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
hyper_body | A streaming HTTP body. |
hyper_buf | A buffer of bytes that is sent or received on a |
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_headers | An HTTP header map. |
hyper_io | An IO object used to represent a socket or similar concept. |
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 |
Constants
HYPER_HTTP_VERSION_1_0 | The HTTP/1.0 version. |
HYPER_HTTP_VERSION_1_1 | The HTTP/1.1 version. |
HYPER_HTTP_VERSION_2 | The HTTP/2 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 | Return a task that will poll the body for the next buffer of data. |
hyper_body_foreach | Return a task that will poll the body and execute the callback with each body chunk that is received. |
hyper_body_free | Free a |
hyper_body_new | Create a new “empty” body. |
hyper_body_set_data_func | Set the 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_free | Free this buffer. |
hyper_buf_len | Get the length of the bytes this buffer contains. |
hyper_clientconn_free | Free a |
hyper_clientconn_handshake | Starts an HTTP client connection handshake using the provided IO transport and options. |
hyper_clientconn_options_exec | Set the client background task executor. |
hyper_clientconn_options_free | Free a |
hyper_clientconn_options_http2 | Set the whether to use HTTP2. |
hyper_clientconn_options_new | Creates a new set of HTTP clientconn options to be used in a handshake. |
hyper_clientconn_send | Send a request on the client connection. |
hyper_context_waker | Copies a waker out of the task context. |
hyper_error_code | Get an equivalent |
hyper_error_free | Frees a |
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 have notified that they are ready again. |
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 unused |
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 if not going to send it on a client. |
hyper_request_headers | Gets a reference to the HTTP headers of this request |
hyper_request_new | Construct a new HTTP request. |
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_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 after using it. |
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_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 that hasn’t been woken. |
hyper_waker_wake | Free a waker that hasn’t been woken. |