Disambiguating overlapping traits
A type can implement many different traits. What if two traits both require
the same name? For example, many traits might have a method named get()
.
They might even have different return types!
A type can implement many different traits. What if two traits both require the same name? For example, many traits might have a method named get()
. They might even have different return types!
Good news: because each trait implementation gets its own impl
block, it's
clear which trait's get
method you're implementing.
What about when it comes time to call those methods? To disambiguate between them, we have to use Fully Qualified Syntax.
参照
The Rust Programming Language chapter on Fully Qualified syntax