cute::opt

Trait StateOpt

Source
pub trait StateOpt {
    type S: State;

    // Required methods
    fn name(&self) -> &str;
    fn state(&self) -> &Self::S;

    // Provided methods
    fn consume(&self) -> bool { ... }
    fn match<'a>(&self, arg: &'a str) -> Match<'a> { ... }
}
Expand description

Trait defining the behavior of a command-line option

Required Associated Types§

Source

type S: State

The associated state type

Required Methods§

Source

fn name(&self) -> &str

Returns the name of the option

Source

fn state(&self) -> &Self::S

Returns the associated state

Provided Methods§

Source

fn consume(&self) -> bool

Indicates whether this option consumes the next argument

Source

fn match<'a>(&self, arg: &'a str) -> Match<'a>

Attempts to match the given argument with this option

Implementors§

Source§

impl<S: State> StateOpt for Opt<'_, S>

Source§

type S = S