Struct mitochondria::CloningCell [] [src]

pub struct CloningCell<T: NonSelfReferentialClone>(_);

A mutable memory location that clones its contents on retrieval.

Methods

impl<T: NonSelfReferentialClone> CloningCell<T>
[src]

fn new(value: T) -> Self

Creates a new CloningCell containing the given value.

Example

use mitochondria::CloningCell;

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

fn get(&self) -> T

Returns a clone of the contained value.

Example

use mitochondria::CloningCell;

let c = CloningCell::new("Hello lysosome!".to_owned());

let greeting = c.get();

fn set(&self, value: T)

Sets the contained value.

Example

use mitochondria::CloningCell;

let c = CloningCell::new("Hello vacuole!".to_owned());

c.set("Hello cytoskeleton!".to_owned());