/// validate_name returns an error if the name is invalid
/// (we require 3-64 lowercase ascii letters, numbers, or . - _)
validate_name returns an error if the name is invalid
(we require 3-64 lowercase ascii letters, numbers, or .
validate_name returns an error if the name is invalid ( we require 3 - 64 lowercase ascii letters numbers or .
fn validate_name(name: String) -> StdResult<()> {
    if name.len() < MIN_NAME_LENGTH {
        Err(StdError::generic_err("Name too short"))
    } else if name.len() > MAX_NAME_LENGTH {
        Err(StdError::generic_err("Name too long"))
    } else {
        match name.find(invalid_char) {
            None => Ok(()),
            Some(bytepos_invalid_char_start) => {
                let c = name[bytepos_invalid_char_start..].chars().next().unwrap();
                Err(StdError::generic_err(format!("Invalid character: '{}'", c)))
            }
        }
    }
}
fn validate_name ( name : String ) -> StdResult < ( ) > { if name . len ( ) < MIN_NAME_LENGTH { Err ( StdError :: generic_err ( " " ) ) } else if name . len ( ) > MAX_NAME_LENGTH { Err ( StdError :: generic_err ( " " ) ) } else { match name . find ( invalid_char ) { None => Ok ( ( ) ) , Some ( bytepos_invalid_char_start ) => { let c = name [ bytepos_invalid_char_start .. ] . chars ( ) . next ( ) . unwrap ( ) ; Err ( StdError :: generic_err ( format ! ( " " c ) ) ) } } } }
validate_name returns an error if the name is invalid
(we require 3-64 lowercase ascii letters, numbers, or .
validate_name returns an error if the name is invalid ( we require 3 - 64 lowercase ascii letters numbers or .
name
String