struct Foo(T); type Bar = Foo; #[derive(derive_more::AsRef)] #[as_ref(Bar)] struct Baz(Foo); fn main() { let item = Baz(Foo(1i32)); let _: &Bar = item.as_ref(); }