[−][src]Trait mapped_command::OutputMapping
Trait used to configure what Command::run()
returns.
Associated Types
type Output: 'static
[src]
The output produced by this command, if it is run and doesn't fail.
type Error: 'static
[src]
The error produced by this command, if it is run and does fail.
Required methods
fn capture_stdout(&self) -> bool
[src]
Return if stdout needs to be captured for this output mapping map_output
function.
This should be a pure function only depending on &self
.
fn capture_stderr(&self) -> bool
[src]
Return if stderr needs to be captured for this output mapping map_output
function.
This should be a pure function only depending on &self
.
fn map_output(
self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
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.
Implementors
impl OutputMapping for ReturnNothing
[src]
type Output = ()
type Error = CommandExecutionError
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
self: Box<Self>,
_stdout: Option<Vec<u8>>,
_stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
self: Box<Self>,
_stdout: Option<Vec<u8>>,
_stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl OutputMapping for ReturnStderr
[src]
type Output = Vec<u8>
type Error = CommandExecutionError
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
self: Box<Self>,
_stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
self: Box<Self>,
_stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl OutputMapping for ReturnStderrString
[src]
type Output = String
type Error = CommandExecutionWithStringOutputError
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
self: Box<Self>,
_stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
self: Box<Self>,
_stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl OutputMapping for ReturnStdout
[src]
type Output = Vec<u8>
type Error = CommandExecutionError
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
self: Box<Self>,
stdout: Option<Vec<u8>>,
_stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
self: Box<Self>,
stdout: Option<Vec<u8>>,
_stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl OutputMapping for ReturnStdoutAndErr
[src]
type Output = CapturedStdoutAndErr
type Error = CommandExecutionError
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl OutputMapping for ReturnStdoutAndErrStrings
[src]
type Output = CapturedStdoutAndErrStrings
type Error = CommandExecutionWithStringOutputError
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl OutputMapping for ReturnStdoutString
[src]
type Output = String
type Error = CommandExecutionWithStringOutputError
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
self: Box<Self>,
stdout: Option<Vec<u8>>,
_stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
self: Box<Self>,
stdout: Option<Vec<u8>>,
_stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl<O, E, F> OutputMapping for MapStderr<O, E, F> where
F: FnMut(Vec<u8>) -> Result<O, E>,
E: From<CommandExecutionError>,
[src]
F: FnMut(Vec<u8>) -> Result<O, E>,
E: From<CommandExecutionError>,
type Output = O
type Error = E
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
mut self: Box<Self>,
_stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
mut self: Box<Self>,
_stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl<O, E, F> OutputMapping for MapStderrString<O, E, F> where
F: FnMut(String) -> Result<O, E>,
E: From<CommandExecutionWithStringOutputError>,
[src]
F: FnMut(String) -> Result<O, E>,
E: From<CommandExecutionWithStringOutputError>,
type Output = O
type Error = E
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
mut self: Box<Self>,
_stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
mut self: Box<Self>,
_stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl<O, E, F> OutputMapping for MapStdout<O, E, F> where
F: FnMut(Vec<u8>) -> Result<O, E>,
E: From<CommandExecutionError>,
[src]
F: FnMut(Vec<u8>) -> Result<O, E>,
E: From<CommandExecutionError>,
type Output = O
type Error = E
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
mut self: Box<Self>,
stdout: Option<Vec<u8>>,
_stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
mut self: Box<Self>,
stdout: Option<Vec<u8>>,
_stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl<O, E, F> OutputMapping for MapStdoutAndErr<O, E, F> where
F: FnMut(CapturedStdoutAndErr) -> Result<O, E>,
E: From<CommandExecutionError>,
[src]
F: FnMut(CapturedStdoutAndErr) -> Result<O, E>,
E: From<CommandExecutionError>,
type Output = O
type Error = E
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
mut self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
mut self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl<O, E, F> OutputMapping for MapStdoutAndErrStrings<O, E, F> where
F: FnMut(CapturedStdoutAndErrStrings) -> Result<O, E>,
E: From<CommandExecutionWithStringOutputError>,
[src]
F: FnMut(CapturedStdoutAndErrStrings) -> Result<O, E>,
E: From<CommandExecutionWithStringOutputError>,
type Output = O
type Error = E
fn capture_stdout(&self) -> bool
[src]
fn capture_stderr(&self) -> bool
[src]
fn map_output(
mut self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
[src]
mut self: Box<Self>,
stdout: Option<Vec<u8>>,
stderr: Option<Vec<u8>>,
_exit_status: ExitStatus
) -> Result<Self::Output, Self::Error>
impl<O, E, F> OutputMapping for MapStdoutString<O, E, F> where
F: FnMut(String) -> Result<O, E>,
E: From<CommandExecutionWithStringOutputError>,
[src]
F: FnMut(String) -> Result<O, E>,
E: From<CommandExecutionWithStringOutputError>,