pub struct HttpConnector<R = GaiResolver> { /* private fields */ }
Expand description
Implementations
sourceimpl 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: 'static>(
executor: E,
handle: Option<Handle>
) -> HttpConnector where
E: Executor<GaiTask> + Send + Sync,
pub fn new_with_executor<E: 'static>(
executor: E,
handle: Option<Handle>
) -> HttpConnector where
E: Executor<GaiTask> + Send + Sync,
Construct a new HttpConnector.
Takes an executor to run blocking getaddrinfo
tasks on.
sourceimpl HttpConnector<TokioThreadpoolGaiResolver>
impl HttpConnector<TokioThreadpoolGaiResolver>
sourcepub fn new_with_tokio_threadpool_resolver() -> Self
pub fn new_with_tokio_threadpool_resolver() -> Self
Construct a new HttpConnector using the TokioThreadpoolGaiResolver
.
This resolver requires the threadpool runtime to be used.
sourceimpl<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 Self
pub fn set_reuse_address(&mut self, reuse_address: bool) -> &mut Self
Set that all socket have SO_REUSEADDR
set to the supplied value reuse_address
.
Default is false
.
Trait Implementations
sourceimpl<R: Clone> Clone for HttpConnector<R>
impl<R: Clone> Clone for HttpConnector<R>
sourcefn clone(&self) -> HttpConnector<R>
fn clone(&self) -> HttpConnector<R>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more