Struct governor::middleware::StateInformationMiddleware
source · pub struct StateInformationMiddleware;
Expand description
Middleware that returns the state of the rate limiter if a positive decision is reached.
Trait Implementations§
source§impl Debug for StateInformationMiddleware
impl Debug for StateInformationMiddleware
source§impl<P: Reference> RateLimitingMiddleware<P> for StateInformationMiddleware
impl<P: Reference> RateLimitingMiddleware<P> for StateInformationMiddleware
§type PositiveOutcome = StateSnapshot
type PositiveOutcome = StateSnapshot
The state snapshot returned from the limiter.
§type NegativeOutcome = NotUntil<P>
type NegativeOutcome = NotUntil<P>
The type that’s returned by the rate limiter when a cell is not allowed. Read more
source§fn allow<K>(_key: &K, state: impl Into<StateSnapshot>) -> Self::PositiveOutcome
fn allow<K>(_key: &K, state: impl Into<StateSnapshot>) -> Self::PositiveOutcome
Called when a positive rate-limiting decision is made. Read more
source§fn disallow<K>(
_key: &K,
state: impl Into<StateSnapshot>,
start_time: P,
) -> Self::NegativeOutcome
fn disallow<K>( _key: &K, state: impl Into<StateSnapshot>, start_time: P, ) -> Self::NegativeOutcome
Called when a negative rate-limiting decision is made (the
“not allowed but OK” case). Read more
Auto Trait Implementations§
impl Freeze for StateInformationMiddleware
impl RefUnwindSafe for StateInformationMiddleware
impl Send for StateInformationMiddleware
impl Sync for StateInformationMiddleware
impl Unpin for StateInformationMiddleware
impl UnwindSafe for StateInformationMiddleware
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