Beginning of `stack-next` refactor
-Refactoring the protocol stack into something similar to a runtime. -Handles merging handler builders which is placing the ground work for plugins in. - Increased metadata generation during compilation enables less ser/de during execution. - Goal is to have an O(1) time from incoming operation to calling handlers. - Decreased penalty for using the statically typed API from within your code, now avoids some allocation. # Changes - Added `GiteratedRuntime` which is to replace the current unified stack - Added `RuntimeBuilder` which does what the current `OperationHandlers` struct does, but much better. - Added `RuntimeMetadata` to store type metadata for new `Any` based internals - Refactored serde_json out of the internal operation handling
parent: tbd commit: 708dea4
1 | use |
2 | , |
3 | , | PhantomData
4 | str FromStr, |
5 | ; |
6 | |
7 | use Error; |
8 | |
9 | use crate:: |
10 | , |
11 | , | ObjectBackend
12 | , | GiteratedOperation
13 | , |
14 | , |
15 | ; |
16 | |
17 | |
18 | pub use *; |
19 | |
20 | |
21 | |
22 | 'b, |
23 | S: Clone + Send + Sync, |
24 | O: GiteratedObject, |
25 | B: + 'b + Send + Sync + Clone, |
26 | > |
27 | pub(crate) inner: O, |
28 | pub(crate) backend: B, |
29 | pub(crate) _marker: , |
30 | |
31 | |
32 | |
33 | Object |
34 | |
35 | |
36 | &self.inner |
37 | |
38 | |
39 | pub unsafe |
40 | Object |
41 | inner: object, |
42 | backend, |
43 | _marker: PhantomData, |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | S: Clone + Send + Sync, |
50 | O: GiteratedObject + Display, |
51 | B: + Send + Sync + Clone, |
52 | > |
53 | |
54 | |
55 | self.inner.fmt |
56 | |
57 | |
58 | |
59 | |
60 | ; |
61 | |
62 | ; |
63 | |
64 | |
65 | |
66 | 'b, |
67 | I: Clone + Send + Sync, |
68 | O: GiteratedObject + Clone + Debug + 'static, |
69 | B: , |
70 | > |
71 | |
72 | pub async |
73 | &mut self, |
74 | operation_state: &I, |
75 | |
76 | let result = self |
77 | .request |
78 | GetValue |
79 | value_name: value_name .to_string, |
80 | _marker: PhantomData, |
81 | , |
82 | operation_state, |
83 | |
84 | .await; |
85 | |
86 | result |
87 | |
88 | |
89 | pub async |
90 | &mut self, |
91 | operation_state: &I, |
92 | |
93 | self.request |
94 | GetSetting |
95 | setting_name: name .to_string, |
96 | , |
97 | operation_state, |
98 | |
99 | .await |
100 | .map |
101 | |
102 | |
103 | pub async |
104 | &mut self, |
105 | setting: S, |
106 | operation_state: &I, |
107 | |
108 | self.request |
109 | SetSetting |
110 | setting_name: name .to_string, |
111 | value: AnySetting, |
112 | , |
113 | operation_state, |
114 | |
115 | .await |
116 | |
117 | |
118 | pub async |
119 | &mut self, |
120 | request: R, |
121 | operation_state: &I, |
122 | |
123 | self.backend |
124 | .object_operation |
125 | self.inner.clone, |
126 | , | operation_name
127 | request, |
128 | operation_state, |
129 | |
130 | .await |
131 | |
132 | |
133 |