pub trait RouteHandler: Send + Sync {
// Required methods
fn handle<'life0, 'async_trait>(
&'life0 self,
request: JsonRpcRequest,
ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<JsonRpcResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn can_handle(&self, method: &str) -> bool;
// Provided method
fn metadata(&self) -> RouteMetadata { ... }
}
Expand description
Route handler trait for custom routes
Required Methods§
Sourcefn handle<'life0, 'async_trait>(
&'life0 self,
request: JsonRpcRequest,
ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<JsonRpcResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle<'life0, 'async_trait>(
&'life0 self,
request: JsonRpcRequest,
ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<JsonRpcResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle the request
Sourcefn can_handle(&self, method: &str) -> bool
fn can_handle(&self, method: &str) -> bool
Check if this handler can handle the request
Provided Methods§
Sourcefn metadata(&self) -> RouteMetadata
fn metadata(&self) -> RouteMetadata
Get handler metadata