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.
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.