Skip to main content

CallbackHandler

Trait CallbackHandler 

Source
pub trait CallbackHandler:
    Send
    + Sync
    + 'static {
    // Required method
    fn call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        method: &'life1 str,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, RpcError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Answers the server’s callbacks on this session (0.21+).

A client installs one only for the methods it advertised in client_methods; a server never sends anything else. The returned value is serialized as the callback’s result, and an RpcError becomes its error response, so declining is a normal outcome rather than a transport failure.

Required Methods§

Source

fn call<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, params: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§