Skip to main content

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