Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize stream interval, pending, merge #885

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/stream/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
Expand Down
9 changes: 4 additions & 5 deletions src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;
}
12 changes: 11 additions & 1 deletion src/stream/pending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -53,14 +57,20 @@ impl<T> Stream for Pending<T> {
}
}

#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl<T> DoubleEndedStream for Pending<T> {
fn poll_next_back(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<T>> {
Poll::Pending
}
}

#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl<T> FusedStream for Pending<T> {}

#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl<T> ExactSizeStream for Pending<T> {
fn len(&self) -> usize {
0
Expand Down
2 changes: 0 additions & 2 deletions src/stream/stream/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<L, R> {
#[pin]
Expand Down