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