Skip to main content

Crate cratestack_client_rust

Crate cratestack_client_rust 

Source

Structs§

AuthorizationRequest
BatchBuilder
Accumulates queued [BatchableCall]s into a single POST /rpc/batch round-trip. Build via RpcClient::batch_builder or the macro-generated Client::batch().
BatchHandle
A typed key returned by BatchableCall::queue. Pair it with [BatchResults::take] to extract the typed output for that op from the batch response.
BatchResults
Per-handle results from a sent batch. Each handle can be taken exactly once.
BatchableCall
A typed unary RPC call that has been prepared but not yet sent.
CborCodec
The CBOR codec. decode refuses input nested deeper than [DEFAULT_MAX_DECODE_DEPTH] levels (cratestack#1315); use CborCodec::with_max_depth for another limit.
CborSeqChunkDecoder
Re-exported from cratestack-codec-cbor, where the scanner moved so server-side byte-stream bindings (WebTransport) share it with this client. The cratestack_client_rust::CborSeqChunkDecoder path is unchanged. Stateful boundary scanner for application/cbor-seq streams. Bytes arrive in arbitrary chunks; this type buffers them and emits the byte ranges of any complete top-level CBOR items observed so far. The CBOR-level parse uses minicbor::Decoder::skip for boundary detection (cheap, doesn’t allocate); the per-item serde decode happens at the caller’s leisure on each returned slice.
Challenges
Every WWW-Authenticate value an error answer carried, raw and in the order they arrived (cratestack#1243): an AuthRefusal’s challenges. Unparsed: a challenge’s own grammar (RFC 9110 §11.6.1) is the caller’s.
ClientConfig
CratestackClient
InMemoryStateStore
JsonCodec
JsonFileStateStore
PersistedClientState
PreparedCall
A prepared unary mutation, including its final inner payload and key mode.
RequestIdempotency
Whether one outbound request may be replayed byte-for-byte without an idempotency key — the single fact a retry middleware needs and cannot work out for itself.
RequestJournalEntry
RouteRef
The route template of one call, and the values of its {parameters} in template order.
RpcClient
Thin RPC client built on top of the REST client’s transport + codec plumbing.
RpcErrorBody
Wire shape of a single error returned by an RPC call. Maps from [CratestackError] via rpc_code + [CratestackError::public_message].
RpcRemoteError
Error variant produced by the RPC client when a remote call fails with an RpcErrorBody payload. Distinct from the REST ClientError::Remote (which carries the CratestackErrorResponse shape) so library users can switch on the gRPC-style code string directly.
RpcRequest
Wire shape of a single batch request frame.
RpcResponseFrame
Wire shape of a single batch response frame.
RpcSubscribeInput
RuntimeConfigWire
RuntimeErrorWire
RuntimeHandle
RuntimeHeader
RuntimeRequestWire
RuntimeResponseWire
RuntimeTransportConfig
StepUpRequired
What a step-up refusal asks for (cratestack#1244). Each requirement is present only when the refused operation declares it.
SubscriptionTarget
Where a subscription is served. The generated client fills it in; the binding decides which half it reads.
TypedResponse
A decoded typed body paired with the status and headers it arrived with (issue #493).

Enums§

ClientError
EnvelopeError
A failure that belongs to the signed transport, not to the call.
RpcClientError
Top-level error returned by the RPC client. Mirrors ClientError (the REST error type) but reports server-side failures as RpcRemoteError { code, message, details } rather than the REST-shaped CratestackErrorResponse.
RuntimeChunkWire
FFI-shaped chunk delivered to the execute_streamed callback. Item carries one CBOR-encoded item’s raw bytes; Error is terminal; End is terminal and indicates a clean stream close.
RuntimeCodecConfig
RuntimeEnvelopeConfig
RuntimeErrorCode
RuntimeStateStoreConfig
SubscriptionTransport
Which binding a subscription uses.

Constants§

INSUFFICIENT_USER_AUTHENTICATION
The extra member error of a step-up refusal (RFC 9470).
RPC_BATCH_PATH
Mount path for batched RPC calls. Body is a codec-encoded sequence of RpcRequest frames.
RPC_UNARY_PATH
Mount path for unary RPC calls. The trailing segment is the percent-decoded op id, e.g. POST /rpc/model.User.list.

Traits§

ClientStateStore
HttpClientCodec
Projection
Back-compat alias — the trait moved to cratestack-core and was renamed ProjectionDecoder to free up the Projection name for the SQL value type in cratestack-sql.
ProjectionDecoder
RequestAuthorizer
Async by design (issue #453): real credential providers — an OAuth2 client-credentials token with a refresh-on-expiry cache, for instance — need to make an HTTP call on a cache miss, which a sync authorize can’t do without block_on (panics/deadlocks depending on the runtime) or a pre-fetch-and-stash workaround that reintroduces the expiry race the cache existed to avoid. #[async_trait] (rather than a bare async fn in the trait) keeps Arc<dyn RequestAuthorizer> — CratestackClient::with_request_authorizer stores the authorizer as a trait object — dyn-compatible; native AFIT would drop that. Same convention other dyn-dispatched async hook traits already use elsewhere in the workspace (e.g. cratestack_core::audit::AuditSink).
StepUpError
An error that may be a step-up refusal: what retry_after_step_up reads. Implemented by ClientError, RpcClientError and RpcRemoteError.

Functions§

encode_path_segment
segment as one URL path segment: everything but the RFC 3986 unreserved characters is percent-encoded, so an id such as 50%off or a/b reaches the server as the value the seal binds.
ensure_crypto_provider
Installs a ring-backed rustls::crypto::CryptoProvider if the process doesn’t already have one (#440).
retry_after_step_up
Run call (a future, or anything .await takes, such as a generated RPC method’s call); when it fails with a step-up refusal, hand the refusal to reprove and, when that answers true (the caller authenticated again), run call once more and return what it gives, even a second step-up refusal. Never loops.
rpc_code
Map a [CratestackError] to its stable RPC code (gRPC-style snake_case).
rpc_error_to_client
An err frame as a ClientError::Remote, with the HTTP status its code stands for, so it reads like a refusal of a unary call.

Type Aliases§

ClientSubscription
A live subscription: items until the server ends it, or a terminal Err. None after an Err, or when the stream ends normally (a subscription procedure whose source ran out). Dropping it cancels the subscription.
HeaderPair
QueryPair
RpcStream
Stable alias for the receiver shape that [RpcClient::call_streaming] returns. Exists so macro-generated code (include_client_schema! for transport rpc schemas) has a single name to bind without re-spelling the tokio/error-type plumbing on every method, and so downstream users have a typedef they can store in struct fields, function returns, etc. without leaking the implementation detail.