Enum age::cli_common::file_io::OutputWriter
source · pub enum OutputWriter {
File(LazyFile),
Stdout(StdoutWriter),
}
Available on crate feature
cli-common
only.Expand description
Wrapper around either a file or standard output.
Variants§
Implementations§
source§impl OutputWriter
impl OutputWriter
sourcepub fn new(
output: Option<String>,
allow_overwrite: bool,
format: OutputFormat,
_mode: u32,
input_is_tty: bool
) -> Result<Self>
pub fn new( output: Option<String>, allow_overwrite: bool, format: OutputFormat, _mode: u32, input_is_tty: bool ) -> Result<Self>
Constructs a new OutputWriter
.
Writes to the file at path output
, or standard output if output
is None
or
Some("-")
.
If allow_overwrite
is true
, the file at path output
will be overwritten if
it exists. This option has no effect if output
is None
or Some("-")
.
sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Returns true if this output is to a terminal, and a user will likely see it.
Trait Implementations§
source§impl Debug for OutputWriter
impl Debug for OutputWriter
source§impl Write for OutputWriter
impl Write for OutputWriter
source§fn write(&mut self, data: &[u8]) -> Result<usize>
fn write(&mut self, data: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. Read more
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for OutputWriter
impl Send for OutputWriter
impl Sync for OutputWriter
impl Unpin for OutputWriter
impl !UnwindSafe for OutputWriter
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