fn new_named_flag_value(spec: &Spec, value: Option<String>) -> ValueResult<Value> {
    Ok(match spec.is_boolean() {
        false => Value::Single(match value {
            None => return Err(ValueError::MissingValue(spec.get_name().to_owned())),
            Some(value) => value,
        }),
        true => Value::Boolean(match value {
            None => true.to_string(),
            Some(value) => {
                if value.parse::<bool>().is_err() {
                    return Err(ValueError::BadBoolean(value.clone()));
                }

                value
            }
        }),
    })
}
/// Constructs a new Value for a named flag. Note that named flags can never
/// have repeated values, so this function only handles the Single and
/// Boolean cases.
Constructs a new Value for a named flag. Note that named flags can never
have repeated values, so this function only handles the Single and
Boolean cases.
Constructs a new Value for a named flag . Note that named flags can never have repeated values so this function only handles the Single and Boolean cases .
fn new_named_flag_value(spec: &Spec, value: Option<String>) -> ValueResult<Value> {
    Ok(match spec.is_boolean() {
        false => Value::Single(match value {
            None => return Err(ValueError::MissingValue(spec.get_name().to_owned())),
            Some(value) => value,
        }),
        true => Value::Boolean(match value {
            None => true.to_string(),
            Some(value) => {
                if value.parse::<bool>().is_err() {
                    return Err(ValueError::BadBoolean(value.clone()));
                }
                value
            }
        }),
    })
}
fn new_named_flag_value ( spec : & Spec , value : Option < String > ) -> ValueResult < Value > { Ok ( match spec . is_boolean ( ) { false => Value :: Single ( match value { None => return Err ( ValueError :: MissingValue ( spec . get_name ( ) . to_owned ( ) ) ) , Some ( value ) => value , } ) , true => Value :: Boolean ( match value { None => true . to_string ( ) , Some ( value ) => { if value . parse :: < bool > ( ) . is_err ( ) { return Err ( ValueError :: BadBoolean ( value . clone ( ) ) ) ; } value } } ) , } ) }
Constructs a new Value for a named flag.
Constructs a new Value for a named flag .
spec
&Spec
value
Option<String>
spec
&Spec
value
Option<String>