rust/library/core
Jan Behrens 551d921de0 docs: Improve AsRef / AsMut docs on blanket impls
- Explicitly mention that `AsRef` and `AsMut` do not auto-dereference
  generally for all dereferencable types (but only if inner type is a
  shared and/or mutable reference)
- Give advice to not use `AsRef` or `AsMut` for the sole purpose of
  dereferencing
- Suggest providing a transitive `AsRef` or `AsMut` implementation for
  types which implement `Deref`
- Add new section "Reflexivity" in documentation comments for `AsRef`
  and `AsMut`
- Provide better example for `AsMut`
- Added heading "Relation to `Borrow`" in `AsRef`'s docs to improve
  structure

Issue #45742 and a corresponding FIXME in the libcore suggest that
`AsRef` and `AsMut` should provide a blanket implementation over
`Deref`. As that is difficult to realize at the moment, this commit
updates the documentation to better describe the status-quo and to give
advice on how to use `AsRef` and `AsMut`.
2022-07-19 11:40:40 +02:00
..
benches Add unicode fast path to is_printable 2022-05-31 10:51:35 +02:00
primitive_docs
src docs: Improve AsRef / AsMut docs on blanket impls 2022-07-19 11:40:40 +02:00
tests Rollup merge of #98839 - 5225225:assert_transmute_copy_size, r=thomcc 2022-07-18 21:14:42 +05:30
Cargo.toml Avoid use of rand::thread_rng in stdlib benchmarks 2022-05-02 00:08:21 -07:00