pub struct JsonRpcResponse {
pub jsonrpc: &'static str,
pub id: Option<Value>,
pub result: Option<Value>,
pub error: Option<JsonRpcError>,
}Expand description
A JSON-RPC 2.0 response.
Fields§
§jsonrpc: &'static strProtocol version — always "2.0".
id: Option<Value>Echoed request identifier.
result: Option<Value>Present on success.
error: Option<JsonRpcError>Present on error.
Implementations§
Source§impl JsonRpcResponse
impl JsonRpcResponse
Sourcepub fn success(id: Option<Value>, result: impl Serialize) -> Self
pub fn success(id: Option<Value>, result: impl Serialize) -> Self
Build a success response from any serializable result type.
§Panics
Panics if result cannot be serialized to JSON. This should never
happen for the well-formed MCP structs in this module.
Trait Implementations§
Source§impl Clone for JsonRpcResponse
impl Clone for JsonRpcResponse
Source§fn clone(&self) -> JsonRpcResponse
fn clone(&self) -> JsonRpcResponse
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 JsonRpcResponse
impl Debug for JsonRpcResponse
impl Eq for JsonRpcResponse
Source§impl PartialEq for JsonRpcResponse
impl PartialEq for JsonRpcResponse
Source§impl Serialize for JsonRpcResponse
impl Serialize for JsonRpcResponse
impl StructuralPartialEq for JsonRpcResponse
Auto Trait Implementations§
impl Freeze for JsonRpcResponse
impl RefUnwindSafe for JsonRpcResponse
impl Send for JsonRpcResponse
impl Sync for JsonRpcResponse
impl Unpin for JsonRpcResponse
impl UnsafeUnpin for JsonRpcResponse
impl UnwindSafe for JsonRpcResponse
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