sortedvec

A pure rust library that exposes a single data type, SortedVec. Its raison d'ĂȘtre is to provide a lookup table that has quicker lookups than regular Vecs, O(log(n)) vs O(n), and is simpler and more memory efficient than hashmaps. It is ideal for (very) small lookup tables where additions and deletions are infrequent.

Example

```rust use sortedvec::SortedVec;

let unsorted = vec![3, 5, 0, 10, 7, 1]; let sorted = SortedVec::from_vec(unsorted.clone(), |&x| x);

// linear search (slow!) let unsortedcontainssix: Option<_> = unsorted.iter().find(|&x| *x == 6); assert!(sortedcontainssix.is_none());

// binary search (fast!) let sortedcontainssix: Option<_> = sorted.find(&6); assert!(sortedcontainssix.is_none()); ```