pub struct OfferCell<T> { /* private fields */ }Expand description
A data container that can offer optional ownership of its stored information
Implementations§
Source§impl<T> OfferCell<T>
impl<T> OfferCell<T>
Sourcepub fn offer(&mut self) -> Option<Offering<'_, T>>
pub fn offer(&mut self) -> Option<Offering<'_, T>>
Offers optional ownership of the stored data as a Offering item
Sourcepub fn insert_offer(&mut self, item: T) -> Offering<'_, T>
pub fn insert_offer(&mut self, item: T) -> Offering<'_, T>
Inserts item into the cell and returns the item as an offering
Sourcepub fn offer_or_insert(&mut self, insert: impl FnMut() -> T) -> Offering<'_, T>
pub fn offer_or_insert(&mut self, insert: impl FnMut() -> T) -> Offering<'_, T>
Inserts data if there is none currently, then returns the stored data
Sourcepub fn entry(&mut self) -> OfferEntry<'_, T>
pub fn entry(&mut self) -> OfferEntry<'_, T>
Returns an Offering if there is one.
Otherwise returns an EmptyOffering.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for OfferCell<T>where
T: Freeze,
impl<T> RefUnwindSafe for OfferCell<T>where
T: RefUnwindSafe,
impl<T> Send for OfferCell<T>where
T: Send,
impl<T> Sync for OfferCell<T>where
T: Sync,
impl<T> Unpin for OfferCell<T>where
T: Unpin,
impl<T> UnwindSafe for OfferCell<T>where
T: 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
Mutably borrows from an owned value. Read more