pub enum Id<I = IriBuf, B = BlankIdBuf> {
Valid(ValidId<I, B>),
Invalid(String),
}
Expand description
Node identifier.
Used to reference a node across a document or to a remote document. It can be an identifier (IRI), a blank node identifier for local blank nodes or an invalid reference (a string that is neither an IRI nor blank node identifier).
Variants
Valid(ValidId<I, B>)
Invalid(String)
Invalid reference.
Implementations
sourceimpl<I, B> Id<I, B>where
I: From<IriBuf>,
B: From<BlankIdBuf>,
impl<I, B> Id<I, B>where
I: From<IriBuf>,
B: From<BlankIdBuf>,
pub fn from_string(s: String) -> Id<I, B>
sourceimpl<I, B> Id<I, B>
impl<I, B> Id<I, B>
pub fn iri(iri: I) -> Id<I, B>
pub fn blank(b: B) -> Id<I, B>
pub fn from_string_in(
vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B>,
s: String
) -> Id<I, B>
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Checks if this is a valid reference.
Returns true
is this reference is a node identifier or a blank node identifier,
false
otherwise.
pub fn into_blank(self) -> Option<B>
sourcepub fn as_iri(&self) -> Option<&I>
pub fn as_iri(&self) -> Option<&I>
If the reference is a node identifier, returns the node IRI.
Returns None
if it is a blank node reference.
pub fn into_term(self) -> Term<I, B>
pub fn as_ref(&self) -> Ref<'_, I, B>
Trait Implementations
sourceimpl<T, B, N> AsRefWithContext<str, N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> AsRefWithContext<str, N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
fn as_ref_with(&'a self, vocabulary: &'a N) -> &'a str
sourceimpl<T, B, N> DisplayWithContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> DisplayWithContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
sourceimpl<T, B, M, N> IntoJsonWithContextMeta<M, N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, M, N> IntoJsonWithContextMeta<M, N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
fn into_json_meta_with(self, meta: M, context: &N) -> Meta<Value<M>, M>
sourceimpl<T, B> MappedEq<Id<T, B>> for Id<T, B>where
T: PartialEq<T>,
B: PartialEq<B>,
impl<T, B> MappedEq<Id<T, B>> for Id<T, B>where
T: PartialEq<T>,
B: PartialEq<B>,
type BlankId = B
sourceimpl<I, B> Ord for Id<I, B>where
I: Ord,
B: Ord,
impl<I, B> Ord for Id<I, B>where
I: Ord,
B: Ord,
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<I, B> PartialEq<I> for Id<I, B>where
I: PartialEq<I>,
impl<I, B> PartialEq<I> for Id<I, B>where
I: PartialEq<I>,
sourceimpl<I, B> PartialEq<Id<I, B>> for Id<I, B>where
I: PartialEq<I>,
B: PartialEq<B>,
impl<I, B> PartialEq<Id<I, B>> for Id<I, B>where
I: PartialEq<I>,
B: PartialEq<B>,
sourceimpl<T, B> PartialEq<Id<T, B>> for Term<T, B>where
T: PartialEq<T>,
B: PartialEq<B>,
impl<T, B> PartialEq<Id<T, B>> for Term<T, B>where
T: PartialEq<T>,
B: PartialEq<B>,
sourceimpl<T, B> PartialEq<Term<T, B>> for Id<T, B>where
T: PartialEq<T>,
B: PartialEq<B>,
impl<T, B> PartialEq<Term<T, B>> for Id<T, B>where
T: PartialEq<T>,
B: PartialEq<B>,
sourceimpl<T, B> PartialEq<str> for Id<T, B>where
T: PartialEq<str>,
B: PartialEq<str>,
impl<T, B> PartialEq<str> for Id<T, B>where
T: PartialEq<str>,
B: PartialEq<str>,
sourceimpl<I, B> PartialOrd<Id<I, B>> for Id<I, B>where
I: PartialOrd<I>,
B: PartialOrd<B>,
impl<I, B> PartialOrd<Id<I, B>> for Id<I, B>where
I: PartialOrd<I>,
B: PartialOrd<B>,
sourcefn partial_cmp(&self, other: &Id<I, B>) -> Option<Ordering>
fn partial_cmp(&self, other: &Id<I, B>) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const 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 moresourceimpl<T, B, N> PrecomputeSizeWithContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> PrecomputeSizeWithContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
sourceimpl<T, B, N> PrintWithContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> PrintWithContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
sourceimpl<T, B, N> PrintWithSizeAndContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> PrintWithSizeAndContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
sourceimpl<I, B> StrippedHash for Id<I, B>where
I: Hash,
B: Hash,
impl<I, B> StrippedHash for Id<I, B>where
I: Hash,
B: Hash,
fn stripped_hash<H>(&self, state: &mut H)where
H: Hasher,
sourceimpl<I, B> StrippedPartialEq<Id<I, B>> for Id<I, B>where
I: PartialEq<I>,
B: PartialEq<B>,
impl<I, B> StrippedPartialEq<Id<I, B>> for Id<I, B>where
I: PartialEq<I>,
B: PartialEq<B>,
fn stripped_eq(&self, other: &Id<I, B>) -> bool
sourceimpl<I, B, M> TryFromJson<I, B, M> for Id<I, B>
impl<I, B, M> TryFromJson<I, B, M> for Id<I, B>
fn try_from_json_in(
vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B>,
Meta<Value<M>, M>
) -> Result<Meta<Id<I, B>, M>, Meta<InvalidExpandedJson<M>, M>>
impl<I, B> Eq for Id<I, B>where
I: Eq,
B: Eq,
impl<I, B> StrippedEq for Id<I, B>where
I: Eq,
B: Eq,
impl<I, B> StructuralEq for Id<I, B>
impl<I, B> StructuralPartialEq for Id<I, B>
Auto Trait Implementations
impl<I, B> RefUnwindSafe for Id<I, B>where
B: RefUnwindSafe,
I: RefUnwindSafe,
impl<I, B> Send for Id<I, B>where
B: Send,
I: Send,
impl<I, B> Sync for Id<I, B>where
B: Sync,
I: Sync,
impl<I, B> Unpin for Id<I, B>where
B: Unpin,
I: Unpin,
impl<I, B> UnwindSafe for Id<I, B>where
B: UnwindSafe,
I: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> BorrowStripped for T
impl<T> BorrowStripped for T
sourceimpl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
fn equivalent(&self, key: &K) -> bool
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.