2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-03-28 20:16:41 +00:00

Merge branch '342-stream-throttle' of github.com:Wassasin/async-std into 342-stream-throttle

This commit is contained in:
Wouter Geraedts 2019-11-12 15:03:54 +01:00
commit 77a1849303
2 changed files with 8 additions and 1 deletions

View file

@ -318,6 +318,7 @@ extension_trait! {
#[doc = r#" #[doc = r#"
Limit the amount of items yielded per timeslice in a stream. Limit the amount of items yielded per timeslice in a stream.
This stream does not drop any items, but will only limit the rate at which items pass through.
# Examples # Examples
``` ```
# fn main() { async_std::task::block_on(async { # fn main() { async_std::task::block_on(async {

View file

@ -9,7 +9,13 @@ use crate::stream::Stream;
use crate::task::{Context, Poll}; use crate::task::{Context, Poll};
pin_project! { pin_project! {
/// A stream that only yields one element once every `duration`, and applies backpressure. Does not drop any elements. /// A stream that only yields one element once every `duration`.
///
/// This `struct` is created by the [`throttle`] method on [`Stream`]. See its
/// documentation for more.
///
/// [`throttle`]: trait.Stream.html#method.throttle
/// [`Stream`]: trait.Stream.html
#[doc(hidden)] #[doc(hidden)]
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct Throttle<S> { pub struct Throttle<S> {