#[non_exhaustive]pub enum ProtocolLevelNotification {
CancelRequestNotification(CancelRequestNotification),
}Expand description
General protocol-level notifications that all sides are expected to implement.
Notifications whose methods start with ‘$/’ are messages which
are protocol implementation dependent and might not be implementable in all
clients or agents. For example if the implementation uses a single threaded
synchronous programming language then there is little it can do to react to
a $/cancel_request notification. If an agent or client receives
notifications starting with ‘$/’ it is free to ignore the notification.
Notifications do not expect a response.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CancelRequestNotification(CancelRequestNotification)
Cancels an ongoing request.
This is a notification sent by the side that sent a request to cancel that request.
Upon receiving this notification, the receiver:
- MAY cancel the corresponding request activity and all nested activities
- MAY send any pending notifications.
- MUST send one of these responses for the original request:
- Valid response with appropriate data (partial results or cancellation marker)
- Error response with code
-32800(Cancelled)
See protocol docs: Cancellation
Implementations§
Source§impl ProtocolLevelNotification
impl ProtocolLevelNotification
Sourcepub fn supports_method(method: &str) -> bool
pub fn supports_method(method: &str) -> bool
Whether this enum recognizes the method with the enabled Cargo features, including extensions when it has an extension variant.
This does not check the peer’s advertised capabilities.
Sourcepub fn from_method_and_params(
method: &str,
params: &Value,
) -> Result<ProtocolLevelNotification, MethodDispatchError>
pub fn from_method_and_params( method: &str, params: &Value, ) -> Result<ProtocolLevelNotification, MethodDispatchError>
Parses parameters selected by the JSON-RPC method name.
Use this instead of the enum’s untagged Deserialize
implementation. Untagged deserialization selects by payload
shape, which can silently select an unrelated variant.
The payload is passed unchanged to the selected type’s
deserializer. In particular, null is not converted to {}.
Extension payloads retain their JSON value and method name.
§Errors
Returns crate::MethodDispatchError::UnknownMethod for an
unsupported method, or crate::MethodDispatchError::InvalidPayload
for a malformed payload.
Trait Implementations§
Source§impl Clone for ProtocolLevelNotification
impl Clone for ProtocolLevelNotification
Source§fn clone(&self) -> ProtocolLevelNotification
fn clone(&self) -> ProtocolLevelNotification
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtocolLevelNotification
impl Debug for ProtocolLevelNotification
Source§impl<'de> Deserialize<'de> for ProtocolLevelNotification
impl<'de> Deserialize<'de> for ProtocolLevelNotification
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProtocolLevelNotification, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProtocolLevelNotification, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonRpcMessage for ProtocolLevelNotification
impl JsonRpcMessage for ProtocolLevelNotification
Source§fn matches_method(method: &str) -> bool
fn matches_method(method: &str) -> bool
Source§fn to_untyped_message(&self) -> Result<UntypedMessage, Error>
fn to_untyped_message(&self) -> Result<UntypedMessage, Error>
impl JsonRpcNotification for ProtocolLevelNotification
Source§impl JsonSchema for ProtocolLevelNotification
impl JsonSchema for ProtocolLevelNotification
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more