[][src]Struct factory::CloneFactory

pub struct CloneFactory<T>(_);

A Factory that creates instances using T::clone() method.


use factory::{CloneFactory, Factory};

let f = CloneFactory::new(10);
assert_eq!(f.create(), 10);


impl<T: Clone> CloneFactory<T>[src]

pub fn new(original: T) -> Self[src]

Makes a new CloneFactory.

The instances the factory creates are copied from original.

pub fn get_ref(&self) -> &T[src]

Returns a reference to the original instance.

pub fn get_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the original instance.

Trait Implementations

impl<T: Clone> Factory for CloneFactory<T>[src]

type Item = T

The type of instances created by this factory.

impl<T: Clone> Clone for CloneFactory<T>[src]

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

Performs copy-assignment from source. Read more

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

impl<T: Debug> Debug for CloneFactory<T>[src]

Auto Trait Implementations

impl<T> Send for CloneFactory<T> where
    T: Send

impl<T> Sync for CloneFactory<T> where
    T: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone

type Owned = T

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 

impl<T, U> TryFrom for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> BorrowMut for T where
    T: ?Sized

impl<T, U> TryInto for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.