workflow_rpc/types.rs
1//!
2//! Trait constraints for RPC methods (Ops) and message (Req,Resp,Msg).
3//!
4
5use crate::imports::*;
6
7/// Marker trait bundling the bounds required of an RPC operation (method) id
8/// type: it must be hashable and comparable for dispatch, serializable via both
9/// Borsh and Serde, and shareable across threads.
10pub trait OpsT:
11 Debug
12 + Clone
13 + Eq
14 + Hash
15 + BorshSerialize
16 + BorshDeserialize
17 + Serialize
18 + DeserializeOwned
19 + Send
20 + Sync
21 + 'static
22{
23}
24impl<T> OpsT for T where
25 T: Debug
26 + Clone
27 + Eq
28 + Hash
29 + BorshSerialize
30 + BorshDeserialize
31 + Serialize
32 + DeserializeOwned
33 + Send
34 + Sync
35 + 'static
36{
37}
38
39/// Marker trait bundling the bounds required of an RPC message payload type
40/// (request, response or notification): it must be serializable via both Borsh
41/// and Serde and shareable across threads.
42pub trait MsgT:
43 BorshSerialize + BorshDeserialize + Serialize + DeserializeOwned + Send + Sync + 'static
44{
45}
46
47impl<T> MsgT for T where
48 T: BorshSerialize + BorshDeserialize + Serialize + DeserializeOwned + Send + Sync + 'static
49{
50}