Skip to main content

fidl_next_common_fuchsia_hardware_powerdomain/
fidl_next_common_fuchsia_hardware_powerdomain.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 type DomainEnableResponse = ();
8
9    pub type DomainDisableResponse = ();
10
11    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
12    #[repr(C)]
13    pub struct DomainIsEnabledResponse {
14        pub enabled: bool,
15    }
16
17    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DomainIsEnabledResponse, ___E>
18        for DomainIsEnabledResponse
19    where
20        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
21    {
22        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
23            Self,
24            crate::wire::DomainIsEnabledResponse,
25        > = unsafe {
26            ::fidl_next::CopyOptimization::enable_if(
27                true && <bool as ::fidl_next::Encode<bool, ___E>>::COPY_OPTIMIZATION.is_enabled(),
28            )
29        };
30
31        #[inline]
32        fn encode(
33            self,
34            encoder_: &mut ___E,
35            out_: &mut ::core::mem::MaybeUninit<crate::wire::DomainIsEnabledResponse>,
36            _: (),
37        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
38            ::fidl_next::munge! {
39                let crate::wire::DomainIsEnabledResponse {
40                    enabled,
41
42                } = out_;
43            }
44
45            ::fidl_next::Encode::encode(self.enabled, encoder_, enabled, ())?;
46
47            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(enabled.as_mut_ptr()) };
48
49            Ok(())
50        }
51    }
52
53    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DomainIsEnabledResponse, ___E>
54        for &'a DomainIsEnabledResponse
55    where
56        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
57    {
58        #[inline]
59        fn encode(
60            self,
61            encoder_: &mut ___E,
62            out_: &mut ::core::mem::MaybeUninit<crate::wire::DomainIsEnabledResponse>,
63            _: (),
64        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
65            ::fidl_next::munge! {
66                let crate::wire::DomainIsEnabledResponse {
67                    enabled,
68
69                } = out_;
70            }
71
72            ::fidl_next::Encode::encode(&self.enabled, encoder_, enabled, ())?;
73
74            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(enabled.as_mut_ptr()) };
75
76            Ok(())
77        }
78    }
79
80    unsafe impl<___E>
81        ::fidl_next::EncodeOption<
82            ::fidl_next::wire::Box<'static, crate::wire::DomainIsEnabledResponse>,
83            ___E,
84        > for DomainIsEnabledResponse
85    where
86        ___E: ::fidl_next::Encoder + ?Sized,
87        DomainIsEnabledResponse: ::fidl_next::Encode<crate::wire::DomainIsEnabledResponse, ___E>,
88    {
89        #[inline]
90        fn encode_option(
91            this: ::core::option::Option<Self>,
92            encoder: &mut ___E,
93            out: &mut ::core::mem::MaybeUninit<
94                ::fidl_next::wire::Box<'static, crate::wire::DomainIsEnabledResponse>,
95            >,
96            _: (),
97        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
98            if let Some(inner) = this {
99                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
100                ::fidl_next::wire::Box::encode_present(out);
101            } else {
102                ::fidl_next::wire::Box::encode_absent(out);
103            }
104
105            Ok(())
106        }
107    }
108
109    unsafe impl<'a, ___E>
110        ::fidl_next::EncodeOption<
111            ::fidl_next::wire::Box<'static, crate::wire::DomainIsEnabledResponse>,
112            ___E,
113        > for &'a DomainIsEnabledResponse
114    where
115        ___E: ::fidl_next::Encoder + ?Sized,
116        &'a DomainIsEnabledResponse:
117            ::fidl_next::Encode<crate::wire::DomainIsEnabledResponse, ___E>,
118    {
119        #[inline]
120        fn encode_option(
121            this: ::core::option::Option<Self>,
122            encoder: &mut ___E,
123            out: &mut ::core::mem::MaybeUninit<
124                ::fidl_next::wire::Box<'static, crate::wire::DomainIsEnabledResponse>,
125            >,
126            _: (),
127        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
128            if let Some(inner) = this {
129                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
130                ::fidl_next::wire::Box::encode_present(out);
131            } else {
132                ::fidl_next::wire::Box::encode_absent(out);
133            }
134
135            Ok(())
136        }
137    }
138
139    impl ::fidl_next::FromWire<crate::wire::DomainIsEnabledResponse> for DomainIsEnabledResponse {
140        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
141            crate::wire::DomainIsEnabledResponse,
142            Self,
143        > = unsafe {
144            ::fidl_next::CopyOptimization::enable_if(
145                true && <bool as ::fidl_next::FromWire<bool>>::COPY_OPTIMIZATION.is_enabled(),
146            )
147        };
148
149        #[inline]
150        fn from_wire(wire: crate::wire::DomainIsEnabledResponse) -> Self {
151            Self { enabled: ::fidl_next::FromWire::from_wire(wire.enabled) }
152        }
153    }
154
155    impl ::fidl_next::FromWireRef<crate::wire::DomainIsEnabledResponse> for DomainIsEnabledResponse {
156        #[inline]
157        fn from_wire_ref(wire: &crate::wire::DomainIsEnabledResponse) -> Self {
158            Self { enabled: ::fidl_next::FromWireRef::from_wire_ref(&wire.enabled) }
159        }
160    }
161
162    #[doc = " Represents a single power domain configuration for a device.\n"]
163    #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
164    pub struct PowerDomain {
165        pub id: ::core::option::Option<u32>,
166
167        pub name: ::core::option::Option<::std::string::String>,
168
169        pub domain_id: ::core::option::Option<u32>,
170    }
171
172    impl PowerDomain {
173        fn __max_ordinal(&self) -> usize {
174            if self.domain_id.is_some() {
175                return 3;
176            }
177
178            if self.name.is_some() {
179                return 2;
180            }
181
182            if self.id.is_some() {
183                return 1;
184            }
185
186            0
187        }
188    }
189
190    unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerDomain<'static>, ___E> for PowerDomain
191    where
192        ___E: ::fidl_next::Encoder + ?Sized,
193    {
194        #[inline]
195        fn encode(
196            mut self,
197            encoder: &mut ___E,
198            out: &mut ::core::mem::MaybeUninit<crate::wire::PowerDomain<'static>>,
199            _: (),
200        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
201            ::fidl_next::munge!(let crate::wire::PowerDomain { table } = out);
202
203            let max_ord = self.__max_ordinal();
204
205            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
206            ::fidl_next::Wire::zero_padding(&mut out);
207
208            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
209                ::fidl_next::wire::Envelope,
210            >(encoder, max_ord);
211
212            for i in 1..=max_ord {
213                match i {
214                    3 => {
215                        if let Some(value) = self.domain_id.take() {
216                            ::fidl_next::wire::Envelope::encode_value::<
217                                ::fidl_next::wire::Uint32,
218                                ___E,
219                            >(
220                                value, preallocated.encoder, &mut out, ()
221                            )?;
222                        } else {
223                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
224                        }
225                    }
226
227                    2 => {
228                        if let Some(value) = self.name.take() {
229                            ::fidl_next::wire::Envelope::encode_value::<
230                                ::fidl_next::wire::String<'static>,
231                                ___E,
232                            >(
233                                value, preallocated.encoder, &mut out, 4294967295
234                            )?;
235                        } else {
236                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
237                        }
238                    }
239
240                    1 => {
241                        if let Some(value) = self.id.take() {
242                            ::fidl_next::wire::Envelope::encode_value::<
243                                ::fidl_next::wire::Uint32,
244                                ___E,
245                            >(
246                                value, preallocated.encoder, &mut out, ()
247                            )?;
248                        } else {
249                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
250                        }
251                    }
252
253                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
254                }
255                unsafe {
256                    preallocated.write_next(out.assume_init_ref());
257                }
258            }
259
260            ::fidl_next::wire::Table::encode_len(table, max_ord);
261
262            Ok(())
263        }
264    }
265
266    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PowerDomain<'static>, ___E>
267        for &'a PowerDomain
268    where
269        ___E: ::fidl_next::Encoder + ?Sized,
270    {
271        #[inline]
272        fn encode(
273            self,
274            encoder: &mut ___E,
275            out: &mut ::core::mem::MaybeUninit<crate::wire::PowerDomain<'static>>,
276            _: (),
277        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
278            ::fidl_next::munge!(let crate::wire::PowerDomain { table } = out);
279
280            let max_ord = self.__max_ordinal();
281
282            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
283            ::fidl_next::Wire::zero_padding(&mut out);
284
285            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
286                ::fidl_next::wire::Envelope,
287            >(encoder, max_ord);
288
289            for i in 1..=max_ord {
290                match i {
291                    3 => {
292                        if let Some(value) = &self.domain_id {
293                            ::fidl_next::wire::Envelope::encode_value::<
294                                ::fidl_next::wire::Uint32,
295                                ___E,
296                            >(
297                                value, preallocated.encoder, &mut out, ()
298                            )?;
299                        } else {
300                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
301                        }
302                    }
303
304                    2 => {
305                        if let Some(value) = &self.name {
306                            ::fidl_next::wire::Envelope::encode_value::<
307                                ::fidl_next::wire::String<'static>,
308                                ___E,
309                            >(
310                                value, preallocated.encoder, &mut out, 4294967295
311                            )?;
312                        } else {
313                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
314                        }
315                    }
316
317                    1 => {
318                        if let Some(value) = &self.id {
319                            ::fidl_next::wire::Envelope::encode_value::<
320                                ::fidl_next::wire::Uint32,
321                                ___E,
322                            >(
323                                value, preallocated.encoder, &mut out, ()
324                            )?;
325                        } else {
326                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
327                        }
328                    }
329
330                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
331                }
332                unsafe {
333                    preallocated.write_next(out.assume_init_ref());
334                }
335            }
336
337            ::fidl_next::wire::Table::encode_len(table, max_ord);
338
339            Ok(())
340        }
341    }
342
343    impl<'de> ::fidl_next::FromWire<crate::wire::PowerDomain<'de>> for PowerDomain {
344        #[inline]
345        fn from_wire(wire_: crate::wire::PowerDomain<'de>) -> Self {
346            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
347
348            let id = wire_.table.get(1);
349
350            let name = wire_.table.get(2);
351
352            let domain_id = wire_.table.get(3);
353
354            Self {
355                id: id.map(|envelope| {
356                    ::fidl_next::FromWire::from_wire(unsafe {
357                        envelope.read_unchecked::<::fidl_next::wire::Uint32>()
358                    })
359                }),
360
361                name: name.map(|envelope| {
362                    ::fidl_next::FromWire::from_wire(unsafe {
363                        envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
364                    })
365                }),
366
367                domain_id: domain_id.map(|envelope| {
368                    ::fidl_next::FromWire::from_wire(unsafe {
369                        envelope.read_unchecked::<::fidl_next::wire::Uint32>()
370                    })
371                }),
372            }
373        }
374    }
375
376    impl<'de> ::fidl_next::FromWireRef<crate::wire::PowerDomain<'de>> for PowerDomain {
377        #[inline]
378        fn from_wire_ref(wire: &crate::wire::PowerDomain<'de>) -> Self {
379            Self {
380                id: wire.table.get(1).map(|envelope| {
381                    ::fidl_next::FromWireRef::from_wire_ref(unsafe {
382                        envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
383                    })
384                }),
385
386                name: wire.table.get(2).map(|envelope| {
387                    ::fidl_next::FromWireRef::from_wire_ref(unsafe {
388                        envelope.deref_unchecked::<::fidl_next::wire::String<'de>>()
389                    })
390                }),
391
392                domain_id: wire.table.get(3).map(|envelope| {
393                    ::fidl_next::FromWireRef::from_wire_ref(unsafe {
394                        envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
395                    })
396                }),
397            }
398        }
399    }
400
401    #[doc = " The top-level metadata structure passed to drivers to describe their power domains.\n"]
402    #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
403    pub struct DomainMetadata {
404        pub domains: ::core::option::Option<::std::vec::Vec<crate::natural::PowerDomain>>,
405    }
406
407    impl DomainMetadata {
408        fn __max_ordinal(&self) -> usize {
409            if self.domains.is_some() {
410                return 1;
411            }
412
413            0
414        }
415    }
416
417    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DomainMetadata<'static>, ___E> for DomainMetadata
418    where
419        ___E: ::fidl_next::Encoder + ?Sized,
420    {
421        #[inline]
422        fn encode(
423            mut self,
424            encoder: &mut ___E,
425            out: &mut ::core::mem::MaybeUninit<crate::wire::DomainMetadata<'static>>,
426            _: (),
427        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
428            ::fidl_next::munge!(let crate::wire::DomainMetadata { table } = out);
429
430            let max_ord = self.__max_ordinal();
431
432            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
433            ::fidl_next::Wire::zero_padding(&mut out);
434
435            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
436                ::fidl_next::wire::Envelope,
437            >(encoder, max_ord);
438
439            for i in 1..=max_ord {
440                match i {
441                    1 => {
442                        if let Some(value) = self.domains.take() {
443                            ::fidl_next::wire::Envelope::encode_value::<
444                                ::fidl_next::wire::Vector<
445                                    'static,
446                                    crate::wire::PowerDomain<'static>,
447                                >,
448                                ___E,
449                            >(
450                                value, preallocated.encoder, &mut out, (4294967295, ())
451                            )?;
452                        } else {
453                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
454                        }
455                    }
456
457                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
458                }
459                unsafe {
460                    preallocated.write_next(out.assume_init_ref());
461                }
462            }
463
464            ::fidl_next::wire::Table::encode_len(table, max_ord);
465
466            Ok(())
467        }
468    }
469
470    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DomainMetadata<'static>, ___E>
471        for &'a DomainMetadata
472    where
473        ___E: ::fidl_next::Encoder + ?Sized,
474    {
475        #[inline]
476        fn encode(
477            self,
478            encoder: &mut ___E,
479            out: &mut ::core::mem::MaybeUninit<crate::wire::DomainMetadata<'static>>,
480            _: (),
481        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
482            ::fidl_next::munge!(let crate::wire::DomainMetadata { table } = out);
483
484            let max_ord = self.__max_ordinal();
485
486            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
487            ::fidl_next::Wire::zero_padding(&mut out);
488
489            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
490                ::fidl_next::wire::Envelope,
491            >(encoder, max_ord);
492
493            for i in 1..=max_ord {
494                match i {
495                    1 => {
496                        if let Some(value) = &self.domains {
497                            ::fidl_next::wire::Envelope::encode_value::<
498                                ::fidl_next::wire::Vector<
499                                    'static,
500                                    crate::wire::PowerDomain<'static>,
501                                >,
502                                ___E,
503                            >(
504                                value, preallocated.encoder, &mut out, (4294967295, ())
505                            )?;
506                        } else {
507                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
508                        }
509                    }
510
511                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
512                }
513                unsafe {
514                    preallocated.write_next(out.assume_init_ref());
515                }
516            }
517
518            ::fidl_next::wire::Table::encode_len(table, max_ord);
519
520            Ok(())
521        }
522    }
523
524    impl<'de> ::fidl_next::FromWire<crate::wire::DomainMetadata<'de>> for DomainMetadata {
525        #[inline]
526        fn from_wire(wire_: crate::wire::DomainMetadata<'de>) -> Self {
527            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
528
529            let domains = wire_.table.get(1);
530
531            Self {
532
533
534                domains: domains.map(|envelope| ::fidl_next::FromWire::from_wire(
535                    unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerDomain<'de>>>() }
536                )),
537
538        }
539        }
540    }
541
542    impl<'de> ::fidl_next::FromWireRef<crate::wire::DomainMetadata<'de>> for DomainMetadata {
543        #[inline]
544        fn from_wire_ref(wire: &crate::wire::DomainMetadata<'de>) -> Self {
545            Self {
546
547
548                domains: wire.table.get(1)
549                    .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
550                        unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerDomain<'de>>>() }
551                    )),
552
553        }
554        }
555    }
556}
557
558pub mod wire {
559
560    /// The wire type corresponding to [`DomainEnableResponse`].
561    pub type DomainEnableResponse = ::fidl_next::wire::Unit;
562
563    /// The wire type corresponding to [`DomainDisableResponse`].
564    pub type DomainDisableResponse = ::fidl_next::wire::Unit;
565
566    /// The wire type corresponding to [`DomainIsEnabledResponse`].
567    #[derive(Clone, Debug)]
568    #[repr(C)]
569    pub struct DomainIsEnabledResponse {
570        pub enabled: bool,
571    }
572
573    static_assertions::const_assert_eq!(std::mem::size_of::<DomainIsEnabledResponse>(), 1);
574    static_assertions::const_assert_eq!(std::mem::align_of::<DomainIsEnabledResponse>(), 1);
575
576    static_assertions::const_assert_eq!(std::mem::offset_of!(DomainIsEnabledResponse, enabled), 0);
577
578    impl ::fidl_next::Constrained for DomainIsEnabledResponse {
579        type Constraint = ();
580
581        fn validate(
582            _: ::fidl_next::Slot<'_, Self>,
583            _: Self::Constraint,
584        ) -> Result<(), ::fidl_next::ValidationError> {
585            Ok(())
586        }
587    }
588
589    unsafe impl ::fidl_next::Wire for DomainIsEnabledResponse {
590        type Narrowed<'de> = DomainIsEnabledResponse;
591
592        #[inline]
593        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
594            ::fidl_next::munge! {
595                let Self {
596                    enabled,
597
598                } = &mut *out_;
599            }
600
601            ::fidl_next::Wire::zero_padding(enabled);
602        }
603    }
604
605    unsafe impl<___D> ::fidl_next::Decode<___D> for DomainIsEnabledResponse
606    where
607        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
608    {
609        fn decode(
610            slot_: ::fidl_next::Slot<'_, Self>,
611            decoder_: &mut ___D,
612            _: (),
613        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
614            ::fidl_next::munge! {
615                let Self {
616                    mut enabled,
617
618                } = slot_;
619            }
620
621            let _field = enabled.as_mut();
622
623            ::fidl_next::Decode::decode(enabled.as_mut(), decoder_, ())?;
624
625            Ok(())
626        }
627    }
628
629    impl ::fidl_next::IntoNatural for DomainIsEnabledResponse {
630        type Natural = crate::natural::DomainIsEnabledResponse;
631    }
632
633    /// The wire type corresponding to [`PowerDomain`].
634    #[repr(C)]
635    pub struct PowerDomain<'de> {
636        pub(crate) table: ::fidl_next::wire::Table<'de>,
637    }
638
639    impl<'de> Drop for PowerDomain<'de> {
640        fn drop(&mut self) {
641            let _ = self
642                .table
643                .get(1)
644                .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
645
646            let _ = self.table.get(2).map(|envelope| unsafe {
647                envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
648            });
649
650            let _ = self
651                .table
652                .get(3)
653                .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
654        }
655    }
656
657    impl ::fidl_next::Constrained for PowerDomain<'_> {
658        type Constraint = ();
659
660        fn validate(
661            _: ::fidl_next::Slot<'_, Self>,
662            _: Self::Constraint,
663        ) -> Result<(), ::fidl_next::ValidationError> {
664            Ok(())
665        }
666    }
667
668    unsafe impl ::fidl_next::Wire for PowerDomain<'static> {
669        type Narrowed<'de> = PowerDomain<'de>;
670
671        #[inline]
672        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
673            ::fidl_next::munge!(let Self { table } = out);
674            ::fidl_next::wire::Table::zero_padding(table);
675        }
676    }
677
678    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerDomain<'de>
679    where
680        ___D: ::fidl_next::Decoder<'de> + ?Sized,
681    {
682        fn decode(
683            slot: ::fidl_next::Slot<'_, Self>,
684            decoder: &mut ___D,
685            _: (),
686        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
687            ::fidl_next::munge!(let Self { table } = slot);
688
689            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
690                match ordinal {
691                    0 => unsafe { ::core::hint::unreachable_unchecked() },
692
693                    1 => {
694                        ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
695                            slot.as_mut(),
696                            decoder,
697                            (),
698                        )?;
699
700                        Ok(())
701                    }
702
703                    2 => {
704                        ::fidl_next::wire::Envelope::decode_as::<
705                            ___D,
706                            ::fidl_next::wire::String<'de>,
707                        >(slot.as_mut(), decoder, 4294967295)?;
708
709                        Ok(())
710                    }
711
712                    3 => {
713                        ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
714                            slot.as_mut(),
715                            decoder,
716                            (),
717                        )?;
718
719                        Ok(())
720                    }
721
722                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
723                }
724            })
725        }
726    }
727
728    impl<'de> PowerDomain<'de> {
729        pub fn id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
730            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
731        }
732
733        pub fn take_id(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
734            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
735        }
736
737        pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
738            unsafe { Some(self.table.get(2)?.deref_unchecked()) }
739        }
740
741        pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
742            unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
743        }
744
745        pub fn domain_id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
746            unsafe { Some(self.table.get(3)?.deref_unchecked()) }
747        }
748
749        pub fn take_domain_id(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
750            unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
751        }
752    }
753
754    impl<'de> ::core::fmt::Debug for PowerDomain<'de> {
755        fn fmt(
756            &self,
757            f: &mut ::core::fmt::Formatter<'_>,
758        ) -> ::core::result::Result<(), ::core::fmt::Error> {
759            f.debug_struct("PowerDomain")
760                .field("id", &self.id())
761                .field("name", &self.name())
762                .field("domain_id", &self.domain_id())
763                .finish()
764        }
765    }
766
767    impl<'de> ::fidl_next::IntoNatural for PowerDomain<'de> {
768        type Natural = crate::natural::PowerDomain;
769    }
770
771    /// The wire type corresponding to [`DomainMetadata`].
772    #[repr(C)]
773    pub struct DomainMetadata<'de> {
774        pub(crate) table: ::fidl_next::wire::Table<'de>,
775    }
776
777    impl<'de> Drop for DomainMetadata<'de> {
778        fn drop(&mut self) {
779            let _ = self.table.get(1)
780                .map(|envelope| unsafe {
781                    envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerDomain<'de>>>()
782                });
783        }
784    }
785
786    impl ::fidl_next::Constrained for DomainMetadata<'_> {
787        type Constraint = ();
788
789        fn validate(
790            _: ::fidl_next::Slot<'_, Self>,
791            _: Self::Constraint,
792        ) -> Result<(), ::fidl_next::ValidationError> {
793            Ok(())
794        }
795    }
796
797    unsafe impl ::fidl_next::Wire for DomainMetadata<'static> {
798        type Narrowed<'de> = DomainMetadata<'de>;
799
800        #[inline]
801        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
802            ::fidl_next::munge!(let Self { table } = out);
803            ::fidl_next::wire::Table::zero_padding(table);
804        }
805    }
806
807    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DomainMetadata<'de>
808    where
809        ___D: ::fidl_next::Decoder<'de> + ?Sized,
810    {
811        fn decode(
812            slot: ::fidl_next::Slot<'_, Self>,
813            decoder: &mut ___D,
814            _: (),
815        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
816            ::fidl_next::munge!(let Self { table } = slot);
817
818            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
819                match ordinal {
820                    0 => unsafe { ::core::hint::unreachable_unchecked() },
821
822                    1 => {
823                        ::fidl_next::wire::Envelope::decode_as::<
824                            ___D,
825                            ::fidl_next::wire::Vector<'de, crate::wire::PowerDomain<'de>>,
826                        >(slot.as_mut(), decoder, (4294967295, ()))?;
827
828                        Ok(())
829                    }
830
831                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
832                }
833            })
834        }
835    }
836
837    impl<'de> DomainMetadata<'de> {
838        pub fn domains(
839            &self,
840        ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::PowerDomain<'de>>>
841        {
842            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
843        }
844
845        pub fn take_domains(
846            &mut self,
847        ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::PowerDomain<'de>>>
848        {
849            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
850        }
851    }
852
853    impl<'de> ::core::fmt::Debug for DomainMetadata<'de> {
854        fn fmt(
855            &self,
856            f: &mut ::core::fmt::Formatter<'_>,
857        ) -> ::core::result::Result<(), ::core::fmt::Error> {
858            f.debug_struct("DomainMetadata").field("domains", &self.domains()).finish()
859        }
860    }
861
862    impl<'de> ::fidl_next::IntoNatural for DomainMetadata<'de> {
863        type Natural = crate::natural::DomainMetadata;
864    }
865}
866
867pub mod wire_optional {}
868
869pub mod generic {
870
871    /// The generic type corresponding to [`DomainEnableResponse`].
872    pub type DomainEnableResponse = ();
873
874    /// The generic type corresponding to [`DomainDisableResponse`].
875    pub type DomainDisableResponse = ();
876
877    /// The generic type corresponding to [`DomainIsEnabledResponse`].
878    pub struct DomainIsEnabledResponse<T0> {
879        pub enabled: T0,
880    }
881
882    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DomainIsEnabledResponse, ___E>
883        for DomainIsEnabledResponse<T0>
884    where
885        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
886        T0: ::fidl_next::Encode<bool, ___E>,
887    {
888        #[inline]
889        fn encode(
890            self,
891            encoder_: &mut ___E,
892            out_: &mut ::core::mem::MaybeUninit<crate::wire::DomainIsEnabledResponse>,
893            _: (),
894        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
895            ::fidl_next::munge! {
896                let crate::wire::DomainIsEnabledResponse {
897                    enabled,
898
899                } = out_;
900            }
901
902            ::fidl_next::Encode::encode(self.enabled, encoder_, enabled, ())?;
903
904            Ok(())
905        }
906    }
907
908    unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DomainIsEnabledResponse, ___E>
909        for &'a DomainIsEnabledResponse<T0>
910    where
911        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
912        &'a T0: ::fidl_next::Encode<bool, ___E>,
913    {
914        #[inline]
915        fn encode(
916            self,
917            encoder_: &mut ___E,
918            out_: &mut ::core::mem::MaybeUninit<crate::wire::DomainIsEnabledResponse>,
919            _: (),
920        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
921            ::fidl_next::munge! {
922                let crate::wire::DomainIsEnabledResponse {
923                    enabled,
924
925                } = out_;
926            }
927
928            ::fidl_next::Encode::encode(&self.enabled, encoder_, enabled, ())?;
929
930            Ok(())
931        }
932    }
933}
934
935pub use self::natural::*;
936
937/// The type corresponding to the Domain protocol.
938#[doc = " Protocol for controlling a power domain.\n Provides basic enable/disable support, typically used when full power management\n is not required or is handled elsewhere.\n"]
939#[derive(PartialEq, Debug)]
940pub struct Domain;
941
942#[cfg(target_os = "fuchsia")]
943impl ::fidl_next::HasTransport for Domain {
944    type Transport = ::fidl_next::fuchsia::zx::Channel;
945}
946
947pub mod domain {
948    pub mod prelude {
949        pub use crate::{
950            Domain, DomainClientHandler, DomainLocalClientHandler, DomainLocalServerHandler,
951            DomainServerHandler, domain,
952        };
953
954        pub use crate::natural::DomainDisableResponse;
955
956        pub use crate::natural::DomainEnableResponse;
957
958        pub use crate::natural::DomainIsEnabledResponse;
959    }
960
961    pub struct Enable;
962
963    impl ::fidl_next::Method for Enable {
964        const ORDINAL: u64 = 2070181937608286071;
965        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
966            ::fidl_next::protocol::Flexibility::Flexible;
967
968        type Protocol = crate::Domain;
969
970        type Request = ::fidl_next::wire::EmptyMessageBody;
971    }
972
973    impl ::fidl_next::TwoWayMethod for Enable {
974        type Response = ::fidl_next::wire::Result<
975            'static,
976            crate::wire::DomainEnableResponse,
977            ::fidl_next::wire::fuchsia::Status,
978        >;
979    }
980
981    impl<___R> ::fidl_next::Respond<___R> for Enable {
982        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
983
984        fn respond(response: ___R) -> Self::Output {
985            ::core::result::Result::Ok(response)
986        }
987    }
988
989    impl<___R> ::fidl_next::RespondErr<___R> for Enable {
990        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
991
992        fn respond_err(response: ___R) -> Self::Output {
993            ::core::result::Result::Err(response)
994        }
995    }
996
997    pub struct Disable;
998
999    impl ::fidl_next::Method for Disable {
1000        const ORDINAL: u64 = 764136726546827899;
1001        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1002            ::fidl_next::protocol::Flexibility::Flexible;
1003
1004        type Protocol = crate::Domain;
1005
1006        type Request = ::fidl_next::wire::EmptyMessageBody;
1007    }
1008
1009    impl ::fidl_next::TwoWayMethod for Disable {
1010        type Response = ::fidl_next::wire::Result<
1011            'static,
1012            crate::wire::DomainDisableResponse,
1013            ::fidl_next::wire::fuchsia::Status,
1014        >;
1015    }
1016
1017    impl<___R> ::fidl_next::Respond<___R> for Disable {
1018        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1019
1020        fn respond(response: ___R) -> Self::Output {
1021            ::core::result::Result::Ok(response)
1022        }
1023    }
1024
1025    impl<___R> ::fidl_next::RespondErr<___R> for Disable {
1026        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1027
1028        fn respond_err(response: ___R) -> Self::Output {
1029            ::core::result::Result::Err(response)
1030        }
1031    }
1032
1033    pub struct IsEnabled;
1034
1035    impl ::fidl_next::Method for IsEnabled {
1036        const ORDINAL: u64 = 6531400635744256917;
1037        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1038            ::fidl_next::protocol::Flexibility::Flexible;
1039
1040        type Protocol = crate::Domain;
1041
1042        type Request = ::fidl_next::wire::EmptyMessageBody;
1043    }
1044
1045    impl ::fidl_next::TwoWayMethod for IsEnabled {
1046        type Response = ::fidl_next::wire::Result<
1047            'static,
1048            crate::wire::DomainIsEnabledResponse,
1049            ::fidl_next::wire::fuchsia::Status,
1050        >;
1051    }
1052
1053    impl<___R> ::fidl_next::Respond<___R> for IsEnabled {
1054        type Output = ::core::result::Result<
1055            crate::generic::DomainIsEnabledResponse<___R>,
1056            ::fidl_next::never::Never,
1057        >;
1058
1059        fn respond(response: ___R) -> Self::Output {
1060            ::core::result::Result::Ok(crate::generic::DomainIsEnabledResponse {
1061                enabled: response,
1062            })
1063        }
1064    }
1065
1066    impl<___R> ::fidl_next::RespondErr<___R> for IsEnabled {
1067        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1068
1069        fn respond_err(response: ___R) -> Self::Output {
1070            ::core::result::Result::Err(response)
1071        }
1072    }
1073
1074    mod ___detail {
1075        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Domain
1076        where
1077            ___T: ::fidl_next::Transport,
1078        {
1079            type Client = DomainClient<___T>;
1080            type Server = DomainServer<___T>;
1081        }
1082
1083        /// The client for the `Domain` protocol.
1084        #[repr(transparent)]
1085        pub struct DomainClient<___T: ::fidl_next::Transport> {
1086            #[allow(dead_code)]
1087            client: ::fidl_next::protocol::Client<___T>,
1088        }
1089
1090        impl<___T> DomainClient<___T>
1091        where
1092            ___T: ::fidl_next::Transport,
1093        {
1094            #[doc = " Enable the power domain.\n"]
1095            pub fn enable(&self) -> ::fidl_next::TwoWayFuture<'_, super::Enable, ___T> {
1096                ::fidl_next::TwoWayFuture::from_untyped(
1097                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1098                        2070181937608286071,
1099                        <super::Enable as ::fidl_next::Method>::FLEXIBILITY,
1100                        (),
1101                    ),
1102                )
1103            }
1104
1105            #[doc = " Disable the power domain.\n"]
1106            pub fn disable(&self) -> ::fidl_next::TwoWayFuture<'_, super::Disable, ___T> {
1107                ::fidl_next::TwoWayFuture::from_untyped(
1108                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1109                        764136726546827899,
1110                        <super::Disable as ::fidl_next::Method>::FLEXIBILITY,
1111                        (),
1112                    ),
1113                )
1114            }
1115
1116            #[doc = " Returns `true` if the power domain is enabled.\n"]
1117            pub fn is_enabled(&self) -> ::fidl_next::TwoWayFuture<'_, super::IsEnabled, ___T> {
1118                ::fidl_next::TwoWayFuture::from_untyped(
1119                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1120                        6531400635744256917,
1121                        <super::IsEnabled as ::fidl_next::Method>::FLEXIBILITY,
1122                        (),
1123                    ),
1124                )
1125            }
1126        }
1127
1128        /// The server for the `Domain` protocol.
1129        #[repr(transparent)]
1130        pub struct DomainServer<___T: ::fidl_next::Transport> {
1131            server: ::fidl_next::protocol::Server<___T>,
1132        }
1133
1134        impl<___T> DomainServer<___T> where ___T: ::fidl_next::Transport {}
1135    }
1136}
1137
1138#[diagnostic::on_unimplemented(
1139    note = "If {Self} implements the non-local DomainClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1140)]
1141
1142/// A client handler for the Domain protocol.
1143///
1144/// See [`Domain`] for more details.
1145pub trait DomainLocalClientHandler<
1146    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1147    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1148>
1149{
1150    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1151        ::core::future::ready(())
1152    }
1153}
1154
1155impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Domain
1156where
1157    ___H: DomainLocalClientHandler<___T>,
1158    ___T: ::fidl_next::Transport,
1159{
1160    async fn on_event(
1161        handler: &mut ___H,
1162        mut message: ::fidl_next::Message<___T>,
1163    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1164        match *message.header().ordinal {
1165            ordinal => {
1166                handler.on_unknown_interaction(ordinal).await;
1167                if ::core::matches!(
1168                    message.header().flexibility(),
1169                    ::fidl_next::protocol::Flexibility::Strict
1170                ) {
1171                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1172                } else {
1173                    Ok(())
1174                }
1175            }
1176        }
1177    }
1178}
1179
1180#[diagnostic::on_unimplemented(
1181    note = "If {Self} implements the non-local DomainServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1182)]
1183
1184/// A server handler for the Domain protocol.
1185///
1186/// See [`Domain`] for more details.
1187pub trait DomainLocalServerHandler<
1188    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1189    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1190>
1191{
1192    #[doc = " Enable the power domain.\n"]
1193    fn enable(
1194        &mut self,
1195
1196        responder: ::fidl_next::Responder<domain::Enable, ___T>,
1197    ) -> impl ::core::future::Future<Output = ()>;
1198
1199    #[doc = " Disable the power domain.\n"]
1200    fn disable(
1201        &mut self,
1202
1203        responder: ::fidl_next::Responder<domain::Disable, ___T>,
1204    ) -> impl ::core::future::Future<Output = ()>;
1205
1206    #[doc = " Returns `true` if the power domain is enabled.\n"]
1207    fn is_enabled(
1208        &mut self,
1209
1210        responder: ::fidl_next::Responder<domain::IsEnabled, ___T>,
1211    ) -> impl ::core::future::Future<Output = ()>;
1212
1213    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1214        ::core::future::ready(())
1215    }
1216}
1217
1218impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Domain
1219where
1220    ___H: DomainLocalServerHandler<___T>,
1221    ___T: ::fidl_next::Transport,
1222{
1223    async fn on_one_way(
1224        handler: &mut ___H,
1225        mut message: ::fidl_next::Message<___T>,
1226    ) -> ::core::result::Result<
1227        (),
1228        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1229    > {
1230        match *message.header().ordinal {
1231            ordinal => {
1232                handler.on_unknown_interaction(ordinal).await;
1233                if ::core::matches!(
1234                    message.header().flexibility(),
1235                    ::fidl_next::protocol::Flexibility::Strict
1236                ) {
1237                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1238                } else {
1239                    Ok(())
1240                }
1241            }
1242        }
1243    }
1244
1245    async fn on_two_way(
1246        handler: &mut ___H,
1247        mut message: ::fidl_next::Message<___T>,
1248        responder: ::fidl_next::protocol::Responder<___T>,
1249    ) -> ::core::result::Result<
1250        (),
1251        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1252    > {
1253        match *message.header().ordinal {
1254            2070181937608286071 => {
1255                let responder = ::fidl_next::Responder::from_untyped(responder);
1256
1257                handler.enable(responder).await;
1258                Ok(())
1259            }
1260
1261            764136726546827899 => {
1262                let responder = ::fidl_next::Responder::from_untyped(responder);
1263
1264                handler.disable(responder).await;
1265                Ok(())
1266            }
1267
1268            6531400635744256917 => {
1269                let responder = ::fidl_next::Responder::from_untyped(responder);
1270
1271                handler.is_enabled(responder).await;
1272                Ok(())
1273            }
1274
1275            ordinal => {
1276                handler.on_unknown_interaction(ordinal).await;
1277                if ::core::matches!(
1278                    message.header().flexibility(),
1279                    ::fidl_next::protocol::Flexibility::Strict
1280                ) {
1281                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1282                } else {
1283                    responder
1284                        .respond_framework_error(
1285                            ordinal,
1286                            ::fidl_next::FrameworkError::UnknownMethod,
1287                        )
1288                        .expect("encoding a framework error should never fail")
1289                        .await?;
1290                    Ok(())
1291                }
1292            }
1293        }
1294    }
1295}
1296
1297/// A client handler for the Domain protocol.
1298///
1299/// See [`Domain`] for more details.
1300pub trait DomainClientHandler<
1301    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1302    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1303>
1304{
1305    fn on_unknown_interaction(
1306        &mut self,
1307        ordinal: u64,
1308    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1309        ::core::future::ready(())
1310    }
1311}
1312
1313impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Domain
1314where
1315    ___H: DomainClientHandler<___T> + ::core::marker::Send,
1316    ___T: ::fidl_next::Transport,
1317{
1318    async fn on_event(
1319        handler: &mut ___H,
1320        mut message: ::fidl_next::Message<___T>,
1321    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1322        match *message.header().ordinal {
1323            ordinal => {
1324                handler.on_unknown_interaction(ordinal).await;
1325                if ::core::matches!(
1326                    message.header().flexibility(),
1327                    ::fidl_next::protocol::Flexibility::Strict
1328                ) {
1329                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1330                } else {
1331                    Ok(())
1332                }
1333            }
1334        }
1335    }
1336}
1337
1338/// A server handler for the Domain protocol.
1339///
1340/// See [`Domain`] for more details.
1341pub trait DomainServerHandler<
1342    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1343    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1344>
1345{
1346    #[doc = " Enable the power domain.\n"]
1347    fn enable(
1348        &mut self,
1349
1350        responder: ::fidl_next::Responder<domain::Enable, ___T>,
1351    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1352
1353    #[doc = " Disable the power domain.\n"]
1354    fn disable(
1355        &mut self,
1356
1357        responder: ::fidl_next::Responder<domain::Disable, ___T>,
1358    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1359
1360    #[doc = " Returns `true` if the power domain is enabled.\n"]
1361    fn is_enabled(
1362        &mut self,
1363
1364        responder: ::fidl_next::Responder<domain::IsEnabled, ___T>,
1365    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1366
1367    fn on_unknown_interaction(
1368        &mut self,
1369        ordinal: u64,
1370    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1371        ::core::future::ready(())
1372    }
1373}
1374
1375impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Domain
1376where
1377    ___H: DomainServerHandler<___T> + ::core::marker::Send,
1378    ___T: ::fidl_next::Transport,
1379{
1380    async fn on_one_way(
1381        handler: &mut ___H,
1382        mut message: ::fidl_next::Message<___T>,
1383    ) -> ::core::result::Result<
1384        (),
1385        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1386    > {
1387        match *message.header().ordinal {
1388            ordinal => {
1389                handler.on_unknown_interaction(ordinal).await;
1390                if ::core::matches!(
1391                    message.header().flexibility(),
1392                    ::fidl_next::protocol::Flexibility::Strict
1393                ) {
1394                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1395                } else {
1396                    Ok(())
1397                }
1398            }
1399        }
1400    }
1401
1402    async fn on_two_way(
1403        handler: &mut ___H,
1404        mut message: ::fidl_next::Message<___T>,
1405        responder: ::fidl_next::protocol::Responder<___T>,
1406    ) -> ::core::result::Result<
1407        (),
1408        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1409    > {
1410        match *message.header().ordinal {
1411            2070181937608286071 => {
1412                let responder = ::fidl_next::Responder::from_untyped(responder);
1413
1414                handler.enable(responder).await;
1415                Ok(())
1416            }
1417
1418            764136726546827899 => {
1419                let responder = ::fidl_next::Responder::from_untyped(responder);
1420
1421                handler.disable(responder).await;
1422                Ok(())
1423            }
1424
1425            6531400635744256917 => {
1426                let responder = ::fidl_next::Responder::from_untyped(responder);
1427
1428                handler.is_enabled(responder).await;
1429                Ok(())
1430            }
1431
1432            ordinal => {
1433                handler.on_unknown_interaction(ordinal).await;
1434                if ::core::matches!(
1435                    message.header().flexibility(),
1436                    ::fidl_next::protocol::Flexibility::Strict
1437                ) {
1438                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1439                } else {
1440                    responder
1441                        .respond_framework_error(
1442                            ordinal,
1443                            ::fidl_next::FrameworkError::UnknownMethod,
1444                        )
1445                        .expect("encoding a framework error should never fail")
1446                        .await?;
1447                    Ok(())
1448                }
1449            }
1450        }
1451    }
1452}
1453
1454impl<___T> DomainClientHandler<___T> for ::fidl_next::IgnoreEvents
1455where
1456    ___T: ::fidl_next::Transport,
1457{
1458    async fn on_unknown_interaction(&mut self, _: u64) {}
1459}
1460
1461impl<___H, ___T> DomainLocalClientHandler<___T> for ::fidl_next::Local<___H>
1462where
1463    ___H: DomainClientHandler<___T>,
1464    ___T: ::fidl_next::Transport,
1465{
1466    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1467        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1468    }
1469}
1470
1471impl<___H, ___T> DomainLocalServerHandler<___T> for ::fidl_next::Local<___H>
1472where
1473    ___H: DomainServerHandler<___T>,
1474    ___T: ::fidl_next::Transport,
1475{
1476    async fn enable(&mut self, responder: ::fidl_next::Responder<domain::Enable, ___T>) {
1477        ___H::enable(&mut self.0, responder).await
1478    }
1479
1480    async fn disable(&mut self, responder: ::fidl_next::Responder<domain::Disable, ___T>) {
1481        ___H::disable(&mut self.0, responder).await
1482    }
1483
1484    async fn is_enabled(&mut self, responder: ::fidl_next::Responder<domain::IsEnabled, ___T>) {
1485        ___H::is_enabled(&mut self.0, responder).await
1486    }
1487
1488    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1489        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1490    }
1491}