Skip to main content

One doc tagged with "disambiguation"

View all tags

Fully Qualified Syntax for Disambiguation

After learning how to empower our types by implementing traits for them, a new question arises: what happens if a type implements two different traits that both have a method with the same name? Or what if a struct's own method has the same name as a method from a trait it implements? Rust is designed to be unambiguous, and it provides fully qualified syntax as a powerful tool to tell the compiler exactly which method you intend to call.