1#![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
11pub type Point2 = [f32; 2];
14
15#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
17#[repr(u32)]
18pub enum ErrorReason {
19 Denied = 1,
21}
22
23impl ErrorReason {
24 #[inline]
25 pub fn from_primitive(prim: u32) -> Option<Self> {
26 match prim {
27 1 => Some(Self::Denied),
28 _ => None,
29 }
30 }
31
32 #[inline]
33 pub const fn into_primitive(self) -> u32 {
34 self as u32
35 }
36
37 #[deprecated = "Strict enums should not use `is_unknown`"]
38 #[inline]
39 pub fn is_unknown(&self) -> bool {
40 false
41 }
42}
43
44#[derive(Clone, Debug, PartialEq)]
52pub struct TouchEventWithLocalHit {
53 pub touch_event: fidl_fuchsia_ui_pointer::TouchEvent,
55 pub local_viewref_koid: u64,
58 pub local_point: [f32; 2],
61}
62
63impl fidl::Persistable for TouchEventWithLocalHit {}
64
65#[derive(Clone, Debug, PartialEq)]
66pub struct TouchSourceWithLocalHitUpdateResponseRequest {
67 pub interaction: fidl_fuchsia_ui_pointer::TouchInteractionId,
68 pub response: fidl_fuchsia_ui_pointer::TouchResponse,
69}
70
71impl fidl::Persistable for TouchSourceWithLocalHitUpdateResponseRequest {}
72
73#[derive(Clone, Debug, PartialEq)]
74pub struct TouchSourceWithLocalHitWatchRequest {
75 pub responses: Vec<fidl_fuchsia_ui_pointer::TouchResponse>,
76}
77
78impl fidl::Persistable for TouchSourceWithLocalHitWatchRequest {}
79
80#[derive(Clone, Debug, PartialEq)]
81pub struct TouchSourceWithLocalHitWatchResponse {
82 pub events: Vec<TouchEventWithLocalHit>,
83}
84
85impl fidl::Persistable for TouchSourceWithLocalHitWatchResponse {}
86
87mod internal {
88 use super::*;
89 unsafe impl fidl::encoding::TypeMarker for ErrorReason {
90 type Owned = Self;
91
92 #[inline(always)]
93 fn inline_align(_context: fidl::encoding::Context) -> usize {
94 std::mem::align_of::<u32>()
95 }
96
97 #[inline(always)]
98 fn inline_size(_context: fidl::encoding::Context) -> usize {
99 std::mem::size_of::<u32>()
100 }
101
102 #[inline(always)]
103 fn encode_is_copy() -> bool {
104 true
105 }
106
107 #[inline(always)]
108 fn decode_is_copy() -> bool {
109 false
110 }
111 }
112
113 impl fidl::encoding::ValueTypeMarker for ErrorReason {
114 type Borrowed<'a> = Self;
115 #[inline(always)]
116 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
117 *value
118 }
119 }
120
121 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorReason {
122 #[inline]
123 unsafe fn encode(
124 self,
125 encoder: &mut fidl::encoding::Encoder<'_, D>,
126 offset: usize,
127 _depth: fidl::encoding::Depth,
128 ) -> fidl::Result<()> {
129 encoder.debug_check_bounds::<Self>(offset);
130 encoder.write_num(self.into_primitive(), offset);
131 Ok(())
132 }
133 }
134
135 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorReason {
136 #[inline(always)]
137 fn new_empty() -> Self {
138 Self::Denied
139 }
140
141 #[inline]
142 unsafe fn decode(
143 &mut self,
144 decoder: &mut fidl::encoding::Decoder<'_, D>,
145 offset: usize,
146 _depth: fidl::encoding::Depth,
147 ) -> fidl::Result<()> {
148 decoder.debug_check_bounds::<Self>(offset);
149 let prim = decoder.read_num::<u32>(offset);
150
151 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
152 Ok(())
153 }
154 }
155
156 impl fidl::encoding::ValueTypeMarker for TouchEventWithLocalHit {
157 type Borrowed<'a> = &'a Self;
158 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
159 value
160 }
161 }
162
163 unsafe impl fidl::encoding::TypeMarker for TouchEventWithLocalHit {
164 type Owned = Self;
165
166 #[inline(always)]
167 fn inline_align(_context: fidl::encoding::Context) -> usize {
168 8
169 }
170
171 #[inline(always)]
172 fn inline_size(_context: fidl::encoding::Context) -> usize {
173 32
174 }
175 }
176
177 unsafe impl<D: fidl::encoding::ResourceDialect>
178 fidl::encoding::Encode<TouchEventWithLocalHit, D> for &TouchEventWithLocalHit
179 {
180 #[inline]
181 unsafe fn encode(
182 self,
183 encoder: &mut fidl::encoding::Encoder<'_, D>,
184 offset: usize,
185 _depth: fidl::encoding::Depth,
186 ) -> fidl::Result<()> {
187 encoder.debug_check_bounds::<TouchEventWithLocalHit>(offset);
188 fidl::encoding::Encode::<TouchEventWithLocalHit, D>::encode(
190 (
191 <fidl_fuchsia_ui_pointer::TouchEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.touch_event),
192 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.local_viewref_koid),
193 <fidl::encoding::Array<f32, 2> as fidl::encoding::ValueTypeMarker>::borrow(&self.local_point),
194 ),
195 encoder, offset, _depth
196 )
197 }
198 }
199 unsafe impl<
200 D: fidl::encoding::ResourceDialect,
201 T0: fidl::encoding::Encode<fidl_fuchsia_ui_pointer::TouchEvent, D>,
202 T1: fidl::encoding::Encode<u64, D>,
203 T2: fidl::encoding::Encode<fidl::encoding::Array<f32, 2>, D>,
204 > fidl::encoding::Encode<TouchEventWithLocalHit, D> for (T0, T1, T2)
205 {
206 #[inline]
207 unsafe fn encode(
208 self,
209 encoder: &mut fidl::encoding::Encoder<'_, D>,
210 offset: usize,
211 depth: fidl::encoding::Depth,
212 ) -> fidl::Result<()> {
213 encoder.debug_check_bounds::<TouchEventWithLocalHit>(offset);
214 self.0.encode(encoder, offset + 0, depth)?;
218 self.1.encode(encoder, offset + 16, depth)?;
219 self.2.encode(encoder, offset + 24, depth)?;
220 Ok(())
221 }
222 }
223
224 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
225 for TouchEventWithLocalHit
226 {
227 #[inline(always)]
228 fn new_empty() -> Self {
229 Self {
230 touch_event: fidl::new_empty!(fidl_fuchsia_ui_pointer::TouchEvent, D),
231 local_viewref_koid: fidl::new_empty!(u64, D),
232 local_point: fidl::new_empty!(fidl::encoding::Array<f32, 2>, D),
233 }
234 }
235
236 #[inline]
237 unsafe fn decode(
238 &mut self,
239 decoder: &mut fidl::encoding::Decoder<'_, D>,
240 offset: usize,
241 _depth: fidl::encoding::Depth,
242 ) -> fidl::Result<()> {
243 decoder.debug_check_bounds::<Self>(offset);
244 fidl::decode!(
246 fidl_fuchsia_ui_pointer::TouchEvent,
247 D,
248 &mut self.touch_event,
249 decoder,
250 offset + 0,
251 _depth
252 )?;
253 fidl::decode!(u64, D, &mut self.local_viewref_koid, decoder, offset + 16, _depth)?;
254 fidl::decode!(fidl::encoding::Array<f32, 2>, D, &mut self.local_point, decoder, offset + 24, _depth)?;
255 Ok(())
256 }
257 }
258
259 impl fidl::encoding::ValueTypeMarker for TouchSourceWithLocalHitUpdateResponseRequest {
260 type Borrowed<'a> = &'a Self;
261 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
262 value
263 }
264 }
265
266 unsafe impl fidl::encoding::TypeMarker for TouchSourceWithLocalHitUpdateResponseRequest {
267 type Owned = Self;
268
269 #[inline(always)]
270 fn inline_align(_context: fidl::encoding::Context) -> usize {
271 8
272 }
273
274 #[inline(always)]
275 fn inline_size(_context: fidl::encoding::Context) -> usize {
276 32
277 }
278 }
279
280 unsafe impl<D: fidl::encoding::ResourceDialect>
281 fidl::encoding::Encode<TouchSourceWithLocalHitUpdateResponseRequest, D>
282 for &TouchSourceWithLocalHitUpdateResponseRequest
283 {
284 #[inline]
285 unsafe fn encode(
286 self,
287 encoder: &mut fidl::encoding::Encoder<'_, D>,
288 offset: usize,
289 _depth: fidl::encoding::Depth,
290 ) -> fidl::Result<()> {
291 encoder.debug_check_bounds::<TouchSourceWithLocalHitUpdateResponseRequest>(offset);
292 fidl::encoding::Encode::<TouchSourceWithLocalHitUpdateResponseRequest, D>::encode(
294 (
295 <fidl_fuchsia_ui_pointer::TouchInteractionId as fidl::encoding::ValueTypeMarker>::borrow(&self.interaction),
296 <fidl_fuchsia_ui_pointer::TouchResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.response),
297 ),
298 encoder, offset, _depth
299 )
300 }
301 }
302 unsafe impl<
303 D: fidl::encoding::ResourceDialect,
304 T0: fidl::encoding::Encode<fidl_fuchsia_ui_pointer::TouchInteractionId, D>,
305 T1: fidl::encoding::Encode<fidl_fuchsia_ui_pointer::TouchResponse, D>,
306 > fidl::encoding::Encode<TouchSourceWithLocalHitUpdateResponseRequest, D> for (T0, T1)
307 {
308 #[inline]
309 unsafe fn encode(
310 self,
311 encoder: &mut fidl::encoding::Encoder<'_, D>,
312 offset: usize,
313 depth: fidl::encoding::Depth,
314 ) -> fidl::Result<()> {
315 encoder.debug_check_bounds::<TouchSourceWithLocalHitUpdateResponseRequest>(offset);
316 unsafe {
319 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
320 (ptr as *mut u64).write_unaligned(0);
321 }
322 self.0.encode(encoder, offset + 0, depth)?;
324 self.1.encode(encoder, offset + 16, depth)?;
325 Ok(())
326 }
327 }
328
329 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
330 for TouchSourceWithLocalHitUpdateResponseRequest
331 {
332 #[inline(always)]
333 fn new_empty() -> Self {
334 Self {
335 interaction: fidl::new_empty!(fidl_fuchsia_ui_pointer::TouchInteractionId, D),
336 response: fidl::new_empty!(fidl_fuchsia_ui_pointer::TouchResponse, D),
337 }
338 }
339
340 #[inline]
341 unsafe fn decode(
342 &mut self,
343 decoder: &mut fidl::encoding::Decoder<'_, D>,
344 offset: usize,
345 _depth: fidl::encoding::Depth,
346 ) -> fidl::Result<()> {
347 decoder.debug_check_bounds::<Self>(offset);
348 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
350 let padval = unsafe { (ptr as *const u64).read_unaligned() };
351 let mask = 0xffffffff00000000u64;
352 let maskedval = padval & mask;
353 if maskedval != 0 {
354 return Err(fidl::Error::NonZeroPadding {
355 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
356 });
357 }
358 fidl::decode!(
359 fidl_fuchsia_ui_pointer::TouchInteractionId,
360 D,
361 &mut self.interaction,
362 decoder,
363 offset + 0,
364 _depth
365 )?;
366 fidl::decode!(
367 fidl_fuchsia_ui_pointer::TouchResponse,
368 D,
369 &mut self.response,
370 decoder,
371 offset + 16,
372 _depth
373 )?;
374 Ok(())
375 }
376 }
377
378 impl fidl::encoding::ValueTypeMarker for TouchSourceWithLocalHitWatchRequest {
379 type Borrowed<'a> = &'a Self;
380 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
381 value
382 }
383 }
384
385 unsafe impl fidl::encoding::TypeMarker for TouchSourceWithLocalHitWatchRequest {
386 type Owned = Self;
387
388 #[inline(always)]
389 fn inline_align(_context: fidl::encoding::Context) -> usize {
390 8
391 }
392
393 #[inline(always)]
394 fn inline_size(_context: fidl::encoding::Context) -> usize {
395 16
396 }
397 }
398
399 unsafe impl<D: fidl::encoding::ResourceDialect>
400 fidl::encoding::Encode<TouchSourceWithLocalHitWatchRequest, D>
401 for &TouchSourceWithLocalHitWatchRequest
402 {
403 #[inline]
404 unsafe fn encode(
405 self,
406 encoder: &mut fidl::encoding::Encoder<'_, D>,
407 offset: usize,
408 _depth: fidl::encoding::Depth,
409 ) -> fidl::Result<()> {
410 encoder.debug_check_bounds::<TouchSourceWithLocalHitWatchRequest>(offset);
411 fidl::encoding::Encode::<TouchSourceWithLocalHitWatchRequest, D>::encode(
413 (
414 <fidl::encoding::Vector<fidl_fuchsia_ui_pointer::TouchResponse, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.responses),
415 ),
416 encoder, offset, _depth
417 )
418 }
419 }
420 unsafe impl<
421 D: fidl::encoding::ResourceDialect,
422 T0: fidl::encoding::Encode<
423 fidl::encoding::Vector<fidl_fuchsia_ui_pointer::TouchResponse, 128>,
424 D,
425 >,
426 > fidl::encoding::Encode<TouchSourceWithLocalHitWatchRequest, D> for (T0,)
427 {
428 #[inline]
429 unsafe fn encode(
430 self,
431 encoder: &mut fidl::encoding::Encoder<'_, D>,
432 offset: usize,
433 depth: fidl::encoding::Depth,
434 ) -> fidl::Result<()> {
435 encoder.debug_check_bounds::<TouchSourceWithLocalHitWatchRequest>(offset);
436 self.0.encode(encoder, offset + 0, depth)?;
440 Ok(())
441 }
442 }
443
444 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
445 for TouchSourceWithLocalHitWatchRequest
446 {
447 #[inline(always)]
448 fn new_empty() -> Self {
449 Self {
450 responses: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_ui_pointer::TouchResponse, 128>, D),
451 }
452 }
453
454 #[inline]
455 unsafe fn decode(
456 &mut self,
457 decoder: &mut fidl::encoding::Decoder<'_, D>,
458 offset: usize,
459 _depth: fidl::encoding::Depth,
460 ) -> fidl::Result<()> {
461 decoder.debug_check_bounds::<Self>(offset);
462 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_ui_pointer::TouchResponse, 128>, D, &mut self.responses, decoder, offset + 0, _depth)?;
464 Ok(())
465 }
466 }
467
468 impl fidl::encoding::ValueTypeMarker for TouchSourceWithLocalHitWatchResponse {
469 type Borrowed<'a> = &'a Self;
470 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
471 value
472 }
473 }
474
475 unsafe impl fidl::encoding::TypeMarker for TouchSourceWithLocalHitWatchResponse {
476 type Owned = Self;
477
478 #[inline(always)]
479 fn inline_align(_context: fidl::encoding::Context) -> usize {
480 8
481 }
482
483 #[inline(always)]
484 fn inline_size(_context: fidl::encoding::Context) -> usize {
485 16
486 }
487 }
488
489 unsafe impl<D: fidl::encoding::ResourceDialect>
490 fidl::encoding::Encode<TouchSourceWithLocalHitWatchResponse, D>
491 for &TouchSourceWithLocalHitWatchResponse
492 {
493 #[inline]
494 unsafe fn encode(
495 self,
496 encoder: &mut fidl::encoding::Encoder<'_, D>,
497 offset: usize,
498 _depth: fidl::encoding::Depth,
499 ) -> fidl::Result<()> {
500 encoder.debug_check_bounds::<TouchSourceWithLocalHitWatchResponse>(offset);
501 fidl::encoding::Encode::<TouchSourceWithLocalHitWatchResponse, D>::encode(
503 (
504 <fidl::encoding::Vector<TouchEventWithLocalHit, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
505 ),
506 encoder, offset, _depth
507 )
508 }
509 }
510 unsafe impl<
511 D: fidl::encoding::ResourceDialect,
512 T0: fidl::encoding::Encode<fidl::encoding::Vector<TouchEventWithLocalHit, 128>, D>,
513 > fidl::encoding::Encode<TouchSourceWithLocalHitWatchResponse, D> for (T0,)
514 {
515 #[inline]
516 unsafe fn encode(
517 self,
518 encoder: &mut fidl::encoding::Encoder<'_, D>,
519 offset: usize,
520 depth: fidl::encoding::Depth,
521 ) -> fidl::Result<()> {
522 encoder.debug_check_bounds::<TouchSourceWithLocalHitWatchResponse>(offset);
523 self.0.encode(encoder, offset + 0, depth)?;
527 Ok(())
528 }
529 }
530
531 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
532 for TouchSourceWithLocalHitWatchResponse
533 {
534 #[inline(always)]
535 fn new_empty() -> Self {
536 Self {
537 events: fidl::new_empty!(fidl::encoding::Vector<TouchEventWithLocalHit, 128>, D),
538 }
539 }
540
541 #[inline]
542 unsafe fn decode(
543 &mut self,
544 decoder: &mut fidl::encoding::Decoder<'_, D>,
545 offset: usize,
546 _depth: fidl::encoding::Depth,
547 ) -> fidl::Result<()> {
548 decoder.debug_check_bounds::<Self>(offset);
549 fidl::decode!(fidl::encoding::Vector<TouchEventWithLocalHit, 128>, D, &mut self.events, decoder, offset + 0, _depth)?;
551 Ok(())
552 }
553 }
554}