Struct jsonrpc_rs::Server
source · pub struct Server { /* private fields */ }Expand description
JSONRPC server context structure.
Implementations§
source§impl Server
impl Server
pub fn new<S>(tag: S) -> Selfwhere
S: Into<String>,
sourcepub fn handle<P, R, F>(self, method: &'static str, f: F) -> Selfwhere
F: FnMut(P) -> Result<Option<R>, ErrorCode> + 'static + Clone + Sync + Send,
for<'a> P: Deserialize<'a> + Serialize,
R: Serialize + Default,
pub fn handle<P, R, F>(self, method: &'static str, f: F) -> Selfwhere
F: FnMut(P) -> Result<Option<R>, ErrorCode> + 'static + Clone + Sync + Send,
for<'a> P: Deserialize<'a> + Serialize,
R: Serialize + Default,
Register jsonrpc server sync handler
sourcepub fn async_handle<P, R, F, FR>(self, method: &'static str, f: F) -> Selfwhere
F: FnMut(P) -> FR + 'static + Sync + Send + Clone,
FR: Future<Output = Result<Option<R>, ErrorCode>> + Sync + Send + 'static,
for<'a> P: Deserialize<'a> + Serialize + Send,
R: Serialize + Default,
pub fn async_handle<P, R, F, FR>(self, method: &'static str, f: F) -> Selfwhere
F: FnMut(P) -> FR + 'static + Sync + Send + Clone,
FR: Future<Output = Result<Option<R>, ErrorCode>> + Sync + Send + 'static,
for<'a> P: Deserialize<'a> + Serialize + Send,
R: Serialize + Default,
Register jsonrpc server async handler
The register async handler be required to implement Clone trait.