mirror of https://github.com/fafhrd91/actix-web
fmt
This commit is contained in:
parent
cd1eb5f627
commit
010b5dd66d
|
@ -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))]
|
#[cfg(not(test))]
|
||||||
pin_project! {
|
pin_project! {
|
||||||
/// Dispatcher for HTTP/1.1 protocol
|
/// 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)]
|
#[cfg(test)]
|
||||||
pin_project! {
|
pin_project! {
|
||||||
/// Dispatcher for HTTP/1.1 protocol
|
/// 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! {
|
pin_project! {
|
||||||
#[project = InnerDispatcherProj]
|
#[project = InnerDispatcherProj]
|
||||||
struct InnerDispatcher<T, S, B, X, U>
|
struct InnerDispatcher<T, S, B, X, U>
|
||||||
|
|
Loading…
Reference in New Issue