pub trait TestOutputSink {
// Required methods
fn write_stdout(
&mut self,
executable: &TestExecutable,
bytes: &[u8],
) -> Result<()>;
fn write_stderr(
&mut self,
executable: &TestExecutable,
bytes: &[u8],
) -> Result<()>;
// Provided method
fn test_finished(&mut self, result: &TestRunResult) -> Result<()> { ... }
}Expand description
Sink for test executable output. The runner forwards stdout /
stderr chunks to this sink while each process is still
running, and also keeps a full captured copy in
TestRunResult. Tests in this crate use null_sink to
discard output.
Required Methods§
Sourcefn write_stdout(
&mut self,
executable: &TestExecutable,
bytes: &[u8],
) -> Result<()>
fn write_stdout( &mut self, executable: &TestExecutable, bytes: &[u8], ) -> Result<()>
Sourcefn write_stderr(
&mut self,
executable: &TestExecutable,
bytes: &[u8],
) -> Result<()>
fn write_stderr( &mut self, executable: &TestExecutable, bytes: &[u8], ) -> Result<()>
Provided Methods§
Sourcefn test_finished(&mut self, result: &TestRunResult) -> Result<()>
fn test_finished(&mut self, result: &TestRunResult) -> Result<()>
Called exactly once per executable, immediately after it
exits and before the next executable starts. Streaming
sinks render the per-test result line here so multi-test
runs report progress the way cargo test does. The
default implementation does nothing.
§Errors
Returns the implementor’s io::Error if the sink fails to
write the result line.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".