Trait coi::Provide

source ·
pub trait Provide {
    type Output: Inject + ?Sized;

    // Required methods
    fn provide(&self, container: &Container) -> Result<Arc<Self::Output>>;
    fn dependencies(&self) -> &'static [&'static str];
}
Expand description

A trait to manage the construction of an injectable trait or struct.

Required Associated Types§

source

type Output: Inject + ?Sized

The type that this provider will produce when resolved from a Container.

Required Methods§

source

fn provide(&self, container: &Container) -> Result<Arc<Self::Output>>

Only intended to be used internally

source

fn dependencies(&self) -> &'static [&'static str]

Available on crate feature debug only.

Return list of dependencies

Implementations on Foreign Types§

source§

impl<T> Provide for (&'static [&'static str], dyn Fn(&Container) -> Result<Arc<T>>)
where T: Inject + ?Sized,

Available on crate feature debug only.
§

type Output = T

source§

fn provide(&self, container: &Container) -> Result<Arc<Self::Output>>

source§

fn dependencies(&self) -> &'static [&'static str]

source§

impl<T, F> Provide for (&'static [&'static str], F)
where F: Fn(&Container) -> Result<Arc<T>>, T: Inject + ?Sized,

Available on crate feature debug only.
§

type Output = T

source§

fn provide(&self, container: &Container) -> Result<Arc<Self::Output>>

source§

fn dependencies(&self) -> &'static [&'static str]

Implementors§