Enum rdf_types::Id

source ·
pub enum Id<I = IriBuf, B = BlankIdBuf> {
    Blank(B),
    Iri(I),
}
Expand description

RDF node identifier.

Either a blank node identifier or an IRI.

Hash implementation

It is guaranteed that the Hash implementation of Id is transparent, meaning that the hash of Term::Blank(id) the same as id and the hash of Subject::Iri(iri) is the same as iri.

Variants§

§

Blank(B)

Blank node identifier.

§

Iri(I)

IRI.

Implementations§

source§

impl<I, B> Id<I, B>

source

pub fn is_blank(&self) -> bool

source

pub fn is_iri(&self) -> bool

source

pub fn as_blank(&self) -> Option<&B>

source

pub fn as_iri(&self) -> Option<&I>

source

pub fn try_into_blank(self) -> Result<B, I>

source

pub fn into_blank(self) -> Option<B>

source

pub fn try_into_iri(self) -> Result<I, B>

source

pub fn into_iri(self) -> Option<I>

source

pub fn as_term<L>(&self) -> Term<&Self, &L>

Converts this id reference into the term Term::Id(&id).

source

pub fn into_term<L>(self) -> Term<Self, L>

Converts the id into the term Term::Id(id).

source

pub fn as_str(&self) -> &strwhere I: AsRef<str>, B: AsRef<str>,

Returns a borrowed string representation of the id.

source

pub fn as_ref(&self) -> Id<&I, &B>

Converts an &Id<I, B> into an Id<&I, &B>.

source§

impl<'a, I, B> Id<&'a I, &'a B>

source

pub fn cloned(self) -> Id<I, B>where I: Clone, B: Clone,

Maps an Id<&I, &B> into an Id<I, B> by cloning the contents of the id.

source

pub fn copied(self) -> Id<I, B>where I: Copy, B: Copy,

Maps an Id<&I, &B> into an Id<I, B> by copying the contents of the id.

source§

impl Id

source

pub fn as_id_ref(&self) -> IdRef<'_>

Turns this reference into an IdRef.

source

pub fn as_subject_ref(&self) -> SubjectRef<'_>

Alias for as_id_ref.

source

pub fn as_graph_label_ref(&self) -> GraphLabelRef<'_>

Alias for as_id_ref.

source

pub fn inserted_into<V: VocabularyMut>( &self, vocabulary: &mut V ) -> Id<V::Iri, V::BlankId>

source

pub fn insert_into<V: VocabularyMut>( self, vocabulary: &mut V ) -> Id<V::Iri, V::BlankId>

source§

impl<'a> Id<Iri<'a>, &'a BlankId>

source

pub fn into_owned(self) -> Id

Trait Implementations§

source§

impl<I, B> AsBlankId for Id<I, B>

source§

fn as_blank(&self) -> Option<&Self::BlankId>

Returns a reference to the blank node identifier value, if any.
source§

fn is_blank(&self) -> bool

source§

impl<I, B> AsId for Id<I, B>

§

type Iri = I

§

type BlankId = B

source§

fn as_id(&self) -> Id<&I, &B>

source§

impl<I, B> AsIri for Id<I, B>

source§

fn as_iri(&self) -> Option<&I>

Returns a reference to the iri value, if any.
source§

fn is_iri(&self) -> bool

source§

impl<I, B, L> AsRdfTerm<I, B, L> for Id<I, B>

source§

fn as_rdf_term(&self) -> Term<Id<&I, &B>, &L>

source§

impl<I: Clone, B: Clone> Clone for Id<I, B>

source§

fn clone(&self) -> Id<I, B>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I: Debug, B: Debug> Debug for Id<I, B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I: Display, B: Display> Display for Id<I, B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I, B> FromBlankId for Id<I, B>

source§

fn from_blank(b: Self::BlankId) -> Self

Builds a value from a blank node identifier.
source§

impl<I, B> FromIri for Id<I, B>

source§

fn from_iri(b: I) -> Self

Builds a value from an iri.
source§

impl<I: Hash, B: Hash> Hash for Id<I, B>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<V, I: InsertIntoVocabulary<V>, B: InsertIntoVocabulary<V>> InsertIntoVocabulary<V> for Id<I, B>

source§

impl<V, I: InsertedIntoVocabulary<V>, B: InsertedIntoVocabulary<V>> InsertedIntoVocabulary<V> for Id<I, B>

source§

impl<I, B, T: IdInterpretationMut<Self>> Interpret<T> for Id<I, B>

§

type Interpreted = <T as Interpretation>::Resource

Interpreted form.
source§

fn interpret(self, interpretation: &mut T) -> Self::Interpreted

Interpret the given resource.
source§

impl<I, B> IntoBlankId for Id<I, B>

source§

fn try_into_blank(self) -> Result<Self::BlankId, Self>

source§

fn into_blank(self) -> Option<Self::BlankId>

Converts the value into a blank node identifier, if any.
source§

impl<I, B> IntoId for Id<I, B>

source§

fn into_id(self) -> Self

source§

impl<I, B> IntoIri for Id<I, B>

source§

fn try_into_iri(self) -> Result<I, Self>

source§

fn into_iri(self) -> Option<Self::Iri>

Converts the value into an iri, if any.
source§

impl<I, B, T, U> MapLiteral<T, U> for Id<I, B>

§

type Output = Id<I, B>

source§

fn map_literal(self, _f: impl FnMut(T) -> U) -> Self::Output

Maps RDF literal values.
source§

impl<I, B> MaybeBlankId for Id<I, B>

§

type BlankId = B

Inner blank node identifier type.
source§

impl<I, B> MaybeIri for Id<I, B>

§

type Iri = I

Inner iri type.
source§

impl<I: Ord, B: Ord> Ord for Id<I, B>

source§

fn cmp(&self, other: &Id<I, B>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<I1: PartialEq<I2>, B1: PartialEq<B2>, I2, B2> PartialEq<Id<I2, B2>> for Id<I1, B1>

source§

fn eq(&self, other: &Id<I2, B2>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<I1: PartialOrd<I2>, B1: PartialOrd<B2>, I2, B2> PartialOrd<Id<I2, B2>> for Id<I1, B1>

source§

fn partial_cmp(&self, other: &Id<I2, B2>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<I: Display, B: Display> RdfDisplay for Id<I, B>

source§

fn rdf_fmt(&self, f: &mut Formatter<'_>) -> Result

source§

fn rdf_display(&self) -> RdfDisplayed<&Self>

source§

impl<I: Copy, B: Copy> Copy for Id<I, B>

source§

impl<I: Eq, B: Eq> Eq for Id<I, B>

source§

impl<I, B> StructuralEq 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<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<I, B, T> IdInterpretation<Id<I, B>> for Twhere T: IriInterpretation<I> + BlankIdInterpretation<B>,

source§

fn id_interpretation( &self, id: &Id<I, B> ) -> Option<<T as Interpretation>::Resource>

Returns the interpretation of the given node identifier, if any.
source§

impl<I, B, T> IdInterpretationMut<Id<I, B>> for Twhere T: IriInterpretationMut<I> + BlankIdInterpretationMut<B>,

source§

fn interpret_id(&mut self, id: Id<I, B>) -> <T as Interpretation>::Resource

Interprets the given identifier.
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.