Skip to main content

MergeDecoder

Struct MergeDecoder 

Source
pub struct MergeDecoder<D> { /* private fields */ }
Expand description

Merges the DBN decoding streams from one or more other decoders. Both metadata and the record streams are merged.

Implementations§

Source§

impl<D> Decoder<D>

Source

pub fn new(decoders: Vec<D>) -> Result<Self>

Creates a new merge decoder from the given decoders. Both the DBN metadata and the records will be merged.

§Errors

This function returns an error if decoders is empty. Errors can also result from failing to merge the DBN metadata. It will also return an error if one of the inner decoders returns an error while decoding the first record. A decoder returning Ok(None) does not result in a failure.

Trait Implementations§

Source§

impl<D> DbnMetadata for Decoder<D>

Source§

fn metadata(&self) -> &Metadata

Returns an immutable reference to the decoded Metadata.
Source§

fn metadata_mut(&mut self) -> &mut Metadata

Returns a mutable reference to the decoded Metadata.
Source§

impl<D> DecodeRecord for Decoder<D>
where D: LastRecord + DecodeRecordRef,

Source§

fn decode_record<T: HasRType>(&mut self) -> Result<Option<&T>>

Tries to decode a reference to a single record of type T. Returns Ok(None) if the input has been exhausted. Read more
Source§

fn decode_records<T: HasRType + Clone>(self) -> Result<Vec<T>>
where Self: Sized,

Tries to decode all records into a Vec. This eagerly decodes the data. Read more
Source§

impl<D> DecodeRecordRef for Decoder<D>
where D: LastRecord + DecodeRecordRef,

Source§

fn decode_record_ref(&mut self) -> Result<Option<RecordRef<'_>>>

Tries to decode a generic reference a record. Returns Ok(None) if input has been exhausted. Read more
Source§

fn decode_buf_iter(&mut self) -> impl Iterator<Item = Result<RecordBuf>> + '_

Returns an Iterator of owned RecordBufs decoded from this reader. Read more
Source§

impl<D> DecodeStream for Decoder<D>
where D: LastRecord + DecodeRecordRef,

Source§

fn decode_stream<T: HasRType>(self) -> StreamIterDecoder<Self, T>
where Self: Sized,

Converts the decoder into a streaming iterator of records of type T. This lazily decodes the data.

Auto Trait Implementations§

§

impl<D> Freeze for Decoder<D>

§

impl<D> RefUnwindSafe for Decoder<D>
where D: RefUnwindSafe,

§

impl<D> Send for Decoder<D>
where D: Send,

§

impl<D> Sync for Decoder<D>
where D: Sync,

§

impl<D> Unpin for Decoder<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for Decoder<D>

§

impl<D> UnwindSafe for Decoder<D>
where D: 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.
Source§

impl<T> Ungil for T
where T: Send,