1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_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 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 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 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 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 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 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 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 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 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::NullableHandle {
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 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 pub fn take_event_stream(&self) -> DeviceEventStream {
303 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
304 }
305
306 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 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 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 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 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 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 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 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 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
633pub 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 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 GetOperatingPointInfo { opp: u32, responder: DeviceGetOperatingPointInfoResponder },
851 GetCurrentOperatingPoint { responder: DeviceGetCurrentOperatingPointResponder },
853 SetCurrentOperatingPoint {
859 requested_opp: u32,
860 responder: DeviceSetCurrentOperatingPointResponder,
861 },
862 GetOperatingPointCount { responder: DeviceGetOperatingPointCountResponder },
864 GetNumLogicalCores { responder: DeviceGetNumLogicalCoresResponder },
867 GetLogicalCoreId { index: u64, responder: DeviceGetLogicalCoreIdResponder },
871 GetDomainId { responder: DeviceGetDomainIdResponder },
875 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 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
982 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
983 self.inner.shutdown_with_epitaph(status)
984 }
985
986 fn is_closed(&self) -> bool {
987 self.inner.channel().is_closed()
988 }
989 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
990 self.inner.channel().on_closed()
991 }
992
993 #[cfg(target_os = "fuchsia")]
994 fn signal_peer(
995 &self,
996 clear_mask: zx::Signals,
997 set_mask: zx::Signals,
998 ) -> Result<(), zx_status::Status> {
999 use fidl::Peered;
1000 self.inner.channel().signal_peer(clear_mask, set_mask)
1001 }
1002}
1003
1004impl DeviceControlHandle {}
1005
1006#[must_use = "FIDL methods require a response to be sent"]
1007#[derive(Debug)]
1008pub struct DeviceGetOperatingPointInfoResponder {
1009 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1010 tx_id: u32,
1011}
1012
1013impl std::ops::Drop for DeviceGetOperatingPointInfoResponder {
1017 fn drop(&mut self) {
1018 self.control_handle.shutdown();
1019 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1021 }
1022}
1023
1024impl fidl::endpoints::Responder for DeviceGetOperatingPointInfoResponder {
1025 type ControlHandle = DeviceControlHandle;
1026
1027 fn control_handle(&self) -> &DeviceControlHandle {
1028 &self.control_handle
1029 }
1030
1031 fn drop_without_shutdown(mut self) {
1032 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1034 std::mem::forget(self);
1036 }
1037}
1038
1039impl DeviceGetOperatingPointInfoResponder {
1040 pub fn send(self, mut result: Result<&CpuOperatingPointInfo, i32>) -> Result<(), fidl::Error> {
1044 let _result = self.send_raw(result);
1045 if _result.is_err() {
1046 self.control_handle.shutdown();
1047 }
1048 self.drop_without_shutdown();
1049 _result
1050 }
1051
1052 pub fn send_no_shutdown_on_err(
1054 self,
1055 mut result: Result<&CpuOperatingPointInfo, i32>,
1056 ) -> Result<(), fidl::Error> {
1057 let _result = self.send_raw(result);
1058 self.drop_without_shutdown();
1059 _result
1060 }
1061
1062 fn send_raw(&self, mut result: Result<&CpuOperatingPointInfo, i32>) -> Result<(), fidl::Error> {
1063 self.control_handle.inner.send::<fidl::encoding::ResultType<
1064 DeviceGetOperatingPointInfoResponse,
1065 i32,
1066 >>(
1067 result.map(|info| (info,)),
1068 self.tx_id,
1069 0x6594a9234fc958e2,
1070 fidl::encoding::DynamicFlags::empty(),
1071 )
1072 }
1073}
1074
1075#[must_use = "FIDL methods require a response to be sent"]
1076#[derive(Debug)]
1077pub struct DeviceGetCurrentOperatingPointResponder {
1078 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1079 tx_id: u32,
1080}
1081
1082impl std::ops::Drop for DeviceGetCurrentOperatingPointResponder {
1086 fn drop(&mut self) {
1087 self.control_handle.shutdown();
1088 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1090 }
1091}
1092
1093impl fidl::endpoints::Responder for DeviceGetCurrentOperatingPointResponder {
1094 type ControlHandle = DeviceControlHandle;
1095
1096 fn control_handle(&self) -> &DeviceControlHandle {
1097 &self.control_handle
1098 }
1099
1100 fn drop_without_shutdown(mut self) {
1101 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1103 std::mem::forget(self);
1105 }
1106}
1107
1108impl DeviceGetCurrentOperatingPointResponder {
1109 pub fn send(self, mut out_opp: u32) -> Result<(), fidl::Error> {
1113 let _result = self.send_raw(out_opp);
1114 if _result.is_err() {
1115 self.control_handle.shutdown();
1116 }
1117 self.drop_without_shutdown();
1118 _result
1119 }
1120
1121 pub fn send_no_shutdown_on_err(self, mut out_opp: u32) -> Result<(), fidl::Error> {
1123 let _result = self.send_raw(out_opp);
1124 self.drop_without_shutdown();
1125 _result
1126 }
1127
1128 fn send_raw(&self, mut out_opp: u32) -> Result<(), fidl::Error> {
1129 self.control_handle.inner.send::<DeviceGetCurrentOperatingPointResponse>(
1130 (out_opp,),
1131 self.tx_id,
1132 0x52de67a5993f5fe1,
1133 fidl::encoding::DynamicFlags::empty(),
1134 )
1135 }
1136}
1137
1138#[must_use = "FIDL methods require a response to be sent"]
1139#[derive(Debug)]
1140pub struct DeviceSetCurrentOperatingPointResponder {
1141 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1142 tx_id: u32,
1143}
1144
1145impl std::ops::Drop for DeviceSetCurrentOperatingPointResponder {
1149 fn drop(&mut self) {
1150 self.control_handle.shutdown();
1151 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1153 }
1154}
1155
1156impl fidl::endpoints::Responder for DeviceSetCurrentOperatingPointResponder {
1157 type ControlHandle = DeviceControlHandle;
1158
1159 fn control_handle(&self) -> &DeviceControlHandle {
1160 &self.control_handle
1161 }
1162
1163 fn drop_without_shutdown(mut self) {
1164 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1166 std::mem::forget(self);
1168 }
1169}
1170
1171impl DeviceSetCurrentOperatingPointResponder {
1172 pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1176 let _result = self.send_raw(result);
1177 if _result.is_err() {
1178 self.control_handle.shutdown();
1179 }
1180 self.drop_without_shutdown();
1181 _result
1182 }
1183
1184 pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1186 let _result = self.send_raw(result);
1187 self.drop_without_shutdown();
1188 _result
1189 }
1190
1191 fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1192 self.control_handle.inner.send::<fidl::encoding::ResultType<
1193 DeviceSetCurrentOperatingPointResponse,
1194 i32,
1195 >>(
1196 result.map(|out_opp| (out_opp,)),
1197 self.tx_id,
1198 0x34a7828b5ca53fd,
1199 fidl::encoding::DynamicFlags::empty(),
1200 )
1201 }
1202}
1203
1204#[must_use = "FIDL methods require a response to be sent"]
1205#[derive(Debug)]
1206pub struct DeviceGetOperatingPointCountResponder {
1207 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1208 tx_id: u32,
1209}
1210
1211impl std::ops::Drop for DeviceGetOperatingPointCountResponder {
1215 fn drop(&mut self) {
1216 self.control_handle.shutdown();
1217 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1219 }
1220}
1221
1222impl fidl::endpoints::Responder for DeviceGetOperatingPointCountResponder {
1223 type ControlHandle = DeviceControlHandle;
1224
1225 fn control_handle(&self) -> &DeviceControlHandle {
1226 &self.control_handle
1227 }
1228
1229 fn drop_without_shutdown(mut self) {
1230 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1232 std::mem::forget(self);
1234 }
1235}
1236
1237impl DeviceGetOperatingPointCountResponder {
1238 pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1242 let _result = self.send_raw(result);
1243 if _result.is_err() {
1244 self.control_handle.shutdown();
1245 }
1246 self.drop_without_shutdown();
1247 _result
1248 }
1249
1250 pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1252 let _result = self.send_raw(result);
1253 self.drop_without_shutdown();
1254 _result
1255 }
1256
1257 fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1258 self.control_handle.inner.send::<fidl::encoding::ResultType<
1259 DeviceGetOperatingPointCountResponse,
1260 i32,
1261 >>(
1262 result.map(|count| (count,)),
1263 self.tx_id,
1264 0x13e70ec7131889ba,
1265 fidl::encoding::DynamicFlags::empty(),
1266 )
1267 }
1268}
1269
1270#[must_use = "FIDL methods require a response to be sent"]
1271#[derive(Debug)]
1272pub struct DeviceGetNumLogicalCoresResponder {
1273 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1274 tx_id: u32,
1275}
1276
1277impl std::ops::Drop for DeviceGetNumLogicalCoresResponder {
1281 fn drop(&mut self) {
1282 self.control_handle.shutdown();
1283 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1285 }
1286}
1287
1288impl fidl::endpoints::Responder for DeviceGetNumLogicalCoresResponder {
1289 type ControlHandle = DeviceControlHandle;
1290
1291 fn control_handle(&self) -> &DeviceControlHandle {
1292 &self.control_handle
1293 }
1294
1295 fn drop_without_shutdown(mut self) {
1296 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1298 std::mem::forget(self);
1300 }
1301}
1302
1303impl DeviceGetNumLogicalCoresResponder {
1304 pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
1308 let _result = self.send_raw(count);
1309 if _result.is_err() {
1310 self.control_handle.shutdown();
1311 }
1312 self.drop_without_shutdown();
1313 _result
1314 }
1315
1316 pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
1318 let _result = self.send_raw(count);
1319 self.drop_without_shutdown();
1320 _result
1321 }
1322
1323 fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
1324 self.control_handle.inner.send::<DeviceGetNumLogicalCoresResponse>(
1325 (count,),
1326 self.tx_id,
1327 0x74e304c90ca165c5,
1328 fidl::encoding::DynamicFlags::empty(),
1329 )
1330 }
1331}
1332
1333#[must_use = "FIDL methods require a response to be sent"]
1334#[derive(Debug)]
1335pub struct DeviceGetLogicalCoreIdResponder {
1336 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1337 tx_id: u32,
1338}
1339
1340impl std::ops::Drop for DeviceGetLogicalCoreIdResponder {
1344 fn drop(&mut self) {
1345 self.control_handle.shutdown();
1346 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1348 }
1349}
1350
1351impl fidl::endpoints::Responder for DeviceGetLogicalCoreIdResponder {
1352 type ControlHandle = DeviceControlHandle;
1353
1354 fn control_handle(&self) -> &DeviceControlHandle {
1355 &self.control_handle
1356 }
1357
1358 fn drop_without_shutdown(mut self) {
1359 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1361 std::mem::forget(self);
1363 }
1364}
1365
1366impl DeviceGetLogicalCoreIdResponder {
1367 pub fn send(self, mut id: u64) -> Result<(), fidl::Error> {
1371 let _result = self.send_raw(id);
1372 if _result.is_err() {
1373 self.control_handle.shutdown();
1374 }
1375 self.drop_without_shutdown();
1376 _result
1377 }
1378
1379 pub fn send_no_shutdown_on_err(self, mut id: u64) -> Result<(), fidl::Error> {
1381 let _result = self.send_raw(id);
1382 self.drop_without_shutdown();
1383 _result
1384 }
1385
1386 fn send_raw(&self, mut id: u64) -> Result<(), fidl::Error> {
1387 self.control_handle.inner.send::<DeviceGetLogicalCoreIdResponse>(
1388 (id,),
1389 self.tx_id,
1390 0x7168f98ddbd26058,
1391 fidl::encoding::DynamicFlags::empty(),
1392 )
1393 }
1394}
1395
1396#[must_use = "FIDL methods require a response to be sent"]
1397#[derive(Debug)]
1398pub struct DeviceGetDomainIdResponder {
1399 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1400 tx_id: u32,
1401}
1402
1403impl std::ops::Drop for DeviceGetDomainIdResponder {
1407 fn drop(&mut self) {
1408 self.control_handle.shutdown();
1409 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1411 }
1412}
1413
1414impl fidl::endpoints::Responder for DeviceGetDomainIdResponder {
1415 type ControlHandle = DeviceControlHandle;
1416
1417 fn control_handle(&self) -> &DeviceControlHandle {
1418 &self.control_handle
1419 }
1420
1421 fn drop_without_shutdown(mut self) {
1422 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1424 std::mem::forget(self);
1426 }
1427}
1428
1429impl DeviceGetDomainIdResponder {
1430 pub fn send(self, mut domain_id: u32) -> Result<(), fidl::Error> {
1434 let _result = self.send_raw(domain_id);
1435 if _result.is_err() {
1436 self.control_handle.shutdown();
1437 }
1438 self.drop_without_shutdown();
1439 _result
1440 }
1441
1442 pub fn send_no_shutdown_on_err(self, mut domain_id: u32) -> Result<(), fidl::Error> {
1444 let _result = self.send_raw(domain_id);
1445 self.drop_without_shutdown();
1446 _result
1447 }
1448
1449 fn send_raw(&self, mut domain_id: u32) -> Result<(), fidl::Error> {
1450 self.control_handle.inner.send::<DeviceGetDomainIdResponse>(
1451 (domain_id,),
1452 self.tx_id,
1453 0x3030f85bdc1ef321,
1454 fidl::encoding::DynamicFlags::empty(),
1455 )
1456 }
1457}
1458
1459#[must_use = "FIDL methods require a response to be sent"]
1460#[derive(Debug)]
1461pub struct DeviceGetRelativePerformanceResponder {
1462 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1463 tx_id: u32,
1464}
1465
1466impl std::ops::Drop for DeviceGetRelativePerformanceResponder {
1470 fn drop(&mut self) {
1471 self.control_handle.shutdown();
1472 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1474 }
1475}
1476
1477impl fidl::endpoints::Responder for DeviceGetRelativePerformanceResponder {
1478 type ControlHandle = DeviceControlHandle;
1479
1480 fn control_handle(&self) -> &DeviceControlHandle {
1481 &self.control_handle
1482 }
1483
1484 fn drop_without_shutdown(mut self) {
1485 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1487 std::mem::forget(self);
1489 }
1490}
1491
1492impl DeviceGetRelativePerformanceResponder {
1493 pub fn send(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
1497 let _result = self.send_raw(result);
1498 if _result.is_err() {
1499 self.control_handle.shutdown();
1500 }
1501 self.drop_without_shutdown();
1502 _result
1503 }
1504
1505 pub fn send_no_shutdown_on_err(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
1507 let _result = self.send_raw(result);
1508 self.drop_without_shutdown();
1509 _result
1510 }
1511
1512 fn send_raw(&self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
1513 self.control_handle.inner.send::<fidl::encoding::ResultType<
1514 DeviceGetRelativePerformanceResponse,
1515 i32,
1516 >>(
1517 result.map(|relative_performance| (relative_performance,)),
1518 self.tx_id,
1519 0x41c37eaf0c26a3d3,
1520 fidl::encoding::DynamicFlags::empty(),
1521 )
1522 }
1523}
1524
1525#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1526pub struct ServiceMarker;
1527
1528#[cfg(target_os = "fuchsia")]
1529impl fidl::endpoints::ServiceMarker for ServiceMarker {
1530 type Proxy = ServiceProxy;
1531 type Request = ServiceRequest;
1532 const SERVICE_NAME: &'static str = "fuchsia.hardware.cpu.ctrl.Service";
1533}
1534
1535#[cfg(target_os = "fuchsia")]
1538pub enum ServiceRequest {
1539 Device(DeviceRequestStream),
1540}
1541
1542#[cfg(target_os = "fuchsia")]
1543impl fidl::endpoints::ServiceRequest for ServiceRequest {
1544 type Service = ServiceMarker;
1545
1546 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1547 match name {
1548 "device" => Self::Device(
1549 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1550 ),
1551 _ => panic!("no such member protocol name for service Service"),
1552 }
1553 }
1554
1555 fn member_names() -> &'static [&'static str] {
1556 &["device"]
1557 }
1558}
1559#[cfg(target_os = "fuchsia")]
1560pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1561
1562#[cfg(target_os = "fuchsia")]
1563impl fidl::endpoints::ServiceProxy for ServiceProxy {
1564 type Service = ServiceMarker;
1565
1566 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1567 Self(opener)
1568 }
1569}
1570
1571#[cfg(target_os = "fuchsia")]
1572impl ServiceProxy {
1573 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1574 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1575 self.connect_channel_to_device(server_end)?;
1576 Ok(proxy)
1577 }
1578
1579 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1582 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1583 self.connect_channel_to_device(server_end)?;
1584 Ok(proxy)
1585 }
1586
1587 pub fn connect_channel_to_device(
1590 &self,
1591 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1592 ) -> Result<(), fidl::Error> {
1593 self.0.open_member("device", server_end.into_channel())
1594 }
1595
1596 pub fn instance_name(&self) -> &str {
1597 self.0.instance_name()
1598 }
1599}
1600
1601mod internal {
1602 use super::*;
1603}