Debian Codegraph @

gcc/testsuite/rust/link/trait_import_0.rs

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