Skip to main content

Process

Trait Process 

Source
pub trait Process {
    // Required methods
    async fn process_full<N, L, W>(
        &self,
        vocabulary: &mut N,
        active_context: &Context<N::Iri, N::BlankId>,
        loader: &L,
        base_url: Option<N::Iri>,
        options: Options,
        warnings: W,
    ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
       where N: VocabularyMut,
             N::Iri: Clone + Eq + Hash,
             N::BlankId: Clone + PartialEq,
             L: Loader,
             W: WarningHandler<N>;
    async fn process_full_with_cache<N, L, W>(
        &self,
        vocabulary: &mut N,
        active_context: &Context<N::Iri, N::BlankId>,
        loader: &L,
        base_url: Option<N::Iri>,
        options: Options,
        warnings: W,
        cache: &ProcessingCache<N::Iri, N::BlankId>,
    ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
       where N: VocabularyMut,
             N::Iri: Clone + Eq + Hash,
             N::BlankId: Clone + Eq + Hash,
             L: Loader,
             W: WarningHandler<N>;

    // Provided methods
    async fn process_with_cache<N, L>(
        &self,
        vocabulary: &mut N,
        active_context: &Context<N::Iri, N::BlankId>,
        loader: &L,
        base_url: Option<N::Iri>,
        options: Options,
        cache: &ProcessingCache<N::Iri, N::BlankId>,
    ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
       where N: VocabularyMut,
             N::Iri: Clone + Eq + Hash,
             N::BlankId: Clone + Eq + Hash,
             L: Loader { ... }
    async fn process_with<N, L>(
        &self,
        vocabulary: &mut N,
        active_context: &Context<N::Iri, N::BlankId>,
        loader: &L,
        base_url: Option<N::Iri>,
        options: Options,
    ) -> ProcessingResult<'_, N::Iri, N::BlankId, L::Error>
       where N: VocabularyMut,
             N::Iri: Clone + Eq + Hash,
             N::BlankId: Clone + PartialEq,
             L: Loader { ... }
    async fn process<N, L>(
        &self,
        vocabulary: &mut N,
        loader: &L,
        base_url: Option<N::Iri>,
    ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
       where N: VocabularyMut,
             N::Iri: Clone + Eq + Hash,
             N::BlankId: Clone + PartialEq,
             L: Loader { ... }
}
Expand description

Contexts that can be processed into an active context.

Required Methods§

Source

async fn process_full<N, L, W>( &self, vocabulary: &mut N, active_context: &Context<N::Iri, N::BlankId>, loader: &L, base_url: Option<N::Iri>, options: Options, warnings: W, ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
where N: VocabularyMut, N::Iri: Clone + Eq + Hash, N::BlankId: Clone + PartialEq, L: Loader, W: WarningHandler<N>,

Processes this context on top of active_context, taking every parameter of the algorithm explicitly.

base_url is the URL the context was written at; it is what relative @context IRIs, @import values and @base are resolved against. loader fetches remote contexts and @imported documents. warnings receives the Warnings the algorithm reports without aborting.

Source

async fn process_full_with_cache<N, L, W>( &self, vocabulary: &mut N, active_context: &Context<N::Iri, N::BlankId>, loader: &L, base_url: Option<N::Iri>, options: Options, warnings: W, cache: &ProcessingCache<N::Iri, N::BlankId>, ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
where N: VocabularyMut, N::Iri: Clone + Eq + Hash, N::BlankId: Clone + Eq + Hash, L: Loader, W: WarningHandler<N>,

Processes this context as Process::process_full does, but consults cache first and stores the result on a miss.

Worth using whenever the same @context is processed repeatedly against the same active context — the usual shape of a document with many nodes. See ProcessingCache for what makes a cached result reusable and for the lifetime the cache has to be given.

Provided Methods§

Source

async fn process_with_cache<N, L>( &self, vocabulary: &mut N, active_context: &Context<N::Iri, N::BlankId>, loader: &L, base_url: Option<N::Iri>, options: Options, cache: &ProcessingCache<N::Iri, N::BlankId>, ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
where N: VocabularyMut, N::Iri: Clone + Eq + Hash, N::BlankId: Clone + Eq + Hash, L: Loader,

Processes this context as Process::process_full_with_cache does, printing any warning to standard error.

Source

async fn process_with<N, L>( &self, vocabulary: &mut N, active_context: &Context<N::Iri, N::BlankId>, loader: &L, base_url: Option<N::Iri>, options: Options, ) -> ProcessingResult<'_, N::Iri, N::BlankId, L::Error>
where N: VocabularyMut, N::Iri: Clone + Eq + Hash, N::BlankId: Clone + PartialEq, L: Loader,

Processes this context as Process::process_full does, printing any warning to standard error.

Source

async fn process<N, L>( &self, vocabulary: &mut N, loader: &L, base_url: Option<N::Iri>, ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
where N: VocabularyMut, N::Iri: Clone + Eq + Hash, N::BlankId: Clone + PartialEq, L: Loader,

Processes this context on top of a fresh, empty active context, with the default Options, printing any warning to standard error.

This is the entry point for the @context of a document, as opposed to a scoped context layered on top of an existing one.

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 Process for Context

Source§

async fn process_full<N, L, W>( &self, vocabulary: &mut N, active_context: &Context<N::Iri, N::BlankId>, loader: &L, base_url: Option<N::Iri>, options: Options, warnings: W, ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
where N: VocabularyMut, N::Iri: Clone + Eq + Hash, N::BlankId: Clone + PartialEq, L: Loader, W: WarningHandler<N>,

Source§

async fn process_full_with_cache<N, L, W>( &self, vocabulary: &mut N, active_context: &Context<N::Iri, N::BlankId>, loader: &L, base_url: Option<N::Iri>, options: Options, warnings: W, cache: &ProcessingCache<N::Iri, N::BlankId>, ) -> Result<Processed<'_, N::Iri, N::BlankId>, Error<L::Error>>
where N: VocabularyMut, N::Iri: Clone + Eq + Hash, N::BlankId: Clone + Eq + Hash, L: Loader, W: WarningHandler<N>,

Implementors§