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 indexmap::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>
Sourcepub fn from_string(s: String) -> Self
pub fn from_string(s: String) -> Self
Parses an identifier from a string, keeping it as invalid if it is neither an IRI nor a blank node identifier.
Source§impl<I, B> Id<I, B>
impl<I, B> Id<I, B>
Sourcepub fn from_string_in(
vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B>,
s: String,
) -> Self
pub fn from_string_in( vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B>, s: String, ) -> Self
Parses an identifier from a string, interning it in the given vocabulary.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Checks whether this identifier is a well-formed IRI or blank node identifier, rather than a string that failed to parse as either.
Sourcepub fn into_blank(self) -> Option<B>
pub fn into_blank(self) -> Option<B>
Consumes the identifier, returning the blank node identifier if it is one.
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<V: IriVocabulary + BlankIdVocabulary> DisplayWithContext<V> for Id<V::Iri, V::BlankId>
impl<V: IriVocabulary + BlankIdVocabulary> DisplayWithContext<V> for Id<V::Iri, V::BlankId>
impl<I: Eq, B: Eq> Eq for Id<I, B>
Source§impl<I: PartialEq, B: PartialEq> Equivalent<Id<I, B>> for ValidId<I, B>
impl<I: PartialEq, B: PartialEq> Equivalent<Id<I, B>> for ValidId<I, B>
Source§fn equivalent(&self, key: &Id<I, B>) -> bool
fn equivalent(&self, key: &Id<I, B>) -> bool
key and return true if they are equal.Source§impl<I> Equivalent<Id<I>> for BlankId
impl<I> Equivalent<Id<I>> for BlankId
Source§fn equivalent(&self, key: &Id<I, BlankIdBuf>) -> bool
fn equivalent(&self, key: &Id<I, BlankIdBuf>) -> bool
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, BlankIdBuf>) -> bool
fn equivalent(&self, key: &Id<I, BlankIdBuf>) -> bool
key and return true if they are equal.Source§impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> IntoJsonWithContext<N> for Id<T, B>
impl<T, B, N: Vocabulary<Iri = T, BlankId = B>> IntoJsonWithContext<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>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<I: PartialOrd, B: PartialOrd> PartialOrd for Id<I, B>
impl<I: PartialOrd, B: PartialOrd> PartialOrd for Id<I, B>
Source§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>
impl<I: PartialEq, B: PartialEq> StructuralPartialEq for Id<I, B>
Source§impl<I, B> TryFromJson<I, B> for Id<I, B>
impl<I, B> TryFromJson<I, B> for Id<I, B>
Source§fn try_from_json_in(
vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B>,
value: Value,
) -> Result<Self, InvalidExpandedJson>
fn try_from_json_in( vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B>, value: Value, ) -> Result<Self, InvalidExpandedJson>
Auto Trait Implementations§
impl<I, B> Freeze for Id<I, B>
impl<I, B> RefUnwindSafe for Id<I, B>where
ValidId<I, B>: 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> UnsafeUnpin for Id<I, B>where
ValidId<I, B>: UnsafeUnpin,
impl<I, B> UnwindSafe for Id<I, B>where
ValidId<I, B>: 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> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self is equivalent to key.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<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,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more