1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use crate::executor::{BlockingObj, FutureObj};
use crate::{App, Spawn};
impl<S> App<S, ()> {
#[cfg_attr(feature = "docs", doc(cfg(feature = "runtime")))]
#[inline]
pub fn state(state: S) -> Self {
Self::with_exec(state, Exec)
}
}
impl App<(), ()> {
#[cfg_attr(feature = "docs", doc(cfg(feature = "runtime")))]
#[inline]
pub fn new() -> Self {
Self::state(())
}
}
pub struct Exec;
impl Spawn for Exec {
#[inline]
fn spawn(&self, fut: FutureObj) {
async_std::task::spawn(fut);
}
#[inline]
fn spawn_blocking(&self, task: BlockingObj) {
async_std::task::spawn_blocking(task);
}
}