[−][src]Struct pflag::FlagSet
A FlagSet represents a set of defined flags.
Implementations
impl<'a> FlagSet<'a>[src]
pub fn new(name: &'a str) -> Self[src]
new returns a new, empty flag set with the specified name.
pub fn add_flag(&mut self, flag: Flag<'a>)[src]
add_flag will add the flag to the FlagSet.
pub fn parsed(&self) -> bool[src]
parsed reports whether self.parse has been called.
pub fn args(&self) -> Vec<String>[src]
args returns the non-flag arguments.
pub fn visit<F: FnMut(&Flag<'_>)>(&self, f: F)[src]
visit visits the flags in lexicographical order or in primordial order if f.SortFlags is false, calling fn for each. It visits only those flags that have been set.
pub fn visit_all<F: FnMut(&Flag<'_>)>(&self, f: F)[src]
visit_all visits the flags in lexicographical order or in primordial order if f.SortFlags is false, calling fn for each. It visits all flags, even those not set.
pub fn lookup(&self, name: &str) -> Option<Ref<'_, Flag<'_>>>[src]
lookup returns the flag structure of the named flag, returning None if none exists.
pub fn set(&mut self, name: &str, value: &str) -> Result<(), String>[src]
set sets the value of the named flag.
pub fn parse(
&mut self,
args: impl IntoIterator<Item = String>
) -> Result<(), String>[src]
&mut self,
args: impl IntoIterator<Item = String>
) -> Result<(), String>
parse parses flag definitions from the argument list, which should not include the command name. Must be called after all flags in the FlagSet are defined and before flags are accessed by the program. The return value will be ErrHelp if -help was set but not defined.
pub fn bool(&mut self, name: &'a str, value: bool, usage: &'a str)[src]
bool defines a bool flag with specified name, default value, and usage string.
pub fn char(&mut self, name: &'a str, value: char, usage: &'a str)[src]
char defines a char flag with specified name, default value, and usage string.
pub fn string(&mut self, name: &'a str, value: String, usage: &'a str)[src]
string defines a String flag with specified name, default value, and usage string.
pub fn uint8(&mut self, name: &'a str, value: u8, usage: &'a str)[src]
uint8 defines a u8 flag with specified name, default value, and usage string.
pub fn uint16(&mut self, name: &'a str, value: u16, usage: &'a str)[src]
uint16 defines a u16 flag with specified name, default value, and usage string.
pub fn uint32(&mut self, name: &'a str, value: u32, usage: &'a str)[src]
uint32 defines a u32 flag with specified name, default value, and usage string.
pub fn uint64(&mut self, name: &'a str, value: u64, usage: &'a str)[src]
uint64 defines a u64 flag with specified name, default value, and usage string.
pub fn uint128(&mut self, name: &'a str, value: u128, usage: &'a str)[src]
uint128 defines a u128 flag with specified name, default value, and usage string.
pub fn usize(&mut self, name: &'a str, value: usize, usage: &'a str)[src]
usize defines a usize flag with specified name, default value, and usage string.
pub fn int8(&mut self, name: &'a str, value: i8, usage: &'a str)[src]
int8 defines a i8 flag with specified name, default value, and usage string.
pub fn int16(&mut self, name: &'a str, value: i16, usage: &'a str)[src]
int16 defines a i16 flag with specified name, default value, and usage string.
pub fn int32(&mut self, name: &'a str, value: i32, usage: &'a str)[src]
int32 defines a i32 flag with specified name, default value, and usage string.
pub fn int64(&mut self, name: &'a str, value: i64, usage: &'a str)[src]
int64 defines a i64 flag with specified name, default value, and usage string.
pub fn int128(&mut self, name: &'a str, value: i128, usage: &'a str)[src]
int128 defines a i128 flag with specified name, default value, and usage string.
pub fn isize(&mut self, name: &'a str, value: isize, usage: &'a str)[src]
isize defines a isize flag with specified name, default value, and usage string.
pub fn f32(&mut self, name: &'a str, value: f32, usage: &'a str)[src]
f32 defines a f32 flag with specified name, default value, and usage string.
pub fn f64(&mut self, name: &'a str, value: f64, usage: &'a str)[src]
f64 defines a f64 flag with specified name, default value, and usage string.
pub fn ip_addr(&mut self, name: &'a str, value: IpAddr, usage: &'a str)[src]
ip_addr defines a std::net::IpAddr flag with specified name, default value, and usage string.
pub fn ip_v4_addr(&mut self, name: &'a str, value: Ipv4Addr, usage: &'a str)[src]
ip_v4_addr defines a std::net::Ipv4Addr flag with specified name, default value, and usage string.
pub fn ip_v6_addr(&mut self, name: &'a str, value: Ipv6Addr, usage: &'a str)[src]
ip_v6_addr defines a std::net::Ipv6Addr flag with specified name, default value, and usage string.
pub fn socket_addr(&mut self, name: &'a str, value: SocketAddr, usage: &'a str)[src]
socket_addr defines a std::net::SocketAddr flag with specified name, default value, and usage string.
pub fn socket_addr_v4(
&mut self,
name: &'a str,
value: SocketAddrV4,
usage: &'a str
)[src]
&mut self,
name: &'a str,
value: SocketAddrV4,
usage: &'a str
)
socket_addr_v4 defines a std::net::SocketAddrV4 flag with specified name, default value, and usage string.
pub fn socket_addr_v6(
&mut self,
name: &'a str,
value: SocketAddrV6,
usage: &'a str
)[src]
&mut self,
name: &'a str,
value: SocketAddrV6,
usage: &'a str
)
socket_addr_v6 defines a std::net::SocketAddrV6 flag with specified name, default value, and usage string.
pub fn value_of<T: FromStr<Err: Debug>>(&self, name: &str) -> T[src]
value_of retrieves the value for the given flags name.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for FlagSet<'a>
impl<'a> !Send for FlagSet<'a>
impl<'a> !Sync for FlagSet<'a>
impl<'a> Unpin for FlagSet<'a>
impl<'a> !UnwindSafe for FlagSet<'a>
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,
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> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
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.
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>,