diff --git a/src/helpers/auto_abort_join_handle.rs b/src/helpers/auto_abort_join_handle.rs index fa476a8b..8faa1f25 100644 --- a/src/helpers/auto_abort_join_handle.rs +++ b/src/helpers/auto_abort_join_handle.rs @@ -16,6 +16,18 @@ impl AutoAbortJoinHandle { } } +impl AutoAbortJoinHandle +where + T: Send + 'static, +{ + pub fn spawn(future: F) -> Self + where + F: Future + Send + 'static, + { + Self(tokio::spawn(future)) + } +} + impl Drop for AutoAbortJoinHandle { fn drop(&mut self) { self.0.abort();