From 2a44ec3ffdcd78b23ac31b722b4312774d643c3a Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 24 Sep 2022 16:14:45 +0200 Subject: 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 --- examples/async/bootstrap.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/async') 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> di_container .bind::() .to_default_factory(&|_| { - let cat: TransientPtr = TransientPtr::new(Cat::new()); + Box::new(|| { + let cat: TransientPtr = TransientPtr::new(Cat::new()); - cat + cat + }) }) .await?; -- cgit v1.2.3-18-g5258