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