aboutsummaryrefslogtreecommitdiff
path: root/examples/factory/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/factory/main.rs')
-rw-r--r--examples/factory/main.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/factory/main.rs b/examples/factory/main.rs
index bf3d43b..0f1a97b 100644
--- a/examples/factory/main.rs
+++ b/examples/factory/main.rs
@@ -7,21 +7,25 @@ mod interfaces;
mod user;
mod user_manager;
+use std::error::Error;
+
use bootstrap::bootstrap;
use crate::interfaces::user_manager::IUserManager;
-fn main()
+fn main() -> Result<(), Box<dyn Error>>
{
println!("Hello, world!");
- let di_container = bootstrap();
+ let di_container = bootstrap()?;
- let mut user_manager = di_container.get::<dyn IUserManager>().unwrap();
+ let mut user_manager = di_container.get::<dyn IUserManager>()?.transient()?;
user_manager.fill_with_users();
println!("Printing user information");
user_manager.print_users();
+
+ Ok(())
}