Struct hyper::ffi::hyper_clientconn

source ·
pub struct hyper_clientconn { /* private fields */ }
Available on crate feature ffi and hyper_unstable_ffi only.
Expand description

An HTTP client connection handle.

These are used to send one or more requests on a single connection.

It’s possible to send multiple requests on a single connection, such as when HTTP/1 keep-alive or HTTP/2 is used.

To create a hyper_clientconn:

  1. Create a hyper_io with hyper_io_new.
  2. Create a hyper_clientconn_options with hyper_clientconn_options_new.
  3. Call hyper_clientconn_handshake with the hyper_io and hyper_clientconn_options. This creates a hyper_task.
  4. Call hyper_task_set_userdata to assign an application-specific pointer to the task. This allows keeping track of multiple connections that may be handshaking simultaneously.
  5. Add the hyper_task to an executor with hyper_executor_push.
  6. Poll that executor until it yields a task of type HYPER_TASK_CLIENTCONN.
  7. Extract the hyper_clientconn from the task with hyper_task_value. This will require a cast from void * to hyper_clientconn *.

This process results in a hyper_clientconn that permanently owns the hyper_io. Because the hyper_io in turn owns a TCP or TLS connection, that means the hyper_clientconn owns the connection for both the clientconn’s lifetime and the connection’s lifetime.

In other words, each connection (hyper_io) must have exactly one hyper_clientconn associated with it. That’s because hyper_clientconn_handshake sends the HTTP/2 Connection Preface (for HTTP/2 connections). Since that preface can’t be sent twice, handshake can’t be called twice.

Methods:

  • hyper_clientconn_handshake: Creates an HTTP client handshake task.
  • hyper_clientconn_send: Creates a task to send a request on the client connection.
  • hyper_clientconn_free: Free a hyper_clientconn *.

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

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

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more