forked from mirror/async-std
fix type def
This commit is contained in:
parent
271b6f4a1c
commit
00e7e58bf3
2 changed files with 14 additions and 21 deletions
|
@ -13,27 +13,27 @@ pin_project! {
|
|||
/// [`flat_map`]: trait.Stream.html#method.flat_map
|
||||
/// [`Stream`]: trait.Stream.html
|
||||
#[allow(missing_debug_implementations)]
|
||||
pub struct FlatMap<S: Stream, U: IntoStream, F> {
|
||||
pub struct FlatMap<S, U, T, F> {
|
||||
#[pin]
|
||||
inner: FlattenCompat<Map<S, F, S::Item, U>, U>,
|
||||
inner: FlattenCompat<Map<S, F, T, U>, U>,
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, U, F> FlatMap<S, U, F>
|
||||
impl<S, U, F> FlatMap<S, U, S::Item, F>
|
||||
where
|
||||
S: Stream,
|
||||
U: IntoStream,
|
||||
F: FnMut(S::Item) -> U,
|
||||
{
|
||||
|
||||
pub fn new(stream: S, f: F) -> FlatMap<S, U, F> {
|
||||
pub fn new(stream: S, f: F) -> FlatMap<S, U, S::Item, F> {
|
||||
FlatMap {
|
||||
inner: FlattenCompat::new(stream.map(f)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, U, F> Stream for FlatMap<S, U, F>
|
||||
impl<S, U, F> Stream for FlatMap<S, U, S::Item, F>
|
||||
where
|
||||
S: Stream<Item: IntoStream<IntoStream = U, Item = U::Item>> + std::marker::Unpin,
|
||||
U: Stream + std::marker::Unpin,
|
||||
|
@ -53,22 +53,19 @@ pin_project!{
|
|||
/// [`flatten`]: trait.Stream.html#method.flatten
|
||||
/// [`Stream`]: trait.Stream.html
|
||||
#[allow(missing_debug_implementations)]
|
||||
pub struct Flatten<S: Stream>
|
||||
where
|
||||
S::Item: IntoStream,
|
||||
{
|
||||
pub struct Flatten<S, U> {
|
||||
#[pin]
|
||||
inner: FlattenCompat<S, <S::Item as IntoStream>::IntoStream>,
|
||||
inner: FlattenCompat<S, U>
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: Stream<Item: IntoStream>> Flatten<S> {
|
||||
pub fn new(stream: S) -> Flatten<S> {
|
||||
impl<S: Stream<Item: IntoStream>> Flatten<S, S::Item> {
|
||||
pub fn new(stream: S) -> Flatten<S, S::Item> {
|
||||
Flatten { inner: FlattenCompat::new(stream) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, U> Stream for Flatten<S>
|
||||
impl<S, U> Stream for Flatten<S, <S::Item as IntoStream>::IntoStream>
|
||||
where
|
||||
S: Stream<Item: IntoStream<IntoStream = U, Item = U::Item>> + std::marker::Unpin,
|
||||
U: Stream + std::marker::Unpin,
|
||||
|
|
|
@ -30,6 +30,7 @@ mod filter;
|
|||
mod filter_map;
|
||||
mod find;
|
||||
mod find_map;
|
||||
mod flatten;
|
||||
mod fold;
|
||||
mod for_each;
|
||||
mod fuse;
|
||||
|
@ -77,6 +78,7 @@ use try_for_each::TryForEeachFuture;
|
|||
|
||||
pub use chain::Chain;
|
||||
pub use filter::Filter;
|
||||
pub use flatten::{FlatMap, Flatten};
|
||||
pub use fuse::Fuse;
|
||||
pub use inspect::Inspect;
|
||||
pub use map::Map;
|
||||
|
@ -99,10 +101,8 @@ cfg_unstable! {
|
|||
use crate::stream::into_stream::IntoStream;
|
||||
|
||||
pub use merge::Merge;
|
||||
pub use flatten::{FlatMap, Flatten};
|
||||
|
||||
mod merge;
|
||||
mod flatten;
|
||||
}
|
||||
|
||||
extension_trait! {
|
||||
|
@ -588,9 +588,7 @@ extension_trait! {
|
|||
# });
|
||||
```
|
||||
"#]
|
||||
#[cfg(feature = "unstable")]
|
||||
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
|
||||
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
|
||||
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, Self::Item, F>
|
||||
where
|
||||
Self: Sized,
|
||||
U: IntoStream,
|
||||
|
@ -622,9 +620,7 @@ extension_trait! {
|
|||
|
||||
# });
|
||||
"#]
|
||||
#[cfg(feature = "unstable")]
|
||||
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
|
||||
fn flatten(self) -> Flatten<Self>
|
||||
fn flatten(self) -> Flatten<Self, Self::Item>
|
||||
where
|
||||
Self: Sized,
|
||||
Self::Item: IntoStream,
|
||||
|
|
Loading…
Reference in a new issue