pub struct Buffer {
buf: Box<[MaybeUninit<u8>]>,
pos: usize,
filled: usize,
initialized: usize,
}
Fields§
§buf: Box<[MaybeUninit<u8>]>
§pos: usize
§filled: usize
§initialized: usize
Implementations§
source§impl Buffer
impl Buffer
pub fn with_capacity(capacity: usize) -> Self
pub fn buffer(&self) -> &[u8] ⓘ
pub fn capacity(&self) -> usize
pub fn filled(&self) -> usize
pub fn pos(&self) -> usize
pub fn discard_buffer(&mut self)
pub fn consume(&mut self, amt: usize)
sourcepub fn consume_with<V>(&mut self, amt: usize, visitor: V) -> boolwhere
V: FnMut(&[u8]),
pub fn consume_with<V>(&mut self, amt: usize, visitor: V) -> boolwhere V: FnMut(&[u8]),
If there are amt
bytes available in the buffer, pass a slice containing those bytes to
visitor
and return true. If there are not enough bytes available, return false.
pub fn unconsume(&mut self, amt: usize)
pub fn fill_buf(&mut self, reader: impl Read) -> Result<&[u8]>
Auto Trait Implementations§
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnwindSafe for Buffer
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