1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_power_system__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14pub type LeaseToken = fidl::EventPair;
15
16#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest {
18 pub name: String,
22 pub server_token: fidl::EventPair,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
29 for ActivityGovernorAcquireWakeLeaseWithTokenRequest
30{
31}
32
33#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct ActivityGovernorAcquireWakeLeaseResponse {
35 pub token: fidl::EventPair,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40 for ActivityGovernorAcquireWakeLeaseResponse
41{
42}
43
44#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct ActivityGovernorRegisterSuspendBlockerResponse {
46 pub token: fidl::EventPair,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51 for ActivityGovernorRegisterSuspendBlockerResponse
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
57 pub token: fidl::EventPair,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63 for ActivityGovernorTakeApplicationActivityLeaseResponse
64{
65}
66
67#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
68pub struct ActivityGovernorTakeWakeLeaseResponse {
69 pub token: fidl::EventPair,
71}
72
73impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
74 for ActivityGovernorTakeWakeLeaseResponse
75{
76}
77
78#[derive(Debug, Default, PartialEq)]
79pub struct ActivityGovernorRegisterSuspendBlockerRequest {
80 pub suspend_blocker: Option<fidl::endpoints::ClientEnd<SuspendBlockerMarker>>,
84 pub name: Option<String>,
90 #[doc(hidden)]
91 pub __source_breaking: fidl::marker::SourceBreaking,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
95 for ActivityGovernorRegisterSuspendBlockerRequest
96{
97}
98
99#[derive(Debug, Default, PartialEq)]
103pub struct ApplicationActivity {
104 pub assertive_dependency_token: Option<fidl::Event>,
105 #[doc(hidden)]
106 pub __source_breaking: fidl::marker::SourceBreaking,
107}
108
109impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ApplicationActivity {}
110
111#[derive(Debug, Default, PartialEq)]
115pub struct Cpu {
116 pub assertive_dependency_token: Option<fidl::Event>,
117 #[doc(hidden)]
118 pub __source_breaking: fidl::marker::SourceBreaking,
119}
120
121impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Cpu {}
122
123#[derive(Debug, Default, PartialEq)]
124pub struct CpuElementManagerAddExecutionStateDependencyRequest {
125 pub dependency_token: Option<fidl::Event>,
129 pub power_level: Option<u8>,
132 #[doc(hidden)]
133 pub __source_breaking: fidl::marker::SourceBreaking,
134}
135
136impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
137 for CpuElementManagerAddExecutionStateDependencyRequest
138{
139}
140
141#[derive(Debug, Default, PartialEq)]
150pub struct ExecutionState {
151 pub opportunistic_dependency_token: Option<fidl::Event>,
152 #[doc(hidden)]
153 pub __source_breaking: fidl::marker::SourceBreaking,
154}
155
156impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ExecutionState {}
157
158#[derive(Debug, Default, PartialEq)]
160pub struct PowerElements {
161 pub execution_state: Option<ExecutionState>,
162 pub application_activity: Option<ApplicationActivity>,
163 #[doc(hidden)]
164 pub __source_breaking: fidl::marker::SourceBreaking,
165}
166
167impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PowerElements {}
168
169#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
170pub struct ActivityGovernorMarker;
171
172impl fidl::endpoints::ProtocolMarker for ActivityGovernorMarker {
173 type Proxy = ActivityGovernorProxy;
174 type RequestStream = ActivityGovernorRequestStream;
175 #[cfg(target_os = "fuchsia")]
176 type SynchronousProxy = ActivityGovernorSynchronousProxy;
177
178 const DEBUG_NAME: &'static str = "fuchsia.power.system.ActivityGovernor";
179}
180impl fidl::endpoints::DiscoverableProtocolMarker for ActivityGovernorMarker {}
181pub type ActivityGovernorAcquireWakeLeaseResult = Result<fidl::EventPair, AcquireWakeLeaseError>;
182pub type ActivityGovernorAcquireWakeLeaseWithTokenResult = Result<(), AcquireWakeLeaseError>;
183pub type ActivityGovernorRegisterSuspendBlockerResult =
184 Result<fidl::EventPair, RegisterSuspendBlockerError>;
185
186pub trait ActivityGovernorProxyInterface: Send + Sync {
187 type GetPowerElementsResponseFut: std::future::Future<Output = Result<PowerElements, fidl::Error>>
188 + Send;
189 fn r#get_power_elements(&self) -> Self::GetPowerElementsResponseFut;
190 type TakeWakeLeaseResponseFut: std::future::Future<Output = Result<fidl::EventPair, fidl::Error>>
191 + Send;
192 fn r#take_wake_lease(&self, name: &str) -> Self::TakeWakeLeaseResponseFut;
193 type AcquireWakeLeaseResponseFut: std::future::Future<Output = Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error>>
194 + Send;
195 fn r#acquire_wake_lease(&self, name: &str) -> Self::AcquireWakeLeaseResponseFut;
196 type AcquireWakeLeaseWithTokenResponseFut: std::future::Future<
197 Output = Result<ActivityGovernorAcquireWakeLeaseWithTokenResult, fidl::Error>,
198 > + Send;
199 fn r#acquire_wake_lease_with_token(
200 &self,
201 name: &str,
202 server_token: fidl::EventPair,
203 ) -> Self::AcquireWakeLeaseWithTokenResponseFut;
204 type TakeApplicationActivityLeaseResponseFut: std::future::Future<Output = Result<fidl::EventPair, fidl::Error>>
205 + Send;
206 fn r#take_application_activity_lease(
207 &self,
208 name: &str,
209 ) -> Self::TakeApplicationActivityLeaseResponseFut;
210 type RegisterSuspendBlockerResponseFut: std::future::Future<
211 Output = Result<ActivityGovernorRegisterSuspendBlockerResult, fidl::Error>,
212 > + Send;
213 fn r#register_suspend_blocker(
214 &self,
215 payload: ActivityGovernorRegisterSuspendBlockerRequest,
216 ) -> Self::RegisterSuspendBlockerResponseFut;
217}
218#[derive(Debug)]
219#[cfg(target_os = "fuchsia")]
220pub struct ActivityGovernorSynchronousProxy {
221 client: fidl::client::sync::Client,
222}
223
224#[cfg(target_os = "fuchsia")]
225impl fidl::endpoints::SynchronousProxy for ActivityGovernorSynchronousProxy {
226 type Proxy = ActivityGovernorProxy;
227 type Protocol = ActivityGovernorMarker;
228
229 fn from_channel(inner: fidl::Channel) -> Self {
230 Self::new(inner)
231 }
232
233 fn into_channel(self) -> fidl::Channel {
234 self.client.into_channel()
235 }
236
237 fn as_channel(&self) -> &fidl::Channel {
238 self.client.as_channel()
239 }
240}
241
242#[cfg(target_os = "fuchsia")]
243impl ActivityGovernorSynchronousProxy {
244 pub fn new(channel: fidl::Channel) -> Self {
245 let protocol_name = <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
246 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
247 }
248
249 pub fn into_channel(self) -> fidl::Channel {
250 self.client.into_channel()
251 }
252
253 pub fn wait_for_event(
256 &self,
257 deadline: zx::MonotonicInstant,
258 ) -> Result<ActivityGovernorEvent, fidl::Error> {
259 ActivityGovernorEvent::decode(self.client.wait_for_event(deadline)?)
260 }
261
262 pub fn r#get_power_elements(
269 &self,
270 ___deadline: zx::MonotonicInstant,
271 ) -> Result<PowerElements, fidl::Error> {
272 let _response = self.client.send_query::<
273 fidl::encoding::EmptyPayload,
274 fidl::encoding::FlexibleType<PowerElements>,
275 >(
276 (),
277 0x798003259dfb5672,
278 fidl::encoding::DynamicFlags::FLEXIBLE,
279 ___deadline,
280 )?
281 .into_result::<ActivityGovernorMarker>("get_power_elements")?;
282 Ok(_response)
283 }
284
285 pub fn r#take_wake_lease(
294 &self,
295 mut name: &str,
296 ___deadline: zx::MonotonicInstant,
297 ) -> Result<fidl::EventPair, fidl::Error> {
298 let _response = self.client.send_query::<
299 ActivityGovernorTakeWakeLeaseRequest,
300 fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>,
301 >(
302 (name,),
303 0x291cfb42b2d3bf69,
304 fidl::encoding::DynamicFlags::FLEXIBLE,
305 ___deadline,
306 )?
307 .into_result::<ActivityGovernorMarker>("take_wake_lease")?;
308 Ok(_response.token)
309 }
310
311 pub fn r#acquire_wake_lease(
316 &self,
317 mut name: &str,
318 ___deadline: zx::MonotonicInstant,
319 ) -> Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error> {
320 let _response = self.client.send_query::<
321 ActivityGovernorAcquireWakeLeaseRequest,
322 fidl::encoding::FlexibleResultType<ActivityGovernorAcquireWakeLeaseResponse, AcquireWakeLeaseError>,
323 >(
324 (name,),
325 0x2de25abd8fa7c103,
326 fidl::encoding::DynamicFlags::FLEXIBLE,
327 ___deadline,
328 )?
329 .into_result::<ActivityGovernorMarker>("acquire_wake_lease")?;
330 Ok(_response.map(|x| x.token))
331 }
332
333 pub fn r#acquire_wake_lease_with_token(
343 &self,
344 mut name: &str,
345 mut server_token: fidl::EventPair,
346 ___deadline: zx::MonotonicInstant,
347 ) -> Result<ActivityGovernorAcquireWakeLeaseWithTokenResult, fidl::Error> {
348 let _response = self.client.send_query::<
349 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
350 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AcquireWakeLeaseError>,
351 >(
352 (name, server_token,),
353 0x1cdd2ea3bee46f51,
354 fidl::encoding::DynamicFlags::FLEXIBLE,
355 ___deadline,
356 )?
357 .into_result::<ActivityGovernorMarker>("acquire_wake_lease_with_token")?;
358 Ok(_response.map(|x| x))
359 }
360
361 pub fn r#take_application_activity_lease(
371 &self,
372 mut name: &str,
373 ___deadline: zx::MonotonicInstant,
374 ) -> Result<fidl::EventPair, fidl::Error> {
375 let _response = self.client.send_query::<
376 ActivityGovernorTakeApplicationActivityLeaseRequest,
377 fidl::encoding::FlexibleType<ActivityGovernorTakeApplicationActivityLeaseResponse>,
378 >(
379 (name,),
380 0x37cd5364de7ada14,
381 fidl::encoding::DynamicFlags::FLEXIBLE,
382 ___deadline,
383 )?
384 .into_result::<ActivityGovernorMarker>("take_application_activity_lease")?;
385 Ok(_response.token)
386 }
387
388 pub fn r#register_suspend_blocker(
404 &self,
405 mut payload: ActivityGovernorRegisterSuspendBlockerRequest,
406 ___deadline: zx::MonotonicInstant,
407 ) -> Result<ActivityGovernorRegisterSuspendBlockerResult, fidl::Error> {
408 let _response = self.client.send_query::<
409 ActivityGovernorRegisterSuspendBlockerRequest,
410 fidl::encoding::FlexibleResultType<ActivityGovernorRegisterSuspendBlockerResponse, RegisterSuspendBlockerError>,
411 >(
412 &mut payload,
413 0x34ef55b180feef01,
414 fidl::encoding::DynamicFlags::FLEXIBLE,
415 ___deadline,
416 )?
417 .into_result::<ActivityGovernorMarker>("register_suspend_blocker")?;
418 Ok(_response.map(|x| x.token))
419 }
420}
421
422#[cfg(target_os = "fuchsia")]
423impl From<ActivityGovernorSynchronousProxy> for zx::Handle {
424 fn from(value: ActivityGovernorSynchronousProxy) -> Self {
425 value.into_channel().into()
426 }
427}
428
429#[cfg(target_os = "fuchsia")]
430impl From<fidl::Channel> for ActivityGovernorSynchronousProxy {
431 fn from(value: fidl::Channel) -> Self {
432 Self::new(value)
433 }
434}
435
436#[cfg(target_os = "fuchsia")]
437impl fidl::endpoints::FromClient for ActivityGovernorSynchronousProxy {
438 type Protocol = ActivityGovernorMarker;
439
440 fn from_client(value: fidl::endpoints::ClientEnd<ActivityGovernorMarker>) -> Self {
441 Self::new(value.into_channel())
442 }
443}
444
445#[derive(Debug, Clone)]
446pub struct ActivityGovernorProxy {
447 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
448}
449
450impl fidl::endpoints::Proxy for ActivityGovernorProxy {
451 type Protocol = ActivityGovernorMarker;
452
453 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
454 Self::new(inner)
455 }
456
457 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
458 self.client.into_channel().map_err(|client| Self { client })
459 }
460
461 fn as_channel(&self) -> &::fidl::AsyncChannel {
462 self.client.as_channel()
463 }
464}
465
466impl ActivityGovernorProxy {
467 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
469 let protocol_name = <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
470 Self { client: fidl::client::Client::new(channel, protocol_name) }
471 }
472
473 pub fn take_event_stream(&self) -> ActivityGovernorEventStream {
479 ActivityGovernorEventStream { event_receiver: self.client.take_event_receiver() }
480 }
481
482 pub fn r#get_power_elements(
489 &self,
490 ) -> fidl::client::QueryResponseFut<PowerElements, fidl::encoding::DefaultFuchsiaResourceDialect>
491 {
492 ActivityGovernorProxyInterface::r#get_power_elements(self)
493 }
494
495 pub fn r#take_wake_lease(
504 &self,
505 mut name: &str,
506 ) -> fidl::client::QueryResponseFut<
507 fidl::EventPair,
508 fidl::encoding::DefaultFuchsiaResourceDialect,
509 > {
510 ActivityGovernorProxyInterface::r#take_wake_lease(self, name)
511 }
512
513 pub fn r#acquire_wake_lease(
518 &self,
519 mut name: &str,
520 ) -> fidl::client::QueryResponseFut<
521 ActivityGovernorAcquireWakeLeaseResult,
522 fidl::encoding::DefaultFuchsiaResourceDialect,
523 > {
524 ActivityGovernorProxyInterface::r#acquire_wake_lease(self, name)
525 }
526
527 pub fn r#acquire_wake_lease_with_token(
537 &self,
538 mut name: &str,
539 mut server_token: fidl::EventPair,
540 ) -> fidl::client::QueryResponseFut<
541 ActivityGovernorAcquireWakeLeaseWithTokenResult,
542 fidl::encoding::DefaultFuchsiaResourceDialect,
543 > {
544 ActivityGovernorProxyInterface::r#acquire_wake_lease_with_token(self, name, server_token)
545 }
546
547 pub fn r#take_application_activity_lease(
557 &self,
558 mut name: &str,
559 ) -> fidl::client::QueryResponseFut<
560 fidl::EventPair,
561 fidl::encoding::DefaultFuchsiaResourceDialect,
562 > {
563 ActivityGovernorProxyInterface::r#take_application_activity_lease(self, name)
564 }
565
566 pub fn r#register_suspend_blocker(
582 &self,
583 mut payload: ActivityGovernorRegisterSuspendBlockerRequest,
584 ) -> fidl::client::QueryResponseFut<
585 ActivityGovernorRegisterSuspendBlockerResult,
586 fidl::encoding::DefaultFuchsiaResourceDialect,
587 > {
588 ActivityGovernorProxyInterface::r#register_suspend_blocker(self, payload)
589 }
590}
591
592impl ActivityGovernorProxyInterface for ActivityGovernorProxy {
593 type GetPowerElementsResponseFut = fidl::client::QueryResponseFut<
594 PowerElements,
595 fidl::encoding::DefaultFuchsiaResourceDialect,
596 >;
597 fn r#get_power_elements(&self) -> Self::GetPowerElementsResponseFut {
598 fn _decode(
599 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
600 ) -> Result<PowerElements, fidl::Error> {
601 let _response = fidl::client::decode_transaction_body::<
602 fidl::encoding::FlexibleType<PowerElements>,
603 fidl::encoding::DefaultFuchsiaResourceDialect,
604 0x798003259dfb5672,
605 >(_buf?)?
606 .into_result::<ActivityGovernorMarker>("get_power_elements")?;
607 Ok(_response)
608 }
609 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PowerElements>(
610 (),
611 0x798003259dfb5672,
612 fidl::encoding::DynamicFlags::FLEXIBLE,
613 _decode,
614 )
615 }
616
617 type TakeWakeLeaseResponseFut = fidl::client::QueryResponseFut<
618 fidl::EventPair,
619 fidl::encoding::DefaultFuchsiaResourceDialect,
620 >;
621 fn r#take_wake_lease(&self, mut name: &str) -> Self::TakeWakeLeaseResponseFut {
622 fn _decode(
623 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
624 ) -> Result<fidl::EventPair, fidl::Error> {
625 let _response = fidl::client::decode_transaction_body::<
626 fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>,
627 fidl::encoding::DefaultFuchsiaResourceDialect,
628 0x291cfb42b2d3bf69,
629 >(_buf?)?
630 .into_result::<ActivityGovernorMarker>("take_wake_lease")?;
631 Ok(_response.token)
632 }
633 self.client.send_query_and_decode::<ActivityGovernorTakeWakeLeaseRequest, fidl::EventPair>(
634 (name,),
635 0x291cfb42b2d3bf69,
636 fidl::encoding::DynamicFlags::FLEXIBLE,
637 _decode,
638 )
639 }
640
641 type AcquireWakeLeaseResponseFut = fidl::client::QueryResponseFut<
642 ActivityGovernorAcquireWakeLeaseResult,
643 fidl::encoding::DefaultFuchsiaResourceDialect,
644 >;
645 fn r#acquire_wake_lease(&self, mut name: &str) -> Self::AcquireWakeLeaseResponseFut {
646 fn _decode(
647 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
648 ) -> Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error> {
649 let _response = fidl::client::decode_transaction_body::<
650 fidl::encoding::FlexibleResultType<
651 ActivityGovernorAcquireWakeLeaseResponse,
652 AcquireWakeLeaseError,
653 >,
654 fidl::encoding::DefaultFuchsiaResourceDialect,
655 0x2de25abd8fa7c103,
656 >(_buf?)?
657 .into_result::<ActivityGovernorMarker>("acquire_wake_lease")?;
658 Ok(_response.map(|x| x.token))
659 }
660 self.client.send_query_and_decode::<
661 ActivityGovernorAcquireWakeLeaseRequest,
662 ActivityGovernorAcquireWakeLeaseResult,
663 >(
664 (name,),
665 0x2de25abd8fa7c103,
666 fidl::encoding::DynamicFlags::FLEXIBLE,
667 _decode,
668 )
669 }
670
671 type AcquireWakeLeaseWithTokenResponseFut = fidl::client::QueryResponseFut<
672 ActivityGovernorAcquireWakeLeaseWithTokenResult,
673 fidl::encoding::DefaultFuchsiaResourceDialect,
674 >;
675 fn r#acquire_wake_lease_with_token(
676 &self,
677 mut name: &str,
678 mut server_token: fidl::EventPair,
679 ) -> Self::AcquireWakeLeaseWithTokenResponseFut {
680 fn _decode(
681 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
682 ) -> Result<ActivityGovernorAcquireWakeLeaseWithTokenResult, fidl::Error> {
683 let _response = fidl::client::decode_transaction_body::<
684 fidl::encoding::FlexibleResultType<
685 fidl::encoding::EmptyStruct,
686 AcquireWakeLeaseError,
687 >,
688 fidl::encoding::DefaultFuchsiaResourceDialect,
689 0x1cdd2ea3bee46f51,
690 >(_buf?)?
691 .into_result::<ActivityGovernorMarker>("acquire_wake_lease_with_token")?;
692 Ok(_response.map(|x| x))
693 }
694 self.client.send_query_and_decode::<
695 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
696 ActivityGovernorAcquireWakeLeaseWithTokenResult,
697 >(
698 (name, server_token,),
699 0x1cdd2ea3bee46f51,
700 fidl::encoding::DynamicFlags::FLEXIBLE,
701 _decode,
702 )
703 }
704
705 type TakeApplicationActivityLeaseResponseFut = fidl::client::QueryResponseFut<
706 fidl::EventPair,
707 fidl::encoding::DefaultFuchsiaResourceDialect,
708 >;
709 fn r#take_application_activity_lease(
710 &self,
711 mut name: &str,
712 ) -> Self::TakeApplicationActivityLeaseResponseFut {
713 fn _decode(
714 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
715 ) -> Result<fidl::EventPair, fidl::Error> {
716 let _response = fidl::client::decode_transaction_body::<
717 fidl::encoding::FlexibleType<ActivityGovernorTakeApplicationActivityLeaseResponse>,
718 fidl::encoding::DefaultFuchsiaResourceDialect,
719 0x37cd5364de7ada14,
720 >(_buf?)?
721 .into_result::<ActivityGovernorMarker>("take_application_activity_lease")?;
722 Ok(_response.token)
723 }
724 self.client.send_query_and_decode::<
725 ActivityGovernorTakeApplicationActivityLeaseRequest,
726 fidl::EventPair,
727 >(
728 (name,),
729 0x37cd5364de7ada14,
730 fidl::encoding::DynamicFlags::FLEXIBLE,
731 _decode,
732 )
733 }
734
735 type RegisterSuspendBlockerResponseFut = fidl::client::QueryResponseFut<
736 ActivityGovernorRegisterSuspendBlockerResult,
737 fidl::encoding::DefaultFuchsiaResourceDialect,
738 >;
739 fn r#register_suspend_blocker(
740 &self,
741 mut payload: ActivityGovernorRegisterSuspendBlockerRequest,
742 ) -> Self::RegisterSuspendBlockerResponseFut {
743 fn _decode(
744 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
745 ) -> Result<ActivityGovernorRegisterSuspendBlockerResult, fidl::Error> {
746 let _response = fidl::client::decode_transaction_body::<
747 fidl::encoding::FlexibleResultType<
748 ActivityGovernorRegisterSuspendBlockerResponse,
749 RegisterSuspendBlockerError,
750 >,
751 fidl::encoding::DefaultFuchsiaResourceDialect,
752 0x34ef55b180feef01,
753 >(_buf?)?
754 .into_result::<ActivityGovernorMarker>("register_suspend_blocker")?;
755 Ok(_response.map(|x| x.token))
756 }
757 self.client.send_query_and_decode::<
758 ActivityGovernorRegisterSuspendBlockerRequest,
759 ActivityGovernorRegisterSuspendBlockerResult,
760 >(
761 &mut payload,
762 0x34ef55b180feef01,
763 fidl::encoding::DynamicFlags::FLEXIBLE,
764 _decode,
765 )
766 }
767}
768
769pub struct ActivityGovernorEventStream {
770 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
771}
772
773impl std::marker::Unpin for ActivityGovernorEventStream {}
774
775impl futures::stream::FusedStream for ActivityGovernorEventStream {
776 fn is_terminated(&self) -> bool {
777 self.event_receiver.is_terminated()
778 }
779}
780
781impl futures::Stream for ActivityGovernorEventStream {
782 type Item = Result<ActivityGovernorEvent, fidl::Error>;
783
784 fn poll_next(
785 mut self: std::pin::Pin<&mut Self>,
786 cx: &mut std::task::Context<'_>,
787 ) -> std::task::Poll<Option<Self::Item>> {
788 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
789 &mut self.event_receiver,
790 cx
791 )?) {
792 Some(buf) => std::task::Poll::Ready(Some(ActivityGovernorEvent::decode(buf))),
793 None => std::task::Poll::Ready(None),
794 }
795 }
796}
797
798#[derive(Debug)]
799pub enum ActivityGovernorEvent {
800 #[non_exhaustive]
801 _UnknownEvent {
802 ordinal: u64,
804 },
805}
806
807impl ActivityGovernorEvent {
808 fn decode(
810 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
811 ) -> Result<ActivityGovernorEvent, fidl::Error> {
812 let (bytes, _handles) = buf.split_mut();
813 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
814 debug_assert_eq!(tx_header.tx_id, 0);
815 match tx_header.ordinal {
816 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
817 Ok(ActivityGovernorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
818 }
819 _ => Err(fidl::Error::UnknownOrdinal {
820 ordinal: tx_header.ordinal,
821 protocol_name:
822 <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
823 }),
824 }
825 }
826}
827
828pub struct ActivityGovernorRequestStream {
830 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
831 is_terminated: bool,
832}
833
834impl std::marker::Unpin for ActivityGovernorRequestStream {}
835
836impl futures::stream::FusedStream for ActivityGovernorRequestStream {
837 fn is_terminated(&self) -> bool {
838 self.is_terminated
839 }
840}
841
842impl fidl::endpoints::RequestStream for ActivityGovernorRequestStream {
843 type Protocol = ActivityGovernorMarker;
844 type ControlHandle = ActivityGovernorControlHandle;
845
846 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
847 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
848 }
849
850 fn control_handle(&self) -> Self::ControlHandle {
851 ActivityGovernorControlHandle { inner: self.inner.clone() }
852 }
853
854 fn into_inner(
855 self,
856 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
857 {
858 (self.inner, self.is_terminated)
859 }
860
861 fn from_inner(
862 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
863 is_terminated: bool,
864 ) -> Self {
865 Self { inner, is_terminated }
866 }
867}
868
869impl futures::Stream for ActivityGovernorRequestStream {
870 type Item = Result<ActivityGovernorRequest, fidl::Error>;
871
872 fn poll_next(
873 mut self: std::pin::Pin<&mut Self>,
874 cx: &mut std::task::Context<'_>,
875 ) -> std::task::Poll<Option<Self::Item>> {
876 let this = &mut *self;
877 if this.inner.check_shutdown(cx) {
878 this.is_terminated = true;
879 return std::task::Poll::Ready(None);
880 }
881 if this.is_terminated {
882 panic!("polled ActivityGovernorRequestStream after completion");
883 }
884 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
885 |bytes, handles| {
886 match this.inner.channel().read_etc(cx, bytes, handles) {
887 std::task::Poll::Ready(Ok(())) => {}
888 std::task::Poll::Pending => return std::task::Poll::Pending,
889 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
890 this.is_terminated = true;
891 return std::task::Poll::Ready(None);
892 }
893 std::task::Poll::Ready(Err(e)) => {
894 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
895 e.into(),
896 ))));
897 }
898 }
899
900 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
902
903 std::task::Poll::Ready(Some(match header.ordinal {
904 0x798003259dfb5672 => {
905 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
906 let mut req = fidl::new_empty!(
907 fidl::encoding::EmptyPayload,
908 fidl::encoding::DefaultFuchsiaResourceDialect
909 );
910 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
911 let control_handle =
912 ActivityGovernorControlHandle { inner: this.inner.clone() };
913 Ok(ActivityGovernorRequest::GetPowerElements {
914 responder: ActivityGovernorGetPowerElementsResponder {
915 control_handle: std::mem::ManuallyDrop::new(control_handle),
916 tx_id: header.tx_id,
917 },
918 })
919 }
920 0x291cfb42b2d3bf69 => {
921 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
922 let mut req = fidl::new_empty!(
923 ActivityGovernorTakeWakeLeaseRequest,
924 fidl::encoding::DefaultFuchsiaResourceDialect
925 );
926 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorTakeWakeLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
927 let control_handle =
928 ActivityGovernorControlHandle { inner: this.inner.clone() };
929 Ok(ActivityGovernorRequest::TakeWakeLease {
930 name: req.name,
931
932 responder: ActivityGovernorTakeWakeLeaseResponder {
933 control_handle: std::mem::ManuallyDrop::new(control_handle),
934 tx_id: header.tx_id,
935 },
936 })
937 }
938 0x2de25abd8fa7c103 => {
939 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
940 let mut req = fidl::new_empty!(
941 ActivityGovernorAcquireWakeLeaseRequest,
942 fidl::encoding::DefaultFuchsiaResourceDialect
943 );
944 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorAcquireWakeLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
945 let control_handle =
946 ActivityGovernorControlHandle { inner: this.inner.clone() };
947 Ok(ActivityGovernorRequest::AcquireWakeLease {
948 name: req.name,
949
950 responder: ActivityGovernorAcquireWakeLeaseResponder {
951 control_handle: std::mem::ManuallyDrop::new(control_handle),
952 tx_id: header.tx_id,
953 },
954 })
955 }
956 0x1cdd2ea3bee46f51 => {
957 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
958 let mut req = fidl::new_empty!(
959 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
960 fidl::encoding::DefaultFuchsiaResourceDialect
961 );
962 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorAcquireWakeLeaseWithTokenRequest>(&header, _body_bytes, handles, &mut req)?;
963 let control_handle =
964 ActivityGovernorControlHandle { inner: this.inner.clone() };
965 Ok(ActivityGovernorRequest::AcquireWakeLeaseWithToken {
966 name: req.name,
967 server_token: req.server_token,
968
969 responder: ActivityGovernorAcquireWakeLeaseWithTokenResponder {
970 control_handle: std::mem::ManuallyDrop::new(control_handle),
971 tx_id: header.tx_id,
972 },
973 })
974 }
975 0x37cd5364de7ada14 => {
976 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
977 let mut req = fidl::new_empty!(
978 ActivityGovernorTakeApplicationActivityLeaseRequest,
979 fidl::encoding::DefaultFuchsiaResourceDialect
980 );
981 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorTakeApplicationActivityLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
982 let control_handle =
983 ActivityGovernorControlHandle { inner: this.inner.clone() };
984 Ok(ActivityGovernorRequest::TakeApplicationActivityLease {
985 name: req.name,
986
987 responder: ActivityGovernorTakeApplicationActivityLeaseResponder {
988 control_handle: std::mem::ManuallyDrop::new(control_handle),
989 tx_id: header.tx_id,
990 },
991 })
992 }
993 0x34ef55b180feef01 => {
994 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
995 let mut req = fidl::new_empty!(
996 ActivityGovernorRegisterSuspendBlockerRequest,
997 fidl::encoding::DefaultFuchsiaResourceDialect
998 );
999 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorRegisterSuspendBlockerRequest>(&header, _body_bytes, handles, &mut req)?;
1000 let control_handle =
1001 ActivityGovernorControlHandle { inner: this.inner.clone() };
1002 Ok(ActivityGovernorRequest::RegisterSuspendBlocker {
1003 payload: req,
1004 responder: ActivityGovernorRegisterSuspendBlockerResponder {
1005 control_handle: std::mem::ManuallyDrop::new(control_handle),
1006 tx_id: header.tx_id,
1007 },
1008 })
1009 }
1010 _ if header.tx_id == 0
1011 && header
1012 .dynamic_flags()
1013 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1014 {
1015 Ok(ActivityGovernorRequest::_UnknownMethod {
1016 ordinal: header.ordinal,
1017 control_handle: ActivityGovernorControlHandle {
1018 inner: this.inner.clone(),
1019 },
1020 method_type: fidl::MethodType::OneWay,
1021 })
1022 }
1023 _ if header
1024 .dynamic_flags()
1025 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1026 {
1027 this.inner.send_framework_err(
1028 fidl::encoding::FrameworkErr::UnknownMethod,
1029 header.tx_id,
1030 header.ordinal,
1031 header.dynamic_flags(),
1032 (bytes, handles),
1033 )?;
1034 Ok(ActivityGovernorRequest::_UnknownMethod {
1035 ordinal: header.ordinal,
1036 control_handle: ActivityGovernorControlHandle {
1037 inner: this.inner.clone(),
1038 },
1039 method_type: fidl::MethodType::TwoWay,
1040 })
1041 }
1042 _ => Err(fidl::Error::UnknownOrdinal {
1043 ordinal: header.ordinal,
1044 protocol_name:
1045 <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1046 }),
1047 }))
1048 },
1049 )
1050 }
1051}
1052
1053#[derive(Debug)]
1062pub enum ActivityGovernorRequest {
1063 GetPowerElements { responder: ActivityGovernorGetPowerElementsResponder },
1070 TakeWakeLease { name: String, responder: ActivityGovernorTakeWakeLeaseResponder },
1079 AcquireWakeLease { name: String, responder: ActivityGovernorAcquireWakeLeaseResponder },
1084 AcquireWakeLeaseWithToken {
1094 name: String,
1095 server_token: fidl::EventPair,
1096 responder: ActivityGovernorAcquireWakeLeaseWithTokenResponder,
1097 },
1098 TakeApplicationActivityLease {
1108 name: String,
1109 responder: ActivityGovernorTakeApplicationActivityLeaseResponder,
1110 },
1111 RegisterSuspendBlocker {
1127 payload: ActivityGovernorRegisterSuspendBlockerRequest,
1128 responder: ActivityGovernorRegisterSuspendBlockerResponder,
1129 },
1130 #[non_exhaustive]
1132 _UnknownMethod {
1133 ordinal: u64,
1135 control_handle: ActivityGovernorControlHandle,
1136 method_type: fidl::MethodType,
1137 },
1138}
1139
1140impl ActivityGovernorRequest {
1141 #[allow(irrefutable_let_patterns)]
1142 pub fn into_get_power_elements(self) -> Option<(ActivityGovernorGetPowerElementsResponder)> {
1143 if let ActivityGovernorRequest::GetPowerElements { responder } = self {
1144 Some((responder))
1145 } else {
1146 None
1147 }
1148 }
1149
1150 #[allow(irrefutable_let_patterns)]
1151 pub fn into_take_wake_lease(self) -> Option<(String, ActivityGovernorTakeWakeLeaseResponder)> {
1152 if let ActivityGovernorRequest::TakeWakeLease { name, responder } = self {
1153 Some((name, responder))
1154 } else {
1155 None
1156 }
1157 }
1158
1159 #[allow(irrefutable_let_patterns)]
1160 pub fn into_acquire_wake_lease(
1161 self,
1162 ) -> Option<(String, ActivityGovernorAcquireWakeLeaseResponder)> {
1163 if let ActivityGovernorRequest::AcquireWakeLease { name, responder } = self {
1164 Some((name, responder))
1165 } else {
1166 None
1167 }
1168 }
1169
1170 #[allow(irrefutable_let_patterns)]
1171 pub fn into_acquire_wake_lease_with_token(
1172 self,
1173 ) -> Option<(String, fidl::EventPair, ActivityGovernorAcquireWakeLeaseWithTokenResponder)> {
1174 if let ActivityGovernorRequest::AcquireWakeLeaseWithToken {
1175 name,
1176 server_token,
1177 responder,
1178 } = self
1179 {
1180 Some((name, server_token, responder))
1181 } else {
1182 None
1183 }
1184 }
1185
1186 #[allow(irrefutable_let_patterns)]
1187 pub fn into_take_application_activity_lease(
1188 self,
1189 ) -> Option<(String, ActivityGovernorTakeApplicationActivityLeaseResponder)> {
1190 if let ActivityGovernorRequest::TakeApplicationActivityLease { name, responder } = self {
1191 Some((name, responder))
1192 } else {
1193 None
1194 }
1195 }
1196
1197 #[allow(irrefutable_let_patterns)]
1198 pub fn into_register_suspend_blocker(
1199 self,
1200 ) -> Option<(
1201 ActivityGovernorRegisterSuspendBlockerRequest,
1202 ActivityGovernorRegisterSuspendBlockerResponder,
1203 )> {
1204 if let ActivityGovernorRequest::RegisterSuspendBlocker { payload, responder } = self {
1205 Some((payload, responder))
1206 } else {
1207 None
1208 }
1209 }
1210
1211 pub fn method_name(&self) -> &'static str {
1213 match *self {
1214 ActivityGovernorRequest::GetPowerElements { .. } => "get_power_elements",
1215 ActivityGovernorRequest::TakeWakeLease { .. } => "take_wake_lease",
1216 ActivityGovernorRequest::AcquireWakeLease { .. } => "acquire_wake_lease",
1217 ActivityGovernorRequest::AcquireWakeLeaseWithToken { .. } => {
1218 "acquire_wake_lease_with_token"
1219 }
1220 ActivityGovernorRequest::TakeApplicationActivityLease { .. } => {
1221 "take_application_activity_lease"
1222 }
1223 ActivityGovernorRequest::RegisterSuspendBlocker { .. } => "register_suspend_blocker",
1224 ActivityGovernorRequest::_UnknownMethod {
1225 method_type: fidl::MethodType::OneWay,
1226 ..
1227 } => "unknown one-way method",
1228 ActivityGovernorRequest::_UnknownMethod {
1229 method_type: fidl::MethodType::TwoWay,
1230 ..
1231 } => "unknown two-way method",
1232 }
1233 }
1234}
1235
1236#[derive(Debug, Clone)]
1237pub struct ActivityGovernorControlHandle {
1238 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1239}
1240
1241impl fidl::endpoints::ControlHandle for ActivityGovernorControlHandle {
1242 fn shutdown(&self) {
1243 self.inner.shutdown()
1244 }
1245 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1246 self.inner.shutdown_with_epitaph(status)
1247 }
1248
1249 fn is_closed(&self) -> bool {
1250 self.inner.channel().is_closed()
1251 }
1252 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1253 self.inner.channel().on_closed()
1254 }
1255
1256 #[cfg(target_os = "fuchsia")]
1257 fn signal_peer(
1258 &self,
1259 clear_mask: zx::Signals,
1260 set_mask: zx::Signals,
1261 ) -> Result<(), zx_status::Status> {
1262 use fidl::Peered;
1263 self.inner.channel().signal_peer(clear_mask, set_mask)
1264 }
1265}
1266
1267impl ActivityGovernorControlHandle {}
1268
1269#[must_use = "FIDL methods require a response to be sent"]
1270#[derive(Debug)]
1271pub struct ActivityGovernorGetPowerElementsResponder {
1272 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1273 tx_id: u32,
1274}
1275
1276impl std::ops::Drop for ActivityGovernorGetPowerElementsResponder {
1280 fn drop(&mut self) {
1281 self.control_handle.shutdown();
1282 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1284 }
1285}
1286
1287impl fidl::endpoints::Responder for ActivityGovernorGetPowerElementsResponder {
1288 type ControlHandle = ActivityGovernorControlHandle;
1289
1290 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1291 &self.control_handle
1292 }
1293
1294 fn drop_without_shutdown(mut self) {
1295 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1297 std::mem::forget(self);
1299 }
1300}
1301
1302impl ActivityGovernorGetPowerElementsResponder {
1303 pub fn send(self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1307 let _result = self.send_raw(payload);
1308 if _result.is_err() {
1309 self.control_handle.shutdown();
1310 }
1311 self.drop_without_shutdown();
1312 _result
1313 }
1314
1315 pub fn send_no_shutdown_on_err(self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1317 let _result = self.send_raw(payload);
1318 self.drop_without_shutdown();
1319 _result
1320 }
1321
1322 fn send_raw(&self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1323 self.control_handle.inner.send::<fidl::encoding::FlexibleType<PowerElements>>(
1324 fidl::encoding::Flexible::new(&mut payload),
1325 self.tx_id,
1326 0x798003259dfb5672,
1327 fidl::encoding::DynamicFlags::FLEXIBLE,
1328 )
1329 }
1330}
1331
1332#[must_use = "FIDL methods require a response to be sent"]
1333#[derive(Debug)]
1334pub struct ActivityGovernorTakeWakeLeaseResponder {
1335 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1336 tx_id: u32,
1337}
1338
1339impl std::ops::Drop for ActivityGovernorTakeWakeLeaseResponder {
1343 fn drop(&mut self) {
1344 self.control_handle.shutdown();
1345 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1347 }
1348}
1349
1350impl fidl::endpoints::Responder for ActivityGovernorTakeWakeLeaseResponder {
1351 type ControlHandle = ActivityGovernorControlHandle;
1352
1353 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1354 &self.control_handle
1355 }
1356
1357 fn drop_without_shutdown(mut self) {
1358 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1360 std::mem::forget(self);
1362 }
1363}
1364
1365impl ActivityGovernorTakeWakeLeaseResponder {
1366 pub fn send(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1370 let _result = self.send_raw(token);
1371 if _result.is_err() {
1372 self.control_handle.shutdown();
1373 }
1374 self.drop_without_shutdown();
1375 _result
1376 }
1377
1378 pub fn send_no_shutdown_on_err(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1380 let _result = self.send_raw(token);
1381 self.drop_without_shutdown();
1382 _result
1383 }
1384
1385 fn send_raw(&self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1386 self.control_handle
1387 .inner
1388 .send::<fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>>(
1389 fidl::encoding::Flexible::new((token,)),
1390 self.tx_id,
1391 0x291cfb42b2d3bf69,
1392 fidl::encoding::DynamicFlags::FLEXIBLE,
1393 )
1394 }
1395}
1396
1397#[must_use = "FIDL methods require a response to be sent"]
1398#[derive(Debug)]
1399pub struct ActivityGovernorAcquireWakeLeaseResponder {
1400 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1401 tx_id: u32,
1402}
1403
1404impl std::ops::Drop for ActivityGovernorAcquireWakeLeaseResponder {
1408 fn drop(&mut self) {
1409 self.control_handle.shutdown();
1410 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1412 }
1413}
1414
1415impl fidl::endpoints::Responder for ActivityGovernorAcquireWakeLeaseResponder {
1416 type ControlHandle = ActivityGovernorControlHandle;
1417
1418 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1419 &self.control_handle
1420 }
1421
1422 fn drop_without_shutdown(mut self) {
1423 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1425 std::mem::forget(self);
1427 }
1428}
1429
1430impl ActivityGovernorAcquireWakeLeaseResponder {
1431 pub fn send(
1435 self,
1436 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1437 ) -> Result<(), fidl::Error> {
1438 let _result = self.send_raw(result);
1439 if _result.is_err() {
1440 self.control_handle.shutdown();
1441 }
1442 self.drop_without_shutdown();
1443 _result
1444 }
1445
1446 pub fn send_no_shutdown_on_err(
1448 self,
1449 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1450 ) -> Result<(), fidl::Error> {
1451 let _result = self.send_raw(result);
1452 self.drop_without_shutdown();
1453 _result
1454 }
1455
1456 fn send_raw(
1457 &self,
1458 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1459 ) -> Result<(), fidl::Error> {
1460 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1461 ActivityGovernorAcquireWakeLeaseResponse,
1462 AcquireWakeLeaseError,
1463 >>(
1464 fidl::encoding::FlexibleResult::new(result.map(|token| (token,))),
1465 self.tx_id,
1466 0x2de25abd8fa7c103,
1467 fidl::encoding::DynamicFlags::FLEXIBLE,
1468 )
1469 }
1470}
1471
1472#[must_use = "FIDL methods require a response to be sent"]
1473#[derive(Debug)]
1474pub struct ActivityGovernorAcquireWakeLeaseWithTokenResponder {
1475 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1476 tx_id: u32,
1477}
1478
1479impl std::ops::Drop for ActivityGovernorAcquireWakeLeaseWithTokenResponder {
1483 fn drop(&mut self) {
1484 self.control_handle.shutdown();
1485 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1487 }
1488}
1489
1490impl fidl::endpoints::Responder for ActivityGovernorAcquireWakeLeaseWithTokenResponder {
1491 type ControlHandle = ActivityGovernorControlHandle;
1492
1493 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1494 &self.control_handle
1495 }
1496
1497 fn drop_without_shutdown(mut self) {
1498 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1500 std::mem::forget(self);
1502 }
1503}
1504
1505impl ActivityGovernorAcquireWakeLeaseWithTokenResponder {
1506 pub fn send(self, mut result: Result<(), AcquireWakeLeaseError>) -> Result<(), fidl::Error> {
1510 let _result = self.send_raw(result);
1511 if _result.is_err() {
1512 self.control_handle.shutdown();
1513 }
1514 self.drop_without_shutdown();
1515 _result
1516 }
1517
1518 pub fn send_no_shutdown_on_err(
1520 self,
1521 mut result: Result<(), AcquireWakeLeaseError>,
1522 ) -> Result<(), fidl::Error> {
1523 let _result = self.send_raw(result);
1524 self.drop_without_shutdown();
1525 _result
1526 }
1527
1528 fn send_raw(&self, mut result: Result<(), AcquireWakeLeaseError>) -> Result<(), fidl::Error> {
1529 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1530 fidl::encoding::EmptyStruct,
1531 AcquireWakeLeaseError,
1532 >>(
1533 fidl::encoding::FlexibleResult::new(result),
1534 self.tx_id,
1535 0x1cdd2ea3bee46f51,
1536 fidl::encoding::DynamicFlags::FLEXIBLE,
1537 )
1538 }
1539}
1540
1541#[must_use = "FIDL methods require a response to be sent"]
1542#[derive(Debug)]
1543pub struct ActivityGovernorTakeApplicationActivityLeaseResponder {
1544 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1545 tx_id: u32,
1546}
1547
1548impl std::ops::Drop for ActivityGovernorTakeApplicationActivityLeaseResponder {
1552 fn drop(&mut self) {
1553 self.control_handle.shutdown();
1554 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1556 }
1557}
1558
1559impl fidl::endpoints::Responder for ActivityGovernorTakeApplicationActivityLeaseResponder {
1560 type ControlHandle = ActivityGovernorControlHandle;
1561
1562 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1563 &self.control_handle
1564 }
1565
1566 fn drop_without_shutdown(mut self) {
1567 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569 std::mem::forget(self);
1571 }
1572}
1573
1574impl ActivityGovernorTakeApplicationActivityLeaseResponder {
1575 pub fn send(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1579 let _result = self.send_raw(token);
1580 if _result.is_err() {
1581 self.control_handle.shutdown();
1582 }
1583 self.drop_without_shutdown();
1584 _result
1585 }
1586
1587 pub fn send_no_shutdown_on_err(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1589 let _result = self.send_raw(token);
1590 self.drop_without_shutdown();
1591 _result
1592 }
1593
1594 fn send_raw(&self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1595 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
1596 ActivityGovernorTakeApplicationActivityLeaseResponse,
1597 >>(
1598 fidl::encoding::Flexible::new((token,)),
1599 self.tx_id,
1600 0x37cd5364de7ada14,
1601 fidl::encoding::DynamicFlags::FLEXIBLE,
1602 )
1603 }
1604}
1605
1606#[must_use = "FIDL methods require a response to be sent"]
1607#[derive(Debug)]
1608pub struct ActivityGovernorRegisterSuspendBlockerResponder {
1609 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1610 tx_id: u32,
1611}
1612
1613impl std::ops::Drop for ActivityGovernorRegisterSuspendBlockerResponder {
1617 fn drop(&mut self) {
1618 self.control_handle.shutdown();
1619 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1621 }
1622}
1623
1624impl fidl::endpoints::Responder for ActivityGovernorRegisterSuspendBlockerResponder {
1625 type ControlHandle = ActivityGovernorControlHandle;
1626
1627 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1628 &self.control_handle
1629 }
1630
1631 fn drop_without_shutdown(mut self) {
1632 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1634 std::mem::forget(self);
1636 }
1637}
1638
1639impl ActivityGovernorRegisterSuspendBlockerResponder {
1640 pub fn send(
1644 self,
1645 mut result: Result<fidl::EventPair, RegisterSuspendBlockerError>,
1646 ) -> Result<(), fidl::Error> {
1647 let _result = self.send_raw(result);
1648 if _result.is_err() {
1649 self.control_handle.shutdown();
1650 }
1651 self.drop_without_shutdown();
1652 _result
1653 }
1654
1655 pub fn send_no_shutdown_on_err(
1657 self,
1658 mut result: Result<fidl::EventPair, RegisterSuspendBlockerError>,
1659 ) -> Result<(), fidl::Error> {
1660 let _result = self.send_raw(result);
1661 self.drop_without_shutdown();
1662 _result
1663 }
1664
1665 fn send_raw(
1666 &self,
1667 mut result: Result<fidl::EventPair, RegisterSuspendBlockerError>,
1668 ) -> Result<(), fidl::Error> {
1669 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1670 ActivityGovernorRegisterSuspendBlockerResponse,
1671 RegisterSuspendBlockerError,
1672 >>(
1673 fidl::encoding::FlexibleResult::new(result.map(|token| (token,))),
1674 self.tx_id,
1675 0x34ef55b180feef01,
1676 fidl::encoding::DynamicFlags::FLEXIBLE,
1677 )
1678 }
1679}
1680
1681#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1682pub struct BootControlMarker;
1683
1684impl fidl::endpoints::ProtocolMarker for BootControlMarker {
1685 type Proxy = BootControlProxy;
1686 type RequestStream = BootControlRequestStream;
1687 #[cfg(target_os = "fuchsia")]
1688 type SynchronousProxy = BootControlSynchronousProxy;
1689
1690 const DEBUG_NAME: &'static str = "fuchsia.power.system.BootControl";
1691}
1692impl fidl::endpoints::DiscoverableProtocolMarker for BootControlMarker {}
1693
1694pub trait BootControlProxyInterface: Send + Sync {
1695 type SetBootCompleteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1696 fn r#set_boot_complete(&self) -> Self::SetBootCompleteResponseFut;
1697}
1698#[derive(Debug)]
1699#[cfg(target_os = "fuchsia")]
1700pub struct BootControlSynchronousProxy {
1701 client: fidl::client::sync::Client,
1702}
1703
1704#[cfg(target_os = "fuchsia")]
1705impl fidl::endpoints::SynchronousProxy for BootControlSynchronousProxy {
1706 type Proxy = BootControlProxy;
1707 type Protocol = BootControlMarker;
1708
1709 fn from_channel(inner: fidl::Channel) -> Self {
1710 Self::new(inner)
1711 }
1712
1713 fn into_channel(self) -> fidl::Channel {
1714 self.client.into_channel()
1715 }
1716
1717 fn as_channel(&self) -> &fidl::Channel {
1718 self.client.as_channel()
1719 }
1720}
1721
1722#[cfg(target_os = "fuchsia")]
1723impl BootControlSynchronousProxy {
1724 pub fn new(channel: fidl::Channel) -> Self {
1725 let protocol_name = <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1726 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1727 }
1728
1729 pub fn into_channel(self) -> fidl::Channel {
1730 self.client.into_channel()
1731 }
1732
1733 pub fn wait_for_event(
1736 &self,
1737 deadline: zx::MonotonicInstant,
1738 ) -> Result<BootControlEvent, fidl::Error> {
1739 BootControlEvent::decode(self.client.wait_for_event(deadline)?)
1740 }
1741
1742 pub fn r#set_boot_complete(
1745 &self,
1746 ___deadline: zx::MonotonicInstant,
1747 ) -> Result<(), fidl::Error> {
1748 let _response = self.client.send_query::<
1749 fidl::encoding::EmptyPayload,
1750 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1751 >(
1752 (),
1753 0x3c9b9f24ad3ca2b5,
1754 fidl::encoding::DynamicFlags::FLEXIBLE,
1755 ___deadline,
1756 )?
1757 .into_result::<BootControlMarker>("set_boot_complete")?;
1758 Ok(_response)
1759 }
1760}
1761
1762#[cfg(target_os = "fuchsia")]
1763impl From<BootControlSynchronousProxy> for zx::Handle {
1764 fn from(value: BootControlSynchronousProxy) -> Self {
1765 value.into_channel().into()
1766 }
1767}
1768
1769#[cfg(target_os = "fuchsia")]
1770impl From<fidl::Channel> for BootControlSynchronousProxy {
1771 fn from(value: fidl::Channel) -> Self {
1772 Self::new(value)
1773 }
1774}
1775
1776#[cfg(target_os = "fuchsia")]
1777impl fidl::endpoints::FromClient for BootControlSynchronousProxy {
1778 type Protocol = BootControlMarker;
1779
1780 fn from_client(value: fidl::endpoints::ClientEnd<BootControlMarker>) -> Self {
1781 Self::new(value.into_channel())
1782 }
1783}
1784
1785#[derive(Debug, Clone)]
1786pub struct BootControlProxy {
1787 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1788}
1789
1790impl fidl::endpoints::Proxy for BootControlProxy {
1791 type Protocol = BootControlMarker;
1792
1793 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1794 Self::new(inner)
1795 }
1796
1797 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1798 self.client.into_channel().map_err(|client| Self { client })
1799 }
1800
1801 fn as_channel(&self) -> &::fidl::AsyncChannel {
1802 self.client.as_channel()
1803 }
1804}
1805
1806impl BootControlProxy {
1807 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1809 let protocol_name = <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1810 Self { client: fidl::client::Client::new(channel, protocol_name) }
1811 }
1812
1813 pub fn take_event_stream(&self) -> BootControlEventStream {
1819 BootControlEventStream { event_receiver: self.client.take_event_receiver() }
1820 }
1821
1822 pub fn r#set_boot_complete(
1825 &self,
1826 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1827 BootControlProxyInterface::r#set_boot_complete(self)
1828 }
1829}
1830
1831impl BootControlProxyInterface for BootControlProxy {
1832 type SetBootCompleteResponseFut =
1833 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1834 fn r#set_boot_complete(&self) -> Self::SetBootCompleteResponseFut {
1835 fn _decode(
1836 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1837 ) -> Result<(), fidl::Error> {
1838 let _response = fidl::client::decode_transaction_body::<
1839 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1840 fidl::encoding::DefaultFuchsiaResourceDialect,
1841 0x3c9b9f24ad3ca2b5,
1842 >(_buf?)?
1843 .into_result::<BootControlMarker>("set_boot_complete")?;
1844 Ok(_response)
1845 }
1846 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1847 (),
1848 0x3c9b9f24ad3ca2b5,
1849 fidl::encoding::DynamicFlags::FLEXIBLE,
1850 _decode,
1851 )
1852 }
1853}
1854
1855pub struct BootControlEventStream {
1856 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1857}
1858
1859impl std::marker::Unpin for BootControlEventStream {}
1860
1861impl futures::stream::FusedStream for BootControlEventStream {
1862 fn is_terminated(&self) -> bool {
1863 self.event_receiver.is_terminated()
1864 }
1865}
1866
1867impl futures::Stream for BootControlEventStream {
1868 type Item = Result<BootControlEvent, fidl::Error>;
1869
1870 fn poll_next(
1871 mut self: std::pin::Pin<&mut Self>,
1872 cx: &mut std::task::Context<'_>,
1873 ) -> std::task::Poll<Option<Self::Item>> {
1874 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1875 &mut self.event_receiver,
1876 cx
1877 )?) {
1878 Some(buf) => std::task::Poll::Ready(Some(BootControlEvent::decode(buf))),
1879 None => std::task::Poll::Ready(None),
1880 }
1881 }
1882}
1883
1884#[derive(Debug)]
1885pub enum BootControlEvent {
1886 #[non_exhaustive]
1887 _UnknownEvent {
1888 ordinal: u64,
1890 },
1891}
1892
1893impl BootControlEvent {
1894 fn decode(
1896 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1897 ) -> Result<BootControlEvent, fidl::Error> {
1898 let (bytes, _handles) = buf.split_mut();
1899 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1900 debug_assert_eq!(tx_header.tx_id, 0);
1901 match tx_header.ordinal {
1902 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1903 Ok(BootControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1904 }
1905 _ => Err(fidl::Error::UnknownOrdinal {
1906 ordinal: tx_header.ordinal,
1907 protocol_name: <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1908 }),
1909 }
1910 }
1911}
1912
1913pub struct BootControlRequestStream {
1915 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1916 is_terminated: bool,
1917}
1918
1919impl std::marker::Unpin for BootControlRequestStream {}
1920
1921impl futures::stream::FusedStream for BootControlRequestStream {
1922 fn is_terminated(&self) -> bool {
1923 self.is_terminated
1924 }
1925}
1926
1927impl fidl::endpoints::RequestStream for BootControlRequestStream {
1928 type Protocol = BootControlMarker;
1929 type ControlHandle = BootControlControlHandle;
1930
1931 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1932 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1933 }
1934
1935 fn control_handle(&self) -> Self::ControlHandle {
1936 BootControlControlHandle { inner: self.inner.clone() }
1937 }
1938
1939 fn into_inner(
1940 self,
1941 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1942 {
1943 (self.inner, self.is_terminated)
1944 }
1945
1946 fn from_inner(
1947 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1948 is_terminated: bool,
1949 ) -> Self {
1950 Self { inner, is_terminated }
1951 }
1952}
1953
1954impl futures::Stream for BootControlRequestStream {
1955 type Item = Result<BootControlRequest, fidl::Error>;
1956
1957 fn poll_next(
1958 mut self: std::pin::Pin<&mut Self>,
1959 cx: &mut std::task::Context<'_>,
1960 ) -> std::task::Poll<Option<Self::Item>> {
1961 let this = &mut *self;
1962 if this.inner.check_shutdown(cx) {
1963 this.is_terminated = true;
1964 return std::task::Poll::Ready(None);
1965 }
1966 if this.is_terminated {
1967 panic!("polled BootControlRequestStream after completion");
1968 }
1969 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1970 |bytes, handles| {
1971 match this.inner.channel().read_etc(cx, bytes, handles) {
1972 std::task::Poll::Ready(Ok(())) => {}
1973 std::task::Poll::Pending => return std::task::Poll::Pending,
1974 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1975 this.is_terminated = true;
1976 return std::task::Poll::Ready(None);
1977 }
1978 std::task::Poll::Ready(Err(e)) => {
1979 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1980 e.into(),
1981 ))));
1982 }
1983 }
1984
1985 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1987
1988 std::task::Poll::Ready(Some(match header.ordinal {
1989 0x3c9b9f24ad3ca2b5 => {
1990 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1991 let mut req = fidl::new_empty!(
1992 fidl::encoding::EmptyPayload,
1993 fidl::encoding::DefaultFuchsiaResourceDialect
1994 );
1995 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1996 let control_handle = BootControlControlHandle { inner: this.inner.clone() };
1997 Ok(BootControlRequest::SetBootComplete {
1998 responder: BootControlSetBootCompleteResponder {
1999 control_handle: std::mem::ManuallyDrop::new(control_handle),
2000 tx_id: header.tx_id,
2001 },
2002 })
2003 }
2004 _ if header.tx_id == 0
2005 && header
2006 .dynamic_flags()
2007 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2008 {
2009 Ok(BootControlRequest::_UnknownMethod {
2010 ordinal: header.ordinal,
2011 control_handle: BootControlControlHandle { inner: this.inner.clone() },
2012 method_type: fidl::MethodType::OneWay,
2013 })
2014 }
2015 _ if header
2016 .dynamic_flags()
2017 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2018 {
2019 this.inner.send_framework_err(
2020 fidl::encoding::FrameworkErr::UnknownMethod,
2021 header.tx_id,
2022 header.ordinal,
2023 header.dynamic_flags(),
2024 (bytes, handles),
2025 )?;
2026 Ok(BootControlRequest::_UnknownMethod {
2027 ordinal: header.ordinal,
2028 control_handle: BootControlControlHandle { inner: this.inner.clone() },
2029 method_type: fidl::MethodType::TwoWay,
2030 })
2031 }
2032 _ => Err(fidl::Error::UnknownOrdinal {
2033 ordinal: header.ordinal,
2034 protocol_name:
2035 <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2036 }),
2037 }))
2038 },
2039 )
2040 }
2041}
2042
2043#[derive(Debug)]
2045pub enum BootControlRequest {
2046 SetBootComplete { responder: BootControlSetBootCompleteResponder },
2049 #[non_exhaustive]
2051 _UnknownMethod {
2052 ordinal: u64,
2054 control_handle: BootControlControlHandle,
2055 method_type: fidl::MethodType,
2056 },
2057}
2058
2059impl BootControlRequest {
2060 #[allow(irrefutable_let_patterns)]
2061 pub fn into_set_boot_complete(self) -> Option<(BootControlSetBootCompleteResponder)> {
2062 if let BootControlRequest::SetBootComplete { responder } = self {
2063 Some((responder))
2064 } else {
2065 None
2066 }
2067 }
2068
2069 pub fn method_name(&self) -> &'static str {
2071 match *self {
2072 BootControlRequest::SetBootComplete { .. } => "set_boot_complete",
2073 BootControlRequest::_UnknownMethod {
2074 method_type: fidl::MethodType::OneWay, ..
2075 } => "unknown one-way method",
2076 BootControlRequest::_UnknownMethod {
2077 method_type: fidl::MethodType::TwoWay, ..
2078 } => "unknown two-way method",
2079 }
2080 }
2081}
2082
2083#[derive(Debug, Clone)]
2084pub struct BootControlControlHandle {
2085 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2086}
2087
2088impl fidl::endpoints::ControlHandle for BootControlControlHandle {
2089 fn shutdown(&self) {
2090 self.inner.shutdown()
2091 }
2092 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2093 self.inner.shutdown_with_epitaph(status)
2094 }
2095
2096 fn is_closed(&self) -> bool {
2097 self.inner.channel().is_closed()
2098 }
2099 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2100 self.inner.channel().on_closed()
2101 }
2102
2103 #[cfg(target_os = "fuchsia")]
2104 fn signal_peer(
2105 &self,
2106 clear_mask: zx::Signals,
2107 set_mask: zx::Signals,
2108 ) -> Result<(), zx_status::Status> {
2109 use fidl::Peered;
2110 self.inner.channel().signal_peer(clear_mask, set_mask)
2111 }
2112}
2113
2114impl BootControlControlHandle {}
2115
2116#[must_use = "FIDL methods require a response to be sent"]
2117#[derive(Debug)]
2118pub struct BootControlSetBootCompleteResponder {
2119 control_handle: std::mem::ManuallyDrop<BootControlControlHandle>,
2120 tx_id: u32,
2121}
2122
2123impl std::ops::Drop for BootControlSetBootCompleteResponder {
2127 fn drop(&mut self) {
2128 self.control_handle.shutdown();
2129 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2131 }
2132}
2133
2134impl fidl::endpoints::Responder for BootControlSetBootCompleteResponder {
2135 type ControlHandle = BootControlControlHandle;
2136
2137 fn control_handle(&self) -> &BootControlControlHandle {
2138 &self.control_handle
2139 }
2140
2141 fn drop_without_shutdown(mut self) {
2142 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2144 std::mem::forget(self);
2146 }
2147}
2148
2149impl BootControlSetBootCompleteResponder {
2150 pub fn send(self) -> Result<(), fidl::Error> {
2154 let _result = self.send_raw();
2155 if _result.is_err() {
2156 self.control_handle.shutdown();
2157 }
2158 self.drop_without_shutdown();
2159 _result
2160 }
2161
2162 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2164 let _result = self.send_raw();
2165 self.drop_without_shutdown();
2166 _result
2167 }
2168
2169 fn send_raw(&self) -> Result<(), fidl::Error> {
2170 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2171 fidl::encoding::Flexible::new(()),
2172 self.tx_id,
2173 0x3c9b9f24ad3ca2b5,
2174 fidl::encoding::DynamicFlags::FLEXIBLE,
2175 )
2176 }
2177}
2178
2179#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2180pub struct CpuElementManagerMarker;
2181
2182impl fidl::endpoints::ProtocolMarker for CpuElementManagerMarker {
2183 type Proxy = CpuElementManagerProxy;
2184 type RequestStream = CpuElementManagerRequestStream;
2185 #[cfg(target_os = "fuchsia")]
2186 type SynchronousProxy = CpuElementManagerSynchronousProxy;
2187
2188 const DEBUG_NAME: &'static str = "fuchsia.power.system.CpuElementManager";
2189}
2190impl fidl::endpoints::DiscoverableProtocolMarker for CpuElementManagerMarker {}
2191pub type CpuElementManagerAddExecutionStateDependencyResult =
2192 Result<(), AddExecutionStateDependencyError>;
2193
2194pub trait CpuElementManagerProxyInterface: Send + Sync {
2195 type GetCpuDependencyTokenResponseFut: std::future::Future<Output = Result<Cpu, fidl::Error>>
2196 + Send;
2197 fn r#get_cpu_dependency_token(&self) -> Self::GetCpuDependencyTokenResponseFut;
2198 type AddExecutionStateDependencyResponseFut: std::future::Future<
2199 Output = Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error>,
2200 > + Send;
2201 fn r#add_execution_state_dependency(
2202 &self,
2203 payload: CpuElementManagerAddExecutionStateDependencyRequest,
2204 ) -> Self::AddExecutionStateDependencyResponseFut;
2205}
2206#[derive(Debug)]
2207#[cfg(target_os = "fuchsia")]
2208pub struct CpuElementManagerSynchronousProxy {
2209 client: fidl::client::sync::Client,
2210}
2211
2212#[cfg(target_os = "fuchsia")]
2213impl fidl::endpoints::SynchronousProxy for CpuElementManagerSynchronousProxy {
2214 type Proxy = CpuElementManagerProxy;
2215 type Protocol = CpuElementManagerMarker;
2216
2217 fn from_channel(inner: fidl::Channel) -> Self {
2218 Self::new(inner)
2219 }
2220
2221 fn into_channel(self) -> fidl::Channel {
2222 self.client.into_channel()
2223 }
2224
2225 fn as_channel(&self) -> &fidl::Channel {
2226 self.client.as_channel()
2227 }
2228}
2229
2230#[cfg(target_os = "fuchsia")]
2231impl CpuElementManagerSynchronousProxy {
2232 pub fn new(channel: fidl::Channel) -> Self {
2233 let protocol_name =
2234 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2235 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2236 }
2237
2238 pub fn into_channel(self) -> fidl::Channel {
2239 self.client.into_channel()
2240 }
2241
2242 pub fn wait_for_event(
2245 &self,
2246 deadline: zx::MonotonicInstant,
2247 ) -> Result<CpuElementManagerEvent, fidl::Error> {
2248 CpuElementManagerEvent::decode(self.client.wait_for_event(deadline)?)
2249 }
2250
2251 pub fn r#get_cpu_dependency_token(
2253 &self,
2254 ___deadline: zx::MonotonicInstant,
2255 ) -> Result<Cpu, fidl::Error> {
2256 let _response = self
2257 .client
2258 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleType<Cpu>>(
2259 (),
2260 0x2c43645ed70344ba,
2261 fidl::encoding::DynamicFlags::FLEXIBLE,
2262 ___deadline,
2263 )?
2264 .into_result::<CpuElementManagerMarker>("get_cpu_dependency_token")?;
2265 Ok(_response)
2266 }
2267
2268 pub fn r#add_execution_state_dependency(
2278 &self,
2279 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
2280 ___deadline: zx::MonotonicInstant,
2281 ) -> Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error> {
2282 let _response = self.client.send_query::<
2283 CpuElementManagerAddExecutionStateDependencyRequest,
2284 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddExecutionStateDependencyError>,
2285 >(
2286 &mut payload,
2287 0xdf2f5ea2af76234,
2288 fidl::encoding::DynamicFlags::FLEXIBLE,
2289 ___deadline,
2290 )?
2291 .into_result::<CpuElementManagerMarker>("add_execution_state_dependency")?;
2292 Ok(_response.map(|x| x))
2293 }
2294}
2295
2296#[cfg(target_os = "fuchsia")]
2297impl From<CpuElementManagerSynchronousProxy> for zx::Handle {
2298 fn from(value: CpuElementManagerSynchronousProxy) -> Self {
2299 value.into_channel().into()
2300 }
2301}
2302
2303#[cfg(target_os = "fuchsia")]
2304impl From<fidl::Channel> for CpuElementManagerSynchronousProxy {
2305 fn from(value: fidl::Channel) -> Self {
2306 Self::new(value)
2307 }
2308}
2309
2310#[cfg(target_os = "fuchsia")]
2311impl fidl::endpoints::FromClient for CpuElementManagerSynchronousProxy {
2312 type Protocol = CpuElementManagerMarker;
2313
2314 fn from_client(value: fidl::endpoints::ClientEnd<CpuElementManagerMarker>) -> Self {
2315 Self::new(value.into_channel())
2316 }
2317}
2318
2319#[derive(Debug, Clone)]
2320pub struct CpuElementManagerProxy {
2321 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2322}
2323
2324impl fidl::endpoints::Proxy for CpuElementManagerProxy {
2325 type Protocol = CpuElementManagerMarker;
2326
2327 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2328 Self::new(inner)
2329 }
2330
2331 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2332 self.client.into_channel().map_err(|client| Self { client })
2333 }
2334
2335 fn as_channel(&self) -> &::fidl::AsyncChannel {
2336 self.client.as_channel()
2337 }
2338}
2339
2340impl CpuElementManagerProxy {
2341 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2343 let protocol_name =
2344 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2345 Self { client: fidl::client::Client::new(channel, protocol_name) }
2346 }
2347
2348 pub fn take_event_stream(&self) -> CpuElementManagerEventStream {
2354 CpuElementManagerEventStream { event_receiver: self.client.take_event_receiver() }
2355 }
2356
2357 pub fn r#get_cpu_dependency_token(
2359 &self,
2360 ) -> fidl::client::QueryResponseFut<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect> {
2361 CpuElementManagerProxyInterface::r#get_cpu_dependency_token(self)
2362 }
2363
2364 pub fn r#add_execution_state_dependency(
2374 &self,
2375 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
2376 ) -> fidl::client::QueryResponseFut<
2377 CpuElementManagerAddExecutionStateDependencyResult,
2378 fidl::encoding::DefaultFuchsiaResourceDialect,
2379 > {
2380 CpuElementManagerProxyInterface::r#add_execution_state_dependency(self, payload)
2381 }
2382}
2383
2384impl CpuElementManagerProxyInterface for CpuElementManagerProxy {
2385 type GetCpuDependencyTokenResponseFut =
2386 fidl::client::QueryResponseFut<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect>;
2387 fn r#get_cpu_dependency_token(&self) -> Self::GetCpuDependencyTokenResponseFut {
2388 fn _decode(
2389 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2390 ) -> Result<Cpu, fidl::Error> {
2391 let _response = fidl::client::decode_transaction_body::<
2392 fidl::encoding::FlexibleType<Cpu>,
2393 fidl::encoding::DefaultFuchsiaResourceDialect,
2394 0x2c43645ed70344ba,
2395 >(_buf?)?
2396 .into_result::<CpuElementManagerMarker>("get_cpu_dependency_token")?;
2397 Ok(_response)
2398 }
2399 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Cpu>(
2400 (),
2401 0x2c43645ed70344ba,
2402 fidl::encoding::DynamicFlags::FLEXIBLE,
2403 _decode,
2404 )
2405 }
2406
2407 type AddExecutionStateDependencyResponseFut = fidl::client::QueryResponseFut<
2408 CpuElementManagerAddExecutionStateDependencyResult,
2409 fidl::encoding::DefaultFuchsiaResourceDialect,
2410 >;
2411 fn r#add_execution_state_dependency(
2412 &self,
2413 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
2414 ) -> Self::AddExecutionStateDependencyResponseFut {
2415 fn _decode(
2416 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2417 ) -> Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error> {
2418 let _response = fidl::client::decode_transaction_body::<
2419 fidl::encoding::FlexibleResultType<
2420 fidl::encoding::EmptyStruct,
2421 AddExecutionStateDependencyError,
2422 >,
2423 fidl::encoding::DefaultFuchsiaResourceDialect,
2424 0xdf2f5ea2af76234,
2425 >(_buf?)?
2426 .into_result::<CpuElementManagerMarker>("add_execution_state_dependency")?;
2427 Ok(_response.map(|x| x))
2428 }
2429 self.client.send_query_and_decode::<
2430 CpuElementManagerAddExecutionStateDependencyRequest,
2431 CpuElementManagerAddExecutionStateDependencyResult,
2432 >(
2433 &mut payload,
2434 0xdf2f5ea2af76234,
2435 fidl::encoding::DynamicFlags::FLEXIBLE,
2436 _decode,
2437 )
2438 }
2439}
2440
2441pub struct CpuElementManagerEventStream {
2442 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2443}
2444
2445impl std::marker::Unpin for CpuElementManagerEventStream {}
2446
2447impl futures::stream::FusedStream for CpuElementManagerEventStream {
2448 fn is_terminated(&self) -> bool {
2449 self.event_receiver.is_terminated()
2450 }
2451}
2452
2453impl futures::Stream for CpuElementManagerEventStream {
2454 type Item = Result<CpuElementManagerEvent, fidl::Error>;
2455
2456 fn poll_next(
2457 mut self: std::pin::Pin<&mut Self>,
2458 cx: &mut std::task::Context<'_>,
2459 ) -> std::task::Poll<Option<Self::Item>> {
2460 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2461 &mut self.event_receiver,
2462 cx
2463 )?) {
2464 Some(buf) => std::task::Poll::Ready(Some(CpuElementManagerEvent::decode(buf))),
2465 None => std::task::Poll::Ready(None),
2466 }
2467 }
2468}
2469
2470#[derive(Debug)]
2471pub enum CpuElementManagerEvent {
2472 #[non_exhaustive]
2473 _UnknownEvent {
2474 ordinal: u64,
2476 },
2477}
2478
2479impl CpuElementManagerEvent {
2480 fn decode(
2482 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2483 ) -> Result<CpuElementManagerEvent, fidl::Error> {
2484 let (bytes, _handles) = buf.split_mut();
2485 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2486 debug_assert_eq!(tx_header.tx_id, 0);
2487 match tx_header.ordinal {
2488 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2489 Ok(CpuElementManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2490 }
2491 _ => Err(fidl::Error::UnknownOrdinal {
2492 ordinal: tx_header.ordinal,
2493 protocol_name:
2494 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2495 }),
2496 }
2497 }
2498}
2499
2500pub struct CpuElementManagerRequestStream {
2502 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2503 is_terminated: bool,
2504}
2505
2506impl std::marker::Unpin for CpuElementManagerRequestStream {}
2507
2508impl futures::stream::FusedStream for CpuElementManagerRequestStream {
2509 fn is_terminated(&self) -> bool {
2510 self.is_terminated
2511 }
2512}
2513
2514impl fidl::endpoints::RequestStream for CpuElementManagerRequestStream {
2515 type Protocol = CpuElementManagerMarker;
2516 type ControlHandle = CpuElementManagerControlHandle;
2517
2518 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2519 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2520 }
2521
2522 fn control_handle(&self) -> Self::ControlHandle {
2523 CpuElementManagerControlHandle { inner: self.inner.clone() }
2524 }
2525
2526 fn into_inner(
2527 self,
2528 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2529 {
2530 (self.inner, self.is_terminated)
2531 }
2532
2533 fn from_inner(
2534 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2535 is_terminated: bool,
2536 ) -> Self {
2537 Self { inner, is_terminated }
2538 }
2539}
2540
2541impl futures::Stream for CpuElementManagerRequestStream {
2542 type Item = Result<CpuElementManagerRequest, fidl::Error>;
2543
2544 fn poll_next(
2545 mut self: std::pin::Pin<&mut Self>,
2546 cx: &mut std::task::Context<'_>,
2547 ) -> std::task::Poll<Option<Self::Item>> {
2548 let this = &mut *self;
2549 if this.inner.check_shutdown(cx) {
2550 this.is_terminated = true;
2551 return std::task::Poll::Ready(None);
2552 }
2553 if this.is_terminated {
2554 panic!("polled CpuElementManagerRequestStream after completion");
2555 }
2556 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2557 |bytes, handles| {
2558 match this.inner.channel().read_etc(cx, bytes, handles) {
2559 std::task::Poll::Ready(Ok(())) => {}
2560 std::task::Poll::Pending => return std::task::Poll::Pending,
2561 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2562 this.is_terminated = true;
2563 return std::task::Poll::Ready(None);
2564 }
2565 std::task::Poll::Ready(Err(e)) => {
2566 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2567 e.into(),
2568 ))));
2569 }
2570 }
2571
2572 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2574
2575 std::task::Poll::Ready(Some(match header.ordinal {
2576 0x2c43645ed70344ba => {
2577 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2578 let mut req = fidl::new_empty!(
2579 fidl::encoding::EmptyPayload,
2580 fidl::encoding::DefaultFuchsiaResourceDialect
2581 );
2582 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2583 let control_handle =
2584 CpuElementManagerControlHandle { inner: this.inner.clone() };
2585 Ok(CpuElementManagerRequest::GetCpuDependencyToken {
2586 responder: CpuElementManagerGetCpuDependencyTokenResponder {
2587 control_handle: std::mem::ManuallyDrop::new(control_handle),
2588 tx_id: header.tx_id,
2589 },
2590 })
2591 }
2592 0xdf2f5ea2af76234 => {
2593 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2594 let mut req = fidl::new_empty!(
2595 CpuElementManagerAddExecutionStateDependencyRequest,
2596 fidl::encoding::DefaultFuchsiaResourceDialect
2597 );
2598 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CpuElementManagerAddExecutionStateDependencyRequest>(&header, _body_bytes, handles, &mut req)?;
2599 let control_handle =
2600 CpuElementManagerControlHandle { inner: this.inner.clone() };
2601 Ok(CpuElementManagerRequest::AddExecutionStateDependency {
2602 payload: req,
2603 responder: CpuElementManagerAddExecutionStateDependencyResponder {
2604 control_handle: std::mem::ManuallyDrop::new(control_handle),
2605 tx_id: header.tx_id,
2606 },
2607 })
2608 }
2609 _ if header.tx_id == 0
2610 && header
2611 .dynamic_flags()
2612 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2613 {
2614 Ok(CpuElementManagerRequest::_UnknownMethod {
2615 ordinal: header.ordinal,
2616 control_handle: CpuElementManagerControlHandle {
2617 inner: this.inner.clone(),
2618 },
2619 method_type: fidl::MethodType::OneWay,
2620 })
2621 }
2622 _ if header
2623 .dynamic_flags()
2624 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2625 {
2626 this.inner.send_framework_err(
2627 fidl::encoding::FrameworkErr::UnknownMethod,
2628 header.tx_id,
2629 header.ordinal,
2630 header.dynamic_flags(),
2631 (bytes, handles),
2632 )?;
2633 Ok(CpuElementManagerRequest::_UnknownMethod {
2634 ordinal: header.ordinal,
2635 control_handle: CpuElementManagerControlHandle {
2636 inner: this.inner.clone(),
2637 },
2638 method_type: fidl::MethodType::TwoWay,
2639 })
2640 }
2641 _ => Err(fidl::Error::UnknownOrdinal {
2642 ordinal: header.ordinal,
2643 protocol_name:
2644 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2645 }),
2646 }))
2647 },
2648 )
2649 }
2650}
2651
2652#[derive(Debug)]
2654pub enum CpuElementManagerRequest {
2655 GetCpuDependencyToken { responder: CpuElementManagerGetCpuDependencyTokenResponder },
2657 AddExecutionStateDependency {
2667 payload: CpuElementManagerAddExecutionStateDependencyRequest,
2668 responder: CpuElementManagerAddExecutionStateDependencyResponder,
2669 },
2670 #[non_exhaustive]
2672 _UnknownMethod {
2673 ordinal: u64,
2675 control_handle: CpuElementManagerControlHandle,
2676 method_type: fidl::MethodType,
2677 },
2678}
2679
2680impl CpuElementManagerRequest {
2681 #[allow(irrefutable_let_patterns)]
2682 pub fn into_get_cpu_dependency_token(
2683 self,
2684 ) -> Option<(CpuElementManagerGetCpuDependencyTokenResponder)> {
2685 if let CpuElementManagerRequest::GetCpuDependencyToken { responder } = self {
2686 Some((responder))
2687 } else {
2688 None
2689 }
2690 }
2691
2692 #[allow(irrefutable_let_patterns)]
2693 pub fn into_add_execution_state_dependency(
2694 self,
2695 ) -> Option<(
2696 CpuElementManagerAddExecutionStateDependencyRequest,
2697 CpuElementManagerAddExecutionStateDependencyResponder,
2698 )> {
2699 if let CpuElementManagerRequest::AddExecutionStateDependency { payload, responder } = self {
2700 Some((payload, responder))
2701 } else {
2702 None
2703 }
2704 }
2705
2706 pub fn method_name(&self) -> &'static str {
2708 match *self {
2709 CpuElementManagerRequest::GetCpuDependencyToken { .. } => "get_cpu_dependency_token",
2710 CpuElementManagerRequest::AddExecutionStateDependency { .. } => {
2711 "add_execution_state_dependency"
2712 }
2713 CpuElementManagerRequest::_UnknownMethod {
2714 method_type: fidl::MethodType::OneWay,
2715 ..
2716 } => "unknown one-way method",
2717 CpuElementManagerRequest::_UnknownMethod {
2718 method_type: fidl::MethodType::TwoWay,
2719 ..
2720 } => "unknown two-way method",
2721 }
2722 }
2723}
2724
2725#[derive(Debug, Clone)]
2726pub struct CpuElementManagerControlHandle {
2727 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2728}
2729
2730impl fidl::endpoints::ControlHandle for CpuElementManagerControlHandle {
2731 fn shutdown(&self) {
2732 self.inner.shutdown()
2733 }
2734 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2735 self.inner.shutdown_with_epitaph(status)
2736 }
2737
2738 fn is_closed(&self) -> bool {
2739 self.inner.channel().is_closed()
2740 }
2741 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2742 self.inner.channel().on_closed()
2743 }
2744
2745 #[cfg(target_os = "fuchsia")]
2746 fn signal_peer(
2747 &self,
2748 clear_mask: zx::Signals,
2749 set_mask: zx::Signals,
2750 ) -> Result<(), zx_status::Status> {
2751 use fidl::Peered;
2752 self.inner.channel().signal_peer(clear_mask, set_mask)
2753 }
2754}
2755
2756impl CpuElementManagerControlHandle {}
2757
2758#[must_use = "FIDL methods require a response to be sent"]
2759#[derive(Debug)]
2760pub struct CpuElementManagerGetCpuDependencyTokenResponder {
2761 control_handle: std::mem::ManuallyDrop<CpuElementManagerControlHandle>,
2762 tx_id: u32,
2763}
2764
2765impl std::ops::Drop for CpuElementManagerGetCpuDependencyTokenResponder {
2769 fn drop(&mut self) {
2770 self.control_handle.shutdown();
2771 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2773 }
2774}
2775
2776impl fidl::endpoints::Responder for CpuElementManagerGetCpuDependencyTokenResponder {
2777 type ControlHandle = CpuElementManagerControlHandle;
2778
2779 fn control_handle(&self) -> &CpuElementManagerControlHandle {
2780 &self.control_handle
2781 }
2782
2783 fn drop_without_shutdown(mut self) {
2784 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2786 std::mem::forget(self);
2788 }
2789}
2790
2791impl CpuElementManagerGetCpuDependencyTokenResponder {
2792 pub fn send(self, mut payload: Cpu) -> Result<(), fidl::Error> {
2796 let _result = self.send_raw(payload);
2797 if _result.is_err() {
2798 self.control_handle.shutdown();
2799 }
2800 self.drop_without_shutdown();
2801 _result
2802 }
2803
2804 pub fn send_no_shutdown_on_err(self, mut payload: Cpu) -> Result<(), fidl::Error> {
2806 let _result = self.send_raw(payload);
2807 self.drop_without_shutdown();
2808 _result
2809 }
2810
2811 fn send_raw(&self, mut payload: Cpu) -> Result<(), fidl::Error> {
2812 self.control_handle.inner.send::<fidl::encoding::FlexibleType<Cpu>>(
2813 fidl::encoding::Flexible::new(&mut payload),
2814 self.tx_id,
2815 0x2c43645ed70344ba,
2816 fidl::encoding::DynamicFlags::FLEXIBLE,
2817 )
2818 }
2819}
2820
2821#[must_use = "FIDL methods require a response to be sent"]
2822#[derive(Debug)]
2823pub struct CpuElementManagerAddExecutionStateDependencyResponder {
2824 control_handle: std::mem::ManuallyDrop<CpuElementManagerControlHandle>,
2825 tx_id: u32,
2826}
2827
2828impl std::ops::Drop for CpuElementManagerAddExecutionStateDependencyResponder {
2832 fn drop(&mut self) {
2833 self.control_handle.shutdown();
2834 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2836 }
2837}
2838
2839impl fidl::endpoints::Responder for CpuElementManagerAddExecutionStateDependencyResponder {
2840 type ControlHandle = CpuElementManagerControlHandle;
2841
2842 fn control_handle(&self) -> &CpuElementManagerControlHandle {
2843 &self.control_handle
2844 }
2845
2846 fn drop_without_shutdown(mut self) {
2847 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2849 std::mem::forget(self);
2851 }
2852}
2853
2854impl CpuElementManagerAddExecutionStateDependencyResponder {
2855 pub fn send(
2859 self,
2860 mut result: Result<(), AddExecutionStateDependencyError>,
2861 ) -> Result<(), fidl::Error> {
2862 let _result = self.send_raw(result);
2863 if _result.is_err() {
2864 self.control_handle.shutdown();
2865 }
2866 self.drop_without_shutdown();
2867 _result
2868 }
2869
2870 pub fn send_no_shutdown_on_err(
2872 self,
2873 mut result: Result<(), AddExecutionStateDependencyError>,
2874 ) -> Result<(), fidl::Error> {
2875 let _result = self.send_raw(result);
2876 self.drop_without_shutdown();
2877 _result
2878 }
2879
2880 fn send_raw(
2881 &self,
2882 mut result: Result<(), AddExecutionStateDependencyError>,
2883 ) -> Result<(), fidl::Error> {
2884 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2885 fidl::encoding::EmptyStruct,
2886 AddExecutionStateDependencyError,
2887 >>(
2888 fidl::encoding::FlexibleResult::new(result),
2889 self.tx_id,
2890 0xdf2f5ea2af76234,
2891 fidl::encoding::DynamicFlags::FLEXIBLE,
2892 )
2893 }
2894}
2895
2896#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2897pub struct SuspendBlockerMarker;
2898
2899impl fidl::endpoints::ProtocolMarker for SuspendBlockerMarker {
2900 type Proxy = SuspendBlockerProxy;
2901 type RequestStream = SuspendBlockerRequestStream;
2902 #[cfg(target_os = "fuchsia")]
2903 type SynchronousProxy = SuspendBlockerSynchronousProxy;
2904
2905 const DEBUG_NAME: &'static str = "(anonymous) SuspendBlocker";
2906}
2907
2908pub trait SuspendBlockerProxyInterface: Send + Sync {
2909 type BeforeSuspendResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2910 fn r#before_suspend(&self) -> Self::BeforeSuspendResponseFut;
2911 type AfterResumeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2912 fn r#after_resume(&self) -> Self::AfterResumeResponseFut;
2913}
2914#[derive(Debug)]
2915#[cfg(target_os = "fuchsia")]
2916pub struct SuspendBlockerSynchronousProxy {
2917 client: fidl::client::sync::Client,
2918}
2919
2920#[cfg(target_os = "fuchsia")]
2921impl fidl::endpoints::SynchronousProxy for SuspendBlockerSynchronousProxy {
2922 type Proxy = SuspendBlockerProxy;
2923 type Protocol = SuspendBlockerMarker;
2924
2925 fn from_channel(inner: fidl::Channel) -> Self {
2926 Self::new(inner)
2927 }
2928
2929 fn into_channel(self) -> fidl::Channel {
2930 self.client.into_channel()
2931 }
2932
2933 fn as_channel(&self) -> &fidl::Channel {
2934 self.client.as_channel()
2935 }
2936}
2937
2938#[cfg(target_os = "fuchsia")]
2939impl SuspendBlockerSynchronousProxy {
2940 pub fn new(channel: fidl::Channel) -> Self {
2941 let protocol_name = <SuspendBlockerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2942 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2943 }
2944
2945 pub fn into_channel(self) -> fidl::Channel {
2946 self.client.into_channel()
2947 }
2948
2949 pub fn wait_for_event(
2952 &self,
2953 deadline: zx::MonotonicInstant,
2954 ) -> Result<SuspendBlockerEvent, fidl::Error> {
2955 SuspendBlockerEvent::decode(self.client.wait_for_event(deadline)?)
2956 }
2957
2958 pub fn r#before_suspend(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2980 let _response = self.client.send_query::<
2981 fidl::encoding::EmptyPayload,
2982 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2983 >(
2984 (),
2985 0x6b569393a01a6d80,
2986 fidl::encoding::DynamicFlags::FLEXIBLE,
2987 ___deadline,
2988 )?
2989 .into_result::<SuspendBlockerMarker>("before_suspend")?;
2990 Ok(_response)
2991 }
2992
2993 pub fn r#after_resume(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
3004 let _response = self.client.send_query::<
3005 fidl::encoding::EmptyPayload,
3006 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3007 >(
3008 (),
3009 0x6a329cfcc73f2dea,
3010 fidl::encoding::DynamicFlags::FLEXIBLE,
3011 ___deadline,
3012 )?
3013 .into_result::<SuspendBlockerMarker>("after_resume")?;
3014 Ok(_response)
3015 }
3016}
3017
3018#[cfg(target_os = "fuchsia")]
3019impl From<SuspendBlockerSynchronousProxy> for zx::Handle {
3020 fn from(value: SuspendBlockerSynchronousProxy) -> Self {
3021 value.into_channel().into()
3022 }
3023}
3024
3025#[cfg(target_os = "fuchsia")]
3026impl From<fidl::Channel> for SuspendBlockerSynchronousProxy {
3027 fn from(value: fidl::Channel) -> Self {
3028 Self::new(value)
3029 }
3030}
3031
3032#[cfg(target_os = "fuchsia")]
3033impl fidl::endpoints::FromClient for SuspendBlockerSynchronousProxy {
3034 type Protocol = SuspendBlockerMarker;
3035
3036 fn from_client(value: fidl::endpoints::ClientEnd<SuspendBlockerMarker>) -> Self {
3037 Self::new(value.into_channel())
3038 }
3039}
3040
3041#[derive(Debug, Clone)]
3042pub struct SuspendBlockerProxy {
3043 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3044}
3045
3046impl fidl::endpoints::Proxy for SuspendBlockerProxy {
3047 type Protocol = SuspendBlockerMarker;
3048
3049 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3050 Self::new(inner)
3051 }
3052
3053 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3054 self.client.into_channel().map_err(|client| Self { client })
3055 }
3056
3057 fn as_channel(&self) -> &::fidl::AsyncChannel {
3058 self.client.as_channel()
3059 }
3060}
3061
3062impl SuspendBlockerProxy {
3063 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3065 let protocol_name = <SuspendBlockerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3066 Self { client: fidl::client::Client::new(channel, protocol_name) }
3067 }
3068
3069 pub fn take_event_stream(&self) -> SuspendBlockerEventStream {
3075 SuspendBlockerEventStream { event_receiver: self.client.take_event_receiver() }
3076 }
3077
3078 pub fn r#before_suspend(
3100 &self,
3101 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3102 SuspendBlockerProxyInterface::r#before_suspend(self)
3103 }
3104
3105 pub fn r#after_resume(
3116 &self,
3117 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3118 SuspendBlockerProxyInterface::r#after_resume(self)
3119 }
3120}
3121
3122impl SuspendBlockerProxyInterface for SuspendBlockerProxy {
3123 type BeforeSuspendResponseFut =
3124 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3125 fn r#before_suspend(&self) -> Self::BeforeSuspendResponseFut {
3126 fn _decode(
3127 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3128 ) -> Result<(), fidl::Error> {
3129 let _response = fidl::client::decode_transaction_body::<
3130 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3131 fidl::encoding::DefaultFuchsiaResourceDialect,
3132 0x6b569393a01a6d80,
3133 >(_buf?)?
3134 .into_result::<SuspendBlockerMarker>("before_suspend")?;
3135 Ok(_response)
3136 }
3137 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
3138 (),
3139 0x6b569393a01a6d80,
3140 fidl::encoding::DynamicFlags::FLEXIBLE,
3141 _decode,
3142 )
3143 }
3144
3145 type AfterResumeResponseFut =
3146 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3147 fn r#after_resume(&self) -> Self::AfterResumeResponseFut {
3148 fn _decode(
3149 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3150 ) -> Result<(), fidl::Error> {
3151 let _response = fidl::client::decode_transaction_body::<
3152 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3153 fidl::encoding::DefaultFuchsiaResourceDialect,
3154 0x6a329cfcc73f2dea,
3155 >(_buf?)?
3156 .into_result::<SuspendBlockerMarker>("after_resume")?;
3157 Ok(_response)
3158 }
3159 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
3160 (),
3161 0x6a329cfcc73f2dea,
3162 fidl::encoding::DynamicFlags::FLEXIBLE,
3163 _decode,
3164 )
3165 }
3166}
3167
3168pub struct SuspendBlockerEventStream {
3169 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3170}
3171
3172impl std::marker::Unpin for SuspendBlockerEventStream {}
3173
3174impl futures::stream::FusedStream for SuspendBlockerEventStream {
3175 fn is_terminated(&self) -> bool {
3176 self.event_receiver.is_terminated()
3177 }
3178}
3179
3180impl futures::Stream for SuspendBlockerEventStream {
3181 type Item = Result<SuspendBlockerEvent, fidl::Error>;
3182
3183 fn poll_next(
3184 mut self: std::pin::Pin<&mut Self>,
3185 cx: &mut std::task::Context<'_>,
3186 ) -> std::task::Poll<Option<Self::Item>> {
3187 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3188 &mut self.event_receiver,
3189 cx
3190 )?) {
3191 Some(buf) => std::task::Poll::Ready(Some(SuspendBlockerEvent::decode(buf))),
3192 None => std::task::Poll::Ready(None),
3193 }
3194 }
3195}
3196
3197#[derive(Debug)]
3198pub enum SuspendBlockerEvent {
3199 #[non_exhaustive]
3200 _UnknownEvent {
3201 ordinal: u64,
3203 },
3204}
3205
3206impl SuspendBlockerEvent {
3207 fn decode(
3209 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3210 ) -> Result<SuspendBlockerEvent, fidl::Error> {
3211 let (bytes, _handles) = buf.split_mut();
3212 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3213 debug_assert_eq!(tx_header.tx_id, 0);
3214 match tx_header.ordinal {
3215 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3216 Ok(SuspendBlockerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3217 }
3218 _ => Err(fidl::Error::UnknownOrdinal {
3219 ordinal: tx_header.ordinal,
3220 protocol_name:
3221 <SuspendBlockerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3222 }),
3223 }
3224 }
3225}
3226
3227pub struct SuspendBlockerRequestStream {
3229 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3230 is_terminated: bool,
3231}
3232
3233impl std::marker::Unpin for SuspendBlockerRequestStream {}
3234
3235impl futures::stream::FusedStream for SuspendBlockerRequestStream {
3236 fn is_terminated(&self) -> bool {
3237 self.is_terminated
3238 }
3239}
3240
3241impl fidl::endpoints::RequestStream for SuspendBlockerRequestStream {
3242 type Protocol = SuspendBlockerMarker;
3243 type ControlHandle = SuspendBlockerControlHandle;
3244
3245 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3246 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3247 }
3248
3249 fn control_handle(&self) -> Self::ControlHandle {
3250 SuspendBlockerControlHandle { inner: self.inner.clone() }
3251 }
3252
3253 fn into_inner(
3254 self,
3255 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3256 {
3257 (self.inner, self.is_terminated)
3258 }
3259
3260 fn from_inner(
3261 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3262 is_terminated: bool,
3263 ) -> Self {
3264 Self { inner, is_terminated }
3265 }
3266}
3267
3268impl futures::Stream for SuspendBlockerRequestStream {
3269 type Item = Result<SuspendBlockerRequest, fidl::Error>;
3270
3271 fn poll_next(
3272 mut self: std::pin::Pin<&mut Self>,
3273 cx: &mut std::task::Context<'_>,
3274 ) -> std::task::Poll<Option<Self::Item>> {
3275 let this = &mut *self;
3276 if this.inner.check_shutdown(cx) {
3277 this.is_terminated = true;
3278 return std::task::Poll::Ready(None);
3279 }
3280 if this.is_terminated {
3281 panic!("polled SuspendBlockerRequestStream after completion");
3282 }
3283 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3284 |bytes, handles| {
3285 match this.inner.channel().read_etc(cx, bytes, handles) {
3286 std::task::Poll::Ready(Ok(())) => {}
3287 std::task::Poll::Pending => return std::task::Poll::Pending,
3288 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3289 this.is_terminated = true;
3290 return std::task::Poll::Ready(None);
3291 }
3292 std::task::Poll::Ready(Err(e)) => {
3293 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3294 e.into(),
3295 ))));
3296 }
3297 }
3298
3299 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3301
3302 std::task::Poll::Ready(Some(match header.ordinal {
3303 0x6b569393a01a6d80 => {
3304 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3305 let mut req = fidl::new_empty!(
3306 fidl::encoding::EmptyPayload,
3307 fidl::encoding::DefaultFuchsiaResourceDialect
3308 );
3309 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3310 let control_handle =
3311 SuspendBlockerControlHandle { inner: this.inner.clone() };
3312 Ok(SuspendBlockerRequest::BeforeSuspend {
3313 responder: SuspendBlockerBeforeSuspendResponder {
3314 control_handle: std::mem::ManuallyDrop::new(control_handle),
3315 tx_id: header.tx_id,
3316 },
3317 })
3318 }
3319 0x6a329cfcc73f2dea => {
3320 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3321 let mut req = fidl::new_empty!(
3322 fidl::encoding::EmptyPayload,
3323 fidl::encoding::DefaultFuchsiaResourceDialect
3324 );
3325 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3326 let control_handle =
3327 SuspendBlockerControlHandle { inner: this.inner.clone() };
3328 Ok(SuspendBlockerRequest::AfterResume {
3329 responder: SuspendBlockerAfterResumeResponder {
3330 control_handle: std::mem::ManuallyDrop::new(control_handle),
3331 tx_id: header.tx_id,
3332 },
3333 })
3334 }
3335 _ if header.tx_id == 0
3336 && header
3337 .dynamic_flags()
3338 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3339 {
3340 Ok(SuspendBlockerRequest::_UnknownMethod {
3341 ordinal: header.ordinal,
3342 control_handle: SuspendBlockerControlHandle {
3343 inner: this.inner.clone(),
3344 },
3345 method_type: fidl::MethodType::OneWay,
3346 })
3347 }
3348 _ if header
3349 .dynamic_flags()
3350 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3351 {
3352 this.inner.send_framework_err(
3353 fidl::encoding::FrameworkErr::UnknownMethod,
3354 header.tx_id,
3355 header.ordinal,
3356 header.dynamic_flags(),
3357 (bytes, handles),
3358 )?;
3359 Ok(SuspendBlockerRequest::_UnknownMethod {
3360 ordinal: header.ordinal,
3361 control_handle: SuspendBlockerControlHandle {
3362 inner: this.inner.clone(),
3363 },
3364 method_type: fidl::MethodType::TwoWay,
3365 })
3366 }
3367 _ => Err(fidl::Error::UnknownOrdinal {
3368 ordinal: header.ordinal,
3369 protocol_name:
3370 <SuspendBlockerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3371 }),
3372 }))
3373 },
3374 )
3375 }
3376}
3377
3378#[derive(Debug)]
3381pub enum SuspendBlockerRequest {
3382 BeforeSuspend { responder: SuspendBlockerBeforeSuspendResponder },
3404 AfterResume { responder: SuspendBlockerAfterResumeResponder },
3415 #[non_exhaustive]
3417 _UnknownMethod {
3418 ordinal: u64,
3420 control_handle: SuspendBlockerControlHandle,
3421 method_type: fidl::MethodType,
3422 },
3423}
3424
3425impl SuspendBlockerRequest {
3426 #[allow(irrefutable_let_patterns)]
3427 pub fn into_before_suspend(self) -> Option<(SuspendBlockerBeforeSuspendResponder)> {
3428 if let SuspendBlockerRequest::BeforeSuspend { responder } = self {
3429 Some((responder))
3430 } else {
3431 None
3432 }
3433 }
3434
3435 #[allow(irrefutable_let_patterns)]
3436 pub fn into_after_resume(self) -> Option<(SuspendBlockerAfterResumeResponder)> {
3437 if let SuspendBlockerRequest::AfterResume { responder } = self {
3438 Some((responder))
3439 } else {
3440 None
3441 }
3442 }
3443
3444 pub fn method_name(&self) -> &'static str {
3446 match *self {
3447 SuspendBlockerRequest::BeforeSuspend { .. } => "before_suspend",
3448 SuspendBlockerRequest::AfterResume { .. } => "after_resume",
3449 SuspendBlockerRequest::_UnknownMethod {
3450 method_type: fidl::MethodType::OneWay, ..
3451 } => "unknown one-way method",
3452 SuspendBlockerRequest::_UnknownMethod {
3453 method_type: fidl::MethodType::TwoWay, ..
3454 } => "unknown two-way method",
3455 }
3456 }
3457}
3458
3459#[derive(Debug, Clone)]
3460pub struct SuspendBlockerControlHandle {
3461 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3462}
3463
3464impl fidl::endpoints::ControlHandle for SuspendBlockerControlHandle {
3465 fn shutdown(&self) {
3466 self.inner.shutdown()
3467 }
3468 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3469 self.inner.shutdown_with_epitaph(status)
3470 }
3471
3472 fn is_closed(&self) -> bool {
3473 self.inner.channel().is_closed()
3474 }
3475 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3476 self.inner.channel().on_closed()
3477 }
3478
3479 #[cfg(target_os = "fuchsia")]
3480 fn signal_peer(
3481 &self,
3482 clear_mask: zx::Signals,
3483 set_mask: zx::Signals,
3484 ) -> Result<(), zx_status::Status> {
3485 use fidl::Peered;
3486 self.inner.channel().signal_peer(clear_mask, set_mask)
3487 }
3488}
3489
3490impl SuspendBlockerControlHandle {}
3491
3492#[must_use = "FIDL methods require a response to be sent"]
3493#[derive(Debug)]
3494pub struct SuspendBlockerBeforeSuspendResponder {
3495 control_handle: std::mem::ManuallyDrop<SuspendBlockerControlHandle>,
3496 tx_id: u32,
3497}
3498
3499impl std::ops::Drop for SuspendBlockerBeforeSuspendResponder {
3503 fn drop(&mut self) {
3504 self.control_handle.shutdown();
3505 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3507 }
3508}
3509
3510impl fidl::endpoints::Responder for SuspendBlockerBeforeSuspendResponder {
3511 type ControlHandle = SuspendBlockerControlHandle;
3512
3513 fn control_handle(&self) -> &SuspendBlockerControlHandle {
3514 &self.control_handle
3515 }
3516
3517 fn drop_without_shutdown(mut self) {
3518 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3520 std::mem::forget(self);
3522 }
3523}
3524
3525impl SuspendBlockerBeforeSuspendResponder {
3526 pub fn send(self) -> Result<(), fidl::Error> {
3530 let _result = self.send_raw();
3531 if _result.is_err() {
3532 self.control_handle.shutdown();
3533 }
3534 self.drop_without_shutdown();
3535 _result
3536 }
3537
3538 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3540 let _result = self.send_raw();
3541 self.drop_without_shutdown();
3542 _result
3543 }
3544
3545 fn send_raw(&self) -> Result<(), fidl::Error> {
3546 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3547 fidl::encoding::Flexible::new(()),
3548 self.tx_id,
3549 0x6b569393a01a6d80,
3550 fidl::encoding::DynamicFlags::FLEXIBLE,
3551 )
3552 }
3553}
3554
3555#[must_use = "FIDL methods require a response to be sent"]
3556#[derive(Debug)]
3557pub struct SuspendBlockerAfterResumeResponder {
3558 control_handle: std::mem::ManuallyDrop<SuspendBlockerControlHandle>,
3559 tx_id: u32,
3560}
3561
3562impl std::ops::Drop for SuspendBlockerAfterResumeResponder {
3566 fn drop(&mut self) {
3567 self.control_handle.shutdown();
3568 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3570 }
3571}
3572
3573impl fidl::endpoints::Responder for SuspendBlockerAfterResumeResponder {
3574 type ControlHandle = SuspendBlockerControlHandle;
3575
3576 fn control_handle(&self) -> &SuspendBlockerControlHandle {
3577 &self.control_handle
3578 }
3579
3580 fn drop_without_shutdown(mut self) {
3581 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3583 std::mem::forget(self);
3585 }
3586}
3587
3588impl SuspendBlockerAfterResumeResponder {
3589 pub fn send(self) -> Result<(), fidl::Error> {
3593 let _result = self.send_raw();
3594 if _result.is_err() {
3595 self.control_handle.shutdown();
3596 }
3597 self.drop_without_shutdown();
3598 _result
3599 }
3600
3601 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3603 let _result = self.send_raw();
3604 self.drop_without_shutdown();
3605 _result
3606 }
3607
3608 fn send_raw(&self) -> Result<(), fidl::Error> {
3609 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3610 fidl::encoding::Flexible::new(()),
3611 self.tx_id,
3612 0x6a329cfcc73f2dea,
3613 fidl::encoding::DynamicFlags::FLEXIBLE,
3614 )
3615 }
3616}
3617
3618mod internal {
3619 use super::*;
3620
3621 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorAcquireWakeLeaseWithTokenRequest {
3622 type Borrowed<'a> = &'a mut Self;
3623 fn take_or_borrow<'a>(
3624 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3625 ) -> Self::Borrowed<'a> {
3626 value
3627 }
3628 }
3629
3630 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireWakeLeaseWithTokenRequest {
3631 type Owned = Self;
3632
3633 #[inline(always)]
3634 fn inline_align(_context: fidl::encoding::Context) -> usize {
3635 8
3636 }
3637
3638 #[inline(always)]
3639 fn inline_size(_context: fidl::encoding::Context) -> usize {
3640 24
3641 }
3642 }
3643
3644 unsafe impl
3645 fidl::encoding::Encode<
3646 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
3647 fidl::encoding::DefaultFuchsiaResourceDialect,
3648 > for &mut ActivityGovernorAcquireWakeLeaseWithTokenRequest
3649 {
3650 #[inline]
3651 unsafe fn encode(
3652 self,
3653 encoder: &mut fidl::encoding::Encoder<
3654 '_,
3655 fidl::encoding::DefaultFuchsiaResourceDialect,
3656 >,
3657 offset: usize,
3658 _depth: fidl::encoding::Depth,
3659 ) -> fidl::Result<()> {
3660 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseWithTokenRequest>(offset);
3661 fidl::encoding::Encode::<
3663 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
3664 fidl::encoding::DefaultFuchsiaResourceDialect,
3665 >::encode(
3666 (
3667 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
3668 &self.name,
3669 ),
3670 <fidl::encoding::HandleType<
3671 fidl::EventPair,
3672 { fidl::ObjectType::EVENTPAIR.into_raw() },
3673 16387,
3674 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3675 &mut self.server_token,
3676 ),
3677 ),
3678 encoder,
3679 offset,
3680 _depth,
3681 )
3682 }
3683 }
3684 unsafe impl<
3685 T0: fidl::encoding::Encode<
3686 fidl::encoding::BoundedString<64>,
3687 fidl::encoding::DefaultFuchsiaResourceDialect,
3688 >,
3689 T1: fidl::encoding::Encode<
3690 fidl::encoding::HandleType<
3691 fidl::EventPair,
3692 { fidl::ObjectType::EVENTPAIR.into_raw() },
3693 16387,
3694 >,
3695 fidl::encoding::DefaultFuchsiaResourceDialect,
3696 >,
3697 >
3698 fidl::encoding::Encode<
3699 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
3700 fidl::encoding::DefaultFuchsiaResourceDialect,
3701 > for (T0, T1)
3702 {
3703 #[inline]
3704 unsafe fn encode(
3705 self,
3706 encoder: &mut fidl::encoding::Encoder<
3707 '_,
3708 fidl::encoding::DefaultFuchsiaResourceDialect,
3709 >,
3710 offset: usize,
3711 depth: fidl::encoding::Depth,
3712 ) -> fidl::Result<()> {
3713 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseWithTokenRequest>(offset);
3714 unsafe {
3717 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3718 (ptr as *mut u64).write_unaligned(0);
3719 }
3720 self.0.encode(encoder, offset + 0, depth)?;
3722 self.1.encode(encoder, offset + 16, depth)?;
3723 Ok(())
3724 }
3725 }
3726
3727 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3728 for ActivityGovernorAcquireWakeLeaseWithTokenRequest
3729 {
3730 #[inline(always)]
3731 fn new_empty() -> Self {
3732 Self {
3733 name: fidl::new_empty!(
3734 fidl::encoding::BoundedString<64>,
3735 fidl::encoding::DefaultFuchsiaResourceDialect
3736 ),
3737 server_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
3738 }
3739 }
3740
3741 #[inline]
3742 unsafe fn decode(
3743 &mut self,
3744 decoder: &mut fidl::encoding::Decoder<
3745 '_,
3746 fidl::encoding::DefaultFuchsiaResourceDialect,
3747 >,
3748 offset: usize,
3749 _depth: fidl::encoding::Depth,
3750 ) -> fidl::Result<()> {
3751 decoder.debug_check_bounds::<Self>(offset);
3752 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3754 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3755 let mask = 0xffffffff00000000u64;
3756 let maskedval = padval & mask;
3757 if maskedval != 0 {
3758 return Err(fidl::Error::NonZeroPadding {
3759 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3760 });
3761 }
3762 fidl::decode!(
3763 fidl::encoding::BoundedString<64>,
3764 fidl::encoding::DefaultFuchsiaResourceDialect,
3765 &mut self.name,
3766 decoder,
3767 offset + 0,
3768 _depth
3769 )?;
3770 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_token, decoder, offset + 16, _depth)?;
3771 Ok(())
3772 }
3773 }
3774
3775 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorAcquireWakeLeaseResponse {
3776 type Borrowed<'a> = &'a mut Self;
3777 fn take_or_borrow<'a>(
3778 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3779 ) -> Self::Borrowed<'a> {
3780 value
3781 }
3782 }
3783
3784 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireWakeLeaseResponse {
3785 type Owned = Self;
3786
3787 #[inline(always)]
3788 fn inline_align(_context: fidl::encoding::Context) -> usize {
3789 4
3790 }
3791
3792 #[inline(always)]
3793 fn inline_size(_context: fidl::encoding::Context) -> usize {
3794 4
3795 }
3796 }
3797
3798 unsafe impl
3799 fidl::encoding::Encode<
3800 ActivityGovernorAcquireWakeLeaseResponse,
3801 fidl::encoding::DefaultFuchsiaResourceDialect,
3802 > for &mut ActivityGovernorAcquireWakeLeaseResponse
3803 {
3804 #[inline]
3805 unsafe fn encode(
3806 self,
3807 encoder: &mut fidl::encoding::Encoder<
3808 '_,
3809 fidl::encoding::DefaultFuchsiaResourceDialect,
3810 >,
3811 offset: usize,
3812 _depth: fidl::encoding::Depth,
3813 ) -> fidl::Result<()> {
3814 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseResponse>(offset);
3815 fidl::encoding::Encode::<
3817 ActivityGovernorAcquireWakeLeaseResponse,
3818 fidl::encoding::DefaultFuchsiaResourceDialect,
3819 >::encode(
3820 (<fidl::encoding::HandleType<
3821 fidl::EventPair,
3822 { fidl::ObjectType::EVENTPAIR.into_raw() },
3823 16387,
3824 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3825 &mut self.token
3826 ),),
3827 encoder,
3828 offset,
3829 _depth,
3830 )
3831 }
3832 }
3833 unsafe impl<
3834 T0: fidl::encoding::Encode<
3835 fidl::encoding::HandleType<
3836 fidl::EventPair,
3837 { fidl::ObjectType::EVENTPAIR.into_raw() },
3838 16387,
3839 >,
3840 fidl::encoding::DefaultFuchsiaResourceDialect,
3841 >,
3842 >
3843 fidl::encoding::Encode<
3844 ActivityGovernorAcquireWakeLeaseResponse,
3845 fidl::encoding::DefaultFuchsiaResourceDialect,
3846 > for (T0,)
3847 {
3848 #[inline]
3849 unsafe fn encode(
3850 self,
3851 encoder: &mut fidl::encoding::Encoder<
3852 '_,
3853 fidl::encoding::DefaultFuchsiaResourceDialect,
3854 >,
3855 offset: usize,
3856 depth: fidl::encoding::Depth,
3857 ) -> fidl::Result<()> {
3858 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseResponse>(offset);
3859 self.0.encode(encoder, offset + 0, depth)?;
3863 Ok(())
3864 }
3865 }
3866
3867 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3868 for ActivityGovernorAcquireWakeLeaseResponse
3869 {
3870 #[inline(always)]
3871 fn new_empty() -> Self {
3872 Self {
3873 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
3874 }
3875 }
3876
3877 #[inline]
3878 unsafe fn decode(
3879 &mut self,
3880 decoder: &mut fidl::encoding::Decoder<
3881 '_,
3882 fidl::encoding::DefaultFuchsiaResourceDialect,
3883 >,
3884 offset: usize,
3885 _depth: fidl::encoding::Depth,
3886 ) -> fidl::Result<()> {
3887 decoder.debug_check_bounds::<Self>(offset);
3888 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
3890 Ok(())
3891 }
3892 }
3893
3894 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorRegisterSuspendBlockerResponse {
3895 type Borrowed<'a> = &'a mut Self;
3896 fn take_or_borrow<'a>(
3897 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3898 ) -> Self::Borrowed<'a> {
3899 value
3900 }
3901 }
3902
3903 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorRegisterSuspendBlockerResponse {
3904 type Owned = Self;
3905
3906 #[inline(always)]
3907 fn inline_align(_context: fidl::encoding::Context) -> usize {
3908 4
3909 }
3910
3911 #[inline(always)]
3912 fn inline_size(_context: fidl::encoding::Context) -> usize {
3913 4
3914 }
3915 }
3916
3917 unsafe impl
3918 fidl::encoding::Encode<
3919 ActivityGovernorRegisterSuspendBlockerResponse,
3920 fidl::encoding::DefaultFuchsiaResourceDialect,
3921 > for &mut ActivityGovernorRegisterSuspendBlockerResponse
3922 {
3923 #[inline]
3924 unsafe fn encode(
3925 self,
3926 encoder: &mut fidl::encoding::Encoder<
3927 '_,
3928 fidl::encoding::DefaultFuchsiaResourceDialect,
3929 >,
3930 offset: usize,
3931 _depth: fidl::encoding::Depth,
3932 ) -> fidl::Result<()> {
3933 encoder.debug_check_bounds::<ActivityGovernorRegisterSuspendBlockerResponse>(offset);
3934 fidl::encoding::Encode::<
3936 ActivityGovernorRegisterSuspendBlockerResponse,
3937 fidl::encoding::DefaultFuchsiaResourceDialect,
3938 >::encode(
3939 (<fidl::encoding::HandleType<
3940 fidl::EventPair,
3941 { fidl::ObjectType::EVENTPAIR.into_raw() },
3942 16387,
3943 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3944 &mut self.token
3945 ),),
3946 encoder,
3947 offset,
3948 _depth,
3949 )
3950 }
3951 }
3952 unsafe impl<
3953 T0: fidl::encoding::Encode<
3954 fidl::encoding::HandleType<
3955 fidl::EventPair,
3956 { fidl::ObjectType::EVENTPAIR.into_raw() },
3957 16387,
3958 >,
3959 fidl::encoding::DefaultFuchsiaResourceDialect,
3960 >,
3961 >
3962 fidl::encoding::Encode<
3963 ActivityGovernorRegisterSuspendBlockerResponse,
3964 fidl::encoding::DefaultFuchsiaResourceDialect,
3965 > for (T0,)
3966 {
3967 #[inline]
3968 unsafe fn encode(
3969 self,
3970 encoder: &mut fidl::encoding::Encoder<
3971 '_,
3972 fidl::encoding::DefaultFuchsiaResourceDialect,
3973 >,
3974 offset: usize,
3975 depth: fidl::encoding::Depth,
3976 ) -> fidl::Result<()> {
3977 encoder.debug_check_bounds::<ActivityGovernorRegisterSuspendBlockerResponse>(offset);
3978 self.0.encode(encoder, offset + 0, depth)?;
3982 Ok(())
3983 }
3984 }
3985
3986 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3987 for ActivityGovernorRegisterSuspendBlockerResponse
3988 {
3989 #[inline(always)]
3990 fn new_empty() -> Self {
3991 Self {
3992 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
3993 }
3994 }
3995
3996 #[inline]
3997 unsafe fn decode(
3998 &mut self,
3999 decoder: &mut fidl::encoding::Decoder<
4000 '_,
4001 fidl::encoding::DefaultFuchsiaResourceDialect,
4002 >,
4003 offset: usize,
4004 _depth: fidl::encoding::Depth,
4005 ) -> fidl::Result<()> {
4006 decoder.debug_check_bounds::<Self>(offset);
4007 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4009 Ok(())
4010 }
4011 }
4012
4013 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorTakeApplicationActivityLeaseResponse {
4014 type Borrowed<'a> = &'a mut Self;
4015 fn take_or_borrow<'a>(
4016 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4017 ) -> Self::Borrowed<'a> {
4018 value
4019 }
4020 }
4021
4022 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeApplicationActivityLeaseResponse {
4023 type Owned = Self;
4024
4025 #[inline(always)]
4026 fn inline_align(_context: fidl::encoding::Context) -> usize {
4027 4
4028 }
4029
4030 #[inline(always)]
4031 fn inline_size(_context: fidl::encoding::Context) -> usize {
4032 4
4033 }
4034 }
4035
4036 unsafe impl
4037 fidl::encoding::Encode<
4038 ActivityGovernorTakeApplicationActivityLeaseResponse,
4039 fidl::encoding::DefaultFuchsiaResourceDialect,
4040 > for &mut ActivityGovernorTakeApplicationActivityLeaseResponse
4041 {
4042 #[inline]
4043 unsafe fn encode(
4044 self,
4045 encoder: &mut fidl::encoding::Encoder<
4046 '_,
4047 fidl::encoding::DefaultFuchsiaResourceDialect,
4048 >,
4049 offset: usize,
4050 _depth: fidl::encoding::Depth,
4051 ) -> fidl::Result<()> {
4052 encoder
4053 .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseResponse>(offset);
4054 fidl::encoding::Encode::<
4056 ActivityGovernorTakeApplicationActivityLeaseResponse,
4057 fidl::encoding::DefaultFuchsiaResourceDialect,
4058 >::encode(
4059 (<fidl::encoding::HandleType<
4060 fidl::EventPair,
4061 { fidl::ObjectType::EVENTPAIR.into_raw() },
4062 16387,
4063 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4064 &mut self.token
4065 ),),
4066 encoder,
4067 offset,
4068 _depth,
4069 )
4070 }
4071 }
4072 unsafe impl<
4073 T0: fidl::encoding::Encode<
4074 fidl::encoding::HandleType<
4075 fidl::EventPair,
4076 { fidl::ObjectType::EVENTPAIR.into_raw() },
4077 16387,
4078 >,
4079 fidl::encoding::DefaultFuchsiaResourceDialect,
4080 >,
4081 >
4082 fidl::encoding::Encode<
4083 ActivityGovernorTakeApplicationActivityLeaseResponse,
4084 fidl::encoding::DefaultFuchsiaResourceDialect,
4085 > for (T0,)
4086 {
4087 #[inline]
4088 unsafe fn encode(
4089 self,
4090 encoder: &mut fidl::encoding::Encoder<
4091 '_,
4092 fidl::encoding::DefaultFuchsiaResourceDialect,
4093 >,
4094 offset: usize,
4095 depth: fidl::encoding::Depth,
4096 ) -> fidl::Result<()> {
4097 encoder
4098 .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseResponse>(offset);
4099 self.0.encode(encoder, offset + 0, depth)?;
4103 Ok(())
4104 }
4105 }
4106
4107 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4108 for ActivityGovernorTakeApplicationActivityLeaseResponse
4109 {
4110 #[inline(always)]
4111 fn new_empty() -> Self {
4112 Self {
4113 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
4114 }
4115 }
4116
4117 #[inline]
4118 unsafe fn decode(
4119 &mut self,
4120 decoder: &mut fidl::encoding::Decoder<
4121 '_,
4122 fidl::encoding::DefaultFuchsiaResourceDialect,
4123 >,
4124 offset: usize,
4125 _depth: fidl::encoding::Depth,
4126 ) -> fidl::Result<()> {
4127 decoder.debug_check_bounds::<Self>(offset);
4128 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4130 Ok(())
4131 }
4132 }
4133
4134 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorTakeWakeLeaseResponse {
4135 type Borrowed<'a> = &'a mut Self;
4136 fn take_or_borrow<'a>(
4137 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4138 ) -> Self::Borrowed<'a> {
4139 value
4140 }
4141 }
4142
4143 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeWakeLeaseResponse {
4144 type Owned = Self;
4145
4146 #[inline(always)]
4147 fn inline_align(_context: fidl::encoding::Context) -> usize {
4148 4
4149 }
4150
4151 #[inline(always)]
4152 fn inline_size(_context: fidl::encoding::Context) -> usize {
4153 4
4154 }
4155 }
4156
4157 unsafe impl
4158 fidl::encoding::Encode<
4159 ActivityGovernorTakeWakeLeaseResponse,
4160 fidl::encoding::DefaultFuchsiaResourceDialect,
4161 > for &mut ActivityGovernorTakeWakeLeaseResponse
4162 {
4163 #[inline]
4164 unsafe fn encode(
4165 self,
4166 encoder: &mut fidl::encoding::Encoder<
4167 '_,
4168 fidl::encoding::DefaultFuchsiaResourceDialect,
4169 >,
4170 offset: usize,
4171 _depth: fidl::encoding::Depth,
4172 ) -> fidl::Result<()> {
4173 encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseResponse>(offset);
4174 fidl::encoding::Encode::<
4176 ActivityGovernorTakeWakeLeaseResponse,
4177 fidl::encoding::DefaultFuchsiaResourceDialect,
4178 >::encode(
4179 (<fidl::encoding::HandleType<
4180 fidl::EventPair,
4181 { fidl::ObjectType::EVENTPAIR.into_raw() },
4182 16387,
4183 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4184 &mut self.token
4185 ),),
4186 encoder,
4187 offset,
4188 _depth,
4189 )
4190 }
4191 }
4192 unsafe impl<
4193 T0: fidl::encoding::Encode<
4194 fidl::encoding::HandleType<
4195 fidl::EventPair,
4196 { fidl::ObjectType::EVENTPAIR.into_raw() },
4197 16387,
4198 >,
4199 fidl::encoding::DefaultFuchsiaResourceDialect,
4200 >,
4201 >
4202 fidl::encoding::Encode<
4203 ActivityGovernorTakeWakeLeaseResponse,
4204 fidl::encoding::DefaultFuchsiaResourceDialect,
4205 > for (T0,)
4206 {
4207 #[inline]
4208 unsafe fn encode(
4209 self,
4210 encoder: &mut fidl::encoding::Encoder<
4211 '_,
4212 fidl::encoding::DefaultFuchsiaResourceDialect,
4213 >,
4214 offset: usize,
4215 depth: fidl::encoding::Depth,
4216 ) -> fidl::Result<()> {
4217 encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseResponse>(offset);
4218 self.0.encode(encoder, offset + 0, depth)?;
4222 Ok(())
4223 }
4224 }
4225
4226 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4227 for ActivityGovernorTakeWakeLeaseResponse
4228 {
4229 #[inline(always)]
4230 fn new_empty() -> Self {
4231 Self {
4232 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
4233 }
4234 }
4235
4236 #[inline]
4237 unsafe fn decode(
4238 &mut self,
4239 decoder: &mut fidl::encoding::Decoder<
4240 '_,
4241 fidl::encoding::DefaultFuchsiaResourceDialect,
4242 >,
4243 offset: usize,
4244 _depth: fidl::encoding::Depth,
4245 ) -> fidl::Result<()> {
4246 decoder.debug_check_bounds::<Self>(offset);
4247 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4249 Ok(())
4250 }
4251 }
4252
4253 impl ActivityGovernorRegisterSuspendBlockerRequest {
4254 #[inline(always)]
4255 fn max_ordinal_present(&self) -> u64 {
4256 if let Some(_) = self.name {
4257 return 2;
4258 }
4259 if let Some(_) = self.suspend_blocker {
4260 return 1;
4261 }
4262 0
4263 }
4264 }
4265
4266 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorRegisterSuspendBlockerRequest {
4267 type Borrowed<'a> = &'a mut Self;
4268 fn take_or_borrow<'a>(
4269 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4270 ) -> Self::Borrowed<'a> {
4271 value
4272 }
4273 }
4274
4275 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorRegisterSuspendBlockerRequest {
4276 type Owned = Self;
4277
4278 #[inline(always)]
4279 fn inline_align(_context: fidl::encoding::Context) -> usize {
4280 8
4281 }
4282
4283 #[inline(always)]
4284 fn inline_size(_context: fidl::encoding::Context) -> usize {
4285 16
4286 }
4287 }
4288
4289 unsafe impl
4290 fidl::encoding::Encode<
4291 ActivityGovernorRegisterSuspendBlockerRequest,
4292 fidl::encoding::DefaultFuchsiaResourceDialect,
4293 > for &mut ActivityGovernorRegisterSuspendBlockerRequest
4294 {
4295 unsafe fn encode(
4296 self,
4297 encoder: &mut fidl::encoding::Encoder<
4298 '_,
4299 fidl::encoding::DefaultFuchsiaResourceDialect,
4300 >,
4301 offset: usize,
4302 mut depth: fidl::encoding::Depth,
4303 ) -> fidl::Result<()> {
4304 encoder.debug_check_bounds::<ActivityGovernorRegisterSuspendBlockerRequest>(offset);
4305 let max_ordinal: u64 = self.max_ordinal_present();
4307 encoder.write_num(max_ordinal, offset);
4308 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4309 if max_ordinal == 0 {
4311 return Ok(());
4312 }
4313 depth.increment()?;
4314 let envelope_size = 8;
4315 let bytes_len = max_ordinal as usize * envelope_size;
4316 #[allow(unused_variables)]
4317 let offset = encoder.out_of_line_offset(bytes_len);
4318 let mut _prev_end_offset: usize = 0;
4319 if 1 > max_ordinal {
4320 return Ok(());
4321 }
4322
4323 let cur_offset: usize = (1 - 1) * envelope_size;
4326
4327 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4329
4330 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SuspendBlockerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4335 self.suspend_blocker.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SuspendBlockerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4336 encoder, offset + cur_offset, depth
4337 )?;
4338
4339 _prev_end_offset = cur_offset + envelope_size;
4340 if 2 > max_ordinal {
4341 return Ok(());
4342 }
4343
4344 let cur_offset: usize = (2 - 1) * envelope_size;
4347
4348 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4350
4351 fidl::encoding::encode_in_envelope_optional::<
4356 fidl::encoding::BoundedString<64>,
4357 fidl::encoding::DefaultFuchsiaResourceDialect,
4358 >(
4359 self.name.as_ref().map(
4360 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
4361 ),
4362 encoder,
4363 offset + cur_offset,
4364 depth,
4365 )?;
4366
4367 _prev_end_offset = cur_offset + envelope_size;
4368
4369 Ok(())
4370 }
4371 }
4372
4373 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4374 for ActivityGovernorRegisterSuspendBlockerRequest
4375 {
4376 #[inline(always)]
4377 fn new_empty() -> Self {
4378 Self::default()
4379 }
4380
4381 unsafe fn decode(
4382 &mut self,
4383 decoder: &mut fidl::encoding::Decoder<
4384 '_,
4385 fidl::encoding::DefaultFuchsiaResourceDialect,
4386 >,
4387 offset: usize,
4388 mut depth: fidl::encoding::Depth,
4389 ) -> fidl::Result<()> {
4390 decoder.debug_check_bounds::<Self>(offset);
4391 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4392 None => return Err(fidl::Error::NotNullable),
4393 Some(len) => len,
4394 };
4395 if len == 0 {
4397 return Ok(());
4398 };
4399 depth.increment()?;
4400 let envelope_size = 8;
4401 let bytes_len = len * envelope_size;
4402 let offset = decoder.out_of_line_offset(bytes_len)?;
4403 let mut _next_ordinal_to_read = 0;
4405 let mut next_offset = offset;
4406 let end_offset = offset + bytes_len;
4407 _next_ordinal_to_read += 1;
4408 if next_offset >= end_offset {
4409 return Ok(());
4410 }
4411
4412 while _next_ordinal_to_read < 1 {
4414 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4415 _next_ordinal_to_read += 1;
4416 next_offset += envelope_size;
4417 }
4418
4419 let next_out_of_line = decoder.next_out_of_line();
4420 let handles_before = decoder.remaining_handles();
4421 if let Some((inlined, num_bytes, num_handles)) =
4422 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4423 {
4424 let member_inline_size = <fidl::encoding::Endpoint<
4425 fidl::endpoints::ClientEnd<SuspendBlockerMarker>,
4426 > as fidl::encoding::TypeMarker>::inline_size(
4427 decoder.context
4428 );
4429 if inlined != (member_inline_size <= 4) {
4430 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4431 }
4432 let inner_offset;
4433 let mut inner_depth = depth.clone();
4434 if inlined {
4435 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4436 inner_offset = next_offset;
4437 } else {
4438 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4439 inner_depth.increment()?;
4440 }
4441 let val_ref = self.suspend_blocker.get_or_insert_with(|| {
4442 fidl::new_empty!(
4443 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SuspendBlockerMarker>>,
4444 fidl::encoding::DefaultFuchsiaResourceDialect
4445 )
4446 });
4447 fidl::decode!(
4448 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SuspendBlockerMarker>>,
4449 fidl::encoding::DefaultFuchsiaResourceDialect,
4450 val_ref,
4451 decoder,
4452 inner_offset,
4453 inner_depth
4454 )?;
4455 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4456 {
4457 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4458 }
4459 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4460 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4461 }
4462 }
4463
4464 next_offset += envelope_size;
4465 _next_ordinal_to_read += 1;
4466 if next_offset >= end_offset {
4467 return Ok(());
4468 }
4469
4470 while _next_ordinal_to_read < 2 {
4472 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4473 _next_ordinal_to_read += 1;
4474 next_offset += envelope_size;
4475 }
4476
4477 let next_out_of_line = decoder.next_out_of_line();
4478 let handles_before = decoder.remaining_handles();
4479 if let Some((inlined, num_bytes, num_handles)) =
4480 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4481 {
4482 let member_inline_size =
4483 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
4484 decoder.context,
4485 );
4486 if inlined != (member_inline_size <= 4) {
4487 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4488 }
4489 let inner_offset;
4490 let mut inner_depth = depth.clone();
4491 if inlined {
4492 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4493 inner_offset = next_offset;
4494 } else {
4495 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4496 inner_depth.increment()?;
4497 }
4498 let val_ref = self.name.get_or_insert_with(|| {
4499 fidl::new_empty!(
4500 fidl::encoding::BoundedString<64>,
4501 fidl::encoding::DefaultFuchsiaResourceDialect
4502 )
4503 });
4504 fidl::decode!(
4505 fidl::encoding::BoundedString<64>,
4506 fidl::encoding::DefaultFuchsiaResourceDialect,
4507 val_ref,
4508 decoder,
4509 inner_offset,
4510 inner_depth
4511 )?;
4512 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4513 {
4514 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4515 }
4516 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4517 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4518 }
4519 }
4520
4521 next_offset += envelope_size;
4522
4523 while next_offset < end_offset {
4525 _next_ordinal_to_read += 1;
4526 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4527 next_offset += envelope_size;
4528 }
4529
4530 Ok(())
4531 }
4532 }
4533
4534 impl ApplicationActivity {
4535 #[inline(always)]
4536 fn max_ordinal_present(&self) -> u64 {
4537 if let Some(_) = self.assertive_dependency_token {
4538 return 1;
4539 }
4540 0
4541 }
4542 }
4543
4544 impl fidl::encoding::ResourceTypeMarker for ApplicationActivity {
4545 type Borrowed<'a> = &'a mut Self;
4546 fn take_or_borrow<'a>(
4547 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4548 ) -> Self::Borrowed<'a> {
4549 value
4550 }
4551 }
4552
4553 unsafe impl fidl::encoding::TypeMarker for ApplicationActivity {
4554 type Owned = Self;
4555
4556 #[inline(always)]
4557 fn inline_align(_context: fidl::encoding::Context) -> usize {
4558 8
4559 }
4560
4561 #[inline(always)]
4562 fn inline_size(_context: fidl::encoding::Context) -> usize {
4563 16
4564 }
4565 }
4566
4567 unsafe impl
4568 fidl::encoding::Encode<ApplicationActivity, fidl::encoding::DefaultFuchsiaResourceDialect>
4569 for &mut ApplicationActivity
4570 {
4571 unsafe fn encode(
4572 self,
4573 encoder: &mut fidl::encoding::Encoder<
4574 '_,
4575 fidl::encoding::DefaultFuchsiaResourceDialect,
4576 >,
4577 offset: usize,
4578 mut depth: fidl::encoding::Depth,
4579 ) -> fidl::Result<()> {
4580 encoder.debug_check_bounds::<ApplicationActivity>(offset);
4581 let max_ordinal: u64 = self.max_ordinal_present();
4583 encoder.write_num(max_ordinal, offset);
4584 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4585 if max_ordinal == 0 {
4587 return Ok(());
4588 }
4589 depth.increment()?;
4590 let envelope_size = 8;
4591 let bytes_len = max_ordinal as usize * envelope_size;
4592 #[allow(unused_variables)]
4593 let offset = encoder.out_of_line_offset(bytes_len);
4594 let mut _prev_end_offset: usize = 0;
4595 if 1 > max_ordinal {
4596 return Ok(());
4597 }
4598
4599 let cur_offset: usize = (1 - 1) * envelope_size;
4602
4603 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4605
4606 fidl::encoding::encode_in_envelope_optional::<
4611 fidl::encoding::HandleType<
4612 fidl::Event,
4613 { fidl::ObjectType::EVENT.into_raw() },
4614 2147483648,
4615 >,
4616 fidl::encoding::DefaultFuchsiaResourceDialect,
4617 >(
4618 self.assertive_dependency_token.as_mut().map(
4619 <fidl::encoding::HandleType<
4620 fidl::Event,
4621 { fidl::ObjectType::EVENT.into_raw() },
4622 2147483648,
4623 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4624 ),
4625 encoder,
4626 offset + cur_offset,
4627 depth,
4628 )?;
4629
4630 _prev_end_offset = cur_offset + envelope_size;
4631
4632 Ok(())
4633 }
4634 }
4635
4636 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4637 for ApplicationActivity
4638 {
4639 #[inline(always)]
4640 fn new_empty() -> Self {
4641 Self::default()
4642 }
4643
4644 unsafe fn decode(
4645 &mut self,
4646 decoder: &mut fidl::encoding::Decoder<
4647 '_,
4648 fidl::encoding::DefaultFuchsiaResourceDialect,
4649 >,
4650 offset: usize,
4651 mut depth: fidl::encoding::Depth,
4652 ) -> fidl::Result<()> {
4653 decoder.debug_check_bounds::<Self>(offset);
4654 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4655 None => return Err(fidl::Error::NotNullable),
4656 Some(len) => len,
4657 };
4658 if len == 0 {
4660 return Ok(());
4661 };
4662 depth.increment()?;
4663 let envelope_size = 8;
4664 let bytes_len = len * envelope_size;
4665 let offset = decoder.out_of_line_offset(bytes_len)?;
4666 let mut _next_ordinal_to_read = 0;
4668 let mut next_offset = offset;
4669 let end_offset = offset + bytes_len;
4670 _next_ordinal_to_read += 1;
4671 if next_offset >= end_offset {
4672 return Ok(());
4673 }
4674
4675 while _next_ordinal_to_read < 1 {
4677 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4678 _next_ordinal_to_read += 1;
4679 next_offset += envelope_size;
4680 }
4681
4682 let next_out_of_line = decoder.next_out_of_line();
4683 let handles_before = decoder.remaining_handles();
4684 if let Some((inlined, num_bytes, num_handles)) =
4685 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4686 {
4687 let member_inline_size = <fidl::encoding::HandleType<
4688 fidl::Event,
4689 { fidl::ObjectType::EVENT.into_raw() },
4690 2147483648,
4691 > as fidl::encoding::TypeMarker>::inline_size(
4692 decoder.context
4693 );
4694 if inlined != (member_inline_size <= 4) {
4695 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4696 }
4697 let inner_offset;
4698 let mut inner_depth = depth.clone();
4699 if inlined {
4700 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4701 inner_offset = next_offset;
4702 } else {
4703 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4704 inner_depth.increment()?;
4705 }
4706 let val_ref =
4707 self.assertive_dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4708 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4709 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4710 {
4711 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4712 }
4713 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4714 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4715 }
4716 }
4717
4718 next_offset += envelope_size;
4719
4720 while next_offset < end_offset {
4722 _next_ordinal_to_read += 1;
4723 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4724 next_offset += envelope_size;
4725 }
4726
4727 Ok(())
4728 }
4729 }
4730
4731 impl Cpu {
4732 #[inline(always)]
4733 fn max_ordinal_present(&self) -> u64 {
4734 if let Some(_) = self.assertive_dependency_token {
4735 return 1;
4736 }
4737 0
4738 }
4739 }
4740
4741 impl fidl::encoding::ResourceTypeMarker for Cpu {
4742 type Borrowed<'a> = &'a mut Self;
4743 fn take_or_borrow<'a>(
4744 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4745 ) -> Self::Borrowed<'a> {
4746 value
4747 }
4748 }
4749
4750 unsafe impl fidl::encoding::TypeMarker for Cpu {
4751 type Owned = Self;
4752
4753 #[inline(always)]
4754 fn inline_align(_context: fidl::encoding::Context) -> usize {
4755 8
4756 }
4757
4758 #[inline(always)]
4759 fn inline_size(_context: fidl::encoding::Context) -> usize {
4760 16
4761 }
4762 }
4763
4764 unsafe impl fidl::encoding::Encode<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect>
4765 for &mut Cpu
4766 {
4767 unsafe fn encode(
4768 self,
4769 encoder: &mut fidl::encoding::Encoder<
4770 '_,
4771 fidl::encoding::DefaultFuchsiaResourceDialect,
4772 >,
4773 offset: usize,
4774 mut depth: fidl::encoding::Depth,
4775 ) -> fidl::Result<()> {
4776 encoder.debug_check_bounds::<Cpu>(offset);
4777 let max_ordinal: u64 = self.max_ordinal_present();
4779 encoder.write_num(max_ordinal, offset);
4780 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4781 if max_ordinal == 0 {
4783 return Ok(());
4784 }
4785 depth.increment()?;
4786 let envelope_size = 8;
4787 let bytes_len = max_ordinal as usize * envelope_size;
4788 #[allow(unused_variables)]
4789 let offset = encoder.out_of_line_offset(bytes_len);
4790 let mut _prev_end_offset: usize = 0;
4791 if 1 > max_ordinal {
4792 return Ok(());
4793 }
4794
4795 let cur_offset: usize = (1 - 1) * envelope_size;
4798
4799 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4801
4802 fidl::encoding::encode_in_envelope_optional::<
4807 fidl::encoding::HandleType<
4808 fidl::Event,
4809 { fidl::ObjectType::EVENT.into_raw() },
4810 2147483648,
4811 >,
4812 fidl::encoding::DefaultFuchsiaResourceDialect,
4813 >(
4814 self.assertive_dependency_token.as_mut().map(
4815 <fidl::encoding::HandleType<
4816 fidl::Event,
4817 { fidl::ObjectType::EVENT.into_raw() },
4818 2147483648,
4819 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4820 ),
4821 encoder,
4822 offset + cur_offset,
4823 depth,
4824 )?;
4825
4826 _prev_end_offset = cur_offset + envelope_size;
4827
4828 Ok(())
4829 }
4830 }
4831
4832 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Cpu {
4833 #[inline(always)]
4834 fn new_empty() -> Self {
4835 Self::default()
4836 }
4837
4838 unsafe fn decode(
4839 &mut self,
4840 decoder: &mut fidl::encoding::Decoder<
4841 '_,
4842 fidl::encoding::DefaultFuchsiaResourceDialect,
4843 >,
4844 offset: usize,
4845 mut depth: fidl::encoding::Depth,
4846 ) -> fidl::Result<()> {
4847 decoder.debug_check_bounds::<Self>(offset);
4848 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4849 None => return Err(fidl::Error::NotNullable),
4850 Some(len) => len,
4851 };
4852 if len == 0 {
4854 return Ok(());
4855 };
4856 depth.increment()?;
4857 let envelope_size = 8;
4858 let bytes_len = len * envelope_size;
4859 let offset = decoder.out_of_line_offset(bytes_len)?;
4860 let mut _next_ordinal_to_read = 0;
4862 let mut next_offset = offset;
4863 let end_offset = offset + bytes_len;
4864 _next_ordinal_to_read += 1;
4865 if next_offset >= end_offset {
4866 return Ok(());
4867 }
4868
4869 while _next_ordinal_to_read < 1 {
4871 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4872 _next_ordinal_to_read += 1;
4873 next_offset += envelope_size;
4874 }
4875
4876 let next_out_of_line = decoder.next_out_of_line();
4877 let handles_before = decoder.remaining_handles();
4878 if let Some((inlined, num_bytes, num_handles)) =
4879 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4880 {
4881 let member_inline_size = <fidl::encoding::HandleType<
4882 fidl::Event,
4883 { fidl::ObjectType::EVENT.into_raw() },
4884 2147483648,
4885 > as fidl::encoding::TypeMarker>::inline_size(
4886 decoder.context
4887 );
4888 if inlined != (member_inline_size <= 4) {
4889 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4890 }
4891 let inner_offset;
4892 let mut inner_depth = depth.clone();
4893 if inlined {
4894 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4895 inner_offset = next_offset;
4896 } else {
4897 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4898 inner_depth.increment()?;
4899 }
4900 let val_ref =
4901 self.assertive_dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4902 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4903 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4904 {
4905 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4906 }
4907 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4908 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4909 }
4910 }
4911
4912 next_offset += envelope_size;
4913
4914 while next_offset < end_offset {
4916 _next_ordinal_to_read += 1;
4917 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4918 next_offset += envelope_size;
4919 }
4920
4921 Ok(())
4922 }
4923 }
4924
4925 impl CpuElementManagerAddExecutionStateDependencyRequest {
4926 #[inline(always)]
4927 fn max_ordinal_present(&self) -> u64 {
4928 if let Some(_) = self.power_level {
4929 return 2;
4930 }
4931 if let Some(_) = self.dependency_token {
4932 return 1;
4933 }
4934 0
4935 }
4936 }
4937
4938 impl fidl::encoding::ResourceTypeMarker for CpuElementManagerAddExecutionStateDependencyRequest {
4939 type Borrowed<'a> = &'a mut Self;
4940 fn take_or_borrow<'a>(
4941 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4942 ) -> Self::Borrowed<'a> {
4943 value
4944 }
4945 }
4946
4947 unsafe impl fidl::encoding::TypeMarker for CpuElementManagerAddExecutionStateDependencyRequest {
4948 type Owned = Self;
4949
4950 #[inline(always)]
4951 fn inline_align(_context: fidl::encoding::Context) -> usize {
4952 8
4953 }
4954
4955 #[inline(always)]
4956 fn inline_size(_context: fidl::encoding::Context) -> usize {
4957 16
4958 }
4959 }
4960
4961 unsafe impl
4962 fidl::encoding::Encode<
4963 CpuElementManagerAddExecutionStateDependencyRequest,
4964 fidl::encoding::DefaultFuchsiaResourceDialect,
4965 > for &mut CpuElementManagerAddExecutionStateDependencyRequest
4966 {
4967 unsafe fn encode(
4968 self,
4969 encoder: &mut fidl::encoding::Encoder<
4970 '_,
4971 fidl::encoding::DefaultFuchsiaResourceDialect,
4972 >,
4973 offset: usize,
4974 mut depth: fidl::encoding::Depth,
4975 ) -> fidl::Result<()> {
4976 encoder
4977 .debug_check_bounds::<CpuElementManagerAddExecutionStateDependencyRequest>(offset);
4978 let max_ordinal: u64 = self.max_ordinal_present();
4980 encoder.write_num(max_ordinal, offset);
4981 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4982 if max_ordinal == 0 {
4984 return Ok(());
4985 }
4986 depth.increment()?;
4987 let envelope_size = 8;
4988 let bytes_len = max_ordinal as usize * envelope_size;
4989 #[allow(unused_variables)]
4990 let offset = encoder.out_of_line_offset(bytes_len);
4991 let mut _prev_end_offset: usize = 0;
4992 if 1 > max_ordinal {
4993 return Ok(());
4994 }
4995
4996 let cur_offset: usize = (1 - 1) * envelope_size;
4999
5000 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5002
5003 fidl::encoding::encode_in_envelope_optional::<
5008 fidl::encoding::HandleType<
5009 fidl::Event,
5010 { fidl::ObjectType::EVENT.into_raw() },
5011 2147483648,
5012 >,
5013 fidl::encoding::DefaultFuchsiaResourceDialect,
5014 >(
5015 self.dependency_token.as_mut().map(
5016 <fidl::encoding::HandleType<
5017 fidl::Event,
5018 { fidl::ObjectType::EVENT.into_raw() },
5019 2147483648,
5020 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5021 ),
5022 encoder,
5023 offset + cur_offset,
5024 depth,
5025 )?;
5026
5027 _prev_end_offset = cur_offset + envelope_size;
5028 if 2 > max_ordinal {
5029 return Ok(());
5030 }
5031
5032 let cur_offset: usize = (2 - 1) * envelope_size;
5035
5036 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5038
5039 fidl::encoding::encode_in_envelope_optional::<
5044 u8,
5045 fidl::encoding::DefaultFuchsiaResourceDialect,
5046 >(
5047 self.power_level.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
5048 encoder,
5049 offset + cur_offset,
5050 depth,
5051 )?;
5052
5053 _prev_end_offset = cur_offset + envelope_size;
5054
5055 Ok(())
5056 }
5057 }
5058
5059 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5060 for CpuElementManagerAddExecutionStateDependencyRequest
5061 {
5062 #[inline(always)]
5063 fn new_empty() -> Self {
5064 Self::default()
5065 }
5066
5067 unsafe fn decode(
5068 &mut self,
5069 decoder: &mut fidl::encoding::Decoder<
5070 '_,
5071 fidl::encoding::DefaultFuchsiaResourceDialect,
5072 >,
5073 offset: usize,
5074 mut depth: fidl::encoding::Depth,
5075 ) -> fidl::Result<()> {
5076 decoder.debug_check_bounds::<Self>(offset);
5077 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5078 None => return Err(fidl::Error::NotNullable),
5079 Some(len) => len,
5080 };
5081 if len == 0 {
5083 return Ok(());
5084 };
5085 depth.increment()?;
5086 let envelope_size = 8;
5087 let bytes_len = len * envelope_size;
5088 let offset = decoder.out_of_line_offset(bytes_len)?;
5089 let mut _next_ordinal_to_read = 0;
5091 let mut next_offset = offset;
5092 let end_offset = offset + bytes_len;
5093 _next_ordinal_to_read += 1;
5094 if next_offset >= end_offset {
5095 return Ok(());
5096 }
5097
5098 while _next_ordinal_to_read < 1 {
5100 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5101 _next_ordinal_to_read += 1;
5102 next_offset += envelope_size;
5103 }
5104
5105 let next_out_of_line = decoder.next_out_of_line();
5106 let handles_before = decoder.remaining_handles();
5107 if let Some((inlined, num_bytes, num_handles)) =
5108 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5109 {
5110 let member_inline_size = <fidl::encoding::HandleType<
5111 fidl::Event,
5112 { fidl::ObjectType::EVENT.into_raw() },
5113 2147483648,
5114 > as fidl::encoding::TypeMarker>::inline_size(
5115 decoder.context
5116 );
5117 if inlined != (member_inline_size <= 4) {
5118 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5119 }
5120 let inner_offset;
5121 let mut inner_depth = depth.clone();
5122 if inlined {
5123 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5124 inner_offset = next_offset;
5125 } else {
5126 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5127 inner_depth.increment()?;
5128 }
5129 let val_ref =
5130 self.dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5131 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5132 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5133 {
5134 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5135 }
5136 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5137 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5138 }
5139 }
5140
5141 next_offset += envelope_size;
5142 _next_ordinal_to_read += 1;
5143 if next_offset >= end_offset {
5144 return Ok(());
5145 }
5146
5147 while _next_ordinal_to_read < 2 {
5149 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5150 _next_ordinal_to_read += 1;
5151 next_offset += envelope_size;
5152 }
5153
5154 let next_out_of_line = decoder.next_out_of_line();
5155 let handles_before = decoder.remaining_handles();
5156 if let Some((inlined, num_bytes, num_handles)) =
5157 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5158 {
5159 let member_inline_size =
5160 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5161 if inlined != (member_inline_size <= 4) {
5162 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5163 }
5164 let inner_offset;
5165 let mut inner_depth = depth.clone();
5166 if inlined {
5167 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5168 inner_offset = next_offset;
5169 } else {
5170 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5171 inner_depth.increment()?;
5172 }
5173 let val_ref = self.power_level.get_or_insert_with(|| {
5174 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
5175 });
5176 fidl::decode!(
5177 u8,
5178 fidl::encoding::DefaultFuchsiaResourceDialect,
5179 val_ref,
5180 decoder,
5181 inner_offset,
5182 inner_depth
5183 )?;
5184 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5185 {
5186 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5187 }
5188 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5189 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5190 }
5191 }
5192
5193 next_offset += envelope_size;
5194
5195 while next_offset < end_offset {
5197 _next_ordinal_to_read += 1;
5198 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5199 next_offset += envelope_size;
5200 }
5201
5202 Ok(())
5203 }
5204 }
5205
5206 impl ExecutionState {
5207 #[inline(always)]
5208 fn max_ordinal_present(&self) -> u64 {
5209 if let Some(_) = self.opportunistic_dependency_token {
5210 return 1;
5211 }
5212 0
5213 }
5214 }
5215
5216 impl fidl::encoding::ResourceTypeMarker for ExecutionState {
5217 type Borrowed<'a> = &'a mut Self;
5218 fn take_or_borrow<'a>(
5219 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5220 ) -> Self::Borrowed<'a> {
5221 value
5222 }
5223 }
5224
5225 unsafe impl fidl::encoding::TypeMarker for ExecutionState {
5226 type Owned = Self;
5227
5228 #[inline(always)]
5229 fn inline_align(_context: fidl::encoding::Context) -> usize {
5230 8
5231 }
5232
5233 #[inline(always)]
5234 fn inline_size(_context: fidl::encoding::Context) -> usize {
5235 16
5236 }
5237 }
5238
5239 unsafe impl
5240 fidl::encoding::Encode<ExecutionState, fidl::encoding::DefaultFuchsiaResourceDialect>
5241 for &mut ExecutionState
5242 {
5243 unsafe fn encode(
5244 self,
5245 encoder: &mut fidl::encoding::Encoder<
5246 '_,
5247 fidl::encoding::DefaultFuchsiaResourceDialect,
5248 >,
5249 offset: usize,
5250 mut depth: fidl::encoding::Depth,
5251 ) -> fidl::Result<()> {
5252 encoder.debug_check_bounds::<ExecutionState>(offset);
5253 let max_ordinal: u64 = self.max_ordinal_present();
5255 encoder.write_num(max_ordinal, offset);
5256 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5257 if max_ordinal == 0 {
5259 return Ok(());
5260 }
5261 depth.increment()?;
5262 let envelope_size = 8;
5263 let bytes_len = max_ordinal as usize * envelope_size;
5264 #[allow(unused_variables)]
5265 let offset = encoder.out_of_line_offset(bytes_len);
5266 let mut _prev_end_offset: usize = 0;
5267 if 1 > max_ordinal {
5268 return Ok(());
5269 }
5270
5271 let cur_offset: usize = (1 - 1) * envelope_size;
5274
5275 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5277
5278 fidl::encoding::encode_in_envelope_optional::<
5283 fidl::encoding::HandleType<
5284 fidl::Event,
5285 { fidl::ObjectType::EVENT.into_raw() },
5286 2147483648,
5287 >,
5288 fidl::encoding::DefaultFuchsiaResourceDialect,
5289 >(
5290 self.opportunistic_dependency_token.as_mut().map(
5291 <fidl::encoding::HandleType<
5292 fidl::Event,
5293 { fidl::ObjectType::EVENT.into_raw() },
5294 2147483648,
5295 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5296 ),
5297 encoder,
5298 offset + cur_offset,
5299 depth,
5300 )?;
5301
5302 _prev_end_offset = cur_offset + envelope_size;
5303
5304 Ok(())
5305 }
5306 }
5307
5308 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5309 for ExecutionState
5310 {
5311 #[inline(always)]
5312 fn new_empty() -> Self {
5313 Self::default()
5314 }
5315
5316 unsafe fn decode(
5317 &mut self,
5318 decoder: &mut fidl::encoding::Decoder<
5319 '_,
5320 fidl::encoding::DefaultFuchsiaResourceDialect,
5321 >,
5322 offset: usize,
5323 mut depth: fidl::encoding::Depth,
5324 ) -> fidl::Result<()> {
5325 decoder.debug_check_bounds::<Self>(offset);
5326 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5327 None => return Err(fidl::Error::NotNullable),
5328 Some(len) => len,
5329 };
5330 if len == 0 {
5332 return Ok(());
5333 };
5334 depth.increment()?;
5335 let envelope_size = 8;
5336 let bytes_len = len * envelope_size;
5337 let offset = decoder.out_of_line_offset(bytes_len)?;
5338 let mut _next_ordinal_to_read = 0;
5340 let mut next_offset = offset;
5341 let end_offset = offset + bytes_len;
5342 _next_ordinal_to_read += 1;
5343 if next_offset >= end_offset {
5344 return Ok(());
5345 }
5346
5347 while _next_ordinal_to_read < 1 {
5349 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5350 _next_ordinal_to_read += 1;
5351 next_offset += envelope_size;
5352 }
5353
5354 let next_out_of_line = decoder.next_out_of_line();
5355 let handles_before = decoder.remaining_handles();
5356 if let Some((inlined, num_bytes, num_handles)) =
5357 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5358 {
5359 let member_inline_size = <fidl::encoding::HandleType<
5360 fidl::Event,
5361 { fidl::ObjectType::EVENT.into_raw() },
5362 2147483648,
5363 > as fidl::encoding::TypeMarker>::inline_size(
5364 decoder.context
5365 );
5366 if inlined != (member_inline_size <= 4) {
5367 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5368 }
5369 let inner_offset;
5370 let mut inner_depth = depth.clone();
5371 if inlined {
5372 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5373 inner_offset = next_offset;
5374 } else {
5375 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5376 inner_depth.increment()?;
5377 }
5378 let val_ref =
5379 self.opportunistic_dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5380 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5381 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5382 {
5383 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5384 }
5385 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5386 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5387 }
5388 }
5389
5390 next_offset += envelope_size;
5391
5392 while next_offset < end_offset {
5394 _next_ordinal_to_read += 1;
5395 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5396 next_offset += envelope_size;
5397 }
5398
5399 Ok(())
5400 }
5401 }
5402
5403 impl PowerElements {
5404 #[inline(always)]
5405 fn max_ordinal_present(&self) -> u64 {
5406 if let Some(_) = self.application_activity {
5407 return 3;
5408 }
5409 if let Some(_) = self.execution_state {
5410 return 1;
5411 }
5412 0
5413 }
5414 }
5415
5416 impl fidl::encoding::ResourceTypeMarker for PowerElements {
5417 type Borrowed<'a> = &'a mut Self;
5418 fn take_or_borrow<'a>(
5419 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5420 ) -> Self::Borrowed<'a> {
5421 value
5422 }
5423 }
5424
5425 unsafe impl fidl::encoding::TypeMarker for PowerElements {
5426 type Owned = Self;
5427
5428 #[inline(always)]
5429 fn inline_align(_context: fidl::encoding::Context) -> usize {
5430 8
5431 }
5432
5433 #[inline(always)]
5434 fn inline_size(_context: fidl::encoding::Context) -> usize {
5435 16
5436 }
5437 }
5438
5439 unsafe impl fidl::encoding::Encode<PowerElements, fidl::encoding::DefaultFuchsiaResourceDialect>
5440 for &mut PowerElements
5441 {
5442 unsafe fn encode(
5443 self,
5444 encoder: &mut fidl::encoding::Encoder<
5445 '_,
5446 fidl::encoding::DefaultFuchsiaResourceDialect,
5447 >,
5448 offset: usize,
5449 mut depth: fidl::encoding::Depth,
5450 ) -> fidl::Result<()> {
5451 encoder.debug_check_bounds::<PowerElements>(offset);
5452 let max_ordinal: u64 = self.max_ordinal_present();
5454 encoder.write_num(max_ordinal, offset);
5455 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5456 if max_ordinal == 0 {
5458 return Ok(());
5459 }
5460 depth.increment()?;
5461 let envelope_size = 8;
5462 let bytes_len = max_ordinal as usize * envelope_size;
5463 #[allow(unused_variables)]
5464 let offset = encoder.out_of_line_offset(bytes_len);
5465 let mut _prev_end_offset: usize = 0;
5466 if 1 > max_ordinal {
5467 return Ok(());
5468 }
5469
5470 let cur_offset: usize = (1 - 1) * envelope_size;
5473
5474 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5476
5477 fidl::encoding::encode_in_envelope_optional::<
5482 ExecutionState,
5483 fidl::encoding::DefaultFuchsiaResourceDialect,
5484 >(
5485 self.execution_state
5486 .as_mut()
5487 .map(<ExecutionState as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5488 encoder,
5489 offset + cur_offset,
5490 depth,
5491 )?;
5492
5493 _prev_end_offset = cur_offset + envelope_size;
5494 if 3 > max_ordinal {
5495 return Ok(());
5496 }
5497
5498 let cur_offset: usize = (3 - 1) * envelope_size;
5501
5502 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5504
5505 fidl::encoding::encode_in_envelope_optional::<
5510 ApplicationActivity,
5511 fidl::encoding::DefaultFuchsiaResourceDialect,
5512 >(
5513 self.application_activity.as_mut().map(
5514 <ApplicationActivity as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5515 ),
5516 encoder,
5517 offset + cur_offset,
5518 depth,
5519 )?;
5520
5521 _prev_end_offset = cur_offset + envelope_size;
5522
5523 Ok(())
5524 }
5525 }
5526
5527 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PowerElements {
5528 #[inline(always)]
5529 fn new_empty() -> Self {
5530 Self::default()
5531 }
5532
5533 unsafe fn decode(
5534 &mut self,
5535 decoder: &mut fidl::encoding::Decoder<
5536 '_,
5537 fidl::encoding::DefaultFuchsiaResourceDialect,
5538 >,
5539 offset: usize,
5540 mut depth: fidl::encoding::Depth,
5541 ) -> fidl::Result<()> {
5542 decoder.debug_check_bounds::<Self>(offset);
5543 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5544 None => return Err(fidl::Error::NotNullable),
5545 Some(len) => len,
5546 };
5547 if len == 0 {
5549 return Ok(());
5550 };
5551 depth.increment()?;
5552 let envelope_size = 8;
5553 let bytes_len = len * envelope_size;
5554 let offset = decoder.out_of_line_offset(bytes_len)?;
5555 let mut _next_ordinal_to_read = 0;
5557 let mut next_offset = offset;
5558 let end_offset = offset + bytes_len;
5559 _next_ordinal_to_read += 1;
5560 if next_offset >= end_offset {
5561 return Ok(());
5562 }
5563
5564 while _next_ordinal_to_read < 1 {
5566 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5567 _next_ordinal_to_read += 1;
5568 next_offset += envelope_size;
5569 }
5570
5571 let next_out_of_line = decoder.next_out_of_line();
5572 let handles_before = decoder.remaining_handles();
5573 if let Some((inlined, num_bytes, num_handles)) =
5574 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5575 {
5576 let member_inline_size =
5577 <ExecutionState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5578 if inlined != (member_inline_size <= 4) {
5579 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5580 }
5581 let inner_offset;
5582 let mut inner_depth = depth.clone();
5583 if inlined {
5584 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5585 inner_offset = next_offset;
5586 } else {
5587 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5588 inner_depth.increment()?;
5589 }
5590 let val_ref = self.execution_state.get_or_insert_with(|| {
5591 fidl::new_empty!(ExecutionState, fidl::encoding::DefaultFuchsiaResourceDialect)
5592 });
5593 fidl::decode!(
5594 ExecutionState,
5595 fidl::encoding::DefaultFuchsiaResourceDialect,
5596 val_ref,
5597 decoder,
5598 inner_offset,
5599 inner_depth
5600 )?;
5601 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5602 {
5603 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5604 }
5605 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5606 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5607 }
5608 }
5609
5610 next_offset += envelope_size;
5611 _next_ordinal_to_read += 1;
5612 if next_offset >= end_offset {
5613 return Ok(());
5614 }
5615
5616 while _next_ordinal_to_read < 3 {
5618 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5619 _next_ordinal_to_read += 1;
5620 next_offset += envelope_size;
5621 }
5622
5623 let next_out_of_line = decoder.next_out_of_line();
5624 let handles_before = decoder.remaining_handles();
5625 if let Some((inlined, num_bytes, num_handles)) =
5626 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5627 {
5628 let member_inline_size =
5629 <ApplicationActivity as fidl::encoding::TypeMarker>::inline_size(
5630 decoder.context,
5631 );
5632 if inlined != (member_inline_size <= 4) {
5633 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5634 }
5635 let inner_offset;
5636 let mut inner_depth = depth.clone();
5637 if inlined {
5638 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5639 inner_offset = next_offset;
5640 } else {
5641 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5642 inner_depth.increment()?;
5643 }
5644 let val_ref = self.application_activity.get_or_insert_with(|| {
5645 fidl::new_empty!(
5646 ApplicationActivity,
5647 fidl::encoding::DefaultFuchsiaResourceDialect
5648 )
5649 });
5650 fidl::decode!(
5651 ApplicationActivity,
5652 fidl::encoding::DefaultFuchsiaResourceDialect,
5653 val_ref,
5654 decoder,
5655 inner_offset,
5656 inner_depth
5657 )?;
5658 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5659 {
5660 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5661 }
5662 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5663 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5664 }
5665 }
5666
5667 next_offset += envelope_size;
5668
5669 while next_offset < end_offset {
5671 _next_ordinal_to_read += 1;
5672 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5673 next_offset += envelope_size;
5674 }
5675
5676 Ok(())
5677 }
5678 }
5679}