pub fn new(specs: Vec<Spec>) -> Result<Specs> {
        if !specs
            .iter()
            .filter(|s| s.is_positional())
            .skip_while(|s| !s.has_default_value())
            .all(|s| s.has_default_value())
        {
            return Err(Error::InvalidArgument(format!(
                "Positional flags after the first one with a default must also have defaults"
            )));
        }

        if !specs
            .iter()
            .rev()
            .skip_while(|s| !s.is_positional())
            .next()
            .map_or(true, |s| s.is_variadic() || s.default_value_len() <= 1)
        {
            return Err(Error::InvalidArgument(format!(
                "The last positional flag can only have multiple default values if it is variadic"
            )));
        }

        Ok(Specs { specs: specs })
    }
/// Construct a new Specs structure from the given complete list of flag
/// Spec structures.
///
/// This may return an error if the Spec structures, taken together, are
/// invalid (for example, if *multiple* variadic flags are defined).
Construct a new Specs structure from the given complete list of flag
Spec structures.

This may return an error if the Spec structures, taken together, are
invalid (for example, if *multiple* variadic flags are defined).
Construct a new Specs structure from the given complete list of flag Spec structures . This may return an error if the Spec structures taken together are invalid ( for example if * multiple * variadic flags are defined ) .
pub fn new(specs: Vec<Spec>) -> Result<Specs> {
        if !specs
            .iter()
            .filter(|s| s.is_positional())
            .skip_while(|s| !s.has_default_value())
            .all(|s| s.has_default_value())
        {
            return Err(Error::InvalidArgument(format!(
                "Positional flags after the first one with a default must also have defaults"
            )));
        }
        if !specs
            .iter()
            .rev()
            .skip_while(|s| !s.is_positional())
            .next()
            .map_or(true, |s| s.is_variadic() || s.default_value_len() <= 1)
        {
            return Err(Error::InvalidArgument(format!(
                "The last positional flag can only have multiple default values if it is variadic"
            )));
        }
        Ok(Specs { specs: specs })
    }
pub fn new ( specs : Vec < Spec > ) -> Result < Specs > { if ! specs . iter ( ) . filter ( | s | s . is_positional ( ) ) . skip_while ( | s | ! s . has_default_value ( ) ) . all ( | s | s . has_default_value ( ) ) { return Err ( Error :: InvalidArgument ( format ! ( " " ) ) ) ; } if ! specs . iter ( ) . rev ( ) . skip_while ( | s | ! s . is_positional ( ) ) . next ( ) . map_or ( true , | s | s . is_variadic ( ) || s . default_value_len ( ) <= 1 ) { return Err ( Error :: InvalidArgument ( format ! ( " " ) ) ) ; } Ok ( Specs { specs : specs } ) }
Construct a new Specs structure from the given complete list of flag
Spec structures.
Construct a new Specs structure from the given complete list of flag Spec structures .
specs
Vec<Spec>
specs
Vec<Spec>