File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ use core:: fmt:: { Debug } ;
2+
3+ use serde_:: { Serialize , Deserialize } ;
4+
5+ pub trait Protocol < Id > {
6+ type ProtocolError : ProtocolError < Id > ;
7+ }
8+
9+ pub trait ProtocolError < Id > : Debug + Clone + Serialize + for < ' de > Deserialize < ' de > { }
10+
11+ pub trait ChainedProtocol < Id > : ' static + Debug {
12+ type Protocol1 : Protocol < Id > ;
13+ }
14+
15+ #[ derive_where:: derive_where( Debug , Clone ) ]
16+ #[ derive( Serialize , Deserialize ) ]
17+ #[ serde( crate = "serde_" ) ]
18+ #[ serde( bound( serialize = "
19+ <C::Protocol1 as Protocol<Id>>::ProtocolError: Serialize,
20+ " ) ) ]
21+ #[ serde( bound( deserialize = "
22+ <C::Protocol1 as Protocol<Id>>::ProtocolError: for<'x> Deserialize<'x>,
23+ " ) ) ]
24+ pub enum ChainedProtocolError < Id , C >
25+ where
26+ C : ChainedProtocol < Id > ,
27+ {
28+ Protocol1 ( <C :: Protocol1 as Protocol < Id > >:: ProtocolError ) ,
29+ }
30+
31+ impl < Id , C > ProtocolError < Id > for ChainedProtocolError < Id , C >
32+ where
33+ C : ChainedProtocol < Id > ,
34+ {
35+
36+ }
You can’t perform that action at this time.
0 commit comments