1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 pub use fidl_next_common_fuchsia_ui_input3::natural::*;
8
9 #[derive(Debug, PartialEq)]
10 #[repr(C)]
11 pub struct KeyboardAddListenerRequest {
12 pub view_ref: ::fidl_next_fuchsia_ui_views::natural::ViewRef,
13
14 pub listener:
15 ::fidl_next::ClientEnd<crate::KeyboardListener, ::fidl_next::fuchsia::zx::Channel>,
16 }
17
18 unsafe impl<___E> ::fidl_next::Encode<crate::wire::KeyboardAddListenerRequest, ___E>
19 for KeyboardAddListenerRequest
20 where
21 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
22 ___E: ::fidl_next::fuchsia::HandleEncoder,
23 {
24 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
25 Self,
26 crate::wire::KeyboardAddListenerRequest,
27 > = unsafe {
28 ::fidl_next::CopyOptimization::enable_if(
29 true && <::fidl_next_fuchsia_ui_views::natural::ViewRef as ::fidl_next::Encode<
30 ::fidl_next_fuchsia_ui_views::wire::ViewRef,
31 ___E,
32 >>::COPY_OPTIMIZATION
33 .is_enabled()
34 && <::fidl_next::ClientEnd<
35 crate::KeyboardListener,
36 ::fidl_next::fuchsia::zx::Channel,
37 > as ::fidl_next::Encode<
38 ::fidl_next::ClientEnd<
39 crate::KeyboardListener,
40 ::fidl_next::wire::fuchsia::Channel,
41 >,
42 ___E,
43 >>::COPY_OPTIMIZATION
44 .is_enabled(),
45 )
46 };
47
48 #[inline]
49 fn encode(
50 self,
51 encoder_: &mut ___E,
52 out_: &mut ::core::mem::MaybeUninit<crate::wire::KeyboardAddListenerRequest>,
53 _: (),
54 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
55 ::fidl_next::munge! {
56 let crate::wire::KeyboardAddListenerRequest {
57 view_ref,
58 listener,
59
60 } = out_;
61 }
62
63 ::fidl_next::Encode::encode(self.view_ref, encoder_, view_ref, ())?;
64
65 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(view_ref.as_mut_ptr()) };
66
67 ::fidl_next::Encode::encode(self.listener, encoder_, listener, ())?;
68
69 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(listener.as_mut_ptr()) };
70
71 Ok(())
72 }
73 }
74
75 unsafe impl<___E>
76 ::fidl_next::EncodeOption<
77 ::fidl_next::wire::Box<'static, crate::wire::KeyboardAddListenerRequest>,
78 ___E,
79 > for KeyboardAddListenerRequest
80 where
81 ___E: ::fidl_next::Encoder + ?Sized,
82 KeyboardAddListenerRequest:
83 ::fidl_next::Encode<crate::wire::KeyboardAddListenerRequest, ___E>,
84 {
85 #[inline]
86 fn encode_option(
87 this: ::core::option::Option<Self>,
88 encoder: &mut ___E,
89 out: &mut ::core::mem::MaybeUninit<
90 ::fidl_next::wire::Box<'static, crate::wire::KeyboardAddListenerRequest>,
91 >,
92 _: (),
93 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
94 if let Some(inner) = this {
95 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
96 ::fidl_next::wire::Box::encode_present(out);
97 } else {
98 ::fidl_next::wire::Box::encode_absent(out);
99 }
100
101 Ok(())
102 }
103 }
104
105 impl ::fidl_next::FromWire<crate::wire::KeyboardAddListenerRequest> for KeyboardAddListenerRequest {
106 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
107 crate::wire::KeyboardAddListenerRequest,
108 Self,
109 > = unsafe {
110 ::fidl_next::CopyOptimization::enable_if(
111 true && <::fidl_next_fuchsia_ui_views::natural::ViewRef as ::fidl_next::FromWire<
112 ::fidl_next_fuchsia_ui_views::wire::ViewRef,
113 >>::COPY_OPTIMIZATION
114 .is_enabled()
115 && <::fidl_next::ClientEnd<
116 crate::KeyboardListener,
117 ::fidl_next::fuchsia::zx::Channel,
118 > as ::fidl_next::FromWire<
119 ::fidl_next::ClientEnd<
120 crate::KeyboardListener,
121 ::fidl_next::wire::fuchsia::Channel,
122 >,
123 >>::COPY_OPTIMIZATION
124 .is_enabled(),
125 )
126 };
127
128 #[inline]
129 fn from_wire(wire: crate::wire::KeyboardAddListenerRequest) -> Self {
130 Self {
131 view_ref: ::fidl_next::FromWire::from_wire(wire.view_ref),
132
133 listener: ::fidl_next::FromWire::from_wire(wire.listener),
134 }
135 }
136 }
137}
138
139pub mod wire {
140
141 pub use fidl_next_common_fuchsia_ui_input3::wire::*;
142
143 #[derive(Debug)]
145 #[repr(C)]
146 pub struct KeyboardAddListenerRequest {
147 pub view_ref: ::fidl_next_fuchsia_ui_views::wire::ViewRef,
148
149 pub listener:
150 ::fidl_next::ClientEnd<crate::KeyboardListener, ::fidl_next::wire::fuchsia::Channel>,
151 }
152
153 static_assertions::const_assert_eq!(std::mem::size_of::<KeyboardAddListenerRequest>(), 8);
154 static_assertions::const_assert_eq!(std::mem::align_of::<KeyboardAddListenerRequest>(), 4);
155
156 static_assertions::const_assert_eq!(
157 std::mem::offset_of!(KeyboardAddListenerRequest, view_ref),
158 0
159 );
160
161 static_assertions::const_assert_eq!(
162 std::mem::offset_of!(KeyboardAddListenerRequest, listener),
163 4
164 );
165
166 impl ::fidl_next::Constrained for KeyboardAddListenerRequest {
167 type Constraint = ();
168
169 fn validate(
170 _: ::fidl_next::Slot<'_, Self>,
171 _: Self::Constraint,
172 ) -> Result<(), ::fidl_next::ValidationError> {
173 Ok(())
174 }
175 }
176
177 unsafe impl ::fidl_next::Wire for KeyboardAddListenerRequest {
178 type Narrowed<'de> = KeyboardAddListenerRequest;
179
180 #[inline]
181 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
182 ::fidl_next::munge! {
183 let Self {
184 view_ref,
185 listener,
186
187 } = &mut *out_;
188 }
189
190 ::fidl_next::Wire::zero_padding(view_ref);
191
192 ::fidl_next::Wire::zero_padding(listener);
193 }
194 }
195
196 unsafe impl<___D> ::fidl_next::Decode<___D> for KeyboardAddListenerRequest
197 where
198 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
199 ___D: ::fidl_next::fuchsia::HandleDecoder,
200 {
201 fn decode(
202 slot_: ::fidl_next::Slot<'_, Self>,
203 decoder_: &mut ___D,
204 _: (),
205 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
206 ::fidl_next::munge! {
207 let Self {
208 mut view_ref,
209 mut listener,
210
211 } = slot_;
212 }
213
214 let _field = view_ref.as_mut();
215
216 ::fidl_next::Decode::decode(view_ref.as_mut(), decoder_, ())?;
217
218 let _field = listener.as_mut();
219
220 ::fidl_next::Decode::decode(listener.as_mut(), decoder_, ())?;
221
222 Ok(())
223 }
224 }
225
226 impl ::fidl_next::IntoNatural for KeyboardAddListenerRequest {
227 type Natural = crate::natural::KeyboardAddListenerRequest;
228 }
229}
230
231pub mod wire_optional {
232
233 pub use fidl_next_common_fuchsia_ui_input3::wire_optional::*;
234}
235
236pub mod generic {
237
238 pub use fidl_next_common_fuchsia_ui_input3::generic::*;
239
240 pub struct KeyboardAddListenerRequest<T0, T1> {
242 pub view_ref: T0,
243
244 pub listener: T1,
245 }
246
247 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::KeyboardAddListenerRequest, ___E>
248 for KeyboardAddListenerRequest<T0, T1>
249 where
250 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
251 ___E: ::fidl_next::fuchsia::HandleEncoder,
252 T0: ::fidl_next::Encode<::fidl_next_fuchsia_ui_views::wire::ViewRef, ___E>,
253 T1: ::fidl_next::Encode<
254 ::fidl_next::ClientEnd<
255 crate::KeyboardListener,
256 ::fidl_next::wire::fuchsia::Channel,
257 >,
258 ___E,
259 >,
260 {
261 #[inline]
262 fn encode(
263 self,
264 encoder_: &mut ___E,
265 out_: &mut ::core::mem::MaybeUninit<crate::wire::KeyboardAddListenerRequest>,
266 _: (),
267 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
268 ::fidl_next::munge! {
269 let crate::wire::KeyboardAddListenerRequest {
270 view_ref,
271 listener,
272
273 } = out_;
274 }
275
276 ::fidl_next::Encode::encode(self.view_ref, encoder_, view_ref, ())?;
277
278 ::fidl_next::Encode::encode(self.listener, encoder_, listener, ())?;
279
280 Ok(())
281 }
282 }
283}
284
285pub use self::natural::*;
286
287#[doc = " Components may request this service from their namespace to be notified of\n physical key events.\n"]
289#[derive(PartialEq, Debug)]
290pub struct Keyboard;
291
292impl ::fidl_next::Discoverable for Keyboard {
293 const PROTOCOL_NAME: &'static str = "fuchsia.ui.input3.Keyboard";
294}
295
296#[cfg(target_os = "fuchsia")]
297impl ::fidl_next::HasTransport for Keyboard {
298 type Transport = ::fidl_next::fuchsia::zx::Channel;
299}
300
301pub mod keyboard {
302 pub mod prelude {
303 pub use crate::{
304 Keyboard, KeyboardClientHandler, KeyboardLocalClientHandler,
305 KeyboardLocalServerHandler, KeyboardServerHandler, keyboard,
306 };
307
308 pub use crate::natural::KeyboardAddListenerRequest;
309 }
310
311 pub struct AddListener;
312
313 impl ::fidl_next::Method for AddListener {
314 const ORDINAL: u64 = 4306977845568814370;
315 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
316 ::fidl_next::protocol::Flexibility::Strict;
317
318 type Protocol = crate::Keyboard;
319
320 type Request = crate::wire::KeyboardAddListenerRequest;
321 }
322
323 impl ::fidl_next::TwoWayMethod for AddListener {
324 type Response = ::fidl_next::wire::Strict<::fidl_next::wire::EmptyMessageBody>;
325 }
326
327 impl<___R> ::fidl_next::Respond<___R> for AddListener {
328 type Output = ::fidl_next::Strict<___R>;
329
330 fn respond(response: ___R) -> Self::Output {
331 ::fidl_next::Strict(response)
332 }
333 }
334
335 mod ___detail {
336 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Keyboard
337 where
338 ___T: ::fidl_next::Transport,
339 {
340 type Client = KeyboardClient<___T>;
341 type Server = KeyboardServer<___T>;
342 }
343
344 #[repr(transparent)]
346 pub struct KeyboardClient<___T: ::fidl_next::Transport> {
347 #[allow(dead_code)]
348 client: ::fidl_next::protocol::Client<___T>,
349 }
350
351 impl<___T> KeyboardClient<___T>
352 where
353 ___T: ::fidl_next::Transport,
354 {
355 #[doc = " Add a key event listener for the specified View.\n If multiple listeners are added, each will receive key events independently and\n should respond with a `Status`.\n\n The client calling `AddListener` should keep the connection to `Keyboard` alive\n for as long as the events from `KeyboardListener` need to be received. Dropping the\n connection to the `Keyboard` protocol will terminate `KeyboardListener` as well.\n"]
356 pub fn add_listener(
357 &self,
358
359 view_ref: impl ::fidl_next::Encode<
360 ::fidl_next_fuchsia_ui_views::wire::ViewRef,
361 <___T as ::fidl_next::Transport>::SendBuffer,
362 >,
363
364 listener: impl ::fidl_next::Encode<
365 ::fidl_next::ClientEnd<
366 crate::KeyboardListener,
367 ::fidl_next::wire::fuchsia::Channel,
368 >,
369 <___T as ::fidl_next::Transport>::SendBuffer,
370 >,
371 ) -> ::fidl_next::TwoWayFuture<'_, super::AddListener, ___T>
372 where
373 <___T as ::fidl_next::Transport>::SendBuffer:
374 ::fidl_next::encoder::InternalHandleEncoder,
375 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
376 {
377 self.add_listener_with(crate::generic::KeyboardAddListenerRequest {
378 view_ref,
379
380 listener,
381 })
382 }
383
384 #[doc = " Add a key event listener for the specified View.\n If multiple listeners are added, each will receive key events independently and\n should respond with a `Status`.\n\n The client calling `AddListener` should keep the connection to `Keyboard` alive\n for as long as the events from `KeyboardListener` need to be received. Dropping the\n connection to the `Keyboard` protocol will terminate `KeyboardListener` as well.\n"]
385 pub fn add_listener_with<___R>(
386 &self,
387 request: ___R,
388 ) -> ::fidl_next::TwoWayFuture<'_, super::AddListener, ___T>
389 where
390 ___R: ::fidl_next::Encode<
391 crate::wire::KeyboardAddListenerRequest,
392 <___T as ::fidl_next::Transport>::SendBuffer,
393 >,
394 {
395 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
396 4306977845568814370,
397 <super::AddListener as ::fidl_next::Method>::FLEXIBILITY,
398 request,
399 ))
400 }
401 }
402
403 #[repr(transparent)]
405 pub struct KeyboardServer<___T: ::fidl_next::Transport> {
406 server: ::fidl_next::protocol::Server<___T>,
407 }
408
409 impl<___T> KeyboardServer<___T> where ___T: ::fidl_next::Transport {}
410 }
411}
412
413#[diagnostic::on_unimplemented(
414 note = "If {Self} implements the non-local KeyboardClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
415)]
416
417pub trait KeyboardLocalClientHandler<
421 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
422 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
423>
424{
425}
426
427impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Keyboard
428where
429 ___H: KeyboardLocalClientHandler<___T>,
430 ___T: ::fidl_next::Transport,
431{
432 async fn on_event(
433 handler: &mut ___H,
434 mut message: ::fidl_next::Message<___T>,
435 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
436 match *message.header().ordinal {
437 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
438 }
439 }
440}
441
442#[diagnostic::on_unimplemented(
443 note = "If {Self} implements the non-local KeyboardServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
444)]
445
446pub trait KeyboardLocalServerHandler<
450 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
451 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
452>
453{
454 #[doc = " Add a key event listener for the specified View.\n If multiple listeners are added, each will receive key events independently and\n should respond with a `Status`.\n\n The client calling `AddListener` should keep the connection to `Keyboard` alive\n for as long as the events from `KeyboardListener` need to be received. Dropping the\n connection to the `Keyboard` protocol will terminate `KeyboardListener` as well.\n"]
455 fn add_listener(
456 &mut self,
457
458 request: ::fidl_next::Request<keyboard::AddListener, ___T>,
459
460 responder: ::fidl_next::Responder<keyboard::AddListener, ___T>,
461 ) -> impl ::core::future::Future<Output = ()>;
462}
463
464impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Keyboard
465where
466 ___H: KeyboardLocalServerHandler<___T>,
467 ___T: ::fidl_next::Transport,
468 for<'de> crate::wire::KeyboardAddListenerRequest: ::fidl_next::Decode<
469 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
470 Constraint = (),
471 >,
472{
473 async fn on_one_way(
474 handler: &mut ___H,
475 mut message: ::fidl_next::Message<___T>,
476 ) -> ::core::result::Result<
477 (),
478 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
479 > {
480 match *message.header().ordinal {
481 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
482 }
483 }
484
485 async fn on_two_way(
486 handler: &mut ___H,
487 mut message: ::fidl_next::Message<___T>,
488 responder: ::fidl_next::protocol::Responder<___T>,
489 ) -> ::core::result::Result<
490 (),
491 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
492 > {
493 match *message.header().ordinal {
494 4306977845568814370 => {
495 let responder = ::fidl_next::Responder::from_untyped(responder);
496
497 match ::fidl_next::AsDecoderExt::into_decoded(message) {
498 Ok(decoded) => {
499 handler
500 .add_listener(::fidl_next::Request::from_decoded(decoded), responder)
501 .await;
502 Ok(())
503 }
504 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
505 ordinal: 4306977845568814370,
506 error,
507 }),
508 }
509 }
510
511 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
512 }
513 }
514}
515
516pub trait KeyboardClientHandler<
520 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
521 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
522>
523{
524}
525
526impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Keyboard
527where
528 ___H: KeyboardClientHandler<___T> + ::core::marker::Send,
529 ___T: ::fidl_next::Transport,
530{
531 async fn on_event(
532 handler: &mut ___H,
533 mut message: ::fidl_next::Message<___T>,
534 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
535 match *message.header().ordinal {
536 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
537 }
538 }
539}
540
541pub trait KeyboardServerHandler<
545 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
546 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
547>
548{
549 #[doc = " Add a key event listener for the specified View.\n If multiple listeners are added, each will receive key events independently and\n should respond with a `Status`.\n\n The client calling `AddListener` should keep the connection to `Keyboard` alive\n for as long as the events from `KeyboardListener` need to be received. Dropping the\n connection to the `Keyboard` protocol will terminate `KeyboardListener` as well.\n"]
550 fn add_listener(
551 &mut self,
552
553 request: ::fidl_next::Request<keyboard::AddListener, ___T>,
554
555 responder: ::fidl_next::Responder<keyboard::AddListener, ___T>,
556 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
557}
558
559impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Keyboard
560where
561 ___H: KeyboardServerHandler<___T> + ::core::marker::Send,
562 ___T: ::fidl_next::Transport,
563 for<'de> crate::wire::KeyboardAddListenerRequest: ::fidl_next::Decode<
564 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
565 Constraint = (),
566 >,
567{
568 async fn on_one_way(
569 handler: &mut ___H,
570 mut message: ::fidl_next::Message<___T>,
571 ) -> ::core::result::Result<
572 (),
573 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
574 > {
575 match *message.header().ordinal {
576 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
577 }
578 }
579
580 async fn on_two_way(
581 handler: &mut ___H,
582 mut message: ::fidl_next::Message<___T>,
583 responder: ::fidl_next::protocol::Responder<___T>,
584 ) -> ::core::result::Result<
585 (),
586 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
587 > {
588 match *message.header().ordinal {
589 4306977845568814370 => {
590 let responder = ::fidl_next::Responder::from_untyped(responder);
591
592 match ::fidl_next::AsDecoderExt::into_decoded(message) {
593 Ok(decoded) => {
594 handler
595 .add_listener(::fidl_next::Request::from_decoded(decoded), responder)
596 .await;
597 Ok(())
598 }
599 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
600 ordinal: 4306977845568814370,
601 error,
602 }),
603 }
604 }
605
606 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
607 }
608 }
609}
610
611impl<___T> KeyboardClientHandler<___T> for ::fidl_next::IgnoreEvents where
612 ___T: ::fidl_next::Transport
613{
614}
615
616impl<___H, ___T> KeyboardLocalClientHandler<___T> for ::fidl_next::Local<___H>
617where
618 ___H: KeyboardClientHandler<___T>,
619 ___T: ::fidl_next::Transport,
620{
621}
622
623impl<___H, ___T> KeyboardLocalServerHandler<___T> for ::fidl_next::Local<___H>
624where
625 ___H: KeyboardServerHandler<___T>,
626 ___T: ::fidl_next::Transport,
627{
628 async fn add_listener(
629 &mut self,
630
631 request: ::fidl_next::Request<keyboard::AddListener, ___T>,
632
633 responder: ::fidl_next::Responder<keyboard::AddListener, ___T>,
634 ) {
635 ___H::add_listener(&mut self.0, request, responder).await
636 }
637}
638
639pub use fidl_next_common_fuchsia_ui_input3::*;