Struct json_ld::Document

source ·
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>

source

pub fn new( remote: RemoteDocument<I>, expanded: ExpandedDocument<I, B> ) -> Document<I, B>

source

pub fn into_remote(self) -> RemoteDocument<I>

source

pub fn into_compact(self) -> Value

source

pub fn into_expanded(self) -> ExpandedDocument<I, B>

source

pub fn into_parts(self) -> (RemoteDocument<I>, ExpandedDocument<I, B>)

source

pub fn as_remote(&self) -> &RemoteDocument<I>

source

pub fn as_compact(&self) -> &Value

source

pub fn as_expanded(&self) -> &ExpandedDocument<I, B>

Methods from Deref<Target = ExpandedDocument<I, B>>§

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn objects(&self) -> &IndexSet<Indexed<Object<T, B>>>

source

pub fn iter(&self) -> Iter<'_, Indexed<Object<T, B>>>

source

pub fn traverse(&self) -> Traverse<'_, T, B>

source

pub fn count(&self, f: impl FnMut(&FragmentRef<'_, T, B>) -> bool) -> usize

source

pub fn blank_ids(&self) -> HashSet<&B>
where B: Eq + Hash,

Returns the set of all blank identifiers in the given document.

source

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.

source

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>

source§

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>

source§

fn borrow(&self) -> &RemoteDocument<I>

Immutably borrows from an owned value. Read more
source§

impl<I, B> Borrow<Value> for Document<I, B>

source§

fn borrow(&self) -> &Value

Immutably borrows from an owned value. Read more
source§

impl<I, B> Clone for Document<I, B>
where I: Clone, B: Clone,

source§

fn clone(&self) -> Document<I, B>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I, B> Debug for Document<I, B>
where I: Debug, B: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<I, B> Deref for Document<I, B>

§

type Target = ExpandedDocument<I, B>

The resulting type after dereferencing.
source§

fn deref(&self) -> &<Document<I, B> as Deref>::Target

Dereferences the value.
source§

impl<V, I> LinkedData<I, V> for Document<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>

source§

fn visit<S>( &self, visitor: S ) -> Result<<S as Visitor<I, V>>::Ok, <S as Visitor<I, V>>::Error>
where S: Visitor<I, V>,

Visit the RDF dataset represented by this type.
source§

impl<V, I> LinkedDataGraph<I, V> for Document<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>

source§

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> PartialEq for Document<I, B>
where I: Eq + Hash, B: Eq + Hash,

source§

fn eq(&self, other: &Document<I, B>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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,

Serialize this value into the given Serde serializer. Read more
source§

impl<I, B> Eq for Document<I, B>
where I: Eq + Hash, B: Eq + Hash,

Auto Trait Implementations§

§

impl<I, B> Freeze for Document<I, B>
where I: Freeze,

§

impl<I, B> RefUnwindSafe for Document<I, B>

§

impl<I, B> Send for Document<I, B>
where I: Send, B: Send,

§

impl<I, B> Sync for Document<I, B>
where I: Sync, B: Sync,

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> At for T

source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> BorrowStripped for T

source§

fn stripped(&self) -> &Stripped<T>

source§

impl<T> BorrowUnordered for T

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, C> FromWithContext<T, C> for T

source§

fn from_with(value: T, _context: &C) -> T

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

source§

fn into_with(self, context: &C) -> U

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToOwned for T

§

type Owned = T

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

§

type Error = Infallible

source§

fn try_from_with( value: U, context: &C ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

§

type Error = <U as TryFromWithContext<T, C>>::Error

source§

fn try_into_with( self, context: &C ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

source§

impl<T> WithContext for T
where T: ?Sized,

source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

source§

fn into_with<C>(self, context: C) -> Contextual<T, C>

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more