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