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