gsof_protocol 0.1.23

Software to collect data generated by sources who provide GSOF messages (Trimble)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#[doc = r#"
Check if a string can be a valid number for 16bits.
Than means from 0 to 65635. So can be use to validate port numbers and other
equivalents set.
Also the algorithm can be modified for more greates  numeric types.
"#]
pub fn isnumeric(val: String) -> Result<(), String> {
    match val.parse::<u16>() {
        Ok(n) => {
            if 1 <= n &&  n <= u16::MAX {
                return Ok(());
            };
            Err("Value must be from 1 to 65635".to_string())
        }
        Err(_e) => Err("Must be numeric value".to_string()),
    }
}