1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-28 15:57:47 +02:00

Use immutable reference of service state. Update awc dns resolver. (#1905)

This commit is contained in:
fakeshadow
2021-02-06 17:00:40 -08:00
committed by GitHub
parent 20cf0094e5
commit 41bc04b1c4
65 changed files with 497 additions and 538 deletions

View File

@@ -1,5 +1,4 @@
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform};
@@ -8,7 +7,7 @@ use actix_web::{http, test, web::Path, App, Error, HttpResponse, Responder};
use actix_web_codegen::{
connect, delete, get, head, options, patch, post, put, route, trace,
};
use futures_util::future;
use futures_util::future::{self, LocalBoxFuture};
// Make sure that we can name function as 'config'
#[get("/config")]
@@ -117,14 +116,13 @@ where
{
type Response = ServiceResponse<B>;
type Error = Error;
#[allow(clippy::type_complexity)]
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>>>>;
type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.service.poll_ready(cx)
}
fn call(&mut self, req: ServiceRequest) -> Self::Future {
fn call(&self, req: ServiceRequest) -> Self::Future {
let fut = self.service.call(req);
Box::pin(async move {