Skip to main content

Factory

Trait Factory 

Source
pub trait Factory: Sized + 'static {
    // Required method
    fn definition() -> Self;

    // Provided method
    fn factory() -> FactoryBuilder<Self> { ... }
}
Expand description

Implement this on a model to enable the factory DSL.

The definition() method returns a default instance with fake data.

Required Methods§

Source

fn definition() -> Self

Return a model instance filled with fake/default data.

Provided Methods§

Source

fn factory() -> FactoryBuilder<Self>

Access the FactoryBuilder for this model.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§