Skip to content

Commit 463502c

Browse files
authored
io: clarify ReadBuf::uninit allows initialized buffers as well (#7053)
1 parent a1520f5 commit 463502c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tokio/src/io/read_buf.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ impl<'a> ReadBuf<'a> {
3939
}
4040
}
4141

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

0 commit comments

Comments
 (0)