Struct ffx_writer::Writer
source · pub struct Writer { /* private fields */ }
Expand description
This is the legacy writer that doesn’t impose any particular type of the machine output. It should not be used in new code.
Implementations§
source§impl Writer
impl Writer
sourcepub fn new(format: Option<Format>) -> Self
pub fn new(format: Option<Format>) -> Self
Create a new Writer with the specified format.
Passing None for format implies no output via the machine function.
sourcepub fn new_test(format: Option<Format>) -> Self
pub fn new_test(format: Option<Format>) -> Self
Create a new Writer with the specified format that captures all output for later replay.
Passing None for format implies no output via the machine function.
sourcepub fn test_output(&self) -> Result<String>
pub fn test_output(&self) -> Result<String>
Get all output that would have been generated on standard output by this object.
An error will be returned if this method is called on a non-test instance.
sourcepub fn test_error(&self) -> Result<String>
pub fn test_error(&self) -> Result<String>
Get all output that would have been generated on standard error by this object.
An error will be returned if this method is called on a non-test instance.
sourcepub fn machine<T: Serialize>(&self, output: &T) -> Result<()>
pub fn machine<T: Serialize>(&self, output: &T) -> Result<()>
Writes machine consumable output to standard output.
This is a no-op if is_machine
returns false.
sourcepub fn is_machine(&self) -> bool
pub fn is_machine(&self) -> bool
Returns true if the receiver was configured to output for machines.
sourcepub fn write(&self, value: impl Display) -> Result<()>
pub fn write(&self, value: impl Display) -> Result<()>
Writes the value to standard output without a newline.
This is a no-op if is_machine
returns true.
sourcepub fn line(&self, value: impl Display) -> Result<()>
pub fn line(&self, value: impl Display) -> Result<()>
Writes the value to standard output with a newline.
This is a no-op if is_machine
returns true.
Trait Implementations§
source§impl Write for Writer
impl Write for Writer
source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)