Struct noodles_bam::bai::AsyncReader [−][src]
pub struct AsyncReader<R> where
R: AsyncRead, { /* fields omitted */ }
Expand description
An async BAM index (BAI) reader.
Implementations
Creates an async BAM index (BAI) reader.
Examples
use noodles_bam::bai;
let data = [];
let reader = bai::AsyncReader::new(&data[..]);
Reads the BAM index (BAI) header.
The position of the stream is expected to be at the start.
Examples
use noodles_bam::bai;
let data = b"BAI\x01";
let mut reader = bai::AsyncReader::new(&data[..]);
reader.read_header().await?;
Reads the BAM index.
The position of the stream is expected to be directly after the header.
Examples
use noodles_bam::bai;
use tokio::fs::File;
let mut reader = File::open("sample.bam.bai")
.await
.map(bai::AsyncReader::new)?;
reader.read_header().await?;
let index = reader.read_index().await?;