Round one, find candidates by dereferencing (and maybe an unsized coercion):
- &Foo
- Foo
Round two, add &T
and &mut T
after each T
:
&Foo
&&Foo
&mut &Foo
Foo
&Foo
&mut Foo
Round three, find methods for the first of these with a receiver that matches:
-
&Foo
is the first and we find two receivers:-
Foo::method
receives&Foo
-
Trait::method
receives&Foo
-
The first is an inherent method and it wins.