Skip to content

stabilize stream::{FromStream,IntoStream,Extend} #323

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

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
1 change: 0 additions & 1 deletion src/stream/extend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use crate::stream::IntoStream;
/// #
/// # }) }
/// ```
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
pub trait Extend<A> {
/// Extends a collection with the contents of a stream.
fn stream_extend<'a, T: IntoStream<Item = A> + 'a>(
Expand Down
2 changes: 0 additions & 2 deletions src/stream/from_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {
/// Creates a value from a stream.
///
Expand Down
2 changes: 0 additions & 2 deletions src/stream/into_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@
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};

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)]
Expand Down
14 changes: 3 additions & 11 deletions src/stream/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand All @@ -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.
Expand Down Expand Up @@ -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,
Expand Down