pub trait ByteRateExt: Sized + Copy {
const ZERO: Self;
// Required methods
fn from_bytes_per_sec(rate: i64) -> Self;
fn from_bytes_per_sec_f64(rate: f64) -> Self;
fn bytes_per_sec_f64(self) -> f64;
fn bytes_per_sec_i64(self) -> i64;
fn time_to_transfer(self, size: ByteSize) -> Time;
}Expand description
Byte throughputs: construction from raw integers, and extraction back to them.
Required Associated Constants§
Required Methods§
Sourcefn from_bytes_per_sec(rate: i64) -> Self
fn from_bytes_per_sec(rate: i64) -> Self
A raw bytes-per-second rate, as Kafka’s quota configs express it.
Sourcefn from_bytes_per_sec_f64(rate: f64) -> Self
fn from_bytes_per_sec_f64(rate: f64) -> Self
A fractional bytes-per-second rate, as a measurement produces it.
Sourcefn bytes_per_sec_f64(self) -> f64
fn bytes_per_sec_f64(self) -> f64
The rate in bytes per second.
Sourcefn bytes_per_sec_i64(self) -> i64
fn bytes_per_sec_i64(self) -> i64
The rate as Kafka’s int64 quota fields.
Sourcefn time_to_transfer(self, size: ByteSize) -> Time
fn time_to_transfer(self, size: ByteSize) -> Time
How long transferring size takes at this rate.
A zero or negative rate gives TimeExt::ZERO and not an infinity,
because every caller reads an unset quota as “unlimited”.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".