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 (unless allow_multiple is set).
        let argument = self
            .args
            .get(arg_name)
            .ok_or_else(|| Error::UnexpectedArgument(arg_name.to_string()))?;

        if !argument.allow_multiple && argument.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 (unless allow_multiple is set).
        let argument = self
            .args
            .get(arg_name)
            .ok_or_else(|| Error::UnexpectedArgument(arg_name.to_string()))?;
        if !argument.allow_multiple && argument.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 (unless allow_multiple is set). let argument = self . args . get ( arg_name ) . ok_or_else ( | | Error :: UnexpectedArgument ( arg_name . to_string ( ) ) ) ? ; if ! argument . allow_multiple && argument . 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
&self
arg
&str