miden_node_utils/
spawn.rs1use tokio::task::JoinHandle;
2use tracing::Span;
3
4pub fn spawn_blocking_in_current_span<F, R>(f: F) -> JoinHandle<R>
6where
7 F: FnOnce() -> R + Send + 'static,
8 R: Send + 'static,
9{
10 spawn_blocking_in_span(f, Span::current())
11}
12
13pub fn spawn_blocking_in_span<F, R>(f: F, span: Span) -> JoinHandle<R>
15where
16 F: FnOnce() -> R + Send + 'static,
17 R: Send + 'static,
18{
19 #[expect(clippy::disallowed_methods)]
20 tokio::task::spawn_blocking(move || span.in_scope(f))
21}