Remove Executor::block_on and simplify Compositor creation
This commit is contained in:
parent
baadcc150f
commit
57cb14ce38
13 changed files with 58 additions and 108 deletions
|
|
@ -13,10 +13,6 @@ impl crate::Executor for Executor {
|
|||
fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
|
||||
let _ = async_std::task::spawn(future);
|
||||
}
|
||||
|
||||
fn block_on(future: impl Future<Output = ()> + 'static) {
|
||||
async_std::task::block_on(future);
|
||||
}
|
||||
}
|
||||
|
||||
pub mod time {
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ impl crate::Executor for Executor {
|
|||
fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
|
||||
smol::spawn(future).detach();
|
||||
}
|
||||
|
||||
fn block_on(future: impl Future<Output = ()> + 'static) {
|
||||
smol::block_on(future);
|
||||
}
|
||||
}
|
||||
|
||||
pub mod time {
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@ impl crate::Executor for Executor {
|
|||
fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
|
||||
self.spawn_ok(future);
|
||||
}
|
||||
|
||||
fn block_on(future: impl Future<Output = ()> + 'static) {
|
||||
futures::executor::block_on(future);
|
||||
}
|
||||
}
|
||||
|
||||
pub mod time {
|
||||
|
|
|
|||
|
|
@ -17,13 +17,6 @@ impl crate::Executor for Executor {
|
|||
let _guard = tokio::runtime::Runtime::enter(self);
|
||||
f()
|
||||
}
|
||||
|
||||
fn block_on(future: impl Future<Output = ()> + 'static) {
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.build()
|
||||
.unwrap()
|
||||
.block_on(future);
|
||||
}
|
||||
}
|
||||
|
||||
pub mod time {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
//! A backend that does nothing!
|
||||
use crate::MaybeSend;
|
||||
|
||||
/// An executor that drops all the futures, instead of spawning them.
|
||||
#[derive(Debug)]
|
||||
|
|
@ -9,17 +10,7 @@ impl crate::Executor for Executor {
|
|||
Ok(Self)
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn spawn(&self, _future: impl Future<Output = ()> + Send + 'static) {}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn spawn(&self, _future: impl Future<Output = ()> + 'static) {}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn block_on(_future: impl Future<Output = ()> + 'static) {}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn block_on(_future: impl Future<Output = ()> + 'static) {}
|
||||
fn spawn(&self, _future: impl Future<Output = ()> + MaybeSend + 'static) {}
|
||||
}
|
||||
|
||||
pub mod time {
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ impl crate::Executor for Executor {
|
|||
fn spawn(&self, future: impl futures::Future<Output = ()> + 'static) {
|
||||
wasm_bindgen_futures::spawn_local(future);
|
||||
}
|
||||
|
||||
fn block_on(future: impl futures::Future<Output = ()> + 'static) {
|
||||
wasm_bindgen_futures::spawn_local(future);
|
||||
}
|
||||
}
|
||||
|
||||
pub mod time {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue