Struct noodles::cram::crai::Writer[][src]

pub struct Writer<W> where
    W: Write
{ /* fields omitted */ }
Expand description

A CRAM index writer.

Implementations

Creates a CRAM index writer.

Examples

use noodles_cram::crai;
let writer = crai::Writer::new(Vec::new());

Returns a reference to the underlying writer.

Examples

use noodles_cram::crai;
let writer = crai::Writer::new(Vec::new());
assert!(writer.get_ref().is_empty());

Attempts to finish the output stream and returns the underlying writer.

This is typically only manually called if the underlying stream is needed before the writer is dropped.

Examples

use noodles_cram::crai;
let writer = crai::Writer::new(Vec::new());
let empty_gz = [31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0];
assert_eq!(writer.finish()?, empty_gz);

Writes a CRAM index.

Examples

use noodles_bam as bam;
use noodles_cram::crai;

let mut writer = crai::Writer::new(Vec::new());

let index = vec![crai::Record::new(
    bam::record::ReferenceSequenceId::try_from(0).map(Some)?,
    10946,
    6765,
    17711,
    233,
    317811,
)];

writer.write_index(&index)?;

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

Performs the conversion.

Performs the conversion.

Should always be Self

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.