add broad_flat_map
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
98f9570547
commit
2b730a30ad
1 changed files with 28 additions and 0 deletions
|
@ -35,6 +35,13 @@ where
|
||||||
Fut: Future<Output = Option<U>> + Send,
|
Fut: Future<Output = Option<U>> + Send,
|
||||||
U: Send;
|
U: Send;
|
||||||
|
|
||||||
|
fn broadn_flat_map<F, Fut, U, N>(self, n: N, f: F) -> impl Stream<Item = U> + Send
|
||||||
|
where
|
||||||
|
N: Into<Option<usize>>,
|
||||||
|
F: Fn(Item) -> Fut + Send,
|
||||||
|
Fut: Stream<Item = U> + Send + Unpin,
|
||||||
|
U: Send;
|
||||||
|
|
||||||
fn broadn_then<F, Fut, U, N>(self, n: N, f: F) -> impl Stream<Item = U> + Send
|
fn broadn_then<F, Fut, U, N>(self, n: N, f: F) -> impl Stream<Item = U> + Send
|
||||||
where
|
where
|
||||||
N: Into<Option<usize>>,
|
N: Into<Option<usize>>,
|
||||||
|
@ -70,6 +77,16 @@ where
|
||||||
self.broadn_filter_map(None, f)
|
self.broadn_filter_map(None, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn broad_flat_map<F, Fut, U>(self, f: F) -> impl Stream<Item = U> + Send
|
||||||
|
where
|
||||||
|
F: Fn(Item) -> Fut + Send,
|
||||||
|
Fut: Stream<Item = U> + Send + Unpin,
|
||||||
|
U: Send,
|
||||||
|
{
|
||||||
|
self.broadn_flat_map(None, f)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn broad_then<F, Fut, U>(self, f: F) -> impl Stream<Item = U> + Send
|
fn broad_then<F, Fut, U>(self, f: F) -> impl Stream<Item = U> + Send
|
||||||
where
|
where
|
||||||
|
@ -122,6 +139,17 @@ where
|
||||||
.ready_filter_map(identity)
|
.ready_filter_map(identity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn broadn_flat_map<F, Fut, U, N>(self, n: N, f: F) -> impl Stream<Item = U> + Send
|
||||||
|
where
|
||||||
|
N: Into<Option<usize>>,
|
||||||
|
F: Fn(Item) -> Fut + Send,
|
||||||
|
Fut: Stream<Item = U> + Send + Unpin,
|
||||||
|
U: Send,
|
||||||
|
{
|
||||||
|
self.flat_map_unordered(n.into().unwrap_or_else(automatic_width), f)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn broadn_then<F, Fut, U, N>(self, n: N, f: F) -> impl Stream<Item = U> + Send
|
fn broadn_then<F, Fut, U, N>(self, n: N, f: F) -> impl Stream<Item = U> + Send
|
||||||
where
|
where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue