pub struct EraClient<Http> { /* private fields */ }
Expand description
An HTTP client with features for downloading ERA files from an external HTTP accessible endpoint.
Implementations§
Source§impl<Http: HttpClient + Clone> EraClient<Http>
impl<Http: HttpClient + Clone> EraClient<Http>
Sourcepub const fn new(client: Http, url: Url, folder: Box<Path>) -> Self
pub const fn new(client: Http, url: Url, folder: Box<Path>) -> Self
Constructs EraClient
using client
to download from url
into folder
.
Sourcepub async fn download_to_file(&mut self, url: impl IntoUrl) -> Result<Box<Path>>
pub async fn download_to_file(&mut self, url: impl IntoUrl) -> Result<Box<Path>>
Performs a GET request on url
and stores the response body into a file located within
the folder
.
Sourcepub async fn recover_index(&self) -> u64
pub async fn recover_index(&self) -> u64
Recovers index of file following the latest downloaded file from a different run.
Sourcepub async fn url(&self, number: u64) -> Result<Option<Url>>
pub async fn url(&self, number: u64) -> Result<Option<Url>>
Returns a download URL for the file corresponding to number
.
Sourcepub async fn files_count(&self) -> usize
pub async fn files_count(&self) -> usize
Returns the number of files in the folder
.
Sourcepub async fn fetch_file_list(&self) -> Result<()>
pub async fn fetch_file_list(&self) -> Result<()>
Fetches the list of ERA1 files from url
and stores it in a file located within folder
.
Trait Implementations§
Auto Trait Implementations§
impl<Http> Freeze for EraClient<Http>where
Http: Freeze,
impl<Http> RefUnwindSafe for EraClient<Http>where
Http: RefUnwindSafe,
impl<Http> Send for EraClient<Http>where
Http: Send,
impl<Http> Sync for EraClient<Http>where
Http: Sync,
impl<Http> Unpin for EraClient<Http>where
Http: Unpin,
impl<Http> UnwindSafe for EraClient<Http>where
Http: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.