UnrestrictiveUrl

Struct UnrestrictiveUrl 

Source
pub struct UnrestrictiveUrl<'a> {
    pub fragment: Option<&'a str>,
    pub host: Option<Host<&'a str>>,
    pub password: Option<&'a str>,
    pub path: Option<&'a str>,
    pub port: Option<u16>,
    pub query: Option<&'a str>,
    pub scheme: Option<&'a str>,
    pub username: Option<&'a str>,
    /* private fields */
}
Expand description

A small wrapper around url::Url that allows free URL modifications.

Since the url crate strictly follows the WHATWG specification, some operations are deemed illegal and can’t be performed with the crate. This crate allows such operations.

§Example

use unrestrictive_url::{Url, UnrestrictiveUrl};

let url = Url::parse("https://github.com").unwrap();
let mut url = UnrestrictiveUrl::from(&url);
url.scheme = Some("jojo");

assert_eq!("jojo://github.com/", url.to_string());

Fields§

§fragment: Option<&'a str>§host: Option<Host<&'a str>>§password: Option<&'a str>§path: Option<&'a str>§port: Option<u16>§query: Option<&'a str>§scheme: Option<&'a str>§username: Option<&'a str>

Implementations§

Source§

impl<'a> UnrestrictiveUrl<'a>

Source

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

Trait Implementations§

Source§

impl Display for UnrestrictiveUrl<'_>

Source§

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

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

impl<'a> From<&'a Url> for UnrestrictiveUrl<'a>

Source§

fn from(url: &'a Url) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for UnrestrictiveUrl<'a>

§

impl<'a> RefUnwindSafe for UnrestrictiveUrl<'a>

§

impl<'a> Send for UnrestrictiveUrl<'a>

§

impl<'a> Sync for UnrestrictiveUrl<'a>

§

impl<'a> Unpin for UnrestrictiveUrl<'a>

§

impl<'a> UnwindSafe for UnrestrictiveUrl<'a>

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

Source§

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,