diff --git a/actix-http/examples/hello-world.rs b/actix-http/examples/hello-world.rs index 85994556d..c1a942894 100644 --- a/actix-http/examples/hello-world.rs +++ b/actix-http/examples/hello-world.rs @@ -1,6 +1,6 @@ use std::{env, io}; -use actix_http::{http::StatusCode, HttpService, Response}; +use actix_http::{http::StatusCode, Error, HttpService, Response}; use actix_server::Server; use actix_utils::future; use http::header::HeaderValue; @@ -23,7 +23,7 @@ async fn main() -> io::Result<()> { "x-head", HeaderValue::from_static("dummy value!"), )); - future::ok::<_, ()>(res.body("Hello world!")) + future::ok::<_, Error>(res.body("Hello world!")) }) .tcp() })? diff --git a/actix-test/src/lib.rs b/actix-test/src/lib.rs index 8fab33289..76b1c6eda 100644 --- a/actix-test/src/lib.rs +++ b/actix-test/src/lib.rs @@ -36,13 +36,14 @@ use std::{fmt, net, sync::mpsc, thread, time}; use actix_codec::{AsyncRead, AsyncWrite, Framed}; pub use actix_http::test::TestBuffer; use actix_http::{ + body::Body, http::{HeaderMap, Method}, ws, HttpService, Request, Response, }; use actix_service::{map_config, IntoServiceFactory, ServiceFactory}; use actix_web::{ dev::{AppConfig, MessageBody, Server, Service}, - rt, web, Error, + rt, web, }; use awc::{error::PayloadError, Client, ClientRequest, ClientResponse, Connector}; use futures_core::Stream; @@ -81,7 +82,7 @@ where F: Fn() -> I + Send + Clone + 'static, I: IntoServiceFactory, S: ServiceFactory + 'static, - S::Error: Into + 'static, + S::Error: Into> + 'static, S::InitError: fmt::Debug, S::Response: Into> + 'static, >::Future: 'static, @@ -120,7 +121,7 @@ where F: Fn() -> I + Send + Clone + 'static, I: IntoServiceFactory, S: ServiceFactory + 'static, - S::Error: Into + 'static, + S::Error: Into> + 'static, S::InitError: fmt::Debug, S::Response: Into> + 'static, >::Future: 'static, diff --git a/awc/tests/test_ws.rs b/awc/tests/test_ws.rs index bfc81afbc..64764ae55 100644 --- a/awc/tests/test_ws.rs +++ b/awc/tests/test_ws.rs @@ -33,7 +33,9 @@ async fn test_simple() { // start WebSocket service let framed = framed.replace_codec(ws::Codec::new()); - ws::Dispatcher::with(framed, ws_service).await + ws::Dispatcher::with(framed, ws_service) + .await + .map_err(Error::from) } }) .finish(|_| ok::<_, Error>(Response::not_found())) diff --git a/src/server.rs b/src/server.rs index 6577f4d1f..e75df87b3 100644 --- a/src/server.rs +++ b/src/server.rs @@ -7,7 +7,8 @@ use std::{ }; use actix_http::{ - body::MessageBody, Error, Extensions, HttpService, KeepAlive, Request, Response, + body::{Body, MessageBody}, + Extensions, HttpService, KeepAlive, Request, Response, }; use actix_server::{Server, ServerBuilder}; use actix_service::{map_config, IntoServiceFactory, Service, ServiceFactory}; @@ -53,7 +54,7 @@ where F: Fn() -> I + Send + Clone + 'static, I: IntoServiceFactory, S: ServiceFactory, - S::Error: Into, + S::Error: Into>, S::InitError: fmt::Debug, S::Response: Into>, B: MessageBody, @@ -74,7 +75,7 @@ where S: ServiceFactory + 'static, // S::Future: 'static, - S::Error: Into + 'static, + S::Error: Into> + 'static, S::InitError: fmt::Debug, S::Response: Into> + 'static, >::Future: 'static, @@ -574,7 +575,7 @@ where F: Fn() -> I + Send + Clone + 'static, I: IntoServiceFactory, S: ServiceFactory, - S::Error: Into, + S::Error: Into>, S::InitError: fmt::Debug, S::Response: Into>, S::Service: 'static,