Provider

Trait Provider 

Source
pub trait Provider<T>: Send + Sync {
    // Required method
    fn provide<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<T, DependencyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Available on crate feature di only.
Expand description

Trait for types that can provide dependencies

This trait is implemented automatically by the #[di_container] macro for container types, but can also be implemented manually for custom providers.

Required Methods§

Source

fn provide<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<T, DependencyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provide an instance of the dependency

Implementors§