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