pub trait StreamFormatDecode<T>: StreamFormat {
type Frame;
type Framer: Decoder<Item = Self::Frame, Error = StreamError> + Send;
type Parser: FrameParser<Self::Frame, T> + Send;
// Required methods
fn framer(&self, options: &DecodeOptions) -> Self::Framer;
fn parser(&self) -> Self::Parser;
}Expand description
Decodes bytes into items of type T.
Required Associated Types§
Sourcetype Frame
type Frame
One framed record, before deserialisation.
Formats that can separate the two use a type independent of T, such as csv::ByteRecord,
say. Formats that cannot use Result<T, StreamError> and an IdentityParser.
Sourcetype Framer: Decoder<Item = Self::Frame, Error = StreamError> + Send
type Framer: Decoder<Item = Self::Frame, Error = StreamError> + Send
Splits the body into records.
Its error type is the framing error, and it is terminal: FramedRead latches its
error state and ends the stream. Correct, because a framer that has lost track of where
records begin cannot resynchronise. Per-record deserialisation failures are not
terminal and are reported by Self::Parser instead.
Sourcetype Parser: FrameParser<Self::Frame, T> + Send
type Parser: FrameParser<Self::Frame, T> + Send
Deserialises framed records.
Required Methods§
Sourcefn framer(&self, options: &DecodeOptions) -> Self::Framer
fn framer(&self, options: &DecodeOptions) -> Self::Framer
Build a framer for one body.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl StreamFormatDecode<RecordBatch> for ArrowRecordBatchIpcStreamFormat
Available on crate feature arrow only.
impl StreamFormatDecode<RecordBatch> for ArrowRecordBatchIpcStreamFormat
Available on crate feature
arrow only.type Frame = Result<RecordBatch, StreamError>
type Framer = ArrowIpcCodec
type Parser = IdentityParser
Source§impl<T, E> StreamFormatDecode<T> for JsonArrayStreamFormat<E>where
T: for<'de> Deserialize<'de>,
E: Serialize,
Available on crate feature json only.
impl<T, E> StreamFormatDecode<T> for JsonArrayStreamFormat<E>where
T: for<'de> Deserialize<'de>,
E: Serialize,
Available on crate feature
json only.type Frame = Result<T, StreamError>
type Framer = JsonArrayCodec<T>
type Parser = IdentityParser
Source§impl<T> StreamFormatDecode<T> for CsvStreamFormatwhere
T: for<'de> Deserialize<'de>,
Available on crate feature csv only.
impl<T> StreamFormatDecode<T> for CsvStreamFormatwhere
T: for<'de> Deserialize<'de>,
Available on crate feature
csv only.Source§impl<T> StreamFormatDecode<T> for JsonNewLineStreamFormatwhere
T: for<'de> Deserialize<'de>,
Available on crate feature json only.
impl<T> StreamFormatDecode<T> for JsonNewLineStreamFormatwhere
T: for<'de> Deserialize<'de>,
Available on crate feature
json only.type Frame = Result<T, StreamError>
type Framer = JsonNewLineCodec<T>
type Parser = IdentityParser
Source§impl<T> StreamFormatDecode<T> for ProtobufStreamFormat
Available on crate feature protobuf only.
impl<T> StreamFormatDecode<T> for ProtobufStreamFormat
Available on crate feature
protobuf only.