use serde::{de::DeserializeOwned, Serialize};
pub trait RpcDescriptor {
type Input: DeserializeOwned + Send + 'static;
type Output: Serialize + Send + 'static;
const KEY: &'static str;
const SUBJECT: &'static str;
const CALLER_CAPABILITIES: &'static [&'static str] = &[];
}
impl<D> RpcDescriptor for D
where
D: crate::client::RpcDescriptor,
D::Input: DeserializeOwned + Send + 'static,
D::Output: Serialize + Send + 'static,
{
type Input = D::Input;
type Output = D::Output;
const KEY: &'static str = D::KEY;
const SUBJECT: &'static str = D::SUBJECT;
const CALLER_CAPABILITIES: &'static [&'static str] = D::CALLER_CAPABILITIES;
}
pub trait EventDescriptor {
type Event: Serialize + DeserializeOwned + Send + Sync + 'static;
const KEY: &'static str;
const SUBJECT: &'static str;
}
impl<D> EventDescriptor for D
where
D: crate::client::EventDescriptor,
D::Event: Serialize + DeserializeOwned + Send + Sync + 'static,
{
type Event = D::Event;
const KEY: &'static str = D::KEY;
const SUBJECT: &'static str = D::SUBJECT;
}
pub trait FeedDescriptor {
type Input: DeserializeOwned + Send + 'static;
type Event: Serialize + Send + 'static;
const KEY: &'static str;
const SUBJECT: &'static str;
const SUBSCRIBE_CAPABILITIES: &'static [&'static str] = &[];
}
impl<D> FeedDescriptor for D
where
D: crate::client::FeedDescriptor,
D::Input: DeserializeOwned + Send + 'static,
D::Event: Serialize + Send + 'static,
{
type Input = D::Input;
type Event = D::Event;
const KEY: &'static str = D::KEY;
const SUBJECT: &'static str = D::SUBJECT;
const SUBSCRIBE_CAPABILITIES: &'static [&'static str] = D::SUBSCRIBE_CAPABILITIES;
}