Skip to main content

fidl_fuchsia_hardware_cpu_ctrl/
fidl_fuchsia_hardware_cpu_ctrl.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_hardware_cpu_ctrl__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeviceMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeviceMarker {
18    type Proxy = DeviceProxy;
19    type RequestStream = DeviceRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = DeviceSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "(anonymous) Device";
24}
25pub type DeviceGetOperatingPointInfoResult = Result<CpuOperatingPointInfo, i32>;
26pub type DeviceSetCurrentOperatingPointResult = Result<u32, i32>;
27pub type DeviceSetMinimumOperatingPointLimitResult = Result<(), i32>;
28pub type DeviceSetMaximumOperatingPointLimitResult = Result<(), i32>;
29pub type DeviceSetOperatingPointLimitsResult = Result<(), i32>;
30pub type DeviceGetCurrentOperatingPointLimitsResult = Result<(u32, u32), i32>;
31pub type DeviceGetOperatingPointCountResult = Result<u32, i32>;
32pub type DeviceGetRelativePerformanceResult = Result<u8, i32>;
33
34pub trait DeviceProxyInterface: Send + Sync {
35    type GetOperatingPointInfoResponseFut: std::future::Future<Output = Result<DeviceGetOperatingPointInfoResult, fidl::Error>>
36        + Send;
37    fn r#get_operating_point_info(&self, opp: u32) -> Self::GetOperatingPointInfoResponseFut;
38    type GetCurrentOperatingPointResponseFut: std::future::Future<Output = Result<u32, fidl::Error>>
39        + Send;
40    fn r#get_current_operating_point(&self) -> Self::GetCurrentOperatingPointResponseFut;
41    type SetCurrentOperatingPointResponseFut: std::future::Future<Output = Result<DeviceSetCurrentOperatingPointResult, fidl::Error>>
42        + Send;
43    fn r#set_current_operating_point(
44        &self,
45        requested_opp: u32,
46    ) -> Self::SetCurrentOperatingPointResponseFut;
47    type SetMinimumOperatingPointLimitResponseFut: std::future::Future<Output = Result<DeviceSetMinimumOperatingPointLimitResult, fidl::Error>>
48        + Send;
49    fn r#set_minimum_operating_point_limit(
50        &self,
51        minimum_opp: u32,
52    ) -> Self::SetMinimumOperatingPointLimitResponseFut;
53    type SetMaximumOperatingPointLimitResponseFut: std::future::Future<Output = Result<DeviceSetMaximumOperatingPointLimitResult, fidl::Error>>
54        + Send;
55    fn r#set_maximum_operating_point_limit(
56        &self,
57        maximum_opp: u32,
58    ) -> Self::SetMaximumOperatingPointLimitResponseFut;
59    type SetOperatingPointLimitsResponseFut: std::future::Future<Output = Result<DeviceSetOperatingPointLimitsResult, fidl::Error>>
60        + Send;
61    fn r#set_operating_point_limits(
62        &self,
63        minimum_opp: u32,
64        maximum_opp: u32,
65    ) -> Self::SetOperatingPointLimitsResponseFut;
66    type GetCurrentOperatingPointLimitsResponseFut: std::future::Future<
67            Output = Result<DeviceGetCurrentOperatingPointLimitsResult, fidl::Error>,
68        > + Send;
69    fn r#get_current_operating_point_limits(
70        &self,
71    ) -> Self::GetCurrentOperatingPointLimitsResponseFut;
72    type GetOperatingPointCountResponseFut: std::future::Future<Output = Result<DeviceGetOperatingPointCountResult, fidl::Error>>
73        + Send;
74    fn r#get_operating_point_count(&self) -> Self::GetOperatingPointCountResponseFut;
75    type GetNumLogicalCoresResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
76        + Send;
77    fn r#get_num_logical_cores(&self) -> Self::GetNumLogicalCoresResponseFut;
78    type GetLogicalCoreIdResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
79    fn r#get_logical_core_id(&self, index: u64) -> Self::GetLogicalCoreIdResponseFut;
80    type GetDomainIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
81    fn r#get_domain_id(&self) -> Self::GetDomainIdResponseFut;
82    type GetRelativePerformanceResponseFut: std::future::Future<Output = Result<DeviceGetRelativePerformanceResult, fidl::Error>>
83        + Send;
84    fn r#get_relative_performance(&self) -> Self::GetRelativePerformanceResponseFut;
85}
86#[derive(Debug)]
87#[cfg(target_os = "fuchsia")]
88pub struct DeviceSynchronousProxy {
89    client: fidl::client::sync::Client,
90}
91
92#[cfg(target_os = "fuchsia")]
93impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
94    type Proxy = DeviceProxy;
95    type Protocol = DeviceMarker;
96
97    fn from_channel(inner: fidl::Channel) -> Self {
98        Self::new(inner)
99    }
100
101    fn into_channel(self) -> fidl::Channel {
102        self.client.into_channel()
103    }
104
105    fn as_channel(&self) -> &fidl::Channel {
106        self.client.as_channel()
107    }
108}
109
110#[cfg(target_os = "fuchsia")]
111impl DeviceSynchronousProxy {
112    pub fn new(channel: fidl::Channel) -> Self {
113        Self { client: fidl::client::sync::Client::new(channel) }
114    }
115
116    pub fn into_channel(self) -> fidl::Channel {
117        self.client.into_channel()
118    }
119
120    /// Waits until an event arrives and returns it. It is safe for other
121    /// threads to make concurrent requests while waiting for an event.
122    pub fn wait_for_event(
123        &self,
124        deadline: zx::MonotonicInstant,
125    ) -> Result<DeviceEvent, fidl::Error> {
126        DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
127    }
128
129    /// Returns information about a given operating point for this performance
130    /// domain.
131    pub fn r#get_operating_point_info(
132        &self,
133        mut opp: u32,
134        ___deadline: zx::MonotonicInstant,
135    ) -> Result<DeviceGetOperatingPointInfoResult, fidl::Error> {
136        let _response = self.client.send_query::<
137            DeviceGetOperatingPointInfoRequest,
138            fidl::encoding::ResultType<DeviceGetOperatingPointInfoResponse, i32>,
139            DeviceMarker,
140        >(
141            (opp,),
142            0x6594a9234fc958e2,
143            fidl::encoding::DynamicFlags::empty(),
144            ___deadline,
145        )?;
146        Ok(_response.map(|x| x.info))
147    }
148
149    /// Gets the current operating point of the device.
150    pub fn r#get_current_operating_point(
151        &self,
152        ___deadline: zx::MonotonicInstant,
153    ) -> Result<u32, fidl::Error> {
154        let _response = self.client.send_query::<
155            fidl::encoding::EmptyPayload,
156            DeviceGetCurrentOperatingPointResponse,
157            DeviceMarker,
158        >(
159            (),
160            0x52de67a5993f5fe1,
161            fidl::encoding::DynamicFlags::empty(),
162            ___deadline,
163        )?;
164        Ok(_response.out_opp)
165    }
166
167    /// Set the operating point of this device to the requested operating point.
168    ///
169    /// Operating points are in numeric P-state order, such that the maximum
170    /// operating performance point is 0 and the minimum is n-1, where n is the
171    /// number of operating points returned by GetOperatingPointCount().
172    ///
173    /// The requested operating point may be clamped to the range [min, max]
174    /// when operating point limits are supported. See SetOperatingPointLimits
175    /// for details.
176    ///
177    /// Returns ZX_OK, if the device is in a working state and the operating
178    /// point is changed to requested_opp successfully. out_opp will be same as
179    /// requested_opp.
180    ///
181    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
182    /// [n-1, 0], where n is the number of operating points returned by
183    /// GetOperatingPointCount().
184    ///
185    /// Returns error status, if switching to the requested_opp was
186    /// unsuccessful. out_opp is the operating performance point (OPP) that the
187    /// device is currently in.
188    pub fn r#set_current_operating_point(
189        &self,
190        mut requested_opp: u32,
191        ___deadline: zx::MonotonicInstant,
192    ) -> Result<DeviceSetCurrentOperatingPointResult, fidl::Error> {
193        let _response = self.client.send_query::<
194            DeviceSetCurrentOperatingPointRequest,
195            fidl::encoding::ResultType<DeviceSetCurrentOperatingPointResponse, i32>,
196            DeviceMarker,
197        >(
198            (requested_opp,),
199            0x34a7828b5ca53fd,
200            fidl::encoding::DynamicFlags::empty(),
201            ___deadline,
202        )?;
203        Ok(_response.map(|x| x.out_opp))
204    }
205
206    /// Sets the minimum operating point to use, particularly when the kernel
207    /// automatically controls the operating points of this device.
208    ///
209    /// See SetOperatingPointLimits for details on the semantics of operating
210    /// point limits.
211    ///
212    /// Returns ZX_OK on success.
213    ///
214    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
215    /// [n-1, 0], where n is the number of operating points returned by
216    /// GetOperatingPointCount().
217    ///
218    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
219    pub fn r#set_minimum_operating_point_limit(
220        &self,
221        mut minimum_opp: u32,
222        ___deadline: zx::MonotonicInstant,
223    ) -> Result<DeviceSetMinimumOperatingPointLimitResult, fidl::Error> {
224        let _response = self.client.send_query::<
225            DeviceSetMinimumOperatingPointLimitRequest,
226            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
227            DeviceMarker,
228        >(
229            (minimum_opp,),
230            0x5467de86fa3fdfe7,
231            fidl::encoding::DynamicFlags::empty(),
232            ___deadline,
233        )?;
234        Ok(_response.map(|x| x))
235    }
236
237    /// Sets the maximum operating point to use, particularly when the kernel
238    /// automatically controls the operating points of this device.
239    ///
240    /// See SetOperatingPointLimits for details on the semantics of operating
241    /// point limits.
242    ///
243    /// Returns ZX_OK on success.
244    ///
245    /// Returns ZX_ERR_OUT_OF_RANGE if the maximum_opp is outside of the range
246    /// [n-1, 0], where n is the number of operating points returned by
247    /// GetOperatingPointCount().
248    ///
249    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
250    pub fn r#set_maximum_operating_point_limit(
251        &self,
252        mut maximum_opp: u32,
253        ___deadline: zx::MonotonicInstant,
254    ) -> Result<DeviceSetMaximumOperatingPointLimitResult, fidl::Error> {
255        let _response = self.client.send_query::<
256            DeviceSetMaximumOperatingPointLimitRequest,
257            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
258            DeviceMarker,
259        >(
260            (maximum_opp,),
261            0x385fa4d74481fbfd,
262            fidl::encoding::DynamicFlags::empty(),
263            ___deadline,
264        )?;
265        Ok(_response.map(|x| x))
266    }
267
268    /// Sets the operational boundaries (minimum and maximum operating points)
269    /// for the device, when supported.
270    ///
271    /// Limits define the allowable performance range for the performance
272    /// domain. They are primarily used for:
273    /// * Thermal Mitigation: Progressively lowering the maximum operating point
274    ///   (moving from 0 toward n-1) to reduce power dissipation.
275    /// * Performance Boosting: Raising the minimum operating point (moving
276    ///   from n-1 toward 0) when automatic performance matching is insufficient
277    ///   for the current workload.
278    ///
279    /// Limits are useful on platforms where ether hardware or the kernel
280    /// automatically manages performance. By setting boundaries, userspace can
281    /// enforce power and performance policies while allowing the underlying
282    /// system to react to high-fidelity signals in real-time.
283    ///
284    /// When limits are applied, the active operating point is clamped to the range:
285    /// `[max(minimum_opp, maximim_opp), maximum_opp]`.
286    ///
287    /// Note that `maximim_opp` and `minimum_opp` reside in the P-state range [n-1, 0].
288    /// This logic ensures that the `minimum_opp` can be adjusted independently while
289    /// always respecting the ceiling imposed by the `maximim_opp`.
290    ///
291    /// Set the operating point limits to (n-1, 0) to effectively remove the limits.
292    ///
293    /// Returns ZX_OK on success.
294    ///
295    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp or maximum_opp is outside
296    /// of the range [n-1, 0], where n is the number of operating points
297    /// returned by GetOperatingPointCount().
298    ///
299    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
300    pub fn r#set_operating_point_limits(
301        &self,
302        mut minimum_opp: u32,
303        mut maximum_opp: u32,
304        ___deadline: zx::MonotonicInstant,
305    ) -> Result<DeviceSetOperatingPointLimitsResult, fidl::Error> {
306        let _response = self.client.send_query::<
307            DeviceSetOperatingPointLimitsRequest,
308            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
309            DeviceMarker,
310        >(
311            (minimum_opp, maximum_opp,),
312            0x30aa7514dd598b23,
313            fidl::encoding::DynamicFlags::empty(),
314            ___deadline,
315        )?;
316        Ok(_response.map(|x| x))
317    }
318
319    /// Returns the current minimum and maximum operating point limits.
320    ///
321    /// Returns ZX_OK on success.
322    ///
323    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
324    pub fn r#get_current_operating_point_limits(
325        &self,
326        ___deadline: zx::MonotonicInstant,
327    ) -> Result<DeviceGetCurrentOperatingPointLimitsResult, fidl::Error> {
328        let _response =
329            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
330                DeviceGetCurrentOperatingPointLimitsResponse,
331                i32,
332            >, DeviceMarker>(
333                (),
334                0x7aefe3d765cfc6a7,
335                fidl::encoding::DynamicFlags::empty(),
336                ___deadline,
337            )?;
338        Ok(_response.map(|x| (x.minimum_opp, x.maximum_opp)))
339    }
340
341    /// Returns the number of operating points within this performance domain.
342    pub fn r#get_operating_point_count(
343        &self,
344        ___deadline: zx::MonotonicInstant,
345    ) -> Result<DeviceGetOperatingPointCountResult, fidl::Error> {
346        let _response = self.client.send_query::<
347            fidl::encoding::EmptyPayload,
348            fidl::encoding::ResultType<DeviceGetOperatingPointCountResponse, i32>,
349            DeviceMarker,
350        >(
351            (),
352            0x13e70ec7131889ba,
353            fidl::encoding::DynamicFlags::empty(),
354            ___deadline,
355        )?;
356        Ok(_response.map(|x| x.count))
357    }
358
359    /// Returns the number of logical cores contained within this performance
360    /// domain.
361    pub fn r#get_num_logical_cores(
362        &self,
363        ___deadline: zx::MonotonicInstant,
364    ) -> Result<u64, fidl::Error> {
365        let _response = self.client.send_query::<
366            fidl::encoding::EmptyPayload,
367            DeviceGetNumLogicalCoresResponse,
368            DeviceMarker,
369        >(
370            (),
371            0x74e304c90ca165c5,
372            fidl::encoding::DynamicFlags::empty(),
373            ___deadline,
374        )?;
375        Ok(_response.count)
376    }
377
378    /// Returns a global system-wide core ID for the nth core in this
379    /// performance domain. `index` must be a value in the range [0, n) where
380    /// n is the value returned by GetNumLogicalCores().
381    pub fn r#get_logical_core_id(
382        &self,
383        mut index: u64,
384        ___deadline: zx::MonotonicInstant,
385    ) -> Result<u64, fidl::Error> {
386        let _response = self.client.send_query::<
387            DeviceGetLogicalCoreIdRequest,
388            DeviceGetLogicalCoreIdResponse,
389            DeviceMarker,
390        >(
391            (index,),
392            0x7168f98ddbd26058,
393            fidl::encoding::DynamicFlags::empty(),
394            ___deadline,
395        )?;
396        Ok(_response.id)
397    }
398
399    /// Returns the id of this performance domain within its package. This
400    /// number should be stable across boots, but clients should prefer to use
401    /// GetRelativePerformance to differentiate cores if possible.
402    pub fn r#get_domain_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
403        let _response = self
404            .client
405            .send_query::<fidl::encoding::EmptyPayload, DeviceGetDomainIdResponse, DeviceMarker>(
406                (),
407                0x3030f85bdc1ef321,
408                fidl::encoding::DynamicFlags::empty(),
409                ___deadline,
410            )?;
411        Ok(_response.domain_id)
412    }
413
414    /// The relative performance of this domain as configured by the platform,
415    /// if known. The highest performance domain should return 255, while others
416    /// should return N/255 fractional values relative to that domain.
417    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
418    pub fn r#get_relative_performance(
419        &self,
420        ___deadline: zx::MonotonicInstant,
421    ) -> Result<DeviceGetRelativePerformanceResult, fidl::Error> {
422        let _response = self.client.send_query::<
423            fidl::encoding::EmptyPayload,
424            fidl::encoding::ResultType<DeviceGetRelativePerformanceResponse, i32>,
425            DeviceMarker,
426        >(
427            (),
428            0x41c37eaf0c26a3d3,
429            fidl::encoding::DynamicFlags::empty(),
430            ___deadline,
431        )?;
432        Ok(_response.map(|x| x.relative_performance))
433    }
434}
435
436#[cfg(target_os = "fuchsia")]
437impl From<DeviceSynchronousProxy> for zx::NullableHandle {
438    fn from(value: DeviceSynchronousProxy) -> Self {
439        value.into_channel().into()
440    }
441}
442
443#[cfg(target_os = "fuchsia")]
444impl From<fidl::Channel> for DeviceSynchronousProxy {
445    fn from(value: fidl::Channel) -> Self {
446        Self::new(value)
447    }
448}
449
450#[cfg(target_os = "fuchsia")]
451impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
452    type Protocol = DeviceMarker;
453
454    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
455        Self::new(value.into_channel())
456    }
457}
458
459#[derive(Debug, Clone)]
460pub struct DeviceProxy {
461    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
462}
463
464impl fidl::endpoints::Proxy for DeviceProxy {
465    type Protocol = DeviceMarker;
466
467    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
468        Self::new(inner)
469    }
470
471    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
472        self.client.into_channel().map_err(|client| Self { client })
473    }
474
475    fn as_channel(&self) -> &::fidl::AsyncChannel {
476        self.client.as_channel()
477    }
478}
479
480impl DeviceProxy {
481    /// Create a new Proxy for fuchsia.hardware.cpu.ctrl/Device.
482    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
483        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
484        Self { client: fidl::client::Client::new(channel, protocol_name) }
485    }
486
487    /// Get a Stream of events from the remote end of the protocol.
488    ///
489    /// # Panics
490    ///
491    /// Panics if the event stream was already taken.
492    pub fn take_event_stream(&self) -> DeviceEventStream {
493        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
494    }
495
496    /// Returns information about a given operating point for this performance
497    /// domain.
498    pub fn r#get_operating_point_info(
499        &self,
500        mut opp: u32,
501    ) -> fidl::client::QueryResponseFut<
502        DeviceGetOperatingPointInfoResult,
503        fidl::encoding::DefaultFuchsiaResourceDialect,
504    > {
505        DeviceProxyInterface::r#get_operating_point_info(self, opp)
506    }
507
508    /// Gets the current operating point of the device.
509    pub fn r#get_current_operating_point(
510        &self,
511    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
512        DeviceProxyInterface::r#get_current_operating_point(self)
513    }
514
515    /// Set the operating point of this device to the requested operating point.
516    ///
517    /// Operating points are in numeric P-state order, such that the maximum
518    /// operating performance point is 0 and the minimum is n-1, where n is the
519    /// number of operating points returned by GetOperatingPointCount().
520    ///
521    /// The requested operating point may be clamped to the range [min, max]
522    /// when operating point limits are supported. See SetOperatingPointLimits
523    /// for details.
524    ///
525    /// Returns ZX_OK, if the device is in a working state and the operating
526    /// point is changed to requested_opp successfully. out_opp will be same as
527    /// requested_opp.
528    ///
529    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
530    /// [n-1, 0], where n is the number of operating points returned by
531    /// GetOperatingPointCount().
532    ///
533    /// Returns error status, if switching to the requested_opp was
534    /// unsuccessful. out_opp is the operating performance point (OPP) that the
535    /// device is currently in.
536    pub fn r#set_current_operating_point(
537        &self,
538        mut requested_opp: u32,
539    ) -> fidl::client::QueryResponseFut<
540        DeviceSetCurrentOperatingPointResult,
541        fidl::encoding::DefaultFuchsiaResourceDialect,
542    > {
543        DeviceProxyInterface::r#set_current_operating_point(self, requested_opp)
544    }
545
546    /// Sets the minimum operating point to use, particularly when the kernel
547    /// automatically controls the operating points of this device.
548    ///
549    /// See SetOperatingPointLimits for details on the semantics of operating
550    /// point limits.
551    ///
552    /// Returns ZX_OK on success.
553    ///
554    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
555    /// [n-1, 0], where n is the number of operating points returned by
556    /// GetOperatingPointCount().
557    ///
558    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
559    pub fn r#set_minimum_operating_point_limit(
560        &self,
561        mut minimum_opp: u32,
562    ) -> fidl::client::QueryResponseFut<
563        DeviceSetMinimumOperatingPointLimitResult,
564        fidl::encoding::DefaultFuchsiaResourceDialect,
565    > {
566        DeviceProxyInterface::r#set_minimum_operating_point_limit(self, minimum_opp)
567    }
568
569    /// Sets the maximum operating point to use, particularly when the kernel
570    /// automatically controls the operating points of this device.
571    ///
572    /// See SetOperatingPointLimits for details on the semantics of operating
573    /// point limits.
574    ///
575    /// Returns ZX_OK on success.
576    ///
577    /// Returns ZX_ERR_OUT_OF_RANGE if the maximum_opp is outside of the range
578    /// [n-1, 0], where n is the number of operating points returned by
579    /// GetOperatingPointCount().
580    ///
581    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
582    pub fn r#set_maximum_operating_point_limit(
583        &self,
584        mut maximum_opp: u32,
585    ) -> fidl::client::QueryResponseFut<
586        DeviceSetMaximumOperatingPointLimitResult,
587        fidl::encoding::DefaultFuchsiaResourceDialect,
588    > {
589        DeviceProxyInterface::r#set_maximum_operating_point_limit(self, maximum_opp)
590    }
591
592    /// Sets the operational boundaries (minimum and maximum operating points)
593    /// for the device, when supported.
594    ///
595    /// Limits define the allowable performance range for the performance
596    /// domain. They are primarily used for:
597    /// * Thermal Mitigation: Progressively lowering the maximum operating point
598    ///   (moving from 0 toward n-1) to reduce power dissipation.
599    /// * Performance Boosting: Raising the minimum operating point (moving
600    ///   from n-1 toward 0) when automatic performance matching is insufficient
601    ///   for the current workload.
602    ///
603    /// Limits are useful on platforms where ether hardware or the kernel
604    /// automatically manages performance. By setting boundaries, userspace can
605    /// enforce power and performance policies while allowing the underlying
606    /// system to react to high-fidelity signals in real-time.
607    ///
608    /// When limits are applied, the active operating point is clamped to the range:
609    /// `[max(minimum_opp, maximim_opp), maximum_opp]`.
610    ///
611    /// Note that `maximim_opp` and `minimum_opp` reside in the P-state range [n-1, 0].
612    /// This logic ensures that the `minimum_opp` can be adjusted independently while
613    /// always respecting the ceiling imposed by the `maximim_opp`.
614    ///
615    /// Set the operating point limits to (n-1, 0) to effectively remove the limits.
616    ///
617    /// Returns ZX_OK on success.
618    ///
619    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp or maximum_opp is outside
620    /// of the range [n-1, 0], where n is the number of operating points
621    /// returned by GetOperatingPointCount().
622    ///
623    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
624    pub fn r#set_operating_point_limits(
625        &self,
626        mut minimum_opp: u32,
627        mut maximum_opp: u32,
628    ) -> fidl::client::QueryResponseFut<
629        DeviceSetOperatingPointLimitsResult,
630        fidl::encoding::DefaultFuchsiaResourceDialect,
631    > {
632        DeviceProxyInterface::r#set_operating_point_limits(self, minimum_opp, maximum_opp)
633    }
634
635    /// Returns the current minimum and maximum operating point limits.
636    ///
637    /// Returns ZX_OK on success.
638    ///
639    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
640    pub fn r#get_current_operating_point_limits(
641        &self,
642    ) -> fidl::client::QueryResponseFut<
643        DeviceGetCurrentOperatingPointLimitsResult,
644        fidl::encoding::DefaultFuchsiaResourceDialect,
645    > {
646        DeviceProxyInterface::r#get_current_operating_point_limits(self)
647    }
648
649    /// Returns the number of operating points within this performance domain.
650    pub fn r#get_operating_point_count(
651        &self,
652    ) -> fidl::client::QueryResponseFut<
653        DeviceGetOperatingPointCountResult,
654        fidl::encoding::DefaultFuchsiaResourceDialect,
655    > {
656        DeviceProxyInterface::r#get_operating_point_count(self)
657    }
658
659    /// Returns the number of logical cores contained within this performance
660    /// domain.
661    pub fn r#get_num_logical_cores(
662        &self,
663    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
664        DeviceProxyInterface::r#get_num_logical_cores(self)
665    }
666
667    /// Returns a global system-wide core ID for the nth core in this
668    /// performance domain. `index` must be a value in the range [0, n) where
669    /// n is the value returned by GetNumLogicalCores().
670    pub fn r#get_logical_core_id(
671        &self,
672        mut index: u64,
673    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
674        DeviceProxyInterface::r#get_logical_core_id(self, index)
675    }
676
677    /// Returns the id of this performance domain within its package. This
678    /// number should be stable across boots, but clients should prefer to use
679    /// GetRelativePerformance to differentiate cores if possible.
680    pub fn r#get_domain_id(
681        &self,
682    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
683        DeviceProxyInterface::r#get_domain_id(self)
684    }
685
686    /// The relative performance of this domain as configured by the platform,
687    /// if known. The highest performance domain should return 255, while others
688    /// should return N/255 fractional values relative to that domain.
689    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
690    pub fn r#get_relative_performance(
691        &self,
692    ) -> fidl::client::QueryResponseFut<
693        DeviceGetRelativePerformanceResult,
694        fidl::encoding::DefaultFuchsiaResourceDialect,
695    > {
696        DeviceProxyInterface::r#get_relative_performance(self)
697    }
698}
699
700impl DeviceProxyInterface for DeviceProxy {
701    type GetOperatingPointInfoResponseFut = fidl::client::QueryResponseFut<
702        DeviceGetOperatingPointInfoResult,
703        fidl::encoding::DefaultFuchsiaResourceDialect,
704    >;
705    fn r#get_operating_point_info(&self, mut opp: u32) -> Self::GetOperatingPointInfoResponseFut {
706        fn _decode(
707            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
708        ) -> Result<DeviceGetOperatingPointInfoResult, fidl::Error> {
709            let _response = fidl::client::decode_transaction_body::<
710                fidl::encoding::ResultType<DeviceGetOperatingPointInfoResponse, i32>,
711                fidl::encoding::DefaultFuchsiaResourceDialect,
712                0x6594a9234fc958e2,
713            >(_buf?)?;
714            Ok(_response.map(|x| x.info))
715        }
716        self.client.send_query_and_decode::<
717            DeviceGetOperatingPointInfoRequest,
718            DeviceGetOperatingPointInfoResult,
719        >(
720            (opp,),
721            0x6594a9234fc958e2,
722            fidl::encoding::DynamicFlags::empty(),
723            _decode,
724        )
725    }
726
727    type GetCurrentOperatingPointResponseFut =
728        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
729    fn r#get_current_operating_point(&self) -> Self::GetCurrentOperatingPointResponseFut {
730        fn _decode(
731            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
732        ) -> Result<u32, fidl::Error> {
733            let _response = fidl::client::decode_transaction_body::<
734                DeviceGetCurrentOperatingPointResponse,
735                fidl::encoding::DefaultFuchsiaResourceDialect,
736                0x52de67a5993f5fe1,
737            >(_buf?)?;
738            Ok(_response.out_opp)
739        }
740        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
741            (),
742            0x52de67a5993f5fe1,
743            fidl::encoding::DynamicFlags::empty(),
744            _decode,
745        )
746    }
747
748    type SetCurrentOperatingPointResponseFut = fidl::client::QueryResponseFut<
749        DeviceSetCurrentOperatingPointResult,
750        fidl::encoding::DefaultFuchsiaResourceDialect,
751    >;
752    fn r#set_current_operating_point(
753        &self,
754        mut requested_opp: u32,
755    ) -> Self::SetCurrentOperatingPointResponseFut {
756        fn _decode(
757            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
758        ) -> Result<DeviceSetCurrentOperatingPointResult, fidl::Error> {
759            let _response = fidl::client::decode_transaction_body::<
760                fidl::encoding::ResultType<DeviceSetCurrentOperatingPointResponse, i32>,
761                fidl::encoding::DefaultFuchsiaResourceDialect,
762                0x34a7828b5ca53fd,
763            >(_buf?)?;
764            Ok(_response.map(|x| x.out_opp))
765        }
766        self.client.send_query_and_decode::<
767            DeviceSetCurrentOperatingPointRequest,
768            DeviceSetCurrentOperatingPointResult,
769        >(
770            (requested_opp,),
771            0x34a7828b5ca53fd,
772            fidl::encoding::DynamicFlags::empty(),
773            _decode,
774        )
775    }
776
777    type SetMinimumOperatingPointLimitResponseFut = fidl::client::QueryResponseFut<
778        DeviceSetMinimumOperatingPointLimitResult,
779        fidl::encoding::DefaultFuchsiaResourceDialect,
780    >;
781    fn r#set_minimum_operating_point_limit(
782        &self,
783        mut minimum_opp: u32,
784    ) -> Self::SetMinimumOperatingPointLimitResponseFut {
785        fn _decode(
786            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
787        ) -> Result<DeviceSetMinimumOperatingPointLimitResult, fidl::Error> {
788            let _response = fidl::client::decode_transaction_body::<
789                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
790                fidl::encoding::DefaultFuchsiaResourceDialect,
791                0x5467de86fa3fdfe7,
792            >(_buf?)?;
793            Ok(_response.map(|x| x))
794        }
795        self.client.send_query_and_decode::<
796            DeviceSetMinimumOperatingPointLimitRequest,
797            DeviceSetMinimumOperatingPointLimitResult,
798        >(
799            (minimum_opp,),
800            0x5467de86fa3fdfe7,
801            fidl::encoding::DynamicFlags::empty(),
802            _decode,
803        )
804    }
805
806    type SetMaximumOperatingPointLimitResponseFut = fidl::client::QueryResponseFut<
807        DeviceSetMaximumOperatingPointLimitResult,
808        fidl::encoding::DefaultFuchsiaResourceDialect,
809    >;
810    fn r#set_maximum_operating_point_limit(
811        &self,
812        mut maximum_opp: u32,
813    ) -> Self::SetMaximumOperatingPointLimitResponseFut {
814        fn _decode(
815            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
816        ) -> Result<DeviceSetMaximumOperatingPointLimitResult, fidl::Error> {
817            let _response = fidl::client::decode_transaction_body::<
818                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
819                fidl::encoding::DefaultFuchsiaResourceDialect,
820                0x385fa4d74481fbfd,
821            >(_buf?)?;
822            Ok(_response.map(|x| x))
823        }
824        self.client.send_query_and_decode::<
825            DeviceSetMaximumOperatingPointLimitRequest,
826            DeviceSetMaximumOperatingPointLimitResult,
827        >(
828            (maximum_opp,),
829            0x385fa4d74481fbfd,
830            fidl::encoding::DynamicFlags::empty(),
831            _decode,
832        )
833    }
834
835    type SetOperatingPointLimitsResponseFut = fidl::client::QueryResponseFut<
836        DeviceSetOperatingPointLimitsResult,
837        fidl::encoding::DefaultFuchsiaResourceDialect,
838    >;
839    fn r#set_operating_point_limits(
840        &self,
841        mut minimum_opp: u32,
842        mut maximum_opp: u32,
843    ) -> Self::SetOperatingPointLimitsResponseFut {
844        fn _decode(
845            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
846        ) -> Result<DeviceSetOperatingPointLimitsResult, fidl::Error> {
847            let _response = fidl::client::decode_transaction_body::<
848                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
849                fidl::encoding::DefaultFuchsiaResourceDialect,
850                0x30aa7514dd598b23,
851            >(_buf?)?;
852            Ok(_response.map(|x| x))
853        }
854        self.client.send_query_and_decode::<
855            DeviceSetOperatingPointLimitsRequest,
856            DeviceSetOperatingPointLimitsResult,
857        >(
858            (minimum_opp, maximum_opp,),
859            0x30aa7514dd598b23,
860            fidl::encoding::DynamicFlags::empty(),
861            _decode,
862        )
863    }
864
865    type GetCurrentOperatingPointLimitsResponseFut = fidl::client::QueryResponseFut<
866        DeviceGetCurrentOperatingPointLimitsResult,
867        fidl::encoding::DefaultFuchsiaResourceDialect,
868    >;
869    fn r#get_current_operating_point_limits(
870        &self,
871    ) -> Self::GetCurrentOperatingPointLimitsResponseFut {
872        fn _decode(
873            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
874        ) -> Result<DeviceGetCurrentOperatingPointLimitsResult, fidl::Error> {
875            let _response = fidl::client::decode_transaction_body::<
876                fidl::encoding::ResultType<DeviceGetCurrentOperatingPointLimitsResponse, i32>,
877                fidl::encoding::DefaultFuchsiaResourceDialect,
878                0x7aefe3d765cfc6a7,
879            >(_buf?)?;
880            Ok(_response.map(|x| (x.minimum_opp, x.maximum_opp)))
881        }
882        self.client.send_query_and_decode::<
883            fidl::encoding::EmptyPayload,
884            DeviceGetCurrentOperatingPointLimitsResult,
885        >(
886            (),
887            0x7aefe3d765cfc6a7,
888            fidl::encoding::DynamicFlags::empty(),
889            _decode,
890        )
891    }
892
893    type GetOperatingPointCountResponseFut = fidl::client::QueryResponseFut<
894        DeviceGetOperatingPointCountResult,
895        fidl::encoding::DefaultFuchsiaResourceDialect,
896    >;
897    fn r#get_operating_point_count(&self) -> Self::GetOperatingPointCountResponseFut {
898        fn _decode(
899            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
900        ) -> Result<DeviceGetOperatingPointCountResult, fidl::Error> {
901            let _response = fidl::client::decode_transaction_body::<
902                fidl::encoding::ResultType<DeviceGetOperatingPointCountResponse, i32>,
903                fidl::encoding::DefaultFuchsiaResourceDialect,
904                0x13e70ec7131889ba,
905            >(_buf?)?;
906            Ok(_response.map(|x| x.count))
907        }
908        self.client.send_query_and_decode::<
909            fidl::encoding::EmptyPayload,
910            DeviceGetOperatingPointCountResult,
911        >(
912            (),
913            0x13e70ec7131889ba,
914            fidl::encoding::DynamicFlags::empty(),
915            _decode,
916        )
917    }
918
919    type GetNumLogicalCoresResponseFut =
920        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
921    fn r#get_num_logical_cores(&self) -> Self::GetNumLogicalCoresResponseFut {
922        fn _decode(
923            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
924        ) -> Result<u64, fidl::Error> {
925            let _response = fidl::client::decode_transaction_body::<
926                DeviceGetNumLogicalCoresResponse,
927                fidl::encoding::DefaultFuchsiaResourceDialect,
928                0x74e304c90ca165c5,
929            >(_buf?)?;
930            Ok(_response.count)
931        }
932        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
933            (),
934            0x74e304c90ca165c5,
935            fidl::encoding::DynamicFlags::empty(),
936            _decode,
937        )
938    }
939
940    type GetLogicalCoreIdResponseFut =
941        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
942    fn r#get_logical_core_id(&self, mut index: u64) -> Self::GetLogicalCoreIdResponseFut {
943        fn _decode(
944            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
945        ) -> Result<u64, fidl::Error> {
946            let _response = fidl::client::decode_transaction_body::<
947                DeviceGetLogicalCoreIdResponse,
948                fidl::encoding::DefaultFuchsiaResourceDialect,
949                0x7168f98ddbd26058,
950            >(_buf?)?;
951            Ok(_response.id)
952        }
953        self.client.send_query_and_decode::<DeviceGetLogicalCoreIdRequest, u64>(
954            (index,),
955            0x7168f98ddbd26058,
956            fidl::encoding::DynamicFlags::empty(),
957            _decode,
958        )
959    }
960
961    type GetDomainIdResponseFut =
962        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
963    fn r#get_domain_id(&self) -> Self::GetDomainIdResponseFut {
964        fn _decode(
965            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
966        ) -> Result<u32, fidl::Error> {
967            let _response = fidl::client::decode_transaction_body::<
968                DeviceGetDomainIdResponse,
969                fidl::encoding::DefaultFuchsiaResourceDialect,
970                0x3030f85bdc1ef321,
971            >(_buf?)?;
972            Ok(_response.domain_id)
973        }
974        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
975            (),
976            0x3030f85bdc1ef321,
977            fidl::encoding::DynamicFlags::empty(),
978            _decode,
979        )
980    }
981
982    type GetRelativePerformanceResponseFut = fidl::client::QueryResponseFut<
983        DeviceGetRelativePerformanceResult,
984        fidl::encoding::DefaultFuchsiaResourceDialect,
985    >;
986    fn r#get_relative_performance(&self) -> Self::GetRelativePerformanceResponseFut {
987        fn _decode(
988            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
989        ) -> Result<DeviceGetRelativePerformanceResult, fidl::Error> {
990            let _response = fidl::client::decode_transaction_body::<
991                fidl::encoding::ResultType<DeviceGetRelativePerformanceResponse, i32>,
992                fidl::encoding::DefaultFuchsiaResourceDialect,
993                0x41c37eaf0c26a3d3,
994            >(_buf?)?;
995            Ok(_response.map(|x| x.relative_performance))
996        }
997        self.client.send_query_and_decode::<
998            fidl::encoding::EmptyPayload,
999            DeviceGetRelativePerformanceResult,
1000        >(
1001            (),
1002            0x41c37eaf0c26a3d3,
1003            fidl::encoding::DynamicFlags::empty(),
1004            _decode,
1005        )
1006    }
1007}
1008
1009pub struct DeviceEventStream {
1010    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1011}
1012
1013impl std::marker::Unpin for DeviceEventStream {}
1014
1015impl futures::stream::FusedStream for DeviceEventStream {
1016    fn is_terminated(&self) -> bool {
1017        self.event_receiver.is_terminated()
1018    }
1019}
1020
1021impl futures::Stream for DeviceEventStream {
1022    type Item = Result<DeviceEvent, fidl::Error>;
1023
1024    fn poll_next(
1025        mut self: std::pin::Pin<&mut Self>,
1026        cx: &mut std::task::Context<'_>,
1027    ) -> std::task::Poll<Option<Self::Item>> {
1028        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1029            &mut self.event_receiver,
1030            cx
1031        )?) {
1032            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1033            None => std::task::Poll::Ready(None),
1034        }
1035    }
1036}
1037
1038#[derive(Debug)]
1039pub enum DeviceEvent {}
1040
1041impl DeviceEvent {
1042    /// Decodes a message buffer as a [`DeviceEvent`].
1043    fn decode(
1044        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1045    ) -> Result<DeviceEvent, fidl::Error> {
1046        let (bytes, _handles) = buf.split_mut();
1047        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1048        debug_assert_eq!(tx_header.tx_id, 0);
1049        match tx_header.ordinal {
1050            _ => Err(fidl::Error::UnknownOrdinal {
1051                ordinal: tx_header.ordinal,
1052                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1053            }),
1054        }
1055    }
1056}
1057
1058/// A Stream of incoming requests for fuchsia.hardware.cpu.ctrl/Device.
1059pub struct DeviceRequestStream {
1060    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1061    is_terminated: bool,
1062}
1063
1064impl std::marker::Unpin for DeviceRequestStream {}
1065
1066impl futures::stream::FusedStream for DeviceRequestStream {
1067    fn is_terminated(&self) -> bool {
1068        self.is_terminated
1069    }
1070}
1071
1072impl fidl::endpoints::RequestStream for DeviceRequestStream {
1073    type Protocol = DeviceMarker;
1074    type ControlHandle = DeviceControlHandle;
1075
1076    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1077        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1078    }
1079
1080    fn control_handle(&self) -> Self::ControlHandle {
1081        DeviceControlHandle { inner: self.inner.clone() }
1082    }
1083
1084    fn into_inner(
1085        self,
1086    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1087    {
1088        (self.inner, self.is_terminated)
1089    }
1090
1091    fn from_inner(
1092        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1093        is_terminated: bool,
1094    ) -> Self {
1095        Self { inner, is_terminated }
1096    }
1097}
1098
1099impl futures::Stream for DeviceRequestStream {
1100    type Item = Result<DeviceRequest, fidl::Error>;
1101
1102    fn poll_next(
1103        mut self: std::pin::Pin<&mut Self>,
1104        cx: &mut std::task::Context<'_>,
1105    ) -> std::task::Poll<Option<Self::Item>> {
1106        let this = &mut *self;
1107        if this.inner.check_shutdown(cx) {
1108            this.is_terminated = true;
1109            return std::task::Poll::Ready(None);
1110        }
1111        if this.is_terminated {
1112            panic!("polled DeviceRequestStream after completion");
1113        }
1114        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1115            |bytes, handles| {
1116                match this.inner.channel().read_etc(cx, bytes, handles) {
1117                    std::task::Poll::Ready(Ok(())) => {}
1118                    std::task::Poll::Pending => return std::task::Poll::Pending,
1119                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1120                        this.is_terminated = true;
1121                        return std::task::Poll::Ready(None);
1122                    }
1123                    std::task::Poll::Ready(Err(e)) => {
1124                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1125                            e.into(),
1126                        ))));
1127                    }
1128                }
1129
1130                // A message has been received from the channel
1131                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1132
1133                std::task::Poll::Ready(Some(match header.ordinal {
1134                    0x6594a9234fc958e2 => {
1135                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1136                        let mut req = fidl::new_empty!(
1137                            DeviceGetOperatingPointInfoRequest,
1138                            fidl::encoding::DefaultFuchsiaResourceDialect
1139                        );
1140                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetOperatingPointInfoRequest>(&header, _body_bytes, handles, &mut req)?;
1141                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1142                        Ok(DeviceRequest::GetOperatingPointInfo {
1143                            opp: req.opp,
1144
1145                            responder: DeviceGetOperatingPointInfoResponder {
1146                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1147                                tx_id: header.tx_id,
1148                            },
1149                        })
1150                    }
1151                    0x52de67a5993f5fe1 => {
1152                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1153                        let mut req = fidl::new_empty!(
1154                            fidl::encoding::EmptyPayload,
1155                            fidl::encoding::DefaultFuchsiaResourceDialect
1156                        );
1157                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1158                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1159                        Ok(DeviceRequest::GetCurrentOperatingPoint {
1160                            responder: DeviceGetCurrentOperatingPointResponder {
1161                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1162                                tx_id: header.tx_id,
1163                            },
1164                        })
1165                    }
1166                    0x34a7828b5ca53fd => {
1167                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1168                        let mut req = fidl::new_empty!(
1169                            DeviceSetCurrentOperatingPointRequest,
1170                            fidl::encoding::DefaultFuchsiaResourceDialect
1171                        );
1172                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetCurrentOperatingPointRequest>(&header, _body_bytes, handles, &mut req)?;
1173                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1174                        Ok(DeviceRequest::SetCurrentOperatingPoint {
1175                            requested_opp: req.requested_opp,
1176
1177                            responder: DeviceSetCurrentOperatingPointResponder {
1178                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1179                                tx_id: header.tx_id,
1180                            },
1181                        })
1182                    }
1183                    0x5467de86fa3fdfe7 => {
1184                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1185                        let mut req = fidl::new_empty!(
1186                            DeviceSetMinimumOperatingPointLimitRequest,
1187                            fidl::encoding::DefaultFuchsiaResourceDialect
1188                        );
1189                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetMinimumOperatingPointLimitRequest>(&header, _body_bytes, handles, &mut req)?;
1190                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1191                        Ok(DeviceRequest::SetMinimumOperatingPointLimit {
1192                            minimum_opp: req.minimum_opp,
1193
1194                            responder: DeviceSetMinimumOperatingPointLimitResponder {
1195                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1196                                tx_id: header.tx_id,
1197                            },
1198                        })
1199                    }
1200                    0x385fa4d74481fbfd => {
1201                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1202                        let mut req = fidl::new_empty!(
1203                            DeviceSetMaximumOperatingPointLimitRequest,
1204                            fidl::encoding::DefaultFuchsiaResourceDialect
1205                        );
1206                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetMaximumOperatingPointLimitRequest>(&header, _body_bytes, handles, &mut req)?;
1207                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1208                        Ok(DeviceRequest::SetMaximumOperatingPointLimit {
1209                            maximum_opp: req.maximum_opp,
1210
1211                            responder: DeviceSetMaximumOperatingPointLimitResponder {
1212                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1213                                tx_id: header.tx_id,
1214                            },
1215                        })
1216                    }
1217                    0x30aa7514dd598b23 => {
1218                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1219                        let mut req = fidl::new_empty!(
1220                            DeviceSetOperatingPointLimitsRequest,
1221                            fidl::encoding::DefaultFuchsiaResourceDialect
1222                        );
1223                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetOperatingPointLimitsRequest>(&header, _body_bytes, handles, &mut req)?;
1224                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1225                        Ok(DeviceRequest::SetOperatingPointLimits {
1226                            minimum_opp: req.minimum_opp,
1227                            maximum_opp: req.maximum_opp,
1228
1229                            responder: DeviceSetOperatingPointLimitsResponder {
1230                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1231                                tx_id: header.tx_id,
1232                            },
1233                        })
1234                    }
1235                    0x7aefe3d765cfc6a7 => {
1236                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1237                        let mut req = fidl::new_empty!(
1238                            fidl::encoding::EmptyPayload,
1239                            fidl::encoding::DefaultFuchsiaResourceDialect
1240                        );
1241                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1242                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1243                        Ok(DeviceRequest::GetCurrentOperatingPointLimits {
1244                            responder: DeviceGetCurrentOperatingPointLimitsResponder {
1245                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1246                                tx_id: header.tx_id,
1247                            },
1248                        })
1249                    }
1250                    0x13e70ec7131889ba => {
1251                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1252                        let mut req = fidl::new_empty!(
1253                            fidl::encoding::EmptyPayload,
1254                            fidl::encoding::DefaultFuchsiaResourceDialect
1255                        );
1256                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1257                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1258                        Ok(DeviceRequest::GetOperatingPointCount {
1259                            responder: DeviceGetOperatingPointCountResponder {
1260                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1261                                tx_id: header.tx_id,
1262                            },
1263                        })
1264                    }
1265                    0x74e304c90ca165c5 => {
1266                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1267                        let mut req = fidl::new_empty!(
1268                            fidl::encoding::EmptyPayload,
1269                            fidl::encoding::DefaultFuchsiaResourceDialect
1270                        );
1271                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1272                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1273                        Ok(DeviceRequest::GetNumLogicalCores {
1274                            responder: DeviceGetNumLogicalCoresResponder {
1275                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1276                                tx_id: header.tx_id,
1277                            },
1278                        })
1279                    }
1280                    0x7168f98ddbd26058 => {
1281                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1282                        let mut req = fidl::new_empty!(
1283                            DeviceGetLogicalCoreIdRequest,
1284                            fidl::encoding::DefaultFuchsiaResourceDialect
1285                        );
1286                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetLogicalCoreIdRequest>(&header, _body_bytes, handles, &mut req)?;
1287                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1288                        Ok(DeviceRequest::GetLogicalCoreId {
1289                            index: req.index,
1290
1291                            responder: DeviceGetLogicalCoreIdResponder {
1292                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1293                                tx_id: header.tx_id,
1294                            },
1295                        })
1296                    }
1297                    0x3030f85bdc1ef321 => {
1298                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1299                        let mut req = fidl::new_empty!(
1300                            fidl::encoding::EmptyPayload,
1301                            fidl::encoding::DefaultFuchsiaResourceDialect
1302                        );
1303                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1304                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1305                        Ok(DeviceRequest::GetDomainId {
1306                            responder: DeviceGetDomainIdResponder {
1307                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1308                                tx_id: header.tx_id,
1309                            },
1310                        })
1311                    }
1312                    0x41c37eaf0c26a3d3 => {
1313                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1314                        let mut req = fidl::new_empty!(
1315                            fidl::encoding::EmptyPayload,
1316                            fidl::encoding::DefaultFuchsiaResourceDialect
1317                        );
1318                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1319                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1320                        Ok(DeviceRequest::GetRelativePerformance {
1321                            responder: DeviceGetRelativePerformanceResponder {
1322                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1323                                tx_id: header.tx_id,
1324                            },
1325                        })
1326                    }
1327                    _ => Err(fidl::Error::UnknownOrdinal {
1328                        ordinal: header.ordinal,
1329                        protocol_name:
1330                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1331                    }),
1332                }))
1333            },
1334        )
1335    }
1336}
1337
1338#[derive(Debug)]
1339pub enum DeviceRequest {
1340    /// Returns information about a given operating point for this performance
1341    /// domain.
1342    GetOperatingPointInfo { opp: u32, responder: DeviceGetOperatingPointInfoResponder },
1343    /// Gets the current operating point of the device.
1344    GetCurrentOperatingPoint { responder: DeviceGetCurrentOperatingPointResponder },
1345    /// Set the operating point of this device to the requested operating point.
1346    ///
1347    /// Operating points are in numeric P-state order, such that the maximum
1348    /// operating performance point is 0 and the minimum is n-1, where n is the
1349    /// number of operating points returned by GetOperatingPointCount().
1350    ///
1351    /// The requested operating point may be clamped to the range [min, max]
1352    /// when operating point limits are supported. See SetOperatingPointLimits
1353    /// for details.
1354    ///
1355    /// Returns ZX_OK, if the device is in a working state and the operating
1356    /// point is changed to requested_opp successfully. out_opp will be same as
1357    /// requested_opp.
1358    ///
1359    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
1360    /// [n-1, 0], where n is the number of operating points returned by
1361    /// GetOperatingPointCount().
1362    ///
1363    /// Returns error status, if switching to the requested_opp was
1364    /// unsuccessful. out_opp is the operating performance point (OPP) that the
1365    /// device is currently in.
1366    SetCurrentOperatingPoint {
1367        requested_opp: u32,
1368        responder: DeviceSetCurrentOperatingPointResponder,
1369    },
1370    /// Sets the minimum operating point to use, particularly when the kernel
1371    /// automatically controls the operating points of this device.
1372    ///
1373    /// See SetOperatingPointLimits for details on the semantics of operating
1374    /// point limits.
1375    ///
1376    /// Returns ZX_OK on success.
1377    ///
1378    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
1379    /// [n-1, 0], where n is the number of operating points returned by
1380    /// GetOperatingPointCount().
1381    ///
1382    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
1383    SetMinimumOperatingPointLimit {
1384        minimum_opp: u32,
1385        responder: DeviceSetMinimumOperatingPointLimitResponder,
1386    },
1387    /// Sets the maximum operating point to use, particularly when the kernel
1388    /// automatically controls the operating points of this device.
1389    ///
1390    /// See SetOperatingPointLimits for details on the semantics of operating
1391    /// point limits.
1392    ///
1393    /// Returns ZX_OK on success.
1394    ///
1395    /// Returns ZX_ERR_OUT_OF_RANGE if the maximum_opp is outside of the range
1396    /// [n-1, 0], where n is the number of operating points returned by
1397    /// GetOperatingPointCount().
1398    ///
1399    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
1400    SetMaximumOperatingPointLimit {
1401        maximum_opp: u32,
1402        responder: DeviceSetMaximumOperatingPointLimitResponder,
1403    },
1404    /// Sets the operational boundaries (minimum and maximum operating points)
1405    /// for the device, when supported.
1406    ///
1407    /// Limits define the allowable performance range for the performance
1408    /// domain. They are primarily used for:
1409    /// * Thermal Mitigation: Progressively lowering the maximum operating point
1410    ///   (moving from 0 toward n-1) to reduce power dissipation.
1411    /// * Performance Boosting: Raising the minimum operating point (moving
1412    ///   from n-1 toward 0) when automatic performance matching is insufficient
1413    ///   for the current workload.
1414    ///
1415    /// Limits are useful on platforms where ether hardware or the kernel
1416    /// automatically manages performance. By setting boundaries, userspace can
1417    /// enforce power and performance policies while allowing the underlying
1418    /// system to react to high-fidelity signals in real-time.
1419    ///
1420    /// When limits are applied, the active operating point is clamped to the range:
1421    /// `[max(minimum_opp, maximim_opp), maximum_opp]`.
1422    ///
1423    /// Note that `maximim_opp` and `minimum_opp` reside in the P-state range [n-1, 0].
1424    /// This logic ensures that the `minimum_opp` can be adjusted independently while
1425    /// always respecting the ceiling imposed by the `maximim_opp`.
1426    ///
1427    /// Set the operating point limits to (n-1, 0) to effectively remove the limits.
1428    ///
1429    /// Returns ZX_OK on success.
1430    ///
1431    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp or maximum_opp is outside
1432    /// of the range [n-1, 0], where n is the number of operating points
1433    /// returned by GetOperatingPointCount().
1434    ///
1435    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
1436    SetOperatingPointLimits {
1437        minimum_opp: u32,
1438        maximum_opp: u32,
1439        responder: DeviceSetOperatingPointLimitsResponder,
1440    },
1441    /// Returns the current minimum and maximum operating point limits.
1442    ///
1443    /// Returns ZX_OK on success.
1444    ///
1445    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
1446    GetCurrentOperatingPointLimits { responder: DeviceGetCurrentOperatingPointLimitsResponder },
1447    /// Returns the number of operating points within this performance domain.
1448    GetOperatingPointCount { responder: DeviceGetOperatingPointCountResponder },
1449    /// Returns the number of logical cores contained within this performance
1450    /// domain.
1451    GetNumLogicalCores { responder: DeviceGetNumLogicalCoresResponder },
1452    /// Returns a global system-wide core ID for the nth core in this
1453    /// performance domain. `index` must be a value in the range [0, n) where
1454    /// n is the value returned by GetNumLogicalCores().
1455    GetLogicalCoreId { index: u64, responder: DeviceGetLogicalCoreIdResponder },
1456    /// Returns the id of this performance domain within its package. This
1457    /// number should be stable across boots, but clients should prefer to use
1458    /// GetRelativePerformance to differentiate cores if possible.
1459    GetDomainId { responder: DeviceGetDomainIdResponder },
1460    /// The relative performance of this domain as configured by the platform,
1461    /// if known. The highest performance domain should return 255, while others
1462    /// should return N/255 fractional values relative to that domain.
1463    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
1464    GetRelativePerformance { responder: DeviceGetRelativePerformanceResponder },
1465}
1466
1467impl DeviceRequest {
1468    #[allow(irrefutable_let_patterns)]
1469    pub fn into_get_operating_point_info(
1470        self,
1471    ) -> Option<(u32, DeviceGetOperatingPointInfoResponder)> {
1472        if let DeviceRequest::GetOperatingPointInfo { opp, responder } = self {
1473            Some((opp, responder))
1474        } else {
1475            None
1476        }
1477    }
1478
1479    #[allow(irrefutable_let_patterns)]
1480    pub fn into_get_current_operating_point(
1481        self,
1482    ) -> Option<(DeviceGetCurrentOperatingPointResponder)> {
1483        if let DeviceRequest::GetCurrentOperatingPoint { responder } = self {
1484            Some((responder))
1485        } else {
1486            None
1487        }
1488    }
1489
1490    #[allow(irrefutable_let_patterns)]
1491    pub fn into_set_current_operating_point(
1492        self,
1493    ) -> Option<(u32, DeviceSetCurrentOperatingPointResponder)> {
1494        if let DeviceRequest::SetCurrentOperatingPoint { requested_opp, responder } = self {
1495            Some((requested_opp, responder))
1496        } else {
1497            None
1498        }
1499    }
1500
1501    #[allow(irrefutable_let_patterns)]
1502    pub fn into_set_minimum_operating_point_limit(
1503        self,
1504    ) -> Option<(u32, DeviceSetMinimumOperatingPointLimitResponder)> {
1505        if let DeviceRequest::SetMinimumOperatingPointLimit { minimum_opp, responder } = self {
1506            Some((minimum_opp, responder))
1507        } else {
1508            None
1509        }
1510    }
1511
1512    #[allow(irrefutable_let_patterns)]
1513    pub fn into_set_maximum_operating_point_limit(
1514        self,
1515    ) -> Option<(u32, DeviceSetMaximumOperatingPointLimitResponder)> {
1516        if let DeviceRequest::SetMaximumOperatingPointLimit { maximum_opp, responder } = self {
1517            Some((maximum_opp, responder))
1518        } else {
1519            None
1520        }
1521    }
1522
1523    #[allow(irrefutable_let_patterns)]
1524    pub fn into_set_operating_point_limits(
1525        self,
1526    ) -> Option<(u32, u32, DeviceSetOperatingPointLimitsResponder)> {
1527        if let DeviceRequest::SetOperatingPointLimits { minimum_opp, maximum_opp, responder } = self
1528        {
1529            Some((minimum_opp, maximum_opp, responder))
1530        } else {
1531            None
1532        }
1533    }
1534
1535    #[allow(irrefutable_let_patterns)]
1536    pub fn into_get_current_operating_point_limits(
1537        self,
1538    ) -> Option<(DeviceGetCurrentOperatingPointLimitsResponder)> {
1539        if let DeviceRequest::GetCurrentOperatingPointLimits { responder } = self {
1540            Some((responder))
1541        } else {
1542            None
1543        }
1544    }
1545
1546    #[allow(irrefutable_let_patterns)]
1547    pub fn into_get_operating_point_count(self) -> Option<(DeviceGetOperatingPointCountResponder)> {
1548        if let DeviceRequest::GetOperatingPointCount { responder } = self {
1549            Some((responder))
1550        } else {
1551            None
1552        }
1553    }
1554
1555    #[allow(irrefutable_let_patterns)]
1556    pub fn into_get_num_logical_cores(self) -> Option<(DeviceGetNumLogicalCoresResponder)> {
1557        if let DeviceRequest::GetNumLogicalCores { responder } = self {
1558            Some((responder))
1559        } else {
1560            None
1561        }
1562    }
1563
1564    #[allow(irrefutable_let_patterns)]
1565    pub fn into_get_logical_core_id(self) -> Option<(u64, DeviceGetLogicalCoreIdResponder)> {
1566        if let DeviceRequest::GetLogicalCoreId { index, responder } = self {
1567            Some((index, responder))
1568        } else {
1569            None
1570        }
1571    }
1572
1573    #[allow(irrefutable_let_patterns)]
1574    pub fn into_get_domain_id(self) -> Option<(DeviceGetDomainIdResponder)> {
1575        if let DeviceRequest::GetDomainId { responder } = self { Some((responder)) } else { None }
1576    }
1577
1578    #[allow(irrefutable_let_patterns)]
1579    pub fn into_get_relative_performance(self) -> Option<(DeviceGetRelativePerformanceResponder)> {
1580        if let DeviceRequest::GetRelativePerformance { responder } = self {
1581            Some((responder))
1582        } else {
1583            None
1584        }
1585    }
1586
1587    /// Name of the method defined in FIDL
1588    pub fn method_name(&self) -> &'static str {
1589        match *self {
1590            DeviceRequest::GetOperatingPointInfo { .. } => "get_operating_point_info",
1591            DeviceRequest::GetCurrentOperatingPoint { .. } => "get_current_operating_point",
1592            DeviceRequest::SetCurrentOperatingPoint { .. } => "set_current_operating_point",
1593            DeviceRequest::SetMinimumOperatingPointLimit { .. } => {
1594                "set_minimum_operating_point_limit"
1595            }
1596            DeviceRequest::SetMaximumOperatingPointLimit { .. } => {
1597                "set_maximum_operating_point_limit"
1598            }
1599            DeviceRequest::SetOperatingPointLimits { .. } => "set_operating_point_limits",
1600            DeviceRequest::GetCurrentOperatingPointLimits { .. } => {
1601                "get_current_operating_point_limits"
1602            }
1603            DeviceRequest::GetOperatingPointCount { .. } => "get_operating_point_count",
1604            DeviceRequest::GetNumLogicalCores { .. } => "get_num_logical_cores",
1605            DeviceRequest::GetLogicalCoreId { .. } => "get_logical_core_id",
1606            DeviceRequest::GetDomainId { .. } => "get_domain_id",
1607            DeviceRequest::GetRelativePerformance { .. } => "get_relative_performance",
1608        }
1609    }
1610}
1611
1612#[derive(Debug, Clone)]
1613pub struct DeviceControlHandle {
1614    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1615}
1616
1617impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1618    fn shutdown(&self) {
1619        self.inner.shutdown()
1620    }
1621
1622    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1623        self.inner.shutdown_with_epitaph(status)
1624    }
1625
1626    fn is_closed(&self) -> bool {
1627        self.inner.channel().is_closed()
1628    }
1629    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1630        self.inner.channel().on_closed()
1631    }
1632
1633    #[cfg(target_os = "fuchsia")]
1634    fn signal_peer(
1635        &self,
1636        clear_mask: zx::Signals,
1637        set_mask: zx::Signals,
1638    ) -> Result<(), zx_status::Status> {
1639        use fidl::Peered;
1640        self.inner.channel().signal_peer(clear_mask, set_mask)
1641    }
1642}
1643
1644impl DeviceControlHandle {}
1645
1646#[must_use = "FIDL methods require a response to be sent"]
1647#[derive(Debug)]
1648pub struct DeviceGetOperatingPointInfoResponder {
1649    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1650    tx_id: u32,
1651}
1652
1653/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1654/// if the responder is dropped without sending a response, so that the client
1655/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1656impl std::ops::Drop for DeviceGetOperatingPointInfoResponder {
1657    fn drop(&mut self) {
1658        self.control_handle.shutdown();
1659        // Safety: drops once, never accessed again
1660        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1661    }
1662}
1663
1664impl fidl::endpoints::Responder for DeviceGetOperatingPointInfoResponder {
1665    type ControlHandle = DeviceControlHandle;
1666
1667    fn control_handle(&self) -> &DeviceControlHandle {
1668        &self.control_handle
1669    }
1670
1671    fn drop_without_shutdown(mut self) {
1672        // Safety: drops once, never accessed again due to mem::forget
1673        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1674        // Prevent Drop from running (which would shut down the channel)
1675        std::mem::forget(self);
1676    }
1677}
1678
1679impl DeviceGetOperatingPointInfoResponder {
1680    /// Sends a response to the FIDL transaction.
1681    ///
1682    /// Sets the channel to shutdown if an error occurs.
1683    pub fn send(self, mut result: Result<&CpuOperatingPointInfo, i32>) -> Result<(), fidl::Error> {
1684        let _result = self.send_raw(result);
1685        if _result.is_err() {
1686            self.control_handle.shutdown();
1687        }
1688        self.drop_without_shutdown();
1689        _result
1690    }
1691
1692    /// Similar to "send" but does not shutdown the channel if an error occurs.
1693    pub fn send_no_shutdown_on_err(
1694        self,
1695        mut result: Result<&CpuOperatingPointInfo, i32>,
1696    ) -> Result<(), fidl::Error> {
1697        let _result = self.send_raw(result);
1698        self.drop_without_shutdown();
1699        _result
1700    }
1701
1702    fn send_raw(&self, mut result: Result<&CpuOperatingPointInfo, i32>) -> Result<(), fidl::Error> {
1703        self.control_handle.inner.send::<fidl::encoding::ResultType<
1704            DeviceGetOperatingPointInfoResponse,
1705            i32,
1706        >>(
1707            result.map(|info| (info,)),
1708            self.tx_id,
1709            0x6594a9234fc958e2,
1710            fidl::encoding::DynamicFlags::empty(),
1711        )
1712    }
1713}
1714
1715#[must_use = "FIDL methods require a response to be sent"]
1716#[derive(Debug)]
1717pub struct DeviceGetCurrentOperatingPointResponder {
1718    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1719    tx_id: u32,
1720}
1721
1722/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1723/// if the responder is dropped without sending a response, so that the client
1724/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1725impl std::ops::Drop for DeviceGetCurrentOperatingPointResponder {
1726    fn drop(&mut self) {
1727        self.control_handle.shutdown();
1728        // Safety: drops once, never accessed again
1729        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1730    }
1731}
1732
1733impl fidl::endpoints::Responder for DeviceGetCurrentOperatingPointResponder {
1734    type ControlHandle = DeviceControlHandle;
1735
1736    fn control_handle(&self) -> &DeviceControlHandle {
1737        &self.control_handle
1738    }
1739
1740    fn drop_without_shutdown(mut self) {
1741        // Safety: drops once, never accessed again due to mem::forget
1742        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1743        // Prevent Drop from running (which would shut down the channel)
1744        std::mem::forget(self);
1745    }
1746}
1747
1748impl DeviceGetCurrentOperatingPointResponder {
1749    /// Sends a response to the FIDL transaction.
1750    ///
1751    /// Sets the channel to shutdown if an error occurs.
1752    pub fn send(self, mut out_opp: u32) -> Result<(), fidl::Error> {
1753        let _result = self.send_raw(out_opp);
1754        if _result.is_err() {
1755            self.control_handle.shutdown();
1756        }
1757        self.drop_without_shutdown();
1758        _result
1759    }
1760
1761    /// Similar to "send" but does not shutdown the channel if an error occurs.
1762    pub fn send_no_shutdown_on_err(self, mut out_opp: u32) -> Result<(), fidl::Error> {
1763        let _result = self.send_raw(out_opp);
1764        self.drop_without_shutdown();
1765        _result
1766    }
1767
1768    fn send_raw(&self, mut out_opp: u32) -> Result<(), fidl::Error> {
1769        self.control_handle.inner.send::<DeviceGetCurrentOperatingPointResponse>(
1770            (out_opp,),
1771            self.tx_id,
1772            0x52de67a5993f5fe1,
1773            fidl::encoding::DynamicFlags::empty(),
1774        )
1775    }
1776}
1777
1778#[must_use = "FIDL methods require a response to be sent"]
1779#[derive(Debug)]
1780pub struct DeviceSetCurrentOperatingPointResponder {
1781    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1782    tx_id: u32,
1783}
1784
1785/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1786/// if the responder is dropped without sending a response, so that the client
1787/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1788impl std::ops::Drop for DeviceSetCurrentOperatingPointResponder {
1789    fn drop(&mut self) {
1790        self.control_handle.shutdown();
1791        // Safety: drops once, never accessed again
1792        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1793    }
1794}
1795
1796impl fidl::endpoints::Responder for DeviceSetCurrentOperatingPointResponder {
1797    type ControlHandle = DeviceControlHandle;
1798
1799    fn control_handle(&self) -> &DeviceControlHandle {
1800        &self.control_handle
1801    }
1802
1803    fn drop_without_shutdown(mut self) {
1804        // Safety: drops once, never accessed again due to mem::forget
1805        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1806        // Prevent Drop from running (which would shut down the channel)
1807        std::mem::forget(self);
1808    }
1809}
1810
1811impl DeviceSetCurrentOperatingPointResponder {
1812    /// Sends a response to the FIDL transaction.
1813    ///
1814    /// Sets the channel to shutdown if an error occurs.
1815    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1816        let _result = self.send_raw(result);
1817        if _result.is_err() {
1818            self.control_handle.shutdown();
1819        }
1820        self.drop_without_shutdown();
1821        _result
1822    }
1823
1824    /// Similar to "send" but does not shutdown the channel if an error occurs.
1825    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1826        let _result = self.send_raw(result);
1827        self.drop_without_shutdown();
1828        _result
1829    }
1830
1831    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1832        self.control_handle.inner.send::<fidl::encoding::ResultType<
1833            DeviceSetCurrentOperatingPointResponse,
1834            i32,
1835        >>(
1836            result.map(|out_opp| (out_opp,)),
1837            self.tx_id,
1838            0x34a7828b5ca53fd,
1839            fidl::encoding::DynamicFlags::empty(),
1840        )
1841    }
1842}
1843
1844#[must_use = "FIDL methods require a response to be sent"]
1845#[derive(Debug)]
1846pub struct DeviceSetMinimumOperatingPointLimitResponder {
1847    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1848    tx_id: u32,
1849}
1850
1851/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1852/// if the responder is dropped without sending a response, so that the client
1853/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1854impl std::ops::Drop for DeviceSetMinimumOperatingPointLimitResponder {
1855    fn drop(&mut self) {
1856        self.control_handle.shutdown();
1857        // Safety: drops once, never accessed again
1858        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1859    }
1860}
1861
1862impl fidl::endpoints::Responder for DeviceSetMinimumOperatingPointLimitResponder {
1863    type ControlHandle = DeviceControlHandle;
1864
1865    fn control_handle(&self) -> &DeviceControlHandle {
1866        &self.control_handle
1867    }
1868
1869    fn drop_without_shutdown(mut self) {
1870        // Safety: drops once, never accessed again due to mem::forget
1871        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1872        // Prevent Drop from running (which would shut down the channel)
1873        std::mem::forget(self);
1874    }
1875}
1876
1877impl DeviceSetMinimumOperatingPointLimitResponder {
1878    /// Sends a response to the FIDL transaction.
1879    ///
1880    /// Sets the channel to shutdown if an error occurs.
1881    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1882        let _result = self.send_raw(result);
1883        if _result.is_err() {
1884            self.control_handle.shutdown();
1885        }
1886        self.drop_without_shutdown();
1887        _result
1888    }
1889
1890    /// Similar to "send" but does not shutdown the channel if an error occurs.
1891    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1892        let _result = self.send_raw(result);
1893        self.drop_without_shutdown();
1894        _result
1895    }
1896
1897    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1898        self.control_handle
1899            .inner
1900            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1901                result,
1902                self.tx_id,
1903                0x5467de86fa3fdfe7,
1904                fidl::encoding::DynamicFlags::empty(),
1905            )
1906    }
1907}
1908
1909#[must_use = "FIDL methods require a response to be sent"]
1910#[derive(Debug)]
1911pub struct DeviceSetMaximumOperatingPointLimitResponder {
1912    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1913    tx_id: u32,
1914}
1915
1916/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1917/// if the responder is dropped without sending a response, so that the client
1918/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1919impl std::ops::Drop for DeviceSetMaximumOperatingPointLimitResponder {
1920    fn drop(&mut self) {
1921        self.control_handle.shutdown();
1922        // Safety: drops once, never accessed again
1923        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1924    }
1925}
1926
1927impl fidl::endpoints::Responder for DeviceSetMaximumOperatingPointLimitResponder {
1928    type ControlHandle = DeviceControlHandle;
1929
1930    fn control_handle(&self) -> &DeviceControlHandle {
1931        &self.control_handle
1932    }
1933
1934    fn drop_without_shutdown(mut self) {
1935        // Safety: drops once, never accessed again due to mem::forget
1936        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1937        // Prevent Drop from running (which would shut down the channel)
1938        std::mem::forget(self);
1939    }
1940}
1941
1942impl DeviceSetMaximumOperatingPointLimitResponder {
1943    /// Sends a response to the FIDL transaction.
1944    ///
1945    /// Sets the channel to shutdown if an error occurs.
1946    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1947        let _result = self.send_raw(result);
1948        if _result.is_err() {
1949            self.control_handle.shutdown();
1950        }
1951        self.drop_without_shutdown();
1952        _result
1953    }
1954
1955    /// Similar to "send" but does not shutdown the channel if an error occurs.
1956    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1957        let _result = self.send_raw(result);
1958        self.drop_without_shutdown();
1959        _result
1960    }
1961
1962    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1963        self.control_handle
1964            .inner
1965            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1966                result,
1967                self.tx_id,
1968                0x385fa4d74481fbfd,
1969                fidl::encoding::DynamicFlags::empty(),
1970            )
1971    }
1972}
1973
1974#[must_use = "FIDL methods require a response to be sent"]
1975#[derive(Debug)]
1976pub struct DeviceSetOperatingPointLimitsResponder {
1977    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1978    tx_id: u32,
1979}
1980
1981/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1982/// if the responder is dropped without sending a response, so that the client
1983/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1984impl std::ops::Drop for DeviceSetOperatingPointLimitsResponder {
1985    fn drop(&mut self) {
1986        self.control_handle.shutdown();
1987        // Safety: drops once, never accessed again
1988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1989    }
1990}
1991
1992impl fidl::endpoints::Responder for DeviceSetOperatingPointLimitsResponder {
1993    type ControlHandle = DeviceControlHandle;
1994
1995    fn control_handle(&self) -> &DeviceControlHandle {
1996        &self.control_handle
1997    }
1998
1999    fn drop_without_shutdown(mut self) {
2000        // Safety: drops once, never accessed again due to mem::forget
2001        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2002        // Prevent Drop from running (which would shut down the channel)
2003        std::mem::forget(self);
2004    }
2005}
2006
2007impl DeviceSetOperatingPointLimitsResponder {
2008    /// Sends a response to the FIDL transaction.
2009    ///
2010    /// Sets the channel to shutdown if an error occurs.
2011    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2012        let _result = self.send_raw(result);
2013        if _result.is_err() {
2014            self.control_handle.shutdown();
2015        }
2016        self.drop_without_shutdown();
2017        _result
2018    }
2019
2020    /// Similar to "send" but does not shutdown the channel if an error occurs.
2021    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2022        let _result = self.send_raw(result);
2023        self.drop_without_shutdown();
2024        _result
2025    }
2026
2027    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2028        self.control_handle
2029            .inner
2030            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2031                result,
2032                self.tx_id,
2033                0x30aa7514dd598b23,
2034                fidl::encoding::DynamicFlags::empty(),
2035            )
2036    }
2037}
2038
2039#[must_use = "FIDL methods require a response to be sent"]
2040#[derive(Debug)]
2041pub struct DeviceGetCurrentOperatingPointLimitsResponder {
2042    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2043    tx_id: u32,
2044}
2045
2046/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2047/// if the responder is dropped without sending a response, so that the client
2048/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2049impl std::ops::Drop for DeviceGetCurrentOperatingPointLimitsResponder {
2050    fn drop(&mut self) {
2051        self.control_handle.shutdown();
2052        // Safety: drops once, never accessed again
2053        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2054    }
2055}
2056
2057impl fidl::endpoints::Responder for DeviceGetCurrentOperatingPointLimitsResponder {
2058    type ControlHandle = DeviceControlHandle;
2059
2060    fn control_handle(&self) -> &DeviceControlHandle {
2061        &self.control_handle
2062    }
2063
2064    fn drop_without_shutdown(mut self) {
2065        // Safety: drops once, never accessed again due to mem::forget
2066        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2067        // Prevent Drop from running (which would shut down the channel)
2068        std::mem::forget(self);
2069    }
2070}
2071
2072impl DeviceGetCurrentOperatingPointLimitsResponder {
2073    /// Sends a response to the FIDL transaction.
2074    ///
2075    /// Sets the channel to shutdown if an error occurs.
2076    pub fn send(self, mut result: Result<(u32, u32), i32>) -> Result<(), fidl::Error> {
2077        let _result = self.send_raw(result);
2078        if _result.is_err() {
2079            self.control_handle.shutdown();
2080        }
2081        self.drop_without_shutdown();
2082        _result
2083    }
2084
2085    /// Similar to "send" but does not shutdown the channel if an error occurs.
2086    pub fn send_no_shutdown_on_err(
2087        self,
2088        mut result: Result<(u32, u32), i32>,
2089    ) -> Result<(), fidl::Error> {
2090        let _result = self.send_raw(result);
2091        self.drop_without_shutdown();
2092        _result
2093    }
2094
2095    fn send_raw(&self, mut result: Result<(u32, u32), i32>) -> Result<(), fidl::Error> {
2096        self.control_handle.inner.send::<fidl::encoding::ResultType<
2097            DeviceGetCurrentOperatingPointLimitsResponse,
2098            i32,
2099        >>(
2100            result,
2101            self.tx_id,
2102            0x7aefe3d765cfc6a7,
2103            fidl::encoding::DynamicFlags::empty(),
2104        )
2105    }
2106}
2107
2108#[must_use = "FIDL methods require a response to be sent"]
2109#[derive(Debug)]
2110pub struct DeviceGetOperatingPointCountResponder {
2111    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2112    tx_id: u32,
2113}
2114
2115/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2116/// if the responder is dropped without sending a response, so that the client
2117/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2118impl std::ops::Drop for DeviceGetOperatingPointCountResponder {
2119    fn drop(&mut self) {
2120        self.control_handle.shutdown();
2121        // Safety: drops once, never accessed again
2122        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2123    }
2124}
2125
2126impl fidl::endpoints::Responder for DeviceGetOperatingPointCountResponder {
2127    type ControlHandle = DeviceControlHandle;
2128
2129    fn control_handle(&self) -> &DeviceControlHandle {
2130        &self.control_handle
2131    }
2132
2133    fn drop_without_shutdown(mut self) {
2134        // Safety: drops once, never accessed again due to mem::forget
2135        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2136        // Prevent Drop from running (which would shut down the channel)
2137        std::mem::forget(self);
2138    }
2139}
2140
2141impl DeviceGetOperatingPointCountResponder {
2142    /// Sends a response to the FIDL transaction.
2143    ///
2144    /// Sets the channel to shutdown if an error occurs.
2145    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
2146        let _result = self.send_raw(result);
2147        if _result.is_err() {
2148            self.control_handle.shutdown();
2149        }
2150        self.drop_without_shutdown();
2151        _result
2152    }
2153
2154    /// Similar to "send" but does not shutdown the channel if an error occurs.
2155    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
2156        let _result = self.send_raw(result);
2157        self.drop_without_shutdown();
2158        _result
2159    }
2160
2161    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
2162        self.control_handle.inner.send::<fidl::encoding::ResultType<
2163            DeviceGetOperatingPointCountResponse,
2164            i32,
2165        >>(
2166            result.map(|count| (count,)),
2167            self.tx_id,
2168            0x13e70ec7131889ba,
2169            fidl::encoding::DynamicFlags::empty(),
2170        )
2171    }
2172}
2173
2174#[must_use = "FIDL methods require a response to be sent"]
2175#[derive(Debug)]
2176pub struct DeviceGetNumLogicalCoresResponder {
2177    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2178    tx_id: u32,
2179}
2180
2181/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2182/// if the responder is dropped without sending a response, so that the client
2183/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2184impl std::ops::Drop for DeviceGetNumLogicalCoresResponder {
2185    fn drop(&mut self) {
2186        self.control_handle.shutdown();
2187        // Safety: drops once, never accessed again
2188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2189    }
2190}
2191
2192impl fidl::endpoints::Responder for DeviceGetNumLogicalCoresResponder {
2193    type ControlHandle = DeviceControlHandle;
2194
2195    fn control_handle(&self) -> &DeviceControlHandle {
2196        &self.control_handle
2197    }
2198
2199    fn drop_without_shutdown(mut self) {
2200        // Safety: drops once, never accessed again due to mem::forget
2201        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2202        // Prevent Drop from running (which would shut down the channel)
2203        std::mem::forget(self);
2204    }
2205}
2206
2207impl DeviceGetNumLogicalCoresResponder {
2208    /// Sends a response to the FIDL transaction.
2209    ///
2210    /// Sets the channel to shutdown if an error occurs.
2211    pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
2212        let _result = self.send_raw(count);
2213        if _result.is_err() {
2214            self.control_handle.shutdown();
2215        }
2216        self.drop_without_shutdown();
2217        _result
2218    }
2219
2220    /// Similar to "send" but does not shutdown the channel if an error occurs.
2221    pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
2222        let _result = self.send_raw(count);
2223        self.drop_without_shutdown();
2224        _result
2225    }
2226
2227    fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
2228        self.control_handle.inner.send::<DeviceGetNumLogicalCoresResponse>(
2229            (count,),
2230            self.tx_id,
2231            0x74e304c90ca165c5,
2232            fidl::encoding::DynamicFlags::empty(),
2233        )
2234    }
2235}
2236
2237#[must_use = "FIDL methods require a response to be sent"]
2238#[derive(Debug)]
2239pub struct DeviceGetLogicalCoreIdResponder {
2240    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2241    tx_id: u32,
2242}
2243
2244/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2245/// if the responder is dropped without sending a response, so that the client
2246/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2247impl std::ops::Drop for DeviceGetLogicalCoreIdResponder {
2248    fn drop(&mut self) {
2249        self.control_handle.shutdown();
2250        // Safety: drops once, never accessed again
2251        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2252    }
2253}
2254
2255impl fidl::endpoints::Responder for DeviceGetLogicalCoreIdResponder {
2256    type ControlHandle = DeviceControlHandle;
2257
2258    fn control_handle(&self) -> &DeviceControlHandle {
2259        &self.control_handle
2260    }
2261
2262    fn drop_without_shutdown(mut self) {
2263        // Safety: drops once, never accessed again due to mem::forget
2264        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2265        // Prevent Drop from running (which would shut down the channel)
2266        std::mem::forget(self);
2267    }
2268}
2269
2270impl DeviceGetLogicalCoreIdResponder {
2271    /// Sends a response to the FIDL transaction.
2272    ///
2273    /// Sets the channel to shutdown if an error occurs.
2274    pub fn send(self, mut id: u64) -> Result<(), fidl::Error> {
2275        let _result = self.send_raw(id);
2276        if _result.is_err() {
2277            self.control_handle.shutdown();
2278        }
2279        self.drop_without_shutdown();
2280        _result
2281    }
2282
2283    /// Similar to "send" but does not shutdown the channel if an error occurs.
2284    pub fn send_no_shutdown_on_err(self, mut id: u64) -> Result<(), fidl::Error> {
2285        let _result = self.send_raw(id);
2286        self.drop_without_shutdown();
2287        _result
2288    }
2289
2290    fn send_raw(&self, mut id: u64) -> Result<(), fidl::Error> {
2291        self.control_handle.inner.send::<DeviceGetLogicalCoreIdResponse>(
2292            (id,),
2293            self.tx_id,
2294            0x7168f98ddbd26058,
2295            fidl::encoding::DynamicFlags::empty(),
2296        )
2297    }
2298}
2299
2300#[must_use = "FIDL methods require a response to be sent"]
2301#[derive(Debug)]
2302pub struct DeviceGetDomainIdResponder {
2303    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2304    tx_id: u32,
2305}
2306
2307/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2308/// if the responder is dropped without sending a response, so that the client
2309/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2310impl std::ops::Drop for DeviceGetDomainIdResponder {
2311    fn drop(&mut self) {
2312        self.control_handle.shutdown();
2313        // Safety: drops once, never accessed again
2314        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2315    }
2316}
2317
2318impl fidl::endpoints::Responder for DeviceGetDomainIdResponder {
2319    type ControlHandle = DeviceControlHandle;
2320
2321    fn control_handle(&self) -> &DeviceControlHandle {
2322        &self.control_handle
2323    }
2324
2325    fn drop_without_shutdown(mut self) {
2326        // Safety: drops once, never accessed again due to mem::forget
2327        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2328        // Prevent Drop from running (which would shut down the channel)
2329        std::mem::forget(self);
2330    }
2331}
2332
2333impl DeviceGetDomainIdResponder {
2334    /// Sends a response to the FIDL transaction.
2335    ///
2336    /// Sets the channel to shutdown if an error occurs.
2337    pub fn send(self, mut domain_id: u32) -> Result<(), fidl::Error> {
2338        let _result = self.send_raw(domain_id);
2339        if _result.is_err() {
2340            self.control_handle.shutdown();
2341        }
2342        self.drop_without_shutdown();
2343        _result
2344    }
2345
2346    /// Similar to "send" but does not shutdown the channel if an error occurs.
2347    pub fn send_no_shutdown_on_err(self, mut domain_id: u32) -> Result<(), fidl::Error> {
2348        let _result = self.send_raw(domain_id);
2349        self.drop_without_shutdown();
2350        _result
2351    }
2352
2353    fn send_raw(&self, mut domain_id: u32) -> Result<(), fidl::Error> {
2354        self.control_handle.inner.send::<DeviceGetDomainIdResponse>(
2355            (domain_id,),
2356            self.tx_id,
2357            0x3030f85bdc1ef321,
2358            fidl::encoding::DynamicFlags::empty(),
2359        )
2360    }
2361}
2362
2363#[must_use = "FIDL methods require a response to be sent"]
2364#[derive(Debug)]
2365pub struct DeviceGetRelativePerformanceResponder {
2366    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2367    tx_id: u32,
2368}
2369
2370/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2371/// if the responder is dropped without sending a response, so that the client
2372/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2373impl std::ops::Drop for DeviceGetRelativePerformanceResponder {
2374    fn drop(&mut self) {
2375        self.control_handle.shutdown();
2376        // Safety: drops once, never accessed again
2377        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2378    }
2379}
2380
2381impl fidl::endpoints::Responder for DeviceGetRelativePerformanceResponder {
2382    type ControlHandle = DeviceControlHandle;
2383
2384    fn control_handle(&self) -> &DeviceControlHandle {
2385        &self.control_handle
2386    }
2387
2388    fn drop_without_shutdown(mut self) {
2389        // Safety: drops once, never accessed again due to mem::forget
2390        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2391        // Prevent Drop from running (which would shut down the channel)
2392        std::mem::forget(self);
2393    }
2394}
2395
2396impl DeviceGetRelativePerformanceResponder {
2397    /// Sends a response to the FIDL transaction.
2398    ///
2399    /// Sets the channel to shutdown if an error occurs.
2400    pub fn send(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
2401        let _result = self.send_raw(result);
2402        if _result.is_err() {
2403            self.control_handle.shutdown();
2404        }
2405        self.drop_without_shutdown();
2406        _result
2407    }
2408
2409    /// Similar to "send" but does not shutdown the channel if an error occurs.
2410    pub fn send_no_shutdown_on_err(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
2411        let _result = self.send_raw(result);
2412        self.drop_without_shutdown();
2413        _result
2414    }
2415
2416    fn send_raw(&self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
2417        self.control_handle.inner.send::<fidl::encoding::ResultType<
2418            DeviceGetRelativePerformanceResponse,
2419            i32,
2420        >>(
2421            result.map(|relative_performance| (relative_performance,)),
2422            self.tx_id,
2423            0x41c37eaf0c26a3d3,
2424            fidl::encoding::DynamicFlags::empty(),
2425        )
2426    }
2427}
2428
2429#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2430pub struct ServiceMarker;
2431
2432#[cfg(target_os = "fuchsia")]
2433impl fidl::endpoints::ServiceMarker for ServiceMarker {
2434    type Proxy = ServiceProxy;
2435    type Request = ServiceRequest;
2436    const SERVICE_NAME: &'static str = "fuchsia.hardware.cpu.ctrl.Service";
2437}
2438
2439/// A request for one of the member protocols of Service.
2440///
2441#[cfg(target_os = "fuchsia")]
2442pub enum ServiceRequest {
2443    Device(DeviceRequestStream),
2444}
2445
2446#[cfg(target_os = "fuchsia")]
2447impl fidl::endpoints::ServiceRequest for ServiceRequest {
2448    type Service = ServiceMarker;
2449
2450    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2451        match name {
2452            "device" => Self::Device(
2453                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2454            ),
2455            _ => panic!("no such member protocol name for service Service"),
2456        }
2457    }
2458
2459    fn member_names() -> &'static [&'static str] {
2460        &["device"]
2461    }
2462}
2463#[cfg(target_os = "fuchsia")]
2464pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2465
2466#[cfg(target_os = "fuchsia")]
2467impl fidl::endpoints::ServiceProxy for ServiceProxy {
2468    type Service = ServiceMarker;
2469
2470    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2471        Self(opener)
2472    }
2473}
2474
2475#[cfg(target_os = "fuchsia")]
2476impl ServiceProxy {
2477    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
2478        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2479        self.connect_channel_to_device(server_end)?;
2480        Ok(proxy)
2481    }
2482
2483    /// Like `connect_to_device`, but returns a sync proxy.
2484    /// See [`Self::connect_to_device`] for more details.
2485    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2486        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2487        self.connect_channel_to_device(server_end)?;
2488        Ok(proxy)
2489    }
2490
2491    /// Like `connect_to_device`, but accepts a server end.
2492    /// See [`Self::connect_to_device`] for more details.
2493    pub fn connect_channel_to_device(
2494        &self,
2495        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2496    ) -> Result<(), fidl::Error> {
2497        self.0.open_member("device", server_end.into_channel())
2498    }
2499
2500    pub fn instance_name(&self) -> &str {
2501        self.0.instance_name()
2502    }
2503}
2504
2505mod internal {
2506    use super::*;
2507}