pathetic

Struct Uri

Source
pub struct Uri(/* private fields */);
Expand description

The relative URI container

Implementations§

Source§

impl Uri

Source

pub fn new(input: &str) -> Result<Self, ParseError>

Create a new Uri, from a path-query-fragment str.

Source

pub fn join(&self, input: &str) -> Result<Self, ParseError>

Parse a string as an URL, with this URL as the base URL.

Source

pub fn as_str(&self) -> &str

Return the serialization of this URL.

Source

pub fn path(&self) -> &str

Return the path for this URL, as a percent-encoded ASCII string.

Source

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

Return this URL’s query string, if any, as a percent-encoded ASCII string.

Source

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

Return this URL’s fragment identifier, if any.

Source

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

Return an iterator of ‘/’ slash-separated path segments, each as a percent-encoded ASCII string.

Source

pub fn path_segments_mut(&mut self) -> PathSegmentsMut<'_>

Return an object with methods to manipulate this URL’s path segments.

Source

pub fn query_pairs(&self) -> Parse<'_>

Parse the URL’s query string, if any, as application/x-www-form-urlencoded and return an iterator of (key, value) pairs.

Source

pub fn query_pairs_mut(&mut self) -> Serializer<'_, UrlQuery<'_>>

Manipulate this URL’s query string, viewed as a sequence of name/value pairs in application/x-www-form-urlencoded syntax.

Source

pub fn set_path(&mut self, path: &str)

Change this URL’s path.

Source

pub fn set_query(&mut self, query: Option<&str>)

Change this URL’s query string.

Source

pub fn set_fragment(&mut self, fragment: Option<&str>)

Change this URL’s fragment identifier.

Source

pub fn with_path(self, path: &str) -> Self

Modify the path inline.

Source

pub fn with_query(self, query: Option<&str>) -> Self

Modify the fragment inline.

Source

pub fn with_fragment(self, fragment: Option<&str>) -> Self

Modify the fragment inline.

Source

pub fn with_path_segments_mut<F>(self, cls: F) -> Self
where F: for<'a, 'b> Fn(&'b mut PathSegmentsMut<'a>) -> &'b mut PathSegmentsMut<'a>,

Modify the path segments inline.

Source

pub fn with_query_pairs_mut<F>(self, cls: F) -> Self
where F: for<'a, 'b> Fn(&'b mut Serializer<'a, UrlQuery<'a>>) -> &'b mut Serializer<'a, UrlQuery<'a>>,

Modify the query pairs inline.

Trait Implementations§

Source§

impl AsRef<str> for Uri

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Uri

Source§

fn clone(&self) -> Uri

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 Uri

Source§

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

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

impl Default for Uri

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Uri

Source§

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

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

impl Ord for Uri

Source§

fn cmp(&self, other: &Uri) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Uri

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Uri

Source§

fn partial_cmp(&self, other: &Uri) -> Option<Ordering>

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

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TryFrom<&str> for Uri

Source§

type Error = ParseError

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

fn try_from(t: &str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for Uri

Source§

impl StructuralPartialEq for Uri

Auto Trait Implementations§

§

impl Freeze for Uri

§

impl RefUnwindSafe for Uri

§

impl Send for Uri

§

impl Sync for Uri

§

impl Unpin for Uri

§

impl UnwindSafe for Uri

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T