mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2025-03-14 18:55:37 +00:00
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,
|
||||
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
|
||||
where
|
||||
N: Into<Option<usize>>,
|
||||
|
@ -70,6 +77,16 @@ where
|
|||
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]
|
||||
fn broad_then<F, Fut, U>(self, f: F) -> impl Stream<Item = U> + Send
|
||||
where
|
||||
|
@ -122,6 +139,17 @@ where
|
|||
.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]
|
||||
fn broadn_then<F, Fut, U, N>(self, n: N, f: F) -> impl Stream<Item = U> + Send
|
||||
where
|
||||
|
|
Loading…
Add table
Reference in a new issue