Update sipper and relax Send requirements

This commit is contained in:
Héctor Ramón Jiménez 2025-02-09 21:05:42 +01:00
parent c8981d0096
commit 7ba2e39133
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 9 additions and 11 deletions

View file

@ -63,18 +63,15 @@ impl<T> Task<T> {
/// progress with the first closure and the output with the second one.
pub fn sip<S, Output, Progress>(
sipper: S,
on_progress: impl Fn(Progress) -> T + Send + 'static,
on_output: impl FnOnce(Output) -> T + Send + 'static,
on_progress: impl Fn(Progress) -> T + MaybeSend + 'static,
on_output: impl FnOnce(Output) -> T + MaybeSend + 'static,
) -> Self
where
S: Sipper<Output, Progress> + Send + 'static,
S::Future: Send + 'static,
Output: Send,
Progress: Send,
T: Send + 'static,
S: Sipper<Output, Progress> + MaybeSend + 'static,
T: MaybeSend + 'static,
{
Self::stream(stream(sipper::sipper(move |sender| async move {
on_output(sipper.map(on_progress).run(sender).await)
on_output(sipper.with(on_progress).run(sender).await)
})))
}