mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-22 00:00:15 +02:00
Rename Buf/BufMut, methods to chunk/chunk_mut (#450)
The `bytes()` / `bytes_mut()` name implies the method returns the full set of bytes represented by `Buf`/`BufMut`. To rectify this, the methods are renamed to `chunk()` and `chunk_mut()` to reflect the partial nature of the returned byte slice. `bytes_vectored()` is renamed `chunks_vectored()`. Closes #447
This commit is contained in:
+2
-2
@@ -61,8 +61,8 @@ unsafe impl<T: BufMut> BufMut for Limit<T> {
|
||||
cmp::min(self.inner.remaining_mut(), self.limit)
|
||||
}
|
||||
|
||||
fn bytes_mut(&mut self) -> &mut UninitSlice {
|
||||
let bytes = self.inner.bytes_mut();
|
||||
fn chunk_mut(&mut self) -> &mut UninitSlice {
|
||||
let bytes = self.inner.chunk_mut();
|
||||
let end = cmp::min(bytes.len(), self.limit);
|
||||
&mut bytes[..end]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user