Enum jsonrpc_lite::JsonRPC
[−]
[src]
pub enum JsonRPC { Request(Map<String, Value>), Notification(Map<String, Value>), Success(Map<String, Value>), Error(Map<String, Value>), ErrorRequst(Error), }
JSON-RPC 2.0 Request object and Response object JSON-RPC 2.0 Specification.
Variants
Request(Map<String, Value>)
Request object
Notification(Map<String, Value>)
Notification object
Success(Map<String, Value>)
Success Response
Error(Map<String, Value>)
Error Response
ErrorRequst(Error)
Error Request
Methods
impl JsonRPC
[src]
fn request(id: &Id, method: &str) -> Self
Creates a JSON-RPC 2.0 request object without params
fn request_with_params(id: &Id, method: &str, params: &Params) -> Self
Creates a JSON-RPC 2.0 request object with params
fn notification(method: &str) -> Self
Creates a JSON-RPC 2.0 notification object without params
fn notification_with_params(method: &str, params: &Params) -> Self
Creates a JSON-RPC 2.0 notification object with params
fn success(id: &Id, result: &Value) -> Self
Creates a JSON-RPC 2.0 success response object
fn error(id: &Id, error: &Error) -> Self
Creates a JSON-RPC 2.0 error response object
fn get_id(&self) -> Option<Id>
fn get_method<'a>(&'a self) -> Option<&'a str>
fn get_params(&self) -> Option<Params>
fn get_result<'a>(&'a self) -> Option<&'a Value>
fn get_error<'a>(&'a self) -> Option<&'a Value>
fn parse(json: &str) -> Vec<Self>
Parses JSON string to a array of JSON-RPC 2.0 object
fn parse_object(json: &Value) -> Self
Parses JSON value object to a JSON-RPC 2.0 object
Trait Implementations
impl Debug for JsonRPC
[src]
impl PartialEq for JsonRPC
[src]
fn eq(&self, __arg_0: &JsonRPC) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &JsonRPC) -> bool
This method tests for !=
.
impl Clone for JsonRPC
[src]
fn clone(&self) -> JsonRPC
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl ToJson for JsonRPC
[src]
fn to_json(&self) -> Value
Converts a JSON-RPC 2.0 object to a JSON value