pub struct JsonRpcNotification {
pub version: JsonRpcVersion,
pub method: String,
pub params: Option<RequestParams>,
}Expand description
A JSON-RPC notification (request without an id)
Fields§
§version: JsonRpcVersion§method: String§params: Option<RequestParams>Implementations§
Source§impl JsonRpcNotification
impl JsonRpcNotification
pub fn new(method: String, params: Option<RequestParams>) -> JsonRpcNotification
Sourcepub fn new_no_params(method: String) -> JsonRpcNotification
pub fn new_no_params(method: String) -> JsonRpcNotification
Create a new notification with no parameters
Sourcepub fn new_with_object_params(
method: String,
params: HashMap<String, Value>,
) -> JsonRpcNotification
pub fn new_with_object_params( method: String, params: HashMap<String, Value>, ) -> JsonRpcNotification
Create a new notification with object parameters
Sourcepub fn new_with_array_params(
method: String,
params: Vec<Value>,
) -> JsonRpcNotification
pub fn new_with_array_params( method: String, params: Vec<Value>, ) -> JsonRpcNotification
Create a new notification with array parameters
Sourcepub fn get_param(&self, name: &str) -> Option<&Value>
pub fn get_param(&self, name: &str) -> Option<&Value>
Get a parameter by name (if params are an object)
Sourcepub fn get_param_index(&self, index: usize) -> Option<&Value>
pub fn get_param_index(&self, index: usize) -> Option<&Value>
Get a parameter by index (if params are an array)
Trait Implementations§
Source§impl Clone for JsonRpcNotification
impl Clone for JsonRpcNotification
Source§fn clone(&self) -> JsonRpcNotification
fn clone(&self) -> JsonRpcNotification
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 JsonRpcNotification
impl Debug for JsonRpcNotification
Source§impl<'de> Deserialize<'de> for JsonRpcNotification
impl<'de> Deserialize<'de> for JsonRpcNotification
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonRpcNotification, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonRpcNotification, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for JsonRpcNotification
impl Serialize for JsonRpcNotification
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 JsonRpcNotification
impl RefUnwindSafe for JsonRpcNotification
impl Send for JsonRpcNotification
impl Sync for JsonRpcNotification
impl Unpin for JsonRpcNotification
impl UnsafeUnpin for JsonRpcNotification
impl UnwindSafe for JsonRpcNotification
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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<B> IntoFunctionResponse<B, Body> for Bwhere
B: Serialize,
impl<B> IntoFunctionResponse<B, Body> for Bwhere
B: Serialize,
Source§fn into_response(self) -> FunctionResponse<B, Body>
fn into_response(self) -> FunctionResponse<B, Body>
Convert the type into a FunctionResponse.