mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 18:11:10 +00:00
Split the service initialisation up into seperate functions (#6332)
* Seperate out the complexity in ServiceBuilder::build_common into seperate functions * Fix line widths * Move some functions to their respective crates
This commit is contained in:
@@ -358,10 +358,13 @@ impl SpawnBlockingExecutor {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl crate::traits::SpawnBlocking for SpawnBlockingExecutor {
|
||||
impl crate::traits::SpawnNamed for SpawnBlockingExecutor {
|
||||
fn spawn_blocking(&self, _: &'static str, future: futures::future::BoxFuture<'static, ()>) {
|
||||
self.0.spawn_ok(future);
|
||||
}
|
||||
fn spawn(&self, _: &'static str, future: futures::future::BoxFuture<'static, ()>) {
|
||||
self.0.spawn_ok(future);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -349,10 +349,14 @@ impl TaskExecutorExt {
|
||||
}
|
||||
}
|
||||
|
||||
/// Something that can spawn a blocking future.
|
||||
pub trait SpawnBlocking {
|
||||
/// Something that can spawn futures (blocking and non-blocking) with am assigned name.
|
||||
pub trait SpawnNamed {
|
||||
/// 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, ()>);
|
||||
/// Spawn the given non-blocking future.
|
||||
///
|
||||
/// The given `name` is used to identify the future in tracing.
|
||||
fn spawn(&self, name: &'static str, future: futures::future::BoxFuture<'static, ()>);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user