pub struct State<Decoder, Buffer> {
pub decoder: Decoder,
pub buffer: Buffer,
}Expand description
The managed decoding state for the stream of data.
Fields§
§decoder: DecoderThe decoder to use for processing the data.
buffer: BufferThe buffer containing carried data from the previously decoded chunks.
Implementations§
Source§impl<Decoder, Buffer> State<Decoder, Buffer>
impl<Decoder, Buffer> State<Decoder, Buffer>
Sourcepub fn process_next_chunk(
&mut self,
chunk: &[u8],
) -> AvailableIter<'_, Decoder, Buffer> ⓘ
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.
Sourcepub fn is_empty(&self) -> bool
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).
Sourcepub fn finish(self) -> Result<(), Buffer>
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§
Auto Trait Implementations§
impl<Decoder, Buffer> Freeze for State<Decoder, Buffer>
impl<Decoder, Buffer> RefUnwindSafe for State<Decoder, Buffer>where
Decoder: RefUnwindSafe,
Buffer: RefUnwindSafe,
impl<Decoder, Buffer> Send for State<Decoder, Buffer>
impl<Decoder, Buffer> Sync for State<Decoder, Buffer>
impl<Decoder, Buffer> Unpin for State<Decoder, Buffer>
impl<Decoder, Buffer> UnwindSafe for State<Decoder, Buffer>where
Decoder: UnwindSafe,
Buffer: UnwindSafe,
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