aboutsummaryrefslogtreecommitdiff
path: root/examples/unbound/main.rs
blob: 29fa0d4c7b2f9cfe289397108ae53a9c7ce2c7a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]

mod animal_store;
mod animals;
mod bootstrap;
mod interfaces;

use anyhow::Result;
use syrette::di_container::blocking::prelude::*;

use crate::bootstrap::bootstrap;
use crate::interfaces::dog::IDog;
use crate::interfaces::human::IHuman;

fn main() -> Result<()>
{
    println!("Hello, world!");

    let di_container = bootstrap()?;

    let dog = di_container.get::<dyn IDog>()?.singleton()?;

    dog.woof();

    let human = di_container.get::<dyn IHuman>()?.transient()?;

    human.make_pets_make_sounds();

    Ok(())
}