use teksilo_app::TeksiloAppBuilder;
use crate::executor::AsyncRuntimeHandle;
pub trait TeksiloAppBuilderAsyncExt {
fn install_async(self) -> Self;
}
impl TeksiloAppBuilderAsyncExt for TeksiloAppBuilder {
fn install_async(self) -> Self {
let handle = AsyncRuntimeHandle::new();
let poll_source = handle.poll_source();
let completions = handle.completions();
let tick_handle = handle.clone();
let waker_handle = handle.clone();
self.app_state(handle)
.app_state(completions)
.on_loop_tick(poll_source, move || tick_handle.tick())
.on_ready(move |proxy| waker_handle.set_poster(std::sync::Arc::new(proxy)))
}
}