Trait 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§

Source

fn inject(lifetime: ServiceLifetime) -> InjectBuilder

Creates and returns a builder for an injected type.

§Arguments
  • lifetime - The lifetime of the injected type

Provided Methods§

Source

fn singleton() -> InjectBuilder

Creates and returns a builder for a singleton injected type.

Source

fn scoped() -> InjectBuilder

Creates and returns a builder for a scoped injected type.

Source

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.

Implementors§