fidl_fuchsia_sysinfo__common/
fidl_fuchsia_sysinfo__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
11pub const BOARD_NAME_LEN: u8 = 32;
12
13pub const BOOTLOADER_VENDOR_LEN: u8 = 32;
14
15pub const SERIAL_NUMBER_LEN: u8 = 32;
16
17#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
18pub enum InterruptControllerType {
19    Unknown,
20    Apic,
21    GicV2,
22    GicV3,
23    Plic,
24    #[doc(hidden)]
25    __SourceBreaking {
26        unknown_ordinal: u32,
27    },
28}
29
30/// Pattern that matches an unknown `InterruptControllerType` member.
31#[macro_export]
32macro_rules! InterruptControllerTypeUnknown {
33    () => {
34        _
35    };
36}
37
38impl InterruptControllerType {
39    #[inline]
40    pub fn from_primitive(prim: u32) -> Option<Self> {
41        match prim {
42            0 => Some(Self::Unknown),
43            1 => Some(Self::Apic),
44            2 => Some(Self::GicV2),
45            3 => Some(Self::GicV3),
46            4 => Some(Self::Plic),
47            _ => None,
48        }
49    }
50
51    #[inline]
52    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
53        match prim {
54            0 => Self::Unknown,
55            1 => Self::Apic,
56            2 => Self::GicV2,
57            3 => Self::GicV3,
58            4 => Self::Plic,
59            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
60        }
61    }
62
63    #[inline]
64    pub fn unknown() -> Self {
65        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
66    }
67
68    #[inline]
69    pub const fn into_primitive(self) -> u32 {
70        match self {
71            Self::Unknown => 0,
72            Self::Apic => 1,
73            Self::GicV2 => 2,
74            Self::GicV3 => 3,
75            Self::Plic => 4,
76            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
77        }
78    }
79
80    #[inline]
81    pub fn is_unknown(&self) -> bool {
82        match self {
83            Self::__SourceBreaking { unknown_ordinal: _ } => true,
84            _ => false,
85        }
86    }
87}
88
89#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
90pub struct InterruptControllerInfo {
91    pub type_: InterruptControllerType,
92}
93
94impl fidl::Persistable for InterruptControllerInfo {}
95
96#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97pub struct SysInfoGetBoardNameResponse {
98    pub status: i32,
99    pub name: Option<String>,
100}
101
102impl fidl::Persistable for SysInfoGetBoardNameResponse {}
103
104#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105#[repr(C)]
106pub struct SysInfoGetBoardRevisionResponse {
107    pub status: i32,
108    pub revision: u32,
109}
110
111impl fidl::Persistable for SysInfoGetBoardRevisionResponse {}
112
113#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114pub struct SysInfoGetBootloaderVendorResponse {
115    pub status: i32,
116    pub vendor: Option<String>,
117}
118
119impl fidl::Persistable for SysInfoGetBootloaderVendorResponse {}
120
121#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
122pub struct SysInfoGetInterruptControllerInfoResponse {
123    pub status: i32,
124    pub info: Option<Box<InterruptControllerInfo>>,
125}
126
127impl fidl::Persistable for SysInfoGetInterruptControllerInfoResponse {}
128
129#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
130pub struct SysInfoGetSerialNumberResponse {
131    pub serial: String,
132}
133
134impl fidl::Persistable for SysInfoGetSerialNumberResponse {}
135
136pub mod sys_info_ordinals {
137    pub const GET_BOARD_NAME: u64 = 0x6d29d1a6edf9a614;
138    pub const GET_BOARD_REVISION: u64 = 0x3dd050d99012e9cc;
139    pub const GET_BOOTLOADER_VENDOR: u64 = 0x2511f1c2f9ae2017;
140    pub const GET_INTERRUPT_CONTROLLER_INFO: u64 = 0x31a438b28dca119c;
141    pub const GET_SERIAL_NUMBER: u64 = 0x3b6920410a59f01f;
142}
143
144mod internal {
145    use super::*;
146    unsafe impl fidl::encoding::TypeMarker for InterruptControllerType {
147        type Owned = Self;
148
149        #[inline(always)]
150        fn inline_align(_context: fidl::encoding::Context) -> usize {
151            std::mem::align_of::<u32>()
152        }
153
154        #[inline(always)]
155        fn inline_size(_context: fidl::encoding::Context) -> usize {
156            std::mem::size_of::<u32>()
157        }
158
159        #[inline(always)]
160        fn encode_is_copy() -> bool {
161            false
162        }
163
164        #[inline(always)]
165        fn decode_is_copy() -> bool {
166            false
167        }
168    }
169
170    impl fidl::encoding::ValueTypeMarker for InterruptControllerType {
171        type Borrowed<'a> = Self;
172        #[inline(always)]
173        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
174            *value
175        }
176    }
177
178    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
179        for InterruptControllerType
180    {
181        #[inline]
182        unsafe fn encode(
183            self,
184            encoder: &mut fidl::encoding::Encoder<'_, D>,
185            offset: usize,
186            _depth: fidl::encoding::Depth,
187        ) -> fidl::Result<()> {
188            encoder.debug_check_bounds::<Self>(offset);
189            encoder.write_num(self.into_primitive(), offset);
190            Ok(())
191        }
192    }
193
194    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
195        for InterruptControllerType
196    {
197        #[inline(always)]
198        fn new_empty() -> Self {
199            Self::unknown()
200        }
201
202        #[inline]
203        unsafe fn decode(
204            &mut self,
205            decoder: &mut fidl::encoding::Decoder<'_, D>,
206            offset: usize,
207            _depth: fidl::encoding::Depth,
208        ) -> fidl::Result<()> {
209            decoder.debug_check_bounds::<Self>(offset);
210            let prim = decoder.read_num::<u32>(offset);
211
212            *self = Self::from_primitive_allow_unknown(prim);
213            Ok(())
214        }
215    }
216
217    impl fidl::encoding::ValueTypeMarker for InterruptControllerInfo {
218        type Borrowed<'a> = &'a Self;
219        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
220            value
221        }
222    }
223
224    unsafe impl fidl::encoding::TypeMarker for InterruptControllerInfo {
225        type Owned = Self;
226
227        #[inline(always)]
228        fn inline_align(_context: fidl::encoding::Context) -> usize {
229            4
230        }
231
232        #[inline(always)]
233        fn inline_size(_context: fidl::encoding::Context) -> usize {
234            4
235        }
236    }
237
238    unsafe impl<D: fidl::encoding::ResourceDialect>
239        fidl::encoding::Encode<InterruptControllerInfo, D> for &InterruptControllerInfo
240    {
241        #[inline]
242        unsafe fn encode(
243            self,
244            encoder: &mut fidl::encoding::Encoder<'_, D>,
245            offset: usize,
246            _depth: fidl::encoding::Depth,
247        ) -> fidl::Result<()> {
248            encoder.debug_check_bounds::<InterruptControllerInfo>(offset);
249            // Delegate to tuple encoding.
250            fidl::encoding::Encode::<InterruptControllerInfo, D>::encode(
251                (<InterruptControllerType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),),
252                encoder,
253                offset,
254                _depth,
255            )
256        }
257    }
258    unsafe impl<
259            D: fidl::encoding::ResourceDialect,
260            T0: fidl::encoding::Encode<InterruptControllerType, D>,
261        > fidl::encoding::Encode<InterruptControllerInfo, D> for (T0,)
262    {
263        #[inline]
264        unsafe fn encode(
265            self,
266            encoder: &mut fidl::encoding::Encoder<'_, D>,
267            offset: usize,
268            depth: fidl::encoding::Depth,
269        ) -> fidl::Result<()> {
270            encoder.debug_check_bounds::<InterruptControllerInfo>(offset);
271            // Zero out padding regions. There's no need to apply masks
272            // because the unmasked parts will be overwritten by fields.
273            // Write the fields.
274            self.0.encode(encoder, offset + 0, depth)?;
275            Ok(())
276        }
277    }
278
279    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
280        for InterruptControllerInfo
281    {
282        #[inline(always)]
283        fn new_empty() -> Self {
284            Self { type_: fidl::new_empty!(InterruptControllerType, D) }
285        }
286
287        #[inline]
288        unsafe fn decode(
289            &mut self,
290            decoder: &mut fidl::encoding::Decoder<'_, D>,
291            offset: usize,
292            _depth: fidl::encoding::Depth,
293        ) -> fidl::Result<()> {
294            decoder.debug_check_bounds::<Self>(offset);
295            // Verify that padding bytes are zero.
296            fidl::decode!(
297                InterruptControllerType,
298                D,
299                &mut self.type_,
300                decoder,
301                offset + 0,
302                _depth
303            )?;
304            Ok(())
305        }
306    }
307
308    impl fidl::encoding::ValueTypeMarker for SysInfoGetBoardNameResponse {
309        type Borrowed<'a> = &'a Self;
310        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
311            value
312        }
313    }
314
315    unsafe impl fidl::encoding::TypeMarker for SysInfoGetBoardNameResponse {
316        type Owned = Self;
317
318        #[inline(always)]
319        fn inline_align(_context: fidl::encoding::Context) -> usize {
320            8
321        }
322
323        #[inline(always)]
324        fn inline_size(_context: fidl::encoding::Context) -> usize {
325            24
326        }
327    }
328
329    unsafe impl<D: fidl::encoding::ResourceDialect>
330        fidl::encoding::Encode<SysInfoGetBoardNameResponse, D> for &SysInfoGetBoardNameResponse
331    {
332        #[inline]
333        unsafe fn encode(
334            self,
335            encoder: &mut fidl::encoding::Encoder<'_, D>,
336            offset: usize,
337            _depth: fidl::encoding::Depth,
338        ) -> fidl::Result<()> {
339            encoder.debug_check_bounds::<SysInfoGetBoardNameResponse>(offset);
340            // Delegate to tuple encoding.
341            fidl::encoding::Encode::<SysInfoGetBoardNameResponse, D>::encode(
342                (
343                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
344                    <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
345                ),
346                encoder, offset, _depth
347            )
348        }
349    }
350    unsafe impl<
351            D: fidl::encoding::ResourceDialect,
352            T0: fidl::encoding::Encode<i32, D>,
353            T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
354        > fidl::encoding::Encode<SysInfoGetBoardNameResponse, D> for (T0, T1)
355    {
356        #[inline]
357        unsafe fn encode(
358            self,
359            encoder: &mut fidl::encoding::Encoder<'_, D>,
360            offset: usize,
361            depth: fidl::encoding::Depth,
362        ) -> fidl::Result<()> {
363            encoder.debug_check_bounds::<SysInfoGetBoardNameResponse>(offset);
364            // Zero out padding regions. There's no need to apply masks
365            // because the unmasked parts will be overwritten by fields.
366            unsafe {
367                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
368                (ptr as *mut u64).write_unaligned(0);
369            }
370            // Write the fields.
371            self.0.encode(encoder, offset + 0, depth)?;
372            self.1.encode(encoder, offset + 8, depth)?;
373            Ok(())
374        }
375    }
376
377    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
378        for SysInfoGetBoardNameResponse
379    {
380        #[inline(always)]
381        fn new_empty() -> Self {
382            Self {
383                status: fidl::new_empty!(i32, D),
384                name: fidl::new_empty!(
385                    fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
386                    D
387                ),
388            }
389        }
390
391        #[inline]
392        unsafe fn decode(
393            &mut self,
394            decoder: &mut fidl::encoding::Decoder<'_, D>,
395            offset: usize,
396            _depth: fidl::encoding::Depth,
397        ) -> fidl::Result<()> {
398            decoder.debug_check_bounds::<Self>(offset);
399            // Verify that padding bytes are zero.
400            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
401            let padval = unsafe { (ptr as *const u64).read_unaligned() };
402            let mask = 0xffffffff00000000u64;
403            let maskedval = padval & mask;
404            if maskedval != 0 {
405                return Err(fidl::Error::NonZeroPadding {
406                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
407                });
408            }
409            fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
410            fidl::decode!(
411                fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
412                D,
413                &mut self.name,
414                decoder,
415                offset + 8,
416                _depth
417            )?;
418            Ok(())
419        }
420    }
421
422    impl fidl::encoding::ValueTypeMarker for SysInfoGetBoardRevisionResponse {
423        type Borrowed<'a> = &'a Self;
424        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
425            value
426        }
427    }
428
429    unsafe impl fidl::encoding::TypeMarker for SysInfoGetBoardRevisionResponse {
430        type Owned = Self;
431
432        #[inline(always)]
433        fn inline_align(_context: fidl::encoding::Context) -> usize {
434            4
435        }
436
437        #[inline(always)]
438        fn inline_size(_context: fidl::encoding::Context) -> usize {
439            8
440        }
441        #[inline(always)]
442        fn encode_is_copy() -> bool {
443            true
444        }
445
446        #[inline(always)]
447        fn decode_is_copy() -> bool {
448            true
449        }
450    }
451
452    unsafe impl<D: fidl::encoding::ResourceDialect>
453        fidl::encoding::Encode<SysInfoGetBoardRevisionResponse, D>
454        for &SysInfoGetBoardRevisionResponse
455    {
456        #[inline]
457        unsafe fn encode(
458            self,
459            encoder: &mut fidl::encoding::Encoder<'_, D>,
460            offset: usize,
461            _depth: fidl::encoding::Depth,
462        ) -> fidl::Result<()> {
463            encoder.debug_check_bounds::<SysInfoGetBoardRevisionResponse>(offset);
464            unsafe {
465                // Copy the object into the buffer.
466                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
467                (buf_ptr as *mut SysInfoGetBoardRevisionResponse)
468                    .write_unaligned((self as *const SysInfoGetBoardRevisionResponse).read());
469                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
470                // done second because the memcpy will write garbage to these bytes.
471            }
472            Ok(())
473        }
474    }
475    unsafe impl<
476            D: fidl::encoding::ResourceDialect,
477            T0: fidl::encoding::Encode<i32, D>,
478            T1: fidl::encoding::Encode<u32, D>,
479        > fidl::encoding::Encode<SysInfoGetBoardRevisionResponse, D> for (T0, T1)
480    {
481        #[inline]
482        unsafe fn encode(
483            self,
484            encoder: &mut fidl::encoding::Encoder<'_, D>,
485            offset: usize,
486            depth: fidl::encoding::Depth,
487        ) -> fidl::Result<()> {
488            encoder.debug_check_bounds::<SysInfoGetBoardRevisionResponse>(offset);
489            // Zero out padding regions. There's no need to apply masks
490            // because the unmasked parts will be overwritten by fields.
491            // Write the fields.
492            self.0.encode(encoder, offset + 0, depth)?;
493            self.1.encode(encoder, offset + 4, depth)?;
494            Ok(())
495        }
496    }
497
498    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
499        for SysInfoGetBoardRevisionResponse
500    {
501        #[inline(always)]
502        fn new_empty() -> Self {
503            Self { status: fidl::new_empty!(i32, D), revision: fidl::new_empty!(u32, D) }
504        }
505
506        #[inline]
507        unsafe fn decode(
508            &mut self,
509            decoder: &mut fidl::encoding::Decoder<'_, D>,
510            offset: usize,
511            _depth: fidl::encoding::Depth,
512        ) -> fidl::Result<()> {
513            decoder.debug_check_bounds::<Self>(offset);
514            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
515            // Verify that padding bytes are zero.
516            // Copy from the buffer into the object.
517            unsafe {
518                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
519            }
520            Ok(())
521        }
522    }
523
524    impl fidl::encoding::ValueTypeMarker for SysInfoGetBootloaderVendorResponse {
525        type Borrowed<'a> = &'a Self;
526        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
527            value
528        }
529    }
530
531    unsafe impl fidl::encoding::TypeMarker for SysInfoGetBootloaderVendorResponse {
532        type Owned = Self;
533
534        #[inline(always)]
535        fn inline_align(_context: fidl::encoding::Context) -> usize {
536            8
537        }
538
539        #[inline(always)]
540        fn inline_size(_context: fidl::encoding::Context) -> usize {
541            24
542        }
543    }
544
545    unsafe impl<D: fidl::encoding::ResourceDialect>
546        fidl::encoding::Encode<SysInfoGetBootloaderVendorResponse, D>
547        for &SysInfoGetBootloaderVendorResponse
548    {
549        #[inline]
550        unsafe fn encode(
551            self,
552            encoder: &mut fidl::encoding::Encoder<'_, D>,
553            offset: usize,
554            _depth: fidl::encoding::Depth,
555        ) -> fidl::Result<()> {
556            encoder.debug_check_bounds::<SysInfoGetBootloaderVendorResponse>(offset);
557            // Delegate to tuple encoding.
558            fidl::encoding::Encode::<SysInfoGetBootloaderVendorResponse, D>::encode(
559                (
560                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
561                    <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor),
562                ),
563                encoder, offset, _depth
564            )
565        }
566    }
567    unsafe impl<
568            D: fidl::encoding::ResourceDialect,
569            T0: fidl::encoding::Encode<i32, D>,
570            T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
571        > fidl::encoding::Encode<SysInfoGetBootloaderVendorResponse, D> for (T0, T1)
572    {
573        #[inline]
574        unsafe fn encode(
575            self,
576            encoder: &mut fidl::encoding::Encoder<'_, D>,
577            offset: usize,
578            depth: fidl::encoding::Depth,
579        ) -> fidl::Result<()> {
580            encoder.debug_check_bounds::<SysInfoGetBootloaderVendorResponse>(offset);
581            // Zero out padding regions. There's no need to apply masks
582            // because the unmasked parts will be overwritten by fields.
583            unsafe {
584                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
585                (ptr as *mut u64).write_unaligned(0);
586            }
587            // Write the fields.
588            self.0.encode(encoder, offset + 0, depth)?;
589            self.1.encode(encoder, offset + 8, depth)?;
590            Ok(())
591        }
592    }
593
594    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
595        for SysInfoGetBootloaderVendorResponse
596    {
597        #[inline(always)]
598        fn new_empty() -> Self {
599            Self {
600                status: fidl::new_empty!(i32, D),
601                vendor: fidl::new_empty!(
602                    fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
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            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
618            let padval = unsafe { (ptr as *const u64).read_unaligned() };
619            let mask = 0xffffffff00000000u64;
620            let maskedval = padval & mask;
621            if maskedval != 0 {
622                return Err(fidl::Error::NonZeroPadding {
623                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
624                });
625            }
626            fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
627            fidl::decode!(
628                fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
629                D,
630                &mut self.vendor,
631                decoder,
632                offset + 8,
633                _depth
634            )?;
635            Ok(())
636        }
637    }
638
639    impl fidl::encoding::ValueTypeMarker for SysInfoGetInterruptControllerInfoResponse {
640        type Borrowed<'a> = &'a Self;
641        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
642            value
643        }
644    }
645
646    unsafe impl fidl::encoding::TypeMarker for SysInfoGetInterruptControllerInfoResponse {
647        type Owned = Self;
648
649        #[inline(always)]
650        fn inline_align(_context: fidl::encoding::Context) -> usize {
651            8
652        }
653
654        #[inline(always)]
655        fn inline_size(_context: fidl::encoding::Context) -> usize {
656            16
657        }
658    }
659
660    unsafe impl<D: fidl::encoding::ResourceDialect>
661        fidl::encoding::Encode<SysInfoGetInterruptControllerInfoResponse, D>
662        for &SysInfoGetInterruptControllerInfoResponse
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::<SysInfoGetInterruptControllerInfoResponse>(offset);
672            // Delegate to tuple encoding.
673            fidl::encoding::Encode::<SysInfoGetInterruptControllerInfoResponse, D>::encode(
674                (
675                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
676                    <fidl::encoding::Boxed<InterruptControllerInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
677                ),
678                encoder, offset, _depth
679            )
680        }
681    }
682    unsafe impl<
683            D: fidl::encoding::ResourceDialect,
684            T0: fidl::encoding::Encode<i32, D>,
685            T1: fidl::encoding::Encode<fidl::encoding::Boxed<InterruptControllerInfo>, D>,
686        > fidl::encoding::Encode<SysInfoGetInterruptControllerInfoResponse, D> for (T0, T1)
687    {
688        #[inline]
689        unsafe fn encode(
690            self,
691            encoder: &mut fidl::encoding::Encoder<'_, D>,
692            offset: usize,
693            depth: fidl::encoding::Depth,
694        ) -> fidl::Result<()> {
695            encoder.debug_check_bounds::<SysInfoGetInterruptControllerInfoResponse>(offset);
696            // Zero out padding regions. There's no need to apply masks
697            // because the unmasked parts will be overwritten by fields.
698            unsafe {
699                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
700                (ptr as *mut u64).write_unaligned(0);
701            }
702            // Write the fields.
703            self.0.encode(encoder, offset + 0, depth)?;
704            self.1.encode(encoder, offset + 8, depth)?;
705            Ok(())
706        }
707    }
708
709    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
710        for SysInfoGetInterruptControllerInfoResponse
711    {
712        #[inline(always)]
713        fn new_empty() -> Self {
714            Self {
715                status: fidl::new_empty!(i32, D),
716                info: fidl::new_empty!(fidl::encoding::Boxed<InterruptControllerInfo>, D),
717            }
718        }
719
720        #[inline]
721        unsafe fn decode(
722            &mut self,
723            decoder: &mut fidl::encoding::Decoder<'_, D>,
724            offset: usize,
725            _depth: fidl::encoding::Depth,
726        ) -> fidl::Result<()> {
727            decoder.debug_check_bounds::<Self>(offset);
728            // Verify that padding bytes are zero.
729            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
730            let padval = unsafe { (ptr as *const u64).read_unaligned() };
731            let mask = 0xffffffff00000000u64;
732            let maskedval = padval & mask;
733            if maskedval != 0 {
734                return Err(fidl::Error::NonZeroPadding {
735                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
736                });
737            }
738            fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
739            fidl::decode!(
740                fidl::encoding::Boxed<InterruptControllerInfo>,
741                D,
742                &mut self.info,
743                decoder,
744                offset + 8,
745                _depth
746            )?;
747            Ok(())
748        }
749    }
750
751    impl fidl::encoding::ValueTypeMarker for SysInfoGetSerialNumberResponse {
752        type Borrowed<'a> = &'a Self;
753        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
754            value
755        }
756    }
757
758    unsafe impl fidl::encoding::TypeMarker for SysInfoGetSerialNumberResponse {
759        type Owned = Self;
760
761        #[inline(always)]
762        fn inline_align(_context: fidl::encoding::Context) -> usize {
763            8
764        }
765
766        #[inline(always)]
767        fn inline_size(_context: fidl::encoding::Context) -> usize {
768            16
769        }
770    }
771
772    unsafe impl<D: fidl::encoding::ResourceDialect>
773        fidl::encoding::Encode<SysInfoGetSerialNumberResponse, D>
774        for &SysInfoGetSerialNumberResponse
775    {
776        #[inline]
777        unsafe fn encode(
778            self,
779            encoder: &mut fidl::encoding::Encoder<'_, D>,
780            offset: usize,
781            _depth: fidl::encoding::Depth,
782        ) -> fidl::Result<()> {
783            encoder.debug_check_bounds::<SysInfoGetSerialNumberResponse>(offset);
784            // Delegate to tuple encoding.
785            fidl::encoding::Encode::<SysInfoGetSerialNumberResponse, D>::encode(
786                (<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
787                    &self.serial,
788                ),),
789                encoder,
790                offset,
791                _depth,
792            )
793        }
794    }
795    unsafe impl<
796            D: fidl::encoding::ResourceDialect,
797            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
798        > fidl::encoding::Encode<SysInfoGetSerialNumberResponse, D> for (T0,)
799    {
800        #[inline]
801        unsafe fn encode(
802            self,
803            encoder: &mut fidl::encoding::Encoder<'_, D>,
804            offset: usize,
805            depth: fidl::encoding::Depth,
806        ) -> fidl::Result<()> {
807            encoder.debug_check_bounds::<SysInfoGetSerialNumberResponse>(offset);
808            // Zero out padding regions. There's no need to apply masks
809            // because the unmasked parts will be overwritten by fields.
810            // Write the fields.
811            self.0.encode(encoder, offset + 0, depth)?;
812            Ok(())
813        }
814    }
815
816    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
817        for SysInfoGetSerialNumberResponse
818    {
819        #[inline(always)]
820        fn new_empty() -> Self {
821            Self { serial: fidl::new_empty!(fidl::encoding::BoundedString<32>, D) }
822        }
823
824        #[inline]
825        unsafe fn decode(
826            &mut self,
827            decoder: &mut fidl::encoding::Decoder<'_, D>,
828            offset: usize,
829            _depth: fidl::encoding::Depth,
830        ) -> fidl::Result<()> {
831            decoder.debug_check_bounds::<Self>(offset);
832            // Verify that padding bytes are zero.
833            fidl::decode!(
834                fidl::encoding::BoundedString<32>,
835                D,
836                &mut self.serial,
837                decoder,
838                offset + 0,
839                _depth
840            )?;
841            Ok(())
842        }
843    }
844}