[][src]Struct pflag::FlagSet

pub struct FlagSet { /* fields omitted */ }

A FlagSet represents a set of defined flags.

Implementations

impl FlagSet[src]

pub fn new<S: Into<String>>(name: S) -> Self[src]

new returns a new, empty flag set with the specified name.

pub fn add_flag(&mut self, flag: Flag)[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<S: Into<String>>(&self, name: S) -> Option<&Flag>[src]

lookup returns the flag structure of the named flag, returning None if none exists.

pub fn set<S: Into<String>, T: Into<String>>(
    &mut self,
    name: S,
    value: T
) -> Result<(), String>
[src]

set sets the value of the named flag.

pub fn parse<'a>(
    &mut self,
    args: impl IntoIterator<Item = &'a str>
) -> Result<(), String>
[src]

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.

let mut flags = pflag::FlagSet::new("example");
flags.string("hello", String::new(), "example flag");

let args = vec!["--hello=world"];
if let Err(err) = flags.parse(args) {
    panic!(err);
}

pub fn bool<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: bool,
    usage: U
)
[src]

bool defines a bool flag with specified name, default value, and usage string.

pub fn bool_p<S, U>(&mut self, name: S, shorthand: char, value: bool, usage: U) where
    S: Into<String>,
    U: Into<String>, 
[src]

bool_p is like bool, but accepts a shorthand letter that can be used after a single dash.

pub fn bool_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<bool>,
    usage: U
)
[src]

bool_slice defines a Slice<bool> flag with specified name, default value, and usage string.

pub fn bool_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<bool>,
    usage: U
)
[src]

bool_p_slice is like bool_slice, but accepts a shorthand letter that can used after a single dash.

pub fn duration<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Duration,
    usage: U
)
[src]

Defines a time::Duration flag with specified name, default value, and usage string.

pub fn duration_p<S, U>(
    &mut self,
    name: S,
    shorthand: char,
    value: Duration,
    usage: U
) where
    S: Into<String>,
    U: Into<String>, 
[src]

duration_p is like duration, but accepts a shorthand letter that can be used after a single dash.

pub fn duration_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<Duration>,
    usage: U
)
[src]

duration_slice defines a Slice<time::Duration> flag with specified name, default value, and usage string.

pub fn duration_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<Duration>,
    usage: U
)
[src]

duration_p_slice is like duration_slice, but accepts a shorthand letter that can used after a single dash.

pub fn char<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: char,
    usage: U
)
[src]

char defines a char flag with specified name, default value, and usage string.

pub fn char_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: char,
    usage: U
)
[src]

char_p is like char, but accepts a shorthand letter that can be used after a single dash.

pub fn char_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<char>,
    usage: U
)
[src]

char_slice defines a Slice<char> flag with specified name, default value, and usage string.

pub fn char_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<char>,
    usage: U
)
[src]

char_p_slice is like char_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn string<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: String,
    usage: U
)
[src]

string defines a String flag with specified name, default value, and usage string.

pub fn string_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: String,
    usage: U
)
[src]

string_p is like string, but accepts a shorthand letter that can be used after a single dash.

pub fn string_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<String>,
    usage: U
)
[src]

string_slice defines a Slice<String> flag with specified name, default value, and usage string.

pub fn string_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<String>,
    usage: U
)
[src]

string_p_slice is like string_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn uint8<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: u8,
    usage: U
)
[src]

uint8 defines a u8 flag with specified name, default value, and usage string.

pub fn uint8_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: u8,
    usage: U
)
[src]

uint8_p is like uint8, but accepts a shorthand letter that can be used after a single dash.

pub fn uint8_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<u8>,
    usage: U
)
[src]

uint8_slice defines a Slice<u8> flag with specified name, default value, and usage string.

pub fn uint8_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<u8>,
    usage: U
)
[src]

uint8_p_slice is like uint8_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn uint16<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: u16,
    usage: U
)
[src]

uint16 defines a u16 flag with specified name, default value, and usage string.

pub fn uint16_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: u16,
    usage: U
)
[src]

uint16_p is like uint16, but accepts a shorthand letter that can be used after a single dash.

