Skip to content

Commit 5f8cabb

Browse files
committed
uncomment all of the park related stuff
1 parent 55ca2ce commit 5f8cabb

File tree

4 files changed

+35
-39
lines changed

4 files changed

+35
-39
lines changed

src/future/future_ext.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use core::future::Future;
22

3-
//use crate::channel::Parker;
4-
//use crate::time::stream::IntoStream;
3+
use crate::channel::Parker;
4+
use crate::stream::IntoStream;
55

6-
use super::{Delay, IntoFuture, Timeout};
6+
use super::{Delay, IntoFuture, Park, Timeout};
77

88
/// Extend `Future` with time-based operations.
99
pub trait FutureExt: Future {
@@ -77,21 +77,19 @@ pub trait FutureExt: Future {
7777
{
7878
Delay::new(self, deadline.into_future())
7979
}
80-
/* FIXME channels
81-
/// Suspend or resume execution of a future.
82-
///
83-
/// When this method is called the execution of the future will be put into
84-
/// a suspended state until the channel returns `Parker::Unpark` or the
85-
/// channel's senders are dropped. The underlying future will not be polled
86-
/// while the it is paused.
87-
fn park<I>(self, interval: I) -> Park<Self, I::IntoStream>
88-
where
89-
Self: Sized,
90-
I: IntoStream<Item = Parker>,
91-
{
92-
Park::new(self, interval.into_stream())
93-
}
94-
*/
80+
/// Suspend or resume execution of a future.
81+
///
82+
/// When this method is called the execution of the future will be put into
83+
/// a suspended state until the channel returns `Parker::Unpark` or the
84+
/// channel's senders are dropped. The underlying future will not be polled
85+
/// while the it is paused.
86+
fn park<I>(self, interval: I) -> Park<Self, I::IntoStream>
87+
where
88+
Self: Sized,
89+
I: IntoStream<Item = Parker>,
90+
{
91+
Park::new(self, interval.into_stream())
92+
}
9593
}
9694

9795
impl<T> FutureExt for T where T: Future {}

src/future/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
4242
mod delay;
4343
mod future_ext;
44-
//mod park;
44+
mod park;
4545
mod relative_future;
4646
mod timeout;
4747

4848
pub use delay::Delay;
4949
pub use future_ext::FutureExt;
50-
//pub use park::Park;
50+
pub use park::Park;
5151
pub use relative_future::Timer;
5252
pub use std::future::IntoFuture;
5353
pub use timeout::Timeout;

src/stream/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod debounce;
55
mod delay;
66
mod interval;
77
mod into_stream;
8-
//mod park;
8+
mod park;
99
mod sample;
1010
mod stream_ext;
1111
mod throttle;
@@ -16,7 +16,7 @@ pub use debounce::Debounce;
1616
pub use delay::Delay;
1717
pub use interval::{interval, Interval};
1818
pub use into_stream::IntoStream;
19-
//pub use park::Park;
19+
pub use park::Park;
2020
pub use sample::Sample;
2121
pub use stream_ext::StreamExt;
2222
pub use throttle::Throttle;

src/stream/stream_ext.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
//use crate::channel::Parker;
1+
use crate::channel::Parker;
22
use crate::future::Timer;
33
use std::future::IntoFuture;
44

55
use futures_core::Stream;
66

7-
use super::{Buffer, Debounce, Delay, IntoStream, /*Park,*/ Sample, Throttle, Timeout};
7+
use super::{Buffer, Debounce, Delay, IntoStream, Park, Sample, Throttle, Timeout};
88

99
/// Extend `Stream` with time-based operations.
1010
pub trait StreamExt: Stream {
@@ -178,21 +178,19 @@ pub trait StreamExt: Stream {
178178
{
179179
Delay::new(self, deadline.into_future())
180180
}
181-
/* FIXME
182-
/// Suspend or resume execution of a stream.
183-
///
184-
/// When this method is called the execution of the stream will be put into
185-
/// a suspended state until the channel returns `Parker::Unpark` or the
186-
/// channel's senders are dropped. The underlying stream will not be polled
187-
/// while the it is paused.
188-
fn park<I>(self, interval: I) -> Park<Self, I::IntoStream>
189-
where
190-
Self: Sized,
191-
I: IntoStream<Item = Parker>,
192-
{
193-
Park::new(self, interval.into_stream())
194-
}
195-
*/
181+
/// Suspend or resume execution of a stream.
182+
///
183+
/// When this method is called the execution of the stream will be put into
184+
/// a suspended state until the channel returns `Parker::Unpark` or the
185+
/// channel's senders are dropped. The underlying stream will not be polled
186+
/// while the it is paused.
187+
fn park<I>(self, interval: I) -> Park<Self, I::IntoStream>
188+
where
189+
Self: Sized,
190+
I: IntoStream<Item = Parker>,
191+
{
192+
Park::new(self, interval.into_stream())
193+
}
196194
/// Yield an item, then ignore subsequent items for a duration.
197195
///
198196
/// In addition to using a time-based interval, this method can take any

0 commit comments

Comments
 (0)