State

Struct State 

Source
pub struct State<Decoder, Buffer> {
    pub decoder: Decoder,
    pub buffer: Buffer,
}
Expand description

The managed decoding state for the stream of data.

Fields§

§decoder: Decoder

The decoder to use for processing the data.

§buffer: Buffer

The buffer containing carried data from the previously decoded chunks.

Implementations§

Source§

impl<Decoder, Buffer> State<Decoder, Buffer>
where Decoder: Decoder<Buffer>, Buffer: Buffer,

Source

pub fn process_next_chunk( &mut self, chunk: &[u8], ) -> AvailableIter<'_, Decoder, Buffer>

Take the next chunk of data and return the iterator over the values available with this new data.

Source

pub fn is_empty(&self) -> bool

Returns true if there is no bufferred data.

When the State buffer is not empty, this means that it contains some (possibly incomplete) data for the encoded values that has been added to this state previously but has not yet been decoded (the most obvious reason for which is that decoding would require more data to arrive to succeed).

Source

pub fn finish(self) -> Result<(), Buffer>

Finish the processing.

Returns Ok(()) if the state is empty [see Self::is_empty, otherwise returns an Err with the buffer containing the unhandled data.

Trait Implementations§

Source§

impl<Decoder: Debug, Buffer: Debug> Debug for State<Decoder, Buffer>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Decoder, Buffer> Freeze for State<Decoder, Buffer>
where Decoder: Freeze, Buffer: Freeze,

§

impl<Decoder, Buffer> RefUnwindSafe for State<Decoder, Buffer>
where Decoder: RefUnwindSafe, Buffer: RefUnwindSafe,

§

impl<Decoder, Buffer> Send for State<Decoder, Buffer>
where Decoder: Send, Buffer: Send,

§

impl<Decoder, Buffer> Sync for State<Decoder, Buffer>
where Decoder: Sync, Buffer: Sync,

§

impl<Decoder, Buffer> Unpin for State<Decoder, Buffer>
where Decoder: Unpin, Buffer: Unpin,

§

impl<Decoder, Buffer> UnwindSafe for State<Decoder, Buffer>
where Decoder: UnwindSafe, Buffer: UnwindSafe,

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.