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
100pub mod driver_lists_ordinals {
101    pub const GET_DRIVER_LISTS: u64 = 0x63c3de40e768357;
102}
103
104pub mod internal_ordinals {
105    pub const GET_TEST_PACKAGE: u64 = 0x298c1d6e57d57db8;
106    pub const GET_TEST_RESOLUTION_CONTEXT: u64 = 0x78e5d4f1fefd67b7;
107    pub const GET_BOOT_DIRECTORY: u64 = 0x3e1969123c4dfb31;
108    pub const GET_BOOT_DRIVER_OVERRIDES: u64 = 0x6a40991d8259e008;
109}
110
111pub mod manifest_provider_ordinals {
112    pub const GET_MANIFEST: u64 = 0x44eaae3b45e860d;
113}
114
115pub mod realm_ordinals {
116    pub const START: u64 = 0x3dc6949d581e96fa;
117}
118
119pub mod resource_provider_ordinals {
120    pub const GET_DEVICE_TREE: u64 = 0x28fafebf621fdb07;
121}
122
123mod internal {
124    use super::*;
125    unsafe impl fidl::encoding::TypeMarker for Collection {
126        type Owned = Self;
127
128        #[inline(always)]
129        fn inline_align(_context: fidl::encoding::Context) -> usize {
130            std::mem::align_of::<u32>()
131        }
132
133        #[inline(always)]
134        fn inline_size(_context: fidl::encoding::Context) -> usize {
135            std::mem::size_of::<u32>()
136        }
137
138        #[inline(always)]
139        fn encode_is_copy() -> bool {
140            true
141        }
142
143        #[inline(always)]
144        fn decode_is_copy() -> bool {
145            false
146        }
147    }
148
149    impl fidl::encoding::ValueTypeMarker for Collection {
150        type Borrowed<'a> = Self;
151        #[inline(always)]
152        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
153            *value
154        }
155    }
156
157    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Collection {
158        #[inline]
159        unsafe fn encode(
160            self,
161            encoder: &mut fidl::encoding::Encoder<'_, D>,
162            offset: usize,
163            _depth: fidl::encoding::Depth,
164        ) -> fidl::Result<()> {
165            encoder.debug_check_bounds::<Self>(offset);
166            encoder.write_num(self.into_primitive(), offset);
167            Ok(())
168        }
169    }
170
171    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Collection {
172        #[inline(always)]
173        fn new_empty() -> Self {
174            Self::Unknown
175        }
176
177        #[inline]
178        unsafe fn decode(
179            &mut self,
180            decoder: &mut fidl::encoding::Decoder<'_, D>,
181            offset: usize,
182            _depth: fidl::encoding::Depth,
183        ) -> fidl::Result<()> {
184            decoder.debug_check_bounds::<Self>(offset);
185            let prim = decoder.read_num::<u32>(offset);
186
187            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
188            Ok(())
189        }
190    }
191
192    impl fidl::encoding::ValueTypeMarker for DriverListsGetDriverListsResponse {
193        type Borrowed<'a> = &'a Self;
194        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
195            value
196        }
197    }
198
199    unsafe impl fidl::encoding::TypeMarker for DriverListsGetDriverListsResponse {
200        type Owned = Self;
201
202        #[inline(always)]
203        fn inline_align(_context: fidl::encoding::Context) -> usize {
204            8
205        }
206
207        #[inline(always)]
208        fn inline_size(_context: fidl::encoding::Context) -> usize {
209            32
210        }
211    }
212
213    unsafe impl<D: fidl::encoding::ResourceDialect>
214        fidl::encoding::Encode<DriverListsGetDriverListsResponse, D>
215        for &DriverListsGetDriverListsResponse
216    {
217        #[inline]
218        unsafe fn encode(
219            self,
220            encoder: &mut fidl::encoding::Encoder<'_, D>,
221            offset: usize,
222            _depth: fidl::encoding::Depth,
223        ) -> fidl::Result<()> {
224            encoder.debug_check_bounds::<DriverListsGetDriverListsResponse>(offset);
225            // Delegate to tuple encoding.
226            fidl::encoding::Encode::<DriverListsGetDriverListsResponse, D>::encode(
227                (
228                    <fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200> as fidl::encoding::ValueTypeMarker>::borrow(&self.boot_drivers),
229                    <fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200> as fidl::encoding::ValueTypeMarker>::borrow(&self.base_drivers),
230                ),
231                encoder, offset, _depth
232            )
233        }
234    }
235    unsafe impl<
236        D: fidl::encoding::ResourceDialect,
237        T0: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>, D>,
238        T1: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>, D>,
239    > fidl::encoding::Encode<DriverListsGetDriverListsResponse, D> for (T0, T1)
240    {
241        #[inline]
242        unsafe fn encode(
243            self,
244            encoder: &mut fidl::encoding::Encoder<'_, D>,
245            offset: usize,
246            depth: fidl::encoding::Depth,
247        ) -> fidl::Result<()> {
248            encoder.debug_check_bounds::<DriverListsGetDriverListsResponse>(offset);
249            // Zero out padding regions. There's no need to apply masks
250            // because the unmasked parts will be overwritten by fields.
251            // Write the fields.
252            self.0.encode(encoder, offset + 0, depth)?;
253            self.1.encode(encoder, offset + 16, depth)?;
254            Ok(())
255        }
256    }
257
258    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
259        for DriverListsGetDriverListsResponse
260    {
261        #[inline(always)]
262        fn new_empty() -> Self {
263            Self {
264                boot_drivers: fidl::new_empty!(
265                    fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
266                    D
267                ),
268                base_drivers: fidl::new_empty!(
269                    fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
270                    D
271                ),
272            }
273        }
274
275        #[inline]
276        unsafe fn decode(
277            &mut self,
278            decoder: &mut fidl::encoding::Decoder<'_, D>,
279            offset: usize,
280            _depth: fidl::encoding::Depth,
281        ) -> fidl::Result<()> {
282            decoder.debug_check_bounds::<Self>(offset);
283            // Verify that padding bytes are zero.
284            fidl::decode!(
285                fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
286                D,
287                &mut self.boot_drivers,
288                decoder,
289                offset + 0,
290                _depth
291            )?;
292            fidl::decode!(
293                fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
294                D,
295                &mut self.base_drivers,
296                decoder,
297                offset + 16,
298                _depth
299            )?;
300            Ok(())
301        }
302    }
303
304    impl fidl::encoding::ValueTypeMarker for DriverLog {
305        type Borrowed<'a> = &'a Self;
306        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
307            value
308        }
309    }
310
311    unsafe impl fidl::encoding::TypeMarker for DriverLog {
312        type Owned = Self;
313
314        #[inline(always)]
315        fn inline_align(_context: fidl::encoding::Context) -> usize {
316            8
317        }
318
319        #[inline(always)]
320        fn inline_size(_context: fidl::encoding::Context) -> usize {
321            24
322        }
323    }
324
325    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DriverLog, D>
326        for &DriverLog
327    {
328        #[inline]
329        unsafe fn encode(
330            self,
331            encoder: &mut fidl::encoding::Encoder<'_, D>,
332            offset: usize,
333            _depth: fidl::encoding::Depth,
334        ) -> fidl::Result<()> {
335            encoder.debug_check_bounds::<DriverLog>(offset);
336            // Delegate to tuple encoding.
337            fidl::encoding::Encode::<DriverLog, D>::encode(
338                (
339                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
340                    <fidl_fuchsia_diagnostics_types__common::Severity as fidl::encoding::ValueTypeMarker>::borrow(&self.log_level),
341                ),
342                encoder, offset, _depth
343            )
344        }
345    }
346    unsafe impl<
347        D: fidl::encoding::ResourceDialect,
348        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
349        T1: fidl::encoding::Encode<fidl_fuchsia_diagnostics_types__common::Severity, D>,
350    > fidl::encoding::Encode<DriverLog, D> for (T0, T1)
351    {
352        #[inline]
353        unsafe fn encode(
354            self,
355            encoder: &mut fidl::encoding::Encoder<'_, D>,
356            offset: usize,
357            depth: fidl::encoding::Depth,
358        ) -> fidl::Result<()> {
359            encoder.debug_check_bounds::<DriverLog>(offset);
360            // Zero out padding regions. There's no need to apply masks
361            // because the unmasked parts will be overwritten by fields.
362            unsafe {
363                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
364                (ptr as *mut u64).write_unaligned(0);
365            }
366            // Write the fields.
367            self.0.encode(encoder, offset + 0, depth)?;
368            self.1.encode(encoder, offset + 16, depth)?;
369            Ok(())
370        }
371    }
372
373    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DriverLog {
374        #[inline(always)]
375        fn new_empty() -> Self {
376            Self {
377                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
378                log_level: fidl::new_empty!(fidl_fuchsia_diagnostics_types__common::Severity, D),
379            }
380        }
381
382        #[inline]
383        unsafe fn decode(
384            &mut self,
385            decoder: &mut fidl::encoding::Decoder<'_, D>,
386            offset: usize,
387            _depth: fidl::encoding::Depth,
388        ) -> fidl::Result<()> {
389            decoder.debug_check_bounds::<Self>(offset);
390            // Verify that padding bytes are zero.
391            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
392            let padval = unsafe { (ptr as *const u64).read_unaligned() };
393            let mask = 0xffffffffffffff00u64;
394            let maskedval = padval & mask;
395            if maskedval != 0 {
396                return Err(fidl::Error::NonZeroPadding {
397                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
398                });
399            }
400            fidl::decode!(
401                fidl::encoding::UnboundedString,
402                D,
403                &mut self.name,
404                decoder,
405                offset + 0,
406                _depth
407            )?;
408            fidl::decode!(
409                fidl_fuchsia_diagnostics_types__common::Severity,
410                D,
411                &mut self.log_level,
412                decoder,
413                offset + 16,
414                _depth
415            )?;
416            Ok(())
417        }
418    }
419
420    impl fidl::encoding::ValueTypeMarker for Expose {
421        type Borrowed<'a> = &'a Self;
422        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
423            value
424        }
425    }
426
427    unsafe impl fidl::encoding::TypeMarker for Expose {
428        type Owned = Self;
429
430        #[inline(always)]
431        fn inline_align(_context: fidl::encoding::Context) -> usize {
432            8
433        }
434
435        #[inline(always)]
436        fn inline_size(_context: fidl::encoding::Context) -> usize {
437            24
438        }
439    }
440
441    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Expose, D> for &Expose {
442        #[inline]
443        unsafe fn encode(
444            self,
445            encoder: &mut fidl::encoding::Encoder<'_, D>,
446            offset: usize,
447            _depth: fidl::encoding::Depth,
448        ) -> fidl::Result<()> {
449            encoder.debug_check_bounds::<Expose>(offset);
450            // Delegate to tuple encoding.
451            fidl::encoding::Encode::<Expose, D>::encode(
452                (
453                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
454                        &self.service_name,
455                    ),
456                    <Collection as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
457                ),
458                encoder,
459                offset,
460                _depth,
461            )
462        }
463    }
464    unsafe impl<
465        D: fidl::encoding::ResourceDialect,
466        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
467        T1: fidl::encoding::Encode<Collection, D>,
468    > fidl::encoding::Encode<Expose, D> for (T0, T1)
469    {
470        #[inline]
471        unsafe fn encode(
472            self,
473            encoder: &mut fidl::encoding::Encoder<'_, D>,
474            offset: usize,
475            depth: fidl::encoding::Depth,
476        ) -> fidl::Result<()> {
477            encoder.debug_check_bounds::<Expose>(offset);
478            // Zero out padding regions. There's no need to apply masks
479            // because the unmasked parts will be overwritten by fields.
480            unsafe {
481                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
482                (ptr as *mut u64).write_unaligned(0);
483            }
484            // Write the fields.
485            self.0.encode(encoder, offset + 0, depth)?;
486            self.1.encode(encoder, offset + 16, depth)?;
487            Ok(())
488        }
489    }
490
491    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Expose {
492        #[inline(always)]
493        fn new_empty() -> Self {
494            Self {
495                service_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
496                collection: fidl::new_empty!(Collection, D),
497            }
498        }
499
500        #[inline]
501        unsafe fn decode(
502            &mut self,
503            decoder: &mut fidl::encoding::Decoder<'_, D>,
504            offset: usize,
505            _depth: fidl::encoding::Depth,
506        ) -> fidl::Result<()> {
507            decoder.debug_check_bounds::<Self>(offset);
508            // Verify that padding bytes are zero.
509            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
510            let padval = unsafe { (ptr as *const u64).read_unaligned() };
511            let mask = 0xffffffff00000000u64;
512            let maskedval = padval & mask;
513            if maskedval != 0 {
514                return Err(fidl::Error::NonZeroPadding {
515                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
516                });
517            }
518            fidl::decode!(
519                fidl::encoding::UnboundedString,
520                D,
521                &mut self.service_name,
522                decoder,
523                offset + 0,
524                _depth
525            )?;
526            fidl::decode!(Collection, D, &mut self.collection, decoder, offset + 16, _depth)?;
527            Ok(())
528        }
529    }
530
531    impl fidl::encoding::ValueTypeMarker for InternalGetBootDriverOverridesResponse {
532        type Borrowed<'a> = &'a Self;
533        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
534            value
535        }
536    }
537
538    unsafe impl fidl::encoding::TypeMarker for InternalGetBootDriverOverridesResponse {
539        type Owned = Self;
540
541        #[inline(always)]
542        fn inline_align(_context: fidl::encoding::Context) -> usize {
543            8
544        }
545
546        #[inline(always)]
547        fn inline_size(_context: fidl::encoding::Context) -> usize {
548            16
549        }
550    }
551
552    unsafe impl<D: fidl::encoding::ResourceDialect>
553        fidl::encoding::Encode<InternalGetBootDriverOverridesResponse, D>
554        for &InternalGetBootDriverOverridesResponse
555    {
556        #[inline]
557        unsafe fn encode(
558            self,
559            encoder: &mut fidl::encoding::Encoder<'_, D>,
560            offset: usize,
561            _depth: fidl::encoding::Depth,
562        ) -> fidl::Result<()> {
563            encoder.debug_check_bounds::<InternalGetBootDriverOverridesResponse>(offset);
564            // Delegate to tuple encoding.
565            fidl::encoding::Encode::<InternalGetBootDriverOverridesResponse, D>::encode(
566                (
567                    <fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200> as fidl::encoding::ValueTypeMarker>::borrow(&self.boot_overrides),
568                ),
569                encoder, offset, _depth
570            )
571        }
572    }
573    unsafe impl<
574        D: fidl::encoding::ResourceDialect,
575        T0: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>, D>,
576    > fidl::encoding::Encode<InternalGetBootDriverOverridesResponse, D> for (T0,)
577    {
578        #[inline]
579        unsafe fn encode(
580            self,
581            encoder: &mut fidl::encoding::Encoder<'_, D>,
582            offset: usize,
583            depth: fidl::encoding::Depth,
584        ) -> fidl::Result<()> {
585            encoder.debug_check_bounds::<InternalGetBootDriverOverridesResponse>(offset);
586            // Zero out padding regions. There's no need to apply masks
587            // because the unmasked parts will be overwritten by fields.
588            // Write the fields.
589            self.0.encode(encoder, offset + 0, depth)?;
590            Ok(())
591        }
592    }
593
594    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
595        for InternalGetBootDriverOverridesResponse
596    {
597        #[inline(always)]
598        fn new_empty() -> Self {
599            Self {
600                boot_overrides: fidl::new_empty!(
601                    fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
602                    D
603                ),
604            }
605        }
606
607        #[inline]
608        unsafe fn decode(
609            &mut self,
610            decoder: &mut fidl::encoding::Decoder<'_, D>,
611            offset: usize,
612            _depth: fidl::encoding::Depth,
613        ) -> fidl::Result<()> {
614            decoder.debug_check_bounds::<Self>(offset);
615            // Verify that padding bytes are zero.
616            fidl::decode!(
617                fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
618                D,
619                &mut self.boot_overrides,
620                decoder,
621                offset + 0,
622                _depth
623            )?;
624            Ok(())
625        }
626    }
627
628    impl fidl::encoding::ValueTypeMarker for InternalGetTestResolutionContextResponse {
629        type Borrowed<'a> = &'a Self;
630        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
631            value
632        }
633    }
634
635    unsafe impl fidl::encoding::TypeMarker for InternalGetTestResolutionContextResponse {
636        type Owned = Self;
637
638        #[inline(always)]
639        fn inline_align(_context: fidl::encoding::Context) -> usize {
640            8
641        }
642
643        #[inline(always)]
644        fn inline_size(_context: fidl::encoding::Context) -> usize {
645            8
646        }
647    }
648
649    unsafe impl<D: fidl::encoding::ResourceDialect>
650        fidl::encoding::Encode<InternalGetTestResolutionContextResponse, D>
651        for &InternalGetTestResolutionContextResponse
652    {
653        #[inline]
654        unsafe fn encode(
655            self,
656            encoder: &mut fidl::encoding::Encoder<'_, D>,
657            offset: usize,
658            _depth: fidl::encoding::Depth,
659        ) -> fidl::Result<()> {
660            encoder.debug_check_bounds::<InternalGetTestResolutionContextResponse>(offset);
661            // Delegate to tuple encoding.
662            fidl::encoding::Encode::<InternalGetTestResolutionContextResponse, D>::encode(
663                (
664                    <fidl::encoding::Boxed<fidl_fuchsia_component_resolution__common::Context> as fidl::encoding::ValueTypeMarker>::borrow(&self.context),
665                ),
666                encoder, offset, _depth
667            )
668        }
669    }
670    unsafe impl<
671        D: fidl::encoding::ResourceDialect,
672        T0: fidl::encoding::Encode<
673                fidl::encoding::Boxed<fidl_fuchsia_component_resolution__common::Context>,
674                D,
675            >,
676    > fidl::encoding::Encode<InternalGetTestResolutionContextResponse, D> for (T0,)
677    {
678        #[inline]
679        unsafe fn encode(
680            self,
681            encoder: &mut fidl::encoding::Encoder<'_, D>,
682            offset: usize,
683            depth: fidl::encoding::Depth,
684        ) -> fidl::Result<()> {
685            encoder.debug_check_bounds::<InternalGetTestResolutionContextResponse>(offset);
686            // Zero out padding regions. There's no need to apply masks
687            // because the unmasked parts will be overwritten by fields.
688            // Write the fields.
689            self.0.encode(encoder, offset + 0, depth)?;
690            Ok(())
691        }
692    }
693
694    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
695        for InternalGetTestResolutionContextResponse
696    {
697        #[inline(always)]
698        fn new_empty() -> Self {
699            Self {
700                context: fidl::new_empty!(
701                    fidl::encoding::Boxed<fidl_fuchsia_component_resolution__common::Context>,
702                    D
703                ),
704            }
705        }
706
707        #[inline]
708        unsafe fn decode(
709            &mut self,
710            decoder: &mut fidl::encoding::Decoder<'_, D>,
711            offset: usize,
712            _depth: fidl::encoding::Depth,
713        ) -> fidl::Result<()> {
714            decoder.debug_check_bounds::<Self>(offset);
715            // Verify that padding bytes are zero.
716            fidl::decode!(
717                fidl::encoding::Boxed<fidl_fuchsia_component_resolution__common::Context>,
718                D,
719                &mut self.context,
720                decoder,
721                offset + 0,
722                _depth
723            )?;
724            Ok(())
725        }
726    }
727
728    impl fidl::encoding::ValueTypeMarker for Offer {
729        type Borrowed<'a> = &'a Self;
730        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
731            value
732        }
733    }
734
735    unsafe impl fidl::encoding::TypeMarker for Offer {
736        type Owned = Self;
737
738        #[inline(always)]
739        fn inline_align(_context: fidl::encoding::Context) -> usize {
740            8
741        }
742
743        #[inline(always)]
744        fn inline_size(_context: fidl::encoding::Context) -> usize {
745            24
746        }
747    }
748
749    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Offer, D> for &Offer {
750        #[inline]
751        unsafe fn encode(
752            self,
753            encoder: &mut fidl::encoding::Encoder<'_, D>,
754            offset: usize,
755            _depth: fidl::encoding::Depth,
756        ) -> fidl::Result<()> {
757            encoder.debug_check_bounds::<Offer>(offset);
758            // Delegate to tuple encoding.
759            fidl::encoding::Encode::<Offer, D>::encode(
760                (
761                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
762                        &self.protocol_name,
763                    ),
764                    <Collection as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
765                ),
766                encoder,
767                offset,
768                _depth,
769            )
770        }
771    }
772    unsafe impl<
773        D: fidl::encoding::ResourceDialect,
774        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
775        T1: fidl::encoding::Encode<Collection, D>,
776    > fidl::encoding::Encode<Offer, D> for (T0, T1)
777    {
778        #[inline]
779        unsafe fn encode(
780            self,
781            encoder: &mut fidl::encoding::Encoder<'_, D>,
782            offset: usize,
783            depth: fidl::encoding::Depth,
784        ) -> fidl::Result<()> {
785            encoder.debug_check_bounds::<Offer>(offset);
786            // Zero out padding regions. There's no need to apply masks
787            // because the unmasked parts will be overwritten by fields.
788            unsafe {
789                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
790                (ptr as *mut u64).write_unaligned(0);
791            }
792            // Write the fields.
793            self.0.encode(encoder, offset + 0, depth)?;
794            self.1.encode(encoder, offset + 16, depth)?;
795            Ok(())
796        }
797    }
798
799    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Offer {
800        #[inline(always)]
801        fn new_empty() -> Self {
802            Self {
803                protocol_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
804                collection: fidl::new_empty!(Collection, D),
805            }
806        }
807
808        #[inline]
809        unsafe fn decode(
810            &mut self,
811            decoder: &mut fidl::encoding::Decoder<'_, D>,
812            offset: usize,
813            _depth: fidl::encoding::Depth,
814        ) -> fidl::Result<()> {
815            decoder.debug_check_bounds::<Self>(offset);
816            // Verify that padding bytes are zero.
817            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
818            let padval = unsafe { (ptr as *const u64).read_unaligned() };
819            let mask = 0xffffffff00000000u64;
820            let maskedval = padval & mask;
821            if maskedval != 0 {
822                return Err(fidl::Error::NonZeroPadding {
823                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
824                });
825            }
826            fidl::decode!(
827                fidl::encoding::UnboundedString,
828                D,
829                &mut self.protocol_name,
830                decoder,
831                offset + 0,
832                _depth
833            )?;
834            fidl::decode!(Collection, D, &mut self.collection, decoder, offset + 16, _depth)?;
835            Ok(())
836        }
837    }
838
839    impl fidl::encoding::ValueTypeMarker for SoftwareDevice {
840        type Borrowed<'a> = &'a Self;
841        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
842            value
843        }
844    }
845
846    unsafe impl fidl::encoding::TypeMarker for SoftwareDevice {
847        type Owned = Self;
848
849        #[inline(always)]
850        fn inline_align(_context: fidl::encoding::Context) -> usize {
851            8
852        }
853
854        #[inline(always)]
855        fn inline_size(_context: fidl::encoding::Context) -> usize {
856            24
857        }
858    }
859
860    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SoftwareDevice, D>
861        for &SoftwareDevice
862    {
863        #[inline]
864        unsafe fn encode(
865            self,
866            encoder: &mut fidl::encoding::Encoder<'_, D>,
867            offset: usize,
868            _depth: fidl::encoding::Depth,
869        ) -> fidl::Result<()> {
870            encoder.debug_check_bounds::<SoftwareDevice>(offset);
871            // Delegate to tuple encoding.
872            fidl::encoding::Encode::<SoftwareDevice, D>::encode(
873                (
874                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
875                        &self.device_name,
876                    ),
877                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
878                ),
879                encoder,
880                offset,
881                _depth,
882            )
883        }
884    }
885    unsafe impl<
886        D: fidl::encoding::ResourceDialect,
887        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
888        T1: fidl::encoding::Encode<u32, D>,
889    > fidl::encoding::Encode<SoftwareDevice, D> for (T0, T1)
890    {
891        #[inline]
892        unsafe fn encode(
893            self,
894            encoder: &mut fidl::encoding::Encoder<'_, D>,
895            offset: usize,
896            depth: fidl::encoding::Depth,
897        ) -> fidl::Result<()> {
898            encoder.debug_check_bounds::<SoftwareDevice>(offset);
899            // Zero out padding regions. There's no need to apply masks
900            // because the unmasked parts will be overwritten by fields.
901            unsafe {
902                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
903                (ptr as *mut u64).write_unaligned(0);
904            }
905            // Write the fields.
906            self.0.encode(encoder, offset + 0, depth)?;
907            self.1.encode(encoder, offset + 16, depth)?;
908            Ok(())
909        }
910    }
911
912    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SoftwareDevice {
913        #[inline(always)]
914        fn new_empty() -> Self {
915            Self {
916                device_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
917                device_id: fidl::new_empty!(u32, D),
918            }
919        }
920
921        #[inline]
922        unsafe fn decode(
923            &mut self,
924            decoder: &mut fidl::encoding::Decoder<'_, D>,
925            offset: usize,
926            _depth: fidl::encoding::Depth,
927        ) -> fidl::Result<()> {
928            decoder.debug_check_bounds::<Self>(offset);
929            // Verify that padding bytes are zero.
930            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
931            let padval = unsafe { (ptr as *const u64).read_unaligned() };
932            let mask = 0xffffffff00000000u64;
933            let maskedval = padval & mask;
934            if maskedval != 0 {
935                return Err(fidl::Error::NonZeroPadding {
936                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
937                });
938            }
939            fidl::decode!(
940                fidl::encoding::UnboundedString,
941                D,
942                &mut self.device_name,
943                decoder,
944                offset + 0,
945                _depth
946            )?;
947            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 16, _depth)?;
948            Ok(())
949        }
950    }
951}