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§
Source§impl ClientJsonrpcRequest
impl ClientJsonrpcRequest
pub fn new(id: RequestId, request: RequestFromClient) -> ClientJsonrpcRequest
pub fn jsonrpc(&self) -> &String
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<ClientJsonrpcRequest, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ClientJsonrpcRequest, <D as Deserializer<'de>>::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<ClientJsonrpcRequest, <ClientJsonrpcRequest as FromStr>::Err>
fn from_str( s: &str, ) -> Result<ClientJsonrpcRequest, <ClientJsonrpcRequest as FromStr>::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());
Source§impl Serialize for ClientJsonrpcRequest
BEGIN AUTO GENERATED
impl Serialize for ClientJsonrpcRequest
BEGIN AUTO GENERATED
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.