pub trait RpcHandler:
Clone
+ Send
+ Sync
+ 'static {
type Request: DeserializeOwned + Send + Sync + Debug;
// Required method
fn on_request<'life0, 'async_trait>(
&'life0 self,
request: Self::Request,
) -> Pin<Box<dyn Future<Output = ResponseResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn on_call<'life0, 'async_trait>(
&'life0 self,
call: RpcMethodCall,
) -> Pin<Box<dyn Future<Output = RpcResponse> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Helper trait that is used to execute ethereum rpc calls
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn on_call<'life0, 'async_trait>(
&'life0 self,
call: RpcMethodCall,
) -> Pin<Box<dyn Future<Output = RpcResponse> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_call<'life0, 'async_trait>(
&'life0 self,
call: RpcMethodCall,
) -> Pin<Box<dyn Future<Output = RpcResponse> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Invoked for every incoming RpcMethodCall
This will attempt to deserialize a { "method" : "<name>", "params": "<params>" }
message
into the Request
type of this handler. If a Request
instance was deserialized
successfully, Self::on_request
will be invoked.
Note: override this function if the expected Request
deviates from { "method" : "<name>", "params": "<params>" }
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.