Skip to main content

parse_host

Function parse_host 

Source
pub fn parse_host(value: &[u8]) -> Result<Host<'_>, ParseError>
Expand description

Parses a host with no port.

§Errors

As parse_host_port, and ErrorKind::InvalidHost for a port.

§Examples

use parse_net::{host::parse_host, Host};

assert_eq!(parse_host(b"192.0.2.1")?, Host::V4([192, 0, 2, 1].into()));
assert!(parse_host(b"a.example:80").is_err());