use std::{pin::Pin, time::Duration};
#[derive(Clone, Debug)]
pub struct GioRuntime;
impl GioRuntime {
pub fn new() -> Self {
Self
}
}
impl Default for GioRuntime {
fn default() -> Self {
Self::new()
}
}
impl crate::runtime::RuntimeHandle for GioRuntime {
fn spawn(&self, f: Pin<Box<dyn Future<Output = ()> + Send + 'static>>) {
glib::spawn_future(f);
}
fn sleep(&self, duration: Duration) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>> {
Box::pin(async move {
glib::timeout_future(duration).await;
})
}
}