use derive_bounded::Clone; trait Associate { type A: Clone; type B: Clone; type C: Clone; } #[derive(Debug)] struct Holder; impl Associate for Holder { type A = usize; type B = String; type C = u32; } #[derive(Clone)] #[bounded_to(T::B, T::C)] struct A { a: T::A, b: B, } #[derive(Clone)] #[bounded_to(T::C)] struct B { b: T::B, c: C, } #[derive(Clone)] #[bounded_to(T::C)] struct C { c: T::C, } #[derive(Clone, Debug)] #[bounded_to(T::C)] struct C2 where T: Associate, { c: T::C, v: V, b: Blah, } #[derive(Clone, Debug)] struct Struct(A); #[test] fn clone() { let c2 = C2:: { c: 22, v: 42, b: Default::default(), }; let d = c2.clone(); dbg!(&d); dbg!(&c2); }