pub struct RateSpec {
pub ops_per_sec: f64,
pub burst_ratio: f64,
pub verb: Verb,
pub unit: TimeUnit,
}Expand description
Parsed rate limiter configuration.
Fields§
§ops_per_sec: f64§burst_ratio: f64§verb: Verb§unit: TimeUnitImplementations§
Source§impl RateSpec
impl RateSpec
Sourcepub fn with_burst(ops_per_sec: f64, burst_ratio: f64) -> Self
pub fn with_burst(ops_per_sec: f64, burst_ratio: f64) -> Self
Create with explicit burst ratio.
Sourcepub fn parse(spec: &str) -> Result<Self, String>
pub fn parse(spec: &str) -> Result<Self, String>
Parse a rate spec string.
Formats:
"1000"— 1000 ops/s, 1.1x burst, start"1000,1.5"— 1000 ops/s, 1.5x burst"1000,1.1,restart"— with verb
Sourcepub fn ticks_per_op(&self) -> u32
pub fn ticks_per_op(&self) -> u32
Ticks per operation in the configured time unit.
Trait Implementations§
Source§impl ControlApplier<RateSpec> for RateLimiterApplier
impl ControlApplier<RateSpec> for RateLimiterApplier
Auto Trait Implementations§
impl Freeze for RateSpec
impl RefUnwindSafe for RateSpec
impl Send for RateSpec
impl Sync for RateSpec
impl Unpin for RateSpec
impl UnsafeUnpin for RateSpec
impl UnwindSafe for RateSpec
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