diff options
author | HampusM <hampus@hampusmat.com> | 2022-09-24 16:14:45 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-09-24 16:14:45 +0200 |
commit | 2a44ec3ffdcd78b23ac31b722b4312774d643c3a (patch) | |
tree | d3056a1fffe6311f863c4d683cc3444507c3e7d8 /examples/async/bootstrap.rs | |
parent | 695f90bf900015df1e2728445f833dabced838a9 (diff) |
refactor!: remove repetition of declaring factory interfaces
BREAKING CHANGE: The to_default_factory method of the blocking and async DI containers now expect a function returning another function
Diffstat (limited to 'examples/async/bootstrap.rs')
-rw-r--r-- | examples/async/bootstrap.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/async/bootstrap.rs b/examples/async/bootstrap.rs index 51af067..dd2febe 100644 --- a/examples/async/bootstrap.rs +++ b/examples/async/bootstrap.rs @@ -30,9 +30,11 @@ pub async fn bootstrap() -> Result<Arc<AsyncDIContainer>> di_container .bind::<dyn ICat>() .to_default_factory(&|_| { - let cat: TransientPtr<dyn ICat> = TransientPtr::new(Cat::new()); + Box::new(|| { + let cat: TransientPtr<dyn ICat> = TransientPtr::new(Cat::new()); - cat + cat + }) }) .await?; |