pub trait Dispatcher:
Send
+ Sync
+ 'static {
// Required methods
fn dispatch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: Request,
tx: Option<&'life1 Sender<Message>>,
id: u64,
frame_type: Option<FrameType>,
) -> Pin<Box<dyn Future<Output = Option<ResponseAndSubScriptionNotifier>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn method_names(&self) -> Vec<&str>;
// Provided method
fn match_method(&self, _name: &str) -> bool { ... }
}
Expand description
A method dispatcher. These take a request and handle the method execution. Can be generated from an impl
block
using nimiq_jsonrpc_derive::service
.
Required Methods§
Sourcefn dispatch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: Request,
tx: Option<&'life1 Sender<Message>>,
id: u64,
frame_type: Option<FrameType>,
) -> Pin<Box<dyn Future<Output = Option<ResponseAndSubScriptionNotifier>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn dispatch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: Request,
tx: Option<&'life1 Sender<Message>>,
id: u64,
frame_type: Option<FrameType>,
) -> Pin<Box<dyn Future<Output = Option<ResponseAndSubScriptionNotifier>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Calls the requested method with the request parameters and returns it’s return value (or error) as a response.
Sourcefn method_names(&self) -> Vec<&str>
fn method_names(&self) -> Vec<&str>
Returns the names of all methods matched by this dispatcher.