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 ImeServiceControlHandle {
536 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
537 self.inner.shutdown_with_epitaph(status.into())
538 }
539}
540
541impl fidl::endpoints::ControlHandle for ImeServiceControlHandle {
542 fn shutdown(&self) {
543 self.inner.shutdown()
544 }
545
546 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
547 self.inner.shutdown_with_epitaph(status)
548 }
549
550 fn is_closed(&self) -> bool {
551 self.inner.channel().is_closed()
552 }
553 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
554 self.inner.channel().on_closed()
555 }
556
557 #[cfg(target_os = "fuchsia")]
558 fn signal_peer(
559 &self,
560 clear_mask: zx::Signals,
561 set_mask: zx::Signals,
562 ) -> Result<(), zx_status::Status> {
563 use fidl::Peered;
564 self.inner.channel().signal_peer(clear_mask, set_mask)
565 }
566}
567
568impl ImeServiceControlHandle {}
569
570#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
571pub struct InputDeviceMarker;
572
573impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
574 type Proxy = InputDeviceProxy;
575 type RequestStream = InputDeviceRequestStream;
576 #[cfg(target_os = "fuchsia")]
577 type SynchronousProxy = InputDeviceSynchronousProxy;
578
579 const DEBUG_NAME: &'static str = "(anonymous) InputDevice";
580}
581
582pub trait InputDeviceProxyInterface: Send + Sync {
583 fn r#dispatch_report(&self, report: &InputReport) -> Result<(), fidl::Error>;
584}
585#[derive(Debug)]
586#[cfg(target_os = "fuchsia")]
587pub struct InputDeviceSynchronousProxy {
588 client: fidl::client::sync::Client,
589}
590
591#[cfg(target_os = "fuchsia")]
592impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
593 type Proxy = InputDeviceProxy;
594 type Protocol = InputDeviceMarker;
595
596 fn from_channel(inner: fidl::Channel) -> Self {
597 Self::new(inner)
598 }
599
600 fn into_channel(self) -> fidl::Channel {
601 self.client.into_channel()
602 }
603
604 fn as_channel(&self) -> &fidl::Channel {
605 self.client.as_channel()
606 }
607}
608
609#[cfg(target_os = "fuchsia")]
610impl InputDeviceSynchronousProxy {
611 pub fn new(channel: fidl::Channel) -> Self {
612 Self { client: fidl::client::sync::Client::new(channel) }
613 }
614
615 pub fn into_channel(self) -> fidl::Channel {
616 self.client.into_channel()
617 }
618
619 pub fn wait_for_event(
622 &self,
623 deadline: zx::MonotonicInstant,
624 ) -> Result<InputDeviceEvent, fidl::Error> {
625 InputDeviceEvent::decode(self.client.wait_for_event::<InputDeviceMarker>(deadline)?)
626 }
627
628 pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
630 self.client.send::<InputDeviceDispatchReportRequest>(
631 (report,),
632 0x7ee375d01c8e149f,
633 fidl::encoding::DynamicFlags::empty(),
634 )
635 }
636}
637
638#[cfg(target_os = "fuchsia")]
639impl From<InputDeviceSynchronousProxy> for zx::NullableHandle {
640 fn from(value: InputDeviceSynchronousProxy) -> Self {
641 value.into_channel().into()
642 }
643}
644
645#[cfg(target_os = "fuchsia")]
646impl From<fidl::Channel> for InputDeviceSynchronousProxy {
647 fn from(value: fidl::Channel) -> Self {
648 Self::new(value)
649 }
650}
651
652#[cfg(target_os = "fuchsia")]
653impl fidl::endpoints::FromClient for InputDeviceSynchronousProxy {
654 type Protocol = InputDeviceMarker;
655
656 fn from_client(value: fidl::endpoints::ClientEnd<InputDeviceMarker>) -> Self {
657 Self::new(value.into_channel())
658 }
659}
660
661#[derive(Debug, Clone)]
662pub struct InputDeviceProxy {
663 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
664}
665
666impl fidl::endpoints::Proxy for InputDeviceProxy {
667 type Protocol = InputDeviceMarker;
668
669 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
670 Self::new(inner)
671 }
672
673 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
674 self.client.into_channel().map_err(|client| Self { client })
675 }
676
677 fn as_channel(&self) -> &::fidl::AsyncChannel {
678 self.client.as_channel()
679 }
680}
681
682impl InputDeviceProxy {
683 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
685 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
686 Self { client: fidl::client::Client::new(channel, protocol_name) }
687 }
688
689 pub fn take_event_stream(&self) -> InputDeviceEventStream {
695 InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
696 }
697
698 pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
700 InputDeviceProxyInterface::r#dispatch_report(self, report)
701 }
702}
703
704impl InputDeviceProxyInterface for InputDeviceProxy {
705 fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
706 self.client.send::<InputDeviceDispatchReportRequest>(
707 (report,),
708 0x7ee375d01c8e149f,
709 fidl::encoding::DynamicFlags::empty(),
710 )
711 }
712}
713
714pub struct InputDeviceEventStream {
715 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
716}
717
718impl std::marker::Unpin for InputDeviceEventStream {}
719
720impl futures::stream::FusedStream for InputDeviceEventStream {
721 fn is_terminated(&self) -> bool {
722 self.event_receiver.is_terminated()
723 }
724}
725
726impl futures::Stream for InputDeviceEventStream {
727 type Item = Result<InputDeviceEvent, fidl::Error>;
728
729 fn poll_next(
730 mut self: std::pin::Pin<&mut Self>,
731 cx: &mut std::task::Context<'_>,
732 ) -> std::task::Poll<Option<Self::Item>> {
733 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
734 &mut self.event_receiver,
735 cx
736 )?) {
737 Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
738 None => std::task::Poll::Ready(None),
739 }
740 }
741}
742
743#[derive(Debug)]
744pub enum InputDeviceEvent {}
745
746impl InputDeviceEvent {
747 fn decode(
749 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
750 ) -> Result<InputDeviceEvent, fidl::Error> {
751 let (bytes, _handles) = buf.split_mut();
752 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
753 debug_assert_eq!(tx_header.tx_id, 0);
754 match tx_header.ordinal {
755 _ => Err(fidl::Error::UnknownOrdinal {
756 ordinal: tx_header.ordinal,
757 protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
758 }),
759 }
760 }
761}
762
763pub struct InputDeviceRequestStream {
765 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
766 is_terminated: bool,
767}
768
769impl std::marker::Unpin for InputDeviceRequestStream {}
770
771impl futures::stream::FusedStream for InputDeviceRequestStream {
772 fn is_terminated(&self) -> bool {
773 self.is_terminated
774 }
775}
776
777impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
778 type Protocol = InputDeviceMarker;
779 type ControlHandle = InputDeviceControlHandle;
780
781 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
782 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
783 }
784
785 fn control_handle(&self) -> Self::ControlHandle {
786 InputDeviceControlHandle { inner: self.inner.clone() }
787 }
788
789 fn into_inner(
790 self,
791 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
792 {
793 (self.inner, self.is_terminated)
794 }
795
796 fn from_inner(
797 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
798 is_terminated: bool,
799 ) -> Self {
800 Self { inner, is_terminated }
801 }
802}
803
804impl futures::Stream for InputDeviceRequestStream {
805 type Item = Result<InputDeviceRequest, fidl::Error>;
806
807 fn poll_next(
808 mut self: std::pin::Pin<&mut Self>,
809 cx: &mut std::task::Context<'_>,
810 ) -> std::task::Poll<Option<Self::Item>> {
811 let this = &mut *self;
812 if this.inner.check_shutdown(cx) {
813 this.is_terminated = true;
814 return std::task::Poll::Ready(None);
815 }
816 if this.is_terminated {
817 panic!("polled InputDeviceRequestStream after completion");
818 }
819 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
820 |bytes, handles| {
821 match this.inner.channel().read_etc(cx, bytes, handles) {
822 std::task::Poll::Ready(Ok(())) => {}
823 std::task::Poll::Pending => return std::task::Poll::Pending,
824 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
825 this.is_terminated = true;
826 return std::task::Poll::Ready(None);
827 }
828 std::task::Poll::Ready(Err(e)) => {
829 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
830 e.into(),
831 ))));
832 }
833 }
834
835 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
837
838 std::task::Poll::Ready(Some(match header.ordinal {
839 0x7ee375d01c8e149f => {
840 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
841 let mut req = fidl::new_empty!(
842 InputDeviceDispatchReportRequest,
843 fidl::encoding::DefaultFuchsiaResourceDialect
844 );
845 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceDispatchReportRequest>(&header, _body_bytes, handles, &mut req)?;
846 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
847 Ok(InputDeviceRequest::DispatchReport {
848 report: req.report,
849
850 control_handle,
851 })
852 }
853 _ => Err(fidl::Error::UnknownOrdinal {
854 ordinal: header.ordinal,
855 protocol_name:
856 <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
857 }),
858 }))
859 },
860 )
861 }
862}
863
864#[derive(Debug)]
865pub enum InputDeviceRequest {
866 DispatchReport { report: InputReport, control_handle: InputDeviceControlHandle },
868}
869
870impl InputDeviceRequest {
871 #[allow(irrefutable_let_patterns)]
872 pub fn into_dispatch_report(self) -> Option<(InputReport, InputDeviceControlHandle)> {
873 if let InputDeviceRequest::DispatchReport { report, control_handle } = self {
874 Some((report, control_handle))
875 } else {
876 None
877 }
878 }
879
880 pub fn method_name(&self) -> &'static str {
882 match *self {
883 InputDeviceRequest::DispatchReport { .. } => "dispatch_report",
884 }
885 }
886}
887
888#[derive(Debug, Clone)]
889pub struct InputDeviceControlHandle {
890 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
891}
892
893impl InputDeviceControlHandle {
894 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
895 self.inner.shutdown_with_epitaph(status.into())
896 }
897}
898
899impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
900 fn shutdown(&self) {
901 self.inner.shutdown()
902 }
903
904 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
905 self.inner.shutdown_with_epitaph(status)
906 }
907
908 fn is_closed(&self) -> bool {
909 self.inner.channel().is_closed()
910 }
911 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
912 self.inner.channel().on_closed()
913 }
914
915 #[cfg(target_os = "fuchsia")]
916 fn signal_peer(
917 &self,
918 clear_mask: zx::Signals,
919 set_mask: zx::Signals,
920 ) -> Result<(), zx_status::Status> {
921 use fidl::Peered;
922 self.inner.channel().signal_peer(clear_mask, set_mask)
923 }
924}
925
926impl InputDeviceControlHandle {}
927
928#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
929pub struct InputMethodEditorMarker;
930
931impl fidl::endpoints::ProtocolMarker for InputMethodEditorMarker {
932 type Proxy = InputMethodEditorProxy;
933 type RequestStream = InputMethodEditorRequestStream;
934 #[cfg(target_os = "fuchsia")]
935 type SynchronousProxy = InputMethodEditorSynchronousProxy;
936
937 const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditor";
938}
939
940pub trait InputMethodEditorProxyInterface: Send + Sync {
941 fn r#set_keyboard_type(&self, keyboard_type: KeyboardType) -> Result<(), fidl::Error>;
942 fn r#set_state(&self, state: &TextInputState) -> Result<(), fidl::Error>;
943 fn r#inject_input(&self, event: &InputEvent) -> Result<(), fidl::Error>;
944 type DispatchKey3ResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
945 fn r#dispatch_key3(
946 &self,
947 event: &fidl_fuchsia_ui_input3::KeyEvent,
948 ) -> Self::DispatchKey3ResponseFut;
949 fn r#show(&self) -> Result<(), fidl::Error>;
950 fn r#hide(&self) -> Result<(), fidl::Error>;
951}
952#[derive(Debug)]
953#[cfg(target_os = "fuchsia")]
954pub struct InputMethodEditorSynchronousProxy {
955 client: fidl::client::sync::Client,
956}
957
958#[cfg(target_os = "fuchsia")]
959impl fidl::endpoints::SynchronousProxy for InputMethodEditorSynchronousProxy {
960 type Proxy = InputMethodEditorProxy;
961 type Protocol = InputMethodEditorMarker;
962
963 fn from_channel(inner: fidl::Channel) -> Self {
964 Self::new(inner)
965 }
966
967 fn into_channel(self) -> fidl::Channel {
968 self.client.into_channel()
969 }
970
971 fn as_channel(&self) -> &fidl::Channel {
972 self.client.as_channel()
973 }
974}
975
976#[cfg(target_os = "fuchsia")]
977impl InputMethodEditorSynchronousProxy {
978 pub fn new(channel: fidl::Channel) -> Self {
979 Self { client: fidl::client::sync::Client::new(channel) }
980 }
981
982 pub fn into_channel(self) -> fidl::Channel {
983 self.client.into_channel()
984 }
985
986 pub fn wait_for_event(
989 &self,
990 deadline: zx::MonotonicInstant,
991 ) -> Result<InputMethodEditorEvent, fidl::Error> {
992 InputMethodEditorEvent::decode(
993 self.client.wait_for_event::<InputMethodEditorMarker>(deadline)?,
994 )
995 }
996
997 pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
998 self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
999 (keyboard_type,),
1000 0x14fe60e927d7d487,
1001 fidl::encoding::DynamicFlags::empty(),
1002 )
1003 }
1004
1005 pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
1006 self.client.send::<InputMethodEditorSetStateRequest>(
1007 (state,),
1008 0x12b477b779818f45,
1009 fidl::encoding::DynamicFlags::empty(),
1010 )
1011 }
1012
1013 pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
1014 self.client.send::<InputMethodEditorInjectInputRequest>(
1015 (event,),
1016 0x34af74618a4f82b,
1017 fidl::encoding::DynamicFlags::empty(),
1018 )
1019 }
1020
1021 pub fn r#dispatch_key3(
1022 &self,
1023 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
1024 ___deadline: zx::MonotonicInstant,
1025 ) -> Result<bool, fidl::Error> {
1026 let _response = self.client.send_query::<
1027 InputMethodEditorDispatchKey3Request,
1028 InputMethodEditorDispatchKey3Response,
1029 InputMethodEditorMarker,
1030 >(
1031 (event,),
1032 0x2e13667c827209ac,
1033 fidl::encoding::DynamicFlags::empty(),
1034 ___deadline,
1035 )?;
1036 Ok(_response.handled)
1037 }
1038
1039 pub fn r#show(&self) -> Result<(), fidl::Error> {
1040 self.client.send::<fidl::encoding::EmptyPayload>(
1041 (),
1042 0x19ba00ba1beb002e,
1043 fidl::encoding::DynamicFlags::empty(),
1044 )
1045 }
1046
1047 pub fn r#hide(&self) -> Result<(), fidl::Error> {
1048 self.client.send::<fidl::encoding::EmptyPayload>(
1049 (),
1050 0x283e0cd73f0d6d9e,
1051 fidl::encoding::DynamicFlags::empty(),
1052 )
1053 }
1054}
1055
1056#[cfg(target_os = "fuchsia")]
1057impl From<InputMethodEditorSynchronousProxy> for zx::NullableHandle {
1058 fn from(value: InputMethodEditorSynchronousProxy) -> Self {
1059 value.into_channel().into()
1060 }
1061}
1062
1063#[cfg(target_os = "fuchsia")]
1064impl From<fidl::Channel> for InputMethodEditorSynchronousProxy {
1065 fn from(value: fidl::Channel) -> Self {
1066 Self::new(value)
1067 }
1068}
1069
1070#[cfg(target_os = "fuchsia")]
1071impl fidl::endpoints::FromClient for InputMethodEditorSynchronousProxy {
1072 type Protocol = InputMethodEditorMarker;
1073
1074 fn from_client(value: fidl::endpoints::ClientEnd<InputMethodEditorMarker>) -> Self {
1075 Self::new(value.into_channel())
1076 }
1077}
1078
1079#[derive(Debug, Clone)]
1080pub struct InputMethodEditorProxy {
1081 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1082}
1083
1084impl fidl::endpoints::Proxy for InputMethodEditorProxy {
1085 type Protocol = InputMethodEditorMarker;
1086
1087 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1088 Self::new(inner)
1089 }
1090
1091 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1092 self.client.into_channel().map_err(|client| Self { client })
1093 }
1094
1095 fn as_channel(&self) -> &::fidl::AsyncChannel {
1096 self.client.as_channel()
1097 }
1098}
1099
1100impl InputMethodEditorProxy {
1101 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1103 let protocol_name =
1104 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1105 Self { client: fidl::client::Client::new(channel, protocol_name) }
1106 }
1107
1108 pub fn take_event_stream(&self) -> InputMethodEditorEventStream {
1114 InputMethodEditorEventStream { event_receiver: self.client.take_event_receiver() }
1115 }
1116
1117 pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
1118 InputMethodEditorProxyInterface::r#set_keyboard_type(self, keyboard_type)
1119 }
1120
1121 pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
1122 InputMethodEditorProxyInterface::r#set_state(self, state)
1123 }
1124
1125 pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
1126 InputMethodEditorProxyInterface::r#inject_input(self, event)
1127 }
1128
1129 pub fn r#dispatch_key3(
1130 &self,
1131 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
1132 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
1133 InputMethodEditorProxyInterface::r#dispatch_key3(self, event)
1134 }
1135
1136 pub fn r#show(&self) -> Result<(), fidl::Error> {
1137 InputMethodEditorProxyInterface::r#show(self)
1138 }
1139
1140 pub fn r#hide(&self) -> Result<(), fidl::Error> {
1141 InputMethodEditorProxyInterface::r#hide(self)
1142 }
1143}
1144
1145impl InputMethodEditorProxyInterface for InputMethodEditorProxy {
1146 fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
1147 self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
1148 (keyboard_type,),
1149 0x14fe60e927d7d487,
1150 fidl::encoding::DynamicFlags::empty(),
1151 )
1152 }
1153
1154 fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
1155 self.client.send::<InputMethodEditorSetStateRequest>(
1156 (state,),
1157 0x12b477b779818f45,
1158 fidl::encoding::DynamicFlags::empty(),
1159 )
1160 }
1161
1162 fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
1163 self.client.send::<InputMethodEditorInjectInputRequest>(
1164 (event,),
1165 0x34af74618a4f82b,
1166 fidl::encoding::DynamicFlags::empty(),
1167 )
1168 }
1169
1170 type DispatchKey3ResponseFut =
1171 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
1172 fn r#dispatch_key3(
1173 &self,
1174 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
1175 ) -> Self::DispatchKey3ResponseFut {
1176 fn _decode(
1177 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1178 ) -> Result<bool, fidl::Error> {
1179 let _response = fidl::client::decode_transaction_body::<
1180 InputMethodEditorDispatchKey3Response,
1181 fidl::encoding::DefaultFuchsiaResourceDialect,
1182 0x2e13667c827209ac,
1183 >(_buf?)?;
1184 Ok(_response.handled)
1185 }
1186 self.client.send_query_and_decode::<InputMethodEditorDispatchKey3Request, bool>(
1187 (event,),
1188 0x2e13667c827209ac,
1189 fidl::encoding::DynamicFlags::empty(),
1190 _decode,
1191 )
1192 }
1193
1194 fn r#show(&self) -> Result<(), fidl::Error> {
1195 self.client.send::<fidl::encoding::EmptyPayload>(
1196 (),
1197 0x19ba00ba1beb002e,
1198 fidl::encoding::DynamicFlags::empty(),
1199 )
1200 }
1201
1202 fn r#hide(&self) -> Result<(), fidl::Error> {
1203 self.client.send::<fidl::encoding::EmptyPayload>(
1204 (),
1205 0x283e0cd73f0d6d9e,
1206 fidl::encoding::DynamicFlags::empty(),
1207 )
1208 }
1209}
1210
1211pub struct InputMethodEditorEventStream {
1212 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1213}
1214
1215impl std::marker::Unpin for InputMethodEditorEventStream {}
1216
1217impl futures::stream::FusedStream for InputMethodEditorEventStream {
1218 fn is_terminated(&self) -> bool {
1219 self.event_receiver.is_terminated()
1220 }
1221}
1222
1223impl futures::Stream for InputMethodEditorEventStream {
1224 type Item = Result<InputMethodEditorEvent, fidl::Error>;
1225
1226 fn poll_next(
1227 mut self: std::pin::Pin<&mut Self>,
1228 cx: &mut std::task::Context<'_>,
1229 ) -> std::task::Poll<Option<Self::Item>> {
1230 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1231 &mut self.event_receiver,
1232 cx
1233 )?) {
1234 Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorEvent::decode(buf))),
1235 None => std::task::Poll::Ready(None),
1236 }
1237 }
1238}
1239
1240#[derive(Debug)]
1241pub enum InputMethodEditorEvent {}
1242
1243impl InputMethodEditorEvent {
1244 fn decode(
1246 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1247 ) -> Result<InputMethodEditorEvent, fidl::Error> {
1248 let (bytes, _handles) = buf.split_mut();
1249 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1250 debug_assert_eq!(tx_header.tx_id, 0);
1251 match tx_header.ordinal {
1252 _ => Err(fidl::Error::UnknownOrdinal {
1253 ordinal: tx_header.ordinal,
1254 protocol_name:
1255 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1256 }),
1257 }
1258 }
1259}
1260
1261pub struct InputMethodEditorRequestStream {
1263 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1264 is_terminated: bool,
1265}
1266
1267impl std::marker::Unpin for InputMethodEditorRequestStream {}
1268
1269impl futures::stream::FusedStream for InputMethodEditorRequestStream {
1270 fn is_terminated(&self) -> bool {
1271 self.is_terminated
1272 }
1273}
1274
1275impl fidl::endpoints::RequestStream for InputMethodEditorRequestStream {
1276 type Protocol = InputMethodEditorMarker;
1277 type ControlHandle = InputMethodEditorControlHandle;
1278
1279 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1280 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1281 }
1282
1283 fn control_handle(&self) -> Self::ControlHandle {
1284 InputMethodEditorControlHandle { inner: self.inner.clone() }
1285 }
1286
1287 fn into_inner(
1288 self,
1289 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1290 {
1291 (self.inner, self.is_terminated)
1292 }
1293
1294 fn from_inner(
1295 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1296 is_terminated: bool,
1297 ) -> Self {
1298 Self { inner, is_terminated }
1299 }
1300}
1301
1302impl futures::Stream for InputMethodEditorRequestStream {
1303 type Item = Result<InputMethodEditorRequest, fidl::Error>;
1304
1305 fn poll_next(
1306 mut self: std::pin::Pin<&mut Self>,
1307 cx: &mut std::task::Context<'_>,
1308 ) -> std::task::Poll<Option<Self::Item>> {
1309 let this = &mut *self;
1310 if this.inner.check_shutdown(cx) {
1311 this.is_terminated = true;
1312 return std::task::Poll::Ready(None);
1313 }
1314 if this.is_terminated {
1315 panic!("polled InputMethodEditorRequestStream after completion");
1316 }
1317 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1318 |bytes, handles| {
1319 match this.inner.channel().read_etc(cx, bytes, handles) {
1320 std::task::Poll::Ready(Ok(())) => {}
1321 std::task::Poll::Pending => return std::task::Poll::Pending,
1322 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1323 this.is_terminated = true;
1324 return std::task::Poll::Ready(None);
1325 }
1326 std::task::Poll::Ready(Err(e)) => {
1327 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1328 e.into(),
1329 ))));
1330 }
1331 }
1332
1333 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1335
1336 std::task::Poll::Ready(Some(match header.ordinal {
1337 0x14fe60e927d7d487 => {
1338 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1339 let mut req = fidl::new_empty!(
1340 InputMethodEditorSetKeyboardTypeRequest,
1341 fidl::encoding::DefaultFuchsiaResourceDialect
1342 );
1343 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorSetKeyboardTypeRequest>(&header, _body_bytes, handles, &mut req)?;
1344 let control_handle =
1345 InputMethodEditorControlHandle { inner: this.inner.clone() };
1346 Ok(InputMethodEditorRequest::SetKeyboardType {
1347 keyboard_type: req.keyboard_type,
1348
1349 control_handle,
1350 })
1351 }
1352 0x12b477b779818f45 => {
1353 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1354 let mut req = fidl::new_empty!(
1355 InputMethodEditorSetStateRequest,
1356 fidl::encoding::DefaultFuchsiaResourceDialect
1357 );
1358 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorSetStateRequest>(&header, _body_bytes, handles, &mut req)?;
1359 let control_handle =
1360 InputMethodEditorControlHandle { inner: this.inner.clone() };
1361 Ok(InputMethodEditorRequest::SetState { state: req.state, control_handle })
1362 }
1363 0x34af74618a4f82b => {
1364 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1365 let mut req = fidl::new_empty!(
1366 InputMethodEditorInjectInputRequest,
1367 fidl::encoding::DefaultFuchsiaResourceDialect
1368 );
1369 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorInjectInputRequest>(&header, _body_bytes, handles, &mut req)?;
1370 let control_handle =
1371 InputMethodEditorControlHandle { inner: this.inner.clone() };
1372 Ok(InputMethodEditorRequest::InjectInput {
1373 event: req.event,
1374
1375 control_handle,
1376 })
1377 }
1378 0x2e13667c827209ac => {
1379 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1380 let mut req = fidl::new_empty!(
1381 InputMethodEditorDispatchKey3Request,
1382 fidl::encoding::DefaultFuchsiaResourceDialect
1383 );
1384 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorDispatchKey3Request>(&header, _body_bytes, handles, &mut req)?;
1385 let control_handle =
1386 InputMethodEditorControlHandle { inner: this.inner.clone() };
1387 Ok(InputMethodEditorRequest::DispatchKey3 {
1388 event: req.event,
1389
1390 responder: InputMethodEditorDispatchKey3Responder {
1391 control_handle: std::mem::ManuallyDrop::new(control_handle),
1392 tx_id: header.tx_id,
1393 },
1394 })
1395 }
1396 0x19ba00ba1beb002e => {
1397 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1398 let mut req = fidl::new_empty!(
1399 fidl::encoding::EmptyPayload,
1400 fidl::encoding::DefaultFuchsiaResourceDialect
1401 );
1402 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1403 let control_handle =
1404 InputMethodEditorControlHandle { inner: this.inner.clone() };
1405 Ok(InputMethodEditorRequest::Show { control_handle })
1406 }
1407 0x283e0cd73f0d6d9e => {
1408 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1409 let mut req = fidl::new_empty!(
1410 fidl::encoding::EmptyPayload,
1411 fidl::encoding::DefaultFuchsiaResourceDialect
1412 );
1413 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1414 let control_handle =
1415 InputMethodEditorControlHandle { inner: this.inner.clone() };
1416 Ok(InputMethodEditorRequest::Hide { control_handle })
1417 }
1418 _ => Err(fidl::Error::UnknownOrdinal {
1419 ordinal: header.ordinal,
1420 protocol_name:
1421 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1422 }),
1423 }))
1424 },
1425 )
1426 }
1427}
1428
1429#[derive(Debug)]
1431pub enum InputMethodEditorRequest {
1432 SetKeyboardType {
1433 keyboard_type: KeyboardType,
1434 control_handle: InputMethodEditorControlHandle,
1435 },
1436 SetState {
1437 state: TextInputState,
1438 control_handle: InputMethodEditorControlHandle,
1439 },
1440 InjectInput {
1441 event: InputEvent,
1442 control_handle: InputMethodEditorControlHandle,
1443 },
1444 DispatchKey3 {
1445 event: fidl_fuchsia_ui_input3::KeyEvent,
1446 responder: InputMethodEditorDispatchKey3Responder,
1447 },
1448 Show {
1449 control_handle: InputMethodEditorControlHandle,
1450 },
1451 Hide {
1452 control_handle: InputMethodEditorControlHandle,
1453 },
1454}
1455
1456impl InputMethodEditorRequest {
1457 #[allow(irrefutable_let_patterns)]
1458 pub fn into_set_keyboard_type(self) -> Option<(KeyboardType, InputMethodEditorControlHandle)> {
1459 if let InputMethodEditorRequest::SetKeyboardType { keyboard_type, control_handle } = self {
1460 Some((keyboard_type, control_handle))
1461 } else {
1462 None
1463 }
1464 }
1465
1466 #[allow(irrefutable_let_patterns)]
1467 pub fn into_set_state(self) -> Option<(TextInputState, InputMethodEditorControlHandle)> {
1468 if let InputMethodEditorRequest::SetState { state, control_handle } = self {
1469 Some((state, control_handle))
1470 } else {
1471 None
1472 }
1473 }
1474
1475 #[allow(irrefutable_let_patterns)]
1476 pub fn into_inject_input(self) -> Option<(InputEvent, InputMethodEditorControlHandle)> {
1477 if let InputMethodEditorRequest::InjectInput { event, control_handle } = self {
1478 Some((event, control_handle))
1479 } else {
1480 None
1481 }
1482 }
1483
1484 #[allow(irrefutable_let_patterns)]
1485 pub fn into_dispatch_key3(
1486 self,
1487 ) -> Option<(fidl_fuchsia_ui_input3::KeyEvent, InputMethodEditorDispatchKey3Responder)> {
1488 if let InputMethodEditorRequest::DispatchKey3 { event, responder } = self {
1489 Some((event, responder))
1490 } else {
1491 None
1492 }
1493 }
1494
1495 #[allow(irrefutable_let_patterns)]
1496 pub fn into_show(self) -> Option<(InputMethodEditorControlHandle)> {
1497 if let InputMethodEditorRequest::Show { control_handle } = self {
1498 Some((control_handle))
1499 } else {
1500 None
1501 }
1502 }
1503
1504 #[allow(irrefutable_let_patterns)]
1505 pub fn into_hide(self) -> Option<(InputMethodEditorControlHandle)> {
1506 if let InputMethodEditorRequest::Hide { control_handle } = self {
1507 Some((control_handle))
1508 } else {
1509 None
1510 }
1511 }
1512
1513 pub fn method_name(&self) -> &'static str {
1515 match *self {
1516 InputMethodEditorRequest::SetKeyboardType { .. } => "set_keyboard_type",
1517 InputMethodEditorRequest::SetState { .. } => "set_state",
1518 InputMethodEditorRequest::InjectInput { .. } => "inject_input",
1519 InputMethodEditorRequest::DispatchKey3 { .. } => "dispatch_key3",
1520 InputMethodEditorRequest::Show { .. } => "show",
1521 InputMethodEditorRequest::Hide { .. } => "hide",
1522 }
1523 }
1524}
1525
1526#[derive(Debug, Clone)]
1527pub struct InputMethodEditorControlHandle {
1528 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1529}
1530
1531impl InputMethodEditorControlHandle {
1532 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1533 self.inner.shutdown_with_epitaph(status.into())
1534 }
1535}
1536
1537impl fidl::endpoints::ControlHandle for InputMethodEditorControlHandle {
1538 fn shutdown(&self) {
1539 self.inner.shutdown()
1540 }
1541
1542 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1543 self.inner.shutdown_with_epitaph(status)
1544 }
1545
1546 fn is_closed(&self) -> bool {
1547 self.inner.channel().is_closed()
1548 }
1549 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1550 self.inner.channel().on_closed()
1551 }
1552
1553 #[cfg(target_os = "fuchsia")]
1554 fn signal_peer(
1555 &self,
1556 clear_mask: zx::Signals,
1557 set_mask: zx::Signals,
1558 ) -> Result<(), zx_status::Status> {
1559 use fidl::Peered;
1560 self.inner.channel().signal_peer(clear_mask, set_mask)
1561 }
1562}
1563
1564impl InputMethodEditorControlHandle {}
1565
1566#[must_use = "FIDL methods require a response to be sent"]
1567#[derive(Debug)]
1568pub struct InputMethodEditorDispatchKey3Responder {
1569 control_handle: std::mem::ManuallyDrop<InputMethodEditorControlHandle>,
1570 tx_id: u32,
1571}
1572
1573impl std::ops::Drop for InputMethodEditorDispatchKey3Responder {
1577 fn drop(&mut self) {
1578 self.control_handle.shutdown();
1579 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1581 }
1582}
1583
1584impl fidl::endpoints::Responder for InputMethodEditorDispatchKey3Responder {
1585 type ControlHandle = InputMethodEditorControlHandle;
1586
1587 fn control_handle(&self) -> &InputMethodEditorControlHandle {
1588 &self.control_handle
1589 }
1590
1591 fn drop_without_shutdown(mut self) {
1592 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1594 std::mem::forget(self);
1596 }
1597}
1598
1599impl InputMethodEditorDispatchKey3Responder {
1600 pub fn send(self, mut handled: bool) -> Result<(), fidl::Error> {
1604 let _result = self.send_raw(handled);
1605 if _result.is_err() {
1606 self.control_handle.shutdown();
1607 }
1608 self.drop_without_shutdown();
1609 _result
1610 }
1611
1612 pub fn send_no_shutdown_on_err(self, mut handled: bool) -> Result<(), fidl::Error> {
1614 let _result = self.send_raw(handled);
1615 self.drop_without_shutdown();
1616 _result
1617 }
1618
1619 fn send_raw(&self, mut handled: bool) -> Result<(), fidl::Error> {
1620 self.control_handle.inner.send::<InputMethodEditorDispatchKey3Response>(
1621 (handled,),
1622 self.tx_id,
1623 0x2e13667c827209ac,
1624 fidl::encoding::DynamicFlags::empty(),
1625 )
1626 }
1627}
1628
1629#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1630pub struct InputMethodEditorClientMarker;
1631
1632impl fidl::endpoints::ProtocolMarker for InputMethodEditorClientMarker {
1633 type Proxy = InputMethodEditorClientProxy;
1634 type RequestStream = InputMethodEditorClientRequestStream;
1635 #[cfg(target_os = "fuchsia")]
1636 type SynchronousProxy = InputMethodEditorClientSynchronousProxy;
1637
1638 const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditorClient";
1639}
1640
1641pub trait InputMethodEditorClientProxyInterface: Send + Sync {
1642 fn r#did_update_state(
1643 &self,
1644 state: &TextInputState,
1645 event: Option<&InputEvent>,
1646 ) -> Result<(), fidl::Error>;
1647 fn r#on_action(&self, action: InputMethodAction) -> Result<(), fidl::Error>;
1648}
1649#[derive(Debug)]
1650#[cfg(target_os = "fuchsia")]
1651pub struct InputMethodEditorClientSynchronousProxy {
1652 client: fidl::client::sync::Client,
1653}
1654
1655#[cfg(target_os = "fuchsia")]
1656impl fidl::endpoints::SynchronousProxy for InputMethodEditorClientSynchronousProxy {
1657 type Proxy = InputMethodEditorClientProxy;
1658 type Protocol = InputMethodEditorClientMarker;
1659
1660 fn from_channel(inner: fidl::Channel) -> Self {
1661 Self::new(inner)
1662 }
1663
1664 fn into_channel(self) -> fidl::Channel {
1665 self.client.into_channel()
1666 }
1667
1668 fn as_channel(&self) -> &fidl::Channel {
1669 self.client.as_channel()
1670 }
1671}
1672
1673#[cfg(target_os = "fuchsia")]
1674impl InputMethodEditorClientSynchronousProxy {
1675 pub fn new(channel: fidl::Channel) -> Self {
1676 Self { client: fidl::client::sync::Client::new(channel) }
1677 }
1678
1679 pub fn into_channel(self) -> fidl::Channel {
1680 self.client.into_channel()
1681 }
1682
1683 pub fn wait_for_event(
1686 &self,
1687 deadline: zx::MonotonicInstant,
1688 ) -> Result<InputMethodEditorClientEvent, fidl::Error> {
1689 InputMethodEditorClientEvent::decode(
1690 self.client.wait_for_event::<InputMethodEditorClientMarker>(deadline)?,
1691 )
1692 }
1693
1694 pub fn r#did_update_state(
1695 &self,
1696 mut state: &TextInputState,
1697 mut event: Option<&InputEvent>,
1698 ) -> Result<(), fidl::Error> {
1699 self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
1700 (state, event),
1701 0x26681a6b204b679d,
1702 fidl::encoding::DynamicFlags::empty(),
1703 )
1704 }
1705
1706 pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1707 self.client.send::<InputMethodEditorClientOnActionRequest>(
1708 (action,),
1709 0x19c420f173275398,
1710 fidl::encoding::DynamicFlags::empty(),
1711 )
1712 }
1713}
1714
1715#[cfg(target_os = "fuchsia")]
1716impl From<InputMethodEditorClientSynchronousProxy> for zx::NullableHandle {
1717 fn from(value: InputMethodEditorClientSynchronousProxy) -> Self {
1718 value.into_channel().into()
1719 }
1720}
1721
1722#[cfg(target_os = "fuchsia")]
1723impl From<fidl::Channel> for InputMethodEditorClientSynchronousProxy {
1724 fn from(value: fidl::Channel) -> Self {
1725 Self::new(value)
1726 }
1727}
1728
1729#[cfg(target_os = "fuchsia")]
1730impl fidl::endpoints::FromClient for InputMethodEditorClientSynchronousProxy {
1731 type Protocol = InputMethodEditorClientMarker;
1732
1733 fn from_client(value: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>) -> Self {
1734 Self::new(value.into_channel())
1735 }
1736}
1737
1738#[derive(Debug, Clone)]
1739pub struct InputMethodEditorClientProxy {
1740 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1741}
1742
1743impl fidl::endpoints::Proxy for InputMethodEditorClientProxy {
1744 type Protocol = InputMethodEditorClientMarker;
1745
1746 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1747 Self::new(inner)
1748 }
1749
1750 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1751 self.client.into_channel().map_err(|client| Self { client })
1752 }
1753
1754 fn as_channel(&self) -> &::fidl::AsyncChannel {
1755 self.client.as_channel()
1756 }
1757}
1758
1759impl InputMethodEditorClientProxy {
1760 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1762 let protocol_name =
1763 <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1764 Self { client: fidl::client::Client::new(channel, protocol_name) }
1765 }
1766
1767 pub fn take_event_stream(&self) -> InputMethodEditorClientEventStream {
1773 InputMethodEditorClientEventStream { event_receiver: self.client.take_event_receiver() }
1774 }
1775
1776 pub fn r#did_update_state(
1777 &self,
1778 mut state: &TextInputState,
1779 mut event: Option<&InputEvent>,
1780 ) -> Result<(), fidl::Error> {
1781 InputMethodEditorClientProxyInterface::r#did_update_state(self, state, event)
1782 }
1783
1784 pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1785 InputMethodEditorClientProxyInterface::r#on_action(self, action)
1786 }
1787}
1788
1789impl InputMethodEditorClientProxyInterface for InputMethodEditorClientProxy {
1790 fn r#did_update_state(
1791 &self,
1792 mut state: &TextInputState,
1793 mut event: Option<&InputEvent>,
1794 ) -> Result<(), fidl::Error> {
1795 self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
1796 (state, event),
1797 0x26681a6b204b679d,
1798 fidl::encoding::DynamicFlags::empty(),
1799 )
1800 }
1801
1802 fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1803 self.client.send::<InputMethodEditorClientOnActionRequest>(
1804 (action,),
1805 0x19c420f173275398,
1806 fidl::encoding::DynamicFlags::empty(),
1807 )
1808 }
1809}
1810
1811pub struct InputMethodEditorClientEventStream {
1812 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1813}
1814
1815impl std::marker::Unpin for InputMethodEditorClientEventStream {}
1816
1817impl futures::stream::FusedStream for InputMethodEditorClientEventStream {
1818 fn is_terminated(&self) -> bool {
1819 self.event_receiver.is_terminated()
1820 }
1821}
1822
1823impl futures::Stream for InputMethodEditorClientEventStream {
1824 type Item = Result<InputMethodEditorClientEvent, fidl::Error>;
1825
1826 fn poll_next(
1827 mut self: std::pin::Pin<&mut Self>,
1828 cx: &mut std::task::Context<'_>,
1829 ) -> std::task::Poll<Option<Self::Item>> {
1830 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1831 &mut self.event_receiver,
1832 cx
1833 )?) {
1834 Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorClientEvent::decode(buf))),
1835 None => std::task::Poll::Ready(None),
1836 }
1837 }
1838}
1839
1840#[derive(Debug)]
1841pub enum InputMethodEditorClientEvent {}
1842
1843impl InputMethodEditorClientEvent {
1844 fn decode(
1846 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1847 ) -> Result<InputMethodEditorClientEvent, fidl::Error> {
1848 let (bytes, _handles) = buf.split_mut();
1849 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1850 debug_assert_eq!(tx_header.tx_id, 0);
1851 match tx_header.ordinal {
1852 _ => Err(fidl::Error::UnknownOrdinal {
1853 ordinal: tx_header.ordinal,
1854 protocol_name:
1855 <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1856 }),
1857 }
1858 }
1859}
1860
1861pub struct InputMethodEditorClientRequestStream {
1863 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1864 is_terminated: bool,
1865}
1866
1867impl std::marker::Unpin for InputMethodEditorClientRequestStream {}
1868
1869impl futures::stream::FusedStream for InputMethodEditorClientRequestStream {
1870 fn is_terminated(&self) -> bool {
1871 self.is_terminated
1872 }
1873}
1874
1875impl fidl::endpoints::RequestStream for InputMethodEditorClientRequestStream {
1876 type Protocol = InputMethodEditorClientMarker;
1877 type ControlHandle = InputMethodEditorClientControlHandle;
1878
1879 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1880 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1881 }
1882
1883 fn control_handle(&self) -> Self::ControlHandle {
1884 InputMethodEditorClientControlHandle { inner: self.inner.clone() }
1885 }
1886
1887 fn into_inner(
1888 self,
1889 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1890 {
1891 (self.inner, self.is_terminated)
1892 }
1893
1894 fn from_inner(
1895 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1896 is_terminated: bool,
1897 ) -> Self {
1898 Self { inner, is_terminated }
1899 }
1900}
1901
1902impl futures::Stream for InputMethodEditorClientRequestStream {
1903 type Item = Result<InputMethodEditorClientRequest, fidl::Error>;
1904
1905 fn poll_next(
1906 mut self: std::pin::Pin<&mut Self>,
1907 cx: &mut std::task::Context<'_>,
1908 ) -> std::task::Poll<Option<Self::Item>> {
1909 let this = &mut *self;
1910 if this.inner.check_shutdown(cx) {
1911 this.is_terminated = true;
1912 return std::task::Poll::Ready(None);
1913 }
1914 if this.is_terminated {
1915 panic!("polled InputMethodEditorClientRequestStream after completion");
1916 }
1917 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1918 |bytes, handles| {
1919 match this.inner.channel().read_etc(cx, bytes, handles) {
1920 std::task::Poll::Ready(Ok(())) => {}
1921 std::task::Poll::Pending => return std::task::Poll::Pending,
1922 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1923 this.is_terminated = true;
1924 return std::task::Poll::Ready(None);
1925 }
1926 std::task::Poll::Ready(Err(e)) => {
1927 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1928 e.into(),
1929 ))));
1930 }
1931 }
1932
1933 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1935
1936 std::task::Poll::Ready(Some(match header.ordinal {
1937 0x26681a6b204b679d => {
1938 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1939 let mut req = fidl::new_empty!(InputMethodEditorClientDidUpdateStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1940 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorClientDidUpdateStateRequest>(&header, _body_bytes, handles, &mut req)?;
1941 let control_handle = InputMethodEditorClientControlHandle {
1942 inner: this.inner.clone(),
1943 };
1944 Ok(InputMethodEditorClientRequest::DidUpdateState {state: req.state,
1945event: req.event,
1946
1947 control_handle,
1948 })
1949 }
1950 0x19c420f173275398 => {
1951 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1952 let mut req = fidl::new_empty!(InputMethodEditorClientOnActionRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1953 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorClientOnActionRequest>(&header, _body_bytes, handles, &mut req)?;
1954 let control_handle = InputMethodEditorClientControlHandle {
1955 inner: this.inner.clone(),
1956 };
1957 Ok(InputMethodEditorClientRequest::OnAction {action: req.action,
1958
1959 control_handle,
1960 })
1961 }
1962 _ => Err(fidl::Error::UnknownOrdinal {
1963 ordinal: header.ordinal,
1964 protocol_name: <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1965 }),
1966 }))
1967 },
1968 )
1969 }
1970}
1971
1972#[derive(Debug)]
1974pub enum InputMethodEditorClientRequest {
1975 DidUpdateState {
1976 state: TextInputState,
1977 event: Option<Box<InputEvent>>,
1978 control_handle: InputMethodEditorClientControlHandle,
1979 },
1980 OnAction {
1981 action: InputMethodAction,
1982 control_handle: InputMethodEditorClientControlHandle,
1983 },
1984}
1985
1986impl InputMethodEditorClientRequest {
1987 #[allow(irrefutable_let_patterns)]
1988 pub fn into_did_update_state(
1989 self,
1990 ) -> Option<(TextInputState, Option<Box<InputEvent>>, InputMethodEditorClientControlHandle)>
1991 {
1992 if let InputMethodEditorClientRequest::DidUpdateState { state, event, control_handle } =
1993 self
1994 {
1995 Some((state, event, control_handle))
1996 } else {
1997 None
1998 }
1999 }
2000
2001 #[allow(irrefutable_let_patterns)]
2002 pub fn into_on_action(
2003 self,
2004 ) -> Option<(InputMethodAction, InputMethodEditorClientControlHandle)> {
2005 if let InputMethodEditorClientRequest::OnAction { action, control_handle } = self {
2006 Some((action, control_handle))
2007 } else {
2008 None
2009 }
2010 }
2011
2012 pub fn method_name(&self) -> &'static str {
2014 match *self {
2015 InputMethodEditorClientRequest::DidUpdateState { .. } => "did_update_state",
2016 InputMethodEditorClientRequest::OnAction { .. } => "on_action",
2017 }
2018 }
2019}
2020
2021#[derive(Debug, Clone)]
2022pub struct InputMethodEditorClientControlHandle {
2023 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2024}
2025
2026impl InputMethodEditorClientControlHandle {
2027 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2028 self.inner.shutdown_with_epitaph(status.into())
2029 }
2030}
2031
2032impl fidl::endpoints::ControlHandle for InputMethodEditorClientControlHandle {
2033 fn shutdown(&self) {
2034 self.inner.shutdown()
2035 }
2036
2037 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2038 self.inner.shutdown_with_epitaph(status)
2039 }
2040
2041 fn is_closed(&self) -> bool {
2042 self.inner.channel().is_closed()
2043 }
2044 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2045 self.inner.channel().on_closed()
2046 }
2047
2048 #[cfg(target_os = "fuchsia")]
2049 fn signal_peer(
2050 &self,
2051 clear_mask: zx::Signals,
2052 set_mask: zx::Signals,
2053 ) -> Result<(), zx_status::Status> {
2054 use fidl::Peered;
2055 self.inner.channel().signal_peer(clear_mask, set_mask)
2056 }
2057}
2058
2059impl InputMethodEditorClientControlHandle {}
2060
2061mod internal {
2062 use super::*;
2063
2064 impl fidl::encoding::ResourceTypeMarker for ImeServiceGetInputMethodEditorRequest {
2065 type Borrowed<'a> = &'a mut Self;
2066 fn take_or_borrow<'a>(
2067 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2068 ) -> Self::Borrowed<'a> {
2069 value
2070 }
2071 }
2072
2073 unsafe impl fidl::encoding::TypeMarker for ImeServiceGetInputMethodEditorRequest {
2074 type Owned = Self;
2075
2076 #[inline(always)]
2077 fn inline_align(_context: fidl::encoding::Context) -> usize {
2078 8
2079 }
2080
2081 #[inline(always)]
2082 fn inline_size(_context: fidl::encoding::Context) -> usize {
2083 80
2084 }
2085 }
2086
2087 unsafe impl
2088 fidl::encoding::Encode<
2089 ImeServiceGetInputMethodEditorRequest,
2090 fidl::encoding::DefaultFuchsiaResourceDialect,
2091 > for &mut ImeServiceGetInputMethodEditorRequest
2092 {
2093 #[inline]
2094 unsafe fn encode(
2095 self,
2096 encoder: &mut fidl::encoding::Encoder<
2097 '_,
2098 fidl::encoding::DefaultFuchsiaResourceDialect,
2099 >,
2100 offset: usize,
2101 _depth: fidl::encoding::Depth,
2102 ) -> fidl::Result<()> {
2103 encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
2104 fidl::encoding::Encode::<ImeServiceGetInputMethodEditorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2106 (
2107 <KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),
2108 <InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
2109 <TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_state),
2110 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
2111 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.editor),
2112 ),
2113 encoder, offset, _depth
2114 )
2115 }
2116 }
2117 unsafe impl<
2118 T0: fidl::encoding::Encode<KeyboardType, fidl::encoding::DefaultFuchsiaResourceDialect>,
2119 T1: fidl::encoding::Encode<InputMethodAction, fidl::encoding::DefaultFuchsiaResourceDialect>,
2120 T2: fidl::encoding::Encode<TextInputState, fidl::encoding::DefaultFuchsiaResourceDialect>,
2121 T3: fidl::encoding::Encode<
2122 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
2123 fidl::encoding::DefaultFuchsiaResourceDialect,
2124 >,
2125 T4: fidl::encoding::Encode<
2126 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2127 fidl::encoding::DefaultFuchsiaResourceDialect,
2128 >,
2129 >
2130 fidl::encoding::Encode<
2131 ImeServiceGetInputMethodEditorRequest,
2132 fidl::encoding::DefaultFuchsiaResourceDialect,
2133 > for (T0, T1, T2, T3, T4)
2134 {
2135 #[inline]
2136 unsafe fn encode(
2137 self,
2138 encoder: &mut fidl::encoding::Encoder<
2139 '_,
2140 fidl::encoding::DefaultFuchsiaResourceDialect,
2141 >,
2142 offset: usize,
2143 depth: fidl::encoding::Depth,
2144 ) -> fidl::Result<()> {
2145 encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
2146 self.0.encode(encoder, offset + 0, depth)?;
2150 self.1.encode(encoder, offset + 4, depth)?;
2151 self.2.encode(encoder, offset + 8, depth)?;
2152 self.3.encode(encoder, offset + 72, depth)?;
2153 self.4.encode(encoder, offset + 76, depth)?;
2154 Ok(())
2155 }
2156 }
2157
2158 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2159 for ImeServiceGetInputMethodEditorRequest
2160 {
2161 #[inline(always)]
2162 fn new_empty() -> Self {
2163 Self {
2164 keyboard_type: fidl::new_empty!(
2165 KeyboardType,
2166 fidl::encoding::DefaultFuchsiaResourceDialect
2167 ),
2168 action: fidl::new_empty!(
2169 InputMethodAction,
2170 fidl::encoding::DefaultFuchsiaResourceDialect
2171 ),
2172 initial_state: fidl::new_empty!(
2173 TextInputState,
2174 fidl::encoding::DefaultFuchsiaResourceDialect
2175 ),
2176 client: fidl::new_empty!(
2177 fidl::encoding::Endpoint<
2178 fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
2179 >,
2180 fidl::encoding::DefaultFuchsiaResourceDialect
2181 ),
2182 editor: fidl::new_empty!(
2183 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2184 fidl::encoding::DefaultFuchsiaResourceDialect
2185 ),
2186 }
2187 }
2188
2189 #[inline]
2190 unsafe fn decode(
2191 &mut self,
2192 decoder: &mut fidl::encoding::Decoder<
2193 '_,
2194 fidl::encoding::DefaultFuchsiaResourceDialect,
2195 >,
2196 offset: usize,
2197 _depth: fidl::encoding::Depth,
2198 ) -> fidl::Result<()> {
2199 decoder.debug_check_bounds::<Self>(offset);
2200 fidl::decode!(
2202 KeyboardType,
2203 fidl::encoding::DefaultFuchsiaResourceDialect,
2204 &mut self.keyboard_type,
2205 decoder,
2206 offset + 0,
2207 _depth
2208 )?;
2209 fidl::decode!(
2210 InputMethodAction,
2211 fidl::encoding::DefaultFuchsiaResourceDialect,
2212 &mut self.action,
2213 decoder,
2214 offset + 4,
2215 _depth
2216 )?;
2217 fidl::decode!(
2218 TextInputState,
2219 fidl::encoding::DefaultFuchsiaResourceDialect,
2220 &mut self.initial_state,
2221 decoder,
2222 offset + 8,
2223 _depth
2224 )?;
2225 fidl::decode!(
2226 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
2227 fidl::encoding::DefaultFuchsiaResourceDialect,
2228 &mut self.client,
2229 decoder,
2230 offset + 72,
2231 _depth
2232 )?;
2233 fidl::decode!(
2234 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2235 fidl::encoding::DefaultFuchsiaResourceDialect,
2236 &mut self.editor,
2237 decoder,
2238 offset + 76,
2239 _depth
2240 )?;
2241 Ok(())
2242 }
2243 }
2244
2245 impl MediaButtonsEvent {
2246 #[inline(always)]
2247 fn max_ordinal_present(&self) -> u64 {
2248 if let Some(_) = self.trace_flow_id {
2249 return 9;
2250 }
2251 if let Some(_) = self.wake_lease {
2252 return 8;
2253 }
2254 if let Some(_) = self.device_id {
2255 return 7;
2256 }
2257 if let Some(_) = self.function {
2258 return 6;
2259 }
2260 if let Some(_) = self.power {
2261 return 5;
2262 }
2263 if let Some(_) = self.camera_disable {
2264 return 4;
2265 }
2266 if let Some(_) = self.pause {
2267 return 3;
2268 }
2269 if let Some(_) = self.mic_mute {
2270 return 2;
2271 }
2272 if let Some(_) = self.volume {
2273 return 1;
2274 }
2275 0
2276 }
2277 }
2278
2279 impl fidl::encoding::ResourceTypeMarker for MediaButtonsEvent {
2280 type Borrowed<'a> = &'a mut Self;
2281 fn take_or_borrow<'a>(
2282 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2283 ) -> Self::Borrowed<'a> {
2284 value
2285 }
2286 }
2287
2288 unsafe impl fidl::encoding::TypeMarker for MediaButtonsEvent {
2289 type Owned = Self;
2290
2291 #[inline(always)]
2292 fn inline_align(_context: fidl::encoding::Context) -> usize {
2293 8
2294 }
2295
2296 #[inline(always)]
2297 fn inline_size(_context: fidl::encoding::Context) -> usize {
2298 16
2299 }
2300 }
2301
2302 unsafe impl
2303 fidl::encoding::Encode<MediaButtonsEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
2304 for &mut MediaButtonsEvent
2305 {
2306 unsafe fn encode(
2307 self,
2308 encoder: &mut fidl::encoding::Encoder<
2309 '_,
2310 fidl::encoding::DefaultFuchsiaResourceDialect,
2311 >,
2312 offset: usize,
2313 mut depth: fidl::encoding::Depth,
2314 ) -> fidl::Result<()> {
2315 encoder.debug_check_bounds::<MediaButtonsEvent>(offset);
2316 let max_ordinal: u64 = self.max_ordinal_present();
2318 encoder.write_num(max_ordinal, offset);
2319 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2320 if max_ordinal == 0 {
2322 return Ok(());
2323 }
2324 depth.increment()?;
2325 let envelope_size = 8;
2326 let bytes_len = max_ordinal as usize * envelope_size;
2327 #[allow(unused_variables)]
2328 let offset = encoder.out_of_line_offset(bytes_len);
2329 let mut _prev_end_offset: usize = 0;
2330 if 1 > max_ordinal {
2331 return Ok(());
2332 }
2333
2334 let cur_offset: usize = (1 - 1) * envelope_size;
2337
2338 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2340
2341 fidl::encoding::encode_in_envelope_optional::<
2346 i8,
2347 fidl::encoding::DefaultFuchsiaResourceDialect,
2348 >(
2349 self.volume.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
2350 encoder,
2351 offset + cur_offset,
2352 depth,
2353 )?;
2354
2355 _prev_end_offset = cur_offset + envelope_size;
2356 if 2 > max_ordinal {
2357 return Ok(());
2358 }
2359
2360 let cur_offset: usize = (2 - 1) * envelope_size;
2363
2364 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2366
2367 fidl::encoding::encode_in_envelope_optional::<
2372 bool,
2373 fidl::encoding::DefaultFuchsiaResourceDialect,
2374 >(
2375 self.mic_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2376 encoder,
2377 offset + cur_offset,
2378 depth,
2379 )?;
2380
2381 _prev_end_offset = cur_offset + envelope_size;
2382 if 3 > max_ordinal {
2383 return Ok(());
2384 }
2385
2386 let cur_offset: usize = (3 - 1) * envelope_size;
2389
2390 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2392
2393 fidl::encoding::encode_in_envelope_optional::<
2398 bool,
2399 fidl::encoding::DefaultFuchsiaResourceDialect,
2400 >(
2401 self.pause.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2402 encoder,
2403 offset + cur_offset,
2404 depth,
2405 )?;
2406
2407 _prev_end_offset = cur_offset + envelope_size;
2408 if 4 > max_ordinal {
2409 return Ok(());
2410 }
2411
2412 let cur_offset: usize = (4 - 1) * envelope_size;
2415
2416 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2418
2419 fidl::encoding::encode_in_envelope_optional::<
2424 bool,
2425 fidl::encoding::DefaultFuchsiaResourceDialect,
2426 >(
2427 self.camera_disable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2428 encoder,
2429 offset + cur_offset,
2430 depth,
2431 )?;
2432
2433 _prev_end_offset = cur_offset + envelope_size;
2434 if 5 > max_ordinal {
2435 return Ok(());
2436 }
2437
2438 let cur_offset: usize = (5 - 1) * envelope_size;
2441
2442 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2444
2445 fidl::encoding::encode_in_envelope_optional::<
2450 bool,
2451 fidl::encoding::DefaultFuchsiaResourceDialect,
2452 >(
2453 self.power.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2454 encoder,
2455 offset + cur_offset,
2456 depth,
2457 )?;
2458
2459 _prev_end_offset = cur_offset + envelope_size;
2460 if 6 > max_ordinal {
2461 return Ok(());
2462 }
2463
2464 let cur_offset: usize = (6 - 1) * envelope_size;
2467
2468 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2470
2471 fidl::encoding::encode_in_envelope_optional::<
2476 bool,
2477 fidl::encoding::DefaultFuchsiaResourceDialect,
2478 >(
2479 self.function.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2480 encoder,
2481 offset + cur_offset,
2482 depth,
2483 )?;
2484
2485 _prev_end_offset = cur_offset + envelope_size;
2486 if 7 > max_ordinal {
2487 return Ok(());
2488 }
2489
2490 let cur_offset: usize = (7 - 1) * envelope_size;
2493
2494 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2496
2497 fidl::encoding::encode_in_envelope_optional::<
2502 u32,
2503 fidl::encoding::DefaultFuchsiaResourceDialect,
2504 >(
2505 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2506 encoder,
2507 offset + cur_offset,
2508 depth,
2509 )?;
2510
2511 _prev_end_offset = cur_offset + envelope_size;
2512 if 8 > max_ordinal {
2513 return Ok(());
2514 }
2515
2516 let cur_offset: usize = (8 - 1) * envelope_size;
2519
2520 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2522
2523 fidl::encoding::encode_in_envelope_optional::<
2528 fidl::encoding::HandleType<
2529 fidl::EventPair,
2530 { fidl::ObjectType::EVENTPAIR.into_raw() },
2531 2147483648,
2532 >,
2533 fidl::encoding::DefaultFuchsiaResourceDialect,
2534 >(
2535 self.wake_lease.as_mut().map(
2536 <fidl::encoding::HandleType<
2537 fidl::EventPair,
2538 { fidl::ObjectType::EVENTPAIR.into_raw() },
2539 2147483648,
2540 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2541 ),
2542 encoder,
2543 offset + cur_offset,
2544 depth,
2545 )?;
2546
2547 _prev_end_offset = cur_offset + envelope_size;
2548 if 9 > max_ordinal {
2549 return Ok(());
2550 }
2551
2552 let cur_offset: usize = (9 - 1) * envelope_size;
2555
2556 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2558
2559 fidl::encoding::encode_in_envelope_optional::<
2564 u64,
2565 fidl::encoding::DefaultFuchsiaResourceDialect,
2566 >(
2567 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2568 encoder,
2569 offset + cur_offset,
2570 depth,
2571 )?;
2572
2573 _prev_end_offset = cur_offset + envelope_size;
2574
2575 Ok(())
2576 }
2577 }
2578
2579 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2580 for MediaButtonsEvent
2581 {
2582 #[inline(always)]
2583 fn new_empty() -> Self {
2584 Self::default()
2585 }
2586
2587 unsafe fn decode(
2588 &mut self,
2589 decoder: &mut fidl::encoding::Decoder<
2590 '_,
2591 fidl::encoding::DefaultFuchsiaResourceDialect,
2592 >,
2593 offset: usize,
2594 mut depth: fidl::encoding::Depth,
2595 ) -> fidl::Result<()> {
2596 decoder.debug_check_bounds::<Self>(offset);
2597 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2598 None => return Err(fidl::Error::NotNullable),
2599 Some(len) => len,
2600 };
2601 if len == 0 {
2603 return Ok(());
2604 };
2605 depth.increment()?;
2606 let envelope_size = 8;
2607 let bytes_len = len * envelope_size;
2608 let offset = decoder.out_of_line_offset(bytes_len)?;
2609 let mut _next_ordinal_to_read = 0;
2611 let mut next_offset = offset;
2612 let end_offset = offset + bytes_len;
2613 _next_ordinal_to_read += 1;
2614 if next_offset >= end_offset {
2615 return Ok(());
2616 }
2617
2618 while _next_ordinal_to_read < 1 {
2620 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2621 _next_ordinal_to_read += 1;
2622 next_offset += envelope_size;
2623 }
2624
2625 let next_out_of_line = decoder.next_out_of_line();
2626 let handles_before = decoder.remaining_handles();
2627 if let Some((inlined, num_bytes, num_handles)) =
2628 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2629 {
2630 let member_inline_size =
2631 <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2632 if inlined != (member_inline_size <= 4) {
2633 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2634 }
2635 let inner_offset;
2636 let mut inner_depth = depth.clone();
2637 if inlined {
2638 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2639 inner_offset = next_offset;
2640 } else {
2641 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2642 inner_depth.increment()?;
2643 }
2644 let val_ref = self.volume.get_or_insert_with(|| {
2645 fidl::new_empty!(i8, fidl::encoding::DefaultFuchsiaResourceDialect)
2646 });
2647 fidl::decode!(
2648 i8,
2649 fidl::encoding::DefaultFuchsiaResourceDialect,
2650 val_ref,
2651 decoder,
2652 inner_offset,
2653 inner_depth
2654 )?;
2655 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2656 {
2657 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2658 }
2659 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2660 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2661 }
2662 }
2663
2664 next_offset += envelope_size;
2665 _next_ordinal_to_read += 1;
2666 if next_offset >= end_offset {
2667 return Ok(());
2668 }
2669
2670 while _next_ordinal_to_read < 2 {
2672 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2673 _next_ordinal_to_read += 1;
2674 next_offset += envelope_size;
2675 }
2676
2677 let next_out_of_line = decoder.next_out_of_line();
2678 let handles_before = decoder.remaining_handles();
2679 if let Some((inlined, num_bytes, num_handles)) =
2680 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2681 {
2682 let member_inline_size =
2683 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2684 if inlined != (member_inline_size <= 4) {
2685 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2686 }
2687 let inner_offset;
2688 let mut inner_depth = depth.clone();
2689 if inlined {
2690 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2691 inner_offset = next_offset;
2692 } else {
2693 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2694 inner_depth.increment()?;
2695 }
2696 let val_ref = self.mic_mute.get_or_insert_with(|| {
2697 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2698 });
2699 fidl::decode!(
2700 bool,
2701 fidl::encoding::DefaultFuchsiaResourceDialect,
2702 val_ref,
2703 decoder,
2704 inner_offset,
2705 inner_depth
2706 )?;
2707 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2708 {
2709 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2710 }
2711 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2712 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2713 }
2714 }
2715
2716 next_offset += envelope_size;
2717 _next_ordinal_to_read += 1;
2718 if next_offset >= end_offset {
2719 return Ok(());
2720 }
2721
2722 while _next_ordinal_to_read < 3 {
2724 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2725 _next_ordinal_to_read += 1;
2726 next_offset += envelope_size;
2727 }
2728
2729 let next_out_of_line = decoder.next_out_of_line();
2730 let handles_before = decoder.remaining_handles();
2731 if let Some((inlined, num_bytes, num_handles)) =
2732 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2733 {
2734 let member_inline_size =
2735 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2736 if inlined != (member_inline_size <= 4) {
2737 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2738 }
2739 let inner_offset;
2740 let mut inner_depth = depth.clone();
2741 if inlined {
2742 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2743 inner_offset = next_offset;
2744 } else {
2745 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2746 inner_depth.increment()?;
2747 }
2748 let val_ref = self.pause.get_or_insert_with(|| {
2749 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2750 });
2751 fidl::decode!(
2752 bool,
2753 fidl::encoding::DefaultFuchsiaResourceDialect,
2754 val_ref,
2755 decoder,
2756 inner_offset,
2757 inner_depth
2758 )?;
2759 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2760 {
2761 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2762 }
2763 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2764 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2765 }
2766 }
2767
2768 next_offset += envelope_size;
2769 _next_ordinal_to_read += 1;
2770 if next_offset >= end_offset {
2771 return Ok(());
2772 }
2773
2774 while _next_ordinal_to_read < 4 {
2776 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2777 _next_ordinal_to_read += 1;
2778 next_offset += envelope_size;
2779 }
2780
2781 let next_out_of_line = decoder.next_out_of_line();
2782 let handles_before = decoder.remaining_handles();
2783 if let Some((inlined, num_bytes, num_handles)) =
2784 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2785 {
2786 let member_inline_size =
2787 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2788 if inlined != (member_inline_size <= 4) {
2789 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2790 }
2791 let inner_offset;
2792 let mut inner_depth = depth.clone();
2793 if inlined {
2794 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2795 inner_offset = next_offset;
2796 } else {
2797 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2798 inner_depth.increment()?;
2799 }
2800 let val_ref = self.camera_disable.get_or_insert_with(|| {
2801 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2802 });
2803 fidl::decode!(
2804 bool,
2805 fidl::encoding::DefaultFuchsiaResourceDialect,
2806 val_ref,
2807 decoder,
2808 inner_offset,
2809 inner_depth
2810 )?;
2811 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2812 {
2813 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2814 }
2815 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2816 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2817 }
2818 }
2819
2820 next_offset += envelope_size;
2821 _next_ordinal_to_read += 1;
2822 if next_offset >= end_offset {
2823 return Ok(());
2824 }
2825
2826 while _next_ordinal_to_read < 5 {
2828 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2829 _next_ordinal_to_read += 1;
2830 next_offset += envelope_size;
2831 }
2832
2833 let next_out_of_line = decoder.next_out_of_line();
2834 let handles_before = decoder.remaining_handles();
2835 if let Some((inlined, num_bytes, num_handles)) =
2836 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2837 {
2838 let member_inline_size =
2839 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2840 if inlined != (member_inline_size <= 4) {
2841 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2842 }
2843 let inner_offset;
2844 let mut inner_depth = depth.clone();
2845 if inlined {
2846 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2847 inner_offset = next_offset;
2848 } else {
2849 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2850 inner_depth.increment()?;
2851 }
2852 let val_ref = self.power.get_or_insert_with(|| {
2853 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2854 });
2855 fidl::decode!(
2856 bool,
2857 fidl::encoding::DefaultFuchsiaResourceDialect,
2858 val_ref,
2859 decoder,
2860 inner_offset,
2861 inner_depth
2862 )?;
2863 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2864 {
2865 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2866 }
2867 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2868 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2869 }
2870 }
2871
2872 next_offset += envelope_size;
2873 _next_ordinal_to_read += 1;
2874 if next_offset >= end_offset {
2875 return Ok(());
2876 }
2877
2878 while _next_ordinal_to_read < 6 {
2880 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2881 _next_ordinal_to_read += 1;
2882 next_offset += envelope_size;
2883 }
2884
2885 let next_out_of_line = decoder.next_out_of_line();
2886 let handles_before = decoder.remaining_handles();
2887 if let Some((inlined, num_bytes, num_handles)) =
2888 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2889 {
2890 let member_inline_size =
2891 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2892 if inlined != (member_inline_size <= 4) {
2893 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2894 }
2895 let inner_offset;
2896 let mut inner_depth = depth.clone();
2897 if inlined {
2898 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2899 inner_offset = next_offset;
2900 } else {
2901 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2902 inner_depth.increment()?;
2903 }
2904 let val_ref = self.function.get_or_insert_with(|| {
2905 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2906 });
2907 fidl::decode!(
2908 bool,
2909 fidl::encoding::DefaultFuchsiaResourceDialect,
2910 val_ref,
2911 decoder,
2912 inner_offset,
2913 inner_depth
2914 )?;
2915 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2916 {
2917 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2918 }
2919 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2920 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2921 }
2922 }
2923
2924 next_offset += envelope_size;
2925 _next_ordinal_to_read += 1;
2926 if next_offset >= end_offset {
2927 return Ok(());
2928 }
2929
2930 while _next_ordinal_to_read < 7 {
2932 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2933 _next_ordinal_to_read += 1;
2934 next_offset += envelope_size;
2935 }
2936
2937 let next_out_of_line = decoder.next_out_of_line();
2938 let handles_before = decoder.remaining_handles();
2939 if let Some((inlined, num_bytes, num_handles)) =
2940 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2941 {
2942 let member_inline_size =
2943 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2944 if inlined != (member_inline_size <= 4) {
2945 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2946 }
2947 let inner_offset;
2948 let mut inner_depth = depth.clone();
2949 if inlined {
2950 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2951 inner_offset = next_offset;
2952 } else {
2953 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2954 inner_depth.increment()?;
2955 }
2956 let val_ref = self.device_id.get_or_insert_with(|| {
2957 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2958 });
2959 fidl::decode!(
2960 u32,
2961 fidl::encoding::DefaultFuchsiaResourceDialect,
2962 val_ref,
2963 decoder,
2964 inner_offset,
2965 inner_depth
2966 )?;
2967 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2968 {
2969 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2970 }
2971 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2972 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2973 }
2974 }
2975
2976 next_offset += envelope_size;
2977 _next_ordinal_to_read += 1;
2978 if next_offset >= end_offset {
2979 return Ok(());
2980 }
2981
2982 while _next_ordinal_to_read < 8 {
2984 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2985 _next_ordinal_to_read += 1;
2986 next_offset += envelope_size;
2987 }
2988
2989 let next_out_of_line = decoder.next_out_of_line();
2990 let handles_before = decoder.remaining_handles();
2991 if let Some((inlined, num_bytes, num_handles)) =
2992 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2993 {
2994 let member_inline_size = <fidl::encoding::HandleType<
2995 fidl::EventPair,
2996 { fidl::ObjectType::EVENTPAIR.into_raw() },
2997 2147483648,
2998 > as fidl::encoding::TypeMarker>::inline_size(
2999 decoder.context
3000 );
3001 if inlined != (member_inline_size <= 4) {
3002 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3003 }
3004 let inner_offset;
3005 let mut inner_depth = depth.clone();
3006 if inlined {
3007 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3008 inner_offset = next_offset;
3009 } else {
3010 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3011 inner_depth.increment()?;
3012 }
3013 let val_ref =
3014 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3015 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3016 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3017 {
3018 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3019 }
3020 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3021 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3022 }
3023 }
3024
3025 next_offset += envelope_size;
3026 _next_ordinal_to_read += 1;
3027 if next_offset >= end_offset {
3028 return Ok(());
3029 }
3030
3031 while _next_ordinal_to_read < 9 {
3033 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3034 _next_ordinal_to_read += 1;
3035 next_offset += envelope_size;
3036 }
3037
3038 let next_out_of_line = decoder.next_out_of_line();
3039 let handles_before = decoder.remaining_handles();
3040 if let Some((inlined, num_bytes, num_handles)) =
3041 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3042 {
3043 let member_inline_size =
3044 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3045 if inlined != (member_inline_size <= 4) {
3046 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3047 }
3048 let inner_offset;
3049 let mut inner_depth = depth.clone();
3050 if inlined {
3051 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3052 inner_offset = next_offset;
3053 } else {
3054 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3055 inner_depth.increment()?;
3056 }
3057 let val_ref = self.trace_flow_id.get_or_insert_with(|| {
3058 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3059 });
3060 fidl::decode!(
3061 u64,
3062 fidl::encoding::DefaultFuchsiaResourceDialect,
3063 val_ref,
3064 decoder,
3065 inner_offset,
3066 inner_depth
3067 )?;
3068 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3069 {
3070 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3071 }
3072 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3073 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3074 }
3075 }
3076
3077 next_offset += envelope_size;
3078
3079 while next_offset < end_offset {
3081 _next_ordinal_to_read += 1;
3082 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3083 next_offset += envelope_size;
3084 }
3085
3086 Ok(())
3087 }
3088 }
3089
3090 impl TouchButtonsEvent {
3091 #[inline(always)]
3092 fn max_ordinal_present(&self) -> u64 {
3093 if let Some(_) = self.trace_flow_id {
3094 return 5;
3095 }
3096 if let Some(_) = self.wake_lease {
3097 return 4;
3098 }
3099 if let Some(_) = self.pressed_buttons {
3100 return 3;
3101 }
3102 if let Some(_) = self.device_info {
3103 return 2;
3104 }
3105 if let Some(_) = self.event_time {
3106 return 1;
3107 }
3108 0
3109 }
3110 }
3111
3112 impl fidl::encoding::ResourceTypeMarker for TouchButtonsEvent {
3113 type Borrowed<'a> = &'a mut Self;
3114 fn take_or_borrow<'a>(
3115 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3116 ) -> Self::Borrowed<'a> {
3117 value
3118 }
3119 }
3120
3121 unsafe impl fidl::encoding::TypeMarker for TouchButtonsEvent {
3122 type Owned = Self;
3123
3124 #[inline(always)]
3125 fn inline_align(_context: fidl::encoding::Context) -> usize {
3126 8
3127 }
3128
3129 #[inline(always)]
3130 fn inline_size(_context: fidl::encoding::Context) -> usize {
3131 16
3132 }
3133 }
3134
3135 unsafe impl
3136 fidl::encoding::Encode<TouchButtonsEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
3137 for &mut TouchButtonsEvent
3138 {
3139 unsafe fn encode(
3140 self,
3141 encoder: &mut fidl::encoding::Encoder<
3142 '_,
3143 fidl::encoding::DefaultFuchsiaResourceDialect,
3144 >,
3145 offset: usize,
3146 mut depth: fidl::encoding::Depth,
3147 ) -> fidl::Result<()> {
3148 encoder.debug_check_bounds::<TouchButtonsEvent>(offset);
3149 let max_ordinal: u64 = self.max_ordinal_present();
3151 encoder.write_num(max_ordinal, offset);
3152 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3153 if max_ordinal == 0 {
3155 return Ok(());
3156 }
3157 depth.increment()?;
3158 let envelope_size = 8;
3159 let bytes_len = max_ordinal as usize * envelope_size;
3160 #[allow(unused_variables)]
3161 let offset = encoder.out_of_line_offset(bytes_len);
3162 let mut _prev_end_offset: usize = 0;
3163 if 1 > max_ordinal {
3164 return Ok(());
3165 }
3166
3167 let cur_offset: usize = (1 - 1) * envelope_size;
3170
3171 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3173
3174 fidl::encoding::encode_in_envelope_optional::<
3179 fidl::MonotonicInstant,
3180 fidl::encoding::DefaultFuchsiaResourceDialect,
3181 >(
3182 self.event_time
3183 .as_ref()
3184 .map(<fidl::MonotonicInstant as fidl::encoding::ValueTypeMarker>::borrow),
3185 encoder,
3186 offset + cur_offset,
3187 depth,
3188 )?;
3189
3190 _prev_end_offset = cur_offset + envelope_size;
3191 if 2 > max_ordinal {
3192 return Ok(());
3193 }
3194
3195 let cur_offset: usize = (2 - 1) * envelope_size;
3198
3199 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3201
3202 fidl::encoding::encode_in_envelope_optional::<
3207 TouchDeviceInfo,
3208 fidl::encoding::DefaultFuchsiaResourceDialect,
3209 >(
3210 self.device_info
3211 .as_ref()
3212 .map(<TouchDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
3213 encoder,
3214 offset + cur_offset,
3215 depth,
3216 )?;
3217
3218 _prev_end_offset = cur_offset + envelope_size;
3219 if 3 > max_ordinal {
3220 return Ok(());
3221 }
3222
3223 let cur_offset: usize = (3 - 1) * envelope_size;
3226
3227 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3229
3230 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<TouchButton>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3235 self.pressed_buttons.as_ref().map(<fidl::encoding::UnboundedVector<TouchButton> as fidl::encoding::ValueTypeMarker>::borrow),
3236 encoder, offset + cur_offset, depth
3237 )?;
3238
3239 _prev_end_offset = cur_offset + envelope_size;
3240 if 4 > max_ordinal {
3241 return Ok(());
3242 }
3243
3244 let cur_offset: usize = (4 - 1) * envelope_size;
3247
3248 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3250
3251 fidl::encoding::encode_in_envelope_optional::<
3256 fidl::encoding::HandleType<
3257 fidl::EventPair,
3258 { fidl::ObjectType::EVENTPAIR.into_raw() },
3259 2147483648,
3260 >,
3261 fidl::encoding::DefaultFuchsiaResourceDialect,
3262 >(
3263 self.wake_lease.as_mut().map(
3264 <fidl::encoding::HandleType<
3265 fidl::EventPair,
3266 { fidl::ObjectType::EVENTPAIR.into_raw() },
3267 2147483648,
3268 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3269 ),
3270 encoder,
3271 offset + cur_offset,
3272 depth,
3273 )?;
3274
3275 _prev_end_offset = cur_offset + envelope_size;
3276 if 5 > max_ordinal {
3277 return Ok(());
3278 }
3279
3280 let cur_offset: usize = (5 - 1) * envelope_size;
3283
3284 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3286
3287 fidl::encoding::encode_in_envelope_optional::<
3292 u64,
3293 fidl::encoding::DefaultFuchsiaResourceDialect,
3294 >(
3295 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3296 encoder,
3297 offset + cur_offset,
3298 depth,
3299 )?;
3300
3301 _prev_end_offset = cur_offset + envelope_size;
3302
3303 Ok(())
3304 }
3305 }
3306
3307 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3308 for TouchButtonsEvent
3309 {
3310 #[inline(always)]
3311 fn new_empty() -> Self {
3312 Self::default()
3313 }
3314
3315 unsafe fn decode(
3316 &mut self,
3317 decoder: &mut fidl::encoding::Decoder<
3318 '_,
3319 fidl::encoding::DefaultFuchsiaResourceDialect,
3320 >,
3321 offset: usize,
3322 mut depth: fidl::encoding::Depth,
3323 ) -> fidl::Result<()> {
3324 decoder.debug_check_bounds::<Self>(offset);
3325 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3326 None => return Err(fidl::Error::NotNullable),
3327 Some(len) => len,
3328 };
3329 if len == 0 {
3331 return Ok(());
3332 };
3333 depth.increment()?;
3334 let envelope_size = 8;
3335 let bytes_len = len * envelope_size;
3336 let offset = decoder.out_of_line_offset(bytes_len)?;
3337 let mut _next_ordinal_to_read = 0;
3339 let mut next_offset = offset;
3340 let end_offset = offset + bytes_len;
3341 _next_ordinal_to_read += 1;
3342 if next_offset >= end_offset {
3343 return Ok(());
3344 }
3345
3346 while _next_ordinal_to_read < 1 {
3348 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3349 _next_ordinal_to_read += 1;
3350 next_offset += envelope_size;
3351 }
3352
3353 let next_out_of_line = decoder.next_out_of_line();
3354 let handles_before = decoder.remaining_handles();
3355 if let Some((inlined, num_bytes, num_handles)) =
3356 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3357 {
3358 let member_inline_size =
3359 <fidl::MonotonicInstant as fidl::encoding::TypeMarker>::inline_size(
3360 decoder.context,
3361 );
3362 if inlined != (member_inline_size <= 4) {
3363 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3364 }
3365 let inner_offset;
3366 let mut inner_depth = depth.clone();
3367 if inlined {
3368 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3369 inner_offset = next_offset;
3370 } else {
3371 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3372 inner_depth.increment()?;
3373 }
3374 let val_ref = self.event_time.get_or_insert_with(|| {
3375 fidl::new_empty!(
3376 fidl::MonotonicInstant,
3377 fidl::encoding::DefaultFuchsiaResourceDialect
3378 )
3379 });
3380 fidl::decode!(
3381 fidl::MonotonicInstant,
3382 fidl::encoding::DefaultFuchsiaResourceDialect,
3383 val_ref,
3384 decoder,
3385 inner_offset,
3386 inner_depth
3387 )?;
3388 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3389 {
3390 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3391 }
3392 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3393 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3394 }
3395 }
3396
3397 next_offset += envelope_size;
3398 _next_ordinal_to_read += 1;
3399 if next_offset >= end_offset {
3400 return Ok(());
3401 }
3402
3403 while _next_ordinal_to_read < 2 {
3405 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3406 _next_ordinal_to_read += 1;
3407 next_offset += envelope_size;
3408 }
3409
3410 let next_out_of_line = decoder.next_out_of_line();
3411 let handles_before = decoder.remaining_handles();
3412 if let Some((inlined, num_bytes, num_handles)) =
3413 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3414 {
3415 let member_inline_size =
3416 <TouchDeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3417 if inlined != (member_inline_size <= 4) {
3418 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3419 }
3420 let inner_offset;
3421 let mut inner_depth = depth.clone();
3422 if inlined {
3423 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3424 inner_offset = next_offset;
3425 } else {
3426 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3427 inner_depth.increment()?;
3428 }
3429 let val_ref = self.device_info.get_or_insert_with(|| {
3430 fidl::new_empty!(TouchDeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect)
3431 });
3432 fidl::decode!(
3433 TouchDeviceInfo,
3434 fidl::encoding::DefaultFuchsiaResourceDialect,
3435 val_ref,
3436 decoder,
3437 inner_offset,
3438 inner_depth
3439 )?;
3440 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3441 {
3442 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3443 }
3444 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3445 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3446 }
3447 }
3448
3449 next_offset += envelope_size;
3450 _next_ordinal_to_read += 1;
3451 if next_offset >= end_offset {
3452 return Ok(());
3453 }
3454
3455 while _next_ordinal_to_read < 3 {
3457 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3458 _next_ordinal_to_read += 1;
3459 next_offset += envelope_size;
3460 }
3461
3462 let next_out_of_line = decoder.next_out_of_line();
3463 let handles_before = decoder.remaining_handles();
3464 if let Some((inlined, num_bytes, num_handles)) =
3465 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3466 {
3467 let member_inline_size = <fidl::encoding::UnboundedVector<TouchButton> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3468 if inlined != (member_inline_size <= 4) {
3469 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3470 }
3471 let inner_offset;
3472 let mut inner_depth = depth.clone();
3473 if inlined {
3474 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3475 inner_offset = next_offset;
3476 } else {
3477 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3478 inner_depth.increment()?;
3479 }
3480 let val_ref = self.pressed_buttons.get_or_insert_with(|| {
3481 fidl::new_empty!(
3482 fidl::encoding::UnboundedVector<TouchButton>,
3483 fidl::encoding::DefaultFuchsiaResourceDialect
3484 )
3485 });
3486 fidl::decode!(
3487 fidl::encoding::UnboundedVector<TouchButton>,
3488 fidl::encoding::DefaultFuchsiaResourceDialect,
3489 val_ref,
3490 decoder,
3491 inner_offset,
3492 inner_depth
3493 )?;
3494 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3495 {
3496 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3497 }
3498 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3499 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3500 }
3501 }
3502
3503 next_offset += envelope_size;
3504 _next_ordinal_to_read += 1;
3505 if next_offset >= end_offset {
3506 return Ok(());
3507 }
3508
3509 while _next_ordinal_to_read < 4 {
3511 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3512 _next_ordinal_to_read += 1;
3513 next_offset += envelope_size;
3514 }
3515
3516 let next_out_of_line = decoder.next_out_of_line();
3517 let handles_before = decoder.remaining_handles();
3518 if let Some((inlined, num_bytes, num_handles)) =
3519 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3520 {
3521 let member_inline_size = <fidl::encoding::HandleType<
3522 fidl::EventPair,
3523 { fidl::ObjectType::EVENTPAIR.into_raw() },
3524 2147483648,
3525 > as fidl::encoding::TypeMarker>::inline_size(
3526 decoder.context
3527 );
3528 if inlined != (member_inline_size <= 4) {
3529 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3530 }
3531 let inner_offset;
3532 let mut inner_depth = depth.clone();
3533 if inlined {
3534 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3535 inner_offset = next_offset;
3536 } else {
3537 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3538 inner_depth.increment()?;
3539 }
3540 let val_ref =
3541 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3542 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3543 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3544 {
3545 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3546 }
3547 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3548 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3549 }
3550 }
3551
3552 next_offset += envelope_size;
3553 _next_ordinal_to_read += 1;
3554 if next_offset >= end_offset {
3555 return Ok(());
3556 }
3557
3558 while _next_ordinal_to_read < 5 {
3560 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3561 _next_ordinal_to_read += 1;
3562 next_offset += envelope_size;
3563 }
3564
3565 let next_out_of_line = decoder.next_out_of_line();
3566 let handles_before = decoder.remaining_handles();
3567 if let Some((inlined, num_bytes, num_handles)) =
3568 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3569 {
3570 let member_inline_size =
3571 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3572 if inlined != (member_inline_size <= 4) {
3573 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3574 }
3575 let inner_offset;
3576 let mut inner_depth = depth.clone();
3577 if inlined {
3578 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3579 inner_offset = next_offset;
3580 } else {
3581 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3582 inner_depth.increment()?;
3583 }
3584 let val_ref = self.trace_flow_id.get_or_insert_with(|| {
3585 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3586 });
3587 fidl::decode!(
3588 u64,
3589 fidl::encoding::DefaultFuchsiaResourceDialect,
3590 val_ref,
3591 decoder,
3592 inner_offset,
3593 inner_depth
3594 )?;
3595 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3596 {
3597 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3598 }
3599 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3600 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3601 }
3602 }
3603
3604 next_offset += envelope_size;
3605
3606 while next_offset < end_offset {
3608 _next_ordinal_to_read += 1;
3609 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3610 next_offset += envelope_size;
3611 }
3612
3613 Ok(())
3614 }
3615 }
3616}