pub struct DownloadOperation(/* private fields */);Expand description
An in-progress or finished download.
Implementations§
Source§impl DownloadOperation
impl DownloadOperation
Sourcepub fn content_disposition(&self) -> String
pub fn content_disposition(&self) -> String
Returns the Content-Disposition header value from the download’s HTTP
response, if any.
Sourcepub fn total_bytes_to_receive(&self) -> i64
pub fn total_bytes_to_receive(&self) -> i64
Returns the expected total size of the download in bytes, or 0 if it is
unknown.
Sourcepub fn bytes_received(&self) -> i64
pub fn bytes_received(&self) -> i64
Returns the number of bytes received so far.
Sourcepub fn result_file_path(&self) -> String
pub fn result_file_path(&self) -> String
Returns the absolute path the download is being written to.
Sourcepub fn state(&self) -> DownloadState
pub fn state(&self) -> DownloadState
Returns the current DownloadState.
Sourcepub fn interrupt_reason(&self) -> DownloadInterruptReason
pub fn interrupt_reason(&self) -> DownloadInterruptReason
Returns why the download was interrupted, or
DownloadInterruptReason::None if it has not been interrupted.
Sourcepub fn can_resume(&self) -> bool
pub fn can_resume(&self) -> bool
Returns true if an interrupted download can
be resumed.
Sourcepub fn cancel(&self) -> Result<()>
pub fn cancel(&self) -> Result<()>
Cancels the download. The file is deleted if it was not yet complete.
Sourcepub fn pause(&self) -> Result<()>
pub fn pause(&self) -> Result<()>
Pauses the download. It stays in progress until resumed or canceled.
Sourcepub fn resume(&self) -> Result<()>
pub fn resume(&self) -> Result<()>
Resumes a paused or interrupted download.
Sourcepub fn on_bytes_received_changed<F: FnMut(DownloadOperation) + 'static>(
&self,
handler: F,
) -> Result<EventRegistration>
pub fn on_bytes_received_changed<F: FnMut(DownloadOperation) + 'static>( &self, handler: F, ) -> Result<EventRegistration>
Subscribes to the bytes-received-changed event, raised as the
download makes progress. The handler receives this operation so it
can read the updated bytes_received.
Sourcepub fn on_state_changed<F: FnMut(DownloadOperation) + 'static>(
&self,
handler: F,
) -> Result<EventRegistration>
pub fn on_state_changed<F: FnMut(DownloadOperation) + 'static>( &self, handler: F, ) -> Result<EventRegistration>
Subscribes to the state-changed event, raised when the download’s
state changes (for example to completed or
interrupted). The handler receives this operation.
Trait Implementations§
Source§impl Clone for DownloadOperation
impl Clone for DownloadOperation
Source§fn clone(&self) -> DownloadOperation
fn clone(&self) -> DownloadOperation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more