Skip to main content

FrameParser

Trait FrameParser 

Source
pub trait FrameParser<F, T> {
    // Required method
    fn parse(&self, frame: F) -> Result<T, StreamError>;
}
Expand description

Turns one framed record into an item.

Separate from the framer so that the framer need not be generic over T. That is not tidiness: a decoder that structurally mentions T forces a T: 'b bound onto every caller’s public signature, whereas a parser mentioning T only in its return type does not.

Required Methods§

Source

fn parse(&self, frame: F) -> Result<T, StreamError>

Deserialise one framed record.

An error here is not terminal: the record framed correctly, so the decoder knows exactly where the next one starts and the stream continues.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> FrameParser<ByteRecord, T> for CsvParser
where T: for<'de> Deserialize<'de>,

Available on crate feature csv only.
Source§

impl<T> FrameParser<Result<T, StreamError>, T> for IdentityParser