Trait json_ld::Loader

source ·
pub trait Loader<I, M> {
    type Output;
    type Error;

    fn load_with<'a>(
        &'a mut self,
        vocabulary: &'a mut impl Sync + Send + IriVocabularyMut<Iri = I>,
        url: I
    ) -> Pin<Box<dyn Future<Output = Result<RemoteDocument<I, M, Self::Output>, Self::Error>> + Send + 'a, Global>>
    where
        I: 'a
; fn load<'a>(
        &'a mut self,
        url: I
    ) -> Pin<Box<dyn Future<Output = Result<RemoteDocument<I, M, Self::Output>, Self::Error>> + Send + 'a, Global>>
    where
        I: 'a,
        (): IriVocabulary<Iri = I>
, { ... } }
Expand description

Document loader.

A document loader is required by most processing functions to fetch remote documents identified by an IRI.

This library provides a few default loader implementations:

  • NoLoader dummy loader that always fail. Perfect if you are certain that the processing will not require any loading.
  • FsLoader that redirect registered IRI prefixes to a local directory on the file system. This way no network calls are performed and the loaded content can be trusted.
  • ReqwestLoader that actually download the remote documents using the reqwest library. This requires the reqwest feature to be enabled.

Required Associated Types§

The type of documents that can be loaded.

Error type.

Required Methods§

Loads the document behind the given IRI, using the given vocabulary.

Provided Methods§

Loads the document behind the given IRI.

Implementors§