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 try_with_capacity(capacity: usize) -> Result<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) -> bool
pub fn consume_with<V>(&mut self, amt: usize, visitor: V) -> bool
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)
Sourcepub fn read_more(&mut self, reader: impl Read) -> Result<usize>
pub fn read_more(&mut self, reader: impl Read) -> Result<usize>
Read more bytes into the buffer without discarding any of its contents
pub fn fill_buf(&mut self, reader: impl Read) -> Result<&[u8]>
Auto Trait Implementations§
impl Freeze for Buffer
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
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)The largest safe length for a
[Self]
. Read more