use shaku::{module, Component, Interface};
trait MyComponent: Interface {}
struct NoDefault;
#[derive(Component)]
#[shaku(interface = MyComponent)]
struct MyComponentImpl {
#[allow(dead_code)]
no_default: NoDefault,
}
impl MyComponent for MyComponentImpl {}
module! {
TestModule {
components = [MyComponentImpl],
providers = []
}
}
#[test]
fn with_given_parameter() {
TestModule::builder()
.with_component_parameters::<MyComponentImpl>(MyComponentImplParameters {
no_default: NoDefault,
})
.build();
}
#[test]
#[should_panic(expected = "There is no default value for `MyComponentImpl::no_default`")]
fn without_given_parameter() {
TestModule::builder().build();
}