TRPL: Borrow and AsRef
These two traits are commonly confused. As such, explain the difference. Fixes #24163
This commit is contained in:
parent
0ad202671f
commit
e780fb270c
4 changed files with 104 additions and 0 deletions
|
|
@ -24,6 +24,11 @@ use marker::Sized;
|
|||
|
||||
/// A cheap, reference-to-reference conversion.
|
||||
///
|
||||
/// `AsRef` is very similar to, but different than, `Borrow`. See
|
||||
/// [the book][book] for more.
|
||||
///
|
||||
/// [book]: ../../book/borrow-and-asref.html
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Both `String` and `&str` implement `AsRef<str>`:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue