mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
Expose that BasicQueue expects blocking spawn (#5860)
* Expose that `BasicQueue` expects blocking spawn Up to now `BasicQueue` expected a closure that to spawn a `Future`. This was expected to be a closure that spawns a blocking future. However, this wasn't documented anywhere. This pr introduces a new trait `SpawnBlocking` that exposes this requirement to the outside. * Feedback
This commit is contained in:
@@ -330,3 +330,11 @@ impl TaskExecutorExt {
|
||||
Self(spawn_handle)
|
||||
}
|
||||
}
|
||||
|
||||
/// Something that can spawn a blocking future.
|
||||
pub trait SpawnBlocking {
|
||||
/// Spawn the given blocking future.
|
||||
///
|
||||
/// The given `name` is used to identify the future in tracing.
|
||||
fn spawn_blocking(&self, name: &'static str, future: futures::future::BoxFuture<'static, ()>);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user