pub struct DownloadProgress {
pub total_bytes: Option<u64>,
pub downloaded_bytes: u64,
pub speed_bps: u64,
pub eta_seconds: Option<u64>,
pub filename: String,
}Expand description
Information about download progress.
Fields§
§total_bytes: Option<u64>Total bytes to download (if known).
downloaded_bytes: u64Bytes downloaded so far.
speed_bps: u64Current download speed in bytes per second.
eta_seconds: Option<u64>Estimated time remaining in seconds.
filename: StringName of the file being downloaded.
Implementations§
Source§impl DownloadProgress
impl DownloadProgress
Sourcepub fn new(filename: impl Into<String>, total_bytes: Option<u64>) -> Self
pub fn new(filename: impl Into<String>, total_bytes: Option<u64>) -> Self
Create a new progress tracker.
Sourcepub fn speed_string(&self) -> String
pub fn speed_string(&self) -> String
Format the download speed as a human-readable string.
Sourcepub fn size_string(&self) -> String
pub fn size_string(&self) -> String
Format the downloaded/total as a human-readable string.
Trait Implementations§
Source§impl Clone for DownloadProgress
impl Clone for DownloadProgress
Source§fn clone(&self) -> DownloadProgress
fn clone(&self) -> DownloadProgress
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DownloadProgress
impl RefUnwindSafe for DownloadProgress
impl Send for DownloadProgress
impl Sync for DownloadProgress
impl Unpin for DownloadProgress
impl UnsafeUnpin for DownloadProgress
impl UnwindSafe for DownloadProgress
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