1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
extern crate trait_import_1; use trait_import_1::Add; struct Foo(i32); impl Add for Foo { type Output = Foo; fn add(self, other: Foo) -> Foo { Foo(self.0 + other.0) } } fn main() -> i32 { let a; a = Foo(1) + Foo(2); 0 }