pub struct AsyncWriter<W> { /* private fields */ }
Expand description

An async BAM writer.

Implementations

Returns a reference to the underlying writer.

Examples
use noodles_bam as bam;
let writer = bam::AsyncWriter::from(Vec::new());
assert!(writer.get_ref().is_empty());

Returns a mutable reference to the underlying writer.

Examples
use noodles_bam as bam;
let mut writer = bam::AsyncWriter::from(Vec::new());
assert!(writer.get_mut().is_empty());

Returns the underlying writer.

Examples
use noodles_bam as bam;
let writer = bam::AsyncWriter::from(Vec::new());
assert!(writer.into_inner().is_empty());

Shuts down the output stream.

Examples
use noodles_bam as bam;
let mut writer = bam::AsyncWriter::new(Vec::new());
writer.shutdown().await?;

Writes a SAM header.

Examples
use noodles_bam as bam;
use noodles_sam as sam;

let mut writer = bam::AsyncWriter::new(Vec::new());

let header = sam::Header::builder().add_comment("noodles-bam").build();
writer.write_header(&header).await?;

Writes the binary reference sequences after the SAM header.

Examples
use noodles_bam as bam;
use noodles_sam::{self as sam, header::ReferenceSequence};

let mut writer = bam::AsyncWriter::new(Vec::new());

let header = sam::Header::builder()
    .add_reference_sequence(ReferenceSequence::new("sq0".parse()?, 8)?)
    .add_comment("noodles-bam")
    .build();

writer.write_header(&header).await?;
writer.write_reference_sequences(header.reference_sequences()).await?;

Writes a BAM record.

Examples
use noodles_bam as bam;
use noodles_sam::{self as sam, alignment::Record};

let mut writer = bam::AsyncWriter::new(Vec::new());

let header = sam::Header::default();
let record = Record::default();
writer.write_record(&header, &record).await?;

Writes an alignment record.

Examples
use noodles_bam as bam;
use noodles_sam::{self as sam, alignment::Record};

let mut writer = bam::AsyncWriter::new(Vec::new());

let header = sam::Header::default();
let record = Record::default();
writer.write_alignment_record(&header, &record).await?;

Creates an async BAM writer builder.

Examples
use noodles_bam as bam;
let builder = bam::AsyncWriter::builder(Vec::new());
let writer = builder.build();

Creates an async BAM writer with a default compression level.

Examples
use noodles_bam as bam;
let writer = bam::AsyncWriter::new(Vec::new());

Trait Implementations

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts to this type from the input type.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more