aboutsummaryrefslogtreecommitdiff
path: root/examples/async/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/async/main.rs')
-rw-r--r--examples/async/main.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/examples/async/main.rs b/examples/async/main.rs
index f72ff39..3c884fe 100644
--- a/examples/async/main.rs
+++ b/examples/async/main.rs
@@ -2,11 +2,8 @@
#![deny(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
-use std::sync::Arc;
-
use anyhow::Result;
use tokio::spawn;
-use tokio::sync::Mutex;
mod animals;
mod bootstrap;
@@ -21,12 +18,10 @@ async fn main() -> Result<()>
{
println!("Hello, world!");
- let di_container = Arc::new(Mutex::new(bootstrap().await?));
+ let di_container = bootstrap().await?;
{
let dog = di_container
- .lock()
- .await
.get::<dyn IDog>()
.await?
.threadsafe_singleton()?;
@@ -35,12 +30,7 @@ async fn main() -> Result<()>
}
spawn(async move {
- let human = di_container
- .lock()
- .await
- .get::<dyn IHuman>()
- .await?
- .transient()?;
+ let human = di_container.get::<dyn IHuman>().await?.transient()?;
human.make_pets_make_sounds();