Trait apple_clis::shared::PublicCommandOutput

source ·
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§

source

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§

source

fn success(&self) -> Result<&Self::PrimarySuccess>

Will return Error::OutputErrored if the command was not successful.

Provided Methods§

source

fn successful(&self) -> bool

Did command exit with an ‘expected’ success case?

source

fn failed(&self) -> bool

Object Safety§

This trait is not object safe.

Implementors§