pub struct BatchableCall<C, O> { /* private fields */ }Expand description
A typed unary RPC call that has been prepared but not yet sent.
Produced by every macro-generated unary RPC method on the typed client (model CRUD + unary procedures). Two consumption modes:
- Eager.
.awaitdirectly —IntoFuturedesugars to the same HTTP requestRpcClient::callwould have made. - Batched.
.queue(&mut batch)registers the call with aBatchBuilderfor a single multiplexedPOST /rpc/batch. Returns a typedBatchHandlefor.take(...)on the results afterbatch.send().awaitresolves.
The input is eagerly converted to serde_json::Value at
construction time so the same prepared call can flow into either
consumption mode without re-borrowing the input. Conversion errors
surface lazily — eagerly on .await, per-handle on the batch path.
Implementations§
Source§impl<C, O> BatchableCall<C, O>
impl<C, O> BatchableCall<C, O>
Sourcepub fn new<I>(rpc: RpcClient<C>, op_id: impl Into<String>, input: &I) -> Selfwhere
I: Serialize,
pub fn new<I>(rpc: RpcClient<C>, op_id: impl Into<String>, input: &I) -> Selfwhere
I: Serialize,
Construct a prepared call. Callers should generally use the macro-generated typed methods rather than building this by hand.
Sourcepub fn queue(self, batch: &mut BatchBuilder<C>) -> BatchHandle<O>
pub fn queue(self, batch: &mut BatchBuilder<C>) -> BatchHandle<O>
Queue this call into a BatchBuilder for deferred
execution. The returned BatchHandle is the key to
retrieve the typed result via [BatchResults::take] after
BatchBuilder::send resolves.
Input-encoding errors observed at construction time are
preserved per-handle, so a single bad input in a batch
produces a per-handle take(...)? error rather than
poisoning the whole batch.