Rust NIF interface for HTTP request execution via wreq.
Request and response metadata are passed as native Elixir maps encoded/decoded directly by Rustler's NifMap. Bodies are passed as raw BEAM binaries.
Summary
Functions
Creates a new Rust-side cookie jar resource.
Builds a Rust-side HTTP client with its own connection pool.
Sends the request metadata and body to the Rust NIF.
Functions
@spec create_cookie_jar() :: reference()
Creates a new Rust-side cookie jar resource.
Returns an opaque reference managed by the BEAM garbage collector.
@spec new_pool(map()) :: {:ok, reference()} | {:error, CloakedReq.Error.t()}
Builds a Rust-side HTTP client with its own connection pool.
The config map is passed directly to the NIF (decoded via Rustler's NifMap).
Returns {:ok, reference()} for the pooled client (managed by the BEAM
garbage collector) or {:error, %CloakedReq.Error{}}.
@spec perform_request(map(), binary() | nil, reference() | nil, reference() | nil) :: {:ok, map(), binary()} | {:error, CloakedReq.Error.t()}
Sends the request metadata and body to the Rust NIF.
The metadata map is passed directly to the NIF (decoded via Rustler's NifMap).
The body is passed as a raw binary (or nil). An optional cookie jar reference
enables automatic cookie persistence across requests, and an optional pool
reference routes the request through a dedicated client built with
new_pool/1.
Returns {:ok, response_meta, body} or {:error, %CloakedReq.Error{}}.