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    /// The generic type corresponding to [`DeviceWatchControllerWriteCommandsRequest`].
658    pub struct DeviceWatchControllerWriteCommandsRequest<T0, T1, T2> {
659        pub address: T0,
660
661        pub size: T1,
662
663        pub setup_wake_lease: T2,
664    }
665
666    unsafe impl<___E, T0, T1, T2>
667        ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsRequest, ___E>
668        for DeviceWatchControllerWriteCommandsRequest<T0, T1, T2>
669    where
670        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
671        ___E: ::fidl_next::fuchsia::HandleEncoder,
672        T0: ::fidl_next::Encode<u8, ___E>,
673        T1: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
674        T2: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
675    {
676        #[inline]
677        fn encode(
678            self,
679            encoder_: &mut ___E,
680            out_: &mut ::core::mem::MaybeUninit<
681                crate::wire::DeviceWatchControllerWriteCommandsRequest,
682            >,
683            _: (),
684        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
685            ::fidl_next::munge! {
686                let crate::wire::DeviceWatchControllerWriteCommandsRequest {
687                    address,
688                    size,
689                    setup_wake_lease,
690
691                } = out_;
692            }
693
694            ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
695
696            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
697
698            ::fidl_next::Encode::encode(self.setup_wake_lease, encoder_, setup_wake_lease, ())?;
699
700            Ok(())
701        }
702    }
703
704    /// The generic type corresponding to [`DeviceWatchControllerWriteCommandsResponse`].
705    pub struct DeviceWatchControllerWriteCommandsResponse<T0, T1> {
706        pub writes: T0,
707
708        pub wake_lease: T1,
709    }
710
711    unsafe impl<___E, T0, T1>
712        ::fidl_next::Encode<crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>, ___E>
713        for DeviceWatchControllerWriteCommandsResponse<T0, T1>
714    where
715        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
716        ___E: ::fidl_next::Encoder,
717        ___E: ::fidl_next::fuchsia::HandleEncoder,
718        T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, crate::wire::Register8>, ___E>,
719        T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
720    {
721        #[inline]
722        fn encode(
723            self,
724            encoder_: &mut ___E,
725            out_: &mut ::core::mem::MaybeUninit<
726                crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
727            >,
728            _: (),
729        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
730            ::fidl_next::munge! {
731                let crate::wire::DeviceWatchControllerWriteCommandsResponse {
732                    writes,
733                    wake_lease,
734
735                } = out_;
736            }
737
738            ::fidl_next::Encode::encode(self.writes, encoder_, writes, (256, ()))?;
739
740            ::fidl_next::Encode::encode(self.wake_lease, encoder_, wake_lease, ())?;
741
742            Ok(())
743        }
744    }
745}
746
747pub use self::natural::*;
748
749/// The type corresponding to the Debug protocol.
750#[derive(PartialEq, Debug)]
751pub struct Debug;
752
753#[cfg(target_os = "fuchsia")]
754impl ::fidl_next::HasTransport for Debug {
755    type Transport = ::fidl_next::fuchsia::zx::Channel;
756}
757
758pub mod debug {
759    pub mod prelude {
760        pub use crate::{
761            Debug, DebugClientHandler, DebugLocalClientHandler, DebugLocalServerHandler,
762            DebugServerHandler, debug,
763        };
764
765        pub use crate::natural::DebugConnectTargetRequest;
766
767        pub use crate::natural::DebugGetControllerPropertiesResponse;
768
769        pub use crate::natural::DebugConnectTargetResponse;
770
771        pub use crate::natural::DriverError;
772    }
773
774    pub struct ConnectTarget;
775
776    impl ::fidl_next::Method for ConnectTarget {
777        const ORDINAL: u64 = 799648158518250777;
778        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
779            ::fidl_next::protocol::Flexibility::Strict;
780
781        type Protocol = crate::Debug;
782
783        type Request = crate::wire::DebugConnectTargetRequest;
784    }
785
786    impl ::fidl_next::TwoWayMethod for ConnectTarget {
787        type Response = ::fidl_next::wire::Result<
788            'static,
789            crate::wire::DebugConnectTargetResponse,
790            crate::wire::DriverError,
791        >;
792    }
793
794    impl<___R> ::fidl_next::Respond<___R> for ConnectTarget {
795        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
796
797        fn respond(response: ___R) -> Self::Output {
798            ::core::result::Result::Ok(response)
799        }
800    }
801
802    impl<___R> ::fidl_next::RespondErr<___R> for ConnectTarget {
803        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
804
805        fn respond_err(response: ___R) -> Self::Output {
806            ::core::result::Result::Err(response)
807        }
808    }
809
810    pub struct GetControllerProperties;
811
812    impl ::fidl_next::Method for GetControllerProperties {
813        const ORDINAL: u64 = 4733781216537150751;
814        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
815            ::fidl_next::protocol::Flexibility::Strict;
816
817        type Protocol = crate::Debug;
818
819        type Request = ::fidl_next::wire::EmptyMessageBody;
820    }
821
822    impl ::fidl_next::TwoWayMethod for GetControllerProperties {
823        type Response =
824            ::fidl_next::wire::Strict<crate::wire::DebugGetControllerPropertiesResponse<'static>>;
825    }
826
827    impl<___R> ::fidl_next::Respond<___R> for GetControllerProperties {
828        type Output = ::fidl_next::Strict<___R>;
829
830        fn respond(response: ___R) -> Self::Output {
831            ::fidl_next::Strict(response)
832        }
833    }
834
835    mod ___detail {
836        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Debug
837        where
838            ___T: ::fidl_next::Transport,
839        {
840            type Client = DebugClient<___T>;
841            type Server = DebugServer<___T>;
842        }
843
844        /// The client for the `Debug` protocol.
845        #[repr(transparent)]
846        pub struct DebugClient<___T: ::fidl_next::Transport> {
847            #[allow(dead_code)]
848            client: ::fidl_next::protocol::Client<___T>,
849        }
850
851        impl<___T> DebugClient<___T>
852        where
853            ___T: ::fidl_next::Transport,
854        {
855            #[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"]
856            pub fn connect_target(
857                &self,
858
859                target_id: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
860
861                server: impl ::fidl_next::Encode<
862                    ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
863                    <___T as ::fidl_next::Transport>::SendBuffer,
864                >,
865            ) -> ::fidl_next::TwoWayFuture<'_, super::ConnectTarget, ___T>
866            where
867                <___T as ::fidl_next::Transport>::SendBuffer:
868                    ::fidl_next::encoder::InternalHandleEncoder,
869                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
870            {
871                self.connect_target_with(crate::generic::DebugConnectTargetRequest {
872                    target_id,
873
874                    server,
875                })
876            }
877
878            #[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"]
879            pub fn connect_target_with<___R>(
880                &self,
881                request: ___R,
882            ) -> ::fidl_next::TwoWayFuture<'_, super::ConnectTarget, ___T>
883            where
884                ___R: ::fidl_next::Encode<
885                        crate::wire::DebugConnectTargetRequest,
886                        <___T as ::fidl_next::Transport>::SendBuffer,
887                    >,
888            {
889                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
890                    799648158518250777,
891                    <super::ConnectTarget as ::fidl_next::Method>::FLEXIBILITY,
892                    request,
893                ))
894            }
895
896            #[doc = " Returns the properties of the host SPMI controller.\n"]
897            pub fn get_controller_properties(
898                &self,
899            ) -> ::fidl_next::TwoWayFuture<'_, super::GetControllerProperties, ___T> {
900                ::fidl_next::TwoWayFuture::from_untyped(
901                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
902                        4733781216537150751,
903                        <super::GetControllerProperties as ::fidl_next::Method>::FLEXIBILITY,
904                        (),
905                    ),
906                )
907            }
908        }
909
910        /// The server for the `Debug` protocol.
911        #[repr(transparent)]
912        pub struct DebugServer<___T: ::fidl_next::Transport> {
913            server: ::fidl_next::protocol::Server<___T>,
914        }
915
916        impl<___T> DebugServer<___T> where ___T: ::fidl_next::Transport {}
917    }
918}
919
920#[diagnostic::on_unimplemented(
921    note = "If {Self} implements the non-local DebugClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
922)]
923
924/// A client handler for the Debug protocol.
925///
926/// See [`Debug`] for more details.
927pub trait DebugLocalClientHandler<
928    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
929    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
930>
931{
932    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
933        ::core::future::ready(())
934    }
935}
936
937impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Debug
938where
939    ___H: DebugLocalClientHandler<___T>,
940    ___T: ::fidl_next::Transport,
941{
942    async fn on_event(
943        handler: &mut ___H,
944        mut message: ::fidl_next::Message<___T>,
945    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
946        match *message.header().ordinal {
947            ordinal => {
948                handler.on_unknown_interaction(ordinal).await;
949                if ::core::matches!(
950                    message.header().flexibility(),
951                    ::fidl_next::protocol::Flexibility::Strict
952                ) {
953                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
954                } else {
955                    Ok(())
956                }
957            }
958        }
959    }
960}
961
962#[diagnostic::on_unimplemented(
963    note = "If {Self} implements the non-local DebugServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
964)]
965
966/// A server handler for the Debug protocol.
967///
968/// See [`Debug`] for more details.
969pub trait DebugLocalServerHandler<
970    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
971    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
972>
973{
974    #[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"]
975    fn connect_target(
976        &mut self,
977
978        request: ::fidl_next::Request<debug::ConnectTarget, ___T>,
979
980        responder: ::fidl_next::Responder<debug::ConnectTarget, ___T>,
981    ) -> impl ::core::future::Future<Output = ()>;
982
983    #[doc = " Returns the properties of the host SPMI controller.\n"]
984    fn get_controller_properties(
985        &mut self,
986
987        responder: ::fidl_next::Responder<debug::GetControllerProperties, ___T>,
988    ) -> impl ::core::future::Future<Output = ()>;
989
990    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
991        ::core::future::ready(())
992    }
993}
994
995impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Debug
996where
997    ___H: DebugLocalServerHandler<___T>,
998    ___T: ::fidl_next::Transport,
999    for<'de> crate::wire::DebugConnectTargetRequest: ::fidl_next::Decode<
1000            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1001            Constraint = (),
1002        >,
1003{
1004    async fn on_one_way(
1005        handler: &mut ___H,
1006        mut message: ::fidl_next::Message<___T>,
1007    ) -> ::core::result::Result<
1008        (),
1009        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1010    > {
1011        match *message.header().ordinal {
1012            ordinal => {
1013                handler.on_unknown_interaction(ordinal).await;
1014                if ::core::matches!(
1015                    message.header().flexibility(),
1016                    ::fidl_next::protocol::Flexibility::Strict
1017                ) {
1018                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1019                } else {
1020                    Ok(())
1021                }
1022            }
1023        }
1024    }
1025
1026    async fn on_two_way(
1027        handler: &mut ___H,
1028        mut message: ::fidl_next::Message<___T>,
1029        responder: ::fidl_next::protocol::Responder<___T>,
1030    ) -> ::core::result::Result<
1031        (),
1032        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1033    > {
1034        match *message.header().ordinal {
1035            799648158518250777 => {
1036                let responder = ::fidl_next::Responder::from_untyped(responder);
1037
1038                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1039                    Ok(decoded) => {
1040                        handler
1041                            .connect_target(::fidl_next::Request::from_decoded(decoded), responder)
1042                            .await;
1043                        Ok(())
1044                    }
1045                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1046                        ordinal: 799648158518250777,
1047                        error,
1048                    }),
1049                }
1050            }
1051
1052            4733781216537150751 => {
1053                let responder = ::fidl_next::Responder::from_untyped(responder);
1054
1055                handler.get_controller_properties(responder).await;
1056                Ok(())
1057            }
1058
1059            ordinal => {
1060                handler.on_unknown_interaction(ordinal).await;
1061                if ::core::matches!(
1062                    message.header().flexibility(),
1063                    ::fidl_next::protocol::Flexibility::Strict
1064                ) {
1065                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1066                } else {
1067                    responder
1068                        .respond_framework_error(
1069                            ordinal,
1070                            ::fidl_next::FrameworkError::UnknownMethod,
1071                        )
1072                        .expect("encoding a framework error should never fail")
1073                        .await?;
1074                    Ok(())
1075                }
1076            }
1077        }
1078    }
1079}
1080
1081/// A client handler for the Debug protocol.
1082///
1083/// See [`Debug`] for more details.
1084pub trait DebugClientHandler<
1085    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1086    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1087>
1088{
1089    fn on_unknown_interaction(
1090        &mut self,
1091        ordinal: u64,
1092    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1093        ::core::future::ready(())
1094    }
1095}
1096
1097impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Debug
1098where
1099    ___H: DebugClientHandler<___T> + ::core::marker::Send,
1100    ___T: ::fidl_next::Transport,
1101{
1102    async fn on_event(
1103        handler: &mut ___H,
1104        mut message: ::fidl_next::Message<___T>,
1105    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1106        match *message.header().ordinal {
1107            ordinal => {
1108                handler.on_unknown_interaction(ordinal).await;
1109                if ::core::matches!(
1110                    message.header().flexibility(),
1111                    ::fidl_next::protocol::Flexibility::Strict
1112                ) {
1113                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1114                } else {
1115                    Ok(())
1116                }
1117            }
1118        }
1119    }
1120}
1121
1122/// A server handler for the Debug protocol.
1123///
1124/// See [`Debug`] for more details.
1125pub trait DebugServerHandler<
1126    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1127    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1128>
1129{
1130    #[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"]
1131    fn connect_target(
1132        &mut self,
1133
1134        request: ::fidl_next::Request<debug::ConnectTarget, ___T>,
1135
1136        responder: ::fidl_next::Responder<debug::ConnectTarget, ___T>,
1137    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1138
1139    #[doc = " Returns the properties of the host SPMI controller.\n"]
1140    fn get_controller_properties(
1141        &mut self,
1142
1143        responder: ::fidl_next::Responder<debug::GetControllerProperties, ___T>,
1144    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1145
1146    fn on_unknown_interaction(
1147        &mut self,
1148        ordinal: u64,
1149    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1150        ::core::future::ready(())
1151    }
1152}
1153
1154impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Debug
1155where
1156    ___H: DebugServerHandler<___T> + ::core::marker::Send,
1157    ___T: ::fidl_next::Transport,
1158    for<'de> crate::wire::DebugConnectTargetRequest: ::fidl_next::Decode<
1159            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1160            Constraint = (),
1161        >,
1162{
1163    async fn on_one_way(
1164        handler: &mut ___H,
1165        mut message: ::fidl_next::Message<___T>,
1166    ) -> ::core::result::Result<
1167        (),
1168        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1169    > {
1170        match *message.header().ordinal {
1171            ordinal => {
1172                handler.on_unknown_interaction(ordinal).await;
1173                if ::core::matches!(
1174                    message.header().flexibility(),
1175                    ::fidl_next::protocol::Flexibility::Strict
1176                ) {
1177                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1178                } else {
1179                    Ok(())
1180                }
1181            }
1182        }
1183    }
1184
1185    async fn on_two_way(
1186        handler: &mut ___H,
1187        mut message: ::fidl_next::Message<___T>,
1188        responder: ::fidl_next::protocol::Responder<___T>,
1189    ) -> ::core::result::Result<
1190        (),
1191        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1192    > {
1193        match *message.header().ordinal {
1194            799648158518250777 => {
1195                let responder = ::fidl_next::Responder::from_untyped(responder);
1196
1197                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1198                    Ok(decoded) => {
1199                        handler
1200                            .connect_target(::fidl_next::Request::from_decoded(decoded), responder)
1201                            .await;
1202                        Ok(())
1203                    }
1204                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1205                        ordinal: 799648158518250777,
1206                        error,
1207                    }),
1208                }
1209            }
1210
1211            4733781216537150751 => {
1212                let responder = ::fidl_next::Responder::from_untyped(responder);
1213
1214                handler.get_controller_properties(responder).await;
1215                Ok(())
1216            }
1217
1218            ordinal => {
1219                handler.on_unknown_interaction(ordinal).await;
1220                if ::core::matches!(
1221                    message.header().flexibility(),
1222                    ::fidl_next::protocol::Flexibility::Strict
1223                ) {
1224                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1225                } else {
1226                    responder
1227                        .respond_framework_error(
1228                            ordinal,
1229                            ::fidl_next::FrameworkError::UnknownMethod,
1230                        )
1231                        .expect("encoding a framework error should never fail")
1232                        .await?;
1233                    Ok(())
1234                }
1235            }
1236        }
1237    }
1238}
1239
1240impl<___T> DebugClientHandler<___T> for ::fidl_next::IgnoreEvents
1241where
1242    ___T: ::fidl_next::Transport,
1243{
1244    async fn on_unknown_interaction(&mut self, _: u64) {}
1245}
1246
1247impl<___H, ___T> DebugLocalClientHandler<___T> for ::fidl_next::Local<___H>
1248where
1249    ___H: DebugClientHandler<___T>,
1250    ___T: ::fidl_next::Transport,
1251{
1252    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1253        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1254    }
1255}
1256
1257impl<___H, ___T> DebugLocalServerHandler<___T> for ::fidl_next::Local<___H>
1258where
1259    ___H: DebugServerHandler<___T>,
1260    ___T: ::fidl_next::Transport,
1261{
1262    async fn connect_target(
1263        &mut self,
1264
1265        request: ::fidl_next::Request<debug::ConnectTarget, ___T>,
1266
1267        responder: ::fidl_next::Responder<debug::ConnectTarget, ___T>,
1268    ) {
1269        ___H::connect_target(&mut self.0, request, responder).await
1270    }
1271
1272    async fn get_controller_properties(
1273        &mut self,
1274
1275        responder: ::fidl_next::Responder<debug::GetControllerProperties, ___T>,
1276    ) {
1277        ___H::get_controller_properties(&mut self.0, responder).await
1278    }
1279
1280    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1281        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1282    }
1283}
1284
1285/// The type corresponding to the DebugService service.
1286#[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"]
1287#[derive(Debug)]
1288pub struct DebugService;
1289
1290impl ::fidl_next::DiscoverableService for DebugService {
1291    const SERVICE_NAME: &'static str = "fuchsia.hardware.spmi.DebugService";
1292    const MEMBER_NAMES: &'static [&'static str] = &["device"];
1293}
1294
1295impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for DebugService {}
1296
1297impl<___C> ::fidl_next::Service<___C> for DebugService
1298where
1299    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1300{
1301    type Connector = DebugServiceConnector<___C>;
1302}
1303
1304/// A strongly-typed service connector for the `DebugService` service.
1305#[repr(transparent)]
1306pub struct DebugServiceConnector<___C> {
1307    #[allow(dead_code)]
1308    connector: ___C,
1309}
1310
1311impl<___C> DebugServiceConnector<___C>
1312where
1313    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1314{
1315    /// Attempts to connect to the `device` service member.
1316    pub fn device(
1317        &self,
1318        server_end: ::fidl_next::ServerEnd<crate::Debug, ::fidl_next::fuchsia::zx::Channel>,
1319    ) -> ::core::result::Result<
1320        (),
1321        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
1322    > {
1323        ::fidl_next::protocol::ServiceConnector::<
1324                ::fidl_next::fuchsia::zx::Channel
1325            >::connect_to_member(
1326                &self.connector,
1327                "device",
1328                server_end.into_untyped(),
1329            )
1330    }
1331}
1332
1333/// A service handler for the `DebugService` service.
1334pub trait DebugServiceHandler {
1335    /// Handles an attempt to connect to the `device` member.
1336    fn device(
1337        &self,
1338        server_end: ::fidl_next::ServerEnd<crate::Debug, ::fidl_next::fuchsia::zx::Channel>,
1339    );
1340}
1341
1342impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for DebugService
1343where
1344    ___H: DebugServiceHandler,
1345    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
1346{
1347    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
1348        use ::fidl_next::InstanceFromServiceTransport;
1349        match member {
1350            "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
1351                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
1352            )),
1353
1354            _ => unreachable!(),
1355        }
1356    }
1357}
1358
1359/// The type corresponding to the Device protocol.
1360#[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"]
1361#[derive(PartialEq, Debug)]
1362pub struct Device;
1363
1364impl ::fidl_next::Discoverable for Device {
1365    const PROTOCOL_NAME: &'static str = "fuchsia.hardware.spmi.Device";
1366}
1367
1368#[cfg(target_os = "fuchsia")]
1369impl ::fidl_next::HasTransport for Device {
1370    type Transport = ::fidl_next::fuchsia::zx::Channel;
1371}
1372
1373pub mod device {
1374    pub mod prelude {
1375        pub use crate::{
1376            Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
1377            DeviceServerHandler, device,
1378        };
1379
1380        pub use crate::natural::DeviceCancelWatchControllerWriteCommandsRequest;
1381
1382        pub use crate::natural::DeviceRegisterReadRequest;
1383
1384        pub use crate::natural::DeviceRegisterWriteRequest;
1385
1386        pub use crate::natural::DeviceWatchControllerWriteCommandsRequest;
1387
1388        pub use crate::natural::DeviceCancelWatchControllerWriteCommandsResponse;
1389
1390        pub use crate::natural::DeviceGetPropertiesResponse;
1391
1392        pub use crate::natural::DeviceRegisterReadResponse;
1393
1394        pub use crate::natural::DeviceRegisterWriteResponse;
1395
1396        pub use crate::natural::DeviceWatchControllerWriteCommandsResponse;
1397
1398        pub use crate::natural::DriverError;
1399    }
1400
1401    pub struct RegisterRead;
1402
1403    impl ::fidl_next::Method for RegisterRead {
1404        const ORDINAL: u64 = 7616793777944757;
1405        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1406            ::fidl_next::protocol::Flexibility::Flexible;
1407
1408        type Protocol = crate::Device;
1409
1410        type Request = crate::wire::DeviceRegisterReadRequest;
1411    }
1412
1413    impl ::fidl_next::TwoWayMethod for RegisterRead {
1414        type Response = ::fidl_next::wire::Result<
1415            'static,
1416            crate::wire::DeviceRegisterReadResponse<'static>,
1417            crate::wire::DriverError,
1418        >;
1419    }
1420
1421    impl<___R> ::fidl_next::Respond<___R> for RegisterRead {
1422        type Output = ::core::result::Result<
1423            crate::generic::DeviceRegisterReadResponse<___R>,
1424            ::fidl_next::never::Never,
1425        >;
1426
1427        fn respond(response: ___R) -> Self::Output {
1428            ::core::result::Result::Ok(crate::generic::DeviceRegisterReadResponse {
1429                data: response,
1430            })
1431        }
1432    }
1433
1434    impl<___R> ::fidl_next::RespondErr<___R> for RegisterRead {
1435        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1436
1437        fn respond_err(response: ___R) -> Self::Output {
1438            ::core::result::Result::Err(response)
1439        }
1440    }
1441
1442    pub struct RegisterWrite;
1443
1444    impl ::fidl_next::Method for RegisterWrite {
1445        const ORDINAL: u64 = 1044640317848992555;
1446        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1447            ::fidl_next::protocol::Flexibility::Flexible;
1448
1449        type Protocol = crate::Device;
1450
1451        type Request = crate::wire::DeviceRegisterWriteRequest<'static>;
1452    }
1453
1454    impl ::fidl_next::TwoWayMethod for RegisterWrite {
1455        type Response = ::fidl_next::wire::Result<
1456            'static,
1457            crate::wire::DeviceRegisterWriteResponse,
1458            crate::wire::DriverError,
1459        >;
1460    }
1461
1462    impl<___R> ::fidl_next::Respond<___R> for RegisterWrite {
1463        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1464
1465        fn respond(response: ___R) -> Self::Output {
1466            ::core::result::Result::Ok(response)
1467        }
1468    }
1469
1470    impl<___R> ::fidl_next::RespondErr<___R> for RegisterWrite {
1471        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1472
1473        fn respond_err(response: ___R) -> Self::Output {
1474            ::core::result::Result::Err(response)
1475        }
1476    }
1477
1478    pub struct GetProperties;
1479
1480    impl ::fidl_next::Method for GetProperties {
1481        const ORDINAL: u64 = 2203507889677991867;
1482        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1483            ::fidl_next::protocol::Flexibility::Flexible;
1484
1485        type Protocol = crate::Device;
1486
1487        type Request = ::fidl_next::wire::EmptyMessageBody;
1488    }
1489
1490    impl ::fidl_next::TwoWayMethod for GetProperties {
1491        type Response =
1492            ::fidl_next::wire::Flexible<'static, crate::wire::DeviceGetPropertiesResponse<'static>>;
1493    }
1494
1495    impl<___R> ::fidl_next::Respond<___R> for GetProperties {
1496        type Output = ::fidl_next::Flexible<___R>;
1497
1498        fn respond(response: ___R) -> Self::Output {
1499            ::fidl_next::Flexible(response)
1500        }
1501    }
1502
1503    pub struct WatchControllerWriteCommands;
1504
1505    impl ::fidl_next::Method for WatchControllerWriteCommands {
1506        const ORDINAL: u64 = 4712819229924853164;
1507        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1508            ::fidl_next::protocol::Flexibility::Flexible;
1509
1510        type Protocol = crate::Device;
1511
1512        type Request = crate::wire::DeviceWatchControllerWriteCommandsRequest;
1513    }
1514
1515    impl ::fidl_next::TwoWayMethod for WatchControllerWriteCommands {
1516        type Response = ::fidl_next::wire::Result<
1517            'static,
1518            crate::wire::DeviceWatchControllerWriteCommandsResponse<'static>,
1519            crate::wire::DriverError,
1520        >;
1521    }
1522
1523    impl<___R> ::fidl_next::Respond<___R> for WatchControllerWriteCommands {
1524        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1525
1526        fn respond(response: ___R) -> Self::Output {
1527            ::core::result::Result::Ok(response)
1528        }
1529    }
1530
1531    impl<___R> ::fidl_next::RespondErr<___R> for WatchControllerWriteCommands {
1532        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1533
1534        fn respond_err(response: ___R) -> Self::Output {
1535            ::core::result::Result::Err(response)
1536        }
1537    }
1538
1539    pub struct CancelWatchControllerWriteCommands;
1540
1541    impl ::fidl_next::Method for CancelWatchControllerWriteCommands {
1542        const ORDINAL: u64 = 5789309704894207008;
1543        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1544            ::fidl_next::protocol::Flexibility::Flexible;
1545
1546        type Protocol = crate::Device;
1547
1548        type Request = crate::wire::DeviceCancelWatchControllerWriteCommandsRequest;
1549    }
1550
1551    impl ::fidl_next::TwoWayMethod for CancelWatchControllerWriteCommands {
1552        type Response = ::fidl_next::wire::Result<
1553            'static,
1554            crate::wire::DeviceCancelWatchControllerWriteCommandsResponse,
1555            crate::wire::DriverError,
1556        >;
1557    }
1558
1559    impl<___R> ::fidl_next::Respond<___R> for CancelWatchControllerWriteCommands {
1560        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1561
1562        fn respond(response: ___R) -> Self::Output {
1563            ::core::result::Result::Ok(response)
1564        }
1565    }
1566
1567    impl<___R> ::fidl_next::RespondErr<___R> for CancelWatchControllerWriteCommands {
1568        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1569
1570        fn respond_err(response: ___R) -> Self::Output {
1571            ::core::result::Result::Err(response)
1572        }
1573    }
1574
1575    mod ___detail {
1576        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1577        where
1578            ___T: ::fidl_next::Transport,
1579        {
1580            type Client = DeviceClient<___T>;
1581            type Server = DeviceServer<___T>;
1582        }
1583
1584        /// The client for the `Device` protocol.
1585        #[repr(transparent)]
1586        pub struct DeviceClient<___T: ::fidl_next::Transport> {
1587            #[allow(dead_code)]
1588            client: ::fidl_next::protocol::Client<___T>,
1589        }
1590
1591        impl<___T> DeviceClient<___T>
1592        where
1593            ___T: ::fidl_next::Transport,
1594        {
1595            #[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"]
1596            pub fn register_read(
1597                &self,
1598
1599                address: impl ::fidl_next::Encode<
1600                    ::fidl_next::wire::Uint16,
1601                    <___T as ::fidl_next::Transport>::SendBuffer,
1602                >,
1603
1604                size_bytes: impl ::fidl_next::Encode<
1605                    ::fidl_next::wire::Uint32,
1606                    <___T as ::fidl_next::Transport>::SendBuffer,
1607                >,
1608            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterRead, ___T>
1609            where
1610                <___T as ::fidl_next::Transport>::SendBuffer:
1611                    ::fidl_next::encoder::InternalHandleEncoder,
1612            {
1613                self.register_read_with(crate::generic::DeviceRegisterReadRequest {
1614                    address,
1615
1616                    size_bytes,
1617                })
1618            }
1619
1620            #[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"]
1621            pub fn register_read_with<___R>(
1622                &self,
1623                request: ___R,
1624            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterRead, ___T>
1625            where
1626                ___R: ::fidl_next::Encode<
1627                        crate::wire::DeviceRegisterReadRequest,
1628                        <___T as ::fidl_next::Transport>::SendBuffer,
1629                    >,
1630            {
1631                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1632                    7616793777944757,
1633                    <super::RegisterRead as ::fidl_next::Method>::FLEXIBILITY,
1634                    request,
1635                ))
1636            }
1637
1638            #[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"]
1639            pub fn register_write(
1640                &self,
1641
1642                address: impl ::fidl_next::Encode<
1643                    ::fidl_next::wire::Uint16,
1644                    <___T as ::fidl_next::Transport>::SendBuffer,
1645                >,
1646
1647                data: impl ::fidl_next::Encode<
1648                    ::fidl_next::wire::Vector<'static, u8>,
1649                    <___T as ::fidl_next::Transport>::SendBuffer,
1650                >,
1651            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterWrite, ___T>
1652            where
1653                <___T as ::fidl_next::Transport>::SendBuffer:
1654                    ::fidl_next::encoder::InternalHandleEncoder,
1655                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1656            {
1657                self.register_write_with(crate::generic::DeviceRegisterWriteRequest {
1658                    address,
1659
1660                    data,
1661                })
1662            }
1663
1664            #[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"]
1665            pub fn register_write_with<___R>(
1666                &self,
1667                request: ___R,
1668            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterWrite, ___T>
1669            where
1670                ___R: ::fidl_next::Encode<
1671                        crate::wire::DeviceRegisterWriteRequest<'static>,
1672                        <___T as ::fidl_next::Transport>::SendBuffer,
1673                    >,
1674            {
1675                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1676                    1044640317848992555,
1677                    <super::RegisterWrite as ::fidl_next::Method>::FLEXIBILITY,
1678                    request,
1679                ))
1680            }
1681
1682            #[doc = " Get the properties of the SPMI device.\n"]
1683            pub fn get_properties(
1684                &self,
1685            ) -> ::fidl_next::TwoWayFuture<'_, super::GetProperties, ___T> {
1686                ::fidl_next::TwoWayFuture::from_untyped(
1687                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1688                        2203507889677991867,
1689                        <super::GetProperties as ::fidl_next::Method>::FLEXIBILITY,
1690                        (),
1691                    ),
1692                )
1693            }
1694
1695            #[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"]
1696            pub fn watch_controller_write_commands(
1697                &self,
1698
1699                address: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
1700
1701                size: impl ::fidl_next::Encode<
1702                    ::fidl_next::wire::Uint16,
1703                    <___T as ::fidl_next::Transport>::SendBuffer,
1704                >,
1705
1706                setup_wake_lease: impl ::fidl_next::Encode<
1707                    ::fidl_next::wire::fuchsia::OptionalEventPair,
1708                    <___T as ::fidl_next::Transport>::SendBuffer,
1709                >,
1710            ) -> ::fidl_next::TwoWayFuture<'_, super::WatchControllerWriteCommands, ___T>
1711            where
1712                <___T as ::fidl_next::Transport>::SendBuffer:
1713                    ::fidl_next::encoder::InternalHandleEncoder,
1714                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1715            {
1716                self.watch_controller_write_commands_with(
1717                    crate::generic::DeviceWatchControllerWriteCommandsRequest {
1718                        address,
1719
1720                        size,
1721
1722                        setup_wake_lease,
1723                    },
1724                )
1725            }
1726
1727            #[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"]
1728            pub fn watch_controller_write_commands_with<___R>(
1729                &self,
1730                request: ___R,
1731            ) -> ::fidl_next::TwoWayFuture<'_, super::WatchControllerWriteCommands, ___T>
1732            where
1733                ___R: ::fidl_next::Encode<
1734                        crate::wire::DeviceWatchControllerWriteCommandsRequest,
1735                        <___T as ::fidl_next::Transport>::SendBuffer,
1736                    >,
1737            {
1738                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1739                    4712819229924853164,
1740                    <super::WatchControllerWriteCommands as ::fidl_next::Method>::FLEXIBILITY,
1741                    request,
1742                ))
1743            }
1744
1745            #[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"]
1746            pub fn cancel_watch_controller_write_commands(
1747                &self,
1748
1749                address: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
1750
1751                size: impl ::fidl_next::Encode<
1752                    ::fidl_next::wire::Uint16,
1753                    <___T as ::fidl_next::Transport>::SendBuffer,
1754                >,
1755            ) -> ::fidl_next::TwoWayFuture<'_, super::CancelWatchControllerWriteCommands, ___T>
1756            where
1757                <___T as ::fidl_next::Transport>::SendBuffer:
1758                    ::fidl_next::encoder::InternalHandleEncoder,
1759            {
1760                self.cancel_watch_controller_write_commands_with(
1761                    crate::generic::DeviceCancelWatchControllerWriteCommandsRequest {
1762                        address,
1763
1764                        size,
1765                    },
1766                )
1767            }
1768
1769            #[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"]
1770            pub fn cancel_watch_controller_write_commands_with<___R>(
1771                &self,
1772                request: ___R,
1773            ) -> ::fidl_next::TwoWayFuture<'_, super::CancelWatchControllerWriteCommands, ___T>
1774            where
1775                ___R: ::fidl_next::Encode<
1776                        crate::wire::DeviceCancelWatchControllerWriteCommandsRequest,
1777                        <___T as ::fidl_next::Transport>::SendBuffer,
1778                    >,
1779            {
1780                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1781                    5789309704894207008,
1782                    <super::CancelWatchControllerWriteCommands as ::fidl_next::Method>::FLEXIBILITY,
1783                    request,
1784                ))
1785            }
1786        }
1787
1788        /// The server for the `Device` protocol.
1789        #[repr(transparent)]
1790        pub struct DeviceServer<___T: ::fidl_next::Transport> {
1791            server: ::fidl_next::protocol::Server<___T>,
1792        }
1793
1794        impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1795    }
1796}
1797
1798#[diagnostic::on_unimplemented(
1799    note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1800)]
1801
1802/// A client handler for the Device protocol.
1803///
1804/// See [`Device`] for more details.
1805pub trait DeviceLocalClientHandler<
1806    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1807    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1808>
1809{
1810    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1811        ::core::future::ready(())
1812    }
1813}
1814
1815impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
1816where
1817    ___H: DeviceLocalClientHandler<___T>,
1818    ___T: ::fidl_next::Transport,
1819{
1820    async fn on_event(
1821        handler: &mut ___H,
1822        mut message: ::fidl_next::Message<___T>,
1823    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1824        match *message.header().ordinal {
1825            ordinal => {
1826                handler.on_unknown_interaction(ordinal).await;
1827                if ::core::matches!(
1828                    message.header().flexibility(),
1829                    ::fidl_next::protocol::Flexibility::Strict
1830                ) {
1831                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1832                } else {
1833                    Ok(())
1834                }
1835            }
1836        }
1837    }
1838}
1839
1840#[diagnostic::on_unimplemented(
1841    note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1842)]
1843
1844/// A server handler for the Device protocol.
1845///
1846/// See [`Device`] for more details.
1847pub trait DeviceLocalServerHandler<
1848    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1849    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1850>
1851{
1852    #[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"]
1853    fn register_read(
1854        &mut self,
1855
1856        request: ::fidl_next::Request<device::RegisterRead, ___T>,
1857
1858        responder: ::fidl_next::Responder<device::RegisterRead, ___T>,
1859    ) -> impl ::core::future::Future<Output = ()>;
1860
1861    #[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"]
1862    fn register_write(
1863        &mut self,
1864
1865        request: ::fidl_next::Request<device::RegisterWrite, ___T>,
1866
1867        responder: ::fidl_next::Responder<device::RegisterWrite, ___T>,
1868    ) -> impl ::core::future::Future<Output = ()>;
1869
1870    #[doc = " Get the properties of the SPMI device.\n"]
1871    fn get_properties(
1872        &mut self,
1873
1874        responder: ::fidl_next::Responder<device::GetProperties, ___T>,
1875    ) -> impl ::core::future::Future<Output = ()>;
1876
1877    #[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"]
1878    fn watch_controller_write_commands(
1879        &mut self,
1880
1881        request: ::fidl_next::Request<device::WatchControllerWriteCommands, ___T>,
1882
1883        responder: ::fidl_next::Responder<device::WatchControllerWriteCommands, ___T>,
1884    ) -> impl ::core::future::Future<Output = ()>;
1885
1886    #[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"]
1887    fn cancel_watch_controller_write_commands(
1888        &mut self,
1889
1890        request: ::fidl_next::Request<device::CancelWatchControllerWriteCommands, ___T>,
1891
1892        responder: ::fidl_next::Responder<device::CancelWatchControllerWriteCommands, ___T>,
1893    ) -> impl ::core::future::Future<Output = ()>;
1894
1895    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1896        ::core::future::ready(())
1897    }
1898}
1899
1900impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
1901where
1902    ___H: DeviceLocalServerHandler<___T>,
1903    ___T: ::fidl_next::Transport,
1904    for<'de> crate::wire::DeviceRegisterReadRequest: ::fidl_next::Decode<
1905            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1906            Constraint = (),
1907        >,
1908    for<'de> crate::wire::DeviceRegisterWriteRequest<'de>: ::fidl_next::Decode<
1909            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1910            Constraint = (),
1911        >,
1912    for<'de> crate::wire::DeviceWatchControllerWriteCommandsRequest: ::fidl_next::Decode<
1913            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1914            Constraint = (),
1915        >,
1916    for<'de> crate::wire::DeviceCancelWatchControllerWriteCommandsRequest: ::fidl_next::Decode<
1917            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1918            Constraint = (),
1919        >,
1920{
1921    async fn on_one_way(
1922        handler: &mut ___H,
1923        mut message: ::fidl_next::Message<___T>,
1924    ) -> ::core::result::Result<
1925        (),
1926        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1927    > {
1928        match *message.header().ordinal {
1929            ordinal => {
1930                handler.on_unknown_interaction(ordinal).await;
1931                if ::core::matches!(
1932                    message.header().flexibility(),
1933                    ::fidl_next::protocol::Flexibility::Strict
1934                ) {
1935                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1936                } else {
1937                    Ok(())
1938                }
1939            }
1940        }
1941    }
1942
1943    async fn on_two_way(
1944        handler: &mut ___H,
1945        mut message: ::fidl_next::Message<___T>,
1946        responder: ::fidl_next::protocol::Responder<___T>,
1947    ) -> ::core::result::Result<
1948        (),
1949        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1950    > {
1951        match *message.header().ordinal {
1952            7616793777944757 => {
1953                let responder = ::fidl_next::Responder::from_untyped(responder);
1954
1955                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1956                    Ok(decoded) => {
1957                        handler
1958                            .register_read(::fidl_next::Request::from_decoded(decoded), responder)
1959                            .await;
1960                        Ok(())
1961                    }
1962                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1963                        ordinal: 7616793777944757,
1964                        error,
1965                    }),
1966                }
1967            }
1968
1969            1044640317848992555 => {
1970                let responder = ::fidl_next::Responder::from_untyped(responder);
1971
1972                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1973                    Ok(decoded) => {
1974                        handler
1975                            .register_write(::fidl_next::Request::from_decoded(decoded), responder)
1976                            .await;
1977                        Ok(())
1978                    }
1979                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1980                        ordinal: 1044640317848992555,
1981                        error,
1982                    }),
1983                }
1984            }
1985
1986            2203507889677991867 => {
1987                let responder = ::fidl_next::Responder::from_untyped(responder);
1988
1989                handler.get_properties(responder).await;
1990                Ok(())
1991            }
1992
1993            4712819229924853164 => {
1994                let responder = ::fidl_next::Responder::from_untyped(responder);
1995
1996                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1997                    Ok(decoded) => {
1998                        handler
1999                            .watch_controller_write_commands(
2000                                ::fidl_next::Request::from_decoded(decoded),
2001                                responder,
2002                            )
2003                            .await;
2004                        Ok(())
2005                    }
2006                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2007                        ordinal: 4712819229924853164,
2008                        error,
2009                    }),
2010                }
2011            }
2012
2013            5789309704894207008 => {
2014                let responder = ::fidl_next::Responder::from_untyped(responder);
2015
2016                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2017                    Ok(decoded) => {
2018                        handler
2019                            .cancel_watch_controller_write_commands(
2020                                ::fidl_next::Request::from_decoded(decoded),
2021                                responder,
2022                            )
2023                            .await;
2024                        Ok(())
2025                    }
2026                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2027                        ordinal: 5789309704894207008,
2028                        error,
2029                    }),
2030                }
2031            }
2032
2033            ordinal => {
2034                handler.on_unknown_interaction(ordinal).await;
2035                if ::core::matches!(
2036                    message.header().flexibility(),
2037                    ::fidl_next::protocol::Flexibility::Strict
2038                ) {
2039                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2040                } else {
2041                    responder
2042                        .respond_framework_error(
2043                            ordinal,
2044                            ::fidl_next::FrameworkError::UnknownMethod,
2045                        )
2046                        .expect("encoding a framework error should never fail")
2047                        .await?;
2048                    Ok(())
2049                }
2050            }
2051        }
2052    }
2053}
2054
2055/// A client handler for the Device protocol.
2056///
2057/// See [`Device`] for more details.
2058pub trait DeviceClientHandler<
2059    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2060    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2061>
2062{
2063    fn on_unknown_interaction(
2064        &mut self,
2065        ordinal: u64,
2066    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2067        ::core::future::ready(())
2068    }
2069}
2070
2071impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
2072where
2073    ___H: DeviceClientHandler<___T> + ::core::marker::Send,
2074    ___T: ::fidl_next::Transport,
2075{
2076    async fn on_event(
2077        handler: &mut ___H,
2078        mut message: ::fidl_next::Message<___T>,
2079    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2080        match *message.header().ordinal {
2081            ordinal => {
2082                handler.on_unknown_interaction(ordinal).await;
2083                if ::core::matches!(
2084                    message.header().flexibility(),
2085                    ::fidl_next::protocol::Flexibility::Strict
2086                ) {
2087                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2088                } else {
2089                    Ok(())
2090                }
2091            }
2092        }
2093    }
2094}
2095
2096/// A server handler for the Device protocol.
2097///
2098/// See [`Device`] for more details.
2099pub trait DeviceServerHandler<
2100    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2101    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2102>
2103{
2104    #[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"]
2105    fn register_read(
2106        &mut self,
2107
2108        request: ::fidl_next::Request<device::RegisterRead, ___T>,
2109
2110        responder: ::fidl_next::Responder<device::RegisterRead, ___T>,
2111    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2112
2113    #[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"]
2114    fn register_write(
2115        &mut self,
2116
2117        request: ::fidl_next::Request<device::RegisterWrite, ___T>,
2118
2119        responder: ::fidl_next::Responder<device::RegisterWrite, ___T>,
2120    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2121
2122    #[doc = " Get the properties of the SPMI device.\n"]
2123    fn get_properties(
2124        &mut self,
2125
2126        responder: ::fidl_next::Responder<device::GetProperties, ___T>,
2127    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2128
2129    #[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"]
2130    fn watch_controller_write_commands(
2131        &mut self,
2132
2133        request: ::fidl_next::Request<device::WatchControllerWriteCommands, ___T>,
2134
2135        responder: ::fidl_next::Responder<device::WatchControllerWriteCommands, ___T>,
2136    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2137
2138    #[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"]
2139    fn cancel_watch_controller_write_commands(
2140        &mut self,
2141
2142        request: ::fidl_next::Request<device::CancelWatchControllerWriteCommands, ___T>,
2143
2144        responder: ::fidl_next::Responder<device::CancelWatchControllerWriteCommands, ___T>,
2145    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2146
2147    fn on_unknown_interaction(
2148        &mut self,
2149        ordinal: u64,
2150    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2151        ::core::future::ready(())
2152    }
2153}
2154
2155impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
2156where
2157    ___H: DeviceServerHandler<___T> + ::core::marker::Send,
2158    ___T: ::fidl_next::Transport,
2159    for<'de> crate::wire::DeviceRegisterReadRequest: ::fidl_next::Decode<
2160            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2161            Constraint = (),
2162        >,
2163    for<'de> crate::wire::DeviceRegisterWriteRequest<'de>: ::fidl_next::Decode<
2164            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2165            Constraint = (),
2166        >,
2167    for<'de> crate::wire::DeviceWatchControllerWriteCommandsRequest: ::fidl_next::Decode<
2168            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2169            Constraint = (),
2170        >,
2171    for<'de> crate::wire::DeviceCancelWatchControllerWriteCommandsRequest: ::fidl_next::Decode<
2172            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2173            Constraint = (),
2174        >,
2175{
2176    async fn on_one_way(
2177        handler: &mut ___H,
2178        mut message: ::fidl_next::Message<___T>,
2179    ) -> ::core::result::Result<
2180        (),
2181        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2182    > {
2183        match *message.header().ordinal {
2184            ordinal => {
2185                handler.on_unknown_interaction(ordinal).await;
2186                if ::core::matches!(
2187                    message.header().flexibility(),
2188                    ::fidl_next::protocol::Flexibility::Strict
2189                ) {
2190                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2191                } else {
2192                    Ok(())
2193                }
2194            }
2195        }
2196    }
2197
2198    async fn on_two_way(
2199        handler: &mut ___H,
2200        mut message: ::fidl_next::Message<___T>,
2201        responder: ::fidl_next::protocol::Responder<___T>,
2202    ) -> ::core::result::Result<
2203        (),
2204        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2205    > {
2206        match *message.header().ordinal {
2207            7616793777944757 => {
2208                let responder = ::fidl_next::Responder::from_untyped(responder);
2209
2210                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2211                    Ok(decoded) => {
2212                        handler
2213                            .register_read(::fidl_next::Request::from_decoded(decoded), responder)
2214                            .await;
2215                        Ok(())
2216                    }
2217                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2218                        ordinal: 7616793777944757,
2219                        error,
2220                    }),
2221                }
2222            }
2223
2224            1044640317848992555 => {
2225                let responder = ::fidl_next::Responder::from_untyped(responder);
2226
2227                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2228                    Ok(decoded) => {
2229                        handler
2230                            .register_write(::fidl_next::Request::from_decoded(decoded), responder)
2231                            .await;
2232                        Ok(())
2233                    }
2234                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2235                        ordinal: 1044640317848992555,
2236                        error,
2237                    }),
2238                }
2239            }
2240
2241            2203507889677991867 => {
2242                let responder = ::fidl_next::Responder::from_untyped(responder);
2243
2244                handler.get_properties(responder).await;
2245                Ok(())
2246            }
2247
2248            4712819229924853164 => {
2249                let responder = ::fidl_next::Responder::from_untyped(responder);
2250
2251                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2252                    Ok(decoded) => {
2253                        handler
2254                            .watch_controller_write_commands(
2255                                ::fidl_next::Request::from_decoded(decoded),
2256                                responder,
2257                            )
2258                            .await;
2259                        Ok(())
2260                    }
2261                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2262                        ordinal: 4712819229924853164,
2263                        error,
2264                    }),
2265                }
2266            }
2267
2268            5789309704894207008 => {
2269                let responder = ::fidl_next::Responder::from_untyped(responder);
2270
2271                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2272                    Ok(decoded) => {
2273                        handler
2274                            .cancel_watch_controller_write_commands(
2275                                ::fidl_next::Request::from_decoded(decoded),
2276                                responder,
2277                            )
2278                            .await;
2279                        Ok(())
2280                    }
2281                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2282                        ordinal: 5789309704894207008,
2283                        error,
2284                    }),
2285                }
2286            }
2287
2288            ordinal => {
2289                handler.on_unknown_interaction(ordinal).await;
2290                if ::core::matches!(
2291                    message.header().flexibility(),
2292                    ::fidl_next::protocol::Flexibility::Strict
2293                ) {
2294                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2295                } else {
2296                    responder
2297                        .respond_framework_error(
2298                            ordinal,
2299                            ::fidl_next::FrameworkError::UnknownMethod,
2300                        )
2301                        .expect("encoding a framework error should never fail")
2302                        .await?;
2303                    Ok(())
2304                }
2305            }
2306        }
2307    }
2308}
2309
2310impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents
2311where
2312    ___T: ::fidl_next::Transport,
2313{
2314    async fn on_unknown_interaction(&mut self, _: u64) {}
2315}
2316
2317impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2318where
2319    ___H: DeviceClientHandler<___T>,
2320    ___T: ::fidl_next::Transport,
2321{
2322    async fn on_unknown_interaction(&mut self, ordinal: u64) {
2323        ___H::on_unknown_interaction(&mut self.0, ordinal).await
2324    }
2325}
2326
2327impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2328where
2329    ___H: DeviceServerHandler<___T>,
2330    ___T: ::fidl_next::Transport,
2331{
2332    async fn register_read(
2333        &mut self,
2334
2335        request: ::fidl_next::Request<device::RegisterRead, ___T>,
2336
2337        responder: ::fidl_next::Responder<device::RegisterRead, ___T>,
2338    ) {
2339        ___H::register_read(&mut self.0, request, responder).await
2340    }
2341
2342    async fn register_write(
2343        &mut self,
2344
2345        request: ::fidl_next::Request<device::RegisterWrite, ___T>,
2346
2347        responder: ::fidl_next::Responder<device::RegisterWrite, ___T>,
2348    ) {
2349        ___H::register_write(&mut self.0, request, responder).await
2350    }
2351
2352    async fn get_properties(
2353        &mut self,
2354
2355        responder: ::fidl_next::Responder<device::GetProperties, ___T>,
2356    ) {
2357        ___H::get_properties(&mut self.0, responder).await
2358    }
2359
2360    async fn watch_controller_write_commands(
2361        &mut self,
2362
2363        request: ::fidl_next::Request<device::WatchControllerWriteCommands, ___T>,
2364
2365        responder: ::fidl_next::Responder<device::WatchControllerWriteCommands, ___T>,
2366    ) {
2367        ___H::watch_controller_write_commands(&mut self.0, request, responder).await
2368    }
2369
2370    async fn cancel_watch_controller_write_commands(
2371        &mut self,
2372
2373        request: ::fidl_next::Request<device::CancelWatchControllerWriteCommands, ___T>,
2374
2375        responder: ::fidl_next::Responder<device::CancelWatchControllerWriteCommands, ___T>,
2376    ) {
2377        ___H::cancel_watch_controller_write_commands(&mut self.0, request, responder).await
2378    }
2379
2380    async fn on_unknown_interaction(&mut self, ordinal: u64) {
2381        ___H::on_unknown_interaction(&mut self.0, ordinal).await
2382    }
2383}
2384
2385/// The type corresponding to the SubTargetService service.
2386#[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"]
2387#[derive(Debug)]
2388pub struct SubTargetService;
2389
2390impl ::fidl_next::DiscoverableService for SubTargetService {
2391    const SERVICE_NAME: &'static str = "fuchsia.hardware.spmi.SubTargetService";
2392    const MEMBER_NAMES: &'static [&'static str] = &["device"];
2393}
2394
2395impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for SubTargetService {}
2396
2397impl<___C> ::fidl_next::Service<___C> for SubTargetService
2398where
2399    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2400{
2401    type Connector = SubTargetServiceConnector<___C>;
2402}
2403
2404/// A strongly-typed service connector for the `SubTargetService` service.
2405#[repr(transparent)]
2406pub struct SubTargetServiceConnector<___C> {
2407    #[allow(dead_code)]
2408    connector: ___C,
2409}
2410
2411impl<___C> SubTargetServiceConnector<___C>
2412where
2413    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2414{
2415    /// Attempts to connect to the `device` service member.
2416    pub fn device(
2417        &self,
2418        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2419    ) -> ::core::result::Result<
2420        (),
2421        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2422    > {
2423        ::fidl_next::protocol::ServiceConnector::<
2424                ::fidl_next::fuchsia::zx::Channel
2425            >::connect_to_member(
2426                &self.connector,
2427                "device",
2428                server_end.into_untyped(),
2429            )
2430    }
2431}
2432
2433/// A service handler for the `SubTargetService` service.
2434pub trait SubTargetServiceHandler {
2435    /// Handles an attempt to connect to the `device` member.
2436    fn device(
2437        &self,
2438        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2439    );
2440}
2441
2442impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for SubTargetService
2443where
2444    ___H: SubTargetServiceHandler,
2445    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2446{
2447    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2448        use ::fidl_next::InstanceFromServiceTransport;
2449        match member {
2450            "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
2451                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2452            )),
2453
2454            _ => unreachable!(),
2455        }
2456    }
2457}
2458
2459/// The type corresponding to the TargetService service.
2460#[doc = " This service represents an SPMI target device. Clients have access to the entire SPMI register\n range.\n"]
2461#[derive(Debug)]
2462pub struct TargetService;
2463
2464impl ::fidl_next::DiscoverableService for TargetService {
2465    const SERVICE_NAME: &'static str = "fuchsia.hardware.spmi.TargetService";
2466    const MEMBER_NAMES: &'static [&'static str] = &["device"];
2467}
2468
2469impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for TargetService {}
2470
2471impl<___C> ::fidl_next::Service<___C> for TargetService
2472where
2473    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2474{
2475    type Connector = TargetServiceConnector<___C>;
2476}
2477
2478/// A strongly-typed service connector for the `TargetService` service.
2479#[repr(transparent)]
2480pub struct TargetServiceConnector<___C> {
2481    #[allow(dead_code)]
2482    connector: ___C,
2483}
2484
2485impl<___C> TargetServiceConnector<___C>
2486where
2487    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2488{
2489    /// Attempts to connect to the `device` service member.
2490    pub fn device(
2491        &self,
2492        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2493    ) -> ::core::result::Result<
2494        (),
2495        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2496    > {
2497        ::fidl_next::protocol::ServiceConnector::<
2498                ::fidl_next::fuchsia::zx::Channel
2499            >::connect_to_member(
2500                &self.connector,
2501                "device",
2502                server_end.into_untyped(),
2503            )
2504    }
2505}
2506
2507/// A service handler for the `TargetService` service.
2508pub trait TargetServiceHandler {
2509    /// Handles an attempt to connect to the `device` member.
2510    fn device(
2511        &self,
2512        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
2513    );
2514}
2515
2516impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for TargetService
2517where
2518    ___H: TargetServiceHandler,
2519    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2520{
2521    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2522        use ::fidl_next::InstanceFromServiceTransport;
2523        match member {
2524            "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
2525                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2526            )),
2527
2528            _ => unreachable!(),
2529        }
2530    }
2531}
2532
2533pub use fidl_next_common_fuchsia_hardware_spmi::*;