mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2025-12-18 13:18:55 -05:00
add is_err() to TryFuture extension
add fold_default to Future tools extension Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
de3b137df8
commit
23cf2b2236
2 changed files with 31 additions and 6 deletions
|
|
@ -32,6 +32,12 @@ where
|
|||
fn counts_with_cap<const CAP: usize>(self) -> impl Future<Output = HashMap<Item, usize>> + Send
|
||||
where
|
||||
<Self as Stream>::Item: Eq + Hash;
|
||||
|
||||
fn fold_default<T, F, Fut>(self, f: F) -> impl Future<Output = T> + Send
|
||||
where
|
||||
F: Fn(T, Item) -> Fut + Send,
|
||||
Fut: Future<Output = T> + Send,
|
||||
T: Default + Send;
|
||||
}
|
||||
|
||||
impl<Item, S> Tools<Item> for S
|
||||
|
|
@ -77,4 +83,14 @@ where
|
|||
counts
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn fold_default<T, F, Fut>(self, f: F) -> impl Future<Output = T> + Send
|
||||
where
|
||||
F: Fn(T, Item) -> Fut + Send,
|
||||
Fut: Future<Output = T> + Send,
|
||||
T: Default + Send,
|
||||
{
|
||||
self.fold(T::default(), f)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue