1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use crate::{App, BlockingObj, FutureObj, Spawn, State}; impl<S: State> App<S> { /// Construct app with default runtime. #[inline] pub fn new(state: S) -> Self { Self::with_exec(state, Exec) } } 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); } }