Skip to main content

call_one

Function call_one 

Source
pub async fn call_one<T, I>(
    transport: &T,
    method: MethodRef,
    params: Result<Value, ClientError>,
    item: Decoder<I>,
) -> Result<I, ClientError>
where T: Transport + ?Sized,
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:

WireResult
one data (decodes), doneOk(item)
error (before or after the item)Err(ClientError::Remote)
done with no item, or a second itemErr(ClientError::Decode) naming the method
transport failureErr(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.