pub struct HttpBackend { /* private fields */ }Expand description
Segmented, resumable HTTP/HTTPS download backend.
Implementations§
Source§impl HttpBackend
impl HttpBackend
Sourcepub fn new(config: &Config) -> Result<Self>
pub fn new(config: &Config) -> Result<Self>
Build a backend using the connection limits and user agent from
config.
Sourcepub async fn download_file(
&self,
request: &DownloadRequest,
file: &ResourceFile,
task_resume: &mut TaskResume,
) -> Result<FileOutcome>
pub async fn download_file( &self, request: &DownloadRequest, file: &ResourceFile, task_resume: &mut TaskResume, ) -> Result<FileOutcome>
Download one resource file, sharing the caller’s task resume. This is public so protocol-specific backends (Hub) can reuse the segmented, resumable HTTP transfer without duplicating it.
Trait Implementations§
Source§impl Clone for HttpBackend
impl Clone for HttpBackend
Source§impl DownloadBackend for HttpBackend
impl DownloadBackend for HttpBackend
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Short, stable identifier such as
http; it is recorded on the task for
diagnostics.Source§fn capabilities(&self) -> BackendCapabilities
fn capabilities(&self) -> BackendCapabilities
Describes the transfer features this backend provides.
Source§fn supports(&self, resource: &Resource) -> bool
fn supports(&self, resource: &Resource) -> bool
Returns
true when this backend can download resource. The check
must be cheap and free of side effects.Source§fn download<'life0, 'async_trait>(
&'life0 self,
request: DownloadRequest,
) -> Pin<Box<dyn Future<Output = Result<DownloadOutcome>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn download<'life0, 'async_trait>(
&'life0 self,
request: DownloadRequest,
) -> Pin<Box<dyn Future<Output = Result<DownloadOutcome>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Performs the transfer. Returns
Completed with one FileOutcome per
written file, or Paused when progress was checkpointed and the task
should stay paused.Auto Trait Implementations§
impl !RefUnwindSafe for HttpBackend
impl !UnwindSafe for HttpBackend
impl Forget for HttpBackend
impl Freeze for HttpBackend
impl Move for HttpBackend
impl Send for HttpBackend
impl Sync for HttpBackend
impl Unpin for HttpBackend
impl UnsafeUnpin for HttpBackend
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