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