[][src]Trait entrance::Options

pub trait Options: Sized {
    fn parse(option: OptionItem) -> Result<Self>;
fn is_informative(&self) -> bool;
fn trigger_informative<Args: Arguments>(
        &self,
        command: &Command<Self, Args>
    );
fn spec() -> &'static [Opt]; }

A trait for parsing and containing options.

Example

use entrance::{Command, Options};

#[derive(Options)]
enum Opts {
    #[entrance(description = "Print help message")]
    #[entrance(short = 'h')]
    #[entrance(informative(entrance::help))]
    Help,

    #[entrance(description = "Print version infomation")]
    #[entrance(informative(entrance::version))]
    Version,
}

Limitation

The derive macro for Options supports only an Enum whose variants don't have any field.

Required methods

fn parse(option: OptionItem) -> Result<Self>

fn is_informative(&self) -> bool

fn trigger_informative<Args: Arguments>(&self, command: &Command<Self, Args>)

fn spec() -> &'static [Opt]

This associated function is for HelpDisplay.

Loading content...

Implementations on Foreign Types

impl Options for ()[src]

Loading content...

Implementors

Loading content...