Implement enter for executor::Default in Wasm
This commit is contained in:
parent
148a4dd469
commit
f0ebcc2474
1 changed files with 9 additions and 1 deletions
|
|
@ -51,7 +51,11 @@ mod platform {
|
||||||
|
|
||||||
/// A default cross-platform executor.
|
/// 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`.
|
/// - On the Web, it will use `iced_futures::executor::WasmBindgen`.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Default(WasmBindgen);
|
pub struct Default(WasmBindgen);
|
||||||
|
|
@ -64,5 +68,9 @@ mod platform {
|
||||||
fn spawn(&self, future: impl futures::Future<Output = ()> + 'static) {
|
fn spawn(&self, future: impl futures::Future<Output = ()> + 'static) {
|
||||||
self.0.spawn(future);
|
self.0.spawn(future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn enter<R>(&self, f: impl FnOnce() -> R) -> R {
|
||||||
|
self.0.enter(f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue