[][src]Struct combu::Flag

pub struct Flag {
    pub name: String,
    pub description: String,
    pub short_alias: Vector<char>,
    pub long_alias: Vector<String>,
    pub default_value: FlagValue,
    pub flag_type: FlagType,
}

Struct for Flag setting's information

Fields

name: String

This flag's name

description: String

This flag's description

short_alias: Vector<char>

Vector of this flag's short alias

long_alias: Vector<String>

Vector of this flag's long alias

default_value: FlagValue

This flag's default value

flag_type: FlagType

This flag's flag_type

Implementations

impl Flag[src]

pub fn new<T: Into<String>>(
    name: T,
    flag_type: FlagType,
    description: T
) -> Flag
[src]

Creates a new instance of Flag

pub fn build_new(
    name: String,
    description: String,
    short_alias: Vector<char>,
    long_alias: Vector<String>,
    flag_type: FlagType,
    default_value: FlagValue
) -> Flag
[src]

Builds a new instance of Flags with all options.

pub fn with_name<T: Into<String>>(name: T) -> Self[src]

Creates a new instance of Flag with name

pub fn with_name_and_type<T: Into<String>>(name: T, flag_type: FlagType) -> Self[src]

Creates a new instance of Flag with name and type

pub fn new_bool<T: Into<String>>(name: T) -> Self[src]

Creates a new instance of bool Flag

pub fn new_string<T: Into<String>>(name: T) -> Self[src]

Creates a new instance of string Flag

pub fn new_int<T: Into<String>>(name: T) -> Self[src]

Creates a new instance of int Flag

pub fn new_float<T: Into<String>>(name: T) -> Self[src]

Creates a new instance of float Flag

pub fn short_alias<T: Into<char>>(self, a: T) -> Self[src]

Add an short alias to this Flag

pub fn alias<T: Into<String>>(self, a: T) -> Self[src]

Add an alias to this Flag

pub fn default_value(self, default_value: FlagValue) -> Self[src]

Set this flag's default value

pub fn description<T: Into<String>>(self, description: T) -> Self[src]

Set this flag's description

pub fn is(&self, name: &str) -> bool[src]

Returns true if &self's name equals name of arg.

pub fn is_short(&self, alias: &char) -> bool[src]

Returns true is alias equals one of short alias

pub fn any_short(&self, aliases: Chars<'_>) -> Vector<usize>[src]

Returns positions alias in aliases matches one of short alias.

pub fn is_long(&self, alias: &str) -> bool[src]

Returns true is alias equals one of long alias

pub fn get_name_clone(&self) -> String[src]

Get this Flag's name's clone

pub fn derive_flag_value_from_string(&self, arg: String) -> FlagValue[src]

Derives this Flag's value from arg Alias of self.flag_type.get_value_from_string(arg)

pub fn derive_flag_value_if_no_value(&self) -> FlagValue[src]

Derives this Flag's value in case of no value Alias of self.flag_type.get_value_if_no_value()

pub fn help(&self, append_to: String, name_and_alias_min_width: usize) -> String[src]

Add help for this flag to append_to. name_and_alias_min_width means min width of name and alias' field.
Flagに対するヘルプをappend_toに追加する。nameとalias表示部分のずれをある程度吸収できるようにその部分の最小幅をname_and_alias_min_widthで指定する

Trait Implementations

impl Clone for Flag[src]

impl Debug for Flag[src]

impl Default for Flag[src]

impl<'_> From<&'_ str> for Flag[src]

impl From<String> for Flag[src]

Auto Trait Implementations

impl RefUnwindSafe for Flag

impl Send for Flag

impl Sync for Flag

impl Unpin for Flag

impl UnwindSafe for Flag

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.