pub struct Namespace<T>(/* private fields */)
where
T: Borrow<str>;Expand description
A custom namespace.
The get method can be used to create a new IRI by concatenating a suffix to this namespace’s IRI.
Implementations§
Source§impl<T> Namespace<T>
impl<T> Namespace<T>
Sourcepub fn new(iri: T) -> Result<Namespace<T>, InvalidIri>
pub fn new(iri: T) -> Result<Namespace<T>, InvalidIri>
Build a custom namespace based on the given IRI.
iri must be a valid IRI, otherwise this constructor returns an error.
Sourcepub fn new_unchecked(iri: T) -> Namespace<T>
pub fn new_unchecked(iri: T) -> Namespace<T>
Build a custom namespace based on the given IRI, without checking that it is valid. If it is not, it may result in undefined behaviour.
Sourcepub fn get<'s>(&'s self, suffix: &'s str) -> Result<NsTerm<'s>, InvalidIri>
pub fn get<'s>(&'s self, suffix: &'s str) -> Result<NsTerm<'s>, InvalidIri>
Build an IRI by appending suffix to this namespace.
Return an error if the concatenation produces an invalid IRI.
Sourcepub fn get_unchecked<'s>(&'s self, suffix: &'s str) -> NsTerm<'s>
pub fn get_unchecked<'s>(&'s self, suffix: &'s str) -> NsTerm<'s>
Build an IRI by appending suffix to this namespace,
without checking that the resulting IRI is valid.
If it is not, it may result in undefined behaviour.
Methods from Deref<Target = IriRef<T>>§
Sourcepub fn resolve<U>(&self, rel: U) -> IriRef<String>where
U: IsIriRef,
pub fn resolve<U>(&self, rel: U) -> IriRef<String>where
U: IsIriRef,
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.
Sourcepub fn as_base(&self) -> BaseIriRef<&str>
pub fn as_base(&self) -> BaseIriRef<&str>
Borrow this IRI as a BaseIriRef
providing more efficient and flexible resolution methods than IriRef::resolve.
Trait Implementations§
Source§impl<T> Ord for Namespace<T>
impl<T> Ord for Namespace<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T> PartialEq for Namespace<T>
impl<T> PartialEq for Namespace<T>
Source§impl<T> PartialOrd for Namespace<T>
impl<T> PartialOrd for Namespace<T>
impl<T> Copy for Namespace<T>
impl<T> Eq for Namespace<T>
impl<T> StructuralPartialEq for Namespace<T>
Auto Trait Implementations§
impl<T> Freeze for Namespace<T>where
T: Freeze,
impl<T> RefUnwindSafe for Namespace<T>where
T: RefUnwindSafe,
impl<T> Send for Namespace<T>where
T: Send,
impl<T> Sync for Namespace<T>where
T: Sync,
impl<T> Unpin for Namespace<T>where
T: Unpin,
impl<T> UnsafeUnpin for Namespace<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Namespace<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more