pub trait MessageHandler: Clone {
// Required method
fn handle_message<'life0, 'async_trait>(
&'life0 mut self,
message: RpcMessage,
) -> Pin<Box<dyn Future<Output = Option<RpcMessage>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn handle_subscribe<'life0, 'async_trait>(
&'life0 mut self,
_chains: Vec<ChainId>,
) -> Pin<Box<dyn Future<Output = Option<Pin<Box<dyn Stream<Item = RpcMessage> + Send>>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
The handler required to create a service.
The implementation needs to implement Clone because a seed instance is used to generate
cloned instances, where each cloned instance handles a single request. Multiple cloned instances
may exist at the same time and handle separate requests concurrently.
Required Methods§
fn handle_message<'life0, 'async_trait>(
&'life0 mut self,
message: RpcMessage,
) -> Pin<Box<dyn Future<Output = Option<RpcMessage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
Sourcefn handle_subscribe<'life0, 'async_trait>(
&'life0 mut self,
_chains: Vec<ChainId>,
) -> Pin<Box<dyn Future<Output = Option<Pin<Box<dyn Stream<Item = RpcMessage> + Send>>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn handle_subscribe<'life0, 'async_trait>(
&'life0 mut self,
_chains: Vec<ChainId>,
) -> Pin<Box<dyn Future<Output = Option<Pin<Box<dyn Stream<Item = RpcMessage> + Send>>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Handle a notification subscription request. Returns a stream of notification
messages if supported, or None if subscriptions are not supported.
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.