File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -87,19 +87,27 @@ pub mod util;
8787#[ cfg( not( feature = "rpc" ) ) ]
8888mod util;
8989
90+ /// Requirements for a local RPC message.
91+ ///
92+ /// Local RPC messages must be Send and Sync so they can be sent between
93+ /// threads, but they don't have to be serializable. They can not be serializable
94+ /// since they contain channels.
95+ ///
96+ /// In addition we require Debug for convenience.
97+ pub trait LocalRpcMessage : Debug + Send + Sync + Unpin + ' static { }
98+
99+ impl < T > LocalRpcMessage for T where T : Debug + Send + Sync + Unpin + ' static { }
100+
90101/// Requirements for a RPC message
91102///
92103/// Even when just using the mem transport, we require messages to be Serializable and Deserializable.
93104/// Likewise, even when using the quinn transport, we require messages to be Send.
94105///
95106/// This does not seem like a big restriction. If you want a pure memory channel without the possibility
96107/// to also use the quinn transport, you might want to use a mpsc channel directly.
97- pub trait RpcMessage : Debug + Serialize + DeserializeOwned + Send + Sync + Unpin + ' static { }
108+ pub trait RpcMessage : LocalRpcMessage + Serialize + DeserializeOwned { }
98109
99- impl < T > RpcMessage for T where
100- T : Debug + Serialize + DeserializeOwned + Send + Sync + Unpin + ' static
101- {
102- }
110+ impl < T > RpcMessage for T where T : LocalRpcMessage + Serialize + DeserializeOwned { }
103111
104112/// Marker trait for a service
105113///
You can’t perform that action at this time.
0 commit comments