pub struct JsonRpcRequest {
pub jsonrpc: Cow<'static, str>,
pub method: String,
pub params: Option<Value>,
pub id: Option<RequestId>,
}Expand description
JSON-RPC 2.0 request.
Fields§
§jsonrpc: Cow<'static, str>Protocol version (always “2.0”).
method: StringMethod name.
params: Option<Value>Request parameters.
id: Option<RequestId>Request ID (absent for notifications).
Implementations§
Source§impl JsonRpcRequest
impl JsonRpcRequest
Sourcepub fn new(
method: impl Into<String>,
params: Option<Value>,
id: impl Into<RequestId>,
) -> JsonRpcRequest
pub fn new( method: impl Into<String>, params: Option<Value>, id: impl Into<RequestId>, ) -> JsonRpcRequest
Creates a new request with the given method and parameters.
Sourcepub fn notification(
method: impl Into<String>,
params: Option<Value>,
) -> JsonRpcRequest
pub fn notification( method: impl Into<String>, params: Option<Value>, ) -> JsonRpcRequest
Creates a notification (request without ID).
Sourcepub fn is_notification(&self) -> bool
pub fn is_notification(&self) -> bool
Returns true if this is a notification (no ID).
Trait Implementations§
Source§impl Clone for JsonRpcRequest
impl Clone for JsonRpcRequest
Source§fn clone(&self) -> JsonRpcRequest
fn clone(&self) -> JsonRpcRequest
Returns a duplicate 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 JsonRpcRequest
impl Debug for JsonRpcRequest
Source§impl<'de> Deserialize<'de> for JsonRpcRequest
impl<'de> Deserialize<'de> for JsonRpcRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonRpcRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonRpcRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for JsonRpcRequest
impl Serialize for JsonRpcRequest
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 JsonRpcRequest
impl RefUnwindSafe for JsonRpcRequest
impl Send for JsonRpcRequest
impl Sync for JsonRpcRequest
impl Unpin for JsonRpcRequest
impl UnwindSafe for JsonRpcRequest
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).