Enum Term

Source
pub enum Term<I = Id, L = Literal> {
    Id(I),
    Literal(L),
}
Expand description

gRDF term.

Either a node identifier or a literal value.

§Hash implementation

It is guaranteed that the Hash implementation of Term is transparent, meaning that the hash of Term::Id(id) the same as id and the hash of Term::Literal(l) is the same as l.

Variants§

§

Id(I)

Node identifier.

§

Literal(L)

Literal value.

Implementations§

Source§

impl<I, L> Term<I, L>

Source

pub fn blank(id: I::BlankId) -> Self
where I: FromBlankId,

Source

pub fn iri(iri: I::Iri) -> Self
where I: FromIri,

Source

pub fn is_id(&self) -> bool

Source

pub fn is_literal(&self) -> bool

Source

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

Source

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

Source

pub fn try_into_id(self) -> Result<I, L>

Source

pub fn as_literal(&self) -> Option<&L>

Source

pub fn into_literal(self) -> Option<L>

Source

pub fn try_into_literal(self) -> Result<L, I>

Source

pub fn is_blank(&self) -> bool
where I: TryAsBlankId,

Source

pub fn is_iri(&self) -> bool
where I: TryAsIri,

Source

pub fn as_blank(&self) -> Option<&I::BlankId>
where I: TryAsBlankId,

Source

pub fn try_into_blank(self) -> Result<I::BlankId, Self>
where I: TryIntoBlankId,

Source

pub fn into_blank(self) -> Option<I::BlankId>
where I: TryIntoBlankId,

Source

pub fn as_iri(&self) -> Option<&I::Iri>
where I: TryAsIri,

Source

pub fn try_into_iri(self) -> Result<I::Iri, Self>
where I: TryIntoIri,

Source

pub fn into_iri(self) -> Option<I::Iri>
where I: TryIntoIri,

Source

pub fn as_ref(&self) -> Term<&I, &L>

Converts from &Term<I, L> to Term<&I, &L>.

Source§

impl<'a, I, L> Term<&'a I, &'a L>

Source

pub fn cloned(self) -> Term<I, L>
where I: Clone, L: Clone,

Source

pub fn copied(self) -> Term<I, L>
where I: Copy, L: Copy,

Source§

impl Term

Source§

impl Term<Id<&Iri, &BlankId>, &Literal>

Source

pub fn into_owned(self) -> Term

Trait Implementations§

Source§

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

Source§

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

Returns this value as an RDF term.
Source§

impl<I: Clone, L: Clone> Clone for Term<I, L>

Source§

fn clone(&self) -> Term<I, L>

Returns a duplicate 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, L: Debug> Debug for Term<I, L>

Source§

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

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

impl<I: Display, L: Display> Display for Term<I, L>

Source§

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

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

impl<V, I: EmbedIntoVocabulary<V>, L: EmbedIntoVocabulary<V>> EmbedIntoVocabulary<V> for Term<I, L>

Source§

type Embedded = Term<<I as EmbedIntoVocabulary<V>>::Embedded, <L as EmbedIntoVocabulary<V>>::Embedded>

Type of the value once embedded into the vocabulary.
Source§

fn embed_into_vocabulary(self, vocabulary: &mut V) -> Self::Embedded

Source§

impl<V, I: EmbeddedIntoVocabulary<V>, L: EmbeddedIntoVocabulary<V>> EmbeddedIntoVocabulary<V> for Term<I, L>

Source§

impl<V: LiteralVocabulary, I: ExtractFromVocabulary<V>> ExtractFromVocabulary<V> for Term<I, V::Literal>

Source§

impl<V: LiteralVocabulary, I: ExtractedFromVocabulary<V>> ExtractedFromVocabulary<V> for Term<I, V::Literal>

Source§

type Extracted = Term<<I as ExtractedFromVocabulary<V>>::Extracted>

Source§

fn extracted_from_vocabulary(&self, vocabulary: &V) -> Self::Extracted

Exports a value embedded into the vocabulary V. Read more
Source§

