macro_rules! compute_medium {
($expr:expr) => { ... };
($pool:expr, $expr:expr) => { ... };
}Expand description
Execute a medium compute task (100μs-1ms) with intelligent scheduling.
This macro first tries to use thread-local context if available (on Tokio worker threads). If no thread-local context, it requires a pool parameter.
§Example
ⓘ
// With thread-local context (on worker thread)
let result = compute_medium!({
(0..1000).map(|i| i * 2).sum::<i32>()
}).await;
// Or with explicit pool (fallback)
let result = compute_medium!(pool, {
(0..1000).map(|i| i * 2).sum::<i32>()
}).await;