wip: refactoring all the structure and improve error messages
This commit is contained in:
parent
f98c778a0c
commit
de91c7a68f
10 changed files with 268 additions and 56 deletions
23
rpxy-lib/src/hyper_executor.rs
Normal file
23
rpxy-lib/src/hyper_executor.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use tokio::runtime::Handle;
|
||||
|
||||
#[derive(Clone)]
|
||||
/// Executor for hyper
|
||||
pub struct LocalExecutor {
|
||||
runtime_handle: Handle,
|
||||
}
|
||||
|
||||
impl LocalExecutor {
|
||||
pub fn new(runtime_handle: Handle) -> Self {
|
||||
LocalExecutor { runtime_handle }
|
||||
}
|
||||
}
|
||||
|
||||
impl<F> hyper::rt::Executor<F> for LocalExecutor
|
||||
where
|
||||
F: std::future::Future + Send + 'static,
|
||||
F::Output: Send,
|
||||
{
|
||||
fn execute(&self, fut: F) {
|
||||
self.runtime_handle.spawn(fut);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue