[−][src]Struct one_way_slot_map::SlotMap
Simple and naive map that keeps elements in slots that can be accessed by id and that id is guaranteed not to change over time
Implementations
impl<K, P, T> SlotMap<K, P, T> where
K: SlotMapKey<P>,
[src]
K: SlotMapKey<P>,
pub fn new() -> SlotMap<K, P, T>
[src]
Create a new default simple slot map
pub fn len(&self) -> usize
[src]
Get the number of items in the slot map
pub fn insert(&mut self, pointer: P, value: T) -> K
[src]
insert the given item into the slot map and return its key
pub fn get(&self, key: &K) -> Option<&T>
[src]
Get the value for the given key if there is one
pub fn get_mut(&mut self, key: &K) -> Option<&mut T>
[src]
Get the value for the given key if there is one
pub fn remove(&mut self, key: &K) -> Option<&mut T>
[src]
Remove the item at the given index and return true iff successful
pub fn clear(&mut self)
[src]
Clears all the values in the slot map
pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'a T>
[src]
Construct an iterator over all the values in the slot map
pub fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = &'a mut T>
[src]
Construct an iterator over all the values in the slot map as mutable references
Trait Implementations
impl<K, P, T> Debug for SlotMap<K, P, T> where
T: Debug,
K: SlotMapKey<P>,
[src]
T: Debug,
K: SlotMapKey<P>,
Auto Trait Implementations
impl<K, P, T> RefUnwindSafe for SlotMap<K, P, T> where
K: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
K: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<K, P, T> Send for SlotMap<K, P, T> where
K: Send,
P: Send,
T: Send,
K: Send,
P: Send,
T: Send,
impl<K, P, T> Sync for SlotMap<K, P, T> where
K: Sync,
P: Sync,
T: Sync,
K: Sync,
P: Sync,
T: Sync,
impl<K, P, T> Unpin for SlotMap<K, P, T> where
K: Unpin,
P: Unpin,
K: Unpin,
P: Unpin,
impl<K, P, T> UnwindSafe for SlotMap<K, P, T> where
K: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
K: UnwindSafe,
P: UnwindSafe,
T: 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<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>,