Skip to main content

fidl_next_fuchsia_power_system/
fidl_next_fuchsia_power_system.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_power_system::natural::*;
8
9    pub type LeaseToken = ::fidl_next::fuchsia::zx::EventPair;
10
11    #[derive(Debug, PartialEq)]
12    #[repr(C)]
13    pub struct ActivityGovernorAcquireWakeLeaseResponse {
14        pub token: ::fidl_next::fuchsia::zx::EventPair,
15    }
16
17    unsafe impl<___E>
18        ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>
19        for ActivityGovernorAcquireWakeLeaseResponse
20    where
21        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
22        ___E: ::fidl_next::fuchsia::HandleEncoder,
23    {
24        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
25            Self,
26            crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
27        > = unsafe {
28            ::fidl_next::CopyOptimization::enable_if(
29                true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
30                    ::fidl_next::wire::fuchsia::EventPair,
31                    ___E,
32                >>::COPY_OPTIMIZATION
33                    .is_enabled(),
34            )
35        };
36
37        #[inline]
38        fn encode(
39            self,
40            encoder_: &mut ___E,
41            out_: &mut ::core::mem::MaybeUninit<
42                crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
43            >,
44            _: (),
45        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
46            ::fidl_next::munge! {
47                let crate::wire::ActivityGovernorAcquireWakeLeaseResponse {
48                    token,
49
50                } = out_;
51            }
52
53            ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
54
55            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
56
57            Ok(())
58        }
59    }
60
61    unsafe impl<___E>
62        ::fidl_next::EncodeOption<
63            ::fidl_next::wire::Box<'static, crate::wire::ActivityGovernorAcquireWakeLeaseResponse>,
64            ___E,
65        > for ActivityGovernorAcquireWakeLeaseResponse
66    where
67        ___E: ::fidl_next::Encoder + ?Sized,
68        ActivityGovernorAcquireWakeLeaseResponse:
69            ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>,
70    {
71        #[inline]
72        fn encode_option(
73            this: ::core::option::Option<Self>,
74            encoder: &mut ___E,
75            out: &mut ::core::mem::MaybeUninit<
76                ::fidl_next::wire::Box<
77                    'static,
78                    crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
79                >,
80            >,
81            _: (),
82        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
83            if let Some(inner) = this {
84                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
85                ::fidl_next::wire::Box::encode_present(out);
86            } else {
87                ::fidl_next::wire::Box::encode_absent(out);
88            }
89
90            Ok(())
91        }
92    }
93
94    impl ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireWakeLeaseResponse>
95        for ActivityGovernorAcquireWakeLeaseResponse
96    {
97        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
98            crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
99            Self,
100        > = unsafe {
101            ::fidl_next::CopyOptimization::enable_if(
102                true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
103                    ::fidl_next::wire::fuchsia::EventPair,
104                >>::COPY_OPTIMIZATION
105                    .is_enabled(),
106            )
107        };
108
109        #[inline]
110        fn from_wire(wire: crate::wire::ActivityGovernorAcquireWakeLeaseResponse) -> Self {
111            Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
112        }
113    }
114
115    #[derive(Debug, Default, PartialEq)]
116    pub struct ActivityGovernorRegisterSuspendBlockerRequest {
117        pub suspend_blocker: ::core::option::Option<
118            ::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::fuchsia::zx::Channel>,
119        >,
120
121        pub name: ::core::option::Option<::std::string::String>,
122    }
123
124    impl ActivityGovernorRegisterSuspendBlockerRequest {
125        fn __max_ordinal(&self) -> usize {
126            if self.name.is_some() {
127                return 2;
128            }
129
130            if self.suspend_blocker.is_some() {
131                return 1;
132            }
133
134            0
135        }
136    }
137
138    unsafe impl<___E>
139        ::fidl_next::Encode<
140            crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>,
141            ___E,
142        > for ActivityGovernorRegisterSuspendBlockerRequest
143    where
144        ___E: ::fidl_next::Encoder + ?Sized,
145        ___E: ::fidl_next::fuchsia::HandleEncoder,
146    {
147        #[inline]
148        fn encode(
149            mut self,
150            encoder: &mut ___E,
151            out: &mut ::core::mem::MaybeUninit<
152                crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>,
153            >,
154            _: (),
155        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
156            ::fidl_next::munge!(let crate::wire::ActivityGovernorRegisterSuspendBlockerRequest { table } = out);
157
158            let max_ord = self.__max_ordinal();
159
160            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
161            ::fidl_next::Wire::zero_padding(&mut out);
162
163            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
164                ::fidl_next::wire::Envelope,
165            >(encoder, max_ord);
166
167            for i in 1..=max_ord {
168                match i {
169                    2 => {
170                        if let Some(value) = self.name.take() {
171                            ::fidl_next::wire::Envelope::encode_value::<
172                                ::fidl_next::wire::String<'static>,
173                                ___E,
174                            >(
175                                value, preallocated.encoder, &mut out, 64
176                            )?;
177                        } else {
178                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
179                        }
180                    }
181
182                    1 => {
183                        if let Some(value) = self.suspend_blocker.take() {
184                            ::fidl_next::wire::Envelope::encode_value::<
185                                ::fidl_next::ClientEnd<
186                                    crate::SuspendBlocker,
187                                    ::fidl_next::wire::fuchsia::Channel,
188                                >,
189                                ___E,
190                            >(
191                                value, preallocated.encoder, &mut out, ()
192                            )?;
193                        } else {
194                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
195                        }
196                    }
197
198                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
199                }
200                unsafe {
201                    preallocated.write_next(out.assume_init_ref());
202                }
203            }
204
205            ::fidl_next::wire::Table::encode_len(table, max_ord);
206
207            Ok(())
208        }
209    }
210
211    impl<'de> ::fidl_next::FromWire<crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>>
212        for ActivityGovernorRegisterSuspendBlockerRequest
213    {
214        #[inline]
215        fn from_wire(
216            wire_: crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>,
217        ) -> Self {
218            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
219
220            let suspend_blocker = wire_.table.get(1);
221
222            let name = wire_.table.get(2);
223
224            Self {
225                suspend_blocker: suspend_blocker.map(|envelope| {
226                    ::fidl_next::FromWire::from_wire(unsafe {
227                        envelope.read_unchecked::<::fidl_next::ClientEnd<
228                            crate::SuspendBlocker,
229                            ::fidl_next::wire::fuchsia::Channel,
230                        >>()
231                    })
232                }),
233
234                name: name.map(|envelope| {
235                    ::fidl_next::FromWire::from_wire(unsafe {
236                        envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
237                    })
238                }),
239            }
240        }
241    }
242
243    #[derive(Debug, PartialEq)]
244    #[repr(C)]
245    pub struct ActivityGovernorRegisterSuspendBlockerResponse {
246        pub token: ::fidl_next::fuchsia::zx::EventPair,
247    }
248
249    unsafe impl<___E>
250        ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>
251        for ActivityGovernorRegisterSuspendBlockerResponse
252    where
253        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
254        ___E: ::fidl_next::fuchsia::HandleEncoder,
255    {
256        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
257            Self,
258            crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
259        > = unsafe {
260            ::fidl_next::CopyOptimization::enable_if(
261                true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
262                    ::fidl_next::wire::fuchsia::EventPair,
263                    ___E,
264                >>::COPY_OPTIMIZATION
265                    .is_enabled(),
266            )
267        };
268
269        #[inline]
270        fn encode(
271            self,
272            encoder_: &mut ___E,
273            out_: &mut ::core::mem::MaybeUninit<
274                crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
275            >,
276            _: (),
277        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
278            ::fidl_next::munge! {
279                let crate::wire::ActivityGovernorRegisterSuspendBlockerResponse {
280                    token,
281
282                } = out_;
283            }
284
285            ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
286
287            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
288
289            Ok(())
290        }
291    }
292
293    unsafe impl<___E>
294        ::fidl_next::EncodeOption<
295            ::fidl_next::wire::Box<
296                'static,
297                crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
298            >,
299            ___E,
300        > for ActivityGovernorRegisterSuspendBlockerResponse
301    where
302        ___E: ::fidl_next::Encoder + ?Sized,
303        ActivityGovernorRegisterSuspendBlockerResponse:
304            ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>,
305    {
306        #[inline]
307        fn encode_option(
308            this: ::core::option::Option<Self>,
309            encoder: &mut ___E,
310            out: &mut ::core::mem::MaybeUninit<
311                ::fidl_next::wire::Box<
312                    'static,
313                    crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
314                >,
315            >,
316            _: (),
317        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
318            if let Some(inner) = this {
319                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
320                ::fidl_next::wire::Box::encode_present(out);
321            } else {
322                ::fidl_next::wire::Box::encode_absent(out);
323            }
324
325            Ok(())
326        }
327    }
328
329    impl ::fidl_next::FromWire<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse>
330        for ActivityGovernorRegisterSuspendBlockerResponse
331    {
332        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
333            crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
334            Self,
335        > = unsafe {
336            ::fidl_next::CopyOptimization::enable_if(
337                true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
338                    ::fidl_next::wire::fuchsia::EventPair,
339                >>::COPY_OPTIMIZATION
340                    .is_enabled(),
341            )
342        };
343
344        #[inline]
345        fn from_wire(wire: crate::wire::ActivityGovernorRegisterSuspendBlockerResponse) -> Self {
346            Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
347        }
348    }
349
350    #[doc = " Holds tokens to the application activity power element.\n\n [`fuchsia.power.system/ApplicationActivityLevel`] defines the power levels supported by this power element.\n"]
351    #[derive(Debug, Default, PartialEq)]
352    pub struct ApplicationActivity {
353        pub assertive_dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
354    }
355
356    impl ApplicationActivity {
357        fn __max_ordinal(&self) -> usize {
358            if self.assertive_dependency_token.is_some() {
359                return 1;
360            }
361
362            0
363        }
364    }
365
366    unsafe impl<___E> ::fidl_next::Encode<crate::wire::ApplicationActivity<'static>, ___E>
367        for ApplicationActivity
368    where
369        ___E: ::fidl_next::Encoder + ?Sized,
370        ___E: ::fidl_next::fuchsia::HandleEncoder,
371    {
372        #[inline]
373        fn encode(
374            mut self,
375            encoder: &mut ___E,
376            out: &mut ::core::mem::MaybeUninit<crate::wire::ApplicationActivity<'static>>,
377            _: (),
378        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
379            ::fidl_next::munge!(let crate::wire::ApplicationActivity { table } = out);
380
381            let max_ord = self.__max_ordinal();
382
383            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
384            ::fidl_next::Wire::zero_padding(&mut out);
385
386            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
387                ::fidl_next::wire::Envelope,
388            >(encoder, max_ord);
389
390            for i in 1..=max_ord {
391                match i {
392                    1 => {
393                        if let Some(value) = self.assertive_dependency_token.take() {
394                            ::fidl_next::wire::Envelope::encode_value::<
395                                ::fidl_next::wire::fuchsia::Event,
396                                ___E,
397                            >(
398                                value, preallocated.encoder, &mut out, ()
399                            )?;
400                        } else {
401                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
402                        }
403                    }
404
405                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
406                }
407                unsafe {
408                    preallocated.write_next(out.assume_init_ref());
409                }
410            }
411
412            ::fidl_next::wire::Table::encode_len(table, max_ord);
413
414            Ok(())
415        }
416    }
417
418    impl<'de> ::fidl_next::FromWire<crate::wire::ApplicationActivity<'de>> for ApplicationActivity {
419        #[inline]
420        fn from_wire(wire_: crate::wire::ApplicationActivity<'de>) -> Self {
421            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
422
423            let assertive_dependency_token = wire_.table.get(1);
424
425            Self {
426                assertive_dependency_token: assertive_dependency_token.map(|envelope| {
427                    ::fidl_next::FromWire::from_wire(unsafe {
428                        envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
429                    })
430                }),
431            }
432        }
433    }
434
435    #[doc = " A collection of power elements that are managed by the activity governor.\n"]
436    #[derive(Debug, Default, PartialEq)]
437    pub struct PowerElements {
438        pub application_activity: ::core::option::Option<crate::natural::ApplicationActivity>,
439    }
440
441    impl PowerElements {
442        fn __max_ordinal(&self) -> usize {
443            if self.application_activity.is_some() {
444                return 3;
445            }
446
447            0
448        }
449    }
450
451    unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerElements<'static>, ___E> for PowerElements
452    where
453        ___E: ::fidl_next::Encoder + ?Sized,
454        ___E: ::fidl_next::fuchsia::HandleEncoder,
455    {
456        #[inline]
457        fn encode(
458            mut self,
459            encoder: &mut ___E,
460            out: &mut ::core::mem::MaybeUninit<crate::wire::PowerElements<'static>>,
461            _: (),
462        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
463            ::fidl_next::munge!(let crate::wire::PowerElements { table } = out);
464
465            let max_ord = self.__max_ordinal();
466
467            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
468            ::fidl_next::Wire::zero_padding(&mut out);
469
470            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
471                ::fidl_next::wire::Envelope,
472            >(encoder, max_ord);
473
474            for i in 1..=max_ord {
475                match i {
476                    3 => {
477                        if let Some(value) = self.application_activity.take() {
478                            ::fidl_next::wire::Envelope::encode_value::<
479                                crate::wire::ApplicationActivity<'static>,
480                                ___E,
481                            >(
482                                value, preallocated.encoder, &mut out, ()
483                            )?;
484                        } else {
485                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
486                        }
487                    }
488
489                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
490                }
491                unsafe {
492                    preallocated.write_next(out.assume_init_ref());
493                }
494            }
495
496            ::fidl_next::wire::Table::encode_len(table, max_ord);
497
498            Ok(())
499        }
500    }
501
502    impl<'de> ::fidl_next::FromWire<crate::wire::PowerElements<'de>> for PowerElements {
503        #[inline]
504        fn from_wire(wire_: crate::wire::PowerElements<'de>) -> Self {
505            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
506
507            let application_activity = wire_.table.get(3);
508
509            Self {
510                application_activity: application_activity.map(|envelope| {
511                    ::fidl_next::FromWire::from_wire(unsafe {
512                        envelope.read_unchecked::<crate::wire::ApplicationActivity<'de>>()
513                    })
514                }),
515            }
516        }
517    }
518
519    #[derive(Debug, PartialEq)]
520    #[repr(C)]
521    pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
522        pub token: ::fidl_next::fuchsia::zx::EventPair,
523    }
524
525    unsafe impl<___E>
526        ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, ___E>
527        for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
528    where
529        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
530        ___E: ::fidl_next::fuchsia::HandleEncoder,
531    {
532        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
533            Self,
534            crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
535        > = unsafe {
536            ::fidl_next::CopyOptimization::enable_if(
537                true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
538                    ::fidl_next::wire::fuchsia::EventPair,
539                    ___E,
540                >>::COPY_OPTIMIZATION
541                    .is_enabled(),
542            )
543        };
544
545        #[inline]
546        fn encode(
547            self,
548            encoder_: &mut ___E,
549            out_: &mut ::core::mem::MaybeUninit<
550                crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
551            >,
552            _: (),
553        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
554            ::fidl_next::munge! {
555                let crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
556                    token,
557
558                } = out_;
559            }
560
561            ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
562
563            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
564
565            Ok(())
566        }
567    }
568
569    unsafe impl<___E>
570        ::fidl_next::EncodeOption<
571            ::fidl_next::wire::Box<
572                'static,
573                crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
574            >,
575            ___E,
576        > for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
577    where
578        ___E: ::fidl_next::Encoder + ?Sized,
579        ActivityGovernorAcquireUnmonitoredWakeLeaseResponse: ::fidl_next::Encode<
580                crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
581                ___E,
582            >,
583    {
584        #[inline]
585        fn encode_option(
586            this: ::core::option::Option<Self>,
587            encoder: &mut ___E,
588            out: &mut ::core::mem::MaybeUninit<
589                ::fidl_next::wire::Box<
590                    'static,
591                    crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
592                >,
593            >,
594            _: (),
595        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
596            if let Some(inner) = this {
597                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
598                ::fidl_next::wire::Box::encode_present(out);
599            } else {
600                ::fidl_next::wire::Box::encode_absent(out);
601            }
602
603            Ok(())
604        }
605    }
606
607    impl ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse>
608        for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
609    {
610        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
611            crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
612            Self,
613        > = unsafe {
614            ::fidl_next::CopyOptimization::enable_if(
615                true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
616                    ::fidl_next::wire::fuchsia::EventPair,
617                >>::COPY_OPTIMIZATION
618                    .is_enabled(),
619            )
620        };
621
622        #[inline]
623        fn from_wire(
624            wire: crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
625        ) -> Self {
626            Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
627        }
628    }
629
630    #[derive(Debug, PartialEq)]
631    pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest {
632        pub name: ::std::string::String,
633
634        pub server_token: ::fidl_next::fuchsia::zx::EventPair,
635    }
636
637    unsafe impl<___E>
638        ::fidl_next::Encode<
639            crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
640            ___E,
641        > for ActivityGovernorAcquireWakeLeaseWithTokenRequest
642    where
643        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
644        ___E: ::fidl_next::Encoder,
645        ___E: ::fidl_next::fuchsia::HandleEncoder,
646    {
647        #[inline]
648        fn encode(
649            self,
650            encoder_: &mut ___E,
651            out_: &mut ::core::mem::MaybeUninit<
652                crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
653            >,
654            _: (),
655        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
656            ::fidl_next::munge! {
657                let crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
658                    name,
659                    server_token,
660
661                } = out_;
662            }
663
664            ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
665
666            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(name.as_mut_ptr()) };
667            ::fidl_next::Constrained::validate(_field, 64)?;
668
669            ::fidl_next::Encode::encode(self.server_token, encoder_, server_token, ())?;
670
671            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(server_token.as_mut_ptr()) };
672
673            Ok(())
674        }
675    }
676
677    unsafe impl<___E>
678        ::fidl_next::EncodeOption<
679            ::fidl_next::wire::Box<
680                'static,
681                crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
682            >,
683            ___E,
684        > for ActivityGovernorAcquireWakeLeaseWithTokenRequest
685    where
686        ___E: ::fidl_next::Encoder + ?Sized,
687        ActivityGovernorAcquireWakeLeaseWithTokenRequest: ::fidl_next::Encode<
688                crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
689                ___E,
690            >,
691    {
692        #[inline]
693        fn encode_option(
694            this: ::core::option::Option<Self>,
695            encoder: &mut ___E,
696            out: &mut ::core::mem::MaybeUninit<
697                ::fidl_next::wire::Box<
698                    'static,
699                    crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
700                >,
701            >,
702            _: (),
703        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
704            if let Some(inner) = this {
705                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
706                ::fidl_next::wire::Box::encode_present(out);
707            } else {
708                ::fidl_next::wire::Box::encode_absent(out);
709            }
710
711            Ok(())
712        }
713    }
714
715    impl<'de>
716        ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>>
717        for ActivityGovernorAcquireWakeLeaseWithTokenRequest
718    {
719        #[inline]
720        fn from_wire(
721            wire: crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>,
722        ) -> Self {
723            Self {
724                name: ::fidl_next::FromWire::from_wire(wire.name),
725
726                server_token: ::fidl_next::FromWire::from_wire(wire.server_token),
727            }
728        }
729    }
730
731    #[derive(Debug, PartialEq)]
732    #[repr(C)]
733    pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
734        pub token: ::fidl_next::fuchsia::zx::EventPair,
735    }
736
737    unsafe impl<___E>
738        ::fidl_next::Encode<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse, ___E>
739        for ActivityGovernorTakeApplicationActivityLeaseResponse
740    where
741        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
742        ___E: ::fidl_next::fuchsia::HandleEncoder,
743    {
744        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
745            Self,
746            crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
747        > = unsafe {
748            ::fidl_next::CopyOptimization::enable_if(
749                true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
750                    ::fidl_next::wire::fuchsia::EventPair,
751                    ___E,
752                >>::COPY_OPTIMIZATION
753                    .is_enabled(),
754            )
755        };
756
757        #[inline]
758        fn encode(
759            self,
760            encoder_: &mut ___E,
761            out_: &mut ::core::mem::MaybeUninit<
762                crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
763            >,
764            _: (),
765        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
766            ::fidl_next::munge! {
767                let crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse {
768                    token,
769
770                } = out_;
771            }
772
773            ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
774
775            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
776
777            Ok(())
778        }
779    }
780
781    unsafe impl<___E>
782        ::fidl_next::EncodeOption<
783            ::fidl_next::wire::Box<
784                'static,
785                crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
786            >,
787            ___E,
788        > for ActivityGovernorTakeApplicationActivityLeaseResponse
789    where
790        ___E: ::fidl_next::Encoder + ?Sized,
791        ActivityGovernorTakeApplicationActivityLeaseResponse: ::fidl_next::Encode<
792                crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
793                ___E,
794            >,
795    {
796        #[inline]
797        fn encode_option(
798            this: ::core::option::Option<Self>,
799            encoder: &mut ___E,
800            out: &mut ::core::mem::MaybeUninit<
801                ::fidl_next::wire::Box<
802                    'static,
803                    crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
804                >,
805            >,
806            _: (),
807        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
808            if let Some(inner) = this {
809                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
810                ::fidl_next::wire::Box::encode_present(out);
811            } else {
812                ::fidl_next::wire::Box::encode_absent(out);
813            }
814
815            Ok(())
816        }
817    }
818
819    impl ::fidl_next::FromWire<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse>
820        for ActivityGovernorTakeApplicationActivityLeaseResponse
821    {
822        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
823            crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
824            Self,
825        > = unsafe {
826            ::fidl_next::CopyOptimization::enable_if(
827                true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
828                    ::fidl_next::wire::fuchsia::EventPair,
829                >>::COPY_OPTIMIZATION
830                    .is_enabled(),
831            )
832        };
833
834        #[inline]
835        fn from_wire(
836            wire: crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
837        ) -> Self {
838            Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
839        }
840    }
841
842    #[doc = " Holds tokens to the CPU power element.\n\n [`fuchsia.power.system/CpuLevel`] defines the power levels supported by this power element.\n"]
843    #[derive(Debug, Default, PartialEq)]
844    pub struct Cpu {
845        pub assertive_dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
846    }
847
848    impl Cpu {
849        fn __max_ordinal(&self) -> usize {
850            if self.assertive_dependency_token.is_some() {
851                return 1;
852            }
853
854            0
855        }
856    }
857
858    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Cpu<'static>, ___E> for Cpu
859    where
860        ___E: ::fidl_next::Encoder + ?Sized,
861        ___E: ::fidl_next::fuchsia::HandleEncoder,
862    {
863        #[inline]
864        fn encode(
865            mut self,
866            encoder: &mut ___E,
867            out: &mut ::core::mem::MaybeUninit<crate::wire::Cpu<'static>>,
868            _: (),
869        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
870            ::fidl_next::munge!(let crate::wire::Cpu { table } = out);
871
872            let max_ord = self.__max_ordinal();
873
874            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
875            ::fidl_next::Wire::zero_padding(&mut out);
876
877            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
878                ::fidl_next::wire::Envelope,
879            >(encoder, max_ord);
880
881            for i in 1..=max_ord {
882                match i {
883                    1 => {
884                        if let Some(value) = self.assertive_dependency_token.take() {
885                            ::fidl_next::wire::Envelope::encode_value::<
886                                ::fidl_next::wire::fuchsia::Event,
887                                ___E,
888                            >(
889                                value, preallocated.encoder, &mut out, ()
890                            )?;
891                        } else {
892                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
893                        }
894                    }
895
896                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
897                }
898                unsafe {
899                    preallocated.write_next(out.assume_init_ref());
900                }
901            }
902
903            ::fidl_next::wire::Table::encode_len(table, max_ord);
904
905            Ok(())
906        }
907    }
908
909    impl<'de> ::fidl_next::FromWire<crate::wire::Cpu<'de>> for Cpu {
910        #[inline]
911        fn from_wire(wire_: crate::wire::Cpu<'de>) -> Self {
912            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
913
914            let assertive_dependency_token = wire_.table.get(1);
915
916            Self {
917                assertive_dependency_token: assertive_dependency_token.map(|envelope| {
918                    ::fidl_next::FromWire::from_wire(unsafe {
919                        envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
920                    })
921                }),
922            }
923        }
924    }
925
926    #[derive(Debug, Default, PartialEq)]
927    pub struct CpuElementManagerAddExecutionStateDependencyRequest {
928        pub dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
929
930        pub power_level: ::core::option::Option<u8>,
931    }
932
933    impl CpuElementManagerAddExecutionStateDependencyRequest {
934        fn __max_ordinal(&self) -> usize {
935            if self.power_level.is_some() {
936                return 2;
937            }
938
939            if self.dependency_token.is_some() {
940                return 1;
941            }
942
943            0
944        }
945    }
946
947    unsafe impl<___E>
948        ::fidl_next::Encode<
949            crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
950            ___E,
951        > for CpuElementManagerAddExecutionStateDependencyRequest
952    where
953        ___E: ::fidl_next::Encoder + ?Sized,
954        ___E: ::fidl_next::fuchsia::HandleEncoder,
955    {
956        #[inline]
957        fn encode(
958            mut self,
959            encoder: &mut ___E,
960            out: &mut ::core::mem::MaybeUninit<
961                crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
962            >,
963            _: (),
964        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
965            ::fidl_next::munge!(let crate::wire::CpuElementManagerAddExecutionStateDependencyRequest { table } = out);
966
967            let max_ord = self.__max_ordinal();
968
969            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
970            ::fidl_next::Wire::zero_padding(&mut out);
971
972            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
973                ::fidl_next::wire::Envelope,
974            >(encoder, max_ord);
975
976            for i in 1..=max_ord {
977                match i {
978                    2 => {
979                        if let Some(value) = self.power_level.take() {
980                            ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
981                                value,
982                                preallocated.encoder,
983                                &mut out,
984                                (),
985                            )?;
986                        } else {
987                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
988                        }
989                    }
990
991                    1 => {
992                        if let Some(value) = self.dependency_token.take() {
993                            ::fidl_next::wire::Envelope::encode_value::<
994                                ::fidl_next::wire::fuchsia::Event,
995                                ___E,
996                            >(
997                                value, preallocated.encoder, &mut out, ()
998                            )?;
999                        } else {
1000                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
1001                        }
1002                    }
1003
1004                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1005                }
1006                unsafe {
1007                    preallocated.write_next(out.assume_init_ref());
1008                }
1009            }
1010
1011            ::fidl_next::wire::Table::encode_len(table, max_ord);
1012
1013            Ok(())
1014        }
1015    }
1016
1017    impl<'de>
1018        ::fidl_next::FromWire<crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>>
1019        for CpuElementManagerAddExecutionStateDependencyRequest
1020    {
1021        #[inline]
1022        fn from_wire(
1023            wire_: crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>,
1024        ) -> Self {
1025            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1026
1027            let dependency_token = wire_.table.get(1);
1028
1029            let power_level = wire_.table.get(2);
1030
1031            Self {
1032                dependency_token: dependency_token.map(|envelope| {
1033                    ::fidl_next::FromWire::from_wire(unsafe {
1034                        envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1035                    })
1036                }),
1037
1038                power_level: power_level.map(|envelope| {
1039                    ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
1040                }),
1041            }
1042        }
1043    }
1044}
1045
1046pub mod wire {
1047
1048    pub use fidl_next_common_fuchsia_power_system::wire::*;
1049
1050    /// The wire type corresponding to [`LeaseToken`](crate::natural::LeaseToken).
1051    pub type LeaseToken = ::fidl_next::wire::fuchsia::EventPair;
1052
1053    /// The wire type corresponding to [`ActivityGovernorAcquireWakeLeaseResponse`].
1054    #[derive(Debug)]
1055    #[repr(C)]
1056    pub struct ActivityGovernorAcquireWakeLeaseResponse {
1057        pub token: ::fidl_next::wire::fuchsia::EventPair,
1058    }
1059
1060    static_assertions::const_assert_eq!(
1061        std::mem::size_of::<ActivityGovernorAcquireWakeLeaseResponse>(),
1062        4
1063    );
1064    static_assertions::const_assert_eq!(
1065        std::mem::align_of::<ActivityGovernorAcquireWakeLeaseResponse>(),
1066        4
1067    );
1068
1069    static_assertions::const_assert_eq!(
1070        std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseResponse, token),
1071        0
1072    );
1073
1074    impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLeaseResponse {
1075        type Constraint = ();
1076
1077        fn validate(
1078            _: ::fidl_next::Slot<'_, Self>,
1079            _: Self::Constraint,
1080        ) -> Result<(), ::fidl_next::ValidationError> {
1081            Ok(())
1082        }
1083    }
1084
1085    unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLeaseResponse {
1086        type Narrowed<'de> = ActivityGovernorAcquireWakeLeaseResponse;
1087
1088        #[inline]
1089        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1090            ::fidl_next::munge! {
1091                let Self {
1092                    token,
1093
1094                } = &mut *out_;
1095            }
1096
1097            ::fidl_next::Wire::zero_padding(token);
1098        }
1099    }
1100
1101    unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireWakeLeaseResponse
1102    where
1103        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1104        ___D: ::fidl_next::fuchsia::HandleDecoder,
1105    {
1106        fn decode(
1107            slot_: ::fidl_next::Slot<'_, Self>,
1108            decoder_: &mut ___D,
1109            _: (),
1110        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1111            ::fidl_next::munge! {
1112                let Self {
1113                    mut token,
1114
1115                } = slot_;
1116            }
1117
1118            let _field = token.as_mut();
1119
1120            ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1121
1122            Ok(())
1123        }
1124    }
1125
1126    impl ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLeaseResponse {
1127        type Natural = crate::natural::ActivityGovernorAcquireWakeLeaseResponse;
1128    }
1129
1130    /// The wire type corresponding to [`ActivityGovernorRegisterSuspendBlockerRequest`].
1131    #[repr(C)]
1132    pub struct ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1133        pub(crate) table: ::fidl_next::wire::Table<'de>,
1134    }
1135
1136    impl<'de> Drop for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1137        fn drop(&mut self) {
1138            let _ = self.table.get(1).map(|envelope| unsafe {
1139                envelope.read_unchecked::<::fidl_next::ClientEnd<
1140                    crate::SuspendBlocker,
1141                    ::fidl_next::wire::fuchsia::Channel,
1142                >>()
1143            });
1144
1145            let _ = self.table.get(2).map(|envelope| unsafe {
1146                envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
1147            });
1148        }
1149    }
1150
1151    impl ::fidl_next::Constrained for ActivityGovernorRegisterSuspendBlockerRequest<'_> {
1152        type Constraint = ();
1153
1154        fn validate(
1155            _: ::fidl_next::Slot<'_, Self>,
1156            _: Self::Constraint,
1157        ) -> Result<(), ::fidl_next::ValidationError> {
1158            Ok(())
1159        }
1160    }
1161
1162    unsafe impl ::fidl_next::Wire for ActivityGovernorRegisterSuspendBlockerRequest<'static> {
1163        type Narrowed<'de> = ActivityGovernorRegisterSuspendBlockerRequest<'de>;
1164
1165        #[inline]
1166        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1167            ::fidl_next::munge!(let Self { table } = out);
1168            ::fidl_next::wire::Table::zero_padding(table);
1169        }
1170    }
1171
1172    unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1173        for ActivityGovernorRegisterSuspendBlockerRequest<'de>
1174    where
1175        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1176        ___D: ::fidl_next::fuchsia::HandleDecoder,
1177    {
1178        fn decode(
1179            slot: ::fidl_next::Slot<'_, Self>,
1180            decoder: &mut ___D,
1181            _: (),
1182        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1183            ::fidl_next::munge!(let Self { table } = slot);
1184
1185            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1186                match ordinal {
1187                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1188
1189                    1 => {
1190                        ::fidl_next::wire::Envelope::decode_as::<
1191                            ___D,
1192                            ::fidl_next::ClientEnd<
1193                                crate::SuspendBlocker,
1194                                ::fidl_next::wire::fuchsia::Channel,
1195                            >,
1196                        >(slot.as_mut(), decoder, ())?;
1197
1198                        Ok(())
1199                    }
1200
1201                    2 => {
1202                        ::fidl_next::wire::Envelope::decode_as::<
1203                            ___D,
1204                            ::fidl_next::wire::String<'de>,
1205                        >(slot.as_mut(), decoder, 64)?;
1206
1207                        let value = unsafe {
1208                            slot.deref_unchecked()
1209                                .deref_unchecked::<::fidl_next::wire::String<'_>>()
1210                        };
1211
1212                        if value.len() > 64 {
1213                            return Err(::fidl_next::DecodeError::VectorTooLong {
1214                                size: value.len() as u64,
1215                                limit: 64,
1216                            });
1217                        }
1218
1219                        Ok(())
1220                    }
1221
1222                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1223                }
1224            })
1225        }
1226    }
1227
1228    impl<'de> ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1229        pub fn suspend_blocker(
1230            &self,
1231        ) -> ::core::option::Option<
1232            &::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::wire::fuchsia::Channel>,
1233        > {
1234            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1235        }
1236
1237        pub fn take_suspend_blocker(
1238            &mut self,
1239        ) -> ::core::option::Option<
1240            ::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::wire::fuchsia::Channel>,
1241        > {
1242            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1243        }
1244
1245        pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
1246            unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1247        }
1248
1249        pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
1250            unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
1251        }
1252    }
1253
1254    impl<'de> ::core::fmt::Debug for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1255        fn fmt(
1256            &self,
1257            f: &mut ::core::fmt::Formatter<'_>,
1258        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1259            f.debug_struct("ActivityGovernorRegisterSuspendBlockerRequest")
1260                .field("suspend_blocker", &self.suspend_blocker())
1261                .field("name", &self.name())
1262                .finish()
1263        }
1264    }
1265
1266    impl<'de> ::fidl_next::IntoNatural for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1267        type Natural = crate::natural::ActivityGovernorRegisterSuspendBlockerRequest;
1268    }
1269
1270    /// The wire type corresponding to [`ActivityGovernorRegisterSuspendBlockerResponse`].
1271    #[derive(Debug)]
1272    #[repr(C)]
1273    pub struct ActivityGovernorRegisterSuspendBlockerResponse {
1274        pub token: ::fidl_next::wire::fuchsia::EventPair,
1275    }
1276
1277    static_assertions::const_assert_eq!(
1278        std::mem::size_of::<ActivityGovernorRegisterSuspendBlockerResponse>(),
1279        4
1280    );
1281    static_assertions::const_assert_eq!(
1282        std::mem::align_of::<ActivityGovernorRegisterSuspendBlockerResponse>(),
1283        4
1284    );
1285
1286    static_assertions::const_assert_eq!(
1287        std::mem::offset_of!(ActivityGovernorRegisterSuspendBlockerResponse, token),
1288        0
1289    );
1290
1291    impl ::fidl_next::Constrained for ActivityGovernorRegisterSuspendBlockerResponse {
1292        type Constraint = ();
1293
1294        fn validate(
1295            _: ::fidl_next::Slot<'_, Self>,
1296            _: Self::Constraint,
1297        ) -> Result<(), ::fidl_next::ValidationError> {
1298            Ok(())
1299        }
1300    }
1301
1302    unsafe impl ::fidl_next::Wire for ActivityGovernorRegisterSuspendBlockerResponse {
1303        type Narrowed<'de> = ActivityGovernorRegisterSuspendBlockerResponse;
1304
1305        #[inline]
1306        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1307            ::fidl_next::munge! {
1308                let Self {
1309                    token,
1310
1311                } = &mut *out_;
1312            }
1313
1314            ::fidl_next::Wire::zero_padding(token);
1315        }
1316    }
1317
1318    unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorRegisterSuspendBlockerResponse
1319    where
1320        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1321        ___D: ::fidl_next::fuchsia::HandleDecoder,
1322    {
1323        fn decode(
1324            slot_: ::fidl_next::Slot<'_, Self>,
1325            decoder_: &mut ___D,
1326            _: (),
1327        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1328            ::fidl_next::munge! {
1329                let Self {
1330                    mut token,
1331
1332                } = slot_;
1333            }
1334
1335            let _field = token.as_mut();
1336
1337            ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1338
1339            Ok(())
1340        }
1341    }
1342
1343    impl ::fidl_next::IntoNatural for ActivityGovernorRegisterSuspendBlockerResponse {
1344        type Natural = crate::natural::ActivityGovernorRegisterSuspendBlockerResponse;
1345    }
1346
1347    /// The wire type corresponding to [`ApplicationActivity`].
1348    #[repr(C)]
1349    pub struct ApplicationActivity<'de> {
1350        pub(crate) table: ::fidl_next::wire::Table<'de>,
1351    }
1352
1353    impl<'de> Drop for ApplicationActivity<'de> {
1354        fn drop(&mut self) {
1355            let _ = self.table.get(1).map(|envelope| unsafe {
1356                envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1357            });
1358        }
1359    }
1360
1361    impl ::fidl_next::Constrained for ApplicationActivity<'_> {
1362        type Constraint = ();
1363
1364        fn validate(
1365            _: ::fidl_next::Slot<'_, Self>,
1366            _: Self::Constraint,
1367        ) -> Result<(), ::fidl_next::ValidationError> {
1368            Ok(())
1369        }
1370    }
1371
1372    unsafe impl ::fidl_next::Wire for ApplicationActivity<'static> {
1373        type Narrowed<'de> = ApplicationActivity<'de>;
1374
1375        #[inline]
1376        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1377            ::fidl_next::munge!(let Self { table } = out);
1378            ::fidl_next::wire::Table::zero_padding(table);
1379        }
1380    }
1381
1382    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ApplicationActivity<'de>
1383    where
1384        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1385        ___D: ::fidl_next::fuchsia::HandleDecoder,
1386    {
1387        fn decode(
1388            slot: ::fidl_next::Slot<'_, Self>,
1389            decoder: &mut ___D,
1390            _: (),
1391        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1392            ::fidl_next::munge!(let Self { table } = slot);
1393
1394            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1395                match ordinal {
1396                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1397
1398                    1 => {
1399                        ::fidl_next::wire::Envelope::decode_as::<
1400                            ___D,
1401                            ::fidl_next::wire::fuchsia::Event,
1402                        >(slot.as_mut(), decoder, ())?;
1403
1404                        Ok(())
1405                    }
1406
1407                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1408                }
1409            })
1410        }
1411    }
1412
1413    impl<'de> ApplicationActivity<'de> {
1414        pub fn assertive_dependency_token(
1415            &self,
1416        ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
1417            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1418        }
1419
1420        pub fn take_assertive_dependency_token(
1421            &mut self,
1422        ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
1423            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1424        }
1425    }
1426
1427    impl<'de> ::core::fmt::Debug for ApplicationActivity<'de> {
1428        fn fmt(
1429            &self,
1430            f: &mut ::core::fmt::Formatter<'_>,
1431        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1432            f.debug_struct("ApplicationActivity")
1433                .field("assertive_dependency_token", &self.assertive_dependency_token())
1434                .finish()
1435        }
1436    }
1437
1438    impl<'de> ::fidl_next::IntoNatural for ApplicationActivity<'de> {
1439        type Natural = crate::natural::ApplicationActivity;
1440    }
1441
1442    /// The wire type corresponding to [`PowerElements`].
1443    #[repr(C)]
1444    pub struct PowerElements<'de> {
1445        pub(crate) table: ::fidl_next::wire::Table<'de>,
1446    }
1447
1448    impl<'de> Drop for PowerElements<'de> {
1449        fn drop(&mut self) {
1450            let _ = self.table.get(3).map(|envelope| unsafe {
1451                envelope.read_unchecked::<crate::wire::ApplicationActivity<'de>>()
1452            });
1453        }
1454    }
1455
1456    impl ::fidl_next::Constrained for PowerElements<'_> {
1457        type Constraint = ();
1458
1459        fn validate(
1460            _: ::fidl_next::Slot<'_, Self>,
1461            _: Self::Constraint,
1462        ) -> Result<(), ::fidl_next::ValidationError> {
1463            Ok(())
1464        }
1465    }
1466
1467    unsafe impl ::fidl_next::Wire for PowerElements<'static> {
1468        type Narrowed<'de> = PowerElements<'de>;
1469
1470        #[inline]
1471        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1472            ::fidl_next::munge!(let Self { table } = out);
1473            ::fidl_next::wire::Table::zero_padding(table);
1474        }
1475    }
1476
1477    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElements<'de>
1478    where
1479        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1480        ___D: ::fidl_next::fuchsia::HandleDecoder,
1481    {
1482        fn decode(
1483            slot: ::fidl_next::Slot<'_, Self>,
1484            decoder: &mut ___D,
1485            _: (),
1486        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1487            ::fidl_next::munge!(let Self { table } = slot);
1488
1489            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1490                match ordinal {
1491                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1492
1493                    3 => {
1494                        ::fidl_next::wire::Envelope::decode_as::<
1495                            ___D,
1496                            crate::wire::ApplicationActivity<'de>,
1497                        >(slot.as_mut(), decoder, ())?;
1498
1499                        Ok(())
1500                    }
1501
1502                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1503                }
1504            })
1505        }
1506    }
1507
1508    impl<'de> PowerElements<'de> {
1509        pub fn application_activity(
1510            &self,
1511        ) -> ::core::option::Option<&crate::wire::ApplicationActivity<'de>> {
1512            unsafe { Some(self.table.get(3)?.deref_unchecked()) }
1513        }
1514
1515        pub fn take_application_activity(
1516            &mut self,
1517        ) -> ::core::option::Option<crate::wire::ApplicationActivity<'de>> {
1518            unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
1519        }
1520    }
1521
1522    impl<'de> ::core::fmt::Debug for PowerElements<'de> {
1523        fn fmt(
1524            &self,
1525            f: &mut ::core::fmt::Formatter<'_>,
1526        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1527            f.debug_struct("PowerElements")
1528                .field("application_activity", &self.application_activity())
1529                .finish()
1530        }
1531    }
1532
1533    impl<'de> ::fidl_next::IntoNatural for PowerElements<'de> {
1534        type Natural = crate::natural::PowerElements;
1535    }
1536
1537    /// The wire type corresponding to [`ActivityGovernorAcquireUnmonitoredWakeLeaseResponse`].
1538    #[derive(Debug)]
1539    #[repr(C)]
1540    pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1541        pub token: ::fidl_next::wire::fuchsia::EventPair,
1542    }
1543
1544    static_assertions::const_assert_eq!(
1545        std::mem::size_of::<ActivityGovernorAcquireUnmonitoredWakeLeaseResponse>(),
1546        4
1547    );
1548    static_assertions::const_assert_eq!(
1549        std::mem::align_of::<ActivityGovernorAcquireUnmonitoredWakeLeaseResponse>(),
1550        4
1551    );
1552
1553    static_assertions::const_assert_eq!(
1554        std::mem::offset_of!(ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, token),
1555        0
1556    );
1557
1558    impl ::fidl_next::Constrained for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1559        type Constraint = ();
1560
1561        fn validate(
1562            _: ::fidl_next::Slot<'_, Self>,
1563            _: Self::Constraint,
1564        ) -> Result<(), ::fidl_next::ValidationError> {
1565            Ok(())
1566        }
1567    }
1568
1569    unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1570        type Narrowed<'de> = ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
1571
1572        #[inline]
1573        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1574            ::fidl_next::munge! {
1575                let Self {
1576                    token,
1577
1578                } = &mut *out_;
1579            }
1580
1581            ::fidl_next::Wire::zero_padding(token);
1582        }
1583    }
1584
1585    unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
1586    where
1587        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1588        ___D: ::fidl_next::fuchsia::HandleDecoder,
1589    {
1590        fn decode(
1591            slot_: ::fidl_next::Slot<'_, Self>,
1592            decoder_: &mut ___D,
1593            _: (),
1594        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1595            ::fidl_next::munge! {
1596                let Self {
1597                    mut token,
1598
1599                } = slot_;
1600            }
1601
1602            let _field = token.as_mut();
1603
1604            ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1605
1606            Ok(())
1607        }
1608    }
1609
1610    impl ::fidl_next::IntoNatural for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1611        type Natural = crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
1612    }
1613
1614    /// The wire type corresponding to [`ActivityGovernorAcquireWakeLeaseWithTokenRequest`].
1615    #[derive(Debug)]
1616    #[repr(C)]
1617    pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de> {
1618        pub name: ::fidl_next::wire::String<'de>,
1619
1620        pub server_token: ::fidl_next::wire::fuchsia::EventPair,
1621    }
1622
1623    static_assertions::const_assert_eq!(
1624        std::mem::size_of::<ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>>(),
1625        24
1626    );
1627    static_assertions::const_assert_eq!(
1628        std::mem::align_of::<ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>>(),
1629        8
1630    );
1631
1632    static_assertions::const_assert_eq!(
1633        std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>, name),
1634        0
1635    );
1636
1637    static_assertions::const_assert_eq!(
1638        std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>, server_token),
1639        16
1640    );
1641
1642    impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_> {
1643        type Constraint = ();
1644
1645        fn validate(
1646            _: ::fidl_next::Slot<'_, Self>,
1647            _: Self::Constraint,
1648        ) -> Result<(), ::fidl_next::ValidationError> {
1649            Ok(())
1650        }
1651    }
1652
1653    unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static> {
1654        type Narrowed<'de> = ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>;
1655
1656        #[inline]
1657        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1658            ::fidl_next::munge! {
1659                let Self {
1660                    name,
1661                    server_token,
1662
1663                } = &mut *out_;
1664            }
1665
1666            ::fidl_next::Wire::zero_padding(name);
1667
1668            ::fidl_next::Wire::zero_padding(server_token);
1669
1670            unsafe {
1671                out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
1672            }
1673        }
1674    }
1675
1676    unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1677        for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>
1678    where
1679        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1680        ___D: ::fidl_next::Decoder<'de>,
1681        ___D: ::fidl_next::fuchsia::HandleDecoder,
1682    {
1683        fn decode(
1684            slot_: ::fidl_next::Slot<'_, Self>,
1685            decoder_: &mut ___D,
1686            _: (),
1687        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1688            if slot_.as_bytes()[20..24] != [0u8; 4] {
1689                return Err(::fidl_next::DecodeError::InvalidPadding);
1690            }
1691
1692            ::fidl_next::munge! {
1693                let Self {
1694                    mut name,
1695                    mut server_token,
1696
1697                } = slot_;
1698            }
1699
1700            let _field = name.as_mut();
1701            ::fidl_next::Constrained::validate(_field, 64)?;
1702            ::fidl_next::Decode::decode(name.as_mut(), decoder_, 64)?;
1703
1704            let name = unsafe { name.deref_unchecked() };
1705
1706            if name.len() > 64 {
1707                return Err(::fidl_next::DecodeError::VectorTooLong {
1708                    size: name.len() as u64,
1709                    limit: 64,
1710                });
1711            }
1712
1713            let _field = server_token.as_mut();
1714
1715            ::fidl_next::Decode::decode(server_token.as_mut(), decoder_, ())?;
1716
1717            Ok(())
1718        }
1719    }
1720
1721    impl<'de> ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de> {
1722        type Natural = crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenRequest;
1723    }
1724
1725    /// The wire type corresponding to [`ActivityGovernorTakeApplicationActivityLeaseResponse`].
1726    #[derive(Debug)]
1727    #[repr(C)]
1728    pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
1729        pub token: ::fidl_next::wire::fuchsia::EventPair,
1730    }
1731
1732    static_assertions::const_assert_eq!(
1733        std::mem::size_of::<ActivityGovernorTakeApplicationActivityLeaseResponse>(),
1734        4
1735    );
1736    static_assertions::const_assert_eq!(
1737        std::mem::align_of::<ActivityGovernorTakeApplicationActivityLeaseResponse>(),
1738        4
1739    );
1740
1741    static_assertions::const_assert_eq!(
1742        std::mem::offset_of!(ActivityGovernorTakeApplicationActivityLeaseResponse, token),
1743        0
1744    );
1745
1746    impl ::fidl_next::Constrained for ActivityGovernorTakeApplicationActivityLeaseResponse {
1747        type Constraint = ();
1748
1749        fn validate(
1750            _: ::fidl_next::Slot<'_, Self>,
1751            _: Self::Constraint,
1752        ) -> Result<(), ::fidl_next::ValidationError> {
1753            Ok(())
1754        }
1755    }
1756
1757    unsafe impl ::fidl_next::Wire for ActivityGovernorTakeApplicationActivityLeaseResponse {
1758        type Narrowed<'de> = ActivityGovernorTakeApplicationActivityLeaseResponse;
1759
1760        #[inline]
1761        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1762            ::fidl_next::munge! {
1763                let Self {
1764                    token,
1765
1766                } = &mut *out_;
1767            }
1768
1769            ::fidl_next::Wire::zero_padding(token);
1770        }
1771    }
1772
1773    unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorTakeApplicationActivityLeaseResponse
1774    where
1775        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1776        ___D: ::fidl_next::fuchsia::HandleDecoder,
1777    {
1778        fn decode(
1779            slot_: ::fidl_next::Slot<'_, Self>,
1780            decoder_: &mut ___D,
1781            _: (),
1782        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1783            ::fidl_next::munge! {
1784                let Self {
1785                    mut token,
1786
1787                } = slot_;
1788            }
1789
1790            let _field = token.as_mut();
1791
1792            ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1793
1794            Ok(())
1795        }
1796    }
1797
1798    impl ::fidl_next::IntoNatural for ActivityGovernorTakeApplicationActivityLeaseResponse {
1799        type Natural = crate::natural::ActivityGovernorTakeApplicationActivityLeaseResponse;
1800    }
1801
1802    /// The wire type corresponding to [`Cpu`].
1803    #[repr(C)]
1804    pub struct Cpu<'de> {
1805        pub(crate) table: ::fidl_next::wire::Table<'de>,
1806    }
1807
1808    impl<'de> Drop for Cpu<'de> {
1809        fn drop(&mut self) {
1810            let _ = self.table.get(1).map(|envelope| unsafe {
1811                envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1812            });
1813        }
1814    }
1815
1816    impl ::fidl_next::Constrained for Cpu<'_> {
1817        type Constraint = ();
1818
1819        fn validate(
1820            _: ::fidl_next::Slot<'_, Self>,
1821            _: Self::Constraint,
1822        ) -> Result<(), ::fidl_next::ValidationError> {
1823            Ok(())
1824        }
1825    }
1826
1827    unsafe impl ::fidl_next::Wire for Cpu<'static> {
1828        type Narrowed<'de> = Cpu<'de>;
1829
1830        #[inline]
1831        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1832            ::fidl_next::munge!(let Self { table } = out);
1833            ::fidl_next::wire::Table::zero_padding(table);
1834        }
1835    }
1836
1837    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Cpu<'de>
1838    where
1839        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1840        ___D: ::fidl_next::fuchsia::HandleDecoder,
1841    {
1842        fn decode(
1843            slot: ::fidl_next::Slot<'_, Self>,
1844            decoder: &mut ___D,
1845            _: (),
1846        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1847            ::fidl_next::munge!(let Self { table } = slot);
1848
1849            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1850                match ordinal {
1851                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1852
1853                    1 => {
1854                        ::fidl_next::wire::Envelope::decode_as::<
1855                            ___D,
1856                            ::fidl_next::wire::fuchsia::Event,
1857                        >(slot.as_mut(), decoder, ())?;
1858
1859                        Ok(())
1860                    }
1861
1862                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1863                }
1864            })
1865        }
1866    }
1867
1868    impl<'de> Cpu<'de> {
1869        pub fn assertive_dependency_token(
1870            &self,
1871        ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
1872            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1873        }
1874
1875        pub fn take_assertive_dependency_token(
1876            &mut self,
1877        ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
1878            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1879        }
1880    }
1881
1882    impl<'de> ::core::fmt::Debug for Cpu<'de> {
1883        fn fmt(
1884            &self,
1885            f: &mut ::core::fmt::Formatter<'_>,
1886        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1887            f.debug_struct("Cpu")
1888                .field("assertive_dependency_token", &self.assertive_dependency_token())
1889                .finish()
1890        }
1891    }
1892
1893    impl<'de> ::fidl_next::IntoNatural for Cpu<'de> {
1894        type Natural = crate::natural::Cpu;
1895    }
1896
1897    /// The wire type corresponding to [`CpuElementManagerAddExecutionStateDependencyRequest`].
1898    #[repr(C)]
1899    pub struct CpuElementManagerAddExecutionStateDependencyRequest<'de> {
1900        pub(crate) table: ::fidl_next::wire::Table<'de>,
1901    }
1902
1903    impl<'de> Drop for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
1904        fn drop(&mut self) {
1905            let _ = self.table.get(1).map(|envelope| unsafe {
1906                envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1907            });
1908
1909            let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
1910        }
1911    }
1912
1913    impl ::fidl_next::Constrained for CpuElementManagerAddExecutionStateDependencyRequest<'_> {
1914        type Constraint = ();
1915
1916        fn validate(
1917            _: ::fidl_next::Slot<'_, Self>,
1918            _: Self::Constraint,
1919        ) -> Result<(), ::fidl_next::ValidationError> {
1920            Ok(())
1921        }
1922    }
1923
1924    unsafe impl ::fidl_next::Wire for CpuElementManagerAddExecutionStateDependencyRequest<'static> {
1925        type Narrowed<'de> = CpuElementManagerAddExecutionStateDependencyRequest<'de>;
1926
1927        #[inline]
1928        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1929            ::fidl_next::munge!(let Self { table } = out);
1930            ::fidl_next::wire::Table::zero_padding(table);
1931        }
1932    }
1933
1934    unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1935        for CpuElementManagerAddExecutionStateDependencyRequest<'de>
1936    where
1937        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1938        ___D: ::fidl_next::fuchsia::HandleDecoder,
1939    {
1940        fn decode(
1941            slot: ::fidl_next::Slot<'_, Self>,
1942            decoder: &mut ___D,
1943            _: (),
1944        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1945            ::fidl_next::munge!(let Self { table } = slot);
1946
1947            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1948                match ordinal {
1949                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1950
1951                    1 => {
1952                        ::fidl_next::wire::Envelope::decode_as::<
1953                            ___D,
1954                            ::fidl_next::wire::fuchsia::Event,
1955                        >(slot.as_mut(), decoder, ())?;
1956
1957                        Ok(())
1958                    }
1959
1960                    2 => {
1961                        ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
1962                            slot.as_mut(),
1963                            decoder,
1964                            (),
1965                        )?;
1966
1967                        Ok(())
1968                    }
1969
1970                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1971                }
1972            })
1973        }
1974    }
1975
1976    impl<'de> CpuElementManagerAddExecutionStateDependencyRequest<'de> {
1977        pub fn dependency_token(
1978            &self,
1979        ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
1980            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1981        }
1982
1983        pub fn take_dependency_token(
1984            &mut self,
1985        ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
1986            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1987        }
1988
1989        pub fn power_level(&self) -> ::core::option::Option<&u8> {
1990            unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1991        }
1992
1993        pub fn take_power_level(&mut self) -> ::core::option::Option<u8> {
1994            unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
1995        }
1996    }
1997
1998    impl<'de> ::core::fmt::Debug for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
1999        fn fmt(
2000            &self,
2001            f: &mut ::core::fmt::Formatter<'_>,
2002        ) -> ::core::result::Result<(), ::core::fmt::Error> {
2003            f.debug_struct("CpuElementManagerAddExecutionStateDependencyRequest")
2004                .field("dependency_token", &self.dependency_token())
2005                .field("power_level", &self.power_level())
2006                .finish()
2007        }
2008    }
2009
2010    impl<'de> ::fidl_next::IntoNatural for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2011        type Natural = crate::natural::CpuElementManagerAddExecutionStateDependencyRequest;
2012    }
2013}
2014
2015pub mod wire_optional {
2016
2017    pub use fidl_next_common_fuchsia_power_system::wire_optional::*;
2018}
2019
2020pub mod generic {
2021
2022    pub use fidl_next_common_fuchsia_power_system::generic::*;
2023
2024    /// The generic type corresponding to [`ActivityGovernorAcquireWakeLeaseResponse`].
2025    pub struct ActivityGovernorAcquireWakeLeaseResponse<T0> {
2026        pub token: T0,
2027    }
2028
2029    unsafe impl<___E, T0>
2030        ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>
2031        for ActivityGovernorAcquireWakeLeaseResponse<T0>
2032    where
2033        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2034        ___E: ::fidl_next::fuchsia::HandleEncoder,
2035        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2036    {
2037        #[inline]
2038        fn encode(
2039            self,
2040            encoder_: &mut ___E,
2041            out_: &mut ::core::mem::MaybeUninit<
2042                crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
2043            >,
2044            _: (),
2045        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2046            ::fidl_next::munge! {
2047                let crate::wire::ActivityGovernorAcquireWakeLeaseResponse {
2048                    token,
2049
2050                } = out_;
2051            }
2052
2053            ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2054
2055            Ok(())
2056        }
2057    }
2058
2059    /// The generic type corresponding to [`ActivityGovernorRegisterSuspendBlockerResponse`].
2060    pub struct ActivityGovernorRegisterSuspendBlockerResponse<T0> {
2061        pub token: T0,
2062    }
2063
2064    unsafe impl<___E, T0>
2065        ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>
2066        for ActivityGovernorRegisterSuspendBlockerResponse<T0>
2067    where
2068        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2069        ___E: ::fidl_next::fuchsia::HandleEncoder,
2070        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2071    {
2072        #[inline]
2073        fn encode(
2074            self,
2075            encoder_: &mut ___E,
2076            out_: &mut ::core::mem::MaybeUninit<
2077                crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
2078            >,
2079            _: (),
2080        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2081            ::fidl_next::munge! {
2082                let crate::wire::ActivityGovernorRegisterSuspendBlockerResponse {
2083                    token,
2084
2085                } = out_;
2086            }
2087
2088            ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2089
2090            Ok(())
2091        }
2092    }
2093
2094    /// The generic type corresponding to [`ActivityGovernorAcquireUnmonitoredWakeLeaseResponse`].
2095    pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<T0> {
2096        pub token: T0,
2097    }
2098
2099    unsafe impl<___E, T0>
2100        ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, ___E>
2101        for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<T0>
2102    where
2103        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2104        ___E: ::fidl_next::fuchsia::HandleEncoder,
2105        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2106    {
2107        #[inline]
2108        fn encode(
2109            self,
2110            encoder_: &mut ___E,
2111            out_: &mut ::core::mem::MaybeUninit<
2112                crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
2113            >,
2114            _: (),
2115        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2116            ::fidl_next::munge! {
2117                let crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
2118                    token,
2119
2120                } = out_;
2121            }
2122
2123            ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2124
2125            Ok(())
2126        }
2127    }
2128
2129    /// The generic type corresponding to [`ActivityGovernorAcquireWakeLeaseWithTokenRequest`].
2130    pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1> {
2131        pub name: T0,
2132
2133        pub server_token: T1,
2134    }
2135
2136    unsafe impl<___E, T0, T1>
2137        ::fidl_next::Encode<
2138            crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2139            ___E,
2140        > for ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1>
2141    where
2142        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2143        ___E: ::fidl_next::Encoder,
2144        ___E: ::fidl_next::fuchsia::HandleEncoder,
2145        T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
2146        T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2147    {
2148        #[inline]
2149        fn encode(
2150            self,
2151            encoder_: &mut ___E,
2152            out_: &mut ::core::mem::MaybeUninit<
2153                crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2154            >,
2155            _: (),
2156        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2157            ::fidl_next::munge! {
2158                let crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
2159                    name,
2160                    server_token,
2161
2162                } = out_;
2163            }
2164
2165            ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
2166
2167            ::fidl_next::Encode::encode(self.server_token, encoder_, server_token, ())?;
2168
2169            Ok(())
2170        }
2171    }
2172
2173    /// The generic type corresponding to [`ActivityGovernorTakeApplicationActivityLeaseResponse`].
2174    pub struct ActivityGovernorTakeApplicationActivityLeaseResponse<T0> {
2175        pub token: T0,
2176    }
2177
2178    unsafe impl<___E, T0>
2179        ::fidl_next::Encode<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse, ___E>
2180        for ActivityGovernorTakeApplicationActivityLeaseResponse<T0>
2181    where
2182        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2183        ___E: ::fidl_next::fuchsia::HandleEncoder,
2184        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2185    {
2186        #[inline]
2187        fn encode(
2188            self,
2189            encoder_: &mut ___E,
2190            out_: &mut ::core::mem::MaybeUninit<
2191                crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
2192            >,
2193            _: (),
2194        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2195            ::fidl_next::munge! {
2196                let crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse {
2197                    token,
2198
2199                } = out_;
2200            }
2201
2202            ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2203
2204            Ok(())
2205        }
2206    }
2207}
2208
2209pub use self::natural::*;
2210
2211/// The type corresponding to the ActivityGovernor protocol.
2212#[doc = " A service for exposing events and power elements managed by the system\n activity governor (SAG).\n\n SAG is responsible for managing the execution state of the hardware\n platform. The hardware platform consists of the components required to\n execute code on the device. This typically includes the CPU, memory,\n operating system, and other components required for these components to\n function (clock trees, power domains, etc.).\n"]
2213#[derive(PartialEq, Debug)]
2214pub struct ActivityGovernor;
2215
2216impl ::fidl_next::Discoverable for ActivityGovernor {
2217    const PROTOCOL_NAME: &'static str = "fuchsia.power.system.ActivityGovernor";
2218}
2219
2220#[cfg(target_os = "fuchsia")]
2221impl ::fidl_next::HasTransport for ActivityGovernor {
2222    type Transport = ::fidl_next::fuchsia::zx::Channel;
2223}
2224
2225pub mod activity_governor {
2226    pub mod prelude {
2227        pub use crate::{
2228            ActivityGovernor, ActivityGovernorClientHandler, ActivityGovernorLocalClientHandler,
2229            ActivityGovernorLocalServerHandler, ActivityGovernorServerHandler, activity_governor,
2230        };
2231
2232        pub use crate::natural::AcquireWakeLeaseError;
2233
2234        pub use crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest;
2235
2236        pub use crate::natural::ActivityGovernorAcquireWakeLeaseRequest;
2237
2238        pub use crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenRequest;
2239
2240        pub use crate::natural::ActivityGovernorRegisterSuspendBlockerRequest;
2241
2242        pub use crate::natural::ActivityGovernorTakeApplicationActivityLeaseRequest;
2243
2244        pub use crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
2245
2246        pub use crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenResponse;
2247
2248        pub use crate::natural::ActivityGovernorAcquireWakeLeaseResponse;
2249
2250        pub use crate::natural::ActivityGovernorRegisterSuspendBlockerResponse;
2251
2252        pub use crate::natural::ActivityGovernorTakeApplicationActivityLeaseResponse;
2253
2254        pub use crate::natural::PowerElements;
2255
2256        pub use crate::natural::RegisterSuspendBlockerError;
2257    }
2258
2259    pub struct GetPowerElements;
2260
2261    impl ::fidl_next::Method for GetPowerElements {
2262        const ORDINAL: u64 = 8755001135707412082;
2263        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2264            ::fidl_next::protocol::Flexibility::Flexible;
2265
2266        type Protocol = crate::ActivityGovernor;
2267
2268        type Request = ::fidl_next::wire::EmptyMessageBody;
2269    }
2270
2271    impl ::fidl_next::TwoWayMethod for GetPowerElements {
2272        type Response = ::fidl_next::wire::Flexible<'static, crate::wire::PowerElements<'static>>;
2273    }
2274
2275    impl<___R> ::fidl_next::Respond<___R> for GetPowerElements {
2276        type Output = ::fidl_next::Flexible<___R>;
2277
2278        fn respond(response: ___R) -> Self::Output {
2279            ::fidl_next::Flexible(response)
2280        }
2281    }
2282
2283    pub struct AcquireWakeLease;
2284
2285    impl ::fidl_next::Method for AcquireWakeLease {
2286        const ORDINAL: u64 = 3306304846648819971;
2287        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2288            ::fidl_next::protocol::Flexibility::Flexible;
2289
2290        type Protocol = crate::ActivityGovernor;
2291
2292        type Request = crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'static>;
2293    }
2294
2295    impl ::fidl_next::TwoWayMethod for AcquireWakeLease {
2296        type Response = ::fidl_next::wire::Result<
2297            'static,
2298            crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
2299            crate::wire::AcquireWakeLeaseError,
2300        >;
2301    }
2302
2303    impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLease {
2304        type Output = ::core::result::Result<
2305            crate::generic::ActivityGovernorAcquireWakeLeaseResponse<___R>,
2306            ::fidl_next::never::Never,
2307        >;
2308
2309        fn respond(response: ___R) -> Self::Output {
2310            ::core::result::Result::Ok(crate::generic::ActivityGovernorAcquireWakeLeaseResponse {
2311                token: response,
2312            })
2313        }
2314    }
2315
2316    impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLease {
2317        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2318
2319        fn respond_err(response: ___R) -> Self::Output {
2320            ::core::result::Result::Err(response)
2321        }
2322    }
2323
2324    pub struct AcquireUnmonitoredWakeLease;
2325
2326    impl ::fidl_next::Method for AcquireUnmonitoredWakeLease {
2327        const ORDINAL: u64 = 6877005249659825577;
2328        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2329            ::fidl_next::protocol::Flexibility::Flexible;
2330
2331        type Protocol = crate::ActivityGovernor;
2332
2333        type Request = crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'static>;
2334    }
2335
2336    impl ::fidl_next::TwoWayMethod for AcquireUnmonitoredWakeLease {
2337        type Response = ::fidl_next::wire::Result<
2338            'static,
2339            crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
2340            crate::wire::AcquireWakeLeaseError,
2341        >;
2342    }
2343
2344    impl<___R> ::fidl_next::Respond<___R> for AcquireUnmonitoredWakeLease {
2345        type Output = ::core::result::Result<
2346            crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<___R>,
2347            ::fidl_next::never::Never,
2348        >;
2349
2350        fn respond(response: ___R) -> Self::Output {
2351            ::core::result::Result::Ok(
2352                crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
2353                    token: response,
2354                },
2355            )
2356        }
2357    }
2358
2359    impl<___R> ::fidl_next::RespondErr<___R> for AcquireUnmonitoredWakeLease {
2360        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2361
2362        fn respond_err(response: ___R) -> Self::Output {
2363            ::core::result::Result::Err(response)
2364        }
2365    }
2366
2367    pub struct AcquireWakeLeaseWithToken;
2368
2369    impl ::fidl_next::Method for AcquireWakeLeaseWithToken {
2370        const ORDINAL: u64 = 2079869883732225873;
2371        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2372            ::fidl_next::protocol::Flexibility::Flexible;
2373
2374        type Protocol = crate::ActivityGovernor;
2375
2376        type Request = crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>;
2377    }
2378
2379    impl ::fidl_next::TwoWayMethod for AcquireWakeLeaseWithToken {
2380        type Response = ::fidl_next::wire::Result<
2381            'static,
2382            crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenResponse,
2383            crate::wire::AcquireWakeLeaseError,
2384        >;
2385    }
2386
2387    impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLeaseWithToken {
2388        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
2389
2390        fn respond(response: ___R) -> Self::Output {
2391            ::core::result::Result::Ok(response)
2392        }
2393    }
2394
2395    impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLeaseWithToken {
2396        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2397
2398        fn respond_err(response: ___R) -> Self::Output {
2399            ::core::result::Result::Err(response)
2400        }
2401    }
2402
2403    pub struct TakeApplicationActivityLease;
2404
2405    impl ::fidl_next::Method for TakeApplicationActivityLease {
2406        const ORDINAL: u64 = 4020961735006149140;
2407        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2408            ::fidl_next::protocol::Flexibility::Flexible;
2409
2410        type Protocol = crate::ActivityGovernor;
2411
2412        type Request = crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'static>;
2413    }
2414
2415    impl ::fidl_next::TwoWayMethod for TakeApplicationActivityLease {
2416        type Response = ::fidl_next::wire::Flexible<
2417            'static,
2418            crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
2419        >;
2420    }
2421
2422    impl<___R> ::fidl_next::Respond<___R> for TakeApplicationActivityLease {
2423        type Output = ::fidl_next::Flexible<
2424            crate::generic::ActivityGovernorTakeApplicationActivityLeaseResponse<___R>,
2425        >;
2426
2427        fn respond(response: ___R) -> Self::Output {
2428            ::fidl_next::Flexible(
2429                crate::generic::ActivityGovernorTakeApplicationActivityLeaseResponse {
2430                    token: response,
2431                },
2432            )
2433        }
2434    }
2435
2436    pub struct RegisterSuspendBlocker;
2437
2438    impl ::fidl_next::Method for RegisterSuspendBlocker {
2439        const ORDINAL: u64 = 3814361630267862785;
2440        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2441            ::fidl_next::protocol::Flexibility::Flexible;
2442
2443        type Protocol = crate::ActivityGovernor;
2444
2445        type Request = crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>;
2446    }
2447
2448    impl ::fidl_next::TwoWayMethod for RegisterSuspendBlocker {
2449        type Response = ::fidl_next::wire::Result<
2450            'static,
2451            crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
2452            crate::wire::RegisterSuspendBlockerError,
2453        >;
2454    }
2455
2456    impl<___R> ::fidl_next::Respond<___R> for RegisterSuspendBlocker {
2457        type Output = ::core::result::Result<
2458            crate::generic::ActivityGovernorRegisterSuspendBlockerResponse<___R>,
2459            ::fidl_next::never::Never,
2460        >;
2461
2462        fn respond(response: ___R) -> Self::Output {
2463            ::core::result::Result::Ok(
2464                crate::generic::ActivityGovernorRegisterSuspendBlockerResponse { token: response },
2465            )
2466        }
2467    }
2468
2469    impl<___R> ::fidl_next::RespondErr<___R> for RegisterSuspendBlocker {
2470        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2471
2472        fn respond_err(response: ___R) -> Self::Output {
2473            ::core::result::Result::Err(response)
2474        }
2475    }
2476
2477    mod ___detail {
2478        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ActivityGovernor
2479        where
2480            ___T: ::fidl_next::Transport,
2481        {
2482            type Client = ActivityGovernorClient<___T>;
2483            type Server = ActivityGovernorServer<___T>;
2484        }
2485
2486        /// The client for the `ActivityGovernor` protocol.
2487        #[repr(transparent)]
2488        pub struct ActivityGovernorClient<___T: ::fidl_next::Transport> {
2489            #[allow(dead_code)]
2490            client: ::fidl_next::protocol::Client<___T>,
2491        }
2492
2493        impl<___T> ActivityGovernorClient<___T>
2494        where
2495            ___T: ::fidl_next::Transport,
2496        {
2497            #[doc = " Gets the power elements owned by the activity governor.\n\n If an error occurs while the server is registering a power element with\n the power broker or an error occurs while creating a token for a power\n element, then the channel to `ActivityGovernor` will be closed by the\n server and no response will be returned.\n"]
2498            pub fn get_power_elements(
2499                &self,
2500            ) -> ::fidl_next::TwoWayFuture<'_, super::GetPowerElements, ___T> {
2501                ::fidl_next::TwoWayFuture::from_untyped(
2502                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
2503                        8755001135707412082,
2504                        <super::GetPowerElements as ::fidl_next::Method>::FLEXIBILITY,
2505                        (),
2506                    ),
2507                )
2508            }
2509
2510            #[doc = " Creates a lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n"]
2511            pub fn acquire_wake_lease(
2512                &self,
2513
2514                name: impl ::fidl_next::Encode<
2515                    ::fidl_next::wire::String<'static>,
2516                    <___T as ::fidl_next::Transport>::SendBuffer,
2517                >,
2518            ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease, ___T>
2519            where
2520                <___T as ::fidl_next::Transport>::SendBuffer:
2521                    ::fidl_next::encoder::InternalHandleEncoder,
2522                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2523            {
2524                self.acquire_wake_lease_with(
2525                    crate::generic::ActivityGovernorAcquireWakeLeaseRequest { name },
2526                )
2527            }
2528
2529            #[doc = " Creates a lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n"]
2530            pub fn acquire_wake_lease_with<___R>(
2531                &self,
2532                request: ___R,
2533            ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease, ___T>
2534            where
2535                ___R: ::fidl_next::Encode<
2536                        crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'static>,
2537                        <___T as ::fidl_next::Transport>::SendBuffer,
2538                    >,
2539            {
2540                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2541                    3306304846648819971,
2542                    <super::AcquireWakeLease as ::fidl_next::Method>::FLEXIBILITY,
2543                    request,
2544                ))
2545            }
2546
2547            #[doc = " Creates an unmonitored lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n\n This is intended for leases expected to be held for extended periods.\n Unlike normal wake leases, the server does not monitor the duration\n of an unmonitored wake lease and will not file a crash report if it exceeds\n preconfigured alert thresholds.\n"]
2548            pub fn acquire_unmonitored_wake_lease(
2549                &self,
2550
2551                name: impl ::fidl_next::Encode<
2552                    ::fidl_next::wire::String<'static>,
2553                    <___T as ::fidl_next::Transport>::SendBuffer,
2554                >,
2555            ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireUnmonitoredWakeLease, ___T>
2556            where
2557                <___T as ::fidl_next::Transport>::SendBuffer:
2558                    ::fidl_next::encoder::InternalHandleEncoder,
2559                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2560            {
2561                self.acquire_unmonitored_wake_lease_with(
2562                    crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest { name },
2563                )
2564            }
2565
2566            #[doc = " Creates an unmonitored lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n\n This is intended for leases expected to be held for extended periods.\n Unlike normal wake leases, the server does not monitor the duration\n of an unmonitored wake lease and will not file a crash report if it exceeds\n preconfigured alert thresholds.\n"]
2567            pub fn acquire_unmonitored_wake_lease_with<___R>(
2568                &self,
2569                request: ___R,
2570            ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireUnmonitoredWakeLease, ___T>
2571            where
2572                ___R: ::fidl_next::Encode<
2573                        crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'static>,
2574                        <___T as ::fidl_next::Transport>::SendBuffer,
2575                    >,
2576            {
2577                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2578                    6877005249659825577,
2579                    <super::AcquireUnmonitoredWakeLease as ::fidl_next::Method>::FLEXIBILITY,
2580                    request,
2581                ))
2582            }
2583
2584            #[doc = " Creates a lease that blocks suspension of the hardware platform.\n WARNING: Suspension can only be considered blocked after the client\n receives the response to this call. This means, for example, an\n interrupt should only be ack\'ed or a different wake lease dropped only\n **after** getting an error-free response.\n\n The hardware platform will remain resumed until `server_token` observes\n `PEER_CLOSED`, indicating all handles to the client side of the\n `LeaseToken` are closed.\n"]
2585            pub fn acquire_wake_lease_with_token(
2586                &self,
2587
2588                name: impl ::fidl_next::Encode<
2589                    ::fidl_next::wire::String<'static>,
2590                    <___T as ::fidl_next::Transport>::SendBuffer,
2591                >,
2592
2593                server_token: impl ::fidl_next::Encode<
2594                    ::fidl_next::wire::fuchsia::EventPair,
2595                    <___T as ::fidl_next::Transport>::SendBuffer,
2596                >,
2597            ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLeaseWithToken, ___T>
2598            where
2599                <___T as ::fidl_next::Transport>::SendBuffer:
2600                    ::fidl_next::encoder::InternalHandleEncoder,
2601                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2602                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
2603            {
2604                self.acquire_wake_lease_with_token_with(
2605                    crate::generic::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
2606                        name,
2607
2608                        server_token,
2609                    },
2610                )
2611            }
2612
2613            #[doc = " Creates a lease that blocks suspension of the hardware platform.\n WARNING: Suspension can only be considered blocked after the client\n receives the response to this call. This means, for example, an\n interrupt should only be ack\'ed or a different wake lease dropped only\n **after** getting an error-free response.\n\n The hardware platform will remain resumed until `server_token` observes\n `PEER_CLOSED`, indicating all handles to the client side of the\n `LeaseToken` are closed.\n"]
2614            pub fn acquire_wake_lease_with_token_with<___R>(
2615                &self,
2616                request: ___R,
2617            ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLeaseWithToken, ___T>
2618            where
2619                ___R: ::fidl_next::Encode<
2620                        crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2621                        <___T as ::fidl_next::Transport>::SendBuffer,
2622                    >,
2623            {
2624                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2625                    2079869883732225873,
2626                    <super::AcquireWakeLeaseWithToken as ::fidl_next::Method>::FLEXIBILITY,
2627                    request,
2628                ))
2629            }
2630
2631            #[doc = " Creates a lease that blocks the system from dropping below the Application\n Activity \'Active\' state. In particular, this blocks suspension of the\n hardware platform.\n\n This method is _not_ safe to call during SuspendBlocker.BeforeSuspend.\n\n If an error occurs while creating a token for the activity lease, then the\n channel to `ActivityGovernor` will be closed by the server and no\n response will be returned.\n"]
2632            pub fn take_application_activity_lease(
2633                &self,
2634
2635                name: impl ::fidl_next::Encode<
2636                    ::fidl_next::wire::String<'static>,
2637                    <___T as ::fidl_next::Transport>::SendBuffer,
2638                >,
2639            ) -> ::fidl_next::TwoWayFuture<'_, super::TakeApplicationActivityLease, ___T>
2640            where
2641                <___T as ::fidl_next::Transport>::SendBuffer:
2642                    ::fidl_next::encoder::InternalHandleEncoder,
2643                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2644            {
2645                self.take_application_activity_lease_with(
2646                    crate::generic::ActivityGovernorTakeApplicationActivityLeaseRequest { name },
2647                )
2648            }
2649
2650            #[doc = " Creates a lease that blocks the system from dropping below the Application\n Activity \'Active\' state. In particular, this blocks suspension of the\n hardware platform.\n\n This method is _not_ safe to call during SuspendBlocker.BeforeSuspend.\n\n If an error occurs while creating a token for the activity lease, then the\n channel to `ActivityGovernor` will be closed by the server and no\n response will be returned.\n"]
2651            pub fn take_application_activity_lease_with<___R>(
2652                &self,
2653                request: ___R,
2654            ) -> ::fidl_next::TwoWayFuture<'_, super::TakeApplicationActivityLease, ___T>
2655            where
2656                ___R: ::fidl_next::Encode<
2657                        crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'static>,
2658                        <___T as ::fidl_next::Transport>::SendBuffer,
2659                    >,
2660            {
2661                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2662                    4020961735006149140,
2663                    <super::TakeApplicationActivityLease as ::fidl_next::Method>::FLEXIBILITY,
2664                    request,
2665                ))
2666            }
2667
2668            #[doc = " Registers a suspend blocker.\n\n On successful registration, a wake lease token is returned. This token\n prevents hardware platform suspension while it exists. Clients are\n expected to perform any initialization of the given `suspend_blocker`\n server while holding this token. Additionally, this means the first call\n `suspend_blocker` will get is `BeforeSuspend`.\n\n To unregister, close the `SuspendBlocker` channel.\n\n If any required field of the table is missing, the error\n [`RegisterSuspendBlockerError.INVALID_ARGS`] is returned.\n\n If an error occurs while registering `suspend_blocker`, it will be\n dropped, closing the channel.\n"]
2669            pub fn register_suspend_blocker_with<___R>(
2670                &self,
2671                request: ___R,
2672            ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterSuspendBlocker, ___T>
2673            where
2674                ___R: ::fidl_next::Encode<
2675                        crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>,
2676                        <___T as ::fidl_next::Transport>::SendBuffer,
2677                    >,
2678            {
2679                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2680                    3814361630267862785,
2681                    <super::RegisterSuspendBlocker as ::fidl_next::Method>::FLEXIBILITY,
2682                    request,
2683                ))
2684            }
2685        }
2686
2687        /// The server for the `ActivityGovernor` protocol.
2688        #[repr(transparent)]
2689        pub struct ActivityGovernorServer<___T: ::fidl_next::Transport> {
2690            server: ::fidl_next::protocol::Server<___T>,
2691        }
2692
2693        impl<___T> ActivityGovernorServer<___T> where ___T: ::fidl_next::Transport {}
2694    }
2695}
2696
2697#[diagnostic::on_unimplemented(
2698    note = "If {Self} implements the non-local ActivityGovernorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
2699)]
2700
2701/// A client handler for the ActivityGovernor protocol.
2702///
2703/// See [`ActivityGovernor`] for more details.
2704pub trait ActivityGovernorLocalClientHandler<
2705    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2706    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2707>
2708{
2709    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2710        ::core::future::ready(())
2711    }
2712}
2713
2714impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ActivityGovernor
2715where
2716    ___H: ActivityGovernorLocalClientHandler<___T>,
2717    ___T: ::fidl_next::Transport,
2718{
2719    async fn on_event(
2720        handler: &mut ___H,
2721        mut message: ::fidl_next::Message<___T>,
2722    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2723        match *message.header().ordinal {
2724            ordinal => {
2725                handler.on_unknown_interaction(ordinal).await;
2726                if ::core::matches!(
2727                    message.header().flexibility(),
2728                    ::fidl_next::protocol::Flexibility::Strict
2729                ) {
2730                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2731                } else {
2732                    Ok(())
2733                }
2734            }
2735        }
2736    }
2737}
2738
2739#[diagnostic::on_unimplemented(
2740    note = "If {Self} implements the non-local ActivityGovernorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
2741)]
2742
2743/// A server handler for the ActivityGovernor protocol.
2744///
2745/// See [`ActivityGovernor`] for more details.
2746pub trait ActivityGovernorLocalServerHandler<
2747    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2748    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2749>
2750{
2751    #[doc = " Gets the power elements owned by the activity governor.\n\n If an error occurs while the server is registering a power element with\n the power broker or an error occurs while creating a token for a power\n element, then the channel to `ActivityGovernor` will be closed by the\n server and no response will be returned.\n"]
2752    fn get_power_elements(
2753        &mut self,
2754
2755        responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
2756    ) -> impl ::core::future::Future<Output = ()>;
2757
2758    #[doc = " Creates a lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n"]
2759    fn acquire_wake_lease(
2760        &mut self,
2761
2762        request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
2763
2764        responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
2765    ) -> impl ::core::future::Future<Output = ()>;
2766
2767    #[doc = " Creates an unmonitored lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n\n This is intended for leases expected to be held for extended periods.\n Unlike normal wake leases, the server does not monitor the duration\n of an unmonitored wake lease and will not file a crash report if it exceeds\n preconfigured alert thresholds.\n"]
2768    fn acquire_unmonitored_wake_lease(
2769        &mut self,
2770
2771        request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
2772
2773        responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
2774    ) -> impl ::core::future::Future<Output = ()>;
2775
2776    #[doc = " Creates a lease that blocks suspension of the hardware platform.\n WARNING: Suspension can only be considered blocked after the client\n receives the response to this call. This means, for example, an\n interrupt should only be ack\'ed or a different wake lease dropped only\n **after** getting an error-free response.\n\n The hardware platform will remain resumed until `server_token` observes\n `PEER_CLOSED`, indicating all handles to the client side of the\n `LeaseToken` are closed.\n"]
2777    fn acquire_wake_lease_with_token(
2778        &mut self,
2779
2780        request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
2781
2782        responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
2783    ) -> impl ::core::future::Future<Output = ()>;
2784
2785    #[doc = " Creates a lease that blocks the system from dropping below the Application\n Activity \'Active\' state. In particular, this blocks suspension of the\n hardware platform.\n\n This method is _not_ safe to call during SuspendBlocker.BeforeSuspend.\n\n If an error occurs while creating a token for the activity lease, then the\n channel to `ActivityGovernor` will be closed by the server and no\n response will be returned.\n"]
2786    fn take_application_activity_lease(
2787        &mut self,
2788
2789        request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
2790
2791        responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
2792    ) -> impl ::core::future::Future<Output = ()>;
2793
2794    #[doc = " Registers a suspend blocker.\n\n On successful registration, a wake lease token is returned. This token\n prevents hardware platform suspension while it exists. Clients are\n expected to perform any initialization of the given `suspend_blocker`\n server while holding this token. Additionally, this means the first call\n `suspend_blocker` will get is `BeforeSuspend`.\n\n To unregister, close the `SuspendBlocker` channel.\n\n If any required field of the table is missing, the error\n [`RegisterSuspendBlockerError.INVALID_ARGS`] is returned.\n\n If an error occurs while registering `suspend_blocker`, it will be\n dropped, closing the channel.\n"]
2795    fn register_suspend_blocker(
2796        &mut self,
2797
2798        request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
2799
2800        responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
2801    ) -> impl ::core::future::Future<Output = ()>;
2802
2803    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2804        ::core::future::ready(())
2805    }
2806}
2807
2808impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ActivityGovernor
2809where
2810    ___H: ActivityGovernorLocalServerHandler<___T> ,
2811    ___T: ::fidl_next::Transport,
2812
2813
2814
2815
2816            for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'de>: ::fidl_next::Decode<
2817                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2818                Constraint = (),
2819            >,
2820
2821
2822
2823            for<'de> crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'de>: ::fidl_next::Decode<
2824                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2825                Constraint = (),
2826            >,
2827
2828
2829
2830            for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>: ::fidl_next::Decode<
2831                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2832                Constraint = (),
2833            >,
2834
2835
2836
2837            for<'de> crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'de>: ::fidl_next::Decode<
2838                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2839                Constraint = (),
2840            >,
2841
2842
2843
2844            for<'de> crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>: ::fidl_next::Decode<
2845                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2846                Constraint = (),
2847            >,
2848
2849
2850{
2851    async fn on_one_way(
2852        handler: &mut ___H,
2853        mut message: ::fidl_next::Message<___T>,
2854    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
2855        match *message.header().ordinal {
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875            ordinal => {
2876
2877                    handler.on_unknown_interaction(ordinal).await;
2878                    if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
2879                        Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2880                    } else {
2881                        Ok(())
2882                    }
2883
2884            }
2885        }
2886    }
2887
2888    async fn on_two_way(
2889        handler: &mut ___H,
2890        mut message: ::fidl_next::Message<___T>,
2891        responder: ::fidl_next::protocol::Responder<___T>,
2892    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
2893        match *message.header().ordinal {
2894
2895
2896
2897                    8755001135707412082 => {
2898                        let responder = ::fidl_next::Responder::from_untyped(responder);
2899
2900                            handler.get_power_elements(responder).await;
2901                            Ok(())
2902
2903                    }
2904
2905
2906
2907
2908                    3306304846648819971 => {
2909                        let responder = ::fidl_next::Responder::from_untyped(responder);
2910
2911                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
2912                                Ok(decoded) => {
2913                                    handler.acquire_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
2914                                    Ok(())
2915                                }
2916                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2917                                    ordinal: 3306304846648819971,
2918                                    error,
2919                                }),
2920                            }
2921
2922                    }
2923
2924
2925
2926
2927                    6877005249659825577 => {
2928                        let responder = ::fidl_next::Responder::from_untyped(responder);
2929
2930                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
2931                                Ok(decoded) => {
2932                                    handler.acquire_unmonitored_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
2933                                    Ok(())
2934                                }
2935                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2936                                    ordinal: 6877005249659825577,
2937                                    error,
2938                                }),
2939                            }
2940
2941                    }
2942
2943
2944
2945
2946                    2079869883732225873 => {
2947                        let responder = ::fidl_next::Responder::from_untyped(responder);
2948
2949                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
2950                                Ok(decoded) => {
2951                                    handler.acquire_wake_lease_with_token(::fidl_next::Request::from_decoded(decoded), responder).await;
2952                                    Ok(())
2953                                }
2954                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2955                                    ordinal: 2079869883732225873,
2956                                    error,
2957                                }),
2958                            }
2959
2960                    }
2961
2962
2963
2964
2965                    4020961735006149140 => {
2966                        let responder = ::fidl_next::Responder::from_untyped(responder);
2967
2968                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
2969                                Ok(decoded) => {
2970                                    handler.take_application_activity_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
2971                                    Ok(())
2972                                }
2973                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2974                                    ordinal: 4020961735006149140,
2975                                    error,
2976                                }),
2977                            }
2978
2979                    }
2980
2981
2982
2983
2984                    3814361630267862785 => {
2985                        let responder = ::fidl_next::Responder::from_untyped(responder);
2986
2987                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
2988                                Ok(decoded) => {
2989                                    handler.register_suspend_blocker(::fidl_next::Request::from_decoded(decoded), responder).await;
2990                                    Ok(())
2991                                }
2992                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2993                                    ordinal: 3814361630267862785,
2994                                    error,
2995                                }),
2996                            }
2997
2998                    }
2999
3000
3001            ordinal => {
3002
3003                        handler.on_unknown_interaction(ordinal).await;
3004                        if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3005                            Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3006                        } else {
3007                            responder.respond_framework_error(
3008                                ordinal,
3009                                ::fidl_next::FrameworkError::UnknownMethod,
3010                            )
3011                            .expect("encoding a framework error should never fail")
3012                            .await?;
3013                            Ok(())
3014                        }
3015
3016            }
3017        }
3018    }
3019}
3020
3021/// A client handler for the ActivityGovernor protocol.
3022///
3023/// See [`ActivityGovernor`] for more details.
3024pub trait ActivityGovernorClientHandler<
3025    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3026    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3027>
3028{
3029    fn on_unknown_interaction(
3030        &mut self,
3031        ordinal: u64,
3032    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3033        ::core::future::ready(())
3034    }
3035}
3036
3037impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ActivityGovernor
3038where
3039    ___H: ActivityGovernorClientHandler<___T> + ::core::marker::Send,
3040    ___T: ::fidl_next::Transport,
3041{
3042    async fn on_event(
3043        handler: &mut ___H,
3044        mut message: ::fidl_next::Message<___T>,
3045    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3046        match *message.header().ordinal {
3047            ordinal => {
3048                handler.on_unknown_interaction(ordinal).await;
3049                if ::core::matches!(
3050                    message.header().flexibility(),
3051                    ::fidl_next::protocol::Flexibility::Strict
3052                ) {
3053                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3054                } else {
3055                    Ok(())
3056                }
3057            }
3058        }
3059    }
3060}
3061
3062/// A server handler for the ActivityGovernor protocol.
3063///
3064/// See [`ActivityGovernor`] for more details.
3065pub trait ActivityGovernorServerHandler<
3066    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3067    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3068>
3069{
3070    #[doc = " Gets the power elements owned by the activity governor.\n\n If an error occurs while the server is registering a power element with\n the power broker or an error occurs while creating a token for a power\n element, then the channel to `ActivityGovernor` will be closed by the\n server and no response will be returned.\n"]
3071    fn get_power_elements(
3072        &mut self,
3073
3074        responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
3075    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3076
3077    #[doc = " Creates a lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n"]
3078    fn acquire_wake_lease(
3079        &mut self,
3080
3081        request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3082
3083        responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3084    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3085
3086    #[doc = " Creates an unmonitored lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n\n This is intended for leases expected to be held for extended periods.\n Unlike normal wake leases, the server does not monitor the duration\n of an unmonitored wake lease and will not file a crash report if it exceeds\n preconfigured alert thresholds.\n"]
3087    fn acquire_unmonitored_wake_lease(
3088        &mut self,
3089
3090        request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3091
3092        responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3093    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3094
3095    #[doc = " Creates a lease that blocks suspension of the hardware platform.\n WARNING: Suspension can only be considered blocked after the client\n receives the response to this call. This means, for example, an\n interrupt should only be ack\'ed or a different wake lease dropped only\n **after** getting an error-free response.\n\n The hardware platform will remain resumed until `server_token` observes\n `PEER_CLOSED`, indicating all handles to the client side of the\n `LeaseToken` are closed.\n"]
3096    fn acquire_wake_lease_with_token(
3097        &mut self,
3098
3099        request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3100
3101        responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3102    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3103
3104    #[doc = " Creates a lease that blocks the system from dropping below the Application\n Activity \'Active\' state. In particular, this blocks suspension of the\n hardware platform.\n\n This method is _not_ safe to call during SuspendBlocker.BeforeSuspend.\n\n If an error occurs while creating a token for the activity lease, then the\n channel to `ActivityGovernor` will be closed by the server and no\n response will be returned.\n"]
3105    fn take_application_activity_lease(
3106        &mut self,
3107
3108        request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3109
3110        responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3111    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3112
3113    #[doc = " Registers a suspend blocker.\n\n On successful registration, a wake lease token is returned. This token\n prevents hardware platform suspension while it exists. Clients are\n expected to perform any initialization of the given `suspend_blocker`\n server while holding this token. Additionally, this means the first call\n `suspend_blocker` will get is `BeforeSuspend`.\n\n To unregister, close the `SuspendBlocker` channel.\n\n If any required field of the table is missing, the error\n [`RegisterSuspendBlockerError.INVALID_ARGS`] is returned.\n\n If an error occurs while registering `suspend_blocker`, it will be\n dropped, closing the channel.\n"]
3114    fn register_suspend_blocker(
3115        &mut self,
3116
3117        request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3118
3119        responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3120    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3121
3122    fn on_unknown_interaction(
3123        &mut self,
3124        ordinal: u64,
3125    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3126        ::core::future::ready(())
3127    }
3128}
3129
3130impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ActivityGovernor
3131where
3132    ___H: ActivityGovernorServerHandler<___T> + ::core::marker::Send,
3133    ___T: ::fidl_next::Transport,
3134
3135
3136
3137
3138            for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'de>: ::fidl_next::Decode<
3139                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3140                Constraint = (),
3141            >,
3142
3143
3144
3145            for<'de> crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'de>: ::fidl_next::Decode<
3146                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3147                Constraint = (),
3148            >,
3149
3150
3151
3152            for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>: ::fidl_next::Decode<
3153                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3154                Constraint = (),
3155            >,
3156
3157
3158
3159            for<'de> crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'de>: ::fidl_next::Decode<
3160                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3161                Constraint = (),
3162            >,
3163
3164
3165
3166            for<'de> crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>: ::fidl_next::Decode<
3167                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3168                Constraint = (),
3169            >,
3170
3171
3172{
3173    async fn on_one_way(
3174        handler: &mut ___H,
3175        mut message: ::fidl_next::Message<___T>,
3176    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3177        match *message.header().ordinal {
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197            ordinal => {
3198
3199                    handler.on_unknown_interaction(ordinal).await;
3200                    if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3201                        Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3202                    } else {
3203                        Ok(())
3204                    }
3205
3206            }
3207        }
3208    }
3209
3210    async fn on_two_way(
3211        handler: &mut ___H,
3212        mut message: ::fidl_next::Message<___T>,
3213        responder: ::fidl_next::protocol::Responder<___T>,
3214    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3215        match *message.header().ordinal {
3216
3217
3218
3219                    8755001135707412082 => {
3220                        let responder = ::fidl_next::Responder::from_untyped(responder);
3221
3222                            handler.get_power_elements(responder).await;
3223                            Ok(())
3224
3225                    }
3226
3227
3228
3229
3230                    3306304846648819971 => {
3231                        let responder = ::fidl_next::Responder::from_untyped(responder);
3232
3233                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
3234                                Ok(decoded) => {
3235                                    handler.acquire_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3236                                    Ok(())
3237                                }
3238                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3239                                    ordinal: 3306304846648819971,
3240                                    error,
3241                                }),
3242                            }
3243
3244                    }
3245
3246
3247
3248
3249                    6877005249659825577 => {
3250                        let responder = ::fidl_next::Responder::from_untyped(responder);
3251
3252                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
3253                                Ok(decoded) => {
3254                                    handler.acquire_unmonitored_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3255                                    Ok(())
3256                                }
3257                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3258                                    ordinal: 6877005249659825577,
3259                                    error,
3260                                }),
3261                            }
3262
3263                    }
3264
3265
3266
3267
3268                    2079869883732225873 => {
3269                        let responder = ::fidl_next::Responder::from_untyped(responder);
3270
3271                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
3272                                Ok(decoded) => {
3273                                    handler.acquire_wake_lease_with_token(::fidl_next::Request::from_decoded(decoded), responder).await;
3274                                    Ok(())
3275                                }
3276                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3277                                    ordinal: 2079869883732225873,
3278                                    error,
3279                                }),
3280                            }
3281
3282                    }
3283
3284
3285
3286
3287                    4020961735006149140 => {
3288                        let responder = ::fidl_next::Responder::from_untyped(responder);
3289
3290                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
3291                                Ok(decoded) => {
3292                                    handler.take_application_activity_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3293                                    Ok(())
3294                                }
3295                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3296                                    ordinal: 4020961735006149140,
3297                                    error,
3298                                }),
3299                            }
3300
3301                    }
3302
3303
3304
3305
3306                    3814361630267862785 => {
3307                        let responder = ::fidl_next::Responder::from_untyped(responder);
3308
3309                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
3310                                Ok(decoded) => {
3311                                    handler.register_suspend_blocker(::fidl_next::Request::from_decoded(decoded), responder).await;
3312                                    Ok(())
3313                                }
3314                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3315                                    ordinal: 3814361630267862785,
3316                                    error,
3317                                }),
3318                            }
3319
3320                    }
3321
3322
3323            ordinal => {
3324
3325                        handler.on_unknown_interaction(ordinal).await;
3326                        if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3327                            Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3328                        } else {
3329                            responder.respond_framework_error(
3330                                ordinal,
3331                                ::fidl_next::FrameworkError::UnknownMethod,
3332                            )
3333                            .expect("encoding a framework error should never fail")
3334                            .await?;
3335                            Ok(())
3336                        }
3337
3338            }
3339        }
3340    }
3341}
3342
3343impl<___T> ActivityGovernorClientHandler<___T> for ::fidl_next::IgnoreEvents
3344where
3345    ___T: ::fidl_next::Transport,
3346{
3347    async fn on_unknown_interaction(&mut self, _: u64) {}
3348}
3349
3350impl<___H, ___T> ActivityGovernorLocalClientHandler<___T> for ::fidl_next::Local<___H>
3351where
3352    ___H: ActivityGovernorClientHandler<___T>,
3353    ___T: ::fidl_next::Transport,
3354{
3355    async fn on_unknown_interaction(&mut self, ordinal: u64) {
3356        ___H::on_unknown_interaction(&mut self.0, ordinal).await
3357    }
3358}
3359
3360impl<___H, ___T> ActivityGovernorLocalServerHandler<___T> for ::fidl_next::Local<___H>
3361where
3362    ___H: ActivityGovernorServerHandler<___T>,
3363    ___T: ::fidl_next::Transport,
3364{
3365    async fn get_power_elements(
3366        &mut self,
3367
3368        responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
3369    ) {
3370        ___H::get_power_elements(&mut self.0, responder).await
3371    }
3372
3373    async fn acquire_wake_lease(
3374        &mut self,
3375
3376        request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3377
3378        responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3379    ) {
3380        ___H::acquire_wake_lease(&mut self.0, request, responder).await
3381    }
3382
3383    async fn acquire_unmonitored_wake_lease(
3384        &mut self,
3385
3386        request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3387
3388        responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3389    ) {
3390        ___H::acquire_unmonitored_wake_lease(&mut self.0, request, responder).await
3391    }
3392
3393    async fn acquire_wake_lease_with_token(
3394        &mut self,
3395
3396        request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3397
3398        responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3399    ) {
3400        ___H::acquire_wake_lease_with_token(&mut self.0, request, responder).await
3401    }
3402
3403    async fn take_application_activity_lease(
3404        &mut self,
3405
3406        request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3407
3408        responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3409    ) {
3410        ___H::take_application_activity_lease(&mut self.0, request, responder).await
3411    }
3412
3413    async fn register_suspend_blocker(
3414        &mut self,
3415
3416        request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3417
3418        responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3419    ) {
3420        ___H::register_suspend_blocker(&mut self.0, request, responder).await
3421    }
3422
3423    async fn on_unknown_interaction(&mut self, ordinal: u64) {
3424        ___H::on_unknown_interaction(&mut self.0, ordinal).await
3425    }
3426}
3427
3428/// The type corresponding to the CpuElementManager protocol.
3429#[doc = " A service that provides access to CPU-related power elements.\n"]
3430#[derive(PartialEq, Debug)]
3431pub struct CpuElementManager;
3432
3433impl ::fidl_next::Discoverable for CpuElementManager {
3434    const PROTOCOL_NAME: &'static str = "fuchsia.power.system.CpuElementManager";
3435}
3436
3437#[cfg(target_os = "fuchsia")]
3438impl ::fidl_next::HasTransport for CpuElementManager {
3439    type Transport = ::fidl_next::fuchsia::zx::Channel;
3440}
3441
3442pub mod cpu_element_manager {
3443    pub mod prelude {
3444        pub use crate::{
3445            CpuElementManager, CpuElementManagerClientHandler, CpuElementManagerLocalClientHandler,
3446            CpuElementManagerLocalServerHandler, CpuElementManagerServerHandler,
3447            cpu_element_manager,
3448        };
3449
3450        pub use crate::natural::AddExecutionStateDependencyError;
3451
3452        pub use crate::natural::Cpu;
3453
3454        pub use crate::natural::CpuElementManagerAddExecutionStateDependencyRequest;
3455
3456        pub use crate::natural::CpuElementManagerAddExecutionStateDependencyResponse;
3457    }
3458
3459    pub struct GetCpuDependencyToken;
3460
3461    impl ::fidl_next::Method for GetCpuDependencyToken {
3462        const ORDINAL: u64 = 3189503319605462202;
3463        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3464            ::fidl_next::protocol::Flexibility::Flexible;
3465
3466        type Protocol = crate::CpuElementManager;
3467
3468        type Request = ::fidl_next::wire::EmptyMessageBody;
3469    }
3470
3471    impl ::fidl_next::TwoWayMethod for GetCpuDependencyToken {
3472        type Response = ::fidl_next::wire::Flexible<'static, crate::wire::Cpu<'static>>;
3473    }
3474
3475    impl<___R> ::fidl_next::Respond<___R> for GetCpuDependencyToken {
3476        type Output = ::fidl_next::Flexible<___R>;
3477
3478        fn respond(response: ___R) -> Self::Output {
3479            ::fidl_next::Flexible(response)
3480        }
3481    }
3482
3483    pub struct AddExecutionStateDependency;
3484
3485    impl ::fidl_next::Method for AddExecutionStateDependency {
3486        const ORDINAL: u64 = 1005136052949049908;
3487        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3488            ::fidl_next::protocol::Flexibility::Flexible;
3489
3490        type Protocol = crate::CpuElementManager;
3491
3492        type Request = crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>;
3493    }
3494
3495    impl ::fidl_next::TwoWayMethod for AddExecutionStateDependency {
3496        type Response = ::fidl_next::wire::Result<
3497            'static,
3498            crate::wire::CpuElementManagerAddExecutionStateDependencyResponse,
3499            crate::wire::AddExecutionStateDependencyError,
3500        >;
3501    }
3502
3503    impl<___R> ::fidl_next::Respond<___R> for AddExecutionStateDependency {
3504        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
3505
3506        fn respond(response: ___R) -> Self::Output {
3507            ::core::result::Result::Ok(response)
3508        }
3509    }
3510
3511    impl<___R> ::fidl_next::RespondErr<___R> for AddExecutionStateDependency {
3512        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3513
3514        fn respond_err(response: ___R) -> Self::Output {
3515            ::core::result::Result::Err(response)
3516        }
3517    }
3518
3519    mod ___detail {
3520        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::CpuElementManager
3521        where
3522            ___T: ::fidl_next::Transport,
3523        {
3524            type Client = CpuElementManagerClient<___T>;
3525            type Server = CpuElementManagerServer<___T>;
3526        }
3527
3528        /// The client for the `CpuElementManager` protocol.
3529        #[repr(transparent)]
3530        pub struct CpuElementManagerClient<___T: ::fidl_next::Transport> {
3531            #[allow(dead_code)]
3532            client: ::fidl_next::protocol::Client<___T>,
3533        }
3534
3535        impl<___T> CpuElementManagerClient<___T>
3536        where
3537            ___T: ::fidl_next::Transport,
3538        {
3539            #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
3540            pub fn get_cpu_dependency_token(
3541                &self,
3542            ) -> ::fidl_next::TwoWayFuture<'_, super::GetCpuDependencyToken, ___T> {
3543                ::fidl_next::TwoWayFuture::from_untyped(
3544                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
3545                        3189503319605462202,
3546                        <super::GetCpuDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3547                        (),
3548                    ),
3549                )
3550            }
3551
3552            #[doc = " Adds a dependency from the Execution State power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n\n Once the Execution State power element is created, future calls will\n return [`fuchsia.power.system/AddExecutionStateDependencyError.BAD_STATE`]\n and no changes to Execution State dependencies will be made.\n\n If any required entries in the request are missing, the server will\n return [`fuchsia.power.system/AddExecutionStateDependencyError.INVALID_ARGS`].\n"]
3553            pub fn add_execution_state_dependency_with<___R>(
3554                &self,
3555                request: ___R,
3556            ) -> ::fidl_next::TwoWayFuture<'_, super::AddExecutionStateDependency, ___T>
3557            where
3558                ___R: ::fidl_next::Encode<
3559                        crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
3560                        <___T as ::fidl_next::Transport>::SendBuffer,
3561                    >,
3562            {
3563                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3564                    1005136052949049908,
3565                    <super::AddExecutionStateDependency as ::fidl_next::Method>::FLEXIBILITY,
3566                    request,
3567                ))
3568            }
3569        }
3570
3571        /// The server for the `CpuElementManager` protocol.
3572        #[repr(transparent)]
3573        pub struct CpuElementManagerServer<___T: ::fidl_next::Transport> {
3574            server: ::fidl_next::protocol::Server<___T>,
3575        }
3576
3577        impl<___T> CpuElementManagerServer<___T> where ___T: ::fidl_next::Transport {}
3578    }
3579}
3580
3581#[diagnostic::on_unimplemented(
3582    note = "If {Self} implements the non-local CpuElementManagerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3583)]
3584
3585/// A client handler for the CpuElementManager protocol.
3586///
3587/// See [`CpuElementManager`] for more details.
3588pub trait CpuElementManagerLocalClientHandler<
3589    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3590    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3591>
3592{
3593    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3594        ::core::future::ready(())
3595    }
3596}
3597
3598impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for CpuElementManager
3599where
3600    ___H: CpuElementManagerLocalClientHandler<___T>,
3601    ___T: ::fidl_next::Transport,
3602{
3603    async fn on_event(
3604        handler: &mut ___H,
3605        mut message: ::fidl_next::Message<___T>,
3606    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3607        match *message.header().ordinal {
3608            ordinal => {
3609                handler.on_unknown_interaction(ordinal).await;
3610                if ::core::matches!(
3611                    message.header().flexibility(),
3612                    ::fidl_next::protocol::Flexibility::Strict
3613                ) {
3614                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3615                } else {
3616                    Ok(())
3617                }
3618            }
3619        }
3620    }
3621}
3622
3623#[diagnostic::on_unimplemented(
3624    note = "If {Self} implements the non-local CpuElementManagerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3625)]
3626
3627/// A server handler for the CpuElementManager protocol.
3628///
3629/// See [`CpuElementManager`] for more details.
3630pub trait CpuElementManagerLocalServerHandler<
3631    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3632    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3633>
3634{
3635    #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
3636    fn get_cpu_dependency_token(
3637        &mut self,
3638
3639        responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
3640    ) -> impl ::core::future::Future<Output = ()>;
3641
3642    #[doc = " Adds a dependency from the Execution State power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n\n Once the Execution State power element is created, future calls will\n return [`fuchsia.power.system/AddExecutionStateDependencyError.BAD_STATE`]\n and no changes to Execution State dependencies will be made.\n\n If any required entries in the request are missing, the server will\n return [`fuchsia.power.system/AddExecutionStateDependencyError.INVALID_ARGS`].\n"]
3643    fn add_execution_state_dependency(
3644        &mut self,
3645
3646        request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
3647
3648        responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
3649    ) -> impl ::core::future::Future<Output = ()>;
3650
3651    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3652        ::core::future::ready(())
3653    }
3654}
3655
3656impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for CpuElementManager
3657where
3658    ___H: CpuElementManagerLocalServerHandler<___T> ,
3659    ___T: ::fidl_next::Transport,
3660
3661
3662
3663
3664            for<'de> crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>: ::fidl_next::Decode<
3665                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3666                Constraint = (),
3667            >,
3668
3669
3670{
3671    async fn on_one_way(
3672        handler: &mut ___H,
3673        mut message: ::fidl_next::Message<___T>,
3674    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3675        match *message.header().ordinal {
3676
3677
3678
3679
3680
3681
3682
3683            ordinal => {
3684
3685                    handler.on_unknown_interaction(ordinal).await;
3686                    if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3687                        Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3688                    } else {
3689                        Ok(())
3690                    }
3691
3692            }
3693        }
3694    }
3695
3696    async fn on_two_way(
3697        handler: &mut ___H,
3698        mut message: ::fidl_next::Message<___T>,
3699        responder: ::fidl_next::protocol::Responder<___T>,
3700    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3701        match *message.header().ordinal {
3702
3703
3704
3705                    3189503319605462202 => {
3706                        let responder = ::fidl_next::Responder::from_untyped(responder);
3707
3708                            handler.get_cpu_dependency_token(responder).await;
3709                            Ok(())
3710
3711                    }
3712
3713
3714
3715
3716                    1005136052949049908 => {
3717                        let responder = ::fidl_next::Responder::from_untyped(responder);
3718
3719                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
3720                                Ok(decoded) => {
3721                                    handler.add_execution_state_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
3722                                    Ok(())
3723                                }
3724                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3725                                    ordinal: 1005136052949049908,
3726                                    error,
3727                                }),
3728                            }
3729
3730                    }
3731
3732
3733            ordinal => {
3734
3735                        handler.on_unknown_interaction(ordinal).await;
3736                        if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3737                            Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3738                        } else {
3739                            responder.respond_framework_error(
3740                                ordinal,
3741                                ::fidl_next::FrameworkError::UnknownMethod,
3742                            )
3743                            .expect("encoding a framework error should never fail")
3744                            .await?;
3745                            Ok(())
3746                        }
3747
3748            }
3749        }
3750    }
3751}
3752
3753/// A client handler for the CpuElementManager protocol.
3754///
3755/// See [`CpuElementManager`] for more details.
3756pub trait CpuElementManagerClientHandler<
3757    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3758    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3759>
3760{
3761    fn on_unknown_interaction(
3762        &mut self,
3763        ordinal: u64,
3764    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3765        ::core::future::ready(())
3766    }
3767}
3768
3769impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for CpuElementManager
3770where
3771    ___H: CpuElementManagerClientHandler<___T> + ::core::marker::Send,
3772    ___T: ::fidl_next::Transport,
3773{
3774    async fn on_event(
3775        handler: &mut ___H,
3776        mut message: ::fidl_next::Message<___T>,
3777    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3778        match *message.header().ordinal {
3779            ordinal => {
3780                handler.on_unknown_interaction(ordinal).await;
3781                if ::core::matches!(
3782                    message.header().flexibility(),
3783                    ::fidl_next::protocol::Flexibility::Strict
3784                ) {
3785                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3786                } else {
3787                    Ok(())
3788                }
3789            }
3790        }
3791    }
3792}
3793
3794/// A server handler for the CpuElementManager protocol.
3795///
3796/// See [`CpuElementManager`] for more details.
3797pub trait CpuElementManagerServerHandler<
3798    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3799    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3800>
3801{
3802    #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
3803    fn get_cpu_dependency_token(
3804        &mut self,
3805
3806        responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
3807    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3808
3809    #[doc = " Adds a dependency from the Execution State power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n\n Once the Execution State power element is created, future calls will\n return [`fuchsia.power.system/AddExecutionStateDependencyError.BAD_STATE`]\n and no changes to Execution State dependencies will be made.\n\n If any required entries in the request are missing, the server will\n return [`fuchsia.power.system/AddExecutionStateDependencyError.INVALID_ARGS`].\n"]
3810    fn add_execution_state_dependency(
3811        &mut self,
3812
3813        request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
3814
3815        responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
3816    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3817
3818    fn on_unknown_interaction(
3819        &mut self,
3820        ordinal: u64,
3821    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3822        ::core::future::ready(())
3823    }
3824}
3825
3826impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for CpuElementManager
3827where
3828    ___H: CpuElementManagerServerHandler<___T> + ::core::marker::Send,
3829    ___T: ::fidl_next::Transport,
3830
3831
3832
3833
3834            for<'de> crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>: ::fidl_next::Decode<
3835                <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3836                Constraint = (),
3837            >,
3838
3839
3840{
3841    async fn on_one_way(
3842        handler: &mut ___H,
3843        mut message: ::fidl_next::Message<___T>,
3844    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3845        match *message.header().ordinal {
3846
3847
3848
3849
3850
3851
3852
3853            ordinal => {
3854
3855                    handler.on_unknown_interaction(ordinal).await;
3856                    if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3857                        Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3858                    } else {
3859                        Ok(())
3860                    }
3861
3862            }
3863        }
3864    }
3865
3866    async fn on_two_way(
3867        handler: &mut ___H,
3868        mut message: ::fidl_next::Message<___T>,
3869        responder: ::fidl_next::protocol::Responder<___T>,
3870    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3871        match *message.header().ordinal {
3872
3873
3874
3875                    3189503319605462202 => {
3876                        let responder = ::fidl_next::Responder::from_untyped(responder);
3877
3878                            handler.get_cpu_dependency_token(responder).await;
3879                            Ok(())
3880
3881                    }
3882
3883
3884
3885
3886                    1005136052949049908 => {
3887                        let responder = ::fidl_next::Responder::from_untyped(responder);
3888
3889                            match ::fidl_next::AsDecoderExt::into_decoded(message) {
3890                                Ok(decoded) => {
3891                                    handler.add_execution_state_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
3892                                    Ok(())
3893                                }
3894                                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3895                                    ordinal: 1005136052949049908,
3896                                    error,
3897                                }),
3898                            }
3899
3900                    }
3901
3902
3903            ordinal => {
3904
3905                        handler.on_unknown_interaction(ordinal).await;
3906                        if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3907                            Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3908                        } else {
3909                            responder.respond_framework_error(
3910                                ordinal,
3911                                ::fidl_next::FrameworkError::UnknownMethod,
3912                            )
3913                            .expect("encoding a framework error should never fail")
3914                            .await?;
3915                            Ok(())
3916                        }
3917
3918            }
3919        }
3920    }
3921}
3922
3923impl<___T> CpuElementManagerClientHandler<___T> for ::fidl_next::IgnoreEvents
3924where
3925    ___T: ::fidl_next::Transport,
3926{
3927    async fn on_unknown_interaction(&mut self, _: u64) {}
3928}
3929
3930impl<___H, ___T> CpuElementManagerLocalClientHandler<___T> for ::fidl_next::Local<___H>
3931where
3932    ___H: CpuElementManagerClientHandler<___T>,
3933    ___T: ::fidl_next::Transport,
3934{
3935    async fn on_unknown_interaction(&mut self, ordinal: u64) {
3936        ___H::on_unknown_interaction(&mut self.0, ordinal).await
3937    }
3938}
3939
3940impl<___H, ___T> CpuElementManagerLocalServerHandler<___T> for ::fidl_next::Local<___H>
3941where
3942    ___H: CpuElementManagerServerHandler<___T>,
3943    ___T: ::fidl_next::Transport,
3944{
3945    async fn get_cpu_dependency_token(
3946        &mut self,
3947
3948        responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
3949    ) {
3950        ___H::get_cpu_dependency_token(&mut self.0, responder).await
3951    }
3952
3953    async fn add_execution_state_dependency(
3954        &mut self,
3955
3956        request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
3957
3958        responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
3959    ) {
3960        ___H::add_execution_state_dependency(&mut self.0, request, responder).await
3961    }
3962
3963    async fn on_unknown_interaction(&mut self, ordinal: u64) {
3964        ___H::on_unknown_interaction(&mut self.0, ordinal).await
3965    }
3966}
3967
3968pub use fidl_next_common_fuchsia_power_system::*;