mirror of
https://github.com/TECHNOFAB11/aerosol.git
synced 2025-12-12 08:00:08 +01:00
Add support for dependencies of dependencies
This commit is contained in:
parent
f47d3a417d
commit
cc46fbe621
4 changed files with 43 additions and 12 deletions
|
|
@ -52,7 +52,7 @@
|
|||
//! struct StdoutLoggerFactory;
|
||||
//! impl aerosol::Factory for StdoutLoggerFactory {
|
||||
//! type Object = Arc<Logger>;
|
||||
//! fn build() -> Result<Arc<Logger>, failure::Error> {
|
||||
//! fn build(_: ()) -> Result<Arc<Logger>, failure::Error> {
|
||||
//! Ok(Arc::new(StdoutLogger))
|
||||
//! }
|
||||
//! }
|
||||
|
|
@ -116,9 +116,9 @@ pub trait Provide<T> {
|
|||
|
||||
/// Implement this trait to provide a convenient syntax for
|
||||
/// constructing implementations of dependencies.
|
||||
pub trait Factory {
|
||||
pub trait Factory<Args=()> {
|
||||
type Object;
|
||||
fn build() -> Result<Self::Object, failure::Error>;
|
||||
fn build(args: Args) -> Result<Self::Object, failure::Error>;
|
||||
}
|
||||
|
||||
/// Allows cloning a context whilst replacing one dependency
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue