Module hyper::ffi[][src]

Expand description

hyper C API

This part of the documentation describes the C API for hyper. That is, how to use the hyper library in C code. This is not a regular Rust module, and thus it is not accessible in Rust.

Unstable

The C API of hyper is currently unstable, which means it’s not part of the semver contract as the rest of the Rust API is. Because of that, it’s only accessible if --cfg hyper_unstable_ffi is passed to rustc when compiling. The easiest way to do that is setting the RUSTFLAGS environment variable.

Building

The C API is part of the Rust library, but isn’t compiled by default. Using cargo, it can be compiled with the following command:

RUSTFLAGS="--cfg hyper_unstable_ffi" cargo build --features client,http1,http2,ffi

Structs

A streaming HTTP body.

A buffer of bytes that is sent or received on a hyper_body.

An HTTP client connection handle.

An options builder to configure an HTTP client connection.

An async context for a task that contains the related waker.

A more detailed error object returned by some hyper functions.

A task executor for hyper_tasks.

An HTTP header map.

An IO object used to represent a socket or similar concept.

An HTTP request.

An HTTP response.

An async task.

A waker that is saved and used to waken a pending task.

Enums

A return code for many of hyper’s methods.

A descriptor for what type a hyper_task value is.

Constants

The HTTP/1.0 version.

The HTTP/1.1 version.

The HTTP/2 version.

An HTTP Version that is unspecified.

Sentinel value to return from a read or write callback that the operation has errored.

Sentinel value to return from a read or write callback that the operation is pending.

Return in iter functions to stop iterating.

Return in iter functions to continue iterating.

Return in a poll function indicate an error.

Return in a poll function to indicate it is still pending.

Return in a poll function to indicate it was ready.

Functions

Return a task that will poll the body for the next buffer of data.

Return a task that will poll the body and execute the callback with each body chunk that is received.

Free a hyper_body *.

Create a new “empty” body.

Set the data callback for this body.

Set userdata on this body, which will be passed to callback functions.

Get a pointer to the bytes in this buffer.

Create a new hyper_buf * by copying the provided bytes.

Free this buffer.

Get the length of the bytes this buffer contains.

Free a hyper_clientconn *.

Starts an HTTP client connection handshake using the provided IO transport and options.

Set the client background task executor.

Free a hyper_clientconn_options *.

Set the whether to include a copy of the raw headers in responses received on this connection.

Set the whether to use HTTP2.

Creates a new set of HTTP clientconn options to be used in a handshake.

Send a request on the client connection.

Copies a waker out of the task context.

Get an equivalent hyper_code from this error.

Frees a hyper_error.

Print the details of this error to a buffer.

Frees an executor and any incomplete tasks still part of it.

Creates a new task executor.

Polls the executor, trying to make progress on any tasks that have notified that they are ready again.

Push a task onto the executor.

Adds the provided value to the list of the provided name.

Iterates the headers passing each name and value pair to the callback.

Sets the header with the provided name to the provided value.

Free an unused hyper_io *.

Create a new IO type used to represent a transport.

Set the read function for this IO transport.

Set the user data pointer for this IO to some value.

Set the write function for this IO transport.

Free an HTTP request if not going to send it on a client.

Gets a reference to the HTTP headers of this request

Construct a new HTTP request.

Set an informational (1xx) response callback.

Set the body of the request.

Set the HTTP Method of the request.

Set the URI of the request.

Set the preferred HTTP version of the request.

Take ownership of the body of this response.

Free an HTTP response after using it.

Gets a reference to the HTTP headers of this response.

Get a reference to the full raw headers of this response.

Get a pointer to the reason-phrase of this response.

Get the length of the reason-phrase of this response.

Get the HTTP-Status code of this response.

Get the HTTP version used by this response.

Free a task.

Set a user data pointer to be associated with this task.

Query the return type of this task.

Retrieve the userdata that has been set via hyper_task_set_userdata.

Takes the output value of this task.

Returns a static ASCII (null terminated) string of the hyper version.

Free a waker that hasn’t been woken.

Wake up the task associated with a waker.