Skip to main content

PubSubRpcHandler

Trait PubSubRpcHandler 

Source
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§

Source

type Request: DeserializeOwned + Send + Sync + Debug

The request type to expect

Source

type SubscriptionId: Hash + PartialEq + Eq + Send + Sync + Debug

The identifier to use for subscriptions

Source

type Subscription: Stream<Item = Value> + Send + Sync + Unpin

The subscription type this handle may create

Required Methods§

Source

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".

Implementors§