[−][src]Trait governor::prelude::StreamRateLimitExt
Allows converting a futures::Stream
combinator into a rate-limited stream.
Required methods
fn ratelimit_stream(
self,
limiter: &'a DirectRateLimiter<MonotonicClock>
) -> RatelimitedStream<'a, Self> where
Self: Sized,
self,
limiter: &'a DirectRateLimiter<MonotonicClock>
) -> RatelimitedStream<'a, Self> where
Self: Sized,
Limits the rate at which the stream produces items.
Note that this combinator limits the rate at which it yields
items, not necessarily the rate at which the underlying stream is polled.
The combinator will buffer at most one item in order to adhere to the
given limiter. I.e. if it already has an item buffered and needs to wait
it will not poll
the underlying stream.
fn ratelimit_stream_with_jitter(
self,
limiter: &'a DirectRateLimiter<MonotonicClock>,
jitter: Jitter
) -> RatelimitedStream<'a, Self> where
Self: Sized,
self,
limiter: &'a DirectRateLimiter<MonotonicClock>,
jitter: Jitter
) -> RatelimitedStream<'a, Self> where
Self: Sized,
Limits the rate at which the stream produces items, with a randomized wait period.
Note that this combinator limits the rate at which it yields
items, not necessarily the rate at which the underlying stream is polled.
The combinator will buffer at most one item in order to adhere to the
given limiter. I.e. if it already has an item buffered and needs to wait
it will not poll
the underlying stream.
Implementors
impl<'a, S: Stream> StreamRateLimitExt<'a> for S
[src]
fn ratelimit_stream(
self,
limiter: &'a DirectRateLimiter<MonotonicClock>
) -> RatelimitedStream<'a, Self> where
Self: Sized,
[src]
self,
limiter: &'a DirectRateLimiter<MonotonicClock>
) -> RatelimitedStream<'a, Self> where
Self: Sized,
fn ratelimit_stream_with_jitter(
self,
limiter: &'a DirectRateLimiter<MonotonicClock>,
jitter: Jitter
) -> RatelimitedStream<'a, Self> where
Self: Sized,
[src]
self,
limiter: &'a DirectRateLimiter<MonotonicClock>,
jitter: Jitter
) -> RatelimitedStream<'a, Self> where
Self: Sized,