Struct sota::datatype::json_rpc::RpcRequest [] [src]

pub struct RpcRequest<E: Encodable> {
    pub jsonrpc: String,
    pub id: u64,
    pub method: String,
    pub params: E,
}

Encode the body of a JSON-RPC call.

Fields

jsonrpc
id
method
params

Methods

impl<E: Encodable> RpcRequest<E>
[src]

fn new(method: &str, params: E) -> RpcRequest<E>

Instantiate a new RpcRequest with the default version (2.0) and an id generated from the current time.

fn send(&self, url: Url) -> Result<String, String>

Send a JSON-RPC POST request to the specified URL.

Trait Implementations

Derived Implementations

impl<E: Encodable + Encodable> Encodable for RpcRequest<E>
[src]

fn encode<__SE: Encoder>(&self, __arg_0: &mut __SE) -> Result<(), __SE::Error>

Serialize a value using an Encoder.

impl<E: Decodable + Encodable> Decodable for RpcRequest<E>
[src]

fn decode<__DE: Decoder>(__arg_0: &mut __DE) -> Result<RpcRequest<E>, __DE::Error>

Deserialize a value using a Decoder.