struct Buffer {
birth: Option<Instant>,
data: Vec<u8>,
used: usize,
}
Fields§
§birth: Option<Instant>
Time of the first piece of data.
data: Vec<u8>
§used: usize
Implementations§
source§impl Buffer
impl Buffer
fn new() -> Self
fn birth(&self) -> Option<Instant>
sourcefn consume(&mut self, empty: bool) -> Option<Vec<u8>>
fn consume(&mut self, empty: bool) -> Option<Vec<u8>>
Resets the buffer and returns the old data (before the reset). If there was no data pushed, it returns None.
§Arguments
empty
- if true, the new buffer may be created with zero capacity as an optimization.
sourcefn unused_mut(&mut self) -> &mut [u8] ⓘ
fn unused_mut(&mut self) -> &mut [u8] ⓘ
Returns mutable slice to the unused part of the buffer.
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