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
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__common::DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.device),
59                    <fidl_fuchsia_hwinfo__common::ProductInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.product),
60                    <fidl_fuchsia_hwinfo__common::BoardInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.board),
61                ),
62                encoder, offset, _depth
63            )
64        }
65    }
66    unsafe impl<
67            D: fidl::encoding::ResourceDialect,
68            T0: fidl::encoding::Encode<fidl_fuchsia_hwinfo__common::DeviceInfo, D>,
69            T1: fidl::encoding::Encode<fidl_fuchsia_hwinfo__common::ProductInfo, D>,
70            T2: fidl::encoding::Encode<fidl_fuchsia_hwinfo__common::BoardInfo, D>,
71        > fidl::encoding::Encode<SetterSetResponsesRequest, D> for (T0, T1, T2)
72    {
73        #[inline]
74        unsafe fn encode(
75            self,
76            encoder: &mut fidl::encoding::Encoder<'_, D>,
77            offset: usize,
78            depth: fidl::encoding::Depth,
79        ) -> fidl::Result<()> {
80            encoder.debug_check_bounds::<SetterSetResponsesRequest>(offset);
81            // Zero out padding regions. There's no need to apply masks
82            // because the unmasked parts will be overwritten by fields.
83            // Write the fields.
84            self.0.encode(encoder, offset + 0, depth)?;
85            self.1.encode(encoder, offset + 16, depth)?;
86            self.2.encode(encoder, offset + 32, depth)?;
87            Ok(())
88        }
89    }
90
91    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
92        for SetterSetResponsesRequest
93    {
94        #[inline(always)]
95        fn new_empty() -> Self {
96            Self {
97                device: fidl::new_empty!(fidl_fuchsia_hwinfo__common::DeviceInfo, D),
98                product: fidl::new_empty!(fidl_fuchsia_hwinfo__common::ProductInfo, D),
99                board: fidl::new_empty!(fidl_fuchsia_hwinfo__common::BoardInfo, D),
100            }
101        }
102
103        #[inline]
104        unsafe fn decode(
105            &mut self,
106            decoder: &mut fidl::encoding::Decoder<'_, D>,
107            offset: usize,
108            _depth: fidl::encoding::Depth,
109        ) -> fidl::Result<()> {
110            decoder.debug_check_bounds::<Self>(offset);
111            // Verify that padding bytes are zero.
112            fidl::decode!(
113                fidl_fuchsia_hwinfo__common::DeviceInfo,
114                D,
115                &mut self.device,
116                decoder,
117                offset + 0,
118                _depth
119            )?;
120            fidl::decode!(
121                fidl_fuchsia_hwinfo__common::ProductInfo,
122                D,
123                &mut self.product,
124                decoder,
125                offset + 16,
126                _depth
127            )?;
128            fidl::decode!(
129                fidl_fuchsia_hwinfo__common::BoardInfo,
130                D,
131                &mut self.board,
132                decoder,
133                offset + 32,
134                _depth
135            )?;
136            Ok(())
137        }
138    }
139}