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 DeviceGetOperatingPointCountResult = Result<u32, i32>;
28pub type DeviceGetRelativePerformanceResult = Result<u8, i32>;
29
30pub trait DeviceProxyInterface: Send + Sync {
31    type GetOperatingPointInfoResponseFut: std::future::Future<Output = Result<DeviceGetOperatingPointInfoResult, fidl::Error>>
32        + Send;
33    fn r#get_operating_point_info(&self, opp: u32) -> Self::GetOperatingPointInfoResponseFut;
34    type GetCurrentOperatingPointResponseFut: std::future::Future<Output = Result<u32, fidl::Error>>
35        + Send;
36    fn r#get_current_operating_point(&self) -> Self::GetCurrentOperatingPointResponseFut;
37    type SetCurrentOperatingPointResponseFut: std::future::Future<Output = Result<DeviceSetCurrentOperatingPointResult, fidl::Error>>
38        + Send;
39    fn r#set_current_operating_point(
40        &self,
41        requested_opp: u32,
42    ) -> Self::SetCurrentOperatingPointResponseFut;
43    type GetOperatingPointCountResponseFut: std::future::Future<Output = Result<DeviceGetOperatingPointCountResult, fidl::Error>>
44        + Send;
45    fn r#get_operating_point_count(&self) -> Self::GetOperatingPointCountResponseFut;
46    type GetNumLogicalCoresResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
47        + Send;
48    fn r#get_num_logical_cores(&self) -> Self::GetNumLogicalCoresResponseFut;
49    type GetLogicalCoreIdResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
50    fn r#get_logical_core_id(&self, index: u64) -> Self::GetLogicalCoreIdResponseFut;
51    type GetDomainIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
52    fn r#get_domain_id(&self) -> Self::GetDomainIdResponseFut;
53    type GetRelativePerformanceResponseFut: std::future::Future<Output = Result<DeviceGetRelativePerformanceResult, fidl::Error>>
54        + Send;
55    fn r#get_relative_performance(&self) -> Self::GetRelativePerformanceResponseFut;
56}
57#[derive(Debug)]
58#[cfg(target_os = "fuchsia")]
59pub struct DeviceSynchronousProxy {
60    client: fidl::client::sync::Client,
61}
62
63#[cfg(target_os = "fuchsia")]
64impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
65    type Proxy = DeviceProxy;
66    type Protocol = DeviceMarker;
67
68    fn from_channel(inner: fidl::Channel) -> Self {
69        Self::new(inner)
70    }
71
72    fn into_channel(self) -> fidl::Channel {
73        self.client.into_channel()
74    }
75
76    fn as_channel(&self) -> &fidl::Channel {
77        self.client.as_channel()
78    }
79}
80
81#[cfg(target_os = "fuchsia")]
82impl DeviceSynchronousProxy {
83    pub fn new(channel: fidl::Channel) -> Self {
84        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
85        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
86    }
87
88    pub fn into_channel(self) -> fidl::Channel {
89        self.client.into_channel()
90    }
91
92    /// Waits until an event arrives and returns it. It is safe for other
93    /// threads to make concurrent requests while waiting for an event.
94    pub fn wait_for_event(
95        &self,
96        deadline: zx::MonotonicInstant,
97    ) -> Result<DeviceEvent, fidl::Error> {
98        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
99    }
100
101    /// Returns information about a given operating point for this performance
102    /// domain.
103    pub fn r#get_operating_point_info(
104        &self,
105        mut opp: u32,
106        ___deadline: zx::MonotonicInstant,
107    ) -> Result<DeviceGetOperatingPointInfoResult, fidl::Error> {
108        let _response = self.client.send_query::<
109            DeviceGetOperatingPointInfoRequest,
110            fidl::encoding::ResultType<DeviceGetOperatingPointInfoResponse, i32>,
111        >(
112            (opp,),
113            0x6594a9234fc958e2,
114            fidl::encoding::DynamicFlags::empty(),
115            ___deadline,
116        )?;
117        Ok(_response.map(|x| x.info))
118    }
119
120    /// Gets the current operating point of the device.
121    pub fn r#get_current_operating_point(
122        &self,
123        ___deadline: zx::MonotonicInstant,
124    ) -> Result<u32, fidl::Error> {
125        let _response = self
126            .client
127            .send_query::<fidl::encoding::EmptyPayload, DeviceGetCurrentOperatingPointResponse>(
128                (),
129                0x52de67a5993f5fe1,
130                fidl::encoding::DynamicFlags::empty(),
131                ___deadline,
132            )?;
133        Ok(_response.out_opp)
134    }
135
136    /// Set the operating point of this device to the requested operating point.
137    /// Returns ZX_OK, if the device is in a working state and the operating point is changed to
138    /// requested_opp successfully. out_opp will be same as requested_opp.
139    /// Returns error status, if switching to the requested_opp was unsuccessful. out_opp
140    /// is the operating performance point (OPP) that the device is currently in.
141    pub fn r#set_current_operating_point(
142        &self,
143        mut requested_opp: u32,
144        ___deadline: zx::MonotonicInstant,
145    ) -> Result<DeviceSetCurrentOperatingPointResult, fidl::Error> {
146        let _response = self.client.send_query::<
147            DeviceSetCurrentOperatingPointRequest,
148            fidl::encoding::ResultType<DeviceSetCurrentOperatingPointResponse, i32>,
149        >(
150            (requested_opp,),
151            0x34a7828b5ca53fd,
152            fidl::encoding::DynamicFlags::empty(),
153            ___deadline,
154        )?;
155        Ok(_response.map(|x| x.out_opp))
156    }
157
158    /// Returns the number of operating points within this performance domain.
159    pub fn r#get_operating_point_count(
160        &self,
161        ___deadline: zx::MonotonicInstant,
162    ) -> Result<DeviceGetOperatingPointCountResult, fidl::Error> {
163        let _response = self.client.send_query::<
164            fidl::encoding::EmptyPayload,
165            fidl::encoding::ResultType<DeviceGetOperatingPointCountResponse, i32>,
166        >(
167            (),
168            0x13e70ec7131889ba,
169            fidl::encoding::DynamicFlags::empty(),
170            ___deadline,
171        )?;
172        Ok(_response.map(|x| x.count))
173    }
174
175    /// Returns the number of logical cores contained within this performance
176    /// domain.
177    pub fn r#get_num_logical_cores(
178        &self,
179        ___deadline: zx::MonotonicInstant,
180    ) -> Result<u64, fidl::Error> {
181        let _response = self
182            .client
183            .send_query::<fidl::encoding::EmptyPayload, DeviceGetNumLogicalCoresResponse>(
184                (),
185                0x74e304c90ca165c5,
186                fidl::encoding::DynamicFlags::empty(),
187                ___deadline,
188            )?;
189        Ok(_response.count)
190    }
191
192    /// Returns a global system-wide core ID for the nth core in this
193    /// performance domain. `index` must be a value in the range [0, n) where
194    /// n is the value returned by GetNumLogicalCores().
195    pub fn r#get_logical_core_id(
196        &self,
197        mut index: u64,
198        ___deadline: zx::MonotonicInstant,
199    ) -> Result<u64, fidl::Error> {
200        let _response = self
201            .client
202            .send_query::<DeviceGetLogicalCoreIdRequest, DeviceGetLogicalCoreIdResponse>(
203                (index,),
204                0x7168f98ddbd26058,
205                fidl::encoding::DynamicFlags::empty(),
206                ___deadline,
207            )?;
208        Ok(_response.id)
209    }
210
211    /// Returns the id of this performance domain within its package. This
212    /// number should be stable across boots, but clients should prefer to use
213    /// GetRelativePerformance to differentiate cores if possible.
214    pub fn r#get_domain_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
215        let _response =
216            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDomainIdResponse>(
217                (),
218                0x3030f85bdc1ef321,
219                fidl::encoding::DynamicFlags::empty(),
220                ___deadline,
221            )?;
222        Ok(_response.domain_id)
223    }
224
225    /// The relative performance of this domain as configured by the platform,
226    /// if known. The highest performance domain should return 255, while others
227    /// should return N/255 fractional values relative to that domain.
228    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
229    pub fn r#get_relative_performance(
230        &self,
231        ___deadline: zx::MonotonicInstant,
232    ) -> Result<DeviceGetRelativePerformanceResult, fidl::Error> {
233        let _response = self.client.send_query::<
234            fidl::encoding::EmptyPayload,
235            fidl::encoding::ResultType<DeviceGetRelativePerformanceResponse, i32>,
236        >(
237            (),
238            0x41c37eaf0c26a3d3,
239            fidl::encoding::DynamicFlags::empty(),
240            ___deadline,
241        )?;
242        Ok(_response.map(|x| x.relative_performance))
243    }
244}
245
246#[cfg(target_os = "fuchsia")]
247impl From<DeviceSynchronousProxy> for zx::Handle {
248    fn from(value: DeviceSynchronousProxy) -> Self {
249        value.into_channel().into()
250    }
251}
252
253#[cfg(target_os = "fuchsia")]
254impl From<fidl::Channel> for DeviceSynchronousProxy {
255    fn from(value: fidl::Channel) -> Self {
256        Self::new(value)
257    }
258}
259
260#[cfg(target_os = "fuchsia")]
261impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
262    type Protocol = DeviceMarker;
263
264    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
265        Self::new(value.into_channel())
266    }
267}
268
269#[derive(Debug, Clone)]
270pub struct DeviceProxy {
271    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
272}
273
274impl fidl::endpoints::Proxy for DeviceProxy {
275    type Protocol = DeviceMarker;
276
277    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
278        Self::new(inner)
279    }
280
281    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
282        self.client.into_channel().map_err(|client| Self { client })
283    }
284
285    fn as_channel(&self) -> &::fidl::AsyncChannel {
286        self.client.as_channel()
287    }
288}
289
290impl DeviceProxy {
291    /// Create a new Proxy for fuchsia.hardware.cpu.ctrl/Device.
292    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
293        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
294        Self { client: fidl::client::Client::new(channel, protocol_name) }
295    }
296
297    /// Get a Stream of events from the remote end of the protocol.
298    ///
299    /// # Panics
300    ///
301    /// Panics if the event stream was already taken.
302    pub fn take_event_stream(&self) -> DeviceEventStream {
303        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
304    }
305
306    /// Returns information about a given operating point for this performance
307    /// domain.
308    pub fn r#get_operating_point_info(
309        &self,
310        mut opp: u32,
311    ) -> fidl::client::QueryResponseFut<
312        DeviceGetOperatingPointInfoResult,
313        fidl::encoding::DefaultFuchsiaResourceDialect,
314    > {
315        DeviceProxyInterface::r#get_operating_point_info(self, opp)
316    }
317
318    /// Gets the current operating point of the device.
319    pub fn r#get_current_operating_point(
320        &self,
321    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
322        DeviceProxyInterface::r#get_current_operating_point(self)
323    }
324
325    /// Set the operating point of this device to the requested operating point.
326    /// Returns ZX_OK, if the device is in a working state and the operating point is changed to
327    /// requested_opp successfully. out_opp will be same as requested_opp.
328    /// Returns error status, if switching to the requested_opp was unsuccessful. out_opp
329    /// is the operating performance point (OPP) that the device is currently in.
330    pub fn r#set_current_operating_point(
331        &self,
332        mut requested_opp: u32,
333    ) -> fidl::client::QueryResponseFut<
334        DeviceSetCurrentOperatingPointResult,
335        fidl::encoding::DefaultFuchsiaResourceDialect,
336    > {
337        DeviceProxyInterface::r#set_current_operating_point(self, requested_opp)
338    }
339
340    /// Returns the number of operating points within this performance domain.
341    pub fn r#get_operating_point_count(
342        &self,
343    ) -> fidl::client::QueryResponseFut<
344        DeviceGetOperatingPointCountResult,
345        fidl::encoding::DefaultFuchsiaResourceDialect,
346    > {
347        DeviceProxyInterface::r#get_operating_point_count(self)
348    }
349
350    /// Returns the number of logical cores contained within this performance
351    /// domain.
352    pub fn r#get_num_logical_cores(
353        &self,
354    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
355        DeviceProxyInterface::r#get_num_logical_cores(self)
356    }
357
358    /// Returns a global system-wide core ID for the nth core in this
359    /// performance domain. `index` must be a value in the range [0, n) where
360    /// n is the value returned by GetNumLogicalCores().
361    pub fn r#get_logical_core_id(
362        &self,
363        mut index: u64,
364    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
365        DeviceProxyInterface::r#get_logical_core_id(self, index)
366    }
367
368    /// Returns the id of this performance domain within its package. This
369    /// number should be stable across boots, but clients should prefer to use
370    /// GetRelativePerformance to differentiate cores if possible.
371    pub fn r#get_domain_id(
372        &self,
373    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
374        DeviceProxyInterface::r#get_domain_id(self)
375    }
376
377    /// The relative performance of this domain as configured by the platform,
378    /// if known. The highest performance domain should return 255, while others
379    /// should return N/255 fractional values relative to that domain.
380    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
381    pub fn r#get_relative_performance(
382        &self,
383    ) -> fidl::client::QueryResponseFut<
384        DeviceGetRelativePerformanceResult,
385        fidl::encoding::DefaultFuchsiaResourceDialect,
386    > {
387        DeviceProxyInterface::r#get_relative_performance(self)
388    }
389}
390
391impl DeviceProxyInterface for DeviceProxy {
392    type GetOperatingPointInfoResponseFut = fidl::client::QueryResponseFut<
393        DeviceGetOperatingPointInfoResult,
394        fidl::encoding::DefaultFuchsiaResourceDialect,
395    >;
396    fn r#get_operating_point_info(&self, mut opp: u32) -> Self::GetOperatingPointInfoResponseFut {
397        fn _decode(
398            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
399        ) -> Result<DeviceGetOperatingPointInfoResult, fidl::Error> {
400            let _response = fidl::client::decode_transaction_body::<
401                fidl::encoding::ResultType<DeviceGetOperatingPointInfoResponse, i32>,
402                fidl::encoding::DefaultFuchsiaResourceDialect,
403                0x6594a9234fc958e2,
404            >(_buf?)?;
405            Ok(_response.map(|x| x.info))
406        }
407        self.client.send_query_and_decode::<
408            DeviceGetOperatingPointInfoRequest,
409            DeviceGetOperatingPointInfoResult,
410        >(
411            (opp,),
412            0x6594a9234fc958e2,
413            fidl::encoding::DynamicFlags::empty(),
414            _decode,
415        )
416    }
417
418    type GetCurrentOperatingPointResponseFut =
419        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
420    fn r#get_current_operating_point(&self) -> Self::GetCurrentOperatingPointResponseFut {
421        fn _decode(
422            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
423        ) -> Result<u32, fidl::Error> {
424            let _response = fidl::client::decode_transaction_body::<
425                DeviceGetCurrentOperatingPointResponse,
426                fidl::encoding::DefaultFuchsiaResourceDialect,
427                0x52de67a5993f5fe1,
428            >(_buf?)?;
429            Ok(_response.out_opp)
430        }
431        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
432            (),
433            0x52de67a5993f5fe1,
434            fidl::encoding::DynamicFlags::empty(),
435            _decode,
436        )
437    }
438
439    type SetCurrentOperatingPointResponseFut = fidl::client::QueryResponseFut<
440        DeviceSetCurrentOperatingPointResult,
441        fidl::encoding::DefaultFuchsiaResourceDialect,
442    >;
443    fn r#set_current_operating_point(
444        &self,
445        mut requested_opp: u32,
446    ) -> Self::SetCurrentOperatingPointResponseFut {
447        fn _decode(
448            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
449        ) -> Result<DeviceSetCurrentOperatingPointResult, fidl::Error> {
450            let _response = fidl::client::decode_transaction_body::<
451                fidl::encoding::ResultType<DeviceSetCurrentOperatingPointResponse, i32>,
452                fidl::encoding::DefaultFuchsiaResourceDialect,
453                0x34a7828b5ca53fd,
454            >(_buf?)?;
455            Ok(_response.map(|x| x.out_opp))
456        }
457        self.client.send_query_and_decode::<
458            DeviceSetCurrentOperatingPointRequest,
459            DeviceSetCurrentOperatingPointResult,
460        >(
461            (requested_opp,),
462            0x34a7828b5ca53fd,
463            fidl::encoding::DynamicFlags::empty(),
464            _decode,
465        )
466    }
467
468    type GetOperatingPointCountResponseFut = fidl::client::QueryResponseFut<
469        DeviceGetOperatingPointCountResult,
470        fidl::encoding::DefaultFuchsiaResourceDialect,
471    >;
472    fn r#get_operating_point_count(&self) -> Self::GetOperatingPointCountResponseFut {
473        fn _decode(
474            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
475        ) -> Result<DeviceGetOperatingPointCountResult, fidl::Error> {
476            let _response = fidl::client::decode_transaction_body::<
477                fidl::encoding::ResultType<DeviceGetOperatingPointCountResponse, i32>,
478                fidl::encoding::DefaultFuchsiaResourceDialect,
479                0x13e70ec7131889ba,
480            >(_buf?)?;
481            Ok(_response.map(|x| x.count))
482        }
483        self.client.send_query_and_decode::<
484            fidl::encoding::EmptyPayload,
485            DeviceGetOperatingPointCountResult,
486        >(
487            (),
488            0x13e70ec7131889ba,
489            fidl::encoding::DynamicFlags::empty(),
490            _decode,
491        )
492    }
493
494    type GetNumLogicalCoresResponseFut =
495        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
496    fn r#get_num_logical_cores(&self) -> Self::GetNumLogicalCoresResponseFut {
497        fn _decode(
498            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
499        ) -> Result<u64, fidl::Error> {
500            let _response = fidl::client::decode_transaction_body::<
501                DeviceGetNumLogicalCoresResponse,
502                fidl::encoding::DefaultFuchsiaResourceDialect,
503                0x74e304c90ca165c5,
504            >(_buf?)?;
505            Ok(_response.count)
506        }
507        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
508            (),
509            0x74e304c90ca165c5,
510            fidl::encoding::DynamicFlags::empty(),
511            _decode,
512        )
513    }
514
515    type GetLogicalCoreIdResponseFut =
516        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
517    fn r#get_logical_core_id(&self, mut index: u64) -> Self::GetLogicalCoreIdResponseFut {
518        fn _decode(
519            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
520        ) -> Result<u64, fidl::Error> {
521            let _response = fidl::client::decode_transaction_body::<
522                DeviceGetLogicalCoreIdResponse,
523                fidl::encoding::DefaultFuchsiaResourceDialect,
524                0x7168f98ddbd26058,
525            >(_buf?)?;
526            Ok(_response.id)
527        }
528        self.client.send_query_and_decode::<DeviceGetLogicalCoreIdRequest, u64>(
529            (index,),
530            0x7168f98ddbd26058,
531            fidl::encoding::DynamicFlags::empty(),
532            _decode,
533        )
534    }
535
536    type GetDomainIdResponseFut =
537        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
538    fn r#get_domain_id(&self) -> Self::GetDomainIdResponseFut {
539        fn _decode(
540            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
541        ) -> Result<u32, fidl::Error> {
542            let _response = fidl::client::decode_transaction_body::<
543                DeviceGetDomainIdResponse,
544                fidl::encoding::DefaultFuchsiaResourceDialect,
545                0x3030f85bdc1ef321,
546            >(_buf?)?;
547            Ok(_response.domain_id)
548        }
549        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
550            (),
551            0x3030f85bdc1ef321,
552            fidl::encoding::DynamicFlags::empty(),
553            _decode,
554        )
555    }
556
557    type GetRelativePerformanceResponseFut = fidl::client::QueryResponseFut<
558        DeviceGetRelativePerformanceResult,
559        fidl::encoding::DefaultFuchsiaResourceDialect,
560    >;
561    fn r#get_relative_performance(&self) -> Self::GetRelativePerformanceResponseFut {
562        fn _decode(
563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
564        ) -> Result<DeviceGetRelativePerformanceResult, fidl::Error> {
565            let _response = fidl::client::decode_transaction_body::<
566                fidl::encoding::ResultType<DeviceGetRelativePerformanceResponse, i32>,
567                fidl::encoding::DefaultFuchsiaResourceDialect,
568                0x41c37eaf0c26a3d3,
569            >(_buf?)?;
570            Ok(_response.map(|x| x.relative_performance))
571        }
572        self.client.send_query_and_decode::<
573            fidl::encoding::EmptyPayload,
574            DeviceGetRelativePerformanceResult,
575        >(
576            (),
577            0x41c37eaf0c26a3d3,
578            fidl::encoding::DynamicFlags::empty(),
579            _decode,
580        )
581    }
582}
583
584pub struct DeviceEventStream {
585    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
586}
587
588impl std::marker::Unpin for DeviceEventStream {}
589
590impl futures::stream::FusedStream for DeviceEventStream {
591    fn is_terminated(&self) -> bool {
592        self.event_receiver.is_terminated()
593    }
594}
595
596impl futures::Stream for DeviceEventStream {
597    type Item = Result<DeviceEvent, fidl::Error>;
598
599    fn poll_next(
600        mut self: std::pin::Pin<&mut Self>,
601        cx: &mut std::task::Context<'_>,
602    ) -> std::task::Poll<Option<Self::Item>> {
603        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
604            &mut self.event_receiver,
605            cx
606        )?) {
607            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
608            None => std::task::Poll::Ready(None),
609        }
610    }
611}
612
613#[derive(Debug)]
614pub enum DeviceEvent {}
615
616impl DeviceEvent {
617    /// Decodes a message buffer as a [`DeviceEvent`].
618    fn decode(
619        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
620    ) -> Result<DeviceEvent, fidl::Error> {
621        let (bytes, _handles) = buf.split_mut();
622        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
623        debug_assert_eq!(tx_header.tx_id, 0);
624        match tx_header.ordinal {
625            _ => Err(fidl::Error::UnknownOrdinal {
626                ordinal: tx_header.ordinal,
627                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
628            }),
629        }
630    }
631}
632
633/// A Stream of incoming requests for fuchsia.hardware.cpu.ctrl/Device.
634pub struct DeviceRequestStream {
635    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
636    is_terminated: bool,
637}
638
639impl std::marker::Unpin for DeviceRequestStream {}
640
641impl futures::stream::FusedStream for DeviceRequestStream {
642    fn is_terminated(&self) -> bool {
643        self.is_terminated
644    }
645}
646
647impl fidl::endpoints::RequestStream for DeviceRequestStream {
648    type Protocol = DeviceMarker;
649    type ControlHandle = DeviceControlHandle;
650
651    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
652        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
653    }
654
655    fn control_handle(&self) -> Self::ControlHandle {
656        DeviceControlHandle { inner: self.inner.clone() }
657    }
658
659    fn into_inner(
660        self,
661    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
662    {
663        (self.inner, self.is_terminated)
664    }
665
666    fn from_inner(
667        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
668        is_terminated: bool,
669    ) -> Self {
670        Self { inner, is_terminated }
671    }
672}
673
674impl futures::Stream for DeviceRequestStream {
675    type Item = Result<DeviceRequest, fidl::Error>;
676
677    fn poll_next(
678        mut self: std::pin::Pin<&mut Self>,
679        cx: &mut std::task::Context<'_>,
680    ) -> std::task::Poll<Option<Self::Item>> {
681        let this = &mut *self;
682        if this.inner.check_shutdown(cx) {
683            this.is_terminated = true;
684            return std::task::Poll::Ready(None);
685        }
686        if this.is_terminated {
687            panic!("polled DeviceRequestStream after completion");
688        }
689        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
690            |bytes, handles| {
691                match this.inner.channel().read_etc(cx, bytes, handles) {
692                    std::task::Poll::Ready(Ok(())) => {}
693                    std::task::Poll::Pending => return std::task::Poll::Pending,
694                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
695                        this.is_terminated = true;
696                        return std::task::Poll::Ready(None);
697                    }
698                    std::task::Poll::Ready(Err(e)) => {
699                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
700                            e.into(),
701                        ))));
702                    }
703                }
704
705                // A message has been received from the channel
706                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
707
708                std::task::Poll::Ready(Some(match header.ordinal {
709                    0x6594a9234fc958e2 => {
710                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
711                        let mut req = fidl::new_empty!(
712                            DeviceGetOperatingPointInfoRequest,
713                            fidl::encoding::DefaultFuchsiaResourceDialect
714                        );
715                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetOperatingPointInfoRequest>(&header, _body_bytes, handles, &mut req)?;
716                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
717                        Ok(DeviceRequest::GetOperatingPointInfo {
718                            opp: req.opp,
719
720                            responder: DeviceGetOperatingPointInfoResponder {
721                                control_handle: std::mem::ManuallyDrop::new(control_handle),
722                                tx_id: header.tx_id,
723                            },
724                        })
725                    }
726                    0x52de67a5993f5fe1 => {
727                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
728                        let mut req = fidl::new_empty!(
729                            fidl::encoding::EmptyPayload,
730                            fidl::encoding::DefaultFuchsiaResourceDialect
731                        );
732                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
733                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
734                        Ok(DeviceRequest::GetCurrentOperatingPoint {
735                            responder: DeviceGetCurrentOperatingPointResponder {
736                                control_handle: std::mem::ManuallyDrop::new(control_handle),
737                                tx_id: header.tx_id,
738                            },
739                        })
740                    }
741                    0x34a7828b5ca53fd => {
742                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
743                        let mut req = fidl::new_empty!(
744                            DeviceSetCurrentOperatingPointRequest,
745                            fidl::encoding::DefaultFuchsiaResourceDialect
746                        );
747                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetCurrentOperatingPointRequest>(&header, _body_bytes, handles, &mut req)?;
748                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
749                        Ok(DeviceRequest::SetCurrentOperatingPoint {
750                            requested_opp: req.requested_opp,
751
752                            responder: DeviceSetCurrentOperatingPointResponder {
753                                control_handle: std::mem::ManuallyDrop::new(control_handle),
754                                tx_id: header.tx_id,
755                            },
756                        })
757                    }
758                    0x13e70ec7131889ba => {
759                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
760                        let mut req = fidl::new_empty!(
761                            fidl::encoding::EmptyPayload,
762                            fidl::encoding::DefaultFuchsiaResourceDialect
763                        );
764                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
765                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
766                        Ok(DeviceRequest::GetOperatingPointCount {
767                            responder: DeviceGetOperatingPointCountResponder {
768                                control_handle: std::mem::ManuallyDrop::new(control_handle),
769                                tx_id: header.tx_id,
770                            },
771                        })
772                    }
773                    0x74e304c90ca165c5 => {
774                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
775                        let mut req = fidl::new_empty!(
776                            fidl::encoding::EmptyPayload,
777                            fidl::encoding::DefaultFuchsiaResourceDialect
778                        );
779                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
780                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
781                        Ok(DeviceRequest::GetNumLogicalCores {
782                            responder: DeviceGetNumLogicalCoresResponder {
783                                control_handle: std::mem::ManuallyDrop::new(control_handle),
784                                tx_id: header.tx_id,
785                            },
786                        })
787                    }
788                    0x7168f98ddbd26058 => {
789                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
790                        let mut req = fidl::new_empty!(
791                            DeviceGetLogicalCoreIdRequest,
792                            fidl::encoding::DefaultFuchsiaResourceDialect
793                        );
794                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetLogicalCoreIdRequest>(&header, _body_bytes, handles, &mut req)?;
795                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
796                        Ok(DeviceRequest::GetLogicalCoreId {
797                            index: req.index,
798
799                            responder: DeviceGetLogicalCoreIdResponder {
800                                control_handle: std::mem::ManuallyDrop::new(control_handle),
801                                tx_id: header.tx_id,
802                            },
803                        })
804                    }
805                    0x3030f85bdc1ef321 => {
806                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
807                        let mut req = fidl::new_empty!(
808                            fidl::encoding::EmptyPayload,
809                            fidl::encoding::DefaultFuchsiaResourceDialect
810                        );
811                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
812                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
813                        Ok(DeviceRequest::GetDomainId {
814                            responder: DeviceGetDomainIdResponder {
815                                control_handle: std::mem::ManuallyDrop::new(control_handle),
816                                tx_id: header.tx_id,
817                            },
818                        })
819                    }
820                    0x41c37eaf0c26a3d3 => {
821                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
822                        let mut req = fidl::new_empty!(
823                            fidl::encoding::EmptyPayload,
824                            fidl::encoding::DefaultFuchsiaResourceDialect
825                        );
826                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
827                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
828                        Ok(DeviceRequest::GetRelativePerformance {
829                            responder: DeviceGetRelativePerformanceResponder {
830                                control_handle: std::mem::ManuallyDrop::new(control_handle),
831                                tx_id: header.tx_id,
832                            },
833                        })
834                    }
835                    _ => Err(fidl::Error::UnknownOrdinal {
836                        ordinal: header.ordinal,
837                        protocol_name:
838                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
839                    }),
840                }))
841            },
842        )
843    }
844}
845
846#[derive(Debug)]
847pub enum DeviceRequest {
848    /// Returns information about a given operating point for this performance
849    /// domain.
850    GetOperatingPointInfo { opp: u32, responder: DeviceGetOperatingPointInfoResponder },
851    /// Gets the current operating point of the device.
852    GetCurrentOperatingPoint { responder: DeviceGetCurrentOperatingPointResponder },
853    /// Set the operating point of this device to the requested operating point.
854    /// Returns ZX_OK, if the device is in a working state and the operating point is changed to
855    /// requested_opp successfully. out_opp will be same as requested_opp.
856    /// Returns error status, if switching to the requested_opp was unsuccessful. out_opp
857    /// is the operating performance point (OPP) that the device is currently in.
858    SetCurrentOperatingPoint {
859        requested_opp: u32,
860        responder: DeviceSetCurrentOperatingPointResponder,
861    },
862    /// Returns the number of operating points within this performance domain.
863    GetOperatingPointCount { responder: DeviceGetOperatingPointCountResponder },
864    /// Returns the number of logical cores contained within this performance
865    /// domain.
866    GetNumLogicalCores { responder: DeviceGetNumLogicalCoresResponder },
867    /// Returns a global system-wide core ID for the nth core in this
868    /// performance domain. `index` must be a value in the range [0, n) where
869    /// n is the value returned by GetNumLogicalCores().
870    GetLogicalCoreId { index: u64, responder: DeviceGetLogicalCoreIdResponder },
871    /// Returns the id of this performance domain within its package. This
872    /// number should be stable across boots, but clients should prefer to use
873    /// GetRelativePerformance to differentiate cores if possible.
874    GetDomainId { responder: DeviceGetDomainIdResponder },
875    /// The relative performance of this domain as configured by the platform,
876    /// if known. The highest performance domain should return 255, while others
877    /// should return N/255 fractional values relative to that domain.
878    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
879    GetRelativePerformance { responder: DeviceGetRelativePerformanceResponder },
880}
881
882impl DeviceRequest {
883    #[allow(irrefutable_let_patterns)]
884    pub fn into_get_operating_point_info(
885        self,
886    ) -> Option<(u32, DeviceGetOperatingPointInfoResponder)> {
887        if let DeviceRequest::GetOperatingPointInfo { opp, responder } = self {
888            Some((opp, responder))
889        } else {
890            None
891        }
892    }
893
894    #[allow(irrefutable_let_patterns)]
895    pub fn into_get_current_operating_point(
896        self,
897    ) -> Option<(DeviceGetCurrentOperatingPointResponder)> {
898        if let DeviceRequest::GetCurrentOperatingPoint { responder } = self {
899            Some((responder))
900        } else {
901            None
902        }
903    }
904
905    #[allow(irrefutable_let_patterns)]
906    pub fn into_set_current_operating_point(
907        self,
908    ) -> Option<(u32, DeviceSetCurrentOperatingPointResponder)> {
909        if let DeviceRequest::SetCurrentOperatingPoint { requested_opp, responder } = self {
910            Some((requested_opp, responder))
911        } else {
912            None
913        }
914    }
915
916    #[allow(irrefutable_let_patterns)]
917    pub fn into_get_operating_point_count(self) -> Option<(DeviceGetOperatingPointCountResponder)> {
918        if let DeviceRequest::GetOperatingPointCount { responder } = self {
919            Some((responder))
920        } else {
921            None
922        }
923    }
924
925    #[allow(irrefutable_let_patterns)]
926    pub fn into_get_num_logical_cores(self) -> Option<(DeviceGetNumLogicalCoresResponder)> {
927        if let DeviceRequest::GetNumLogicalCores { responder } = self {
928            Some((responder))
929        } else {
930            None
931        }
932    }
933
934    #[allow(irrefutable_let_patterns)]
935    pub fn into_get_logical_core_id(self) -> Option<(u64, DeviceGetLogicalCoreIdResponder)> {
936        if let DeviceRequest::GetLogicalCoreId { index, responder } = self {
937            Some((index, responder))
938        } else {
939            None
940        }
941    }
942
943    #[allow(irrefutable_let_patterns)]
944    pub fn into_get_domain_id(self) -> Option<(DeviceGetDomainIdResponder)> {
945        if let DeviceRequest::GetDomainId { responder } = self { Some((responder)) } else { None }
946    }
947
948    #[allow(irrefutable_let_patterns)]
949    pub fn into_get_relative_performance(self) -> Option<(DeviceGetRelativePerformanceResponder)> {
950        if let DeviceRequest::GetRelativePerformance { responder } = self {
951            Some((responder))
952        } else {
953            None
954        }
955    }
956
957    /// Name of the method defined in FIDL
958    pub fn method_name(&self) -> &'static str {
959        match *self {
960            DeviceRequest::GetOperatingPointInfo { .. } => "get_operating_point_info",
961            DeviceRequest::GetCurrentOperatingPoint { .. } => "get_current_operating_point",
962            DeviceRequest::SetCurrentOperatingPoint { .. } => "set_current_operating_point",
963            DeviceRequest::GetOperatingPointCount { .. } => "get_operating_point_count",
964            DeviceRequest::GetNumLogicalCores { .. } => "get_num_logical_cores",
965            DeviceRequest::GetLogicalCoreId { .. } => "get_logical_core_id",
966            DeviceRequest::GetDomainId { .. } => "get_domain_id",
967            DeviceRequest::GetRelativePerformance { .. } => "get_relative_performance",
968        }
969    }
970}
971
972#[derive(Debug, Clone)]
973pub struct DeviceControlHandle {
974    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
975}
976
977impl fidl::endpoints::ControlHandle for DeviceControlHandle {
978    fn shutdown(&self) {
979        self.inner.shutdown()
980    }
981    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
982        self.inner.shutdown_with_epitaph(status)
983    }
984
985    fn is_closed(&self) -> bool {
986        self.inner.channel().is_closed()
987    }
988    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
989        self.inner.channel().on_closed()
990    }
991
992    #[cfg(target_os = "fuchsia")]
993    fn signal_peer(
994        &self,
995        clear_mask: zx::Signals,
996        set_mask: zx::Signals,
997    ) -> Result<(), zx_status::Status> {
998        use fidl::Peered;
999        self.inner.channel().signal_peer(clear_mask, set_mask)
1000    }
1001}
1002
1003impl DeviceControlHandle {}
1004
1005#[must_use = "FIDL methods require a response to be sent"]
1006#[derive(Debug)]
1007pub struct DeviceGetOperatingPointInfoResponder {
1008    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1009    tx_id: u32,
1010}
1011
1012/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1013/// if the responder is dropped without sending a response, so that the client
1014/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1015impl std::ops::Drop for DeviceGetOperatingPointInfoResponder {
1016    fn drop(&mut self) {
1017        self.control_handle.shutdown();
1018        // Safety: drops once, never accessed again
1019        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1020    }
1021}
1022
1023impl fidl::endpoints::Responder for DeviceGetOperatingPointInfoResponder {
1024    type ControlHandle = DeviceControlHandle;
1025
1026    fn control_handle(&self) -> &DeviceControlHandle {
1027        &self.control_handle
1028    }
1029
1030    fn drop_without_shutdown(mut self) {
1031        // Safety: drops once, never accessed again due to mem::forget
1032        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1033        // Prevent Drop from running (which would shut down the channel)
1034        std::mem::forget(self);
1035    }
1036}
1037
1038impl DeviceGetOperatingPointInfoResponder {
1039    /// Sends a response to the FIDL transaction.
1040    ///
1041    /// Sets the channel to shutdown if an error occurs.
1042    pub fn send(self, mut result: Result<&CpuOperatingPointInfo, i32>) -> Result<(), fidl::Error> {
1043        let _result = self.send_raw(result);
1044        if _result.is_err() {
1045            self.control_handle.shutdown();
1046        }
1047        self.drop_without_shutdown();
1048        _result
1049    }
1050
1051    /// Similar to "send" but does not shutdown the channel if an error occurs.
1052    pub fn send_no_shutdown_on_err(
1053        self,
1054        mut result: Result<&CpuOperatingPointInfo, i32>,
1055    ) -> Result<(), fidl::Error> {
1056        let _result = self.send_raw(result);
1057        self.drop_without_shutdown();
1058        _result
1059    }
1060
1061    fn send_raw(&self, mut result: Result<&CpuOperatingPointInfo, i32>) -> Result<(), fidl::Error> {
1062        self.control_handle.inner.send::<fidl::encoding::ResultType<
1063            DeviceGetOperatingPointInfoResponse,
1064            i32,
1065        >>(
1066            result.map(|info| (info,)),
1067            self.tx_id,
1068            0x6594a9234fc958e2,
1069            fidl::encoding::DynamicFlags::empty(),
1070        )
1071    }
1072}
1073
1074#[must_use = "FIDL methods require a response to be sent"]
1075#[derive(Debug)]
1076pub struct DeviceGetCurrentOperatingPointResponder {
1077    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1078    tx_id: u32,
1079}
1080
1081/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1082/// if the responder is dropped without sending a response, so that the client
1083/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1084impl std::ops::Drop for DeviceGetCurrentOperatingPointResponder {
1085    fn drop(&mut self) {
1086        self.control_handle.shutdown();
1087        // Safety: drops once, never accessed again
1088        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1089    }
1090}
1091
1092impl fidl::endpoints::Responder for DeviceGetCurrentOperatingPointResponder {
1093    type ControlHandle = DeviceControlHandle;
1094
1095    fn control_handle(&self) -> &DeviceControlHandle {
1096        &self.control_handle
1097    }
1098
1099    fn drop_without_shutdown(mut self) {
1100        // Safety: drops once, never accessed again due to mem::forget
1101        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1102        // Prevent Drop from running (which would shut down the channel)
1103        std::mem::forget(self);
1104    }
1105}
1106
1107impl DeviceGetCurrentOperatingPointResponder {
1108    /// Sends a response to the FIDL transaction.
1109    ///
1110    /// Sets the channel to shutdown if an error occurs.
1111    pub fn send(self, mut out_opp: u32) -> Result<(), fidl::Error> {
1112        let _result = self.send_raw(out_opp);
1113        if _result.is_err() {
1114            self.control_handle.shutdown();
1115        }
1116        self.drop_without_shutdown();
1117        _result
1118    }
1119
1120    /// Similar to "send" but does not shutdown the channel if an error occurs.
1121    pub fn send_no_shutdown_on_err(self, mut out_opp: u32) -> Result<(), fidl::Error> {
1122        let _result = self.send_raw(out_opp);
1123        self.drop_without_shutdown();
1124        _result
1125    }
1126
1127    fn send_raw(&self, mut out_opp: u32) -> Result<(), fidl::Error> {
1128        self.control_handle.inner.send::<DeviceGetCurrentOperatingPointResponse>(
1129            (out_opp,),
1130            self.tx_id,
1131            0x52de67a5993f5fe1,
1132            fidl::encoding::DynamicFlags::empty(),
1133        )
1134    }
1135}
1136
1137#[must_use = "FIDL methods require a response to be sent"]
1138#[derive(Debug)]
1139pub struct DeviceSetCurrentOperatingPointResponder {
1140    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1141    tx_id: u32,
1142}
1143
1144/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1145/// if the responder is dropped without sending a response, so that the client
1146/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1147impl std::ops::Drop for DeviceSetCurrentOperatingPointResponder {
1148    fn drop(&mut self) {
1149        self.control_handle.shutdown();
1150        // Safety: drops once, never accessed again
1151        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1152    }
1153}
1154
1155impl fidl::endpoints::Responder for DeviceSetCurrentOperatingPointResponder {
1156    type ControlHandle = DeviceControlHandle;
1157
1158    fn control_handle(&self) -> &DeviceControlHandle {
1159        &self.control_handle
1160    }
1161
1162    fn drop_without_shutdown(mut self) {
1163        // Safety: drops once, never accessed again due to mem::forget
1164        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1165        // Prevent Drop from running (which would shut down the channel)
1166        std::mem::forget(self);
1167    }
1168}
1169
1170impl DeviceSetCurrentOperatingPointResponder {
1171    /// Sends a response to the FIDL transaction.
1172    ///
1173    /// Sets the channel to shutdown if an error occurs.
1174    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1175        let _result = self.send_raw(result);
1176        if _result.is_err() {
1177            self.control_handle.shutdown();
1178        }
1179        self.drop_without_shutdown();
1180        _result
1181    }
1182
1183    /// Similar to "send" but does not shutdown the channel if an error occurs.
1184    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1185        let _result = self.send_raw(result);
1186        self.drop_without_shutdown();
1187        _result
1188    }
1189
1190    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1191        self.control_handle.inner.send::<fidl::encoding::ResultType<
1192            DeviceSetCurrentOperatingPointResponse,
1193            i32,
1194        >>(
1195            result.map(|out_opp| (out_opp,)),
1196            self.tx_id,
1197            0x34a7828b5ca53fd,
1198            fidl::encoding::DynamicFlags::empty(),
1199        )
1200    }
1201}
1202
1203#[must_use = "FIDL methods require a response to be sent"]
1204#[derive(Debug)]
1205pub struct DeviceGetOperatingPointCountResponder {
1206    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1207    tx_id: u32,
1208}
1209
1210/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1211/// if the responder is dropped without sending a response, so that the client
1212/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1213impl std::ops::Drop for DeviceGetOperatingPointCountResponder {
1214    fn drop(&mut self) {
1215        self.control_handle.shutdown();
1216        // Safety: drops once, never accessed again
1217        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1218    }
1219}
1220
1221impl fidl::endpoints::Responder for DeviceGetOperatingPointCountResponder {
1222    type ControlHandle = DeviceControlHandle;
1223
1224    fn control_handle(&self) -> &DeviceControlHandle {
1225        &self.control_handle
1226    }
1227
1228    fn drop_without_shutdown(mut self) {
1229        // Safety: drops once, never accessed again due to mem::forget
1230        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1231        // Prevent Drop from running (which would shut down the channel)
1232        std::mem::forget(self);
1233    }
1234}
1235
1236impl DeviceGetOperatingPointCountResponder {
1237    /// Sends a response to the FIDL transaction.
1238    ///
1239    /// Sets the channel to shutdown if an error occurs.
1240    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1241        let _result = self.send_raw(result);
1242        if _result.is_err() {
1243            self.control_handle.shutdown();
1244        }
1245        self.drop_without_shutdown();
1246        _result
1247    }
1248
1249    /// Similar to "send" but does not shutdown the channel if an error occurs.
1250    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1251        let _result = self.send_raw(result);
1252        self.drop_without_shutdown();
1253        _result
1254    }
1255
1256    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1257        self.control_handle.inner.send::<fidl::encoding::ResultType<
1258            DeviceGetOperatingPointCountResponse,
1259            i32,
1260        >>(
1261            result.map(|count| (count,)),
1262            self.tx_id,
1263            0x13e70ec7131889ba,
1264            fidl::encoding::DynamicFlags::empty(),
1265        )
1266    }
1267}
1268
1269#[must_use = "FIDL methods require a response to be sent"]
1270#[derive(Debug)]
1271pub struct DeviceGetNumLogicalCoresResponder {
1272    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1273    tx_id: u32,
1274}
1275
1276/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1277/// if the responder is dropped without sending a response, so that the client
1278/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1279impl std::ops::Drop for DeviceGetNumLogicalCoresResponder {
1280    fn drop(&mut self) {
1281        self.control_handle.shutdown();
1282        // Safety: drops once, never accessed again
1283        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1284    }
1285}
1286
1287impl fidl::endpoints::Responder for DeviceGetNumLogicalCoresResponder {
1288    type ControlHandle = DeviceControlHandle;
1289
1290    fn control_handle(&self) -> &DeviceControlHandle {
1291        &self.control_handle
1292    }
1293
1294    fn drop_without_shutdown(mut self) {
1295        // Safety: drops once, never accessed again due to mem::forget
1296        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1297        // Prevent Drop from running (which would shut down the channel)
1298        std::mem::forget(self);
1299    }
1300}
1301
1302impl DeviceGetNumLogicalCoresResponder {
1303    /// Sends a response to the FIDL transaction.
1304    ///
1305    /// Sets the channel to shutdown if an error occurs.
1306    pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
1307        let _result = self.send_raw(count);
1308        if _result.is_err() {
1309            self.control_handle.shutdown();
1310        }
1311        self.drop_without_shutdown();
1312        _result
1313    }
1314
1315    /// Similar to "send" but does not shutdown the channel if an error occurs.
1316    pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
1317        let _result = self.send_raw(count);
1318        self.drop_without_shutdown();
1319        _result
1320    }
1321
1322    fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
1323        self.control_handle.inner.send::<DeviceGetNumLogicalCoresResponse>(
1324            (count,),
1325            self.tx_id,
1326            0x74e304c90ca165c5,
1327            fidl::encoding::DynamicFlags::empty(),
1328        )
1329    }
1330}
1331
1332#[must_use = "FIDL methods require a response to be sent"]
1333#[derive(Debug)]
1334pub struct DeviceGetLogicalCoreIdResponder {
1335    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1336    tx_id: u32,
1337}
1338
1339/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1340/// if the responder is dropped without sending a response, so that the client
1341/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1342impl std::ops::Drop for DeviceGetLogicalCoreIdResponder {
1343    fn drop(&mut self) {
1344        self.control_handle.shutdown();
1345        // Safety: drops once, never accessed again
1346        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1347    }
1348}
1349
1350impl fidl::endpoints::Responder for DeviceGetLogicalCoreIdResponder {
1351    type ControlHandle = DeviceControlHandle;
1352
1353    fn control_handle(&self) -> &DeviceControlHandle {
1354        &self.control_handle
1355    }
1356
1357    fn drop_without_shutdown(mut self) {
1358        // Safety: drops once, never accessed again due to mem::forget
1359        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1360        // Prevent Drop from running (which would shut down the channel)
1361        std::mem::forget(self);
1362    }
1363}
1364
1365impl DeviceGetLogicalCoreIdResponder {
1366    /// Sends a response to the FIDL transaction.
1367    ///
1368    /// Sets the channel to shutdown if an error occurs.
1369    pub fn send(self, mut id: u64) -> Result<(), fidl::Error> {
1370        let _result = self.send_raw(id);
1371        if _result.is_err() {
1372            self.control_handle.shutdown();
1373        }
1374        self.drop_without_shutdown();
1375        _result
1376    }
1377
1378    /// Similar to "send" but does not shutdown the channel if an error occurs.
1379    pub fn send_no_shutdown_on_err(self, mut id: u64) -> Result<(), fidl::Error> {
1380        let _result = self.send_raw(id);
1381        self.drop_without_shutdown();
1382        _result
1383    }
1384
1385    fn send_raw(&self, mut id: u64) -> Result<(), fidl::Error> {
1386        self.control_handle.inner.send::<DeviceGetLogicalCoreIdResponse>(
1387            (id,),
1388            self.tx_id,
1389            0x7168f98ddbd26058,
1390            fidl::encoding::DynamicFlags::empty(),
1391        )
1392    }
1393}
1394
1395#[must_use = "FIDL methods require a response to be sent"]
1396#[derive(Debug)]
1397pub struct DeviceGetDomainIdResponder {
1398    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1399    tx_id: u32,
1400}
1401
1402/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1403/// if the responder is dropped without sending a response, so that the client
1404/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1405impl std::ops::Drop for DeviceGetDomainIdResponder {
1406    fn drop(&mut self) {
1407        self.control_handle.shutdown();
1408        // Safety: drops once, never accessed again
1409        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1410    }
1411}
1412
1413impl fidl::endpoints::Responder for DeviceGetDomainIdResponder {
1414    type ControlHandle = DeviceControlHandle;
1415
1416    fn control_handle(&self) -> &DeviceControlHandle {
1417        &self.control_handle
1418    }
1419
1420    fn drop_without_shutdown(mut self) {
1421        // Safety: drops once, never accessed again due to mem::forget
1422        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1423        // Prevent Drop from running (which would shut down the channel)
1424        std::mem::forget(self);
1425    }
1426}
1427
1428impl DeviceGetDomainIdResponder {
1429    /// Sends a response to the FIDL transaction.
1430    ///
1431    /// Sets the channel to shutdown if an error occurs.
1432    pub fn send(self, mut domain_id: u32) -> Result<(), fidl::Error> {
1433        let _result = self.send_raw(domain_id);
1434        if _result.is_err() {
1435            self.control_handle.shutdown();
1436        }
1437        self.drop_without_shutdown();
1438        _result
1439    }
1440
1441    /// Similar to "send" but does not shutdown the channel if an error occurs.
1442    pub fn send_no_shutdown_on_err(self, mut domain_id: u32) -> Result<(), fidl::Error> {
1443        let _result = self.send_raw(domain_id);
1444        self.drop_without_shutdown();
1445        _result
1446    }
1447
1448    fn send_raw(&self, mut domain_id: u32) -> Result<(), fidl::Error> {
1449        self.control_handle.inner.send::<DeviceGetDomainIdResponse>(
1450            (domain_id,),
1451            self.tx_id,
1452            0x3030f85bdc1ef321,
1453            fidl::encoding::DynamicFlags::empty(),
1454        )
1455    }
1456}
1457
1458#[must_use = "FIDL methods require a response to be sent"]
1459#[derive(Debug)]
1460pub struct DeviceGetRelativePerformanceResponder {
1461    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1462    tx_id: u32,
1463}
1464
1465/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1466/// if the responder is dropped without sending a response, so that the client
1467/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1468impl std::ops::Drop for DeviceGetRelativePerformanceResponder {
1469    fn drop(&mut self) {
1470        self.control_handle.shutdown();
1471        // Safety: drops once, never accessed again
1472        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1473    }
1474}
1475
1476impl fidl::endpoints::Responder for DeviceGetRelativePerformanceResponder {
1477    type ControlHandle = DeviceControlHandle;
1478
1479    fn control_handle(&self) -> &DeviceControlHandle {
1480        &self.control_handle
1481    }
1482
1483    fn drop_without_shutdown(mut self) {
1484        // Safety: drops once, never accessed again due to mem::forget
1485        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1486        // Prevent Drop from running (which would shut down the channel)
1487        std::mem::forget(self);
1488    }
1489}
1490
1491impl DeviceGetRelativePerformanceResponder {
1492    /// Sends a response to the FIDL transaction.
1493    ///
1494    /// Sets the channel to shutdown if an error occurs.
1495    pub fn send(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
1496        let _result = self.send_raw(result);
1497        if _result.is_err() {
1498            self.control_handle.shutdown();
1499        }
1500        self.drop_without_shutdown();
1501        _result
1502    }
1503
1504    /// Similar to "send" but does not shutdown the channel if an error occurs.
1505    pub fn send_no_shutdown_on_err(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
1506        let _result = self.send_raw(result);
1507        self.drop_without_shutdown();
1508        _result
1509    }
1510
1511    fn send_raw(&self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
1512        self.control_handle.inner.send::<fidl::encoding::ResultType<
1513            DeviceGetRelativePerformanceResponse,
1514            i32,
1515        >>(
1516            result.map(|relative_performance| (relative_performance,)),
1517            self.tx_id,
1518            0x41c37eaf0c26a3d3,
1519            fidl::encoding::DynamicFlags::empty(),
1520        )
1521    }
1522}
1523
1524#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1525pub struct ServiceMarker;
1526
1527#[cfg(target_os = "fuchsia")]
1528impl fidl::endpoints::ServiceMarker for ServiceMarker {
1529    type Proxy = ServiceProxy;
1530    type Request = ServiceRequest;
1531    const SERVICE_NAME: &'static str = "fuchsia.hardware.cpu.ctrl.Service";
1532}
1533
1534/// A request for one of the member protocols of Service.
1535///
1536#[cfg(target_os = "fuchsia")]
1537pub enum ServiceRequest {
1538    Device(DeviceRequestStream),
1539}
1540
1541#[cfg(target_os = "fuchsia")]
1542impl fidl::endpoints::ServiceRequest for ServiceRequest {
1543    type Service = ServiceMarker;
1544
1545    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1546        match name {
1547            "device" => Self::Device(
1548                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1549            ),
1550            _ => panic!("no such member protocol name for service Service"),
1551        }
1552    }
1553
1554    fn member_names() -> &'static [&'static str] {
1555        &["device"]
1556    }
1557}
1558#[cfg(target_os = "fuchsia")]
1559pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1560
1561#[cfg(target_os = "fuchsia")]
1562impl fidl::endpoints::ServiceProxy for ServiceProxy {
1563    type Service = ServiceMarker;
1564
1565    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1566        Self(opener)
1567    }
1568}
1569
1570#[cfg(target_os = "fuchsia")]
1571impl ServiceProxy {
1572    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1573        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1574        self.connect_channel_to_device(server_end)?;
1575        Ok(proxy)
1576    }
1577
1578    /// Like `connect_to_device`, but returns a sync proxy.
1579    /// See [`Self::connect_to_device`] for more details.
1580    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1581        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1582        self.connect_channel_to_device(server_end)?;
1583        Ok(proxy)
1584    }
1585
1586    /// Like `connect_to_device`, but accepts a server end.
1587    /// See [`Self::connect_to_device`] for more details.
1588    pub fn connect_channel_to_device(
1589        &self,
1590        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1591    ) -> Result<(), fidl::Error> {
1592        self.0.open_member("device", server_end.into_channel())
1593    }
1594
1595    pub fn instance_name(&self) -> &str {
1596        self.0.instance_name()
1597    }
1598}
1599
1600mod internal {
1601    use super::*;
1602}