Skip to main content

EmbedContext

Trait EmbedContext 

Source
pub trait EmbedContext {
    // Required method
    fn embed_context<N>(
        &mut self,
        vocabulary: &N,
        context: ProcessedRef<'_, '_, N::Iri, N::BlankId>,
        options: Options,
    ) -> Result<(), IriConfusedWithPrefix>
       where N: Vocabulary,
             N::Iri: Clone + Hash + Eq,
             N::BlankId: Clone + Hash + Eq;
}
Expand description

Documents that a @context can be embedded into.

The final step of document compaction is to record, in the output, the context the output was compacted against, so that the result round-trips back to the same expanded document.

Required Methods§

Source

fn embed_context<N>( &mut self, vocabulary: &N, context: ProcessedRef<'_, '_, N::Iri, N::BlankId>, options: Options, ) -> Result<(), IriConfusedWithPrefix>
where N: Vocabulary, N::Iri: Clone + Hash + Eq, N::BlankId: Clone + Hash + Eq,

Embeds context into this document as a @context entry.

The context is written in its original, unprocessed form, as the first entry of the document’s top-level object. A document that compacted to an array is first wrapped in an object under whatever @graph compacts to, since only an object can carry @context. Nothing is embedded when the document compacted to null or to nothing at all, or when the context itself is null or empty.

§Errors

Returns an error when the context cannot be embedded in the compacted document.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl EmbedContext for Value

Source§

fn embed_context<N>( &mut self, vocabulary: &N, context: ProcessedRef<'_, '_, N::Iri, N::BlankId>, options: Options, ) -> Result<(), IriConfusedWithPrefix>
where N: Vocabulary, N::Iri: Clone + Hash + Eq, N::BlankId: Clone + Hash + Eq,

Implementors§