chassis 0.2.0

Compile-time dependency injection framework
Documentation
#[test]
fn provide_static_ref() {
    #[derive(Default)]
    pub struct Module;

    #[chassis::module]
    impl Module {
        pub fn provide_ref() -> &'static str {
            "test"
        }
    }

    #[chassis::injector(modules = [Module])]
    pub trait Factory {
        fn resolve(&self) -> &'static str;
    }

    let factory = <dyn Factory>::new().unwrap();
    assert_eq!("test", factory.resolve());
}

// TODO:
// #[test]
// fn provide_ref() {
//     #[derive(Default)]
//     pub struct Module {
//         string: String,
//     }
//
//     #[chassis::module]
//     impl Module {
//         pub fn provide_ref(&self) -> &str {
//             &self.string
//         }
//     }
//
//     #[chassis::factory(modules = [Module])]
//     pub trait Factory {
//         fn resolve(&self) -> &str;
//     }
//
//     let factory = <dyn Factory>::new().unwrap();
//     println!("{}", factory.resolve());
// }