Module ffi

Source
Available on crate feature ffi and hyper_unstable_ffi only.
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, staring with 1.64.0, it can be compiled with the following command:

RUSTFLAGS="--cfg hyper_unstable_ffi" cargo rustc --crate-type cdylib --features client,http1,http2,ffi

Structs§

hyper_body
A streaming HTTP body.
hyper_buf
A buffer of bytes that is sent or received on a hyper_body.
hyper_clientconn
An HTTP client connection handle.
hyper_clientconn_options
An options builder to configure an HTTP client connection.
hyper_context
An async context for a task that contains the related waker.
hyper_error
A more detailed error object returned by some hyper functions.
hyper_executor
A task executor for hyper_tasks.
hyper_headers
An HTTP header map.
hyper_io
A read/write handle for a specific connection.
hyper_request
An HTTP request.
hyper_response
An HTTP response.
hyper_task
An async task.
hyper_waker
A waker that is saved and used to waken a pending task.

Enums§

hyper_code
A return code for many of hyper’s methods.
hyper_task_return_type
A descriptor for what type a hyper_task value is.

Constants§

HYPER_HTTP_VERSION_2
The HTTP/2 version.
HYPER_HTTP_VERSION_1_0
The HTTP/1.0 version.
HYPER_HTTP_VERSION_1_1
The HTTP/1.1 version.
HYPER_HTTP_VERSION_NONE
An HTTP Version that is unspecified.
HYPER_IO_ERROR
Sentinel value to return from a read or write callback that the operation has errored.
HYPER_IO_PENDING
Sentinel value to return from a read or write callback that the operation is pending.
HYPER_ITER_BREAK
Return in iter functions to stop iterating.
HYPER_ITER_CONTINUE
Return in iter functions to continue iterating.
HYPER_POLL_ERROR
Return in a poll function indicate an error.
HYPER_POLL_PENDING
Return in a poll function to indicate it is still pending.
HYPER_POLL_READY
Return in a poll function to indicate it was ready.

Functions§

hyper_body_data
Creates a task that will poll a response body for the next buffer of data.
hyper_body_foreach
Creates a task to execute the callback with each body chunk received.
hyper_body_free
Free a body.
hyper_body_new
Creates a new “empty” body.
hyper_body_set_data_func
Set the outgoing data callback for this body.
hyper_body_set_userdata
Set userdata on this body, which will be passed to callback functions.
hyper_buf_bytes
Get a pointer to the bytes in this buffer.
hyper_buf_copy
Create a new hyper_buf * by copying the provided bytes.
hyper_buf_free
Free this buffer.
hyper_buf_len
Get the length of the bytes this buffer contains.
hyper_clientconn_free
Free a hyper_clientconn *.
hyper_clientconn_handshake
Creates an HTTP client handshake task.
hyper_clientconn_options_exec
Set the client background task executor.
hyper_clientconn_options_free
Free a set of HTTP clientconn options.
hyper_clientconn_options_http2
Set whether to use HTTP2.
hyper_clientconn_options_http1_allow_multiline_headers
Set whether HTTP/1 connections accept obsolete line folding for header values.
hyper_clientconn_options_new
Creates a new set of HTTP clientconn options to be used in a handshake.
hyper_clientconn_options_set_preserve_header_case
Set whether header case is preserved.
hyper_clientconn_options_set_preserve_header_order
Set whether header order is preserved.
hyper_clientconn_send
Creates a task to send a request on the client connection.
hyper_context_waker
Creates a waker associated with the task context.
hyper_error_code
Get an equivalent hyper_code from this error.
hyper_error_free
Frees a hyper_error.
hyper_error_print
Print the details of this error to a buffer.
hyper_executor_free
Frees an executor and any incomplete tasks still part of it.
hyper_executor_new
Creates a new task executor.
hyper_executor_poll
Polls the executor, trying to make progress on any tasks that can do so.
hyper_executor_push
Push a task onto the executor.
hyper_headers_add
Adds the provided value to the list of the provided name.
hyper_headers_foreach
Iterates the headers passing each name and value pair to the callback.
hyper_headers_set
Sets the header with the provided name to the provided value.
hyper_io_free
Free an IO handle.
hyper_io_new
Create a new IO type used to represent a transport.
hyper_io_set_read
Set the read function for this IO transport.
hyper_io_set_userdata
Set the user data pointer for this IO to some value.
hyper_io_set_write
Set the write function for this IO transport.
hyper_request_free
Free an HTTP request.
hyper_request_headers
Gets a mutable reference to the HTTP headers of this request
hyper_request_new
Construct a new HTTP request.
hyper_request_on_informational
Set an informational (1xx) response callback.
hyper_request_set_body
Set the body of the request.
hyper_request_set_method
Set the HTTP Method of the request.
hyper_request_set_uri
Set the URI of the request.
hyper_request_set_uri_parts
Set the URI of the request with separate scheme, authority, and path/query strings.
hyper_request_set_version
Set the preferred HTTP version of the request.
hyper_response_body
Take ownership of the body of this response.
hyper_response_free
Free an HTTP response.
hyper_response_headers
Gets a reference to the HTTP headers of this response.
hyper_response_reason_phrase
Get a pointer to the reason-phrase of this response.
hyper_response_reason_phrase_len
Get the length of the reason-phrase of this response.
hyper_response_status
Get the HTTP-Status code of this response.
hyper_response_version
Get the HTTP version used by this response.
hyper_task_free
Free a task.
hyper_task_set_userdata
Set a user data pointer to be associated with this task.
hyper_task_type
Query the return type of this task.
hyper_task_userdata
Retrieve the userdata that has been set via hyper_task_set_userdata.
hyper_task_value
Takes the output value of this task.
hyper_version
Returns a static ASCII (null terminated) string of the hyper version.
hyper_waker_free
Free a waker.
hyper_waker_wake
Wake up the task associated with a waker.