1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-22 05:35:08 +02:00

simplify ExtractService's return type (#1842)

This commit is contained in:
fakeshadow
2020-12-20 10:20:29 +08:00
committed by GitHub
parent 79de04d862
commit 6cbf27508a
2 changed files with 10 additions and 30 deletions

View File

@@ -163,7 +163,7 @@ where
{
type Request = ServiceRequest;
type Response = ServiceResponse;
type Error = (Error, ServiceRequest);
type Error = Error;
type Config = ();
type Service = ExtractService<T, S>;
type InitError = ();
@@ -192,7 +192,7 @@ where
{
type Request = ServiceRequest;
type Response = ServiceResponse;
type Error = (Error, ServiceRequest);
type Error = Error;
type Future = ExtractResponse<T, S>;
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
@@ -220,7 +220,7 @@ where
Error = Infallible,
>,
{
type Output = Result<ServiceResponse, (Error, ServiceRequest)>;
type Output = Result<ServiceResponse, Error>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
loop {
@@ -231,7 +231,7 @@ where
match res {
Err(e) => {
let req = ServiceRequest::new(req);
return Poll::Ready(Err((e.into(), req)));
return Poll::Ready(Ok(req.error_response(e.into())));
}
Ok(item) => {
let fut = srv.call((item, req));