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

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn is_machine(&self) -> bool

Returns true if the receiver was configured to output for machines.

source

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.

source

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.

source

pub fn info(&self, value: impl Display) -> Result<()>

Writes the value to standard error with a newline.

This is output regardless of the value that is_machine returns.

source

pub fn error(&self, value: impl Display) -> Result<()>

Writes the value to standard error with a newline.

This is output regardless of the value that is_machine returns.

Trait Implementations§

source§

impl Clone for Writer

source§

fn clone(&self) -> Writer

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Writer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Writer

source§

fn default() -> Writer

Returns the “default value” for a type. Read more
source§

impl Write for Writer

source§

fn write(&mut self, buf: &[u8]) -> Result<usize>

Write a buffer into this writer, returning how many bytes were written. Read more
source§

fn flush(&mut self) -> Result<()>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · source§

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>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.