Parse Functions
Table of Contents
- parse::email::host()
- parse::email::user()
- parse::url::domain()
- parse::url::fragment()
- parse::url::host()
- parse::url::path()
- parse::url::port()
- parse::url::query()
parse::email::host()
The parse::email::host function parses and returns the email host from a valid email address. This function is also aliased as parse_email_host!.
Function signature: parse::email::host(string) -> value
Example:
#![allow(unused)] fn main() { parse::email::host!("oyelowo@codebreather.com"); }
parse::email::user()
The parse::email::user function parses and returns the email username from a valid email address. This function is also aliased as parse_email_user!.
Function signature: parse::email::user(string) -> value
Example:
#![allow(unused)] fn main() { parse::email::user!("oyelowo@codebreather.com"); }
parse::url::domain()
The parse::url::domain function parses and returns the domain from a valid URL. This function is also aliased as parse_url_domain!.
Function signature: parse::url::domain(string) -> value
Example:
#![allow(unused)] fn main() { parse::url::domain!("https://codebreather.com:443/topics?arg=value#fragment"); }
parse::url::fragment()
The parse::url::fragment function parses and returns the fragment from a valid URL. This function is also aliased as parse_url_fragment!.
Function signature: parse::url::fragment(string) -> value
Example:
#![allow(unused)] fn main() { parse::url::fragment!("https://codebreather.com:443/topics?arg=value#fragment"); }
parse::url::host()
The parse::url::host function parses and returns the hostname from a valid URL. This function is also aliased as parse_url_host!.
Function signature: parse::url::host(string) -> value
Example:
#![allow(unused)] fn main() { parse::url::host!("https://codebreather.com:443/topics?arg=value#fragment"); }
parse::url::path()
The parse::url::path function parses and returns the path from a valid URL. This function is also aliased as parse_url_path!.
Function signature: parse::url::path(string) -> value
Example:
#![allow(unused)] fn main() { parse::url::path!("https://codebreather.com:443/topics?arg=value#fragment"); }
parse::url::port()
The parse::url::port function parses and returns the port from a valid URL. This function is also aliased as parse_url_port!.
Function signature: `parse::url
::port(string) -> value`
Example:
#![allow(unused)] fn main() { parse::url::port!("https://codebreather.com:443/topics?arg=value#fragment"); }
parse::url::query()
The parse::url::query function parses and returns the query from a valid URL. This function is also aliased as parse_url_query!.
Function signature: parse::url::query(string) -> value
Example:
#![allow(unused)] fn main() { parse::url::query!("https://codebreather.com:443/topics?arg=value#fragment"); }
That concludes the documentation for the parse macros.