pub trait FrequencyExt: Sized + Copy {
const ZERO: Self;
// Required methods
fn from_per_sec(rate: f64) -> Self;
fn from_per_sec_u64(rate: u64) -> Self;
fn per_sec_f64(self) -> f64;
fn per_sec_u64(self) -> u64;
fn period(self) -> Time;
}Expand description
Event rates: construction from raw numbers, and extraction back to them.
Required Associated Constants§
Required Methods§
Sourcefn from_per_sec(rate: f64) -> Self
fn from_per_sec(rate: f64) -> Self
A raw events-per-second rate.
Sourcefn from_per_sec_u64(rate: u64) -> Self
fn from_per_sec_u64(rate: u64) -> Self
A whole-events-per-second rate, as a counter-based limiter configures one.
Sourcefn per_sec_f64(self) -> f64
fn per_sec_f64(self) -> f64
The rate in events per second.
Sourcefn per_sec_u64(self) -> u64
fn per_sec_u64(self) -> u64
The rate as whole events per second, for a limiter that counts in
integers. Rounds to nearest; negatives and NaN become zero.
Sourcefn period(self) -> Time
fn period(self) -> Time
The interval between events at this rate.
A zero or negative rate gives TimeExt::ZERO and not an infinity.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".