gossamer/url

Types

The URL interface represents an object providing static methods used for creating, parsing, and manipulating URLs.

pub type URL

Values

pub fn can_parse(url: String) -> Bool

Returns a boolean value indicating if a URL string is valid and can be parsed.

pub fn can_parse_with_base(url: String, base: String) -> Bool

Returns a boolean value indicating if a URL string with a base is valid and can be parsed.

pub fn hash(url: URL) -> String
pub fn host(url: URL) -> String
pub fn hostname(url: URL) -> String
pub fn href(url: URL) -> String
pub fn new(url: String) -> URL

Creates a new URL object by parsing the specified URL string. Throws a TypeError if the URL is invalid.

pub fn new_with_base(url: String, base: String) -> URL

Creates a new URL object by parsing the specified URL string with a base URL. Throws a TypeError if the URL is invalid.

pub fn origin(url: URL) -> String

The origin of the URL.

pub fn parse(url: String) -> option.Option(URL)

Parses a URL string and returns a URL object, or None if invalid.

pub fn parse_with_base(
  url: String,
  base: String,
) -> option.Option(URL)

Parses a URL string relative to a base URL and returns a URL object, or None if invalid.

pub fn password(url: URL) -> String
pub fn pathname(url: URL) -> String
pub fn port(url: URL) -> String
pub fn protocol(url: URL) -> String
pub fn search(url: URL) -> String
pub fn set_hash(url: URL, hash: String) -> URL
pub fn set_host(url: URL, host: String) -> URL
pub fn set_hostname(url: URL, hostname: String) -> URL
pub fn set_href(url: URL, href: String) -> URL
pub fn set_password(url: URL, password: String) -> URL
pub fn set_pathname(url: URL, pathname: String) -> URL
pub fn set_port(url: URL, port: String) -> URL
pub fn set_protocol(url: URL, protocol: String) -> URL
pub fn set_search(url: URL, search: String) -> URL
pub fn set_username(url: URL, username: String) -> URL
pub fn to_json(url: URL) -> String
pub fn to_string(url: URL) -> String
pub fn username(url: URL) -> String
Search Document