Struct json_ld::ChainLoader 
source · pub struct ChainLoader<L1, L2>(/* private fields */);Expand description
- ChainLoader: loads document from the first loader, otherwise falls back to the second one.
This can be useful for combining, for example,
an FsLoader for loading some contexts from a local cache,
and a ReqwestLoader for loading any other context from the web.
Note that it is also possible to nest several ChainLoaders,
to combine more than two loaders.
Implementations§
source§impl<L1, L2> ChainLoader<L1, L2>
 
impl<L1, L2> ChainLoader<L1, L2>
sourcepub fn new(l1: L1, l2: L2) -> ChainLoader<L1, L2>
 
pub fn new(l1: L1, l2: L2) -> ChainLoader<L1, L2>
Build a new chain loader
Trait Implementations§
source§impl<L1, L2> Loader for ChainLoader<L1, L2>
 
impl<L1, L2> Loader for ChainLoader<L1, L2>
source§async fn load(&self, url: &Iri) -> Result<RemoteDocument, LoadError>
 
async fn load(&self, url: &Iri) -> Result<RemoteDocument, LoadError>
Loads the document behind the given IRI.
source§async fn load_with<V>(
    &self,
    vocabulary: &mut V,
    url: <V as IriVocabulary>::Iri,
) -> Result<RemoteDocument<<V as IriVocabulary>::Iri>, LoadError>
 
async fn load_with<V>( &self, vocabulary: &mut V, url: <V as IriVocabulary>::Iri, ) -> Result<RemoteDocument<<V as IriVocabulary>::Iri>, LoadError>
Loads the document behind the given IRI, using the given vocabulary.
Auto Trait Implementations§
impl<L1, L2> Freeze for ChainLoader<L1, L2>
impl<L1, L2> RefUnwindSafe for ChainLoader<L1, L2>where
    L1: RefUnwindSafe,
    L2: RefUnwindSafe,
impl<L1, L2> Send for ChainLoader<L1, L2>
impl<L1, L2> Sync for ChainLoader<L1, L2>
impl<L1, L2> Unpin for ChainLoader<L1, L2>
impl<L1, L2> UnwindSafe for ChainLoader<L1, L2>where
    L1: UnwindSafe,
    L2: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more