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_input__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ImeServiceGetInputMethodEditorRequest {
16 pub keyboard_type: KeyboardType,
17 pub action: InputMethodAction,
18 pub initial_state: TextInputState,
19 pub client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
20 pub editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
24 for ImeServiceGetInputMethodEditorRequest
25{
26}
27
28#[derive(Debug, Default, PartialEq)]
29pub struct MediaButtonsEvent {
30 pub volume: Option<i8>,
31 pub mic_mute: Option<bool>,
32 pub pause: Option<bool>,
33 pub camera_disable: Option<bool>,
34 pub power: Option<bool>,
35 pub function: Option<bool>,
36 pub device_id: Option<u32>,
37 pub wake_lease: Option<fidl::EventPair>,
39 pub trace_flow_id: Option<u64>,
41 #[doc(hidden)]
42 pub __source_breaking: fidl::marker::SourceBreaking,
43}
44
45impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MediaButtonsEvent {}
46
47#[derive(Debug, Default, PartialEq)]
48pub struct TouchButtonsEvent {
49 pub event_time: Option<fidl::MonotonicInstant>,
50 pub device_info: Option<TouchDeviceInfo>,
51 pub pressed_buttons: Option<Vec<TouchButton>>,
52 pub wake_lease: Option<fidl::EventPair>,
54 pub trace_flow_id: Option<u64>,
56 #[doc(hidden)]
57 pub __source_breaking: fidl::marker::SourceBreaking,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TouchButtonsEvent {}
61
62#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
63pub struct ImeServiceMarker;
64
65impl fidl::endpoints::ProtocolMarker for ImeServiceMarker {
66 type Proxy = ImeServiceProxy;
67 type RequestStream = ImeServiceRequestStream;
68 #[cfg(target_os = "fuchsia")]
69 type SynchronousProxy = ImeServiceSynchronousProxy;
70
71 const DEBUG_NAME: &'static str = "fuchsia.ui.input.ImeService";
72}
73impl fidl::endpoints::DiscoverableProtocolMarker for ImeServiceMarker {}
74
75pub trait ImeServiceProxyInterface: Send + Sync {
76 fn r#get_input_method_editor(
77 &self,
78 keyboard_type: KeyboardType,
79 action: InputMethodAction,
80 initial_state: &TextInputState,
81 client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
82 editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
83 ) -> Result<(), fidl::Error>;
84 fn r#show_keyboard(&self) -> Result<(), fidl::Error>;
85 fn r#hide_keyboard(&self) -> Result<(), fidl::Error>;
86}
87#[derive(Debug)]
88#[cfg(target_os = "fuchsia")]
89pub struct ImeServiceSynchronousProxy {
90 client: fidl::client::sync::Client,
91}
92
93#[cfg(target_os = "fuchsia")]
94impl fidl::endpoints::SynchronousProxy for ImeServiceSynchronousProxy {
95 type Proxy = ImeServiceProxy;
96 type Protocol = ImeServiceMarker;
97
98 fn from_channel(inner: fidl::Channel) -> Self {
99 Self::new(inner)
100 }
101
102 fn into_channel(self) -> fidl::Channel {
103 self.client.into_channel()
104 }
105
106 fn as_channel(&self) -> &fidl::Channel {
107 self.client.as_channel()
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl ImeServiceSynchronousProxy {
113 pub fn new(channel: fidl::Channel) -> Self {
114 Self { client: fidl::client::sync::Client::new(channel) }
115 }
116
117 pub fn into_channel(self) -> fidl::Channel {
118 self.client.into_channel()
119 }
120
121 pub fn wait_for_event(
124 &self,
125 deadline: zx::MonotonicInstant,
126 ) -> Result<ImeServiceEvent, fidl::Error> {
127 ImeServiceEvent::decode(self.client.wait_for_event::<ImeServiceMarker>(deadline)?)
128 }
129
130 pub fn r#get_input_method_editor(
131 &self,
132 mut keyboard_type: KeyboardType,
133 mut action: InputMethodAction,
134 mut initial_state: &TextInputState,
135 mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
136 mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
137 ) -> Result<(), fidl::Error> {
138 self.client.send::<ImeServiceGetInputMethodEditorRequest>(
139 (keyboard_type, action, initial_state, client, editor),
140 0x148d2e42a1f461fc,
141 fidl::encoding::DynamicFlags::empty(),
142 )
143 }
144
145 pub fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
146 self.client.send::<fidl::encoding::EmptyPayload>(
147 (),
148 0x38ed2a1de28cfcf0,
149 fidl::encoding::DynamicFlags::empty(),
150 )
151 }
152
153 pub fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
154 self.client.send::<fidl::encoding::EmptyPayload>(
155 (),
156 0x7667f098198d09fd,
157 fidl::encoding::DynamicFlags::empty(),
158 )
159 }
160}
161
162#[cfg(target_os = "fuchsia")]
163impl From<ImeServiceSynchronousProxy> for zx::NullableHandle {
164 fn from(value: ImeServiceSynchronousProxy) -> Self {
165 value.into_channel().into()
166 }
167}
168
169#[cfg(target_os = "fuchsia")]
170impl From<fidl::Channel> for ImeServiceSynchronousProxy {
171 fn from(value: fidl::Channel) -> Self {
172 Self::new(value)
173 }
174}
175
176#[cfg(target_os = "fuchsia")]
177impl fidl::endpoints::FromClient for ImeServiceSynchronousProxy {
178 type Protocol = ImeServiceMarker;
179
180 fn from_client(value: fidl::endpoints::ClientEnd<ImeServiceMarker>) -> Self {
181 Self::new(value.into_channel())
182 }
183}
184
185#[derive(Debug, Clone)]
186pub struct ImeServiceProxy {
187 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
188}
189
190impl fidl::endpoints::Proxy for ImeServiceProxy {
191 type Protocol = ImeServiceMarker;
192
193 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
194 Self::new(inner)
195 }
196
197 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
198 self.client.into_channel().map_err(|client| Self { client })
199 }
200
201 fn as_channel(&self) -> &::fidl::AsyncChannel {
202 self.client.as_channel()
203 }
204}
205
206impl ImeServiceProxy {
207 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
209 let protocol_name = <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
210 Self { client: fidl::client::Client::new(channel, protocol_name) }
211 }
212
213 pub fn take_event_stream(&self) -> ImeServiceEventStream {
219 ImeServiceEventStream { event_receiver: self.client.take_event_receiver() }
220 }
221
222 pub fn r#get_input_method_editor(
223 &self,
224 mut keyboard_type: KeyboardType,
225 mut action: InputMethodAction,
226 mut initial_state: &TextInputState,
227 mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
228 mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
229 ) -> Result<(), fidl::Error> {
230 ImeServiceProxyInterface::r#get_input_method_editor(
231 self,
232 keyboard_type,
233 action,
234 initial_state,
235 client,
236 editor,
237 )
238 }
239
240 pub fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
241 ImeServiceProxyInterface::r#show_keyboard(self)
242 }
243
244 pub fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
245 ImeServiceProxyInterface::r#hide_keyboard(self)
246 }
247}
248
249impl ImeServiceProxyInterface for ImeServiceProxy {
250 fn r#get_input_method_editor(
251 &self,
252 mut keyboard_type: KeyboardType,
253 mut action: InputMethodAction,
254 mut initial_state: &TextInputState,
255 mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
256 mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
257 ) -> Result<(), fidl::Error> {
258 self.client.send::<ImeServiceGetInputMethodEditorRequest>(
259 (keyboard_type, action, initial_state, client, editor),
260 0x148d2e42a1f461fc,
261 fidl::encoding::DynamicFlags::empty(),
262 )
263 }
264
265 fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
266 self.client.send::<fidl::encoding::EmptyPayload>(
267 (),
268 0x38ed2a1de28cfcf0,
269 fidl::encoding::DynamicFlags::empty(),
270 )
271 }
272
273 fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
274 self.client.send::<fidl::encoding::EmptyPayload>(
275 (),
276 0x7667f098198d09fd,
277 fidl::encoding::DynamicFlags::empty(),
278 )
279 }
280}
281
282pub struct ImeServiceEventStream {
283 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
284}
285
286impl std::marker::Unpin for ImeServiceEventStream {}
287
288impl futures::stream::FusedStream for ImeServiceEventStream {
289 fn is_terminated(&self) -> bool {
290 self.event_receiver.is_terminated()
291 }
292}
293
294impl futures::Stream for ImeServiceEventStream {
295 type Item = Result<ImeServiceEvent, fidl::Error>;
296
297 fn poll_next(
298 mut self: std::pin::Pin<&mut Self>,
299 cx: &mut std::task::Context<'_>,
300 ) -> std::task::Poll<Option<Self::Item>> {
301 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
302 &mut self.event_receiver,
303 cx
304 )?) {
305 Some(buf) => std::task::Poll::Ready(Some(ImeServiceEvent::decode(buf))),
306 None => std::task::Poll::Ready(None),
307 }
308 }
309}
310
311#[derive(Debug)]
312pub enum ImeServiceEvent {}
313
314impl ImeServiceEvent {
315 fn decode(
317 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
318 ) -> Result<ImeServiceEvent, fidl::Error> {
319 let (bytes, _handles) = buf.split_mut();
320 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
321 debug_assert_eq!(tx_header.tx_id, 0);
322 match tx_header.ordinal {
323 _ => Err(fidl::Error::UnknownOrdinal {
324 ordinal: tx_header.ordinal,
325 protocol_name: <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
326 }),
327 }
328 }
329}
330
331pub struct ImeServiceRequestStream {
333 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
334 is_terminated: bool,
335}
336
337impl std::marker::Unpin for ImeServiceRequestStream {}
338
339impl futures::stream::FusedStream for ImeServiceRequestStream {
340 fn is_terminated(&self) -> bool {
341 self.is_terminated
342 }
343}
344
345impl fidl::endpoints::RequestStream for ImeServiceRequestStream {
346 type Protocol = ImeServiceMarker;
347 type ControlHandle = ImeServiceControlHandle;
348
349 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
350 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
351 }
352
353 fn control_handle(&self) -> Self::ControlHandle {
354 ImeServiceControlHandle { inner: self.inner.clone() }
355 }
356
357 fn into_inner(
358 self,
359 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
360 {
361 (self.inner, self.is_terminated)
362 }
363
364 fn from_inner(
365 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
366 is_terminated: bool,
367 ) -> Self {
368 Self { inner, is_terminated }
369 }
370}
371
372impl futures::Stream for ImeServiceRequestStream {
373 type Item = Result<ImeServiceRequest, fidl::Error>;
374
375 fn poll_next(
376 mut self: std::pin::Pin<&mut Self>,
377 cx: &mut std::task::Context<'_>,
378 ) -> std::task::Poll<Option<Self::Item>> {
379 let this = &mut *self;
380 if this.inner.check_shutdown(cx) {
381 this.is_terminated = true;
382 return std::task::Poll::Ready(None);
383 }
384 if this.is_terminated {
385 panic!("polled ImeServiceRequestStream after completion");
386 }
387 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
388 |bytes, handles| {
389 match this.inner.channel().read_etc(cx, bytes, handles) {
390 std::task::Poll::Ready(Ok(())) => {}
391 std::task::Poll::Pending => return std::task::Poll::Pending,
392 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
393 this.is_terminated = true;
394 return std::task::Poll::Ready(None);
395 }
396 std::task::Poll::Ready(Err(e)) => {
397 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
398 e.into(),
399 ))));
400 }
401 }
402
403 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
405
406 std::task::Poll::Ready(Some(match header.ordinal {
407 0x148d2e42a1f461fc => {
408 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
409 let mut req = fidl::new_empty!(
410 ImeServiceGetInputMethodEditorRequest,
411 fidl::encoding::DefaultFuchsiaResourceDialect
412 );
413 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImeServiceGetInputMethodEditorRequest>(&header, _body_bytes, handles, &mut req)?;
414 let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
415 Ok(ImeServiceRequest::GetInputMethodEditor {
416 keyboard_type: req.keyboard_type,
417 action: req.action,
418 initial_state: req.initial_state,
419 client: req.client,
420 editor: req.editor,
421
422 control_handle,
423 })
424 }
425 0x38ed2a1de28cfcf0 => {
426 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
427 let mut req = fidl::new_empty!(
428 fidl::encoding::EmptyPayload,
429 fidl::encoding::DefaultFuchsiaResourceDialect
430 );
431 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
432 let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
433 Ok(ImeServiceRequest::ShowKeyboard { control_handle })
434 }
435 0x7667f098198d09fd => {
436 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
437 let mut req = fidl::new_empty!(
438 fidl::encoding::EmptyPayload,
439 fidl::encoding::DefaultFuchsiaResourceDialect
440 );
441 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
442 let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
443 Ok(ImeServiceRequest::HideKeyboard { control_handle })
444 }
445 _ => Err(fidl::Error::UnknownOrdinal {
446 ordinal: header.ordinal,
447 protocol_name:
448 <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
449 }),
450 }))
451 },
452 )
453 }
454}
455
456#[derive(Debug)]
458pub enum ImeServiceRequest {
459 GetInputMethodEditor {
460 keyboard_type: KeyboardType,
461 action: InputMethodAction,
462 initial_state: TextInputState,
463 client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
464 editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
465 control_handle: ImeServiceControlHandle,
466 },
467 ShowKeyboard {
468 control_handle: ImeServiceControlHandle,
469 },
470 HideKeyboard {
471 control_handle: ImeServiceControlHandle,
472 },
473}
474
475impl ImeServiceRequest {
476 #[allow(irrefutable_let_patterns)]
477 pub fn into_get_input_method_editor(
478 self,
479 ) -> Option<(
480 KeyboardType,
481 InputMethodAction,
482 TextInputState,
483 fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
484 fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
485 ImeServiceControlHandle,
486 )> {
487 if let ImeServiceRequest::GetInputMethodEditor {
488 keyboard_type,
489 action,
490 initial_state,
491 client,
492 editor,
493 control_handle,
494 } = self
495 {
496 Some((keyboard_type, action, initial_state, client, editor, control_handle))
497 } else {
498 None
499 }
500 }
501
502 #[allow(irrefutable_let_patterns)]
503 pub fn into_show_keyboard(self) -> Option<(ImeServiceControlHandle)> {
504 if let ImeServiceRequest::ShowKeyboard { control_handle } = self {
505 Some((control_handle))
506 } else {
507 None
508 }
509 }
510
511 #[allow(irrefutable_let_patterns)]
512 pub fn into_hide_keyboard(self) -> Option<(ImeServiceControlHandle)> {
513 if let ImeServiceRequest::HideKeyboard { control_handle } = self {
514 Some((control_handle))
515 } else {
516 None
517 }
518 }
519
520 pub fn method_name(&self) -> &'static str {
522 match *self {
523 ImeServiceRequest::GetInputMethodEditor { .. } => "get_input_method_editor",
524 ImeServiceRequest::ShowKeyboard { .. } => "show_keyboard",
525 ImeServiceRequest::HideKeyboard { .. } => "hide_keyboard",
526 }
527 }
528}
529
530#[derive(Debug, Clone)]
531pub struct ImeServiceControlHandle {
532 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
533}
534
535impl fidl::endpoints::ControlHandle for ImeServiceControlHandle {
536 fn shutdown(&self) {
537 self.inner.shutdown()
538 }
539
540 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
541 self.inner.shutdown_with_epitaph(status)
542 }
543
544 fn is_closed(&self) -> bool {
545 self.inner.channel().is_closed()
546 }
547 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
548 self.inner.channel().on_closed()
549 }
550
551 #[cfg(target_os = "fuchsia")]
552 fn signal_peer(
553 &self,
554 clear_mask: zx::Signals,
555 set_mask: zx::Signals,
556 ) -> Result<(), zx_status::Status> {
557 use fidl::Peered;
558 self.inner.channel().signal_peer(clear_mask, set_mask)
559 }
560}
561
562impl ImeServiceControlHandle {}
563
564#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
565pub struct InputDeviceMarker;
566
567impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
568 type Proxy = InputDeviceProxy;
569 type RequestStream = InputDeviceRequestStream;
570 #[cfg(target_os = "fuchsia")]
571 type SynchronousProxy = InputDeviceSynchronousProxy;
572
573 const DEBUG_NAME: &'static str = "(anonymous) InputDevice";
574}
575
576pub trait InputDeviceProxyInterface: Send + Sync {
577 fn r#dispatch_report(&self, report: &InputReport) -> Result<(), fidl::Error>;
578}
579#[derive(Debug)]
580#[cfg(target_os = "fuchsia")]
581pub struct InputDeviceSynchronousProxy {
582 client: fidl::client::sync::Client,
583}
584
585#[cfg(target_os = "fuchsia")]
586impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
587 type Proxy = InputDeviceProxy;
588 type Protocol = InputDeviceMarker;
589
590 fn from_channel(inner: fidl::Channel) -> Self {
591 Self::new(inner)
592 }
593
594 fn into_channel(self) -> fidl::Channel {
595 self.client.into_channel()
596 }
597
598 fn as_channel(&self) -> &fidl::Channel {
599 self.client.as_channel()
600 }
601}
602
603#[cfg(target_os = "fuchsia")]
604impl InputDeviceSynchronousProxy {
605 pub fn new(channel: fidl::Channel) -> Self {
606 Self { client: fidl::client::sync::Client::new(channel) }
607 }
608
609 pub fn into_channel(self) -> fidl::Channel {
610 self.client.into_channel()
611 }
612
613 pub fn wait_for_event(
616 &self,
617 deadline: zx::MonotonicInstant,
618 ) -> Result<InputDeviceEvent, fidl::Error> {
619 InputDeviceEvent::decode(self.client.wait_for_event::<InputDeviceMarker>(deadline)?)
620 }
621
622 pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
624 self.client.send::<InputDeviceDispatchReportRequest>(
625 (report,),
626 0x7ee375d01c8e149f,
627 fidl::encoding::DynamicFlags::empty(),
628 )
629 }
630}
631
632#[cfg(target_os = "fuchsia")]
633impl From<InputDeviceSynchronousProxy> for zx::NullableHandle {
634 fn from(value: InputDeviceSynchronousProxy) -> Self {
635 value.into_channel().into()
636 }
637}
638
639#[cfg(target_os = "fuchsia")]
640impl From<fidl::Channel> for InputDeviceSynchronousProxy {
641 fn from(value: fidl::Channel) -> Self {
642 Self::new(value)
643 }
644}
645
646#[cfg(target_os = "fuchsia")]
647impl fidl::endpoints::FromClient for InputDeviceSynchronousProxy {
648 type Protocol = InputDeviceMarker;
649
650 fn from_client(value: fidl::endpoints::ClientEnd<InputDeviceMarker>) -> Self {
651 Self::new(value.into_channel())
652 }
653}
654
655#[derive(Debug, Clone)]
656pub struct InputDeviceProxy {
657 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
658}
659
660impl fidl::endpoints::Proxy for InputDeviceProxy {
661 type Protocol = InputDeviceMarker;
662
663 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
664 Self::new(inner)
665 }
666
667 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
668 self.client.into_channel().map_err(|client| Self { client })
669 }
670
671 fn as_channel(&self) -> &::fidl::AsyncChannel {
672 self.client.as_channel()
673 }
674}
675
676impl InputDeviceProxy {
677 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
679 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
680 Self { client: fidl::client::Client::new(channel, protocol_name) }
681 }
682
683 pub fn take_event_stream(&self) -> InputDeviceEventStream {
689 InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
690 }
691
692 pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
694 InputDeviceProxyInterface::r#dispatch_report(self, report)
695 }
696}
697
698impl InputDeviceProxyInterface for InputDeviceProxy {
699 fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
700 self.client.send::<InputDeviceDispatchReportRequest>(
701 (report,),
702 0x7ee375d01c8e149f,
703 fidl::encoding::DynamicFlags::empty(),
704 )
705 }
706}
707
708pub struct InputDeviceEventStream {
709 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
710}
711
712impl std::marker::Unpin for InputDeviceEventStream {}
713
714impl futures::stream::FusedStream for InputDeviceEventStream {
715 fn is_terminated(&self) -> bool {
716 self.event_receiver.is_terminated()
717 }
718}
719
720impl futures::Stream for InputDeviceEventStream {
721 type Item = Result<InputDeviceEvent, fidl::Error>;
722
723 fn poll_next(
724 mut self: std::pin::Pin<&mut Self>,
725 cx: &mut std::task::Context<'_>,
726 ) -> std::task::Poll<Option<Self::Item>> {
727 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
728 &mut self.event_receiver,
729 cx
730 )?) {
731 Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
732 None => std::task::Poll::Ready(None),
733 }
734 }
735}
736
737#[derive(Debug)]
738pub enum InputDeviceEvent {}
739
740impl InputDeviceEvent {
741 fn decode(
743 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
744 ) -> Result<InputDeviceEvent, fidl::Error> {
745 let (bytes, _handles) = buf.split_mut();
746 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
747 debug_assert_eq!(tx_header.tx_id, 0);
748 match tx_header.ordinal {
749 _ => Err(fidl::Error::UnknownOrdinal {
750 ordinal: tx_header.ordinal,
751 protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
752 }),
753 }
754 }
755}
756
757pub struct InputDeviceRequestStream {
759 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
760 is_terminated: bool,
761}
762
763impl std::marker::Unpin for InputDeviceRequestStream {}
764
765impl futures::stream::FusedStream for InputDeviceRequestStream {
766 fn is_terminated(&self) -> bool {
767 self.is_terminated
768 }
769}
770
771impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
772 type Protocol = InputDeviceMarker;
773 type ControlHandle = InputDeviceControlHandle;
774
775 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
776 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
777 }
778
779 fn control_handle(&self) -> Self::ControlHandle {
780 InputDeviceControlHandle { inner: self.inner.clone() }
781 }
782
783 fn into_inner(
784 self,
785 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
786 {
787 (self.inner, self.is_terminated)
788 }
789
790 fn from_inner(
791 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
792 is_terminated: bool,
793 ) -> Self {
794 Self { inner, is_terminated }
795 }
796}
797
798impl futures::Stream for InputDeviceRequestStream {
799 type Item = Result<InputDeviceRequest, fidl::Error>;
800
801 fn poll_next(
802 mut self: std::pin::Pin<&mut Self>,
803 cx: &mut std::task::Context<'_>,
804 ) -> std::task::Poll<Option<Self::Item>> {
805 let this = &mut *self;
806 if this.inner.check_shutdown(cx) {
807 this.is_terminated = true;
808 return std::task::Poll::Ready(None);
809 }
810 if this.is_terminated {
811 panic!("polled InputDeviceRequestStream after completion");
812 }
813 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
814 |bytes, handles| {
815 match this.inner.channel().read_etc(cx, bytes, handles) {
816 std::task::Poll::Ready(Ok(())) => {}
817 std::task::Poll::Pending => return std::task::Poll::Pending,
818 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
819 this.is_terminated = true;
820 return std::task::Poll::Ready(None);
821 }
822 std::task::Poll::Ready(Err(e)) => {
823 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
824 e.into(),
825 ))));
826 }
827 }
828
829 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
831
832 std::task::Poll::Ready(Some(match header.ordinal {
833 0x7ee375d01c8e149f => {
834 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
835 let mut req = fidl::new_empty!(
836 InputDeviceDispatchReportRequest,
837 fidl::encoding::DefaultFuchsiaResourceDialect
838 );
839 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceDispatchReportRequest>(&header, _body_bytes, handles, &mut req)?;
840 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
841 Ok(InputDeviceRequest::DispatchReport {
842 report: req.report,
843
844 control_handle,
845 })
846 }
847 _ => Err(fidl::Error::UnknownOrdinal {
848 ordinal: header.ordinal,
849 protocol_name:
850 <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
851 }),
852 }))
853 },
854 )
855 }
856}
857
858#[derive(Debug)]
859pub enum InputDeviceRequest {
860 DispatchReport { report: InputReport, control_handle: InputDeviceControlHandle },
862}
863
864impl InputDeviceRequest {
865 #[allow(irrefutable_let_patterns)]
866 pub fn into_dispatch_report(self) -> Option<(InputReport, InputDeviceControlHandle)> {
867 if let InputDeviceRequest::DispatchReport { report, control_handle } = self {
868 Some((report, control_handle))
869 } else {
870 None
871 }
872 }
873
874 pub fn method_name(&self) -> &'static str {
876 match *self {
877 InputDeviceRequest::DispatchReport { .. } => "dispatch_report",
878 }
879 }
880}
881
882#[derive(Debug, Clone)]
883pub struct InputDeviceControlHandle {
884 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
885}
886
887impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
888 fn shutdown(&self) {
889 self.inner.shutdown()
890 }
891
892 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
893 self.inner.shutdown_with_epitaph(status)
894 }
895
896 fn is_closed(&self) -> bool {
897 self.inner.channel().is_closed()
898 }
899 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
900 self.inner.channel().on_closed()
901 }
902
903 #[cfg(target_os = "fuchsia")]
904 fn signal_peer(
905 &self,
906 clear_mask: zx::Signals,
907 set_mask: zx::Signals,
908 ) -> Result<(), zx_status::Status> {
909 use fidl::Peered;
910 self.inner.channel().signal_peer(clear_mask, set_mask)
911 }
912}
913
914impl InputDeviceControlHandle {}
915
916#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
917pub struct InputMethodEditorMarker;
918
919impl fidl::endpoints::ProtocolMarker for InputMethodEditorMarker {
920 type Proxy = InputMethodEditorProxy;
921 type RequestStream = InputMethodEditorRequestStream;
922 #[cfg(target_os = "fuchsia")]
923 type SynchronousProxy = InputMethodEditorSynchronousProxy;
924
925 const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditor";
926}
927
928pub trait InputMethodEditorProxyInterface: Send + Sync {
929 fn r#set_keyboard_type(&self, keyboard_type: KeyboardType) -> Result<(), fidl::Error>;
930 fn r#set_state(&self, state: &TextInputState) -> Result<(), fidl::Error>;
931 fn r#inject_input(&self, event: &InputEvent) -> Result<(), fidl::Error>;
932 type DispatchKey3ResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
933 fn r#dispatch_key3(
934 &self,
935 event: &fidl_fuchsia_ui_input3::KeyEvent,
936 ) -> Self::DispatchKey3ResponseFut;
937 fn r#show(&self) -> Result<(), fidl::Error>;
938 fn r#hide(&self) -> Result<(), fidl::Error>;
939}
940#[derive(Debug)]
941#[cfg(target_os = "fuchsia")]
942pub struct InputMethodEditorSynchronousProxy {
943 client: fidl::client::sync::Client,
944}
945
946#[cfg(target_os = "fuchsia")]
947impl fidl::endpoints::SynchronousProxy for InputMethodEditorSynchronousProxy {
948 type Proxy = InputMethodEditorProxy;
949 type Protocol = InputMethodEditorMarker;
950
951 fn from_channel(inner: fidl::Channel) -> Self {
952 Self::new(inner)
953 }
954
955 fn into_channel(self) -> fidl::Channel {
956 self.client.into_channel()
957 }
958
959 fn as_channel(&self) -> &fidl::Channel {
960 self.client.as_channel()
961 }
962}
963
964#[cfg(target_os = "fuchsia")]
965impl InputMethodEditorSynchronousProxy {
966 pub fn new(channel: fidl::Channel) -> Self {
967 Self { client: fidl::client::sync::Client::new(channel) }
968 }
969
970 pub fn into_channel(self) -> fidl::Channel {
971 self.client.into_channel()
972 }
973
974 pub fn wait_for_event(
977 &self,
978 deadline: zx::MonotonicInstant,
979 ) -> Result<InputMethodEditorEvent, fidl::Error> {
980 InputMethodEditorEvent::decode(
981 self.client.wait_for_event::<InputMethodEditorMarker>(deadline)?,
982 )
983 }
984
985 pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
986 self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
987 (keyboard_type,),
988 0x14fe60e927d7d487,
989 fidl::encoding::DynamicFlags::empty(),
990 )
991 }
992
993 pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
994 self.client.send::<InputMethodEditorSetStateRequest>(
995 (state,),
996 0x12b477b779818f45,
997 fidl::encoding::DynamicFlags::empty(),
998 )
999 }
1000
1001 pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
1002 self.client.send::<InputMethodEditorInjectInputRequest>(
1003 (event,),
1004 0x34af74618a4f82b,
1005 fidl::encoding::DynamicFlags::empty(),
1006 )
1007 }
1008
1009 pub fn r#dispatch_key3(
1010 &self,
1011 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
1012 ___deadline: zx::MonotonicInstant,
1013 ) -> Result<bool, fidl::Error> {
1014 let _response = self.client.send_query::<
1015 InputMethodEditorDispatchKey3Request,
1016 InputMethodEditorDispatchKey3Response,
1017 InputMethodEditorMarker,
1018 >(
1019 (event,),
1020 0x2e13667c827209ac,
1021 fidl::encoding::DynamicFlags::empty(),
1022 ___deadline,
1023 )?;
1024 Ok(_response.handled)
1025 }
1026
1027 pub fn r#show(&self) -> Result<(), fidl::Error> {
1028 self.client.send::<fidl::encoding::EmptyPayload>(
1029 (),
1030 0x19ba00ba1beb002e,
1031 fidl::encoding::DynamicFlags::empty(),
1032 )
1033 }
1034
1035 pub fn r#hide(&self) -> Result<(), fidl::Error> {
1036 self.client.send::<fidl::encoding::EmptyPayload>(
1037 (),
1038 0x283e0cd73f0d6d9e,
1039 fidl::encoding::DynamicFlags::empty(),
1040 )
1041 }
1042}
1043
1044#[cfg(target_os = "fuchsia")]
1045impl From<InputMethodEditorSynchronousProxy> for zx::NullableHandle {
1046 fn from(value: InputMethodEditorSynchronousProxy) -> Self {
1047 value.into_channel().into()
1048 }
1049}
1050
1051#[cfg(target_os = "fuchsia")]
1052impl From<fidl::Channel> for InputMethodEditorSynchronousProxy {
1053 fn from(value: fidl::Channel) -> Self {
1054 Self::new(value)
1055 }
1056}
1057
1058#[cfg(target_os = "fuchsia")]
1059impl fidl::endpoints::FromClient for InputMethodEditorSynchronousProxy {
1060 type Protocol = InputMethodEditorMarker;
1061
1062 fn from_client(value: fidl::endpoints::ClientEnd<InputMethodEditorMarker>) -> Self {
1063 Self::new(value.into_channel())
1064 }
1065}
1066
1067#[derive(Debug, Clone)]
1068pub struct InputMethodEditorProxy {
1069 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1070}
1071
1072impl fidl::endpoints::Proxy for InputMethodEditorProxy {
1073 type Protocol = InputMethodEditorMarker;
1074
1075 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1076 Self::new(inner)
1077 }
1078
1079 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1080 self.client.into_channel().map_err(|client| Self { client })
1081 }
1082
1083 fn as_channel(&self) -> &::fidl::AsyncChannel {
1084 self.client.as_channel()
1085 }
1086}
1087
1088impl InputMethodEditorProxy {
1089 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1091 let protocol_name =
1092 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1093 Self { client: fidl::client::Client::new(channel, protocol_name) }
1094 }
1095
1096 pub fn take_event_stream(&self) -> InputMethodEditorEventStream {
1102 InputMethodEditorEventStream { event_receiver: self.client.take_event_receiver() }
1103 }
1104
1105 pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
1106 InputMethodEditorProxyInterface::r#set_keyboard_type(self, keyboard_type)
1107 }
1108
1109 pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
1110 InputMethodEditorProxyInterface::r#set_state(self, state)
1111 }
1112
1113 pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
1114 InputMethodEditorProxyInterface::r#inject_input(self, event)
1115 }
1116
1117 pub fn r#dispatch_key3(
1118 &self,
1119 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
1120 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
1121 InputMethodEditorProxyInterface::r#dispatch_key3(self, event)
1122 }
1123
1124 pub fn r#show(&self) -> Result<(), fidl::Error> {
1125 InputMethodEditorProxyInterface::r#show(self)
1126 }
1127
1128 pub fn r#hide(&self) -> Result<(), fidl::Error> {
1129 InputMethodEditorProxyInterface::r#hide(self)
1130 }
1131}
1132
1133impl InputMethodEditorProxyInterface for InputMethodEditorProxy {
1134 fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
1135 self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
1136 (keyboard_type,),
1137 0x14fe60e927d7d487,
1138 fidl::encoding::DynamicFlags::empty(),
1139 )
1140 }
1141
1142 fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
1143 self.client.send::<InputMethodEditorSetStateRequest>(
1144 (state,),
1145 0x12b477b779818f45,
1146 fidl::encoding::DynamicFlags::empty(),
1147 )
1148 }
1149
1150 fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
1151 self.client.send::<InputMethodEditorInjectInputRequest>(
1152 (event,),
1153 0x34af74618a4f82b,
1154 fidl::encoding::DynamicFlags::empty(),
1155 )
1156 }
1157
1158 type DispatchKey3ResponseFut =
1159 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
1160 fn r#dispatch_key3(
1161 &self,
1162 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
1163 ) -> Self::DispatchKey3ResponseFut {
1164 fn _decode(
1165 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1166 ) -> Result<bool, fidl::Error> {
1167 let _response = fidl::client::decode_transaction_body::<
1168 InputMethodEditorDispatchKey3Response,
1169 fidl::encoding::DefaultFuchsiaResourceDialect,
1170 0x2e13667c827209ac,
1171 >(_buf?)?;
1172 Ok(_response.handled)
1173 }
1174 self.client.send_query_and_decode::<InputMethodEditorDispatchKey3Request, bool>(
1175 (event,),
1176 0x2e13667c827209ac,
1177 fidl::encoding::DynamicFlags::empty(),
1178 _decode,
1179 )
1180 }
1181
1182 fn r#show(&self) -> Result<(), fidl::Error> {
1183 self.client.send::<fidl::encoding::EmptyPayload>(
1184 (),
1185 0x19ba00ba1beb002e,
1186 fidl::encoding::DynamicFlags::empty(),
1187 )
1188 }
1189
1190 fn r#hide(&self) -> Result<(), fidl::Error> {
1191 self.client.send::<fidl::encoding::EmptyPayload>(
1192 (),
1193 0x283e0cd73f0d6d9e,
1194 fidl::encoding::DynamicFlags::empty(),
1195 )
1196 }
1197}
1198
1199pub struct InputMethodEditorEventStream {
1200 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1201}
1202
1203impl std::marker::Unpin for InputMethodEditorEventStream {}
1204
1205impl futures::stream::FusedStream for InputMethodEditorEventStream {
1206 fn is_terminated(&self) -> bool {
1207 self.event_receiver.is_terminated()
1208 }
1209}
1210
1211impl futures::Stream for InputMethodEditorEventStream {
1212 type Item = Result<InputMethodEditorEvent, fidl::Error>;
1213
1214 fn poll_next(
1215 mut self: std::pin::Pin<&mut Self>,
1216 cx: &mut std::task::Context<'_>,
1217 ) -> std::task::Poll<Option<Self::Item>> {
1218 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1219 &mut self.event_receiver,
1220 cx
1221 )?) {
1222 Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorEvent::decode(buf))),
1223 None => std::task::Poll::Ready(None),
1224 }
1225 }
1226}
1227
1228#[derive(Debug)]
1229pub enum InputMethodEditorEvent {}
1230
1231impl InputMethodEditorEvent {
1232 fn decode(
1234 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1235 ) -> Result<InputMethodEditorEvent, fidl::Error> {
1236 let (bytes, _handles) = buf.split_mut();
1237 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1238 debug_assert_eq!(tx_header.tx_id, 0);
1239 match tx_header.ordinal {
1240 _ => Err(fidl::Error::UnknownOrdinal {
1241 ordinal: tx_header.ordinal,
1242 protocol_name:
1243 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1244 }),
1245 }
1246 }
1247}
1248
1249pub struct InputMethodEditorRequestStream {
1251 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1252 is_terminated: bool,
1253}
1254
1255impl std::marker::Unpin for InputMethodEditorRequestStream {}
1256
1257impl futures::stream::FusedStream for InputMethodEditorRequestStream {
1258 fn is_terminated(&self) -> bool {
1259 self.is_terminated
1260 }
1261}
1262
1263impl fidl::endpoints::RequestStream for InputMethodEditorRequestStream {
1264 type Protocol = InputMethodEditorMarker;
1265 type ControlHandle = InputMethodEditorControlHandle;
1266
1267 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1268 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1269 }
1270
1271 fn control_handle(&self) -> Self::ControlHandle {
1272 InputMethodEditorControlHandle { inner: self.inner.clone() }
1273 }
1274
1275 fn into_inner(
1276 self,
1277 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1278 {
1279 (self.inner, self.is_terminated)
1280 }
1281
1282 fn from_inner(
1283 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1284 is_terminated: bool,
1285 ) -> Self {
1286 Self { inner, is_terminated }
1287 }
1288}
1289
1290impl futures::Stream for InputMethodEditorRequestStream {
1291 type Item = Result<InputMethodEditorRequest, fidl::Error>;
1292
1293 fn poll_next(
1294 mut self: std::pin::Pin<&mut Self>,
1295 cx: &mut std::task::Context<'_>,
1296 ) -> std::task::Poll<Option<Self::Item>> {
1297 let this = &mut *self;
1298 if this.inner.check_shutdown(cx) {
1299 this.is_terminated = true;
1300 return std::task::Poll::Ready(None);
1301 }
1302 if this.is_terminated {
1303 panic!("polled InputMethodEditorRequestStream after completion");
1304 }
1305 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1306 |bytes, handles| {
1307 match this.inner.channel().read_etc(cx, bytes, handles) {
1308 std::task::Poll::Ready(Ok(())) => {}
1309 std::task::Poll::Pending => return std::task::Poll::Pending,
1310 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1311 this.is_terminated = true;
1312 return std::task::Poll::Ready(None);
1313 }
1314 std::task::Poll::Ready(Err(e)) => {
1315 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1316 e.into(),
1317 ))));
1318 }
1319 }
1320
1321 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1323
1324 std::task::Poll::Ready(Some(match header.ordinal {
1325 0x14fe60e927d7d487 => {
1326 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1327 let mut req = fidl::new_empty!(
1328 InputMethodEditorSetKeyboardTypeRequest,
1329 fidl::encoding::DefaultFuchsiaResourceDialect
1330 );
1331 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorSetKeyboardTypeRequest>(&header, _body_bytes, handles, &mut req)?;
1332 let control_handle =
1333 InputMethodEditorControlHandle { inner: this.inner.clone() };
1334 Ok(InputMethodEditorRequest::SetKeyboardType {
1335 keyboard_type: req.keyboard_type,
1336
1337 control_handle,
1338 })
1339 }
1340 0x12b477b779818f45 => {
1341 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1342 let mut req = fidl::new_empty!(
1343 InputMethodEditorSetStateRequest,
1344 fidl::encoding::DefaultFuchsiaResourceDialect
1345 );
1346 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorSetStateRequest>(&header, _body_bytes, handles, &mut req)?;
1347 let control_handle =
1348 InputMethodEditorControlHandle { inner: this.inner.clone() };
1349 Ok(InputMethodEditorRequest::SetState { state: req.state, control_handle })
1350 }
1351 0x34af74618a4f82b => {
1352 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1353 let mut req = fidl::new_empty!(
1354 InputMethodEditorInjectInputRequest,
1355 fidl::encoding::DefaultFuchsiaResourceDialect
1356 );
1357 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorInjectInputRequest>(&header, _body_bytes, handles, &mut req)?;
1358 let control_handle =
1359 InputMethodEditorControlHandle { inner: this.inner.clone() };
1360 Ok(InputMethodEditorRequest::InjectInput {
1361 event: req.event,
1362
1363 control_handle,
1364 })
1365 }
1366 0x2e13667c827209ac => {
1367 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1368 let mut req = fidl::new_empty!(
1369 InputMethodEditorDispatchKey3Request,
1370 fidl::encoding::DefaultFuchsiaResourceDialect
1371 );
1372 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorDispatchKey3Request>(&header, _body_bytes, handles, &mut req)?;
1373 let control_handle =
1374 InputMethodEditorControlHandle { inner: this.inner.clone() };
1375 Ok(InputMethodEditorRequest::DispatchKey3 {
1376 event: req.event,
1377
1378 responder: InputMethodEditorDispatchKey3Responder {
1379 control_handle: std::mem::ManuallyDrop::new(control_handle),
1380 tx_id: header.tx_id,
1381 },
1382 })
1383 }
1384 0x19ba00ba1beb002e => {
1385 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1386 let mut req = fidl::new_empty!(
1387 fidl::encoding::EmptyPayload,
1388 fidl::encoding::DefaultFuchsiaResourceDialect
1389 );
1390 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1391 let control_handle =
1392 InputMethodEditorControlHandle { inner: this.inner.clone() };
1393 Ok(InputMethodEditorRequest::Show { control_handle })
1394 }
1395 0x283e0cd73f0d6d9e => {
1396 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1397 let mut req = fidl::new_empty!(
1398 fidl::encoding::EmptyPayload,
1399 fidl::encoding::DefaultFuchsiaResourceDialect
1400 );
1401 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1402 let control_handle =
1403 InputMethodEditorControlHandle { inner: this.inner.clone() };
1404 Ok(InputMethodEditorRequest::Hide { control_handle })
1405 }
1406 _ => Err(fidl::Error::UnknownOrdinal {
1407 ordinal: header.ordinal,
1408 protocol_name:
1409 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1410 }),
1411 }))
1412 },
1413 )
1414 }
1415}
1416
1417#[derive(Debug)]
1419pub enum InputMethodEditorRequest {
1420 SetKeyboardType {
1421 keyboard_type: KeyboardType,
1422 control_handle: InputMethodEditorControlHandle,
1423 },
1424 SetState {
1425 state: TextInputState,
1426 control_handle: InputMethodEditorControlHandle,
1427 },
1428 InjectInput {
1429 event: InputEvent,
1430 control_handle: InputMethodEditorControlHandle,
1431 },
1432 DispatchKey3 {
1433 event: fidl_fuchsia_ui_input3::KeyEvent,
1434 responder: InputMethodEditorDispatchKey3Responder,
1435 },
1436 Show {
1437 control_handle: InputMethodEditorControlHandle,
1438 },
1439 Hide {
1440 control_handle: InputMethodEditorControlHandle,
1441 },
1442}
1443
1444impl InputMethodEditorRequest {
1445 #[allow(irrefutable_let_patterns)]
1446 pub fn into_set_keyboard_type(self) -> Option<(KeyboardType, InputMethodEditorControlHandle)> {
1447 if let InputMethodEditorRequest::SetKeyboardType { keyboard_type, control_handle } = self {
1448 Some((keyboard_type, control_handle))
1449 } else {
1450 None
1451 }
1452 }
1453
1454 #[allow(irrefutable_let_patterns)]
1455 pub fn into_set_state(self) -> Option<(TextInputState, InputMethodEditorControlHandle)> {
1456 if let InputMethodEditorRequest::SetState { state, control_handle } = self {
1457 Some((state, control_handle))
1458 } else {
1459 None
1460 }
1461 }
1462
1463 #[allow(irrefutable_let_patterns)]
1464 pub fn into_inject_input(self) -> Option<(InputEvent, InputMethodEditorControlHandle)> {
1465 if let InputMethodEditorRequest::InjectInput { event, control_handle } = self {
1466 Some((event, control_handle))
1467 } else {
1468 None
1469 }
1470 }
1471
1472 #[allow(irrefutable_let_patterns)]
1473 pub fn into_dispatch_key3(
1474 self,
1475 ) -> Option<(fidl_fuchsia_ui_input3::KeyEvent, InputMethodEditorDispatchKey3Responder)> {
1476 if let InputMethodEditorRequest::DispatchKey3 { event, responder } = self {
1477 Some((event, responder))
1478 } else {
1479 None
1480 }
1481 }
1482
1483 #[allow(irrefutable_let_patterns)]
1484 pub fn into_show(self) -> Option<(InputMethodEditorControlHandle)> {
1485 if let InputMethodEditorRequest::Show { control_handle } = self {
1486 Some((control_handle))
1487 } else {
1488 None
1489 }
1490 }
1491
1492 #[allow(irrefutable_let_patterns)]
1493 pub fn into_hide(self) -> Option<(InputMethodEditorControlHandle)> {
1494 if let InputMethodEditorRequest::Hide { control_handle } = self {
1495 Some((control_handle))
1496 } else {
1497 None
1498 }
1499 }
1500
1501 pub fn method_name(&self) -> &'static str {
1503 match *self {
1504 InputMethodEditorRequest::SetKeyboardType { .. } => "set_keyboard_type",
1505 InputMethodEditorRequest::SetState { .. } => "set_state",
1506 InputMethodEditorRequest::InjectInput { .. } => "inject_input",
1507 InputMethodEditorRequest::DispatchKey3 { .. } => "dispatch_key3",
1508 InputMethodEditorRequest::Show { .. } => "show",
1509 InputMethodEditorRequest::Hide { .. } => "hide",
1510 }
1511 }
1512}
1513
1514#[derive(Debug, Clone)]
1515pub struct InputMethodEditorControlHandle {
1516 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1517}
1518
1519impl fidl::endpoints::ControlHandle for InputMethodEditorControlHandle {
1520 fn shutdown(&self) {
1521 self.inner.shutdown()
1522 }
1523
1524 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1525 self.inner.shutdown_with_epitaph(status)
1526 }
1527
1528 fn is_closed(&self) -> bool {
1529 self.inner.channel().is_closed()
1530 }
1531 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1532 self.inner.channel().on_closed()
1533 }
1534
1535 #[cfg(target_os = "fuchsia")]
1536 fn signal_peer(
1537 &self,
1538 clear_mask: zx::Signals,
1539 set_mask: zx::Signals,
1540 ) -> Result<(), zx_status::Status> {
1541 use fidl::Peered;
1542 self.inner.channel().signal_peer(clear_mask, set_mask)
1543 }
1544}
1545
1546impl InputMethodEditorControlHandle {}
1547
1548#[must_use = "FIDL methods require a response to be sent"]
1549#[derive(Debug)]
1550pub struct InputMethodEditorDispatchKey3Responder {
1551 control_handle: std::mem::ManuallyDrop<InputMethodEditorControlHandle>,
1552 tx_id: u32,
1553}
1554
1555impl std::ops::Drop for InputMethodEditorDispatchKey3Responder {
1559 fn drop(&mut self) {
1560 self.control_handle.shutdown();
1561 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1563 }
1564}
1565
1566impl fidl::endpoints::Responder for InputMethodEditorDispatchKey3Responder {
1567 type ControlHandle = InputMethodEditorControlHandle;
1568
1569 fn control_handle(&self) -> &InputMethodEditorControlHandle {
1570 &self.control_handle
1571 }
1572
1573 fn drop_without_shutdown(mut self) {
1574 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1576 std::mem::forget(self);
1578 }
1579}
1580
1581impl InputMethodEditorDispatchKey3Responder {
1582 pub fn send(self, mut handled: bool) -> Result<(), fidl::Error> {
1586 let _result = self.send_raw(handled);
1587 if _result.is_err() {
1588 self.control_handle.shutdown();
1589 }
1590 self.drop_without_shutdown();
1591 _result
1592 }
1593
1594 pub fn send_no_shutdown_on_err(self, mut handled: bool) -> Result<(), fidl::Error> {
1596 let _result = self.send_raw(handled);
1597 self.drop_without_shutdown();
1598 _result
1599 }
1600
1601 fn send_raw(&self, mut handled: bool) -> Result<(), fidl::Error> {
1602 self.control_handle.inner.send::<InputMethodEditorDispatchKey3Response>(
1603 (handled,),
1604 self.tx_id,
1605 0x2e13667c827209ac,
1606 fidl::encoding::DynamicFlags::empty(),
1607 )
1608 }
1609}
1610
1611#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1612pub struct InputMethodEditorClientMarker;
1613
1614impl fidl::endpoints::ProtocolMarker for InputMethodEditorClientMarker {
1615 type Proxy = InputMethodEditorClientProxy;
1616 type RequestStream = InputMethodEditorClientRequestStream;
1617 #[cfg(target_os = "fuchsia")]
1618 type SynchronousProxy = InputMethodEditorClientSynchronousProxy;
1619
1620 const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditorClient";
1621}
1622
1623pub trait InputMethodEditorClientProxyInterface: Send + Sync {
1624 fn r#did_update_state(
1625 &self,
1626 state: &TextInputState,
1627 event: Option<&InputEvent>,
1628 ) -> Result<(), fidl::Error>;
1629 fn r#on_action(&self, action: InputMethodAction) -> Result<(), fidl::Error>;
1630}
1631#[derive(Debug)]
1632#[cfg(target_os = "fuchsia")]
1633pub struct InputMethodEditorClientSynchronousProxy {
1634 client: fidl::client::sync::Client,
1635}
1636
1637#[cfg(target_os = "fuchsia")]
1638impl fidl::endpoints::SynchronousProxy for InputMethodEditorClientSynchronousProxy {
1639 type Proxy = InputMethodEditorClientProxy;
1640 type Protocol = InputMethodEditorClientMarker;
1641
1642 fn from_channel(inner: fidl::Channel) -> Self {
1643 Self::new(inner)
1644 }
1645
1646 fn into_channel(self) -> fidl::Channel {
1647 self.client.into_channel()
1648 }
1649
1650 fn as_channel(&self) -> &fidl::Channel {
1651 self.client.as_channel()
1652 }
1653}
1654
1655#[cfg(target_os = "fuchsia")]
1656impl InputMethodEditorClientSynchronousProxy {
1657 pub fn new(channel: fidl::Channel) -> Self {
1658 Self { client: fidl::client::sync::Client::new(channel) }
1659 }
1660
1661 pub fn into_channel(self) -> fidl::Channel {
1662 self.client.into_channel()
1663 }
1664
1665 pub fn wait_for_event(
1668 &self,
1669 deadline: zx::MonotonicInstant,
1670 ) -> Result<InputMethodEditorClientEvent, fidl::Error> {
1671 InputMethodEditorClientEvent::decode(
1672 self.client.wait_for_event::<InputMethodEditorClientMarker>(deadline)?,
1673 )
1674 }
1675
1676 pub fn r#did_update_state(
1677 &self,
1678 mut state: &TextInputState,
1679 mut event: Option<&InputEvent>,
1680 ) -> Result<(), fidl::Error> {
1681 self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
1682 (state, event),
1683 0x26681a6b204b679d,
1684 fidl::encoding::DynamicFlags::empty(),
1685 )
1686 }
1687
1688 pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1689 self.client.send::<InputMethodEditorClientOnActionRequest>(
1690 (action,),
1691 0x19c420f173275398,
1692 fidl::encoding::DynamicFlags::empty(),
1693 )
1694 }
1695}
1696
1697#[cfg(target_os = "fuchsia")]
1698impl From<InputMethodEditorClientSynchronousProxy> for zx::NullableHandle {
1699 fn from(value: InputMethodEditorClientSynchronousProxy) -> Self {
1700 value.into_channel().into()
1701 }
1702}
1703
1704#[cfg(target_os = "fuchsia")]
1705impl From<fidl::Channel> for InputMethodEditorClientSynchronousProxy {
1706 fn from(value: fidl::Channel) -> Self {
1707 Self::new(value)
1708 }
1709}
1710
1711#[cfg(target_os = "fuchsia")]
1712impl fidl::endpoints::FromClient for InputMethodEditorClientSynchronousProxy {
1713 type Protocol = InputMethodEditorClientMarker;
1714
1715 fn from_client(value: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>) -> Self {
1716 Self::new(value.into_channel())
1717 }
1718}
1719
1720#[derive(Debug, Clone)]
1721pub struct InputMethodEditorClientProxy {
1722 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1723}
1724
1725impl fidl::endpoints::Proxy for InputMethodEditorClientProxy {
1726 type Protocol = InputMethodEditorClientMarker;
1727
1728 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1729 Self::new(inner)
1730 }
1731
1732 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1733 self.client.into_channel().map_err(|client| Self { client })
1734 }
1735
1736 fn as_channel(&self) -> &::fidl::AsyncChannel {
1737 self.client.as_channel()
1738 }
1739}
1740
1741impl InputMethodEditorClientProxy {
1742 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1744 let protocol_name =
1745 <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1746 Self { client: fidl::client::Client::new(channel, protocol_name) }
1747 }
1748
1749 pub fn take_event_stream(&self) -> InputMethodEditorClientEventStream {
1755 InputMethodEditorClientEventStream { event_receiver: self.client.take_event_receiver() }
1756 }
1757
1758 pub fn r#did_update_state(
1759 &self,
1760 mut state: &TextInputState,
1761 mut event: Option<&InputEvent>,
1762 ) -> Result<(), fidl::Error> {
1763 InputMethodEditorClientProxyInterface::r#did_update_state(self, state, event)
1764 }
1765
1766 pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1767 InputMethodEditorClientProxyInterface::r#on_action(self, action)
1768 }
1769}
1770
1771impl InputMethodEditorClientProxyInterface for InputMethodEditorClientProxy {
1772 fn r#did_update_state(
1773 &self,
1774 mut state: &TextInputState,
1775 mut event: Option<&InputEvent>,
1776 ) -> Result<(), fidl::Error> {
1777 self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
1778 (state, event),
1779 0x26681a6b204b679d,
1780 fidl::encoding::DynamicFlags::empty(),
1781 )
1782 }
1783
1784 fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1785 self.client.send::<InputMethodEditorClientOnActionRequest>(
1786 (action,),
1787 0x19c420f173275398,
1788 fidl::encoding::DynamicFlags::empty(),
1789 )
1790 }
1791}
1792
1793pub struct InputMethodEditorClientEventStream {
1794 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1795}
1796
1797impl std::marker::Unpin for InputMethodEditorClientEventStream {}
1798
1799impl futures::stream::FusedStream for InputMethodEditorClientEventStream {
1800 fn is_terminated(&self) -> bool {
1801 self.event_receiver.is_terminated()
1802 }
1803}
1804
1805impl futures::Stream for InputMethodEditorClientEventStream {
1806 type Item = Result<InputMethodEditorClientEvent, fidl::Error>;
1807
1808 fn poll_next(
1809 mut self: std::pin::Pin<&mut Self>,
1810 cx: &mut std::task::Context<'_>,
1811 ) -> std::task::Poll<Option<Self::Item>> {
1812 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1813 &mut self.event_receiver,
1814 cx
1815 )?) {
1816 Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorClientEvent::decode(buf))),
1817 None => std::task::Poll::Ready(None),
1818 }
1819 }
1820}
1821
1822#[derive(Debug)]
1823pub enum InputMethodEditorClientEvent {}
1824
1825impl InputMethodEditorClientEvent {
1826 fn decode(
1828 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1829 ) -> Result<InputMethodEditorClientEvent, fidl::Error> {
1830 let (bytes, _handles) = buf.split_mut();
1831 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1832 debug_assert_eq!(tx_header.tx_id, 0);
1833 match tx_header.ordinal {
1834 _ => Err(fidl::Error::UnknownOrdinal {
1835 ordinal: tx_header.ordinal,
1836 protocol_name:
1837 <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1838 }),
1839 }
1840 }
1841}
1842
1843pub struct InputMethodEditorClientRequestStream {
1845 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1846 is_terminated: bool,
1847}
1848
1849impl std::marker::Unpin for InputMethodEditorClientRequestStream {}
1850
1851impl futures::stream::FusedStream for InputMethodEditorClientRequestStream {
1852 fn is_terminated(&self) -> bool {
1853 self.is_terminated
1854 }
1855}
1856
1857impl fidl::endpoints::RequestStream for InputMethodEditorClientRequestStream {
1858 type Protocol = InputMethodEditorClientMarker;
1859 type ControlHandle = InputMethodEditorClientControlHandle;
1860
1861 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1862 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1863 }
1864
1865 fn control_handle(&self) -> Self::ControlHandle {
1866 InputMethodEditorClientControlHandle { inner: self.inner.clone() }
1867 }
1868
1869 fn into_inner(
1870 self,
1871 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1872 {
1873 (self.inner, self.is_terminated)
1874 }
1875
1876 fn from_inner(
1877 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1878 is_terminated: bool,
1879 ) -> Self {
1880 Self { inner, is_terminated }
1881 }
1882}
1883
1884impl futures::Stream for InputMethodEditorClientRequestStream {
1885 type Item = Result<InputMethodEditorClientRequest, fidl::Error>;
1886
1887 fn poll_next(
1888 mut self: std::pin::Pin<&mut Self>,
1889 cx: &mut std::task::Context<'_>,
1890 ) -> std::task::Poll<Option<Self::Item>> {
1891 let this = &mut *self;
1892 if this.inner.check_shutdown(cx) {
1893 this.is_terminated = true;
1894 return std::task::Poll::Ready(None);
1895 }
1896 if this.is_terminated {
1897 panic!("polled InputMethodEditorClientRequestStream after completion");
1898 }
1899 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1900 |bytes, handles| {
1901 match this.inner.channel().read_etc(cx, bytes, handles) {
1902 std::task::Poll::Ready(Ok(())) => {}
1903 std::task::Poll::Pending => return std::task::Poll::Pending,
1904 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1905 this.is_terminated = true;
1906 return std::task::Poll::Ready(None);
1907 }
1908 std::task::Poll::Ready(Err(e)) => {
1909 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1910 e.into(),
1911 ))));
1912 }
1913 }
1914
1915 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1917
1918 std::task::Poll::Ready(Some(match header.ordinal {
1919 0x26681a6b204b679d => {
1920 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1921 let mut req = fidl::new_empty!(InputMethodEditorClientDidUpdateStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1922 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorClientDidUpdateStateRequest>(&header, _body_bytes, handles, &mut req)?;
1923 let control_handle = InputMethodEditorClientControlHandle {
1924 inner: this.inner.clone(),
1925 };
1926 Ok(InputMethodEditorClientRequest::DidUpdateState {state: req.state,
1927event: req.event,
1928
1929 control_handle,
1930 })
1931 }
1932 0x19c420f173275398 => {
1933 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1934 let mut req = fidl::new_empty!(InputMethodEditorClientOnActionRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1935 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorClientOnActionRequest>(&header, _body_bytes, handles, &mut req)?;
1936 let control_handle = InputMethodEditorClientControlHandle {
1937 inner: this.inner.clone(),
1938 };
1939 Ok(InputMethodEditorClientRequest::OnAction {action: req.action,
1940
1941 control_handle,
1942 })
1943 }
1944 _ => Err(fidl::Error::UnknownOrdinal {
1945 ordinal: header.ordinal,
1946 protocol_name: <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1947 }),
1948 }))
1949 },
1950 )
1951 }
1952}
1953
1954#[derive(Debug)]
1956pub enum InputMethodEditorClientRequest {
1957 DidUpdateState {
1958 state: TextInputState,
1959 event: Option<Box<InputEvent>>,
1960 control_handle: InputMethodEditorClientControlHandle,
1961 },
1962 OnAction {
1963 action: InputMethodAction,
1964 control_handle: InputMethodEditorClientControlHandle,
1965 },
1966}
1967
1968impl InputMethodEditorClientRequest {
1969 #[allow(irrefutable_let_patterns)]
1970 pub fn into_did_update_state(
1971 self,
1972 ) -> Option<(TextInputState, Option<Box<InputEvent>>, InputMethodEditorClientControlHandle)>
1973 {
1974 if let InputMethodEditorClientRequest::DidUpdateState { state, event, control_handle } =
1975 self
1976 {
1977 Some((state, event, control_handle))
1978 } else {
1979 None
1980 }
1981 }
1982
1983 #[allow(irrefutable_let_patterns)]
1984 pub fn into_on_action(
1985 self,
1986 ) -> Option<(InputMethodAction, InputMethodEditorClientControlHandle)> {
1987 if let InputMethodEditorClientRequest::OnAction { action, control_handle } = self {
1988 Some((action, control_handle))
1989 } else {
1990 None
1991 }
1992 }
1993
1994 pub fn method_name(&self) -> &'static str {
1996 match *self {
1997 InputMethodEditorClientRequest::DidUpdateState { .. } => "did_update_state",
1998 InputMethodEditorClientRequest::OnAction { .. } => "on_action",
1999 }
2000 }
2001}
2002
2003#[derive(Debug, Clone)]
2004pub struct InputMethodEditorClientControlHandle {
2005 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2006}
2007
2008impl fidl::endpoints::ControlHandle for InputMethodEditorClientControlHandle {
2009 fn shutdown(&self) {
2010 self.inner.shutdown()
2011 }
2012
2013 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2014 self.inner.shutdown_with_epitaph(status)
2015 }
2016
2017 fn is_closed(&self) -> bool {
2018 self.inner.channel().is_closed()
2019 }
2020 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2021 self.inner.channel().on_closed()
2022 }
2023
2024 #[cfg(target_os = "fuchsia")]
2025 fn signal_peer(
2026 &self,
2027 clear_mask: zx::Signals,
2028 set_mask: zx::Signals,
2029 ) -> Result<(), zx_status::Status> {
2030 use fidl::Peered;
2031 self.inner.channel().signal_peer(clear_mask, set_mask)
2032 }
2033}
2034
2035impl InputMethodEditorClientControlHandle {}
2036
2037mod internal {
2038 use super::*;
2039
2040 impl fidl::encoding::ResourceTypeMarker for ImeServiceGetInputMethodEditorRequest {
2041 type Borrowed<'a> = &'a mut Self;
2042 fn take_or_borrow<'a>(
2043 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2044 ) -> Self::Borrowed<'a> {
2045 value
2046 }
2047 }
2048
2049 unsafe impl fidl::encoding::TypeMarker for ImeServiceGetInputMethodEditorRequest {
2050 type Owned = Self;
2051
2052 #[inline(always)]
2053 fn inline_align(_context: fidl::encoding::Context) -> usize {
2054 8
2055 }
2056
2057 #[inline(always)]
2058 fn inline_size(_context: fidl::encoding::Context) -> usize {
2059 80
2060 }
2061 }
2062
2063 unsafe impl
2064 fidl::encoding::Encode<
2065 ImeServiceGetInputMethodEditorRequest,
2066 fidl::encoding::DefaultFuchsiaResourceDialect,
2067 > for &mut ImeServiceGetInputMethodEditorRequest
2068 {
2069 #[inline]
2070 unsafe fn encode(
2071 self,
2072 encoder: &mut fidl::encoding::Encoder<
2073 '_,
2074 fidl::encoding::DefaultFuchsiaResourceDialect,
2075 >,
2076 offset: usize,
2077 _depth: fidl::encoding::Depth,
2078 ) -> fidl::Result<()> {
2079 encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
2080 fidl::encoding::Encode::<ImeServiceGetInputMethodEditorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2082 (
2083 <KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),
2084 <InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
2085 <TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_state),
2086 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
2087 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.editor),
2088 ),
2089 encoder, offset, _depth
2090 )
2091 }
2092 }
2093 unsafe impl<
2094 T0: fidl::encoding::Encode<KeyboardType, fidl::encoding::DefaultFuchsiaResourceDialect>,
2095 T1: fidl::encoding::Encode<InputMethodAction, fidl::encoding::DefaultFuchsiaResourceDialect>,
2096 T2: fidl::encoding::Encode<TextInputState, fidl::encoding::DefaultFuchsiaResourceDialect>,
2097 T3: fidl::encoding::Encode<
2098 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
2099 fidl::encoding::DefaultFuchsiaResourceDialect,
2100 >,
2101 T4: fidl::encoding::Encode<
2102 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2103 fidl::encoding::DefaultFuchsiaResourceDialect,
2104 >,
2105 >
2106 fidl::encoding::Encode<
2107 ImeServiceGetInputMethodEditorRequest,
2108 fidl::encoding::DefaultFuchsiaResourceDialect,
2109 > for (T0, T1, T2, T3, T4)
2110 {
2111 #[inline]
2112 unsafe fn encode(
2113 self,
2114 encoder: &mut fidl::encoding::Encoder<
2115 '_,
2116 fidl::encoding::DefaultFuchsiaResourceDialect,
2117 >,
2118 offset: usize,
2119 depth: fidl::encoding::Depth,
2120 ) -> fidl::Result<()> {
2121 encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
2122 self.0.encode(encoder, offset + 0, depth)?;
2126 self.1.encode(encoder, offset + 4, depth)?;
2127 self.2.encode(encoder, offset + 8, depth)?;
2128 self.3.encode(encoder, offset + 72, depth)?;
2129 self.4.encode(encoder, offset + 76, depth)?;
2130 Ok(())
2131 }
2132 }
2133
2134 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2135 for ImeServiceGetInputMethodEditorRequest
2136 {
2137 #[inline(always)]
2138 fn new_empty() -> Self {
2139 Self {
2140 keyboard_type: fidl::new_empty!(
2141 KeyboardType,
2142 fidl::encoding::DefaultFuchsiaResourceDialect
2143 ),
2144 action: fidl::new_empty!(
2145 InputMethodAction,
2146 fidl::encoding::DefaultFuchsiaResourceDialect
2147 ),
2148 initial_state: fidl::new_empty!(
2149 TextInputState,
2150 fidl::encoding::DefaultFuchsiaResourceDialect
2151 ),
2152 client: fidl::new_empty!(
2153 fidl::encoding::Endpoint<
2154 fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
2155 >,
2156 fidl::encoding::DefaultFuchsiaResourceDialect
2157 ),
2158 editor: fidl::new_empty!(
2159 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2160 fidl::encoding::DefaultFuchsiaResourceDialect
2161 ),
2162 }
2163 }
2164
2165 #[inline]
2166 unsafe fn decode(
2167 &mut self,
2168 decoder: &mut fidl::encoding::Decoder<
2169 '_,
2170 fidl::encoding::DefaultFuchsiaResourceDialect,
2171 >,
2172 offset: usize,
2173 _depth: fidl::encoding::Depth,
2174 ) -> fidl::Result<()> {
2175 decoder.debug_check_bounds::<Self>(offset);
2176 fidl::decode!(
2178 KeyboardType,
2179 fidl::encoding::DefaultFuchsiaResourceDialect,
2180 &mut self.keyboard_type,
2181 decoder,
2182 offset + 0,
2183 _depth
2184 )?;
2185 fidl::decode!(
2186 InputMethodAction,
2187 fidl::encoding::DefaultFuchsiaResourceDialect,
2188 &mut self.action,
2189 decoder,
2190 offset + 4,
2191 _depth
2192 )?;
2193 fidl::decode!(
2194 TextInputState,
2195 fidl::encoding::DefaultFuchsiaResourceDialect,
2196 &mut self.initial_state,
2197 decoder,
2198 offset + 8,
2199 _depth
2200 )?;
2201 fidl::decode!(
2202 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
2203 fidl::encoding::DefaultFuchsiaResourceDialect,
2204 &mut self.client,
2205 decoder,
2206 offset + 72,
2207 _depth
2208 )?;
2209 fidl::decode!(
2210 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2211 fidl::encoding::DefaultFuchsiaResourceDialect,
2212 &mut self.editor,
2213 decoder,
2214 offset + 76,
2215 _depth
2216 )?;
2217 Ok(())
2218 }
2219 }
2220
2221 impl MediaButtonsEvent {
2222 #[inline(always)]
2223 fn max_ordinal_present(&self) -> u64 {
2224 if let Some(_) = self.trace_flow_id {
2225 return 9;
2226 }
2227 if let Some(_) = self.wake_lease {
2228 return 8;
2229 }
2230 if let Some(_) = self.device_id {
2231 return 7;
2232 }
2233 if let Some(_) = self.function {
2234 return 6;
2235 }
2236 if let Some(_) = self.power {
2237 return 5;
2238 }
2239 if let Some(_) = self.camera_disable {
2240 return 4;
2241 }
2242 if let Some(_) = self.pause {
2243 return 3;
2244 }
2245 if let Some(_) = self.mic_mute {
2246 return 2;
2247 }
2248 if let Some(_) = self.volume {
2249 return 1;
2250 }
2251 0
2252 }
2253 }
2254
2255 impl fidl::encoding::ResourceTypeMarker for MediaButtonsEvent {
2256 type Borrowed<'a> = &'a mut Self;
2257 fn take_or_borrow<'a>(
2258 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2259 ) -> Self::Borrowed<'a> {
2260 value
2261 }
2262 }
2263
2264 unsafe impl fidl::encoding::TypeMarker for MediaButtonsEvent {
2265 type Owned = Self;
2266
2267 #[inline(always)]
2268 fn inline_align(_context: fidl::encoding::Context) -> usize {
2269 8
2270 }
2271
2272 #[inline(always)]
2273 fn inline_size(_context: fidl::encoding::Context) -> usize {
2274 16
2275 }
2276 }
2277
2278 unsafe impl
2279 fidl::encoding::Encode<MediaButtonsEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
2280 for &mut MediaButtonsEvent
2281 {
2282 unsafe fn encode(
2283 self,
2284 encoder: &mut fidl::encoding::Encoder<
2285 '_,
2286 fidl::encoding::DefaultFuchsiaResourceDialect,
2287 >,
2288 offset: usize,
2289 mut depth: fidl::encoding::Depth,
2290 ) -> fidl::Result<()> {
2291 encoder.debug_check_bounds::<MediaButtonsEvent>(offset);
2292 let max_ordinal: u64 = self.max_ordinal_present();
2294 encoder.write_num(max_ordinal, offset);
2295 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2296 if max_ordinal == 0 {
2298 return Ok(());
2299 }
2300 depth.increment()?;
2301 let envelope_size = 8;
2302 let bytes_len = max_ordinal as usize * envelope_size;
2303 #[allow(unused_variables)]
2304 let offset = encoder.out_of_line_offset(bytes_len);
2305 let mut _prev_end_offset: usize = 0;
2306 if 1 > max_ordinal {
2307 return Ok(());
2308 }
2309
2310 let cur_offset: usize = (1 - 1) * envelope_size;
2313
2314 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2316
2317 fidl::encoding::encode_in_envelope_optional::<
2322 i8,
2323 fidl::encoding::DefaultFuchsiaResourceDialect,
2324 >(
2325 self.volume.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
2326 encoder,
2327 offset + cur_offset,
2328 depth,
2329 )?;
2330
2331 _prev_end_offset = cur_offset + envelope_size;
2332 if 2 > max_ordinal {
2333 return Ok(());
2334 }
2335
2336 let cur_offset: usize = (2 - 1) * envelope_size;
2339
2340 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2342
2343 fidl::encoding::encode_in_envelope_optional::<
2348 bool,
2349 fidl::encoding::DefaultFuchsiaResourceDialect,
2350 >(
2351 self.mic_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2352 encoder,
2353 offset + cur_offset,
2354 depth,
2355 )?;
2356
2357 _prev_end_offset = cur_offset + envelope_size;
2358 if 3 > max_ordinal {
2359 return Ok(());
2360 }
2361
2362 let cur_offset: usize = (3 - 1) * envelope_size;
2365
2366 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2368
2369 fidl::encoding::encode_in_envelope_optional::<
2374 bool,
2375 fidl::encoding::DefaultFuchsiaResourceDialect,
2376 >(
2377 self.pause.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2378 encoder,
2379 offset + cur_offset,
2380 depth,
2381 )?;
2382
2383 _prev_end_offset = cur_offset + envelope_size;
2384 if 4 > max_ordinal {
2385 return Ok(());
2386 }
2387
2388 let cur_offset: usize = (4 - 1) * envelope_size;
2391
2392 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2394
2395 fidl::encoding::encode_in_envelope_optional::<
2400 bool,
2401 fidl::encoding::DefaultFuchsiaResourceDialect,
2402 >(
2403 self.camera_disable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2404 encoder,
2405 offset + cur_offset,
2406 depth,
2407 )?;
2408
2409 _prev_end_offset = cur_offset + envelope_size;
2410 if 5 > max_ordinal {
2411 return Ok(());
2412 }
2413
2414 let cur_offset: usize = (5 - 1) * envelope_size;
2417
2418 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2420
2421 fidl::encoding::encode_in_envelope_optional::<
2426 bool,
2427 fidl::encoding::DefaultFuchsiaResourceDialect,
2428 >(
2429 self.power.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2430 encoder,
2431 offset + cur_offset,
2432 depth,
2433 )?;
2434
2435 _prev_end_offset = cur_offset + envelope_size;
2436 if 6 > max_ordinal {
2437 return Ok(());
2438 }
2439
2440 let cur_offset: usize = (6 - 1) * envelope_size;
2443
2444 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2446
2447 fidl::encoding::encode_in_envelope_optional::<
2452 bool,
2453 fidl::encoding::DefaultFuchsiaResourceDialect,
2454 >(
2455 self.function.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2456 encoder,
2457 offset + cur_offset,
2458 depth,
2459 )?;
2460
2461 _prev_end_offset = cur_offset + envelope_size;
2462 if 7 > max_ordinal {
2463 return Ok(());
2464 }
2465
2466 let cur_offset: usize = (7 - 1) * envelope_size;
2469
2470 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2472
2473 fidl::encoding::encode_in_envelope_optional::<
2478 u32,
2479 fidl::encoding::DefaultFuchsiaResourceDialect,
2480 >(
2481 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2482 encoder,
2483 offset + cur_offset,
2484 depth,
2485 )?;
2486
2487 _prev_end_offset = cur_offset + envelope_size;
2488 if 8 > max_ordinal {
2489 return Ok(());
2490 }
2491
2492 let cur_offset: usize = (8 - 1) * envelope_size;
2495
2496 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2498
2499 fidl::encoding::encode_in_envelope_optional::<
2504 fidl::encoding::HandleType<
2505 fidl::EventPair,
2506 { fidl::ObjectType::EVENTPAIR.into_raw() },
2507 2147483648,
2508 >,
2509 fidl::encoding::DefaultFuchsiaResourceDialect,
2510 >(
2511 self.wake_lease.as_mut().map(
2512 <fidl::encoding::HandleType<
2513 fidl::EventPair,
2514 { fidl::ObjectType::EVENTPAIR.into_raw() },
2515 2147483648,
2516 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2517 ),
2518 encoder,
2519 offset + cur_offset,
2520 depth,
2521 )?;
2522
2523 _prev_end_offset = cur_offset + envelope_size;
2524 if 9 > max_ordinal {
2525 return Ok(());
2526 }
2527
2528 let cur_offset: usize = (9 - 1) * envelope_size;
2531
2532 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2534
2535 fidl::encoding::encode_in_envelope_optional::<
2540 u64,
2541 fidl::encoding::DefaultFuchsiaResourceDialect,
2542 >(
2543 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2544 encoder,
2545 offset + cur_offset,
2546 depth,
2547 )?;
2548
2549 _prev_end_offset = cur_offset + envelope_size;
2550
2551 Ok(())
2552 }
2553 }
2554
2555 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2556 for MediaButtonsEvent
2557 {
2558 #[inline(always)]
2559 fn new_empty() -> Self {
2560 Self::default()
2561 }
2562
2563 unsafe fn decode(
2564 &mut self,
2565 decoder: &mut fidl::encoding::Decoder<
2566 '_,
2567 fidl::encoding::DefaultFuchsiaResourceDialect,
2568 >,
2569 offset: usize,
2570 mut depth: fidl::encoding::Depth,
2571 ) -> fidl::Result<()> {
2572 decoder.debug_check_bounds::<Self>(offset);
2573 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2574 None => return Err(fidl::Error::NotNullable),
2575 Some(len) => len,
2576 };
2577 if len == 0 {
2579 return Ok(());
2580 };
2581 depth.increment()?;
2582 let envelope_size = 8;
2583 let bytes_len = len * envelope_size;
2584 let offset = decoder.out_of_line_offset(bytes_len)?;
2585 let mut _next_ordinal_to_read = 0;
2587 let mut next_offset = offset;
2588 let end_offset = offset + bytes_len;
2589 _next_ordinal_to_read += 1;
2590 if next_offset >= end_offset {
2591 return Ok(());
2592 }
2593
2594 while _next_ordinal_to_read < 1 {
2596 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2597 _next_ordinal_to_read += 1;
2598 next_offset += envelope_size;
2599 }
2600
2601 let next_out_of_line = decoder.next_out_of_line();
2602 let handles_before = decoder.remaining_handles();
2603 if let Some((inlined, num_bytes, num_handles)) =
2604 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2605 {
2606 let member_inline_size =
2607 <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2608 if inlined != (member_inline_size <= 4) {
2609 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2610 }
2611 let inner_offset;
2612 let mut inner_depth = depth.clone();
2613 if inlined {
2614 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2615 inner_offset = next_offset;
2616 } else {
2617 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2618 inner_depth.increment()?;
2619 }
2620 let val_ref = self.volume.get_or_insert_with(|| {
2621 fidl::new_empty!(i8, fidl::encoding::DefaultFuchsiaResourceDialect)
2622 });
2623 fidl::decode!(
2624 i8,
2625 fidl::encoding::DefaultFuchsiaResourceDialect,
2626 val_ref,
2627 decoder,
2628 inner_offset,
2629 inner_depth
2630 )?;
2631 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2632 {
2633 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2634 }
2635 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2636 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2637 }
2638 }
2639
2640 next_offset += envelope_size;
2641 _next_ordinal_to_read += 1;
2642 if next_offset >= end_offset {
2643 return Ok(());
2644 }
2645
2646 while _next_ordinal_to_read < 2 {
2648 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2649 _next_ordinal_to_read += 1;
2650 next_offset += envelope_size;
2651 }
2652
2653 let next_out_of_line = decoder.next_out_of_line();
2654 let handles_before = decoder.remaining_handles();
2655 if let Some((inlined, num_bytes, num_handles)) =
2656 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2657 {
2658 let member_inline_size =
2659 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2660 if inlined != (member_inline_size <= 4) {
2661 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2662 }
2663 let inner_offset;
2664 let mut inner_depth = depth.clone();
2665 if inlined {
2666 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2667 inner_offset = next_offset;
2668 } else {
2669 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2670 inner_depth.increment()?;
2671 }
2672 let val_ref = self.mic_mute.get_or_insert_with(|| {
2673 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2674 });
2675 fidl::decode!(
2676 bool,
2677 fidl::encoding::DefaultFuchsiaResourceDialect,
2678 val_ref,
2679 decoder,
2680 inner_offset,
2681 inner_depth
2682 )?;
2683 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2684 {
2685 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2686 }
2687 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2688 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2689 }
2690 }
2691
2692 next_offset += envelope_size;
2693 _next_ordinal_to_read += 1;
2694 if next_offset >= end_offset {
2695 return Ok(());
2696 }
2697
2698 while _next_ordinal_to_read < 3 {
2700 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2701 _next_ordinal_to_read += 1;
2702 next_offset += envelope_size;
2703 }
2704
2705 let next_out_of_line = decoder.next_out_of_line();
2706 let handles_before = decoder.remaining_handles();
2707 if let Some((inlined, num_bytes, num_handles)) =
2708 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2709 {
2710 let member_inline_size =
2711 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2712 if inlined != (member_inline_size <= 4) {
2713 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2714 }
2715 let inner_offset;
2716 let mut inner_depth = depth.clone();
2717 if inlined {
2718 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2719 inner_offset = next_offset;
2720 } else {
2721 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2722 inner_depth.increment()?;
2723 }
2724 let val_ref = self.pause.get_or_insert_with(|| {
2725 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2726 });
2727 fidl::decode!(
2728 bool,
2729 fidl::encoding::DefaultFuchsiaResourceDialect,
2730 val_ref,
2731 decoder,
2732 inner_offset,
2733 inner_depth
2734 )?;
2735 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2736 {
2737 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2738 }
2739 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2740 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2741 }
2742 }
2743
2744 next_offset += envelope_size;
2745 _next_ordinal_to_read += 1;
2746 if next_offset >= end_offset {
2747 return Ok(());
2748 }
2749
2750 while _next_ordinal_to_read < 4 {
2752 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2753 _next_ordinal_to_read += 1;
2754 next_offset += envelope_size;
2755 }
2756
2757 let next_out_of_line = decoder.next_out_of_line();
2758 let handles_before = decoder.remaining_handles();
2759 if let Some((inlined, num_bytes, num_handles)) =
2760 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2761 {
2762 let member_inline_size =
2763 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2764 if inlined != (member_inline_size <= 4) {
2765 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2766 }
2767 let inner_offset;
2768 let mut inner_depth = depth.clone();
2769 if inlined {
2770 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2771 inner_offset = next_offset;
2772 } else {
2773 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2774 inner_depth.increment()?;
2775 }
2776 let val_ref = self.camera_disable.get_or_insert_with(|| {
2777 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2778 });
2779 fidl::decode!(
2780 bool,
2781 fidl::encoding::DefaultFuchsiaResourceDialect,
2782 val_ref,
2783 decoder,
2784 inner_offset,
2785 inner_depth
2786 )?;
2787 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2788 {
2789 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2790 }
2791 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2792 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2793 }
2794 }
2795
2796 next_offset += envelope_size;
2797 _next_ordinal_to_read += 1;
2798 if next_offset >= end_offset {
2799 return Ok(());
2800 }
2801
2802 while _next_ordinal_to_read < 5 {
2804 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2805 _next_ordinal_to_read += 1;
2806 next_offset += envelope_size;
2807 }
2808
2809 let next_out_of_line = decoder.next_out_of_line();
2810 let handles_before = decoder.remaining_handles();
2811 if let Some((inlined, num_bytes, num_handles)) =
2812 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2813 {
2814 let member_inline_size =
2815 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2816 if inlined != (member_inline_size <= 4) {
2817 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2818 }
2819 let inner_offset;
2820 let mut inner_depth = depth.clone();
2821 if inlined {
2822 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2823 inner_offset = next_offset;
2824 } else {
2825 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2826 inner_depth.increment()?;
2827 }
2828 let val_ref = self.power.get_or_insert_with(|| {
2829 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2830 });
2831 fidl::decode!(
2832 bool,
2833 fidl::encoding::DefaultFuchsiaResourceDialect,
2834 val_ref,
2835 decoder,
2836 inner_offset,
2837 inner_depth
2838 )?;
2839 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2840 {
2841 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2842 }
2843 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2844 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2845 }
2846 }
2847
2848 next_offset += envelope_size;
2849 _next_ordinal_to_read += 1;
2850 if next_offset >= end_offset {
2851 return Ok(());
2852 }
2853
2854 while _next_ordinal_to_read < 6 {
2856 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2857 _next_ordinal_to_read += 1;
2858 next_offset += envelope_size;
2859 }
2860
2861 let next_out_of_line = decoder.next_out_of_line();
2862 let handles_before = decoder.remaining_handles();
2863 if let Some((inlined, num_bytes, num_handles)) =
2864 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2865 {
2866 let member_inline_size =
2867 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2868 if inlined != (member_inline_size <= 4) {
2869 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2870 }
2871 let inner_offset;
2872 let mut inner_depth = depth.clone();
2873 if inlined {
2874 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2875 inner_offset = next_offset;
2876 } else {
2877 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2878 inner_depth.increment()?;
2879 }
2880 let val_ref = self.function.get_or_insert_with(|| {
2881 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2882 });
2883 fidl::decode!(
2884 bool,
2885 fidl::encoding::DefaultFuchsiaResourceDialect,
2886 val_ref,
2887 decoder,
2888 inner_offset,
2889 inner_depth
2890 )?;
2891 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2892 {
2893 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2894 }
2895 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2896 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2897 }
2898 }
2899
2900 next_offset += envelope_size;
2901 _next_ordinal_to_read += 1;
2902 if next_offset >= end_offset {
2903 return Ok(());
2904 }
2905
2906 while _next_ordinal_to_read < 7 {
2908 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2909 _next_ordinal_to_read += 1;
2910 next_offset += envelope_size;
2911 }
2912
2913 let next_out_of_line = decoder.next_out_of_line();
2914 let handles_before = decoder.remaining_handles();
2915 if let Some((inlined, num_bytes, num_handles)) =
2916 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2917 {
2918 let member_inline_size =
2919 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2920 if inlined != (member_inline_size <= 4) {
2921 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2922 }
2923 let inner_offset;
2924 let mut inner_depth = depth.clone();
2925 if inlined {
2926 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2927 inner_offset = next_offset;
2928 } else {
2929 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2930 inner_depth.increment()?;
2931 }
2932 let val_ref = self.device_id.get_or_insert_with(|| {
2933 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2934 });
2935 fidl::decode!(
2936 u32,
2937 fidl::encoding::DefaultFuchsiaResourceDialect,
2938 val_ref,
2939 decoder,
2940 inner_offset,
2941 inner_depth
2942 )?;
2943 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2944 {
2945 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2946 }
2947 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2948 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2949 }
2950 }
2951
2952 next_offset += envelope_size;
2953 _next_ordinal_to_read += 1;
2954 if next_offset >= end_offset {
2955 return Ok(());
2956 }
2957
2958 while _next_ordinal_to_read < 8 {
2960 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2961 _next_ordinal_to_read += 1;
2962 next_offset += envelope_size;
2963 }
2964
2965 let next_out_of_line = decoder.next_out_of_line();
2966 let handles_before = decoder.remaining_handles();
2967 if let Some((inlined, num_bytes, num_handles)) =
2968 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2969 {
2970 let member_inline_size = <fidl::encoding::HandleType<
2971 fidl::EventPair,
2972 { fidl::ObjectType::EVENTPAIR.into_raw() },
2973 2147483648,
2974 > as fidl::encoding::TypeMarker>::inline_size(
2975 decoder.context
2976 );
2977 if inlined != (member_inline_size <= 4) {
2978 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2979 }
2980 let inner_offset;
2981 let mut inner_depth = depth.clone();
2982 if inlined {
2983 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2984 inner_offset = next_offset;
2985 } else {
2986 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2987 inner_depth.increment()?;
2988 }
2989 let val_ref =
2990 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2991 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2992 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2993 {
2994 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2995 }
2996 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2997 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2998 }
2999 }
3000
3001 next_offset += envelope_size;
3002 _next_ordinal_to_read += 1;
3003 if next_offset >= end_offset {
3004 return Ok(());
3005 }
3006
3007 while _next_ordinal_to_read < 9 {
3009 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3010 _next_ordinal_to_read += 1;
3011 next_offset += envelope_size;
3012 }
3013
3014 let next_out_of_line = decoder.next_out_of_line();
3015 let handles_before = decoder.remaining_handles();
3016 if let Some((inlined, num_bytes, num_handles)) =
3017 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3018 {
3019 let member_inline_size =
3020 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3021 if inlined != (member_inline_size <= 4) {
3022 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3023 }
3024 let inner_offset;
3025 let mut inner_depth = depth.clone();
3026 if inlined {
3027 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3028 inner_offset = next_offset;
3029 } else {
3030 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3031 inner_depth.increment()?;
3032 }
3033 let val_ref = self.trace_flow_id.get_or_insert_with(|| {
3034 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3035 });
3036 fidl::decode!(
3037 u64,
3038 fidl::encoding::DefaultFuchsiaResourceDialect,
3039 val_ref,
3040 decoder,
3041 inner_offset,
3042 inner_depth
3043 )?;
3044 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3045 {
3046 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3047 }
3048 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3049 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3050 }
3051 }
3052
3053 next_offset += envelope_size;
3054
3055 while next_offset < end_offset {
3057 _next_ordinal_to_read += 1;
3058 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3059 next_offset += envelope_size;
3060 }
3061
3062 Ok(())
3063 }
3064 }
3065
3066 impl TouchButtonsEvent {
3067 #[inline(always)]
3068 fn max_ordinal_present(&self) -> u64 {
3069 if let Some(_) = self.trace_flow_id {
3070 return 5;
3071 }
3072 if let Some(_) = self.wake_lease {
3073 return 4;
3074 }
3075 if let Some(_) = self.pressed_buttons {
3076 return 3;
3077 }
3078 if let Some(_) = self.device_info {
3079 return 2;
3080 }
3081 if let Some(_) = self.event_time {
3082 return 1;
3083 }
3084 0
3085 }
3086 }
3087
3088 impl fidl::encoding::ResourceTypeMarker for TouchButtonsEvent {
3089 type Borrowed<'a> = &'a mut Self;
3090 fn take_or_borrow<'a>(
3091 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3092 ) -> Self::Borrowed<'a> {
3093 value
3094 }
3095 }
3096
3097 unsafe impl fidl::encoding::TypeMarker for TouchButtonsEvent {
3098 type Owned = Self;
3099
3100 #[inline(always)]
3101 fn inline_align(_context: fidl::encoding::Context) -> usize {
3102 8
3103 }
3104
3105 #[inline(always)]
3106 fn inline_size(_context: fidl::encoding::Context) -> usize {
3107 16
3108 }
3109 }
3110
3111 unsafe impl
3112 fidl::encoding::Encode<TouchButtonsEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
3113 for &mut TouchButtonsEvent
3114 {
3115 unsafe fn encode(
3116 self,
3117 encoder: &mut fidl::encoding::Encoder<
3118 '_,
3119 fidl::encoding::DefaultFuchsiaResourceDialect,
3120 >,
3121 offset: usize,
3122 mut depth: fidl::encoding::Depth,
3123 ) -> fidl::Result<()> {
3124 encoder.debug_check_bounds::<TouchButtonsEvent>(offset);
3125 let max_ordinal: u64 = self.max_ordinal_present();
3127 encoder.write_num(max_ordinal, offset);
3128 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3129 if max_ordinal == 0 {
3131 return Ok(());
3132 }
3133 depth.increment()?;
3134 let envelope_size = 8;
3135 let bytes_len = max_ordinal as usize * envelope_size;
3136 #[allow(unused_variables)]
3137 let offset = encoder.out_of_line_offset(bytes_len);
3138 let mut _prev_end_offset: usize = 0;
3139 if 1 > max_ordinal {
3140 return Ok(());
3141 }
3142
3143 let cur_offset: usize = (1 - 1) * envelope_size;
3146
3147 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3149
3150 fidl::encoding::encode_in_envelope_optional::<
3155 fidl::MonotonicInstant,
3156 fidl::encoding::DefaultFuchsiaResourceDialect,
3157 >(
3158 self.event_time
3159 .as_ref()
3160 .map(<fidl::MonotonicInstant as fidl::encoding::ValueTypeMarker>::borrow),
3161 encoder,
3162 offset + cur_offset,
3163 depth,
3164 )?;
3165
3166 _prev_end_offset = cur_offset + envelope_size;
3167 if 2 > max_ordinal {
3168 return Ok(());
3169 }
3170
3171 let cur_offset: usize = (2 - 1) * envelope_size;
3174
3175 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3177
3178 fidl::encoding::encode_in_envelope_optional::<
3183 TouchDeviceInfo,
3184 fidl::encoding::DefaultFuchsiaResourceDialect,
3185 >(
3186 self.device_info
3187 .as_ref()
3188 .map(<TouchDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
3189 encoder,
3190 offset + cur_offset,
3191 depth,
3192 )?;
3193
3194 _prev_end_offset = cur_offset + envelope_size;
3195 if 3 > max_ordinal {
3196 return Ok(());
3197 }
3198
3199 let cur_offset: usize = (3 - 1) * envelope_size;
3202
3203 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3205
3206 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<TouchButton>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3211 self.pressed_buttons.as_ref().map(<fidl::encoding::UnboundedVector<TouchButton> as fidl::encoding::ValueTypeMarker>::borrow),
3212 encoder, offset + cur_offset, depth
3213 )?;
3214
3215 _prev_end_offset = cur_offset + envelope_size;
3216 if 4 > max_ordinal {
3217 return Ok(());
3218 }
3219
3220 let cur_offset: usize = (4 - 1) * envelope_size;
3223
3224 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3226
3227 fidl::encoding::encode_in_envelope_optional::<
3232 fidl::encoding::HandleType<
3233 fidl::EventPair,
3234 { fidl::ObjectType::EVENTPAIR.into_raw() },
3235 2147483648,
3236 >,
3237 fidl::encoding::DefaultFuchsiaResourceDialect,
3238 >(
3239 self.wake_lease.as_mut().map(
3240 <fidl::encoding::HandleType<
3241 fidl::EventPair,
3242 { fidl::ObjectType::EVENTPAIR.into_raw() },
3243 2147483648,
3244 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3245 ),
3246 encoder,
3247 offset + cur_offset,
3248 depth,
3249 )?;
3250
3251 _prev_end_offset = cur_offset + envelope_size;
3252 if 5 > max_ordinal {
3253 return Ok(());
3254 }
3255
3256 let cur_offset: usize = (5 - 1) * envelope_size;
3259
3260 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3262
3263 fidl::encoding::encode_in_envelope_optional::<
3268 u64,
3269 fidl::encoding::DefaultFuchsiaResourceDialect,
3270 >(
3271 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3272 encoder,
3273 offset + cur_offset,
3274 depth,
3275 )?;
3276
3277 _prev_end_offset = cur_offset + envelope_size;
3278
3279 Ok(())
3280 }
3281 }
3282
3283 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3284 for TouchButtonsEvent
3285 {
3286 #[inline(always)]
3287 fn new_empty() -> Self {
3288 Self::default()
3289 }
3290
3291 unsafe fn decode(
3292 &mut self,
3293 decoder: &mut fidl::encoding::Decoder<
3294 '_,
3295 fidl::encoding::DefaultFuchsiaResourceDialect,
3296 >,
3297 offset: usize,
3298 mut depth: fidl::encoding::Depth,
3299 ) -> fidl::Result<()> {
3300 decoder.debug_check_bounds::<Self>(offset);
3301 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3302 None => return Err(fidl::Error::NotNullable),
3303 Some(len) => len,
3304 };
3305 if len == 0 {
3307 return Ok(());
3308 };
3309 depth.increment()?;
3310 let envelope_size = 8;
3311 let bytes_len = len * envelope_size;
3312 let offset = decoder.out_of_line_offset(bytes_len)?;
3313 let mut _next_ordinal_to_read = 0;
3315 let mut next_offset = offset;
3316 let end_offset = offset + bytes_len;
3317 _next_ordinal_to_read += 1;
3318 if next_offset >= end_offset {
3319 return Ok(());
3320 }
3321
3322 while _next_ordinal_to_read < 1 {
3324 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3325 _next_ordinal_to_read += 1;
3326 next_offset += envelope_size;
3327 }
3328
3329 let next_out_of_line = decoder.next_out_of_line();
3330 let handles_before = decoder.remaining_handles();
3331 if let Some((inlined, num_bytes, num_handles)) =
3332 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3333 {
3334 let member_inline_size =
3335 <fidl::MonotonicInstant as fidl::encoding::TypeMarker>::inline_size(
3336 decoder.context,
3337 );
3338 if inlined != (member_inline_size <= 4) {
3339 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3340 }
3341 let inner_offset;
3342 let mut inner_depth = depth.clone();
3343 if inlined {
3344 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3345 inner_offset = next_offset;
3346 } else {
3347 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3348 inner_depth.increment()?;
3349 }
3350 let val_ref = self.event_time.get_or_insert_with(|| {
3351 fidl::new_empty!(
3352 fidl::MonotonicInstant,
3353 fidl::encoding::DefaultFuchsiaResourceDialect
3354 )
3355 });
3356 fidl::decode!(
3357 fidl::MonotonicInstant,
3358 fidl::encoding::DefaultFuchsiaResourceDialect,
3359 val_ref,
3360 decoder,
3361 inner_offset,
3362 inner_depth
3363 )?;
3364 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3365 {
3366 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3367 }
3368 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3369 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3370 }
3371 }
3372
3373 next_offset += envelope_size;
3374 _next_ordinal_to_read += 1;
3375 if next_offset >= end_offset {
3376 return Ok(());
3377 }
3378
3379 while _next_ordinal_to_read < 2 {
3381 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3382 _next_ordinal_to_read += 1;
3383 next_offset += envelope_size;
3384 }
3385
3386 let next_out_of_line = decoder.next_out_of_line();
3387 let handles_before = decoder.remaining_handles();
3388 if let Some((inlined, num_bytes, num_handles)) =
3389 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3390 {
3391 let member_inline_size =
3392 <TouchDeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3393 if inlined != (member_inline_size <= 4) {
3394 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3395 }
3396 let inner_offset;
3397 let mut inner_depth = depth.clone();
3398 if inlined {
3399 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3400 inner_offset = next_offset;
3401 } else {
3402 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3403 inner_depth.increment()?;
3404 }
3405 let val_ref = self.device_info.get_or_insert_with(|| {
3406 fidl::new_empty!(TouchDeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect)
3407 });
3408 fidl::decode!(
3409 TouchDeviceInfo,
3410 fidl::encoding::DefaultFuchsiaResourceDialect,
3411 val_ref,
3412 decoder,
3413 inner_offset,
3414 inner_depth
3415 )?;
3416 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3417 {
3418 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3419 }
3420 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3421 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3422 }
3423 }
3424
3425 next_offset += envelope_size;
3426 _next_ordinal_to_read += 1;
3427 if next_offset >= end_offset {
3428 return Ok(());
3429 }
3430
3431 while _next_ordinal_to_read < 3 {
3433 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3434 _next_ordinal_to_read += 1;
3435 next_offset += envelope_size;
3436 }
3437
3438 let next_out_of_line = decoder.next_out_of_line();
3439 let handles_before = decoder.remaining_handles();
3440 if let Some((inlined, num_bytes, num_handles)) =
3441 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3442 {
3443 let member_inline_size = <fidl::encoding::UnboundedVector<TouchButton> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3444 if inlined != (member_inline_size <= 4) {
3445 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3446 }
3447 let inner_offset;
3448 let mut inner_depth = depth.clone();
3449 if inlined {
3450 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3451 inner_offset = next_offset;
3452 } else {
3453 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3454 inner_depth.increment()?;
3455 }
3456 let val_ref = self.pressed_buttons.get_or_insert_with(|| {
3457 fidl::new_empty!(
3458 fidl::encoding::UnboundedVector<TouchButton>,
3459 fidl::encoding::DefaultFuchsiaResourceDialect
3460 )
3461 });
3462 fidl::decode!(
3463 fidl::encoding::UnboundedVector<TouchButton>,
3464 fidl::encoding::DefaultFuchsiaResourceDialect,
3465 val_ref,
3466 decoder,
3467 inner_offset,
3468 inner_depth
3469 )?;
3470 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3471 {
3472 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3473 }
3474 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3475 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3476 }
3477 }
3478
3479 next_offset += envelope_size;
3480 _next_ordinal_to_read += 1;
3481 if next_offset >= end_offset {
3482 return Ok(());
3483 }
3484
3485 while _next_ordinal_to_read < 4 {
3487 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3488 _next_ordinal_to_read += 1;
3489 next_offset += envelope_size;
3490 }
3491
3492 let next_out_of_line = decoder.next_out_of_line();
3493 let handles_before = decoder.remaining_handles();
3494 if let Some((inlined, num_bytes, num_handles)) =
3495 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3496 {
3497 let member_inline_size = <fidl::encoding::HandleType<
3498 fidl::EventPair,
3499 { fidl::ObjectType::EVENTPAIR.into_raw() },
3500 2147483648,
3501 > as fidl::encoding::TypeMarker>::inline_size(
3502 decoder.context
3503 );
3504 if inlined != (member_inline_size <= 4) {
3505 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3506 }
3507 let inner_offset;
3508 let mut inner_depth = depth.clone();
3509 if inlined {
3510 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3511 inner_offset = next_offset;
3512 } else {
3513 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3514 inner_depth.increment()?;
3515 }
3516 let val_ref =
3517 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3518 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3519 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3520 {
3521 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3522 }
3523 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3524 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3525 }
3526 }
3527
3528 next_offset += envelope_size;
3529 _next_ordinal_to_read += 1;
3530 if next_offset >= end_offset {
3531 return Ok(());
3532 }
3533
3534 while _next_ordinal_to_read < 5 {
3536 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3537 _next_ordinal_to_read += 1;
3538 next_offset += envelope_size;
3539 }
3540
3541 let next_out_of_line = decoder.next_out_of_line();
3542 let handles_before = decoder.remaining_handles();
3543 if let Some((inlined, num_bytes, num_handles)) =
3544 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3545 {
3546 let member_inline_size =
3547 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3548 if inlined != (member_inline_size <= 4) {
3549 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3550 }
3551 let inner_offset;
3552 let mut inner_depth = depth.clone();
3553 if inlined {
3554 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3555 inner_offset = next_offset;
3556 } else {
3557 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3558 inner_depth.increment()?;
3559 }
3560 let val_ref = self.trace_flow_id.get_or_insert_with(|| {
3561 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3562 });
3563 fidl::decode!(
3564 u64,
3565 fidl::encoding::DefaultFuchsiaResourceDialect,
3566 val_ref,
3567 decoder,
3568 inner_offset,
3569 inner_depth
3570 )?;
3571 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3572 {
3573 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3574 }
3575 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3576 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3577 }
3578 }
3579
3580 next_offset += envelope_size;
3581
3582 while next_offset < end_offset {
3584 _next_ordinal_to_read += 1;
3585 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3586 next_offset += envelope_size;
3587 }
3588
3589 Ok(())
3590 }
3591 }
3592}