gameServer2/src/utils.rs
author marmistrz
Sun, 24 Jun 2018 12:09:31 -0400
changeset 13421 d1368c776a4f
parent 13416 cdf69667593b
child 13423 87a6cad20c90
permissions -rw-r--r--
Enable all lints from the rust-2018-idioms suite. Additionally, fix the violation of the bare-trait-objects lint.

use mio;

pub const PROTOCOL_VERSION : u32 = 3;
pub const SERVER: mio::Token = mio::Token(1000000000 + 0);

pub fn is_name_illegal(name: &str ) -> bool{
    name.len() > 40 ||
        name.trim().is_empty() ||
        name.chars().any(|c|
            "$()*+?[]^{|}\x7F".contains(c) ||
                '\x00' <= c && c <= '\x1F')
}