Struct OutputStream

Source
pub struct OutputStream {
    pub header: Option<Vec<String>>,
    /* private fields */
}
Expand description

Represents an output file.

This struct is used to handle operations on an output file, such as writing to the file. This abstracts writing both plaintext and gzip-compressed files.

Fields§

§header: Option<Vec<String>>

Implementations§

Source§

impl OutputStream

Source

pub fn new(filepath: impl Into<PathBuf>, header: Option<Vec<String>>) -> Self

Constructs a new OutputStream.

§Arguments
  • filepath - A string slice that holds the path to the file. If the file extension is .gz, OutputStream will automatically write gzip-compressed output.
  • header - An optional vector of strings representing commented header lines to be written to the file.
Source

pub fn new_stdout(header: Option<Vec<String>>) -> Self

Constructs a new OutputStream for standard output.

Source

pub fn writer(&self) -> Result<Box<dyn Write>>

Opens the file and returns a writer.

If the file path ends with “.gz”, the file is treated as gzip-compressed, and the function will handle compression automatically. If a header is set, it will be written to the file.

§Returns

A result containing a Box<dyn Write> on success, or an io::Error on failure.

Auto Trait Implementations§

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>,

Source§

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>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V