Skip to main content

Module client

Module client 

Source
Expand description

Per-call helpers used by the generated REST client.

The macro keeps emitted code small by funnelling the common “send unary request and decode the response” path through send_unary, and the streaming path through send_streaming.

Structs§

StreamRequest
A configured streaming request, ready to be opened.

Traits§

StreamRequestFactory
Builder for a streaming request that can be re-issued on reconnect.

Functions§

build_default_http_client
Non-otel build of build_default_http_client: RED metrics (.with_metrics) are NOT compiled in — that builder method only exists under toolkit-http/otel. client_type is unused in this configuration. .with_otel() is still called (see the doc on the otel-cfg sibling above): whether it actually propagates traceparent depends on whether toolkit-http/otel ends up enabled by some crate in the build, not on this crate’s own otel feature.
open_streaming
Open a stream eagerly: connect, check the response status, and perform the framing’s own setup before returning, so an open-time failure is an Err from this call rather than the returned stream’s first item.
send_streaming
Send a streaming request and adapt the response into a typed stream, with the open deferred until the stream is first polled.
send_unary
Send a unary request and decode the JSON response.
with_json_body
Add a JSON body to a request builder. Wraps toolkit_http’s fallible .json() (which can fail to serialize) in our TransportError surface so the macro emit path can ? uniformly.