[−][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 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 Iter<'a, K, V>
ⓘImportant traits for Keys<'a, K, V>pub fn keys(&mut self) -> Keys<u64, V>
[src]
ⓘImportant traits for Keys<'a, K, V>
ⓘImportant traits for Values<'a, K, V>pub fn values(&mut self) -> Values<u64, V>
[src]
ⓘImportant traits for Values<'a, K, V>
ⓘImportant traits for IterMut<'a, K, V>pub fn iter_mut<'a>(&mut self) -> IterMut<u64, V>
[src]
ⓘImportant traits for IterMut<'a, K, V>
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]
Auto Trait Implementations
impl<V> Send for IntMap<V> where
V: Send,
V: Send,
impl<V> Unpin for IntMap<V> where
V: Unpin,
V: Unpin,
impl<V> Sync for IntMap<V> where
V: Sync,
V: Sync,
impl<V> RefUnwindSafe for IntMap<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> UnwindSafe for IntMap<V> where
V: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
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> From<T> for 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,