pub struct Entry<'a, R, ChunkKey, ItemKey, Element>where
R: Record<ChunkKey, ItemKey> + 'a,
ChunkKey: BorrowedKey + ?Sized,
ChunkKey::Owned: ValidKey,
ItemKey: BorrowedKey + ?Sized,
ItemKey::Owned: ValidKey,{ /* private fields */ }Expand description
An Entry for an element. This is intended to work in the same way as the Entries from
rust’s standard collections API. An Entry refers to an element that we have tried to
look up and might or might not have found.
§Type Parameters
R: The key used to lookup thisEntryChunkKey: The chunk key type of the backingStorageItemKey: The item key type of the backingStorageElement: The element type of the backingStorage, and also theElementrepresented by thisEntry.
Implementations§
Source§impl<'a, R, ChunkKey, ItemKey, Element> Entry<'a, R, ChunkKey, ItemKey, Element>where
R: Record<ChunkKey, ItemKey> + 'a,
ChunkKey: BorrowedKey + ?Sized,
ChunkKey::Owned: ValidKey,
ItemKey: BorrowedKey + ?Sized,
ItemKey::Owned: ValidKey,
Element: Record<ChunkKey, ItemKey>,
impl<'a, R, ChunkKey, ItemKey, Element> Entry<'a, R, ChunkKey, ItemKey, Element>where
R: Record<ChunkKey, ItemKey> + 'a,
ChunkKey: BorrowedKey + ?Sized,
ChunkKey::Owned: ValidKey,
ItemKey: BorrowedKey + ?Sized,
ItemKey::Owned: ValidKey,
Element: Record<ChunkKey, ItemKey>,
Sourcepub fn id(&self) -> &R
pub fn id(&self) -> &R
Returns the value whose ChunkKey and ItemKey is used to look up this Entry.
Sourcepub fn or_insert_with<F>(self, f: F) -> &'a mut Elementwhere
F: FnOnce() -> Element,
pub fn or_insert_with<F>(self, f: F) -> &'a mut Elementwhere
F: FnOnce() -> Element,
Insert a record at this entry if it does not already exist.
Sourcepub fn and_modify<F>(self, f: F) -> Selfwhere
F: FnOnce(&mut Element),
pub fn and_modify<F>(self, f: F) -> Selfwhere
F: FnOnce(&mut Element),
Modify this element if it exists. If the element does not exist, nothing happens.
Sourcepub fn get_mut(&mut self) -> Option<&mut Element>
pub fn get_mut(&mut self) -> Option<&mut Element>
Get a mutable reference to the element.
Auto Trait Implementations§
impl<'a, R, ChunkKey, ItemKey, Element> Freeze for Entry<'a, R, ChunkKey, ItemKey, Element>
impl<'a, R, ChunkKey, ItemKey, Element> RefUnwindSafe for Entry<'a, R, ChunkKey, ItemKey, Element>where
<ItemKey as ToOwned>::Owned: Sized + RefUnwindSafe,
<ChunkKey as ToOwned>::Owned: Sized + RefUnwindSafe,
R: RefUnwindSafe,
Element: RefUnwindSafe,
ChunkKey: ?Sized,
ItemKey: ?Sized,
impl<'a, R, ChunkKey, ItemKey, Element> Send for Entry<'a, R, ChunkKey, ItemKey, Element>
impl<'a, R, ChunkKey, ItemKey, Element> Sync for Entry<'a, R, ChunkKey, ItemKey, Element>
impl<'a, R, ChunkKey, ItemKey, Element> Unpin for Entry<'a, R, ChunkKey, ItemKey, Element>
impl<'a, R, ChunkKey, ItemKey, Element> !UnwindSafe for Entry<'a, R, ChunkKey, ItemKey, Element>
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
Mutably borrows from an owned value. Read more