pub async fn call_one<T, I>(
transport: &T,
method: MethodRef,
params: Result<Value, ClientError>,
item: Decoder<I>,
) -> Result<I, ClientError>Expand description
Call a one-item method (-> T, -> Result<T, E>) and return its item —
what a generated client’s one-item async fn is.
Reads the call to its terminal frame: one data item, then done. So a
transport that cancels a dropped call (the WebSocket one) never cancels a
call that finished, and a server that breaks the contract is caught:
| Wire | Result |
|---|---|
one data (decodes), done | Ok(item) |
error (before or after the item) | Err(ClientError::Remote) |
done with no item, or a second item | Err(ClientError::Decode) naming the method |
| transport failure | Err(ClientError::Transport) |
Progress frames are dropped (a one-item method never reports progress:
RETURNS-1 decision 10); request frames are skipped. When params is an
Err nothing is sent and that is the result.