stabilize stream::{FromStream,IntoStream,Extend}

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
stabilize-from-stream
Yoshua Wuyts 5 years ago
parent b9bddbb7a0
commit 3491fbc01b
No known key found for this signature in database
GPG Key ID: 24EA8164F96777ED

@ -66,18 +66,18 @@ cfg_if! {
pub mod path; pub mod path;
#[cfg_attr(feature = "docs", doc(cfg(unstable)))] #[cfg_attr(feature = "docs", doc(cfg(unstable)))]
pub mod pin; pub mod pin;
mod unit;
mod vec;
mod result;
mod option;
mod string;
mod collections;
} }
} }
mod macros;
pub(crate) mod utils; pub(crate) mod utils;
mod collections;
mod macros;
mod option;
mod result;
mod string;
mod unit;
mod vec;
#[doc(inline)] #[doc(inline)]
pub use std::{write, writeln}; pub use std::{write, writeln};

@ -27,7 +27,6 @@ use crate::stream::IntoStream;
/// # /// #
/// # }) } /// # }) }
/// ``` /// ```
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
pub trait Extend<A> { pub trait Extend<A> {
/// Extends a collection with the contents of a stream. /// Extends a collection with the contents of a stream.
fn stream_extend<'a, T: IntoStream<Item = A> + 'a>( fn stream_extend<'a, T: IntoStream<Item = A> + 'a>(

@ -106,8 +106,6 @@ use std::pin::Pin;
///``` ///```
/// ///
/// [`IntoStream`]: trait.IntoStream.html /// [`IntoStream`]: trait.IntoStream.html
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[cfg(any(feature = "unstable", feature = "docs"))]
pub trait FromStream<T> { pub trait FromStream<T> {
/// Creates a value from a stream. /// Creates a value from a stream.
/// ///

@ -13,8 +13,6 @@ use crate::stream::Stream;
/// See also: [`FromStream`]. /// See also: [`FromStream`].
/// ///
/// [`FromStream`]: trait.FromStream.html /// [`FromStream`]: trait.FromStream.html
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[cfg(any(feature = "unstable", feature = "docs"))]
pub trait IntoStream { pub trait IntoStream {
/// The type of the elements being iterated over. /// The type of the elements being iterated over.
type Item; type Item;

@ -24,6 +24,9 @@
use cfg_if::cfg_if; use cfg_if::cfg_if;
pub use empty::{empty, Empty}; 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 once::{once, Once};
pub use repeat::{repeat, Repeat}; pub use repeat::{repeat, Repeat};
pub use stream::{Chain, Filter, Fuse, Inspect, Scan, Skip, SkipWhile, StepBy, Stream, Take, Zip}; 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; pub(crate) mod stream;
mod empty; mod empty;
mod extend;
mod from_stream;
mod into_stream;
mod once; mod once;
mod repeat; mod repeat;
cfg_if! { cfg_if! {
if #[cfg(any(feature = "unstable", feature = "docs"))] { if #[cfg(any(feature = "unstable", feature = "docs"))] {
mod double_ended_stream; mod double_ended_stream;
mod extend;
mod from_stream;
mod into_stream;
pub use double_ended_stream::DoubleEndedStream; 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)))] #[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[doc(inline)] #[doc(inline)]

@ -72,9 +72,12 @@ pub use zip::Zip;
use std::cmp::Ordering; use std::cmp::Ordering;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::pin::Pin;
use cfg_if::cfg_if; use cfg_if::cfg_if;
use crate::future::Future;
use crate::stream::FromStream;
use crate::utils::extension_trait; use crate::utils::extension_trait;
cfg_if! { 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! { extension_trait! {
#[doc = r#" #[doc = r#"
An asynchronous stream of values. An asynchronous stream of values.
@ -1135,8 +1129,6 @@ extension_trait! {
[`stream`]: trait.Stream.html#tymethod.next [`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)"] #[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead (TODO)"]
fn collect<'a, B>( fn collect<'a, B>(
self, self,

Loading…
Cancel
Save