aboutsummaryrefslogtreecommitdiff
path: root/src/buf/uninit_slice.rs
diff options
context:
space:
mode:
authorGravatar Carl Lerche <me@carllerche.com> 2020-12-18 11:04:31 -0800
committerGravatar GitHub <noreply@github.com> 2020-12-18 11:04:31 -0800
commit06907f3e7badc98b83902c27ab19661693b0979a (patch)
tree32708b56819050278270c7b6781556d59a3d5445 /src/buf/uninit_slice.rs
parent54f5ced6c58c47f721836a9444654de4c8d687a1 (diff)
downloadbytes-06907f3e7badc98b83902c27ab19661693b0979a.tar.gz
bytes-06907f3e7badc98b83902c27ab19661693b0979a.tar.zst
bytes-06907f3e7badc98b83902c27ab19661693b0979a.zip
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
Diffstat (limited to 'src/buf/uninit_slice.rs')
-rw-r--r--src/buf/uninit_slice.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/buf/uninit_slice.rs b/src/buf/uninit_slice.rs
index 32ebde4..73f4e89 100644
--- a/src/buf/uninit_slice.rs
+++ b/src/buf/uninit_slice.rs
@@ -6,7 +6,7 @@ use core::ops::{
/// Uninitialized byte slice.
///
-/// Returned by `BufMut::bytes_mut()`, the referenced byte slice may be
+/// Returned by `BufMut::chunk_mut()`, the referenced byte slice may be
/// uninitialized. The wrapper provides safe access without introducing
/// undefined behavior.
///
@@ -114,7 +114,7 @@ impl UninitSlice {
///
/// let mut data = [0, 1, 2];
/// let mut slice = &mut data[..];
- /// let ptr = BufMut::bytes_mut(&mut slice).as_mut_ptr();
+ /// let ptr = BufMut::chunk_mut(&mut slice).as_mut_ptr();
/// ```
pub fn as_mut_ptr(&mut self) -> *mut u8 {
self.0.as_mut_ptr() as *mut _
@@ -129,7 +129,7 @@ impl UninitSlice {
///
/// let mut data = [0, 1, 2];
/// let mut slice = &mut data[..];
- /// let len = BufMut::bytes_mut(&mut slice).len();
+ /// let len = BufMut::chunk_mut(&mut slice).len();
///
/// assert_eq!(len, 3);
/// ```