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):
| Call | Yields | Progress frames |
|---|---|---|
client.m(..) | Result<I, ClientError> | dropped, undecoded |
client.m(..).with_progress() | Result<Frame<I, P>, ClientError>, in arrival order | decoded 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 item | Yielded | Stream continues? |
|---|---|---|
data (decodes as I) | the item | yes |
data (does not) | Err(ClientError::Decode) | no |
progress | nothing — unless opted in: Frame::Progress(p) | yes |
progress (opted in, does not decode as P) | Err(ClientError::Decode) | no |
error | Err(ClientError::Remote(RemoteError)) | no |
request | skipped (the typed client has no answer channel) | yes |
done | nothing | no |
| transport failure | Err(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>, whereAis{Ns}Event. - Method
Stream - With
Progress - A
MethodStreamwhose 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.
- Maybe
Send Sync Send + Syncoff wasm32, nothing on it — what an event constructor moved into a boxedEventsmust be.
Functions§
- call_
one - Call a one-item method (
-> T,-> Result<T, E>) and return its item — what a generated client’s one-itemasync fnis. - call_
one_ with_ input - BIDIR-6:
call_one, for a method with an input half:inputis sent under the callee’s credit while the call is read to its end.