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