From 8e862c7998d0b59c71d20cbcbbc57031f734b6fa Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 22 Aug 2022 19:13:19 +0200 Subject: refactor!: move specifying binding scope to a binding scope configurator BREAKING CHANGE: Specifying the scope of a DI container binding is now done with a binding scope configurator --- examples/basic/main.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'examples/basic/main.rs') 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> { println!("Hello, world!"); - let di_container = bootstrap(); + let di_container = bootstrap()?; - let dog = di_container.get_singleton::().unwrap(); + let dog = di_container.get_singleton::()?; dog.woof(); - let human = di_container.get::().unwrap(); + let human = di_container.get::()?; human.make_pets_make_sounds(); + + Ok(()) } -- cgit v1.2.3-18-g5258