pub struct WriterBuilder { /* private fields */ }Expand description
Configuration for a FastxWriter.
use fastx::{Alphabet, WriterBuilder};
// Format and gzip are inferred from the path: this writes gzipped FASTQ.
let mut writer = WriterBuilder::new()
.line_width(80)
.validate(Alphabet::Dna)
.create("out.fq.gz")?;
writer.finish()?;Implementations§
Source§impl WriterBuilder
impl WriterBuilder
Sourcepub fn new() -> WriterBuilder
pub fn new() -> WriterBuilder
A builder with default settings.
Sourcepub fn format(self, format: Format) -> Self
pub fn format(self, format: Format) -> Self
Force the output format instead of inferring it from the path.
Sourcepub fn line_width(self, width: usize) -> Self
pub fn line_width(self, width: usize) -> Self
FASTA line width; 0 disables wrapping.
Sourcepub fn compression(self, compression: Compression) -> Self
pub fn compression(self, compression: Compression) -> Self
Force compression instead of inferring it from the path.
Sourcepub fn level(self, level: CompressionLevel) -> Self
pub fn level(self, level: CompressionLevel) -> Self
gzip compression level.
Sourcepub fn validate(self, alphabet: Alphabet) -> Self
pub fn validate(self, alphabet: Alphabet) -> Self
Validate records against an alphabet before writing.
Sourcepub fn buffer_size(self, bytes: usize) -> Self
pub fn buffer_size(self, bytes: usize) -> Self
Output buffer size in bytes.
Sourcepub fn blocks_per_batch(self, blocks: usize) -> Self
pub fn blocks_per_batch(self, blocks: usize) -> Self
How many BGZF blocks to compress at a time.
Only affects BGZF output. Blocks are independent, so a batch is
compressed across cores and the bytes written are identical either way —
this trades blocks × 64 KiB of memory for parallelism. The default is
several blocks per core; pass 1 to force single-threaded compression.
Sourcepub fn build<W: Write>(&self, inner: W) -> Result<FastxWriter<W>>
pub fn build<W: Write>(&self, inner: W) -> Result<FastxWriter<W>>
Build a writer around any Write. Requires a format to be set.
Sourcepub fn create<P: AsRef<Path>>(&self, path: P) -> Result<BoxedWriter>
pub fn create<P: AsRef<Path>>(&self, path: P) -> Result<BoxedWriter>
Create a file, inferring format and gzip compression from its extension.
Sourcepub fn stdout(&self) -> Result<BoxedWriter>
pub fn stdout(&self) -> Result<BoxedWriter>
Write to standard output.
Trait Implementations§
Source§impl Clone for WriterBuilder
impl Clone for WriterBuilder
Source§fn clone(&self) -> WriterBuilder
fn clone(&self) -> WriterBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WriterBuilder
impl Debug for WriterBuilder
Auto Trait Implementations§
impl Freeze for WriterBuilder
impl RefUnwindSafe for WriterBuilder
impl Send for WriterBuilder
impl Sync for WriterBuilder
impl Unpin for WriterBuilder
impl UnsafeUnpin for WriterBuilder
impl UnwindSafe for WriterBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more