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_spi::natural::*;
8
9 #[derive(Debug, PartialEq)]
10 #[repr(C)]
11 pub struct ControllerOpenSessionRequest {
12 pub session: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
13 }
14
15 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ControllerOpenSessionRequest, ___E>
16 for ControllerOpenSessionRequest
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::ControllerOpenSessionRequest,
24 > = unsafe {
25 ::fidl_next::CopyOptimization::enable_if(
26 true
27
28 && <
29 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::Encode<::fidl_next::ServerEnd<crate::Device, ::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::ControllerOpenSessionRequest>,
40 _: (),
41 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
42 ::fidl_next::munge! {
43 let crate::wire::ControllerOpenSessionRequest {
44 session,
45
46 } = out_;
47 }
48
49 ::fidl_next::Encode::encode(self.session, encoder_, session, ())?;
50
51 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(session.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::ControllerOpenSessionRequest>,
60 ___E,
61 > for ControllerOpenSessionRequest
62 where
63 ___E: ::fidl_next::Encoder + ?Sized,
64 ControllerOpenSessionRequest:
65 ::fidl_next::Encode<crate::wire::ControllerOpenSessionRequest, ___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::ControllerOpenSessionRequest>,
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::ControllerOpenSessionRequest>
88 for ControllerOpenSessionRequest
89 {
90 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
91 crate::wire::ControllerOpenSessionRequest,
92 Self,
93 > = unsafe {
94 ::fidl_next::CopyOptimization::enable_if(
95 true
96
97 && <
98 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>>
99 >::COPY_OPTIMIZATION.is_enabled()
100
101 )
102 };
103
104 #[inline]
105 fn from_wire(wire: crate::wire::ControllerOpenSessionRequest) -> Self {
106 Self { session: ::fidl_next::FromWire::from_wire(wire.session) }
107 }
108 }
109
110 #[derive(Debug, PartialEq)]
111 #[repr(C)]
112 pub struct TestConnectSpiLoopbackRequest {
113 pub server: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
114 }
115
116 unsafe impl<___E> ::fidl_next::Encode<crate::wire::TestConnectSpiLoopbackRequest, ___E>
117 for TestConnectSpiLoopbackRequest
118 where
119 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
120 ___E: ::fidl_next::fuchsia::HandleEncoder,
121 {
122 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
123 Self,
124 crate::wire::TestConnectSpiLoopbackRequest,
125 > = unsafe {
126 ::fidl_next::CopyOptimization::enable_if(
127 true
128
129 && <
130 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::Encode<::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>, ___E>
131 >::COPY_OPTIMIZATION.is_enabled()
132
133 )
134 };
135
136 #[inline]
137 fn encode(
138 self,
139 encoder_: &mut ___E,
140 out_: &mut ::core::mem::MaybeUninit<crate::wire::TestConnectSpiLoopbackRequest>,
141 _: (),
142 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
143 ::fidl_next::munge! {
144 let crate::wire::TestConnectSpiLoopbackRequest {
145 server,
146
147 } = out_;
148 }
149
150 ::fidl_next::Encode::encode(self.server, encoder_, server, ())?;
151
152 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(server.as_mut_ptr()) };
153
154 Ok(())
155 }
156 }
157
158 unsafe impl<___E>
159 ::fidl_next::EncodeOption<
160 ::fidl_next::wire::Box<'static, crate::wire::TestConnectSpiLoopbackRequest>,
161 ___E,
162 > for TestConnectSpiLoopbackRequest
163 where
164 ___E: ::fidl_next::Encoder + ?Sized,
165 TestConnectSpiLoopbackRequest:
166 ::fidl_next::Encode<crate::wire::TestConnectSpiLoopbackRequest, ___E>,
167 {
168 #[inline]
169 fn encode_option(
170 this: ::core::option::Option<Self>,
171 encoder: &mut ___E,
172 out: &mut ::core::mem::MaybeUninit<
173 ::fidl_next::wire::Box<'static, crate::wire::TestConnectSpiLoopbackRequest>,
174 >,
175 _: (),
176 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
177 if let Some(inner) = this {
178 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
179 ::fidl_next::wire::Box::encode_present(out);
180 } else {
181 ::fidl_next::wire::Box::encode_absent(out);
182 }
183
184 Ok(())
185 }
186 }
187
188 impl ::fidl_next::FromWire<crate::wire::TestConnectSpiLoopbackRequest>
189 for TestConnectSpiLoopbackRequest
190 {
191 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
192 crate::wire::TestConnectSpiLoopbackRequest,
193 Self,
194 > = unsafe {
195 ::fidl_next::CopyOptimization::enable_if(
196 true
197
198 && <
199 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>>
200 >::COPY_OPTIMIZATION.is_enabled()
201
202 )
203 };
204
205 #[inline]
206 fn from_wire(wire: crate::wire::TestConnectSpiLoopbackRequest) -> Self {
207 Self { server: ::fidl_next::FromWire::from_wire(wire.server) }
208 }
209 }
210}
211
212pub mod wire {
213
214 pub use fidl_next_common_fuchsia_hardware_spi::wire::*;
215
216 #[derive(Debug)]
218 #[repr(C)]
219 pub struct ControllerOpenSessionRequest {
220 pub session: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
221 }
222
223 static_assertions::const_assert_eq!(std::mem::size_of::<ControllerOpenSessionRequest>(), 4);
224 static_assertions::const_assert_eq!(std::mem::align_of::<ControllerOpenSessionRequest>(), 4);
225
226 static_assertions::const_assert_eq!(
227 std::mem::offset_of!(ControllerOpenSessionRequest, session),
228 0
229 );
230
231 impl ::fidl_next::Constrained for ControllerOpenSessionRequest {
232 type Constraint = ();
233
234 fn validate(
235 _: ::fidl_next::Slot<'_, Self>,
236 _: Self::Constraint,
237 ) -> Result<(), ::fidl_next::ValidationError> {
238 Ok(())
239 }
240 }
241
242 unsafe impl ::fidl_next::Wire for ControllerOpenSessionRequest {
243 type Narrowed<'de> = ControllerOpenSessionRequest;
244
245 #[inline]
246 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
247 ::fidl_next::munge! {
248 let Self {
249 session,
250
251 } = &mut *out_;
252 }
253
254 ::fidl_next::Wire::zero_padding(session);
255 }
256 }
257
258 unsafe impl<___D> ::fidl_next::Decode<___D> for ControllerOpenSessionRequest
259 where
260 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
261 ___D: ::fidl_next::fuchsia::HandleDecoder,
262 {
263 fn decode(
264 slot_: ::fidl_next::Slot<'_, Self>,
265 decoder_: &mut ___D,
266 _: (),
267 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
268 ::fidl_next::munge! {
269 let Self {
270 mut session,
271
272 } = slot_;
273 }
274
275 let _field = session.as_mut();
276
277 ::fidl_next::Decode::decode(session.as_mut(), decoder_, ())?;
278
279 Ok(())
280 }
281 }
282
283 impl ::fidl_next::IntoNatural for ControllerOpenSessionRequest {
284 type Natural = crate::natural::ControllerOpenSessionRequest;
285 }
286
287 #[derive(Debug)]
289 #[repr(C)]
290 pub struct TestConnectSpiLoopbackRequest {
291 pub server: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
292 }
293
294 static_assertions::const_assert_eq!(std::mem::size_of::<TestConnectSpiLoopbackRequest>(), 4);
295 static_assertions::const_assert_eq!(std::mem::align_of::<TestConnectSpiLoopbackRequest>(), 4);
296
297 static_assertions::const_assert_eq!(
298 std::mem::offset_of!(TestConnectSpiLoopbackRequest, server),
299 0
300 );
301
302 impl ::fidl_next::Constrained for TestConnectSpiLoopbackRequest {
303 type Constraint = ();
304
305 fn validate(
306 _: ::fidl_next::Slot<'_, Self>,
307 _: Self::Constraint,
308 ) -> Result<(), ::fidl_next::ValidationError> {
309 Ok(())
310 }
311 }
312
313 unsafe impl ::fidl_next::Wire for TestConnectSpiLoopbackRequest {
314 type Narrowed<'de> = TestConnectSpiLoopbackRequest;
315
316 #[inline]
317 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
318 ::fidl_next::munge! {
319 let Self {
320 server,
321
322 } = &mut *out_;
323 }
324
325 ::fidl_next::Wire::zero_padding(server);
326 }
327 }
328
329 unsafe impl<___D> ::fidl_next::Decode<___D> for TestConnectSpiLoopbackRequest
330 where
331 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
332 ___D: ::fidl_next::fuchsia::HandleDecoder,
333 {
334 fn decode(
335 slot_: ::fidl_next::Slot<'_, Self>,
336 decoder_: &mut ___D,
337 _: (),
338 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
339 ::fidl_next::munge! {
340 let Self {
341 mut server,
342
343 } = slot_;
344 }
345
346 let _field = server.as_mut();
347
348 ::fidl_next::Decode::decode(server.as_mut(), decoder_, ())?;
349
350 Ok(())
351 }
352 }
353
354 impl ::fidl_next::IntoNatural for TestConnectSpiLoopbackRequest {
355 type Natural = crate::natural::TestConnectSpiLoopbackRequest;
356 }
357}
358
359pub mod wire_optional {
360
361 pub use fidl_next_common_fuchsia_hardware_spi::wire_optional::*;
362}
363
364pub mod generic {
365
366 pub use fidl_next_common_fuchsia_hardware_spi::generic::*;
367
368 pub struct ControllerOpenSessionRequest<T0> {
370 pub session: T0,
371 }
372
373 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::ControllerOpenSessionRequest, ___E>
374 for ControllerOpenSessionRequest<T0>
375 where
376 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
377 ___E: ::fidl_next::fuchsia::HandleEncoder,
378 T0: ::fidl_next::Encode<
379 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
380 ___E,
381 >,
382 {
383 #[inline]
384 fn encode(
385 self,
386 encoder_: &mut ___E,
387 out_: &mut ::core::mem::MaybeUninit<crate::wire::ControllerOpenSessionRequest>,
388 _: (),
389 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
390 ::fidl_next::munge! {
391 let crate::wire::ControllerOpenSessionRequest {
392 session,
393
394 } = out_;
395 }
396
397 ::fidl_next::Encode::encode(self.session, encoder_, session, ())?;
398
399 Ok(())
400 }
401 }
402
403 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::ControllerOpenSessionRequest, ___E>
404 for &'a ControllerOpenSessionRequest<T0>
405 where
406 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
407 ___E: ::fidl_next::fuchsia::HandleEncoder,
408 &'a T0: ::fidl_next::Encode<
409 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
410 ___E,
411 >,
412 {
413 #[inline]
414 fn encode(
415 self,
416 encoder_: &mut ___E,
417 out_: &mut ::core::mem::MaybeUninit<crate::wire::ControllerOpenSessionRequest>,
418 _: (),
419 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
420 ::fidl_next::munge! {
421 let crate::wire::ControllerOpenSessionRequest {
422 session,
423
424 } = out_;
425 }
426
427 ::fidl_next::Encode::encode(&self.session, encoder_, session, ())?;
428
429 Ok(())
430 }
431 }
432
433 pub struct TestConnectSpiLoopbackRequest<T0> {
435 pub server: T0,
436 }
437
438 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::TestConnectSpiLoopbackRequest, ___E>
439 for TestConnectSpiLoopbackRequest<T0>
440 where
441 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
442 ___E: ::fidl_next::fuchsia::HandleEncoder,
443 T0: ::fidl_next::Encode<
444 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
445 ___E,
446 >,
447 {
448 #[inline]
449 fn encode(
450 self,
451 encoder_: &mut ___E,
452 out_: &mut ::core::mem::MaybeUninit<crate::wire::TestConnectSpiLoopbackRequest>,
453 _: (),
454 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
455 ::fidl_next::munge! {
456 let crate::wire::TestConnectSpiLoopbackRequest {
457 server,
458
459 } = out_;
460 }
461
462 ::fidl_next::Encode::encode(self.server, encoder_, server, ())?;
463
464 Ok(())
465 }
466 }
467
468 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::TestConnectSpiLoopbackRequest, ___E>
469 for &'a TestConnectSpiLoopbackRequest<T0>
470 where
471 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
472 ___E: ::fidl_next::fuchsia::HandleEncoder,
473 &'a T0: ::fidl_next::Encode<
474 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
475 ___E,
476 >,
477 {
478 #[inline]
479 fn encode(
480 self,
481 encoder_: &mut ___E,
482 out_: &mut ::core::mem::MaybeUninit<crate::wire::TestConnectSpiLoopbackRequest>,
483 _: (),
484 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
485 ::fidl_next::munge! {
486 let crate::wire::TestConnectSpiLoopbackRequest {
487 server,
488
489 } = out_;
490 }
491
492 ::fidl_next::Encode::encode(&self.server, encoder_, server, ())?;
493
494 Ok(())
495 }
496 }
497}
498
499pub use self::natural::*;
500
501#[derive(PartialEq, Debug)]
503pub struct Controller;
504
505#[cfg(target_os = "fuchsia")]
506impl ::fidl_next::HasTransport for Controller {
507 type Transport = ::fidl_next::fuchsia::zx::Channel;
508}
509
510pub mod controller {
511 pub mod prelude {
512 pub use crate::{
513 Controller, ControllerClientHandler, ControllerLocalClientHandler,
514 ControllerLocalServerHandler, ControllerServerHandler, controller,
515 };
516
517 pub use crate::natural::ControllerOpenSessionRequest;
518 }
519
520 pub struct OpenSession;
521
522 impl ::fidl_next::Method for OpenSession {
523 const ORDINAL: u64 = 1862345129906445108;
524 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
525 ::fidl_next::protocol::Flexibility::Strict;
526
527 type Protocol = crate::Controller;
528
529 type Request = crate::wire::ControllerOpenSessionRequest;
530 }
531
532 mod ___detail {
533 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Controller
534 where
535 ___T: ::fidl_next::Transport,
536 {
537 type Client = ControllerClient<___T>;
538 type Server = ControllerServer<___T>;
539 }
540
541 #[repr(transparent)]
543 pub struct ControllerClient<___T: ::fidl_next::Transport> {
544 #[allow(dead_code)]
545 client: ::fidl_next::protocol::Client<___T>,
546 }
547
548 impl<___T> ControllerClient<___T>
549 where
550 ___T: ::fidl_next::Transport,
551 {
552 #[doc = " Opens a new session on the device.\n\n At most one session is permitted at one time; the server end will be\n closed with `ZX_ERR_ALREADY_BOUND` if a session already exists.\n"]
553 pub fn open_session(
554 &self,
555
556 session: impl ::fidl_next::Encode<
557 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
558 <___T as ::fidl_next::Transport>::SendBuffer,
559 >,
560 ) -> ::fidl_next::SendFuture<'_, ___T>
561 where
562 <___T as ::fidl_next::Transport>::SendBuffer:
563 ::fidl_next::encoder::InternalHandleEncoder,
564 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
565 {
566 self.open_session_with(crate::generic::ControllerOpenSessionRequest { session })
567 }
568
569 #[doc = " Opens a new session on the device.\n\n At most one session is permitted at one time; the server end will be\n closed with `ZX_ERR_ALREADY_BOUND` if a session already exists.\n"]
570 pub fn open_session_with<___R>(
571 &self,
572 request: ___R,
573 ) -> ::fidl_next::SendFuture<'_, ___T>
574 where
575 ___R: ::fidl_next::Encode<
576 crate::wire::ControllerOpenSessionRequest,
577 <___T as ::fidl_next::Transport>::SendBuffer,
578 >,
579 {
580 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
581 1862345129906445108,
582 <super::OpenSession as ::fidl_next::Method>::FLEXIBILITY,
583 request,
584 ))
585 }
586 }
587
588 #[repr(transparent)]
590 pub struct ControllerServer<___T: ::fidl_next::Transport> {
591 server: ::fidl_next::protocol::Server<___T>,
592 }
593
594 impl<___T> ControllerServer<___T> where ___T: ::fidl_next::Transport {}
595 }
596}
597
598#[diagnostic::on_unimplemented(
599 note = "If {Self} implements the non-local ControllerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
600)]
601
602pub trait ControllerLocalClientHandler<
606 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
607 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
608>
609{
610}
611
612impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Controller
613where
614 ___H: ControllerLocalClientHandler<___T>,
615 ___T: ::fidl_next::Transport,
616{
617 async fn on_event(
618 handler: &mut ___H,
619 mut message: ::fidl_next::Message<___T>,
620 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
621 match *message.header().ordinal {
622 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
623 }
624 }
625}
626
627#[diagnostic::on_unimplemented(
628 note = "If {Self} implements the non-local ControllerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
629)]
630
631pub trait ControllerLocalServerHandler<
635 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
636 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
637>
638{
639 #[doc = " Opens a new session on the device.\n\n At most one session is permitted at one time; the server end will be\n closed with `ZX_ERR_ALREADY_BOUND` if a session already exists.\n"]
640 fn open_session(
641 &mut self,
642
643 request: ::fidl_next::Request<controller::OpenSession, ___T>,
644 ) -> impl ::core::future::Future<Output = ()>;
645}
646
647impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Controller
648where
649 ___H: ControllerLocalServerHandler<___T>,
650 ___T: ::fidl_next::Transport,
651 for<'de> crate::wire::ControllerOpenSessionRequest: ::fidl_next::Decode<
652 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
653 Constraint = (),
654 >,
655{
656 async fn on_one_way(
657 handler: &mut ___H,
658 mut message: ::fidl_next::Message<___T>,
659 ) -> ::core::result::Result<
660 (),
661 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
662 > {
663 match *message.header().ordinal {
664 1862345129906445108 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
665 Ok(decoded) => {
666 handler.open_session(::fidl_next::Request::from_decoded(decoded)).await;
667 Ok(())
668 }
669 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
670 ordinal: 1862345129906445108,
671 error,
672 }),
673 },
674
675 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
676 }
677 }
678
679 async fn on_two_way(
680 handler: &mut ___H,
681 mut message: ::fidl_next::Message<___T>,
682 responder: ::fidl_next::protocol::Responder<___T>,
683 ) -> ::core::result::Result<
684 (),
685 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
686 > {
687 match *message.header().ordinal {
688 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
689 }
690 }
691}
692
693pub trait ControllerClientHandler<
697 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
698 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
699>
700{
701}
702
703impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Controller
704where
705 ___H: ControllerClientHandler<___T> + ::core::marker::Send,
706 ___T: ::fidl_next::Transport,
707{
708 async fn on_event(
709 handler: &mut ___H,
710 mut message: ::fidl_next::Message<___T>,
711 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
712 match *message.header().ordinal {
713 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
714 }
715 }
716}
717
718pub trait ControllerServerHandler<
722 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
723 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
724>
725{
726 #[doc = " Opens a new session on the device.\n\n At most one session is permitted at one time; the server end will be\n closed with `ZX_ERR_ALREADY_BOUND` if a session already exists.\n"]
727 fn open_session(
728 &mut self,
729
730 request: ::fidl_next::Request<controller::OpenSession, ___T>,
731 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
732}
733
734impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Controller
735where
736 ___H: ControllerServerHandler<___T> + ::core::marker::Send,
737 ___T: ::fidl_next::Transport,
738 for<'de> crate::wire::ControllerOpenSessionRequest: ::fidl_next::Decode<
739 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
740 Constraint = (),
741 >,
742{
743 async fn on_one_way(
744 handler: &mut ___H,
745 mut message: ::fidl_next::Message<___T>,
746 ) -> ::core::result::Result<
747 (),
748 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
749 > {
750 match *message.header().ordinal {
751 1862345129906445108 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
752 Ok(decoded) => {
753 handler.open_session(::fidl_next::Request::from_decoded(decoded)).await;
754 Ok(())
755 }
756 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
757 ordinal: 1862345129906445108,
758 error,
759 }),
760 },
761
762 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
763 }
764 }
765
766 async fn on_two_way(
767 handler: &mut ___H,
768 mut message: ::fidl_next::Message<___T>,
769 responder: ::fidl_next::protocol::Responder<___T>,
770 ) -> ::core::result::Result<
771 (),
772 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
773 > {
774 match *message.header().ordinal {
775 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
776 }
777 }
778}
779
780impl<___T> ControllerClientHandler<___T> for ::fidl_next::IgnoreEvents where
781 ___T: ::fidl_next::Transport
782{
783}
784
785impl<___H, ___T> ControllerLocalClientHandler<___T> for ::fidl_next::Local<___H>
786where
787 ___H: ControllerClientHandler<___T>,
788 ___T: ::fidl_next::Transport,
789{
790}
791
792impl<___H, ___T> ControllerLocalServerHandler<___T> for ::fidl_next::Local<___H>
793where
794 ___H: ControllerServerHandler<___T>,
795 ___T: ::fidl_next::Transport,
796{
797 async fn open_session(&mut self, request: ::fidl_next::Request<controller::OpenSession, ___T>) {
798 ___H::open_session(&mut self.0, request).await
799 }
800}
801
802#[derive(Debug)]
804pub struct ControllerService;
805
806impl ::fidl_next::DiscoverableService for ControllerService {
807 const SERVICE_NAME: &'static str = "fuchsia.hardware.spi.ControllerService";
808 const MEMBER_NAMES: &'static [&'static str] = &["device"];
809}
810
811impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for ControllerService {}
812
813impl<___C> ::fidl_next::Service<___C> for ControllerService
814where
815 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
816{
817 type Connector = ControllerServiceConnector<___C>;
818}
819
820#[repr(transparent)]
822pub struct ControllerServiceConnector<___C> {
823 #[allow(dead_code)]
824 connector: ___C,
825}
826
827impl<___C> ControllerServiceConnector<___C>
828where
829 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
830{
831 pub fn device(
833 &self,
834 server_end: ::fidl_next::ServerEnd<crate::Controller, ::fidl_next::fuchsia::zx::Channel>,
835 ) -> ::core::result::Result<
836 (),
837 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
838 > {
839 ::fidl_next::protocol::ServiceConnector::<
840 ::fidl_next::fuchsia::zx::Channel
841 >::connect_to_member(
842 &self.connector,
843 "device",
844 server_end.into_untyped(),
845 )
846 }
847}
848
849pub trait ControllerServiceHandler {
851 fn device(
853 &self,
854 server_end: ::fidl_next::ServerEnd<crate::Controller, ::fidl_next::fuchsia::zx::Channel>,
855 );
856}
857
858impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for ControllerService
859where
860 ___H: ControllerServiceHandler,
861 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
862{
863 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
864 use ::fidl_next::InstanceFromServiceTransport;
865 match member {
866 "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
867 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
868 )),
869
870 _ => unreachable!(),
871 }
872 }
873}
874
875#[derive(PartialEq, Debug)]
877pub struct Device;
878
879impl ::fidl_next::Discoverable for Device {
880 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.spi.Device";
881}
882
883#[cfg(target_os = "fuchsia")]
884impl ::fidl_next::HasTransport for Device {
885 type Transport = ::fidl_next::fuchsia::zx::Channel;
886}
887
888pub mod device {
889 pub mod prelude {
890 pub use crate::{
891 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
892 DeviceServerHandler, device,
893 };
894
895 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoExchangeRequest;
896
897 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoReceiveRequest;
898
899 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoTransmitRequest;
900
901 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoExchangeResponse;
902
903 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoReceiveResponse;
904
905 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoTransmitResponse;
906
907 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoRegisterRegisterVmoRequest;
908
909 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoRegisterUnregisterVmoRequest;
910
911 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoRegisterRegisterVmoResponse;
912
913 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoRegisterUnregisterVmoResponse;
914
915 pub use crate::natural::DeviceAssertCsResponse;
916
917 pub use crate::natural::DeviceCanAssertCsResponse;
918
919 pub use crate::natural::DeviceDeassertCsResponse;
920
921 pub use crate::natural::DeviceExchangeVectorRequest;
922
923 pub use crate::natural::DeviceExchangeVectorResponse;
924
925 pub use crate::natural::DeviceReceiveVectorRequest;
926
927 pub use crate::natural::DeviceReceiveVectorResponse;
928
929 pub use crate::natural::DeviceTransmitVectorRequest;
930
931 pub use crate::natural::DeviceTransmitVectorResponse;
932 }
933
934 pub struct Transmit;
935
936 impl ::fidl_next::Method for Transmit {
937 const ORDINAL: u64 = 8726129880940523711;
938 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
939 ::fidl_next::protocol::Flexibility::Strict;
940
941 type Protocol = crate::Device;
942
943 type Request = ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitRequest;
944 }
945
946 impl ::fidl_next::TwoWayMethod for Transmit {
947 type Response = ::fidl_next::wire::Result<
948 'static,
949 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitResponse,
950 ::fidl_next::wire::Int32,
951 >;
952 }
953
954 impl<___R> ::fidl_next::Respond<___R> for Transmit {
955 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
956
957 fn respond(response: ___R) -> Self::Output {
958 ::core::result::Result::Ok(response)
959 }
960 }
961
962 impl<___R> ::fidl_next::RespondErr<___R> for Transmit {
963 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
964
965 fn respond_err(response: ___R) -> Self::Output {
966 ::core::result::Result::Err(response)
967 }
968 }
969
970 pub struct Receive;
971
972 impl ::fidl_next::Method for Receive {
973 const ORDINAL: u64 = 2031572499837475673;
974 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
975 ::fidl_next::protocol::Flexibility::Strict;
976
977 type Protocol = crate::Device;
978
979 type Request = ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveRequest;
980 }
981
982 impl ::fidl_next::TwoWayMethod for Receive {
983 type Response = ::fidl_next::wire::Result<
984 'static,
985 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveResponse,
986 ::fidl_next::wire::Int32,
987 >;
988 }
989
990 impl<___R> ::fidl_next::Respond<___R> for Receive {
991 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
992
993 fn respond(response: ___R) -> Self::Output {
994 ::core::result::Result::Ok(response)
995 }
996 }
997
998 impl<___R> ::fidl_next::RespondErr<___R> for Receive {
999 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1000
1001 fn respond_err(response: ___R) -> Self::Output {
1002 ::core::result::Result::Err(response)
1003 }
1004 }
1005
1006 pub struct Exchange;
1007
1008 impl ::fidl_next::Method for Exchange {
1009 const ORDINAL: u64 = 7915872066671078604;
1010 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1011 ::fidl_next::protocol::Flexibility::Strict;
1012
1013 type Protocol = crate::Device;
1014
1015 type Request = ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeRequest;
1016 }
1017
1018 impl ::fidl_next::TwoWayMethod for Exchange {
1019 type Response = ::fidl_next::wire::Result<
1020 'static,
1021 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeResponse,
1022 ::fidl_next::wire::Int32,
1023 >;
1024 }
1025
1026 impl<___R> ::fidl_next::Respond<___R> for Exchange {
1027 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1028
1029 fn respond(response: ___R) -> Self::Output {
1030 ::core::result::Result::Ok(response)
1031 }
1032 }
1033
1034 impl<___R> ::fidl_next::RespondErr<___R> for Exchange {
1035 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1036
1037 fn respond_err(response: ___R) -> Self::Output {
1038 ::core::result::Result::Err(response)
1039 }
1040 }
1041
1042 pub struct RegisterVmo;
1043
1044 impl ::fidl_next::Method for RegisterVmo {
1045 const ORDINAL: u64 = 3593681058348550677;
1046 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1047 ::fidl_next::protocol::Flexibility::Strict;
1048
1049 type Protocol = crate::Device;
1050
1051 type Request =
1052 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoRequest;
1053 }
1054
1055 impl ::fidl_next::TwoWayMethod for RegisterVmo {
1056 type Response = ::fidl_next::wire::Result<
1057 'static,
1058 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoResponse,
1059 ::fidl_next::wire::Int32,
1060 >;
1061 }
1062
1063 impl<___R> ::fidl_next::Respond<___R> for RegisterVmo {
1064 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1065
1066 fn respond(response: ___R) -> Self::Output {
1067 ::core::result::Result::Ok(response)
1068 }
1069 }
1070
1071 impl<___R> ::fidl_next::RespondErr<___R> for RegisterVmo {
1072 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1073
1074 fn respond_err(response: ___R) -> Self::Output {
1075 ::core::result::Result::Err(response)
1076 }
1077 }
1078
1079 pub struct UnregisterVmo;
1080
1081 impl ::fidl_next::Method for UnregisterVmo {
1082 const ORDINAL: u64 = 1266894365566071049;
1083 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1084 ::fidl_next::protocol::Flexibility::Strict;
1085
1086 type Protocol = crate::Device;
1087
1088 type Request =
1089 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoRequest;
1090 }
1091
1092 impl ::fidl_next::TwoWayMethod for UnregisterVmo {
1093 type Response = ::fidl_next::wire::Result<
1094 'static,
1095 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoResponse,
1096 ::fidl_next::wire::Int32,
1097 >;
1098 }
1099
1100 impl<___R> ::fidl_next::Respond<___R> for UnregisterVmo {
1101 type Output =
1102 ::core::result::Result<
1103 ::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoRegisterUnregisterVmoResponse<___R>,
1104 ::fidl_next::never::Never,
1105 >;
1106
1107 fn respond(response: ___R) -> Self::Output {
1108 ::core::result::Result::Ok(
1109 ::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoRegisterUnregisterVmoResponse {
1110 vmo: response,
1111 }
1112 )
1113 }
1114 }
1115
1116 impl<___R> ::fidl_next::RespondErr<___R> for UnregisterVmo {
1117 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1118
1119 fn respond_err(response: ___R) -> Self::Output {
1120 ::core::result::Result::Err(response)
1121 }
1122 }
1123
1124 pub struct TransmitVector;
1125
1126 impl ::fidl_next::Method for TransmitVector {
1127 const ORDINAL: u64 = 5091362422849398226;
1128 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1129 ::fidl_next::protocol::Flexibility::Strict;
1130
1131 type Protocol = crate::Device;
1132
1133 type Request = crate::wire::DeviceTransmitVectorRequest<'static>;
1134 }
1135
1136 impl ::fidl_next::TwoWayMethod for TransmitVector {
1137 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceTransmitVectorResponse>;
1138 }
1139
1140 impl<___R> ::fidl_next::Respond<___R> for TransmitVector {
1141 type Output = ::fidl_next::Strict<crate::generic::DeviceTransmitVectorResponse<___R>>;
1142
1143 fn respond(response: ___R) -> Self::Output {
1144 ::fidl_next::Strict(crate::generic::DeviceTransmitVectorResponse { status: response })
1145 }
1146 }
1147
1148 pub struct ReceiveVector;
1149
1150 impl ::fidl_next::Method for ReceiveVector {
1151 const ORDINAL: u64 = 4013095315797000150;
1152 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1153 ::fidl_next::protocol::Flexibility::Strict;
1154
1155 type Protocol = crate::Device;
1156
1157 type Request = crate::wire::DeviceReceiveVectorRequest;
1158 }
1159
1160 impl ::fidl_next::TwoWayMethod for ReceiveVector {
1161 type Response =
1162 ::fidl_next::wire::Strict<crate::wire::DeviceReceiveVectorResponse<'static>>;
1163 }
1164
1165 impl<___R> ::fidl_next::Respond<___R> for ReceiveVector {
1166 type Output = ::fidl_next::Strict<___R>;
1167
1168 fn respond(response: ___R) -> Self::Output {
1169 ::fidl_next::Strict(response)
1170 }
1171 }
1172
1173 pub struct ExchangeVector;
1174
1175 impl ::fidl_next::Method for ExchangeVector {
1176 const ORDINAL: u64 = 9199936960863142845;
1177 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1178 ::fidl_next::protocol::Flexibility::Strict;
1179
1180 type Protocol = crate::Device;
1181
1182 type Request = crate::wire::DeviceExchangeVectorRequest<'static>;
1183 }
1184
1185 impl ::fidl_next::TwoWayMethod for ExchangeVector {
1186 type Response =
1187 ::fidl_next::wire::Strict<crate::wire::DeviceExchangeVectorResponse<'static>>;
1188 }
1189
1190 impl<___R> ::fidl_next::Respond<___R> for ExchangeVector {
1191 type Output = ::fidl_next::Strict<___R>;
1192
1193 fn respond(response: ___R) -> Self::Output {
1194 ::fidl_next::Strict(response)
1195 }
1196 }
1197
1198 pub struct CanAssertCs;
1199
1200 impl ::fidl_next::Method for CanAssertCs {
1201 const ORDINAL: u64 = 2273212530067875956;
1202 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1203 ::fidl_next::protocol::Flexibility::Strict;
1204
1205 type Protocol = crate::Device;
1206
1207 type Request = ::fidl_next::wire::EmptyMessageBody;
1208 }
1209
1210 impl ::fidl_next::TwoWayMethod for CanAssertCs {
1211 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceCanAssertCsResponse>;
1212 }
1213
1214 impl<___R> ::fidl_next::Respond<___R> for CanAssertCs {
1215 type Output = ::fidl_next::Strict<crate::generic::DeviceCanAssertCsResponse<___R>>;
1216
1217 fn respond(response: ___R) -> Self::Output {
1218 ::fidl_next::Strict(crate::generic::DeviceCanAssertCsResponse { can: response })
1219 }
1220 }
1221
1222 pub struct AssertCs;
1223
1224 impl ::fidl_next::Method for AssertCs {
1225 const ORDINAL: u64 = 5761910272765271270;
1226 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1227 ::fidl_next::protocol::Flexibility::Strict;
1228
1229 type Protocol = crate::Device;
1230
1231 type Request = ::fidl_next::wire::EmptyMessageBody;
1232 }
1233
1234 impl ::fidl_next::TwoWayMethod for AssertCs {
1235 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceAssertCsResponse>;
1236 }
1237
1238 impl<___R> ::fidl_next::Respond<___R> for AssertCs {
1239 type Output = ::fidl_next::Strict<crate::generic::DeviceAssertCsResponse<___R>>;
1240
1241 fn respond(response: ___R) -> Self::Output {
1242 ::fidl_next::Strict(crate::generic::DeviceAssertCsResponse { status: response })
1243 }
1244 }
1245
1246 pub struct DeassertCs;
1247
1248 impl ::fidl_next::Method for DeassertCs {
1249 const ORDINAL: u64 = 6795041648297119160;
1250 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1251 ::fidl_next::protocol::Flexibility::Strict;
1252
1253 type Protocol = crate::Device;
1254
1255 type Request = ::fidl_next::wire::EmptyMessageBody;
1256 }
1257
1258 impl ::fidl_next::TwoWayMethod for DeassertCs {
1259 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceDeassertCsResponse>;
1260 }
1261
1262 impl<___R> ::fidl_next::Respond<___R> for DeassertCs {
1263 type Output = ::fidl_next::Strict<crate::generic::DeviceDeassertCsResponse<___R>>;
1264
1265 fn respond(response: ___R) -> Self::Output {
1266 ::fidl_next::Strict(crate::generic::DeviceDeassertCsResponse { status: response })
1267 }
1268 }
1269
1270 mod ___detail {
1271 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1272 where
1273 ___T: ::fidl_next::Transport,
1274 {
1275 type Client = DeviceClient<___T>;
1276 type Server = DeviceServer<___T>;
1277 }
1278
1279 #[repr(transparent)]
1281 pub struct DeviceClient<___T: ::fidl_next::Transport> {
1282 #[allow(dead_code)]
1283 client: ::fidl_next::protocol::Client<___T>,
1284 }
1285
1286 impl<___T> DeviceClient<___T>
1287 where
1288 ___T: ::fidl_next::Transport,
1289 {
1290 #[doc = " Sends the data in buffer to the device.\n"]
1291 pub fn transmit(
1292 &self,
1293
1294 buffer: impl ::fidl_next::Encode<
1295 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoBuffer,
1296 <___T as ::fidl_next::Transport>::SendBuffer,
1297 >,
1298 ) -> ::fidl_next::TwoWayFuture<'_, super::Transmit, ___T>
1299 where
1300 <___T as ::fidl_next::Transport>::SendBuffer:
1301 ::fidl_next::encoder::InternalHandleEncoder,
1302 {
1303 self.transmit_with(::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoIoTransmitRequest {
1304
1305 buffer,
1306
1307 })
1308 }
1309
1310 #[doc = " Sends the data in buffer to the device.\n"]
1311 pub fn transmit_with<___R>(
1312 &self,
1313 request: ___R,
1314 ) -> ::fidl_next::TwoWayFuture<'_, super::Transmit, ___T>
1315 where
1316 ___R: ::fidl_next::Encode<
1317 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitRequest,
1318 <___T as ::fidl_next::Transport>::SendBuffer,
1319 >,
1320 {
1321 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1322 8726129880940523711,
1323 <super::Transmit as ::fidl_next::Method>::FLEXIBILITY,
1324 request,
1325 ))
1326 }
1327
1328 #[doc = " Receives data from the device into buffer.\n"]
1329 pub fn receive(
1330 &self,
1331
1332 buffer: impl ::fidl_next::Encode<
1333 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoBuffer,
1334 <___T as ::fidl_next::Transport>::SendBuffer,
1335 >,
1336 ) -> ::fidl_next::TwoWayFuture<'_, super::Receive, ___T>
1337 where
1338 <___T as ::fidl_next::Transport>::SendBuffer:
1339 ::fidl_next::encoder::InternalHandleEncoder,
1340 {
1341 self.receive_with(
1342 ::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoIoReceiveRequest {
1343 buffer,
1344 },
1345 )
1346 }
1347
1348 #[doc = " Receives data from the device into buffer.\n"]
1349 pub fn receive_with<___R>(
1350 &self,
1351 request: ___R,
1352 ) -> ::fidl_next::TwoWayFuture<'_, super::Receive, ___T>
1353 where
1354 ___R: ::fidl_next::Encode<
1355 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveRequest,
1356 <___T as ::fidl_next::Transport>::SendBuffer,
1357 >,
1358 {
1359 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1360 2031572499837475673,
1361 <super::Receive as ::fidl_next::Method>::FLEXIBILITY,
1362 request,
1363 ))
1364 }
1365
1366 #[doc = " Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must\n be the same.\n"]
1367 pub fn exchange(
1368 &self,
1369
1370 tx_buffer: impl ::fidl_next::Encode<
1371 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoBuffer,
1372 <___T as ::fidl_next::Transport>::SendBuffer,
1373 >,
1374
1375 rx_buffer: impl ::fidl_next::Encode<
1376 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoBuffer,
1377 <___T as ::fidl_next::Transport>::SendBuffer,
1378 >,
1379 ) -> ::fidl_next::TwoWayFuture<'_, super::Exchange, ___T>
1380 where
1381 <___T as ::fidl_next::Transport>::SendBuffer:
1382 ::fidl_next::encoder::InternalHandleEncoder,
1383 {
1384 self.exchange_with(::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoIoExchangeRequest {
1385
1386 tx_buffer,
1387
1388 rx_buffer,
1389
1390 })
1391 }
1392
1393 #[doc = " Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must\n be the same.\n"]
1394 pub fn exchange_with<___R>(
1395 &self,
1396 request: ___R,
1397 ) -> ::fidl_next::TwoWayFuture<'_, super::Exchange, ___T>
1398 where
1399 ___R: ::fidl_next::Encode<
1400 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeRequest,
1401 <___T as ::fidl_next::Transport>::SendBuffer,
1402 >,
1403 {
1404 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1405 7915872066671078604,
1406 <super::Exchange as ::fidl_next::Method>::FLEXIBILITY,
1407 request,
1408 ))
1409 }
1410
1411 #[doc = " Registers a VMO and transfers ownership to the driver.\n vmo_id: The ID chosen by the client that will be used in operations on this VMO.\n vmo: The handle, offset, and size of this VMO. IO operations on this VMO will be relative to\n the offset and size specified here.\n rights: A bit field of SharedVmoRight values indicating how this VMO may be used. Callers\n should assume that the driver will map and/or pin the VMO using these rights.\n"]
1412 pub fn register_vmo(
1413 &self,
1414
1415 vmo_id: impl ::fidl_next::Encode<
1416 ::fidl_next::wire::Uint32,
1417 <___T as ::fidl_next::Transport>::SendBuffer,
1418 >,
1419
1420 vmo: impl ::fidl_next::Encode<
1421 ::fidl_next_fuchsia_mem::wire::Range,
1422 <___T as ::fidl_next::Transport>::SendBuffer,
1423 >,
1424
1425 rights: impl ::fidl_next::Encode<
1426 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRight,
1427 <___T as ::fidl_next::Transport>::SendBuffer,
1428 >,
1429 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterVmo, ___T>
1430 where
1431 <___T as ::fidl_next::Transport>::SendBuffer:
1432 ::fidl_next::encoder::InternalHandleEncoder,
1433 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1434 {
1435 self.register_vmo_with(::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoRegisterRegisterVmoRequest {
1436
1437 vmo_id,
1438
1439 vmo,
1440
1441 rights,
1442
1443 })
1444 }
1445
1446 #[doc = " Registers a VMO and transfers ownership to the driver.\n vmo_id: The ID chosen by the client that will be used in operations on this VMO.\n vmo: The handle, offset, and size of this VMO. IO operations on this VMO will be relative to\n the offset and size specified here.\n rights: A bit field of SharedVmoRight values indicating how this VMO may be used. Callers\n should assume that the driver will map and/or pin the VMO using these rights.\n"]
1447 pub fn register_vmo_with<___R>(
1448 &self,
1449 request: ___R,
1450 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterVmo, ___T>
1451 where
1452 ___R: ::fidl_next::Encode<
1453 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoRequest,
1454 <___T as ::fidl_next::Transport>::SendBuffer,
1455 >,
1456{
1457 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1458 3593681058348550677,
1459 <super::RegisterVmo as ::fidl_next::Method>::FLEXIBILITY,
1460 request,
1461 ))
1462 }
1463
1464 #[doc = " Unmaps and/or unpins the VMO and returns the handle to the caller.\n"]
1465 pub fn unregister_vmo(
1466 &self,
1467
1468 vmo_id: impl ::fidl_next::Encode<
1469 ::fidl_next::wire::Uint32,
1470 <___T as ::fidl_next::Transport>::SendBuffer,
1471 >,
1472 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterVmo, ___T>
1473 where
1474 <___T as ::fidl_next::Transport>::SendBuffer:
1475 ::fidl_next::encoder::InternalHandleEncoder,
1476 {
1477 self.unregister_vmo_with(::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoRegisterUnregisterVmoRequest {
1478
1479 vmo_id,
1480
1481 })
1482 }
1483
1484 #[doc = " Unmaps and/or unpins the VMO and returns the handle to the caller.\n"]
1485 pub fn unregister_vmo_with<___R>(
1486 &self,
1487 request: ___R,
1488 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterVmo, ___T>
1489 where
1490 ___R: ::fidl_next::Encode<
1491 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoRequest,
1492 <___T as ::fidl_next::Transport>::SendBuffer,
1493 >,
1494{
1495 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1496 1266894365566071049,
1497 <super::UnregisterVmo as ::fidl_next::Method>::FLEXIBILITY,
1498 request,
1499 ))
1500 }
1501
1502 #[doc = " Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.\n"]
1503 pub fn transmit_vector(
1504 &self,
1505
1506 data: impl ::fidl_next::Encode<
1507 ::fidl_next::wire::Vector<'static, u8>,
1508 <___T as ::fidl_next::Transport>::SendBuffer,
1509 >,
1510 ) -> ::fidl_next::TwoWayFuture<'_, super::TransmitVector, ___T>
1511 where
1512 <___T as ::fidl_next::Transport>::SendBuffer:
1513 ::fidl_next::encoder::InternalHandleEncoder,
1514 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1515 {
1516 self.transmit_vector_with(crate::generic::DeviceTransmitVectorRequest { data })
1517 }
1518
1519 #[doc = " Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.\n"]
1520 pub fn transmit_vector_with<___R>(
1521 &self,
1522 request: ___R,
1523 ) -> ::fidl_next::TwoWayFuture<'_, super::TransmitVector, ___T>
1524 where
1525 ___R: ::fidl_next::Encode<
1526 crate::wire::DeviceTransmitVectorRequest<'static>,
1527 <___T as ::fidl_next::Transport>::SendBuffer,
1528 >,
1529 {
1530 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1531 5091362422849398226,
1532 <super::TransmitVector as ::fidl_next::Method>::FLEXIBILITY,
1533 request,
1534 ))
1535 }
1536
1537 #[doc = " Half-duplex receive data from a SPI device; always reads the full size requested.\n"]
1538 pub fn receive_vector(
1539 &self,
1540
1541 size: impl ::fidl_next::Encode<
1542 ::fidl_next::wire::Uint32,
1543 <___T as ::fidl_next::Transport>::SendBuffer,
1544 >,
1545 ) -> ::fidl_next::TwoWayFuture<'_, super::ReceiveVector, ___T>
1546 where
1547 <___T as ::fidl_next::Transport>::SendBuffer:
1548 ::fidl_next::encoder::InternalHandleEncoder,
1549 {
1550 self.receive_vector_with(crate::generic::DeviceReceiveVectorRequest { size })
1551 }
1552
1553 #[doc = " Half-duplex receive data from a SPI device; always reads the full size requested.\n"]
1554 pub fn receive_vector_with<___R>(
1555 &self,
1556 request: ___R,
1557 ) -> ::fidl_next::TwoWayFuture<'_, super::ReceiveVector, ___T>
1558 where
1559 ___R: ::fidl_next::Encode<
1560 crate::wire::DeviceReceiveVectorRequest,
1561 <___T as ::fidl_next::Transport>::SendBuffer,
1562 >,
1563 {
1564 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1565 4013095315797000150,
1566 <super::ReceiveVector as ::fidl_next::Method>::FLEXIBILITY,
1567 request,
1568 ))
1569 }
1570
1571 #[doc = " Full-duplex SPI transaction. Received data will exactly equal the length of the transmit\n buffer.\n"]
1572 pub fn exchange_vector(
1573 &self,
1574
1575 txdata: impl ::fidl_next::Encode<
1576 ::fidl_next::wire::Vector<'static, u8>,
1577 <___T as ::fidl_next::Transport>::SendBuffer,
1578 >,
1579 ) -> ::fidl_next::TwoWayFuture<'_, super::ExchangeVector, ___T>
1580 where
1581 <___T as ::fidl_next::Transport>::SendBuffer:
1582 ::fidl_next::encoder::InternalHandleEncoder,
1583 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1584 {
1585 self.exchange_vector_with(crate::generic::DeviceExchangeVectorRequest { txdata })
1586 }
1587
1588 #[doc = " Full-duplex SPI transaction. Received data will exactly equal the length of the transmit\n buffer.\n"]
1589 pub fn exchange_vector_with<___R>(
1590 &self,
1591 request: ___R,
1592 ) -> ::fidl_next::TwoWayFuture<'_, super::ExchangeVector, ___T>
1593 where
1594 ___R: ::fidl_next::Encode<
1595 crate::wire::DeviceExchangeVectorRequest<'static>,
1596 <___T as ::fidl_next::Transport>::SendBuffer,
1597 >,
1598 {
1599 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1600 9199936960863142845,
1601 <super::ExchangeVector as ::fidl_next::Method>::FLEXIBILITY,
1602 request,
1603 ))
1604 }
1605
1606 #[doc = " Returns true if the device can call |AssertCs()| and |DeassertCs()|.\n"]
1607 pub fn can_assert_cs(&self) -> ::fidl_next::TwoWayFuture<'_, super::CanAssertCs, ___T> {
1608 ::fidl_next::TwoWayFuture::from_untyped(
1609 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1610 2273212530067875956,
1611 <super::CanAssertCs as ::fidl_next::Method>::FLEXIBILITY,
1612 (),
1613 ),
1614 )
1615 }
1616
1617 #[doc = " Assert CS for this device.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
1618 pub fn assert_cs(&self) -> ::fidl_next::TwoWayFuture<'_, super::AssertCs, ___T> {
1619 ::fidl_next::TwoWayFuture::from_untyped(
1620 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1621 5761910272765271270,
1622 <super::AssertCs as ::fidl_next::Method>::FLEXIBILITY,
1623 (),
1624 ),
1625 )
1626 }
1627
1628 #[doc = " Deassert CS for this device.\n Returns ZX_ERR_BAD_STATE if CS is already deasserted.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
1629 pub fn deassert_cs(&self) -> ::fidl_next::TwoWayFuture<'_, super::DeassertCs, ___T> {
1630 ::fidl_next::TwoWayFuture::from_untyped(
1631 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1632 6795041648297119160,
1633 <super::DeassertCs as ::fidl_next::Method>::FLEXIBILITY,
1634 (),
1635 ),
1636 )
1637 }
1638 }
1639
1640 #[repr(transparent)]
1642 pub struct DeviceServer<___T: ::fidl_next::Transport> {
1643 server: ::fidl_next::protocol::Server<___T>,
1644 }
1645
1646 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1647 }
1648}
1649
1650#[diagnostic::on_unimplemented(
1651 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1652)]
1653
1654pub trait DeviceLocalClientHandler<
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}
1663
1664impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
1665where
1666 ___H: DeviceLocalClientHandler<___T>,
1667 ___T: ::fidl_next::Transport,
1668{
1669 async fn on_event(
1670 handler: &mut ___H,
1671 mut message: ::fidl_next::Message<___T>,
1672 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1673 match *message.header().ordinal {
1674 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1675 }
1676 }
1677}
1678
1679#[diagnostic::on_unimplemented(
1680 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1681)]
1682
1683pub trait DeviceLocalServerHandler<
1687 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1688 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1689>
1690{
1691 #[doc = " Sends the data in buffer to the device.\n"]
1692 fn transmit(
1693 &mut self,
1694
1695 request: ::fidl_next::Request<device::Transmit, ___T>,
1696
1697 responder: ::fidl_next::Responder<device::Transmit, ___T>,
1698 ) -> impl ::core::future::Future<Output = ()>;
1699
1700 #[doc = " Receives data from the device into buffer.\n"]
1701 fn receive(
1702 &mut self,
1703
1704 request: ::fidl_next::Request<device::Receive, ___T>,
1705
1706 responder: ::fidl_next::Responder<device::Receive, ___T>,
1707 ) -> impl ::core::future::Future<Output = ()>;
1708
1709 #[doc = " Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must\n be the same.\n"]
1710 fn exchange(
1711 &mut self,
1712
1713 request: ::fidl_next::Request<device::Exchange, ___T>,
1714
1715 responder: ::fidl_next::Responder<device::Exchange, ___T>,
1716 ) -> impl ::core::future::Future<Output = ()>;
1717
1718 #[doc = " Registers a VMO and transfers ownership to the driver.\n vmo_id: The ID chosen by the client that will be used in operations on this VMO.\n vmo: The handle, offset, and size of this VMO. IO operations on this VMO will be relative to\n the offset and size specified here.\n rights: A bit field of SharedVmoRight values indicating how this VMO may be used. Callers\n should assume that the driver will map and/or pin the VMO using these rights.\n"]
1719 fn register_vmo(
1720 &mut self,
1721
1722 request: ::fidl_next::Request<device::RegisterVmo, ___T>,
1723
1724 responder: ::fidl_next::Responder<device::RegisterVmo, ___T>,
1725 ) -> impl ::core::future::Future<Output = ()>;
1726
1727 #[doc = " Unmaps and/or unpins the VMO and returns the handle to the caller.\n"]
1728 fn unregister_vmo(
1729 &mut self,
1730
1731 request: ::fidl_next::Request<device::UnregisterVmo, ___T>,
1732
1733 responder: ::fidl_next::Responder<device::UnregisterVmo, ___T>,
1734 ) -> impl ::core::future::Future<Output = ()>;
1735
1736 #[doc = " Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.\n"]
1737 fn transmit_vector(
1738 &mut self,
1739
1740 request: ::fidl_next::Request<device::TransmitVector, ___T>,
1741
1742 responder: ::fidl_next::Responder<device::TransmitVector, ___T>,
1743 ) -> impl ::core::future::Future<Output = ()>;
1744
1745 #[doc = " Half-duplex receive data from a SPI device; always reads the full size requested.\n"]
1746 fn receive_vector(
1747 &mut self,
1748
1749 request: ::fidl_next::Request<device::ReceiveVector, ___T>,
1750
1751 responder: ::fidl_next::Responder<device::ReceiveVector, ___T>,
1752 ) -> impl ::core::future::Future<Output = ()>;
1753
1754 #[doc = " Full-duplex SPI transaction. Received data will exactly equal the length of the transmit\n buffer.\n"]
1755 fn exchange_vector(
1756 &mut self,
1757
1758 request: ::fidl_next::Request<device::ExchangeVector, ___T>,
1759
1760 responder: ::fidl_next::Responder<device::ExchangeVector, ___T>,
1761 ) -> impl ::core::future::Future<Output = ()>;
1762
1763 #[doc = " Returns true if the device can call |AssertCs()| and |DeassertCs()|.\n"]
1764 fn can_assert_cs(
1765 &mut self,
1766
1767 responder: ::fidl_next::Responder<device::CanAssertCs, ___T>,
1768 ) -> impl ::core::future::Future<Output = ()>;
1769
1770 #[doc = " Assert CS for this device.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
1771 fn assert_cs(
1772 &mut self,
1773
1774 responder: ::fidl_next::Responder<device::AssertCs, ___T>,
1775 ) -> impl ::core::future::Future<Output = ()>;
1776
1777 #[doc = " Deassert CS for this device.\n Returns ZX_ERR_BAD_STATE if CS is already deasserted.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
1778 fn deassert_cs(
1779 &mut self,
1780
1781 responder: ::fidl_next::Responder<device::DeassertCs, ___T>,
1782 ) -> impl ::core::future::Future<Output = ()>;
1783}
1784
1785impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
1786where
1787 ___H: DeviceLocalServerHandler<___T> ,
1788 ___T: ::fidl_next::Transport,
1789
1790
1791 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitRequest: ::fidl_next::Decode<
1792 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1793 Constraint = (),
1794 >,
1795
1796
1797
1798 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveRequest: ::fidl_next::Decode<
1799 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1800 Constraint = (),
1801 >,
1802
1803
1804
1805 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeRequest: ::fidl_next::Decode<
1806 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1807 Constraint = (),
1808 >,
1809
1810
1811
1812 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoRequest: ::fidl_next::Decode<
1813 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1814 Constraint = (),
1815 >,
1816
1817
1818
1819 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoRequest: ::fidl_next::Decode<
1820 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1821 Constraint = (),
1822 >,
1823
1824
1825
1826 for<'de> crate::wire::DeviceTransmitVectorRequest<'de>: ::fidl_next::Decode<
1827 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1828 Constraint = (),
1829 >,
1830
1831
1832
1833 for<'de> crate::wire::DeviceReceiveVectorRequest: ::fidl_next::Decode<
1834 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1835 Constraint = (),
1836 >,
1837
1838
1839
1840 for<'de> crate::wire::DeviceExchangeVectorRequest<'de>: ::fidl_next::Decode<
1841 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1842 Constraint = (),
1843 >,
1844
1845
1846
1847
1848
1849
1850
1851
1852{
1853 async fn on_one_way(
1854 handler: &mut ___H,
1855 mut message: ::fidl_next::Message<___T>,
1856 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
1857 match *message.header().ordinal {
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892 ordinal => {
1893
1894 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1895
1896 }
1897 }
1898 }
1899
1900 async fn on_two_way(
1901 handler: &mut ___H,
1902 mut message: ::fidl_next::Message<___T>,
1903 responder: ::fidl_next::protocol::Responder<___T>,
1904 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
1905 match *message.header().ordinal {
1906
1907
1908
1909 8726129880940523711 => {
1910 let responder = ::fidl_next::Responder::from_untyped(responder);
1911
1912 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1913 Ok(decoded) => {
1914 handler.transmit(::fidl_next::Request::from_decoded(decoded), responder).await;
1915 Ok(())
1916 }
1917 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1918 ordinal: 8726129880940523711,
1919 error,
1920 }),
1921 }
1922
1923 }
1924
1925
1926
1927
1928 2031572499837475673 => {
1929 let responder = ::fidl_next::Responder::from_untyped(responder);
1930
1931 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1932 Ok(decoded) => {
1933 handler.receive(::fidl_next::Request::from_decoded(decoded), responder).await;
1934 Ok(())
1935 }
1936 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1937 ordinal: 2031572499837475673,
1938 error,
1939 }),
1940 }
1941
1942 }
1943
1944
1945
1946
1947 7915872066671078604 => {
1948 let responder = ::fidl_next::Responder::from_untyped(responder);
1949
1950 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1951 Ok(decoded) => {
1952 handler.exchange(::fidl_next::Request::from_decoded(decoded), responder).await;
1953 Ok(())
1954 }
1955 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1956 ordinal: 7915872066671078604,
1957 error,
1958 }),
1959 }
1960
1961 }
1962
1963
1964
1965
1966 3593681058348550677 => {
1967 let responder = ::fidl_next::Responder::from_untyped(responder);
1968
1969 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1970 Ok(decoded) => {
1971 handler.register_vmo(::fidl_next::Request::from_decoded(decoded), responder).await;
1972 Ok(())
1973 }
1974 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1975 ordinal: 3593681058348550677,
1976 error,
1977 }),
1978 }
1979
1980 }
1981
1982
1983
1984
1985 1266894365566071049 => {
1986 let responder = ::fidl_next::Responder::from_untyped(responder);
1987
1988 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1989 Ok(decoded) => {
1990 handler.unregister_vmo(::fidl_next::Request::from_decoded(decoded), responder).await;
1991 Ok(())
1992 }
1993 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1994 ordinal: 1266894365566071049,
1995 error,
1996 }),
1997 }
1998
1999 }
2000
2001
2002
2003
2004 5091362422849398226 => {
2005 let responder = ::fidl_next::Responder::from_untyped(responder);
2006
2007 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2008 Ok(decoded) => {
2009 handler.transmit_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2010 Ok(())
2011 }
2012 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2013 ordinal: 5091362422849398226,
2014 error,
2015 }),
2016 }
2017
2018 }
2019
2020
2021
2022
2023 4013095315797000150 => {
2024 let responder = ::fidl_next::Responder::from_untyped(responder);
2025
2026 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2027 Ok(decoded) => {
2028 handler.receive_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2029 Ok(())
2030 }
2031 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2032 ordinal: 4013095315797000150,
2033 error,
2034 }),
2035 }
2036
2037 }
2038
2039
2040
2041
2042 9199936960863142845 => {
2043 let responder = ::fidl_next::Responder::from_untyped(responder);
2044
2045 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2046 Ok(decoded) => {
2047 handler.exchange_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2048 Ok(())
2049 }
2050 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2051 ordinal: 9199936960863142845,
2052 error,
2053 }),
2054 }
2055
2056 }
2057
2058
2059
2060
2061 2273212530067875956 => {
2062 let responder = ::fidl_next::Responder::from_untyped(responder);
2063
2064 handler.can_assert_cs(responder).await;
2065 Ok(())
2066
2067 }
2068
2069
2070
2071
2072 5761910272765271270 => {
2073 let responder = ::fidl_next::Responder::from_untyped(responder);
2074
2075 handler.assert_cs(responder).await;
2076 Ok(())
2077
2078 }
2079
2080
2081
2082
2083 6795041648297119160 => {
2084 let responder = ::fidl_next::Responder::from_untyped(responder);
2085
2086 handler.deassert_cs(responder).await;
2087 Ok(())
2088
2089 }
2090
2091
2092 ordinal => {
2093
2094 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2095
2096 }
2097 }
2098 }
2099}
2100
2101pub trait DeviceClientHandler<
2105 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2106 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2107>
2108{
2109}
2110
2111impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
2112where
2113 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
2114 ___T: ::fidl_next::Transport,
2115{
2116 async fn on_event(
2117 handler: &mut ___H,
2118 mut message: ::fidl_next::Message<___T>,
2119 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2120 match *message.header().ordinal {
2121 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
2122 }
2123 }
2124}
2125
2126pub trait DeviceServerHandler<
2130 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2131 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2132>
2133{
2134 #[doc = " Sends the data in buffer to the device.\n"]
2135 fn transmit(
2136 &mut self,
2137
2138 request: ::fidl_next::Request<device::Transmit, ___T>,
2139
2140 responder: ::fidl_next::Responder<device::Transmit, ___T>,
2141 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2142
2143 #[doc = " Receives data from the device into buffer.\n"]
2144 fn receive(
2145 &mut self,
2146
2147 request: ::fidl_next::Request<device::Receive, ___T>,
2148
2149 responder: ::fidl_next::Responder<device::Receive, ___T>,
2150 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2151
2152 #[doc = " Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must\n be the same.\n"]
2153 fn exchange(
2154 &mut self,
2155
2156 request: ::fidl_next::Request<device::Exchange, ___T>,
2157
2158 responder: ::fidl_next::Responder<device::Exchange, ___T>,
2159 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2160
2161 #[doc = " Registers a VMO and transfers ownership to the driver.\n vmo_id: The ID chosen by the client that will be used in operations on this VMO.\n vmo: The handle, offset, and size of this VMO. IO operations on this VMO will be relative to\n the offset and size specified here.\n rights: A bit field of SharedVmoRight values indicating how this VMO may be used. Callers\n should assume that the driver will map and/or pin the VMO using these rights.\n"]
2162 fn register_vmo(
2163 &mut self,
2164
2165 request: ::fidl_next::Request<device::RegisterVmo, ___T>,
2166
2167 responder: ::fidl_next::Responder<device::RegisterVmo, ___T>,
2168 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2169
2170 #[doc = " Unmaps and/or unpins the VMO and returns the handle to the caller.\n"]
2171 fn unregister_vmo(
2172 &mut self,
2173
2174 request: ::fidl_next::Request<device::UnregisterVmo, ___T>,
2175
2176 responder: ::fidl_next::Responder<device::UnregisterVmo, ___T>,
2177 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2178
2179 #[doc = " Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.\n"]
2180 fn transmit_vector(
2181 &mut self,
2182
2183 request: ::fidl_next::Request<device::TransmitVector, ___T>,
2184
2185 responder: ::fidl_next::Responder<device::TransmitVector, ___T>,
2186 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2187
2188 #[doc = " Half-duplex receive data from a SPI device; always reads the full size requested.\n"]
2189 fn receive_vector(
2190 &mut self,
2191
2192 request: ::fidl_next::Request<device::ReceiveVector, ___T>,
2193
2194 responder: ::fidl_next::Responder<device::ReceiveVector, ___T>,
2195 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2196
2197 #[doc = " Full-duplex SPI transaction. Received data will exactly equal the length of the transmit\n buffer.\n"]
2198 fn exchange_vector(
2199 &mut self,
2200
2201 request: ::fidl_next::Request<device::ExchangeVector, ___T>,
2202
2203 responder: ::fidl_next::Responder<device::ExchangeVector, ___T>,
2204 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2205
2206 #[doc = " Returns true if the device can call |AssertCs()| and |DeassertCs()|.\n"]
2207 fn can_assert_cs(
2208 &mut self,
2209
2210 responder: ::fidl_next::Responder<device::CanAssertCs, ___T>,
2211 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2212
2213 #[doc = " Assert CS for this device.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
2214 fn assert_cs(
2215 &mut self,
2216
2217 responder: ::fidl_next::Responder<device::AssertCs, ___T>,
2218 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2219
2220 #[doc = " Deassert CS for this device.\n Returns ZX_ERR_BAD_STATE if CS is already deasserted.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
2221 fn deassert_cs(
2222 &mut self,
2223
2224 responder: ::fidl_next::Responder<device::DeassertCs, ___T>,
2225 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2226}
2227
2228impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
2229where
2230 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
2231 ___T: ::fidl_next::Transport,
2232
2233
2234 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitRequest: ::fidl_next::Decode<
2235 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2236 Constraint = (),
2237 >,
2238
2239
2240
2241 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveRequest: ::fidl_next::Decode<
2242 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2243 Constraint = (),
2244 >,
2245
2246
2247
2248 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeRequest: ::fidl_next::Decode<
2249 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2250 Constraint = (),
2251 >,
2252
2253
2254
2255 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoRequest: ::fidl_next::Decode<
2256 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2257 Constraint = (),
2258 >,
2259
2260
2261
2262 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoRequest: ::fidl_next::Decode<
2263 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2264 Constraint = (),
2265 >,
2266
2267
2268
2269 for<'de> crate::wire::DeviceTransmitVectorRequest<'de>: ::fidl_next::Decode<
2270 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2271 Constraint = (),
2272 >,
2273
2274
2275
2276 for<'de> crate::wire::DeviceReceiveVectorRequest: ::fidl_next::Decode<
2277 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2278 Constraint = (),
2279 >,
2280
2281
2282
2283 for<'de> crate::wire::DeviceExchangeVectorRequest<'de>: ::fidl_next::Decode<
2284 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2285 Constraint = (),
2286 >,
2287
2288
2289
2290
2291
2292
2293
2294
2295{
2296 async fn on_one_way(
2297 handler: &mut ___H,
2298 mut message: ::fidl_next::Message<___T>,
2299 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
2300 match *message.header().ordinal {
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335 ordinal => {
2336
2337 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2338
2339 }
2340 }
2341 }
2342
2343 async fn on_two_way(
2344 handler: &mut ___H,
2345 mut message: ::fidl_next::Message<___T>,
2346 responder: ::fidl_next::protocol::Responder<___T>,
2347 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
2348 match *message.header().ordinal {
2349
2350
2351
2352 8726129880940523711 => {
2353 let responder = ::fidl_next::Responder::from_untyped(responder);
2354
2355 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2356 Ok(decoded) => {
2357 handler.transmit(::fidl_next::Request::from_decoded(decoded), responder).await;
2358 Ok(())
2359 }
2360 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2361 ordinal: 8726129880940523711,
2362 error,
2363 }),
2364 }
2365
2366 }
2367
2368
2369
2370
2371 2031572499837475673 => {
2372 let responder = ::fidl_next::Responder::from_untyped(responder);
2373
2374 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2375 Ok(decoded) => {
2376 handler.receive(::fidl_next::Request::from_decoded(decoded), responder).await;
2377 Ok(())
2378 }
2379 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2380 ordinal: 2031572499837475673,
2381 error,
2382 }),
2383 }
2384
2385 }
2386
2387
2388
2389
2390 7915872066671078604 => {
2391 let responder = ::fidl_next::Responder::from_untyped(responder);
2392
2393 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2394 Ok(decoded) => {
2395 handler.exchange(::fidl_next::Request::from_decoded(decoded), responder).await;
2396 Ok(())
2397 }
2398 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2399 ordinal: 7915872066671078604,
2400 error,
2401 }),
2402 }
2403
2404 }
2405
2406
2407
2408
2409 3593681058348550677 => {
2410 let responder = ::fidl_next::Responder::from_untyped(responder);
2411
2412 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2413 Ok(decoded) => {
2414 handler.register_vmo(::fidl_next::Request::from_decoded(decoded), responder).await;
2415 Ok(())
2416 }
2417 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2418 ordinal: 3593681058348550677,
2419 error,
2420 }),
2421 }
2422
2423 }
2424
2425
2426
2427
2428 1266894365566071049 => {
2429 let responder = ::fidl_next::Responder::from_untyped(responder);
2430
2431 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2432 Ok(decoded) => {
2433 handler.unregister_vmo(::fidl_next::Request::from_decoded(decoded), responder).await;
2434 Ok(())
2435 }
2436 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2437 ordinal: 1266894365566071049,
2438 error,
2439 }),
2440 }
2441
2442 }
2443
2444
2445
2446
2447 5091362422849398226 => {
2448 let responder = ::fidl_next::Responder::from_untyped(responder);
2449
2450 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2451 Ok(decoded) => {
2452 handler.transmit_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2453 Ok(())
2454 }
2455 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2456 ordinal: 5091362422849398226,
2457 error,
2458 }),
2459 }
2460
2461 }
2462
2463
2464
2465
2466 4013095315797000150 => {
2467 let responder = ::fidl_next::Responder::from_untyped(responder);
2468
2469 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2470 Ok(decoded) => {
2471 handler.receive_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2472 Ok(())
2473 }
2474 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2475 ordinal: 4013095315797000150,
2476 error,
2477 }),
2478 }
2479
2480 }
2481
2482
2483
2484
2485 9199936960863142845 => {
2486 let responder = ::fidl_next::Responder::from_untyped(responder);
2487
2488 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2489 Ok(decoded) => {
2490 handler.exchange_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2491 Ok(())
2492 }
2493 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2494 ordinal: 9199936960863142845,
2495 error,
2496 }),
2497 }
2498
2499 }
2500
2501
2502
2503
2504 2273212530067875956 => {
2505 let responder = ::fidl_next::Responder::from_untyped(responder);
2506
2507 handler.can_assert_cs(responder).await;
2508 Ok(())
2509
2510 }
2511
2512
2513
2514
2515 5761910272765271270 => {
2516 let responder = ::fidl_next::Responder::from_untyped(responder);
2517
2518 handler.assert_cs(responder).await;
2519 Ok(())
2520
2521 }
2522
2523
2524
2525
2526 6795041648297119160 => {
2527 let responder = ::fidl_next::Responder::from_untyped(responder);
2528
2529 handler.deassert_cs(responder).await;
2530 Ok(())
2531
2532 }
2533
2534
2535 ordinal => {
2536
2537 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2538
2539 }
2540 }
2541 }
2542}
2543
2544impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
2545{}
2546
2547impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2548where
2549 ___H: DeviceClientHandler<___T>,
2550 ___T: ::fidl_next::Transport,
2551{
2552}
2553
2554impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2555where
2556 ___H: DeviceServerHandler<___T>,
2557 ___T: ::fidl_next::Transport,
2558{
2559 async fn transmit(
2560 &mut self,
2561
2562 request: ::fidl_next::Request<device::Transmit, ___T>,
2563
2564 responder: ::fidl_next::Responder<device::Transmit, ___T>,
2565 ) {
2566 ___H::transmit(&mut self.0, request, responder).await
2567 }
2568
2569 async fn receive(
2570 &mut self,
2571
2572 request: ::fidl_next::Request<device::Receive, ___T>,
2573
2574 responder: ::fidl_next::Responder<device::Receive, ___T>,
2575 ) {
2576 ___H::receive(&mut self.0, request, responder).await
2577 }
2578
2579 async fn exchange(
2580 &mut self,
2581
2582 request: ::fidl_next::Request<device::Exchange, ___T>,
2583
2584 responder: ::fidl_next::Responder<device::Exchange, ___T>,
2585 ) {
2586 ___H::exchange(&mut self.0, request, responder).await
2587 }
2588
2589 async fn register_vmo(
2590 &mut self,
2591
2592 request: ::fidl_next::Request<device::RegisterVmo, ___T>,
2593
2594 responder: ::fidl_next::Responder<device::RegisterVmo, ___T>,
2595 ) {
2596 ___H::register_vmo(&mut self.0, request, responder).await
2597 }
2598
2599 async fn unregister_vmo(
2600 &mut self,
2601
2602 request: ::fidl_next::Request<device::UnregisterVmo, ___T>,
2603
2604 responder: ::fidl_next::Responder<device::UnregisterVmo, ___T>,
2605 ) {
2606 ___H::unregister_vmo(&mut self.0, request, responder).await
2607 }
2608
2609 async fn transmit_vector(
2610 &mut self,
2611
2612 request: ::fidl_next::Request<device::TransmitVector, ___T>,
2613
2614 responder: ::fidl_next::Responder<device::TransmitVector, ___T>,
2615 ) {
2616 ___H::transmit_vector(&mut self.0, request, responder).await
2617 }
2618
2619 async fn receive_vector(
2620 &mut self,
2621
2622 request: ::fidl_next::Request<device::ReceiveVector, ___T>,
2623
2624 responder: ::fidl_next::Responder<device::ReceiveVector, ___T>,
2625 ) {
2626 ___H::receive_vector(&mut self.0, request, responder).await
2627 }
2628
2629 async fn exchange_vector(
2630 &mut self,
2631
2632 request: ::fidl_next::Request<device::ExchangeVector, ___T>,
2633
2634 responder: ::fidl_next::Responder<device::ExchangeVector, ___T>,
2635 ) {
2636 ___H::exchange_vector(&mut self.0, request, responder).await
2637 }
2638
2639 async fn can_assert_cs(
2640 &mut self,
2641
2642 responder: ::fidl_next::Responder<device::CanAssertCs, ___T>,
2643 ) {
2644 ___H::can_assert_cs(&mut self.0, responder).await
2645 }
2646
2647 async fn assert_cs(&mut self, responder: ::fidl_next::Responder<device::AssertCs, ___T>) {
2648 ___H::assert_cs(&mut self.0, responder).await
2649 }
2650
2651 async fn deassert_cs(&mut self, responder: ::fidl_next::Responder<device::DeassertCs, ___T>) {
2652 ___H::deassert_cs(&mut self.0, responder).await
2653 }
2654}
2655
2656#[derive(Debug)]
2658pub struct Service;
2659
2660impl ::fidl_next::DiscoverableService for Service {
2661 const SERVICE_NAME: &'static str = "fuchsia.hardware.spi.Service";
2662 const MEMBER_NAMES: &'static [&'static str] = &["device"];
2663}
2664
2665impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for Service {}
2666
2667impl<___C> ::fidl_next::Service<___C> for Service
2668where
2669 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2670{
2671 type Connector = ServiceConnector<___C>;
2672}
2673
2674#[repr(transparent)]
2676pub struct ServiceConnector<___C> {
2677 #[allow(dead_code)]
2678 connector: ___C,
2679}
2680
2681impl<___C> ServiceConnector<___C>
2682where
2683 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2684{
2685 pub fn device(
2687 &self,
2688 server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2689 ) -> ::core::result::Result<
2690 (),
2691 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2692 > {
2693 ::fidl_next::protocol::ServiceConnector::<
2694 ::fidl_next::fuchsia::zx::Channel
2695 >::connect_to_member(
2696 &self.connector,
2697 "device",
2698 server_end.into_untyped(),
2699 )
2700 }
2701}
2702
2703pub trait ServiceHandler {
2705 fn device(
2707 &self,
2708 server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2709 );
2710}
2711
2712impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for Service
2713where
2714 ___H: ServiceHandler,
2715 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2716{
2717 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2718 use ::fidl_next::InstanceFromServiceTransport;
2719 match member {
2720 "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
2721 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2722 )),
2723
2724 _ => unreachable!(),
2725 }
2726 }
2727}
2728
2729#[derive(PartialEq, Debug)]
2731pub struct Test;
2732
2733#[cfg(target_os = "fuchsia")]
2734impl ::fidl_next::HasTransport for Test {
2735 type Transport = ::fidl_next::fuchsia::zx::Channel;
2736}
2737
2738pub mod test {
2739 pub mod prelude {
2740 pub use crate::{
2741 Test, TestClientHandler, TestLocalClientHandler, TestLocalServerHandler,
2742 TestServerHandler, test,
2743 };
2744
2745 pub use ::fidl_next_fuchsia_driver_token::natural::NodeTokenGetResponse;
2746
2747 pub use crate::natural::TestConnectSpiLoopbackRequest;
2748
2749 pub use crate::natural::TestConnectSpiLoopbackResponse;
2750 }
2751
2752 pub struct Get;
2753
2754 impl ::fidl_next::Method for Get {
2755 const ORDINAL: u64 = 7212073050437890521;
2756 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2757 ::fidl_next::protocol::Flexibility::Strict;
2758
2759 type Protocol = crate::Test;
2760
2761 type Request = ::fidl_next::wire::EmptyMessageBody;
2762 }
2763
2764 impl ::fidl_next::TwoWayMethod for Get {
2765 type Response = ::fidl_next::wire::Result<
2766 'static,
2767 ::fidl_next_fuchsia_driver_token::wire::NodeTokenGetResponse,
2768 ::fidl_next::wire::Int32,
2769 >;
2770 }
2771
2772 impl<___R> ::fidl_next::Respond<___R> for Get {
2773 type Output = ::core::result::Result<
2774 ::fidl_next_fuchsia_driver_token::generic::NodeTokenGetResponse<___R>,
2775 ::fidl_next::never::Never,
2776 >;
2777
2778 fn respond(response: ___R) -> Self::Output {
2779 ::core::result::Result::Ok(
2780 ::fidl_next_fuchsia_driver_token::generic::NodeTokenGetResponse { token: response },
2781 )
2782 }
2783 }
2784
2785 impl<___R> ::fidl_next::RespondErr<___R> for Get {
2786 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2787
2788 fn respond_err(response: ___R) -> Self::Output {
2789 ::core::result::Result::Err(response)
2790 }
2791 }
2792
2793 pub struct ConnectSpiLoopback;
2794
2795 impl ::fidl_next::Method for ConnectSpiLoopback {
2796 const ORDINAL: u64 = 4756931346235964202;
2797 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2798 ::fidl_next::protocol::Flexibility::Strict;
2799
2800 type Protocol = crate::Test;
2801
2802 type Request = crate::wire::TestConnectSpiLoopbackRequest;
2803 }
2804
2805 impl ::fidl_next::TwoWayMethod for ConnectSpiLoopback {
2806 type Response = ::fidl_next::wire::Result<
2807 'static,
2808 crate::wire::TestConnectSpiLoopbackResponse,
2809 ::fidl_next::wire::fuchsia::Status,
2810 >;
2811 }
2812
2813 impl<___R> ::fidl_next::Respond<___R> for ConnectSpiLoopback {
2814 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
2815
2816 fn respond(response: ___R) -> Self::Output {
2817 ::core::result::Result::Ok(response)
2818 }
2819 }
2820
2821 impl<___R> ::fidl_next::RespondErr<___R> for ConnectSpiLoopback {
2822 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2823
2824 fn respond_err(response: ___R) -> Self::Output {
2825 ::core::result::Result::Err(response)
2826 }
2827 }
2828
2829 mod ___detail {
2830 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Test
2831 where
2832 ___T: ::fidl_next::Transport,
2833 {
2834 type Client = TestClient<___T>;
2835 type Server = TestServer<___T>;
2836 }
2837
2838 #[repr(transparent)]
2840 pub struct TestClient<___T: ::fidl_next::Transport> {
2841 #[allow(dead_code)]
2842 client: ::fidl_next::protocol::Client<___T>,
2843 }
2844
2845 impl<___T> TestClient<___T>
2846 where
2847 ___T: ::fidl_next::Transport,
2848 {
2849 pub fn get(&self) -> ::fidl_next::TwoWayFuture<'_, super::Get, ___T> {
2850 ::fidl_next::TwoWayFuture::from_untyped(
2851 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
2852 7212073050437890521,
2853 <super::Get as ::fidl_next::Method>::FLEXIBILITY,
2854 (),
2855 ),
2856 )
2857 }
2858
2859 #[doc = " Opens a connection to a SPI device in loopback mode, to be used for testing.\n\n Returns ZX_ERR_NOT_SUPPORTED if debugging is not enabled in this build.\n\n If the SPI implementation driver itself does not support loopback mode, this call will\n succeed, but calls to the Device will fail with ZX_ERR_NOT_SUPPORTED instead.\n"]
2860 pub fn connect_spi_loopback(
2861 &self,
2862
2863 server: impl ::fidl_next::Encode<
2864 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
2865 <___T as ::fidl_next::Transport>::SendBuffer,
2866 >,
2867 ) -> ::fidl_next::TwoWayFuture<'_, super::ConnectSpiLoopback, ___T>
2868 where
2869 <___T as ::fidl_next::Transport>::SendBuffer:
2870 ::fidl_next::encoder::InternalHandleEncoder,
2871 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
2872 {
2873 self.connect_spi_loopback_with(crate::generic::TestConnectSpiLoopbackRequest {
2874 server,
2875 })
2876 }
2877
2878 #[doc = " Opens a connection to a SPI device in loopback mode, to be used for testing.\n\n Returns ZX_ERR_NOT_SUPPORTED if debugging is not enabled in this build.\n\n If the SPI implementation driver itself does not support loopback mode, this call will\n succeed, but calls to the Device will fail with ZX_ERR_NOT_SUPPORTED instead.\n"]
2879 pub fn connect_spi_loopback_with<___R>(
2880 &self,
2881 request: ___R,
2882 ) -> ::fidl_next::TwoWayFuture<'_, super::ConnectSpiLoopback, ___T>
2883 where
2884 ___R: ::fidl_next::Encode<
2885 crate::wire::TestConnectSpiLoopbackRequest,
2886 <___T as ::fidl_next::Transport>::SendBuffer,
2887 >,
2888 {
2889 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2890 4756931346235964202,
2891 <super::ConnectSpiLoopback as ::fidl_next::Method>::FLEXIBILITY,
2892 request,
2893 ))
2894 }
2895 }
2896
2897 #[repr(transparent)]
2899 pub struct TestServer<___T: ::fidl_next::Transport> {
2900 server: ::fidl_next::protocol::Server<___T>,
2901 }
2902
2903 impl<___T> TestServer<___T> where ___T: ::fidl_next::Transport {}
2904 }
2905}
2906
2907#[diagnostic::on_unimplemented(
2908 note = "If {Self} implements the non-local TestClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
2909)]
2910
2911pub trait TestLocalClientHandler<
2915 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2916 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2917>
2918{
2919 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2920 ::core::future::ready(())
2921 }
2922}
2923
2924impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Test
2925where
2926 ___H: TestLocalClientHandler<___T>,
2927 ___T: ::fidl_next::Transport,
2928{
2929 async fn on_event(
2930 handler: &mut ___H,
2931 mut message: ::fidl_next::Message<___T>,
2932 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2933 match *message.header().ordinal {
2934 ordinal => {
2935 handler.on_unknown_interaction(ordinal).await;
2936 if ::core::matches!(
2937 message.header().flexibility(),
2938 ::fidl_next::protocol::Flexibility::Strict
2939 ) {
2940 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2941 } else {
2942 Ok(())
2943 }
2944 }
2945 }
2946 }
2947}
2948
2949#[diagnostic::on_unimplemented(
2950 note = "If {Self} implements the non-local TestServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
2951)]
2952
2953pub trait TestLocalServerHandler<
2957 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2958 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2959>
2960{
2961 fn get(
2962 &mut self,
2963
2964 responder: ::fidl_next::Responder<test::Get, ___T>,
2965 ) -> impl ::core::future::Future<Output = ()>;
2966
2967 #[doc = " Opens a connection to a SPI device in loopback mode, to be used for testing.\n\n Returns ZX_ERR_NOT_SUPPORTED if debugging is not enabled in this build.\n\n If the SPI implementation driver itself does not support loopback mode, this call will\n succeed, but calls to the Device will fail with ZX_ERR_NOT_SUPPORTED instead.\n"]
2968 fn connect_spi_loopback(
2969 &mut self,
2970
2971 request: ::fidl_next::Request<test::ConnectSpiLoopback, ___T>,
2972
2973 responder: ::fidl_next::Responder<test::ConnectSpiLoopback, ___T>,
2974 ) -> impl ::core::future::Future<Output = ()>;
2975
2976 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2977 ::core::future::ready(())
2978 }
2979}
2980
2981impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Test
2982where
2983 ___H: TestLocalServerHandler<___T>,
2984 ___T: ::fidl_next::Transport,
2985 for<'de> crate::wire::TestConnectSpiLoopbackRequest: ::fidl_next::Decode<
2986 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2987 Constraint = (),
2988 >,
2989{
2990 async fn on_one_way(
2991 handler: &mut ___H,
2992 mut message: ::fidl_next::Message<___T>,
2993 ) -> ::core::result::Result<
2994 (),
2995 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2996 > {
2997 match *message.header().ordinal {
2998 ordinal => {
2999 handler.on_unknown_interaction(ordinal).await;
3000 if ::core::matches!(
3001 message.header().flexibility(),
3002 ::fidl_next::protocol::Flexibility::Strict
3003 ) {
3004 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3005 } else {
3006 Ok(())
3007 }
3008 }
3009 }
3010 }
3011
3012 async fn on_two_way(
3013 handler: &mut ___H,
3014 mut message: ::fidl_next::Message<___T>,
3015 responder: ::fidl_next::protocol::Responder<___T>,
3016 ) -> ::core::result::Result<
3017 (),
3018 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3019 > {
3020 match *message.header().ordinal {
3021 7212073050437890521 => {
3022 let responder = ::fidl_next::Responder::from_untyped(responder);
3023
3024 handler.get(responder).await;
3025 Ok(())
3026 }
3027
3028 4756931346235964202 => {
3029 let responder = ::fidl_next::Responder::from_untyped(responder);
3030
3031 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3032 Ok(decoded) => {
3033 handler
3034 .connect_spi_loopback(
3035 ::fidl_next::Request::from_decoded(decoded),
3036 responder,
3037 )
3038 .await;
3039 Ok(())
3040 }
3041 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3042 ordinal: 4756931346235964202,
3043 error,
3044 }),
3045 }
3046 }
3047
3048 ordinal => {
3049 handler.on_unknown_interaction(ordinal).await;
3050 if ::core::matches!(
3051 message.header().flexibility(),
3052 ::fidl_next::protocol::Flexibility::Strict
3053 ) {
3054 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3055 } else {
3056 responder
3057 .respond_framework_error(
3058 ordinal,
3059 ::fidl_next::FrameworkError::UnknownMethod,
3060 )
3061 .expect("encoding a framework error should never fail")
3062 .await?;
3063 Ok(())
3064 }
3065 }
3066 }
3067 }
3068}
3069
3070pub trait TestClientHandler<
3074 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3075 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3076>
3077{
3078 fn on_unknown_interaction(
3079 &mut self,
3080 ordinal: u64,
3081 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3082 ::core::future::ready(())
3083 }
3084}
3085
3086impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Test
3087where
3088 ___H: TestClientHandler<___T> + ::core::marker::Send,
3089 ___T: ::fidl_next::Transport,
3090{
3091 async fn on_event(
3092 handler: &mut ___H,
3093 mut message: ::fidl_next::Message<___T>,
3094 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3095 match *message.header().ordinal {
3096 ordinal => {
3097 handler.on_unknown_interaction(ordinal).await;
3098 if ::core::matches!(
3099 message.header().flexibility(),
3100 ::fidl_next::protocol::Flexibility::Strict
3101 ) {
3102 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3103 } else {
3104 Ok(())
3105 }
3106 }
3107 }
3108 }
3109}
3110
3111pub trait TestServerHandler<
3115 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3116 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3117>
3118{
3119 fn get(
3120 &mut self,
3121
3122 responder: ::fidl_next::Responder<test::Get, ___T>,
3123 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3124
3125 #[doc = " Opens a connection to a SPI device in loopback mode, to be used for testing.\n\n Returns ZX_ERR_NOT_SUPPORTED if debugging is not enabled in this build.\n\n If the SPI implementation driver itself does not support loopback mode, this call will\n succeed, but calls to the Device will fail with ZX_ERR_NOT_SUPPORTED instead.\n"]
3126 fn connect_spi_loopback(
3127 &mut self,
3128
3129 request: ::fidl_next::Request<test::ConnectSpiLoopback, ___T>,
3130
3131 responder: ::fidl_next::Responder<test::ConnectSpiLoopback, ___T>,
3132 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3133
3134 fn on_unknown_interaction(
3135 &mut self,
3136 ordinal: u64,
3137 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3138 ::core::future::ready(())
3139 }
3140}
3141
3142impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Test
3143where
3144 ___H: TestServerHandler<___T> + ::core::marker::Send,
3145 ___T: ::fidl_next::Transport,
3146 for<'de> crate::wire::TestConnectSpiLoopbackRequest: ::fidl_next::Decode<
3147 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3148 Constraint = (),
3149 >,
3150{
3151 async fn on_one_way(
3152 handler: &mut ___H,
3153 mut message: ::fidl_next::Message<___T>,
3154 ) -> ::core::result::Result<
3155 (),
3156 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3157 > {
3158 match *message.header().ordinal {
3159 ordinal => {
3160 handler.on_unknown_interaction(ordinal).await;
3161 if ::core::matches!(
3162 message.header().flexibility(),
3163 ::fidl_next::protocol::Flexibility::Strict
3164 ) {
3165 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3166 } else {
3167 Ok(())
3168 }
3169 }
3170 }
3171 }
3172
3173 async fn on_two_way(
3174 handler: &mut ___H,
3175 mut message: ::fidl_next::Message<___T>,
3176 responder: ::fidl_next::protocol::Responder<___T>,
3177 ) -> ::core::result::Result<
3178 (),
3179 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3180 > {
3181 match *message.header().ordinal {
3182 7212073050437890521 => {
3183 let responder = ::fidl_next::Responder::from_untyped(responder);
3184
3185 handler.get(responder).await;
3186 Ok(())
3187 }
3188
3189 4756931346235964202 => {
3190 let responder = ::fidl_next::Responder::from_untyped(responder);
3191
3192 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3193 Ok(decoded) => {
3194 handler
3195 .connect_spi_loopback(
3196 ::fidl_next::Request::from_decoded(decoded),
3197 responder,
3198 )
3199 .await;
3200 Ok(())
3201 }
3202 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3203 ordinal: 4756931346235964202,
3204 error,
3205 }),
3206 }
3207 }
3208
3209 ordinal => {
3210 handler.on_unknown_interaction(ordinal).await;
3211 if ::core::matches!(
3212 message.header().flexibility(),
3213 ::fidl_next::protocol::Flexibility::Strict
3214 ) {
3215 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3216 } else {
3217 responder
3218 .respond_framework_error(
3219 ordinal,
3220 ::fidl_next::FrameworkError::UnknownMethod,
3221 )
3222 .expect("encoding a framework error should never fail")
3223 .await?;
3224 Ok(())
3225 }
3226 }
3227 }
3228 }
3229}
3230
3231impl<___T> TestClientHandler<___T> for ::fidl_next::IgnoreEvents
3232where
3233 ___T: ::fidl_next::Transport,
3234{
3235 async fn on_unknown_interaction(&mut self, _: u64) {}
3236}
3237
3238impl<___H, ___T> TestLocalClientHandler<___T> for ::fidl_next::Local<___H>
3239where
3240 ___H: TestClientHandler<___T>,
3241 ___T: ::fidl_next::Transport,
3242{
3243 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3244 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3245 }
3246}
3247
3248impl<___H, ___T> TestLocalServerHandler<___T> for ::fidl_next::Local<___H>
3249where
3250 ___H: TestServerHandler<___T>,
3251 ___T: ::fidl_next::Transport,
3252{
3253 async fn get(&mut self, responder: ::fidl_next::Responder<test::Get, ___T>) {
3254 ___H::get(&mut self.0, responder).await
3255 }
3256
3257 async fn connect_spi_loopback(
3258 &mut self,
3259
3260 request: ::fidl_next::Request<test::ConnectSpiLoopback, ___T>,
3261
3262 responder: ::fidl_next::Responder<test::ConnectSpiLoopback, ___T>,
3263 ) {
3264 ___H::connect_spi_loopback(&mut self.0, request, responder).await
3265 }
3266
3267 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3268 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3269 }
3270}
3271
3272#[derive(Debug)]
3274pub struct TestService;
3275
3276impl ::fidl_next::DiscoverableService for TestService {
3277 const SERVICE_NAME: &'static str = "fuchsia.hardware.spi.TestService";
3278 const MEMBER_NAMES: &'static [&'static str] = &["test"];
3279}
3280
3281impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for TestService {}
3282
3283impl<___C> ::fidl_next::Service<___C> for TestService
3284where
3285 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
3286{
3287 type Connector = TestServiceConnector<___C>;
3288}
3289
3290#[repr(transparent)]
3292pub struct TestServiceConnector<___C> {
3293 #[allow(dead_code)]
3294 connector: ___C,
3295}
3296
3297impl<___C> TestServiceConnector<___C>
3298where
3299 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
3300{
3301 pub fn test(
3303 &self,
3304 server_end: ::fidl_next::ServerEnd<crate::Test, ::fidl_next::fuchsia::zx::Channel>,
3305 ) -> ::core::result::Result<
3306 (),
3307 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
3308 > {
3309 ::fidl_next::protocol::ServiceConnector::<
3310 ::fidl_next::fuchsia::zx::Channel
3311 >::connect_to_member(
3312 &self.connector,
3313 "test",
3314 server_end.into_untyped(),
3315 )
3316 }
3317}
3318
3319pub trait TestServiceHandler {
3321 fn test(
3323 &self,
3324 server_end: ::fidl_next::ServerEnd<crate::Test, ::fidl_next::fuchsia::zx::Channel>,
3325 );
3326}
3327
3328impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for TestService
3329where
3330 ___H: TestServiceHandler,
3331 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
3332{
3333 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
3334 use ::fidl_next::InstanceFromServiceTransport;
3335 match member {
3336 "test" => handler.test(::fidl_next::ServerEnd::from_untyped(
3337 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
3338 )),
3339
3340 _ => unreachable!(),
3341 }
3342 }
3343}
3344
3345pub use fidl_next_common_fuchsia_hardware_spi::*;