fui_core/task/join_handle.rs
1///
2/// JoinHandle will abort the task when dropped.
3///
4pub struct JoinHandle<T> {
5 handle: tokio::task::JoinHandle<T>,
6}
7
8impl<T> JoinHandle<T> {
9 pub fn new(handle: tokio::task::JoinHandle<T>) -> Self {
10 JoinHandle { handle }
11 }
12}
13
14impl<T> Drop for JoinHandle<T> {
15 fn drop(&mut self) {
16 self.handle.abort();
17 }
18}