Register a custom RPC method for the RPC passthrough from the main daemon
(mut self, name: &str, description: &str, callback: C)
| 275 | /// Register a custom RPC method for the RPC passthrough from the |
| 276 | /// main daemon |
| 277 | pub fn rpcmethod<C, F>(mut self, name: &str, description: &str, callback: C) -> Builder<S, I, O> |
| 278 | where |
| 279 | C: Send + Sync + 'static, |
| 280 | C: Fn(Plugin<S>, Request) -> F + 'static, |
| 281 | F: Future<Output = Response> + Send + 'static, |
| 282 | { |
| 283 | self.rpcmethods.insert( |
| 284 | name.to_string(), |
| 285 | RpcMethod { |
| 286 | name: name.to_string(), |
| 287 | description: description.to_string(), |
| 288 | usage: String::default(), |
| 289 | callback: Box::new(move |p, r| Box::pin(callback(p, r))), |
| 290 | }, |
| 291 | ); |
| 292 | self |
| 293 | } |
| 294 | |
| 295 | pub fn rpcmethod_from_builder(mut self, rpc_method: RpcMethodBuilder<S>) -> Builder<S, I, O> { |
| 296 | self.rpcmethods |