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§

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.

Object Safety§

This trait is not object safe.

Implementors§