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.
Trait Implementations§
Source§impl<C, O> IntoFuture for BatchableCall<C, O>
impl<C, O> IntoFuture for BatchableCall<C, O>
Source§type Output = Result<O, RpcClientError>
type Output = Result<O, RpcClientError>
Source§type IntoFuture = Pin<Box<dyn Future<Output = <BatchableCall<C, O> as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <BatchableCall<C, O> as IntoFuture>::Output> + Send>>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Auto Trait Implementations§
impl<C, O> !RefUnwindSafe for BatchableCall<C, O>
impl<C, O> !UnwindSafe for BatchableCall<C, O>
impl<C, O> Freeze for BatchableCall<C, O>where
C: Freeze,
impl<C, O> Send for BatchableCall<C, O>where
C: Send,
impl<C, O> Sync for BatchableCall<C, O>where
C: Sync,
impl<C, O> Unpin for BatchableCall<C, O>where
C: Unpin,
impl<C, O> UnsafeUnpin for BatchableCall<C, O>where
C: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more