iri_string::normalize

Struct Normalized

source
pub struct Normalized<'a, T: ?Sized> { /* private fields */ }
Expand description

Normalized OR resolved IRI.

Resolved IRI can be represented by this type. In that case, the result might not be normalized. If you want the IRI resolution result to be normalized, use enable_normalization method.

Implementations§

source§

impl<'a, T: ?Sized> Normalized<'a, T>

source

pub fn enable_normalization(&mut self)

Enables the normalization.

This lets the normalizer apply the case normalization, percent-encoding normalization, and dot segments removal.

source

pub fn enable_normalization_preserving_authorityless_relative_path(&mut self)

Enables the normalization that preserve relative path under some condition.

Note that this normalization algorithm is not compatible with RFC 3986 algorithm for some inputs.

See RiStr::normalize_but_preserve_authorityless_relative_path() for detail.

source

pub fn and_normalize(self) -> Self

Returns Self with normalization enabled.

source

pub fn and_normalize_but_preserve_authorityless_relative_path(self) -> Self

Returns Self with special normalization enabled.

Note that this normalization algorithm is not compatible with RFC 3986 algorithm for some inputs.

See RiStr::normalize_but_preserve_authorityless_relative_path() for detail.

source

pub fn ensure_rfc3986_normalizable(&self) -> Result<(), Error>

Checks if the path is normalizable by RFC 3986 algorithm.

Returns Ok(()) when normalizable, returns Err(_) if not.

Trait Implementations§

source§

impl<T: ?Sized> Debug for Normalized<'_, T>

source§

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

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

impl<S: Spec> Display for Normalized<'_, RiAbsoluteStr<S>>

source§

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

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

impl<S: Spec> Display for Normalized<'_, RiStr<S>>

source§

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

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

impl<S: Spec> From<&Normalized<'_, RiAbsoluteStr<S>>> for RiAbsoluteString<S>

Available on crate feature alloc only.
source§

fn from(v: &Normalized<'_, RiAbsoluteStr<S>>) -> Self

Converts to this type from the input type.
source§

impl<S: Spec> From<&Normalized<'_, RiStr<S>>> for RiString<S>

Available on crate feature alloc only.
source§

fn from(v: &Normalized<'_, RiStr<S>>) -> Self

Converts to this type from the input type.
source§

impl<S: Spec> From<Normalized<'_, RiAbsoluteStr<S>>> for RiAbsoluteString<S>

Available on crate feature alloc only.
source§

fn from(v: Normalized<'_, RiAbsoluteStr<S>>) -> Self

Converts to this type from the input type.
source§

impl<S: Spec> From<Normalized<'_, RiStr<S>>> for RiString<S>

Available on crate feature alloc only.
source§

fn from(v: Normalized<'_, RiStr<S>>) -> Self

Converts to this type from the input type.
source§

impl<S: Spec> ToDedicatedString for Normalized<'_, RiAbsoluteStr<S>>

Available on crate feature alloc only.
source§

type Target = RiAbsoluteString<S>

Conversion target type.
source§

fn try_to_dedicated_string(&self) -> Result<Self::Target, TryReserveError>

Converts the value to the allocated string.
source§

fn to_dedicated_string(&self) -> Self::Target

Converts the value to the allocated string. Read more
source§

impl<S: Spec> ToDedicatedString for Normalized<'_, RiStr<S>>

Available on crate feature alloc only.
source§

type Target = RiString<S>

Conversion target type.
source§

fn try_to_dedicated_string(&self) -> Result<Self::Target, TryReserveError>

Converts the value to the allocated string.
source§

fn to_dedicated_string(&self) -> Self::Target

Converts the value to the allocated string. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for Normalized<'a, T>
where T: ?Sized,

§

impl<'a, T> RefUnwindSafe for Normalized<'a, T>
where T: ?Sized,

§

impl<'a, T> Send for Normalized<'a, T>
where T: ?Sized,

§

impl<'a, T> Sync for Normalized<'a, T>
where T: ?Sized,

§

impl<'a, T> Unpin for Normalized<'a, T>
where T: ?Sized,

§

impl<'a, T> UnwindSafe for Normalized<'a, T>
where T: ?Sized,

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§

default fn to_string(&self) -> String

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

impl<T> ToStringFallible for T
where T: Display,

source§

fn try_to_string(&self) -> Result<String, TryReserveError>

Available on crate feature alloc only.

ToString::to_string, but without panic on OOM.

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.