This commit is contained in:
Rob Ede 2021-12-17 04:21:42 +00:00
parent cd1eb5f627
commit 010b5dd66d
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
1 changed files with 25 additions and 31 deletions

View File

@ -46,6 +46,11 @@ bitflags! {
}
}
// there's 2 versions of Dispatcher state because of:
// https://github.com/taiki-e/pin-project-lite/issues/3
//
// tl;dr: pin-project-lite doesn't play well with other attribute macros
#[cfg(not(test))]
pin_project! {
/// Dispatcher for HTTP/1.1 protocol
@ -67,37 +72,6 @@ pin_project! {
}
}
// there's 2 versions of dispatcher state because of:
// https://github.com/taiki-e/pin-project-lite/issues/3
//
// tl;dr: pin-project-lite doesn't play well with other attribute macros
pin_project! {
#[project = DispatcherStateProj]
enum DispatcherState<T, S, B, X, U>
where
S: Service<Request>,
S::Error: Into<Response<BoxBody>>,
B: MessageBody,
X: Service<Request, Response = Request>,
X::Error: Into<Response<BoxBody>>,
U: Service<(Request, Framed<T, Codec>), Response = ()>,
U::Error: fmt::Display,
{
Normal {
#[pin]
inner: InnerDispatcher<T, S, B, X, U>,
},
Upgrade {
#[pin]
fut: U::Future,
},
}
}
#[cfg(test)]
pin_project! {
/// Dispatcher for HTTP/1.1 protocol
@ -122,6 +96,26 @@ pin_project! {
}
}
pin_project! {
#[project = DispatcherStateProj]
enum DispatcherState<T, S, B, X, U>
where
S: Service<Request>,
S::Error: Into<Response<BoxBody>>,
B: MessageBody,
X: Service<Request, Response = Request>,
X::Error: Into<Response<BoxBody>>,
U: Service<(Request, Framed<T, Codec>), Response = ()>,
U::Error: fmt::Display,
{
Normal { #[pin] inner: InnerDispatcher<T, S, B, X, U> },
Upgrade { #[pin] fut: U::Future },
}
}
pin_project! {
#[project = InnerDispatcherProj]
struct InnerDispatcher<T, S, B, X, U>