[][src]Struct intmap::IntMap

pub struct IntMap<V> { /* fields omitted */ }

Methods

impl<V> IntMap<V>[src]

pub fn new() -> Self[src]

Creates a new IntMap.

Examples

use intmap::IntMap;

let mut map: IntMap<u64> = IntMap::new();

pub fn with_capacity(capacity: usize) -> Self[src]

Creates a new IntMap with a at least capacity, all sizes is a power of 2.

Examples

use intmap::IntMap;

let mut map: IntMap<u64> = IntMap::with_capacity(20);

pub fn insert(&mut self, key: u64, value: V) -> bool[src]

Insert key/value into the IntMap.

Examples

use intmap::IntMap;

let mut map = IntMap::new();
map.insert(21, "Eat my shorts");

pub fn get(&self, key: u64) -> Option<&V>[src]

Get value from the IntMap.

Examples

use intmap::IntMap;

let mut map: IntMap<u64> = IntMap::new();
map.insert(21, 42);
let val = map.get(21);
assert!(val.is_some());
assert_eq!(*val.unwrap(), 42);
assert!(map.contains_key(21));

pub fn get_mut(&mut self, key: u64) -> Option<&mut V>[src]

Get mutable value from the IntMap.

Examples

use intmap::IntMap;

let mut map: IntMap<u64> = IntMap::new();
map.insert(21, 42);

assert_eq!(*map.get(21).unwrap(), 42);
assert!(map.contains_key(21));

{
    let mut val = map.get_mut(21).unwrap();
    *val+=1;
}
    assert_eq!(*map.get(21).unwrap(), 43);

pub fn remove(&mut self, key: u64) -> Option<V>[src]

Remove value from the IntMap.

Examples

use intmap::IntMap;

let mut map: IntMap<u64> = IntMap::new();
map.insert(21, 42);
let val = map.remove(21);
assert!(val.is_some());
assert_eq!(val.unwrap(), 42);
assert!(!map.contains_key(21));

pub fn contains_key(&self, key: u64) -> bool[src]

Returns true if key is in map.

Examples

use intmap::IntMap;

let mut map: IntMap<u64> = IntMap::new();
map.insert(21, 42);
assert!(map.contains_key(21));

pub fn clear(&mut self)[src]

Removes all elements from map.

Examples

use intmap::IntMap;

let mut map: IntMap<u64> = IntMap::new();
map.insert(21, 42);
map.clear();
assert_eq!(map.len(), 0);

pub fn is_empty(&mut self) -> bool[src]

Returns true if map is empty

Examples

use intmap::IntMap;

let mut map: IntMap<u64> = IntMap::new();
map.insert(21, 42);
assert!(!map.is_empty());
map.remove(21);
assert!(map.is_empty());

Important traits for Iter<'a, K, V>
pub fn iter<'a>(&self) -> Iter<u64, V>[src]

Important traits for Keys<'a, K, V>
pub fn keys(&mut self) -> Keys<u64, V>[src]

Important traits for Values<'a, K, V>
pub fn values(&mut self) -> Values<u64, V>[src]

Important traits for IterMut<'a, K, V>
pub fn iter_mut<'a>(&mut self) -> IterMut<u64, V>[src]

pub fn len(&self) -> usize[src]

Number of elements in map.

pub fn load(&self) -> u64[src]

Force count number of slots filled.

pub fn load_rate(&self) -> f64[src]

pub fn capacity(&self) -> usize[src]

Total number of slots available.

pub fn assert_count(&self) -> bool[src]

pub fn collisions(&self) -> IntMap<u64>[src]

Trait Implementations

impl<V> IntoIterator for IntMap<V>[src]

type Item = (u64, V)

The type of the elements being iterated over.

type IntoIter = IntoIter<u64, V>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<V> Send for IntMap<V> where
    V: Send

impl<V> Sync for IntMap<V> where
    V: Sync

impl<V> Unpin for IntMap<V> where
    V: Unpin

impl<V> RefUnwindSafe for IntMap<V> where
    V: RefUnwindSafe

impl<V> UnwindSafe for IntMap<V> where
    V: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]