pub struct Writer<W: Write> { /* private fields */ }Expand description
Writes Transcripts into a BufWriter
Examples
use std::io;
use atglib::tests;;
use atglib::genepred::Writer;
use atglib::models::TranscriptWrite;
let transcripts = vec![tests::transcripts::standard_transcript()];
let output = Vec::new(); // substitute this with proper IO (io::stdout())
let mut writer = Writer::new(output);
writer.write_transcript_vec(&transcripts);
let written_output = String::from_utf8(writer.into_inner().unwrap()).unwrap();
assert_eq!(written_output.starts_with("Test-Transcript\tchr1\t"), true);Implementations§
source§impl<W: Write> Writer<W>
 
impl<W: Write> Writer<W>
sourcepub fn new(writer: W) -> Self
 
pub fn new(writer: W) -> Self
Creates a new generic Writer for any `std::io::Read`` object
Use this method when you want to write to stdout or a remote source, e.g. via HTTP
pub fn with_capacity(capacity: usize, writer: W) -> Self
pub fn flush(&mut self) -> Result<(), Error>
pub fn into_inner(self) -> Result<W, IntoInnerError<BufWriter<W>>>
Trait Implementations§
source§impl<W: Write> TranscriptWrite for Writer<W>
 
impl<W: Write> TranscriptWrite for Writer<W>
source§fn writeln_single_transcript(
    &mut self,
    transcript: &Transcript
) -> Result<(), Error>
 
fn writeln_single_transcript( &mut self, transcript: &Transcript ) -> Result<(), Error>
Writes a single transcript formatted as GenePred with an extra newline
This method adds an extra newline at the end of the row to allow writing multiple transcripts continuosly
source§fn write_single_transcript(
    &mut self,
    transcript: &Transcript
) -> Result<(), Error>
 
fn write_single_transcript( &mut self, transcript: &Transcript ) -> Result<(), Error>
Writes a single transcript formatted as GenePred
Consider writeln_single_transcript
to ensure that an extra newline is added to the output
fn write_transcript_vec( &mut self, transcripts: &[Transcript] ) -> Result<(), Error>
fn write_transcripts(&mut self, transcripts: &Transcripts) -> Result<(), Error>
Auto Trait Implementations§
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