pub enum JsonRpc<N, R> {
Request(Value, R),
Notification(N),
}Variants§
Trait Implementations§
Source§impl<'de, N, R> Deserialize<'de> for JsonRpc<N, R>
This function disentangles the various cases:
impl<'de, N, R> Deserialize<'de> for JsonRpc<N, R>
This function disentangles the various cases:
-
If we have an
idthen it is a request -
Otherwise it’s a notification that doesn’t require a response.
Furthermore we distinguish between the built-in types and the custom user notifications/methods:
-
We either match a built-in type above,
-
Or it’s a custom one, so we pass it around just as a
serde_json::Value
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<N, R> Freeze for JsonRpc<N, R>
impl<N, R> RefUnwindSafe for JsonRpc<N, R>where
R: RefUnwindSafe,
N: RefUnwindSafe,
impl<N, R> Send for JsonRpc<N, R>
impl<N, R> Sync for JsonRpc<N, R>
impl<N, R> Unpin for JsonRpc<N, R>
impl<N, R> UnwindSafe for JsonRpc<N, R>where
R: UnwindSafe,
N: UnwindSafe,
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