pub struct HttpCachedClient { /* private fields */ }Expand description
The client to download and cache rust releases.
If a cached file is not present, or if a cached file is present, but the copy is outdated,
the client will download a new copy of the given resource and store it to the cache_folder.
If a cached file is present, and the copy is not outdated, the cached file will be returned
instead.
Implementations§
Source§impl HttpCachedClient
impl HttpCachedClient
Sourcepub fn new(cache_folder: PathBuf, cache_timeout: Duration) -> Self
pub fn new(cache_folder: PathBuf, cache_timeout: Duration) -> Self
Create a new HttpCachedClient.
use std::time::Duration;
use rust_releases_io::{base_cache_dir, HttpCachedClient};
let cache_folder = base_cache_dir().unwrap();
let timeout = Duration::from_secs(86_400);
let _client = HttpCachedClient::new(cache_folder, timeout);Trait Implementations§
Source§impl Debug for HttpCachedClient
impl Debug for HttpCachedClient
Source§impl RustReleasesClient for HttpCachedClient
impl RustReleasesClient for HttpCachedClient
Source§type Error = HttpCachedClientError
type Error = HttpCachedClientError
The type of error returned by the client implementation.
Source§fn fetch(
&self,
resource: ResourceFile<'_, '_>,
) -> Result<RetrievedDocument, Self::Error>
fn fetch( &self, resource: ResourceFile<'_, '_>, ) -> Result<RetrievedDocument, Self::Error>
Fetch the document described by the
resource file.Auto Trait Implementations§
impl Freeze for HttpCachedClient
impl RefUnwindSafe for HttpCachedClient
impl Send for HttpCachedClient
impl Sync for HttpCachedClient
impl Unpin for HttpCachedClient
impl UnsafeUnpin for HttpCachedClient
impl UnwindSafe for HttpCachedClient
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