fn validate_arg(&self, arg: &str) -> Result<()> {
        if !arg.starts_with(ARG_PREFIX) {
            return Err(Error::UnexpectedArgument(arg.to_string()));
        }
        let arg_name = &arg[ARG_PREFIX.len()..];

        // Check if the argument is an expected one and, if yes, check that it was not
        // provided more than once.
        if self
            .args
            .get(arg_name)
            .ok_or_else(|| Error::UnexpectedArgument(arg_name.to_string()))?
            .user_value
            .is_some()
        {
            return Err(Error::DuplicateArgument(arg_name.to_string()));
        }
        Ok(())
    }
// Does a general validation of `arg` command line argument.
Does a general validation of `arg` command line argument.
Does a general validation of ` arg ` command line argument .
fn validate_arg(&self, arg: &str) -> Result<()> {
        if !arg.starts_with(ARG_PREFIX) {
            return Err(Error::UnexpectedArgument(arg.to_string()));
        }
        let arg_name = &arg[ARG_PREFIX.len()..];
        // Check if the argument is an expected one and, if yes, check that it was not
        // provided more than once.
        if self
            .args
            .get(arg_name)
            .ok_or_else(|| Error::UnexpectedArgument(arg_name.to_string()))?
            .user_value
            .is_some()
        {
            return Err(Error::DuplicateArgument(arg_name.to_string()));
        }
        Ok(())
    }
fn validate_arg ( & self , arg : & str ) -> Result < ( ) > { if ! arg . starts_with ( ARG_PREFIX ) { return Err ( Error :: UnexpectedArgument ( arg . to_string ( ) ) ) ; } let arg_name = & arg [ ARG_PREFIX . len ( ) .. ] ; // Check if the argument is an expected one and, if yes, check that it was not // provided more than once. if self . args . get ( arg_name ) . ok_or_else ( | | Error :: UnexpectedArgument ( arg_name . to_string ( ) ) ) ? . user_value . is_some ( ) { return Err ( Error :: DuplicateArgument ( arg_name . to_string ( ) ) ) ; } Ok ( ( ) ) }
Does a general validation of `arg` command line argument.
Does a general validation of ` arg ` command line argument .
&self
arg
&str