Skip to main content

CommandOption

Trait CommandOption 

Source
pub trait CommandOption {
    // Required method
    fn definition(&self) -> OptionDef;

    // Provided method
    fn value_resolver(&self) -> Option<ValueProvider> { ... }
}
Expand description

One attachment of a shared option to a command: the DRY parse definition plus this command’s value resolver.

The same option name may be attached by many commands; they must all return an equal OptionDef from definition, but each may return its own value_resolver.

Required Methods§

Source

fn definition(&self) -> OptionDef

The shared, parse-defining shape. Must be identical for a given option name across every command that attaches it.

Provided Methods§

Source

fn value_resolver(&self) -> Option<ValueProvider>

This command’s value completer. None means no value completion (a boolean flag, or a value with no closed/known set). May differ between commands that share the same definition().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§