pub trait Provider<M: Module>: 'static {
type Interface: ?Sized;
// Required method
fn provide(module: &M) -> Result<Box<Self::Interface>, Box<dyn Error>>;
}
Expand description
Like Component
s, 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 Provider
s
(ex. DB repository, service using a DB repository, etc).
See also the provider getting started guide.
Required Associated Types§
Required Methods§
Object Safety§
This trait is not object safe.