pub struct Writer<W> { /* private fields */ }
Expand description
A 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;
let writer = fasta::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;
let mut writer = fasta::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;
let writer = fasta::io::Writer::new(io::sink());
let _inner = writer.into_inner();
source§impl<W> Writer<W>where
W: Write,
impl<W> Writer<W>where
W: Write,
sourcepub fn new(inner: W) -> Self
pub fn new(inner: W) -> Self
Creates a FASTA writer.
§Examples
use noodles_fasta as fasta;
let writer = fasta::io::Writer::new(Vec::new());
sourcepub fn write_record(&mut self, record: &Record) -> Result<()>
pub 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}};
let mut writer = fasta::io::Writer::new(Vec::new());
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)?;
assert_eq!(writer.get_ref(), b">sq0\nACGT\n");
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