Enum rdf_types::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) -> Selfwhere I: FromBlankId,

source

pub fn iri(iri: I::Iri) -> Selfwhere 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) -> boolwhere I: AsBlankId,

source

pub fn is_iri(&self) -> boolwhere I: AsIri,

source

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

source

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

source

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

source

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

source

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

source

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

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<L> Term<Id, L>

source

pub fn as_term_ref(&self) -> TermRef<'_, L>

source

pub fn as_object_ref(&self) -> ObjectRef<'_, L>

Alias for as_term_ref.

source§

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

source

pub fn into_owned(self) -> Term<Id, L>where L: Clone,

Trait Implementations§

source§

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

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

source§

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

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 Term<Id<I, B>, L>

source§

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

source§

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

source§

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

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

source§

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

source§

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

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

source§

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

source§

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

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

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

§

type Id = I

Node identifier type.
§

type Literal = L

Literal type.
source§

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

Turns the value into a Term.
source§

impl<I, T, U> MapLiteral<T, U> for Term<I, T>

§

type Output = Term<I, U>

source§

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

Maps RDF literal values.
source§

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

§

type BlankId = <I as MaybeBlankId>::BlankId

Inner blank node identifier type.
source§

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

§

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

source§

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

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

Auto Trait Implementations§

§

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

§

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