fn new<'b>(specs: &'a Specs, flag: &'b str) -> ValueResult<NamedFlagSpec<'a>> {
        let trimmed = if flag.starts_with("--") {
            &flag[2..]
        } else {
            &flag[1..]
        };
        let equals_idx = trimmed.rfind('=');
        let name = equals_idx.map_or(trimmed, |ei| &trimmed[0..ei]);
        let value = equals_idx.map_or(None, |ei| Some((&trimmed[ei + 1..]).to_owned()));

        let spec: &'a Spec = match specs.find_named_spec(name) {
            Some(s) => s,
            None => return Err(ValueError::UnknownFlag(name.to_owned())),
        };

        Ok(NamedFlagSpec {
            value: value,
            spec: spec,
        })
    }
/// Constructs a new NamedFlagSpec by parsing the given flag argument. The
/// given string must start with "-" or "--", and it may optionally contain
/// an associated value after an "=" character. The part of the string
/// after the hyphens but before the "=" is considered to be the flag name,
/// and is used to look up the associated Spec. This name may be either the
/// short or long name for the flag.
Constructs a new NamedFlagSpec by parsing the given flag argument.
Constructs a new NamedFlagSpec by parsing the given flag argument .
fn new<'b>(specs: &'a Specs, flag: &'b str) -> ValueResult<NamedFlagSpec<'a>> {
        let trimmed = if flag.starts_with("--") {
            &flag[2..]
        } else {
            &flag[1..]
        };
        let equals_idx = trimmed.rfind('=');
        let name = equals_idx.map_or(trimmed, |ei| &trimmed[0..ei]);
        let value = equals_idx.map_or(None, |ei| Some((&trimmed[ei + 1..]).to_owned()));
        let spec: &'a Spec = match specs.find_named_spec(name) {
            Some(s) => s,
            None => return Err(ValueError::UnknownFlag(name.to_owned())),
        };
        Ok(NamedFlagSpec {
            value: value,
            spec: spec,
        })
    }
fn new < ' b > ( specs : & ' a Specs , flag : & ' b str ) -> ValueResult < NamedFlagSpec < ' a > > { let trimmed = if flag . starts_with ( " " ) { & flag [ 2 .. ] } else { & flag [ 1 .. ] } ; let equals_idx = trimmed . rfind ( '=' ) ; let name = equals_idx . map_or ( trimmed , | ei | & trimmed [ 0 .. ei ] ) ; let value = equals_idx . map_or ( None , | ei | Some ( ( & trimmed [ ei + 1 .. ] ) . to_owned ( ) ) ) ; let spec : & ' a Spec = match specs . find_named_spec ( name ) { Some ( s ) => s , None => return Err ( ValueError :: UnknownFlag ( name . to_owned ( ) ) ) , } ; Ok ( NamedFlagSpec { value : value , spec : spec , } ) }
Constructs a new NamedFlagSpec by parsing the given flag argument.
Constructs a new NamedFlagSpec by parsing the given flag argument .
specs
&'a Specs
flag
&'b str
specs
&'a Specs
flag
&'b str