Trait shaku::Provider[][src]

pub trait Provider<M: Module>: 'static {
    type Interface: ?Sized;
    fn provide(module: &M) -> Result<Box<Self::Interface>, Box<dyn Error>>;
}

Like Components, providers provide a service by implementing an interface.

Unlike Component, Provider represents a temporary service. Examples include a connection to a remote service or pooled database connection. Because only providers can have other providers as dependencies, services which use these provided services must also be Providers (ex. DB repository, service using a DB repository, etc).

See also the provider getting started guide.

Associated Types

type Interface: ?Sized[src]

The trait/interface which this provider implements

Loading content...

Required methods

fn provide(module: &M) -> Result<Box<Self::Interface>, Box<dyn Error>>[src]

Provides the service, possibly resolving other components/providers to do so.

Loading content...

Implementors

Loading content...