fidl_fuchsia_hwinfo_mock__common/
fidl_fuchsia_hwinfo_mock__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#[derive(Clone, Debug, PartialEq)]
12pub struct SetterSetResponsesRequest {
13    pub device: fidl_fuchsia_hwinfo__common::DeviceInfo,
14    pub product: fidl_fuchsia_hwinfo__common::ProductInfo,
15    pub board: fidl_fuchsia_hwinfo__common::BoardInfo,
16}
17
18impl fidl::Persistable for SetterSetResponsesRequest {}
19
20pub mod setter_ordinals {
21    pub const SET_RESPONSES: u64 = 0x491d2c44c662f96d;
22}
23
24mod internal {
25    use super::*;
26
27    impl fidl::encoding::ValueTypeMarker for SetterSetResponsesRequest {
28        type Borrowed<'a> = &'a Self;
29        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
30            value
31        }
32    }
33
34    unsafe impl fidl::encoding::TypeMarker for SetterSetResponsesRequest {
35        type Owned = Self;
36
37        #[inline(always)]
38        fn inline_align(_context: fidl::encoding::Context) -> usize {
39            8
40        }
41
42        #[inline(always)]
43        fn inline_size(_context: fidl::encoding::Context) -> usize {
44            48
45        }
46    }
47
48    unsafe impl<D: fidl::encoding::ResourceDialect>
49        fidl::encoding::Encode<SetterSetResponsesRequest, D> for &SetterSetResponsesRequest
50    {
51        #[inline]
52        unsafe fn encode(
53            self,
54            encoder: &mut fidl::encoding::Encoder<'_, D>,
55            offset: usize,
56            _depth: fidl::encoding::Depth,
57        ) -> fidl::Result<()> {
58            encoder.debug_check_bounds::<SetterSetResponsesRequest>(offset);
59            // Delegate to tuple encoding.
60            fidl::encoding::Encode::<SetterSetResponsesRequest, D>::encode(
61                (
62                    <fidl_fuchsia_hwinfo__common::DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.device),
63                    <fidl_fuchsia_hwinfo__common::ProductInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.product),
64                    <fidl_fuchsia_hwinfo__common::BoardInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.board),
65                ),
66                encoder, offset, _depth
67            )
68        }
69    }
70    unsafe impl<
71            D: fidl::encoding::ResourceDialect,
72            T0: fidl::encoding::Encode<fidl_fuchsia_hwinfo__common::DeviceInfo, D>,
73            T1: fidl::encoding::Encode<fidl_fuchsia_hwinfo__common::ProductInfo, D>,
74            T2: fidl::encoding::Encode<fidl_fuchsia_hwinfo__common::BoardInfo, D>,
75        > fidl::encoding::Encode<SetterSetResponsesRequest, D> for (T0, T1, T2)
76    {
77        #[inline]
78        unsafe fn encode(
79            self,
80            encoder: &mut fidl::encoding::Encoder<'_, D>,
81            offset: usize,
82            depth: fidl::encoding::Depth,
83        ) -> fidl::Result<()> {
84            encoder.debug_check_bounds::<SetterSetResponsesRequest>(offset);
85            // Zero out padding regions. There's no need to apply masks
86            // because the unmasked parts will be overwritten by fields.
87            // Write the fields.
88            self.0.encode(encoder, offset + 0, depth)?;
89            self.1.encode(encoder, offset + 16, depth)?;
90            self.2.encode(encoder, offset + 32, depth)?;
91            Ok(())
92        }
93    }
94
95    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
96        for SetterSetResponsesRequest
97    {
98        #[inline(always)]
99        fn new_empty() -> Self {
100            Self {
101                device: fidl::new_empty!(fidl_fuchsia_hwinfo__common::DeviceInfo, D),
102                product: fidl::new_empty!(fidl_fuchsia_hwinfo__common::ProductInfo, D),
103                board: fidl::new_empty!(fidl_fuchsia_hwinfo__common::BoardInfo, D),
104            }
105        }
106
107        #[inline]
108        unsafe fn decode(
109            &mut self,
110            decoder: &mut fidl::encoding::Decoder<'_, D>,
111            offset: usize,
112            _depth: fidl::encoding::Depth,
113        ) -> fidl::Result<()> {
114            decoder.debug_check_bounds::<Self>(offset);
115            // Verify that padding bytes are zero.
116            fidl::decode!(
117                fidl_fuchsia_hwinfo__common::DeviceInfo,
118                D,
119                &mut self.device,
120                decoder,
121                offset + 0,
122                _depth
123            )?;
124            fidl::decode!(
125                fidl_fuchsia_hwinfo__common::ProductInfo,
126                D,
127                &mut self.product,
128                decoder,
129                offset + 16,
130                _depth
131            )?;
132            fidl::decode!(
133                fidl_fuchsia_hwinfo__common::BoardInfo,
134                D,
135                &mut self.board,
136                decoder,
137                offset + 32,
138                _depth
139            )?;
140            Ok(())
141        }
142    }
143}