broker_tokio::time

Struct Throttle

Source
pub struct Throttle<T> { /* private fields */ }
Available on crate features stream and time only.
Expand description

Stream for the throttle function.

Implementations§

Source§

impl<T: Unpin> Throttle<T>

Source

pub fn get_ref(&self) -> &T

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

Source

pub fn get_mut(&mut self) -> &mut T

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

Note that care must be taken to avoid tampering with the state of the stream which may otherwise confuse this combinator.

Source

pub fn into_inner(self) -> T

Consumes this combinator, returning the underlying stream.

Note that this may discard intermediate state of this combinator, so care should be taken to avoid losing resources when this is called.

Trait Implementations§

Source§

impl<T: Debug> Debug for Throttle<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Stream> Stream for Throttle<T>

Source§

type Item = <T as Stream>::Item

Values yielded by the stream.
Source§

fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Self::Item>>

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the stream. Read more
Source§

impl<'__pin, T> Unpin for Throttle<T>
where __Origin<'__pin, T>: Unpin,

Auto Trait Implementations§

§

impl<T> Freeze for Throttle<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for Throttle<T>

§

impl<T> Send for Throttle<T>
where T: Send,

§

impl<T> Sync for Throttle<T>
where T: Sync,

§

impl<T> !UnwindSafe for Throttle<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<St> StreamExt for St
where St: Stream + ?Sized,

Source§

fn next(&mut self) -> Next<'_, Self>
where Self: Unpin,

Available on crate feature stream only.
Consumes and returns the next value in the stream or None if the stream is finished. Read more
Source§

fn try_next<T, E>(&mut self) -> TryNext<'_, Self>
where Self: Stream<Item = Result<T, E>> + Unpin,

Available on crate feature stream only.
Consumes and returns the next item in the stream. If an error is encountered before the next item, the error is returned instead. Read more
Source§

fn map<T, F>(self, f: F) -> Map<Self, F>
where F: FnMut(Self::Item) -> T, Self: Sized,

Available on crate feature stream only.
Maps this stream’s items to a different type, returning a new stream of the resulting type. Read more
Source§

fn merge<U>(self, other: U) -> Merge<Self, U>
where U: Stream<Item = Self::Item>, Self: Sized,

Available on crate feature stream only.
Combine two streams into one by interleaving the output of both as it is produced. Read more
Source§

fn filter<F>(self, f: F) -> Filter<Self, F>
where F: FnMut(&Self::Item) -> bool, Self: Sized,

Available on crate feature stream only.
Filters the values produced by this stream according to the provided predicate. Read more
Source§

fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
where F: FnMut(Self::Item) -> Option<T>, Self: Sized,

Available on crate feature stream only.
Filters the values produced by this stream while simultaneously mapping them to a different type according to the provided closure. Read more
Source§

fn fuse(self) -> Fuse<Self>
where Self: Sized,

Available on crate feature stream only.
Creates a stream which ends after the first None. Read more
Source§

fn take(self, n: usize) -> Take<Self>
where Self: Sized,

Available on crate feature stream only.
Creates a new stream of at most n items of the underlying stream. Read more
Source§

fn take_while<F>(self, f: F) -> TakeWhile<Self, F>
where F: FnMut(&Self::Item) -> bool, Self: Sized,

Available on crate feature stream only.
Take elements from this stream while the provided predicate resolves to true. Read more
Source§

fn all<F>(&mut self, f: F) -> AllFuture<'_, Self, F>
where Self: Unpin, F: FnMut(Self::Item) -> bool,

Available on crate feature stream only.
Tests if every element of the stream matches a predicate. Read more
Source§

fn any<F>(&mut self, f: F) -> AnyFuture<'_, Self, F>
where Self: Unpin, F: FnMut(Self::Item) -> bool,

Available on crate feature stream only.
Tests if any element of the stream matches a predicate. Read more
Source§

fn chain<U>(self, other: U) -> Chain<Self, U>
where U: Stream<Item = Self::Item>, Self: Sized,

Available on crate feature stream only.
Combine two streams into one by first returning all values from the first stream then all values from the second stream. Read more
Source§

fn collect<T>(self) -> Collect<Self, T>
where T: FromStream<Self::Item>, Self: Sized,

Available on crate feature stream only.
Drain stream pushing all emitted values into a collection. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

type Ok = T

The type of successful values yielded by this future
Source§

type Error = E

The type of failures yielded by this future
Source§

fn try_poll_next( self: Pin<&mut S>, cx: &mut Context<'_>, ) -> Poll<Option<Result<<S as TryStream>::Ok, <S as TryStream>::Error>>>

Poll this TryStream as if it were a Stream. Read more