pub struct Document<I = IriBuf, B = BlankIdBuf> { /* private fields */ }
Expand description
JSON-LD document in both compact and expanded form.
Implementations§
Source§impl<I, B> Document<I, B>
impl<I, B> Document<I, B>
pub fn new( remote: RemoteDocument<I>, expanded: ExpandedDocument<I, B>, ) -> Document<I, B>
pub fn into_remote(self) -> RemoteDocument<I>
pub fn into_compact(self) -> Value
pub fn into_expanded(self) -> ExpandedDocument<I, B>
pub fn into_parts(self) -> (RemoteDocument<I>, ExpandedDocument<I, B>)
pub fn as_remote(&self) -> &RemoteDocument<I>
pub fn as_compact(&self) -> &Value
pub fn as_expanded(&self) -> &ExpandedDocument<I, B>
Methods from Deref<Target = ExpandedDocument<I, B>>§
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn objects(&self) -> &IndexSet<Indexed<Object<T, B>>>
pub fn iter(&self) -> Iter<'_, Indexed<Object<T, B>>>
pub fn traverse(&self) -> Traverse<'_, T, B> ⓘ
pub fn count(&self, f: impl FnMut(&FragmentRef<'_, T, B>) -> bool) -> usize
Sourcepub fn blank_ids(&self) -> HashSet<&B>
pub fn blank_ids(&self) -> HashSet<&B>
Returns the set of all blank identifiers in the given document.
Sourcepub fn main_node(&self) -> Option<&Node<T, B>>
pub fn main_node(&self) -> Option<&Node<T, B>>
Returns the main node object of the document, if any.
The main node is the unique top level (root) node object. If multiple
node objects are on the root, None
is returned.
pub fn generate_node_map_with<V, G>(
&self,
vocabulary: &mut V,
generator: G,
) -> Result<NodeMap<T, B>, ConflictingIndexes<T, B>>where
V: Vocabulary<Iri = T, BlankId = B>,
G: Generator<V>,
Trait Implementations§
Source§impl<I, B> Borrow<ExpandedDocument<I, B>> for Document<I, B>
impl<I, B> Borrow<ExpandedDocument<I, B>> for Document<I, B>
Source§fn borrow(&self) -> &ExpandedDocument<I, B>
fn borrow(&self) -> &ExpandedDocument<I, B>
Immutably borrows from an owned value. Read more
Source§impl<I, B> Borrow<RemoteDocument<I>> for Document<I, B>
impl<I, B> Borrow<RemoteDocument<I>> for Document<I, B>
Source§fn borrow(&self) -> &RemoteDocument<I>
fn borrow(&self) -> &RemoteDocument<I>
Immutably borrows from an owned value. Read more
Source§impl<V, I> LinkedData<I, V> for Document<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>where
V: Vocabulary + IriVocabularyMut,
I: Interpretation,
<V as IriVocabulary>::Iri: LinkedDataSubject<I, V> + LinkedDataResource<I, V>,
<V as BlankIdVocabulary>::BlankId: LinkedDataSubject<I, V> + LinkedDataResource<I, V>,
impl<V, I> LinkedData<I, V> for Document<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>where
V: Vocabulary + IriVocabularyMut,
I: Interpretation,
<V as IriVocabulary>::Iri: LinkedDataSubject<I, V> + LinkedDataResource<I, V>,
<V as BlankIdVocabulary>::BlankId: LinkedDataSubject<I, V> + LinkedDataResource<I, V>,
Source§impl<V, I> LinkedDataGraph<I, V> for Document<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>where
V: Vocabulary + IriVocabularyMut,
I: Interpretation,
<V as IriVocabulary>::Iri: LinkedDataSubject<I, V> + LinkedDataResource<I, V>,
<V as BlankIdVocabulary>::BlankId: LinkedDataSubject<I, V> + LinkedDataResource<I, V>,
impl<V, I> LinkedDataGraph<I, V> for Document<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>where
V: Vocabulary + IriVocabularyMut,
I: Interpretation,
<V as IriVocabulary>::Iri: LinkedDataSubject<I, V> + LinkedDataResource<I, V>,
<V as BlankIdVocabulary>::BlankId: LinkedDataSubject<I, V> + LinkedDataResource<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<I, B> Serialize for Document<I, B>
impl<I, B> Serialize for Document<I, B>
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<I, B> Eq for Document<I, B>
Auto Trait Implementations§
impl<I, B> Freeze for Document<I, B>where
I: Freeze,
impl<I, B> RefUnwindSafe for Document<I, B>where
I: RefUnwindSafe,
B: RefUnwindSafe,
impl<I, B> Send for Document<I, B>
impl<I, B> Sync for Document<I, B>
impl<I, B> Unpin for Document<I, B>where
I: Unpin,
impl<I, B> UnwindSafe for Document<I, B>where
I: 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
Mutably borrows from an owned value. Read more
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key
and return true
if they are equal.