Skip to content

Commit

Permalink
io: clarify ReadBuf::uninit allows initialized buffers as well (#7053)
Browse files Browse the repository at this point in the history
  • Loading branch information
zacknewman authored Jan 6, 2025
1 parent a1520f5 commit 463502c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tokio/src/io/read_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ impl<'a> ReadBuf<'a> {
}
}

/// Creates a new `ReadBuf` from a fully uninitialized buffer.
/// Creates a new `ReadBuf` from a buffer that may be uninitialized.
///
/// Use `assume_init` if part of the buffer is known to be already initialized.
/// The internal cursor will mark the entire buffer as uninitialized. If
/// the buffer is known to be partially initialized, then use `assume_init`
/// to move the internal cursor.
#[inline]
pub fn uninit(buf: &'a mut [MaybeUninit<u8>]) -> ReadBuf<'a> {
ReadBuf {
Expand Down

0 comments on commit 463502c

Please sign in to comment.