Struct noodles_fasta::AsyncReader

source ·
pub struct AsyncReader<R> { /* private fields */ }
Expand description

An async FASTA reader.

Implementations§

source§

impl<R> Reader<R>
where R: AsyncBufRead + Unpin,

source

pub fn new(inner: R) -> Self

Creates an async FASTA reader.

§Examples
use noodles_fasta as fasta;
let data = [];
let mut reader = fasta::AsyncReader::new(&data[..]);
source

pub async fn read_definition(&mut self, buf: &mut String) -> Result<usize>

Reads a raw definition line.

§Examples
use noodles_fasta as fasta;

let data = b">sq0\nACGT\n>sq1\nNNNN\nNNNN\nNN\n";
let mut reader = fasta::AsyncReader::new(&data[..]);

let mut buf = String::new();
reader.read_definition(&mut buf).await?;

assert_eq!(buf, ">sq0");
source

pub async fn read_sequence(&mut self, buf: &mut Vec<u8>) -> Result<usize>

Reads a sequence.

§Examples
use noodles_fasta as fasta;

let data = b">sq0\nACGT\n>sq1\nNNNN\nNNNN\nNN\n";
let mut reader = fasta::AsyncReader::new(&data[..]);
reader.read_definition(&mut String::new()).await?;

let mut buf = Vec::new();
reader.read_sequence(&mut buf).await?;

assert_eq!(buf, b"ACGT");
source§

impl<R> Reader<R>
where R: AsyncRead + AsyncSeek + Unpin,

source

pub async fn seek(&mut self, pos: SeekFrom) -> Result<u64>

Seeks the underlying stream to the given position.

Auto Trait Implementations§

§

impl<R> Freeze for Reader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Reader<R>
where R: RefUnwindSafe,

§

impl<R> Send for Reader<R>
where R: Send,

§

impl<R> Sync for Reader<R>
where R: Sync,

§

impl<R> Unpin for Reader<R>
where R: Unpin,

§

impl<R> UnwindSafe for Reader<R>
where R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.