pub struct SchemaCache<C: HttpClient = UreqClient> { /* private fields */ }Expand description
A disk-backed cache for JSON Schema files.
Schemas are fetched via HTTP and stored as <cache_dir>/<hash>.json
where <hash> is a hex-encoded hash of the URI. When a schema is
requested, the cache is checked first; on a miss the schema is fetched
and written to disk for future use.
Implementations§
Source§impl<C: HttpClient> SchemaCache<C>
impl<C: HttpClient> SchemaCache<C>
Trait Implementations§
Source§impl<C: HttpClient> AsyncRetrieve for SchemaCache<C>
impl<C: HttpClient> AsyncRetrieve for SchemaCache<C>
Source§fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
uri: &'life1 Uri<String>,
) -> Pin<Box<dyn Future<Output = Result<Value, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
uri: &'life1 Uri<String>,
) -> Pin<Box<dyn Future<Output = Result<Value, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Asynchronously retrieve a resource from the given URI. Read more
Source§impl<C: Clone + HttpClient> Clone for SchemaCache<C>
impl<C: Clone + HttpClient> Clone for SchemaCache<C>
Source§fn clone(&self) -> SchemaCache<C>
fn clone(&self) -> SchemaCache<C>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<C> Freeze for SchemaCache<C>where
C: Freeze,
impl<C> RefUnwindSafe for SchemaCache<C>where
C: RefUnwindSafe,
impl<C> Send for SchemaCache<C>
impl<C> Sync for SchemaCache<C>
impl<C> Unpin for SchemaCache<C>where
C: Unpin,
impl<C> UnsafeUnpin for SchemaCache<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for SchemaCache<C>where
C: 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