OLD | NEW |
| (Empty) |
1 //! This file was auto-generated by the Rust bindings generator. | |
2 #![allow(bad_style)] | |
3 #![allow(unused_imports)] | |
4 #![allow(unused_variables)] | |
5 #![allow(dead_code)] | |
6 | |
7 use mojo::bindings::decoding; | |
8 use mojo::bindings::decoding::{Decoder, ValidationError}; | |
9 use mojo::bindings::encoding; | |
10 use mojo::bindings::encoding::{Context, DataHeaderValue, DATA_HEADER_SIZE, Encod
er}; | |
11 use mojo::bindings::message; | |
12 use mojo::bindings::message::MessageHeader; | |
13 use mojo::bindings::mojom; | |
14 use mojo::bindings::mojom::{MojomEncodable, MojomPointer, MojomStruct, MojomUnio
n, MojomMessage, | |
15 MojomInterface, MojomInterfaceSend, MojomInterfaceRe
cv, | |
16 MojomMessageOption, UNION_SIZE}; | |
17 | |
18 use mojo::system; | |
19 use mojo::system::{CastHandle, UntypedHandle}; | |
20 use mojo::system::message_pipe; | |
21 | |
22 use std::collections::HashMap; | |
23 use std::vec::Vec; | |
24 | |
25 // Top-level constants: | |
26 | |
27 | |
28 // Structs: | |
29 // -- StructA -- | |
30 | |
31 // Constants | |
32 // Enums | |
33 // Struct version information | |
34 const StructAVersions: [(u32, u32); 1] = [(0, 16)]; | |
35 | |
36 // Struct definition | |
37 pub struct StructA { | |
38 pub i: u64, | |
39 } | |
40 | |
41 impl MojomPointer for StructA { | |
42 fn header_data(&self) -> DataHeaderValue { | |
43 DataHeaderValue::Version(0) | |
44 } | |
45 fn serialized_size(&self, _context: &Context) -> usize { | |
46 16 | |
47 } | |
48 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
49 MojomEncodable::encode(self.i, encoder, context.clone()); | |
50 | |
51 } | |
52 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
53 let version = { | |
54 let mut state = decoder.get_mut(&context); | |
55 match state.decode_struct_header(&StructAVersions) { | |
56 Ok(header) => header.data(), | |
57 Err(err) => return Err(err), | |
58 } | |
59 }; | |
60 let i = match <u64>::decode(decoder, context.clone()) { | |
61 Ok(value) => value, | |
62 Err(err) => return Err(err), | |
63 }; | |
64 Ok(StructA { i: i }) | |
65 } | |
66 } | |
67 | |
68 impl MojomEncodable for StructA { | |
69 impl_encodable_for_pointer!(); | |
70 fn compute_size(&self, context: Context) -> usize { | |
71 encoding::align_default(self.serialized_size(&context)) + | |
72 self.i.compute_size(context.clone()) | |
73 } | |
74 } | |
75 | |
76 impl MojomStruct for StructA {} | |
77 // -- StructB -- | |
78 | |
79 // Constants | |
80 // Enums | |
81 // Struct version information | |
82 const StructBVersions: [(u32, u32); 1] = [(0, 16)]; | |
83 | |
84 // Struct definition | |
85 pub struct StructB { | |
86 pub struct_a: StructA, | |
87 } | |
88 | |
89 impl MojomPointer for StructB { | |
90 fn header_data(&self) -> DataHeaderValue { | |
91 DataHeaderValue::Version(0) | |
92 } | |
93 fn serialized_size(&self, _context: &Context) -> usize { | |
94 16 | |
95 } | |
96 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
97 MojomEncodable::encode(self.struct_a, encoder, context.clone()); | |
98 | |
99 } | |
100 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
101 let version = { | |
102 let mut state = decoder.get_mut(&context); | |
103 match state.decode_struct_header(&StructBVersions) { | |
104 Ok(header) => header.data(), | |
105 Err(err) => return Err(err), | |
106 } | |
107 }; | |
108 let struct_a = match <StructA>::decode(decoder, context.clone()) { | |
109 Ok(value) => value, | |
110 Err(err) => return Err(err), | |
111 }; | |
112 Ok(StructB { struct_a: struct_a }) | |
113 } | |
114 } | |
115 | |
116 impl MojomEncodable for StructB { | |
117 impl_encodable_for_pointer!(); | |
118 fn compute_size(&self, context: Context) -> usize { | |
119 encoding::align_default(self.serialized_size(&context)) + | |
120 self.struct_a.compute_size(context.clone()) | |
121 } | |
122 } | |
123 | |
124 impl MojomStruct for StructB {} | |
125 // -- StructC -- | |
126 | |
127 // Constants | |
128 // Enums | |
129 // Struct version information | |
130 const StructCVersions: [(u32, u32); 1] = [(0, 16)]; | |
131 | |
132 // Struct definition | |
133 pub struct StructC { | |
134 pub data: Vec<u8>, | |
135 } | |
136 | |
137 impl MojomPointer for StructC { | |
138 fn header_data(&self) -> DataHeaderValue { | |
139 DataHeaderValue::Version(0) | |
140 } | |
141 fn serialized_size(&self, _context: &Context) -> usize { | |
142 16 | |
143 } | |
144 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
145 MojomEncodable::encode(self.data, encoder, context.clone()); | |
146 | |
147 } | |
148 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
149 let version = { | |
150 let mut state = decoder.get_mut(&context); | |
151 match state.decode_struct_header(&StructCVersions) { | |
152 Ok(header) => header.data(), | |
153 Err(err) => return Err(err), | |
154 } | |
155 }; | |
156 let data = match <Vec<u8>>::decode(decoder, context.clone()) { | |
157 Ok(value) => value, | |
158 Err(err) => return Err(err), | |
159 }; | |
160 Ok(StructC { data: data }) | |
161 } | |
162 } | |
163 | |
164 impl MojomEncodable for StructC { | |
165 impl_encodable_for_pointer!(); | |
166 fn compute_size(&self, context: Context) -> usize { | |
167 encoding::align_default(self.serialized_size(&context)) + | |
168 self.data.compute_size(context.clone()) | |
169 } | |
170 } | |
171 | |
172 impl MojomStruct for StructC {} | |
173 // -- StructD -- | |
174 | |
175 // Constants | |
176 // Enums | |
177 // Struct version information | |
178 const StructDVersions: [(u32, u32); 1] = [(0, 16)]; | |
179 | |
180 // Struct definition | |
181 pub struct StructD { | |
182 pub message_pipes: Vec<message_pipe::MessageEndpoint>, | |
183 } | |
184 | |
185 impl MojomPointer for StructD { | |
186 fn header_data(&self) -> DataHeaderValue { | |
187 DataHeaderValue::Version(0) | |
188 } | |
189 fn serialized_size(&self, _context: &Context) -> usize { | |
190 16 | |
191 } | |
192 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
193 MojomEncodable::encode(self.message_pipes, encoder, context.clone()); | |
194 | |
195 } | |
196 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
197 let version = { | |
198 let mut state = decoder.get_mut(&context); | |
199 match state.decode_struct_header(&StructDVersions) { | |
200 Ok(header) => header.data(), | |
201 Err(err) => return Err(err), | |
202 } | |
203 }; | |
204 let message_pipes = match <Vec<message_pipe::MessageEndpoint>>::decode(d
ecoder, context.clone()) { | |
205 Ok(value) => value, | |
206 Err(err) => return Err(err), | |
207 }; | |
208 Ok(StructD { message_pipes: message_pipes }) | |
209 } | |
210 } | |
211 | |
212 impl MojomEncodable for StructD { | |
213 impl_encodable_for_pointer!(); | |
214 fn compute_size(&self, context: Context) -> usize { | |
215 encoding::align_default(self.serialized_size(&context)) + | |
216 self.message_pipes.compute_size(context.clone()) | |
217 } | |
218 } | |
219 | |
220 impl MojomStruct for StructD {} | |
221 // -- StructE -- | |
222 | |
223 // Constants | |
224 // Enums | |
225 // Struct version information | |
226 const StructEVersions: [(u32, u32); 1] = [(0, 24)]; | |
227 | |
228 // Struct definition | |
229 pub struct StructE { | |
230 pub struct_d: StructD, | |
231 pub data_pipe_consumer: system::data_pipe::Consumer<u8>, | |
232 } | |
233 | |
234 impl MojomPointer for StructE { | |
235 fn header_data(&self) -> DataHeaderValue { | |
236 DataHeaderValue::Version(0) | |
237 } | |
238 fn serialized_size(&self, _context: &Context) -> usize { | |
239 24 | |
240 } | |
241 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
242 MojomEncodable::encode(self.struct_d, encoder, context.clone()); | |
243 MojomEncodable::encode(self.data_pipe_consumer, encoder, context.clone()
); | |
244 | |
245 } | |
246 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
247 let version = { | |
248 let mut state = decoder.get_mut(&context); | |
249 match state.decode_struct_header(&StructEVersions) { | |
250 Ok(header) => header.data(), | |
251 Err(err) => return Err(err), | |
252 } | |
253 }; | |
254 let struct_d = match <StructD>::decode(decoder, context.clone()) { | |
255 Ok(value) => value, | |
256 Err(err) => return Err(err), | |
257 }; | |
258 let data_pipe_consumer = | |
259 match <system::data_pipe::Consumer<u8>>::decode(decoder, context.clo
ne()) { | |
260 Ok(value) => value, | |
261 Err(err) => return Err(err), | |
262 }; | |
263 Ok(StructE { | |
264 struct_d: struct_d, | |
265 data_pipe_consumer: data_pipe_consumer, | |
266 }) | |
267 } | |
268 } | |
269 | |
270 impl MojomEncodable for StructE { | |
271 impl_encodable_for_pointer!(); | |
272 fn compute_size(&self, context: Context) -> usize { | |
273 encoding::align_default(self.serialized_size(&context)) + | |
274 self.struct_d.compute_size(context.clone()) + | |
275 self.data_pipe_consumer.compute_size(context.clone()) | |
276 } | |
277 } | |
278 | |
279 impl MojomStruct for StructE {} | |
280 // -- StructF -- | |
281 | |
282 // Constants | |
283 // Enums | |
284 // Struct version information | |
285 const StructFVersions: [(u32, u32); 1] = [(0, 16)]; | |
286 | |
287 // Struct definition | |
288 pub struct StructF { | |
289 pub fixed_size_array: [u8; 3], | |
290 } | |
291 | |
292 impl MojomPointer for StructF { | |
293 fn header_data(&self) -> DataHeaderValue { | |
294 DataHeaderValue::Version(0) | |
295 } | |
296 fn serialized_size(&self, _context: &Context) -> usize { | |
297 16 | |
298 } | |
299 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
300 MojomEncodable::encode(self.fixed_size_array, encoder, context.clone()); | |
301 | |
302 } | |
303 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
304 let version = { | |
305 let mut state = decoder.get_mut(&context); | |
306 match state.decode_struct_header(&StructFVersions) { | |
307 Ok(header) => header.data(), | |
308 Err(err) => return Err(err), | |
309 } | |
310 }; | |
311 let fixed_size_array = match <[u8; 3]>::decode(decoder, context.clone())
{ | |
312 Ok(value) => value, | |
313 Err(err) => return Err(err), | |
314 }; | |
315 Ok(StructF { fixed_size_array: fixed_size_array }) | |
316 } | |
317 } | |
318 | |
319 impl MojomEncodable for StructF { | |
320 impl_encodable_for_pointer!(); | |
321 fn compute_size(&self, context: Context) -> usize { | |
322 encoding::align_default(self.serialized_size(&context)) + | |
323 self.fixed_size_array.compute_size(context.clone()) | |
324 } | |
325 } | |
326 | |
327 impl MojomStruct for StructF {} | |
328 // -- StructG -- | |
329 | |
330 // Constants | |
331 // Enums | |
332 // Struct version information | |
333 const StructGVersions: [(u32, u32); 3] = [(0, 16), (1, 24), (3, 32)]; | |
334 | |
335 // Struct definition | |
336 pub struct StructG { | |
337 pub i: i32, | |
338 pub b: bool, | |
339 pub struct_a: Option<StructA>, | |
340 pub str: Option<String>, | |
341 } | |
342 | |
343 impl MojomPointer for StructG { | |
344 fn header_data(&self) -> DataHeaderValue { | |
345 DataHeaderValue::Version(3) | |
346 } | |
347 fn serialized_size(&self, _context: &Context) -> usize { | |
348 32 | |
349 } | |
350 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
351 MojomEncodable::encode(self.i, encoder, context.clone()); | |
352 MojomEncodable::encode(self.b, encoder, context.clone()); | |
353 MojomEncodable::encode(self.struct_a, encoder, context.clone()); | |
354 MojomEncodable::encode(self.str, encoder, context.clone()); | |
355 | |
356 } | |
357 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
358 let version = { | |
359 let mut state = decoder.get_mut(&context); | |
360 match state.decode_struct_header(&StructGVersions) { | |
361 Ok(header) => header.data(), | |
362 Err(err) => return Err(err), | |
363 } | |
364 }; | |
365 let i = match <i32>::decode(decoder, context.clone()) { | |
366 Ok(value) => value, | |
367 Err(err) => return Err(err), | |
368 }; | |
369 let b = if version >= 3 { | |
370 match <bool>::decode(decoder, context.clone()) { | |
371 Ok(value) => value, | |
372 Err(err) => return Err(err), | |
373 } | |
374 } else { | |
375 Default::default() | |
376 }; | |
377 let struct_a = if version >= 1 { | |
378 match <Option<StructA>>::decode(decoder, context.clone()) { | |
379 Ok(value) => value, | |
380 Err(err) => return Err(err), | |
381 } | |
382 } else { | |
383 Default::default() | |
384 }; | |
385 let str = if version >= 3 { | |
386 match <Option<String>>::decode(decoder, context.clone()) { | |
387 Ok(value) => value, | |
388 Err(err) => return Err(err), | |
389 } | |
390 } else { | |
391 Default::default() | |
392 }; | |
393 Ok(StructG { | |
394 i: i, | |
395 b: b, | |
396 struct_a: struct_a, | |
397 str: str, | |
398 }) | |
399 } | |
400 } | |
401 | |
402 impl MojomEncodable for StructG { | |
403 impl_encodable_for_pointer!(); | |
404 fn compute_size(&self, context: Context) -> usize { | |
405 encoding::align_default(self.serialized_size(&context)) + | |
406 self.i.compute_size(context.clone()) + self.b.compute_size(context.clone
()) + | |
407 self.struct_a.compute_size(context.clone()) + self.str.compute_size(cont
ext.clone()) | |
408 } | |
409 } | |
410 | |
411 impl MojomStruct for StructG {} | |
412 // -- StructH -- | |
413 | |
414 // Constants | |
415 // Enums | |
416 // Struct version information | |
417 const StructHVersions: [(u32, u32); 1] = [(0, 48)]; | |
418 | |
419 // Struct definition | |
420 pub struct StructH { | |
421 pub a: bool, | |
422 pub b: u8, | |
423 pub c: Option<UnionA>, | |
424 pub d: Option<Vec<UnionA>>, | |
425 pub e: Option<HashMap<u8, UnionA>>, | |
426 } | |
427 | |
428 impl MojomPointer for StructH { | |
429 fn header_data(&self) -> DataHeaderValue { | |
430 DataHeaderValue::Version(0) | |
431 } | |
432 fn serialized_size(&self, _context: &Context) -> usize { | |
433 48 | |
434 } | |
435 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
436 MojomEncodable::encode(self.a, encoder, context.clone()); | |
437 MojomEncodable::encode(self.b, encoder, context.clone()); | |
438 MojomEncodable::encode(self.c, encoder, context.clone()); | |
439 MojomEncodable::encode(self.d, encoder, context.clone()); | |
440 MojomEncodable::encode(self.e, encoder, context.clone()); | |
441 | |
442 } | |
443 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
444 let version = { | |
445 let mut state = decoder.get_mut(&context); | |
446 match state.decode_struct_header(&StructHVersions) { | |
447 Ok(header) => header.data(), | |
448 Err(err) => return Err(err), | |
449 } | |
450 }; | |
451 let a = match <bool>::decode(decoder, context.clone()) { | |
452 Ok(value) => value, | |
453 Err(err) => return Err(err), | |
454 }; | |
455 let b = match <u8>::decode(decoder, context.clone()) { | |
456 Ok(value) => value, | |
457 Err(err) => return Err(err), | |
458 }; | |
459 let c = match <Option<UnionA>>::decode(decoder, context.clone()) { | |
460 Ok(value) => value, | |
461 Err(err) => return Err(err), | |
462 }; | |
463 let d = match <Option<Vec<UnionA>>>::decode(decoder, context.clone()) { | |
464 Ok(value) => value, | |
465 Err(err) => return Err(err), | |
466 }; | |
467 let e = match <Option<HashMap<u8, UnionA>>>::decode(decoder, context.clo
ne()) { | |
468 Ok(value) => value, | |
469 Err(err) => return Err(err), | |
470 }; | |
471 Ok(StructH { | |
472 a: a, | |
473 b: b, | |
474 c: c, | |
475 d: d, | |
476 e: e, | |
477 }) | |
478 } | |
479 } | |
480 | |
481 impl MojomEncodable for StructH { | |
482 impl_encodable_for_pointer!(); | |
483 fn compute_size(&self, context: Context) -> usize { | |
484 encoding::align_default(self.serialized_size(&context)) + | |
485 self.a.compute_size(context.clone()) + self.b.compute_size(context.clone
()) + | |
486 self.c.compute_size(context.clone()) + self.d.compute_size(context.clone
()) + | |
487 self.e.compute_size(context.clone()) | |
488 } | |
489 } | |
490 | |
491 impl MojomStruct for StructH {} | |
492 // -- BasicStruct -- | |
493 | |
494 // Constants | |
495 // Enums | |
496 // Struct version information | |
497 const BasicStructVersions: [(u32, u32); 1] = [(0, 16)]; | |
498 | |
499 // Struct definition | |
500 pub struct BasicStruct { | |
501 pub a: i32, | |
502 } | |
503 | |
504 impl MojomPointer for BasicStruct { | |
505 fn header_data(&self) -> DataHeaderValue { | |
506 DataHeaderValue::Version(0) | |
507 } | |
508 fn serialized_size(&self, _context: &Context) -> usize { | |
509 16 | |
510 } | |
511 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
512 MojomEncodable::encode(self.a, encoder, context.clone()); | |
513 | |
514 } | |
515 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
516 let version = { | |
517 let mut state = decoder.get_mut(&context); | |
518 match state.decode_struct_header(&BasicStructVersions) { | |
519 Ok(header) => header.data(), | |
520 Err(err) => return Err(err), | |
521 } | |
522 }; | |
523 let a = match <i32>::decode(decoder, context.clone()) { | |
524 Ok(value) => value, | |
525 Err(err) => return Err(err), | |
526 }; | |
527 Ok(BasicStruct { a: a }) | |
528 } | |
529 } | |
530 | |
531 impl MojomEncodable for BasicStruct { | |
532 impl_encodable_for_pointer!(); | |
533 fn compute_size(&self, context: Context) -> usize { | |
534 encoding::align_default(self.serialized_size(&context)) + | |
535 self.a.compute_size(context.clone()) | |
536 } | |
537 } | |
538 | |
539 impl MojomStruct for BasicStruct {} | |
540 // -- StructWithEnum -- | |
541 | |
542 // Constants | |
543 // Enums | |
544 type StructWithEnumEnumWithin = i32; | |
545 const StructWithEnumEnumWithin_A: StructWithEnumEnumWithin = 0; | |
546 const StructWithEnumEnumWithin_B: StructWithEnumEnumWithin = 1; | |
547 const StructWithEnumEnumWithin_C: StructWithEnumEnumWithin = 2; | |
548 const StructWithEnumEnumWithin_D: StructWithEnumEnumWithin = 3; | |
549 | |
550 const StructWithEnumEnumWithin__UNKNOWN: StructWithEnumEnumWithin = 0x7FFFFFFF; | |
551 | |
552 | |
553 // Struct version information | |
554 const StructWithEnumVersions: [(u32, u32); 1] = [(0, 8)]; | |
555 | |
556 // Struct definition | |
557 pub struct StructWithEnum { | |
558 } | |
559 | |
560 impl MojomPointer for StructWithEnum { | |
561 fn header_data(&self) -> DataHeaderValue { | |
562 DataHeaderValue::Version(0) | |
563 } | |
564 fn serialized_size(&self, _context: &Context) -> usize { | |
565 8 | |
566 } | |
567 fn encode_value(self, encoder: &mut Encoder, context: Context) {} | |
568 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
569 let version = { | |
570 let mut state = decoder.get_mut(&context); | |
571 match state.decode_struct_header(&StructWithEnumVersions) { | |
572 Ok(header) => header.data(), | |
573 Err(err) => return Err(err), | |
574 } | |
575 }; | |
576 Ok(StructWithEnum {}) | |
577 } | |
578 } | |
579 | |
580 impl MojomEncodable for StructWithEnum { | |
581 impl_encodable_for_pointer!(); | |
582 fn compute_size(&self, context: Context) -> usize { | |
583 encoding::align_default(self.serialized_size(&context)) | |
584 } | |
585 } | |
586 | |
587 impl MojomStruct for StructWithEnum {} | |
588 | |
589 | |
590 // Mojom Unions: | |
591 // -- UnionA -- | |
592 | |
593 type UnionATag = u32; | |
594 const UnionATag_a: UnionATag = 0; | |
595 const UnionATag_b: UnionATag = 1; | |
596 const UnionATag_c: UnionATag = 2; | |
597 const UnionATag_d: UnionATag = 3; | |
598 const UnionATag_e: UnionATag = 4; | |
599 const UnionATag_f: UnionATag = 5; | |
600 const UnionATag_g: UnionATag = 6; | |
601 const UnionATag_h: UnionATag = 7; | |
602 const UnionATag_i: UnionATag = 8; | |
603 const UnionATag_j: UnionATag = 9; | |
604 | |
605 | |
606 const UnionATag__UNKNOWN: UnionATag = 0xFFFFFFFF; | |
607 | |
608 | |
609 | |
610 pub enum UnionA { | |
611 a(u16), | |
612 b(u32), | |
613 c(Option<StructA>), | |
614 d(Option<Vec<u8>>), | |
615 e(Option<HashMap<String, u8>>), | |
616 f(Option<UnionB>), | |
617 g(StructA), | |
618 h(Vec<u8>), | |
619 i(HashMap<String, u8>), | |
620 j(UnionB), | |
621 _Unknown(u64), | |
622 } | |
623 | |
624 impl MojomUnion for UnionA { | |
625 fn get_tag(&self) -> u32 { | |
626 match *self { | |
627 UnionA::a(_) => UnionATag_a, | |
628 UnionA::b(_) => UnionATag_b, | |
629 UnionA::c(_) => UnionATag_c, | |
630 UnionA::d(_) => UnionATag_d, | |
631 UnionA::e(_) => UnionATag_e, | |
632 UnionA::f(_) => UnionATag_f, | |
633 UnionA::g(_) => UnionATag_g, | |
634 UnionA::h(_) => UnionATag_h, | |
635 UnionA::i(_) => UnionATag_i, | |
636 UnionA::j(_) => UnionATag_j, | |
637 UnionA::_Unknown(_) => UnionATag__UNKNOWN, | |
638 } | |
639 } | |
640 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
641 match self { | |
642 UnionA::a(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
643 UnionA::b(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
644 UnionA::c(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
645 UnionA::d(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
646 UnionA::e(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
647 UnionA::f(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
648 UnionA::g(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
649 UnionA::h(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
650 UnionA::i(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
651 UnionA::j(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
652 UnionA::_Unknown(val) => MojomEncodable::encode(val, encoder, contex
t.clone()), | |
653 } | |
654 } | |
655 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
656 let tag = { | |
657 let mut state = decoder.get_mut(&context); | |
658 let bytes = state.decode::<u32>(); | |
659 if (bytes as usize) != UNION_SIZE { | |
660 return Err(ValidationError::UnexpectedNullUnion); | |
661 } | |
662 state.decode::<u32>() | |
663 }; | |
664 Ok(match tag { | |
665 UnionATag_a => { | |
666 UnionA::a({ | |
667 match <u16>::decode(decoder, context.clone()) { | |
668 Ok(value) => value, | |
669 Err(err) => return Err(err), | |
670 } | |
671 }) | |
672 } | |
673 UnionATag_b => { | |
674 UnionA::b({ | |
675 match <u32>::decode(decoder, context.clone()) { | |
676 Ok(value) => value, | |
677 Err(err) => return Err(err), | |
678 } | |
679 }) | |
680 } | |
681 UnionATag_c => { | |
682 UnionA::c({ | |
683 match <Option<StructA>>::decode(decoder, context.clone()) { | |
684 Ok(value) => value, | |
685 Err(err) => return Err(err), | |
686 } | |
687 }) | |
688 } | |
689 UnionATag_d => { | |
690 UnionA::d({ | |
691 match <Option<Vec<u8>>>::decode(decoder, context.clone()) { | |
692 Ok(value) => value, | |
693 Err(err) => return Err(err), | |
694 } | |
695 }) | |
696 } | |
697 UnionATag_e => { | |
698 UnionA::e({ | |
699 match <Option<HashMap<String, u8>>>::decode(decoder, context
.clone()) { | |
700 Ok(value) => value, | |
701 Err(err) => return Err(err), | |
702 } | |
703 }) | |
704 } | |
705 UnionATag_f => { | |
706 UnionA::f({ | |
707 match <Option<UnionB>>::decode(decoder, context.clone()) { | |
708 Ok(value) => value, | |
709 Err(err) => return Err(err), | |
710 } | |
711 }) | |
712 } | |
713 UnionATag_g => { | |
714 UnionA::g({ | |
715 match <StructA>::decode(decoder, context.clone()) { | |
716 Ok(value) => value, | |
717 Err(err) => return Err(err), | |
718 } | |
719 }) | |
720 } | |
721 UnionATag_h => { | |
722 UnionA::h({ | |
723 match <Vec<u8>>::decode(decoder, context.clone()) { | |
724 Ok(value) => value, | |
725 Err(err) => return Err(err), | |
726 } | |
727 }) | |
728 } | |
729 UnionATag_i => { | |
730 UnionA::i({ | |
731 match <HashMap<String, u8>>::decode(decoder, context.clone()
) { | |
732 Ok(value) => value, | |
733 Err(err) => return Err(err), | |
734 } | |
735 }) | |
736 } | |
737 UnionATag_j => { | |
738 UnionA::j({ | |
739 match <UnionB>::decode(decoder, context.clone()) { | |
740 Ok(value) => value, | |
741 Err(err) => return Err(err), | |
742 } | |
743 }) | |
744 } | |
745 _ => UnionA::_Unknown(u64::decode(decoder, context.clone()).unwrap()
), | |
746 }) | |
747 } | |
748 } | |
749 | |
750 impl MojomEncodable for UnionA { | |
751 impl_encodable_for_union!(); | |
752 fn compute_size(&self, context: Context) -> usize { | |
753 UNION_SIZE + | |
754 match *self { | |
755 UnionA::a(ref val) => val.compute_size(context.clone()), | |
756 UnionA::b(ref val) => val.compute_size(context.clone()), | |
757 UnionA::c(ref val) => val.compute_size(context.clone()), | |
758 UnionA::d(ref val) => val.compute_size(context.clone()), | |
759 UnionA::e(ref val) => val.compute_size(context.clone()), | |
760 UnionA::f(ref val) => val.compute_size(context.clone()), | |
761 UnionA::g(ref val) => val.compute_size(context.clone()), | |
762 UnionA::h(ref val) => val.compute_size(context.clone()), | |
763 UnionA::i(ref val) => val.compute_size(context.clone()), | |
764 UnionA::j(ref val) => val.compute_size(context.clone()), | |
765 UnionA::_Unknown(ref val) => 0, | |
766 } | |
767 } | |
768 } | |
769 | |
770 // -- UnionB -- | |
771 | |
772 type UnionBTag = u32; | |
773 const UnionBTag_a: UnionBTag = 0; | |
774 const UnionBTag_b: UnionBTag = 1; | |
775 const UnionBTag_c: UnionBTag = 2; | |
776 const UnionBTag_d: UnionBTag = 3; | |
777 | |
778 | |
779 const UnionBTag__UNKNOWN: UnionBTag = 0xFFFFFFFF; | |
780 | |
781 | |
782 | |
783 pub enum UnionB { | |
784 a(u16), | |
785 b(u32), | |
786 c(u64), | |
787 d(u32), | |
788 _Unknown(u64), | |
789 } | |
790 | |
791 impl MojomUnion for UnionB { | |
792 fn get_tag(&self) -> u32 { | |
793 match *self { | |
794 UnionB::a(_) => UnionBTag_a, | |
795 UnionB::b(_) => UnionBTag_b, | |
796 UnionB::c(_) => UnionBTag_c, | |
797 UnionB::d(_) => UnionBTag_d, | |
798 UnionB::_Unknown(_) => UnionBTag__UNKNOWN, | |
799 } | |
800 } | |
801 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
802 match self { | |
803 UnionB::a(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
804 UnionB::b(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
805 UnionB::c(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
806 UnionB::d(val) => MojomEncodable::encode(val, encoder, context.clone
()), | |
807 UnionB::_Unknown(val) => MojomEncodable::encode(val, encoder, contex
t.clone()), | |
808 } | |
809 } | |
810 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
811 let tag = { | |
812 let mut state = decoder.get_mut(&context); | |
813 let bytes = state.decode::<u32>(); | |
814 if (bytes as usize) != UNION_SIZE { | |
815 return Err(ValidationError::UnexpectedNullUnion); | |
816 } | |
817 state.decode::<u32>() | |
818 }; | |
819 Ok(match tag { | |
820 UnionBTag_a => { | |
821 UnionB::a({ | |
822 match <u16>::decode(decoder, context.clone()) { | |
823 Ok(value) => value, | |
824 Err(err) => return Err(err), | |
825 } | |
826 }) | |
827 } | |
828 UnionBTag_b => { | |
829 UnionB::b({ | |
830 match <u32>::decode(decoder, context.clone()) { | |
831 Ok(value) => value, | |
832 Err(err) => return Err(err), | |
833 } | |
834 }) | |
835 } | |
836 UnionBTag_c => { | |
837 UnionB::c({ | |
838 match <u64>::decode(decoder, context.clone()) { | |
839 Ok(value) => value, | |
840 Err(err) => return Err(err), | |
841 } | |
842 }) | |
843 } | |
844 UnionBTag_d => { | |
845 UnionB::d({ | |
846 match <u32>::decode(decoder, context.clone()) { | |
847 Ok(value) => value, | |
848 Err(err) => return Err(err), | |
849 } | |
850 }) | |
851 } | |
852 _ => UnionB::_Unknown(u64::decode(decoder, context.clone()).unwrap()
), | |
853 }) | |
854 } | |
855 } | |
856 | |
857 impl MojomEncodable for UnionB { | |
858 impl_encodable_for_union!(); | |
859 fn compute_size(&self, context: Context) -> usize { | |
860 UNION_SIZE + | |
861 match *self { | |
862 UnionB::a(ref val) => val.compute_size(context.clone()), | |
863 UnionB::b(ref val) => val.compute_size(context.clone()), | |
864 UnionB::c(ref val) => val.compute_size(context.clone()), | |
865 UnionB::d(ref val) => val.compute_size(context.clone()), | |
866 UnionB::_Unknown(ref val) => 0, | |
867 } | |
868 } | |
869 } | |
870 | |
871 | |
872 | |
873 // Mojom Enums: | |
874 type BasicEnum = i32; | |
875 const BasicEnum_A: BasicEnum = 0; | |
876 const BasicEnum_B: BasicEnum = 1; | |
877 const BasicEnum_C: BasicEnum = 0; | |
878 const BasicEnum_D: BasicEnum = -3; | |
879 const BasicEnum_E: BasicEnum = 10; | |
880 | |
881 const BasicEnum__UNKNOWN: BasicEnum = 0x7FFFFFFF; | |
882 | |
883 | |
884 | |
885 | |
886 // Interfaces: | |
887 // --- InterfaceA --- | |
888 | |
889 pub mod InterfaceA { | |
890 pub const SERVICE_NAME: &'static str = ""; | |
891 pub const VERSION: u32 = 0; | |
892 } | |
893 | |
894 pub struct InterfaceAClient { | |
895 pipe: message_pipe::MessageEndpoint, | |
896 version: u32, | |
897 } | |
898 | |
899 impl InterfaceAClient { | |
900 pub fn new(pipe: message_pipe::MessageEndpoint) -> InterfaceAClient { | |
901 InterfaceAClient { | |
902 pipe: pipe, | |
903 version: InterfaceA::VERSION, | |
904 } | |
905 } | |
906 pub fn with_version(pipe: message_pipe::MessageEndpoint, version: u32) -> In
terfaceAClient { | |
907 InterfaceAClient { | |
908 pipe: pipe, | |
909 version: version, | |
910 } | |
911 } | |
912 } | |
913 | |
914 impl MojomInterface for InterfaceAClient { | |
915 fn service_name() -> &'static str { | |
916 InterfaceA::SERVICE_NAME | |
917 } | |
918 fn version(&self) -> u32 { | |
919 self.version | |
920 } | |
921 fn pipe(&self) -> &message_pipe::MessageEndpoint { | |
922 &self.pipe | |
923 } | |
924 fn unwrap(self) -> message_pipe::MessageEndpoint { | |
925 self.pipe | |
926 } | |
927 } | |
928 | |
929 impl CastHandle for InterfaceAClient { | |
930 unsafe fn from_untyped(handle: system::UntypedHandle) -> InterfaceAClient { | |
931 InterfaceAClient { | |
932 pipe: message_pipe::MessageEndpoint::from_untyped(handle), | |
933 version: 0, // Since we have no other information, assume its the ba
se | |
934 } | |
935 } | |
936 fn as_untyped(self) -> system::UntypedHandle { | |
937 self.pipe.as_untyped() | |
938 } | |
939 } | |
940 | |
941 impl MojomEncodable for InterfaceAClient { | |
942 impl_encodable_for_interface!(); | |
943 } | |
944 | |
945 impl<R: InterfaceARequest> MojomInterfaceSend<R> for InterfaceAClient {} | |
946 impl MojomInterfaceRecv for InterfaceAClient { | |
947 type Container = InterfaceAResponseOption; | |
948 } | |
949 | |
950 pub struct InterfaceAServer { | |
951 pipe: message_pipe::MessageEndpoint, | |
952 version: u32, | |
953 } | |
954 | |
955 impl InterfaceAServer { | |
956 pub fn new(pipe: message_pipe::MessageEndpoint) -> InterfaceAServer { | |
957 InterfaceAServer { | |
958 pipe: pipe, | |
959 version: InterfaceA::VERSION, | |
960 } | |
961 } | |
962 pub fn with_version(pipe: message_pipe::MessageEndpoint, version: u32) -> In
terfaceAServer { | |
963 InterfaceAServer { | |
964 pipe: pipe, | |
965 version: version, | |
966 } | |
967 } | |
968 } | |
969 | |
970 impl MojomInterface for InterfaceAServer { | |
971 fn service_name() -> &'static str { | |
972 InterfaceA::SERVICE_NAME | |
973 } | |
974 fn version(&self) -> u32 { | |
975 self.version | |
976 } | |
977 fn pipe(&self) -> &message_pipe::MessageEndpoint { | |
978 &self.pipe | |
979 } | |
980 fn unwrap(self) -> message_pipe::MessageEndpoint { | |
981 self.pipe | |
982 } | |
983 } | |
984 | |
985 impl CastHandle for InterfaceAServer { | |
986 unsafe fn from_untyped(handle: system::UntypedHandle) -> InterfaceAServer { | |
987 InterfaceAServer { | |
988 pipe: message_pipe::MessageEndpoint::from_untyped(handle), | |
989 version: 0, // Since we have no other information, assume its the ba
se | |
990 } | |
991 } | |
992 fn as_untyped(self) -> system::UntypedHandle { | |
993 self.pipe.as_untyped() | |
994 } | |
995 } | |
996 | |
997 impl MojomEncodable for InterfaceAServer { | |
998 impl_encodable_for_interface!(); | |
999 } | |
1000 | |
1001 impl<R: InterfaceAResponse> MojomInterfaceSend<R> for InterfaceAServer {} | |
1002 impl MojomInterfaceRecv for InterfaceAServer { | |
1003 type Container = InterfaceARequestOption; | |
1004 } | |
1005 | |
1006 // Enums | |
1007 | |
1008 | |
1009 // Constants | |
1010 | |
1011 | |
1012 pub trait InterfaceARequest: MojomMessage {} | |
1013 pub trait InterfaceAResponse: MojomMessage {} | |
1014 | |
1015 pub enum InterfaceARequestOption { | |
1016 | |
1017 } | |
1018 | |
1019 impl MojomMessageOption for InterfaceARequestOption { | |
1020 fn decode_payload(header: MessageHeader, | |
1021 buffer: &[u8], | |
1022 handles: Vec<UntypedHandle>) | |
1023 -> Result<Self, ValidationError> { | |
1024 match header.name { | |
1025 _ => Err(ValidationError::MessageHeaderUnknownMethod), | |
1026 } | |
1027 } | |
1028 } | |
1029 | |
1030 pub enum InterfaceAResponseOption { | |
1031 | |
1032 } | |
1033 | |
1034 impl MojomMessageOption for InterfaceAResponseOption { | |
1035 fn decode_payload(header: MessageHeader, | |
1036 buffer: &[u8], | |
1037 handles: Vec<UntypedHandle>) | |
1038 -> Result<Self, ValidationError> { | |
1039 if header.flags != message::MESSAGE_HEADER_IS_RESPONSE { | |
1040 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1041 } | |
1042 match header.name { | |
1043 _ => Err(ValidationError::MessageHeaderUnknownMethod), | |
1044 } | |
1045 } | |
1046 } | |
1047 | |
1048 | |
1049 // --- BoundsCheckTestInterface --- | |
1050 | |
1051 pub mod BoundsCheckTestInterface { | |
1052 pub const SERVICE_NAME: &'static str = "this.is.the.service.name.for.BoundsC
heckTestInterface"; | |
1053 pub const VERSION: u32 = 0; | |
1054 } | |
1055 | |
1056 pub struct BoundsCheckTestInterfaceClient { | |
1057 pipe: message_pipe::MessageEndpoint, | |
1058 version: u32, | |
1059 } | |
1060 | |
1061 impl BoundsCheckTestInterfaceClient { | |
1062 pub fn new(pipe: message_pipe::MessageEndpoint) -> BoundsCheckTestInterfaceC
lient { | |
1063 BoundsCheckTestInterfaceClient { | |
1064 pipe: pipe, | |
1065 version: BoundsCheckTestInterface::VERSION, | |
1066 } | |
1067 } | |
1068 pub fn with_version(pipe: message_pipe::MessageEndpoint, | |
1069 version: u32) | |
1070 -> BoundsCheckTestInterfaceClient { | |
1071 BoundsCheckTestInterfaceClient { | |
1072 pipe: pipe, | |
1073 version: version, | |
1074 } | |
1075 } | |
1076 } | |
1077 | |
1078 impl MojomInterface for BoundsCheckTestInterfaceClient { | |
1079 fn service_name() -> &'static str { | |
1080 BoundsCheckTestInterface::SERVICE_NAME | |
1081 } | |
1082 fn version(&self) -> u32 { | |
1083 self.version | |
1084 } | |
1085 fn pipe(&self) -> &message_pipe::MessageEndpoint { | |
1086 &self.pipe | |
1087 } | |
1088 fn unwrap(self) -> message_pipe::MessageEndpoint { | |
1089 self.pipe | |
1090 } | |
1091 } | |
1092 | |
1093 impl CastHandle for BoundsCheckTestInterfaceClient { | |
1094 unsafe fn from_untyped(handle: system::UntypedHandle) -> BoundsCheckTestInte
rfaceClient { | |
1095 BoundsCheckTestInterfaceClient { | |
1096 pipe: message_pipe::MessageEndpoint::from_untyped(handle), | |
1097 version: 0, // Since we have no other information, assume its the ba
se | |
1098 } | |
1099 } | |
1100 fn as_untyped(self) -> system::UntypedHandle { | |
1101 self.pipe.as_untyped() | |
1102 } | |
1103 } | |
1104 | |
1105 impl MojomEncodable for BoundsCheckTestInterfaceClient { | |
1106 impl_encodable_for_interface!(); | |
1107 } | |
1108 | |
1109 impl<R: BoundsCheckTestInterfaceRequest> MojomInterfaceSend<R> for BoundsCheckTe
stInterfaceClient {} | |
1110 impl MojomInterfaceRecv for BoundsCheckTestInterfaceClient { | |
1111 type Container = BoundsCheckTestInterfaceResponseOption; | |
1112 } | |
1113 | |
1114 pub struct BoundsCheckTestInterfaceServer { | |
1115 pipe: message_pipe::MessageEndpoint, | |
1116 version: u32, | |
1117 } | |
1118 | |
1119 impl BoundsCheckTestInterfaceServer { | |
1120 pub fn new(pipe: message_pipe::MessageEndpoint) -> BoundsCheckTestInterfaceS
erver { | |
1121 BoundsCheckTestInterfaceServer { | |
1122 pipe: pipe, | |
1123 version: BoundsCheckTestInterface::VERSION, | |
1124 } | |
1125 } | |
1126 pub fn with_version(pipe: message_pipe::MessageEndpoint, | |
1127 version: u32) | |
1128 -> BoundsCheckTestInterfaceServer { | |
1129 BoundsCheckTestInterfaceServer { | |
1130 pipe: pipe, | |
1131 version: version, | |
1132 } | |
1133 } | |
1134 } | |
1135 | |
1136 impl MojomInterface for BoundsCheckTestInterfaceServer { | |
1137 fn service_name() -> &'static str { | |
1138 BoundsCheckTestInterface::SERVICE_NAME | |
1139 } | |
1140 fn version(&self) -> u32 { | |
1141 self.version | |
1142 } | |
1143 fn pipe(&self) -> &message_pipe::MessageEndpoint { | |
1144 &self.pipe | |
1145 } | |
1146 fn unwrap(self) -> message_pipe::MessageEndpoint { | |
1147 self.pipe | |
1148 } | |
1149 } | |
1150 | |
1151 impl CastHandle for BoundsCheckTestInterfaceServer { | |
1152 unsafe fn from_untyped(handle: system::UntypedHandle) -> BoundsCheckTestInte
rfaceServer { | |
1153 BoundsCheckTestInterfaceServer { | |
1154 pipe: message_pipe::MessageEndpoint::from_untyped(handle), | |
1155 version: 0, // Since we have no other information, assume its the ba
se | |
1156 } | |
1157 } | |
1158 fn as_untyped(self) -> system::UntypedHandle { | |
1159 self.pipe.as_untyped() | |
1160 } | |
1161 } | |
1162 | |
1163 impl MojomEncodable for BoundsCheckTestInterfaceServer { | |
1164 impl_encodable_for_interface!(); | |
1165 } | |
1166 | |
1167 impl<R: BoundsCheckTestInterfaceResponse> MojomInterfaceSend<R> for BoundsCheckT
estInterfaceServer {} | |
1168 impl MojomInterfaceRecv for BoundsCheckTestInterfaceServer { | |
1169 type Container = BoundsCheckTestInterfaceRequestOption; | |
1170 } | |
1171 | |
1172 // Enums | |
1173 | |
1174 | |
1175 // Constants | |
1176 | |
1177 | |
1178 pub trait BoundsCheckTestInterfaceRequest: MojomMessage {} | |
1179 pub trait BoundsCheckTestInterfaceResponse: MojomMessage {} | |
1180 | |
1181 pub enum BoundsCheckTestInterfaceRequestOption { | |
1182 BoundsCheckTestInterfaceMethod0(BoundsCheckTestInterfaceMethod0Request), | |
1183 BoundsCheckTestInterfaceMethod1(BoundsCheckTestInterfaceMethod1Request), | |
1184 } | |
1185 | |
1186 impl MojomMessageOption for BoundsCheckTestInterfaceRequestOption { | |
1187 fn decode_payload(header: MessageHeader, | |
1188 buffer: &[u8], | |
1189 handles: Vec<UntypedHandle>) | |
1190 -> Result<Self, ValidationError> { | |
1191 match header.name { | |
1192 BoundsCheckTestInterfaceMethod0::ORDINAL => { | |
1193 if header.flags != message::MESSAGE_HEADER_EXPECT_RESPONSE { | |
1194 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1195 } | |
1196 match BoundsCheckTestInterfaceMethod0Request::deserialize(buffer
, handles) { | |
1197 Ok(value) => Ok(BoundsCheckTestInterfaceRequestOption::Bound
sCheckTestInterfaceMethod0(value)), | |
1198 Err(err) => return Err(err), | |
1199 } | |
1200 } | |
1201 BoundsCheckTestInterfaceMethod1::ORDINAL => { | |
1202 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1203 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1204 } | |
1205 match BoundsCheckTestInterfaceMethod1Request::deserialize(buffer
, handles) { | |
1206 Ok(value) => Ok(BoundsCheckTestInterfaceRequestOption::Bound
sCheckTestInterfaceMethod1(value)), | |
1207 Err(err) => return Err(err), | |
1208 } | |
1209 } | |
1210 _ => Err(ValidationError::MessageHeaderUnknownMethod), | |
1211 } | |
1212 } | |
1213 } | |
1214 | |
1215 pub enum BoundsCheckTestInterfaceResponseOption { | |
1216 BoundsCheckTestInterfaceMethod0(BoundsCheckTestInterfaceMethod0Response), | |
1217 } | |
1218 | |
1219 impl MojomMessageOption for BoundsCheckTestInterfaceResponseOption { | |
1220 fn decode_payload(header: MessageHeader, | |
1221 buffer: &[u8], | |
1222 handles: Vec<UntypedHandle>) | |
1223 -> Result<Self, ValidationError> { | |
1224 if header.flags != message::MESSAGE_HEADER_IS_RESPONSE { | |
1225 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1226 } | |
1227 match header.name { | |
1228 BoundsCheckTestInterfaceMethod0::ORDINAL => { | |
1229 match BoundsCheckTestInterfaceMethod0Response::deserialize(buffe
r, handles) { | |
1230 Ok(value) => Ok(BoundsCheckTestInterfaceResponseOption::Boun
dsCheckTestInterfaceMethod0(value)), | |
1231 Err(err) => return Err(err), | |
1232 } | |
1233 } | |
1234 _ => Err(ValidationError::MessageHeaderUnknownMethod), | |
1235 } | |
1236 } | |
1237 } | |
1238 | |
1239 /// Message: BoundsCheckTestInterfaceMethod0 | |
1240 pub mod BoundsCheckTestInterfaceMethod0 { | |
1241 pub const ORDINAL: u32 = 0; | |
1242 pub const MIN_VERSION: u32 = 0; | |
1243 } | |
1244 // -- BoundsCheckTestInterfaceMethod0Request -- | |
1245 | |
1246 // Constants | |
1247 // Enums | |
1248 // Struct version information | |
1249 const BoundsCheckTestInterfaceMethod0RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
1250 | |
1251 // Struct definition | |
1252 pub struct BoundsCheckTestInterfaceMethod0Request { | |
1253 pub param0: u8, | |
1254 } | |
1255 | |
1256 impl MojomPointer for BoundsCheckTestInterfaceMethod0Request { | |
1257 fn header_data(&self) -> DataHeaderValue { | |
1258 DataHeaderValue::Version(0) | |
1259 } | |
1260 fn serialized_size(&self, _context: &Context) -> usize { | |
1261 16 | |
1262 } | |
1263 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
1264 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
1265 | |
1266 } | |
1267 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
1268 let version = { | |
1269 let mut state = decoder.get_mut(&context); | |
1270 match state.decode_struct_header(&BoundsCheckTestInterfaceMethod0Req
uestVersions) { | |
1271 Ok(header) => header.data(), | |
1272 Err(err) => return Err(err), | |
1273 } | |
1274 }; | |
1275 let param0 = match <u8>::decode(decoder, context.clone()) { | |
1276 Ok(value) => value, | |
1277 Err(err) => return Err(err), | |
1278 }; | |
1279 Ok(BoundsCheckTestInterfaceMethod0Request { param0: param0 }) | |
1280 } | |
1281 } | |
1282 | |
1283 impl MojomEncodable for BoundsCheckTestInterfaceMethod0Request { | |
1284 impl_encodable_for_pointer!(); | |
1285 fn compute_size(&self, context: Context) -> usize { | |
1286 encoding::align_default(self.serialized_size(&context)) + | |
1287 self.param0.compute_size(context.clone()) | |
1288 } | |
1289 } | |
1290 | |
1291 impl MojomStruct for BoundsCheckTestInterfaceMethod0Request {} | |
1292 impl MojomMessage for BoundsCheckTestInterfaceMethod0Request { | |
1293 fn min_version() -> u32 { | |
1294 BoundsCheckTestInterfaceMethod0::MIN_VERSION | |
1295 } | |
1296 fn create_header() -> MessageHeader { | |
1297 MessageHeader::new(1, | |
1298 BoundsCheckTestInterfaceMethod0::ORDINAL, | |
1299 message::MESSAGE_HEADER_EXPECT_RESPONSE) | |
1300 | |
1301 } | |
1302 } | |
1303 impl BoundsCheckTestInterfaceRequest for BoundsCheckTestInterfaceMethod0Request
{} | |
1304 | |
1305 // -- BoundsCheckTestInterfaceMethod0Response -- | |
1306 | |
1307 // Constants | |
1308 // Enums | |
1309 // Struct version information | |
1310 const BoundsCheckTestInterfaceMethod0ResponseVersions: [(u32, u32); 1] = [(0, 16
)]; | |
1311 | |
1312 // Struct definition | |
1313 pub struct BoundsCheckTestInterfaceMethod0Response { | |
1314 pub param0: u8, | |
1315 } | |
1316 | |
1317 impl MojomPointer for BoundsCheckTestInterfaceMethod0Response { | |
1318 fn header_data(&self) -> DataHeaderValue { | |
1319 DataHeaderValue::Version(0) | |
1320 } | |
1321 fn serialized_size(&self, _context: &Context) -> usize { | |
1322 16 | |
1323 } | |
1324 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
1325 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
1326 | |
1327 } | |
1328 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
1329 let version = { | |
1330 let mut state = decoder.get_mut(&context); | |
1331 match state.decode_struct_header(&BoundsCheckTestInterfaceMethod0Res
ponseVersions) { | |
1332 Ok(header) => header.data(), | |
1333 Err(err) => return Err(err), | |
1334 } | |
1335 }; | |
1336 let param0 = match <u8>::decode(decoder, context.clone()) { | |
1337 Ok(value) => value, | |
1338 Err(err) => return Err(err), | |
1339 }; | |
1340 Ok(BoundsCheckTestInterfaceMethod0Response { param0: param0 }) | |
1341 } | |
1342 } | |
1343 | |
1344 impl MojomEncodable for BoundsCheckTestInterfaceMethod0Response { | |
1345 impl_encodable_for_pointer!(); | |
1346 fn compute_size(&self, context: Context) -> usize { | |
1347 encoding::align_default(self.serialized_size(&context)) + | |
1348 self.param0.compute_size(context.clone()) | |
1349 } | |
1350 } | |
1351 | |
1352 impl MojomStruct for BoundsCheckTestInterfaceMethod0Response {} | |
1353 | |
1354 impl MojomMessage for BoundsCheckTestInterfaceMethod0Response { | |
1355 fn min_version() -> u32 { | |
1356 BoundsCheckTestInterfaceMethod0::MIN_VERSION | |
1357 } | |
1358 fn create_header() -> MessageHeader { | |
1359 MessageHeader::new(1, | |
1360 BoundsCheckTestInterfaceMethod0::ORDINAL, | |
1361 message::MESSAGE_HEADER_IS_RESPONSE) | |
1362 } | |
1363 } | |
1364 impl BoundsCheckTestInterfaceResponse for BoundsCheckTestInterfaceMethod0Respons
e {} | |
1365 /// Message: BoundsCheckTestInterfaceMethod1 | |
1366 pub mod BoundsCheckTestInterfaceMethod1 { | |
1367 pub const ORDINAL: u32 = 1; | |
1368 pub const MIN_VERSION: u32 = 0; | |
1369 } | |
1370 // -- BoundsCheckTestInterfaceMethod1Request -- | |
1371 | |
1372 // Constants | |
1373 // Enums | |
1374 // Struct version information | |
1375 const BoundsCheckTestInterfaceMethod1RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
1376 | |
1377 // Struct definition | |
1378 pub struct BoundsCheckTestInterfaceMethod1Request { | |
1379 pub param0: u8, | |
1380 } | |
1381 | |
1382 impl MojomPointer for BoundsCheckTestInterfaceMethod1Request { | |
1383 fn header_data(&self) -> DataHeaderValue { | |
1384 DataHeaderValue::Version(0) | |
1385 } | |
1386 fn serialized_size(&self, _context: &Context) -> usize { | |
1387 16 | |
1388 } | |
1389 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
1390 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
1391 | |
1392 } | |
1393 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
1394 let version = { | |
1395 let mut state = decoder.get_mut(&context); | |
1396 match state.decode_struct_header(&BoundsCheckTestInterfaceMethod1Req
uestVersions) { | |
1397 Ok(header) => header.data(), | |
1398 Err(err) => return Err(err), | |
1399 } | |
1400 }; | |
1401 let param0 = match <u8>::decode(decoder, context.clone()) { | |
1402 Ok(value) => value, | |
1403 Err(err) => return Err(err), | |
1404 }; | |
1405 Ok(BoundsCheckTestInterfaceMethod1Request { param0: param0 }) | |
1406 } | |
1407 } | |
1408 | |
1409 impl MojomEncodable for BoundsCheckTestInterfaceMethod1Request { | |
1410 impl_encodable_for_pointer!(); | |
1411 fn compute_size(&self, context: Context) -> usize { | |
1412 encoding::align_default(self.serialized_size(&context)) + | |
1413 self.param0.compute_size(context.clone()) | |
1414 } | |
1415 } | |
1416 | |
1417 impl MojomStruct for BoundsCheckTestInterfaceMethod1Request {} | |
1418 impl MojomMessage for BoundsCheckTestInterfaceMethod1Request { | |
1419 fn min_version() -> u32 { | |
1420 BoundsCheckTestInterfaceMethod1::MIN_VERSION | |
1421 } | |
1422 fn create_header() -> MessageHeader { | |
1423 MessageHeader::new(0, | |
1424 BoundsCheckTestInterfaceMethod1::ORDINAL, | |
1425 message::MESSAGE_HEADER_NO_FLAG) | |
1426 | |
1427 } | |
1428 } | |
1429 impl BoundsCheckTestInterfaceRequest for BoundsCheckTestInterfaceMethod1Request
{} | |
1430 | |
1431 | |
1432 // --- ConformanceTestInterface --- | |
1433 | |
1434 pub mod ConformanceTestInterface { | |
1435 pub const SERVICE_NAME: &'static str = ""; | |
1436 pub const VERSION: u32 = 0; | |
1437 } | |
1438 | |
1439 pub struct ConformanceTestInterfaceClient { | |
1440 pipe: message_pipe::MessageEndpoint, | |
1441 version: u32, | |
1442 } | |
1443 | |
1444 impl ConformanceTestInterfaceClient { | |
1445 pub fn new(pipe: message_pipe::MessageEndpoint) -> ConformanceTestInterfaceC
lient { | |
1446 ConformanceTestInterfaceClient { | |
1447 pipe: pipe, | |
1448 version: ConformanceTestInterface::VERSION, | |
1449 } | |
1450 } | |
1451 pub fn with_version(pipe: message_pipe::MessageEndpoint, | |
1452 version: u32) | |
1453 -> ConformanceTestInterfaceClient { | |
1454 ConformanceTestInterfaceClient { | |
1455 pipe: pipe, | |
1456 version: version, | |
1457 } | |
1458 } | |
1459 } | |
1460 | |
1461 impl MojomInterface for ConformanceTestInterfaceClient { | |
1462 fn service_name() -> &'static str { | |
1463 ConformanceTestInterface::SERVICE_NAME | |
1464 } | |
1465 fn version(&self) -> u32 { | |
1466 self.version | |
1467 } | |
1468 fn pipe(&self) -> &message_pipe::MessageEndpoint { | |
1469 &self.pipe | |
1470 } | |
1471 fn unwrap(self) -> message_pipe::MessageEndpoint { | |
1472 self.pipe | |
1473 } | |
1474 } | |
1475 | |
1476 impl CastHandle for ConformanceTestInterfaceClient { | |
1477 unsafe fn from_untyped(handle: system::UntypedHandle) -> ConformanceTestInte
rfaceClient { | |
1478 ConformanceTestInterfaceClient { | |
1479 pipe: message_pipe::MessageEndpoint::from_untyped(handle), | |
1480 version: 0, // Since we have no other information, assume its the ba
se | |
1481 } | |
1482 } | |
1483 fn as_untyped(self) -> system::UntypedHandle { | |
1484 self.pipe.as_untyped() | |
1485 } | |
1486 } | |
1487 | |
1488 impl MojomEncodable for ConformanceTestInterfaceClient { | |
1489 impl_encodable_for_interface!(); | |
1490 } | |
1491 | |
1492 impl<R: ConformanceTestInterfaceRequest> MojomInterfaceSend<R> for ConformanceTe
stInterfaceClient {} | |
1493 impl MojomInterfaceRecv for ConformanceTestInterfaceClient { | |
1494 type Container = ConformanceTestInterfaceResponseOption; | |
1495 } | |
1496 | |
1497 pub struct ConformanceTestInterfaceServer { | |
1498 pipe: message_pipe::MessageEndpoint, | |
1499 version: u32, | |
1500 } | |
1501 | |
1502 impl ConformanceTestInterfaceServer { | |
1503 pub fn new(pipe: message_pipe::MessageEndpoint) -> ConformanceTestInterfaceS
erver { | |
1504 ConformanceTestInterfaceServer { | |
1505 pipe: pipe, | |
1506 version: ConformanceTestInterface::VERSION, | |
1507 } | |
1508 } | |
1509 pub fn with_version(pipe: message_pipe::MessageEndpoint, | |
1510 version: u32) | |
1511 -> ConformanceTestInterfaceServer { | |
1512 ConformanceTestInterfaceServer { | |
1513 pipe: pipe, | |
1514 version: version, | |
1515 } | |
1516 } | |
1517 } | |
1518 | |
1519 impl MojomInterface for ConformanceTestInterfaceServer { | |
1520 fn service_name() -> &'static str { | |
1521 ConformanceTestInterface::SERVICE_NAME | |
1522 } | |
1523 fn version(&self) -> u32 { | |
1524 self.version | |
1525 } | |
1526 fn pipe(&self) -> &message_pipe::MessageEndpoint { | |
1527 &self.pipe | |
1528 } | |
1529 fn unwrap(self) -> message_pipe::MessageEndpoint { | |
1530 self.pipe | |
1531 } | |
1532 } | |
1533 | |
1534 impl CastHandle for ConformanceTestInterfaceServer { | |
1535 unsafe fn from_untyped(handle: system::UntypedHandle) -> ConformanceTestInte
rfaceServer { | |
1536 ConformanceTestInterfaceServer { | |
1537 pipe: message_pipe::MessageEndpoint::from_untyped(handle), | |
1538 version: 0, // Since we have no other information, assume its the ba
se | |
1539 } | |
1540 } | |
1541 fn as_untyped(self) -> system::UntypedHandle { | |
1542 self.pipe.as_untyped() | |
1543 } | |
1544 } | |
1545 | |
1546 impl MojomEncodable for ConformanceTestInterfaceServer { | |
1547 impl_encodable_for_interface!(); | |
1548 } | |
1549 | |
1550 impl<R: ConformanceTestInterfaceResponse> MojomInterfaceSend<R> for ConformanceT
estInterfaceServer {} | |
1551 impl MojomInterfaceRecv for ConformanceTestInterfaceServer { | |
1552 type Container = ConformanceTestInterfaceRequestOption; | |
1553 } | |
1554 | |
1555 // Enums | |
1556 | |
1557 | |
1558 // Constants | |
1559 | |
1560 | |
1561 pub trait ConformanceTestInterfaceRequest: MojomMessage {} | |
1562 pub trait ConformanceTestInterfaceResponse: MojomMessage {} | |
1563 | |
1564 pub enum ConformanceTestInterfaceRequestOption { | |
1565 ConformanceTestInterfaceMethod3(ConformanceTestInterfaceMethod3Request), | |
1566 ConformanceTestInterfaceMethod4(ConformanceTestInterfaceMethod4Request), | |
1567 ConformanceTestInterfaceMethod5(ConformanceTestInterfaceMethod5Request), | |
1568 ConformanceTestInterfaceMethod7(ConformanceTestInterfaceMethod7Request), | |
1569 ConformanceTestInterfaceMethod12(ConformanceTestInterfaceMethod12Request), | |
1570 ConformanceTestInterfaceMethod14(ConformanceTestInterfaceMethod14Request), | |
1571 ConformanceTestInterfaceMethod15(ConformanceTestInterfaceMethod15Request), | |
1572 ConformanceTestInterfaceMethod1(ConformanceTestInterfaceMethod1Request), | |
1573 ConformanceTestInterfaceMethod2(ConformanceTestInterfaceMethod2Request), | |
1574 ConformanceTestInterfaceMethod6(ConformanceTestInterfaceMethod6Request), | |
1575 ConformanceTestInterfaceMethod8(ConformanceTestInterfaceMethod8Request), | |
1576 ConformanceTestInterfaceMethod10(ConformanceTestInterfaceMethod10Request), | |
1577 ConformanceTestInterfaceMethod11(ConformanceTestInterfaceMethod11Request), | |
1578 ConformanceTestInterfaceMethod0(ConformanceTestInterfaceMethod0Request), | |
1579 ConformanceTestInterfaceMethod9(ConformanceTestInterfaceMethod9Request), | |
1580 ConformanceTestInterfaceMethod13(ConformanceTestInterfaceMethod13Request), | |
1581 } | |
1582 | |
1583 impl MojomMessageOption for ConformanceTestInterfaceRequestOption { | |
1584 fn decode_payload(header: MessageHeader, | |
1585 buffer: &[u8], | |
1586 handles: Vec<UntypedHandle>) | |
1587 -> Result<Self, ValidationError> { | |
1588 match header.name { | |
1589 ConformanceTestInterfaceMethod3::ORDINAL => { | |
1590 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1591 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1592 } | |
1593 match ConformanceTestInterfaceMethod3Request::deserialize(buffer
, handles) { | |
1594 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod3(value)), | |
1595 Err(err) => return Err(err), | |
1596 } | |
1597 } | |
1598 ConformanceTestInterfaceMethod4::ORDINAL => { | |
1599 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1600 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1601 } | |
1602 match ConformanceTestInterfaceMethod4Request::deserialize(buffer
, handles) { | |
1603 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod4(value)), | |
1604 Err(err) => return Err(err), | |
1605 } | |
1606 } | |
1607 ConformanceTestInterfaceMethod5::ORDINAL => { | |
1608 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1609 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1610 } | |
1611 match ConformanceTestInterfaceMethod5Request::deserialize(buffer
, handles) { | |
1612 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod5(value)), | |
1613 Err(err) => return Err(err), | |
1614 } | |
1615 } | |
1616 ConformanceTestInterfaceMethod7::ORDINAL => { | |
1617 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1618 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1619 } | |
1620 match ConformanceTestInterfaceMethod7Request::deserialize(buffer
, handles) { | |
1621 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod7(value)), | |
1622 Err(err) => return Err(err), | |
1623 } | |
1624 } | |
1625 ConformanceTestInterfaceMethod12::ORDINAL => { | |
1626 if header.flags != message::MESSAGE_HEADER_EXPECT_RESPONSE { | |
1627 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1628 } | |
1629 match ConformanceTestInterfaceMethod12Request::deserialize(buffe
r, handles) { | |
1630 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod12(value)), | |
1631 Err(err) => return Err(err), | |
1632 } | |
1633 } | |
1634 ConformanceTestInterfaceMethod14::ORDINAL => { | |
1635 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1636 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1637 } | |
1638 match ConformanceTestInterfaceMethod14Request::deserialize(buffe
r, handles) { | |
1639 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod14(value)), | |
1640 Err(err) => return Err(err), | |
1641 } | |
1642 } | |
1643 ConformanceTestInterfaceMethod15::ORDINAL => { | |
1644 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1645 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1646 } | |
1647 match ConformanceTestInterfaceMethod15Request::deserialize(buffe
r, handles) { | |
1648 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod15(value)), | |
1649 Err(err) => return Err(err), | |
1650 } | |
1651 } | |
1652 ConformanceTestInterfaceMethod1::ORDINAL => { | |
1653 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1654 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1655 } | |
1656 match ConformanceTestInterfaceMethod1Request::deserialize(buffer
, handles) { | |
1657 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod1(value)), | |
1658 Err(err) => return Err(err), | |
1659 } | |
1660 } | |
1661 ConformanceTestInterfaceMethod2::ORDINAL => { | |
1662 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1663 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1664 } | |
1665 match ConformanceTestInterfaceMethod2Request::deserialize(buffer
, handles) { | |
1666 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod2(value)), | |
1667 Err(err) => return Err(err), | |
1668 } | |
1669 } | |
1670 ConformanceTestInterfaceMethod6::ORDINAL => { | |
1671 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1672 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1673 } | |
1674 match ConformanceTestInterfaceMethod6Request::deserialize(buffer
, handles) { | |
1675 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod6(value)), | |
1676 Err(err) => return Err(err), | |
1677 } | |
1678 } | |
1679 ConformanceTestInterfaceMethod8::ORDINAL => { | |
1680 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1681 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1682 } | |
1683 match ConformanceTestInterfaceMethod8Request::deserialize(buffer
, handles) { | |
1684 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod8(value)), | |
1685 Err(err) => return Err(err), | |
1686 } | |
1687 } | |
1688 ConformanceTestInterfaceMethod10::ORDINAL => { | |
1689 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1690 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1691 } | |
1692 match ConformanceTestInterfaceMethod10Request::deserialize(buffe
r, handles) { | |
1693 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod10(value)), | |
1694 Err(err) => return Err(err), | |
1695 } | |
1696 } | |
1697 ConformanceTestInterfaceMethod11::ORDINAL => { | |
1698 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1699 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1700 } | |
1701 match ConformanceTestInterfaceMethod11Request::deserialize(buffe
r, handles) { | |
1702 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod11(value)), | |
1703 Err(err) => return Err(err), | |
1704 } | |
1705 } | |
1706 ConformanceTestInterfaceMethod0::ORDINAL => { | |
1707 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1708 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1709 } | |
1710 match ConformanceTestInterfaceMethod0Request::deserialize(buffer
, handles) { | |
1711 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod0(value)), | |
1712 Err(err) => return Err(err), | |
1713 } | |
1714 } | |
1715 ConformanceTestInterfaceMethod9::ORDINAL => { | |
1716 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1717 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1718 } | |
1719 match ConformanceTestInterfaceMethod9Request::deserialize(buffer
, handles) { | |
1720 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod9(value)), | |
1721 Err(err) => return Err(err), | |
1722 } | |
1723 } | |
1724 ConformanceTestInterfaceMethod13::ORDINAL => { | |
1725 if header.flags != message::MESSAGE_HEADER_NO_FLAG { | |
1726 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1727 } | |
1728 match ConformanceTestInterfaceMethod13Request::deserialize(buffe
r, handles) { | |
1729 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo
rmanceTestInterfaceMethod13(value)), | |
1730 Err(err) => return Err(err), | |
1731 } | |
1732 } | |
1733 _ => Err(ValidationError::MessageHeaderUnknownMethod), | |
1734 } | |
1735 } | |
1736 } | |
1737 | |
1738 pub enum ConformanceTestInterfaceResponseOption { | |
1739 ConformanceTestInterfaceMethod12(ConformanceTestInterfaceMethod12Response), | |
1740 } | |
1741 | |
1742 impl MojomMessageOption for ConformanceTestInterfaceResponseOption { | |
1743 fn decode_payload(header: MessageHeader, | |
1744 buffer: &[u8], | |
1745 handles: Vec<UntypedHandle>) | |
1746 -> Result<Self, ValidationError> { | |
1747 if header.flags != message::MESSAGE_HEADER_IS_RESPONSE { | |
1748 return Err(ValidationError::MessageHeaderInvalidFlags); | |
1749 } | |
1750 match header.name { | |
1751 ConformanceTestInterfaceMethod12::ORDINAL => { | |
1752 match ConformanceTestInterfaceMethod12Response::deserialize(buff
er, handles) { | |
1753 Ok(value) => Ok(ConformanceTestInterfaceResponseOption::Conf
ormanceTestInterfaceMethod12(value)), | |
1754 Err(err) => return Err(err), | |
1755 } | |
1756 } | |
1757 _ => Err(ValidationError::MessageHeaderUnknownMethod), | |
1758 } | |
1759 } | |
1760 } | |
1761 | |
1762 /// Message: ConformanceTestInterfaceMethod3 | |
1763 pub mod ConformanceTestInterfaceMethod3 { | |
1764 pub const ORDINAL: u32 = 3; | |
1765 pub const MIN_VERSION: u32 = 0; | |
1766 } | |
1767 // -- ConformanceTestInterfaceMethod3Request -- | |
1768 | |
1769 // Constants | |
1770 // Enums | |
1771 // Struct version information | |
1772 const ConformanceTestInterfaceMethod3RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
1773 | |
1774 // Struct definition | |
1775 pub struct ConformanceTestInterfaceMethod3Request { | |
1776 pub param0: Vec<bool>, | |
1777 } | |
1778 | |
1779 impl MojomPointer for ConformanceTestInterfaceMethod3Request { | |
1780 fn header_data(&self) -> DataHeaderValue { | |
1781 DataHeaderValue::Version(0) | |
1782 } | |
1783 fn serialized_size(&self, _context: &Context) -> usize { | |
1784 16 | |
1785 } | |
1786 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
1787 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
1788 | |
1789 } | |
1790 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
1791 let version = { | |
1792 let mut state = decoder.get_mut(&context); | |
1793 match state.decode_struct_header(&ConformanceTestInterfaceMethod3Req
uestVersions) { | |
1794 Ok(header) => header.data(), | |
1795 Err(err) => return Err(err), | |
1796 } | |
1797 }; | |
1798 let param0 = match <Vec<bool>>::decode(decoder, context.clone()) { | |
1799 Ok(value) => value, | |
1800 Err(err) => return Err(err), | |
1801 }; | |
1802 Ok(ConformanceTestInterfaceMethod3Request { param0: param0 }) | |
1803 } | |
1804 } | |
1805 | |
1806 impl MojomEncodable for ConformanceTestInterfaceMethod3Request { | |
1807 impl_encodable_for_pointer!(); | |
1808 fn compute_size(&self, context: Context) -> usize { | |
1809 encoding::align_default(self.serialized_size(&context)) + | |
1810 self.param0.compute_size(context.clone()) | |
1811 } | |
1812 } | |
1813 | |
1814 impl MojomStruct for ConformanceTestInterfaceMethod3Request {} | |
1815 impl MojomMessage for ConformanceTestInterfaceMethod3Request { | |
1816 fn min_version() -> u32 { | |
1817 ConformanceTestInterfaceMethod3::MIN_VERSION | |
1818 } | |
1819 fn create_header() -> MessageHeader { | |
1820 MessageHeader::new(0, | |
1821 ConformanceTestInterfaceMethod3::ORDINAL, | |
1822 message::MESSAGE_HEADER_NO_FLAG) | |
1823 | |
1824 } | |
1825 } | |
1826 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod3Request
{} | |
1827 | |
1828 /// Message: ConformanceTestInterfaceMethod4 | |
1829 pub mod ConformanceTestInterfaceMethod4 { | |
1830 pub const ORDINAL: u32 = 4; | |
1831 pub const MIN_VERSION: u32 = 0; | |
1832 } | |
1833 // -- ConformanceTestInterfaceMethod4Request -- | |
1834 | |
1835 // Constants | |
1836 // Enums | |
1837 // Struct version information | |
1838 const ConformanceTestInterfaceMethod4RequestVersions: [(u32, u32); 1] = [(0, 24)
]; | |
1839 | |
1840 // Struct definition | |
1841 pub struct ConformanceTestInterfaceMethod4Request { | |
1842 pub param0: StructC, | |
1843 pub param1: Vec<u8>, | |
1844 } | |
1845 | |
1846 impl MojomPointer for ConformanceTestInterfaceMethod4Request { | |
1847 fn header_data(&self) -> DataHeaderValue { | |
1848 DataHeaderValue::Version(0) | |
1849 } | |
1850 fn serialized_size(&self, _context: &Context) -> usize { | |
1851 24 | |
1852 } | |
1853 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
1854 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
1855 MojomEncodable::encode(self.param1, encoder, context.clone()); | |
1856 | |
1857 } | |
1858 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
1859 let version = { | |
1860 let mut state = decoder.get_mut(&context); | |
1861 match state.decode_struct_header(&ConformanceTestInterfaceMethod4Req
uestVersions) { | |
1862 Ok(header) => header.data(), | |
1863 Err(err) => return Err(err), | |
1864 } | |
1865 }; | |
1866 let param0 = match <StructC>::decode(decoder, context.clone()) { | |
1867 Ok(value) => value, | |
1868 Err(err) => return Err(err), | |
1869 }; | |
1870 let param1 = match <Vec<u8>>::decode(decoder, context.clone()) { | |
1871 Ok(value) => value, | |
1872 Err(err) => return Err(err), | |
1873 }; | |
1874 Ok(ConformanceTestInterfaceMethod4Request { | |
1875 param0: param0, | |
1876 param1: param1, | |
1877 }) | |
1878 } | |
1879 } | |
1880 | |
1881 impl MojomEncodable for ConformanceTestInterfaceMethod4Request { | |
1882 impl_encodable_for_pointer!(); | |
1883 fn compute_size(&self, context: Context) -> usize { | |
1884 encoding::align_default(self.serialized_size(&context)) + | |
1885 self.param0.compute_size(context.clone()) + | |
1886 self.param1.compute_size(context.clone()) | |
1887 } | |
1888 } | |
1889 | |
1890 impl MojomStruct for ConformanceTestInterfaceMethod4Request {} | |
1891 impl MojomMessage for ConformanceTestInterfaceMethod4Request { | |
1892 fn min_version() -> u32 { | |
1893 ConformanceTestInterfaceMethod4::MIN_VERSION | |
1894 } | |
1895 fn create_header() -> MessageHeader { | |
1896 MessageHeader::new(0, | |
1897 ConformanceTestInterfaceMethod4::ORDINAL, | |
1898 message::MESSAGE_HEADER_NO_FLAG) | |
1899 | |
1900 } | |
1901 } | |
1902 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod4Request
{} | |
1903 | |
1904 /// Message: ConformanceTestInterfaceMethod5 | |
1905 pub mod ConformanceTestInterfaceMethod5 { | |
1906 pub const ORDINAL: u32 = 5; | |
1907 pub const MIN_VERSION: u32 = 0; | |
1908 } | |
1909 // -- ConformanceTestInterfaceMethod5Request -- | |
1910 | |
1911 // Constants | |
1912 // Enums | |
1913 // Struct version information | |
1914 const ConformanceTestInterfaceMethod5RequestVersions: [(u32, u32); 1] = [(0, 24)
]; | |
1915 | |
1916 // Struct definition | |
1917 pub struct ConformanceTestInterfaceMethod5Request { | |
1918 pub param0: StructE, | |
1919 pub param1: system::data_pipe::Producer<u8>, | |
1920 } | |
1921 | |
1922 impl MojomPointer for ConformanceTestInterfaceMethod5Request { | |
1923 fn header_data(&self) -> DataHeaderValue { | |
1924 DataHeaderValue::Version(0) | |
1925 } | |
1926 fn serialized_size(&self, _context: &Context) -> usize { | |
1927 24 | |
1928 } | |
1929 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
1930 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
1931 MojomEncodable::encode(self.param1, encoder, context.clone()); | |
1932 | |
1933 } | |
1934 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
1935 let version = { | |
1936 let mut state = decoder.get_mut(&context); | |
1937 match state.decode_struct_header(&ConformanceTestInterfaceMethod5Req
uestVersions) { | |
1938 Ok(header) => header.data(), | |
1939 Err(err) => return Err(err), | |
1940 } | |
1941 }; | |
1942 let param0 = match <StructE>::decode(decoder, context.clone()) { | |
1943 Ok(value) => value, | |
1944 Err(err) => return Err(err), | |
1945 }; | |
1946 let param1 = | |
1947 match <system::data_pipe::Producer<u8>>::decode(decoder, context.clo
ne()) { | |
1948 Ok(value) => value, | |
1949 Err(err) => return Err(err), | |
1950 }; | |
1951 Ok(ConformanceTestInterfaceMethod5Request { | |
1952 param0: param0, | |
1953 param1: param1, | |
1954 }) | |
1955 } | |
1956 } | |
1957 | |
1958 impl MojomEncodable for ConformanceTestInterfaceMethod5Request { | |
1959 impl_encodable_for_pointer!(); | |
1960 fn compute_size(&self, context: Context) -> usize { | |
1961 encoding::align_default(self.serialized_size(&context)) + | |
1962 self.param0.compute_size(context.clone()) + | |
1963 self.param1.compute_size(context.clone()) | |
1964 } | |
1965 } | |
1966 | |
1967 impl MojomStruct for ConformanceTestInterfaceMethod5Request {} | |
1968 impl MojomMessage for ConformanceTestInterfaceMethod5Request { | |
1969 fn min_version() -> u32 { | |
1970 ConformanceTestInterfaceMethod5::MIN_VERSION | |
1971 } | |
1972 fn create_header() -> MessageHeader { | |
1973 MessageHeader::new(0, | |
1974 ConformanceTestInterfaceMethod5::ORDINAL, | |
1975 message::MESSAGE_HEADER_NO_FLAG) | |
1976 | |
1977 } | |
1978 } | |
1979 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod5Request
{} | |
1980 | |
1981 /// Message: ConformanceTestInterfaceMethod7 | |
1982 pub mod ConformanceTestInterfaceMethod7 { | |
1983 pub const ORDINAL: u32 = 7; | |
1984 pub const MIN_VERSION: u32 = 0; | |
1985 } | |
1986 // -- ConformanceTestInterfaceMethod7Request -- | |
1987 | |
1988 // Constants | |
1989 // Enums | |
1990 // Struct version information | |
1991 const ConformanceTestInterfaceMethod7RequestVersions: [(u32, u32); 1] = [(0, 24)
]; | |
1992 | |
1993 // Struct definition | |
1994 pub struct ConformanceTestInterfaceMethod7Request { | |
1995 pub param0: StructF, | |
1996 pub param1: [Option<[u8; 3]>; 2], | |
1997 } | |
1998 | |
1999 impl MojomPointer for ConformanceTestInterfaceMethod7Request { | |
2000 fn header_data(&self) -> DataHeaderValue { | |
2001 DataHeaderValue::Version(0) | |
2002 } | |
2003 fn serialized_size(&self, _context: &Context) -> usize { | |
2004 24 | |
2005 } | |
2006 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2007 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2008 MojomEncodable::encode(self.param1, encoder, context.clone()); | |
2009 | |
2010 } | |
2011 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2012 let version = { | |
2013 let mut state = decoder.get_mut(&context); | |
2014 match state.decode_struct_header(&ConformanceTestInterfaceMethod7Req
uestVersions) { | |
2015 Ok(header) => header.data(), | |
2016 Err(err) => return Err(err), | |
2017 } | |
2018 }; | |
2019 let param0 = match <StructF>::decode(decoder, context.clone()) { | |
2020 Ok(value) => value, | |
2021 Err(err) => return Err(err), | |
2022 }; | |
2023 let param1 = match <[Option<[u8; 3]>; 2]>::decode(decoder, context.clone
()) { | |
2024 Ok(value) => value, | |
2025 Err(err) => return Err(err), | |
2026 }; | |
2027 Ok(ConformanceTestInterfaceMethod7Request { | |
2028 param0: param0, | |
2029 param1: param1, | |
2030 }) | |
2031 } | |
2032 } | |
2033 | |
2034 impl MojomEncodable for ConformanceTestInterfaceMethod7Request { | |
2035 impl_encodable_for_pointer!(); | |
2036 fn compute_size(&self, context: Context) -> usize { | |
2037 encoding::align_default(self.serialized_size(&context)) + | |
2038 self.param0.compute_size(context.clone()) + | |
2039 self.param1.compute_size(context.clone()) | |
2040 } | |
2041 } | |
2042 | |
2043 impl MojomStruct for ConformanceTestInterfaceMethod7Request {} | |
2044 impl MojomMessage for ConformanceTestInterfaceMethod7Request { | |
2045 fn min_version() -> u32 { | |
2046 ConformanceTestInterfaceMethod7::MIN_VERSION | |
2047 } | |
2048 fn create_header() -> MessageHeader { | |
2049 MessageHeader::new(0, | |
2050 ConformanceTestInterfaceMethod7::ORDINAL, | |
2051 message::MESSAGE_HEADER_NO_FLAG) | |
2052 | |
2053 } | |
2054 } | |
2055 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod7Request
{} | |
2056 | |
2057 /// Message: ConformanceTestInterfaceMethod12 | |
2058 pub mod ConformanceTestInterfaceMethod12 { | |
2059 pub const ORDINAL: u32 = 12; | |
2060 pub const MIN_VERSION: u32 = 0; | |
2061 } | |
2062 // -- ConformanceTestInterfaceMethod12Request -- | |
2063 | |
2064 // Constants | |
2065 // Enums | |
2066 // Struct version information | |
2067 const ConformanceTestInterfaceMethod12RequestVersions: [(u32, u32); 1] = [(0, 16
)]; | |
2068 | |
2069 // Struct definition | |
2070 pub struct ConformanceTestInterfaceMethod12Request { | |
2071 pub param0: f32, | |
2072 } | |
2073 | |
2074 impl MojomPointer for ConformanceTestInterfaceMethod12Request { | |
2075 fn header_data(&self) -> DataHeaderValue { | |
2076 DataHeaderValue::Version(0) | |
2077 } | |
2078 fn serialized_size(&self, _context: &Context) -> usize { | |
2079 16 | |
2080 } | |
2081 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2082 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2083 | |
2084 } | |
2085 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2086 let version = { | |
2087 let mut state = decoder.get_mut(&context); | |
2088 match state.decode_struct_header(&ConformanceTestInterfaceMethod12Re
questVersions) { | |
2089 Ok(header) => header.data(), | |
2090 Err(err) => return Err(err), | |
2091 } | |
2092 }; | |
2093 let param0 = match <f32>::decode(decoder, context.clone()) { | |
2094 Ok(value) => value, | |
2095 Err(err) => return Err(err), | |
2096 }; | |
2097 Ok(ConformanceTestInterfaceMethod12Request { param0: param0 }) | |
2098 } | |
2099 } | |
2100 | |
2101 impl MojomEncodable for ConformanceTestInterfaceMethod12Request { | |
2102 impl_encodable_for_pointer!(); | |
2103 fn compute_size(&self, context: Context) -> usize { | |
2104 encoding::align_default(self.serialized_size(&context)) + | |
2105 self.param0.compute_size(context.clone()) | |
2106 } | |
2107 } | |
2108 | |
2109 impl MojomStruct for ConformanceTestInterfaceMethod12Request {} | |
2110 impl MojomMessage for ConformanceTestInterfaceMethod12Request { | |
2111 fn min_version() -> u32 { | |
2112 ConformanceTestInterfaceMethod12::MIN_VERSION | |
2113 } | |
2114 fn create_header() -> MessageHeader { | |
2115 MessageHeader::new(1, | |
2116 ConformanceTestInterfaceMethod12::ORDINAL, | |
2117 message::MESSAGE_HEADER_EXPECT_RESPONSE) | |
2118 | |
2119 } | |
2120 } | |
2121 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod12Request
{} | |
2122 | |
2123 // -- ConformanceTestInterfaceMethod12Response -- | |
2124 | |
2125 // Constants | |
2126 // Enums | |
2127 // Struct version information | |
2128 const ConformanceTestInterfaceMethod12ResponseVersions: [(u32, u32); 1] = [(0, 1
6)]; | |
2129 | |
2130 // Struct definition | |
2131 pub struct ConformanceTestInterfaceMethod12Response { | |
2132 pub param0: f32, | |
2133 } | |
2134 | |
2135 impl MojomPointer for ConformanceTestInterfaceMethod12Response { | |
2136 fn header_data(&self) -> DataHeaderValue { | |
2137 DataHeaderValue::Version(0) | |
2138 } | |
2139 fn serialized_size(&self, _context: &Context) -> usize { | |
2140 16 | |
2141 } | |
2142 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2143 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2144 | |
2145 } | |
2146 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2147 let version = { | |
2148 let mut state = decoder.get_mut(&context); | |
2149 match state.decode_struct_header(&ConformanceTestInterfaceMethod12Re
sponseVersions) { | |
2150 Ok(header) => header.data(), | |
2151 Err(err) => return Err(err), | |
2152 } | |
2153 }; | |
2154 let param0 = match <f32>::decode(decoder, context.clone()) { | |
2155 Ok(value) => value, | |
2156 Err(err) => return Err(err), | |
2157 }; | |
2158 Ok(ConformanceTestInterfaceMethod12Response { param0: param0 }) | |
2159 } | |
2160 } | |
2161 | |
2162 impl MojomEncodable for ConformanceTestInterfaceMethod12Response { | |
2163 impl_encodable_for_pointer!(); | |
2164 fn compute_size(&self, context: Context) -> usize { | |
2165 encoding::align_default(self.serialized_size(&context)) + | |
2166 self.param0.compute_size(context.clone()) | |
2167 } | |
2168 } | |
2169 | |
2170 impl MojomStruct for ConformanceTestInterfaceMethod12Response {} | |
2171 | |
2172 impl MojomMessage for ConformanceTestInterfaceMethod12Response { | |
2173 fn min_version() -> u32 { | |
2174 ConformanceTestInterfaceMethod12::MIN_VERSION | |
2175 } | |
2176 fn create_header() -> MessageHeader { | |
2177 MessageHeader::new(1, | |
2178 ConformanceTestInterfaceMethod12::ORDINAL, | |
2179 message::MESSAGE_HEADER_IS_RESPONSE) | |
2180 } | |
2181 } | |
2182 impl ConformanceTestInterfaceResponse for ConformanceTestInterfaceMethod12Respon
se {} | |
2183 /// Message: ConformanceTestInterfaceMethod14 | |
2184 pub mod ConformanceTestInterfaceMethod14 { | |
2185 pub const ORDINAL: u32 = 14; | |
2186 pub const MIN_VERSION: u32 = 0; | |
2187 } | |
2188 // -- ConformanceTestInterfaceMethod14Request -- | |
2189 | |
2190 // Constants | |
2191 // Enums | |
2192 // Struct version information | |
2193 const ConformanceTestInterfaceMethod14RequestVersions: [(u32, u32); 1] = [(0, 24
)]; | |
2194 | |
2195 // Struct definition | |
2196 pub struct ConformanceTestInterfaceMethod14Request { | |
2197 pub param0: UnionA, | |
2198 } | |
2199 | |
2200 impl MojomPointer for ConformanceTestInterfaceMethod14Request { | |
2201 fn header_data(&self) -> DataHeaderValue { | |
2202 DataHeaderValue::Version(0) | |
2203 } | |
2204 fn serialized_size(&self, _context: &Context) -> usize { | |
2205 24 | |
2206 } | |
2207 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2208 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2209 | |
2210 } | |
2211 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2212 let version = { | |
2213 let mut state = decoder.get_mut(&context); | |
2214 match state.decode_struct_header(&ConformanceTestInterfaceMethod14Re
questVersions) { | |
2215 Ok(header) => header.data(), | |
2216 Err(err) => return Err(err), | |
2217 } | |
2218 }; | |
2219 let param0 = match <UnionA>::decode(decoder, context.clone()) { | |
2220 Ok(value) => value, | |
2221 Err(err) => return Err(err), | |
2222 }; | |
2223 Ok(ConformanceTestInterfaceMethod14Request { param0: param0 }) | |
2224 } | |
2225 } | |
2226 | |
2227 impl MojomEncodable for ConformanceTestInterfaceMethod14Request { | |
2228 impl_encodable_for_pointer!(); | |
2229 fn compute_size(&self, context: Context) -> usize { | |
2230 encoding::align_default(self.serialized_size(&context)) + | |
2231 self.param0.compute_size(context.clone()) | |
2232 } | |
2233 } | |
2234 | |
2235 impl MojomStruct for ConformanceTestInterfaceMethod14Request {} | |
2236 impl MojomMessage for ConformanceTestInterfaceMethod14Request { | |
2237 fn min_version() -> u32 { | |
2238 ConformanceTestInterfaceMethod14::MIN_VERSION | |
2239 } | |
2240 fn create_header() -> MessageHeader { | |
2241 MessageHeader::new(0, | |
2242 ConformanceTestInterfaceMethod14::ORDINAL, | |
2243 message::MESSAGE_HEADER_NO_FLAG) | |
2244 | |
2245 } | |
2246 } | |
2247 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod14Request
{} | |
2248 | |
2249 /// Message: ConformanceTestInterfaceMethod15 | |
2250 pub mod ConformanceTestInterfaceMethod15 { | |
2251 pub const ORDINAL: u32 = 15; | |
2252 pub const MIN_VERSION: u32 = 0; | |
2253 } | |
2254 // -- ConformanceTestInterfaceMethod15Request -- | |
2255 | |
2256 // Constants | |
2257 // Enums | |
2258 // Struct version information | |
2259 const ConformanceTestInterfaceMethod15RequestVersions: [(u32, u32); 1] = [(0, 16
)]; | |
2260 | |
2261 // Struct definition | |
2262 pub struct ConformanceTestInterfaceMethod15Request { | |
2263 pub param0: StructH, | |
2264 } | |
2265 | |
2266 impl MojomPointer for ConformanceTestInterfaceMethod15Request { | |
2267 fn header_data(&self) -> DataHeaderValue { | |
2268 DataHeaderValue::Version(0) | |
2269 } | |
2270 fn serialized_size(&self, _context: &Context) -> usize { | |
2271 16 | |
2272 } | |
2273 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2274 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2275 | |
2276 } | |
2277 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2278 let version = { | |
2279 let mut state = decoder.get_mut(&context); | |
2280 match state.decode_struct_header(&ConformanceTestInterfaceMethod15Re
questVersions) { | |
2281 Ok(header) => header.data(), | |
2282 Err(err) => return Err(err), | |
2283 } | |
2284 }; | |
2285 let param0 = match <StructH>::decode(decoder, context.clone()) { | |
2286 Ok(value) => value, | |
2287 Err(err) => return Err(err), | |
2288 }; | |
2289 Ok(ConformanceTestInterfaceMethod15Request { param0: param0 }) | |
2290 } | |
2291 } | |
2292 | |
2293 impl MojomEncodable for ConformanceTestInterfaceMethod15Request { | |
2294 impl_encodable_for_pointer!(); | |
2295 fn compute_size(&self, context: Context) -> usize { | |
2296 encoding::align_default(self.serialized_size(&context)) + | |
2297 self.param0.compute_size(context.clone()) | |
2298 } | |
2299 } | |
2300 | |
2301 impl MojomStruct for ConformanceTestInterfaceMethod15Request {} | |
2302 impl MojomMessage for ConformanceTestInterfaceMethod15Request { | |
2303 fn min_version() -> u32 { | |
2304 ConformanceTestInterfaceMethod15::MIN_VERSION | |
2305 } | |
2306 fn create_header() -> MessageHeader { | |
2307 MessageHeader::new(0, | |
2308 ConformanceTestInterfaceMethod15::ORDINAL, | |
2309 message::MESSAGE_HEADER_NO_FLAG) | |
2310 | |
2311 } | |
2312 } | |
2313 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod15Request
{} | |
2314 | |
2315 /// Message: ConformanceTestInterfaceMethod1 | |
2316 pub mod ConformanceTestInterfaceMethod1 { | |
2317 pub const ORDINAL: u32 = 1; | |
2318 pub const MIN_VERSION: u32 = 0; | |
2319 } | |
2320 // -- ConformanceTestInterfaceMethod1Request -- | |
2321 | |
2322 // Constants | |
2323 // Enums | |
2324 // Struct version information | |
2325 const ConformanceTestInterfaceMethod1RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
2326 | |
2327 // Struct definition | |
2328 pub struct ConformanceTestInterfaceMethod1Request { | |
2329 pub param0: StructA, | |
2330 } | |
2331 | |
2332 impl MojomPointer for ConformanceTestInterfaceMethod1Request { | |
2333 fn header_data(&self) -> DataHeaderValue { | |
2334 DataHeaderValue::Version(0) | |
2335 } | |
2336 fn serialized_size(&self, _context: &Context) -> usize { | |
2337 16 | |
2338 } | |
2339 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2340 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2341 | |
2342 } | |
2343 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2344 let version = { | |
2345 let mut state = decoder.get_mut(&context); | |
2346 match state.decode_struct_header(&ConformanceTestInterfaceMethod1Req
uestVersions) { | |
2347 Ok(header) => header.data(), | |
2348 Err(err) => return Err(err), | |
2349 } | |
2350 }; | |
2351 let param0 = match <StructA>::decode(decoder, context.clone()) { | |
2352 Ok(value) => value, | |
2353 Err(err) => return Err(err), | |
2354 }; | |
2355 Ok(ConformanceTestInterfaceMethod1Request { param0: param0 }) | |
2356 } | |
2357 } | |
2358 | |
2359 impl MojomEncodable for ConformanceTestInterfaceMethod1Request { | |
2360 impl_encodable_for_pointer!(); | |
2361 fn compute_size(&self, context: Context) -> usize { | |
2362 encoding::align_default(self.serialized_size(&context)) + | |
2363 self.param0.compute_size(context.clone()) | |
2364 } | |
2365 } | |
2366 | |
2367 impl MojomStruct for ConformanceTestInterfaceMethod1Request {} | |
2368 impl MojomMessage for ConformanceTestInterfaceMethod1Request { | |
2369 fn min_version() -> u32 { | |
2370 ConformanceTestInterfaceMethod1::MIN_VERSION | |
2371 } | |
2372 fn create_header() -> MessageHeader { | |
2373 MessageHeader::new(0, | |
2374 ConformanceTestInterfaceMethod1::ORDINAL, | |
2375 message::MESSAGE_HEADER_NO_FLAG) | |
2376 | |
2377 } | |
2378 } | |
2379 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod1Request
{} | |
2380 | |
2381 /// Message: ConformanceTestInterfaceMethod2 | |
2382 pub mod ConformanceTestInterfaceMethod2 { | |
2383 pub const ORDINAL: u32 = 2; | |
2384 pub const MIN_VERSION: u32 = 0; | |
2385 } | |
2386 // -- ConformanceTestInterfaceMethod2Request -- | |
2387 | |
2388 // Constants | |
2389 // Enums | |
2390 // Struct version information | |
2391 const ConformanceTestInterfaceMethod2RequestVersions: [(u32, u32); 1] = [(0, 24)
]; | |
2392 | |
2393 // Struct definition | |
2394 pub struct ConformanceTestInterfaceMethod2Request { | |
2395 pub param0: StructB, | |
2396 pub param1: StructA, | |
2397 } | |
2398 | |
2399 impl MojomPointer for ConformanceTestInterfaceMethod2Request { | |
2400 fn header_data(&self) -> DataHeaderValue { | |
2401 DataHeaderValue::Version(0) | |
2402 } | |
2403 fn serialized_size(&self, _context: &Context) -> usize { | |
2404 24 | |
2405 } | |
2406 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2407 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2408 MojomEncodable::encode(self.param1, encoder, context.clone()); | |
2409 | |
2410 } | |
2411 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2412 let version = { | |
2413 let mut state = decoder.get_mut(&context); | |
2414 match state.decode_struct_header(&ConformanceTestInterfaceMethod2Req
uestVersions) { | |
2415 Ok(header) => header.data(), | |
2416 Err(err) => return Err(err), | |
2417 } | |
2418 }; | |
2419 let param0 = match <StructB>::decode(decoder, context.clone()) { | |
2420 Ok(value) => value, | |
2421 Err(err) => return Err(err), | |
2422 }; | |
2423 let param1 = match <StructA>::decode(decoder, context.clone()) { | |
2424 Ok(value) => value, | |
2425 Err(err) => return Err(err), | |
2426 }; | |
2427 Ok(ConformanceTestInterfaceMethod2Request { | |
2428 param0: param0, | |
2429 param1: param1, | |
2430 }) | |
2431 } | |
2432 } | |
2433 | |
2434 impl MojomEncodable for ConformanceTestInterfaceMethod2Request { | |
2435 impl_encodable_for_pointer!(); | |
2436 fn compute_size(&self, context: Context) -> usize { | |
2437 encoding::align_default(self.serialized_size(&context)) + | |
2438 self.param0.compute_size(context.clone()) + | |
2439 self.param1.compute_size(context.clone()) | |
2440 } | |
2441 } | |
2442 | |
2443 impl MojomStruct for ConformanceTestInterfaceMethod2Request {} | |
2444 impl MojomMessage for ConformanceTestInterfaceMethod2Request { | |
2445 fn min_version() -> u32 { | |
2446 ConformanceTestInterfaceMethod2::MIN_VERSION | |
2447 } | |
2448 fn create_header() -> MessageHeader { | |
2449 MessageHeader::new(0, | |
2450 ConformanceTestInterfaceMethod2::ORDINAL, | |
2451 message::MESSAGE_HEADER_NO_FLAG) | |
2452 | |
2453 } | |
2454 } | |
2455 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod2Request
{} | |
2456 | |
2457 /// Message: ConformanceTestInterfaceMethod6 | |
2458 pub mod ConformanceTestInterfaceMethod6 { | |
2459 pub const ORDINAL: u32 = 6; | |
2460 pub const MIN_VERSION: u32 = 0; | |
2461 } | |
2462 // -- ConformanceTestInterfaceMethod6Request -- | |
2463 | |
2464 // Constants | |
2465 // Enums | |
2466 // Struct version information | |
2467 const ConformanceTestInterfaceMethod6RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
2468 | |
2469 // Struct definition | |
2470 pub struct ConformanceTestInterfaceMethod6Request { | |
2471 pub param0: Vec<Vec<u8>>, | |
2472 } | |
2473 | |
2474 impl MojomPointer for ConformanceTestInterfaceMethod6Request { | |
2475 fn header_data(&self) -> DataHeaderValue { | |
2476 DataHeaderValue::Version(0) | |
2477 } | |
2478 fn serialized_size(&self, _context: &Context) -> usize { | |
2479 16 | |
2480 } | |
2481 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2482 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2483 | |
2484 } | |
2485 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2486 let version = { | |
2487 let mut state = decoder.get_mut(&context); | |
2488 match state.decode_struct_header(&ConformanceTestInterfaceMethod6Req
uestVersions) { | |
2489 Ok(header) => header.data(), | |
2490 Err(err) => return Err(err), | |
2491 } | |
2492 }; | |
2493 let param0 = match <Vec<Vec<u8>>>::decode(decoder, context.clone()) { | |
2494 Ok(value) => value, | |
2495 Err(err) => return Err(err), | |
2496 }; | |
2497 Ok(ConformanceTestInterfaceMethod6Request { param0: param0 }) | |
2498 } | |
2499 } | |
2500 | |
2501 impl MojomEncodable for ConformanceTestInterfaceMethod6Request { | |
2502 impl_encodable_for_pointer!(); | |
2503 fn compute_size(&self, context: Context) -> usize { | |
2504 encoding::align_default(self.serialized_size(&context)) + | |
2505 self.param0.compute_size(context.clone()) | |
2506 } | |
2507 } | |
2508 | |
2509 impl MojomStruct for ConformanceTestInterfaceMethod6Request {} | |
2510 impl MojomMessage for ConformanceTestInterfaceMethod6Request { | |
2511 fn min_version() -> u32 { | |
2512 ConformanceTestInterfaceMethod6::MIN_VERSION | |
2513 } | |
2514 fn create_header() -> MessageHeader { | |
2515 MessageHeader::new(0, | |
2516 ConformanceTestInterfaceMethod6::ORDINAL, | |
2517 message::MESSAGE_HEADER_NO_FLAG) | |
2518 | |
2519 } | |
2520 } | |
2521 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod6Request
{} | |
2522 | |
2523 /// Message: ConformanceTestInterfaceMethod8 | |
2524 pub mod ConformanceTestInterfaceMethod8 { | |
2525 pub const ORDINAL: u32 = 8; | |
2526 pub const MIN_VERSION: u32 = 0; | |
2527 } | |
2528 // -- ConformanceTestInterfaceMethod8Request -- | |
2529 | |
2530 // Constants | |
2531 // Enums | |
2532 // Struct version information | |
2533 const ConformanceTestInterfaceMethod8RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
2534 | |
2535 // Struct definition | |
2536 pub struct ConformanceTestInterfaceMethod8Request { | |
2537 pub param0: Vec<Option<Vec<String>>>, | |
2538 } | |
2539 | |
2540 impl MojomPointer for ConformanceTestInterfaceMethod8Request { | |
2541 fn header_data(&self) -> DataHeaderValue { | |
2542 DataHeaderValue::Version(0) | |
2543 } | |
2544 fn serialized_size(&self, _context: &Context) -> usize { | |
2545 16 | |
2546 } | |
2547 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2548 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2549 | |
2550 } | |
2551 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2552 let version = { | |
2553 let mut state = decoder.get_mut(&context); | |
2554 match state.decode_struct_header(&ConformanceTestInterfaceMethod8Req
uestVersions) { | |
2555 Ok(header) => header.data(), | |
2556 Err(err) => return Err(err), | |
2557 } | |
2558 }; | |
2559 let param0 = match <Vec<Option<Vec<String>>>>::decode(decoder, context.c
lone()) { | |
2560 Ok(value) => value, | |
2561 Err(err) => return Err(err), | |
2562 }; | |
2563 Ok(ConformanceTestInterfaceMethod8Request { param0: param0 }) | |
2564 } | |
2565 } | |
2566 | |
2567 impl MojomEncodable for ConformanceTestInterfaceMethod8Request { | |
2568 impl_encodable_for_pointer!(); | |
2569 fn compute_size(&self, context: Context) -> usize { | |
2570 encoding::align_default(self.serialized_size(&context)) + | |
2571 self.param0.compute_size(context.clone()) | |
2572 } | |
2573 } | |
2574 | |
2575 impl MojomStruct for ConformanceTestInterfaceMethod8Request {} | |
2576 impl MojomMessage for ConformanceTestInterfaceMethod8Request { | |
2577 fn min_version() -> u32 { | |
2578 ConformanceTestInterfaceMethod8::MIN_VERSION | |
2579 } | |
2580 fn create_header() -> MessageHeader { | |
2581 MessageHeader::new(0, | |
2582 ConformanceTestInterfaceMethod8::ORDINAL, | |
2583 message::MESSAGE_HEADER_NO_FLAG) | |
2584 | |
2585 } | |
2586 } | |
2587 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod8Request
{} | |
2588 | |
2589 /// Message: ConformanceTestInterfaceMethod10 | |
2590 pub mod ConformanceTestInterfaceMethod10 { | |
2591 pub const ORDINAL: u32 = 10; | |
2592 pub const MIN_VERSION: u32 = 0; | |
2593 } | |
2594 // -- ConformanceTestInterfaceMethod10Request -- | |
2595 | |
2596 // Constants | |
2597 // Enums | |
2598 // Struct version information | |
2599 const ConformanceTestInterfaceMethod10RequestVersions: [(u32, u32); 1] = [(0, 16
)]; | |
2600 | |
2601 // Struct definition | |
2602 pub struct ConformanceTestInterfaceMethod10Request { | |
2603 pub param0: HashMap<String, u8>, | |
2604 } | |
2605 | |
2606 impl MojomPointer for ConformanceTestInterfaceMethod10Request { | |
2607 fn header_data(&self) -> DataHeaderValue { | |
2608 DataHeaderValue::Version(0) | |
2609 } | |
2610 fn serialized_size(&self, _context: &Context) -> usize { | |
2611 16 | |
2612 } | |
2613 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2614 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2615 | |
2616 } | |
2617 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2618 let version = { | |
2619 let mut state = decoder.get_mut(&context); | |
2620 match state.decode_struct_header(&ConformanceTestInterfaceMethod10Re
questVersions) { | |
2621 Ok(header) => header.data(), | |
2622 Err(err) => return Err(err), | |
2623 } | |
2624 }; | |
2625 let param0 = match <HashMap<String, u8>>::decode(decoder, context.clone(
)) { | |
2626 Ok(value) => value, | |
2627 Err(err) => return Err(err), | |
2628 }; | |
2629 Ok(ConformanceTestInterfaceMethod10Request { param0: param0 }) | |
2630 } | |
2631 } | |
2632 | |
2633 impl MojomEncodable for ConformanceTestInterfaceMethod10Request { | |
2634 impl_encodable_for_pointer!(); | |
2635 fn compute_size(&self, context: Context) -> usize { | |
2636 encoding::align_default(self.serialized_size(&context)) + | |
2637 self.param0.compute_size(context.clone()) | |
2638 } | |
2639 } | |
2640 | |
2641 impl MojomStruct for ConformanceTestInterfaceMethod10Request {} | |
2642 impl MojomMessage for ConformanceTestInterfaceMethod10Request { | |
2643 fn min_version() -> u32 { | |
2644 ConformanceTestInterfaceMethod10::MIN_VERSION | |
2645 } | |
2646 fn create_header() -> MessageHeader { | |
2647 MessageHeader::new(0, | |
2648 ConformanceTestInterfaceMethod10::ORDINAL, | |
2649 message::MESSAGE_HEADER_NO_FLAG) | |
2650 | |
2651 } | |
2652 } | |
2653 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod10Request
{} | |
2654 | |
2655 /// Message: ConformanceTestInterfaceMethod11 | |
2656 pub mod ConformanceTestInterfaceMethod11 { | |
2657 pub const ORDINAL: u32 = 11; | |
2658 pub const MIN_VERSION: u32 = 0; | |
2659 } | |
2660 // -- ConformanceTestInterfaceMethod11Request -- | |
2661 | |
2662 // Constants | |
2663 // Enums | |
2664 // Struct version information | |
2665 const ConformanceTestInterfaceMethod11RequestVersions: [(u32, u32); 1] = [(0, 16
)]; | |
2666 | |
2667 // Struct definition | |
2668 pub struct ConformanceTestInterfaceMethod11Request { | |
2669 pub param0: StructG, | |
2670 } | |
2671 | |
2672 impl MojomPointer for ConformanceTestInterfaceMethod11Request { | |
2673 fn header_data(&self) -> DataHeaderValue { | |
2674 DataHeaderValue::Version(0) | |
2675 } | |
2676 fn serialized_size(&self, _context: &Context) -> usize { | |
2677 16 | |
2678 } | |
2679 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2680 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2681 | |
2682 } | |
2683 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2684 let version = { | |
2685 let mut state = decoder.get_mut(&context); | |
2686 match state.decode_struct_header(&ConformanceTestInterfaceMethod11Re
questVersions) { | |
2687 Ok(header) => header.data(), | |
2688 Err(err) => return Err(err), | |
2689 } | |
2690 }; | |
2691 let param0 = match <StructG>::decode(decoder, context.clone()) { | |
2692 Ok(value) => value, | |
2693 Err(err) => return Err(err), | |
2694 }; | |
2695 Ok(ConformanceTestInterfaceMethod11Request { param0: param0 }) | |
2696 } | |
2697 } | |
2698 | |
2699 impl MojomEncodable for ConformanceTestInterfaceMethod11Request { | |
2700 impl_encodable_for_pointer!(); | |
2701 fn compute_size(&self, context: Context) -> usize { | |
2702 encoding::align_default(self.serialized_size(&context)) + | |
2703 self.param0.compute_size(context.clone()) | |
2704 } | |
2705 } | |
2706 | |
2707 impl MojomStruct for ConformanceTestInterfaceMethod11Request {} | |
2708 impl MojomMessage for ConformanceTestInterfaceMethod11Request { | |
2709 fn min_version() -> u32 { | |
2710 ConformanceTestInterfaceMethod11::MIN_VERSION | |
2711 } | |
2712 fn create_header() -> MessageHeader { | |
2713 MessageHeader::new(0, | |
2714 ConformanceTestInterfaceMethod11::ORDINAL, | |
2715 message::MESSAGE_HEADER_NO_FLAG) | |
2716 | |
2717 } | |
2718 } | |
2719 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod11Request
{} | |
2720 | |
2721 /// Message: ConformanceTestInterfaceMethod0 | |
2722 pub mod ConformanceTestInterfaceMethod0 { | |
2723 pub const ORDINAL: u32 = 0; | |
2724 pub const MIN_VERSION: u32 = 0; | |
2725 } | |
2726 // -- ConformanceTestInterfaceMethod0Request -- | |
2727 | |
2728 // Constants | |
2729 // Enums | |
2730 // Struct version information | |
2731 const ConformanceTestInterfaceMethod0RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
2732 | |
2733 // Struct definition | |
2734 pub struct ConformanceTestInterfaceMethod0Request { | |
2735 pub param0: f32, | |
2736 } | |
2737 | |
2738 impl MojomPointer for ConformanceTestInterfaceMethod0Request { | |
2739 fn header_data(&self) -> DataHeaderValue { | |
2740 DataHeaderValue::Version(0) | |
2741 } | |
2742 fn serialized_size(&self, _context: &Context) -> usize { | |
2743 16 | |
2744 } | |
2745 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2746 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2747 | |
2748 } | |
2749 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2750 let version = { | |
2751 let mut state = decoder.get_mut(&context); | |
2752 match state.decode_struct_header(&ConformanceTestInterfaceMethod0Req
uestVersions) { | |
2753 Ok(header) => header.data(), | |
2754 Err(err) => return Err(err), | |
2755 } | |
2756 }; | |
2757 let param0 = match <f32>::decode(decoder, context.clone()) { | |
2758 Ok(value) => value, | |
2759 Err(err) => return Err(err), | |
2760 }; | |
2761 Ok(ConformanceTestInterfaceMethod0Request { param0: param0 }) | |
2762 } | |
2763 } | |
2764 | |
2765 impl MojomEncodable for ConformanceTestInterfaceMethod0Request { | |
2766 impl_encodable_for_pointer!(); | |
2767 fn compute_size(&self, context: Context) -> usize { | |
2768 encoding::align_default(self.serialized_size(&context)) + | |
2769 self.param0.compute_size(context.clone()) | |
2770 } | |
2771 } | |
2772 | |
2773 impl MojomStruct for ConformanceTestInterfaceMethod0Request {} | |
2774 impl MojomMessage for ConformanceTestInterfaceMethod0Request { | |
2775 fn min_version() -> u32 { | |
2776 ConformanceTestInterfaceMethod0::MIN_VERSION | |
2777 } | |
2778 fn create_header() -> MessageHeader { | |
2779 MessageHeader::new(0, | |
2780 ConformanceTestInterfaceMethod0::ORDINAL, | |
2781 message::MESSAGE_HEADER_NO_FLAG) | |
2782 | |
2783 } | |
2784 } | |
2785 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod0Request
{} | |
2786 | |
2787 /// Message: ConformanceTestInterfaceMethod9 | |
2788 pub mod ConformanceTestInterfaceMethod9 { | |
2789 pub const ORDINAL: u32 = 9; | |
2790 pub const MIN_VERSION: u32 = 0; | |
2791 } | |
2792 // -- ConformanceTestInterfaceMethod9Request -- | |
2793 | |
2794 // Constants | |
2795 // Enums | |
2796 // Struct version information | |
2797 const ConformanceTestInterfaceMethod9RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
2798 | |
2799 // Struct definition | |
2800 pub struct ConformanceTestInterfaceMethod9Request { | |
2801 pub param0: Option<Vec<Vec<Option<system::UntypedHandle>>>>, | |
2802 } | |
2803 | |
2804 impl MojomPointer for ConformanceTestInterfaceMethod9Request { | |
2805 fn header_data(&self) -> DataHeaderValue { | |
2806 DataHeaderValue::Version(0) | |
2807 } | |
2808 fn serialized_size(&self, _context: &Context) -> usize { | |
2809 16 | |
2810 } | |
2811 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2812 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2813 | |
2814 } | |
2815 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2816 let version = { | |
2817 let mut state = decoder.get_mut(&context); | |
2818 match state.decode_struct_header(&ConformanceTestInterfaceMethod9Req
uestVersions) { | |
2819 Ok(header) => header.data(), | |
2820 Err(err) => return Err(err), | |
2821 } | |
2822 }; | |
2823 let param0 = match <Option<Vec<Vec<Option<system::UntypedHandle>>>>>::de
code(decoder, context.clone()) { | |
2824 Ok(value) => value, | |
2825 Err(err) => return Err(err), | |
2826 }; | |
2827 Ok(ConformanceTestInterfaceMethod9Request { param0: param0 }) | |
2828 } | |
2829 } | |
2830 | |
2831 impl MojomEncodable for ConformanceTestInterfaceMethod9Request { | |
2832 impl_encodable_for_pointer!(); | |
2833 fn compute_size(&self, context: Context) -> usize { | |
2834 encoding::align_default(self.serialized_size(&context)) + | |
2835 self.param0.compute_size(context.clone()) | |
2836 } | |
2837 } | |
2838 | |
2839 impl MojomStruct for ConformanceTestInterfaceMethod9Request {} | |
2840 impl MojomMessage for ConformanceTestInterfaceMethod9Request { | |
2841 fn min_version() -> u32 { | |
2842 ConformanceTestInterfaceMethod9::MIN_VERSION | |
2843 } | |
2844 fn create_header() -> MessageHeader { | |
2845 MessageHeader::new(0, | |
2846 ConformanceTestInterfaceMethod9::ORDINAL, | |
2847 message::MESSAGE_HEADER_NO_FLAG) | |
2848 | |
2849 } | |
2850 } | |
2851 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod9Request
{} | |
2852 | |
2853 /// Message: ConformanceTestInterfaceMethod13 | |
2854 pub mod ConformanceTestInterfaceMethod13 { | |
2855 pub const ORDINAL: u32 = 13; | |
2856 pub const MIN_VERSION: u32 = 0; | |
2857 } | |
2858 // -- ConformanceTestInterfaceMethod13Request -- | |
2859 | |
2860 // Constants | |
2861 // Enums | |
2862 // Struct version information | |
2863 const ConformanceTestInterfaceMethod13RequestVersions: [(u32, u32); 1] = [(0, 32
)]; | |
2864 | |
2865 // Struct definition | |
2866 pub struct ConformanceTestInterfaceMethod13Request { | |
2867 pub param0: Option<InterfaceAClient>, | |
2868 pub param1: u32, | |
2869 pub param2: Option<InterfaceAClient>, | |
2870 } | |
2871 | |
2872 impl MojomPointer for ConformanceTestInterfaceMethod13Request { | |
2873 fn header_data(&self) -> DataHeaderValue { | |
2874 DataHeaderValue::Version(0) | |
2875 } | |
2876 fn serialized_size(&self, _context: &Context) -> usize { | |
2877 32 | |
2878 } | |
2879 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
2880 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
2881 MojomEncodable::encode(self.param1, encoder, context.clone()); | |
2882 MojomEncodable::encode(self.param2, encoder, context.clone()); | |
2883 | |
2884 } | |
2885 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
2886 let version = { | |
2887 let mut state = decoder.get_mut(&context); | |
2888 match state.decode_struct_header(&ConformanceTestInterfaceMethod13Re
questVersions) { | |
2889 Ok(header) => header.data(), | |
2890 Err(err) => return Err(err), | |
2891 } | |
2892 }; | |
2893 let param0 = match <Option<InterfaceAClient>>::decode(decoder, context.c
lone()) { | |
2894 Ok(value) => value, | |
2895 Err(err) => return Err(err), | |
2896 }; | |
2897 let param1 = match <u32>::decode(decoder, context.clone()) { | |
2898 Ok(value) => value, | |
2899 Err(err) => return Err(err), | |
2900 }; | |
2901 let param2 = match <Option<InterfaceAClient>>::decode(decoder, context.c
lone()) { | |
2902 Ok(value) => value, | |
2903 Err(err) => return Err(err), | |
2904 }; | |
2905 Ok(ConformanceTestInterfaceMethod13Request { | |
2906 param0: param0, | |
2907 param1: param1, | |
2908 param2: param2, | |
2909 }) | |
2910 } | |
2911 } | |
2912 | |
2913 impl MojomEncodable for ConformanceTestInterfaceMethod13Request { | |
2914 impl_encodable_for_pointer!(); | |
2915 fn compute_size(&self, context: Context) -> usize { | |
2916 encoding::align_default(self.serialized_size(&context)) + | |
2917 self.param0.compute_size(context.clone()) + | |
2918 self.param1.compute_size(context.clone()) + | |
2919 self.param2.compute_size(context.clone()) | |
2920 } | |
2921 } | |
2922 | |
2923 impl MojomStruct for ConformanceTestInterfaceMethod13Request {} | |
2924 impl MojomMessage for ConformanceTestInterfaceMethod13Request { | |
2925 fn min_version() -> u32 { | |
2926 ConformanceTestInterfaceMethod13::MIN_VERSION | |
2927 } | |
2928 fn create_header() -> MessageHeader { | |
2929 MessageHeader::new(0, | |
2930 ConformanceTestInterfaceMethod13::ORDINAL, | |
2931 message::MESSAGE_HEADER_NO_FLAG) | |
2932 | |
2933 } | |
2934 } | |
2935 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod13Request
{} | |
2936 | |
2937 | |
2938 // --- IntegrationTestInterface --- | |
2939 | |
2940 pub mod IntegrationTestInterface { | |
2941 pub const SERVICE_NAME: &'static str = ""; | |
2942 pub const VERSION: u32 = 0; | |
2943 } | |
2944 | |
2945 pub struct IntegrationTestInterfaceClient { | |
2946 pipe: message_pipe::MessageEndpoint, | |
2947 version: u32, | |
2948 } | |
2949 | |
2950 impl IntegrationTestInterfaceClient { | |
2951 pub fn new(pipe: message_pipe::MessageEndpoint) -> IntegrationTestInterfaceC
lient { | |
2952 IntegrationTestInterfaceClient { | |
2953 pipe: pipe, | |
2954 version: IntegrationTestInterface::VERSION, | |
2955 } | |
2956 } | |
2957 pub fn with_version(pipe: message_pipe::MessageEndpoint, | |
2958 version: u32) | |
2959 -> IntegrationTestInterfaceClient { | |
2960 IntegrationTestInterfaceClient { | |
2961 pipe: pipe, | |
2962 version: version, | |
2963 } | |
2964 } | |
2965 } | |
2966 | |
2967 impl MojomInterface for IntegrationTestInterfaceClient { | |
2968 fn service_name() -> &'static str { | |
2969 IntegrationTestInterface::SERVICE_NAME | |
2970 } | |
2971 fn version(&self) -> u32 { | |
2972 self.version | |
2973 } | |
2974 fn pipe(&self) -> &message_pipe::MessageEndpoint { | |
2975 &self.pipe | |
2976 } | |
2977 fn unwrap(self) -> message_pipe::MessageEndpoint { | |
2978 self.pipe | |
2979 } | |
2980 } | |
2981 | |
2982 impl CastHandle for IntegrationTestInterfaceClient { | |
2983 unsafe fn from_untyped(handle: system::UntypedHandle) -> IntegrationTestInte
rfaceClient { | |
2984 IntegrationTestInterfaceClient { | |
2985 pipe: message_pipe::MessageEndpoint::from_untyped(handle), | |
2986 version: 0, // Since we have no other information, assume its the ba
se | |
2987 } | |
2988 } | |
2989 fn as_untyped(self) -> system::UntypedHandle { | |
2990 self.pipe.as_untyped() | |
2991 } | |
2992 } | |
2993 | |
2994 impl MojomEncodable for IntegrationTestInterfaceClient { | |
2995 impl_encodable_for_interface!(); | |
2996 } | |
2997 | |
2998 impl<R: IntegrationTestInterfaceRequest> MojomInterfaceSend<R> for IntegrationTe
stInterfaceClient {} | |
2999 impl MojomInterfaceRecv for IntegrationTestInterfaceClient { | |
3000 type Container = IntegrationTestInterfaceResponseOption; | |
3001 } | |
3002 | |
3003 pub struct IntegrationTestInterfaceServer { | |
3004 pipe: message_pipe::MessageEndpoint, | |
3005 version: u32, | |
3006 } | |
3007 | |
3008 impl IntegrationTestInterfaceServer { | |
3009 pub fn new(pipe: message_pipe::MessageEndpoint) -> IntegrationTestInterfaceS
erver { | |
3010 IntegrationTestInterfaceServer { | |
3011 pipe: pipe, | |
3012 version: IntegrationTestInterface::VERSION, | |
3013 } | |
3014 } | |
3015 pub fn with_version(pipe: message_pipe::MessageEndpoint, | |
3016 version: u32) | |
3017 -> IntegrationTestInterfaceServer { | |
3018 IntegrationTestInterfaceServer { | |
3019 pipe: pipe, | |
3020 version: version, | |
3021 } | |
3022 } | |
3023 } | |
3024 | |
3025 impl MojomInterface for IntegrationTestInterfaceServer { | |
3026 fn service_name() -> &'static str { | |
3027 IntegrationTestInterface::SERVICE_NAME | |
3028 } | |
3029 fn version(&self) -> u32 { | |
3030 self.version | |
3031 } | |
3032 fn pipe(&self) -> &message_pipe::MessageEndpoint { | |
3033 &self.pipe | |
3034 } | |
3035 fn unwrap(self) -> message_pipe::MessageEndpoint { | |
3036 self.pipe | |
3037 } | |
3038 } | |
3039 | |
3040 impl CastHandle for IntegrationTestInterfaceServer { | |
3041 unsafe fn from_untyped(handle: system::UntypedHandle) -> IntegrationTestInte
rfaceServer { | |
3042 IntegrationTestInterfaceServer { | |
3043 pipe: message_pipe::MessageEndpoint::from_untyped(handle), | |
3044 version: 0, // Since we have no other information, assume its the ba
se | |
3045 } | |
3046 } | |
3047 fn as_untyped(self) -> system::UntypedHandle { | |
3048 self.pipe.as_untyped() | |
3049 } | |
3050 } | |
3051 | |
3052 impl MojomEncodable for IntegrationTestInterfaceServer { | |
3053 impl_encodable_for_interface!(); | |
3054 } | |
3055 | |
3056 impl<R: IntegrationTestInterfaceResponse> MojomInterfaceSend<R> for IntegrationT
estInterfaceServer {} | |
3057 impl MojomInterfaceRecv for IntegrationTestInterfaceServer { | |
3058 type Container = IntegrationTestInterfaceRequestOption; | |
3059 } | |
3060 | |
3061 // Enums | |
3062 | |
3063 | |
3064 // Constants | |
3065 | |
3066 | |
3067 pub trait IntegrationTestInterfaceRequest: MojomMessage {} | |
3068 pub trait IntegrationTestInterfaceResponse: MojomMessage {} | |
3069 | |
3070 pub enum IntegrationTestInterfaceRequestOption { | |
3071 IntegrationTestInterfaceMethod0(IntegrationTestInterfaceMethod0Request), | |
3072 } | |
3073 | |
3074 impl MojomMessageOption for IntegrationTestInterfaceRequestOption { | |
3075 fn decode_payload(header: MessageHeader, | |
3076 buffer: &[u8], | |
3077 handles: Vec<UntypedHandle>) | |
3078 -> Result<Self, ValidationError> { | |
3079 match header.name { | |
3080 IntegrationTestInterfaceMethod0::ORDINAL => { | |
3081 if header.flags != message::MESSAGE_HEADER_EXPECT_RESPONSE { | |
3082 return Err(ValidationError::MessageHeaderInvalidFlags); | |
3083 } | |
3084 match IntegrationTestInterfaceMethod0Request::deserialize(buffer
, handles) { | |
3085 Ok(value) => Ok(IntegrationTestInterfaceRequestOption::Integ
rationTestInterfaceMethod0(value)), | |
3086 Err(err) => return Err(err), | |
3087 } | |
3088 } | |
3089 _ => Err(ValidationError::MessageHeaderUnknownMethod), | |
3090 } | |
3091 } | |
3092 } | |
3093 | |
3094 pub enum IntegrationTestInterfaceResponseOption { | |
3095 IntegrationTestInterfaceMethod0(IntegrationTestInterfaceMethod0Response), | |
3096 } | |
3097 | |
3098 impl MojomMessageOption for IntegrationTestInterfaceResponseOption { | |
3099 fn decode_payload(header: MessageHeader, | |
3100 buffer: &[u8], | |
3101 handles: Vec<UntypedHandle>) | |
3102 -> Result<Self, ValidationError> { | |
3103 if header.flags != message::MESSAGE_HEADER_IS_RESPONSE { | |
3104 return Err(ValidationError::MessageHeaderInvalidFlags); | |
3105 } | |
3106 match header.name { | |
3107 IntegrationTestInterfaceMethod0::ORDINAL => { | |
3108 match IntegrationTestInterfaceMethod0Response::deserialize(buffe
r, handles) { | |
3109 Ok(value) => Ok(IntegrationTestInterfaceResponseOption::Inte
grationTestInterfaceMethod0(value)), | |
3110 Err(err) => return Err(err), | |
3111 } | |
3112 } | |
3113 _ => Err(ValidationError::MessageHeaderUnknownMethod), | |
3114 } | |
3115 } | |
3116 } | |
3117 | |
3118 /// Message: IntegrationTestInterfaceMethod0 | |
3119 pub mod IntegrationTestInterfaceMethod0 { | |
3120 pub const ORDINAL: u32 = 0; | |
3121 pub const MIN_VERSION: u32 = 0; | |
3122 } | |
3123 // -- IntegrationTestInterfaceMethod0Request -- | |
3124 | |
3125 // Constants | |
3126 // Enums | |
3127 // Struct version information | |
3128 const IntegrationTestInterfaceMethod0RequestVersions: [(u32, u32); 1] = [(0, 16)
]; | |
3129 | |
3130 // Struct definition | |
3131 pub struct IntegrationTestInterfaceMethod0Request { | |
3132 pub param0: BasicStruct, | |
3133 } | |
3134 | |
3135 impl MojomPointer for IntegrationTestInterfaceMethod0Request { | |
3136 fn header_data(&self) -> DataHeaderValue { | |
3137 DataHeaderValue::Version(0) | |
3138 } | |
3139 fn serialized_size(&self, _context: &Context) -> usize { | |
3140 16 | |
3141 } | |
3142 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
3143 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
3144 | |
3145 } | |
3146 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
3147 let version = { | |
3148 let mut state = decoder.get_mut(&context); | |
3149 match state.decode_struct_header(&IntegrationTestInterfaceMethod0Req
uestVersions) { | |
3150 Ok(header) => header.data(), | |
3151 Err(err) => return Err(err), | |
3152 } | |
3153 }; | |
3154 let param0 = match <BasicStruct>::decode(decoder, context.clone()) { | |
3155 Ok(value) => value, | |
3156 Err(err) => return Err(err), | |
3157 }; | |
3158 Ok(IntegrationTestInterfaceMethod0Request { param0: param0 }) | |
3159 } | |
3160 } | |
3161 | |
3162 impl MojomEncodable for IntegrationTestInterfaceMethod0Request { | |
3163 impl_encodable_for_pointer!(); | |
3164 fn compute_size(&self, context: Context) -> usize { | |
3165 encoding::align_default(self.serialized_size(&context)) + | |
3166 self.param0.compute_size(context.clone()) | |
3167 } | |
3168 } | |
3169 | |
3170 impl MojomStruct for IntegrationTestInterfaceMethod0Request {} | |
3171 impl MojomMessage for IntegrationTestInterfaceMethod0Request { | |
3172 fn min_version() -> u32 { | |
3173 IntegrationTestInterfaceMethod0::MIN_VERSION | |
3174 } | |
3175 fn create_header() -> MessageHeader { | |
3176 MessageHeader::new(1, | |
3177 IntegrationTestInterfaceMethod0::ORDINAL, | |
3178 message::MESSAGE_HEADER_EXPECT_RESPONSE) | |
3179 | |
3180 } | |
3181 } | |
3182 impl IntegrationTestInterfaceRequest for IntegrationTestInterfaceMethod0Request
{} | |
3183 | |
3184 // -- IntegrationTestInterfaceMethod0Response -- | |
3185 | |
3186 // Constants | |
3187 // Enums | |
3188 // Struct version information | |
3189 const IntegrationTestInterfaceMethod0ResponseVersions: [(u32, u32); 1] = [(0, 16
)]; | |
3190 | |
3191 // Struct definition | |
3192 pub struct IntegrationTestInterfaceMethod0Response { | |
3193 pub param0: Vec<u8>, | |
3194 } | |
3195 | |
3196 impl MojomPointer for IntegrationTestInterfaceMethod0Response { | |
3197 fn header_data(&self) -> DataHeaderValue { | |
3198 DataHeaderValue::Version(0) | |
3199 } | |
3200 fn serialized_size(&self, _context: &Context) -> usize { | |
3201 16 | |
3202 } | |
3203 fn encode_value(self, encoder: &mut Encoder, context: Context) { | |
3204 MojomEncodable::encode(self.param0, encoder, context.clone()); | |
3205 | |
3206 } | |
3207 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val
idationError> { | |
3208 let version = { | |
3209 let mut state = decoder.get_mut(&context); | |
3210 match state.decode_struct_header(&IntegrationTestInterfaceMethod0Res
ponseVersions) { | |
3211 Ok(header) => header.data(), | |
3212 Err(err) => return Err(err), | |
3213 } | |
3214 }; | |
3215 let param0 = match <Vec<u8>>::decode(decoder, context.clone()) { | |
3216 Ok(value) => value, | |
3217 Err(err) => return Err(err), | |
3218 }; | |
3219 Ok(IntegrationTestInterfaceMethod0Response { param0: param0 }) | |
3220 } | |
3221 } | |
3222 | |
3223 impl MojomEncodable for IntegrationTestInterfaceMethod0Response { | |
3224 impl_encodable_for_pointer!(); | |
3225 fn compute_size(&self, context: Context) -> usize { | |
3226 encoding::align_default(self.serialized_size(&context)) + | |
3227 self.param0.compute_size(context.clone()) | |
3228 } | |
3229 } | |
3230 | |
3231 impl MojomStruct for IntegrationTestInterfaceMethod0Response {} | |
3232 | |
3233 impl MojomMessage for IntegrationTestInterfaceMethod0Response { | |
3234 fn min_version() -> u32 { | |
3235 IntegrationTestInterfaceMethod0::MIN_VERSION | |
3236 } | |
3237 fn create_header() -> MessageHeader { | |
3238 MessageHeader::new(1, | |
3239 IntegrationTestInterfaceMethod0::ORDINAL, | |
3240 message::MESSAGE_HEADER_IS_RESPONSE) | |
3241 } | |
3242 } | |
3243 impl IntegrationTestInterfaceResponse for IntegrationTestInterfaceMethod0Respons
e {} | |
OLD | NEW |