Enum json_ld_core::id::Id
source · 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).
Hash
implementation
It is guaranteed that the Hash
implementation of Id
is transparent,
meaning that the hash of Id::Valid(id)
the same as id
, and the hash of
Id::Invalid(id)
is the same as id
.
This may be useful to define custom hashbrown::Equivalent<Id<I, B>>
implementation.
Variants§
Implementations§
source§impl<I: From<IriBuf>, B: From<BlankIdBuf>> Id<I, B>
impl<I: From<IriBuf>, B: From<BlankIdBuf>> Id<I, B>
pub fn from_string(s: String) -> Self
source§impl<I, B> Id<I, B>
impl<I, B> Id<I, B>
pub fn iri(iri: I) -> Self
pub fn blank(b: B) -> Self
pub fn from_string_in(
vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B>,
s: String
) -> Self
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>
pub fn is_blank(&self) -> bool
pub fn as_blank(&self) -> Option<&B>
pub fn is_iri(&self) -> bool
pub fn as_iri(&self) -> Option<&I>
pub fn into_term(self) -> Term<I, B>
pub fn as_ref(&self) -> Ref<'_, I, B>
Trait Implementations§
source§impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> AsRefWithContext<str, N> for Id<T, B>
impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> AsRefWithContext<str, N> for Id<T, B>
fn as_ref_with<'a>(&'a self, vocabulary: &'a N) -> &'a str
source§impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> DisplayWithContext<N> for Id<T, B>
impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> DisplayWithContext<N> for Id<T, B>
source§impl<I> Equivalent<Id<I, BlankIdBuf>> for BlankId
impl<I> Equivalent<Id<I, BlankIdBuf>> for BlankId
source§fn equivalent(&self, key: &Id<I, BlankIdBuf>) -> bool
fn equivalent(&self, key: &Id<I, BlankIdBuf>) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<I> Equivalent<Id<I, BlankIdBuf>> for BlankIdBuf
impl<I> Equivalent<Id<I, BlankIdBuf>> for BlankIdBuf
source§fn equivalent(&self, key: &Id<I, BlankIdBuf>) -> bool
fn equivalent(&self, key: &Id<I, BlankIdBuf>) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<T, B, M, N: Vocabulary<Iri = T, BlankId = B>> IntoJsonWithContextMeta<M, N> for Id<T, B>
impl<T, B, M, N: Vocabulary<Iri = T, BlankId = B>> IntoJsonWithContextMeta<M, N> for Id<T, B>
source§impl<I: Ord, B: Ord> Ord for Id<I, B>
impl<I: Ord, B: Ord> Ord for Id<I, B>
source§impl<I: PartialEq, B: PartialEq> PartialEq<Id<I, B>> for Id<I, B>
impl<I: PartialEq, B: PartialEq> PartialEq<Id<I, B>> for Id<I, B>
source§impl<T: PartialEq, B: PartialEq> PartialEq<Id<T, B>> for Term<T, B>
impl<T: PartialEq, B: PartialEq> PartialEq<Id<T, B>> for Term<T, B>
source§impl<T: PartialEq, B: PartialEq> PartialEq<Term<T, B>> for Id<T, B>
impl<T: PartialEq, B: PartialEq> PartialEq<Term<T, B>> for Id<T, B>
source§impl<I: PartialOrd, B: PartialOrd> PartialOrd<Id<I, B>> for Id<I, B>
impl<I: PartialOrd, B: PartialOrd> PartialOrd<Id<I, B>> for Id<I, B>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> PrecomputeSizeWithContext<N> for Id<T, B>
impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> PrecomputeSizeWithContext<N> for Id<T, B>
source§impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> PrintWithContext<N> for Id<T, B>
impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> PrintWithContext<N> for Id<T, B>
source§impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> PrintWithSizeAndContext<N> for Id<T, B>
impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> PrintWithSizeAndContext<N> for Id<T, B>
source§impl<I: Hash, B: Hash> StrippedHash for Id<I, B>
impl<I: Hash, B: Hash> StrippedHash for Id<I, B>
fn stripped_hash<H: Hasher>(&self, state: &mut H)
source§impl<I: PartialEq<__I>, B: PartialEq<__B>, __I, __B> StrippedPartialEq<Id<__I, __B>> for Id<I, B>
impl<I: PartialEq<__I>, B: PartialEq<__B>, __I, __B> StrippedPartialEq<Id<__I, __B>> for Id<I, B>
fn stripped_eq(&self, other: &Id<__I, __B>) -> bool
source§impl<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: Meta<Value<M>, M>
) -> Result<Meta<Self, M>, Meta<InvalidExpandedJson<M>, M>>
impl<I: Eq, B: Eq> Eq for Id<I, B>
impl<I: Eq, B: Eq> StrippedEq for Id<I, B>
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§
source§impl<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
source§impl<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,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.