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 ActivityGovernorTakeWakeLeaseResponse {
522 pub token: ::fidl_next::fuchsia::zx::EventPair,
523 }
524
525 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ActivityGovernorTakeWakeLeaseResponse, ___E>
526 for ActivityGovernorTakeWakeLeaseResponse
527 where
528 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
529 ___E: ::fidl_next::fuchsia::HandleEncoder,
530 {
531 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
532 Self,
533 crate::wire::ActivityGovernorTakeWakeLeaseResponse,
534 > = unsafe {
535 ::fidl_next::CopyOptimization::enable_if(
536 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
537 ::fidl_next::wire::fuchsia::EventPair,
538 ___E,
539 >>::COPY_OPTIMIZATION
540 .is_enabled(),
541 )
542 };
543
544 #[inline]
545 fn encode(
546 self,
547 encoder_: &mut ___E,
548 out_: &mut ::core::mem::MaybeUninit<crate::wire::ActivityGovernorTakeWakeLeaseResponse>,
549 _: (),
550 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
551 ::fidl_next::munge! {
552 let crate::wire::ActivityGovernorTakeWakeLeaseResponse {
553 token,
554
555 } = out_;
556 }
557
558 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
559
560 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
561
562 Ok(())
563 }
564 }
565
566 unsafe impl<___E>
567 ::fidl_next::EncodeOption<
568 ::fidl_next::wire::Box<'static, crate::wire::ActivityGovernorTakeWakeLeaseResponse>,
569 ___E,
570 > for ActivityGovernorTakeWakeLeaseResponse
571 where
572 ___E: ::fidl_next::Encoder + ?Sized,
573 ActivityGovernorTakeWakeLeaseResponse:
574 ::fidl_next::Encode<crate::wire::ActivityGovernorTakeWakeLeaseResponse, ___E>,
575 {
576 #[inline]
577 fn encode_option(
578 this: ::core::option::Option<Self>,
579 encoder: &mut ___E,
580 out: &mut ::core::mem::MaybeUninit<
581 ::fidl_next::wire::Box<'static, crate::wire::ActivityGovernorTakeWakeLeaseResponse>,
582 >,
583 _: (),
584 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
585 if let Some(inner) = this {
586 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
587 ::fidl_next::wire::Box::encode_present(out);
588 } else {
589 ::fidl_next::wire::Box::encode_absent(out);
590 }
591
592 Ok(())
593 }
594 }
595
596 impl ::fidl_next::FromWire<crate::wire::ActivityGovernorTakeWakeLeaseResponse>
597 for ActivityGovernorTakeWakeLeaseResponse
598 {
599 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
600 crate::wire::ActivityGovernorTakeWakeLeaseResponse,
601 Self,
602 > = unsafe {
603 ::fidl_next::CopyOptimization::enable_if(
604 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
605 ::fidl_next::wire::fuchsia::EventPair,
606 >>::COPY_OPTIMIZATION
607 .is_enabled(),
608 )
609 };
610
611 #[inline]
612 fn from_wire(wire: crate::wire::ActivityGovernorTakeWakeLeaseResponse) -> Self {
613 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
614 }
615 }
616
617 #[derive(Debug, PartialEq)]
618 #[repr(C)]
619 pub struct ActivityGovernorAcquireLongWakeLeaseResponse {
620 pub token: ::fidl_next::fuchsia::zx::EventPair,
621 }
622
623 unsafe impl<___E>
624 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse, ___E>
625 for ActivityGovernorAcquireLongWakeLeaseResponse
626 where
627 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
628 ___E: ::fidl_next::fuchsia::HandleEncoder,
629 {
630 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
631 Self,
632 crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse,
633 > = unsafe {
634 ::fidl_next::CopyOptimization::enable_if(
635 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
636 ::fidl_next::wire::fuchsia::EventPair,
637 ___E,
638 >>::COPY_OPTIMIZATION
639 .is_enabled(),
640 )
641 };
642
643 #[inline]
644 fn encode(
645 self,
646 encoder_: &mut ___E,
647 out_: &mut ::core::mem::MaybeUninit<
648 crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse,
649 >,
650 _: (),
651 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
652 ::fidl_next::munge! {
653 let crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse {
654 token,
655
656 } = out_;
657 }
658
659 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
660
661 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
662
663 Ok(())
664 }
665 }
666
667 unsafe impl<___E>
668 ::fidl_next::EncodeOption<
669 ::fidl_next::wire::Box<
670 'static,
671 crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse,
672 >,
673 ___E,
674 > for ActivityGovernorAcquireLongWakeLeaseResponse
675 where
676 ___E: ::fidl_next::Encoder + ?Sized,
677 ActivityGovernorAcquireLongWakeLeaseResponse:
678 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse, ___E>,
679 {
680 #[inline]
681 fn encode_option(
682 this: ::core::option::Option<Self>,
683 encoder: &mut ___E,
684 out: &mut ::core::mem::MaybeUninit<
685 ::fidl_next::wire::Box<
686 'static,
687 crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse,
688 >,
689 >,
690 _: (),
691 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
692 if let Some(inner) = this {
693 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
694 ::fidl_next::wire::Box::encode_present(out);
695 } else {
696 ::fidl_next::wire::Box::encode_absent(out);
697 }
698
699 Ok(())
700 }
701 }
702
703 impl ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse>
704 for ActivityGovernorAcquireLongWakeLeaseResponse
705 {
706 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
707 crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse,
708 Self,
709 > = unsafe {
710 ::fidl_next::CopyOptimization::enable_if(
711 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
712 ::fidl_next::wire::fuchsia::EventPair,
713 >>::COPY_OPTIMIZATION
714 .is_enabled(),
715 )
716 };
717
718 #[inline]
719 fn from_wire(wire: crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse) -> Self {
720 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
721 }
722 }
723
724 #[derive(Debug, PartialEq)]
725 pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest {
726 pub name: ::std::string::String,
727
728 pub server_token: ::fidl_next::fuchsia::zx::EventPair,
729 }
730
731 unsafe impl<___E>
732 ::fidl_next::Encode<
733 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
734 ___E,
735 > for ActivityGovernorAcquireWakeLeaseWithTokenRequest
736 where
737 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
738 ___E: ::fidl_next::Encoder,
739 ___E: ::fidl_next::fuchsia::HandleEncoder,
740 {
741 #[inline]
742 fn encode(
743 self,
744 encoder_: &mut ___E,
745 out_: &mut ::core::mem::MaybeUninit<
746 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
747 >,
748 _: (),
749 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
750 ::fidl_next::munge! {
751 let crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
752 name,
753 server_token,
754
755 } = out_;
756 }
757
758 ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
759
760 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(name.as_mut_ptr()) };
761 ::fidl_next::Constrained::validate(_field, 64)?;
762
763 ::fidl_next::Encode::encode(self.server_token, encoder_, server_token, ())?;
764
765 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(server_token.as_mut_ptr()) };
766
767 Ok(())
768 }
769 }
770
771 unsafe impl<___E>
772 ::fidl_next::EncodeOption<
773 ::fidl_next::wire::Box<
774 'static,
775 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
776 >,
777 ___E,
778 > for ActivityGovernorAcquireWakeLeaseWithTokenRequest
779 where
780 ___E: ::fidl_next::Encoder + ?Sized,
781 ActivityGovernorAcquireWakeLeaseWithTokenRequest: ::fidl_next::Encode<
782 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
783 ___E,
784 >,
785 {
786 #[inline]
787 fn encode_option(
788 this: ::core::option::Option<Self>,
789 encoder: &mut ___E,
790 out: &mut ::core::mem::MaybeUninit<
791 ::fidl_next::wire::Box<
792 'static,
793 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
794 >,
795 >,
796 _: (),
797 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
798 if let Some(inner) = this {
799 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
800 ::fidl_next::wire::Box::encode_present(out);
801 } else {
802 ::fidl_next::wire::Box::encode_absent(out);
803 }
804
805 Ok(())
806 }
807 }
808
809 impl<'de>
810 ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>>
811 for ActivityGovernorAcquireWakeLeaseWithTokenRequest
812 {
813 #[inline]
814 fn from_wire(
815 wire: crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>,
816 ) -> Self {
817 Self {
818 name: ::fidl_next::FromWire::from_wire(wire.name),
819
820 server_token: ::fidl_next::FromWire::from_wire(wire.server_token),
821 }
822 }
823 }
824
825 #[derive(Debug, PartialEq)]
826 #[repr(C)]
827 pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
828 pub token: ::fidl_next::fuchsia::zx::EventPair,
829 }
830
831 unsafe impl<___E>
832 ::fidl_next::Encode<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse, ___E>
833 for ActivityGovernorTakeApplicationActivityLeaseResponse
834 where
835 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
836 ___E: ::fidl_next::fuchsia::HandleEncoder,
837 {
838 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
839 Self,
840 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
841 > = unsafe {
842 ::fidl_next::CopyOptimization::enable_if(
843 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
844 ::fidl_next::wire::fuchsia::EventPair,
845 ___E,
846 >>::COPY_OPTIMIZATION
847 .is_enabled(),
848 )
849 };
850
851 #[inline]
852 fn encode(
853 self,
854 encoder_: &mut ___E,
855 out_: &mut ::core::mem::MaybeUninit<
856 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
857 >,
858 _: (),
859 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
860 ::fidl_next::munge! {
861 let crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse {
862 token,
863
864 } = out_;
865 }
866
867 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
868
869 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
870
871 Ok(())
872 }
873 }
874
875 unsafe impl<___E>
876 ::fidl_next::EncodeOption<
877 ::fidl_next::wire::Box<
878 'static,
879 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
880 >,
881 ___E,
882 > for ActivityGovernorTakeApplicationActivityLeaseResponse
883 where
884 ___E: ::fidl_next::Encoder + ?Sized,
885 ActivityGovernorTakeApplicationActivityLeaseResponse: ::fidl_next::Encode<
886 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
887 ___E,
888 >,
889 {
890 #[inline]
891 fn encode_option(
892 this: ::core::option::Option<Self>,
893 encoder: &mut ___E,
894 out: &mut ::core::mem::MaybeUninit<
895 ::fidl_next::wire::Box<
896 'static,
897 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
898 >,
899 >,
900 _: (),
901 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
902 if let Some(inner) = this {
903 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
904 ::fidl_next::wire::Box::encode_present(out);
905 } else {
906 ::fidl_next::wire::Box::encode_absent(out);
907 }
908
909 Ok(())
910 }
911 }
912
913 impl ::fidl_next::FromWire<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse>
914 for ActivityGovernorTakeApplicationActivityLeaseResponse
915 {
916 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
917 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
918 Self,
919 > = unsafe {
920 ::fidl_next::CopyOptimization::enable_if(
921 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
922 ::fidl_next::wire::fuchsia::EventPair,
923 >>::COPY_OPTIMIZATION
924 .is_enabled(),
925 )
926 };
927
928 #[inline]
929 fn from_wire(
930 wire: crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
931 ) -> Self {
932 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
933 }
934 }
935
936 #[doc = " Holds tokens to the CPU power element.\n\n [`fuchsia.power.system/CpuLevel`] defines the power levels supported by this power element.\n"]
937 #[derive(Debug, Default, PartialEq)]
938 pub struct Cpu {
939 pub assertive_dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
940 }
941
942 impl Cpu {
943 fn __max_ordinal(&self) -> usize {
944 if self.assertive_dependency_token.is_some() {
945 return 1;
946 }
947
948 0
949 }
950 }
951
952 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Cpu<'static>, ___E> for Cpu
953 where
954 ___E: ::fidl_next::Encoder + ?Sized,
955 ___E: ::fidl_next::fuchsia::HandleEncoder,
956 {
957 #[inline]
958 fn encode(
959 mut self,
960 encoder: &mut ___E,
961 out: &mut ::core::mem::MaybeUninit<crate::wire::Cpu<'static>>,
962 _: (),
963 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
964 ::fidl_next::munge!(let crate::wire::Cpu { table } = out);
965
966 let max_ord = self.__max_ordinal();
967
968 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
969 ::fidl_next::Wire::zero_padding(&mut out);
970
971 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
972 ::fidl_next::wire::Envelope,
973 >(encoder, max_ord);
974
975 for i in 1..=max_ord {
976 match i {
977 1 => {
978 if let Some(value) = self.assertive_dependency_token.take() {
979 ::fidl_next::wire::Envelope::encode_value::<
980 ::fidl_next::wire::fuchsia::Event,
981 ___E,
982 >(
983 value, preallocated.encoder, &mut out, ()
984 )?;
985 } else {
986 ::fidl_next::wire::Envelope::encode_zero(&mut out)
987 }
988 }
989
990 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
991 }
992 unsafe {
993 preallocated.write_next(out.assume_init_ref());
994 }
995 }
996
997 ::fidl_next::wire::Table::encode_len(table, max_ord);
998
999 Ok(())
1000 }
1001 }
1002
1003 impl<'de> ::fidl_next::FromWire<crate::wire::Cpu<'de>> for Cpu {
1004 #[inline]
1005 fn from_wire(wire_: crate::wire::Cpu<'de>) -> Self {
1006 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1007
1008 let assertive_dependency_token = wire_.table.get(1);
1009
1010 Self {
1011 assertive_dependency_token: assertive_dependency_token.map(|envelope| {
1012 ::fidl_next::FromWire::from_wire(unsafe {
1013 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1014 })
1015 }),
1016 }
1017 }
1018 }
1019
1020 #[derive(Debug, Default, PartialEq)]
1021 pub struct CpuElementManagerAddExecutionStateDependencyRequest {
1022 pub dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1023
1024 pub power_level: ::core::option::Option<u8>,
1025 }
1026
1027 impl CpuElementManagerAddExecutionStateDependencyRequest {
1028 fn __max_ordinal(&self) -> usize {
1029 if self.power_level.is_some() {
1030 return 2;
1031 }
1032
1033 if self.dependency_token.is_some() {
1034 return 1;
1035 }
1036
1037 0
1038 }
1039 }
1040
1041 unsafe impl<___E>
1042 ::fidl_next::Encode<
1043 crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
1044 ___E,
1045 > for CpuElementManagerAddExecutionStateDependencyRequest
1046 where
1047 ___E: ::fidl_next::Encoder + ?Sized,
1048 ___E: ::fidl_next::fuchsia::HandleEncoder,
1049 {
1050 #[inline]
1051 fn encode(
1052 mut self,
1053 encoder: &mut ___E,
1054 out: &mut ::core::mem::MaybeUninit<
1055 crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
1056 >,
1057 _: (),
1058 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1059 ::fidl_next::munge!(let crate::wire::CpuElementManagerAddExecutionStateDependencyRequest { table } = out);
1060
1061 let max_ord = self.__max_ordinal();
1062
1063 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1064 ::fidl_next::Wire::zero_padding(&mut out);
1065
1066 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1067 ::fidl_next::wire::Envelope,
1068 >(encoder, max_ord);
1069
1070 for i in 1..=max_ord {
1071 match i {
1072 2 => {
1073 if let Some(value) = self.power_level.take() {
1074 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1075 value,
1076 preallocated.encoder,
1077 &mut out,
1078 (),
1079 )?;
1080 } else {
1081 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1082 }
1083 }
1084
1085 1 => {
1086 if let Some(value) = self.dependency_token.take() {
1087 ::fidl_next::wire::Envelope::encode_value::<
1088 ::fidl_next::wire::fuchsia::Event,
1089 ___E,
1090 >(
1091 value, preallocated.encoder, &mut out, ()
1092 )?;
1093 } else {
1094 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1095 }
1096 }
1097
1098 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1099 }
1100 unsafe {
1101 preallocated.write_next(out.assume_init_ref());
1102 }
1103 }
1104
1105 ::fidl_next::wire::Table::encode_len(table, max_ord);
1106
1107 Ok(())
1108 }
1109 }
1110
1111 impl<'de>
1112 ::fidl_next::FromWire<crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>>
1113 for CpuElementManagerAddExecutionStateDependencyRequest
1114 {
1115 #[inline]
1116 fn from_wire(
1117 wire_: crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>,
1118 ) -> Self {
1119 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1120
1121 let dependency_token = wire_.table.get(1);
1122
1123 let power_level = wire_.table.get(2);
1124
1125 Self {
1126 dependency_token: dependency_token.map(|envelope| {
1127 ::fidl_next::FromWire::from_wire(unsafe {
1128 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1129 })
1130 }),
1131
1132 power_level: power_level.map(|envelope| {
1133 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
1134 }),
1135 }
1136 }
1137 }
1138}
1139
1140pub mod wire {
1141
1142 pub use fidl_next_common_fuchsia_power_system::wire::*;
1143
1144 pub type LeaseToken = ::fidl_next::wire::fuchsia::EventPair;
1146
1147 #[derive(Debug)]
1149 #[repr(C)]
1150 pub struct ActivityGovernorAcquireWakeLeaseResponse {
1151 pub token: ::fidl_next::wire::fuchsia::EventPair,
1152 }
1153
1154 static_assertions::const_assert_eq!(
1155 std::mem::size_of::<ActivityGovernorAcquireWakeLeaseResponse>(),
1156 4
1157 );
1158 static_assertions::const_assert_eq!(
1159 std::mem::align_of::<ActivityGovernorAcquireWakeLeaseResponse>(),
1160 4
1161 );
1162
1163 static_assertions::const_assert_eq!(
1164 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseResponse, token),
1165 0
1166 );
1167
1168 impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLeaseResponse {
1169 type Constraint = ();
1170
1171 fn validate(
1172 _: ::fidl_next::Slot<'_, Self>,
1173 _: Self::Constraint,
1174 ) -> Result<(), ::fidl_next::ValidationError> {
1175 Ok(())
1176 }
1177 }
1178
1179 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLeaseResponse {
1180 type Narrowed<'de> = ActivityGovernorAcquireWakeLeaseResponse;
1181
1182 #[inline]
1183 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1184 ::fidl_next::munge! {
1185 let Self {
1186 token,
1187
1188 } = &mut *out_;
1189 }
1190
1191 ::fidl_next::Wire::zero_padding(token);
1192 }
1193 }
1194
1195 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireWakeLeaseResponse
1196 where
1197 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1198 ___D: ::fidl_next::fuchsia::HandleDecoder,
1199 {
1200 fn decode(
1201 slot_: ::fidl_next::Slot<'_, Self>,
1202 decoder_: &mut ___D,
1203 _: (),
1204 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1205 ::fidl_next::munge! {
1206 let Self {
1207 mut token,
1208
1209 } = slot_;
1210 }
1211
1212 let _field = token.as_mut();
1213
1214 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1215
1216 Ok(())
1217 }
1218 }
1219
1220 impl ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLeaseResponse {
1221 type Natural = crate::natural::ActivityGovernorAcquireWakeLeaseResponse;
1222 }
1223
1224 #[repr(C)]
1226 pub struct ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1227 pub(crate) table: ::fidl_next::wire::Table<'de>,
1228 }
1229
1230 impl<'de> Drop for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1231 fn drop(&mut self) {
1232 let _ = self.table.get(1).map(|envelope| unsafe {
1233 envelope.read_unchecked::<::fidl_next::ClientEnd<
1234 crate::SuspendBlocker,
1235 ::fidl_next::wire::fuchsia::Channel,
1236 >>()
1237 });
1238
1239 let _ = self.table.get(2).map(|envelope| unsafe {
1240 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
1241 });
1242 }
1243 }
1244
1245 impl ::fidl_next::Constrained for ActivityGovernorRegisterSuspendBlockerRequest<'_> {
1246 type Constraint = ();
1247
1248 fn validate(
1249 _: ::fidl_next::Slot<'_, Self>,
1250 _: Self::Constraint,
1251 ) -> Result<(), ::fidl_next::ValidationError> {
1252 Ok(())
1253 }
1254 }
1255
1256 unsafe impl ::fidl_next::Wire for ActivityGovernorRegisterSuspendBlockerRequest<'static> {
1257 type Narrowed<'de> = ActivityGovernorRegisterSuspendBlockerRequest<'de>;
1258
1259 #[inline]
1260 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1261 ::fidl_next::munge!(let Self { table } = out);
1262 ::fidl_next::wire::Table::zero_padding(table);
1263 }
1264 }
1265
1266 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1267 for ActivityGovernorRegisterSuspendBlockerRequest<'de>
1268 where
1269 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1270 ___D: ::fidl_next::fuchsia::HandleDecoder,
1271 {
1272 fn decode(
1273 slot: ::fidl_next::Slot<'_, Self>,
1274 decoder: &mut ___D,
1275 _: (),
1276 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1277 ::fidl_next::munge!(let Self { table } = slot);
1278
1279 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1280 match ordinal {
1281 0 => unsafe { ::core::hint::unreachable_unchecked() },
1282
1283 1 => {
1284 ::fidl_next::wire::Envelope::decode_as::<
1285 ___D,
1286 ::fidl_next::ClientEnd<
1287 crate::SuspendBlocker,
1288 ::fidl_next::wire::fuchsia::Channel,
1289 >,
1290 >(slot.as_mut(), decoder, ())?;
1291
1292 Ok(())
1293 }
1294
1295 2 => {
1296 ::fidl_next::wire::Envelope::decode_as::<
1297 ___D,
1298 ::fidl_next::wire::String<'de>,
1299 >(slot.as_mut(), decoder, 64)?;
1300
1301 let value = unsafe {
1302 slot.deref_unchecked()
1303 .deref_unchecked::<::fidl_next::wire::String<'_>>()
1304 };
1305
1306 if value.len() > 64 {
1307 return Err(::fidl_next::DecodeError::VectorTooLong {
1308 size: value.len() as u64,
1309 limit: 64,
1310 });
1311 }
1312
1313 Ok(())
1314 }
1315
1316 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1317 }
1318 })
1319 }
1320 }
1321
1322 impl<'de> ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1323 pub fn suspend_blocker(
1324 &self,
1325 ) -> ::core::option::Option<
1326 &::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::wire::fuchsia::Channel>,
1327 > {
1328 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1329 }
1330
1331 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
1332 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1333 }
1334 }
1335
1336 impl<'de> ::core::fmt::Debug for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1337 fn fmt(
1338 &self,
1339 f: &mut ::core::fmt::Formatter<'_>,
1340 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1341 f.debug_struct("ActivityGovernorRegisterSuspendBlockerRequest")
1342 .field("suspend_blocker", &self.suspend_blocker())
1343 .field("name", &self.name())
1344 .finish()
1345 }
1346 }
1347
1348 impl<'de> ::fidl_next::IntoNatural for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1349 type Natural = crate::natural::ActivityGovernorRegisterSuspendBlockerRequest;
1350 }
1351
1352 #[derive(Debug)]
1354 #[repr(C)]
1355 pub struct ActivityGovernorRegisterSuspendBlockerResponse {
1356 pub token: ::fidl_next::wire::fuchsia::EventPair,
1357 }
1358
1359 static_assertions::const_assert_eq!(
1360 std::mem::size_of::<ActivityGovernorRegisterSuspendBlockerResponse>(),
1361 4
1362 );
1363 static_assertions::const_assert_eq!(
1364 std::mem::align_of::<ActivityGovernorRegisterSuspendBlockerResponse>(),
1365 4
1366 );
1367
1368 static_assertions::const_assert_eq!(
1369 std::mem::offset_of!(ActivityGovernorRegisterSuspendBlockerResponse, token),
1370 0
1371 );
1372
1373 impl ::fidl_next::Constrained for ActivityGovernorRegisterSuspendBlockerResponse {
1374 type Constraint = ();
1375
1376 fn validate(
1377 _: ::fidl_next::Slot<'_, Self>,
1378 _: Self::Constraint,
1379 ) -> Result<(), ::fidl_next::ValidationError> {
1380 Ok(())
1381 }
1382 }
1383
1384 unsafe impl ::fidl_next::Wire for ActivityGovernorRegisterSuspendBlockerResponse {
1385 type Narrowed<'de> = ActivityGovernorRegisterSuspendBlockerResponse;
1386
1387 #[inline]
1388 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1389 ::fidl_next::munge! {
1390 let Self {
1391 token,
1392
1393 } = &mut *out_;
1394 }
1395
1396 ::fidl_next::Wire::zero_padding(token);
1397 }
1398 }
1399
1400 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorRegisterSuspendBlockerResponse
1401 where
1402 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1403 ___D: ::fidl_next::fuchsia::HandleDecoder,
1404 {
1405 fn decode(
1406 slot_: ::fidl_next::Slot<'_, Self>,
1407 decoder_: &mut ___D,
1408 _: (),
1409 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1410 ::fidl_next::munge! {
1411 let Self {
1412 mut token,
1413
1414 } = slot_;
1415 }
1416
1417 let _field = token.as_mut();
1418
1419 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1420
1421 Ok(())
1422 }
1423 }
1424
1425 impl ::fidl_next::IntoNatural for ActivityGovernorRegisterSuspendBlockerResponse {
1426 type Natural = crate::natural::ActivityGovernorRegisterSuspendBlockerResponse;
1427 }
1428
1429 #[repr(C)]
1431 pub struct ApplicationActivity<'de> {
1432 pub(crate) table: ::fidl_next::wire::Table<'de>,
1433 }
1434
1435 impl<'de> Drop for ApplicationActivity<'de> {
1436 fn drop(&mut self) {
1437 let _ = self.table.get(1).map(|envelope| unsafe {
1438 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1439 });
1440 }
1441 }
1442
1443 impl ::fidl_next::Constrained for ApplicationActivity<'_> {
1444 type Constraint = ();
1445
1446 fn validate(
1447 _: ::fidl_next::Slot<'_, Self>,
1448 _: Self::Constraint,
1449 ) -> Result<(), ::fidl_next::ValidationError> {
1450 Ok(())
1451 }
1452 }
1453
1454 unsafe impl ::fidl_next::Wire for ApplicationActivity<'static> {
1455 type Narrowed<'de> = ApplicationActivity<'de>;
1456
1457 #[inline]
1458 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1459 ::fidl_next::munge!(let Self { table } = out);
1460 ::fidl_next::wire::Table::zero_padding(table);
1461 }
1462 }
1463
1464 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ApplicationActivity<'de>
1465 where
1466 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1467 ___D: ::fidl_next::fuchsia::HandleDecoder,
1468 {
1469 fn decode(
1470 slot: ::fidl_next::Slot<'_, Self>,
1471 decoder: &mut ___D,
1472 _: (),
1473 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1474 ::fidl_next::munge!(let Self { table } = slot);
1475
1476 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1477 match ordinal {
1478 0 => unsafe { ::core::hint::unreachable_unchecked() },
1479
1480 1 => {
1481 ::fidl_next::wire::Envelope::decode_as::<
1482 ___D,
1483 ::fidl_next::wire::fuchsia::Event,
1484 >(slot.as_mut(), decoder, ())?;
1485
1486 Ok(())
1487 }
1488
1489 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1490 }
1491 })
1492 }
1493 }
1494
1495 impl<'de> ApplicationActivity<'de> {
1496 pub fn assertive_dependency_token(
1497 &self,
1498 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
1499 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1500 }
1501 }
1502
1503 impl<'de> ::core::fmt::Debug for ApplicationActivity<'de> {
1504 fn fmt(
1505 &self,
1506 f: &mut ::core::fmt::Formatter<'_>,
1507 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1508 f.debug_struct("ApplicationActivity")
1509 .field("assertive_dependency_token", &self.assertive_dependency_token())
1510 .finish()
1511 }
1512 }
1513
1514 impl<'de> ::fidl_next::IntoNatural for ApplicationActivity<'de> {
1515 type Natural = crate::natural::ApplicationActivity;
1516 }
1517
1518 #[repr(C)]
1520 pub struct PowerElements<'de> {
1521 pub(crate) table: ::fidl_next::wire::Table<'de>,
1522 }
1523
1524 impl<'de> Drop for PowerElements<'de> {
1525 fn drop(&mut self) {
1526 let _ = self.table.get(3).map(|envelope| unsafe {
1527 envelope.read_unchecked::<crate::wire::ApplicationActivity<'de>>()
1528 });
1529 }
1530 }
1531
1532 impl ::fidl_next::Constrained for PowerElements<'_> {
1533 type Constraint = ();
1534
1535 fn validate(
1536 _: ::fidl_next::Slot<'_, Self>,
1537 _: Self::Constraint,
1538 ) -> Result<(), ::fidl_next::ValidationError> {
1539 Ok(())
1540 }
1541 }
1542
1543 unsafe impl ::fidl_next::Wire for PowerElements<'static> {
1544 type Narrowed<'de> = PowerElements<'de>;
1545
1546 #[inline]
1547 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1548 ::fidl_next::munge!(let Self { table } = out);
1549 ::fidl_next::wire::Table::zero_padding(table);
1550 }
1551 }
1552
1553 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElements<'de>
1554 where
1555 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1556 ___D: ::fidl_next::fuchsia::HandleDecoder,
1557 {
1558 fn decode(
1559 slot: ::fidl_next::Slot<'_, Self>,
1560 decoder: &mut ___D,
1561 _: (),
1562 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1563 ::fidl_next::munge!(let Self { table } = slot);
1564
1565 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1566 match ordinal {
1567 0 => unsafe { ::core::hint::unreachable_unchecked() },
1568
1569 3 => {
1570 ::fidl_next::wire::Envelope::decode_as::<
1571 ___D,
1572 crate::wire::ApplicationActivity<'de>,
1573 >(slot.as_mut(), decoder, ())?;
1574
1575 Ok(())
1576 }
1577
1578 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1579 }
1580 })
1581 }
1582 }
1583
1584 impl<'de> PowerElements<'de> {
1585 pub fn application_activity(
1586 &self,
1587 ) -> ::core::option::Option<&crate::wire::ApplicationActivity<'de>> {
1588 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
1589 }
1590 }
1591
1592 impl<'de> ::core::fmt::Debug for PowerElements<'de> {
1593 fn fmt(
1594 &self,
1595 f: &mut ::core::fmt::Formatter<'_>,
1596 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1597 f.debug_struct("PowerElements")
1598 .field("application_activity", &self.application_activity())
1599 .finish()
1600 }
1601 }
1602
1603 impl<'de> ::fidl_next::IntoNatural for PowerElements<'de> {
1604 type Natural = crate::natural::PowerElements;
1605 }
1606
1607 #[derive(Debug)]
1609 #[repr(C)]
1610 pub struct ActivityGovernorTakeWakeLeaseResponse {
1611 pub token: ::fidl_next::wire::fuchsia::EventPair,
1612 }
1613
1614 static_assertions::const_assert_eq!(
1615 std::mem::size_of::<ActivityGovernorTakeWakeLeaseResponse>(),
1616 4
1617 );
1618 static_assertions::const_assert_eq!(
1619 std::mem::align_of::<ActivityGovernorTakeWakeLeaseResponse>(),
1620 4
1621 );
1622
1623 static_assertions::const_assert_eq!(
1624 std::mem::offset_of!(ActivityGovernorTakeWakeLeaseResponse, token),
1625 0
1626 );
1627
1628 impl ::fidl_next::Constrained for ActivityGovernorTakeWakeLeaseResponse {
1629 type Constraint = ();
1630
1631 fn validate(
1632 _: ::fidl_next::Slot<'_, Self>,
1633 _: Self::Constraint,
1634 ) -> Result<(), ::fidl_next::ValidationError> {
1635 Ok(())
1636 }
1637 }
1638
1639 unsafe impl ::fidl_next::Wire for ActivityGovernorTakeWakeLeaseResponse {
1640 type Narrowed<'de> = ActivityGovernorTakeWakeLeaseResponse;
1641
1642 #[inline]
1643 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1644 ::fidl_next::munge! {
1645 let Self {
1646 token,
1647
1648 } = &mut *out_;
1649 }
1650
1651 ::fidl_next::Wire::zero_padding(token);
1652 }
1653 }
1654
1655 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorTakeWakeLeaseResponse
1656 where
1657 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1658 ___D: ::fidl_next::fuchsia::HandleDecoder,
1659 {
1660 fn decode(
1661 slot_: ::fidl_next::Slot<'_, Self>,
1662 decoder_: &mut ___D,
1663 _: (),
1664 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1665 ::fidl_next::munge! {
1666 let Self {
1667 mut token,
1668
1669 } = slot_;
1670 }
1671
1672 let _field = token.as_mut();
1673
1674 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1675
1676 Ok(())
1677 }
1678 }
1679
1680 impl ::fidl_next::IntoNatural for ActivityGovernorTakeWakeLeaseResponse {
1681 type Natural = crate::natural::ActivityGovernorTakeWakeLeaseResponse;
1682 }
1683
1684 #[derive(Debug)]
1686 #[repr(C)]
1687 pub struct ActivityGovernorAcquireLongWakeLeaseResponse {
1688 pub token: ::fidl_next::wire::fuchsia::EventPair,
1689 }
1690
1691 static_assertions::const_assert_eq!(
1692 std::mem::size_of::<ActivityGovernorAcquireLongWakeLeaseResponse>(),
1693 4
1694 );
1695 static_assertions::const_assert_eq!(
1696 std::mem::align_of::<ActivityGovernorAcquireLongWakeLeaseResponse>(),
1697 4
1698 );
1699
1700 static_assertions::const_assert_eq!(
1701 std::mem::offset_of!(ActivityGovernorAcquireLongWakeLeaseResponse, token),
1702 0
1703 );
1704
1705 impl ::fidl_next::Constrained for ActivityGovernorAcquireLongWakeLeaseResponse {
1706 type Constraint = ();
1707
1708 fn validate(
1709 _: ::fidl_next::Slot<'_, Self>,
1710 _: Self::Constraint,
1711 ) -> Result<(), ::fidl_next::ValidationError> {
1712 Ok(())
1713 }
1714 }
1715
1716 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireLongWakeLeaseResponse {
1717 type Narrowed<'de> = ActivityGovernorAcquireLongWakeLeaseResponse;
1718
1719 #[inline]
1720 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1721 ::fidl_next::munge! {
1722 let Self {
1723 token,
1724
1725 } = &mut *out_;
1726 }
1727
1728 ::fidl_next::Wire::zero_padding(token);
1729 }
1730 }
1731
1732 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireLongWakeLeaseResponse
1733 where
1734 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1735 ___D: ::fidl_next::fuchsia::HandleDecoder,
1736 {
1737 fn decode(
1738 slot_: ::fidl_next::Slot<'_, Self>,
1739 decoder_: &mut ___D,
1740 _: (),
1741 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1742 ::fidl_next::munge! {
1743 let Self {
1744 mut token,
1745
1746 } = slot_;
1747 }
1748
1749 let _field = token.as_mut();
1750
1751 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1752
1753 Ok(())
1754 }
1755 }
1756
1757 impl ::fidl_next::IntoNatural for ActivityGovernorAcquireLongWakeLeaseResponse {
1758 type Natural = crate::natural::ActivityGovernorAcquireLongWakeLeaseResponse;
1759 }
1760
1761 #[derive(Debug)]
1763 #[repr(C)]
1764 pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de> {
1765 pub name: ::fidl_next::wire::String<'de>,
1766
1767 pub server_token: ::fidl_next::wire::fuchsia::EventPair,
1768 }
1769
1770 static_assertions::const_assert_eq!(
1771 std::mem::size_of::<ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>>(),
1772 24
1773 );
1774 static_assertions::const_assert_eq!(
1775 std::mem::align_of::<ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>>(),
1776 8
1777 );
1778
1779 static_assertions::const_assert_eq!(
1780 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>, name),
1781 0
1782 );
1783
1784 static_assertions::const_assert_eq!(
1785 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>, server_token),
1786 16
1787 );
1788
1789 impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_> {
1790 type Constraint = ();
1791
1792 fn validate(
1793 _: ::fidl_next::Slot<'_, Self>,
1794 _: Self::Constraint,
1795 ) -> Result<(), ::fidl_next::ValidationError> {
1796 Ok(())
1797 }
1798 }
1799
1800 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static> {
1801 type Narrowed<'de> = ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>;
1802
1803 #[inline]
1804 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1805 ::fidl_next::munge! {
1806 let Self {
1807 name,
1808 server_token,
1809
1810 } = &mut *out_;
1811 }
1812
1813 ::fidl_next::Wire::zero_padding(name);
1814
1815 ::fidl_next::Wire::zero_padding(server_token);
1816
1817 unsafe {
1818 out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
1819 }
1820 }
1821 }
1822
1823 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1824 for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>
1825 where
1826 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1827 ___D: ::fidl_next::Decoder<'de>,
1828 ___D: ::fidl_next::fuchsia::HandleDecoder,
1829 {
1830 fn decode(
1831 slot_: ::fidl_next::Slot<'_, Self>,
1832 decoder_: &mut ___D,
1833 _: (),
1834 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1835 if slot_.as_bytes()[20..24] != [0u8; 4] {
1836 return Err(::fidl_next::DecodeError::InvalidPadding);
1837 }
1838
1839 ::fidl_next::munge! {
1840 let Self {
1841 mut name,
1842 mut server_token,
1843
1844 } = slot_;
1845 }
1846
1847 let _field = name.as_mut();
1848 ::fidl_next::Constrained::validate(_field, 64)?;
1849 ::fidl_next::Decode::decode(name.as_mut(), decoder_, 64)?;
1850
1851 let name = unsafe { name.deref_unchecked() };
1852
1853 if name.len() > 64 {
1854 return Err(::fidl_next::DecodeError::VectorTooLong {
1855 size: name.len() as u64,
1856 limit: 64,
1857 });
1858 }
1859
1860 let _field = server_token.as_mut();
1861
1862 ::fidl_next::Decode::decode(server_token.as_mut(), decoder_, ())?;
1863
1864 Ok(())
1865 }
1866 }
1867
1868 impl<'de> ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de> {
1869 type Natural = crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenRequest;
1870 }
1871
1872 #[derive(Debug)]
1874 #[repr(C)]
1875 pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
1876 pub token: ::fidl_next::wire::fuchsia::EventPair,
1877 }
1878
1879 static_assertions::const_assert_eq!(
1880 std::mem::size_of::<ActivityGovernorTakeApplicationActivityLeaseResponse>(),
1881 4
1882 );
1883 static_assertions::const_assert_eq!(
1884 std::mem::align_of::<ActivityGovernorTakeApplicationActivityLeaseResponse>(),
1885 4
1886 );
1887
1888 static_assertions::const_assert_eq!(
1889 std::mem::offset_of!(ActivityGovernorTakeApplicationActivityLeaseResponse, token),
1890 0
1891 );
1892
1893 impl ::fidl_next::Constrained for ActivityGovernorTakeApplicationActivityLeaseResponse {
1894 type Constraint = ();
1895
1896 fn validate(
1897 _: ::fidl_next::Slot<'_, Self>,
1898 _: Self::Constraint,
1899 ) -> Result<(), ::fidl_next::ValidationError> {
1900 Ok(())
1901 }
1902 }
1903
1904 unsafe impl ::fidl_next::Wire for ActivityGovernorTakeApplicationActivityLeaseResponse {
1905 type Narrowed<'de> = ActivityGovernorTakeApplicationActivityLeaseResponse;
1906
1907 #[inline]
1908 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1909 ::fidl_next::munge! {
1910 let Self {
1911 token,
1912
1913 } = &mut *out_;
1914 }
1915
1916 ::fidl_next::Wire::zero_padding(token);
1917 }
1918 }
1919
1920 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorTakeApplicationActivityLeaseResponse
1921 where
1922 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1923 ___D: ::fidl_next::fuchsia::HandleDecoder,
1924 {
1925 fn decode(
1926 slot_: ::fidl_next::Slot<'_, Self>,
1927 decoder_: &mut ___D,
1928 _: (),
1929 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1930 ::fidl_next::munge! {
1931 let Self {
1932 mut token,
1933
1934 } = slot_;
1935 }
1936
1937 let _field = token.as_mut();
1938
1939 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1940
1941 Ok(())
1942 }
1943 }
1944
1945 impl ::fidl_next::IntoNatural for ActivityGovernorTakeApplicationActivityLeaseResponse {
1946 type Natural = crate::natural::ActivityGovernorTakeApplicationActivityLeaseResponse;
1947 }
1948
1949 #[repr(C)]
1951 pub struct Cpu<'de> {
1952 pub(crate) table: ::fidl_next::wire::Table<'de>,
1953 }
1954
1955 impl<'de> Drop for Cpu<'de> {
1956 fn drop(&mut self) {
1957 let _ = self.table.get(1).map(|envelope| unsafe {
1958 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1959 });
1960 }
1961 }
1962
1963 impl ::fidl_next::Constrained for Cpu<'_> {
1964 type Constraint = ();
1965
1966 fn validate(
1967 _: ::fidl_next::Slot<'_, Self>,
1968 _: Self::Constraint,
1969 ) -> Result<(), ::fidl_next::ValidationError> {
1970 Ok(())
1971 }
1972 }
1973
1974 unsafe impl ::fidl_next::Wire for Cpu<'static> {
1975 type Narrowed<'de> = Cpu<'de>;
1976
1977 #[inline]
1978 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1979 ::fidl_next::munge!(let Self { table } = out);
1980 ::fidl_next::wire::Table::zero_padding(table);
1981 }
1982 }
1983
1984 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Cpu<'de>
1985 where
1986 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1987 ___D: ::fidl_next::fuchsia::HandleDecoder,
1988 {
1989 fn decode(
1990 slot: ::fidl_next::Slot<'_, Self>,
1991 decoder: &mut ___D,
1992 _: (),
1993 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1994 ::fidl_next::munge!(let Self { table } = slot);
1995
1996 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1997 match ordinal {
1998 0 => unsafe { ::core::hint::unreachable_unchecked() },
1999
2000 1 => {
2001 ::fidl_next::wire::Envelope::decode_as::<
2002 ___D,
2003 ::fidl_next::wire::fuchsia::Event,
2004 >(slot.as_mut(), decoder, ())?;
2005
2006 Ok(())
2007 }
2008
2009 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2010 }
2011 })
2012 }
2013 }
2014
2015 impl<'de> Cpu<'de> {
2016 pub fn assertive_dependency_token(
2017 &self,
2018 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2019 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2020 }
2021 }
2022
2023 impl<'de> ::core::fmt::Debug for Cpu<'de> {
2024 fn fmt(
2025 &self,
2026 f: &mut ::core::fmt::Formatter<'_>,
2027 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2028 f.debug_struct("Cpu")
2029 .field("assertive_dependency_token", &self.assertive_dependency_token())
2030 .finish()
2031 }
2032 }
2033
2034 impl<'de> ::fidl_next::IntoNatural for Cpu<'de> {
2035 type Natural = crate::natural::Cpu;
2036 }
2037
2038 #[repr(C)]
2040 pub struct CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2041 pub(crate) table: ::fidl_next::wire::Table<'de>,
2042 }
2043
2044 impl<'de> Drop for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2045 fn drop(&mut self) {
2046 let _ = self.table.get(1).map(|envelope| unsafe {
2047 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2048 });
2049
2050 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2051 }
2052 }
2053
2054 impl ::fidl_next::Constrained for CpuElementManagerAddExecutionStateDependencyRequest<'_> {
2055 type Constraint = ();
2056
2057 fn validate(
2058 _: ::fidl_next::Slot<'_, Self>,
2059 _: Self::Constraint,
2060 ) -> Result<(), ::fidl_next::ValidationError> {
2061 Ok(())
2062 }
2063 }
2064
2065 unsafe impl ::fidl_next::Wire for CpuElementManagerAddExecutionStateDependencyRequest<'static> {
2066 type Narrowed<'de> = CpuElementManagerAddExecutionStateDependencyRequest<'de>;
2067
2068 #[inline]
2069 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2070 ::fidl_next::munge!(let Self { table } = out);
2071 ::fidl_next::wire::Table::zero_padding(table);
2072 }
2073 }
2074
2075 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2076 for CpuElementManagerAddExecutionStateDependencyRequest<'de>
2077 where
2078 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2079 ___D: ::fidl_next::fuchsia::HandleDecoder,
2080 {
2081 fn decode(
2082 slot: ::fidl_next::Slot<'_, Self>,
2083 decoder: &mut ___D,
2084 _: (),
2085 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2086 ::fidl_next::munge!(let Self { table } = slot);
2087
2088 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2089 match ordinal {
2090 0 => unsafe { ::core::hint::unreachable_unchecked() },
2091
2092 1 => {
2093 ::fidl_next::wire::Envelope::decode_as::<
2094 ___D,
2095 ::fidl_next::wire::fuchsia::Event,
2096 >(slot.as_mut(), decoder, ())?;
2097
2098 Ok(())
2099 }
2100
2101 2 => {
2102 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2103 slot.as_mut(),
2104 decoder,
2105 (),
2106 )?;
2107
2108 Ok(())
2109 }
2110
2111 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2112 }
2113 })
2114 }
2115 }
2116
2117 impl<'de> CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2118 pub fn dependency_token(
2119 &self,
2120 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2121 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2122 }
2123
2124 pub fn power_level(&self) -> ::core::option::Option<&u8> {
2125 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2126 }
2127 }
2128
2129 impl<'de> ::core::fmt::Debug for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2130 fn fmt(
2131 &self,
2132 f: &mut ::core::fmt::Formatter<'_>,
2133 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2134 f.debug_struct("CpuElementManagerAddExecutionStateDependencyRequest")
2135 .field("dependency_token", &self.dependency_token())
2136 .field("power_level", &self.power_level())
2137 .finish()
2138 }
2139 }
2140
2141 impl<'de> ::fidl_next::IntoNatural for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2142 type Natural = crate::natural::CpuElementManagerAddExecutionStateDependencyRequest;
2143 }
2144}
2145
2146pub mod wire_optional {
2147
2148 pub use fidl_next_common_fuchsia_power_system::wire_optional::*;
2149}
2150
2151pub mod generic {
2152
2153 pub use fidl_next_common_fuchsia_power_system::generic::*;
2154
2155 pub struct ActivityGovernorAcquireWakeLeaseResponse<T0> {
2157 pub token: T0,
2158 }
2159
2160 unsafe impl<___E, T0>
2161 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>
2162 for ActivityGovernorAcquireWakeLeaseResponse<T0>
2163 where
2164 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2165 ___E: ::fidl_next::fuchsia::HandleEncoder,
2166 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2167 {
2168 #[inline]
2169 fn encode(
2170 self,
2171 encoder_: &mut ___E,
2172 out_: &mut ::core::mem::MaybeUninit<
2173 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
2174 >,
2175 _: (),
2176 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2177 ::fidl_next::munge! {
2178 let crate::wire::ActivityGovernorAcquireWakeLeaseResponse {
2179 token,
2180
2181 } = out_;
2182 }
2183
2184 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2185
2186 Ok(())
2187 }
2188 }
2189
2190 pub struct ActivityGovernorRegisterSuspendBlockerResponse<T0> {
2192 pub token: T0,
2193 }
2194
2195 unsafe impl<___E, T0>
2196 ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>
2197 for ActivityGovernorRegisterSuspendBlockerResponse<T0>
2198 where
2199 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2200 ___E: ::fidl_next::fuchsia::HandleEncoder,
2201 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2202 {
2203 #[inline]
2204 fn encode(
2205 self,
2206 encoder_: &mut ___E,
2207 out_: &mut ::core::mem::MaybeUninit<
2208 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
2209 >,
2210 _: (),
2211 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2212 ::fidl_next::munge! {
2213 let crate::wire::ActivityGovernorRegisterSuspendBlockerResponse {
2214 token,
2215
2216 } = out_;
2217 }
2218
2219 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2220
2221 Ok(())
2222 }
2223 }
2224
2225 pub struct ActivityGovernorTakeWakeLeaseResponse<T0> {
2227 pub token: T0,
2228 }
2229
2230 unsafe impl<___E, T0>
2231 ::fidl_next::Encode<crate::wire::ActivityGovernorTakeWakeLeaseResponse, ___E>
2232 for ActivityGovernorTakeWakeLeaseResponse<T0>
2233 where
2234 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2235 ___E: ::fidl_next::fuchsia::HandleEncoder,
2236 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2237 {
2238 #[inline]
2239 fn encode(
2240 self,
2241 encoder_: &mut ___E,
2242 out_: &mut ::core::mem::MaybeUninit<crate::wire::ActivityGovernorTakeWakeLeaseResponse>,
2243 _: (),
2244 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2245 ::fidl_next::munge! {
2246 let crate::wire::ActivityGovernorTakeWakeLeaseResponse {
2247 token,
2248
2249 } = out_;
2250 }
2251
2252 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2253
2254 Ok(())
2255 }
2256 }
2257
2258 pub struct ActivityGovernorAcquireLongWakeLeaseResponse<T0> {
2260 pub token: T0,
2261 }
2262
2263 unsafe impl<___E, T0>
2264 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse, ___E>
2265 for ActivityGovernorAcquireLongWakeLeaseResponse<T0>
2266 where
2267 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2268 ___E: ::fidl_next::fuchsia::HandleEncoder,
2269 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2270 {
2271 #[inline]
2272 fn encode(
2273 self,
2274 encoder_: &mut ___E,
2275 out_: &mut ::core::mem::MaybeUninit<
2276 crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse,
2277 >,
2278 _: (),
2279 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2280 ::fidl_next::munge! {
2281 let crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse {
2282 token,
2283
2284 } = out_;
2285 }
2286
2287 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2288
2289 Ok(())
2290 }
2291 }
2292
2293 pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1> {
2295 pub name: T0,
2296
2297 pub server_token: T1,
2298 }
2299
2300 unsafe impl<___E, T0, T1>
2301 ::fidl_next::Encode<
2302 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2303 ___E,
2304 > for ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1>
2305 where
2306 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2307 ___E: ::fidl_next::Encoder,
2308 ___E: ::fidl_next::fuchsia::HandleEncoder,
2309 T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
2310 T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2311 {
2312 #[inline]
2313 fn encode(
2314 self,
2315 encoder_: &mut ___E,
2316 out_: &mut ::core::mem::MaybeUninit<
2317 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2318 >,
2319 _: (),
2320 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2321 ::fidl_next::munge! {
2322 let crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
2323 name,
2324 server_token,
2325
2326 } = out_;
2327 }
2328
2329 ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
2330
2331 ::fidl_next::Encode::encode(self.server_token, encoder_, server_token, ())?;
2332
2333 Ok(())
2334 }
2335 }
2336
2337 pub struct ActivityGovernorTakeApplicationActivityLeaseResponse<T0> {
2339 pub token: T0,
2340 }
2341
2342 unsafe impl<___E, T0>
2343 ::fidl_next::Encode<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse, ___E>
2344 for ActivityGovernorTakeApplicationActivityLeaseResponse<T0>
2345 where
2346 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2347 ___E: ::fidl_next::fuchsia::HandleEncoder,
2348 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2349 {
2350 #[inline]
2351 fn encode(
2352 self,
2353 encoder_: &mut ___E,
2354 out_: &mut ::core::mem::MaybeUninit<
2355 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
2356 >,
2357 _: (),
2358 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2359 ::fidl_next::munge! {
2360 let crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse {
2361 token,
2362
2363 } = out_;
2364 }
2365
2366 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2367
2368 Ok(())
2369 }
2370 }
2371}
2372
2373pub use self::natural::*;
2374
2375#[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"]
2377#[derive(PartialEq, Debug)]
2378pub struct ActivityGovernor;
2379
2380impl ::fidl_next::Discoverable for ActivityGovernor {
2381 const PROTOCOL_NAME: &'static str = "fuchsia.power.system.ActivityGovernor";
2382}
2383
2384#[cfg(target_os = "fuchsia")]
2385impl ::fidl_next::HasTransport for ActivityGovernor {
2386 type Transport = ::fidl_next::fuchsia::zx::Channel;
2387}
2388
2389pub mod activity_governor {
2390 pub mod prelude {
2391 pub use crate::{
2392 ActivityGovernor, ActivityGovernorClientHandler, ActivityGovernorLocalClientHandler,
2393 ActivityGovernorLocalServerHandler, ActivityGovernorServerHandler, activity_governor,
2394 };
2395
2396 pub use crate::natural::AcquireWakeLeaseError;
2397
2398 pub use crate::natural::ActivityGovernorAcquireLongWakeLeaseRequest;
2399
2400 pub use crate::natural::ActivityGovernorAcquireWakeLeaseRequest;
2401
2402 pub use crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenRequest;
2403
2404 pub use crate::natural::ActivityGovernorRegisterSuspendBlockerRequest;
2405
2406 pub use crate::natural::ActivityGovernorTakeApplicationActivityLeaseRequest;
2407
2408 pub use crate::natural::ActivityGovernorTakeWakeLeaseRequest;
2409
2410 pub use crate::natural::ActivityGovernorAcquireLongWakeLeaseResponse;
2411
2412 pub use crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenResponse;
2413
2414 pub use crate::natural::ActivityGovernorAcquireWakeLeaseResponse;
2415
2416 pub use crate::natural::ActivityGovernorRegisterSuspendBlockerResponse;
2417
2418 pub use crate::natural::ActivityGovernorTakeApplicationActivityLeaseResponse;
2419
2420 pub use crate::natural::ActivityGovernorTakeWakeLeaseResponse;
2421
2422 pub use crate::natural::PowerElements;
2423
2424 pub use crate::natural::RegisterSuspendBlockerError;
2425 }
2426
2427 pub struct GetPowerElements;
2428
2429 impl ::fidl_next::Method for GetPowerElements {
2430 const ORDINAL: u64 = 8755001135707412082;
2431 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2432 ::fidl_next::protocol::Flexibility::Flexible;
2433
2434 type Protocol = crate::ActivityGovernor;
2435
2436 type Request = ::fidl_next::wire::EmptyMessageBody;
2437 }
2438
2439 impl ::fidl_next::TwoWayMethod for GetPowerElements {
2440 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::PowerElements<'static>>;
2441 }
2442
2443 impl<___R> ::fidl_next::Respond<___R> for GetPowerElements {
2444 type Output = ::fidl_next::Flexible<___R>;
2445
2446 fn respond(response: ___R) -> Self::Output {
2447 ::fidl_next::Flexible::Ok(response)
2448 }
2449 }
2450
2451 pub struct TakeWakeLease;
2452
2453 impl ::fidl_next::Method for TakeWakeLease {
2454 const ORDINAL: u64 = 2962518918789578601;
2455 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2456 ::fidl_next::protocol::Flexibility::Flexible;
2457
2458 type Protocol = crate::ActivityGovernor;
2459
2460 type Request = crate::wire::ActivityGovernorTakeWakeLeaseRequest<'static>;
2461 }
2462
2463 impl ::fidl_next::TwoWayMethod for TakeWakeLease {
2464 type Response = ::fidl_next::wire::Flexible<
2465 'static,
2466 crate::wire::ActivityGovernorTakeWakeLeaseResponse,
2467 >;
2468 }
2469
2470 impl<___R> ::fidl_next::Respond<___R> for TakeWakeLease {
2471 type Output =
2472 ::fidl_next::Flexible<crate::generic::ActivityGovernorTakeWakeLeaseResponse<___R>>;
2473
2474 fn respond(response: ___R) -> Self::Output {
2475 ::fidl_next::Flexible::Ok(crate::generic::ActivityGovernorTakeWakeLeaseResponse {
2476 token: response,
2477 })
2478 }
2479 }
2480
2481 pub struct AcquireWakeLease;
2482
2483 impl ::fidl_next::Method for AcquireWakeLease {
2484 const ORDINAL: u64 = 3306304846648819971;
2485 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2486 ::fidl_next::protocol::Flexibility::Flexible;
2487
2488 type Protocol = crate::ActivityGovernor;
2489
2490 type Request = crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'static>;
2491 }
2492
2493 impl ::fidl_next::TwoWayMethod for AcquireWakeLease {
2494 type Response = ::fidl_next::wire::FlexibleResult<
2495 'static,
2496 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
2497 crate::wire::AcquireWakeLeaseError,
2498 >;
2499 }
2500
2501 impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLease {
2502 type Output = ::fidl_next::FlexibleResult<
2503 crate::generic::ActivityGovernorAcquireWakeLeaseResponse<___R>,
2504 ::fidl_next::util::Never,
2505 >;
2506
2507 fn respond(response: ___R) -> Self::Output {
2508 ::fidl_next::FlexibleResult::Ok(
2509 crate::generic::ActivityGovernorAcquireWakeLeaseResponse { token: response },
2510 )
2511 }
2512 }
2513
2514 impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLease {
2515 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
2516
2517 fn respond_err(response: ___R) -> Self::Output {
2518 ::fidl_next::FlexibleResult::Err(response)
2519 }
2520 }
2521
2522 pub struct AcquireLongWakeLease;
2523
2524 impl ::fidl_next::Method for AcquireLongWakeLease {
2525 const ORDINAL: u64 = 2258586591235944042;
2526 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2527 ::fidl_next::protocol::Flexibility::Flexible;
2528
2529 type Protocol = crate::ActivityGovernor;
2530
2531 type Request = crate::wire::ActivityGovernorAcquireLongWakeLeaseRequest<'static>;
2532 }
2533
2534 impl ::fidl_next::TwoWayMethod for AcquireLongWakeLease {
2535 type Response = ::fidl_next::wire::FlexibleResult<
2536 'static,
2537 crate::wire::ActivityGovernorAcquireLongWakeLeaseResponse,
2538 crate::wire::AcquireWakeLeaseError,
2539 >;
2540 }
2541
2542 impl<___R> ::fidl_next::Respond<___R> for AcquireLongWakeLease {
2543 type Output = ::fidl_next::FlexibleResult<
2544 crate::generic::ActivityGovernorAcquireLongWakeLeaseResponse<___R>,
2545 ::fidl_next::util::Never,
2546 >;
2547
2548 fn respond(response: ___R) -> Self::Output {
2549 ::fidl_next::FlexibleResult::Ok(
2550 crate::generic::ActivityGovernorAcquireLongWakeLeaseResponse { token: response },
2551 )
2552 }
2553 }
2554
2555 impl<___R> ::fidl_next::RespondErr<___R> for AcquireLongWakeLease {
2556 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
2557
2558 fn respond_err(response: ___R) -> Self::Output {
2559 ::fidl_next::FlexibleResult::Err(response)
2560 }
2561 }
2562
2563 pub struct AcquireWakeLeaseWithToken;
2564
2565 impl ::fidl_next::Method for AcquireWakeLeaseWithToken {
2566 const ORDINAL: u64 = 2079869883732225873;
2567 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2568 ::fidl_next::protocol::Flexibility::Flexible;
2569
2570 type Protocol = crate::ActivityGovernor;
2571
2572 type Request = crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>;
2573 }
2574
2575 impl ::fidl_next::TwoWayMethod for AcquireWakeLeaseWithToken {
2576 type Response = ::fidl_next::wire::FlexibleResult<
2577 'static,
2578 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenResponse,
2579 crate::wire::AcquireWakeLeaseError,
2580 >;
2581 }
2582
2583 impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLeaseWithToken {
2584 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
2585
2586 fn respond(response: ___R) -> Self::Output {
2587 ::fidl_next::FlexibleResult::Ok(response)
2588 }
2589 }
2590
2591 impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLeaseWithToken {
2592 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
2593
2594 fn respond_err(response: ___R) -> Self::Output {
2595 ::fidl_next::FlexibleResult::Err(response)
2596 }
2597 }
2598
2599 pub struct TakeApplicationActivityLease;
2600
2601 impl ::fidl_next::Method for TakeApplicationActivityLease {
2602 const ORDINAL: u64 = 4020961735006149140;
2603 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2604 ::fidl_next::protocol::Flexibility::Flexible;
2605
2606 type Protocol = crate::ActivityGovernor;
2607
2608 type Request = crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'static>;
2609 }
2610
2611 impl ::fidl_next::TwoWayMethod for TakeApplicationActivityLease {
2612 type Response = ::fidl_next::wire::Flexible<
2613 'static,
2614 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
2615 >;
2616 }
2617
2618 impl<___R> ::fidl_next::Respond<___R> for TakeApplicationActivityLease {
2619 type Output = ::fidl_next::Flexible<
2620 crate::generic::ActivityGovernorTakeApplicationActivityLeaseResponse<___R>,
2621 >;
2622
2623 fn respond(response: ___R) -> Self::Output {
2624 ::fidl_next::Flexible::Ok(
2625 crate::generic::ActivityGovernorTakeApplicationActivityLeaseResponse {
2626 token: response,
2627 },
2628 )
2629 }
2630 }
2631
2632 pub struct RegisterSuspendBlocker;
2633
2634 impl ::fidl_next::Method for RegisterSuspendBlocker {
2635 const ORDINAL: u64 = 3814361630267862785;
2636 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2637 ::fidl_next::protocol::Flexibility::Flexible;
2638
2639 type Protocol = crate::ActivityGovernor;
2640
2641 type Request = crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>;
2642 }
2643
2644 impl ::fidl_next::TwoWayMethod for RegisterSuspendBlocker {
2645 type Response = ::fidl_next::wire::FlexibleResult<
2646 'static,
2647 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
2648 crate::wire::RegisterSuspendBlockerError,
2649 >;
2650 }
2651
2652 impl<___R> ::fidl_next::Respond<___R> for RegisterSuspendBlocker {
2653 type Output = ::fidl_next::FlexibleResult<
2654 crate::generic::ActivityGovernorRegisterSuspendBlockerResponse<___R>,
2655 ::fidl_next::util::Never,
2656 >;
2657
2658 fn respond(response: ___R) -> Self::Output {
2659 ::fidl_next::FlexibleResult::Ok(
2660 crate::generic::ActivityGovernorRegisterSuspendBlockerResponse { token: response },
2661 )
2662 }
2663 }
2664
2665 impl<___R> ::fidl_next::RespondErr<___R> for RegisterSuspendBlocker {
2666 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
2667
2668 fn respond_err(response: ___R) -> Self::Output {
2669 ::fidl_next::FlexibleResult::Err(response)
2670 }
2671 }
2672
2673 mod ___detail {
2674 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ActivityGovernor
2675 where
2676 ___T: ::fidl_next::Transport,
2677 {
2678 type Client = ActivityGovernorClient<___T>;
2679 type Server = ActivityGovernorServer<___T>;
2680 }
2681
2682 #[repr(transparent)]
2684 pub struct ActivityGovernorClient<___T: ::fidl_next::Transport> {
2685 #[allow(dead_code)]
2686 client: ::fidl_next::protocol::Client<___T>,
2687 }
2688
2689 impl<___T> ActivityGovernorClient<___T>
2690 where
2691 ___T: ::fidl_next::Transport,
2692 {
2693 #[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"]
2694 pub fn get_power_elements(
2695 &self,
2696 ) -> ::fidl_next::TwoWayFuture<'_, super::GetPowerElements, ___T> {
2697 ::fidl_next::TwoWayFuture::from_untyped(
2698 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
2699 8755001135707412082,
2700 <super::GetPowerElements as ::fidl_next::Method>::FLEXIBILITY,
2701 (),
2702 ),
2703 )
2704 }
2705
2706 #[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\n If an error occurs while creating a token for the wake lease, then the\n channel to `ActivityGovernor` will be closed by the server and no\n response will be returned.\n"]
2707 pub fn take_wake_lease(
2708 &self,
2709
2710 name: impl ::fidl_next::Encode<
2711 ::fidl_next::wire::String<'static>,
2712 <___T as ::fidl_next::Transport>::SendBuffer,
2713 >,
2714 ) -> ::fidl_next::TwoWayFuture<'_, super::TakeWakeLease, ___T>
2715 where
2716 <___T as ::fidl_next::Transport>::SendBuffer:
2717 ::fidl_next::encoder::InternalHandleEncoder,
2718 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2719 {
2720 self.take_wake_lease_with(crate::generic::ActivityGovernorTakeWakeLeaseRequest {
2721 name,
2722 })
2723 }
2724
2725 #[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\n If an error occurs while creating a token for the wake lease, then the\n channel to `ActivityGovernor` will be closed by the server and no\n response will be returned.\n"]
2726 pub fn take_wake_lease_with<___R>(
2727 &self,
2728 request: ___R,
2729 ) -> ::fidl_next::TwoWayFuture<'_, super::TakeWakeLease, ___T>
2730 where
2731 ___R: ::fidl_next::Encode<
2732 crate::wire::ActivityGovernorTakeWakeLeaseRequest<'static>,
2733 <___T as ::fidl_next::Transport>::SendBuffer,
2734 >,
2735 {
2736 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2737 2962518918789578601,
2738 <super::TakeWakeLease as ::fidl_next::Method>::FLEXIBILITY,
2739 request,
2740 ))
2741 }
2742
2743 #[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"]
2744 pub fn acquire_wake_lease(
2745 &self,
2746
2747 name: impl ::fidl_next::Encode<
2748 ::fidl_next::wire::String<'static>,
2749 <___T as ::fidl_next::Transport>::SendBuffer,
2750 >,
2751 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease, ___T>
2752 where
2753 <___T as ::fidl_next::Transport>::SendBuffer:
2754 ::fidl_next::encoder::InternalHandleEncoder,
2755 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2756 {
2757 self.acquire_wake_lease_with(
2758 crate::generic::ActivityGovernorAcquireWakeLeaseRequest { name },
2759 )
2760 }
2761
2762 #[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"]
2763 pub fn acquire_wake_lease_with<___R>(
2764 &self,
2765 request: ___R,
2766 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease, ___T>
2767 where
2768 ___R: ::fidl_next::Encode<
2769 crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'static>,
2770 <___T as ::fidl_next::Transport>::SendBuffer,
2771 >,
2772 {
2773 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2774 3306304846648819971,
2775 <super::AcquireWakeLease as ::fidl_next::Method>::FLEXIBILITY,
2776 request,
2777 ))
2778 }
2779
2780 #[doc = " Creates a long-term 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 a long wake lease and will not log a runtime error if it exceeds\n preconfigured alert thresholds.\n"]
2781 pub fn acquire_long_wake_lease(
2782 &self,
2783
2784 name: impl ::fidl_next::Encode<
2785 ::fidl_next::wire::String<'static>,
2786 <___T as ::fidl_next::Transport>::SendBuffer,
2787 >,
2788 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireLongWakeLease, ___T>
2789 where
2790 <___T as ::fidl_next::Transport>::SendBuffer:
2791 ::fidl_next::encoder::InternalHandleEncoder,
2792 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2793 {
2794 self.acquire_long_wake_lease_with(
2795 crate::generic::ActivityGovernorAcquireLongWakeLeaseRequest { name },
2796 )
2797 }
2798
2799 #[doc = " Creates a long-term 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 a long wake lease and will not log a runtime error if it exceeds\n preconfigured alert thresholds.\n"]
2800 pub fn acquire_long_wake_lease_with<___R>(
2801 &self,
2802 request: ___R,
2803 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireLongWakeLease, ___T>
2804 where
2805 ___R: ::fidl_next::Encode<
2806 crate::wire::ActivityGovernorAcquireLongWakeLeaseRequest<'static>,
2807 <___T as ::fidl_next::Transport>::SendBuffer,
2808 >,
2809 {
2810 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2811 2258586591235944042,
2812 <super::AcquireLongWakeLease as ::fidl_next::Method>::FLEXIBILITY,
2813 request,
2814 ))
2815 }
2816
2817 #[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"]
2818 pub fn acquire_wake_lease_with_token(
2819 &self,
2820
2821 name: impl ::fidl_next::Encode<
2822 ::fidl_next::wire::String<'static>,
2823 <___T as ::fidl_next::Transport>::SendBuffer,
2824 >,
2825
2826 server_token: impl ::fidl_next::Encode<
2827 ::fidl_next::wire::fuchsia::EventPair,
2828 <___T as ::fidl_next::Transport>::SendBuffer,
2829 >,
2830 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLeaseWithToken, ___T>
2831 where
2832 <___T as ::fidl_next::Transport>::SendBuffer:
2833 ::fidl_next::encoder::InternalHandleEncoder,
2834 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2835 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
2836 {
2837 self.acquire_wake_lease_with_token_with(
2838 crate::generic::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
2839 name,
2840
2841 server_token,
2842 },
2843 )
2844 }
2845
2846 #[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"]
2847 pub fn acquire_wake_lease_with_token_with<___R>(
2848 &self,
2849 request: ___R,
2850 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLeaseWithToken, ___T>
2851 where
2852 ___R: ::fidl_next::Encode<
2853 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2854 <___T as ::fidl_next::Transport>::SendBuffer,
2855 >,
2856 {
2857 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2858 2079869883732225873,
2859 <super::AcquireWakeLeaseWithToken as ::fidl_next::Method>::FLEXIBILITY,
2860 request,
2861 ))
2862 }
2863
2864 #[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"]
2865 pub fn take_application_activity_lease(
2866 &self,
2867
2868 name: impl ::fidl_next::Encode<
2869 ::fidl_next::wire::String<'static>,
2870 <___T as ::fidl_next::Transport>::SendBuffer,
2871 >,
2872 ) -> ::fidl_next::TwoWayFuture<'_, super::TakeApplicationActivityLease, ___T>
2873 where
2874 <___T as ::fidl_next::Transport>::SendBuffer:
2875 ::fidl_next::encoder::InternalHandleEncoder,
2876 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2877 {
2878 self.take_application_activity_lease_with(
2879 crate::generic::ActivityGovernorTakeApplicationActivityLeaseRequest { name },
2880 )
2881 }
2882
2883 #[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"]
2884 pub fn take_application_activity_lease_with<___R>(
2885 &self,
2886 request: ___R,
2887 ) -> ::fidl_next::TwoWayFuture<'_, super::TakeApplicationActivityLease, ___T>
2888 where
2889 ___R: ::fidl_next::Encode<
2890 crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'static>,
2891 <___T as ::fidl_next::Transport>::SendBuffer,
2892 >,
2893 {
2894 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2895 4020961735006149140,
2896 <super::TakeApplicationActivityLease as ::fidl_next::Method>::FLEXIBILITY,
2897 request,
2898 ))
2899 }
2900
2901 #[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"]
2902 pub fn register_suspend_blocker_with<___R>(
2903 &self,
2904 request: ___R,
2905 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterSuspendBlocker, ___T>
2906 where
2907 ___R: ::fidl_next::Encode<
2908 crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>,
2909 <___T as ::fidl_next::Transport>::SendBuffer,
2910 >,
2911 {
2912 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2913 3814361630267862785,
2914 <super::RegisterSuspendBlocker as ::fidl_next::Method>::FLEXIBILITY,
2915 request,
2916 ))
2917 }
2918 }
2919
2920 #[repr(transparent)]
2922 pub struct ActivityGovernorServer<___T: ::fidl_next::Transport> {
2923 server: ::fidl_next::protocol::Server<___T>,
2924 }
2925
2926 impl<___T> ActivityGovernorServer<___T> where ___T: ::fidl_next::Transport {}
2927 }
2928}
2929
2930#[diagnostic::on_unimplemented(
2931 note = "If {Self} implements the non-local ActivityGovernorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
2932)]
2933
2934pub trait ActivityGovernorLocalClientHandler<
2938 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2939 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2940>
2941{
2942 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2943 ::core::future::ready(())
2944 }
2945}
2946
2947impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ActivityGovernor
2948where
2949 ___H: ActivityGovernorLocalClientHandler<___T>,
2950 ___T: ::fidl_next::Transport,
2951{
2952 async fn on_event(
2953 handler: &mut ___H,
2954 ordinal: u64,
2955 flexibility: ::fidl_next::protocol::Flexibility,
2956 body: ::fidl_next::Body<___T>,
2957 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2958 match ordinal {
2959 ordinal => {
2960 handler.on_unknown_interaction(ordinal).await;
2961 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
2962 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2963 } else {
2964 Ok(())
2965 }
2966 }
2967 }
2968 }
2969}
2970
2971#[diagnostic::on_unimplemented(
2972 note = "If {Self} implements the non-local ActivityGovernorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
2973)]
2974
2975pub trait ActivityGovernorLocalServerHandler<
2979 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2980 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2981>
2982{
2983 #[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"]
2984 fn get_power_elements(
2985 &mut self,
2986
2987 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
2988 ) -> impl ::core::future::Future<Output = ()>;
2989
2990 #[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\n If an error occurs while creating a token for the wake lease, then the\n channel to `ActivityGovernor` will be closed by the server and no\n response will be returned.\n"]
2991 fn take_wake_lease(
2992 &mut self,
2993
2994 request: ::fidl_next::Request<activity_governor::TakeWakeLease, ___T>,
2995
2996 responder: ::fidl_next::Responder<activity_governor::TakeWakeLease, ___T>,
2997 ) -> impl ::core::future::Future<Output = ()>;
2998
2999 #[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"]
3000 fn acquire_wake_lease(
3001 &mut self,
3002
3003 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3004
3005 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3006 ) -> impl ::core::future::Future<Output = ()>;
3007
3008 #[doc = " Creates a long-term 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 a long wake lease and will not log a runtime error if it exceeds\n preconfigured alert thresholds.\n"]
3009 fn acquire_long_wake_lease(
3010 &mut self,
3011
3012 request: ::fidl_next::Request<activity_governor::AcquireLongWakeLease, ___T>,
3013
3014 responder: ::fidl_next::Responder<activity_governor::AcquireLongWakeLease, ___T>,
3015 ) -> impl ::core::future::Future<Output = ()>;
3016
3017 #[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"]
3018 fn acquire_wake_lease_with_token(
3019 &mut self,
3020
3021 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3022
3023 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3024 ) -> impl ::core::future::Future<Output = ()>;
3025
3026 #[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"]
3027 fn take_application_activity_lease(
3028 &mut self,
3029
3030 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3031
3032 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3033 ) -> impl ::core::future::Future<Output = ()>;
3034
3035 #[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"]
3036 fn register_suspend_blocker(
3037 &mut self,
3038
3039 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3040
3041 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3042 ) -> impl ::core::future::Future<Output = ()>;
3043
3044 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3045 ::core::future::ready(())
3046 }
3047}
3048
3049impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ActivityGovernor
3050where
3051 ___H: ActivityGovernorLocalServerHandler<___T> ,
3052 ___T: ::fidl_next::Transport,
3053
3054
3055
3056
3057 for<'de> crate::wire::ActivityGovernorTakeWakeLeaseRequest<'de>: ::fidl_next::Decode<
3058 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3059 Constraint = (),
3060 >,
3061
3062
3063
3064 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'de>: ::fidl_next::Decode<
3065 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3066 Constraint = (),
3067 >,
3068
3069
3070
3071 for<'de> crate::wire::ActivityGovernorAcquireLongWakeLeaseRequest<'de>: ::fidl_next::Decode<
3072 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3073 Constraint = (),
3074 >,
3075
3076
3077
3078 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>: ::fidl_next::Decode<
3079 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3080 Constraint = (),
3081 >,
3082
3083
3084
3085 for<'de> crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'de>: ::fidl_next::Decode<
3086 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3087 Constraint = (),
3088 >,
3089
3090
3091
3092 for<'de> crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>: ::fidl_next::Decode<
3093 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3094 Constraint = (),
3095 >,
3096
3097
3098{
3099 async fn on_one_way(
3100 handler: &mut ___H,
3101 ordinal: u64,
3102 flexibility: ::fidl_next::protocol::Flexibility,
3103 body: ::fidl_next::Body<___T>,
3104 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3105 match ordinal {
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128 ordinal => {
3129
3130 handler.on_unknown_interaction(ordinal).await;
3131 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3132 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3133 } else {
3134 Ok(())
3135 }
3136
3137 }
3138 }
3139 }
3140
3141 async fn on_two_way(
3142 handler: &mut ___H,
3143 ordinal: u64,
3144 flexibility: ::fidl_next::protocol::Flexibility,
3145 body: ::fidl_next::Body<___T>,
3146 responder: ::fidl_next::protocol::Responder<___T>,
3147 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3148 match ordinal {
3149
3150
3151
3152 8755001135707412082 => {
3153 let responder = ::fidl_next::Responder::from_untyped(responder);
3154
3155 handler.get_power_elements(responder).await;
3156 Ok(())
3157
3158 }
3159
3160
3161
3162
3163 2962518918789578601 => {
3164 let responder = ::fidl_next::Responder::from_untyped(responder);
3165
3166 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3167 Ok(decoded) => {
3168 handler.take_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3169 Ok(())
3170 }
3171 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3172 ordinal: 2962518918789578601,
3173 error,
3174 }),
3175 }
3176
3177 }
3178
3179
3180
3181
3182 3306304846648819971 => {
3183 let responder = ::fidl_next::Responder::from_untyped(responder);
3184
3185 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3186 Ok(decoded) => {
3187 handler.acquire_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3188 Ok(())
3189 }
3190 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3191 ordinal: 3306304846648819971,
3192 error,
3193 }),
3194 }
3195
3196 }
3197
3198
3199
3200
3201 2258586591235944042 => {
3202 let responder = ::fidl_next::Responder::from_untyped(responder);
3203
3204 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3205 Ok(decoded) => {
3206 handler.acquire_long_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3207 Ok(())
3208 }
3209 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3210 ordinal: 2258586591235944042,
3211 error,
3212 }),
3213 }
3214
3215 }
3216
3217
3218
3219
3220 2079869883732225873 => {
3221 let responder = ::fidl_next::Responder::from_untyped(responder);
3222
3223 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3224 Ok(decoded) => {
3225 handler.acquire_wake_lease_with_token(::fidl_next::Request::from_decoded(decoded), responder).await;
3226 Ok(())
3227 }
3228 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3229 ordinal: 2079869883732225873,
3230 error,
3231 }),
3232 }
3233
3234 }
3235
3236
3237
3238
3239 4020961735006149140 => {
3240 let responder = ::fidl_next::Responder::from_untyped(responder);
3241
3242 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3243 Ok(decoded) => {
3244 handler.take_application_activity_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3245 Ok(())
3246 }
3247 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3248 ordinal: 4020961735006149140,
3249 error,
3250 }),
3251 }
3252
3253 }
3254
3255
3256
3257
3258 3814361630267862785 => {
3259 let responder = ::fidl_next::Responder::from_untyped(responder);
3260
3261 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3262 Ok(decoded) => {
3263 handler.register_suspend_blocker(::fidl_next::Request::from_decoded(decoded), responder).await;
3264 Ok(())
3265 }
3266 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3267 ordinal: 3814361630267862785,
3268 error,
3269 }),
3270 }
3271
3272 }
3273
3274
3275 ordinal => {
3276
3277 handler.on_unknown_interaction(ordinal).await;
3278 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3279 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3280 } else {
3281 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
3282 ordinal,
3283 flexibility,
3284 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
3285 )
3286 .expect("encoding a framework error should never fail")
3287 .await?;
3288 Ok(())
3289 }
3290
3291 }
3292 }
3293 }
3294}
3295
3296pub trait ActivityGovernorClientHandler<
3300 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3301 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3302>
3303{
3304 fn on_unknown_interaction(
3305 &mut self,
3306 ordinal: u64,
3307 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3308 ::core::future::ready(())
3309 }
3310}
3311
3312impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ActivityGovernor
3313where
3314 ___H: ActivityGovernorClientHandler<___T> + ::core::marker::Send,
3315 ___T: ::fidl_next::Transport,
3316{
3317 async fn on_event(
3318 handler: &mut ___H,
3319 ordinal: u64,
3320 flexibility: ::fidl_next::protocol::Flexibility,
3321 body: ::fidl_next::Body<___T>,
3322 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3323 match ordinal {
3324 ordinal => {
3325 handler.on_unknown_interaction(ordinal).await;
3326 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3327 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3328 } else {
3329 Ok(())
3330 }
3331 }
3332 }
3333 }
3334}
3335
3336pub trait ActivityGovernorServerHandler<
3340 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3341 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3342>
3343{
3344 #[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"]
3345 fn get_power_elements(
3346 &mut self,
3347
3348 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
3349 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3350
3351 #[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\n If an error occurs while creating a token for the wake lease, then the\n channel to `ActivityGovernor` will be closed by the server and no\n response will be returned.\n"]
3352 fn take_wake_lease(
3353 &mut self,
3354
3355 request: ::fidl_next::Request<activity_governor::TakeWakeLease, ___T>,
3356
3357 responder: ::fidl_next::Responder<activity_governor::TakeWakeLease, ___T>,
3358 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3359
3360 #[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"]
3361 fn acquire_wake_lease(
3362 &mut self,
3363
3364 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3365
3366 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3367 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3368
3369 #[doc = " Creates a long-term 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 a long wake lease and will not log a runtime error if it exceeds\n preconfigured alert thresholds.\n"]
3370 fn acquire_long_wake_lease(
3371 &mut self,
3372
3373 request: ::fidl_next::Request<activity_governor::AcquireLongWakeLease, ___T>,
3374
3375 responder: ::fidl_next::Responder<activity_governor::AcquireLongWakeLease, ___T>,
3376 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3377
3378 #[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"]
3379 fn acquire_wake_lease_with_token(
3380 &mut self,
3381
3382 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3383
3384 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3385 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3386
3387 #[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"]
3388 fn take_application_activity_lease(
3389 &mut self,
3390
3391 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3392
3393 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3394 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3395
3396 #[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"]
3397 fn register_suspend_blocker(
3398 &mut self,
3399
3400 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3401
3402 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3403 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3404
3405 fn on_unknown_interaction(
3406 &mut self,
3407 ordinal: u64,
3408 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3409 ::core::future::ready(())
3410 }
3411}
3412
3413impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ActivityGovernor
3414where
3415 ___H: ActivityGovernorServerHandler<___T> + ::core::marker::Send,
3416 ___T: ::fidl_next::Transport,
3417
3418
3419
3420
3421 for<'de> crate::wire::ActivityGovernorTakeWakeLeaseRequest<'de>: ::fidl_next::Decode<
3422 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3423 Constraint = (),
3424 >,
3425
3426
3427
3428 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'de>: ::fidl_next::Decode<
3429 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3430 Constraint = (),
3431 >,
3432
3433
3434
3435 for<'de> crate::wire::ActivityGovernorAcquireLongWakeLeaseRequest<'de>: ::fidl_next::Decode<
3436 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3437 Constraint = (),
3438 >,
3439
3440
3441
3442 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>: ::fidl_next::Decode<
3443 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3444 Constraint = (),
3445 >,
3446
3447
3448
3449 for<'de> crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'de>: ::fidl_next::Decode<
3450 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3451 Constraint = (),
3452 >,
3453
3454
3455
3456 for<'de> crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>: ::fidl_next::Decode<
3457 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3458 Constraint = (),
3459 >,
3460
3461
3462{
3463 async fn on_one_way(
3464 handler: &mut ___H,
3465 ordinal: u64,
3466 flexibility: ::fidl_next::protocol::Flexibility,
3467 body: ::fidl_next::Body<___T>,
3468 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3469 match ordinal {
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492 ordinal => {
3493
3494 handler.on_unknown_interaction(ordinal).await;
3495 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3496 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3497 } else {
3498 Ok(())
3499 }
3500
3501 }
3502 }
3503 }
3504
3505 async fn on_two_way(
3506 handler: &mut ___H,
3507 ordinal: u64,
3508 flexibility: ::fidl_next::protocol::Flexibility,
3509 body: ::fidl_next::Body<___T>,
3510 responder: ::fidl_next::protocol::Responder<___T>,
3511 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3512 match ordinal {
3513
3514
3515
3516 8755001135707412082 => {
3517 let responder = ::fidl_next::Responder::from_untyped(responder);
3518
3519 handler.get_power_elements(responder).await;
3520 Ok(())
3521
3522 }
3523
3524
3525
3526
3527 2962518918789578601 => {
3528 let responder = ::fidl_next::Responder::from_untyped(responder);
3529
3530 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3531 Ok(decoded) => {
3532 handler.take_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3533 Ok(())
3534 }
3535 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3536 ordinal: 2962518918789578601,
3537 error,
3538 }),
3539 }
3540
3541 }
3542
3543
3544
3545
3546 3306304846648819971 => {
3547 let responder = ::fidl_next::Responder::from_untyped(responder);
3548
3549 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3550 Ok(decoded) => {
3551 handler.acquire_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3552 Ok(())
3553 }
3554 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3555 ordinal: 3306304846648819971,
3556 error,
3557 }),
3558 }
3559
3560 }
3561
3562
3563
3564
3565 2258586591235944042 => {
3566 let responder = ::fidl_next::Responder::from_untyped(responder);
3567
3568 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3569 Ok(decoded) => {
3570 handler.acquire_long_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3571 Ok(())
3572 }
3573 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3574 ordinal: 2258586591235944042,
3575 error,
3576 }),
3577 }
3578
3579 }
3580
3581
3582
3583
3584 2079869883732225873 => {
3585 let responder = ::fidl_next::Responder::from_untyped(responder);
3586
3587 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3588 Ok(decoded) => {
3589 handler.acquire_wake_lease_with_token(::fidl_next::Request::from_decoded(decoded), responder).await;
3590 Ok(())
3591 }
3592 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3593 ordinal: 2079869883732225873,
3594 error,
3595 }),
3596 }
3597
3598 }
3599
3600
3601
3602
3603 4020961735006149140 => {
3604 let responder = ::fidl_next::Responder::from_untyped(responder);
3605
3606 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3607 Ok(decoded) => {
3608 handler.take_application_activity_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3609 Ok(())
3610 }
3611 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3612 ordinal: 4020961735006149140,
3613 error,
3614 }),
3615 }
3616
3617 }
3618
3619
3620
3621
3622 3814361630267862785 => {
3623 let responder = ::fidl_next::Responder::from_untyped(responder);
3624
3625 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3626 Ok(decoded) => {
3627 handler.register_suspend_blocker(::fidl_next::Request::from_decoded(decoded), responder).await;
3628 Ok(())
3629 }
3630 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3631 ordinal: 3814361630267862785,
3632 error,
3633 }),
3634 }
3635
3636 }
3637
3638
3639 ordinal => {
3640
3641 handler.on_unknown_interaction(ordinal).await;
3642 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3643 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3644 } else {
3645 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
3646 ordinal,
3647 flexibility,
3648 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
3649 )
3650 .expect("encoding a framework error should never fail")
3651 .await?;
3652 Ok(())
3653 }
3654
3655 }
3656 }
3657 }
3658}
3659
3660impl<___T> ActivityGovernorClientHandler<___T> for ::fidl_next::IgnoreEvents
3661where
3662 ___T: ::fidl_next::Transport,
3663{
3664 async fn on_unknown_interaction(&mut self, _: u64) {}
3665}
3666
3667impl<___H, ___T> ActivityGovernorLocalClientHandler<___T> for ::fidl_next::Local<___H>
3668where
3669 ___H: ActivityGovernorClientHandler<___T>,
3670 ___T: ::fidl_next::Transport,
3671{
3672 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3673 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3674 }
3675}
3676
3677impl<___H, ___T> ActivityGovernorLocalServerHandler<___T> for ::fidl_next::Local<___H>
3678where
3679 ___H: ActivityGovernorServerHandler<___T>,
3680 ___T: ::fidl_next::Transport,
3681{
3682 async fn get_power_elements(
3683 &mut self,
3684
3685 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
3686 ) {
3687 ___H::get_power_elements(&mut self.0, responder).await
3688 }
3689
3690 async fn take_wake_lease(
3691 &mut self,
3692
3693 request: ::fidl_next::Request<activity_governor::TakeWakeLease, ___T>,
3694
3695 responder: ::fidl_next::Responder<activity_governor::TakeWakeLease, ___T>,
3696 ) {
3697 ___H::take_wake_lease(&mut self.0, request, responder).await
3698 }
3699
3700 async fn acquire_wake_lease(
3701 &mut self,
3702
3703 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3704
3705 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3706 ) {
3707 ___H::acquire_wake_lease(&mut self.0, request, responder).await
3708 }
3709
3710 async fn acquire_long_wake_lease(
3711 &mut self,
3712
3713 request: ::fidl_next::Request<activity_governor::AcquireLongWakeLease, ___T>,
3714
3715 responder: ::fidl_next::Responder<activity_governor::AcquireLongWakeLease, ___T>,
3716 ) {
3717 ___H::acquire_long_wake_lease(&mut self.0, request, responder).await
3718 }
3719
3720 async fn acquire_wake_lease_with_token(
3721 &mut self,
3722
3723 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3724
3725 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3726 ) {
3727 ___H::acquire_wake_lease_with_token(&mut self.0, request, responder).await
3728 }
3729
3730 async fn take_application_activity_lease(
3731 &mut self,
3732
3733 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3734
3735 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3736 ) {
3737 ___H::take_application_activity_lease(&mut self.0, request, responder).await
3738 }
3739
3740 async fn register_suspend_blocker(
3741 &mut self,
3742
3743 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3744
3745 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3746 ) {
3747 ___H::register_suspend_blocker(&mut self.0, request, responder).await
3748 }
3749
3750 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3751 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3752 }
3753}
3754
3755#[doc = " A service that provides access to CPU-related power elements.\n"]
3757#[derive(PartialEq, Debug)]
3758pub struct CpuElementManager;
3759
3760impl ::fidl_next::Discoverable for CpuElementManager {
3761 const PROTOCOL_NAME: &'static str = "fuchsia.power.system.CpuElementManager";
3762}
3763
3764#[cfg(target_os = "fuchsia")]
3765impl ::fidl_next::HasTransport for CpuElementManager {
3766 type Transport = ::fidl_next::fuchsia::zx::Channel;
3767}
3768
3769pub mod cpu_element_manager {
3770 pub mod prelude {
3771 pub use crate::{
3772 CpuElementManager, CpuElementManagerClientHandler, CpuElementManagerLocalClientHandler,
3773 CpuElementManagerLocalServerHandler, CpuElementManagerServerHandler,
3774 cpu_element_manager,
3775 };
3776
3777 pub use crate::natural::AddExecutionStateDependencyError;
3778
3779 pub use crate::natural::Cpu;
3780
3781 pub use crate::natural::CpuElementManagerAddExecutionStateDependencyRequest;
3782
3783 pub use crate::natural::CpuElementManagerAddExecutionStateDependencyResponse;
3784 }
3785
3786 pub struct GetCpuDependencyToken;
3787
3788 impl ::fidl_next::Method for GetCpuDependencyToken {
3789 const ORDINAL: u64 = 3189503319605462202;
3790 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3791 ::fidl_next::protocol::Flexibility::Flexible;
3792
3793 type Protocol = crate::CpuElementManager;
3794
3795 type Request = ::fidl_next::wire::EmptyMessageBody;
3796 }
3797
3798 impl ::fidl_next::TwoWayMethod for GetCpuDependencyToken {
3799 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::Cpu<'static>>;
3800 }
3801
3802 impl<___R> ::fidl_next::Respond<___R> for GetCpuDependencyToken {
3803 type Output = ::fidl_next::Flexible<___R>;
3804
3805 fn respond(response: ___R) -> Self::Output {
3806 ::fidl_next::Flexible::Ok(response)
3807 }
3808 }
3809
3810 pub struct AddExecutionStateDependency;
3811
3812 impl ::fidl_next::Method for AddExecutionStateDependency {
3813 const ORDINAL: u64 = 1005136052949049908;
3814 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3815 ::fidl_next::protocol::Flexibility::Flexible;
3816
3817 type Protocol = crate::CpuElementManager;
3818
3819 type Request = crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>;
3820 }
3821
3822 impl ::fidl_next::TwoWayMethod for AddExecutionStateDependency {
3823 type Response = ::fidl_next::wire::FlexibleResult<
3824 'static,
3825 crate::wire::CpuElementManagerAddExecutionStateDependencyResponse,
3826 crate::wire::AddExecutionStateDependencyError,
3827 >;
3828 }
3829
3830 impl<___R> ::fidl_next::Respond<___R> for AddExecutionStateDependency {
3831 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
3832
3833 fn respond(response: ___R) -> Self::Output {
3834 ::fidl_next::FlexibleResult::Ok(response)
3835 }
3836 }
3837
3838 impl<___R> ::fidl_next::RespondErr<___R> for AddExecutionStateDependency {
3839 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
3840
3841 fn respond_err(response: ___R) -> Self::Output {
3842 ::fidl_next::FlexibleResult::Err(response)
3843 }
3844 }
3845
3846 mod ___detail {
3847 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::CpuElementManager
3848 where
3849 ___T: ::fidl_next::Transport,
3850 {
3851 type Client = CpuElementManagerClient<___T>;
3852 type Server = CpuElementManagerServer<___T>;
3853 }
3854
3855 #[repr(transparent)]
3857 pub struct CpuElementManagerClient<___T: ::fidl_next::Transport> {
3858 #[allow(dead_code)]
3859 client: ::fidl_next::protocol::Client<___T>,
3860 }
3861
3862 impl<___T> CpuElementManagerClient<___T>
3863 where
3864 ___T: ::fidl_next::Transport,
3865 {
3866 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
3867 pub fn get_cpu_dependency_token(
3868 &self,
3869 ) -> ::fidl_next::TwoWayFuture<'_, super::GetCpuDependencyToken, ___T> {
3870 ::fidl_next::TwoWayFuture::from_untyped(
3871 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
3872 3189503319605462202,
3873 <super::GetCpuDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3874 (),
3875 ),
3876 )
3877 }
3878
3879 #[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"]
3880 pub fn add_execution_state_dependency_with<___R>(
3881 &self,
3882 request: ___R,
3883 ) -> ::fidl_next::TwoWayFuture<'_, super::AddExecutionStateDependency, ___T>
3884 where
3885 ___R: ::fidl_next::Encode<
3886 crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
3887 <___T as ::fidl_next::Transport>::SendBuffer,
3888 >,
3889 {
3890 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3891 1005136052949049908,
3892 <super::AddExecutionStateDependency as ::fidl_next::Method>::FLEXIBILITY,
3893 request,
3894 ))
3895 }
3896 }
3897
3898 #[repr(transparent)]
3900 pub struct CpuElementManagerServer<___T: ::fidl_next::Transport> {
3901 server: ::fidl_next::protocol::Server<___T>,
3902 }
3903
3904 impl<___T> CpuElementManagerServer<___T> where ___T: ::fidl_next::Transport {}
3905 }
3906}
3907
3908#[diagnostic::on_unimplemented(
3909 note = "If {Self} implements the non-local CpuElementManagerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3910)]
3911
3912pub trait CpuElementManagerLocalClientHandler<
3916 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3917 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3918>
3919{
3920 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3921 ::core::future::ready(())
3922 }
3923}
3924
3925impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for CpuElementManager
3926where
3927 ___H: CpuElementManagerLocalClientHandler<___T>,
3928 ___T: ::fidl_next::Transport,
3929{
3930 async fn on_event(
3931 handler: &mut ___H,
3932 ordinal: u64,
3933 flexibility: ::fidl_next::protocol::Flexibility,
3934 body: ::fidl_next::Body<___T>,
3935 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3936 match ordinal {
3937 ordinal => {
3938 handler.on_unknown_interaction(ordinal).await;
3939 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3940 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3941 } else {
3942 Ok(())
3943 }
3944 }
3945 }
3946 }
3947}
3948
3949#[diagnostic::on_unimplemented(
3950 note = "If {Self} implements the non-local CpuElementManagerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3951)]
3952
3953pub trait CpuElementManagerLocalServerHandler<
3957 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3958 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3959>
3960{
3961 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
3962 fn get_cpu_dependency_token(
3963 &mut self,
3964
3965 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
3966 ) -> impl ::core::future::Future<Output = ()>;
3967
3968 #[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"]
3969 fn add_execution_state_dependency(
3970 &mut self,
3971
3972 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
3973
3974 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
3975 ) -> impl ::core::future::Future<Output = ()>;
3976
3977 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3978 ::core::future::ready(())
3979 }
3980}
3981
3982impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for CpuElementManager
3983where
3984 ___H: CpuElementManagerLocalServerHandler<___T> ,
3985 ___T: ::fidl_next::Transport,
3986
3987
3988
3989
3990 for<'de> crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>: ::fidl_next::Decode<
3991 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3992 Constraint = (),
3993 >,
3994
3995
3996{
3997 async fn on_one_way(
3998 handler: &mut ___H,
3999 ordinal: u64,
4000 flexibility: ::fidl_next::protocol::Flexibility,
4001 body: ::fidl_next::Body<___T>,
4002 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4003 match ordinal {
4004
4005
4006
4007
4008
4009
4010
4011 ordinal => {
4012
4013 handler.on_unknown_interaction(ordinal).await;
4014 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4015 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4016 } else {
4017 Ok(())
4018 }
4019
4020 }
4021 }
4022 }
4023
4024 async fn on_two_way(
4025 handler: &mut ___H,
4026 ordinal: u64,
4027 flexibility: ::fidl_next::protocol::Flexibility,
4028 body: ::fidl_next::Body<___T>,
4029 responder: ::fidl_next::protocol::Responder<___T>,
4030 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4031 match ordinal {
4032
4033
4034
4035 3189503319605462202 => {
4036 let responder = ::fidl_next::Responder::from_untyped(responder);
4037
4038 handler.get_cpu_dependency_token(responder).await;
4039 Ok(())
4040
4041 }
4042
4043
4044
4045
4046 1005136052949049908 => {
4047 let responder = ::fidl_next::Responder::from_untyped(responder);
4048
4049 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4050 Ok(decoded) => {
4051 handler.add_execution_state_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
4052 Ok(())
4053 }
4054 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4055 ordinal: 1005136052949049908,
4056 error,
4057 }),
4058 }
4059
4060 }
4061
4062
4063 ordinal => {
4064
4065 handler.on_unknown_interaction(ordinal).await;
4066 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4067 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4068 } else {
4069 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4070 ordinal,
4071 flexibility,
4072 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4073 )
4074 .expect("encoding a framework error should never fail")
4075 .await?;
4076 Ok(())
4077 }
4078
4079 }
4080 }
4081 }
4082}
4083
4084pub trait CpuElementManagerClientHandler<
4088 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4089 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4090>
4091{
4092 fn on_unknown_interaction(
4093 &mut self,
4094 ordinal: u64,
4095 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4096 ::core::future::ready(())
4097 }
4098}
4099
4100impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for CpuElementManager
4101where
4102 ___H: CpuElementManagerClientHandler<___T> + ::core::marker::Send,
4103 ___T: ::fidl_next::Transport,
4104{
4105 async fn on_event(
4106 handler: &mut ___H,
4107 ordinal: u64,
4108 flexibility: ::fidl_next::protocol::Flexibility,
4109 body: ::fidl_next::Body<___T>,
4110 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4111 match ordinal {
4112 ordinal => {
4113 handler.on_unknown_interaction(ordinal).await;
4114 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4115 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4116 } else {
4117 Ok(())
4118 }
4119 }
4120 }
4121 }
4122}
4123
4124pub trait CpuElementManagerServerHandler<
4128 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4129 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4130>
4131{
4132 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
4133 fn get_cpu_dependency_token(
4134 &mut self,
4135
4136 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
4137 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4138
4139 #[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"]
4140 fn add_execution_state_dependency(
4141 &mut self,
4142
4143 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
4144
4145 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
4146 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4147
4148 fn on_unknown_interaction(
4149 &mut self,
4150 ordinal: u64,
4151 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4152 ::core::future::ready(())
4153 }
4154}
4155
4156impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for CpuElementManager
4157where
4158 ___H: CpuElementManagerServerHandler<___T> + ::core::marker::Send,
4159 ___T: ::fidl_next::Transport,
4160
4161
4162
4163
4164 for<'de> crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>: ::fidl_next::Decode<
4165 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4166 Constraint = (),
4167 >,
4168
4169
4170{
4171 async fn on_one_way(
4172 handler: &mut ___H,
4173 ordinal: u64,
4174 flexibility: ::fidl_next::protocol::Flexibility,
4175 body: ::fidl_next::Body<___T>,
4176 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4177 match ordinal {
4178
4179
4180
4181
4182
4183
4184
4185 ordinal => {
4186
4187 handler.on_unknown_interaction(ordinal).await;
4188 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4189 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4190 } else {
4191 Ok(())
4192 }
4193
4194 }
4195 }
4196 }
4197
4198 async fn on_two_way(
4199 handler: &mut ___H,
4200 ordinal: u64,
4201 flexibility: ::fidl_next::protocol::Flexibility,
4202 body: ::fidl_next::Body<___T>,
4203 responder: ::fidl_next::protocol::Responder<___T>,
4204 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4205 match ordinal {
4206
4207
4208
4209 3189503319605462202 => {
4210 let responder = ::fidl_next::Responder::from_untyped(responder);
4211
4212 handler.get_cpu_dependency_token(responder).await;
4213 Ok(())
4214
4215 }
4216
4217
4218
4219
4220 1005136052949049908 => {
4221 let responder = ::fidl_next::Responder::from_untyped(responder);
4222
4223 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4224 Ok(decoded) => {
4225 handler.add_execution_state_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
4226 Ok(())
4227 }
4228 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4229 ordinal: 1005136052949049908,
4230 error,
4231 }),
4232 }
4233
4234 }
4235
4236
4237 ordinal => {
4238
4239 handler.on_unknown_interaction(ordinal).await;
4240 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4241 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4242 } else {
4243 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4244 ordinal,
4245 flexibility,
4246 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4247 )
4248 .expect("encoding a framework error should never fail")
4249 .await?;
4250 Ok(())
4251 }
4252
4253 }
4254 }
4255 }
4256}
4257
4258impl<___T> CpuElementManagerClientHandler<___T> for ::fidl_next::IgnoreEvents
4259where
4260 ___T: ::fidl_next::Transport,
4261{
4262 async fn on_unknown_interaction(&mut self, _: u64) {}
4263}
4264
4265impl<___H, ___T> CpuElementManagerLocalClientHandler<___T> for ::fidl_next::Local<___H>
4266where
4267 ___H: CpuElementManagerClientHandler<___T>,
4268 ___T: ::fidl_next::Transport,
4269{
4270 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4271 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4272 }
4273}
4274
4275impl<___H, ___T> CpuElementManagerLocalServerHandler<___T> for ::fidl_next::Local<___H>
4276where
4277 ___H: CpuElementManagerServerHandler<___T>,
4278 ___T: ::fidl_next::Transport,
4279{
4280 async fn get_cpu_dependency_token(
4281 &mut self,
4282
4283 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
4284 ) {
4285 ___H::get_cpu_dependency_token(&mut self.0, responder).await
4286 }
4287
4288 async fn add_execution_state_dependency(
4289 &mut self,
4290
4291 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
4292
4293 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
4294 ) {
4295 ___H::add_execution_state_dependency(&mut self.0, request, responder).await
4296 }
4297
4298 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4299 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4300 }
4301}
4302
4303pub use fidl_next_common_fuchsia_power_system::*;