aboutsummaryrefslogtreecommitdiff
path: root/examples/generics/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/generics/main.rs')
-rw-r--r--examples/generics/main.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/generics/main.rs b/examples/generics/main.rs
new file mode 100644
index 0000000..9442641
--- /dev/null
+++ b/examples/generics/main.rs
@@ -0,0 +1,19 @@
+mod bootstrap;
+mod interfaces;
+mod printer;
+
+use bootstrap::bootstrap;
+use interfaces::printer::IPrinter;
+
+fn main()
+{
+ let di_container = bootstrap();
+
+ let string_printer = di_container.get::<dyn IPrinter<String>>().unwrap();
+
+ string_printer.print("Hello there".to_string());
+
+ let int_printer = di_container.get::<dyn IPrinter<i32>>().unwrap();
+
+ int_printer.print(2782028);
+}