[][src]Struct governor::RatelimitedStream

pub struct RatelimitedStream<'a, S: Stream, D: DirectStateStore, C: Clock> { /* fields omitted */ }

A [Stream][futures::Stream] combinator which will limit the rate of items being received.

This is produced by the StreamRateLimitExt::ratelimit_stream and StreamRateLimitExt::ratelimit_stream_with_jitter methods.

Implementations

impl<'a, S: Stream, D: DirectStateStore, C: Clock> RatelimitedStream<'a, S, D, C>[src]

Conversion methods for the stream combinator.

pub fn get_ref(&self) -> &S[src]

Acquires a reference to the underlying stream that this combinator is pulling from.

pub fn get_mut(&mut self) -> &mut S[src]

Acquires a mutable reference to the underlying stream that this combinator is pulling from.

pub fn into_inner(self) -> (S, Option<S::Item>)[src]

Consumes this combinator, returning the underlying stream and any item which it has already produced but which is still being held back in order to abide by the limiter.

Trait Implementations

impl<'a, Item, S: Stream + Sink<Item>, D: DirectStateStore, C: Clock> Sink<Item> for RatelimitedStream<'a, S, D, C> where
    S: Unpin,
    S::Item: Unpin
[src]

Pass-through implementation for [futures::Sink] if the Stream also implements it.

type Error = <S as Sink<Item>>::Error

The type of value produced by the sink when an error occurs.

impl<'a, S: Stream, D: DirectStateStore, C: Clock> Stream for RatelimitedStream<'a, S, D, C> where
    S: Unpin,
    S::Item: Unpin,
    Self: Unpin,
    C: ReasonablyRealtime
[src]

Implements the [futures::Stream] combinator.

type Item = S::Item

Values yielded by the stream.

Auto Trait Implementations

impl<'a, S, D, C> !RefUnwindSafe for RatelimitedStream<'a, S, D, C>[src]

impl<'a, S, D, C> Send for RatelimitedStream<'a, S, D, C> where
    C: Sync,
    D: Sync,
    S: Send,
    <S as Stream>::Item: Send
[src]

impl<'a, S, D, C> Sync for RatelimitedStream<'a, S, D, C> where
    C: Sync,
    D: Sync,
    S: Sync,
    <S as Stream>::Item: Sync
[src]

impl<'a, S, D, C> Unpin for RatelimitedStream<'a, S, D, C> where
    S: Unpin,
    <S as Stream>::Item: Unpin
[src]

impl<'a, S, D, C> !UnwindSafe for RatelimitedStream<'a, S, D, C>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Item> SinkExt<Item> for T where
    T: Sink<Item> + ?Sized

impl<T> StreamExt for T where
    T: Stream + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,