parse_port

Function parse_port 

Source
pub fn parse_port(s: &str) -> Result<(Option<u16>, &str), Error>
Expand description

Parses the port from the prefix of s.

The string s should start with a : if there is a port.

Returns Ok(Some(port), rest_of_s). Returns Ok(None, rest_of_s) if s does not start with a :. Returns Err(InvalidPort) if the port is invalid.