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