std: add tests for the Vec<u8> Writer impl
std: add Reader impl for &[u8]
core: fix a doctest
auto merge of #18980 : erickt/rust/reader, r=erickt

This continues the work @thestinger started in #18885 (which hasn't landed yet, so wait for that to land before landing this one). Instead of adding more methods to `BufReader`, this just allows a `&[u8]` to be used directly as a `Reader`. It also adds an impl of `Writer` for `&mut [u8]`.
Merge remote-tracking branch 'upstream/master'