pub enum Id<I = IriBuf, B = BlankIdBuf> {
Valid(Id<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 indexmap::Equivalent<Id<I, B>>
implementation.
Variants§
Implementations§
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>
pub fn map<J, C>(self, f: impl FnOnce(Id<I, B>) -> Id<J, C>) -> Id<J, C>
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<V> DisplayWithContext<V> for Id<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>where
V: IriVocabulary + BlankIdVocabulary,
impl<V> DisplayWithContext<V> for Id<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>where
V: IriVocabulary + BlankIdVocabulary,
Source§impl<I> Equivalent<Id<I>> for BlankId
impl<I> Equivalent<Id<I>> for BlankId
Source§fn equivalent(&self, key: &Id<I>) -> bool
fn equivalent(&self, key: &Id<I>) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<I> Equivalent<Id<I>> for BlankIdBuf
impl<I> Equivalent<Id<I>> for BlankIdBuf
Source§fn equivalent(&self, key: &Id<I>) -> bool
fn equivalent(&self, key: &Id<I>) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<I, B> Equivalent<Id<I, B>> for Id<I, B>
impl<I, B> Equivalent<Id<I, B>> for Id<I, B>
Source§fn equivalent(&self, key: &Id<I, B>) -> bool
fn equivalent(&self, key: &Id<I, B>) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T, B, N> IntoJsonWithContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> IntoJsonWithContext<N> for Id<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
fn into_json_with(self, context: &N) -> Value
Source§impl<I, B> Ord for Id<I, B>
impl<I, B> Ord for Id<I, B>
Source§impl<I, B> PartialOrd for Id<I, B>where
I: PartialOrd,
B: PartialOrd,
impl<I, B> PartialOrd for Id<I, B>where
I: PartialOrd,
B: PartialOrd,
Source§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> TryFromJson<I, B> for Id<I, B>
impl<I, B> TryFromJson<I, B> for Id<I, B>
fn try_from_json_in( vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B>, value: Value, ) -> Result<Id<I, B>, InvalidExpandedJson>
impl<I, B> Eq for Id<I, B>
impl<I, B> StructuralPartialEq for Id<I, B>
Auto Trait Implementations§
impl<I, B> Freeze for Id<I, B>
impl<I, B> RefUnwindSafe for Id<I, B>where
B: RefUnwindSafe,
I: RefUnwindSafe,
impl<I, B> Send for Id<I, B>
impl<I, B> Sync for Id<I, B>
impl<I, B> Unpin for Id<I, B>
impl<I, B> UnwindSafe for Id<I, B>where
B: UnwindSafe,
I: 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
Mutably borrows from an owned value. Read more
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<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
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
Compare self to
key
and return true
if they are equal.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<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, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.