diff --git a/Cargo.toml b/Cargo.toml index 4d2d783ef..ce26e82e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,9 @@ awc = { version = "2.0.0-alpha.1", default-features = false } bytes = "0.5.3" derive_more = "0.99.2" encoding_rs = "0.8" -futures = "0.3.1" +futures-channel = { version = "0.3.5", default-features = false } +futures-core = { version = "0.3.5", default-features = false } +futures-util = { version = "0.3.5", default-features = false } fxhash = "0.2.1" log = "0.4" mime = "0.3" diff --git a/actix-files/Cargo.toml b/actix-files/Cargo.toml index 60f92c5d9..ead2b51f5 100644 --- a/actix-files/Cargo.toml +++ b/actix-files/Cargo.toml @@ -23,7 +23,8 @@ actix-http = "2.0.0-alpha.3" actix-service = "1.0.1" bitflags = "1" bytes = "0.5.3" -futures = "0.3.1" +futures-core = { version = "0.3.5", default-features = false } +futures-util = { version = "0.3.5", default-features = false } derive_more = "0.99.2" log = "0.4" mime = "0.3" diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs index 27ec6c583..76c68ce25 100644 --- a/actix-files/src/lib.rs +++ b/actix-files/src/lib.rs @@ -24,8 +24,8 @@ use actix_web::http::header::{self, DispositionType}; use actix_web::http::Method; use actix_web::{web, FromRequest, HttpRequest, HttpResponse}; use bytes::Bytes; -use futures::future::{ok, ready, Either, FutureExt, LocalBoxFuture, Ready}; -use futures::Stream; +use futures_core::Stream; +use futures_util::future::{ok, ready, Either, FutureExt, LocalBoxFuture, Ready}; use mime; use mime_guess::from_ext; use percent_encoding::{utf8_percent_encode, CONTROLS}; diff --git a/actix-files/src/named.rs b/actix-files/src/named.rs index e05316904..6ee561a4b 100644 --- a/actix-files/src/named.rs +++ b/actix-files/src/named.rs @@ -18,7 +18,7 @@ use actix_web::http::header::{ }; use actix_web::http::{ContentEncoding, StatusCode}; use actix_web::{Error, HttpMessage, HttpRequest, HttpResponse, Responder}; -use futures::future::{ready, Ready}; +use futures_util::future::{ready, Ready}; use crate::range::HttpRange; use crate::ChunkedReadFile; diff --git a/actix-framed/Cargo.toml b/actix-framed/Cargo.toml index 94009db6f..ba7a01e0c 100644 --- a/actix-framed/Cargo.toml +++ b/actix-framed/Cargo.toml @@ -26,7 +26,7 @@ actix-rt = "1.0.0" actix-http = "2.0.0-alpha.3" bytes = "0.5.3" -futures = "0.3.1" +futures-util = { version = "0.3.5", default-features = false } pin-project = "0.4.6" log = "0.4" diff --git a/actix-framed/src/app.rs b/actix-framed/src/app.rs index e4b91e6c4..2fddbc039 100644 --- a/actix-framed/src/app.rs +++ b/actix-framed/src/app.rs @@ -8,7 +8,7 @@ use actix_http::h1::{Codec, SendResponse}; use actix_http::{Error, Request, Response}; use actix_router::{Path, Router, Url}; use actix_service::{IntoServiceFactory, Service, ServiceFactory}; -use futures::future::{ok, FutureExt, LocalBoxFuture}; +use futures_util::future::{ok, FutureExt, LocalBoxFuture}; use crate::helpers::{BoxedHttpNewService, BoxedHttpService, HttpNewService}; use crate::request::FramedRequest; diff --git a/actix-framed/src/helpers.rs b/actix-framed/src/helpers.rs index 29492e45b..d83736a52 100644 --- a/actix-framed/src/helpers.rs +++ b/actix-framed/src/helpers.rs @@ -2,7 +2,7 @@ use std::task::{Context, Poll}; use actix_http::Error; use actix_service::{Service, ServiceFactory}; -use futures::future::{FutureExt, LocalBoxFuture}; +use futures_util::future::{FutureExt, LocalBoxFuture}; pub(crate) type BoxedHttpService = Box< dyn Service< diff --git a/actix-framed/src/route.rs b/actix-framed/src/route.rs index 793f46273..7b9004b64 100644 --- a/actix-framed/src/route.rs +++ b/actix-framed/src/route.rs @@ -6,7 +6,7 @@ use std::task::{Context, Poll}; use actix_codec::{AsyncRead, AsyncWrite}; use actix_http::{http::Method, Error}; use actix_service::{Service, ServiceFactory}; -use futures::future::{ok, FutureExt, LocalBoxFuture, Ready}; +use futures_util::future::{ok, FutureExt, LocalBoxFuture, Ready}; use log::error; use crate::app::HttpServiceFactory; diff --git a/actix-framed/src/service.rs b/actix-framed/src/service.rs index 92393ca75..dd61f298d 100644 --- a/actix-framed/src/service.rs +++ b/actix-framed/src/service.rs @@ -1,3 +1,4 @@ +use std::future::Future; use std::marker::PhantomData; use std::pin::Pin; use std::task::{Context, Poll}; @@ -9,8 +10,7 @@ use actix_http::h1::{Codec, Message}; use actix_http::ws::{verify_handshake, HandshakeError}; use actix_http::{Request, Response}; use actix_service::{Service, ServiceFactory}; -use futures::future::{err, ok, Either, Ready}; -use futures::Future; +use futures_util::future::{err, ok, Either, Ready}; /// Service that verifies incoming request if it is valid websocket /// upgrade request. In case of error returns `HandshakeError` diff --git a/actix-framed/tests/test_server.rs b/actix-framed/tests/test_server.rs index 150fc10f3..ec6897861 100644 --- a/actix-framed/tests/test_server.rs +++ b/actix-framed/tests/test_server.rs @@ -4,7 +4,7 @@ use actix_http_test::test_server; use actix_service::{pipeline_factory, IntoServiceFactory, ServiceFactory}; use actix_utils::framed::Dispatcher; use bytes::Bytes; -use futures::{future, SinkExt, StreamExt}; +use futures_util::{future, SinkExt, StreamExt}; use actix_framed::{FramedApp, FramedRequest, FramedRoute, SendError, VerifyWebSockets}; diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 7e398f6fa..894bd44f8 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -56,9 +56,9 @@ copyless = "0.1.4" derive_more = "0.99.2" either = "1.5.3" encoding_rs = "0.8" -futures-core = "0.3.1" -futures-util = "0.3.1" -futures-channel = "0.3.1" +futures-channel = { version = "0.3.5", default-features = false } +futures-core = { version = "0.3.5", default-features = false } +futures-util = { version = "0.3.5", default-features = false } fxhash = "0.2.1" h2 = "0.2.1" http = "0.2.0" @@ -88,11 +88,10 @@ flate2 = { version = "1.0.13", optional = true } [dev-dependencies] actix-server = "1.0.1" -actix-connect = { version = "2.0.0-alpha.2", features=["openssl"] } -actix-http-test = { version = "1.0.0", features=["openssl"] } -actix-tls = { version = "2.0.0-alpha.1", features=["openssl"] } +actix-connect = { version = "2.0.0-alpha.2", features = ["openssl"] } +actix-http-test = { version = "1.0.0", features = ["openssl"] } +actix-tls = { version = "2.0.0-alpha.1", features = ["openssl"] } criterion = "0.3" -futures = "0.3.1" env_logger = "0.7" serde_derive = "1.0" open-ssl = { version="0.10", package = "openssl" } diff --git a/actix-http/examples/echo.rs b/actix-http/examples/echo.rs index b2b88a7ea..beb1cce2c 100644 --- a/actix-http/examples/echo.rs +++ b/actix-http/examples/echo.rs @@ -3,7 +3,7 @@ use std::{env, io}; use actix_http::{Error, HttpService, Request, Response}; use actix_server::Server; use bytes::BytesMut; -use futures::StreamExt; +use futures_util::StreamExt; use http::header::HeaderValue; use log::info; diff --git a/actix-http/examples/echo2.rs b/actix-http/examples/echo2.rs index f89ea2dfb..5b7e504d3 100644 --- a/actix-http/examples/echo2.rs +++ b/actix-http/examples/echo2.rs @@ -4,7 +4,7 @@ use actix_http::http::HeaderValue; use actix_http::{Error, HttpService, Request, Response}; use actix_server::Server; use bytes::BytesMut; -use futures::StreamExt; +use futures_util::StreamExt; use log::info; async fn handle_request(mut req: Request) -> Result { diff --git a/actix-http/examples/hello-world.rs b/actix-http/examples/hello-world.rs index 4134ee734..d6477b152 100644 --- a/actix-http/examples/hello-world.rs +++ b/actix-http/examples/hello-world.rs @@ -2,7 +2,7 @@ use std::{env, io}; use actix_http::{HttpService, Response}; use actix_server::Server; -use futures::future; +use futures_util::future; use http::header::HeaderValue; use log::info; diff --git a/actix-http/src/body.rs b/actix-http/src/body.rs index b821e777f..9d6fb26ee 100644 --- a/actix-http/src/body.rs +++ b/actix-http/src/body.rs @@ -482,7 +482,7 @@ where #[cfg(test)] mod tests { use super::*; - use futures::stream; + use futures_util::stream; use futures_util::future::poll_fn; use futures_util::pin_mut; diff --git a/actix-http/src/client/connection.rs b/actix-http/src/client/connection.rs index 0ca788b32..c1362df85 100644 --- a/actix-http/src/client/connection.rs +++ b/actix-http/src/client/connection.rs @@ -1,10 +1,11 @@ +use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use std::{fmt, io, mem, time}; use actix_codec::{AsyncRead, AsyncWrite, Framed}; use bytes::{Buf, Bytes}; -use futures_util::future::{err, Either, Future, FutureExt, LocalBoxFuture, Ready}; +use futures_util::future::{err, Either, FutureExt, LocalBoxFuture, Ready}; use h2::client::SendRequest; use pin_project::{pin_project, project}; diff --git a/actix-http/tests/test_client.rs b/actix-http/tests/test_client.rs index 5347971a6..07104decc 100644 --- a/actix-http/tests/test_client.rs +++ b/actix-http/tests/test_client.rs @@ -1,6 +1,6 @@ use actix_service::ServiceFactory; use bytes::Bytes; -use futures::future::{self, ok}; +use futures_util::future::{self, ok}; use actix_http::{http, HttpService, Request, Response}; use actix_http_test::test_server; diff --git a/actix-http/tests/test_openssl.rs b/actix-http/tests/test_openssl.rs index e8aaa7fc4..3a7bfa409 100644 --- a/actix-http/tests/test_openssl.rs +++ b/actix-http/tests/test_openssl.rs @@ -5,8 +5,8 @@ use actix_http_test::test_server; use actix_service::{fn_service, ServiceFactory}; use bytes::{Bytes, BytesMut}; -use futures::future::{err, ok, ready}; -use futures::stream::{once, Stream, StreamExt}; +use futures_util::future::{err, ok, ready}; +use futures_util::stream::{once, Stream, StreamExt}; use open_ssl::ssl::{AlpnError, SslAcceptor, SslFiletype, SslMethod}; use actix_http::error::{ErrorBadRequest, PayloadError}; diff --git a/actix-http/tests/test_rustls.rs b/actix-http/tests/test_rustls.rs index fff32ac8b..465cba6df 100644 --- a/actix-http/tests/test_rustls.rs +++ b/actix-http/tests/test_rustls.rs @@ -7,8 +7,8 @@ use actix_http_test::test_server; use actix_service::{fn_factory_with_config, fn_service}; use bytes::{Bytes, BytesMut}; -use futures::future::{self, err, ok}; -use futures::stream::{once, Stream, StreamExt}; +use futures_util::future::{self, err, ok}; +use futures_util::stream::{once, Stream, StreamExt}; use rust_tls::{ internal::pemfile::{certs, pkcs8_private_keys}, NoClientAuth, ServerConfig as RustlsServerConfig, diff --git a/actix-http/tests/test_server.rs b/actix-http/tests/test_server.rs index 35c71e37a..bee5ebef2 100644 --- a/actix-http/tests/test_server.rs +++ b/actix-http/tests/test_server.rs @@ -6,8 +6,8 @@ use actix_http_test::test_server; use actix_rt::time::delay_for; use actix_service::fn_service; use bytes::Bytes; -use futures::future::{self, err, ok, ready, FutureExt}; -use futures::stream::{once, StreamExt}; +use futures_util::future::{self, err, ok, ready, FutureExt}; +use futures_util::stream::{once, StreamExt}; use regex::Regex; use actix_http::httpmessage::HttpMessage; diff --git a/actix-http/tests/test_ws.rs b/actix-http/tests/test_ws.rs index 4b4b8f089..ff9def85b 100644 --- a/actix-http/tests/test_ws.rs +++ b/actix-http/tests/test_ws.rs @@ -1,4 +1,5 @@ use std::cell::Cell; +use std::future::Future; use std::marker::PhantomData; use std::pin::Pin; use std::sync::{Arc, Mutex}; @@ -9,9 +10,9 @@ use actix_http_test::test_server; use actix_service::{fn_factory, Service}; use actix_utils::framed::Dispatcher; use bytes::Bytes; -use futures::future; -use futures::task::{Context, Poll}; -use futures::{Future, SinkExt, StreamExt}; +use futures_util::future; +use futures_util::task::{Context, Poll}; +use futures_util::{SinkExt, StreamExt}; struct WsService(Arc, Cell)>>); diff --git a/actix-multipart/Cargo.toml b/actix-multipart/Cargo.toml index d8421d0eb..2fed60d33 100644 --- a/actix-multipart/Cargo.toml +++ b/actix-multipart/Cargo.toml @@ -22,7 +22,7 @@ actix-utils = "1.0.3" bytes = "0.5.3" derive_more = "0.99.2" httparse = "1.3" -futures = "0.3.1" +futures-util = { version = "0.3.5", default-features = false } log = "0.4" mime = "0.3" twoway = "0.2" diff --git a/actix-multipart/src/extractor.rs b/actix-multipart/src/extractor.rs index 71c815227..4e4caee01 100644 --- a/actix-multipart/src/extractor.rs +++ b/actix-multipart/src/extractor.rs @@ -1,6 +1,6 @@ //! Multipart payload support use actix_web::{dev::Payload, Error, FromRequest, HttpRequest}; -use futures::future::{ok, Ready}; +use futures_util::future::{ok, Ready}; use crate::server::Multipart; @@ -11,7 +11,7 @@ use crate::server::Multipart; /// ## Server example /// /// ```rust -/// use futures::{Stream, StreamExt}; +/// use futures_util::stream::{Stream, StreamExt}; /// use actix_web::{web, HttpResponse, Error}; /// use actix_multipart as mp; /// diff --git a/actix-multipart/src/server.rs b/actix-multipart/src/server.rs index 2555cb7a3..f96a7821a 100644 --- a/actix-multipart/src/server.rs +++ b/actix-multipart/src/server.rs @@ -8,7 +8,7 @@ use std::task::{Context, Poll}; use std::{cmp, fmt}; use bytes::{Bytes, BytesMut}; -use futures::stream::{LocalBoxStream, Stream, StreamExt}; +use futures_util::stream::{LocalBoxStream, Stream, StreamExt}; use httparse; use mime; @@ -814,7 +814,7 @@ mod tests { use actix_utils::mpsc; use actix_web::http::header::{DispositionParam, DispositionType}; use bytes::Bytes; - use futures::future::lazy; + use futures_util::future::lazy; #[actix_rt::test] async fn test_boundary() { diff --git a/actix-web-actors/Cargo.toml b/actix-web-actors/Cargo.toml index f9bcc65de..b62616958 100644 --- a/actix-web-actors/Cargo.toml +++ b/actix-web-actors/Cargo.toml @@ -21,9 +21,11 @@ actix-web = "3.0.0-alpha.2" actix-http = "2.0.0-alpha.3" actix-codec = "0.2.0" bytes = "0.5.2" -futures = "0.3.1" +futures-channel = { version = "0.3.5", default-features = false } +futures-core = { version = "0.3.5", default-features = false } pin-project = "0.4.6" [dev-dependencies] actix-rt = "1.0.0" env_logger = "0.7" +futures-util = { version = "0.3.5", default-features = false } diff --git a/actix-web-actors/src/context.rs b/actix-web-actors/src/context.rs index c889092d2..0839a4288 100644 --- a/actix-web-actors/src/context.rs +++ b/actix-web-actors/src/context.rs @@ -1,4 +1,5 @@ use std::collections::VecDeque; +use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; @@ -11,8 +12,8 @@ use actix::{ }; use actix_web::error::Error; use bytes::Bytes; -use futures::channel::oneshot::Sender; -use futures::{Future, Stream}; +use futures_channel::oneshot::Sender; +use futures_core::Stream; /// Execution context for http actors pub struct HttpContext diff --git a/actix-web-actors/src/ws.rs b/actix-web-actors/src/ws.rs index b28aeade4..3f5972532 100644 --- a/actix-web-actors/src/ws.rs +++ b/actix-web-actors/src/ws.rs @@ -1,5 +1,6 @@ //! Websocket integration use std::collections::VecDeque; +use std::future::Future; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; @@ -23,8 +24,8 @@ use actix_web::error::{Error, PayloadError}; use actix_web::http::{header, Method, StatusCode}; use actix_web::{HttpRequest, HttpResponse}; use bytes::{Bytes, BytesMut}; -use futures::channel::oneshot::Sender; -use futures::{Future, Stream}; +use futures_channel::oneshot::Sender; +use futures_core::Stream; /// Do websocket handshake and start ws actor. pub fn start(actor: A, req: &HttpRequest, stream: T) -> Result diff --git a/actix-web-actors/tests/test_ws.rs b/actix-web-actors/tests/test_ws.rs index 076e375d3..25977c2c2 100644 --- a/actix-web-actors/tests/test_ws.rs +++ b/actix-web-actors/tests/test_ws.rs @@ -2,7 +2,7 @@ use actix::prelude::*; use actix_web::{test, web, App, HttpRequest}; use actix_web_actors::*; use bytes::Bytes; -use futures::{SinkExt, StreamExt}; +use futures_util::{SinkExt, StreamExt}; struct Ws; diff --git a/actix-web-codegen/Cargo.toml b/actix-web-codegen/Cargo.toml index 835c9fcc9..c7b06e311 100644 --- a/actix-web-codegen/Cargo.toml +++ b/actix-web-codegen/Cargo.toml @@ -19,4 +19,4 @@ proc-macro2 = "^1" [dev-dependencies] actix-rt = "1.0.0" actix-web = "3.0.0-alpha.2" -futures = "0.3.1" +futures-util = { version = "0.3.5", default-features = false } diff --git a/actix-web-codegen/src/lib.rs b/actix-web-codegen/src/lib.rs index 39a8a6464..2a49b4714 100644 --- a/actix-web-codegen/src/lib.rs +++ b/actix-web-codegen/src/lib.rs @@ -33,7 +33,6 @@ //! ```rust //! use actix_web::HttpResponse; //! use actix_web_codegen::get; -//! use futures::{future, Future}; //! //! #[get("/test")] //! async fn async_test() -> Result { diff --git a/actix-web-codegen/tests/test_macro.rs b/actix-web-codegen/tests/test_macro.rs index 8264a7fd7..0ef7e1c75 100644 --- a/actix-web-codegen/tests/test_macro.rs +++ b/actix-web-codegen/tests/test_macro.rs @@ -1,10 +1,11 @@ +use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use actix_web::{http, test, web::Path, App, HttpResponse, Responder, Error}; use actix_web::dev::{Service, Transform, ServiceRequest, ServiceResponse}; use actix_web_codegen::{connect, delete, get, head, options, patch, post, put, trace}; -use futures::{future, Future}; +use futures_util::future; use actix_web::http::header::{HeaderName, HeaderValue}; // Make sure that we can name function as 'config' diff --git a/awc/Cargo.toml b/awc/Cargo.toml index 5ccf31654..c31c19025 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -42,7 +42,7 @@ actix-rt = "1.0.0" base64 = "0.11" bytes = "0.5.3" derive_more = "0.99.2" -futures-core = "0.3.1" +futures-core = { version = "0.3.5", default-features = false } log =" 0.4" mime = "0.3" percent-encoding = "2.1" @@ -63,6 +63,6 @@ actix-server = "1.0.0" actix-tls = { version = "2.0.0-alpha.1", features = ["openssl", "rustls"] } brotli2 = "0.3.2" flate2 = "1.0.13" -futures = "0.3.1" +futures-util = { version = "0.3.5", default-features = false } env_logger = "0.7" webpki = "0.21" diff --git a/awc/src/lib.rs b/awc/src/lib.rs index 952a15369..1cc31a194 100644 --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -7,7 +7,6 @@ //! An HTTP Client //! //! ```rust -//! use futures::future::{lazy, Future}; //! use actix_rt::System; //! use awc::Client; //! diff --git a/awc/src/request.rs b/awc/src/request.rs index 67b063a8e..21a7cd911 100644 --- a/awc/src/request.rs +++ b/awc/src/request.rs @@ -156,7 +156,7 @@ impl ClientRequest { /// /// ```rust /// fn main() { - /// # actix_rt::System::new("test").block_on(futures::future::lazy(|_| { + /// # actix_rt::System::new("test").block_on(futures_util::future::lazy(|_| { /// let req = awc::Client::new() /// .get("http://www.rust-lang.org") /// .set(awc::http::header::Date::now()) diff --git a/awc/src/response.rs b/awc/src/response.rs index 20093c72d..ffc8c5408 100644 --- a/awc/src/response.rs +++ b/awc/src/response.rs @@ -1,11 +1,12 @@ use std::cell::{Ref, RefMut}; use std::fmt; +use std::future::Future; use std::marker::PhantomData; use std::pin::Pin; use std::task::{Context, Poll}; use bytes::{Bytes, BytesMut}; -use futures_core::{ready, Future, Stream}; +use futures_core::{ready, Stream}; use actix_http::cookie::Cookie; use actix_http::error::{CookieParseError, PayloadError}; diff --git a/awc/src/sender.rs b/awc/src/sender.rs index 983e730e1..5e0f5beec 100644 --- a/awc/src/sender.rs +++ b/awc/src/sender.rs @@ -1,3 +1,4 @@ +use std::future::Future; use std::net; use std::pin::Pin; use std::rc::Rc; @@ -7,7 +8,7 @@ use std::time::Duration; use actix_rt::time::{delay_for, Delay}; use bytes::Bytes; use derive_more::From; -use futures_core::{Future, Stream}; +use futures_core::Stream; use serde::Serialize; use actix_http::body::{Body, BodyStream}; diff --git a/awc/tests/test_client.rs b/awc/tests/test_client.rs index 449734a9f..cc61f1006 100644 --- a/awc/tests/test_client.rs +++ b/awc/tests/test_client.rs @@ -9,7 +9,7 @@ use bytes::Bytes; use flate2::read::GzDecoder; use flate2::write::GzEncoder; use flate2::Compression; -use futures::future::ok; +use futures_util::future::ok; use rand::Rng; use actix_http::HttpService; diff --git a/awc/tests/test_rustls_client.rs b/awc/tests/test_rustls_client.rs index 7407a33fc..0c6be76d4 100644 --- a/awc/tests/test_rustls_client.rs +++ b/awc/tests/test_rustls_client.rs @@ -7,7 +7,7 @@ use actix_http_test::test_server; use actix_service::{map_config, pipeline_factory, ServiceFactory}; use actix_web::http::Version; use actix_web::{dev::AppConfig, web, App, HttpResponse}; -use futures::future::ok; +use futures_util::future::ok; use open_ssl::ssl::{SslAcceptor, SslFiletype, SslMethod, SslVerifyMode}; use rust_tls::ClientConfig; diff --git a/awc/tests/test_ssl_client.rs b/awc/tests/test_ssl_client.rs index 8e128ad0c..b2a2e1785 100644 --- a/awc/tests/test_ssl_client.rs +++ b/awc/tests/test_ssl_client.rs @@ -7,7 +7,7 @@ use actix_http_test::test_server; use actix_service::{map_config, pipeline_factory, ServiceFactory}; use actix_web::http::Version; use actix_web::{dev::AppConfig, web, App, HttpResponse}; -use futures::future::ok; +use futures_util::future::ok; use open_ssl::ssl::{SslAcceptor, SslConnector, SslFiletype, SslMethod, SslVerifyMode}; fn ssl_acceptor() -> SslAcceptor { diff --git a/awc/tests/test_ws.rs b/awc/tests/test_ws.rs index 779a4301c..d3f66814f 100644 --- a/awc/tests/test_ws.rs +++ b/awc/tests/test_ws.rs @@ -4,8 +4,8 @@ use actix_codec::Framed; use actix_http::{body::BodySize, h1, ws, Error, HttpService, Request, Response}; use actix_http_test::test_server; use bytes::Bytes; -use futures::future::ok; -use futures::{SinkExt, StreamExt}; +use futures_util::future::ok; +use futures_util::{SinkExt, StreamExt}; async fn ws_service(req: ws::Frame) -> Result { match req { diff --git a/benches/server.rs b/benches/server.rs index 93079a223..70531adf7 100644 --- a/benches/server.rs +++ b/benches/server.rs @@ -1,7 +1,7 @@ use actix_web::{test, web, App, HttpResponse}; use awc::Client; use criterion::{criterion_group, criterion_main, Criterion}; -use futures::future::join_all; +use futures_util::future::join_all; const STR: &str = "Hello World Hello World Hello World Hello World Hello World \ Hello World Hello World Hello World Hello World Hello World \ diff --git a/src/app.rs b/src/app.rs index 7d3100db7..9e38f5bc9 100644 --- a/src/app.rs +++ b/src/app.rs @@ -10,7 +10,7 @@ use actix_service::boxed::{self, BoxServiceFactory}; use actix_service::{ apply, apply_fn_factory, IntoServiceFactory, ServiceFactory, Transform, }; -use futures::future::FutureExt; +use futures_util::future::FutureExt; use crate::app_service::{AppEntry, AppInit, AppRoutingFactory}; use crate::config::ServiceConfig; @@ -474,7 +474,7 @@ where mod tests { use actix_service::Service; use bytes::Bytes; - use futures::future::{ok, err}; + use futures_util::future::{ok, err}; use super::*; use crate::http::{header, HeaderValue, Method, StatusCode}; diff --git a/src/app_service.rs b/src/app_service.rs index 693624ba0..233cfc0d5 100644 --- a/src/app_service.rs +++ b/src/app_service.rs @@ -9,7 +9,7 @@ use actix_http::{Extensions, Request, Response}; use actix_router::{Path, ResourceDef, ResourceInfo, Router, Url}; use actix_service::boxed::{self, BoxService, BoxServiceFactory}; use actix_service::{fn_service, Service, ServiceFactory}; -use futures::future::{join_all, ok, FutureExt, LocalBoxFuture}; +use futures_util::future::{join_all, ok, FutureExt, LocalBoxFuture}; use crate::config::{AppConfig, AppService}; use crate::data::{DataFactory, FnDataFactory}; diff --git a/src/data.rs b/src/data.rs index e657d8b7b..34ada863d 100644 --- a/src/data.rs +++ b/src/data.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use actix_http::error::{Error, ErrorInternalServerError}; use actix_http::Extensions; -use futures::future::{err, ok, LocalBoxFuture, Ready}; +use futures_util::future::{err, ok, LocalBoxFuture, Ready}; use crate::dev::Payload; use crate::extract::FromRequest; diff --git a/src/extract.rs b/src/extract.rs index 5289bd7db..df9c34cb3 100644 --- a/src/extract.rs +++ b/src/extract.rs @@ -4,7 +4,7 @@ use std::pin::Pin; use std::task::{Context, Poll}; use actix_http::error::Error; -use futures::future::{ok, FutureExt, LocalBoxFuture, Ready}; +use futures_util::future::{ok, FutureExt, LocalBoxFuture, Ready}; use crate::dev::Payload; use crate::request::HttpRequest; @@ -50,7 +50,7 @@ pub trait FromRequest: Sized { /// ```rust /// use actix_web::{web, dev, App, Error, HttpRequest, FromRequest}; /// use actix_web::error::ErrorBadRequest; -/// use futures::future::{ok, err, Ready}; +/// use futures_util::future::{ok, err, Ready}; /// use serde_derive::Deserialize; /// use rand; /// @@ -122,7 +122,7 @@ where /// ```rust /// use actix_web::{web, dev, App, Result, Error, HttpRequest, FromRequest}; /// use actix_web::error::ErrorBadRequest; -/// use futures::future::{ok, err, Ready}; +/// use futures_util::future::{ok, err, Ready}; /// use serde_derive::Deserialize; /// use rand; /// diff --git a/src/handler.rs b/src/handler.rs index 33cd2408d..669512ab3 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -6,8 +6,8 @@ use std::task::{Context, Poll}; use actix_http::{Error, Response}; use actix_service::{Service, ServiceFactory}; -use futures::future::{ok, Ready}; -use futures::ready; +use futures_util::future::{ok, Ready}; +use futures_util::ready; use pin_project::pin_project; use crate::extract::FromRequest; diff --git a/src/middleware/compress.rs b/src/middleware/compress.rs index 70006ab3c..6de451c84 100644 --- a/src/middleware/compress.rs +++ b/src/middleware/compress.rs @@ -11,7 +11,7 @@ use actix_http::encoding::Encoder; use actix_http::http::header::{ContentEncoding, ACCEPT_ENCODING}; use actix_http::Error; use actix_service::{Service, Transform}; -use futures::future::{ok, Ready}; +use futures_util::future::{ok, Ready}; use pin_project::pin_project; use crate::dev::BodyEncoding; @@ -133,7 +133,7 @@ where fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); - match futures::ready!(this.fut.poll(cx)) { + match futures_util::ready!(this.fut.poll(cx)) { Ok(resp) => { let enc = if let Some(enc) = resp.response().get_encoding() { enc diff --git a/src/middleware/condition.rs b/src/middleware/condition.rs index 8c6909134..7ff81437b 100644 --- a/src/middleware/condition.rs +++ b/src/middleware/condition.rs @@ -2,7 +2,7 @@ use std::task::{Context, Poll}; use actix_service::{Service, Transform}; -use futures::future::{ok, Either, FutureExt, LocalBoxFuture}; +use futures_util::future::{ok, Either, FutureExt, LocalBoxFuture}; /// `Middleware` for conditionally enables another middleware. /// The controlled middleware must not change the `Service` interfaces. diff --git a/src/middleware/defaultheaders.rs b/src/middleware/defaultheaders.rs index ba001c77b..ef2e56e69 100644 --- a/src/middleware/defaultheaders.rs +++ b/src/middleware/defaultheaders.rs @@ -4,7 +4,7 @@ use std::rc::Rc; use std::task::{Context, Poll}; use actix_service::{Service, Transform}; -use futures::future::{ok, FutureExt, LocalBoxFuture, Ready}; +use futures_util::future::{ok, FutureExt, LocalBoxFuture, Ready}; use crate::http::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use crate::http::{Error as HttpError, HeaderMap}; @@ -157,7 +157,7 @@ where #[cfg(test)] mod tests { use actix_service::IntoService; - use futures::future::ok; + use futures_util::future::ok; use super::*; use crate::dev::ServiceRequest; diff --git a/src/middleware/errhandlers.rs b/src/middleware/errhandlers.rs index 71886af0b..93a5d3f22 100644 --- a/src/middleware/errhandlers.rs +++ b/src/middleware/errhandlers.rs @@ -3,7 +3,7 @@ use std::rc::Rc; use std::task::{Context, Poll}; use actix_service::{Service, Transform}; -use futures::future::{ok, FutureExt, LocalBoxFuture, Ready}; +use futures_util::future::{ok, FutureExt, LocalBoxFuture, Ready}; use fxhash::FxHashMap; use crate::dev::{ServiceRequest, ServiceResponse}; @@ -147,7 +147,7 @@ where #[cfg(test)] mod tests { use actix_service::IntoService; - use futures::future::ok; + use futures_util::future::ok; use super::*; use crate::http::{header::CONTENT_TYPE, HeaderValue, StatusCode}; diff --git a/src/middleware/logger.rs b/src/middleware/logger.rs index d6b931bb4..e63efc832 100644 --- a/src/middleware/logger.rs +++ b/src/middleware/logger.rs @@ -11,7 +11,7 @@ use std::task::{Context, Poll}; use actix_service::{Service, Transform}; use bytes::Bytes; -use futures::future::{ok, Ready}; +use futures_util::future::{ok, Ready}; use log::debug; use regex::Regex; use time::OffsetDateTime; @@ -216,7 +216,7 @@ where fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); - let res = match futures::ready!(this.fut.poll(cx)) { + let res = match futures_util::ready!(this.fut.poll(cx)) { Ok(res) => res, Err(e) => return Poll::Ready(Err(e)), }; @@ -506,7 +506,7 @@ impl<'a> fmt::Display for FormatDisplay<'a> { #[cfg(test)] mod tests { use actix_service::{IntoService, Service, Transform}; - use futures::future::ok; + use futures_util::future::ok; use super::*; use crate::http::{header, StatusCode}; diff --git a/src/middleware/normalize.rs b/src/middleware/normalize.rs index 38b5310f7..139ec892e 100644 --- a/src/middleware/normalize.rs +++ b/src/middleware/normalize.rs @@ -4,7 +4,7 @@ use std::task::{Context, Poll}; use actix_http::http::{PathAndQuery, Uri}; use actix_service::{Service, Transform}; use bytes::Bytes; -use futures::future::{ok, Ready}; +use futures_util::future::{ok, Ready}; use regex::Regex; use crate::service::{ServiceRequest, ServiceResponse}; diff --git a/src/request.rs b/src/request.rs index 72fea1faf..f8abeb1bb 100644 --- a/src/request.rs +++ b/src/request.rs @@ -5,7 +5,7 @@ use std::{fmt, net}; use actix_http::http::{HeaderMap, Method, Uri, Version}; use actix_http::{Error, Extensions, HttpMessage, Message, Payload, RequestHead}; use actix_router::{Path, Url}; -use futures::future::{ok, Ready}; +use futures_util::future::{ok, Ready}; use tinyvec::TinyVec; use crate::config::AppConfig; diff --git a/src/resource.rs b/src/resource.rs index 4c0e26c18..5da1de62f 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -11,7 +11,7 @@ use actix_service::boxed::{self, BoxService, BoxServiceFactory}; use actix_service::{ apply, apply_fn_factory, IntoServiceFactory, Service, ServiceFactory, Transform, }; -use futures::future::{ok, Either, LocalBoxFuture, Ready}; +use futures_util::future::{ok, Either, LocalBoxFuture, Ready}; use crate::data::Data; use crate::dev::{insert_slash, AppService, HttpServiceFactory, ResourceDef}; @@ -588,7 +588,7 @@ mod tests { use actix_rt::time::delay_for; use actix_service::Service; - use futures::future::ok; + use futures_util::future::ok; use crate::http::{header, HeaderValue, Method, StatusCode}; use crate::middleware::DefaultHeaders; diff --git a/src/responder.rs b/src/responder.rs index 7189eecf1..367c9fccf 100644 --- a/src/responder.rs +++ b/src/responder.rs @@ -10,8 +10,8 @@ use actix_http::http::{ }; use actix_http::{Error, Response, ResponseBuilder}; use bytes::{Bytes, BytesMut}; -use futures::future::{err, ok, Either as EitherFuture, Ready}; -use futures::ready; +use futures_util::future::{err, ok, Either as EitherFuture, Ready}; +use futures_util::ready; use pin_project::{pin_project, project}; use crate::request::HttpRequest; diff --git a/src/route.rs b/src/route.rs index 11455630c..8da9aec1b 100644 --- a/src/route.rs +++ b/src/route.rs @@ -5,7 +5,7 @@ use std::task::{Context, Poll}; use actix_http::{http::Method, Error}; use actix_service::{Service, ServiceFactory}; -use futures::future::{ready, FutureExt, LocalBoxFuture}; +use futures_util::future::{ready, FutureExt, LocalBoxFuture}; use crate::extract::FromRequest; use crate::guard::{self, Guard}; diff --git a/src/scope.rs b/src/scope.rs index 5afca61da..b9166a4bf 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -1,5 +1,6 @@ use std::cell::RefCell; use std::fmt; +use std::future::Future; use std::pin::Pin; use std::rc::Rc; use std::task::{Context, Poll}; @@ -10,7 +11,7 @@ use actix_service::boxed::{self, BoxService, BoxServiceFactory}; use actix_service::{ apply, apply_fn_factory, IntoServiceFactory, Service, ServiceFactory, Transform, }; -use futures::future::{ok, Either, Future, LocalBoxFuture, Ready}; +use futures_util::future::{ok, Either, LocalBoxFuture, Ready}; use crate::config::ServiceConfig; use crate::data::Data; @@ -666,7 +667,7 @@ impl ServiceFactory for ScopeEndpoint { mod tests { use actix_service::Service; use bytes::Bytes; - use futures::future::ok; + use futures_util::future::ok; use crate::dev::{Body, ResponseBody}; use crate::http::{header, HeaderValue, Method, StatusCode}; diff --git a/src/server.rs b/src/server.rs index 97dd9f7f7..248cd39b3 100644 --- a/src/server.rs +++ b/src/server.rs @@ -13,7 +13,7 @@ use actix_http::Protocol; #[cfg(unix)] use actix_service::pipeline_factory; #[cfg(unix)] -use futures::future::ok; +use futures_util::future::ok; #[cfg(feature = "openssl")] use actix_tls::openssl::{AlpnError, SslAcceptor, SslAcceptorBuilder}; diff --git a/src/service.rs b/src/service.rs index c0148a9b2..232a2f132 100644 --- a/src/service.rs +++ b/src/service.rs @@ -536,7 +536,7 @@ mod tests { use crate::test::{init_service, TestRequest}; use crate::{guard, http, web, App, HttpResponse}; use actix_service::Service; - use futures::future::ok; + use futures_util::future::ok; #[test] fn test_service_request() { diff --git a/src/test.rs b/src/test.rs index c8a738d83..79e351eb3 100644 --- a/src/test.rs +++ b/src/test.rs @@ -18,8 +18,9 @@ use actix_service::{ use awc::error::PayloadError; use awc::{Client, ClientRequest, ClientResponse, Connector}; use bytes::{Bytes, BytesMut}; -use futures::future::ok; -use futures::stream::{Stream, StreamExt}; +use futures_core::Stream; +use futures_util::future::ok; +use futures_util::StreamExt; use net2::TcpBuilder; use serde::de::DeserializeOwned; use serde::Serialize; diff --git a/src/types/form.rs b/src/types/form.rs index d917345e1..ca1a4b103 100644 --- a/src/types/form.rs +++ b/src/types/form.rs @@ -9,8 +9,8 @@ use std::{fmt, ops}; use actix_http::{Error, HttpMessage, Payload, Response}; use bytes::BytesMut; use encoding_rs::{Encoding, UTF_8}; -use futures::future::{err, ok, FutureExt, LocalBoxFuture, Ready}; -use futures::StreamExt; +use futures_util::future::{err, ok, FutureExt, LocalBoxFuture, Ready}; +use futures_util::StreamExt; use serde::de::DeserializeOwned; use serde::Serialize; diff --git a/src/types/json.rs b/src/types/json.rs index df8aa4fc6..f746fd432 100644 --- a/src/types/json.rs +++ b/src/types/json.rs @@ -7,8 +7,8 @@ use std::task::{Context, Poll}; use std::{fmt, ops}; use bytes::BytesMut; -use futures::future::{err, ok, FutureExt, LocalBoxFuture, Ready}; -use futures::StreamExt; +use futures_util::future::{err, ok, FutureExt, LocalBoxFuture, Ready}; +use futures_util::StreamExt; use serde::de::DeserializeOwned; use serde::Serialize; diff --git a/src/types/path.rs b/src/types/path.rs index a37cb8f12..82050171c 100644 --- a/src/types/path.rs +++ b/src/types/path.rs @@ -4,7 +4,7 @@ use std::{fmt, ops}; use actix_http::error::{Error, ErrorNotFound}; use actix_router::PathDeserializer; -use futures::future::{ready, Ready}; +use futures_util::future::{ready, Ready}; use serde::de; use crate::dev::Payload; diff --git a/src/types/payload.rs b/src/types/payload.rs index 449e6c5b0..bad33bfc6 100644 --- a/src/types/payload.rs +++ b/src/types/payload.rs @@ -8,8 +8,9 @@ use actix_http::error::{Error, ErrorBadRequest, PayloadError}; use actix_http::HttpMessage; use bytes::{Bytes, BytesMut}; use encoding_rs::UTF_8; -use futures::future::{err, ok, Either, FutureExt, LocalBoxFuture, Ready}; -use futures::{Stream, StreamExt}; +use futures_core::stream::Stream; +use futures_util::future::{err, ok, Either, FutureExt, LocalBoxFuture, Ready}; +use futures_util::StreamExt; use mime::Mime; use crate::dev; @@ -22,9 +23,10 @@ use crate::request::HttpRequest; /// ## Example /// /// ```rust -/// use futures::{Future, Stream, StreamExt}; /// use actix_web::{web, error, App, Error, HttpResponse}; -/// +/// use std::future::Future; +/// use futures_core::stream::Stream; +/// use futures_util::StreamExt; /// /// extract binary data from request /// async fn index(mut body: web::Payload) -> Result /// { @@ -70,8 +72,10 @@ impl Stream for Payload { /// ## Example /// /// ```rust -/// use futures::{Future, Stream, StreamExt}; /// use actix_web::{web, error, App, Error, HttpResponse}; +/// use std::future::Future; +/// use futures_core::stream::Stream; +/// use futures_util::StreamExt; /// /// /// extract binary data from request /// async fn index(mut body: web::Payload) -> Result diff --git a/src/types/query.rs b/src/types/query.rs index 73ea14f17..cf1a8930d 100644 --- a/src/types/query.rs +++ b/src/types/query.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use std::{fmt, ops}; use actix_http::error::Error; -use futures::future::{err, ok, Ready}; +use futures_util::future::{err, ok, Ready}; use serde::de; use crate::dev::Payload; diff --git a/src/types/readlines.rs b/src/types/readlines.rs index 82853381b..f03235377 100644 --- a/src/types/readlines.rs +++ b/src/types/readlines.rs @@ -5,7 +5,7 @@ use std::task::{Context, Poll}; use bytes::{Bytes, BytesMut}; use encoding_rs::{Encoding, UTF_8}; -use futures::Stream; +use futures_util::stream::Stream; use crate::dev::Payload; use crate::error::{PayloadError, ReadlinesError}; @@ -172,7 +172,7 @@ where #[cfg(test)] mod tests { - use futures::stream::StreamExt; + use futures_util::stream::StreamExt; use super::*; use crate::test::TestRequest; diff --git a/src/web.rs b/src/web.rs index f47cf865e..1d1174f41 100644 --- a/src/web.rs +++ b/src/web.rs @@ -1,11 +1,11 @@ //! Essentials helper functions and types for application registration. use actix_http::http::Method; use actix_router::IntoPattern; -use futures::Future; +use std::future::Future; pub use actix_http::Response as HttpResponse; pub use bytes::{Bytes, BytesMut}; -pub use futures::channel::oneshot::Canceled; +pub use futures_channel::oneshot::Canceled; use crate::error::BlockingError; use crate::extract::FromRequest; diff --git a/test-server/Cargo.toml b/test-server/Cargo.toml index f44ecc5fd..8357815c9 100644 --- a/test-server/Cargo.toml +++ b/test-server/Cargo.toml @@ -41,7 +41,7 @@ awc = "2.0.0-alpha.1" base64 = "0.11" bytes = "0.5.3" -futures = "0.3.1" +futures-core = { version = "0.3.5", default-features = false } http = "0.2.0" log = "0.4" env_logger = "0.6" diff --git a/test-server/src/lib.rs b/test-server/src/lib.rs index c36cc706f..4fa0ecc17 100644 --- a/test-server/src/lib.rs +++ b/test-server/src/lib.rs @@ -7,7 +7,7 @@ use actix_rt::{net::TcpStream, System}; use actix_server::{Server, ServiceFactory}; use awc::{error::PayloadError, ws, Client, ClientRequest, ClientResponse, Connector}; use bytes::Bytes; -use futures::Stream; +use futures_core::stream::Stream; use http::Method; use net2::TcpBuilder; diff --git a/tests/test_server.rs b/tests/test_server.rs index a4dfa65a0..926b211ee 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -1,3 +1,4 @@ +use std::future::Future; use std::io::{Read, Write}; use std::pin::Pin; use std::task::{Context, Poll}; @@ -11,7 +12,7 @@ use bytes::Bytes; use flate2::read::GzDecoder; use flate2::write::{GzEncoder, ZlibDecoder, ZlibEncoder}; use flate2::Compression; -use futures::{ready, Future}; +use futures_util::ready; use rand::{distributions::Alphanumeric, Rng}; use actix_web::dev::BodyEncoding; @@ -56,7 +57,7 @@ impl TestBody { } } -impl futures::Stream for TestBody { +impl futures_core::stream::Stream for TestBody { type Item = Result; fn poll_next(