aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/async/bootstrap.rs6
-rw-r--r--examples/with-3rd-party/bootstrap.rs2
2 files changed, 5 insertions, 3 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?;
diff --git a/examples/with-3rd-party/bootstrap.rs b/examples/with-3rd-party/bootstrap.rs
index c5512c4..4fea754 100644
--- a/examples/with-3rd-party/bootstrap.rs
+++ b/examples/with-3rd-party/bootstrap.rs
@@ -18,7 +18,7 @@ pub fn bootstrap() -> Result<Rc<DIContainer>, Box<dyn Error>>
di_container
.bind::<Shuriken>()
- .to_default_factory(&|_| TransientPtr::new(Shuriken::new()))?;
+ .to_default_factory(&|_| Box::new(|| TransientPtr::new(Shuriken::new())))?;
Ok(di_container)
}