pub struct HttpService<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> { /* private fields */ }
Expand description
ServiceFactory
HTTP1.1/HTTP2 transport implementation
Implementations§
Source§impl<T, S, B> HttpService<T, S, B>
impl<T, S, B> HttpService<T, S, B>
Sourcepub fn build() -> HttpServiceBuilder<T, S>
pub fn build() -> HttpServiceBuilder<T, S>
Create builder for HttpService
instance.
Source§impl<T, S, B> HttpService<T, S, B>
impl<T, S, B> HttpService<T, S, B>
Sourcepub fn new<F: IntoServiceFactory<S>>(service: F) -> Self
pub fn new<F: IntoServiceFactory<S>>(service: F) -> Self
Create new HttpService
instance.
Source§impl<T, S, B, X, U> HttpService<T, S, B, X, U>
impl<T, S, B, X, U> HttpService<T, S, B, X, U>
Sourcepub fn expect<X1>(self, expect: X1) -> HttpService<T, S, B, X1, U>
pub fn expect<X1>(self, expect: X1) -> HttpService<T, S, B, X1, U>
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.
Sourcepub fn upgrade<U1>(self, upgrade: Option<U1>) -> HttpService<T, S, B, X, U1>
pub fn upgrade<U1>(self, upgrade: Option<U1>) -> HttpService<T, S, B, X, U1>
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.
Source§impl<S, B, X, U> HttpService<TcpStream, S, B, X, U>where
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<TcpStream, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
impl<S, B, X, U> HttpService<TcpStream, S, B, X, U>where
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<TcpStream, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
Sourcepub fn tcp(
self,
) -> impl ServiceFactory<Config = (), Request = TcpStream, Response = (), Error = DispatchError, InitError = ()>
pub fn tcp( self, ) -> impl ServiceFactory<Config = (), Request = TcpStream, Response = (), Error = DispatchError, InitError = ()>
Create simple tcp stream service
Trait Implementations§
Source§impl<T, S, B, X, U> ServiceFactory for HttpService<T, S, B, X, U>where
T: AsyncRead + AsyncWrite + Unpin,
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<T, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
impl<T, S, B, X, U> ServiceFactory for HttpService<T, S, B, X, U>where
T: AsyncRead + AsyncWrite + Unpin,
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<T, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
Source§type Error = DispatchError
type Error = DispatchError
Errors produced by the service
Source§type Service = HttpServiceHandler<T, <S as ServiceFactory>::Service, B, <X as ServiceFactory>::Service, <U as ServiceFactory>::Service>
type Service = HttpServiceHandler<T, <S as ServiceFactory>::Service, B, <X as ServiceFactory>::Service, <U as ServiceFactory>::Service>
The
Service
value created by this factorySource§fn new_service(&self, _: ()) -> Self::Future
fn new_service(&self, _: ()) -> Self::Future
Create and return a new service value asynchronously.
Source§fn map<F, R>(self, f: F) -> MapServiceFactory<Self, F, R>
fn map<F, R>(self, f: F) -> MapServiceFactory<Self, F, R>
Map this service’s output to a different type, returning a new service
of the resulting type.
Source§fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, F, E>
fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, F, E>
Map this service’s error to a different error, returning a new service.
Source§fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, E>
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, E>
Map this factory’s init error to a different error, returning a new service.
Auto Trait Implementations§
impl<T, S, B, X, U> Freeze for HttpService<T, S, B, X, U>
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> !RefUnwindSafe for HttpService<T, S, B, X, U>
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> !Send for HttpService<T, S, B, X, U>
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> !Sync for HttpService<T, S, B, X, U>
impl<T, S, B, X, U> Unpin for HttpService<T, S, B, X, U>
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> !UnwindSafe for HttpService<T, S, B, X, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoServiceFactory<T> for Twhere
T: ServiceFactory,
impl<T> IntoServiceFactory<T> for Twhere
T: ServiceFactory,
Source§fn into_factory(self) -> T
fn into_factory(self) -> T
Convert
Self
to a ServiceFactory