blob: 0775880ec5a5d2e74d458fa4ccb4c12693a0918e (
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(&self, name: &str) -> Option<PubSubRPCMethod>;
fn name(&self) -> String;
}
|