Skip to main content

fidl_next_fuchsia_hardware_spmi/
fidl_next_fuchsia_hardware_spmi.rs

1// DO NOT EDIT: This file is machine-generated by fidlgen
2#![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_spmi::natural::*;
8
9    #[derive(Debug, PartialEq)]
10    pub struct DebugConnectTargetRequest {
11        pub target_id: u8,
12
13        pub server: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
14    }
15
16    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DebugConnectTargetRequest, ___E>
17        for DebugConnectTargetRequest
18    where
19        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
20        ___E: ::fidl_next::fuchsia::HandleEncoder,
21    {
22        #[inline]
23        fn encode(
24            self,
25            encoder_: &mut ___E,
26            out_: &mut ::core::mem::MaybeUninit<crate::wire::DebugConnectTargetRequest>,
27            _: (),
28        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
29            ::fidl_next::munge! {
30                let crate::wire::DebugConnectTargetRequest {
31                    target_id,
32                    server,
33
34                } = out_;
35            }
36
37            ::fidl_next::Encode::encode(self.target_id, encoder_, target_id, ())?;
38
39            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(target_id.as_mut_ptr()) };
40
41            ::fidl_next::Encode::encode(self.server, encoder_, server, ())?;
42
43            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(server.as_mut_ptr()) };
44
45            Ok(())
46        }
47    }
48
49    unsafe impl<___E>
50        ::fidl_next::EncodeOption<
51            ::fidl_next::wire::Box<'static, crate::wire::DebugConnectTargetRequest>,
52            ___E,
53        > for DebugConnectTargetRequest
54    where
55        ___E: ::fidl_next::Encoder + ?Sized,
56        DebugConnectTargetRequest:
57            ::fidl_next::Encode<crate::wire::DebugConnectTargetRequest, ___E>,
58    {
59        #[inline]
60        fn encode_option(
61            this: ::core::option::Option<Self>,
62            encoder: &mut ___E,
63            out: &mut ::core::mem::MaybeUninit<
64                ::fidl_next::wire::Box<'static, crate::wire::DebugConnectTargetRequest>,
65            >,
66            _: (),
67        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
68            if let Some(inner) = this {
69                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
70                ::fidl_next::wire::Box::encode_present(out);
71            } else {
72                ::fidl_next::wire::Box::encode_absent(out);
73            }
74
75            Ok(())
76        }
77    }
78
79    impl ::fidl_next::FromWire<crate::wire::DebugConnectTargetRequest> for DebugConnectTargetRequest {
80        #[inline]
81        fn from_wire(wire: crate::wire::DebugConnectTargetRequest) -> Self {
82            Self {
83                target_id: ::fidl_next::FromWire::from_wire(wire.target_id),
84
85                server: ::fidl_next::FromWire::from_wire(wire.server),
86            }
87        }
88    }
89
90    #[derive(Debug, PartialEq)]
91    pub struct DeviceWatchControllerWriteCommandsRequest {
92        pub address: u8,
93
94        pub size: u16,
95
96        pub setup_wake_lease: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
97    }
98
99    unsafe impl<___E>
100        ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsRequest, ___E>
101        for DeviceWatchControllerWriteCommandsRequest
102    where
103        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
104        ___E: ::fidl_next::fuchsia::HandleEncoder,
105    {
106        #[inline]
107        fn encode(
108            self,
109            encoder_: &mut ___E,
110            out_: &mut ::core::mem::MaybeUninit<
111                crate::wire::DeviceWatchControllerWriteCommandsRequest,
112            >,
113            _: (),
114        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
115            ::fidl_next::munge! {
116                let crate::wire::DeviceWatchControllerWriteCommandsRequest {
117                    address,
118                    size,
119                    setup_wake_lease,
120
121                } = out_;
122            }
123
124            ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
125
126            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(address.as_mut_ptr()) };
127
128            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
129
130            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(size.as_mut_ptr()) };
131
132            ::fidl_next::Encode::encode(self.setup_wake_lease, encoder_, setup_wake_lease, ())?;
133
134            let mut _field =
135                unsafe { ::fidl_next::Slot::new_unchecked(setup_wake_lease.as_mut_ptr()) };
136
137            Ok(())
138        }
139    }
140
141    unsafe impl<___E>
142        ::fidl_next::EncodeOption<
143            ::fidl_next::wire::Box<'static, crate::wire::DeviceWatchControllerWriteCommandsRequest>,
144            ___E,
145        > for DeviceWatchControllerWriteCommandsRequest
146    where
147        ___E: ::fidl_next::Encoder + ?Sized,
148        DeviceWatchControllerWriteCommandsRequest:
149            ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsRequest, ___E>,
150    {
151        #[inline]
152        fn encode_option(
153            this: ::core::option::Option<Self>,
154            encoder: &mut ___E,
155            out: &mut ::core::mem::MaybeUninit<
156                ::fidl_next::wire::Box<
157                    'static,
158                    crate::wire::DeviceWatchControllerWriteCommandsRequest,
159                >,
160            >,
161            _: (),
162        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
163            if let Some(inner) = this {
164                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
165                ::fidl_next::wire::Box::encode_present(out);
166            } else {
167                ::fidl_next::wire::Box::encode_absent(out);
168            }
169
170            Ok(())
171        }
172    }
173
174    impl ::fidl_next::FromWire<crate::wire::DeviceWatchControllerWriteCommandsRequest>
175        for DeviceWatchControllerWriteCommandsRequest
176    {
177        #[inline]
178        fn from_wire(wire: crate::wire::DeviceWatchControllerWriteCommandsRequest) -> Self {
179            Self {
180                address: ::fidl_next::FromWire::from_wire(wire.address),
181
182                size: ::fidl_next::FromWire::from_wire(wire.size),
183
184                setup_wake_lease: ::fidl_next::FromWire::from_wire(wire.setup_wake_lease),
185            }
186        }
187    }
188
189    #[derive(Debug, PartialEq)]
190    pub struct DeviceWatchControllerWriteCommandsResponse {
191        pub writes: ::std::vec::Vec<crate::natural::Register8>,
192
193        pub wake_lease: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
194    }
195
196    unsafe impl<___E>
197        ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>, ___E>
198        for DeviceWatchControllerWriteCommandsResponse
199    where
200        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
201        ___E: ::fidl_next::Encoder,
202        ___E: ::fidl_next::fuchsia::HandleEncoder,
203    {
204        #[inline]
205        fn encode(
206            self,
207            encoder_: &mut ___E,
208            out_: &mut ::core::mem::MaybeUninit<
209                crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
210            >,
211            _: (),
212        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
213            ::fidl_next::munge! {
214                let crate::wire::DeviceWatchControllerWriteCommandsResponse {
215                    writes,
216                    wake_lease,
217
218                } = out_;
219            }
220
221            ::fidl_next::Encode::encode(self.writes, encoder_, writes, (256, ()))?;
222
223            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(writes.as_mut_ptr()) };
224            ::fidl_next::Constrained::validate(_field, (256, ()))?;
225
226            ::fidl_next::Encode::encode(self.wake_lease, encoder_, wake_lease, ())?;
227
228            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(wake_lease.as_mut_ptr()) };
229
230            Ok(())
231        }
232    }
233
234    unsafe impl<___E>
235        ::fidl_next::EncodeOption<
236            ::fidl_next::wire::Box<
237                'static,
238                crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
239            >,
240            ___E,
241        > for DeviceWatchControllerWriteCommandsResponse
242    where
243        ___E: ::fidl_next::Encoder + ?Sized,
244        DeviceWatchControllerWriteCommandsResponse: ::fidl_next::Encode<
245                crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
246                ___E,
247            >,
248    {
249        #[inline]
250        fn encode_option(
251            this: ::core::option::Option<Self>,
252            encoder: &mut ___E,
253            out: &mut ::core::mem::MaybeUninit<
254                ::fidl_next::wire::Box<
255                    'static,
256                    crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
257                >,
258            >,
259            _: (),
260        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
261            if let Some(inner) = this {
262                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
263                ::fidl_next::wire::Box::encode_present(out);
264            } else {
265                ::fidl_next::wire::Box::encode_absent(out);
266            }
267
268            Ok(())
269        }
270    }
271
272    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceWatchControllerWriteCommandsResponse<'de>>
273        for DeviceWatchControllerWriteCommandsResponse
274    {
275        #[inline]
276        fn from_wire(wire: crate::wire::DeviceWatchControllerWriteCommandsResponse<'de>) -> Self {
277            Self {
278                writes: ::fidl_next::FromWire::from_wire(wire.writes),
279
280                wake_lease: ::fidl_next::FromWire::from_wire(wire.wake_lease),
281            }
282        }
283    }
284}
285
286pub mod wire {
287
288    pub use fidl_next_common_fuchsia_hardware_spmi::wire::*;
289
290    /// The wire type corresponding to [`DebugConnectTargetRequest`].
291    #[derive(Debug)]
292    #[repr(C)]
293    pub struct DebugConnectTargetRequest {
294        pub target_id: u8,
295
296        pub server: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
297    }
298
299    static_assertions::const_assert_eq!(std::mem::size_of::<DebugConnectTargetRequest>(), 8);
300    static_assertions::const_assert_eq!(std::mem::align_of::<DebugConnectTargetRequest>(), 4);
301
302    static_assertions::const_assert_eq!(
303        std::mem::offset_of!(DebugConnectTargetRequest, target_id),
304        0
305    );
306
307    static_assertions::const_assert_eq!(std::mem::offset_of!(DebugConnectTargetRequest, server), 4);
308
309    impl ::fidl_next::Constrained for DebugConnectTargetRequest {
310        type Constraint = ();
311
312        fn validate(
313            _: ::fidl_next::Slot<'_, Self>,
314            _: Self::Constraint,
315        ) -> Result<(), ::fidl_next::ValidationError> {
316            Ok(())
317        }
318    }
319
320    unsafe impl ::fidl_next::Wire for DebugConnectTargetRequest {
321        type Narrowed<'de> = DebugConnectTargetRequest;
322
323        #[inline]
324        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
325            ::fidl_next::munge! {
326                let Self {
327                    target_id,
328                    server,
329
330                } = &mut *out_;
331            }
332
333            ::fidl_next::Wire::zero_padding(target_id);
334
335            ::fidl_next::Wire::zero_padding(server);
336
337            unsafe {
338                out_.as_mut_ptr().cast::<u8>().add(1).write_bytes(0, 3);
339            }
340        }
341    }
342
343    unsafe impl<___D> ::fidl_next::Decode<___D> for DebugConnectTargetRequest
344    where
345        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
346        ___D: ::fidl_next::fuchsia::HandleDecoder,
347    {
348        fn decode(
349            slot_: ::fidl_next::Slot<'_, Self>,
350            decoder_: &mut ___D,
351            _: (),
352        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
353            if slot_.as_bytes()[1..4] != [0u8; 3] {
354                return Err(::fidl_next::DecodeError::InvalidPadding);
355            }
356
357            ::fidl_next::munge! {
358                let Self {
359                    mut target_id,
360                    mut server,
361
362                } = slot_;
363            }
364
365            let _field = target_id.as_mut();
366
367            ::fidl_next::Decode::decode(target_id.as_mut(), decoder_, ())?;
368
369            let _field = server.as_mut();
370
371            ::fidl_next::Decode::decode(server.as_mut(), decoder_, ())?;
372
373            Ok(())
374        }
375    }
376
377    impl ::fidl_next::IntoNatural for DebugConnectTargetRequest {
378        type Natural = crate::natural::DebugConnectTargetRequest;
379    }
380
381    /// The wire type corresponding to [`DeviceWatchControllerWriteCommandsRequest`].
382    #[derive(Debug)]
383    #[repr(C)]
384    pub struct DeviceWatchControllerWriteCommandsRequest {
385        pub address: u8,
386
387        pub size: ::fidl_next::wire::Uint16,
388
389        pub setup_wake_lease: ::fidl_next::wire::fuchsia::OptionalEventPair,
390    }
391
392    static_assertions::const_assert_eq!(
393        std::mem::size_of::<DeviceWatchControllerWriteCommandsRequest>(),
394        8
395    );
396    static_assertions::const_assert_eq!(
397        std::mem::align_of::<DeviceWatchControllerWriteCommandsRequest>(),
398        4
399    );
400
401    static_assertions::const_assert_eq!(
402        std::mem::offset_of!(DeviceWatchControllerWriteCommandsRequest, address),
403        0
404    );
405
406    static_assertions::const_assert_eq!(
407        std::mem::offset_of!(DeviceWatchControllerWriteCommandsRequest, size),
408        2
409    );
410
411    static_assertions::const_assert_eq!(
412        std::mem::offset_of!(DeviceWatchControllerWriteCommandsRequest, setup_wake_lease),
413        4
414    );
415
416    impl ::fidl_next::Constrained for DeviceWatchControllerWriteCommandsRequest {
417        type Constraint = ();
418
419        fn validate(
420            _: ::fidl_next::Slot<'_, Self>,
421            _: Self::Constraint,
422        ) -> Result<(), ::fidl_next::ValidationError> {
423            Ok(())
424        }
425    }
426
427    unsafe impl ::fidl_next::Wire for DeviceWatchControllerWriteCommandsRequest {
428        type Narrowed<'de> = DeviceWatchControllerWriteCommandsRequest;
429
430        #[inline]
431        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
432            ::fidl_next::munge! {
433                let Self {
434                    address,
435                    size,
436                    setup_wake_lease,
437
438                } = &mut *out_;
439            }
440
441            ::fidl_next::Wire::zero_padding(address);
442
443            ::fidl_next::Wire::zero_padding(size);
444
445            ::fidl_next::Wire::zero_padding(setup_wake_lease);
446
447            unsafe {
448                out_.as_mut_ptr().cast::<u8>().add(1).write_bytes(0, 1);
449            }
450        }
451    }
452
453    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceWatchControllerWriteCommandsRequest
454    where
455        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
456        ___D: ::fidl_next::fuchsia::HandleDecoder,
457    {
458        fn decode(
459            slot_: ::fidl_next::Slot<'_, Self>,
460            decoder_: &mut ___D,
461            _: (),
462        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
463            if slot_.as_bytes()[1..2] != [0u8; 1] {
464                return Err(::fidl_next::DecodeError::InvalidPadding);
465            }
466
467            ::fidl_next::munge! {
468                let Self {
469                    mut address,
470                    mut size,
471                    mut setup_wake_lease,
472
473                } = slot_;
474            }
475
476            let _field = address.as_mut();
477
478            ::fidl_next::Decode::decode(address.as_mut(), decoder_, ())?;
479
480            let _field = size.as_mut();
481
482            ::fidl_next::Decode::decode(size.as_mut(), decoder_, ())?;
483
484            let _field = setup_wake_lease.as_mut();
485
486            ::fidl_next::Decode::decode(setup_wake_lease.as_mut(), decoder_, ())?;
487
488            Ok(())
489        }
490    }
491
492    impl ::fidl_next::IntoNatural for DeviceWatchControllerWriteCommandsRequest {
493        type Natural = crate::natural::DeviceWatchControllerWriteCommandsRequest;
494    }
495
496    /// The wire type corresponding to [`DeviceWatchControllerWriteCommandsResponse`].
497    #[derive(Debug)]
498    #[repr(C)]
499    pub struct DeviceWatchControllerWriteCommandsResponse<'de> {
500        pub writes: ::fidl_next::wire::Vector<'de, crate::wire::Register8>,
501
502        pub wake_lease: ::fidl_next::wire::fuchsia::OptionalEventPair,
503    }
504
505    static_assertions::const_assert_eq!(
506        std::mem::size_of::<DeviceWatchControllerWriteCommandsResponse<'_>>(),
507        24
508    );
509    static_assertions::const_assert_eq!(
510        std::mem::align_of::<DeviceWatchControllerWriteCommandsResponse<'_>>(),
511        8
512    );
513
514    static_assertions::const_assert_eq!(
515        std::mem::offset_of!(DeviceWatchControllerWriteCommandsResponse<'_>, writes),
516        0
517    );
518
519    static_assertions::const_assert_eq!(
520        std::mem::offset_of!(DeviceWatchControllerWriteCommandsResponse<'_>, wake_lease),
521        16
522    );
523
524    impl ::fidl_next::Constrained for DeviceWatchControllerWriteCommandsResponse<'_> {
525        type Constraint = ();
526
527        fn validate(
528            _: ::fidl_next::Slot<'_, Self>,
529            _: Self::Constraint,
530        ) -> Result<(), ::fidl_next::ValidationError> {
531            Ok(())
532        }
533    }
534
535    unsafe impl ::fidl_next::Wire for DeviceWatchControllerWriteCommandsResponse<'static> {
536        type Narrowed<'de> = DeviceWatchControllerWriteCommandsResponse<'de>;
537
538        #[inline]
539        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
540            ::fidl_next::munge! {
541                let Self {
542                    writes,
543                    wake_lease,
544
545                } = &mut *out_;
546            }
547
548            ::fidl_next::Wire::zero_padding(writes);
549
550            ::fidl_next::Wire::zero_padding(wake_lease);
551
552            unsafe {
553                out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
554            }
555        }
556    }
557
558    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceWatchControllerWriteCommandsResponse<'de>
559    where
560        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
561        ___D: ::fidl_next::Decoder<'de>,
562        ___D: ::fidl_next::fuchsia::HandleDecoder,
563    {
564        fn decode(
565            slot_: ::fidl_next::Slot<'_, Self>,
566            decoder_: &mut ___D,
567            _: (),
568        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
569            if slot_.as_bytes()[20..24] != [0u8; 4] {
570                return Err(::fidl_next::DecodeError::InvalidPadding);
571            }
572
573            ::fidl_next::munge! {
574                let Self {
575                    mut writes,
576                    mut wake_lease,
577
578                } = slot_;
579            }
580
581            let _field = writes.as_mut();
582            ::fidl_next::Constrained::validate(_field, (256, ()))?;
583            ::fidl_next::Decode::decode(writes.as_mut(), decoder_, (256, ()))?;
584
585            let writes = unsafe { writes.deref_unchecked() };
586
587            if writes.len() > 256 {
588                return Err(::fidl_next::DecodeError::VectorTooLong {
589                    size: writes.len() as u64,
590                    limit: 256,
591                });
592            }
593
594            let _field = wake_lease.as_mut();
595
596            ::fidl_next::Decode::decode(wake_lease.as_mut(), decoder_, ())?;
597
598            Ok(())
599        }
600    }
601
602    impl<'de> ::fidl_next::IntoNatural for DeviceWatchControllerWriteCommandsResponse<'de> {
603        type Natural = crate::natural::DeviceWatchControllerWriteCommandsResponse;
604    }
605}
606
607pub mod wire_optional {
608
609    pub use fidl_next_common_fuchsia_hardware_spmi::wire_optional::*;
610}
611
612pub mod generic {
613
614    pub use fidl_next_common_fuchsia_hardware_spmi::generic::*;
615
616    /// The generic type corresponding to [`DebugConnectTargetRequest`].
617    pub struct DebugConnectTargetRequest<T0, T1> {
618        pub target_id: T0,
619
620        pub server: T1,
621    }
622
623    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::DebugConnectTargetRequest, ___E>
624        for DebugConnectTargetRequest<T0, T1>
625    where
626        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
627        ___E: ::fidl_next::fuchsia::HandleEncoder,
628        T0: ::fidl_next::Encode<u8, ___E>,
629        T1: ::fidl_next::Encode<
630                ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
631                ___E,
632            >,
633    {
634        #[inline]
635        fn encode(
636            self,
637            encoder_: &mut ___E,
638            out_: &mut ::core::mem::MaybeUninit<crate::wire::DebugConnectTargetRequest>,
639            _: (),
640        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
641            ::fidl_next::munge! {
642                let crate::wire::DebugConnectTargetRequest {
643                    target_id,
644                    server,
645
646                } = out_;
647            }
648
649            ::fidl_next::Encode::encode(self.target_id, encoder_, target_id, ())?;
650
651            ::fidl_next::Encode::encode(self.server, encoder_, server, ())?;
652
653            Ok(())
654        }
655    }
656
657    unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::DebugConnectTargetRequest, ___E>
658        for &'a DebugConnectTargetRequest<T0, T1>
659    where
660        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
661        ___E: ::fidl_next::fuchsia::HandleEncoder,
662        &'a T0: ::fidl_next::Encode<u8, ___E>,
663        &'a T1: ::fidl_next::Encode<
664                ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
665                ___E,
666            >,
667    {
668        #[inline]
669        fn encode(
670            self,
671            encoder_: &mut ___E,
672            out_: &mut ::core::mem::MaybeUninit<crate::wire::DebugConnectTargetRequest>,
673            _: (),
674        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
675            ::fidl_next::munge! {
676                let crate::wire::DebugConnectTargetRequest {
677                    target_id,
678                    server,
679
680                } = out_;
681            }
682
683            ::fidl_next::Encode::encode(&self.target_id, encoder_, target_id, ())?;
684
685            ::fidl_next::Encode::encode(&self.server, encoder_, server, ())?;
686
687            Ok(())
688        }
689    }
690
691    /// The generic type corresponding to [`DeviceWatchControllerWriteCommandsRequest`].
692    pub struct DeviceWatchControllerWriteCommandsRequest<T0, T1, T2> {
693        pub address: T0,
694
695        pub size: T1,
696
697        pub setup_wake_lease: T2,
698    }
699
700    unsafe impl<___E, T0, T1, T2>
701        ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsRequest, ___E>
702        for DeviceWatchControllerWriteCommandsRequest<T0, T1, T2>
703    where
704        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
705        ___E: ::fidl_next::fuchsia::HandleEncoder,
706        T0: ::fidl_next::Encode<u8, ___E>,
707        T1: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
708        T2: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
709    {
710        #[inline]
711        fn encode(
712            self,
713            encoder_: &mut ___E,
714            out_: &mut ::core::mem::MaybeUninit<
715                crate::wire::DeviceWatchControllerWriteCommandsRequest,
716            >,
717            _: (),
718        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
719            ::fidl_next::munge! {
720                let crate::wire::DeviceWatchControllerWriteCommandsRequest {
721                    address,
722                    size,
723                    setup_wake_lease,
724
725                } = out_;
726            }
727
728            ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
729
730            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
731
732            ::fidl_next::Encode::encode(self.setup_wake_lease, encoder_, setup_wake_lease, ())?;
733
734            Ok(())
735        }
736    }
737
738    unsafe impl<'a, ___E, T0, T1, T2>
739        ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsRequest, ___E>
740        for &'a DeviceWatchControllerWriteCommandsRequest<T0, T1, T2>
741    where
742        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
743        ___E: ::fidl_next::fuchsia::HandleEncoder,
744        &'a T0: ::fidl_next::Encode<u8, ___E>,
745        &'a T1: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
746        &'a T2: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
747    {
748        #[inline]
749        fn encode(
750            self,
751            encoder_: &mut ___E,
752            out_: &mut ::core::mem::MaybeUninit<
753                crate::wire::DeviceWatchControllerWriteCommandsRequest,
754            >,
755            _: (),
756        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
757            ::fidl_next::munge! {
758                let crate::wire::DeviceWatchControllerWriteCommandsRequest {
759                    address,
760                    size,
761                    setup_wake_lease,
762
763                } = out_;
764            }
765
766            ::fidl_next::Encode::encode(&self.address, encoder_, address, ())?;
767
768            ::fidl_next::Encode::encode(&self.size, encoder_, size, ())?;
769
770            ::fidl_next::Encode::encode(&self.setup_wake_lease, encoder_, setup_wake_lease, ())?;
771
772            Ok(())
773        }
774    }
775
776    /// The generic type corresponding to [`DeviceWatchControllerWriteCommandsResponse`].
777    pub struct DeviceWatchControllerWriteCommandsResponse<T0, T1> {
778        pub writes: T0,
779
780        pub wake_lease: T1,
781    }
782
783    unsafe impl<___E, T0, T1>
784        ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>, ___E>
785        for DeviceWatchControllerWriteCommandsResponse<T0, T1>
786    where
787        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
788        ___E: ::fidl_next::Encoder,
789        ___E: ::fidl_next::fuchsia::HandleEncoder,
790        T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, crate::wire::Register8>, ___E>,
791        T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
792    {
793        #[inline]
794        fn encode(
795            self,
796            encoder_: &mut ___E,
797            out_: &mut ::core::mem::MaybeUninit<
798                crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
799            >,
800            _: (),
801        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
802            ::fidl_next::munge! {
803                let crate::wire::DeviceWatchControllerWriteCommandsResponse {
804                    writes,
805                    wake_lease,
806
807                } = out_;
808            }
809
810            ::fidl_next::Encode::encode(self.writes, encoder_, writes, (256, ()))?;
811
812            ::fidl_next::Encode::encode(self.wake_lease, encoder_, wake_lease, ())?;
813
814            Ok(())
815        }
816    }
817
818    unsafe impl<'a, ___E, T0, T1>
819        ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>, ___E>
820        for &'a DeviceWatchControllerWriteCommandsResponse<T0, T1>
821    where
822        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
823        ___E: ::fidl_next::Encoder,
824        ___E: ::fidl_next::fuchsia::HandleEncoder,
825        &'a T0:
826            ::fidl_next::Encode<::fidl_next::wire::Vector<'static, crate::wire::Register8>, ___E>,
827        &'a T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
828    {
829        #[inline]
830        fn encode(
831            self,
832            encoder_: &mut ___E,
833            out_: &mut ::core::mem::MaybeUninit<
834                crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
835            >,
836            _: (),
837        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
838            ::fidl_next::munge! {
839                let crate::wire::DeviceWatchControllerWriteCommandsResponse {
840                    writes,
841                    wake_lease,
842
843                } = out_;
844            }
845
846            ::fidl_next::Encode::encode(&self.writes, encoder_, writes, (256, ()))?;
847
848            ::fidl_next::Encode::encode(&self.wake_lease, encoder_, wake_lease, ())?;
849
850            Ok(())
851        }
852    }
853}
854
855pub use self::natural::*;
856
857/// The type corresponding to the Debug protocol.
858#[derive(PartialEq, Debug)]
859pub struct Debug;
860
861#[cfg(target_os = "fuchsia")]
862impl ::fidl_next::HasTransport for Debug {
863    type Transport = ::fidl_next::fuchsia::zx::Channel;
864}
865
866pub mod debug {
867    pub mod prelude {
868        pub use crate::{
869            Debug, DebugClientHandler, DebugLocalClientHandler, DebugLocalServerHandler,
870            DebugServerHandler, debug,
871        };
872
873        pub use crate::natural::DebugConnectTargetRequest;
874
875        pub use crate::natural::DebugGetControllerPropertiesResponse;
876
877        pub use crate::natural::DebugConnectTargetResponse;
878
879        pub use crate::natural::DriverError;
880    }
881
882    pub struct ConnectTarget;
883
884    impl ::fidl_next::Method for ConnectTarget {
885        const ORDINAL: u64 = 799648158518250777;
886        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
887            ::fidl_next::protocol::Flexibility::Strict;
888
889        type Protocol = crate::Debug;
890
891        type Request = crate::wire::DebugConnectTargetRequest;
892    }
893
894    impl ::fidl_next::TwoWayMethod for ConnectTarget {
895        type Response = ::fidl_next::wire::Result<
896            'static,
897            crate::wire::DebugConnectTargetResponse,
898            crate::wire::DriverError,
899        >;
900    }
901
902    impl<___R> ::fidl_next::Respond<___R> for ConnectTarget {
903        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
904
905        fn respond(response: ___R) -> Self::Output {
906            ::core::result::Result::Ok(response)
907        }
908    }
909
910    impl<___R> ::fidl_next::RespondErr<___R> for ConnectTarget {
911        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
912
913        fn respond_err(response: ___R) -> Self::Output {
914            ::core::result::Result::Err(response)
915        }
916    }
917
918    pub struct GetControllerProperties;
919
920    impl ::fidl_next::Method for GetControllerProperties {
921        const ORDINAL: u64 = 4733781216537150751;
922        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
923            ::fidl_next::protocol::Flexibility::Strict;
924
925        type Protocol = crate::Debug;
926
927        type Request = ::fidl_next::wire::EmptyMessageBody;
928    }
929
930    impl ::fidl_next::TwoWayMethod for GetControllerProperties {
931        type Response =
932            ::fidl_next::wire::Strict<crate::wire::DebugGetControllerPropertiesResponse<'static>>;
933    }
934
935    impl<___R> ::fidl_next::Respond<___R> for GetControllerProperties {
936        type Output = ::fidl_next::Strict<___R>;
937
938        fn respond(response: ___R) -> Self::Output {
939            ::fidl_next::Strict(response)
940        }
941    }
942
943    mod ___detail {
944        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Debug
945        where
946            ___T: ::fidl_next::Transport,
947        {
948            type Client = DebugClient<___T>;
949            type Server = DebugServer<___T>;
950        }
951
952        /// The client for the `Debug` protocol.
953        #[repr(transparent)]
954        pub struct DebugClient<___T: ::fidl_next::Transport> {
955            #[allow(dead_code)]
956            client: ::fidl_next::protocol::Client<___T>,
957        }
958
959        impl<___T> DebugClient<___T>
960        where
961            ___T: ::fidl_next::Transport,
962        {
963            #[doc = " Connects to the target device with the given ID. Equivalent to connecting to `TargetService`\n via the corresponding driver node.\n\n Returns `INVALID_ARGS` if `target_id` is greater than or equal to `MAX_TARGETS`.\n May return an error if there is no such target on the bus; otherwise errors will be returned\n when attempting to access the client.\n"]
964            pub fn connect_target(
965                &self,
966
967                target_id: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
968
969                server: impl ::fidl_next::Encode<
970                    ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
971                    <___T as ::fidl_next::Transport>::SendBuffer,
972                >,
973            ) -> ::fidl_next::TwoWayFuture<'_, super::ConnectTarget, ___T>
974            where
975                <___T as ::fidl_next::Transport>::SendBuffer:
976                    ::fidl_next::encoder::InternalHandleEncoder,
977                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
978            {
979                self.connect_target_with(crate::generic::DebugConnectTargetRequest {
980                    target_id,
981
982                    server,
983                })
984            }
985
986            #[doc = " Connects to the target device with the given ID. Equivalent to connecting to `TargetService`\n via the corresponding driver node.\n\n Returns `INVALID_ARGS` if `target_id` is greater than or equal to `MAX_TARGETS`.\n May return an error if there is no such target on the bus; otherwise errors will be returned\n when attempting to access the client.\n"]
987            pub fn connect_target_with<___R>(
988                &self,
989                request: ___R,
990            ) -> ::fidl_next::TwoWayFuture<'_, super::ConnectTarget, ___T>
991            where
992                ___R: ::fidl_next::Encode<
993                        crate::wire::DebugConnectTargetRequest,
994                        <___T as ::fidl_next::Transport>::SendBuffer,
995                    >,
996            {
997                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
998                    799648158518250777,
999                    <super::ConnectTarget as ::fidl_next::Method>::FLEXIBILITY,
1000                    request,
1001                ))
1002            }
1003
1004            #[doc = " Returns the properties of the host SPMI controller.\n"]
1005            pub fn get_controller_properties(
1006                &self,
1007            ) -> ::fidl_next::TwoWayFuture<'_, super::GetControllerProperties, ___T> {
1008                ::fidl_next::TwoWayFuture::from_untyped(
1009                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1010                        4733781216537150751,
1011                        <super::GetControllerProperties as ::fidl_next::Method>::FLEXIBILITY,
1012                        (),
1013                    ),
1014                )
1015            }
1016        }
1017
1018        /// The server for the `Debug` protocol.
1019        #[repr(transparent)]
1020        pub struct DebugServer<___T: ::fidl_next::Transport> {
1021            server: ::fidl_next::protocol::Server<___T>,
1022        }
1023
1024        impl<___T> DebugServer<___T> where ___T: ::fidl_next::Transport {}
1025    }
1026}
1027
1028#[diagnostic::on_unimplemented(
1029    note = "If {Self} implements the non-local DebugClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1030)]
1031
1032/// A client handler for the Debug protocol.
1033///
1034/// See [`Debug`] for more details.
1035pub trait DebugLocalClientHandler<
1036    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1037    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1038>
1039{
1040    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1041        ::core::future::ready(())
1042    }
1043}
1044
1045impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Debug
1046where
1047    ___H: DebugLocalClientHandler<___T>,
1048    ___T: ::fidl_next::Transport,
1049{
1050    async fn on_event(
1051        handler: &mut ___H,
1052        mut message: ::fidl_next::Message<___T>,
1053    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1054        match *message.header().ordinal {
1055            ordinal => {
1056                handler.on_unknown_interaction(ordinal).await;
1057                if ::core::matches!(
1058                    message.header().flexibility(),
1059                    ::fidl_next::protocol::Flexibility::Strict
1060                ) {
1061                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1062                } else {
1063                    Ok(())
1064                }
1065            }
1066        }
1067    }
1068}
1069
1070#[diagnostic::on_unimplemented(
1071    note = "If {Self} implements the non-local DebugServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1072)]
1073
1074/// A server handler for the Debug protocol.
1075///
1076/// See [`Debug`] for more details.
1077pub trait DebugLocalServerHandler<
1078    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1079    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1080>
1081{
1082    #[doc = " Connects to the target device with the given ID. Equivalent to connecting to `TargetService`\n via the corresponding driver node.\n\n Returns `INVALID_ARGS` if `target_id` is greater than or equal to `MAX_TARGETS`.\n May return an error if there is no such target on the bus; otherwise errors will be returned\n when attempting to access the client.\n"]
1083    fn connect_target(
1084        &mut self,
1085
1086        request: ::fidl_next::Request<debug::ConnectTarget, ___T>,
1087
1088        responder: ::fidl_next::Responder<debug::ConnectTarget, ___T>,
1089    ) -> impl ::core::future::Future<Output = ()>;
1090
1091    #[doc = " Returns the properties of the host SPMI controller.\n"]
1092    fn get_controller_properties(
1093        &mut self,
1094
1095        responder: ::fidl_next::Responder<debug::GetControllerProperties, ___T>,
1096    ) -> impl ::core::future::Future<Output = ()>;
1097
1098    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1099        ::core::future::ready(())
1100    }
1101}
1102
1103impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Debug
1104where
1105    ___H: DebugLocalServerHandler<___T>,
1106    ___T: ::fidl_next::Transport,
1107    for<'de> crate::wire::DebugConnectTargetRequest: ::fidl_next::Decode<
1108            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1109            Constraint = (),
1110        >,
1111{
1112    async fn on_one_way(
1113        handler: &mut ___H,
1114        mut message: ::fidl_next::Message<___T>,
1115    ) -> ::core::result::Result<
1116        (),
1117        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1118    > {
1119        match *message.header().ordinal {
1120            ordinal => {
1121                handler.on_unknown_interaction(ordinal).await;
1122                if ::core::matches!(
1123                    message.header().flexibility(),
1124                    ::fidl_next::protocol::Flexibility::Strict
1125                ) {
1126                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1127                } else {
1128                    Ok(())
1129                }
1130            }
1131        }
1132    }
1133
1134    async fn on_two_way(
1135        handler: &mut ___H,
1136        mut message: ::fidl_next::Message<___T>,
1137        responder: ::fidl_next::protocol::Responder<___T>,
1138    ) -> ::core::result::Result<
1139        (),
1140        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1141    > {
1142        match *message.header().ordinal {
1143            799648158518250777 => {
1144                let responder = ::fidl_next::Responder::from_untyped(responder);
1145
1146                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1147                    Ok(decoded) => {
1148                        handler
1149                            .connect_target(::fidl_next::Request::from_decoded(decoded), responder)
1150                            .await;
1151                        Ok(())
1152                    }
1153                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1154                        ordinal: 799648158518250777,
1155                        error,
1156                    }),
1157                }
1158            }
1159
1160            4733781216537150751 => {
1161                let responder = ::fidl_next::Responder::from_untyped(responder);
1162
1163                handler.get_controller_properties(responder).await;
1164                Ok(())
1165            }
1166
1167            ordinal => {
1168                handler.on_unknown_interaction(ordinal).await;
1169                if ::core::matches!(
1170                    message.header().flexibility(),
1171                    ::fidl_next::protocol::Flexibility::Strict
1172                ) {
1173                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1174                } else {
1175                    responder
1176                        .respond_framework_error(
1177                            ordinal,
1178                            ::fidl_next::FrameworkError::UnknownMethod,
1179                        )
1180                        .expect("encoding a framework error should never fail")
1181                        .await?;
1182                    Ok(())
1183                }
1184            }
1185        }
1186    }
1187}
1188
1189/// A client handler for the Debug protocol.
1190///
1191/// See [`Debug`] for more details.
1192pub trait DebugClientHandler<
1193    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1194    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1195>
1196{
1197    fn on_unknown_interaction(
1198        &mut self,
1199        ordinal: u64,
1200    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1201        ::core::future::ready(())
1202    }
1203}
1204
1205impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Debug
1206where
1207    ___H: DebugClientHandler<___T> + ::core::marker::Send,
1208    ___T: ::fidl_next::Transport,
1209{
1210    async fn on_event(
1211        handler: &mut ___H,
1212        mut message: ::fidl_next::Message<___T>,
1213    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1214        match *message.header().ordinal {
1215            ordinal => {
1216                handler.on_unknown_interaction(ordinal).await;
1217                if ::core::matches!(
1218                    message.header().flexibility(),
1219                    ::fidl_next::protocol::Flexibility::Strict
1220                ) {
1221                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1222                } else {
1223                    Ok(())
1224                }
1225            }
1226        }
1227    }
1228}
1229
1230/// A server handler for the Debug protocol.
1231///
1232/// See [`Debug`] for more details.
1233pub trait DebugServerHandler<
1234    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1235    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1236>
1237{
1238    #[doc = " Connects to the target device with the given ID. Equivalent to connecting to `TargetService`\n via the corresponding driver node.\n\n Returns `INVALID_ARGS` if `target_id` is greater than or equal to `MAX_TARGETS`.\n May return an error if there is no such target on the bus; otherwise errors will be returned\n when attempting to access the client.\n"]
1239    fn connect_target(
1240        &mut self,
1241
1242        request: ::fidl_next::Request<debug::ConnectTarget, ___T>,
1243
1244        responder: ::fidl_next::Responder<debug::ConnectTarget, ___T>,
1245    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1246
1247    #[doc = " Returns the properties of the host SPMI controller.\n"]
1248    fn get_controller_properties(
1249        &mut self,
1250
1251        responder: ::fidl_next::Responder<debug::GetControllerProperties, ___T>,
1252    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1253
1254    fn on_unknown_interaction(
1255        &mut self,
1256        ordinal: u64,
1257    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1258        ::core::future::ready(())
1259    }
1260}
1261
1262impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Debug
1263where
1264    ___H: DebugServerHandler<___T> + ::core::marker::Send,
1265    ___T: ::fidl_next::Transport,
1266    for<'de> crate::wire::DebugConnectTargetRequest: ::fidl_next::Decode<
1267            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1268            Constraint = (),
1269        >,
1270{
1271    async fn on_one_way(
1272        handler: &mut ___H,
1273        mut message: ::fidl_next::Message<___T>,
1274    ) -> ::core::result::Result<
1275        (),
1276        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1277    > {
1278        match *message.header().ordinal {
1279            ordinal => {
1280                handler.on_unknown_interaction(ordinal).await;
1281                if ::core::matches!(
1282                    message.header().flexibility(),
1283                    ::fidl_next::protocol::Flexibility::Strict
1284                ) {
1285                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1286                } else {
1287                    Ok(())
1288                }
1289            }
1290        }
1291    }
1292
1293    async fn on_two_way(
1294        handler: &mut ___H,
1295        mut message: ::fidl_next::Message<___T>,
1296        responder: ::fidl_next::protocol::Responder<___T>,
1297    ) -> ::core::result::Result<
1298        (),
1299        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1300    > {
1301        match *message.header().ordinal {
1302            799648158518250777 => {
1303                let responder = ::fidl_next::Responder::from_untyped(responder);
1304
1305                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1306                    Ok(decoded) => {
1307                        handler
1308                            .connect_target(::fidl_next::Request::from_decoded(decoded), responder)
1309                            .await;
1310                        Ok(())
1311                    }
1312                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1313                        ordinal: 799648158518250777,
1314                        error,
1315                    }),
1316                }
1317            }
1318
1319            4733781216537150751 => {
1320                let responder = ::fidl_next::Responder::from_untyped(responder);
1321
1322                handler.get_controller_properties(responder).await;
1323                Ok(())
1324            }
1325
1326            ordinal => {
1327                handler.on_unknown_interaction(ordinal).await;
1328                if ::core::matches!(
1329                    message.header().flexibility(),
1330                    ::fidl_next::protocol::Flexibility::Strict
1331                ) {
1332                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1333                } else {
1334                    responder
1335                        .respond_framework_error(
1336                            ordinal,
1337                            ::fidl_next::FrameworkError::UnknownMethod,
1338                        )
1339                        .expect("encoding a framework error should never fail")
1340                        .await?;
1341                    Ok(())
1342                }
1343            }
1344        }
1345    }
1346}
1347
1348impl<___T> DebugClientHandler<___T> for ::fidl_next::IgnoreEvents
1349where
1350    ___T: ::fidl_next::Transport,
1351{
1352    async fn on_unknown_interaction(&mut self, _: u64) {}
1353}
1354
1355impl<___H, ___T> DebugLocalClientHandler<___T> for ::fidl_next::Local<___H>
1356where
1357    ___H: DebugClientHandler<___T>,
1358    ___T: ::fidl_next::Transport,
1359{
1360    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1361        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1362    }
1363}
1364
1365impl<___H, ___T> DebugLocalServerHandler<___T> for ::fidl_next::Local<___H>
1366where
1367    ___H: DebugServerHandler<___T>,
1368    ___T: ::fidl_next::Transport,
1369{
1370    async fn connect_target(
1371        &mut self,
1372
1373        request: ::fidl_next::Request<debug::ConnectTarget, ___T>,
1374
1375        responder: ::fidl_next::Responder<debug::ConnectTarget, ___T>,
1376    ) {
1377        ___H::connect_target(&mut self.0, request, responder).await
1378    }
1379
1380    async fn get_controller_properties(
1381        &mut self,
1382
1383        responder: ::fidl_next::Responder<debug::GetControllerProperties, ___T>,
1384    ) {
1385        ___H::get_controller_properties(&mut self.0, responder).await
1386    }
1387
1388    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1389        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1390    }
1391}
1392
1393/// The type corresponding to the DebugService service.
1394#[doc = " This service can be used by command-line utilities and tests to connect to any target device on\n the SPMI bus. It is not exposed to drivers.\n"]
1395#[derive(Debug)]
1396pub struct DebugService;
1397
1398impl ::fidl_next::DiscoverableService for DebugService {
1399    const SERVICE_NAME: &'static str = "fuchsia.hardware.spmi.DebugService";
1400    const MEMBER_NAMES: &'static [&'static str] = &["device"];
1401}
1402
1403impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for DebugService {}
1404
1405impl<___C> ::fidl_next::Service<___C> for DebugService
1406where
1407    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1408{
1409    type Connector = DebugServiceConnector<___C>;
1410}
1411
1412/// A strongly-typed service connector for the `DebugService` service.
1413#[repr(transparent)]
1414pub struct DebugServiceConnector<___C> {
1415    #[allow(dead_code)]
1416    connector: ___C,
1417}
1418
1419impl<___C> DebugServiceConnector<___C>
1420where
1421    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1422{
1423    /// Attempts to connect to the `device` service member.
1424    pub fn device(
1425        &self,
1426        server_end: ::fidl_next::ServerEnd<crate::Debug, ::fidl_next::fuchsia::zx::Channel>,
1427    ) -> ::core::result::Result<
1428        (),
1429        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
1430    > {
1431        ::fidl_next::protocol::ServiceConnector::<
1432                ::fidl_next::fuchsia::zx::Channel
1433            >::connect_to_member(
1434                &self.connector,
1435                "device",
1436                server_end.into_untyped(),
1437            )
1438    }
1439}
1440
1441/// A service handler for the `DebugService` service.
1442pub trait DebugServiceHandler {
1443    /// Handles an attempt to connect to the `device` member.
1444    fn device(
1445        &self,
1446        server_end: ::fidl_next::ServerEnd<crate::Debug, ::fidl_next::fuchsia::zx::Channel>,
1447    );
1448}
1449
1450impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for DebugService
1451where
1452    ___H: DebugServiceHandler,
1453    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
1454{
1455    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
1456        use ::fidl_next::InstanceFromServiceTransport;
1457        match member {
1458            "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
1459                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
1460            )),
1461
1462            _ => unreachable!(),
1463        }
1464    }
1465}
1466
1467/// The type corresponding to the Device protocol.
1468#[doc = " Each instance of `Device` represents a target/secondary SPMI device on a SPMI bus.\n To support multiple SPMI devices, multiple nodes must be instantiated.\n"]
1469#[derive(PartialEq, Debug)]
1470pub struct Device;
1471
1472impl ::fidl_next::Discoverable for Device {
1473    const PROTOCOL_NAME: &'static str = "fuchsia.hardware.spmi.Device";
1474}
1475
1476#[cfg(target_os = "fuchsia")]
1477impl ::fidl_next::HasTransport for Device {
1478    type Transport = ::fidl_next::fuchsia::zx::Channel;
1479}
1480
1481pub mod device {
1482    pub mod prelude {
1483        pub use crate::{
1484            Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
1485            DeviceServerHandler, device,
1486        };
1487
1488        pub use crate::natural::DeviceCancelWatchControllerWriteCommandsRequest;
1489
1490        pub use crate::natural::DeviceRegisterReadRequest;
1491
1492        pub use crate::natural::DeviceRegisterWriteRequest;
1493
1494        pub use crate::natural::DeviceWatchControllerWriteCommandsRequest;
1495
1496        pub use crate::natural::DeviceCancelWatchControllerWriteCommandsResponse;
1497
1498        pub use crate::natural::DeviceGetPropertiesResponse;
1499
1500        pub use crate::natural::DeviceRegisterReadResponse;
1501
1502        pub use crate::natural::DeviceRegisterWriteResponse;
1503
1504        pub use crate::natural::DeviceWatchControllerWriteCommandsResponse;
1505
1506        pub use crate::natural::DriverError;
1507    }
1508
1509    pub struct RegisterRead;
1510
1511    impl ::fidl_next::Method for RegisterRead {
1512        const ORDINAL: u64 = 7616793777944757;
1513        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1514            ::fidl_next::protocol::Flexibility::Flexible;
1515
1516        type Protocol = crate::Device;
1517
1518        type Request = crate::wire::DeviceRegisterReadRequest;
1519    }
1520
1521    impl ::fidl_next::TwoWayMethod for RegisterRead {
1522        type Response = ::fidl_next::wire::Result<
1523            'static,
1524            crate::wire::DeviceRegisterReadResponse<'static>,
1525            crate::wire::DriverError,
1526        >;
1527    }
1528
1529    impl<___R> ::fidl_next::Respond<___R> for RegisterRead {
1530        type Output = ::core::result::Result<
1531            crate::generic::DeviceRegisterReadResponse<___R>,
1532            ::fidl_next::never::Never,
1533        >;
1534
1535        fn respond(response: ___R) -> Self::Output {
1536            ::core::result::Result::Ok(crate::generic::DeviceRegisterReadResponse {
1537                data: response,
1538            })
1539        }
1540    }
1541
1542    impl<___R> ::fidl_next::RespondErr<___R> for RegisterRead {
1543        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1544
1545        fn respond_err(response: ___R) -> Self::Output {
1546            ::core::result::Result::Err(response)
1547        }
1548    }
1549
1550    pub struct RegisterWrite;
1551
1552    impl ::fidl_next::Method for RegisterWrite {
1553        const ORDINAL: u64 = 1044640317848992555;
1554        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1555            ::fidl_next::protocol::Flexibility::Flexible;
1556
1557        type Protocol = crate::Device;
1558
1559        type Request = crate::wire::DeviceRegisterWriteRequest<'static>;
1560    }
1561
1562    impl ::fidl_next::TwoWayMethod for RegisterWrite {
1563        type Response = ::fidl_next::wire::Result<
1564            'static,
1565            crate::wire::DeviceRegisterWriteResponse,
1566            crate::wire::DriverError,
1567        >;
1568    }
1569
1570    impl<___R> ::fidl_next::Respond<___R> for RegisterWrite {
1571        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1572
1573        fn respond(response: ___R) -> Self::Output {
1574            ::core::result::Result::Ok(response)
1575        }
1576    }
1577
1578    impl<___R> ::fidl_next::RespondErr<___R> for RegisterWrite {
1579        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1580
1581        fn respond_err(response: ___R) -> Self::Output {
1582            ::core::result::Result::Err(response)
1583        }
1584    }
1585
1586    pub struct GetProperties;
1587
1588    impl ::fidl_next::Method for GetProperties {
1589        const ORDINAL: u64 = 2203507889677991867;
1590        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1591            ::fidl_next::protocol::Flexibility::Flexible;
1592
1593        type Protocol = crate::Device;
1594
1595        type Request = ::fidl_next::wire::EmptyMessageBody;
1596    }
1597
1598    impl ::fidl_next::TwoWayMethod for GetProperties {
1599        type Response =
1600            ::fidl_next::wire::Flexible<'static, crate::wire::DeviceGetPropertiesResponse<'static>>;
1601    }
1602
1603    impl<___R> ::fidl_next::Respond<___R> for GetProperties {
1604        type Output = ::fidl_next::Flexible<___R>;
1605
1606        fn respond(response: ___R) -> Self::Output {
1607            ::fidl_next::Flexible(response)
1608        }
1609    }
1610
1611    pub struct WatchControllerWriteCommands;
1612
1613    impl ::fidl_next::Method for WatchControllerWriteCommands {
1614        const ORDINAL: u64 = 4712819229924853164;
1615        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1616            ::fidl_next::protocol::Flexibility::Flexible;
1617
1618        type Protocol = crate::Device;
1619
1620        type Request = crate::wire::DeviceWatchControllerWriteCommandsRequest;
1621    }
1622
1623    impl ::fidl_next::TwoWayMethod for WatchControllerWriteCommands {
1624        type Response = ::fidl_next::wire::Result<
1625            'static,
1626            crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
1627            crate::wire::DriverError,
1628        >;
1629    }
1630
1631    impl<___R> ::fidl_next::Respond<___R> for WatchControllerWriteCommands {
1632        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1633
1634        fn respond(response: ___R) -> Self::Output {
1635            ::core::result::Result::Ok(response)
1636        }
1637    }
1638
1639    impl<___R> ::fidl_next::RespondErr<___R> for WatchControllerWriteCommands {
1640        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1641
1642        fn respond_err(response: ___R) -> Self::Output {
1643            ::core::result::Result::Err(response)
1644        }
1645    }
1646
1647    pub struct CancelWatchControllerWriteCommands;
1648
1649    impl ::fidl_next::Method for CancelWatchControllerWriteCommands {
1650        const ORDINAL: u64 = 5789309704894207008;
1651        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1652            ::fidl_next::protocol::Flexibility::Flexible;
1653
1654        type Protocol = crate::Device;
1655
1656        type Request = crate::wire::DeviceCancelWatchControllerWriteCommandsRequest;
1657    }
1658
1659    impl ::fidl_next::TwoWayMethod for CancelWatchControllerWriteCommands {
1660        type Response = ::fidl_next::wire::Result<
1661            'static,
1662            crate::wire::DeviceCancelWatchControllerWriteCommandsResponse,
1663            crate::wire::DriverError,
1664        >;
1665    }
1666
1667    impl<___R> ::fidl_next::Respond<___R> for CancelWatchControllerWriteCommands {
1668        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1669
1670        fn respond(response: ___R) -> Self::Output {
1671            ::core::result::Result::Ok(response)
1672        }
1673    }
1674
1675    impl<___R> ::fidl_next::RespondErr<___R> for CancelWatchControllerWriteCommands {
1676        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1677
1678        fn respond_err(response: ___R) -> Self::Output {
1679            ::core::result::Result::Err(response)
1680        }
1681    }
1682
1683    mod ___detail {
1684        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1685        where
1686            ___T: ::fidl_next::Transport,
1687        {
1688            type Client = DeviceClient<___T>;
1689            type Server = DeviceServer<___T>;
1690        }
1691
1692        /// The client for the `Device` protocol.
1693        #[repr(transparent)]
1694        pub struct DeviceClient<___T: ::fidl_next::Transport> {
1695            #[allow(dead_code)]
1696            client: ::fidl_next::protocol::Client<___T>,
1697        }
1698
1699        impl<___T> DeviceClient<___T>
1700        where
1701            ___T: ::fidl_next::Transport,
1702        {
1703            #[doc = " Issue register read commands to the SPMI device.\n The implementation may choose which SPMI variation (e.g. extended, long) to use.\n When successful, it returns `size_bytes` in `data` read contiguously starting from\n `address` in the device.\n"]
1704            pub fn register_read(
1705                &self,
1706
1707                address: impl ::fidl_next::Encode<
1708                    ::fidl_next::wire::Uint16,
1709                    <___T as ::fidl_next::Transport>::SendBuffer,
1710                >,
1711
1712                size_bytes: impl ::fidl_next::Encode<
1713                    ::fidl_next::wire::Uint32,
1714                    <___T as ::fidl_next::Transport>::SendBuffer,
1715                >,
1716            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterRead, ___T>
1717            where
1718                <___T as ::fidl_next::Transport>::SendBuffer:
1719                    ::fidl_next::encoder::InternalHandleEncoder,
1720            {
1721                self.register_read_with(crate::generic::DeviceRegisterReadRequest {
1722                    address,
1723
1724                    size_bytes,
1725                })
1726            }
1727
1728            #[doc = " Issue register read commands to the SPMI device.\n The implementation may choose which SPMI variation (e.g. extended, long) to use.\n When successful, it returns `size_bytes` in `data` read contiguously starting from\n `address` in the device.\n"]
1729            pub fn register_read_with<___R>(
1730                &self,
1731                request: ___R,
1732            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterRead, ___T>
1733            where
1734                ___R: ::fidl_next::Encode<
1735                        crate::wire::DeviceRegisterReadRequest,
1736                        <___T as ::fidl_next::Transport>::SendBuffer,
1737                    >,
1738            {
1739                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1740                    7616793777944757,
1741                    <super::RegisterRead as ::fidl_next::Method>::FLEXIBILITY,
1742                    request,
1743                ))
1744            }
1745
1746            #[doc = " Issue register write commands to the SPMI device.\n The implementation may choose which SPMI variation (e.g. extended, long) to use.\n When this command is successful, `data` will be written contiguously starting from\n `address` in the device.\n"]
1747            pub fn register_write(
1748                &self,
1749
1750                address: impl ::fidl_next::Encode<
1751                    ::fidl_next::wire::Uint16,
1752                    <___T as ::fidl_next::Transport>::SendBuffer,
1753                >,
1754
1755                data: impl ::fidl_next::Encode<
1756                    ::fidl_next::wire::Vector<'static, u8>,
1757                    <___T as ::fidl_next::Transport>::SendBuffer,
1758                >,
1759            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterWrite, ___T>
1760            where
1761                <___T as ::fidl_next::Transport>::SendBuffer:
1762                    ::fidl_next::encoder::InternalHandleEncoder,
1763                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1764            {
1765                self.register_write_with(crate::generic::DeviceRegisterWriteRequest {
1766                    address,
1767
1768                    data,
1769                })
1770            }
1771
1772            #[doc = " Issue register write commands to the SPMI device.\n The implementation may choose which SPMI variation (e.g. extended, long) to use.\n When this command is successful, `data` will be written contiguously starting from\n `address` in the device.\n"]
1773            pub fn register_write_with<___R>(
1774                &self,
1775                request: ___R,
1776            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterWrite, ___T>
1777            where
1778                ___R: ::fidl_next::Encode<
1779                        crate::wire::DeviceRegisterWriteRequest<'static>,
1780                        <___T as ::fidl_next::Transport>::SendBuffer,
1781                    >,
1782            {
1783                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1784                    1044640317848992555,
1785                    <super::RegisterWrite as ::fidl_next::Method>::FLEXIBILITY,
1786                    request,
1787                ))
1788            }
1789
1790            #[doc = " Get the properties of the SPMI device.\n"]
1791            pub fn get_properties(
1792                &self,
1793            ) -> ::fidl_next::TwoWayFuture<'_, super::GetProperties, ___T> {
1794                ::fidl_next::TwoWayFuture::from_untyped(
1795                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1796                        2203507889677991867,
1797                        <super::GetProperties as ::fidl_next::Method>::FLEXIBILITY,
1798                        (),
1799                    ),
1800                )
1801            }
1802
1803            #[doc = " Hanging-get method to receive controller write commands from the device. `address` and\n `size` specify the register range to monitor for commands. Multiple overlapping calls to\n this method are not allowed.\n Returns `INVALID_ARGS` if `address` or `size` are invalid, or `BAD_STATE` if another call\n is pending for this register range. Returns `CANCELED` if\n `CancelWatchControllerWriteCommands()` was called for this register range.\n\n If this method is meant to keep the system awake (prevents suspension) while watch is setup,\n use the passed-in `setup_wake_lease` `LeaseToken`. Then, when the watch is triggered this\n method will return a second `wake_lease` `LeaseToken` to prevent suspension.\n\n These keep alive wake lease tokens are provided by the Power Framework\'s System Activity\n Governor. A driver supporting keep alive must be able to get `wake_lease` from System\n Activity Governor.\n\n When `wake_lease` is closed, then the created wake lease keeping the system from suspending\n at the time of watch triggering is dropped. Hence, to guarantee that the system is not\n suspended by the Power Framework a client must either keep this `wake_lease` for as long as\n the system needs to stay awake, or a client must get its own wake lease from the Power\n Framework before it drops `wake_lease` to prevent suspension.\n"]
1804            pub fn watch_controller_write_commands(
1805                &self,
1806
1807                address: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
1808
1809                size: impl ::fidl_next::Encode<
1810                    ::fidl_next::wire::Uint16,
1811                    <___T as ::fidl_next::Transport>::SendBuffer,
1812                >,
1813
1814                setup_wake_lease: impl ::fidl_next::Encode<
1815                    ::fidl_next::wire::fuchsia::OptionalEventPair,
1816                    <___T as ::fidl_next::Transport>::SendBuffer,
1817                >,
1818            ) -> ::fidl_next::TwoWayFuture<'_, super::WatchControllerWriteCommands, ___T>
1819            where
1820                <___T as ::fidl_next::Transport>::SendBuffer:
1821                    ::fidl_next::encoder::InternalHandleEncoder,
1822                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1823            {
1824                self.watch_controller_write_commands_with(
1825                    crate::generic::DeviceWatchControllerWriteCommandsRequest {
1826                        address,
1827
1828                        size,
1829
1830                        setup_wake_lease,
1831                    },
1832                )
1833            }
1834
1835            #[doc = " Hanging-get method to receive controller write commands from the device. `address` and\n `size` specify the register range to monitor for commands. Multiple overlapping calls to\n this method are not allowed.\n Returns `INVALID_ARGS` if `address` or `size` are invalid, or `BAD_STATE` if another call\n is pending for this register range. Returns `CANCELED` if\n `CancelWatchControllerWriteCommands()` was called for this register range.\n\n If this method is meant to keep the system awake (prevents suspension) while watch is setup,\n use the passed-in `setup_wake_lease` `LeaseToken`. Then, when the watch is triggered this\n method will return a second `wake_lease` `LeaseToken` to prevent suspension.\n\n These keep alive wake lease tokens are provided by the Power Framework\'s System Activity\n Governor. A driver supporting keep alive must be able to get `wake_lease` from System\n Activity Governor.\n\n When `wake_lease` is closed, then the created wake lease keeping the system from suspending\n at the time of watch triggering is dropped. Hence, to guarantee that the system is not\n suspended by the Power Framework a client must either keep this `wake_lease` for as long as\n the system needs to stay awake, or a client must get its own wake lease from the Power\n Framework before it drops `wake_lease` to prevent suspension.\n"]
1836            pub fn watch_controller_write_commands_with<___R>(
1837                &self,
1838                request: ___R,
1839            ) -> ::fidl_next::TwoWayFuture<'_, super::WatchControllerWriteCommands, ___T>
1840            where
1841                ___R: ::fidl_next::Encode<
1842                        crate::wire::DeviceWatchControllerWriteCommandsRequest,
1843                        <___T as ::fidl_next::Transport>::SendBuffer,
1844                    >,
1845            {
1846                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1847                    4712819229924853164,
1848                    <super::WatchControllerWriteCommands as ::fidl_next::Method>::FLEXIBILITY,
1849                    request,
1850                ))
1851            }
1852
1853            #[doc = " Cancels an pending call to `WatchControllerWriteCommands`. `address` and `size` must\n exactly match a previous call to `WatchControllerWriteCommands()`, otherwise `NOT_FOUND`\n is returned.\n"]
1854            pub fn cancel_watch_controller_write_commands(
1855                &self,
1856
1857                address: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
1858
1859                size: impl ::fidl_next::Encode<
1860                    ::fidl_next::wire::Uint16,
1861                    <___T as ::fidl_next::Transport>::SendBuffer,
1862                >,
1863            ) -> ::fidl_next::TwoWayFuture<'_, super::CancelWatchControllerWriteCommands, ___T>
1864            where
1865                <___T as ::fidl_next::Transport>::SendBuffer:
1866                    ::fidl_next::encoder::InternalHandleEncoder,
1867            {
1868                self.cancel_watch_controller_write_commands_with(
1869                    crate::generic::DeviceCancelWatchControllerWriteCommandsRequest {
1870                        address,
1871
1872                        size,
1873                    },
1874                )
1875            }
1876
1877            #[doc = " Cancels an pending call to `WatchControllerWriteCommands`. `address` and `size` must\n exactly match a previous call to `WatchControllerWriteCommands()`, otherwise `NOT_FOUND`\n is returned.\n"]
1878            pub fn cancel_watch_controller_write_commands_with<___R>(
1879                &self,
1880                request: ___R,
1881            ) -> ::fidl_next::TwoWayFuture<'_, super::CancelWatchControllerWriteCommands, ___T>
1882            where
1883                ___R: ::fidl_next::Encode<
1884                        crate::wire::DeviceCancelWatchControllerWriteCommandsRequest,
1885                        <___T as ::fidl_next::Transport>::SendBuffer,
1886                    >,
1887            {
1888                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1889                    5789309704894207008,
1890                    <super::CancelWatchControllerWriteCommands as ::fidl_next::Method>::FLEXIBILITY,
1891                    request,
1892                ))
1893            }
1894        }
1895
1896        /// The server for the `Device` protocol.
1897        #[repr(transparent)]
1898        pub struct DeviceServer<___T: ::fidl_next::Transport> {
1899            server: ::fidl_next::protocol::Server<___T>,
1900        }
1901
1902        impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1903    }
1904}
1905
1906#[diagnostic::on_unimplemented(
1907    note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1908)]
1909
1910/// A client handler for the Device protocol.
1911///
1912/// See [`Device`] for more details.
1913pub trait DeviceLocalClientHandler<
1914    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1915    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1916>
1917{
1918    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1919        ::core::future::ready(())
1920    }
1921}
1922
1923impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
1924where
1925    ___H: DeviceLocalClientHandler<___T>,
1926    ___T: ::fidl_next::Transport,
1927{
1928    async fn on_event(
1929        handler: &mut ___H,
1930        mut message: ::fidl_next::Message<___T>,
1931    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1932        match *message.header().ordinal {
1933            ordinal => {
1934                handler.on_unknown_interaction(ordinal).await;
1935                if ::core::matches!(
1936                    message.header().flexibility(),
1937                    ::fidl_next::protocol::Flexibility::Strict
1938                ) {
1939                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1940                } else {
1941                    Ok(())
1942                }
1943            }
1944        }
1945    }
1946}
1947
1948#[diagnostic::on_unimplemented(
1949    note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1950)]
1951
1952/// A server handler for the Device protocol.
1953///
1954/// See [`Device`] for more details.
1955pub trait DeviceLocalServerHandler<
1956    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1957    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1958>
1959{
1960    #[doc = " Issue register read commands to the SPMI device.\n The implementation may choose which SPMI variation (e.g. extended, long) to use.\n When successful, it returns `size_bytes` in `data` read contiguously starting from\n `address` in the device.\n"]
1961    fn register_read(
1962        &mut self,
1963
1964        request: ::fidl_next::Request<device::RegisterRead, ___T>,
1965
1966        responder: ::fidl_next::Responder<device::RegisterRead, ___T>,
1967    ) -> impl ::core::future::Future<Output = ()>;
1968
1969    #[doc = " Issue register write commands to the SPMI device.\n The implementation may choose which SPMI variation (e.g. extended, long) to use.\n When this command is successful, `data` will be written contiguously starting from\n `address` in the device.\n"]
1970    fn register_write(
1971        &mut self,
1972
1973        request: ::fidl_next::Request<device::RegisterWrite, ___T>,
1974
1975        responder: ::fidl_next::Responder<device::RegisterWrite, ___T>,
1976    ) -> impl ::core::future::Future<Output = ()>;
1977
1978    #[doc = " Get the properties of the SPMI device.\n"]
1979    fn get_properties(
1980        &mut self,
1981
1982        responder: ::fidl_next::Responder<device::GetProperties, ___T>,
1983    ) -> impl ::core::future::Future<Output = ()>;
1984
1985    #[doc = " Hanging-get method to receive controller write commands from the device. `address` and\n `size` specify the register range to monitor for commands. Multiple overlapping calls to\n this method are not allowed.\n Returns `INVALID_ARGS` if `address` or `size` are invalid, or `BAD_STATE` if another call\n is pending for this register range. Returns `CANCELED` if\n `CancelWatchControllerWriteCommands()` was called for this register range.\n\n If this method is meant to keep the system awake (prevents suspension) while watch is setup,\n use the passed-in `setup_wake_lease` `LeaseToken`. Then, when the watch is triggered this\n method will return a second `wake_lease` `LeaseToken` to prevent suspension.\n\n These keep alive wake lease tokens are provided by the Power Framework\'s System Activity\n Governor. A driver supporting keep alive must be able to get `wake_lease` from System\n Activity Governor.\n\n When `wake_lease` is closed, then the created wake lease keeping the system from suspending\n at the time of watch triggering is dropped. Hence, to guarantee that the system is not\n suspended by the Power Framework a client must either keep this `wake_lease` for as long as\n the system needs to stay awake, or a client must get its own wake lease from the Power\n Framework before it drops `wake_lease` to prevent suspension.\n"]
1986    fn watch_controller_write_commands(
1987        &mut self,
1988
1989        request: ::fidl_next::Request<device::WatchControllerWriteCommands, ___T>,
1990
1991        responder: ::fidl_next::Responder<device::WatchControllerWriteCommands, ___T>,
1992    ) -> impl ::core::future::Future<Output = ()>;
1993
1994    #[doc = " Cancels an pending call to `WatchControllerWriteCommands`. `address` and `size` must\n exactly match a previous call to `WatchControllerWriteCommands()`, otherwise `NOT_FOUND`\n is returned.\n"]
1995    fn cancel_watch_controller_write_commands(
1996        &mut self,
1997
1998        request: ::fidl_next::Request<device::CancelWatchControllerWriteCommands, ___T>,
1999
2000        responder: ::fidl_next::Responder<device::CancelWatchControllerWriteCommands, ___T>,
2001    ) -> impl ::core::future::Future<Output = ()>;
2002
2003    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2004        ::core::future::ready(())
2005    }
2006}
2007
2008impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
2009where
2010    ___H: DeviceLocalServerHandler<___T>,
2011    ___T: ::fidl_next::Transport,
2012    for<'de> crate::wire::DeviceRegisterReadRequest: ::fidl_next::Decode<
2013            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2014            Constraint = (),
2015        >,
2016    for<'de> crate::wire::DeviceRegisterWriteRequest<'de>: ::fidl_next::Decode<
2017            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2018            Constraint = (),
2019        >,
2020    for<'de> crate::wire::DeviceWatchControllerWriteCommandsRequest: ::fidl_next::Decode<
2021            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2022            Constraint = (),
2023        >,
2024    for<'de> crate::wire::DeviceCancelWatchControllerWriteCommandsRequest: ::fidl_next::Decode<
2025            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2026            Constraint = (),
2027        >,
2028{
2029    async fn on_one_way(
2030        handler: &mut ___H,
2031        mut message: ::fidl_next::Message<___T>,
2032    ) -> ::core::result::Result<
2033        (),
2034        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2035    > {
2036        match *message.header().ordinal {
2037            ordinal => {
2038                handler.on_unknown_interaction(ordinal).await;
2039                if ::core::matches!(
2040                    message.header().flexibility(),
2041                    ::fidl_next::protocol::Flexibility::Strict
2042                ) {
2043                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2044                } else {
2045                    Ok(())
2046                }
2047            }
2048        }
2049    }
2050
2051    async fn on_two_way(
2052        handler: &mut ___H,
2053        mut message: ::fidl_next::Message<___T>,
2054        responder: ::fidl_next::protocol::Responder<___T>,
2055    ) -> ::core::result::Result<
2056        (),
2057        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2058    > {
2059        match *message.header().ordinal {
2060            7616793777944757 => {
2061                let responder = ::fidl_next::Responder::from_untyped(responder);
2062
2063                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2064                    Ok(decoded) => {
2065                        handler
2066                            .register_read(::fidl_next::Request::from_decoded(decoded), responder)
2067                            .await;
2068                        Ok(())
2069                    }
2070                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2071                        ordinal: 7616793777944757,
2072                        error,
2073                    }),
2074                }
2075            }
2076
2077            1044640317848992555 => {
2078                let responder = ::fidl_next::Responder::from_untyped(responder);
2079
2080                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2081                    Ok(decoded) => {
2082                        handler
2083                            .register_write(::fidl_next::Request::from_decoded(decoded), responder)
2084                            .await;
2085                        Ok(())
2086                    }
2087                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2088                        ordinal: 1044640317848992555,
2089                        error,
2090                    }),
2091                }
2092            }
2093
2094            2203507889677991867 => {
2095                let responder = ::fidl_next::Responder::from_untyped(responder);
2096
2097                handler.get_properties(responder).await;
2098                Ok(())
2099            }
2100
2101            4712819229924853164 => {
2102                let responder = ::fidl_next::Responder::from_untyped(responder);
2103
2104                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2105                    Ok(decoded) => {
2106                        handler
2107                            .watch_controller_write_commands(
2108                                ::fidl_next::Request::from_decoded(decoded),
2109                                responder,
2110                            )
2111                            .await;
2112                        Ok(())
2113                    }
2114                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2115                        ordinal: 4712819229924853164,
2116                        error,
2117                    }),
2118                }
2119            }
2120
2121            5789309704894207008 => {
2122                let responder = ::fidl_next::Responder::from_untyped(responder);
2123
2124                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2125                    Ok(decoded) => {
2126                        handler
2127                            .cancel_watch_controller_write_commands(
2128                                ::fidl_next::Request::from_decoded(decoded),
2129                                responder,
2130                            )
2131                            .await;
2132                        Ok(())
2133                    }
2134                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2135                        ordinal: 5789309704894207008,
2136                        error,
2137                    }),
2138                }
2139            }
2140
2141            ordinal => {
2142                handler.on_unknown_interaction(ordinal).await;
2143                if ::core::matches!(
2144                    message.header().flexibility(),
2145                    ::fidl_next::protocol::Flexibility::Strict
2146                ) {
2147                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2148                } else {
2149                    responder
2150                        .respond_framework_error(
2151                            ordinal,
2152                            ::fidl_next::FrameworkError::UnknownMethod,
2153                        )
2154                        .expect("encoding a framework error should never fail")
2155                        .await?;
2156                    Ok(())
2157                }
2158            }
2159        }
2160    }
2161}
2162
2163/// A client handler for the Device protocol.
2164///
2165/// See [`Device`] for more details.
2166pub trait DeviceClientHandler<
2167    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2168    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2169>
2170{
2171    fn on_unknown_interaction(
2172        &mut self,
2173        ordinal: u64,
2174    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2175        ::core::future::ready(())
2176    }
2177}
2178
2179impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
2180where
2181    ___H: DeviceClientHandler<___T> + ::core::marker::Send,
2182    ___T: ::fidl_next::Transport,
2183{
2184    async fn on_event(
2185        handler: &mut ___H,
2186        mut message: ::fidl_next::Message<___T>,
2187    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2188        match *message.header().ordinal {
2189            ordinal => {
2190                handler.on_unknown_interaction(ordinal).await;
2191                if ::core::matches!(
2192                    message.header().flexibility(),
2193                    ::fidl_next::protocol::Flexibility::Strict
2194                ) {
2195                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2196                } else {
2197                    Ok(())
2198                }
2199            }
2200        }
2201    }
2202}
2203
2204/// A server handler for the Device protocol.
2205///
2206/// See [`Device`] for more details.
2207pub trait DeviceServerHandler<
2208    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2209    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2210>
2211{
2212    #[doc = " Issue register read commands to the SPMI device.\n The implementation may choose which SPMI variation (e.g. extended, long) to use.\n When successful, it returns `size_bytes` in `data` read contiguously starting from\n `address` in the device.\n"]
2213    fn register_read(
2214        &mut self,
2215
2216        request: ::fidl_next::Request<device::RegisterRead, ___T>,
2217
2218        responder: ::fidl_next::Responder<device::RegisterRead, ___T>,
2219    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2220
2221    #[doc = " Issue register write commands to the SPMI device.\n The implementation may choose which SPMI variation (e.g. extended, long) to use.\n When this command is successful, `data` will be written contiguously starting from\n `address` in the device.\n"]
2222    fn register_write(
2223        &mut self,
2224
2225        request: ::fidl_next::Request<device::RegisterWrite, ___T>,
2226
2227        responder: ::fidl_next::Responder<device::RegisterWrite, ___T>,
2228    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2229
2230    #[doc = " Get the properties of the SPMI device.\n"]
2231    fn get_properties(
2232        &mut self,
2233
2234        responder: ::fidl_next::Responder<device::GetProperties, ___T>,
2235    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2236
2237    #[doc = " Hanging-get method to receive controller write commands from the device. `address` and\n `size` specify the register range to monitor for commands. Multiple overlapping calls to\n this method are not allowed.\n Returns `INVALID_ARGS` if `address` or `size` are invalid, or `BAD_STATE` if another call\n is pending for this register range. Returns `CANCELED` if\n `CancelWatchControllerWriteCommands()` was called for this register range.\n\n If this method is meant to keep the system awake (prevents suspension) while watch is setup,\n use the passed-in `setup_wake_lease` `LeaseToken`. Then, when the watch is triggered this\n method will return a second `wake_lease` `LeaseToken` to prevent suspension.\n\n These keep alive wake lease tokens are provided by the Power Framework\'s System Activity\n Governor. A driver supporting keep alive must be able to get `wake_lease` from System\n Activity Governor.\n\n When `wake_lease` is closed, then the created wake lease keeping the system from suspending\n at the time of watch triggering is dropped. Hence, to guarantee that the system is not\n suspended by the Power Framework a client must either keep this `wake_lease` for as long as\n the system needs to stay awake, or a client must get its own wake lease from the Power\n Framework before it drops `wake_lease` to prevent suspension.\n"]
2238    fn watch_controller_write_commands(
2239        &mut self,
2240
2241        request: ::fidl_next::Request<device::WatchControllerWriteCommands, ___T>,
2242
2243        responder: ::fidl_next::Responder<device::WatchControllerWriteCommands, ___T>,
2244    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2245
2246    #[doc = " Cancels an pending call to `WatchControllerWriteCommands`. `address` and `size` must\n exactly match a previous call to `WatchControllerWriteCommands()`, otherwise `NOT_FOUND`\n is returned.\n"]
2247    fn cancel_watch_controller_write_commands(
2248        &mut self,
2249
2250        request: ::fidl_next::Request<device::CancelWatchControllerWriteCommands, ___T>,
2251
2252        responder: ::fidl_next::Responder<device::CancelWatchControllerWriteCommands, ___T>,
2253    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2254
2255    fn on_unknown_interaction(
2256        &mut self,
2257        ordinal: u64,
2258    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2259        ::core::future::ready(())
2260    }
2261}
2262
2263impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
2264where
2265    ___H: DeviceServerHandler<___T> + ::core::marker::Send,
2266    ___T: ::fidl_next::Transport,
2267    for<'de> crate::wire::DeviceRegisterReadRequest: ::fidl_next::Decode<
2268            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2269            Constraint = (),
2270        >,
2271    for<'de> crate::wire::DeviceRegisterWriteRequest<'de>: ::fidl_next::Decode<
2272            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2273            Constraint = (),
2274        >,
2275    for<'de> crate::wire::DeviceWatchControllerWriteCommandsRequest: ::fidl_next::Decode<
2276            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2277            Constraint = (),
2278        >,
2279    for<'de> crate::wire::DeviceCancelWatchControllerWriteCommandsRequest: ::fidl_next::Decode<
2280            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2281            Constraint = (),
2282        >,
2283{
2284    async fn on_one_way(
2285        handler: &mut ___H,
2286        mut message: ::fidl_next::Message<___T>,
2287    ) -> ::core::result::Result<
2288        (),
2289        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2290    > {
2291        match *message.header().ordinal {
2292            ordinal => {
2293                handler.on_unknown_interaction(ordinal).await;
2294                if ::core::matches!(
2295                    message.header().flexibility(),
2296                    ::fidl_next::protocol::Flexibility::Strict
2297                ) {
2298                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2299                } else {
2300                    Ok(())
2301                }
2302            }
2303        }
2304    }
2305
2306    async fn on_two_way(
2307        handler: &mut ___H,
2308        mut message: ::fidl_next::Message<___T>,
2309        responder: ::fidl_next::protocol::Responder<___T>,
2310    ) -> ::core::result::Result<
2311        (),
2312        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2313    > {
2314        match *message.header().ordinal {
2315            7616793777944757 => {
2316                let responder = ::fidl_next::Responder::from_untyped(responder);
2317
2318                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2319                    Ok(decoded) => {
2320                        handler
2321                            .register_read(::fidl_next::Request::from_decoded(decoded), responder)
2322                            .await;
2323                        Ok(())
2324                    }
2325                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2326                        ordinal: 7616793777944757,
2327                        error,
2328                    }),
2329                }
2330            }
2331
2332            1044640317848992555 => {
2333                let responder = ::fidl_next::Responder::from_untyped(responder);
2334
2335                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2336                    Ok(decoded) => {
2337                        handler
2338                            .register_write(::fidl_next::Request::from_decoded(decoded), responder)
2339                            .await;
2340                        Ok(())
2341                    }
2342                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2343                        ordinal: 1044640317848992555,
2344                        error,
2345                    }),
2346                }
2347            }
2348
2349            2203507889677991867 => {
2350                let responder = ::fidl_next::Responder::from_untyped(responder);
2351
2352                handler.get_properties(responder).await;
2353                Ok(())
2354            }
2355
2356            4712819229924853164 => {
2357                let responder = ::fidl_next::Responder::from_untyped(responder);
2358
2359                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2360                    Ok(decoded) => {
2361                        handler
2362                            .watch_controller_write_commands(
2363                                ::fidl_next::Request::from_decoded(decoded),
2364                                responder,
2365                            )
2366                            .await;
2367                        Ok(())
2368                    }
2369                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2370                        ordinal: 4712819229924853164,
2371                        error,
2372                    }),
2373                }
2374            }
2375
2376            5789309704894207008 => {
2377                let responder = ::fidl_next::Responder::from_untyped(responder);
2378
2379                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2380                    Ok(decoded) => {
2381                        handler
2382                            .cancel_watch_controller_write_commands(
2383                                ::fidl_next::Request::from_decoded(decoded),
2384                                responder,
2385                            )
2386                            .await;
2387                        Ok(())
2388                    }
2389                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2390                        ordinal: 5789309704894207008,
2391                        error,
2392                    }),
2393                }
2394            }
2395
2396            ordinal => {
2397                handler.on_unknown_interaction(ordinal).await;
2398                if ::core::matches!(
2399                    message.header().flexibility(),
2400                    ::fidl_next::protocol::Flexibility::Strict
2401                ) {
2402                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2403                } else {
2404                    responder
2405                        .respond_framework_error(
2406                            ordinal,
2407                            ::fidl_next::FrameworkError::UnknownMethod,
2408                        )
2409                        .expect("encoding a framework error should never fail")
2410                        .await?;
2411                    Ok(())
2412                }
2413            }
2414        }
2415    }
2416}
2417
2418impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents
2419where
2420    ___T: ::fidl_next::Transport,
2421{
2422    async fn on_unknown_interaction(&mut self, _: u64) {}
2423}
2424
2425impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2426where
2427    ___H: DeviceClientHandler<___T>,
2428    ___T: ::fidl_next::Transport,
2429{
2430    async fn on_unknown_interaction(&mut self, ordinal: u64) {
2431        ___H::on_unknown_interaction(&mut self.0, ordinal).await
2432    }
2433}
2434
2435impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2436where
2437    ___H: DeviceServerHandler<___T>,
2438    ___T: ::fidl_next::Transport,
2439{
2440    async fn register_read(
2441        &mut self,
2442
2443        request: ::fidl_next::Request<device::RegisterRead, ___T>,
2444
2445        responder: ::fidl_next::Responder<device::RegisterRead, ___T>,
2446    ) {
2447        ___H::register_read(&mut self.0, request, responder).await
2448    }
2449
2450    async fn register_write(
2451        &mut self,
2452
2453        request: ::fidl_next::Request<device::RegisterWrite, ___T>,
2454
2455        responder: ::fidl_next::Responder<device::RegisterWrite, ___T>,
2456    ) {
2457        ___H::register_write(&mut self.0, request, responder).await
2458    }
2459
2460    async fn get_properties(
2461        &mut self,
2462
2463        responder: ::fidl_next::Responder<device::GetProperties, ___T>,
2464    ) {
2465        ___H::get_properties(&mut self.0, responder).await
2466    }
2467
2468    async fn watch_controller_write_commands(
2469        &mut self,
2470
2471        request: ::fidl_next::Request<device::WatchControllerWriteCommands, ___T>,
2472
2473        responder: ::fidl_next::Responder<device::WatchControllerWriteCommands, ___T>,
2474    ) {
2475        ___H::watch_controller_write_commands(&mut self.0, request, responder).await
2476    }
2477
2478    async fn cancel_watch_controller_write_commands(
2479        &mut self,
2480
2481        request: ::fidl_next::Request<device::CancelWatchControllerWriteCommands, ___T>,
2482
2483        responder: ::fidl_next::Responder<device::CancelWatchControllerWriteCommands, ___T>,
2484    ) {
2485        ___H::cancel_watch_controller_write_commands(&mut self.0, request, responder).await
2486    }
2487
2488    async fn on_unknown_interaction(&mut self, ordinal: u64) {
2489        ___H::on_unknown_interaction(&mut self.0, ordinal).await
2490    }
2491}
2492
2493/// The type corresponding to the SubTargetService service.
2494#[doc = " This service represents a sub-target device within an SPMI target. Clients have access to a\n subset of the SPMI register range as determined by the controller driver.\n"]
2495#[derive(Debug)]
2496pub struct SubTargetService;
2497
2498impl ::fidl_next::DiscoverableService for SubTargetService {
2499    const SERVICE_NAME: &'static str = "fuchsia.hardware.spmi.SubTargetService";
2500    const MEMBER_NAMES: &'static [&'static str] = &["device"];
2501}
2502
2503impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for SubTargetService {}
2504
2505impl<___C> ::fidl_next::Service<___C> for SubTargetService
2506where
2507    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2508{
2509    type Connector = SubTargetServiceConnector<___C>;
2510}
2511
2512/// A strongly-typed service connector for the `SubTargetService` service.
2513#[repr(transparent)]
2514pub struct SubTargetServiceConnector<___C> {
2515    #[allow(dead_code)]
2516    connector: ___C,
2517}
2518
2519impl<___C> SubTargetServiceConnector<___C>
2520where
2521    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2522{
2523    /// Attempts to connect to the `device` service member.
2524    pub fn device(
2525        &self,
2526        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2527    ) -> ::core::result::Result<
2528        (),
2529        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2530    > {
2531        ::fidl_next::protocol::ServiceConnector::<
2532                ::fidl_next::fuchsia::zx::Channel
2533            >::connect_to_member(
2534                &self.connector,
2535                "device",
2536                server_end.into_untyped(),
2537            )
2538    }
2539}
2540
2541/// A service handler for the `SubTargetService` service.
2542pub trait SubTargetServiceHandler {
2543    /// Handles an attempt to connect to the `device` member.
2544    fn device(
2545        &self,
2546        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2547    );
2548}
2549
2550impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for SubTargetService
2551where
2552    ___H: SubTargetServiceHandler,
2553    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2554{
2555    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2556        use ::fidl_next::InstanceFromServiceTransport;
2557        match member {
2558            "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
2559                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2560            )),
2561
2562            _ => unreachable!(),
2563        }
2564    }
2565}
2566
2567/// The type corresponding to the TargetService service.
2568#[doc = " This service represents an SPMI target device. Clients have access to the entire SPMI register\n range.\n"]
2569#[derive(Debug)]
2570pub struct TargetService;
2571
2572impl ::fidl_next::DiscoverableService for TargetService {
2573    const SERVICE_NAME: &'static str = "fuchsia.hardware.spmi.TargetService";
2574    const MEMBER_NAMES: &'static [&'static str] = &["device"];
2575}
2576
2577impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for TargetService {}
2578
2579impl<___C> ::fidl_next::Service<___C> for TargetService
2580where
2581    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2582{
2583    type Connector = TargetServiceConnector<___C>;
2584}
2585
2586/// A strongly-typed service connector for the `TargetService` service.
2587#[repr(transparent)]
2588pub struct TargetServiceConnector<___C> {
2589    #[allow(dead_code)]
2590    connector: ___C,
2591}
2592
2593impl<___C> TargetServiceConnector<___C>
2594where
2595    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2596{
2597    /// Attempts to connect to the `device` service member.
2598    pub fn device(
2599        &self,
2600        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2601    ) -> ::core::result::Result<
2602        (),
2603        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2604    > {
2605        ::fidl_next::protocol::ServiceConnector::<
2606                ::fidl_next::fuchsia::zx::Channel
2607            >::connect_to_member(
2608                &self.connector,
2609                "device",
2610                server_end.into_untyped(),
2611            )
2612    }
2613}
2614
2615/// A service handler for the `TargetService` service.
2616pub trait TargetServiceHandler {
2617    /// Handles an attempt to connect to the `device` member.
2618    fn device(
2619        &self,
2620        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2621    );
2622}
2623
2624impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for TargetService
2625where
2626    ___H: TargetServiceHandler,
2627    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2628{
2629    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2630        use ::fidl_next::InstanceFromServiceTransport;
2631        match member {
2632            "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
2633                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2634            )),
2635
2636            _ => unreachable!(),
2637        }
2638    }
2639}
2640
2641pub use fidl_next_common_fuchsia_hardware_spmi::*;