Struct xitca_web::middleware::rate_limit::RateLimit
source · pub struct RateLimit(/* private fields */);Implementations§
source§impl RateLimit
impl RateLimit
sourcepub fn per_second(max_burst: u32) -> Self
pub fn per_second(max_burst: u32) -> Self
Construct a RateLimit for a number of cells per_second period. The given number of cells is also assumed to be the maximum burst size.
Panics
- When max_burst is zero.
sourcepub fn per_minute(max_burst: u32) -> Self
pub fn per_minute(max_burst: u32) -> Self
Construct a RateLimit for a number of cells per_minute period. The given number of cells is also assumed to be the maximum burst size.
Panics
- When max_burst is zero.
sourcepub fn per_hour(max_burst: u32) -> Self
pub fn per_hour(max_burst: u32) -> Self
Construct a RateLimit for a number of cells per_hour period. The given number of cells is also assumed to be the maximum burst size.
Panics
- When max_burst is zero.
sourcepub fn with_period(replenish_1_per: Duration) -> Self
pub fn with_period(replenish_1_per: Duration) -> Self
Construct a RateLimit that replenishes one cell in a given interval.
Panics
- When the Duration is zero.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for RateLimit
impl Send for RateLimit
impl Sync for RateLimit
impl Unpin for RateLimit
impl UnwindSafe for RateLimit
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<S, Arg> ServiceExt<Arg> for Swhere
S: Service<Arg>,
impl<S, Arg> ServiceExt<Arg> for Swhere
S: Service<Arg>,
source§fn enclosed<T>(self, build: T) -> Pipeline<Self, T, BuildEnclosed>
fn enclosed<T>(self, build: T) -> Pipeline<Self, T, BuildEnclosed>
Enclose Self with given
T as Service<<Self as Service<_>>::Response>>. In other word T
would take Self’s Service::Response type as it’s generic argument of Service<_> impl.source§fn enclosed_fn<T, Req>(self, func: T) -> Pipeline<Self, T, BuildEnclosedFn>
fn enclosed_fn<T, Req>(self, func: T) -> Pipeline<Self, T, BuildEnclosedFn>
Function version of Self::enclosed method.
source§fn map<F, Res, ResMap>(self, mapper: F) -> Pipeline<Self, F, BuildMap>
fn map<F, Res, ResMap>(self, mapper: F) -> Pipeline<Self, F, BuildMap>
Mutate
<<Self::Response as Service<Req>>::Future as Future>::Output type with given
closure.