From 1c46b68581213ca8ae6200daa32f626b5389b4b0 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 25 Aug 2022 20:21:49 +0200 Subject: refactor!: make DI container have single get function BREAKING CHANGE: The DI container get_singleton & get_factory functions have been replaced by the get function now returning a enum --- examples/generics/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'examples/generics') diff --git a/examples/generics/main.rs b/examples/generics/main.rs index 9442641..f491aa0 100644 --- a/examples/generics/main.rs +++ b/examples/generics/main.rs @@ -2,18 +2,22 @@ mod bootstrap; mod interfaces; mod printer; +use std::error::Error; + use bootstrap::bootstrap; use interfaces::printer::IPrinter; -fn main() +fn main() -> Result<(), Box> { let di_container = bootstrap(); - let string_printer = di_container.get::>().unwrap(); + let string_printer = di_container.get::>()?.transient()?; string_printer.print("Hello there".to_string()); - let int_printer = di_container.get::>().unwrap(); + let int_printer = di_container.get::>()?.transient()?; int_printer.print(2782028); + + Ok(()) } -- cgit v1.2.3-18-g5258