Struct nafcodec::EncoderBuilder
source · pub struct EncoderBuilder { /* private fields */ }
Expand description
A builder to configure and initialize an Encoder
.
The fields to encode are opt-in: only the fields enabled through the
builder will be extracted from the Record
passed to Encoder::push
and written to the archive.
For instance, to write a nucleotide archive containing only the sequence and identifier of each record:
let encoder = nafcodec::EncoderBuilder::new(nafcodec::SequenceType::Dna)
.id(true)
.sequence(true)
.with_memory()
.unwrap();
Implementations§
source§impl EncoderBuilder
impl EncoderBuilder
sourcepub fn new(sequence_type: SequenceType) -> Self
pub fn new(sequence_type: SequenceType) -> Self
Create a new encoder builder with default parameters.
sourcepub fn from_flags<F: Into<Flags>>(sequence_type: SequenceType, flags: F) -> Self
pub fn from_flags<F: Into<Flags>>(sequence_type: SequenceType, flags: F) -> Self
Create a new encoder builder from the given flags.
This constructor can be used as a shortcut to setup encoding of a subset of supported fields. For instance, to write only the sequence identifiers and quality lines to an archive:
let mut encoder = EncoderBuilder::from_flags(Dna, Flag::Id | Flag::Quality)
.with_memory()
.unwrap();
sourcepub fn id(&mut self, id: bool) -> &mut Self
pub fn id(&mut self, id: bool) -> &mut Self
Whether or not to encode the identifier of each record.
sourcepub fn comment(&mut self, comment: bool) -> &mut Self
pub fn comment(&mut self, comment: bool) -> &mut Self
Whether or not to encode the comment of each record.
sourcepub fn sequence(&mut self, sequence: bool) -> &mut Self
pub fn sequence(&mut self, sequence: bool) -> &mut Self
Whether or not to encode the sequence of each record.
sourcepub fn quality(&mut self, quality: bool) -> &mut Self
pub fn quality(&mut self, quality: bool) -> &mut Self
Whether or not to decode the quality of each record.
sourcepub fn compression_level(&mut self, level: i32) -> &mut Self
pub fn compression_level(&mut self, level: i32) -> &mut Self
The compression level to use for zstd
compression.
Pass 0
to use the default zstd
value, otherwise any
integer in range 1-22. See zstd::stream::write::Encoder
for more information.
Trait Implementations§
source§impl Clone for EncoderBuilder
impl Clone for EncoderBuilder
source§fn clone(&self) -> EncoderBuilder
fn clone(&self) -> EncoderBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more