pub enum Entry<'a, T: 'static> {
Occupied(OccupiedEntry<'a, T>),
Vacant(VacantEntry<'a, T>),
}
Expand description
A view into a thread’s slot in a ThreadLocal
that may be empty.
Variants§
Implementations§
Source§impl<'a, T: 'static> Entry<'a, T>
impl<'a, T: 'static> Entry<'a, T>
Sourcepub fn or_insert(self, default: T) -> &'a mut T
pub fn or_insert(self, default: T) -> &'a mut T
Ensures a value is in the entry by inserting the default if it is empty, and returns a mutable reference to the value in the entry.
Sourcepub fn or_insert_with<F>(self, default: F) -> &'a mut Twhere
F: FnOnce() -> T,
pub fn or_insert_with<F>(self, default: F) -> &'a mut Twhere
F: FnOnce() -> T,
Ensures a value is in the entry by inserting the result of the default function if it is empty, and returns a mutable reference to the value in the entry.
Auto Trait Implementations§
impl<'a, T> Freeze for Entry<'a, T>
impl<'a, T> !RefUnwindSafe for Entry<'a, T>
impl<'a, T> !Send for Entry<'a, T>
impl<'a, T> !Sync for Entry<'a, T>
impl<'a, T> Unpin for Entry<'a, T>
impl<'a, T> !UnwindSafe for Entry<'a, T>
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