Struct movecell::MoveCell
[−]
[src]
pub struct MoveCell<T>(_);
A container similar to std::cell::Cell
,
but that also supports not-implicitly-copyable types.
Methods
impl<T> MoveCell<T>
[src]
fn new(value: T) -> MoveCell<T>
Create a new MoveCell
containing the given value.
fn into_inner(self) -> T
Consume the MoveCell
and return the inner value.
fn replace(&self, new_value: T) -> T
Return the inner value after replacing it with the given value.
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.
impl<T: Default> MoveCell<T>
[src]
Convenience methods for when there is a default value.
fn take(&self) -> T
Return the inner value after replacing it with the default value.
fn borrow(&self) -> Borrow<T>
Take the value, and return it in a Borrow
guard that will return it when dropped.
The cell’s contents are set to the default value until the guard is dropped.
Trait Implementations
impl<T: Default> Default for MoveCell<T>
[src]
impl<T: Default + Clone> Clone for MoveCell<T>
[src]
The cell’s contents are temporarily set to the default value during the clone.
fn clone(&self) -> MoveCell<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: Default + Debug> Debug for MoveCell<T>
[src]
The cell’s contents are temporarily set to the default value during the formatting.
impl<T: Default + Eq> Eq for MoveCell<T>
[src]
The cell’s contents are temporarily set to the default value during the comparaison.
impl<T: Default + PartialEq> PartialEq for MoveCell<T>
[src]
The cell’s contents are temporarily set to the default value during the comparaison.