aboutsummaryrefslogtreecommitdiff
path: root/examples/factory/main.rs
blob: d4287176e8483ce4a93e548e7796144fa5f63aa6 (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 bootstrap;
mod interfaces;
mod user;
mod user_manager;

use std::error::Error;

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

use crate::bootstrap::bootstrap;
use crate::interfaces::user_manager::IUserManager;

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

    let di_container = bootstrap()?;

    let mut user_manager = di_container.get::<dyn IUserManager>()?.transient()?;

    user_manager.fill_with_users();

    println!("Printing user information");

    user_manager.print_users();

    Ok(())
}