pub fn uint16_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<u16>,
    usage: U
)
[src]

uint16_slice defines a Slice<u16> flag with specified name, default value, and usage string.

pub fn uint16_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<u16>,
    usage: U
)
[src]

uint16_p_slice is like uint16_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn uint32<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: u32,
    usage: U
)
[src]

uint32 defines a u32 flag with specified name, default value, and usage string.

pub fn uint32_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: u32,
    usage: U
)
[src]

uint32_p is like uint32, but accepts a shorthand letter that can be used after a single dash.

pub fn uint32_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<u32>,
    usage: U
)
[src]

uint32_slice defines a Slice<u32> flag with specified name, default value, and usage string.

pub fn uint32_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<u32>,
    usage: U
)
[src]

uint32_p_slice is like uint32_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn uint64<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: u64,
    usage: U
)
[src]

uint64 defines a u64 flag with specified name, default value, and usage string.

pub fn uint64_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: u64,
    usage: U
)
[src]

uint64_p is like uint64, but accepts a shorthand letter that can be used after a single dash.

pub fn uint64_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<u64>,
    usage: U
)
[src]

uint64_slice defines a Slice<u64> flag with specified name, default value, and usage string.

pub fn uint64_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<u64>,
    usage: U
)
[src]

uint64_p_slice is like uint64_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn uint128<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: u128,
    usage: U
)
[src]

uint128 defines a u128 flag with specified name, default value, and usage string.

pub fn uint128_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: u128,
    usage: U
)
[src]

uint128_p is like uint128, but accepts a shorthand letter that can be used after a single dash.

pub fn uint128_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<u128>,
    usage: U
)
[src]

uint128_slice defines a Slice<u128> flag with specified name, default value, and usage string.

pub fn uint128_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<u128>,
    usage: U
)
[src]

uint128_p_slice is like uint128_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn usize<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: usize,
    usage: U
)
[src]

usize defines a usize flag with specified name, default value, and usage string.

pub fn usize_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: usize,
    usage: U
)
[src]

usize_p is like usize, but accepts a shorthand letter that can be used after a single dash.

pub fn usize_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<usize>,
    usage: U
)
[src]

usize_slice defines a Slice<usize> flag with specified name, default value, and usage string.

pub fn usize_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<usize>,
    usage: U
)
[src]

usize_p_slice is like usize_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn int8<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: i8,
    usage: U
)
[src]

int8 defines a i8 flag with specified name, default value, and usage string.

pub fn int8_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: i8,
    usage: U
)
[src]

int8_p is like int8, but accepts a shorthand letter that can be used after a single dash.

pub fn int8_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<i8>,
    usage: U
)
[src]

int8_slice defines a Slice<i8> flag with specified name, default value, and usage string.

pub fn int8_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<i8>,
    usage: U
)
[src]

int8_p_slice is like int8_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn int16<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: i16,
    usage: U
)
[src]

int16 defines a i16 flag with specified name, default value, and usage string.

pub fn int16_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: i16,
    usage: U
)
[src]

int16_p is like int16, but accepts a shorthand letter that can be used after a single dash.

pub fn int16_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<i16>,
    usage: U
)
[src]

int16_slice defines a Slice<i16> flag with specified name, default value, and usage string.

pub fn int16_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<i16>,
    usage: U
)
[src]

int16_p_slice is like int16_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn int32<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: i32,
    usage: U
)
[src]

int32 defines a i32 flag with specified name, default value, and usage string.

pub fn int32_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: i32,
    usage: U
)
[src]

int32_p is like int32, but accepts a shorthand letter that can be used after a single dash.

pub fn int32_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<i32>,
    usage: U
)
[src]

int32_slice defines a Slice<i32> flag with specified name, default value, and usage string.

pub fn int32_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<i32>,
    usage: U
)
[src]

int32_p_slice is like int32_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn int64<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: i64,
    usage: U
)
[src]

int64 defines a i64 flag with specified name, default value, and usage string.

pub fn int64_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: i64,
    usage: U
)
[src]

int64_p is like int64, but accepts a shorthand letter that can be used after a single dash.

