1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_ui_pointer_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct MouseSourceV2OnMouseEventsRequest {
16 pub events: Vec<MouseEvent>,
17 pub last_event_stamp: u64,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
23 for MouseSourceV2OnMouseEventsRequest
24{
25}
26
27#[derive(Debug, PartialEq)]
28pub struct MouseSourceWatchResponse {
29 pub events: Vec<MouseEvent>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MouseSourceWatchResponse {}
33
34#[derive(Debug, PartialEq)]
35pub struct TouchSourceV2OnTouchEventsRequest {
36 pub events: Vec<TouchEvent>,
37 pub last_event_stamp: u64,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for TouchSourceV2OnTouchEventsRequest
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct TouchSourceWatchResponse {
49 pub events: Vec<TouchEvent>,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TouchSourceWatchResponse {}
53
54#[derive(Debug, Default, PartialEq)]
55pub struct MouseEvent {
56 pub timestamp: Option<i64>,
59 pub view_parameters: Option<ViewParameters>,
64 pub device_info: Option<MouseDeviceInfo>,
68 pub pointer_sample: Option<MousePointerSample>,
77 pub stream_info: Option<MouseEventStreamInfo>,
80 pub trace_flow_id: Option<u64>,
83 pub wake_lease: Option<fidl::EventPair>,
85 #[doc(hidden)]
86 pub __source_breaking: fidl::marker::SourceBreaking,
87}
88
89impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MouseEvent {}
90
91#[derive(Debug, Default, PartialEq)]
92pub struct TouchEvent {
93 pub timestamp: Option<i64>,
96 pub view_parameters: Option<ViewParameters>,
101 pub device_info: Option<TouchDeviceInfo>,
105 pub pointer_sample: Option<TouchPointerSample>,
109 pub interaction_result: Option<TouchInteractionResult>,
112 pub trace_flow_id: Option<u64>,
115 pub wake_lease: Option<fidl::EventPair>,
117 #[doc(hidden)]
118 pub __source_breaking: fidl::marker::SourceBreaking,
119}
120
121impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TouchEvent {}
122
123#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
124pub struct MouseSourceMarker;
125
126impl fidl::endpoints::ProtocolMarker for MouseSourceMarker {
127 type Proxy = MouseSourceProxy;
128 type RequestStream = MouseSourceRequestStream;
129 #[cfg(target_os = "fuchsia")]
130 type SynchronousProxy = MouseSourceSynchronousProxy;
131
132 const DEBUG_NAME: &'static str = "(anonymous) MouseSource";
133}
134
135pub trait MouseSourceProxyInterface: Send + Sync {
136 type WatchResponseFut: std::future::Future<Output = Result<Vec<MouseEvent>, fidl::Error>> + Send;
137 fn r#watch(&self) -> Self::WatchResponseFut;
138}
139#[derive(Debug)]
140#[cfg(target_os = "fuchsia")]
141pub struct MouseSourceSynchronousProxy {
142 client: fidl::client::sync::Client,
143}
144
145#[cfg(target_os = "fuchsia")]
146impl fidl::endpoints::SynchronousProxy for MouseSourceSynchronousProxy {
147 type Proxy = MouseSourceProxy;
148 type Protocol = MouseSourceMarker;
149
150 fn from_channel(inner: fidl::Channel) -> Self {
151 Self::new(inner)
152 }
153
154 fn into_channel(self) -> fidl::Channel {
155 self.client.into_channel()
156 }
157
158 fn as_channel(&self) -> &fidl::Channel {
159 self.client.as_channel()
160 }
161}
162
163#[cfg(target_os = "fuchsia")]
164impl MouseSourceSynchronousProxy {
165 pub fn new(channel: fidl::Channel) -> Self {
166 Self { client: fidl::client::sync::Client::new(channel) }
167 }
168
169 pub fn into_channel(self) -> fidl::Channel {
170 self.client.into_channel()
171 }
172
173 pub fn wait_for_event(
176 &self,
177 deadline: zx::MonotonicInstant,
178 ) -> Result<MouseSourceEvent, fidl::Error> {
179 MouseSourceEvent::decode(self.client.wait_for_event::<MouseSourceMarker>(deadline)?)
180 }
181
182 pub fn r#watch(
207 &self,
208 ___deadline: zx::MonotonicInstant,
209 ) -> Result<Vec<MouseEvent>, fidl::Error> {
210 let _response = self.client.send_query::<
211 fidl::encoding::EmptyPayload,
212 MouseSourceWatchResponse,
213 MouseSourceMarker,
214 >(
215 (),
216 0x5b1f6e917ac1abb4,
217 fidl::encoding::DynamicFlags::empty(),
218 ___deadline,
219 )?;
220 Ok(_response.events)
221 }
222}
223
224#[cfg(target_os = "fuchsia")]
225impl From<MouseSourceSynchronousProxy> for zx::NullableHandle {
226 fn from(value: MouseSourceSynchronousProxy) -> Self {
227 value.into_channel().into()
228 }
229}
230
231#[cfg(target_os = "fuchsia")]
232impl From<fidl::Channel> for MouseSourceSynchronousProxy {
233 fn from(value: fidl::Channel) -> Self {
234 Self::new(value)
235 }
236}
237
238#[cfg(target_os = "fuchsia")]
239impl fidl::endpoints::FromClient for MouseSourceSynchronousProxy {
240 type Protocol = MouseSourceMarker;
241
242 fn from_client(value: fidl::endpoints::ClientEnd<MouseSourceMarker>) -> Self {
243 Self::new(value.into_channel())
244 }
245}
246
247#[derive(Debug, Clone)]
248pub struct MouseSourceProxy {
249 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
250}
251
252impl fidl::endpoints::Proxy for MouseSourceProxy {
253 type Protocol = MouseSourceMarker;
254
255 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
256 Self::new(inner)
257 }
258
259 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
260 self.client.into_channel().map_err(|client| Self { client })
261 }
262
263 fn as_channel(&self) -> &::fidl::AsyncChannel {
264 self.client.as_channel()
265 }
266}
267
268impl MouseSourceProxy {
269 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
271 let protocol_name = <MouseSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
272 Self { client: fidl::client::Client::new(channel, protocol_name) }
273 }
274
275 pub fn take_event_stream(&self) -> MouseSourceEventStream {
281 MouseSourceEventStream { event_receiver: self.client.take_event_receiver() }
282 }
283
284 pub fn r#watch(
309 &self,
310 ) -> fidl::client::QueryResponseFut<
311 Vec<MouseEvent>,
312 fidl::encoding::DefaultFuchsiaResourceDialect,
313 > {
314 MouseSourceProxyInterface::r#watch(self)
315 }
316}
317
318impl MouseSourceProxyInterface for MouseSourceProxy {
319 type WatchResponseFut = fidl::client::QueryResponseFut<
320 Vec<MouseEvent>,
321 fidl::encoding::DefaultFuchsiaResourceDialect,
322 >;
323 fn r#watch(&self) -> Self::WatchResponseFut {
324 fn _decode(
325 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
326 ) -> Result<Vec<MouseEvent>, fidl::Error> {
327 let _response = fidl::client::decode_transaction_body::<
328 MouseSourceWatchResponse,
329 fidl::encoding::DefaultFuchsiaResourceDialect,
330 0x5b1f6e917ac1abb4,
331 >(_buf?)?;
332 Ok(_response.events)
333 }
334 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<MouseEvent>>(
335 (),
336 0x5b1f6e917ac1abb4,
337 fidl::encoding::DynamicFlags::empty(),
338 _decode,
339 )
340 }
341}
342
343pub struct MouseSourceEventStream {
344 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
345}
346
347impl std::marker::Unpin for MouseSourceEventStream {}
348
349impl futures::stream::FusedStream for MouseSourceEventStream {
350 fn is_terminated(&self) -> bool {
351 self.event_receiver.is_terminated()
352 }
353}
354
355impl futures::Stream for MouseSourceEventStream {
356 type Item = Result<MouseSourceEvent, fidl::Error>;
357
358 fn poll_next(
359 mut self: std::pin::Pin<&mut Self>,
360 cx: &mut std::task::Context<'_>,
361 ) -> std::task::Poll<Option<Self::Item>> {
362 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
363 &mut self.event_receiver,
364 cx
365 )?) {
366 Some(buf) => std::task::Poll::Ready(Some(MouseSourceEvent::decode(buf))),
367 None => std::task::Poll::Ready(None),
368 }
369 }
370}
371
372#[derive(Debug)]
373pub enum MouseSourceEvent {}
374
375impl MouseSourceEvent {
376 fn decode(
378 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
379 ) -> Result<MouseSourceEvent, fidl::Error> {
380 let (bytes, _handles) = buf.split_mut();
381 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
382 debug_assert_eq!(tx_header.tx_id, 0);
383 match tx_header.ordinal {
384 _ => Err(fidl::Error::UnknownOrdinal {
385 ordinal: tx_header.ordinal,
386 protocol_name: <MouseSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
387 }),
388 }
389 }
390}
391
392pub struct MouseSourceRequestStream {
394 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
395 is_terminated: bool,
396}
397
398impl std::marker::Unpin for MouseSourceRequestStream {}
399
400impl futures::stream::FusedStream for MouseSourceRequestStream {
401 fn is_terminated(&self) -> bool {
402 self.is_terminated
403 }
404}
405
406impl fidl::endpoints::RequestStream for MouseSourceRequestStream {
407 type Protocol = MouseSourceMarker;
408 type ControlHandle = MouseSourceControlHandle;
409
410 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
411 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
412 }
413
414 fn control_handle(&self) -> Self::ControlHandle {
415 MouseSourceControlHandle { inner: self.inner.clone() }
416 }
417
418 fn into_inner(
419 self,
420 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
421 {
422 (self.inner, self.is_terminated)
423 }
424
425 fn from_inner(
426 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
427 is_terminated: bool,
428 ) -> Self {
429 Self { inner, is_terminated }
430 }
431}
432
433impl futures::Stream for MouseSourceRequestStream {
434 type Item = Result<MouseSourceRequest, fidl::Error>;
435
436 fn poll_next(
437 mut self: std::pin::Pin<&mut Self>,
438 cx: &mut std::task::Context<'_>,
439 ) -> std::task::Poll<Option<Self::Item>> {
440 let this = &mut *self;
441 if this.inner.check_shutdown(cx) {
442 this.is_terminated = true;
443 return std::task::Poll::Ready(None);
444 }
445 if this.is_terminated {
446 panic!("polled MouseSourceRequestStream after completion");
447 }
448 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
449 |bytes, handles| {
450 match this.inner.channel().read_etc(cx, bytes, handles) {
451 std::task::Poll::Ready(Ok(())) => {}
452 std::task::Poll::Pending => return std::task::Poll::Pending,
453 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
454 this.is_terminated = true;
455 return std::task::Poll::Ready(None);
456 }
457 std::task::Poll::Ready(Err(e)) => {
458 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
459 e.into(),
460 ))));
461 }
462 }
463
464 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
466
467 std::task::Poll::Ready(Some(match header.ordinal {
468 0x5b1f6e917ac1abb4 => {
469 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
470 let mut req = fidl::new_empty!(
471 fidl::encoding::EmptyPayload,
472 fidl::encoding::DefaultFuchsiaResourceDialect
473 );
474 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
475 let control_handle = MouseSourceControlHandle { inner: this.inner.clone() };
476 Ok(MouseSourceRequest::Watch {
477 responder: MouseSourceWatchResponder {
478 control_handle: std::mem::ManuallyDrop::new(control_handle),
479 tx_id: header.tx_id,
480 },
481 })
482 }
483 _ => Err(fidl::Error::UnknownOrdinal {
484 ordinal: header.ordinal,
485 protocol_name:
486 <MouseSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
487 }),
488 }))
489 },
490 )
491 }
492}
493
494#[derive(Debug)]
509pub enum MouseSourceRequest {
510 Watch { responder: MouseSourceWatchResponder },
535}
536
537impl MouseSourceRequest {
538 #[allow(irrefutable_let_patterns)]
539 pub fn into_watch(self) -> Option<(MouseSourceWatchResponder)> {
540 if let MouseSourceRequest::Watch { responder } = self { Some((responder)) } else { None }
541 }
542
543 pub fn method_name(&self) -> &'static str {
545 match *self {
546 MouseSourceRequest::Watch { .. } => "watch",
547 }
548 }
549}
550
551#[derive(Debug, Clone)]
552pub struct MouseSourceControlHandle {
553 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
554}
555
556impl MouseSourceControlHandle {
557 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
558 self.inner.shutdown_with_epitaph(status.into())
559 }
560}
561
562impl fidl::endpoints::ControlHandle for MouseSourceControlHandle {
563 fn shutdown(&self) {
564 self.inner.shutdown()
565 }
566
567 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
568 self.inner.shutdown_with_epitaph(status)
569 }
570
571 fn is_closed(&self) -> bool {
572 self.inner.channel().is_closed()
573 }
574 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
575 self.inner.channel().on_closed()
576 }
577
578 #[cfg(target_os = "fuchsia")]
579 fn signal_peer(
580 &self,
581 clear_mask: zx::Signals,
582 set_mask: zx::Signals,
583 ) -> Result<(), zx_status::Status> {
584 use fidl::Peered;
585 self.inner.channel().signal_peer(clear_mask, set_mask)
586 }
587}
588
589impl MouseSourceControlHandle {}
590
591#[must_use = "FIDL methods require a response to be sent"]
592#[derive(Debug)]
593pub struct MouseSourceWatchResponder {
594 control_handle: std::mem::ManuallyDrop<MouseSourceControlHandle>,
595 tx_id: u32,
596}
597
598impl std::ops::Drop for MouseSourceWatchResponder {
602 fn drop(&mut self) {
603 self.control_handle.shutdown();
604 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
606 }
607}
608
609impl fidl::endpoints::Responder for MouseSourceWatchResponder {
610 type ControlHandle = MouseSourceControlHandle;
611
612 fn control_handle(&self) -> &MouseSourceControlHandle {
613 &self.control_handle
614 }
615
616 fn drop_without_shutdown(mut self) {
617 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
619 std::mem::forget(self);
621 }
622}
623
624impl MouseSourceWatchResponder {
625 pub fn send(self, mut events: Vec<MouseEvent>) -> Result<(), fidl::Error> {
629 let _result = self.send_raw(events);
630 if _result.is_err() {
631 self.control_handle.shutdown();
632 }
633 self.drop_without_shutdown();
634 _result
635 }
636
637 pub fn send_no_shutdown_on_err(self, mut events: Vec<MouseEvent>) -> Result<(), fidl::Error> {
639 let _result = self.send_raw(events);
640 self.drop_without_shutdown();
641 _result
642 }
643
644 fn send_raw(&self, mut events: Vec<MouseEvent>) -> Result<(), fidl::Error> {
645 self.control_handle.inner.send::<MouseSourceWatchResponse>(
646 (events.as_mut(),),
647 self.tx_id,
648 0x5b1f6e917ac1abb4,
649 fidl::encoding::DynamicFlags::empty(),
650 )
651 }
652}
653
654#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
655pub struct MouseSourceV2Marker;
656
657impl fidl::endpoints::ProtocolMarker for MouseSourceV2Marker {
658 type Proxy = MouseSourceV2Proxy;
659 type RequestStream = MouseSourceV2RequestStream;
660 #[cfg(target_os = "fuchsia")]
661 type SynchronousProxy = MouseSourceV2SynchronousProxy;
662
663 const DEBUG_NAME: &'static str = "(anonymous) MouseSourceV2";
664}
665
666pub trait MouseSourceV2ProxyInterface: Send + Sync {
667 fn r#acknowledge_events(&self, last_acknowledged_event_stamp: u64) -> Result<(), fidl::Error>;
668}
669#[derive(Debug)]
670#[cfg(target_os = "fuchsia")]
671pub struct MouseSourceV2SynchronousProxy {
672 client: fidl::client::sync::Client,
673}
674
675#[cfg(target_os = "fuchsia")]
676impl fidl::endpoints::SynchronousProxy for MouseSourceV2SynchronousProxy {
677 type Proxy = MouseSourceV2Proxy;
678 type Protocol = MouseSourceV2Marker;
679
680 fn from_channel(inner: fidl::Channel) -> Self {
681 Self::new(inner)
682 }
683
684 fn into_channel(self) -> fidl::Channel {
685 self.client.into_channel()
686 }
687
688 fn as_channel(&self) -> &fidl::Channel {
689 self.client.as_channel()
690 }
691}
692
693#[cfg(target_os = "fuchsia")]
694impl MouseSourceV2SynchronousProxy {
695 pub fn new(channel: fidl::Channel) -> Self {
696 Self { client: fidl::client::sync::Client::new(channel) }
697 }
698
699 pub fn into_channel(self) -> fidl::Channel {
700 self.client.into_channel()
701 }
702
703 pub fn wait_for_event(
706 &self,
707 deadline: zx::MonotonicInstant,
708 ) -> Result<MouseSourceV2Event, fidl::Error> {
709 MouseSourceV2Event::decode(self.client.wait_for_event::<MouseSourceV2Marker>(deadline)?)
710 }
711
712 pub fn r#acknowledge_events(
727 &self,
728 mut last_acknowledged_event_stamp: u64,
729 ) -> Result<(), fidl::Error> {
730 self.client.send::<MouseSourceV2AcknowledgeEventsRequest>(
731 (last_acknowledged_event_stamp,),
732 0x1be628961fdf2cf1,
733 fidl::encoding::DynamicFlags::empty(),
734 )
735 }
736}
737
738#[cfg(target_os = "fuchsia")]
739impl From<MouseSourceV2SynchronousProxy> for zx::NullableHandle {
740 fn from(value: MouseSourceV2SynchronousProxy) -> Self {
741 value.into_channel().into()
742 }
743}
744
745#[cfg(target_os = "fuchsia")]
746impl From<fidl::Channel> for MouseSourceV2SynchronousProxy {
747 fn from(value: fidl::Channel) -> Self {
748 Self::new(value)
749 }
750}
751
752#[cfg(target_os = "fuchsia")]
753impl fidl::endpoints::FromClient for MouseSourceV2SynchronousProxy {
754 type Protocol = MouseSourceV2Marker;
755
756 fn from_client(value: fidl::endpoints::ClientEnd<MouseSourceV2Marker>) -> Self {
757 Self::new(value.into_channel())
758 }
759}
760
761#[derive(Debug, Clone)]
762pub struct MouseSourceV2Proxy {
763 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
764}
765
766impl fidl::endpoints::Proxy for MouseSourceV2Proxy {
767 type Protocol = MouseSourceV2Marker;
768
769 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
770 Self::new(inner)
771 }
772
773 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
774 self.client.into_channel().map_err(|client| Self { client })
775 }
776
777 fn as_channel(&self) -> &::fidl::AsyncChannel {
778 self.client.as_channel()
779 }
780}
781
782impl MouseSourceV2Proxy {
783 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
785 let protocol_name = <MouseSourceV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
786 Self { client: fidl::client::Client::new(channel, protocol_name) }
787 }
788
789 pub fn take_event_stream(&self) -> MouseSourceV2EventStream {
795 MouseSourceV2EventStream { event_receiver: self.client.take_event_receiver() }
796 }
797
798 pub fn r#acknowledge_events(
813 &self,
814 mut last_acknowledged_event_stamp: u64,
815 ) -> Result<(), fidl::Error> {
816 MouseSourceV2ProxyInterface::r#acknowledge_events(self, last_acknowledged_event_stamp)
817 }
818}
819
820impl MouseSourceV2ProxyInterface for MouseSourceV2Proxy {
821 fn r#acknowledge_events(
822 &self,
823 mut last_acknowledged_event_stamp: u64,
824 ) -> Result<(), fidl::Error> {
825 self.client.send::<MouseSourceV2AcknowledgeEventsRequest>(
826 (last_acknowledged_event_stamp,),
827 0x1be628961fdf2cf1,
828 fidl::encoding::DynamicFlags::empty(),
829 )
830 }
831}
832
833pub struct MouseSourceV2EventStream {
834 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
835}
836
837impl std::marker::Unpin for MouseSourceV2EventStream {}
838
839impl futures::stream::FusedStream for MouseSourceV2EventStream {
840 fn is_terminated(&self) -> bool {
841 self.event_receiver.is_terminated()
842 }
843}
844
845impl futures::Stream for MouseSourceV2EventStream {
846 type Item = Result<MouseSourceV2Event, fidl::Error>;
847
848 fn poll_next(
849 mut self: std::pin::Pin<&mut Self>,
850 cx: &mut std::task::Context<'_>,
851 ) -> std::task::Poll<Option<Self::Item>> {
852 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
853 &mut self.event_receiver,
854 cx
855 )?) {
856 Some(buf) => std::task::Poll::Ready(Some(MouseSourceV2Event::decode(buf))),
857 None => std::task::Poll::Ready(None),
858 }
859 }
860}
861
862#[derive(Debug)]
863pub enum MouseSourceV2Event {
864 OnMouseEvents {
865 events: Vec<MouseEvent>,
866 last_event_stamp: u64,
867 },
868 #[non_exhaustive]
869 _UnknownEvent {
870 ordinal: u64,
872 },
873}
874
875impl MouseSourceV2Event {
876 #[allow(irrefutable_let_patterns)]
877 pub fn into_on_mouse_events(self) -> Option<(Vec<MouseEvent>, u64)> {
878 if let MouseSourceV2Event::OnMouseEvents { events, last_event_stamp } = self {
879 Some((events, last_event_stamp))
880 } else {
881 None
882 }
883 }
884
885 fn decode(
887 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
888 ) -> Result<MouseSourceV2Event, fidl::Error> {
889 let (bytes, _handles) = buf.split_mut();
890 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
891 debug_assert_eq!(tx_header.tx_id, 0);
892 match tx_header.ordinal {
893 0x61f8d843a513238d => {
894 let mut out = fidl::new_empty!(
895 MouseSourceV2OnMouseEventsRequest,
896 fidl::encoding::DefaultFuchsiaResourceDialect
897 );
898 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MouseSourceV2OnMouseEventsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
899 Ok((MouseSourceV2Event::OnMouseEvents {
900 events: out.events,
901 last_event_stamp: out.last_event_stamp,
902 }))
903 }
904 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
905 Ok(MouseSourceV2Event::_UnknownEvent { ordinal: tx_header.ordinal })
906 }
907 _ => Err(fidl::Error::UnknownOrdinal {
908 ordinal: tx_header.ordinal,
909 protocol_name: <MouseSourceV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
910 }),
911 }
912 }
913}
914
915pub struct MouseSourceV2RequestStream {
917 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
918 is_terminated: bool,
919}
920
921impl std::marker::Unpin for MouseSourceV2RequestStream {}
922
923impl futures::stream::FusedStream for MouseSourceV2RequestStream {
924 fn is_terminated(&self) -> bool {
925 self.is_terminated
926 }
927}
928
929impl fidl::endpoints::RequestStream for MouseSourceV2RequestStream {
930 type Protocol = MouseSourceV2Marker;
931 type ControlHandle = MouseSourceV2ControlHandle;
932
933 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
934 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
935 }
936
937 fn control_handle(&self) -> Self::ControlHandle {
938 MouseSourceV2ControlHandle { inner: self.inner.clone() }
939 }
940
941 fn into_inner(
942 self,
943 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
944 {
945 (self.inner, self.is_terminated)
946 }
947
948 fn from_inner(
949 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
950 is_terminated: bool,
951 ) -> Self {
952 Self { inner, is_terminated }
953 }
954}
955
956impl futures::Stream for MouseSourceV2RequestStream {
957 type Item = Result<MouseSourceV2Request, fidl::Error>;
958
959 fn poll_next(
960 mut self: std::pin::Pin<&mut Self>,
961 cx: &mut std::task::Context<'_>,
962 ) -> std::task::Poll<Option<Self::Item>> {
963 let this = &mut *self;
964 if this.inner.check_shutdown(cx) {
965 this.is_terminated = true;
966 return std::task::Poll::Ready(None);
967 }
968 if this.is_terminated {
969 panic!("polled MouseSourceV2RequestStream after completion");
970 }
971 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
972 |bytes, handles| {
973 match this.inner.channel().read_etc(cx, bytes, handles) {
974 std::task::Poll::Ready(Ok(())) => {}
975 std::task::Poll::Pending => return std::task::Poll::Pending,
976 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
977 this.is_terminated = true;
978 return std::task::Poll::Ready(None);
979 }
980 std::task::Poll::Ready(Err(e)) => {
981 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
982 e.into(),
983 ))));
984 }
985 }
986
987 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
989
990 std::task::Poll::Ready(Some(match header.ordinal {
991 0x1be628961fdf2cf1 => {
992 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
993 let mut req = fidl::new_empty!(
994 MouseSourceV2AcknowledgeEventsRequest,
995 fidl::encoding::DefaultFuchsiaResourceDialect
996 );
997 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MouseSourceV2AcknowledgeEventsRequest>(&header, _body_bytes, handles, &mut req)?;
998 let control_handle =
999 MouseSourceV2ControlHandle { inner: this.inner.clone() };
1000 Ok(MouseSourceV2Request::AcknowledgeEvents {
1001 last_acknowledged_event_stamp: req.last_acknowledged_event_stamp,
1002
1003 control_handle,
1004 })
1005 }
1006 _ if header.tx_id == 0
1007 && header
1008 .dynamic_flags()
1009 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1010 {
1011 Ok(MouseSourceV2Request::_UnknownMethod {
1012 ordinal: header.ordinal,
1013 control_handle: MouseSourceV2ControlHandle {
1014 inner: this.inner.clone(),
1015 },
1016 method_type: fidl::MethodType::OneWay,
1017 })
1018 }
1019 _ if header
1020 .dynamic_flags()
1021 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1022 {
1023 this.inner.send_framework_err(
1024 fidl::encoding::FrameworkErr::UnknownMethod,
1025 header.tx_id,
1026 header.ordinal,
1027 header.dynamic_flags(),
1028 (bytes, handles),
1029 )?;
1030 Ok(MouseSourceV2Request::_UnknownMethod {
1031 ordinal: header.ordinal,
1032 control_handle: MouseSourceV2ControlHandle {
1033 inner: this.inner.clone(),
1034 },
1035 method_type: fidl::MethodType::TwoWay,
1036 })
1037 }
1038 _ => Err(fidl::Error::UnknownOrdinal {
1039 ordinal: header.ordinal,
1040 protocol_name:
1041 <MouseSourceV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1042 }),
1043 }))
1044 },
1045 )
1046 }
1047}
1048
1049#[derive(Debug)]
1071pub enum MouseSourceV2Request {
1072 AcknowledgeEvents {
1087 last_acknowledged_event_stamp: u64,
1088 control_handle: MouseSourceV2ControlHandle,
1089 },
1090 #[non_exhaustive]
1092 _UnknownMethod {
1093 ordinal: u64,
1095 control_handle: MouseSourceV2ControlHandle,
1096 method_type: fidl::MethodType,
1097 },
1098}
1099
1100impl MouseSourceV2Request {
1101 #[allow(irrefutable_let_patterns)]
1102 pub fn into_acknowledge_events(self) -> Option<(u64, MouseSourceV2ControlHandle)> {
1103 if let MouseSourceV2Request::AcknowledgeEvents {
1104 last_acknowledged_event_stamp,
1105 control_handle,
1106 } = self
1107 {
1108 Some((last_acknowledged_event_stamp, control_handle))
1109 } else {
1110 None
1111 }
1112 }
1113
1114 pub fn method_name(&self) -> &'static str {
1116 match *self {
1117 MouseSourceV2Request::AcknowledgeEvents { .. } => "acknowledge_events",
1118 MouseSourceV2Request::_UnknownMethod {
1119 method_type: fidl::MethodType::OneWay, ..
1120 } => "unknown one-way method",
1121 MouseSourceV2Request::_UnknownMethod {
1122 method_type: fidl::MethodType::TwoWay, ..
1123 } => "unknown two-way method",
1124 }
1125 }
1126}
1127
1128#[derive(Debug, Clone)]
1129pub struct MouseSourceV2ControlHandle {
1130 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1131}
1132
1133impl MouseSourceV2ControlHandle {
1134 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1135 self.inner.shutdown_with_epitaph(status.into())
1136 }
1137}
1138
1139impl fidl::endpoints::ControlHandle for MouseSourceV2ControlHandle {
1140 fn shutdown(&self) {
1141 self.inner.shutdown()
1142 }
1143
1144 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1145 self.inner.shutdown_with_epitaph(status)
1146 }
1147
1148 fn is_closed(&self) -> bool {
1149 self.inner.channel().is_closed()
1150 }
1151 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1152 self.inner.channel().on_closed()
1153 }
1154
1155 #[cfg(target_os = "fuchsia")]
1156 fn signal_peer(
1157 &self,
1158 clear_mask: zx::Signals,
1159 set_mask: zx::Signals,
1160 ) -> Result<(), zx_status::Status> {
1161 use fidl::Peered;
1162 self.inner.channel().signal_peer(clear_mask, set_mask)
1163 }
1164}
1165
1166impl MouseSourceV2ControlHandle {
1167 pub fn send_on_mouse_events(
1168 &self,
1169 mut events: Vec<MouseEvent>,
1170 mut last_event_stamp: u64,
1171 ) -> Result<(), fidl::Error> {
1172 self.inner.send::<MouseSourceV2OnMouseEventsRequest>(
1173 (events.as_mut(), last_event_stamp),
1174 0,
1175 0x61f8d843a513238d,
1176 fidl::encoding::DynamicFlags::empty(),
1177 )
1178 }
1179}
1180
1181#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1182pub struct TouchSourceMarker;
1183
1184impl fidl::endpoints::ProtocolMarker for TouchSourceMarker {
1185 type Proxy = TouchSourceProxy;
1186 type RequestStream = TouchSourceRequestStream;
1187 #[cfg(target_os = "fuchsia")]
1188 type SynchronousProxy = TouchSourceSynchronousProxy;
1189
1190 const DEBUG_NAME: &'static str = "(anonymous) TouchSource";
1191}
1192
1193pub trait TouchSourceProxyInterface: Send + Sync {
1194 type WatchResponseFut: std::future::Future<Output = Result<Vec<TouchEvent>, fidl::Error>> + Send;
1195 fn r#watch(&self, responses: &[TouchResponse]) -> Self::WatchResponseFut;
1196 type UpdateResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1197 fn r#update_response(
1198 &self,
1199 interaction: &TouchInteractionId,
1200 response: &TouchResponse,
1201 ) -> Self::UpdateResponseResponseFut;
1202}
1203#[derive(Debug)]
1204#[cfg(target_os = "fuchsia")]
1205pub struct TouchSourceSynchronousProxy {
1206 client: fidl::client::sync::Client,
1207}
1208
1209#[cfg(target_os = "fuchsia")]
1210impl fidl::endpoints::SynchronousProxy for TouchSourceSynchronousProxy {
1211 type Proxy = TouchSourceProxy;
1212 type Protocol = TouchSourceMarker;
1213
1214 fn from_channel(inner: fidl::Channel) -> Self {
1215 Self::new(inner)
1216 }
1217
1218 fn into_channel(self) -> fidl::Channel {
1219 self.client.into_channel()
1220 }
1221
1222 fn as_channel(&self) -> &fidl::Channel {
1223 self.client.as_channel()
1224 }
1225}
1226
1227#[cfg(target_os = "fuchsia")]
1228impl TouchSourceSynchronousProxy {
1229 pub fn new(channel: fidl::Channel) -> Self {
1230 Self { client: fidl::client::sync::Client::new(channel) }
1231 }
1232
1233 pub fn into_channel(self) -> fidl::Channel {
1234 self.client.into_channel()
1235 }
1236
1237 pub fn wait_for_event(
1240 &self,
1241 deadline: zx::MonotonicInstant,
1242 ) -> Result<TouchSourceEvent, fidl::Error> {
1243 TouchSourceEvent::decode(self.client.wait_for_event::<TouchSourceMarker>(deadline)?)
1244 }
1245
1246 pub fn r#watch(
1287 &self,
1288 mut responses: &[TouchResponse],
1289 ___deadline: zx::MonotonicInstant,
1290 ) -> Result<Vec<TouchEvent>, fidl::Error> {
1291 let _response = self
1292 .client
1293 .send_query::<TouchSourceWatchRequest, TouchSourceWatchResponse, TouchSourceMarker>(
1294 (responses,),
1295 0x38453127dd0fc7d,
1296 fidl::encoding::DynamicFlags::empty(),
1297 ___deadline,
1298 )?;
1299 Ok(_response.events)
1300 }
1301
1302 pub fn r#update_response(
1319 &self,
1320 mut interaction: &TouchInteractionId,
1321 mut response: &TouchResponse,
1322 ___deadline: zx::MonotonicInstant,
1323 ) -> Result<(), fidl::Error> {
1324 let _response = self.client.send_query::<
1325 TouchSourceUpdateResponseRequest,
1326 fidl::encoding::EmptyPayload,
1327 TouchSourceMarker,
1328 >(
1329 (interaction, response,),
1330 0x6c746a313b39898a,
1331 fidl::encoding::DynamicFlags::empty(),
1332 ___deadline,
1333 )?;
1334 Ok(_response)
1335 }
1336}
1337
1338#[cfg(target_os = "fuchsia")]
1339impl From<TouchSourceSynchronousProxy> for zx::NullableHandle {
1340 fn from(value: TouchSourceSynchronousProxy) -> Self {
1341 value.into_channel().into()
1342 }
1343}
1344
1345#[cfg(target_os = "fuchsia")]
1346impl From<fidl::Channel> for TouchSourceSynchronousProxy {
1347 fn from(value: fidl::Channel) -> Self {
1348 Self::new(value)
1349 }
1350}
1351
1352#[cfg(target_os = "fuchsia")]
1353impl fidl::endpoints::FromClient for TouchSourceSynchronousProxy {
1354 type Protocol = TouchSourceMarker;
1355
1356 fn from_client(value: fidl::endpoints::ClientEnd<TouchSourceMarker>) -> Self {
1357 Self::new(value.into_channel())
1358 }
1359}
1360
1361#[derive(Debug, Clone)]
1362pub struct TouchSourceProxy {
1363 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1364}
1365
1366impl fidl::endpoints::Proxy for TouchSourceProxy {
1367 type Protocol = TouchSourceMarker;
1368
1369 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1370 Self::new(inner)
1371 }
1372
1373 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1374 self.client.into_channel().map_err(|client| Self { client })
1375 }
1376
1377 fn as_channel(&self) -> &::fidl::AsyncChannel {
1378 self.client.as_channel()
1379 }
1380}
1381
1382impl TouchSourceProxy {
1383 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1385 let protocol_name = <TouchSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1386 Self { client: fidl::client::Client::new(channel, protocol_name) }
1387 }
1388
1389 pub fn take_event_stream(&self) -> TouchSourceEventStream {
1395 TouchSourceEventStream { event_receiver: self.client.take_event_receiver() }
1396 }
1397
1398 pub fn r#watch(
1439 &self,
1440 mut responses: &[TouchResponse],
1441 ) -> fidl::client::QueryResponseFut<
1442 Vec<TouchEvent>,
1443 fidl::encoding::DefaultFuchsiaResourceDialect,
1444 > {
1445 TouchSourceProxyInterface::r#watch(self, responses)
1446 }
1447
1448 pub fn r#update_response(
1465 &self,
1466 mut interaction: &TouchInteractionId,
1467 mut response: &TouchResponse,
1468 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1469 TouchSourceProxyInterface::r#update_response(self, interaction, response)
1470 }
1471}
1472
1473impl TouchSourceProxyInterface for TouchSourceProxy {
1474 type WatchResponseFut = fidl::client::QueryResponseFut<
1475 Vec<TouchEvent>,
1476 fidl::encoding::DefaultFuchsiaResourceDialect,
1477 >;
1478 fn r#watch(&self, mut responses: &[TouchResponse]) -> Self::WatchResponseFut {
1479 fn _decode(
1480 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1481 ) -> Result<Vec<TouchEvent>, fidl::Error> {
1482 let _response = fidl::client::decode_transaction_body::<
1483 TouchSourceWatchResponse,
1484 fidl::encoding::DefaultFuchsiaResourceDialect,
1485 0x38453127dd0fc7d,
1486 >(_buf?)?;
1487 Ok(_response.events)
1488 }
1489 self.client.send_query_and_decode::<TouchSourceWatchRequest, Vec<TouchEvent>>(
1490 (responses,),
1491 0x38453127dd0fc7d,
1492 fidl::encoding::DynamicFlags::empty(),
1493 _decode,
1494 )
1495 }
1496
1497 type UpdateResponseResponseFut =
1498 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1499 fn r#update_response(
1500 &self,
1501 mut interaction: &TouchInteractionId,
1502 mut response: &TouchResponse,
1503 ) -> Self::UpdateResponseResponseFut {
1504 fn _decode(
1505 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1506 ) -> Result<(), fidl::Error> {
1507 let _response = fidl::client::decode_transaction_body::<
1508 fidl::encoding::EmptyPayload,
1509 fidl::encoding::DefaultFuchsiaResourceDialect,
1510 0x6c746a313b39898a,
1511 >(_buf?)?;
1512 Ok(_response)
1513 }
1514 self.client.send_query_and_decode::<TouchSourceUpdateResponseRequest, ()>(
1515 (interaction, response),
1516 0x6c746a313b39898a,
1517 fidl::encoding::DynamicFlags::empty(),
1518 _decode,
1519 )
1520 }
1521}
1522
1523pub struct TouchSourceEventStream {
1524 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1525}
1526
1527impl std::marker::Unpin for TouchSourceEventStream {}
1528
1529impl futures::stream::FusedStream for TouchSourceEventStream {
1530 fn is_terminated(&self) -> bool {
1531 self.event_receiver.is_terminated()
1532 }
1533}
1534
1535impl futures::Stream for TouchSourceEventStream {
1536 type Item = Result<TouchSourceEvent, fidl::Error>;
1537
1538 fn poll_next(
1539 mut self: std::pin::Pin<&mut Self>,
1540 cx: &mut std::task::Context<'_>,
1541 ) -> std::task::Poll<Option<Self::Item>> {
1542 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1543 &mut self.event_receiver,
1544 cx
1545 )?) {
1546 Some(buf) => std::task::Poll::Ready(Some(TouchSourceEvent::decode(buf))),
1547 None => std::task::Poll::Ready(None),
1548 }
1549 }
1550}
1551
1552#[derive(Debug)]
1553pub enum TouchSourceEvent {}
1554
1555impl TouchSourceEvent {
1556 fn decode(
1558 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1559 ) -> Result<TouchSourceEvent, fidl::Error> {
1560 let (bytes, _handles) = buf.split_mut();
1561 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1562 debug_assert_eq!(tx_header.tx_id, 0);
1563 match tx_header.ordinal {
1564 _ => Err(fidl::Error::UnknownOrdinal {
1565 ordinal: tx_header.ordinal,
1566 protocol_name: <TouchSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1567 }),
1568 }
1569 }
1570}
1571
1572pub struct TouchSourceRequestStream {
1574 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1575 is_terminated: bool,
1576}
1577
1578impl std::marker::Unpin for TouchSourceRequestStream {}
1579
1580impl futures::stream::FusedStream for TouchSourceRequestStream {
1581 fn is_terminated(&self) -> bool {
1582 self.is_terminated
1583 }
1584}
1585
1586impl fidl::endpoints::RequestStream for TouchSourceRequestStream {
1587 type Protocol = TouchSourceMarker;
1588 type ControlHandle = TouchSourceControlHandle;
1589
1590 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1591 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1592 }
1593
1594 fn control_handle(&self) -> Self::ControlHandle {
1595 TouchSourceControlHandle { inner: self.inner.clone() }
1596 }
1597
1598 fn into_inner(
1599 self,
1600 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1601 {
1602 (self.inner, self.is_terminated)
1603 }
1604
1605 fn from_inner(
1606 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1607 is_terminated: bool,
1608 ) -> Self {
1609 Self { inner, is_terminated }
1610 }
1611}
1612
1613impl futures::Stream for TouchSourceRequestStream {
1614 type Item = Result<TouchSourceRequest, fidl::Error>;
1615
1616 fn poll_next(
1617 mut self: std::pin::Pin<&mut Self>,
1618 cx: &mut std::task::Context<'_>,
1619 ) -> std::task::Poll<Option<Self::Item>> {
1620 let this = &mut *self;
1621 if this.inner.check_shutdown(cx) {
1622 this.is_terminated = true;
1623 return std::task::Poll::Ready(None);
1624 }
1625 if this.is_terminated {
1626 panic!("polled TouchSourceRequestStream after completion");
1627 }
1628 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1629 |bytes, handles| {
1630 match this.inner.channel().read_etc(cx, bytes, handles) {
1631 std::task::Poll::Ready(Ok(())) => {}
1632 std::task::Poll::Pending => return std::task::Poll::Pending,
1633 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1634 this.is_terminated = true;
1635 return std::task::Poll::Ready(None);
1636 }
1637 std::task::Poll::Ready(Err(e)) => {
1638 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1639 e.into(),
1640 ))));
1641 }
1642 }
1643
1644 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1646
1647 std::task::Poll::Ready(Some(match header.ordinal {
1648 0x38453127dd0fc7d => {
1649 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1650 let mut req = fidl::new_empty!(
1651 TouchSourceWatchRequest,
1652 fidl::encoding::DefaultFuchsiaResourceDialect
1653 );
1654 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchSourceWatchRequest>(&header, _body_bytes, handles, &mut req)?;
1655 let control_handle = TouchSourceControlHandle { inner: this.inner.clone() };
1656 Ok(TouchSourceRequest::Watch {
1657 responses: req.responses,
1658
1659 responder: TouchSourceWatchResponder {
1660 control_handle: std::mem::ManuallyDrop::new(control_handle),
1661 tx_id: header.tx_id,
1662 },
1663 })
1664 }
1665 0x6c746a313b39898a => {
1666 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1667 let mut req = fidl::new_empty!(
1668 TouchSourceUpdateResponseRequest,
1669 fidl::encoding::DefaultFuchsiaResourceDialect
1670 );
1671 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchSourceUpdateResponseRequest>(&header, _body_bytes, handles, &mut req)?;
1672 let control_handle = TouchSourceControlHandle { inner: this.inner.clone() };
1673 Ok(TouchSourceRequest::UpdateResponse {
1674 interaction: req.interaction,
1675 response: req.response,
1676
1677 responder: TouchSourceUpdateResponseResponder {
1678 control_handle: std::mem::ManuallyDrop::new(control_handle),
1679 tx_id: header.tx_id,
1680 },
1681 })
1682 }
1683 _ => Err(fidl::Error::UnknownOrdinal {
1684 ordinal: header.ordinal,
1685 protocol_name:
1686 <TouchSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1687 }),
1688 }))
1689 },
1690 )
1691 }
1692}
1693
1694#[derive(Debug)]
1710pub enum TouchSourceRequest {
1711 Watch { responses: Vec<TouchResponse>, responder: TouchSourceWatchResponder },
1752 UpdateResponse {
1769 interaction: TouchInteractionId,
1770 response: TouchResponse,
1771 responder: TouchSourceUpdateResponseResponder,
1772 },
1773}
1774
1775impl TouchSourceRequest {
1776 #[allow(irrefutable_let_patterns)]
1777 pub fn into_watch(self) -> Option<(Vec<TouchResponse>, TouchSourceWatchResponder)> {
1778 if let TouchSourceRequest::Watch { responses, responder } = self {
1779 Some((responses, responder))
1780 } else {
1781 None
1782 }
1783 }
1784
1785 #[allow(irrefutable_let_patterns)]
1786 pub fn into_update_response(
1787 self,
1788 ) -> Option<(TouchInteractionId, TouchResponse, TouchSourceUpdateResponseResponder)> {
1789 if let TouchSourceRequest::UpdateResponse { interaction, response, responder } = self {
1790 Some((interaction, response, responder))
1791 } else {
1792 None
1793 }
1794 }
1795
1796 pub fn method_name(&self) -> &'static str {
1798 match *self {
1799 TouchSourceRequest::Watch { .. } => "watch",
1800 TouchSourceRequest::UpdateResponse { .. } => "update_response",
1801 }
1802 }
1803}
1804
1805#[derive(Debug, Clone)]
1806pub struct TouchSourceControlHandle {
1807 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1808}
1809
1810impl TouchSourceControlHandle {
1811 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1812 self.inner.shutdown_with_epitaph(status.into())
1813 }
1814}
1815
1816impl fidl::endpoints::ControlHandle for TouchSourceControlHandle {
1817 fn shutdown(&self) {
1818 self.inner.shutdown()
1819 }
1820
1821 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1822 self.inner.shutdown_with_epitaph(status)
1823 }
1824
1825 fn is_closed(&self) -> bool {
1826 self.inner.channel().is_closed()
1827 }
1828 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1829 self.inner.channel().on_closed()
1830 }
1831
1832 #[cfg(target_os = "fuchsia")]
1833 fn signal_peer(
1834 &self,
1835 clear_mask: zx::Signals,
1836 set_mask: zx::Signals,
1837 ) -> Result<(), zx_status::Status> {
1838 use fidl::Peered;
1839 self.inner.channel().signal_peer(clear_mask, set_mask)
1840 }
1841}
1842
1843impl TouchSourceControlHandle {}
1844
1845#[must_use = "FIDL methods require a response to be sent"]
1846#[derive(Debug)]
1847pub struct TouchSourceWatchResponder {
1848 control_handle: std::mem::ManuallyDrop<TouchSourceControlHandle>,
1849 tx_id: u32,
1850}
1851
1852impl std::ops::Drop for TouchSourceWatchResponder {
1856 fn drop(&mut self) {
1857 self.control_handle.shutdown();
1858 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1860 }
1861}
1862
1863impl fidl::endpoints::Responder for TouchSourceWatchResponder {
1864 type ControlHandle = TouchSourceControlHandle;
1865
1866 fn control_handle(&self) -> &TouchSourceControlHandle {
1867 &self.control_handle
1868 }
1869
1870 fn drop_without_shutdown(mut self) {
1871 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1873 std::mem::forget(self);
1875 }
1876}
1877
1878impl TouchSourceWatchResponder {
1879 pub fn send(self, mut events: Vec<TouchEvent>) -> Result<(), fidl::Error> {
1883 let _result = self.send_raw(events);
1884 if _result.is_err() {
1885 self.control_handle.shutdown();
1886 }
1887 self.drop_without_shutdown();
1888 _result
1889 }
1890
1891 pub fn send_no_shutdown_on_err(self, mut events: Vec<TouchEvent>) -> Result<(), fidl::Error> {
1893 let _result = self.send_raw(events);
1894 self.drop_without_shutdown();
1895 _result
1896 }
1897
1898 fn send_raw(&self, mut events: Vec<TouchEvent>) -> Result<(), fidl::Error> {
1899 self.control_handle.inner.send::<TouchSourceWatchResponse>(
1900 (events.as_mut(),),
1901 self.tx_id,
1902 0x38453127dd0fc7d,
1903 fidl::encoding::DynamicFlags::empty(),
1904 )
1905 }
1906}
1907
1908#[must_use = "FIDL methods require a response to be sent"]
1909#[derive(Debug)]
1910pub struct TouchSourceUpdateResponseResponder {
1911 control_handle: std::mem::ManuallyDrop<TouchSourceControlHandle>,
1912 tx_id: u32,
1913}
1914
1915impl std::ops::Drop for TouchSourceUpdateResponseResponder {
1919 fn drop(&mut self) {
1920 self.control_handle.shutdown();
1921 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1923 }
1924}
1925
1926impl fidl::endpoints::Responder for TouchSourceUpdateResponseResponder {
1927 type ControlHandle = TouchSourceControlHandle;
1928
1929 fn control_handle(&self) -> &TouchSourceControlHandle {
1930 &self.control_handle
1931 }
1932
1933 fn drop_without_shutdown(mut self) {
1934 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1936 std::mem::forget(self);
1938 }
1939}
1940
1941impl TouchSourceUpdateResponseResponder {
1942 pub fn send(self) -> Result<(), fidl::Error> {
1946 let _result = self.send_raw();
1947 if _result.is_err() {
1948 self.control_handle.shutdown();
1949 }
1950 self.drop_without_shutdown();
1951 _result
1952 }
1953
1954 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1956 let _result = self.send_raw();
1957 self.drop_without_shutdown();
1958 _result
1959 }
1960
1961 fn send_raw(&self) -> Result<(), fidl::Error> {
1962 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1963 (),
1964 self.tx_id,
1965 0x6c746a313b39898a,
1966 fidl::encoding::DynamicFlags::empty(),
1967 )
1968 }
1969}
1970
1971#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1972pub struct TouchSourceV2Marker;
1973
1974impl fidl::endpoints::ProtocolMarker for TouchSourceV2Marker {
1975 type Proxy = TouchSourceV2Proxy;
1976 type RequestStream = TouchSourceV2RequestStream;
1977 #[cfg(target_os = "fuchsia")]
1978 type SynchronousProxy = TouchSourceV2SynchronousProxy;
1979
1980 const DEBUG_NAME: &'static str = "(anonymous) TouchSourceV2";
1981}
1982
1983pub trait TouchSourceV2ProxyInterface: Send + Sync {
1984 fn r#acknowledge_events(&self, last_acknowledged_event_stamp: u64) -> Result<(), fidl::Error>;
1985}
1986#[derive(Debug)]
1987#[cfg(target_os = "fuchsia")]
1988pub struct TouchSourceV2SynchronousProxy {
1989 client: fidl::client::sync::Client,
1990}
1991
1992#[cfg(target_os = "fuchsia")]
1993impl fidl::endpoints::SynchronousProxy for TouchSourceV2SynchronousProxy {
1994 type Proxy = TouchSourceV2Proxy;
1995 type Protocol = TouchSourceV2Marker;
1996
1997 fn from_channel(inner: fidl::Channel) -> Self {
1998 Self::new(inner)
1999 }
2000
2001 fn into_channel(self) -> fidl::Channel {
2002 self.client.into_channel()
2003 }
2004
2005 fn as_channel(&self) -> &fidl::Channel {
2006 self.client.as_channel()
2007 }
2008}
2009
2010#[cfg(target_os = "fuchsia")]
2011impl TouchSourceV2SynchronousProxy {
2012 pub fn new(channel: fidl::Channel) -> Self {
2013 Self { client: fidl::client::sync::Client::new(channel) }
2014 }
2015
2016 pub fn into_channel(self) -> fidl::Channel {
2017 self.client.into_channel()
2018 }
2019
2020 pub fn wait_for_event(
2023 &self,
2024 deadline: zx::MonotonicInstant,
2025 ) -> Result<TouchSourceV2Event, fidl::Error> {
2026 TouchSourceV2Event::decode(self.client.wait_for_event::<TouchSourceV2Marker>(deadline)?)
2027 }
2028
2029 pub fn r#acknowledge_events(
2044 &self,
2045 mut last_acknowledged_event_stamp: u64,
2046 ) -> Result<(), fidl::Error> {
2047 self.client.send::<TouchSourceV2AcknowledgeEventsRequest>(
2048 (last_acknowledged_event_stamp,),
2049 0x262966714efb0712,
2050 fidl::encoding::DynamicFlags::empty(),
2051 )
2052 }
2053}
2054
2055#[cfg(target_os = "fuchsia")]
2056impl From<TouchSourceV2SynchronousProxy> for zx::NullableHandle {
2057 fn from(value: TouchSourceV2SynchronousProxy) -> Self {
2058 value.into_channel().into()
2059 }
2060}
2061
2062#[cfg(target_os = "fuchsia")]
2063impl From<fidl::Channel> for TouchSourceV2SynchronousProxy {
2064 fn from(value: fidl::Channel) -> Self {
2065 Self::new(value)
2066 }
2067}
2068
2069#[cfg(target_os = "fuchsia")]
2070impl fidl::endpoints::FromClient for TouchSourceV2SynchronousProxy {
2071 type Protocol = TouchSourceV2Marker;
2072
2073 fn from_client(value: fidl::endpoints::ClientEnd<TouchSourceV2Marker>) -> Self {
2074 Self::new(value.into_channel())
2075 }
2076}
2077
2078#[derive(Debug, Clone)]
2079pub struct TouchSourceV2Proxy {
2080 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2081}
2082
2083impl fidl::endpoints::Proxy for TouchSourceV2Proxy {
2084 type Protocol = TouchSourceV2Marker;
2085
2086 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2087 Self::new(inner)
2088 }
2089
2090 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2091 self.client.into_channel().map_err(|client| Self { client })
2092 }
2093
2094 fn as_channel(&self) -> &::fidl::AsyncChannel {
2095 self.client.as_channel()
2096 }
2097}
2098
2099impl TouchSourceV2Proxy {
2100 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2102 let protocol_name = <TouchSourceV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2103 Self { client: fidl::client::Client::new(channel, protocol_name) }
2104 }
2105
2106 pub fn take_event_stream(&self) -> TouchSourceV2EventStream {
2112 TouchSourceV2EventStream { event_receiver: self.client.take_event_receiver() }
2113 }
2114
2115 pub fn r#acknowledge_events(
2130 &self,
2131 mut last_acknowledged_event_stamp: u64,
2132 ) -> Result<(), fidl::Error> {
2133 TouchSourceV2ProxyInterface::r#acknowledge_events(self, last_acknowledged_event_stamp)
2134 }
2135}
2136
2137impl TouchSourceV2ProxyInterface for TouchSourceV2Proxy {
2138 fn r#acknowledge_events(
2139 &self,
2140 mut last_acknowledged_event_stamp: u64,
2141 ) -> Result<(), fidl::Error> {
2142 self.client.send::<TouchSourceV2AcknowledgeEventsRequest>(
2143 (last_acknowledged_event_stamp,),
2144 0x262966714efb0712,
2145 fidl::encoding::DynamicFlags::empty(),
2146 )
2147 }
2148}
2149
2150pub struct TouchSourceV2EventStream {
2151 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2152}
2153
2154impl std::marker::Unpin for TouchSourceV2EventStream {}
2155
2156impl futures::stream::FusedStream for TouchSourceV2EventStream {
2157 fn is_terminated(&self) -> bool {
2158 self.event_receiver.is_terminated()
2159 }
2160}
2161
2162impl futures::Stream for TouchSourceV2EventStream {
2163 type Item = Result<TouchSourceV2Event, fidl::Error>;
2164
2165 fn poll_next(
2166 mut self: std::pin::Pin<&mut Self>,
2167 cx: &mut std::task::Context<'_>,
2168 ) -> std::task::Poll<Option<Self::Item>> {
2169 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2170 &mut self.event_receiver,
2171 cx
2172 )?) {
2173 Some(buf) => std::task::Poll::Ready(Some(TouchSourceV2Event::decode(buf))),
2174 None => std::task::Poll::Ready(None),
2175 }
2176 }
2177}
2178
2179#[derive(Debug)]
2180pub enum TouchSourceV2Event {
2181 OnTouchEvents {
2182 events: Vec<TouchEvent>,
2183 last_event_stamp: u64,
2184 },
2185 #[non_exhaustive]
2186 _UnknownEvent {
2187 ordinal: u64,
2189 },
2190}
2191
2192impl TouchSourceV2Event {
2193 #[allow(irrefutable_let_patterns)]
2194 pub fn into_on_touch_events(self) -> Option<(Vec<TouchEvent>, u64)> {
2195 if let TouchSourceV2Event::OnTouchEvents { events, last_event_stamp } = self {
2196 Some((events, last_event_stamp))
2197 } else {
2198 None
2199 }
2200 }
2201
2202 fn decode(
2204 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2205 ) -> Result<TouchSourceV2Event, fidl::Error> {
2206 let (bytes, _handles) = buf.split_mut();
2207 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2208 debug_assert_eq!(tx_header.tx_id, 0);
2209 match tx_header.ordinal {
2210 0x28aa3c07e625b3f7 => {
2211 let mut out = fidl::new_empty!(
2212 TouchSourceV2OnTouchEventsRequest,
2213 fidl::encoding::DefaultFuchsiaResourceDialect
2214 );
2215 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchSourceV2OnTouchEventsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2216 Ok((TouchSourceV2Event::OnTouchEvents {
2217 events: out.events,
2218 last_event_stamp: out.last_event_stamp,
2219 }))
2220 }
2221 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2222 Ok(TouchSourceV2Event::_UnknownEvent { ordinal: tx_header.ordinal })
2223 }
2224 _ => Err(fidl::Error::UnknownOrdinal {
2225 ordinal: tx_header.ordinal,
2226 protocol_name: <TouchSourceV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2227 }),
2228 }
2229 }
2230}
2231
2232pub struct TouchSourceV2RequestStream {
2234 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2235 is_terminated: bool,
2236}
2237
2238impl std::marker::Unpin for TouchSourceV2RequestStream {}
2239
2240impl futures::stream::FusedStream for TouchSourceV2RequestStream {
2241 fn is_terminated(&self) -> bool {
2242 self.is_terminated
2243 }
2244}
2245
2246impl fidl::endpoints::RequestStream for TouchSourceV2RequestStream {
2247 type Protocol = TouchSourceV2Marker;
2248 type ControlHandle = TouchSourceV2ControlHandle;
2249
2250 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2251 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2252 }
2253
2254 fn control_handle(&self) -> Self::ControlHandle {
2255 TouchSourceV2ControlHandle { inner: self.inner.clone() }
2256 }
2257
2258 fn into_inner(
2259 self,
2260 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2261 {
2262 (self.inner, self.is_terminated)
2263 }
2264
2265 fn from_inner(
2266 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2267 is_terminated: bool,
2268 ) -> Self {
2269 Self { inner, is_terminated }
2270 }
2271}
2272
2273impl futures::Stream for TouchSourceV2RequestStream {
2274 type Item = Result<TouchSourceV2Request, fidl::Error>;
2275
2276 fn poll_next(
2277 mut self: std::pin::Pin<&mut Self>,
2278 cx: &mut std::task::Context<'_>,
2279 ) -> std::task::Poll<Option<Self::Item>> {
2280 let this = &mut *self;
2281 if this.inner.check_shutdown(cx) {
2282 this.is_terminated = true;
2283 return std::task::Poll::Ready(None);
2284 }
2285 if this.is_terminated {
2286 panic!("polled TouchSourceV2RequestStream after completion");
2287 }
2288 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2289 |bytes, handles| {
2290 match this.inner.channel().read_etc(cx, bytes, handles) {
2291 std::task::Poll::Ready(Ok(())) => {}
2292 std::task::Poll::Pending => return std::task::Poll::Pending,
2293 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2294 this.is_terminated = true;
2295 return std::task::Poll::Ready(None);
2296 }
2297 std::task::Poll::Ready(Err(e)) => {
2298 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2299 e.into(),
2300 ))));
2301 }
2302 }
2303
2304 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2306
2307 std::task::Poll::Ready(Some(match header.ordinal {
2308 0x262966714efb0712 => {
2309 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2310 let mut req = fidl::new_empty!(
2311 TouchSourceV2AcknowledgeEventsRequest,
2312 fidl::encoding::DefaultFuchsiaResourceDialect
2313 );
2314 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchSourceV2AcknowledgeEventsRequest>(&header, _body_bytes, handles, &mut req)?;
2315 let control_handle =
2316 TouchSourceV2ControlHandle { inner: this.inner.clone() };
2317 Ok(TouchSourceV2Request::AcknowledgeEvents {
2318 last_acknowledged_event_stamp: req.last_acknowledged_event_stamp,
2319
2320 control_handle,
2321 })
2322 }
2323 _ if header.tx_id == 0
2324 && header
2325 .dynamic_flags()
2326 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2327 {
2328 Ok(TouchSourceV2Request::_UnknownMethod {
2329 ordinal: header.ordinal,
2330 control_handle: TouchSourceV2ControlHandle {
2331 inner: this.inner.clone(),
2332 },
2333 method_type: fidl::MethodType::OneWay,
2334 })
2335 }
2336 _ if header
2337 .dynamic_flags()
2338 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2339 {
2340 this.inner.send_framework_err(
2341 fidl::encoding::FrameworkErr::UnknownMethod,
2342 header.tx_id,
2343 header.ordinal,
2344 header.dynamic_flags(),
2345 (bytes, handles),
2346 )?;
2347 Ok(TouchSourceV2Request::_UnknownMethod {
2348 ordinal: header.ordinal,
2349 control_handle: TouchSourceV2ControlHandle {
2350 inner: this.inner.clone(),
2351 },
2352 method_type: fidl::MethodType::TwoWay,
2353 })
2354 }
2355 _ => Err(fidl::Error::UnknownOrdinal {
2356 ordinal: header.ordinal,
2357 protocol_name:
2358 <TouchSourceV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2359 }),
2360 }))
2361 },
2362 )
2363 }
2364}
2365
2366#[derive(Debug)]
2403pub enum TouchSourceV2Request {
2404 AcknowledgeEvents {
2419 last_acknowledged_event_stamp: u64,
2420 control_handle: TouchSourceV2ControlHandle,
2421 },
2422 #[non_exhaustive]
2424 _UnknownMethod {
2425 ordinal: u64,
2427 control_handle: TouchSourceV2ControlHandle,
2428 method_type: fidl::MethodType,
2429 },
2430}
2431
2432impl TouchSourceV2Request {
2433 #[allow(irrefutable_let_patterns)]
2434 pub fn into_acknowledge_events(self) -> Option<(u64, TouchSourceV2ControlHandle)> {
2435 if let TouchSourceV2Request::AcknowledgeEvents {
2436 last_acknowledged_event_stamp,
2437 control_handle,
2438 } = self
2439 {
2440 Some((last_acknowledged_event_stamp, control_handle))
2441 } else {
2442 None
2443 }
2444 }
2445
2446 pub fn method_name(&self) -> &'static str {
2448 match *self {
2449 TouchSourceV2Request::AcknowledgeEvents { .. } => "acknowledge_events",
2450 TouchSourceV2Request::_UnknownMethod {
2451 method_type: fidl::MethodType::OneWay, ..
2452 } => "unknown one-way method",
2453 TouchSourceV2Request::_UnknownMethod {
2454 method_type: fidl::MethodType::TwoWay, ..
2455 } => "unknown two-way method",
2456 }
2457 }
2458}
2459
2460#[derive(Debug, Clone)]
2461pub struct TouchSourceV2ControlHandle {
2462 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2463}
2464
2465impl TouchSourceV2ControlHandle {
2466 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2467 self.inner.shutdown_with_epitaph(status.into())
2468 }
2469}
2470
2471impl fidl::endpoints::ControlHandle for TouchSourceV2ControlHandle {
2472 fn shutdown(&self) {
2473 self.inner.shutdown()
2474 }
2475
2476 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2477 self.inner.shutdown_with_epitaph(status)
2478 }
2479
2480 fn is_closed(&self) -> bool {
2481 self.inner.channel().is_closed()
2482 }
2483 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2484 self.inner.channel().on_closed()
2485 }
2486
2487 #[cfg(target_os = "fuchsia")]
2488 fn signal_peer(
2489 &self,
2490 clear_mask: zx::Signals,
2491 set_mask: zx::Signals,
2492 ) -> Result<(), zx_status::Status> {
2493 use fidl::Peered;
2494 self.inner.channel().signal_peer(clear_mask, set_mask)
2495 }
2496}
2497
2498impl TouchSourceV2ControlHandle {
2499 pub fn send_on_touch_events(
2500 &self,
2501 mut events: Vec<TouchEvent>,
2502 mut last_event_stamp: u64,
2503 ) -> Result<(), fidl::Error> {
2504 self.inner.send::<TouchSourceV2OnTouchEventsRequest>(
2505 (events.as_mut(), last_event_stamp),
2506 0,
2507 0x28aa3c07e625b3f7,
2508 fidl::encoding::DynamicFlags::empty(),
2509 )
2510 }
2511}
2512
2513mod internal {
2514 use super::*;
2515
2516 impl fidl::encoding::ResourceTypeMarker for MouseSourceV2OnMouseEventsRequest {
2517 type Borrowed<'a> = &'a mut Self;
2518 fn take_or_borrow<'a>(
2519 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2520 ) -> Self::Borrowed<'a> {
2521 value
2522 }
2523 }
2524
2525 unsafe impl fidl::encoding::TypeMarker for MouseSourceV2OnMouseEventsRequest {
2526 type Owned = Self;
2527
2528 #[inline(always)]
2529 fn inline_align(_context: fidl::encoding::Context) -> usize {
2530 8
2531 }
2532
2533 #[inline(always)]
2534 fn inline_size(_context: fidl::encoding::Context) -> usize {
2535 24
2536 }
2537 }
2538
2539 unsafe impl
2540 fidl::encoding::Encode<
2541 MouseSourceV2OnMouseEventsRequest,
2542 fidl::encoding::DefaultFuchsiaResourceDialect,
2543 > for &mut MouseSourceV2OnMouseEventsRequest
2544 {
2545 #[inline]
2546 unsafe fn encode(
2547 self,
2548 encoder: &mut fidl::encoding::Encoder<
2549 '_,
2550 fidl::encoding::DefaultFuchsiaResourceDialect,
2551 >,
2552 offset: usize,
2553 _depth: fidl::encoding::Depth,
2554 ) -> fidl::Result<()> {
2555 encoder.debug_check_bounds::<MouseSourceV2OnMouseEventsRequest>(offset);
2556 fidl::encoding::Encode::<MouseSourceV2OnMouseEventsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2558 (
2559 <fidl::encoding::Vector<MouseEvent, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
2560 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.last_event_stamp),
2561 ),
2562 encoder, offset, _depth
2563 )
2564 }
2565 }
2566 unsafe impl<
2567 T0: fidl::encoding::Encode<
2568 fidl::encoding::Vector<MouseEvent, 128>,
2569 fidl::encoding::DefaultFuchsiaResourceDialect,
2570 >,
2571 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2572 >
2573 fidl::encoding::Encode<
2574 MouseSourceV2OnMouseEventsRequest,
2575 fidl::encoding::DefaultFuchsiaResourceDialect,
2576 > for (T0, T1)
2577 {
2578 #[inline]
2579 unsafe fn encode(
2580 self,
2581 encoder: &mut fidl::encoding::Encoder<
2582 '_,
2583 fidl::encoding::DefaultFuchsiaResourceDialect,
2584 >,
2585 offset: usize,
2586 depth: fidl::encoding::Depth,
2587 ) -> fidl::Result<()> {
2588 encoder.debug_check_bounds::<MouseSourceV2OnMouseEventsRequest>(offset);
2589 self.0.encode(encoder, offset + 0, depth)?;
2593 self.1.encode(encoder, offset + 16, depth)?;
2594 Ok(())
2595 }
2596 }
2597
2598 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2599 for MouseSourceV2OnMouseEventsRequest
2600 {
2601 #[inline(always)]
2602 fn new_empty() -> Self {
2603 Self {
2604 events: fidl::new_empty!(fidl::encoding::Vector<MouseEvent, 128>, fidl::encoding::DefaultFuchsiaResourceDialect),
2605 last_event_stamp: fidl::new_empty!(
2606 u64,
2607 fidl::encoding::DefaultFuchsiaResourceDialect
2608 ),
2609 }
2610 }
2611
2612 #[inline]
2613 unsafe fn decode(
2614 &mut self,
2615 decoder: &mut fidl::encoding::Decoder<
2616 '_,
2617 fidl::encoding::DefaultFuchsiaResourceDialect,
2618 >,
2619 offset: usize,
2620 _depth: fidl::encoding::Depth,
2621 ) -> fidl::Result<()> {
2622 decoder.debug_check_bounds::<Self>(offset);
2623 fidl::decode!(fidl::encoding::Vector<MouseEvent, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.events, decoder, offset + 0, _depth)?;
2625 fidl::decode!(
2626 u64,
2627 fidl::encoding::DefaultFuchsiaResourceDialect,
2628 &mut self.last_event_stamp,
2629 decoder,
2630 offset + 16,
2631 _depth
2632 )?;
2633 Ok(())
2634 }
2635 }
2636
2637 impl fidl::encoding::ResourceTypeMarker for MouseSourceWatchResponse {
2638 type Borrowed<'a> = &'a mut Self;
2639 fn take_or_borrow<'a>(
2640 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2641 ) -> Self::Borrowed<'a> {
2642 value
2643 }
2644 }
2645
2646 unsafe impl fidl::encoding::TypeMarker for MouseSourceWatchResponse {
2647 type Owned = Self;
2648
2649 #[inline(always)]
2650 fn inline_align(_context: fidl::encoding::Context) -> usize {
2651 8
2652 }
2653
2654 #[inline(always)]
2655 fn inline_size(_context: fidl::encoding::Context) -> usize {
2656 16
2657 }
2658 }
2659
2660 unsafe impl
2661 fidl::encoding::Encode<
2662 MouseSourceWatchResponse,
2663 fidl::encoding::DefaultFuchsiaResourceDialect,
2664 > for &mut MouseSourceWatchResponse
2665 {
2666 #[inline]
2667 unsafe fn encode(
2668 self,
2669 encoder: &mut fidl::encoding::Encoder<
2670 '_,
2671 fidl::encoding::DefaultFuchsiaResourceDialect,
2672 >,
2673 offset: usize,
2674 _depth: fidl::encoding::Depth,
2675 ) -> fidl::Result<()> {
2676 encoder.debug_check_bounds::<MouseSourceWatchResponse>(offset);
2677 fidl::encoding::Encode::<MouseSourceWatchResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2679 (
2680 <fidl::encoding::Vector<MouseEvent, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
2681 ),
2682 encoder, offset, _depth
2683 )
2684 }
2685 }
2686 unsafe impl<
2687 T0: fidl::encoding::Encode<
2688 fidl::encoding::Vector<MouseEvent, 128>,
2689 fidl::encoding::DefaultFuchsiaResourceDialect,
2690 >,
2691 >
2692 fidl::encoding::Encode<
2693 MouseSourceWatchResponse,
2694 fidl::encoding::DefaultFuchsiaResourceDialect,
2695 > for (T0,)
2696 {
2697 #[inline]
2698 unsafe fn encode(
2699 self,
2700 encoder: &mut fidl::encoding::Encoder<
2701 '_,
2702 fidl::encoding::DefaultFuchsiaResourceDialect,
2703 >,
2704 offset: usize,
2705 depth: fidl::encoding::Depth,
2706 ) -> fidl::Result<()> {
2707 encoder.debug_check_bounds::<MouseSourceWatchResponse>(offset);
2708 self.0.encode(encoder, offset + 0, depth)?;
2712 Ok(())
2713 }
2714 }
2715
2716 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2717 for MouseSourceWatchResponse
2718 {
2719 #[inline(always)]
2720 fn new_empty() -> Self {
2721 Self {
2722 events: fidl::new_empty!(fidl::encoding::Vector<MouseEvent, 128>, fidl::encoding::DefaultFuchsiaResourceDialect),
2723 }
2724 }
2725
2726 #[inline]
2727 unsafe fn decode(
2728 &mut self,
2729 decoder: &mut fidl::encoding::Decoder<
2730 '_,
2731 fidl::encoding::DefaultFuchsiaResourceDialect,
2732 >,
2733 offset: usize,
2734 _depth: fidl::encoding::Depth,
2735 ) -> fidl::Result<()> {
2736 decoder.debug_check_bounds::<Self>(offset);
2737 fidl::decode!(fidl::encoding::Vector<MouseEvent, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.events, decoder, offset + 0, _depth)?;
2739 Ok(())
2740 }
2741 }
2742
2743 impl fidl::encoding::ResourceTypeMarker for TouchSourceV2OnTouchEventsRequest {
2744 type Borrowed<'a> = &'a mut Self;
2745 fn take_or_borrow<'a>(
2746 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2747 ) -> Self::Borrowed<'a> {
2748 value
2749 }
2750 }
2751
2752 unsafe impl fidl::encoding::TypeMarker for TouchSourceV2OnTouchEventsRequest {
2753 type Owned = Self;
2754
2755 #[inline(always)]
2756 fn inline_align(_context: fidl::encoding::Context) -> usize {
2757 8
2758 }
2759
2760 #[inline(always)]
2761 fn inline_size(_context: fidl::encoding::Context) -> usize {
2762 24
2763 }
2764 }
2765
2766 unsafe impl
2767 fidl::encoding::Encode<
2768 TouchSourceV2OnTouchEventsRequest,
2769 fidl::encoding::DefaultFuchsiaResourceDialect,
2770 > for &mut TouchSourceV2OnTouchEventsRequest
2771 {
2772 #[inline]
2773 unsafe fn encode(
2774 self,
2775 encoder: &mut fidl::encoding::Encoder<
2776 '_,
2777 fidl::encoding::DefaultFuchsiaResourceDialect,
2778 >,
2779 offset: usize,
2780 _depth: fidl::encoding::Depth,
2781 ) -> fidl::Result<()> {
2782 encoder.debug_check_bounds::<TouchSourceV2OnTouchEventsRequest>(offset);
2783 fidl::encoding::Encode::<TouchSourceV2OnTouchEventsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2785 (
2786 <fidl::encoding::Vector<TouchEvent, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
2787 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.last_event_stamp),
2788 ),
2789 encoder, offset, _depth
2790 )
2791 }
2792 }
2793 unsafe impl<
2794 T0: fidl::encoding::Encode<
2795 fidl::encoding::Vector<TouchEvent, 128>,
2796 fidl::encoding::DefaultFuchsiaResourceDialect,
2797 >,
2798 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2799 >
2800 fidl::encoding::Encode<
2801 TouchSourceV2OnTouchEventsRequest,
2802 fidl::encoding::DefaultFuchsiaResourceDialect,
2803 > for (T0, T1)
2804 {
2805 #[inline]
2806 unsafe fn encode(
2807 self,
2808 encoder: &mut fidl::encoding::Encoder<
2809 '_,
2810 fidl::encoding::DefaultFuchsiaResourceDialect,
2811 >,
2812 offset: usize,
2813 depth: fidl::encoding::Depth,
2814 ) -> fidl::Result<()> {
2815 encoder.debug_check_bounds::<TouchSourceV2OnTouchEventsRequest>(offset);
2816 self.0.encode(encoder, offset + 0, depth)?;
2820 self.1.encode(encoder, offset + 16, depth)?;
2821 Ok(())
2822 }
2823 }
2824
2825 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2826 for TouchSourceV2OnTouchEventsRequest
2827 {
2828 #[inline(always)]
2829 fn new_empty() -> Self {
2830 Self {
2831 events: fidl::new_empty!(fidl::encoding::Vector<TouchEvent, 128>, fidl::encoding::DefaultFuchsiaResourceDialect),
2832 last_event_stamp: fidl::new_empty!(
2833 u64,
2834 fidl::encoding::DefaultFuchsiaResourceDialect
2835 ),
2836 }
2837 }
2838
2839 #[inline]
2840 unsafe fn decode(
2841 &mut self,
2842 decoder: &mut fidl::encoding::Decoder<
2843 '_,
2844 fidl::encoding::DefaultFuchsiaResourceDialect,
2845 >,
2846 offset: usize,
2847 _depth: fidl::encoding::Depth,
2848 ) -> fidl::Result<()> {
2849 decoder.debug_check_bounds::<Self>(offset);
2850 fidl::decode!(fidl::encoding::Vector<TouchEvent, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.events, decoder, offset + 0, _depth)?;
2852 fidl::decode!(
2853 u64,
2854 fidl::encoding::DefaultFuchsiaResourceDialect,
2855 &mut self.last_event_stamp,
2856 decoder,
2857 offset + 16,
2858 _depth
2859 )?;
2860 Ok(())
2861 }
2862 }
2863
2864 impl fidl::encoding::ResourceTypeMarker for TouchSourceWatchResponse {
2865 type Borrowed<'a> = &'a mut Self;
2866 fn take_or_borrow<'a>(
2867 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2868 ) -> Self::Borrowed<'a> {
2869 value
2870 }
2871 }
2872
2873 unsafe impl fidl::encoding::TypeMarker for TouchSourceWatchResponse {
2874 type Owned = Self;
2875
2876 #[inline(always)]
2877 fn inline_align(_context: fidl::encoding::Context) -> usize {
2878 8
2879 }
2880
2881 #[inline(always)]
2882 fn inline_size(_context: fidl::encoding::Context) -> usize {
2883 16
2884 }
2885 }
2886
2887 unsafe impl
2888 fidl::encoding::Encode<
2889 TouchSourceWatchResponse,
2890 fidl::encoding::DefaultFuchsiaResourceDialect,
2891 > for &mut TouchSourceWatchResponse
2892 {
2893 #[inline]
2894 unsafe fn encode(
2895 self,
2896 encoder: &mut fidl::encoding::Encoder<
2897 '_,
2898 fidl::encoding::DefaultFuchsiaResourceDialect,
2899 >,
2900 offset: usize,
2901 _depth: fidl::encoding::Depth,
2902 ) -> fidl::Result<()> {
2903 encoder.debug_check_bounds::<TouchSourceWatchResponse>(offset);
2904 fidl::encoding::Encode::<TouchSourceWatchResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2906 (
2907 <fidl::encoding::Vector<TouchEvent, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
2908 ),
2909 encoder, offset, _depth
2910 )
2911 }
2912 }
2913 unsafe impl<
2914 T0: fidl::encoding::Encode<
2915 fidl::encoding::Vector<TouchEvent, 128>,
2916 fidl::encoding::DefaultFuchsiaResourceDialect,
2917 >,
2918 >
2919 fidl::encoding::Encode<
2920 TouchSourceWatchResponse,
2921 fidl::encoding::DefaultFuchsiaResourceDialect,
2922 > for (T0,)
2923 {
2924 #[inline]
2925 unsafe fn encode(
2926 self,
2927 encoder: &mut fidl::encoding::Encoder<
2928 '_,
2929 fidl::encoding::DefaultFuchsiaResourceDialect,
2930 >,
2931 offset: usize,
2932 depth: fidl::encoding::Depth,
2933 ) -> fidl::Result<()> {
2934 encoder.debug_check_bounds::<TouchSourceWatchResponse>(offset);
2935 self.0.encode(encoder, offset + 0, depth)?;
2939 Ok(())
2940 }
2941 }
2942
2943 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2944 for TouchSourceWatchResponse
2945 {
2946 #[inline(always)]
2947 fn new_empty() -> Self {
2948 Self {
2949 events: fidl::new_empty!(fidl::encoding::Vector<TouchEvent, 128>, fidl::encoding::DefaultFuchsiaResourceDialect),
2950 }
2951 }
2952
2953 #[inline]
2954 unsafe fn decode(
2955 &mut self,
2956 decoder: &mut fidl::encoding::Decoder<
2957 '_,
2958 fidl::encoding::DefaultFuchsiaResourceDialect,
2959 >,
2960 offset: usize,
2961 _depth: fidl::encoding::Depth,
2962 ) -> fidl::Result<()> {
2963 decoder.debug_check_bounds::<Self>(offset);
2964 fidl::decode!(fidl::encoding::Vector<TouchEvent, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.events, decoder, offset + 0, _depth)?;
2966 Ok(())
2967 }
2968 }
2969
2970 impl MouseEvent {
2971 #[inline(always)]
2972 fn max_ordinal_present(&self) -> u64 {
2973 if let Some(_) = self.wake_lease {
2974 return 7;
2975 }
2976 if let Some(_) = self.trace_flow_id {
2977 return 6;
2978 }
2979 if let Some(_) = self.stream_info {
2980 return 5;
2981 }
2982 if let Some(_) = self.pointer_sample {
2983 return 4;
2984 }
2985 if let Some(_) = self.device_info {
2986 return 3;
2987 }
2988 if let Some(_) = self.view_parameters {
2989 return 2;
2990 }
2991 if let Some(_) = self.timestamp {
2992 return 1;
2993 }
2994 0
2995 }
2996 }
2997
2998 impl fidl::encoding::ResourceTypeMarker for MouseEvent {
2999 type Borrowed<'a> = &'a mut Self;
3000 fn take_or_borrow<'a>(
3001 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3002 ) -> Self::Borrowed<'a> {
3003 value
3004 }
3005 }
3006
3007 unsafe impl fidl::encoding::TypeMarker for MouseEvent {
3008 type Owned = Self;
3009
3010 #[inline(always)]
3011 fn inline_align(_context: fidl::encoding::Context) -> usize {
3012 8
3013 }
3014
3015 #[inline(always)]
3016 fn inline_size(_context: fidl::encoding::Context) -> usize {
3017 16
3018 }
3019 }
3020
3021 unsafe impl fidl::encoding::Encode<MouseEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
3022 for &mut MouseEvent
3023 {
3024 unsafe fn encode(
3025 self,
3026 encoder: &mut fidl::encoding::Encoder<
3027 '_,
3028 fidl::encoding::DefaultFuchsiaResourceDialect,
3029 >,
3030 offset: usize,
3031 mut depth: fidl::encoding::Depth,
3032 ) -> fidl::Result<()> {
3033 encoder.debug_check_bounds::<MouseEvent>(offset);
3034 let max_ordinal: u64 = self.max_ordinal_present();
3036 encoder.write_num(max_ordinal, offset);
3037 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3038 if max_ordinal == 0 {
3040 return Ok(());
3041 }
3042 depth.increment()?;
3043 let envelope_size = 8;
3044 let bytes_len = max_ordinal as usize * envelope_size;
3045 #[allow(unused_variables)]
3046 let offset = encoder.out_of_line_offset(bytes_len);
3047 let mut _prev_end_offset: usize = 0;
3048 if 1 > max_ordinal {
3049 return Ok(());
3050 }
3051
3052 let cur_offset: usize = (1 - 1) * envelope_size;
3055
3056 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3058
3059 fidl::encoding::encode_in_envelope_optional::<
3064 i64,
3065 fidl::encoding::DefaultFuchsiaResourceDialect,
3066 >(
3067 self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3068 encoder,
3069 offset + cur_offset,
3070 depth,
3071 )?;
3072
3073 _prev_end_offset = cur_offset + envelope_size;
3074 if 2 > max_ordinal {
3075 return Ok(());
3076 }
3077
3078 let cur_offset: usize = (2 - 1) * envelope_size;
3081
3082 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3084
3085 fidl::encoding::encode_in_envelope_optional::<
3090 ViewParameters,
3091 fidl::encoding::DefaultFuchsiaResourceDialect,
3092 >(
3093 self.view_parameters
3094 .as_ref()
3095 .map(<ViewParameters as fidl::encoding::ValueTypeMarker>::borrow),
3096 encoder,
3097 offset + cur_offset,
3098 depth,
3099 )?;
3100
3101 _prev_end_offset = cur_offset + envelope_size;
3102 if 3 > max_ordinal {
3103 return Ok(());
3104 }
3105
3106 let cur_offset: usize = (3 - 1) * envelope_size;
3109
3110 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3112
3113 fidl::encoding::encode_in_envelope_optional::<
3118 MouseDeviceInfo,
3119 fidl::encoding::DefaultFuchsiaResourceDialect,
3120 >(
3121 self.device_info
3122 .as_ref()
3123 .map(<MouseDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
3124 encoder,
3125 offset + cur_offset,
3126 depth,
3127 )?;
3128
3129 _prev_end_offset = cur_offset + envelope_size;
3130 if 4 > max_ordinal {
3131 return Ok(());
3132 }
3133
3134 let cur_offset: usize = (4 - 1) * envelope_size;
3137
3138 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3140
3141 fidl::encoding::encode_in_envelope_optional::<
3146 MousePointerSample,
3147 fidl::encoding::DefaultFuchsiaResourceDialect,
3148 >(
3149 self.pointer_sample
3150 .as_ref()
3151 .map(<MousePointerSample as fidl::encoding::ValueTypeMarker>::borrow),
3152 encoder,
3153 offset + cur_offset,
3154 depth,
3155 )?;
3156
3157 _prev_end_offset = cur_offset + envelope_size;
3158 if 5 > max_ordinal {
3159 return Ok(());
3160 }
3161
3162 let cur_offset: usize = (5 - 1) * envelope_size;
3165
3166 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3168
3169 fidl::encoding::encode_in_envelope_optional::<
3174 MouseEventStreamInfo,
3175 fidl::encoding::DefaultFuchsiaResourceDialect,
3176 >(
3177 self.stream_info
3178 .as_ref()
3179 .map(<MouseEventStreamInfo as fidl::encoding::ValueTypeMarker>::borrow),
3180 encoder,
3181 offset + cur_offset,
3182 depth,
3183 )?;
3184
3185 _prev_end_offset = cur_offset + envelope_size;
3186 if 6 > max_ordinal {
3187 return Ok(());
3188 }
3189
3190 let cur_offset: usize = (6 - 1) * envelope_size;
3193
3194 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3196
3197 fidl::encoding::encode_in_envelope_optional::<
3202 u64,
3203 fidl::encoding::DefaultFuchsiaResourceDialect,
3204 >(
3205 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3206 encoder,
3207 offset + cur_offset,
3208 depth,
3209 )?;
3210
3211 _prev_end_offset = cur_offset + envelope_size;
3212 if 7 > max_ordinal {
3213 return Ok(());
3214 }
3215
3216 let cur_offset: usize = (7 - 1) * envelope_size;
3219
3220 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3222
3223 fidl::encoding::encode_in_envelope_optional::<
3228 fidl::encoding::HandleType<
3229 fidl::EventPair,
3230 { fidl::ObjectType::EVENTPAIR.into_raw() },
3231 2147483648,
3232 >,
3233 fidl::encoding::DefaultFuchsiaResourceDialect,
3234 >(
3235 self.wake_lease.as_mut().map(
3236 <fidl::encoding::HandleType<
3237 fidl::EventPair,
3238 { fidl::ObjectType::EVENTPAIR.into_raw() },
3239 2147483648,
3240 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3241 ),
3242 encoder,
3243 offset + cur_offset,
3244 depth,
3245 )?;
3246
3247 _prev_end_offset = cur_offset + envelope_size;
3248
3249 Ok(())
3250 }
3251 }
3252
3253 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for MouseEvent {
3254 #[inline(always)]
3255 fn new_empty() -> Self {
3256 Self::default()
3257 }
3258
3259 unsafe fn decode(
3260 &mut self,
3261 decoder: &mut fidl::encoding::Decoder<
3262 '_,
3263 fidl::encoding::DefaultFuchsiaResourceDialect,
3264 >,
3265 offset: usize,
3266 mut depth: fidl::encoding::Depth,
3267 ) -> fidl::Result<()> {
3268 decoder.debug_check_bounds::<Self>(offset);
3269 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3270 None => return Err(fidl::Error::NotNullable),
3271 Some(len) => len,
3272 };
3273 if len == 0 {
3275 return Ok(());
3276 };
3277 depth.increment()?;
3278 let envelope_size = 8;
3279 let bytes_len = len * envelope_size;
3280 let offset = decoder.out_of_line_offset(bytes_len)?;
3281 let mut _next_ordinal_to_read = 0;
3283 let mut next_offset = offset;
3284 let end_offset = offset + bytes_len;
3285 _next_ordinal_to_read += 1;
3286 if next_offset >= end_offset {
3287 return Ok(());
3288 }
3289
3290 while _next_ordinal_to_read < 1 {
3292 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3293 _next_ordinal_to_read += 1;
3294 next_offset += envelope_size;
3295 }
3296
3297 let next_out_of_line = decoder.next_out_of_line();
3298 let handles_before = decoder.remaining_handles();
3299 if let Some((inlined, num_bytes, num_handles)) =
3300 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3301 {
3302 let member_inline_size =
3303 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3304 if inlined != (member_inline_size <= 4) {
3305 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3306 }
3307 let inner_offset;
3308 let mut inner_depth = depth.clone();
3309 if inlined {
3310 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3311 inner_offset = next_offset;
3312 } else {
3313 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3314 inner_depth.increment()?;
3315 }
3316 let val_ref = self.timestamp.get_or_insert_with(|| {
3317 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
3318 });
3319 fidl::decode!(
3320 i64,
3321 fidl::encoding::DefaultFuchsiaResourceDialect,
3322 val_ref,
3323 decoder,
3324 inner_offset,
3325 inner_depth
3326 )?;
3327 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3328 {
3329 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3330 }
3331 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3332 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3333 }
3334 }
3335
3336 next_offset += envelope_size;
3337 _next_ordinal_to_read += 1;
3338 if next_offset >= end_offset {
3339 return Ok(());
3340 }
3341
3342 while _next_ordinal_to_read < 2 {
3344 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3345 _next_ordinal_to_read += 1;
3346 next_offset += envelope_size;
3347 }
3348
3349 let next_out_of_line = decoder.next_out_of_line();
3350 let handles_before = decoder.remaining_handles();
3351 if let Some((inlined, num_bytes, num_handles)) =
3352 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3353 {
3354 let member_inline_size =
3355 <ViewParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3356 if inlined != (member_inline_size <= 4) {
3357 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3358 }
3359 let inner_offset;
3360 let mut inner_depth = depth.clone();
3361 if inlined {
3362 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3363 inner_offset = next_offset;
3364 } else {
3365 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3366 inner_depth.increment()?;
3367 }
3368 let val_ref = self.view_parameters.get_or_insert_with(|| {
3369 fidl::new_empty!(ViewParameters, fidl::encoding::DefaultFuchsiaResourceDialect)
3370 });
3371 fidl::decode!(
3372 ViewParameters,
3373 fidl::encoding::DefaultFuchsiaResourceDialect,
3374 val_ref,
3375 decoder,
3376 inner_offset,
3377 inner_depth
3378 )?;
3379 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3380 {
3381 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3382 }
3383 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3384 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3385 }
3386 }
3387
3388 next_offset += envelope_size;
3389 _next_ordinal_to_read += 1;
3390 if next_offset >= end_offset {
3391 return Ok(());
3392 }
3393
3394 while _next_ordinal_to_read < 3 {
3396 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3397 _next_ordinal_to_read += 1;
3398 next_offset += envelope_size;
3399 }
3400
3401 let next_out_of_line = decoder.next_out_of_line();
3402 let handles_before = decoder.remaining_handles();
3403 if let Some((inlined, num_bytes, num_handles)) =
3404 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3405 {
3406 let member_inline_size =
3407 <MouseDeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3408 if inlined != (member_inline_size <= 4) {
3409 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3410 }
3411 let inner_offset;
3412 let mut inner_depth = depth.clone();
3413 if inlined {
3414 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3415 inner_offset = next_offset;
3416 } else {
3417 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3418 inner_depth.increment()?;
3419 }
3420 let val_ref = self.device_info.get_or_insert_with(|| {
3421 fidl::new_empty!(MouseDeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect)
3422 });
3423 fidl::decode!(
3424 MouseDeviceInfo,
3425 fidl::encoding::DefaultFuchsiaResourceDialect,
3426 val_ref,
3427 decoder,
3428 inner_offset,
3429 inner_depth
3430 )?;
3431 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3432 {
3433 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3434 }
3435 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3436 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3437 }
3438 }
3439
3440 next_offset += envelope_size;
3441 _next_ordinal_to_read += 1;
3442 if next_offset >= end_offset {
3443 return Ok(());
3444 }
3445
3446 while _next_ordinal_to_read < 4 {
3448 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3449 _next_ordinal_to_read += 1;
3450 next_offset += envelope_size;
3451 }
3452
3453 let next_out_of_line = decoder.next_out_of_line();
3454 let handles_before = decoder.remaining_handles();
3455 if let Some((inlined, num_bytes, num_handles)) =
3456 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3457 {
3458 let member_inline_size =
3459 <MousePointerSample as fidl::encoding::TypeMarker>::inline_size(
3460 decoder.context,
3461 );
3462 if inlined != (member_inline_size <= 4) {
3463 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3464 }
3465 let inner_offset;
3466 let mut inner_depth = depth.clone();
3467 if inlined {
3468 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3469 inner_offset = next_offset;
3470 } else {
3471 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3472 inner_depth.increment()?;
3473 }
3474 let val_ref = self.pointer_sample.get_or_insert_with(|| {
3475 fidl::new_empty!(
3476 MousePointerSample,
3477 fidl::encoding::DefaultFuchsiaResourceDialect
3478 )
3479 });
3480 fidl::decode!(
3481 MousePointerSample,
3482 fidl::encoding::DefaultFuchsiaResourceDialect,
3483 val_ref,
3484 decoder,
3485 inner_offset,
3486 inner_depth
3487 )?;
3488 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3489 {
3490 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3491 }
3492 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3493 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3494 }
3495 }
3496
3497 next_offset += envelope_size;
3498 _next_ordinal_to_read += 1;
3499 if next_offset >= end_offset {
3500 return Ok(());
3501 }
3502
3503 while _next_ordinal_to_read < 5 {
3505 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3506 _next_ordinal_to_read += 1;
3507 next_offset += envelope_size;
3508 }
3509
3510 let next_out_of_line = decoder.next_out_of_line();
3511 let handles_before = decoder.remaining_handles();
3512 if let Some((inlined, num_bytes, num_handles)) =
3513 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3514 {
3515 let member_inline_size =
3516 <MouseEventStreamInfo as fidl::encoding::TypeMarker>::inline_size(
3517 decoder.context,
3518 );
3519 if inlined != (member_inline_size <= 4) {
3520 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3521 }
3522 let inner_offset;
3523 let mut inner_depth = depth.clone();
3524 if inlined {
3525 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3526 inner_offset = next_offset;
3527 } else {
3528 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3529 inner_depth.increment()?;
3530 }
3531 let val_ref = self.stream_info.get_or_insert_with(|| {
3532 fidl::new_empty!(
3533 MouseEventStreamInfo,
3534 fidl::encoding::DefaultFuchsiaResourceDialect
3535 )
3536 });
3537 fidl::decode!(
3538 MouseEventStreamInfo,
3539 fidl::encoding::DefaultFuchsiaResourceDialect,
3540 val_ref,
3541 decoder,
3542 inner_offset,
3543 inner_depth
3544 )?;
3545 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3546 {
3547 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3548 }
3549 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3550 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3551 }
3552 }
3553
3554 next_offset += envelope_size;
3555 _next_ordinal_to_read += 1;
3556 if next_offset >= end_offset {
3557 return Ok(());
3558 }
3559
3560 while _next_ordinal_to_read < 6 {
3562 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3563 _next_ordinal_to_read += 1;
3564 next_offset += envelope_size;
3565 }
3566
3567 let next_out_of_line = decoder.next_out_of_line();
3568 let handles_before = decoder.remaining_handles();
3569 if let Some((inlined, num_bytes, num_handles)) =
3570 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3571 {
3572 let member_inline_size =
3573 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3574 if inlined != (member_inline_size <= 4) {
3575 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3576 }
3577 let inner_offset;
3578 let mut inner_depth = depth.clone();
3579 if inlined {
3580 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3581 inner_offset = next_offset;
3582 } else {
3583 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3584 inner_depth.increment()?;
3585 }
3586 let val_ref = self.trace_flow_id.get_or_insert_with(|| {
3587 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3588 });
3589 fidl::decode!(
3590 u64,
3591 fidl::encoding::DefaultFuchsiaResourceDialect,
3592 val_ref,
3593 decoder,
3594 inner_offset,
3595 inner_depth
3596 )?;
3597 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3598 {
3599 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3600 }
3601 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3602 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3603 }
3604 }
3605
3606 next_offset += envelope_size;
3607 _next_ordinal_to_read += 1;
3608 if next_offset >= end_offset {
3609 return Ok(());
3610 }
3611
3612 while _next_ordinal_to_read < 7 {
3614 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3615 _next_ordinal_to_read += 1;
3616 next_offset += envelope_size;
3617 }
3618
3619 let next_out_of_line = decoder.next_out_of_line();
3620 let handles_before = decoder.remaining_handles();
3621 if let Some((inlined, num_bytes, num_handles)) =
3622 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3623 {
3624 let member_inline_size = <fidl::encoding::HandleType<
3625 fidl::EventPair,
3626 { fidl::ObjectType::EVENTPAIR.into_raw() },
3627 2147483648,
3628 > as fidl::encoding::TypeMarker>::inline_size(
3629 decoder.context
3630 );
3631 if inlined != (member_inline_size <= 4) {
3632 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3633 }
3634 let inner_offset;
3635 let mut inner_depth = depth.clone();
3636 if inlined {
3637 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3638 inner_offset = next_offset;
3639 } else {
3640 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3641 inner_depth.increment()?;
3642 }
3643 let val_ref =
3644 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3645 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3646 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3647 {
3648 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3649 }
3650 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3651 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3652 }
3653 }
3654
3655 next_offset += envelope_size;
3656
3657 while next_offset < end_offset {
3659 _next_ordinal_to_read += 1;
3660 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3661 next_offset += envelope_size;
3662 }
3663
3664 Ok(())
3665 }
3666 }
3667
3668 impl TouchEvent {
3669 #[inline(always)]
3670 fn max_ordinal_present(&self) -> u64 {
3671 if let Some(_) = self.wake_lease {
3672 return 7;
3673 }
3674 if let Some(_) = self.trace_flow_id {
3675 return 6;
3676 }
3677 if let Some(_) = self.interaction_result {
3678 return 5;
3679 }
3680 if let Some(_) = self.pointer_sample {
3681 return 4;
3682 }
3683 if let Some(_) = self.device_info {
3684 return 3;
3685 }
3686 if let Some(_) = self.view_parameters {
3687 return 2;
3688 }
3689 if let Some(_) = self.timestamp {
3690 return 1;
3691 }
3692 0
3693 }
3694 }
3695
3696 impl fidl::encoding::ResourceTypeMarker for TouchEvent {
3697 type Borrowed<'a> = &'a mut Self;
3698 fn take_or_borrow<'a>(
3699 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3700 ) -> Self::Borrowed<'a> {
3701 value
3702 }
3703 }
3704
3705 unsafe impl fidl::encoding::TypeMarker for TouchEvent {
3706 type Owned = Self;
3707
3708 #[inline(always)]
3709 fn inline_align(_context: fidl::encoding::Context) -> usize {
3710 8
3711 }
3712
3713 #[inline(always)]
3714 fn inline_size(_context: fidl::encoding::Context) -> usize {
3715 16
3716 }
3717 }
3718
3719 unsafe impl fidl::encoding::Encode<TouchEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
3720 for &mut TouchEvent
3721 {
3722 unsafe fn encode(
3723 self,
3724 encoder: &mut fidl::encoding::Encoder<
3725 '_,
3726 fidl::encoding::DefaultFuchsiaResourceDialect,
3727 >,
3728 offset: usize,
3729 mut depth: fidl::encoding::Depth,
3730 ) -> fidl::Result<()> {
3731 encoder.debug_check_bounds::<TouchEvent>(offset);
3732 let max_ordinal: u64 = self.max_ordinal_present();
3734 encoder.write_num(max_ordinal, offset);
3735 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3736 if max_ordinal == 0 {
3738 return Ok(());
3739 }
3740 depth.increment()?;
3741 let envelope_size = 8;
3742 let bytes_len = max_ordinal as usize * envelope_size;
3743 #[allow(unused_variables)]
3744 let offset = encoder.out_of_line_offset(bytes_len);
3745 let mut _prev_end_offset: usize = 0;
3746 if 1 > max_ordinal {
3747 return Ok(());
3748 }
3749
3750 let cur_offset: usize = (1 - 1) * envelope_size;
3753
3754 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3756
3757 fidl::encoding::encode_in_envelope_optional::<
3762 i64,
3763 fidl::encoding::DefaultFuchsiaResourceDialect,
3764 >(
3765 self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3766 encoder,
3767 offset + cur_offset,
3768 depth,
3769 )?;
3770
3771 _prev_end_offset = cur_offset + envelope_size;
3772 if 2 > max_ordinal {
3773 return Ok(());
3774 }
3775
3776 let cur_offset: usize = (2 - 1) * envelope_size;
3779
3780 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3782
3783 fidl::encoding::encode_in_envelope_optional::<
3788 ViewParameters,
3789 fidl::encoding::DefaultFuchsiaResourceDialect,
3790 >(
3791 self.view_parameters
3792 .as_ref()
3793 .map(<ViewParameters as fidl::encoding::ValueTypeMarker>::borrow),
3794 encoder,
3795 offset + cur_offset,
3796 depth,
3797 )?;
3798
3799 _prev_end_offset = cur_offset + envelope_size;
3800 if 3 > max_ordinal {
3801 return Ok(());
3802 }
3803
3804 let cur_offset: usize = (3 - 1) * envelope_size;
3807
3808 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3810
3811 fidl::encoding::encode_in_envelope_optional::<
3816 TouchDeviceInfo,
3817 fidl::encoding::DefaultFuchsiaResourceDialect,
3818 >(
3819 self.device_info
3820 .as_ref()
3821 .map(<TouchDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
3822 encoder,
3823 offset + cur_offset,
3824 depth,
3825 )?;
3826
3827 _prev_end_offset = cur_offset + envelope_size;
3828 if 4 > max_ordinal {
3829 return Ok(());
3830 }
3831
3832 let cur_offset: usize = (4 - 1) * envelope_size;
3835
3836 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3838
3839 fidl::encoding::encode_in_envelope_optional::<
3844 TouchPointerSample,
3845 fidl::encoding::DefaultFuchsiaResourceDialect,
3846 >(
3847 self.pointer_sample
3848 .as_ref()
3849 .map(<TouchPointerSample as fidl::encoding::ValueTypeMarker>::borrow),
3850 encoder,
3851 offset + cur_offset,
3852 depth,
3853 )?;
3854
3855 _prev_end_offset = cur_offset + envelope_size;
3856 if 5 > max_ordinal {
3857 return Ok(());
3858 }
3859
3860 let cur_offset: usize = (5 - 1) * envelope_size;
3863
3864 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3866
3867 fidl::encoding::encode_in_envelope_optional::<
3872 TouchInteractionResult,
3873 fidl::encoding::DefaultFuchsiaResourceDialect,
3874 >(
3875 self.interaction_result
3876 .as_ref()
3877 .map(<TouchInteractionResult as fidl::encoding::ValueTypeMarker>::borrow),
3878 encoder,
3879 offset + cur_offset,
3880 depth,
3881 )?;
3882
3883 _prev_end_offset = cur_offset + envelope_size;
3884 if 6 > max_ordinal {
3885 return Ok(());
3886 }
3887
3888 let cur_offset: usize = (6 - 1) * envelope_size;
3891
3892 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3894
3895 fidl::encoding::encode_in_envelope_optional::<
3900 u64,
3901 fidl::encoding::DefaultFuchsiaResourceDialect,
3902 >(
3903 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3904 encoder,
3905 offset + cur_offset,
3906 depth,
3907 )?;
3908
3909 _prev_end_offset = cur_offset + envelope_size;
3910 if 7 > max_ordinal {
3911 return Ok(());
3912 }
3913
3914 let cur_offset: usize = (7 - 1) * envelope_size;
3917
3918 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3920
3921 fidl::encoding::encode_in_envelope_optional::<
3926 fidl::encoding::HandleType<
3927 fidl::EventPair,
3928 { fidl::ObjectType::EVENTPAIR.into_raw() },
3929 2147483648,
3930 >,
3931 fidl::encoding::DefaultFuchsiaResourceDialect,
3932 >(
3933 self.wake_lease.as_mut().map(
3934 <fidl::encoding::HandleType<
3935 fidl::EventPair,
3936 { fidl::ObjectType::EVENTPAIR.into_raw() },
3937 2147483648,
3938 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3939 ),
3940 encoder,
3941 offset + cur_offset,
3942 depth,
3943 )?;
3944
3945 _prev_end_offset = cur_offset + envelope_size;
3946
3947 Ok(())
3948 }
3949 }
3950
3951 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for TouchEvent {
3952 #[inline(always)]
3953 fn new_empty() -> Self {
3954 Self::default()
3955 }
3956
3957 unsafe fn decode(
3958 &mut self,
3959 decoder: &mut fidl::encoding::Decoder<
3960 '_,
3961 fidl::encoding::DefaultFuchsiaResourceDialect,
3962 >,
3963 offset: usize,
3964 mut depth: fidl::encoding::Depth,
3965 ) -> fidl::Result<()> {
3966 decoder.debug_check_bounds::<Self>(offset);
3967 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3968 None => return Err(fidl::Error::NotNullable),
3969 Some(len) => len,
3970 };
3971 if len == 0 {
3973 return Ok(());
3974 };
3975 depth.increment()?;
3976 let envelope_size = 8;
3977 let bytes_len = len * envelope_size;
3978 let offset = decoder.out_of_line_offset(bytes_len)?;
3979 let mut _next_ordinal_to_read = 0;
3981 let mut next_offset = offset;
3982 let end_offset = offset + bytes_len;
3983 _next_ordinal_to_read += 1;
3984 if next_offset >= end_offset {
3985 return Ok(());
3986 }
3987
3988 while _next_ordinal_to_read < 1 {
3990 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3991 _next_ordinal_to_read += 1;
3992 next_offset += envelope_size;
3993 }
3994
3995 let next_out_of_line = decoder.next_out_of_line();
3996 let handles_before = decoder.remaining_handles();
3997 if let Some((inlined, num_bytes, num_handles)) =
3998 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3999 {
4000 let member_inline_size =
4001 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4002 if inlined != (member_inline_size <= 4) {
4003 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4004 }
4005 let inner_offset;
4006 let mut inner_depth = depth.clone();
4007 if inlined {
4008 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4009 inner_offset = next_offset;
4010 } else {
4011 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4012 inner_depth.increment()?;
4013 }
4014 let val_ref = self.timestamp.get_or_insert_with(|| {
4015 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
4016 });
4017 fidl::decode!(
4018 i64,
4019 fidl::encoding::DefaultFuchsiaResourceDialect,
4020 val_ref,
4021 decoder,
4022 inner_offset,
4023 inner_depth
4024 )?;
4025 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4026 {
4027 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4028 }
4029 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4030 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4031 }
4032 }
4033
4034 next_offset += envelope_size;
4035 _next_ordinal_to_read += 1;
4036 if next_offset >= end_offset {
4037 return Ok(());
4038 }
4039
4040 while _next_ordinal_to_read < 2 {
4042 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4043 _next_ordinal_to_read += 1;
4044 next_offset += envelope_size;
4045 }
4046
4047 let next_out_of_line = decoder.next_out_of_line();
4048 let handles_before = decoder.remaining_handles();
4049 if let Some((inlined, num_bytes, num_handles)) =
4050 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4051 {
4052 let member_inline_size =
4053 <ViewParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4054 if inlined != (member_inline_size <= 4) {
4055 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4056 }
4057 let inner_offset;
4058 let mut inner_depth = depth.clone();
4059 if inlined {
4060 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4061 inner_offset = next_offset;
4062 } else {
4063 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4064 inner_depth.increment()?;
4065 }
4066 let val_ref = self.view_parameters.get_or_insert_with(|| {
4067 fidl::new_empty!(ViewParameters, fidl::encoding::DefaultFuchsiaResourceDialect)
4068 });
4069 fidl::decode!(
4070 ViewParameters,
4071 fidl::encoding::DefaultFuchsiaResourceDialect,
4072 val_ref,
4073 decoder,
4074 inner_offset,
4075 inner_depth
4076 )?;
4077 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4078 {
4079 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4080 }
4081 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4082 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4083 }
4084 }
4085
4086 next_offset += envelope_size;
4087 _next_ordinal_to_read += 1;
4088 if next_offset >= end_offset {
4089 return Ok(());
4090 }
4091
4092 while _next_ordinal_to_read < 3 {
4094 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4095 _next_ordinal_to_read += 1;
4096 next_offset += envelope_size;
4097 }
4098
4099 let next_out_of_line = decoder.next_out_of_line();
4100 let handles_before = decoder.remaining_handles();
4101 if let Some((inlined, num_bytes, num_handles)) =
4102 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4103 {
4104 let member_inline_size =
4105 <TouchDeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4106 if inlined != (member_inline_size <= 4) {
4107 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4108 }
4109 let inner_offset;
4110 let mut inner_depth = depth.clone();
4111 if inlined {
4112 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4113 inner_offset = next_offset;
4114 } else {
4115 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4116 inner_depth.increment()?;
4117 }
4118 let val_ref = self.device_info.get_or_insert_with(|| {
4119 fidl::new_empty!(TouchDeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect)
4120 });
4121 fidl::decode!(
4122 TouchDeviceInfo,
4123 fidl::encoding::DefaultFuchsiaResourceDialect,
4124 val_ref,
4125 decoder,
4126 inner_offset,
4127 inner_depth
4128 )?;
4129 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4130 {
4131 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4132 }
4133 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4134 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4135 }
4136 }
4137
4138 next_offset += envelope_size;
4139 _next_ordinal_to_read += 1;
4140 if next_offset >= end_offset {
4141 return Ok(());
4142 }
4143
4144 while _next_ordinal_to_read < 4 {
4146 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4147 _next_ordinal_to_read += 1;
4148 next_offset += envelope_size;
4149 }
4150
4151 let next_out_of_line = decoder.next_out_of_line();
4152 let handles_before = decoder.remaining_handles();
4153 if let Some((inlined, num_bytes, num_handles)) =
4154 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4155 {
4156 let member_inline_size =
4157 <TouchPointerSample as fidl::encoding::TypeMarker>::inline_size(
4158 decoder.context,
4159 );
4160 if inlined != (member_inline_size <= 4) {
4161 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4162 }
4163 let inner_offset;
4164 let mut inner_depth = depth.clone();
4165 if inlined {
4166 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4167 inner_offset = next_offset;
4168 } else {
4169 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4170 inner_depth.increment()?;
4171 }
4172 let val_ref = self.pointer_sample.get_or_insert_with(|| {
4173 fidl::new_empty!(
4174 TouchPointerSample,
4175 fidl::encoding::DefaultFuchsiaResourceDialect
4176 )
4177 });
4178 fidl::decode!(
4179 TouchPointerSample,
4180 fidl::encoding::DefaultFuchsiaResourceDialect,
4181 val_ref,
4182 decoder,
4183 inner_offset,
4184 inner_depth
4185 )?;
4186 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4187 {
4188 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4189 }
4190 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4191 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4192 }
4193 }
4194
4195 next_offset += envelope_size;
4196 _next_ordinal_to_read += 1;
4197 if next_offset >= end_offset {
4198 return Ok(());
4199 }
4200
4201 while _next_ordinal_to_read < 5 {
4203 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4204 _next_ordinal_to_read += 1;
4205 next_offset += envelope_size;
4206 }
4207
4208 let next_out_of_line = decoder.next_out_of_line();
4209 let handles_before = decoder.remaining_handles();
4210 if let Some((inlined, num_bytes, num_handles)) =
4211 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4212 {
4213 let member_inline_size =
4214 <TouchInteractionResult as fidl::encoding::TypeMarker>::inline_size(
4215 decoder.context,
4216 );
4217 if inlined != (member_inline_size <= 4) {
4218 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4219 }
4220 let inner_offset;
4221 let mut inner_depth = depth.clone();
4222 if inlined {
4223 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4224 inner_offset = next_offset;
4225 } else {
4226 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4227 inner_depth.increment()?;
4228 }
4229 let val_ref = self.interaction_result.get_or_insert_with(|| {
4230 fidl::new_empty!(
4231 TouchInteractionResult,
4232 fidl::encoding::DefaultFuchsiaResourceDialect
4233 )
4234 });
4235 fidl::decode!(
4236 TouchInteractionResult,
4237 fidl::encoding::DefaultFuchsiaResourceDialect,
4238 val_ref,
4239 decoder,
4240 inner_offset,
4241 inner_depth
4242 )?;
4243 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4244 {
4245 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4246 }
4247 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4248 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4249 }
4250 }
4251
4252 next_offset += envelope_size;
4253 _next_ordinal_to_read += 1;
4254 if next_offset >= end_offset {
4255 return Ok(());
4256 }
4257
4258 while _next_ordinal_to_read < 6 {
4260 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4261 _next_ordinal_to_read += 1;
4262 next_offset += envelope_size;
4263 }
4264
4265 let next_out_of_line = decoder.next_out_of_line();
4266 let handles_before = decoder.remaining_handles();
4267 if let Some((inlined, num_bytes, num_handles)) =
4268 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4269 {
4270 let member_inline_size =
4271 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4272 if inlined != (member_inline_size <= 4) {
4273 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4274 }
4275 let inner_offset;
4276 let mut inner_depth = depth.clone();
4277 if inlined {
4278 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4279 inner_offset = next_offset;
4280 } else {
4281 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4282 inner_depth.increment()?;
4283 }
4284 let val_ref = self.trace_flow_id.get_or_insert_with(|| {
4285 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
4286 });
4287 fidl::decode!(
4288 u64,
4289 fidl::encoding::DefaultFuchsiaResourceDialect,
4290 val_ref,
4291 decoder,
4292 inner_offset,
4293 inner_depth
4294 )?;
4295 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4296 {
4297 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4298 }
4299 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4300 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4301 }
4302 }
4303
4304 next_offset += envelope_size;
4305 _next_ordinal_to_read += 1;
4306 if next_offset >= end_offset {
4307 return Ok(());
4308 }
4309
4310 while _next_ordinal_to_read < 7 {
4312 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4313 _next_ordinal_to_read += 1;
4314 next_offset += envelope_size;
4315 }
4316
4317 let next_out_of_line = decoder.next_out_of_line();
4318 let handles_before = decoder.remaining_handles();
4319 if let Some((inlined, num_bytes, num_handles)) =
4320 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4321 {
4322 let member_inline_size = <fidl::encoding::HandleType<
4323 fidl::EventPair,
4324 { fidl::ObjectType::EVENTPAIR.into_raw() },
4325 2147483648,
4326 > as fidl::encoding::TypeMarker>::inline_size(
4327 decoder.context
4328 );
4329 if inlined != (member_inline_size <= 4) {
4330 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4331 }
4332 let inner_offset;
4333 let mut inner_depth = depth.clone();
4334 if inlined {
4335 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4336 inner_offset = next_offset;
4337 } else {
4338 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4339 inner_depth.increment()?;
4340 }
4341 let val_ref =
4342 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4343 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4344 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4345 {
4346 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4347 }
4348 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4349 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4350 }
4351 }
4352
4353 next_offset += envelope_size;
4354
4355 while next_offset < end_offset {
4357 _next_ordinal_to_read += 1;
4358 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4359 next_offset += envelope_size;
4360 }
4361
4362 Ok(())
4363 }
4364 }
4365}