Skip to main content

fidl_fuchsia_driver_index_common/
fidl_fuchsia_driver_index_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct DevelopmentManagerDisableDriverRequest {
13    pub driver_url: String,
14    pub package_hash: Option<String>,
15}
16
17impl fidl::Persistable for DevelopmentManagerDisableDriverRequest {}
18
19#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20pub struct DevelopmentManagerEnableDriverRequest {
21    pub driver_url: String,
22    pub package_hash: Option<String>,
23}
24
25impl fidl::Persistable for DevelopmentManagerEnableDriverRequest {}
26
27#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct DevelopmentManagerRebindCompositesWithDriverRequest {
29    pub driver_url: String,
30}
31
32impl fidl::Persistable for DevelopmentManagerRebindCompositesWithDriverRequest {}
33
34#[derive(Clone, Debug, PartialEq)]
35pub struct DriverIndexMatchDriverRequest {
36    pub args: MatchDriverArgs,
37}
38
39impl fidl::Persistable for DriverIndexMatchDriverRequest {}
40
41#[derive(Clone, Debug, PartialEq)]
42pub struct DriverIndexMatchPendingNodeRequest {
43    pub dependencies: Vec<fidl_fuchsia_driver_framework_common::ParentSpec2>,
44}
45
46impl fidl::Persistable for DriverIndexMatchPendingNodeRequest {}
47
48#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49pub struct DriverIndexRebindCompositeNodeSpecRequest {
50    pub spec: String,
51    pub driver_url_suffix: Option<String>,
52}
53
54impl fidl::Persistable for DriverIndexRebindCompositeNodeSpecRequest {}
55
56#[derive(Clone, Debug, Default, PartialEq)]
57pub struct MatchDriverArgs {
58    /// Properties of the node to be matched.
59    pub properties: Option<Vec<fidl_fuchsia_driver_framework_common::NodeProperty2>>,
60    /// The name of the node to be matched. Used for debugging purposes.
61    pub name: Option<String>,
62    pub driver_url_suffix: Option<String>,
63    #[doc(hidden)]
64    pub __source_breaking: fidl::marker::SourceBreaking,
65}
66
67impl fidl::Persistable for MatchDriverArgs {}
68
69#[derive(Clone, Debug, Default, PartialEq)]
70pub struct MatchPendingNodeResult {
71    /// Information for the matched composite driver.
72    pub driver: Option<fidl_fuchsia_driver_framework_common::CompositeDriverMatch>,
73    #[doc(hidden)]
74    pub __source_breaking: fidl::marker::SourceBreaking,
75}
76
77impl fidl::Persistable for MatchPendingNodeResult {}
78
79/// Driver matched by the driver index.
80#[derive(Clone, Debug)]
81pub enum MatchDriverResult {
82    /// Information for a normal driver.
83    Driver(fidl_fuchsia_driver_framework_common::DriverInfo),
84    /// Information for a parent spec.
85    CompositeParents(Vec<fidl_fuchsia_driver_framework_common::CompositeParent>),
86    #[doc(hidden)]
87    __SourceBreaking { unknown_ordinal: u64 },
88}
89
90/// Pattern that matches an unknown `MatchDriverResult` member.
91#[macro_export]
92macro_rules! MatchDriverResultUnknown {
93    () => {
94        _
95    };
96}
97
98// Custom PartialEq so that unknown variants are not equal to themselves.
99impl PartialEq for MatchDriverResult {
100    fn eq(&self, other: &Self) -> bool {
101        match (self, other) {
102            (Self::Driver(x), Self::Driver(y)) => *x == *y,
103            (Self::CompositeParents(x), Self::CompositeParents(y)) => *x == *y,
104            _ => false,
105        }
106    }
107}
108
109impl MatchDriverResult {
110    #[inline]
111    pub fn ordinal(&self) -> u64 {
112        match *self {
113            Self::Driver(_) => 1,
114            Self::CompositeParents(_) => 2,
115            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
116        }
117    }
118
119    #[inline]
120    pub fn unknown_variant_for_testing() -> Self {
121        Self::__SourceBreaking { unknown_ordinal: 0 }
122    }
123
124    #[inline]
125    pub fn is_unknown(&self) -> bool {
126        match self {
127            Self::__SourceBreaking { .. } => true,
128            _ => false,
129        }
130    }
131}
132
133impl fidl::Persistable for MatchDriverResult {}
134
135pub mod development_manager_ordinals {
136    pub const GET_DRIVER_INFO: u64 = 0x80387b9999b4de2;
137    pub const GET_COMPOSITE_NODE_SPECS: u64 = 0x6fd4c2f5e0478970;
138    pub const DISABLE_DRIVER: u64 = 0x7a9043fc2acabf77;
139    pub const ENABLE_DRIVER: u64 = 0x4abba8d322e671d9;
140    pub const REBIND_COMPOSITES_WITH_DRIVER: u64 = 0x1da137c4f10d053c;
141}
142
143pub mod driver_index_ordinals {
144    pub const MATCH_DRIVER: u64 = 0x38317894f6269541;
145    pub const ADD_COMPOSITE_NODE_SPEC: u64 = 0x66d25a18fa46a2a2;
146    pub const REBIND_COMPOSITE_NODE_SPEC: u64 = 0x6667ac8de58b202a;
147    pub const MATCH_PENDING_NODE: u64 = 0x4bd2ee2aff5bb339;
148    pub const SET_NOTIFIER: u64 = 0x1dfdede9fcdab511;
149}
150
151pub mod driver_notifier_ordinals {
152    pub const NEW_DRIVER_AVAILABLE: u64 = 0x1642ffd065b6b48e;
153}
154
155mod internal {
156    use super::*;
157
158    impl fidl::encoding::ValueTypeMarker for DevelopmentManagerDisableDriverRequest {
159        type Borrowed<'a> = &'a Self;
160        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
161            value
162        }
163    }
164
165    unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerDisableDriverRequest {
166        type Owned = Self;
167
168        #[inline(always)]
169        fn inline_align(_context: fidl::encoding::Context) -> usize {
170            8
171        }
172
173        #[inline(always)]
174        fn inline_size(_context: fidl::encoding::Context) -> usize {
175            32
176        }
177    }
178
179    unsafe impl<D: fidl::encoding::ResourceDialect>
180        fidl::encoding::Encode<DevelopmentManagerDisableDriverRequest, D>
181        for &DevelopmentManagerDisableDriverRequest
182    {
183        #[inline]
184        unsafe fn encode(
185            self,
186            encoder: &mut fidl::encoding::Encoder<'_, D>,
187            offset: usize,
188            _depth: fidl::encoding::Depth,
189        ) -> fidl::Result<()> {
190            encoder.debug_check_bounds::<DevelopmentManagerDisableDriverRequest>(offset);
191            // Delegate to tuple encoding.
192            fidl::encoding::Encode::<DevelopmentManagerDisableDriverRequest, D>::encode(
193                (
194                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_url),
195                    <fidl::encoding::Optional<fidl::encoding::BoundedString<64>> as fidl::encoding::ValueTypeMarker>::borrow(&self.package_hash),
196                ),
197                encoder, offset, _depth
198            )
199        }
200    }
201    unsafe impl<
202        D: fidl::encoding::ResourceDialect,
203        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
204        T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<64>>, D>,
205    > fidl::encoding::Encode<DevelopmentManagerDisableDriverRequest, D> for (T0, T1)
206    {
207        #[inline]
208        unsafe fn encode(
209            self,
210            encoder: &mut fidl::encoding::Encoder<'_, D>,
211            offset: usize,
212            depth: fidl::encoding::Depth,
213        ) -> fidl::Result<()> {
214            encoder.debug_check_bounds::<DevelopmentManagerDisableDriverRequest>(offset);
215            // Zero out padding regions. There's no need to apply masks
216            // because the unmasked parts will be overwritten by fields.
217            // Write the fields.
218            self.0.encode(encoder, offset + 0, depth)?;
219            self.1.encode(encoder, offset + 16, depth)?;
220            Ok(())
221        }
222    }
223
224    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
225        for DevelopmentManagerDisableDriverRequest
226    {
227        #[inline(always)]
228        fn new_empty() -> Self {
229            Self {
230                driver_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
231                package_hash: fidl::new_empty!(
232                    fidl::encoding::Optional<fidl::encoding::BoundedString<64>>,
233                    D
234                ),
235            }
236        }
237
238        #[inline]
239        unsafe fn decode(
240            &mut self,
241            decoder: &mut fidl::encoding::Decoder<'_, D>,
242            offset: usize,
243            _depth: fidl::encoding::Depth,
244        ) -> fidl::Result<()> {
245            decoder.debug_check_bounds::<Self>(offset);
246            // Verify that padding bytes are zero.
247            fidl::decode!(
248                fidl::encoding::BoundedString<4096>,
249                D,
250                &mut self.driver_url,
251                decoder,
252                offset + 0,
253                _depth
254            )?;
255            fidl::decode!(
256                fidl::encoding::Optional<fidl::encoding::BoundedString<64>>,
257                D,
258                &mut self.package_hash,
259                decoder,
260                offset + 16,
261                _depth
262            )?;
263            Ok(())
264        }
265    }
266
267    impl fidl::encoding::ValueTypeMarker for DevelopmentManagerEnableDriverRequest {
268        type Borrowed<'a> = &'a Self;
269        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
270            value
271        }
272    }
273
274    unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerEnableDriverRequest {
275        type Owned = Self;
276
277        #[inline(always)]
278        fn inline_align(_context: fidl::encoding::Context) -> usize {
279            8
280        }
281
282        #[inline(always)]
283        fn inline_size(_context: fidl::encoding::Context) -> usize {
284            32
285        }
286    }
287
288    unsafe impl<D: fidl::encoding::ResourceDialect>
289        fidl::encoding::Encode<DevelopmentManagerEnableDriverRequest, D>
290        for &DevelopmentManagerEnableDriverRequest
291    {
292        #[inline]
293        unsafe fn encode(
294            self,
295            encoder: &mut fidl::encoding::Encoder<'_, D>,
296            offset: usize,
297            _depth: fidl::encoding::Depth,
298        ) -> fidl::Result<()> {
299            encoder.debug_check_bounds::<DevelopmentManagerEnableDriverRequest>(offset);
300            // Delegate to tuple encoding.
301            fidl::encoding::Encode::<DevelopmentManagerEnableDriverRequest, D>::encode(
302                (
303                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_url),
304                    <fidl::encoding::Optional<fidl::encoding::BoundedString<64>> as fidl::encoding::ValueTypeMarker>::borrow(&self.package_hash),
305                ),
306                encoder, offset, _depth
307            )
308        }
309    }
310    unsafe impl<
311        D: fidl::encoding::ResourceDialect,
312        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
313        T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<64>>, D>,
314    > fidl::encoding::Encode<DevelopmentManagerEnableDriverRequest, D> for (T0, T1)
315    {
316        #[inline]
317        unsafe fn encode(
318            self,
319            encoder: &mut fidl::encoding::Encoder<'_, D>,
320            offset: usize,
321            depth: fidl::encoding::Depth,
322        ) -> fidl::Result<()> {
323            encoder.debug_check_bounds::<DevelopmentManagerEnableDriverRequest>(offset);
324            // Zero out padding regions. There's no need to apply masks
325            // because the unmasked parts will be overwritten by fields.
326            // Write the fields.
327            self.0.encode(encoder, offset + 0, depth)?;
328            self.1.encode(encoder, offset + 16, depth)?;
329            Ok(())
330        }
331    }
332
333    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
334        for DevelopmentManagerEnableDriverRequest
335    {
336        #[inline(always)]
337        fn new_empty() -> Self {
338            Self {
339                driver_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
340                package_hash: fidl::new_empty!(
341                    fidl::encoding::Optional<fidl::encoding::BoundedString<64>>,
342                    D
343                ),
344            }
345        }
346
347        #[inline]
348        unsafe fn decode(
349            &mut self,
350            decoder: &mut fidl::encoding::Decoder<'_, D>,
351            offset: usize,
352            _depth: fidl::encoding::Depth,
353        ) -> fidl::Result<()> {
354            decoder.debug_check_bounds::<Self>(offset);
355            // Verify that padding bytes are zero.
356            fidl::decode!(
357                fidl::encoding::BoundedString<4096>,
358                D,
359                &mut self.driver_url,
360                decoder,
361                offset + 0,
362                _depth
363            )?;
364            fidl::decode!(
365                fidl::encoding::Optional<fidl::encoding::BoundedString<64>>,
366                D,
367                &mut self.package_hash,
368                decoder,
369                offset + 16,
370                _depth
371            )?;
372            Ok(())
373        }
374    }
375
376    impl fidl::encoding::ValueTypeMarker for DevelopmentManagerRebindCompositesWithDriverRequest {
377        type Borrowed<'a> = &'a Self;
378        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
379            value
380        }
381    }
382
383    unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerRebindCompositesWithDriverRequest {
384        type Owned = Self;
385
386        #[inline(always)]
387        fn inline_align(_context: fidl::encoding::Context) -> usize {
388            8
389        }
390
391        #[inline(always)]
392        fn inline_size(_context: fidl::encoding::Context) -> usize {
393            16
394        }
395    }
396
397    unsafe impl<D: fidl::encoding::ResourceDialect>
398        fidl::encoding::Encode<DevelopmentManagerRebindCompositesWithDriverRequest, D>
399        for &DevelopmentManagerRebindCompositesWithDriverRequest
400    {
401        #[inline]
402        unsafe fn encode(
403            self,
404            encoder: &mut fidl::encoding::Encoder<'_, D>,
405            offset: usize,
406            _depth: fidl::encoding::Depth,
407        ) -> fidl::Result<()> {
408            encoder
409                .debug_check_bounds::<DevelopmentManagerRebindCompositesWithDriverRequest>(offset);
410            // Delegate to tuple encoding.
411            fidl::encoding::Encode::<DevelopmentManagerRebindCompositesWithDriverRequest, D>::encode(
412                (<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
413                    &self.driver_url,
414                ),),
415                encoder,
416                offset,
417                _depth,
418            )
419        }
420    }
421    unsafe impl<
422        D: fidl::encoding::ResourceDialect,
423        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
424    > fidl::encoding::Encode<DevelopmentManagerRebindCompositesWithDriverRequest, D> for (T0,)
425    {
426        #[inline]
427        unsafe fn encode(
428            self,
429            encoder: &mut fidl::encoding::Encoder<'_, D>,
430            offset: usize,
431            depth: fidl::encoding::Depth,
432        ) -> fidl::Result<()> {
433            encoder
434                .debug_check_bounds::<DevelopmentManagerRebindCompositesWithDriverRequest>(offset);
435            // Zero out padding regions. There's no need to apply masks
436            // because the unmasked parts will be overwritten by fields.
437            // Write the fields.
438            self.0.encode(encoder, offset + 0, depth)?;
439            Ok(())
440        }
441    }
442
443    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
444        for DevelopmentManagerRebindCompositesWithDriverRequest
445    {
446        #[inline(always)]
447        fn new_empty() -> Self {
448            Self { driver_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
449        }
450
451        #[inline]
452        unsafe fn decode(
453            &mut self,
454            decoder: &mut fidl::encoding::Decoder<'_, D>,
455            offset: usize,
456            _depth: fidl::encoding::Depth,
457        ) -> fidl::Result<()> {
458            decoder.debug_check_bounds::<Self>(offset);
459            // Verify that padding bytes are zero.
460            fidl::decode!(
461                fidl::encoding::BoundedString<4096>,
462                D,
463                &mut self.driver_url,
464                decoder,
465                offset + 0,
466                _depth
467            )?;
468            Ok(())
469        }
470    }
471
472    impl fidl::encoding::ValueTypeMarker for DriverIndexMatchDriverRequest {
473        type Borrowed<'a> = &'a Self;
474        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
475            value
476        }
477    }
478
479    unsafe impl fidl::encoding::TypeMarker for DriverIndexMatchDriverRequest {
480        type Owned = Self;
481
482        #[inline(always)]
483        fn inline_align(_context: fidl::encoding::Context) -> usize {
484            8
485        }
486
487        #[inline(always)]
488        fn inline_size(_context: fidl::encoding::Context) -> usize {
489            16
490        }
491    }
492
493    unsafe impl<D: fidl::encoding::ResourceDialect>
494        fidl::encoding::Encode<DriverIndexMatchDriverRequest, D>
495        for &DriverIndexMatchDriverRequest
496    {
497        #[inline]
498        unsafe fn encode(
499            self,
500            encoder: &mut fidl::encoding::Encoder<'_, D>,
501            offset: usize,
502            _depth: fidl::encoding::Depth,
503        ) -> fidl::Result<()> {
504            encoder.debug_check_bounds::<DriverIndexMatchDriverRequest>(offset);
505            // Delegate to tuple encoding.
506            fidl::encoding::Encode::<DriverIndexMatchDriverRequest, D>::encode(
507                (<MatchDriverArgs as fidl::encoding::ValueTypeMarker>::borrow(&self.args),),
508                encoder,
509                offset,
510                _depth,
511            )
512        }
513    }
514    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<MatchDriverArgs, D>>
515        fidl::encoding::Encode<DriverIndexMatchDriverRequest, D> for (T0,)
516    {
517        #[inline]
518        unsafe fn encode(
519            self,
520            encoder: &mut fidl::encoding::Encoder<'_, D>,
521            offset: usize,
522            depth: fidl::encoding::Depth,
523        ) -> fidl::Result<()> {
524            encoder.debug_check_bounds::<DriverIndexMatchDriverRequest>(offset);
525            // Zero out padding regions. There's no need to apply masks
526            // because the unmasked parts will be overwritten by fields.
527            // Write the fields.
528            self.0.encode(encoder, offset + 0, depth)?;
529            Ok(())
530        }
531    }
532
533    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
534        for DriverIndexMatchDriverRequest
535    {
536        #[inline(always)]
537        fn new_empty() -> Self {
538            Self { args: fidl::new_empty!(MatchDriverArgs, D) }
539        }
540
541        #[inline]
542        unsafe fn decode(
543            &mut self,
544            decoder: &mut fidl::encoding::Decoder<'_, D>,
545            offset: usize,
546            _depth: fidl::encoding::Depth,
547        ) -> fidl::Result<()> {
548            decoder.debug_check_bounds::<Self>(offset);
549            // Verify that padding bytes are zero.
550            fidl::decode!(MatchDriverArgs, D, &mut self.args, decoder, offset + 0, _depth)?;
551            Ok(())
552        }
553    }
554
555    impl fidl::encoding::ValueTypeMarker for DriverIndexMatchPendingNodeRequest {
556        type Borrowed<'a> = &'a Self;
557        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
558            value
559        }
560    }
561
562    unsafe impl fidl::encoding::TypeMarker for DriverIndexMatchPendingNodeRequest {
563        type Owned = Self;
564
565        #[inline(always)]
566        fn inline_align(_context: fidl::encoding::Context) -> usize {
567            8
568        }
569
570        #[inline(always)]
571        fn inline_size(_context: fidl::encoding::Context) -> usize {
572            16
573        }
574    }
575
576    unsafe impl<D: fidl::encoding::ResourceDialect>
577        fidl::encoding::Encode<DriverIndexMatchPendingNodeRequest, D>
578        for &DriverIndexMatchPendingNodeRequest
579    {
580        #[inline]
581        unsafe fn encode(
582            self,
583            encoder: &mut fidl::encoding::Encoder<'_, D>,
584            offset: usize,
585            _depth: fidl::encoding::Depth,
586        ) -> fidl::Result<()> {
587            encoder.debug_check_bounds::<DriverIndexMatchPendingNodeRequest>(offset);
588            // Delegate to tuple encoding.
589            fidl::encoding::Encode::<DriverIndexMatchPendingNodeRequest, D>::encode(
590                (<fidl::encoding::UnboundedVector<
591                    fidl_fuchsia_driver_framework_common::ParentSpec2,
592                > as fidl::encoding::ValueTypeMarker>::borrow(&self.dependencies),),
593                encoder,
594                offset,
595                _depth,
596            )
597        }
598    }
599    unsafe impl<
600        D: fidl::encoding::ResourceDialect,
601        T0: fidl::encoding::Encode<
602                fidl::encoding::UnboundedVector<fidl_fuchsia_driver_framework_common::ParentSpec2>,
603                D,
604            >,
605    > fidl::encoding::Encode<DriverIndexMatchPendingNodeRequest, D> for (T0,)
606    {
607        #[inline]
608        unsafe fn encode(
609            self,
610            encoder: &mut fidl::encoding::Encoder<'_, D>,
611            offset: usize,
612            depth: fidl::encoding::Depth,
613        ) -> fidl::Result<()> {
614            encoder.debug_check_bounds::<DriverIndexMatchPendingNodeRequest>(offset);
615            // Zero out padding regions. There's no need to apply masks
616            // because the unmasked parts will be overwritten by fields.
617            // Write the fields.
618            self.0.encode(encoder, offset + 0, depth)?;
619            Ok(())
620        }
621    }
622
623    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
624        for DriverIndexMatchPendingNodeRequest
625    {
626        #[inline(always)]
627        fn new_empty() -> Self {
628            Self {
629                dependencies: fidl::new_empty!(
630                    fidl::encoding::UnboundedVector<
631                        fidl_fuchsia_driver_framework_common::ParentSpec2,
632                    >,
633                    D
634                ),
635            }
636        }
637
638        #[inline]
639        unsafe fn decode(
640            &mut self,
641            decoder: &mut fidl::encoding::Decoder<'_, D>,
642            offset: usize,
643            _depth: fidl::encoding::Depth,
644        ) -> fidl::Result<()> {
645            decoder.debug_check_bounds::<Self>(offset);
646            // Verify that padding bytes are zero.
647            fidl::decode!(
648                fidl::encoding::UnboundedVector<fidl_fuchsia_driver_framework_common::ParentSpec2>,
649                D,
650                &mut self.dependencies,
651                decoder,
652                offset + 0,
653                _depth
654            )?;
655            Ok(())
656        }
657    }
658
659    impl fidl::encoding::ValueTypeMarker for DriverIndexRebindCompositeNodeSpecRequest {
660        type Borrowed<'a> = &'a Self;
661        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
662            value
663        }
664    }
665
666    unsafe impl fidl::encoding::TypeMarker for DriverIndexRebindCompositeNodeSpecRequest {
667        type Owned = Self;
668
669        #[inline(always)]
670        fn inline_align(_context: fidl::encoding::Context) -> usize {
671            8
672        }
673
674        #[inline(always)]
675        fn inline_size(_context: fidl::encoding::Context) -> usize {
676            32
677        }
678    }
679
680    unsafe impl<D: fidl::encoding::ResourceDialect>
681        fidl::encoding::Encode<DriverIndexRebindCompositeNodeSpecRequest, D>
682        for &DriverIndexRebindCompositeNodeSpecRequest
683    {
684        #[inline]
685        unsafe fn encode(
686            self,
687            encoder: &mut fidl::encoding::Encoder<'_, D>,
688            offset: usize,
689            _depth: fidl::encoding::Depth,
690        ) -> fidl::Result<()> {
691            encoder.debug_check_bounds::<DriverIndexRebindCompositeNodeSpecRequest>(offset);
692            // Delegate to tuple encoding.
693            fidl::encoding::Encode::<DriverIndexRebindCompositeNodeSpecRequest, D>::encode(
694                (
695                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.spec),
696                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_url_suffix),
697                ),
698                encoder, offset, _depth
699            )
700        }
701    }
702    unsafe impl<
703        D: fidl::encoding::ResourceDialect,
704        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
705        T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
706    > fidl::encoding::Encode<DriverIndexRebindCompositeNodeSpecRequest, D> for (T0, T1)
707    {
708        #[inline]
709        unsafe fn encode(
710            self,
711            encoder: &mut fidl::encoding::Encoder<'_, D>,
712            offset: usize,
713            depth: fidl::encoding::Depth,
714        ) -> fidl::Result<()> {
715            encoder.debug_check_bounds::<DriverIndexRebindCompositeNodeSpecRequest>(offset);
716            // Zero out padding regions. There's no need to apply masks
717            // because the unmasked parts will be overwritten by fields.
718            // Write the fields.
719            self.0.encode(encoder, offset + 0, depth)?;
720            self.1.encode(encoder, offset + 16, depth)?;
721            Ok(())
722        }
723    }
724
725    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
726        for DriverIndexRebindCompositeNodeSpecRequest
727    {
728        #[inline(always)]
729        fn new_empty() -> Self {
730            Self {
731                spec: fidl::new_empty!(fidl::encoding::UnboundedString, D),
732                driver_url_suffix: fidl::new_empty!(
733                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
734                    D
735                ),
736            }
737        }
738
739        #[inline]
740        unsafe fn decode(
741            &mut self,
742            decoder: &mut fidl::encoding::Decoder<'_, D>,
743            offset: usize,
744            _depth: fidl::encoding::Depth,
745        ) -> fidl::Result<()> {
746            decoder.debug_check_bounds::<Self>(offset);
747            // Verify that padding bytes are zero.
748            fidl::decode!(
749                fidl::encoding::UnboundedString,
750                D,
751                &mut self.spec,
752                decoder,
753                offset + 0,
754                _depth
755            )?;
756            fidl::decode!(
757                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
758                D,
759                &mut self.driver_url_suffix,
760                decoder,
761                offset + 16,
762                _depth
763            )?;
764            Ok(())
765        }
766    }
767
768    impl MatchDriverArgs {
769        #[inline(always)]
770        fn max_ordinal_present(&self) -> u64 {
771            if let Some(_) = self.driver_url_suffix {
772                return 3;
773            }
774            if let Some(_) = self.name {
775                return 2;
776            }
777            if let Some(_) = self.properties {
778                return 1;
779            }
780            0
781        }
782    }
783
784    impl fidl::encoding::ValueTypeMarker for MatchDriverArgs {
785        type Borrowed<'a> = &'a Self;
786        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
787            value
788        }
789    }
790
791    unsafe impl fidl::encoding::TypeMarker for MatchDriverArgs {
792        type Owned = Self;
793
794        #[inline(always)]
795        fn inline_align(_context: fidl::encoding::Context) -> usize {
796            8
797        }
798
799        #[inline(always)]
800        fn inline_size(_context: fidl::encoding::Context) -> usize {
801            16
802        }
803    }
804
805    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MatchDriverArgs, D>
806        for &MatchDriverArgs
807    {
808        unsafe fn encode(
809            self,
810            encoder: &mut fidl::encoding::Encoder<'_, D>,
811            offset: usize,
812            mut depth: fidl::encoding::Depth,
813        ) -> fidl::Result<()> {
814            encoder.debug_check_bounds::<MatchDriverArgs>(offset);
815            // Vector header
816            let max_ordinal: u64 = self.max_ordinal_present();
817            encoder.write_num(max_ordinal, offset);
818            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
819            // Calling encoder.out_of_line_offset(0) is not allowed.
820            if max_ordinal == 0 {
821                return Ok(());
822            }
823            depth.increment()?;
824            let envelope_size = 8;
825            let bytes_len = max_ordinal as usize * envelope_size;
826            #[allow(unused_variables)]
827            let offset = encoder.out_of_line_offset(bytes_len);
828            let mut _prev_end_offset: usize = 0;
829            if 1 > max_ordinal {
830                return Ok(());
831            }
832
833            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
834            // are envelope_size bytes.
835            let cur_offset: usize = (1 - 1) * envelope_size;
836
837            // Zero reserved fields.
838            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
839
840            // Safety:
841            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
842            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
843            //   envelope_size bytes, there is always sufficient room.
844            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_driver_framework_common::NodeProperty2, 64>, D>(
845            self.properties.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_driver_framework_common::NodeProperty2, 64> as fidl::encoding::ValueTypeMarker>::borrow),
846            encoder, offset + cur_offset, depth
847        )?;
848
849            _prev_end_offset = cur_offset + envelope_size;
850            if 2 > max_ordinal {
851                return Ok(());
852            }
853
854            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
855            // are envelope_size bytes.
856            let cur_offset: usize = (2 - 1) * envelope_size;
857
858            // Zero reserved fields.
859            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
860
861            // Safety:
862            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
863            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
864            //   envelope_size bytes, there is always sufficient room.
865            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<128>, D>(
866                self.name.as_ref().map(
867                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
868                ),
869                encoder,
870                offset + cur_offset,
871                depth,
872            )?;
873
874            _prev_end_offset = cur_offset + envelope_size;
875            if 3 > max_ordinal {
876                return Ok(());
877            }
878
879            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
880            // are envelope_size bytes.
881            let cur_offset: usize = (3 - 1) * envelope_size;
882
883            // Zero reserved fields.
884            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
885
886            // Safety:
887            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
888            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
889            //   envelope_size bytes, there is always sufficient room.
890            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
891                self.driver_url_suffix.as_ref().map(
892                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
893                ),
894                encoder,
895                offset + cur_offset,
896                depth,
897            )?;
898
899            _prev_end_offset = cur_offset + envelope_size;
900
901            Ok(())
902        }
903    }
904
905    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MatchDriverArgs {
906        #[inline(always)]
907        fn new_empty() -> Self {
908            Self::default()
909        }
910
911        unsafe fn decode(
912            &mut self,
913            decoder: &mut fidl::encoding::Decoder<'_, D>,
914            offset: usize,
915            mut depth: fidl::encoding::Depth,
916        ) -> fidl::Result<()> {
917            decoder.debug_check_bounds::<Self>(offset);
918            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
919                None => return Err(fidl::Error::NotNullable),
920                Some(len) => len,
921            };
922            // Calling decoder.out_of_line_offset(0) is not allowed.
923            if len == 0 {
924                return Ok(());
925            };
926            depth.increment()?;
927            let envelope_size = 8;
928            let bytes_len = len * envelope_size;
929            let offset = decoder.out_of_line_offset(bytes_len)?;
930            // Decode the envelope for each type.
931            let mut _next_ordinal_to_read = 0;
932            let mut next_offset = offset;
933            let end_offset = offset + bytes_len;
934            _next_ordinal_to_read += 1;
935            if next_offset >= end_offset {
936                return Ok(());
937            }
938
939            // Decode unknown envelopes for gaps in ordinals.
940            while _next_ordinal_to_read < 1 {
941                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
942                _next_ordinal_to_read += 1;
943                next_offset += envelope_size;
944            }
945
946            let next_out_of_line = decoder.next_out_of_line();
947            let handles_before = decoder.remaining_handles();
948            if let Some((inlined, num_bytes, num_handles)) =
949                fidl::encoding::decode_envelope_header(decoder, next_offset)?
950            {
951                let member_inline_size = <fidl::encoding::Vector<
952                    fidl_fuchsia_driver_framework_common::NodeProperty2,
953                    64,
954                > as fidl::encoding::TypeMarker>::inline_size(
955                    decoder.context
956                );
957                if inlined != (member_inline_size <= 4) {
958                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
959                }
960                let inner_offset;
961                let mut inner_depth = depth.clone();
962                if inlined {
963                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
964                    inner_offset = next_offset;
965                } else {
966                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
967                    inner_depth.increment()?;
968                }
969                let val_ref =
970                self.properties.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_driver_framework_common::NodeProperty2, 64>, D));
971                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_driver_framework_common::NodeProperty2, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
972                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
973                {
974                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
975                }
976                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
977                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
978                }
979            }
980
981            next_offset += envelope_size;
982            _next_ordinal_to_read += 1;
983            if next_offset >= end_offset {
984                return Ok(());
985            }
986
987            // Decode unknown envelopes for gaps in ordinals.
988            while _next_ordinal_to_read < 2 {
989                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
990                _next_ordinal_to_read += 1;
991                next_offset += envelope_size;
992            }
993
994            let next_out_of_line = decoder.next_out_of_line();
995            let handles_before = decoder.remaining_handles();
996            if let Some((inlined, num_bytes, num_handles)) =
997                fidl::encoding::decode_envelope_header(decoder, next_offset)?
998            {
999                let member_inline_size =
1000                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
1001                        decoder.context,
1002                    );
1003                if inlined != (member_inline_size <= 4) {
1004                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1005                }
1006                let inner_offset;
1007                let mut inner_depth = depth.clone();
1008                if inlined {
1009                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1010                    inner_offset = next_offset;
1011                } else {
1012                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1013                    inner_depth.increment()?;
1014                }
1015                let val_ref = self
1016                    .name
1017                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
1018                fidl::decode!(
1019                    fidl::encoding::BoundedString<128>,
1020                    D,
1021                    val_ref,
1022                    decoder,
1023                    inner_offset,
1024                    inner_depth
1025                )?;
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            // Decode unknown envelopes for gaps in ordinals.
1042            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                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1055                        decoder.context,
1056                    );
1057                if inlined != (member_inline_size <= 4) {
1058                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1059                }
1060                let inner_offset;
1061                let mut inner_depth = depth.clone();
1062                if inlined {
1063                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1064                    inner_offset = next_offset;
1065                } else {
1066                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1067                    inner_depth.increment()?;
1068                }
1069                let val_ref = self
1070                    .driver_url_suffix
1071                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
1072                fidl::decode!(
1073                    fidl::encoding::UnboundedString,
1074                    D,
1075                    val_ref,
1076                    decoder,
1077                    inner_offset,
1078                    inner_depth
1079                )?;
1080                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1081                {
1082                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1083                }
1084                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1085                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1086                }
1087            }
1088
1089            next_offset += envelope_size;
1090
1091            // Decode the remaining unknown envelopes.
1092            while next_offset < end_offset {
1093                _next_ordinal_to_read += 1;
1094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1095                next_offset += envelope_size;
1096            }
1097
1098            Ok(())
1099        }
1100    }
1101
1102    impl MatchPendingNodeResult {
1103        #[inline(always)]
1104        fn max_ordinal_present(&self) -> u64 {
1105            if let Some(_) = self.driver {
1106                return 1;
1107            }
1108            0
1109        }
1110    }
1111
1112    impl fidl::encoding::ValueTypeMarker for MatchPendingNodeResult {
1113        type Borrowed<'a> = &'a Self;
1114        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1115            value
1116        }
1117    }
1118
1119    unsafe impl fidl::encoding::TypeMarker for MatchPendingNodeResult {
1120        type Owned = Self;
1121
1122        #[inline(always)]
1123        fn inline_align(_context: fidl::encoding::Context) -> usize {
1124            8
1125        }
1126
1127        #[inline(always)]
1128        fn inline_size(_context: fidl::encoding::Context) -> usize {
1129            16
1130        }
1131    }
1132
1133    unsafe impl<D: fidl::encoding::ResourceDialect>
1134        fidl::encoding::Encode<MatchPendingNodeResult, D> for &MatchPendingNodeResult
1135    {
1136        unsafe fn encode(
1137            self,
1138            encoder: &mut fidl::encoding::Encoder<'_, D>,
1139            offset: usize,
1140            mut depth: fidl::encoding::Depth,
1141        ) -> fidl::Result<()> {
1142            encoder.debug_check_bounds::<MatchPendingNodeResult>(offset);
1143            // Vector header
1144            let max_ordinal: u64 = self.max_ordinal_present();
1145            encoder.write_num(max_ordinal, offset);
1146            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1147            // Calling encoder.out_of_line_offset(0) is not allowed.
1148            if max_ordinal == 0 {
1149                return Ok(());
1150            }
1151            depth.increment()?;
1152            let envelope_size = 8;
1153            let bytes_len = max_ordinal as usize * envelope_size;
1154            #[allow(unused_variables)]
1155            let offset = encoder.out_of_line_offset(bytes_len);
1156            let mut _prev_end_offset: usize = 0;
1157            if 1 > max_ordinal {
1158                return Ok(());
1159            }
1160
1161            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1162            // are envelope_size bytes.
1163            let cur_offset: usize = (1 - 1) * envelope_size;
1164
1165            // Zero reserved fields.
1166            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1167
1168            // Safety:
1169            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1170            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1171            //   envelope_size bytes, there is always sufficient room.
1172            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_driver_framework_common::CompositeDriverMatch, D>(
1173            self.driver.as_ref().map(<fidl_fuchsia_driver_framework_common::CompositeDriverMatch as fidl::encoding::ValueTypeMarker>::borrow),
1174            encoder, offset + cur_offset, depth
1175        )?;
1176
1177            _prev_end_offset = cur_offset + envelope_size;
1178
1179            Ok(())
1180        }
1181    }
1182
1183    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1184        for MatchPendingNodeResult
1185    {
1186        #[inline(always)]
1187        fn new_empty() -> Self {
1188            Self::default()
1189        }
1190
1191        unsafe fn decode(
1192            &mut self,
1193            decoder: &mut fidl::encoding::Decoder<'_, D>,
1194            offset: usize,
1195            mut depth: fidl::encoding::Depth,
1196        ) -> fidl::Result<()> {
1197            decoder.debug_check_bounds::<Self>(offset);
1198            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1199                None => return Err(fidl::Error::NotNullable),
1200                Some(len) => len,
1201            };
1202            // Calling decoder.out_of_line_offset(0) is not allowed.
1203            if len == 0 {
1204                return Ok(());
1205            };
1206            depth.increment()?;
1207            let envelope_size = 8;
1208            let bytes_len = len * envelope_size;
1209            let offset = decoder.out_of_line_offset(bytes_len)?;
1210            // Decode the envelope for each type.
1211            let mut _next_ordinal_to_read = 0;
1212            let mut next_offset = offset;
1213            let end_offset = offset + bytes_len;
1214            _next_ordinal_to_read += 1;
1215            if next_offset >= end_offset {
1216                return Ok(());
1217            }
1218
1219            // Decode unknown envelopes for gaps in ordinals.
1220            while _next_ordinal_to_read < 1 {
1221                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1222                _next_ordinal_to_read += 1;
1223                next_offset += envelope_size;
1224            }
1225
1226            let next_out_of_line = decoder.next_out_of_line();
1227            let handles_before = decoder.remaining_handles();
1228            if let Some((inlined, num_bytes, num_handles)) =
1229                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1230            {
1231                let member_inline_size = <fidl_fuchsia_driver_framework_common::CompositeDriverMatch as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1232                if inlined != (member_inline_size <= 4) {
1233                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1234                }
1235                let inner_offset;
1236                let mut inner_depth = depth.clone();
1237                if inlined {
1238                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1239                    inner_offset = next_offset;
1240                } else {
1241                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1242                    inner_depth.increment()?;
1243                }
1244                let val_ref = self.driver.get_or_insert_with(|| {
1245                    fidl::new_empty!(fidl_fuchsia_driver_framework_common::CompositeDriverMatch, D)
1246                });
1247                fidl::decode!(
1248                    fidl_fuchsia_driver_framework_common::CompositeDriverMatch,
1249                    D,
1250                    val_ref,
1251                    decoder,
1252                    inner_offset,
1253                    inner_depth
1254                )?;
1255                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1256                {
1257                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1258                }
1259                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1260                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1261                }
1262            }
1263
1264            next_offset += envelope_size;
1265
1266            // Decode the remaining unknown envelopes.
1267            while next_offset < end_offset {
1268                _next_ordinal_to_read += 1;
1269                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1270                next_offset += envelope_size;
1271            }
1272
1273            Ok(())
1274        }
1275    }
1276
1277    impl fidl::encoding::ValueTypeMarker for MatchDriverResult {
1278        type Borrowed<'a> = &'a Self;
1279        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1280            value
1281        }
1282    }
1283
1284    unsafe impl fidl::encoding::TypeMarker for MatchDriverResult {
1285        type Owned = Self;
1286
1287        #[inline(always)]
1288        fn inline_align(_context: fidl::encoding::Context) -> usize {
1289            8
1290        }
1291
1292        #[inline(always)]
1293        fn inline_size(_context: fidl::encoding::Context) -> usize {
1294            16
1295        }
1296    }
1297
1298    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MatchDriverResult, D>
1299        for &MatchDriverResult
1300    {
1301        #[inline]
1302        unsafe fn encode(
1303            self,
1304            encoder: &mut fidl::encoding::Encoder<'_, D>,
1305            offset: usize,
1306            _depth: fidl::encoding::Depth,
1307        ) -> fidl::Result<()> {
1308            encoder.debug_check_bounds::<MatchDriverResult>(offset);
1309            encoder.write_num::<u64>(self.ordinal(), offset);
1310            match self {
1311            MatchDriverResult::Driver(ref val) => {
1312                fidl::encoding::encode_in_envelope::<fidl_fuchsia_driver_framework_common::DriverInfo, D>(
1313                    <fidl_fuchsia_driver_framework_common::DriverInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
1314                    encoder, offset + 8, _depth
1315                )
1316            }
1317            MatchDriverResult::CompositeParents(ref val) => {
1318                fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<fidl_fuchsia_driver_framework_common::CompositeParent>, D>(
1319                    <fidl::encoding::UnboundedVector<fidl_fuchsia_driver_framework_common::CompositeParent> as fidl::encoding::ValueTypeMarker>::borrow(val),
1320                    encoder, offset + 8, _depth
1321                )
1322            }
1323            MatchDriverResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1324        }
1325        }
1326    }
1327
1328    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MatchDriverResult {
1329        #[inline(always)]
1330        fn new_empty() -> Self {
1331            Self::__SourceBreaking { unknown_ordinal: 0 }
1332        }
1333
1334        #[inline]
1335        unsafe fn decode(
1336            &mut self,
1337            decoder: &mut fidl::encoding::Decoder<'_, D>,
1338            offset: usize,
1339            mut depth: fidl::encoding::Depth,
1340        ) -> fidl::Result<()> {
1341            decoder.debug_check_bounds::<Self>(offset);
1342            #[allow(unused_variables)]
1343            let next_out_of_line = decoder.next_out_of_line();
1344            let handles_before = decoder.remaining_handles();
1345            let (ordinal, inlined, num_bytes, num_handles) =
1346                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1347
1348            let member_inline_size = match ordinal {
1349            1 => <fidl_fuchsia_driver_framework_common::DriverInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1350            2 => <fidl::encoding::UnboundedVector<fidl_fuchsia_driver_framework_common::CompositeParent> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1351            0 => return Err(fidl::Error::UnknownUnionTag),
1352            _ => num_bytes as usize,
1353        };
1354
1355            if inlined != (member_inline_size <= 4) {
1356                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1357            }
1358            let _inner_offset;
1359            if inlined {
1360                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1361                _inner_offset = offset + 8;
1362            } else {
1363                depth.increment()?;
1364                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1365            }
1366            match ordinal {
1367                1 => {
1368                    #[allow(irrefutable_let_patterns)]
1369                    if let MatchDriverResult::Driver(_) = self {
1370                        // Do nothing, read the value into the object
1371                    } else {
1372                        // Initialize `self` to the right variant
1373                        *self = MatchDriverResult::Driver(fidl::new_empty!(
1374                            fidl_fuchsia_driver_framework_common::DriverInfo,
1375                            D
1376                        ));
1377                    }
1378                    #[allow(irrefutable_let_patterns)]
1379                    if let MatchDriverResult::Driver(ref mut val) = self {
1380                        fidl::decode!(
1381                            fidl_fuchsia_driver_framework_common::DriverInfo,
1382                            D,
1383                            val,
1384                            decoder,
1385                            _inner_offset,
1386                            depth
1387                        )?;
1388                    } else {
1389                        unreachable!()
1390                    }
1391                }
1392                2 => {
1393                    #[allow(irrefutable_let_patterns)]
1394                    if let MatchDriverResult::CompositeParents(_) = self {
1395                        // Do nothing, read the value into the object
1396                    } else {
1397                        // Initialize `self` to the right variant
1398                        *self = MatchDriverResult::CompositeParents(fidl::new_empty!(
1399                            fidl::encoding::UnboundedVector<
1400                                fidl_fuchsia_driver_framework_common::CompositeParent,
1401                            >,
1402                            D
1403                        ));
1404                    }
1405                    #[allow(irrefutable_let_patterns)]
1406                    if let MatchDriverResult::CompositeParents(ref mut val) = self {
1407                        fidl::decode!(
1408                            fidl::encoding::UnboundedVector<
1409                                fidl_fuchsia_driver_framework_common::CompositeParent,
1410                            >,
1411                            D,
1412                            val,
1413                            decoder,
1414                            _inner_offset,
1415                            depth
1416                        )?;
1417                    } else {
1418                        unreachable!()
1419                    }
1420                }
1421                #[allow(deprecated)]
1422                ordinal => {
1423                    for _ in 0..num_handles {
1424                        decoder.drop_next_handle()?;
1425                    }
1426                    *self = MatchDriverResult::__SourceBreaking { unknown_ordinal: ordinal };
1427                }
1428            }
1429            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1430                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1431            }
1432            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1433                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1434            }
1435            Ok(())
1436        }
1437    }
1438}