pub fn int64_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<i64>,
    usage: U
)
[src]

int64_slice defines a Slice<i64> flag with specified name, default value, and usage string.

pub fn int64_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<i64>,
    usage: U
)
[src]

int64_p_slice is like int64_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn int128<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: i128,
    usage: U
)
[src]

int128 defines a i128 flag with specified name, default value, and usage string.

pub fn int128_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: i128,
    usage: U
)
[src]

int128_p is like int128, but accepts a shorthand letter that can be used after a single dash.

pub fn int128_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<i128>,
    usage: U
)
[src]

int128_slice defines a Slice<i128> flag with specified name, default value, and usage string.

pub fn int128_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<i128>,
    usage: U
)
[src]

int128_p_slice is like int128_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn isize<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: isize,
    usage: U
)
[src]

isize defines a isize flag with specified name, default value, and usage string.

pub fn isize_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: isize,
    usage: U
)
[src]

isize_p is like isize, but accepts a shorthand letter that can be used after a single dash.

pub fn isize_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<isize>,
    usage: U
)
[src]

isize_slice defines a Slice<isize> flag with specified name, default value, and usage string.

pub fn isize_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<isize>,
    usage: U
)
[src]

isize_p_slice is like isize_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn f32<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: f32,
    usage: U
)
[src]

f32 defines a f32 flag with specified name, default value, and usage string.

pub fn f32_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: f32,
    usage: U
)
[src]

f32_p is like f32, but accepts a shorthand letter that can be used after a single dash.

pub fn f32_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<f32>,
    usage: U
)
[src]

f32_slice defines a Slice<f32> flag with specified name, default value, and usage string.

pub fn f32_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<f32>,
    usage: U
)
[src]

f32_p_slice is like f32_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn f64<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: f64,
    usage: U
)
[src]

f64 defines a f64 flag with specified name, default value, and usage string.

pub fn f64_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: f64,
    usage: U
)
[src]

f64_p is like f64, but accepts a shorthand letter that can be used after a single dash.

pub fn f64_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<f64>,
    usage: U
)
[src]

f64_slice defines a Slice<f64> flag with specified name, default value, and usage string.

pub fn f64_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<f64>,
    usage: U
)
[src]

f64_p_slice is like f64_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn ip_addr<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: IpAddr,
    usage: U
)
[src]

ip_addr defines a IpAddr flag with specified name, default value, and usage string.

pub fn ip_addr_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: IpAddr,
    usage: U
)
[src]

ip_addr_p is like ip_addr, but accepts a shorthand letter that can be used after a single dash.

pub fn ip_addr_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<IpAddr>,
    usage: U
)
[src]

ip_addr_slice defines a Slice<IpAddr> flag with specified name, default value, and usage string.

pub fn ip_addr_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<IpAddr>,
    usage: U
)
[src]

ip_addr_p_slice is like ip_addr_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn ip_v4_addr<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Ipv4Addr,
    usage: U
)
[src]

ip_v4_addr defines a Ipv4Addr flag with specified name, default value, and usage string.

pub fn ip_v4_addr_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Ipv4Addr,
    usage: U
)
[src]

ip_v4_addr_p is like ip_v4_addr, but accepts a shorthand letter that can be used after a single dash.

pub fn ip_v4_addr_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<Ipv4Addr>,
    usage: U
)
[src]

ip_v4_addr_slice defines a Slice<Ipv4Addr> flag with specified name, default value, and usage string.

pub fn ip_v4_addr_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<Ipv4Addr>,
    usage: U
)
[src]

ip_v4_addr_p_slice is like ip_v4_addr_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn ip_v6_addr<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Ipv6Addr,
    usage: U
)
[src]

ip_v6_addr defines a Ipv6Addr flag with specified name, default value, and usage string.

pub fn ip_v6_addr_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Ipv6Addr,
    usage: U
)
[src]

ip_v6_addr_p is like ip_v6_addr, but accepts a shorthand letter that can be used after a single dash.

pub fn ip_v6_addr_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<Ipv6Addr>,
    usage: U
)
[src]

ip_v6_addr_slice defines a Slice<Ipv6Addr> flag with specified name, default value, and usage string.

