pub struct Url { /* private fields */ }
Expand description

Contains a request url.

This is a wrapper around Uri with the caveat that a scheme and an authority is set, which makes it a Url.

Implementations§

source§

impl Url

source

pub fn from_inner(inner: Uri) -> Option<Self>

Creates a new Uri from an http::Uri

Returns None if the http::Uri does not contain a scheme or authority.

source

pub fn scheme(&self) -> &str

Returns the used scheme.

source

pub fn is_https(&self) -> bool

Returns true if the used scheme is https.

source

pub fn is_http(&self) -> bool

Returns true if the used scheme is http.

source

pub fn host(&self) -> &str

Returns the host.

source

pub fn port(&self) -> Option<u16>

Returns the used port if any.

source

pub fn path(&self) -> &str

Returns the path.

source

pub fn path_segments(&self) -> Split<'_, char>

Returns the path as segments divided by a slash, first starting and ending slash removed.

source

pub fn query(&self) -> Option<&str>

Returns the query string.

source

pub fn parse_query_pairs(&self) -> QueryIter<'_>

Returns an iterator with the Item (Cow<'_, str>, Cow<'_, str>)

Key and values are percent decoded.

Trait Implementations§

source§

impl Clone for Url

source§

fn clone(&self) -> Url

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Url

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Url

source§

fn eq(&self, other: &Url) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Url

source§

impl StructuralPartialEq for Url

Auto Trait Implementations§

§

impl !Freeze for Url

§

impl RefUnwindSafe for Url

§

impl Send for Url

§

impl Sync for Url

§

impl Unpin for Url

§

impl UnwindSafe for Url

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.