Struct Dbz

Source
pub struct Dbz<R: BufRead> { /* private fields */ }
Expand description

Object for reading, parsing, and serializing a Databento Binary Encoding (DBZ) file.

Implementations§

Source§

impl Dbz<BufReader<File>>

Source

pub fn from_file(path: impl AsRef<Path>) -> Result<Self>

Creates a new Dbz from the file at path. This function reads the metadata, but does not read the body of the file.

§Errors

This function will return an error if path doesn’t exist. It will also return an error if it is unable to parse the metadata from the file.

Source§

impl<R: BufRead> Dbz<R>

Source

pub fn new(reader: R) -> Result<Self>

Creates a new Dbz from reader.

§Errors

This function will return an error if it is unable to parse the metadata in reader.

Source

pub fn schema(&self) -> Schema

Returns the Schema of the DBZ data. The schema also indicates the record type T for Self::try_into_iter.

Source

pub fn metadata(&self) -> &Metadata

Returns a reference to all metadata read from the Dbz data in a Metadata object.

Source

pub fn try_into_iter<T: ConstTypeId>(self) -> Result<DbzStreamIter<R, T>>

Try to decode the DBZ file into a streaming iterator. This decodes the data lazily.

§Errors

This function will return an error if the zstd portion of the DBZ file was compressed in an unexpected manner.

Source§

impl<R: BufRead> Dbz<R>

Source

pub fn write_to( self, writer: impl Write, encoding: OutputEncoding, ) -> Result<()>

Streams the contents of the Dbz to writer encoding it using encoding. Consumes the Dbz object.

§Errors

This function returns an error if Dbz::schema() is Schema::Statistics. It will also return an error if there’s an issue writing the output to writer.

Trait Implementations§

Source§

impl<R: Debug + BufRead> Debug for Dbz<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Dbz<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Dbz<R>
where R: RefUnwindSafe,

§

impl<R> Send for Dbz<R>
where R: Send,

§

impl<R> Sync for Dbz<R>
where R: Sync,

§

impl<R> Unpin for Dbz<R>
where R: Unpin,

§

impl<R> UnwindSafe for Dbz<R>
where R: 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.