Struct actix_http::HttpService [−][src]
pub struct HttpService<T, S, B, X = ExpectHandler, U = UpgradeHandler> { /* fields omitted */ }
Expand description
A ServiceFactory for HTTP/1.1 or HTTP/2 protocol.
Implementations
impl<S, B, X, U> HttpService<TlsStream<TcpStream>, S, B, X, U> where
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static,
X::Error: Into<Response<AnyBody>>,
X::InitError: Debug,
U: ServiceFactory<(Request, Framed<TlsStream<TcpStream>, Codec>), Config = (), Response = ()>,
U::Future: 'static,
U::Error: Display + Into<Response<AnyBody>>,
U::InitError: Debug,
impl<S, B, X, U> HttpService<TlsStream<TcpStream>, S, B, X, U> where
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static,
X::Error: Into<Response<AnyBody>>,
X::InitError: Debug,
U: ServiceFactory<(Request, Framed<TlsStream<TcpStream>, Codec>), Config = (), Response = ()>,
U::Future: 'static,
U::Error: Display + Into<Response<AnyBody>>,
U::InitError: Debug, pub fn openssl(
self,
acceptor: SslAcceptor
) -> impl ServiceFactory<TcpStream, Config = (), Response = (), Error = TlsError<SslError, DispatchError>, InitError = ()>
pub fn openssl(
self,
acceptor: SslAcceptor
) -> impl ServiceFactory<TcpStream, Config = (), Response = (), Error = TlsError<SslError, DispatchError>, InitError = ()>Create openssl based service
impl<S, B, X, U> HttpService<TlsStream<TcpStream>, S, B, X, U> where
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static,
X::Error: Into<Response<AnyBody>>,
X::InitError: Debug,
U: ServiceFactory<(Request, Framed<TlsStream<TcpStream>, Codec>), Config = (), Response = ()>,
U::Future: 'static,
U::Error: Display + Into<Response<AnyBody>>,
U::InitError: Debug,
impl<S, B, X, U> HttpService<TlsStream<TcpStream>, S, B, X, U> where
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static,
X::Error: Into<Response<AnyBody>>,
X::InitError: Debug,
U: ServiceFactory<(Request, Framed<TlsStream<TcpStream>, Codec>), Config = (), Response = ()>,
U::Future: 'static,
U::Error: Display + Into<Response<AnyBody>>,
U::InitError: Debug, pub fn rustls(
self,
config: ServerConfig
) -> impl ServiceFactory<TcpStream, Config = (), Response = (), Error = TlsError<Error, DispatchError>, InitError = ()>
pub fn rustls(
self,
config: ServerConfig
) -> impl ServiceFactory<TcpStream, Config = (), Response = (), Error = TlsError<Error, DispatchError>, InitError = ()>Create rustls based service
Create builder for HttpService instance.
impl<T, S, B> HttpService<T, S, B> where
S: ServiceFactory<Request, Config = ()>,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
impl<T, S, B> HttpService<T, S, B> where
S: ServiceFactory<Request, Config = ()>,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>, Create new HttpService instance.
Provide service for EXPECT: 100-Continue support.
Service get called with request that contains EXPECT header.
Service must return request in case of success, in that case
request will be forwarded to main service.
Provide service for custom Connection: UPGRADE support.
If service is provided then normal requests handling get halted and this service get called with original request and framed object.
impl<S, B, X, U> HttpService<TcpStream, S, B, X, U> where
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static,
X::Error: Into<Response<AnyBody>>,
X::InitError: Debug,
U: ServiceFactory<(Request, Framed<TcpStream, Codec>), Config = (), Response = ()>,
U::Future: 'static,
U::Error: Display + Into<Response<AnyBody>>,
U::InitError: Debug,
impl<S, B, X, U> HttpService<TcpStream, S, B, X, U> where
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static,
X::Error: Into<Response<AnyBody>>,
X::InitError: Debug,
U: ServiceFactory<(Request, Framed<TcpStream, Codec>), Config = (), Response = ()>,
U::Future: 'static,
U::Error: Display + Into<Response<AnyBody>>,
U::InitError: Debug, pub fn tcp(
self
) -> impl ServiceFactory<TcpStream, Config = (), Response = (), Error = DispatchError, InitError = ()>
pub fn tcp(
self
) -> impl ServiceFactory<TcpStream, Config = (), Response = (), Error = DispatchError, InitError = ()>Create simple tcp stream service
Trait Implementations
impl<T, S, B, X, U> ServiceFactory<(T, Protocol, Option<SocketAddr>)> for HttpService<T, S, B, X, U> where
T: AsyncRead + AsyncWrite + Unpin + 'static,
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static,
X::Error: Into<Response<AnyBody>>,
X::InitError: Debug,
U: ServiceFactory<(Request, Framed<T, Codec>), Config = (), Response = ()>,
U::Future: 'static,
U::Error: Display + Into<Response<AnyBody>>,
U::InitError: Debug,
impl<T, S, B, X, U> ServiceFactory<(T, Protocol, Option<SocketAddr>)> for HttpService<T, S, B, X, U> where
T: AsyncRead + AsyncWrite + Unpin + 'static,
S: ServiceFactory<Request, Config = ()>,
S::Future: 'static,
S::Error: Into<Response<AnyBody>> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static,
B::Error: Into<Box<dyn StdError>>,
X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static,
X::Error: Into<Response<AnyBody>>,
X::InitError: Debug,
U: ServiceFactory<(Request, Framed<T, Codec>), Config = (), Response = ()>,
U::Future: 'static,
U::Error: Display + Into<Response<AnyBody>>,
U::InitError: Debug, type Error = DispatchError
type Error = DispatchErrorErrors produced by the created services.
The kind of Service created by this factory.
type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>
type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>The future of the Service instance.g
Create and return a new service asynchronously.
Auto Trait Implementations
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler> !RefUnwindSafe for HttpService<T, S, B, X, U>impl<T, S, B, X = ExpectHandler, U = UpgradeHandler> !Send for HttpService<T, S, B, X, U>impl<T, S, B, X = ExpectHandler, U = UpgradeHandler> !Sync for HttpService<T, S, B, X, U>impl<T, S, B, X, U> Unpin for HttpService<T, S, B, X, U> where
B: Unpin,
S: Unpin,
U: Unpin,
X: Unpin, impl<T, S, B, X = ExpectHandler, U = UpgradeHandler> !UnwindSafe for HttpService<T, S, B, X, U>Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
Convert Self to a ServiceFactory
type Output = T
type Output = TShould always be Self
Map this service’s output to a different type, returning a new service of the resulting type. Read more
Map this service’s error to a different error, returning a new service.
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, Req, E> where
F: Fn(Self::InitError) -> E + Clone,
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, Req, E> where
F: Fn(Self::InitError) -> E + Clone, Map this factory’s init error to a different error, returning a new service.
Call another service after call to this one has resolved successfully.
pub fn vzip(self) -> V