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
ClientHandleisSend + Syncand may be shared across threads.RequestHandle,ResponseHandle, andErrorHandleare single-thread, single-use. Create, use, and free them on one thread.StreamingResponseHandleholds thread-safe shared state (Arc<StreamState>):nextmay 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§
- Client
Builder Handle - Opaque handle to a client builder.
- Client
Handle - Opaque handle to an HTTP client.
- Error
Handle - Opaque handle to an error.
- FfiString
- Owned C string returned by FFI. Must be freed with
eggfetch_string_free. - Request
Handle - Opaque handle to a request builder.
- Response
Handle - Opaque handle to a completed response.
- Stream
Chunk - A single chunk from a streaming response.
- Streaming
Response Handle - 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.