1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 pub use fidl_next_common_fuchsia_power_system::natural::*;
8
9 pub type LeaseToken = ::fidl_next::fuchsia::zx::EventPair;
10
11 #[derive(Debug, PartialEq)]
12 #[repr(C)]
13 pub struct ActivityGovernorAcquireWakeLeaseResponse {
14 pub token: ::fidl_next::fuchsia::zx::EventPair,
15 }
16
17 unsafe impl<___E>
18 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>
19 for ActivityGovernorAcquireWakeLeaseResponse
20 where
21 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
22 ___E: ::fidl_next::fuchsia::HandleEncoder,
23 {
24 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
25 Self,
26 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
27 > = unsafe {
28 ::fidl_next::CopyOptimization::enable_if(
29 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
30 ::fidl_next::wire::fuchsia::EventPair,
31 ___E,
32 >>::COPY_OPTIMIZATION
33 .is_enabled(),
34 )
35 };
36
37 #[inline]
38 fn encode(
39 self,
40 encoder_: &mut ___E,
41 out_: &mut ::core::mem::MaybeUninit<
42 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
43 >,
44 _: (),
45 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
46 ::fidl_next::munge! {
47 let crate::wire::ActivityGovernorAcquireWakeLeaseResponse {
48 token,
49
50 } = out_;
51 }
52
53 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
54
55 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
56
57 Ok(())
58 }
59 }
60
61 unsafe impl<___E>
62 ::fidl_next::EncodeOption<
63 ::fidl_next::wire::Box<'static, crate::wire::ActivityGovernorAcquireWakeLeaseResponse>,
64 ___E,
65 > for ActivityGovernorAcquireWakeLeaseResponse
66 where
67 ___E: ::fidl_next::Encoder + ?Sized,
68 ActivityGovernorAcquireWakeLeaseResponse:
69 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>,
70 {
71 #[inline]
72 fn encode_option(
73 this: ::core::option::Option<Self>,
74 encoder: &mut ___E,
75 out: &mut ::core::mem::MaybeUninit<
76 ::fidl_next::wire::Box<
77 'static,
78 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
79 >,
80 >,
81 _: (),
82 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
83 if let Some(inner) = this {
84 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
85 ::fidl_next::wire::Box::encode_present(out);
86 } else {
87 ::fidl_next::wire::Box::encode_absent(out);
88 }
89
90 Ok(())
91 }
92 }
93
94 impl ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireWakeLeaseResponse>
95 for ActivityGovernorAcquireWakeLeaseResponse
96 {
97 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
98 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
99 Self,
100 > = unsafe {
101 ::fidl_next::CopyOptimization::enable_if(
102 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
103 ::fidl_next::wire::fuchsia::EventPair,
104 >>::COPY_OPTIMIZATION
105 .is_enabled(),
106 )
107 };
108
109 #[inline]
110 fn from_wire(wire: crate::wire::ActivityGovernorAcquireWakeLeaseResponse) -> Self {
111 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
112 }
113 }
114
115 #[derive(Debug, Default, PartialEq)]
116 pub struct ActivityGovernorRegisterSuspendBlockerRequest {
117 pub suspend_blocker: ::core::option::Option<
118 ::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::fuchsia::zx::Channel>,
119 >,
120
121 pub name: ::core::option::Option<::std::string::String>,
122 }
123
124 impl ActivityGovernorRegisterSuspendBlockerRequest {
125 fn __max_ordinal(&self) -> usize {
126 if self.name.is_some() {
127 return 2;
128 }
129
130 if self.suspend_blocker.is_some() {
131 return 1;
132 }
133
134 0
135 }
136 }
137
138 unsafe impl<___E>
139 ::fidl_next::Encode<
140 crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>,
141 ___E,
142 > for ActivityGovernorRegisterSuspendBlockerRequest
143 where
144 ___E: ::fidl_next::Encoder + ?Sized,
145 ___E: ::fidl_next::fuchsia::HandleEncoder,
146 {
147 #[inline]
148 fn encode(
149 mut self,
150 encoder: &mut ___E,
151 out: &mut ::core::mem::MaybeUninit<
152 crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>,
153 >,
154 _: (),
155 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
156 ::fidl_next::munge!(let crate::wire::ActivityGovernorRegisterSuspendBlockerRequest { table } = out);
157
158 let max_ord = self.__max_ordinal();
159
160 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
161 ::fidl_next::Wire::zero_padding(&mut out);
162
163 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
164 ::fidl_next::wire::Envelope,
165 >(encoder, max_ord);
166
167 for i in 1..=max_ord {
168 match i {
169 2 => {
170 if let Some(value) = self.name.take() {
171 ::fidl_next::wire::Envelope::encode_value::<
172 ::fidl_next::wire::String<'static>,
173 ___E,
174 >(
175 value, preallocated.encoder, &mut out, 64
176 )?;
177 } else {
178 ::fidl_next::wire::Envelope::encode_zero(&mut out)
179 }
180 }
181
182 1 => {
183 if let Some(value) = self.suspend_blocker.take() {
184 ::fidl_next::wire::Envelope::encode_value::<
185 ::fidl_next::ClientEnd<
186 crate::SuspendBlocker,
187 ::fidl_next::wire::fuchsia::Channel,
188 >,
189 ___E,
190 >(
191 value, preallocated.encoder, &mut out, ()
192 )?;
193 } else {
194 ::fidl_next::wire::Envelope::encode_zero(&mut out)
195 }
196 }
197
198 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
199 }
200 unsafe {
201 preallocated.write_next(out.assume_init_ref());
202 }
203 }
204
205 ::fidl_next::wire::Table::encode_len(table, max_ord);
206
207 Ok(())
208 }
209 }
210
211 impl<'de> ::fidl_next::FromWire<crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>>
212 for ActivityGovernorRegisterSuspendBlockerRequest
213 {
214 #[inline]
215 fn from_wire(
216 wire_: crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>,
217 ) -> Self {
218 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
219
220 let suspend_blocker = wire_.table.get(1);
221
222 let name = wire_.table.get(2);
223
224 Self {
225 suspend_blocker: suspend_blocker.map(|envelope| {
226 ::fidl_next::FromWire::from_wire(unsafe {
227 envelope.read_unchecked::<::fidl_next::ClientEnd<
228 crate::SuspendBlocker,
229 ::fidl_next::wire::fuchsia::Channel,
230 >>()
231 })
232 }),
233
234 name: name.map(|envelope| {
235 ::fidl_next::FromWire::from_wire(unsafe {
236 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
237 })
238 }),
239 }
240 }
241 }
242
243 #[derive(Debug, PartialEq)]
244 #[repr(C)]
245 pub struct ActivityGovernorRegisterSuspendBlockerResponse {
246 pub token: ::fidl_next::fuchsia::zx::EventPair,
247 }
248
249 unsafe impl<___E>
250 ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>
251 for ActivityGovernorRegisterSuspendBlockerResponse
252 where
253 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
254 ___E: ::fidl_next::fuchsia::HandleEncoder,
255 {
256 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
257 Self,
258 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
259 > = unsafe {
260 ::fidl_next::CopyOptimization::enable_if(
261 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
262 ::fidl_next::wire::fuchsia::EventPair,
263 ___E,
264 >>::COPY_OPTIMIZATION
265 .is_enabled(),
266 )
267 };
268
269 #[inline]
270 fn encode(
271 self,
272 encoder_: &mut ___E,
273 out_: &mut ::core::mem::MaybeUninit<
274 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
275 >,
276 _: (),
277 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
278 ::fidl_next::munge! {
279 let crate::wire::ActivityGovernorRegisterSuspendBlockerResponse {
280 token,
281
282 } = out_;
283 }
284
285 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
286
287 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
288
289 Ok(())
290 }
291 }
292
293 unsafe impl<___E>
294 ::fidl_next::EncodeOption<
295 ::fidl_next::wire::Box<
296 'static,
297 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
298 >,
299 ___E,
300 > for ActivityGovernorRegisterSuspendBlockerResponse
301 where
302 ___E: ::fidl_next::Encoder + ?Sized,
303 ActivityGovernorRegisterSuspendBlockerResponse:
304 ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>,
305 {
306 #[inline]
307 fn encode_option(
308 this: ::core::option::Option<Self>,
309 encoder: &mut ___E,
310 out: &mut ::core::mem::MaybeUninit<
311 ::fidl_next::wire::Box<
312 'static,
313 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
314 >,
315 >,
316 _: (),
317 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
318 if let Some(inner) = this {
319 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
320 ::fidl_next::wire::Box::encode_present(out);
321 } else {
322 ::fidl_next::wire::Box::encode_absent(out);
323 }
324
325 Ok(())
326 }
327 }
328
329 impl ::fidl_next::FromWire<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse>
330 for ActivityGovernorRegisterSuspendBlockerResponse
331 {
332 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
333 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
334 Self,
335 > = unsafe {
336 ::fidl_next::CopyOptimization::enable_if(
337 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
338 ::fidl_next::wire::fuchsia::EventPair,
339 >>::COPY_OPTIMIZATION
340 .is_enabled(),
341 )
342 };
343
344 #[inline]
345 fn from_wire(wire: crate::wire::ActivityGovernorRegisterSuspendBlockerResponse) -> Self {
346 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
347 }
348 }
349
350 #[doc = " Holds tokens to the application activity power element.\n\n [`fuchsia.power.system/ApplicationActivityLevel`] defines the power levels supported by this power element.\n"]
351 #[derive(Debug, Default, PartialEq)]
352 pub struct ApplicationActivity {
353 pub assertive_dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
354 }
355
356 impl ApplicationActivity {
357 fn __max_ordinal(&self) -> usize {
358 if self.assertive_dependency_token.is_some() {
359 return 1;
360 }
361
362 0
363 }
364 }
365
366 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ApplicationActivity<'static>, ___E>
367 for ApplicationActivity
368 where
369 ___E: ::fidl_next::Encoder + ?Sized,
370 ___E: ::fidl_next::fuchsia::HandleEncoder,
371 {
372 #[inline]
373 fn encode(
374 mut self,
375 encoder: &mut ___E,
376 out: &mut ::core::mem::MaybeUninit<crate::wire::ApplicationActivity<'static>>,
377 _: (),
378 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
379 ::fidl_next::munge!(let crate::wire::ApplicationActivity { table } = out);
380
381 let max_ord = self.__max_ordinal();
382
383 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
384 ::fidl_next::Wire::zero_padding(&mut out);
385
386 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
387 ::fidl_next::wire::Envelope,
388 >(encoder, max_ord);
389
390 for i in 1..=max_ord {
391 match i {
392 1 => {
393 if let Some(value) = self.assertive_dependency_token.take() {
394 ::fidl_next::wire::Envelope::encode_value::<
395 ::fidl_next::wire::fuchsia::Event,
396 ___E,
397 >(
398 value, preallocated.encoder, &mut out, ()
399 )?;
400 } else {
401 ::fidl_next::wire::Envelope::encode_zero(&mut out)
402 }
403 }
404
405 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
406 }
407 unsafe {
408 preallocated.write_next(out.assume_init_ref());
409 }
410 }
411
412 ::fidl_next::wire::Table::encode_len(table, max_ord);
413
414 Ok(())
415 }
416 }
417
418 impl<'de> ::fidl_next::FromWire<crate::wire::ApplicationActivity<'de>> for ApplicationActivity {
419 #[inline]
420 fn from_wire(wire_: crate::wire::ApplicationActivity<'de>) -> Self {
421 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
422
423 let assertive_dependency_token = wire_.table.get(1);
424
425 Self {
426 assertive_dependency_token: assertive_dependency_token.map(|envelope| {
427 ::fidl_next::FromWire::from_wire(unsafe {
428 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
429 })
430 }),
431 }
432 }
433 }
434
435 #[doc = " A collection of power elements that are managed by the activity governor.\n"]
436 #[derive(Debug, Default, PartialEq)]
437 pub struct PowerElements {
438 pub application_activity: ::core::option::Option<crate::natural::ApplicationActivity>,
439 }
440
441 impl PowerElements {
442 fn __max_ordinal(&self) -> usize {
443 if self.application_activity.is_some() {
444 return 3;
445 }
446
447 0
448 }
449 }
450
451 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerElements<'static>, ___E> for PowerElements
452 where
453 ___E: ::fidl_next::Encoder + ?Sized,
454 ___E: ::fidl_next::fuchsia::HandleEncoder,
455 {
456 #[inline]
457 fn encode(
458 mut self,
459 encoder: &mut ___E,
460 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerElements<'static>>,
461 _: (),
462 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
463 ::fidl_next::munge!(let crate::wire::PowerElements { table } = out);
464
465 let max_ord = self.__max_ordinal();
466
467 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
468 ::fidl_next::Wire::zero_padding(&mut out);
469
470 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
471 ::fidl_next::wire::Envelope,
472 >(encoder, max_ord);
473
474 for i in 1..=max_ord {
475 match i {
476 3 => {
477 if let Some(value) = self.application_activity.take() {
478 ::fidl_next::wire::Envelope::encode_value::<
479 crate::wire::ApplicationActivity<'static>,
480 ___E,
481 >(
482 value, preallocated.encoder, &mut out, ()
483 )?;
484 } else {
485 ::fidl_next::wire::Envelope::encode_zero(&mut out)
486 }
487 }
488
489 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
490 }
491 unsafe {
492 preallocated.write_next(out.assume_init_ref());
493 }
494 }
495
496 ::fidl_next::wire::Table::encode_len(table, max_ord);
497
498 Ok(())
499 }
500 }
501
502 impl<'de> ::fidl_next::FromWire<crate::wire::PowerElements<'de>> for PowerElements {
503 #[inline]
504 fn from_wire(wire_: crate::wire::PowerElements<'de>) -> Self {
505 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
506
507 let application_activity = wire_.table.get(3);
508
509 Self {
510 application_activity: application_activity.map(|envelope| {
511 ::fidl_next::FromWire::from_wire(unsafe {
512 envelope.read_unchecked::<crate::wire::ApplicationActivity<'de>>()
513 })
514 }),
515 }
516 }
517 }
518
519 #[derive(Debug, PartialEq)]
520 #[repr(C)]
521 pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
522 pub token: ::fidl_next::fuchsia::zx::EventPair,
523 }
524
525 unsafe impl<___E>
526 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, ___E>
527 for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
528 where
529 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
530 ___E: ::fidl_next::fuchsia::HandleEncoder,
531 {
532 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
533 Self,
534 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
535 > = unsafe {
536 ::fidl_next::CopyOptimization::enable_if(
537 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
538 ::fidl_next::wire::fuchsia::EventPair,
539 ___E,
540 >>::COPY_OPTIMIZATION
541 .is_enabled(),
542 )
543 };
544
545 #[inline]
546 fn encode(
547 self,
548 encoder_: &mut ___E,
549 out_: &mut ::core::mem::MaybeUninit<
550 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
551 >,
552 _: (),
553 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
554 ::fidl_next::munge! {
555 let crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
556 token,
557
558 } = out_;
559 }
560
561 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
562
563 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
564
565 Ok(())
566 }
567 }
568
569 unsafe impl<___E>
570 ::fidl_next::EncodeOption<
571 ::fidl_next::wire::Box<
572 'static,
573 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
574 >,
575 ___E,
576 > for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
577 where
578 ___E: ::fidl_next::Encoder + ?Sized,
579 ActivityGovernorAcquireUnmonitoredWakeLeaseResponse: ::fidl_next::Encode<
580 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
581 ___E,
582 >,
583 {
584 #[inline]
585 fn encode_option(
586 this: ::core::option::Option<Self>,
587 encoder: &mut ___E,
588 out: &mut ::core::mem::MaybeUninit<
589 ::fidl_next::wire::Box<
590 'static,
591 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
592 >,
593 >,
594 _: (),
595 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
596 if let Some(inner) = this {
597 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
598 ::fidl_next::wire::Box::encode_present(out);
599 } else {
600 ::fidl_next::wire::Box::encode_absent(out);
601 }
602
603 Ok(())
604 }
605 }
606
607 impl ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse>
608 for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
609 {
610 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
611 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
612 Self,
613 > = unsafe {
614 ::fidl_next::CopyOptimization::enable_if(
615 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
616 ::fidl_next::wire::fuchsia::EventPair,
617 >>::COPY_OPTIMIZATION
618 .is_enabled(),
619 )
620 };
621
622 #[inline]
623 fn from_wire(
624 wire: crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
625 ) -> Self {
626 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
627 }
628 }
629
630 #[derive(Debug, PartialEq)]
631 pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest {
632 pub name: ::std::string::String,
633
634 pub server_token: ::fidl_next::fuchsia::zx::EventPair,
635 }
636
637 unsafe impl<___E>
638 ::fidl_next::Encode<
639 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
640 ___E,
641 > for ActivityGovernorAcquireWakeLeaseWithTokenRequest
642 where
643 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
644 ___E: ::fidl_next::Encoder,
645 ___E: ::fidl_next::fuchsia::HandleEncoder,
646 {
647 #[inline]
648 fn encode(
649 self,
650 encoder_: &mut ___E,
651 out_: &mut ::core::mem::MaybeUninit<
652 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
653 >,
654 _: (),
655 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
656 ::fidl_next::munge! {
657 let crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
658 name,
659 server_token,
660
661 } = out_;
662 }
663
664 ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
665
666 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(name.as_mut_ptr()) };
667 ::fidl_next::Constrained::validate(_field, 64)?;
668
669 ::fidl_next::Encode::encode(self.server_token, encoder_, server_token, ())?;
670
671 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(server_token.as_mut_ptr()) };
672
673 Ok(())
674 }
675 }
676
677 unsafe impl<___E>
678 ::fidl_next::EncodeOption<
679 ::fidl_next::wire::Box<
680 'static,
681 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
682 >,
683 ___E,
684 > for ActivityGovernorAcquireWakeLeaseWithTokenRequest
685 where
686 ___E: ::fidl_next::Encoder + ?Sized,
687 ActivityGovernorAcquireWakeLeaseWithTokenRequest: ::fidl_next::Encode<
688 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
689 ___E,
690 >,
691 {
692 #[inline]
693 fn encode_option(
694 this: ::core::option::Option<Self>,
695 encoder: &mut ___E,
696 out: &mut ::core::mem::MaybeUninit<
697 ::fidl_next::wire::Box<
698 'static,
699 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
700 >,
701 >,
702 _: (),
703 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
704 if let Some(inner) = this {
705 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
706 ::fidl_next::wire::Box::encode_present(out);
707 } else {
708 ::fidl_next::wire::Box::encode_absent(out);
709 }
710
711 Ok(())
712 }
713 }
714
715 impl<'de>
716 ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>>
717 for ActivityGovernorAcquireWakeLeaseWithTokenRequest
718 {
719 #[inline]
720 fn from_wire(
721 wire: crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>,
722 ) -> Self {
723 Self {
724 name: ::fidl_next::FromWire::from_wire(wire.name),
725
726 server_token: ::fidl_next::FromWire::from_wire(wire.server_token),
727 }
728 }
729 }
730
731 #[derive(Debug, Default, PartialEq)]
732 pub struct ActivityGovernorAcquireWakeLease2Request {
733 pub name: ::core::option::Option<::std::string::String>,
734
735 pub server_token: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
736
737 pub previous_client_token: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
738
739 pub unmonitored: ::core::option::Option<bool>,
740 }
741
742 impl ActivityGovernorAcquireWakeLease2Request {
743 fn __max_ordinal(&self) -> usize {
744 if self.unmonitored.is_some() {
745 return 4;
746 }
747
748 if self.previous_client_token.is_some() {
749 return 3;
750 }
751
752 if self.server_token.is_some() {
753 return 2;
754 }
755
756 if self.name.is_some() {
757 return 1;
758 }
759
760 0
761 }
762 }
763
764 unsafe impl<___E>
765 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLease2Request<'static>, ___E>
766 for ActivityGovernorAcquireWakeLease2Request
767 where
768 ___E: ::fidl_next::Encoder + ?Sized,
769 ___E: ::fidl_next::fuchsia::HandleEncoder,
770 {
771 #[inline]
772 fn encode(
773 mut self,
774 encoder: &mut ___E,
775 out: &mut ::core::mem::MaybeUninit<
776 crate::wire::ActivityGovernorAcquireWakeLease2Request<'static>,
777 >,
778 _: (),
779 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
780 ::fidl_next::munge!(let crate::wire::ActivityGovernorAcquireWakeLease2Request { table } = out);
781
782 let max_ord = self.__max_ordinal();
783
784 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
785 ::fidl_next::Wire::zero_padding(&mut out);
786
787 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
788 ::fidl_next::wire::Envelope,
789 >(encoder, max_ord);
790
791 for i in 1..=max_ord {
792 match i {
793 4 => {
794 if let Some(value) = self.unmonitored.take() {
795 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
796 value,
797 preallocated.encoder,
798 &mut out,
799 (),
800 )?;
801 } else {
802 ::fidl_next::wire::Envelope::encode_zero(&mut out)
803 }
804 }
805
806 3 => {
807 if let Some(value) = self.previous_client_token.take() {
808 ::fidl_next::wire::Envelope::encode_value::<
809 ::fidl_next::wire::fuchsia::EventPair,
810 ___E,
811 >(
812 value, preallocated.encoder, &mut out, ()
813 )?;
814 } else {
815 ::fidl_next::wire::Envelope::encode_zero(&mut out)
816 }
817 }
818
819 2 => {
820 if let Some(value) = self.server_token.take() {
821 ::fidl_next::wire::Envelope::encode_value::<
822 ::fidl_next::wire::fuchsia::EventPair,
823 ___E,
824 >(
825 value, preallocated.encoder, &mut out, ()
826 )?;
827 } else {
828 ::fidl_next::wire::Envelope::encode_zero(&mut out)
829 }
830 }
831
832 1 => {
833 if let Some(value) = self.name.take() {
834 ::fidl_next::wire::Envelope::encode_value::<
835 ::fidl_next::wire::String<'static>,
836 ___E,
837 >(
838 value, preallocated.encoder, &mut out, 64
839 )?;
840 } else {
841 ::fidl_next::wire::Envelope::encode_zero(&mut out)
842 }
843 }
844
845 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
846 }
847 unsafe {
848 preallocated.write_next(out.assume_init_ref());
849 }
850 }
851
852 ::fidl_next::wire::Table::encode_len(table, max_ord);
853
854 Ok(())
855 }
856 }
857
858 impl<'de> ::fidl_next::FromWire<crate::wire::ActivityGovernorAcquireWakeLease2Request<'de>>
859 for ActivityGovernorAcquireWakeLease2Request
860 {
861 #[inline]
862 fn from_wire(wire_: crate::wire::ActivityGovernorAcquireWakeLease2Request<'de>) -> Self {
863 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
864
865 let name = wire_.table.get(1);
866
867 let server_token = wire_.table.get(2);
868
869 let previous_client_token = wire_.table.get(3);
870
871 let unmonitored = wire_.table.get(4);
872
873 Self {
874 name: name.map(|envelope| {
875 ::fidl_next::FromWire::from_wire(unsafe {
876 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
877 })
878 }),
879
880 server_token: server_token.map(|envelope| {
881 ::fidl_next::FromWire::from_wire(unsafe {
882 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
883 })
884 }),
885
886 previous_client_token: previous_client_token.map(|envelope| {
887 ::fidl_next::FromWire::from_wire(unsafe {
888 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
889 })
890 }),
891
892 unmonitored: unmonitored.map(|envelope| {
893 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
894 }),
895 }
896 }
897 }
898
899 #[derive(Debug, PartialEq)]
900 #[repr(C)]
901 pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
902 pub token: ::fidl_next::fuchsia::zx::EventPair,
903 }
904
905 unsafe impl<___E>
906 ::fidl_next::Encode<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse, ___E>
907 for ActivityGovernorTakeApplicationActivityLeaseResponse
908 where
909 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
910 ___E: ::fidl_next::fuchsia::HandleEncoder,
911 {
912 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
913 Self,
914 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
915 > = unsafe {
916 ::fidl_next::CopyOptimization::enable_if(
917 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::Encode<
918 ::fidl_next::wire::fuchsia::EventPair,
919 ___E,
920 >>::COPY_OPTIMIZATION
921 .is_enabled(),
922 )
923 };
924
925 #[inline]
926 fn encode(
927 self,
928 encoder_: &mut ___E,
929 out_: &mut ::core::mem::MaybeUninit<
930 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
931 >,
932 _: (),
933 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
934 ::fidl_next::munge! {
935 let crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse {
936 token,
937
938 } = out_;
939 }
940
941 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
942
943 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
944
945 Ok(())
946 }
947 }
948
949 unsafe impl<___E>
950 ::fidl_next::EncodeOption<
951 ::fidl_next::wire::Box<
952 'static,
953 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
954 >,
955 ___E,
956 > for ActivityGovernorTakeApplicationActivityLeaseResponse
957 where
958 ___E: ::fidl_next::Encoder + ?Sized,
959 ActivityGovernorTakeApplicationActivityLeaseResponse: ::fidl_next::Encode<
960 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
961 ___E,
962 >,
963 {
964 #[inline]
965 fn encode_option(
966 this: ::core::option::Option<Self>,
967 encoder: &mut ___E,
968 out: &mut ::core::mem::MaybeUninit<
969 ::fidl_next::wire::Box<
970 'static,
971 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
972 >,
973 >,
974 _: (),
975 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
976 if let Some(inner) = this {
977 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
978 ::fidl_next::wire::Box::encode_present(out);
979 } else {
980 ::fidl_next::wire::Box::encode_absent(out);
981 }
982
983 Ok(())
984 }
985 }
986
987 impl ::fidl_next::FromWire<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse>
988 for ActivityGovernorTakeApplicationActivityLeaseResponse
989 {
990 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
991 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
992 Self,
993 > = unsafe {
994 ::fidl_next::CopyOptimization::enable_if(
995 true && <::fidl_next::fuchsia::zx::EventPair as ::fidl_next::FromWire<
996 ::fidl_next::wire::fuchsia::EventPair,
997 >>::COPY_OPTIMIZATION
998 .is_enabled(),
999 )
1000 };
1001
1002 #[inline]
1003 fn from_wire(
1004 wire: crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
1005 ) -> Self {
1006 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
1007 }
1008 }
1009
1010 #[doc = " Holds tokens to the CPU power element.\n\n [`fuchsia.power.system/CpuLevel`] defines the power levels supported by this power element.\n"]
1011 #[derive(Debug, Default, PartialEq)]
1012 pub struct Cpu {
1013 pub assertive_dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1014 }
1015
1016 impl Cpu {
1017 fn __max_ordinal(&self) -> usize {
1018 if self.assertive_dependency_token.is_some() {
1019 return 1;
1020 }
1021
1022 0
1023 }
1024 }
1025
1026 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Cpu<'static>, ___E> for Cpu
1027 where
1028 ___E: ::fidl_next::Encoder + ?Sized,
1029 ___E: ::fidl_next::fuchsia::HandleEncoder,
1030 {
1031 #[inline]
1032 fn encode(
1033 mut self,
1034 encoder: &mut ___E,
1035 out: &mut ::core::mem::MaybeUninit<crate::wire::Cpu<'static>>,
1036 _: (),
1037 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1038 ::fidl_next::munge!(let crate::wire::Cpu { table } = out);
1039
1040 let max_ord = self.__max_ordinal();
1041
1042 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1043 ::fidl_next::Wire::zero_padding(&mut out);
1044
1045 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1046 ::fidl_next::wire::Envelope,
1047 >(encoder, max_ord);
1048
1049 for i in 1..=max_ord {
1050 match i {
1051 1 => {
1052 if let Some(value) = self.assertive_dependency_token.take() {
1053 ::fidl_next::wire::Envelope::encode_value::<
1054 ::fidl_next::wire::fuchsia::Event,
1055 ___E,
1056 >(
1057 value, preallocated.encoder, &mut out, ()
1058 )?;
1059 } else {
1060 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1061 }
1062 }
1063
1064 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1065 }
1066 unsafe {
1067 preallocated.write_next(out.assume_init_ref());
1068 }
1069 }
1070
1071 ::fidl_next::wire::Table::encode_len(table, max_ord);
1072
1073 Ok(())
1074 }
1075 }
1076
1077 impl<'de> ::fidl_next::FromWire<crate::wire::Cpu<'de>> for Cpu {
1078 #[inline]
1079 fn from_wire(wire_: crate::wire::Cpu<'de>) -> Self {
1080 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1081
1082 let assertive_dependency_token = wire_.table.get(1);
1083
1084 Self {
1085 assertive_dependency_token: assertive_dependency_token.map(|envelope| {
1086 ::fidl_next::FromWire::from_wire(unsafe {
1087 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1088 })
1089 }),
1090 }
1091 }
1092 }
1093
1094 #[derive(Debug, Default, PartialEq)]
1095 pub struct CpuElementManagerAddExecutionStateDependencyRequest {
1096 pub dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1097
1098 pub power_level: ::core::option::Option<u8>,
1099 }
1100
1101 impl CpuElementManagerAddExecutionStateDependencyRequest {
1102 fn __max_ordinal(&self) -> usize {
1103 if self.power_level.is_some() {
1104 return 2;
1105 }
1106
1107 if self.dependency_token.is_some() {
1108 return 1;
1109 }
1110
1111 0
1112 }
1113 }
1114
1115 unsafe impl<___E>
1116 ::fidl_next::Encode<
1117 crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
1118 ___E,
1119 > for CpuElementManagerAddExecutionStateDependencyRequest
1120 where
1121 ___E: ::fidl_next::Encoder + ?Sized,
1122 ___E: ::fidl_next::fuchsia::HandleEncoder,
1123 {
1124 #[inline]
1125 fn encode(
1126 mut self,
1127 encoder: &mut ___E,
1128 out: &mut ::core::mem::MaybeUninit<
1129 crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
1130 >,
1131 _: (),
1132 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1133 ::fidl_next::munge!(let crate::wire::CpuElementManagerAddExecutionStateDependencyRequest { table } = out);
1134
1135 let max_ord = self.__max_ordinal();
1136
1137 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1138 ::fidl_next::Wire::zero_padding(&mut out);
1139
1140 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1141 ::fidl_next::wire::Envelope,
1142 >(encoder, max_ord);
1143
1144 for i in 1..=max_ord {
1145 match i {
1146 2 => {
1147 if let Some(value) = self.power_level.take() {
1148 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1149 value,
1150 preallocated.encoder,
1151 &mut out,
1152 (),
1153 )?;
1154 } else {
1155 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1156 }
1157 }
1158
1159 1 => {
1160 if let Some(value) = self.dependency_token.take() {
1161 ::fidl_next::wire::Envelope::encode_value::<
1162 ::fidl_next::wire::fuchsia::Event,
1163 ___E,
1164 >(
1165 value, preallocated.encoder, &mut out, ()
1166 )?;
1167 } else {
1168 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1169 }
1170 }
1171
1172 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1173 }
1174 unsafe {
1175 preallocated.write_next(out.assume_init_ref());
1176 }
1177 }
1178
1179 ::fidl_next::wire::Table::encode_len(table, max_ord);
1180
1181 Ok(())
1182 }
1183 }
1184
1185 impl<'de>
1186 ::fidl_next::FromWire<crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>>
1187 for CpuElementManagerAddExecutionStateDependencyRequest
1188 {
1189 #[inline]
1190 fn from_wire(
1191 wire_: crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>,
1192 ) -> Self {
1193 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1194
1195 let dependency_token = wire_.table.get(1);
1196
1197 let power_level = wire_.table.get(2);
1198
1199 Self {
1200 dependency_token: dependency_token.map(|envelope| {
1201 ::fidl_next::FromWire::from_wire(unsafe {
1202 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1203 })
1204 }),
1205
1206 power_level: power_level.map(|envelope| {
1207 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
1208 }),
1209 }
1210 }
1211 }
1212
1213 #[doc = " Holds the dependency token for the Execution State power element.\n"]
1214 #[derive(Debug, Default, PartialEq)]
1215 pub struct ExecutionState {
1216 pub dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1217 }
1218
1219 impl ExecutionState {
1220 fn __max_ordinal(&self) -> usize {
1221 if self.dependency_token.is_some() {
1222 return 1;
1223 }
1224
1225 0
1226 }
1227 }
1228
1229 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ExecutionState<'static>, ___E> for ExecutionState
1230 where
1231 ___E: ::fidl_next::Encoder + ?Sized,
1232 ___E: ::fidl_next::fuchsia::HandleEncoder,
1233 {
1234 #[inline]
1235 fn encode(
1236 mut self,
1237 encoder: &mut ___E,
1238 out: &mut ::core::mem::MaybeUninit<crate::wire::ExecutionState<'static>>,
1239 _: (),
1240 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1241 ::fidl_next::munge!(let crate::wire::ExecutionState { table } = out);
1242
1243 let max_ord = self.__max_ordinal();
1244
1245 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1246 ::fidl_next::Wire::zero_padding(&mut out);
1247
1248 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1249 ::fidl_next::wire::Envelope,
1250 >(encoder, max_ord);
1251
1252 for i in 1..=max_ord {
1253 match i {
1254 1 => {
1255 if let Some(value) = self.dependency_token.take() {
1256 ::fidl_next::wire::Envelope::encode_value::<
1257 ::fidl_next::wire::fuchsia::Event,
1258 ___E,
1259 >(
1260 value, preallocated.encoder, &mut out, ()
1261 )?;
1262 } else {
1263 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1264 }
1265 }
1266
1267 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1268 }
1269 unsafe {
1270 preallocated.write_next(out.assume_init_ref());
1271 }
1272 }
1273
1274 ::fidl_next::wire::Table::encode_len(table, max_ord);
1275
1276 Ok(())
1277 }
1278 }
1279
1280 impl<'de> ::fidl_next::FromWire<crate::wire::ExecutionState<'de>> for ExecutionState {
1281 #[inline]
1282 fn from_wire(wire_: crate::wire::ExecutionState<'de>) -> Self {
1283 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1284
1285 let dependency_token = wire_.table.get(1);
1286
1287 Self {
1288 dependency_token: dependency_token.map(|envelope| {
1289 ::fidl_next::FromWire::from_wire(unsafe {
1290 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1291 })
1292 }),
1293 }
1294 }
1295 }
1296
1297 #[derive(Debug, Default, PartialEq)]
1298 pub struct ExecutionStateManagerAddApplicationActivityDependencyRequest {
1299 pub dependency_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1300
1301 pub power_level: ::core::option::Option<u8>,
1302 }
1303
1304 impl ExecutionStateManagerAddApplicationActivityDependencyRequest {
1305 fn __max_ordinal(&self) -> usize {
1306 if self.power_level.is_some() {
1307 return 2;
1308 }
1309
1310 if self.dependency_token.is_some() {
1311 return 1;
1312 }
1313
1314 0
1315 }
1316 }
1317
1318 unsafe impl<___E>
1319 ::fidl_next::Encode<
1320 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'static>,
1321 ___E,
1322 > for ExecutionStateManagerAddApplicationActivityDependencyRequest
1323 where
1324 ___E: ::fidl_next::Encoder + ?Sized,
1325 ___E: ::fidl_next::fuchsia::HandleEncoder,
1326 {
1327 #[inline]
1328 fn encode(
1329 mut self,
1330 encoder: &mut ___E,
1331 out: &mut ::core::mem::MaybeUninit<
1332 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'static>,
1333 >,
1334 _: (),
1335 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1336 ::fidl_next::munge!(let crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest { table } = out);
1337
1338 let max_ord = self.__max_ordinal();
1339
1340 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1341 ::fidl_next::Wire::zero_padding(&mut out);
1342
1343 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1344 ::fidl_next::wire::Envelope,
1345 >(encoder, max_ord);
1346
1347 for i in 1..=max_ord {
1348 match i {
1349 2 => {
1350 if let Some(value) = self.power_level.take() {
1351 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1352 value,
1353 preallocated.encoder,
1354 &mut out,
1355 (),
1356 )?;
1357 } else {
1358 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1359 }
1360 }
1361
1362 1 => {
1363 if let Some(value) = self.dependency_token.take() {
1364 ::fidl_next::wire::Envelope::encode_value::<
1365 ::fidl_next::wire::fuchsia::Event,
1366 ___E,
1367 >(
1368 value, preallocated.encoder, &mut out, ()
1369 )?;
1370 } else {
1371 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1372 }
1373 }
1374
1375 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1376 }
1377 unsafe {
1378 preallocated.write_next(out.assume_init_ref());
1379 }
1380 }
1381
1382 ::fidl_next::wire::Table::encode_len(table, max_ord);
1383
1384 Ok(())
1385 }
1386 }
1387
1388 impl<'de>
1389 ::fidl_next::FromWire<
1390 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>,
1391 > for ExecutionStateManagerAddApplicationActivityDependencyRequest
1392 {
1393 #[inline]
1394 fn from_wire(
1395 wire_: crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>,
1396 ) -> Self {
1397 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1398
1399 let dependency_token = wire_.table.get(1);
1400
1401 let power_level = wire_.table.get(2);
1402
1403 Self {
1404 dependency_token: dependency_token.map(|envelope| {
1405 ::fidl_next::FromWire::from_wire(unsafe {
1406 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1407 })
1408 }),
1409
1410 power_level: power_level.map(|envelope| {
1411 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
1412 }),
1413 }
1414 }
1415 }
1416}
1417
1418pub mod wire {
1419
1420 pub use fidl_next_common_fuchsia_power_system::wire::*;
1421
1422 pub type LeaseToken = ::fidl_next::wire::fuchsia::EventPair;
1424
1425 #[derive(Debug)]
1427 #[repr(C)]
1428 pub struct ActivityGovernorAcquireWakeLeaseResponse {
1429 pub token: ::fidl_next::wire::fuchsia::EventPair,
1430 }
1431
1432 static_assertions::const_assert_eq!(
1433 std::mem::size_of::<ActivityGovernorAcquireWakeLeaseResponse>(),
1434 4
1435 );
1436 static_assertions::const_assert_eq!(
1437 std::mem::align_of::<ActivityGovernorAcquireWakeLeaseResponse>(),
1438 4
1439 );
1440
1441 static_assertions::const_assert_eq!(
1442 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseResponse, token),
1443 0
1444 );
1445
1446 impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLeaseResponse {
1447 type Constraint = ();
1448
1449 fn validate(
1450 _: ::fidl_next::Slot<'_, Self>,
1451 _: Self::Constraint,
1452 ) -> Result<(), ::fidl_next::ValidationError> {
1453 Ok(())
1454 }
1455 }
1456
1457 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLeaseResponse {
1458 type Narrowed<'de> = ActivityGovernorAcquireWakeLeaseResponse;
1459
1460 #[inline]
1461 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1462 ::fidl_next::munge! {
1463 let Self {
1464 token,
1465
1466 } = &mut *out_;
1467 }
1468
1469 ::fidl_next::Wire::zero_padding(token);
1470 }
1471 }
1472
1473 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireWakeLeaseResponse
1474 where
1475 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1476 ___D: ::fidl_next::fuchsia::HandleDecoder,
1477 {
1478 fn decode(
1479 slot_: ::fidl_next::Slot<'_, Self>,
1480 decoder_: &mut ___D,
1481 _: (),
1482 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1483 ::fidl_next::munge! {
1484 let Self {
1485 mut token,
1486
1487 } = slot_;
1488 }
1489
1490 let _field = token.as_mut();
1491
1492 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1493
1494 Ok(())
1495 }
1496 }
1497
1498 impl ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLeaseResponse {
1499 type Natural = crate::natural::ActivityGovernorAcquireWakeLeaseResponse;
1500 }
1501
1502 #[repr(C)]
1504 pub struct ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1505 pub(crate) table: ::fidl_next::wire::Table<'de>,
1506 }
1507
1508 impl<'de> Drop for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1509 fn drop(&mut self) {
1510 let _ = self.table.get(1).map(|envelope| unsafe {
1511 envelope.read_unchecked::<::fidl_next::ClientEnd<
1512 crate::SuspendBlocker,
1513 ::fidl_next::wire::fuchsia::Channel,
1514 >>()
1515 });
1516
1517 let _ = self.table.get(2).map(|envelope| unsafe {
1518 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
1519 });
1520 }
1521 }
1522
1523 impl ::fidl_next::Constrained for ActivityGovernorRegisterSuspendBlockerRequest<'_> {
1524 type Constraint = ();
1525
1526 fn validate(
1527 _: ::fidl_next::Slot<'_, Self>,
1528 _: Self::Constraint,
1529 ) -> Result<(), ::fidl_next::ValidationError> {
1530 Ok(())
1531 }
1532 }
1533
1534 unsafe impl ::fidl_next::Wire for ActivityGovernorRegisterSuspendBlockerRequest<'static> {
1535 type Narrowed<'de> = ActivityGovernorRegisterSuspendBlockerRequest<'de>;
1536
1537 #[inline]
1538 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1539 ::fidl_next::munge!(let Self { table } = out);
1540 ::fidl_next::wire::Table::zero_padding(table);
1541 }
1542 }
1543
1544 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1545 for ActivityGovernorRegisterSuspendBlockerRequest<'de>
1546 where
1547 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1548 ___D: ::fidl_next::fuchsia::HandleDecoder,
1549 {
1550 fn decode(
1551 slot: ::fidl_next::Slot<'_, Self>,
1552 decoder: &mut ___D,
1553 _: (),
1554 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1555 ::fidl_next::munge!(let Self { table } = slot);
1556
1557 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1558 match ordinal {
1559 0 => unsafe { ::core::hint::unreachable_unchecked() },
1560
1561 1 => {
1562 ::fidl_next::wire::Envelope::decode_as::<
1563 ___D,
1564 ::fidl_next::ClientEnd<
1565 crate::SuspendBlocker,
1566 ::fidl_next::wire::fuchsia::Channel,
1567 >,
1568 >(slot.as_mut(), decoder, ())?;
1569
1570 Ok(())
1571 }
1572
1573 2 => {
1574 ::fidl_next::wire::Envelope::decode_as::<
1575 ___D,
1576 ::fidl_next::wire::String<'de>,
1577 >(slot.as_mut(), decoder, 64)?;
1578
1579 let value = unsafe {
1580 slot.deref_unchecked()
1581 .deref_unchecked::<::fidl_next::wire::String<'_>>()
1582 };
1583
1584 if value.len() > 64 {
1585 return Err(::fidl_next::DecodeError::VectorTooLong {
1586 size: value.len() as u64,
1587 limit: 64,
1588 });
1589 }
1590
1591 Ok(())
1592 }
1593
1594 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1595 }
1596 })
1597 }
1598 }
1599
1600 impl<'de> ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1601 pub fn suspend_blocker(
1602 &self,
1603 ) -> ::core::option::Option<
1604 &::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::wire::fuchsia::Channel>,
1605 > {
1606 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1607 }
1608
1609 pub fn take_suspend_blocker(
1610 &mut self,
1611 ) -> ::core::option::Option<
1612 ::fidl_next::ClientEnd<crate::SuspendBlocker, ::fidl_next::wire::fuchsia::Channel>,
1613 > {
1614 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1615 }
1616
1617 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
1618 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1619 }
1620
1621 pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
1622 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
1623 }
1624 }
1625
1626 impl<'de> ::core::fmt::Debug for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1627 fn fmt(
1628 &self,
1629 f: &mut ::core::fmt::Formatter<'_>,
1630 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1631 f.debug_struct("ActivityGovernorRegisterSuspendBlockerRequest")
1632 .field("suspend_blocker", &self.suspend_blocker())
1633 .field("name", &self.name())
1634 .finish()
1635 }
1636 }
1637
1638 impl<'de> ::fidl_next::IntoNatural for ActivityGovernorRegisterSuspendBlockerRequest<'de> {
1639 type Natural = crate::natural::ActivityGovernorRegisterSuspendBlockerRequest;
1640 }
1641
1642 #[derive(Debug)]
1644 #[repr(C)]
1645 pub struct ActivityGovernorRegisterSuspendBlockerResponse {
1646 pub token: ::fidl_next::wire::fuchsia::EventPair,
1647 }
1648
1649 static_assertions::const_assert_eq!(
1650 std::mem::size_of::<ActivityGovernorRegisterSuspendBlockerResponse>(),
1651 4
1652 );
1653 static_assertions::const_assert_eq!(
1654 std::mem::align_of::<ActivityGovernorRegisterSuspendBlockerResponse>(),
1655 4
1656 );
1657
1658 static_assertions::const_assert_eq!(
1659 std::mem::offset_of!(ActivityGovernorRegisterSuspendBlockerResponse, token),
1660 0
1661 );
1662
1663 impl ::fidl_next::Constrained for ActivityGovernorRegisterSuspendBlockerResponse {
1664 type Constraint = ();
1665
1666 fn validate(
1667 _: ::fidl_next::Slot<'_, Self>,
1668 _: Self::Constraint,
1669 ) -> Result<(), ::fidl_next::ValidationError> {
1670 Ok(())
1671 }
1672 }
1673
1674 unsafe impl ::fidl_next::Wire for ActivityGovernorRegisterSuspendBlockerResponse {
1675 type Narrowed<'de> = ActivityGovernorRegisterSuspendBlockerResponse;
1676
1677 #[inline]
1678 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1679 ::fidl_next::munge! {
1680 let Self {
1681 token,
1682
1683 } = &mut *out_;
1684 }
1685
1686 ::fidl_next::Wire::zero_padding(token);
1687 }
1688 }
1689
1690 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorRegisterSuspendBlockerResponse
1691 where
1692 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1693 ___D: ::fidl_next::fuchsia::HandleDecoder,
1694 {
1695 fn decode(
1696 slot_: ::fidl_next::Slot<'_, Self>,
1697 decoder_: &mut ___D,
1698 _: (),
1699 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1700 ::fidl_next::munge! {
1701 let Self {
1702 mut token,
1703
1704 } = slot_;
1705 }
1706
1707 let _field = token.as_mut();
1708
1709 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1710
1711 Ok(())
1712 }
1713 }
1714
1715 impl ::fidl_next::IntoNatural for ActivityGovernorRegisterSuspendBlockerResponse {
1716 type Natural = crate::natural::ActivityGovernorRegisterSuspendBlockerResponse;
1717 }
1718
1719 #[repr(C)]
1721 pub struct ApplicationActivity<'de> {
1722 pub(crate) table: ::fidl_next::wire::Table<'de>,
1723 }
1724
1725 impl<'de> Drop for ApplicationActivity<'de> {
1726 fn drop(&mut self) {
1727 let _ = self.table.get(1).map(|envelope| unsafe {
1728 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1729 });
1730 }
1731 }
1732
1733 impl ::fidl_next::Constrained for ApplicationActivity<'_> {
1734 type Constraint = ();
1735
1736 fn validate(
1737 _: ::fidl_next::Slot<'_, Self>,
1738 _: Self::Constraint,
1739 ) -> Result<(), ::fidl_next::ValidationError> {
1740 Ok(())
1741 }
1742 }
1743
1744 unsafe impl ::fidl_next::Wire for ApplicationActivity<'static> {
1745 type Narrowed<'de> = ApplicationActivity<'de>;
1746
1747 #[inline]
1748 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1749 ::fidl_next::munge!(let Self { table } = out);
1750 ::fidl_next::wire::Table::zero_padding(table);
1751 }
1752 }
1753
1754 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ApplicationActivity<'de>
1755 where
1756 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1757 ___D: ::fidl_next::fuchsia::HandleDecoder,
1758 {
1759 fn decode(
1760 slot: ::fidl_next::Slot<'_, Self>,
1761 decoder: &mut ___D,
1762 _: (),
1763 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1764 ::fidl_next::munge!(let Self { table } = slot);
1765
1766 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1767 match ordinal {
1768 0 => unsafe { ::core::hint::unreachable_unchecked() },
1769
1770 1 => {
1771 ::fidl_next::wire::Envelope::decode_as::<
1772 ___D,
1773 ::fidl_next::wire::fuchsia::Event,
1774 >(slot.as_mut(), decoder, ())?;
1775
1776 Ok(())
1777 }
1778
1779 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1780 }
1781 })
1782 }
1783 }
1784
1785 impl<'de> ApplicationActivity<'de> {
1786 pub fn assertive_dependency_token(
1787 &self,
1788 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
1789 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1790 }
1791
1792 pub fn take_assertive_dependency_token(
1793 &mut self,
1794 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
1795 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1796 }
1797 }
1798
1799 impl<'de> ::core::fmt::Debug for ApplicationActivity<'de> {
1800 fn fmt(
1801 &self,
1802 f: &mut ::core::fmt::Formatter<'_>,
1803 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1804 f.debug_struct("ApplicationActivity")
1805 .field("assertive_dependency_token", &self.assertive_dependency_token())
1806 .finish()
1807 }
1808 }
1809
1810 impl<'de> ::fidl_next::IntoNatural for ApplicationActivity<'de> {
1811 type Natural = crate::natural::ApplicationActivity;
1812 }
1813
1814 #[repr(C)]
1816 pub struct PowerElements<'de> {
1817 pub(crate) table: ::fidl_next::wire::Table<'de>,
1818 }
1819
1820 impl<'de> Drop for PowerElements<'de> {
1821 fn drop(&mut self) {
1822 let _ = self.table.get(3).map(|envelope| unsafe {
1823 envelope.read_unchecked::<crate::wire::ApplicationActivity<'de>>()
1824 });
1825 }
1826 }
1827
1828 impl ::fidl_next::Constrained for PowerElements<'_> {
1829 type Constraint = ();
1830
1831 fn validate(
1832 _: ::fidl_next::Slot<'_, Self>,
1833 _: Self::Constraint,
1834 ) -> Result<(), ::fidl_next::ValidationError> {
1835 Ok(())
1836 }
1837 }
1838
1839 unsafe impl ::fidl_next::Wire for PowerElements<'static> {
1840 type Narrowed<'de> = PowerElements<'de>;
1841
1842 #[inline]
1843 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1844 ::fidl_next::munge!(let Self { table } = out);
1845 ::fidl_next::wire::Table::zero_padding(table);
1846 }
1847 }
1848
1849 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElements<'de>
1850 where
1851 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1852 ___D: ::fidl_next::fuchsia::HandleDecoder,
1853 {
1854 fn decode(
1855 slot: ::fidl_next::Slot<'_, Self>,
1856 decoder: &mut ___D,
1857 _: (),
1858 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1859 ::fidl_next::munge!(let Self { table } = slot);
1860
1861 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1862 match ordinal {
1863 0 => unsafe { ::core::hint::unreachable_unchecked() },
1864
1865 3 => {
1866 ::fidl_next::wire::Envelope::decode_as::<
1867 ___D,
1868 crate::wire::ApplicationActivity<'de>,
1869 >(slot.as_mut(), decoder, ())?;
1870
1871 Ok(())
1872 }
1873
1874 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1875 }
1876 })
1877 }
1878 }
1879
1880 impl<'de> PowerElements<'de> {
1881 pub fn application_activity(
1882 &self,
1883 ) -> ::core::option::Option<&crate::wire::ApplicationActivity<'de>> {
1884 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
1885 }
1886
1887 pub fn take_application_activity(
1888 &mut self,
1889 ) -> ::core::option::Option<crate::wire::ApplicationActivity<'de>> {
1890 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
1891 }
1892 }
1893
1894 impl<'de> ::core::fmt::Debug for PowerElements<'de> {
1895 fn fmt(
1896 &self,
1897 f: &mut ::core::fmt::Formatter<'_>,
1898 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1899 f.debug_struct("PowerElements")
1900 .field("application_activity", &self.application_activity())
1901 .finish()
1902 }
1903 }
1904
1905 impl<'de> ::fidl_next::IntoNatural for PowerElements<'de> {
1906 type Natural = crate::natural::PowerElements;
1907 }
1908
1909 #[derive(Debug)]
1911 #[repr(C)]
1912 pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1913 pub token: ::fidl_next::wire::fuchsia::EventPair,
1914 }
1915
1916 static_assertions::const_assert_eq!(
1917 std::mem::size_of::<ActivityGovernorAcquireUnmonitoredWakeLeaseResponse>(),
1918 4
1919 );
1920 static_assertions::const_assert_eq!(
1921 std::mem::align_of::<ActivityGovernorAcquireUnmonitoredWakeLeaseResponse>(),
1922 4
1923 );
1924
1925 static_assertions::const_assert_eq!(
1926 std::mem::offset_of!(ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, token),
1927 0
1928 );
1929
1930 impl ::fidl_next::Constrained for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1931 type Constraint = ();
1932
1933 fn validate(
1934 _: ::fidl_next::Slot<'_, Self>,
1935 _: Self::Constraint,
1936 ) -> Result<(), ::fidl_next::ValidationError> {
1937 Ok(())
1938 }
1939 }
1940
1941 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1942 type Narrowed<'de> = ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
1943
1944 #[inline]
1945 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1946 ::fidl_next::munge! {
1947 let Self {
1948 token,
1949
1950 } = &mut *out_;
1951 }
1952
1953 ::fidl_next::Wire::zero_padding(token);
1954 }
1955 }
1956
1957 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse
1958 where
1959 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1960 ___D: ::fidl_next::fuchsia::HandleDecoder,
1961 {
1962 fn decode(
1963 slot_: ::fidl_next::Slot<'_, Self>,
1964 decoder_: &mut ___D,
1965 _: (),
1966 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1967 ::fidl_next::munge! {
1968 let Self {
1969 mut token,
1970
1971 } = slot_;
1972 }
1973
1974 let _field = token.as_mut();
1975
1976 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1977
1978 Ok(())
1979 }
1980 }
1981
1982 impl ::fidl_next::IntoNatural for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
1983 type Natural = crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
1984 }
1985
1986 #[derive(Debug)]
1988 #[repr(C)]
1989 pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de> {
1990 pub name: ::fidl_next::wire::String<'de>,
1991
1992 pub server_token: ::fidl_next::wire::fuchsia::EventPair,
1993 }
1994
1995 static_assertions::const_assert_eq!(
1996 std::mem::size_of::<ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>>(),
1997 24
1998 );
1999 static_assertions::const_assert_eq!(
2000 std::mem::align_of::<ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>>(),
2001 8
2002 );
2003
2004 static_assertions::const_assert_eq!(
2005 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>, name),
2006 0
2007 );
2008
2009 static_assertions::const_assert_eq!(
2010 std::mem::offset_of!(ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_>, server_token),
2011 16
2012 );
2013
2014 impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'_> {
2015 type Constraint = ();
2016
2017 fn validate(
2018 _: ::fidl_next::Slot<'_, Self>,
2019 _: Self::Constraint,
2020 ) -> Result<(), ::fidl_next::ValidationError> {
2021 Ok(())
2022 }
2023 }
2024
2025 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static> {
2026 type Narrowed<'de> = ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>;
2027
2028 #[inline]
2029 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2030 ::fidl_next::munge! {
2031 let Self {
2032 name,
2033 server_token,
2034
2035 } = &mut *out_;
2036 }
2037
2038 ::fidl_next::Wire::zero_padding(name);
2039
2040 ::fidl_next::Wire::zero_padding(server_token);
2041
2042 unsafe {
2043 out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
2044 }
2045 }
2046 }
2047
2048 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2049 for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>
2050 where
2051 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2052 ___D: ::fidl_next::Decoder<'de>,
2053 ___D: ::fidl_next::fuchsia::HandleDecoder,
2054 {
2055 fn decode(
2056 slot_: ::fidl_next::Slot<'_, Self>,
2057 decoder_: &mut ___D,
2058 _: (),
2059 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2060 if slot_.as_bytes()[20..24] != [0u8; 4] {
2061 return Err(::fidl_next::DecodeError::InvalidPadding);
2062 }
2063
2064 ::fidl_next::munge! {
2065 let Self {
2066 mut name,
2067 mut server_token,
2068
2069 } = slot_;
2070 }
2071
2072 let _field = name.as_mut();
2073 ::fidl_next::Constrained::validate(_field, 64)?;
2074 ::fidl_next::Decode::decode(name.as_mut(), decoder_, 64)?;
2075
2076 let name = unsafe { name.deref_unchecked() };
2077
2078 if name.len() > 64 {
2079 return Err(::fidl_next::DecodeError::VectorTooLong {
2080 size: name.len() as u64,
2081 limit: 64,
2082 });
2083 }
2084
2085 let _field = server_token.as_mut();
2086
2087 ::fidl_next::Decode::decode(server_token.as_mut(), decoder_, ())?;
2088
2089 Ok(())
2090 }
2091 }
2092
2093 impl<'de> ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de> {
2094 type Natural = crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenRequest;
2095 }
2096
2097 #[repr(C)]
2099 pub struct ActivityGovernorAcquireWakeLease2Request<'de> {
2100 pub(crate) table: ::fidl_next::wire::Table<'de>,
2101 }
2102
2103 impl<'de> Drop for ActivityGovernorAcquireWakeLease2Request<'de> {
2104 fn drop(&mut self) {
2105 let _ = self.table.get(1).map(|envelope| unsafe {
2106 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2107 });
2108
2109 let _ = self.table.get(2).map(|envelope| unsafe {
2110 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
2111 });
2112
2113 let _ = self.table.get(3).map(|envelope| unsafe {
2114 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
2115 });
2116
2117 let _ = self.table.get(4).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
2118 }
2119 }
2120
2121 impl ::fidl_next::Constrained for ActivityGovernorAcquireWakeLease2Request<'_> {
2122 type Constraint = ();
2123
2124 fn validate(
2125 _: ::fidl_next::Slot<'_, Self>,
2126 _: Self::Constraint,
2127 ) -> Result<(), ::fidl_next::ValidationError> {
2128 Ok(())
2129 }
2130 }
2131
2132 unsafe impl ::fidl_next::Wire for ActivityGovernorAcquireWakeLease2Request<'static> {
2133 type Narrowed<'de> = ActivityGovernorAcquireWakeLease2Request<'de>;
2134
2135 #[inline]
2136 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2137 ::fidl_next::munge!(let Self { table } = out);
2138 ::fidl_next::wire::Table::zero_padding(table);
2139 }
2140 }
2141
2142 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ActivityGovernorAcquireWakeLease2Request<'de>
2143 where
2144 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2145 ___D: ::fidl_next::fuchsia::HandleDecoder,
2146 {
2147 fn decode(
2148 slot: ::fidl_next::Slot<'_, Self>,
2149 decoder: &mut ___D,
2150 _: (),
2151 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2152 ::fidl_next::munge!(let Self { table } = slot);
2153
2154 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2155 match ordinal {
2156 0 => unsafe { ::core::hint::unreachable_unchecked() },
2157
2158 1 => {
2159 ::fidl_next::wire::Envelope::decode_as::<
2160 ___D,
2161 ::fidl_next::wire::String<'de>,
2162 >(slot.as_mut(), decoder, 64)?;
2163
2164 let value = unsafe {
2165 slot.deref_unchecked()
2166 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2167 };
2168
2169 if value.len() > 64 {
2170 return Err(::fidl_next::DecodeError::VectorTooLong {
2171 size: value.len() as u64,
2172 limit: 64,
2173 });
2174 }
2175
2176 Ok(())
2177 }
2178
2179 2 => {
2180 ::fidl_next::wire::Envelope::decode_as::<
2181 ___D,
2182 ::fidl_next::wire::fuchsia::EventPair,
2183 >(slot.as_mut(), decoder, ())?;
2184
2185 Ok(())
2186 }
2187
2188 3 => {
2189 ::fidl_next::wire::Envelope::decode_as::<
2190 ___D,
2191 ::fidl_next::wire::fuchsia::EventPair,
2192 >(slot.as_mut(), decoder, ())?;
2193
2194 Ok(())
2195 }
2196
2197 4 => {
2198 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
2199 slot.as_mut(),
2200 decoder,
2201 (),
2202 )?;
2203
2204 Ok(())
2205 }
2206
2207 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2208 }
2209 })
2210 }
2211 }
2212
2213 impl<'de> ActivityGovernorAcquireWakeLease2Request<'de> {
2214 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2215 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2216 }
2217
2218 pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
2219 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2220 }
2221
2222 pub fn server_token(
2223 &self,
2224 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
2225 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2226 }
2227
2228 pub fn take_server_token(
2229 &mut self,
2230 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::EventPair> {
2231 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2232 }
2233
2234 pub fn previous_client_token(
2235 &self,
2236 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
2237 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2238 }
2239
2240 pub fn take_previous_client_token(
2241 &mut self,
2242 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::EventPair> {
2243 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
2244 }
2245
2246 pub fn unmonitored(&self) -> ::core::option::Option<&bool> {
2247 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2248 }
2249
2250 pub fn take_unmonitored(&mut self) -> ::core::option::Option<bool> {
2251 unsafe { Some(self.table.get_mut(4)?.take_unchecked()) }
2252 }
2253 }
2254
2255 impl<'de> ::core::fmt::Debug for ActivityGovernorAcquireWakeLease2Request<'de> {
2256 fn fmt(
2257 &self,
2258 f: &mut ::core::fmt::Formatter<'_>,
2259 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2260 f.debug_struct("ActivityGovernorAcquireWakeLease2Request")
2261 .field("name", &self.name())
2262 .field("server_token", &self.server_token())
2263 .field("previous_client_token", &self.previous_client_token())
2264 .field("unmonitored", &self.unmonitored())
2265 .finish()
2266 }
2267 }
2268
2269 impl<'de> ::fidl_next::IntoNatural for ActivityGovernorAcquireWakeLease2Request<'de> {
2270 type Natural = crate::natural::ActivityGovernorAcquireWakeLease2Request;
2271 }
2272
2273 #[derive(Debug)]
2275 #[repr(C)]
2276 pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
2277 pub token: ::fidl_next::wire::fuchsia::EventPair,
2278 }
2279
2280 static_assertions::const_assert_eq!(
2281 std::mem::size_of::<ActivityGovernorTakeApplicationActivityLeaseResponse>(),
2282 4
2283 );
2284 static_assertions::const_assert_eq!(
2285 std::mem::align_of::<ActivityGovernorTakeApplicationActivityLeaseResponse>(),
2286 4
2287 );
2288
2289 static_assertions::const_assert_eq!(
2290 std::mem::offset_of!(ActivityGovernorTakeApplicationActivityLeaseResponse, token),
2291 0
2292 );
2293
2294 impl ::fidl_next::Constrained for ActivityGovernorTakeApplicationActivityLeaseResponse {
2295 type Constraint = ();
2296
2297 fn validate(
2298 _: ::fidl_next::Slot<'_, Self>,
2299 _: Self::Constraint,
2300 ) -> Result<(), ::fidl_next::ValidationError> {
2301 Ok(())
2302 }
2303 }
2304
2305 unsafe impl ::fidl_next::Wire for ActivityGovernorTakeApplicationActivityLeaseResponse {
2306 type Narrowed<'de> = ActivityGovernorTakeApplicationActivityLeaseResponse;
2307
2308 #[inline]
2309 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2310 ::fidl_next::munge! {
2311 let Self {
2312 token,
2313
2314 } = &mut *out_;
2315 }
2316
2317 ::fidl_next::Wire::zero_padding(token);
2318 }
2319 }
2320
2321 unsafe impl<___D> ::fidl_next::Decode<___D> for ActivityGovernorTakeApplicationActivityLeaseResponse
2322 where
2323 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2324 ___D: ::fidl_next::fuchsia::HandleDecoder,
2325 {
2326 fn decode(
2327 slot_: ::fidl_next::Slot<'_, Self>,
2328 decoder_: &mut ___D,
2329 _: (),
2330 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2331 ::fidl_next::munge! {
2332 let Self {
2333 mut token,
2334
2335 } = slot_;
2336 }
2337
2338 let _field = token.as_mut();
2339
2340 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
2341
2342 Ok(())
2343 }
2344 }
2345
2346 impl ::fidl_next::IntoNatural for ActivityGovernorTakeApplicationActivityLeaseResponse {
2347 type Natural = crate::natural::ActivityGovernorTakeApplicationActivityLeaseResponse;
2348 }
2349
2350 #[repr(C)]
2352 pub struct Cpu<'de> {
2353 pub(crate) table: ::fidl_next::wire::Table<'de>,
2354 }
2355
2356 impl<'de> Drop for Cpu<'de> {
2357 fn drop(&mut self) {
2358 let _ = self.table.get(1).map(|envelope| unsafe {
2359 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2360 });
2361 }
2362 }
2363
2364 impl ::fidl_next::Constrained for Cpu<'_> {
2365 type Constraint = ();
2366
2367 fn validate(
2368 _: ::fidl_next::Slot<'_, Self>,
2369 _: Self::Constraint,
2370 ) -> Result<(), ::fidl_next::ValidationError> {
2371 Ok(())
2372 }
2373 }
2374
2375 unsafe impl ::fidl_next::Wire for Cpu<'static> {
2376 type Narrowed<'de> = Cpu<'de>;
2377
2378 #[inline]
2379 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2380 ::fidl_next::munge!(let Self { table } = out);
2381 ::fidl_next::wire::Table::zero_padding(table);
2382 }
2383 }
2384
2385 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Cpu<'de>
2386 where
2387 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2388 ___D: ::fidl_next::fuchsia::HandleDecoder,
2389 {
2390 fn decode(
2391 slot: ::fidl_next::Slot<'_, Self>,
2392 decoder: &mut ___D,
2393 _: (),
2394 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2395 ::fidl_next::munge!(let Self { table } = slot);
2396
2397 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2398 match ordinal {
2399 0 => unsafe { ::core::hint::unreachable_unchecked() },
2400
2401 1 => {
2402 ::fidl_next::wire::Envelope::decode_as::<
2403 ___D,
2404 ::fidl_next::wire::fuchsia::Event,
2405 >(slot.as_mut(), decoder, ())?;
2406
2407 Ok(())
2408 }
2409
2410 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2411 }
2412 })
2413 }
2414 }
2415
2416 impl<'de> Cpu<'de> {
2417 pub fn assertive_dependency_token(
2418 &self,
2419 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2420 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2421 }
2422
2423 pub fn take_assertive_dependency_token(
2424 &mut self,
2425 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2426 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2427 }
2428 }
2429
2430 impl<'de> ::core::fmt::Debug for Cpu<'de> {
2431 fn fmt(
2432 &self,
2433 f: &mut ::core::fmt::Formatter<'_>,
2434 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2435 f.debug_struct("Cpu")
2436 .field("assertive_dependency_token", &self.assertive_dependency_token())
2437 .finish()
2438 }
2439 }
2440
2441 impl<'de> ::fidl_next::IntoNatural for Cpu<'de> {
2442 type Natural = crate::natural::Cpu;
2443 }
2444
2445 #[repr(C)]
2447 pub struct CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2448 pub(crate) table: ::fidl_next::wire::Table<'de>,
2449 }
2450
2451 impl<'de> Drop for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2452 fn drop(&mut self) {
2453 let _ = self.table.get(1).map(|envelope| unsafe {
2454 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2455 });
2456
2457 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2458 }
2459 }
2460
2461 impl ::fidl_next::Constrained for CpuElementManagerAddExecutionStateDependencyRequest<'_> {
2462 type Constraint = ();
2463
2464 fn validate(
2465 _: ::fidl_next::Slot<'_, Self>,
2466 _: Self::Constraint,
2467 ) -> Result<(), ::fidl_next::ValidationError> {
2468 Ok(())
2469 }
2470 }
2471
2472 unsafe impl ::fidl_next::Wire for CpuElementManagerAddExecutionStateDependencyRequest<'static> {
2473 type Narrowed<'de> = CpuElementManagerAddExecutionStateDependencyRequest<'de>;
2474
2475 #[inline]
2476 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2477 ::fidl_next::munge!(let Self { table } = out);
2478 ::fidl_next::wire::Table::zero_padding(table);
2479 }
2480 }
2481
2482 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2483 for CpuElementManagerAddExecutionStateDependencyRequest<'de>
2484 where
2485 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2486 ___D: ::fidl_next::fuchsia::HandleDecoder,
2487 {
2488 fn decode(
2489 slot: ::fidl_next::Slot<'_, Self>,
2490 decoder: &mut ___D,
2491 _: (),
2492 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2493 ::fidl_next::munge!(let Self { table } = slot);
2494
2495 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2496 match ordinal {
2497 0 => unsafe { ::core::hint::unreachable_unchecked() },
2498
2499 1 => {
2500 ::fidl_next::wire::Envelope::decode_as::<
2501 ___D,
2502 ::fidl_next::wire::fuchsia::Event,
2503 >(slot.as_mut(), decoder, ())?;
2504
2505 Ok(())
2506 }
2507
2508 2 => {
2509 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2510 slot.as_mut(),
2511 decoder,
2512 (),
2513 )?;
2514
2515 Ok(())
2516 }
2517
2518 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2519 }
2520 })
2521 }
2522 }
2523
2524 impl<'de> CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2525 pub fn dependency_token(
2526 &self,
2527 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2528 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2529 }
2530
2531 pub fn take_dependency_token(
2532 &mut self,
2533 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2534 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2535 }
2536
2537 pub fn power_level(&self) -> ::core::option::Option<&u8> {
2538 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2539 }
2540
2541 pub fn take_power_level(&mut self) -> ::core::option::Option<u8> {
2542 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2543 }
2544 }
2545
2546 impl<'de> ::core::fmt::Debug for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2547 fn fmt(
2548 &self,
2549 f: &mut ::core::fmt::Formatter<'_>,
2550 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2551 f.debug_struct("CpuElementManagerAddExecutionStateDependencyRequest")
2552 .field("dependency_token", &self.dependency_token())
2553 .field("power_level", &self.power_level())
2554 .finish()
2555 }
2556 }
2557
2558 impl<'de> ::fidl_next::IntoNatural for CpuElementManagerAddExecutionStateDependencyRequest<'de> {
2559 type Natural = crate::natural::CpuElementManagerAddExecutionStateDependencyRequest;
2560 }
2561
2562 #[repr(C)]
2564 pub struct ExecutionState<'de> {
2565 pub(crate) table: ::fidl_next::wire::Table<'de>,
2566 }
2567
2568 impl<'de> Drop for ExecutionState<'de> {
2569 fn drop(&mut self) {
2570 let _ = self.table.get(1).map(|envelope| unsafe {
2571 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2572 });
2573 }
2574 }
2575
2576 impl ::fidl_next::Constrained for ExecutionState<'_> {
2577 type Constraint = ();
2578
2579 fn validate(
2580 _: ::fidl_next::Slot<'_, Self>,
2581 _: Self::Constraint,
2582 ) -> Result<(), ::fidl_next::ValidationError> {
2583 Ok(())
2584 }
2585 }
2586
2587 unsafe impl ::fidl_next::Wire for ExecutionState<'static> {
2588 type Narrowed<'de> = ExecutionState<'de>;
2589
2590 #[inline]
2591 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2592 ::fidl_next::munge!(let Self { table } = out);
2593 ::fidl_next::wire::Table::zero_padding(table);
2594 }
2595 }
2596
2597 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ExecutionState<'de>
2598 where
2599 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2600 ___D: ::fidl_next::fuchsia::HandleDecoder,
2601 {
2602 fn decode(
2603 slot: ::fidl_next::Slot<'_, Self>,
2604 decoder: &mut ___D,
2605 _: (),
2606 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2607 ::fidl_next::munge!(let Self { table } = slot);
2608
2609 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2610 match ordinal {
2611 0 => unsafe { ::core::hint::unreachable_unchecked() },
2612
2613 1 => {
2614 ::fidl_next::wire::Envelope::decode_as::<
2615 ___D,
2616 ::fidl_next::wire::fuchsia::Event,
2617 >(slot.as_mut(), decoder, ())?;
2618
2619 Ok(())
2620 }
2621
2622 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2623 }
2624 })
2625 }
2626 }
2627
2628 impl<'de> ExecutionState<'de> {
2629 pub fn dependency_token(
2630 &self,
2631 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2632 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2633 }
2634
2635 pub fn take_dependency_token(
2636 &mut self,
2637 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2638 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2639 }
2640 }
2641
2642 impl<'de> ::core::fmt::Debug for ExecutionState<'de> {
2643 fn fmt(
2644 &self,
2645 f: &mut ::core::fmt::Formatter<'_>,
2646 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2647 f.debug_struct("ExecutionState")
2648 .field("dependency_token", &self.dependency_token())
2649 .finish()
2650 }
2651 }
2652
2653 impl<'de> ::fidl_next::IntoNatural for ExecutionState<'de> {
2654 type Natural = crate::natural::ExecutionState;
2655 }
2656
2657 #[repr(C)]
2659 pub struct ExecutionStateManagerAddApplicationActivityDependencyRequest<'de> {
2660 pub(crate) table: ::fidl_next::wire::Table<'de>,
2661 }
2662
2663 impl<'de> Drop for ExecutionStateManagerAddApplicationActivityDependencyRequest<'de> {
2664 fn drop(&mut self) {
2665 let _ = self.table.get(1).map(|envelope| unsafe {
2666 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2667 });
2668
2669 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2670 }
2671 }
2672
2673 impl ::fidl_next::Constrained for ExecutionStateManagerAddApplicationActivityDependencyRequest<'_> {
2674 type Constraint = ();
2675
2676 fn validate(
2677 _: ::fidl_next::Slot<'_, Self>,
2678 _: Self::Constraint,
2679 ) -> Result<(), ::fidl_next::ValidationError> {
2680 Ok(())
2681 }
2682 }
2683
2684 unsafe impl ::fidl_next::Wire
2685 for ExecutionStateManagerAddApplicationActivityDependencyRequest<'static>
2686 {
2687 type Narrowed<'de> = ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>;
2688
2689 #[inline]
2690 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2691 ::fidl_next::munge!(let Self { table } = out);
2692 ::fidl_next::wire::Table::zero_padding(table);
2693 }
2694 }
2695
2696 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2697 for ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>
2698 where
2699 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2700 ___D: ::fidl_next::fuchsia::HandleDecoder,
2701 {
2702 fn decode(
2703 slot: ::fidl_next::Slot<'_, Self>,
2704 decoder: &mut ___D,
2705 _: (),
2706 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2707 ::fidl_next::munge!(let Self { table } = slot);
2708
2709 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2710 match ordinal {
2711 0 => unsafe { ::core::hint::unreachable_unchecked() },
2712
2713 1 => {
2714 ::fidl_next::wire::Envelope::decode_as::<
2715 ___D,
2716 ::fidl_next::wire::fuchsia::Event,
2717 >(slot.as_mut(), decoder, ())?;
2718
2719 Ok(())
2720 }
2721
2722 2 => {
2723 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2724 slot.as_mut(),
2725 decoder,
2726 (),
2727 )?;
2728
2729 Ok(())
2730 }
2731
2732 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2733 }
2734 })
2735 }
2736 }
2737
2738 impl<'de> ExecutionStateManagerAddApplicationActivityDependencyRequest<'de> {
2739 pub fn dependency_token(
2740 &self,
2741 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2742 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2743 }
2744
2745 pub fn take_dependency_token(
2746 &mut self,
2747 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2748 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2749 }
2750
2751 pub fn power_level(&self) -> ::core::option::Option<&u8> {
2752 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2753 }
2754
2755 pub fn take_power_level(&mut self) -> ::core::option::Option<u8> {
2756 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2757 }
2758 }
2759
2760 impl<'de> ::core::fmt::Debug for ExecutionStateManagerAddApplicationActivityDependencyRequest<'de> {
2761 fn fmt(
2762 &self,
2763 f: &mut ::core::fmt::Formatter<'_>,
2764 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2765 f.debug_struct("ExecutionStateManagerAddApplicationActivityDependencyRequest")
2766 .field("dependency_token", &self.dependency_token())
2767 .field("power_level", &self.power_level())
2768 .finish()
2769 }
2770 }
2771
2772 impl<'de> ::fidl_next::IntoNatural
2773 for ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>
2774 {
2775 type Natural = crate::natural::ExecutionStateManagerAddApplicationActivityDependencyRequest;
2776 }
2777}
2778
2779pub mod wire_optional {
2780
2781 pub use fidl_next_common_fuchsia_power_system::wire_optional::*;
2782}
2783
2784pub mod generic {
2785
2786 pub use fidl_next_common_fuchsia_power_system::generic::*;
2787
2788 pub struct ActivityGovernorAcquireWakeLeaseResponse<T0> {
2790 pub token: T0,
2791 }
2792
2793 unsafe impl<___E, T0>
2794 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>
2795 for ActivityGovernorAcquireWakeLeaseResponse<T0>
2796 where
2797 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2798 ___E: ::fidl_next::fuchsia::HandleEncoder,
2799 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2800 {
2801 #[inline]
2802 fn encode(
2803 self,
2804 encoder_: &mut ___E,
2805 out_: &mut ::core::mem::MaybeUninit<
2806 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
2807 >,
2808 _: (),
2809 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2810 ::fidl_next::munge! {
2811 let crate::wire::ActivityGovernorAcquireWakeLeaseResponse {
2812 token,
2813
2814 } = out_;
2815 }
2816
2817 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2818
2819 Ok(())
2820 }
2821 }
2822
2823 unsafe impl<'a, ___E, T0>
2824 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireWakeLeaseResponse, ___E>
2825 for &'a ActivityGovernorAcquireWakeLeaseResponse<T0>
2826 where
2827 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2828 ___E: ::fidl_next::fuchsia::HandleEncoder,
2829 &'a T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2830 {
2831 #[inline]
2832 fn encode(
2833 self,
2834 encoder_: &mut ___E,
2835 out_: &mut ::core::mem::MaybeUninit<
2836 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
2837 >,
2838 _: (),
2839 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2840 ::fidl_next::munge! {
2841 let crate::wire::ActivityGovernorAcquireWakeLeaseResponse {
2842 token,
2843
2844 } = out_;
2845 }
2846
2847 ::fidl_next::Encode::encode(&self.token, encoder_, token, ())?;
2848
2849 Ok(())
2850 }
2851 }
2852
2853 pub struct ActivityGovernorRegisterSuspendBlockerResponse<T0> {
2855 pub token: T0,
2856 }
2857
2858 unsafe impl<___E, T0>
2859 ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>
2860 for ActivityGovernorRegisterSuspendBlockerResponse<T0>
2861 where
2862 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2863 ___E: ::fidl_next::fuchsia::HandleEncoder,
2864 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2865 {
2866 #[inline]
2867 fn encode(
2868 self,
2869 encoder_: &mut ___E,
2870 out_: &mut ::core::mem::MaybeUninit<
2871 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
2872 >,
2873 _: (),
2874 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2875 ::fidl_next::munge! {
2876 let crate::wire::ActivityGovernorRegisterSuspendBlockerResponse {
2877 token,
2878
2879 } = out_;
2880 }
2881
2882 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2883
2884 Ok(())
2885 }
2886 }
2887
2888 unsafe impl<'a, ___E, T0>
2889 ::fidl_next::Encode<crate::wire::ActivityGovernorRegisterSuspendBlockerResponse, ___E>
2890 for &'a ActivityGovernorRegisterSuspendBlockerResponse<T0>
2891 where
2892 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2893 ___E: ::fidl_next::fuchsia::HandleEncoder,
2894 &'a T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2895 {
2896 #[inline]
2897 fn encode(
2898 self,
2899 encoder_: &mut ___E,
2900 out_: &mut ::core::mem::MaybeUninit<
2901 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
2902 >,
2903 _: (),
2904 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2905 ::fidl_next::munge! {
2906 let crate::wire::ActivityGovernorRegisterSuspendBlockerResponse {
2907 token,
2908
2909 } = out_;
2910 }
2911
2912 ::fidl_next::Encode::encode(&self.token, encoder_, token, ())?;
2913
2914 Ok(())
2915 }
2916 }
2917
2918 pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<T0> {
2920 pub token: T0,
2921 }
2922
2923 unsafe impl<___E, T0>
2924 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, ___E>
2925 for ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<T0>
2926 where
2927 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2928 ___E: ::fidl_next::fuchsia::HandleEncoder,
2929 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2930 {
2931 #[inline]
2932 fn encode(
2933 self,
2934 encoder_: &mut ___E,
2935 out_: &mut ::core::mem::MaybeUninit<
2936 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
2937 >,
2938 _: (),
2939 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2940 ::fidl_next::munge! {
2941 let crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
2942 token,
2943
2944 } = out_;
2945 }
2946
2947 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
2948
2949 Ok(())
2950 }
2951 }
2952
2953 unsafe impl<'a, ___E, T0>
2954 ::fidl_next::Encode<crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse, ___E>
2955 for &'a ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<T0>
2956 where
2957 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2958 ___E: ::fidl_next::fuchsia::HandleEncoder,
2959 &'a T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
2960 {
2961 #[inline]
2962 fn encode(
2963 self,
2964 encoder_: &mut ___E,
2965 out_: &mut ::core::mem::MaybeUninit<
2966 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
2967 >,
2968 _: (),
2969 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2970 ::fidl_next::munge! {
2971 let crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
2972 token,
2973
2974 } = out_;
2975 }
2976
2977 ::fidl_next::Encode::encode(&self.token, encoder_, token, ())?;
2978
2979 Ok(())
2980 }
2981 }
2982
2983 pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1> {
2985 pub name: T0,
2986
2987 pub server_token: T1,
2988 }
2989
2990 unsafe impl<___E, T0, T1>
2991 ::fidl_next::Encode<
2992 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
2993 ___E,
2994 > for ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1>
2995 where
2996 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2997 ___E: ::fidl_next::Encoder,
2998 ___E: ::fidl_next::fuchsia::HandleEncoder,
2999 T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
3000 T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
3001 {
3002 #[inline]
3003 fn encode(
3004 self,
3005 encoder_: &mut ___E,
3006 out_: &mut ::core::mem::MaybeUninit<
3007 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
3008 >,
3009 _: (),
3010 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3011 ::fidl_next::munge! {
3012 let crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
3013 name,
3014 server_token,
3015
3016 } = out_;
3017 }
3018
3019 ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
3020
3021 ::fidl_next::Encode::encode(self.server_token, encoder_, server_token, ())?;
3022
3023 Ok(())
3024 }
3025 }
3026
3027 unsafe impl<'a, ___E, T0, T1>
3028 ::fidl_next::Encode<
3029 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
3030 ___E,
3031 > for &'a ActivityGovernorAcquireWakeLeaseWithTokenRequest<T0, T1>
3032 where
3033 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3034 ___E: ::fidl_next::Encoder,
3035 ___E: ::fidl_next::fuchsia::HandleEncoder,
3036 &'a T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
3037 &'a T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
3038 {
3039 #[inline]
3040 fn encode(
3041 self,
3042 encoder_: &mut ___E,
3043 out_: &mut ::core::mem::MaybeUninit<
3044 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
3045 >,
3046 _: (),
3047 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3048 ::fidl_next::munge! {
3049 let crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
3050 name,
3051 server_token,
3052
3053 } = out_;
3054 }
3055
3056 ::fidl_next::Encode::encode(&self.name, encoder_, name, 64)?;
3057
3058 ::fidl_next::Encode::encode(&self.server_token, encoder_, server_token, ())?;
3059
3060 Ok(())
3061 }
3062 }
3063
3064 pub struct ActivityGovernorTakeApplicationActivityLeaseResponse<T0> {
3066 pub token: T0,
3067 }
3068
3069 unsafe impl<___E, T0>
3070 ::fidl_next::Encode<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse, ___E>
3071 for ActivityGovernorTakeApplicationActivityLeaseResponse<T0>
3072 where
3073 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3074 ___E: ::fidl_next::fuchsia::HandleEncoder,
3075 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
3076 {
3077 #[inline]
3078 fn encode(
3079 self,
3080 encoder_: &mut ___E,
3081 out_: &mut ::core::mem::MaybeUninit<
3082 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
3083 >,
3084 _: (),
3085 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3086 ::fidl_next::munge! {
3087 let crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse {
3088 token,
3089
3090 } = out_;
3091 }
3092
3093 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
3094
3095 Ok(())
3096 }
3097 }
3098
3099 unsafe impl<'a, ___E, T0>
3100 ::fidl_next::Encode<crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse, ___E>
3101 for &'a ActivityGovernorTakeApplicationActivityLeaseResponse<T0>
3102 where
3103 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3104 ___E: ::fidl_next::fuchsia::HandleEncoder,
3105 &'a T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::EventPair, ___E>,
3106 {
3107 #[inline]
3108 fn encode(
3109 self,
3110 encoder_: &mut ___E,
3111 out_: &mut ::core::mem::MaybeUninit<
3112 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
3113 >,
3114 _: (),
3115 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3116 ::fidl_next::munge! {
3117 let crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse {
3118 token,
3119
3120 } = out_;
3121 }
3122
3123 ::fidl_next::Encode::encode(&self.token, encoder_, token, ())?;
3124
3125 Ok(())
3126 }
3127 }
3128}
3129
3130pub use self::natural::*;
3131
3132#[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"]
3134#[derive(PartialEq, Debug)]
3135pub struct ActivityGovernor;
3136
3137impl ::fidl_next::Discoverable for ActivityGovernor {
3138 const PROTOCOL_NAME: &'static str = "fuchsia.power.system.ActivityGovernor";
3139}
3140
3141#[cfg(target_os = "fuchsia")]
3142impl ::fidl_next::HasTransport for ActivityGovernor {
3143 type Transport = ::fidl_next::fuchsia::zx::Channel;
3144}
3145
3146pub mod activity_governor {
3147 pub mod prelude {
3148 pub use crate::{
3149 ActivityGovernor, ActivityGovernorClientHandler, ActivityGovernorLocalClientHandler,
3150 ActivityGovernorLocalServerHandler, ActivityGovernorServerHandler, activity_governor,
3151 };
3152
3153 pub use crate::natural::AcquireWakeLeaseError;
3154
3155 pub use crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest;
3156
3157 pub use crate::natural::ActivityGovernorAcquireWakeLease2Request;
3158
3159 pub use crate::natural::ActivityGovernorAcquireWakeLeaseRequest;
3160
3161 pub use crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenRequest;
3162
3163 pub use crate::natural::ActivityGovernorRegisterSuspendBlockerRequest;
3164
3165 pub use crate::natural::ActivityGovernorTakeApplicationActivityLeaseRequest;
3166
3167 pub use crate::natural::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse;
3168
3169 pub use crate::natural::ActivityGovernorAcquireWakeLease2Response;
3170
3171 pub use crate::natural::ActivityGovernorAcquireWakeLeaseWithTokenResponse;
3172
3173 pub use crate::natural::ActivityGovernorAcquireWakeLeaseResponse;
3174
3175 pub use crate::natural::ActivityGovernorRegisterSuspendBlockerResponse;
3176
3177 pub use crate::natural::ActivityGovernorTakeApplicationActivityLeaseResponse;
3178
3179 pub use crate::natural::PowerElements;
3180
3181 pub use crate::natural::RegisterSuspendBlockerError;
3182 }
3183
3184 pub struct GetPowerElements;
3185
3186 impl ::fidl_next::Method for GetPowerElements {
3187 const ORDINAL: u64 = 8755001135707412082;
3188 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3189 ::fidl_next::protocol::Flexibility::Flexible;
3190
3191 type Protocol = crate::ActivityGovernor;
3192
3193 type Request = ::fidl_next::wire::EmptyMessageBody;
3194 }
3195
3196 impl ::fidl_next::TwoWayMethod for GetPowerElements {
3197 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::PowerElements<'static>>;
3198 }
3199
3200 impl<___R> ::fidl_next::Respond<___R> for GetPowerElements {
3201 type Output = ::fidl_next::Flexible<___R>;
3202
3203 fn respond(response: ___R) -> Self::Output {
3204 ::fidl_next::Flexible(response)
3205 }
3206 }
3207
3208 pub struct AcquireWakeLease;
3209
3210 impl ::fidl_next::Method for AcquireWakeLease {
3211 const ORDINAL: u64 = 3306304846648819971;
3212 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3213 ::fidl_next::protocol::Flexibility::Flexible;
3214
3215 type Protocol = crate::ActivityGovernor;
3216
3217 type Request = crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'static>;
3218 }
3219
3220 impl ::fidl_next::TwoWayMethod for AcquireWakeLease {
3221 type Response = ::fidl_next::wire::Result<
3222 'static,
3223 crate::wire::ActivityGovernorAcquireWakeLeaseResponse,
3224 crate::wire::AcquireWakeLeaseError,
3225 >;
3226 }
3227
3228 impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLease {
3229 type Output = ::core::result::Result<
3230 crate::generic::ActivityGovernorAcquireWakeLeaseResponse<___R>,
3231 ::fidl_next::never::Never,
3232 >;
3233
3234 fn respond(response: ___R) -> Self::Output {
3235 ::core::result::Result::Ok(crate::generic::ActivityGovernorAcquireWakeLeaseResponse {
3236 token: response,
3237 })
3238 }
3239 }
3240
3241 impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLease {
3242 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3243
3244 fn respond_err(response: ___R) -> Self::Output {
3245 ::core::result::Result::Err(response)
3246 }
3247 }
3248
3249 pub struct AcquireUnmonitoredWakeLease;
3250
3251 impl ::fidl_next::Method for AcquireUnmonitoredWakeLease {
3252 const ORDINAL: u64 = 6877005249659825577;
3253 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3254 ::fidl_next::protocol::Flexibility::Flexible;
3255
3256 type Protocol = crate::ActivityGovernor;
3257
3258 type Request = crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'static>;
3259 }
3260
3261 impl ::fidl_next::TwoWayMethod for AcquireUnmonitoredWakeLease {
3262 type Response = ::fidl_next::wire::Result<
3263 'static,
3264 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse,
3265 crate::wire::AcquireWakeLeaseError,
3266 >;
3267 }
3268
3269 impl<___R> ::fidl_next::Respond<___R> for AcquireUnmonitoredWakeLease {
3270 type Output = ::core::result::Result<
3271 crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse<___R>,
3272 ::fidl_next::never::Never,
3273 >;
3274
3275 fn respond(response: ___R) -> Self::Output {
3276 ::core::result::Result::Ok(
3277 crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseResponse {
3278 token: response,
3279 },
3280 )
3281 }
3282 }
3283
3284 impl<___R> ::fidl_next::RespondErr<___R> for AcquireUnmonitoredWakeLease {
3285 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3286
3287 fn respond_err(response: ___R) -> Self::Output {
3288 ::core::result::Result::Err(response)
3289 }
3290 }
3291
3292 pub struct AcquireWakeLeaseWithToken;
3293
3294 impl ::fidl_next::Method for AcquireWakeLeaseWithToken {
3295 const ORDINAL: u64 = 2079869883732225873;
3296 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3297 ::fidl_next::protocol::Flexibility::Flexible;
3298
3299 type Protocol = crate::ActivityGovernor;
3300
3301 type Request = crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>;
3302 }
3303
3304 impl ::fidl_next::TwoWayMethod for AcquireWakeLeaseWithToken {
3305 type Response = ::fidl_next::wire::Result<
3306 'static,
3307 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenResponse,
3308 crate::wire::AcquireWakeLeaseError,
3309 >;
3310 }
3311
3312 impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLeaseWithToken {
3313 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
3314
3315 fn respond(response: ___R) -> Self::Output {
3316 ::core::result::Result::Ok(response)
3317 }
3318 }
3319
3320 impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLeaseWithToken {
3321 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3322
3323 fn respond_err(response: ___R) -> Self::Output {
3324 ::core::result::Result::Err(response)
3325 }
3326 }
3327
3328 pub struct AcquireWakeLease2;
3329
3330 impl ::fidl_next::Method for AcquireWakeLease2 {
3331 const ORDINAL: u64 = 498586365593251363;
3332 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3333 ::fidl_next::protocol::Flexibility::Flexible;
3334
3335 type Protocol = crate::ActivityGovernor;
3336
3337 type Request = crate::wire::ActivityGovernorAcquireWakeLease2Request<'static>;
3338 }
3339
3340 impl ::fidl_next::TwoWayMethod for AcquireWakeLease2 {
3341 type Response = ::fidl_next::wire::Result<
3342 'static,
3343 crate::wire::ActivityGovernorAcquireWakeLease2Response,
3344 crate::wire::AcquireWakeLeaseError,
3345 >;
3346 }
3347
3348 impl<___R> ::fidl_next::Respond<___R> for AcquireWakeLease2 {
3349 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
3350
3351 fn respond(response: ___R) -> Self::Output {
3352 ::core::result::Result::Ok(response)
3353 }
3354 }
3355
3356 impl<___R> ::fidl_next::RespondErr<___R> for AcquireWakeLease2 {
3357 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3358
3359 fn respond_err(response: ___R) -> Self::Output {
3360 ::core::result::Result::Err(response)
3361 }
3362 }
3363
3364 pub struct TakeApplicationActivityLease;
3365
3366 impl ::fidl_next::Method for TakeApplicationActivityLease {
3367 const ORDINAL: u64 = 4020961735006149140;
3368 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3369 ::fidl_next::protocol::Flexibility::Flexible;
3370
3371 type Protocol = crate::ActivityGovernor;
3372
3373 type Request = crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'static>;
3374 }
3375
3376 impl ::fidl_next::TwoWayMethod for TakeApplicationActivityLease {
3377 type Response = ::fidl_next::wire::Flexible<
3378 'static,
3379 crate::wire::ActivityGovernorTakeApplicationActivityLeaseResponse,
3380 >;
3381 }
3382
3383 impl<___R> ::fidl_next::Respond<___R> for TakeApplicationActivityLease {
3384 type Output = ::fidl_next::Flexible<
3385 crate::generic::ActivityGovernorTakeApplicationActivityLeaseResponse<___R>,
3386 >;
3387
3388 fn respond(response: ___R) -> Self::Output {
3389 ::fidl_next::Flexible(
3390 crate::generic::ActivityGovernorTakeApplicationActivityLeaseResponse {
3391 token: response,
3392 },
3393 )
3394 }
3395 }
3396
3397 pub struct RegisterSuspendBlocker;
3398
3399 impl ::fidl_next::Method for RegisterSuspendBlocker {
3400 const ORDINAL: u64 = 3814361630267862785;
3401 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3402 ::fidl_next::protocol::Flexibility::Flexible;
3403
3404 type Protocol = crate::ActivityGovernor;
3405
3406 type Request = crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>;
3407 }
3408
3409 impl ::fidl_next::TwoWayMethod for RegisterSuspendBlocker {
3410 type Response = ::fidl_next::wire::Result<
3411 'static,
3412 crate::wire::ActivityGovernorRegisterSuspendBlockerResponse,
3413 crate::wire::RegisterSuspendBlockerError,
3414 >;
3415 }
3416
3417 impl<___R> ::fidl_next::Respond<___R> for RegisterSuspendBlocker {
3418 type Output = ::core::result::Result<
3419 crate::generic::ActivityGovernorRegisterSuspendBlockerResponse<___R>,
3420 ::fidl_next::never::Never,
3421 >;
3422
3423 fn respond(response: ___R) -> Self::Output {
3424 ::core::result::Result::Ok(
3425 crate::generic::ActivityGovernorRegisterSuspendBlockerResponse { token: response },
3426 )
3427 }
3428 }
3429
3430 impl<___R> ::fidl_next::RespondErr<___R> for RegisterSuspendBlocker {
3431 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3432
3433 fn respond_err(response: ___R) -> Self::Output {
3434 ::core::result::Result::Err(response)
3435 }
3436 }
3437
3438 mod ___detail {
3439 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ActivityGovernor
3440 where
3441 ___T: ::fidl_next::Transport,
3442 {
3443 type Client = ActivityGovernorClient<___T>;
3444 type Server = ActivityGovernorServer<___T>;
3445 }
3446
3447 #[repr(transparent)]
3449 pub struct ActivityGovernorClient<___T: ::fidl_next::Transport> {
3450 #[allow(dead_code)]
3451 client: ::fidl_next::protocol::Client<___T>,
3452 }
3453
3454 impl<___T> ActivityGovernorClient<___T>
3455 where
3456 ___T: ::fidl_next::Transport,
3457 {
3458 #[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"]
3459 pub fn get_power_elements(
3460 &self,
3461 ) -> ::fidl_next::TwoWayFuture<'_, super::GetPowerElements, ___T> {
3462 ::fidl_next::TwoWayFuture::from_untyped(
3463 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
3464 8755001135707412082,
3465 <super::GetPowerElements as ::fidl_next::Method>::FLEXIBILITY,
3466 (),
3467 ),
3468 )
3469 }
3470
3471 #[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"]
3472 pub fn acquire_wake_lease(
3473 &self,
3474
3475 name: impl ::fidl_next::Encode<
3476 ::fidl_next::wire::String<'static>,
3477 <___T as ::fidl_next::Transport>::SendBuffer,
3478 >,
3479 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease, ___T>
3480 where
3481 <___T as ::fidl_next::Transport>::SendBuffer:
3482 ::fidl_next::encoder::InternalHandleEncoder,
3483 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
3484 {
3485 self.acquire_wake_lease_with(
3486 crate::generic::ActivityGovernorAcquireWakeLeaseRequest { name },
3487 )
3488 }
3489
3490 #[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"]
3491 pub fn acquire_wake_lease_with<___R>(
3492 &self,
3493 request: ___R,
3494 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease, ___T>
3495 where
3496 ___R: ::fidl_next::Encode<
3497 crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'static>,
3498 <___T as ::fidl_next::Transport>::SendBuffer,
3499 >,
3500 {
3501 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3502 3306304846648819971,
3503 <super::AcquireWakeLease as ::fidl_next::Method>::FLEXIBILITY,
3504 request,
3505 ))
3506 }
3507
3508 #[doc = " Creates an unmonitored lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n\n This is intended for leases expected to be held for extended periods.\n Unlike normal wake leases, the server does not monitor the duration\n of an unmonitored wake lease and will not file a crash report if it exceeds\n preconfigured alert thresholds.\n"]
3509 pub fn acquire_unmonitored_wake_lease(
3510 &self,
3511
3512 name: impl ::fidl_next::Encode<
3513 ::fidl_next::wire::String<'static>,
3514 <___T as ::fidl_next::Transport>::SendBuffer,
3515 >,
3516 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireUnmonitoredWakeLease, ___T>
3517 where
3518 <___T as ::fidl_next::Transport>::SendBuffer:
3519 ::fidl_next::encoder::InternalHandleEncoder,
3520 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
3521 {
3522 self.acquire_unmonitored_wake_lease_with(
3523 crate::generic::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest { name },
3524 )
3525 }
3526
3527 #[doc = " Creates an unmonitored lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n\n This is intended for leases expected to be held for extended periods.\n Unlike normal wake leases, the server does not monitor the duration\n of an unmonitored wake lease and will not file a crash report if it exceeds\n preconfigured alert thresholds.\n"]
3528 pub fn acquire_unmonitored_wake_lease_with<___R>(
3529 &self,
3530 request: ___R,
3531 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireUnmonitoredWakeLease, ___T>
3532 where
3533 ___R: ::fidl_next::Encode<
3534 crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'static>,
3535 <___T as ::fidl_next::Transport>::SendBuffer,
3536 >,
3537 {
3538 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3539 6877005249659825577,
3540 <super::AcquireUnmonitoredWakeLease as ::fidl_next::Method>::FLEXIBILITY,
3541 request,
3542 ))
3543 }
3544
3545 #[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"]
3546 pub fn acquire_wake_lease_with_token(
3547 &self,
3548
3549 name: impl ::fidl_next::Encode<
3550 ::fidl_next::wire::String<'static>,
3551 <___T as ::fidl_next::Transport>::SendBuffer,
3552 >,
3553
3554 server_token: impl ::fidl_next::Encode<
3555 ::fidl_next::wire::fuchsia::EventPair,
3556 <___T as ::fidl_next::Transport>::SendBuffer,
3557 >,
3558 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLeaseWithToken, ___T>
3559 where
3560 <___T as ::fidl_next::Transport>::SendBuffer:
3561 ::fidl_next::encoder::InternalHandleEncoder,
3562 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
3563 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3564 {
3565 self.acquire_wake_lease_with_token_with(
3566 crate::generic::ActivityGovernorAcquireWakeLeaseWithTokenRequest {
3567 name,
3568
3569 server_token,
3570 },
3571 )
3572 }
3573
3574 #[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"]
3575 pub fn acquire_wake_lease_with_token_with<___R>(
3576 &self,
3577 request: ___R,
3578 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLeaseWithToken, ___T>
3579 where
3580 ___R: ::fidl_next::Encode<
3581 crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'static>,
3582 <___T as ::fidl_next::Transport>::SendBuffer,
3583 >,
3584 {
3585 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3586 2079869883732225873,
3587 <super::AcquireWakeLeaseWithToken as ::fidl_next::Method>::FLEXIBILITY,
3588 request,
3589 ))
3590 }
3591
3592 #[doc = " Creates a lease that blocks suspension of the hardware platform, optionally\n associating it with a predecessor lease (`previous_client_token`).\n\n WARNING: Suspension can only be considered blocked after the client\n receives the response to this call, unless `previous_client_token` is\n provided and actively blocking suspension. When `previous_client_token`\n is provided, SAG retains the `previous_client_token` handle until the new\n wake lease is registered to prevent suspension.\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"]
3593 pub fn acquire_wake_lease2_with<___R>(
3594 &self,
3595 request: ___R,
3596 ) -> ::fidl_next::TwoWayFuture<'_, super::AcquireWakeLease2, ___T>
3597 where
3598 ___R: ::fidl_next::Encode<
3599 crate::wire::ActivityGovernorAcquireWakeLease2Request<'static>,
3600 <___T as ::fidl_next::Transport>::SendBuffer,
3601 >,
3602 {
3603 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3604 498586365593251363,
3605 <super::AcquireWakeLease2 as ::fidl_next::Method>::FLEXIBILITY,
3606 request,
3607 ))
3608 }
3609
3610 #[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"]
3611 pub fn take_application_activity_lease(
3612 &self,
3613
3614 name: impl ::fidl_next::Encode<
3615 ::fidl_next::wire::String<'static>,
3616 <___T as ::fidl_next::Transport>::SendBuffer,
3617 >,
3618 ) -> ::fidl_next::TwoWayFuture<'_, super::TakeApplicationActivityLease, ___T>
3619 where
3620 <___T as ::fidl_next::Transport>::SendBuffer:
3621 ::fidl_next::encoder::InternalHandleEncoder,
3622 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
3623 {
3624 self.take_application_activity_lease_with(
3625 crate::generic::ActivityGovernorTakeApplicationActivityLeaseRequest { name },
3626 )
3627 }
3628
3629 #[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"]
3630 pub fn take_application_activity_lease_with<___R>(
3631 &self,
3632 request: ___R,
3633 ) -> ::fidl_next::TwoWayFuture<'_, super::TakeApplicationActivityLease, ___T>
3634 where
3635 ___R: ::fidl_next::Encode<
3636 crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'static>,
3637 <___T as ::fidl_next::Transport>::SendBuffer,
3638 >,
3639 {
3640 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3641 4020961735006149140,
3642 <super::TakeApplicationActivityLease as ::fidl_next::Method>::FLEXIBILITY,
3643 request,
3644 ))
3645 }
3646
3647 #[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"]
3648 pub fn register_suspend_blocker_with<___R>(
3649 &self,
3650 request: ___R,
3651 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterSuspendBlocker, ___T>
3652 where
3653 ___R: ::fidl_next::Encode<
3654 crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'static>,
3655 <___T as ::fidl_next::Transport>::SendBuffer,
3656 >,
3657 {
3658 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3659 3814361630267862785,
3660 <super::RegisterSuspendBlocker as ::fidl_next::Method>::FLEXIBILITY,
3661 request,
3662 ))
3663 }
3664 }
3665
3666 #[repr(transparent)]
3668 pub struct ActivityGovernorServer<___T: ::fidl_next::Transport> {
3669 server: ::fidl_next::protocol::Server<___T>,
3670 }
3671
3672 impl<___T> ActivityGovernorServer<___T> where ___T: ::fidl_next::Transport {}
3673 }
3674}
3675
3676#[diagnostic::on_unimplemented(
3677 note = "If {Self} implements the non-local ActivityGovernorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3678)]
3679
3680pub trait ActivityGovernorLocalClientHandler<
3684 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3685 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3686>
3687{
3688 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3689 ::core::future::ready(())
3690 }
3691}
3692
3693impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ActivityGovernor
3694where
3695 ___H: ActivityGovernorLocalClientHandler<___T>,
3696 ___T: ::fidl_next::Transport,
3697{
3698 async fn on_event(
3699 handler: &mut ___H,
3700 mut message: ::fidl_next::Message<___T>,
3701 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3702 match *message.header().ordinal {
3703 ordinal => {
3704 handler.on_unknown_interaction(ordinal).await;
3705 if ::core::matches!(
3706 message.header().flexibility(),
3707 ::fidl_next::protocol::Flexibility::Strict
3708 ) {
3709 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3710 } else {
3711 Ok(())
3712 }
3713 }
3714 }
3715 }
3716}
3717
3718#[diagnostic::on_unimplemented(
3719 note = "If {Self} implements the non-local ActivityGovernorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3720)]
3721
3722pub trait ActivityGovernorLocalServerHandler<
3726 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3727 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3728>
3729{
3730 #[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"]
3731 fn get_power_elements(
3732 &mut self,
3733
3734 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
3735 ) -> impl ::core::future::Future<Output = ()>;
3736
3737 #[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"]
3738 fn acquire_wake_lease(
3739 &mut self,
3740
3741 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
3742
3743 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
3744 ) -> impl ::core::future::Future<Output = ()>;
3745
3746 #[doc = " Creates an unmonitored lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n\n This is intended for leases expected to be held for extended periods.\n Unlike normal wake leases, the server does not monitor the duration\n of an unmonitored wake lease and will not file a crash report if it exceeds\n preconfigured alert thresholds.\n"]
3747 fn acquire_unmonitored_wake_lease(
3748 &mut self,
3749
3750 request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3751
3752 responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
3753 ) -> impl ::core::future::Future<Output = ()>;
3754
3755 #[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"]
3756 fn acquire_wake_lease_with_token(
3757 &mut self,
3758
3759 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3760
3761 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
3762 ) -> impl ::core::future::Future<Output = ()>;
3763
3764 #[doc = " Creates a lease that blocks suspension of the hardware platform, optionally\n associating it with a predecessor lease (`previous_client_token`).\n\n WARNING: Suspension can only be considered blocked after the client\n receives the response to this call, unless `previous_client_token` is\n provided and actively blocking suspension. When `previous_client_token`\n is provided, SAG retains the `previous_client_token` handle until the new\n wake lease is registered to prevent suspension.\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"]
3765 fn acquire_wake_lease2(
3766 &mut self,
3767
3768 request: ::fidl_next::Request<activity_governor::AcquireWakeLease2, ___T>,
3769
3770 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease2, ___T>,
3771 ) -> impl ::core::future::Future<Output = ()>;
3772
3773 #[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"]
3774 fn take_application_activity_lease(
3775 &mut self,
3776
3777 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
3778
3779 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
3780 ) -> impl ::core::future::Future<Output = ()>;
3781
3782 #[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"]
3783 fn register_suspend_blocker(
3784 &mut self,
3785
3786 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
3787
3788 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
3789 ) -> impl ::core::future::Future<Output = ()>;
3790
3791 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3792 ::core::future::ready(())
3793 }
3794}
3795
3796impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ActivityGovernor
3797where
3798 ___H: ActivityGovernorLocalServerHandler<___T> ,
3799 ___T: ::fidl_next::Transport,
3800
3801
3802
3803
3804 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'de>: ::fidl_next::Decode<
3805 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3806 Constraint = (),
3807 >,
3808
3809
3810
3811 for<'de> crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'de>: ::fidl_next::Decode<
3812 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3813 Constraint = (),
3814 >,
3815
3816
3817
3818 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>: ::fidl_next::Decode<
3819 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3820 Constraint = (),
3821 >,
3822
3823
3824
3825 for<'de> crate::wire::ActivityGovernorAcquireWakeLease2Request<'de>: ::fidl_next::Decode<
3826 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3827 Constraint = (),
3828 >,
3829
3830
3831
3832 for<'de> crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'de>: ::fidl_next::Decode<
3833 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3834 Constraint = (),
3835 >,
3836
3837
3838
3839 for<'de> crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>: ::fidl_next::Decode<
3840 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3841 Constraint = (),
3842 >,
3843
3844
3845{
3846 async fn on_one_way(
3847 handler: &mut ___H,
3848 mut message: ::fidl_next::Message<___T>,
3849 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3850 match *message.header().ordinal {
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873 ordinal => {
3874
3875 handler.on_unknown_interaction(ordinal).await;
3876 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
3877 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3878 } else {
3879 Ok(())
3880 }
3881
3882 }
3883 }
3884 }
3885
3886 async fn on_two_way(
3887 handler: &mut ___H,
3888 mut message: ::fidl_next::Message<___T>,
3889 responder: ::fidl_next::protocol::Responder<___T>,
3890 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
3891 match *message.header().ordinal {
3892
3893
3894
3895 8755001135707412082 => {
3896 let responder = ::fidl_next::Responder::from_untyped(responder);
3897
3898 handler.get_power_elements(responder).await;
3899 Ok(())
3900
3901 }
3902
3903
3904
3905
3906 3306304846648819971 => {
3907 let responder = ::fidl_next::Responder::from_untyped(responder);
3908
3909 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3910 Ok(decoded) => {
3911 handler.acquire_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3912 Ok(())
3913 }
3914 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3915 ordinal: 3306304846648819971,
3916 error,
3917 }),
3918 }
3919
3920 }
3921
3922
3923
3924
3925 6877005249659825577 => {
3926 let responder = ::fidl_next::Responder::from_untyped(responder);
3927
3928 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3929 Ok(decoded) => {
3930 handler.acquire_unmonitored_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3931 Ok(())
3932 }
3933 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3934 ordinal: 6877005249659825577,
3935 error,
3936 }),
3937 }
3938
3939 }
3940
3941
3942
3943
3944 2079869883732225873 => {
3945 let responder = ::fidl_next::Responder::from_untyped(responder);
3946
3947 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3948 Ok(decoded) => {
3949 handler.acquire_wake_lease_with_token(::fidl_next::Request::from_decoded(decoded), responder).await;
3950 Ok(())
3951 }
3952 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3953 ordinal: 2079869883732225873,
3954 error,
3955 }),
3956 }
3957
3958 }
3959
3960
3961
3962
3963 498586365593251363 => {
3964 let responder = ::fidl_next::Responder::from_untyped(responder);
3965
3966 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3967 Ok(decoded) => {
3968 handler.acquire_wake_lease2(::fidl_next::Request::from_decoded(decoded), responder).await;
3969 Ok(())
3970 }
3971 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3972 ordinal: 498586365593251363,
3973 error,
3974 }),
3975 }
3976
3977 }
3978
3979
3980
3981
3982 4020961735006149140 => {
3983 let responder = ::fidl_next::Responder::from_untyped(responder);
3984
3985 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3986 Ok(decoded) => {
3987 handler.take_application_activity_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
3988 Ok(())
3989 }
3990 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3991 ordinal: 4020961735006149140,
3992 error,
3993 }),
3994 }
3995
3996 }
3997
3998
3999
4000
4001 3814361630267862785 => {
4002 let responder = ::fidl_next::Responder::from_untyped(responder);
4003
4004 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4005 Ok(decoded) => {
4006 handler.register_suspend_blocker(::fidl_next::Request::from_decoded(decoded), responder).await;
4007 Ok(())
4008 }
4009 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4010 ordinal: 3814361630267862785,
4011 error,
4012 }),
4013 }
4014
4015 }
4016
4017
4018 ordinal => {
4019
4020 handler.on_unknown_interaction(ordinal).await;
4021 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4022 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4023 } else {
4024 responder.respond_framework_error(
4025 ordinal,
4026 ::fidl_next::FrameworkError::UnknownMethod,
4027 )
4028 .expect("encoding a framework error should never fail")
4029 .await?;
4030 Ok(())
4031 }
4032
4033 }
4034 }
4035 }
4036}
4037
4038pub trait ActivityGovernorClientHandler<
4042 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4043 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4044>
4045{
4046 fn on_unknown_interaction(
4047 &mut self,
4048 ordinal: u64,
4049 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4050 ::core::future::ready(())
4051 }
4052}
4053
4054impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ActivityGovernor
4055where
4056 ___H: ActivityGovernorClientHandler<___T> + ::core::marker::Send,
4057 ___T: ::fidl_next::Transport,
4058{
4059 async fn on_event(
4060 handler: &mut ___H,
4061 mut message: ::fidl_next::Message<___T>,
4062 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4063 match *message.header().ordinal {
4064 ordinal => {
4065 handler.on_unknown_interaction(ordinal).await;
4066 if ::core::matches!(
4067 message.header().flexibility(),
4068 ::fidl_next::protocol::Flexibility::Strict
4069 ) {
4070 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4071 } else {
4072 Ok(())
4073 }
4074 }
4075 }
4076 }
4077}
4078
4079pub trait ActivityGovernorServerHandler<
4083 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4084 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4085>
4086{
4087 #[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"]
4088 fn get_power_elements(
4089 &mut self,
4090
4091 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
4092 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4093
4094 #[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"]
4095 fn acquire_wake_lease(
4096 &mut self,
4097
4098 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
4099
4100 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
4101 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4102
4103 #[doc = " Creates an unmonitored lease that blocks suspension of the hardware platform.\n\n The hardware platform will not suspend as long as a valid\n [`LeaseToken`] exists.\n\n This is intended for leases expected to be held for extended periods.\n Unlike normal wake leases, the server does not monitor the duration\n of an unmonitored wake lease and will not file a crash report if it exceeds\n preconfigured alert thresholds.\n"]
4104 fn acquire_unmonitored_wake_lease(
4105 &mut self,
4106
4107 request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
4108
4109 responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
4110 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4111
4112 #[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"]
4113 fn acquire_wake_lease_with_token(
4114 &mut self,
4115
4116 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
4117
4118 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
4119 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4120
4121 #[doc = " Creates a lease that blocks suspension of the hardware platform, optionally\n associating it with a predecessor lease (`previous_client_token`).\n\n WARNING: Suspension can only be considered blocked after the client\n receives the response to this call, unless `previous_client_token` is\n provided and actively blocking suspension. When `previous_client_token`\n is provided, SAG retains the `previous_client_token` handle until the new\n wake lease is registered to prevent suspension.\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"]
4122 fn acquire_wake_lease2(
4123 &mut self,
4124
4125 request: ::fidl_next::Request<activity_governor::AcquireWakeLease2, ___T>,
4126
4127 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease2, ___T>,
4128 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4129
4130 #[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"]
4131 fn take_application_activity_lease(
4132 &mut self,
4133
4134 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
4135
4136 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
4137 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4138
4139 #[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"]
4140 fn register_suspend_blocker(
4141 &mut self,
4142
4143 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
4144
4145 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___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 ActivityGovernor
4157where
4158 ___H: ActivityGovernorServerHandler<___T> + ::core::marker::Send,
4159 ___T: ::fidl_next::Transport,
4160
4161
4162
4163
4164 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseRequest<'de>: ::fidl_next::Decode<
4165 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4166 Constraint = (),
4167 >,
4168
4169
4170
4171 for<'de> crate::wire::ActivityGovernorAcquireUnmonitoredWakeLeaseRequest<'de>: ::fidl_next::Decode<
4172 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4173 Constraint = (),
4174 >,
4175
4176
4177
4178 for<'de> crate::wire::ActivityGovernorAcquireWakeLeaseWithTokenRequest<'de>: ::fidl_next::Decode<
4179 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4180 Constraint = (),
4181 >,
4182
4183
4184
4185 for<'de> crate::wire::ActivityGovernorAcquireWakeLease2Request<'de>: ::fidl_next::Decode<
4186 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4187 Constraint = (),
4188 >,
4189
4190
4191
4192 for<'de> crate::wire::ActivityGovernorTakeApplicationActivityLeaseRequest<'de>: ::fidl_next::Decode<
4193 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4194 Constraint = (),
4195 >,
4196
4197
4198
4199 for<'de> crate::wire::ActivityGovernorRegisterSuspendBlockerRequest<'de>: ::fidl_next::Decode<
4200 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4201 Constraint = (),
4202 >,
4203
4204
4205{
4206 async fn on_one_way(
4207 handler: &mut ___H,
4208 mut message: ::fidl_next::Message<___T>,
4209 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4210 match *message.header().ordinal {
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233 ordinal => {
4234
4235 handler.on_unknown_interaction(ordinal).await;
4236 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4237 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4238 } else {
4239 Ok(())
4240 }
4241
4242 }
4243 }
4244 }
4245
4246 async fn on_two_way(
4247 handler: &mut ___H,
4248 mut message: ::fidl_next::Message<___T>,
4249 responder: ::fidl_next::protocol::Responder<___T>,
4250 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4251 match *message.header().ordinal {
4252
4253
4254
4255 8755001135707412082 => {
4256 let responder = ::fidl_next::Responder::from_untyped(responder);
4257
4258 handler.get_power_elements(responder).await;
4259 Ok(())
4260
4261 }
4262
4263
4264
4265
4266 3306304846648819971 => {
4267 let responder = ::fidl_next::Responder::from_untyped(responder);
4268
4269 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4270 Ok(decoded) => {
4271 handler.acquire_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
4272 Ok(())
4273 }
4274 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4275 ordinal: 3306304846648819971,
4276 error,
4277 }),
4278 }
4279
4280 }
4281
4282
4283
4284
4285 6877005249659825577 => {
4286 let responder = ::fidl_next::Responder::from_untyped(responder);
4287
4288 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4289 Ok(decoded) => {
4290 handler.acquire_unmonitored_wake_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
4291 Ok(())
4292 }
4293 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4294 ordinal: 6877005249659825577,
4295 error,
4296 }),
4297 }
4298
4299 }
4300
4301
4302
4303
4304 2079869883732225873 => {
4305 let responder = ::fidl_next::Responder::from_untyped(responder);
4306
4307 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4308 Ok(decoded) => {
4309 handler.acquire_wake_lease_with_token(::fidl_next::Request::from_decoded(decoded), responder).await;
4310 Ok(())
4311 }
4312 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4313 ordinal: 2079869883732225873,
4314 error,
4315 }),
4316 }
4317
4318 }
4319
4320
4321
4322
4323 498586365593251363 => {
4324 let responder = ::fidl_next::Responder::from_untyped(responder);
4325
4326 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4327 Ok(decoded) => {
4328 handler.acquire_wake_lease2(::fidl_next::Request::from_decoded(decoded), responder).await;
4329 Ok(())
4330 }
4331 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4332 ordinal: 498586365593251363,
4333 error,
4334 }),
4335 }
4336
4337 }
4338
4339
4340
4341
4342 4020961735006149140 => {
4343 let responder = ::fidl_next::Responder::from_untyped(responder);
4344
4345 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4346 Ok(decoded) => {
4347 handler.take_application_activity_lease(::fidl_next::Request::from_decoded(decoded), responder).await;
4348 Ok(())
4349 }
4350 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4351 ordinal: 4020961735006149140,
4352 error,
4353 }),
4354 }
4355
4356 }
4357
4358
4359
4360
4361 3814361630267862785 => {
4362 let responder = ::fidl_next::Responder::from_untyped(responder);
4363
4364 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4365 Ok(decoded) => {
4366 handler.register_suspend_blocker(::fidl_next::Request::from_decoded(decoded), responder).await;
4367 Ok(())
4368 }
4369 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4370 ordinal: 3814361630267862785,
4371 error,
4372 }),
4373 }
4374
4375 }
4376
4377
4378 ordinal => {
4379
4380 handler.on_unknown_interaction(ordinal).await;
4381 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4382 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4383 } else {
4384 responder.respond_framework_error(
4385 ordinal,
4386 ::fidl_next::FrameworkError::UnknownMethod,
4387 )
4388 .expect("encoding a framework error should never fail")
4389 .await?;
4390 Ok(())
4391 }
4392
4393 }
4394 }
4395 }
4396}
4397
4398impl<___T> ActivityGovernorClientHandler<___T> for ::fidl_next::IgnoreEvents
4399where
4400 ___T: ::fidl_next::Transport,
4401{
4402 async fn on_unknown_interaction(&mut self, _: u64) {}
4403}
4404
4405impl<___H, ___T> ActivityGovernorLocalClientHandler<___T> for ::fidl_next::Local<___H>
4406where
4407 ___H: ActivityGovernorClientHandler<___T>,
4408 ___T: ::fidl_next::Transport,
4409{
4410 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4411 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4412 }
4413}
4414
4415impl<___H, ___T> ActivityGovernorLocalServerHandler<___T> for ::fidl_next::Local<___H>
4416where
4417 ___H: ActivityGovernorServerHandler<___T>,
4418 ___T: ::fidl_next::Transport,
4419{
4420 async fn get_power_elements(
4421 &mut self,
4422
4423 responder: ::fidl_next::Responder<activity_governor::GetPowerElements, ___T>,
4424 ) {
4425 ___H::get_power_elements(&mut self.0, responder).await
4426 }
4427
4428 async fn acquire_wake_lease(
4429 &mut self,
4430
4431 request: ::fidl_next::Request<activity_governor::AcquireWakeLease, ___T>,
4432
4433 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease, ___T>,
4434 ) {
4435 ___H::acquire_wake_lease(&mut self.0, request, responder).await
4436 }
4437
4438 async fn acquire_unmonitored_wake_lease(
4439 &mut self,
4440
4441 request: ::fidl_next::Request<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
4442
4443 responder: ::fidl_next::Responder<activity_governor::AcquireUnmonitoredWakeLease, ___T>,
4444 ) {
4445 ___H::acquire_unmonitored_wake_lease(&mut self.0, request, responder).await
4446 }
4447
4448 async fn acquire_wake_lease_with_token(
4449 &mut self,
4450
4451 request: ::fidl_next::Request<activity_governor::AcquireWakeLeaseWithToken, ___T>,
4452
4453 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLeaseWithToken, ___T>,
4454 ) {
4455 ___H::acquire_wake_lease_with_token(&mut self.0, request, responder).await
4456 }
4457
4458 async fn acquire_wake_lease2(
4459 &mut self,
4460
4461 request: ::fidl_next::Request<activity_governor::AcquireWakeLease2, ___T>,
4462
4463 responder: ::fidl_next::Responder<activity_governor::AcquireWakeLease2, ___T>,
4464 ) {
4465 ___H::acquire_wake_lease2(&mut self.0, request, responder).await
4466 }
4467
4468 async fn take_application_activity_lease(
4469 &mut self,
4470
4471 request: ::fidl_next::Request<activity_governor::TakeApplicationActivityLease, ___T>,
4472
4473 responder: ::fidl_next::Responder<activity_governor::TakeApplicationActivityLease, ___T>,
4474 ) {
4475 ___H::take_application_activity_lease(&mut self.0, request, responder).await
4476 }
4477
4478 async fn register_suspend_blocker(
4479 &mut self,
4480
4481 request: ::fidl_next::Request<activity_governor::RegisterSuspendBlocker, ___T>,
4482
4483 responder: ::fidl_next::Responder<activity_governor::RegisterSuspendBlocker, ___T>,
4484 ) {
4485 ___H::register_suspend_blocker(&mut self.0, request, responder).await
4486 }
4487
4488 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4489 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4490 }
4491}
4492
4493#[doc = " A service that provides access to CPU-related power elements.\n"]
4495#[derive(PartialEq, Debug)]
4496pub struct CpuElementManager;
4497
4498impl ::fidl_next::Discoverable for CpuElementManager {
4499 const PROTOCOL_NAME: &'static str = "fuchsia.power.system.CpuElementManager";
4500}
4501
4502#[cfg(target_os = "fuchsia")]
4503impl ::fidl_next::HasTransport for CpuElementManager {
4504 type Transport = ::fidl_next::fuchsia::zx::Channel;
4505}
4506
4507pub mod cpu_element_manager {
4508 pub mod prelude {
4509 pub use crate::{
4510 CpuElementManager, CpuElementManagerClientHandler, CpuElementManagerLocalClientHandler,
4511 CpuElementManagerLocalServerHandler, CpuElementManagerServerHandler,
4512 cpu_element_manager,
4513 };
4514
4515 pub use crate::natural::AddExecutionStateDependencyError;
4516
4517 pub use crate::natural::Cpu;
4518
4519 pub use crate::natural::CpuElementManagerAddExecutionStateDependencyRequest;
4520
4521 pub use crate::natural::CpuElementManagerAddExecutionStateDependencyResponse;
4522 }
4523
4524 pub struct GetCpuDependencyToken;
4525
4526 impl ::fidl_next::Method for GetCpuDependencyToken {
4527 const ORDINAL: u64 = 3189503319605462202;
4528 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4529 ::fidl_next::protocol::Flexibility::Flexible;
4530
4531 type Protocol = crate::CpuElementManager;
4532
4533 type Request = ::fidl_next::wire::EmptyMessageBody;
4534 }
4535
4536 impl ::fidl_next::TwoWayMethod for GetCpuDependencyToken {
4537 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::Cpu<'static>>;
4538 }
4539
4540 impl<___R> ::fidl_next::Respond<___R> for GetCpuDependencyToken {
4541 type Output = ::fidl_next::Flexible<___R>;
4542
4543 fn respond(response: ___R) -> Self::Output {
4544 ::fidl_next::Flexible(response)
4545 }
4546 }
4547
4548 pub struct AddExecutionStateDependency;
4549
4550 impl ::fidl_next::Method for AddExecutionStateDependency {
4551 const ORDINAL: u64 = 1005136052949049908;
4552 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4553 ::fidl_next::protocol::Flexibility::Flexible;
4554
4555 type Protocol = crate::CpuElementManager;
4556
4557 type Request = crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>;
4558 }
4559
4560 impl ::fidl_next::TwoWayMethod for AddExecutionStateDependency {
4561 type Response = ::fidl_next::wire::Result<
4562 'static,
4563 crate::wire::CpuElementManagerAddExecutionStateDependencyResponse,
4564 crate::wire::AddExecutionStateDependencyError,
4565 >;
4566 }
4567
4568 impl<___R> ::fidl_next::Respond<___R> for AddExecutionStateDependency {
4569 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
4570
4571 fn respond(response: ___R) -> Self::Output {
4572 ::core::result::Result::Ok(response)
4573 }
4574 }
4575
4576 impl<___R> ::fidl_next::RespondErr<___R> for AddExecutionStateDependency {
4577 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
4578
4579 fn respond_err(response: ___R) -> Self::Output {
4580 ::core::result::Result::Err(response)
4581 }
4582 }
4583
4584 mod ___detail {
4585 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::CpuElementManager
4586 where
4587 ___T: ::fidl_next::Transport,
4588 {
4589 type Client = CpuElementManagerClient<___T>;
4590 type Server = CpuElementManagerServer<___T>;
4591 }
4592
4593 #[repr(transparent)]
4595 pub struct CpuElementManagerClient<___T: ::fidl_next::Transport> {
4596 #[allow(dead_code)]
4597 client: ::fidl_next::protocol::Client<___T>,
4598 }
4599
4600 impl<___T> CpuElementManagerClient<___T>
4601 where
4602 ___T: ::fidl_next::Transport,
4603 {
4604 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
4605 pub fn get_cpu_dependency_token(
4606 &self,
4607 ) -> ::fidl_next::TwoWayFuture<'_, super::GetCpuDependencyToken, ___T> {
4608 ::fidl_next::TwoWayFuture::from_untyped(
4609 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4610 3189503319605462202,
4611 <super::GetCpuDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
4612 (),
4613 ),
4614 )
4615 }
4616
4617 #[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"]
4618 pub fn add_execution_state_dependency_with<___R>(
4619 &self,
4620 request: ___R,
4621 ) -> ::fidl_next::TwoWayFuture<'_, super::AddExecutionStateDependency, ___T>
4622 where
4623 ___R: ::fidl_next::Encode<
4624 crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'static>,
4625 <___T as ::fidl_next::Transport>::SendBuffer,
4626 >,
4627 {
4628 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
4629 1005136052949049908,
4630 <super::AddExecutionStateDependency as ::fidl_next::Method>::FLEXIBILITY,
4631 request,
4632 ))
4633 }
4634 }
4635
4636 #[repr(transparent)]
4638 pub struct CpuElementManagerServer<___T: ::fidl_next::Transport> {
4639 server: ::fidl_next::protocol::Server<___T>,
4640 }
4641
4642 impl<___T> CpuElementManagerServer<___T> where ___T: ::fidl_next::Transport {}
4643 }
4644}
4645
4646#[diagnostic::on_unimplemented(
4647 note = "If {Self} implements the non-local CpuElementManagerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4648)]
4649
4650pub trait CpuElementManagerLocalClientHandler<
4654 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4655 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4656>
4657{
4658 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4659 ::core::future::ready(())
4660 }
4661}
4662
4663impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for CpuElementManager
4664where
4665 ___H: CpuElementManagerLocalClientHandler<___T>,
4666 ___T: ::fidl_next::Transport,
4667{
4668 async fn on_event(
4669 handler: &mut ___H,
4670 mut message: ::fidl_next::Message<___T>,
4671 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4672 match *message.header().ordinal {
4673 ordinal => {
4674 handler.on_unknown_interaction(ordinal).await;
4675 if ::core::matches!(
4676 message.header().flexibility(),
4677 ::fidl_next::protocol::Flexibility::Strict
4678 ) {
4679 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4680 } else {
4681 Ok(())
4682 }
4683 }
4684 }
4685 }
4686}
4687
4688#[diagnostic::on_unimplemented(
4689 note = "If {Self} implements the non-local CpuElementManagerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4690)]
4691
4692pub trait CpuElementManagerLocalServerHandler<
4696 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4697 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4698>
4699{
4700 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
4701 fn get_cpu_dependency_token(
4702 &mut self,
4703
4704 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
4705 ) -> impl ::core::future::Future<Output = ()>;
4706
4707 #[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"]
4708 fn add_execution_state_dependency(
4709 &mut self,
4710
4711 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
4712
4713 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
4714 ) -> impl ::core::future::Future<Output = ()>;
4715
4716 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4717 ::core::future::ready(())
4718 }
4719}
4720
4721impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for CpuElementManager
4722where
4723 ___H: CpuElementManagerLocalServerHandler<___T> ,
4724 ___T: ::fidl_next::Transport,
4725
4726
4727
4728
4729 for<'de> crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>: ::fidl_next::Decode<
4730 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4731 Constraint = (),
4732 >,
4733
4734
4735{
4736 async fn on_one_way(
4737 handler: &mut ___H,
4738 mut message: ::fidl_next::Message<___T>,
4739 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4740 match *message.header().ordinal {
4741
4742
4743
4744
4745
4746
4747
4748 ordinal => {
4749
4750 handler.on_unknown_interaction(ordinal).await;
4751 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4752 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4753 } else {
4754 Ok(())
4755 }
4756
4757 }
4758 }
4759 }
4760
4761 async fn on_two_way(
4762 handler: &mut ___H,
4763 mut message: ::fidl_next::Message<___T>,
4764 responder: ::fidl_next::protocol::Responder<___T>,
4765 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4766 match *message.header().ordinal {
4767
4768
4769
4770 3189503319605462202 => {
4771 let responder = ::fidl_next::Responder::from_untyped(responder);
4772
4773 handler.get_cpu_dependency_token(responder).await;
4774 Ok(())
4775
4776 }
4777
4778
4779
4780
4781 1005136052949049908 => {
4782 let responder = ::fidl_next::Responder::from_untyped(responder);
4783
4784 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4785 Ok(decoded) => {
4786 handler.add_execution_state_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
4787 Ok(())
4788 }
4789 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4790 ordinal: 1005136052949049908,
4791 error,
4792 }),
4793 }
4794
4795 }
4796
4797
4798 ordinal => {
4799
4800 handler.on_unknown_interaction(ordinal).await;
4801 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4802 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4803 } else {
4804 responder.respond_framework_error(
4805 ordinal,
4806 ::fidl_next::FrameworkError::UnknownMethod,
4807 )
4808 .expect("encoding a framework error should never fail")
4809 .await?;
4810 Ok(())
4811 }
4812
4813 }
4814 }
4815 }
4816}
4817
4818pub trait CpuElementManagerClientHandler<
4822 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4823 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4824>
4825{
4826 fn on_unknown_interaction(
4827 &mut self,
4828 ordinal: u64,
4829 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4830 ::core::future::ready(())
4831 }
4832}
4833
4834impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for CpuElementManager
4835where
4836 ___H: CpuElementManagerClientHandler<___T> + ::core::marker::Send,
4837 ___T: ::fidl_next::Transport,
4838{
4839 async fn on_event(
4840 handler: &mut ___H,
4841 mut message: ::fidl_next::Message<___T>,
4842 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4843 match *message.header().ordinal {
4844 ordinal => {
4845 handler.on_unknown_interaction(ordinal).await;
4846 if ::core::matches!(
4847 message.header().flexibility(),
4848 ::fidl_next::protocol::Flexibility::Strict
4849 ) {
4850 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4851 } else {
4852 Ok(())
4853 }
4854 }
4855 }
4856 }
4857}
4858
4859pub trait CpuElementManagerServerHandler<
4863 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4864 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4865>
4866{
4867 #[doc = " Gets the assertive dependency token for the CPU power element.\n"]
4868 fn get_cpu_dependency_token(
4869 &mut self,
4870
4871 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
4872 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4873
4874 #[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"]
4875 fn add_execution_state_dependency(
4876 &mut self,
4877
4878 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
4879
4880 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
4881 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4882
4883 fn on_unknown_interaction(
4884 &mut self,
4885 ordinal: u64,
4886 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4887 ::core::future::ready(())
4888 }
4889}
4890
4891impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for CpuElementManager
4892where
4893 ___H: CpuElementManagerServerHandler<___T> + ::core::marker::Send,
4894 ___T: ::fidl_next::Transport,
4895
4896
4897
4898
4899 for<'de> crate::wire::CpuElementManagerAddExecutionStateDependencyRequest<'de>: ::fidl_next::Decode<
4900 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4901 Constraint = (),
4902 >,
4903
4904
4905{
4906 async fn on_one_way(
4907 handler: &mut ___H,
4908 mut message: ::fidl_next::Message<___T>,
4909 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4910 match *message.header().ordinal {
4911
4912
4913
4914
4915
4916
4917
4918 ordinal => {
4919
4920 handler.on_unknown_interaction(ordinal).await;
4921 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4922 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4923 } else {
4924 Ok(())
4925 }
4926
4927 }
4928 }
4929 }
4930
4931 async fn on_two_way(
4932 handler: &mut ___H,
4933 mut message: ::fidl_next::Message<___T>,
4934 responder: ::fidl_next::protocol::Responder<___T>,
4935 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
4936 match *message.header().ordinal {
4937
4938
4939
4940 3189503319605462202 => {
4941 let responder = ::fidl_next::Responder::from_untyped(responder);
4942
4943 handler.get_cpu_dependency_token(responder).await;
4944 Ok(())
4945
4946 }
4947
4948
4949
4950
4951 1005136052949049908 => {
4952 let responder = ::fidl_next::Responder::from_untyped(responder);
4953
4954 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4955 Ok(decoded) => {
4956 handler.add_execution_state_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
4957 Ok(())
4958 }
4959 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4960 ordinal: 1005136052949049908,
4961 error,
4962 }),
4963 }
4964
4965 }
4966
4967
4968 ordinal => {
4969
4970 handler.on_unknown_interaction(ordinal).await;
4971 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
4972 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4973 } else {
4974 responder.respond_framework_error(
4975 ordinal,
4976 ::fidl_next::FrameworkError::UnknownMethod,
4977 )
4978 .expect("encoding a framework error should never fail")
4979 .await?;
4980 Ok(())
4981 }
4982
4983 }
4984 }
4985 }
4986}
4987
4988impl<___T> CpuElementManagerClientHandler<___T> for ::fidl_next::IgnoreEvents
4989where
4990 ___T: ::fidl_next::Transport,
4991{
4992 async fn on_unknown_interaction(&mut self, _: u64) {}
4993}
4994
4995impl<___H, ___T> CpuElementManagerLocalClientHandler<___T> for ::fidl_next::Local<___H>
4996where
4997 ___H: CpuElementManagerClientHandler<___T>,
4998 ___T: ::fidl_next::Transport,
4999{
5000 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5001 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5002 }
5003}
5004
5005impl<___H, ___T> CpuElementManagerLocalServerHandler<___T> for ::fidl_next::Local<___H>
5006where
5007 ___H: CpuElementManagerServerHandler<___T>,
5008 ___T: ::fidl_next::Transport,
5009{
5010 async fn get_cpu_dependency_token(
5011 &mut self,
5012
5013 responder: ::fidl_next::Responder<cpu_element_manager::GetCpuDependencyToken, ___T>,
5014 ) {
5015 ___H::get_cpu_dependency_token(&mut self.0, responder).await
5016 }
5017
5018 async fn add_execution_state_dependency(
5019 &mut self,
5020
5021 request: ::fidl_next::Request<cpu_element_manager::AddExecutionStateDependency, ___T>,
5022
5023 responder: ::fidl_next::Responder<cpu_element_manager::AddExecutionStateDependency, ___T>,
5024 ) {
5025 ___H::add_execution_state_dependency(&mut self.0, request, responder).await
5026 }
5027
5028 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5029 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5030 }
5031}
5032
5033#[doc = " A service for exposing execution state management capabilities.\n"]
5035#[derive(PartialEq, Debug)]
5036pub struct ExecutionStateManager;
5037
5038impl ::fidl_next::Discoverable for ExecutionStateManager {
5039 const PROTOCOL_NAME: &'static str = "fuchsia.power.system.ExecutionStateManager";
5040}
5041
5042#[cfg(target_os = "fuchsia")]
5043impl ::fidl_next::HasTransport for ExecutionStateManager {
5044 type Transport = ::fidl_next::fuchsia::zx::Channel;
5045}
5046
5047pub mod execution_state_manager {
5048 pub mod prelude {
5049 pub use crate::{
5050 ExecutionStateManager, ExecutionStateManagerClientHandler,
5051 ExecutionStateManagerLocalClientHandler, ExecutionStateManagerLocalServerHandler,
5052 ExecutionStateManagerServerHandler, execution_state_manager,
5053 };
5054
5055 pub use crate::natural::AddApplicationActivityDependencyError;
5056
5057 pub use crate::natural::ExecutionState;
5058
5059 pub use crate::natural::ExecutionStateManagerAddApplicationActivityDependencyRequest;
5060
5061 pub use crate::natural::ExecutionStateManagerAddApplicationActivityDependencyResponse;
5062 }
5063
5064 pub struct GetExecutionStateDependencyToken;
5065
5066 impl ::fidl_next::Method for GetExecutionStateDependencyToken {
5067 const ORDINAL: u64 = 8208054324408055568;
5068 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5069 ::fidl_next::protocol::Flexibility::Flexible;
5070
5071 type Protocol = crate::ExecutionStateManager;
5072
5073 type Request = ::fidl_next::wire::EmptyMessageBody;
5074 }
5075
5076 impl ::fidl_next::TwoWayMethod for GetExecutionStateDependencyToken {
5077 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::ExecutionState<'static>>;
5078 }
5079
5080 impl<___R> ::fidl_next::Respond<___R> for GetExecutionStateDependencyToken {
5081 type Output = ::fidl_next::Flexible<___R>;
5082
5083 fn respond(response: ___R) -> Self::Output {
5084 ::fidl_next::Flexible(response)
5085 }
5086 }
5087
5088 pub struct AddApplicationActivityDependency;
5089
5090 impl ::fidl_next::Method for AddApplicationActivityDependency {
5091 const ORDINAL: u64 = 4149397805243818457;
5092 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5093 ::fidl_next::protocol::Flexibility::Flexible;
5094
5095 type Protocol = crate::ExecutionStateManager;
5096
5097 type Request =
5098 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'static>;
5099 }
5100
5101 impl ::fidl_next::TwoWayMethod for AddApplicationActivityDependency {
5102 type Response = ::fidl_next::wire::Result<
5103 'static,
5104 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyResponse,
5105 crate::wire::AddApplicationActivityDependencyError,
5106 >;
5107 }
5108
5109 impl<___R> ::fidl_next::Respond<___R> for AddApplicationActivityDependency {
5110 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
5111
5112 fn respond(response: ___R) -> Self::Output {
5113 ::core::result::Result::Ok(response)
5114 }
5115 }
5116
5117 impl<___R> ::fidl_next::RespondErr<___R> for AddApplicationActivityDependency {
5118 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
5119
5120 fn respond_err(response: ___R) -> Self::Output {
5121 ::core::result::Result::Err(response)
5122 }
5123 }
5124
5125 mod ___detail {
5126 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ExecutionStateManager
5127 where
5128 ___T: ::fidl_next::Transport,
5129 {
5130 type Client = ExecutionStateManagerClient<___T>;
5131 type Server = ExecutionStateManagerServer<___T>;
5132 }
5133
5134 #[repr(transparent)]
5136 pub struct ExecutionStateManagerClient<___T: ::fidl_next::Transport> {
5137 #[allow(dead_code)]
5138 client: ::fidl_next::protocol::Client<___T>,
5139 }
5140
5141 impl<___T> ExecutionStateManagerClient<___T>
5142 where
5143 ___T: ::fidl_next::Transport,
5144 {
5145 #[doc = " Gets the dependency token for the execution state power element. This will block if SAG\n is not fully initialized.\n"]
5146 pub fn get_execution_state_dependency_token(
5147 &self,
5148 ) -> ::fidl_next::TwoWayFuture<'_, super::GetExecutionStateDependencyToken, ___T>
5149 {
5150 ::fidl_next::TwoWayFuture::from_untyped(
5151 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
5152 8208054324408055568,
5153 <super::GetExecutionStateDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
5154 (),
5155 )
5156 )
5157 }
5158
5159 #[doc = " Adds a dependency from the Application Activity power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n Be aware of the following client-side conditions:\n - If SAG is not fully initialized, the call blocks until initialization is complete.\n - The call may block as required by `fuchsia.power.broker/ElementControl.AddDependency`,\n which at time of writing may call `fuchsia.power.ElementControl.SetLevel` on the\n associated power element.\n"]
5160 pub fn add_application_activity_dependency_with<___R>(
5161 &self,
5162 request: ___R,
5163 ) -> ::fidl_next::TwoWayFuture<'_, super::AddApplicationActivityDependency, ___T>
5164 where
5165 ___R: ::fidl_next::Encode<
5166 crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<
5167 'static,
5168 >,
5169 <___T as ::fidl_next::Transport>::SendBuffer,
5170 >,
5171 {
5172 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5173 4149397805243818457,
5174 <super::AddApplicationActivityDependency as ::fidl_next::Method>::FLEXIBILITY,
5175 request,
5176 ))
5177 }
5178 }
5179
5180 #[repr(transparent)]
5182 pub struct ExecutionStateManagerServer<___T: ::fidl_next::Transport> {
5183 server: ::fidl_next::protocol::Server<___T>,
5184 }
5185
5186 impl<___T> ExecutionStateManagerServer<___T> where ___T: ::fidl_next::Transport {}
5187 }
5188}
5189
5190#[diagnostic::on_unimplemented(
5191 note = "If {Self} implements the non-local ExecutionStateManagerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5192)]
5193
5194pub trait ExecutionStateManagerLocalClientHandler<
5198 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5199 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5200>
5201{
5202 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5203 ::core::future::ready(())
5204 }
5205}
5206
5207impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ExecutionStateManager
5208where
5209 ___H: ExecutionStateManagerLocalClientHandler<___T>,
5210 ___T: ::fidl_next::Transport,
5211{
5212 async fn on_event(
5213 handler: &mut ___H,
5214 mut message: ::fidl_next::Message<___T>,
5215 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5216 match *message.header().ordinal {
5217 ordinal => {
5218 handler.on_unknown_interaction(ordinal).await;
5219 if ::core::matches!(
5220 message.header().flexibility(),
5221 ::fidl_next::protocol::Flexibility::Strict
5222 ) {
5223 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5224 } else {
5225 Ok(())
5226 }
5227 }
5228 }
5229 }
5230}
5231
5232#[diagnostic::on_unimplemented(
5233 note = "If {Self} implements the non-local ExecutionStateManagerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5234)]
5235
5236pub trait ExecutionStateManagerLocalServerHandler<
5240 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5241 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5242>
5243{
5244 #[doc = " Gets the dependency token for the execution state power element. This will block if SAG\n is not fully initialized.\n"]
5245 fn get_execution_state_dependency_token(
5246 &mut self,
5247
5248 responder: ::fidl_next::Responder<
5249 execution_state_manager::GetExecutionStateDependencyToken,
5250 ___T,
5251 >,
5252 ) -> impl ::core::future::Future<Output = ()>;
5253
5254 #[doc = " Adds a dependency from the Application Activity power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n Be aware of the following client-side conditions:\n - If SAG is not fully initialized, the call blocks until initialization is complete.\n - The call may block as required by `fuchsia.power.broker/ElementControl.AddDependency`,\n which at time of writing may call `fuchsia.power.ElementControl.SetLevel` on the\n associated power element.\n"]
5255 fn add_application_activity_dependency(
5256 &mut self,
5257
5258 request: ::fidl_next::Request<
5259 execution_state_manager::AddApplicationActivityDependency,
5260 ___T,
5261 >,
5262
5263 responder: ::fidl_next::Responder<
5264 execution_state_manager::AddApplicationActivityDependency,
5265 ___T,
5266 >,
5267 ) -> impl ::core::future::Future<Output = ()>;
5268
5269 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5270 ::core::future::ready(())
5271 }
5272}
5273
5274impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ExecutionStateManager
5275where
5276 ___H: ExecutionStateManagerLocalServerHandler<___T> ,
5277 ___T: ::fidl_next::Transport,
5278
5279
5280
5281
5282 for<'de> crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>: ::fidl_next::Decode<
5283 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5284 Constraint = (),
5285 >,
5286
5287
5288{
5289 async fn on_one_way(
5290 handler: &mut ___H,
5291 mut message: ::fidl_next::Message<___T>,
5292 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
5293 match *message.header().ordinal {
5294
5295
5296
5297
5298
5299
5300
5301 ordinal => {
5302
5303 handler.on_unknown_interaction(ordinal).await;
5304 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
5305 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5306 } else {
5307 Ok(())
5308 }
5309
5310 }
5311 }
5312 }
5313
5314 async fn on_two_way(
5315 handler: &mut ___H,
5316 mut message: ::fidl_next::Message<___T>,
5317 responder: ::fidl_next::protocol::Responder<___T>,
5318 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
5319 match *message.header().ordinal {
5320
5321
5322
5323 8208054324408055568 => {
5324 let responder = ::fidl_next::Responder::from_untyped(responder);
5325
5326 handler.get_execution_state_dependency_token(responder).await;
5327 Ok(())
5328
5329 }
5330
5331
5332
5333
5334 4149397805243818457 => {
5335 let responder = ::fidl_next::Responder::from_untyped(responder);
5336
5337 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5338 Ok(decoded) => {
5339 handler.add_application_activity_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
5340 Ok(())
5341 }
5342 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5343 ordinal: 4149397805243818457,
5344 error,
5345 }),
5346 }
5347
5348 }
5349
5350
5351 ordinal => {
5352
5353 handler.on_unknown_interaction(ordinal).await;
5354 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
5355 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5356 } else {
5357 responder.respond_framework_error(
5358 ordinal,
5359 ::fidl_next::FrameworkError::UnknownMethod,
5360 )
5361 .expect("encoding a framework error should never fail")
5362 .await?;
5363 Ok(())
5364 }
5365
5366 }
5367 }
5368 }
5369}
5370
5371pub trait ExecutionStateManagerClientHandler<
5375 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5376 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5377>
5378{
5379 fn on_unknown_interaction(
5380 &mut self,
5381 ordinal: u64,
5382 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5383 ::core::future::ready(())
5384 }
5385}
5386
5387impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ExecutionStateManager
5388where
5389 ___H: ExecutionStateManagerClientHandler<___T> + ::core::marker::Send,
5390 ___T: ::fidl_next::Transport,
5391{
5392 async fn on_event(
5393 handler: &mut ___H,
5394 mut message: ::fidl_next::Message<___T>,
5395 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5396 match *message.header().ordinal {
5397 ordinal => {
5398 handler.on_unknown_interaction(ordinal).await;
5399 if ::core::matches!(
5400 message.header().flexibility(),
5401 ::fidl_next::protocol::Flexibility::Strict
5402 ) {
5403 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5404 } else {
5405 Ok(())
5406 }
5407 }
5408 }
5409 }
5410}
5411
5412pub trait ExecutionStateManagerServerHandler<
5416 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5417 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5418>
5419{
5420 #[doc = " Gets the dependency token for the execution state power element. This will block if SAG\n is not fully initialized.\n"]
5421 fn get_execution_state_dependency_token(
5422 &mut self,
5423
5424 responder: ::fidl_next::Responder<
5425 execution_state_manager::GetExecutionStateDependencyToken,
5426 ___T,
5427 >,
5428 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5429
5430 #[doc = " Adds a dependency from the Application Activity power element to the target\n power element identified by [`dependency_token`] at [`power_level`].\n Be aware of the following client-side conditions:\n - If SAG is not fully initialized, the call blocks until initialization is complete.\n - The call may block as required by `fuchsia.power.broker/ElementControl.AddDependency`,\n which at time of writing may call `fuchsia.power.ElementControl.SetLevel` on the\n associated power element.\n"]
5431 fn add_application_activity_dependency(
5432 &mut self,
5433
5434 request: ::fidl_next::Request<
5435 execution_state_manager::AddApplicationActivityDependency,
5436 ___T,
5437 >,
5438
5439 responder: ::fidl_next::Responder<
5440 execution_state_manager::AddApplicationActivityDependency,
5441 ___T,
5442 >,
5443 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5444
5445 fn on_unknown_interaction(
5446 &mut self,
5447 ordinal: u64,
5448 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5449 ::core::future::ready(())
5450 }
5451}
5452
5453impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ExecutionStateManager
5454where
5455 ___H: ExecutionStateManagerServerHandler<___T> + ::core::marker::Send,
5456 ___T: ::fidl_next::Transport,
5457
5458
5459
5460
5461 for<'de> crate::wire::ExecutionStateManagerAddApplicationActivityDependencyRequest<'de>: ::fidl_next::Decode<
5462 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5463 Constraint = (),
5464 >,
5465
5466
5467{
5468 async fn on_one_way(
5469 handler: &mut ___H,
5470 mut message: ::fidl_next::Message<___T>,
5471 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
5472 match *message.header().ordinal {
5473
5474
5475
5476
5477
5478
5479
5480 ordinal => {
5481
5482 handler.on_unknown_interaction(ordinal).await;
5483 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
5484 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5485 } else {
5486 Ok(())
5487 }
5488
5489 }
5490 }
5491 }
5492
5493 async fn on_two_way(
5494 handler: &mut ___H,
5495 mut message: ::fidl_next::Message<___T>,
5496 responder: ::fidl_next::protocol::Responder<___T>,
5497 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
5498 match *message.header().ordinal {
5499
5500
5501
5502 8208054324408055568 => {
5503 let responder = ::fidl_next::Responder::from_untyped(responder);
5504
5505 handler.get_execution_state_dependency_token(responder).await;
5506 Ok(())
5507
5508 }
5509
5510
5511
5512
5513 4149397805243818457 => {
5514 let responder = ::fidl_next::Responder::from_untyped(responder);
5515
5516 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5517 Ok(decoded) => {
5518 handler.add_application_activity_dependency(::fidl_next::Request::from_decoded(decoded), responder).await;
5519 Ok(())
5520 }
5521 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5522 ordinal: 4149397805243818457,
5523 error,
5524 }),
5525 }
5526
5527 }
5528
5529
5530 ordinal => {
5531
5532 handler.on_unknown_interaction(ordinal).await;
5533 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
5534 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5535 } else {
5536 responder.respond_framework_error(
5537 ordinal,
5538 ::fidl_next::FrameworkError::UnknownMethod,
5539 )
5540 .expect("encoding a framework error should never fail")
5541 .await?;
5542 Ok(())
5543 }
5544
5545 }
5546 }
5547 }
5548}
5549
5550impl<___T> ExecutionStateManagerClientHandler<___T> for ::fidl_next::IgnoreEvents
5551where
5552 ___T: ::fidl_next::Transport,
5553{
5554 async fn on_unknown_interaction(&mut self, _: u64) {}
5555}
5556
5557impl<___H, ___T> ExecutionStateManagerLocalClientHandler<___T> for ::fidl_next::Local<___H>
5558where
5559 ___H: ExecutionStateManagerClientHandler<___T>,
5560 ___T: ::fidl_next::Transport,
5561{
5562 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5563 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5564 }
5565}
5566
5567impl<___H, ___T> ExecutionStateManagerLocalServerHandler<___T> for ::fidl_next::Local<___H>
5568where
5569 ___H: ExecutionStateManagerServerHandler<___T>,
5570 ___T: ::fidl_next::Transport,
5571{
5572 async fn get_execution_state_dependency_token(
5573 &mut self,
5574
5575 responder: ::fidl_next::Responder<
5576 execution_state_manager::GetExecutionStateDependencyToken,
5577 ___T,
5578 >,
5579 ) {
5580 ___H::get_execution_state_dependency_token(&mut self.0, responder).await
5581 }
5582
5583 async fn add_application_activity_dependency(
5584 &mut self,
5585
5586 request: ::fidl_next::Request<
5587 execution_state_manager::AddApplicationActivityDependency,
5588 ___T,
5589 >,
5590
5591 responder: ::fidl_next::Responder<
5592 execution_state_manager::AddApplicationActivityDependency,
5593 ___T,
5594 >,
5595 ) {
5596 ___H::add_application_activity_dependency(&mut self.0, request, responder).await
5597 }
5598
5599 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5600 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5601 }
5602}
5603
5604pub use fidl_next_common_fuchsia_power_system::*;