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