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 ChainLoader
s,
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