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