diff options
Diffstat (limited to 'examples/basic/main.rs')
-rw-r--r-- | examples/basic/main.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/basic/main.rs b/examples/basic/main.rs index 3a937c3..72f07c2 100644 --- a/examples/basic/main.rs +++ b/examples/basic/main.rs @@ -2,6 +2,8 @@ #![deny(clippy::pedantic)] #![allow(clippy::module_name_repetitions)] +use std::error::Error; + mod animals; mod bootstrap; mod interfaces; @@ -10,17 +12,19 @@ use bootstrap::bootstrap; use interfaces::dog::IDog; use interfaces::human::IHuman; -fn main() +fn main() -> Result<(), Box<dyn Error>> { println!("Hello, world!"); - let di_container = bootstrap(); + let di_container = bootstrap()?; - let dog = di_container.get_singleton::<dyn IDog>().unwrap(); + let dog = di_container.get_singleton::<dyn IDog>()?; dog.woof(); - let human = di_container.get::<dyn IHuman>().unwrap(); + let human = di_container.get::<dyn IHuman>()?; human.make_pets_make_sounds(); + + Ok(()) } |