pub fn ip_v6_addr_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<Ipv6Addr>,
    usage: U
)
[src]

ip_v6_addr_p_slice is like ip_v6_addr_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn socket_addr<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: SocketAddr,
    usage: U
)
[src]

socket_addr defines a SocketAddr flag with specified name, default value, and usage string.

pub fn socket_addr_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: SocketAddr,
    usage: U
)
[src]

socket_addr_p is like socket_addr, but accepts a shorthand letter that can be used after a single dash.

pub fn socket_addr_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<SocketAddr>,
    usage: U
)
[src]

socket_addr_slice defines a Slice<SocketAddr> flag with specified name, default value, and usage string.

pub fn socket_addr_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<SocketAddr>,
    usage: U
)
[src]

socket_addr_p_slice is like socket_addr_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn socket_addr_v4<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: SocketAddrV4,
    usage: U
)
[src]

socket_addr_v4 defines a SocketAddrV4 flag with specified name, default value, and usage string.

pub fn socket_addr_v4_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: SocketAddrV4,
    usage: U
)
[src]

socket_addr_v4_p is like socket_addr_v4, but accepts a shorthand letter that can be used after a single dash.

pub fn socket_addr_v4_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<SocketAddrV4>,
    usage: U
)
[src]

socket_addr_v4_slice defines a Slice<SocketAddrV4> flag with specified name, default value, and usage string.

pub fn socket_addr_v4_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<SocketAddrV4>,
    usage: U
)
[src]

socket_addr_v4_p_slice is like socket_addr_v4_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn socket_addr_v6<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: SocketAddrV6,
    usage: U
)
[src]

socket_addr_v6 defines a SocketAddrV6 flag with specified name, default value, and usage string.

pub fn socket_addr_v6_p<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: SocketAddrV6,
    usage: U
)
[src]

socket_addr_v6_p is like socket_addr_v6, but accepts a shorthand letter that can be used after a single dash.

pub fn socket_addr_v6_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    value: Slice<SocketAddrV6>,
    usage: U
)
[src]

socket_addr_v6_slice defines a Slice<SocketAddrV6> flag with specified name, default value, and usage string.

pub fn socket_addr_v6_p_slice<S: Into<String>, U: Into<String>>(
    &mut self,
    name: S,
    shorthand: char,
    value: Slice<SocketAddrV6>,
    usage: U
)
[src]

socket_addr_v6_p_slice is like socket_addr_v6_slice, but accepts a shorthand letter that can be used after a single dash.

pub fn var<N, V, U>(&mut self, name: N, value: V, usage: U) where
    N: Into<String>,
    V: Value + 'static,
    U: Into<String>, 
[src]

A helper method for creating flags with a custom Value implementation.

#[derive(Debug)]
pub struct Complex(f64, f64);

impl pflag::Value for Complex {
    fn set(&mut self, _: std::string::String) -> std::result::Result<(), pflag::ValueError> { todo!() }

    fn value(&self) -> &dyn std::any::Any { self }
}

let mut flags = pflag::FlagSet::new("custom");
flags.var("complex_number", Complex(0.0, 0.0), "a complex number");

pub fn var_p<N, V, U>(&mut self, name: N, shorthand: char, value: V, usage: U) where
    N: Into<String>,
    V: Value + 'static,
    U: Into<String>, 
[src]

A helper method for creating flags with a custom Value implementation.

pub fn value_of<T: 'static>(&self, name: &str) -> Option<&T>[src]

value_of retrieves a reference to the value for the given flag.

let mut flags = pflag::FlagSet::new("example");
flags.string("hello", "world".to_string(), "example");

let val = flags.value_of::<String>("hello").unwrap();
assert_eq!(*val, "world");

Trait Implementations

impl Display for FlagSet[src]

FlagSet implements fmt::Display to format the usage for all the flags in the set.

Auto Trait Implementations

impl !RefUnwindSafe for FlagSet

impl !Send for FlagSet

impl !Sync for FlagSet

impl Unpin for FlagSet

impl !UnwindSafe for FlagSet

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> ToString for T where
    T: Display + ?Sized
[src]

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.