diff options
author | HampusM <hampus@hampusmat.com> | 2022-08-20 18:06:42 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-08-21 18:17:51 +0200 |
commit | 55f5e8ca096467be2db895b459760ec34b63fce6 (patch) | |
tree | bb34d7f74d5ee7e423e57dbdfd9865d0115b0ff9 /examples/unbound/main.rs | |
parent | 12acab96a7d9ba8032378f8be7b6932f4406a849 (diff) |
docs: add example for displaying a unbound interface error
Diffstat (limited to 'examples/unbound/main.rs')
-rw-r--r-- | examples/unbound/main.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/unbound/main.rs b/examples/unbound/main.rs new file mode 100644 index 0000000..3a937c3 --- /dev/null +++ b/examples/unbound/main.rs @@ -0,0 +1,26 @@ +#![deny(clippy::all)] +#![deny(clippy::pedantic)] +#![allow(clippy::module_name_repetitions)] + +mod animals; +mod bootstrap; +mod interfaces; + +use bootstrap::bootstrap; +use interfaces::dog::IDog; +use interfaces::human::IHuman; + +fn main() +{ + println!("Hello, world!"); + + let di_container = bootstrap(); + + let dog = di_container.get_singleton::<dyn IDog>().unwrap(); + + dog.woof(); + + let human = di_container.get::<dyn IHuman>().unwrap(); + + human.make_pets_make_sounds(); +} |