Closed grzenow4 closed 1 year ago
This PR changes submit_to function signature to
submit_to
pub fn submit_to<Func, Fut, Ret>(shard_id: u32, func: Func) -> impl Future<Output = Ret> where Func: FnOnce() -> Fut + Send + 'static, Fut: Future<Output = Ret> + 'static, Ret: Send + 'static,
Now you don't have to call the await to start a function execution. Simple test for this change is added:
await
#[seastar::test] async fn test_submit_to_no_await() { let (tx, rx) = futures::channel::oneshot::channel::<i32>(); let _ = submit_to(0, || async { tx.send(42).ok(); }); assert!(matches!(rx.await.unwrap(), 42)); }
Also small correction: submit_to checks if runtime is running.
This PR changes
submit_to
function signature toNow you don't have to call the
await
to start a function execution. Simple test for this change is added:Also small correction:
submit_to
checks if runtime is running.