Trait DecodeRecord

Source
pub trait DecodeRecord {
    // Required method
    fn decode_record<T: HasRType>(&mut self) -> Result<Option<&T>>;

    // Provided method
    fn decode_records<T: HasRType + Clone>(self) -> Result<Vec<T>>
       where Self: Sized { ... }
}
Expand description

Trait for types that decode DBN records of a particular type.

Required Methods§

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.

§Errors

This function returns an error if the underlying reader returns an error of a kind other than io::ErrorKind::UnexpectedEof upon reading.

If the next record is of a different type than T, an Error::Conversion will be returned.

If the length property of the record is invalid, an Error::Decode will be returned.

Provided Methods§

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.

§Errors

This function returns an error if the underlying reader returns an error of a kind other than io::ErrorKind::UnexpectedEof upon reading.

If any of the records is of a different type than T, an Error::Conversion will be returned.

If the length property of any of the records is invalid, a Error::Decode will be returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<D> DecodeRecord for dbn::decode::MergeDecoder<D>
where D: BufferSlice + DecodeRecordRef,

Source§

impl<D> DecodeRecord for dbn::decode::MergeRecordDecoder<D>
where D: BufferSlice + DecodeRecordRef,

Source§

impl<R> DecodeRecord for dbn::decode::dbn::Decoder<R>
where R: Read,

Source§

impl<R> DecodeRecord for dbn::decode::dbn::RecordDecoder<R>
where R: Read,

Source§

impl<R> DecodeRecord for DynDecoder<'_, R>
where R: BufRead,

Source§

impl<R: BufRead> DecodeRecord for dbn::decode::dbz::Decoder<R>