This commit is contained in:
nora 2023-03-07 17:26:47 +01:00
parent 370b3bcf98
commit bb02adf04e
2 changed files with 7 additions and 7 deletions

View file

@ -16,7 +16,7 @@ pub trait ConnStreamExec<F, B>: Clone {
fn execute_h2stream(&mut self); fn execute_h2stream(&mut self);
} }
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
pub trait NewSvcExec<I, S, E, W: Watcher<I, S, E>>: Clone { pub trait NewSvcExec<I, S, E, W: Watcher<I, S>>: 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>);
} }
@ -46,7 +46,7 @@ where
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
NewSvcTask<I, S, E, W>: Future<Output = ()> + Send + 'static, NewSvcTask<I, S, E, W>: Future<Output = ()> + Send + 'static,
W: Watcher<I, S, E>, W: Watcher<I, S>,
{ {
fn execute_new_svc(&mut self, fut: NewSvcTask<I, S, E, W>) { fn execute_new_svc(&mut self, fut: NewSvcTask<I, S, E, W>) {
loop {} loop {}

View file

@ -64,12 +64,12 @@ impl<I, E> Builder<I, E> {
loop {} loop {}
} }
} }
pub trait Watcher<I, S, E> { pub trait Watcher<I, S> {
type Future; type Future;
} }
pub(crate) struct NoopWatcher; pub(crate) struct NoopWatcher;
impl<I, S, E> Watcher<I, S, E> for NoopWatcher impl<I, S> Watcher<I, S> for NoopWatcher
where where
S: HttpService<Body>, S: HttpService<Body>,
{ {
@ -83,11 +83,11 @@ pub(crate) mod new_svc {
use crate::common::{task, Future, Pin, Poll}; use crate::common::{task, Future, Pin, Poll};
use crate::service::HttpService; use crate::service::HttpService;
pub struct NewSvcTask<I, S, E, W: Watcher<I, S, E>> { pub struct NewSvcTask<I, S, E, W: Watcher<I, S>> {
state: State<I, S, E, W>, state: State<I, S, E, W>,
} }
pub(super) struct State<I, S, E, W: Watcher<I, S, E>> { pub(super) struct State<I, S, E, W: Watcher<I, S>> {
a: (I, S, E), a: (I, S, E),
future: W::Future, future: W::Future,
} }
@ -96,7 +96,7 @@ pub(crate) mod new_svc {
where where
S: HttpService<Body, ResBody = B>, S: HttpService<Body, ResBody = B>,
E: ConnStreamExec<S::Future, B>, E: ConnStreamExec<S::Future, B>,
W: Watcher<I, S, E>, W: Watcher<I, S>,
{ {
type Output = (); type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> { fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {