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
11pub type DependencyType = fidl_fuchsia_power_broker::DependencyType;
12
13pub type ElementName = String;
14
15pub type PowerLevel = u8;
16
17pub const MAX_DEPENDENCIES: u16 = MAX_VALID_POWER_LEVELS as u16;
18
19pub const MAX_ELEMENTS: u16 = 256;
20
21pub const MAX_ELEMENT_NAME_LEN: u16 = fidl_fuchsia_power_broker::MAX_ELEMENT_NAME_LEN as u16;
22
23pub const MAX_VALID_POWER_LEVELS: u16 = fidl_fuchsia_power_broker::MAX_VALID_POWER_LEVELS as u16;
24
25#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
27#[repr(u32)]
28pub enum CreateTopologyGraphError {
29 Internal = 1,
31 InvalidTopology = 2,
34}
35
36impl CreateTopologyGraphError {
37 #[inline]
38 pub fn from_primitive(prim: u32) -> Option<Self> {
39 match prim {
40 1 => Some(Self::Internal),
41 2 => Some(Self::InvalidTopology),
42 _ => None,
43 }
44 }
45
46 #[inline]
47 pub const fn into_primitive(self) -> u32 {
48 self as u32
49 }
50
51 #[deprecated = "Strict enums should not use `is_unknown`"]
52 #[inline]
53 pub fn is_unknown(&self) -> bool {
54 false
55 }
56}
57
58#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
61#[repr(u32)]
62pub enum LeaseControlError {
63 Internal = 1,
65 InvalidElement = 2,
68}
69
70impl LeaseControlError {
71 #[inline]
72 pub fn from_primitive(prim: u32) -> Option<Self> {
73 match prim {
74 1 => Some(Self::Internal),
75 2 => Some(Self::InvalidElement),
76 _ => None,
77 }
78 }
79
80 #[inline]
81 pub const fn into_primitive(self) -> u32 {
82 self as u32
83 }
84
85 #[deprecated = "Strict enums should not use `is_unknown`"]
86 #[inline]
87 pub fn is_unknown(&self) -> bool {
88 false
89 }
90}
91
92#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
94#[repr(u32)]
95pub enum OpenStatusChannelError {
96 Internal = 1,
98 InvalidElement = 2,
101}
102
103impl OpenStatusChannelError {
104 #[inline]
105 pub fn from_primitive(prim: u32) -> Option<Self> {
106 match prim {
107 1 => Some(Self::Internal),
108 2 => Some(Self::InvalidElement),
109 _ => None,
110 }
111 }
112
113 #[inline]
114 pub const fn into_primitive(self) -> u32 {
115 self as u32
116 }
117
118 #[deprecated = "Strict enums should not use `is_unknown`"]
119 #[inline]
120 pub fn is_unknown(&self) -> bool {
121 false
122 }
123}
124
125#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
127#[repr(u32)]
128pub enum SystemActivityControlError {
129 Internal = 1,
131}
132
133impl SystemActivityControlError {
134 #[inline]
135 pub fn from_primitive(prim: u32) -> Option<Self> {
136 match prim {
137 1 => Some(Self::Internal),
138 _ => None,
139 }
140 }
141
142 #[inline]
143 pub const fn into_primitive(self) -> u32 {
144 self as u32
145 }
146
147 #[deprecated = "Strict enums should not use `is_unknown`"]
148 #[inline]
149 pub fn is_unknown(&self) -> bool {
150 false
151 }
152}
153
154#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
156pub struct Element {
157 pub element_name: String,
158 pub initial_current_level: u8,
159 pub valid_levels: Vec<u8>,
160 pub dependencies: Vec<LevelDependency>,
161}
162
163impl fidl::Persistable for Element {}
164
165#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
167pub struct LevelDependency {
168 pub dependency_type: fidl_fuchsia_power_broker::DependencyType,
169 pub dependent_level: u8,
170 pub requires_element: String,
171 pub requires_level: u8,
172}
173
174impl fidl::Persistable for LevelDependency {}
175
176#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
177pub struct TopologyControlAcquireLeaseRequest {
178 pub element_name: String,
179 pub level: u8,
181}
182
183impl fidl::Persistable for TopologyControlAcquireLeaseRequest {}
184
185#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
186pub struct TopologyControlCreateRequest {
187 pub elements: Vec<Element>,
189}
190
191impl fidl::Persistable for TopologyControlCreateRequest {}
192
193#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
194pub struct TopologyControlDropLeaseRequest {
195 pub element_name: String,
196}
197
198impl fidl::Persistable for TopologyControlDropLeaseRequest {}
199
200mod internal {
201 use super::*;
202 unsafe impl fidl::encoding::TypeMarker for CreateTopologyGraphError {
203 type Owned = Self;
204
205 #[inline(always)]
206 fn inline_align(_context: fidl::encoding::Context) -> usize {
207 std::mem::align_of::<u32>()
208 }
209
210 #[inline(always)]
211 fn inline_size(_context: fidl::encoding::Context) -> usize {
212 std::mem::size_of::<u32>()
213 }
214
215 #[inline(always)]
216 fn encode_is_copy() -> bool {
217 true
218 }
219
220 #[inline(always)]
221 fn decode_is_copy() -> bool {
222 false
223 }
224 }
225
226 impl fidl::encoding::ValueTypeMarker for CreateTopologyGraphError {
227 type Borrowed<'a> = Self;
228 #[inline(always)]
229 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
230 *value
231 }
232 }
233
234 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
235 for CreateTopologyGraphError
236 {
237 #[inline]
238 unsafe fn encode(
239 self,
240 encoder: &mut fidl::encoding::Encoder<'_, D>,
241 offset: usize,
242 _depth: fidl::encoding::Depth,
243 ) -> fidl::Result<()> {
244 encoder.debug_check_bounds::<Self>(offset);
245 encoder.write_num(self.into_primitive(), offset);
246 Ok(())
247 }
248 }
249
250 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
251 for CreateTopologyGraphError
252 {
253 #[inline(always)]
254 fn new_empty() -> Self {
255 Self::Internal
256 }
257
258 #[inline]
259 unsafe fn decode(
260 &mut self,
261 decoder: &mut fidl::encoding::Decoder<'_, D>,
262 offset: usize,
263 _depth: fidl::encoding::Depth,
264 ) -> fidl::Result<()> {
265 decoder.debug_check_bounds::<Self>(offset);
266 let prim = decoder.read_num::<u32>(offset);
267
268 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
269 Ok(())
270 }
271 }
272 unsafe impl fidl::encoding::TypeMarker for LeaseControlError {
273 type Owned = Self;
274
275 #[inline(always)]
276 fn inline_align(_context: fidl::encoding::Context) -> usize {
277 std::mem::align_of::<u32>()
278 }
279
280 #[inline(always)]
281 fn inline_size(_context: fidl::encoding::Context) -> usize {
282 std::mem::size_of::<u32>()
283 }
284
285 #[inline(always)]
286 fn encode_is_copy() -> bool {
287 true
288 }
289
290 #[inline(always)]
291 fn decode_is_copy() -> bool {
292 false
293 }
294 }
295
296 impl fidl::encoding::ValueTypeMarker for LeaseControlError {
297 type Borrowed<'a> = Self;
298 #[inline(always)]
299 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
300 *value
301 }
302 }
303
304 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
305 for LeaseControlError
306 {
307 #[inline]
308 unsafe fn encode(
309 self,
310 encoder: &mut fidl::encoding::Encoder<'_, D>,
311 offset: usize,
312 _depth: fidl::encoding::Depth,
313 ) -> fidl::Result<()> {
314 encoder.debug_check_bounds::<Self>(offset);
315 encoder.write_num(self.into_primitive(), offset);
316 Ok(())
317 }
318 }
319
320 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeaseControlError {
321 #[inline(always)]
322 fn new_empty() -> Self {
323 Self::Internal
324 }
325
326 #[inline]
327 unsafe fn decode(
328 &mut self,
329 decoder: &mut fidl::encoding::Decoder<'_, D>,
330 offset: usize,
331 _depth: fidl::encoding::Depth,
332 ) -> fidl::Result<()> {
333 decoder.debug_check_bounds::<Self>(offset);
334 let prim = decoder.read_num::<u32>(offset);
335
336 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
337 Ok(())
338 }
339 }
340 unsafe impl fidl::encoding::TypeMarker for OpenStatusChannelError {
341 type Owned = Self;
342
343 #[inline(always)]
344 fn inline_align(_context: fidl::encoding::Context) -> usize {
345 std::mem::align_of::<u32>()
346 }
347
348 #[inline(always)]
349 fn inline_size(_context: fidl::encoding::Context) -> usize {
350 std::mem::size_of::<u32>()
351 }
352
353 #[inline(always)]
354 fn encode_is_copy() -> bool {
355 true
356 }
357
358 #[inline(always)]
359 fn decode_is_copy() -> bool {
360 false
361 }
362 }
363
364 impl fidl::encoding::ValueTypeMarker for OpenStatusChannelError {
365 type Borrowed<'a> = Self;
366 #[inline(always)]
367 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
368 *value
369 }
370 }
371
372 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
373 for OpenStatusChannelError
374 {
375 #[inline]
376 unsafe fn encode(
377 self,
378 encoder: &mut fidl::encoding::Encoder<'_, D>,
379 offset: usize,
380 _depth: fidl::encoding::Depth,
381 ) -> fidl::Result<()> {
382 encoder.debug_check_bounds::<Self>(offset);
383 encoder.write_num(self.into_primitive(), offset);
384 Ok(())
385 }
386 }
387
388 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
389 for OpenStatusChannelError
390 {
391 #[inline(always)]
392 fn new_empty() -> Self {
393 Self::Internal
394 }
395
396 #[inline]
397 unsafe fn decode(
398 &mut self,
399 decoder: &mut fidl::encoding::Decoder<'_, D>,
400 offset: usize,
401 _depth: fidl::encoding::Depth,
402 ) -> fidl::Result<()> {
403 decoder.debug_check_bounds::<Self>(offset);
404 let prim = decoder.read_num::<u32>(offset);
405
406 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
407 Ok(())
408 }
409 }
410 unsafe impl fidl::encoding::TypeMarker for SystemActivityControlError {
411 type Owned = Self;
412
413 #[inline(always)]
414 fn inline_align(_context: fidl::encoding::Context) -> usize {
415 std::mem::align_of::<u32>()
416 }
417
418 #[inline(always)]
419 fn inline_size(_context: fidl::encoding::Context) -> usize {
420 std::mem::size_of::<u32>()
421 }
422
423 #[inline(always)]
424 fn encode_is_copy() -> bool {
425 true
426 }
427
428 #[inline(always)]
429 fn decode_is_copy() -> bool {
430 false
431 }
432 }
433
434 impl fidl::encoding::ValueTypeMarker for SystemActivityControlError {
435 type Borrowed<'a> = Self;
436 #[inline(always)]
437 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
438 *value
439 }
440 }
441
442 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
443 for SystemActivityControlError
444 {
445 #[inline]
446 unsafe fn encode(
447 self,
448 encoder: &mut fidl::encoding::Encoder<'_, D>,
449 offset: usize,
450 _depth: fidl::encoding::Depth,
451 ) -> fidl::Result<()> {
452 encoder.debug_check_bounds::<Self>(offset);
453 encoder.write_num(self.into_primitive(), offset);
454 Ok(())
455 }
456 }
457
458 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
459 for SystemActivityControlError
460 {
461 #[inline(always)]
462 fn new_empty() -> Self {
463 Self::Internal
464 }
465
466 #[inline]
467 unsafe fn decode(
468 &mut self,
469 decoder: &mut fidl::encoding::Decoder<'_, D>,
470 offset: usize,
471 _depth: fidl::encoding::Depth,
472 ) -> fidl::Result<()> {
473 decoder.debug_check_bounds::<Self>(offset);
474 let prim = decoder.read_num::<u32>(offset);
475
476 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
477 Ok(())
478 }
479 }
480
481 impl fidl::encoding::ValueTypeMarker for Element {
482 type Borrowed<'a> = &'a Self;
483 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
484 value
485 }
486 }
487
488 unsafe impl fidl::encoding::TypeMarker for Element {
489 type Owned = Self;
490
491 #[inline(always)]
492 fn inline_align(_context: fidl::encoding::Context) -> usize {
493 8
494 }
495
496 #[inline(always)]
497 fn inline_size(_context: fidl::encoding::Context) -> usize {
498 56
499 }
500 }
501
502 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Element, D> for &Element {
503 #[inline]
504 unsafe fn encode(
505 self,
506 encoder: &mut fidl::encoding::Encoder<'_, D>,
507 offset: usize,
508 _depth: fidl::encoding::Depth,
509 ) -> fidl::Result<()> {
510 encoder.debug_check_bounds::<Element>(offset);
511 fidl::encoding::Encode::<Element, D>::encode(
513 (
514 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(&self.element_name),
515 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_current_level),
516 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.valid_levels),
517 <fidl::encoding::Vector<LevelDependency, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.dependencies),
518 ),
519 encoder, offset, _depth
520 )
521 }
522 }
523 unsafe impl<
524 D: fidl::encoding::ResourceDialect,
525 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
526 T1: fidl::encoding::Encode<u8, D>,
527 T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
528 T3: fidl::encoding::Encode<fidl::encoding::Vector<LevelDependency, 256>, D>,
529 > fidl::encoding::Encode<Element, D> for (T0, T1, T2, T3)
530 {
531 #[inline]
532 unsafe fn encode(
533 self,
534 encoder: &mut fidl::encoding::Encoder<'_, D>,
535 offset: usize,
536 depth: fidl::encoding::Depth,
537 ) -> fidl::Result<()> {
538 encoder.debug_check_bounds::<Element>(offset);
539 unsafe {
542 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
543 (ptr as *mut u64).write_unaligned(0);
544 }
545 self.0.encode(encoder, offset + 0, depth)?;
547 self.1.encode(encoder, offset + 16, depth)?;
548 self.2.encode(encoder, offset + 24, depth)?;
549 self.3.encode(encoder, offset + 40, depth)?;
550 Ok(())
551 }
552 }
553
554 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Element {
555 #[inline(always)]
556 fn new_empty() -> Self {
557 Self {
558 element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
559 initial_current_level: fidl::new_empty!(u8, D),
560 valid_levels: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
561 dependencies: fidl::new_empty!(fidl::encoding::Vector<LevelDependency, 256>, D),
562 }
563 }
564
565 #[inline]
566 unsafe fn decode(
567 &mut self,
568 decoder: &mut fidl::encoding::Decoder<'_, D>,
569 offset: usize,
570 _depth: fidl::encoding::Depth,
571 ) -> fidl::Result<()> {
572 decoder.debug_check_bounds::<Self>(offset);
573 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
575 let padval = unsafe { (ptr as *const u64).read_unaligned() };
576 let mask = 0xffffffffffffff00u64;
577 let maskedval = padval & mask;
578 if maskedval != 0 {
579 return Err(fidl::Error::NonZeroPadding {
580 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
581 });
582 }
583 fidl::decode!(
584 fidl::encoding::BoundedString<64>,
585 D,
586 &mut self.element_name,
587 decoder,
588 offset + 0,
589 _depth
590 )?;
591 fidl::decode!(u8, D, &mut self.initial_current_level, decoder, offset + 16, _depth)?;
592 fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.valid_levels, decoder, offset + 24, _depth)?;
593 fidl::decode!(fidl::encoding::Vector<LevelDependency, 256>, D, &mut self.dependencies, decoder, offset + 40, _depth)?;
594 Ok(())
595 }
596 }
597
598 impl fidl::encoding::ValueTypeMarker for LevelDependency {
599 type Borrowed<'a> = &'a Self;
600 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
601 value
602 }
603 }
604
605 unsafe impl fidl::encoding::TypeMarker for LevelDependency {
606 type Owned = Self;
607
608 #[inline(always)]
609 fn inline_align(_context: fidl::encoding::Context) -> usize {
610 8
611 }
612
613 #[inline(always)]
614 fn inline_size(_context: fidl::encoding::Context) -> usize {
615 32
616 }
617 }
618
619 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LevelDependency, D>
620 for &LevelDependency
621 {
622 #[inline]
623 unsafe fn encode(
624 self,
625 encoder: &mut fidl::encoding::Encoder<'_, D>,
626 offset: usize,
627 _depth: fidl::encoding::Depth,
628 ) -> fidl::Result<()> {
629 encoder.debug_check_bounds::<LevelDependency>(offset);
630 fidl::encoding::Encode::<LevelDependency, D>::encode(
632 (
633 <fidl_fuchsia_power_broker::DependencyType as fidl::encoding::ValueTypeMarker>::borrow(&self.dependency_type),
634 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dependent_level),
635 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(&self.requires_element),
636 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.requires_level),
637 ),
638 encoder, offset, _depth
639 )
640 }
641 }
642 unsafe impl<
643 D: fidl::encoding::ResourceDialect,
644 T0: fidl::encoding::Encode<fidl_fuchsia_power_broker::DependencyType, D>,
645 T1: fidl::encoding::Encode<u8, D>,
646 T2: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
647 T3: fidl::encoding::Encode<u8, D>,
648 > fidl::encoding::Encode<LevelDependency, D> for (T0, T1, T2, T3)
649 {
650 #[inline]
651 unsafe fn encode(
652 self,
653 encoder: &mut fidl::encoding::Encoder<'_, D>,
654 offset: usize,
655 depth: fidl::encoding::Depth,
656 ) -> fidl::Result<()> {
657 encoder.debug_check_bounds::<LevelDependency>(offset);
658 unsafe {
661 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
662 (ptr as *mut u64).write_unaligned(0);
663 }
664 unsafe {
665 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
666 (ptr as *mut u64).write_unaligned(0);
667 }
668 self.0.encode(encoder, offset + 0, depth)?;
670 self.1.encode(encoder, offset + 4, depth)?;
671 self.2.encode(encoder, offset + 8, depth)?;
672 self.3.encode(encoder, offset + 24, depth)?;
673 Ok(())
674 }
675 }
676
677 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LevelDependency {
678 #[inline(always)]
679 fn new_empty() -> Self {
680 Self {
681 dependency_type: fidl::new_empty!(fidl_fuchsia_power_broker::DependencyType, D),
682 dependent_level: fidl::new_empty!(u8, D),
683 requires_element: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
684 requires_level: fidl::new_empty!(u8, D),
685 }
686 }
687
688 #[inline]
689 unsafe fn decode(
690 &mut self,
691 decoder: &mut fidl::encoding::Decoder<'_, D>,
692 offset: usize,
693 _depth: fidl::encoding::Depth,
694 ) -> fidl::Result<()> {
695 decoder.debug_check_bounds::<Self>(offset);
696 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
698 let padval = unsafe { (ptr as *const u64).read_unaligned() };
699 let mask = 0xffffff0000000000u64;
700 let maskedval = padval & mask;
701 if maskedval != 0 {
702 return Err(fidl::Error::NonZeroPadding {
703 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
704 });
705 }
706 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
707 let padval = unsafe { (ptr as *const u64).read_unaligned() };
708 let mask = 0xffffffffffffff00u64;
709 let maskedval = padval & mask;
710 if maskedval != 0 {
711 return Err(fidl::Error::NonZeroPadding {
712 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
713 });
714 }
715 fidl::decode!(
716 fidl_fuchsia_power_broker::DependencyType,
717 D,
718 &mut self.dependency_type,
719 decoder,
720 offset + 0,
721 _depth
722 )?;
723 fidl::decode!(u8, D, &mut self.dependent_level, decoder, offset + 4, _depth)?;
724 fidl::decode!(
725 fidl::encoding::BoundedString<64>,
726 D,
727 &mut self.requires_element,
728 decoder,
729 offset + 8,
730 _depth
731 )?;
732 fidl::decode!(u8, D, &mut self.requires_level, decoder, offset + 24, _depth)?;
733 Ok(())
734 }
735 }
736
737 impl fidl::encoding::ValueTypeMarker for TopologyControlAcquireLeaseRequest {
738 type Borrowed<'a> = &'a Self;
739 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
740 value
741 }
742 }
743
744 unsafe impl fidl::encoding::TypeMarker for TopologyControlAcquireLeaseRequest {
745 type Owned = Self;
746
747 #[inline(always)]
748 fn inline_align(_context: fidl::encoding::Context) -> usize {
749 8
750 }
751
752 #[inline(always)]
753 fn inline_size(_context: fidl::encoding::Context) -> usize {
754 24
755 }
756 }
757
758 unsafe impl<D: fidl::encoding::ResourceDialect>
759 fidl::encoding::Encode<TopologyControlAcquireLeaseRequest, D>
760 for &TopologyControlAcquireLeaseRequest
761 {
762 #[inline]
763 unsafe fn encode(
764 self,
765 encoder: &mut fidl::encoding::Encoder<'_, D>,
766 offset: usize,
767 _depth: fidl::encoding::Depth,
768 ) -> fidl::Result<()> {
769 encoder.debug_check_bounds::<TopologyControlAcquireLeaseRequest>(offset);
770 fidl::encoding::Encode::<TopologyControlAcquireLeaseRequest, D>::encode(
772 (
773 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
774 &self.element_name,
775 ),
776 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.level),
777 ),
778 encoder,
779 offset,
780 _depth,
781 )
782 }
783 }
784 unsafe impl<
785 D: fidl::encoding::ResourceDialect,
786 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
787 T1: fidl::encoding::Encode<u8, D>,
788 > fidl::encoding::Encode<TopologyControlAcquireLeaseRequest, D> for (T0, T1)
789 {
790 #[inline]
791 unsafe fn encode(
792 self,
793 encoder: &mut fidl::encoding::Encoder<'_, D>,
794 offset: usize,
795 depth: fidl::encoding::Depth,
796 ) -> fidl::Result<()> {
797 encoder.debug_check_bounds::<TopologyControlAcquireLeaseRequest>(offset);
798 unsafe {
801 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
802 (ptr as *mut u64).write_unaligned(0);
803 }
804 self.0.encode(encoder, offset + 0, depth)?;
806 self.1.encode(encoder, offset + 16, depth)?;
807 Ok(())
808 }
809 }
810
811 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
812 for TopologyControlAcquireLeaseRequest
813 {
814 #[inline(always)]
815 fn new_empty() -> Self {
816 Self {
817 element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
818 level: fidl::new_empty!(u8, D),
819 }
820 }
821
822 #[inline]
823 unsafe fn decode(
824 &mut self,
825 decoder: &mut fidl::encoding::Decoder<'_, D>,
826 offset: usize,
827 _depth: fidl::encoding::Depth,
828 ) -> fidl::Result<()> {
829 decoder.debug_check_bounds::<Self>(offset);
830 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
832 let padval = unsafe { (ptr as *const u64).read_unaligned() };
833 let mask = 0xffffffffffffff00u64;
834 let maskedval = padval & mask;
835 if maskedval != 0 {
836 return Err(fidl::Error::NonZeroPadding {
837 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
838 });
839 }
840 fidl::decode!(
841 fidl::encoding::BoundedString<64>,
842 D,
843 &mut self.element_name,
844 decoder,
845 offset + 0,
846 _depth
847 )?;
848 fidl::decode!(u8, D, &mut self.level, decoder, offset + 16, _depth)?;
849 Ok(())
850 }
851 }
852
853 impl fidl::encoding::ValueTypeMarker for TopologyControlCreateRequest {
854 type Borrowed<'a> = &'a Self;
855 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
856 value
857 }
858 }
859
860 unsafe impl fidl::encoding::TypeMarker for TopologyControlCreateRequest {
861 type Owned = Self;
862
863 #[inline(always)]
864 fn inline_align(_context: fidl::encoding::Context) -> usize {
865 8
866 }
867
868 #[inline(always)]
869 fn inline_size(_context: fidl::encoding::Context) -> usize {
870 16
871 }
872 }
873
874 unsafe impl<D: fidl::encoding::ResourceDialect>
875 fidl::encoding::Encode<TopologyControlCreateRequest, D> for &TopologyControlCreateRequest
876 {
877 #[inline]
878 unsafe fn encode(
879 self,
880 encoder: &mut fidl::encoding::Encoder<'_, D>,
881 offset: usize,
882 _depth: fidl::encoding::Depth,
883 ) -> fidl::Result<()> {
884 encoder.debug_check_bounds::<TopologyControlCreateRequest>(offset);
885 fidl::encoding::Encode::<TopologyControlCreateRequest, D>::encode(
887 (
888 <fidl::encoding::Vector<Element, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.elements),
889 ),
890 encoder, offset, _depth
891 )
892 }
893 }
894 unsafe impl<
895 D: fidl::encoding::ResourceDialect,
896 T0: fidl::encoding::Encode<fidl::encoding::Vector<Element, 256>, D>,
897 > fidl::encoding::Encode<TopologyControlCreateRequest, D> for (T0,)
898 {
899 #[inline]
900 unsafe fn encode(
901 self,
902 encoder: &mut fidl::encoding::Encoder<'_, D>,
903 offset: usize,
904 depth: fidl::encoding::Depth,
905 ) -> fidl::Result<()> {
906 encoder.debug_check_bounds::<TopologyControlCreateRequest>(offset);
907 self.0.encode(encoder, offset + 0, depth)?;
911 Ok(())
912 }
913 }
914
915 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
916 for TopologyControlCreateRequest
917 {
918 #[inline(always)]
919 fn new_empty() -> Self {
920 Self { elements: fidl::new_empty!(fidl::encoding::Vector<Element, 256>, D) }
921 }
922
923 #[inline]
924 unsafe fn decode(
925 &mut self,
926 decoder: &mut fidl::encoding::Decoder<'_, D>,
927 offset: usize,
928 _depth: fidl::encoding::Depth,
929 ) -> fidl::Result<()> {
930 decoder.debug_check_bounds::<Self>(offset);
931 fidl::decode!(fidl::encoding::Vector<Element, 256>, D, &mut self.elements, decoder, offset + 0, _depth)?;
933 Ok(())
934 }
935 }
936
937 impl fidl::encoding::ValueTypeMarker for TopologyControlDropLeaseRequest {
938 type Borrowed<'a> = &'a Self;
939 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
940 value
941 }
942 }
943
944 unsafe impl fidl::encoding::TypeMarker for TopologyControlDropLeaseRequest {
945 type Owned = Self;
946
947 #[inline(always)]
948 fn inline_align(_context: fidl::encoding::Context) -> usize {
949 8
950 }
951
952 #[inline(always)]
953 fn inline_size(_context: fidl::encoding::Context) -> usize {
954 16
955 }
956 }
957
958 unsafe impl<D: fidl::encoding::ResourceDialect>
959 fidl::encoding::Encode<TopologyControlDropLeaseRequest, D>
960 for &TopologyControlDropLeaseRequest
961 {
962 #[inline]
963 unsafe fn encode(
964 self,
965 encoder: &mut fidl::encoding::Encoder<'_, D>,
966 offset: usize,
967 _depth: fidl::encoding::Depth,
968 ) -> fidl::Result<()> {
969 encoder.debug_check_bounds::<TopologyControlDropLeaseRequest>(offset);
970 fidl::encoding::Encode::<TopologyControlDropLeaseRequest, D>::encode(
972 (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
973 &self.element_name,
974 ),),
975 encoder,
976 offset,
977 _depth,
978 )
979 }
980 }
981 unsafe impl<
982 D: fidl::encoding::ResourceDialect,
983 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
984 > fidl::encoding::Encode<TopologyControlDropLeaseRequest, D> for (T0,)
985 {
986 #[inline]
987 unsafe fn encode(
988 self,
989 encoder: &mut fidl::encoding::Encoder<'_, D>,
990 offset: usize,
991 depth: fidl::encoding::Depth,
992 ) -> fidl::Result<()> {
993 encoder.debug_check_bounds::<TopologyControlDropLeaseRequest>(offset);
994 self.0.encode(encoder, offset + 0, depth)?;
998 Ok(())
999 }
1000 }
1001
1002 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1003 for TopologyControlDropLeaseRequest
1004 {
1005 #[inline(always)]
1006 fn new_empty() -> Self {
1007 Self { element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
1008 }
1009
1010 #[inline]
1011 unsafe fn decode(
1012 &mut self,
1013 decoder: &mut fidl::encoding::Decoder<'_, D>,
1014 offset: usize,
1015 _depth: fidl::encoding::Depth,
1016 ) -> fidl::Result<()> {
1017 decoder.debug_check_bounds::<Self>(offset);
1018 fidl::decode!(
1020 fidl::encoding::BoundedString<64>,
1021 D,
1022 &mut self.element_name,
1023 decoder,
1024 offset + 0,
1025 _depth
1026 )?;
1027 Ok(())
1028 }
1029 }
1030}