pub enum OwnableCell<T> {
Available(T),
Taken,
}Expand description
A simple container implementation of Ownable, holds the item in the Available variant.
Variants§
Trait Implementations§
Source§impl<T> Ownable for OwnableCell<T>
Defines a Cell that holds a number, takes and mutates it and then reads from the Cell again.
impl<T> Ownable for OwnableCell<T>
Defines a Cell that holds a number, takes and mutates it and then reads from the Cell again.
§Examples
let mut source = OwnableCell::Available(100);
{
let mut guard = item.take();
*guard.unwrap() += 100;
}
assert_eq!(200, source.read().unwrap());Auto Trait Implementations§
impl<T> Freeze for OwnableCell<T>where
T: Freeze,
impl<T> RefUnwindSafe for OwnableCell<T>where
T: RefUnwindSafe,
impl<T> Send for OwnableCell<T>where
T: Send,
impl<T> Sync for OwnableCell<T>where
T: Sync,
impl<T> Unpin for OwnableCell<T>where
T: Unpin,
impl<T> UnwindSafe for OwnableCell<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