Term

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 as MaybeBlankId>::BlankId) -> Term<I, L>
where I: FromBlankId,

Source

pub fn iri(iri: <I as MaybeIri>::Iri) -> Term<I, L>
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 as MaybeBlankId>::BlankId>
where I: TryAsBlankId,

Source

pub fn try_into_blank(self) -> Result<<I as MaybeBlankId>::BlankId, Term<I, L>>
where I: TryIntoBlankId,

Source

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

Source

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

Source

pub fn try_into_iri(self) -> Result<<I as MaybeIri>::Iri, Term<I, L>>
where I: TryIntoIri,

Source

pub fn into_iri(self) -> Option<<I as MaybeIri>::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, L, V> AsRefWithContext<str, V> for Term<I, L>
where I: AsRefWithContext<str, V>, L: AsRef<str>,

Available on crate feature contextual only.
Source§

fn as_ref_with<'a>(&'a self, vocabulary: &'a V) -> &'a str

Source§

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

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, L> Debug for Term<I, L>
where I: Debug, L: Debug,

Source§

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

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

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

Source§

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

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

impl<I, L, V> DisplayWithContext<V> for Term<I, L>

Available on crate feature contextual only.
Source§

fn fmt_with(&self, vocabulary: &V, f: &mut Formatter<'_>) -> Result<(), Error>

Source§

impl<V, I, L> 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, ) -> <Term<I, L> as EmbedIntoVocabulary<V>>::Embedded

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn extracted_from_vocabulary( &self, vocabulary: &V, ) -> <Term<I, <V as LiteralVocabulary>::Literal> as ExtractedFromVocabulary<V>>::Extracted

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

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

fn from_blank(b: <Term<I, L> as MaybeBlankId>::BlankId) -> Term<I, L>

Builds a value from a blank node identifier.
Source§

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

Source§

fn from_iri(b: <Term<I, L> as MaybeIri>::Iri) -> Term<I, L>

Builds a value from an iri.
Source§

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

Source§

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

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

Source§

type Interpreted = <I as Interpretation>::Resource

Interpreted form.
Source§

fn interpret( self, interpretation: &mut I, ) -> <Term<T, L> as Interpret<I>>::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<V, I, T, B, L> LinkedDataResource<I, V> for Term<Id<T, B>, L>

Source§

fn interpretation( &self, vocabulary: &mut V, interpretation: &mut I, ) -> ResourceInterpretation<'_, I, V>

Source§

fn lexical_representation<'a>( &'a self, vocabulary: &'a mut V, interpretation: &'a mut I, ) -> Option<CowRdfTerm<'a, V>>
where I: ReverseTermInterpretation<Iri = <V as IriVocabulary>::Iri, BlankId = <V as BlankIdVocabulary>::BlankId, Literal = <V as LiteralVocabulary>::Literal>,

Source§

fn reference_interpretation( &self, vocabulary: &mut V, interpretation: &mut I, ) -> ResourceInterpretation<'_, I, V>

Source§

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

Source§

type BlankId = <I as MaybeBlankId>::BlankId

Inner blank node identifier type.
Source§

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

Source§

type Iri = <I as MaybeIri>::Iri

Inner iri type.
Source§

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

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, L1, I2, L2> PartialEq<Term<I2, L2>> for Term<I1, L1>
where I1: PartialEq<I2>, L1: PartialEq<L2>,

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, L1, I2, L2> PartialOrd<Term<I2, L2>> for Term<I1, L1>
where I1: PartialOrd<I2>, L1: PartialOrd<L2>,

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, L> RdfDisplay for Term<I, L>
where I: RdfDisplay, L: RdfDisplay,

Source§

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

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, L, V> RdfDisplayWithContext<V> for Term<I, L>

Available on crate feature contextual only.
Source§

fn rdf_fmt_with( &self, vocabulary: &V, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

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

Source§

fn try_as_blank(&self) -> Option<&<Term<I, L> as MaybeBlankId>::BlankId>

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

fn is_blank(&self) -> bool

Source§

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

Source§

fn try_as_iri(&self) -> Option<&<Term<I, L> as MaybeIri>::Iri>

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

fn is_iri(&self) -> bool

Source§

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

Source§

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

Source§

fn try_into_blank( self, ) -> Result<<Term<I, L> as MaybeBlankId>::BlankId, Term<I, L>>

Source§

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

Source§

fn try_into_iri(self) -> Result<<Term<I, L> as MaybeIri>::Iri, Term<I, L>>

Source§

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

Source§

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

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> At for T

Source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. 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> BorrowStripped for T

Source§

fn stripped(&self) -> &Stripped<T>

Source§

impl<T> BorrowUnordered for T

Source§

impl<T> CallHasher for T
where T: Hash + ?Sized,

Source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, C> FromWithContext<T, C> for T

Source§

fn from_with(value: T, _context: &C) -> T

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, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

Source§

fn into_with(self, context: &C) -> U

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToOwned for T

Source§

type Owned = T

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, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

Source§

type Error = Infallible

Source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

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, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

Source§

type Error = <U as TryFromWithContext<T, C>>::Error

Source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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

Source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

Source§

fn into_with<C>(self, context: C) -> Contextual<T, C>

Source§

impl<T> MaybeId for T