karyon_jsonrpc/
hyper_exec.rs1use std::sync::Arc;
6
7use karyon_core::async_util::{TaskGroup, TaskResult};
8
9#[derive(Clone)]
10pub(crate) struct HyperExecutor {
11 task_group: Arc<TaskGroup>,
12}
13
14impl HyperExecutor {
15 pub(crate) fn new(task_group: Arc<TaskGroup>) -> Self {
16 Self { task_group }
17 }
18}
19
20impl<F> hyper::rt::Executor<F> for HyperExecutor
21where
22 F: std::future::Future + Send + 'static,
23 F::Output: Send + 'static,
24{
25 fn execute(&self, fut: F) {
26 self.task_group.spawn(
27 async move {
28 let _ = fut.await;
29 },
30 |_: TaskResult<()>| async {},
31 );
32 }
33}