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