[][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 --- 2020-01-06

Macros

map

Creates a NumMap in a simiar manner to vec![].

Structs

Drain

The Iterator which visits all non zero values in a NumMap.

HashMap

A hash map implemented with quadratic probing and SIMD lookup.

HashSet

A hash set implemented as a HashMap where the value is ().

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.

Values

The Iterator which visits all non zero values in a NumMap.

Enums

Entry

A view into a single entry in a map, which may either be vacant or occupied.

Traits

NonZero

A marker trait for types which are NonZero numbers.

Number

A marker trait for types which have a NonZero equivilant.

ToNumber

A type which can be converted to a Number.

Type Definitions

DefaultHashBuilder

Default hasher for HashMap.