pub enum Object<T = IriBuf, B = BlankIdBuf> {
Value(Value<T>),
Node(Box<Node<T, B>>),
List(List<T, B>),
}
Expand description
Object.
JSON-LD connects together multiple kinds of data objects. Objects may be nodes, values or lists of objects.
You can get an Object
by expanding a JSON-LD document using the
expansion algorithm or by converting an already expanded JSON document
using TryFromJson
.
Variants§
Implementations§
source§impl<T, B> Object<T, B>
impl<T, B> Object<T, B>
sourcepub fn identify_all_with<V, G>(&mut self, vocabulary: &mut V, generator: &mut G)
pub fn identify_all_with<V, G>(&mut self, vocabulary: &mut V, generator: &mut G)
Assigns an identifier to every node included in this object using the given generator
.
sourcepub fn identify_all<G>(&mut self, generator: &mut G)
pub fn identify_all<G>(&mut self, generator: &mut G)
Use the given generator
to assign an identifier to all nodes that
don’t have one.
sourcepub fn canonicalize_with(&mut self, buffer: &mut Buffer)
pub fn canonicalize_with(&mut self, buffer: &mut Buffer)
Puts this object literals 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 object literals into canonical form.
sourcepub fn as_iri(&self) -> Option<&T>
pub fn as_iri(&self) -> Option<&T>
Identifier of the object as an IRI.
If the object is a node identified by an IRI, returns this IRI.
Returns None
otherwise.
sourcepub fn as_value_mut(&mut self) -> Option<&mut Value<T>>
pub fn as_value_mut(&mut self) -> Option<&mut Value<T>>
Returns this object as a mutable value, if it is one.
sourcepub fn into_value(self) -> Option<Value<T>>
pub fn into_value(self) -> Option<Value<T>>
Converts this object as a value, if it is one.
sourcepub fn as_node_mut(&mut self) -> Option<&mut Node<T, B>>
pub fn as_node_mut(&mut self) -> Option<&mut Node<T, B>>
Returns this object as a mutable node, if it is one.
sourcepub fn is_graph(&self) -> bool
pub fn is_graph(&self) -> bool
Tests if the object is a graph object (a node with a @graph
field).
sourcepub fn as_list_mut(&mut self) -> Option<&mut List<T, B>>
pub fn as_list_mut(&mut self) -> Option<&mut List<T, B>>
Returns this object as a mutable list, if it is one.
sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Get the object as a string.
If the object is a value that is a string, returns this string.
If the object is a node that is identified, returns the identifier as a string.
Returns None
otherwise.
sourcepub fn language(&self) -> Option<&LenientLangTag>
pub fn language(&self) -> Option<&LenientLangTag>
If the object is a language-tagged value, Return its associated language.
sourcepub fn traverse(&self) -> Traverse<'_, T, B> ⓘ
pub fn traverse(&self) -> Traverse<'_, T, B> ⓘ
Returns an iterator over all fragments of this object, including the object itself.
Fragments include:
- objects
- key-value pairs,
- keys
- values
sourcepub fn equivalent(&self, other: &Object<T, B>) -> bool
pub fn equivalent(&self, other: &Object<T, B>) -> bool
Equivalence operator.
Equivalence is different from equality for anonymous objects: List objects and anonymous node objects have an implicit unlabeled blank nodes and thus never equivalent.
Trait Implementations§
source§impl<T, B, N> IntoJsonWithContext<N> for Object<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> IntoJsonWithContext<N> for Object<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
fn into_json_with(self, vocabulary: &N) -> Value
source§impl<T, B, V, I> LinkedData<I, V> for Object<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
impl<T, B, V, I> LinkedData<I, V> for Object<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
source§impl<T, B, V, I> LinkedDataGraph<I, V> for Object<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
impl<T, B, V, I> LinkedDataGraph<I, V> for Object<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
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, B, V, I> LinkedDataPredicateObjects<I, V> for Object<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
impl<T, B, V, I> LinkedDataPredicateObjects<I, V> for Object<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
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<T, B, V, I> LinkedDataResource<I, V> for Object<T, B>where
V: Vocabulary<Iri = T>,
I: Interpretation,
T: LinkedDataResource<I, V>,
B: LinkedDataResource<I, V>,
impl<T, B, V, I> LinkedDataResource<I, V> for Object<T, B>where
V: Vocabulary<Iri = T>,
I: Interpretation,
T: LinkedDataResource<I, V>,
B: LinkedDataResource<I, V>,
fn interpretation( &self, vocabulary: &mut V, interpretation: &mut I ) -> ResourceInterpretation<'_, I, V>
fn reference_interpretation( &self, vocabulary: &mut V, interpretation: &mut I ) -> ResourceInterpretation<'_, I, V>
source§impl<T, B, V, I> LinkedDataSubject<I, V> for Object<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
impl<T, B, V, I> LinkedDataSubject<I, V> for Object<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
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, B> PartialEq for Object<T, B>
impl<T, B> PartialEq for Object<T, B>
source§impl<T, B> TryFromJson<T, B> for Object<T, B>
impl<T, B> TryFromJson<T, B> for Object<T, B>
fn try_from_json_in( vocabulary: &mut impl VocabularyMut<Iri = T, BlankId = B>, value: Value ) -> Result<Object<T, B>, InvalidExpandedJson>
source§impl<T, B> TryFromJsonObject<T, B> for Object<T, B>
impl<T, B> TryFromJsonObject<T, B> for Object<T, B>
fn try_from_json_object_in( vocabulary: &mut impl VocabularyMut<Iri = T, BlankId = B>, object: Object ) -> Result<Object<T, B>, InvalidExpandedJson>
impl<T, B> Eq for Object<T, B>
Auto Trait Implementations§
impl<T, B> Freeze for Object<T, B>where
T: Freeze,
impl<T, B> RefUnwindSafe for Object<T, B>where
T: RefUnwindSafe,
B: RefUnwindSafe,
impl<T, B> Send for Object<T, B>
impl<T, B> Sync for Object<T, B>
impl<T, B> Unpin for Object<T, B>where
T: Unpin,
impl<T, B> UnwindSafe for Object<T, B>where
T: UnwindSafe,
B: 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<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>,
async fn compact_indexed_fragment<'a, N, L>( &'a self, vocabulary: &'a mut N, index: Option<&'a str>, active_context: &'a Context<I, B>, type_scoped_context: &'a Context<I, B>, active_property: Option<&'a str>, loader: &'a mut L, options: Options ) -> Result<Value, Error<<L as Loader<I>>::Error>>
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.