Struct command_error::OutputContext
source · pub struct OutputContext<O> { /* private fields */ }
Expand description
Output
combined with context about the Command
that produced it.
This contains additional information about the command that was run (via a CommandDisplay
object) and can be used to construct error messages (for use in methods like
CommandExt::output_checked_as
).
Note that because ExitStatus
has a trivial implementation for OutputLike
(where
stdout
and stderr
return empty strings), this
is also used as context for status
calls.
Implementations§
source§impl<O> OutputContext<O>where
O: OutputLike + 'static,
impl<O> OutputContext<O>where
O: OutputLike + 'static,
sourcepub fn into_output(self) -> O
pub fn into_output(self) -> O
Get the OutputLike
data contained in this context object.
sourcepub fn output(&self) -> &O
pub fn output(&self) -> &O
Get a reference to the OutputLike
data contained in this context object.
sourcepub fn status(&self) -> ExitStatus
pub fn status(&self) -> ExitStatus
Get the command’s ExitStatus
.
sourcepub fn command(&self) -> &dyn CommandDisplay
pub fn command(&self) -> &dyn CommandDisplay
Get a reference to the command contained in this context object, for use in error messages or diagnostics.
sourcepub fn into_command(self) -> Box<dyn CommandDisplay>
pub fn into_command(self) -> Box<dyn CommandDisplay>
Get the command contained in this context object, for use in error messages or diagnostics.
sourcepub fn error(self) -> Error
pub fn error(self) -> Error
Construct an error that indicates this command failed, containing information about the command and its output.
See CommandExt
for examples of the error format.