pub struct HttpServiceBuilder<T, S, X = ExpectHandler, U = UpgradeHandler> { /* private fields */ }
Expand description

An HTTP service builder.

This type can construct an instance of HttpService through a builder-like pattern.

Implementations§

Set connection keep-alive setting.

Applies to HTTP/1.1 keep-alive and HTTP/2 ping-pong.

By default keep-alive is 5 seconds.

Set connection secure state

Set the local address that this service is bound to.

Set client request timeout (for first request).

Defines a timeout for reading client request header. If the client does not transmit the request head within this duration, the connection is terminated with a 408 Request Timeout response error.

A duration of zero disables the timeout.

By default, the client timeout is 5 seconds.

Set client connection disconnect timeout.

Defines a timeout for disconnect connection. If a disconnect procedure does not complete within this time, the request get dropped. This timeout affects secure connections.

A duration of zero disables the timeout.

By default, the disconnect timeout is disabled.

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.

Sets the callback to be run on connection establishment.

Has mutable access to a data container that will be merged into request extensions. This enables transport layer data (like client certificates) to be accessed in middleware and handlers.

Finish service configuration and create a service for the HTTP/1 protocol.

Finish service configuration and create a service for the HTTP/2 protocol.

Finish service configuration and create HttpService instance.

Trait Implementations§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more