Function dispatch_method_with_args

Source
pub async fn dispatch_method_with_args<P, R, E, F, Fut>(
    request: Request,
    f: F,
) -> Option<ResponseAndSubScriptionNotifier>
where P: for<'de> Deserialize<'de> + Send, R: Serialize, RpcError: From<E>, F: FnOnce(P) -> Fut + Send, Fut: Future<Output = Result<(R, Option<Arc<Notify>>), E>> + Send,
Expand description

Read the request and call a handler function if possible. This variant accepts calls with arguments.

This is a helper function used by implementations of Dispatcher.

§TODO

  • Currently this always expects an object with named parameters. Do we want to accept a list too?
  • Merge with it’s other variant, as a function call without arguments is just one with () as request parameter.