Skip to main content

ClientStreamCallRaw

Struct ClientStreamCallRaw 

Source
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

Source

pub fn call_id(&self) -> u64

Server-assigned call_id. Useful for trace correlation / custom logging.

Source

pub fn flow_controlled(&self) -> bool

Whether this call is flow-controlled (caller set CallOptions::request_window_initial).

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for ClientStreamCallRaw

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more