1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use crate::{App, BlockingObj, FutureObj, Spawn, State};

impl<S: State> App<S> {
    /// Construct app with default runtime.
    pub fn new(state: S) -> Self {
        Self::with_exec(state, Exec)
    }
}

pub struct Exec;

impl Spawn for Exec {
    fn spawn(&self, fut: FutureObj) {
        async_std::task::spawn(fut);
    }

    fn spawn_blocking(&self, task: BlockingObj) {
        async_std::task::spawn_blocking(task);
    }
}