From 14bbacd76ae56378f3f71d6aff1d7ae0c627743d Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Wed, 23 Sep 2020 14:12:07 +0200 Subject: [PATCH 1/4] Stabilize stream::interval --- src/stream/interval.rs | 4 ---- src/stream/mod.rs | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/stream/interval.rs b/src/stream/interval.rs index 0a7eb4807..55fe1f0df 100644 --- a/src/stream/interval.rs +++ b/src/stream/interval.rs @@ -41,8 +41,6 @@ use crate::utils::{timer_after, Timer}; /// # /// # Ok(()) }) } /// ``` -#[cfg(feature = "unstable")] -#[cfg_attr(feature = "docs", doc(cfg(unstable)))] pub fn interval(dur: Duration) -> Interval { Interval { delay: timer_after(dur), @@ -56,8 +54,6 @@ pub fn interval(dur: Duration) -> Interval { /// documentation for more. /// /// [`interval`]: fn.interval.html -#[cfg(feature = "unstable")] -#[cfg_attr(feature = "docs", doc(cfg(unstable)))] #[derive(Debug)] pub struct Interval { delay: Timer, diff --git a/src/stream/mod.rs b/src/stream/mod.rs index 0bfd4e865..7f1ebba8d 100644 --- a/src/stream/mod.rs +++ b/src/stream/mod.rs @@ -303,6 +303,7 @@ pub use empty::{empty, Empty}; pub use from_fn::{from_fn, FromFn}; pub use from_iter::{from_iter, FromIter}; +pub use interval::{interval, Interval}; pub use once::{once, Once}; pub use repeat::{repeat, Repeat}; pub use repeat_with::{repeat_with, RepeatWith}; @@ -313,6 +314,7 @@ pub(crate) mod stream; mod empty; mod from_fn; mod from_iter; +mod interval; mod once; mod repeat; mod repeat_with; @@ -323,7 +325,6 @@ cfg_unstable! { mod extend; mod from_stream; mod fused_stream; - mod interval; mod into_stream; mod pending; mod product; @@ -335,7 +336,6 @@ cfg_unstable! { pub use extend::{extend, Extend}; pub use from_stream::FromStream; pub use fused_stream::FusedStream; - pub use interval::{interval, Interval}; pub use into_stream::IntoStream; pub use pending::{pending, Pending}; pub use product::Product; From d8dcedf815d5c515d42158b810d9f74300710bb3 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Wed, 23 Sep 2020 14:12:35 +0200 Subject: [PATCH 2/4] Stabilize Stream::merge --- src/stream/mod.rs | 1 - src/stream/stream/merge.rs | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/stream/mod.rs b/src/stream/mod.rs index 7f1ebba8d..30fdc9204 100644 --- a/src/stream/mod.rs +++ b/src/stream/mod.rs @@ -339,7 +339,6 @@ cfg_unstable! { pub use into_stream::IntoStream; pub use pending::{pending, Pending}; pub use product::Product; - pub use stream::Merge; pub use successors::{successors, Successors}; pub use sum::Sum; } diff --git a/src/stream/stream/merge.rs b/src/stream/stream/merge.rs index 232097292..d1eea9d16 100644 --- a/src/stream/stream/merge.rs +++ b/src/stream/stream/merge.rs @@ -16,8 +16,6 @@ pin_project! { /// /// [`merge`]: trait.Stream.html#method.merge /// [`Stream`]: trait.Stream.html - #[cfg(feature = "unstable")] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] #[derive(Debug)] pub struct Merge { #[pin] From 741e9388f3c8fd6894fe3d0cfa88c1d6e39e387d Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Wed, 23 Sep 2020 14:12:44 +0200 Subject: [PATCH 3/4] Stabilize stream::pending --- src/stream/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stream/mod.rs b/src/stream/mod.rs index 30fdc9204..40b3eea7f 100644 --- a/src/stream/mod.rs +++ b/src/stream/mod.rs @@ -305,6 +305,7 @@ pub use from_fn::{from_fn, FromFn}; pub use from_iter::{from_iter, FromIter}; pub use interval::{interval, Interval}; pub use once::{once, Once}; +pub use pending::{pending, Pending}; pub use repeat::{repeat, Repeat}; pub use repeat_with::{repeat_with, RepeatWith}; pub use stream::*; @@ -316,6 +317,7 @@ mod from_fn; mod from_iter; mod interval; mod once; +mod pending; mod repeat; mod repeat_with; @@ -326,7 +328,6 @@ cfg_unstable! { mod from_stream; mod fused_stream; mod into_stream; - mod pending; mod product; mod successors; mod sum; @@ -337,7 +338,6 @@ cfg_unstable! { pub use from_stream::FromStream; pub use fused_stream::FusedStream; pub use into_stream::IntoStream; - pub use pending::{pending, Pending}; pub use product::Product; pub use successors::{successors, Successors}; pub use sum::Sum; From 3a6e75cc1dc462aa6c1a738966b26878e934def9 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Wed, 23 Sep 2020 14:23:36 +0200 Subject: [PATCH 4/4] fix pending stabilization --- src/stream/pending.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/stream/pending.rs b/src/stream/pending.rs index edb6be4b1..61dfeced1 100644 --- a/src/stream/pending.rs +++ b/src/stream/pending.rs @@ -2,7 +2,11 @@ use core::marker::PhantomData; use core::pin::Pin; use core::task::{Context, Poll}; -use crate::stream::{DoubleEndedStream, ExactSizeStream, FusedStream, Stream}; +cfg_unstable! { + use crate::stream::{DoubleEndedStream, ExactSizeStream, FusedStream}; +} + +use crate::stream::Stream; /// A stream that never returns any items. /// @@ -53,14 +57,20 @@ impl Stream for Pending { } } +#[cfg(feature = "unstable")] +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] impl DoubleEndedStream for Pending { fn poll_next_back(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { Poll::Pending } } +#[cfg(feature = "unstable")] +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] impl FusedStream for Pending {} +#[cfg(feature = "unstable")] +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] impl ExactSizeStream for Pending { fn len(&self) -> usize { 0