use std::rc::Rc; use teloc::{Dependency, Resolver, ServiceProvider}; #[derive(Dependency)] struct Controller; #[derive(Dependency)] struct Schema1Cloned { a: Rc, } #[derive(Dependency)] struct Schema2Cloned { a: Rc, } #[test] fn test_cloned() { let container = ServiceProvider::new() .add_singleton::>() .add_transient::() .add_transient::(); let schema1: Schema1Cloned = container.resolve(); let schema2: Schema2Cloned = container.resolve(); assert!(Rc::ptr_eq(&schema1.a, &schema2.a)); }