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, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
29pub struct ImeServiceMarker;
30
31impl fidl::endpoints::ProtocolMarker for ImeServiceMarker {
32 type Proxy = ImeServiceProxy;
33 type RequestStream = ImeServiceRequestStream;
34 #[cfg(target_os = "fuchsia")]
35 type SynchronousProxy = ImeServiceSynchronousProxy;
36
37 const DEBUG_NAME: &'static str = "fuchsia.ui.input.ImeService";
38}
39impl fidl::endpoints::DiscoverableProtocolMarker for ImeServiceMarker {}
40
41pub trait ImeServiceProxyInterface: Send + Sync {
42 fn r#get_input_method_editor(
43 &self,
44 keyboard_type: KeyboardType,
45 action: InputMethodAction,
46 initial_state: &TextInputState,
47 client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
48 editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
49 ) -> Result<(), fidl::Error>;
50 fn r#show_keyboard(&self) -> Result<(), fidl::Error>;
51 fn r#hide_keyboard(&self) -> Result<(), fidl::Error>;
52}
53#[derive(Debug)]
54#[cfg(target_os = "fuchsia")]
55pub struct ImeServiceSynchronousProxy {
56 client: fidl::client::sync::Client,
57}
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::SynchronousProxy for ImeServiceSynchronousProxy {
61 type Proxy = ImeServiceProxy;
62 type Protocol = ImeServiceMarker;
63
64 fn from_channel(inner: fidl::Channel) -> Self {
65 Self::new(inner)
66 }
67
68 fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 fn as_channel(&self) -> &fidl::Channel {
73 self.client.as_channel()
74 }
75}
76
77#[cfg(target_os = "fuchsia")]
78impl ImeServiceSynchronousProxy {
79 pub fn new(channel: fidl::Channel) -> Self {
80 let protocol_name = <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
81 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
82 }
83
84 pub fn into_channel(self) -> fidl::Channel {
85 self.client.into_channel()
86 }
87
88 pub fn wait_for_event(
91 &self,
92 deadline: zx::MonotonicInstant,
93 ) -> Result<ImeServiceEvent, fidl::Error> {
94 ImeServiceEvent::decode(self.client.wait_for_event(deadline)?)
95 }
96
97 pub fn r#get_input_method_editor(
98 &self,
99 mut keyboard_type: KeyboardType,
100 mut action: InputMethodAction,
101 mut initial_state: &TextInputState,
102 mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
103 mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
104 ) -> Result<(), fidl::Error> {
105 self.client.send::<ImeServiceGetInputMethodEditorRequest>(
106 (keyboard_type, action, initial_state, client, editor),
107 0x148d2e42a1f461fc,
108 fidl::encoding::DynamicFlags::empty(),
109 )
110 }
111
112 pub fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
113 self.client.send::<fidl::encoding::EmptyPayload>(
114 (),
115 0x38ed2a1de28cfcf0,
116 fidl::encoding::DynamicFlags::empty(),
117 )
118 }
119
120 pub fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
121 self.client.send::<fidl::encoding::EmptyPayload>(
122 (),
123 0x7667f098198d09fd,
124 fidl::encoding::DynamicFlags::empty(),
125 )
126 }
127}
128
129#[cfg(target_os = "fuchsia")]
130impl From<ImeServiceSynchronousProxy> for zx::Handle {
131 fn from(value: ImeServiceSynchronousProxy) -> Self {
132 value.into_channel().into()
133 }
134}
135
136#[cfg(target_os = "fuchsia")]
137impl From<fidl::Channel> for ImeServiceSynchronousProxy {
138 fn from(value: fidl::Channel) -> Self {
139 Self::new(value)
140 }
141}
142
143#[derive(Debug, Clone)]
144pub struct ImeServiceProxy {
145 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
146}
147
148impl fidl::endpoints::Proxy for ImeServiceProxy {
149 type Protocol = ImeServiceMarker;
150
151 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
152 Self::new(inner)
153 }
154
155 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
156 self.client.into_channel().map_err(|client| Self { client })
157 }
158
159 fn as_channel(&self) -> &::fidl::AsyncChannel {
160 self.client.as_channel()
161 }
162}
163
164impl ImeServiceProxy {
165 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
167 let protocol_name = <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
168 Self { client: fidl::client::Client::new(channel, protocol_name) }
169 }
170
171 pub fn take_event_stream(&self) -> ImeServiceEventStream {
177 ImeServiceEventStream { event_receiver: self.client.take_event_receiver() }
178 }
179
180 pub fn r#get_input_method_editor(
181 &self,
182 mut keyboard_type: KeyboardType,
183 mut action: InputMethodAction,
184 mut initial_state: &TextInputState,
185 mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
186 mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
187 ) -> Result<(), fidl::Error> {
188 ImeServiceProxyInterface::r#get_input_method_editor(
189 self,
190 keyboard_type,
191 action,
192 initial_state,
193 client,
194 editor,
195 )
196 }
197
198 pub fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
199 ImeServiceProxyInterface::r#show_keyboard(self)
200 }
201
202 pub fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
203 ImeServiceProxyInterface::r#hide_keyboard(self)
204 }
205}
206
207impl ImeServiceProxyInterface for ImeServiceProxy {
208 fn r#get_input_method_editor(
209 &self,
210 mut keyboard_type: KeyboardType,
211 mut action: InputMethodAction,
212 mut initial_state: &TextInputState,
213 mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
214 mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
215 ) -> Result<(), fidl::Error> {
216 self.client.send::<ImeServiceGetInputMethodEditorRequest>(
217 (keyboard_type, action, initial_state, client, editor),
218 0x148d2e42a1f461fc,
219 fidl::encoding::DynamicFlags::empty(),
220 )
221 }
222
223 fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
224 self.client.send::<fidl::encoding::EmptyPayload>(
225 (),
226 0x38ed2a1de28cfcf0,
227 fidl::encoding::DynamicFlags::empty(),
228 )
229 }
230
231 fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
232 self.client.send::<fidl::encoding::EmptyPayload>(
233 (),
234 0x7667f098198d09fd,
235 fidl::encoding::DynamicFlags::empty(),
236 )
237 }
238}
239
240pub struct ImeServiceEventStream {
241 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
242}
243
244impl std::marker::Unpin for ImeServiceEventStream {}
245
246impl futures::stream::FusedStream for ImeServiceEventStream {
247 fn is_terminated(&self) -> bool {
248 self.event_receiver.is_terminated()
249 }
250}
251
252impl futures::Stream for ImeServiceEventStream {
253 type Item = Result<ImeServiceEvent, fidl::Error>;
254
255 fn poll_next(
256 mut self: std::pin::Pin<&mut Self>,
257 cx: &mut std::task::Context<'_>,
258 ) -> std::task::Poll<Option<Self::Item>> {
259 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
260 &mut self.event_receiver,
261 cx
262 )?) {
263 Some(buf) => std::task::Poll::Ready(Some(ImeServiceEvent::decode(buf))),
264 None => std::task::Poll::Ready(None),
265 }
266 }
267}
268
269#[derive(Debug)]
270pub enum ImeServiceEvent {}
271
272impl ImeServiceEvent {
273 fn decode(
275 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
276 ) -> Result<ImeServiceEvent, fidl::Error> {
277 let (bytes, _handles) = buf.split_mut();
278 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
279 debug_assert_eq!(tx_header.tx_id, 0);
280 match tx_header.ordinal {
281 _ => Err(fidl::Error::UnknownOrdinal {
282 ordinal: tx_header.ordinal,
283 protocol_name: <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
284 }),
285 }
286 }
287}
288
289pub struct ImeServiceRequestStream {
291 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
292 is_terminated: bool,
293}
294
295impl std::marker::Unpin for ImeServiceRequestStream {}
296
297impl futures::stream::FusedStream for ImeServiceRequestStream {
298 fn is_terminated(&self) -> bool {
299 self.is_terminated
300 }
301}
302
303impl fidl::endpoints::RequestStream for ImeServiceRequestStream {
304 type Protocol = ImeServiceMarker;
305 type ControlHandle = ImeServiceControlHandle;
306
307 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
308 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
309 }
310
311 fn control_handle(&self) -> Self::ControlHandle {
312 ImeServiceControlHandle { inner: self.inner.clone() }
313 }
314
315 fn into_inner(
316 self,
317 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
318 {
319 (self.inner, self.is_terminated)
320 }
321
322 fn from_inner(
323 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
324 is_terminated: bool,
325 ) -> Self {
326 Self { inner, is_terminated }
327 }
328}
329
330impl futures::Stream for ImeServiceRequestStream {
331 type Item = Result<ImeServiceRequest, fidl::Error>;
332
333 fn poll_next(
334 mut self: std::pin::Pin<&mut Self>,
335 cx: &mut std::task::Context<'_>,
336 ) -> std::task::Poll<Option<Self::Item>> {
337 let this = &mut *self;
338 if this.inner.check_shutdown(cx) {
339 this.is_terminated = true;
340 return std::task::Poll::Ready(None);
341 }
342 if this.is_terminated {
343 panic!("polled ImeServiceRequestStream after completion");
344 }
345 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
346 |bytes, handles| {
347 match this.inner.channel().read_etc(cx, bytes, handles) {
348 std::task::Poll::Ready(Ok(())) => {}
349 std::task::Poll::Pending => return std::task::Poll::Pending,
350 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
351 this.is_terminated = true;
352 return std::task::Poll::Ready(None);
353 }
354 std::task::Poll::Ready(Err(e)) => {
355 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
356 e.into(),
357 ))))
358 }
359 }
360
361 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
363
364 std::task::Poll::Ready(Some(match header.ordinal {
365 0x148d2e42a1f461fc => {
366 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
367 let mut req = fidl::new_empty!(
368 ImeServiceGetInputMethodEditorRequest,
369 fidl::encoding::DefaultFuchsiaResourceDialect
370 );
371 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImeServiceGetInputMethodEditorRequest>(&header, _body_bytes, handles, &mut req)?;
372 let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
373 Ok(ImeServiceRequest::GetInputMethodEditor {
374 keyboard_type: req.keyboard_type,
375 action: req.action,
376 initial_state: req.initial_state,
377 client: req.client,
378 editor: req.editor,
379
380 control_handle,
381 })
382 }
383 0x38ed2a1de28cfcf0 => {
384 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
385 let mut req = fidl::new_empty!(
386 fidl::encoding::EmptyPayload,
387 fidl::encoding::DefaultFuchsiaResourceDialect
388 );
389 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
390 let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
391 Ok(ImeServiceRequest::ShowKeyboard { control_handle })
392 }
393 0x7667f098198d09fd => {
394 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
395 let mut req = fidl::new_empty!(
396 fidl::encoding::EmptyPayload,
397 fidl::encoding::DefaultFuchsiaResourceDialect
398 );
399 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
400 let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
401 Ok(ImeServiceRequest::HideKeyboard { control_handle })
402 }
403 _ => Err(fidl::Error::UnknownOrdinal {
404 ordinal: header.ordinal,
405 protocol_name:
406 <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
407 }),
408 }))
409 },
410 )
411 }
412}
413
414#[derive(Debug)]
416pub enum ImeServiceRequest {
417 GetInputMethodEditor {
418 keyboard_type: KeyboardType,
419 action: InputMethodAction,
420 initial_state: TextInputState,
421 client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
422 editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
423 control_handle: ImeServiceControlHandle,
424 },
425 ShowKeyboard {
426 control_handle: ImeServiceControlHandle,
427 },
428 HideKeyboard {
429 control_handle: ImeServiceControlHandle,
430 },
431}
432
433impl ImeServiceRequest {
434 #[allow(irrefutable_let_patterns)]
435 pub fn into_get_input_method_editor(
436 self,
437 ) -> Option<(
438 KeyboardType,
439 InputMethodAction,
440 TextInputState,
441 fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
442 fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
443 ImeServiceControlHandle,
444 )> {
445 if let ImeServiceRequest::GetInputMethodEditor {
446 keyboard_type,
447 action,
448 initial_state,
449 client,
450 editor,
451 control_handle,
452 } = self
453 {
454 Some((keyboard_type, action, initial_state, client, editor, control_handle))
455 } else {
456 None
457 }
458 }
459
460 #[allow(irrefutable_let_patterns)]
461 pub fn into_show_keyboard(self) -> Option<(ImeServiceControlHandle)> {
462 if let ImeServiceRequest::ShowKeyboard { control_handle } = self {
463 Some((control_handle))
464 } else {
465 None
466 }
467 }
468
469 #[allow(irrefutable_let_patterns)]
470 pub fn into_hide_keyboard(self) -> Option<(ImeServiceControlHandle)> {
471 if let ImeServiceRequest::HideKeyboard { control_handle } = self {
472 Some((control_handle))
473 } else {
474 None
475 }
476 }
477
478 pub fn method_name(&self) -> &'static str {
480 match *self {
481 ImeServiceRequest::GetInputMethodEditor { .. } => "get_input_method_editor",
482 ImeServiceRequest::ShowKeyboard { .. } => "show_keyboard",
483 ImeServiceRequest::HideKeyboard { .. } => "hide_keyboard",
484 }
485 }
486}
487
488#[derive(Debug, Clone)]
489pub struct ImeServiceControlHandle {
490 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
491}
492
493impl fidl::endpoints::ControlHandle for ImeServiceControlHandle {
494 fn shutdown(&self) {
495 self.inner.shutdown()
496 }
497 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
498 self.inner.shutdown_with_epitaph(status)
499 }
500
501 fn is_closed(&self) -> bool {
502 self.inner.channel().is_closed()
503 }
504 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
505 self.inner.channel().on_closed()
506 }
507
508 #[cfg(target_os = "fuchsia")]
509 fn signal_peer(
510 &self,
511 clear_mask: zx::Signals,
512 set_mask: zx::Signals,
513 ) -> Result<(), zx_status::Status> {
514 use fidl::Peered;
515 self.inner.channel().signal_peer(clear_mask, set_mask)
516 }
517}
518
519impl ImeServiceControlHandle {}
520
521#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
522pub struct InputDeviceMarker;
523
524impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
525 type Proxy = InputDeviceProxy;
526 type RequestStream = InputDeviceRequestStream;
527 #[cfg(target_os = "fuchsia")]
528 type SynchronousProxy = InputDeviceSynchronousProxy;
529
530 const DEBUG_NAME: &'static str = "(anonymous) InputDevice";
531}
532
533pub trait InputDeviceProxyInterface: Send + Sync {
534 fn r#dispatch_report(&self, report: &InputReport) -> Result<(), fidl::Error>;
535}
536#[derive(Debug)]
537#[cfg(target_os = "fuchsia")]
538pub struct InputDeviceSynchronousProxy {
539 client: fidl::client::sync::Client,
540}
541
542#[cfg(target_os = "fuchsia")]
543impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
544 type Proxy = InputDeviceProxy;
545 type Protocol = InputDeviceMarker;
546
547 fn from_channel(inner: fidl::Channel) -> Self {
548 Self::new(inner)
549 }
550
551 fn into_channel(self) -> fidl::Channel {
552 self.client.into_channel()
553 }
554
555 fn as_channel(&self) -> &fidl::Channel {
556 self.client.as_channel()
557 }
558}
559
560#[cfg(target_os = "fuchsia")]
561impl InputDeviceSynchronousProxy {
562 pub fn new(channel: fidl::Channel) -> Self {
563 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
564 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
565 }
566
567 pub fn into_channel(self) -> fidl::Channel {
568 self.client.into_channel()
569 }
570
571 pub fn wait_for_event(
574 &self,
575 deadline: zx::MonotonicInstant,
576 ) -> Result<InputDeviceEvent, fidl::Error> {
577 InputDeviceEvent::decode(self.client.wait_for_event(deadline)?)
578 }
579
580 pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
582 self.client.send::<InputDeviceDispatchReportRequest>(
583 (report,),
584 0x7ee375d01c8e149f,
585 fidl::encoding::DynamicFlags::empty(),
586 )
587 }
588}
589
590#[cfg(target_os = "fuchsia")]
591impl From<InputDeviceSynchronousProxy> for zx::Handle {
592 fn from(value: InputDeviceSynchronousProxy) -> Self {
593 value.into_channel().into()
594 }
595}
596
597#[cfg(target_os = "fuchsia")]
598impl From<fidl::Channel> for InputDeviceSynchronousProxy {
599 fn from(value: fidl::Channel) -> Self {
600 Self::new(value)
601 }
602}
603
604#[derive(Debug, Clone)]
605pub struct InputDeviceProxy {
606 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
607}
608
609impl fidl::endpoints::Proxy for InputDeviceProxy {
610 type Protocol = InputDeviceMarker;
611
612 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
613 Self::new(inner)
614 }
615
616 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
617 self.client.into_channel().map_err(|client| Self { client })
618 }
619
620 fn as_channel(&self) -> &::fidl::AsyncChannel {
621 self.client.as_channel()
622 }
623}
624
625impl InputDeviceProxy {
626 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
628 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
629 Self { client: fidl::client::Client::new(channel, protocol_name) }
630 }
631
632 pub fn take_event_stream(&self) -> InputDeviceEventStream {
638 InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
639 }
640
641 pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
643 InputDeviceProxyInterface::r#dispatch_report(self, report)
644 }
645}
646
647impl InputDeviceProxyInterface for InputDeviceProxy {
648 fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
649 self.client.send::<InputDeviceDispatchReportRequest>(
650 (report,),
651 0x7ee375d01c8e149f,
652 fidl::encoding::DynamicFlags::empty(),
653 )
654 }
655}
656
657pub struct InputDeviceEventStream {
658 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
659}
660
661impl std::marker::Unpin for InputDeviceEventStream {}
662
663impl futures::stream::FusedStream for InputDeviceEventStream {
664 fn is_terminated(&self) -> bool {
665 self.event_receiver.is_terminated()
666 }
667}
668
669impl futures::Stream for InputDeviceEventStream {
670 type Item = Result<InputDeviceEvent, fidl::Error>;
671
672 fn poll_next(
673 mut self: std::pin::Pin<&mut Self>,
674 cx: &mut std::task::Context<'_>,
675 ) -> std::task::Poll<Option<Self::Item>> {
676 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
677 &mut self.event_receiver,
678 cx
679 )?) {
680 Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
681 None => std::task::Poll::Ready(None),
682 }
683 }
684}
685
686#[derive(Debug)]
687pub enum InputDeviceEvent {}
688
689impl InputDeviceEvent {
690 fn decode(
692 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
693 ) -> Result<InputDeviceEvent, fidl::Error> {
694 let (bytes, _handles) = buf.split_mut();
695 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
696 debug_assert_eq!(tx_header.tx_id, 0);
697 match tx_header.ordinal {
698 _ => Err(fidl::Error::UnknownOrdinal {
699 ordinal: tx_header.ordinal,
700 protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
701 }),
702 }
703 }
704}
705
706pub struct InputDeviceRequestStream {
708 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
709 is_terminated: bool,
710}
711
712impl std::marker::Unpin for InputDeviceRequestStream {}
713
714impl futures::stream::FusedStream for InputDeviceRequestStream {
715 fn is_terminated(&self) -> bool {
716 self.is_terminated
717 }
718}
719
720impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
721 type Protocol = InputDeviceMarker;
722 type ControlHandle = InputDeviceControlHandle;
723
724 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
725 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
726 }
727
728 fn control_handle(&self) -> Self::ControlHandle {
729 InputDeviceControlHandle { inner: self.inner.clone() }
730 }
731
732 fn into_inner(
733 self,
734 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
735 {
736 (self.inner, self.is_terminated)
737 }
738
739 fn from_inner(
740 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
741 is_terminated: bool,
742 ) -> Self {
743 Self { inner, is_terminated }
744 }
745}
746
747impl futures::Stream for InputDeviceRequestStream {
748 type Item = Result<InputDeviceRequest, fidl::Error>;
749
750 fn poll_next(
751 mut self: std::pin::Pin<&mut Self>,
752 cx: &mut std::task::Context<'_>,
753 ) -> std::task::Poll<Option<Self::Item>> {
754 let this = &mut *self;
755 if this.inner.check_shutdown(cx) {
756 this.is_terminated = true;
757 return std::task::Poll::Ready(None);
758 }
759 if this.is_terminated {
760 panic!("polled InputDeviceRequestStream after completion");
761 }
762 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
763 |bytes, handles| {
764 match this.inner.channel().read_etc(cx, bytes, handles) {
765 std::task::Poll::Ready(Ok(())) => {}
766 std::task::Poll::Pending => return std::task::Poll::Pending,
767 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
768 this.is_terminated = true;
769 return std::task::Poll::Ready(None);
770 }
771 std::task::Poll::Ready(Err(e)) => {
772 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
773 e.into(),
774 ))))
775 }
776 }
777
778 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
780
781 std::task::Poll::Ready(Some(match header.ordinal {
782 0x7ee375d01c8e149f => {
783 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
784 let mut req = fidl::new_empty!(
785 InputDeviceDispatchReportRequest,
786 fidl::encoding::DefaultFuchsiaResourceDialect
787 );
788 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceDispatchReportRequest>(&header, _body_bytes, handles, &mut req)?;
789 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
790 Ok(InputDeviceRequest::DispatchReport {
791 report: req.report,
792
793 control_handle,
794 })
795 }
796 _ => Err(fidl::Error::UnknownOrdinal {
797 ordinal: header.ordinal,
798 protocol_name:
799 <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
800 }),
801 }))
802 },
803 )
804 }
805}
806
807#[derive(Debug)]
808pub enum InputDeviceRequest {
809 DispatchReport { report: InputReport, control_handle: InputDeviceControlHandle },
811}
812
813impl InputDeviceRequest {
814 #[allow(irrefutable_let_patterns)]
815 pub fn into_dispatch_report(self) -> Option<(InputReport, InputDeviceControlHandle)> {
816 if let InputDeviceRequest::DispatchReport { report, control_handle } = self {
817 Some((report, control_handle))
818 } else {
819 None
820 }
821 }
822
823 pub fn method_name(&self) -> &'static str {
825 match *self {
826 InputDeviceRequest::DispatchReport { .. } => "dispatch_report",
827 }
828 }
829}
830
831#[derive(Debug, Clone)]
832pub struct InputDeviceControlHandle {
833 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
834}
835
836impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
837 fn shutdown(&self) {
838 self.inner.shutdown()
839 }
840 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
841 self.inner.shutdown_with_epitaph(status)
842 }
843
844 fn is_closed(&self) -> bool {
845 self.inner.channel().is_closed()
846 }
847 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
848 self.inner.channel().on_closed()
849 }
850
851 #[cfg(target_os = "fuchsia")]
852 fn signal_peer(
853 &self,
854 clear_mask: zx::Signals,
855 set_mask: zx::Signals,
856 ) -> Result<(), zx_status::Status> {
857 use fidl::Peered;
858 self.inner.channel().signal_peer(clear_mask, set_mask)
859 }
860}
861
862impl InputDeviceControlHandle {}
863
864#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
865pub struct InputMethodEditorMarker;
866
867impl fidl::endpoints::ProtocolMarker for InputMethodEditorMarker {
868 type Proxy = InputMethodEditorProxy;
869 type RequestStream = InputMethodEditorRequestStream;
870 #[cfg(target_os = "fuchsia")]
871 type SynchronousProxy = InputMethodEditorSynchronousProxy;
872
873 const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditor";
874}
875
876pub trait InputMethodEditorProxyInterface: Send + Sync {
877 fn r#set_keyboard_type(&self, keyboard_type: KeyboardType) -> Result<(), fidl::Error>;
878 fn r#set_state(&self, state: &TextInputState) -> Result<(), fidl::Error>;
879 fn r#inject_input(&self, event: &InputEvent) -> Result<(), fidl::Error>;
880 type DispatchKey3ResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
881 fn r#dispatch_key3(
882 &self,
883 event: &fidl_fuchsia_ui_input3::KeyEvent,
884 ) -> Self::DispatchKey3ResponseFut;
885 fn r#show(&self) -> Result<(), fidl::Error>;
886 fn r#hide(&self) -> Result<(), fidl::Error>;
887}
888#[derive(Debug)]
889#[cfg(target_os = "fuchsia")]
890pub struct InputMethodEditorSynchronousProxy {
891 client: fidl::client::sync::Client,
892}
893
894#[cfg(target_os = "fuchsia")]
895impl fidl::endpoints::SynchronousProxy for InputMethodEditorSynchronousProxy {
896 type Proxy = InputMethodEditorProxy;
897 type Protocol = InputMethodEditorMarker;
898
899 fn from_channel(inner: fidl::Channel) -> Self {
900 Self::new(inner)
901 }
902
903 fn into_channel(self) -> fidl::Channel {
904 self.client.into_channel()
905 }
906
907 fn as_channel(&self) -> &fidl::Channel {
908 self.client.as_channel()
909 }
910}
911
912#[cfg(target_os = "fuchsia")]
913impl InputMethodEditorSynchronousProxy {
914 pub fn new(channel: fidl::Channel) -> Self {
915 let protocol_name =
916 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
917 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
918 }
919
920 pub fn into_channel(self) -> fidl::Channel {
921 self.client.into_channel()
922 }
923
924 pub fn wait_for_event(
927 &self,
928 deadline: zx::MonotonicInstant,
929 ) -> Result<InputMethodEditorEvent, fidl::Error> {
930 InputMethodEditorEvent::decode(self.client.wait_for_event(deadline)?)
931 }
932
933 pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
934 self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
935 (keyboard_type,),
936 0x14fe60e927d7d487,
937 fidl::encoding::DynamicFlags::empty(),
938 )
939 }
940
941 pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
942 self.client.send::<InputMethodEditorSetStateRequest>(
943 (state,),
944 0x12b477b779818f45,
945 fidl::encoding::DynamicFlags::empty(),
946 )
947 }
948
949 pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
950 self.client.send::<InputMethodEditorInjectInputRequest>(
951 (event,),
952 0x34af74618a4f82b,
953 fidl::encoding::DynamicFlags::empty(),
954 )
955 }
956
957 pub fn r#dispatch_key3(
958 &self,
959 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
960 ___deadline: zx::MonotonicInstant,
961 ) -> Result<bool, fidl::Error> {
962 let _response = self.client.send_query::<
963 InputMethodEditorDispatchKey3Request,
964 InputMethodEditorDispatchKey3Response,
965 >(
966 (event,),
967 0x2e13667c827209ac,
968 fidl::encoding::DynamicFlags::empty(),
969 ___deadline,
970 )?;
971 Ok(_response.handled)
972 }
973
974 pub fn r#show(&self) -> Result<(), fidl::Error> {
975 self.client.send::<fidl::encoding::EmptyPayload>(
976 (),
977 0x19ba00ba1beb002e,
978 fidl::encoding::DynamicFlags::empty(),
979 )
980 }
981
982 pub fn r#hide(&self) -> Result<(), fidl::Error> {
983 self.client.send::<fidl::encoding::EmptyPayload>(
984 (),
985 0x283e0cd73f0d6d9e,
986 fidl::encoding::DynamicFlags::empty(),
987 )
988 }
989}
990
991#[cfg(target_os = "fuchsia")]
992impl From<InputMethodEditorSynchronousProxy> for zx::Handle {
993 fn from(value: InputMethodEditorSynchronousProxy) -> Self {
994 value.into_channel().into()
995 }
996}
997
998#[cfg(target_os = "fuchsia")]
999impl From<fidl::Channel> for InputMethodEditorSynchronousProxy {
1000 fn from(value: fidl::Channel) -> Self {
1001 Self::new(value)
1002 }
1003}
1004
1005#[derive(Debug, Clone)]
1006pub struct InputMethodEditorProxy {
1007 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1008}
1009
1010impl fidl::endpoints::Proxy for InputMethodEditorProxy {
1011 type Protocol = InputMethodEditorMarker;
1012
1013 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1014 Self::new(inner)
1015 }
1016
1017 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1018 self.client.into_channel().map_err(|client| Self { client })
1019 }
1020
1021 fn as_channel(&self) -> &::fidl::AsyncChannel {
1022 self.client.as_channel()
1023 }
1024}
1025
1026impl InputMethodEditorProxy {
1027 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1029 let protocol_name =
1030 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1031 Self { client: fidl::client::Client::new(channel, protocol_name) }
1032 }
1033
1034 pub fn take_event_stream(&self) -> InputMethodEditorEventStream {
1040 InputMethodEditorEventStream { event_receiver: self.client.take_event_receiver() }
1041 }
1042
1043 pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
1044 InputMethodEditorProxyInterface::r#set_keyboard_type(self, keyboard_type)
1045 }
1046
1047 pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
1048 InputMethodEditorProxyInterface::r#set_state(self, state)
1049 }
1050
1051 pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
1052 InputMethodEditorProxyInterface::r#inject_input(self, event)
1053 }
1054
1055 pub fn r#dispatch_key3(
1056 &self,
1057 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
1058 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
1059 InputMethodEditorProxyInterface::r#dispatch_key3(self, event)
1060 }
1061
1062 pub fn r#show(&self) -> Result<(), fidl::Error> {
1063 InputMethodEditorProxyInterface::r#show(self)
1064 }
1065
1066 pub fn r#hide(&self) -> Result<(), fidl::Error> {
1067 InputMethodEditorProxyInterface::r#hide(self)
1068 }
1069}
1070
1071impl InputMethodEditorProxyInterface for InputMethodEditorProxy {
1072 fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
1073 self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
1074 (keyboard_type,),
1075 0x14fe60e927d7d487,
1076 fidl::encoding::DynamicFlags::empty(),
1077 )
1078 }
1079
1080 fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
1081 self.client.send::<InputMethodEditorSetStateRequest>(
1082 (state,),
1083 0x12b477b779818f45,
1084 fidl::encoding::DynamicFlags::empty(),
1085 )
1086 }
1087
1088 fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
1089 self.client.send::<InputMethodEditorInjectInputRequest>(
1090 (event,),
1091 0x34af74618a4f82b,
1092 fidl::encoding::DynamicFlags::empty(),
1093 )
1094 }
1095
1096 type DispatchKey3ResponseFut =
1097 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
1098 fn r#dispatch_key3(
1099 &self,
1100 mut event: &fidl_fuchsia_ui_input3::KeyEvent,
1101 ) -> Self::DispatchKey3ResponseFut {
1102 fn _decode(
1103 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1104 ) -> Result<bool, fidl::Error> {
1105 let _response = fidl::client::decode_transaction_body::<
1106 InputMethodEditorDispatchKey3Response,
1107 fidl::encoding::DefaultFuchsiaResourceDialect,
1108 0x2e13667c827209ac,
1109 >(_buf?)?;
1110 Ok(_response.handled)
1111 }
1112 self.client.send_query_and_decode::<InputMethodEditorDispatchKey3Request, bool>(
1113 (event,),
1114 0x2e13667c827209ac,
1115 fidl::encoding::DynamicFlags::empty(),
1116 _decode,
1117 )
1118 }
1119
1120 fn r#show(&self) -> Result<(), fidl::Error> {
1121 self.client.send::<fidl::encoding::EmptyPayload>(
1122 (),
1123 0x19ba00ba1beb002e,
1124 fidl::encoding::DynamicFlags::empty(),
1125 )
1126 }
1127
1128 fn r#hide(&self) -> Result<(), fidl::Error> {
1129 self.client.send::<fidl::encoding::EmptyPayload>(
1130 (),
1131 0x283e0cd73f0d6d9e,
1132 fidl::encoding::DynamicFlags::empty(),
1133 )
1134 }
1135}
1136
1137pub struct InputMethodEditorEventStream {
1138 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1139}
1140
1141impl std::marker::Unpin for InputMethodEditorEventStream {}
1142
1143impl futures::stream::FusedStream for InputMethodEditorEventStream {
1144 fn is_terminated(&self) -> bool {
1145 self.event_receiver.is_terminated()
1146 }
1147}
1148
1149impl futures::Stream for InputMethodEditorEventStream {
1150 type Item = Result<InputMethodEditorEvent, fidl::Error>;
1151
1152 fn poll_next(
1153 mut self: std::pin::Pin<&mut Self>,
1154 cx: &mut std::task::Context<'_>,
1155 ) -> std::task::Poll<Option<Self::Item>> {
1156 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1157 &mut self.event_receiver,
1158 cx
1159 )?) {
1160 Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorEvent::decode(buf))),
1161 None => std::task::Poll::Ready(None),
1162 }
1163 }
1164}
1165
1166#[derive(Debug)]
1167pub enum InputMethodEditorEvent {}
1168
1169impl InputMethodEditorEvent {
1170 fn decode(
1172 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1173 ) -> Result<InputMethodEditorEvent, fidl::Error> {
1174 let (bytes, _handles) = buf.split_mut();
1175 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1176 debug_assert_eq!(tx_header.tx_id, 0);
1177 match tx_header.ordinal {
1178 _ => Err(fidl::Error::UnknownOrdinal {
1179 ordinal: tx_header.ordinal,
1180 protocol_name:
1181 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1182 }),
1183 }
1184 }
1185}
1186
1187pub struct InputMethodEditorRequestStream {
1189 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1190 is_terminated: bool,
1191}
1192
1193impl std::marker::Unpin for InputMethodEditorRequestStream {}
1194
1195impl futures::stream::FusedStream for InputMethodEditorRequestStream {
1196 fn is_terminated(&self) -> bool {
1197 self.is_terminated
1198 }
1199}
1200
1201impl fidl::endpoints::RequestStream for InputMethodEditorRequestStream {
1202 type Protocol = InputMethodEditorMarker;
1203 type ControlHandle = InputMethodEditorControlHandle;
1204
1205 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1206 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1207 }
1208
1209 fn control_handle(&self) -> Self::ControlHandle {
1210 InputMethodEditorControlHandle { inner: self.inner.clone() }
1211 }
1212
1213 fn into_inner(
1214 self,
1215 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1216 {
1217 (self.inner, self.is_terminated)
1218 }
1219
1220 fn from_inner(
1221 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1222 is_terminated: bool,
1223 ) -> Self {
1224 Self { inner, is_terminated }
1225 }
1226}
1227
1228impl futures::Stream for InputMethodEditorRequestStream {
1229 type Item = Result<InputMethodEditorRequest, fidl::Error>;
1230
1231 fn poll_next(
1232 mut self: std::pin::Pin<&mut Self>,
1233 cx: &mut std::task::Context<'_>,
1234 ) -> std::task::Poll<Option<Self::Item>> {
1235 let this = &mut *self;
1236 if this.inner.check_shutdown(cx) {
1237 this.is_terminated = true;
1238 return std::task::Poll::Ready(None);
1239 }
1240 if this.is_terminated {
1241 panic!("polled InputMethodEditorRequestStream after completion");
1242 }
1243 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1244 |bytes, handles| {
1245 match this.inner.channel().read_etc(cx, bytes, handles) {
1246 std::task::Poll::Ready(Ok(())) => {}
1247 std::task::Poll::Pending => return std::task::Poll::Pending,
1248 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1249 this.is_terminated = true;
1250 return std::task::Poll::Ready(None);
1251 }
1252 std::task::Poll::Ready(Err(e)) => {
1253 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1254 e.into(),
1255 ))))
1256 }
1257 }
1258
1259 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1261
1262 std::task::Poll::Ready(Some(match header.ordinal {
1263 0x14fe60e927d7d487 => {
1264 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1265 let mut req = fidl::new_empty!(
1266 InputMethodEditorSetKeyboardTypeRequest,
1267 fidl::encoding::DefaultFuchsiaResourceDialect
1268 );
1269 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorSetKeyboardTypeRequest>(&header, _body_bytes, handles, &mut req)?;
1270 let control_handle =
1271 InputMethodEditorControlHandle { inner: this.inner.clone() };
1272 Ok(InputMethodEditorRequest::SetKeyboardType {
1273 keyboard_type: req.keyboard_type,
1274
1275 control_handle,
1276 })
1277 }
1278 0x12b477b779818f45 => {
1279 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1280 let mut req = fidl::new_empty!(
1281 InputMethodEditorSetStateRequest,
1282 fidl::encoding::DefaultFuchsiaResourceDialect
1283 );
1284 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorSetStateRequest>(&header, _body_bytes, handles, &mut req)?;
1285 let control_handle =
1286 InputMethodEditorControlHandle { inner: this.inner.clone() };
1287 Ok(InputMethodEditorRequest::SetState { state: req.state, control_handle })
1288 }
1289 0x34af74618a4f82b => {
1290 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1291 let mut req = fidl::new_empty!(
1292 InputMethodEditorInjectInputRequest,
1293 fidl::encoding::DefaultFuchsiaResourceDialect
1294 );
1295 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorInjectInputRequest>(&header, _body_bytes, handles, &mut req)?;
1296 let control_handle =
1297 InputMethodEditorControlHandle { inner: this.inner.clone() };
1298 Ok(InputMethodEditorRequest::InjectInput {
1299 event: req.event,
1300
1301 control_handle,
1302 })
1303 }
1304 0x2e13667c827209ac => {
1305 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1306 let mut req = fidl::new_empty!(
1307 InputMethodEditorDispatchKey3Request,
1308 fidl::encoding::DefaultFuchsiaResourceDialect
1309 );
1310 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorDispatchKey3Request>(&header, _body_bytes, handles, &mut req)?;
1311 let control_handle =
1312 InputMethodEditorControlHandle { inner: this.inner.clone() };
1313 Ok(InputMethodEditorRequest::DispatchKey3 {
1314 event: req.event,
1315
1316 responder: InputMethodEditorDispatchKey3Responder {
1317 control_handle: std::mem::ManuallyDrop::new(control_handle),
1318 tx_id: header.tx_id,
1319 },
1320 })
1321 }
1322 0x19ba00ba1beb002e => {
1323 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1324 let mut req = fidl::new_empty!(
1325 fidl::encoding::EmptyPayload,
1326 fidl::encoding::DefaultFuchsiaResourceDialect
1327 );
1328 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1329 let control_handle =
1330 InputMethodEditorControlHandle { inner: this.inner.clone() };
1331 Ok(InputMethodEditorRequest::Show { control_handle })
1332 }
1333 0x283e0cd73f0d6d9e => {
1334 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1335 let mut req = fidl::new_empty!(
1336 fidl::encoding::EmptyPayload,
1337 fidl::encoding::DefaultFuchsiaResourceDialect
1338 );
1339 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1340 let control_handle =
1341 InputMethodEditorControlHandle { inner: this.inner.clone() };
1342 Ok(InputMethodEditorRequest::Hide { control_handle })
1343 }
1344 _ => Err(fidl::Error::UnknownOrdinal {
1345 ordinal: header.ordinal,
1346 protocol_name:
1347 <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1348 }),
1349 }))
1350 },
1351 )
1352 }
1353}
1354
1355#[derive(Debug)]
1357pub enum InputMethodEditorRequest {
1358 SetKeyboardType {
1359 keyboard_type: KeyboardType,
1360 control_handle: InputMethodEditorControlHandle,
1361 },
1362 SetState {
1363 state: TextInputState,
1364 control_handle: InputMethodEditorControlHandle,
1365 },
1366 InjectInput {
1367 event: InputEvent,
1368 control_handle: InputMethodEditorControlHandle,
1369 },
1370 DispatchKey3 {
1371 event: fidl_fuchsia_ui_input3::KeyEvent,
1372 responder: InputMethodEditorDispatchKey3Responder,
1373 },
1374 Show {
1375 control_handle: InputMethodEditorControlHandle,
1376 },
1377 Hide {
1378 control_handle: InputMethodEditorControlHandle,
1379 },
1380}
1381
1382impl InputMethodEditorRequest {
1383 #[allow(irrefutable_let_patterns)]
1384 pub fn into_set_keyboard_type(self) -> Option<(KeyboardType, InputMethodEditorControlHandle)> {
1385 if let InputMethodEditorRequest::SetKeyboardType { keyboard_type, control_handle } = self {
1386 Some((keyboard_type, control_handle))
1387 } else {
1388 None
1389 }
1390 }
1391
1392 #[allow(irrefutable_let_patterns)]
1393 pub fn into_set_state(self) -> Option<(TextInputState, InputMethodEditorControlHandle)> {
1394 if let InputMethodEditorRequest::SetState { state, control_handle } = self {
1395 Some((state, control_handle))
1396 } else {
1397 None
1398 }
1399 }
1400
1401 #[allow(irrefutable_let_patterns)]
1402 pub fn into_inject_input(self) -> Option<(InputEvent, InputMethodEditorControlHandle)> {
1403 if let InputMethodEditorRequest::InjectInput { event, control_handle } = self {
1404 Some((event, control_handle))
1405 } else {
1406 None
1407 }
1408 }
1409
1410 #[allow(irrefutable_let_patterns)]
1411 pub fn into_dispatch_key3(
1412 self,
1413 ) -> Option<(fidl_fuchsia_ui_input3::KeyEvent, InputMethodEditorDispatchKey3Responder)> {
1414 if let InputMethodEditorRequest::DispatchKey3 { event, responder } = self {
1415 Some((event, responder))
1416 } else {
1417 None
1418 }
1419 }
1420
1421 #[allow(irrefutable_let_patterns)]
1422 pub fn into_show(self) -> Option<(InputMethodEditorControlHandle)> {
1423 if let InputMethodEditorRequest::Show { control_handle } = self {
1424 Some((control_handle))
1425 } else {
1426 None
1427 }
1428 }
1429
1430 #[allow(irrefutable_let_patterns)]
1431 pub fn into_hide(self) -> Option<(InputMethodEditorControlHandle)> {
1432 if let InputMethodEditorRequest::Hide { control_handle } = self {
1433 Some((control_handle))
1434 } else {
1435 None
1436 }
1437 }
1438
1439 pub fn method_name(&self) -> &'static str {
1441 match *self {
1442 InputMethodEditorRequest::SetKeyboardType { .. } => "set_keyboard_type",
1443 InputMethodEditorRequest::SetState { .. } => "set_state",
1444 InputMethodEditorRequest::InjectInput { .. } => "inject_input",
1445 InputMethodEditorRequest::DispatchKey3 { .. } => "dispatch_key3",
1446 InputMethodEditorRequest::Show { .. } => "show",
1447 InputMethodEditorRequest::Hide { .. } => "hide",
1448 }
1449 }
1450}
1451
1452#[derive(Debug, Clone)]
1453pub struct InputMethodEditorControlHandle {
1454 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1455}
1456
1457impl fidl::endpoints::ControlHandle for InputMethodEditorControlHandle {
1458 fn shutdown(&self) {
1459 self.inner.shutdown()
1460 }
1461 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1462 self.inner.shutdown_with_epitaph(status)
1463 }
1464
1465 fn is_closed(&self) -> bool {
1466 self.inner.channel().is_closed()
1467 }
1468 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1469 self.inner.channel().on_closed()
1470 }
1471
1472 #[cfg(target_os = "fuchsia")]
1473 fn signal_peer(
1474 &self,
1475 clear_mask: zx::Signals,
1476 set_mask: zx::Signals,
1477 ) -> Result<(), zx_status::Status> {
1478 use fidl::Peered;
1479 self.inner.channel().signal_peer(clear_mask, set_mask)
1480 }
1481}
1482
1483impl InputMethodEditorControlHandle {}
1484
1485#[must_use = "FIDL methods require a response to be sent"]
1486#[derive(Debug)]
1487pub struct InputMethodEditorDispatchKey3Responder {
1488 control_handle: std::mem::ManuallyDrop<InputMethodEditorControlHandle>,
1489 tx_id: u32,
1490}
1491
1492impl std::ops::Drop for InputMethodEditorDispatchKey3Responder {
1496 fn drop(&mut self) {
1497 self.control_handle.shutdown();
1498 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1500 }
1501}
1502
1503impl fidl::endpoints::Responder for InputMethodEditorDispatchKey3Responder {
1504 type ControlHandle = InputMethodEditorControlHandle;
1505
1506 fn control_handle(&self) -> &InputMethodEditorControlHandle {
1507 &self.control_handle
1508 }
1509
1510 fn drop_without_shutdown(mut self) {
1511 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1513 std::mem::forget(self);
1515 }
1516}
1517
1518impl InputMethodEditorDispatchKey3Responder {
1519 pub fn send(self, mut handled: bool) -> Result<(), fidl::Error> {
1523 let _result = self.send_raw(handled);
1524 if _result.is_err() {
1525 self.control_handle.shutdown();
1526 }
1527 self.drop_without_shutdown();
1528 _result
1529 }
1530
1531 pub fn send_no_shutdown_on_err(self, mut handled: bool) -> Result<(), fidl::Error> {
1533 let _result = self.send_raw(handled);
1534 self.drop_without_shutdown();
1535 _result
1536 }
1537
1538 fn send_raw(&self, mut handled: bool) -> Result<(), fidl::Error> {
1539 self.control_handle.inner.send::<InputMethodEditorDispatchKey3Response>(
1540 (handled,),
1541 self.tx_id,
1542 0x2e13667c827209ac,
1543 fidl::encoding::DynamicFlags::empty(),
1544 )
1545 }
1546}
1547
1548#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1549pub struct InputMethodEditorClientMarker;
1550
1551impl fidl::endpoints::ProtocolMarker for InputMethodEditorClientMarker {
1552 type Proxy = InputMethodEditorClientProxy;
1553 type RequestStream = InputMethodEditorClientRequestStream;
1554 #[cfg(target_os = "fuchsia")]
1555 type SynchronousProxy = InputMethodEditorClientSynchronousProxy;
1556
1557 const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditorClient";
1558}
1559
1560pub trait InputMethodEditorClientProxyInterface: Send + Sync {
1561 fn r#did_update_state(
1562 &self,
1563 state: &TextInputState,
1564 event: Option<&InputEvent>,
1565 ) -> Result<(), fidl::Error>;
1566 fn r#on_action(&self, action: InputMethodAction) -> Result<(), fidl::Error>;
1567}
1568#[derive(Debug)]
1569#[cfg(target_os = "fuchsia")]
1570pub struct InputMethodEditorClientSynchronousProxy {
1571 client: fidl::client::sync::Client,
1572}
1573
1574#[cfg(target_os = "fuchsia")]
1575impl fidl::endpoints::SynchronousProxy for InputMethodEditorClientSynchronousProxy {
1576 type Proxy = InputMethodEditorClientProxy;
1577 type Protocol = InputMethodEditorClientMarker;
1578
1579 fn from_channel(inner: fidl::Channel) -> Self {
1580 Self::new(inner)
1581 }
1582
1583 fn into_channel(self) -> fidl::Channel {
1584 self.client.into_channel()
1585 }
1586
1587 fn as_channel(&self) -> &fidl::Channel {
1588 self.client.as_channel()
1589 }
1590}
1591
1592#[cfg(target_os = "fuchsia")]
1593impl InputMethodEditorClientSynchronousProxy {
1594 pub fn new(channel: fidl::Channel) -> Self {
1595 let protocol_name =
1596 <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1597 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1598 }
1599
1600 pub fn into_channel(self) -> fidl::Channel {
1601 self.client.into_channel()
1602 }
1603
1604 pub fn wait_for_event(
1607 &self,
1608 deadline: zx::MonotonicInstant,
1609 ) -> Result<InputMethodEditorClientEvent, fidl::Error> {
1610 InputMethodEditorClientEvent::decode(self.client.wait_for_event(deadline)?)
1611 }
1612
1613 pub fn r#did_update_state(
1614 &self,
1615 mut state: &TextInputState,
1616 mut event: Option<&InputEvent>,
1617 ) -> Result<(), fidl::Error> {
1618 self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
1619 (state, event),
1620 0x26681a6b204b679d,
1621 fidl::encoding::DynamicFlags::empty(),
1622 )
1623 }
1624
1625 pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1626 self.client.send::<InputMethodEditorClientOnActionRequest>(
1627 (action,),
1628 0x19c420f173275398,
1629 fidl::encoding::DynamicFlags::empty(),
1630 )
1631 }
1632}
1633
1634#[cfg(target_os = "fuchsia")]
1635impl From<InputMethodEditorClientSynchronousProxy> for zx::Handle {
1636 fn from(value: InputMethodEditorClientSynchronousProxy) -> Self {
1637 value.into_channel().into()
1638 }
1639}
1640
1641#[cfg(target_os = "fuchsia")]
1642impl From<fidl::Channel> for InputMethodEditorClientSynchronousProxy {
1643 fn from(value: fidl::Channel) -> Self {
1644 Self::new(value)
1645 }
1646}
1647
1648#[derive(Debug, Clone)]
1649pub struct InputMethodEditorClientProxy {
1650 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1651}
1652
1653impl fidl::endpoints::Proxy for InputMethodEditorClientProxy {
1654 type Protocol = InputMethodEditorClientMarker;
1655
1656 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1657 Self::new(inner)
1658 }
1659
1660 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1661 self.client.into_channel().map_err(|client| Self { client })
1662 }
1663
1664 fn as_channel(&self) -> &::fidl::AsyncChannel {
1665 self.client.as_channel()
1666 }
1667}
1668
1669impl InputMethodEditorClientProxy {
1670 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1672 let protocol_name =
1673 <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1674 Self { client: fidl::client::Client::new(channel, protocol_name) }
1675 }
1676
1677 pub fn take_event_stream(&self) -> InputMethodEditorClientEventStream {
1683 InputMethodEditorClientEventStream { event_receiver: self.client.take_event_receiver() }
1684 }
1685
1686 pub fn r#did_update_state(
1687 &self,
1688 mut state: &TextInputState,
1689 mut event: Option<&InputEvent>,
1690 ) -> Result<(), fidl::Error> {
1691 InputMethodEditorClientProxyInterface::r#did_update_state(self, state, event)
1692 }
1693
1694 pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1695 InputMethodEditorClientProxyInterface::r#on_action(self, action)
1696 }
1697}
1698
1699impl InputMethodEditorClientProxyInterface for InputMethodEditorClientProxy {
1700 fn r#did_update_state(
1701 &self,
1702 mut state: &TextInputState,
1703 mut event: Option<&InputEvent>,
1704 ) -> Result<(), fidl::Error> {
1705 self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
1706 (state, event),
1707 0x26681a6b204b679d,
1708 fidl::encoding::DynamicFlags::empty(),
1709 )
1710 }
1711
1712 fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
1713 self.client.send::<InputMethodEditorClientOnActionRequest>(
1714 (action,),
1715 0x19c420f173275398,
1716 fidl::encoding::DynamicFlags::empty(),
1717 )
1718 }
1719}
1720
1721pub struct InputMethodEditorClientEventStream {
1722 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1723}
1724
1725impl std::marker::Unpin for InputMethodEditorClientEventStream {}
1726
1727impl futures::stream::FusedStream for InputMethodEditorClientEventStream {
1728 fn is_terminated(&self) -> bool {
1729 self.event_receiver.is_terminated()
1730 }
1731}
1732
1733impl futures::Stream for InputMethodEditorClientEventStream {
1734 type Item = Result<InputMethodEditorClientEvent, fidl::Error>;
1735
1736 fn poll_next(
1737 mut self: std::pin::Pin<&mut Self>,
1738 cx: &mut std::task::Context<'_>,
1739 ) -> std::task::Poll<Option<Self::Item>> {
1740 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1741 &mut self.event_receiver,
1742 cx
1743 )?) {
1744 Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorClientEvent::decode(buf))),
1745 None => std::task::Poll::Ready(None),
1746 }
1747 }
1748}
1749
1750#[derive(Debug)]
1751pub enum InputMethodEditorClientEvent {}
1752
1753impl InputMethodEditorClientEvent {
1754 fn decode(
1756 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1757 ) -> Result<InputMethodEditorClientEvent, fidl::Error> {
1758 let (bytes, _handles) = buf.split_mut();
1759 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1760 debug_assert_eq!(tx_header.tx_id, 0);
1761 match tx_header.ordinal {
1762 _ => Err(fidl::Error::UnknownOrdinal {
1763 ordinal: tx_header.ordinal,
1764 protocol_name:
1765 <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1766 }),
1767 }
1768 }
1769}
1770
1771pub struct InputMethodEditorClientRequestStream {
1773 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1774 is_terminated: bool,
1775}
1776
1777impl std::marker::Unpin for InputMethodEditorClientRequestStream {}
1778
1779impl futures::stream::FusedStream for InputMethodEditorClientRequestStream {
1780 fn is_terminated(&self) -> bool {
1781 self.is_terminated
1782 }
1783}
1784
1785impl fidl::endpoints::RequestStream for InputMethodEditorClientRequestStream {
1786 type Protocol = InputMethodEditorClientMarker;
1787 type ControlHandle = InputMethodEditorClientControlHandle;
1788
1789 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1790 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1791 }
1792
1793 fn control_handle(&self) -> Self::ControlHandle {
1794 InputMethodEditorClientControlHandle { inner: self.inner.clone() }
1795 }
1796
1797 fn into_inner(
1798 self,
1799 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1800 {
1801 (self.inner, self.is_terminated)
1802 }
1803
1804 fn from_inner(
1805 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1806 is_terminated: bool,
1807 ) -> Self {
1808 Self { inner, is_terminated }
1809 }
1810}
1811
1812impl futures::Stream for InputMethodEditorClientRequestStream {
1813 type Item = Result<InputMethodEditorClientRequest, fidl::Error>;
1814
1815 fn poll_next(
1816 mut self: std::pin::Pin<&mut Self>,
1817 cx: &mut std::task::Context<'_>,
1818 ) -> std::task::Poll<Option<Self::Item>> {
1819 let this = &mut *self;
1820 if this.inner.check_shutdown(cx) {
1821 this.is_terminated = true;
1822 return std::task::Poll::Ready(None);
1823 }
1824 if this.is_terminated {
1825 panic!("polled InputMethodEditorClientRequestStream after completion");
1826 }
1827 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1828 |bytes, handles| {
1829 match this.inner.channel().read_etc(cx, bytes, handles) {
1830 std::task::Poll::Ready(Ok(())) => {}
1831 std::task::Poll::Pending => return std::task::Poll::Pending,
1832 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1833 this.is_terminated = true;
1834 return std::task::Poll::Ready(None);
1835 }
1836 std::task::Poll::Ready(Err(e)) => {
1837 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1838 e.into(),
1839 ))))
1840 }
1841 }
1842
1843 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1845
1846 std::task::Poll::Ready(Some(match header.ordinal {
1847 0x26681a6b204b679d => {
1848 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1849 let mut req = fidl::new_empty!(InputMethodEditorClientDidUpdateStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1850 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorClientDidUpdateStateRequest>(&header, _body_bytes, handles, &mut req)?;
1851 let control_handle = InputMethodEditorClientControlHandle {
1852 inner: this.inner.clone(),
1853 };
1854 Ok(InputMethodEditorClientRequest::DidUpdateState {state: req.state,
1855event: req.event,
1856
1857 control_handle,
1858 })
1859 }
1860 0x19c420f173275398 => {
1861 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1862 let mut req = fidl::new_empty!(InputMethodEditorClientOnActionRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1863 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorClientOnActionRequest>(&header, _body_bytes, handles, &mut req)?;
1864 let control_handle = InputMethodEditorClientControlHandle {
1865 inner: this.inner.clone(),
1866 };
1867 Ok(InputMethodEditorClientRequest::OnAction {action: req.action,
1868
1869 control_handle,
1870 })
1871 }
1872 _ => Err(fidl::Error::UnknownOrdinal {
1873 ordinal: header.ordinal,
1874 protocol_name: <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1875 }),
1876 }))
1877 },
1878 )
1879 }
1880}
1881
1882#[derive(Debug)]
1884pub enum InputMethodEditorClientRequest {
1885 DidUpdateState {
1886 state: TextInputState,
1887 event: Option<Box<InputEvent>>,
1888 control_handle: InputMethodEditorClientControlHandle,
1889 },
1890 OnAction {
1891 action: InputMethodAction,
1892 control_handle: InputMethodEditorClientControlHandle,
1893 },
1894}
1895
1896impl InputMethodEditorClientRequest {
1897 #[allow(irrefutable_let_patterns)]
1898 pub fn into_did_update_state(
1899 self,
1900 ) -> Option<(TextInputState, Option<Box<InputEvent>>, InputMethodEditorClientControlHandle)>
1901 {
1902 if let InputMethodEditorClientRequest::DidUpdateState { state, event, control_handle } =
1903 self
1904 {
1905 Some((state, event, control_handle))
1906 } else {
1907 None
1908 }
1909 }
1910
1911 #[allow(irrefutable_let_patterns)]
1912 pub fn into_on_action(
1913 self,
1914 ) -> Option<(InputMethodAction, InputMethodEditorClientControlHandle)> {
1915 if let InputMethodEditorClientRequest::OnAction { action, control_handle } = self {
1916 Some((action, control_handle))
1917 } else {
1918 None
1919 }
1920 }
1921
1922 pub fn method_name(&self) -> &'static str {
1924 match *self {
1925 InputMethodEditorClientRequest::DidUpdateState { .. } => "did_update_state",
1926 InputMethodEditorClientRequest::OnAction { .. } => "on_action",
1927 }
1928 }
1929}
1930
1931#[derive(Debug, Clone)]
1932pub struct InputMethodEditorClientControlHandle {
1933 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1934}
1935
1936impl fidl::endpoints::ControlHandle for InputMethodEditorClientControlHandle {
1937 fn shutdown(&self) {
1938 self.inner.shutdown()
1939 }
1940 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1941 self.inner.shutdown_with_epitaph(status)
1942 }
1943
1944 fn is_closed(&self) -> bool {
1945 self.inner.channel().is_closed()
1946 }
1947 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1948 self.inner.channel().on_closed()
1949 }
1950
1951 #[cfg(target_os = "fuchsia")]
1952 fn signal_peer(
1953 &self,
1954 clear_mask: zx::Signals,
1955 set_mask: zx::Signals,
1956 ) -> Result<(), zx_status::Status> {
1957 use fidl::Peered;
1958 self.inner.channel().signal_peer(clear_mask, set_mask)
1959 }
1960}
1961
1962impl InputMethodEditorClientControlHandle {}
1963
1964mod internal {
1965 use super::*;
1966
1967 impl fidl::encoding::ResourceTypeMarker for ImeServiceGetInputMethodEditorRequest {
1968 type Borrowed<'a> = &'a mut Self;
1969 fn take_or_borrow<'a>(
1970 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1971 ) -> Self::Borrowed<'a> {
1972 value
1973 }
1974 }
1975
1976 unsafe impl fidl::encoding::TypeMarker for ImeServiceGetInputMethodEditorRequest {
1977 type Owned = Self;
1978
1979 #[inline(always)]
1980 fn inline_align(_context: fidl::encoding::Context) -> usize {
1981 8
1982 }
1983
1984 #[inline(always)]
1985 fn inline_size(_context: fidl::encoding::Context) -> usize {
1986 80
1987 }
1988 }
1989
1990 unsafe impl
1991 fidl::encoding::Encode<
1992 ImeServiceGetInputMethodEditorRequest,
1993 fidl::encoding::DefaultFuchsiaResourceDialect,
1994 > for &mut ImeServiceGetInputMethodEditorRequest
1995 {
1996 #[inline]
1997 unsafe fn encode(
1998 self,
1999 encoder: &mut fidl::encoding::Encoder<
2000 '_,
2001 fidl::encoding::DefaultFuchsiaResourceDialect,
2002 >,
2003 offset: usize,
2004 _depth: fidl::encoding::Depth,
2005 ) -> fidl::Result<()> {
2006 encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
2007 fidl::encoding::Encode::<ImeServiceGetInputMethodEditorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2009 (
2010 <KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),
2011 <InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
2012 <TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_state),
2013 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
2014 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.editor),
2015 ),
2016 encoder, offset, _depth
2017 )
2018 }
2019 }
2020 unsafe impl<
2021 T0: fidl::encoding::Encode<KeyboardType, fidl::encoding::DefaultFuchsiaResourceDialect>,
2022 T1: fidl::encoding::Encode<
2023 InputMethodAction,
2024 fidl::encoding::DefaultFuchsiaResourceDialect,
2025 >,
2026 T2: fidl::encoding::Encode<TextInputState, fidl::encoding::DefaultFuchsiaResourceDialect>,
2027 T3: fidl::encoding::Encode<
2028 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
2029 fidl::encoding::DefaultFuchsiaResourceDialect,
2030 >,
2031 T4: fidl::encoding::Encode<
2032 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2033 fidl::encoding::DefaultFuchsiaResourceDialect,
2034 >,
2035 >
2036 fidl::encoding::Encode<
2037 ImeServiceGetInputMethodEditorRequest,
2038 fidl::encoding::DefaultFuchsiaResourceDialect,
2039 > for (T0, T1, T2, T3, T4)
2040 {
2041 #[inline]
2042 unsafe fn encode(
2043 self,
2044 encoder: &mut fidl::encoding::Encoder<
2045 '_,
2046 fidl::encoding::DefaultFuchsiaResourceDialect,
2047 >,
2048 offset: usize,
2049 depth: fidl::encoding::Depth,
2050 ) -> fidl::Result<()> {
2051 encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
2052 self.0.encode(encoder, offset + 0, depth)?;
2056 self.1.encode(encoder, offset + 4, depth)?;
2057 self.2.encode(encoder, offset + 8, depth)?;
2058 self.3.encode(encoder, offset + 72, depth)?;
2059 self.4.encode(encoder, offset + 76, depth)?;
2060 Ok(())
2061 }
2062 }
2063
2064 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2065 for ImeServiceGetInputMethodEditorRequest
2066 {
2067 #[inline(always)]
2068 fn new_empty() -> Self {
2069 Self {
2070 keyboard_type: fidl::new_empty!(
2071 KeyboardType,
2072 fidl::encoding::DefaultFuchsiaResourceDialect
2073 ),
2074 action: fidl::new_empty!(
2075 InputMethodAction,
2076 fidl::encoding::DefaultFuchsiaResourceDialect
2077 ),
2078 initial_state: fidl::new_empty!(
2079 TextInputState,
2080 fidl::encoding::DefaultFuchsiaResourceDialect
2081 ),
2082 client: fidl::new_empty!(
2083 fidl::encoding::Endpoint<
2084 fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
2085 >,
2086 fidl::encoding::DefaultFuchsiaResourceDialect
2087 ),
2088 editor: fidl::new_empty!(
2089 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2090 fidl::encoding::DefaultFuchsiaResourceDialect
2091 ),
2092 }
2093 }
2094
2095 #[inline]
2096 unsafe fn decode(
2097 &mut self,
2098 decoder: &mut fidl::encoding::Decoder<
2099 '_,
2100 fidl::encoding::DefaultFuchsiaResourceDialect,
2101 >,
2102 offset: usize,
2103 _depth: fidl::encoding::Depth,
2104 ) -> fidl::Result<()> {
2105 decoder.debug_check_bounds::<Self>(offset);
2106 fidl::decode!(
2108 KeyboardType,
2109 fidl::encoding::DefaultFuchsiaResourceDialect,
2110 &mut self.keyboard_type,
2111 decoder,
2112 offset + 0,
2113 _depth
2114 )?;
2115 fidl::decode!(
2116 InputMethodAction,
2117 fidl::encoding::DefaultFuchsiaResourceDialect,
2118 &mut self.action,
2119 decoder,
2120 offset + 4,
2121 _depth
2122 )?;
2123 fidl::decode!(
2124 TextInputState,
2125 fidl::encoding::DefaultFuchsiaResourceDialect,
2126 &mut self.initial_state,
2127 decoder,
2128 offset + 8,
2129 _depth
2130 )?;
2131 fidl::decode!(
2132 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
2133 fidl::encoding::DefaultFuchsiaResourceDialect,
2134 &mut self.client,
2135 decoder,
2136 offset + 72,
2137 _depth
2138 )?;
2139 fidl::decode!(
2140 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
2141 fidl::encoding::DefaultFuchsiaResourceDialect,
2142 &mut self.editor,
2143 decoder,
2144 offset + 76,
2145 _depth
2146 )?;
2147 Ok(())
2148 }
2149 }
2150}