pub struct EventIdMap<E, V>(/* private fields */)
where
E: Borrow<EventId>;state-res only.Expand description
A map of event IDs to a type V.
Implementations§
Source§impl<E, V> EventIdMap<E, V>
impl<E, V> EventIdMap<E, V>
Sourcepub fn new() -> EventIdMap<E, V>
pub fn new() -> EventIdMap<E, V>
Create an empty EventIdMap.
Sourcepub fn with_capacity(capacity: usize) -> EventIdMap<E, V>
pub fn with_capacity(capacity: usize) -> EventIdMap<E, V>
Create an empty EventIdMap with the given capacity.
Sourcepub fn iter(&self) -> EventIdMapIter<'_, E, V> ⓘ
pub fn iter(&self) -> EventIdMapIter<'_, E, V> ⓘ
Gets an iterator over the entries of the map.
Sourcepub fn keys(&self) -> EventIdMapKeys<'_, E, V> ⓘ
pub fn keys(&self) -> EventIdMapKeys<'_, E, V> ⓘ
Gets an iterator over the keys of the map.
Sourcepub fn into_keys(self) -> EventIdMapIntoKeys<E, V> ⓘ
pub fn into_keys(self) -> EventIdMapIntoKeys<E, V> ⓘ
Gets an iterator over the keys of the map.
Sourcepub fn values(&self) -> EventIdMapValues<'_, E, V> ⓘ
pub fn values(&self) -> EventIdMapValues<'_, E, V> ⓘ
Gets an iterator over the values of the map.
Sourcepub fn into_values(self) -> EventIdMapIntoValues<E, V> ⓘ
pub fn into_values(self) -> EventIdMapIntoValues<E, V> ⓘ
Gets an iterator over the values of the map.
Source§impl<E, V> EventIdMap<E, V>
impl<E, V> EventIdMap<E, V>
Sourcepub fn contains_event_id(&self, event_id: &EventId) -> bool
pub fn contains_event_id(&self, event_id: &EventId) -> bool
Returns true if the map contains a value for the specified event ID.
Sourcepub fn get(&self, event_id: &EventId) -> Option<&V>
pub fn get(&self, event_id: &EventId) -> Option<&V>
Returns a reference to the value corresponding to given event ID.
Sourcepub fn get_mut(&mut self, event_id: &EventId) -> Option<&mut V>
pub fn get_mut(&mut self, event_id: &EventId) -> Option<&mut V>
Returns a mutable reference to the value corresponding to given event ID.
Sourcepub fn get_key_value(&self, event_id: &EventId) -> Option<(&E, &V)>
pub fn get_key_value(&self, event_id: &EventId) -> Option<(&E, &V)>
Returns the key-value pair corresponding to the supplied event ID.
Sourcepub fn entry(&mut self, event_id: E) -> EventIdMapEntry<'_, E, V>
pub fn entry(&mut self, event_id: E) -> EventIdMapEntry<'_, E, V>
Gets the given event ID’s corresponding entry in the map for in-place manipulation.
Sourcepub fn insert(&mut self, event_id: E, value: V) -> Option<V>
pub fn insert(&mut self, event_id: E, value: V) -> Option<V>
Inserts a key-value pair into the map.
If the map did not have this event ID present, None is returned.
If the map did have this event ID present, the value is updated, and the old value is returned.
Sourcepub fn remove(&mut self, event_id: &EventId) -> Option<V>
pub fn remove(&mut self, event_id: &EventId) -> Option<V>
Removes an event ID from the map, returning the value at the event ID if the event ID was previously in the map.
Sourcepub fn remove_entry(&mut self, event_id: &EventId) -> Option<(E, V)>
pub fn remove_entry(&mut self, event_id: &EventId) -> Option<(E, V)>
Removes an event ID from the map, returning the stored event ID and value if the event ID was previously in the map.
Trait Implementations§
Source§impl<E, V> Clone for EventIdMap<E, V>
impl<E, V> Clone for EventIdMap<E, V>
Source§fn clone(&self) -> EventIdMap<E, V>
fn clone(&self) -> EventIdMap<E, V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<E, V> Debug for EventIdMap<E, V>
impl<E, V> Debug for EventIdMap<E, V>
Source§impl<E, V> Default for EventIdMap<E, V>
impl<E, V> Default for EventIdMap<E, V>
Source§fn default() -> EventIdMap<E, V>
fn default() -> EventIdMap<E, V>
Source§impl<E, V> Extend<(E, V)> for EventIdMap<E, V>
impl<E, V> Extend<(E, V)> for EventIdMap<E, V>
Source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = (E, V)>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = (E, V)>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<E, V> FromIterator<(E, V)> for EventIdMap<E, V>
impl<E, V> FromIterator<(E, V)> for EventIdMap<E, V>
Source§fn from_iter<T>(iter: T) -> EventIdMap<E, V>where
T: IntoIterator<Item = (E, V)>,
fn from_iter<T>(iter: T) -> EventIdMap<E, V>where
T: IntoIterator<Item = (E, V)>,
Source§impl<E, V> Index<&EventId> for EventIdMap<E, V>
impl<E, V> Index<&EventId> for EventIdMap<E, V>
Source§impl<'a, E, V> IntoIterator for &'a EventIdMap<E, V>
impl<'a, E, V> IntoIterator for &'a EventIdMap<E, V>
Source§impl<E, V> IntoIterator for EventIdMap<E, V>
impl<E, V> IntoIterator for EventIdMap<E, V>
Source§type IntoIter = EventIdMapIntoIter<E, V>
type IntoIter = EventIdMapIntoIter<E, V>
Source§fn into_iter(self) -> <EventIdMap<E, V> as IntoIterator>::IntoIter
fn into_iter(self) -> <EventIdMap<E, V> as IntoIterator>::IntoIter
Auto Trait Implementations§
impl<E, V> Freeze for EventIdMap<E, V>
impl<E, V> RefUnwindSafe for EventIdMap<E, V>where
E: RefUnwindSafe,
V: RefUnwindSafe,
impl<E, V> Send for EventIdMap<E, V>
impl<E, V> Sync for EventIdMap<E, V>
impl<E, V> Unpin for EventIdMap<E, V>
impl<E, V> UnsafeUnpin for EventIdMap<E, V>
impl<E, V> UnwindSafe for EventIdMap<E, V>where
E: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more