port

Function port 

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

Validates IRI port.

Note that the syntax of the port is common between RFC 3986 (URIs) and RFC 3987 (IRIs).

Also note that this function does not accept a leading colon.

ยงExamples

use iri_string::validate::port;
assert!(port("0").is_ok());
assert!(port("8080").is_ok());
assert!(port("0000080").is_ok());
// URI/IRI syntax itself does not have limit on the port number.
assert!(port("999999999").is_ok());

// The leading colon is not a part of the `port`.
assert!(port(":443").is_err());