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>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes 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 Freeze for OutputWriter
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more