Struct jsonrpc::ResponseCompletable
[−]
[src]
pub struct ResponseCompletable { /* fields omitted */ }
A completable for a JSON-RPC request. This is an object that must be "completed", that is, a result must be provided. (this is the inverse of a future)
Must be completed once and only once, otherwise a panic is generated upon drop.
On completion, the on_response callback is invoked. Typically: this will write an appropriate JSON-RPC response to the endpoint output.
Methods
impl ResponseCompletable
[src]
fn new(
id: Option<Id>,
on_response: Box<FnMut(Option<Response>) + Send>
) -> ResponseCompletable
id: Option<Id>,
on_response: Box<FnMut(Option<Response>) + Send>
) -> ResponseCompletable
fn complete(self, response_result: Option<ResponseResult>)
fn complete_with_error(self, error: RequestError)
fn handle_request_with<PARAMS, RET, RET_ERROR, METHOD>(
self,
params: RequestParams,
method_handler: METHOD
) where
PARAMS: Deserialize,
RET: Serialize,
RET_ERROR: Serialize,
METHOD: FnOnce(PARAMS, MethodCompletable<RET, RET_ERROR>),
self,
params: RequestParams,
method_handler: METHOD
) where
PARAMS: Deserialize,
RET: Serialize,
RET_ERROR: Serialize,
METHOD: FnOnce(PARAMS, MethodCompletable<RET, RET_ERROR>),
fn sync_handle_request<PARAMS, RET, RET_ERROR, METHOD>(
self,
params: RequestParams,
sync_method_handler: METHOD
) where
PARAMS: Deserialize,
RET: Serialize,
RET_ERROR: Serialize,
METHOD: FnOnce(PARAMS) -> MethodResult<RET, RET_ERROR>,
self,
params: RequestParams,
sync_method_handler: METHOD
) where
PARAMS: Deserialize,
RET: Serialize,
RET_ERROR: Serialize,
METHOD: FnOnce(PARAMS) -> MethodResult<RET, RET_ERROR>,
fn handle_notification_with<PARAMS, METHOD>(
self,
params: RequestParams,
method_handler: METHOD
) where
PARAMS: Deserialize,
METHOD: FnOnce(PARAMS),
self,
params: RequestParams,
method_handler: METHOD
) where
PARAMS: Deserialize,
METHOD: FnOnce(PARAMS),
fn sync_handle_notification<PARAMS, METHOD>(
self,
params: RequestParams,
sync_method_handler: METHOD
) where
PARAMS: Deserialize,
METHOD: FnOnce(PARAMS),
self,
params: RequestParams,
sync_method_handler: METHOD
) where
PARAMS: Deserialize,
METHOD: FnOnce(PARAMS),