pub struct HeadTailBuffer { /* private fields */ }Expand description
Byte buffer that preserves the beginning and end, dropping the middle.
Implementations§
Source§impl HeadTailBuffer
impl HeadTailBuffer
pub fn new(max_bytes: usize) -> Self
pub fn push_chunk(&mut self, chunk: Vec<u8>)
pub fn snapshot(&self) -> Vec<Vec<u8>>
pub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes_with_omission_marker(&self, marker: &[u8]) -> Vec<u8> ⓘ
Sourcepub fn suffix_bytes(&self, max_bytes: usize) -> Vec<u8> ⓘ
pub fn suffix_bytes(&self, max_bytes: usize) -> Vec<u8> ⓘ
Return up to max_bytes from the end of the retained content
(head followed by tail), preserving order. Avoids allocating the full
buffer when only a suffix is needed.
pub fn drain(&mut self) -> Vec<Vec<u8>>
pub fn drain_into(&mut self, target: &mut HeadTailBuffer)
pub fn retained_bytes(&self) -> usize
pub fn omitted_bytes(&self) -> usize
Sourcepub fn head_bytes(&self) -> usize
pub fn head_bytes(&self) -> usize
Length in bytes of the retained head (the split point: to_bytes() is
the head followed by the tail, with omitted_bytes dropped between).
Trait Implementations§
Source§impl Clone for HeadTailBuffer
impl Clone for HeadTailBuffer
Source§fn clone(&self) -> HeadTailBuffer
fn clone(&self) -> HeadTailBuffer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HeadTailBuffer
impl RefUnwindSafe for HeadTailBuffer
impl Send for HeadTailBuffer
impl Sync for HeadTailBuffer
impl Unpin for HeadTailBuffer
impl UnsafeUnpin for HeadTailBuffer
impl UnwindSafe for HeadTailBuffer
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