itemizer/lib.rs
1//! **Itemizer** is a data structure that maps items to unique integer IDs. It is used to convert items into unique IDs, and back again.
2//!
3//! The Itemizer is generic over the type of the item, so it can be used with any type that implements the Eq, Hash, Ord, and Clone traits.
4//!
5//! When calling `id_of` on an itemizer, it assigns an index, wrapped in an `Item` struct which represents this value. Using `value_of`, the original value can be retrieved.
6//!
7//! ```rust
8//! use itemizer::Itemizer;
9//!
10//! let mut itemizer = Itemizer::new();
11//! let item1 = itemizer.id_of(&"item1".to_string());
12//! let item2 = itemizer.id_of(&"item2".to_string());
13//!
14//! assert_eq!(itemizer.value_of(&item1), &"item1".to_string());
15//! assert_eq!(itemizer.value_of(&item2), &"item2".to_string());
16//!
17//! ```
18//!
19
20mod item;
21mod itemizer;
22
23pub use item::Item;
24pub use itemizer::Itemizer;