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