Universal Function Call Syntax
https://doc.rust-lang.org/book/ufcs.html
複数のtrait
を実装したことにより、同じ名前の関数を持った際は、Trait::関数名
としてどの関数を実行するか指定する必要がある。
trait Foo { fn f(&self); } trait Bar { fn f(&self); } struct Baz; impl Foo for Baz { fn f(&self) { println!("Baz’s impl of Foo"); } } impl Bar for Baz { fn f(&self) { println!("Baz’s impl of Bar"); } } fn main() { let b = Baz; // b.f(); // エラーになる。 Foo::f(&b); Bar::f(&b); }