pub struct HttpConnector<R = GaiResolver> { /* private fields */ }
Expand description
Implementations§
Source§impl HttpConnector
impl HttpConnector
Sourcepub fn new(threads: usize) -> HttpConnector
pub fn new(threads: usize) -> HttpConnector
Construct a new HttpConnector.
Takes number of DNS worker threads.
Sourcepub fn new_with_executor<E>(
executor: E,
handle: Option<Handle>,
) -> HttpConnector
pub fn new_with_executor<E>( executor: E, handle: Option<Handle>, ) -> HttpConnector
Construct a new HttpConnector.
Takes an executor to run blocking getaddrinfo
tasks on.
Source§impl HttpConnector<TokioThreadpoolGaiResolver>
impl HttpConnector<TokioThreadpoolGaiResolver>
Sourcepub fn new_with_tokio_threadpool_resolver() -> HttpConnector<TokioThreadpoolGaiResolver>
pub fn new_with_tokio_threadpool_resolver() -> HttpConnector<TokioThreadpoolGaiResolver>
Construct a new HttpConnector using the TokioThreadpoolGaiResolver
.
This resolver requires the threadpool runtime to be used.
Source§impl<R> HttpConnector<R>
impl<R> HttpConnector<R>
Sourcepub fn new_with_resolver(resolver: R) -> HttpConnector<R>
pub fn new_with_resolver(resolver: R) -> HttpConnector<R>
Construct a new HttpConnector.
Takes a Resolve
to handle DNS lookups.
Sourcepub fn enforce_http(&mut self, is_enforced: bool)
pub fn enforce_http(&mut self, is_enforced: bool)
Option to enforce all Uri
s have the http
scheme.
Enabled by default.
Sourcepub fn set_reactor(&mut self, handle: Option<Handle>)
pub fn set_reactor(&mut self, handle: Option<Handle>)
Set a handle to a Reactor
to register connections to.
If None
, the implicit default reactor will be used.
Sourcepub fn set_keepalive(&mut self, dur: Option<Duration>)
pub fn set_keepalive(&mut self, dur: Option<Duration>)
Set that all sockets have SO_KEEPALIVE
set with the supplied duration.
If None
, the option will not be set.
Default is None
.
Sourcepub fn set_nodelay(&mut self, nodelay: bool)
pub fn set_nodelay(&mut self, nodelay: bool)
Set that all sockets have SO_NODELAY
set to the supplied value nodelay
.
Default is false
.
Sourcepub fn set_send_buffer_size(&mut self, size: Option<usize>)
pub fn set_send_buffer_size(&mut self, size: Option<usize>)
Sets the value of the SO_SNDBUF option on the socket.
Sourcepub fn set_recv_buffer_size(&mut self, size: Option<usize>)
pub fn set_recv_buffer_size(&mut self, size: Option<usize>)
Sets the value of the SO_RCVBUF option on the socket.
Sourcepub fn set_local_address(&mut self, addr: Option<IpAddr>)
pub fn set_local_address(&mut self, addr: Option<IpAddr>)
Set that all sockets are bound to the configured address before connection.
If None
, the sockets will not be bound.
Default is None
.
Sourcepub fn set_resolve_timeout(&mut self, dur: Option<Duration>)
pub fn set_resolve_timeout(&mut self, dur: Option<Duration>)
Set timeout for hostname resolution.
If None
, then no timeout is applied by the connector, making it
subject to the timeout imposed by the operating system.
Default is None
.
Sourcepub fn set_connect_timeout(&mut self, dur: Option<Duration>)
pub fn set_connect_timeout(&mut self, dur: Option<Duration>)
Set the connect timeout.
If a domain resolves to multiple IP addresses, the timeout will be evenly divided across them.
Default is None
.
Sourcepub fn set_happy_eyeballs_timeout(&mut self, dur: Option<Duration>)
pub fn set_happy_eyeballs_timeout(&mut self, dur: Option<Duration>)
Set timeout for RFC 6555 (Happy Eyeballs) algorithm.
If hostname resolves to both IPv4 and IPv6 addresses and connection cannot be established using preferred address family before timeout elapses, then connector will in parallel attempt connection using other address family.
If None
, parallel connection attempts are disabled.
Default is 300 milliseconds.
Sourcepub fn set_reuse_address(
&mut self,
reuse_address: bool,
) -> &mut HttpConnector<R>
pub fn set_reuse_address( &mut self, reuse_address: bool, ) -> &mut HttpConnector<R>
Set that all socket have SO_REUSEADDR
set to the supplied value reuse_address
.
Default is false
.
Trait Implementations§
Source§impl<R> Clone for HttpConnector<R>where
R: Clone,
impl<R> Clone for HttpConnector<R>where
R: Clone,
Source§fn clone(&self) -> HttpConnector<R>
fn clone(&self) -> HttpConnector<R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<R> Connect for HttpConnector<R>
impl<R> Connect for HttpConnector<R>
Source§fn connect(&self, dst: Destination) -> <HttpConnector<R> as Connect>::Future
fn connect(&self, dst: Destination) -> <HttpConnector<R> as Connect>::Future
Auto Trait Implementations§
impl<R> Freeze for HttpConnector<R>where
R: Freeze,
impl<R = GaiResolver> !RefUnwindSafe for HttpConnector<R>
impl<R> Send for HttpConnector<R>where
R: Send,
impl<R> Sync for HttpConnector<R>where
R: Sync,
impl<R> Unpin for HttpConnector<R>where
R: Unpin,
impl<R = GaiResolver> !UnwindSafe for HttpConnector<R>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more