pub enum JsonRpcMessage {
Request(JsonRpcRequest),
Notification(JsonRpcNotification),
}Expand description
Incoming message union (request | notification) produced by the parser.
Enum representing the inbound JSON-RPC messages a server parses:
a request or a notification. Responses are produced, not parsed here,
and live in turul_rpc_core::response::JsonRpcResponse.
Variants§
Request(JsonRpcRequest)
Notification(JsonRpcNotification)
Implementations§
Source§impl JsonRpcMessage
Utility functions for working with JSON-RPC messages.
impl JsonRpcMessage
Utility functions for working with JSON-RPC messages.
Sourcepub fn is_request(&self) -> bool
pub fn is_request(&self) -> bool
Check if this is a request (has ID).
Sourcepub fn is_notification(&self) -> bool
pub fn is_notification(&self) -> bool
Check if this is a notification (no ID).
Sourcepub fn request_id(&self) -> Option<&RequestId>
pub fn request_id(&self) -> Option<&RequestId>
Get the request ID if this is a request.
Trait Implementations§
Source§impl Clone for JsonRpcMessage
impl Clone for JsonRpcMessage
Source§fn clone(&self) -> JsonRpcMessage
fn clone(&self) -> JsonRpcMessage
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 JsonRpcMessage
impl Debug for JsonRpcMessage
Source§impl From<JsonRpcMessage> for JsonRpcWireMessage
impl From<JsonRpcMessage> for JsonRpcWireMessage
Source§fn from(message: JsonRpcMessage) -> JsonRpcWireMessage
fn from(message: JsonRpcMessage) -> JsonRpcWireMessage
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for JsonRpcMessage
impl RefUnwindSafe for JsonRpcMessage
impl Send for JsonRpcMessage
impl Sync for JsonRpcMessage
impl Unpin for JsonRpcMessage
impl UnsafeUnpin for JsonRpcMessage
impl UnwindSafe for JsonRpcMessage
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