Trait governor::state::direct::SinkRateLimitExt
source · pub trait SinkRateLimitExt<Item, S>: Sink<Item>where
S: Sink<Item>,{
// Required methods
fn ratelimit_sink<D: DirectStateStore, C: ReasonablyRealtime, MW: RateLimitingMiddleware<C::Instant, NegativeOutcome = NotUntil<C::Instant>>>(
self,
limiter: &RateLimiter<NotKeyed, D, C, MW>,
) -> RatelimitedSink<'_, Item, S, D, C, MW>
where Self: Sized;
fn ratelimit_sink_with_jitter<D: DirectStateStore, C: ReasonablyRealtime, MW: RateLimitingMiddleware<C::Instant, NegativeOutcome = NotUntil<C::Instant>>>(
self,
limiter: &RateLimiter<NotKeyed, D, C, MW>,
jitter: Jitter,
) -> RatelimitedSink<'_, Item, S, D, C, MW>
where Self: Sized;
}
Expand description
Allows converting a futures::Sink
combinator into a rate-limited sink.
Required Methods§
sourcefn ratelimit_sink<D: DirectStateStore, C: ReasonablyRealtime, MW: RateLimitingMiddleware<C::Instant, NegativeOutcome = NotUntil<C::Instant>>>(
self,
limiter: &RateLimiter<NotKeyed, D, C, MW>,
) -> RatelimitedSink<'_, Item, S, D, C, MW>where
Self: Sized,
fn ratelimit_sink<D: DirectStateStore, C: ReasonablyRealtime, MW: RateLimitingMiddleware<C::Instant, NegativeOutcome = NotUntil<C::Instant>>>(
self,
limiter: &RateLimiter<NotKeyed, D, C, MW>,
) -> RatelimitedSink<'_, Item, S, D, C, MW>where
Self: Sized,
Limits the rate at which items can be put into the current sink.
sourcefn ratelimit_sink_with_jitter<D: DirectStateStore, C: ReasonablyRealtime, MW: RateLimitingMiddleware<C::Instant, NegativeOutcome = NotUntil<C::Instant>>>(
self,
limiter: &RateLimiter<NotKeyed, D, C, MW>,
jitter: Jitter,
) -> RatelimitedSink<'_, Item, S, D, C, MW>where
Self: Sized,
fn ratelimit_sink_with_jitter<D: DirectStateStore, C: ReasonablyRealtime, MW: RateLimitingMiddleware<C::Instant, NegativeOutcome = NotUntil<C::Instant>>>(
self,
limiter: &RateLimiter<NotKeyed, D, C, MW>,
jitter: Jitter,
) -> RatelimitedSink<'_, Item, S, D, C, MW>where
Self: Sized,
Limits the rate at which items can be put into the current sink, with a randomized wait period.