pub struct MoveCell<T>(/* private fields */);
Expand description
A container similar to std::cell::Cell
,
but that also supports not-implicitly-copyable types.
Implementations§
Source§impl<T> MoveCell<T>
impl<T> MoveCell<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the MoveCell
and return the inner value.
Sourcepub fn replace(&self, new_value: T) -> T
pub fn replace(&self, new_value: T) -> T
Return the inner value after replacing it with the given value.
Sourcepub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T>
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T>
Returns a reference to the underlying UnsafeCell
.
§Unsafety
This method is unsafe because UnsafeCell
’s field is public.
Trait Implementations§
Source§impl<T: Default + Clone> Clone for MoveCell<T>
The cell’s contents are temporarily set to the default value during the clone.
impl<T: Default + Clone> Clone for MoveCell<T>
The cell’s contents are temporarily set to the default value during the clone.
Source§impl<T: Default + Debug> Debug for MoveCell<T>
The cell’s contents are temporarily set to the default value during the formatting.
impl<T: Default + Debug> Debug for MoveCell<T>
The cell’s contents are temporarily set to the default value during the formatting.
Source§impl<T: Default + PartialEq> PartialEq for MoveCell<T>
The cell’s contents are temporarily set to the default value during the comparaison.
impl<T: Default + PartialEq> PartialEq for MoveCell<T>
The cell’s contents are temporarily set to the default value during the comparaison.
impl<T: Default + Eq> Eq for MoveCell<T>
The cell’s contents are temporarily set to the default value during the comparaison.
Auto Trait Implementations§
impl<T> !Freeze for MoveCell<T>
impl<T> !RefUnwindSafe for MoveCell<T>
impl<T> Send for MoveCell<T>where
T: Send,
impl<T> !Sync for MoveCell<T>
impl<T> Unpin for MoveCell<T>where
T: Unpin,
impl<T> UnwindSafe for MoveCell<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