pub struct DataRate(/* private fields */);Expand description
A data rate quantity, stored internally in bits per second (bps).
§Construction
let rate = DataRate::from_mbps(100.0);Implementations§
Source§impl DataRate
impl DataRate
Sourcepub const fn from_bytes_ps(val: f64) -> Self
pub const fn from_bytes_ps(val: f64) -> Self
Create from bytes per second. 1 B/s = 8 bps.
Sourcepub const fn from_kbytes_ps(val: f64) -> Self
pub const fn from_kbytes_ps(val: f64) -> Self
Create from kilobytes per second. 1 KB/s = 8e3 bps.
Sourcepub const fn from_mbytes_ps(val: f64) -> Self
pub const fn from_mbytes_ps(val: f64) -> Self
Create from megabytes per second. 1 MB/s = 8e6 bps.
Sourcepub const fn from_gbytes_ps(val: f64) -> Self
pub const fn from_gbytes_ps(val: f64) -> Self
Create from gigabytes per second. 1 GB/s = 8e9 bps.
Sourcepub const fn in_bytes_ps(self) -> f64
pub const fn in_bytes_ps(self) -> f64
Get value in bytes per second.
Sourcepub const fn in_kbytes_ps(self) -> f64
pub const fn in_kbytes_ps(self) -> f64
Get value in kilobytes per second.
Sourcepub const fn in_mbytes_ps(self) -> f64
pub const fn in_mbytes_ps(self) -> f64
Get value in megabytes per second.
Sourcepub const fn in_gbytes_ps(self) -> f64
pub const fn in_gbytes_ps(self) -> f64
Get value in gigabytes per second.
Sourcepub fn in_unit(self, unit: DataRateUnit) -> f64
pub fn in_unit(self, unit: DataRateUnit) -> f64
Get value in the specified DataRateUnit.
Sourcepub fn display_as(self, unit: DataRateUnit) -> DisplayWithUnit
pub fn display_as(self, unit: DataRateUnit) -> DisplayWithUnit
Return a display wrapper that formats this data rate in the given unit.
Trait Implementations§
Source§impl AddAssign for DataRate
impl AddAssign for DataRate
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl DivAssign<f64> for DataRate
impl DivAssign<f64> for DataRate
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
Performs the
/= operation. Read moreSource§impl MulAssign<f64> for DataRate
impl MulAssign<f64> for DataRate
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*= operation. Read moreSource§impl PartialOrd for DataRate
impl PartialOrd for DataRate
Source§impl SubAssign for DataRate
impl SubAssign for DataRate
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for DataRate
impl StructuralPartialEq for DataRate
Auto Trait Implementations§
impl Freeze for DataRate
impl RefUnwindSafe for DataRate
impl Send for DataRate
impl Sync for DataRate
impl Unpin for DataRate
impl UnsafeUnpin for DataRate
impl UnwindSafe for DataRate
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