Struct mitochondria::MoveCell [] [src]

pub struct MoveCell<T> { /* fields omitted */ }

A mutable memory location that steals ownership.

Methods

impl<T> MoveCell<T>
[src]

Creates a new MoveCell containing value.

Examples

use mitochondria::MoveCell;

let c = MoveCell::new("Hello cytosol!".to_owned());

Consumes the MoveCell, returning the wrapped value.

Examples

use mitochondria::MoveCell;

let c = MoveCell::new("Hello matrix!".to_owned());

let greeting = c.into_inner();

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());

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();

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!");

Trait Implementations

impl<T> Send for MoveCell<T> where
    T: Send
[src]

impl<T: Default> Default for MoveCell<T>
[src]

Returns the "default value" for a type. Read more

impl<T> From<T> for MoveCell<T>
[src]

Performs the conversion.