diff options
author | 2020-03-30 18:18:33 +0200 | |
---|---|---|
committer | 2020-03-30 18:18:33 +0200 | |
commit | f0ebcc24742aba79cc779a4145a188f2534a5e35 (patch) | |
tree | 2ed8d57f186fbcec41a675c4b2ce58a1f0608787 /src/executor.rs | |
parent | 148a4dd469c0b8f5f84f895878a43543275dd7f0 (diff) | |
download | iced-f0ebcc24742aba79cc779a4145a188f2534a5e35.tar.gz iced-f0ebcc24742aba79cc779a4145a188f2534a5e35.tar.bz2 iced-f0ebcc24742aba79cc779a4145a188f2534a5e35.zip |
Implement `enter` for `executor::Default` in Wasm
Diffstat (limited to 'src/executor.rs')
-rw-r--r-- | src/executor.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/executor.rs b/src/executor.rs index b4be5264..6c5425d1 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -51,7 +51,11 @@ mod platform { /// A default cross-platform executor. /// - /// - On native platforms, it will use `iced_futures::executor::ThreadPool`. + /// - On native platforms, it will use: + /// - `iced_futures::executor::Tokio` when the `tokio` feature is enabled. + /// - `iced_futures::executor::AsyncStd` when the `async-std` feature is + /// enabled. + /// - `iced_futures::executor::ThreadPool` otherwise. /// - On the Web, it will use `iced_futures::executor::WasmBindgen`. #[derive(Debug)] pub struct Default(WasmBindgen); @@ -64,5 +68,9 @@ mod platform { fn spawn(&self, future: impl futures::Future<Output = ()> + 'static) { self.0.spawn(future); } + + fn enter<R>(&self, f: impl FnOnce() -> R) -> R { + self.0.enter(f) + } } } |