Struct sophia_iri::IriRef

source ·
pub struct IriRef<T: Borrow<str>>(/* private fields */);
Expand description

Implementations§

source§

impl<T: Borrow<str>> IriRef<T>

source

pub fn new(iri: T) -> Result<Self, InvalidIri>

This wrapper guarantees that the underlying str satisfies the irelative-ref rule in RFC-3687 (i.e. an absolute or relative IRI reference).

source

pub fn as_str(&self) -> &str

Gets a reference to the underlying &str.

source

pub fn resolve<U: IsIriRef>(&self, rel: U) -> IriRef<String>

Resolve a relative IRI reference against this one.

NB: when resolving multiple IRI references against the same base, it is preferable to first turn it into a BaseIriRef, with the IriRef::as_base or IriRef::to_base methods.

source

pub fn as_base(&self) -> BaseIriRef<&str>

Borrow this IRI as a BaseIriRef providing more efficient and flexible resolution methods than IriRef::resolve.

source

pub fn to_base(self) -> BaseIriRef<T>
where T: Deref<Target = str>,

Turn this IRI into a BaseIriRef providing more efficient and flexible resolution methods than IriRef::resolve.

source

pub fn new_unchecked(inner: T) -> Self

Construct a IriRef<T> without checking that the inner value is valid. If it is not, it may result in undefined behaviour.

source

pub fn unwrap(self) -> T

Returns the wrapped value, consuming self.

source

pub fn map_unchecked<F, U>(self, f: F) -> IriRef<U>
where F: FnOnce(T) -> U, U: Borrow<str>,

Map a IriRef<T> to a IriRef<U> by applying a function to the wrapped value. It does not check that the value returned by the function is valid. If it is not, it may result in undefined behaviour.

source§

impl<T> IriRef<T>
where T: Borrow<str>,

source

pub fn as_ref(&self) -> IriRef<&str>

Convert from &IriRef<T> to IriRef<&str>.

source§

impl IriRef<&'static str>

source

pub const fn new_unchecked_const(inner: &'static str) -> Self

Construct a IriRef<&'static str> without checking that the inner value is valid. If it is not, it may result in undefined behaviour.

Trait Implementations§

source§

impl<T: Borrow<str>> AsRef<T> for IriRef<T>

source§

fn as_ref(&self) -> &T

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

impl<T: Borrow<str>> AsRef<str> for IriRef<T>

source§

fn as_ref(&self) -> &str

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

impl<T: Borrow<str>> Borrow<T> for IriRef<T>

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T: Borrow<str>> Borrow<str> for IriRef<T>

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl<T: Clone + Borrow<str>> Clone for IriRef<T>

source§

fn clone(&self) -> IriRef<T>

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<T: Debug + Borrow<str>> Debug for IriRef<T>

source§

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

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

impl<'a, T: Borrow<str> + Deserialize<'a>> Deserialize<'a> for IriRef<T>

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: Borrow<str>> Display for IriRef<T>

source§

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

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

impl<T> Hash for IriRef<T>
where T: Borrow<str> + Hash,

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> Ord for IriRef<T>
where T: Borrow<str> + Eq + Ord,

source§

fn cmp(&self, rhs: &IriRef<T>) -> 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 + PartialOrd,

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

impl<T, U> PartialEq<IriRef<T>> for IriRef<U>
where T: Borrow<str>, U: Borrow<str> + PartialEq<T>,

source§

fn eq(&self, rhs: &IriRef<T>) -> 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<T> PartialEq<IriRef<T>> for str
where T: Borrow<str>, str: PartialEq,

source§

fn eq(&self, other: &IriRef<T>) -> 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<T> PartialEq<str> for IriRef<T>
where T: Borrow<str>, str: PartialEq,

source§

fn eq(&self, other: &str) -> 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<T, U> PartialOrd<IriRef<T>> for IriRef<U>
where T: Borrow<str>, U: Borrow<str> + PartialOrd<T>,

source§

fn partial_cmp(&self, rhs: &IriRef<T>) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> PartialOrd<IriRef<T>> for str
where T: Borrow<str>, str: PartialOrd,

source§

fn partial_cmp(&self, other: &IriRef<T>) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> PartialOrd<str> for IriRef<T>
where T: Borrow<str>, str: PartialOrd,

source§

fn partial_cmp(&self, other: &str) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: Borrow<str>> Serialize for IriRef<T>

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Borrow<str>> Deref for IriRef<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl<T: Copy + Borrow<str>> Copy for IriRef<T>

source§

impl<T> Eq for IriRef<T>
where T: Borrow<str> + Eq,

source§

impl<T: Borrow<str>> IsIriRef for IriRef<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for IriRef<T>
where T: RefUnwindSafe,

§

impl<T> Send for IriRef<T>
where T: Send,

§

impl<T> Sync for IriRef<T>
where T: Sync,

§

impl<T> Unpin for IriRef<T>
where T: Unpin,

§

impl<T> UnwindSafe for IriRef<T>
where T: UnwindSafe,

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> AsIriRef for T
where T: IsIriRef,

source§

fn as_iri_ref(&self) -> IriRef<&str>

Extract an IriRef wrapping the underlying str.
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, U> Resolvable<T> for U
where T: Borrow<str>, U: IsIriRef,

§

type OutputAbs = Iri<T>

The output type when joining to an absolute base.
§

type OutputRel = IriRef<T>

The output type when joining to an relative base.
source§

fn output_abs(res: Result<T, IriParseError>) -> <U as Resolvable<T>>::OutputAbs

Method for producing the Self::OutputAbs from a raw result.
source§

fn output_rel(res: Result<T, IriParseError>) -> <U as Resolvable<T>>::OutputRel

Method for producing the Self::OutputRel from a raw result.
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> 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>,

§

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,