pub trait PubSubRpcHandler:
Clone
+ Send
+ Sync
+ Unpin
+ 'static {
type Request: DeserializeOwned + Send + Sync + Debug;
type SubscriptionId: Hash + PartialEq + Eq + Send + Sync + Debug;
type Subscription: Stream<Item = Value> + Send + Sync + Unpin;
// Required method
fn on_request<'life0, 'async_trait>(
&'life0 self,
request: Self::Request,
cx: PubSubContext<Self>,
) -> Pin<Box<dyn Future<Output = ResponseResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
The general purpose trait for handling RPC requests and subscriptions
Required Associated Types§
Required Methods§
Sourcefn on_request<'life0, 'async_trait>(
&'life0 self,
request: Self::Request,
cx: PubSubContext<Self>,
) -> Pin<Box<dyn Future<Output = ResponseResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_request<'life0, 'async_trait>(
&'life0 self,
request: Self::Request,
cx: PubSubContext<Self>,
) -> Pin<Box<dyn Future<Output = ResponseResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Invoked when the request was received
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".