This commit is contained in:
nora 2023-03-07 16:39:54 +01:00
parent b40c185fc9
commit 44a0230869
2 changed files with 3 additions and 33 deletions

View file

@ -21,6 +21,7 @@ pub trait ConnStreamExec<F, B: HttpBody>: Clone {
pub trait NewSvcExec<I, S, E, W: Watcher<I, S, E>>: Clone { pub trait NewSvcExec<I, S, E, W: Watcher<I, S, E>>: Clone {
fn execute_new_svc(&mut self, fut: NewSvcTask<I, S, E, W>); fn execute_new_svc(&mut self, fut: NewSvcTask<I, S, E, W>);
} }
pub(crate) type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>; pub(crate) type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>;
#[derive(Clone)] #[derive(Clone)]
pub enum Exec { pub enum Exec {
@ -42,6 +43,7 @@ where
loop {} loop {}
} }
} }
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
impl<I, S, E, W> NewSvcExec<I, S, E, W> for Exec impl<I, S, E, W> NewSvcExec<I, S, E, W> for Exec
where where
@ -53,7 +55,7 @@ where
loop {} loop {}
} }
} }
#[cfg(feature = "server")]
impl<E, F, B> ConnStreamExec<F, B> for E impl<E, F, B> ConnStreamExec<F, B> for E
where where
E: Executor<H2Stream<F, B>> + Clone, E: Executor<H2Stream<F, B>> + Clone,
@ -64,34 +66,3 @@ where
loop {} loop {}
} }
} }
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
impl<I, S, E, W> NewSvcExec<I, S, E, W> for E
where
E: Executor<NewSvcTask<I, S, E, W>> + Clone,
NewSvcTask<I, S, E, W>: Future<Output = ()>,
S: HttpService<Body>,
W: Watcher<I, S, E>,
{
fn execute_new_svc(&mut self, fut: NewSvcTask<I, S, E, W>) {
loop {}
}
}
#[cfg(not(feature = "http2"))]
#[allow(missing_debug_implementations)]
pub(crate) struct H2Stream<F, B>(std::marker::PhantomData<(F, B)>);
#[cfg(not(feature = "http2"))]
impl<F, B, E> Future for H2Stream<F, B>
where
F: Future<Output = Result<http::Response<B>, E>>,
B: crate::body::HttpBody,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
E: Into<Box<dyn std::error::Error + Send + Sync>>,
{
type Output = ();
fn poll(
self: Pin<&mut Self>,
_cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Self::Output> {
loop {}
}
}

View file

@ -119,7 +119,6 @@ pub(crate) mod new_svc {
} }
impl<I, S, B, E, W> Future for NewSvcTask<I, S, E, W> impl<I, S, B, E, W> Future for NewSvcTask<I, S, E, W>
where where
I: AsyncRead + AsyncWrite + Unpin + Send + 'static,
S: HttpService<Body, ResBody = B>, S: HttpService<Body, ResBody = B>,
B: HttpBody + 'static, B: HttpBody + 'static,
B::Error: Into<Box<dyn StdError + Send + Sync>>, B::Error: Into<Box<dyn StdError + Send + Sync>>,