use shaku::{HasComponent, HasProvider, Interface}; use shaku_derive::{module, Component, Provider}; use std::sync::Arc; #[test] fn compile_ok() {} trait MyComponent: Interface {} trait MyProvider {} trait Module1: HasComponent {} trait Module2: HasProvider {} #[derive(Component)] #[shaku(interface = MyComponent)] struct MyComponentImpl; impl MyComponent for MyComponentImpl {} #[derive(Provider)] #[shaku(interface = MyProvider)] struct MyProviderImpl { #[shaku(inject)] #[allow(dead_code)] component: Arc, } impl MyProvider for MyProviderImpl {} module! { Module1Impl { components = [MyComponentImpl], providers = [] } } module! { Module2Impl { components = [], providers = [MyProviderImpl], use Module1 { components = [MyComponent], providers = [] } } } module! { RootModule { components = [], providers = [], use Module2 { components = [], providers = [MyProvider] } } }