diff options
author | 2024-08-12 05:12:42 +0200 | |
---|---|---|
committer | 2024-08-12 05:12:42 +0200 | |
commit | 01aa84e41afa556fd4e82ef11f2f55cf443ef1aa (patch) | |
tree | d794bc53ecd2f8405ec6128f7d730042179e1635 /runtime/src/task.rs | |
parent | 7740c35a2a0f162b04f78075afa5a8e2448a782c (diff) | |
download | iced-01aa84e41afa556fd4e82ef11f2f55cf443ef1aa.tar.gz iced-01aa84e41afa556fd4e82ef11f2f55cf443ef1aa.tar.bz2 iced-01aa84e41afa556fd4e82ef11f2f55cf443ef1aa.zip |
Make `window::close` return and introduce `Task::discard`
Diffstat (limited to 'runtime/src/task.rs')
-rw-r--r-- | runtime/src/task.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/src/task.rs b/runtime/src/task.rs index 4d75ddaa..ec8d7cc7 100644 --- a/runtime/src/task.rs +++ b/runtime/src/task.rs @@ -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 |