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)]
13#[repr(u32)]
14pub enum DiffType {
15 Full = 0,
17 Diff = 1,
19 Both = 2,
21}
22
23impl DiffType {
24 #[inline]
25 pub fn from_primitive(prim: u32) -> Option<Self> {
26 match prim {
27 0 => Some(Self::Full),
28 1 => Some(Self::Diff),
29 2 => Some(Self::Both),
30 _ => None,
31 }
32 }
33
34 #[inline]
35 pub const fn into_primitive(self) -> u32 {
36 self as u32
37 }
38
39 #[deprecated = "Strict enums should not use `is_unknown`"]
40 #[inline]
41 pub fn is_unknown(&self) -> bool {
42 false
43 }
44}
45
46#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
48#[repr(u32)]
49pub enum TestResult {
50 Ok = 0,
52 Unimplemented = 1,
54 Failed = 2,
56 Illegal = 3,
58}
59
60impl TestResult {
61 #[inline]
62 pub fn from_primitive(prim: u32) -> Option<Self> {
63 match prim {
64 0 => Some(Self::Ok),
65 1 => Some(Self::Unimplemented),
66 2 => Some(Self::Failed),
67 3 => Some(Self::Illegal),
68 _ => None,
69 }
70 }
71
72 #[inline]
73 pub const fn into_primitive(self) -> u32 {
74 self as u32
75 }
76
77 #[deprecated = "Strict enums should not use `is_unknown`"]
78 #[inline]
79 pub fn is_unknown(&self) -> bool {
80 false
81 }
82}
83
84#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct CreateBytesProperty {
87 pub parent: u32,
88 pub id: u32,
89 pub name: String,
90 pub value: Vec<u8>,
91}
92
93impl fidl::Persistable for CreateBytesProperty {}
94
95#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct CreateNode {
99 pub parent: u32,
100 pub id: u32,
101 pub name: String,
102}
103
104impl fidl::Persistable for CreateNode {}
105
106#[derive(Clone, Debug, PartialEq)]
108pub struct CreateNumericProperty {
109 pub parent: u32,
110 pub id: u32,
111 pub name: String,
112 pub value: Value,
113}
114
115impl fidl::Persistable for CreateNumericProperty {}
116
117#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119#[repr(C)]
120pub struct DeleteNode {
121 pub id: u32,
122}
123
124impl fidl::Persistable for DeleteNode {}
125
126#[derive(Clone, Debug, PartialEq)]
127pub struct InspectPuppetActRequest {
128 pub action: Action,
129}
130
131impl fidl::Persistable for InspectPuppetActRequest {}
132
133#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
134pub struct InspectPuppetActResponse {
135 pub result: TestResult,
136}
137
138impl fidl::Persistable for InspectPuppetActResponse {}
139
140#[derive(Clone, Debug, PartialEq)]
141pub struct InspectPuppetInitializeRequest {
142 pub params: InitializationParams,
143}
144
145impl fidl::Persistable for InspectPuppetInitializeRequest {}
146
147#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
148pub struct InspectPuppetPublishResponse {
149 pub result: TestResult,
150}
151
152impl fidl::Persistable for InspectPuppetPublishResponse {}
153
154#[derive(Clone, Debug, Default, PartialEq)]
156pub struct InitializationParams {
157 pub vmo_size: Option<u64>,
158 #[doc(hidden)]
159 pub __source_breaking: fidl::marker::SourceBreaking,
160}
161
162impl fidl::Persistable for InitializationParams {}
163
164#[derive(Clone, Debug)]
166pub enum Action {
167 CreateNode(CreateNode),
168 DeleteNode(DeleteNode),
169 CreateNumericProperty(CreateNumericProperty),
170 CreateBytesProperty(CreateBytesProperty),
171 #[doc(hidden)]
172 __SourceBreaking {
173 unknown_ordinal: u64,
174 },
175}
176
177#[macro_export]
179macro_rules! ActionUnknown {
180 () => {
181 _
182 };
183}
184
185impl PartialEq for Action {
187 fn eq(&self, other: &Self) -> bool {
188 match (self, other) {
189 (Self::CreateNode(x), Self::CreateNode(y)) => *x == *y,
190 (Self::DeleteNode(x), Self::DeleteNode(y)) => *x == *y,
191 (Self::CreateNumericProperty(x), Self::CreateNumericProperty(y)) => *x == *y,
192 (Self::CreateBytesProperty(x), Self::CreateBytesProperty(y)) => *x == *y,
193 _ => false,
194 }
195 }
196}
197
198impl Action {
199 #[inline]
200 pub fn ordinal(&self) -> u64 {
201 match *self {
202 Self::CreateNode(_) => 1,
203 Self::DeleteNode(_) => 2,
204 Self::CreateNumericProperty(_) => 3,
205 Self::CreateBytesProperty(_) => 4,
206 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
207 }
208 }
209
210 #[inline]
211 pub fn unknown_variant_for_testing() -> Self {
212 Self::__SourceBreaking { unknown_ordinal: 0 }
213 }
214
215 #[inline]
216 pub fn is_unknown(&self) -> bool {
217 match self {
218 Self::__SourceBreaking { .. } => true,
219 _ => false,
220 }
221 }
222}
223
224impl fidl::Persistable for Action {}
225
226#[derive(Clone, Debug)]
227pub enum Value {
228 IntT(i64),
229 UintT(u64),
230 DoubleT(f64),
231 StringT(String),
232 #[doc(hidden)]
233 __SourceBreaking {
234 unknown_ordinal: u64,
235 },
236}
237
238#[macro_export]
240macro_rules! ValueUnknown {
241 () => {
242 _
243 };
244}
245
246impl PartialEq for Value {
248 fn eq(&self, other: &Self) -> bool {
249 match (self, other) {
250 (Self::IntT(x), Self::IntT(y)) => *x == *y,
251 (Self::UintT(x), Self::UintT(y)) => *x == *y,
252 (Self::DoubleT(x), Self::DoubleT(y)) => *x == *y,
253 (Self::StringT(x), Self::StringT(y)) => *x == *y,
254 _ => false,
255 }
256 }
257}
258
259impl Value {
260 #[inline]
261 pub fn ordinal(&self) -> u64 {
262 match *self {
263 Self::IntT(_) => 1,
264 Self::UintT(_) => 2,
265 Self::DoubleT(_) => 3,
266 Self::StringT(_) => 4,
267 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
268 }
269 }
270
271 #[inline]
272 pub fn unknown_variant_for_testing() -> Self {
273 Self::__SourceBreaking { unknown_ordinal: 0 }
274 }
275
276 #[inline]
277 pub fn is_unknown(&self) -> bool {
278 match self {
279 Self::__SourceBreaking { .. } => true,
280 _ => false,
281 }
282 }
283}
284
285impl fidl::Persistable for Value {}
286
287mod internal {
288 use super::*;
289 unsafe impl fidl::encoding::TypeMarker for DiffType {
290 type Owned = Self;
291
292 #[inline(always)]
293 fn inline_align(_context: fidl::encoding::Context) -> usize {
294 std::mem::align_of::<u32>()
295 }
296
297 #[inline(always)]
298 fn inline_size(_context: fidl::encoding::Context) -> usize {
299 std::mem::size_of::<u32>()
300 }
301
302 #[inline(always)]
303 fn encode_is_copy() -> bool {
304 true
305 }
306
307 #[inline(always)]
308 fn decode_is_copy() -> bool {
309 false
310 }
311 }
312
313 impl fidl::encoding::ValueTypeMarker for DiffType {
314 type Borrowed<'a> = Self;
315 #[inline(always)]
316 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
317 *value
318 }
319 }
320
321 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DiffType {
322 #[inline]
323 unsafe fn encode(
324 self,
325 encoder: &mut fidl::encoding::Encoder<'_, D>,
326 offset: usize,
327 _depth: fidl::encoding::Depth,
328 ) -> fidl::Result<()> {
329 encoder.debug_check_bounds::<Self>(offset);
330 encoder.write_num(self.into_primitive(), offset);
331 Ok(())
332 }
333 }
334
335 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DiffType {
336 #[inline(always)]
337 fn new_empty() -> Self {
338 Self::Full
339 }
340
341 #[inline]
342 unsafe fn decode(
343 &mut self,
344 decoder: &mut fidl::encoding::Decoder<'_, D>,
345 offset: usize,
346 _depth: fidl::encoding::Depth,
347 ) -> fidl::Result<()> {
348 decoder.debug_check_bounds::<Self>(offset);
349 let prim = decoder.read_num::<u32>(offset);
350
351 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
352 Ok(())
353 }
354 }
355 unsafe impl fidl::encoding::TypeMarker for TestResult {
356 type Owned = Self;
357
358 #[inline(always)]
359 fn inline_align(_context: fidl::encoding::Context) -> usize {
360 std::mem::align_of::<u32>()
361 }
362
363 #[inline(always)]
364 fn inline_size(_context: fidl::encoding::Context) -> usize {
365 std::mem::size_of::<u32>()
366 }
367
368 #[inline(always)]
369 fn encode_is_copy() -> bool {
370 true
371 }
372
373 #[inline(always)]
374 fn decode_is_copy() -> bool {
375 false
376 }
377 }
378
379 impl fidl::encoding::ValueTypeMarker for TestResult {
380 type Borrowed<'a> = Self;
381 #[inline(always)]
382 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
383 *value
384 }
385 }
386
387 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TestResult {
388 #[inline]
389 unsafe fn encode(
390 self,
391 encoder: &mut fidl::encoding::Encoder<'_, D>,
392 offset: usize,
393 _depth: fidl::encoding::Depth,
394 ) -> fidl::Result<()> {
395 encoder.debug_check_bounds::<Self>(offset);
396 encoder.write_num(self.into_primitive(), offset);
397 Ok(())
398 }
399 }
400
401 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestResult {
402 #[inline(always)]
403 fn new_empty() -> Self {
404 Self::Ok
405 }
406
407 #[inline]
408 unsafe fn decode(
409 &mut self,
410 decoder: &mut fidl::encoding::Decoder<'_, D>,
411 offset: usize,
412 _depth: fidl::encoding::Depth,
413 ) -> fidl::Result<()> {
414 decoder.debug_check_bounds::<Self>(offset);
415 let prim = decoder.read_num::<u32>(offset);
416
417 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
418 Ok(())
419 }
420 }
421
422 impl fidl::encoding::ValueTypeMarker for CreateBytesProperty {
423 type Borrowed<'a> = &'a Self;
424 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
425 value
426 }
427 }
428
429 unsafe impl fidl::encoding::TypeMarker for CreateBytesProperty {
430 type Owned = Self;
431
432 #[inline(always)]
433 fn inline_align(_context: fidl::encoding::Context) -> usize {
434 8
435 }
436
437 #[inline(always)]
438 fn inline_size(_context: fidl::encoding::Context) -> usize {
439 40
440 }
441 }
442
443 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateBytesProperty, D>
444 for &CreateBytesProperty
445 {
446 #[inline]
447 unsafe fn encode(
448 self,
449 encoder: &mut fidl::encoding::Encoder<'_, D>,
450 offset: usize,
451 _depth: fidl::encoding::Depth,
452 ) -> fidl::Result<()> {
453 encoder.debug_check_bounds::<CreateBytesProperty>(offset);
454 fidl::encoding::Encode::<CreateBytesProperty, D>::encode(
456 (
457 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.parent),
458 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
459 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
460 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
461 ),
462 encoder, offset, _depth
463 )
464 }
465 }
466 unsafe impl<
467 D: fidl::encoding::ResourceDialect,
468 T0: fidl::encoding::Encode<u32, D>,
469 T1: fidl::encoding::Encode<u32, D>,
470 T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
471 T3: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
472 > fidl::encoding::Encode<CreateBytesProperty, D> for (T0, T1, T2, T3)
473 {
474 #[inline]
475 unsafe fn encode(
476 self,
477 encoder: &mut fidl::encoding::Encoder<'_, D>,
478 offset: usize,
479 depth: fidl::encoding::Depth,
480 ) -> fidl::Result<()> {
481 encoder.debug_check_bounds::<CreateBytesProperty>(offset);
482 self.0.encode(encoder, offset + 0, depth)?;
486 self.1.encode(encoder, offset + 4, depth)?;
487 self.2.encode(encoder, offset + 8, depth)?;
488 self.3.encode(encoder, offset + 24, depth)?;
489 Ok(())
490 }
491 }
492
493 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateBytesProperty {
494 #[inline(always)]
495 fn new_empty() -> Self {
496 Self {
497 parent: fidl::new_empty!(u32, D),
498 id: fidl::new_empty!(u32, D),
499 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
500 value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
501 }
502 }
503
504 #[inline]
505 unsafe fn decode(
506 &mut self,
507 decoder: &mut fidl::encoding::Decoder<'_, D>,
508 offset: usize,
509 _depth: fidl::encoding::Depth,
510 ) -> fidl::Result<()> {
511 decoder.debug_check_bounds::<Self>(offset);
512 fidl::decode!(u32, D, &mut self.parent, decoder, offset + 0, _depth)?;
514 fidl::decode!(u32, D, &mut self.id, decoder, offset + 4, _depth)?;
515 fidl::decode!(
516 fidl::encoding::UnboundedString,
517 D,
518 &mut self.name,
519 decoder,
520 offset + 8,
521 _depth
522 )?;
523 fidl::decode!(
524 fidl::encoding::UnboundedVector<u8>,
525 D,
526 &mut self.value,
527 decoder,
528 offset + 24,
529 _depth
530 )?;
531 Ok(())
532 }
533 }
534
535 impl fidl::encoding::ValueTypeMarker for CreateNode {
536 type Borrowed<'a> = &'a Self;
537 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
538 value
539 }
540 }
541
542 unsafe impl fidl::encoding::TypeMarker for CreateNode {
543 type Owned = Self;
544
545 #[inline(always)]
546 fn inline_align(_context: fidl::encoding::Context) -> usize {
547 8
548 }
549
550 #[inline(always)]
551 fn inline_size(_context: fidl::encoding::Context) -> usize {
552 24
553 }
554 }
555
556 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateNode, D>
557 for &CreateNode
558 {
559 #[inline]
560 unsafe fn encode(
561 self,
562 encoder: &mut fidl::encoding::Encoder<'_, D>,
563 offset: usize,
564 _depth: fidl::encoding::Depth,
565 ) -> fidl::Result<()> {
566 encoder.debug_check_bounds::<CreateNode>(offset);
567 fidl::encoding::Encode::<CreateNode, D>::encode(
569 (
570 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.parent),
571 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
572 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
573 &self.name,
574 ),
575 ),
576 encoder,
577 offset,
578 _depth,
579 )
580 }
581 }
582 unsafe impl<
583 D: fidl::encoding::ResourceDialect,
584 T0: fidl::encoding::Encode<u32, D>,
585 T1: fidl::encoding::Encode<u32, D>,
586 T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
587 > fidl::encoding::Encode<CreateNode, D> for (T0, T1, T2)
588 {
589 #[inline]
590 unsafe fn encode(
591 self,
592 encoder: &mut fidl::encoding::Encoder<'_, D>,
593 offset: usize,
594 depth: fidl::encoding::Depth,
595 ) -> fidl::Result<()> {
596 encoder.debug_check_bounds::<CreateNode>(offset);
597 self.0.encode(encoder, offset + 0, depth)?;
601 self.1.encode(encoder, offset + 4, depth)?;
602 self.2.encode(encoder, offset + 8, depth)?;
603 Ok(())
604 }
605 }
606
607 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateNode {
608 #[inline(always)]
609 fn new_empty() -> Self {
610 Self {
611 parent: fidl::new_empty!(u32, D),
612 id: fidl::new_empty!(u32, D),
613 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
614 }
615 }
616
617 #[inline]
618 unsafe fn decode(
619 &mut self,
620 decoder: &mut fidl::encoding::Decoder<'_, D>,
621 offset: usize,
622 _depth: fidl::encoding::Depth,
623 ) -> fidl::Result<()> {
624 decoder.debug_check_bounds::<Self>(offset);
625 fidl::decode!(u32, D, &mut self.parent, decoder, offset + 0, _depth)?;
627 fidl::decode!(u32, D, &mut self.id, decoder, offset + 4, _depth)?;
628 fidl::decode!(
629 fidl::encoding::UnboundedString,
630 D,
631 &mut self.name,
632 decoder,
633 offset + 8,
634 _depth
635 )?;
636 Ok(())
637 }
638 }
639
640 impl fidl::encoding::ValueTypeMarker for CreateNumericProperty {
641 type Borrowed<'a> = &'a Self;
642 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
643 value
644 }
645 }
646
647 unsafe impl fidl::encoding::TypeMarker for CreateNumericProperty {
648 type Owned = Self;
649
650 #[inline(always)]
651 fn inline_align(_context: fidl::encoding::Context) -> usize {
652 8
653 }
654
655 #[inline(always)]
656 fn inline_size(_context: fidl::encoding::Context) -> usize {
657 40
658 }
659 }
660
661 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateNumericProperty, D>
662 for &CreateNumericProperty
663 {
664 #[inline]
665 unsafe fn encode(
666 self,
667 encoder: &mut fidl::encoding::Encoder<'_, D>,
668 offset: usize,
669 _depth: fidl::encoding::Depth,
670 ) -> fidl::Result<()> {
671 encoder.debug_check_bounds::<CreateNumericProperty>(offset);
672 fidl::encoding::Encode::<CreateNumericProperty, D>::encode(
674 (
675 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.parent),
676 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
677 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
678 &self.name,
679 ),
680 <Value as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
681 ),
682 encoder,
683 offset,
684 _depth,
685 )
686 }
687 }
688 unsafe impl<
689 D: fidl::encoding::ResourceDialect,
690 T0: fidl::encoding::Encode<u32, D>,
691 T1: fidl::encoding::Encode<u32, D>,
692 T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
693 T3: fidl::encoding::Encode<Value, D>,
694 > fidl::encoding::Encode<CreateNumericProperty, D> for (T0, T1, T2, T3)
695 {
696 #[inline]
697 unsafe fn encode(
698 self,
699 encoder: &mut fidl::encoding::Encoder<'_, D>,
700 offset: usize,
701 depth: fidl::encoding::Depth,
702 ) -> fidl::Result<()> {
703 encoder.debug_check_bounds::<CreateNumericProperty>(offset);
704 self.0.encode(encoder, offset + 0, depth)?;
708 self.1.encode(encoder, offset + 4, depth)?;
709 self.2.encode(encoder, offset + 8, depth)?;
710 self.3.encode(encoder, offset + 24, depth)?;
711 Ok(())
712 }
713 }
714
715 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateNumericProperty {
716 #[inline(always)]
717 fn new_empty() -> Self {
718 Self {
719 parent: fidl::new_empty!(u32, D),
720 id: fidl::new_empty!(u32, D),
721 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
722 value: fidl::new_empty!(Value, D),
723 }
724 }
725
726 #[inline]
727 unsafe fn decode(
728 &mut self,
729 decoder: &mut fidl::encoding::Decoder<'_, D>,
730 offset: usize,
731 _depth: fidl::encoding::Depth,
732 ) -> fidl::Result<()> {
733 decoder.debug_check_bounds::<Self>(offset);
734 fidl::decode!(u32, D, &mut self.parent, decoder, offset + 0, _depth)?;
736 fidl::decode!(u32, D, &mut self.id, decoder, offset + 4, _depth)?;
737 fidl::decode!(
738 fidl::encoding::UnboundedString,
739 D,
740 &mut self.name,
741 decoder,
742 offset + 8,
743 _depth
744 )?;
745 fidl::decode!(Value, D, &mut self.value, decoder, offset + 24, _depth)?;
746 Ok(())
747 }
748 }
749
750 impl fidl::encoding::ValueTypeMarker for DeleteNode {
751 type Borrowed<'a> = &'a Self;
752 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
753 value
754 }
755 }
756
757 unsafe impl fidl::encoding::TypeMarker for DeleteNode {
758 type Owned = Self;
759
760 #[inline(always)]
761 fn inline_align(_context: fidl::encoding::Context) -> usize {
762 4
763 }
764
765 #[inline(always)]
766 fn inline_size(_context: fidl::encoding::Context) -> usize {
767 4
768 }
769 #[inline(always)]
770 fn encode_is_copy() -> bool {
771 true
772 }
773
774 #[inline(always)]
775 fn decode_is_copy() -> bool {
776 true
777 }
778 }
779
780 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeleteNode, D>
781 for &DeleteNode
782 {
783 #[inline]
784 unsafe fn encode(
785 self,
786 encoder: &mut fidl::encoding::Encoder<'_, D>,
787 offset: usize,
788 _depth: fidl::encoding::Depth,
789 ) -> fidl::Result<()> {
790 encoder.debug_check_bounds::<DeleteNode>(offset);
791 unsafe {
792 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
794 (buf_ptr as *mut DeleteNode).write_unaligned((self as *const DeleteNode).read());
795 }
798 Ok(())
799 }
800 }
801 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
802 fidl::encoding::Encode<DeleteNode, D> for (T0,)
803 {
804 #[inline]
805 unsafe fn encode(
806 self,
807 encoder: &mut fidl::encoding::Encoder<'_, D>,
808 offset: usize,
809 depth: fidl::encoding::Depth,
810 ) -> fidl::Result<()> {
811 encoder.debug_check_bounds::<DeleteNode>(offset);
812 self.0.encode(encoder, offset + 0, depth)?;
816 Ok(())
817 }
818 }
819
820 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeleteNode {
821 #[inline(always)]
822 fn new_empty() -> Self {
823 Self { id: fidl::new_empty!(u32, D) }
824 }
825
826 #[inline]
827 unsafe fn decode(
828 &mut self,
829 decoder: &mut fidl::encoding::Decoder<'_, D>,
830 offset: usize,
831 _depth: fidl::encoding::Depth,
832 ) -> fidl::Result<()> {
833 decoder.debug_check_bounds::<Self>(offset);
834 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
835 unsafe {
838 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
839 }
840 Ok(())
841 }
842 }
843
844 impl fidl::encoding::ValueTypeMarker for InspectPuppetActRequest {
845 type Borrowed<'a> = &'a Self;
846 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
847 value
848 }
849 }
850
851 unsafe impl fidl::encoding::TypeMarker for InspectPuppetActRequest {
852 type Owned = Self;
853
854 #[inline(always)]
855 fn inline_align(_context: fidl::encoding::Context) -> usize {
856 8
857 }
858
859 #[inline(always)]
860 fn inline_size(_context: fidl::encoding::Context) -> usize {
861 16
862 }
863 }
864
865 unsafe impl<D: fidl::encoding::ResourceDialect>
866 fidl::encoding::Encode<InspectPuppetActRequest, D> for &InspectPuppetActRequest
867 {
868 #[inline]
869 unsafe fn encode(
870 self,
871 encoder: &mut fidl::encoding::Encoder<'_, D>,
872 offset: usize,
873 _depth: fidl::encoding::Depth,
874 ) -> fidl::Result<()> {
875 encoder.debug_check_bounds::<InspectPuppetActRequest>(offset);
876 fidl::encoding::Encode::<InspectPuppetActRequest, D>::encode(
878 (<Action as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
879 encoder,
880 offset,
881 _depth,
882 )
883 }
884 }
885 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Action, D>>
886 fidl::encoding::Encode<InspectPuppetActRequest, D> for (T0,)
887 {
888 #[inline]
889 unsafe fn encode(
890 self,
891 encoder: &mut fidl::encoding::Encoder<'_, D>,
892 offset: usize,
893 depth: fidl::encoding::Depth,
894 ) -> fidl::Result<()> {
895 encoder.debug_check_bounds::<InspectPuppetActRequest>(offset);
896 self.0.encode(encoder, offset + 0, depth)?;
900 Ok(())
901 }
902 }
903
904 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
905 for InspectPuppetActRequest
906 {
907 #[inline(always)]
908 fn new_empty() -> Self {
909 Self { action: fidl::new_empty!(Action, D) }
910 }
911
912 #[inline]
913 unsafe fn decode(
914 &mut self,
915 decoder: &mut fidl::encoding::Decoder<'_, D>,
916 offset: usize,
917 _depth: fidl::encoding::Depth,
918 ) -> fidl::Result<()> {
919 decoder.debug_check_bounds::<Self>(offset);
920 fidl::decode!(Action, D, &mut self.action, decoder, offset + 0, _depth)?;
922 Ok(())
923 }
924 }
925
926 impl fidl::encoding::ValueTypeMarker for InspectPuppetActResponse {
927 type Borrowed<'a> = &'a Self;
928 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
929 value
930 }
931 }
932
933 unsafe impl fidl::encoding::TypeMarker for InspectPuppetActResponse {
934 type Owned = Self;
935
936 #[inline(always)]
937 fn inline_align(_context: fidl::encoding::Context) -> usize {
938 4
939 }
940
941 #[inline(always)]
942 fn inline_size(_context: fidl::encoding::Context) -> usize {
943 4
944 }
945 }
946
947 unsafe impl<D: fidl::encoding::ResourceDialect>
948 fidl::encoding::Encode<InspectPuppetActResponse, D> for &InspectPuppetActResponse
949 {
950 #[inline]
951 unsafe fn encode(
952 self,
953 encoder: &mut fidl::encoding::Encoder<'_, D>,
954 offset: usize,
955 _depth: fidl::encoding::Depth,
956 ) -> fidl::Result<()> {
957 encoder.debug_check_bounds::<InspectPuppetActResponse>(offset);
958 fidl::encoding::Encode::<InspectPuppetActResponse, D>::encode(
960 (<TestResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
961 encoder,
962 offset,
963 _depth,
964 )
965 }
966 }
967 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TestResult, D>>
968 fidl::encoding::Encode<InspectPuppetActResponse, D> for (T0,)
969 {
970 #[inline]
971 unsafe fn encode(
972 self,
973 encoder: &mut fidl::encoding::Encoder<'_, D>,
974 offset: usize,
975 depth: fidl::encoding::Depth,
976 ) -> fidl::Result<()> {
977 encoder.debug_check_bounds::<InspectPuppetActResponse>(offset);
978 self.0.encode(encoder, offset + 0, depth)?;
982 Ok(())
983 }
984 }
985
986 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
987 for InspectPuppetActResponse
988 {
989 #[inline(always)]
990 fn new_empty() -> Self {
991 Self { result: fidl::new_empty!(TestResult, D) }
992 }
993
994 #[inline]
995 unsafe fn decode(
996 &mut self,
997 decoder: &mut fidl::encoding::Decoder<'_, D>,
998 offset: usize,
999 _depth: fidl::encoding::Depth,
1000 ) -> fidl::Result<()> {
1001 decoder.debug_check_bounds::<Self>(offset);
1002 fidl::decode!(TestResult, D, &mut self.result, decoder, offset + 0, _depth)?;
1004 Ok(())
1005 }
1006 }
1007
1008 impl fidl::encoding::ValueTypeMarker for InspectPuppetInitializeRequest {
1009 type Borrowed<'a> = &'a Self;
1010 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1011 value
1012 }
1013 }
1014
1015 unsafe impl fidl::encoding::TypeMarker for InspectPuppetInitializeRequest {
1016 type Owned = Self;
1017
1018 #[inline(always)]
1019 fn inline_align(_context: fidl::encoding::Context) -> usize {
1020 8
1021 }
1022
1023 #[inline(always)]
1024 fn inline_size(_context: fidl::encoding::Context) -> usize {
1025 16
1026 }
1027 }
1028
1029 unsafe impl<D: fidl::encoding::ResourceDialect>
1030 fidl::encoding::Encode<InspectPuppetInitializeRequest, D>
1031 for &InspectPuppetInitializeRequest
1032 {
1033 #[inline]
1034 unsafe fn encode(
1035 self,
1036 encoder: &mut fidl::encoding::Encoder<'_, D>,
1037 offset: usize,
1038 _depth: fidl::encoding::Depth,
1039 ) -> fidl::Result<()> {
1040 encoder.debug_check_bounds::<InspectPuppetInitializeRequest>(offset);
1041 fidl::encoding::Encode::<InspectPuppetInitializeRequest, D>::encode(
1043 (<InitializationParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),),
1044 encoder,
1045 offset,
1046 _depth,
1047 )
1048 }
1049 }
1050 unsafe impl<
1051 D: fidl::encoding::ResourceDialect,
1052 T0: fidl::encoding::Encode<InitializationParams, D>,
1053 > fidl::encoding::Encode<InspectPuppetInitializeRequest, D> for (T0,)
1054 {
1055 #[inline]
1056 unsafe fn encode(
1057 self,
1058 encoder: &mut fidl::encoding::Encoder<'_, D>,
1059 offset: usize,
1060 depth: fidl::encoding::Depth,
1061 ) -> fidl::Result<()> {
1062 encoder.debug_check_bounds::<InspectPuppetInitializeRequest>(offset);
1063 self.0.encode(encoder, offset + 0, depth)?;
1067 Ok(())
1068 }
1069 }
1070
1071 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1072 for InspectPuppetInitializeRequest
1073 {
1074 #[inline(always)]
1075 fn new_empty() -> Self {
1076 Self { params: fidl::new_empty!(InitializationParams, D) }
1077 }
1078
1079 #[inline]
1080 unsafe fn decode(
1081 &mut self,
1082 decoder: &mut fidl::encoding::Decoder<'_, D>,
1083 offset: usize,
1084 _depth: fidl::encoding::Depth,
1085 ) -> fidl::Result<()> {
1086 decoder.debug_check_bounds::<Self>(offset);
1087 fidl::decode!(InitializationParams, D, &mut self.params, decoder, offset + 0, _depth)?;
1089 Ok(())
1090 }
1091 }
1092
1093 impl fidl::encoding::ValueTypeMarker for InspectPuppetPublishResponse {
1094 type Borrowed<'a> = &'a Self;
1095 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1096 value
1097 }
1098 }
1099
1100 unsafe impl fidl::encoding::TypeMarker for InspectPuppetPublishResponse {
1101 type Owned = Self;
1102
1103 #[inline(always)]
1104 fn inline_align(_context: fidl::encoding::Context) -> usize {
1105 4
1106 }
1107
1108 #[inline(always)]
1109 fn inline_size(_context: fidl::encoding::Context) -> usize {
1110 4
1111 }
1112 }
1113
1114 unsafe impl<D: fidl::encoding::ResourceDialect>
1115 fidl::encoding::Encode<InspectPuppetPublishResponse, D> for &InspectPuppetPublishResponse
1116 {
1117 #[inline]
1118 unsafe fn encode(
1119 self,
1120 encoder: &mut fidl::encoding::Encoder<'_, D>,
1121 offset: usize,
1122 _depth: fidl::encoding::Depth,
1123 ) -> fidl::Result<()> {
1124 encoder.debug_check_bounds::<InspectPuppetPublishResponse>(offset);
1125 fidl::encoding::Encode::<InspectPuppetPublishResponse, D>::encode(
1127 (<TestResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
1128 encoder,
1129 offset,
1130 _depth,
1131 )
1132 }
1133 }
1134 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TestResult, D>>
1135 fidl::encoding::Encode<InspectPuppetPublishResponse, D> for (T0,)
1136 {
1137 #[inline]
1138 unsafe fn encode(
1139 self,
1140 encoder: &mut fidl::encoding::Encoder<'_, D>,
1141 offset: usize,
1142 depth: fidl::encoding::Depth,
1143 ) -> fidl::Result<()> {
1144 encoder.debug_check_bounds::<InspectPuppetPublishResponse>(offset);
1145 self.0.encode(encoder, offset + 0, depth)?;
1149 Ok(())
1150 }
1151 }
1152
1153 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1154 for InspectPuppetPublishResponse
1155 {
1156 #[inline(always)]
1157 fn new_empty() -> Self {
1158 Self { result: fidl::new_empty!(TestResult, D) }
1159 }
1160
1161 #[inline]
1162 unsafe fn decode(
1163 &mut self,
1164 decoder: &mut fidl::encoding::Decoder<'_, D>,
1165 offset: usize,
1166 _depth: fidl::encoding::Depth,
1167 ) -> fidl::Result<()> {
1168 decoder.debug_check_bounds::<Self>(offset);
1169 fidl::decode!(TestResult, D, &mut self.result, decoder, offset + 0, _depth)?;
1171 Ok(())
1172 }
1173 }
1174
1175 impl InitializationParams {
1176 #[inline(always)]
1177 fn max_ordinal_present(&self) -> u64 {
1178 if let Some(_) = self.vmo_size {
1179 return 1;
1180 }
1181 0
1182 }
1183 }
1184
1185 impl fidl::encoding::ValueTypeMarker for InitializationParams {
1186 type Borrowed<'a> = &'a Self;
1187 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1188 value
1189 }
1190 }
1191
1192 unsafe impl fidl::encoding::TypeMarker for InitializationParams {
1193 type Owned = Self;
1194
1195 #[inline(always)]
1196 fn inline_align(_context: fidl::encoding::Context) -> usize {
1197 8
1198 }
1199
1200 #[inline(always)]
1201 fn inline_size(_context: fidl::encoding::Context) -> usize {
1202 16
1203 }
1204 }
1205
1206 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InitializationParams, D>
1207 for &InitializationParams
1208 {
1209 unsafe fn encode(
1210 self,
1211 encoder: &mut fidl::encoding::Encoder<'_, D>,
1212 offset: usize,
1213 mut depth: fidl::encoding::Depth,
1214 ) -> fidl::Result<()> {
1215 encoder.debug_check_bounds::<InitializationParams>(offset);
1216 let max_ordinal: u64 = self.max_ordinal_present();
1218 encoder.write_num(max_ordinal, offset);
1219 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1220 if max_ordinal == 0 {
1222 return Ok(());
1223 }
1224 depth.increment()?;
1225 let envelope_size = 8;
1226 let bytes_len = max_ordinal as usize * envelope_size;
1227 #[allow(unused_variables)]
1228 let offset = encoder.out_of_line_offset(bytes_len);
1229 let mut _prev_end_offset: usize = 0;
1230 if 1 > max_ordinal {
1231 return Ok(());
1232 }
1233
1234 let cur_offset: usize = (1 - 1) * envelope_size;
1237
1238 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1240
1241 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1246 self.vmo_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1247 encoder,
1248 offset + cur_offset,
1249 depth,
1250 )?;
1251
1252 _prev_end_offset = cur_offset + envelope_size;
1253
1254 Ok(())
1255 }
1256 }
1257
1258 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InitializationParams {
1259 #[inline(always)]
1260 fn new_empty() -> Self {
1261 Self::default()
1262 }
1263
1264 unsafe fn decode(
1265 &mut self,
1266 decoder: &mut fidl::encoding::Decoder<'_, D>,
1267 offset: usize,
1268 mut depth: fidl::encoding::Depth,
1269 ) -> fidl::Result<()> {
1270 decoder.debug_check_bounds::<Self>(offset);
1271 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1272 None => return Err(fidl::Error::NotNullable),
1273 Some(len) => len,
1274 };
1275 if len == 0 {
1277 return Ok(());
1278 };
1279 depth.increment()?;
1280 let envelope_size = 8;
1281 let bytes_len = len * envelope_size;
1282 let offset = decoder.out_of_line_offset(bytes_len)?;
1283 let mut _next_ordinal_to_read = 0;
1285 let mut next_offset = offset;
1286 let end_offset = offset + bytes_len;
1287 _next_ordinal_to_read += 1;
1288 if next_offset >= end_offset {
1289 return Ok(());
1290 }
1291
1292 while _next_ordinal_to_read < 1 {
1294 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1295 _next_ordinal_to_read += 1;
1296 next_offset += envelope_size;
1297 }
1298
1299 let next_out_of_line = decoder.next_out_of_line();
1300 let handles_before = decoder.remaining_handles();
1301 if let Some((inlined, num_bytes, num_handles)) =
1302 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1303 {
1304 let member_inline_size =
1305 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1306 if inlined != (member_inline_size <= 4) {
1307 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1308 }
1309 let inner_offset;
1310 let mut inner_depth = depth.clone();
1311 if inlined {
1312 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1313 inner_offset = next_offset;
1314 } else {
1315 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1316 inner_depth.increment()?;
1317 }
1318 let val_ref = self.vmo_size.get_or_insert_with(|| fidl::new_empty!(u64, D));
1319 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1320 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1321 {
1322 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1323 }
1324 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1325 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1326 }
1327 }
1328
1329 next_offset += envelope_size;
1330
1331 while next_offset < end_offset {
1333 _next_ordinal_to_read += 1;
1334 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1335 next_offset += envelope_size;
1336 }
1337
1338 Ok(())
1339 }
1340 }
1341
1342 impl fidl::encoding::ValueTypeMarker for Action {
1343 type Borrowed<'a> = &'a Self;
1344 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1345 value
1346 }
1347 }
1348
1349 unsafe impl fidl::encoding::TypeMarker for Action {
1350 type Owned = Self;
1351
1352 #[inline(always)]
1353 fn inline_align(_context: fidl::encoding::Context) -> usize {
1354 8
1355 }
1356
1357 #[inline(always)]
1358 fn inline_size(_context: fidl::encoding::Context) -> usize {
1359 16
1360 }
1361 }
1362
1363 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
1364 #[inline]
1365 unsafe fn encode(
1366 self,
1367 encoder: &mut fidl::encoding::Encoder<'_, D>,
1368 offset: usize,
1369 _depth: fidl::encoding::Depth,
1370 ) -> fidl::Result<()> {
1371 encoder.debug_check_bounds::<Action>(offset);
1372 encoder.write_num::<u64>(self.ordinal(), offset);
1373 match self {
1374 Action::CreateNode(ref val) => fidl::encoding::encode_in_envelope::<CreateNode, D>(
1375 <CreateNode as fidl::encoding::ValueTypeMarker>::borrow(val),
1376 encoder,
1377 offset + 8,
1378 _depth,
1379 ),
1380 Action::DeleteNode(ref val) => fidl::encoding::encode_in_envelope::<DeleteNode, D>(
1381 <DeleteNode as fidl::encoding::ValueTypeMarker>::borrow(val),
1382 encoder,
1383 offset + 8,
1384 _depth,
1385 ),
1386 Action::CreateNumericProperty(ref val) => {
1387 fidl::encoding::encode_in_envelope::<CreateNumericProperty, D>(
1388 <CreateNumericProperty as fidl::encoding::ValueTypeMarker>::borrow(val),
1389 encoder,
1390 offset + 8,
1391 _depth,
1392 )
1393 }
1394 Action::CreateBytesProperty(ref val) => {
1395 fidl::encoding::encode_in_envelope::<CreateBytesProperty, D>(
1396 <CreateBytesProperty as fidl::encoding::ValueTypeMarker>::borrow(val),
1397 encoder,
1398 offset + 8,
1399 _depth,
1400 )
1401 }
1402 Action::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1403 }
1404 }
1405 }
1406
1407 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
1408 #[inline(always)]
1409 fn new_empty() -> Self {
1410 Self::__SourceBreaking { unknown_ordinal: 0 }
1411 }
1412
1413 #[inline]
1414 unsafe fn decode(
1415 &mut self,
1416 decoder: &mut fidl::encoding::Decoder<'_, D>,
1417 offset: usize,
1418 mut depth: fidl::encoding::Depth,
1419 ) -> fidl::Result<()> {
1420 decoder.debug_check_bounds::<Self>(offset);
1421 #[allow(unused_variables)]
1422 let next_out_of_line = decoder.next_out_of_line();
1423 let handles_before = decoder.remaining_handles();
1424 let (ordinal, inlined, num_bytes, num_handles) =
1425 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1426
1427 let member_inline_size = match ordinal {
1428 1 => <CreateNode as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1429 2 => <DeleteNode as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1430 3 => <CreateNumericProperty as fidl::encoding::TypeMarker>::inline_size(
1431 decoder.context,
1432 ),
1433 4 => <CreateBytesProperty as fidl::encoding::TypeMarker>::inline_size(
1434 decoder.context,
1435 ),
1436 0 => return Err(fidl::Error::UnknownUnionTag),
1437 _ => num_bytes as usize,
1438 };
1439
1440 if inlined != (member_inline_size <= 4) {
1441 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1442 }
1443 let _inner_offset;
1444 if inlined {
1445 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1446 _inner_offset = offset + 8;
1447 } else {
1448 depth.increment()?;
1449 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1450 }
1451 match ordinal {
1452 1 => {
1453 #[allow(irrefutable_let_patterns)]
1454 if let Action::CreateNode(_) = self {
1455 } else {
1457 *self = Action::CreateNode(fidl::new_empty!(CreateNode, D));
1459 }
1460 #[allow(irrefutable_let_patterns)]
1461 if let Action::CreateNode(ref mut val) = self {
1462 fidl::decode!(CreateNode, D, val, decoder, _inner_offset, depth)?;
1463 } else {
1464 unreachable!()
1465 }
1466 }
1467 2 => {
1468 #[allow(irrefutable_let_patterns)]
1469 if let Action::DeleteNode(_) = self {
1470 } else {
1472 *self = Action::DeleteNode(fidl::new_empty!(DeleteNode, D));
1474 }
1475 #[allow(irrefutable_let_patterns)]
1476 if let Action::DeleteNode(ref mut val) = self {
1477 fidl::decode!(DeleteNode, D, val, decoder, _inner_offset, depth)?;
1478 } else {
1479 unreachable!()
1480 }
1481 }
1482 3 => {
1483 #[allow(irrefutable_let_patterns)]
1484 if let Action::CreateNumericProperty(_) = self {
1485 } else {
1487 *self = Action::CreateNumericProperty(fidl::new_empty!(
1489 CreateNumericProperty,
1490 D
1491 ));
1492 }
1493 #[allow(irrefutable_let_patterns)]
1494 if let Action::CreateNumericProperty(ref mut val) = self {
1495 fidl::decode!(
1496 CreateNumericProperty,
1497 D,
1498 val,
1499 decoder,
1500 _inner_offset,
1501 depth
1502 )?;
1503 } else {
1504 unreachable!()
1505 }
1506 }
1507 4 => {
1508 #[allow(irrefutable_let_patterns)]
1509 if let Action::CreateBytesProperty(_) = self {
1510 } else {
1512 *self =
1514 Action::CreateBytesProperty(fidl::new_empty!(CreateBytesProperty, D));
1515 }
1516 #[allow(irrefutable_let_patterns)]
1517 if let Action::CreateBytesProperty(ref mut val) = self {
1518 fidl::decode!(CreateBytesProperty, D, val, decoder, _inner_offset, depth)?;
1519 } else {
1520 unreachable!()
1521 }
1522 }
1523 #[allow(deprecated)]
1524 ordinal => {
1525 for _ in 0..num_handles {
1526 decoder.drop_next_handle()?;
1527 }
1528 *self = Action::__SourceBreaking { unknown_ordinal: ordinal };
1529 }
1530 }
1531 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1532 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1533 }
1534 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1535 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1536 }
1537 Ok(())
1538 }
1539 }
1540
1541 impl fidl::encoding::ValueTypeMarker for Value {
1542 type Borrowed<'a> = &'a Self;
1543 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1544 value
1545 }
1546 }
1547
1548 unsafe impl fidl::encoding::TypeMarker for Value {
1549 type Owned = Self;
1550
1551 #[inline(always)]
1552 fn inline_align(_context: fidl::encoding::Context) -> usize {
1553 8
1554 }
1555
1556 #[inline(always)]
1557 fn inline_size(_context: fidl::encoding::Context) -> usize {
1558 16
1559 }
1560 }
1561
1562 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Value, D> for &Value {
1563 #[inline]
1564 unsafe fn encode(
1565 self,
1566 encoder: &mut fidl::encoding::Encoder<'_, D>,
1567 offset: usize,
1568 _depth: fidl::encoding::Depth,
1569 ) -> fidl::Result<()> {
1570 encoder.debug_check_bounds::<Value>(offset);
1571 encoder.write_num::<u64>(self.ordinal(), offset);
1572 match self {
1573 Value::IntT(ref val) => fidl::encoding::encode_in_envelope::<i64, D>(
1574 <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1575 encoder,
1576 offset + 8,
1577 _depth,
1578 ),
1579 Value::UintT(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
1580 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1581 encoder,
1582 offset + 8,
1583 _depth,
1584 ),
1585 Value::DoubleT(ref val) => fidl::encoding::encode_in_envelope::<f64, D>(
1586 <f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1587 encoder,
1588 offset + 8,
1589 _depth,
1590 ),
1591 Value::StringT(ref val) => fidl::encoding::encode_in_envelope::<
1592 fidl::encoding::UnboundedString,
1593 D,
1594 >(
1595 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1596 val,
1597 ),
1598 encoder,
1599 offset + 8,
1600 _depth,
1601 ),
1602 Value::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1603 }
1604 }
1605 }
1606
1607 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Value {
1608 #[inline(always)]
1609 fn new_empty() -> Self {
1610 Self::__SourceBreaking { unknown_ordinal: 0 }
1611 }
1612
1613 #[inline]
1614 unsafe fn decode(
1615 &mut self,
1616 decoder: &mut fidl::encoding::Decoder<'_, D>,
1617 offset: usize,
1618 mut depth: fidl::encoding::Depth,
1619 ) -> fidl::Result<()> {
1620 decoder.debug_check_bounds::<Self>(offset);
1621 #[allow(unused_variables)]
1622 let next_out_of_line = decoder.next_out_of_line();
1623 let handles_before = decoder.remaining_handles();
1624 let (ordinal, inlined, num_bytes, num_handles) =
1625 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1626
1627 let member_inline_size = match ordinal {
1628 1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1629 2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1630 3 => <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1631 4 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1632 decoder.context,
1633 ),
1634 0 => return Err(fidl::Error::UnknownUnionTag),
1635 _ => num_bytes as usize,
1636 };
1637
1638 if inlined != (member_inline_size <= 4) {
1639 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1640 }
1641 let _inner_offset;
1642 if inlined {
1643 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1644 _inner_offset = offset + 8;
1645 } else {
1646 depth.increment()?;
1647 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1648 }
1649 match ordinal {
1650 1 => {
1651 #[allow(irrefutable_let_patterns)]
1652 if let Value::IntT(_) = self {
1653 } else {
1655 *self = Value::IntT(fidl::new_empty!(i64, D));
1657 }
1658 #[allow(irrefutable_let_patterns)]
1659 if let Value::IntT(ref mut val) = self {
1660 fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
1661 } else {
1662 unreachable!()
1663 }
1664 }
1665 2 => {
1666 #[allow(irrefutable_let_patterns)]
1667 if let Value::UintT(_) = self {
1668 } else {
1670 *self = Value::UintT(fidl::new_empty!(u64, D));
1672 }
1673 #[allow(irrefutable_let_patterns)]
1674 if let Value::UintT(ref mut val) = self {
1675 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
1676 } else {
1677 unreachable!()
1678 }
1679 }
1680 3 => {
1681 #[allow(irrefutable_let_patterns)]
1682 if let Value::DoubleT(_) = self {
1683 } else {
1685 *self = Value::DoubleT(fidl::new_empty!(f64, D));
1687 }
1688 #[allow(irrefutable_let_patterns)]
1689 if let Value::DoubleT(ref mut val) = self {
1690 fidl::decode!(f64, D, val, decoder, _inner_offset, depth)?;
1691 } else {
1692 unreachable!()
1693 }
1694 }
1695 4 => {
1696 #[allow(irrefutable_let_patterns)]
1697 if let Value::StringT(_) = self {
1698 } else {
1700 *self =
1702 Value::StringT(fidl::new_empty!(fidl::encoding::UnboundedString, D));
1703 }
1704 #[allow(irrefutable_let_patterns)]
1705 if let Value::StringT(ref mut val) = self {
1706 fidl::decode!(
1707 fidl::encoding::UnboundedString,
1708 D,
1709 val,
1710 decoder,
1711 _inner_offset,
1712 depth
1713 )?;
1714 } else {
1715 unreachable!()
1716 }
1717 }
1718 #[allow(deprecated)]
1719 ordinal => {
1720 for _ in 0..num_handles {
1721 decoder.drop_next_handle()?;
1722 }
1723 *self = Value::__SourceBreaking { unknown_ordinal: ordinal };
1724 }
1725 }
1726 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1727 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1728 }
1729 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1730 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1731 }
1732 Ok(())
1733 }
1734 }
1735}