pub trait JsonRpcRequest: JsonRpcMessage {
type Response: JsonRpcResponse;
}Expand description
A struct that represents a request (JSON-RPC message expecting a response).
§Derive Macro
Use #[derive(JsonRpcRequest)] to automatically implement both JsonRpcMessage and JsonRpcRequest:
ⓘ
use agent_client_protocol::{JsonRpcRequest, JsonRpcResponse};
use serde::{Serialize, Deserialize};
#[derive(Debug, Clone, Serialize, Deserialize, JsonRpcRequest)]
#[request(method = "_hello", response = HelloResponse)]
struct HelloRequest {
name: String,
}
#[derive(Debug, Serialize, Deserialize, JsonRpcResponse)]
struct HelloResponse {
greeting: String,
}Required Associated Types§
Sourcetype Response: JsonRpcResponse
type Response: JsonRpcResponse
The type of data expected in response.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".