Struct async_fetcher::AsyncFetcher
source · pub struct AsyncFetcher<'a> { /* private fields */ }
Expand description
A future builder for creating futures to fetch files from an asynchronous reqwest client.
Implementations
sourceimpl<'a> AsyncFetcher<'a>
impl<'a> AsyncFetcher<'a>
sourcepub fn new(client: &'a Client, from_url: String) -> Self
pub fn new(client: &'a Client, from_url: String) -> Self
Initialze a new featuer to fetch from the given URL.
Stores the complete file to to_path
when done.
sourcepub fn with_progress_callback<F: Fn(FetchEvent) + Send + Sync + 'static>(
self,
func: impl Into<Arc<F>>
) -> Self
pub fn with_progress_callback<F: Fn(FetchEvent) + Send + Sync + 'static>(
self,
func: impl Into<Arc<F>>
) -> Self
Enable progress callback handling.
sourcepub fn request_to_path(
self,
to_path: PathBuf
) -> ResponseState<impl RequestFuture>
pub fn request_to_path(
self,
to_path: PathBuf
) -> ResponseState<impl RequestFuture>
Submit the GET request for the file, if the modified time is too old.
Returns a ResponseState
, which can either be manually handled by the caller, or used
to commit the download with this API.
sourcepub fn request_to_path_with_checksum<D: Digest>(
self,
to_path: PathBuf,
checksum: &str
) -> ResponseState<impl RequestFuture>
pub fn request_to_path_with_checksum<D: Digest>(
self,
to_path: PathBuf,
checksum: &str
) -> ResponseState<impl RequestFuture>
Submit the GET request for the file, if checksums are a mismatch.
Returns a ResponseState
, which can either be manually handled by the caller, or used
to commit the download with this API.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for AsyncFetcher<'a>
impl<'a> Send for AsyncFetcher<'a>
impl<'a> Sync for AsyncFetcher<'a>
impl<'a> Unpin for AsyncFetcher<'a>
impl<'a> !UnwindSafe for AsyncFetcher<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more