pub struct DownloadSpeed { /* private fields */ }Expand description
Download speed in bytes per second (fixed-point representation)
Internally stores bytes_per_second * SCALE for precision.
表示下载速度(单位:字节每秒,定点数表示)
内部存储 bytes_per_second * SCALE 以保持精度。
Implementations§
Source§impl DownloadSpeed
impl DownloadSpeed
Sourcepub fn new(bytes: u64, duration: Duration) -> Self
pub fn new(bytes: u64, duration: Duration) -> Self
Create a new download speed from bytes downloaded and time taken
Uses pure integer arithmetic with nanosecond precision.
§Parameters
bytes: Number of bytes downloaded (can be zero)duration: Time taken for the download
从下载的字节数和所用时间创建一个新的下载速度实例
使用纯整数运算,保持纳秒级精度。
§参数
bytes: 下载的字节数(可以为零)duration: 下载所用的时间
Sourcepub fn as_scaled(&self) -> u128
pub fn as_scaled(&self) -> u128
Get the internal scaled value (for advanced usage)
获取内部缩放值(高级用途)
Trait Implementations§
Source§impl Clone for DownloadSpeed
impl Clone for DownloadSpeed
Source§fn clone(&self) -> DownloadSpeed
fn clone(&self) -> DownloadSpeed
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 DownloadSpeed
impl Debug for DownloadSpeed
Source§impl FileSizeFormat for DownloadSpeed
impl FileSizeFormat for DownloadSpeed
Source§fn get_si_parts(&self) -> (String, &'static str)
fn get_si_parts(&self) -> (String, &'static str)
Returns the formatted value and unit in SI (base-1000) standard
返回 SI (base-1000) 标准的 (formatted_value, unit)
Source§fn get_iec_parts(&self) -> (String, &'static str)
fn get_iec_parts(&self) -> (String, &'static str)
Returns the formatted value and unit in IEC (base-1024) standard
返回 IEC (base-1024) 标准的 (formatted_value, unit)
Source§fn to_si_string(&self) -> String
fn to_si_string(&self) -> String
Returns a formatted string in SI (base-1000) standard Read more
Source§fn to_iec_string(&self) -> String
fn to_iec_string(&self) -> String
Returns a formatted string in IEC (base-1024) standard Read more
fn to_formatted(self, standard: SizeStandard) -> FormattedValue<Self>
Source§impl Ord for DownloadSpeed
impl Ord for DownloadSpeed
Source§fn cmp(&self, other: &DownloadSpeed) -> Ordering
fn cmp(&self, other: &DownloadSpeed) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DownloadSpeed
impl PartialEq for DownloadSpeed
Source§impl PartialOrd for DownloadSpeed
impl PartialOrd for DownloadSpeed
impl Copy for DownloadSpeed
impl Eq for DownloadSpeed
impl StructuralPartialEq for DownloadSpeed
Auto Trait Implementations§
impl Freeze for DownloadSpeed
impl RefUnwindSafe for DownloadSpeed
impl Send for DownloadSpeed
impl Sync for DownloadSpeed
impl Unpin for DownloadSpeed
impl UnwindSafe for DownloadSpeed
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