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