Enum cln_plugin::codec::JsonRpc
source · [−]pub enum JsonRpc<N, R> {
Request(usize, R),
Notification(N),
CustomRequest(usize, Value),
CustomNotification(Value),
}Variants
Request(usize, R)
Notification(N)
CustomRequest(usize, Value)
CustomNotification(Value)
Trait Implementations
sourceimpl<'de, N, R> Deserialize<'de> for JsonRpc<N, R> where
N: Deserialize<'de> + Debug,
R: Deserialize<'de> + Debug,
impl<'de, N, R> Deserialize<'de> for JsonRpc<N, R> where
N: Deserialize<'de> + Debug,
R: Deserialize<'de> + Debug,
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
sourcefn 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> RefUnwindSafe for JsonRpc<N, R> where
N: RefUnwindSafe,
R: RefUnwindSafe,
impl<N, R> Send for JsonRpc<N, R> where
N: Send,
R: Send,
impl<N, R> Sync for JsonRpc<N, R> where
N: Sync,
R: Sync,
impl<N, R> Unpin for JsonRpc<N, R> where
N: Unpin,
R: Unpin,
impl<N, R> UnwindSafe for JsonRpc<N, R> where
N: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more