pub struct RpcRequest {
pub jsonrpc: String,
pub method: String,
pub params: Value,
pub id: Option<Value>,
}Expand description
JSON-RPC 2.0 request object.
params is left as Value; each handler parses it into its own
concrete shape. A notification is a request with id == None.
Fields§
§jsonrpc: StringProtocol version. Must be "2.0"; other values are rejected at
the transport layer before the handler runs.
method: StringMethod name. Maps into the dispatch table.
params: ValueMethod parameters. Object form ({"foo": 1}) is preferred for
clarity, but positional arrays are also accepted by the spec.
id: Option<Value>None means the request is a notification — the server replies
with no body. Notifications may not include an error reply.
Implementations§
Source§impl RpcRequest
impl RpcRequest
Sourcepub fn is_notification(&self) -> bool
pub fn is_notification(&self) -> bool
true if this is a notification (no id, no response expected).
Sourcepub fn version_ok(&self) -> bool
pub fn version_ok(&self) -> bool
Strictly check the jsonrpc field is "2.0".
Trait Implementations§
Source§impl Debug for RpcRequest
impl Debug for RpcRequest
Source§impl<'de> Deserialize<'de> for RpcRequest
impl<'de> Deserialize<'de> for RpcRequest
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 RpcRequest
impl RefUnwindSafe for RpcRequest
impl Send for RpcRequest
impl Sync for RpcRequest
impl Unpin for RpcRequest
impl UnsafeUnpin for RpcRequest
impl UnwindSafe for RpcRequest
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