some comments

master
rasul 5 years ago
parent 7a17fe4a08
commit aba6e663df

@ -1,11 +1,17 @@
use crate::game::Game;
/// Return value for check functions
#[derive(Debug)]
pub enum PlayerCheck {
/// The value checks out
Ok(String),
/// There is one or more issues
Err(Vec<String>),
}
impl Game {
/// Check the player name to ensure it meets guidelines
pub fn check_player_name<S: Into<String>>(&self, name: S) -> PlayerCheck {
let name = name.into();
let name = name.trim();
@ -31,6 +37,7 @@ impl Game {
}
}
/// Check the password to ensure it meets password requirements
pub fn check_player_password<S: Into<String>>(&self, password: S) -> PlayerCheck {
let password = password.into();
let mut err_vec = Vec::<String>::new();

Loading…
Cancel
Save