Skip to content

Commit e418280

Browse files
authored
Make bytes_mut -> chunk_mut rename more easily discoverable (tokio-rs#471)
1 parent 8daf43e commit e418280

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ jobs:
160160
run: rustup update stable && rustup default stable
161161
- name: Build documentation
162162
run: cargo doc --no-deps --all-features
163+
env:
164+
RUSTDOCFLAGS: --cfg docsrs
163165
- name: Publish documentation
164166
run: |
165167
cd target/doc

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# 1.0.0 (December 22, 2020)
1111

1212
### Changed
13-
- Rename Buf/BufMut, methods to chunk/chunk_mut (#450)
13+
- Rename `Buf`/`BufMut` methods `bytes()` and `bytes_mut()` to `chunk()` and `chunk_mut()` (#450)
1414

1515
### Removed
1616
- remove unused Buf implementation. (#449)

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ serde_test = "1.0"
3232

3333
[target.'cfg(loom)'.dev-dependencies]
3434
loom = "0.4"
35+
36+
[package.metadata.docs.rs]
37+
rustdoc-args = ["--cfg", "docsrs"]

src/buf/buf_impl.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ pub trait Buf {
127127
/// This function should never panic. Once the end of the buffer is reached,
128128
/// i.e., `Buf::remaining` returns 0, calls to `chunk()` should return an
129129
/// empty slice.
130+
// The `chunk` method was previously called `bytes`. This alias makes the rename
131+
// more easily discoverable.
132+
#[cfg_attr(docsrs, doc(alias = "bytes"))]
130133
fn chunk(&self) -> &[u8];
131134

132135
/// Fills `dst` with potentially multiple slices starting at `self`'s

src/buf/buf_mut.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ pub unsafe trait BufMut {
158158
/// `chunk_mut()` returning an empty slice implies that `remaining_mut()` will
159159
/// return 0 and `remaining_mut()` returning 0 implies that `chunk_mut()` will
160160
/// return an empty slice.
161+
// The `chunk_mut` method was previously called `bytes_mut`. This alias makes the
162+
// rename more easily discoverable.
163+
#[cfg_attr(docsrs, doc(alias = "bytes_mut"))]
161164
fn chunk_mut(&mut self) -> &mut UninitSlice;
162165

163166
/// Transfer bytes into `self` from `src` and advance the cursor by the

0 commit comments

Comments
 (0)