pub struct ClientJsonrpcRequest {
pub id: RequestId,
pub method: String,
pub request: RequestFromClient,
/* private fields */
}
Expand description
“Similar to JsonrpcRequest , but with the variants restricted to client-side requests.”
Fields§
§id: RequestId
§method: String
§request: RequestFromClient
Implementations§
Trait Implementations§
Source§impl Clone for ClientJsonrpcRequest
impl Clone for ClientJsonrpcRequest
Source§fn clone(&self) -> ClientJsonrpcRequest
fn clone(&self) -> ClientJsonrpcRequest
Returns a copy of the value. Read more
1.0.0 · 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 ClientJsonrpcRequest
impl Debug for ClientJsonrpcRequest
Source§impl<'de> Deserialize<'de> for ClientJsonrpcRequest
impl<'de> Deserialize<'de> for ClientJsonrpcRequest
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ClientJsonrpcRequest
Formats the ClientJsonrpcRequest as a JSON string.
impl Display for ClientJsonrpcRequest
Formats the ClientJsonrpcRequest as a JSON string.
Source§impl FromStr for ClientJsonrpcRequest
impl FromStr for ClientJsonrpcRequest
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a JSON-RPC request from a string.
This implementation allows ClientJsonrpcRequest
to be created
from a JSON string using the from_str
method.
§Arguments
s
- A JSON string representing a JSON-RPC request.
§Returns
Ok(ClientJsonrpcRequest)
if parsing is successful.Err(RpcError)
if the string is not valid JSON.
§Example
use std::str::FromStr;
use rust_mcp_schema::schema_utils::ClientJsonrpcRequest;
let json = r#"{"jsonrpc": "2.0", "method": "initialize", "id": 1}"#;
let request = ClientJsonrpcRequest::from_str(json);
assert!(request.is_ok());
Auto Trait Implementations§
impl Freeze for ClientJsonrpcRequest
impl RefUnwindSafe for ClientJsonrpcRequest
impl Send for ClientJsonrpcRequest
impl Sync for ClientJsonrpcRequest
impl Unpin for ClientJsonrpcRequest
impl UnwindSafe for ClientJsonrpcRequest
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