Skip to main content

fidl_fuchsia_power_cpu/
fidl_fuchsia_power_cpu.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_power_cpu_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DomainControllerLeaseMaxFrequencyResponse {
16    pub lease_token: fidl::EventPair,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for DomainControllerLeaseMaxFrequencyResponse
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct DomainControllerLeaseMinFrequencyResponse {
26    pub lease_token: fidl::EventPair,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for DomainControllerLeaseMinFrequencyResponse
31{
32}
33
34#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
35pub struct DomainControllerMarker;
36
37impl fidl::endpoints::ProtocolMarker for DomainControllerMarker {
38    type Proxy = DomainControllerProxy;
39    type RequestStream = DomainControllerRequestStream;
40    #[cfg(target_os = "fuchsia")]
41    type SynchronousProxy = DomainControllerSynchronousProxy;
42
43    const DEBUG_NAME: &'static str = "fuchsia.power.cpu.DomainController";
44}
45impl fidl::endpoints::DiscoverableProtocolMarker for DomainControllerMarker {}
46pub type DomainControllerGetMaxFrequencyResult = Result<u64, DomainControllerError>;
47pub type DomainControllerSetMaxFrequencyResult = Result<(), DomainControllerError>;
48pub type DomainControllerClearMaxFrequencyResult = Result<(), DomainControllerError>;
49pub type DomainControllerGetMinFrequencyResult = Result<u64, DomainControllerError>;
50pub type DomainControllerLeaseMaxFrequencyResult = Result<fidl::EventPair, DomainControllerError>;
51pub type DomainControllerLeaseMinFrequencyResult = Result<fidl::EventPair, DomainControllerError>;
52
53pub trait DomainControllerProxyInterface: Send + Sync {
54    type ListDomainsResponseFut: std::future::Future<Output = Result<Vec<DomainInfo>, fidl::Error>>
55        + Send;
56    fn r#list_domains(&self) -> Self::ListDomainsResponseFut;
57    type GetMaxFrequencyResponseFut: std::future::Future<Output = Result<DomainControllerGetMaxFrequencyResult, fidl::Error>>
58        + Send;
59    fn r#get_max_frequency(&self, domain_id: u64) -> Self::GetMaxFrequencyResponseFut;
60    type SetMaxFrequencyResponseFut: std::future::Future<Output = Result<DomainControllerSetMaxFrequencyResult, fidl::Error>>
61        + Send;
62    fn r#set_max_frequency(
63        &self,
64        domain_id: u64,
65        frequency_index: u64,
66    ) -> Self::SetMaxFrequencyResponseFut;
67    type ClearMaxFrequencyResponseFut: std::future::Future<Output = Result<DomainControllerClearMaxFrequencyResult, fidl::Error>>
68        + Send;
69    fn r#clear_max_frequency(&self, domain_id: u64) -> Self::ClearMaxFrequencyResponseFut;
70    type GetMinFrequencyResponseFut: std::future::Future<Output = Result<DomainControllerGetMinFrequencyResult, fidl::Error>>
71        + Send;
72    fn r#get_min_frequency(&self, domain_id: u64) -> Self::GetMinFrequencyResponseFut;
73    type LeaseMaxFrequencyResponseFut: std::future::Future<Output = Result<DomainControllerLeaseMaxFrequencyResult, fidl::Error>>
74        + Send;
75    fn r#lease_max_frequency(
76        &self,
77        domain_id: u64,
78        frequency_index: u64,
79        lease_name: &str,
80    ) -> Self::LeaseMaxFrequencyResponseFut;
81    type LeaseMinFrequencyResponseFut: std::future::Future<Output = Result<DomainControllerLeaseMinFrequencyResult, fidl::Error>>
82        + Send;
83    fn r#lease_min_frequency(
84        &self,
85        domain_id: u64,
86        frequency_index: u64,
87        lease_name: &str,
88    ) -> Self::LeaseMinFrequencyResponseFut;
89}
90#[derive(Debug)]
91#[cfg(target_os = "fuchsia")]
92pub struct DomainControllerSynchronousProxy {
93    client: fidl::client::sync::Client,
94}
95
96#[cfg(target_os = "fuchsia")]
97impl fidl::endpoints::SynchronousProxy for DomainControllerSynchronousProxy {
98    type Proxy = DomainControllerProxy;
99    type Protocol = DomainControllerMarker;
100
101    fn from_channel(inner: fidl::Channel) -> Self {
102        Self::new(inner)
103    }
104
105    fn into_channel(self) -> fidl::Channel {
106        self.client.into_channel()
107    }
108
109    fn as_channel(&self) -> &fidl::Channel {
110        self.client.as_channel()
111    }
112}
113
114#[cfg(target_os = "fuchsia")]
115impl DomainControllerSynchronousProxy {
116    pub fn new(channel: fidl::Channel) -> Self {
117        Self { client: fidl::client::sync::Client::new(channel) }
118    }
119
120    pub fn into_channel(self) -> fidl::Channel {
121        self.client.into_channel()
122    }
123
124    /// Waits until an event arrives and returns it. It is safe for other
125    /// threads to make concurrent requests while waiting for an event.
126    pub fn wait_for_event(
127        &self,
128        deadline: zx::MonotonicInstant,
129    ) -> Result<DomainControllerEvent, fidl::Error> {
130        DomainControllerEvent::decode(
131            self.client.wait_for_event::<DomainControllerMarker>(deadline)?,
132        )
133    }
134
135    /// Lists info about each domain managed by the server.
136    ///
137    /// The server is guaranteed to fill all fields within `DomainInfo` unless
138    /// the field is explicitly marked as "Optional".
139    pub fn r#list_domains(
140        &self,
141        ___deadline: zx::MonotonicInstant,
142    ) -> Result<Vec<DomainInfo>, fidl::Error> {
143        let _response = self.client.send_query::<
144            fidl::encoding::EmptyPayload,
145            fidl::encoding::FlexibleType<DomainControllerListDomainsResponse>,
146            DomainControllerMarker,
147        >(
148            (),
149            0x3dfa728011b3ee0c,
150            fidl::encoding::DynamicFlags::FLEXIBLE,
151            ___deadline,
152        )?
153        .into_result::<DomainControllerMarker>("list_domains")?;
154        Ok(_response.domains)
155    }
156
157    /// Gets the index of the max frequency the CPU can run at.
158    ///
159    /// `max_frequency_index` corresponds to the index of a frequency within
160    /// this domain's `available_frequencies_hz` list retrieved via
161    /// [`ListDomains`].
162    ///
163    /// If SetMaxFrequency or LeaseMaxFrequency has never been called, this will
164    /// return the index that corresponds to the highest available frequency for
165    /// this domain.
166    ///
167    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
168    pub fn r#get_max_frequency(
169        &self,
170        mut domain_id: u64,
171        ___deadline: zx::MonotonicInstant,
172    ) -> Result<DomainControllerGetMaxFrequencyResult, fidl::Error> {
173        let _response = self.client.send_query::<
174            DomainControllerGetMaxFrequencyRequest,
175            fidl::encoding::FlexibleResultType<DomainControllerGetMaxFrequencyResponse, DomainControllerError>,
176            DomainControllerMarker,
177        >(
178            (domain_id,),
179            0x6c8cc16cbd270f62,
180            fidl::encoding::DynamicFlags::FLEXIBLE,
181            ___deadline,
182        )?
183        .into_result::<DomainControllerMarker>("get_max_frequency")?;
184        Ok(_response.map(|x| x.max_frequency_index))
185    }
186
187    /// Sets the max frequency the CPU can run at.
188    ///
189    /// `frequency_index` must correspond to the index of a frequency within
190    /// this domain's `available_frequencies_hz` list retrieved via
191    /// [`ListDomains`].
192    ///
193    /// On products with Runtime Processor Power Management (RPPM), the CPU may
194    /// briefly exceed max frequency if power limits allow.
195    ///
196    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
197    /// If `frequency_index` is invalid, INVALID_ARGUMENTS is returned.
198    pub fn r#set_max_frequency(
199        &self,
200        mut domain_id: u64,
201        mut frequency_index: u64,
202        ___deadline: zx::MonotonicInstant,
203    ) -> Result<DomainControllerSetMaxFrequencyResult, fidl::Error> {
204        let _response = self.client.send_query::<
205            DomainControllerSetMaxFrequencyRequest,
206            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DomainControllerError>,
207            DomainControllerMarker,
208        >(
209            (domain_id, frequency_index,),
210            0x427d7a45e538939e,
211            fidl::encoding::DynamicFlags::FLEXIBLE,
212            ___deadline,
213        )?
214        .into_result::<DomainControllerMarker>("set_max_frequency")?;
215        Ok(_response.map(|x| x))
216    }
217
218    /// Clears the max frequency limit the CPU can run at.
219    ///
220    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
221    pub fn r#clear_max_frequency(
222        &self,
223        mut domain_id: u64,
224        ___deadline: zx::MonotonicInstant,
225    ) -> Result<DomainControllerClearMaxFrequencyResult, fidl::Error> {
226        let _response = self.client.send_query::<
227            DomainControllerClearMaxFrequencyRequest,
228            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DomainControllerError>,
229            DomainControllerMarker,
230        >(
231            (domain_id,),
232            0x738116a31e202ba5,
233            fidl::encoding::DynamicFlags::FLEXIBLE,
234            ___deadline,
235        )?
236        .into_result::<DomainControllerMarker>("clear_max_frequency")?;
237        Ok(_response.map(|x| x))
238    }
239
240    /// Gets the index of the min frequency the CPU can run at.
241    ///
242    /// `min_frequency_index` corresponds to the index of a frequency within
243    /// this domain's `available_frequencies_hz` list retrieved via
244    /// [`ListDomains`].
245    ///
246    /// If no floor lease is currently active, this will return the index that
247    /// corresponds to the lowest available frequency for this domain.
248    ///
249    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
250    pub fn r#get_min_frequency(
251        &self,
252        mut domain_id: u64,
253        ___deadline: zx::MonotonicInstant,
254    ) -> Result<DomainControllerGetMinFrequencyResult, fidl::Error> {
255        let _response = self.client.send_query::<
256            DomainControllerGetMinFrequencyRequest,
257            fidl::encoding::FlexibleResultType<DomainControllerGetMinFrequencyResponse, DomainControllerError>,
258            DomainControllerMarker,
259        >(
260            (domain_id,),
261            0x69f0bd89c925321c,
262            fidl::encoding::DynamicFlags::FLEXIBLE,
263            ___deadline,
264        )?
265        .into_result::<DomainControllerMarker>("get_min_frequency")?;
266        Ok(_response.map(|x| x.min_frequency_index))
267    }
268
269    /// Acquires a ceiling lease on `domain_id` capping its maximum operating
270    /// point at `frequency_index`.
271    ///
272    /// Multiple clients may hold concurrent ceiling leases on the same domain;
273    /// the server enforces the lowest maximum frequency (highest
274    /// `frequency_index`) across all active leases. Each call creates an
275    /// independent lease whose lifetime is governed solely by the returned
276    /// `lease_token` handle; closing all handles to `lease_token` releases the
277    /// lease.
278    ///
279    /// `lease_name` is a human-readable label for diagnostics and Inspect only
280    /// and is not required to be unique.
281    ///
282    /// If `domain_id` or `frequency_index` is invalid, INVALID_ARGUMENTS is
283    /// returned.
284    pub fn r#lease_max_frequency(
285        &self,
286        mut domain_id: u64,
287        mut frequency_index: u64,
288        mut lease_name: &str,
289        ___deadline: zx::MonotonicInstant,
290    ) -> Result<DomainControllerLeaseMaxFrequencyResult, fidl::Error> {
291        let _response = self.client.send_query::<
292            DomainControllerLeaseMaxFrequencyRequest,
293            fidl::encoding::FlexibleResultType<DomainControllerLeaseMaxFrequencyResponse, DomainControllerError>,
294            DomainControllerMarker,
295        >(
296            (domain_id, frequency_index, lease_name,),
297            0x5ea676204a21a276,
298            fidl::encoding::DynamicFlags::FLEXIBLE,
299            ___deadline,
300        )?
301        .into_result::<DomainControllerMarker>("lease_max_frequency")?;
302        Ok(_response.map(|x| x.lease_token))
303    }
304
305    /// Acquires a floor lease on `domain_id` raising its minimum operating
306    /// point to `frequency_index`.
307    ///
308    /// Multiple clients may hold concurrent floor leases on the same domain;
309    /// the server enforces the highest minimum frequency (lowest
310    /// `frequency_index`) across all active leases. Each call creates an
311    /// independent lease whose lifetime is governed solely by the returned
312    /// `lease_token` handle; closing all handles to `lease_token` releases the
313    /// lease.
314    ///
315    /// `lease_name` is a human-readable label for diagnostics and Inspect only
316    /// and is not required to be unique.
317    ///
318    /// If `domain_id` or `frequency_index` is invalid, INVALID_ARGUMENTS is
319    /// returned.
320    pub fn r#lease_min_frequency(
321        &self,
322        mut domain_id: u64,
323        mut frequency_index: u64,
324        mut lease_name: &str,
325        ___deadline: zx::MonotonicInstant,
326    ) -> Result<DomainControllerLeaseMinFrequencyResult, fidl::Error> {
327        let _response = self.client.send_query::<
328            DomainControllerLeaseMinFrequencyRequest,
329            fidl::encoding::FlexibleResultType<DomainControllerLeaseMinFrequencyResponse, DomainControllerError>,
330            DomainControllerMarker,
331        >(
332            (domain_id, frequency_index, lease_name,),
333            0x544abd141e121407,
334            fidl::encoding::DynamicFlags::FLEXIBLE,
335            ___deadline,
336        )?
337        .into_result::<DomainControllerMarker>("lease_min_frequency")?;
338        Ok(_response.map(|x| x.lease_token))
339    }
340}
341
342#[cfg(target_os = "fuchsia")]
343impl From<DomainControllerSynchronousProxy> for zx::NullableHandle {
344    fn from(value: DomainControllerSynchronousProxy) -> Self {
345        value.into_channel().into()
346    }
347}
348
349#[cfg(target_os = "fuchsia")]
350impl From<fidl::Channel> for DomainControllerSynchronousProxy {
351    fn from(value: fidl::Channel) -> Self {
352        Self::new(value)
353    }
354}
355
356#[cfg(target_os = "fuchsia")]
357impl fidl::endpoints::FromClient for DomainControllerSynchronousProxy {
358    type Protocol = DomainControllerMarker;
359
360    fn from_client(value: fidl::endpoints::ClientEnd<DomainControllerMarker>) -> Self {
361        Self::new(value.into_channel())
362    }
363}
364
365#[derive(Debug, Clone)]
366pub struct DomainControllerProxy {
367    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
368}
369
370impl fidl::endpoints::Proxy for DomainControllerProxy {
371    type Protocol = DomainControllerMarker;
372
373    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
374        Self::new(inner)
375    }
376
377    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
378        self.client.into_channel().map_err(|client| Self { client })
379    }
380
381    fn as_channel(&self) -> &::fidl::AsyncChannel {
382        self.client.as_channel()
383    }
384}
385
386impl DomainControllerProxy {
387    /// Create a new Proxy for fuchsia.power.cpu/DomainController.
388    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
389        let protocol_name = <DomainControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
390        Self { client: fidl::client::Client::new(channel, protocol_name) }
391    }
392
393    /// Get a Stream of events from the remote end of the protocol.
394    ///
395    /// # Panics
396    ///
397    /// Panics if the event stream was already taken.
398    pub fn take_event_stream(&self) -> DomainControllerEventStream {
399        DomainControllerEventStream { event_receiver: self.client.take_event_receiver() }
400    }
401
402    /// Lists info about each domain managed by the server.
403    ///
404    /// The server is guaranteed to fill all fields within `DomainInfo` unless
405    /// the field is explicitly marked as "Optional".
406    pub fn r#list_domains(
407        &self,
408    ) -> fidl::client::QueryResponseFut<
409        Vec<DomainInfo>,
410        fidl::encoding::DefaultFuchsiaResourceDialect,
411    > {
412        DomainControllerProxyInterface::r#list_domains(self)
413    }
414
415    /// Gets the index of the max frequency the CPU can run at.
416    ///
417    /// `max_frequency_index` corresponds to the index of a frequency within
418    /// this domain's `available_frequencies_hz` list retrieved via
419    /// [`ListDomains`].
420    ///
421    /// If SetMaxFrequency or LeaseMaxFrequency has never been called, this will
422    /// return the index that corresponds to the highest available frequency for
423    /// this domain.
424    ///
425    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
426    pub fn r#get_max_frequency(
427        &self,
428        mut domain_id: u64,
429    ) -> fidl::client::QueryResponseFut<
430        DomainControllerGetMaxFrequencyResult,
431        fidl::encoding::DefaultFuchsiaResourceDialect,
432    > {
433        DomainControllerProxyInterface::r#get_max_frequency(self, domain_id)
434    }
435
436    /// Sets the max frequency the CPU can run at.
437    ///
438    /// `frequency_index` must correspond to the index of a frequency within
439    /// this domain's `available_frequencies_hz` list retrieved via
440    /// [`ListDomains`].
441    ///
442    /// On products with Runtime Processor Power Management (RPPM), the CPU may
443    /// briefly exceed max frequency if power limits allow.
444    ///
445    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
446    /// If `frequency_index` is invalid, INVALID_ARGUMENTS is returned.
447    pub fn r#set_max_frequency(
448        &self,
449        mut domain_id: u64,
450        mut frequency_index: u64,
451    ) -> fidl::client::QueryResponseFut<
452        DomainControllerSetMaxFrequencyResult,
453        fidl::encoding::DefaultFuchsiaResourceDialect,
454    > {
455        DomainControllerProxyInterface::r#set_max_frequency(self, domain_id, frequency_index)
456    }
457
458    /// Clears the max frequency limit the CPU can run at.
459    ///
460    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
461    pub fn r#clear_max_frequency(
462        &self,
463        mut domain_id: u64,
464    ) -> fidl::client::QueryResponseFut<
465        DomainControllerClearMaxFrequencyResult,
466        fidl::encoding::DefaultFuchsiaResourceDialect,
467    > {
468        DomainControllerProxyInterface::r#clear_max_frequency(self, domain_id)
469    }
470
471    /// Gets the index of the min frequency the CPU can run at.
472    ///
473    /// `min_frequency_index` corresponds to the index of a frequency within
474    /// this domain's `available_frequencies_hz` list retrieved via
475    /// [`ListDomains`].
476    ///
477    /// If no floor lease is currently active, this will return the index that
478    /// corresponds to the lowest available frequency for this domain.
479    ///
480    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
481    pub fn r#get_min_frequency(
482        &self,
483        mut domain_id: u64,
484    ) -> fidl::client::QueryResponseFut<
485        DomainControllerGetMinFrequencyResult,
486        fidl::encoding::DefaultFuchsiaResourceDialect,
487    > {
488        DomainControllerProxyInterface::r#get_min_frequency(self, domain_id)
489    }
490
491    /// Acquires a ceiling lease on `domain_id` capping its maximum operating
492    /// point at `frequency_index`.
493    ///
494    /// Multiple clients may hold concurrent ceiling leases on the same domain;
495    /// the server enforces the lowest maximum frequency (highest
496    /// `frequency_index`) across all active leases. Each call creates an
497    /// independent lease whose lifetime is governed solely by the returned
498    /// `lease_token` handle; closing all handles to `lease_token` releases the
499    /// lease.
500    ///
501    /// `lease_name` is a human-readable label for diagnostics and Inspect only
502    /// and is not required to be unique.
503    ///
504    /// If `domain_id` or `frequency_index` is invalid, INVALID_ARGUMENTS is
505    /// returned.
506    pub fn r#lease_max_frequency(
507        &self,
508        mut domain_id: u64,
509        mut frequency_index: u64,
510        mut lease_name: &str,
511    ) -> fidl::client::QueryResponseFut<
512        DomainControllerLeaseMaxFrequencyResult,
513        fidl::encoding::DefaultFuchsiaResourceDialect,
514    > {
515        DomainControllerProxyInterface::r#lease_max_frequency(
516            self,
517            domain_id,
518            frequency_index,
519            lease_name,
520        )
521    }
522
523    /// Acquires a floor lease on `domain_id` raising its minimum operating
524    /// point to `frequency_index`.
525    ///
526    /// Multiple clients may hold concurrent floor leases on the same domain;
527    /// the server enforces the highest minimum frequency (lowest
528    /// `frequency_index`) across all active leases. Each call creates an
529    /// independent lease whose lifetime is governed solely by the returned
530    /// `lease_token` handle; closing all handles to `lease_token` releases the
531    /// lease.
532    ///
533    /// `lease_name` is a human-readable label for diagnostics and Inspect only
534    /// and is not required to be unique.
535    ///
536    /// If `domain_id` or `frequency_index` is invalid, INVALID_ARGUMENTS is
537    /// returned.
538    pub fn r#lease_min_frequency(
539        &self,
540        mut domain_id: u64,
541        mut frequency_index: u64,
542        mut lease_name: &str,
543    ) -> fidl::client::QueryResponseFut<
544        DomainControllerLeaseMinFrequencyResult,
545        fidl::encoding::DefaultFuchsiaResourceDialect,
546    > {
547        DomainControllerProxyInterface::r#lease_min_frequency(
548            self,
549            domain_id,
550            frequency_index,
551            lease_name,
552        )
553    }
554}
555
556impl DomainControllerProxyInterface for DomainControllerProxy {
557    type ListDomainsResponseFut = fidl::client::QueryResponseFut<
558        Vec<DomainInfo>,
559        fidl::encoding::DefaultFuchsiaResourceDialect,
560    >;
561    fn r#list_domains(&self) -> Self::ListDomainsResponseFut {
562        fn _decode(
563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
564        ) -> Result<Vec<DomainInfo>, fidl::Error> {
565            let _response = fidl::client::decode_transaction_body::<
566                fidl::encoding::FlexibleType<DomainControllerListDomainsResponse>,
567                fidl::encoding::DefaultFuchsiaResourceDialect,
568                0x3dfa728011b3ee0c,
569            >(_buf?)?
570            .into_result::<DomainControllerMarker>("list_domains")?;
571            Ok(_response.domains)
572        }
573        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<DomainInfo>>(
574            (),
575            0x3dfa728011b3ee0c,
576            fidl::encoding::DynamicFlags::FLEXIBLE,
577            _decode,
578        )
579    }
580
581    type GetMaxFrequencyResponseFut = fidl::client::QueryResponseFut<
582        DomainControllerGetMaxFrequencyResult,
583        fidl::encoding::DefaultFuchsiaResourceDialect,
584    >;
585    fn r#get_max_frequency(&self, mut domain_id: u64) -> Self::GetMaxFrequencyResponseFut {
586        fn _decode(
587            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
588        ) -> Result<DomainControllerGetMaxFrequencyResult, fidl::Error> {
589            let _response = fidl::client::decode_transaction_body::<
590                fidl::encoding::FlexibleResultType<
591                    DomainControllerGetMaxFrequencyResponse,
592                    DomainControllerError,
593                >,
594                fidl::encoding::DefaultFuchsiaResourceDialect,
595                0x6c8cc16cbd270f62,
596            >(_buf?)?
597            .into_result::<DomainControllerMarker>("get_max_frequency")?;
598            Ok(_response.map(|x| x.max_frequency_index))
599        }
600        self.client.send_query_and_decode::<
601            DomainControllerGetMaxFrequencyRequest,
602            DomainControllerGetMaxFrequencyResult,
603        >(
604            (domain_id,),
605            0x6c8cc16cbd270f62,
606            fidl::encoding::DynamicFlags::FLEXIBLE,
607            _decode,
608        )
609    }
610
611    type SetMaxFrequencyResponseFut = fidl::client::QueryResponseFut<
612        DomainControllerSetMaxFrequencyResult,
613        fidl::encoding::DefaultFuchsiaResourceDialect,
614    >;
615    fn r#set_max_frequency(
616        &self,
617        mut domain_id: u64,
618        mut frequency_index: u64,
619    ) -> Self::SetMaxFrequencyResponseFut {
620        fn _decode(
621            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
622        ) -> Result<DomainControllerSetMaxFrequencyResult, fidl::Error> {
623            let _response = fidl::client::decode_transaction_body::<
624                fidl::encoding::FlexibleResultType<
625                    fidl::encoding::EmptyStruct,
626                    DomainControllerError,
627                >,
628                fidl::encoding::DefaultFuchsiaResourceDialect,
629                0x427d7a45e538939e,
630            >(_buf?)?
631            .into_result::<DomainControllerMarker>("set_max_frequency")?;
632            Ok(_response.map(|x| x))
633        }
634        self.client.send_query_and_decode::<
635            DomainControllerSetMaxFrequencyRequest,
636            DomainControllerSetMaxFrequencyResult,
637        >(
638            (domain_id, frequency_index,),
639            0x427d7a45e538939e,
640            fidl::encoding::DynamicFlags::FLEXIBLE,
641            _decode,
642        )
643    }
644
645    type ClearMaxFrequencyResponseFut = fidl::client::QueryResponseFut<
646        DomainControllerClearMaxFrequencyResult,
647        fidl::encoding::DefaultFuchsiaResourceDialect,
648    >;
649    fn r#clear_max_frequency(&self, mut domain_id: u64) -> Self::ClearMaxFrequencyResponseFut {
650        fn _decode(
651            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
652        ) -> Result<DomainControllerClearMaxFrequencyResult, fidl::Error> {
653            let _response = fidl::client::decode_transaction_body::<
654                fidl::encoding::FlexibleResultType<
655                    fidl::encoding::EmptyStruct,
656                    DomainControllerError,
657                >,
658                fidl::encoding::DefaultFuchsiaResourceDialect,
659                0x738116a31e202ba5,
660            >(_buf?)?
661            .into_result::<DomainControllerMarker>("clear_max_frequency")?;
662            Ok(_response.map(|x| x))
663        }
664        self.client.send_query_and_decode::<
665            DomainControllerClearMaxFrequencyRequest,
666            DomainControllerClearMaxFrequencyResult,
667        >(
668            (domain_id,),
669            0x738116a31e202ba5,
670            fidl::encoding::DynamicFlags::FLEXIBLE,
671            _decode,
672        )
673    }
674
675    type GetMinFrequencyResponseFut = fidl::client::QueryResponseFut<
676        DomainControllerGetMinFrequencyResult,
677        fidl::encoding::DefaultFuchsiaResourceDialect,
678    >;
679    fn r#get_min_frequency(&self, mut domain_id: u64) -> Self::GetMinFrequencyResponseFut {
680        fn _decode(
681            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
682        ) -> Result<DomainControllerGetMinFrequencyResult, fidl::Error> {
683            let _response = fidl::client::decode_transaction_body::<
684                fidl::encoding::FlexibleResultType<
685                    DomainControllerGetMinFrequencyResponse,
686                    DomainControllerError,
687                >,
688                fidl::encoding::DefaultFuchsiaResourceDialect,
689                0x69f0bd89c925321c,
690            >(_buf?)?
691            .into_result::<DomainControllerMarker>("get_min_frequency")?;
692            Ok(_response.map(|x| x.min_frequency_index))
693        }
694        self.client.send_query_and_decode::<
695            DomainControllerGetMinFrequencyRequest,
696            DomainControllerGetMinFrequencyResult,
697        >(
698            (domain_id,),
699            0x69f0bd89c925321c,
700            fidl::encoding::DynamicFlags::FLEXIBLE,
701            _decode,
702        )
703    }
704
705    type LeaseMaxFrequencyResponseFut = fidl::client::QueryResponseFut<
706        DomainControllerLeaseMaxFrequencyResult,
707        fidl::encoding::DefaultFuchsiaResourceDialect,
708    >;
709    fn r#lease_max_frequency(
710        &self,
711        mut domain_id: u64,
712        mut frequency_index: u64,
713        mut lease_name: &str,
714    ) -> Self::LeaseMaxFrequencyResponseFut {
715        fn _decode(
716            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
717        ) -> Result<DomainControllerLeaseMaxFrequencyResult, fidl::Error> {
718            let _response = fidl::client::decode_transaction_body::<
719                fidl::encoding::FlexibleResultType<
720                    DomainControllerLeaseMaxFrequencyResponse,
721                    DomainControllerError,
722                >,
723                fidl::encoding::DefaultFuchsiaResourceDialect,
724                0x5ea676204a21a276,
725            >(_buf?)?
726            .into_result::<DomainControllerMarker>("lease_max_frequency")?;
727            Ok(_response.map(|x| x.lease_token))
728        }
729        self.client.send_query_and_decode::<
730            DomainControllerLeaseMaxFrequencyRequest,
731            DomainControllerLeaseMaxFrequencyResult,
732        >(
733            (domain_id, frequency_index, lease_name,),
734            0x5ea676204a21a276,
735            fidl::encoding::DynamicFlags::FLEXIBLE,
736            _decode,
737        )
738    }
739
740    type LeaseMinFrequencyResponseFut = fidl::client::QueryResponseFut<
741        DomainControllerLeaseMinFrequencyResult,
742        fidl::encoding::DefaultFuchsiaResourceDialect,
743    >;
744    fn r#lease_min_frequency(
745        &self,
746        mut domain_id: u64,
747        mut frequency_index: u64,
748        mut lease_name: &str,
749    ) -> Self::LeaseMinFrequencyResponseFut {
750        fn _decode(
751            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
752        ) -> Result<DomainControllerLeaseMinFrequencyResult, fidl::Error> {
753            let _response = fidl::client::decode_transaction_body::<
754                fidl::encoding::FlexibleResultType<
755                    DomainControllerLeaseMinFrequencyResponse,
756                    DomainControllerError,
757                >,
758                fidl::encoding::DefaultFuchsiaResourceDialect,
759                0x544abd141e121407,
760            >(_buf?)?
761            .into_result::<DomainControllerMarker>("lease_min_frequency")?;
762            Ok(_response.map(|x| x.lease_token))
763        }
764        self.client.send_query_and_decode::<
765            DomainControllerLeaseMinFrequencyRequest,
766            DomainControllerLeaseMinFrequencyResult,
767        >(
768            (domain_id, frequency_index, lease_name,),
769            0x544abd141e121407,
770            fidl::encoding::DynamicFlags::FLEXIBLE,
771            _decode,
772        )
773    }
774}
775
776pub struct DomainControllerEventStream {
777    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
778}
779
780impl std::marker::Unpin for DomainControllerEventStream {}
781
782impl futures::stream::FusedStream for DomainControllerEventStream {
783    fn is_terminated(&self) -> bool {
784        self.event_receiver.is_terminated()
785    }
786}
787
788impl futures::Stream for DomainControllerEventStream {
789    type Item = Result<DomainControllerEvent, fidl::Error>;
790
791    fn poll_next(
792        mut self: std::pin::Pin<&mut Self>,
793        cx: &mut std::task::Context<'_>,
794    ) -> std::task::Poll<Option<Self::Item>> {
795        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
796            &mut self.event_receiver,
797            cx
798        )?) {
799            Some(buf) => std::task::Poll::Ready(Some(DomainControllerEvent::decode(buf))),
800            None => std::task::Poll::Ready(None),
801        }
802    }
803}
804
805#[derive(Debug)]
806pub enum DomainControllerEvent {
807    #[non_exhaustive]
808    _UnknownEvent {
809        /// Ordinal of the event that was sent.
810        ordinal: u64,
811    },
812}
813
814impl DomainControllerEvent {
815    /// Decodes a message buffer as a [`DomainControllerEvent`].
816    fn decode(
817        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
818    ) -> Result<DomainControllerEvent, fidl::Error> {
819        let (bytes, _handles) = buf.split_mut();
820        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
821        debug_assert_eq!(tx_header.tx_id, 0);
822        match tx_header.ordinal {
823            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
824                Ok(DomainControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
825            }
826            _ => Err(fidl::Error::UnknownOrdinal {
827                ordinal: tx_header.ordinal,
828                protocol_name:
829                    <DomainControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
830            }),
831        }
832    }
833}
834
835/// A Stream of incoming requests for fuchsia.power.cpu/DomainController.
836pub struct DomainControllerRequestStream {
837    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
838    is_terminated: bool,
839}
840
841impl std::marker::Unpin for DomainControllerRequestStream {}
842
843impl futures::stream::FusedStream for DomainControllerRequestStream {
844    fn is_terminated(&self) -> bool {
845        self.is_terminated
846    }
847}
848
849impl fidl::endpoints::RequestStream for DomainControllerRequestStream {
850    type Protocol = DomainControllerMarker;
851    type ControlHandle = DomainControllerControlHandle;
852
853    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
854        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
855    }
856
857    fn control_handle(&self) -> Self::ControlHandle {
858        DomainControllerControlHandle { inner: self.inner.clone() }
859    }
860
861    fn into_inner(
862        self,
863    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
864    {
865        (self.inner, self.is_terminated)
866    }
867
868    fn from_inner(
869        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
870        is_terminated: bool,
871    ) -> Self {
872        Self { inner, is_terminated }
873    }
874}
875
876impl futures::Stream for DomainControllerRequestStream {
877    type Item = Result<DomainControllerRequest, fidl::Error>;
878
879    fn poll_next(
880        mut self: std::pin::Pin<&mut Self>,
881        cx: &mut std::task::Context<'_>,
882    ) -> std::task::Poll<Option<Self::Item>> {
883        let this = &mut *self;
884        if this.inner.check_shutdown(cx) {
885            this.is_terminated = true;
886            return std::task::Poll::Ready(None);
887        }
888        if this.is_terminated {
889            panic!("polled DomainControllerRequestStream after completion");
890        }
891        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
892            |bytes, handles| {
893                match this.inner.channel().read_etc(cx, bytes, handles) {
894                    std::task::Poll::Ready(Ok(())) => {}
895                    std::task::Poll::Pending => return std::task::Poll::Pending,
896                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
897                        this.is_terminated = true;
898                        return std::task::Poll::Ready(None);
899                    }
900                    std::task::Poll::Ready(Err(e)) => {
901                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
902                            e.into(),
903                        ))));
904                    }
905                }
906
907                // A message has been received from the channel
908                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
909
910                std::task::Poll::Ready(Some(match header.ordinal {
911                    0x3dfa728011b3ee0c => {
912                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
913                        let mut req = fidl::new_empty!(
914                            fidl::encoding::EmptyPayload,
915                            fidl::encoding::DefaultFuchsiaResourceDialect
916                        );
917                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
918                        let control_handle =
919                            DomainControllerControlHandle { inner: this.inner.clone() };
920                        Ok(DomainControllerRequest::ListDomains {
921                            responder: DomainControllerListDomainsResponder {
922                                control_handle: std::mem::ManuallyDrop::new(control_handle),
923                                tx_id: header.tx_id,
924                            },
925                        })
926                    }
927                    0x6c8cc16cbd270f62 => {
928                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
929                        let mut req = fidl::new_empty!(
930                            DomainControllerGetMaxFrequencyRequest,
931                            fidl::encoding::DefaultFuchsiaResourceDialect
932                        );
933                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DomainControllerGetMaxFrequencyRequest>(&header, _body_bytes, handles, &mut req)?;
934                        let control_handle =
935                            DomainControllerControlHandle { inner: this.inner.clone() };
936                        Ok(DomainControllerRequest::GetMaxFrequency {
937                            domain_id: req.domain_id,
938
939                            responder: DomainControllerGetMaxFrequencyResponder {
940                                control_handle: std::mem::ManuallyDrop::new(control_handle),
941                                tx_id: header.tx_id,
942                            },
943                        })
944                    }
945                    0x427d7a45e538939e => {
946                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
947                        let mut req = fidl::new_empty!(
948                            DomainControllerSetMaxFrequencyRequest,
949                            fidl::encoding::DefaultFuchsiaResourceDialect
950                        );
951                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DomainControllerSetMaxFrequencyRequest>(&header, _body_bytes, handles, &mut req)?;
952                        let control_handle =
953                            DomainControllerControlHandle { inner: this.inner.clone() };
954                        Ok(DomainControllerRequest::SetMaxFrequency {
955                            domain_id: req.domain_id,
956                            frequency_index: req.frequency_index,
957
958                            responder: DomainControllerSetMaxFrequencyResponder {
959                                control_handle: std::mem::ManuallyDrop::new(control_handle),
960                                tx_id: header.tx_id,
961                            },
962                        })
963                    }
964                    0x738116a31e202ba5 => {
965                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
966                        let mut req = fidl::new_empty!(
967                            DomainControllerClearMaxFrequencyRequest,
968                            fidl::encoding::DefaultFuchsiaResourceDialect
969                        );
970                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DomainControllerClearMaxFrequencyRequest>(&header, _body_bytes, handles, &mut req)?;
971                        let control_handle =
972                            DomainControllerControlHandle { inner: this.inner.clone() };
973                        Ok(DomainControllerRequest::ClearMaxFrequency {
974                            domain_id: req.domain_id,
975
976                            responder: DomainControllerClearMaxFrequencyResponder {
977                                control_handle: std::mem::ManuallyDrop::new(control_handle),
978                                tx_id: header.tx_id,
979                            },
980                        })
981                    }
982                    0x69f0bd89c925321c => {
983                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
984                        let mut req = fidl::new_empty!(
985                            DomainControllerGetMinFrequencyRequest,
986                            fidl::encoding::DefaultFuchsiaResourceDialect
987                        );
988                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DomainControllerGetMinFrequencyRequest>(&header, _body_bytes, handles, &mut req)?;
989                        let control_handle =
990                            DomainControllerControlHandle { inner: this.inner.clone() };
991                        Ok(DomainControllerRequest::GetMinFrequency {
992                            domain_id: req.domain_id,
993
994                            responder: DomainControllerGetMinFrequencyResponder {
995                                control_handle: std::mem::ManuallyDrop::new(control_handle),
996                                tx_id: header.tx_id,
997                            },
998                        })
999                    }
1000                    0x5ea676204a21a276 => {
1001                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1002                        let mut req = fidl::new_empty!(
1003                            DomainControllerLeaseMaxFrequencyRequest,
1004                            fidl::encoding::DefaultFuchsiaResourceDialect
1005                        );
1006                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DomainControllerLeaseMaxFrequencyRequest>(&header, _body_bytes, handles, &mut req)?;
1007                        let control_handle =
1008                            DomainControllerControlHandle { inner: this.inner.clone() };
1009                        Ok(DomainControllerRequest::LeaseMaxFrequency {
1010                            domain_id: req.domain_id,
1011                            frequency_index: req.frequency_index,
1012                            lease_name: req.lease_name,
1013
1014                            responder: DomainControllerLeaseMaxFrequencyResponder {
1015                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1016                                tx_id: header.tx_id,
1017                            },
1018                        })
1019                    }
1020                    0x544abd141e121407 => {
1021                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1022                        let mut req = fidl::new_empty!(
1023                            DomainControllerLeaseMinFrequencyRequest,
1024                            fidl::encoding::DefaultFuchsiaResourceDialect
1025                        );
1026                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DomainControllerLeaseMinFrequencyRequest>(&header, _body_bytes, handles, &mut req)?;
1027                        let control_handle =
1028                            DomainControllerControlHandle { inner: this.inner.clone() };
1029                        Ok(DomainControllerRequest::LeaseMinFrequency {
1030                            domain_id: req.domain_id,
1031                            frequency_index: req.frequency_index,
1032                            lease_name: req.lease_name,
1033
1034                            responder: DomainControllerLeaseMinFrequencyResponder {
1035                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1036                                tx_id: header.tx_id,
1037                            },
1038                        })
1039                    }
1040                    _ if header.tx_id == 0
1041                        && header
1042                            .dynamic_flags()
1043                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1044                    {
1045                        Ok(DomainControllerRequest::_UnknownMethod {
1046                            ordinal: header.ordinal,
1047                            control_handle: DomainControllerControlHandle {
1048                                inner: this.inner.clone(),
1049                            },
1050                            method_type: fidl::MethodType::OneWay,
1051                        })
1052                    }
1053                    _ if header
1054                        .dynamic_flags()
1055                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1056                    {
1057                        this.inner.send_framework_err(
1058                            fidl::encoding::FrameworkErr::UnknownMethod,
1059                            header.tx_id,
1060                            header.ordinal,
1061                            header.dynamic_flags(),
1062                            (bytes, handles),
1063                        )?;
1064                        Ok(DomainControllerRequest::_UnknownMethod {
1065                            ordinal: header.ordinal,
1066                            control_handle: DomainControllerControlHandle {
1067                                inner: this.inner.clone(),
1068                            },
1069                            method_type: fidl::MethodType::TwoWay,
1070                        })
1071                    }
1072                    _ => Err(fidl::Error::UnknownOrdinal {
1073                        ordinal: header.ordinal,
1074                        protocol_name:
1075                            <DomainControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1076                    }),
1077                }))
1078            },
1079        )
1080    }
1081}
1082
1083#[derive(Debug)]
1084pub enum DomainControllerRequest {
1085    /// Lists info about each domain managed by the server.
1086    ///
1087    /// The server is guaranteed to fill all fields within `DomainInfo` unless
1088    /// the field is explicitly marked as "Optional".
1089    ListDomains { responder: DomainControllerListDomainsResponder },
1090    /// Gets the index of the max frequency the CPU can run at.
1091    ///
1092    /// `max_frequency_index` corresponds to the index of a frequency within
1093    /// this domain's `available_frequencies_hz` list retrieved via
1094    /// [`ListDomains`].
1095    ///
1096    /// If SetMaxFrequency or LeaseMaxFrequency has never been called, this will
1097    /// return the index that corresponds to the highest available frequency for
1098    /// this domain.
1099    ///
1100    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
1101    GetMaxFrequency { domain_id: u64, responder: DomainControllerGetMaxFrequencyResponder },
1102    /// Sets the max frequency the CPU can run at.
1103    ///
1104    /// `frequency_index` must correspond to the index of a frequency within
1105    /// this domain's `available_frequencies_hz` list retrieved via
1106    /// [`ListDomains`].
1107    ///
1108    /// On products with Runtime Processor Power Management (RPPM), the CPU may
1109    /// briefly exceed max frequency if power limits allow.
1110    ///
1111    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
1112    /// If `frequency_index` is invalid, INVALID_ARGUMENTS is returned.
1113    SetMaxFrequency {
1114        domain_id: u64,
1115        frequency_index: u64,
1116        responder: DomainControllerSetMaxFrequencyResponder,
1117    },
1118    /// Clears the max frequency limit the CPU can run at.
1119    ///
1120    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
1121    ClearMaxFrequency { domain_id: u64, responder: DomainControllerClearMaxFrequencyResponder },
1122    /// Gets the index of the min frequency the CPU can run at.
1123    ///
1124    /// `min_frequency_index` corresponds to the index of a frequency within
1125    /// this domain's `available_frequencies_hz` list retrieved via
1126    /// [`ListDomains`].
1127    ///
1128    /// If no floor lease is currently active, this will return the index that
1129    /// corresponds to the lowest available frequency for this domain.
1130    ///
1131    /// If `domain_id` is invalid, INVALID_ARGUMENTS is returned.
1132    GetMinFrequency { domain_id: u64, responder: DomainControllerGetMinFrequencyResponder },
1133    /// Acquires a ceiling lease on `domain_id` capping its maximum operating
1134    /// point at `frequency_index`.
1135    ///
1136    /// Multiple clients may hold concurrent ceiling leases on the same domain;
1137    /// the server enforces the lowest maximum frequency (highest
1138    /// `frequency_index`) across all active leases. Each call creates an
1139    /// independent lease whose lifetime is governed solely by the returned
1140    /// `lease_token` handle; closing all handles to `lease_token` releases the
1141    /// lease.
1142    ///
1143    /// `lease_name` is a human-readable label for diagnostics and Inspect only
1144    /// and is not required to be unique.
1145    ///
1146    /// If `domain_id` or `frequency_index` is invalid, INVALID_ARGUMENTS is
1147    /// returned.
1148    LeaseMaxFrequency {
1149        domain_id: u64,
1150        frequency_index: u64,
1151        lease_name: String,
1152        responder: DomainControllerLeaseMaxFrequencyResponder,
1153    },
1154    /// Acquires a floor lease on `domain_id` raising its minimum operating
1155    /// point to `frequency_index`.
1156    ///
1157    /// Multiple clients may hold concurrent floor leases on the same domain;
1158    /// the server enforces the highest minimum frequency (lowest
1159    /// `frequency_index`) across all active leases. Each call creates an
1160    /// independent lease whose lifetime is governed solely by the returned
1161    /// `lease_token` handle; closing all handles to `lease_token` releases the
1162    /// lease.
1163    ///
1164    /// `lease_name` is a human-readable label for diagnostics and Inspect only
1165    /// and is not required to be unique.
1166    ///
1167    /// If `domain_id` or `frequency_index` is invalid, INVALID_ARGUMENTS is
1168    /// returned.
1169    LeaseMinFrequency {
1170        domain_id: u64,
1171        frequency_index: u64,
1172        lease_name: String,
1173        responder: DomainControllerLeaseMinFrequencyResponder,
1174    },
1175    /// An interaction was received which does not match any known method.
1176    #[non_exhaustive]
1177    _UnknownMethod {
1178        /// Ordinal of the method that was called.
1179        ordinal: u64,
1180        control_handle: DomainControllerControlHandle,
1181        method_type: fidl::MethodType,
1182    },
1183}
1184
1185impl DomainControllerRequest {
1186    #[allow(irrefutable_let_patterns)]
1187    pub fn into_list_domains(self) -> Option<(DomainControllerListDomainsResponder)> {
1188        if let DomainControllerRequest::ListDomains { responder } = self {
1189            Some((responder))
1190        } else {
1191            None
1192        }
1193    }
1194
1195    #[allow(irrefutable_let_patterns)]
1196    pub fn into_get_max_frequency(self) -> Option<(u64, DomainControllerGetMaxFrequencyResponder)> {
1197        if let DomainControllerRequest::GetMaxFrequency { domain_id, responder } = self {
1198            Some((domain_id, responder))
1199        } else {
1200            None
1201        }
1202    }
1203
1204    #[allow(irrefutable_let_patterns)]
1205    pub fn into_set_max_frequency(
1206        self,
1207    ) -> Option<(u64, u64, DomainControllerSetMaxFrequencyResponder)> {
1208        if let DomainControllerRequest::SetMaxFrequency { domain_id, frequency_index, responder } =
1209            self
1210        {
1211            Some((domain_id, frequency_index, responder))
1212        } else {
1213            None
1214        }
1215    }
1216
1217    #[allow(irrefutable_let_patterns)]
1218    pub fn into_clear_max_frequency(
1219        self,
1220    ) -> Option<(u64, DomainControllerClearMaxFrequencyResponder)> {
1221        if let DomainControllerRequest::ClearMaxFrequency { domain_id, responder } = self {
1222            Some((domain_id, responder))
1223        } else {
1224            None
1225        }
1226    }
1227
1228    #[allow(irrefutable_let_patterns)]
1229    pub fn into_get_min_frequency(self) -> Option<(u64, DomainControllerGetMinFrequencyResponder)> {
1230        if let DomainControllerRequest::GetMinFrequency { domain_id, responder } = self {
1231            Some((domain_id, responder))
1232        } else {
1233            None
1234        }
1235    }
1236
1237    #[allow(irrefutable_let_patterns)]
1238    pub fn into_lease_max_frequency(
1239        self,
1240    ) -> Option<(u64, u64, String, DomainControllerLeaseMaxFrequencyResponder)> {
1241        if let DomainControllerRequest::LeaseMaxFrequency {
1242            domain_id,
1243            frequency_index,
1244            lease_name,
1245            responder,
1246        } = self
1247        {
1248            Some((domain_id, frequency_index, lease_name, responder))
1249        } else {
1250            None
1251        }
1252    }
1253
1254    #[allow(irrefutable_let_patterns)]
1255    pub fn into_lease_min_frequency(
1256        self,
1257    ) -> Option<(u64, u64, String, DomainControllerLeaseMinFrequencyResponder)> {
1258        if let DomainControllerRequest::LeaseMinFrequency {
1259            domain_id,
1260            frequency_index,
1261            lease_name,
1262            responder,
1263        } = self
1264        {
1265            Some((domain_id, frequency_index, lease_name, responder))
1266        } else {
1267            None
1268        }
1269    }
1270
1271    /// Name of the method defined in FIDL
1272    pub fn method_name(&self) -> &'static str {
1273        match *self {
1274            DomainControllerRequest::ListDomains { .. } => "list_domains",
1275            DomainControllerRequest::GetMaxFrequency { .. } => "get_max_frequency",
1276            DomainControllerRequest::SetMaxFrequency { .. } => "set_max_frequency",
1277            DomainControllerRequest::ClearMaxFrequency { .. } => "clear_max_frequency",
1278            DomainControllerRequest::GetMinFrequency { .. } => "get_min_frequency",
1279            DomainControllerRequest::LeaseMaxFrequency { .. } => "lease_max_frequency",
1280            DomainControllerRequest::LeaseMinFrequency { .. } => "lease_min_frequency",
1281            DomainControllerRequest::_UnknownMethod {
1282                method_type: fidl::MethodType::OneWay,
1283                ..
1284            } => "unknown one-way method",
1285            DomainControllerRequest::_UnknownMethod {
1286                method_type: fidl::MethodType::TwoWay,
1287                ..
1288            } => "unknown two-way method",
1289        }
1290    }
1291}
1292
1293#[derive(Debug, Clone)]
1294pub struct DomainControllerControlHandle {
1295    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1296}
1297
1298impl DomainControllerControlHandle {
1299    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1300        self.inner.shutdown_with_epitaph(status.into())
1301    }
1302}
1303
1304impl fidl::endpoints::ControlHandle for DomainControllerControlHandle {
1305    fn shutdown(&self) {
1306        self.inner.shutdown()
1307    }
1308
1309    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1310        self.inner.shutdown_with_epitaph(status)
1311    }
1312
1313    fn is_closed(&self) -> bool {
1314        self.inner.channel().is_closed()
1315    }
1316    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1317        self.inner.channel().on_closed()
1318    }
1319
1320    #[cfg(target_os = "fuchsia")]
1321    fn signal_peer(
1322        &self,
1323        clear_mask: zx::Signals,
1324        set_mask: zx::Signals,
1325    ) -> Result<(), zx_status::Status> {
1326        use fidl::Peered;
1327        self.inner.channel().signal_peer(clear_mask, set_mask)
1328    }
1329}
1330
1331impl DomainControllerControlHandle {}
1332
1333#[must_use = "FIDL methods require a response to be sent"]
1334#[derive(Debug)]
1335pub struct DomainControllerListDomainsResponder {
1336    control_handle: std::mem::ManuallyDrop<DomainControllerControlHandle>,
1337    tx_id: u32,
1338}
1339
1340/// Set the the channel to be shutdown (see [`DomainControllerControlHandle::shutdown`])
1341/// if the responder is dropped without sending a response, so that the client
1342/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1343impl std::ops::Drop for DomainControllerListDomainsResponder {
1344    fn drop(&mut self) {
1345        self.control_handle.shutdown();
1346        // Safety: drops once, never accessed again
1347        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1348    }
1349}
1350
1351impl fidl::endpoints::Responder for DomainControllerListDomainsResponder {
1352    type ControlHandle = DomainControllerControlHandle;
1353
1354    fn control_handle(&self) -> &DomainControllerControlHandle {
1355        &self.control_handle
1356    }
1357
1358    fn drop_without_shutdown(mut self) {
1359        // Safety: drops once, never accessed again due to mem::forget
1360        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1361        // Prevent Drop from running (which would shut down the channel)
1362        std::mem::forget(self);
1363    }
1364}
1365
1366impl DomainControllerListDomainsResponder {
1367    /// Sends a response to the FIDL transaction.
1368    ///
1369    /// Sets the channel to shutdown if an error occurs.
1370    pub fn send(self, mut domains: &[DomainInfo]) -> Result<(), fidl::Error> {
1371        let _result = self.send_raw(domains);
1372        if _result.is_err() {
1373            self.control_handle.shutdown();
1374        }
1375        self.drop_without_shutdown();
1376        _result
1377    }
1378
1379    /// Similar to "send" but does not shutdown the channel if an error occurs.
1380    pub fn send_no_shutdown_on_err(self, mut domains: &[DomainInfo]) -> Result<(), fidl::Error> {
1381        let _result = self.send_raw(domains);
1382        self.drop_without_shutdown();
1383        _result
1384    }
1385
1386    fn send_raw(&self, mut domains: &[DomainInfo]) -> Result<(), fidl::Error> {
1387        self.control_handle
1388            .inner
1389            .send::<fidl::encoding::FlexibleType<DomainControllerListDomainsResponse>>(
1390                fidl::encoding::Flexible::new((domains,)),
1391                self.tx_id,
1392                0x3dfa728011b3ee0c,
1393                fidl::encoding::DynamicFlags::FLEXIBLE,
1394            )
1395    }
1396}
1397
1398#[must_use = "FIDL methods require a response to be sent"]
1399#[derive(Debug)]
1400pub struct DomainControllerGetMaxFrequencyResponder {
1401    control_handle: std::mem::ManuallyDrop<DomainControllerControlHandle>,
1402    tx_id: u32,
1403}
1404
1405/// Set the the channel to be shutdown (see [`DomainControllerControlHandle::shutdown`])
1406/// if the responder is dropped without sending a response, so that the client
1407/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1408impl std::ops::Drop for DomainControllerGetMaxFrequencyResponder {
1409    fn drop(&mut self) {
1410        self.control_handle.shutdown();
1411        // Safety: drops once, never accessed again
1412        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1413    }
1414}
1415
1416impl fidl::endpoints::Responder for DomainControllerGetMaxFrequencyResponder {
1417    type ControlHandle = DomainControllerControlHandle;
1418
1419    fn control_handle(&self) -> &DomainControllerControlHandle {
1420        &self.control_handle
1421    }
1422
1423    fn drop_without_shutdown(mut self) {
1424        // Safety: drops once, never accessed again due to mem::forget
1425        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1426        // Prevent Drop from running (which would shut down the channel)
1427        std::mem::forget(self);
1428    }
1429}
1430
1431impl DomainControllerGetMaxFrequencyResponder {
1432    /// Sends a response to the FIDL transaction.
1433    ///
1434    /// Sets the channel to shutdown if an error occurs.
1435    pub fn send(self, mut result: Result<u64, DomainControllerError>) -> Result<(), fidl::Error> {
1436        let _result = self.send_raw(result);
1437        if _result.is_err() {
1438            self.control_handle.shutdown();
1439        }
1440        self.drop_without_shutdown();
1441        _result
1442    }
1443
1444    /// Similar to "send" but does not shutdown the channel if an error occurs.
1445    pub fn send_no_shutdown_on_err(
1446        self,
1447        mut result: Result<u64, DomainControllerError>,
1448    ) -> Result<(), fidl::Error> {
1449        let _result = self.send_raw(result);
1450        self.drop_without_shutdown();
1451        _result
1452    }
1453
1454    fn send_raw(&self, mut result: Result<u64, DomainControllerError>) -> Result<(), fidl::Error> {
1455        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1456            DomainControllerGetMaxFrequencyResponse,
1457            DomainControllerError,
1458        >>(
1459            fidl::encoding::FlexibleResult::new(
1460                result.map(|max_frequency_index| (max_frequency_index,)),
1461            ),
1462            self.tx_id,
1463            0x6c8cc16cbd270f62,
1464            fidl::encoding::DynamicFlags::FLEXIBLE,
1465        )
1466    }
1467}
1468
1469#[must_use = "FIDL methods require a response to be sent"]
1470#[derive(Debug)]
1471pub struct DomainControllerSetMaxFrequencyResponder {
1472    control_handle: std::mem::ManuallyDrop<DomainControllerControlHandle>,
1473    tx_id: u32,
1474}
1475
1476/// Set the the channel to be shutdown (see [`DomainControllerControlHandle::shutdown`])
1477/// if the responder is dropped without sending a response, so that the client
1478/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1479impl std::ops::Drop for DomainControllerSetMaxFrequencyResponder {
1480    fn drop(&mut self) {
1481        self.control_handle.shutdown();
1482        // Safety: drops once, never accessed again
1483        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1484    }
1485}
1486
1487impl fidl::endpoints::Responder for DomainControllerSetMaxFrequencyResponder {
1488    type ControlHandle = DomainControllerControlHandle;
1489
1490    fn control_handle(&self) -> &DomainControllerControlHandle {
1491        &self.control_handle
1492    }
1493
1494    fn drop_without_shutdown(mut self) {
1495        // Safety: drops once, never accessed again due to mem::forget
1496        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1497        // Prevent Drop from running (which would shut down the channel)
1498        std::mem::forget(self);
1499    }
1500}
1501
1502impl DomainControllerSetMaxFrequencyResponder {
1503    /// Sends a response to the FIDL transaction.
1504    ///
1505    /// Sets the channel to shutdown if an error occurs.
1506    pub fn send(self, mut result: Result<(), DomainControllerError>) -> Result<(), fidl::Error> {
1507        let _result = self.send_raw(result);
1508        if _result.is_err() {
1509            self.control_handle.shutdown();
1510        }
1511        self.drop_without_shutdown();
1512        _result
1513    }
1514
1515    /// Similar to "send" but does not shutdown the channel if an error occurs.
1516    pub fn send_no_shutdown_on_err(
1517        self,
1518        mut result: Result<(), DomainControllerError>,
1519    ) -> Result<(), fidl::Error> {
1520        let _result = self.send_raw(result);
1521        self.drop_without_shutdown();
1522        _result
1523    }
1524
1525    fn send_raw(&self, mut result: Result<(), DomainControllerError>) -> Result<(), fidl::Error> {
1526        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1527            fidl::encoding::EmptyStruct,
1528            DomainControllerError,
1529        >>(
1530            fidl::encoding::FlexibleResult::new(result),
1531            self.tx_id,
1532            0x427d7a45e538939e,
1533            fidl::encoding::DynamicFlags::FLEXIBLE,
1534        )
1535    }
1536}
1537
1538#[must_use = "FIDL methods require a response to be sent"]
1539#[derive(Debug)]
1540pub struct DomainControllerClearMaxFrequencyResponder {
1541    control_handle: std::mem::ManuallyDrop<DomainControllerControlHandle>,
1542    tx_id: u32,
1543}
1544
1545/// Set the the channel to be shutdown (see [`DomainControllerControlHandle::shutdown`])
1546/// if the responder is dropped without sending a response, so that the client
1547/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1548impl std::ops::Drop for DomainControllerClearMaxFrequencyResponder {
1549    fn drop(&mut self) {
1550        self.control_handle.shutdown();
1551        // Safety: drops once, never accessed again
1552        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1553    }
1554}
1555
1556impl fidl::endpoints::Responder for DomainControllerClearMaxFrequencyResponder {
1557    type ControlHandle = DomainControllerControlHandle;
1558
1559    fn control_handle(&self) -> &DomainControllerControlHandle {
1560        &self.control_handle
1561    }
1562
1563    fn drop_without_shutdown(mut self) {
1564        // Safety: drops once, never accessed again due to mem::forget
1565        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1566        // Prevent Drop from running (which would shut down the channel)
1567        std::mem::forget(self);
1568    }
1569}
1570
1571impl DomainControllerClearMaxFrequencyResponder {
1572    /// Sends a response to the FIDL transaction.
1573    ///
1574    /// Sets the channel to shutdown if an error occurs.
1575    pub fn send(self, mut result: Result<(), DomainControllerError>) -> Result<(), fidl::Error> {
1576        let _result = self.send_raw(result);
1577        if _result.is_err() {
1578            self.control_handle.shutdown();
1579        }
1580        self.drop_without_shutdown();
1581        _result
1582    }
1583
1584    /// Similar to "send" but does not shutdown the channel if an error occurs.
1585    pub fn send_no_shutdown_on_err(
1586        self,
1587        mut result: Result<(), DomainControllerError>,
1588    ) -> Result<(), fidl::Error> {
1589        let _result = self.send_raw(result);
1590        self.drop_without_shutdown();
1591        _result
1592    }
1593
1594    fn send_raw(&self, mut result: Result<(), DomainControllerError>) -> Result<(), fidl::Error> {
1595        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1596            fidl::encoding::EmptyStruct,
1597            DomainControllerError,
1598        >>(
1599            fidl::encoding::FlexibleResult::new(result),
1600            self.tx_id,
1601            0x738116a31e202ba5,
1602            fidl::encoding::DynamicFlags::FLEXIBLE,
1603        )
1604    }
1605}
1606
1607#[must_use = "FIDL methods require a response to be sent"]
1608#[derive(Debug)]
1609pub struct DomainControllerGetMinFrequencyResponder {
1610    control_handle: std::mem::ManuallyDrop<DomainControllerControlHandle>,
1611    tx_id: u32,
1612}
1613
1614/// Set the the channel to be shutdown (see [`DomainControllerControlHandle::shutdown`])
1615/// if the responder is dropped without sending a response, so that the client
1616/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1617impl std::ops::Drop for DomainControllerGetMinFrequencyResponder {
1618    fn drop(&mut self) {
1619        self.control_handle.shutdown();
1620        // Safety: drops once, never accessed again
1621        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1622    }
1623}
1624
1625impl fidl::endpoints::Responder for DomainControllerGetMinFrequencyResponder {
1626    type ControlHandle = DomainControllerControlHandle;
1627
1628    fn control_handle(&self) -> &DomainControllerControlHandle {
1629        &self.control_handle
1630    }
1631
1632    fn drop_without_shutdown(mut self) {
1633        // Safety: drops once, never accessed again due to mem::forget
1634        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1635        // Prevent Drop from running (which would shut down the channel)
1636        std::mem::forget(self);
1637    }
1638}
1639
1640impl DomainControllerGetMinFrequencyResponder {
1641    /// Sends a response to the FIDL transaction.
1642    ///
1643    /// Sets the channel to shutdown if an error occurs.
1644    pub fn send(self, mut result: Result<u64, DomainControllerError>) -> Result<(), fidl::Error> {
1645        let _result = self.send_raw(result);
1646        if _result.is_err() {
1647            self.control_handle.shutdown();
1648        }
1649        self.drop_without_shutdown();
1650        _result
1651    }
1652
1653    /// Similar to "send" but does not shutdown the channel if an error occurs.
1654    pub fn send_no_shutdown_on_err(
1655        self,
1656        mut result: Result<u64, DomainControllerError>,
1657    ) -> Result<(), fidl::Error> {
1658        let _result = self.send_raw(result);
1659        self.drop_without_shutdown();
1660        _result
1661    }
1662
1663    fn send_raw(&self, mut result: Result<u64, DomainControllerError>) -> Result<(), fidl::Error> {
1664        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1665            DomainControllerGetMinFrequencyResponse,
1666            DomainControllerError,
1667        >>(
1668            fidl::encoding::FlexibleResult::new(
1669                result.map(|min_frequency_index| (min_frequency_index,)),
1670            ),
1671            self.tx_id,
1672            0x69f0bd89c925321c,
1673            fidl::encoding::DynamicFlags::FLEXIBLE,
1674        )
1675    }
1676}
1677
1678#[must_use = "FIDL methods require a response to be sent"]
1679#[derive(Debug)]
1680pub struct DomainControllerLeaseMaxFrequencyResponder {
1681    control_handle: std::mem::ManuallyDrop<DomainControllerControlHandle>,
1682    tx_id: u32,
1683}
1684
1685/// Set the the channel to be shutdown (see [`DomainControllerControlHandle::shutdown`])
1686/// if the responder is dropped without sending a response, so that the client
1687/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1688impl std::ops::Drop for DomainControllerLeaseMaxFrequencyResponder {
1689    fn drop(&mut self) {
1690        self.control_handle.shutdown();
1691        // Safety: drops once, never accessed again
1692        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1693    }
1694}
1695
1696impl fidl::endpoints::Responder for DomainControllerLeaseMaxFrequencyResponder {
1697    type ControlHandle = DomainControllerControlHandle;
1698
1699    fn control_handle(&self) -> &DomainControllerControlHandle {
1700        &self.control_handle
1701    }
1702
1703    fn drop_without_shutdown(mut self) {
1704        // Safety: drops once, never accessed again due to mem::forget
1705        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1706        // Prevent Drop from running (which would shut down the channel)
1707        std::mem::forget(self);
1708    }
1709}
1710
1711impl DomainControllerLeaseMaxFrequencyResponder {
1712    /// Sends a response to the FIDL transaction.
1713    ///
1714    /// Sets the channel to shutdown if an error occurs.
1715    pub fn send(
1716        self,
1717        mut result: Result<fidl::EventPair, DomainControllerError>,
1718    ) -> Result<(), fidl::Error> {
1719        let _result = self.send_raw(result);
1720        if _result.is_err() {
1721            self.control_handle.shutdown();
1722        }
1723        self.drop_without_shutdown();
1724        _result
1725    }
1726
1727    /// Similar to "send" but does not shutdown the channel if an error occurs.
1728    pub fn send_no_shutdown_on_err(
1729        self,
1730        mut result: Result<fidl::EventPair, DomainControllerError>,
1731    ) -> Result<(), fidl::Error> {
1732        let _result = self.send_raw(result);
1733        self.drop_without_shutdown();
1734        _result
1735    }
1736
1737    fn send_raw(
1738        &self,
1739        mut result: Result<fidl::EventPair, DomainControllerError>,
1740    ) -> Result<(), fidl::Error> {
1741        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1742            DomainControllerLeaseMaxFrequencyResponse,
1743            DomainControllerError,
1744        >>(
1745            fidl::encoding::FlexibleResult::new(result.map(|lease_token| (lease_token,))),
1746            self.tx_id,
1747            0x5ea676204a21a276,
1748            fidl::encoding::DynamicFlags::FLEXIBLE,
1749        )
1750    }
1751}
1752
1753#[must_use = "FIDL methods require a response to be sent"]
1754#[derive(Debug)]
1755pub struct DomainControllerLeaseMinFrequencyResponder {
1756    control_handle: std::mem::ManuallyDrop<DomainControllerControlHandle>,
1757    tx_id: u32,
1758}
1759
1760/// Set the the channel to be shutdown (see [`DomainControllerControlHandle::shutdown`])
1761/// if the responder is dropped without sending a response, so that the client
1762/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1763impl std::ops::Drop for DomainControllerLeaseMinFrequencyResponder {
1764    fn drop(&mut self) {
1765        self.control_handle.shutdown();
1766        // Safety: drops once, never accessed again
1767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1768    }
1769}
1770
1771impl fidl::endpoints::Responder for DomainControllerLeaseMinFrequencyResponder {
1772    type ControlHandle = DomainControllerControlHandle;
1773
1774    fn control_handle(&self) -> &DomainControllerControlHandle {
1775        &self.control_handle
1776    }
1777
1778    fn drop_without_shutdown(mut self) {
1779        // Safety: drops once, never accessed again due to mem::forget
1780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1781        // Prevent Drop from running (which would shut down the channel)
1782        std::mem::forget(self);
1783    }
1784}
1785
1786impl DomainControllerLeaseMinFrequencyResponder {
1787    /// Sends a response to the FIDL transaction.
1788    ///
1789    /// Sets the channel to shutdown if an error occurs.
1790    pub fn send(
1791        self,
1792        mut result: Result<fidl::EventPair, DomainControllerError>,
1793    ) -> Result<(), fidl::Error> {
1794        let _result = self.send_raw(result);
1795        if _result.is_err() {
1796            self.control_handle.shutdown();
1797        }
1798        self.drop_without_shutdown();
1799        _result
1800    }
1801
1802    /// Similar to "send" but does not shutdown the channel if an error occurs.
1803    pub fn send_no_shutdown_on_err(
1804        self,
1805        mut result: Result<fidl::EventPair, DomainControllerError>,
1806    ) -> Result<(), fidl::Error> {
1807        let _result = self.send_raw(result);
1808        self.drop_without_shutdown();
1809        _result
1810    }
1811
1812    fn send_raw(
1813        &self,
1814        mut result: Result<fidl::EventPair, DomainControllerError>,
1815    ) -> Result<(), fidl::Error> {
1816        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1817            DomainControllerLeaseMinFrequencyResponse,
1818            DomainControllerError,
1819        >>(
1820            fidl::encoding::FlexibleResult::new(result.map(|lease_token| (lease_token,))),
1821            self.tx_id,
1822            0x544abd141e121407,
1823            fidl::encoding::DynamicFlags::FLEXIBLE,
1824        )
1825    }
1826}
1827
1828mod internal {
1829    use super::*;
1830
1831    impl fidl::encoding::ResourceTypeMarker for DomainControllerLeaseMaxFrequencyResponse {
1832        type Borrowed<'a> = &'a mut Self;
1833        fn take_or_borrow<'a>(
1834            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1835        ) -> Self::Borrowed<'a> {
1836            value
1837        }
1838    }
1839
1840    unsafe impl fidl::encoding::TypeMarker for DomainControllerLeaseMaxFrequencyResponse {
1841        type Owned = Self;
1842
1843        #[inline(always)]
1844        fn inline_align(_context: fidl::encoding::Context) -> usize {
1845            4
1846        }
1847
1848        #[inline(always)]
1849        fn inline_size(_context: fidl::encoding::Context) -> usize {
1850            4
1851        }
1852    }
1853
1854    unsafe impl
1855        fidl::encoding::Encode<
1856            DomainControllerLeaseMaxFrequencyResponse,
1857            fidl::encoding::DefaultFuchsiaResourceDialect,
1858        > for &mut DomainControllerLeaseMaxFrequencyResponse
1859    {
1860        #[inline]
1861        unsafe fn encode(
1862            self,
1863            encoder: &mut fidl::encoding::Encoder<
1864                '_,
1865                fidl::encoding::DefaultFuchsiaResourceDialect,
1866            >,
1867            offset: usize,
1868            _depth: fidl::encoding::Depth,
1869        ) -> fidl::Result<()> {
1870            encoder.debug_check_bounds::<DomainControllerLeaseMaxFrequencyResponse>(offset);
1871            // Delegate to tuple encoding.
1872            fidl::encoding::Encode::<
1873                DomainControllerLeaseMaxFrequencyResponse,
1874                fidl::encoding::DefaultFuchsiaResourceDialect,
1875            >::encode(
1876                (<fidl::encoding::HandleType<
1877                    fidl::EventPair,
1878                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1879                    24579,
1880                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1881                    &mut self.lease_token
1882                ),),
1883                encoder,
1884                offset,
1885                _depth,
1886            )
1887        }
1888    }
1889    unsafe impl<
1890        T0: fidl::encoding::Encode<
1891                fidl::encoding::HandleType<
1892                    fidl::EventPair,
1893                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1894                    24579,
1895                >,
1896                fidl::encoding::DefaultFuchsiaResourceDialect,
1897            >,
1898    >
1899        fidl::encoding::Encode<
1900            DomainControllerLeaseMaxFrequencyResponse,
1901            fidl::encoding::DefaultFuchsiaResourceDialect,
1902        > for (T0,)
1903    {
1904        #[inline]
1905        unsafe fn encode(
1906            self,
1907            encoder: &mut fidl::encoding::Encoder<
1908                '_,
1909                fidl::encoding::DefaultFuchsiaResourceDialect,
1910            >,
1911            offset: usize,
1912            depth: fidl::encoding::Depth,
1913        ) -> fidl::Result<()> {
1914            encoder.debug_check_bounds::<DomainControllerLeaseMaxFrequencyResponse>(offset);
1915            // Zero out padding regions. There's no need to apply masks
1916            // because the unmasked parts will be overwritten by fields.
1917            // Write the fields.
1918            self.0.encode(encoder, offset + 0, depth)?;
1919            Ok(())
1920        }
1921    }
1922
1923    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1924        for DomainControllerLeaseMaxFrequencyResponse
1925    {
1926        #[inline(always)]
1927        fn new_empty() -> Self {
1928            Self {
1929                lease_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 24579>, fidl::encoding::DefaultFuchsiaResourceDialect),
1930            }
1931        }
1932
1933        #[inline]
1934        unsafe fn decode(
1935            &mut self,
1936            decoder: &mut fidl::encoding::Decoder<
1937                '_,
1938                fidl::encoding::DefaultFuchsiaResourceDialect,
1939            >,
1940            offset: usize,
1941            _depth: fidl::encoding::Depth,
1942        ) -> fidl::Result<()> {
1943            decoder.debug_check_bounds::<Self>(offset);
1944            // Verify that padding bytes are zero.
1945            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 24579>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.lease_token, decoder, offset + 0, _depth)?;
1946            Ok(())
1947        }
1948    }
1949
1950    impl fidl::encoding::ResourceTypeMarker for DomainControllerLeaseMinFrequencyResponse {
1951        type Borrowed<'a> = &'a mut Self;
1952        fn take_or_borrow<'a>(
1953            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1954        ) -> Self::Borrowed<'a> {
1955            value
1956        }
1957    }
1958
1959    unsafe impl fidl::encoding::TypeMarker for DomainControllerLeaseMinFrequencyResponse {
1960        type Owned = Self;
1961
1962        #[inline(always)]
1963        fn inline_align(_context: fidl::encoding::Context) -> usize {
1964            4
1965        }
1966
1967        #[inline(always)]
1968        fn inline_size(_context: fidl::encoding::Context) -> usize {
1969            4
1970        }
1971    }
1972
1973    unsafe impl
1974        fidl::encoding::Encode<
1975            DomainControllerLeaseMinFrequencyResponse,
1976            fidl::encoding::DefaultFuchsiaResourceDialect,
1977        > for &mut DomainControllerLeaseMinFrequencyResponse
1978    {
1979        #[inline]
1980        unsafe fn encode(
1981            self,
1982            encoder: &mut fidl::encoding::Encoder<
1983                '_,
1984                fidl::encoding::DefaultFuchsiaResourceDialect,
1985            >,
1986            offset: usize,
1987            _depth: fidl::encoding::Depth,
1988        ) -> fidl::Result<()> {
1989            encoder.debug_check_bounds::<DomainControllerLeaseMinFrequencyResponse>(offset);
1990            // Delegate to tuple encoding.
1991            fidl::encoding::Encode::<
1992                DomainControllerLeaseMinFrequencyResponse,
1993                fidl::encoding::DefaultFuchsiaResourceDialect,
1994            >::encode(
1995                (<fidl::encoding::HandleType<
1996                    fidl::EventPair,
1997                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1998                    24579,
1999                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2000                    &mut self.lease_token
2001                ),),
2002                encoder,
2003                offset,
2004                _depth,
2005            )
2006        }
2007    }
2008    unsafe impl<
2009        T0: fidl::encoding::Encode<
2010                fidl::encoding::HandleType<
2011                    fidl::EventPair,
2012                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2013                    24579,
2014                >,
2015                fidl::encoding::DefaultFuchsiaResourceDialect,
2016            >,
2017    >
2018        fidl::encoding::Encode<
2019            DomainControllerLeaseMinFrequencyResponse,
2020            fidl::encoding::DefaultFuchsiaResourceDialect,
2021        > for (T0,)
2022    {
2023        #[inline]
2024        unsafe fn encode(
2025            self,
2026            encoder: &mut fidl::encoding::Encoder<
2027                '_,
2028                fidl::encoding::DefaultFuchsiaResourceDialect,
2029            >,
2030            offset: usize,
2031            depth: fidl::encoding::Depth,
2032        ) -> fidl::Result<()> {
2033            encoder.debug_check_bounds::<DomainControllerLeaseMinFrequencyResponse>(offset);
2034            // Zero out padding regions. There's no need to apply masks
2035            // because the unmasked parts will be overwritten by fields.
2036            // Write the fields.
2037            self.0.encode(encoder, offset + 0, depth)?;
2038            Ok(())
2039        }
2040    }
2041
2042    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2043        for DomainControllerLeaseMinFrequencyResponse
2044    {
2045        #[inline(always)]
2046        fn new_empty() -> Self {
2047            Self {
2048                lease_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 24579>, fidl::encoding::DefaultFuchsiaResourceDialect),
2049            }
2050        }
2051
2052        #[inline]
2053        unsafe fn decode(
2054            &mut self,
2055            decoder: &mut fidl::encoding::Decoder<
2056                '_,
2057                fidl::encoding::DefaultFuchsiaResourceDialect,
2058            >,
2059            offset: usize,
2060            _depth: fidl::encoding::Depth,
2061        ) -> fidl::Result<()> {
2062            decoder.debug_check_bounds::<Self>(offset);
2063            // Verify that padding bytes are zero.
2064            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 24579>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.lease_token, decoder, offset + 0, _depth)?;
2065            Ok(())
2066        }
2067    }
2068}