Auto merge of #29505 - rjbs:docs-where-type, r=steveklabnik
I read this section a few times before even having a guess what was meant, then consulted IRC for confirmation. It may be that I was thick-headed, but I think this is a useful addition.
This commit is contained in:
commit
7caf54bc0f
@ -400,7 +400,9 @@ fn inverse<T>() -> T
|
||||
|
||||
This shows off the additional feature of `where` clauses: they allow bounds
|
||||
where the left-hand side is an arbitrary type (`i32` in this case), not just a
|
||||
plain type parameter (like `T`).
|
||||
plain type parameter (like `T`). In this example, `i32` must implement
|
||||
`ConvertTo<T>`. Rather than defining what `i32` is (since that's obvious), the
|
||||
`where` clause here is a constraint on `T`.
|
||||
|
||||
# Default methods
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user