Struct awc::Connector [−][src]
pub struct Connector<T, U> { /* fields omitted */ }
Expand description
Manages http client network connectivity
The Connector
type uses a builder-like combinator pattern for service
construction that finishes by calling the .finish()
method.
use std::time::Duration;
use actix_http::client::Connector;
let connector = Connector::new()
.timeout(Duration::from_secs(5))
.finish();
Implementations
pub fn connector<T1, U1>(self, connector: T1) -> Connector<T1, U1> where
U1: AsyncRead + AsyncWrite + Unpin + Debug,
T1: Service<Request = Connect<Uri>, Response = Connection<Uri, U1>, Error = ConnectError> + Clone,
pub fn connector<T1, U1>(self, connector: T1) -> Connector<T1, U1> where
U1: AsyncRead + AsyncWrite + Unpin + Debug,
T1: Service<Request = Connect<Uri>, Response = Connection<Uri, U1>, Error = ConnectError> + Clone,
Use custom connector.
impl<T, U> Connector<T, U> where
U: AsyncRead + AsyncWrite + Unpin + Debug + 'static,
T: 'static + Service<Request = Connect<Uri>, Response = Connection<Uri, U>, Error = ConnectError> + Clone,
impl<T, U> Connector<T, U> where
U: AsyncRead + AsyncWrite + Unpin + Debug + 'static,
T: 'static + Service<Request = Connect<Uri>, Response = Connection<Uri, U>, Error = ConnectError> + Clone,
Connection timeout, i.e. max time to connect to remote host including dns name resolution. Set to 1 second by default.
Maximum supported http major version Supported versions http/1.1, http/2
Indicates the initial window size (in octets) for HTTP2 stream-level flow control for received data.
The default value is 65,535 and is good for APIs, but not for big objects.
Indicates the initial window size (in octets) for HTTP2 connection-level flow control for received data.
The default value is 65,535 and is good for APIs, but not for big objects.
Set total number of simultaneous connections per type of scheme.
If limit is 0, the connector has no limit. The default limit size is 100.
Set keep-alive period for opened connection.
Keep-alive period is the period between connection usage. If the delay between repeated usages of the same connection exceeds this period, the connection is closed. Default keep-alive period is 15 seconds.
Set max lifetime period for connection.
Connection lifetime is max lifetime of any opened connection until it is closed regardless of keep-alive period. Default lifetime period is 75 seconds.
Set server connection disconnect timeout in milliseconds.
Defines a timeout for disconnect connection. If a disconnect procedure does not complete within this time, the socket get dropped. This timeout affects only secure connections.
To disable timeout set value to 0.
By default disconnect timeout is set to 3000 milliseconds.
pub fn finish(
self
) -> impl Service<Request = Connect, Response = impl Connection, Error = ConnectError> + Clone
pub fn finish(
self
) -> impl Service<Request = Connect, Response = impl Connection, Error = ConnectError> + Clone
Finish configuration process and create connector service.
The Connector builder always concludes by calling finish()
last in
its combinator chain.
Auto Trait Implementations
impl<T, U> !RefUnwindSafe for Connector<T, U>
impl<T, U> !UnwindSafe for Connector<T, U>
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
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