Skip to content

Commit 7522390

Browse files
committed
fix: Stabilize stream most method
1 parent be60dd9 commit 7522390

15 files changed

+43
-89
lines changed

Diff for: src/stream/double_ended_stream/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ use try_rfold::TryRFoldFuture;
2222
/// `Item`s from the back, as well as the front.
2323
///
2424
/// [`Stream`]: trait.Stream.html
25-
#[cfg(feature = "unstable")]
26-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
2725
pub trait DoubleEndedStream: Stream {
2826
#[doc = r#"
2927
Attempts to receive the next item from the back of the stream.

Diff for: src/stream/exact_size_stream.rs

-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ pub use crate::stream::Stream;
7676
/// # });
7777
/// ```
7878
#[allow(clippy::len_without_is_empty)] // ExactSizeIterator::is_empty is unstable
79-
#[cfg(feature = "unstable")]
80-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
8179
pub trait ExactSizeStream: Stream {
8280
/// Returns the exact number of times the stream will iterate.
8381
///

Diff for: src/stream/extend.rs

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ use crate::stream::IntoStream;
2727
/// #
2828
/// # })
2929
/// ```
30-
#[cfg(feature = "unstable")]
31-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
3230
pub trait Extend<A> {
3331
/// Extends a collection with the contents of a stream.
3432
fn extend<'a, T: IntoStream<Item = A> + 'a>(

Diff for: src/stream/fused_stream.rs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ use crate::stream::Stream;
1414
/// [`None`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.None
1515
/// [`Stream::fuse`]: trait.Stream.html#method.fuse
1616
/// [`Fuse`]: struct.Fuse.html
17-
#[cfg(feature = "unstable")]
18-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
1917
pub trait FusedStream: Stream {}
2018

2119
impl<S: FusedStream + ?Sized + Unpin> FusedStream for &mut S {}

Diff for: src/stream/interval.rs

-4
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ use futures_timer::Delay;
4141
/// #
4242
/// # Ok(()) }) }
4343
/// ```
44-
#[cfg(feature = "unstable")]
45-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
4644
pub fn interval(dur: Duration) -> Interval {
4745
Interval {
4846
delay: Delay::new(dur),
@@ -56,8 +54,6 @@ pub fn interval(dur: Duration) -> Interval {
5654
/// documentation for more.
5755
///
5856
/// [`interval`]: fn.interval.html
59-
#[cfg(feature = "unstable")]
60-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
6157
#[derive(Debug)]
6258
pub struct Interval {
6359
delay: Delay,

Diff for: src/stream/mod.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -300,46 +300,46 @@
300300
//! [`take`]: trait.Stream.html#method.take
301301
//! [`min`]: trait.Stream.html#method.min
302302
303+
pub use double_ended_stream::DoubleEndedStream;
303304
pub use empty::{empty, Empty};
305+
pub use exact_size_stream::ExactSizeStream;
304306
pub use from_fn::{from_fn, FromFn};
305307
pub use from_iter::{from_iter, FromIter};
308+
pub use fused_stream::FusedStream;
309+
pub use interval::{interval, Interval};
306310
pub use once::{once, Once};
311+
pub use pending::{pending, Pending};
312+
pub use product::Product;
307313
pub use repeat::{repeat, Repeat};
308314
pub use repeat_with::{repeat_with, RepeatWith};
315+
pub use stream::Merge;
309316
pub use stream::*;
317+
pub use successors::{successors, Successors};
318+
pub use sum::Sum;
310319

311320
pub(crate) mod stream;
312321

322+
mod double_ended_stream;
313323
mod empty;
324+
mod exact_size_stream;
314325
mod from_fn;
315326
mod from_iter;
327+
mod fused_stream;
328+
mod interval;
316329
mod once;
330+
mod pending;
331+
mod product;
317332
mod repeat;
318333
mod repeat_with;
334+
mod successors;
335+
mod sum;
319336

320337
cfg_unstable! {
321-
mod double_ended_stream;
322-
mod exact_size_stream;
323-
mod extend;
324338
mod from_stream;
325-
mod fused_stream;
326-
mod interval;
327339
mod into_stream;
328-
mod pending;
329-
mod product;
330-
mod successors;
331-
mod sum;
340+
mod extend;
332341

333-
pub use double_ended_stream::DoubleEndedStream;
334-
pub use exact_size_stream::ExactSizeStream;
335342
pub use extend::{extend, Extend};
336343
pub use from_stream::FromStream;
337-
pub use fused_stream::FusedStream;
338-
pub use interval::{interval, Interval};
339344
pub use into_stream::IntoStream;
340-
pub use pending::{pending, Pending};
341-
pub use product::Product;
342-
pub use stream::Merge;
343-
pub use successors::{successors, Successors};
344-
pub use sum::Sum;
345345
}

Diff for: src/stream/once.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use pin_project_lite::pin_project;
55
use crate::stream::Stream;
66
use crate::task::{Context, Poll};
77

8-
#[cfg(feature = "unstable")]
98
use crate::stream::DoubleEndedStream;
109

1110
/// Creates a stream that yields a single item.
@@ -50,8 +49,7 @@ impl<T> Stream for Once<T> {
5049
}
5150
}
5251

53-
#[cfg(feature = "unstable")]
54-
impl <T> DoubleEndedStream for Once<T> {
52+
impl<T> DoubleEndedStream for Once<T> {
5553
fn poll_next_back(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
5654
Poll::Ready(self.project().value.take())
5755
}

Diff for: src/stream/product.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use core::pin::Pin;
21
use core::future::Future;
2+
use core::pin::Pin;
33

44
use crate::stream::Stream;
55

@@ -13,8 +13,6 @@ use crate::stream::Stream;
1313
/// [`product`]: trait.Product.html#tymethod.product
1414
/// [`FromStream`]: trait.FromStream.html
1515
/// [`Stream::product`]: trait.Stream.html#method.product
16-
#[cfg(feature = "unstable")]
17-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
1816
pub trait Product<A = Self>: Sized {
1917
/// Method which takes a stream and generates `Self` from the elements by
2018
/// multiplying the items.
@@ -23,9 +21,9 @@ pub trait Product<A = Self>: Sized {
2321
S: Stream<Item = A> + 'a;
2422
}
2523

26-
use core::ops::Mul;
27-
use core::num::Wrapping;
2824
use crate::stream::stream::StreamExt;
25+
use core::num::Wrapping;
26+
use core::ops::Mul;
2927

3028
macro_rules! integer_product {
3129
(@impls $one: expr, $($a:ty)*) => ($(
@@ -75,5 +73,5 @@ macro_rules! float_product {
7573
);
7674
}
7775

78-
integer_product!{ i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize }
79-
float_product!{ f32 f64 }
76+
integer_product! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize }
77+
float_product! { f32 f64 }

Diff for: src/stream/stream/count.rs

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ use crate::task::{Context, Poll};
99
pin_project! {
1010
#[doc(hidden)]
1111
#[allow(missing_debug_implementations)]
12-
#[cfg(feature = "unstable")]
13-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
1412
pub struct CountFuture<S> {
1513
#[pin]
1614
stream: S,

Diff for: src/stream/stream/merge.rs

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ pin_project! {
1616
///
1717
/// [`merge`]: trait.Stream.html#method.merge
1818
/// [`Stream`]: trait.Stream.html
19-
#[cfg(feature = "unstable")]
20-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
2119
#[derive(Debug)]
2220
pub struct Merge<L, R> {
2321
#[pin]

Diff for: src/stream/stream/mod.rs

+19-35
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ mod chain;
2727
mod cloned;
2828
mod cmp;
2929
mod copied;
30+
mod count;
3031
mod cycle;
32+
mod delay;
3133
mod enumerate;
3234
mod eq;
3335
mod filter;
@@ -47,6 +49,7 @@ mod map;
4749
mod max;
4850
mod max_by;
4951
mod max_by_key;
52+
mod merge;
5053
mod min;
5154
mod min_by;
5255
mod min_by_key;
@@ -61,13 +64,17 @@ mod skip_while;
6164
mod step_by;
6265
mod take;
6366
mod take_while;
67+
mod throttle;
68+
mod timeout;
6469
mod try_fold;
6570
mod try_for_each;
71+
mod unzip;
6672
mod zip;
6773

6874
use all::AllFuture;
6975
use any::AnyFuture;
7076
use cmp::CmpFuture;
77+
use count::CountFuture;
7178
use cycle::Cycle;
7279
use enumerate::Enumerate;
7380
use eq::EqFuture;
@@ -94,53 +101,48 @@ use partial_cmp::PartialCmpFuture;
94101
use position::PositionFuture;
95102
use try_fold::TryFoldFuture;
96103
use try_for_each::TryForEachFuture;
104+
use unzip::UnzipFuture;
97105

98106
pub use chain::Chain;
99107
pub use cloned::Cloned;
100108
pub use copied::Copied;
109+
pub use delay::Delay;
101110
pub use filter::Filter;
102111
pub use fuse::Fuse;
103112
pub use inspect::Inspect;
104113
pub use map::Map;
114+
pub use merge::Merge;
105115
pub use scan::Scan;
106116
pub use skip::Skip;
107117
pub use skip_while::SkipWhile;
108118
pub use step_by::StepBy;
109119
pub use take::Take;
110120
pub use take_while::TakeWhile;
121+
pub use throttle::Throttle;
122+
pub use timeout::{Timeout, TimeoutError};
111123
pub use zip::Zip;
112124

113125
use core::cmp::Ordering;
126+
use core::future::Future;
127+
use core::pin::Pin;
128+
use core::time::Duration;
114129

115-
cfg_unstable! {
116-
use core::future::Future;
117-
use core::pin::Pin;
118-
use core::time::Duration;
130+
use crate::stream::{Product, Sum};
119131

132+
cfg_unstable! {
133+
use crate::stream::FromStream;
120134
use crate::stream::into_stream::IntoStream;
121-
use crate::stream::{FromStream, Product, Sum};
122135
use crate::stream::Extend;
123136

124-
use count::CountFuture;
125137
use partition::PartitionFuture;
126-
use unzip::UnzipFuture;
127138

128-
pub use merge::Merge;
129139
pub use flatten::Flatten;
130140
pub use flat_map::FlatMap;
131-
pub use timeout::{TimeoutError, Timeout};
132-
pub use throttle::Throttle;
133-
pub use delay::Delay;
134141

135-
mod count;
136-
mod merge;
142+
137143
mod flatten;
138144
mod flat_map;
139145
mod partition;
140-
mod timeout;
141-
mod throttle;
142-
mod delay;
143-
mod unzip;
144146
}
145147

146148
extension_trait! {
@@ -355,8 +357,6 @@ extension_trait! {
355357
# }) }
356358
```
357359
"#]
358-
#[cfg(feature = "unstable")]
359-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
360360
fn throttle(self, d: Duration) -> Throttle<Self>
361361
where
362362
Self: Sized,
@@ -598,8 +598,6 @@ extension_trait! {
598598
# }) }
599599
```
600600
"#]
601-
#[cfg(any(feature = "unstable", feature = "docs"))]
602-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
603601
fn delay(self, dur: std::time::Duration) -> Delay<Self>
604602
where
605603
Self: Sized,
@@ -1511,8 +1509,6 @@ extension_trait! {
15111509
# }) }
15121510
```
15131511
"#]
1514-
#[cfg(feature = "unstable")]
1515-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
15161512
fn by_ref(&mut self) -> &mut Self {
15171513
self
15181514
}
@@ -1656,8 +1652,6 @@ extension_trait! {
16561652
# Ok(()) }) }
16571653
```
16581654
"#]
1659-
#[cfg(any(feature = "unstable", feature = "docs"))]
1660-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
16611655
fn timeout(self, dur: Duration) -> Timeout<Self>
16621656
where
16631657
Self: Stream + Sized,
@@ -1822,8 +1816,6 @@ extension_trait! {
18221816
# }) }
18231817
```
18241818
"#]
1825-
#[cfg(feature = "unstable")]
1826-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
18271819
fn unzip<A, B, FromA, FromB>(self) -> impl Future<Output = (FromA, FromB)> [UnzipFuture<Self, FromA, FromB>]
18281820
where
18291821
FromA: Default + Extend<A>,
@@ -1921,8 +1913,6 @@ extension_trait! {
19211913
# });
19221914
```
19231915
"#]
1924-
#[cfg(feature = "unstable")]
1925-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
19261916
fn merge<U>(self, other: U) -> Merge<Self, U>
19271917
where
19281918
Self: Sized,
@@ -2068,8 +2058,6 @@ extension_trait! {
20682058
# }) }
20692059
```
20702060
"#]
2071-
#[cfg(feature = "unstable")]
2072-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
20732061
fn count(self) -> impl Future<Output = usize> [CountFuture<Self>]
20742062
where
20752063
Self: Sized,
@@ -2330,8 +2318,6 @@ extension_trait! {
23302318
# }) }
23312319
```
23322320
"#]
2333-
#[cfg(feature = "unstable")]
2334-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
23352321
fn sum<'a, S>(
23362322
self,
23372323
) -> impl Future<Output = S> + 'a [Pin<Box<dyn Future<Output = S> + 'a>>]
@@ -2376,8 +2362,6 @@ extension_trait! {
23762362
# }) }
23772363
```
23782364
"#]
2379-
#[cfg(feature = "unstable")]
2380-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
23812365
fn product<'a, P>(
23822366
self,
23832367
) -> impl Future<Output = P> + 'a [Pin<Box<dyn Future<Output = P> + 'a>>]

Diff for: src/stream/stream/timeout.rs

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ impl<S: Stream> Stream for Timeout<S> {
4747
}
4848

4949
/// An error returned when a stream times out.
50-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
51-
#[cfg(any(feature = "unstable", feature = "docs"))]
5250
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
5351
pub struct TimeoutError {
5452
_private: (),

Diff for: src/stream/stream/unzip.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ use crate::task::{Context, Poll};
88

99
pin_project! {
1010
#[derive(Clone, Debug)]
11-
#[cfg(feature = "unstable")]
12-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
1311
pub struct UnzipFuture<S, FromA, FromB> {
1412
#[pin]
1513
stream: S,

0 commit comments

Comments
 (0)