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>) -> Self
Sourcepub fn new_no_params(method: String) -> Self
pub fn new_no_params(method: String) -> Self
Create a new notification with no parameters
Sourcepub fn new_with_object_params(
method: String,
params: HashMap<String, Value>,
) -> Self
pub fn new_with_object_params( method: String, params: HashMap<String, Value>, ) -> Self
Create a new notification with object parameters
Sourcepub fn new_with_array_params(method: String, params: Vec<Value>) -> Self
pub fn new_with_array_params(method: String, params: Vec<Value>) -> Self
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 · 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<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
Auto Trait Implementations§
impl Freeze for JsonRpcNotification
impl RefUnwindSafe for JsonRpcNotification
impl Send for JsonRpcNotification
impl Sync for JsonRpcNotification
impl Unpin 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