TRPL: Borrow and AsRef

These two traits are commonly confused. As such, explain the difference.

Fixes #24163
This commit is contained in:
Steve Klabnik 2015-04-30 14:40:38 -04:00
parent 0ad202671f
commit e780fb270c
4 changed files with 104 additions and 0 deletions

View file

@ -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>`: