pub struct ReadBuf { /* private fields */ }Expand description
A read buffer that tracks filled and initialized portions.
This buffer manages a Vec<u8> and keeps track of which bytes have been
filled with data and which bytes have been initialized.
Implementations§
Source§impl ReadBuf
impl ReadBuf
Sourcepub fn new(raw: &mut [u8]) -> Self
pub fn new(raw: &mut [u8]) -> Self
Creates a new ReadBuf from a mutable slice.
The data is copied into an owned Vec<u8>. All bytes are considered
initialized but unfilled.
Sourcepub const fn uninit(raw: Vec<u8>) -> Self
pub const fn uninit(raw: Vec<u8>) -> Self
Creates a new ReadBuf with uninitialized bytes.
All bytes are considered uninitialized and unfilled.
Sourcepub fn unfilled(&mut self) -> ReadBufCursor<'_>
pub fn unfilled(&mut self) -> ReadBufCursor<'_>
Returns a cursor over the unfilled portion of the buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReadBuf
impl RefUnwindSafe for ReadBuf
impl Send for ReadBuf
impl Sync for ReadBuf
impl Unpin for ReadBuf
impl UnsafeUnpin for ReadBuf
impl UnwindSafe for ReadBuf
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more