1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12pub enum SpawnConsoleError {
13 InvalidArgs,
15 Canceled,
17 #[doc(hidden)]
18 __SourceBreaking { unknown_ordinal: u32 },
19}
20
21#[macro_export]
23macro_rules! SpawnConsoleErrorUnknown {
24 () => {
25 _
26 };
27}
28
29impl SpawnConsoleError {
30 #[inline]
31 pub fn from_primitive(prim: u32) -> Option<Self> {
32 match prim {
33 1 => Some(Self::InvalidArgs),
34 2 => Some(Self::Canceled),
35 _ => None,
36 }
37 }
38
39 #[inline]
40 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
41 match prim {
42 1 => Self::InvalidArgs,
43 2 => Self::Canceled,
44 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
45 }
46 }
47
48 #[inline]
49 pub fn unknown() -> Self {
50 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
51 }
52
53 #[inline]
54 pub const fn into_primitive(self) -> u32 {
55 match self {
56 Self::InvalidArgs => 1,
57 Self::Canceled => 2,
58 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
59 }
60 }
61
62 #[inline]
63 pub fn is_unknown(&self) -> bool {
64 match self {
65 Self::__SourceBreaking { unknown_ordinal: _ } => true,
66 _ => false,
67 }
68 }
69}
70
71#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
72#[repr(C)]
73pub struct ConsoleWindowSize {
74 pub rows: u16,
75 pub cols: u16,
76 pub x_pixels: u16,
77 pub y_pixels: u16,
78}
79
80impl fidl::Persistable for ConsoleWindowSize {}
81
82#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83#[repr(C)]
84pub struct ControllerSpawnConsoleResponse {
85 pub exit_code: u8,
86}
87
88impl fidl::Persistable for ControllerSpawnConsoleResponse {}
89
90#[derive(Clone, Debug, Default, PartialEq)]
91pub struct ControllerGetVmoReferencesRequest {
92 pub koid: Option<u64>,
93 #[doc(hidden)]
94 pub __source_breaking: fidl::marker::SourceBreaking,
95}
96
97impl fidl::Persistable for ControllerGetVmoReferencesRequest {}
98
99#[derive(Clone, Debug, Default, PartialEq)]
100pub struct ControllerGetVmoReferencesResponse {
101 pub references: Option<Vec<VmoReference>>,
102 #[doc(hidden)]
103 pub __source_breaking: fidl::marker::SourceBreaking,
104}
105
106impl fidl::Persistable for ControllerGetVmoReferencesResponse {}
107
108#[derive(Clone, Debug, Default, PartialEq)]
109pub struct VmoReference {
110 pub process_name: Option<String>,
112 pub pid: Option<u64>,
114 pub fd: Option<i32>,
116 pub koid: Option<u64>,
118 #[doc(hidden)]
119 pub __source_breaking: fidl::marker::SourceBreaking,
120}
121
122impl fidl::Persistable for VmoReference {}
123
124mod internal {
125 use super::*;
126 unsafe impl fidl::encoding::TypeMarker for SpawnConsoleError {
127 type Owned = Self;
128
129 #[inline(always)]
130 fn inline_align(_context: fidl::encoding::Context) -> usize {
131 std::mem::align_of::<u32>()
132 }
133
134 #[inline(always)]
135 fn inline_size(_context: fidl::encoding::Context) -> usize {
136 std::mem::size_of::<u32>()
137 }
138
139 #[inline(always)]
140 fn encode_is_copy() -> bool {
141 false
142 }
143
144 #[inline(always)]
145 fn decode_is_copy() -> bool {
146 false
147 }
148 }
149
150 impl fidl::encoding::ValueTypeMarker for SpawnConsoleError {
151 type Borrowed<'a> = Self;
152 #[inline(always)]
153 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
154 *value
155 }
156 }
157
158 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
159 for SpawnConsoleError
160 {
161 #[inline]
162 unsafe fn encode(
163 self,
164 encoder: &mut fidl::encoding::Encoder<'_, D>,
165 offset: usize,
166 _depth: fidl::encoding::Depth,
167 ) -> fidl::Result<()> {
168 encoder.debug_check_bounds::<Self>(offset);
169 encoder.write_num(self.into_primitive(), offset);
170 Ok(())
171 }
172 }
173
174 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SpawnConsoleError {
175 #[inline(always)]
176 fn new_empty() -> Self {
177 Self::unknown()
178 }
179
180 #[inline]
181 unsafe fn decode(
182 &mut self,
183 decoder: &mut fidl::encoding::Decoder<'_, D>,
184 offset: usize,
185 _depth: fidl::encoding::Depth,
186 ) -> fidl::Result<()> {
187 decoder.debug_check_bounds::<Self>(offset);
188 let prim = decoder.read_num::<u32>(offset);
189
190 *self = Self::from_primitive_allow_unknown(prim);
191 Ok(())
192 }
193 }
194
195 impl fidl::encoding::ValueTypeMarker for ConsoleWindowSize {
196 type Borrowed<'a> = &'a Self;
197 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
198 value
199 }
200 }
201
202 unsafe impl fidl::encoding::TypeMarker for ConsoleWindowSize {
203 type Owned = Self;
204
205 #[inline(always)]
206 fn inline_align(_context: fidl::encoding::Context) -> usize {
207 2
208 }
209
210 #[inline(always)]
211 fn inline_size(_context: fidl::encoding::Context) -> usize {
212 8
213 }
214 #[inline(always)]
215 fn encode_is_copy() -> bool {
216 true
217 }
218
219 #[inline(always)]
220 fn decode_is_copy() -> bool {
221 true
222 }
223 }
224
225 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ConsoleWindowSize, D>
226 for &ConsoleWindowSize
227 {
228 #[inline]
229 unsafe fn encode(
230 self,
231 encoder: &mut fidl::encoding::Encoder<'_, D>,
232 offset: usize,
233 _depth: fidl::encoding::Depth,
234 ) -> fidl::Result<()> {
235 encoder.debug_check_bounds::<ConsoleWindowSize>(offset);
236 unsafe {
237 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
239 (buf_ptr as *mut ConsoleWindowSize)
240 .write_unaligned((self as *const ConsoleWindowSize).read());
241 }
244 Ok(())
245 }
246 }
247 unsafe impl<
248 D: fidl::encoding::ResourceDialect,
249 T0: fidl::encoding::Encode<u16, D>,
250 T1: fidl::encoding::Encode<u16, D>,
251 T2: fidl::encoding::Encode<u16, D>,
252 T3: fidl::encoding::Encode<u16, D>,
253 > fidl::encoding::Encode<ConsoleWindowSize, D> for (T0, T1, T2, T3)
254 {
255 #[inline]
256 unsafe fn encode(
257 self,
258 encoder: &mut fidl::encoding::Encoder<'_, D>,
259 offset: usize,
260 depth: fidl::encoding::Depth,
261 ) -> fidl::Result<()> {
262 encoder.debug_check_bounds::<ConsoleWindowSize>(offset);
263 self.0.encode(encoder, offset + 0, depth)?;
267 self.1.encode(encoder, offset + 2, depth)?;
268 self.2.encode(encoder, offset + 4, depth)?;
269 self.3.encode(encoder, offset + 6, depth)?;
270 Ok(())
271 }
272 }
273
274 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConsoleWindowSize {
275 #[inline(always)]
276 fn new_empty() -> Self {
277 Self {
278 rows: fidl::new_empty!(u16, D),
279 cols: fidl::new_empty!(u16, D),
280 x_pixels: fidl::new_empty!(u16, D),
281 y_pixels: fidl::new_empty!(u16, D),
282 }
283 }
284
285 #[inline]
286 unsafe fn decode(
287 &mut self,
288 decoder: &mut fidl::encoding::Decoder<'_, D>,
289 offset: usize,
290 _depth: fidl::encoding::Depth,
291 ) -> fidl::Result<()> {
292 decoder.debug_check_bounds::<Self>(offset);
293 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
294 unsafe {
297 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
298 }
299 Ok(())
300 }
301 }
302
303 impl fidl::encoding::ValueTypeMarker for ControllerSpawnConsoleResponse {
304 type Borrowed<'a> = &'a Self;
305 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
306 value
307 }
308 }
309
310 unsafe impl fidl::encoding::TypeMarker for ControllerSpawnConsoleResponse {
311 type Owned = Self;
312
313 #[inline(always)]
314 fn inline_align(_context: fidl::encoding::Context) -> usize {
315 1
316 }
317
318 #[inline(always)]
319 fn inline_size(_context: fidl::encoding::Context) -> usize {
320 1
321 }
322 #[inline(always)]
323 fn encode_is_copy() -> bool {
324 true
325 }
326
327 #[inline(always)]
328 fn decode_is_copy() -> bool {
329 true
330 }
331 }
332
333 unsafe impl<D: fidl::encoding::ResourceDialect>
334 fidl::encoding::Encode<ControllerSpawnConsoleResponse, D>
335 for &ControllerSpawnConsoleResponse
336 {
337 #[inline]
338 unsafe fn encode(
339 self,
340 encoder: &mut fidl::encoding::Encoder<'_, D>,
341 offset: usize,
342 _depth: fidl::encoding::Depth,
343 ) -> fidl::Result<()> {
344 encoder.debug_check_bounds::<ControllerSpawnConsoleResponse>(offset);
345 unsafe {
346 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
348 (buf_ptr as *mut ControllerSpawnConsoleResponse)
349 .write_unaligned((self as *const ControllerSpawnConsoleResponse).read());
350 }
353 Ok(())
354 }
355 }
356 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
357 fidl::encoding::Encode<ControllerSpawnConsoleResponse, D> for (T0,)
358 {
359 #[inline]
360 unsafe fn encode(
361 self,
362 encoder: &mut fidl::encoding::Encoder<'_, D>,
363 offset: usize,
364 depth: fidl::encoding::Depth,
365 ) -> fidl::Result<()> {
366 encoder.debug_check_bounds::<ControllerSpawnConsoleResponse>(offset);
367 self.0.encode(encoder, offset + 0, depth)?;
371 Ok(())
372 }
373 }
374
375 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
376 for ControllerSpawnConsoleResponse
377 {
378 #[inline(always)]
379 fn new_empty() -> Self {
380 Self { exit_code: fidl::new_empty!(u8, D) }
381 }
382
383 #[inline]
384 unsafe fn decode(
385 &mut self,
386 decoder: &mut fidl::encoding::Decoder<'_, D>,
387 offset: usize,
388 _depth: fidl::encoding::Depth,
389 ) -> fidl::Result<()> {
390 decoder.debug_check_bounds::<Self>(offset);
391 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
392 unsafe {
395 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
396 }
397 Ok(())
398 }
399 }
400
401 impl ControllerGetVmoReferencesRequest {
402 #[inline(always)]
403 fn max_ordinal_present(&self) -> u64 {
404 if let Some(_) = self.koid {
405 return 1;
406 }
407 0
408 }
409 }
410
411 impl fidl::encoding::ValueTypeMarker for ControllerGetVmoReferencesRequest {
412 type Borrowed<'a> = &'a Self;
413 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
414 value
415 }
416 }
417
418 unsafe impl fidl::encoding::TypeMarker for ControllerGetVmoReferencesRequest {
419 type Owned = Self;
420
421 #[inline(always)]
422 fn inline_align(_context: fidl::encoding::Context) -> usize {
423 8
424 }
425
426 #[inline(always)]
427 fn inline_size(_context: fidl::encoding::Context) -> usize {
428 16
429 }
430 }
431
432 unsafe impl<D: fidl::encoding::ResourceDialect>
433 fidl::encoding::Encode<ControllerGetVmoReferencesRequest, D>
434 for &ControllerGetVmoReferencesRequest
435 {
436 unsafe fn encode(
437 self,
438 encoder: &mut fidl::encoding::Encoder<'_, D>,
439 offset: usize,
440 mut depth: fidl::encoding::Depth,
441 ) -> fidl::Result<()> {
442 encoder.debug_check_bounds::<ControllerGetVmoReferencesRequest>(offset);
443 let max_ordinal: u64 = self.max_ordinal_present();
445 encoder.write_num(max_ordinal, offset);
446 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
447 if max_ordinal == 0 {
449 return Ok(());
450 }
451 depth.increment()?;
452 let envelope_size = 8;
453 let bytes_len = max_ordinal as usize * envelope_size;
454 #[allow(unused_variables)]
455 let offset = encoder.out_of_line_offset(bytes_len);
456 let mut _prev_end_offset: usize = 0;
457 if 1 > max_ordinal {
458 return Ok(());
459 }
460
461 let cur_offset: usize = (1 - 1) * envelope_size;
464
465 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
467
468 fidl::encoding::encode_in_envelope_optional::<u64, D>(
473 self.koid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
474 encoder,
475 offset + cur_offset,
476 depth,
477 )?;
478
479 _prev_end_offset = cur_offset + envelope_size;
480
481 Ok(())
482 }
483 }
484
485 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
486 for ControllerGetVmoReferencesRequest
487 {
488 #[inline(always)]
489 fn new_empty() -> Self {
490 Self::default()
491 }
492
493 unsafe fn decode(
494 &mut self,
495 decoder: &mut fidl::encoding::Decoder<'_, D>,
496 offset: usize,
497 mut depth: fidl::encoding::Depth,
498 ) -> fidl::Result<()> {
499 decoder.debug_check_bounds::<Self>(offset);
500 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
501 None => return Err(fidl::Error::NotNullable),
502 Some(len) => len,
503 };
504 if len == 0 {
506 return Ok(());
507 };
508 depth.increment()?;
509 let envelope_size = 8;
510 let bytes_len = len * envelope_size;
511 let offset = decoder.out_of_line_offset(bytes_len)?;
512 let mut _next_ordinal_to_read = 0;
514 let mut next_offset = offset;
515 let end_offset = offset + bytes_len;
516 _next_ordinal_to_read += 1;
517 if next_offset >= end_offset {
518 return Ok(());
519 }
520
521 while _next_ordinal_to_read < 1 {
523 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
524 _next_ordinal_to_read += 1;
525 next_offset += envelope_size;
526 }
527
528 let next_out_of_line = decoder.next_out_of_line();
529 let handles_before = decoder.remaining_handles();
530 if let Some((inlined, num_bytes, num_handles)) =
531 fidl::encoding::decode_envelope_header(decoder, next_offset)?
532 {
533 let member_inline_size =
534 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
535 if inlined != (member_inline_size <= 4) {
536 return Err(fidl::Error::InvalidInlineBitInEnvelope);
537 }
538 let inner_offset;
539 let mut inner_depth = depth.clone();
540 if inlined {
541 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
542 inner_offset = next_offset;
543 } else {
544 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
545 inner_depth.increment()?;
546 }
547 let val_ref = self.koid.get_or_insert_with(|| fidl::new_empty!(u64, D));
548 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
549 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
550 {
551 return Err(fidl::Error::InvalidNumBytesInEnvelope);
552 }
553 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
554 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
555 }
556 }
557
558 next_offset += envelope_size;
559
560 while next_offset < end_offset {
562 _next_ordinal_to_read += 1;
563 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
564 next_offset += envelope_size;
565 }
566
567 Ok(())
568 }
569 }
570
571 impl ControllerGetVmoReferencesResponse {
572 #[inline(always)]
573 fn max_ordinal_present(&self) -> u64 {
574 if let Some(_) = self.references {
575 return 1;
576 }
577 0
578 }
579 }
580
581 impl fidl::encoding::ValueTypeMarker for ControllerGetVmoReferencesResponse {
582 type Borrowed<'a> = &'a Self;
583 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
584 value
585 }
586 }
587
588 unsafe impl fidl::encoding::TypeMarker for ControllerGetVmoReferencesResponse {
589 type Owned = Self;
590
591 #[inline(always)]
592 fn inline_align(_context: fidl::encoding::Context) -> usize {
593 8
594 }
595
596 #[inline(always)]
597 fn inline_size(_context: fidl::encoding::Context) -> usize {
598 16
599 }
600 }
601
602 unsafe impl<D: fidl::encoding::ResourceDialect>
603 fidl::encoding::Encode<ControllerGetVmoReferencesResponse, D>
604 for &ControllerGetVmoReferencesResponse
605 {
606 unsafe fn encode(
607 self,
608 encoder: &mut fidl::encoding::Encoder<'_, D>,
609 offset: usize,
610 mut depth: fidl::encoding::Depth,
611 ) -> fidl::Result<()> {
612 encoder.debug_check_bounds::<ControllerGetVmoReferencesResponse>(offset);
613 let max_ordinal: u64 = self.max_ordinal_present();
615 encoder.write_num(max_ordinal, offset);
616 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
617 if max_ordinal == 0 {
619 return Ok(());
620 }
621 depth.increment()?;
622 let envelope_size = 8;
623 let bytes_len = max_ordinal as usize * envelope_size;
624 #[allow(unused_variables)]
625 let offset = encoder.out_of_line_offset(bytes_len);
626 let mut _prev_end_offset: usize = 0;
627 if 1 > max_ordinal {
628 return Ok(());
629 }
630
631 let cur_offset: usize = (1 - 1) * envelope_size;
634
635 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
637
638 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<VmoReference>, D>(
643 self.references.as_ref().map(<fidl::encoding::UnboundedVector<VmoReference> as fidl::encoding::ValueTypeMarker>::borrow),
644 encoder, offset + cur_offset, depth
645 )?;
646
647 _prev_end_offset = cur_offset + envelope_size;
648
649 Ok(())
650 }
651 }
652
653 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
654 for ControllerGetVmoReferencesResponse
655 {
656 #[inline(always)]
657 fn new_empty() -> Self {
658 Self::default()
659 }
660
661 unsafe fn decode(
662 &mut self,
663 decoder: &mut fidl::encoding::Decoder<'_, D>,
664 offset: usize,
665 mut depth: fidl::encoding::Depth,
666 ) -> fidl::Result<()> {
667 decoder.debug_check_bounds::<Self>(offset);
668 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
669 None => return Err(fidl::Error::NotNullable),
670 Some(len) => len,
671 };
672 if len == 0 {
674 return Ok(());
675 };
676 depth.increment()?;
677 let envelope_size = 8;
678 let bytes_len = len * envelope_size;
679 let offset = decoder.out_of_line_offset(bytes_len)?;
680 let mut _next_ordinal_to_read = 0;
682 let mut next_offset = offset;
683 let end_offset = offset + bytes_len;
684 _next_ordinal_to_read += 1;
685 if next_offset >= end_offset {
686 return Ok(());
687 }
688
689 while _next_ordinal_to_read < 1 {
691 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
692 _next_ordinal_to_read += 1;
693 next_offset += envelope_size;
694 }
695
696 let next_out_of_line = decoder.next_out_of_line();
697 let handles_before = decoder.remaining_handles();
698 if let Some((inlined, num_bytes, num_handles)) =
699 fidl::encoding::decode_envelope_header(decoder, next_offset)?
700 {
701 let member_inline_size = <fidl::encoding::UnboundedVector<VmoReference> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
702 if inlined != (member_inline_size <= 4) {
703 return Err(fidl::Error::InvalidInlineBitInEnvelope);
704 }
705 let inner_offset;
706 let mut inner_depth = depth.clone();
707 if inlined {
708 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
709 inner_offset = next_offset;
710 } else {
711 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
712 inner_depth.increment()?;
713 }
714 let val_ref = self.references.get_or_insert_with(|| {
715 fidl::new_empty!(fidl::encoding::UnboundedVector<VmoReference>, D)
716 });
717 fidl::decode!(
718 fidl::encoding::UnboundedVector<VmoReference>,
719 D,
720 val_ref,
721 decoder,
722 inner_offset,
723 inner_depth
724 )?;
725 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
726 {
727 return Err(fidl::Error::InvalidNumBytesInEnvelope);
728 }
729 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
730 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
731 }
732 }
733
734 next_offset += envelope_size;
735
736 while next_offset < end_offset {
738 _next_ordinal_to_read += 1;
739 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
740 next_offset += envelope_size;
741 }
742
743 Ok(())
744 }
745 }
746
747 impl VmoReference {
748 #[inline(always)]
749 fn max_ordinal_present(&self) -> u64 {
750 if let Some(_) = self.koid {
751 return 4;
752 }
753 if let Some(_) = self.fd {
754 return 3;
755 }
756 if let Some(_) = self.pid {
757 return 2;
758 }
759 if let Some(_) = self.process_name {
760 return 1;
761 }
762 0
763 }
764 }
765
766 impl fidl::encoding::ValueTypeMarker for VmoReference {
767 type Borrowed<'a> = &'a Self;
768 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
769 value
770 }
771 }
772
773 unsafe impl fidl::encoding::TypeMarker for VmoReference {
774 type Owned = Self;
775
776 #[inline(always)]
777 fn inline_align(_context: fidl::encoding::Context) -> usize {
778 8
779 }
780
781 #[inline(always)]
782 fn inline_size(_context: fidl::encoding::Context) -> usize {
783 16
784 }
785 }
786
787 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VmoReference, D>
788 for &VmoReference
789 {
790 unsafe fn encode(
791 self,
792 encoder: &mut fidl::encoding::Encoder<'_, D>,
793 offset: usize,
794 mut depth: fidl::encoding::Depth,
795 ) -> fidl::Result<()> {
796 encoder.debug_check_bounds::<VmoReference>(offset);
797 let max_ordinal: u64 = self.max_ordinal_present();
799 encoder.write_num(max_ordinal, offset);
800 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
801 if max_ordinal == 0 {
803 return Ok(());
804 }
805 depth.increment()?;
806 let envelope_size = 8;
807 let bytes_len = max_ordinal as usize * envelope_size;
808 #[allow(unused_variables)]
809 let offset = encoder.out_of_line_offset(bytes_len);
810 let mut _prev_end_offset: usize = 0;
811 if 1 > max_ordinal {
812 return Ok(());
813 }
814
815 let cur_offset: usize = (1 - 1) * envelope_size;
818
819 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
821
822 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
827 self.process_name.as_ref().map(
828 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
829 ),
830 encoder,
831 offset + cur_offset,
832 depth,
833 )?;
834
835 _prev_end_offset = cur_offset + envelope_size;
836 if 2 > max_ordinal {
837 return Ok(());
838 }
839
840 let cur_offset: usize = (2 - 1) * envelope_size;
843
844 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
846
847 fidl::encoding::encode_in_envelope_optional::<u64, D>(
852 self.pid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
853 encoder,
854 offset + cur_offset,
855 depth,
856 )?;
857
858 _prev_end_offset = cur_offset + envelope_size;
859 if 3 > max_ordinal {
860 return Ok(());
861 }
862
863 let cur_offset: usize = (3 - 1) * envelope_size;
866
867 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
869
870 fidl::encoding::encode_in_envelope_optional::<i32, D>(
875 self.fd.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
876 encoder,
877 offset + cur_offset,
878 depth,
879 )?;
880
881 _prev_end_offset = cur_offset + envelope_size;
882 if 4 > max_ordinal {
883 return Ok(());
884 }
885
886 let cur_offset: usize = (4 - 1) * envelope_size;
889
890 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
892
893 fidl::encoding::encode_in_envelope_optional::<u64, D>(
898 self.koid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
899 encoder,
900 offset + cur_offset,
901 depth,
902 )?;
903
904 _prev_end_offset = cur_offset + envelope_size;
905
906 Ok(())
907 }
908 }
909
910 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VmoReference {
911 #[inline(always)]
912 fn new_empty() -> Self {
913 Self::default()
914 }
915
916 unsafe fn decode(
917 &mut self,
918 decoder: &mut fidl::encoding::Decoder<'_, D>,
919 offset: usize,
920 mut depth: fidl::encoding::Depth,
921 ) -> fidl::Result<()> {
922 decoder.debug_check_bounds::<Self>(offset);
923 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
924 None => return Err(fidl::Error::NotNullable),
925 Some(len) => len,
926 };
927 if len == 0 {
929 return Ok(());
930 };
931 depth.increment()?;
932 let envelope_size = 8;
933 let bytes_len = len * envelope_size;
934 let offset = decoder.out_of_line_offset(bytes_len)?;
935 let mut _next_ordinal_to_read = 0;
937 let mut next_offset = offset;
938 let end_offset = offset + bytes_len;
939 _next_ordinal_to_read += 1;
940 if next_offset >= end_offset {
941 return Ok(());
942 }
943
944 while _next_ordinal_to_read < 1 {
946 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
947 _next_ordinal_to_read += 1;
948 next_offset += envelope_size;
949 }
950
951 let next_out_of_line = decoder.next_out_of_line();
952 let handles_before = decoder.remaining_handles();
953 if let Some((inlined, num_bytes, num_handles)) =
954 fidl::encoding::decode_envelope_header(decoder, next_offset)?
955 {
956 let member_inline_size =
957 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
958 decoder.context,
959 );
960 if inlined != (member_inline_size <= 4) {
961 return Err(fidl::Error::InvalidInlineBitInEnvelope);
962 }
963 let inner_offset;
964 let mut inner_depth = depth.clone();
965 if inlined {
966 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
967 inner_offset = next_offset;
968 } else {
969 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
970 inner_depth.increment()?;
971 }
972 let val_ref = self
973 .process_name
974 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
975 fidl::decode!(
976 fidl::encoding::UnboundedString,
977 D,
978 val_ref,
979 decoder,
980 inner_offset,
981 inner_depth
982 )?;
983 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
984 {
985 return Err(fidl::Error::InvalidNumBytesInEnvelope);
986 }
987 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
988 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
989 }
990 }
991
992 next_offset += envelope_size;
993 _next_ordinal_to_read += 1;
994 if next_offset >= end_offset {
995 return Ok(());
996 }
997
998 while _next_ordinal_to_read < 2 {
1000 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1001 _next_ordinal_to_read += 1;
1002 next_offset += envelope_size;
1003 }
1004
1005 let next_out_of_line = decoder.next_out_of_line();
1006 let handles_before = decoder.remaining_handles();
1007 if let Some((inlined, num_bytes, num_handles)) =
1008 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1009 {
1010 let member_inline_size =
1011 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1012 if inlined != (member_inline_size <= 4) {
1013 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1014 }
1015 let inner_offset;
1016 let mut inner_depth = depth.clone();
1017 if inlined {
1018 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1019 inner_offset = next_offset;
1020 } else {
1021 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1022 inner_depth.increment()?;
1023 }
1024 let val_ref = self.pid.get_or_insert_with(|| fidl::new_empty!(u64, D));
1025 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1026 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1027 {
1028 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1029 }
1030 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1031 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1032 }
1033 }
1034
1035 next_offset += envelope_size;
1036 _next_ordinal_to_read += 1;
1037 if next_offset >= end_offset {
1038 return Ok(());
1039 }
1040
1041 while _next_ordinal_to_read < 3 {
1043 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1044 _next_ordinal_to_read += 1;
1045 next_offset += envelope_size;
1046 }
1047
1048 let next_out_of_line = decoder.next_out_of_line();
1049 let handles_before = decoder.remaining_handles();
1050 if let Some((inlined, num_bytes, num_handles)) =
1051 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1052 {
1053 let member_inline_size =
1054 <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1055 if inlined != (member_inline_size <= 4) {
1056 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1057 }
1058 let inner_offset;
1059 let mut inner_depth = depth.clone();
1060 if inlined {
1061 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1062 inner_offset = next_offset;
1063 } else {
1064 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1065 inner_depth.increment()?;
1066 }
1067 let val_ref = self.fd.get_or_insert_with(|| fidl::new_empty!(i32, D));
1068 fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
1069 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1070 {
1071 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1072 }
1073 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1074 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1075 }
1076 }
1077
1078 next_offset += envelope_size;
1079 _next_ordinal_to_read += 1;
1080 if next_offset >= end_offset {
1081 return Ok(());
1082 }
1083
1084 while _next_ordinal_to_read < 4 {
1086 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1087 _next_ordinal_to_read += 1;
1088 next_offset += envelope_size;
1089 }
1090
1091 let next_out_of_line = decoder.next_out_of_line();
1092 let handles_before = decoder.remaining_handles();
1093 if let Some((inlined, num_bytes, num_handles)) =
1094 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1095 {
1096 let member_inline_size =
1097 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1098 if inlined != (member_inline_size <= 4) {
1099 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1100 }
1101 let inner_offset;
1102 let mut inner_depth = depth.clone();
1103 if inlined {
1104 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1105 inner_offset = next_offset;
1106 } else {
1107 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1108 inner_depth.increment()?;
1109 }
1110 let val_ref = self.koid.get_or_insert_with(|| fidl::new_empty!(u64, D));
1111 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1112 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1113 {
1114 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1115 }
1116 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1117 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1118 }
1119 }
1120
1121 next_offset += envelope_size;
1122
1123 while next_offset < end_offset {
1125 _next_ordinal_to_read += 1;
1126 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1127 next_offset += envelope_size;
1128 }
1129
1130 Ok(())
1131 }
1132 }
1133}