pub trait AsyncJsonLdLoader {
// Required method
async fn async_load(
&self,
url: &Iri,
) -> Result<JsonLdDocument, JsonLdLoadError>;
}Expand description
Async Document loader.
A document loader is required by most processing functions to fetch remote
documents identified by an IRI. In particular, the loader is in charge of
fetching all the remote contexts imported in a @context entry.
This library provides a few default loader implementations:
NoJsonLdLoaderdummy loader that always fail. Perfect if you are certain that the processing will not require any loading.- Standard
HashMapandBTreeMapmapping IRIs to pre-loaded documents. This way no network calls are performed and the loaded content can be trusted. JsonLdFsLoaderthat redirecting registered IRI prefixes to a local directory on the file system. This also avoids network calls. The loaded content can be trusted as long as the file system is trusted.JsonLdReqwestLoaderactually downloading the remote documents using thereqwestlibrary. This requires thereqwestfeature to be enabled.
Required Methods§
Sourceasync fn async_load(&self, url: &Iri) -> Result<JsonLdDocument, JsonLdLoadError>
async fn async_load(&self, url: &Iri) -> Result<JsonLdDocument, JsonLdLoadError>
Loads the document behind the given IRI.
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 AsyncJsonLdLoader for BTreeMap<IriBuf, JsonLdDocument>
impl AsyncJsonLdLoader for BTreeMap<IriBuf, JsonLdDocument>
async fn async_load(&self, url: &Iri) -> Result<JsonLdDocument, JsonLdLoadError>
Source§impl AsyncJsonLdLoader for HashMap<IriBuf, JsonLdDocument>
impl AsyncJsonLdLoader for HashMap<IriBuf, JsonLdDocument>
async fn async_load(&self, url: &Iri) -> Result<JsonLdDocument, JsonLdLoadError>
Source§impl<L: AsyncJsonLdLoader, F: FnOnce() -> L> AsyncJsonLdLoader for LazyLock<L, F>
Lazily initialized loader, e.g. a static map of pre-loaded documents.
impl<L: AsyncJsonLdLoader, F: FnOnce() -> L> AsyncJsonLdLoader for LazyLock<L, F>
Lazily initialized loader, e.g. a static map of pre-loaded documents.