logo
pub enum Url {
    Static(&'static str),
    StaticDomain {
        domain: &'static str,
        path: Cow<'static, str>,
    },
}
Expand description

URL for HTTP requests

This is intentionally quite restricted to use static domains and protocols for security and simplicity purposes

Variants

Static(&'static str)

Fully static full URL

This is required to start with https:// protocol

StaticDomain

Fields

domain: &'static str

Static domain of the URL

Example: ark.embark.dev

path: Cow<'static, str>

Optional dynamic URL path under the domain.

Example: /guide/getting-started/system-reqs.html

Note: This must start with /

URL with static domain and static or dynamic path

Implementations

Create a new URL from static string

This is required to start with https:// protocol, but this is currently not validated at compile-time

Example
const TARGET: Url = Url::const_from_str("https://google.com/search?q=rust")

Create a new URL from a static domain and path

Example
const TARGET: Url = Url::const_with_path("google.com", "/search?q=rust")

Create a new URL with an existing one as base and append the new path in the end

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.