From 8651f84f205da7a89f2fc7333d1dd8de0d80a22b Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 17 Sep 2022 16:12:45 +0200 Subject: refactor!: make async DI container be used inside of a Arc BREAKING CHANGE: The async DI container is to be used inside of a Arc & it also no longer implements Default --- examples/async/bootstrap.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'examples/async/bootstrap.rs') diff --git a/examples/async/bootstrap.rs b/examples/async/bootstrap.rs index b640712..7e1d2cd 100644 --- a/examples/async/bootstrap.rs +++ b/examples/async/bootstrap.rs @@ -1,3 +1,5 @@ +use std::sync::Arc; + use anyhow::Result; use syrette::async_di_container::AsyncDIContainer; @@ -11,18 +13,19 @@ use crate::interfaces::cat::ICat; use crate::interfaces::dog::IDog; use crate::interfaces::human::IHuman; -pub async fn bootstrap() -> Result +pub async fn bootstrap() -> Result> { let mut di_container = AsyncDIContainer::new(); di_container .bind::() - .to::()? + .to::() + .await? .in_singleton_scope() .await?; - di_container.bind::().to::()?; - di_container.bind::().to::()?; + di_container.bind::().to::().await?; + di_container.bind::().to::().await?; Ok(di_container) } -- cgit v1.2.3-18-g5258