pub struct Request {
pub jsonrpc: String,
pub method: String,
pub params: Option<Box<RawValue>>,
pub id: RequestId,
}Expand description
A JSON-RPC 2.0 request object.
Params are stored as Box<RawValue> to defer deserialization
until the method handler is known.
Fields§
§jsonrpc: StringThe JSON-RPC version — must be "2.0".
method: StringThe name of the method to invoke.
params: Option<Box<RawValue>>Structured parameters for the method (optional).
id: RequestIdClient-assigned identifier. Absent for notifications.
Implementations§
Source§impl Request
impl Request
Sourcepub fn is_notification(&self) -> bool
pub fn is_notification(&self) -> bool
Returns true if this request is a notification (has no id).
Sourcepub fn parse_params<P: DeserializeOwned>(&self) -> Result<P, Error>
pub fn parse_params<P: DeserializeOwned>(&self) -> Result<P, Error>
Deserializes the params into a concrete type.
Returns an error if the params are absent or fail to deserialize.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Request
impl<'de> Deserialize<'de> for Request
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 From<Request> for RequestMessage
impl From<Request> for RequestMessage
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
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