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_hardware_mailbox::natural::*;
8
9 #[derive(Debug, PartialEq)]
10 #[repr(C)]
11 pub struct ChannelRegisterListenerRequest {
12 pub listener: ::fidl_next::ClientEnd<crate::Listener, ::fidl_next::fuchsia::zx::Channel>,
13 }
14
15 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ChannelRegisterListenerRequest, ___E>
16 for ChannelRegisterListenerRequest
17 where
18 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
19 ___E: ::fidl_next::fuchsia::HandleEncoder,
20 {
21 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
22 Self,
23 crate::wire::ChannelRegisterListenerRequest,
24 > = unsafe {
25 ::fidl_next::CopyOptimization::enable_if(
26 true
27
28 && <
29 ::fidl_next::ClientEnd<crate::Listener, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::Encode<::fidl_next::ClientEnd<crate::Listener, ::fidl_next::wire::fuchsia::Channel>, ___E>
30 >::COPY_OPTIMIZATION.is_enabled()
31
32 )
33 };
34
35 #[inline]
36 fn encode(
37 self,
38 encoder_: &mut ___E,
39 out_: &mut ::core::mem::MaybeUninit<crate::wire::ChannelRegisterListenerRequest>,
40 _: (),
41 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
42 ::fidl_next::munge! {
43 let crate::wire::ChannelRegisterListenerRequest {
44 listener,
45
46 } = out_;
47 }
48
49 ::fidl_next::Encode::encode(self.listener, encoder_, listener, ())?;
50
51 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(listener.as_mut_ptr()) };
52
53 Ok(())
54 }
55 }
56
57 unsafe impl<___E>
58 ::fidl_next::EncodeOption<
59 ::fidl_next::wire::Box<'static, crate::wire::ChannelRegisterListenerRequest>,
60 ___E,
61 > for ChannelRegisterListenerRequest
62 where
63 ___E: ::fidl_next::Encoder + ?Sized,
64 ChannelRegisterListenerRequest:
65 ::fidl_next::Encode<crate::wire::ChannelRegisterListenerRequest, ___E>,
66 {
67 #[inline]
68 fn encode_option(
69 this: ::core::option::Option<Self>,
70 encoder: &mut ___E,
71 out: &mut ::core::mem::MaybeUninit<
72 ::fidl_next::wire::Box<'static, crate::wire::ChannelRegisterListenerRequest>,
73 >,
74 _: (),
75 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
76 if let Some(inner) = this {
77 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
78 ::fidl_next::wire::Box::encode_present(out);
79 } else {
80 ::fidl_next::wire::Box::encode_absent(out);
81 }
82
83 Ok(())
84 }
85 }
86
87 impl ::fidl_next::FromWire<crate::wire::ChannelRegisterListenerRequest>
88 for ChannelRegisterListenerRequest
89 {
90 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
91 crate::wire::ChannelRegisterListenerRequest,
92 Self,
93 > = unsafe {
94 ::fidl_next::CopyOptimization::enable_if(
95 true
96
97 && <
98 ::fidl_next::ClientEnd<crate::Listener, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::FromWire<::fidl_next::ClientEnd<crate::Listener, ::fidl_next::wire::fuchsia::Channel>>
99 >::COPY_OPTIMIZATION.is_enabled()
100
101 )
102 };
103
104 #[inline]
105 fn from_wire(wire: crate::wire::ChannelRegisterListenerRequest) -> Self {
106 Self { listener: ::fidl_next::FromWire::from_wire(wire.listener) }
107 }
108 }
109
110 #[derive(Debug, PartialEq)]
111 pub struct ListenerOnMessageRequest {
112 pub message: ::std::vec::Vec<u8>,
113
114 pub lease: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
115 }
116
117 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ListenerOnMessageRequest<'static>, ___E>
118 for ListenerOnMessageRequest
119 where
120 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
121 ___E: ::fidl_next::Encoder,
122 ___E: ::fidl_next::fuchsia::HandleEncoder,
123 {
124 #[inline]
125 fn encode(
126 self,
127 encoder_: &mut ___E,
128 out_: &mut ::core::mem::MaybeUninit<crate::wire::ListenerOnMessageRequest<'static>>,
129 _: (),
130 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
131 ::fidl_next::munge! {
132 let crate::wire::ListenerOnMessageRequest {
133 message,
134 lease,
135
136 } = out_;
137 }
138
139 ::fidl_next::Encode::encode(self.message, encoder_, message, (4294967295, ()))?;
140
141 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(message.as_mut_ptr()) };
142 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
143
144 ::fidl_next::Encode::encode(self.lease, encoder_, lease, ())?;
145
146 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(lease.as_mut_ptr()) };
147
148 Ok(())
149 }
150 }
151
152 unsafe impl<___E>
153 ::fidl_next::EncodeOption<
154 ::fidl_next::wire::Box<'static, crate::wire::ListenerOnMessageRequest<'static>>,
155 ___E,
156 > for ListenerOnMessageRequest
157 where
158 ___E: ::fidl_next::Encoder + ?Sized,
159 ListenerOnMessageRequest:
160 ::fidl_next::Encode<crate::wire::ListenerOnMessageRequest<'static>, ___E>,
161 {
162 #[inline]
163 fn encode_option(
164 this: ::core::option::Option<Self>,
165 encoder: &mut ___E,
166 out: &mut ::core::mem::MaybeUninit<
167 ::fidl_next::wire::Box<'static, crate::wire::ListenerOnMessageRequest<'static>>,
168 >,
169 _: (),
170 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
171 if let Some(inner) = this {
172 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
173 ::fidl_next::wire::Box::encode_present(out);
174 } else {
175 ::fidl_next::wire::Box::encode_absent(out);
176 }
177
178 Ok(())
179 }
180 }
181
182 impl<'de> ::fidl_next::FromWire<crate::wire::ListenerOnMessageRequest<'de>>
183 for ListenerOnMessageRequest
184 {
185 #[inline]
186 fn from_wire(wire: crate::wire::ListenerOnMessageRequest<'de>) -> Self {
187 Self {
188 message: ::fidl_next::FromWire::from_wire(wire.message),
189
190 lease: ::fidl_next::FromWire::from_wire(wire.lease),
191 }
192 }
193 }
194
195 #[derive(Debug, PartialEq)]
196 pub struct ListenerOnRequestRequest {
197 pub message: ::std::vec::Vec<u8>,
198
199 pub lease: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
200 }
201
202 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ListenerOnRequestRequest<'static>, ___E>
203 for ListenerOnRequestRequest
204 where
205 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
206 ___E: ::fidl_next::Encoder,
207 ___E: ::fidl_next::fuchsia::HandleEncoder,
208 {
209 #[inline]
210 fn encode(
211 self,
212 encoder_: &mut ___E,
213 out_: &mut ::core::mem::MaybeUninit<crate::wire::ListenerOnRequestRequest<'static>>,
214 _: (),
215 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
216 ::fidl_next::munge! {
217 let crate::wire::ListenerOnRequestRequest {
218 message,
219 lease,
220
221 } = out_;
222 }
223
224 ::fidl_next::Encode::encode(self.message, encoder_, message, (4294967295, ()))?;
225
226 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(message.as_mut_ptr()) };
227 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
228
229 ::fidl_next::Encode::encode(self.lease, encoder_, lease, ())?;
230
231 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(lease.as_mut_ptr()) };
232
233 Ok(())
234 }
235 }
236
237 unsafe impl<___E>
238 ::fidl_next::EncodeOption<
239 ::fidl_next::wire::Box<'static, crate::wire::ListenerOnRequestRequest<'static>>,
240 ___E,
241 > for ListenerOnRequestRequest
242 where
243 ___E: ::fidl_next::Encoder + ?Sized,
244 ListenerOnRequestRequest:
245 ::fidl_next::Encode<crate::wire::ListenerOnRequestRequest<'static>, ___E>,
246 {
247 #[inline]
248 fn encode_option(
249 this: ::core::option::Option<Self>,
250 encoder: &mut ___E,
251 out: &mut ::core::mem::MaybeUninit<
252 ::fidl_next::wire::Box<'static, crate::wire::ListenerOnRequestRequest<'static>>,
253 >,
254 _: (),
255 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
256 if let Some(inner) = this {
257 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
258 ::fidl_next::wire::Box::encode_present(out);
259 } else {
260 ::fidl_next::wire::Box::encode_absent(out);
261 }
262
263 Ok(())
264 }
265 }
266
267 impl<'de> ::fidl_next::FromWire<crate::wire::ListenerOnRequestRequest<'de>>
268 for ListenerOnRequestRequest
269 {
270 #[inline]
271 fn from_wire(wire: crate::wire::ListenerOnRequestRequest<'de>) -> Self {
272 Self {
273 message: ::fidl_next::FromWire::from_wire(wire.message),
274
275 lease: ::fidl_next::FromWire::from_wire(wire.lease),
276 }
277 }
278 }
279}
280
281pub mod wire {
282
283 pub use fidl_next_common_fuchsia_hardware_mailbox::wire::*;
284
285 #[derive(Debug)]
287 #[repr(C)]
288 pub struct ChannelRegisterListenerRequest {
289 pub listener: ::fidl_next::ClientEnd<crate::Listener, ::fidl_next::wire::fuchsia::Channel>,
290 }
291
292 static_assertions::const_assert_eq!(std::mem::size_of::<ChannelRegisterListenerRequest>(), 4);
293 static_assertions::const_assert_eq!(std::mem::align_of::<ChannelRegisterListenerRequest>(), 4);
294
295 static_assertions::const_assert_eq!(
296 std::mem::offset_of!(ChannelRegisterListenerRequest, listener),
297 0
298 );
299
300 impl ::fidl_next::Constrained for ChannelRegisterListenerRequest {
301 type Constraint = ();
302
303 fn validate(
304 _: ::fidl_next::Slot<'_, Self>,
305 _: Self::Constraint,
306 ) -> Result<(), ::fidl_next::ValidationError> {
307 Ok(())
308 }
309 }
310
311 unsafe impl ::fidl_next::Wire for ChannelRegisterListenerRequest {
312 type Narrowed<'de> = ChannelRegisterListenerRequest;
313
314 #[inline]
315 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
316 ::fidl_next::munge! {
317 let Self {
318 listener,
319
320 } = &mut *out_;
321 }
322
323 ::fidl_next::Wire::zero_padding(listener);
324 }
325 }
326
327 unsafe impl<___D> ::fidl_next::Decode<___D> for ChannelRegisterListenerRequest
328 where
329 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
330 ___D: ::fidl_next::fuchsia::HandleDecoder,
331 {
332 fn decode(
333 slot_: ::fidl_next::Slot<'_, Self>,
334 decoder_: &mut ___D,
335 _: (),
336 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
337 ::fidl_next::munge! {
338 let Self {
339 mut listener,
340
341 } = slot_;
342 }
343
344 let _field = listener.as_mut();
345
346 ::fidl_next::Decode::decode(listener.as_mut(), decoder_, ())?;
347
348 Ok(())
349 }
350 }
351
352 impl ::fidl_next::IntoNatural for ChannelRegisterListenerRequest {
353 type Natural = crate::natural::ChannelRegisterListenerRequest;
354 }
355
356 #[derive(Debug)]
358 #[repr(C)]
359 pub struct ListenerOnMessageRequest<'de> {
360 pub message: ::fidl_next::wire::Vector<'de, u8>,
361
362 pub lease: ::fidl_next::wire::fuchsia::OptionalEventPair,
363 }
364
365 static_assertions::const_assert_eq!(std::mem::size_of::<ListenerOnMessageRequest<'_>>(), 24);
366 static_assertions::const_assert_eq!(std::mem::align_of::<ListenerOnMessageRequest<'_>>(), 8);
367
368 static_assertions::const_assert_eq!(
369 std::mem::offset_of!(ListenerOnMessageRequest<'_>, message),
370 0
371 );
372
373 static_assertions::const_assert_eq!(
374 std::mem::offset_of!(ListenerOnMessageRequest<'_>, lease),
375 16
376 );
377
378 impl ::fidl_next::Constrained for ListenerOnMessageRequest<'_> {
379 type Constraint = ();
380
381 fn validate(
382 _: ::fidl_next::Slot<'_, Self>,
383 _: Self::Constraint,
384 ) -> Result<(), ::fidl_next::ValidationError> {
385 Ok(())
386 }
387 }
388
389 unsafe impl ::fidl_next::Wire for ListenerOnMessageRequest<'static> {
390 type Narrowed<'de> = ListenerOnMessageRequest<'de>;
391
392 #[inline]
393 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
394 ::fidl_next::munge! {
395 let Self {
396 message,
397 lease,
398
399 } = &mut *out_;
400 }
401
402 ::fidl_next::Wire::zero_padding(message);
403
404 ::fidl_next::Wire::zero_padding(lease);
405
406 unsafe {
407 out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
408 }
409 }
410 }
411
412 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ListenerOnMessageRequest<'de>
413 where
414 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
415 ___D: ::fidl_next::Decoder<'de>,
416 ___D: ::fidl_next::fuchsia::HandleDecoder,
417 {
418 fn decode(
419 slot_: ::fidl_next::Slot<'_, Self>,
420 decoder_: &mut ___D,
421 _: (),
422 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
423 if slot_.as_bytes()[20..24] != [0u8; 4] {
424 return Err(::fidl_next::DecodeError::InvalidPadding);
425 }
426
427 ::fidl_next::munge! {
428 let Self {
429 mut message,
430 mut lease,
431
432 } = slot_;
433 }
434
435 let _field = message.as_mut();
436 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
437 ::fidl_next::Decode::decode(message.as_mut(), decoder_, (4294967295, ()))?;
438
439 let _field = lease.as_mut();
440
441 ::fidl_next::Decode::decode(lease.as_mut(), decoder_, ())?;
442
443 Ok(())
444 }
445 }
446
447 impl<'de> ::fidl_next::IntoNatural for ListenerOnMessageRequest<'de> {
448 type Natural = crate::natural::ListenerOnMessageRequest;
449 }
450
451 #[derive(Debug)]
453 #[repr(C)]
454 pub struct ListenerOnRequestRequest<'de> {
455 pub message: ::fidl_next::wire::Vector<'de, u8>,
456
457 pub lease: ::fidl_next::wire::fuchsia::OptionalEventPair,
458 }
459
460 static_assertions::const_assert_eq!(std::mem::size_of::<ListenerOnRequestRequest<'_>>(), 24);
461 static_assertions::const_assert_eq!(std::mem::align_of::<ListenerOnRequestRequest<'_>>(), 8);
462
463 static_assertions::const_assert_eq!(
464 std::mem::offset_of!(ListenerOnRequestRequest<'_>, message),
465 0
466 );
467
468 static_assertions::const_assert_eq!(
469 std::mem::offset_of!(ListenerOnRequestRequest<'_>, lease),
470 16
471 );
472
473 impl ::fidl_next::Constrained for ListenerOnRequestRequest<'_> {
474 type Constraint = ();
475
476 fn validate(
477 _: ::fidl_next::Slot<'_, Self>,
478 _: Self::Constraint,
479 ) -> Result<(), ::fidl_next::ValidationError> {
480 Ok(())
481 }
482 }
483
484 unsafe impl ::fidl_next::Wire for ListenerOnRequestRequest<'static> {
485 type Narrowed<'de> = ListenerOnRequestRequest<'de>;
486
487 #[inline]
488 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
489 ::fidl_next::munge! {
490 let Self {
491 message,
492 lease,
493
494 } = &mut *out_;
495 }
496
497 ::fidl_next::Wire::zero_padding(message);
498
499 ::fidl_next::Wire::zero_padding(lease);
500
501 unsafe {
502 out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
503 }
504 }
505 }
506
507 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ListenerOnRequestRequest<'de>
508 where
509 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
510 ___D: ::fidl_next::Decoder<'de>,
511 ___D: ::fidl_next::fuchsia::HandleDecoder,
512 {
513 fn decode(
514 slot_: ::fidl_next::Slot<'_, Self>,
515 decoder_: &mut ___D,
516 _: (),
517 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
518 if slot_.as_bytes()[20..24] != [0u8; 4] {
519 return Err(::fidl_next::DecodeError::InvalidPadding);
520 }
521
522 ::fidl_next::munge! {
523 let Self {
524 mut message,
525 mut lease,
526
527 } = slot_;
528 }
529
530 let _field = message.as_mut();
531 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
532 ::fidl_next::Decode::decode(message.as_mut(), decoder_, (4294967295, ()))?;
533
534 let _field = lease.as_mut();
535
536 ::fidl_next::Decode::decode(lease.as_mut(), decoder_, ())?;
537
538 Ok(())
539 }
540 }
541
542 impl<'de> ::fidl_next::IntoNatural for ListenerOnRequestRequest<'de> {
543 type Natural = crate::natural::ListenerOnRequestRequest;
544 }
545}
546
547pub mod wire_optional {
548
549 pub use fidl_next_common_fuchsia_hardware_mailbox::wire_optional::*;
550}
551
552pub mod generic {
553
554 pub use fidl_next_common_fuchsia_hardware_mailbox::generic::*;
555
556 pub struct ChannelRegisterListenerRequest<T0> {
558 pub listener: T0,
559 }
560
561 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::ChannelRegisterListenerRequest, ___E>
562 for ChannelRegisterListenerRequest<T0>
563 where
564 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
565 ___E: ::fidl_next::fuchsia::HandleEncoder,
566 T0: ::fidl_next::Encode<
567 ::fidl_next::ClientEnd<crate::Listener, ::fidl_next::wire::fuchsia::Channel>,
568 ___E,
569 >,
570 {
571 #[inline]
572 fn encode(
573 self,
574 encoder_: &mut ___E,
575 out_: &mut ::core::mem::MaybeUninit<crate::wire::ChannelRegisterListenerRequest>,
576 _: (),
577 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
578 ::fidl_next::munge! {
579 let crate::wire::ChannelRegisterListenerRequest {
580 listener,
581
582 } = out_;
583 }
584
585 ::fidl_next::Encode::encode(self.listener, encoder_, listener, ())?;
586
587 Ok(())
588 }
589 }
590
591 pub struct ListenerOnMessageRequest<T0, T1> {
593 pub message: T0,
594
595 pub lease: T1,
596 }
597
598 unsafe impl<___E, T0, T1>
599 ::fidl_next::Encode<crate::wire::ListenerOnMessageRequest<'static>, ___E>
600 for ListenerOnMessageRequest<T0, T1>
601 where
602 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
603 ___E: ::fidl_next::Encoder,
604 ___E: ::fidl_next::fuchsia::HandleEncoder,
605 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
606 T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
607 {
608 #[inline]
609 fn encode(
610 self,
611 encoder_: &mut ___E,
612 out_: &mut ::core::mem::MaybeUninit<crate::wire::ListenerOnMessageRequest<'static>>,
613 _: (),
614 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
615 ::fidl_next::munge! {
616 let crate::wire::ListenerOnMessageRequest {
617 message,
618 lease,
619
620 } = out_;
621 }
622
623 ::fidl_next::Encode::encode(self.message, encoder_, message, (4294967295, ()))?;
624
625 ::fidl_next::Encode::encode(self.lease, encoder_, lease, ())?;
626
627 Ok(())
628 }
629 }
630
631 pub struct ListenerOnRequestRequest<T0, T1> {
633 pub message: T0,
634
635 pub lease: T1,
636 }
637
638 unsafe impl<___E, T0, T1>
639 ::fidl_next::Encode<crate::wire::ListenerOnRequestRequest<'static>, ___E>
640 for ListenerOnRequestRequest<T0, T1>
641 where
642 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
643 ___E: ::fidl_next::Encoder,
644 ___E: ::fidl_next::fuchsia::HandleEncoder,
645 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
646 T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
647 {
648 #[inline]
649 fn encode(
650 self,
651 encoder_: &mut ___E,
652 out_: &mut ::core::mem::MaybeUninit<crate::wire::ListenerOnRequestRequest<'static>>,
653 _: (),
654 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
655 ::fidl_next::munge! {
656 let crate::wire::ListenerOnRequestRequest {
657 message,
658 lease,
659
660 } = out_;
661 }
662
663 ::fidl_next::Encode::encode(self.message, encoder_, message, (4294967295, ()))?;
664
665 ::fidl_next::Encode::encode(self.lease, encoder_, lease, ())?;
666
667 Ok(())
668 }
669 }
670}
671
672pub use self::natural::*;
673
674#[doc = " `Channel` represents a single mailbox channel that can be used to send messages to a\n destination core.\n"]
676#[derive(PartialEq, Debug)]
677pub struct Channel;
678
679impl ::fidl_next::Discoverable for Channel {
680 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.mailbox.Channel";
681}
682
683#[cfg(target_os = "fuchsia")]
684impl ::fidl_next::HasTransport for Channel {
685 type Transport = ::fidl_next::fuchsia::zx::Channel;
686}
687
688pub mod channel {
689 pub mod prelude {
690 pub use crate::{
691 Channel, ChannelClientHandler, ChannelLocalClientHandler, ChannelLocalServerHandler,
692 ChannelServerHandler, channel,
693 };
694
695 pub use crate::natural::ChannelRegisterListenerRequest;
696
697 pub use crate::natural::ChannelSendMessageRequest;
698
699 pub use crate::natural::ChannelSendRequestRequest;
700
701 pub use crate::natural::ChannelRegisterListenerResponse;
702
703 pub use crate::natural::ChannelSendMessageResponse;
704
705 pub use crate::natural::ChannelSendRequestResponse;
706 }
707
708 pub struct SendMessage;
709
710 impl ::fidl_next::Method for SendMessage {
711 const ORDINAL: u64 = 6704182562539000811;
712 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
713 ::fidl_next::protocol::Flexibility::Strict;
714
715 type Protocol = crate::Channel;
716
717 type Request = crate::wire::ChannelSendMessageRequest<'static>;
718 }
719
720 impl ::fidl_next::TwoWayMethod for SendMessage {
721 type Response = ::fidl_next::wire::Result<
722 'static,
723 crate::wire::ChannelSendMessageResponse,
724 ::fidl_next::wire::fuchsia::Status,
725 >;
726 }
727
728 impl<___R> ::fidl_next::Respond<___R> for SendMessage {
729 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
730
731 fn respond(response: ___R) -> Self::Output {
732 ::core::result::Result::Ok(response)
733 }
734 }
735
736 impl<___R> ::fidl_next::RespondErr<___R> for SendMessage {
737 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
738
739 fn respond_err(response: ___R) -> Self::Output {
740 ::core::result::Result::Err(response)
741 }
742 }
743
744 pub struct SendRequest;
745
746 impl ::fidl_next::Method for SendRequest {
747 const ORDINAL: u64 = 8628593229059937179;
748 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
749 ::fidl_next::protocol::Flexibility::Flexible;
750
751 type Protocol = crate::Channel;
752
753 type Request = crate::wire::ChannelSendRequestRequest<'static>;
754 }
755
756 impl ::fidl_next::TwoWayMethod for SendRequest {
757 type Response = ::fidl_next::wire::Result<
758 'static,
759 crate::wire::ChannelSendRequestResponse<'static>,
760 ::fidl_next::wire::fuchsia::Status,
761 >;
762 }
763
764 impl<___R> ::fidl_next::Respond<___R> for SendRequest {
765 type Output = ::core::result::Result<
766 crate::generic::ChannelSendRequestResponse<___R>,
767 ::fidl_next::never::Never,
768 >;
769
770 fn respond(response: ___R) -> Self::Output {
771 ::core::result::Result::Ok(crate::generic::ChannelSendRequestResponse {
772 response: response,
773 })
774 }
775 }
776
777 impl<___R> ::fidl_next::RespondErr<___R> for SendRequest {
778 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
779
780 fn respond_err(response: ___R) -> Self::Output {
781 ::core::result::Result::Err(response)
782 }
783 }
784
785 pub struct RegisterListener;
786
787 impl ::fidl_next::Method for RegisterListener {
788 const ORDINAL: u64 = 7770453825026299131;
789 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
790 ::fidl_next::protocol::Flexibility::Flexible;
791
792 type Protocol = crate::Channel;
793
794 type Request = crate::wire::ChannelRegisterListenerRequest;
795 }
796
797 impl ::fidl_next::TwoWayMethod for RegisterListener {
798 type Response = ::fidl_next::wire::Result<
799 'static,
800 crate::wire::ChannelRegisterListenerResponse,
801 ::fidl_next::wire::fuchsia::Status,
802 >;
803 }
804
805 impl<___R> ::fidl_next::Respond<___R> for RegisterListener {
806 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
807
808 fn respond(response: ___R) -> Self::Output {
809 ::core::result::Result::Ok(response)
810 }
811 }
812
813 impl<___R> ::fidl_next::RespondErr<___R> for RegisterListener {
814 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
815
816 fn respond_err(response: ___R) -> Self::Output {
817 ::core::result::Result::Err(response)
818 }
819 }
820
821 mod ___detail {
822 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Channel
823 where
824 ___T: ::fidl_next::Transport,
825 {
826 type Client = ChannelClient<___T>;
827 type Server = ChannelServer<___T>;
828 }
829
830 #[repr(transparent)]
832 pub struct ChannelClient<___T: ::fidl_next::Transport> {
833 #[allow(dead_code)]
834 client: ::fidl_next::protocol::Client<___T>,
835 }
836
837 impl<___T> ChannelClient<___T>
838 where
839 ___T: ::fidl_next::Transport,
840 {
841 #[doc = " Writes the message to the mailbox, interrupts the destination core, and (if applicable)\n waits for the destination core to ack the message.\n\n Returns `ZX_ERR_OUT_OF_RANGE` if `message` is larger than what the hardware can support.\n"]
842 pub fn send_message(
843 &self,
844
845 message: impl ::fidl_next::Encode<
846 ::fidl_next::wire::Vector<'static, u8>,
847 <___T as ::fidl_next::Transport>::SendBuffer,
848 >,
849 ) -> ::fidl_next::TwoWayFuture<'_, super::SendMessage, ___T>
850 where
851 <___T as ::fidl_next::Transport>::SendBuffer:
852 ::fidl_next::encoder::InternalHandleEncoder,
853 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
854 {
855 self.send_message_with(crate::generic::ChannelSendMessageRequest { message })
856 }
857
858 #[doc = " Writes the message to the mailbox, interrupts the destination core, and (if applicable)\n waits for the destination core to ack the message.\n\n Returns `ZX_ERR_OUT_OF_RANGE` if `message` is larger than what the hardware can support.\n"]
859 pub fn send_message_with<___R>(
860 &self,
861 request: ___R,
862 ) -> ::fidl_next::TwoWayFuture<'_, super::SendMessage, ___T>
863 where
864 ___R: ::fidl_next::Encode<
865 crate::wire::ChannelSendMessageRequest<'static>,
866 <___T as ::fidl_next::Transport>::SendBuffer,
867 >,
868 {
869 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
870 6704182562539000811,
871 <super::SendMessage as ::fidl_next::Method>::FLEXIBILITY,
872 request,
873 ))
874 }
875
876 #[doc = " Writes the request to the mailbox, interrupts the destination core, and\n waits for the destination core to send a response.\n\n Returns `ZX_ERR_OUT_OF_RANGE` if `request` is larger than what the hardware can support.\n Returns `ZX_ERR_NOT_SUPPORTED` if the destination core does not support correlating\n requests to responses.\n"]
877 pub fn send_request(
878 &self,
879
880 request: impl ::fidl_next::Encode<
881 ::fidl_next::wire::Vector<'static, u8>,
882 <___T as ::fidl_next::Transport>::SendBuffer,
883 >,
884 ) -> ::fidl_next::TwoWayFuture<'_, super::SendRequest, ___T>
885 where
886 <___T as ::fidl_next::Transport>::SendBuffer:
887 ::fidl_next::encoder::InternalHandleEncoder,
888 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
889 {
890 self.send_request_with(crate::generic::ChannelSendRequestRequest { request })
891 }
892
893 #[doc = " Writes the request to the mailbox, interrupts the destination core, and\n waits for the destination core to send a response.\n\n Returns `ZX_ERR_OUT_OF_RANGE` if `request` is larger than what the hardware can support.\n Returns `ZX_ERR_NOT_SUPPORTED` if the destination core does not support correlating\n requests to responses.\n"]
894 pub fn send_request_with<___R>(
895 &self,
896 request: ___R,
897 ) -> ::fidl_next::TwoWayFuture<'_, super::SendRequest, ___T>
898 where
899 ___R: ::fidl_next::Encode<
900 crate::wire::ChannelSendRequestRequest<'static>,
901 <___T as ::fidl_next::Transport>::SendBuffer,
902 >,
903 {
904 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
905 8628593229059937179,
906 <super::SendRequest as ::fidl_next::Method>::FLEXIBILITY,
907 request,
908 ))
909 }
910
911 #[doc = " Registers a listener for incoming messages on this channel. Multiple listeners may NOT be\n registered at a time. If a listener is already registered, this call will fail with\n `ZX_ERR_ALREADY_BOUND`.\n\n To unregister a listener, the server will close its end of the channel. Another listener\n may be registered after the previous listener has been unregistered.\n"]
912 pub fn register_listener(
913 &self,
914
915 listener: impl ::fidl_next::Encode<
916 ::fidl_next::ClientEnd<crate::Listener, ::fidl_next::wire::fuchsia::Channel>,
917 <___T as ::fidl_next::Transport>::SendBuffer,
918 >,
919 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterListener, ___T>
920 where
921 <___T as ::fidl_next::Transport>::SendBuffer:
922 ::fidl_next::encoder::InternalHandleEncoder,
923 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
924 {
925 self.register_listener_with(crate::generic::ChannelRegisterListenerRequest {
926 listener,
927 })
928 }
929
930 #[doc = " Registers a listener for incoming messages on this channel. Multiple listeners may NOT be\n registered at a time. If a listener is already registered, this call will fail with\n `ZX_ERR_ALREADY_BOUND`.\n\n To unregister a listener, the server will close its end of the channel. Another listener\n may be registered after the previous listener has been unregistered.\n"]
931 pub fn register_listener_with<___R>(
932 &self,
933 request: ___R,
934 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterListener, ___T>
935 where
936 ___R: ::fidl_next::Encode<
937 crate::wire::ChannelRegisterListenerRequest,
938 <___T as ::fidl_next::Transport>::SendBuffer,
939 >,
940 {
941 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
942 7770453825026299131,
943 <super::RegisterListener as ::fidl_next::Method>::FLEXIBILITY,
944 request,
945 ))
946 }
947 }
948
949 #[repr(transparent)]
951 pub struct ChannelServer<___T: ::fidl_next::Transport> {
952 server: ::fidl_next::protocol::Server<___T>,
953 }
954
955 impl<___T> ChannelServer<___T> where ___T: ::fidl_next::Transport {}
956 }
957}
958
959#[diagnostic::on_unimplemented(
960 note = "If {Self} implements the non-local ChannelClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
961)]
962
963pub trait ChannelLocalClientHandler<
967 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
968 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
969>
970{
971 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
972 ::core::future::ready(())
973 }
974}
975
976impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Channel
977where
978 ___H: ChannelLocalClientHandler<___T>,
979 ___T: ::fidl_next::Transport,
980{
981 async fn on_event(
982 handler: &mut ___H,
983 mut message: ::fidl_next::Message<___T>,
984 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
985 match *message.header().ordinal {
986 ordinal => {
987 handler.on_unknown_interaction(ordinal).await;
988 if ::core::matches!(
989 message.header().flexibility(),
990 ::fidl_next::protocol::Flexibility::Strict
991 ) {
992 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
993 } else {
994 Ok(())
995 }
996 }
997 }
998 }
999}
1000
1001#[diagnostic::on_unimplemented(
1002 note = "If {Self} implements the non-local ChannelServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1003)]
1004
1005pub trait ChannelLocalServerHandler<
1009 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1010 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1011>
1012{
1013 #[doc = " Writes the message to the mailbox, interrupts the destination core, and (if applicable)\n waits for the destination core to ack the message.\n\n Returns `ZX_ERR_OUT_OF_RANGE` if `message` is larger than what the hardware can support.\n"]
1014 fn send_message(
1015 &mut self,
1016
1017 request: ::fidl_next::Request<channel::SendMessage, ___T>,
1018
1019 responder: ::fidl_next::Responder<channel::SendMessage, ___T>,
1020 ) -> impl ::core::future::Future<Output = ()>;
1021
1022 #[doc = " Writes the request to the mailbox, interrupts the destination core, and\n waits for the destination core to send a response.\n\n Returns `ZX_ERR_OUT_OF_RANGE` if `request` is larger than what the hardware can support.\n Returns `ZX_ERR_NOT_SUPPORTED` if the destination core does not support correlating\n requests to responses.\n"]
1023 fn send_request(
1024 &mut self,
1025
1026 request: ::fidl_next::Request<channel::SendRequest, ___T>,
1027
1028 responder: ::fidl_next::Responder<channel::SendRequest, ___T>,
1029 ) -> impl ::core::future::Future<Output = ()>;
1030
1031 #[doc = " Registers a listener for incoming messages on this channel. Multiple listeners may NOT be\n registered at a time. If a listener is already registered, this call will fail with\n `ZX_ERR_ALREADY_BOUND`.\n\n To unregister a listener, the server will close its end of the channel. Another listener\n may be registered after the previous listener has been unregistered.\n"]
1032 fn register_listener(
1033 &mut self,
1034
1035 request: ::fidl_next::Request<channel::RegisterListener, ___T>,
1036
1037 responder: ::fidl_next::Responder<channel::RegisterListener, ___T>,
1038 ) -> impl ::core::future::Future<Output = ()>;
1039
1040 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1041 ::core::future::ready(())
1042 }
1043}
1044
1045impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Channel
1046where
1047 ___H: ChannelLocalServerHandler<___T>,
1048 ___T: ::fidl_next::Transport,
1049 for<'de> crate::wire::ChannelSendMessageRequest<'de>: ::fidl_next::Decode<
1050 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1051 Constraint = (),
1052 >,
1053 for<'de> crate::wire::ChannelSendRequestRequest<'de>: ::fidl_next::Decode<
1054 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1055 Constraint = (),
1056 >,
1057 for<'de> crate::wire::ChannelRegisterListenerRequest: ::fidl_next::Decode<
1058 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1059 Constraint = (),
1060 >,
1061{
1062 async fn on_one_way(
1063 handler: &mut ___H,
1064 mut message: ::fidl_next::Message<___T>,
1065 ) -> ::core::result::Result<
1066 (),
1067 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1068 > {
1069 match *message.header().ordinal {
1070 ordinal => {
1071 handler.on_unknown_interaction(ordinal).await;
1072 if ::core::matches!(
1073 message.header().flexibility(),
1074 ::fidl_next::protocol::Flexibility::Strict
1075 ) {
1076 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1077 } else {
1078 Ok(())
1079 }
1080 }
1081 }
1082 }
1083
1084 async fn on_two_way(
1085 handler: &mut ___H,
1086 mut message: ::fidl_next::Message<___T>,
1087 responder: ::fidl_next::protocol::Responder<___T>,
1088 ) -> ::core::result::Result<
1089 (),
1090 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1091 > {
1092 match *message.header().ordinal {
1093 6704182562539000811 => {
1094 let responder = ::fidl_next::Responder::from_untyped(responder);
1095
1096 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1097 Ok(decoded) => {
1098 handler
1099 .send_message(::fidl_next::Request::from_decoded(decoded), responder)
1100 .await;
1101 Ok(())
1102 }
1103 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1104 ordinal: 6704182562539000811,
1105 error,
1106 }),
1107 }
1108 }
1109
1110 8628593229059937179 => {
1111 let responder = ::fidl_next::Responder::from_untyped(responder);
1112
1113 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1114 Ok(decoded) => {
1115 handler
1116 .send_request(::fidl_next::Request::from_decoded(decoded), responder)
1117 .await;
1118 Ok(())
1119 }
1120 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1121 ordinal: 8628593229059937179,
1122 error,
1123 }),
1124 }
1125 }
1126
1127 7770453825026299131 => {
1128 let responder = ::fidl_next::Responder::from_untyped(responder);
1129
1130 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1131 Ok(decoded) => {
1132 handler
1133 .register_listener(
1134 ::fidl_next::Request::from_decoded(decoded),
1135 responder,
1136 )
1137 .await;
1138 Ok(())
1139 }
1140 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1141 ordinal: 7770453825026299131,
1142 error,
1143 }),
1144 }
1145 }
1146
1147 ordinal => {
1148 handler.on_unknown_interaction(ordinal).await;
1149 if ::core::matches!(
1150 message.header().flexibility(),
1151 ::fidl_next::protocol::Flexibility::Strict
1152 ) {
1153 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1154 } else {
1155 responder
1156 .respond_framework_error(
1157 ordinal,
1158 ::fidl_next::FrameworkError::UnknownMethod,
1159 )
1160 .expect("encoding a framework error should never fail")
1161 .await?;
1162 Ok(())
1163 }
1164 }
1165 }
1166 }
1167}
1168
1169pub trait ChannelClientHandler<
1173 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1174 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1175>
1176{
1177 fn on_unknown_interaction(
1178 &mut self,
1179 ordinal: u64,
1180 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1181 ::core::future::ready(())
1182 }
1183}
1184
1185impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Channel
1186where
1187 ___H: ChannelClientHandler<___T> + ::core::marker::Send,
1188 ___T: ::fidl_next::Transport,
1189{
1190 async fn on_event(
1191 handler: &mut ___H,
1192 mut message: ::fidl_next::Message<___T>,
1193 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1194 match *message.header().ordinal {
1195 ordinal => {
1196 handler.on_unknown_interaction(ordinal).await;
1197 if ::core::matches!(
1198 message.header().flexibility(),
1199 ::fidl_next::protocol::Flexibility::Strict
1200 ) {
1201 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1202 } else {
1203 Ok(())
1204 }
1205 }
1206 }
1207 }
1208}
1209
1210pub trait ChannelServerHandler<
1214 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1215 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1216>
1217{
1218 #[doc = " Writes the message to the mailbox, interrupts the destination core, and (if applicable)\n waits for the destination core to ack the message.\n\n Returns `ZX_ERR_OUT_OF_RANGE` if `message` is larger than what the hardware can support.\n"]
1219 fn send_message(
1220 &mut self,
1221
1222 request: ::fidl_next::Request<channel::SendMessage, ___T>,
1223
1224 responder: ::fidl_next::Responder<channel::SendMessage, ___T>,
1225 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1226
1227 #[doc = " Writes the request to the mailbox, interrupts the destination core, and\n waits for the destination core to send a response.\n\n Returns `ZX_ERR_OUT_OF_RANGE` if `request` is larger than what the hardware can support.\n Returns `ZX_ERR_NOT_SUPPORTED` if the destination core does not support correlating\n requests to responses.\n"]
1228 fn send_request(
1229 &mut self,
1230
1231 request: ::fidl_next::Request<channel::SendRequest, ___T>,
1232
1233 responder: ::fidl_next::Responder<channel::SendRequest, ___T>,
1234 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1235
1236 #[doc = " Registers a listener for incoming messages on this channel. Multiple listeners may NOT be\n registered at a time. If a listener is already registered, this call will fail with\n `ZX_ERR_ALREADY_BOUND`.\n\n To unregister a listener, the server will close its end of the channel. Another listener\n may be registered after the previous listener has been unregistered.\n"]
1237 fn register_listener(
1238 &mut self,
1239
1240 request: ::fidl_next::Request<channel::RegisterListener, ___T>,
1241
1242 responder: ::fidl_next::Responder<channel::RegisterListener, ___T>,
1243 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1244
1245 fn on_unknown_interaction(
1246 &mut self,
1247 ordinal: u64,
1248 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1249 ::core::future::ready(())
1250 }
1251}
1252
1253impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Channel
1254where
1255 ___H: ChannelServerHandler<___T> + ::core::marker::Send,
1256 ___T: ::fidl_next::Transport,
1257 for<'de> crate::wire::ChannelSendMessageRequest<'de>: ::fidl_next::Decode<
1258 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1259 Constraint = (),
1260 >,
1261 for<'de> crate::wire::ChannelSendRequestRequest<'de>: ::fidl_next::Decode<
1262 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1263 Constraint = (),
1264 >,
1265 for<'de> crate::wire::ChannelRegisterListenerRequest: ::fidl_next::Decode<
1266 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1267 Constraint = (),
1268 >,
1269{
1270 async fn on_one_way(
1271 handler: &mut ___H,
1272 mut message: ::fidl_next::Message<___T>,
1273 ) -> ::core::result::Result<
1274 (),
1275 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1276 > {
1277 match *message.header().ordinal {
1278 ordinal => {
1279 handler.on_unknown_interaction(ordinal).await;
1280 if ::core::matches!(
1281 message.header().flexibility(),
1282 ::fidl_next::protocol::Flexibility::Strict
1283 ) {
1284 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1285 } else {
1286 Ok(())
1287 }
1288 }
1289 }
1290 }
1291
1292 async fn on_two_way(
1293 handler: &mut ___H,
1294 mut message: ::fidl_next::Message<___T>,
1295 responder: ::fidl_next::protocol::Responder<___T>,
1296 ) -> ::core::result::Result<
1297 (),
1298 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1299 > {
1300 match *message.header().ordinal {
1301 6704182562539000811 => {
1302 let responder = ::fidl_next::Responder::from_untyped(responder);
1303
1304 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1305 Ok(decoded) => {
1306 handler
1307 .send_message(::fidl_next::Request::from_decoded(decoded), responder)
1308 .await;
1309 Ok(())
1310 }
1311 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1312 ordinal: 6704182562539000811,
1313 error,
1314 }),
1315 }
1316 }
1317
1318 8628593229059937179 => {
1319 let responder = ::fidl_next::Responder::from_untyped(responder);
1320
1321 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1322 Ok(decoded) => {
1323 handler
1324 .send_request(::fidl_next::Request::from_decoded(decoded), responder)
1325 .await;
1326 Ok(())
1327 }
1328 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1329 ordinal: 8628593229059937179,
1330 error,
1331 }),
1332 }
1333 }
1334
1335 7770453825026299131 => {
1336 let responder = ::fidl_next::Responder::from_untyped(responder);
1337
1338 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1339 Ok(decoded) => {
1340 handler
1341 .register_listener(
1342 ::fidl_next::Request::from_decoded(decoded),
1343 responder,
1344 )
1345 .await;
1346 Ok(())
1347 }
1348 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1349 ordinal: 7770453825026299131,
1350 error,
1351 }),
1352 }
1353 }
1354
1355 ordinal => {
1356 handler.on_unknown_interaction(ordinal).await;
1357 if ::core::matches!(
1358 message.header().flexibility(),
1359 ::fidl_next::protocol::Flexibility::Strict
1360 ) {
1361 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1362 } else {
1363 responder
1364 .respond_framework_error(
1365 ordinal,
1366 ::fidl_next::FrameworkError::UnknownMethod,
1367 )
1368 .expect("encoding a framework error should never fail")
1369 .await?;
1370 Ok(())
1371 }
1372 }
1373 }
1374 }
1375}
1376
1377impl<___T> ChannelClientHandler<___T> for ::fidl_next::IgnoreEvents
1378where
1379 ___T: ::fidl_next::Transport,
1380{
1381 async fn on_unknown_interaction(&mut self, _: u64) {}
1382}
1383
1384impl<___H, ___T> ChannelLocalClientHandler<___T> for ::fidl_next::Local<___H>
1385where
1386 ___H: ChannelClientHandler<___T>,
1387 ___T: ::fidl_next::Transport,
1388{
1389 async fn on_unknown_interaction(&mut self, ordinal: u64) {
1390 ___H::on_unknown_interaction(&mut self.0, ordinal).await
1391 }
1392}
1393
1394impl<___H, ___T> ChannelLocalServerHandler<___T> for ::fidl_next::Local<___H>
1395where
1396 ___H: ChannelServerHandler<___T>,
1397 ___T: ::fidl_next::Transport,
1398{
1399 async fn send_message(
1400 &mut self,
1401
1402 request: ::fidl_next::Request<channel::SendMessage, ___T>,
1403
1404 responder: ::fidl_next::Responder<channel::SendMessage, ___T>,
1405 ) {
1406 ___H::send_message(&mut self.0, request, responder).await
1407 }
1408
1409 async fn send_request(
1410 &mut self,
1411
1412 request: ::fidl_next::Request<channel::SendRequest, ___T>,
1413
1414 responder: ::fidl_next::Responder<channel::SendRequest, ___T>,
1415 ) {
1416 ___H::send_request(&mut self.0, request, responder).await
1417 }
1418
1419 async fn register_listener(
1420 &mut self,
1421
1422 request: ::fidl_next::Request<channel::RegisterListener, ___T>,
1423
1424 responder: ::fidl_next::Responder<channel::RegisterListener, ___T>,
1425 ) {
1426 ___H::register_listener(&mut self.0, request, responder).await
1427 }
1428
1429 async fn on_unknown_interaction(&mut self, ordinal: u64) {
1430 ___H::on_unknown_interaction(&mut self.0, ordinal).await
1431 }
1432}
1433
1434#[doc = " `Listener` is used to receive messages from a mailbox channel.\n\n The server end of this is held by the mailbox client.\n"]
1436#[derive(PartialEq, Debug)]
1437pub struct Listener;
1438
1439#[cfg(target_os = "fuchsia")]
1440impl ::fidl_next::HasTransport for Listener {
1441 type Transport = ::fidl_next::fuchsia::zx::Channel;
1442}
1443
1444pub mod listener {
1445 pub mod prelude {
1446 pub use crate::{
1447 Listener, ListenerClientHandler, ListenerLocalClientHandler,
1448 ListenerLocalServerHandler, ListenerServerHandler, listener,
1449 };
1450
1451 pub use crate::natural::ListenerOnMessageRequest;
1452
1453 pub use crate::natural::ListenerOnRequestRequest;
1454
1455 pub use crate::natural::ListenerOnMessageResponse;
1456
1457 pub use crate::natural::ListenerOnRequestResponse;
1458 }
1459
1460 pub struct OnMessage;
1461
1462 impl ::fidl_next::Method for OnMessage {
1463 const ORDINAL: u64 = 3132544944554375052;
1464 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1465 ::fidl_next::protocol::Flexibility::Flexible;
1466
1467 type Protocol = crate::Listener;
1468
1469 type Request = crate::wire::ListenerOnMessageRequest<'static>;
1470 }
1471
1472 impl ::fidl_next::TwoWayMethod for OnMessage {
1473 type Response = ::fidl_next::wire::Result<
1474 'static,
1475 crate::wire::ListenerOnMessageResponse,
1476 ::fidl_next::wire::fuchsia::Status,
1477 >;
1478 }
1479
1480 impl<___R> ::fidl_next::Respond<___R> for OnMessage {
1481 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1482
1483 fn respond(response: ___R) -> Self::Output {
1484 ::core::result::Result::Ok(response)
1485 }
1486 }
1487
1488 impl<___R> ::fidl_next::RespondErr<___R> for OnMessage {
1489 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1490
1491 fn respond_err(response: ___R) -> Self::Output {
1492 ::core::result::Result::Err(response)
1493 }
1494 }
1495
1496 pub struct OnRequest;
1497
1498 impl ::fidl_next::Method for OnRequest {
1499 const ORDINAL: u64 = 6226805799602931743;
1500 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1501 ::fidl_next::protocol::Flexibility::Flexible;
1502
1503 type Protocol = crate::Listener;
1504
1505 type Request = crate::wire::ListenerOnRequestRequest<'static>;
1506 }
1507
1508 impl ::fidl_next::TwoWayMethod for OnRequest {
1509 type Response = ::fidl_next::wire::Result<
1510 'static,
1511 crate::wire::ListenerOnRequestResponse<'static>,
1512 ::fidl_next::wire::fuchsia::Status,
1513 >;
1514 }
1515
1516 impl<___R> ::fidl_next::Respond<___R> for OnRequest {
1517 type Output = ::core::result::Result<
1518 crate::generic::ListenerOnRequestResponse<___R>,
1519 ::fidl_next::never::Never,
1520 >;
1521
1522 fn respond(response: ___R) -> Self::Output {
1523 ::core::result::Result::Ok(crate::generic::ListenerOnRequestResponse {
1524 response: response,
1525 })
1526 }
1527 }
1528
1529 impl<___R> ::fidl_next::RespondErr<___R> for OnRequest {
1530 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1531
1532 fn respond_err(response: ___R) -> Self::Output {
1533 ::core::result::Result::Err(response)
1534 }
1535 }
1536
1537 mod ___detail {
1538 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Listener
1539 where
1540 ___T: ::fidl_next::Transport,
1541 {
1542 type Client = ListenerClient<___T>;
1543 type Server = ListenerServer<___T>;
1544 }
1545
1546 #[repr(transparent)]
1548 pub struct ListenerClient<___T: ::fidl_next::Transport> {
1549 #[allow(dead_code)]
1550 client: ::fidl_next::protocol::Client<___T>,
1551 }
1552
1553 impl<___T> ListenerClient<___T>
1554 where
1555 ___T: ::fidl_next::Transport,
1556 {
1557 #[doc = " Called when a message is received on the mailbox channel.\n\n The mailbox driver will not call `OnMessage` concurrently. It will wait\n for the previous call to complete before sending another message.\n\n If the client fails to respond to `OnMessage` in a timely manner, the\n mailbox driver may run out of memory and drop subsequent messages.\n\n `lease` is an optional wake lease baton passed by the mailbox driver when\n the message caused or arrived during a wake event, keeping the system\n awake until the listener has handled the message (or acquired its own\n wake lease).\n"]
1558 pub fn on_message(
1559 &self,
1560
1561 message: impl ::fidl_next::Encode<
1562 ::fidl_next::wire::Vector<'static, u8>,
1563 <___T as ::fidl_next::Transport>::SendBuffer,
1564 >,
1565
1566 lease: impl ::fidl_next::Encode<
1567 ::fidl_next::wire::fuchsia::OptionalEventPair,
1568 <___T as ::fidl_next::Transport>::SendBuffer,
1569 >,
1570 ) -> ::fidl_next::TwoWayFuture<'_, super::OnMessage, ___T>
1571 where
1572 <___T as ::fidl_next::Transport>::SendBuffer:
1573 ::fidl_next::encoder::InternalHandleEncoder,
1574 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1575 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1576 {
1577 self.on_message_with(crate::generic::ListenerOnMessageRequest { message, lease })
1578 }
1579
1580 #[doc = " Called when a message is received on the mailbox channel.\n\n The mailbox driver will not call `OnMessage` concurrently. It will wait\n for the previous call to complete before sending another message.\n\n If the client fails to respond to `OnMessage` in a timely manner, the\n mailbox driver may run out of memory and drop subsequent messages.\n\n `lease` is an optional wake lease baton passed by the mailbox driver when\n the message caused or arrived during a wake event, keeping the system\n awake until the listener has handled the message (or acquired its own\n wake lease).\n"]
1581 pub fn on_message_with<___R>(
1582 &self,
1583 request: ___R,
1584 ) -> ::fidl_next::TwoWayFuture<'_, super::OnMessage, ___T>
1585 where
1586 ___R: ::fidl_next::Encode<
1587 crate::wire::ListenerOnMessageRequest<'static>,
1588 <___T as ::fidl_next::Transport>::SendBuffer,
1589 >,
1590 {
1591 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1592 3132544944554375052,
1593 <super::OnMessage as ::fidl_next::Method>::FLEXIBILITY,
1594 request,
1595 ))
1596 }
1597
1598 #[doc = " Called when a request is received on the mailbox channel.\n\n The client should process the request and return the response payload based\n on what was requested. The response will be returned to the remote core by\n the mailbox driver.\n\n If the listener returns an error, the error is logged by the mailbox driver\n and no response is returned to the remote core.\n\n The same concurrency rules as `OnMessage` apply.\n\n `lease` is an optional wake lease baton with the same semantics as in\n `OnMessage`.\n"]
1599 pub fn on_request(
1600 &self,
1601
1602 message: impl ::fidl_next::Encode<
1603 ::fidl_next::wire::Vector<'static, u8>,
1604 <___T as ::fidl_next::Transport>::SendBuffer,
1605 >,
1606
1607 lease: impl ::fidl_next::Encode<
1608 ::fidl_next::wire::fuchsia::OptionalEventPair,
1609 <___T as ::fidl_next::Transport>::SendBuffer,
1610 >,
1611 ) -> ::fidl_next::TwoWayFuture<'_, super::OnRequest, ___T>
1612 where
1613 <___T as ::fidl_next::Transport>::SendBuffer:
1614 ::fidl_next::encoder::InternalHandleEncoder,
1615 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1616 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1617 {
1618 self.on_request_with(crate::generic::ListenerOnRequestRequest { message, lease })
1619 }
1620
1621 #[doc = " Called when a request is received on the mailbox channel.\n\n The client should process the request and return the response payload based\n on what was requested. The response will be returned to the remote core by\n the mailbox driver.\n\n If the listener returns an error, the error is logged by the mailbox driver\n and no response is returned to the remote core.\n\n The same concurrency rules as `OnMessage` apply.\n\n `lease` is an optional wake lease baton with the same semantics as in\n `OnMessage`.\n"]
1622 pub fn on_request_with<___R>(
1623 &self,
1624 request: ___R,
1625 ) -> ::fidl_next::TwoWayFuture<'_, super::OnRequest, ___T>
1626 where
1627 ___R: ::fidl_next::Encode<
1628 crate::wire::ListenerOnRequestRequest<'static>,
1629 <___T as ::fidl_next::Transport>::SendBuffer,
1630 >,
1631 {
1632 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1633 6226805799602931743,
1634 <super::OnRequest as ::fidl_next::Method>::FLEXIBILITY,
1635 request,
1636 ))
1637 }
1638 }
1639
1640 #[repr(transparent)]
1642 pub struct ListenerServer<___T: ::fidl_next::Transport> {
1643 server: ::fidl_next::protocol::Server<___T>,
1644 }
1645
1646 impl<___T> ListenerServer<___T> where ___T: ::fidl_next::Transport {}
1647 }
1648}
1649
1650#[diagnostic::on_unimplemented(
1651 note = "If {Self} implements the non-local ListenerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1652)]
1653
1654pub trait ListenerLocalClientHandler<
1658 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1659 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1660>
1661{
1662 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1663 ::core::future::ready(())
1664 }
1665}
1666
1667impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Listener
1668where
1669 ___H: ListenerLocalClientHandler<___T>,
1670 ___T: ::fidl_next::Transport,
1671{
1672 async fn on_event(
1673 handler: &mut ___H,
1674 mut message: ::fidl_next::Message<___T>,
1675 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1676 match *message.header().ordinal {
1677 ordinal => {
1678 handler.on_unknown_interaction(ordinal).await;
1679 if ::core::matches!(
1680 message.header().flexibility(),
1681 ::fidl_next::protocol::Flexibility::Strict
1682 ) {
1683 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1684 } else {
1685 Ok(())
1686 }
1687 }
1688 }
1689 }
1690}
1691
1692#[diagnostic::on_unimplemented(
1693 note = "If {Self} implements the non-local ListenerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1694)]
1695
1696pub trait ListenerLocalServerHandler<
1700 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1701 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1702>
1703{
1704 #[doc = " Called when a message is received on the mailbox channel.\n\n The mailbox driver will not call `OnMessage` concurrently. It will wait\n for the previous call to complete before sending another message.\n\n If the client fails to respond to `OnMessage` in a timely manner, the\n mailbox driver may run out of memory and drop subsequent messages.\n\n `lease` is an optional wake lease baton passed by the mailbox driver when\n the message caused or arrived during a wake event, keeping the system\n awake until the listener has handled the message (or acquired its own\n wake lease).\n"]
1705 fn on_message(
1706 &mut self,
1707
1708 request: ::fidl_next::Request<listener::OnMessage, ___T>,
1709
1710 responder: ::fidl_next::Responder<listener::OnMessage, ___T>,
1711 ) -> impl ::core::future::Future<Output = ()>;
1712
1713 #[doc = " Called when a request is received on the mailbox channel.\n\n The client should process the request and return the response payload based\n on what was requested. The response will be returned to the remote core by\n the mailbox driver.\n\n If the listener returns an error, the error is logged by the mailbox driver\n and no response is returned to the remote core.\n\n The same concurrency rules as `OnMessage` apply.\n\n `lease` is an optional wake lease baton with the same semantics as in\n `OnMessage`.\n"]
1714 fn on_request(
1715 &mut self,
1716
1717 request: ::fidl_next::Request<listener::OnRequest, ___T>,
1718
1719 responder: ::fidl_next::Responder<listener::OnRequest, ___T>,
1720 ) -> impl ::core::future::Future<Output = ()>;
1721
1722 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1723 ::core::future::ready(())
1724 }
1725}
1726
1727impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Listener
1728where
1729 ___H: ListenerLocalServerHandler<___T>,
1730 ___T: ::fidl_next::Transport,
1731 for<'de> crate::wire::ListenerOnMessageRequest<'de>: ::fidl_next::Decode<
1732 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1733 Constraint = (),
1734 >,
1735 for<'de> crate::wire::ListenerOnRequestRequest<'de>: ::fidl_next::Decode<
1736 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1737 Constraint = (),
1738 >,
1739{
1740 async fn on_one_way(
1741 handler: &mut ___H,
1742 mut message: ::fidl_next::Message<___T>,
1743 ) -> ::core::result::Result<
1744 (),
1745 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1746 > {
1747 match *message.header().ordinal {
1748 ordinal => {
1749 handler.on_unknown_interaction(ordinal).await;
1750 if ::core::matches!(
1751 message.header().flexibility(),
1752 ::fidl_next::protocol::Flexibility::Strict
1753 ) {
1754 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1755 } else {
1756 Ok(())
1757 }
1758 }
1759 }
1760 }
1761
1762 async fn on_two_way(
1763 handler: &mut ___H,
1764 mut message: ::fidl_next::Message<___T>,
1765 responder: ::fidl_next::protocol::Responder<___T>,
1766 ) -> ::core::result::Result<
1767 (),
1768 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1769 > {
1770 match *message.header().ordinal {
1771 3132544944554375052 => {
1772 let responder = ::fidl_next::Responder::from_untyped(responder);
1773
1774 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1775 Ok(decoded) => {
1776 handler
1777 .on_message(::fidl_next::Request::from_decoded(decoded), responder)
1778 .await;
1779 Ok(())
1780 }
1781 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1782 ordinal: 3132544944554375052,
1783 error,
1784 }),
1785 }
1786 }
1787
1788 6226805799602931743 => {
1789 let responder = ::fidl_next::Responder::from_untyped(responder);
1790
1791 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1792 Ok(decoded) => {
1793 handler
1794 .on_request(::fidl_next::Request::from_decoded(decoded), responder)
1795 .await;
1796 Ok(())
1797 }
1798 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1799 ordinal: 6226805799602931743,
1800 error,
1801 }),
1802 }
1803 }
1804
1805 ordinal => {
1806 handler.on_unknown_interaction(ordinal).await;
1807 if ::core::matches!(
1808 message.header().flexibility(),
1809 ::fidl_next::protocol::Flexibility::Strict
1810 ) {
1811 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1812 } else {
1813 responder
1814 .respond_framework_error(
1815 ordinal,
1816 ::fidl_next::FrameworkError::UnknownMethod,
1817 )
1818 .expect("encoding a framework error should never fail")
1819 .await?;
1820 Ok(())
1821 }
1822 }
1823 }
1824 }
1825}
1826
1827pub trait ListenerClientHandler<
1831 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1832 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1833>
1834{
1835 fn on_unknown_interaction(
1836 &mut self,
1837 ordinal: u64,
1838 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1839 ::core::future::ready(())
1840 }
1841}
1842
1843impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Listener
1844where
1845 ___H: ListenerClientHandler<___T> + ::core::marker::Send,
1846 ___T: ::fidl_next::Transport,
1847{
1848 async fn on_event(
1849 handler: &mut ___H,
1850 mut message: ::fidl_next::Message<___T>,
1851 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1852 match *message.header().ordinal {
1853 ordinal => {
1854 handler.on_unknown_interaction(ordinal).await;
1855 if ::core::matches!(
1856 message.header().flexibility(),
1857 ::fidl_next::protocol::Flexibility::Strict
1858 ) {
1859 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1860 } else {
1861 Ok(())
1862 }
1863 }
1864 }
1865 }
1866}
1867
1868pub trait ListenerServerHandler<
1872 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1873 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1874>
1875{
1876 #[doc = " Called when a message is received on the mailbox channel.\n\n The mailbox driver will not call `OnMessage` concurrently. It will wait\n for the previous call to complete before sending another message.\n\n If the client fails to respond to `OnMessage` in a timely manner, the\n mailbox driver may run out of memory and drop subsequent messages.\n\n `lease` is an optional wake lease baton passed by the mailbox driver when\n the message caused or arrived during a wake event, keeping the system\n awake until the listener has handled the message (or acquired its own\n wake lease).\n"]
1877 fn on_message(
1878 &mut self,
1879
1880 request: ::fidl_next::Request<listener::OnMessage, ___T>,
1881
1882 responder: ::fidl_next::Responder<listener::OnMessage, ___T>,
1883 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1884
1885 #[doc = " Called when a request is received on the mailbox channel.\n\n The client should process the request and return the response payload based\n on what was requested. The response will be returned to the remote core by\n the mailbox driver.\n\n If the listener returns an error, the error is logged by the mailbox driver\n and no response is returned to the remote core.\n\n The same concurrency rules as `OnMessage` apply.\n\n `lease` is an optional wake lease baton with the same semantics as in\n `OnMessage`.\n"]
1886 fn on_request(
1887 &mut self,
1888
1889 request: ::fidl_next::Request<listener::OnRequest, ___T>,
1890
1891 responder: ::fidl_next::Responder<listener::OnRequest, ___T>,
1892 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1893
1894 fn on_unknown_interaction(
1895 &mut self,
1896 ordinal: u64,
1897 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1898 ::core::future::ready(())
1899 }
1900}
1901
1902impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Listener
1903where
1904 ___H: ListenerServerHandler<___T> + ::core::marker::Send,
1905 ___T: ::fidl_next::Transport,
1906 for<'de> crate::wire::ListenerOnMessageRequest<'de>: ::fidl_next::Decode<
1907 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1908 Constraint = (),
1909 >,
1910 for<'de> crate::wire::ListenerOnRequestRequest<'de>: ::fidl_next::Decode<
1911 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1912 Constraint = (),
1913 >,
1914{
1915 async fn on_one_way(
1916 handler: &mut ___H,
1917 mut message: ::fidl_next::Message<___T>,
1918 ) -> ::core::result::Result<
1919 (),
1920 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1921 > {
1922 match *message.header().ordinal {
1923 ordinal => {
1924 handler.on_unknown_interaction(ordinal).await;
1925 if ::core::matches!(
1926 message.header().flexibility(),
1927 ::fidl_next::protocol::Flexibility::Strict
1928 ) {
1929 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1930 } else {
1931 Ok(())
1932 }
1933 }
1934 }
1935 }
1936
1937 async fn on_two_way(
1938 handler: &mut ___H,
1939 mut message: ::fidl_next::Message<___T>,
1940 responder: ::fidl_next::protocol::Responder<___T>,
1941 ) -> ::core::result::Result<
1942 (),
1943 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1944 > {
1945 match *message.header().ordinal {
1946 3132544944554375052 => {
1947 let responder = ::fidl_next::Responder::from_untyped(responder);
1948
1949 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1950 Ok(decoded) => {
1951 handler
1952 .on_message(::fidl_next::Request::from_decoded(decoded), responder)
1953 .await;
1954 Ok(())
1955 }
1956 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1957 ordinal: 3132544944554375052,
1958 error,
1959 }),
1960 }
1961 }
1962
1963 6226805799602931743 => {
1964 let responder = ::fidl_next::Responder::from_untyped(responder);
1965
1966 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1967 Ok(decoded) => {
1968 handler
1969 .on_request(::fidl_next::Request::from_decoded(decoded), responder)
1970 .await;
1971 Ok(())
1972 }
1973 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1974 ordinal: 6226805799602931743,
1975 error,
1976 }),
1977 }
1978 }
1979
1980 ordinal => {
1981 handler.on_unknown_interaction(ordinal).await;
1982 if ::core::matches!(
1983 message.header().flexibility(),
1984 ::fidl_next::protocol::Flexibility::Strict
1985 ) {
1986 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1987 } else {
1988 responder
1989 .respond_framework_error(
1990 ordinal,
1991 ::fidl_next::FrameworkError::UnknownMethod,
1992 )
1993 .expect("encoding a framework error should never fail")
1994 .await?;
1995 Ok(())
1996 }
1997 }
1998 }
1999 }
2000}
2001
2002impl<___T> ListenerClientHandler<___T> for ::fidl_next::IgnoreEvents
2003where
2004 ___T: ::fidl_next::Transport,
2005{
2006 async fn on_unknown_interaction(&mut self, _: u64) {}
2007}
2008
2009impl<___H, ___T> ListenerLocalClientHandler<___T> for ::fidl_next::Local<___H>
2010where
2011 ___H: ListenerClientHandler<___T>,
2012 ___T: ::fidl_next::Transport,
2013{
2014 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2015 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2016 }
2017}
2018
2019impl<___H, ___T> ListenerLocalServerHandler<___T> for ::fidl_next::Local<___H>
2020where
2021 ___H: ListenerServerHandler<___T>,
2022 ___T: ::fidl_next::Transport,
2023{
2024 async fn on_message(
2025 &mut self,
2026
2027 request: ::fidl_next::Request<listener::OnMessage, ___T>,
2028
2029 responder: ::fidl_next::Responder<listener::OnMessage, ___T>,
2030 ) {
2031 ___H::on_message(&mut self.0, request, responder).await
2032 }
2033
2034 async fn on_request(
2035 &mut self,
2036
2037 request: ::fidl_next::Request<listener::OnRequest, ___T>,
2038
2039 responder: ::fidl_next::Responder<listener::OnRequest, ___T>,
2040 ) {
2041 ___H::on_request(&mut self.0, request, responder).await
2042 }
2043
2044 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2045 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2046 }
2047}
2048
2049#[derive(Debug)]
2051pub struct Service;
2052
2053impl ::fidl_next::DiscoverableService for Service {
2054 const SERVICE_NAME: &'static str = "fuchsia.hardware.mailbox.Service";
2055 const MEMBER_NAMES: &'static [&'static str] = &["channel"];
2056}
2057
2058impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for Service {}
2059
2060impl<___C> ::fidl_next::Service<___C> for Service
2061where
2062 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2063{
2064 type Connector = ServiceConnector<___C>;
2065}
2066
2067#[repr(transparent)]
2069pub struct ServiceConnector<___C> {
2070 #[allow(dead_code)]
2071 connector: ___C,
2072}
2073
2074impl<___C> ServiceConnector<___C>
2075where
2076 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2077{
2078 pub fn channel(
2080 &self,
2081 server_end: ::fidl_next::ServerEnd<crate::Channel, ::fidl_next::fuchsia::zx::Channel>,
2082 ) -> ::core::result::Result<
2083 (),
2084 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2085 > {
2086 ::fidl_next::protocol::ServiceConnector::<
2087 ::fidl_next::fuchsia::zx::Channel
2088 >::connect_to_member(
2089 &self.connector,
2090 "channel",
2091 server_end.into_untyped(),
2092 )
2093 }
2094}
2095
2096pub trait ServiceHandler {
2098 fn channel(
2100 &self,
2101 server_end: ::fidl_next::ServerEnd<crate::Channel, ::fidl_next::fuchsia::zx::Channel>,
2102 );
2103}
2104
2105impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for Service
2106where
2107 ___H: ServiceHandler,
2108 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2109{
2110 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2111 use ::fidl_next::InstanceFromServiceTransport;
2112 match member {
2113 "channel" => handler.channel(::fidl_next::ServerEnd::from_untyped(
2114 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2115 )),
2116
2117 _ => unreachable!(),
2118 }
2119 }
2120}
2121
2122pub use fidl_next_common_fuchsia_hardware_mailbox::*;