Struct hyper::client::connect::HttpConnector[][src]

pub struct HttpConnector<R = GaiResolver> { /* fields omitted */ }
This is supported on crate features client and tcp only.
Expand description

A connector for the http scheme.

Performs DNS resolution in a thread pool, and then connects over TCP.

Note

Sets the HttpInfo value on responses, which includes transport information such as the remote socket address used.

Implementations

impl HttpConnector[src]

pub fn new() -> HttpConnector[src]

Construct a new HttpConnector.

impl<R> HttpConnector<R>[src]

pub fn new_with_resolver(resolver: R) -> HttpConnector<R>[src]

Construct a new HttpConnector.

Takes a Resolver to handle DNS lookups.

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

Option to enforce all Uris have the http scheme.

Enabled by default.

pub fn set_keepalive(&mut self, dur: Option<Duration>)[src]

Set that all sockets have SO_KEEPALIVE set with the supplied duration.

If None, the option will not be set.

Default is None.

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

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

Default is false.

pub fn set_send_buffer_size(&mut self, size: Option<usize>)[src]

Sets the value of the SO_SNDBUF option on the socket.

pub fn set_recv_buffer_size(&mut self, size: Option<usize>)[src]

Sets the value of the SO_RCVBUF option on the socket.

pub fn set_local_address(&mut self, addr: Option<IpAddr>)[src]

Set that all sockets are bound to the configured address before connection.

If None, the sockets will not be bound.

Default is None.

pub fn set_local_addresses(&mut self, addr_ipv4: Ipv4Addr, addr_ipv6: Ipv6Addr)[src]

Set that all sockets are bound to the configured IPv4 or IPv6 address (depending on host’s preferences) before connection.

pub fn set_connect_timeout(&mut self, dur: Option<Duration>)[src]

Set the connect timeout.

If a domain resolves to multiple IP addresses, the timeout will be evenly divided across them.

Default is None.

pub fn set_happy_eyeballs_timeout(&mut self, dur: Option<Duration>)[src]

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.

pub fn set_reuse_address(&mut self, reuse_address: bool) -> &mut Self[src]

Set that all socket have SO_REUSEADDR set to the supplied value reuse_address.

Default is false.

Trait Implementations

impl<R: Clone> Clone for HttpConnector<R>[src]

fn clone(&self) -> HttpConnector<R>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<R: Debug> Debug for HttpConnector<R>[src]

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

Formats the value using the given formatter. Read more

impl<R> Service<Uri> for HttpConnector<R> where
    R: Resolve + Clone + Send + Sync + 'static,
    R::Future: Send
[src]

type Response = TcpStream

Responses given by the service.

type Error = ConnectError

Errors produced by the service.

type Future = HttpConnecting<R>

The future response value.

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>[src]

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more

fn call(&mut self, dst: Uri) -> Self::Future[src]

Process the request and return the response asynchronously. Read more

Auto Trait Implementations

impl<R> RefUnwindSafe for HttpConnector<R> where
    R: RefUnwindSafe

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> UnwindSafe for HttpConnector<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.