Skip to main content

dispatch

Function dispatch 

Source
pub async fn dispatch<F, Fut>(
    method: &str,
    args_json: &str,
    request_id: u64,
    send: F,
) -> Result<DispatchResult, String>
where F: FnOnce(Vec<u8>) -> Fut, Fut: Future<Output = Result<Vec<u8>, String>>,
Expand description

Transport-agnostic JSON dispatch for this service.

Routes method calls by name, handling serialization on both sides. Scoped methods use dot notation: "ttt.init", "ttt.train". Streaming methods return DispatchResult::Stream with raw StreamInfo bytes.