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