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§
- Clone
Factory - A
Factorythat creates instances usingT::clone()method. - Default
Factory - A
Factorythat creates instances usingT::default()function. - Swappable
Factory #[cfg(feature = "swappable")]AFactorythat allows for swapping inner factories dynamically.
Traits§
- Factory
- This trait allows for creating any number of instances of the
Itemtype. - Parameterized
Factory - This trait allows for creating any number of instances of the
Itemtype with the given parameter.