Struct mitochondria::MoveCell
[−]
[src]
pub struct MoveCell<T> { /* fields omitted */ }
A mutable memory location that steals ownership.
Methods
impl<T> MoveCell<T>
[src]
fn new(value: T) -> Self
Creates a new MoveCell
containing value
.
Examples
use mitochondria::MoveCell; let c = MoveCell::new("Hello cytosol!".to_owned());Run
fn into_inner(self) -> T
Consumes the MoveCell
, returning the wrapped value.
Examples
use mitochondria::MoveCell; let c = MoveCell::new("Hello matrix!".to_owned()); let greeting = c.into_inner();Run
fn replace(&self, value: T) -> T
Replaces the value of this cell, returning the old one.
Examples
use mitochondria::MoveCell; let c = MoveCell::new("Hello lysosome!".to_owned()); let greeting = c.replace("Goodbye!".to_owned());Run
fn as_ptr(&self) -> *mut T
Returns a raw pointer to the underlying value in this cell.
Examples
use mitochondria::MoveCell; let c = MoveCell::new("Hello centrosome!".to_owned()); let ptr = c.as_ptr();Run
fn as_mut(&mut self) -> &mut T
Returns a mutable reference to the underlying value.
This call borrows MoveCell
mutably (at compile-time) which
guarantees that we possess the only reference.
use mitochondria::MoveCell; let mut c = MoveCell::new("Porins,".to_owned()); *c.as_mut() += " unite!"; assert_eq!(c.into_inner(), "Porins, unite!");Run
Trait Implementations
impl<T> Send for MoveCell<T> where T: Send
[src]
impl<T: Default> Default for MoveCell<T>
[src]
impl<T> From<T> for MoveCell<T>
[src]
fn from(value: T) -> Self
Performs the conversion.