Struct seahorse::Flag [−][src]
Flag
type.
Option flag struct
Fields
name: String
Flag name
description: Option<String>
Flag description
flag_type: FlagType
Flag type
alias: Option<Vec<String>>
Flag alias
Implementations
impl Flag
[src]
pub fn new<T: Into<String>>(name: T, flag_type: FlagType) -> Self
[src]
Create new instance of Flag
Example
use seahorse::{Flag, FlagType}; let bool_flag = Flag::new("bool", FlagType::Bool); let float_flag = Flag::new("float", FlagType::Float);
pub fn description<T: Into<String>>(self, description: T) -> Self
[src]
Set description of the flag
Example
use seahorse::{Flag, FlagType}; let bool_flag = Flag::new("bool", FlagType::Bool) .description("cli cmd Hello --bool");
pub fn alias<T: Into<String>>(self, name: T) -> Self
[src]
Set alias of the flag
Example
use seahorse::{Flag, FlagType}; let bool_flag = Flag::new("bool", FlagType::Bool) .alias("b"); let string_flag = Flag::new("string", FlagType::String) .alias("s") .alias("str");
pub fn option_index(&self, v: &[String]) -> Option<usize>
[src]
Get flag position from command line argument
pub fn value(&self, v: Option<String>) -> Result<FlagValue, FlagError>
[src]
Get flag value
Trait Implementations
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,