Struct url::RelativeSchemeData [] [src]

pub struct RelativeSchemeData {
    pub username: String,
    pub password: Option<String>,
    pub host: Host,
    pub port: Option<u16>,
    pub default_port: Option<u16>,
    pub path: Vec<String>,
}

Components for URLs in a relative scheme such as HTTP.

Fields

The username of the URL, as a possibly empty, percent-encoded string.

Percent encoded strings are within the ASCII range.

See also the lossy_percent_decode_username method.

The password of the URL.

None if the : delimiter character was not part of the parsed input, otherwise a possibly empty, percent-encoded string.

Percent encoded strings are within the ASCII range.

See also the lossy_percent_decode_password method.

The host of the URL, either a domain name or an IPv4 address

The port number of the URL. None for file-like schemes, or to indicate the default port number.

The default port number for the URL’s scheme. None for file-like schemes.

The path of the URL, as vector of percent-encoded strings.

Percent encoded strings are within the ASCII range.

See also the serialize_path method and, for URLs in the file scheme, the to_file_path method.

Methods

impl RelativeSchemeData
[src]

Percent-decode the URL’s username.

This is “lossy”: invalid UTF-8 percent-encoded byte sequences will be replaced � U+FFFD, the replacement character.

Percent-decode the URL’s password, if any.

This is “lossy”: invalid UTF-8 percent-encoded byte sequences will be replaced � U+FFFD, the replacement character.

Assuming the URL is in the file scheme or similar, convert its path to an absolute std::path::Path.

Note: This does not actually check the URL’s scheme, and may give nonsensical results for other schemes. It is the user’s responsibility to check the URL’s scheme before calling this.

let path = url.to_file_path();

Returns Err if the host is neither empty nor "localhost", or if Path::new_opt() returns None. (That is, if the percent-decoded path contains a NUL byte or, for a Windows path, is not UTF-8.)

If the host is a domain, return the domain as a string.

If the host is a domain, return a mutable reference to the domain string.

Return the port number of the URL, even if it is the default. Return None for file-like URLs.

Serialize the path as a string.

The returned string starts with a "/" slash, and components are separated by slashes. A trailing slash represents an empty last component.

Serialize the userinfo as a string.

Format: ":@".

Trait Implementations

impl Debug for RelativeSchemeData
[src]

Formats the value using the given formatter.

impl Clone for RelativeSchemeData
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for RelativeSchemeData
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for RelativeSchemeData
[src]

impl Hash for RelativeSchemeData
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl PartialOrd for RelativeSchemeData
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for RelativeSchemeData
[src]

This method returns an Ordering between self and other. Read more

impl Display for RelativeSchemeData
[src]

Formats the value using the given formatter.