pub struct DiskCache { /* private fields */ }Implementations§
Source§impl DiskCache
impl DiskCache
pub fn new() -> Result<Self>
pub async fn get_json<T>(
&self,
client: &ClientWithMiddleware,
url: &str,
) -> Result<T>where
T: DeserializeOwned,
Sourcepub async fn get_zstd_json<T>(
&self,
client: &ClientWithMiddleware,
url: &str,
) -> Result<T>where
T: DeserializeOwned,
pub async fn get_zstd_json<T>(
&self,
client: &ClientWithMiddleware,
url: &str,
) -> Result<T>where
T: DeserializeOwned,
Download a zstd-compressed JSON file and return the deserialized value.
docs.rs serves rustdoc JSON as Content-Type: application/zstd bodies.
The decompressed JSON text is cached so repeat calls skip the download.
pub async fn get_text( &self, client: &ClientWithMiddleware, url: &str, ) -> Result<String>
Sourcepub async fn head_check(
&self,
client: &ClientWithMiddleware,
url: &str,
) -> Result<bool>
pub async fn head_check( &self, client: &ClientWithMiddleware, url: &str, ) -> Result<bool>
Returns true if URL returns success (200), false for 404, error for other failures.
Auto Trait Implementations§
impl Freeze for DiskCache
impl RefUnwindSafe for DiskCache
impl Send for DiskCache
impl Sync for DiskCache
impl Unpin for DiskCache
impl UnsafeUnpin for DiskCache
impl UnwindSafe for DiskCache
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