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,
}
Expand description
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
sourceimpl Flag
impl Flag
sourcepub fn new<T: Into<String>>(name: T, flag_type: FlagType, description: T) -> Flag
pub fn new<T: Into<String>>(name: T, flag_type: FlagType, description: T) -> Flag
Creates a new instance of Flag
sourcepub fn with_all_field(
name: String,
description: String,
short_alias: Vector<char>,
long_alias: Vector<String>,
flag_type: FlagType,
default_value: FlagValue
) -> Flag
pub fn with_all_field(
name: String,
description: String,
short_alias: Vector<char>,
long_alias: Vector<String>,
flag_type: FlagType,
default_value: FlagValue
) -> Flag
Builds a new instance of Flags with all options.
sourcepub fn with_name_and_type<T: Into<String>>(name: T, flag_type: FlagType) -> Self
pub fn with_name_and_type<T: Into<String>>(name: T, flag_type: FlagType) -> Self
Creates a new instance of Flag with name and type
sourcepub fn new_string<T: Into<String>>(name: T) -> Self
pub fn new_string<T: Into<String>>(name: T) -> Self
Creates a new instance of string Flag
sourcepub fn short_alias<T: Into<char>>(self, a: T) -> Self
pub fn short_alias<T: Into<char>>(self, a: T) -> Self
Add an short alias to this Flag
sourcepub fn default_value(self, default_value: FlagValue) -> Self
pub fn default_value(self, default_value: FlagValue) -> Self
Set this flag’s default value
sourcepub fn description<T: Into<String>>(self, description: T) -> Self
pub fn description<T: Into<String>>(self, description: T) -> Self
Set this flag’s description
sourcepub fn any_short(&self, aliases: Chars<'_>) -> Vector<usize>
pub fn any_short(&self, aliases: Chars<'_>) -> Vector<usize>
Returns positions alias in aliases matches one of short alias.
sourcepub fn get_name_clone(&self) -> String
pub fn get_name_clone(&self) -> String
Get this Flag’s name’s clone
sourcepub fn derive_flag_value_from_string(&self, arg: String) -> FlagValue
pub fn derive_flag_value_from_string(&self, arg: String) -> FlagValue
Derives this Flag’s value from arg Alias of self.flag_type.get_value_from_string(arg)
sourcepub fn derive_flag_value_if_no_value(&self) -> FlagValue
pub fn derive_flag_value_if_no_value(&self) -> FlagValue
Derives this Flag’s value in case of no value Alias of self.flag_type.get_value_if_no_value()
Trait Implementations
impl StructuralPartialEq for Flag
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more