Skip to main content

Injectable

Trait Injectable 

Source
pub trait Injectable:
    Send
    + Sync
    + 'static {
    // Required methods
    fn create(container: &Container) -> BoxFuture<'_, Result<Self>>
       where Self: Sized;
    fn dependencies() -> Vec<ProviderDependency>
       where Self: Sized;

    // Provided methods
    fn on_module_init(&self) -> BoxFuture<'_, Result<()>> { ... }
    fn on_bootstrap(&self) -> BoxFuture<'_, Result<()>> { ... }
    fn on_shutdown(&self) -> BoxFuture<'_, Result<()>> { ... }
}
Expand description

Re-exported public API. Public Caelix extension trait Injectable.

Required Methods§

Source

fn create(container: &Container) -> BoxFuture<'_, Result<Self>>
where Self: Sized,

Public Caelix API.

Source

fn dependencies() -> Vec<ProviderDependency>
where Self: Sized,

Dependencies resolved while constructing this provider.

#[injectable] supplies this automatically. Handwritten implementations must return provider_dependencies![...]; Caelix rejects construction-time resolution of a provider that is absent from this declaration.

Provided Methods§

Source

fn on_module_init(&self) -> BoxFuture<'_, Result<()>>

Public Caelix API.

Source

fn on_bootstrap(&self) -> BoxFuture<'_, Result<()>>

Public Caelix API.

Source

fn on_shutdown(&self) -> BoxFuture<'_, Result<()>>

Public Caelix API.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§