pub enum Value<T = IriBuf> {
Literal(Literal, Option<T>),
LangString(LangString),
Json(Value),
}Expand description
Value object.
Either a typed literal value, or an internationalized language string.
Variants§
Literal(Literal, Option<T>)
Typed literal value.
LangString(LangString)
Language tagged string.
Json(Value)
JSON literal value.
Implementations§
Source§impl<T> Value<T>
impl<T> Value<T>
Sourcepub fn as_literal(&self) -> Option<(&Literal, Option<&T>)>
pub fn as_literal(&self) -> Option<(&Literal, Option<&T>)>
Returns the literal and its type, if this is a typed literal value.
Sourcepub fn literal_type(&self) -> Option<&T>
pub fn literal_type(&self) -> Option<&T>
Returns the @type IRI of this value, if it is a typed literal with
one.
Sourcepub fn set_literal_type(&mut self, ty: Option<T>) -> Option<T>
pub fn set_literal_type(&mut self, ty: Option<T>) -> Option<T>
Sets the @type IRI of a typed literal value, returning the type it
replaced.
Has no effect and returns None if the value is not a typed literal.
Sourcepub fn map_literal_type<F: FnOnce(Option<T>) -> Option<T>>(&mut self, f: F)
pub fn map_literal_type<F: FnOnce(Option<T>) -> Option<T>>(&mut self, f: F)
Replaces the @type IRI of a typed literal value with the result of
f.
Has no effect if the value is not a typed literal.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the value as a boolean, if it is a literal holding one.
Sourcepub fn as_number(&self) -> Option<&Number>
pub fn as_number(&self) -> Option<&Number>
Returns the value as a number, if it is a literal holding one.
Sourcepub fn typ(&self) -> Option<TypeRef<'_, T>>
pub fn typ(&self) -> Option<TypeRef<'_, T>>
Returns the @type of the value, if it has one.
JSON literal values report TypeRef::Json; language-tagged strings
have no type and report None.
Sourcepub fn language(&self) -> Option<&LenientLangTag>
pub fn language(&self) -> Option<&LenientLangTag>
Returns the @language of the value.
Returns None if the value is not a language-tagged string, or is one
carrying only a @direction.
Sourcepub fn direction(&self) -> Option<Direction>
pub fn direction(&self) -> Option<Direction>
Returns the @direction of the value.
Returns None if the value is not a language-tagged string, or is one
carrying only a @language.
Sourcepub fn entries(&self) -> Entries<'_, T> ⓘ
pub fn entries(&self) -> Entries<'_, T> ⓘ
Returns an iterator over the entries of the JSON representation of the value object.
Sourcepub fn canonicalize_with(&mut self, buffer: &mut Buffer)
pub fn canonicalize_with(&mut self, buffer: &mut Buffer)
Puts the literal held by this value object into canonical form, using
the given buffer to render numbers.
Sourcepub fn canonicalize(&mut self)
pub fn canonicalize(&mut self)
Puts the literal held by this value object into canonical form.
Trait Implementations§
Source§impl<T, B> Any<T, B> for Value<T>
impl<T, B> Any<T, B> for Value<T>
Source§fn id(&self) -> Option<&Id<T, B>>
fn id(&self) -> Option<&Id<T, B>>
@id) of the object, if it is a node object
with one.Source§fn language<'a>(&'a self) -> Option<&'a LenientLangTag>where
T: 'a,
B: 'a,
fn language<'a>(&'a self) -> Option<&'a LenientLangTag>where
T: 'a,
B: 'a,
impl<T: Eq> Eq for Value<T>
Source§impl<T, N: IriVocabulary<Iri = T>> IntoJsonWithContext<N> for Value<T>
impl<T, N: IriVocabulary<Iri = T>> IntoJsonWithContext<N> for Value<T>
Source§impl<T, I: Interpretation> LinkedData<I> for Value<T>where
T: LinkedDataResource<I>,
impl<T, I: Interpretation> LinkedData<I> for Value<T>where
T: LinkedDataResource<I>,
Source§impl<T, I: Interpretation> LinkedDataGraph<I> for Value<T>where
T: LinkedDataResource<I>,
impl<T, I: Interpretation> LinkedDataGraph<I> for Value<T>where
T: LinkedDataResource<I>,
Source§fn visit_graph<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: GraphVisitor<I>,
fn visit_graph<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: GraphVisitor<I>,
Source§impl<T, I: Interpretation> LinkedDataPredicateObjects<I> for Value<T>where
T: LinkedDataResource<I>,
impl<T, I: Interpretation> LinkedDataPredicateObjects<I> for Value<T>where
T: LinkedDataResource<I>,
Source§fn visit_objects<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: PredicateObjectsVisitor<I>,
fn visit_objects<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: PredicateObjectsVisitor<I>,
Source§impl<T, I: Interpretation> LinkedDataResource<I> for Value<T>where
T: LinkedDataResource<I>,
impl<T, I: Interpretation> LinkedDataResource<I> for Value<T>where
T: LinkedDataResource<I>,
Source§fn interpretation(
&self,
interpretation: &mut I,
) -> ResourceInterpretation<'_, I>
fn interpretation( &self, interpretation: &mut I, ) -> ResourceInterpretation<'_, I>
interpretation if required.Source§fn lexical_representation<'a>(
&'a self,
interpretation: &'a mut I,
) -> Option<CowRdfTerm<'a>>where
I: ReverseInterpretation + ReverseLocalInterpretation,
fn lexical_representation<'a>(
&'a self,
interpretation: &'a mut I,
) -> Option<CowRdfTerm<'a>>where
I: ReverseInterpretation + ReverseLocalInterpretation,
Source§fn reference_interpretation(
&self,
interpretation: &mut I,
) -> ResourceInterpretation<'_, I>
fn reference_interpretation( &self, interpretation: &mut I, ) -> ResourceInterpretation<'_, I>
Source§impl<T, I: Interpretation> LinkedDataSubject<I> for Value<T>where
T: LinkedDataResource<I>,
impl<T, I: Interpretation> LinkedDataSubject<I> for Value<T>where
T: LinkedDataResource<I>,
Source§fn visit_subject<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: SubjectVisitor<I>,
fn visit_subject<S>(&self, visitor: S) -> Result<S::Ok, S::Error>where
S: SubjectVisitor<I>,
Source§impl<T: Ord> Ord for Value<T>
impl<T: Ord> Ord for Value<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialOrd> PartialOrd for Value<T>
impl<T: PartialOrd> PartialOrd for Value<T>
impl<T: PartialEq> StructuralPartialEq for Value<T>
Auto Trait Implementations§
impl<T> Freeze for Value<T>
impl<T> RefUnwindSafe for Value<T>where
Option<T>: RefUnwindSafe,
impl<T> Send for Value<T>
impl<T> Sync for Value<T>
impl<T> Unpin for Value<T>
impl<T> UnsafeUnpin for Value<T>where
Option<T>: UnsafeUnpin,
impl<T> UnwindSafe for Value<T>where
Option<T>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self is equivalent to key.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.