[−][src]Struct intmap::IntMap
Methods
impl<V> IntMap<V>[src]
pub fn new() -> Self[src]
pub fn with_capacity(capacity: usize) -> Self[src]
Creates a new IntMap with at least the given capacity, rounded to the next power of two.
Examples
use intmap::IntMap; let mut map: IntMap<u64> = IntMap::with_capacity(20);
pub fn reserve(&mut self, additional: usize)[src]
Ensures that the IntMap has space for at least additional more elements
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());
pub fn iter(&self) -> Iter<u64, V>[src]
pub fn iter_mut(&mut self) -> IterMut<u64, V>[src]
pub fn keys(&self) -> Keys<u64, V>[src]
pub fn values(&self) -> Values<u64, V>[src]
pub fn values_mut(&mut self) -> ValuesMut<u64, V>[src]
pub fn drain(&mut self) -> Drain<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: Clone> Clone for IntMap<V>[src]
impl<V> Debug for IntMap<V> where
V: Debug, [src]
V: Debug,
impl<V> Eq for IntMap<V> where
V: Eq, [src]
V: Eq,
impl<V> Extend<(u64, V)> for IntMap<V>[src]
impl<V> FromIterator<(u64, V)> for IntMap<V>[src]
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?
fn into_iter(self) -> Self::IntoIter[src]
impl<V> PartialEq<IntMap<V>> for IntMap<V> where
V: PartialEq, [src]
V: PartialEq,
Auto Trait Implementations
impl<V> RefUnwindSafe for IntMap<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> Send for IntMap<V> where
V: Send,
V: Send,
impl<V> Sync for IntMap<V> where
V: Sync,
V: Sync,
impl<V> Unpin for IntMap<V> where
V: Unpin,
V: Unpin,
impl<V> UnwindSafe for IntMap<V> where
V: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator, [src]
I: Iterator,
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?
fn into_iter(self) -> I[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,