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