Struct s2n_quic_core::recovery::bandwidth::Bandwidth
source · pub struct Bandwidth { /* private fields */ }
Expand description
Represents a rate at which data is transferred
While bandwidth is typically thought of as an amount of data over a fixed
amount of time (bytes per second, for example), in this case we internally
represent bandwidth as the inverse: an amount of time to send a fixed amount
of data (nanoseconds per kibibyte or 1024 bytes, in this case). This allows for
some of the math operations needed on Bandwidth
to avoid division, while
reducing the likelihood of panicking due to overflow.
The maximum (non-infinite) value that can be represented is ~1 TB/second.
Implementations§
Trait Implementations§
source§impl Div<Bandwidth> for u64
impl Div<Bandwidth> for u64
Divides a count of bytes represented as a u64 by the given Bandwidth
Since Bandwidth
is a rate of bytes over a time period, this division
results in a Duration
being returned, representing how long a path
with the given Bandwidth
would take to transmit the given number of
bytes.
source§impl Ord for Bandwidth
impl Ord for Bandwidth
source§impl PartialEq for Bandwidth
impl PartialEq for Bandwidth
source§impl PartialOrd for Bandwidth
impl PartialOrd for Bandwidth
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more