-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Description
Based on new-user questions on IRC, many users are confused by the fact that this is valid code:
let v: Vec<int> = vec![1,2,3];
let i = v.head();even though the Vec<T> documentation does not include a method named head. This is because head is actually a method on type [T], and Vec<T> implements Deref<[T]>.
More generally, it's not easy (1) to look at the documentation for a given type and see all the methods that are callable on values of that type, or (2) to look at a piece of code and figure out where to find the documentation for a given method.
This could be fixed by listing "T methods callable via dereference" on the documentation page for a any type that implements Deref<T>. (This is similar to how systems like JavaDoc list "methods inherited from BaseClass" in the docs for any class that extends BaseClass.)