pub struct Reader<R> { /* private fields */ }
Expand description
An async FASTA reader.
Implementations§
source§impl<R> Reader<R>
impl<R> Reader<R>
sourcepub fn get_ref(&self) -> &R
pub fn get_ref(&self) -> &R
Returns a reference to the underlying reader.
§Examples
use noodles_fasta as fasta;
use tokio::io;
let reader = fasta::r#async::io::Reader::new(io::empty());
let _inner = reader.get_ref();
sourcepub fn get_mut(&mut self) -> &mut R
pub fn get_mut(&mut self) -> &mut R
Returns a mutable reference to the underlying reader.
§Examples
use noodles_fasta as fasta;
use tokio::io;
let mut reader = fasta::r#async::io::Reader::new(io::empty());
let _inner = reader.get_mut();
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Returns the underlying reader.
§Examples
use noodles_fasta as fasta;
use tokio::io;
let reader = fasta::r#async::io::Reader::new(io::empty());
let _inner = reader.into_inner();
source§impl<R> Reader<R>where
R: AsyncBufRead + Unpin,
impl<R> Reader<R>where
R: AsyncBufRead + Unpin,
sourcepub fn new(inner: R) -> Self
pub fn new(inner: R) -> Self
Creates an async FASTA reader.
§Examples
use noodles_fasta as fasta;
let data = [];
let mut reader = fasta::r#async::io::Reader::new(&data[..]);
sourcepub async fn read_definition(&mut self, buf: &mut String) -> Result<usize>
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::r#async::io::Reader::new(&data[..]);
let mut buf = String::new();
reader.read_definition(&mut buf).await?;
assert_eq!(buf, ">sq0");
sourcepub async fn read_sequence(&mut self, buf: &mut Vec<u8>) -> Result<usize>
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::r#async::io::Reader::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");
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> 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
Mutably borrows from an owned value. Read more