1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-19 04:15:38 +02:00

add associated error type to MessageBody (#2183)

This commit is contained in:
Rob Ede
2021-05-05 18:36:02 +01:00
committed by GitHub
parent dd1a3e7675
commit ddaf8c3e43
27 changed files with 447 additions and 74 deletions

View File

@@ -40,7 +40,9 @@ where
S::Error: Into<Error> + 'static,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Error>,
{
/// Create new `H2Service` instance with config.
pub(crate) fn with_config<F: IntoServiceFactory<S, Request>>(
@@ -69,7 +71,9 @@ where
S::Error: Into<Error> + 'static,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Error>,
{
/// Create plain TCP based service
pub fn tcp(
@@ -106,7 +110,9 @@ mod openssl {
S::Error: Into<Error> + 'static,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Error>,
{
/// Create OpenSSL based service
pub fn openssl(
@@ -150,7 +156,9 @@ mod rustls {
S::Error: Into<Error> + 'static,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Error>,
{
/// Create Rustls based service
pub fn rustls(
@@ -185,12 +193,15 @@ mod rustls {
impl<T, S, B> ServiceFactory<(T, Option<net::SocketAddr>)> for H2Service<T, S, B>
where
T: AsyncRead + AsyncWrite + Unpin + 'static,
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Error> + 'static,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Error>,
{
type Response = ();
type Error = DispatchError;
@@ -252,6 +263,7 @@ where
S::Future: 'static,
S::Response: Into<Response<B>> + 'static,
B: MessageBody + 'static,
B::Error: Into<Error>,
{
type Response = ();
type Error = DispatchError;
@@ -316,6 +328,7 @@ where
S::Future: 'static,
S::Response: Into<Response<B>> + 'static,
B: MessageBody,
B::Error: Into<Error>,
{
type Output = Result<(), DispatchError>;