From 463502cbafdb501c703091442eb658e6241958f1 Mon Sep 17 00:00:00 2001 From: philomathic_life <15947783+zacknewman@users.noreply.github.com> Date: Mon, 6 Jan 2025 10:16:15 +0000 Subject: [PATCH] io: clarify `ReadBuf::uninit` allows initialized buffers as well (#7053) --- tokio/src/io/read_buf.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tokio/src/io/read_buf.rs b/tokio/src/io/read_buf.rs index ec53ea7a207..edef84851ec 100644 --- a/tokio/src/io/read_buf.rs +++ b/tokio/src/io/read_buf.rs @@ -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]) -> ReadBuf<'a> { ReadBuf {