cosmic-applets/applets/cosmic-applet-network/src/task.rs

15 lines
366 B
Rust
Raw Normal View History

2022-02-01 16:46:25 -05:00
// SPDX-License-Identifier: LGPL-3.0-or-later
use std::future::Future;
pub fn spawn<O, F>(future: F) -> tokio::task::JoinHandle<O>
where
F: Future<Output = O> + Send + 'static,
O: Send + 'static,
{
crate::RT.spawn(future)
}
pub fn spawn_local<F: Future<Output = ()> + 'static>(future: F) {
gtk4::glib::MainContext::default().spawn_local(future);
}