From 3491fbc01b75444c3fbb502228df21e6a5be4098 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Mon, 14 Oct 2019 01:33:22 +0200 Subject: [PATCH] stabilize stream::{FromStream,IntoStream,Extend} Signed-off-by: Yoshua Wuyts --- src/lib.rs | 16 ++++++++-------- src/stream/extend.rs | 1 - src/stream/from_stream.rs | 2 -- src/stream/into_stream.rs | 2 -- src/stream/mod.rs | 12 ++++++------ src/stream/stream/mod.rs | 14 +++----------- 6 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f69d1f89..aadcc9e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,18 +66,18 @@ cfg_if! { pub mod path; #[cfg_attr(feature = "docs", doc(cfg(unstable)))] pub mod pin; - - mod unit; - mod vec; - mod result; - mod option; - mod string; - mod collections; } } -mod macros; pub(crate) mod utils; +mod collections; +mod macros; +mod option; +mod result; +mod string; +mod unit; +mod vec; + #[doc(inline)] pub use std::{write, writeln}; diff --git a/src/stream/extend.rs b/src/stream/extend.rs index 27efd8b7..77ee3f1f 100644 --- a/src/stream/extend.rs +++ b/src/stream/extend.rs @@ -27,7 +27,6 @@ use crate::stream::IntoStream; /// # /// # }) } /// ``` -#[cfg_attr(feature = "docs", doc(cfg(unstable)))] pub trait Extend { /// Extends a collection with the contents of a stream. fn stream_extend<'a, T: IntoStream + 'a>( diff --git a/src/stream/from_stream.rs b/src/stream/from_stream.rs index 047dab8f..bdbc65e9 100644 --- a/src/stream/from_stream.rs +++ b/src/stream/from_stream.rs @@ -106,8 +106,6 @@ use std::pin::Pin; ///``` /// /// [`IntoStream`]: trait.IntoStream.html -#[cfg_attr(feature = "docs", doc(cfg(unstable)))] -#[cfg(any(feature = "unstable", feature = "docs"))] pub trait FromStream { /// Creates a value from a stream. /// diff --git a/src/stream/into_stream.rs b/src/stream/into_stream.rs index 92331814..ecce0c4f 100644 --- a/src/stream/into_stream.rs +++ b/src/stream/into_stream.rs @@ -13,8 +13,6 @@ use crate::stream::Stream; /// See also: [`FromStream`]. /// /// [`FromStream`]: trait.FromStream.html -#[cfg_attr(feature = "docs", doc(cfg(unstable)))] -#[cfg(any(feature = "unstable", feature = "docs"))] pub trait IntoStream { /// The type of the elements being iterated over. type Item; diff --git a/src/stream/mod.rs b/src/stream/mod.rs index 3d1b1036..8e694d44 100644 --- a/src/stream/mod.rs +++ b/src/stream/mod.rs @@ -24,6 +24,9 @@ use cfg_if::cfg_if; pub use empty::{empty, Empty}; +pub use extend::Extend; +pub use from_stream::FromStream; +pub use into_stream::IntoStream; pub use once::{once, Once}; pub use repeat::{repeat, Repeat}; pub use stream::{Chain, Filter, Fuse, Inspect, Scan, Skip, SkipWhile, StepBy, Stream, Take, Zip}; @@ -31,20 +34,17 @@ pub use stream::{Chain, Filter, Fuse, Inspect, Scan, Skip, SkipWhile, StepBy, St pub(crate) mod stream; mod empty; +mod extend; +mod from_stream; +mod into_stream; mod once; mod repeat; cfg_if! { if #[cfg(any(feature = "unstable", feature = "docs"))] { mod double_ended_stream; - mod extend; - mod from_stream; - mod into_stream; pub use double_ended_stream::DoubleEndedStream; - pub use extend::Extend; - pub use from_stream::FromStream; - pub use into_stream::IntoStream; #[cfg_attr(feature = "docs", doc(cfg(unstable)))] #[doc(inline)] diff --git a/src/stream/stream/mod.rs b/src/stream/stream/mod.rs index 1bb0d319..9fc871bb 100644 --- a/src/stream/stream/mod.rs +++ b/src/stream/stream/mod.rs @@ -72,9 +72,12 @@ pub use zip::Zip; use std::cmp::Ordering; use std::marker::PhantomData; +use std::pin::Pin; use cfg_if::cfg_if; +use crate::future::Future; +use crate::stream::FromStream; use crate::utils::extension_trait; cfg_if! { @@ -85,15 +88,6 @@ cfg_if! { } } -cfg_if! { - if #[cfg(any(feature = "unstable", feature = "docs"))] { - use std::pin::Pin; - - use crate::future::Future; - use crate::stream::FromStream; - } -} - extension_trait! { #[doc = r#" An asynchronous stream of values. @@ -1135,8 +1129,6 @@ extension_trait! { [`stream`]: trait.Stream.html#tymethod.next "#] - #[cfg(any(feature = "unstable", feature = "docs"))] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] #[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead (TODO)"] fn collect<'a, B>( self,