Skip to main content

Injectable

Trait Injectable 

Source
pub trait Injectable:
    Sized
    + Send
    + Sync
    + 'static {
    // Required method
    fn construct(r: Resolver) -> BoxFuture<'static, Result<Self, KernelError>>;

    // Provided methods
    fn scope() -> Scope { ... }
    fn dependencies() -> Vec<ProviderKey> { ... }
}
Expand description

A type the container can construct (what #[injectable] implements).

Required Methods§

Source

fn construct(r: Resolver) -> BoxFuture<'static, Result<Self, KernelError>>

Builds the value, resolving dependencies through r.

Provided Methods§

Source

fn scope() -> Scope

The provider scope; singletons by default.

Source

fn dependencies() -> Vec<ProviderKey>

The keys construct resolves, used by the boot-time graph check. Keys resolved through Lazy are left out.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§