We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 64bee8c + 147bb2c commit 8fff287Copy full SHA for 8fff287
std/src/io/readbuf.rs
@@ -99,6 +99,13 @@ impl<'data> BorrowedBuf<'data> {
99
unsafe { MaybeUninit::slice_assume_init_ref(&self.buf[0..self.filled]) }
100
}
101
102
+ /// Returns a mutable reference to the filled portion of the buffer.
103
+ #[inline]
104
+ pub fn filled_mut(&mut self) -> &mut [u8] {
105
+ // SAFETY: We only slice the filled part of the buffer, which is always valid
106
+ unsafe { MaybeUninit::slice_assume_init_mut(&mut self.buf[0..self.filled]) }
107
+ }
108
+
109
/// Returns a cursor over the unfilled part of the buffer.
110
#[inline]
111
pub fn unfilled<'this>(&'this mut self) -> BorrowedCursor<'this> {
0 commit comments