pub struct HttpClient { /* private fields */ }Expand description
A client to download rust releases data.
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 HttpClient
impl HttpClient
Sourcepub fn new(timeout: Duration) -> Self
pub fn new(timeout: Duration) -> Self
Create a new HttpClient.
use std::time::Duration;
use rust_releases_io::HttpClient;
let timeout = Duration::from_secs(86_400);
let _client = HttpClient::new(timeout);Trait Implementations§
Source§impl Debug for HttpClient
impl Debug for HttpClient
Source§impl Default for HttpClient
impl Default for HttpClient
Source§fn default() -> Self
fn default() -> Self
Create a new HttpClient.
use rust_releases_io::HttpClient;
let _client = HttpClient::default();Source§impl RustReleasesClient for HttpClient
impl RustReleasesClient for HttpClient
Source§type Error = ClientError
type Error = ClientError
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 HttpClient
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin for HttpClient
impl !UnwindSafe for HttpClient
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