diff options
| author | bors <bors@rust-lang.org> | 2016-10-28 10:20:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-28 10:20:55 -0700 |
| commit | 421b595f25e5dbab9c967afd03929d013f346322 (patch) | |
| tree | 0b59aec9588a4d629bf8ad15509f35d6ae33d9a1 /src/libstd | |
| parent | 36d746718086dfcc12f73562b1996daf2f8ba643 (diff) | |
| parent | 61e765ad982c7b01753ebe9971b4ce407bbdb0d9 (diff) | |
| download | rust-421b595f25e5dbab9c967afd03929d013f346322.tar.gz rust-421b595f25e5dbab9c967afd03929d013f346322.zip | |
Auto merge of #37450 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: #36206, #37343, #37430, #37436, #37441 - Failed merges:
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/impls.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index cd05e6b5de9..6b26c016638 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -147,6 +147,10 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> { // ============================================================================= // In-memory buffer implementations +/// Read is implemented for `&[u8]` by copying from the slice. +/// +/// Note that reading updates the slice to point to the yet unread part. +/// The slice will be empty when EOF is reached. #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Read for &'a [u8] { #[inline] @@ -180,6 +184,11 @@ impl<'a> BufRead for &'a [u8] { fn consume(&mut self, amt: usize) { *self = &self[amt..]; } } +/// Write is implemented for `&mut [u8]` by copying into the slice, overwriting +/// its data. +/// +/// Note that writing updates the slice to point to the yet unwritten part. +/// The slice will be empty when it has been completely overwritten. #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Write for &'a mut [u8] { #[inline] @@ -204,6 +213,8 @@ impl<'a> Write for &'a mut [u8] { fn flush(&mut self) -> io::Result<()> { Ok(()) } } +/// Write is implemented for `Vec<u8>` by appending to the vector. +/// The vector will grow as needed. #[stable(feature = "rust1", since = "1.0.0")] impl Write for Vec<u8> { #[inline] |
