pub struct DownloadCheckpoint {
pub url: String,
pub destination: PathBuf,
pub total_bytes: Option<u64>,
pub downloaded_bytes: u64,
pub partial_checksum: Option<String>,
pub last_update: u64,
}Expand description
Checkpoint data for resumable downloads.
Fields§
§url: StringURL being downloaded
destination: PathBufDestination path
total_bytes: Option<u64>Total bytes expected (from Content-Length)
downloaded_bytes: u64Bytes already downloaded
partial_checksum: Option<String>Checksum of downloaded data (if available)
last_update: u64Timestamp of last progress
Implementations§
Source§impl DownloadCheckpoint
impl DownloadCheckpoint
Sourcepub fn new(url: String, destination: PathBuf, total_bytes: Option<u64>) -> Self
pub fn new(url: String, destination: PathBuf, total_bytes: Option<u64>) -> Self
Create a new checkpoint.
Sourcepub fn update_progress(&mut self, downloaded_bytes: u64)
pub fn update_progress(&mut self, downloaded_bytes: u64)
Update checkpoint with new progress.
Sourcepub fn can_resume(&self) -> bool
pub fn can_resume(&self) -> bool
Check if download can be resumed.
Sourcepub fn range_header(&self) -> String
pub fn range_header(&self) -> String
Get the Range header value for resuming.
Trait Implementations§
Source§impl Clone for DownloadCheckpoint
impl Clone for DownloadCheckpoint
Source§fn clone(&self) -> DownloadCheckpoint
fn clone(&self) -> DownloadCheckpoint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DownloadCheckpoint
impl Debug for DownloadCheckpoint
Source§impl<'de> Deserialize<'de> for DownloadCheckpoint
impl<'de> Deserialize<'de> for DownloadCheckpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DownloadCheckpoint
impl RefUnwindSafe for DownloadCheckpoint
impl Send for DownloadCheckpoint
impl Sync for DownloadCheckpoint
impl Unpin for DownloadCheckpoint
impl UnsafeUnpin for DownloadCheckpoint
impl UnwindSafe for DownloadCheckpoint
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