pub trait PublicCommandOutput:
Debug
+ Serialize
+ CommandNomParsable {
type PrimarySuccess: Debug;
// Required method
fn success(&self) -> Result<&Self::PrimarySuccess>;
// Provided methods
fn successful(&self) -> bool { ... }
fn failed(&self) -> bool { ... }
}Expand description
Common operations that should be implemented on all command outputs. Often the ‘success’ of a command is a semantics issue, and is hence not by default implemented as a plain std::result::Result. This trait bridges the gap between custom command output types and Result, but it is good to check the documentation for the specific command to see if you agree with what outputs are classes as ‘errors’.
Required Associated Types§
Sourcetype PrimarySuccess: Debug
type PrimarySuccess: Debug
If applicable, what the commands successful output should be. If no output is application, often a bool as returned in PublicCommandOutput::successful
Required Methods§
Sourcefn success(&self) -> Result<&Self::PrimarySuccess>
fn success(&self) -> Result<&Self::PrimarySuccess>
Will return Error::OutputErrored if the command was not successful.
Provided Methods§
Sourcefn successful(&self) -> bool
fn successful(&self) -> bool
Did command exit with an ‘expected’ success case?
fn failed(&self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.