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>
pub fn as_str(&self) -> Option<&str>
pub fn as_literal(&self) -> Option<(&Literal, Option<&T>)>
pub fn literal_type(&self) -> Option<&T>
Sourcepub fn set_literal_type(&mut self, ty: Option<T>) -> Option<T>
pub fn set_literal_type(&mut self, ty: Option<T>) -> Option<T>
Set the literal value type, and returns the old type.
Has no effect and return None
if the value is not a literal value.
Sourcepub fn map_literal_type<F>(&mut self, f: F)
pub fn map_literal_type<F>(&mut self, f: F)
Maps the literal value type.
Has no effect if the value is not a literal value.
pub fn as_bool(&self) -> Option<bool>
pub fn as_number(&self) -> Option<&Number>
Sourcepub fn typ(&self) -> Option<TypeRef<'_, T>>
pub fn typ(&self) -> Option<TypeRef<'_, T>>
Return the type of the value if any.
This will return Some(Type::Json)
for JSON literal values.
Sourcepub fn language(&self) -> Option<&LenientLangTag>
pub fn language(&self) -> Option<&LenientLangTag>
If the value is a language tagged string, return its associated language if any.
Returns None
if the value is not a language tagged string.
Sourcepub fn direction(&self) -> Option<Direction>
pub fn direction(&self) -> Option<Direction>
If the value is a language tagged string, return its associated direction if any.
Returns None
if the value is not a language tagged string.
pub fn entries(&self) -> Entries<'_, T> ⓘ
Sourcepub fn canonicalize_with(&mut self, buffer: &mut Buffer)
pub fn canonicalize_with(&mut self, buffer: &mut Buffer)
Puts this value object literal into canonical form using the given
buffer
.
The buffer is used to compute the canonical form of numbers.
Sourcepub fn canonicalize(&mut self)
pub fn canonicalize(&mut self)
Puts this literal into canonical form.
Trait Implementations§
Source§impl<T, N> IntoJsonWithContext<N> for Value<T>where
N: IriVocabulary<Iri = T>,
impl<T, N> IntoJsonWithContext<N> for Value<T>where
N: IriVocabulary<Iri = T>,
fn into_json_with(self, vocabulary: &N) -> Value
Source§impl<V, I> LinkedData<I, V> for Value<<V as IriVocabulary>::Iri>where
V: Vocabulary,
I: Interpretation,
impl<V, I> LinkedData<I, V> for Value<<V as IriVocabulary>::Iri>where
V: Vocabulary,
I: Interpretation,
Source§impl<V, I> LinkedDataGraph<I, V> for Value<<V as IriVocabulary>::Iri>where
V: Vocabulary,
I: Interpretation,
impl<V, I> LinkedDataGraph<I, V> for Value<<V as IriVocabulary>::Iri>where
V: Vocabulary,
I: Interpretation,
fn visit_graph<S>(
&self,
visitor: S,
) -> Result<<S as GraphVisitor<I, V>>::Ok, <S as GraphVisitor<I, V>>::Error>where
S: GraphVisitor<I, V>,
Source§impl<T, V, I> LinkedDataPredicateObjects<I, V> for Value<T>where
V: Vocabulary,
I: Interpretation,
impl<T, V, I> LinkedDataPredicateObjects<I, V> for Value<T>where
V: Vocabulary,
I: Interpretation,
fn visit_objects<S>(
&self,
visitor: S,
) -> Result<<S as PredicateObjectsVisitor<I, V>>::Ok, <S as PredicateObjectsVisitor<I, V>>::Error>where
S: PredicateObjectsVisitor<I, V>,
Source§impl<V, I> LinkedDataResource<I, V> for Value<<V as IriVocabulary>::Iri>where
V: Vocabulary,
I: Interpretation,
impl<V, I> LinkedDataResource<I, V> for Value<<V as IriVocabulary>::Iri>where
V: Vocabulary,
I: Interpretation,
fn interpretation( &self, vocabulary: &mut V, _interpretation: &mut I, ) -> ResourceInterpretation<'_, I, V>
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>,
fn reference_interpretation( &self, vocabulary: &mut V, interpretation: &mut I, ) -> ResourceInterpretation<'_, I, V>
Source§impl<T, V, I> LinkedDataSubject<I, V> for Value<T>where
V: Vocabulary,
I: Interpretation,
impl<T, V, I> LinkedDataSubject<I, V> for Value<T>where
V: Vocabulary,
I: Interpretation,
fn visit_subject<S>(
&self,
visitor: S,
) -> Result<<S as SubjectVisitor<I, V>>::Ok, <S as SubjectVisitor<I, V>>::Error>where
S: SubjectVisitor<I, V>,
Source§impl<T> Ord for Value<T>where
T: Ord,
impl<T> Ord for Value<T>where
T: Ord,
Source§impl<T> PartialOrd for Value<T>where
T: PartialOrd,
impl<T> PartialOrd for Value<T>where
T: PartialOrd,
impl<T> Eq for Value<T>where
T: Eq,
impl<T> StructuralPartialEq for Value<T>
Auto Trait Implementations§
impl<T> Freeze for Value<T>where
T: Freeze,
impl<T> RefUnwindSafe for Value<T>where
T: RefUnwindSafe,
impl<T> Send for Value<T>where
T: Send,
impl<T> Sync for Value<T>where
T: Sync,
impl<T> Unpin for Value<T>where
T: Unpin,
impl<T> UnwindSafe for Value<T>where
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
fn as_unordered(&self) -> &Unordered<T>
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<I, B, T> CompactIndexedFragment<I, B> for Twhere
T: Any<I, B>,
impl<I, B, T> CompactIndexedFragment<I, B> for Twhere
T: Any<I, B>,
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§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.