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
111pub mod wire {
112
113 pub use fidl_next_common_fuchsia_hardware_spi::wire::*;
114
115 #[derive(Debug)]
117 #[repr(C)]
118 pub struct ControllerOpenSessionRequest {
119 pub session: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
120 }
121
122 static_assertions::const_assert_eq!(std::mem::size_of::<ControllerOpenSessionRequest>(), 4);
123 static_assertions::const_assert_eq!(std::mem::align_of::<ControllerOpenSessionRequest>(), 4);
124
125 static_assertions::const_assert_eq!(
126 std::mem::offset_of!(ControllerOpenSessionRequest, session),
127 0
128 );
129
130 impl ::fidl_next::Constrained for ControllerOpenSessionRequest {
131 type Constraint = ();
132
133 fn validate(
134 _: ::fidl_next::Slot<'_, Self>,
135 _: Self::Constraint,
136 ) -> Result<(), ::fidl_next::ValidationError> {
137 Ok(())
138 }
139 }
140
141 unsafe impl ::fidl_next::Wire for ControllerOpenSessionRequest {
142 type Narrowed<'de> = ControllerOpenSessionRequest;
143
144 #[inline]
145 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
146 ::fidl_next::munge! {
147 let Self {
148 session,
149
150 } = &mut *out_;
151 }
152
153 ::fidl_next::Wire::zero_padding(session);
154 }
155 }
156
157 unsafe impl<___D> ::fidl_next::Decode<___D> for ControllerOpenSessionRequest
158 where
159 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
160 ___D: ::fidl_next::fuchsia::HandleDecoder,
161 {
162 fn decode(
163 slot_: ::fidl_next::Slot<'_, Self>,
164 decoder_: &mut ___D,
165 _: (),
166 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
167 ::fidl_next::munge! {
168 let Self {
169 mut session,
170
171 } = slot_;
172 }
173
174 let _field = session.as_mut();
175
176 ::fidl_next::Decode::decode(session.as_mut(), decoder_, ())?;
177
178 Ok(())
179 }
180 }
181
182 impl ::fidl_next::IntoNatural for ControllerOpenSessionRequest {
183 type Natural = crate::natural::ControllerOpenSessionRequest;
184 }
185}
186
187pub mod wire_optional {
188
189 pub use fidl_next_common_fuchsia_hardware_spi::wire_optional::*;
190}
191
192pub mod generic {
193
194 pub use fidl_next_common_fuchsia_hardware_spi::generic::*;
195
196 pub struct ControllerOpenSessionRequest<T0> {
198 pub session: T0,
199 }
200
201 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::ControllerOpenSessionRequest, ___E>
202 for ControllerOpenSessionRequest<T0>
203 where
204 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
205 ___E: ::fidl_next::fuchsia::HandleEncoder,
206 T0: ::fidl_next::Encode<
207 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
208 ___E,
209 >,
210 {
211 #[inline]
212 fn encode(
213 self,
214 encoder_: &mut ___E,
215 out_: &mut ::core::mem::MaybeUninit<crate::wire::ControllerOpenSessionRequest>,
216 _: (),
217 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
218 ::fidl_next::munge! {
219 let crate::wire::ControllerOpenSessionRequest {
220 session,
221
222 } = out_;
223 }
224
225 ::fidl_next::Encode::encode(self.session, encoder_, session, ())?;
226
227 Ok(())
228 }
229 }
230}
231
232pub use self::natural::*;
233
234#[derive(PartialEq, Debug)]
236pub struct Controller;
237
238#[cfg(target_os = "fuchsia")]
239impl ::fidl_next::HasTransport for Controller {
240 type Transport = ::fidl_next::fuchsia::zx::Channel;
241}
242
243pub mod controller {
244 pub mod prelude {
245 pub use crate::{
246 Controller, ControllerClientHandler, ControllerLocalClientHandler,
247 ControllerLocalServerHandler, ControllerServerHandler, controller,
248 };
249
250 pub use crate::natural::ControllerOpenSessionRequest;
251 }
252
253 pub struct OpenSession;
254
255 impl ::fidl_next::Method for OpenSession {
256 const ORDINAL: u64 = 1862345129906445108;
257 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
258 ::fidl_next::protocol::Flexibility::Strict;
259
260 type Protocol = crate::Controller;
261
262 type Request = crate::wire::ControllerOpenSessionRequest;
263 }
264
265 mod ___detail {
266 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Controller
267 where
268 ___T: ::fidl_next::Transport,
269 {
270 type Client = ControllerClient<___T>;
271 type Server = ControllerServer<___T>;
272 }
273
274 #[repr(transparent)]
276 pub struct ControllerClient<___T: ::fidl_next::Transport> {
277 #[allow(dead_code)]
278 client: ::fidl_next::protocol::Client<___T>,
279 }
280
281 impl<___T> ControllerClient<___T>
282 where
283 ___T: ::fidl_next::Transport,
284 {
285 #[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"]
286 pub fn open_session(
287 &self,
288
289 session: impl ::fidl_next::Encode<
290 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
291 <___T as ::fidl_next::Transport>::SendBuffer,
292 >,
293 ) -> ::fidl_next::SendFuture<'_, ___T>
294 where
295 <___T as ::fidl_next::Transport>::SendBuffer:
296 ::fidl_next::encoder::InternalHandleEncoder,
297 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
298 {
299 self.open_session_with(crate::generic::ControllerOpenSessionRequest { session })
300 }
301
302 #[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"]
303 pub fn open_session_with<___R>(
304 &self,
305 request: ___R,
306 ) -> ::fidl_next::SendFuture<'_, ___T>
307 where
308 ___R: ::fidl_next::Encode<
309 crate::wire::ControllerOpenSessionRequest,
310 <___T as ::fidl_next::Transport>::SendBuffer,
311 >,
312 {
313 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
314 1862345129906445108,
315 <super::OpenSession as ::fidl_next::Method>::FLEXIBILITY,
316 request,
317 ))
318 }
319 }
320
321 #[repr(transparent)]
323 pub struct ControllerServer<___T: ::fidl_next::Transport> {
324 server: ::fidl_next::protocol::Server<___T>,
325 }
326
327 impl<___T> ControllerServer<___T> where ___T: ::fidl_next::Transport {}
328 }
329}
330
331#[diagnostic::on_unimplemented(
332 note = "If {Self} implements the non-local ControllerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
333)]
334
335pub trait ControllerLocalClientHandler<
339 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
340 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
341>
342{
343}
344
345impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Controller
346where
347 ___H: ControllerLocalClientHandler<___T>,
348 ___T: ::fidl_next::Transport,
349{
350 async fn on_event(
351 handler: &mut ___H,
352 mut message: ::fidl_next::Message<___T>,
353 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
354 match *message.header().ordinal {
355 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
356 }
357 }
358}
359
360#[diagnostic::on_unimplemented(
361 note = "If {Self} implements the non-local ControllerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
362)]
363
364pub trait ControllerLocalServerHandler<
368 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
369 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
370>
371{
372 #[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"]
373 fn open_session(
374 &mut self,
375
376 request: ::fidl_next::Request<controller::OpenSession, ___T>,
377 ) -> impl ::core::future::Future<Output = ()>;
378}
379
380impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Controller
381where
382 ___H: ControllerLocalServerHandler<___T>,
383 ___T: ::fidl_next::Transport,
384 for<'de> crate::wire::ControllerOpenSessionRequest: ::fidl_next::Decode<
385 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
386 Constraint = (),
387 >,
388{
389 async fn on_one_way(
390 handler: &mut ___H,
391 mut message: ::fidl_next::Message<___T>,
392 ) -> ::core::result::Result<
393 (),
394 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
395 > {
396 match *message.header().ordinal {
397 1862345129906445108 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
398 Ok(decoded) => {
399 handler.open_session(::fidl_next::Request::from_decoded(decoded)).await;
400 Ok(())
401 }
402 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
403 ordinal: 1862345129906445108,
404 error,
405 }),
406 },
407
408 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
409 }
410 }
411
412 async fn on_two_way(
413 handler: &mut ___H,
414 mut message: ::fidl_next::Message<___T>,
415 responder: ::fidl_next::protocol::Responder<___T>,
416 ) -> ::core::result::Result<
417 (),
418 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
419 > {
420 match *message.header().ordinal {
421 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
422 }
423 }
424}
425
426pub trait ControllerClientHandler<
430 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
431 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
432>
433{
434}
435
436impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Controller
437where
438 ___H: ControllerClientHandler<___T> + ::core::marker::Send,
439 ___T: ::fidl_next::Transport,
440{
441 async fn on_event(
442 handler: &mut ___H,
443 mut message: ::fidl_next::Message<___T>,
444 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
445 match *message.header().ordinal {
446 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
447 }
448 }
449}
450
451pub trait ControllerServerHandler<
455 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
456 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
457>
458{
459 #[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"]
460 fn open_session(
461 &mut self,
462
463 request: ::fidl_next::Request<controller::OpenSession, ___T>,
464 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
465}
466
467impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Controller
468where
469 ___H: ControllerServerHandler<___T> + ::core::marker::Send,
470 ___T: ::fidl_next::Transport,
471 for<'de> crate::wire::ControllerOpenSessionRequest: ::fidl_next::Decode<
472 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
473 Constraint = (),
474 >,
475{
476 async fn on_one_way(
477 handler: &mut ___H,
478 mut message: ::fidl_next::Message<___T>,
479 ) -> ::core::result::Result<
480 (),
481 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
482 > {
483 match *message.header().ordinal {
484 1862345129906445108 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
485 Ok(decoded) => {
486 handler.open_session(::fidl_next::Request::from_decoded(decoded)).await;
487 Ok(())
488 }
489 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
490 ordinal: 1862345129906445108,
491 error,
492 }),
493 },
494
495 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
496 }
497 }
498
499 async fn on_two_way(
500 handler: &mut ___H,
501 mut message: ::fidl_next::Message<___T>,
502 responder: ::fidl_next::protocol::Responder<___T>,
503 ) -> ::core::result::Result<
504 (),
505 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
506 > {
507 match *message.header().ordinal {
508 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
509 }
510 }
511}
512
513impl<___T> ControllerClientHandler<___T> for ::fidl_next::IgnoreEvents where
514 ___T: ::fidl_next::Transport
515{
516}
517
518impl<___H, ___T> ControllerLocalClientHandler<___T> for ::fidl_next::Local<___H>
519where
520 ___H: ControllerClientHandler<___T>,
521 ___T: ::fidl_next::Transport,
522{
523}
524
525impl<___H, ___T> ControllerLocalServerHandler<___T> for ::fidl_next::Local<___H>
526where
527 ___H: ControllerServerHandler<___T>,
528 ___T: ::fidl_next::Transport,
529{
530 async fn open_session(&mut self, request: ::fidl_next::Request<controller::OpenSession, ___T>) {
531 ___H::open_session(&mut self.0, request).await
532 }
533}
534
535#[derive(Debug)]
537pub struct ControllerService;
538
539impl ::fidl_next::DiscoverableService for ControllerService {
540 const SERVICE_NAME: &'static str = "fuchsia.hardware.spi.ControllerService";
541 const MEMBER_NAMES: &'static [&'static str] = &["device"];
542}
543
544impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for ControllerService {}
545
546impl<___C> ::fidl_next::Service<___C> for ControllerService
547where
548 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
549{
550 type Connector = ControllerServiceConnector<___C>;
551}
552
553#[repr(transparent)]
555pub struct ControllerServiceConnector<___C> {
556 #[allow(dead_code)]
557 connector: ___C,
558}
559
560impl<___C> ControllerServiceConnector<___C>
561where
562 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
563{
564 pub fn device(
566 &self,
567 server_end: ::fidl_next::ServerEnd<crate::Controller, ::fidl_next::fuchsia::zx::Channel>,
568 ) -> ::core::result::Result<
569 (),
570 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
571 > {
572 ::fidl_next::protocol::ServiceConnector::<
573 ::fidl_next::fuchsia::zx::Channel
574 >::connect_to_member(
575 &self.connector,
576 "device",
577 server_end.into_untyped(),
578 )
579 }
580}
581
582pub trait ControllerServiceHandler {
584 fn device(
586 &self,
587 server_end: ::fidl_next::ServerEnd<crate::Controller, ::fidl_next::fuchsia::zx::Channel>,
588 );
589}
590
591impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for ControllerService
592where
593 ___H: ControllerServiceHandler,
594 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
595{
596 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
597 use ::fidl_next::InstanceFromServiceTransport;
598 match member {
599 "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
600 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
601 )),
602
603 _ => unreachable!(),
604 }
605 }
606}
607
608#[derive(PartialEq, Debug)]
610pub struct Device;
611
612impl ::fidl_next::Discoverable for Device {
613 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.spi.Device";
614}
615
616#[cfg(target_os = "fuchsia")]
617impl ::fidl_next::HasTransport for Device {
618 type Transport = ::fidl_next::fuchsia::zx::Channel;
619}
620
621pub mod device {
622 pub mod prelude {
623 pub use crate::{
624 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
625 DeviceServerHandler, device,
626 };
627
628 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoExchangeRequest;
629
630 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoReceiveRequest;
631
632 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoTransmitRequest;
633
634 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoExchangeResponse;
635
636 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoReceiveResponse;
637
638 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoIoTransmitResponse;
639
640 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoRegisterRegisterVmoRequest;
641
642 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoRegisterUnregisterVmoRequest;
643
644 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoRegisterRegisterVmoResponse;
645
646 pub use ::fidl_next_fuchsia_hardware_sharedmemory::natural::SharedVmoRegisterUnregisterVmoResponse;
647
648 pub use crate::natural::DeviceAssertCsResponse;
649
650 pub use crate::natural::DeviceCanAssertCsResponse;
651
652 pub use crate::natural::DeviceDeassertCsResponse;
653
654 pub use crate::natural::DeviceExchangeVectorRequest;
655
656 pub use crate::natural::DeviceExchangeVectorResponse;
657
658 pub use crate::natural::DeviceReceiveVectorRequest;
659
660 pub use crate::natural::DeviceReceiveVectorResponse;
661
662 pub use crate::natural::DeviceTransmitVectorRequest;
663
664 pub use crate::natural::DeviceTransmitVectorResponse;
665 }
666
667 pub struct Transmit;
668
669 impl ::fidl_next::Method for Transmit {
670 const ORDINAL: u64 = 8726129880940523711;
671 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
672 ::fidl_next::protocol::Flexibility::Strict;
673
674 type Protocol = crate::Device;
675
676 type Request = ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitRequest;
677 }
678
679 impl ::fidl_next::TwoWayMethod for Transmit {
680 type Response = ::fidl_next::wire::Result<
681 'static,
682 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitResponse,
683 ::fidl_next::wire::Int32,
684 >;
685 }
686
687 impl<___R> ::fidl_next::Respond<___R> for Transmit {
688 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
689
690 fn respond(response: ___R) -> Self::Output {
691 ::core::result::Result::Ok(response)
692 }
693 }
694
695 impl<___R> ::fidl_next::RespondErr<___R> for Transmit {
696 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
697
698 fn respond_err(response: ___R) -> Self::Output {
699 ::core::result::Result::Err(response)
700 }
701 }
702
703 pub struct Receive;
704
705 impl ::fidl_next::Method for Receive {
706 const ORDINAL: u64 = 2031572499837475673;
707 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
708 ::fidl_next::protocol::Flexibility::Strict;
709
710 type Protocol = crate::Device;
711
712 type Request = ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveRequest;
713 }
714
715 impl ::fidl_next::TwoWayMethod for Receive {
716 type Response = ::fidl_next::wire::Result<
717 'static,
718 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveResponse,
719 ::fidl_next::wire::Int32,
720 >;
721 }
722
723 impl<___R> ::fidl_next::Respond<___R> for Receive {
724 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
725
726 fn respond(response: ___R) -> Self::Output {
727 ::core::result::Result::Ok(response)
728 }
729 }
730
731 impl<___R> ::fidl_next::RespondErr<___R> for Receive {
732 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
733
734 fn respond_err(response: ___R) -> Self::Output {
735 ::core::result::Result::Err(response)
736 }
737 }
738
739 pub struct Exchange;
740
741 impl ::fidl_next::Method for Exchange {
742 const ORDINAL: u64 = 7915872066671078604;
743 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
744 ::fidl_next::protocol::Flexibility::Strict;
745
746 type Protocol = crate::Device;
747
748 type Request = ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeRequest;
749 }
750
751 impl ::fidl_next::TwoWayMethod for Exchange {
752 type Response = ::fidl_next::wire::Result<
753 'static,
754 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeResponse,
755 ::fidl_next::wire::Int32,
756 >;
757 }
758
759 impl<___R> ::fidl_next::Respond<___R> for Exchange {
760 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
761
762 fn respond(response: ___R) -> Self::Output {
763 ::core::result::Result::Ok(response)
764 }
765 }
766
767 impl<___R> ::fidl_next::RespondErr<___R> for Exchange {
768 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
769
770 fn respond_err(response: ___R) -> Self::Output {
771 ::core::result::Result::Err(response)
772 }
773 }
774
775 pub struct RegisterVmo;
776
777 impl ::fidl_next::Method for RegisterVmo {
778 const ORDINAL: u64 = 3593681058348550677;
779 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
780 ::fidl_next::protocol::Flexibility::Strict;
781
782 type Protocol = crate::Device;
783
784 type Request =
785 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoRequest;
786 }
787
788 impl ::fidl_next::TwoWayMethod for RegisterVmo {
789 type Response = ::fidl_next::wire::Result<
790 'static,
791 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoResponse,
792 ::fidl_next::wire::Int32,
793 >;
794 }
795
796 impl<___R> ::fidl_next::Respond<___R> for RegisterVmo {
797 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
798
799 fn respond(response: ___R) -> Self::Output {
800 ::core::result::Result::Ok(response)
801 }
802 }
803
804 impl<___R> ::fidl_next::RespondErr<___R> for RegisterVmo {
805 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
806
807 fn respond_err(response: ___R) -> Self::Output {
808 ::core::result::Result::Err(response)
809 }
810 }
811
812 pub struct UnregisterVmo;
813
814 impl ::fidl_next::Method for UnregisterVmo {
815 const ORDINAL: u64 = 1266894365566071049;
816 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
817 ::fidl_next::protocol::Flexibility::Strict;
818
819 type Protocol = crate::Device;
820
821 type Request =
822 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoRequest;
823 }
824
825 impl ::fidl_next::TwoWayMethod for UnregisterVmo {
826 type Response = ::fidl_next::wire::Result<
827 'static,
828 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoResponse,
829 ::fidl_next::wire::Int32,
830 >;
831 }
832
833 impl<___R> ::fidl_next::Respond<___R> for UnregisterVmo {
834 type Output =
835 ::core::result::Result<
836 ::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoRegisterUnregisterVmoResponse<___R>,
837 ::fidl_next::never::Never,
838 >;
839
840 fn respond(response: ___R) -> Self::Output {
841 ::core::result::Result::Ok(
842 ::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoRegisterUnregisterVmoResponse {
843 vmo: response,
844 }
845 )
846 }
847 }
848
849 impl<___R> ::fidl_next::RespondErr<___R> for UnregisterVmo {
850 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
851
852 fn respond_err(response: ___R) -> Self::Output {
853 ::core::result::Result::Err(response)
854 }
855 }
856
857 pub struct TransmitVector;
858
859 impl ::fidl_next::Method for TransmitVector {
860 const ORDINAL: u64 = 5091362422849398226;
861 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
862 ::fidl_next::protocol::Flexibility::Strict;
863
864 type Protocol = crate::Device;
865
866 type Request = crate::wire::DeviceTransmitVectorRequest<'static>;
867 }
868
869 impl ::fidl_next::TwoWayMethod for TransmitVector {
870 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceTransmitVectorResponse>;
871 }
872
873 impl<___R> ::fidl_next::Respond<___R> for TransmitVector {
874 type Output = ::fidl_next::Strict<crate::generic::DeviceTransmitVectorResponse<___R>>;
875
876 fn respond(response: ___R) -> Self::Output {
877 ::fidl_next::Strict(crate::generic::DeviceTransmitVectorResponse { status: response })
878 }
879 }
880
881 pub struct ReceiveVector;
882
883 impl ::fidl_next::Method for ReceiveVector {
884 const ORDINAL: u64 = 4013095315797000150;
885 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
886 ::fidl_next::protocol::Flexibility::Strict;
887
888 type Protocol = crate::Device;
889
890 type Request = crate::wire::DeviceReceiveVectorRequest;
891 }
892
893 impl ::fidl_next::TwoWayMethod for ReceiveVector {
894 type Response =
895 ::fidl_next::wire::Strict<crate::wire::DeviceReceiveVectorResponse<'static>>;
896 }
897
898 impl<___R> ::fidl_next::Respond<___R> for ReceiveVector {
899 type Output = ::fidl_next::Strict<___R>;
900
901 fn respond(response: ___R) -> Self::Output {
902 ::fidl_next::Strict(response)
903 }
904 }
905
906 pub struct ExchangeVector;
907
908 impl ::fidl_next::Method for ExchangeVector {
909 const ORDINAL: u64 = 9199936960863142845;
910 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
911 ::fidl_next::protocol::Flexibility::Strict;
912
913 type Protocol = crate::Device;
914
915 type Request = crate::wire::DeviceExchangeVectorRequest<'static>;
916 }
917
918 impl ::fidl_next::TwoWayMethod for ExchangeVector {
919 type Response =
920 ::fidl_next::wire::Strict<crate::wire::DeviceExchangeVectorResponse<'static>>;
921 }
922
923 impl<___R> ::fidl_next::Respond<___R> for ExchangeVector {
924 type Output = ::fidl_next::Strict<___R>;
925
926 fn respond(response: ___R) -> Self::Output {
927 ::fidl_next::Strict(response)
928 }
929 }
930
931 pub struct CanAssertCs;
932
933 impl ::fidl_next::Method for CanAssertCs {
934 const ORDINAL: u64 = 2273212530067875956;
935 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
936 ::fidl_next::protocol::Flexibility::Strict;
937
938 type Protocol = crate::Device;
939
940 type Request = ::fidl_next::wire::EmptyMessageBody;
941 }
942
943 impl ::fidl_next::TwoWayMethod for CanAssertCs {
944 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceCanAssertCsResponse>;
945 }
946
947 impl<___R> ::fidl_next::Respond<___R> for CanAssertCs {
948 type Output = ::fidl_next::Strict<crate::generic::DeviceCanAssertCsResponse<___R>>;
949
950 fn respond(response: ___R) -> Self::Output {
951 ::fidl_next::Strict(crate::generic::DeviceCanAssertCsResponse { can: response })
952 }
953 }
954
955 pub struct AssertCs;
956
957 impl ::fidl_next::Method for AssertCs {
958 const ORDINAL: u64 = 5761910272765271270;
959 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
960 ::fidl_next::protocol::Flexibility::Strict;
961
962 type Protocol = crate::Device;
963
964 type Request = ::fidl_next::wire::EmptyMessageBody;
965 }
966
967 impl ::fidl_next::TwoWayMethod for AssertCs {
968 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceAssertCsResponse>;
969 }
970
971 impl<___R> ::fidl_next::Respond<___R> for AssertCs {
972 type Output = ::fidl_next::Strict<crate::generic::DeviceAssertCsResponse<___R>>;
973
974 fn respond(response: ___R) -> Self::Output {
975 ::fidl_next::Strict(crate::generic::DeviceAssertCsResponse { status: response })
976 }
977 }
978
979 pub struct DeassertCs;
980
981 impl ::fidl_next::Method for DeassertCs {
982 const ORDINAL: u64 = 6795041648297119160;
983 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
984 ::fidl_next::protocol::Flexibility::Strict;
985
986 type Protocol = crate::Device;
987
988 type Request = ::fidl_next::wire::EmptyMessageBody;
989 }
990
991 impl ::fidl_next::TwoWayMethod for DeassertCs {
992 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceDeassertCsResponse>;
993 }
994
995 impl<___R> ::fidl_next::Respond<___R> for DeassertCs {
996 type Output = ::fidl_next::Strict<crate::generic::DeviceDeassertCsResponse<___R>>;
997
998 fn respond(response: ___R) -> Self::Output {
999 ::fidl_next::Strict(crate::generic::DeviceDeassertCsResponse { status: response })
1000 }
1001 }
1002
1003 mod ___detail {
1004 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1005 where
1006 ___T: ::fidl_next::Transport,
1007 {
1008 type Client = DeviceClient<___T>;
1009 type Server = DeviceServer<___T>;
1010 }
1011
1012 #[repr(transparent)]
1014 pub struct DeviceClient<___T: ::fidl_next::Transport> {
1015 #[allow(dead_code)]
1016 client: ::fidl_next::protocol::Client<___T>,
1017 }
1018
1019 impl<___T> DeviceClient<___T>
1020 where
1021 ___T: ::fidl_next::Transport,
1022 {
1023 #[doc = " Sends the data in buffer to the device.\n"]
1024 pub fn transmit(
1025 &self,
1026
1027 buffer: impl ::fidl_next::Encode<
1028 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoBuffer,
1029 <___T as ::fidl_next::Transport>::SendBuffer,
1030 >,
1031 ) -> ::fidl_next::TwoWayFuture<'_, super::Transmit, ___T>
1032 where
1033 <___T as ::fidl_next::Transport>::SendBuffer:
1034 ::fidl_next::encoder::InternalHandleEncoder,
1035 {
1036 self.transmit_with(::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoIoTransmitRequest {
1037
1038 buffer,
1039
1040 })
1041 }
1042
1043 #[doc = " Sends the data in buffer to the device.\n"]
1044 pub fn transmit_with<___R>(
1045 &self,
1046 request: ___R,
1047 ) -> ::fidl_next::TwoWayFuture<'_, super::Transmit, ___T>
1048 where
1049 ___R: ::fidl_next::Encode<
1050 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitRequest,
1051 <___T as ::fidl_next::Transport>::SendBuffer,
1052 >,
1053 {
1054 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1055 8726129880940523711,
1056 <super::Transmit as ::fidl_next::Method>::FLEXIBILITY,
1057 request,
1058 ))
1059 }
1060
1061 #[doc = " Receives data from the device into buffer.\n"]
1062 pub fn receive(
1063 &self,
1064
1065 buffer: impl ::fidl_next::Encode<
1066 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoBuffer,
1067 <___T as ::fidl_next::Transport>::SendBuffer,
1068 >,
1069 ) -> ::fidl_next::TwoWayFuture<'_, super::Receive, ___T>
1070 where
1071 <___T as ::fidl_next::Transport>::SendBuffer:
1072 ::fidl_next::encoder::InternalHandleEncoder,
1073 {
1074 self.receive_with(
1075 ::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoIoReceiveRequest {
1076 buffer,
1077 },
1078 )
1079 }
1080
1081 #[doc = " Receives data from the device into buffer.\n"]
1082 pub fn receive_with<___R>(
1083 &self,
1084 request: ___R,
1085 ) -> ::fidl_next::TwoWayFuture<'_, super::Receive, ___T>
1086 where
1087 ___R: ::fidl_next::Encode<
1088 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveRequest,
1089 <___T as ::fidl_next::Transport>::SendBuffer,
1090 >,
1091 {
1092 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1093 2031572499837475673,
1094 <super::Receive as ::fidl_next::Method>::FLEXIBILITY,
1095 request,
1096 ))
1097 }
1098
1099 #[doc = " Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must\n be the same.\n"]
1100 pub fn exchange(
1101 &self,
1102
1103 tx_buffer: impl ::fidl_next::Encode<
1104 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoBuffer,
1105 <___T as ::fidl_next::Transport>::SendBuffer,
1106 >,
1107
1108 rx_buffer: impl ::fidl_next::Encode<
1109 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoBuffer,
1110 <___T as ::fidl_next::Transport>::SendBuffer,
1111 >,
1112 ) -> ::fidl_next::TwoWayFuture<'_, super::Exchange, ___T>
1113 where
1114 <___T as ::fidl_next::Transport>::SendBuffer:
1115 ::fidl_next::encoder::InternalHandleEncoder,
1116 {
1117 self.exchange_with(::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoIoExchangeRequest {
1118
1119 tx_buffer,
1120
1121 rx_buffer,
1122
1123 })
1124 }
1125
1126 #[doc = " Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must\n be the same.\n"]
1127 pub fn exchange_with<___R>(
1128 &self,
1129 request: ___R,
1130 ) -> ::fidl_next::TwoWayFuture<'_, super::Exchange, ___T>
1131 where
1132 ___R: ::fidl_next::Encode<
1133 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeRequest,
1134 <___T as ::fidl_next::Transport>::SendBuffer,
1135 >,
1136 {
1137 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1138 7915872066671078604,
1139 <super::Exchange as ::fidl_next::Method>::FLEXIBILITY,
1140 request,
1141 ))
1142 }
1143
1144 #[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"]
1145 pub fn register_vmo(
1146 &self,
1147
1148 vmo_id: impl ::fidl_next::Encode<
1149 ::fidl_next::wire::Uint32,
1150 <___T as ::fidl_next::Transport>::SendBuffer,
1151 >,
1152
1153 vmo: impl ::fidl_next::Encode<
1154 ::fidl_next_fuchsia_mem::wire::Range,
1155 <___T as ::fidl_next::Transport>::SendBuffer,
1156 >,
1157
1158 rights: impl ::fidl_next::Encode<
1159 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRight,
1160 <___T as ::fidl_next::Transport>::SendBuffer,
1161 >,
1162 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterVmo, ___T>
1163 where
1164 <___T as ::fidl_next::Transport>::SendBuffer:
1165 ::fidl_next::encoder::InternalHandleEncoder,
1166 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1167 {
1168 self.register_vmo_with(::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoRegisterRegisterVmoRequest {
1169
1170 vmo_id,
1171
1172 vmo,
1173
1174 rights,
1175
1176 })
1177 }
1178
1179 #[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"]
1180 pub fn register_vmo_with<___R>(
1181 &self,
1182 request: ___R,
1183 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterVmo, ___T>
1184 where
1185 ___R: ::fidl_next::Encode<
1186 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoRequest,
1187 <___T as ::fidl_next::Transport>::SendBuffer,
1188 >,
1189 {
1190 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1191 3593681058348550677,
1192 <super::RegisterVmo as ::fidl_next::Method>::FLEXIBILITY,
1193 request,
1194 ))
1195 }
1196
1197 #[doc = " Unmaps and/or unpins the VMO and returns the handle to the caller.\n"]
1198 pub fn unregister_vmo(
1199 &self,
1200
1201 vmo_id: impl ::fidl_next::Encode<
1202 ::fidl_next::wire::Uint32,
1203 <___T as ::fidl_next::Transport>::SendBuffer,
1204 >,
1205 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterVmo, ___T>
1206 where
1207 <___T as ::fidl_next::Transport>::SendBuffer:
1208 ::fidl_next::encoder::InternalHandleEncoder,
1209 {
1210 self.unregister_vmo_with(::fidl_next_fuchsia_hardware_sharedmemory::generic::SharedVmoRegisterUnregisterVmoRequest {
1211
1212 vmo_id,
1213
1214 })
1215 }
1216
1217 #[doc = " Unmaps and/or unpins the VMO and returns the handle to the caller.\n"]
1218 pub fn unregister_vmo_with<___R>(
1219 &self,
1220 request: ___R,
1221 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterVmo, ___T>
1222 where
1223 ___R: ::fidl_next::Encode<
1224 ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoRequest,
1225 <___T as ::fidl_next::Transport>::SendBuffer,
1226 >,
1227 {
1228 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1229 1266894365566071049,
1230 <super::UnregisterVmo as ::fidl_next::Method>::FLEXIBILITY,
1231 request,
1232 ))
1233 }
1234
1235 #[doc = " Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.\n"]
1236 pub fn transmit_vector(
1237 &self,
1238
1239 data: impl ::fidl_next::Encode<
1240 ::fidl_next::wire::Vector<'static, u8>,
1241 <___T as ::fidl_next::Transport>::SendBuffer,
1242 >,
1243 ) -> ::fidl_next::TwoWayFuture<'_, super::TransmitVector, ___T>
1244 where
1245 <___T as ::fidl_next::Transport>::SendBuffer:
1246 ::fidl_next::encoder::InternalHandleEncoder,
1247 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1248 {
1249 self.transmit_vector_with(crate::generic::DeviceTransmitVectorRequest { data })
1250 }
1251
1252 #[doc = " Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.\n"]
1253 pub fn transmit_vector_with<___R>(
1254 &self,
1255 request: ___R,
1256 ) -> ::fidl_next::TwoWayFuture<'_, super::TransmitVector, ___T>
1257 where
1258 ___R: ::fidl_next::Encode<
1259 crate::wire::DeviceTransmitVectorRequest<'static>,
1260 <___T as ::fidl_next::Transport>::SendBuffer,
1261 >,
1262 {
1263 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1264 5091362422849398226,
1265 <super::TransmitVector as ::fidl_next::Method>::FLEXIBILITY,
1266 request,
1267 ))
1268 }
1269
1270 #[doc = " Half-duplex receive data from a SPI device; always reads the full size requested.\n"]
1271 pub fn receive_vector(
1272 &self,
1273
1274 size: impl ::fidl_next::Encode<
1275 ::fidl_next::wire::Uint32,
1276 <___T as ::fidl_next::Transport>::SendBuffer,
1277 >,
1278 ) -> ::fidl_next::TwoWayFuture<'_, super::ReceiveVector, ___T>
1279 where
1280 <___T as ::fidl_next::Transport>::SendBuffer:
1281 ::fidl_next::encoder::InternalHandleEncoder,
1282 {
1283 self.receive_vector_with(crate::generic::DeviceReceiveVectorRequest { size })
1284 }
1285
1286 #[doc = " Half-duplex receive data from a SPI device; always reads the full size requested.\n"]
1287 pub fn receive_vector_with<___R>(
1288 &self,
1289 request: ___R,
1290 ) -> ::fidl_next::TwoWayFuture<'_, super::ReceiveVector, ___T>
1291 where
1292 ___R: ::fidl_next::Encode<
1293 crate::wire::DeviceReceiveVectorRequest,
1294 <___T as ::fidl_next::Transport>::SendBuffer,
1295 >,
1296 {
1297 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1298 4013095315797000150,
1299 <super::ReceiveVector as ::fidl_next::Method>::FLEXIBILITY,
1300 request,
1301 ))
1302 }
1303
1304 #[doc = " Full-duplex SPI transaction. Received data will exactly equal the length of the transmit\n buffer.\n"]
1305 pub fn exchange_vector(
1306 &self,
1307
1308 txdata: impl ::fidl_next::Encode<
1309 ::fidl_next::wire::Vector<'static, u8>,
1310 <___T as ::fidl_next::Transport>::SendBuffer,
1311 >,
1312 ) -> ::fidl_next::TwoWayFuture<'_, super::ExchangeVector, ___T>
1313 where
1314 <___T as ::fidl_next::Transport>::SendBuffer:
1315 ::fidl_next::encoder::InternalHandleEncoder,
1316 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1317 {
1318 self.exchange_vector_with(crate::generic::DeviceExchangeVectorRequest { txdata })
1319 }
1320
1321 #[doc = " Full-duplex SPI transaction. Received data will exactly equal the length of the transmit\n buffer.\n"]
1322 pub fn exchange_vector_with<___R>(
1323 &self,
1324 request: ___R,
1325 ) -> ::fidl_next::TwoWayFuture<'_, super::ExchangeVector, ___T>
1326 where
1327 ___R: ::fidl_next::Encode<
1328 crate::wire::DeviceExchangeVectorRequest<'static>,
1329 <___T as ::fidl_next::Transport>::SendBuffer,
1330 >,
1331 {
1332 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1333 9199936960863142845,
1334 <super::ExchangeVector as ::fidl_next::Method>::FLEXIBILITY,
1335 request,
1336 ))
1337 }
1338
1339 #[doc = " Returns true if the device can call |AssertCs()| and |DeassertCs()|.\n"]
1340 pub fn can_assert_cs(&self) -> ::fidl_next::TwoWayFuture<'_, super::CanAssertCs, ___T> {
1341 ::fidl_next::TwoWayFuture::from_untyped(
1342 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1343 2273212530067875956,
1344 <super::CanAssertCs as ::fidl_next::Method>::FLEXIBILITY,
1345 (),
1346 ),
1347 )
1348 }
1349
1350 #[doc = " Assert CS for this device.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
1351 pub fn assert_cs(&self) -> ::fidl_next::TwoWayFuture<'_, super::AssertCs, ___T> {
1352 ::fidl_next::TwoWayFuture::from_untyped(
1353 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1354 5761910272765271270,
1355 <super::AssertCs as ::fidl_next::Method>::FLEXIBILITY,
1356 (),
1357 ),
1358 )
1359 }
1360
1361 #[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"]
1362 pub fn deassert_cs(&self) -> ::fidl_next::TwoWayFuture<'_, super::DeassertCs, ___T> {
1363 ::fidl_next::TwoWayFuture::from_untyped(
1364 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1365 6795041648297119160,
1366 <super::DeassertCs as ::fidl_next::Method>::FLEXIBILITY,
1367 (),
1368 ),
1369 )
1370 }
1371 }
1372
1373 #[repr(transparent)]
1375 pub struct DeviceServer<___T: ::fidl_next::Transport> {
1376 server: ::fidl_next::protocol::Server<___T>,
1377 }
1378
1379 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1380 }
1381}
1382
1383#[diagnostic::on_unimplemented(
1384 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1385)]
1386
1387pub trait DeviceLocalClientHandler<
1391 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1392 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1393>
1394{
1395}
1396
1397impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
1398where
1399 ___H: DeviceLocalClientHandler<___T>,
1400 ___T: ::fidl_next::Transport,
1401{
1402 async fn on_event(
1403 handler: &mut ___H,
1404 mut message: ::fidl_next::Message<___T>,
1405 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1406 match *message.header().ordinal {
1407 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1408 }
1409 }
1410}
1411
1412#[diagnostic::on_unimplemented(
1413 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1414)]
1415
1416pub trait DeviceLocalServerHandler<
1420 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1421 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1422>
1423{
1424 #[doc = " Sends the data in buffer to the device.\n"]
1425 fn transmit(
1426 &mut self,
1427
1428 request: ::fidl_next::Request<device::Transmit, ___T>,
1429
1430 responder: ::fidl_next::Responder<device::Transmit, ___T>,
1431 ) -> impl ::core::future::Future<Output = ()>;
1432
1433 #[doc = " Receives data from the device into buffer.\n"]
1434 fn receive(
1435 &mut self,
1436
1437 request: ::fidl_next::Request<device::Receive, ___T>,
1438
1439 responder: ::fidl_next::Responder<device::Receive, ___T>,
1440 ) -> impl ::core::future::Future<Output = ()>;
1441
1442 #[doc = " Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must\n be the same.\n"]
1443 fn exchange(
1444 &mut self,
1445
1446 request: ::fidl_next::Request<device::Exchange, ___T>,
1447
1448 responder: ::fidl_next::Responder<device::Exchange, ___T>,
1449 ) -> impl ::core::future::Future<Output = ()>;
1450
1451 #[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"]
1452 fn register_vmo(
1453 &mut self,
1454
1455 request: ::fidl_next::Request<device::RegisterVmo, ___T>,
1456
1457 responder: ::fidl_next::Responder<device::RegisterVmo, ___T>,
1458 ) -> impl ::core::future::Future<Output = ()>;
1459
1460 #[doc = " Unmaps and/or unpins the VMO and returns the handle to the caller.\n"]
1461 fn unregister_vmo(
1462 &mut self,
1463
1464 request: ::fidl_next::Request<device::UnregisterVmo, ___T>,
1465
1466 responder: ::fidl_next::Responder<device::UnregisterVmo, ___T>,
1467 ) -> impl ::core::future::Future<Output = ()>;
1468
1469 #[doc = " Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.\n"]
1470 fn transmit_vector(
1471 &mut self,
1472
1473 request: ::fidl_next::Request<device::TransmitVector, ___T>,
1474
1475 responder: ::fidl_next::Responder<device::TransmitVector, ___T>,
1476 ) -> impl ::core::future::Future<Output = ()>;
1477
1478 #[doc = " Half-duplex receive data from a SPI device; always reads the full size requested.\n"]
1479 fn receive_vector(
1480 &mut self,
1481
1482 request: ::fidl_next::Request<device::ReceiveVector, ___T>,
1483
1484 responder: ::fidl_next::Responder<device::ReceiveVector, ___T>,
1485 ) -> impl ::core::future::Future<Output = ()>;
1486
1487 #[doc = " Full-duplex SPI transaction. Received data will exactly equal the length of the transmit\n buffer.\n"]
1488 fn exchange_vector(
1489 &mut self,
1490
1491 request: ::fidl_next::Request<device::ExchangeVector, ___T>,
1492
1493 responder: ::fidl_next::Responder<device::ExchangeVector, ___T>,
1494 ) -> impl ::core::future::Future<Output = ()>;
1495
1496 #[doc = " Returns true if the device can call |AssertCs()| and |DeassertCs()|.\n"]
1497 fn can_assert_cs(
1498 &mut self,
1499
1500 responder: ::fidl_next::Responder<device::CanAssertCs, ___T>,
1501 ) -> impl ::core::future::Future<Output = ()>;
1502
1503 #[doc = " Assert CS for this device.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
1504 fn assert_cs(
1505 &mut self,
1506
1507 responder: ::fidl_next::Responder<device::AssertCs, ___T>,
1508 ) -> impl ::core::future::Future<Output = ()>;
1509
1510 #[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"]
1511 fn deassert_cs(
1512 &mut self,
1513
1514 responder: ::fidl_next::Responder<device::DeassertCs, ___T>,
1515 ) -> impl ::core::future::Future<Output = ()>;
1516}
1517
1518impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
1519where
1520 ___H: DeviceLocalServerHandler<___T> ,
1521 ___T: ::fidl_next::Transport,
1522
1523
1524 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitRequest: ::fidl_next::Decode<
1525 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1526 Constraint = (),
1527 >,
1528
1529
1530
1531 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveRequest: ::fidl_next::Decode<
1532 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1533 Constraint = (),
1534 >,
1535
1536
1537
1538 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeRequest: ::fidl_next::Decode<
1539 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1540 Constraint = (),
1541 >,
1542
1543
1544
1545 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoRequest: ::fidl_next::Decode<
1546 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1547 Constraint = (),
1548 >,
1549
1550
1551
1552 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoRequest: ::fidl_next::Decode<
1553 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1554 Constraint = (),
1555 >,
1556
1557
1558
1559 for<'de> crate::wire::DeviceTransmitVectorRequest<'de>: ::fidl_next::Decode<
1560 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1561 Constraint = (),
1562 >,
1563
1564
1565
1566 for<'de> crate::wire::DeviceReceiveVectorRequest: ::fidl_next::Decode<
1567 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1568 Constraint = (),
1569 >,
1570
1571
1572
1573 for<'de> crate::wire::DeviceExchangeVectorRequest<'de>: ::fidl_next::Decode<
1574 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1575 Constraint = (),
1576 >,
1577
1578
1579
1580
1581
1582
1583
1584
1585{
1586 async fn on_one_way(
1587 handler: &mut ___H,
1588 mut message: ::fidl_next::Message<___T>,
1589 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
1590 match *message.header().ordinal {
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625 ordinal => {
1626
1627 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1628
1629 }
1630 }
1631 }
1632
1633 async fn on_two_way(
1634 handler: &mut ___H,
1635 mut message: ::fidl_next::Message<___T>,
1636 responder: ::fidl_next::protocol::Responder<___T>,
1637 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
1638 match *message.header().ordinal {
1639
1640
1641
1642 8726129880940523711 => {
1643 let responder = ::fidl_next::Responder::from_untyped(responder);
1644
1645 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1646 Ok(decoded) => {
1647 handler.transmit(::fidl_next::Request::from_decoded(decoded), responder).await;
1648 Ok(())
1649 }
1650 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1651 ordinal: 8726129880940523711,
1652 error,
1653 }),
1654 }
1655
1656 }
1657
1658
1659
1660
1661 2031572499837475673 => {
1662 let responder = ::fidl_next::Responder::from_untyped(responder);
1663
1664 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1665 Ok(decoded) => {
1666 handler.receive(::fidl_next::Request::from_decoded(decoded), responder).await;
1667 Ok(())
1668 }
1669 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1670 ordinal: 2031572499837475673,
1671 error,
1672 }),
1673 }
1674
1675 }
1676
1677
1678
1679
1680 7915872066671078604 => {
1681 let responder = ::fidl_next::Responder::from_untyped(responder);
1682
1683 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1684 Ok(decoded) => {
1685 handler.exchange(::fidl_next::Request::from_decoded(decoded), responder).await;
1686 Ok(())
1687 }
1688 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1689 ordinal: 7915872066671078604,
1690 error,
1691 }),
1692 }
1693
1694 }
1695
1696
1697
1698
1699 3593681058348550677 => {
1700 let responder = ::fidl_next::Responder::from_untyped(responder);
1701
1702 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1703 Ok(decoded) => {
1704 handler.register_vmo(::fidl_next::Request::from_decoded(decoded), responder).await;
1705 Ok(())
1706 }
1707 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1708 ordinal: 3593681058348550677,
1709 error,
1710 }),
1711 }
1712
1713 }
1714
1715
1716
1717
1718 1266894365566071049 => {
1719 let responder = ::fidl_next::Responder::from_untyped(responder);
1720
1721 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1722 Ok(decoded) => {
1723 handler.unregister_vmo(::fidl_next::Request::from_decoded(decoded), responder).await;
1724 Ok(())
1725 }
1726 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1727 ordinal: 1266894365566071049,
1728 error,
1729 }),
1730 }
1731
1732 }
1733
1734
1735
1736
1737 5091362422849398226 => {
1738 let responder = ::fidl_next::Responder::from_untyped(responder);
1739
1740 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1741 Ok(decoded) => {
1742 handler.transmit_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
1743 Ok(())
1744 }
1745 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1746 ordinal: 5091362422849398226,
1747 error,
1748 }),
1749 }
1750
1751 }
1752
1753
1754
1755
1756 4013095315797000150 => {
1757 let responder = ::fidl_next::Responder::from_untyped(responder);
1758
1759 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1760 Ok(decoded) => {
1761 handler.receive_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
1762 Ok(())
1763 }
1764 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1765 ordinal: 4013095315797000150,
1766 error,
1767 }),
1768 }
1769
1770 }
1771
1772
1773
1774
1775 9199936960863142845 => {
1776 let responder = ::fidl_next::Responder::from_untyped(responder);
1777
1778 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1779 Ok(decoded) => {
1780 handler.exchange_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
1781 Ok(())
1782 }
1783 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1784 ordinal: 9199936960863142845,
1785 error,
1786 }),
1787 }
1788
1789 }
1790
1791
1792
1793
1794 2273212530067875956 => {
1795 let responder = ::fidl_next::Responder::from_untyped(responder);
1796
1797 handler.can_assert_cs(responder).await;
1798 Ok(())
1799
1800 }
1801
1802
1803
1804
1805 5761910272765271270 => {
1806 let responder = ::fidl_next::Responder::from_untyped(responder);
1807
1808 handler.assert_cs(responder).await;
1809 Ok(())
1810
1811 }
1812
1813
1814
1815
1816 6795041648297119160 => {
1817 let responder = ::fidl_next::Responder::from_untyped(responder);
1818
1819 handler.deassert_cs(responder).await;
1820 Ok(())
1821
1822 }
1823
1824
1825 ordinal => {
1826
1827 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1828
1829 }
1830 }
1831 }
1832}
1833
1834pub trait DeviceClientHandler<
1838 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1839 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1840>
1841{
1842}
1843
1844impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
1845where
1846 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
1847 ___T: ::fidl_next::Transport,
1848{
1849 async fn on_event(
1850 handler: &mut ___H,
1851 mut message: ::fidl_next::Message<___T>,
1852 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1853 match *message.header().ordinal {
1854 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1855 }
1856 }
1857}
1858
1859pub trait DeviceServerHandler<
1863 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1864 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1865>
1866{
1867 #[doc = " Sends the data in buffer to the device.\n"]
1868 fn transmit(
1869 &mut self,
1870
1871 request: ::fidl_next::Request<device::Transmit, ___T>,
1872
1873 responder: ::fidl_next::Responder<device::Transmit, ___T>,
1874 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1875
1876 #[doc = " Receives data from the device into buffer.\n"]
1877 fn receive(
1878 &mut self,
1879
1880 request: ::fidl_next::Request<device::Receive, ___T>,
1881
1882 responder: ::fidl_next::Responder<device::Receive, ___T>,
1883 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1884
1885 #[doc = " Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must\n be the same.\n"]
1886 fn exchange(
1887 &mut self,
1888
1889 request: ::fidl_next::Request<device::Exchange, ___T>,
1890
1891 responder: ::fidl_next::Responder<device::Exchange, ___T>,
1892 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1893
1894 #[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"]
1895 fn register_vmo(
1896 &mut self,
1897
1898 request: ::fidl_next::Request<device::RegisterVmo, ___T>,
1899
1900 responder: ::fidl_next::Responder<device::RegisterVmo, ___T>,
1901 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1902
1903 #[doc = " Unmaps and/or unpins the VMO and returns the handle to the caller.\n"]
1904 fn unregister_vmo(
1905 &mut self,
1906
1907 request: ::fidl_next::Request<device::UnregisterVmo, ___T>,
1908
1909 responder: ::fidl_next::Responder<device::UnregisterVmo, ___T>,
1910 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1911
1912 #[doc = " Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.\n"]
1913 fn transmit_vector(
1914 &mut self,
1915
1916 request: ::fidl_next::Request<device::TransmitVector, ___T>,
1917
1918 responder: ::fidl_next::Responder<device::TransmitVector, ___T>,
1919 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1920
1921 #[doc = " Half-duplex receive data from a SPI device; always reads the full size requested.\n"]
1922 fn receive_vector(
1923 &mut self,
1924
1925 request: ::fidl_next::Request<device::ReceiveVector, ___T>,
1926
1927 responder: ::fidl_next::Responder<device::ReceiveVector, ___T>,
1928 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1929
1930 #[doc = " Full-duplex SPI transaction. Received data will exactly equal the length of the transmit\n buffer.\n"]
1931 fn exchange_vector(
1932 &mut self,
1933
1934 request: ::fidl_next::Request<device::ExchangeVector, ___T>,
1935
1936 responder: ::fidl_next::Responder<device::ExchangeVector, ___T>,
1937 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1938
1939 #[doc = " Returns true if the device can call |AssertCs()| and |DeassertCs()|.\n"]
1940 fn can_assert_cs(
1941 &mut self,
1942
1943 responder: ::fidl_next::Responder<device::CanAssertCs, ___T>,
1944 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1945
1946 #[doc = " Assert CS for this device.\n Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.\n"]
1947 fn assert_cs(
1948 &mut self,
1949
1950 responder: ::fidl_next::Responder<device::AssertCs, ___T>,
1951 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1952
1953 #[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"]
1954 fn deassert_cs(
1955 &mut self,
1956
1957 responder: ::fidl_next::Responder<device::DeassertCs, ___T>,
1958 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1959}
1960
1961impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
1962where
1963 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
1964 ___T: ::fidl_next::Transport,
1965
1966
1967 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoTransmitRequest: ::fidl_next::Decode<
1968 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1969 Constraint = (),
1970 >,
1971
1972
1973
1974 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoReceiveRequest: ::fidl_next::Decode<
1975 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1976 Constraint = (),
1977 >,
1978
1979
1980
1981 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoIoExchangeRequest: ::fidl_next::Decode<
1982 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1983 Constraint = (),
1984 >,
1985
1986
1987
1988 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterRegisterVmoRequest: ::fidl_next::Decode<
1989 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1990 Constraint = (),
1991 >,
1992
1993
1994
1995 for<'de> ::fidl_next_fuchsia_hardware_sharedmemory::wire::SharedVmoRegisterUnregisterVmoRequest: ::fidl_next::Decode<
1996 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1997 Constraint = (),
1998 >,
1999
2000
2001
2002 for<'de> crate::wire::DeviceTransmitVectorRequest<'de>: ::fidl_next::Decode<
2003 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2004 Constraint = (),
2005 >,
2006
2007
2008
2009 for<'de> crate::wire::DeviceReceiveVectorRequest: ::fidl_next::Decode<
2010 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2011 Constraint = (),
2012 >,
2013
2014
2015
2016 for<'de> crate::wire::DeviceExchangeVectorRequest<'de>: ::fidl_next::Decode<
2017 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2018 Constraint = (),
2019 >,
2020
2021
2022
2023
2024
2025
2026
2027
2028{
2029 async fn on_one_way(
2030 handler: &mut ___H,
2031 mut message: ::fidl_next::Message<___T>,
2032 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
2033 match *message.header().ordinal {
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068 ordinal => {
2069
2070 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2071
2072 }
2073 }
2074 }
2075
2076 async fn on_two_way(
2077 handler: &mut ___H,
2078 mut message: ::fidl_next::Message<___T>,
2079 responder: ::fidl_next::protocol::Responder<___T>,
2080 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
2081 match *message.header().ordinal {
2082
2083
2084
2085 8726129880940523711 => {
2086 let responder = ::fidl_next::Responder::from_untyped(responder);
2087
2088 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2089 Ok(decoded) => {
2090 handler.transmit(::fidl_next::Request::from_decoded(decoded), responder).await;
2091 Ok(())
2092 }
2093 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2094 ordinal: 8726129880940523711,
2095 error,
2096 }),
2097 }
2098
2099 }
2100
2101
2102
2103
2104 2031572499837475673 => {
2105 let responder = ::fidl_next::Responder::from_untyped(responder);
2106
2107 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2108 Ok(decoded) => {
2109 handler.receive(::fidl_next::Request::from_decoded(decoded), responder).await;
2110 Ok(())
2111 }
2112 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2113 ordinal: 2031572499837475673,
2114 error,
2115 }),
2116 }
2117
2118 }
2119
2120
2121
2122
2123 7915872066671078604 => {
2124 let responder = ::fidl_next::Responder::from_untyped(responder);
2125
2126 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2127 Ok(decoded) => {
2128 handler.exchange(::fidl_next::Request::from_decoded(decoded), responder).await;
2129 Ok(())
2130 }
2131 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2132 ordinal: 7915872066671078604,
2133 error,
2134 }),
2135 }
2136
2137 }
2138
2139
2140
2141
2142 3593681058348550677 => {
2143 let responder = ::fidl_next::Responder::from_untyped(responder);
2144
2145 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2146 Ok(decoded) => {
2147 handler.register_vmo(::fidl_next::Request::from_decoded(decoded), responder).await;
2148 Ok(())
2149 }
2150 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2151 ordinal: 3593681058348550677,
2152 error,
2153 }),
2154 }
2155
2156 }
2157
2158
2159
2160
2161 1266894365566071049 => {
2162 let responder = ::fidl_next::Responder::from_untyped(responder);
2163
2164 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2165 Ok(decoded) => {
2166 handler.unregister_vmo(::fidl_next::Request::from_decoded(decoded), responder).await;
2167 Ok(())
2168 }
2169 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2170 ordinal: 1266894365566071049,
2171 error,
2172 }),
2173 }
2174
2175 }
2176
2177
2178
2179
2180 5091362422849398226 => {
2181 let responder = ::fidl_next::Responder::from_untyped(responder);
2182
2183 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2184 Ok(decoded) => {
2185 handler.transmit_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2186 Ok(())
2187 }
2188 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2189 ordinal: 5091362422849398226,
2190 error,
2191 }),
2192 }
2193
2194 }
2195
2196
2197
2198
2199 4013095315797000150 => {
2200 let responder = ::fidl_next::Responder::from_untyped(responder);
2201
2202 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2203 Ok(decoded) => {
2204 handler.receive_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2205 Ok(())
2206 }
2207 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2208 ordinal: 4013095315797000150,
2209 error,
2210 }),
2211 }
2212
2213 }
2214
2215
2216
2217
2218 9199936960863142845 => {
2219 let responder = ::fidl_next::Responder::from_untyped(responder);
2220
2221 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2222 Ok(decoded) => {
2223 handler.exchange_vector(::fidl_next::Request::from_decoded(decoded), responder).await;
2224 Ok(())
2225 }
2226 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2227 ordinal: 9199936960863142845,
2228 error,
2229 }),
2230 }
2231
2232 }
2233
2234
2235
2236
2237 2273212530067875956 => {
2238 let responder = ::fidl_next::Responder::from_untyped(responder);
2239
2240 handler.can_assert_cs(responder).await;
2241 Ok(())
2242
2243 }
2244
2245
2246
2247
2248 5761910272765271270 => {
2249 let responder = ::fidl_next::Responder::from_untyped(responder);
2250
2251 handler.assert_cs(responder).await;
2252 Ok(())
2253
2254 }
2255
2256
2257
2258
2259 6795041648297119160 => {
2260 let responder = ::fidl_next::Responder::from_untyped(responder);
2261
2262 handler.deassert_cs(responder).await;
2263 Ok(())
2264
2265 }
2266
2267
2268 ordinal => {
2269
2270 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2271
2272 }
2273 }
2274 }
2275}
2276
2277impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
2278{}
2279
2280impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2281where
2282 ___H: DeviceClientHandler<___T>,
2283 ___T: ::fidl_next::Transport,
2284{
2285}
2286
2287impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2288where
2289 ___H: DeviceServerHandler<___T>,
2290 ___T: ::fidl_next::Transport,
2291{
2292 async fn transmit(
2293 &mut self,
2294
2295 request: ::fidl_next::Request<device::Transmit, ___T>,
2296
2297 responder: ::fidl_next::Responder<device::Transmit, ___T>,
2298 ) {
2299 ___H::transmit(&mut self.0, request, responder).await
2300 }
2301
2302 async fn receive(
2303 &mut self,
2304
2305 request: ::fidl_next::Request<device::Receive, ___T>,
2306
2307 responder: ::fidl_next::Responder<device::Receive, ___T>,
2308 ) {
2309 ___H::receive(&mut self.0, request, responder).await
2310 }
2311
2312 async fn exchange(
2313 &mut self,
2314
2315 request: ::fidl_next::Request<device::Exchange, ___T>,
2316
2317 responder: ::fidl_next::Responder<device::Exchange, ___T>,
2318 ) {
2319 ___H::exchange(&mut self.0, request, responder).await
2320 }
2321
2322 async fn register_vmo(
2323 &mut self,
2324
2325 request: ::fidl_next::Request<device::RegisterVmo, ___T>,
2326
2327 responder: ::fidl_next::Responder<device::RegisterVmo, ___T>,
2328 ) {
2329 ___H::register_vmo(&mut self.0, request, responder).await
2330 }
2331
2332 async fn unregister_vmo(
2333 &mut self,
2334
2335 request: ::fidl_next::Request<device::UnregisterVmo, ___T>,
2336
2337 responder: ::fidl_next::Responder<device::UnregisterVmo, ___T>,
2338 ) {
2339 ___H::unregister_vmo(&mut self.0, request, responder).await
2340 }
2341
2342 async fn transmit_vector(
2343 &mut self,
2344
2345 request: ::fidl_next::Request<device::TransmitVector, ___T>,
2346
2347 responder: ::fidl_next::Responder<device::TransmitVector, ___T>,
2348 ) {
2349 ___H::transmit_vector(&mut self.0, request, responder).await
2350 }
2351
2352 async fn receive_vector(
2353 &mut self,
2354
2355 request: ::fidl_next::Request<device::ReceiveVector, ___T>,
2356
2357 responder: ::fidl_next::Responder<device::ReceiveVector, ___T>,
2358 ) {
2359 ___H::receive_vector(&mut self.0, request, responder).await
2360 }
2361
2362 async fn exchange_vector(
2363 &mut self,
2364
2365 request: ::fidl_next::Request<device::ExchangeVector, ___T>,
2366
2367 responder: ::fidl_next::Responder<device::ExchangeVector, ___T>,
2368 ) {
2369 ___H::exchange_vector(&mut self.0, request, responder).await
2370 }
2371
2372 async fn can_assert_cs(
2373 &mut self,
2374
2375 responder: ::fidl_next::Responder<device::CanAssertCs, ___T>,
2376 ) {
2377 ___H::can_assert_cs(&mut self.0, responder).await
2378 }
2379
2380 async fn assert_cs(&mut self, responder: ::fidl_next::Responder<device::AssertCs, ___T>) {
2381 ___H::assert_cs(&mut self.0, responder).await
2382 }
2383
2384 async fn deassert_cs(&mut self, responder: ::fidl_next::Responder<device::DeassertCs, ___T>) {
2385 ___H::deassert_cs(&mut self.0, responder).await
2386 }
2387}
2388
2389#[derive(Debug)]
2391pub struct Service;
2392
2393impl ::fidl_next::DiscoverableService for Service {
2394 const SERVICE_NAME: &'static str = "fuchsia.hardware.spi.Service";
2395 const MEMBER_NAMES: &'static [&'static str] = &["device"];
2396}
2397
2398impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for Service {}
2399
2400impl<___C> ::fidl_next::Service<___C> for Service
2401where
2402 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2403{
2404 type Connector = ServiceConnector<___C>;
2405}
2406
2407#[repr(transparent)]
2409pub struct ServiceConnector<___C> {
2410 #[allow(dead_code)]
2411 connector: ___C,
2412}
2413
2414impl<___C> ServiceConnector<___C>
2415where
2416 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2417{
2418 pub fn device(
2420 &self,
2421 server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2422 ) -> ::core::result::Result<
2423 (),
2424 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2425 > {
2426 ::fidl_next::protocol::ServiceConnector::<
2427 ::fidl_next::fuchsia::zx::Channel
2428 >::connect_to_member(
2429 &self.connector,
2430 "device",
2431 server_end.into_untyped(),
2432 )
2433 }
2434}
2435
2436pub trait ServiceHandler {
2438 fn device(
2440 &self,
2441 server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2442 );
2443}
2444
2445impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for Service
2446where
2447 ___H: ServiceHandler,
2448 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2449{
2450 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2451 use ::fidl_next::InstanceFromServiceTransport;
2452 match member {
2453 "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
2454 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2455 )),
2456
2457 _ => unreachable!(),
2458 }
2459 }
2460}
2461
2462pub use fidl_next_common_fuchsia_hardware_spi::*;