Struct rdf_types::literal::Literal

source ·
pub struct Literal<T = Type<IriBuf, LanguageTagBuf>, S = String> { /* private fields */ }
Expand description

RDF Literal.

Implementations§

source§

impl<T, S> Literal<T, S>

source

pub fn new(value: S, type_: T) -> Self

source

pub fn type_(&self) -> &T

source

pub fn type_mut(&mut self) -> &mut T

source

pub fn into_type_(self) -> T

source

pub fn value(&self) -> &S

source

pub fn value_mut(&mut self) -> &mut S

source

pub fn into_value(self) -> S

source

pub fn into_parts(self) -> (S, T)

source

pub fn as_str(&self) -> &str
where S: AsRef<str>,

source

pub fn as_str_mut(&mut self) -> &mut str
where S: AsMut<str>,

source

pub fn as_bytes(&self) -> &[u8]
where S: AsRef<[u8]>,

source

pub fn as_bytes_mut(&mut self) -> &mut [u8]
where S: AsMut<[u8]>,

source

pub fn insert_type_into_vocabulary<V>( self, vocabulary: &mut V ) -> Literal<T::Inserted, S>

source

pub fn inserted_type_into_vocabulary<V>( &self, vocabulary: &mut V ) -> Literal<T::Inserted, S>
where T: InsertedIntoVocabulary<V>, S: Clone,

source§

impl<I, L, S> Literal<Type<I, L>, S>

source

pub fn is_lang_string(&self) -> bool

source

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

Trait Implementations§

source§

impl<T, S> AsLiteral for Literal<T, S>

§

type Value = S

Literal value type.
§

type Type = T

Literal type value type.
source§

fn as_literal(&self) -> Literal<&T, &S>

Turns the reference into a Literal referencing its components.
source§

impl<T, S: AsMut<str>> AsMut<str> for Literal<T, S>

source§

fn as_mut(&mut self) -> &mut str

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<T, S: AsRef<str>> AsRef<str> for Literal<T, S>

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T, S: AsRef<str>> Borrow<str> for Literal<T, S>

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl<T, S: AsRef<str> + AsMut<str>> BorrowMut<str> for Literal<T, S>

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T: Clone, S: Clone> Clone for Literal<T, S>

source§

fn clone(&self) -> Literal<T, S>

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<T: Debug, S: Debug> Debug for Literal<T, S>

source§

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

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

impl<T: RdfDisplay + RdfDisplayType, S: RdfDisplay> Display for Literal<T, S>

source§

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

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

impl<V: LiteralVocabulary> ExportFromVocabulary<V> for Literal<V::Type, V::Value>

source§

impl<V: LiteralVocabulary> ExportedFromVocabulary<V> for Literal<V::Type, V::Value>

§

type Output = Literal<<<V as LiteralVocabulary>::Type as ExportedFromVocabulary<V>>::Output, <V as LiteralVocabulary>::Value>

source§

fn exported_from_vocabulary(&self, vocabulary: &V) -> Self::Output

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

impl<T: Hash, S: Hash> Hash for Literal<T, S>

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: LiteralVocabularyMut> InsertIntoVocabulary<V> for Literal<V::Type, V::Value>

source§

impl<V: LiteralVocabularyMut> InsertedIntoVocabulary<V> for Literal<V::Type, V::Value>

source§

impl<T, S, I: LiteralInterpretationMut<Self>> Interpret<I> for Literal<T, S>

§

type Interpreted = <I as Interpretation>::Resource

Interpreted form.
source§

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

Interpret the given resource.
source§

impl<T, S> IntoLiteral for Literal<T, S>

source§

fn into_literal(self) -> Self

Turns the value into a Literal.
source§

impl LiteralInterpretation<Literal> for ()

source§

fn literal_interpretation(&self, literal: &Literal) -> Option<Self::Resource>

Returns the interpretation of the given literal value, if any.
source§

fn lexical_literal_interpretation<V: LiteralVocabulary<Literal = L>>( &self, vocabulary: &V, literal: &Literal<V::Type, V::Value> ) -> Option<Self::Resource>

source§

impl<T: Ord, S: Ord> Ord for Literal<T, S>

source§

fn cmp(&self, other: &Literal<T, S>) -> 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 + PartialOrd,

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

impl<T: PartialEq, S: PartialEq> PartialEq for Literal<T, S>

source§

fn eq(&self, other: &Literal<T, S>) -> 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<T: PartialOrd, S: PartialOrd> PartialOrd for Literal<T, S>

source§

fn partial_cmp(&self, other: &Literal<T, S>) -> 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<T: RdfDisplay + RdfDisplayType, S: RdfDisplay> RdfDisplay for Literal<T, S>

source§

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

source§

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

source§

impl<T: TryExportLiteralType<V>, S: Into<String>, V> TryExportLiteral<V> for Literal<T, S>

§

type Error = <T as TryExportLiteralType<V>>::Error

source§

fn try_export_literal(self, vocabulary: &V) -> Result<Literal, Self::Error>

source§

impl<'a, T, S> TryFrom<&'a Literal<T, S>> for LiteralIndex

§

type Error = ()

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

fn try_from(_value: &'a Literal<T, S>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, T, S, L: TryFrom<&'a Literal<T, S>>> TryFrom<&'a Literal<T, S>> for LiteralOrIndex<L>

§

type Error = <L as TryFrom<&'a Literal<T, S>>>::Error

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

fn try_from(value: &'a Literal<T, S>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T: Copy, S: Copy> Copy for Literal<T, S>

source§

impl<T: Eq, S: Eq> Eq for Literal<T, S>

source§

impl<T, S> StructuralEq for Literal<T, S>

source§

impl<T, S> StructuralPartialEq for Literal<T, S>

Auto Trait Implementations§

§

impl<T, S> RefUnwindSafe for Literal<T, S>

§

impl<T, S> Send for Literal<T, S>
where S: Send, T: Send,

§

impl<T, S> Sync for Literal<T, S>
where S: Sync, T: Sync,

§

impl<T, S> Unpin for Literal<T, S>
where S: Unpin, T: Unpin,

§

impl<T, S> UnwindSafe for Literal<T, S>
where S: UnwindSafe, T: 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<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,

§

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§

default fn to_string(&self) -> String

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

impl<T, U> TryFrom<U> for T
where 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 T
where 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.