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    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
757        self.inner.shutdown_with_epitaph(status)
758    }
759
760    fn is_closed(&self) -> bool {
761        self.inner.channel().is_closed()
762    }
763    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
764        self.inner.channel().on_closed()
765    }
766
767    #[cfg(target_os = "fuchsia")]
768    fn signal_peer(
769        &self,
770        clear_mask: zx::Signals,
771        set_mask: zx::Signals,
772    ) -> Result<(), zx_status::Status> {
773        use fidl::Peered;
774        self.inner.channel().signal_peer(clear_mask, set_mask)
775    }
776}
777
778impl ProfileProviderControlHandle {}
779
780#[must_use = "FIDL methods require a response to be sent"]
781#[derive(Debug)]
782pub struct ProfileProviderGetProfileResponder {
783    control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
784    tx_id: u32,
785}
786
787/// Set the the channel to be shutdown (see [`ProfileProviderControlHandle::shutdown`])
788/// if the responder is dropped without sending a response, so that the client
789/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
790impl std::ops::Drop for ProfileProviderGetProfileResponder {
791    fn drop(&mut self) {
792        self.control_handle.shutdown();
793        // Safety: drops once, never accessed again
794        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
795    }
796}
797
798impl fidl::endpoints::Responder for ProfileProviderGetProfileResponder {
799    type ControlHandle = ProfileProviderControlHandle;
800
801    fn control_handle(&self) -> &ProfileProviderControlHandle {
802        &self.control_handle
803    }
804
805    fn drop_without_shutdown(mut self) {
806        // Safety: drops once, never accessed again due to mem::forget
807        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
808        // Prevent Drop from running (which would shut down the channel)
809        std::mem::forget(self);
810    }
811}
812
813impl ProfileProviderGetProfileResponder {
814    /// Sends a response to the FIDL transaction.
815    ///
816    /// Sets the channel to shutdown if an error occurs.
817    pub fn send(
818        self,
819        mut status: i32,
820        mut profile: Option<fidl::Profile>,
821    ) -> Result<(), fidl::Error> {
822        let _result = self.send_raw(status, profile);
823        if _result.is_err() {
824            self.control_handle.shutdown();
825        }
826        self.drop_without_shutdown();
827        _result
828    }
829
830    /// Similar to "send" but does not shutdown the channel if an error occurs.
831    pub fn send_no_shutdown_on_err(
832        self,
833        mut status: i32,
834        mut profile: Option<fidl::Profile>,
835    ) -> Result<(), fidl::Error> {
836        let _result = self.send_raw(status, profile);
837        self.drop_without_shutdown();
838        _result
839    }
840
841    fn send_raw(
842        &self,
843        mut status: i32,
844        mut profile: Option<fidl::Profile>,
845    ) -> Result<(), fidl::Error> {
846        self.control_handle.inner.send::<ProfileProviderGetProfileResponse>(
847            (status, profile),
848            self.tx_id,
849            0x686b544f3d19d679,
850            fidl::encoding::DynamicFlags::empty(),
851        )
852    }
853}
854
855#[must_use = "FIDL methods require a response to be sent"]
856#[derive(Debug)]
857pub struct ProfileProviderGetDeadlineProfileResponder {
858    control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
859    tx_id: u32,
860}
861
862/// Set the the channel to be shutdown (see [`ProfileProviderControlHandle::shutdown`])
863/// if the responder is dropped without sending a response, so that the client
864/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
865impl std::ops::Drop for ProfileProviderGetDeadlineProfileResponder {
866    fn drop(&mut self) {
867        self.control_handle.shutdown();
868        // Safety: drops once, never accessed again
869        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
870    }
871}
872
873impl fidl::endpoints::Responder for ProfileProviderGetDeadlineProfileResponder {
874    type ControlHandle = ProfileProviderControlHandle;
875
876    fn control_handle(&self) -> &ProfileProviderControlHandle {
877        &self.control_handle
878    }
879
880    fn drop_without_shutdown(mut self) {
881        // Safety: drops once, never accessed again due to mem::forget
882        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
883        // Prevent Drop from running (which would shut down the channel)
884        std::mem::forget(self);
885    }
886}
887
888impl ProfileProviderGetDeadlineProfileResponder {
889    /// Sends a response to the FIDL transaction.
890    ///
891    /// Sets the channel to shutdown if an error occurs.
892    pub fn send(
893        self,
894        mut status: i32,
895        mut profile: Option<fidl::Profile>,
896    ) -> Result<(), fidl::Error> {
897        let _result = self.send_raw(status, profile);
898        if _result.is_err() {
899            self.control_handle.shutdown();
900        }
901        self.drop_without_shutdown();
902        _result
903    }
904
905    /// Similar to "send" but does not shutdown the channel if an error occurs.
906    pub fn send_no_shutdown_on_err(
907        self,
908        mut status: i32,
909        mut profile: Option<fidl::Profile>,
910    ) -> Result<(), fidl::Error> {
911        let _result = self.send_raw(status, profile);
912        self.drop_without_shutdown();
913        _result
914    }
915
916    fn send_raw(
917        &self,
918        mut status: i32,
919        mut profile: Option<fidl::Profile>,
920    ) -> Result<(), fidl::Error> {
921        self.control_handle.inner.send::<ProfileProviderGetDeadlineProfileResponse>(
922            (status, profile),
923            self.tx_id,
924            0x62404c816133daee,
925            fidl::encoding::DynamicFlags::empty(),
926        )
927    }
928}
929
930#[must_use = "FIDL methods require a response to be sent"]
931#[derive(Debug)]
932pub struct ProfileProviderGetCpuAffinityProfileResponder {
933    control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
934    tx_id: u32,
935}
936
937/// Set the the channel to be shutdown (see [`ProfileProviderControlHandle::shutdown`])
938/// if the responder is dropped without sending a response, so that the client
939/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
940impl std::ops::Drop for ProfileProviderGetCpuAffinityProfileResponder {
941    fn drop(&mut self) {
942        self.control_handle.shutdown();
943        // Safety: drops once, never accessed again
944        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
945    }
946}
947
948impl fidl::endpoints::Responder for ProfileProviderGetCpuAffinityProfileResponder {
949    type ControlHandle = ProfileProviderControlHandle;
950
951    fn control_handle(&self) -> &ProfileProviderControlHandle {
952        &self.control_handle
953    }
954
955    fn drop_without_shutdown(mut self) {
956        // Safety: drops once, never accessed again due to mem::forget
957        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
958        // Prevent Drop from running (which would shut down the channel)
959        std::mem::forget(self);
960    }
961}
962
963impl ProfileProviderGetCpuAffinityProfileResponder {
964    /// Sends a response to the FIDL transaction.
965    ///
966    /// Sets the channel to shutdown if an error occurs.
967    pub fn send(
968        self,
969        mut status: i32,
970        mut profile: Option<fidl::Profile>,
971    ) -> Result<(), fidl::Error> {
972        let _result = self.send_raw(status, profile);
973        if _result.is_err() {
974            self.control_handle.shutdown();
975        }
976        self.drop_without_shutdown();
977        _result
978    }
979
980    /// Similar to "send" but does not shutdown the channel if an error occurs.
981    pub fn send_no_shutdown_on_err(
982        self,
983        mut status: i32,
984        mut profile: Option<fidl::Profile>,
985    ) -> Result<(), fidl::Error> {
986        let _result = self.send_raw(status, profile);
987        self.drop_without_shutdown();
988        _result
989    }
990
991    fn send_raw(
992        &self,
993        mut status: i32,
994        mut profile: Option<fidl::Profile>,
995    ) -> Result<(), fidl::Error> {
996        self.control_handle.inner.send::<ProfileProviderGetCpuAffinityProfileResponse>(
997            (status, profile),
998            self.tx_id,
999            0x36cc6d51ff82ee04,
1000            fidl::encoding::DynamicFlags::empty(),
1001        )
1002    }
1003}
1004
1005#[must_use = "FIDL methods require a response to be sent"]
1006#[derive(Debug)]
1007pub struct ProfileProviderSetProfileByRoleResponder {
1008    control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
1009    tx_id: u32,
1010}
1011
1012/// Set the the channel to be shutdown (see [`ProfileProviderControlHandle::shutdown`])
1013/// if the responder is dropped without sending a response, so that the client
1014/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1015impl std::ops::Drop for ProfileProviderSetProfileByRoleResponder {
1016    fn drop(&mut self) {
1017        self.control_handle.shutdown();
1018        // Safety: drops once, never accessed again
1019        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1020    }
1021}
1022
1023impl fidl::endpoints::Responder for ProfileProviderSetProfileByRoleResponder {
1024    type ControlHandle = ProfileProviderControlHandle;
1025
1026    fn control_handle(&self) -> &ProfileProviderControlHandle {
1027        &self.control_handle
1028    }
1029
1030    fn drop_without_shutdown(mut self) {
1031        // Safety: drops once, never accessed again due to mem::forget
1032        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1033        // Prevent Drop from running (which would shut down the channel)
1034        std::mem::forget(self);
1035    }
1036}
1037
1038impl ProfileProviderSetProfileByRoleResponder {
1039    /// Sends a response to the FIDL transaction.
1040    ///
1041    /// Sets the channel to shutdown if an error occurs.
1042    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1043        let _result = self.send_raw(status);
1044        if _result.is_err() {
1045            self.control_handle.shutdown();
1046        }
1047        self.drop_without_shutdown();
1048        _result
1049    }
1050
1051    /// Similar to "send" but does not shutdown the channel if an error occurs.
1052    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1053        let _result = self.send_raw(status);
1054        self.drop_without_shutdown();
1055        _result
1056    }
1057
1058    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1059        self.control_handle.inner.send::<ProfileProviderSetProfileByRoleResponse>(
1060            (status,),
1061            self.tx_id,
1062            0x31c4d936c0009564,
1063            fidl::encoding::DynamicFlags::empty(),
1064        )
1065    }
1066}
1067
1068mod internal {
1069    use super::*;
1070
1071    impl fidl::encoding::ResourceTypeMarker for ProfileProviderGetCpuAffinityProfileResponse {
1072        type Borrowed<'a> = &'a mut Self;
1073        fn take_or_borrow<'a>(
1074            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1075        ) -> Self::Borrowed<'a> {
1076            value
1077        }
1078    }
1079
1080    unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetCpuAffinityProfileResponse {
1081        type Owned = Self;
1082
1083        #[inline(always)]
1084        fn inline_align(_context: fidl::encoding::Context) -> usize {
1085            4
1086        }
1087
1088        #[inline(always)]
1089        fn inline_size(_context: fidl::encoding::Context) -> usize {
1090            8
1091        }
1092    }
1093
1094    unsafe impl
1095        fidl::encoding::Encode<
1096            ProfileProviderGetCpuAffinityProfileResponse,
1097            fidl::encoding::DefaultFuchsiaResourceDialect,
1098        > for &mut ProfileProviderGetCpuAffinityProfileResponse
1099    {
1100        #[inline]
1101        unsafe fn encode(
1102            self,
1103            encoder: &mut fidl::encoding::Encoder<
1104                '_,
1105                fidl::encoding::DefaultFuchsiaResourceDialect,
1106            >,
1107            offset: usize,
1108            _depth: fidl::encoding::Depth,
1109        ) -> fidl::Result<()> {
1110            encoder.debug_check_bounds::<ProfileProviderGetCpuAffinityProfileResponse>(offset);
1111            // Delegate to tuple encoding.
1112            fidl::encoding::Encode::<
1113                ProfileProviderGetCpuAffinityProfileResponse,
1114                fidl::encoding::DefaultFuchsiaResourceDialect,
1115            >::encode(
1116                (
1117                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
1118                    <fidl::encoding::Optional<
1119                        fidl::encoding::HandleType<
1120                            fidl::Profile,
1121                            { fidl::ObjectType::PROFILE.into_raw() },
1122                            2147483648,
1123                        >,
1124                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1125                        &mut self.profile
1126                    ),
1127                ),
1128                encoder,
1129                offset,
1130                _depth,
1131            )
1132        }
1133    }
1134    unsafe impl<
1135        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1136        T1: fidl::encoding::Encode<
1137                fidl::encoding::Optional<
1138                    fidl::encoding::HandleType<
1139                        fidl::Profile,
1140                        { fidl::ObjectType::PROFILE.into_raw() },
1141                        2147483648,
1142                    >,
1143                >,
1144                fidl::encoding::DefaultFuchsiaResourceDialect,
1145            >,
1146    >
1147        fidl::encoding::Encode<
1148            ProfileProviderGetCpuAffinityProfileResponse,
1149            fidl::encoding::DefaultFuchsiaResourceDialect,
1150        > for (T0, T1)
1151    {
1152        #[inline]
1153        unsafe fn encode(
1154            self,
1155            encoder: &mut fidl::encoding::Encoder<
1156                '_,
1157                fidl::encoding::DefaultFuchsiaResourceDialect,
1158            >,
1159            offset: usize,
1160            depth: fidl::encoding::Depth,
1161        ) -> fidl::Result<()> {
1162            encoder.debug_check_bounds::<ProfileProviderGetCpuAffinityProfileResponse>(offset);
1163            // Zero out padding regions. There's no need to apply masks
1164            // because the unmasked parts will be overwritten by fields.
1165            // Write the fields.
1166            self.0.encode(encoder, offset + 0, depth)?;
1167            self.1.encode(encoder, offset + 4, depth)?;
1168            Ok(())
1169        }
1170    }
1171
1172    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1173        for ProfileProviderGetCpuAffinityProfileResponse
1174    {
1175        #[inline(always)]
1176        fn new_empty() -> Self {
1177            Self {
1178                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
1179                profile: fidl::new_empty!(
1180                    fidl::encoding::Optional<
1181                        fidl::encoding::HandleType<
1182                            fidl::Profile,
1183                            { fidl::ObjectType::PROFILE.into_raw() },
1184                            2147483648,
1185                        >,
1186                    >,
1187                    fidl::encoding::DefaultFuchsiaResourceDialect
1188                ),
1189            }
1190        }
1191
1192        #[inline]
1193        unsafe fn decode(
1194            &mut self,
1195            decoder: &mut fidl::encoding::Decoder<
1196                '_,
1197                fidl::encoding::DefaultFuchsiaResourceDialect,
1198            >,
1199            offset: usize,
1200            _depth: fidl::encoding::Depth,
1201        ) -> fidl::Result<()> {
1202            decoder.debug_check_bounds::<Self>(offset);
1203            // Verify that padding bytes are zero.
1204            fidl::decode!(
1205                i32,
1206                fidl::encoding::DefaultFuchsiaResourceDialect,
1207                &mut self.status,
1208                decoder,
1209                offset + 0,
1210                _depth
1211            )?;
1212            fidl::decode!(
1213                fidl::encoding::Optional<
1214                    fidl::encoding::HandleType<
1215                        fidl::Profile,
1216                        { fidl::ObjectType::PROFILE.into_raw() },
1217                        2147483648,
1218                    >,
1219                >,
1220                fidl::encoding::DefaultFuchsiaResourceDialect,
1221                &mut self.profile,
1222                decoder,
1223                offset + 4,
1224                _depth
1225            )?;
1226            Ok(())
1227        }
1228    }
1229
1230    impl fidl::encoding::ResourceTypeMarker for ProfileProviderGetDeadlineProfileResponse {
1231        type Borrowed<'a> = &'a mut Self;
1232        fn take_or_borrow<'a>(
1233            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1234        ) -> Self::Borrowed<'a> {
1235            value
1236        }
1237    }
1238
1239    unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetDeadlineProfileResponse {
1240        type Owned = Self;
1241
1242        #[inline(always)]
1243        fn inline_align(_context: fidl::encoding::Context) -> usize {
1244            4
1245        }
1246
1247        #[inline(always)]
1248        fn inline_size(_context: fidl::encoding::Context) -> usize {
1249            8
1250        }
1251    }
1252
1253    unsafe impl
1254        fidl::encoding::Encode<
1255            ProfileProviderGetDeadlineProfileResponse,
1256            fidl::encoding::DefaultFuchsiaResourceDialect,
1257        > for &mut ProfileProviderGetDeadlineProfileResponse
1258    {
1259        #[inline]
1260        unsafe fn encode(
1261            self,
1262            encoder: &mut fidl::encoding::Encoder<
1263                '_,
1264                fidl::encoding::DefaultFuchsiaResourceDialect,
1265            >,
1266            offset: usize,
1267            _depth: fidl::encoding::Depth,
1268        ) -> fidl::Result<()> {
1269            encoder.debug_check_bounds::<ProfileProviderGetDeadlineProfileResponse>(offset);
1270            // Delegate to tuple encoding.
1271            fidl::encoding::Encode::<
1272                ProfileProviderGetDeadlineProfileResponse,
1273                fidl::encoding::DefaultFuchsiaResourceDialect,
1274            >::encode(
1275                (
1276                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
1277                    <fidl::encoding::Optional<
1278                        fidl::encoding::HandleType<
1279                            fidl::Profile,
1280                            { fidl::ObjectType::PROFILE.into_raw() },
1281                            2147483648,
1282                        >,
1283                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1284                        &mut self.profile
1285                    ),
1286                ),
1287                encoder,
1288                offset,
1289                _depth,
1290            )
1291        }
1292    }
1293    unsafe impl<
1294        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1295        T1: fidl::encoding::Encode<
1296                fidl::encoding::Optional<
1297                    fidl::encoding::HandleType<
1298                        fidl::Profile,
1299                        { fidl::ObjectType::PROFILE.into_raw() },
1300                        2147483648,
1301                    >,
1302                >,
1303                fidl::encoding::DefaultFuchsiaResourceDialect,
1304            >,
1305    >
1306        fidl::encoding::Encode<
1307            ProfileProviderGetDeadlineProfileResponse,
1308            fidl::encoding::DefaultFuchsiaResourceDialect,
1309        > for (T0, T1)
1310    {
1311        #[inline]
1312        unsafe fn encode(
1313            self,
1314            encoder: &mut fidl::encoding::Encoder<
1315                '_,
1316                fidl::encoding::DefaultFuchsiaResourceDialect,
1317            >,
1318            offset: usize,
1319            depth: fidl::encoding::Depth,
1320        ) -> fidl::Result<()> {
1321            encoder.debug_check_bounds::<ProfileProviderGetDeadlineProfileResponse>(offset);
1322            // Zero out padding regions. There's no need to apply masks
1323            // because the unmasked parts will be overwritten by fields.
1324            // Write the fields.
1325            self.0.encode(encoder, offset + 0, depth)?;
1326            self.1.encode(encoder, offset + 4, depth)?;
1327            Ok(())
1328        }
1329    }
1330
1331    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1332        for ProfileProviderGetDeadlineProfileResponse
1333    {
1334        #[inline(always)]
1335        fn new_empty() -> Self {
1336            Self {
1337                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
1338                profile: fidl::new_empty!(
1339                    fidl::encoding::Optional<
1340                        fidl::encoding::HandleType<
1341                            fidl::Profile,
1342                            { fidl::ObjectType::PROFILE.into_raw() },
1343                            2147483648,
1344                        >,
1345                    >,
1346                    fidl::encoding::DefaultFuchsiaResourceDialect
1347                ),
1348            }
1349        }
1350
1351        #[inline]
1352        unsafe fn decode(
1353            &mut self,
1354            decoder: &mut fidl::encoding::Decoder<
1355                '_,
1356                fidl::encoding::DefaultFuchsiaResourceDialect,
1357            >,
1358            offset: usize,
1359            _depth: fidl::encoding::Depth,
1360        ) -> fidl::Result<()> {
1361            decoder.debug_check_bounds::<Self>(offset);
1362            // Verify that padding bytes are zero.
1363            fidl::decode!(
1364                i32,
1365                fidl::encoding::DefaultFuchsiaResourceDialect,
1366                &mut self.status,
1367                decoder,
1368                offset + 0,
1369                _depth
1370            )?;
1371            fidl::decode!(
1372                fidl::encoding::Optional<
1373                    fidl::encoding::HandleType<
1374                        fidl::Profile,
1375                        { fidl::ObjectType::PROFILE.into_raw() },
1376                        2147483648,
1377                    >,
1378                >,
1379                fidl::encoding::DefaultFuchsiaResourceDialect,
1380                &mut self.profile,
1381                decoder,
1382                offset + 4,
1383                _depth
1384            )?;
1385            Ok(())
1386        }
1387    }
1388
1389    impl fidl::encoding::ResourceTypeMarker for ProfileProviderGetProfileResponse {
1390        type Borrowed<'a> = &'a mut Self;
1391        fn take_or_borrow<'a>(
1392            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1393        ) -> Self::Borrowed<'a> {
1394            value
1395        }
1396    }
1397
1398    unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetProfileResponse {
1399        type Owned = Self;
1400
1401        #[inline(always)]
1402        fn inline_align(_context: fidl::encoding::Context) -> usize {
1403            4
1404        }
1405
1406        #[inline(always)]
1407        fn inline_size(_context: fidl::encoding::Context) -> usize {
1408            8
1409        }
1410    }
1411
1412    unsafe impl
1413        fidl::encoding::Encode<
1414            ProfileProviderGetProfileResponse,
1415            fidl::encoding::DefaultFuchsiaResourceDialect,
1416        > for &mut ProfileProviderGetProfileResponse
1417    {
1418        #[inline]
1419        unsafe fn encode(
1420            self,
1421            encoder: &mut fidl::encoding::Encoder<
1422                '_,
1423                fidl::encoding::DefaultFuchsiaResourceDialect,
1424            >,
1425            offset: usize,
1426            _depth: fidl::encoding::Depth,
1427        ) -> fidl::Result<()> {
1428            encoder.debug_check_bounds::<ProfileProviderGetProfileResponse>(offset);
1429            // Delegate to tuple encoding.
1430            fidl::encoding::Encode::<
1431                ProfileProviderGetProfileResponse,
1432                fidl::encoding::DefaultFuchsiaResourceDialect,
1433            >::encode(
1434                (
1435                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
1436                    <fidl::encoding::Optional<
1437                        fidl::encoding::HandleType<
1438                            fidl::Profile,
1439                            { fidl::ObjectType::PROFILE.into_raw() },
1440                            2147483648,
1441                        >,
1442                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1443                        &mut self.profile
1444                    ),
1445                ),
1446                encoder,
1447                offset,
1448                _depth,
1449            )
1450        }
1451    }
1452    unsafe impl<
1453        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1454        T1: fidl::encoding::Encode<
1455                fidl::encoding::Optional<
1456                    fidl::encoding::HandleType<
1457                        fidl::Profile,
1458                        { fidl::ObjectType::PROFILE.into_raw() },
1459                        2147483648,
1460                    >,
1461                >,
1462                fidl::encoding::DefaultFuchsiaResourceDialect,
1463            >,
1464    >
1465        fidl::encoding::Encode<
1466            ProfileProviderGetProfileResponse,
1467            fidl::encoding::DefaultFuchsiaResourceDialect,
1468        > for (T0, T1)
1469    {
1470        #[inline]
1471        unsafe fn encode(
1472            self,
1473            encoder: &mut fidl::encoding::Encoder<
1474                '_,
1475                fidl::encoding::DefaultFuchsiaResourceDialect,
1476            >,
1477            offset: usize,
1478            depth: fidl::encoding::Depth,
1479        ) -> fidl::Result<()> {
1480            encoder.debug_check_bounds::<ProfileProviderGetProfileResponse>(offset);
1481            // Zero out padding regions. There's no need to apply masks
1482            // because the unmasked parts will be overwritten by fields.
1483            // Write the fields.
1484            self.0.encode(encoder, offset + 0, depth)?;
1485            self.1.encode(encoder, offset + 4, depth)?;
1486            Ok(())
1487        }
1488    }
1489
1490    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1491        for ProfileProviderGetProfileResponse
1492    {
1493        #[inline(always)]
1494        fn new_empty() -> Self {
1495            Self {
1496                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
1497                profile: fidl::new_empty!(
1498                    fidl::encoding::Optional<
1499                        fidl::encoding::HandleType<
1500                            fidl::Profile,
1501                            { fidl::ObjectType::PROFILE.into_raw() },
1502                            2147483648,
1503                        >,
1504                    >,
1505                    fidl::encoding::DefaultFuchsiaResourceDialect
1506                ),
1507            }
1508        }
1509
1510        #[inline]
1511        unsafe fn decode(
1512            &mut self,
1513            decoder: &mut fidl::encoding::Decoder<
1514                '_,
1515                fidl::encoding::DefaultFuchsiaResourceDialect,
1516            >,
1517            offset: usize,
1518            _depth: fidl::encoding::Depth,
1519        ) -> fidl::Result<()> {
1520            decoder.debug_check_bounds::<Self>(offset);
1521            // Verify that padding bytes are zero.
1522            fidl::decode!(
1523                i32,
1524                fidl::encoding::DefaultFuchsiaResourceDialect,
1525                &mut self.status,
1526                decoder,
1527                offset + 0,
1528                _depth
1529            )?;
1530            fidl::decode!(
1531                fidl::encoding::Optional<
1532                    fidl::encoding::HandleType<
1533                        fidl::Profile,
1534                        { fidl::ObjectType::PROFILE.into_raw() },
1535                        2147483648,
1536                    >,
1537                >,
1538                fidl::encoding::DefaultFuchsiaResourceDialect,
1539                &mut self.profile,
1540                decoder,
1541                offset + 4,
1542                _depth
1543            )?;
1544            Ok(())
1545        }
1546    }
1547
1548    impl fidl::encoding::ResourceTypeMarker for ProfileProviderSetProfileByRoleRequest {
1549        type Borrowed<'a> = &'a mut Self;
1550        fn take_or_borrow<'a>(
1551            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1552        ) -> Self::Borrowed<'a> {
1553            value
1554        }
1555    }
1556
1557    unsafe impl fidl::encoding::TypeMarker for ProfileProviderSetProfileByRoleRequest {
1558        type Owned = Self;
1559
1560        #[inline(always)]
1561        fn inline_align(_context: fidl::encoding::Context) -> usize {
1562            8
1563        }
1564
1565        #[inline(always)]
1566        fn inline_size(_context: fidl::encoding::Context) -> usize {
1567            24
1568        }
1569    }
1570
1571    unsafe impl
1572        fidl::encoding::Encode<
1573            ProfileProviderSetProfileByRoleRequest,
1574            fidl::encoding::DefaultFuchsiaResourceDialect,
1575        > for &mut ProfileProviderSetProfileByRoleRequest
1576    {
1577        #[inline]
1578        unsafe fn encode(
1579            self,
1580            encoder: &mut fidl::encoding::Encoder<
1581                '_,
1582                fidl::encoding::DefaultFuchsiaResourceDialect,
1583            >,
1584            offset: usize,
1585            _depth: fidl::encoding::Depth,
1586        ) -> fidl::Result<()> {
1587            encoder.debug_check_bounds::<ProfileProviderSetProfileByRoleRequest>(offset);
1588            // Delegate to tuple encoding.
1589            fidl::encoding::Encode::<ProfileProviderSetProfileByRoleRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1590                (
1591                    <fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
1592                    <fidl::encoding::BoundedString<2048> as fidl::encoding::ValueTypeMarker>::borrow(&self.role),
1593                ),
1594                encoder, offset, _depth
1595            )
1596        }
1597    }
1598    unsafe impl<
1599        T0: fidl::encoding::Encode<
1600                fidl::encoding::HandleType<
1601                    fidl::NullableHandle,
1602                    { fidl::ObjectType::NONE.into_raw() },
1603                    2147483648,
1604                >,
1605                fidl::encoding::DefaultFuchsiaResourceDialect,
1606            >,
1607        T1: fidl::encoding::Encode<
1608                fidl::encoding::BoundedString<2048>,
1609                fidl::encoding::DefaultFuchsiaResourceDialect,
1610            >,
1611    >
1612        fidl::encoding::Encode<
1613            ProfileProviderSetProfileByRoleRequest,
1614            fidl::encoding::DefaultFuchsiaResourceDialect,
1615        > for (T0, T1)
1616    {
1617        #[inline]
1618        unsafe fn encode(
1619            self,
1620            encoder: &mut fidl::encoding::Encoder<
1621                '_,
1622                fidl::encoding::DefaultFuchsiaResourceDialect,
1623            >,
1624            offset: usize,
1625            depth: fidl::encoding::Depth,
1626        ) -> fidl::Result<()> {
1627            encoder.debug_check_bounds::<ProfileProviderSetProfileByRoleRequest>(offset);
1628            // Zero out padding regions. There's no need to apply masks
1629            // because the unmasked parts will be overwritten by fields.
1630            unsafe {
1631                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1632                (ptr as *mut u64).write_unaligned(0);
1633            }
1634            // Write the fields.
1635            self.0.encode(encoder, offset + 0, depth)?;
1636            self.1.encode(encoder, offset + 8, depth)?;
1637            Ok(())
1638        }
1639    }
1640
1641    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1642        for ProfileProviderSetProfileByRoleRequest
1643    {
1644        #[inline(always)]
1645        fn new_empty() -> Self {
1646            Self {
1647                handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1648                role: fidl::new_empty!(
1649                    fidl::encoding::BoundedString<2048>,
1650                    fidl::encoding::DefaultFuchsiaResourceDialect
1651                ),
1652            }
1653        }
1654
1655        #[inline]
1656        unsafe fn decode(
1657            &mut self,
1658            decoder: &mut fidl::encoding::Decoder<
1659                '_,
1660                fidl::encoding::DefaultFuchsiaResourceDialect,
1661            >,
1662            offset: usize,
1663            _depth: fidl::encoding::Depth,
1664        ) -> fidl::Result<()> {
1665            decoder.debug_check_bounds::<Self>(offset);
1666            // Verify that padding bytes are zero.
1667            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1668            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1669            let mask = 0xffffffff00000000u64;
1670            let maskedval = padval & mask;
1671            if maskedval != 0 {
1672                return Err(fidl::Error::NonZeroPadding {
1673                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1674                });
1675            }
1676            fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.handle, decoder, offset + 0, _depth)?;
1677            fidl::decode!(
1678                fidl::encoding::BoundedString<2048>,
1679                fidl::encoding::DefaultFuchsiaResourceDialect,
1680                &mut self.role,
1681                decoder,
1682                offset + 8,
1683                _depth
1684            )?;
1685            Ok(())
1686        }
1687    }
1688}