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 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::ChannelRegisterListenerRequest, ___E>
592 for &'a ChannelRegisterListenerRequest<T0>
593 where
594 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
595 ___E: ::fidl_next::fuchsia::HandleEncoder,
596 &'a T0: ::fidl_next::Encode<
597 ::fidl_next::ClientEnd<crate::Listener, ::fidl_next::wire::fuchsia::Channel>,
598 ___E,
599 >,
600 {
601 #[inline]
602 fn encode(
603 self,
604 encoder_: &mut ___E,
605 out_: &mut ::core::mem::MaybeUninit<crate::wire::ChannelRegisterListenerRequest>,
606 _: (),
607 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
608 ::fidl_next::munge! {
609 let crate::wire::ChannelRegisterListenerRequest {
610 listener,
611
612 } = out_;
613 }
614
615 ::fidl_next::Encode::encode(&self.listener, encoder_, listener, ())?;
616
617 Ok(())
618 }
619 }
620
621 pub struct ListenerOnMessageRequest<T0, T1> {
623 pub message: T0,
624
625 pub lease: T1,
626 }
627
628 unsafe impl<___E, T0, T1>
629 ::fidl_next::Encode<crate::wire::ListenerOnMessageRequest<'static>, ___E>
630 for ListenerOnMessageRequest<T0, T1>
631 where
632 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
633 ___E: ::fidl_next::Encoder,
634 ___E: ::fidl_next::fuchsia::HandleEncoder,
635 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
636 T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
637 {
638 #[inline]
639 fn encode(
640 self,
641 encoder_: &mut ___E,
642 out_: &mut ::core::mem::MaybeUninit<crate::wire::ListenerOnMessageRequest<'static>>,
643 _: (),
644 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
645 ::fidl_next::munge! {
646 let crate::wire::ListenerOnMessageRequest {
647 message,
648 lease,
649
650 } = out_;
651 }
652
653 ::fidl_next::Encode::encode(self.message, encoder_, message, (4294967295, ()))?;
654
655 ::fidl_next::Encode::encode(self.lease, encoder_, lease, ())?;
656
657 Ok(())
658 }
659 }
660
661 unsafe impl<'a, ___E, T0, T1>
662 ::fidl_next::Encode<crate::wire::ListenerOnMessageRequest<'static>, ___E>
663 for &'a ListenerOnMessageRequest<T0, T1>
664 where
665 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
666 ___E: ::fidl_next::Encoder,
667 ___E: ::fidl_next::fuchsia::HandleEncoder,
668 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
669 &'a T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
670 {
671 #[inline]
672 fn encode(
673 self,
674 encoder_: &mut ___E,
675 out_: &mut ::core::mem::MaybeUninit<crate::wire::ListenerOnMessageRequest<'static>>,
676 _: (),
677 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
678 ::fidl_next::munge! {
679 let crate::wire::ListenerOnMessageRequest {
680 message,
681 lease,
682
683 } = out_;
684 }
685
686 ::fidl_next::Encode::encode(&self.message, encoder_, message, (4294967295, ()))?;
687
688 ::fidl_next::Encode::encode(&self.lease, encoder_, lease, ())?;
689
690 Ok(())
691 }
692 }
693
694 pub struct ListenerOnRequestRequest<T0, T1> {
696 pub message: T0,
697
698 pub lease: T1,
699 }
700
701 unsafe impl<___E, T0, T1>
702 ::fidl_next::Encode<crate::wire::ListenerOnRequestRequest<'static>, ___E>
703 for ListenerOnRequestRequest<T0, T1>
704 where
705 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
706 ___E: ::fidl_next::Encoder,
707 ___E: ::fidl_next::fuchsia::HandleEncoder,
708 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
709 T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
710 {
711 #[inline]
712 fn encode(
713 self,
714 encoder_: &mut ___E,
715 out_: &mut ::core::mem::MaybeUninit<crate::wire::ListenerOnRequestRequest<'static>>,
716 _: (),
717 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
718 ::fidl_next::munge! {
719 let crate::wire::ListenerOnRequestRequest {
720 message,
721 lease,
722
723 } = out_;
724 }
725
726 ::fidl_next::Encode::encode(self.message, encoder_, message, (4294967295, ()))?;
727
728 ::fidl_next::Encode::encode(self.lease, encoder_, lease, ())?;
729
730 Ok(())
731 }
732 }
733
734 unsafe impl<'a, ___E, T0, T1>
735 ::fidl_next::Encode<crate::wire::ListenerOnRequestRequest<'static>, ___E>
736 for &'a ListenerOnRequestRequest<T0, T1>
737 where
738 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
739 ___E: ::fidl_next::Encoder,
740 ___E: ::fidl_next::fuchsia::HandleEncoder,
741 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
742 &'a T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
743 {
744 #[inline]
745 fn encode(
746 self,
747 encoder_: &mut ___E,
748 out_: &mut ::core::mem::MaybeUninit<crate::wire::ListenerOnRequestRequest<'static>>,
749 _: (),
750 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
751 ::fidl_next::munge! {
752 let crate::wire::ListenerOnRequestRequest {
753 message,
754 lease,
755
756 } = out_;
757 }
758
759 ::fidl_next::Encode::encode(&self.message, encoder_, message, (4294967295, ()))?;
760
761 ::fidl_next::Encode::encode(&self.lease, encoder_, lease, ())?;
762
763 Ok(())
764 }
765 }
766}
767
768pub use self::natural::*;
769
770#[doc = " `Channel` represents a single mailbox channel that can be used to send messages to a\n destination core.\n"]
772#[derive(PartialEq, Debug)]
773pub struct Channel;
774
775impl ::fidl_next::Discoverable for Channel {
776 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.mailbox.Channel";
777}
778
779#[cfg(target_os = "fuchsia")]
780impl ::fidl_next::HasTransport for Channel {
781 type Transport = ::fidl_next::fuchsia::zx::Channel;
782}
783
784pub mod channel {
785 pub mod prelude {
786 pub use crate::{
787 Channel, ChannelClientHandler, ChannelLocalClientHandler, ChannelLocalServerHandler,
788 ChannelServerHandler, channel,
789 };
790
791 pub use crate::natural::ChannelRegisterListenerRequest;
792
793 pub use crate::natural::ChannelSendMessageRequest;
794
795 pub use crate::natural::ChannelSendRequestRequest;
796
797 pub use crate::natural::ChannelRegisterListenerResponse;
798
799 pub use crate::natural::ChannelSendMessageResponse;
800
801 pub use crate::natural::ChannelSendRequestResponse;
802 }
803
804 pub struct SendMessage;
805
806 impl ::fidl_next::Method for SendMessage {
807 const ORDINAL: u64 = 6704182562539000811;
808 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
809 ::fidl_next::protocol::Flexibility::Strict;
810
811 type Protocol = crate::Channel;
812
813 type Request = crate::wire::ChannelSendMessageRequest<'static>;
814 }
815
816 impl ::fidl_next::TwoWayMethod for SendMessage {
817 type Response = ::fidl_next::wire::Result<
818 'static,
819 crate::wire::ChannelSendMessageResponse,
820 ::fidl_next::wire::fuchsia::Status,
821 >;
822 }
823
824 impl<___R> ::fidl_next::Respond<___R> for SendMessage {
825 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
826
827 fn respond(response: ___R) -> Self::Output {
828 ::core::result::Result::Ok(response)
829 }
830 }
831
832 impl<___R> ::fidl_next::RespondErr<___R> for SendMessage {
833 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
834
835 fn respond_err(response: ___R) -> Self::Output {
836 ::core::result::Result::Err(response)
837 }
838 }
839
840 pub struct SendRequest;
841
842 impl ::fidl_next::Method for SendRequest {
843 const ORDINAL: u64 = 8628593229059937179;
844 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
845 ::fidl_next::protocol::Flexibility::Flexible;
846
847 type Protocol = crate::Channel;
848
849 type Request = crate::wire::ChannelSendRequestRequest<'static>;
850 }
851
852 impl ::fidl_next::TwoWayMethod for SendRequest {
853 type Response = ::fidl_next::wire::Result<
854 'static,
855 crate::wire::ChannelSendRequestResponse<'static>,
856 ::fidl_next::wire::fuchsia::Status,
857 >;
858 }
859
860 impl<___R> ::fidl_next::Respond<___R> for SendRequest {
861 type Output = ::core::result::Result<
862 crate::generic::ChannelSendRequestResponse<___R>,
863 ::fidl_next::never::Never,
864 >;
865
866 fn respond(response: ___R) -> Self::Output {
867 ::core::result::Result::Ok(crate::generic::ChannelSendRequestResponse {
868 response: response,
869 })
870 }
871 }
872
873 impl<___R> ::fidl_next::RespondErr<___R> for SendRequest {
874 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
875
876 fn respond_err(response: ___R) -> Self::Output {
877 ::core::result::Result::Err(response)
878 }
879 }
880
881 pub struct RegisterListener;
882
883 impl ::fidl_next::Method for RegisterListener {
884 const ORDINAL: u64 = 7770453825026299131;
885 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
886 ::fidl_next::protocol::Flexibility::Flexible;
887
888 type Protocol = crate::Channel;
889
890 type Request = crate::wire::ChannelRegisterListenerRequest;
891 }
892
893 impl ::fidl_next::TwoWayMethod for RegisterListener {
894 type Response = ::fidl_next::wire::Result<
895 'static,
896 crate::wire::ChannelRegisterListenerResponse,
897 ::fidl_next::wire::fuchsia::Status,
898 >;
899 }
900
901 impl<___R> ::fidl_next::Respond<___R> for RegisterListener {
902 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
903
904 fn respond(response: ___R) -> Self::Output {
905 ::core::result::Result::Ok(response)
906 }
907 }
908
909 impl<___R> ::fidl_next::RespondErr<___R> for RegisterListener {
910 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
911
912 fn respond_err(response: ___R) -> Self::Output {
913 ::core::result::Result::Err(response)
914 }
915 }
916
917 mod ___detail {
918 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Channel
919 where
920 ___T: ::fidl_next::Transport,
921 {
922 type Client = ChannelClient<___T>;
923 type Server = ChannelServer<___T>;
924 }
925
926 #[repr(transparent)]
928 pub struct ChannelClient<___T: ::fidl_next::Transport> {
929 #[allow(dead_code)]
930 client: ::fidl_next::protocol::Client<___T>,
931 }
932
933 impl<___T> ChannelClient<___T>
934 where
935 ___T: ::fidl_next::Transport,
936 {
937 #[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"]
938 pub fn send_message(
939 &self,
940
941 message: impl ::fidl_next::Encode<
942 ::fidl_next::wire::Vector<'static, u8>,
943 <___T as ::fidl_next::Transport>::SendBuffer,
944 >,
945 ) -> ::fidl_next::TwoWayFuture<'_, super::SendMessage, ___T>
946 where
947 <___T as ::fidl_next::Transport>::SendBuffer:
948 ::fidl_next::encoder::InternalHandleEncoder,
949 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
950 {
951 self.send_message_with(crate::generic::ChannelSendMessageRequest { message })
952 }
953
954 #[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"]
955 pub fn send_message_with<___R>(
956 &self,
957 request: ___R,
958 ) -> ::fidl_next::TwoWayFuture<'_, super::SendMessage, ___T>
959 where
960 ___R: ::fidl_next::Encode<
961 crate::wire::ChannelSendMessageRequest<'static>,
962 <___T as ::fidl_next::Transport>::SendBuffer,
963 >,
964 {
965 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
966 6704182562539000811,
967 <super::SendMessage as ::fidl_next::Method>::FLEXIBILITY,
968 request,
969 ))
970 }
971
972 #[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"]
973 pub fn send_request(
974 &self,
975
976 request: impl ::fidl_next::Encode<
977 ::fidl_next::wire::Vector<'static, u8>,
978 <___T as ::fidl_next::Transport>::SendBuffer,
979 >,
980 ) -> ::fidl_next::TwoWayFuture<'_, super::SendRequest, ___T>
981 where
982 <___T as ::fidl_next::Transport>::SendBuffer:
983 ::fidl_next::encoder::InternalHandleEncoder,
984 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
985 {
986 self.send_request_with(crate::generic::ChannelSendRequestRequest { request })
987 }
988
989 #[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"]
990 pub fn send_request_with<___R>(
991 &self,
992 request: ___R,
993 ) -> ::fidl_next::TwoWayFuture<'_, super::SendRequest, ___T>
994 where
995 ___R: ::fidl_next::Encode<
996 crate::wire::ChannelSendRequestRequest<'static>,
997 <___T as ::fidl_next::Transport>::SendBuffer,
998 >,
999 {
1000 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1001 8628593229059937179,
1002 <super::SendRequest as ::fidl_next::Method>::FLEXIBILITY,
1003 request,
1004 ))
1005 }
1006
1007 #[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"]
1008 pub fn register_listener(
1009 &self,
1010
1011 listener: impl ::fidl_next::Encode<
1012 ::fidl_next::ClientEnd<crate::Listener, ::fidl_next::wire::fuchsia::Channel>,
1013 <___T as ::fidl_next::Transport>::SendBuffer,
1014 >,
1015 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterListener, ___T>
1016 where
1017 <___T as ::fidl_next::Transport>::SendBuffer:
1018 ::fidl_next::encoder::InternalHandleEncoder,
1019 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1020 {
1021 self.register_listener_with(crate::generic::ChannelRegisterListenerRequest {
1022 listener,
1023 })
1024 }
1025
1026 #[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"]
1027 pub fn register_listener_with<___R>(
1028 &self,
1029 request: ___R,
1030 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterListener, ___T>
1031 where
1032 ___R: ::fidl_next::Encode<
1033 crate::wire::ChannelRegisterListenerRequest,
1034 <___T as ::fidl_next::Transport>::SendBuffer,
1035 >,
1036 {
1037 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1038 7770453825026299131,
1039 <super::RegisterListener as ::fidl_next::Method>::FLEXIBILITY,
1040 request,
1041 ))
1042 }
1043 }
1044
1045 #[repr(transparent)]
1047 pub struct ChannelServer<___T: ::fidl_next::Transport> {
1048 server: ::fidl_next::protocol::Server<___T>,
1049 }
1050
1051 impl<___T> ChannelServer<___T> where ___T: ::fidl_next::Transport {}
1052 }
1053}
1054
1055#[diagnostic::on_unimplemented(
1056 note = "If {Self} implements the non-local ChannelClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1057)]
1058
1059pub trait ChannelLocalClientHandler<
1063 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1064 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1065>
1066{
1067 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1068 ::core::future::ready(())
1069 }
1070}
1071
1072impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Channel
1073where
1074 ___H: ChannelLocalClientHandler<___T>,
1075 ___T: ::fidl_next::Transport,
1076{
1077 async fn on_event(
1078 handler: &mut ___H,
1079 mut message: ::fidl_next::Message<___T>,
1080 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1081 match *message.header().ordinal {
1082 ordinal => {
1083 handler.on_unknown_interaction(ordinal).await;
1084 if ::core::matches!(
1085 message.header().flexibility(),
1086 ::fidl_next::protocol::Flexibility::Strict
1087 ) {
1088 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1089 } else {
1090 Ok(())
1091 }
1092 }
1093 }
1094 }
1095}
1096
1097#[diagnostic::on_unimplemented(
1098 note = "If {Self} implements the non-local ChannelServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1099)]
1100
1101pub trait ChannelLocalServerHandler<
1105 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1106 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1107>
1108{
1109 #[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"]
1110 fn send_message(
1111 &mut self,
1112
1113 request: ::fidl_next::Request<channel::SendMessage, ___T>,
1114
1115 responder: ::fidl_next::Responder<channel::SendMessage, ___T>,
1116 ) -> impl ::core::future::Future<Output = ()>;
1117
1118 #[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"]
1119 fn send_request(
1120 &mut self,
1121
1122 request: ::fidl_next::Request<channel::SendRequest, ___T>,
1123
1124 responder: ::fidl_next::Responder<channel::SendRequest, ___T>,
1125 ) -> impl ::core::future::Future<Output = ()>;
1126
1127 #[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"]
1128 fn register_listener(
1129 &mut self,
1130
1131 request: ::fidl_next::Request<channel::RegisterListener, ___T>,
1132
1133 responder: ::fidl_next::Responder<channel::RegisterListener, ___T>,
1134 ) -> impl ::core::future::Future<Output = ()>;
1135
1136 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1137 ::core::future::ready(())
1138 }
1139}
1140
1141impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Channel
1142where
1143 ___H: ChannelLocalServerHandler<___T>,
1144 ___T: ::fidl_next::Transport,
1145 for<'de> crate::wire::ChannelSendMessageRequest<'de>: ::fidl_next::Decode<
1146 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1147 Constraint = (),
1148 >,
1149 for<'de> crate::wire::ChannelSendRequestRequest<'de>: ::fidl_next::Decode<
1150 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1151 Constraint = (),
1152 >,
1153 for<'de> crate::wire::ChannelRegisterListenerRequest: ::fidl_next::Decode<
1154 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1155 Constraint = (),
1156 >,
1157{
1158 async fn on_one_way(
1159 handler: &mut ___H,
1160 mut message: ::fidl_next::Message<___T>,
1161 ) -> ::core::result::Result<
1162 (),
1163 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1164 > {
1165 match *message.header().ordinal {
1166 ordinal => {
1167 handler.on_unknown_interaction(ordinal).await;
1168 if ::core::matches!(
1169 message.header().flexibility(),
1170 ::fidl_next::protocol::Flexibility::Strict
1171 ) {
1172 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1173 } else {
1174 Ok(())
1175 }
1176 }
1177 }
1178 }
1179
1180 async fn on_two_way(
1181 handler: &mut ___H,
1182 mut message: ::fidl_next::Message<___T>,
1183 responder: ::fidl_next::protocol::Responder<___T>,
1184 ) -> ::core::result::Result<
1185 (),
1186 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1187 > {
1188 match *message.header().ordinal {
1189 6704182562539000811 => {
1190 let responder = ::fidl_next::Responder::from_untyped(responder);
1191
1192 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1193 Ok(decoded) => {
1194 handler
1195 .send_message(::fidl_next::Request::from_decoded(decoded), responder)
1196 .await;
1197 Ok(())
1198 }
1199 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1200 ordinal: 6704182562539000811,
1201 error,
1202 }),
1203 }
1204 }
1205
1206 8628593229059937179 => {
1207 let responder = ::fidl_next::Responder::from_untyped(responder);
1208
1209 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1210 Ok(decoded) => {
1211 handler
1212 .send_request(::fidl_next::Request::from_decoded(decoded), responder)
1213 .await;
1214 Ok(())
1215 }
1216 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1217 ordinal: 8628593229059937179,
1218 error,
1219 }),
1220 }
1221 }
1222
1223 7770453825026299131 => {
1224 let responder = ::fidl_next::Responder::from_untyped(responder);
1225
1226 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1227 Ok(decoded) => {
1228 handler
1229 .register_listener(
1230 ::fidl_next::Request::from_decoded(decoded),
1231 responder,
1232 )
1233 .await;
1234 Ok(())
1235 }
1236 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1237 ordinal: 7770453825026299131,
1238 error,
1239 }),
1240 }
1241 }
1242
1243 ordinal => {
1244 handler.on_unknown_interaction(ordinal).await;
1245 if ::core::matches!(
1246 message.header().flexibility(),
1247 ::fidl_next::protocol::Flexibility::Strict
1248 ) {
1249 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1250 } else {
1251 responder
1252 .respond_framework_error(
1253 ordinal,
1254 ::fidl_next::FrameworkError::UnknownMethod,
1255 )
1256 .expect("encoding a framework error should never fail")
1257 .await?;
1258 Ok(())
1259 }
1260 }
1261 }
1262 }
1263}
1264
1265pub trait ChannelClientHandler<
1269 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1270 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1271>
1272{
1273 fn on_unknown_interaction(
1274 &mut self,
1275 ordinal: u64,
1276 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1277 ::core::future::ready(())
1278 }
1279}
1280
1281impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Channel
1282where
1283 ___H: ChannelClientHandler<___T> + ::core::marker::Send,
1284 ___T: ::fidl_next::Transport,
1285{
1286 async fn on_event(
1287 handler: &mut ___H,
1288 mut message: ::fidl_next::Message<___T>,
1289 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1290 match *message.header().ordinal {
1291 ordinal => {
1292 handler.on_unknown_interaction(ordinal).await;
1293 if ::core::matches!(
1294 message.header().flexibility(),
1295 ::fidl_next::protocol::Flexibility::Strict
1296 ) {
1297 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1298 } else {
1299 Ok(())
1300 }
1301 }
1302 }
1303 }
1304}
1305
1306pub trait ChannelServerHandler<
1310 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1311 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1312>
1313{
1314 #[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"]
1315 fn send_message(
1316 &mut self,
1317
1318 request: ::fidl_next::Request<channel::SendMessage, ___T>,
1319
1320 responder: ::fidl_next::Responder<channel::SendMessage, ___T>,
1321 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1322
1323 #[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"]
1324 fn send_request(
1325 &mut self,
1326
1327 request: ::fidl_next::Request<channel::SendRequest, ___T>,
1328
1329 responder: ::fidl_next::Responder<channel::SendRequest, ___T>,
1330 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1331
1332 #[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"]
1333 fn register_listener(
1334 &mut self,
1335
1336 request: ::fidl_next::Request<channel::RegisterListener, ___T>,
1337
1338 responder: ::fidl_next::Responder<channel::RegisterListener, ___T>,
1339 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1340
1341 fn on_unknown_interaction(
1342 &mut self,
1343 ordinal: u64,
1344 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1345 ::core::future::ready(())
1346 }
1347}
1348
1349impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Channel
1350where
1351 ___H: ChannelServerHandler<___T> + ::core::marker::Send,
1352 ___T: ::fidl_next::Transport,
1353 for<'de> crate::wire::ChannelSendMessageRequest<'de>: ::fidl_next::Decode<
1354 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1355 Constraint = (),
1356 >,
1357 for<'de> crate::wire::ChannelSendRequestRequest<'de>: ::fidl_next::Decode<
1358 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1359 Constraint = (),
1360 >,
1361 for<'de> crate::wire::ChannelRegisterListenerRequest: ::fidl_next::Decode<
1362 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1363 Constraint = (),
1364 >,
1365{
1366 async fn on_one_way(
1367 handler: &mut ___H,
1368 mut message: ::fidl_next::Message<___T>,
1369 ) -> ::core::result::Result<
1370 (),
1371 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1372 > {
1373 match *message.header().ordinal {
1374 ordinal => {
1375 handler.on_unknown_interaction(ordinal).await;
1376 if ::core::matches!(
1377 message.header().flexibility(),
1378 ::fidl_next::protocol::Flexibility::Strict
1379 ) {
1380 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1381 } else {
1382 Ok(())
1383 }
1384 }
1385 }
1386 }
1387
1388 async fn on_two_way(
1389 handler: &mut ___H,
1390 mut message: ::fidl_next::Message<___T>,
1391 responder: ::fidl_next::protocol::Responder<___T>,
1392 ) -> ::core::result::Result<
1393 (),
1394 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1395 > {
1396 match *message.header().ordinal {
1397 6704182562539000811 => {
1398 let responder = ::fidl_next::Responder::from_untyped(responder);
1399
1400 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1401 Ok(decoded) => {
1402 handler
1403 .send_message(::fidl_next::Request::from_decoded(decoded), responder)
1404 .await;
1405 Ok(())
1406 }
1407 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1408 ordinal: 6704182562539000811,
1409 error,
1410 }),
1411 }
1412 }
1413
1414 8628593229059937179 => {
1415 let responder = ::fidl_next::Responder::from_untyped(responder);
1416
1417 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1418 Ok(decoded) => {
1419 handler
1420 .send_request(::fidl_next::Request::from_decoded(decoded), responder)
1421 .await;
1422 Ok(())
1423 }
1424 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1425 ordinal: 8628593229059937179,
1426 error,
1427 }),
1428 }
1429 }
1430
1431 7770453825026299131 => {
1432 let responder = ::fidl_next::Responder::from_untyped(responder);
1433
1434 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1435 Ok(decoded) => {
1436 handler
1437 .register_listener(
1438 ::fidl_next::Request::from_decoded(decoded),
1439 responder,
1440 )
1441 .await;
1442 Ok(())
1443 }
1444 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1445 ordinal: 7770453825026299131,
1446 error,
1447 }),
1448 }
1449 }
1450
1451 ordinal => {
1452 handler.on_unknown_interaction(ordinal).await;
1453 if ::core::matches!(
1454 message.header().flexibility(),
1455 ::fidl_next::protocol::Flexibility::Strict
1456 ) {
1457 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1458 } else {
1459 responder
1460 .respond_framework_error(
1461 ordinal,
1462 ::fidl_next::FrameworkError::UnknownMethod,
1463 )
1464 .expect("encoding a framework error should never fail")
1465 .await?;
1466 Ok(())
1467 }
1468 }
1469 }
1470 }
1471}
1472
1473impl<___T> ChannelClientHandler<___T> for ::fidl_next::IgnoreEvents
1474where
1475 ___T: ::fidl_next::Transport,
1476{
1477 async fn on_unknown_interaction(&mut self, _: u64) {}
1478}
1479
1480impl<___H, ___T> ChannelLocalClientHandler<___T> for ::fidl_next::Local<___H>
1481where
1482 ___H: ChannelClientHandler<___T>,
1483 ___T: ::fidl_next::Transport,
1484{
1485 async fn on_unknown_interaction(&mut self, ordinal: u64) {
1486 ___H::on_unknown_interaction(&mut self.0, ordinal).await
1487 }
1488}
1489
1490impl<___H, ___T> ChannelLocalServerHandler<___T> for ::fidl_next::Local<___H>
1491where
1492 ___H: ChannelServerHandler<___T>,
1493 ___T: ::fidl_next::Transport,
1494{
1495 async fn send_message(
1496 &mut self,
1497
1498 request: ::fidl_next::Request<channel::SendMessage, ___T>,
1499
1500 responder: ::fidl_next::Responder<channel::SendMessage, ___T>,
1501 ) {
1502 ___H::send_message(&mut self.0, request, responder).await
1503 }
1504
1505 async fn send_request(
1506 &mut self,
1507
1508 request: ::fidl_next::Request<channel::SendRequest, ___T>,
1509
1510 responder: ::fidl_next::Responder<channel::SendRequest, ___T>,
1511 ) {
1512 ___H::send_request(&mut self.0, request, responder).await
1513 }
1514
1515 async fn register_listener(
1516 &mut self,
1517
1518 request: ::fidl_next::Request<channel::RegisterListener, ___T>,
1519
1520 responder: ::fidl_next::Responder<channel::RegisterListener, ___T>,
1521 ) {
1522 ___H::register_listener(&mut self.0, request, responder).await
1523 }
1524
1525 async fn on_unknown_interaction(&mut self, ordinal: u64) {
1526 ___H::on_unknown_interaction(&mut self.0, ordinal).await
1527 }
1528}
1529
1530#[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"]
1532#[derive(PartialEq, Debug)]
1533pub struct Listener;
1534
1535#[cfg(target_os = "fuchsia")]
1536impl ::fidl_next::HasTransport for Listener {
1537 type Transport = ::fidl_next::fuchsia::zx::Channel;
1538}
1539
1540pub mod listener {
1541 pub mod prelude {
1542 pub use crate::{
1543 Listener, ListenerClientHandler, ListenerLocalClientHandler,
1544 ListenerLocalServerHandler, ListenerServerHandler, listener,
1545 };
1546
1547 pub use crate::natural::ListenerOnMessageRequest;
1548
1549 pub use crate::natural::ListenerOnRequestRequest;
1550
1551 pub use crate::natural::ListenerOnMessageResponse;
1552
1553 pub use crate::natural::ListenerOnRequestResponse;
1554 }
1555
1556 pub struct OnMessage;
1557
1558 impl ::fidl_next::Method for OnMessage {
1559 const ORDINAL: u64 = 3132544944554375052;
1560 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1561 ::fidl_next::protocol::Flexibility::Flexible;
1562
1563 type Protocol = crate::Listener;
1564
1565 type Request = crate::wire::ListenerOnMessageRequest<'static>;
1566 }
1567
1568 impl ::fidl_next::TwoWayMethod for OnMessage {
1569 type Response = ::fidl_next::wire::Result<
1570 'static,
1571 crate::wire::ListenerOnMessageResponse,
1572 ::fidl_next::wire::fuchsia::Status,
1573 >;
1574 }
1575
1576 impl<___R> ::fidl_next::Respond<___R> for OnMessage {
1577 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1578
1579 fn respond(response: ___R) -> Self::Output {
1580 ::core::result::Result::Ok(response)
1581 }
1582 }
1583
1584 impl<___R> ::fidl_next::RespondErr<___R> for OnMessage {
1585 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1586
1587 fn respond_err(response: ___R) -> Self::Output {
1588 ::core::result::Result::Err(response)
1589 }
1590 }
1591
1592 pub struct OnRequest;
1593
1594 impl ::fidl_next::Method for OnRequest {
1595 const ORDINAL: u64 = 6226805799602931743;
1596 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1597 ::fidl_next::protocol::Flexibility::Flexible;
1598
1599 type Protocol = crate::Listener;
1600
1601 type Request = crate::wire::ListenerOnRequestRequest<'static>;
1602 }
1603
1604 impl ::fidl_next::TwoWayMethod for OnRequest {
1605 type Response = ::fidl_next::wire::Result<
1606 'static,
1607 crate::wire::ListenerOnRequestResponse<'static>,
1608 ::fidl_next::wire::fuchsia::Status,
1609 >;
1610 }
1611
1612 impl<___R> ::fidl_next::Respond<___R> for OnRequest {
1613 type Output = ::core::result::Result<
1614 crate::generic::ListenerOnRequestResponse<___R>,
1615 ::fidl_next::never::Never,
1616 >;
1617
1618 fn respond(response: ___R) -> Self::Output {
1619 ::core::result::Result::Ok(crate::generic::ListenerOnRequestResponse {
1620 response: response,
1621 })
1622 }
1623 }
1624
1625 impl<___R> ::fidl_next::RespondErr<___R> for OnRequest {
1626 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1627
1628 fn respond_err(response: ___R) -> Self::Output {
1629 ::core::result::Result::Err(response)
1630 }
1631 }
1632
1633 mod ___detail {
1634 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Listener
1635 where
1636 ___T: ::fidl_next::Transport,
1637 {
1638 type Client = ListenerClient<___T>;
1639 type Server = ListenerServer<___T>;
1640 }
1641
1642 #[repr(transparent)]
1644 pub struct ListenerClient<___T: ::fidl_next::Transport> {
1645 #[allow(dead_code)]
1646 client: ::fidl_next::protocol::Client<___T>,
1647 }
1648
1649 impl<___T> ListenerClient<___T>
1650 where
1651 ___T: ::fidl_next::Transport,
1652 {
1653 #[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"]
1654 pub fn on_message(
1655 &self,
1656
1657 message: impl ::fidl_next::Encode<
1658 ::fidl_next::wire::Vector<'static, u8>,
1659 <___T as ::fidl_next::Transport>::SendBuffer,
1660 >,
1661
1662 lease: impl ::fidl_next::Encode<
1663 ::fidl_next::wire::fuchsia::OptionalEventPair,
1664 <___T as ::fidl_next::Transport>::SendBuffer,
1665 >,
1666 ) -> ::fidl_next::TwoWayFuture<'_, super::OnMessage, ___T>
1667 where
1668 <___T as ::fidl_next::Transport>::SendBuffer:
1669 ::fidl_next::encoder::InternalHandleEncoder,
1670 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1671 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1672 {
1673 self.on_message_with(crate::generic::ListenerOnMessageRequest { message, lease })
1674 }
1675
1676 #[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"]
1677 pub fn on_message_with<___R>(
1678 &self,
1679 request: ___R,
1680 ) -> ::fidl_next::TwoWayFuture<'_, super::OnMessage, ___T>
1681 where
1682 ___R: ::fidl_next::Encode<
1683 crate::wire::ListenerOnMessageRequest<'static>,
1684 <___T as ::fidl_next::Transport>::SendBuffer,
1685 >,
1686 {
1687 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1688 3132544944554375052,
1689 <super::OnMessage as ::fidl_next::Method>::FLEXIBILITY,
1690 request,
1691 ))
1692 }
1693
1694 #[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"]
1695 pub fn on_request(
1696 &self,
1697
1698 message: impl ::fidl_next::Encode<
1699 ::fidl_next::wire::Vector<'static, u8>,
1700 <___T as ::fidl_next::Transport>::SendBuffer,
1701 >,
1702
1703 lease: impl ::fidl_next::Encode<
1704 ::fidl_next::wire::fuchsia::OptionalEventPair,
1705 <___T as ::fidl_next::Transport>::SendBuffer,
1706 >,
1707 ) -> ::fidl_next::TwoWayFuture<'_, super::OnRequest, ___T>
1708 where
1709 <___T as ::fidl_next::Transport>::SendBuffer:
1710 ::fidl_next::encoder::InternalHandleEncoder,
1711 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1712 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1713 {
1714 self.on_request_with(crate::generic::ListenerOnRequestRequest { message, lease })
1715 }
1716
1717 #[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"]
1718 pub fn on_request_with<___R>(
1719 &self,
1720 request: ___R,
1721 ) -> ::fidl_next::TwoWayFuture<'_, super::OnRequest, ___T>
1722 where
1723 ___R: ::fidl_next::Encode<
1724 crate::wire::ListenerOnRequestRequest<'static>,
1725 <___T as ::fidl_next::Transport>::SendBuffer,
1726 >,
1727 {
1728 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1729 6226805799602931743,
1730 <super::OnRequest as ::fidl_next::Method>::FLEXIBILITY,
1731 request,
1732 ))
1733 }
1734 }
1735
1736 #[repr(transparent)]
1738 pub struct ListenerServer<___T: ::fidl_next::Transport> {
1739 server: ::fidl_next::protocol::Server<___T>,
1740 }
1741
1742 impl<___T> ListenerServer<___T> where ___T: ::fidl_next::Transport {}
1743 }
1744}
1745
1746#[diagnostic::on_unimplemented(
1747 note = "If {Self} implements the non-local ListenerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1748)]
1749
1750pub trait ListenerLocalClientHandler<
1754 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1755 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1756>
1757{
1758 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1759 ::core::future::ready(())
1760 }
1761}
1762
1763impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Listener
1764where
1765 ___H: ListenerLocalClientHandler<___T>,
1766 ___T: ::fidl_next::Transport,
1767{
1768 async fn on_event(
1769 handler: &mut ___H,
1770 mut message: ::fidl_next::Message<___T>,
1771 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1772 match *message.header().ordinal {
1773 ordinal => {
1774 handler.on_unknown_interaction(ordinal).await;
1775 if ::core::matches!(
1776 message.header().flexibility(),
1777 ::fidl_next::protocol::Flexibility::Strict
1778 ) {
1779 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1780 } else {
1781 Ok(())
1782 }
1783 }
1784 }
1785 }
1786}
1787
1788#[diagnostic::on_unimplemented(
1789 note = "If {Self} implements the non-local ListenerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1790)]
1791
1792pub trait ListenerLocalServerHandler<
1796 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1797 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1798>
1799{
1800 #[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"]
1801 fn on_message(
1802 &mut self,
1803
1804 request: ::fidl_next::Request<listener::OnMessage, ___T>,
1805
1806 responder: ::fidl_next::Responder<listener::OnMessage, ___T>,
1807 ) -> impl ::core::future::Future<Output = ()>;
1808
1809 #[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"]
1810 fn on_request(
1811 &mut self,
1812
1813 request: ::fidl_next::Request<listener::OnRequest, ___T>,
1814
1815 responder: ::fidl_next::Responder<listener::OnRequest, ___T>,
1816 ) -> impl ::core::future::Future<Output = ()>;
1817
1818 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1819 ::core::future::ready(())
1820 }
1821}
1822
1823impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Listener
1824where
1825 ___H: ListenerLocalServerHandler<___T>,
1826 ___T: ::fidl_next::Transport,
1827 for<'de> crate::wire::ListenerOnMessageRequest<'de>: ::fidl_next::Decode<
1828 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1829 Constraint = (),
1830 >,
1831 for<'de> crate::wire::ListenerOnRequestRequest<'de>: ::fidl_next::Decode<
1832 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1833 Constraint = (),
1834 >,
1835{
1836 async fn on_one_way(
1837 handler: &mut ___H,
1838 mut message: ::fidl_next::Message<___T>,
1839 ) -> ::core::result::Result<
1840 (),
1841 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1842 > {
1843 match *message.header().ordinal {
1844 ordinal => {
1845 handler.on_unknown_interaction(ordinal).await;
1846 if ::core::matches!(
1847 message.header().flexibility(),
1848 ::fidl_next::protocol::Flexibility::Strict
1849 ) {
1850 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1851 } else {
1852 Ok(())
1853 }
1854 }
1855 }
1856 }
1857
1858 async fn on_two_way(
1859 handler: &mut ___H,
1860 mut message: ::fidl_next::Message<___T>,
1861 responder: ::fidl_next::protocol::Responder<___T>,
1862 ) -> ::core::result::Result<
1863 (),
1864 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1865 > {
1866 match *message.header().ordinal {
1867 3132544944554375052 => {
1868 let responder = ::fidl_next::Responder::from_untyped(responder);
1869
1870 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1871 Ok(decoded) => {
1872 handler
1873 .on_message(::fidl_next::Request::from_decoded(decoded), responder)
1874 .await;
1875 Ok(())
1876 }
1877 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1878 ordinal: 3132544944554375052,
1879 error,
1880 }),
1881 }
1882 }
1883
1884 6226805799602931743 => {
1885 let responder = ::fidl_next::Responder::from_untyped(responder);
1886
1887 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1888 Ok(decoded) => {
1889 handler
1890 .on_request(::fidl_next::Request::from_decoded(decoded), responder)
1891 .await;
1892 Ok(())
1893 }
1894 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1895 ordinal: 6226805799602931743,
1896 error,
1897 }),
1898 }
1899 }
1900
1901 ordinal => {
1902 handler.on_unknown_interaction(ordinal).await;
1903 if ::core::matches!(
1904 message.header().flexibility(),
1905 ::fidl_next::protocol::Flexibility::Strict
1906 ) {
1907 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1908 } else {
1909 responder
1910 .respond_framework_error(
1911 ordinal,
1912 ::fidl_next::FrameworkError::UnknownMethod,
1913 )
1914 .expect("encoding a framework error should never fail")
1915 .await?;
1916 Ok(())
1917 }
1918 }
1919 }
1920 }
1921}
1922
1923pub trait ListenerClientHandler<
1927 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1928 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1929>
1930{
1931 fn on_unknown_interaction(
1932 &mut self,
1933 ordinal: u64,
1934 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1935 ::core::future::ready(())
1936 }
1937}
1938
1939impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Listener
1940where
1941 ___H: ListenerClientHandler<___T> + ::core::marker::Send,
1942 ___T: ::fidl_next::Transport,
1943{
1944 async fn on_event(
1945 handler: &mut ___H,
1946 mut message: ::fidl_next::Message<___T>,
1947 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1948 match *message.header().ordinal {
1949 ordinal => {
1950 handler.on_unknown_interaction(ordinal).await;
1951 if ::core::matches!(
1952 message.header().flexibility(),
1953 ::fidl_next::protocol::Flexibility::Strict
1954 ) {
1955 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1956 } else {
1957 Ok(())
1958 }
1959 }
1960 }
1961 }
1962}
1963
1964pub trait ListenerServerHandler<
1968 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1969 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1970>
1971{
1972 #[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"]
1973 fn on_message(
1974 &mut self,
1975
1976 request: ::fidl_next::Request<listener::OnMessage, ___T>,
1977
1978 responder: ::fidl_next::Responder<listener::OnMessage, ___T>,
1979 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1980
1981 #[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"]
1982 fn on_request(
1983 &mut self,
1984
1985 request: ::fidl_next::Request<listener::OnRequest, ___T>,
1986
1987 responder: ::fidl_next::Responder<listener::OnRequest, ___T>,
1988 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1989
1990 fn on_unknown_interaction(
1991 &mut self,
1992 ordinal: u64,
1993 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1994 ::core::future::ready(())
1995 }
1996}
1997
1998impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Listener
1999where
2000 ___H: ListenerServerHandler<___T> + ::core::marker::Send,
2001 ___T: ::fidl_next::Transport,
2002 for<'de> crate::wire::ListenerOnMessageRequest<'de>: ::fidl_next::Decode<
2003 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2004 Constraint = (),
2005 >,
2006 for<'de> crate::wire::ListenerOnRequestRequest<'de>: ::fidl_next::Decode<
2007 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2008 Constraint = (),
2009 >,
2010{
2011 async fn on_one_way(
2012 handler: &mut ___H,
2013 mut message: ::fidl_next::Message<___T>,
2014 ) -> ::core::result::Result<
2015 (),
2016 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2017 > {
2018 match *message.header().ordinal {
2019 ordinal => {
2020 handler.on_unknown_interaction(ordinal).await;
2021 if ::core::matches!(
2022 message.header().flexibility(),
2023 ::fidl_next::protocol::Flexibility::Strict
2024 ) {
2025 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2026 } else {
2027 Ok(())
2028 }
2029 }
2030 }
2031 }
2032
2033 async fn on_two_way(
2034 handler: &mut ___H,
2035 mut message: ::fidl_next::Message<___T>,
2036 responder: ::fidl_next::protocol::Responder<___T>,
2037 ) -> ::core::result::Result<
2038 (),
2039 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2040 > {
2041 match *message.header().ordinal {
2042 3132544944554375052 => {
2043 let responder = ::fidl_next::Responder::from_untyped(responder);
2044
2045 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2046 Ok(decoded) => {
2047 handler
2048 .on_message(::fidl_next::Request::from_decoded(decoded), responder)
2049 .await;
2050 Ok(())
2051 }
2052 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2053 ordinal: 3132544944554375052,
2054 error,
2055 }),
2056 }
2057 }
2058
2059 6226805799602931743 => {
2060 let responder = ::fidl_next::Responder::from_untyped(responder);
2061
2062 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2063 Ok(decoded) => {
2064 handler
2065 .on_request(::fidl_next::Request::from_decoded(decoded), responder)
2066 .await;
2067 Ok(())
2068 }
2069 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2070 ordinal: 6226805799602931743,
2071 error,
2072 }),
2073 }
2074 }
2075
2076 ordinal => {
2077 handler.on_unknown_interaction(ordinal).await;
2078 if ::core::matches!(
2079 message.header().flexibility(),
2080 ::fidl_next::protocol::Flexibility::Strict
2081 ) {
2082 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2083 } else {
2084 responder
2085 .respond_framework_error(
2086 ordinal,
2087 ::fidl_next::FrameworkError::UnknownMethod,
2088 )
2089 .expect("encoding a framework error should never fail")
2090 .await?;
2091 Ok(())
2092 }
2093 }
2094 }
2095 }
2096}
2097
2098impl<___T> ListenerClientHandler<___T> for ::fidl_next::IgnoreEvents
2099where
2100 ___T: ::fidl_next::Transport,
2101{
2102 async fn on_unknown_interaction(&mut self, _: u64) {}
2103}
2104
2105impl<___H, ___T> ListenerLocalClientHandler<___T> for ::fidl_next::Local<___H>
2106where
2107 ___H: ListenerClientHandler<___T>,
2108 ___T: ::fidl_next::Transport,
2109{
2110 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2111 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2112 }
2113}
2114
2115impl<___H, ___T> ListenerLocalServerHandler<___T> for ::fidl_next::Local<___H>
2116where
2117 ___H: ListenerServerHandler<___T>,
2118 ___T: ::fidl_next::Transport,
2119{
2120 async fn on_message(
2121 &mut self,
2122
2123 request: ::fidl_next::Request<listener::OnMessage, ___T>,
2124
2125 responder: ::fidl_next::Responder<listener::OnMessage, ___T>,
2126 ) {
2127 ___H::on_message(&mut self.0, request, responder).await
2128 }
2129
2130 async fn on_request(
2131 &mut self,
2132
2133 request: ::fidl_next::Request<listener::OnRequest, ___T>,
2134
2135 responder: ::fidl_next::Responder<listener::OnRequest, ___T>,
2136 ) {
2137 ___H::on_request(&mut self.0, request, responder).await
2138 }
2139
2140 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2141 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2142 }
2143}
2144
2145#[derive(Debug)]
2147pub struct Service;
2148
2149impl ::fidl_next::DiscoverableService for Service {
2150 const SERVICE_NAME: &'static str = "fuchsia.hardware.mailbox.Service";
2151 const MEMBER_NAMES: &'static [&'static str] = &["channel"];
2152}
2153
2154impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for Service {}
2155
2156impl<___C> ::fidl_next::Service<___C> for Service
2157where
2158 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2159{
2160 type Connector = ServiceConnector<___C>;
2161}
2162
2163#[repr(transparent)]
2165pub struct ServiceConnector<___C> {
2166 #[allow(dead_code)]
2167 connector: ___C,
2168}
2169
2170impl<___C> ServiceConnector<___C>
2171where
2172 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2173{
2174 pub fn channel(
2176 &self,
2177 server_end: ::fidl_next::ServerEnd<crate::Channel, ::fidl_next::fuchsia::zx::Channel>,
2178 ) -> ::core::result::Result<
2179 (),
2180 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2181 > {
2182 ::fidl_next::protocol::ServiceConnector::<
2183 ::fidl_next::fuchsia::zx::Channel
2184 >::connect_to_member(
2185 &self.connector,
2186 "channel",
2187 server_end.into_untyped(),
2188 )
2189 }
2190}
2191
2192pub trait ServiceHandler {
2194 fn channel(
2196 &self,
2197 server_end: ::fidl_next::ServerEnd<crate::Channel, ::fidl_next::fuchsia::zx::Channel>,
2198 );
2199}
2200
2201impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for Service
2202where
2203 ___H: ServiceHandler,
2204 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2205{
2206 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2207 use ::fidl_next::InstanceFromServiceTransport;
2208 match member {
2209 "channel" => handler.channel(::fidl_next::ServerEnd::from_untyped(
2210 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2211 )),
2212
2213 _ => unreachable!(),
2214 }
2215 }
2216}
2217
2218pub use fidl_next_common_fuchsia_hardware_mailbox::*;