fidl_fuchsia_examples_intl_wisdom_common/
fidl_fuchsia_examples_intl_wisdom_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 IntlWisdomServerAskForWisdomRequest {
13    pub intl_profile: fidl_fuchsia_intl::Profile,
14    pub timestamp_ms: i64,
15}
16
17impl fidl::Persistable for IntlWisdomServerAskForWisdomRequest {}
18
19#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20pub struct IntlWisdomServerAskForWisdomResponse {
21    pub response: Option<String>,
22}
23
24impl fidl::Persistable for IntlWisdomServerAskForWisdomResponse {}
25
26mod internal {
27    use super::*;
28
29    impl fidl::encoding::ValueTypeMarker for IntlWisdomServerAskForWisdomRequest {
30        type Borrowed<'a> = &'a Self;
31        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
32            value
33        }
34    }
35
36    unsafe impl fidl::encoding::TypeMarker for IntlWisdomServerAskForWisdomRequest {
37        type Owned = Self;
38
39        #[inline(always)]
40        fn inline_align(_context: fidl::encoding::Context) -> usize {
41            8
42        }
43
44        #[inline(always)]
45        fn inline_size(_context: fidl::encoding::Context) -> usize {
46            24
47        }
48    }
49
50    unsafe impl<D: fidl::encoding::ResourceDialect>
51        fidl::encoding::Encode<IntlWisdomServerAskForWisdomRequest, D>
52        for &IntlWisdomServerAskForWisdomRequest
53    {
54        #[inline]
55        unsafe fn encode(
56            self,
57            encoder: &mut fidl::encoding::Encoder<'_, D>,
58            offset: usize,
59            _depth: fidl::encoding::Depth,
60        ) -> fidl::Result<()> {
61            encoder.debug_check_bounds::<IntlWisdomServerAskForWisdomRequest>(offset);
62            // Delegate to tuple encoding.
63            fidl::encoding::Encode::<IntlWisdomServerAskForWisdomRequest, D>::encode(
64                (
65                    <fidl_fuchsia_intl::Profile as fidl::encoding::ValueTypeMarker>::borrow(
66                        &self.intl_profile,
67                    ),
68                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timestamp_ms),
69                ),
70                encoder,
71                offset,
72                _depth,
73            )
74        }
75    }
76    unsafe impl<
77            D: fidl::encoding::ResourceDialect,
78            T0: fidl::encoding::Encode<fidl_fuchsia_intl::Profile, D>,
79            T1: fidl::encoding::Encode<i64, D>,
80        > fidl::encoding::Encode<IntlWisdomServerAskForWisdomRequest, D> for (T0, T1)
81    {
82        #[inline]
83        unsafe fn encode(
84            self,
85            encoder: &mut fidl::encoding::Encoder<'_, D>,
86            offset: usize,
87            depth: fidl::encoding::Depth,
88        ) -> fidl::Result<()> {
89            encoder.debug_check_bounds::<IntlWisdomServerAskForWisdomRequest>(offset);
90            // Zero out padding regions. There's no need to apply masks
91            // because the unmasked parts will be overwritten by fields.
92            // Write the fields.
93            self.0.encode(encoder, offset + 0, depth)?;
94            self.1.encode(encoder, offset + 16, depth)?;
95            Ok(())
96        }
97    }
98
99    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
100        for IntlWisdomServerAskForWisdomRequest
101    {
102        #[inline(always)]
103        fn new_empty() -> Self {
104            Self {
105                intl_profile: fidl::new_empty!(fidl_fuchsia_intl::Profile, D),
106                timestamp_ms: fidl::new_empty!(i64, D),
107            }
108        }
109
110        #[inline]
111        unsafe fn decode(
112            &mut self,
113            decoder: &mut fidl::encoding::Decoder<'_, D>,
114            offset: usize,
115            _depth: fidl::encoding::Depth,
116        ) -> fidl::Result<()> {
117            decoder.debug_check_bounds::<Self>(offset);
118            // Verify that padding bytes are zero.
119            fidl::decode!(
120                fidl_fuchsia_intl::Profile,
121                D,
122                &mut self.intl_profile,
123                decoder,
124                offset + 0,
125                _depth
126            )?;
127            fidl::decode!(i64, D, &mut self.timestamp_ms, decoder, offset + 16, _depth)?;
128            Ok(())
129        }
130    }
131
132    impl fidl::encoding::ValueTypeMarker for IntlWisdomServerAskForWisdomResponse {
133        type Borrowed<'a> = &'a Self;
134        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
135            value
136        }
137    }
138
139    unsafe impl fidl::encoding::TypeMarker for IntlWisdomServerAskForWisdomResponse {
140        type Owned = Self;
141
142        #[inline(always)]
143        fn inline_align(_context: fidl::encoding::Context) -> usize {
144            8
145        }
146
147        #[inline(always)]
148        fn inline_size(_context: fidl::encoding::Context) -> usize {
149            16
150        }
151    }
152
153    unsafe impl<D: fidl::encoding::ResourceDialect>
154        fidl::encoding::Encode<IntlWisdomServerAskForWisdomResponse, D>
155        for &IntlWisdomServerAskForWisdomResponse
156    {
157        #[inline]
158        unsafe fn encode(
159            self,
160            encoder: &mut fidl::encoding::Encoder<'_, D>,
161            offset: usize,
162            _depth: fidl::encoding::Depth,
163        ) -> fidl::Result<()> {
164            encoder.debug_check_bounds::<IntlWisdomServerAskForWisdomResponse>(offset);
165            // Delegate to tuple encoding.
166            fidl::encoding::Encode::<IntlWisdomServerAskForWisdomResponse, D>::encode(
167                (
168                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.response),
169                ),
170                encoder, offset, _depth
171            )
172        }
173    }
174    unsafe impl<
175            D: fidl::encoding::ResourceDialect,
176            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
177        > fidl::encoding::Encode<IntlWisdomServerAskForWisdomResponse, D> for (T0,)
178    {
179        #[inline]
180        unsafe fn encode(
181            self,
182            encoder: &mut fidl::encoding::Encoder<'_, D>,
183            offset: usize,
184            depth: fidl::encoding::Depth,
185        ) -> fidl::Result<()> {
186            encoder.debug_check_bounds::<IntlWisdomServerAskForWisdomResponse>(offset);
187            // Zero out padding regions. There's no need to apply masks
188            // because the unmasked parts will be overwritten by fields.
189            // Write the fields.
190            self.0.encode(encoder, offset + 0, depth)?;
191            Ok(())
192        }
193    }
194
195    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
196        for IntlWisdomServerAskForWisdomResponse
197    {
198        #[inline(always)]
199        fn new_empty() -> Self {
200            Self {
201                response: fidl::new_empty!(
202                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
203                    D
204                ),
205            }
206        }
207
208        #[inline]
209        unsafe fn decode(
210            &mut self,
211            decoder: &mut fidl::encoding::Decoder<'_, D>,
212            offset: usize,
213            _depth: fidl::encoding::Depth,
214        ) -> fidl::Result<()> {
215            decoder.debug_check_bounds::<Self>(offset);
216            // Verify that padding bytes are zero.
217            fidl::decode!(
218                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
219                D,
220                &mut self.response,
221                decoder,
222                offset + 0,
223                _depth
224            )?;
225            Ok(())
226        }
227    }
228}