pub struct IncomingMessage {
pub jsonrpc: String,
pub id: Option<u64>,
pub method: Option<String>,
pub params: Option<Value>,
pub result: Option<Value>,
pub error: Option<RpcError>,
}Expand description
A raw incoming JSON-RPC message that can be classified as a response, notification, or an RPC call from the remote side.
Fields§
§jsonrpc: String§id: Option<u64>§method: Option<String>§params: Option<Value>§result: Option<Value>§error: Option<RpcError>Implementations§
Source§impl IncomingMessage
impl IncomingMessage
Sourcepub fn is_response(&self) -> bool
pub fn is_response(&self) -> bool
A response has no method and carries result or error.
Sourcepub fn is_notification(&self) -> bool
pub fn is_notification(&self) -> bool
A notification has a method but no id.
Sourcepub fn is_rpc_call(&self) -> bool
pub fn is_rpc_call(&self) -> bool
An RPC call from the remote side has both method and id.
Sourcepub fn into_response(self) -> Response
pub fn into_response(self) -> Response
Convert into a Response (only valid when [is_response] is true).
Trait Implementations§
Source§impl Clone for IncomingMessage
impl Clone for IncomingMessage
Source§fn clone(&self) -> IncomingMessage
fn clone(&self) -> IncomingMessage
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 IncomingMessage
impl Debug for IncomingMessage
Source§impl<'de> Deserialize<'de> for IncomingMessage
impl<'de> Deserialize<'de> for IncomingMessage
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 IncomingMessage
impl RefUnwindSafe for IncomingMessage
impl Send for IncomingMessage
impl Sync for IncomingMessage
impl Unpin for IncomingMessage
impl UnsafeUnpin for IncomingMessage
impl UnwindSafe for IncomingMessage
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