pub struct JsonRpcNotification {
pub jsonrpc_version: String,
pub method: String,
pub params: Option<Value>,
}
Expand description
Data structure for a JSON-RPC notification.
Fields§
§jsonrpc_version: String
§method: String
§params: Option<Value>
Implementations§
Source§impl JsonRpcNotification
impl JsonRpcNotification
pub fn new(method: String, params: Option<Value>) -> JsonRpcNotification
Sourcepub fn new_with_result_params(
result: Result<Value, ProtocolError>,
method: String,
) -> JsonRpcNotification
pub fn new_with_result_params( result: Result<Value, ProtocolError>, method: String, ) -> JsonRpcNotification
Creates a notification for a given result.
The result
argument will be serialized into JsonRpcNotificationResultParams
,
which will be used as the value for the params
field in the notification.
Sourcepub fn get_result(self) -> Result<Value, SerializableProtocolError>
pub fn get_result(self) -> Result<Value, SerializableProtocolError>
Retrieves a Result
from a given notification.
The params
notification value must be a JsonRpcNotificationResultParams
.
Returns Value::Null
if the result cannot be deserialized, or if the value is not present.
Trait Implementations§
Source§impl Clone for JsonRpcNotification
impl Clone for JsonRpcNotification
Source§fn clone(&self) -> JsonRpcNotification
fn clone(&self) -> JsonRpcNotification
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 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 From<JsonRpcNotification> for JsonRpcMessage
impl From<JsonRpcNotification> for JsonRpcMessage
Source§fn from(value: JsonRpcNotification) -> JsonRpcMessage
fn from(value: JsonRpcNotification) -> JsonRpcMessage
Converts to this type from the input type.
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 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