parse_port

Function parse_port 

Source
pub fn parse_port(v: &str) -> Result<String>
Expand description

Parse v if valid port.

A valid port is either

  • an empty string
  • a 4 chars long string with each char in [0-9]

ยงExamples

assert!(parse_port("8081").is_ok());

assert!(parse_port("").is_ok()); // No port specified, which is accepted

assert!(parse_port("abcd").is_err());