pub enum Id<I = IriBuf, B = BlankIdBuf> {
Valid(Subject<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, 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>
source§impl<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>
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> 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>(&'a self, vocabulary: &'a N) -> &'a str
source§impl<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>,
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<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>,
source§impl<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
source§fn mapped_eq<'a, 'b, F>(&'a self, other: &Id<T, B>, f: F) -> boolwhere
F: Clone + Fn(&'a <Id<T, B> as MappedEq<Id<T, B>>>::BlankId) -> &'b <Id<T, B> as MappedEq<Id<T, B>>>::BlankId,
<Id<T, B> as MappedEq<Id<T, B>>>::BlankId: 'a + 'b,
fn mapped_eq<'a, 'b, F>(&'a self, other: &Id<T, B>, f: F) -> boolwhere
F: Clone + Fn(&'a <Id<T, B> as MappedEq<Id<T, B>>>::BlankId) -> &'b <Id<T, B> as MappedEq<Id<T, B>>>::BlankId,
<Id<T, B> as MappedEq<Id<T, B>>>::BlankId: 'a + 'b,
Structural equality with mapped blank identifiers. Read more
source§impl<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,
source§impl<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>,
source§impl<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>,
source§impl<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>,
source§impl<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>,
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> 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>,
source§impl<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>,
source§impl<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>,
source§impl<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,
source§impl<I, B, __I, __B> StrippedPartialEq<Id<__I, __B>> for Id<I, B>where
I: PartialEq<__I>,
B: PartialEq<__B>,
impl<I, B, __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
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<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§
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
§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
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
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.