[−][src]Crate nummap
Defines the NumMap struct which acts as if all unmapped keys have a value of 0.
let mut map = map![(1, 2), (3, 4)]; //We have set no mapping but we still get 0. assert_eq!(map.get(&0,), 0,); //We didn't set a mapping here either but we still get 0. assert_eq!(map.set(0, 10,), 0,); assert_eq!(map.get(&0,), 10,);
Since all keys are considered mapped arithmetic is implemented on values.
let map = map![(1, 2), (3, 4)] + map![(1, 4), (3, 2)]; assert_eq!(map, map![(1, 3), (3, 3)] * 2,);
Author --- daniel.bechaz@gmail.com
Last Moddified --- 2019-05-17
Macros
map | Creates a |
Structs
Drain | The Iterator which visits all non zero values in a NumMap. |
IntoIter | The IntoIterator type which visits all non zero values from a NumMap. |
Iter | The Iterator which visits all non zero values in a NumMap. |
NumMap | A map of numbers where all keys are considered mapped but 0 values are not stored. |
Traits
NonZero | A marker trait for types which are |
Number | A marker trait for types which have a NonZero equivilant. |