Skip to main content

StreamingPeekableIterState

Struct StreamingPeekableIterState 

Source
pub struct StreamingPeekableIterState<T> { /* private fields */ }
Expand description

State for StreamingPeekableIter implementations.

Implementations§

Source§

impl<T> StreamingPeekableIterState<T>

Source

pub fn peek_buffer_replace_and_truncate( &mut self, position: usize, replace_with: u8, )

Modify the peek buffer, overwriting the byte at position with the given byte to replace_with while truncating it to contain only bytes until the newly replaced position.

This is useful if you would want to remove ‘special bytes’ hidden behind, say a NULL byte to disappear and allow standard line readers to read the next line as usual.

Note that position does not include the 4 bytes prefix (they are invisible outside the reader)

Source

pub fn stopped_at(&self) -> Option<PacketLineRef<'static>>

Returns the packet line that stopped the iteration, or None if the end wasn’t reached yet, on EOF, or if fail_on_err_lines() was true.

Source

pub fn reset(&mut self)

Reset all iteration state allowing to continue a stopped iteration that is not yet at EOF.

This can happen once a delimiter is reached.

Source

pub fn reset_with(&mut self, delimiters: &'static [PacketLineRef<'static>])

Similar to reset() with support to changing the delimiters.

Source

pub fn fail_on_err_lines(&mut self, value: bool)

If value is true the provider will check for special ERR packet lines and stop iteration when one is encountered.

Use [stopped_at()]StreamingPeekableIterState::stopped_at() to inspect the cause of the end of the iteration. ne

Source

pub fn replace(&mut self, read: T) -> T

Replace the reader used with the given read, resetting all other iteration state as well.

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.