pub enum Outcome<T> {
Parsed(T),
Help(Printed),
Version(Printed),
Failed(Printed),
}Expand description
What one command line does to a CLI.
The four things parse() can do, as a value instead of a side effect: a struct, a page, a
version, or a failure. A test asserting that ex with no arguments prints help is asserting
on Outcome::Help, which is not something a Result can say.
Variants§
Parsed(T)
It parsed.
Help(Printed)
Help was asked for — or shown because nothing was asked for at all, which is the case
with stderr set and a non-zero code.
Version(Printed)
A version was asked for.
Failed(Printed)
The command line did not parse, and this is what the user reads.
Implementations§
Source§impl<T> Outcome<T>
impl<T> Outcome<T>
Sourcepub fn parsed(self) -> T
pub fn parsed(self) -> T
The parsed struct, panicking with what the CLI would have printed instead.
Sourcepub fn printed(&self) -> Option<&Printed>
pub fn printed(&self) -> Option<&Printed>
What would have been printed, for anything that is not a parse.
Sourcepub fn text(&self) -> Option<&str>
pub fn text(&self) -> Option<&str>
The text of Outcome::printed, for an assertion that only cares what it says.
Trait Implementations§
impl<T: Eq> Eq for Outcome<T>
impl<T: PartialEq> StructuralPartialEq for Outcome<T>
Auto Trait Implementations§
impl<T> Freeze for Outcome<T>where
T: Freeze,
impl<T> RefUnwindSafe for Outcome<T>where
T: RefUnwindSafe,
impl<T> Send for Outcome<T>where
T: Send,
impl<T> Sync for Outcome<T>where
T: Sync,
impl<T> Unpin for Outcome<T>where
T: Unpin,
impl<T> UnsafeUnpin for Outcome<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Outcome<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more