Make window::close return and introduce Task::discard

This commit is contained in:
Héctor Ramón Jiménez 2024-08-12 05:12:42 +02:00
parent 7740c35a2a
commit 01aa84e41a
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 24 additions and 7 deletions

View file

@ -159,6 +159,17 @@ impl<T> Task<T> {
}
}
/// Creates a new [`Task`] that discards the result of the current one.
///
/// Useful if you only care about the side effects of a [`Task`].
pub fn discard<O>(self) -> Task<O>
where
T: MaybeSend + 'static,
O: MaybeSend + 'static,
{
self.then(|_| Task::none())
}
/// Creates a new [`Task`] that can be aborted with the returned [`Handle`].
pub fn abortable(self) -> (Self, Handle)
where