1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
8 #[repr(u32)]
9 pub enum AddElementError {
10 Invalid = 1,
11 NotAuthorized = 2,
12 UnknownOrdinal_(u32) = 3,
13 }
14 impl ::std::convert::From<u32> for AddElementError {
15 fn from(value: u32) -> Self {
16 match value {
17 1 => Self::Invalid,
18 2 => Self::NotAuthorized,
19
20 _ => Self::UnknownOrdinal_(value),
21 }
22 }
23 }
24
25 unsafe impl<___E> ::fidl_next::Encode<crate::wire::AddElementError, ___E> for AddElementError
26 where
27 ___E: ?Sized,
28 {
29 #[inline]
30 fn encode(
31 self,
32 encoder: &mut ___E,
33 out: &mut ::core::mem::MaybeUninit<crate::wire::AddElementError>,
34 _: (),
35 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
36 ::fidl_next::Encode::encode(&self, encoder, out, ())
37 }
38 }
39
40 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::AddElementError, ___E>
41 for &'a AddElementError
42 where
43 ___E: ?Sized,
44 {
45 #[inline]
46 fn encode(
47 self,
48 encoder: &mut ___E,
49 out: &mut ::core::mem::MaybeUninit<crate::wire::AddElementError>,
50 _: (),
51 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
52 ::fidl_next::munge!(let crate::wire::AddElementError { value } = out);
53 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
54 AddElementError::Invalid => 1,
55
56 AddElementError::NotAuthorized => 2,
57
58 AddElementError::UnknownOrdinal_(value) => value,
59 }));
60
61 Ok(())
62 }
63 }
64
65 impl ::core::convert::From<crate::wire::AddElementError> for AddElementError {
66 fn from(wire: crate::wire::AddElementError) -> Self {
67 match u32::from(wire.value) {
68 1 => Self::Invalid,
69
70 2 => Self::NotAuthorized,
71
72 value => Self::UnknownOrdinal_(value),
73 }
74 }
75 }
76
77 impl ::fidl_next::FromWire<crate::wire::AddElementError> for AddElementError {
78 #[inline]
79 fn from_wire(wire: crate::wire::AddElementError) -> Self {
80 Self::from(wire)
81 }
82 }
83
84 impl ::fidl_next::FromWireRef<crate::wire::AddElementError> for AddElementError {
85 #[inline]
86 fn from_wire_ref(wire: &crate::wire::AddElementError) -> Self {
87 Self::from(*wire)
88 }
89 }
90
91 #[doc = " Used to describe the power level of an element.\n Could extend this further to support additional types of power\n levels, such as ACPI.\n"]
92 pub type PowerLevel = u8;
93
94 #[doc = " BinaryPowerLevel is a well-known set of PowerLevels with only two\n states: OFF and ON.\n"]
95 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
96 #[repr(u8)]
97 pub enum BinaryPowerLevel {
98 Off = 0,
99 On = 1,
100 }
101 impl ::core::convert::TryFrom<u8> for BinaryPowerLevel {
102 type Error = ::fidl_next::UnknownStrictEnumMemberError;
103 fn try_from(
104 value: u8,
105 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
106 match value {
107 0 => Ok(Self::Off),
108 1 => Ok(Self::On),
109
110 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
111 }
112 }
113 }
114
115 unsafe impl<___E> ::fidl_next::Encode<crate::wire::BinaryPowerLevel, ___E> for BinaryPowerLevel
116 where
117 ___E: ?Sized,
118 {
119 #[inline]
120 fn encode(
121 self,
122 encoder: &mut ___E,
123 out: &mut ::core::mem::MaybeUninit<crate::wire::BinaryPowerLevel>,
124 _: (),
125 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
126 ::fidl_next::Encode::encode(&self, encoder, out, ())
127 }
128 }
129
130 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::BinaryPowerLevel, ___E>
131 for &'a BinaryPowerLevel
132 where
133 ___E: ?Sized,
134 {
135 #[inline]
136 fn encode(
137 self,
138 encoder: &mut ___E,
139 out: &mut ::core::mem::MaybeUninit<crate::wire::BinaryPowerLevel>,
140 _: (),
141 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
142 ::fidl_next::munge!(let crate::wire::BinaryPowerLevel { value } = out);
143 let _ = value.write(u8::from(match *self {
144 BinaryPowerLevel::Off => 0,
145
146 BinaryPowerLevel::On => 1,
147 }));
148
149 Ok(())
150 }
151 }
152
153 impl ::core::convert::From<crate::wire::BinaryPowerLevel> for BinaryPowerLevel {
154 fn from(wire: crate::wire::BinaryPowerLevel) -> Self {
155 match u8::from(wire.value) {
156 0 => Self::Off,
157
158 1 => Self::On,
159
160 _ => unsafe { ::core::hint::unreachable_unchecked() },
161 }
162 }
163 }
164
165 impl ::fidl_next::FromWire<crate::wire::BinaryPowerLevel> for BinaryPowerLevel {
166 #[inline]
167 fn from_wire(wire: crate::wire::BinaryPowerLevel) -> Self {
168 Self::from(wire)
169 }
170 }
171
172 impl ::fidl_next::FromWireRef<crate::wire::BinaryPowerLevel> for BinaryPowerLevel {
173 #[inline]
174 fn from_wire_ref(wire: &crate::wire::BinaryPowerLevel) -> Self {
175 Self::from(*wire)
176 }
177 }
178
179 pub type ElementControlRegisterDependencyTokenResponse = ();
180
181 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
182 #[repr(u32)]
183 pub enum RegisterDependencyTokenError {
184 AlreadyInUse = 1,
185 Internal = 2,
186 UnknownOrdinal_(u32) = 3,
187 }
188 impl ::std::convert::From<u32> for RegisterDependencyTokenError {
189 fn from(value: u32) -> Self {
190 match value {
191 1 => Self::AlreadyInUse,
192 2 => Self::Internal,
193
194 _ => Self::UnknownOrdinal_(value),
195 }
196 }
197 }
198
199 unsafe impl<___E> ::fidl_next::Encode<crate::wire::RegisterDependencyTokenError, ___E>
200 for RegisterDependencyTokenError
201 where
202 ___E: ?Sized,
203 {
204 #[inline]
205 fn encode(
206 self,
207 encoder: &mut ___E,
208 out: &mut ::core::mem::MaybeUninit<crate::wire::RegisterDependencyTokenError>,
209 _: (),
210 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
211 ::fidl_next::Encode::encode(&self, encoder, out, ())
212 }
213 }
214
215 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::RegisterDependencyTokenError, ___E>
216 for &'a RegisterDependencyTokenError
217 where
218 ___E: ?Sized,
219 {
220 #[inline]
221 fn encode(
222 self,
223 encoder: &mut ___E,
224 out: &mut ::core::mem::MaybeUninit<crate::wire::RegisterDependencyTokenError>,
225 _: (),
226 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
227 ::fidl_next::munge!(let crate::wire::RegisterDependencyTokenError { value } = out);
228 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
229 RegisterDependencyTokenError::AlreadyInUse => 1,
230
231 RegisterDependencyTokenError::Internal => 2,
232
233 RegisterDependencyTokenError::UnknownOrdinal_(value) => value,
234 }));
235
236 Ok(())
237 }
238 }
239
240 impl ::core::convert::From<crate::wire::RegisterDependencyTokenError>
241 for RegisterDependencyTokenError
242 {
243 fn from(wire: crate::wire::RegisterDependencyTokenError) -> Self {
244 match u32::from(wire.value) {
245 1 => Self::AlreadyInUse,
246
247 2 => Self::Internal,
248
249 value => Self::UnknownOrdinal_(value),
250 }
251 }
252 }
253
254 impl ::fidl_next::FromWire<crate::wire::RegisterDependencyTokenError>
255 for RegisterDependencyTokenError
256 {
257 #[inline]
258 fn from_wire(wire: crate::wire::RegisterDependencyTokenError) -> Self {
259 Self::from(wire)
260 }
261 }
262
263 impl ::fidl_next::FromWireRef<crate::wire::RegisterDependencyTokenError>
264 for RegisterDependencyTokenError
265 {
266 #[inline]
267 fn from_wire_ref(wire: &crate::wire::RegisterDependencyTokenError) -> Self {
268 Self::from(*wire)
269 }
270 }
271
272 pub type ElementControlUnregisterDependencyTokenResponse = ();
273
274 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
275 #[repr(u32)]
276 pub enum UnregisterDependencyTokenError {
277 NotAuthorized = 1,
278 NotFound = 2,
279 UnknownOrdinal_(u32) = 3,
280 }
281 impl ::std::convert::From<u32> for UnregisterDependencyTokenError {
282 fn from(value: u32) -> Self {
283 match value {
284 1 => Self::NotAuthorized,
285 2 => Self::NotFound,
286
287 _ => Self::UnknownOrdinal_(value),
288 }
289 }
290 }
291
292 unsafe impl<___E> ::fidl_next::Encode<crate::wire::UnregisterDependencyTokenError, ___E>
293 for UnregisterDependencyTokenError
294 where
295 ___E: ?Sized,
296 {
297 #[inline]
298 fn encode(
299 self,
300 encoder: &mut ___E,
301 out: &mut ::core::mem::MaybeUninit<crate::wire::UnregisterDependencyTokenError>,
302 _: (),
303 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
304 ::fidl_next::Encode::encode(&self, encoder, out, ())
305 }
306 }
307
308 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::UnregisterDependencyTokenError, ___E>
309 for &'a UnregisterDependencyTokenError
310 where
311 ___E: ?Sized,
312 {
313 #[inline]
314 fn encode(
315 self,
316 encoder: &mut ___E,
317 out: &mut ::core::mem::MaybeUninit<crate::wire::UnregisterDependencyTokenError>,
318 _: (),
319 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
320 ::fidl_next::munge!(let crate::wire::UnregisterDependencyTokenError { value } = out);
321 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
322 UnregisterDependencyTokenError::NotAuthorized => 1,
323
324 UnregisterDependencyTokenError::NotFound => 2,
325
326 UnregisterDependencyTokenError::UnknownOrdinal_(value) => value,
327 }));
328
329 Ok(())
330 }
331 }
332
333 impl ::core::convert::From<crate::wire::UnregisterDependencyTokenError>
334 for UnregisterDependencyTokenError
335 {
336 fn from(wire: crate::wire::UnregisterDependencyTokenError) -> Self {
337 match u32::from(wire.value) {
338 1 => Self::NotAuthorized,
339
340 2 => Self::NotFound,
341
342 value => Self::UnknownOrdinal_(value),
343 }
344 }
345 }
346
347 impl ::fidl_next::FromWire<crate::wire::UnregisterDependencyTokenError>
348 for UnregisterDependencyTokenError
349 {
350 #[inline]
351 fn from_wire(wire: crate::wire::UnregisterDependencyTokenError) -> Self {
352 Self::from(wire)
353 }
354 }
355
356 impl ::fidl_next::FromWireRef<crate::wire::UnregisterDependencyTokenError>
357 for UnregisterDependencyTokenError
358 {
359 #[inline]
360 fn from_wire_ref(wire: &crate::wire::UnregisterDependencyTokenError) -> Self {
361 Self::from(*wire)
362 }
363 }
364
365 pub type ElementControlAddDependencyResponse = ();
366
367 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
368 #[repr(u32)]
369 pub enum ModifyDependencyError {
370 AlreadyExists = 1,
371 Invalid = 2,
372 NotAuthorized = 3,
373 NotFound = 4,
374 UnknownOrdinal_(u32) = 5,
375 }
376 impl ::std::convert::From<u32> for ModifyDependencyError {
377 fn from(value: u32) -> Self {
378 match value {
379 1 => Self::AlreadyExists,
380 2 => Self::Invalid,
381 3 => Self::NotAuthorized,
382 4 => Self::NotFound,
383
384 _ => Self::UnknownOrdinal_(value),
385 }
386 }
387 }
388
389 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ModifyDependencyError, ___E>
390 for ModifyDependencyError
391 where
392 ___E: ?Sized,
393 {
394 #[inline]
395 fn encode(
396 self,
397 encoder: &mut ___E,
398 out: &mut ::core::mem::MaybeUninit<crate::wire::ModifyDependencyError>,
399 _: (),
400 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
401 ::fidl_next::Encode::encode(&self, encoder, out, ())
402 }
403 }
404
405 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ModifyDependencyError, ___E>
406 for &'a ModifyDependencyError
407 where
408 ___E: ?Sized,
409 {
410 #[inline]
411 fn encode(
412 self,
413 encoder: &mut ___E,
414 out: &mut ::core::mem::MaybeUninit<crate::wire::ModifyDependencyError>,
415 _: (),
416 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
417 ::fidl_next::munge!(let crate::wire::ModifyDependencyError { value } = out);
418 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
419 ModifyDependencyError::AlreadyExists => 1,
420
421 ModifyDependencyError::Invalid => 2,
422
423 ModifyDependencyError::NotAuthorized => 3,
424
425 ModifyDependencyError::NotFound => 4,
426
427 ModifyDependencyError::UnknownOrdinal_(value) => value,
428 }));
429
430 Ok(())
431 }
432 }
433
434 impl ::core::convert::From<crate::wire::ModifyDependencyError> for ModifyDependencyError {
435 fn from(wire: crate::wire::ModifyDependencyError) -> Self {
436 match u32::from(wire.value) {
437 1 => Self::AlreadyExists,
438
439 2 => Self::Invalid,
440
441 3 => Self::NotAuthorized,
442
443 4 => Self::NotFound,
444
445 value => Self::UnknownOrdinal_(value),
446 }
447 }
448 }
449
450 impl ::fidl_next::FromWire<crate::wire::ModifyDependencyError> for ModifyDependencyError {
451 #[inline]
452 fn from_wire(wire: crate::wire::ModifyDependencyError) -> Self {
453 Self::from(wire)
454 }
455 }
456
457 impl ::fidl_next::FromWireRef<crate::wire::ModifyDependencyError> for ModifyDependencyError {
458 #[inline]
459 fn from_wire_ref(wire: &crate::wire::ModifyDependencyError) -> Self {
460 Self::from(*wire)
461 }
462 }
463
464 #[doc = " Mapping of a plaintext name to a PowerLevel. Names are expected to be unique between\n elements and persistent across reboots of the same build, but consistency is not\n guaranteed between different builds.\n"]
465 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
466 pub struct PowerLevelName {
467 pub level: ::core::option::Option<u8>,
468
469 pub name: ::core::option::Option<::std::string::String>,
470 }
471
472 impl PowerLevelName {
473 fn __max_ordinal(&self) -> usize {
474 if self.name.is_some() {
475 return 2;
476 }
477
478 if self.level.is_some() {
479 return 1;
480 }
481
482 0
483 }
484 }
485
486 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerLevelName<'static>, ___E> for PowerLevelName
487 where
488 ___E: ::fidl_next::Encoder + ?Sized,
489 {
490 #[inline]
491 fn encode(
492 mut self,
493 encoder: &mut ___E,
494 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerLevelName<'static>>,
495 _: (),
496 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
497 ::fidl_next::munge!(let crate::wire::PowerLevelName { table } = out);
498
499 let max_ord = self.__max_ordinal();
500
501 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
502 ::fidl_next::Wire::zero_padding(&mut out);
503
504 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
505 ::fidl_next::wire::Envelope,
506 >(encoder, max_ord);
507
508 for i in 1..=max_ord {
509 match i {
510 2 => {
511 if let Some(value) = self.name.take() {
512 ::fidl_next::wire::Envelope::encode_value::<
513 ::fidl_next::wire::String<'static>,
514 ___E,
515 >(
516 value, preallocated.encoder, &mut out, 16
517 )?;
518 } else {
519 ::fidl_next::wire::Envelope::encode_zero(&mut out)
520 }
521 }
522
523 1 => {
524 if let Some(value) = self.level.take() {
525 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
526 value,
527 preallocated.encoder,
528 &mut out,
529 (),
530 )?;
531 } else {
532 ::fidl_next::wire::Envelope::encode_zero(&mut out)
533 }
534 }
535
536 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
537 }
538 unsafe {
539 preallocated.write_next(out.assume_init_ref());
540 }
541 }
542
543 ::fidl_next::wire::Table::encode_len(table, max_ord);
544
545 Ok(())
546 }
547 }
548
549 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PowerLevelName<'static>, ___E>
550 for &'a PowerLevelName
551 where
552 ___E: ::fidl_next::Encoder + ?Sized,
553 {
554 #[inline]
555 fn encode(
556 self,
557 encoder: &mut ___E,
558 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerLevelName<'static>>,
559 _: (),
560 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
561 ::fidl_next::munge!(let crate::wire::PowerLevelName { table } = out);
562
563 let max_ord = self.__max_ordinal();
564
565 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
566 ::fidl_next::Wire::zero_padding(&mut out);
567
568 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
569 ::fidl_next::wire::Envelope,
570 >(encoder, max_ord);
571
572 for i in 1..=max_ord {
573 match i {
574 2 => {
575 if let Some(value) = &self.name {
576 ::fidl_next::wire::Envelope::encode_value::<
577 ::fidl_next::wire::String<'static>,
578 ___E,
579 >(
580 value, preallocated.encoder, &mut out, 16
581 )?;
582 } else {
583 ::fidl_next::wire::Envelope::encode_zero(&mut out)
584 }
585 }
586
587 1 => {
588 if let Some(value) = &self.level {
589 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
590 value,
591 preallocated.encoder,
592 &mut out,
593 (),
594 )?;
595 } else {
596 ::fidl_next::wire::Envelope::encode_zero(&mut out)
597 }
598 }
599
600 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
601 }
602 unsafe {
603 preallocated.write_next(out.assume_init_ref());
604 }
605 }
606
607 ::fidl_next::wire::Table::encode_len(table, max_ord);
608
609 Ok(())
610 }
611 }
612
613 impl<'de> ::fidl_next::FromWire<crate::wire::PowerLevelName<'de>> for PowerLevelName {
614 #[inline]
615 fn from_wire(wire_: crate::wire::PowerLevelName<'de>) -> Self {
616 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
617
618 let level = wire_.table.get(1);
619
620 let name = wire_.table.get(2);
621
622 Self {
623 level: level.map(|envelope| {
624 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
625 }),
626
627 name: name.map(|envelope| {
628 ::fidl_next::FromWire::from_wire(unsafe {
629 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
630 })
631 }),
632 }
633 }
634 }
635
636 impl<'de> ::fidl_next::FromWireRef<crate::wire::PowerLevelName<'de>> for PowerLevelName {
637 #[inline]
638 fn from_wire_ref(wire: &crate::wire::PowerLevelName<'de>) -> Self {
639 Self {
640 level: wire.table.get(1).map(|envelope| {
641 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
642 envelope.deref_unchecked::<u8>()
643 })
644 }),
645
646 name: wire.table.get(2).map(|envelope| {
647 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
648 envelope.deref_unchecked::<::fidl_next::wire::String<'de>>()
649 })
650 }),
651 }
652 }
653 }
654
655 #[doc = " Mapping of a vector of [`fuchsia.power.broker/PowerLevelName`] to a Power Element via\n its plaintext name. Names are expected to be unique between elements and persistent\n across reboots of the same build, but consistency is not guaranteed between different builds.\n"]
656 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
657 pub struct ElementPowerLevelNames {
658 pub identifier: ::core::option::Option<::std::string::String>,
659
660 pub levels: ::core::option::Option<::std::vec::Vec<crate::natural::PowerLevelName>>,
661 }
662
663 impl ElementPowerLevelNames {
664 fn __max_ordinal(&self) -> usize {
665 if self.levels.is_some() {
666 return 2;
667 }
668
669 if self.identifier.is_some() {
670 return 1;
671 }
672
673 0
674 }
675 }
676
677 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ElementPowerLevelNames<'static>, ___E>
678 for ElementPowerLevelNames
679 where
680 ___E: ::fidl_next::Encoder + ?Sized,
681 {
682 #[inline]
683 fn encode(
684 mut self,
685 encoder: &mut ___E,
686 out: &mut ::core::mem::MaybeUninit<crate::wire::ElementPowerLevelNames<'static>>,
687 _: (),
688 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
689 ::fidl_next::munge!(let crate::wire::ElementPowerLevelNames { table } = out);
690
691 let max_ord = self.__max_ordinal();
692
693 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
694 ::fidl_next::Wire::zero_padding(&mut out);
695
696 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
697 ::fidl_next::wire::Envelope,
698 >(encoder, max_ord);
699
700 for i in 1..=max_ord {
701 match i {
702 2 => {
703 if let Some(value) = self.levels.take() {
704 ::fidl_next::wire::Envelope::encode_value::<
705 ::fidl_next::wire::Vector<
706 'static,
707 crate::wire::PowerLevelName<'static>,
708 >,
709 ___E,
710 >(
711 value, preallocated.encoder, &mut out, (256, ())
712 )?;
713 } else {
714 ::fidl_next::wire::Envelope::encode_zero(&mut out)
715 }
716 }
717
718 1 => {
719 if let Some(value) = self.identifier.take() {
720 ::fidl_next::wire::Envelope::encode_value::<
721 ::fidl_next::wire::String<'static>,
722 ___E,
723 >(
724 value, preallocated.encoder, &mut out, 64
725 )?;
726 } else {
727 ::fidl_next::wire::Envelope::encode_zero(&mut out)
728 }
729 }
730
731 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
732 }
733 unsafe {
734 preallocated.write_next(out.assume_init_ref());
735 }
736 }
737
738 ::fidl_next::wire::Table::encode_len(table, max_ord);
739
740 Ok(())
741 }
742 }
743
744 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ElementPowerLevelNames<'static>, ___E>
745 for &'a ElementPowerLevelNames
746 where
747 ___E: ::fidl_next::Encoder + ?Sized,
748 {
749 #[inline]
750 fn encode(
751 self,
752 encoder: &mut ___E,
753 out: &mut ::core::mem::MaybeUninit<crate::wire::ElementPowerLevelNames<'static>>,
754 _: (),
755 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
756 ::fidl_next::munge!(let crate::wire::ElementPowerLevelNames { table } = out);
757
758 let max_ord = self.__max_ordinal();
759
760 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
761 ::fidl_next::Wire::zero_padding(&mut out);
762
763 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
764 ::fidl_next::wire::Envelope,
765 >(encoder, max_ord);
766
767 for i in 1..=max_ord {
768 match i {
769 2 => {
770 if let Some(value) = &self.levels {
771 ::fidl_next::wire::Envelope::encode_value::<
772 ::fidl_next::wire::Vector<
773 'static,
774 crate::wire::PowerLevelName<'static>,
775 >,
776 ___E,
777 >(
778 value, preallocated.encoder, &mut out, (256, ())
779 )?;
780 } else {
781 ::fidl_next::wire::Envelope::encode_zero(&mut out)
782 }
783 }
784
785 1 => {
786 if let Some(value) = &self.identifier {
787 ::fidl_next::wire::Envelope::encode_value::<
788 ::fidl_next::wire::String<'static>,
789 ___E,
790 >(
791 value, preallocated.encoder, &mut out, 64
792 )?;
793 } else {
794 ::fidl_next::wire::Envelope::encode_zero(&mut out)
795 }
796 }
797
798 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
799 }
800 unsafe {
801 preallocated.write_next(out.assume_init_ref());
802 }
803 }
804
805 ::fidl_next::wire::Table::encode_len(table, max_ord);
806
807 Ok(())
808 }
809 }
810
811 impl<'de> ::fidl_next::FromWire<crate::wire::ElementPowerLevelNames<'de>>
812 for ElementPowerLevelNames
813 {
814 #[inline]
815 fn from_wire(wire_: crate::wire::ElementPowerLevelNames<'de>) -> Self {
816 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
817
818 let identifier = wire_.table.get(1);
819
820 let levels = wire_.table.get(2);
821
822 Self {
823
824
825 identifier: identifier.map(|envelope| ::fidl_next::FromWire::from_wire(
826 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
827 )),
828
829
830 levels: levels.map(|envelope| ::fidl_next::FromWire::from_wire(
831 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerLevelName<'de>>>() }
832 )),
833
834 }
835 }
836 }
837
838 impl<'de> ::fidl_next::FromWireRef<crate::wire::ElementPowerLevelNames<'de>>
839 for ElementPowerLevelNames
840 {
841 #[inline]
842 fn from_wire_ref(wire: &crate::wire::ElementPowerLevelNames<'de>) -> Self {
843 Self {
844
845
846 identifier: wire.table.get(1)
847 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
848 unsafe { envelope.deref_unchecked::<::fidl_next::wire::String<'de>>() }
849 )),
850
851
852 levels: wire.table.get(2)
853 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
854 unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerLevelName<'de>>>() }
855 )),
856
857 }
858 }
859 }
860
861 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
862 #[repr(u32)]
863 pub enum ElementInfoProviderError {
864 Unknown = 0,
865 Failed = 1,
866 UnknownOrdinal_(u32) = 2,
867 }
868 impl ::std::convert::From<u32> for ElementInfoProviderError {
869 fn from(value: u32) -> Self {
870 match value {
871 0 => Self::Unknown,
872 1 => Self::Failed,
873
874 _ => Self::UnknownOrdinal_(value),
875 }
876 }
877 }
878
879 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ElementInfoProviderError, ___E>
880 for ElementInfoProviderError
881 where
882 ___E: ?Sized,
883 {
884 #[inline]
885 fn encode(
886 self,
887 encoder: &mut ___E,
888 out: &mut ::core::mem::MaybeUninit<crate::wire::ElementInfoProviderError>,
889 _: (),
890 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
891 ::fidl_next::Encode::encode(&self, encoder, out, ())
892 }
893 }
894
895 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ElementInfoProviderError, ___E>
896 for &'a ElementInfoProviderError
897 where
898 ___E: ?Sized,
899 {
900 #[inline]
901 fn encode(
902 self,
903 encoder: &mut ___E,
904 out: &mut ::core::mem::MaybeUninit<crate::wire::ElementInfoProviderError>,
905 _: (),
906 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
907 ::fidl_next::munge!(let crate::wire::ElementInfoProviderError { value } = out);
908 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
909 ElementInfoProviderError::Unknown => 0,
910
911 ElementInfoProviderError::Failed => 1,
912
913 ElementInfoProviderError::UnknownOrdinal_(value) => value,
914 }));
915
916 Ok(())
917 }
918 }
919
920 impl ::core::convert::From<crate::wire::ElementInfoProviderError> for ElementInfoProviderError {
921 fn from(wire: crate::wire::ElementInfoProviderError) -> Self {
922 match u32::from(wire.value) {
923 0 => Self::Unknown,
924
925 1 => Self::Failed,
926
927 value => Self::UnknownOrdinal_(value),
928 }
929 }
930 }
931
932 impl ::fidl_next::FromWire<crate::wire::ElementInfoProviderError> for ElementInfoProviderError {
933 #[inline]
934 fn from_wire(wire: crate::wire::ElementInfoProviderError) -> Self {
935 Self::from(wire)
936 }
937 }
938
939 impl ::fidl_next::FromWireRef<crate::wire::ElementInfoProviderError> for ElementInfoProviderError {
940 #[inline]
941 fn from_wire_ref(wire: &crate::wire::ElementInfoProviderError) -> Self {
942 Self::from(*wire)
943 }
944 }
945
946 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
947 #[repr(C)]
948 pub struct ElementRunnerSetLevelRequest {
949 pub level: u8,
950 }
951
952 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ElementRunnerSetLevelRequest, ___E>
953 for ElementRunnerSetLevelRequest
954 where
955 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
956 {
957 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
958 Self,
959 crate::wire::ElementRunnerSetLevelRequest,
960 > = unsafe {
961 ::fidl_next::CopyOptimization::enable_if(
962 true && <u8 as ::fidl_next::Encode<u8, ___E>>::COPY_OPTIMIZATION.is_enabled(),
963 )
964 };
965
966 #[inline]
967 fn encode(
968 self,
969 encoder_: &mut ___E,
970 out_: &mut ::core::mem::MaybeUninit<crate::wire::ElementRunnerSetLevelRequest>,
971 _: (),
972 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
973 ::fidl_next::munge! {
974 let crate::wire::ElementRunnerSetLevelRequest {
975 level,
976
977 } = out_;
978 }
979
980 ::fidl_next::Encode::encode(self.level, encoder_, level, ())?;
981
982 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(level.as_mut_ptr()) };
983
984 Ok(())
985 }
986 }
987
988 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ElementRunnerSetLevelRequest, ___E>
989 for &'a ElementRunnerSetLevelRequest
990 where
991 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
992 {
993 #[inline]
994 fn encode(
995 self,
996 encoder_: &mut ___E,
997 out_: &mut ::core::mem::MaybeUninit<crate::wire::ElementRunnerSetLevelRequest>,
998 _: (),
999 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1000 ::fidl_next::munge! {
1001 let crate::wire::ElementRunnerSetLevelRequest {
1002 level,
1003
1004 } = out_;
1005 }
1006
1007 ::fidl_next::Encode::encode(&self.level, encoder_, level, ())?;
1008
1009 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(level.as_mut_ptr()) };
1010
1011 Ok(())
1012 }
1013 }
1014
1015 unsafe impl<___E>
1016 ::fidl_next::EncodeOption<
1017 ::fidl_next::wire::Box<'static, crate::wire::ElementRunnerSetLevelRequest>,
1018 ___E,
1019 > for ElementRunnerSetLevelRequest
1020 where
1021 ___E: ::fidl_next::Encoder + ?Sized,
1022 ElementRunnerSetLevelRequest:
1023 ::fidl_next::Encode<crate::wire::ElementRunnerSetLevelRequest, ___E>,
1024 {
1025 #[inline]
1026 fn encode_option(
1027 this: ::core::option::Option<Self>,
1028 encoder: &mut ___E,
1029 out: &mut ::core::mem::MaybeUninit<
1030 ::fidl_next::wire::Box<'static, crate::wire::ElementRunnerSetLevelRequest>,
1031 >,
1032 _: (),
1033 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1034 if let Some(inner) = this {
1035 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1036 ::fidl_next::wire::Box::encode_present(out);
1037 } else {
1038 ::fidl_next::wire::Box::encode_absent(out);
1039 }
1040
1041 Ok(())
1042 }
1043 }
1044
1045 unsafe impl<'a, ___E>
1046 ::fidl_next::EncodeOption<
1047 ::fidl_next::wire::Box<'static, crate::wire::ElementRunnerSetLevelRequest>,
1048 ___E,
1049 > for &'a ElementRunnerSetLevelRequest
1050 where
1051 ___E: ::fidl_next::Encoder + ?Sized,
1052 &'a ElementRunnerSetLevelRequest:
1053 ::fidl_next::Encode<crate::wire::ElementRunnerSetLevelRequest, ___E>,
1054 {
1055 #[inline]
1056 fn encode_option(
1057 this: ::core::option::Option<Self>,
1058 encoder: &mut ___E,
1059 out: &mut ::core::mem::MaybeUninit<
1060 ::fidl_next::wire::Box<'static, crate::wire::ElementRunnerSetLevelRequest>,
1061 >,
1062 _: (),
1063 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1064 if let Some(inner) = this {
1065 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1066 ::fidl_next::wire::Box::encode_present(out);
1067 } else {
1068 ::fidl_next::wire::Box::encode_absent(out);
1069 }
1070
1071 Ok(())
1072 }
1073 }
1074
1075 impl ::fidl_next::FromWire<crate::wire::ElementRunnerSetLevelRequest>
1076 for ElementRunnerSetLevelRequest
1077 {
1078 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1079 crate::wire::ElementRunnerSetLevelRequest,
1080 Self,
1081 > = unsafe {
1082 ::fidl_next::CopyOptimization::enable_if(
1083 true && <u8 as ::fidl_next::FromWire<u8>>::COPY_OPTIMIZATION.is_enabled(),
1084 )
1085 };
1086
1087 #[inline]
1088 fn from_wire(wire: crate::wire::ElementRunnerSetLevelRequest) -> Self {
1089 Self { level: ::fidl_next::FromWire::from_wire(wire.level) }
1090 }
1091 }
1092
1093 impl ::fidl_next::FromWireRef<crate::wire::ElementRunnerSetLevelRequest>
1094 for ElementRunnerSetLevelRequest
1095 {
1096 #[inline]
1097 fn from_wire_ref(wire: &crate::wire::ElementRunnerSetLevelRequest) -> Self {
1098 Self { level: ::fidl_next::FromWireRef::from_wire_ref(&wire.level) }
1099 }
1100 }
1101
1102 pub type ElementRunnerSetLevelResponse = ();
1103
1104 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1105 #[repr(u32)]
1106 pub enum LeaseStatus {
1107 Unknown = 0,
1108 Pending = 1,
1109 Satisfied = 2,
1110 UnknownOrdinal_(u32) = 3,
1111 }
1112 impl ::std::convert::From<u32> for LeaseStatus {
1113 fn from(value: u32) -> Self {
1114 match value {
1115 0 => Self::Unknown,
1116 1 => Self::Pending,
1117 2 => Self::Satisfied,
1118
1119 _ => Self::UnknownOrdinal_(value),
1120 }
1121 }
1122 }
1123
1124 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LeaseStatus, ___E> for LeaseStatus
1125 where
1126 ___E: ?Sized,
1127 {
1128 #[inline]
1129 fn encode(
1130 self,
1131 encoder: &mut ___E,
1132 out: &mut ::core::mem::MaybeUninit<crate::wire::LeaseStatus>,
1133 _: (),
1134 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1135 ::fidl_next::Encode::encode(&self, encoder, out, ())
1136 }
1137 }
1138
1139 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::LeaseStatus, ___E> for &'a LeaseStatus
1140 where
1141 ___E: ?Sized,
1142 {
1143 #[inline]
1144 fn encode(
1145 self,
1146 encoder: &mut ___E,
1147 out: &mut ::core::mem::MaybeUninit<crate::wire::LeaseStatus>,
1148 _: (),
1149 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1150 ::fidl_next::munge!(let crate::wire::LeaseStatus { value } = out);
1151 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
1152 LeaseStatus::Unknown => 0,
1153
1154 LeaseStatus::Pending => 1,
1155
1156 LeaseStatus::Satisfied => 2,
1157
1158 LeaseStatus::UnknownOrdinal_(value) => value,
1159 }));
1160
1161 Ok(())
1162 }
1163 }
1164
1165 impl ::core::convert::From<crate::wire::LeaseStatus> for LeaseStatus {
1166 fn from(wire: crate::wire::LeaseStatus) -> Self {
1167 match u32::from(wire.value) {
1168 0 => Self::Unknown,
1169
1170 1 => Self::Pending,
1171
1172 2 => Self::Satisfied,
1173
1174 value => Self::UnknownOrdinal_(value),
1175 }
1176 }
1177 }
1178
1179 impl ::fidl_next::FromWire<crate::wire::LeaseStatus> for LeaseStatus {
1180 #[inline]
1181 fn from_wire(wire: crate::wire::LeaseStatus) -> Self {
1182 Self::from(wire)
1183 }
1184 }
1185
1186 impl ::fidl_next::FromWireRef<crate::wire::LeaseStatus> for LeaseStatus {
1187 #[inline]
1188 fn from_wire_ref(wire: &crate::wire::LeaseStatus) -> Self {
1189 Self::from(*wire)
1190 }
1191 }
1192
1193 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1194 #[repr(C)]
1195 pub struct LeaseControlWatchStatusRequest {
1196 pub last_status: crate::natural::LeaseStatus,
1197 }
1198
1199 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusRequest, ___E>
1200 for LeaseControlWatchStatusRequest
1201 where
1202 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1203 {
1204 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1205 Self,
1206 crate::wire::LeaseControlWatchStatusRequest,
1207 > = unsafe {
1208 ::fidl_next::CopyOptimization::enable_if(
1209 true && <crate::natural::LeaseStatus as ::fidl_next::Encode<
1210 crate::wire::LeaseStatus,
1211 ___E,
1212 >>::COPY_OPTIMIZATION
1213 .is_enabled(),
1214 )
1215 };
1216
1217 #[inline]
1218 fn encode(
1219 self,
1220 encoder_: &mut ___E,
1221 out_: &mut ::core::mem::MaybeUninit<crate::wire::LeaseControlWatchStatusRequest>,
1222 _: (),
1223 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1224 ::fidl_next::munge! {
1225 let crate::wire::LeaseControlWatchStatusRequest {
1226 last_status,
1227
1228 } = out_;
1229 }
1230
1231 ::fidl_next::Encode::encode(self.last_status, encoder_, last_status, ())?;
1232
1233 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(last_status.as_mut_ptr()) };
1234
1235 Ok(())
1236 }
1237 }
1238
1239 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusRequest, ___E>
1240 for &'a LeaseControlWatchStatusRequest
1241 where
1242 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1243 {
1244 #[inline]
1245 fn encode(
1246 self,
1247 encoder_: &mut ___E,
1248 out_: &mut ::core::mem::MaybeUninit<crate::wire::LeaseControlWatchStatusRequest>,
1249 _: (),
1250 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1251 ::fidl_next::munge! {
1252 let crate::wire::LeaseControlWatchStatusRequest {
1253 last_status,
1254
1255 } = out_;
1256 }
1257
1258 ::fidl_next::Encode::encode(&self.last_status, encoder_, last_status, ())?;
1259
1260 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(last_status.as_mut_ptr()) };
1261
1262 Ok(())
1263 }
1264 }
1265
1266 unsafe impl<___E>
1267 ::fidl_next::EncodeOption<
1268 ::fidl_next::wire::Box<'static, crate::wire::LeaseControlWatchStatusRequest>,
1269 ___E,
1270 > for LeaseControlWatchStatusRequest
1271 where
1272 ___E: ::fidl_next::Encoder + ?Sized,
1273 LeaseControlWatchStatusRequest:
1274 ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusRequest, ___E>,
1275 {
1276 #[inline]
1277 fn encode_option(
1278 this: ::core::option::Option<Self>,
1279 encoder: &mut ___E,
1280 out: &mut ::core::mem::MaybeUninit<
1281 ::fidl_next::wire::Box<'static, crate::wire::LeaseControlWatchStatusRequest>,
1282 >,
1283 _: (),
1284 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1285 if let Some(inner) = this {
1286 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1287 ::fidl_next::wire::Box::encode_present(out);
1288 } else {
1289 ::fidl_next::wire::Box::encode_absent(out);
1290 }
1291
1292 Ok(())
1293 }
1294 }
1295
1296 unsafe impl<'a, ___E>
1297 ::fidl_next::EncodeOption<
1298 ::fidl_next::wire::Box<'static, crate::wire::LeaseControlWatchStatusRequest>,
1299 ___E,
1300 > for &'a LeaseControlWatchStatusRequest
1301 where
1302 ___E: ::fidl_next::Encoder + ?Sized,
1303 &'a LeaseControlWatchStatusRequest:
1304 ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusRequest, ___E>,
1305 {
1306 #[inline]
1307 fn encode_option(
1308 this: ::core::option::Option<Self>,
1309 encoder: &mut ___E,
1310 out: &mut ::core::mem::MaybeUninit<
1311 ::fidl_next::wire::Box<'static, crate::wire::LeaseControlWatchStatusRequest>,
1312 >,
1313 _: (),
1314 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1315 if let Some(inner) = this {
1316 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1317 ::fidl_next::wire::Box::encode_present(out);
1318 } else {
1319 ::fidl_next::wire::Box::encode_absent(out);
1320 }
1321
1322 Ok(())
1323 }
1324 }
1325
1326 impl ::fidl_next::FromWire<crate::wire::LeaseControlWatchStatusRequest>
1327 for LeaseControlWatchStatusRequest
1328 {
1329 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1330 crate::wire::LeaseControlWatchStatusRequest,
1331 Self,
1332 > = unsafe {
1333 ::fidl_next::CopyOptimization::enable_if(
1334 true && <crate::natural::LeaseStatus as ::fidl_next::FromWire<
1335 crate::wire::LeaseStatus,
1336 >>::COPY_OPTIMIZATION
1337 .is_enabled(),
1338 )
1339 };
1340
1341 #[inline]
1342 fn from_wire(wire: crate::wire::LeaseControlWatchStatusRequest) -> Self {
1343 Self { last_status: ::fidl_next::FromWire::from_wire(wire.last_status) }
1344 }
1345 }
1346
1347 impl ::fidl_next::FromWireRef<crate::wire::LeaseControlWatchStatusRequest>
1348 for LeaseControlWatchStatusRequest
1349 {
1350 #[inline]
1351 fn from_wire_ref(wire: &crate::wire::LeaseControlWatchStatusRequest) -> Self {
1352 Self { last_status: ::fidl_next::FromWireRef::from_wire_ref(&wire.last_status) }
1353 }
1354 }
1355
1356 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1357 #[repr(C)]
1358 pub struct LeaseControlWatchStatusResponse {
1359 pub status: crate::natural::LeaseStatus,
1360 }
1361
1362 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusResponse, ___E>
1363 for LeaseControlWatchStatusResponse
1364 where
1365 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1366 {
1367 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1368 Self,
1369 crate::wire::LeaseControlWatchStatusResponse,
1370 > = unsafe {
1371 ::fidl_next::CopyOptimization::enable_if(
1372 true && <crate::natural::LeaseStatus as ::fidl_next::Encode<
1373 crate::wire::LeaseStatus,
1374 ___E,
1375 >>::COPY_OPTIMIZATION
1376 .is_enabled(),
1377 )
1378 };
1379
1380 #[inline]
1381 fn encode(
1382 self,
1383 encoder_: &mut ___E,
1384 out_: &mut ::core::mem::MaybeUninit<crate::wire::LeaseControlWatchStatusResponse>,
1385 _: (),
1386 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1387 ::fidl_next::munge! {
1388 let crate::wire::LeaseControlWatchStatusResponse {
1389 status,
1390
1391 } = out_;
1392 }
1393
1394 ::fidl_next::Encode::encode(self.status, encoder_, status, ())?;
1395
1396 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(status.as_mut_ptr()) };
1397
1398 Ok(())
1399 }
1400 }
1401
1402 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusResponse, ___E>
1403 for &'a LeaseControlWatchStatusResponse
1404 where
1405 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1406 {
1407 #[inline]
1408 fn encode(
1409 self,
1410 encoder_: &mut ___E,
1411 out_: &mut ::core::mem::MaybeUninit<crate::wire::LeaseControlWatchStatusResponse>,
1412 _: (),
1413 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1414 ::fidl_next::munge! {
1415 let crate::wire::LeaseControlWatchStatusResponse {
1416 status,
1417
1418 } = out_;
1419 }
1420
1421 ::fidl_next::Encode::encode(&self.status, encoder_, status, ())?;
1422
1423 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(status.as_mut_ptr()) };
1424
1425 Ok(())
1426 }
1427 }
1428
1429 unsafe impl<___E>
1430 ::fidl_next::EncodeOption<
1431 ::fidl_next::wire::Box<'static, crate::wire::LeaseControlWatchStatusResponse>,
1432 ___E,
1433 > for LeaseControlWatchStatusResponse
1434 where
1435 ___E: ::fidl_next::Encoder + ?Sized,
1436 LeaseControlWatchStatusResponse:
1437 ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusResponse, ___E>,
1438 {
1439 #[inline]
1440 fn encode_option(
1441 this: ::core::option::Option<Self>,
1442 encoder: &mut ___E,
1443 out: &mut ::core::mem::MaybeUninit<
1444 ::fidl_next::wire::Box<'static, crate::wire::LeaseControlWatchStatusResponse>,
1445 >,
1446 _: (),
1447 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1448 if let Some(inner) = this {
1449 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1450 ::fidl_next::wire::Box::encode_present(out);
1451 } else {
1452 ::fidl_next::wire::Box::encode_absent(out);
1453 }
1454
1455 Ok(())
1456 }
1457 }
1458
1459 unsafe impl<'a, ___E>
1460 ::fidl_next::EncodeOption<
1461 ::fidl_next::wire::Box<'static, crate::wire::LeaseControlWatchStatusResponse>,
1462 ___E,
1463 > for &'a LeaseControlWatchStatusResponse
1464 where
1465 ___E: ::fidl_next::Encoder + ?Sized,
1466 &'a LeaseControlWatchStatusResponse:
1467 ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusResponse, ___E>,
1468 {
1469 #[inline]
1470 fn encode_option(
1471 this: ::core::option::Option<Self>,
1472 encoder: &mut ___E,
1473 out: &mut ::core::mem::MaybeUninit<
1474 ::fidl_next::wire::Box<'static, crate::wire::LeaseControlWatchStatusResponse>,
1475 >,
1476 _: (),
1477 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1478 if let Some(inner) = this {
1479 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1480 ::fidl_next::wire::Box::encode_present(out);
1481 } else {
1482 ::fidl_next::wire::Box::encode_absent(out);
1483 }
1484
1485 Ok(())
1486 }
1487 }
1488
1489 impl ::fidl_next::FromWire<crate::wire::LeaseControlWatchStatusResponse>
1490 for LeaseControlWatchStatusResponse
1491 {
1492 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1493 crate::wire::LeaseControlWatchStatusResponse,
1494 Self,
1495 > = unsafe {
1496 ::fidl_next::CopyOptimization::enable_if(
1497 true && <crate::natural::LeaseStatus as ::fidl_next::FromWire<
1498 crate::wire::LeaseStatus,
1499 >>::COPY_OPTIMIZATION
1500 .is_enabled(),
1501 )
1502 };
1503
1504 #[inline]
1505 fn from_wire(wire: crate::wire::LeaseControlWatchStatusResponse) -> Self {
1506 Self { status: ::fidl_next::FromWire::from_wire(wire.status) }
1507 }
1508 }
1509
1510 impl ::fidl_next::FromWireRef<crate::wire::LeaseControlWatchStatusResponse>
1511 for LeaseControlWatchStatusResponse
1512 {
1513 #[inline]
1514 fn from_wire_ref(wire: &crate::wire::LeaseControlWatchStatusResponse) -> Self {
1515 Self { status: ::fidl_next::FromWireRef::from_wire_ref(&wire.status) }
1516 }
1517 }
1518
1519 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1520 #[repr(u32)]
1521 pub enum LeaseError {
1522 Internal = 1,
1523 NotAuthorized = 2,
1524 InvalidLevel = 3,
1525 InvalidArgument = 4,
1526 UnknownOrdinal_(u32) = 5,
1527 }
1528 impl ::std::convert::From<u32> for LeaseError {
1529 fn from(value: u32) -> Self {
1530 match value {
1531 1 => Self::Internal,
1532 2 => Self::NotAuthorized,
1533 3 => Self::InvalidLevel,
1534 4 => Self::InvalidArgument,
1535
1536 _ => Self::UnknownOrdinal_(value),
1537 }
1538 }
1539 }
1540
1541 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LeaseError, ___E> for LeaseError
1542 where
1543 ___E: ?Sized,
1544 {
1545 #[inline]
1546 fn encode(
1547 self,
1548 encoder: &mut ___E,
1549 out: &mut ::core::mem::MaybeUninit<crate::wire::LeaseError>,
1550 _: (),
1551 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1552 ::fidl_next::Encode::encode(&self, encoder, out, ())
1553 }
1554 }
1555
1556 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::LeaseError, ___E> for &'a LeaseError
1557 where
1558 ___E: ?Sized,
1559 {
1560 #[inline]
1561 fn encode(
1562 self,
1563 encoder: &mut ___E,
1564 out: &mut ::core::mem::MaybeUninit<crate::wire::LeaseError>,
1565 _: (),
1566 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1567 ::fidl_next::munge!(let crate::wire::LeaseError { value } = out);
1568 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
1569 LeaseError::Internal => 1,
1570
1571 LeaseError::NotAuthorized => 2,
1572
1573 LeaseError::InvalidLevel => 3,
1574
1575 LeaseError::InvalidArgument => 4,
1576
1577 LeaseError::UnknownOrdinal_(value) => value,
1578 }));
1579
1580 Ok(())
1581 }
1582 }
1583
1584 impl ::core::convert::From<crate::wire::LeaseError> for LeaseError {
1585 fn from(wire: crate::wire::LeaseError) -> Self {
1586 match u32::from(wire.value) {
1587 1 => Self::Internal,
1588
1589 2 => Self::NotAuthorized,
1590
1591 3 => Self::InvalidLevel,
1592
1593 4 => Self::InvalidArgument,
1594
1595 value => Self::UnknownOrdinal_(value),
1596 }
1597 }
1598 }
1599
1600 impl ::fidl_next::FromWire<crate::wire::LeaseError> for LeaseError {
1601 #[inline]
1602 fn from_wire(wire: crate::wire::LeaseError) -> Self {
1603 Self::from(wire)
1604 }
1605 }
1606
1607 impl ::fidl_next::FromWireRef<crate::wire::LeaseError> for LeaseError {
1608 #[inline]
1609 fn from_wire_ref(wire: &crate::wire::LeaseError) -> Self {
1610 Self::from(*wire)
1611 }
1612 }
1613
1614 ::fidl_next::bitflags::bitflags! {
1615 #[doc = " Element Permissions\n"]#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, )]pub struct Permissions: u32 {
1616 const MODIFY_DEPENDENT = 1;
1617 const MODIFY_DEPENDENCY = 4;
1618
1619 }
1620 }
1621
1622 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Permissions, ___E> for Permissions
1623 where
1624 ___E: ?Sized,
1625 {
1626 #[inline]
1627 fn encode(
1628 self,
1629 encoder: &mut ___E,
1630 out: &mut ::core::mem::MaybeUninit<crate::wire::Permissions>,
1631 _: (),
1632 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1633 ::fidl_next::Encode::encode(&self, encoder, out, ())
1634 }
1635 }
1636
1637 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Permissions, ___E> for &'a Permissions
1638 where
1639 ___E: ?Sized,
1640 {
1641 #[inline]
1642 fn encode(
1643 self,
1644 _: &mut ___E,
1645 out: &mut ::core::mem::MaybeUninit<crate::wire::Permissions>,
1646 _: (),
1647 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1648 ::fidl_next::munge!(let crate::wire::Permissions { value } = out);
1649
1650 if ::fidl_next::bitflags::Flags::contains_unknown_bits(self) {
1651 return Err(::fidl_next::EncodeError::InvalidStrictBits);
1652 }
1653
1654 let _ = value.write(::fidl_next::wire::Uint32::from(self.bits()));
1655 Ok(())
1656 }
1657 }
1658
1659 impl ::core::convert::From<crate::wire::Permissions> for Permissions {
1660 fn from(wire: crate::wire::Permissions) -> Self {
1661 Self::from_bits_retain(u32::from(wire.value))
1662 }
1663 }
1664
1665 impl ::fidl_next::FromWire<crate::wire::Permissions> for Permissions {
1666 #[inline]
1667 fn from_wire(wire: crate::wire::Permissions) -> Self {
1668 Self::from(wire)
1669 }
1670 }
1671
1672 impl ::fidl_next::FromWireRef<crate::wire::Permissions> for Permissions {
1673 #[inline]
1674 fn from_wire_ref(wire: &crate::wire::Permissions) -> Self {
1675 Self::from(*wire)
1676 }
1677 }
1678
1679 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1680 #[repr(u32)]
1681 pub enum StatusError {
1682 Unknown = 1,
1683 UnknownOrdinal_(u32) = 2,
1684 }
1685 impl ::std::convert::From<u32> for StatusError {
1686 fn from(value: u32) -> Self {
1687 match value {
1688 1 => Self::Unknown,
1689
1690 _ => Self::UnknownOrdinal_(value),
1691 }
1692 }
1693 }
1694
1695 unsafe impl<___E> ::fidl_next::Encode<crate::wire::StatusError, ___E> for StatusError
1696 where
1697 ___E: ?Sized,
1698 {
1699 #[inline]
1700 fn encode(
1701 self,
1702 encoder: &mut ___E,
1703 out: &mut ::core::mem::MaybeUninit<crate::wire::StatusError>,
1704 _: (),
1705 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1706 ::fidl_next::Encode::encode(&self, encoder, out, ())
1707 }
1708 }
1709
1710 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::StatusError, ___E> for &'a StatusError
1711 where
1712 ___E: ?Sized,
1713 {
1714 #[inline]
1715 fn encode(
1716 self,
1717 encoder: &mut ___E,
1718 out: &mut ::core::mem::MaybeUninit<crate::wire::StatusError>,
1719 _: (),
1720 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1721 ::fidl_next::munge!(let crate::wire::StatusError { value } = out);
1722 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
1723 StatusError::Unknown => 1,
1724
1725 StatusError::UnknownOrdinal_(value) => value,
1726 }));
1727
1728 Ok(())
1729 }
1730 }
1731
1732 impl ::core::convert::From<crate::wire::StatusError> for StatusError {
1733 fn from(wire: crate::wire::StatusError) -> Self {
1734 match u32::from(wire.value) {
1735 1 => Self::Unknown,
1736
1737 value => Self::UnknownOrdinal_(value),
1738 }
1739 }
1740 }
1741
1742 impl ::fidl_next::FromWire<crate::wire::StatusError> for StatusError {
1743 #[inline]
1744 fn from_wire(wire: crate::wire::StatusError) -> Self {
1745 Self::from(wire)
1746 }
1747 }
1748
1749 impl ::fidl_next::FromWireRef<crate::wire::StatusError> for StatusError {
1750 #[inline]
1751 fn from_wire_ref(wire: &crate::wire::StatusError) -> Self {
1752 Self::from(*wire)
1753 }
1754 }
1755
1756 pub type TopologyAddElementResponse = ();
1757
1758 pub type TopologyLeaseResponse = ();
1759}
1760
1761pub mod wire {
1762
1763 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1765 #[repr(transparent)]
1766 pub struct AddElementError {
1767 pub(crate) value: ::fidl_next::wire::Uint32,
1768 }
1769
1770 impl ::fidl_next::Constrained for AddElementError {
1771 type Constraint = ();
1772
1773 fn validate(
1774 _: ::fidl_next::Slot<'_, Self>,
1775 _: Self::Constraint,
1776 ) -> Result<(), ::fidl_next::ValidationError> {
1777 Ok(())
1778 }
1779 }
1780
1781 unsafe impl ::fidl_next::Wire for AddElementError {
1782 type Narrowed<'de> = Self;
1783
1784 #[inline]
1785 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1786 }
1788 }
1789
1790 impl AddElementError {
1791 pub const INVALID: AddElementError =
1792 AddElementError { value: ::fidl_next::wire::Uint32(1) };
1793
1794 pub const NOT_AUTHORIZED: AddElementError =
1795 AddElementError { value: ::fidl_next::wire::Uint32(2) };
1796 }
1797
1798 unsafe impl<___D> ::fidl_next::Decode<___D> for AddElementError
1799 where
1800 ___D: ?Sized,
1801 {
1802 fn decode(
1803 slot: ::fidl_next::Slot<'_, Self>,
1804 _: &mut ___D,
1805 _: (),
1806 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1807 Ok(())
1808 }
1809 }
1810
1811 impl ::core::convert::From<crate::natural::AddElementError> for AddElementError {
1812 fn from(natural: crate::natural::AddElementError) -> Self {
1813 match natural {
1814 crate::natural::AddElementError::Invalid => AddElementError::INVALID,
1815
1816 crate::natural::AddElementError::NotAuthorized => AddElementError::NOT_AUTHORIZED,
1817
1818 crate::natural::AddElementError::UnknownOrdinal_(value) => {
1819 AddElementError { value: ::fidl_next::wire::Uint32::from(value) }
1820 }
1821 }
1822 }
1823 }
1824
1825 impl ::fidl_next::IntoNatural for AddElementError {
1826 type Natural = crate::natural::AddElementError;
1827 }
1828
1829 pub type PowerLevel = u8;
1831
1832 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1834 #[repr(transparent)]
1835 pub struct BinaryPowerLevel {
1836 pub(crate) value: u8,
1837 }
1838
1839 impl ::fidl_next::Constrained for BinaryPowerLevel {
1840 type Constraint = ();
1841
1842 fn validate(
1843 _: ::fidl_next::Slot<'_, Self>,
1844 _: Self::Constraint,
1845 ) -> Result<(), ::fidl_next::ValidationError> {
1846 Ok(())
1847 }
1848 }
1849
1850 unsafe impl ::fidl_next::Wire for BinaryPowerLevel {
1851 type Narrowed<'de> = Self;
1852
1853 #[inline]
1854 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1855 }
1857 }
1858
1859 impl BinaryPowerLevel {
1860 pub const OFF: BinaryPowerLevel = BinaryPowerLevel { value: 0 };
1861
1862 pub const ON: BinaryPowerLevel = BinaryPowerLevel { value: 1 };
1863 }
1864
1865 unsafe impl<___D> ::fidl_next::Decode<___D> for BinaryPowerLevel
1866 where
1867 ___D: ?Sized,
1868 {
1869 fn decode(
1870 slot: ::fidl_next::Slot<'_, Self>,
1871 _: &mut ___D,
1872 _: (),
1873 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1874 ::fidl_next::munge!(let Self { value } = slot);
1875
1876 match u8::from(*value) {
1877 0 | 1 => (),
1878 unknown => {
1879 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1880 }
1881 }
1882
1883 Ok(())
1884 }
1885 }
1886
1887 impl ::core::convert::From<crate::natural::BinaryPowerLevel> for BinaryPowerLevel {
1888 fn from(natural: crate::natural::BinaryPowerLevel) -> Self {
1889 match natural {
1890 crate::natural::BinaryPowerLevel::Off => BinaryPowerLevel::OFF,
1891
1892 crate::natural::BinaryPowerLevel::On => BinaryPowerLevel::ON,
1893 }
1894 }
1895 }
1896
1897 impl ::fidl_next::IntoNatural for BinaryPowerLevel {
1898 type Natural = crate::natural::BinaryPowerLevel;
1899 }
1900
1901 pub type ElementControlRegisterDependencyTokenResponse = ::fidl_next::wire::Unit;
1903
1904 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1906 #[repr(transparent)]
1907 pub struct RegisterDependencyTokenError {
1908 pub(crate) value: ::fidl_next::wire::Uint32,
1909 }
1910
1911 impl ::fidl_next::Constrained for RegisterDependencyTokenError {
1912 type Constraint = ();
1913
1914 fn validate(
1915 _: ::fidl_next::Slot<'_, Self>,
1916 _: Self::Constraint,
1917 ) -> Result<(), ::fidl_next::ValidationError> {
1918 Ok(())
1919 }
1920 }
1921
1922 unsafe impl ::fidl_next::Wire for RegisterDependencyTokenError {
1923 type Narrowed<'de> = Self;
1924
1925 #[inline]
1926 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1927 }
1929 }
1930
1931 impl RegisterDependencyTokenError {
1932 pub const ALREADY_IN_USE: RegisterDependencyTokenError =
1933 RegisterDependencyTokenError { value: ::fidl_next::wire::Uint32(1) };
1934
1935 pub const INTERNAL: RegisterDependencyTokenError =
1936 RegisterDependencyTokenError { value: ::fidl_next::wire::Uint32(2) };
1937 }
1938
1939 unsafe impl<___D> ::fidl_next::Decode<___D> for RegisterDependencyTokenError
1940 where
1941 ___D: ?Sized,
1942 {
1943 fn decode(
1944 slot: ::fidl_next::Slot<'_, Self>,
1945 _: &mut ___D,
1946 _: (),
1947 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1948 Ok(())
1949 }
1950 }
1951
1952 impl ::core::convert::From<crate::natural::RegisterDependencyTokenError>
1953 for RegisterDependencyTokenError
1954 {
1955 fn from(natural: crate::natural::RegisterDependencyTokenError) -> Self {
1956 match natural {
1957 crate::natural::RegisterDependencyTokenError::AlreadyInUse => {
1958 RegisterDependencyTokenError::ALREADY_IN_USE
1959 }
1960
1961 crate::natural::RegisterDependencyTokenError::Internal => {
1962 RegisterDependencyTokenError::INTERNAL
1963 }
1964
1965 crate::natural::RegisterDependencyTokenError::UnknownOrdinal_(value) => {
1966 RegisterDependencyTokenError { value: ::fidl_next::wire::Uint32::from(value) }
1967 }
1968 }
1969 }
1970 }
1971
1972 impl ::fidl_next::IntoNatural for RegisterDependencyTokenError {
1973 type Natural = crate::natural::RegisterDependencyTokenError;
1974 }
1975
1976 pub type ElementControlUnregisterDependencyTokenResponse = ::fidl_next::wire::Unit;
1978
1979 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1981 #[repr(transparent)]
1982 pub struct UnregisterDependencyTokenError {
1983 pub(crate) value: ::fidl_next::wire::Uint32,
1984 }
1985
1986 impl ::fidl_next::Constrained for UnregisterDependencyTokenError {
1987 type Constraint = ();
1988
1989 fn validate(
1990 _: ::fidl_next::Slot<'_, Self>,
1991 _: Self::Constraint,
1992 ) -> Result<(), ::fidl_next::ValidationError> {
1993 Ok(())
1994 }
1995 }
1996
1997 unsafe impl ::fidl_next::Wire for UnregisterDependencyTokenError {
1998 type Narrowed<'de> = Self;
1999
2000 #[inline]
2001 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2002 }
2004 }
2005
2006 impl UnregisterDependencyTokenError {
2007 pub const NOT_AUTHORIZED: UnregisterDependencyTokenError =
2008 UnregisterDependencyTokenError { value: ::fidl_next::wire::Uint32(1) };
2009
2010 pub const NOT_FOUND: UnregisterDependencyTokenError =
2011 UnregisterDependencyTokenError { value: ::fidl_next::wire::Uint32(2) };
2012 }
2013
2014 unsafe impl<___D> ::fidl_next::Decode<___D> for UnregisterDependencyTokenError
2015 where
2016 ___D: ?Sized,
2017 {
2018 fn decode(
2019 slot: ::fidl_next::Slot<'_, Self>,
2020 _: &mut ___D,
2021 _: (),
2022 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2023 Ok(())
2024 }
2025 }
2026
2027 impl ::core::convert::From<crate::natural::UnregisterDependencyTokenError>
2028 for UnregisterDependencyTokenError
2029 {
2030 fn from(natural: crate::natural::UnregisterDependencyTokenError) -> Self {
2031 match natural {
2032 crate::natural::UnregisterDependencyTokenError::NotAuthorized => {
2033 UnregisterDependencyTokenError::NOT_AUTHORIZED
2034 }
2035
2036 crate::natural::UnregisterDependencyTokenError::NotFound => {
2037 UnregisterDependencyTokenError::NOT_FOUND
2038 }
2039
2040 crate::natural::UnregisterDependencyTokenError::UnknownOrdinal_(value) => {
2041 UnregisterDependencyTokenError { value: ::fidl_next::wire::Uint32::from(value) }
2042 }
2043 }
2044 }
2045 }
2046
2047 impl ::fidl_next::IntoNatural for UnregisterDependencyTokenError {
2048 type Natural = crate::natural::UnregisterDependencyTokenError;
2049 }
2050
2051 pub type ElementControlAddDependencyResponse = ::fidl_next::wire::Unit;
2053
2054 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
2056 #[repr(transparent)]
2057 pub struct ModifyDependencyError {
2058 pub(crate) value: ::fidl_next::wire::Uint32,
2059 }
2060
2061 impl ::fidl_next::Constrained for ModifyDependencyError {
2062 type Constraint = ();
2063
2064 fn validate(
2065 _: ::fidl_next::Slot<'_, Self>,
2066 _: Self::Constraint,
2067 ) -> Result<(), ::fidl_next::ValidationError> {
2068 Ok(())
2069 }
2070 }
2071
2072 unsafe impl ::fidl_next::Wire for ModifyDependencyError {
2073 type Narrowed<'de> = Self;
2074
2075 #[inline]
2076 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2077 }
2079 }
2080
2081 impl ModifyDependencyError {
2082 pub const ALREADY_EXISTS: ModifyDependencyError =
2083 ModifyDependencyError { value: ::fidl_next::wire::Uint32(1) };
2084
2085 pub const INVALID: ModifyDependencyError =
2086 ModifyDependencyError { value: ::fidl_next::wire::Uint32(2) };
2087
2088 pub const NOT_AUTHORIZED: ModifyDependencyError =
2089 ModifyDependencyError { value: ::fidl_next::wire::Uint32(3) };
2090
2091 pub const NOT_FOUND: ModifyDependencyError =
2092 ModifyDependencyError { value: ::fidl_next::wire::Uint32(4) };
2093 }
2094
2095 unsafe impl<___D> ::fidl_next::Decode<___D> for ModifyDependencyError
2096 where
2097 ___D: ?Sized,
2098 {
2099 fn decode(
2100 slot: ::fidl_next::Slot<'_, Self>,
2101 _: &mut ___D,
2102 _: (),
2103 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2104 Ok(())
2105 }
2106 }
2107
2108 impl ::core::convert::From<crate::natural::ModifyDependencyError> for ModifyDependencyError {
2109 fn from(natural: crate::natural::ModifyDependencyError) -> Self {
2110 match natural {
2111 crate::natural::ModifyDependencyError::AlreadyExists => {
2112 ModifyDependencyError::ALREADY_EXISTS
2113 }
2114
2115 crate::natural::ModifyDependencyError::Invalid => ModifyDependencyError::INVALID,
2116
2117 crate::natural::ModifyDependencyError::NotAuthorized => {
2118 ModifyDependencyError::NOT_AUTHORIZED
2119 }
2120
2121 crate::natural::ModifyDependencyError::NotFound => ModifyDependencyError::NOT_FOUND,
2122
2123 crate::natural::ModifyDependencyError::UnknownOrdinal_(value) => {
2124 ModifyDependencyError { value: ::fidl_next::wire::Uint32::from(value) }
2125 }
2126 }
2127 }
2128 }
2129
2130 impl ::fidl_next::IntoNatural for ModifyDependencyError {
2131 type Natural = crate::natural::ModifyDependencyError;
2132 }
2133
2134 #[repr(C)]
2136 pub struct PowerLevelName<'de> {
2137 pub(crate) table: ::fidl_next::wire::Table<'de>,
2138 }
2139
2140 impl<'de> Drop for PowerLevelName<'de> {
2141 fn drop(&mut self) {
2142 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2143
2144 let _ = self.table.get(2).map(|envelope| unsafe {
2145 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2146 });
2147 }
2148 }
2149
2150 impl ::fidl_next::Constrained for PowerLevelName<'_> {
2151 type Constraint = ();
2152
2153 fn validate(
2154 _: ::fidl_next::Slot<'_, Self>,
2155 _: Self::Constraint,
2156 ) -> Result<(), ::fidl_next::ValidationError> {
2157 Ok(())
2158 }
2159 }
2160
2161 unsafe impl ::fidl_next::Wire for PowerLevelName<'static> {
2162 type Narrowed<'de> = PowerLevelName<'de>;
2163
2164 #[inline]
2165 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2166 ::fidl_next::munge!(let Self { table } = out);
2167 ::fidl_next::wire::Table::zero_padding(table);
2168 }
2169 }
2170
2171 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerLevelName<'de>
2172 where
2173 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2174 {
2175 fn decode(
2176 slot: ::fidl_next::Slot<'_, Self>,
2177 decoder: &mut ___D,
2178 _: (),
2179 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2180 ::fidl_next::munge!(let Self { table } = slot);
2181
2182 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2183 match ordinal {
2184 0 => unsafe { ::core::hint::unreachable_unchecked() },
2185
2186 1 => {
2187 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2188 slot.as_mut(),
2189 decoder,
2190 (),
2191 )?;
2192
2193 Ok(())
2194 }
2195
2196 2 => {
2197 ::fidl_next::wire::Envelope::decode_as::<
2198 ___D,
2199 ::fidl_next::wire::String<'de>,
2200 >(slot.as_mut(), decoder, 16)?;
2201
2202 let value = unsafe {
2203 slot.deref_unchecked()
2204 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2205 };
2206
2207 if value.len() > 16 {
2208 return Err(::fidl_next::DecodeError::VectorTooLong {
2209 size: value.len() as u64,
2210 limit: 16,
2211 });
2212 }
2213
2214 Ok(())
2215 }
2216
2217 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2218 }
2219 })
2220 }
2221 }
2222
2223 impl<'de> PowerLevelName<'de> {
2224 pub fn level(&self) -> ::core::option::Option<&u8> {
2225 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2226 }
2227
2228 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2229 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2230 }
2231 }
2232
2233 impl<'de> ::core::fmt::Debug for PowerLevelName<'de> {
2234 fn fmt(
2235 &self,
2236 f: &mut ::core::fmt::Formatter<'_>,
2237 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2238 f.debug_struct("PowerLevelName")
2239 .field("level", &self.level())
2240 .field("name", &self.name())
2241 .finish()
2242 }
2243 }
2244
2245 impl<'de> ::fidl_next::IntoNatural for PowerLevelName<'de> {
2246 type Natural = crate::natural::PowerLevelName;
2247 }
2248
2249 #[repr(C)]
2251 pub struct ElementPowerLevelNames<'de> {
2252 pub(crate) table: ::fidl_next::wire::Table<'de>,
2253 }
2254
2255 impl<'de> Drop for ElementPowerLevelNames<'de> {
2256 fn drop(&mut self) {
2257 let _ = self.table.get(1).map(|envelope| unsafe {
2258 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2259 });
2260
2261 let _ = self.table.get(2)
2262 .map(|envelope| unsafe {
2263 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerLevelName<'de>>>()
2264 });
2265 }
2266 }
2267
2268 impl ::fidl_next::Constrained for ElementPowerLevelNames<'_> {
2269 type Constraint = ();
2270
2271 fn validate(
2272 _: ::fidl_next::Slot<'_, Self>,
2273 _: Self::Constraint,
2274 ) -> Result<(), ::fidl_next::ValidationError> {
2275 Ok(())
2276 }
2277 }
2278
2279 unsafe impl ::fidl_next::Wire for ElementPowerLevelNames<'static> {
2280 type Narrowed<'de> = ElementPowerLevelNames<'de>;
2281
2282 #[inline]
2283 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2284 ::fidl_next::munge!(let Self { table } = out);
2285 ::fidl_next::wire::Table::zero_padding(table);
2286 }
2287 }
2288
2289 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ElementPowerLevelNames<'de>
2290 where
2291 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2292 {
2293 fn decode(
2294 slot: ::fidl_next::Slot<'_, Self>,
2295 decoder: &mut ___D,
2296 _: (),
2297 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2298 ::fidl_next::munge!(let Self { table } = slot);
2299
2300 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2301 match ordinal {
2302 0 => unsafe { ::core::hint::unreachable_unchecked() },
2303
2304 1 => {
2305 ::fidl_next::wire::Envelope::decode_as::<
2306 ___D,
2307 ::fidl_next::wire::String<'de>,
2308 >(slot.as_mut(), decoder, 64)?;
2309
2310 let value = unsafe {
2311 slot.deref_unchecked()
2312 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2313 };
2314
2315 if value.len() > 64 {
2316 return Err(::fidl_next::DecodeError::VectorTooLong {
2317 size: value.len() as u64,
2318 limit: 64,
2319 });
2320 }
2321
2322 Ok(())
2323 }
2324
2325 2 => {
2326 ::fidl_next::wire::Envelope::decode_as::<
2327 ___D,
2328 ::fidl_next::wire::Vector<'de, crate::wire::PowerLevelName<'de>>,
2329 >(slot.as_mut(), decoder, (256, ()))?;
2330
2331 let value = unsafe {
2332 slot
2333 .deref_unchecked()
2334 .deref_unchecked::<
2335 ::fidl_next::wire::Vector<'_, crate::wire::PowerLevelName<'_>>
2336 >()
2337 };
2338
2339 if value.len() > 256 {
2340 return Err(::fidl_next::DecodeError::VectorTooLong {
2341 size: value.len() as u64,
2342 limit: 256,
2343 });
2344 }
2345
2346 Ok(())
2347 }
2348
2349 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2350 }
2351 })
2352 }
2353 }
2354
2355 impl<'de> ElementPowerLevelNames<'de> {
2356 pub fn identifier(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2357 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2358 }
2359
2360 pub fn levels(
2361 &self,
2362 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::PowerLevelName<'de>>>
2363 {
2364 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2365 }
2366 }
2367
2368 impl<'de> ::core::fmt::Debug for ElementPowerLevelNames<'de> {
2369 fn fmt(
2370 &self,
2371 f: &mut ::core::fmt::Formatter<'_>,
2372 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2373 f.debug_struct("ElementPowerLevelNames")
2374 .field("identifier", &self.identifier())
2375 .field("levels", &self.levels())
2376 .finish()
2377 }
2378 }
2379
2380 impl<'de> ::fidl_next::IntoNatural for ElementPowerLevelNames<'de> {
2381 type Natural = crate::natural::ElementPowerLevelNames;
2382 }
2383
2384 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
2386 #[repr(transparent)]
2387 pub struct ElementInfoProviderError {
2388 pub(crate) value: ::fidl_next::wire::Uint32,
2389 }
2390
2391 impl ::fidl_next::Constrained for ElementInfoProviderError {
2392 type Constraint = ();
2393
2394 fn validate(
2395 _: ::fidl_next::Slot<'_, Self>,
2396 _: Self::Constraint,
2397 ) -> Result<(), ::fidl_next::ValidationError> {
2398 Ok(())
2399 }
2400 }
2401
2402 unsafe impl ::fidl_next::Wire for ElementInfoProviderError {
2403 type Narrowed<'de> = Self;
2404
2405 #[inline]
2406 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2407 }
2409 }
2410
2411 impl ElementInfoProviderError {
2412 pub const UNKNOWN: ElementInfoProviderError =
2413 ElementInfoProviderError { value: ::fidl_next::wire::Uint32(0) };
2414
2415 pub const FAILED: ElementInfoProviderError =
2416 ElementInfoProviderError { value: ::fidl_next::wire::Uint32(1) };
2417 }
2418
2419 unsafe impl<___D> ::fidl_next::Decode<___D> for ElementInfoProviderError
2420 where
2421 ___D: ?Sized,
2422 {
2423 fn decode(
2424 slot: ::fidl_next::Slot<'_, Self>,
2425 _: &mut ___D,
2426 _: (),
2427 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2428 Ok(())
2429 }
2430 }
2431
2432 impl ::core::convert::From<crate::natural::ElementInfoProviderError> for ElementInfoProviderError {
2433 fn from(natural: crate::natural::ElementInfoProviderError) -> Self {
2434 match natural {
2435 crate::natural::ElementInfoProviderError::Unknown => {
2436 ElementInfoProviderError::UNKNOWN
2437 }
2438
2439 crate::natural::ElementInfoProviderError::Failed => {
2440 ElementInfoProviderError::FAILED
2441 }
2442
2443 crate::natural::ElementInfoProviderError::UnknownOrdinal_(value) => {
2444 ElementInfoProviderError { value: ::fidl_next::wire::Uint32::from(value) }
2445 }
2446 }
2447 }
2448 }
2449
2450 impl ::fidl_next::IntoNatural for ElementInfoProviderError {
2451 type Natural = crate::natural::ElementInfoProviderError;
2452 }
2453
2454 #[derive(Clone, Debug)]
2456 #[repr(C)]
2457 pub struct ElementRunnerSetLevelRequest {
2458 pub level: u8,
2459 }
2460
2461 static_assertions::const_assert_eq!(std::mem::size_of::<ElementRunnerSetLevelRequest>(), 1);
2462 static_assertions::const_assert_eq!(std::mem::align_of::<ElementRunnerSetLevelRequest>(), 1);
2463
2464 static_assertions::const_assert_eq!(
2465 std::mem::offset_of!(ElementRunnerSetLevelRequest, level),
2466 0
2467 );
2468
2469 impl ::fidl_next::Constrained for ElementRunnerSetLevelRequest {
2470 type Constraint = ();
2471
2472 fn validate(
2473 _: ::fidl_next::Slot<'_, Self>,
2474 _: Self::Constraint,
2475 ) -> Result<(), ::fidl_next::ValidationError> {
2476 Ok(())
2477 }
2478 }
2479
2480 unsafe impl ::fidl_next::Wire for ElementRunnerSetLevelRequest {
2481 type Narrowed<'de> = ElementRunnerSetLevelRequest;
2482
2483 #[inline]
2484 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2485 ::fidl_next::munge! {
2486 let Self {
2487 level,
2488
2489 } = &mut *out_;
2490 }
2491
2492 ::fidl_next::Wire::zero_padding(level);
2493 }
2494 }
2495
2496 unsafe impl<___D> ::fidl_next::Decode<___D> for ElementRunnerSetLevelRequest
2497 where
2498 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2499 {
2500 fn decode(
2501 slot_: ::fidl_next::Slot<'_, Self>,
2502 decoder_: &mut ___D,
2503 _: (),
2504 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2505 ::fidl_next::munge! {
2506 let Self {
2507 mut level,
2508
2509 } = slot_;
2510 }
2511
2512 let _field = level.as_mut();
2513
2514 ::fidl_next::Decode::decode(level.as_mut(), decoder_, ())?;
2515
2516 Ok(())
2517 }
2518 }
2519
2520 impl ::fidl_next::IntoNatural for ElementRunnerSetLevelRequest {
2521 type Natural = crate::natural::ElementRunnerSetLevelRequest;
2522 }
2523
2524 pub type ElementRunnerSetLevelResponse = ::fidl_next::wire::Unit;
2526
2527 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
2529 #[repr(transparent)]
2530 pub struct LeaseStatus {
2531 pub(crate) value: ::fidl_next::wire::Uint32,
2532 }
2533
2534 impl ::fidl_next::Constrained for LeaseStatus {
2535 type Constraint = ();
2536
2537 fn validate(
2538 _: ::fidl_next::Slot<'_, Self>,
2539 _: Self::Constraint,
2540 ) -> Result<(), ::fidl_next::ValidationError> {
2541 Ok(())
2542 }
2543 }
2544
2545 unsafe impl ::fidl_next::Wire for LeaseStatus {
2546 type Narrowed<'de> = Self;
2547
2548 #[inline]
2549 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2550 }
2552 }
2553
2554 impl LeaseStatus {
2555 pub const UNKNOWN: LeaseStatus = LeaseStatus { value: ::fidl_next::wire::Uint32(0) };
2556
2557 pub const PENDING: LeaseStatus = LeaseStatus { value: ::fidl_next::wire::Uint32(1) };
2558
2559 pub const SATISFIED: LeaseStatus = LeaseStatus { value: ::fidl_next::wire::Uint32(2) };
2560 }
2561
2562 unsafe impl<___D> ::fidl_next::Decode<___D> for LeaseStatus
2563 where
2564 ___D: ?Sized,
2565 {
2566 fn decode(
2567 slot: ::fidl_next::Slot<'_, Self>,
2568 _: &mut ___D,
2569 _: (),
2570 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2571 Ok(())
2572 }
2573 }
2574
2575 impl ::core::convert::From<crate::natural::LeaseStatus> for LeaseStatus {
2576 fn from(natural: crate::natural::LeaseStatus) -> Self {
2577 match natural {
2578 crate::natural::LeaseStatus::Unknown => LeaseStatus::UNKNOWN,
2579
2580 crate::natural::LeaseStatus::Pending => LeaseStatus::PENDING,
2581
2582 crate::natural::LeaseStatus::Satisfied => LeaseStatus::SATISFIED,
2583
2584 crate::natural::LeaseStatus::UnknownOrdinal_(value) => {
2585 LeaseStatus { value: ::fidl_next::wire::Uint32::from(value) }
2586 }
2587 }
2588 }
2589 }
2590
2591 impl ::fidl_next::IntoNatural for LeaseStatus {
2592 type Natural = crate::natural::LeaseStatus;
2593 }
2594
2595 #[derive(Clone, Debug)]
2597 #[repr(C)]
2598 pub struct LeaseControlWatchStatusRequest {
2599 pub last_status: crate::wire::LeaseStatus,
2600 }
2601
2602 static_assertions::const_assert_eq!(std::mem::size_of::<LeaseControlWatchStatusRequest>(), 4);
2603 static_assertions::const_assert_eq!(std::mem::align_of::<LeaseControlWatchStatusRequest>(), 4);
2604
2605 static_assertions::const_assert_eq!(
2606 std::mem::offset_of!(LeaseControlWatchStatusRequest, last_status),
2607 0
2608 );
2609
2610 impl ::fidl_next::Constrained for LeaseControlWatchStatusRequest {
2611 type Constraint = ();
2612
2613 fn validate(
2614 _: ::fidl_next::Slot<'_, Self>,
2615 _: Self::Constraint,
2616 ) -> Result<(), ::fidl_next::ValidationError> {
2617 Ok(())
2618 }
2619 }
2620
2621 unsafe impl ::fidl_next::Wire for LeaseControlWatchStatusRequest {
2622 type Narrowed<'de> = LeaseControlWatchStatusRequest;
2623
2624 #[inline]
2625 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2626 ::fidl_next::munge! {
2627 let Self {
2628 last_status,
2629
2630 } = &mut *out_;
2631 }
2632
2633 ::fidl_next::Wire::zero_padding(last_status);
2634 }
2635 }
2636
2637 unsafe impl<___D> ::fidl_next::Decode<___D> for LeaseControlWatchStatusRequest
2638 where
2639 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2640 {
2641 fn decode(
2642 slot_: ::fidl_next::Slot<'_, Self>,
2643 decoder_: &mut ___D,
2644 _: (),
2645 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2646 ::fidl_next::munge! {
2647 let Self {
2648 mut last_status,
2649
2650 } = slot_;
2651 }
2652
2653 let _field = last_status.as_mut();
2654
2655 ::fidl_next::Decode::decode(last_status.as_mut(), decoder_, ())?;
2656
2657 Ok(())
2658 }
2659 }
2660
2661 impl ::fidl_next::IntoNatural for LeaseControlWatchStatusRequest {
2662 type Natural = crate::natural::LeaseControlWatchStatusRequest;
2663 }
2664
2665 #[derive(Clone, Debug)]
2667 #[repr(C)]
2668 pub struct LeaseControlWatchStatusResponse {
2669 pub status: crate::wire::LeaseStatus,
2670 }
2671
2672 static_assertions::const_assert_eq!(std::mem::size_of::<LeaseControlWatchStatusResponse>(), 4);
2673 static_assertions::const_assert_eq!(std::mem::align_of::<LeaseControlWatchStatusResponse>(), 4);
2674
2675 static_assertions::const_assert_eq!(
2676 std::mem::offset_of!(LeaseControlWatchStatusResponse, status),
2677 0
2678 );
2679
2680 impl ::fidl_next::Constrained for LeaseControlWatchStatusResponse {
2681 type Constraint = ();
2682
2683 fn validate(
2684 _: ::fidl_next::Slot<'_, Self>,
2685 _: Self::Constraint,
2686 ) -> Result<(), ::fidl_next::ValidationError> {
2687 Ok(())
2688 }
2689 }
2690
2691 unsafe impl ::fidl_next::Wire for LeaseControlWatchStatusResponse {
2692 type Narrowed<'de> = LeaseControlWatchStatusResponse;
2693
2694 #[inline]
2695 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2696 ::fidl_next::munge! {
2697 let Self {
2698 status,
2699
2700 } = &mut *out_;
2701 }
2702
2703 ::fidl_next::Wire::zero_padding(status);
2704 }
2705 }
2706
2707 unsafe impl<___D> ::fidl_next::Decode<___D> for LeaseControlWatchStatusResponse
2708 where
2709 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2710 {
2711 fn decode(
2712 slot_: ::fidl_next::Slot<'_, Self>,
2713 decoder_: &mut ___D,
2714 _: (),
2715 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2716 ::fidl_next::munge! {
2717 let Self {
2718 mut status,
2719
2720 } = slot_;
2721 }
2722
2723 let _field = status.as_mut();
2724
2725 ::fidl_next::Decode::decode(status.as_mut(), decoder_, ())?;
2726
2727 Ok(())
2728 }
2729 }
2730
2731 impl ::fidl_next::IntoNatural for LeaseControlWatchStatusResponse {
2732 type Natural = crate::natural::LeaseControlWatchStatusResponse;
2733 }
2734
2735 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
2737 #[repr(transparent)]
2738 pub struct LeaseError {
2739 pub(crate) value: ::fidl_next::wire::Uint32,
2740 }
2741
2742 impl ::fidl_next::Constrained for LeaseError {
2743 type Constraint = ();
2744
2745 fn validate(
2746 _: ::fidl_next::Slot<'_, Self>,
2747 _: Self::Constraint,
2748 ) -> Result<(), ::fidl_next::ValidationError> {
2749 Ok(())
2750 }
2751 }
2752
2753 unsafe impl ::fidl_next::Wire for LeaseError {
2754 type Narrowed<'de> = Self;
2755
2756 #[inline]
2757 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2758 }
2760 }
2761
2762 impl LeaseError {
2763 pub const INTERNAL: LeaseError = LeaseError { value: ::fidl_next::wire::Uint32(1) };
2764
2765 pub const NOT_AUTHORIZED: LeaseError = LeaseError { value: ::fidl_next::wire::Uint32(2) };
2766
2767 pub const INVALID_LEVEL: LeaseError = LeaseError { value: ::fidl_next::wire::Uint32(3) };
2768
2769 pub const INVALID_ARGUMENT: LeaseError = LeaseError { value: ::fidl_next::wire::Uint32(4) };
2770 }
2771
2772 unsafe impl<___D> ::fidl_next::Decode<___D> for LeaseError
2773 where
2774 ___D: ?Sized,
2775 {
2776 fn decode(
2777 slot: ::fidl_next::Slot<'_, Self>,
2778 _: &mut ___D,
2779 _: (),
2780 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2781 Ok(())
2782 }
2783 }
2784
2785 impl ::core::convert::From<crate::natural::LeaseError> for LeaseError {
2786 fn from(natural: crate::natural::LeaseError) -> Self {
2787 match natural {
2788 crate::natural::LeaseError::Internal => LeaseError::INTERNAL,
2789
2790 crate::natural::LeaseError::NotAuthorized => LeaseError::NOT_AUTHORIZED,
2791
2792 crate::natural::LeaseError::InvalidLevel => LeaseError::INVALID_LEVEL,
2793
2794 crate::natural::LeaseError::InvalidArgument => LeaseError::INVALID_ARGUMENT,
2795
2796 crate::natural::LeaseError::UnknownOrdinal_(value) => {
2797 LeaseError { value: ::fidl_next::wire::Uint32::from(value) }
2798 }
2799 }
2800 }
2801 }
2802
2803 impl ::fidl_next::IntoNatural for LeaseError {
2804 type Natural = crate::natural::LeaseError;
2805 }
2806
2807 #[derive(Clone, Copy, Debug)]
2809 #[repr(transparent)]
2810 pub struct Permissions {
2811 pub(crate) value: ::fidl_next::wire::Uint32,
2812 }
2813
2814 impl ::fidl_next::Constrained for Permissions {
2815 type Constraint = ();
2816
2817 fn validate(
2818 _: ::fidl_next::Slot<'_, Self>,
2819 _: Self::Constraint,
2820 ) -> Result<(), ::fidl_next::ValidationError> {
2821 Ok(())
2822 }
2823 }
2824
2825 unsafe impl ::fidl_next::Wire for Permissions {
2826 type Narrowed<'de> = Self;
2827
2828 #[inline]
2829 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2830 }
2832 }
2833
2834 unsafe impl<___D> ::fidl_next::Decode<___D> for Permissions
2835 where
2836 ___D: ?Sized,
2837 {
2838 fn decode(
2839 slot: ::fidl_next::Slot<'_, Self>,
2840 _: &mut ___D,
2841 _: (),
2842 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2843 ::fidl_next::munge!(let Self { value } = slot);
2844 let set = u32::from(*value);
2845 if set & !crate::natural::Permissions::all().bits() != 0 {
2846 return Err(::fidl_next::DecodeError::InvalidBits {
2847 expected: crate::natural::Permissions::all().bits() as usize,
2848 actual: set as usize,
2849 });
2850 }
2851
2852 Ok(())
2853 }
2854 }
2855
2856 impl ::core::convert::From<crate::natural::Permissions> for Permissions {
2857 fn from(natural: crate::natural::Permissions) -> Self {
2858 Self { value: ::fidl_next::wire::Uint32::from(natural.bits()) }
2859 }
2860 }
2861
2862 impl ::fidl_next::IntoNatural for Permissions {
2863 type Natural = crate::natural::Permissions;
2864 }
2865
2866 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
2868 #[repr(transparent)]
2869 pub struct StatusError {
2870 pub(crate) value: ::fidl_next::wire::Uint32,
2871 }
2872
2873 impl ::fidl_next::Constrained for StatusError {
2874 type Constraint = ();
2875
2876 fn validate(
2877 _: ::fidl_next::Slot<'_, Self>,
2878 _: Self::Constraint,
2879 ) -> Result<(), ::fidl_next::ValidationError> {
2880 Ok(())
2881 }
2882 }
2883
2884 unsafe impl ::fidl_next::Wire for StatusError {
2885 type Narrowed<'de> = Self;
2886
2887 #[inline]
2888 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2889 }
2891 }
2892
2893 impl StatusError {
2894 pub const UNKNOWN: StatusError = StatusError { value: ::fidl_next::wire::Uint32(1) };
2895 }
2896
2897 unsafe impl<___D> ::fidl_next::Decode<___D> for StatusError
2898 where
2899 ___D: ?Sized,
2900 {
2901 fn decode(
2902 slot: ::fidl_next::Slot<'_, Self>,
2903 _: &mut ___D,
2904 _: (),
2905 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2906 Ok(())
2907 }
2908 }
2909
2910 impl ::core::convert::From<crate::natural::StatusError> for StatusError {
2911 fn from(natural: crate::natural::StatusError) -> Self {
2912 match natural {
2913 crate::natural::StatusError::Unknown => StatusError::UNKNOWN,
2914
2915 crate::natural::StatusError::UnknownOrdinal_(value) => {
2916 StatusError { value: ::fidl_next::wire::Uint32::from(value) }
2917 }
2918 }
2919 }
2920 }
2921
2922 impl ::fidl_next::IntoNatural for StatusError {
2923 type Natural = crate::natural::StatusError;
2924 }
2925
2926 pub type TopologyAddElementResponse = ::fidl_next::wire::Unit;
2928
2929 pub type TopologyLeaseResponse = ::fidl_next::wire::Unit;
2931}
2932
2933pub mod wire_optional {}
2934
2935pub mod generic {
2936
2937 pub type ElementControlRegisterDependencyTokenResponse = ();
2939
2940 pub type ElementControlUnregisterDependencyTokenResponse = ();
2942
2943 pub type ElementControlAddDependencyResponse = ();
2945
2946 pub struct ElementRunnerSetLevelRequest<T0> {
2948 pub level: T0,
2949 }
2950
2951 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::ElementRunnerSetLevelRequest, ___E>
2952 for ElementRunnerSetLevelRequest<T0>
2953 where
2954 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2955 T0: ::fidl_next::Encode<u8, ___E>,
2956 {
2957 #[inline]
2958 fn encode(
2959 self,
2960 encoder_: &mut ___E,
2961 out_: &mut ::core::mem::MaybeUninit<crate::wire::ElementRunnerSetLevelRequest>,
2962 _: (),
2963 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2964 ::fidl_next::munge! {
2965 let crate::wire::ElementRunnerSetLevelRequest {
2966 level,
2967
2968 } = out_;
2969 }
2970
2971 ::fidl_next::Encode::encode(self.level, encoder_, level, ())?;
2972
2973 Ok(())
2974 }
2975 }
2976
2977 pub type ElementRunnerSetLevelResponse = ();
2979
2980 pub struct LeaseControlWatchStatusRequest<T0> {
2982 pub last_status: T0,
2983 }
2984
2985 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusRequest, ___E>
2986 for LeaseControlWatchStatusRequest<T0>
2987 where
2988 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2989 T0: ::fidl_next::Encode<crate::wire::LeaseStatus, ___E>,
2990 {
2991 #[inline]
2992 fn encode(
2993 self,
2994 encoder_: &mut ___E,
2995 out_: &mut ::core::mem::MaybeUninit<crate::wire::LeaseControlWatchStatusRequest>,
2996 _: (),
2997 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2998 ::fidl_next::munge! {
2999 let crate::wire::LeaseControlWatchStatusRequest {
3000 last_status,
3001
3002 } = out_;
3003 }
3004
3005 ::fidl_next::Encode::encode(self.last_status, encoder_, last_status, ())?;
3006
3007 Ok(())
3008 }
3009 }
3010
3011 pub struct LeaseControlWatchStatusResponse<T0> {
3013 pub status: T0,
3014 }
3015
3016 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::LeaseControlWatchStatusResponse, ___E>
3017 for LeaseControlWatchStatusResponse<T0>
3018 where
3019 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3020 T0: ::fidl_next::Encode<crate::wire::LeaseStatus, ___E>,
3021 {
3022 #[inline]
3023 fn encode(
3024 self,
3025 encoder_: &mut ___E,
3026 out_: &mut ::core::mem::MaybeUninit<crate::wire::LeaseControlWatchStatusResponse>,
3027 _: (),
3028 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3029 ::fidl_next::munge! {
3030 let crate::wire::LeaseControlWatchStatusResponse {
3031 status,
3032
3033 } = out_;
3034 }
3035
3036 ::fidl_next::Encode::encode(self.status, encoder_, status, ())?;
3037
3038 Ok(())
3039 }
3040 }
3041
3042 pub type TopologyAddElementResponse = ();
3044
3045 pub type TopologyLeaseResponse = ();
3047}
3048
3049pub use self::natural::*;
3050
3051pub const MAX_VALID_POWER_LEVELS: u16 = 256 as u16;
3052
3053pub const MAX_ELEMENT_NAME_LEN: u8 = 64 as u8;
3054
3055#[doc = " PowerLevel name lengths are limited to reduce Inspect space usage\n"]
3056pub const MAX_LEVEL_NAME_LEN: u16 = 16 as u16;
3057
3058#[doc = " The runner or operator of an element.\n This should be implemented by all element owners.\n The client end is passed to Power Broker via ElementSchema.element_runner.\n Power Broker calls SetLevel initially, and then whenever the required level\n of the element changes.\n"]
3060#[derive(PartialEq, Debug)]
3061pub struct ElementRunner;
3062
3063impl ::fidl_next::Discoverable for ElementRunner {
3064 const PROTOCOL_NAME: &'static str = "fuchsia.power.broker.ElementRunner";
3065}
3066
3067#[cfg(target_os = "fuchsia")]
3068impl ::fidl_next::HasTransport for ElementRunner {
3069 type Transport = ::fidl_next::fuchsia::zx::Channel;
3070}
3071
3072pub mod element_runner {
3073 pub mod prelude {
3074 pub use crate::{
3075 ElementRunner, ElementRunnerClientHandler, ElementRunnerLocalClientHandler,
3076 ElementRunnerLocalServerHandler, ElementRunnerServerHandler, element_runner,
3077 };
3078
3079 pub use crate::natural::ElementRunnerSetLevelRequest;
3080
3081 pub use crate::natural::ElementRunnerSetLevelResponse;
3082 }
3083
3084 pub struct SetLevel;
3085
3086 impl ::fidl_next::Method for SetLevel {
3087 const ORDINAL: u64 = 79537611020078859;
3088 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3089 ::fidl_next::protocol::Flexibility::Flexible;
3090
3091 type Protocol = crate::ElementRunner;
3092
3093 type Request = crate::wire::ElementRunnerSetLevelRequest;
3094 }
3095
3096 impl ::fidl_next::TwoWayMethod for SetLevel {
3097 type Response =
3098 ::fidl_next::wire::Flexible<'static, crate::wire::ElementRunnerSetLevelResponse>;
3099 }
3100
3101 impl<___R> ::fidl_next::Respond<___R> for SetLevel {
3102 type Output = ::fidl_next::Flexible<___R>;
3103
3104 fn respond(response: ___R) -> Self::Output {
3105 ::fidl_next::Flexible::Ok(response)
3106 }
3107 }
3108
3109 mod ___detail {
3110 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ElementRunner
3111 where
3112 ___T: ::fidl_next::Transport,
3113 {
3114 type Client = ElementRunnerClient<___T>;
3115 type Server = ElementRunnerServer<___T>;
3116 }
3117
3118 #[repr(transparent)]
3120 pub struct ElementRunnerClient<___T: ::fidl_next::Transport> {
3121 #[allow(dead_code)]
3122 client: ::fidl_next::protocol::Client<___T>,
3123 }
3124
3125 impl<___T> ElementRunnerClient<___T>
3126 where
3127 ___T: ::fidl_next::Transport,
3128 {
3129 #[doc = " Sets the level of the power element.\n\n The server blocks while making the level transition. It returns\n once the transition to the new required level is complete.\n If the element cannot transition to the new required level and\n it cannot retry, the channel will be closed.\n"]
3130 pub fn set_level(
3131 &self,
3132
3133 level: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
3134 ) -> ::fidl_next::TwoWayFuture<'_, super::SetLevel, ___T>
3135 where
3136 <___T as ::fidl_next::Transport>::SendBuffer:
3137 ::fidl_next::encoder::InternalHandleEncoder,
3138 {
3139 self.set_level_with(crate::generic::ElementRunnerSetLevelRequest { level })
3140 }
3141
3142 #[doc = " Sets the level of the power element.\n\n The server blocks while making the level transition. It returns\n once the transition to the new required level is complete.\n If the element cannot transition to the new required level and\n it cannot retry, the channel will be closed.\n"]
3143 pub fn set_level_with<___R>(
3144 &self,
3145 request: ___R,
3146 ) -> ::fidl_next::TwoWayFuture<'_, super::SetLevel, ___T>
3147 where
3148 ___R: ::fidl_next::Encode<
3149 crate::wire::ElementRunnerSetLevelRequest,
3150 <___T as ::fidl_next::Transport>::SendBuffer,
3151 >,
3152 {
3153 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3154 79537611020078859,
3155 <super::SetLevel as ::fidl_next::Method>::FLEXIBILITY,
3156 request,
3157 ))
3158 }
3159 }
3160
3161 #[repr(transparent)]
3163 pub struct ElementRunnerServer<___T: ::fidl_next::Transport> {
3164 server: ::fidl_next::protocol::Server<___T>,
3165 }
3166
3167 impl<___T> ElementRunnerServer<___T> where ___T: ::fidl_next::Transport {}
3168 }
3169}
3170
3171#[diagnostic::on_unimplemented(
3172 note = "If {Self} implements the non-local ElementRunnerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3173)]
3174
3175pub trait ElementRunnerLocalClientHandler<
3179 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3180 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3181>
3182{
3183 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3184 ::core::future::ready(())
3185 }
3186}
3187
3188impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ElementRunner
3189where
3190 ___H: ElementRunnerLocalClientHandler<___T>,
3191 ___T: ::fidl_next::Transport,
3192{
3193 async fn on_event(
3194 handler: &mut ___H,
3195 ordinal: u64,
3196 flexibility: ::fidl_next::protocol::Flexibility,
3197 body: ::fidl_next::Body<___T>,
3198 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3199 match ordinal {
3200 ordinal => {
3201 handler.on_unknown_interaction(ordinal).await;
3202 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3203 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3204 } else {
3205 Ok(())
3206 }
3207 }
3208 }
3209 }
3210}
3211
3212#[diagnostic::on_unimplemented(
3213 note = "If {Self} implements the non-local ElementRunnerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3214)]
3215
3216pub trait ElementRunnerLocalServerHandler<
3220 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3221 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3222>
3223{
3224 #[doc = " Sets the level of the power element.\n\n The server blocks while making the level transition. It returns\n once the transition to the new required level is complete.\n If the element cannot transition to the new required level and\n it cannot retry, the channel will be closed.\n"]
3225 fn set_level(
3226 &mut self,
3227
3228 request: ::fidl_next::Request<element_runner::SetLevel, ___T>,
3229
3230 responder: ::fidl_next::Responder<element_runner::SetLevel, ___T>,
3231 ) -> impl ::core::future::Future<Output = ()>;
3232
3233 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3234 ::core::future::ready(())
3235 }
3236}
3237
3238impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ElementRunner
3239where
3240 ___H: ElementRunnerLocalServerHandler<___T>,
3241 ___T: ::fidl_next::Transport,
3242 for<'de> crate::wire::ElementRunnerSetLevelRequest: ::fidl_next::Decode<
3243 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3244 Constraint = (),
3245 >,
3246{
3247 async fn on_one_way(
3248 handler: &mut ___H,
3249 ordinal: u64,
3250 flexibility: ::fidl_next::protocol::Flexibility,
3251 body: ::fidl_next::Body<___T>,
3252 ) -> ::core::result::Result<
3253 (),
3254 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3255 > {
3256 match ordinal {
3257 ordinal => {
3258 handler.on_unknown_interaction(ordinal).await;
3259 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3260 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3261 } else {
3262 Ok(())
3263 }
3264 }
3265 }
3266 }
3267
3268 async fn on_two_way(
3269 handler: &mut ___H,
3270 ordinal: u64,
3271 flexibility: ::fidl_next::protocol::Flexibility,
3272 body: ::fidl_next::Body<___T>,
3273 responder: ::fidl_next::protocol::Responder<___T>,
3274 ) -> ::core::result::Result<
3275 (),
3276 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3277 > {
3278 match ordinal {
3279 79537611020078859 => {
3280 let responder = ::fidl_next::Responder::from_untyped(responder);
3281
3282 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3283 Ok(decoded) => {
3284 handler
3285 .set_level(::fidl_next::Request::from_decoded(decoded), responder)
3286 .await;
3287 Ok(())
3288 }
3289 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3290 ordinal: 79537611020078859,
3291 error,
3292 }),
3293 }
3294 }
3295
3296 ordinal => {
3297 handler.on_unknown_interaction(ordinal).await;
3298 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3299 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3300 } else {
3301 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
3302 ordinal,
3303 flexibility,
3304 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
3305 )
3306 .expect("encoding a framework error should never fail")
3307 .await?;
3308 Ok(())
3309 }
3310 }
3311 }
3312 }
3313}
3314
3315pub trait ElementRunnerClientHandler<
3319 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3320 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3321>
3322{
3323 fn on_unknown_interaction(
3324 &mut self,
3325 ordinal: u64,
3326 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3327 ::core::future::ready(())
3328 }
3329}
3330
3331impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ElementRunner
3332where
3333 ___H: ElementRunnerClientHandler<___T> + ::core::marker::Send,
3334 ___T: ::fidl_next::Transport,
3335{
3336 async fn on_event(
3337 handler: &mut ___H,
3338 ordinal: u64,
3339 flexibility: ::fidl_next::protocol::Flexibility,
3340 body: ::fidl_next::Body<___T>,
3341 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3342 match ordinal {
3343 ordinal => {
3344 handler.on_unknown_interaction(ordinal).await;
3345 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3346 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3347 } else {
3348 Ok(())
3349 }
3350 }
3351 }
3352 }
3353}
3354
3355pub trait ElementRunnerServerHandler<
3359 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3360 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3361>
3362{
3363 #[doc = " Sets the level of the power element.\n\n The server blocks while making the level transition. It returns\n once the transition to the new required level is complete.\n If the element cannot transition to the new required level and\n it cannot retry, the channel will be closed.\n"]
3364 fn set_level(
3365 &mut self,
3366
3367 request: ::fidl_next::Request<element_runner::SetLevel, ___T>,
3368
3369 responder: ::fidl_next::Responder<element_runner::SetLevel, ___T>,
3370 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3371
3372 fn on_unknown_interaction(
3373 &mut self,
3374 ordinal: u64,
3375 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3376 ::core::future::ready(())
3377 }
3378}
3379
3380impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ElementRunner
3381where
3382 ___H: ElementRunnerServerHandler<___T> + ::core::marker::Send,
3383 ___T: ::fidl_next::Transport,
3384 for<'de> crate::wire::ElementRunnerSetLevelRequest: ::fidl_next::Decode<
3385 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3386 Constraint = (),
3387 >,
3388{
3389 async fn on_one_way(
3390 handler: &mut ___H,
3391 ordinal: u64,
3392 flexibility: ::fidl_next::protocol::Flexibility,
3393 body: ::fidl_next::Body<___T>,
3394 ) -> ::core::result::Result<
3395 (),
3396 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3397 > {
3398 match ordinal {
3399 ordinal => {
3400 handler.on_unknown_interaction(ordinal).await;
3401 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3402 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3403 } else {
3404 Ok(())
3405 }
3406 }
3407 }
3408 }
3409
3410 async fn on_two_way(
3411 handler: &mut ___H,
3412 ordinal: u64,
3413 flexibility: ::fidl_next::protocol::Flexibility,
3414 body: ::fidl_next::Body<___T>,
3415 responder: ::fidl_next::protocol::Responder<___T>,
3416 ) -> ::core::result::Result<
3417 (),
3418 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3419 > {
3420 match ordinal {
3421 79537611020078859 => {
3422 let responder = ::fidl_next::Responder::from_untyped(responder);
3423
3424 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3425 Ok(decoded) => {
3426 handler
3427 .set_level(::fidl_next::Request::from_decoded(decoded), responder)
3428 .await;
3429 Ok(())
3430 }
3431 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3432 ordinal: 79537611020078859,
3433 error,
3434 }),
3435 }
3436 }
3437
3438 ordinal => {
3439 handler.on_unknown_interaction(ordinal).await;
3440 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3441 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3442 } else {
3443 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
3444 ordinal,
3445 flexibility,
3446 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
3447 )
3448 .expect("encoding a framework error should never fail")
3449 .await?;
3450 Ok(())
3451 }
3452 }
3453 }
3454 }
3455}
3456
3457impl<___T> ElementRunnerClientHandler<___T> for ::fidl_next::IgnoreEvents
3458where
3459 ___T: ::fidl_next::Transport,
3460{
3461 async fn on_unknown_interaction(&mut self, _: u64) {}
3462}
3463
3464impl<___H, ___T> ElementRunnerLocalClientHandler<___T> for ::fidl_next::Local<___H>
3465where
3466 ___H: ElementRunnerClientHandler<___T>,
3467 ___T: ::fidl_next::Transport,
3468{
3469 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3470 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3471 }
3472}
3473
3474impl<___H, ___T> ElementRunnerLocalServerHandler<___T> for ::fidl_next::Local<___H>
3475where
3476 ___H: ElementRunnerServerHandler<___T>,
3477 ___T: ::fidl_next::Transport,
3478{
3479 async fn set_level(
3480 &mut self,
3481
3482 request: ::fidl_next::Request<element_runner::SetLevel, ___T>,
3483
3484 responder: ::fidl_next::Responder<element_runner::SetLevel, ___T>,
3485 ) {
3486 ___H::set_level(&mut self.0, request, responder).await
3487 }
3488
3489 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3490 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3491 }
3492}
3493
3494pub const MAX_DEPENDENCIES_IN_ADD_ELEMENT: u16 = 128 as u16;
3495
3496#[doc = " A token that represents an open lease. The client\'s handle should be\n dropped to indicate the lease should be closed. This handle may be\n duplicated if the lease will be shared; the lease will remain open\n until the last handle is dropped.\n"]
3497pub const LEASE_TOKEN_RIGHTS: ::fidl_next::fuchsia::zx::Rights =
3498 ::fidl_next::fuchsia::zx::Rights::from_bits_retain(24579);
3499
3500#[doc = " Signal sent by Power Broker on the LeaseToken when the lease is satisfied.\n"]
3501pub const LEASE_SIGNAL_SATISFIED: u32 = 16777216 as u32;
3502
3503#[doc = " Provides lease-scoped access to actions that can be taken on a lease\n previously acquired via Lessor.Lease. Closing this control channel drops\n the lease.\n TODO(https://fxbug.dev/339474151): Switch from a protocol to an eventpair.\n"]
3505#[derive(PartialEq, Debug)]
3506pub struct LeaseControl;
3507
3508#[cfg(target_os = "fuchsia")]
3509impl ::fidl_next::HasTransport for LeaseControl {
3510 type Transport = ::fidl_next::fuchsia::zx::Channel;
3511}
3512
3513pub mod lease_control {
3514 pub mod prelude {
3515 pub use crate::{
3516 LeaseControl, LeaseControlClientHandler, LeaseControlLocalClientHandler,
3517 LeaseControlLocalServerHandler, LeaseControlServerHandler, lease_control,
3518 };
3519
3520 pub use crate::natural::LeaseControlWatchStatusRequest;
3521
3522 pub use crate::natural::LeaseControlWatchStatusResponse;
3523 }
3524
3525 pub struct WatchStatus;
3526
3527 impl ::fidl_next::Method for WatchStatus {
3528 const ORDINAL: u64 = 2970891070576830593;
3529 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3530 ::fidl_next::protocol::Flexibility::Flexible;
3531
3532 type Protocol = crate::LeaseControl;
3533
3534 type Request = crate::wire::LeaseControlWatchStatusRequest;
3535 }
3536
3537 impl ::fidl_next::TwoWayMethod for WatchStatus {
3538 type Response =
3539 ::fidl_next::wire::Flexible<'static, crate::wire::LeaseControlWatchStatusResponse>;
3540 }
3541
3542 impl<___R> ::fidl_next::Respond<___R> for WatchStatus {
3543 type Output = ::fidl_next::Flexible<crate::generic::LeaseControlWatchStatusResponse<___R>>;
3544
3545 fn respond(response: ___R) -> Self::Output {
3546 ::fidl_next::Flexible::Ok(crate::generic::LeaseControlWatchStatusResponse {
3547 status: response,
3548 })
3549 }
3550 }
3551
3552 mod ___detail {
3553 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::LeaseControl
3554 where
3555 ___T: ::fidl_next::Transport,
3556 {
3557 type Client = LeaseControlClient<___T>;
3558 type Server = LeaseControlServer<___T>;
3559 }
3560
3561 #[repr(transparent)]
3563 pub struct LeaseControlClient<___T: ::fidl_next::Transport> {
3564 #[allow(dead_code)]
3565 client: ::fidl_next::protocol::Client<___T>,
3566 }
3567
3568 impl<___T> LeaseControlClient<___T>
3569 where
3570 ___T: ::fidl_next::Transport,
3571 {
3572 #[doc = " Get the current status of the lease.\n If last_status is UNKNOWN, the call will return immediately\n with the current status. Otherwise, the call will block\n until the current status differs from last_status.\n"]
3573 pub fn watch_status(
3574 &self,
3575
3576 last_status: impl ::fidl_next::Encode<
3577 crate::wire::LeaseStatus,
3578 <___T as ::fidl_next::Transport>::SendBuffer,
3579 >,
3580 ) -> ::fidl_next::TwoWayFuture<'_, super::WatchStatus, ___T>
3581 where
3582 <___T as ::fidl_next::Transport>::SendBuffer:
3583 ::fidl_next::encoder::InternalHandleEncoder,
3584 {
3585 self.watch_status_with(crate::generic::LeaseControlWatchStatusRequest {
3586 last_status,
3587 })
3588 }
3589
3590 #[doc = " Get the current status of the lease.\n If last_status is UNKNOWN, the call will return immediately\n with the current status. Otherwise, the call will block\n until the current status differs from last_status.\n"]
3591 pub fn watch_status_with<___R>(
3592 &self,
3593 request: ___R,
3594 ) -> ::fidl_next::TwoWayFuture<'_, super::WatchStatus, ___T>
3595 where
3596 ___R: ::fidl_next::Encode<
3597 crate::wire::LeaseControlWatchStatusRequest,
3598 <___T as ::fidl_next::Transport>::SendBuffer,
3599 >,
3600 {
3601 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3602 2970891070576830593,
3603 <super::WatchStatus as ::fidl_next::Method>::FLEXIBILITY,
3604 request,
3605 ))
3606 }
3607 }
3608
3609 #[repr(transparent)]
3611 pub struct LeaseControlServer<___T: ::fidl_next::Transport> {
3612 server: ::fidl_next::protocol::Server<___T>,
3613 }
3614
3615 impl<___T> LeaseControlServer<___T> where ___T: ::fidl_next::Transport {}
3616 }
3617}
3618
3619#[diagnostic::on_unimplemented(
3620 note = "If {Self} implements the non-local LeaseControlClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3621)]
3622
3623pub trait LeaseControlLocalClientHandler<
3627 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3628 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3629>
3630{
3631 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3632 ::core::future::ready(())
3633 }
3634}
3635
3636impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for LeaseControl
3637where
3638 ___H: LeaseControlLocalClientHandler<___T>,
3639 ___T: ::fidl_next::Transport,
3640{
3641 async fn on_event(
3642 handler: &mut ___H,
3643 ordinal: u64,
3644 flexibility: ::fidl_next::protocol::Flexibility,
3645 body: ::fidl_next::Body<___T>,
3646 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3647 match ordinal {
3648 ordinal => {
3649 handler.on_unknown_interaction(ordinal).await;
3650 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3651 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3652 } else {
3653 Ok(())
3654 }
3655 }
3656 }
3657 }
3658}
3659
3660#[diagnostic::on_unimplemented(
3661 note = "If {Self} implements the non-local LeaseControlServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3662)]
3663
3664pub trait LeaseControlLocalServerHandler<
3668 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3669 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3670>
3671{
3672 #[doc = " Get the current status of the lease.\n If last_status is UNKNOWN, the call will return immediately\n with the current status. Otherwise, the call will block\n until the current status differs from last_status.\n"]
3673 fn watch_status(
3674 &mut self,
3675
3676 request: ::fidl_next::Request<lease_control::WatchStatus, ___T>,
3677
3678 responder: ::fidl_next::Responder<lease_control::WatchStatus, ___T>,
3679 ) -> impl ::core::future::Future<Output = ()>;
3680
3681 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3682 ::core::future::ready(())
3683 }
3684}
3685
3686impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for LeaseControl
3687where
3688 ___H: LeaseControlLocalServerHandler<___T>,
3689 ___T: ::fidl_next::Transport,
3690 for<'de> crate::wire::LeaseControlWatchStatusRequest: ::fidl_next::Decode<
3691 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3692 Constraint = (),
3693 >,
3694{
3695 async fn on_one_way(
3696 handler: &mut ___H,
3697 ordinal: u64,
3698 flexibility: ::fidl_next::protocol::Flexibility,
3699 body: ::fidl_next::Body<___T>,
3700 ) -> ::core::result::Result<
3701 (),
3702 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3703 > {
3704 match ordinal {
3705 ordinal => {
3706 handler.on_unknown_interaction(ordinal).await;
3707 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3708 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3709 } else {
3710 Ok(())
3711 }
3712 }
3713 }
3714 }
3715
3716 async fn on_two_way(
3717 handler: &mut ___H,
3718 ordinal: u64,
3719 flexibility: ::fidl_next::protocol::Flexibility,
3720 body: ::fidl_next::Body<___T>,
3721 responder: ::fidl_next::protocol::Responder<___T>,
3722 ) -> ::core::result::Result<
3723 (),
3724 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3725 > {
3726 match ordinal {
3727 2970891070576830593 => {
3728 let responder = ::fidl_next::Responder::from_untyped(responder);
3729
3730 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3731 Ok(decoded) => {
3732 handler
3733 .watch_status(::fidl_next::Request::from_decoded(decoded), responder)
3734 .await;
3735 Ok(())
3736 }
3737 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3738 ordinal: 2970891070576830593,
3739 error,
3740 }),
3741 }
3742 }
3743
3744 ordinal => {
3745 handler.on_unknown_interaction(ordinal).await;
3746 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3747 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3748 } else {
3749 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
3750 ordinal,
3751 flexibility,
3752 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
3753 )
3754 .expect("encoding a framework error should never fail")
3755 .await?;
3756 Ok(())
3757 }
3758 }
3759 }
3760 }
3761}
3762
3763pub trait LeaseControlClientHandler<
3767 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3768 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3769>
3770{
3771 fn on_unknown_interaction(
3772 &mut self,
3773 ordinal: u64,
3774 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3775 ::core::future::ready(())
3776 }
3777}
3778
3779impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for LeaseControl
3780where
3781 ___H: LeaseControlClientHandler<___T> + ::core::marker::Send,
3782 ___T: ::fidl_next::Transport,
3783{
3784 async fn on_event(
3785 handler: &mut ___H,
3786 ordinal: u64,
3787 flexibility: ::fidl_next::protocol::Flexibility,
3788 body: ::fidl_next::Body<___T>,
3789 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3790 match ordinal {
3791 ordinal => {
3792 handler.on_unknown_interaction(ordinal).await;
3793 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3794 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3795 } else {
3796 Ok(())
3797 }
3798 }
3799 }
3800 }
3801}
3802
3803pub trait LeaseControlServerHandler<
3807 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3808 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3809>
3810{
3811 #[doc = " Get the current status of the lease.\n If last_status is UNKNOWN, the call will return immediately\n with the current status. Otherwise, the call will block\n until the current status differs from last_status.\n"]
3812 fn watch_status(
3813 &mut self,
3814
3815 request: ::fidl_next::Request<lease_control::WatchStatus, ___T>,
3816
3817 responder: ::fidl_next::Responder<lease_control::WatchStatus, ___T>,
3818 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3819
3820 fn on_unknown_interaction(
3821 &mut self,
3822 ordinal: u64,
3823 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3824 ::core::future::ready(())
3825 }
3826}
3827
3828impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for LeaseControl
3829where
3830 ___H: LeaseControlServerHandler<___T> + ::core::marker::Send,
3831 ___T: ::fidl_next::Transport,
3832 for<'de> crate::wire::LeaseControlWatchStatusRequest: ::fidl_next::Decode<
3833 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3834 Constraint = (),
3835 >,
3836{
3837 async fn on_one_way(
3838 handler: &mut ___H,
3839 ordinal: u64,
3840 flexibility: ::fidl_next::protocol::Flexibility,
3841 body: ::fidl_next::Body<___T>,
3842 ) -> ::core::result::Result<
3843 (),
3844 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3845 > {
3846 match ordinal {
3847 ordinal => {
3848 handler.on_unknown_interaction(ordinal).await;
3849 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3850 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3851 } else {
3852 Ok(())
3853 }
3854 }
3855 }
3856 }
3857
3858 async fn on_two_way(
3859 handler: &mut ___H,
3860 ordinal: u64,
3861 flexibility: ::fidl_next::protocol::Flexibility,
3862 body: ::fidl_next::Body<___T>,
3863 responder: ::fidl_next::protocol::Responder<___T>,
3864 ) -> ::core::result::Result<
3865 (),
3866 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3867 > {
3868 match ordinal {
3869 2970891070576830593 => {
3870 let responder = ::fidl_next::Responder::from_untyped(responder);
3871
3872 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3873 Ok(decoded) => {
3874 handler
3875 .watch_status(::fidl_next::Request::from_decoded(decoded), responder)
3876 .await;
3877 Ok(())
3878 }
3879 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3880 ordinal: 2970891070576830593,
3881 error,
3882 }),
3883 }
3884 }
3885
3886 ordinal => {
3887 handler.on_unknown_interaction(ordinal).await;
3888 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3889 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3890 } else {
3891 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
3892 ordinal,
3893 flexibility,
3894 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
3895 )
3896 .expect("encoding a framework error should never fail")
3897 .await?;
3898 Ok(())
3899 }
3900 }
3901 }
3902 }
3903}
3904
3905impl<___T> LeaseControlClientHandler<___T> for ::fidl_next::IgnoreEvents
3906where
3907 ___T: ::fidl_next::Transport,
3908{
3909 async fn on_unknown_interaction(&mut self, _: u64) {}
3910}
3911
3912impl<___H, ___T> LeaseControlLocalClientHandler<___T> for ::fidl_next::Local<___H>
3913where
3914 ___H: LeaseControlClientHandler<___T>,
3915 ___T: ::fidl_next::Transport,
3916{
3917 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3918 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3919 }
3920}
3921
3922impl<___H, ___T> LeaseControlLocalServerHandler<___T> for ::fidl_next::Local<___H>
3923where
3924 ___H: LeaseControlServerHandler<___T>,
3925 ___T: ::fidl_next::Transport,
3926{
3927 async fn watch_status(
3928 &mut self,
3929
3930 request: ::fidl_next::Request<lease_control::WatchStatus, ___T>,
3931
3932 responder: ::fidl_next::Responder<lease_control::WatchStatus, ___T>,
3933 ) {
3934 ___H::watch_status(&mut self.0, request, responder).await
3935 }
3936
3937 async fn on_unknown_interaction(&mut self, ordinal: u64) {
3938 ___H::on_unknown_interaction(&mut self.0, ordinal).await
3939 }
3940}
3941
3942pub const MAX_TOKENS_IN_ADD_ELEMENT: u16 = 128 as u16;