Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify chunk_mut documentation #519

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/buf/buf_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use alloc::{boxed::Box, vec::Vec};

/// A trait for values that provide sequential write access to bytes.
///
/// Write bytes to a buffer
/// Write bytes to a buffer.
///
/// A buffer stores bytes in memory such that write operations are infallible.
/// The underlying storage may or may not be in contiguous memory. A `BufMut`
Expand Down Expand Up @@ -122,8 +122,14 @@ pub unsafe trait BufMut {
}

/// Returns a mutable slice starting at the current BufMut position and of
/// length between 0 and `BufMut::remaining_mut()`. Note that this *can* be shorter than the
/// whole remainder of the buffer (this allows non-continuous implementation).
/// length between 0 and `BufMut::remaining_mut()`. Note that this *can* be
/// shorter than the whole remainder of the buffer (this allows
/// non-continuous implementation).
///
/// Writing to a `BufMut` may involve allocating more memory on the fly.
/// Generally, such allocations happen when this method is called on a
/// container that has run out of capacity. Containers that behave this way
/// include [`Vec<u8>`](std::vec::Vec) and [`BytesMut`](crate::BytesMut).
///
/// This is a lower level function. Most operations are done with other
/// functions.
Expand Down