pub enum Entry<'a, T: IdOrdItem> {
Vacant(VacantEntry<'a, T>),
Occupied(OccupiedEntry<'a, T>),
}
Expand description
An implementation of the Entry API for IdOrdMap
.
Variants§
Implementations§
Source§impl<'a, T: IdOrdItem> Entry<'a, T>
impl<'a, T: IdOrdItem> Entry<'a, T>
Sourcepub fn or_insert_ref(self, default: T) -> &'a T
pub fn or_insert_ref(self, default: T) -> &'a T
Ensures a value is in the entry by inserting the default if empty, and returns a shared reference to the value in the entry.
§Panics
Panics if the key is already present in the map. (The intention is that
the key should be what was passed into IdOrdMap::entry
, but that
isn’t checked in this API due to borrow checker limitations.)
Sourcepub fn or_insert(self, default: T) -> RefMut<'a, T>
pub fn or_insert(self, default: T) -> RefMut<'a, T>
Ensures a value is in the entry by inserting the default if empty, and returns a mutable reference to the value in the entry.
§Panics
Panics if the key is already present in the map. (The intention is that
the key should be what was passed into IdOrdMap::entry
, but that
isn’t checked in this API due to borrow checker limitations.)
Sourcepub fn or_insert_with_ref<F: FnOnce() -> T>(self, default: F) -> &'a T
pub fn or_insert_with_ref<F: FnOnce() -> T>(self, default: F) -> &'a T
Ensures a value is in the entry by inserting the result of the default function if empty, and returns a shared reference to the value in the entry.
§Panics
Panics if the key is already present in the map. (The intention is that
the key should be what was passed into IdOrdMap::entry
, but that
isn’t checked in this API due to borrow checker limitations.)
Sourcepub fn or_insert_with<F: FnOnce() -> T>(self, default: F) -> RefMut<'a, T>
pub fn or_insert_with<F: FnOnce() -> T>(self, default: F) -> RefMut<'a, T>
Ensures a value is in the entry by inserting the result of the default function if empty, and returns a mutable reference to the value in the entry.
§Panics
Panics if the key is already present in the map. (The intention is that
the key should be what was passed into IdOrdMap::entry
, but that
isn’t checked in this API due to borrow checker limitations.)