[−][src]Function net::url::parse
pub fn parse(rawurl: &str) -> Result<URL, Error>
parse parses rawurl into a URL structure.
The rawurl may be relative (a path, without a host) or absolute (starting with a scheme). Trying to parse a hostname and path without a scheme is invalid but may not necessarily return an error, due to parsing ambiguities.
Example
use net::url; use net::url::errors::Error; fn main() { let u = url::parse("https://example.org").unwrap(); let rel = u.parse("/foo").unwrap(); assert_eq!("https://example.org/foo", rel.to_string()); match u.parse(":foo") { Err(Error::Wrapped { .. }) => {} _ => panic!("should has a wrapped error"), } }