🧸 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.

rust 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.