pub enum JsonRpcWireMessage {
Request(JsonRpcRequest),
Notification(JsonRpcNotification),
Response(JsonRpcResponse),
}Expand description
Core MCP protocol types and error handling Any single JSON-RPC 2.0 message read off the wire, in either direction.
The Response arm carries a JsonRpcResponse, which is itself the §5
Success | Error union — so one variant covers both response kinds.
Serialization is untagged: a frame serializes to the bare message object,
not an externally-tagged wrapper. Parse incoming bytes with
parse_json_rpc_wire_message; it validates structure rather than relying
on #[serde(untagged)] deserialization, which would silently misclassify
a malformed-id request as a notification.
Variants§
Request(JsonRpcRequest)
A request: has a method and an id, expects a response.
Notification(JsonRpcNotification)
A notification: has a method, no id, expects no response.
Response(JsonRpcResponse)
A response to a previously-sent request (success or error).
Trait Implementations§
Source§impl Clone for JsonRpcWireMessage
impl Clone for JsonRpcWireMessage
Source§fn clone(&self) -> JsonRpcWireMessage
fn clone(&self) -> JsonRpcWireMessage
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 JsonRpcWireMessage
impl Debug for JsonRpcWireMessage
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.
Source§impl Serialize for JsonRpcWireMessage
impl Serialize for JsonRpcWireMessage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for JsonRpcWireMessage
impl RefUnwindSafe for JsonRpcWireMessage
impl Send for JsonRpcWireMessage
impl Sync for JsonRpcWireMessage
impl Unpin for JsonRpcWireMessage
impl UnsafeUnpin for JsonRpcWireMessage
impl UnwindSafe for JsonRpcWireMessage
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