pub struct Notification {
pub jsonrpc: String,
pub method: String,
pub params: Option<Value>,
}
Expand description
JSON-RPC notification
Fields§
§jsonrpc: String
Protocol header
method: String
Method name
params: Option<Value>
Optional method arguments
Implementations§
Source§impl Notification
impl Notification
Source§impl Notification
impl Notification
Sourcepub fn new<M>(method: M) -> Selfwhere
M: ToString,
pub fn new<M>(method: M) -> Selfwhere
M: ToString,
Create a new notification with the provided method
Sourcepub fn with_params<P>(self, params: P) -> Result<Self, Error>where
P: Serialize,
pub fn with_params<P>(self, params: P) -> Result<Self, Error>where
P: Serialize,
Replace the methods arguments with the provided value
Sourcepub fn with_params_value(self, params: Value) -> Self
pub fn with_params_value(self, params: Value) -> Self
Replace the methods arguments with the parsed value
Sourcepub fn parse_json(json: &str) -> Result<Self, Error>
pub fn parse_json(json: &str) -> Result<Self, Error>
Parse a notification from the provided JSON
Trait Implementations§
Source§impl Clone for Notification
impl Clone for Notification
Source§fn clone(&self) -> Notification
fn clone(&self) -> Notification
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 Notification
impl Debug for Notification
Source§impl<'de> Deserialize<'de> for Notification
impl<'de> Deserialize<'de> for Notification
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 Display for Notification
impl Display for Notification
Source§impl From<Notification> for Message
impl From<Notification> for Message
Source§fn from(notification: Notification) -> Self
fn from(notification: Notification) -> Self
Converts to this type from the input type.
Source§impl FromStr for Notification
impl FromStr for Notification
Source§impl Serialize for Notification
impl Serialize for Notification
Auto Trait Implementations§
impl Freeze for Notification
impl RefUnwindSafe for Notification
impl Send for Notification
impl Sync for Notification
impl Unpin for Notification
impl UnwindSafe for Notification
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