blob: 909b0b0c702690d6e384fe7d6fc054e8d4e0dbbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use std::{future::Future, pin::Pin, sync::Arc};
use crate::RPCResult;
use super::channel::Channel;
/// Represents the RPC method
pub type PubSubRPCMethod<'a> =
Box<dyn Fn(Arc<Channel>, String, serde_json::Value) -> PubSubRPCMethodOutput<'a> + Send + 'a>;
type PubSubRPCMethodOutput<'a> =
Pin<Box<dyn Future<Output = RPCResult<serde_json::Value>> + Send + Sync + 'a>>;
/// Defines the interface for an RPC service.
pub trait PubSubRPCService: Sync + Send {
fn get_pubsub_method<'a>(&'a self, name: &'a str) -> Option<PubSubRPCMethod>;
fn name(&self) -> String;
}
|