Skip to main content

StreamReader

Struct StreamReader 

Source
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>

Source

pub fn new(buf: &'a [u8]) -> Self

Source

pub fn buf(&self) -> &'a [u8] ⓘ

Source

pub fn committed_end(&self) -> usize

Offset just past the last ETB and its payload.

Source

pub fn committed(&self) -> &'a [u8] ⓘ

The committed region of the buffer.

Source

pub fn tail(&self) -> &'a [u8] ⓘ

Everything after the last commit.

Source

pub fn torn(&self) -> bool

Whether data trails the last commit (layout, notes and EOT alone do not count).

Source

pub fn block_count(&self) -> usize

Source

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).

Source

pub fn block_ranges(&self) -> &[(usize, usize)]

[start, end) of every committed block.

Source

pub fn blocks(&self) -> impl Iterator<Item = &'a [u8]> + '_

Source

pub fn damaged(&self) -> &[usize]

Indexes of blocks cut by an ETB inside open text or a level.

Source

pub fn is_damaged(&self, i: usize) -> bool

Source

pub fn undamaged(&self) -> Cow<'a, [u8]>

The committed region with damaged blocks removed: borrowed when no block is damaged, otherwise the undamaged blocks concatenated. Read it with Document::new or Body::new.

Source

pub fn records(&self) -> Result<Vec<Vec<Vec<u8>>>>

Logical values of every committed record (headings and header rows excluded), undamaged blocks only.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.