pub trait JsonRpcResponse:
'static
+ Debug
+ Sized
+ Send
+ Clone {
// Required methods
fn into_json(self, method: &str) -> Result<Value, Error>;
fn from_value(method: &str, value: Value) -> Result<Self, Error>;
}Expand description
Defines the “payload” of a successful response to a JSON-RPC request.
§Derive Macro
Use #[derive(JsonRpcResponse)] to automatically implement this trait:
ⓘ
use agent_client_protocol::JsonRpcResponse;
use serde::{Serialize, Deserialize};
#[derive(Debug, Serialize, Deserialize, JsonRpcResponse)]
#[response(method = "_hello")]
struct HelloResponse {
greeting: String,
}Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.