async_ui_core 0.1.0

Shared code for Async UI
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::future::Future;

use scoped_async_spawn::GiveUnforgettableScope;

use crate::{
    backend::BackendTrait,
    executor::{get_driving_future, spawn_local},
};

pub fn mount<B: BackendTrait, F: Future<Output = ()> + 'static>(fut: F) {
    spawn_local(GiveUnforgettableScope::new_static(fut)).detach();
    B::drive_executor(get_driving_future());
}