pub trait Throttler<T>: Stream<Item = ()> {
// Required methods
fn throttle_pending(self: Pin<&mut Self>, cx: &mut Context<'_>);
fn throttle_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
next_item: Option<&T>,
);
}Expand description
Callbacks for throttling a stream
Required Methods§
Sourcefn throttle_pending(self: Pin<&mut Self>, cx: &mut Context<'_>)
fn throttle_pending(self: Pin<&mut Self>, cx: &mut Context<'_>)
A new item has been received from the input stream.
After invocation of this method throttle_ready will be called
with Some when the current interval has elapsed. The current
item that will be yielded may still change until throttle_ready
is called.
The cx argument is only provided for consistency and can safely
be ignored in most cases. The throttler will be polled immediately
after this method returns.