mofurun 0.4.0

Multi variant Optimized Fun U....okay Mofu is just a cute name okay. Experimental implementation of Vec that stores the state of the underlying array through its enum.
Documentation
  • Coverage
  • 28.57%
    4 out of 14 items documented3 out of 10 items with examples
  • Size
  • Source code size: 15.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.94 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hbina

🧸 Mofurun 🧸

🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸

Experimental implementation of Vec that stores the state of the underlying array using types.

This allows us to optimize some operations based on its state.

🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸🧸

Example

For the simplest case, consider finding the maximum value in a vector.

use mofurun::{sorted_vec::SortedVec, unsorted_vec::UnsortedVec};
pub fn main() {
    // Although we began with a sorted vector, we ended up with an unsorted vector.
    let s : UnsortedVec<i32> = SortedVec::default()
        .push(5)
        .push(4)
        .push(3)
        .push(2)
        .push(1)
        .push(0);
    // Recover sorted vector.
    let s : SortedVec<i32> = s.sort();
}

I think there are many, many more containers like this and I am generally interested in the idea of using structs to force the logic of a program.