Base protocol refactor complete
parent: tbd commit: 079d544
1 | use |
2 | , | type_name
3 | , | Infallible
4 | , |
5 | , | PhantomData
6 | str FromStr, |
7 | ; |
8 | |
9 | use Error; |
10 | use ; |
11 | use Value; |
12 | |
13 | use crate:: |
14 | , |
15 | , |
16 | , |
17 | ; |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | ; |
25 | |
26 | ; |
27 | |
28 | |
29 | |
30 | type Success: Serialize + DeserializeOwned + Send; |
31 | type Failure: Serialize + DeserializeOwned + Send; |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | type Object: GiteratedObject; |
40 | |
41 | ; |
42 | |
43 | |
44 | |
45 | |
46 | inner: O, |
47 | backend: B, |
48 | _marker: , |
49 | |
50 | |
51 | |
52 | |
53 | async |
54 | &self, |
55 | object: O, |
56 | operation: D, |
57 | ; |
58 | |
59 | async |
60 | &self, |
61 | object_str: &str, |
62 | ; |
63 | |
64 | |
65 | |
66 | pub unsafe |
67 | Object |
68 | inner: object, |
69 | backend, |
70 | _marker: PhantomData, |
71 | |
72 | |
73 | |
74 | |
75 | // impl<'b, O: GiteratedObject, B: ObjectBackend> Object<'b, O, B> { |
76 | // pub unsafe fn new_unchecked(value: O, backend: Arc<B>) -> Object<'b, O, B> { |
77 | // todo!() |
78 | // } |
79 | // } |
80 | |
81 | |
82 | Object |
83 | |
84 | // pub async fn get<V: GiteratedObjectValue<Object = O> + Send>( |
85 | // &self, |
86 | // ) -> Result<V, OperationError<ObjectRequestError>> { |
87 | // let operation: GetValue<V> = GetValue { |
88 | // value_name: V::value_name().to_string(), |
89 | // _marker: PhantomData, |
90 | // }; |
91 | |
92 | // let _message: GiteratedMessage<O, _> = GiteratedMessage { |
93 | // object: self.inner.clone(), |
94 | // operation: operation.operation_name().to_string(), |
95 | // payload: operation, |
96 | // }; |
97 | |
98 | // todo!() |
99 | // } |
100 | |
101 | // pub fn request<R: GiteratedOperation<O> + Debug>( |
102 | // &mut self, |
103 | // request: R, |
104 | // ) -> Result<R::Success, R::Failure> { |
105 | // self.backend.object_operation(self.inner.clone(), request); |
106 | |
107 | // todo!() |
108 | // } |
109 | |
110 | |
111 | |
112 | |
113 | pub value_name: String, |
114 | _marker: , |
115 | |
116 | |
117 | |
118 | for GetValue |
119 | |
120 | |
121 | "get_value" |
122 | |
123 | type Success = V; |
124 | type Failure = GetValueError; |
125 | |
126 | |
127 | |
128 | |
129 | |
130 | #[serde(with = "string")] |
131 | pub object: O, |
132 | pub operation: String, |
133 | pub payload: V, |
134 | |
135 | |
136 | |
137 | use Display; |
138 | use FromStr; |
139 | |
140 | use ; |
141 | |
142 | |
143 | |
144 | T: Display, |
145 | S: Serializer, |
146 | |
147 | serializer.collect_str |
148 | |
149 | |
150 | |
151 | |
152 | T: FromStr, |
153 | : Display, | Err
154 | D: , |
155 | |
156 | String deserialize? |
157 | .parse |
158 | .map_err |
159 | |
160 | |
161 | |
162 | |
163 | |
164 | &self, |
165 | |
166 | let object = from_object_str .map_err?; |
167 | let payload = .map_err?; |
168 | |
169 | Ok |
170 | object, |
171 | operation: self.operation.clone, |
172 | payload, |
173 | |
174 | |
175 | |
176 | |
177 | |
178 | |
179 | |
180 | for GiteratedMessage |
181 | |
182 | |
183 | f.debug_struct |
184 | .field |
185 | .field |
186 | .field |
187 | .finish |
188 | |
189 | |
190 | |
191 | |
192 | ; |
193 | |
194 | |
195 | ; |
196 | |
197 | |
198 | type Success = ObjectResponse; |
199 | |
200 | type Failure = ObjectRequestError; |
201 | |
202 | |
203 | |
204 | |
205 | |
206 | Deserialization, |
207 | |
208 | |
209 | |
210 | |
211 | ; |
212 | |
213 | |
214 | |
215 | "any" |
216 | |
217 | |
218 | |
219 | Ok |
220 | |
221 | |
222 | |
223 | |
224 | |
225 | f.write_str |
226 | |
227 | |
228 | |
229 | |
230 | type Err = Infallible; |
231 | |
232 | |
233 | Ok |
234 | |
235 | |
236 | |
237 | |
238 | |
239 | |
240 | ; |
241 | |
242 | |
243 | type Success = ; |
244 | |
245 | type Failure = ; |
246 | |
247 | |
248 | |
249 | pub async |
250 | &mut self, |
251 | |
252 | self.request |
253 | value_name: value_name .to_string, |
254 | _marker: PhantomData, |
255 | |
256 | .await |
257 | |
258 | |
259 | pub async |
260 | &mut self, |
261 | |
262 | self.request |
263 | setting_name: name .to_string, |
264 | _marker: PhantomData, |
265 | |
266 | .await |
267 | |
268 | |
269 | pub async |
270 | &mut self, |
271 | setting: S, |
272 | |
273 | self.request |
274 | setting_name: name .to_string, |
275 | value: setting, |
276 | |
277 | .await |
278 | |
279 | |
280 | pub async |
281 | &mut self, |
282 | request: R, |
283 | |
284 | self.backend |
285 | .object_operation |
286 | .await |
287 | |
288 | |
289 |