1
1
/// Metadata for a View
2
- #[ derive( Clone , PartialEq , :: prost:: Message , serde :: Serialize , serde :: Deserialize ) ]
2
+ #[ derive( serde :: Serialize , serde :: Deserialize , Clone , PartialEq , :: prost:: Message ) ]
3
3
pub struct Meta {
4
4
/// Underlying distributed ledger protocol.
5
5
#[ prost( enumeration = "meta::Protocol" , tag = "1" ) ]
@@ -8,67 +8,92 @@ pub struct Meta {
8
8
/// If the observer and network are synchronizing on a global clock
9
9
/// there won't be a need to distinguish between static and dynamic views.
10
10
#[ prost( string, tag = "2" ) ]
11
- pub timestamp : std :: string:: String ,
11
+ pub timestamp : :: prost :: alloc :: string:: String ,
12
12
/// Notorization, SPV, ZKP, etc. Possibly enum
13
13
#[ prost( string, tag = "3" ) ]
14
- pub proof_type : std :: string:: String ,
14
+ pub proof_type : :: prost :: alloc :: string:: String ,
15
15
/// The data field's serialization format (e.g. JSON, XML, Protobuf)
16
16
#[ prost( string, tag = "4" ) ]
17
- pub serialization_format : std :: string:: String ,
17
+ pub serialization_format : :: prost :: alloc :: string:: String ,
18
18
}
19
+ /// Nested message and enum types in `Meta`.
19
20
pub mod meta {
20
- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , PartialOrd , Ord , :: prost:: Enumeration ) ]
21
+ #[ derive(
22
+ serde:: Serialize ,
23
+ serde:: Deserialize ,
24
+ Clone ,
25
+ Copy ,
26
+ Debug ,
27
+ PartialEq ,
28
+ Eq ,
29
+ Hash ,
30
+ PartialOrd ,
31
+ Ord ,
32
+ :: prost:: Enumeration ,
33
+ ) ]
21
34
#[ repr( i32 ) ]
22
- #[ derive( serde:: Serialize , serde:: Deserialize ) ]
23
35
pub enum Protocol {
24
36
Bitcoin = 0 ,
25
37
Ethereum = 1 ,
26
38
Fabric = 3 ,
27
39
Corda = 4 ,
28
40
}
29
41
}
30
- #[ derive( Clone , PartialEq , :: prost:: Message , serde :: Serialize , serde :: Deserialize ) ]
42
+ #[ derive( serde :: Serialize , serde :: Deserialize , Clone , PartialEq , :: prost:: Message ) ]
31
43
pub struct View {
32
44
#[ prost( message, optional, tag = "1" ) ]
33
- pub meta : :: std :: option:: Option < Meta > ,
45
+ pub meta : :: core :: option:: Option < Meta > ,
34
46
/// Represents the data playload of this view.
35
47
/// The representation of Fabric, Corda etc will be captured elsewhere.
36
48
/// For some protocols, like Bitcoin, the structure of an SPV proof is well known.
37
- #[ prost( bytes, tag = "2" ) ]
38
- pub data : std :: vec:: Vec < u8 > ,
49
+ #[ prost( bytes = "vec" , tag = "2" ) ]
50
+ pub data : :: prost :: alloc :: vec:: Vec < u8 > ,
39
51
}
40
52
/// View represents the response from a remote network
41
- #[ derive( Clone , PartialEq , :: prost:: Message , serde :: Serialize , serde :: Deserialize ) ]
53
+ #[ derive( serde :: Serialize , serde :: Deserialize , Clone , PartialEq , :: prost:: Message ) ]
42
54
pub struct ViewPayload {
43
55
#[ prost( string, tag = "1" ) ]
44
- pub request_id : std :: string:: String ,
56
+ pub request_id : :: prost :: alloc :: string:: String ,
45
57
#[ prost( oneof = "view_payload::State" , tags = "2, 3" ) ]
46
- pub state : :: std :: option:: Option < view_payload:: State > ,
58
+ pub state : :: core :: option:: Option < view_payload:: State > ,
47
59
}
60
+ /// Nested message and enum types in `ViewPayload`.
48
61
pub mod view_payload {
49
- #[ derive( Clone , PartialEq , :: prost:: Oneof , serde :: Serialize , serde :: Deserialize ) ]
62
+ #[ derive( serde :: Serialize , serde :: Deserialize , Clone , PartialEq , :: prost:: Oneof ) ]
50
63
pub enum State {
51
64
#[ prost( message, tag = "2" ) ]
52
65
View ( super :: View ) ,
53
66
#[ prost( string, tag = "3" ) ]
54
- Error ( std :: string:: String ) ,
67
+ Error ( :: prost :: alloc :: string:: String ) ,
55
68
}
56
69
}
57
70
/// the payload that is used for the communication between the requesting relay
58
71
/// and its network
59
- #[ derive( Clone , PartialEq , :: prost:: Message , serde :: Serialize , serde :: Deserialize ) ]
72
+ #[ derive( serde :: Serialize , serde :: Deserialize , Clone , PartialEq , :: prost:: Message ) ]
60
73
pub struct RequestState {
61
74
#[ prost( string, tag = "1" ) ]
62
- pub request_id : std :: string:: String ,
75
+ pub request_id : :: prost :: alloc :: string:: String ,
63
76
#[ prost( enumeration = "request_state::Status" , tag = "2" ) ]
64
77
pub status : i32 ,
65
78
#[ prost( oneof = "request_state::State" , tags = "3, 4" ) ]
66
- pub state : :: std :: option:: Option < request_state:: State > ,
79
+ pub state : :: core :: option:: Option < request_state:: State > ,
67
80
}
81
+ /// Nested message and enum types in `RequestState`.
68
82
pub mod request_state {
69
- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , PartialOrd , Ord , :: prost:: Enumeration ) ]
83
+ #[ derive(
84
+ serde:: Serialize ,
85
+ serde:: Deserialize ,
86
+ Clone ,
87
+ Copy ,
88
+ Debug ,
89
+ PartialEq ,
90
+ Eq ,
91
+ Hash ,
92
+ PartialOrd ,
93
+ Ord ,
94
+ :: prost:: Enumeration ,
95
+ ) ]
70
96
#[ repr( i32 ) ]
71
- #[ derive( serde:: Serialize , serde:: Deserialize ) ]
72
97
pub enum Status {
73
98
/// pending ACK from remote relay
74
99
PendingAck = 0 ,
@@ -77,11 +102,11 @@ pub mod request_state {
77
102
Error = 2 ,
78
103
Completed = 3 ,
79
104
}
80
- #[ derive( Clone , PartialEq , :: prost:: Oneof , serde :: Serialize , serde :: Deserialize ) ]
105
+ #[ derive( serde :: Serialize , serde :: Deserialize , Clone , PartialEq , :: prost:: Oneof ) ]
81
106
pub enum State {
82
107
#[ prost( message, tag = "3" ) ]
83
108
View ( super :: View ) ,
84
109
#[ prost( string, tag = "4" ) ]
85
- Error ( std :: string:: String ) ,
110
+ Error ( :: prost :: alloc :: string:: String ) ,
86
111
}
87
112
}
0 commit comments