1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12#[repr(C)]
13pub struct CpuSet {
14 pub mask: [u64; 8],
15}
16
17impl fidl::Persistable for CpuSet {}
18
19#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20#[repr(C)]
21pub struct ProfileProviderGetCpuAffinityProfileRequest {
22 pub cpu_mask: CpuSet,
23}
24
25impl fidl::Persistable for ProfileProviderGetCpuAffinityProfileRequest {}
26
27#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct ProfileProviderGetDeadlineProfileRequest {
29 pub capacity: u64,
30 pub deadline: u64,
31 pub period: u64,
32 pub name: String,
33}
34
35impl fidl::Persistable for ProfileProviderGetDeadlineProfileRequest {}
36
37#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct ProfileProviderGetProfileRequest {
39 pub priority: u32,
40 pub name: String,
41}
42
43impl fidl::Persistable for ProfileProviderGetProfileRequest {}
44
45#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46#[repr(C)]
47pub struct ProfileProviderSetProfileByRoleResponse {
48 pub status: i32,
49}
50
51impl fidl::Persistable for ProfileProviderSetProfileByRoleResponse {}
52
53pub mod profile_provider_ordinals {
54 pub const GET_PROFILE: u64 = 0x686b544f3d19d679;
55 pub const GET_DEADLINE_PROFILE: u64 = 0x62404c816133daee;
56 pub const GET_CPU_AFFINITY_PROFILE: u64 = 0x36cc6d51ff82ee04;
57 pub const SET_PROFILE_BY_ROLE: u64 = 0x31c4d936c0009564;
58}
59
60mod internal {
61 use super::*;
62
63 impl fidl::encoding::ValueTypeMarker for CpuSet {
64 type Borrowed<'a> = &'a Self;
65 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
66 value
67 }
68 }
69
70 unsafe impl fidl::encoding::TypeMarker for CpuSet {
71 type Owned = Self;
72
73 #[inline(always)]
74 fn inline_align(_context: fidl::encoding::Context) -> usize {
75 8
76 }
77
78 #[inline(always)]
79 fn inline_size(_context: fidl::encoding::Context) -> usize {
80 64
81 }
82 #[inline(always)]
83 fn encode_is_copy() -> bool {
84 true
85 }
86
87 #[inline(always)]
88 fn decode_is_copy() -> bool {
89 true
90 }
91 }
92
93 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CpuSet, D> for &CpuSet {
94 #[inline]
95 unsafe fn encode(
96 self,
97 encoder: &mut fidl::encoding::Encoder<'_, D>,
98 offset: usize,
99 _depth: fidl::encoding::Depth,
100 ) -> fidl::Result<()> {
101 encoder.debug_check_bounds::<CpuSet>(offset);
102 unsafe {
103 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
105 (buf_ptr as *mut CpuSet).write_unaligned((self as *const CpuSet).read());
106 }
109 Ok(())
110 }
111 }
112 unsafe impl<
113 D: fidl::encoding::ResourceDialect,
114 T0: fidl::encoding::Encode<fidl::encoding::Array<u64, 8>, D>,
115 > fidl::encoding::Encode<CpuSet, D> for (T0,)
116 {
117 #[inline]
118 unsafe fn encode(
119 self,
120 encoder: &mut fidl::encoding::Encoder<'_, D>,
121 offset: usize,
122 depth: fidl::encoding::Depth,
123 ) -> fidl::Result<()> {
124 encoder.debug_check_bounds::<CpuSet>(offset);
125 self.0.encode(encoder, offset + 0, depth)?;
129 Ok(())
130 }
131 }
132
133 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CpuSet {
134 #[inline(always)]
135 fn new_empty() -> Self {
136 Self { mask: fidl::new_empty!(fidl::encoding::Array<u64, 8>, D) }
137 }
138
139 #[inline]
140 unsafe fn decode(
141 &mut self,
142 decoder: &mut fidl::encoding::Decoder<'_, D>,
143 offset: usize,
144 _depth: fidl::encoding::Depth,
145 ) -> fidl::Result<()> {
146 decoder.debug_check_bounds::<Self>(offset);
147 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
148 unsafe {
151 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 64);
152 }
153 Ok(())
154 }
155 }
156
157 impl fidl::encoding::ValueTypeMarker for ProfileProviderGetCpuAffinityProfileRequest {
158 type Borrowed<'a> = &'a Self;
159 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
160 value
161 }
162 }
163
164 unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetCpuAffinityProfileRequest {
165 type Owned = Self;
166
167 #[inline(always)]
168 fn inline_align(_context: fidl::encoding::Context) -> usize {
169 8
170 }
171
172 #[inline(always)]
173 fn inline_size(_context: fidl::encoding::Context) -> usize {
174 64
175 }
176 #[inline(always)]
177 fn encode_is_copy() -> bool {
178 true
179 }
180
181 #[inline(always)]
182 fn decode_is_copy() -> bool {
183 true
184 }
185 }
186
187 unsafe impl<D: fidl::encoding::ResourceDialect>
188 fidl::encoding::Encode<ProfileProviderGetCpuAffinityProfileRequest, D>
189 for &ProfileProviderGetCpuAffinityProfileRequest
190 {
191 #[inline]
192 unsafe fn encode(
193 self,
194 encoder: &mut fidl::encoding::Encoder<'_, D>,
195 offset: usize,
196 _depth: fidl::encoding::Depth,
197 ) -> fidl::Result<()> {
198 encoder.debug_check_bounds::<ProfileProviderGetCpuAffinityProfileRequest>(offset);
199 unsafe {
200 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
202 (buf_ptr as *mut ProfileProviderGetCpuAffinityProfileRequest).write_unaligned(
203 (self as *const ProfileProviderGetCpuAffinityProfileRequest).read(),
204 );
205 }
208 Ok(())
209 }
210 }
211 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CpuSet, D>>
212 fidl::encoding::Encode<ProfileProviderGetCpuAffinityProfileRequest, D> for (T0,)
213 {
214 #[inline]
215 unsafe fn encode(
216 self,
217 encoder: &mut fidl::encoding::Encoder<'_, D>,
218 offset: usize,
219 depth: fidl::encoding::Depth,
220 ) -> fidl::Result<()> {
221 encoder.debug_check_bounds::<ProfileProviderGetCpuAffinityProfileRequest>(offset);
222 self.0.encode(encoder, offset + 0, depth)?;
226 Ok(())
227 }
228 }
229
230 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
231 for ProfileProviderGetCpuAffinityProfileRequest
232 {
233 #[inline(always)]
234 fn new_empty() -> Self {
235 Self { cpu_mask: fidl::new_empty!(CpuSet, D) }
236 }
237
238 #[inline]
239 unsafe fn decode(
240 &mut self,
241 decoder: &mut fidl::encoding::Decoder<'_, D>,
242 offset: usize,
243 _depth: fidl::encoding::Depth,
244 ) -> fidl::Result<()> {
245 decoder.debug_check_bounds::<Self>(offset);
246 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
247 unsafe {
250 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 64);
251 }
252 Ok(())
253 }
254 }
255
256 impl fidl::encoding::ValueTypeMarker for ProfileProviderGetDeadlineProfileRequest {
257 type Borrowed<'a> = &'a Self;
258 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
259 value
260 }
261 }
262
263 unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetDeadlineProfileRequest {
264 type Owned = Self;
265
266 #[inline(always)]
267 fn inline_align(_context: fidl::encoding::Context) -> usize {
268 8
269 }
270
271 #[inline(always)]
272 fn inline_size(_context: fidl::encoding::Context) -> usize {
273 40
274 }
275 }
276
277 unsafe impl<D: fidl::encoding::ResourceDialect>
278 fidl::encoding::Encode<ProfileProviderGetDeadlineProfileRequest, D>
279 for &ProfileProviderGetDeadlineProfileRequest
280 {
281 #[inline]
282 unsafe fn encode(
283 self,
284 encoder: &mut fidl::encoding::Encoder<'_, D>,
285 offset: usize,
286 _depth: fidl::encoding::Depth,
287 ) -> fidl::Result<()> {
288 encoder.debug_check_bounds::<ProfileProviderGetDeadlineProfileRequest>(offset);
289 fidl::encoding::Encode::<ProfileProviderGetDeadlineProfileRequest, D>::encode(
291 (
292 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.capacity),
293 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline),
294 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.period),
295 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
296 &self.name,
297 ),
298 ),
299 encoder,
300 offset,
301 _depth,
302 )
303 }
304 }
305 unsafe impl<
306 D: fidl::encoding::ResourceDialect,
307 T0: fidl::encoding::Encode<u64, D>,
308 T1: fidl::encoding::Encode<u64, D>,
309 T2: fidl::encoding::Encode<u64, D>,
310 T3: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
311 > fidl::encoding::Encode<ProfileProviderGetDeadlineProfileRequest, D> for (T0, T1, T2, T3)
312 {
313 #[inline]
314 unsafe fn encode(
315 self,
316 encoder: &mut fidl::encoding::Encoder<'_, D>,
317 offset: usize,
318 depth: fidl::encoding::Depth,
319 ) -> fidl::Result<()> {
320 encoder.debug_check_bounds::<ProfileProviderGetDeadlineProfileRequest>(offset);
321 self.0.encode(encoder, offset + 0, depth)?;
325 self.1.encode(encoder, offset + 8, depth)?;
326 self.2.encode(encoder, offset + 16, depth)?;
327 self.3.encode(encoder, offset + 24, depth)?;
328 Ok(())
329 }
330 }
331
332 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
333 for ProfileProviderGetDeadlineProfileRequest
334 {
335 #[inline(always)]
336 fn new_empty() -> Self {
337 Self {
338 capacity: fidl::new_empty!(u64, D),
339 deadline: fidl::new_empty!(u64, D),
340 period: fidl::new_empty!(u64, D),
341 name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
342 }
343 }
344
345 #[inline]
346 unsafe fn decode(
347 &mut self,
348 decoder: &mut fidl::encoding::Decoder<'_, D>,
349 offset: usize,
350 _depth: fidl::encoding::Depth,
351 ) -> fidl::Result<()> {
352 decoder.debug_check_bounds::<Self>(offset);
353 fidl::decode!(u64, D, &mut self.capacity, decoder, offset + 0, _depth)?;
355 fidl::decode!(u64, D, &mut self.deadline, decoder, offset + 8, _depth)?;
356 fidl::decode!(u64, D, &mut self.period, decoder, offset + 16, _depth)?;
357 fidl::decode!(
358 fidl::encoding::BoundedString<64>,
359 D,
360 &mut self.name,
361 decoder,
362 offset + 24,
363 _depth
364 )?;
365 Ok(())
366 }
367 }
368
369 impl fidl::encoding::ValueTypeMarker for ProfileProviderGetProfileRequest {
370 type Borrowed<'a> = &'a Self;
371 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
372 value
373 }
374 }
375
376 unsafe impl fidl::encoding::TypeMarker for ProfileProviderGetProfileRequest {
377 type Owned = Self;
378
379 #[inline(always)]
380 fn inline_align(_context: fidl::encoding::Context) -> usize {
381 8
382 }
383
384 #[inline(always)]
385 fn inline_size(_context: fidl::encoding::Context) -> usize {
386 24
387 }
388 }
389
390 unsafe impl<D: fidl::encoding::ResourceDialect>
391 fidl::encoding::Encode<ProfileProviderGetProfileRequest, D>
392 for &ProfileProviderGetProfileRequest
393 {
394 #[inline]
395 unsafe fn encode(
396 self,
397 encoder: &mut fidl::encoding::Encoder<'_, D>,
398 offset: usize,
399 _depth: fidl::encoding::Depth,
400 ) -> fidl::Result<()> {
401 encoder.debug_check_bounds::<ProfileProviderGetProfileRequest>(offset);
402 fidl::encoding::Encode::<ProfileProviderGetProfileRequest, D>::encode(
404 (
405 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
406 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
407 &self.name,
408 ),
409 ),
410 encoder,
411 offset,
412 _depth,
413 )
414 }
415 }
416 unsafe impl<
417 D: fidl::encoding::ResourceDialect,
418 T0: fidl::encoding::Encode<u32, D>,
419 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
420 > fidl::encoding::Encode<ProfileProviderGetProfileRequest, D> for (T0, T1)
421 {
422 #[inline]
423 unsafe fn encode(
424 self,
425 encoder: &mut fidl::encoding::Encoder<'_, D>,
426 offset: usize,
427 depth: fidl::encoding::Depth,
428 ) -> fidl::Result<()> {
429 encoder.debug_check_bounds::<ProfileProviderGetProfileRequest>(offset);
430 unsafe {
433 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
434 (ptr as *mut u64).write_unaligned(0);
435 }
436 self.0.encode(encoder, offset + 0, depth)?;
438 self.1.encode(encoder, offset + 8, depth)?;
439 Ok(())
440 }
441 }
442
443 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
444 for ProfileProviderGetProfileRequest
445 {
446 #[inline(always)]
447 fn new_empty() -> Self {
448 Self {
449 priority: fidl::new_empty!(u32, D),
450 name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
451 }
452 }
453
454 #[inline]
455 unsafe fn decode(
456 &mut self,
457 decoder: &mut fidl::encoding::Decoder<'_, D>,
458 offset: usize,
459 _depth: fidl::encoding::Depth,
460 ) -> fidl::Result<()> {
461 decoder.debug_check_bounds::<Self>(offset);
462 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
464 let padval = unsafe { (ptr as *const u64).read_unaligned() };
465 let mask = 0xffffffff00000000u64;
466 let maskedval = padval & mask;
467 if maskedval != 0 {
468 return Err(fidl::Error::NonZeroPadding {
469 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
470 });
471 }
472 fidl::decode!(u32, D, &mut self.priority, decoder, offset + 0, _depth)?;
473 fidl::decode!(
474 fidl::encoding::BoundedString<64>,
475 D,
476 &mut self.name,
477 decoder,
478 offset + 8,
479 _depth
480 )?;
481 Ok(())
482 }
483 }
484
485 impl fidl::encoding::ValueTypeMarker for ProfileProviderSetProfileByRoleResponse {
486 type Borrowed<'a> = &'a Self;
487 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
488 value
489 }
490 }
491
492 unsafe impl fidl::encoding::TypeMarker for ProfileProviderSetProfileByRoleResponse {
493 type Owned = Self;
494
495 #[inline(always)]
496 fn inline_align(_context: fidl::encoding::Context) -> usize {
497 4
498 }
499
500 #[inline(always)]
501 fn inline_size(_context: fidl::encoding::Context) -> usize {
502 4
503 }
504 #[inline(always)]
505 fn encode_is_copy() -> bool {
506 true
507 }
508
509 #[inline(always)]
510 fn decode_is_copy() -> bool {
511 true
512 }
513 }
514
515 unsafe impl<D: fidl::encoding::ResourceDialect>
516 fidl::encoding::Encode<ProfileProviderSetProfileByRoleResponse, D>
517 for &ProfileProviderSetProfileByRoleResponse
518 {
519 #[inline]
520 unsafe fn encode(
521 self,
522 encoder: &mut fidl::encoding::Encoder<'_, D>,
523 offset: usize,
524 _depth: fidl::encoding::Depth,
525 ) -> fidl::Result<()> {
526 encoder.debug_check_bounds::<ProfileProviderSetProfileByRoleResponse>(offset);
527 unsafe {
528 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
530 (buf_ptr as *mut ProfileProviderSetProfileByRoleResponse).write_unaligned(
531 (self as *const ProfileProviderSetProfileByRoleResponse).read(),
532 );
533 }
536 Ok(())
537 }
538 }
539 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
540 fidl::encoding::Encode<ProfileProviderSetProfileByRoleResponse, D> for (T0,)
541 {
542 #[inline]
543 unsafe fn encode(
544 self,
545 encoder: &mut fidl::encoding::Encoder<'_, D>,
546 offset: usize,
547 depth: fidl::encoding::Depth,
548 ) -> fidl::Result<()> {
549 encoder.debug_check_bounds::<ProfileProviderSetProfileByRoleResponse>(offset);
550 self.0.encode(encoder, offset + 0, depth)?;
554 Ok(())
555 }
556 }
557
558 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
559 for ProfileProviderSetProfileByRoleResponse
560 {
561 #[inline(always)]
562 fn new_empty() -> Self {
563 Self { status: fidl::new_empty!(i32, D) }
564 }
565
566 #[inline]
567 unsafe fn decode(
568 &mut self,
569 decoder: &mut fidl::encoding::Decoder<'_, D>,
570 offset: usize,
571 _depth: fidl::encoding::Depth,
572 ) -> fidl::Result<()> {
573 decoder.debug_check_bounds::<Self>(offset);
574 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
575 unsafe {
578 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
579 }
580 Ok(())
581 }
582 }
583}