[][src]Trait mapped_command::OutputMapping

pub trait OutputMapping: 'static {
    type Output: 'static;
    type Error: 'static;
    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>; }

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.

Loading content...

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]

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.

Loading content...

Implementors

impl OutputMapping for ReturnNothing[src]

type Output = ()

type Error = CommandExecutionError

impl OutputMapping for ReturnStderr[src]

type Output = Vec<u8>

type Error = CommandExecutionError

impl OutputMapping for ReturnStderrString[src]

type Output = String

type Error = CommandExecutionWithStringOutputError

impl OutputMapping for ReturnStdout[src]

type Output = Vec<u8>

type Error = CommandExecutionError

impl OutputMapping for ReturnStdoutAndErr[src]

type Output = CapturedStdoutAndErr

type Error = CommandExecutionError

impl OutputMapping for ReturnStdoutAndErrStrings[src]

type Output = CapturedStdoutAndErrStrings

type Error = CommandExecutionWithStringOutputError

impl OutputMapping for ReturnStdoutString[src]

type Output = String

type Error = CommandExecutionWithStringOutputError

impl<O, E, F> OutputMapping for MapStderr<O, E, F> where
    F: FnMut(Vec<u8>) -> Result<O, E>,
    E: From<CommandExecutionError>, 
[src]

type Output = O

type Error = E

impl<O, E, F> OutputMapping for MapStderrString<O, E, F> where
    F: FnMut(String) -> Result<O, E>,
    E: From<CommandExecutionWithStringOutputError>, 
[src]

type Output = O

type Error = E

impl<O, E, F> OutputMapping for MapStdout<O, E, F> where
    F: FnMut(Vec<u8>) -> Result<O, E>,
    E: From<CommandExecutionError>, 
[src]

type Output = O

type Error = E

impl<O, E, F> OutputMapping for MapStdoutAndErr<O, E, F> where
    F: FnMut(CapturedStdoutAndErr) -> Result<O, E>,
    E: From<CommandExecutionError>, 
[src]

type Output = O

type Error = E

impl<O, E, F> OutputMapping for MapStdoutAndErrStrings<O, E, F> where
    F: FnMut(CapturedStdoutAndErrStrings) -> Result<O, E>,
    E: From<CommandExecutionWithStringOutputError>, 
[src]

type Output = O

type Error = E

impl<O, E, F> OutputMapping for MapStdoutString<O, E, F> where
    F: FnMut(String) -> Result<O, E>,
    E: From<CommandExecutionWithStringOutputError>, 
[src]

type Output = O

type Error = E

Loading content...