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