Skip to main content

UriExt

Trait UriExt 

Source
pub trait UriExt {
    // Required methods
    fn host_str(&self) -> Option<&str>;
    fn port_or_default(&self) -> Option<u16>;
    fn is_https(&self) -> bool;
    fn is_http(&self) -> bool;
    fn origin(&self) -> Option<String>;
}
Expand description

Extension trait providing convenience methods for http::Uri.

Required Methods§

Source

fn host_str(&self) -> Option<&str>

Extract the host from the URI.

Source

fn port_or_default(&self) -> Option<u16>

Return the port, or the default port for the scheme (80 for HTTP, 443 for HTTPS).

Source

fn is_https(&self) -> bool

Returns true if the URI scheme is https.

Source

fn is_http(&self) -> bool

Returns true if the URI scheme is http.

Source

fn origin(&self) -> Option<String>

Return the origin portion of the URI (scheme + authority).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§