Struct metafactory::FactoryStable [-]  [+] [src]

pub struct Factory<T: 'static> {
    // some fields omitted
}

A factory proxy.

Factory proxy is used to return a concrete value from unknown source. Factory will always produce a new owned value - any other pattern can be implemented on top of that.

Methods

impl<'a, T: 'static> Factory<T>

fn new(getter: Box<Getter<T> + 'static>) -> Factory<T>

Create a new Factory.

Create a new factory from any type that implements Getter trait.

fn take(&self) -> T

Get a new owned value.

Trait Implementations

impl<'a, T: 'static> Clone for Factory<T>

fn clone(&self) -> Factory<T>

fn clone_from(&mut self, source: &Self)