mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Name all the tasks! (#6726)
* Remove any implementation of `Spawn` or `Executor` from our task executors * Fix compilation * Rename `SpawnBlockingExecutor` * Update primitives/core/src/traits.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Fix tests Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -359,16 +359,16 @@ macro_rules! wasm_export_functions {
|
||||
};
|
||||
}
|
||||
|
||||
/// An executor that supports spawning blocking futures in tests.
|
||||
/// A task executor that can be used in tests.
|
||||
///
|
||||
/// Internally this just wraps a `ThreadPool` with a pool size of `8`. This
|
||||
/// should ensure that we have enough threads in tests for spawning blocking futures.
|
||||
#[cfg(feature = "std")]
|
||||
#[derive(Clone)]
|
||||
pub struct SpawnBlockingExecutor(futures::executor::ThreadPool);
|
||||
pub struct TaskExecutor(futures::executor::ThreadPool);
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl SpawnBlockingExecutor {
|
||||
impl TaskExecutor {
|
||||
/// Create a new instance of `Self`.
|
||||
pub fn new() -> Self {
|
||||
let mut builder = futures::executor::ThreadPoolBuilder::new();
|
||||
@@ -377,7 +377,7 @@ impl SpawnBlockingExecutor {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl crate::traits::SpawnNamed for SpawnBlockingExecutor {
|
||||
impl crate::traits::SpawnNamed for TaskExecutor {
|
||||
fn spawn_blocking(&self, _: &'static str, future: futures::future::BoxFuture<'static, ()>) {
|
||||
self.0.spawn_ok(future);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user