pub struct ClientStreamCallRaw { /* private fields */ }Expand description
Caller-side handle for a client-streaming (or duplex Phase D)
RPC. Push N items via ClientStreamCallRaw::send, then
ClientStreamCallRaw::finish to await the terminal RESPONSE.
Lazy initial REQUEST. The initial REQUEST is published on
the FIRST send() (or on finish() if the caller sends nothing
— that’s the “zero-item upload” degenerate path that opens and
closes the call in one frame). Constructing the handle does
NOT yet emit any wire traffic beyond the reply-channel
subscription setup.
Flow control. When the caller set
CallOptions::request_window_initial to Some(n), the
handle holds an n-permit Semaphore that gates send. The
server’s DISPATCH_RPC_REQUEST_GRANT events refill the
semaphore. When None, send doesn’t block (caller is on the
unbounded-credit fast path).
Cancellation. Dropping the handle BEFORE finish returns
Ok fires a best-effort CANCEL to the server and clears the
pending entry. Dropping after a successful finish is a no-op
(terminal RESPONSE already delivered + entry removed).
Bidi streaming plan (Phase C).
Implementations§
Source§impl ClientStreamCallRaw
impl ClientStreamCallRaw
Sourcepub fn call_id(&self) -> u64
pub fn call_id(&self) -> u64
Server-assigned call_id. Useful for trace correlation /
custom logging.
Sourcepub fn flow_controlled(&self) -> bool
pub fn flow_controlled(&self) -> bool
Whether this call is flow-controlled (caller set
CallOptions::request_window_initial).
Sourcepub async fn send(&mut self, body: Bytes) -> Result<(), RpcError>
pub async fn send(&mut self, body: Bytes) -> Result<(), RpcError>
Push one body chunk to the server. Encodes as the initial REQUEST (first call) or as a REQUEST_CHUNK (subsequent calls). When flow control is opted into, awaits one credit before publishing.
Returns Err(RpcError::Codec) if called after Self::finish.
Sourcepub async fn finish(self) -> Result<RpcReply, RpcError>
pub async fn finish(self) -> Result<RpcReply, RpcError>
Close the upload direction and await the server’s terminal
RESPONSE. Emits a REQUEST_CHUNK with FLAG_RPC_REQUEST_END
(empty body) if the call has already published its initial
REQUEST, or an initial REQUEST with both
FLAG_RPC_CLIENT_STREAMING_REQUEST and
FLAG_RPC_REQUEST_END set (the degenerate “zero-item
upload” path) if nothing was sent.
Consumes the handle — Drop after finish is a no-op.