pub trait OutputMapping: 'static {
type Output: 'static;
type Error: 'static;
// Required methods
fn capture_stdout(&self) -> bool;
fn capture_stderr(&self) -> bool;
fn map_output(
self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
exit_status: ExitStatus,
) -> Result<Self::Output, Self::Error>;
}
Expand description
Trait used to configure what Command::run()
returns.
Required Associated Types§
Required Methods§
Sourcefn capture_stdout(&self) -> bool
fn capture_stdout(&self) -> bool
Return if stdout needs to be captured for this output mapping map_output
function.
This should be a pure function only depending on &self
.
Sourcefn capture_stderr(&self) -> bool
fn capture_stderr(&self) -> bool
Return if stderr needs to be captured for this output mapping map_output
function.
This should be a pure function only depending on &self
.
Sourcefn map_output(
self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
exit_status: ExitStatus,
) -> Result<Self::Output, Self::Error>
fn map_output( self: Box<Self>, stdout: Option<Vec<u8>>, stderr: Option<Vec<u8>>, exit_status: ExitStatus, ) -> Result<Self::Output, Self::Error>
The function called once the command’s run completed.
This function is used to convert the captured stdout/stderr
to an instance of the given Output
type.
If exist code checking is enabled and fails this function will not be called.
If it is disabled this function will be called and the implementation can still decide to fail due to an unexpected/bad exit status.