// ANCHOR: here use std::ops::Deref; impl Deref for MyBox { type Target = T; fn deref(&self) -> &Self::Target { &self.0 } } // ANCHOR_END: here struct MyBox(T); impl MyBox { fn new(x: T) -> MyBox { MyBox(x) } } fn main() { let x = 5; let y = MyBox::new(x); assert_eq!(5, x); assert_eq!(5, *y); }