pub struct DownloadState {
pub status: DownloadStatus,
pub current_file: Option<&'static str>,
pub bytes_downloaded: usize,
pub total_bytes: Option<usize>,
pub error_message: Option<&'static str>,
pub mirror_index: usize,
pub retry_count: usize,
}Expand description
Download state tracking
Fields§
§status: DownloadStatusCurrent status
current_file: Option<&'static str>Current file being downloaded
bytes_downloaded: usizeBytes downloaded so far
total_bytes: Option<usize>Total bytes expected (if known)
error_message: Option<&'static str>Error message if failed
mirror_index: usizeCurrent mirror index being used
retry_count: usizeNumber of retry attempts
Implementations§
Source§impl DownloadState
impl DownloadState
Sourcepub fn start_check(&mut self, filename: &'static str)
pub fn start_check(&mut self, filename: &'static str)
Start checking a file
Sourcepub fn start_download(&mut self, total: Option<usize>)
pub fn start_download(&mut self, total: Option<usize>)
Start downloading after check
Sourcepub fn update_progress(&mut self, bytes: usize)
pub fn update_progress(&mut self, bytes: usize)
Update download progress
Sourcepub fn try_next_mirror(&mut self, max_mirrors: usize) -> bool
pub fn try_next_mirror(&mut self, max_mirrors: usize) -> bool
Try next mirror
Sourcepub fn progress_percent(&self) -> usize
pub fn progress_percent(&self) -> usize
Get progress percentage (0-100)
Sourcepub fn bytes_remaining(&self) -> Option<usize>
pub fn bytes_remaining(&self) -> Option<usize>
Get bytes remaining
Sourcepub fn progress_string(&self) -> (&'static str, &'static str)
pub fn progress_string(&self) -> (&'static str, &'static str)
Format progress as string (e.g., “150 MB / 500 MB”)
Sourcefn size_bucket(bytes: usize) -> &'static str
fn size_bucket(bytes: usize) -> &'static str
Bucket size into human readable string
Trait Implementations§
Source§impl Clone for DownloadState
impl Clone for DownloadState
Source§fn clone(&self) -> DownloadState
fn clone(&self) -> DownloadState
Returns a copy 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 DownloadState
impl Debug for DownloadState
Auto Trait Implementations§
impl Freeze for DownloadState
impl RefUnwindSafe for DownloadState
impl Send for DownloadState
impl Sync for DownloadState
impl Unpin for DownloadState
impl UnwindSafe for DownloadState
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