pub struct JsonRpcRequest {
pub jsonrpc: String,
pub method: String,
pub params: Option<Value>,
pub id: Value,
}Expand description
JSON-RPC 2.0 Request
Fields§
§jsonrpc: StringProtocol version (always “2.0”)
method: StringMethod name
params: Option<Value>Method parameters
id: ValueRequest ID (can be string, number, or null)
Implementations§
Source§impl JsonRpcRequest
impl JsonRpcRequest
Sourcepub fn new(method: impl Into<String>, params: Option<Value>, id: Value) -> Self
pub fn new(method: impl Into<String>, params: Option<Value>, id: Value) -> Self
Create a new JSON-RPC request
Sourcepub fn with_string_id(
method: impl Into<String>,
params: Option<Value>,
id: impl Into<String>,
) -> Self
pub fn with_string_id( method: impl Into<String>, params: Option<Value>, id: impl Into<String>, ) -> Self
Create a request with a string ID
Sourcepub fn with_numeric_id(
method: impl Into<String>,
params: Option<Value>,
id: i64,
) -> Self
pub fn with_numeric_id( method: impl Into<String>, params: Option<Value>, id: i64, ) -> Self
Create a request with a numeric ID
Sourcepub fn message_send(params: MessageSendParams, id: Value) -> Self
pub fn message_send(params: MessageSendParams, id: Value) -> Self
Create a message/send request
Trait Implementations§
Source§impl Clone for JsonRpcRequest
impl Clone for JsonRpcRequest
Source§fn clone(&self) -> JsonRpcRequest
fn clone(&self) -> JsonRpcRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonRpcRequest
impl Debug for JsonRpcRequest
Source§impl<'de> Deserialize<'de> for JsonRpcRequest
impl<'de> Deserialize<'de> for JsonRpcRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for JsonRpcRequest
impl RefUnwindSafe for JsonRpcRequest
impl Send for JsonRpcRequest
impl Sync for JsonRpcRequest
impl Unpin for JsonRpcRequest
impl UnsafeUnpin for JsonRpcRequest
impl UnwindSafe for JsonRpcRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more