Struct HttpConnector

Source
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

Source

pub fn new(threads: usize) -> HttpConnector

Construct a new HttpConnector.

Takes number of DNS worker threads.

Source

pub fn new_with_handle(threads: usize, handle: Handle) -> HttpConnector

Construct a new HttpConnector with a specific Tokio handle.

Source

pub fn new_with_executor<E>( executor: E, handle: Option<Handle>, ) -> HttpConnector
where E: Executor<HttpConnectorBlockingTask> + Send + Sync + 'static,

Construct a new HttpConnector.

Takes an executor to run blocking tasks on.

Source

pub fn enforce_http(&mut self, is_enforced: bool)

Option to enforce all Uris have the http scheme.

Enabled by default.

Source

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.

Source

pub fn set_nodelay(&mut self, nodelay: bool)

Set that all sockets have SO_NODELAY set to the supplied value nodelay.

Default is false.

Source

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

Source§

fn clone(&self) -> HttpConnector

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Connect for HttpConnector

Source§

type Transport = TcpStream

The connected IO Stream.
Source§

type Error = Error

An error occured when trying to connect.
Source§

type Future = HttpConnecting

A Future that will resolve to the connected Transport.
Source§

fn connect(&self, dst: Destination) -> Self::Future

Connect to a destination.
Source§

impl Debug for HttpConnector

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.