Crate factory

Source
Expand description

This crate provides Factory trait and its implementations.

The trait makes it possible to create any number of instances of a specific type.

§Examples

Creates default instances of u8 type:

use factory::{DefaultFactory, Factory};

let f = DefaultFactory::<u8>::new();
assert_eq!(f.create(), 0);
assert_eq!(f.create(), 0);

Structs§

CloneFactory
A Factory that creates instances using T::clone() method.
DefaultFactory
A Factory that creates instances using T::default() function.
SwappableFactory
#[cfg(feature = "swappable")] A Factory that allows for swapping inner factories dynamically.

Traits§

Factory
This trait allows for creating any number of instances of the Item type.
ParameterizedFactory
This trait allows for creating any number of instances of the Item type with the given parameter.