pub struct Builder<C: Clock> { /* fields omitted */ }
Expand description
Builder for Limiter
.
use async_speed_limit::Limiter;
use std::time::Duration;
let limiter = <Limiter>::builder(1_048_576.0)
.refill(Duration::from_millis(100))
.build();
Creates a new limiter builder.
Use infinity to make the speed unlimited.
Sets the speed limit of the limiter.
Use infinity to make the speed unlimited.
The speed limit must be positive. Panics if the speed limit is negative,
zero, or NaN.
Sets the refill period of the limiter.
The default value is 0.1 s, which should be good for most use cases. The
refill period is ignored if the speed is infinity.
The duration must not be zero, otherwise this method panics.
Sets the clock instance used by the limiter.
Formats the value using the given formatter. Read more
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.