use std::ops::Deref;
struct A(usize);
struct B(usize);
impl A {
fn aaa(&self) { println!("A: {}", self.0); }
}
struct C {
a: A,
b: B,
}
impl Deref for C {
type Target = A;
fn deref(&self) -> &Self::Target { &self.a }
}
fn main() {
let o = C { a: A(1), b: B(2) };
o.aaa();
}