Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: mojo/public/rust/tests/util/mojom_validation.rs

Issue 2220183003: Rust: Add validation to decode (Closed) Base URL: git@github.com:domokit/mojo.git@coder-testing
Patch Set: Pass all tests Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/rust/tests/regression.rs ('k') | mojo/public/rust/tests/validation.rs » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //! This file was auto-generated by the Rust bindings generator. 1 //! This file was auto-generated by the Rust bindings generator.
2 #![allow(bad_style)] 2 #![allow(bad_style)]
3 #![allow(unused_imports)] 3 #![allow(unused_imports)]
4 #![allow(unused_variables)] 4 #![allow(unused_variables)]
5 #![allow(dead_code)] 5 #![allow(dead_code)]
6 6
7 use mojo::bindings::decoding::Decoder; 7 use mojo::bindings::decoding;
8 use mojo::bindings::decoding::{Decoder, ValidationError};
8 use mojo::bindings::encoding; 9 use mojo::bindings::encoding;
9 use mojo::bindings::encoding::{Context, DataHeaderValue, DATA_HEADER_SIZE, Encod er}; 10 use mojo::bindings::encoding::{Context, DataHeaderValue, DATA_HEADER_SIZE, Encod er};
10 use mojo::bindings::message; 11 use mojo::bindings::message;
11 use mojo::bindings::message::MessageHeader; 12 use mojo::bindings::message::MessageHeader;
12 use mojo::bindings::mojom; 13 use mojo::bindings::mojom;
13 use mojo::bindings::mojom::{MojomEncodable, MojomPointer, MojomStruct, MojomUnio n, MojomMessage, 14 use mojo::bindings::mojom::{MojomEncodable, MojomPointer, MojomStruct, MojomUnio n, MojomMessage,
14 MojomInterface, MojomInterfaceSend, MojomInterfaceRe cv, 15 MojomInterface, MojomInterfaceSend, MojomInterfaceRe cv,
15 MojomMessageOption, UNION_SIZE}; 16 MojomMessageOption, UNION_SIZE};
16 17
17 use mojo::system; 18 use mojo::system;
(...skipping 23 matching lines...) Expand all
41 fn header_data(&self) -> DataHeaderValue { 42 fn header_data(&self) -> DataHeaderValue {
42 DataHeaderValue::Version(0) 43 DataHeaderValue::Version(0)
43 } 44 }
44 fn serialized_size(&self, _context: &Context) -> usize { 45 fn serialized_size(&self, _context: &Context) -> usize {
45 16 46 16
46 } 47 }
47 fn encode_value(self, encoder: &mut Encoder, context: Context) { 48 fn encode_value(self, encoder: &mut Encoder, context: Context) {
48 MojomEncodable::encode(self.i, encoder, context.clone()); 49 MojomEncodable::encode(self.i, encoder, context.clone());
49 50
50 } 51 }
51 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 52 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
52 // TODO(mknyszek): Validate bytes and version 53 let version = {
53 let (_bytes, version) = {
54 let mut state = decoder.get_mut(&context); 54 let mut state = decoder.get_mut(&context);
55 let bytes = state.decode::<u32>(); 55 match state.decode_struct_header(&StructAVersions) {
56 let version = state.decode::<u32>(); 56 Ok(header) => header.data(),
57 (bytes, version) 57 Err(err) => return Err(err),
58 }
58 }; 59 };
59 let i = u64::decode(decoder, context.clone()); 60 let i = match u64::decode(decoder, context.clone()) {
60 StructA { i: i } 61 Ok(value) => value,
62 Err(err) => return Err(err),
63 };
64 Ok(StructA { i: i })
61 } 65 }
62 } 66 }
63 67
64 impl MojomEncodable for StructA { 68 impl MojomEncodable for StructA {
65 impl_encodable_for_pointer!(); 69 impl_encodable_for_pointer!();
66 fn compute_size(&self, context: Context) -> usize { 70 fn compute_size(&self, context: Context) -> usize {
67 encoding::align_default(self.serialized_size(&context)) + 71 encoding::align_default(self.serialized_size(&context)) +
68 self.i.compute_size(context.clone()) 72 self.i.compute_size(context.clone())
69 } 73 }
70 } 74 }
(...skipping 15 matching lines...) Expand all
86 fn header_data(&self) -> DataHeaderValue { 90 fn header_data(&self) -> DataHeaderValue {
87 DataHeaderValue::Version(0) 91 DataHeaderValue::Version(0)
88 } 92 }
89 fn serialized_size(&self, _context: &Context) -> usize { 93 fn serialized_size(&self, _context: &Context) -> usize {
90 16 94 16
91 } 95 }
92 fn encode_value(self, encoder: &mut Encoder, context: Context) { 96 fn encode_value(self, encoder: &mut Encoder, context: Context) {
93 MojomEncodable::encode(self.struct_a, encoder, context.clone()); 97 MojomEncodable::encode(self.struct_a, encoder, context.clone());
94 98
95 } 99 }
96 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 100 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
97 // TODO(mknyszek): Validate bytes and version 101 let version = {
98 let (_bytes, version) = {
99 let mut state = decoder.get_mut(&context); 102 let mut state = decoder.get_mut(&context);
100 let bytes = state.decode::<u32>(); 103 match state.decode_struct_header(&StructBVersions) {
101 let version = state.decode::<u32>(); 104 Ok(header) => header.data(),
102 (bytes, version) 105 Err(err) => return Err(err),
106 }
103 }; 107 };
104 let struct_a = StructA::decode(decoder, context.clone()); 108 let struct_a = match StructA::decode(decoder, context.clone()) {
105 StructB { struct_a: struct_a } 109 Ok(value) => value,
110 Err(err) => return Err(err),
111 };
112 Ok(StructB { struct_a: struct_a })
106 } 113 }
107 } 114 }
108 115
109 impl MojomEncodable for StructB { 116 impl MojomEncodable for StructB {
110 impl_encodable_for_pointer!(); 117 impl_encodable_for_pointer!();
111 fn compute_size(&self, context: Context) -> usize { 118 fn compute_size(&self, context: Context) -> usize {
112 encoding::align_default(self.serialized_size(&context)) + 119 encoding::align_default(self.serialized_size(&context)) +
113 self.struct_a.compute_size(context.clone()) 120 self.struct_a.compute_size(context.clone())
114 } 121 }
115 } 122 }
(...skipping 15 matching lines...) Expand all
131 fn header_data(&self) -> DataHeaderValue { 138 fn header_data(&self) -> DataHeaderValue {
132 DataHeaderValue::Version(0) 139 DataHeaderValue::Version(0)
133 } 140 }
134 fn serialized_size(&self, _context: &Context) -> usize { 141 fn serialized_size(&self, _context: &Context) -> usize {
135 16 142 16
136 } 143 }
137 fn encode_value(self, encoder: &mut Encoder, context: Context) { 144 fn encode_value(self, encoder: &mut Encoder, context: Context) {
138 MojomEncodable::encode(self.data, encoder, context.clone()); 145 MojomEncodable::encode(self.data, encoder, context.clone());
139 146
140 } 147 }
141 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 148 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
142 // TODO(mknyszek): Validate bytes and version 149 let version = {
143 let (_bytes, version) = {
144 let mut state = decoder.get_mut(&context); 150 let mut state = decoder.get_mut(&context);
145 let bytes = state.decode::<u32>(); 151 match state.decode_struct_header(&StructCVersions) {
146 let version = state.decode::<u32>(); 152 Ok(header) => header.data(),
147 (bytes, version) 153 Err(err) => return Err(err),
154 }
148 }; 155 };
149 let data = Vec::<u8>::decode(decoder, context.clone()); 156 let data = match Vec::<u8>::decode(decoder, context.clone()) {
150 StructC { data: data } 157 Ok(value) => value,
158 Err(err) => return Err(err),
159 };
160 Ok(StructC { data: data })
151 } 161 }
152 } 162 }
153 163
154 impl MojomEncodable for StructC { 164 impl MojomEncodable for StructC {
155 impl_encodable_for_pointer!(); 165 impl_encodable_for_pointer!();
156 fn compute_size(&self, context: Context) -> usize { 166 fn compute_size(&self, context: Context) -> usize {
157 encoding::align_default(self.serialized_size(&context)) + 167 encoding::align_default(self.serialized_size(&context)) +
158 self.data.compute_size(context.clone()) 168 self.data.compute_size(context.clone())
159 } 169 }
160 } 170 }
(...skipping 15 matching lines...) Expand all
176 fn header_data(&self) -> DataHeaderValue { 186 fn header_data(&self) -> DataHeaderValue {
177 DataHeaderValue::Version(0) 187 DataHeaderValue::Version(0)
178 } 188 }
179 fn serialized_size(&self, _context: &Context) -> usize { 189 fn serialized_size(&self, _context: &Context) -> usize {
180 16 190 16
181 } 191 }
182 fn encode_value(self, encoder: &mut Encoder, context: Context) { 192 fn encode_value(self, encoder: &mut Encoder, context: Context) {
183 MojomEncodable::encode(self.message_pipes, encoder, context.clone()); 193 MojomEncodable::encode(self.message_pipes, encoder, context.clone());
184 194
185 } 195 }
186 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 196 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
187 // TODO(mknyszek): Validate bytes and version 197 let version = {
188 let (_bytes, version) = {
189 let mut state = decoder.get_mut(&context); 198 let mut state = decoder.get_mut(&context);
190 let bytes = state.decode::<u32>(); 199 match state.decode_struct_header(&StructDVersions) {
191 let version = state.decode::<u32>(); 200 Ok(header) => header.data(),
192 (bytes, version) 201 Err(err) => return Err(err),
202 }
193 }; 203 };
194 let message_pipes = Vec::<message_pipe::MessageEndpoint>::decode(decoder , context.clone()); 204 let message_pipes = match Vec::<message_pipe::MessageEndpoint>::decode(d ecoder,
195 StructD { message_pipes: message_pipes } 205 c ontext.clone()) {
206 Ok(value) => value,
207 Err(err) => return Err(err),
208 };
209 Ok(StructD { message_pipes: message_pipes })
196 } 210 }
197 } 211 }
198 212
199 impl MojomEncodable for StructD { 213 impl MojomEncodable for StructD {
200 impl_encodable_for_pointer!(); 214 impl_encodable_for_pointer!();
201 fn compute_size(&self, context: Context) -> usize { 215 fn compute_size(&self, context: Context) -> usize {
202 encoding::align_default(self.serialized_size(&context)) + 216 encoding::align_default(self.serialized_size(&context)) +
203 self.message_pipes.compute_size(context.clone()) 217 self.message_pipes.compute_size(context.clone())
204 } 218 }
205 } 219 }
(...skipping 17 matching lines...) Expand all
223 DataHeaderValue::Version(0) 237 DataHeaderValue::Version(0)
224 } 238 }
225 fn serialized_size(&self, _context: &Context) -> usize { 239 fn serialized_size(&self, _context: &Context) -> usize {
226 24 240 24
227 } 241 }
228 fn encode_value(self, encoder: &mut Encoder, context: Context) { 242 fn encode_value(self, encoder: &mut Encoder, context: Context) {
229 MojomEncodable::encode(self.struct_d, encoder, context.clone()); 243 MojomEncodable::encode(self.struct_d, encoder, context.clone());
230 MojomEncodable::encode(self.data_pipe_consumer, encoder, context.clone() ); 244 MojomEncodable::encode(self.data_pipe_consumer, encoder, context.clone() );
231 245
232 } 246 }
233 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 247 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
234 // TODO(mknyszek): Validate bytes and version 248 let version = {
235 let (_bytes, version) = {
236 let mut state = decoder.get_mut(&context); 249 let mut state = decoder.get_mut(&context);
237 let bytes = state.decode::<u32>(); 250 match state.decode_struct_header(&StructEVersions) {
238 let version = state.decode::<u32>(); 251 Ok(header) => header.data(),
239 (bytes, version) 252 Err(err) => return Err(err),
253 }
240 }; 254 };
241 let struct_d = StructD::decode(decoder, context.clone()); 255 let struct_d = match StructD::decode(decoder, context.clone()) {
242 let data_pipe_consumer = system::data_pipe::Consumer::<u8>::decode(decod er, 256 Ok(value) => value,
243 conte xt.clone()); 257 Err(err) => return Err(err),
244 StructE { 258 };
259 let data_pipe_consumer = match system::data_pipe::Consumer::<u8>::decode (decoder,
260 context.clone()) {
261 Ok(value) => value,
262 Err(err) => return Err(err),
263 };
264 Ok(StructE {
245 struct_d: struct_d, 265 struct_d: struct_d,
246 data_pipe_consumer: data_pipe_consumer, 266 data_pipe_consumer: data_pipe_consumer,
247 } 267 })
248 } 268 }
249 } 269 }
250 270
251 impl MojomEncodable for StructE { 271 impl MojomEncodable for StructE {
252 impl_encodable_for_pointer!(); 272 impl_encodable_for_pointer!();
253 fn compute_size(&self, context: Context) -> usize { 273 fn compute_size(&self, context: Context) -> usize {
254 encoding::align_default(self.serialized_size(&context)) + 274 encoding::align_default(self.serialized_size(&context)) +
255 self.struct_d.compute_size(context.clone()) + 275 self.struct_d.compute_size(context.clone()) +
256 self.data_pipe_consumer.compute_size(context.clone()) 276 self.data_pipe_consumer.compute_size(context.clone())
257 } 277 }
(...skipping 16 matching lines...) Expand all
274 fn header_data(&self) -> DataHeaderValue { 294 fn header_data(&self) -> DataHeaderValue {
275 DataHeaderValue::Version(0) 295 DataHeaderValue::Version(0)
276 } 296 }
277 fn serialized_size(&self, _context: &Context) -> usize { 297 fn serialized_size(&self, _context: &Context) -> usize {
278 16 298 16
279 } 299 }
280 fn encode_value(self, encoder: &mut Encoder, context: Context) { 300 fn encode_value(self, encoder: &mut Encoder, context: Context) {
281 MojomEncodable::encode(self.fixed_size_array, encoder, context.clone()); 301 MojomEncodable::encode(self.fixed_size_array, encoder, context.clone());
282 302
283 } 303 }
284 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 304 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
285 // TODO(mknyszek): Validate bytes and version 305 let version = {
286 let (_bytes, version) = {
287 let mut state = decoder.get_mut(&context); 306 let mut state = decoder.get_mut(&context);
288 let bytes = state.decode::<u32>(); 307 match state.decode_struct_header(&StructFVersions) {
289 let version = state.decode::<u32>(); 308 Ok(header) => header.data(),
290 (bytes, version) 309 Err(err) => return Err(err),
310 }
291 }; 311 };
292 let fixed_size_array = Box::<[u8; 3]>::decode(decoder, context.clone()); 312 let fixed_size_array = match Box::<[u8; 3]>::decode(decoder, context.clo ne()) {
293 StructF { fixed_size_array: fixed_size_array } 313 Ok(value) => value,
314 Err(err) => return Err(err),
315 };
316 Ok(StructF { fixed_size_array: fixed_size_array })
294 } 317 }
295 } 318 }
296 319
297 impl MojomEncodable for StructF { 320 impl MojomEncodable for StructF {
298 impl_encodable_for_pointer!(); 321 impl_encodable_for_pointer!();
299 fn compute_size(&self, context: Context) -> usize { 322 fn compute_size(&self, context: Context) -> usize {
300 encoding::align_default(self.serialized_size(&context)) + 323 encoding::align_default(self.serialized_size(&context)) +
301 self.fixed_size_array.compute_size(context.clone()) 324 self.fixed_size_array.compute_size(context.clone())
302 } 325 }
303 } 326 }
(...skipping 21 matching lines...) Expand all
325 fn serialized_size(&self, _context: &Context) -> usize { 348 fn serialized_size(&self, _context: &Context) -> usize {
326 32 349 32
327 } 350 }
328 fn encode_value(self, encoder: &mut Encoder, context: Context) { 351 fn encode_value(self, encoder: &mut Encoder, context: Context) {
329 MojomEncodable::encode(self.i, encoder, context.clone()); 352 MojomEncodable::encode(self.i, encoder, context.clone());
330 MojomEncodable::encode(self.b, encoder, context.clone()); 353 MojomEncodable::encode(self.b, encoder, context.clone());
331 MojomEncodable::encode(self.struct_a, encoder, context.clone()); 354 MojomEncodable::encode(self.struct_a, encoder, context.clone());
332 MojomEncodable::encode(self.str, encoder, context.clone()); 355 MojomEncodable::encode(self.str, encoder, context.clone());
333 356
334 } 357 }
335 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 358 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
336 // TODO(mknyszek): Validate bytes and version 359 let version = {
337 let (_bytes, version) = {
338 let mut state = decoder.get_mut(&context); 360 let mut state = decoder.get_mut(&context);
339 let bytes = state.decode::<u32>(); 361 match state.decode_struct_header(&StructGVersions) {
Eric Holk 2016/08/08 20:34:15 You use this pattern a lot, but I think it's basic
mknyszek 2016/08/08 21:32:22 Oh, wow, yeah I completely forgot about the try! m
340 let version = state.decode::<u32>(); 362 Ok(header) => header.data(),
341 (bytes, version) 363 Err(err) => return Err(err),
364 }
342 }; 365 };
343 let i = i32::decode(decoder, context.clone()); 366 let i = match i32::decode(decoder, context.clone()) {
367 Ok(value) => value,
368 Err(err) => return Err(err),
369 };
344 let b = if version >= 3 { 370 let b = if version >= 3 {
345 bool::decode(decoder, context.clone()) 371 match bool::decode(decoder, context.clone()) {
372 Ok(value) => value,
373 Err(err) => return Err(err),
374 }
346 } else { 375 } else {
347 Default::default() 376 Default::default()
348 }; 377 };
349 let struct_a = if version >= 1 { 378 let struct_a = if version >= 1 {
350 Option::<StructA>::decode(decoder, context.clone()) 379 match Option::<StructA>::decode(decoder, context.clone()) {
380 Ok(value) => value,
381 Err(err) => return Err(err),
382 }
351 } else { 383 } else {
352 Default::default() 384 Default::default()
353 }; 385 };
354 let str = if version >= 3 { 386 let str = if version >= 3 {
355 Option::<String>::decode(decoder, context.clone()) 387 match Option::<String>::decode(decoder, context.clone()) {
388 Ok(value) => value,
389 Err(err) => return Err(err),
390 }
356 } else { 391 } else {
357 Default::default() 392 Default::default()
358 }; 393 };
359 StructG { 394 Ok(StructG {
360 i: i, 395 i: i,
361 b: b, 396 b: b,
362 struct_a: struct_a, 397 struct_a: struct_a,
363 str: str, 398 str: str,
364 } 399 })
365 } 400 }
366 } 401 }
367 402
368 impl MojomEncodable for StructG { 403 impl MojomEncodable for StructG {
369 impl_encodable_for_pointer!(); 404 impl_encodable_for_pointer!();
370 fn compute_size(&self, context: Context) -> usize { 405 fn compute_size(&self, context: Context) -> usize {
371 encoding::align_default(self.serialized_size(&context)) + 406 encoding::align_default(self.serialized_size(&context)) +
372 self.i.compute_size(context.clone()) + self.b.compute_size(context.clone ()) + 407 self.i.compute_size(context.clone()) + self.b.compute_size(context.clone ()) +
373 self.struct_a.compute_size(context.clone()) + self.str.compute_size(cont ext.clone()) 408 self.struct_a.compute_size(context.clone()) + self.str.compute_size(cont ext.clone())
374 } 409 }
(...skipping 24 matching lines...) Expand all
399 48 434 48
400 } 435 }
401 fn encode_value(self, encoder: &mut Encoder, context: Context) { 436 fn encode_value(self, encoder: &mut Encoder, context: Context) {
402 MojomEncodable::encode(self.a, encoder, context.clone()); 437 MojomEncodable::encode(self.a, encoder, context.clone());
403 MojomEncodable::encode(self.b, encoder, context.clone()); 438 MojomEncodable::encode(self.b, encoder, context.clone());
404 MojomEncodable::encode(self.c, encoder, context.clone()); 439 MojomEncodable::encode(self.c, encoder, context.clone());
405 MojomEncodable::encode(self.d, encoder, context.clone()); 440 MojomEncodable::encode(self.d, encoder, context.clone());
406 MojomEncodable::encode(self.e, encoder, context.clone()); 441 MojomEncodable::encode(self.e, encoder, context.clone());
407 442
408 } 443 }
409 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 444 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
410 // TODO(mknyszek): Validate bytes and version 445 let version = {
411 let (_bytes, version) = {
412 let mut state = decoder.get_mut(&context); 446 let mut state = decoder.get_mut(&context);
413 let bytes = state.decode::<u32>(); 447 match state.decode_struct_header(&StructHVersions) {
414 let version = state.decode::<u32>(); 448 Ok(header) => header.data(),
415 (bytes, version) 449 Err(err) => return Err(err),
450 }
416 }; 451 };
417 let a = bool::decode(decoder, context.clone()); 452 let a = match bool::decode(decoder, context.clone()) {
418 let b = u8::decode(decoder, context.clone()); 453 Ok(value) => value,
419 let c = Option::<UnionA>::decode(decoder, context.clone()); 454 Err(err) => return Err(err),
420 let d = Option::<Vec<UnionA>>::decode(decoder, context.clone()); 455 };
421 let e = Option::<HashMap<u8, UnionA>>::decode(decoder, context.clone()); 456 let b = match u8::decode(decoder, context.clone()) {
422 StructH { 457 Ok(value) => value,
458 Err(err) => return Err(err),
459 };
460 let c = match Option::<UnionA>::decode(decoder, context.clone()) {
461 Ok(value) => value,
462 Err(err) => return Err(err),
463 };
464 let d = match Option::<Vec<UnionA>>::decode(decoder, context.clone()) {
465 Ok(value) => value,
466 Err(err) => return Err(err),
467 };
468 let e = match Option::<HashMap<u8, UnionA>>::decode(decoder, context.clo ne()) {
469 Ok(value) => value,
470 Err(err) => return Err(err),
471 };
472 Ok(StructH {
423 a: a, 473 a: a,
424 b: b, 474 b: b,
425 c: c, 475 c: c,
426 d: d, 476 d: d,
427 e: e, 477 e: e,
428 } 478 })
429 } 479 }
430 } 480 }
431 481
432 impl MojomEncodable for StructH { 482 impl MojomEncodable for StructH {
433 impl_encodable_for_pointer!(); 483 impl_encodable_for_pointer!();
434 fn compute_size(&self, context: Context) -> usize { 484 fn compute_size(&self, context: Context) -> usize {
435 encoding::align_default(self.serialized_size(&context)) + 485 encoding::align_default(self.serialized_size(&context)) +
436 self.a.compute_size(context.clone()) + self.b.compute_size(context.clone ()) + 486 self.a.compute_size(context.clone()) + self.b.compute_size(context.clone ()) +
437 self.c.compute_size(context.clone()) + self.d.compute_size(context.clone ()) + 487 self.c.compute_size(context.clone()) + self.d.compute_size(context.clone ()) +
438 self.e.compute_size(context.clone()) 488 self.e.compute_size(context.clone())
(...skipping 17 matching lines...) Expand all
456 fn header_data(&self) -> DataHeaderValue { 506 fn header_data(&self) -> DataHeaderValue {
457 DataHeaderValue::Version(0) 507 DataHeaderValue::Version(0)
458 } 508 }
459 fn serialized_size(&self, _context: &Context) -> usize { 509 fn serialized_size(&self, _context: &Context) -> usize {
460 16 510 16
461 } 511 }
462 fn encode_value(self, encoder: &mut Encoder, context: Context) { 512 fn encode_value(self, encoder: &mut Encoder, context: Context) {
463 MojomEncodable::encode(self.a, encoder, context.clone()); 513 MojomEncodable::encode(self.a, encoder, context.clone());
464 514
465 } 515 }
466 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 516 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
467 // TODO(mknyszek): Validate bytes and version 517 let version = {
468 let (_bytes, version) = {
469 let mut state = decoder.get_mut(&context); 518 let mut state = decoder.get_mut(&context);
470 let bytes = state.decode::<u32>(); 519 match state.decode_struct_header(&BasicStructVersions) {
471 let version = state.decode::<u32>(); 520 Ok(header) => header.data(),
472 (bytes, version) 521 Err(err) => return Err(err),
522 }
473 }; 523 };
474 let a = i32::decode(decoder, context.clone()); 524 let a = match i32::decode(decoder, context.clone()) {
475 BasicStruct { a: a } 525 Ok(value) => value,
526 Err(err) => return Err(err),
527 };
528 Ok(BasicStruct { a: a })
476 } 529 }
477 } 530 }
478 531
479 impl MojomEncodable for BasicStruct { 532 impl MojomEncodable for BasicStruct {
480 impl_encodable_for_pointer!(); 533 impl_encodable_for_pointer!();
481 fn compute_size(&self, context: Context) -> usize { 534 fn compute_size(&self, context: Context) -> usize {
482 encoding::align_default(self.serialized_size(&context)) + 535 encoding::align_default(self.serialized_size(&context)) +
483 self.a.compute_size(context.clone()) 536 self.a.compute_size(context.clone())
484 } 537 }
485 } 538 }
(...skipping 20 matching lines...) Expand all
506 } 559 }
507 560
508 impl MojomPointer for StructWithEnum { 561 impl MojomPointer for StructWithEnum {
509 fn header_data(&self) -> DataHeaderValue { 562 fn header_data(&self) -> DataHeaderValue {
510 DataHeaderValue::Version(0) 563 DataHeaderValue::Version(0)
511 } 564 }
512 fn serialized_size(&self, _context: &Context) -> usize { 565 fn serialized_size(&self, _context: &Context) -> usize {
513 8 566 8
514 } 567 }
515 fn encode_value(self, encoder: &mut Encoder, context: Context) {} 568 fn encode_value(self, encoder: &mut Encoder, context: Context) {}
516 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 569 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
517 // TODO(mknyszek): Validate bytes and version 570 let version = {
518 let (_bytes, version) = {
519 let mut state = decoder.get_mut(&context); 571 let mut state = decoder.get_mut(&context);
520 let bytes = state.decode::<u32>(); 572 match state.decode_struct_header(&StructWithEnumVersions) {
521 let version = state.decode::<u32>(); 573 Ok(header) => header.data(),
522 (bytes, version) 574 Err(err) => return Err(err),
575 }
523 }; 576 };
524 StructWithEnum {} 577 Ok(StructWithEnum {})
525 } 578 }
526 } 579 }
527 580
528 impl MojomEncodable for StructWithEnum { 581 impl MojomEncodable for StructWithEnum {
529 impl_encodable_for_pointer!(); 582 impl_encodable_for_pointer!();
530 fn compute_size(&self, context: Context) -> usize { 583 fn compute_size(&self, context: Context) -> usize {
531 encoding::align_default(self.serialized_size(&context)) 584 encoding::align_default(self.serialized_size(&context))
532 } 585 }
533 } 586 }
534 587
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 UnionA::d(val) => MojomEncodable::encode(val, encoder, context.clone ()), 646 UnionA::d(val) => MojomEncodable::encode(val, encoder, context.clone ()),
594 UnionA::e(val) => MojomEncodable::encode(val, encoder, context.clone ()), 647 UnionA::e(val) => MojomEncodable::encode(val, encoder, context.clone ()),
595 UnionA::f(val) => MojomEncodable::encode(val, encoder, context.clone ()), 648 UnionA::f(val) => MojomEncodable::encode(val, encoder, context.clone ()),
596 UnionA::g(val) => MojomEncodable::encode(val, encoder, context.clone ()), 649 UnionA::g(val) => MojomEncodable::encode(val, encoder, context.clone ()),
597 UnionA::h(val) => MojomEncodable::encode(val, encoder, context.clone ()), 650 UnionA::h(val) => MojomEncodable::encode(val, encoder, context.clone ()),
598 UnionA::i(val) => MojomEncodable::encode(val, encoder, context.clone ()), 651 UnionA::i(val) => MojomEncodable::encode(val, encoder, context.clone ()),
599 UnionA::j(val) => MojomEncodable::encode(val, encoder, context.clone ()), 652 UnionA::j(val) => MojomEncodable::encode(val, encoder, context.clone ()),
600 UnionA::_Unknown(val) => MojomEncodable::encode(val, encoder, contex t.clone()), 653 UnionA::_Unknown(val) => MojomEncodable::encode(val, encoder, contex t.clone()),
601 } 654 }
602 } 655 }
603 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 656 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
604 // TODO(mknyszek): Validate bytes and tag 657 let tag = {
605 let (_bytes, tag) = {
606 let mut state = decoder.get_mut(&context); 658 let mut state = decoder.get_mut(&context);
607 let bytes = state.decode::<u32>(); 659 let bytes = state.decode::<u32>();
608 let tag = state.decode::<u32>(); 660 if (bytes as usize) != UNION_SIZE {
609 (bytes, tag) 661 return Err(ValidationError::UnexpectedNullUnion);
662 }
663 state.decode::<u32>()
610 }; 664 };
611 match tag { 665 Ok(match tag {
612 UnionATag_a => UnionA::a(u16::decode(decoder, context.clone())), 666 UnionATag_a => {
613 UnionATag_b => UnionA::b(u32::decode(decoder, context.clone())), 667 UnionA::a({
614 UnionATag_c => UnionA::c(Option::<StructA>::decode(decoder, context. clone())), 668 match u16::decode(decoder, context.clone()) {
615 UnionATag_d => UnionA::d(Option::<Vec<u8>>::decode(decoder, context. clone())), 669 Ok(value) => value,
670 Err(err) => return Err(err),
671 }
672 })
673 }
674 UnionATag_b => {
675 UnionA::b({
676 match u32::decode(decoder, context.clone()) {
677 Ok(value) => value,
678 Err(err) => return Err(err),
679 }
680 })
681 }
682 UnionATag_c => {
683 UnionA::c({
684 match Option::<StructA>::decode(decoder, context.clone()) {
685 Ok(value) => value,
686 Err(err) => return Err(err),
687 }
688 })
689 }
690 UnionATag_d => {
691 UnionA::d({
692 match Option::<Vec<u8>>::decode(decoder, context.clone()) {
693 Ok(value) => value,
694 Err(err) => return Err(err),
695 }
696 })
697 }
616 UnionATag_e => { 698 UnionATag_e => {
617 UnionA::e(Option::<HashMap<String, u8>>::decode(decoder, context .clone())) 699 UnionA::e({
700 match Option::<HashMap<String, u8>>::decode(decoder, context .clone()) {
701 Ok(value) => value,
702 Err(err) => return Err(err),
703 }
704 })
618 } 705 }
619 UnionATag_f => UnionA::f(Option::<UnionB>::decode(decoder, context.c lone())), 706 UnionATag_f => {
620 UnionATag_g => UnionA::g(StructA::decode(decoder, context.clone())), 707 UnionA::f({
621 UnionATag_h => UnionA::h(Vec::<u8>::decode(decoder, context.clone()) ), 708 match Option::<UnionB>::decode(decoder, context.clone()) {
622 UnionATag_i => UnionA::i(HashMap::<String, u8>::decode(decoder, cont ext.clone())), 709 Ok(value) => value,
623 UnionATag_j => UnionA::j(UnionB::decode(decoder, context.clone())), 710 Err(err) => return Err(err),
624 _ => UnionA::_Unknown(u64::decode(decoder, context.clone())), 711 }
625 } 712 })
713 }
714 UnionATag_g => {
715 UnionA::g({
716 match StructA::decode(decoder, context.clone()) {
717 Ok(value) => value,
718 Err(err) => return Err(err),
719 }
720 })
721 }
722 UnionATag_h => {
723 UnionA::h({
724 match Vec::<u8>::decode(decoder, context.clone()) {
725 Ok(value) => value,
726 Err(err) => return Err(err),
727 }
728 })
729 }
730 UnionATag_i => {
731 UnionA::i({
732 match HashMap::<String, u8>::decode(decoder, context.clone() ) {
733 Ok(value) => value,
734 Err(err) => return Err(err),
735 }
736 })
737 }
738 UnionATag_j => {
739 UnionA::j({
740 match UnionB::decode(decoder, context.clone()) {
741 Ok(value) => value,
742 Err(err) => return Err(err),
743 }
744 })
745 }
746 _ => UnionA::_Unknown(u64::decode(decoder, context.clone()).unwrap() ),
747 })
626 } 748 }
627 } 749 }
628 750
629 impl MojomEncodable for UnionA { 751 impl MojomEncodable for UnionA {
630 impl_encodable_for_union!(); 752 impl_encodable_for_union!();
631 fn compute_size(&self, context: Context) -> usize { 753 fn compute_size(&self, context: Context) -> usize {
632 UNION_SIZE + 754 UNION_SIZE +
633 match *self { 755 match *self {
634 UnionA::a(ref val) => val.compute_size(context.clone()), 756 UnionA::a(ref val) => val.compute_size(context.clone()),
635 UnionA::b(ref val) => val.compute_size(context.clone()), 757 UnionA::b(ref val) => val.compute_size(context.clone()),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 801 }
680 fn encode_value(self, encoder: &mut Encoder, context: Context) { 802 fn encode_value(self, encoder: &mut Encoder, context: Context) {
681 match self { 803 match self {
682 UnionB::a(val) => MojomEncodable::encode(val, encoder, context.clone ()), 804 UnionB::a(val) => MojomEncodable::encode(val, encoder, context.clone ()),
683 UnionB::b(val) => MojomEncodable::encode(val, encoder, context.clone ()), 805 UnionB::b(val) => MojomEncodable::encode(val, encoder, context.clone ()),
684 UnionB::c(val) => MojomEncodable::encode(val, encoder, context.clone ()), 806 UnionB::c(val) => MojomEncodable::encode(val, encoder, context.clone ()),
685 UnionB::d(val) => MojomEncodable::encode(val, encoder, context.clone ()), 807 UnionB::d(val) => MojomEncodable::encode(val, encoder, context.clone ()),
686 UnionB::_Unknown(val) => MojomEncodable::encode(val, encoder, contex t.clone()), 808 UnionB::_Unknown(val) => MojomEncodable::encode(val, encoder, contex t.clone()),
687 } 809 }
688 } 810 }
689 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 811 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
690 // TODO(mknyszek): Validate bytes and tag 812 let tag = {
691 let (_bytes, tag) = {
692 let mut state = decoder.get_mut(&context); 813 let mut state = decoder.get_mut(&context);
693 let bytes = state.decode::<u32>(); 814 let bytes = state.decode::<u32>();
694 let tag = state.decode::<u32>(); 815 if (bytes as usize) != UNION_SIZE {
695 (bytes, tag) 816 return Err(ValidationError::UnexpectedNullUnion);
817 }
818 state.decode::<u32>()
696 }; 819 };
697 match tag { 820 Ok(match tag {
698 UnionBTag_a => UnionB::a(u16::decode(decoder, context.clone())), 821 UnionBTag_a => {
699 UnionBTag_b => UnionB::b(u32::decode(decoder, context.clone())), 822 UnionB::a({
700 UnionBTag_c => UnionB::c(u64::decode(decoder, context.clone())), 823 match u16::decode(decoder, context.clone()) {
701 UnionBTag_d => UnionB::d(u32::decode(decoder, context.clone())), 824 Ok(value) => value,
702 _ => UnionB::_Unknown(u64::decode(decoder, context.clone())), 825 Err(err) => return Err(err),
703 } 826 }
827 })
828 }
829 UnionBTag_b => {
830 UnionB::b({
831 match u32::decode(decoder, context.clone()) {
832 Ok(value) => value,
833 Err(err) => return Err(err),
834 }
835 })
836 }
837 UnionBTag_c => {
838 UnionB::c({
839 match u64::decode(decoder, context.clone()) {
840 Ok(value) => value,
841 Err(err) => return Err(err),
842 }
843 })
844 }
845 UnionBTag_d => {
846 UnionB::d({
847 match u32::decode(decoder, context.clone()) {
848 Ok(value) => value,
849 Err(err) => return Err(err),
850 }
851 })
852 }
853 _ => UnionB::_Unknown(u64::decode(decoder, context.clone()).unwrap() ),
854 })
704 } 855 }
705 } 856 }
706 857
707 impl MojomEncodable for UnionB { 858 impl MojomEncodable for UnionB {
708 impl_encodable_for_union!(); 859 impl_encodable_for_union!();
709 fn compute_size(&self, context: Context) -> usize { 860 fn compute_size(&self, context: Context) -> usize {
710 UNION_SIZE + 861 UNION_SIZE +
711 match *self { 862 match *self {
712 UnionB::a(ref val) => val.compute_size(context.clone()), 863 UnionB::a(ref val) => val.compute_size(context.clone()),
713 UnionB::b(ref val) => val.compute_size(context.clone()), 864 UnionB::b(ref val) => val.compute_size(context.clone()),
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 985
835 986
836 pub trait InterfaceARequest: MojomMessage {} 987 pub trait InterfaceARequest: MojomMessage {}
837 pub trait InterfaceAResponse: MojomMessage {} 988 pub trait InterfaceAResponse: MojomMessage {}
838 989
839 pub enum InterfaceARequestOption { 990 pub enum InterfaceARequestOption {
840 991
841 } 992 }
842 993
843 impl MojomMessageOption for InterfaceARequestOption { 994 impl MojomMessageOption for InterfaceARequestOption {
844 fn decode_payload(ordinal: u32, buffer: &mut [u8], handles: Vec<UntypedHandl e>) -> Self { 995 fn decode_payload(header: MessageHeader,
845 match ordinal { 996 buffer: &mut [u8],
846 _ => panic!("Unknown message found: {}", ordinal), 997 handles: Vec<UntypedHandle>)
998 -> Result<Self, ValidationError> {
999 match header.name {
1000 _ => Err(ValidationError::MessageHeaderUnknownMethod),
847 } 1001 }
848 } 1002 }
849 } 1003 }
850 1004
851 pub enum InterfaceAResponseOption { 1005 pub enum InterfaceAResponseOption {
852 1006
853 } 1007 }
854 1008
855 impl MojomMessageOption for InterfaceAResponseOption { 1009 impl MojomMessageOption for InterfaceAResponseOption {
856 fn decode_payload(ordinal: u32, buffer: &mut [u8], handles: Vec<UntypedHandl e>) -> Self { 1010 fn decode_payload(header: MessageHeader,
857 match ordinal { 1011 buffer: &mut [u8],
858 _ => { 1012 handles: Vec<UntypedHandle>)
859 panic!("Unknown message found, or message has no response: {}", 1013 -> Result<Self, ValidationError> {
860 ordinal) 1014 if header.flags != message::MESSAGE_HEADER_IS_RESPONSE {
861 } 1015 return Err(ValidationError::MessageHeaderInvalidFlags);
1016 }
1017 match header.name {
1018 _ => Err(ValidationError::MessageHeaderUnknownMethod),
862 } 1019 }
863 } 1020 }
864 } 1021 }
865 1022
866 1023
867 // --- BoundsCheckTestInterface --- 1024 // --- BoundsCheckTestInterface ---
868 1025
869 pub mod BoundsCheckTestInterface { 1026 pub mod BoundsCheckTestInterface {
870 pub const SERVICE_NAME: &'static str = "this.is.the.service.name.for.BoundsC heckTestInterface"; 1027 pub const SERVICE_NAME: &'static str = "this.is.the.service.name.for.BoundsC heckTestInterface";
871 pub const VERSION: u32 = 0; 1028 pub const VERSION: u32 = 0;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 1122
966 pub trait BoundsCheckTestInterfaceRequest: MojomMessage {} 1123 pub trait BoundsCheckTestInterfaceRequest: MojomMessage {}
967 pub trait BoundsCheckTestInterfaceResponse: MojomMessage {} 1124 pub trait BoundsCheckTestInterfaceResponse: MojomMessage {}
968 1125
969 pub enum BoundsCheckTestInterfaceRequestOption { 1126 pub enum BoundsCheckTestInterfaceRequestOption {
970 BoundsCheckTestInterfaceMethod0(BoundsCheckTestInterfaceMethod0Request), 1127 BoundsCheckTestInterfaceMethod0(BoundsCheckTestInterfaceMethod0Request),
971 BoundsCheckTestInterfaceMethod1(BoundsCheckTestInterfaceMethod1Request), 1128 BoundsCheckTestInterfaceMethod1(BoundsCheckTestInterfaceMethod1Request),
972 } 1129 }
973 1130
974 impl MojomMessageOption for BoundsCheckTestInterfaceRequestOption { 1131 impl MojomMessageOption for BoundsCheckTestInterfaceRequestOption {
975 fn decode_payload(ordinal: u32, buffer: &mut [u8], handles: Vec<UntypedHandl e>) -> Self { 1132 fn decode_payload(header: MessageHeader,
976 match ordinal { 1133 buffer: &mut [u8],
977 BoundsCheckTestInterfaceMethod0::ORDINAL => BoundsCheckTestInterface RequestOption::BoundsCheckTestInterfaceMethod0(BoundsCheckTestInterfaceMethod0Re quest::deserialize(buffer, handles)), 1134 handles: Vec<UntypedHandle>)
978 BoundsCheckTestInterfaceMethod1::ORDINAL => BoundsCheckTestInterface RequestOption::BoundsCheckTestInterfaceMethod1(BoundsCheckTestInterfaceMethod1Re quest::deserialize(buffer, handles)), 1135 -> Result<Self, ValidationError> {
979 _ => panic!("Unknown message found: {}", ordinal), 1136 match header.name {
1137 BoundsCheckTestInterfaceMethod0::ORDINAL => {
1138 if header.flags != message::MESSAGE_HEADER_EXPECT_RESPONSE {
1139 return Err(ValidationError::MessageHeaderInvalidFlags);
1140 }
1141 match BoundsCheckTestInterfaceMethod0Request::deserialize(buffer , handles) {
1142 Ok(value) => Ok(BoundsCheckTestInterfaceRequestOption::Bound sCheckTestInterfaceMethod0(value)),
1143 Err(err) => return Err(err),
1144 }
1145 }
1146 BoundsCheckTestInterfaceMethod1::ORDINAL => {
1147 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1148 return Err(ValidationError::MessageHeaderInvalidFlags);
1149 }
1150 match BoundsCheckTestInterfaceMethod1Request::deserialize(buffer , handles) {
1151 Ok(value) => Ok(BoundsCheckTestInterfaceRequestOption::Bound sCheckTestInterfaceMethod1(value)),
1152 Err(err) => return Err(err),
1153 }
1154 }
1155 _ => Err(ValidationError::MessageHeaderUnknownMethod),
980 } 1156 }
981 } 1157 }
982 } 1158 }
983 1159
984 pub enum BoundsCheckTestInterfaceResponseOption { 1160 pub enum BoundsCheckTestInterfaceResponseOption {
985 BoundsCheckTestInterfaceMethod0(BoundsCheckTestInterfaceMethod0Response), 1161 BoundsCheckTestInterfaceMethod0(BoundsCheckTestInterfaceMethod0Response),
986 } 1162 }
987 1163
988 impl MojomMessageOption for BoundsCheckTestInterfaceResponseOption { 1164 impl MojomMessageOption for BoundsCheckTestInterfaceResponseOption {
989 fn decode_payload(ordinal: u32, buffer: &mut [u8], handles: Vec<UntypedHandl e>) -> Self { 1165 fn decode_payload(header: MessageHeader,
990 match ordinal { 1166 buffer: &mut [u8],
991 BoundsCheckTestInterfaceMethod0::ORDINAL => BoundsCheckTestInterface ResponseOption::BoundsCheckTestInterfaceMethod0(BoundsCheckTestInterfaceMethod0R esponse::deserialize(buffer, handles)), 1167 handles: Vec<UntypedHandle>)
992 _ => { 1168 -> Result<Self, ValidationError> {
993 panic!("Unknown message found, or message has no response: {}", 1169 if header.flags != message::MESSAGE_HEADER_IS_RESPONSE {
994 ordinal) 1170 return Err(ValidationError::MessageHeaderInvalidFlags);
1171 }
1172 match header.name {
1173 BoundsCheckTestInterfaceMethod0::ORDINAL => {
1174 match BoundsCheckTestInterfaceMethod0Response::deserialize(buffe r, handles) {
1175 Ok(value) => Ok(BoundsCheckTestInterfaceResponseOption::Boun dsCheckTestInterfaceMethod0(value)),
1176 Err(err) => return Err(err),
1177 }
995 } 1178 }
1179 _ => Err(ValidationError::MessageHeaderUnknownMethod),
996 } 1180 }
997 } 1181 }
998 } 1182 }
999 1183
1000 /// Message: BoundsCheckTestInterfaceMethod0 1184 /// Message: BoundsCheckTestInterfaceMethod0
1001 pub mod BoundsCheckTestInterfaceMethod0 { 1185 pub mod BoundsCheckTestInterfaceMethod0 {
1002 pub const ORDINAL: u32 = 0; 1186 pub const ORDINAL: u32 = 0;
1003 pub const MIN_VERSION: u32 = 0; 1187 pub const MIN_VERSION: u32 = 0;
1004 } 1188 }
1005 // -- BoundsCheckTestInterfaceMethod0Request -- 1189 // -- BoundsCheckTestInterfaceMethod0Request --
(...skipping 12 matching lines...) Expand all
1018 fn header_data(&self) -> DataHeaderValue { 1202 fn header_data(&self) -> DataHeaderValue {
1019 DataHeaderValue::Version(0) 1203 DataHeaderValue::Version(0)
1020 } 1204 }
1021 fn serialized_size(&self, _context: &Context) -> usize { 1205 fn serialized_size(&self, _context: &Context) -> usize {
1022 16 1206 16
1023 } 1207 }
1024 fn encode_value(self, encoder: &mut Encoder, context: Context) { 1208 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1025 MojomEncodable::encode(self.param0, encoder, context.clone()); 1209 MojomEncodable::encode(self.param0, encoder, context.clone());
1026 1210
1027 } 1211 }
1028 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 1212 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1029 // TODO(mknyszek): Validate bytes and version 1213 let version = {
1030 let (_bytes, version) = {
1031 let mut state = decoder.get_mut(&context); 1214 let mut state = decoder.get_mut(&context);
1032 let bytes = state.decode::<u32>(); 1215 match state.decode_struct_header(&BoundsCheckTestInterfaceMethod0Req uestVersions) {
1033 let version = state.decode::<u32>(); 1216 Ok(header) => header.data(),
1034 (bytes, version) 1217 Err(err) => return Err(err),
1218 }
1035 }; 1219 };
1036 let param0 = u8::decode(decoder, context.clone()); 1220 let param0 = match u8::decode(decoder, context.clone()) {
1037 BoundsCheckTestInterfaceMethod0Request { param0: param0 } 1221 Ok(value) => value,
1222 Err(err) => return Err(err),
1223 };
1224 Ok(BoundsCheckTestInterfaceMethod0Request { param0: param0 })
1038 } 1225 }
1039 } 1226 }
1040 1227
1041 impl MojomEncodable for BoundsCheckTestInterfaceMethod0Request { 1228 impl MojomEncodable for BoundsCheckTestInterfaceMethod0Request {
1042 impl_encodable_for_pointer!(); 1229 impl_encodable_for_pointer!();
1043 fn compute_size(&self, context: Context) -> usize { 1230 fn compute_size(&self, context: Context) -> usize {
1044 encoding::align_default(self.serialized_size(&context)) + 1231 encoding::align_default(self.serialized_size(&context)) +
1045 self.param0.compute_size(context.clone()) 1232 self.param0.compute_size(context.clone())
1046 } 1233 }
1047 } 1234 }
(...skipping 25 matching lines...) Expand all
1073 fn header_data(&self) -> DataHeaderValue { 1260 fn header_data(&self) -> DataHeaderValue {
1074 DataHeaderValue::Version(0) 1261 DataHeaderValue::Version(0)
1075 } 1262 }
1076 fn serialized_size(&self, _context: &Context) -> usize { 1263 fn serialized_size(&self, _context: &Context) -> usize {
1077 16 1264 16
1078 } 1265 }
1079 fn encode_value(self, encoder: &mut Encoder, context: Context) { 1266 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1080 MojomEncodable::encode(self.param0, encoder, context.clone()); 1267 MojomEncodable::encode(self.param0, encoder, context.clone());
1081 1268
1082 } 1269 }
1083 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 1270 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1084 // TODO(mknyszek): Validate bytes and version 1271 let version = {
1085 let (_bytes, version) = {
1086 let mut state = decoder.get_mut(&context); 1272 let mut state = decoder.get_mut(&context);
1087 let bytes = state.decode::<u32>(); 1273 match state.decode_struct_header(&BoundsCheckTestInterfaceMethod0Res ponseVersions) {
1088 let version = state.decode::<u32>(); 1274 Ok(header) => header.data(),
1089 (bytes, version) 1275 Err(err) => return Err(err),
1276 }
1090 }; 1277 };
1091 let param0 = u8::decode(decoder, context.clone()); 1278 let param0 = match u8::decode(decoder, context.clone()) {
1092 BoundsCheckTestInterfaceMethod0Response { param0: param0 } 1279 Ok(value) => value,
1280 Err(err) => return Err(err),
1281 };
1282 Ok(BoundsCheckTestInterfaceMethod0Response { param0: param0 })
1093 } 1283 }
1094 } 1284 }
1095 1285
1096 impl MojomEncodable for BoundsCheckTestInterfaceMethod0Response { 1286 impl MojomEncodable for BoundsCheckTestInterfaceMethod0Response {
1097 impl_encodable_for_pointer!(); 1287 impl_encodable_for_pointer!();
1098 fn compute_size(&self, context: Context) -> usize { 1288 fn compute_size(&self, context: Context) -> usize {
1099 encoding::align_default(self.serialized_size(&context)) + 1289 encoding::align_default(self.serialized_size(&context)) +
1100 self.param0.compute_size(context.clone()) 1290 self.param0.compute_size(context.clone())
1101 } 1291 }
1102 } 1292 }
(...skipping 29 matching lines...) Expand all
1132 fn header_data(&self) -> DataHeaderValue { 1322 fn header_data(&self) -> DataHeaderValue {
1133 DataHeaderValue::Version(0) 1323 DataHeaderValue::Version(0)
1134 } 1324 }
1135 fn serialized_size(&self, _context: &Context) -> usize { 1325 fn serialized_size(&self, _context: &Context) -> usize {
1136 16 1326 16
1137 } 1327 }
1138 fn encode_value(self, encoder: &mut Encoder, context: Context) { 1328 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1139 MojomEncodable::encode(self.param0, encoder, context.clone()); 1329 MojomEncodable::encode(self.param0, encoder, context.clone());
1140 1330
1141 } 1331 }
1142 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 1332 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1143 // TODO(mknyszek): Validate bytes and version 1333 let version = {
1144 let (_bytes, version) = {
1145 let mut state = decoder.get_mut(&context); 1334 let mut state = decoder.get_mut(&context);
1146 let bytes = state.decode::<u32>(); 1335 match state.decode_struct_header(&BoundsCheckTestInterfaceMethod1Req uestVersions) {
1147 let version = state.decode::<u32>(); 1336 Ok(header) => header.data(),
1148 (bytes, version) 1337 Err(err) => return Err(err),
1338 }
1149 }; 1339 };
1150 let param0 = u8::decode(decoder, context.clone()); 1340 let param0 = match u8::decode(decoder, context.clone()) {
1151 BoundsCheckTestInterfaceMethod1Request { param0: param0 } 1341 Ok(value) => value,
1342 Err(err) => return Err(err),
1343 };
1344 Ok(BoundsCheckTestInterfaceMethod1Request { param0: param0 })
1152 } 1345 }
1153 } 1346 }
1154 1347
1155 impl MojomEncodable for BoundsCheckTestInterfaceMethod1Request { 1348 impl MojomEncodable for BoundsCheckTestInterfaceMethod1Request {
1156 impl_encodable_for_pointer!(); 1349 impl_encodable_for_pointer!();
1157 fn compute_size(&self, context: Context) -> usize { 1350 fn compute_size(&self, context: Context) -> usize {
1158 encoding::align_default(self.serialized_size(&context)) + 1351 encoding::align_default(self.serialized_size(&context)) +
1159 self.param0.compute_size(context.clone()) 1352 self.param0.compute_size(context.clone())
1160 } 1353 }
1161 } 1354 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 // Enums 1461 // Enums
1269 1462
1270 1463
1271 // Constants 1464 // Constants
1272 1465
1273 1466
1274 pub trait ConformanceTestInterfaceRequest: MojomMessage {} 1467 pub trait ConformanceTestInterfaceRequest: MojomMessage {}
1275 pub trait ConformanceTestInterfaceResponse: MojomMessage {} 1468 pub trait ConformanceTestInterfaceResponse: MojomMessage {}
1276 1469
1277 pub enum ConformanceTestInterfaceRequestOption { 1470 pub enum ConformanceTestInterfaceRequestOption {
1278 ConformanceTestInterfaceMethod8(ConformanceTestInterfaceMethod8Request), 1471 ConformanceTestInterfaceMethod0(ConformanceTestInterfaceMethod0Request),
1472 ConformanceTestInterfaceMethod11(ConformanceTestInterfaceMethod11Request),
1473 ConformanceTestInterfaceMethod1(ConformanceTestInterfaceMethod1Request),
1474 ConformanceTestInterfaceMethod9(ConformanceTestInterfaceMethod9Request),
1475 ConformanceTestInterfaceMethod12(ConformanceTestInterfaceMethod12Request),
1279 ConformanceTestInterfaceMethod15(ConformanceTestInterfaceMethod15Request), 1476 ConformanceTestInterfaceMethod15(ConformanceTestInterfaceMethod15Request),
1280 ConformanceTestInterfaceMethod0(ConformanceTestInterfaceMethod0Request),
1281 ConformanceTestInterfaceMethod1(ConformanceTestInterfaceMethod1Request),
1282 ConformanceTestInterfaceMethod4(ConformanceTestInterfaceMethod4Request),
1283 ConformanceTestInterfaceMethod6(ConformanceTestInterfaceMethod6Request),
1284 ConformanceTestInterfaceMethod7(ConformanceTestInterfaceMethod7Request),
1285 ConformanceTestInterfaceMethod14(ConformanceTestInterfaceMethod14Request),
1286 ConformanceTestInterfaceMethod2(ConformanceTestInterfaceMethod2Request),
1287 ConformanceTestInterfaceMethod9(ConformanceTestInterfaceMethod9Request),
1288 ConformanceTestInterfaceMethod11(ConformanceTestInterfaceMethod11Request),
1289 ConformanceTestInterfaceMethod13(ConformanceTestInterfaceMethod13Request),
1290 ConformanceTestInterfaceMethod3(ConformanceTestInterfaceMethod3Request), 1477 ConformanceTestInterfaceMethod3(ConformanceTestInterfaceMethod3Request),
1291 ConformanceTestInterfaceMethod5(ConformanceTestInterfaceMethod5Request), 1478 ConformanceTestInterfaceMethod5(ConformanceTestInterfaceMethod5Request),
1479 ConformanceTestInterfaceMethod6(ConformanceTestInterfaceMethod6Request),
1480 ConformanceTestInterfaceMethod8(ConformanceTestInterfaceMethod8Request),
1481 ConformanceTestInterfaceMethod13(ConformanceTestInterfaceMethod13Request),
1482 ConformanceTestInterfaceMethod2(ConformanceTestInterfaceMethod2Request),
1483 ConformanceTestInterfaceMethod4(ConformanceTestInterfaceMethod4Request),
1484 ConformanceTestInterfaceMethod7(ConformanceTestInterfaceMethod7Request),
1292 ConformanceTestInterfaceMethod10(ConformanceTestInterfaceMethod10Request), 1485 ConformanceTestInterfaceMethod10(ConformanceTestInterfaceMethod10Request),
1293 ConformanceTestInterfaceMethod12(ConformanceTestInterfaceMethod12Request), 1486 ConformanceTestInterfaceMethod14(ConformanceTestInterfaceMethod14Request),
1294 } 1487 }
1295 1488
1296 impl MojomMessageOption for ConformanceTestInterfaceRequestOption { 1489 impl MojomMessageOption for ConformanceTestInterfaceRequestOption {
1297 fn decode_payload(ordinal: u32, buffer: &mut [u8], handles: Vec<UntypedHandl e>) -> Self { 1490 fn decode_payload(header: MessageHeader,
1298 match ordinal { 1491 buffer: &mut [u8],
1299 ConformanceTestInterfaceMethod8::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod8(ConformanceTestInterfaceMethod8Re quest::deserialize(buffer, handles)), 1492 handles: Vec<UntypedHandle>)
1300 ConformanceTestInterfaceMethod15::ORDINAL => ConformanceTestInterfac eRequestOption::ConformanceTestInterfaceMethod15(ConformanceTestInterfaceMethod1 5Request::deserialize(buffer, handles)), 1493 -> Result<Self, ValidationError> {
1301 ConformanceTestInterfaceMethod0::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod0(ConformanceTestInterfaceMethod0Re quest::deserialize(buffer, handles)), 1494 match header.name {
1302 ConformanceTestInterfaceMethod1::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod1(ConformanceTestInterfaceMethod1Re quest::deserialize(buffer, handles)), 1495 ConformanceTestInterfaceMethod0::ORDINAL => {
1303 ConformanceTestInterfaceMethod4::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod4(ConformanceTestInterfaceMethod4Re quest::deserialize(buffer, handles)), 1496 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1304 ConformanceTestInterfaceMethod6::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod6(ConformanceTestInterfaceMethod6Re quest::deserialize(buffer, handles)), 1497 return Err(ValidationError::MessageHeaderInvalidFlags);
1305 ConformanceTestInterfaceMethod7::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod7(ConformanceTestInterfaceMethod7Re quest::deserialize(buffer, handles)), 1498 }
1306 ConformanceTestInterfaceMethod14::ORDINAL => ConformanceTestInterfac eRequestOption::ConformanceTestInterfaceMethod14(ConformanceTestInterfaceMethod1 4Request::deserialize(buffer, handles)), 1499 match ConformanceTestInterfaceMethod0Request::deserialize(buffer , handles) {
1307 ConformanceTestInterfaceMethod2::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod2(ConformanceTestInterfaceMethod2Re quest::deserialize(buffer, handles)), 1500 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod0(value)),
1308 ConformanceTestInterfaceMethod9::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod9(ConformanceTestInterfaceMethod9Re quest::deserialize(buffer, handles)), 1501 Err(err) => return Err(err),
1309 ConformanceTestInterfaceMethod11::ORDINAL => ConformanceTestInterfac eRequestOption::ConformanceTestInterfaceMethod11(ConformanceTestInterfaceMethod1 1Request::deserialize(buffer, handles)), 1502 }
1310 ConformanceTestInterfaceMethod13::ORDINAL => ConformanceTestInterfac eRequestOption::ConformanceTestInterfaceMethod13(ConformanceTestInterfaceMethod1 3Request::deserialize(buffer, handles)), 1503 }
1311 ConformanceTestInterfaceMethod3::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod3(ConformanceTestInterfaceMethod3Re quest::deserialize(buffer, handles)), 1504 ConformanceTestInterfaceMethod11::ORDINAL => {
1312 ConformanceTestInterfaceMethod5::ORDINAL => ConformanceTestInterface RequestOption::ConformanceTestInterfaceMethod5(ConformanceTestInterfaceMethod5Re quest::deserialize(buffer, handles)), 1505 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1313 ConformanceTestInterfaceMethod10::ORDINAL => ConformanceTestInterfac eRequestOption::ConformanceTestInterfaceMethod10(ConformanceTestInterfaceMethod1 0Request::deserialize(buffer, handles)), 1506 return Err(ValidationError::MessageHeaderInvalidFlags);
1314 ConformanceTestInterfaceMethod12::ORDINAL => ConformanceTestInterfac eRequestOption::ConformanceTestInterfaceMethod12(ConformanceTestInterfaceMethod1 2Request::deserialize(buffer, handles)), 1507 }
1315 _ => panic!("Unknown message found: {}", ordinal), 1508 match ConformanceTestInterfaceMethod11Request::deserialize(buffe r, handles) {
1509 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod11(value)),
1510 Err(err) => return Err(err),
1511 }
1512 }
1513 ConformanceTestInterfaceMethod1::ORDINAL => {
1514 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1515 return Err(ValidationError::MessageHeaderInvalidFlags);
1516 }
1517 match ConformanceTestInterfaceMethod1Request::deserialize(buffer , handles) {
1518 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod1(value)),
1519 Err(err) => return Err(err),
1520 }
1521 }
1522 ConformanceTestInterfaceMethod9::ORDINAL => {
1523 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1524 return Err(ValidationError::MessageHeaderInvalidFlags);
1525 }
1526 match ConformanceTestInterfaceMethod9Request::deserialize(buffer , handles) {
1527 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod9(value)),
1528 Err(err) => return Err(err),
1529 }
1530 }
1531 ConformanceTestInterfaceMethod12::ORDINAL => {
1532 if header.flags != message::MESSAGE_HEADER_EXPECT_RESPONSE {
1533 return Err(ValidationError::MessageHeaderInvalidFlags);
1534 }
1535 match ConformanceTestInterfaceMethod12Request::deserialize(buffe r, handles) {
1536 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod12(value)),
1537 Err(err) => return Err(err),
1538 }
1539 }
1540 ConformanceTestInterfaceMethod15::ORDINAL => {
1541 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1542 return Err(ValidationError::MessageHeaderInvalidFlags);
1543 }
1544 match ConformanceTestInterfaceMethod15Request::deserialize(buffe r, handles) {
1545 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod15(value)),
1546 Err(err) => return Err(err),
1547 }
1548 }
1549 ConformanceTestInterfaceMethod3::ORDINAL => {
1550 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1551 return Err(ValidationError::MessageHeaderInvalidFlags);
1552 }
1553 match ConformanceTestInterfaceMethod3Request::deserialize(buffer , handles) {
1554 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod3(value)),
1555 Err(err) => return Err(err),
1556 }
1557 }
1558 ConformanceTestInterfaceMethod5::ORDINAL => {
1559 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1560 return Err(ValidationError::MessageHeaderInvalidFlags);
1561 }
1562 match ConformanceTestInterfaceMethod5Request::deserialize(buffer , handles) {
1563 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod5(value)),
1564 Err(err) => return Err(err),
1565 }
1566 }
1567 ConformanceTestInterfaceMethod6::ORDINAL => {
1568 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1569 return Err(ValidationError::MessageHeaderInvalidFlags);
1570 }
1571 match ConformanceTestInterfaceMethod6Request::deserialize(buffer , handles) {
1572 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod6(value)),
1573 Err(err) => return Err(err),
1574 }
1575 }
1576 ConformanceTestInterfaceMethod8::ORDINAL => {
1577 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1578 return Err(ValidationError::MessageHeaderInvalidFlags);
1579 }
1580 match ConformanceTestInterfaceMethod8Request::deserialize(buffer , handles) {
1581 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod8(value)),
1582 Err(err) => return Err(err),
1583 }
1584 }
1585 ConformanceTestInterfaceMethod13::ORDINAL => {
1586 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1587 return Err(ValidationError::MessageHeaderInvalidFlags);
1588 }
1589 match ConformanceTestInterfaceMethod13Request::deserialize(buffe r, handles) {
1590 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod13(value)),
1591 Err(err) => return Err(err),
1592 }
1593 }
1594 ConformanceTestInterfaceMethod2::ORDINAL => {
1595 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1596 return Err(ValidationError::MessageHeaderInvalidFlags);
1597 }
1598 match ConformanceTestInterfaceMethod2Request::deserialize(buffer , handles) {
1599 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod2(value)),
1600 Err(err) => return Err(err),
1601 }
1602 }
1603 ConformanceTestInterfaceMethod4::ORDINAL => {
1604 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1605 return Err(ValidationError::MessageHeaderInvalidFlags);
1606 }
1607 match ConformanceTestInterfaceMethod4Request::deserialize(buffer , handles) {
1608 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod4(value)),
1609 Err(err) => return Err(err),
1610 }
1611 }
1612 ConformanceTestInterfaceMethod7::ORDINAL => {
1613 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1614 return Err(ValidationError::MessageHeaderInvalidFlags);
1615 }
1616 match ConformanceTestInterfaceMethod7Request::deserialize(buffer , handles) {
1617 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod7(value)),
1618 Err(err) => return Err(err),
1619 }
1620 }
1621 ConformanceTestInterfaceMethod10::ORDINAL => {
1622 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1623 return Err(ValidationError::MessageHeaderInvalidFlags);
1624 }
1625 match ConformanceTestInterfaceMethod10Request::deserialize(buffe r, handles) {
1626 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod10(value)),
1627 Err(err) => return Err(err),
1628 }
1629 }
1630 ConformanceTestInterfaceMethod14::ORDINAL => {
1631 if header.flags != message::MESSAGE_HEADER_NO_FLAG {
1632 return Err(ValidationError::MessageHeaderInvalidFlags);
1633 }
1634 match ConformanceTestInterfaceMethod14Request::deserialize(buffe r, handles) {
1635 Ok(value) => Ok(ConformanceTestInterfaceRequestOption::Confo rmanceTestInterfaceMethod14(value)),
1636 Err(err) => return Err(err),
1637 }
1638 }
1639 _ => Err(ValidationError::MessageHeaderUnknownMethod),
1316 } 1640 }
1317 } 1641 }
1318 } 1642 }
1319 1643
1320 pub enum ConformanceTestInterfaceResponseOption { 1644 pub enum ConformanceTestInterfaceResponseOption {
1321 ConformanceTestInterfaceMethod12(ConformanceTestInterfaceMethod12Response), 1645 ConformanceTestInterfaceMethod12(ConformanceTestInterfaceMethod12Response),
1322 } 1646 }
1323 1647
1324 impl MojomMessageOption for ConformanceTestInterfaceResponseOption { 1648 impl MojomMessageOption for ConformanceTestInterfaceResponseOption {
1325 fn decode_payload(ordinal: u32, buffer: &mut [u8], handles: Vec<UntypedHandl e>) -> Self { 1649 fn decode_payload(header: MessageHeader,
1326 match ordinal { 1650 buffer: &mut [u8],
1327 ConformanceTestInterfaceMethod12::ORDINAL => ConformanceTestInterfac eResponseOption::ConformanceTestInterfaceMethod12(ConformanceTestInterfaceMethod 12Response::deserialize(buffer, handles)), 1651 handles: Vec<UntypedHandle>)
1328 _ => { 1652 -> Result<Self, ValidationError> {
1329 panic!("Unknown message found, or message has no response: {}", 1653 if header.flags != message::MESSAGE_HEADER_IS_RESPONSE {
1330 ordinal) 1654 return Err(ValidationError::MessageHeaderInvalidFlags);
1655 }
1656 match header.name {
1657 ConformanceTestInterfaceMethod12::ORDINAL => {
1658 match ConformanceTestInterfaceMethod12Response::deserialize(buff er, handles) {
1659 Ok(value) => Ok(ConformanceTestInterfaceResponseOption::Conf ormanceTestInterfaceMethod12(value)),
1660 Err(err) => return Err(err),
1661 }
1331 } 1662 }
1663 _ => Err(ValidationError::MessageHeaderUnknownMethod),
1332 } 1664 }
1333 } 1665 }
1334 } 1666 }
1335 1667
1336 /// Message: ConformanceTestInterfaceMethod8 1668 /// Message: ConformanceTestInterfaceMethod0
1337 pub mod ConformanceTestInterfaceMethod8 { 1669 pub mod ConformanceTestInterfaceMethod0 {
1338 pub const ORDINAL: u32 = 8; 1670 pub const ORDINAL: u32 = 0;
1339 pub const MIN_VERSION: u32 = 0; 1671 pub const MIN_VERSION: u32 = 0;
1340 } 1672 }
1341 // -- ConformanceTestInterfaceMethod8Request -- 1673 // -- ConformanceTestInterfaceMethod0Request --
1342 1674
1343 // Constants 1675 // Constants
1344 // Enums 1676 // Enums
1345 // Struct version information 1677 // Struct version information
1346 const ConformanceTestInterfaceMethod8RequestVersions: [(u32, u32); 1] = [(0, 16) ]; 1678 const ConformanceTestInterfaceMethod0RequestVersions: [(u32, u32); 1] = [(0, 16) ];
1347 1679
1348 // Struct definition 1680 // Struct definition
1349 pub struct ConformanceTestInterfaceMethod8Request { 1681 pub struct ConformanceTestInterfaceMethod0Request {
1350 pub param0: Vec<Option<Vec<String>>>, 1682 pub param0: f32,
1351 } 1683 }
1352 1684
1353 impl MojomPointer for ConformanceTestInterfaceMethod8Request { 1685 impl MojomPointer for ConformanceTestInterfaceMethod0Request {
1354 fn header_data(&self) -> DataHeaderValue { 1686 fn header_data(&self) -> DataHeaderValue {
1355 DataHeaderValue::Version(0) 1687 DataHeaderValue::Version(0)
1356 } 1688 }
1357 fn serialized_size(&self, _context: &Context) -> usize { 1689 fn serialized_size(&self, _context: &Context) -> usize {
1358 16 1690 16
1359 } 1691 }
1360 fn encode_value(self, encoder: &mut Encoder, context: Context) { 1692 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1361 MojomEncodable::encode(self.param0, encoder, context.clone()); 1693 MojomEncodable::encode(self.param0, encoder, context.clone());
1362 1694
1363 } 1695 }
1364 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 1696 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1365 // TODO(mknyszek): Validate bytes and version 1697 let version = {
1366 let (_bytes, version) = {
1367 let mut state = decoder.get_mut(&context); 1698 let mut state = decoder.get_mut(&context);
1368 let bytes = state.decode::<u32>(); 1699 match state.decode_struct_header(&ConformanceTestInterfaceMethod0Req uestVersions) {
1369 let version = state.decode::<u32>(); 1700 Ok(header) => header.data(),
1370 (bytes, version) 1701 Err(err) => return Err(err),
1702 }
1371 }; 1703 };
1372 let param0 = Vec::<Option<Vec<String>>>::decode(decoder, context.clone() ); 1704 let param0 = match f32::decode(decoder, context.clone()) {
1373 ConformanceTestInterfaceMethod8Request { param0: param0 } 1705 Ok(value) => value,
1706 Err(err) => return Err(err),
1707 };
1708 Ok(ConformanceTestInterfaceMethod0Request { param0: param0 })
1374 } 1709 }
1375 } 1710 }
1376 1711
1377 impl MojomEncodable for ConformanceTestInterfaceMethod8Request { 1712 impl MojomEncodable for ConformanceTestInterfaceMethod0Request {
1378 impl_encodable_for_pointer!(); 1713 impl_encodable_for_pointer!();
1379 fn compute_size(&self, context: Context) -> usize { 1714 fn compute_size(&self, context: Context) -> usize {
1380 encoding::align_default(self.serialized_size(&context)) + 1715 encoding::align_default(self.serialized_size(&context)) +
1381 self.param0.compute_size(context.clone()) 1716 self.param0.compute_size(context.clone())
1382 } 1717 }
1383 } 1718 }
1384 1719
1385 impl MojomStruct for ConformanceTestInterfaceMethod8Request {} 1720 impl MojomStruct for ConformanceTestInterfaceMethod0Request {}
1386 impl MojomMessage for ConformanceTestInterfaceMethod8Request { 1721 impl MojomMessage for ConformanceTestInterfaceMethod0Request {
1387 fn create_header() -> MessageHeader { 1722 fn create_header() -> MessageHeader {
1388 MessageHeader::new(ConformanceTestInterface::VERSION, 1723 MessageHeader::new(ConformanceTestInterface::VERSION,
1389 ConformanceTestInterfaceMethod8::ORDINAL, 1724 ConformanceTestInterfaceMethod0::ORDINAL,
1390 message::MESSAGE_HEADER_NO_FLAG) 1725 message::MESSAGE_HEADER_NO_FLAG)
1391 1726
1392 } 1727 }
1393 } 1728 }
1394 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod8Request {} 1729 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod0Request {}
1395 1730
1396 /// Message: ConformanceTestInterfaceMethod15 1731 /// Message: ConformanceTestInterfaceMethod11
1397 pub mod ConformanceTestInterfaceMethod15 { 1732 pub mod ConformanceTestInterfaceMethod11 {
1398 pub const ORDINAL: u32 = 15; 1733 pub const ORDINAL: u32 = 11;
1399 pub const MIN_VERSION: u32 = 0; 1734 pub const MIN_VERSION: u32 = 0;
1400 } 1735 }
1401 // -- ConformanceTestInterfaceMethod15Request -- 1736 // -- ConformanceTestInterfaceMethod11Request --
1402 1737
1403 // Constants 1738 // Constants
1404 // Enums 1739 // Enums
1405 // Struct version information 1740 // Struct version information
1406 const ConformanceTestInterfaceMethod15RequestVersions: [(u32, u32); 1] = [(0, 16 )]; 1741 const ConformanceTestInterfaceMethod11RequestVersions: [(u32, u32); 1] = [(0, 16 )];
1407 1742
1408 // Struct definition 1743 // Struct definition
1409 pub struct ConformanceTestInterfaceMethod15Request { 1744 pub struct ConformanceTestInterfaceMethod11Request {
1410 pub param0: StructH, 1745 pub param0: StructG,
1411 } 1746 }
1412 1747
1413 impl MojomPointer for ConformanceTestInterfaceMethod15Request { 1748 impl MojomPointer for ConformanceTestInterfaceMethod11Request {
1414 fn header_data(&self) -> DataHeaderValue { 1749 fn header_data(&self) -> DataHeaderValue {
1415 DataHeaderValue::Version(0) 1750 DataHeaderValue::Version(0)
1416 } 1751 }
1417 fn serialized_size(&self, _context: &Context) -> usize { 1752 fn serialized_size(&self, _context: &Context) -> usize {
1418 16 1753 16
1419 } 1754 }
1420 fn encode_value(self, encoder: &mut Encoder, context: Context) { 1755 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1421 MojomEncodable::encode(self.param0, encoder, context.clone()); 1756 MojomEncodable::encode(self.param0, encoder, context.clone());
1422 1757
1423 } 1758 }
1424 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 1759 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1425 // TODO(mknyszek): Validate bytes and version 1760 let version = {
1426 let (_bytes, version) = {
1427 let mut state = decoder.get_mut(&context); 1761 let mut state = decoder.get_mut(&context);
1428 let bytes = state.decode::<u32>(); 1762 match state.decode_struct_header(&ConformanceTestInterfaceMethod11Re questVersions) {
1429 let version = state.decode::<u32>(); 1763 Ok(header) => header.data(),
1430 (bytes, version) 1764 Err(err) => return Err(err),
1765 }
1431 }; 1766 };
1432 let param0 = StructH::decode(decoder, context.clone()); 1767 let param0 = match StructG::decode(decoder, context.clone()) {
1433 ConformanceTestInterfaceMethod15Request { param0: param0 } 1768 Ok(value) => value,
1769 Err(err) => return Err(err),
1770 };
1771 Ok(ConformanceTestInterfaceMethod11Request { param0: param0 })
1434 } 1772 }
1435 } 1773 }
1436 1774
1437 impl MojomEncodable for ConformanceTestInterfaceMethod15Request { 1775 impl MojomEncodable for ConformanceTestInterfaceMethod11Request {
1438 impl_encodable_for_pointer!(); 1776 impl_encodable_for_pointer!();
1439 fn compute_size(&self, context: Context) -> usize { 1777 fn compute_size(&self, context: Context) -> usize {
1440 encoding::align_default(self.serialized_size(&context)) + 1778 encoding::align_default(self.serialized_size(&context)) +
1441 self.param0.compute_size(context.clone()) 1779 self.param0.compute_size(context.clone())
1442 } 1780 }
1443 } 1781 }
1444 1782
1445 impl MojomStruct for ConformanceTestInterfaceMethod15Request {} 1783 impl MojomStruct for ConformanceTestInterfaceMethod11Request {}
1446 impl MojomMessage for ConformanceTestInterfaceMethod15Request { 1784 impl MojomMessage for ConformanceTestInterfaceMethod11Request {
1447 fn create_header() -> MessageHeader { 1785 fn create_header() -> MessageHeader {
1448 MessageHeader::new(ConformanceTestInterface::VERSION, 1786 MessageHeader::new(ConformanceTestInterface::VERSION,
1449 ConformanceTestInterfaceMethod15::ORDINAL, 1787 ConformanceTestInterfaceMethod11::ORDINAL,
1450 message::MESSAGE_HEADER_NO_FLAG) 1788 message::MESSAGE_HEADER_NO_FLAG)
1451 1789
1452 } 1790 }
1453 } 1791 }
1454 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod15Request {} 1792 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod11Request {}
1455 1793
1456 /// Message: ConformanceTestInterfaceMethod0 1794 /// Message: ConformanceTestInterfaceMethod1
1457 pub mod ConformanceTestInterfaceMethod0 { 1795 pub mod ConformanceTestInterfaceMethod1 {
1458 pub const ORDINAL: u32 = 0; 1796 pub const ORDINAL: u32 = 1;
1459 pub const MIN_VERSION: u32 = 0; 1797 pub const MIN_VERSION: u32 = 0;
1460 } 1798 }
1461 // -- ConformanceTestInterfaceMethod0Request -- 1799 // -- ConformanceTestInterfaceMethod1Request --
1462 1800
1463 // Constants 1801 // Constants
1464 // Enums 1802 // Enums
1465 // Struct version information 1803 // Struct version information
1466 const ConformanceTestInterfaceMethod0RequestVersions: [(u32, u32); 1] = [(0, 16) ]; 1804 const ConformanceTestInterfaceMethod1RequestVersions: [(u32, u32); 1] = [(0, 16) ];
1467 1805
1468 // Struct definition 1806 // Struct definition
1469 pub struct ConformanceTestInterfaceMethod0Request { 1807 pub struct ConformanceTestInterfaceMethod1Request {
1470 pub param0: f32, 1808 pub param0: StructA,
1471 } 1809 }
1472 1810
1473 impl MojomPointer for ConformanceTestInterfaceMethod0Request { 1811 impl MojomPointer for ConformanceTestInterfaceMethod1Request {
1474 fn header_data(&self) -> DataHeaderValue { 1812 fn header_data(&self) -> DataHeaderValue {
1475 DataHeaderValue::Version(0) 1813 DataHeaderValue::Version(0)
1476 } 1814 }
1477 fn serialized_size(&self, _context: &Context) -> usize { 1815 fn serialized_size(&self, _context: &Context) -> usize {
1478 16 1816 16
1479 } 1817 }
1480 fn encode_value(self, encoder: &mut Encoder, context: Context) { 1818 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1481 MojomEncodable::encode(self.param0, encoder, context.clone()); 1819 MojomEncodable::encode(self.param0, encoder, context.clone());
1482 1820
1483 } 1821 }
1484 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 1822 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1485 // TODO(mknyszek): Validate bytes and version 1823 let version = {
1486 let (_bytes, version) = {
1487 let mut state = decoder.get_mut(&context); 1824 let mut state = decoder.get_mut(&context);
1488 let bytes = state.decode::<u32>(); 1825 match state.decode_struct_header(&ConformanceTestInterfaceMethod1Req uestVersions) {
1489 let version = state.decode::<u32>(); 1826 Ok(header) => header.data(),
1490 (bytes, version) 1827 Err(err) => return Err(err),
1828 }
1491 }; 1829 };
1492 let param0 = f32::decode(decoder, context.clone()); 1830 let param0 = match StructA::decode(decoder, context.clone()) {
1493 ConformanceTestInterfaceMethod0Request { param0: param0 } 1831 Ok(value) => value,
1832 Err(err) => return Err(err),
1833 };
1834 Ok(ConformanceTestInterfaceMethod1Request { param0: param0 })
1494 } 1835 }
1495 } 1836 }
1496 1837
1497 impl MojomEncodable for ConformanceTestInterfaceMethod0Request { 1838 impl MojomEncodable for ConformanceTestInterfaceMethod1Request {
1498 impl_encodable_for_pointer!(); 1839 impl_encodable_for_pointer!();
1499 fn compute_size(&self, context: Context) -> usize { 1840 fn compute_size(&self, context: Context) -> usize {
1500 encoding::align_default(self.serialized_size(&context)) + 1841 encoding::align_default(self.serialized_size(&context)) +
1501 self.param0.compute_size(context.clone()) 1842 self.param0.compute_size(context.clone())
1502 } 1843 }
1503 } 1844 }
1504 1845
1505 impl MojomStruct for ConformanceTestInterfaceMethod0Request {} 1846 impl MojomStruct for ConformanceTestInterfaceMethod1Request {}
1506 impl MojomMessage for ConformanceTestInterfaceMethod0Request { 1847 impl MojomMessage for ConformanceTestInterfaceMethod1Request {
1507 fn create_header() -> MessageHeader { 1848 fn create_header() -> MessageHeader {
1508 MessageHeader::new(ConformanceTestInterface::VERSION, 1849 MessageHeader::new(ConformanceTestInterface::VERSION,
1509 ConformanceTestInterfaceMethod0::ORDINAL, 1850 ConformanceTestInterfaceMethod1::ORDINAL,
1510 message::MESSAGE_HEADER_NO_FLAG) 1851 message::MESSAGE_HEADER_NO_FLAG)
1511 1852
1512 } 1853 }
1513 } 1854 }
1514 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod0Request {} 1855 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod1Request {}
1515 1856
1516 /// Message: ConformanceTestInterfaceMethod1 1857 /// Message: ConformanceTestInterfaceMethod9
1517 pub mod ConformanceTestInterfaceMethod1 { 1858 pub mod ConformanceTestInterfaceMethod9 {
1518 pub const ORDINAL: u32 = 1; 1859 pub const ORDINAL: u32 = 9;
1519 pub const MIN_VERSION: u32 = 0; 1860 pub const MIN_VERSION: u32 = 0;
1520 } 1861 }
1521 // -- ConformanceTestInterfaceMethod1Request -- 1862 // -- ConformanceTestInterfaceMethod9Request --
1522 1863
1523 // Constants 1864 // Constants
1524 // Enums 1865 // Enums
1525 // Struct version information 1866 // Struct version information
1526 const ConformanceTestInterfaceMethod1RequestVersions: [(u32, u32); 1] = [(0, 16) ]; 1867 const ConformanceTestInterfaceMethod9RequestVersions: [(u32, u32); 1] = [(0, 16) ];
1527 1868
1528 // Struct definition 1869 // Struct definition
1529 pub struct ConformanceTestInterfaceMethod1Request { 1870 pub struct ConformanceTestInterfaceMethod9Request {
1530 pub param0: StructA, 1871 pub param0: Option<Vec<Vec<Option<system::UntypedHandle>>>>,
1531 } 1872 }
1532 1873
1533 impl MojomPointer for ConformanceTestInterfaceMethod1Request { 1874 impl MojomPointer for ConformanceTestInterfaceMethod9Request {
1534 fn header_data(&self) -> DataHeaderValue { 1875 fn header_data(&self) -> DataHeaderValue {
1535 DataHeaderValue::Version(0) 1876 DataHeaderValue::Version(0)
1536 } 1877 }
1537 fn serialized_size(&self, _context: &Context) -> usize { 1878 fn serialized_size(&self, _context: &Context) -> usize {
1538 16 1879 16
1539 } 1880 }
1540 fn encode_value(self, encoder: &mut Encoder, context: Context) { 1881 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1541 MojomEncodable::encode(self.param0, encoder, context.clone()); 1882 MojomEncodable::encode(self.param0, encoder, context.clone());
1542 1883
1543 } 1884 }
1544 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 1885 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1545 // TODO(mknyszek): Validate bytes and version 1886 let version = {
1546 let (_bytes, version) = {
1547 let mut state = decoder.get_mut(&context); 1887 let mut state = decoder.get_mut(&context);
1548 let bytes = state.decode::<u32>(); 1888 match state.decode_struct_header(&ConformanceTestInterfaceMethod9Req uestVersions) {
1549 let version = state.decode::<u32>(); 1889 Ok(header) => header.data(),
1550 (bytes, version) 1890 Err(err) => return Err(err),
1891 }
1551 }; 1892 };
1552 let param0 = StructA::decode(decoder, context.clone()); 1893 let param0 =
1553 ConformanceTestInterfaceMethod1Request { param0: param0 } 1894 match Option::<Vec<Vec<Option<system::UntypedHandle>>>>::decode(deco der,
1895 cont ext.clone()) {
1896 Ok(value) => value,
1897 Err(err) => return Err(err),
1898 };
1899 Ok(ConformanceTestInterfaceMethod9Request { param0: param0 })
1554 } 1900 }
1555 } 1901 }
1556 1902
1557 impl MojomEncodable for ConformanceTestInterfaceMethod1Request { 1903 impl MojomEncodable for ConformanceTestInterfaceMethod9Request {
1558 impl_encodable_for_pointer!(); 1904 impl_encodable_for_pointer!();
1559 fn compute_size(&self, context: Context) -> usize { 1905 fn compute_size(&self, context: Context) -> usize {
1560 encoding::align_default(self.serialized_size(&context)) + 1906 encoding::align_default(self.serialized_size(&context)) +
1561 self.param0.compute_size(context.clone()) 1907 self.param0.compute_size(context.clone())
1562 } 1908 }
1563 } 1909 }
1564 1910
1565 impl MojomStruct for ConformanceTestInterfaceMethod1Request {} 1911 impl MojomStruct for ConformanceTestInterfaceMethod9Request {}
1566 impl MojomMessage for ConformanceTestInterfaceMethod1Request { 1912 impl MojomMessage for ConformanceTestInterfaceMethod9Request {
1567 fn create_header() -> MessageHeader { 1913 fn create_header() -> MessageHeader {
1568 MessageHeader::new(ConformanceTestInterface::VERSION, 1914 MessageHeader::new(ConformanceTestInterface::VERSION,
1569 ConformanceTestInterfaceMethod1::ORDINAL, 1915 ConformanceTestInterfaceMethod9::ORDINAL,
1570 message::MESSAGE_HEADER_NO_FLAG) 1916 message::MESSAGE_HEADER_NO_FLAG)
1571 1917
1572 } 1918 }
1573 } 1919 }
1574 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod1Request {} 1920 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod9Request {}
1575 1921
1576 /// Message: ConformanceTestInterfaceMethod4 1922 /// Message: ConformanceTestInterfaceMethod12
1577 pub mod ConformanceTestInterfaceMethod4 { 1923 pub mod ConformanceTestInterfaceMethod12 {
1578 pub const ORDINAL: u32 = 4; 1924 pub const ORDINAL: u32 = 12;
1579 pub const MIN_VERSION: u32 = 0; 1925 pub const MIN_VERSION: u32 = 0;
1580 } 1926 }
1581 // -- ConformanceTestInterfaceMethod4Request -- 1927 // -- ConformanceTestInterfaceMethod12Request --
1582 1928
1583 // Constants 1929 // Constants
1584 // Enums 1930 // Enums
1585 // Struct version information 1931 // Struct version information
1586 const ConformanceTestInterfaceMethod4RequestVersions: [(u32, u32); 1] = [(0, 24) ]; 1932 const ConformanceTestInterfaceMethod12RequestVersions: [(u32, u32); 1] = [(0, 16 )];
1587 1933
1588 // Struct definition 1934 // Struct definition
1589 pub struct ConformanceTestInterfaceMethod4Request { 1935 pub struct ConformanceTestInterfaceMethod12Request {
1590 pub param0: StructC, 1936 pub param0: f32,
1591 pub param1: Vec<u8>,
1592 } 1937 }
1593 1938
1594 impl MojomPointer for ConformanceTestInterfaceMethod4Request { 1939 impl MojomPointer for ConformanceTestInterfaceMethod12Request {
1595 fn header_data(&self) -> DataHeaderValue { 1940 fn header_data(&self) -> DataHeaderValue {
1596 DataHeaderValue::Version(0) 1941 DataHeaderValue::Version(0)
1597 } 1942 }
1598 fn serialized_size(&self, _context: &Context) -> usize { 1943 fn serialized_size(&self, _context: &Context) -> usize {
1599 24 1944 16
1600 } 1945 }
1601 fn encode_value(self, encoder: &mut Encoder, context: Context) { 1946 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1602 MojomEncodable::encode(self.param0, encoder, context.clone()); 1947 MojomEncodable::encode(self.param0, encoder, context.clone());
1603 MojomEncodable::encode(self.param1, encoder, context.clone());
1604 1948
1605 } 1949 }
1606 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 1950 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1607 // TODO(mknyszek): Validate bytes and version 1951 let version = {
1608 let (_bytes, version) = {
1609 let mut state = decoder.get_mut(&context); 1952 let mut state = decoder.get_mut(&context);
1610 let bytes = state.decode::<u32>(); 1953 match state.decode_struct_header(&ConformanceTestInterfaceMethod12Re questVersions) {
1611 let version = state.decode::<u32>(); 1954 Ok(header) => header.data(),
1612 (bytes, version) 1955 Err(err) => return Err(err),
1956 }
1613 }; 1957 };
1614 let param0 = StructC::decode(decoder, context.clone()); 1958 let param0 = match f32::decode(decoder, context.clone()) {
1615 let param1 = Vec::<u8>::decode(decoder, context.clone()); 1959 Ok(value) => value,
1616 ConformanceTestInterfaceMethod4Request { 1960 Err(err) => return Err(err),
1617 param0: param0, 1961 };
1618 param1: param1, 1962 Ok(ConformanceTestInterfaceMethod12Request { param0: param0 })
1619 }
1620 } 1963 }
1621 } 1964 }
1622 1965
1623 impl MojomEncodable for ConformanceTestInterfaceMethod4Request { 1966 impl MojomEncodable for ConformanceTestInterfaceMethod12Request {
1624 impl_encodable_for_pointer!(); 1967 impl_encodable_for_pointer!();
1625 fn compute_size(&self, context: Context) -> usize { 1968 fn compute_size(&self, context: Context) -> usize {
1626 encoding::align_default(self.serialized_size(&context)) + 1969 encoding::align_default(self.serialized_size(&context)) +
1627 self.param0.compute_size(context.clone()) + 1970 self.param0.compute_size(context.clone())
1628 self.param1.compute_size(context.clone())
1629 } 1971 }
1630 } 1972 }
1631 1973
1632 impl MojomStruct for ConformanceTestInterfaceMethod4Request {} 1974 impl MojomStruct for ConformanceTestInterfaceMethod12Request {}
1633 impl MojomMessage for ConformanceTestInterfaceMethod4Request { 1975 impl MojomMessage for ConformanceTestInterfaceMethod12Request {
1634 fn create_header() -> MessageHeader { 1976 fn create_header() -> MessageHeader {
1635 MessageHeader::new(ConformanceTestInterface::VERSION, 1977 MessageHeader::new(ConformanceTestInterface::VERSION,
1636 ConformanceTestInterfaceMethod4::ORDINAL, 1978 ConformanceTestInterfaceMethod12::ORDINAL,
1637 message::MESSAGE_HEADER_NO_FLAG) 1979 message::MESSAGE_HEADER_EXPECT_RESPONSE)
1638 1980
1639 } 1981 }
1640 } 1982 }
1641 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod4Request {} 1983 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod12Request {}
1642 1984
1643 /// Message: ConformanceTestInterfaceMethod6 1985 // -- ConformanceTestInterfaceMethod12Response --
1644 pub mod ConformanceTestInterfaceMethod6 {
1645 pub const ORDINAL: u32 = 6;
1646 pub const MIN_VERSION: u32 = 0;
1647 }
1648 // -- ConformanceTestInterfaceMethod6Request --
1649 1986
1650 // Constants 1987 // Constants
1651 // Enums 1988 // Enums
1652 // Struct version information 1989 // Struct version information
1653 const ConformanceTestInterfaceMethod6RequestVersions: [(u32, u32); 1] = [(0, 16) ]; 1990 const ConformanceTestInterfaceMethod12ResponseVersions: [(u32, u32); 1] = [(0, 1 6)];
1654 1991
1655 // Struct definition 1992 // Struct definition
1656 pub struct ConformanceTestInterfaceMethod6Request { 1993 pub struct ConformanceTestInterfaceMethod12Response {
1657 pub param0: Vec<Vec<u8>>, 1994 pub param0: f32,
1658 } 1995 }
1659 1996
1660 impl MojomPointer for ConformanceTestInterfaceMethod6Request { 1997 impl MojomPointer for ConformanceTestInterfaceMethod12Response {
1661 fn header_data(&self) -> DataHeaderValue { 1998 fn header_data(&self) -> DataHeaderValue {
1662 DataHeaderValue::Version(0) 1999 DataHeaderValue::Version(0)
1663 } 2000 }
1664 fn serialized_size(&self, _context: &Context) -> usize { 2001 fn serialized_size(&self, _context: &Context) -> usize {
1665 16 2002 16
1666 } 2003 }
1667 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2004 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1668 MojomEncodable::encode(self.param0, encoder, context.clone()); 2005 MojomEncodable::encode(self.param0, encoder, context.clone());
1669 2006
1670 } 2007 }
1671 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2008 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1672 // TODO(mknyszek): Validate bytes and version 2009 let version = {
1673 let (_bytes, version) = {
1674 let mut state = decoder.get_mut(&context); 2010 let mut state = decoder.get_mut(&context);
1675 let bytes = state.decode::<u32>(); 2011 match state.decode_struct_header(&ConformanceTestInterfaceMethod12Re sponseVersions) {
1676 let version = state.decode::<u32>(); 2012 Ok(header) => header.data(),
1677 (bytes, version) 2013 Err(err) => return Err(err),
2014 }
1678 }; 2015 };
1679 let param0 = Vec::<Vec<u8>>::decode(decoder, context.clone()); 2016 let param0 = match f32::decode(decoder, context.clone()) {
1680 ConformanceTestInterfaceMethod6Request { param0: param0 } 2017 Ok(value) => value,
2018 Err(err) => return Err(err),
2019 };
2020 Ok(ConformanceTestInterfaceMethod12Response { param0: param0 })
1681 } 2021 }
1682 } 2022 }
1683 2023
1684 impl MojomEncodable for ConformanceTestInterfaceMethod6Request { 2024 impl MojomEncodable for ConformanceTestInterfaceMethod12Response {
1685 impl_encodable_for_pointer!(); 2025 impl_encodable_for_pointer!();
1686 fn compute_size(&self, context: Context) -> usize { 2026 fn compute_size(&self, context: Context) -> usize {
1687 encoding::align_default(self.serialized_size(&context)) + 2027 encoding::align_default(self.serialized_size(&context)) +
1688 self.param0.compute_size(context.clone()) 2028 self.param0.compute_size(context.clone())
1689 } 2029 }
1690 } 2030 }
1691 2031
1692 impl MojomStruct for ConformanceTestInterfaceMethod6Request {} 2032 impl MojomStruct for ConformanceTestInterfaceMethod12Response {}
1693 impl MojomMessage for ConformanceTestInterfaceMethod6Request { 2033
2034 impl MojomMessage for ConformanceTestInterfaceMethod12Response {
1694 fn create_header() -> MessageHeader { 2035 fn create_header() -> MessageHeader {
1695 MessageHeader::new(ConformanceTestInterface::VERSION, 2036 MessageHeader::new(ConformanceTestInterface::VERSION,
1696 ConformanceTestInterfaceMethod6::ORDINAL, 2037 ConformanceTestInterfaceMethod12::ORDINAL,
1697 message::MESSAGE_HEADER_NO_FLAG) 2038 message::MESSAGE_HEADER_IS_RESPONSE)
1698
1699 } 2039 }
1700 } 2040 }
1701 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod6Request {} 2041 impl ConformanceTestInterfaceResponse for ConformanceTestInterfaceMethod12Reques t {}
1702 2042 /// Message: ConformanceTestInterfaceMethod15
1703 /// Message: ConformanceTestInterfaceMethod7 2043 pub mod ConformanceTestInterfaceMethod15 {
1704 pub mod ConformanceTestInterfaceMethod7 { 2044 pub const ORDINAL: u32 = 15;
1705 pub const ORDINAL: u32 = 7;
1706 pub const MIN_VERSION: u32 = 0; 2045 pub const MIN_VERSION: u32 = 0;
1707 } 2046 }
1708 // -- ConformanceTestInterfaceMethod7Request -- 2047 // -- ConformanceTestInterfaceMethod15Request --
1709 2048
1710 // Constants 2049 // Constants
1711 // Enums 2050 // Enums
1712 // Struct version information 2051 // Struct version information
1713 const ConformanceTestInterfaceMethod7RequestVersions: [(u32, u32); 1] = [(0, 24) ]; 2052 const ConformanceTestInterfaceMethod15RequestVersions: [(u32, u32); 1] = [(0, 16 )];
1714 2053
1715 // Struct definition 2054 // Struct definition
1716 pub struct ConformanceTestInterfaceMethod7Request { 2055 pub struct ConformanceTestInterfaceMethod15Request {
1717 pub param0: StructF, 2056 pub param0: StructH,
1718 pub param1: Box<[Option<Box<[u8; 3]>>; 2]>,
1719 } 2057 }
1720 2058
1721 impl MojomPointer for ConformanceTestInterfaceMethod7Request { 2059 impl MojomPointer for ConformanceTestInterfaceMethod15Request {
1722 fn header_data(&self) -> DataHeaderValue { 2060 fn header_data(&self) -> DataHeaderValue {
1723 DataHeaderValue::Version(0) 2061 DataHeaderValue::Version(0)
1724 } 2062 }
1725 fn serialized_size(&self, _context: &Context) -> usize { 2063 fn serialized_size(&self, _context: &Context) -> usize {
1726 24 2064 16
1727 }
1728 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1729 MojomEncodable::encode(self.param0, encoder, context.clone());
1730 MojomEncodable::encode(self.param1, encoder, context.clone());
1731
1732 }
1733 fn decode_value(decoder: &mut Decoder, context: Context) -> Self {
1734 // TODO(mknyszek): Validate bytes and version
1735 let (_bytes, version) = {
1736 let mut state = decoder.get_mut(&context);
1737 let bytes = state.decode::<u32>();
1738 let version = state.decode::<u32>();
1739 (bytes, version)
1740 };
1741 let param0 = StructF::decode(decoder, context.clone());
1742 let param1 = Box::<[Option<Box<[u8; 3]>>; 2]>::decode(decoder, context.c lone());
1743 ConformanceTestInterfaceMethod7Request {
1744 param0: param0,
1745 param1: param1,
1746 }
1747 }
1748 }
1749
1750 impl MojomEncodable for ConformanceTestInterfaceMethod7Request {
1751 impl_encodable_for_pointer!();
1752 fn compute_size(&self, context: Context) -> usize {
1753 encoding::align_default(self.serialized_size(&context)) +
1754 self.param0.compute_size(context.clone()) +
1755 self.param1.compute_size(context.clone())
1756 }
1757 }
1758
1759 impl MojomStruct for ConformanceTestInterfaceMethod7Request {}
1760 impl MojomMessage for ConformanceTestInterfaceMethod7Request {
1761 fn create_header() -> MessageHeader {
1762 MessageHeader::new(ConformanceTestInterface::VERSION,
1763 ConformanceTestInterfaceMethod7::ORDINAL,
1764 message::MESSAGE_HEADER_NO_FLAG)
1765
1766 }
1767 }
1768 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod7Request {}
1769
1770 /// Message: ConformanceTestInterfaceMethod14
1771 pub mod ConformanceTestInterfaceMethod14 {
1772 pub const ORDINAL: u32 = 14;
1773 pub const MIN_VERSION: u32 = 0;
1774 }
1775 // -- ConformanceTestInterfaceMethod14Request --
1776
1777 // Constants
1778 // Enums
1779 // Struct version information
1780 const ConformanceTestInterfaceMethod14RequestVersions: [(u32, u32); 1] = [(0, 24 )];
1781
1782 // Struct definition
1783 pub struct ConformanceTestInterfaceMethod14Request {
1784 pub param0: UnionA,
1785 }
1786
1787 impl MojomPointer for ConformanceTestInterfaceMethod14Request {
1788 fn header_data(&self) -> DataHeaderValue {
1789 DataHeaderValue::Version(0)
1790 }
1791 fn serialized_size(&self, _context: &Context) -> usize {
1792 24
1793 } 2065 }
1794 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2066 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1795 MojomEncodable::encode(self.param0, encoder, context.clone()); 2067 MojomEncodable::encode(self.param0, encoder, context.clone());
1796 2068
1797 } 2069 }
1798 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2070 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1799 // TODO(mknyszek): Validate bytes and version 2071 let version = {
1800 let (_bytes, version) = {
1801 let mut state = decoder.get_mut(&context); 2072 let mut state = decoder.get_mut(&context);
1802 let bytes = state.decode::<u32>(); 2073 match state.decode_struct_header(&ConformanceTestInterfaceMethod15Re questVersions) {
1803 let version = state.decode::<u32>(); 2074 Ok(header) => header.data(),
1804 (bytes, version) 2075 Err(err) => return Err(err),
2076 }
1805 }; 2077 };
1806 let param0 = UnionA::decode(decoder, context.clone()); 2078 let param0 = match StructH::decode(decoder, context.clone()) {
1807 ConformanceTestInterfaceMethod14Request { param0: param0 } 2079 Ok(value) => value,
2080 Err(err) => return Err(err),
2081 };
2082 Ok(ConformanceTestInterfaceMethod15Request { param0: param0 })
1808 } 2083 }
1809 } 2084 }
1810 2085
1811 impl MojomEncodable for ConformanceTestInterfaceMethod14Request { 2086 impl MojomEncodable for ConformanceTestInterfaceMethod15Request {
1812 impl_encodable_for_pointer!(); 2087 impl_encodable_for_pointer!();
1813 fn compute_size(&self, context: Context) -> usize { 2088 fn compute_size(&self, context: Context) -> usize {
1814 encoding::align_default(self.serialized_size(&context)) + 2089 encoding::align_default(self.serialized_size(&context)) +
2090 self.param0.compute_size(context.clone())
2091 }
2092 }
2093
2094 impl MojomStruct for ConformanceTestInterfaceMethod15Request {}
2095 impl MojomMessage for ConformanceTestInterfaceMethod15Request {
2096 fn create_header() -> MessageHeader {
2097 MessageHeader::new(ConformanceTestInterface::VERSION,
2098 ConformanceTestInterfaceMethod15::ORDINAL,
2099 message::MESSAGE_HEADER_NO_FLAG)
2100
2101 }
2102 }
2103 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod15Request {}
2104
2105 /// Message: ConformanceTestInterfaceMethod3
2106 pub mod ConformanceTestInterfaceMethod3 {
2107 pub const ORDINAL: u32 = 3;
2108 pub const MIN_VERSION: u32 = 0;
2109 }
2110 // -- ConformanceTestInterfaceMethod3Request --
2111
2112 // Constants
2113 // Enums
2114 // Struct version information
2115 const ConformanceTestInterfaceMethod3RequestVersions: [(u32, u32); 1] = [(0, 16) ];
2116
2117 // Struct definition
2118 pub struct ConformanceTestInterfaceMethod3Request {
2119 pub param0: Vec<bool>,
2120 }
2121
2122 impl MojomPointer for ConformanceTestInterfaceMethod3Request {
2123 fn header_data(&self) -> DataHeaderValue {
2124 DataHeaderValue::Version(0)
2125 }
2126 fn serialized_size(&self, _context: &Context) -> usize {
2127 16
2128 }
2129 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2130 MojomEncodable::encode(self.param0, encoder, context.clone());
2131
2132 }
2133 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2134 let version = {
2135 let mut state = decoder.get_mut(&context);
2136 match state.decode_struct_header(&ConformanceTestInterfaceMethod3Req uestVersions) {
2137 Ok(header) => header.data(),
2138 Err(err) => return Err(err),
2139 }
2140 };
2141 let param0 = match Vec::<bool>::decode(decoder, context.clone()) {
2142 Ok(value) => value,
2143 Err(err) => return Err(err),
2144 };
2145 Ok(ConformanceTestInterfaceMethod3Request { param0: param0 })
2146 }
2147 }
2148
2149 impl MojomEncodable for ConformanceTestInterfaceMethod3Request {
2150 impl_encodable_for_pointer!();
2151 fn compute_size(&self, context: Context) -> usize {
2152 encoding::align_default(self.serialized_size(&context)) +
1815 self.param0.compute_size(context.clone()) 2153 self.param0.compute_size(context.clone())
1816 } 2154 }
1817 } 2155 }
1818 2156
1819 impl MojomStruct for ConformanceTestInterfaceMethod14Request {} 2157 impl MojomStruct for ConformanceTestInterfaceMethod3Request {}
1820 impl MojomMessage for ConformanceTestInterfaceMethod14Request { 2158 impl MojomMessage for ConformanceTestInterfaceMethod3Request {
1821 fn create_header() -> MessageHeader { 2159 fn create_header() -> MessageHeader {
1822 MessageHeader::new(ConformanceTestInterface::VERSION, 2160 MessageHeader::new(ConformanceTestInterface::VERSION,
1823 ConformanceTestInterfaceMethod14::ORDINAL, 2161 ConformanceTestInterfaceMethod3::ORDINAL,
1824 message::MESSAGE_HEADER_NO_FLAG) 2162 message::MESSAGE_HEADER_NO_FLAG)
1825 2163
1826 } 2164 }
1827 } 2165 }
1828 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod14Request {} 2166 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod3Request {}
1829 2167
1830 /// Message: ConformanceTestInterfaceMethod2 2168 /// Message: ConformanceTestInterfaceMethod5
1831 pub mod ConformanceTestInterfaceMethod2 { 2169 pub mod ConformanceTestInterfaceMethod5 {
1832 pub const ORDINAL: u32 = 2; 2170 pub const ORDINAL: u32 = 5;
1833 pub const MIN_VERSION: u32 = 0; 2171 pub const MIN_VERSION: u32 = 0;
1834 } 2172 }
1835 // -- ConformanceTestInterfaceMethod2Request -- 2173 // -- ConformanceTestInterfaceMethod5Request --
1836 2174
1837 // Constants 2175 // Constants
1838 // Enums 2176 // Enums
1839 // Struct version information 2177 // Struct version information
1840 const ConformanceTestInterfaceMethod2RequestVersions: [(u32, u32); 1] = [(0, 24) ]; 2178 const ConformanceTestInterfaceMethod5RequestVersions: [(u32, u32); 1] = [(0, 24) ];
1841 2179
1842 // Struct definition 2180 // Struct definition
1843 pub struct ConformanceTestInterfaceMethod2Request { 2181 pub struct ConformanceTestInterfaceMethod5Request {
1844 pub param0: StructB, 2182 pub param0: StructE,
1845 pub param1: StructA, 2183 pub param1: system::data_pipe::Producer<u8>,
1846 } 2184 }
1847 2185
1848 impl MojomPointer for ConformanceTestInterfaceMethod2Request { 2186 impl MojomPointer for ConformanceTestInterfaceMethod5Request {
1849 fn header_data(&self) -> DataHeaderValue { 2187 fn header_data(&self) -> DataHeaderValue {
1850 DataHeaderValue::Version(0) 2188 DataHeaderValue::Version(0)
1851 } 2189 }
1852 fn serialized_size(&self, _context: &Context) -> usize { 2190 fn serialized_size(&self, _context: &Context) -> usize {
1853 24 2191 24
1854 } 2192 }
1855 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2193 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1856 MojomEncodable::encode(self.param0, encoder, context.clone()); 2194 MojomEncodable::encode(self.param0, encoder, context.clone());
1857 MojomEncodable::encode(self.param1, encoder, context.clone()); 2195 MojomEncodable::encode(self.param1, encoder, context.clone());
1858 2196
1859 } 2197 }
1860 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2198 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1861 // TODO(mknyszek): Validate bytes and version 2199 let version = {
1862 let (_bytes, version) = {
1863 let mut state = decoder.get_mut(&context); 2200 let mut state = decoder.get_mut(&context);
1864 let bytes = state.decode::<u32>(); 2201 match state.decode_struct_header(&ConformanceTestInterfaceMethod5Req uestVersions) {
1865 let version = state.decode::<u32>(); 2202 Ok(header) => header.data(),
1866 (bytes, version) 2203 Err(err) => return Err(err),
2204 }
1867 }; 2205 };
1868 let param0 = StructB::decode(decoder, context.clone()); 2206 let param0 = match StructE::decode(decoder, context.clone()) {
1869 let param1 = StructA::decode(decoder, context.clone()); 2207 Ok(value) => value,
1870 ConformanceTestInterfaceMethod2Request { 2208 Err(err) => return Err(err),
2209 };
2210 let param1 = match system::data_pipe::Producer::<u8>::decode(decoder, co ntext.clone()) {
2211 Ok(value) => value,
2212 Err(err) => return Err(err),
2213 };
2214 Ok(ConformanceTestInterfaceMethod5Request {
1871 param0: param0, 2215 param0: param0,
1872 param1: param1, 2216 param1: param1,
1873 } 2217 })
1874 } 2218 }
1875 } 2219 }
1876 2220
1877 impl MojomEncodable for ConformanceTestInterfaceMethod2Request { 2221 impl MojomEncodable for ConformanceTestInterfaceMethod5Request {
1878 impl_encodable_for_pointer!(); 2222 impl_encodable_for_pointer!();
1879 fn compute_size(&self, context: Context) -> usize { 2223 fn compute_size(&self, context: Context) -> usize {
1880 encoding::align_default(self.serialized_size(&context)) + 2224 encoding::align_default(self.serialized_size(&context)) +
1881 self.param0.compute_size(context.clone()) + 2225 self.param0.compute_size(context.clone()) +
1882 self.param1.compute_size(context.clone()) 2226 self.param1.compute_size(context.clone())
1883 } 2227 }
1884 } 2228 }
1885 2229
1886 impl MojomStruct for ConformanceTestInterfaceMethod2Request {} 2230 impl MojomStruct for ConformanceTestInterfaceMethod5Request {}
1887 impl MojomMessage for ConformanceTestInterfaceMethod2Request { 2231 impl MojomMessage for ConformanceTestInterfaceMethod5Request {
1888 fn create_header() -> MessageHeader { 2232 fn create_header() -> MessageHeader {
1889 MessageHeader::new(ConformanceTestInterface::VERSION, 2233 MessageHeader::new(ConformanceTestInterface::VERSION,
1890 ConformanceTestInterfaceMethod2::ORDINAL, 2234 ConformanceTestInterfaceMethod5::ORDINAL,
1891 message::MESSAGE_HEADER_NO_FLAG) 2235 message::MESSAGE_HEADER_NO_FLAG)
1892 2236
1893 } 2237 }
1894 } 2238 }
1895 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod2Request {} 2239 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod5Request {}
1896 2240
1897 /// Message: ConformanceTestInterfaceMethod9 2241 /// Message: ConformanceTestInterfaceMethod6
1898 pub mod ConformanceTestInterfaceMethod9 { 2242 pub mod ConformanceTestInterfaceMethod6 {
1899 pub const ORDINAL: u32 = 9; 2243 pub const ORDINAL: u32 = 6;
1900 pub const MIN_VERSION: u32 = 0; 2244 pub const MIN_VERSION: u32 = 0;
1901 } 2245 }
1902 // -- ConformanceTestInterfaceMethod9Request -- 2246 // -- ConformanceTestInterfaceMethod6Request --
1903 2247
1904 // Constants 2248 // Constants
1905 // Enums 2249 // Enums
1906 // Struct version information 2250 // Struct version information
1907 const ConformanceTestInterfaceMethod9RequestVersions: [(u32, u32); 1] = [(0, 16) ]; 2251 const ConformanceTestInterfaceMethod6RequestVersions: [(u32, u32); 1] = [(0, 16) ];
1908 2252
1909 // Struct definition 2253 // Struct definition
1910 pub struct ConformanceTestInterfaceMethod9Request { 2254 pub struct ConformanceTestInterfaceMethod6Request {
1911 pub param0: Option<Vec<Vec<Option<system::UntypedHandle>>>>, 2255 pub param0: Vec<Vec<u8>>,
1912 } 2256 }
1913 2257
1914 impl MojomPointer for ConformanceTestInterfaceMethod9Request { 2258 impl MojomPointer for ConformanceTestInterfaceMethod6Request {
1915 fn header_data(&self) -> DataHeaderValue { 2259 fn header_data(&self) -> DataHeaderValue {
1916 DataHeaderValue::Version(0) 2260 DataHeaderValue::Version(0)
1917 } 2261 }
1918 fn serialized_size(&self, _context: &Context) -> usize { 2262 fn serialized_size(&self, _context: &Context) -> usize {
1919 16 2263 16
1920 } 2264 }
1921 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2265 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1922 MojomEncodable::encode(self.param0, encoder, context.clone()); 2266 MojomEncodable::encode(self.param0, encoder, context.clone());
1923 2267
1924 } 2268 }
1925 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2269 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1926 // TODO(mknyszek): Validate bytes and version 2270 let version = {
1927 let (_bytes, version) = {
1928 let mut state = decoder.get_mut(&context); 2271 let mut state = decoder.get_mut(&context);
1929 let bytes = state.decode::<u32>(); 2272 match state.decode_struct_header(&ConformanceTestInterfaceMethod6Req uestVersions) {
1930 let version = state.decode::<u32>(); 2273 Ok(header) => header.data(),
1931 (bytes, version) 2274 Err(err) => return Err(err),
2275 }
1932 }; 2276 };
1933 let param0 = Option::<Vec<Vec<Option<system::UntypedHandle>>>>::decode(d ecoder, 2277 let param0 = match Vec::<Vec<u8>>::decode(decoder, context.clone()) {
1934 c ontext.clone()); 2278 Ok(value) => value,
1935 ConformanceTestInterfaceMethod9Request { param0: param0 } 2279 Err(err) => return Err(err),
2280 };
2281 Ok(ConformanceTestInterfaceMethod6Request { param0: param0 })
1936 } 2282 }
1937 } 2283 }
1938 2284
1939 impl MojomEncodable for ConformanceTestInterfaceMethod9Request { 2285 impl MojomEncodable for ConformanceTestInterfaceMethod6Request {
1940 impl_encodable_for_pointer!(); 2286 impl_encodable_for_pointer!();
1941 fn compute_size(&self, context: Context) -> usize { 2287 fn compute_size(&self, context: Context) -> usize {
1942 encoding::align_default(self.serialized_size(&context)) + 2288 encoding::align_default(self.serialized_size(&context)) +
1943 self.param0.compute_size(context.clone()) 2289 self.param0.compute_size(context.clone())
1944 } 2290 }
1945 } 2291 }
1946 2292
1947 impl MojomStruct for ConformanceTestInterfaceMethod9Request {} 2293 impl MojomStruct for ConformanceTestInterfaceMethod6Request {}
1948 impl MojomMessage for ConformanceTestInterfaceMethod9Request { 2294 impl MojomMessage for ConformanceTestInterfaceMethod6Request {
1949 fn create_header() -> MessageHeader { 2295 fn create_header() -> MessageHeader {
1950 MessageHeader::new(ConformanceTestInterface::VERSION, 2296 MessageHeader::new(ConformanceTestInterface::VERSION,
1951 ConformanceTestInterfaceMethod9::ORDINAL, 2297 ConformanceTestInterfaceMethod6::ORDINAL,
1952 message::MESSAGE_HEADER_NO_FLAG) 2298 message::MESSAGE_HEADER_NO_FLAG)
1953 2299
1954 } 2300 }
1955 } 2301 }
1956 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod9Request {} 2302 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod6Request {}
1957 2303
1958 /// Message: ConformanceTestInterfaceMethod11 2304 /// Message: ConformanceTestInterfaceMethod8
1959 pub mod ConformanceTestInterfaceMethod11 { 2305 pub mod ConformanceTestInterfaceMethod8 {
1960 pub const ORDINAL: u32 = 11; 2306 pub const ORDINAL: u32 = 8;
1961 pub const MIN_VERSION: u32 = 0; 2307 pub const MIN_VERSION: u32 = 0;
1962 } 2308 }
1963 // -- ConformanceTestInterfaceMethod11Request -- 2309 // -- ConformanceTestInterfaceMethod8Request --
1964 2310
1965 // Constants 2311 // Constants
1966 // Enums 2312 // Enums
1967 // Struct version information 2313 // Struct version information
1968 const ConformanceTestInterfaceMethod11RequestVersions: [(u32, u32); 1] = [(0, 16 )]; 2314 const ConformanceTestInterfaceMethod8RequestVersions: [(u32, u32); 1] = [(0, 16) ];
1969 2315
1970 // Struct definition 2316 // Struct definition
1971 pub struct ConformanceTestInterfaceMethod11Request { 2317 pub struct ConformanceTestInterfaceMethod8Request {
1972 pub param0: StructG, 2318 pub param0: Vec<Option<Vec<String>>>,
1973 } 2319 }
1974 2320
1975 impl MojomPointer for ConformanceTestInterfaceMethod11Request { 2321 impl MojomPointer for ConformanceTestInterfaceMethod8Request {
1976 fn header_data(&self) -> DataHeaderValue { 2322 fn header_data(&self) -> DataHeaderValue {
1977 DataHeaderValue::Version(0) 2323 DataHeaderValue::Version(0)
1978 } 2324 }
1979 fn serialized_size(&self, _context: &Context) -> usize { 2325 fn serialized_size(&self, _context: &Context) -> usize {
1980 16 2326 16
1981 } 2327 }
1982 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2328 fn encode_value(self, encoder: &mut Encoder, context: Context) {
1983 MojomEncodable::encode(self.param0, encoder, context.clone()); 2329 MojomEncodable::encode(self.param0, encoder, context.clone());
1984 2330
1985 } 2331 }
1986 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2332 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
1987 // TODO(mknyszek): Validate bytes and version 2333 let version = {
1988 let (_bytes, version) = {
1989 let mut state = decoder.get_mut(&context); 2334 let mut state = decoder.get_mut(&context);
1990 let bytes = state.decode::<u32>(); 2335 match state.decode_struct_header(&ConformanceTestInterfaceMethod8Req uestVersions) {
1991 let version = state.decode::<u32>(); 2336 Ok(header) => header.data(),
1992 (bytes, version) 2337 Err(err) => return Err(err),
2338 }
1993 }; 2339 };
1994 let param0 = StructG::decode(decoder, context.clone()); 2340 let param0 = match Vec::<Option<Vec<String>>>::decode(decoder, context.c lone()) {
1995 ConformanceTestInterfaceMethod11Request { param0: param0 } 2341 Ok(value) => value,
2342 Err(err) => return Err(err),
2343 };
2344 Ok(ConformanceTestInterfaceMethod8Request { param0: param0 })
1996 } 2345 }
1997 } 2346 }
1998 2347
1999 impl MojomEncodable for ConformanceTestInterfaceMethod11Request { 2348 impl MojomEncodable for ConformanceTestInterfaceMethod8Request {
2000 impl_encodable_for_pointer!(); 2349 impl_encodable_for_pointer!();
2001 fn compute_size(&self, context: Context) -> usize { 2350 fn compute_size(&self, context: Context) -> usize {
2002 encoding::align_default(self.serialized_size(&context)) + 2351 encoding::align_default(self.serialized_size(&context)) +
2003 self.param0.compute_size(context.clone()) 2352 self.param0.compute_size(context.clone())
2004 } 2353 }
2005 } 2354 }
2006 2355
2007 impl MojomStruct for ConformanceTestInterfaceMethod11Request {} 2356 impl MojomStruct for ConformanceTestInterfaceMethod8Request {}
2008 impl MojomMessage for ConformanceTestInterfaceMethod11Request { 2357 impl MojomMessage for ConformanceTestInterfaceMethod8Request {
2009 fn create_header() -> MessageHeader { 2358 fn create_header() -> MessageHeader {
2010 MessageHeader::new(ConformanceTestInterface::VERSION, 2359 MessageHeader::new(ConformanceTestInterface::VERSION,
2011 ConformanceTestInterfaceMethod11::ORDINAL, 2360 ConformanceTestInterfaceMethod8::ORDINAL,
2012 message::MESSAGE_HEADER_NO_FLAG) 2361 message::MESSAGE_HEADER_NO_FLAG)
2013 2362
2014 } 2363 }
2015 } 2364 }
2016 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod11Request {} 2365 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod8Request {}
2017 2366
2018 /// Message: ConformanceTestInterfaceMethod13 2367 /// Message: ConformanceTestInterfaceMethod13
2019 pub mod ConformanceTestInterfaceMethod13 { 2368 pub mod ConformanceTestInterfaceMethod13 {
2020 pub const ORDINAL: u32 = 13; 2369 pub const ORDINAL: u32 = 13;
2021 pub const MIN_VERSION: u32 = 0; 2370 pub const MIN_VERSION: u32 = 0;
2022 } 2371 }
2023 // -- ConformanceTestInterfaceMethod13Request -- 2372 // -- ConformanceTestInterfaceMethod13Request --
2024 2373
2025 // Constants 2374 // Constants
2026 // Enums 2375 // Enums
(...skipping 13 matching lines...) Expand all
2040 } 2389 }
2041 fn serialized_size(&self, _context: &Context) -> usize { 2390 fn serialized_size(&self, _context: &Context) -> usize {
2042 32 2391 32
2043 } 2392 }
2044 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2393 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2045 MojomEncodable::encode(self.param0, encoder, context.clone()); 2394 MojomEncodable::encode(self.param0, encoder, context.clone());
2046 MojomEncodable::encode(self.param1, encoder, context.clone()); 2395 MojomEncodable::encode(self.param1, encoder, context.clone());
2047 MojomEncodable::encode(self.param2, encoder, context.clone()); 2396 MojomEncodable::encode(self.param2, encoder, context.clone());
2048 2397
2049 } 2398 }
2050 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2399 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2051 // TODO(mknyszek): Validate bytes and version 2400 let version = {
2052 let (_bytes, version) = {
2053 let mut state = decoder.get_mut(&context); 2401 let mut state = decoder.get_mut(&context);
2054 let bytes = state.decode::<u32>(); 2402 match state.decode_struct_header(&ConformanceTestInterfaceMethod13Re questVersions) {
2055 let version = state.decode::<u32>(); 2403 Ok(header) => header.data(),
2056 (bytes, version) 2404 Err(err) => return Err(err),
2405 }
2057 }; 2406 };
2058 let param0 = Option::<InterfaceAClient>::decode(decoder, context.clone() ); 2407 let param0 = match Option::<InterfaceAClient>::decode(decoder, context.c lone()) {
2059 let param1 = u32::decode(decoder, context.clone()); 2408 Ok(value) => value,
2060 let param2 = Option::<InterfaceAClient>::decode(decoder, context.clone() ); 2409 Err(err) => return Err(err),
2061 ConformanceTestInterfaceMethod13Request { 2410 };
2411 let param1 = match u32::decode(decoder, context.clone()) {
2412 Ok(value) => value,
2413 Err(err) => return Err(err),
2414 };
2415 let param2 = match Option::<InterfaceAClient>::decode(decoder, context.c lone()) {
2416 Ok(value) => value,
2417 Err(err) => return Err(err),
2418 };
2419 Ok(ConformanceTestInterfaceMethod13Request {
2062 param0: param0, 2420 param0: param0,
2063 param1: param1, 2421 param1: param1,
2064 param2: param2, 2422 param2: param2,
2065 } 2423 })
2066 } 2424 }
2067 } 2425 }
2068 2426
2069 impl MojomEncodable for ConformanceTestInterfaceMethod13Request { 2427 impl MojomEncodable for ConformanceTestInterfaceMethod13Request {
2070 impl_encodable_for_pointer!(); 2428 impl_encodable_for_pointer!();
2071 fn compute_size(&self, context: Context) -> usize { 2429 fn compute_size(&self, context: Context) -> usize {
2072 encoding::align_default(self.serialized_size(&context)) + 2430 encoding::align_default(self.serialized_size(&context)) +
2073 self.param0.compute_size(context.clone()) + 2431 self.param0.compute_size(context.clone()) +
2074 self.param1.compute_size(context.clone()) + 2432 self.param1.compute_size(context.clone()) +
2075 self.param2.compute_size(context.clone()) 2433 self.param2.compute_size(context.clone())
2076 } 2434 }
2077 } 2435 }
2078 2436
2079 impl MojomStruct for ConformanceTestInterfaceMethod13Request {} 2437 impl MojomStruct for ConformanceTestInterfaceMethod13Request {}
2080 impl MojomMessage for ConformanceTestInterfaceMethod13Request { 2438 impl MojomMessage for ConformanceTestInterfaceMethod13Request {
2081 fn create_header() -> MessageHeader { 2439 fn create_header() -> MessageHeader {
2082 MessageHeader::new(ConformanceTestInterface::VERSION, 2440 MessageHeader::new(ConformanceTestInterface::VERSION,
2083 ConformanceTestInterfaceMethod13::ORDINAL, 2441 ConformanceTestInterfaceMethod13::ORDINAL,
2084 message::MESSAGE_HEADER_NO_FLAG) 2442 message::MESSAGE_HEADER_NO_FLAG)
2085 2443
2086 } 2444 }
2087 } 2445 }
2088 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod13Request {} 2446 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod13Request {}
2089 2447
2090 /// Message: ConformanceTestInterfaceMethod3 2448 /// Message: ConformanceTestInterfaceMethod2
2091 pub mod ConformanceTestInterfaceMethod3 { 2449 pub mod ConformanceTestInterfaceMethod2 {
2092 pub const ORDINAL: u32 = 3; 2450 pub const ORDINAL: u32 = 2;
2093 pub const MIN_VERSION: u32 = 0; 2451 pub const MIN_VERSION: u32 = 0;
2094 } 2452 }
2095 // -- ConformanceTestInterfaceMethod3Request -- 2453 // -- ConformanceTestInterfaceMethod2Request --
2096 2454
2097 // Constants 2455 // Constants
2098 // Enums 2456 // Enums
2099 // Struct version information 2457 // Struct version information
2100 const ConformanceTestInterfaceMethod3RequestVersions: [(u32, u32); 1] = [(0, 16) ]; 2458 const ConformanceTestInterfaceMethod2RequestVersions: [(u32, u32); 1] = [(0, 24) ];
2101 2459
2102 // Struct definition 2460 // Struct definition
2103 pub struct ConformanceTestInterfaceMethod3Request { 2461 pub struct ConformanceTestInterfaceMethod2Request {
2104 pub param0: Vec<bool>, 2462 pub param0: StructB,
2463 pub param1: StructA,
2105 } 2464 }
2106 2465
2107 impl MojomPointer for ConformanceTestInterfaceMethod3Request { 2466 impl MojomPointer for ConformanceTestInterfaceMethod2Request {
2108 fn header_data(&self) -> DataHeaderValue { 2467 fn header_data(&self) -> DataHeaderValue {
2109 DataHeaderValue::Version(0) 2468 DataHeaderValue::Version(0)
2110 } 2469 }
2111 fn serialized_size(&self, _context: &Context) -> usize { 2470 fn serialized_size(&self, _context: &Context) -> usize {
2112 16 2471 24
2113 } 2472 }
2114 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2473 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2115 MojomEncodable::encode(self.param0, encoder, context.clone()); 2474 MojomEncodable::encode(self.param0, encoder, context.clone());
2475 MojomEncodable::encode(self.param1, encoder, context.clone());
2116 2476
2117 } 2477 }
2118 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2478 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2119 // TODO(mknyszek): Validate bytes and version 2479 let version = {
2120 let (_bytes, version) = {
2121 let mut state = decoder.get_mut(&context); 2480 let mut state = decoder.get_mut(&context);
2122 let bytes = state.decode::<u32>(); 2481 match state.decode_struct_header(&ConformanceTestInterfaceMethod2Req uestVersions) {
2123 let version = state.decode::<u32>(); 2482 Ok(header) => header.data(),
2124 (bytes, version) 2483 Err(err) => return Err(err),
2484 }
2125 }; 2485 };
2126 let param0 = Vec::<bool>::decode(decoder, context.clone()); 2486 let param0 = match StructB::decode(decoder, context.clone()) {
2127 ConformanceTestInterfaceMethod3Request { param0: param0 } 2487 Ok(value) => value,
2488 Err(err) => return Err(err),
2489 };
2490 let param1 = match StructA::decode(decoder, context.clone()) {
2491 Ok(value) => value,
2492 Err(err) => return Err(err),
2493 };
2494 Ok(ConformanceTestInterfaceMethod2Request {
2495 param0: param0,
2496 param1: param1,
2497 })
2128 } 2498 }
2129 } 2499 }
2130 2500
2131 impl MojomEncodable for ConformanceTestInterfaceMethod3Request { 2501 impl MojomEncodable for ConformanceTestInterfaceMethod2Request {
2132 impl_encodable_for_pointer!(); 2502 impl_encodable_for_pointer!();
2133 fn compute_size(&self, context: Context) -> usize { 2503 fn compute_size(&self, context: Context) -> usize {
2134 encoding::align_default(self.serialized_size(&context)) + 2504 encoding::align_default(self.serialized_size(&context)) +
2135 self.param0.compute_size(context.clone()) 2505 self.param0.compute_size(context.clone()) +
2506 self.param1.compute_size(context.clone())
2136 } 2507 }
2137 } 2508 }
2138 2509
2139 impl MojomStruct for ConformanceTestInterfaceMethod3Request {} 2510 impl MojomStruct for ConformanceTestInterfaceMethod2Request {}
2140 impl MojomMessage for ConformanceTestInterfaceMethod3Request { 2511 impl MojomMessage for ConformanceTestInterfaceMethod2Request {
2141 fn create_header() -> MessageHeader { 2512 fn create_header() -> MessageHeader {
2142 MessageHeader::new(ConformanceTestInterface::VERSION, 2513 MessageHeader::new(ConformanceTestInterface::VERSION,
2143 ConformanceTestInterfaceMethod3::ORDINAL, 2514 ConformanceTestInterfaceMethod2::ORDINAL,
2144 message::MESSAGE_HEADER_NO_FLAG) 2515 message::MESSAGE_HEADER_NO_FLAG)
2145 2516
2146 } 2517 }
2147 } 2518 }
2148 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod3Request {} 2519 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod2Request {}
2149 2520
2150 /// Message: ConformanceTestInterfaceMethod5 2521 /// Message: ConformanceTestInterfaceMethod4
2151 pub mod ConformanceTestInterfaceMethod5 { 2522 pub mod ConformanceTestInterfaceMethod4 {
2152 pub const ORDINAL: u32 = 5; 2523 pub const ORDINAL: u32 = 4;
2153 pub const MIN_VERSION: u32 = 0; 2524 pub const MIN_VERSION: u32 = 0;
2154 } 2525 }
2155 // -- ConformanceTestInterfaceMethod5Request -- 2526 // -- ConformanceTestInterfaceMethod4Request --
2156 2527
2157 // Constants 2528 // Constants
2158 // Enums 2529 // Enums
2159 // Struct version information 2530 // Struct version information
2160 const ConformanceTestInterfaceMethod5RequestVersions: [(u32, u32); 1] = [(0, 24) ]; 2531 const ConformanceTestInterfaceMethod4RequestVersions: [(u32, u32); 1] = [(0, 24) ];
2161 2532
2162 // Struct definition 2533 // Struct definition
2163 pub struct ConformanceTestInterfaceMethod5Request { 2534 pub struct ConformanceTestInterfaceMethod4Request {
2164 pub param0: StructE, 2535 pub param0: StructC,
2165 pub param1: system::data_pipe::Producer<u8>, 2536 pub param1: Vec<u8>,
2166 } 2537 }
2167 2538
2168 impl MojomPointer for ConformanceTestInterfaceMethod5Request { 2539 impl MojomPointer for ConformanceTestInterfaceMethod4Request {
2169 fn header_data(&self) -> DataHeaderValue { 2540 fn header_data(&self) -> DataHeaderValue {
2170 DataHeaderValue::Version(0) 2541 DataHeaderValue::Version(0)
2171 } 2542 }
2172 fn serialized_size(&self, _context: &Context) -> usize { 2543 fn serialized_size(&self, _context: &Context) -> usize {
2173 24 2544 24
2174 } 2545 }
2175 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2546 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2176 MojomEncodable::encode(self.param0, encoder, context.clone()); 2547 MojomEncodable::encode(self.param0, encoder, context.clone());
2177 MojomEncodable::encode(self.param1, encoder, context.clone()); 2548 MojomEncodable::encode(self.param1, encoder, context.clone());
2178 2549
2179 } 2550 }
2180 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2551 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2181 // TODO(mknyszek): Validate bytes and version 2552 let version = {
2182 let (_bytes, version) = {
2183 let mut state = decoder.get_mut(&context); 2553 let mut state = decoder.get_mut(&context);
2184 let bytes = state.decode::<u32>(); 2554 match state.decode_struct_header(&ConformanceTestInterfaceMethod4Req uestVersions) {
2185 let version = state.decode::<u32>(); 2555 Ok(header) => header.data(),
2186 (bytes, version) 2556 Err(err) => return Err(err),
2557 }
2187 }; 2558 };
2188 let param0 = StructE::decode(decoder, context.clone()); 2559 let param0 = match StructC::decode(decoder, context.clone()) {
2189 let param1 = system::data_pipe::Producer::<u8>::decode(decoder, context. clone()); 2560 Ok(value) => value,
2190 ConformanceTestInterfaceMethod5Request { 2561 Err(err) => return Err(err),
2562 };
2563 let param1 = match Vec::<u8>::decode(decoder, context.clone()) {
2564 Ok(value) => value,
2565 Err(err) => return Err(err),
2566 };
2567 Ok(ConformanceTestInterfaceMethod4Request {
2191 param0: param0, 2568 param0: param0,
2192 param1: param1, 2569 param1: param1,
2193 } 2570 })
2194 } 2571 }
2195 } 2572 }
2196 2573
2197 impl MojomEncodable for ConformanceTestInterfaceMethod5Request { 2574 impl MojomEncodable for ConformanceTestInterfaceMethod4Request {
2198 impl_encodable_for_pointer!(); 2575 impl_encodable_for_pointer!();
2199 fn compute_size(&self, context: Context) -> usize { 2576 fn compute_size(&self, context: Context) -> usize {
2200 encoding::align_default(self.serialized_size(&context)) + 2577 encoding::align_default(self.serialized_size(&context)) +
2201 self.param0.compute_size(context.clone()) + 2578 self.param0.compute_size(context.clone()) +
2202 self.param1.compute_size(context.clone()) 2579 self.param1.compute_size(context.clone())
2203 } 2580 }
2204 } 2581 }
2205 2582
2206 impl MojomStruct for ConformanceTestInterfaceMethod5Request {} 2583 impl MojomStruct for ConformanceTestInterfaceMethod4Request {}
2207 impl MojomMessage for ConformanceTestInterfaceMethod5Request { 2584 impl MojomMessage for ConformanceTestInterfaceMethod4Request {
2208 fn create_header() -> MessageHeader { 2585 fn create_header() -> MessageHeader {
2209 MessageHeader::new(ConformanceTestInterface::VERSION, 2586 MessageHeader::new(ConformanceTestInterface::VERSION,
2210 ConformanceTestInterfaceMethod5::ORDINAL, 2587 ConformanceTestInterfaceMethod4::ORDINAL,
2211 message::MESSAGE_HEADER_NO_FLAG) 2588 message::MESSAGE_HEADER_NO_FLAG)
2212 2589
2213 } 2590 }
2214 } 2591 }
2215 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod5Request {} 2592 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod4Request {}
2593
2594 /// Message: ConformanceTestInterfaceMethod7
2595 pub mod ConformanceTestInterfaceMethod7 {
2596 pub const ORDINAL: u32 = 7;
2597 pub const MIN_VERSION: u32 = 0;
2598 }
2599 // -- ConformanceTestInterfaceMethod7Request --
2600
2601 // Constants
2602 // Enums
2603 // Struct version information
2604 const ConformanceTestInterfaceMethod7RequestVersions: [(u32, u32); 1] = [(0, 24) ];
2605
2606 // Struct definition
2607 pub struct ConformanceTestInterfaceMethod7Request {
2608 pub param0: StructF,
2609 pub param1: Box<[Option<Box<[u8; 3]>>; 2]>,
2610 }
2611
2612 impl MojomPointer for ConformanceTestInterfaceMethod7Request {
2613 fn header_data(&self) -> DataHeaderValue {
2614 DataHeaderValue::Version(0)
2615 }
2616 fn serialized_size(&self, _context: &Context) -> usize {
2617 24
2618 }
2619 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2620 MojomEncodable::encode(self.param0, encoder, context.clone());
2621 MojomEncodable::encode(self.param1, encoder, context.clone());
2622
2623 }
2624 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2625 let version = {
2626 let mut state = decoder.get_mut(&context);
2627 match state.decode_struct_header(&ConformanceTestInterfaceMethod7Req uestVersions) {
2628 Ok(header) => header.data(),
2629 Err(err) => return Err(err),
2630 }
2631 };
2632 let param0 = match StructF::decode(decoder, context.clone()) {
2633 Ok(value) => value,
2634 Err(err) => return Err(err),
2635 };
2636 let param1 = match Box::<[Option<Box<[u8; 3]>>; 2]>::decode(decoder, con text.clone()) {
2637 Ok(value) => value,
2638 Err(err) => return Err(err),
2639 };
2640 Ok(ConformanceTestInterfaceMethod7Request {
2641 param0: param0,
2642 param1: param1,
2643 })
2644 }
2645 }
2646
2647 impl MojomEncodable for ConformanceTestInterfaceMethod7Request {
2648 impl_encodable_for_pointer!();
2649 fn compute_size(&self, context: Context) -> usize {
2650 encoding::align_default(self.serialized_size(&context)) +
2651 self.param0.compute_size(context.clone()) +
2652 self.param1.compute_size(context.clone())
2653 }
2654 }
2655
2656 impl MojomStruct for ConformanceTestInterfaceMethod7Request {}
2657 impl MojomMessage for ConformanceTestInterfaceMethod7Request {
2658 fn create_header() -> MessageHeader {
2659 MessageHeader::new(ConformanceTestInterface::VERSION,
2660 ConformanceTestInterfaceMethod7::ORDINAL,
2661 message::MESSAGE_HEADER_NO_FLAG)
2662
2663 }
2664 }
2665 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod7Request {}
2216 2666
2217 /// Message: ConformanceTestInterfaceMethod10 2667 /// Message: ConformanceTestInterfaceMethod10
2218 pub mod ConformanceTestInterfaceMethod10 { 2668 pub mod ConformanceTestInterfaceMethod10 {
2219 pub const ORDINAL: u32 = 10; 2669 pub const ORDINAL: u32 = 10;
2220 pub const MIN_VERSION: u32 = 0; 2670 pub const MIN_VERSION: u32 = 0;
2221 } 2671 }
2222 // -- ConformanceTestInterfaceMethod10Request -- 2672 // -- ConformanceTestInterfaceMethod10Request --
2223 2673
2224 // Constants 2674 // Constants
2225 // Enums 2675 // Enums
2226 // Struct version information 2676 // Struct version information
2227 const ConformanceTestInterfaceMethod10RequestVersions: [(u32, u32); 1] = [(0, 16 )]; 2677 const ConformanceTestInterfaceMethod10RequestVersions: [(u32, u32); 1] = [(0, 16 )];
2228 2678
2229 // Struct definition 2679 // Struct definition
2230 pub struct ConformanceTestInterfaceMethod10Request { 2680 pub struct ConformanceTestInterfaceMethod10Request {
2231 pub param0: HashMap<String, u8>, 2681 pub param0: HashMap<String, u8>,
2232 } 2682 }
2233 2683
2234 impl MojomPointer for ConformanceTestInterfaceMethod10Request { 2684 impl MojomPointer for ConformanceTestInterfaceMethod10Request {
2235 fn header_data(&self) -> DataHeaderValue { 2685 fn header_data(&self) -> DataHeaderValue {
2236 DataHeaderValue::Version(0) 2686 DataHeaderValue::Version(0)
2237 } 2687 }
2238 fn serialized_size(&self, _context: &Context) -> usize {
2239 16
2240 }
2241 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2242 MojomEncodable::encode(self.param0, encoder, context.clone());
2243
2244 }
2245 fn decode_value(decoder: &mut Decoder, context: Context) -> Self {
2246 // TODO(mknyszek): Validate bytes and version
2247 let (_bytes, version) = {
2248 let mut state = decoder.get_mut(&context);
2249 let bytes = state.decode::<u32>();
2250 let version = state.decode::<u32>();
2251 (bytes, version)
2252 };
2253 let param0 = HashMap::<String, u8>::decode(decoder, context.clone());
2254 ConformanceTestInterfaceMethod10Request { param0: param0 }
2255 }
2256 }
2257
2258 impl MojomEncodable for ConformanceTestInterfaceMethod10Request {
2259 impl_encodable_for_pointer!();
2260 fn compute_size(&self, context: Context) -> usize {
2261 encoding::align_default(self.serialized_size(&context)) +
2262 self.param0.compute_size(context.clone())
2263 }
2264 }
2265
2266 impl MojomStruct for ConformanceTestInterfaceMethod10Request {}
2267 impl MojomMessage for ConformanceTestInterfaceMethod10Request {
2268 fn create_header() -> MessageHeader {
2269 MessageHeader::new(ConformanceTestInterface::VERSION,
2270 ConformanceTestInterfaceMethod10::ORDINAL,
2271 message::MESSAGE_HEADER_NO_FLAG)
2272
2273 }
2274 }
2275 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod10Request {}
2276
2277 /// Message: ConformanceTestInterfaceMethod12
2278 pub mod ConformanceTestInterfaceMethod12 {
2279 pub const ORDINAL: u32 = 12;
2280 pub const MIN_VERSION: u32 = 0;
2281 }
2282 // -- ConformanceTestInterfaceMethod12Request --
2283
2284 // Constants
2285 // Enums
2286 // Struct version information
2287 const ConformanceTestInterfaceMethod12RequestVersions: [(u32, u32); 1] = [(0, 16 )];
2288
2289 // Struct definition
2290 pub struct ConformanceTestInterfaceMethod12Request {
2291 pub param0: f32,
2292 }
2293
2294 impl MojomPointer for ConformanceTestInterfaceMethod12Request {
2295 fn header_data(&self) -> DataHeaderValue {
2296 DataHeaderValue::Version(0)
2297 }
2298 fn serialized_size(&self, _context: &Context) -> usize { 2688 fn serialized_size(&self, _context: &Context) -> usize {
2299 16 2689 16
2300 } 2690 }
2301 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2691 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2302 MojomEncodable::encode(self.param0, encoder, context.clone()); 2692 MojomEncodable::encode(self.param0, encoder, context.clone());
2303 2693
2304 } 2694 }
2305 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2695 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2306 // TODO(mknyszek): Validate bytes and version 2696 let version = {
2307 let (_bytes, version) = {
2308 let mut state = decoder.get_mut(&context); 2697 let mut state = decoder.get_mut(&context);
2309 let bytes = state.decode::<u32>(); 2698 match state.decode_struct_header(&ConformanceTestInterfaceMethod10Re questVersions) {
2310 let version = state.decode::<u32>(); 2699 Ok(header) => header.data(),
2311 (bytes, version) 2700 Err(err) => return Err(err),
2701 }
2312 }; 2702 };
2313 let param0 = f32::decode(decoder, context.clone()); 2703 let param0 = match HashMap::<String, u8>::decode(decoder, context.clone( )) {
2314 ConformanceTestInterfaceMethod12Request { param0: param0 } 2704 Ok(value) => value,
2705 Err(err) => return Err(err),
2706 };
2707 Ok(ConformanceTestInterfaceMethod10Request { param0: param0 })
2315 } 2708 }
2316 } 2709 }
2317 2710
2318 impl MojomEncodable for ConformanceTestInterfaceMethod12Request { 2711 impl MojomEncodable for ConformanceTestInterfaceMethod10Request {
2319 impl_encodable_for_pointer!(); 2712 impl_encodable_for_pointer!();
2320 fn compute_size(&self, context: Context) -> usize { 2713 fn compute_size(&self, context: Context) -> usize {
2321 encoding::align_default(self.serialized_size(&context)) + 2714 encoding::align_default(self.serialized_size(&context)) +
2322 self.param0.compute_size(context.clone()) 2715 self.param0.compute_size(context.clone())
2323 } 2716 }
2324 } 2717 }
2325 2718
2326 impl MojomStruct for ConformanceTestInterfaceMethod12Request {} 2719 impl MojomStruct for ConformanceTestInterfaceMethod10Request {}
2327 impl MojomMessage for ConformanceTestInterfaceMethod12Request { 2720 impl MojomMessage for ConformanceTestInterfaceMethod10Request {
2328 fn create_header() -> MessageHeader { 2721 fn create_header() -> MessageHeader {
2329 MessageHeader::new(ConformanceTestInterface::VERSION, 2722 MessageHeader::new(ConformanceTestInterface::VERSION,
2330 ConformanceTestInterfaceMethod12::ORDINAL, 2723 ConformanceTestInterfaceMethod10::ORDINAL,
2331 message::MESSAGE_HEADER_EXPECT_RESPONSE) 2724 message::MESSAGE_HEADER_NO_FLAG)
2332 2725
2333 } 2726 }
2334 } 2727 }
2335 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod12Request {} 2728 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod10Request {}
2336 2729
2337 // -- ConformanceTestInterfaceMethod12Response -- 2730 /// Message: ConformanceTestInterfaceMethod14
2731 pub mod ConformanceTestInterfaceMethod14 {
2732 pub const ORDINAL: u32 = 14;
2733 pub const MIN_VERSION: u32 = 0;
2734 }
2735 // -- ConformanceTestInterfaceMethod14Request --
2338 2736
2339 // Constants 2737 // Constants
2340 // Enums 2738 // Enums
2341 // Struct version information 2739 // Struct version information
2342 const ConformanceTestInterfaceMethod12ResponseVersions: [(u32, u32); 1] = [(0, 1 6)]; 2740 const ConformanceTestInterfaceMethod14RequestVersions: [(u32, u32); 1] = [(0, 24 )];
2343 2741
2344 // Struct definition 2742 // Struct definition
2345 pub struct ConformanceTestInterfaceMethod12Response { 2743 pub struct ConformanceTestInterfaceMethod14Request {
2346 pub param0: f32, 2744 pub param0: UnionA,
2347 } 2745 }
2348 2746
2349 impl MojomPointer for ConformanceTestInterfaceMethod12Response { 2747 impl MojomPointer for ConformanceTestInterfaceMethod14Request {
2350 fn header_data(&self) -> DataHeaderValue { 2748 fn header_data(&self) -> DataHeaderValue {
2351 DataHeaderValue::Version(0) 2749 DataHeaderValue::Version(0)
2352 } 2750 }
2353 fn serialized_size(&self, _context: &Context) -> usize { 2751 fn serialized_size(&self, _context: &Context) -> usize {
2354 16 2752 24
2355 } 2753 }
2356 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2754 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2357 MojomEncodable::encode(self.param0, encoder, context.clone()); 2755 MojomEncodable::encode(self.param0, encoder, context.clone());
2358 2756
2359 } 2757 }
2360 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2758 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2361 // TODO(mknyszek): Validate bytes and version 2759 let version = {
2362 let (_bytes, version) = {
2363 let mut state = decoder.get_mut(&context); 2760 let mut state = decoder.get_mut(&context);
2364 let bytes = state.decode::<u32>(); 2761 match state.decode_struct_header(&ConformanceTestInterfaceMethod14Re questVersions) {
2365 let version = state.decode::<u32>(); 2762 Ok(header) => header.data(),
2366 (bytes, version) 2763 Err(err) => return Err(err),
2764 }
2367 }; 2765 };
2368 let param0 = f32::decode(decoder, context.clone()); 2766 let param0 = match UnionA::decode(decoder, context.clone()) {
2369 ConformanceTestInterfaceMethod12Response { param0: param0 } 2767 Ok(value) => value,
2768 Err(err) => return Err(err),
2769 };
2770 Ok(ConformanceTestInterfaceMethod14Request { param0: param0 })
2370 } 2771 }
2371 } 2772 }
2372 2773
2373 impl MojomEncodable for ConformanceTestInterfaceMethod12Response { 2774 impl MojomEncodable for ConformanceTestInterfaceMethod14Request {
2374 impl_encodable_for_pointer!(); 2775 impl_encodable_for_pointer!();
2375 fn compute_size(&self, context: Context) -> usize { 2776 fn compute_size(&self, context: Context) -> usize {
2376 encoding::align_default(self.serialized_size(&context)) + 2777 encoding::align_default(self.serialized_size(&context)) +
2377 self.param0.compute_size(context.clone()) 2778 self.param0.compute_size(context.clone())
2378 } 2779 }
2379 } 2780 }
2380 2781
2381 impl MojomStruct for ConformanceTestInterfaceMethod12Response {} 2782 impl MojomStruct for ConformanceTestInterfaceMethod14Request {}
2382 2783 impl MojomMessage for ConformanceTestInterfaceMethod14Request {
2383 impl MojomMessage for ConformanceTestInterfaceMethod12Response {
2384 fn create_header() -> MessageHeader { 2784 fn create_header() -> MessageHeader {
2385 MessageHeader::new(ConformanceTestInterface::VERSION, 2785 MessageHeader::new(ConformanceTestInterface::VERSION,
2386 ConformanceTestInterfaceMethod12::ORDINAL, 2786 ConformanceTestInterfaceMethod14::ORDINAL,
2387 message::MESSAGE_HEADER_IS_RESPONSE) 2787 message::MESSAGE_HEADER_NO_FLAG)
2788
2388 } 2789 }
2389 } 2790 }
2390 impl ConformanceTestInterfaceResponse for ConformanceTestInterfaceMethod12Reques t {} 2791 impl ConformanceTestInterfaceRequest for ConformanceTestInterfaceMethod14Request {}
2792
2793
2391 // --- IntegrationTestInterface --- 2794 // --- IntegrationTestInterface ---
2392 2795
2393 pub mod IntegrationTestInterface { 2796 pub mod IntegrationTestInterface {
2394 pub const SERVICE_NAME: &'static str = ""; 2797 pub const SERVICE_NAME: &'static str = "";
2395 pub const VERSION: u32 = 0; 2798 pub const VERSION: u32 = 0;
2396 } 2799 }
2397 2800
2398 pub struct IntegrationTestInterfaceClient { 2801 pub struct IntegrationTestInterfaceClient {
2399 pipe: message_pipe::MessageEndpoint, 2802 pipe: message_pipe::MessageEndpoint,
2400 } 2803 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 2891
2489 2892
2490 pub trait IntegrationTestInterfaceRequest: MojomMessage {} 2893 pub trait IntegrationTestInterfaceRequest: MojomMessage {}
2491 pub trait IntegrationTestInterfaceResponse: MojomMessage {} 2894 pub trait IntegrationTestInterfaceResponse: MojomMessage {}
2492 2895
2493 pub enum IntegrationTestInterfaceRequestOption { 2896 pub enum IntegrationTestInterfaceRequestOption {
2494 IntegrationTestInterfaceMethod0(IntegrationTestInterfaceMethod0Request), 2897 IntegrationTestInterfaceMethod0(IntegrationTestInterfaceMethod0Request),
2495 } 2898 }
2496 2899
2497 impl MojomMessageOption for IntegrationTestInterfaceRequestOption { 2900 impl MojomMessageOption for IntegrationTestInterfaceRequestOption {
2498 fn decode_payload(ordinal: u32, buffer: &mut [u8], handles: Vec<UntypedHandl e>) -> Self { 2901 fn decode_payload(header: MessageHeader,
2499 match ordinal { 2902 buffer: &mut [u8],
2500 IntegrationTestInterfaceMethod0::ORDINAL => IntegrationTestInterface RequestOption::IntegrationTestInterfaceMethod0(IntegrationTestInterfaceMethod0Re quest::deserialize(buffer, handles)), 2903 handles: Vec<UntypedHandle>)
2501 _ => panic!("Unknown message found: {}", ordinal), 2904 -> Result<Self, ValidationError> {
2905 match header.name {
2906 IntegrationTestInterfaceMethod0::ORDINAL => {
2907 if header.flags != message::MESSAGE_HEADER_EXPECT_RESPONSE {
2908 return Err(ValidationError::MessageHeaderInvalidFlags);
2909 }
2910 match IntegrationTestInterfaceMethod0Request::deserialize(buffer , handles) {
2911 Ok(value) => Ok(IntegrationTestInterfaceRequestOption::Integ rationTestInterfaceMethod0(value)),
2912 Err(err) => return Err(err),
2913 }
2914 }
2915 _ => Err(ValidationError::MessageHeaderUnknownMethod),
2502 } 2916 }
2503 } 2917 }
2504 } 2918 }
2505 2919
2506 pub enum IntegrationTestInterfaceResponseOption { 2920 pub enum IntegrationTestInterfaceResponseOption {
2507 IntegrationTestInterfaceMethod0(IntegrationTestInterfaceMethod0Response), 2921 IntegrationTestInterfaceMethod0(IntegrationTestInterfaceMethod0Response),
2508 } 2922 }
2509 2923
2510 impl MojomMessageOption for IntegrationTestInterfaceResponseOption { 2924 impl MojomMessageOption for IntegrationTestInterfaceResponseOption {
2511 fn decode_payload(ordinal: u32, buffer: &mut [u8], handles: Vec<UntypedHandl e>) -> Self { 2925 fn decode_payload(header: MessageHeader,
2512 match ordinal { 2926 buffer: &mut [u8],
2513 IntegrationTestInterfaceMethod0::ORDINAL => IntegrationTestInterface ResponseOption::IntegrationTestInterfaceMethod0(IntegrationTestInterfaceMethod0R esponse::deserialize(buffer, handles)), 2927 handles: Vec<UntypedHandle>)
2514 _ => { 2928 -> Result<Self, ValidationError> {
2515 panic!("Unknown message found, or message has no response: {}", 2929 if header.flags != message::MESSAGE_HEADER_IS_RESPONSE {
2516 ordinal) 2930 return Err(ValidationError::MessageHeaderInvalidFlags);
2931 }
2932 match header.name {
2933 IntegrationTestInterfaceMethod0::ORDINAL => {
2934 match IntegrationTestInterfaceMethod0Response::deserialize(buffe r, handles) {
2935 Ok(value) => Ok(IntegrationTestInterfaceResponseOption::Inte grationTestInterfaceMethod0(value)),
2936 Err(err) => return Err(err),
2937 }
2517 } 2938 }
2939 _ => Err(ValidationError::MessageHeaderUnknownMethod),
2518 } 2940 }
2519 } 2941 }
2520 } 2942 }
2521 2943
2522 /// Message: IntegrationTestInterfaceMethod0 2944 /// Message: IntegrationTestInterfaceMethod0
2523 pub mod IntegrationTestInterfaceMethod0 { 2945 pub mod IntegrationTestInterfaceMethod0 {
2524 pub const ORDINAL: u32 = 0; 2946 pub const ORDINAL: u32 = 0;
2525 pub const MIN_VERSION: u32 = 0; 2947 pub const MIN_VERSION: u32 = 0;
2526 } 2948 }
2527 // -- IntegrationTestInterfaceMethod0Request -- 2949 // -- IntegrationTestInterfaceMethod0Request --
(...skipping 12 matching lines...) Expand all
2540 fn header_data(&self) -> DataHeaderValue { 2962 fn header_data(&self) -> DataHeaderValue {
2541 DataHeaderValue::Version(0) 2963 DataHeaderValue::Version(0)
2542 } 2964 }
2543 fn serialized_size(&self, _context: &Context) -> usize { 2965 fn serialized_size(&self, _context: &Context) -> usize {
2544 16 2966 16
2545 } 2967 }
2546 fn encode_value(self, encoder: &mut Encoder, context: Context) { 2968 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2547 MojomEncodable::encode(self.param0, encoder, context.clone()); 2969 MojomEncodable::encode(self.param0, encoder, context.clone());
2548 2970
2549 } 2971 }
2550 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 2972 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2551 // TODO(mknyszek): Validate bytes and version 2973 let version = {
2552 let (_bytes, version) = {
2553 let mut state = decoder.get_mut(&context); 2974 let mut state = decoder.get_mut(&context);
2554 let bytes = state.decode::<u32>(); 2975 match state.decode_struct_header(&IntegrationTestInterfaceMethod0Req uestVersions) {
2555 let version = state.decode::<u32>(); 2976 Ok(header) => header.data(),
2556 (bytes, version) 2977 Err(err) => return Err(err),
2978 }
2557 }; 2979 };
2558 let param0 = BasicStruct::decode(decoder, context.clone()); 2980 let param0 = match BasicStruct::decode(decoder, context.clone()) {
2559 IntegrationTestInterfaceMethod0Request { param0: param0 } 2981 Ok(value) => value,
2982 Err(err) => return Err(err),
2983 };
2984 Ok(IntegrationTestInterfaceMethod0Request { param0: param0 })
2560 } 2985 }
2561 } 2986 }
2562 2987
2563 impl MojomEncodable for IntegrationTestInterfaceMethod0Request { 2988 impl MojomEncodable for IntegrationTestInterfaceMethod0Request {
2564 impl_encodable_for_pointer!(); 2989 impl_encodable_for_pointer!();
2565 fn compute_size(&self, context: Context) -> usize { 2990 fn compute_size(&self, context: Context) -> usize {
2566 encoding::align_default(self.serialized_size(&context)) + 2991 encoding::align_default(self.serialized_size(&context)) +
2567 self.param0.compute_size(context.clone()) 2992 self.param0.compute_size(context.clone())
2568 } 2993 }
2569 } 2994 }
(...skipping 25 matching lines...) Expand all
2595 fn header_data(&self) -> DataHeaderValue { 3020 fn header_data(&self) -> DataHeaderValue {
2596 DataHeaderValue::Version(0) 3021 DataHeaderValue::Version(0)
2597 } 3022 }
2598 fn serialized_size(&self, _context: &Context) -> usize { 3023 fn serialized_size(&self, _context: &Context) -> usize {
2599 16 3024 16
2600 } 3025 }
2601 fn encode_value(self, encoder: &mut Encoder, context: Context) { 3026 fn encode_value(self, encoder: &mut Encoder, context: Context) {
2602 MojomEncodable::encode(self.param0, encoder, context.clone()); 3027 MojomEncodable::encode(self.param0, encoder, context.clone());
2603 3028
2604 } 3029 }
2605 fn decode_value(decoder: &mut Decoder, context: Context) -> Self { 3030 fn decode_value(decoder: &mut Decoder, context: Context) -> Result<Self, Val idationError> {
2606 // TODO(mknyszek): Validate bytes and version 3031 let version = {
2607 let (_bytes, version) = {
2608 let mut state = decoder.get_mut(&context); 3032 let mut state = decoder.get_mut(&context);
2609 let bytes = state.decode::<u32>(); 3033 match state.decode_struct_header(&IntegrationTestInterfaceMethod0Res ponseVersions) {
2610 let version = state.decode::<u32>(); 3034 Ok(header) => header.data(),
2611 (bytes, version) 3035 Err(err) => return Err(err),
3036 }
2612 }; 3037 };
2613 let param0 = Vec::<u8>::decode(decoder, context.clone()); 3038 let param0 = match Vec::<u8>::decode(decoder, context.clone()) {
2614 IntegrationTestInterfaceMethod0Response { param0: param0 } 3039 Ok(value) => value,
3040 Err(err) => return Err(err),
3041 };
3042 Ok(IntegrationTestInterfaceMethod0Response { param0: param0 })
2615 } 3043 }
2616 } 3044 }
2617 3045
2618 impl MojomEncodable for IntegrationTestInterfaceMethod0Response { 3046 impl MojomEncodable for IntegrationTestInterfaceMethod0Response {
2619 impl_encodable_for_pointer!(); 3047 impl_encodable_for_pointer!();
2620 fn compute_size(&self, context: Context) -> usize { 3048 fn compute_size(&self, context: Context) -> usize {
2621 encoding::align_default(self.serialized_size(&context)) + 3049 encoding::align_default(self.serialized_size(&context)) +
2622 self.param0.compute_size(context.clone()) 3050 self.param0.compute_size(context.clone())
2623 } 3051 }
2624 } 3052 }
2625 3053
2626 impl MojomStruct for IntegrationTestInterfaceMethod0Response {} 3054 impl MojomStruct for IntegrationTestInterfaceMethod0Response {}
2627 3055
2628 impl MojomMessage for IntegrationTestInterfaceMethod0Response { 3056 impl MojomMessage for IntegrationTestInterfaceMethod0Response {
2629 fn create_header() -> MessageHeader { 3057 fn create_header() -> MessageHeader {
2630 MessageHeader::new(IntegrationTestInterface::VERSION, 3058 MessageHeader::new(IntegrationTestInterface::VERSION,
2631 IntegrationTestInterfaceMethod0::ORDINAL, 3059 IntegrationTestInterfaceMethod0::ORDINAL,
2632 message::MESSAGE_HEADER_IS_RESPONSE) 3060 message::MESSAGE_HEADER_IS_RESPONSE)
2633 } 3061 }
2634 } 3062 }
2635 impl IntegrationTestInterfaceResponse for IntegrationTestInterfaceMethod0Request {} 3063 impl IntegrationTestInterfaceResponse for IntegrationTestInterfaceMethod0Request {}
OLDNEW
« no previous file with comments | « mojo/public/rust/tests/regression.rs ('k') | mojo/public/rust/tests/validation.rs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698