[−][src]Struct factory::CloneFactory
A Factory
that creates instances using T::clone()
method.
Examples
use factory::{CloneFactory, Factory}; let f = CloneFactory::new(10); assert_eq!(f.create(), 10);
Methods
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]
impl<T: Clone> Clone for CloneFactory<T>
[src]
fn clone(&self) -> CloneFactory<T>
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Default> Default for CloneFactory<T>
[src]
fn default() -> CloneFactory<T>
[src]
impl<T: Debug> Debug for CloneFactory<T>
[src]
Auto Trait Implementations
impl<T> Send for CloneFactory<T> where
T: Send,
T: Send,
impl<T> Sync for CloneFactory<T> where
T: Sync,
T: Sync,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,