pub struct Writer<W> { /* private fields */ }
Expand description
An async FASTA writer.
Implementations§
source§impl<W> Writer<W>
impl<W> Writer<W>
sourcepub fn get_ref(&self) -> &W
pub fn get_ref(&self) -> &W
Returns a reference to the underlying writer.
§Examples
use noodles_fasta as fasta;
use tokio::io;
let writer = fasta::r#async::io::Writer::new(io::sink());
let _inner = writer.get_ref();
sourcepub fn get_mut(&mut self) -> &mut W
pub fn get_mut(&mut self) -> &mut W
Returns a mutable reference to the underlying writer.
§Examples
use noodles_fasta as fasta;
use tokio::io;
let mut writer = fasta::r#async::io::Writer::new(io::sink());
let _inner = writer.get_mut();
sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Unwraps and returns the underlying writer.
§Examples
use noodles_fasta as fasta;
use tokio::io;
let writer = fasta::r#async::io::Writer::new(io::sink());
let _inner = writer.into_inner();
source§impl<W> Writer<W>where
W: AsyncWrite + Unpin,
impl<W> Writer<W>where
W: AsyncWrite + Unpin,
sourcepub fn new(inner: W) -> Self
pub fn new(inner: W) -> Self
Creates a FASTA writer.
§Examples
use noodles_fasta as fasta;
use tokio::io;
let writer = fasta::r#async::io::Writer::new(io::sink());
sourcepub async fn write_record(&mut self, record: &Record) -> Result<()>
pub async fn write_record(&mut self, record: &Record) -> Result<()>
Writes a FASTA record.
By default, sequence lines are hard wrapped at 80 bases. This can be changed by using
Builder::set_line_base_count
when creating the writer.
§Examples
use noodles_fasta::{self as fasta, record::{Definition, Sequence}};
use tokio::io;
let mut writer = fasta::r#async::io::Writer::new(io::sink());
let definition = Definition::new("sq0", None);
let sequence = Sequence::from(b"ACGT".to_vec());
let record = fasta::Record::new(definition, sequence);
writer.write_record(&record).await?;
Auto Trait Implementations§
impl<W> Freeze for Writer<W>where
W: Freeze,
impl<W> RefUnwindSafe for Writer<W>where
W: RefUnwindSafe,
impl<W> Send for Writer<W>where
W: Send,
impl<W> Sync for Writer<W>where
W: Sync,
impl<W> Unpin for Writer<W>where
W: Unpin,
impl<W> UnwindSafe for Writer<W>where
W: 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