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