Enum Entry
pub enum Entry<'a, T, A = Global>
where
A: Allocator,
A view into a single entry in a table, which may either be vacant or occupied.
This enum is constructed from the entry method on HashTable.
Examples
#
#
#
Variants
-
Occupied(OccupiedEntry<'a, T, A>) An occupied entry.
Examples
# # #-
Vacant(VacantEntry<'a, T, A>) A vacant entry.
Examples
# # #
Implementations
impl<'a, T, A> Entry<'a, T, A>
where
A: Allocator,
fn insert(self, value: T) -> OccupiedEntry<'a, T, A>Sets the value of the entry, replacing any existing value if there is one, and returns an
OccupiedEntry.Examples
# # #fn or_insert(self, default: T) -> OccupiedEntry<'a, T, A>Ensures a value is in the entry by inserting if it was vacant.
Returns an
OccupiedEntrypointing to the now-occupied entry.Examples
# # #fn or_insert_with(self, default: impl FnOnce() -> T) -> OccupiedEntry<'a, T, A>Ensures a value is in the entry by inserting the result of the default function if empty..
Returns an
OccupiedEntrypointing to the now-occupied entry.Examples
# # #fn and_modify(self, f: impl FnOnce(&mut T)) -> SelfProvides in-place mutable access to an occupied entry before any potential inserts into the table.
Examples
# # #fn into_table(self) -> &'a mut HashTable<T, A>Converts the
Entryinto a mutable reference to the underlying table.
Trait Implementations
impl<T: Debug, A: Allocator> Debug for Entry<'_, T, A>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<'a, T, A = Global> !UnwindSafe for Entry<'a, T, A>
impl<'a, T, A> Freeze for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: Freeze,
VacantEntry<'a, T, A>: Freeze,
impl<'a, T, A> RefUnwindSafe for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: RefUnwindSafe,
VacantEntry<'a, T, A>: RefUnwindSafe,
impl<'a, T, A> Send for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: Send,
VacantEntry<'a, T, A>: Send,
impl<'a, T, A> Sync for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: Sync,
VacantEntry<'a, T, A>: Sync,
impl<'a, T, A> Unpin for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: Unpin,
VacantEntry<'a, T, A>: Unpin,
impl<'a, T, A> UnsafeUnpin for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: UnsafeUnpin,
VacantEntry<'a, T, A>: UnsafeUnpin,
Blanket Implementations
impl<T> Any for Entry<'a, T, A>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Entry<'a, T, A>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Entry<'a, T, A>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Entry<'a, T, A>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Entry<'a, T, A>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Entry<'a, T, A>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Entry<'a, T, A>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>