1 The compiler doesn't know what method to call because more than one method
2 has the same prototype.
4 Erroneous code example:
17 impl Trait1 for Test { fn foo() {} }
18 impl Trait2 for Test { fn foo() {} }
21 Test::foo() // error, which foo() to call?
25 To avoid this error, you have to keep only one of them and remove the others.
26 So let's take our example and fix it:
35 impl Trait1 for Test { fn foo() {} }
38 Test::foo() // and now that's good!
42 However, a better solution would be using fully explicit naming of type and
56 impl Trait1 for Test { fn foo() {} }
57 impl Trait2 for Test { fn foo() {} }
60 <Test as Trait1>::foo()
77 impl F for X { fn m(&self) { println!("I am F"); } }
78 impl G for X { fn m(&self) { println!("I am G"); } }
83 F::m(&f); // it displays "I am F"
84 G::m(&f); // it displays "I am G"