pub struct HttpConnector { /* private fields */ }
Expand description
A connector for the http
scheme.
Performs DNS resolution in a thread pool, and then connects over TCP.
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_handle(threads: usize, handle: Handle) -> HttpConnector
pub fn new_with_handle(threads: usize, handle: Handle) -> HttpConnector
Construct a new HttpConnector with a specific Tokio handle.
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 tasks on.
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_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_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
.
Trait Implementations§
Source§impl Clone for HttpConnector
impl Clone for HttpConnector
Source§fn clone(&self) -> HttpConnector
fn clone(&self) -> HttpConnector
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Connect for HttpConnector
impl Connect for HttpConnector
Auto Trait Implementations§
impl Freeze for HttpConnector
impl !RefUnwindSafe for HttpConnector
impl Send for HttpConnector
impl Sync for HttpConnector
impl Unpin for HttpConnector
impl !UnwindSafe for HttpConnector
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> 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>
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 more