Trait di::Injectable
source · pub trait Injectable: Sized {
// Required method
fn inject(lifetime: ServiceLifetime) -> InjectBuilder;
// Provided methods
fn singleton() -> InjectBuilder { ... }
fn scoped() -> InjectBuilder { ... }
fn transient() -> InjectBuilder { ... }
}Available on crate feature
inject only.Expand description
Defines the behavior of an injectable type.
Required Methods§
sourcefn inject(lifetime: ServiceLifetime) -> InjectBuilder
fn inject(lifetime: ServiceLifetime) -> InjectBuilder
Provided Methods§
sourcefn singleton() -> InjectBuilder
fn singleton() -> InjectBuilder
Creates and returns a builder for a singleton injected type.
sourcefn scoped() -> InjectBuilder
fn scoped() -> InjectBuilder
Creates and returns a builder for a scoped injected type.
sourcefn transient() -> InjectBuilder
fn transient() -> InjectBuilder
Creates and returns a builder for a transient injected type.
Object Safety§
This trait is not object safe.