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..40b3eea7f 100644 --- a/src/stream/mod.rs +++ b/src/stream/mod.rs @@ -303,7 +303,9 @@ 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 pending::{pending, Pending}; pub use repeat::{repeat, Repeat}; pub use repeat_with::{repeat_with, RepeatWith}; pub use stream::*; @@ -313,7 +315,9 @@ pub(crate) mod stream; mod empty; mod from_fn; mod from_iter; +mod interval; mod once; +mod pending; mod repeat; mod repeat_with; @@ -323,9 +327,7 @@ cfg_unstable! { mod extend; mod from_stream; mod fused_stream; - mod interval; mod into_stream; - mod pending; mod product; mod successors; mod sum; @@ -335,11 +337,8 @@ 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; - pub use stream::Merge; pub use successors::{successors, Successors}; pub use sum::Sum; } 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 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]