You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
626 B
24 lines
626 B
//! Collection of macros. |
|
|
|
/// Spawn a local future on the default `GMainContext`. |
|
/// |
|
/// A custom [`glib::Priority`] can be set as the first argument. |
|
/// |
|
/// [`glib::Priority`]: gtk::glib::Priority |
|
#[macro_export] |
|
macro_rules! spawn { |
|
($future:expr) => { |
|
gtk::glib::MainContext::default().spawn_local($future) |
|
}; |
|
($priority:expr, $future:expr) => { |
|
gtk::glib::MainContext::default().spawn_local_with_priority($priority, $future) |
|
}; |
|
} |
|
|
|
/// Spawn a future on the tokio runtime. |
|
#[macro_export] |
|
macro_rules! spawn_tokio { |
|
($future:expr) => { |
|
$crate::RUNTIME.spawn($future) |
|
}; |
|
}
|
|
|