Skip to main content

Module method_stream

Module method_stream 

Source
Expand description

What a many-item method’s client call returns: MethodStream.

A method that yields many items (-> impl Stream<Item = …>) is called as a stream of its items — a plain TryStream<Ok = I, Error = ClientError> — and two per-call opt-ins turn that same call into something else (RETURNS-1 decisions 6, 11):

CallYieldsProgress frames
client.m(..)Result<I, ClientError>dropped, undecoded
client.m(..).with_progress()Result<Frame<I, P>, ClientError>, in arrival orderdecoded as P
client.m(..).events()Result<{Ns}Event, ClientError>, {Ns}Event::M(item)dropped

I is the method’s item — a plain T, or a Result<T, E> decoded from its {"ok"} / {"err"} wire form — P its progress type (NoProgress when it declares none) and A the activation’s {Ns}Event aggregate.

§Decoding, exhaustively

Wire itemYieldedStream continues?
data (decodes as I)the itemyes
data (does not)Err(ClientError::Decode)no
progressnothing — unless opted in: Frame::Progress(p)yes
progress (opted in, does not decode as P)Err(ClientError::Decode)no
errorErr(ClientError::Remote(RemoteError))no
requestskipped (the typed client has no answer channel)yes
donenothingno
transport failureErr(ClientError::Transport)no

A failed call stays an item of the stream, so a cut-off stream cannot pass for a finished one. An err item (Err(e) of a Result method) is data, the activation saying no: it is Ok(Err(e)) here and does not end the stream — the method decides whether more follows.

NoProgress is uninhabited, so .with_progress() exists on every many-item method and still never yields a progress frame where the schema declares none: such a frame cannot decode, and is a contract break like any other.

Structs§

Events
A call as the activation’s aggregate (MethodStream::events): Result<A, ClientError>, where A is {Ns}Event.
MethodStream
WithProgress
A MethodStream whose caller opted in to progress (MethodStream::with_progress): Result<Frame<I, P>, ClientError>, in arrival order.

Enums§

NoProgress
The progress type of a method that reports none. Uninhabited: no value of it exists, so a stream typed Frame<I, NoProgress> can only ever yield items.

Traits§

EventOf
One call of a many-item method: a stream of its items.
MaybeSendSync
Send + Sync off wasm32, nothing on it — what an event constructor moved into a boxed Events must be.

Functions§

call_one
Call a one-item method (-> T, -> Result<T, E>) and return its item — what a generated client’s one-item async fn is.
call_one_with_input
BIDIR-6: call_one, for a method with an input half: input is sent under the callee’s credit while the call is read to its end.

Type Aliases§

Decoder
Decodes one data frame’s content into a method’s item I — straight from the wire’s text where the transport kept it (PERF.115-36’s Content), never through a Value first.