impl<V: Vocabulary> From<Term<Id<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>, <V as LiteralVocabulary>::Literal>> for Resource<V>

Source§

fn from( value: Term<Id<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>, <V as LiteralVocabulary>::Literal>, ) -> Self

Converts to this type from the input type.
Source§

impl<I: FromBlankId, L> FromBlankId for Term<I, L>

Source§

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

Builds a value from a blank node identifier.
Source§

impl<I: FromIri, L> FromIri for Term<I, L>

Source§

fn from_iri(b: Self::Iri) -> Self

Builds a value from an iri.
Source§

impl<I: Hash, L: Hash> Hash for Term<I, L>

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<I: LiteralInterpretationMut<L>, T: Interpret<I, Interpreted = I::Resource>, L> Interpret<I> for Term<T, L>

Source§

type Interpreted = <I as Interpretation>::Resource

Interpreted form.
Source§

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

Interpret the given resource.
Source§

impl<I, L> IntoTerm for Term<I, L>

Source§

type Id = I

Node identifier type.
Source§

type Literal = L

Literal type.
Source§

fn into_term(self) -> Term<I, L>

Turns the value into a Term.
Source§

impl<I: MaybeBlankId, L> MaybeBlankId for Term<I, L>

Source§

type BlankId = <I as MaybeBlankId>::BlankId

Inner blank node identifier type.
Source§

impl<I: MaybeIri, L> MaybeIri for Term<I, L>

Source§

type Iri = <I as MaybeIri>::Iri

Inner iri type.
Source§

impl<I: Ord, L: Ord> Ord for Term<I, L>

Source§

fn cmp(&self, other: &Term<I, L>) -> Ordering

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl<I1: PartialEq<I2>, L1: PartialEq<L2>, I2, L2> PartialEq<Term<I2, L2>> for Term<I1, L1>

Source§

fn eq(&self, other: &Term<I2, L2>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I1: PartialOrd<I2>, L1: PartialOrd<L2>, I2, L2> PartialOrd<Term<I2, L2>> for Term<I1, L1>

Source§

fn partial_cmp(&self, other: &Term<I2, L2>) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<I: RdfDisplay, L: RdfDisplay> RdfDisplay for Term<I, L>

Source§

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

Formats the value using the given formatter.
Source§

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

Prepare the value to be formatted as an RDF syntax element.
Source§

impl<I: TryAsBlankId, L> TryAsBlankId for Term<I, L>

Source§

fn try_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: TryAsIri, L> TryAsIri for Term<I, L>

Source§

fn try_as_iri(&self) -> Option<&Self::Iri>

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

fn is_iri(&self) -> bool

Source§

impl<V, I: TryExtractFromVocabulary<V>, L: TryExtractFromVocabulary<V>> TryExtractFromVocabulary<V> for Term<I, L>

Source§

impl<I: TryIntoBlankId, L> TryIntoBlankId for Term<I, L>

Source§

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

Source§

impl<I: TryIntoIri, L> TryIntoIri for Term<I, L>

Source§

fn try_into_iri(self) -> Result<Self::Iri, Self>

Source§

impl<I: Copy, L: Copy> Copy for Term<I, L>

Source§

impl<I: Eq, L: Eq> Eq for Term<I, L>

Auto Trait Implementations§

§

impl<I, L> Freeze for Term<I, L>
where I: Freeze, L: Freeze,

§

impl<I, L> RefUnwindSafe for Term<I, L>

§

impl<I, L> Send for Term<I, L>
where I: Send, L: Send,

§

impl<I, L> Sync for Term<I, L>
where I: Sync, L: Sync,

§

impl<I, L> Unpin for Term<I, L>
where I: Unpin, L: Unpin,

§

impl<I, L> UnwindSafe for Term<I, L>
where I: UnwindSafe, L: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

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 Q
where 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<T, U> Into<U> for T
where 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 T
where T: Clone,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

impl<T> TryAsId for T

Source§

fn try_as_id(&self) -> Option<Id<&Self::Iri, &Self::BlankId>>

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> MaybeId for T