Skip to main content

Crate eggfetch_ffi

Crate eggfetch_ffi 

Source
Expand description

C ABI bindings for eggfetch-core.

This crate exposes eggfetch-core as a C-compatible library for consumption by Node.js (N-API), Ruby (FFI), Zig, or any language that can call C ABI functions. All operations are blocking — the internal tokio runtime handles async I/O transparently.

§Thread Safety

  • ClientHandle is Send + Sync and may be shared across threads.
  • RequestHandle, ResponseHandle, and ErrorHandle are single-thread, single-use. Create, use, and free them on one thread.
  • StreamingResponseHandle holds thread-safe shared state (Arc<StreamState>): next may block on one thread while another thread cancels, but each stream is still single-use (consume or cancel, then free).
  • All callback functions must be extern "C".

Structs§

ClientBuilderHandle
Opaque handle to a client builder.
ClientHandle
Opaque handle to an HTTP client.
ErrorHandle
Opaque handle to an error.
FfiString
Owned C string returned by FFI. Must be freed with eggfetch_string_free.
RequestHandle
Opaque handle to a request builder.
ResponseHandle
Opaque handle to a completed response.
StreamChunk
A single chunk from a streaming response.
StreamingResponseHandle
Opaque handle to a streaming response.

Functions§

eggfetch_body_free⚠
Free a body buffer allocated by eggfetch_response_body.
eggfetch_client_builder_automatic_decompression⚠
Enable or disable automatic decompression.
eggfetch_client_builder_basic_auth⚠
Set a basic auth credential on the client.
eggfetch_client_builder_bearer_auth⚠
Set a bearer auth token on the client.
eggfetch_client_builder_build⚠
Build a client from the configured builder.
eggfetch_client_builder_connect_timeout⚠
Set the connect timeout in seconds.
eggfetch_client_builder_danger_accept_invalid_certs⚠
Enable or disable insecure TLS (skip certificate verification).
eggfetch_client_builder_default_header⚠
Add a default header to all requests.
eggfetch_client_builder_follow_redirects⚠
Enable or disable automatic redirect following.
eggfetch_client_builder_free⚠
Free a client builder handle.
eggfetch_client_builder_http_version⚠
Set the HTTP version policy.
eggfetch_client_builder_max_decoded_body_size⚠
Set the maximum decoded body size in bytes.
eggfetch_client_builder_max_decompression_ratio⚠
Set the maximum decompression ratio.
eggfetch_client_builder_max_idle_connections⚠
Set the maximum number of idle connections in the pool.
eggfetch_client_builder_max_idle_connections_per_host⚠
Set the maximum number of idle connections per host.
eggfetch_client_builder_max_redirects⚠
Set the maximum number of redirects to follow.
eggfetch_client_builder_new⚠
Create a new client builder with default settings.
eggfetch_client_builder_read_timeout⚠
Set the read timeout in seconds.
eggfetch_client_builder_timeout⚠
Set the overall request timeout in seconds.
eggfetch_client_builder_user_agent⚠
Set the User-Agent header.
eggfetch_client_builder_write_timeout⚠
Set the write timeout in seconds.
eggfetch_client_delete⚠
Convenience: begin a DELETE request.
eggfetch_client_free⚠
Free a client handle.
eggfetch_client_get⚠
Convenience: begin a GET request.
eggfetch_client_head⚠
Convenience: begin a HEAD request.
eggfetch_client_new⚠
Create a new client with default settings.
eggfetch_client_options⚠
Convenience: begin an OPTIONS request.
eggfetch_client_patch⚠
Convenience: begin a PATCH request.
eggfetch_client_post⚠
Convenience: begin a POST request.
eggfetch_client_put⚠
Convenience: begin a PUT request.
eggfetch_client_request⚠
Begin constructing a request with the given HTTP method and URL.
eggfetch_client_send⚠
Send a request and receive the response synchronously.
eggfetch_client_send_streaming⚠
Send a request and return a streaming response handle.
eggfetch_error_free⚠
Free an error handle.
eggfetch_error_is_error⚠
Check whether an error handle is non-null (i.e., an error occurred).
eggfetch_error_kind⚠
Get the error kind as a newly allocated C string.
eggfetch_error_message⚠
Get the error message as a newly allocated C string.
eggfetch_request_auth_basic⚠
Set basic auth credentials on the request.
eggfetch_request_auth_bearer⚠
Set a bearer auth token on the request.
eggfetch_request_body⚠
Set the request body from a byte buffer.
eggfetch_request_body_str⚠
Set the request body from a string.
eggfetch_request_decompress⚠
Enable or disable automatic decompression for this request.
eggfetch_request_free⚠
Free a request handle.
eggfetch_request_header⚠
Add a header to the request.
eggfetch_request_query⚠
Add a query parameter to the request URL.
eggfetch_request_redirect_policy⚠
Set a per-request redirect policy.
eggfetch_request_timeout⚠
Set a per-request timeout in seconds.
eggfetch_request_without_auth⚠
Remove auth from this request (opt out of client-level auth).
eggfetch_response_body⚠
Get the response body as a newly allocated byte buffer.
eggfetch_response_free⚠
Free a response handle.
eggfetch_response_header⚠
Get a response header by index.
eggfetch_response_header_count⚠
Get the number of response headers.
eggfetch_response_is_success⚠
Check if the response status indicates success (2xx).
eggfetch_response_status⚠
Get the HTTP status code of the response.
eggfetch_response_stream_cancel⚠
Cancel an in-progress streaming response.
eggfetch_response_stream_error⚠
Get the error that ended the stream early, if any.
eggfetch_response_stream_free⚠
Free a streaming response handle.
eggfetch_response_stream_header⚠
Get a response header by index.
eggfetch_response_stream_header_count⚠
Get the number of response headers.
eggfetch_response_stream_next⚠
Read the next chunk from the streaming response.
eggfetch_response_stream_status⚠
Get the HTTP status code of a streaming response.
eggfetch_response_stream_url⚠
Get the response URL as a newly allocated C string.
eggfetch_response_text⚠
Convenience: get the response body as a text string.
eggfetch_response_url⚠
Get the response URL as a newly allocated C string.
eggfetch_stream_chunk_free⚠
Free a stream chunk.
eggfetch_string_free⚠
Free a string returned by an eggfetch FFI function.