Struct lockjaw::Provider[][src]

pub struct Provider<'a, T> { /* fields omitted */ }
Expand description

Creates a binding on demand

T will be created each time Provider.get() is called, allowing multiple instances to be created.

This also prevents creating T immediately when constructing an object that depends on T, which allows lazy initialization and can break cyclic dependency.

WARNING: calling Provider.get() in a constructor can lead to stackoverflow, and is best avoided.

If only a single cached instance is needed, consider using Lazy<T>(Lazy) instead.

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.