json_ld_core/deserialization/
mod.rs

1use linked_data::{LinkedData, LinkedDataGraph, LinkedDataResource, LinkedDataSubject};
2use rdf_types::{vocabulary::IriVocabularyMut, Interpretation, Vocabulary};
3
4use crate::ExpandedDocument;
5
6mod object;
7
8impl<T, B, V: Vocabulary<Iri = T>, I: Interpretation> LinkedDataGraph<I, V>
9	for ExpandedDocument<T, B>
10where
11	T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
12	B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
13	V: IriVocabularyMut,
14{
15	fn visit_graph<S>(&self, mut visitor: S) -> Result<S::Ok, S::Error>
16	where
17		S: linked_data::GraphVisitor<I, V>,
18	{
19		for object in self {
20			visitor.subject(object.inner())?;
21		}
22
23		visitor.end()
24	}
25}
26
27impl<T, B, V: Vocabulary<Iri = T>, I: Interpretation> LinkedData<I, V> for ExpandedDocument<T, B>
28where
29	T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
30	B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
31	V: IriVocabularyMut,
32{
33	fn visit<S>(&self, mut visitor: S) -> Result<S::Ok, S::Error>
34	where
35		S: linked_data::Visitor<I, V>,
36	{
37		visitor.default_graph(self)?;
38		visitor.end()
39	}
40}