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

    // Required method
    fn load_with<'a>(
        &'a mut self,
        vocabulary: &'a mut (impl Sync + Send + IriVocabularyMut<Iri = I>),
        url: I
    ) -> BoxFuture<'a, LoadingResult<I, M, Self::Output, Self::Error>>
       where I: 'a;

    // Provided method
    fn load<'a>(
        &'a mut self,
        url: I
    ) -> BoxFuture<'a, LoadingResult<I, M, Self::Output, Self::Error>>
       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§

source

type Output

The type of documents that can be loaded.

source

type Error

Error type.

Required Methods§

source

fn load_with<'a>( &'a mut self, vocabulary: &'a mut (impl Sync + Send + IriVocabularyMut<Iri = I>), url: I ) -> BoxFuture<'a, LoadingResult<I, M, Self::Output, Self::Error>>
where I: 'a,

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

Provided Methods§

source

fn load<'a>( &'a mut self, url: I ) -> BoxFuture<'a, LoadingResult<I, M, Self::Output, Self::Error>>
where I: 'a, (): IriVocabulary<Iri = I>,

Loads the document behind the given IRI.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<I: Send, T, M> Loader<I, M> for NoLoader<I, M, T>

§

type Output = T

§

type Error = CannotLoad<I>

source§

impl<I: Send, T: Send, M: Send, E> Loader<I, M> for FsLoader<I, M, T, E>

§

type Output = T

§

type Error = Error<E>