Skip to main content

PlatformDownloader

Trait PlatformDownloader 

Source
pub trait PlatformDownloader: Send + Sync {
    // Required methods
    fn download<'a>(
        &'a self,
        url: &'a str,
        target: &'a Path,
        control: HttpControl,
    ) -> HttpFuture<'a, u64>;
    fn downloaded_length(&self, target: &Path) -> Option<u64>;
}
Expand description

A platform’s own transfer for HttpClient::download_to, one that goes on while the application is suspended or closed.

It keeps the contract of download_to: the file at target grows from its current length, a cancelled transfer keeps what arrived for the next call, and the result is the file’s whole length. A transfer that finished while the application was closed is in target when the application starts again, so a call that finds the whole file returns at once.

Required Methods§

Source

fn download<'a>( &'a self, url: &'a str, target: &'a Path, control: HttpControl, ) -> HttpFuture<'a, u64>

Source

fn downloaded_length(&self, target: &Path) -> Option<u64>

The bytes of target this downloader keeps apart from the file, as a paused transfer’s, added to the file’s own; None when it keeps none.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§