1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 pub use fidl_next_common_fuchsia_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 #[doc = " Holds the dependency token for the Execution State power element.\n"]
1046 #[derive(Debug, Default, PartialEq)]
1047 pub struct ExecutionState {
1048 pub dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1049 }
1050
1051 impl ExecutionState {
1052 fn __max_ordinal(&self) -> usize {
1053 if self.dependency_token.is_some() {
1054 return 1;
1055 }
1056
1057 0
1058 }
1059 }
1060
1061 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ExecutionState<'static>, ___E> for ExecutionState
1062 where
1063 ___E: ::fidl_next::Encoder + ?Sized,
1064 ___E: ::fidl_next::fuchsia::HandleEncoder,
1065 {
1066 #[inline]
1067 fn encode(
1068 mut self,
1069 encoder: &mut ___E,
1070 out: &mut ::core::mem::MaybeUninit<crate::wire::ExecutionState<'static>>,
1071 _: (),
1072 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1073 ::fidl_next::munge!(let crate::wire::ExecutionState { table } = out);
1074
1075 let max_ord = self.__max_ordinal();
1076
1077 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1078 ::fidl_next::Wire::zero_padding(&mut out);
1079
1080 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1081 ::fidl_next::wire::Envelope,
1082 >(encoder, max_ord);
1083
1084 for i in 1..=max_ord {
1085 match i {
1086 1 => {
1087 if let Some(value) = self.dependency_token.take() {
1088 ::fidl_next::wire::Envelope::encode_value::<
1089 ::fidl_next::wire::fuchsia::Event,
1090 ___E,
1091 >(
1092 value, preallocated.encoder, &mut out, ()
1093 )?;
1094 } else {
1095 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1096 }
1097 }
1098
1099 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1100 }
1101 unsafe {
1102 preallocated.write_next(out.assume_init_ref());
1103 }
1104 }
1105
1106 ::fidl_next::wire::Table::encode_len(table, max_ord);
1107
1108 Ok(())
1109 }
1110 }
1111
1112 impl<'de> ::fidl_next::FromWire<crate::wire::ExecutionState<'de>> for ExecutionState {
1113 #[inline]
1114 fn from_wire(wire_: crate::wire::ExecutionState<'de>) -> Self {
1115 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1116
1117 let dependency_token = wire_.table.get(1);
1118
1119 Self {
1120 dependency_token: dependency_token.map(|envelope| {
1121 ::fidl_next::FromWire::from_wire(unsafe {
1122 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1123 })
1124 }),
1125 }
1126 }
1127 }
1128
1129 #[derive(Debug, Default, PartialEq)]
1130 pub struct ExecutionStateManagerAddApplicationActivityDependencyRequest {
1131 pub dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1132
1133 pub power_level: ::core::option::Option<u8>,
1134 }
1135
1136 impl ExecutionStateManagerAddApplicationActivityDependencyRequest {
1137 fn __max_ordinal(&self) -> usize {
1138 if self.power_level.is_some() {
1139 return 2;
1140 }
1141
1142 if self.dependency_token.is_some() {
1143 return 1;
1144 }
1145
1146 0
1147 }
1148 }
1149
1150 unsafe impl<___E>
1151 ::fidl_next::Encode<
1152 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'static>,
1153 ___E,
1154 > for ExecutionStateManagerAddApplicationActivityDependencyRequest
1155 where
1156 ___E: ::fidl_next::Encoder + ?Sized,
1157 ___E: ::fidl_next::fuchsia::HandleEncoder,
1158 {
1159 #[inline]
1160 fn encode(
1161 mut self,
1162 encoder: &mut ___E,
1163 out: &mut ::core::mem::MaybeUninit<
1164 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'static>,
1165 >,
1166 _: (),
1167 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1168 ::fidl_next::munge!(let crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest { table } = out);
1169
1170 let max_ord = self.__max_ordinal();
1171
1172 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1173 ::fidl_next::Wire::zero_padding(&mut out);
1174
1175 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1176 ::fidl_next::wire::Envelope,
1177 >(encoder, max_ord);
1178
1179 for i in 1..=max_ord {
1180 match i {
1181 2 => {
1182 if let Some(value) = self.power_level.take() {
1183 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1184 value,
1185 preallocated.encoder,
1186 &mut out,
1187 (),
1188 )?;
1189 } else {
1190 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1191 }
1192 }
1193
1194 1 => {
1195 if let Some(value) = self.dependency_token.take() {
1196 ::fidl_next::wire::Envelope::encode_value::<
1197 ::fidl_next::wire::fuchsia::Event,
1198 ___E,
1199 >(
1200 value, preallocated.encoder, &mut out, ()
1201 )?;
1202 } else {
1203 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1204 }
1205 }
1206
1207 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1208 }
1209 unsafe {
1210 preallocated.write_next(out.assume_init_ref());
1211 }
1212 }
1213
1214 ::fidl_next::wire::Table::encode_len(table, max_ord);
1215
1216 Ok(())
1217 }
1218 }
1219
1220 impl<'de>
1221 ::fidl_next::FromWire<
1222 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>,
1223 > for ExecutionStateManagerAddApplicationActivityDependencyRequest
1224 {
1225 #[inline]
1226 fn from_wire(
1227 wire_: crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>,
1228 ) -> Self {
1229 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1230
1231 let dependency_token = wire_.table.get(1);
1232
1233 let power_level = wire_.table.get(2);
1234
1235 Self {
1236 dependency_token: dependency_token.map(|envelope| {
1237 ::fidl_next::FromWire::from_wire(unsafe {
1238 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1239 })
1240 }),
1241
1242 power_level: power_level.map(|envelope| {
1243 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
1244 }),
1245 }
1246 }
1247 }
1248}
1249
1250pub mod wire {
1251
1252 pub use fidl_next_common_fuchsia_power_system::wire::*;
1253
1254 pub type LeaseToken = ::fidl_next::wire::fuchsia::EventPair;
1256
1257 #[derive(Debug)]
1259 #[repr(C)]
1260 pub struct ActivityGovernorAcquireWakeLeaseResponse {
1261 pub token: ::fidl_next::wire::fuchsia::EventPair,
1262 }
1263
1264 static_assertions::const_assert_eq!(
1265 std::mem::size_of::<ActivityGovernorAcquireWakeLeaseResponse>(),
1266 4
1267 );
1268 static_assertions::const_assert_eq!(
1269 std::mem::align_of::<ActivityGovernorAcquireWakeLeaseResponse>(),
1270 4
1271 );
1272
1273 static_assertions::const_assert_eq!(
1274 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseResponse, token),
1275 0
1276 );
1277
1278 impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLeaseResponse {
1279 type Constraint = ();
1280
1281 fn validate(
1282 _: ::fidl_next::Slot<'_, Self>,
1283 _: Self::Constraint,
1284 ) -> Result<(), ::fidl_next::ValidationError> {
1285 Ok(())
1286 }
1287 }
1288
1289 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLeaseResponse {
1290 type Narrowed<'de> = ActivityGovernorAcquireWakeLeaseResponse;
1291
1292 #[inline]
1293 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1294 ::fidl_next::munge! {
1295 let Self {
1296 token,
1297
1298 } = &mut *out_;
1299 }
1300
1301 ::fidl_next::Wire::zero_padding(token);
1302 }
1303 }
1304
1305 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireWakeLeaseResponse
1306 where
1307 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1308 ___D: ::fidl_next::fuchsia::HandleDecoder,
1309 {
1310 fn decode(
1311 slot_: ::fidl_next::Slot<'_, Self>,
1312 decoder_: &mut ___D,
1313 _: (),
1314 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1315 ::fidl_next::munge! {
1316 let Self {
1317 mut token,
1318
1319 } = slot_;
1320 }
1321
1322 let _field = token.as_mut();
1323
1324 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1325
1326 Ok(())
1327 }
1328 }
1329
1330 impl ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLeaseResponse {
1331 type Natural = crate::natural::ActivityGovernorAcquireWakeLeaseResponse;
1332 }
1333
1334 #[repr(C)]
1336 pub struct ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1337 pub(crate) table: ::fidl_next::wire::Table<'de>,
1338 }
1339
1340 impl<'de> Drop for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1341 fn drop(&mut self) {
1342 let _ = self.table.get(1).map(|envelope| unsafe {
1343 envelope.read_unchecked::<::fidl_next::ClientEnd<
1344 crate::SuspendBlocker,
1345 ::fidl_next::wire::fuchsia::Channel,
1346 >>()
1347 });
1348
1349 let _ = self.table.get(2).map(|envelope| unsafe {
1350 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
1351 });
1352 }
1353 }
1354
1355 impl ::fidl_next::Constrained for ActivityGovernorRegisterSuspendBlockerRequest<'_> {
1356 type Constraint = ();
1357
1358 fn validate(
1359 _: ::fidl_next::Slot<'_, Self>,
1360 _: Self::Constraint,
1361 ) -> Result<(), ::fidl_next::ValidationError> {
1362 Ok(())
1363 }
1364 }
1365
1366 unsafe impl ::fidl_next::Wire for ActivityGovernorRegisterSuspendBlockerRequest<'static> {
1367 type Narrowed<'de> = ActivityGovernorRegisterSuspendBlockerRequest<'de>;
1368
1369 #[inline]
1370 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1371 ::fidl_next::munge!(let Self { table } = out);
1372 ::fidl_next::wire::Table::zero_padding(table);
1373 }
1374 }
1375
1376 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1377 for ActivityGovernorRegisterSuspendBlockerRequest<'de>
1378 where
1379 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1380 ___D: ::fidl_next::fuchsia::HandleDecoder,
1381 {
1382 fn decode(
1383 slot: ::fidl_next::Slot<'_, Self>,
1384 decoder: &mut ___D,
1385 _: (),
1386 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1387 ::fidl_next::munge!(let Self { table } = slot);
1388
1389 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1390 match ordinal {
1391 0 => unsafe { ::core::hint::unreachable_unchecked() },
1392
1393 1 => {
1394 ::fidl_next::wire::Envelope::decode_as::<
1395 ___D,
1396 ::fidl_next::ClientEnd<
1397 crate::SuspendBlocker,
1398 ::fidl_next::wire::fuchsia::Channel,
1399 >,
1400 >(slot.as_mut(), decoder, ())?;
1401
1402 Ok(())
1403 }
1404
1405 2 => {
1406 ::fidl_next::wire::Envelope::decode_as::<
1407 ___D,
1408 ::fidl_next::wire::String<'de>,
1409 >(slot.as_mut(), decoder, 64)?;
1410
1411 let value = unsafe {
1412 slot.deref_unchecked()
1413 .deref_unchecked::<::fidl_next::wire::String<'_>>()
1414 };
1415
1416 if value.len() > 64 {
1417 return Err(::fidl_next::DecodeError::VectorTooLong {
1418 size: value.len() as u64,
1419 limit: 64,
1420 });
1421 }
1422
1423 Ok(())
1424 }
1425
1426 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1427 }
1428 })
1429 }
1430 }
1431
1432 impl<'de> ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1433 pub fn suspend_blocker(
1434 &self,
1435 ) -> ::core::option::Option<
1436 &::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::wire::fuchsia::Channel>,
1437 > {
1438 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1439 }
1440
1441 pub fn take_suspend_blocker(
1442 &mut self,
1443 ) -> ::core::option::Option<
1444 ::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::wire::fuchsia::Channel>,
1445 > {
1446 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1447 }
1448
1449 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
1450 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1451 }
1452
1453 pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
1454 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
1455 }
1456 }
1457
1458 impl<'de> ::core::fmt::Debug for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1459 fn fmt(
1460 &self,
1461 f: &mut ::core::fmt::Formatter<'_>,
1462 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1463 f.debug_struct("ActivityGovernorRegisterSuspendBlockerRequest")
1464 .field("suspend_blocker", &self.suspend_blocker())
1465 .field("name", &self.name())
1466 .finish()
1467 }
1468 }
1469
1470 impl<'de> ::fidl_next::IntoNatural for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1471 type Natural = crate::natural::ActivityGovernorRegisterSuspendBlockerRequest;
1472 }
1473
1474 #[derive(Debug)]
1476 #[repr(C)]
1477 pub struct ActivityGovernorRegisterSuspendBlockerResponse {
1478 pub token: ::fidl_next::wire::fuchsia::EventPair,
1479 }
1480
1481 static_assertions::const_assert_eq!(
1482 std::mem::size_of::<ActivityGovernorRegisterSuspendBlockerResponse>(),
1483 4
1484 );
1485 static_assertions::const_assert_eq!(
1486 std::mem::align_of::<ActivityGovernorRegisterSuspendBlockerResponse>(),
1487 4
1488 );
1489
1490 static_assertions::const_assert_eq!(
1491 std::mem::offset_of!(ActivityGovernorRegisterSuspendBlockerResponse, token),
1492 0
1493 );
1494
1495 impl ::fidl_next::Constrained for ActivityGovernorRegisterSuspendBlockerResponse {
1496 type Constraint = ();
1497
1498 fn validate(
1499 _: ::fidl_next::Slot<'_, Self>,
1500 _: Self::Constraint,
1501 ) -> Result<(), ::fidl_next::ValidationError> {
1502 Ok(())
1503 }
1504 }
1505
1506 unsafe impl ::fidl_next::Wire for ActivityGovernorRegisterSuspendBlockerResponse {
1507 type Narrowed<'de> = ActivityGovernorRegisterSuspendBlockerResponse;
1508
1509 #[inline]
1510 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1511 ::fidl_next::munge! {
1512 let Self {
1513 token,
1514
1515 } = &mut *out_;
1516 }
1517
1518 ::fidl_next::Wire::zero_padding(token);
1519 }
1520 }
1521
1522 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorRegisterSuspendBlockerResponse
1523 where
1524 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1525 ___D: ::fidl_next::fuchsia::HandleDecoder,
1526 {
1527 fn decode(
1528 slot_: ::fidl_next::Slot<'_, Self>,
1529 decoder_: &mut ___D,
1530 _: (),
1531 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1532 ::fidl_next::munge! {
1533 let Self {
1534 mut token,
1535
1536 } = slot_;
1537 }
1538
1539 let _field = token.as_mut();
1540
1541 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1542
1543 Ok(())
1544 }
1545 }
1546
1547 impl ::fidl_next::IntoNatural for ActivityGovernorRegisterSuspendBlockerResponse {
1548 type Natural = crate::natural::ActivityGovernorRegisterSuspendBlockerResponse;
1549 }
1550
1551 #[repr(C)]
1553 pub struct ApplicationActivity<'de> {
1554 pub(crate) table: ::fidl_next::wire::Table<'de>,
1555 }
1556
1557 impl<'de> Drop for ApplicationActivity<'de> {
1558 fn drop(&mut self) {
1559 let _ = self.table.get(1).map(|envelope| unsafe {
1560 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1561 });
1562 }
1563 }
1564
1565 impl ::fidl_next::Constrained for ApplicationActivity<'_> {
1566 type Constraint = ();
1567
1568 fn validate(
1569 _: ::fidl_next::Slot<'_, Self>,
1570 _: Self::Constraint,
1571 ) -> Result<(), ::fidl_next::ValidationError> {
1572 Ok(())
1573 }
1574 }
1575
1576 unsafe impl ::fidl_next::Wire for ApplicationActivity<'static> {
1577 type Narrowed<'de> = ApplicationActivity<'de>;
1578
1579 #[inline]
1580 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1581 ::fidl_next::munge!(let Self { table } = out);
1582 ::fidl_next::wire::Table::zero_padding(table);
1583 }
1584 }
1585
1586 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ApplicationActivity<'de>
1587 where
1588 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1589 ___D: ::fidl_next::fuchsia::HandleDecoder,
1590 {
1591 fn decode(
1592 slot: ::fidl_next::Slot<'_, Self>,
1593 decoder: &mut ___D,
1594 _: (),
1595 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1596 ::fidl_next::munge!(let Self { table } = slot);
1597
1598 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1599 match ordinal {
1600 0 => unsafe { ::core::hint::unreachable_unchecked() },
1601
1602 1 => {
1603 ::fidl_next::wire::Envelope::decode_as::<
1604 ___D,
1605 ::fidl_next::wire::fuchsia::Event,
1606 >(slot.as_mut(), decoder, ())?;
1607
1608 Ok(())
1609 }
1610
1611 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1612 }
1613 })
1614 }
1615 }
1616
1617 impl<'de> ApplicationActivity<'de> {
1618 pub fn assertive_dependency_token(
1619 &self,
1620 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
1621 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1622 }
1623
1624 pub fn take_assertive_dependency_token(
1625 &mut self,
1626 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
1627 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1628 }
1629 }
1630
1631 impl<'de> ::core::fmt::Debug for ApplicationActivity<'de> {
1632 fn fmt(
1633 &self,
1634 f: &mut ::core::fmt::Formatter<'_>,
1635 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1636 f.debug_struct("ApplicationActivity")
1637 .field("assertive_dependency_token", &self.assertive_dependency_token())
1638 .finish()
1639 }
1640 }
1641
1642 impl<'de> ::fidl_next::IntoNatural for ApplicationActivity<'de> {
1643 type Natural = crate::natural::ApplicationActivity;
1644 }
1645
1646 #[repr(C)]
1648 pub struct PowerElements<'de> {
1649 pub(crate) table: ::fidl_next::wire::Table<'de>,
1650 }
1651
1652 impl<'de> Drop for PowerElements<'de> {
1653 fn drop(&mut self) {
1654 let _ = self.table.get(3).map(|envelope| unsafe {
1655 envelope.read_unchecked::<crate::wire::ApplicationActivity<'de>>()
1656 });
1657 }
1658 }
1659
1660 impl ::fidl_next::Constrained for PowerElements<'_> {
1661 type Constraint = ();
1662
1663 fn validate(
1664 _: ::fidl_next::Slot<'_, Self>,
1665 _: Self::Constraint,
1666 ) -> Result<(), ::fidl_next::ValidationError> {
1667 Ok(())
1668 }
1669 }
1670
1671 unsafe impl ::fidl_next::Wire for PowerElements<'static> {
1672 type Narrowed<'de> = PowerElements<'de>;
1673
1674 #[inline]
1675 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1676 ::fidl_next::munge!(let Self { table } = out);
1677 ::fidl_next::wire::Table::zero_padding(table);
1678 }
1679 }
1680
1681 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElements<'de>
1682 where
1683 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1684 ___D: ::fidl_next::fuchsia::HandleDecoder,
1685 {
1686 fn decode(
1687 slot: ::fidl_next::Slot<'_, Self>,
1688 decoder: &mut ___D,
1689 _: (),
1690 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1691 ::fidl_next::munge!(let Self { table } = slot);
1692
1693 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1694 match ordinal {
1695 0 => unsafe { ::core::hint::unreachable_unchecked() },
1696
1697 3 => {
1698 ::fidl_next::wire::Envelope::decode_as::<
1699 ___D,
1700 crate::wire::ApplicationActivity<'de>,
1701 >(slot.as_mut(), decoder, ())?;
1702
1703 Ok(())
1704 }
1705
1706 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1707 }
1708 })
1709 }
1710 }
1711
1712 impl<'de> PowerElements<'de> {
1713 pub fn application_activity(
1714 &self,
1715 ) -> ::core::option::Option<&crate::wire::ApplicationActivity<'de>> {
1716 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
1717 }
1718
1719 pub fn take_application_activity(
1720 &mut self,
1721 ) -> ::core::option::Option<crate::wire::ApplicationActivity<'de>> {
1722 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
1723 }
1724 }
1725
1726 impl<'de> ::core::fmt::Debug for PowerElements<'de> {
1727 fn fmt(
1728 &self,
1729 f: &mut ::core::fmt::Formatter<'_>,
1730 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1731 f.debug_struct("PowerElements")
1732 .field("application_activity", &self.application_activity())
1733 .finish()
1734 }
1735 }
1736
1737 impl<'de> ::fidl_next::IntoNatural for PowerElements<'de> {
1738 type Natural = crate::natural::PowerElements;
1739 }
1740
1741 #[derive(Debug)]
1743 #[repr(C)]
1744 pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1745 pub token: ::fidl_next::wire::fuchsia::EventPair,
1746 }
1747
1748 static_assertions::const_assert_eq!(
1749 std::mem::size_of::<ActivityGovernorAcquireUnmonitoredWakeLeaseResponse>(),
1750 4
1751 );
1752 static_assertions::const_assert_eq!(
1753 std::mem::align_of::<ActivityGovernorAcquireUnmonitoredWakeLeaseResponse>(),
1754 4
1755 );
1756
1757 static_assertions::const_assert_eq!(
1758 std::mem::offset_of!(ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, token),
1759 0
1760 );
1761
1762 impl ::fidl_next::Constrained for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1763 type Constraint = ();
1764
1765 fn validate(
1766 _: ::fidl_next::Slot<'_, Self>,
1767 _: Self::Constraint,
1768 ) -> Result<(), ::fidl_next::ValidationError> {
1769 Ok(())
1770 }
1771 }
1772
1773 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1774 type Narrowed<'de> = ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
1775
1776 #[inline]
1777 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1778 ::fidl_next::munge! {
1779 let Self {
1780 token,
1781
1782 } = &mut *out_;
1783 }
1784
1785 ::fidl_next::Wire::zero_padding(token);
1786 }
1787 }
1788
1789 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
1790 where
1791 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1792 ___D: ::fidl_next::fuchsia::HandleDecoder,
1793 {
1794 fn decode(
1795 slot_: ::fidl_next::Slot<'_, Self>,
1796 decoder_: &mut ___D,
1797 _: (),
1798 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1799 ::fidl_next::munge! {
1800 let Self {
1801 mut token,
1802
1803 } = slot_;
1804 }
1805
1806 let _field = token.as_mut();
1807
1808 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1809
1810 Ok(())
1811 }
1812 }
1813
1814 impl ::fidl_next::IntoNatural for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1815 type Natural = crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
1816 }
1817
1818 #[derive(Debug)]
1820 #[repr(C)]
1821 pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de> {
1822 pub name: ::fidl_next::wire::String<'de>,
1823
1824 pub server_token: ::fidl_next::wire::fuchsia::EventPair,
1825 }
1826
1827 static_assertions::const_assert_eq!(
1828 std::mem::size_of::<ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>>(),
1829 24
1830 );
1831 static_assertions::const_assert_eq!(
1832 std::mem::align_of::<ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>>(),
1833 8
1834 );
1835
1836 static_assertions::const_assert_eq!(
1837 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>, name),
1838 0
1839 );
1840
1841 static_assertions::const_assert_eq!(
1842 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>, server_token),
1843 16
1844 );
1845
1846 impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_> {
1847 type Constraint = ();
1848
1849 fn validate(
1850 _: ::fidl_next::Slot<'_, Self>,
1851 _: Self::Constraint,
1852 ) -> Result<(), ::fidl_next::ValidationError> {
1853 Ok(())
1854 }
1855 }
1856
1857 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static> {
1858 type Narrowed<'de> = ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>;
1859
1860 #[inline]
1861 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1862 ::fidl_next::munge! {
1863 let Self {
1864 name,
1865 server_token,
1866
1867 } = &mut *out_;
1868 }
1869
1870 ::fidl_next::Wire::zero_padding(name);
1871
1872 ::fidl_next::Wire::zero_padding(server_token);
1873
1874 unsafe {
1875 out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
1876 }
1877 }
1878 }
1879
1880 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1881 for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>
1882 where
1883 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1884 ___D: ::fidl_next::Decoder<'de>,
1885 ___D: ::fidl_next::fuchsia::HandleDecoder,
1886 {
1887 fn decode(
1888 slot_: ::fidl_next::Slot<'_, Self>,
1889 decoder_: &mut ___D,
1890 _: (),
1891 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1892 if slot_.as_bytes()[20..24] != [0u8; 4] {
1893 return Err(::fidl_next::DecodeError::InvalidPadding);
1894 }
1895
1896 ::fidl_next::munge! {
1897 let Self {
1898 mut name,
1899 mut server_token,
1900
1901 } = slot_;
1902 }
1903
1904 let _field = name.as_mut();
1905 ::fidl_next::Constrained::validate(_field, 64)?;
1906 ::fidl_next::Decode::decode(name.as_mut(), decoder_, 64)?;
1907
1908 let name = unsafe { name.deref_unchecked() };
1909
1910 if name.len() > 64 {
1911 return Err(::fidl_next::DecodeError::VectorTooLong {
1912 size: name.len() as u64,
1913 limit: 64,
1914 });
1915 }
1916
1917 let _field = server_token.as_mut();
1918
1919 ::fidl_next::Decode::decode(server_token.as_mut(), decoder_, ())?;
1920
1921 Ok(())
1922 }
1923 }
1924
1925 impl<'de> ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de> {
1926 type Natural = crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenRequest;
1927 }
1928
1929 #[derive(Debug)]
1931 #[repr(C)]
1932 pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
1933 pub token: ::fidl_next::wire::fuchsia::EventPair,
1934 }
1935
1936 static_assertions::const_assert_eq!(
1937 std::mem::size_of::<ActivityGovernorTakeApplicationActivityLeaseResponse>(),
1938 4
1939 );
1940 static_assertions::const_assert_eq!(
1941 std::mem::align_of::<ActivityGovernorTakeApplicationActivityLeaseResponse>(),
1942 4
1943 );
1944
1945 static_assertions::const_assert_eq!(
1946 std::mem::offset_of!(ActivityGovernorTakeApplicationActivityLeaseResponse, token),
1947 0
1948 );
1949
1950 impl ::fidl_next::Constrained for ActivityGovernorTakeApplicationActivityLeaseResponse {
1951 type Constraint = ();
1952
1953 fn validate(
1954 _: ::fidl_next::Slot<'_, Self>,
1955 _: Self::Constraint,
1956 ) -> Result<(), ::fidl_next::ValidationError> {
1957 Ok(())
1958 }
1959 }
1960
1961 unsafe impl ::fidl_next::Wire for ActivityGovernorTakeApplicationActivityLeaseResponse {
1962 type Narrowed<'de> = ActivityGovernorTakeApplicationActivityLeaseResponse;
1963
1964 #[inline]
1965 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1966 ::fidl_next::munge! {
1967 let Self {
1968 token,
1969
1970 } = &mut *out_;
1971 }
1972
1973 ::fidl_next::Wire::zero_padding(token);
1974 }
1975 }
1976
1977 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorTakeApplicationActivityLeaseResponse
1978 where
1979 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1980 ___D: ::fidl_next::fuchsia::HandleDecoder,
1981 {
1982 fn decode(
1983 slot_: ::fidl_next::Slot<'_, Self>,
1984 decoder_: &mut ___D,
1985 _: (),
1986 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1987 ::fidl_next::munge! {
1988 let Self {
1989 mut token,
1990
1991 } = slot_;
1992 }
1993
1994 let _field = token.as_mut();
1995
1996 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1997
1998 Ok(())
1999 }
2000 }
2001
2002 impl ::fidl_next::IntoNatural for ActivityGovernorTakeApplicationActivityLeaseResponse {
2003 type Natural = crate::natural::ActivityGovernorTakeApplicationActivityLeaseResponse;
2004 }
2005
2006 #[repr(C)]
2008 pub struct Cpu<'de> {
2009 pub(crate) table: ::fidl_next::wire::Table<'de>,
2010 }
2011
2012 impl<'de> Drop for Cpu<'de> {
2013 fn drop(&mut self) {
2014 let _ = self.table.get(1).map(|envelope| unsafe {
2015 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2016 });
2017 }
2018 }
2019
2020 impl ::fidl_next::Constrained for Cpu<'_> {
2021 type Constraint = ();
2022
2023 fn validate(
2024 _: ::fidl_next::Slot<'_, Self>,
2025 _: Self::Constraint,
2026 ) -> Result<(), ::fidl_next::ValidationError> {
2027 Ok(())
2028 }
2029 }
2030
2031 unsafe impl ::fidl_next::Wire for Cpu<'static> {
2032 type Narrowed<'de> = Cpu<'de>;
2033
2034 #[inline]
2035 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2036 ::fidl_next::munge!(let Self { table } = out);
2037 ::fidl_next::wire::Table::zero_padding(table);
2038 }
2039 }
2040
2041 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Cpu<'de>
2042 where
2043 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2044 ___D: ::fidl_next::fuchsia::HandleDecoder,
2045 {
2046 fn decode(
2047 slot: ::fidl_next::Slot<'_, Self>,
2048 decoder: &mut ___D,
2049 _: (),
2050 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2051 ::fidl_next::munge!(let Self { table } = slot);
2052
2053 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2054 match ordinal {
2055 0 => unsafe { ::core::hint::unreachable_unchecked() },
2056
2057 1 => {
2058 ::fidl_next::wire::Envelope::decode_as::<
2059 ___D,
2060 ::fidl_next::wire::fuchsia::Event,
2061 >(slot.as_mut(), decoder, ())?;
2062
2063 Ok(())
2064 }
2065
2066 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2067 }
2068 })
2069 }
2070 }
2071
2072 impl<'de> Cpu<'de> {
2073 pub fn assertive_dependency_token(
2074 &self,
2075 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2076 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2077 }
2078
2079 pub fn take_assertive_dependency_token(
2080 &mut self,
2081 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2082 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2083 }
2084 }
2085
2086 impl<'de> ::core::fmt::Debug for Cpu<'de> {
2087 fn fmt(
2088 &self,
2089 f: &mut ::core::fmt::Formatter<'_>,
2090 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2091 f.debug_struct("Cpu")
2092 .field("assertive_dependency_token", &self.assertive_dependency_token())
2093 .finish()
2094 }
2095 }
2096
2097 impl<'de> ::fidl_next::IntoNatural for Cpu<'de> {
2098 type Natural = crate::natural::Cpu;
2099 }
2100
2101 #[repr(C)]
2103 pub struct CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2104 pub(crate) table: ::fidl_next::wire::Table<'de>,
2105 }
2106
2107 impl<'de> Drop for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2108 fn drop(&mut self) {
2109 let _ = self.table.get(1).map(|envelope| unsafe {
2110 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2111 });
2112
2113 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2114 }
2115 }
2116
2117 impl ::fidl_next::Constrained for CpuElementManagerAddExecutionStateDependencyRequest<'_> {
2118 type Constraint = ();
2119
2120 fn validate(
2121 _: ::fidl_next::Slot<'_, Self>,
2122 _: Self::Constraint,
2123 ) -> Result<(), ::fidl_next::ValidationError> {
2124 Ok(())
2125 }
2126 }
2127
2128 unsafe impl ::fidl_next::Wire for CpuElementManagerAddExecutionStateDependencyRequest<'static> {
2129 type Narrowed<'de> = CpuElementManagerAddExecutionStateDependencyRequest<'de>;
2130
2131 #[inline]
2132 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2133 ::fidl_next::munge!(let Self { table } = out);
2134 ::fidl_next::wire::Table::zero_padding(table);
2135 }
2136 }
2137
2138 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2139 for CpuElementManagerAddExecutionStateDependencyRequest<'de>
2140 where
2141 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2142 ___D: ::fidl_next::fuchsia::HandleDecoder,
2143 {
2144 fn decode(
2145 slot: ::fidl_next::Slot<'_, Self>,
2146 decoder: &mut ___D,
2147 _: (),
2148 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2149 ::fidl_next::munge!(let Self { table } = slot);
2150
2151 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2152 match ordinal {
2153 0 => unsafe { ::core::hint::unreachable_unchecked() },
2154
2155 1 => {
2156 ::fidl_next::wire::Envelope::decode_as::<
2157 ___D,
2158 ::fidl_next::wire::fuchsia::Event,
2159 >(slot.as_mut(), decoder, ())?;
2160
2161 Ok(())
2162 }
2163
2164 2 => {
2165 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2166 slot.as_mut(),
2167 decoder,
2168 (),
2169 )?;
2170
2171 Ok(())
2172 }
2173
2174 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2175 }
2176 })
2177 }
2178 }
2179
2180 impl<'de> CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2181 pub fn dependency_token(
2182 &self,
2183 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2184 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2185 }
2186
2187 pub fn take_dependency_token(
2188 &mut self,
2189 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2190 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2191 }
2192
2193 pub fn power_level(&self) -> ::core::option::Option<&u8> {
2194 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2195 }
2196
2197 pub fn take_power_level(&mut self) -> ::core::option::Option<u8> {
2198 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2199 }
2200 }
2201
2202 impl<'de> ::core::fmt::Debug for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2203 fn fmt(
2204 &self,
2205 f: &mut ::core::fmt::Formatter<'_>,
2206 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2207 f.debug_struct("CpuElementManagerAddExecutionStateDependencyRequest")
2208 .field("dependency_token", &self.dependency_token())
2209 .field("power_level", &self.power_level())
2210 .finish()
2211 }
2212 }
2213
2214 impl<'de> ::fidl_next::IntoNatural for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2215 type Natural = crate::natural::CpuElementManagerAddExecutionStateDependencyRequest;
2216 }
2217
2218 #[repr(C)]
2220 pub struct ExecutionState<'de> {
2221 pub(crate) table: ::fidl_next::wire::Table<'de>,
2222 }
2223
2224 impl<'de> Drop for ExecutionState<'de> {
2225 fn drop(&mut self) {
2226 let _ = self.table.get(1).map(|envelope| unsafe {
2227 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2228 });
2229 }
2230 }
2231
2232 impl ::fidl_next::Constrained for ExecutionState<'_> {
2233 type Constraint = ();
2234
2235 fn validate(
2236 _: ::fidl_next::Slot<'_, Self>,
2237 _: Self::Constraint,
2238 ) -> Result<(), ::fidl_next::ValidationError> {
2239 Ok(())
2240 }
2241 }
2242
2243 unsafe impl ::fidl_next::Wire for ExecutionState<'static> {
2244 type Narrowed<'de> = ExecutionState<'de>;
2245
2246 #[inline]
2247 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2248 ::fidl_next::munge!(let Self { table } = out);
2249 ::fidl_next::wire::Table::zero_padding(table);
2250 }
2251 }
2252
2253 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ExecutionState<'de>
2254 where
2255 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2256 ___D: ::fidl_next::fuchsia::HandleDecoder,
2257 {
2258 fn decode(
2259 slot: ::fidl_next::Slot<'_, Self>,
2260 decoder: &mut ___D,
2261 _: (),
2262 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2263 ::fidl_next::munge!(let Self { table } = slot);
2264
2265 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2266 match ordinal {
2267 0 => unsafe { ::core::hint::unreachable_unchecked() },
2268
2269 1 => {
2270 ::fidl_next::wire::Envelope::decode_as::<
2271 ___D,
2272 ::fidl_next::wire::fuchsia::Event,
2273 >(slot.as_mut(), decoder, ())?;
2274
2275 Ok(())
2276 }
2277
2278 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2279 }
2280 })
2281 }
2282 }
2283
2284 impl<'de> ExecutionState<'de> {
2285 pub fn dependency_token(
2286 &self,
2287 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2288 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2289 }
2290
2291 pub fn take_dependency_token(
2292 &mut self,
2293 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2294 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2295 }
2296 }
2297
2298 impl<'de> ::core::fmt::Debug for ExecutionState<'de> {
2299 fn fmt(
2300 &self,
2301 f: &mut ::core::fmt::Formatter<'_>,
2302 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2303 f.debug_struct("ExecutionState")
2304 .field("dependency_token", &self.dependency_token())
2305 .finish()
2306 }
2307 }
2308
2309 impl<'de> ::fidl_next::IntoNatural for ExecutionState<'de> {
2310 type Natural = crate::natural::ExecutionState;
2311 }
2312
2313 #[repr(C)]
2315 pub struct ExecutionStateManagerAddApplicationActivityDependencyRequest<'de> {
2316 pub(crate) table: ::fidl_next::wire::Table<'de>,
2317 }
2318
2319 impl<'de> Drop for ExecutionStateManagerAddApplicationActivityDependencyRequest<'de> {
2320 fn drop(&mut self) {
2321 let _ = self.table.get(1).map(|envelope| unsafe {
2322 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2323 });
2324
2325 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2326 }
2327 }
2328
2329 impl ::fidl_next::Constrained for ExecutionStateManagerAddApplicationActivityDependencyRequest<'_> {
2330 type Constraint = ();
2331
2332 fn validate(
2333 _: ::fidl_next::Slot<'_, Self>,
2334 _: Self::Constraint,
2335 ) -> Result<(), ::fidl_next::ValidationError> {
2336 Ok(())
2337 }
2338 }
2339
2340 unsafe impl ::fidl_next::Wire
2341 for ExecutionStateManagerAddApplicationActivityDependencyRequest<'static>
2342 {
2343 type Narrowed<'de> = ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>;
2344
2345 #[inline]
2346 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2347 ::fidl_next::munge!(let Self { table } = out);
2348 ::fidl_next::wire::Table::zero_padding(table);
2349 }
2350 }
2351
2352 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2353 for ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>
2354 where
2355 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2356 ___D: ::fidl_next::fuchsia::HandleDecoder,
2357 {
2358 fn decode(
2359 slot: ::fidl_next::Slot<'_, Self>,
2360 decoder: &mut ___D,
2361 _: (),
2362 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2363 ::fidl_next::munge!(let Self { table } = slot);
2364
2365 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2366 match ordinal {
2367 0 => unsafe { ::core::hint::unreachable_unchecked() },
2368
2369 1 => {
2370 ::fidl_next::wire::Envelope::decode_as::<
2371 ___D,
2372 ::fidl_next::wire::fuchsia::Event,
2373 >(slot.as_mut(), decoder, ())?;
2374
2375 Ok(())
2376 }
2377
2378 2 => {
2379 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2380 slot.as_mut(),
2381 decoder,
2382 (),
2383 )?;
2384
2385 Ok(())
2386 }
2387
2388 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2389 }
2390 })
2391 }
2392 }
2393
2394 impl<'de> ExecutionStateManagerAddApplicationActivityDependencyRequest<'de> {
2395 pub fn dependency_token(
2396 &self,
2397 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2398 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2399 }
2400
2401 pub fn take_dependency_token(
2402 &mut self,
2403 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2404 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2405 }
2406
2407 pub fn power_level(&self) -> ::core::option::Option<&u8> {
2408 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2409 }
2410
2411 pub fn take_power_level(&mut self) -> ::core::option::Option<u8> {
2412 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2413 }
2414 }
2415
2416 impl<'de> ::core::fmt::Debug for ExecutionStateManagerAddApplicationActivityDependencyRequest<'de> {
2417 fn fmt(
2418 &self,
2419 f: &mut ::core::fmt::Formatter<'_>,
2420 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2421 f.debug_struct("ExecutionStateManagerAddApplicationActivityDependencyRequest")
2422 .field("dependency_token", &self.dependency_token())
2423 .field("power_level", &self.power_level())
2424 .finish()
2425 }
2426 }
2427
2428 impl<'de> ::fidl_next::IntoNatural
2429 for ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>
2430 {
2431 type Natural = crate::natural::ExecutionStateManagerAddApplicationActivityDependencyRequest;
2432 }
2433}
2434
2435pub mod wire_optional {
2436
2437 pub use fidl_next_common_fuchsia_power_system::wire_optional::*;
2438}
2439
2440pub mod generic {
2441
2442 pub use fidl_next_common_fuchsia_power_system::generic::*;
2443
2444 pub struct ActivityGovernorAcquireWakeLeaseResponse<T0> {
2446 pub token: T0,
2447 }
2448
2449 unsafe impl<___E, T0>
2450 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>
2451 for ActivityGovernorAcquireWakeLeaseResponse<T0>
2452 where
2453 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2454 ___E: ::fidl_next::fuchsia::HandleEncoder,
2455 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2456 {
2457 #[inline]
2458 fn encode(
2459 self,
2460 encoder_: &mut ___E,
2461 out_: &mut ::core::mem::MaybeUninit<
2462 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
2463 >,
2464 _: (),
2465 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2466 ::fidl_next::munge! {
2467 let crate::wire::ActivityGovernorAcquireWakeLeaseResponse {
2468 token,
2469
2470 } = out_;
2471 }
2472
2473 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2474
2475 Ok(())
2476 }
2477 }
2478
2479 pub struct ActivityGovernorRegisterSuspendBlockerResponse<T0> {
2481 pub token: T0,
2482 }
2483
2484 unsafe impl<___E, T0>
2485 ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>
2486 for ActivityGovernorRegisterSuspendBlockerResponse<T0>
2487 where
2488 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2489 ___E: ::fidl_next::fuchsia::HandleEncoder,
2490 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2491 {
2492 #[inline]
2493 fn encode(
2494 self,
2495 encoder_: &mut ___E,
2496 out_: &mut ::core::mem::MaybeUninit<
2497 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
2498 >,
2499 _: (),
2500 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2501 ::fidl_next::munge! {
2502 let crate::wire::ActivityGovernorRegisterSuspendBlockerResponse {
2503 token,
2504
2505 } = out_;
2506 }
2507
2508 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2509
2510 Ok(())
2511 }
2512 }
2513
2514 pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<T0> {
2516 pub token: T0,
2517 }
2518
2519 unsafe impl<___E, T0>
2520 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, ___E>
2521 for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<T0>
2522 where
2523 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2524 ___E: ::fidl_next::fuchsia::HandleEncoder,
2525 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2526 {
2527 #[inline]
2528 fn encode(
2529 self,
2530 encoder_: &mut ___E,
2531 out_: &mut ::core::mem::MaybeUninit<
2532 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
2533 >,
2534 _: (),
2535 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2536 ::fidl_next::munge! {
2537 let crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
2538 token,
2539
2540 } = out_;
2541 }
2542
2543 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2544
2545 Ok(())
2546 }
2547 }
2548
2549 pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1> {
2551 pub name: T0,
2552
2553 pub server_token: T1,
2554 }
2555
2556 unsafe impl<___E, T0, T1>
2557 ::fidl_next::Encode<
2558 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2559 ___E,
2560 > for ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1>
2561 where
2562 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2563 ___E: ::fidl_next::Encoder,
2564 ___E: ::fidl_next::fuchsia::HandleEncoder,
2565 T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
2566 T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2567 {
2568 #[inline]
2569 fn encode(
2570 self,
2571 encoder_: &mut ___E,
2572 out_: &mut ::core::mem::MaybeUninit<
2573 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2574 >,
2575 _: (),
2576 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2577 ::fidl_next::munge! {
2578 let crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
2579 name,
2580 server_token,
2581
2582 } = out_;
2583 }
2584
2585 ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
2586
2587 ::fidl_next::Encode::encode(self.server_token, encoder_, server_token, ())?;
2588
2589 Ok(())
2590 }
2591 }
2592
2593 pub struct ActivityGovernorTakeApplicationActivityLeaseResponse<T0> {
2595 pub token: T0,
2596 }
2597
2598 unsafe impl<___E, T0>
2599 ::fidl_next::Encode<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse, ___E>
2600 for ActivityGovernorTakeApplicationActivityLeaseResponse<T0>
2601 where
2602 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2603 ___E: ::fidl_next::fuchsia::HandleEncoder,
2604 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2605 {
2606 #[inline]
2607 fn encode(
2608 self,
2609 encoder_: &mut ___E,
2610 out_: &mut ::core::mem::MaybeUninit<
2611 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
2612 >,
2613 _: (),
2614 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2615 ::fidl_next::munge! {
2616 let crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse {
2617 token,
2618
2619 } = out_;
2620 }
2621
2622 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2623
2624 Ok(())
2625 }
2626 }
2627}
2628
2629pub use self::natural::*;
2630
2631#[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"]
2633#[derive(PartialEq, Debug)]
2634pub struct ActivityGovernor;
2635
2636impl ::fidl_next::Discoverable for ActivityGovernor {
2637 const PROTOCOL_NAME: &'static str = "fuchsia.power.system.ActivityGovernor";
2638}
2639
2640#[cfg(target_os = "fuchsia")]
2641impl ::fidl_next::HasTransport for ActivityGovernor {
2642 type Transport = ::fidl_next::fuchsia::zx::Channel;
2643}
2644
2645pub mod activity_governor {
2646 pub mod prelude {
2647 pub use crate::{
2648 ActivityGovernor, ActivityGovernorClientHandler, ActivityGovernorLocalClientHandler,
2649 ActivityGovernorLocalServerHandler, ActivityGovernorServerHandler, activity_governor,
2650 };
2651
2652 pub use crate::natural::AcquireWakeLeaseError;
2653
2654 pub use crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest;
2655
2656 pub use crate::natural::ActivityGovernorAcquireWakeLeaseRequest;
2657
2658 pub use crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenRequest;
2659
2660 pub use crate::natural::ActivityGovernorRegisterSuspendBlockerRequest;
2661
2662 pub use crate::natural::ActivityGovernorTakeApplicationActivityLeaseRequest;
2663
2664 pub use crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
2665
2666 pub use crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenResponse;
2667
2668 pub use crate::natural::ActivityGovernorAcquireWakeLeaseResponse;
2669
2670 pub use crate::natural::ActivityGovernorRegisterSuspendBlockerResponse;
2671
2672 pub use crate::natural::ActivityGovernorTakeApplicationActivityLeaseResponse;
2673
2674 pub use crate::natural::PowerElements;
2675
2676 pub use crate::natural::RegisterSuspendBlockerError;
2677 }
2678
2679 pub struct GetPowerElements;
2680
2681 impl ::fidl_next::Method for GetPowerElements {
2682 const ORDINAL: u64 = 8755001135707412082;
2683 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2684 ::fidl_next::protocol::Flexibility::Flexible;
2685
2686 type Protocol = crate::ActivityGovernor;
2687
2688 type Request = ::fidl_next::wire::EmptyMessageBody;
2689 }
2690
2691 impl ::fidl_next::TwoWayMethod for GetPowerElements {
2692 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::PowerElements<'static>>;
2693 }
2694
2695 impl<___R> ::fidl_next::Respond<___R> for GetPowerElements {
2696 type Output = ::fidl_next::Flexible<___R>;
2697
2698 fn respond(response: ___R) -> Self::Output {
2699 ::fidl_next::Flexible(response)
2700 }
2701 }
2702
2703 pub struct AcquireWakeLease;
2704
2705 impl ::fidl_next::Method for AcquireWakeLease {
2706 const ORDINAL: u64 = 3306304846648819971;
2707 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2708 ::fidl_next::protocol::Flexibility::Flexible;
2709
2710 type Protocol = crate::ActivityGovernor;
2711
2712 type Request = crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'static>;
2713 }
2714
2715 impl ::fidl_next::TwoWayMethod for AcquireWakeLease {
2716 type Response = ::fidl_next::wire::Result<
2717 'static,
2718 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
2719 crate::wire::AcquireWakeLeaseError,
2720 >;
2721 }
2722
2723 impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLease {
2724 type Output = ::core::result::Result<
2725 crate::generic::ActivityGovernorAcquireWakeLeaseResponse<___R>,
2726 ::fidl_next::never::Never,
2727 >;
2728
2729 fn respond(response: ___R) -> Self::Output {
2730 ::core::result::Result::Ok(crate::generic::ActivityGovernorAcquireWakeLeaseResponse {
2731 token: response,
2732 })
2733 }
2734 }
2735
2736 impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLease {
2737 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2738
2739 fn respond_err(response: ___R) -> Self::Output {
2740 ::core::result::Result::Err(response)
2741 }
2742 }
2743
2744 pub struct AcquireUnmonitoredWakeLease;
2745
2746 impl ::fidl_next::Method for AcquireUnmonitoredWakeLease {
2747 const ORDINAL: u64 = 6877005249659825577;
2748 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2749 ::fidl_next::protocol::Flexibility::Flexible;
2750
2751 type Protocol = crate::ActivityGovernor;
2752
2753 type Request = crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'static>;
2754 }
2755
2756 impl ::fidl_next::TwoWayMethod for AcquireUnmonitoredWakeLease {
2757 type Response = ::fidl_next::wire::Result<
2758 'static,
2759 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
2760 crate::wire::AcquireWakeLeaseError,
2761 >;
2762 }
2763
2764 impl<___R> ::fidl_next::Respond<___R> for AcquireUnmonitoredWakeLease {
2765 type Output = ::core::result::Result<
2766 crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<___R>,
2767 ::fidl_next::never::Never,
2768 >;
2769
2770 fn respond(response: ___R) -> Self::Output {
2771 ::core::result::Result::Ok(
2772 crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
2773 token: response,
2774 },
2775 )
2776 }
2777 }
2778
2779 impl<___R> ::fidl_next::RespondErr<___R> for AcquireUnmonitoredWakeLease {
2780 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2781
2782 fn respond_err(response: ___R) -> Self::Output {
2783 ::core::result::Result::Err(response)
2784 }
2785 }
2786
2787 pub struct AcquireWakeLeaseWithToken;
2788
2789 impl ::fidl_next::Method for AcquireWakeLeaseWithToken {
2790 const ORDINAL: u64 = 2079869883732225873;
2791 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2792 ::fidl_next::protocol::Flexibility::Flexible;
2793
2794 type Protocol = crate::ActivityGovernor;
2795
2796 type Request = crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>;
2797 }
2798
2799 impl ::fidl_next::TwoWayMethod for AcquireWakeLeaseWithToken {
2800 type Response = ::fidl_next::wire::Result<
2801 'static,
2802 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenResponse,
2803 crate::wire::AcquireWakeLeaseError,
2804 >;
2805 }
2806
2807 impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLeaseWithToken {
2808 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
2809
2810 fn respond(response: ___R) -> Self::Output {
2811 ::core::result::Result::Ok(response)
2812 }
2813 }
2814
2815 impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLeaseWithToken {
2816 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2817
2818 fn respond_err(response: ___R) -> Self::Output {
2819 ::core::result::Result::Err(response)
2820 }
2821 }
2822
2823 pub struct TakeApplicationActivityLease;
2824
2825 impl ::fidl_next::Method for TakeApplicationActivityLease {
2826 const ORDINAL: u64 = 4020961735006149140;
2827 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2828 ::fidl_next::protocol::Flexibility::Flexible;
2829
2830 type Protocol = crate::ActivityGovernor;
2831
2832 type Request = crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'static>;
2833 }
2834
2835 impl ::fidl_next::TwoWayMethod for TakeApplicationActivityLease {
2836 type Response = ::fidl_next::wire::Flexible<
2837 'static,
2838 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
2839 >;
2840 }
2841
2842 impl<___R> ::fidl_next::Respond<___R> for TakeApplicationActivityLease {
2843 type Output = ::fidl_next::Flexible<
2844 crate::generic::ActivityGovernorTakeApplicationActivityLeaseResponse<___R>,
2845 >;
2846
2847 fn respond(response: ___R) -> Self::Output {
2848 ::fidl_next::Flexible(
2849 crate::generic::ActivityGovernorTakeApplicationActivityLeaseResponse {
2850 token: response,
2851 },
2852 )
2853 }
2854 }
2855
2856 pub struct RegisterSuspendBlocker;
2857
2858 impl ::fidl_next::Method for RegisterSuspendBlocker {
2859 const ORDINAL: u64 = 3814361630267862785;
2860 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2861 ::fidl_next::protocol::Flexibility::Flexible;
2862
2863 type Protocol = crate::ActivityGovernor;
2864
2865 type Request = crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>;
2866 }
2867
2868 impl ::fidl_next::TwoWayMethod for RegisterSuspendBlocker {
2869 type Response = ::fidl_next::wire::Result<
2870 'static,
2871 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
2872 crate::wire::RegisterSuspendBlockerError,
2873 >;
2874 }
2875
2876 impl<___R> ::fidl_next::Respond<___R> for RegisterSuspendBlocker {
2877 type Output = ::core::result::Result<
2878 crate::generic::ActivityGovernorRegisterSuspendBlockerResponse<___R>,
2879 ::fidl_next::never::Never,
2880 >;
2881
2882 fn respond(response: ___R) -> Self::Output {
2883 ::core::result::Result::Ok(
2884 crate::generic::ActivityGovernorRegisterSuspendBlockerResponse { token: response },
2885 )
2886 }
2887 }
2888
2889 impl<___R> ::fidl_next::RespondErr<___R> for RegisterSuspendBlocker {
2890 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2891
2892 fn respond_err(response: ___R) -> Self::Output {
2893 ::core::result::Result::Err(response)
2894 }
2895 }
2896
2897 mod ___detail {
2898 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ActivityGovernor
2899 where
2900 ___T: ::fidl_next::Transport,
2901 {
2902 type Client = ActivityGovernorClient<___T>;
2903 type Server = ActivityGovernorServer<___T>;
2904 }
2905
2906 #[repr(transparent)]
2908 pub struct ActivityGovernorClient<___T: ::fidl_next::Transport> {
2909 #[allow(dead_code)]
2910 client: ::fidl_next::protocol::Client<___T>,
2911 }
2912
2913 impl<___T> ActivityGovernorClient<___T>
2914 where
2915 ___T: ::fidl_next::Transport,
2916 {
2917 #[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"]
2918 pub fn get_power_elements(
2919 &self,
2920 ) -> ::fidl_next::TwoWayFuture<'_, super::GetPowerElements, ___T> {
2921 ::fidl_next::TwoWayFuture::from_untyped(
2922 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
2923 8755001135707412082,
2924 <super::GetPowerElements as ::fidl_next::Method>::FLEXIBILITY,
2925 (),
2926 ),
2927 )
2928 }
2929
2930 #[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"]
2931 pub fn acquire_wake_lease(
2932 &self,
2933
2934 name: impl ::fidl_next::Encode<
2935 ::fidl_next::wire::String<'static>,
2936 <___T as ::fidl_next::Transport>::SendBuffer,
2937 >,
2938 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease, ___T>
2939 where
2940 <___T as ::fidl_next::Transport>::SendBuffer:
2941 ::fidl_next::encoder::InternalHandleEncoder,
2942 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2943 {
2944 self.acquire_wake_lease_with(
2945 crate::generic::ActivityGovernorAcquireWakeLeaseRequest { name },
2946 )
2947 }
2948
2949 #[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"]
2950 pub fn acquire_wake_lease_with<___R>(
2951 &self,
2952 request: ___R,
2953 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease, ___T>
2954 where
2955 ___R: ::fidl_next::Encode<
2956 crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'static>,
2957 <___T as ::fidl_next::Transport>::SendBuffer,
2958 >,
2959 {
2960 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2961 3306304846648819971,
2962 <super::AcquireWakeLease as ::fidl_next::Method>::FLEXIBILITY,
2963 request,
2964 ))
2965 }
2966
2967 #[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"]
2968 pub fn acquire_unmonitored_wake_lease(
2969 &self,
2970
2971 name: impl ::fidl_next::Encode<
2972 ::fidl_next::wire::String<'static>,
2973 <___T as ::fidl_next::Transport>::SendBuffer,
2974 >,
2975 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireUnmonitoredWakeLease, ___T>
2976 where
2977 <___T as ::fidl_next::Transport>::SendBuffer:
2978 ::fidl_next::encoder::InternalHandleEncoder,
2979 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2980 {
2981 self.acquire_unmonitored_wake_lease_with(
2982 crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest { name },
2983 )
2984 }
2985
2986 #[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"]
2987 pub fn acquire_unmonitored_wake_lease_with<___R>(
2988 &self,
2989 request: ___R,
2990 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireUnmonitoredWakeLease, ___T>
2991 where
2992 ___R: ::fidl_next::Encode<
2993 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'static>,
2994 <___T as ::fidl_next::Transport>::SendBuffer,
2995 >,
2996 {
2997 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2998 6877005249659825577,
2999 <super::AcquireUnmonitoredWakeLease as ::fidl_next::Method>::FLEXIBILITY,
3000 request,
3001 ))
3002 }
3003
3004 #[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"]
3005 pub fn acquire_wake_lease_with_token(
3006 &self,
3007
3008 name: impl ::fidl_next::Encode<
3009 ::fidl_next::wire::String<'static>,
3010 <___T as ::fidl_next::Transport>::SendBuffer,
3011 >,
3012
3013 server_token: impl ::fidl_next::Encode<
3014 ::fidl_next::wire::fuchsia::EventPair,
3015 <___T as ::fidl_next::Transport>::SendBuffer,
3016 >,
3017 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLeaseWithToken, ___T>
3018 where
3019 <___T as ::fidl_next::Transport>::SendBuffer:
3020 ::fidl_next::encoder::InternalHandleEncoder,
3021 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
3022 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3023 {
3024 self.acquire_wake_lease_with_token_with(
3025 crate::generic::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
3026 name,
3027
3028 server_token,
3029 },
3030 )
3031 }
3032
3033 #[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"]
3034 pub fn acquire_wake_lease_with_token_with<___R>(
3035 &self,
3036 request: ___R,
3037 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLeaseWithToken, ___T>
3038 where
3039 ___R: ::fidl_next::Encode<
3040 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
3041 <___T as ::fidl_next::Transport>::SendBuffer,
3042 >,
3043 {
3044 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3045 2079869883732225873,
3046 <super::AcquireWakeLeaseWithToken as ::fidl_next::Method>::FLEXIBILITY,
3047 request,
3048 ))
3049 }
3050
3051 #[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"]
3052 pub fn take_application_activity_lease(
3053 &self,
3054
3055 name: impl ::fidl_next::Encode<
3056 ::fidl_next::wire::String<'static>,
3057 <___T as ::fidl_next::Transport>::SendBuffer,
3058 >,
3059 ) -> ::fidl_next::TwoWayFuture<'_, super::TakeApplicationActivityLease, ___T>
3060 where
3061 <___T as ::fidl_next::Transport>::SendBuffer:
3062 ::fidl_next::encoder::InternalHandleEncoder,
3063 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
3064 {
3065 self.take_application_activity_lease_with(
3066 crate::generic::ActivityGovernorTakeApplicationActivityLeaseRequest { name },
3067 )
3068 }
3069
3070 #[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"]
3071 pub fn take_application_activity_lease_with<___R>(
3072 &self,
3073 request: ___R,
3074 ) -> ::fidl_next::TwoWayFuture<'_, super::TakeApplicationActivityLease, ___T>
3075 where
3076 ___R: ::fidl_next::Encode<
3077 crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'static>,
3078 <___T as ::fidl_next::Transport>::SendBuffer,
3079 >,
3080 {
3081 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3082 4020961735006149140,
3083 <super::TakeApplicationActivityLease as ::fidl_next::Method>::FLEXIBILITY,
3084 request,
3085 ))
3086 }
3087
3088 #[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"]
3089 pub fn register_suspend_blocker_with<___R>(
3090 &self,
3091 request: ___R,
3092 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterSuspendBlocker, ___T>
3093 where
3094 ___R: ::fidl_next::Encode<
3095 crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>,
3096 <___T as ::fidl_next::Transport>::SendBuffer,
3097 >,
3098 {
3099 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3100 3814361630267862785,
3101 <super::RegisterSuspendBlocker as ::fidl_next::Method>::FLEXIBILITY,
3102 request,
3103 ))
3104 }
3105 }
3106
3107 #[repr(transparent)]
3109 pub struct ActivityGovernorServer<___T: ::fidl_next::Transport> {
3110 server: ::fidl_next::protocol::Server<___T>,
3111 }
3112
3113 impl<___T> ActivityGovernorServer<___T> where ___T: ::fidl_next::Transport {}
3114 }
3115}
3116
3117#[diagnostic::on_unimplemented(
3118 note = "If {Self} implements the non-local ActivityGovernorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3119)]
3120
3121pub trait ActivityGovernorLocalClientHandler<
3125 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3126 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3127>
3128{
3129 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3130 ::core::future::ready(())
3131 }
3132}
3133
3134impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ActivityGovernor
3135where
3136 ___H: ActivityGovernorLocalClientHandler<___T>,
3137 ___T: ::fidl_next::Transport,
3138{
3139 async fn on_event(
3140 handler: &mut ___H,
3141 mut message: ::fidl_next::Message<___T>,
3142 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3143 match *message.header().ordinal {
3144 ordinal => {
3145 handler.on_unknown_interaction(ordinal).await;
3146 if ::core::matches!(
3147 message.header().flexibility(),
3148 ::fidl_next::protocol::Flexibility::Strict
3149 ) {
3150 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3151 } else {
3152 Ok(())
3153 }
3154 }
3155 }
3156 }
3157}
3158
3159#[diagnostic::on_unimplemented(
3160 note = "If {Self} implements the non-local ActivityGovernorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3161)]
3162
3163pub trait ActivityGovernorLocalServerHandler<
3167 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3168 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3169>
3170{
3171 #[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"]
3172 fn get_power_elements(
3173 &mut self,
3174
3175 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
3176 ) -> impl ::core::future::Future<Output = ()>;
3177
3178 #[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"]
3179 fn acquire_wake_lease(
3180 &mut self,
3181
3182 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3183
3184 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3185 ) -> impl ::core::future::Future<Output = ()>;
3186
3187 #[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"]
3188 fn acquire_unmonitored_wake_lease(
3189 &mut self,
3190
3191 request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3192
3193 responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3194 ) -> impl ::core::future::Future<Output = ()>;
3195
3196 #[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"]
3197 fn acquire_wake_lease_with_token(
3198 &mut self,
3199
3200 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3201
3202 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3203 ) -> impl ::core::future::Future<Output = ()>;
3204
3205 #[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"]
3206 fn take_application_activity_lease(
3207 &mut self,
3208
3209 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3210
3211 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3212 ) -> impl ::core::future::Future<Output = ()>;
3213
3214 #[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"]
3215 fn register_suspend_blocker(
3216 &mut self,
3217
3218 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3219
3220 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3221 ) -> impl ::core::future::Future<Output = ()>;
3222
3223 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3224 ::core::future::ready(())
3225 }
3226}
3227
3228impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ActivityGovernor
3229where
3230 ___H: ActivityGovernorLocalServerHandler<___T> ,
3231 ___T: ::fidl_next::Transport,
3232
3233
3234
3235
3236 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'de>: ::fidl_next::Decode<
3237 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3238 Constraint = (),
3239 >,
3240
3241
3242
3243 for<'de> crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'de>: ::fidl_next::Decode<
3244 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3245 Constraint = (),
3246 >,
3247
3248
3249
3250 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>: ::fidl_next::Decode<
3251 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3252 Constraint = (),
3253 >,
3254
3255
3256
3257 for<'de> crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'de>: ::fidl_next::Decode<
3258 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3259 Constraint = (),
3260 >,
3261
3262
3263
3264 for<'de> crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>: ::fidl_next::Decode<
3265 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3266 Constraint = (),
3267 >,
3268
3269
3270{
3271 async fn on_one_way(
3272 handler: &mut ___H,
3273 mut message: ::fidl_next::Message<___T>,
3274 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3275 match *message.header().ordinal {
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295 ordinal => {
3296
3297 handler.on_unknown_interaction(ordinal).await;
3298 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3299 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3300 } else {
3301 Ok(())
3302 }
3303
3304 }
3305 }
3306 }
3307
3308 async fn on_two_way(
3309 handler: &mut ___H,
3310 mut message: ::fidl_next::Message<___T>,
3311 responder: ::fidl_next::protocol::Responder<___T>,
3312 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3313 match *message.header().ordinal {
3314
3315
3316
3317 8755001135707412082 => {
3318 let responder = ::fidl_next::Responder::from_untyped(responder);
3319
3320 handler.get_power_elements(responder).await;
3321 Ok(())
3322
3323 }
3324
3325
3326
3327
3328 3306304846648819971 => {
3329 let responder = ::fidl_next::Responder::from_untyped(responder);
3330
3331 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3332 Ok(decoded) => {
3333 handler.acquire_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3334 Ok(())
3335 }
3336 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3337 ordinal: 3306304846648819971,
3338 error,
3339 }),
3340 }
3341
3342 }
3343
3344
3345
3346
3347 6877005249659825577 => {
3348 let responder = ::fidl_next::Responder::from_untyped(responder);
3349
3350 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3351 Ok(decoded) => {
3352 handler.acquire_unmonitored_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3353 Ok(())
3354 }
3355 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3356 ordinal: 6877005249659825577,
3357 error,
3358 }),
3359 }
3360
3361 }
3362
3363
3364
3365
3366 2079869883732225873 => {
3367 let responder = ::fidl_next::Responder::from_untyped(responder);
3368
3369 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3370 Ok(decoded) => {
3371 handler.acquire_wake_lease_with_token(::fidl_next::Request::from_decoded(decoded), responder).await;
3372 Ok(())
3373 }
3374 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3375 ordinal: 2079869883732225873,
3376 error,
3377 }),
3378 }
3379
3380 }
3381
3382
3383
3384
3385 4020961735006149140 => {
3386 let responder = ::fidl_next::Responder::from_untyped(responder);
3387
3388 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3389 Ok(decoded) => {
3390 handler.take_application_activity_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3391 Ok(())
3392 }
3393 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3394 ordinal: 4020961735006149140,
3395 error,
3396 }),
3397 }
3398
3399 }
3400
3401
3402
3403
3404 3814361630267862785 => {
3405 let responder = ::fidl_next::Responder::from_untyped(responder);
3406
3407 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3408 Ok(decoded) => {
3409 handler.register_suspend_blocker(::fidl_next::Request::from_decoded(decoded), responder).await;
3410 Ok(())
3411 }
3412 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3413 ordinal: 3814361630267862785,
3414 error,
3415 }),
3416 }
3417
3418 }
3419
3420
3421 ordinal => {
3422
3423 handler.on_unknown_interaction(ordinal).await;
3424 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3425 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3426 } else {
3427 responder.respond_framework_error(
3428 ordinal,
3429 ::fidl_next::FrameworkError::UnknownMethod,
3430 )
3431 .expect("encoding a framework error should never fail")
3432 .await?;
3433 Ok(())
3434 }
3435
3436 }
3437 }
3438 }
3439}
3440
3441pub trait ActivityGovernorClientHandler<
3445 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3446 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3447>
3448{
3449 fn on_unknown_interaction(
3450 &mut self,
3451 ordinal: u64,
3452 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3453 ::core::future::ready(())
3454 }
3455}
3456
3457impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ActivityGovernor
3458where
3459 ___H: ActivityGovernorClientHandler<___T> + ::core::marker::Send,
3460 ___T: ::fidl_next::Transport,
3461{
3462 async fn on_event(
3463 handler: &mut ___H,
3464 mut message: ::fidl_next::Message<___T>,
3465 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3466 match *message.header().ordinal {
3467 ordinal => {
3468 handler.on_unknown_interaction(ordinal).await;
3469 if ::core::matches!(
3470 message.header().flexibility(),
3471 ::fidl_next::protocol::Flexibility::Strict
3472 ) {
3473 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3474 } else {
3475 Ok(())
3476 }
3477 }
3478 }
3479 }
3480}
3481
3482pub trait ActivityGovernorServerHandler<
3486 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3487 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3488>
3489{
3490 #[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"]
3491 fn get_power_elements(
3492 &mut self,
3493
3494 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
3495 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3496
3497 #[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"]
3498 fn acquire_wake_lease(
3499 &mut self,
3500
3501 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3502
3503 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3504 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3505
3506 #[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"]
3507 fn acquire_unmonitored_wake_lease(
3508 &mut self,
3509
3510 request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3511
3512 responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3513 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3514
3515 #[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"]
3516 fn acquire_wake_lease_with_token(
3517 &mut self,
3518
3519 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3520
3521 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3522 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3523
3524 #[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"]
3525 fn take_application_activity_lease(
3526 &mut self,
3527
3528 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3529
3530 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3531 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3532
3533 #[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"]
3534 fn register_suspend_blocker(
3535 &mut self,
3536
3537 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3538
3539 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3540 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3541
3542 fn on_unknown_interaction(
3543 &mut self,
3544 ordinal: u64,
3545 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3546 ::core::future::ready(())
3547 }
3548}
3549
3550impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ActivityGovernor
3551where
3552 ___H: ActivityGovernorServerHandler<___T> + ::core::marker::Send,
3553 ___T: ::fidl_next::Transport,
3554
3555
3556
3557
3558 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'de>: ::fidl_next::Decode<
3559 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3560 Constraint = (),
3561 >,
3562
3563
3564
3565 for<'de> crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'de>: ::fidl_next::Decode<
3566 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3567 Constraint = (),
3568 >,
3569
3570
3571
3572 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>: ::fidl_next::Decode<
3573 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3574 Constraint = (),
3575 >,
3576
3577
3578
3579 for<'de> crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'de>: ::fidl_next::Decode<
3580 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3581 Constraint = (),
3582 >,
3583
3584
3585
3586 for<'de> crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>: ::fidl_next::Decode<
3587 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3588 Constraint = (),
3589 >,
3590
3591
3592{
3593 async fn on_one_way(
3594 handler: &mut ___H,
3595 mut message: ::fidl_next::Message<___T>,
3596 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3597 match *message.header().ordinal {
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617 ordinal => {
3618
3619 handler.on_unknown_interaction(ordinal).await;
3620 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3621 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3622 } else {
3623 Ok(())
3624 }
3625
3626 }
3627 }
3628 }
3629
3630 async fn on_two_way(
3631 handler: &mut ___H,
3632 mut message: ::fidl_next::Message<___T>,
3633 responder: ::fidl_next::protocol::Responder<___T>,
3634 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3635 match *message.header().ordinal {
3636
3637
3638
3639 8755001135707412082 => {
3640 let responder = ::fidl_next::Responder::from_untyped(responder);
3641
3642 handler.get_power_elements(responder).await;
3643 Ok(())
3644
3645 }
3646
3647
3648
3649
3650 3306304846648819971 => {
3651 let responder = ::fidl_next::Responder::from_untyped(responder);
3652
3653 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3654 Ok(decoded) => {
3655 handler.acquire_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3656 Ok(())
3657 }
3658 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3659 ordinal: 3306304846648819971,
3660 error,
3661 }),
3662 }
3663
3664 }
3665
3666
3667
3668
3669 6877005249659825577 => {
3670 let responder = ::fidl_next::Responder::from_untyped(responder);
3671
3672 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3673 Ok(decoded) => {
3674 handler.acquire_unmonitored_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3675 Ok(())
3676 }
3677 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3678 ordinal: 6877005249659825577,
3679 error,
3680 }),
3681 }
3682
3683 }
3684
3685
3686
3687
3688 2079869883732225873 => {
3689 let responder = ::fidl_next::Responder::from_untyped(responder);
3690
3691 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3692 Ok(decoded) => {
3693 handler.acquire_wake_lease_with_token(::fidl_next::Request::from_decoded(decoded), responder).await;
3694 Ok(())
3695 }
3696 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3697 ordinal: 2079869883732225873,
3698 error,
3699 }),
3700 }
3701
3702 }
3703
3704
3705
3706
3707 4020961735006149140 => {
3708 let responder = ::fidl_next::Responder::from_untyped(responder);
3709
3710 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3711 Ok(decoded) => {
3712 handler.take_application_activity_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3713 Ok(())
3714 }
3715 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3716 ordinal: 4020961735006149140,
3717 error,
3718 }),
3719 }
3720
3721 }
3722
3723
3724
3725
3726 3814361630267862785 => {
3727 let responder = ::fidl_next::Responder::from_untyped(responder);
3728
3729 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3730 Ok(decoded) => {
3731 handler.register_suspend_blocker(::fidl_next::Request::from_decoded(decoded), responder).await;
3732 Ok(())
3733 }
3734 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3735 ordinal: 3814361630267862785,
3736 error,
3737 }),
3738 }
3739
3740 }
3741
3742
3743 ordinal => {
3744
3745 handler.on_unknown_interaction(ordinal).await;
3746 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3747 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3748 } else {
3749 responder.respond_framework_error(
3750 ordinal,
3751 ::fidl_next::FrameworkError::UnknownMethod,
3752 )
3753 .expect("encoding a framework error should never fail")
3754 .await?;
3755 Ok(())
3756 }
3757
3758 }
3759 }
3760 }
3761}
3762
3763impl<___T> ActivityGovernorClientHandler<___T> for ::fidl_next::IgnoreEvents
3764where
3765 ___T: ::fidl_next::Transport,
3766{
3767 async fn on_unknown_interaction(&mut self, _: u64) {}
3768}
3769
3770impl<___H, ___T> ActivityGovernorLocalClientHandler<___T> for ::fidl_next::Local<___H>
3771where
3772 ___H: ActivityGovernorClientHandler<___T>,
3773 ___T: ::fidl_next::Transport,
3774{
3775 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3776 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3777 }
3778}
3779
3780impl<___H, ___T> ActivityGovernorLocalServerHandler<___T> for ::fidl_next::Local<___H>
3781where
3782 ___H: ActivityGovernorServerHandler<___T>,
3783 ___T: ::fidl_next::Transport,
3784{
3785 async fn get_power_elements(
3786 &mut self,
3787
3788 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
3789 ) {
3790 ___H::get_power_elements(&mut self.0, responder).await
3791 }
3792
3793 async fn acquire_wake_lease(
3794 &mut self,
3795
3796 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3797
3798 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3799 ) {
3800 ___H::acquire_wake_lease(&mut self.0, request, responder).await
3801 }
3802
3803 async fn acquire_unmonitored_wake_lease(
3804 &mut self,
3805
3806 request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3807
3808 responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3809 ) {
3810 ___H::acquire_unmonitored_wake_lease(&mut self.0, request, responder).await
3811 }
3812
3813 async fn acquire_wake_lease_with_token(
3814 &mut self,
3815
3816 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3817
3818 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3819 ) {
3820 ___H::acquire_wake_lease_with_token(&mut self.0, request, responder).await
3821 }
3822
3823 async fn take_application_activity_lease(
3824 &mut self,
3825
3826 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3827
3828 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3829 ) {
3830 ___H::take_application_activity_lease(&mut self.0, request, responder).await
3831 }
3832
3833 async fn register_suspend_blocker(
3834 &mut self,
3835
3836 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3837
3838 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3839 ) {
3840 ___H::register_suspend_blocker(&mut self.0, request, responder).await
3841 }
3842
3843 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3844 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3845 }
3846}
3847
3848#[doc = " A service that provides access to CPU-related power elements.\n"]
3850#[derive(PartialEq, Debug)]
3851pub struct CpuElementManager;
3852
3853impl ::fidl_next::Discoverable for CpuElementManager {
3854 const PROTOCOL_NAME: &'static str = "fuchsia.power.system.CpuElementManager";
3855}
3856
3857#[cfg(target_os = "fuchsia")]
3858impl ::fidl_next::HasTransport for CpuElementManager {
3859 type Transport = ::fidl_next::fuchsia::zx::Channel;
3860}
3861
3862pub mod cpu_element_manager {
3863 pub mod prelude {
3864 pub use crate::{
3865 CpuElementManager, CpuElementManagerClientHandler, CpuElementManagerLocalClientHandler,
3866 CpuElementManagerLocalServerHandler, CpuElementManagerServerHandler,
3867 cpu_element_manager,
3868 };
3869
3870 pub use crate::natural::AddExecutionStateDependencyError;
3871
3872 pub use crate::natural::Cpu;
3873
3874 pub use crate::natural::CpuElementManagerAddExecutionStateDependencyRequest;
3875
3876 pub use crate::natural::CpuElementManagerAddExecutionStateDependencyResponse;
3877 }
3878
3879 pub struct GetCpuDependencyToken;
3880
3881 impl ::fidl_next::Method for GetCpuDependencyToken {
3882 const ORDINAL: u64 = 3189503319605462202;
3883 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3884 ::fidl_next::protocol::Flexibility::Flexible;
3885
3886 type Protocol = crate::CpuElementManager;
3887
3888 type Request = ::fidl_next::wire::EmptyMessageBody;
3889 }
3890
3891 impl ::fidl_next::TwoWayMethod for GetCpuDependencyToken {
3892 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::Cpu<'static>>;
3893 }
3894
3895 impl<___R> ::fidl_next::Respond<___R> for GetCpuDependencyToken {
3896 type Output = ::fidl_next::Flexible<___R>;
3897
3898 fn respond(response: ___R) -> Self::Output {
3899 ::fidl_next::Flexible(response)
3900 }
3901 }
3902
3903 pub struct AddExecutionStateDependency;
3904
3905 impl ::fidl_next::Method for AddExecutionStateDependency {
3906 const ORDINAL: u64 = 1005136052949049908;
3907 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3908 ::fidl_next::protocol::Flexibility::Flexible;
3909
3910 type Protocol = crate::CpuElementManager;
3911
3912 type Request = crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>;
3913 }
3914
3915 impl ::fidl_next::TwoWayMethod for AddExecutionStateDependency {
3916 type Response = ::fidl_next::wire::Result<
3917 'static,
3918 crate::wire::CpuElementManagerAddExecutionStateDependencyResponse,
3919 crate::wire::AddExecutionStateDependencyError,
3920 >;
3921 }
3922
3923 impl<___R> ::fidl_next::Respond<___R> for AddExecutionStateDependency {
3924 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
3925
3926 fn respond(response: ___R) -> Self::Output {
3927 ::core::result::Result::Ok(response)
3928 }
3929 }
3930
3931 impl<___R> ::fidl_next::RespondErr<___R> for AddExecutionStateDependency {
3932 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3933
3934 fn respond_err(response: ___R) -> Self::Output {
3935 ::core::result::Result::Err(response)
3936 }
3937 }
3938
3939 mod ___detail {
3940 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::CpuElementManager
3941 where
3942 ___T: ::fidl_next::Transport,
3943 {
3944 type Client = CpuElementManagerClient<___T>;
3945 type Server = CpuElementManagerServer<___T>;
3946 }
3947
3948 #[repr(transparent)]
3950 pub struct CpuElementManagerClient<___T: ::fidl_next::Transport> {
3951 #[allow(dead_code)]
3952 client: ::fidl_next::protocol::Client<___T>,
3953 }
3954
3955 impl<___T> CpuElementManagerClient<___T>
3956 where
3957 ___T: ::fidl_next::Transport,
3958 {
3959 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
3960 pub fn get_cpu_dependency_token(
3961 &self,
3962 ) -> ::fidl_next::TwoWayFuture<'_, super::GetCpuDependencyToken, ___T> {
3963 ::fidl_next::TwoWayFuture::from_untyped(
3964 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
3965 3189503319605462202,
3966 <super::GetCpuDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3967 (),
3968 ),
3969 )
3970 }
3971
3972 #[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"]
3973 pub fn add_execution_state_dependency_with<___R>(
3974 &self,
3975 request: ___R,
3976 ) -> ::fidl_next::TwoWayFuture<'_, super::AddExecutionStateDependency, ___T>
3977 where
3978 ___R: ::fidl_next::Encode<
3979 crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
3980 <___T as ::fidl_next::Transport>::SendBuffer,
3981 >,
3982 {
3983 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3984 1005136052949049908,
3985 <super::AddExecutionStateDependency as ::fidl_next::Method>::FLEXIBILITY,
3986 request,
3987 ))
3988 }
3989 }
3990
3991 #[repr(transparent)]
3993 pub struct CpuElementManagerServer<___T: ::fidl_next::Transport> {
3994 server: ::fidl_next::protocol::Server<___T>,
3995 }
3996
3997 impl<___T> CpuElementManagerServer<___T> where ___T: ::fidl_next::Transport {}
3998 }
3999}
4000
4001#[diagnostic::on_unimplemented(
4002 note = "If {Self} implements the non-local CpuElementManagerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4003)]
4004
4005pub trait CpuElementManagerLocalClientHandler<
4009 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4010 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4011>
4012{
4013 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4014 ::core::future::ready(())
4015 }
4016}
4017
4018impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for CpuElementManager
4019where
4020 ___H: CpuElementManagerLocalClientHandler<___T>,
4021 ___T: ::fidl_next::Transport,
4022{
4023 async fn on_event(
4024 handler: &mut ___H,
4025 mut message: ::fidl_next::Message<___T>,
4026 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4027 match *message.header().ordinal {
4028 ordinal => {
4029 handler.on_unknown_interaction(ordinal).await;
4030 if ::core::matches!(
4031 message.header().flexibility(),
4032 ::fidl_next::protocol::Flexibility::Strict
4033 ) {
4034 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4035 } else {
4036 Ok(())
4037 }
4038 }
4039 }
4040 }
4041}
4042
4043#[diagnostic::on_unimplemented(
4044 note = "If {Self} implements the non-local CpuElementManagerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4045)]
4046
4047pub trait CpuElementManagerLocalServerHandler<
4051 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4052 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4053>
4054{
4055 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
4056 fn get_cpu_dependency_token(
4057 &mut self,
4058
4059 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
4060 ) -> impl ::core::future::Future<Output = ()>;
4061
4062 #[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"]
4063 fn add_execution_state_dependency(
4064 &mut self,
4065
4066 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
4067
4068 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
4069 ) -> impl ::core::future::Future<Output = ()>;
4070
4071 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4072 ::core::future::ready(())
4073 }
4074}
4075
4076impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for CpuElementManager
4077where
4078 ___H: CpuElementManagerLocalServerHandler<___T> ,
4079 ___T: ::fidl_next::Transport,
4080
4081
4082
4083
4084 for<'de> crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>: ::fidl_next::Decode<
4085 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4086 Constraint = (),
4087 >,
4088
4089
4090{
4091 async fn on_one_way(
4092 handler: &mut ___H,
4093 mut message: ::fidl_next::Message<___T>,
4094 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4095 match *message.header().ordinal {
4096
4097
4098
4099
4100
4101
4102
4103 ordinal => {
4104
4105 handler.on_unknown_interaction(ordinal).await;
4106 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4107 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4108 } else {
4109 Ok(())
4110 }
4111
4112 }
4113 }
4114 }
4115
4116 async fn on_two_way(
4117 handler: &mut ___H,
4118 mut message: ::fidl_next::Message<___T>,
4119 responder: ::fidl_next::protocol::Responder<___T>,
4120 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4121 match *message.header().ordinal {
4122
4123
4124
4125 3189503319605462202 => {
4126 let responder = ::fidl_next::Responder::from_untyped(responder);
4127
4128 handler.get_cpu_dependency_token(responder).await;
4129 Ok(())
4130
4131 }
4132
4133
4134
4135
4136 1005136052949049908 => {
4137 let responder = ::fidl_next::Responder::from_untyped(responder);
4138
4139 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4140 Ok(decoded) => {
4141 handler.add_execution_state_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
4142 Ok(())
4143 }
4144 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4145 ordinal: 1005136052949049908,
4146 error,
4147 }),
4148 }
4149
4150 }
4151
4152
4153 ordinal => {
4154
4155 handler.on_unknown_interaction(ordinal).await;
4156 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4157 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4158 } else {
4159 responder.respond_framework_error(
4160 ordinal,
4161 ::fidl_next::FrameworkError::UnknownMethod,
4162 )
4163 .expect("encoding a framework error should never fail")
4164 .await?;
4165 Ok(())
4166 }
4167
4168 }
4169 }
4170 }
4171}
4172
4173pub trait CpuElementManagerClientHandler<
4177 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4178 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4179>
4180{
4181 fn on_unknown_interaction(
4182 &mut self,
4183 ordinal: u64,
4184 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4185 ::core::future::ready(())
4186 }
4187}
4188
4189impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for CpuElementManager
4190where
4191 ___H: CpuElementManagerClientHandler<___T> + ::core::marker::Send,
4192 ___T: ::fidl_next::Transport,
4193{
4194 async fn on_event(
4195 handler: &mut ___H,
4196 mut message: ::fidl_next::Message<___T>,
4197 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4198 match *message.header().ordinal {
4199 ordinal => {
4200 handler.on_unknown_interaction(ordinal).await;
4201 if ::core::matches!(
4202 message.header().flexibility(),
4203 ::fidl_next::protocol::Flexibility::Strict
4204 ) {
4205 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4206 } else {
4207 Ok(())
4208 }
4209 }
4210 }
4211 }
4212}
4213
4214pub trait CpuElementManagerServerHandler<
4218 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4219 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4220>
4221{
4222 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
4223 fn get_cpu_dependency_token(
4224 &mut self,
4225
4226 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
4227 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4228
4229 #[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"]
4230 fn add_execution_state_dependency(
4231 &mut self,
4232
4233 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
4234
4235 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
4236 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4237
4238 fn on_unknown_interaction(
4239 &mut self,
4240 ordinal: u64,
4241 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4242 ::core::future::ready(())
4243 }
4244}
4245
4246impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for CpuElementManager
4247where
4248 ___H: CpuElementManagerServerHandler<___T> + ::core::marker::Send,
4249 ___T: ::fidl_next::Transport,
4250
4251
4252
4253
4254 for<'de> crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>: ::fidl_next::Decode<
4255 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4256 Constraint = (),
4257 >,
4258
4259
4260{
4261 async fn on_one_way(
4262 handler: &mut ___H,
4263 mut message: ::fidl_next::Message<___T>,
4264 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4265 match *message.header().ordinal {
4266
4267
4268
4269
4270
4271
4272
4273 ordinal => {
4274
4275 handler.on_unknown_interaction(ordinal).await;
4276 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4277 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4278 } else {
4279 Ok(())
4280 }
4281
4282 }
4283 }
4284 }
4285
4286 async fn on_two_way(
4287 handler: &mut ___H,
4288 mut message: ::fidl_next::Message<___T>,
4289 responder: ::fidl_next::protocol::Responder<___T>,
4290 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4291 match *message.header().ordinal {
4292
4293
4294
4295 3189503319605462202 => {
4296 let responder = ::fidl_next::Responder::from_untyped(responder);
4297
4298 handler.get_cpu_dependency_token(responder).await;
4299 Ok(())
4300
4301 }
4302
4303
4304
4305
4306 1005136052949049908 => {
4307 let responder = ::fidl_next::Responder::from_untyped(responder);
4308
4309 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4310 Ok(decoded) => {
4311 handler.add_execution_state_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
4312 Ok(())
4313 }
4314 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4315 ordinal: 1005136052949049908,
4316 error,
4317 }),
4318 }
4319
4320 }
4321
4322
4323 ordinal => {
4324
4325 handler.on_unknown_interaction(ordinal).await;
4326 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4327 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4328 } else {
4329 responder.respond_framework_error(
4330 ordinal,
4331 ::fidl_next::FrameworkError::UnknownMethod,
4332 )
4333 .expect("encoding a framework error should never fail")
4334 .await?;
4335 Ok(())
4336 }
4337
4338 }
4339 }
4340 }
4341}
4342
4343impl<___T> CpuElementManagerClientHandler<___T> for ::fidl_next::IgnoreEvents
4344where
4345 ___T: ::fidl_next::Transport,
4346{
4347 async fn on_unknown_interaction(&mut self, _: u64) {}
4348}
4349
4350impl<___H, ___T> CpuElementManagerLocalClientHandler<___T> for ::fidl_next::Local<___H>
4351where
4352 ___H: CpuElementManagerClientHandler<___T>,
4353 ___T: ::fidl_next::Transport,
4354{
4355 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4356 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4357 }
4358}
4359
4360impl<___H, ___T> CpuElementManagerLocalServerHandler<___T> for ::fidl_next::Local<___H>
4361where
4362 ___H: CpuElementManagerServerHandler<___T>,
4363 ___T: ::fidl_next::Transport,
4364{
4365 async fn get_cpu_dependency_token(
4366 &mut self,
4367
4368 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
4369 ) {
4370 ___H::get_cpu_dependency_token(&mut self.0, responder).await
4371 }
4372
4373 async fn add_execution_state_dependency(
4374 &mut self,
4375
4376 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
4377
4378 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
4379 ) {
4380 ___H::add_execution_state_dependency(&mut self.0, request, responder).await
4381 }
4382
4383 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4384 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4385 }
4386}
4387
4388#[doc = " A service for exposing execution state management capabilities.\n"]
4390#[derive(PartialEq, Debug)]
4391pub struct ExecutionStateManager;
4392
4393impl ::fidl_next::Discoverable for ExecutionStateManager {
4394 const PROTOCOL_NAME: &'static str = "fuchsia.power.system.ExecutionStateManager";
4395}
4396
4397#[cfg(target_os = "fuchsia")]
4398impl ::fidl_next::HasTransport for ExecutionStateManager {
4399 type Transport = ::fidl_next::fuchsia::zx::Channel;
4400}
4401
4402pub mod execution_state_manager {
4403 pub mod prelude {
4404 pub use crate::{
4405 ExecutionStateManager, ExecutionStateManagerClientHandler,
4406 ExecutionStateManagerLocalClientHandler, ExecutionStateManagerLocalServerHandler,
4407 ExecutionStateManagerServerHandler, execution_state_manager,
4408 };
4409
4410 pub use crate::natural::AddApplicationActivityDependencyError;
4411
4412 pub use crate::natural::ExecutionState;
4413
4414 pub use crate::natural::ExecutionStateManagerAddApplicationActivityDependencyRequest;
4415
4416 pub use crate::natural::ExecutionStateManagerAddApplicationActivityDependencyResponse;
4417 }
4418
4419 pub struct GetExecutionStateDependencyToken;
4420
4421 impl ::fidl_next::Method for GetExecutionStateDependencyToken {
4422 const ORDINAL: u64 = 8208054324408055568;
4423 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4424 ::fidl_next::protocol::Flexibility::Flexible;
4425
4426 type Protocol = crate::ExecutionStateManager;
4427
4428 type Request = ::fidl_next::wire::EmptyMessageBody;
4429 }
4430
4431 impl ::fidl_next::TwoWayMethod for GetExecutionStateDependencyToken {
4432 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::ExecutionState<'static>>;
4433 }
4434
4435 impl<___R> ::fidl_next::Respond<___R> for GetExecutionStateDependencyToken {
4436 type Output = ::fidl_next::Flexible<___R>;
4437
4438 fn respond(response: ___R) -> Self::Output {
4439 ::fidl_next::Flexible(response)
4440 }
4441 }
4442
4443 pub struct AddApplicationActivityDependency;
4444
4445 impl ::fidl_next::Method for AddApplicationActivityDependency {
4446 const ORDINAL: u64 = 4149397805243818457;
4447 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4448 ::fidl_next::protocol::Flexibility::Flexible;
4449
4450 type Protocol = crate::ExecutionStateManager;
4451
4452 type Request =
4453 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'static>;
4454 }
4455
4456 impl ::fidl_next::TwoWayMethod for AddApplicationActivityDependency {
4457 type Response = ::fidl_next::wire::Result<
4458 'static,
4459 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyResponse,
4460 crate::wire::AddApplicationActivityDependencyError,
4461 >;
4462 }
4463
4464 impl<___R> ::fidl_next::Respond<___R> for AddApplicationActivityDependency {
4465 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
4466
4467 fn respond(response: ___R) -> Self::Output {
4468 ::core::result::Result::Ok(response)
4469 }
4470 }
4471
4472 impl<___R> ::fidl_next::RespondErr<___R> for AddApplicationActivityDependency {
4473 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
4474
4475 fn respond_err(response: ___R) -> Self::Output {
4476 ::core::result::Result::Err(response)
4477 }
4478 }
4479
4480 mod ___detail {
4481 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ExecutionStateManager
4482 where
4483 ___T: ::fidl_next::Transport,
4484 {
4485 type Client = ExecutionStateManagerClient<___T>;
4486 type Server = ExecutionStateManagerServer<___T>;
4487 }
4488
4489 #[repr(transparent)]
4491 pub struct ExecutionStateManagerClient<___T: ::fidl_next::Transport> {
4492 #[allow(dead_code)]
4493 client: ::fidl_next::protocol::Client<___T>,
4494 }
4495
4496 impl<___T> ExecutionStateManagerClient<___T>
4497 where
4498 ___T: ::fidl_next::Transport,
4499 {
4500 #[doc = " Gets the dependency token for the execution state power element. This will block if SAG\n is not fully initialized.\n"]
4501 pub fn get_execution_state_dependency_token(
4502 &self,
4503 ) -> ::fidl_next::TwoWayFuture<'_, super::GetExecutionStateDependencyToken, ___T>
4504 {
4505 ::fidl_next::TwoWayFuture::from_untyped(
4506 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4507 8208054324408055568,
4508 <super::GetExecutionStateDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
4509 (),
4510 )
4511 )
4512 }
4513
4514 #[doc = " Adds a dependency from the Application Activity power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n Be aware of the following client-side conditions:\n - If SAG is not fully initialized, the call blocks until initialization is complete.\n - The call may block as required by `fuchsia.power.broker/ElementControl.AddDependency`,\n which at time of writing may call `fuchsia.power.ElementControl.SetLevel` on the\n associated power element.\n"]
4515 pub fn add_application_activity_dependency_with<___R>(
4516 &self,
4517 request: ___R,
4518 ) -> ::fidl_next::TwoWayFuture<'_, super::AddApplicationActivityDependency, ___T>
4519 where
4520 ___R: ::fidl_next::Encode<
4521 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<
4522 'static,
4523 >,
4524 <___T as ::fidl_next::Transport>::SendBuffer,
4525 >,
4526 {
4527 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
4528 4149397805243818457,
4529 <super::AddApplicationActivityDependency as ::fidl_next::Method>::FLEXIBILITY,
4530 request,
4531 ))
4532 }
4533 }
4534
4535 #[repr(transparent)]
4537 pub struct ExecutionStateManagerServer<___T: ::fidl_next::Transport> {
4538 server: ::fidl_next::protocol::Server<___T>,
4539 }
4540
4541 impl<___T> ExecutionStateManagerServer<___T> where ___T: ::fidl_next::Transport {}
4542 }
4543}
4544
4545#[diagnostic::on_unimplemented(
4546 note = "If {Self} implements the non-local ExecutionStateManagerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4547)]
4548
4549pub trait ExecutionStateManagerLocalClientHandler<
4553 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4554 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4555>
4556{
4557 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4558 ::core::future::ready(())
4559 }
4560}
4561
4562impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ExecutionStateManager
4563where
4564 ___H: ExecutionStateManagerLocalClientHandler<___T>,
4565 ___T: ::fidl_next::Transport,
4566{
4567 async fn on_event(
4568 handler: &mut ___H,
4569 mut message: ::fidl_next::Message<___T>,
4570 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4571 match *message.header().ordinal {
4572 ordinal => {
4573 handler.on_unknown_interaction(ordinal).await;
4574 if ::core::matches!(
4575 message.header().flexibility(),
4576 ::fidl_next::protocol::Flexibility::Strict
4577 ) {
4578 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4579 } else {
4580 Ok(())
4581 }
4582 }
4583 }
4584 }
4585}
4586
4587#[diagnostic::on_unimplemented(
4588 note = "If {Self} implements the non-local ExecutionStateManagerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4589)]
4590
4591pub trait ExecutionStateManagerLocalServerHandler<
4595 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4596 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4597>
4598{
4599 #[doc = " Gets the dependency token for the execution state power element. This will block if SAG\n is not fully initialized.\n"]
4600 fn get_execution_state_dependency_token(
4601 &mut self,
4602
4603 responder: ::fidl_next::Responder<
4604 execution_state_manager::GetExecutionStateDependencyToken,
4605 ___T,
4606 >,
4607 ) -> impl ::core::future::Future<Output = ()>;
4608
4609 #[doc = " Adds a dependency from the Application Activity power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n Be aware of the following client-side conditions:\n - If SAG is not fully initialized, the call blocks until initialization is complete.\n - The call may block as required by `fuchsia.power.broker/ElementControl.AddDependency`,\n which at time of writing may call `fuchsia.power.ElementControl.SetLevel` on the\n associated power element.\n"]
4610 fn add_application_activity_dependency(
4611 &mut self,
4612
4613 request: ::fidl_next::Request<
4614 execution_state_manager::AddApplicationActivityDependency,
4615 ___T,
4616 >,
4617
4618 responder: ::fidl_next::Responder<
4619 execution_state_manager::AddApplicationActivityDependency,
4620 ___T,
4621 >,
4622 ) -> impl ::core::future::Future<Output = ()>;
4623
4624 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4625 ::core::future::ready(())
4626 }
4627}
4628
4629impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ExecutionStateManager
4630where
4631 ___H: ExecutionStateManagerLocalServerHandler<___T> ,
4632 ___T: ::fidl_next::Transport,
4633
4634
4635
4636
4637 for<'de> crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>: ::fidl_next::Decode<
4638 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4639 Constraint = (),
4640 >,
4641
4642
4643{
4644 async fn on_one_way(
4645 handler: &mut ___H,
4646 mut message: ::fidl_next::Message<___T>,
4647 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4648 match *message.header().ordinal {
4649
4650
4651
4652
4653
4654
4655
4656 ordinal => {
4657
4658 handler.on_unknown_interaction(ordinal).await;
4659 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4660 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4661 } else {
4662 Ok(())
4663 }
4664
4665 }
4666 }
4667 }
4668
4669 async fn on_two_way(
4670 handler: &mut ___H,
4671 mut message: ::fidl_next::Message<___T>,
4672 responder: ::fidl_next::protocol::Responder<___T>,
4673 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4674 match *message.header().ordinal {
4675
4676
4677
4678 8208054324408055568 => {
4679 let responder = ::fidl_next::Responder::from_untyped(responder);
4680
4681 handler.get_execution_state_dependency_token(responder).await;
4682 Ok(())
4683
4684 }
4685
4686
4687
4688
4689 4149397805243818457 => {
4690 let responder = ::fidl_next::Responder::from_untyped(responder);
4691
4692 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4693 Ok(decoded) => {
4694 handler.add_application_activity_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
4695 Ok(())
4696 }
4697 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4698 ordinal: 4149397805243818457,
4699 error,
4700 }),
4701 }
4702
4703 }
4704
4705
4706 ordinal => {
4707
4708 handler.on_unknown_interaction(ordinal).await;
4709 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4710 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4711 } else {
4712 responder.respond_framework_error(
4713 ordinal,
4714 ::fidl_next::FrameworkError::UnknownMethod,
4715 )
4716 .expect("encoding a framework error should never fail")
4717 .await?;
4718 Ok(())
4719 }
4720
4721 }
4722 }
4723 }
4724}
4725
4726pub trait ExecutionStateManagerClientHandler<
4730 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4731 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4732>
4733{
4734 fn on_unknown_interaction(
4735 &mut self,
4736 ordinal: u64,
4737 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4738 ::core::future::ready(())
4739 }
4740}
4741
4742impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ExecutionStateManager
4743where
4744 ___H: ExecutionStateManagerClientHandler<___T> + ::core::marker::Send,
4745 ___T: ::fidl_next::Transport,
4746{
4747 async fn on_event(
4748 handler: &mut ___H,
4749 mut message: ::fidl_next::Message<___T>,
4750 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4751 match *message.header().ordinal {
4752 ordinal => {
4753 handler.on_unknown_interaction(ordinal).await;
4754 if ::core::matches!(
4755 message.header().flexibility(),
4756 ::fidl_next::protocol::Flexibility::Strict
4757 ) {
4758 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4759 } else {
4760 Ok(())
4761 }
4762 }
4763 }
4764 }
4765}
4766
4767pub trait ExecutionStateManagerServerHandler<
4771 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4772 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4773>
4774{
4775 #[doc = " Gets the dependency token for the execution state power element. This will block if SAG\n is not fully initialized.\n"]
4776 fn get_execution_state_dependency_token(
4777 &mut self,
4778
4779 responder: ::fidl_next::Responder<
4780 execution_state_manager::GetExecutionStateDependencyToken,
4781 ___T,
4782 >,
4783 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4784
4785 #[doc = " Adds a dependency from the Application Activity power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n Be aware of the following client-side conditions:\n - If SAG is not fully initialized, the call blocks until initialization is complete.\n - The call may block as required by `fuchsia.power.broker/ElementControl.AddDependency`,\n which at time of writing may call `fuchsia.power.ElementControl.SetLevel` on the\n associated power element.\n"]
4786 fn add_application_activity_dependency(
4787 &mut self,
4788
4789 request: ::fidl_next::Request<
4790 execution_state_manager::AddApplicationActivityDependency,
4791 ___T,
4792 >,
4793
4794 responder: ::fidl_next::Responder<
4795 execution_state_manager::AddApplicationActivityDependency,
4796 ___T,
4797 >,
4798 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4799
4800 fn on_unknown_interaction(
4801 &mut self,
4802 ordinal: u64,
4803 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4804 ::core::future::ready(())
4805 }
4806}
4807
4808impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ExecutionStateManager
4809where
4810 ___H: ExecutionStateManagerServerHandler<___T> + ::core::marker::Send,
4811 ___T: ::fidl_next::Transport,
4812
4813
4814
4815
4816 for<'de> crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>: ::fidl_next::Decode<
4817 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4818 Constraint = (),
4819 >,
4820
4821
4822{
4823 async fn on_one_way(
4824 handler: &mut ___H,
4825 mut message: ::fidl_next::Message<___T>,
4826 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4827 match *message.header().ordinal {
4828
4829
4830
4831
4832
4833
4834
4835 ordinal => {
4836
4837 handler.on_unknown_interaction(ordinal).await;
4838 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4839 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4840 } else {
4841 Ok(())
4842 }
4843
4844 }
4845 }
4846 }
4847
4848 async fn on_two_way(
4849 handler: &mut ___H,
4850 mut message: ::fidl_next::Message<___T>,
4851 responder: ::fidl_next::protocol::Responder<___T>,
4852 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4853 match *message.header().ordinal {
4854
4855
4856
4857 8208054324408055568 => {
4858 let responder = ::fidl_next::Responder::from_untyped(responder);
4859
4860 handler.get_execution_state_dependency_token(responder).await;
4861 Ok(())
4862
4863 }
4864
4865
4866
4867
4868 4149397805243818457 => {
4869 let responder = ::fidl_next::Responder::from_untyped(responder);
4870
4871 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4872 Ok(decoded) => {
4873 handler.add_application_activity_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
4874 Ok(())
4875 }
4876 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4877 ordinal: 4149397805243818457,
4878 error,
4879 }),
4880 }
4881
4882 }
4883
4884
4885 ordinal => {
4886
4887 handler.on_unknown_interaction(ordinal).await;
4888 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4889 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4890 } else {
4891 responder.respond_framework_error(
4892 ordinal,
4893 ::fidl_next::FrameworkError::UnknownMethod,
4894 )
4895 .expect("encoding a framework error should never fail")
4896 .await?;
4897 Ok(())
4898 }
4899
4900 }
4901 }
4902 }
4903}
4904
4905impl<___T> ExecutionStateManagerClientHandler<___T> for ::fidl_next::IgnoreEvents
4906where
4907 ___T: ::fidl_next::Transport,
4908{
4909 async fn on_unknown_interaction(&mut self, _: u64) {}
4910}
4911
4912impl<___H, ___T> ExecutionStateManagerLocalClientHandler<___T> for ::fidl_next::Local<___H>
4913where
4914 ___H: ExecutionStateManagerClientHandler<___T>,
4915 ___T: ::fidl_next::Transport,
4916{
4917 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4918 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4919 }
4920}
4921
4922impl<___H, ___T> ExecutionStateManagerLocalServerHandler<___T> for ::fidl_next::Local<___H>
4923where
4924 ___H: ExecutionStateManagerServerHandler<___T>,
4925 ___T: ::fidl_next::Transport,
4926{
4927 async fn get_execution_state_dependency_token(
4928 &mut self,
4929
4930 responder: ::fidl_next::Responder<
4931 execution_state_manager::GetExecutionStateDependencyToken,
4932 ___T,
4933 >,
4934 ) {
4935 ___H::get_execution_state_dependency_token(&mut self.0, responder).await
4936 }
4937
4938 async fn add_application_activity_dependency(
4939 &mut self,
4940
4941 request: ::fidl_next::Request<
4942 execution_state_manager::AddApplicationActivityDependency,
4943 ___T,
4944 >,
4945
4946 responder: ::fidl_next::Responder<
4947 execution_state_manager::AddApplicationActivityDependency,
4948 ___T,
4949 >,
4950 ) {
4951 ___H::add_application_activity_dependency(&mut self.0, request, responder).await
4952 }
4953
4954 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4955 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4956 }
4957}
4958
4959pub use fidl_next_common_fuchsia_power_system::*;