Struct dbn::encode::DynEncoder
source · pub struct DynEncoder<'a, W>(/* private fields */)
where
W: Write;Expand description
An encoder whose Encoding and Compression can be set at runtime.
Implementations§
source§impl<'a, W> DynEncoder<'a, W>where
W: Write,
impl<'a, W> DynEncoder<'a, W>where
W: Write,
sourcepub fn new(
writer: W,
encoding: Encoding,
compression: Compression,
metadata: &Metadata,
should_pretty_print: bool,
use_pretty_px: bool,
use_pretty_ts: bool,
) -> Result<Self>
pub fn new( writer: W, encoding: Encoding, compression: Compression, metadata: &Metadata, should_pretty_print: bool, use_pretty_px: bool, use_pretty_ts: bool, ) -> Result<Self>
Constructs a new instance of DynEncoder.
Note: should_pretty_print, use_pretty_px, and use_pretty_ts are ignored
if encoding is Dbn.
§Errors
This function returns an error if it fails to encode the DBN metadata or it fails to initialize the Zstd compression.
sourcepub fn builder(
writer: W,
encoding: Encoding,
compression: Compression,
metadata: &Metadata,
) -> DynEncoderBuilder<'_, W>
pub fn builder( writer: W, encoding: Encoding, compression: Compression, metadata: &Metadata, ) -> DynEncoderBuilder<'_, W>
Creates a builder for configuring a DynEncoder object.
sourcepub fn encode_header<R: DbnEncodable>(
&mut self,
with_symbol: bool,
) -> Result<()>
pub fn encode_header<R: DbnEncodable>( &mut self, with_symbol: bool, ) -> Result<()>
Encodes the CSV header for the record type R, i.e. the names of each of the
fields to the output.
If with_symbol is true, will add a header field for “symbol”.
§Errors
This function returns an error if there’s an error writing to writer.
sourcepub fn encode_header_for_schema(
&mut self,
schema: Schema,
ts_out: bool,
with_symbol: bool,
) -> Result<()>
pub fn encode_header_for_schema( &mut self, schema: Schema, ts_out: bool, with_symbol: bool, ) -> Result<()>
Encodes the CSV header for schema, i.e. the names of each of the fields to
the output.
If ts_out is true, will add a header field “ts_out”. If with_symbol is
true, will add a header field “symbol”.
§Errors
This function returns an error if there’s an error writing to writer.
Trait Implementations§
source§impl<'a, W> EncodeDbn for DynEncoder<'a, W>where
W: Write,
impl<'a, W> EncodeDbn for DynEncoder<'a, W>where
W: Write,
source§fn encode_records<R: DbnEncodable>(&mut self, records: &[R]) -> Result<()>
fn encode_records<R: DbnEncodable>(&mut self, records: &[R]) -> Result<()>
source§fn encode_stream<R: DbnEncodable>(
&mut self,
stream: impl FallibleStreamingIterator<Item = R, Error = Error>,
) -> Result<()>
fn encode_stream<R: DbnEncodable>( &mut self, stream: impl FallibleStreamingIterator<Item = R, Error = Error>, ) -> Result<()>
source§fn encode_decoded<D: DecodeRecordRef + DbnMetadata>(
&mut self,
decoder: D,
) -> Result<()>
fn encode_decoded<D: DecodeRecordRef + DbnMetadata>( &mut self, decoder: D, ) -> Result<()>
source§fn encode_decoded_with_limit<D: DecodeRecordRef + DbnMetadata>(
&mut self,
decoder: D,
limit: NonZeroU64,
) -> Result<()>
fn encode_decoded_with_limit<D: DecodeRecordRef + DbnMetadata>( &mut self, decoder: D, limit: NonZeroU64, ) -> Result<()>
limit records. Read more