pub struct Writer<O: OutputSink> { /* private fields */ }
Expand description
Writer
handles formatting and delivering output from both the plugin and fuzzer.
Callers can use this object to configure how output should be formatted, suppressed, etc. The
underlying OutputSink
is responsible for determining where output actually goes. The plugin
uses print
and error
, while the fuzzer uses write_all
and log
. Fuzzer output can be
paused and resumed, with data being buffered between those calls.
Implementations§
Source§impl<O: OutputSink> Writer<O>
impl<O: OutputSink> Writer<O>
Sourcepub fn new(output: O) -> Self
pub fn new(output: O) -> Self
Creates a new Writer
.
This object will display data received by methods like print
by formatting it and sending
it to the given output
sink.
Sourcepub fn use_colors(&mut self, use_colors: bool)
pub fn use_colors(&mut self, use_colors: bool)
If true, embeds ANSI escape sequences in the output to add colors and styles.
Sourcepub fn tee<P: AsRef<Path>, S: AsRef<str>>(
&self,
dirname: P,
filename: S,
) -> Result<Writer<O>>
pub fn tee<P: AsRef<Path>, S: AsRef<str>>( &self, dirname: P, filename: S, ) -> Result<Writer<O>>
Creates a new Writer
that is a clone of this object, except that it duplicates its output
and writes it to a file created from dirname
and filename
.
Sourcepub fn print<D: Display>(&self, message: D)
pub fn print<D: Display>(&self, message: D)
Writes a displayable message to the OutputSink
.
This method is used with output from the ffx fuzz
plugin.
Sourcepub fn error<D: Display>(&self, message: D)
pub fn error<D: Display>(&self, message: D)
Writes a displayable error to the OutputSink
.
This method is used with output from the ffx fuzz
plugin.
Sourcepub fn write_all(&self, buf: &[u8])
pub fn write_all(&self, buf: &[u8])
Writes bytes directly to the OutputSink
.
This method is used with output from the fuzzer. If pause
is called, data passed to this
method will be buffered until resume
is called.
Sourcepub fn log(&self, logs_data: LogsData)
pub fn log(&self, logs_data: LogsData)
Writes a structured log entry to the OutputSink
.
This method is used with output from the fuzzer. If pause
is called, data passed to this
method will be buffered until resume
is called.
The display format loosely imitates that of ffx log
as implemented by that plugin’s
DefaultLogFormatter
.
Trait Implementations§
Source§impl<O: OutputSink> Clone for Writer<O>
impl<O: OutputSink> Clone for Writer<O>
Auto Trait Implementations§
impl<O> Freeze for Writer<O>where
O: Freeze,
impl<O> !RefUnwindSafe for Writer<O>
impl<O> !Send for Writer<O>
impl<O> !Sync for Writer<O>
impl<O> Unpin for Writer<O>where
O: Unpin,
impl<O> !UnwindSafe for Writer<O>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)