pub struct StreamReader<'a> { /* private fields */ }Expand description
Scans a buffer for commits and exposes the committed region, block by block. Zero-copy: accessors return slices into the original buffer.
Implementations§
Source§impl<'a> StreamReader<'a>
impl<'a> StreamReader<'a>
pub fn new(buf: &'a [u8]) -> Self
pub fn buf(&self) -> &'a [u8] ⓘ
Sourcepub fn committed_end(&self) -> usize
pub fn committed_end(&self) -> usize
Offset just past the last ETB and its payload.
Sourcepub fn torn(&self) -> bool
pub fn torn(&self) -> bool
Whether data trails the last commit (layout, notes and EOT alone do not count).
pub fn block_count(&self) -> usize
Sourcepub fn block(&self, i: usize) -> &'a [u8] ⓘ
pub fn block(&self, i: usize) -> &'a [u8] ⓘ
Committed block i: the bytes from the previous commit to this
block’s ETB (marker and payload excluded).
Sourcepub fn block_ranges(&self) -> &[(usize, usize)]
pub fn block_ranges(&self) -> &[(usize, usize)]
[start, end) of every committed block.
pub fn blocks(&self) -> impl Iterator<Item = &'a [u8]> + '_
pub fn is_damaged(&self, i: usize) -> bool
Auto Trait Implementations§
impl<'a> Forget for StreamReader<'a>
impl<'a> Freeze for StreamReader<'a>
impl<'a> RefUnwindSafe for StreamReader<'a>
impl<'a> Send for StreamReader<'a>
impl<'a> Sync for StreamReader<'a>
impl<'a> Unpin for StreamReader<'a>
impl<'a> UnsafeUnpin for StreamReader<'a>
impl<'a> UnwindSafe for StreamReader<'a>
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