1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// run-pass trait Fooable { fn yes(self); } impl Fooable for usize { fn yes(self) { for _ in 0..self { println!("yes"); } } } pub fn main() { 2.yes(); }