/// Function used to create a Player.
///
/// This function uses PLAYER_NAME_REGEX to assure, that the name has the
/// correct format.
Function used to create a Player.
This function uses PLAYER_NAME_REGEX to assure, that the name has the
correct format.
Function used to create a Player . This function uses PLAYER_NAME_REGEX to assure that the name has the correct format .
pub fn new(name: &String) -> Result<PlayerName, CustomError> {
        if PLAYER_NAME_REGEX.is_match(&name) {
            return Ok(PlayerName {
                name: name.to_string(),
            });
        } else {
            Err(CustomError::player_name_has_wrong_format(name))
        }
    }
pub fn new ( name : & String ) -> Result < PlayerName , CustomError > { if PLAYER_NAME_REGEX . is_match ( & name ) { return Ok ( PlayerName { name : name . to_string ( ) , } ) ; } else { Err ( CustomError :: player_name_has_wrong_format ( name ) ) } }
Function used to create a Player.
Function used to create a Player .
name
&String