fidl_fuchsia_location_namedplace__common/
fidl_fuchsia_location_namedplace__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/// Represents a regulatory region. These values should generally be chosen
12/// from [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) codes. However,
13/// some radios may support extensions beyond the set of ISO 3166-2 codes.
14pub type RegionCode = String;
15
16#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct RegulatoryRegionConfiguratorSetRegionRequest {
18    pub region: String,
19}
20
21impl fidl::Persistable for RegulatoryRegionConfiguratorSetRegionRequest {}
22
23#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct RegulatoryRegionWatcherGetRegionUpdateResponse {
25    pub new_region: Option<String>,
26}
27
28impl fidl::Persistable for RegulatoryRegionWatcherGetRegionUpdateResponse {}
29
30#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct RegulatoryRegionWatcherGetUpdateResponse {
32    pub new_region: String,
33}
34
35impl fidl::Persistable for RegulatoryRegionWatcherGetUpdateResponse {}
36
37pub mod regulatory_region_configurator_ordinals {
38    pub const SET_REGION: u64 = 0x677e15debe2d6910;
39}
40
41pub mod regulatory_region_watcher_ordinals {
42    pub const GET_UPDATE: u64 = 0xaf6dec156c31687;
43    pub const GET_REGION_UPDATE: u64 = 0x28c47004aed3ff0d;
44}
45
46mod internal {
47    use super::*;
48
49    impl fidl::encoding::ValueTypeMarker for RegulatoryRegionConfiguratorSetRegionRequest {
50        type Borrowed<'a> = &'a Self;
51        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
52            value
53        }
54    }
55
56    unsafe impl fidl::encoding::TypeMarker for RegulatoryRegionConfiguratorSetRegionRequest {
57        type Owned = Self;
58
59        #[inline(always)]
60        fn inline_align(_context: fidl::encoding::Context) -> usize {
61            8
62        }
63
64        #[inline(always)]
65        fn inline_size(_context: fidl::encoding::Context) -> usize {
66            16
67        }
68    }
69
70    unsafe impl<D: fidl::encoding::ResourceDialect>
71        fidl::encoding::Encode<RegulatoryRegionConfiguratorSetRegionRequest, D>
72        for &RegulatoryRegionConfiguratorSetRegionRequest
73    {
74        #[inline]
75        unsafe fn encode(
76            self,
77            encoder: &mut fidl::encoding::Encoder<'_, D>,
78            offset: usize,
79            _depth: fidl::encoding::Depth,
80        ) -> fidl::Result<()> {
81            encoder.debug_check_bounds::<RegulatoryRegionConfiguratorSetRegionRequest>(offset);
82            // Delegate to tuple encoding.
83            fidl::encoding::Encode::<RegulatoryRegionConfiguratorSetRegionRequest, D>::encode(
84                (<fidl::encoding::BoundedString<2> as fidl::encoding::ValueTypeMarker>::borrow(
85                    &self.region,
86                ),),
87                encoder,
88                offset,
89                _depth,
90            )
91        }
92    }
93    unsafe impl<
94            D: fidl::encoding::ResourceDialect,
95            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<2>, D>,
96        > fidl::encoding::Encode<RegulatoryRegionConfiguratorSetRegionRequest, D> for (T0,)
97    {
98        #[inline]
99        unsafe fn encode(
100            self,
101            encoder: &mut fidl::encoding::Encoder<'_, D>,
102            offset: usize,
103            depth: fidl::encoding::Depth,
104        ) -> fidl::Result<()> {
105            encoder.debug_check_bounds::<RegulatoryRegionConfiguratorSetRegionRequest>(offset);
106            // Zero out padding regions. There's no need to apply masks
107            // because the unmasked parts will be overwritten by fields.
108            // Write the fields.
109            self.0.encode(encoder, offset + 0, depth)?;
110            Ok(())
111        }
112    }
113
114    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
115        for RegulatoryRegionConfiguratorSetRegionRequest
116    {
117        #[inline(always)]
118        fn new_empty() -> Self {
119            Self { region: fidl::new_empty!(fidl::encoding::BoundedString<2>, D) }
120        }
121
122        #[inline]
123        unsafe fn decode(
124            &mut self,
125            decoder: &mut fidl::encoding::Decoder<'_, D>,
126            offset: usize,
127            _depth: fidl::encoding::Depth,
128        ) -> fidl::Result<()> {
129            decoder.debug_check_bounds::<Self>(offset);
130            // Verify that padding bytes are zero.
131            fidl::decode!(
132                fidl::encoding::BoundedString<2>,
133                D,
134                &mut self.region,
135                decoder,
136                offset + 0,
137                _depth
138            )?;
139            Ok(())
140        }
141    }
142
143    impl fidl::encoding::ValueTypeMarker for RegulatoryRegionWatcherGetRegionUpdateResponse {
144        type Borrowed<'a> = &'a Self;
145        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
146            value
147        }
148    }
149
150    unsafe impl fidl::encoding::TypeMarker for RegulatoryRegionWatcherGetRegionUpdateResponse {
151        type Owned = Self;
152
153        #[inline(always)]
154        fn inline_align(_context: fidl::encoding::Context) -> usize {
155            8
156        }
157
158        #[inline(always)]
159        fn inline_size(_context: fidl::encoding::Context) -> usize {
160            16
161        }
162    }
163
164    unsafe impl<D: fidl::encoding::ResourceDialect>
165        fidl::encoding::Encode<RegulatoryRegionWatcherGetRegionUpdateResponse, D>
166        for &RegulatoryRegionWatcherGetRegionUpdateResponse
167    {
168        #[inline]
169        unsafe fn encode(
170            self,
171            encoder: &mut fidl::encoding::Encoder<'_, D>,
172            offset: usize,
173            _depth: fidl::encoding::Depth,
174        ) -> fidl::Result<()> {
175            encoder.debug_check_bounds::<RegulatoryRegionWatcherGetRegionUpdateResponse>(offset);
176            // Delegate to tuple encoding.
177            fidl::encoding::Encode::<RegulatoryRegionWatcherGetRegionUpdateResponse, D>::encode(
178                (
179                    <fidl::encoding::Optional<fidl::encoding::BoundedString<2>> as fidl::encoding::ValueTypeMarker>::borrow(&self.new_region),
180                ),
181                encoder, offset, _depth
182            )
183        }
184    }
185    unsafe impl<
186            D: fidl::encoding::ResourceDialect,
187            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<2>>, D>,
188        > fidl::encoding::Encode<RegulatoryRegionWatcherGetRegionUpdateResponse, D> for (T0,)
189    {
190        #[inline]
191        unsafe fn encode(
192            self,
193            encoder: &mut fidl::encoding::Encoder<'_, D>,
194            offset: usize,
195            depth: fidl::encoding::Depth,
196        ) -> fidl::Result<()> {
197            encoder.debug_check_bounds::<RegulatoryRegionWatcherGetRegionUpdateResponse>(offset);
198            // Zero out padding regions. There's no need to apply masks
199            // because the unmasked parts will be overwritten by fields.
200            // Write the fields.
201            self.0.encode(encoder, offset + 0, depth)?;
202            Ok(())
203        }
204    }
205
206    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
207        for RegulatoryRegionWatcherGetRegionUpdateResponse
208    {
209        #[inline(always)]
210        fn new_empty() -> Self {
211            Self {
212                new_region: fidl::new_empty!(
213                    fidl::encoding::Optional<fidl::encoding::BoundedString<2>>,
214                    D
215                ),
216            }
217        }
218
219        #[inline]
220        unsafe fn decode(
221            &mut self,
222            decoder: &mut fidl::encoding::Decoder<'_, D>,
223            offset: usize,
224            _depth: fidl::encoding::Depth,
225        ) -> fidl::Result<()> {
226            decoder.debug_check_bounds::<Self>(offset);
227            // Verify that padding bytes are zero.
228            fidl::decode!(
229                fidl::encoding::Optional<fidl::encoding::BoundedString<2>>,
230                D,
231                &mut self.new_region,
232                decoder,
233                offset + 0,
234                _depth
235            )?;
236            Ok(())
237        }
238    }
239
240    impl fidl::encoding::ValueTypeMarker for RegulatoryRegionWatcherGetUpdateResponse {
241        type Borrowed<'a> = &'a Self;
242        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
243            value
244        }
245    }
246
247    unsafe impl fidl::encoding::TypeMarker for RegulatoryRegionWatcherGetUpdateResponse {
248        type Owned = Self;
249
250        #[inline(always)]
251        fn inline_align(_context: fidl::encoding::Context) -> usize {
252            8
253        }
254
255        #[inline(always)]
256        fn inline_size(_context: fidl::encoding::Context) -> usize {
257            16
258        }
259    }
260
261    unsafe impl<D: fidl::encoding::ResourceDialect>
262        fidl::encoding::Encode<RegulatoryRegionWatcherGetUpdateResponse, D>
263        for &RegulatoryRegionWatcherGetUpdateResponse
264    {
265        #[inline]
266        unsafe fn encode(
267            self,
268            encoder: &mut fidl::encoding::Encoder<'_, D>,
269            offset: usize,
270            _depth: fidl::encoding::Depth,
271        ) -> fidl::Result<()> {
272            encoder.debug_check_bounds::<RegulatoryRegionWatcherGetUpdateResponse>(offset);
273            // Delegate to tuple encoding.
274            fidl::encoding::Encode::<RegulatoryRegionWatcherGetUpdateResponse, D>::encode(
275                (<fidl::encoding::BoundedString<2> as fidl::encoding::ValueTypeMarker>::borrow(
276                    &self.new_region,
277                ),),
278                encoder,
279                offset,
280                _depth,
281            )
282        }
283    }
284    unsafe impl<
285            D: fidl::encoding::ResourceDialect,
286            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<2>, D>,
287        > fidl::encoding::Encode<RegulatoryRegionWatcherGetUpdateResponse, D> for (T0,)
288    {
289        #[inline]
290        unsafe fn encode(
291            self,
292            encoder: &mut fidl::encoding::Encoder<'_, D>,
293            offset: usize,
294            depth: fidl::encoding::Depth,
295        ) -> fidl::Result<()> {
296            encoder.debug_check_bounds::<RegulatoryRegionWatcherGetUpdateResponse>(offset);
297            // Zero out padding regions. There's no need to apply masks
298            // because the unmasked parts will be overwritten by fields.
299            // Write the fields.
300            self.0.encode(encoder, offset + 0, depth)?;
301            Ok(())
302        }
303    }
304
305    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
306        for RegulatoryRegionWatcherGetUpdateResponse
307    {
308        #[inline(always)]
309        fn new_empty() -> Self {
310            Self { new_region: fidl::new_empty!(fidl::encoding::BoundedString<2>, D) }
311        }
312
313        #[inline]
314        unsafe fn decode(
315            &mut self,
316            decoder: &mut fidl::encoding::Decoder<'_, D>,
317            offset: usize,
318            _depth: fidl::encoding::Depth,
319        ) -> fidl::Result<()> {
320            decoder.debug_check_bounds::<Self>(offset);
321            // Verify that padding bytes are zero.
322            fidl::decode!(
323                fidl::encoding::BoundedString<2>,
324                D,
325                &mut self.new_region,
326                decoder,
327                offset + 0,
328                _depth
329            )?;
330            Ok(())
331        }
332    }
333}