|
|
|
@ -14,7 +14,7 @@ Such as `&str` over `&String`, `&[T]` over `&Vec<T>`, or `&T` over `&Box<T>`.
|
|
|
|
|
Using borrowed types you can avoid layers of indirection for those instances
|
|
|
|
|
where the owned type already provides a layer of indirection. For instance, a
|
|
|
|
|
`String` has a layer of indirection, so a `&String` will have two layers of
|
|
|
|
|
indrection. We can avoid this by using `&str` instead, and letting `&String`
|
|
|
|
|
indirection. We can avoid this by using `&str` instead, and letting `&String`
|
|
|
|
|
coerce to a `&str` whenever the function is invoked.
|
|
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|