1 // run-pass 2 3 trait Get { 4 type Value; get(&self) -> &<Self as Get>::Value5 fn get(&self) -> &<Self as Get>::Value; grab(&self) -> &<Self as Get>::Value6 fn grab(&self) -> &<Self as Get>::Value { 7 self.get() 8 } 9 } 10 11 struct Struct { 12 x: isize, 13 } 14 15 impl Get for Struct { 16 type Value = isize; get(&self) -> &isize17 fn get(&self) -> &isize { 18 &self.x 19 } 20 } 21 main()22fn main() { 23 let s = Struct { 24 x: 100, 25 }; 26 assert_eq!(*s.grab(), 100); 27 } 28