use crate::handler::{RpcHandlerWrapper, RpcHandlerWrapperTrait};
use crate::{Resources, Result};
use futures::Future;
use serde_json::Value;
pub trait Handler<T, P, R>: Clone
where
T: Send + Sync + 'static,
P: Send + Sync + 'static,
R: Send + Sync + 'static,
{
type Future: Future<Output = Result<Value>> + Send + 'static;
fn call(self, rpc_resources: Resources, params: Option<Value>) -> Self::Future;
fn into_dyn(self) -> Box<dyn RpcHandlerWrapperTrait>
where
Self: Sized + Send + Sync + 'static,
{
Box::new(RpcHandlerWrapper::new(self)) as Box<dyn RpcHandlerWrapperTrait>
}
}