1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 pub use fidl_next_common_fuchsia_power_broker::natural::*;
8
9 #[doc = " A token that represents the right to add a dependency upon another\n element. Should first be registered with Power Broker via\n ElementControl.RegisterDependencyToken of the required element.\n"]
10 pub type DependencyToken = ::fidl_next::fuchsia::zx::Event;
11
12 #[derive(Debug, PartialEq)]
13 #[repr(C)]
14 pub struct ElementControlOpenStatusChannelRequest {
15 pub status_channel:
16 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::fuchsia::zx::Channel>,
17 }
18
19 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ElementControlOpenStatusChannelRequest, ___E>
20 for ElementControlOpenStatusChannelRequest
21 where
22 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
23 ___E: ::fidl_next::fuchsia::HandleEncoder,
24 {
25 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
26 Self,
27 crate::wire::ElementControlOpenStatusChannelRequest,
28 > = unsafe {
29 ::fidl_next::CopyOptimization::enable_if(
30 true
31
32 && <
33 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::Encode<::fidl_next::ServerEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>, ___E>
34 >::COPY_OPTIMIZATION.is_enabled()
35
36 )
37 };
38
39 #[inline]
40 fn encode(
41 self,
42 encoder_: &mut ___E,
43 out_: &mut ::core::mem::MaybeUninit<
44 crate::wire::ElementControlOpenStatusChannelRequest,
45 >,
46 _: (),
47 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
48 ::fidl_next::munge! {
49 let crate::wire::ElementControlOpenStatusChannelRequest {
50 status_channel,
51
52 } = out_;
53 }
54
55 ::fidl_next::Encode::encode(self.status_channel, encoder_, status_channel, ())?;
56
57 let mut _field =
58 unsafe { ::fidl_next::Slot::new_unchecked(status_channel.as_mut_ptr()) };
59
60 Ok(())
61 }
62 }
63
64 unsafe impl<___E>
65 ::fidl_next::EncodeOption<
66 ::fidl_next::wire::Box<'static, crate::wire::ElementControlOpenStatusChannelRequest>,
67 ___E,
68 > for ElementControlOpenStatusChannelRequest
69 where
70 ___E: ::fidl_next::Encoder + ?Sized,
71 ElementControlOpenStatusChannelRequest:
72 ::fidl_next::Encode<crate::wire::ElementControlOpenStatusChannelRequest, ___E>,
73 {
74 #[inline]
75 fn encode_option(
76 this: ::core::option::Option<Self>,
77 encoder: &mut ___E,
78 out: &mut ::core::mem::MaybeUninit<
79 ::fidl_next::wire::Box<
80 'static,
81 crate::wire::ElementControlOpenStatusChannelRequest,
82 >,
83 >,
84 _: (),
85 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
86 if let Some(inner) = this {
87 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
88 ::fidl_next::wire::Box::encode_present(out);
89 } else {
90 ::fidl_next::wire::Box::encode_absent(out);
91 }
92
93 Ok(())
94 }
95 }
96
97 impl ::fidl_next::FromWire<crate::wire::ElementControlOpenStatusChannelRequest>
98 for ElementControlOpenStatusChannelRequest
99 {
100 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
101 crate::wire::ElementControlOpenStatusChannelRequest,
102 Self,
103 > = unsafe {
104 ::fidl_next::CopyOptimization::enable_if(
105 true
106
107 && <
108 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>>
109 >::COPY_OPTIMIZATION.is_enabled()
110
111 )
112 };
113
114 #[inline]
115 fn from_wire(wire: crate::wire::ElementControlOpenStatusChannelRequest) -> Self {
116 Self { status_channel: ::fidl_next::FromWire::from_wire(wire.status_channel) }
117 }
118 }
119
120 #[derive(Debug, PartialEq)]
121 #[repr(C)]
122 pub struct ElementControlRegisterDependencyTokenRequest {
123 pub token: ::fidl_next::fuchsia::zx::Event,
124 }
125
126 unsafe impl<___E>
127 ::fidl_next::Encode<crate::wire::ElementControlRegisterDependencyTokenRequest, ___E>
128 for ElementControlRegisterDependencyTokenRequest
129 where
130 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
131 ___E: ::fidl_next::fuchsia::HandleEncoder,
132 {
133 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
134 Self,
135 crate::wire::ElementControlRegisterDependencyTokenRequest,
136 > = unsafe {
137 ::fidl_next::CopyOptimization::enable_if(
138 true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::Encode<
139 ::fidl_next::wire::fuchsia::Event,
140 ___E,
141 >>::COPY_OPTIMIZATION
142 .is_enabled(),
143 )
144 };
145
146 #[inline]
147 fn encode(
148 self,
149 encoder_: &mut ___E,
150 out_: &mut ::core::mem::MaybeUninit<
151 crate::wire::ElementControlRegisterDependencyTokenRequest,
152 >,
153 _: (),
154 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
155 ::fidl_next::munge! {
156 let crate::wire::ElementControlRegisterDependencyTokenRequest {
157 token,
158
159 } = out_;
160 }
161
162 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
163
164 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
165
166 Ok(())
167 }
168 }
169
170 unsafe impl<___E>
171 ::fidl_next::EncodeOption<
172 ::fidl_next::wire::Box<
173 'static,
174 crate::wire::ElementControlRegisterDependencyTokenRequest,
175 >,
176 ___E,
177 > for ElementControlRegisterDependencyTokenRequest
178 where
179 ___E: ::fidl_next::Encoder + ?Sized,
180 ElementControlRegisterDependencyTokenRequest:
181 ::fidl_next::Encode<crate::wire::ElementControlRegisterDependencyTokenRequest, ___E>,
182 {
183 #[inline]
184 fn encode_option(
185 this: ::core::option::Option<Self>,
186 encoder: &mut ___E,
187 out: &mut ::core::mem::MaybeUninit<
188 ::fidl_next::wire::Box<
189 'static,
190 crate::wire::ElementControlRegisterDependencyTokenRequest,
191 >,
192 >,
193 _: (),
194 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
195 if let Some(inner) = this {
196 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
197 ::fidl_next::wire::Box::encode_present(out);
198 } else {
199 ::fidl_next::wire::Box::encode_absent(out);
200 }
201
202 Ok(())
203 }
204 }
205
206 impl ::fidl_next::FromWire<crate::wire::ElementControlRegisterDependencyTokenRequest>
207 for ElementControlRegisterDependencyTokenRequest
208 {
209 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
210 crate::wire::ElementControlRegisterDependencyTokenRequest,
211 Self,
212 > = unsafe {
213 ::fidl_next::CopyOptimization::enable_if(
214 true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::FromWire<
215 ::fidl_next::wire::fuchsia::Event,
216 >>::COPY_OPTIMIZATION
217 .is_enabled(),
218 )
219 };
220
221 #[inline]
222 fn from_wire(wire: crate::wire::ElementControlRegisterDependencyTokenRequest) -> Self {
223 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
224 }
225 }
226
227 #[derive(Debug, PartialEq)]
228 #[repr(C)]
229 pub struct ElementControlUnregisterDependencyTokenRequest {
230 pub token: ::fidl_next::fuchsia::zx::Event,
231 }
232
233 unsafe impl<___E>
234 ::fidl_next::Encode<crate::wire::ElementControlUnregisterDependencyTokenRequest, ___E>
235 for ElementControlUnregisterDependencyTokenRequest
236 where
237 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
238 ___E: ::fidl_next::fuchsia::HandleEncoder,
239 {
240 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
241 Self,
242 crate::wire::ElementControlUnregisterDependencyTokenRequest,
243 > = unsafe {
244 ::fidl_next::CopyOptimization::enable_if(
245 true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::Encode<
246 ::fidl_next::wire::fuchsia::Event,
247 ___E,
248 >>::COPY_OPTIMIZATION
249 .is_enabled(),
250 )
251 };
252
253 #[inline]
254 fn encode(
255 self,
256 encoder_: &mut ___E,
257 out_: &mut ::core::mem::MaybeUninit<
258 crate::wire::ElementControlUnregisterDependencyTokenRequest,
259 >,
260 _: (),
261 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
262 ::fidl_next::munge! {
263 let crate::wire::ElementControlUnregisterDependencyTokenRequest {
264 token,
265
266 } = out_;
267 }
268
269 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
270
271 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(token.as_mut_ptr()) };
272
273 Ok(())
274 }
275 }
276
277 unsafe impl<___E>
278 ::fidl_next::EncodeOption<
279 ::fidl_next::wire::Box<
280 'static,
281 crate::wire::ElementControlUnregisterDependencyTokenRequest,
282 >,
283 ___E,
284 > for ElementControlUnregisterDependencyTokenRequest
285 where
286 ___E: ::fidl_next::Encoder + ?Sized,
287 ElementControlUnregisterDependencyTokenRequest:
288 ::fidl_next::Encode<crate::wire::ElementControlUnregisterDependencyTokenRequest, ___E>,
289 {
290 #[inline]
291 fn encode_option(
292 this: ::core::option::Option<Self>,
293 encoder: &mut ___E,
294 out: &mut ::core::mem::MaybeUninit<
295 ::fidl_next::wire::Box<
296 'static,
297 crate::wire::ElementControlUnregisterDependencyTokenRequest,
298 >,
299 >,
300 _: (),
301 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
302 if let Some(inner) = this {
303 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
304 ::fidl_next::wire::Box::encode_present(out);
305 } else {
306 ::fidl_next::wire::Box::encode_absent(out);
307 }
308
309 Ok(())
310 }
311 }
312
313 impl ::fidl_next::FromWire<crate::wire::ElementControlUnregisterDependencyTokenRequest>
314 for ElementControlUnregisterDependencyTokenRequest
315 {
316 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
317 crate::wire::ElementControlUnregisterDependencyTokenRequest,
318 Self,
319 > = unsafe {
320 ::fidl_next::CopyOptimization::enable_if(
321 true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::FromWire<
322 ::fidl_next::wire::fuchsia::Event,
323 >>::COPY_OPTIMIZATION
324 .is_enabled(),
325 )
326 };
327
328 #[inline]
329 fn from_wire(wire: crate::wire::ElementControlUnregisterDependencyTokenRequest) -> Self {
330 Self { token: ::fidl_next::FromWire::from_wire(wire.token) }
331 }
332 }
333
334 #[doc = " Describes a dependency from one power element\'s level on another power\n element\'s level.\n For example if element `PowerElement_A` has a level `PowerLevel_A3` which\n depends on an element `PowerElement_B` being at `PowerLevel_B2` then we would\n fill out the struct to convey the meaning:\n - `dependent_level` = `PowerLevel_A3`\n - `requires_token` = `PowerElement_B`\n - `requires_level_by_preference` = `[PowerLevel_B2]`\n (Note the values above are only *symbolic*, eg. `dependent_level` requires\n an integer value, not a string.)\n\n The dependent Element\'s identity is not specified in this struct and must\n be specified as a separate argument in a request or be inferred, perhaps\n because a channel is scoped to the dependent element.\n"]
335 #[derive(Debug, Default, PartialEq)]
336 pub struct LevelDependency {
337 pub dependent_level: ::core::option::Option<u8>,
338
339 pub requires_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
340
341 pub requires_level_by_preference: ::core::option::Option<::std::vec::Vec<u8>>,
342
343 pub remove_with_required_element: ::core::option::Option<bool>,
344 }
345
346 impl LevelDependency {
347 fn __max_ordinal(&self) -> usize {
348 if self.remove_with_required_element.is_some() {
349 return 4;
350 }
351
352 if self.requires_level_by_preference.is_some() {
353 return 3;
354 }
355
356 if self.requires_token.is_some() {
357 return 2;
358 }
359
360 if self.dependent_level.is_some() {
361 return 1;
362 }
363
364 0
365 }
366 }
367
368 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LevelDependency<'static>, ___E>
369 for LevelDependency
370 where
371 ___E: ::fidl_next::Encoder + ?Sized,
372 ___E: ::fidl_next::fuchsia::HandleEncoder,
373 {
374 #[inline]
375 fn encode(
376 mut self,
377 encoder: &mut ___E,
378 out: &mut ::core::mem::MaybeUninit<crate::wire::LevelDependency<'static>>,
379 _: (),
380 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
381 ::fidl_next::munge!(let crate::wire::LevelDependency { table } = out);
382
383 let max_ord = self.__max_ordinal();
384
385 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
386 ::fidl_next::Wire::zero_padding(&mut out);
387
388 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
389 ::fidl_next::wire::Envelope,
390 >(encoder, max_ord);
391
392 for i in 1..=max_ord {
393 match i {
394 4 => {
395 if let Some(value) = self.remove_with_required_element.take() {
396 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
397 value,
398 preallocated.encoder,
399 &mut out,
400 (),
401 )?;
402 } else {
403 ::fidl_next::wire::Envelope::encode_zero(&mut out)
404 }
405 }
406
407 3 => {
408 if let Some(value) = self.requires_level_by_preference.take() {
409 ::fidl_next::wire::Envelope::encode_value::<
410 ::fidl_next::wire::Vector<'static, u8>,
411 ___E,
412 >(
413 value, preallocated.encoder, &mut out, (256, ())
414 )?;
415 } else {
416 ::fidl_next::wire::Envelope::encode_zero(&mut out)
417 }
418 }
419
420 2 => {
421 if let Some(value) = self.requires_token.take() {
422 ::fidl_next::wire::Envelope::encode_value::<
423 ::fidl_next::wire::fuchsia::Event,
424 ___E,
425 >(
426 value, preallocated.encoder, &mut out, ()
427 )?;
428 } else {
429 ::fidl_next::wire::Envelope::encode_zero(&mut out)
430 }
431 }
432
433 1 => {
434 if let Some(value) = self.dependent_level.take() {
435 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
436 value,
437 preallocated.encoder,
438 &mut out,
439 (),
440 )?;
441 } else {
442 ::fidl_next::wire::Envelope::encode_zero(&mut out)
443 }
444 }
445
446 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
447 }
448 unsafe {
449 preallocated.write_next(out.assume_init_ref());
450 }
451 }
452
453 ::fidl_next::wire::Table::encode_len(table, max_ord);
454
455 Ok(())
456 }
457 }
458
459 impl<'de> ::fidl_next::FromWire<crate::wire::LevelDependency<'de>> for LevelDependency {
460 #[inline]
461 fn from_wire(wire_: crate::wire::LevelDependency<'de>) -> Self {
462 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
463
464 let dependent_level = wire_.table.get(1);
465
466 let requires_token = wire_.table.get(2);
467
468 let requires_level_by_preference = wire_.table.get(3);
469
470 let remove_with_required_element = wire_.table.get(4);
471
472 Self {
473 dependent_level: dependent_level.map(|envelope| {
474 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
475 }),
476
477 requires_token: requires_token.map(|envelope| {
478 ::fidl_next::FromWire::from_wire(unsafe {
479 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
480 })
481 }),
482
483 requires_level_by_preference: requires_level_by_preference.map(|envelope| {
484 ::fidl_next::FromWire::from_wire(unsafe {
485 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
486 })
487 }),
488
489 remove_with_required_element: remove_with_required_element.map(|envelope| {
490 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
491 }),
492 }
493 }
494 }
495
496 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
497 pub struct ElementInfoProviderGetElementPowerLevelNamesResponse {
498 pub level_names: ::std::vec::Vec<crate::natural::ElementPowerLevelNames>,
499 }
500
501 unsafe impl<___E>
502 ::fidl_next::Encode<
503 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
504 ___E,
505 > for ElementInfoProviderGetElementPowerLevelNamesResponse
506 where
507 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
508 ___E: ::fidl_next::Encoder,
509 ___E: ::fidl_next::fuchsia::HandleEncoder,
510 {
511 #[inline]
512 fn encode(
513 self,
514 encoder_: &mut ___E,
515 out_: &mut ::core::mem::MaybeUninit<
516 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
517 >,
518 _: (),
519 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
520 ::fidl_next::munge! {
521 let crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse {
522 level_names,
523
524 } = out_;
525 }
526
527 ::fidl_next::Encode::encode(self.level_names, encoder_, level_names, (4294967295, ()))?;
528
529 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(level_names.as_mut_ptr()) };
530 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
531
532 Ok(())
533 }
534 }
535
536 unsafe impl<___E>
537 ::fidl_next::EncodeOption<
538 ::fidl_next::wire::Box<
539 'static,
540 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
541 >,
542 ___E,
543 > for ElementInfoProviderGetElementPowerLevelNamesResponse
544 where
545 ___E: ::fidl_next::Encoder + ?Sized,
546 ElementInfoProviderGetElementPowerLevelNamesResponse: ::fidl_next::Encode<
547 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
548 ___E,
549 >,
550 {
551 #[inline]
552 fn encode_option(
553 this: ::core::option::Option<Self>,
554 encoder: &mut ___E,
555 out: &mut ::core::mem::MaybeUninit<
556 ::fidl_next::wire::Box<
557 'static,
558 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
559 >,
560 >,
561 _: (),
562 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
563 if let Some(inner) = this {
564 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
565 ::fidl_next::wire::Box::encode_present(out);
566 } else {
567 ::fidl_next::wire::Box::encode_absent(out);
568 }
569
570 Ok(())
571 }
572 }
573
574 impl<'de>
575 ::fidl_next::FromWire<
576 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'de>,
577 > for ElementInfoProviderGetElementPowerLevelNamesResponse
578 {
579 #[inline]
580 fn from_wire(
581 wire: crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'de>,
582 ) -> Self {
583 Self { level_names: ::fidl_next::FromWire::from_wire(wire.level_names) }
584 }
585 }
586
587 #[doc = " Status client endpoint and a plaintext name for a specific Power Element. Names are\n expected to be unique between elements and persistent across reboots of the same build,\n but consistency is not guaranteed between different builds.\n"]
588 #[derive(Debug, Default, PartialEq)]
589 pub struct ElementStatusEndpoint {
590 pub identifier: ::core::option::Option<::std::string::String>,
591
592 pub status: ::core::option::Option<
593 ::fidl_next::ClientEnd<crate::Status, ::fidl_next::fuchsia::zx::Channel>,
594 >,
595 }
596
597 impl ElementStatusEndpoint {
598 fn __max_ordinal(&self) -> usize {
599 if self.status.is_some() {
600 return 2;
601 }
602
603 if self.identifier.is_some() {
604 return 1;
605 }
606
607 0
608 }
609 }
610
611 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ElementStatusEndpoint<'static>, ___E>
612 for ElementStatusEndpoint
613 where
614 ___E: ::fidl_next::Encoder + ?Sized,
615 ___E: ::fidl_next::fuchsia::HandleEncoder,
616 {
617 #[inline]
618 fn encode(
619 mut self,
620 encoder: &mut ___E,
621 out: &mut ::core::mem::MaybeUninit<crate::wire::ElementStatusEndpoint<'static>>,
622 _: (),
623 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
624 ::fidl_next::munge!(let crate::wire::ElementStatusEndpoint { table } = out);
625
626 let max_ord = self.__max_ordinal();
627
628 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
629 ::fidl_next::Wire::zero_padding(&mut out);
630
631 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
632 ::fidl_next::wire::Envelope,
633 >(encoder, max_ord);
634
635 for i in 1..=max_ord {
636 match i {
637 2 => {
638 if let Some(value) = self.status.take() {
639 ::fidl_next::wire::Envelope::encode_value::<
640 ::fidl_next::ClientEnd<
641 crate::Status,
642 ::fidl_next::wire::fuchsia::Channel,
643 >,
644 ___E,
645 >(
646 value, preallocated.encoder, &mut out, ()
647 )?;
648 } else {
649 ::fidl_next::wire::Envelope::encode_zero(&mut out)
650 }
651 }
652
653 1 => {
654 if let Some(value) = self.identifier.take() {
655 ::fidl_next::wire::Envelope::encode_value::<
656 ::fidl_next::wire::String<'static>,
657 ___E,
658 >(
659 value, preallocated.encoder, &mut out, 64
660 )?;
661 } else {
662 ::fidl_next::wire::Envelope::encode_zero(&mut out)
663 }
664 }
665
666 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
667 }
668 unsafe {
669 preallocated.write_next(out.assume_init_ref());
670 }
671 }
672
673 ::fidl_next::wire::Table::encode_len(table, max_ord);
674
675 Ok(())
676 }
677 }
678
679 impl<'de> ::fidl_next::FromWire<crate::wire::ElementStatusEndpoint<'de>> for ElementStatusEndpoint {
680 #[inline]
681 fn from_wire(wire_: crate::wire::ElementStatusEndpoint<'de>) -> Self {
682 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
683
684 let identifier = wire_.table.get(1);
685
686 let status = wire_.table.get(2);
687
688 Self {
689 identifier: identifier.map(|envelope| {
690 ::fidl_next::FromWire::from_wire(unsafe {
691 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
692 })
693 }),
694
695 status: status.map(|envelope| {
696 ::fidl_next::FromWire::from_wire(unsafe {
697 envelope.read_unchecked::<::fidl_next::ClientEnd<
698 crate::Status,
699 ::fidl_next::wire::fuchsia::Channel,
700 >>()
701 })
702 }),
703 }
704 }
705 }
706
707 #[derive(Debug, PartialEq)]
708 pub struct ElementInfoProviderGetStatusEndpointsResponse {
709 pub endpoints: ::std::vec::Vec<crate::natural::ElementStatusEndpoint>,
710 }
711
712 unsafe impl<___E>
713 ::fidl_next::Encode<
714 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
715 ___E,
716 > for ElementInfoProviderGetStatusEndpointsResponse
717 where
718 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
719 ___E: ::fidl_next::Encoder,
720 ___E: ::fidl_next::fuchsia::HandleEncoder,
721 {
722 #[inline]
723 fn encode(
724 self,
725 encoder_: &mut ___E,
726 out_: &mut ::core::mem::MaybeUninit<
727 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
728 >,
729 _: (),
730 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
731 ::fidl_next::munge! {
732 let crate::wire::ElementInfoProviderGetStatusEndpointsResponse {
733 endpoints,
734
735 } = out_;
736 }
737
738 ::fidl_next::Encode::encode(self.endpoints, encoder_, endpoints, (4294967295, ()))?;
739
740 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(endpoints.as_mut_ptr()) };
741 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
742
743 Ok(())
744 }
745 }
746
747 unsafe impl<___E>
748 ::fidl_next::EncodeOption<
749 ::fidl_next::wire::Box<
750 'static,
751 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
752 >,
753 ___E,
754 > for ElementInfoProviderGetStatusEndpointsResponse
755 where
756 ___E: ::fidl_next::Encoder + ?Sized,
757 ElementInfoProviderGetStatusEndpointsResponse: ::fidl_next::Encode<
758 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
759 ___E,
760 >,
761 {
762 #[inline]
763 fn encode_option(
764 this: ::core::option::Option<Self>,
765 encoder: &mut ___E,
766 out: &mut ::core::mem::MaybeUninit<
767 ::fidl_next::wire::Box<
768 'static,
769 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
770 >,
771 >,
772 _: (),
773 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
774 if let Some(inner) = this {
775 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
776 ::fidl_next::wire::Box::encode_present(out);
777 } else {
778 ::fidl_next::wire::Box::encode_absent(out);
779 }
780
781 Ok(())
782 }
783 }
784
785 impl<'de> ::fidl_next::FromWire<crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'de>>
786 for ElementInfoProviderGetStatusEndpointsResponse
787 {
788 #[inline]
789 fn from_wire(
790 wire: crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'de>,
791 ) -> Self {
792 Self { endpoints: ::fidl_next::FromWire::from_wire(wire.endpoints) }
793 }
794 }
795
796 pub type LeaseToken = ::fidl_next::fuchsia::zx::EventPair;
797
798 #[doc = " Passed to Topology.AddElement.\n"]
799 #[derive(Debug, Default, PartialEq)]
800 pub struct ElementSchema {
801 pub element_name: ::core::option::Option<::std::string::String>,
802
803 pub initial_current_level: ::core::option::Option<u8>,
804
805 pub valid_levels: ::core::option::Option<::std::vec::Vec<u8>>,
806
807 pub dependencies: ::core::option::Option<::std::vec::Vec<crate::natural::LevelDependency>>,
808
809 pub lessor_channel: ::core::option::Option<
810 ::fidl_next::ServerEnd<crate::Lessor, ::fidl_next::fuchsia::zx::Channel>,
811 >,
812
813 pub element_control: ::core::option::Option<
814 ::fidl_next::ServerEnd<crate::ElementControl, ::fidl_next::fuchsia::zx::Channel>,
815 >,
816
817 pub element_runner: ::core::option::Option<
818 ::fidl_next::ClientEnd<crate::ElementRunner, ::fidl_next::fuchsia::zx::Channel>,
819 >,
820
821 pub initial_lease_token: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
822 }
823
824 impl ElementSchema {
825 fn __max_ordinal(&self) -> usize {
826 if self.initial_lease_token.is_some() {
827 return 11;
828 }
829
830 if self.element_runner.is_some() {
831 return 10;
832 }
833
834 if self.element_control.is_some() {
835 return 9;
836 }
837
838 if self.lessor_channel.is_some() {
839 return 8;
840 }
841
842 if self.dependencies.is_some() {
843 return 4;
844 }
845
846 if self.valid_levels.is_some() {
847 return 3;
848 }
849
850 if self.initial_current_level.is_some() {
851 return 2;
852 }
853
854 if self.element_name.is_some() {
855 return 1;
856 }
857
858 0
859 }
860 }
861
862 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ElementSchema<'static>, ___E> for ElementSchema
863 where
864 ___E: ::fidl_next::Encoder + ?Sized,
865 ___E: ::fidl_next::fuchsia::HandleEncoder,
866 {
867 #[inline]
868 fn encode(
869 mut self,
870 encoder: &mut ___E,
871 out: &mut ::core::mem::MaybeUninit<crate::wire::ElementSchema<'static>>,
872 _: (),
873 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
874 ::fidl_next::munge!(let crate::wire::ElementSchema { table } = out);
875
876 let max_ord = self.__max_ordinal();
877
878 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
879 ::fidl_next::Wire::zero_padding(&mut out);
880
881 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
882 ::fidl_next::wire::Envelope,
883 >(encoder, max_ord);
884
885 for i in 1..=max_ord {
886 match i {
887 11 => {
888 if let Some(value) = self.initial_lease_token.take() {
889 ::fidl_next::wire::Envelope::encode_value::<
890 ::fidl_next::wire::fuchsia::EventPair,
891 ___E,
892 >(
893 value, preallocated.encoder, &mut out, ()
894 )?;
895 } else {
896 ::fidl_next::wire::Envelope::encode_zero(&mut out)
897 }
898 }
899
900 10 => {
901 if let Some(value) = self.element_runner.take() {
902 ::fidl_next::wire::Envelope::encode_value::<
903 ::fidl_next::ClientEnd<
904 crate::ElementRunner,
905 ::fidl_next::wire::fuchsia::Channel,
906 >,
907 ___E,
908 >(
909 value, preallocated.encoder, &mut out, ()
910 )?;
911 } else {
912 ::fidl_next::wire::Envelope::encode_zero(&mut out)
913 }
914 }
915
916 9 => {
917 if let Some(value) = self.element_control.take() {
918 ::fidl_next::wire::Envelope::encode_value::<
919 ::fidl_next::ServerEnd<
920 crate::ElementControl,
921 ::fidl_next::wire::fuchsia::Channel,
922 >,
923 ___E,
924 >(
925 value, preallocated.encoder, &mut out, ()
926 )?;
927 } else {
928 ::fidl_next::wire::Envelope::encode_zero(&mut out)
929 }
930 }
931
932 8 => {
933 if let Some(value) = self.lessor_channel.take() {
934 ::fidl_next::wire::Envelope::encode_value::<
935 ::fidl_next::ServerEnd<
936 crate::Lessor,
937 ::fidl_next::wire::fuchsia::Channel,
938 >,
939 ___E,
940 >(
941 value, preallocated.encoder, &mut out, ()
942 )?;
943 } else {
944 ::fidl_next::wire::Envelope::encode_zero(&mut out)
945 }
946 }
947
948 4 => {
949 if let Some(value) = self.dependencies.take() {
950 ::fidl_next::wire::Envelope::encode_value::<
951 ::fidl_next::wire::Vector<
952 'static,
953 crate::wire::LevelDependency<'static>,
954 >,
955 ___E,
956 >(
957 value, preallocated.encoder, &mut out, (128, ())
958 )?;
959 } else {
960 ::fidl_next::wire::Envelope::encode_zero(&mut out)
961 }
962 }
963
964 3 => {
965 if let Some(value) = self.valid_levels.take() {
966 ::fidl_next::wire::Envelope::encode_value::<
967 ::fidl_next::wire::Vector<'static, u8>,
968 ___E,
969 >(
970 value, preallocated.encoder, &mut out, (256, ())
971 )?;
972 } else {
973 ::fidl_next::wire::Envelope::encode_zero(&mut out)
974 }
975 }
976
977 2 => {
978 if let Some(value) = self.initial_current_level.take() {
979 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
980 value,
981 preallocated.encoder,
982 &mut out,
983 (),
984 )?;
985 } else {
986 ::fidl_next::wire::Envelope::encode_zero(&mut out)
987 }
988 }
989
990 1 => {
991 if let Some(value) = self.element_name.take() {
992 ::fidl_next::wire::Envelope::encode_value::<
993 ::fidl_next::wire::String<'static>,
994 ___E,
995 >(
996 value, preallocated.encoder, &mut out, 64
997 )?;
998 } else {
999 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1000 }
1001 }
1002
1003 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1004 }
1005 unsafe {
1006 preallocated.write_next(out.assume_init_ref());
1007 }
1008 }
1009
1010 ::fidl_next::wire::Table::encode_len(table, max_ord);
1011
1012 Ok(())
1013 }
1014 }
1015
1016 impl<'de> ::fidl_next::FromWire<crate::wire::ElementSchema<'de>> for ElementSchema {
1017 #[inline]
1018 fn from_wire(wire_: crate::wire::ElementSchema<'de>) -> Self {
1019 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1020
1021 let element_name = wire_.table.get(1);
1022
1023 let initial_current_level = wire_.table.get(2);
1024
1025 let valid_levels = wire_.table.get(3);
1026
1027 let dependencies = wire_.table.get(4);
1028
1029 let lessor_channel = wire_.table.get(8);
1030
1031 let element_control = wire_.table.get(9);
1032
1033 let element_runner = wire_.table.get(10);
1034
1035 let initial_lease_token = wire_.table.get(11);
1036
1037 Self {
1038
1039
1040 element_name: element_name.map(|envelope| ::fidl_next::FromWire::from_wire(
1041 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
1042 )),
1043
1044
1045 initial_current_level: initial_current_level.map(|envelope| ::fidl_next::FromWire::from_wire(
1046 unsafe { envelope.read_unchecked::<u8>() }
1047 )),
1048
1049
1050 valid_levels: valid_levels.map(|envelope| ::fidl_next::FromWire::from_wire(
1051 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, u8>>() }
1052 )),
1053
1054
1055 dependencies: dependencies.map(|envelope| ::fidl_next::FromWire::from_wire(
1056 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LevelDependency<'de>>>() }
1057 )),
1058
1059
1060 lessor_channel: lessor_channel.map(|envelope| ::fidl_next::FromWire::from_wire(
1061 unsafe { envelope.read_unchecked::<::fidl_next::ServerEnd<crate::Lessor, ::fidl_next::wire::fuchsia::Channel>>() }
1062 )),
1063
1064
1065 element_control: element_control.map(|envelope| ::fidl_next::FromWire::from_wire(
1066 unsafe { envelope.read_unchecked::<::fidl_next::ServerEnd<crate::ElementControl, ::fidl_next::wire::fuchsia::Channel>>() }
1067 )),
1068
1069
1070 element_runner: element_runner.map(|envelope| ::fidl_next::FromWire::from_wire(
1071 unsafe { envelope.read_unchecked::<::fidl_next::ClientEnd<crate::ElementRunner, ::fidl_next::wire::fuchsia::Channel>>() }
1072 )),
1073
1074
1075 initial_lease_token: initial_lease_token.map(|envelope| ::fidl_next::FromWire::from_wire(
1076 unsafe { envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>() }
1077 )),
1078
1079 }
1080 }
1081 }
1082
1083 #[derive(Debug, Default, PartialEq)]
1084 pub struct LeaseDependency {
1085 pub requires_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1086
1087 pub requires_level: ::core::option::Option<u8>,
1088
1089 pub requires_level_by_preference: ::core::option::Option<::std::vec::Vec<u8>>,
1090 }
1091
1092 impl LeaseDependency {
1093 fn __max_ordinal(&self) -> usize {
1094 if self.requires_level_by_preference.is_some() {
1095 return 3;
1096 }
1097
1098 if self.requires_level.is_some() {
1099 return 2;
1100 }
1101
1102 if self.requires_token.is_some() {
1103 return 1;
1104 }
1105
1106 0
1107 }
1108 }
1109
1110 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LeaseDependency<'static>, ___E>
1111 for LeaseDependency
1112 where
1113 ___E: ::fidl_next::Encoder + ?Sized,
1114 ___E: ::fidl_next::fuchsia::HandleEncoder,
1115 {
1116 #[inline]
1117 fn encode(
1118 mut self,
1119 encoder: &mut ___E,
1120 out: &mut ::core::mem::MaybeUninit<crate::wire::LeaseDependency<'static>>,
1121 _: (),
1122 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1123 ::fidl_next::munge!(let crate::wire::LeaseDependency { table } = out);
1124
1125 let max_ord = self.__max_ordinal();
1126
1127 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1128 ::fidl_next::Wire::zero_padding(&mut out);
1129
1130 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1131 ::fidl_next::wire::Envelope,
1132 >(encoder, max_ord);
1133
1134 for i in 1..=max_ord {
1135 match i {
1136 3 => {
1137 if let Some(value) = self.requires_level_by_preference.take() {
1138 ::fidl_next::wire::Envelope::encode_value::<
1139 ::fidl_next::wire::Vector<'static, u8>,
1140 ___E,
1141 >(
1142 value, preallocated.encoder, &mut out, (256, ())
1143 )?;
1144 } else {
1145 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1146 }
1147 }
1148
1149 2 => {
1150 if let Some(value) = self.requires_level.take() {
1151 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1152 value,
1153 preallocated.encoder,
1154 &mut out,
1155 (),
1156 )?;
1157 } else {
1158 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1159 }
1160 }
1161
1162 1 => {
1163 if let Some(value) = self.requires_token.take() {
1164 ::fidl_next::wire::Envelope::encode_value::<
1165 ::fidl_next::wire::fuchsia::Event,
1166 ___E,
1167 >(
1168 value, preallocated.encoder, &mut out, ()
1169 )?;
1170 } else {
1171 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1172 }
1173 }
1174
1175 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1176 }
1177 unsafe {
1178 preallocated.write_next(out.assume_init_ref());
1179 }
1180 }
1181
1182 ::fidl_next::wire::Table::encode_len(table, max_ord);
1183
1184 Ok(())
1185 }
1186 }
1187
1188 impl<'de> ::fidl_next::FromWire<crate::wire::LeaseDependency<'de>> for LeaseDependency {
1189 #[inline]
1190 fn from_wire(wire_: crate::wire::LeaseDependency<'de>) -> Self {
1191 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1192
1193 let requires_token = wire_.table.get(1);
1194
1195 let requires_level = wire_.table.get(2);
1196
1197 let requires_level_by_preference = wire_.table.get(3);
1198
1199 Self {
1200 requires_token: requires_token.map(|envelope| {
1201 ::fidl_next::FromWire::from_wire(unsafe {
1202 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1203 })
1204 }),
1205
1206 requires_level: requires_level.map(|envelope| {
1207 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
1208 }),
1209
1210 requires_level_by_preference: requires_level_by_preference.map(|envelope| {
1211 ::fidl_next::FromWire::from_wire(unsafe {
1212 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
1213 })
1214 }),
1215 }
1216 }
1217 }
1218
1219 #[doc = " Passed to Topology.Lease.\n"]
1220 #[derive(Debug, Default, PartialEq)]
1221 pub struct LeaseSchema {
1222 pub lease_token: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
1223
1224 pub lease_name: ::core::option::Option<::std::string::String>,
1225
1226 pub dependencies: ::core::option::Option<::std::vec::Vec<crate::natural::LeaseDependency>>,
1227
1228 pub should_return_pending_lease: ::core::option::Option<bool>,
1229 }
1230
1231 impl LeaseSchema {
1232 fn __max_ordinal(&self) -> usize {
1233 if self.should_return_pending_lease.is_some() {
1234 return 4;
1235 }
1236
1237 if self.dependencies.is_some() {
1238 return 3;
1239 }
1240
1241 if self.lease_name.is_some() {
1242 return 2;
1243 }
1244
1245 if self.lease_token.is_some() {
1246 return 1;
1247 }
1248
1249 0
1250 }
1251 }
1252
1253 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LeaseSchema<'static>, ___E> for LeaseSchema
1254 where
1255 ___E: ::fidl_next::Encoder + ?Sized,
1256 ___E: ::fidl_next::fuchsia::HandleEncoder,
1257 {
1258 #[inline]
1259 fn encode(
1260 mut self,
1261 encoder: &mut ___E,
1262 out: &mut ::core::mem::MaybeUninit<crate::wire::LeaseSchema<'static>>,
1263 _: (),
1264 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1265 ::fidl_next::munge!(let crate::wire::LeaseSchema { table } = out);
1266
1267 let max_ord = self.__max_ordinal();
1268
1269 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1270 ::fidl_next::Wire::zero_padding(&mut out);
1271
1272 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1273 ::fidl_next::wire::Envelope,
1274 >(encoder, max_ord);
1275
1276 for i in 1..=max_ord {
1277 match i {
1278 4 => {
1279 if let Some(value) = self.should_return_pending_lease.take() {
1280 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
1281 value,
1282 preallocated.encoder,
1283 &mut out,
1284 (),
1285 )?;
1286 } else {
1287 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1288 }
1289 }
1290
1291 3 => {
1292 if let Some(value) = self.dependencies.take() {
1293 ::fidl_next::wire::Envelope::encode_value::<
1294 ::fidl_next::wire::Vector<
1295 'static,
1296 crate::wire::LeaseDependency<'static>,
1297 >,
1298 ___E,
1299 >(
1300 value, preallocated.encoder, &mut out, (128, ())
1301 )?;
1302 } else {
1303 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1304 }
1305 }
1306
1307 2 => {
1308 if let Some(value) = self.lease_name.take() {
1309 ::fidl_next::wire::Envelope::encode_value::<
1310 ::fidl_next::wire::String<'static>,
1311 ___E,
1312 >(
1313 value, preallocated.encoder, &mut out, 64
1314 )?;
1315 } else {
1316 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1317 }
1318 }
1319
1320 1 => {
1321 if let Some(value) = self.lease_token.take() {
1322 ::fidl_next::wire::Envelope::encode_value::<
1323 ::fidl_next::wire::fuchsia::EventPair,
1324 ___E,
1325 >(
1326 value, preallocated.encoder, &mut out, ()
1327 )?;
1328 } else {
1329 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1330 }
1331 }
1332
1333 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1334 }
1335 unsafe {
1336 preallocated.write_next(out.assume_init_ref());
1337 }
1338 }
1339
1340 ::fidl_next::wire::Table::encode_len(table, max_ord);
1341
1342 Ok(())
1343 }
1344 }
1345
1346 impl<'de> ::fidl_next::FromWire<crate::wire::LeaseSchema<'de>> for LeaseSchema {
1347 #[inline]
1348 fn from_wire(wire_: crate::wire::LeaseSchema<'de>) -> Self {
1349 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1350
1351 let lease_token = wire_.table.get(1);
1352
1353 let lease_name = wire_.table.get(2);
1354
1355 let dependencies = wire_.table.get(3);
1356
1357 let should_return_pending_lease = wire_.table.get(4);
1358
1359 Self {
1360
1361
1362 lease_token: lease_token.map(|envelope| ::fidl_next::FromWire::from_wire(
1363 unsafe { envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>() }
1364 )),
1365
1366
1367 lease_name: lease_name.map(|envelope| ::fidl_next::FromWire::from_wire(
1368 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
1369 )),
1370
1371
1372 dependencies: dependencies.map(|envelope| ::fidl_next::FromWire::from_wire(
1373 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LeaseDependency<'de>>>() }
1374 )),
1375
1376
1377 should_return_pending_lease: should_return_pending_lease.map(|envelope| ::fidl_next::FromWire::from_wire(
1378 unsafe { envelope.read_unchecked::<bool>() }
1379 )),
1380
1381 }
1382 }
1383 }
1384
1385 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1386 #[repr(C)]
1387 pub struct LessorLeaseRequest {
1388 pub level: u8,
1389 }
1390
1391 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LessorLeaseRequest, ___E> for LessorLeaseRequest
1392 where
1393 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1394 ___E: ::fidl_next::fuchsia::HandleEncoder,
1395 {
1396 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1397 Self,
1398 crate::wire::LessorLeaseRequest,
1399 > = unsafe {
1400 ::fidl_next::CopyOptimization::enable_if(
1401 true && <u8 as ::fidl_next::Encode<u8, ___E>>::COPY_OPTIMIZATION.is_enabled(),
1402 )
1403 };
1404
1405 #[inline]
1406 fn encode(
1407 self,
1408 encoder_: &mut ___E,
1409 out_: &mut ::core::mem::MaybeUninit<crate::wire::LessorLeaseRequest>,
1410 _: (),
1411 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1412 ::fidl_next::munge! {
1413 let crate::wire::LessorLeaseRequest {
1414 level,
1415
1416 } = out_;
1417 }
1418
1419 ::fidl_next::Encode::encode(self.level, encoder_, level, ())?;
1420
1421 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(level.as_mut_ptr()) };
1422
1423 Ok(())
1424 }
1425 }
1426
1427 unsafe impl<___E>
1428 ::fidl_next::EncodeOption<
1429 ::fidl_next::wire::Box<'static, crate::wire::LessorLeaseRequest>,
1430 ___E,
1431 > for LessorLeaseRequest
1432 where
1433 ___E: ::fidl_next::Encoder + ?Sized,
1434 LessorLeaseRequest: ::fidl_next::Encode<crate::wire::LessorLeaseRequest, ___E>,
1435 {
1436 #[inline]
1437 fn encode_option(
1438 this: ::core::option::Option<Self>,
1439 encoder: &mut ___E,
1440 out: &mut ::core::mem::MaybeUninit<
1441 ::fidl_next::wire::Box<'static, crate::wire::LessorLeaseRequest>,
1442 >,
1443 _: (),
1444 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1445 if let Some(inner) = this {
1446 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1447 ::fidl_next::wire::Box::encode_present(out);
1448 } else {
1449 ::fidl_next::wire::Box::encode_absent(out);
1450 }
1451
1452 Ok(())
1453 }
1454 }
1455
1456 impl ::fidl_next::FromWire<crate::wire::LessorLeaseRequest> for LessorLeaseRequest {
1457 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1458 crate::wire::LessorLeaseRequest,
1459 Self,
1460 > = unsafe {
1461 ::fidl_next::CopyOptimization::enable_if(
1462 true && <u8 as ::fidl_next::FromWire<u8>>::COPY_OPTIMIZATION.is_enabled(),
1463 )
1464 };
1465
1466 #[inline]
1467 fn from_wire(wire: crate::wire::LessorLeaseRequest) -> Self {
1468 Self { level: ::fidl_next::FromWire::from_wire(wire.level) }
1469 }
1470 }
1471
1472 #[derive(Debug, PartialEq)]
1473 #[repr(C)]
1474 pub struct LessorLeaseResponse {
1475 pub lease_control:
1476 ::fidl_next::ClientEnd<crate::LeaseControl, ::fidl_next::fuchsia::zx::Channel>,
1477 }
1478
1479 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LessorLeaseResponse, ___E>
1480 for LessorLeaseResponse
1481 where
1482 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1483 ___E: ::fidl_next::fuchsia::HandleEncoder,
1484 {
1485 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1486 Self,
1487 crate::wire::LessorLeaseResponse,
1488 > = unsafe {
1489 ::fidl_next::CopyOptimization::enable_if(
1490 true && <::fidl_next::ClientEnd<
1491 crate::LeaseControl,
1492 ::fidl_next::fuchsia::zx::Channel,
1493 > as ::fidl_next::Encode<
1494 ::fidl_next::ClientEnd<
1495 crate::LeaseControl,
1496 ::fidl_next::wire::fuchsia::Channel,
1497 >,
1498 ___E,
1499 >>::COPY_OPTIMIZATION
1500 .is_enabled(),
1501 )
1502 };
1503
1504 #[inline]
1505 fn encode(
1506 self,
1507 encoder_: &mut ___E,
1508 out_: &mut ::core::mem::MaybeUninit<crate::wire::LessorLeaseResponse>,
1509 _: (),
1510 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1511 ::fidl_next::munge! {
1512 let crate::wire::LessorLeaseResponse {
1513 lease_control,
1514
1515 } = out_;
1516 }
1517
1518 ::fidl_next::Encode::encode(self.lease_control, encoder_, lease_control, ())?;
1519
1520 let mut _field =
1521 unsafe { ::fidl_next::Slot::new_unchecked(lease_control.as_mut_ptr()) };
1522
1523 Ok(())
1524 }
1525 }
1526
1527 unsafe impl<___E>
1528 ::fidl_next::EncodeOption<
1529 ::fidl_next::wire::Box<'static, crate::wire::LessorLeaseResponse>,
1530 ___E,
1531 > for LessorLeaseResponse
1532 where
1533 ___E: ::fidl_next::Encoder + ?Sized,
1534 LessorLeaseResponse: ::fidl_next::Encode<crate::wire::LessorLeaseResponse, ___E>,
1535 {
1536 #[inline]
1537 fn encode_option(
1538 this: ::core::option::Option<Self>,
1539 encoder: &mut ___E,
1540 out: &mut ::core::mem::MaybeUninit<
1541 ::fidl_next::wire::Box<'static, crate::wire::LessorLeaseResponse>,
1542 >,
1543 _: (),
1544 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1545 if let Some(inner) = this {
1546 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1547 ::fidl_next::wire::Box::encode_present(out);
1548 } else {
1549 ::fidl_next::wire::Box::encode_absent(out);
1550 }
1551
1552 Ok(())
1553 }
1554 }
1555
1556 impl ::fidl_next::FromWire<crate::wire::LessorLeaseResponse> for LessorLeaseResponse {
1557 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1558 crate::wire::LessorLeaseResponse,
1559 Self,
1560 > = unsafe {
1561 ::fidl_next::CopyOptimization::enable_if(
1562 true && <::fidl_next::ClientEnd<
1563 crate::LeaseControl,
1564 ::fidl_next::fuchsia::zx::Channel,
1565 > as ::fidl_next::FromWire<
1566 ::fidl_next::ClientEnd<
1567 crate::LeaseControl,
1568 ::fidl_next::wire::fuchsia::Channel,
1569 >,
1570 >>::COPY_OPTIMIZATION
1571 .is_enabled(),
1572 )
1573 };
1574
1575 #[inline]
1576 fn from_wire(wire: crate::wire::LessorLeaseResponse) -> Self {
1577 Self { lease_control: ::fidl_next::FromWire::from_wire(wire.lease_control) }
1578 }
1579 }
1580
1581 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1582 #[repr(C)]
1583 pub struct StatusWatchPowerLevelResponse {
1584 pub current_level: u8,
1585 }
1586
1587 unsafe impl<___E> ::fidl_next::Encode<crate::wire::StatusWatchPowerLevelResponse, ___E>
1588 for StatusWatchPowerLevelResponse
1589 where
1590 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1591 ___E: ::fidl_next::fuchsia::HandleEncoder,
1592 {
1593 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1594 Self,
1595 crate::wire::StatusWatchPowerLevelResponse,
1596 > = unsafe {
1597 ::fidl_next::CopyOptimization::enable_if(
1598 true && <u8 as ::fidl_next::Encode<u8, ___E>>::COPY_OPTIMIZATION.is_enabled(),
1599 )
1600 };
1601
1602 #[inline]
1603 fn encode(
1604 self,
1605 encoder_: &mut ___E,
1606 out_: &mut ::core::mem::MaybeUninit<crate::wire::StatusWatchPowerLevelResponse>,
1607 _: (),
1608 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1609 ::fidl_next::munge! {
1610 let crate::wire::StatusWatchPowerLevelResponse {
1611 current_level,
1612
1613 } = out_;
1614 }
1615
1616 ::fidl_next::Encode::encode(self.current_level, encoder_, current_level, ())?;
1617
1618 let mut _field =
1619 unsafe { ::fidl_next::Slot::new_unchecked(current_level.as_mut_ptr()) };
1620
1621 Ok(())
1622 }
1623 }
1624
1625 unsafe impl<___E>
1626 ::fidl_next::EncodeOption<
1627 ::fidl_next::wire::Box<'static, crate::wire::StatusWatchPowerLevelResponse>,
1628 ___E,
1629 > for StatusWatchPowerLevelResponse
1630 where
1631 ___E: ::fidl_next::Encoder + ?Sized,
1632 StatusWatchPowerLevelResponse:
1633 ::fidl_next::Encode<crate::wire::StatusWatchPowerLevelResponse, ___E>,
1634 {
1635 #[inline]
1636 fn encode_option(
1637 this: ::core::option::Option<Self>,
1638 encoder: &mut ___E,
1639 out: &mut ::core::mem::MaybeUninit<
1640 ::fidl_next::wire::Box<'static, crate::wire::StatusWatchPowerLevelResponse>,
1641 >,
1642 _: (),
1643 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1644 if let Some(inner) = this {
1645 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1646 ::fidl_next::wire::Box::encode_present(out);
1647 } else {
1648 ::fidl_next::wire::Box::encode_absent(out);
1649 }
1650
1651 Ok(())
1652 }
1653 }
1654
1655 impl ::fidl_next::FromWire<crate::wire::StatusWatchPowerLevelResponse>
1656 for StatusWatchPowerLevelResponse
1657 {
1658 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1659 crate::wire::StatusWatchPowerLevelResponse,
1660 Self,
1661 > = unsafe {
1662 ::fidl_next::CopyOptimization::enable_if(
1663 true && <u8 as ::fidl_next::FromWire<u8>>::COPY_OPTIMIZATION.is_enabled(),
1664 )
1665 };
1666
1667 #[inline]
1668 fn from_wire(wire: crate::wire::StatusWatchPowerLevelResponse) -> Self {
1669 Self { current_level: ::fidl_next::FromWire::from_wire(wire.current_level) }
1670 }
1671 }
1672}
1673
1674pub mod wire {
1675
1676 pub use fidl_next_common_fuchsia_power_broker::wire::*;
1677
1678 pub type DependencyToken = ::fidl_next::wire::fuchsia::Event;
1680
1681 #[derive(Debug)]
1683 #[repr(C)]
1684 pub struct ElementControlOpenStatusChannelRequest {
1685 pub status_channel:
1686 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
1687 }
1688
1689 static_assertions::const_assert_eq!(
1690 std::mem::size_of::<ElementControlOpenStatusChannelRequest>(),
1691 4
1692 );
1693 static_assertions::const_assert_eq!(
1694 std::mem::align_of::<ElementControlOpenStatusChannelRequest>(),
1695 4
1696 );
1697
1698 static_assertions::const_assert_eq!(
1699 std::mem::offset_of!(ElementControlOpenStatusChannelRequest, status_channel),
1700 0
1701 );
1702
1703 impl ::fidl_next::Constrained for ElementControlOpenStatusChannelRequest {
1704 type Constraint = ();
1705
1706 fn validate(
1707 _: ::fidl_next::Slot<'_, Self>,
1708 _: Self::Constraint,
1709 ) -> Result<(), ::fidl_next::ValidationError> {
1710 Ok(())
1711 }
1712 }
1713
1714 unsafe impl ::fidl_next::Wire for ElementControlOpenStatusChannelRequest {
1715 type Narrowed<'de> = ElementControlOpenStatusChannelRequest;
1716
1717 #[inline]
1718 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1719 ::fidl_next::munge! {
1720 let Self {
1721 status_channel,
1722
1723 } = &mut *out_;
1724 }
1725
1726 ::fidl_next::Wire::zero_padding(status_channel);
1727 }
1728 }
1729
1730 unsafe impl<___D> ::fidl_next::Decode<___D> for ElementControlOpenStatusChannelRequest
1731 where
1732 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1733 ___D: ::fidl_next::fuchsia::HandleDecoder,
1734 {
1735 fn decode(
1736 slot_: ::fidl_next::Slot<'_, Self>,
1737 decoder_: &mut ___D,
1738 _: (),
1739 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1740 ::fidl_next::munge! {
1741 let Self {
1742 mut status_channel,
1743
1744 } = slot_;
1745 }
1746
1747 let _field = status_channel.as_mut();
1748
1749 ::fidl_next::Decode::decode(status_channel.as_mut(), decoder_, ())?;
1750
1751 Ok(())
1752 }
1753 }
1754
1755 impl ::fidl_next::IntoNatural for ElementControlOpenStatusChannelRequest {
1756 type Natural = crate::natural::ElementControlOpenStatusChannelRequest;
1757 }
1758
1759 #[derive(Debug)]
1761 #[repr(C)]
1762 pub struct ElementControlRegisterDependencyTokenRequest {
1763 pub token: ::fidl_next::wire::fuchsia::Event,
1764 }
1765
1766 static_assertions::const_assert_eq!(
1767 std::mem::size_of::<ElementControlRegisterDependencyTokenRequest>(),
1768 4
1769 );
1770 static_assertions::const_assert_eq!(
1771 std::mem::align_of::<ElementControlRegisterDependencyTokenRequest>(),
1772 4
1773 );
1774
1775 static_assertions::const_assert_eq!(
1776 std::mem::offset_of!(ElementControlRegisterDependencyTokenRequest, token),
1777 0
1778 );
1779
1780 impl ::fidl_next::Constrained for ElementControlRegisterDependencyTokenRequest {
1781 type Constraint = ();
1782
1783 fn validate(
1784 _: ::fidl_next::Slot<'_, Self>,
1785 _: Self::Constraint,
1786 ) -> Result<(), ::fidl_next::ValidationError> {
1787 Ok(())
1788 }
1789 }
1790
1791 unsafe impl ::fidl_next::Wire for ElementControlRegisterDependencyTokenRequest {
1792 type Narrowed<'de> = ElementControlRegisterDependencyTokenRequest;
1793
1794 #[inline]
1795 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1796 ::fidl_next::munge! {
1797 let Self {
1798 token,
1799
1800 } = &mut *out_;
1801 }
1802
1803 ::fidl_next::Wire::zero_padding(token);
1804 }
1805 }
1806
1807 unsafe impl<___D> ::fidl_next::Decode<___D> for ElementControlRegisterDependencyTokenRequest
1808 where
1809 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1810 ___D: ::fidl_next::fuchsia::HandleDecoder,
1811 {
1812 fn decode(
1813 slot_: ::fidl_next::Slot<'_, Self>,
1814 decoder_: &mut ___D,
1815 _: (),
1816 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1817 ::fidl_next::munge! {
1818 let Self {
1819 mut token,
1820
1821 } = slot_;
1822 }
1823
1824 let _field = token.as_mut();
1825
1826 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1827
1828 Ok(())
1829 }
1830 }
1831
1832 impl ::fidl_next::IntoNatural for ElementControlRegisterDependencyTokenRequest {
1833 type Natural = crate::natural::ElementControlRegisterDependencyTokenRequest;
1834 }
1835
1836 #[derive(Debug)]
1838 #[repr(C)]
1839 pub struct ElementControlUnregisterDependencyTokenRequest {
1840 pub token: ::fidl_next::wire::fuchsia::Event,
1841 }
1842
1843 static_assertions::const_assert_eq!(
1844 std::mem::size_of::<ElementControlUnregisterDependencyTokenRequest>(),
1845 4
1846 );
1847 static_assertions::const_assert_eq!(
1848 std::mem::align_of::<ElementControlUnregisterDependencyTokenRequest>(),
1849 4
1850 );
1851
1852 static_assertions::const_assert_eq!(
1853 std::mem::offset_of!(ElementControlUnregisterDependencyTokenRequest, token),
1854 0
1855 );
1856
1857 impl ::fidl_next::Constrained for ElementControlUnregisterDependencyTokenRequest {
1858 type Constraint = ();
1859
1860 fn validate(
1861 _: ::fidl_next::Slot<'_, Self>,
1862 _: Self::Constraint,
1863 ) -> Result<(), ::fidl_next::ValidationError> {
1864 Ok(())
1865 }
1866 }
1867
1868 unsafe impl ::fidl_next::Wire for ElementControlUnregisterDependencyTokenRequest {
1869 type Narrowed<'de> = ElementControlUnregisterDependencyTokenRequest;
1870
1871 #[inline]
1872 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1873 ::fidl_next::munge! {
1874 let Self {
1875 token,
1876
1877 } = &mut *out_;
1878 }
1879
1880 ::fidl_next::Wire::zero_padding(token);
1881 }
1882 }
1883
1884 unsafe impl<___D> ::fidl_next::Decode<___D> for ElementControlUnregisterDependencyTokenRequest
1885 where
1886 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1887 ___D: ::fidl_next::fuchsia::HandleDecoder,
1888 {
1889 fn decode(
1890 slot_: ::fidl_next::Slot<'_, Self>,
1891 decoder_: &mut ___D,
1892 _: (),
1893 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1894 ::fidl_next::munge! {
1895 let Self {
1896 mut token,
1897
1898 } = slot_;
1899 }
1900
1901 let _field = token.as_mut();
1902
1903 ::fidl_next::Decode::decode(token.as_mut(), decoder_, ())?;
1904
1905 Ok(())
1906 }
1907 }
1908
1909 impl ::fidl_next::IntoNatural for ElementControlUnregisterDependencyTokenRequest {
1910 type Natural = crate::natural::ElementControlUnregisterDependencyTokenRequest;
1911 }
1912
1913 #[repr(C)]
1915 pub struct LevelDependency<'de> {
1916 pub(crate) table: ::fidl_next::wire::Table<'de>,
1917 }
1918
1919 impl<'de> Drop for LevelDependency<'de> {
1920 fn drop(&mut self) {
1921 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
1922
1923 let _ = self.table.get(2).map(|envelope| unsafe {
1924 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1925 });
1926
1927 let _ = self.table.get(3).map(|envelope| unsafe {
1928 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
1929 });
1930
1931 let _ = self.table.get(4).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
1932 }
1933 }
1934
1935 impl ::fidl_next::Constrained for LevelDependency<'_> {
1936 type Constraint = ();
1937
1938 fn validate(
1939 _: ::fidl_next::Slot<'_, Self>,
1940 _: Self::Constraint,
1941 ) -> Result<(), ::fidl_next::ValidationError> {
1942 Ok(())
1943 }
1944 }
1945
1946 unsafe impl ::fidl_next::Wire for LevelDependency<'static> {
1947 type Narrowed<'de> = LevelDependency<'de>;
1948
1949 #[inline]
1950 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1951 ::fidl_next::munge!(let Self { table } = out);
1952 ::fidl_next::wire::Table::zero_padding(table);
1953 }
1954 }
1955
1956 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LevelDependency<'de>
1957 where
1958 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1959 ___D: ::fidl_next::fuchsia::HandleDecoder,
1960 {
1961 fn decode(
1962 slot: ::fidl_next::Slot<'_, Self>,
1963 decoder: &mut ___D,
1964 _: (),
1965 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1966 ::fidl_next::munge!(let Self { table } = slot);
1967
1968 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1969 match ordinal {
1970 0 => unsafe { ::core::hint::unreachable_unchecked() },
1971
1972 1 => {
1973 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
1974 slot.as_mut(),
1975 decoder,
1976 (),
1977 )?;
1978
1979 Ok(())
1980 }
1981
1982 2 => {
1983 ::fidl_next::wire::Envelope::decode_as::<
1984 ___D,
1985 ::fidl_next::wire::fuchsia::Event,
1986 >(slot.as_mut(), decoder, ())?;
1987
1988 Ok(())
1989 }
1990
1991 3 => {
1992 ::fidl_next::wire::Envelope::decode_as::<
1993 ___D,
1994 ::fidl_next::wire::Vector<'de, u8>,
1995 >(slot.as_mut(), decoder, (256, ()))?;
1996
1997 let value = unsafe {
1998 slot.deref_unchecked()
1999 .deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
2000 };
2001
2002 if value.len() > 256 {
2003 return Err(::fidl_next::DecodeError::VectorTooLong {
2004 size: value.len() as u64,
2005 limit: 256,
2006 });
2007 }
2008
2009 Ok(())
2010 }
2011
2012 4 => {
2013 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
2014 slot.as_mut(),
2015 decoder,
2016 (),
2017 )?;
2018
2019 Ok(())
2020 }
2021
2022 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2023 }
2024 })
2025 }
2026 }
2027
2028 impl<'de> LevelDependency<'de> {
2029 pub fn dependent_level(&self) -> ::core::option::Option<&u8> {
2030 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2031 }
2032
2033 pub fn requires_token(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2034 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2035 }
2036
2037 pub fn requires_level_by_preference(
2038 &self,
2039 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, u8>> {
2040 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2041 }
2042
2043 pub fn remove_with_required_element(&self) -> ::core::option::Option<&bool> {
2044 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2045 }
2046 }
2047
2048 impl<'de> ::core::fmt::Debug for LevelDependency<'de> {
2049 fn fmt(
2050 &self,
2051 f: &mut ::core::fmt::Formatter<'_>,
2052 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2053 f.debug_struct("LevelDependency")
2054 .field("dependent_level", &self.dependent_level())
2055 .field("requires_token", &self.requires_token())
2056 .field("requires_level_by_preference", &self.requires_level_by_preference())
2057 .field("remove_with_required_element", &self.remove_with_required_element())
2058 .finish()
2059 }
2060 }
2061
2062 impl<'de> ::fidl_next::IntoNatural for LevelDependency<'de> {
2063 type Natural = crate::natural::LevelDependency;
2064 }
2065
2066 #[derive(Debug)]
2068 #[repr(C)]
2069 pub struct ElementInfoProviderGetElementPowerLevelNamesResponse<'de> {
2070 pub level_names: ::fidl_next::wire::Vector<'de, crate::wire::ElementPowerLevelNames<'de>>,
2071 }
2072
2073 static_assertions::const_assert_eq!(
2074 std::mem::size_of::<ElementInfoProviderGetElementPowerLevelNamesResponse<'_>>(),
2075 16
2076 );
2077 static_assertions::const_assert_eq!(
2078 std::mem::align_of::<ElementInfoProviderGetElementPowerLevelNamesResponse<'_>>(),
2079 8
2080 );
2081
2082 static_assertions::const_assert_eq!(
2083 std::mem::offset_of!(ElementInfoProviderGetElementPowerLevelNamesResponse<'_>, level_names),
2084 0
2085 );
2086
2087 impl ::fidl_next::Constrained for ElementInfoProviderGetElementPowerLevelNamesResponse<'_> {
2088 type Constraint = ();
2089
2090 fn validate(
2091 _: ::fidl_next::Slot<'_, Self>,
2092 _: Self::Constraint,
2093 ) -> Result<(), ::fidl_next::ValidationError> {
2094 Ok(())
2095 }
2096 }
2097
2098 unsafe impl ::fidl_next::Wire for ElementInfoProviderGetElementPowerLevelNamesResponse<'static> {
2099 type Narrowed<'de> = ElementInfoProviderGetElementPowerLevelNamesResponse<'de>;
2100
2101 #[inline]
2102 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2103 ::fidl_next::munge! {
2104 let Self {
2105 level_names,
2106
2107 } = &mut *out_;
2108 }
2109
2110 ::fidl_next::Wire::zero_padding(level_names);
2111 }
2112 }
2113
2114 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2115 for ElementInfoProviderGetElementPowerLevelNamesResponse<'de>
2116 where
2117 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2118 ___D: ::fidl_next::Decoder<'de>,
2119 ___D: ::fidl_next::fuchsia::HandleDecoder,
2120 {
2121 fn decode(
2122 slot_: ::fidl_next::Slot<'_, Self>,
2123 decoder_: &mut ___D,
2124 _: (),
2125 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2126 ::fidl_next::munge! {
2127 let Self {
2128 mut level_names,
2129
2130 } = slot_;
2131 }
2132
2133 let _field = level_names.as_mut();
2134 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
2135 ::fidl_next::Decode::decode(level_names.as_mut(), decoder_, (4294967295, ()))?;
2136
2137 Ok(())
2138 }
2139 }
2140
2141 impl<'de> ::fidl_next::IntoNatural for ElementInfoProviderGetElementPowerLevelNamesResponse<'de> {
2142 type Natural = crate::natural::ElementInfoProviderGetElementPowerLevelNamesResponse;
2143 }
2144
2145 #[repr(C)]
2147 pub struct ElementStatusEndpoint<'de> {
2148 pub(crate) table: ::fidl_next::wire::Table<'de>,
2149 }
2150
2151 impl<'de> Drop for ElementStatusEndpoint<'de> {
2152 fn drop(&mut self) {
2153 let _ = self.table.get(1).map(|envelope| unsafe {
2154 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2155 });
2156
2157 let _ = self.table.get(2)
2158 .map(|envelope| unsafe {
2159 envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>>()
2160 });
2161 }
2162 }
2163
2164 impl ::fidl_next::Constrained for ElementStatusEndpoint<'_> {
2165 type Constraint = ();
2166
2167 fn validate(
2168 _: ::fidl_next::Slot<'_, Self>,
2169 _: Self::Constraint,
2170 ) -> Result<(), ::fidl_next::ValidationError> {
2171 Ok(())
2172 }
2173 }
2174
2175 unsafe impl ::fidl_next::Wire for ElementStatusEndpoint<'static> {
2176 type Narrowed<'de> = ElementStatusEndpoint<'de>;
2177
2178 #[inline]
2179 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2180 ::fidl_next::munge!(let Self { table } = out);
2181 ::fidl_next::wire::Table::zero_padding(table);
2182 }
2183 }
2184
2185 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ElementStatusEndpoint<'de>
2186 where
2187 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2188 ___D: ::fidl_next::fuchsia::HandleDecoder,
2189 {
2190 fn decode(
2191 slot: ::fidl_next::Slot<'_, Self>,
2192 decoder: &mut ___D,
2193 _: (),
2194 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2195 ::fidl_next::munge!(let Self { table } = slot);
2196
2197 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2198 match ordinal {
2199 0 => unsafe { ::core::hint::unreachable_unchecked() },
2200
2201 1 => {
2202 ::fidl_next::wire::Envelope::decode_as::<
2203 ___D,
2204 ::fidl_next::wire::String<'de>,
2205 >(slot.as_mut(), decoder, 64)?;
2206
2207 let value = unsafe {
2208 slot.deref_unchecked()
2209 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2210 };
2211
2212 if value.len() > 64 {
2213 return Err(::fidl_next::DecodeError::VectorTooLong {
2214 size: value.len() as u64,
2215 limit: 64,
2216 });
2217 }
2218
2219 Ok(())
2220 }
2221
2222 2 => {
2223 ::fidl_next::wire::Envelope::decode_as::<
2224 ___D,
2225 ::fidl_next::ClientEnd<
2226 crate::Status,
2227 ::fidl_next::wire::fuchsia::Channel,
2228 >,
2229 >(slot.as_mut(), decoder, ())?;
2230
2231 Ok(())
2232 }
2233
2234 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2235 }
2236 })
2237 }
2238 }
2239
2240 impl<'de> ElementStatusEndpoint<'de> {
2241 pub fn identifier(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2242 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2243 }
2244
2245 pub fn status(
2246 &self,
2247 ) -> ::core::option::Option<
2248 &::fidl_next::ClientEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
2249 > {
2250 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2251 }
2252 }
2253
2254 impl<'de> ::core::fmt::Debug for ElementStatusEndpoint<'de> {
2255 fn fmt(
2256 &self,
2257 f: &mut ::core::fmt::Formatter<'_>,
2258 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2259 f.debug_struct("ElementStatusEndpoint")
2260 .field("identifier", &self.identifier())
2261 .field("status", &self.status())
2262 .finish()
2263 }
2264 }
2265
2266 impl<'de> ::fidl_next::IntoNatural for ElementStatusEndpoint<'de> {
2267 type Natural = crate::natural::ElementStatusEndpoint;
2268 }
2269
2270 #[derive(Debug)]
2272 #[repr(C)]
2273 pub struct ElementInfoProviderGetStatusEndpointsResponse<'de> {
2274 pub endpoints: ::fidl_next::wire::Vector<'de, crate::wire::ElementStatusEndpoint<'de>>,
2275 }
2276
2277 static_assertions::const_assert_eq!(
2278 std::mem::size_of::<ElementInfoProviderGetStatusEndpointsResponse<'_>>(),
2279 16
2280 );
2281 static_assertions::const_assert_eq!(
2282 std::mem::align_of::<ElementInfoProviderGetStatusEndpointsResponse<'_>>(),
2283 8
2284 );
2285
2286 static_assertions::const_assert_eq!(
2287 std::mem::offset_of!(ElementInfoProviderGetStatusEndpointsResponse<'_>, endpoints),
2288 0
2289 );
2290
2291 impl ::fidl_next::Constrained for ElementInfoProviderGetStatusEndpointsResponse<'_> {
2292 type Constraint = ();
2293
2294 fn validate(
2295 _: ::fidl_next::Slot<'_, Self>,
2296 _: Self::Constraint,
2297 ) -> Result<(), ::fidl_next::ValidationError> {
2298 Ok(())
2299 }
2300 }
2301
2302 unsafe impl ::fidl_next::Wire for ElementInfoProviderGetStatusEndpointsResponse<'static> {
2303 type Narrowed<'de> = ElementInfoProviderGetStatusEndpointsResponse<'de>;
2304
2305 #[inline]
2306 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2307 ::fidl_next::munge! {
2308 let Self {
2309 endpoints,
2310
2311 } = &mut *out_;
2312 }
2313
2314 ::fidl_next::Wire::zero_padding(endpoints);
2315 }
2316 }
2317
2318 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2319 for ElementInfoProviderGetStatusEndpointsResponse<'de>
2320 where
2321 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2322 ___D: ::fidl_next::Decoder<'de>,
2323 ___D: ::fidl_next::fuchsia::HandleDecoder,
2324 {
2325 fn decode(
2326 slot_: ::fidl_next::Slot<'_, Self>,
2327 decoder_: &mut ___D,
2328 _: (),
2329 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2330 ::fidl_next::munge! {
2331 let Self {
2332 mut endpoints,
2333
2334 } = slot_;
2335 }
2336
2337 let _field = endpoints.as_mut();
2338 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
2339 ::fidl_next::Decode::decode(endpoints.as_mut(), decoder_, (4294967295, ()))?;
2340
2341 Ok(())
2342 }
2343 }
2344
2345 impl<'de> ::fidl_next::IntoNatural for ElementInfoProviderGetStatusEndpointsResponse<'de> {
2346 type Natural = crate::natural::ElementInfoProviderGetStatusEndpointsResponse;
2347 }
2348
2349 pub type LeaseToken = ::fidl_next::wire::fuchsia::EventPair;
2351
2352 #[repr(C)]
2354 pub struct ElementSchema<'de> {
2355 pub(crate) table: ::fidl_next::wire::Table<'de>,
2356 }
2357
2358 impl<'de> Drop for ElementSchema<'de> {
2359 fn drop(&mut self) {
2360 let _ = self.table.get(1).map(|envelope| unsafe {
2361 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2362 });
2363
2364 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2365
2366 let _ = self.table.get(3).map(|envelope| unsafe {
2367 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
2368 });
2369
2370 let _ = self.table.get(4)
2371 .map(|envelope| unsafe {
2372 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LevelDependency<'de>>>()
2373 });
2374
2375 let _ = self.table.get(8)
2376 .map(|envelope| unsafe {
2377 envelope.read_unchecked::<::fidl_next::ServerEnd<crate::Lessor, ::fidl_next::wire::fuchsia::Channel>>()
2378 });
2379
2380 let _ = self.table.get(9).map(|envelope| unsafe {
2381 envelope.read_unchecked::<::fidl_next::ServerEnd<
2382 crate::ElementControl,
2383 ::fidl_next::wire::fuchsia::Channel,
2384 >>()
2385 });
2386
2387 let _ = self.table.get(10).map(|envelope| unsafe {
2388 envelope.read_unchecked::<::fidl_next::ClientEnd<
2389 crate::ElementRunner,
2390 ::fidl_next::wire::fuchsia::Channel,
2391 >>()
2392 });
2393
2394 let _ = self.table.get(11).map(|envelope| unsafe {
2395 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
2396 });
2397 }
2398 }
2399
2400 impl ::fidl_next::Constrained for ElementSchema<'_> {
2401 type Constraint = ();
2402
2403 fn validate(
2404 _: ::fidl_next::Slot<'_, Self>,
2405 _: Self::Constraint,
2406 ) -> Result<(), ::fidl_next::ValidationError> {
2407 Ok(())
2408 }
2409 }
2410
2411 unsafe impl ::fidl_next::Wire for ElementSchema<'static> {
2412 type Narrowed<'de> = ElementSchema<'de>;
2413
2414 #[inline]
2415 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2416 ::fidl_next::munge!(let Self { table } = out);
2417 ::fidl_next::wire::Table::zero_padding(table);
2418 }
2419 }
2420
2421 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ElementSchema<'de>
2422 where
2423 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2424 ___D: ::fidl_next::fuchsia::HandleDecoder,
2425 {
2426 fn decode(
2427 slot: ::fidl_next::Slot<'_, Self>,
2428 decoder: &mut ___D,
2429 _: (),
2430 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2431 ::fidl_next::munge!(let Self { table } = slot);
2432
2433 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2434 match ordinal {
2435 0 => unsafe { ::core::hint::unreachable_unchecked() },
2436
2437 1 => {
2438 ::fidl_next::wire::Envelope::decode_as::<
2439 ___D,
2440 ::fidl_next::wire::String<'de>,
2441 >(slot.as_mut(), decoder, 64)?;
2442
2443 let value = unsafe {
2444 slot.deref_unchecked()
2445 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2446 };
2447
2448 if value.len() > 64 {
2449 return Err(::fidl_next::DecodeError::VectorTooLong {
2450 size: value.len() as u64,
2451 limit: 64,
2452 });
2453 }
2454
2455 Ok(())
2456 }
2457
2458 2 => {
2459 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2460 slot.as_mut(),
2461 decoder,
2462 (),
2463 )?;
2464
2465 Ok(())
2466 }
2467
2468 3 => {
2469 ::fidl_next::wire::Envelope::decode_as::<
2470 ___D,
2471 ::fidl_next::wire::Vector<'de, u8>,
2472 >(slot.as_mut(), decoder, (256, ()))?;
2473
2474 let value = unsafe {
2475 slot.deref_unchecked()
2476 .deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
2477 };
2478
2479 if value.len() > 256 {
2480 return Err(::fidl_next::DecodeError::VectorTooLong {
2481 size: value.len() as u64,
2482 limit: 256,
2483 });
2484 }
2485
2486 Ok(())
2487 }
2488
2489 4 => {
2490 ::fidl_next::wire::Envelope::decode_as::<
2491 ___D,
2492 ::fidl_next::wire::Vector<'de, crate::wire::LevelDependency<'de>>,
2493 >(slot.as_mut(), decoder, (128, ()))?;
2494
2495 let value = unsafe {
2496 slot
2497 .deref_unchecked()
2498 .deref_unchecked::<
2499 ::fidl_next::wire::Vector<'_, crate::wire::LevelDependency<'_>>
2500 >()
2501 };
2502
2503 if value.len() > 128 {
2504 return Err(::fidl_next::DecodeError::VectorTooLong {
2505 size: value.len() as u64,
2506 limit: 128,
2507 });
2508 }
2509
2510 Ok(())
2511 }
2512
2513 8 => {
2514 ::fidl_next::wire::Envelope::decode_as::<
2515 ___D,
2516 ::fidl_next::ServerEnd<
2517 crate::Lessor,
2518 ::fidl_next::wire::fuchsia::Channel,
2519 >,
2520 >(slot.as_mut(), decoder, ())?;
2521
2522 Ok(())
2523 }
2524
2525 9 => {
2526 ::fidl_next::wire::Envelope::decode_as::<
2527 ___D,
2528 ::fidl_next::ServerEnd<
2529 crate::ElementControl,
2530 ::fidl_next::wire::fuchsia::Channel,
2531 >,
2532 >(slot.as_mut(), decoder, ())?;
2533
2534 Ok(())
2535 }
2536
2537 10 => {
2538 ::fidl_next::wire::Envelope::decode_as::<
2539 ___D,
2540 ::fidl_next::ClientEnd<
2541 crate::ElementRunner,
2542 ::fidl_next::wire::fuchsia::Channel,
2543 >,
2544 >(slot.as_mut(), decoder, ())?;
2545
2546 Ok(())
2547 }
2548
2549 11 => {
2550 ::fidl_next::wire::Envelope::decode_as::<
2551 ___D,
2552 ::fidl_next::wire::fuchsia::EventPair,
2553 >(slot.as_mut(), decoder, ())?;
2554
2555 Ok(())
2556 }
2557
2558 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2559 }
2560 })
2561 }
2562 }
2563
2564 impl<'de> ElementSchema<'de> {
2565 pub fn element_name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2566 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2567 }
2568
2569 pub fn initial_current_level(&self) -> ::core::option::Option<&u8> {
2570 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2571 }
2572
2573 pub fn valid_levels(&self) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, u8>> {
2574 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2575 }
2576
2577 pub fn dependencies(
2578 &self,
2579 ) -> ::core::option::Option<
2580 &::fidl_next::wire::Vector<'de, crate::wire::LevelDependency<'de>>,
2581 > {
2582 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2583 }
2584
2585 pub fn lessor_channel(
2586 &self,
2587 ) -> ::core::option::Option<
2588 &::fidl_next::ServerEnd<crate::Lessor, ::fidl_next::wire::fuchsia::Channel>,
2589 > {
2590 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
2591 }
2592
2593 pub fn element_control(
2594 &self,
2595 ) -> ::core::option::Option<
2596 &::fidl_next::ServerEnd<crate::ElementControl, ::fidl_next::wire::fuchsia::Channel>,
2597 > {
2598 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
2599 }
2600
2601 pub fn element_runner(
2602 &self,
2603 ) -> ::core::option::Option<
2604 &::fidl_next::ClientEnd<crate::ElementRunner, ::fidl_next::wire::fuchsia::Channel>,
2605 > {
2606 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
2607 }
2608
2609 pub fn initial_lease_token(
2610 &self,
2611 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
2612 unsafe { Some(self.table.get(11)?.deref_unchecked()) }
2613 }
2614 }
2615
2616 impl<'de> ::core::fmt::Debug for ElementSchema<'de> {
2617 fn fmt(
2618 &self,
2619 f: &mut ::core::fmt::Formatter<'_>,
2620 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2621 f.debug_struct("ElementSchema")
2622 .field("element_name", &self.element_name())
2623 .field("initial_current_level", &self.initial_current_level())
2624 .field("valid_levels", &self.valid_levels())
2625 .field("dependencies", &self.dependencies())
2626 .field("lessor_channel", &self.lessor_channel())
2627 .field("element_control", &self.element_control())
2628 .field("element_runner", &self.element_runner())
2629 .field("initial_lease_token", &self.initial_lease_token())
2630 .finish()
2631 }
2632 }
2633
2634 impl<'de> ::fidl_next::IntoNatural for ElementSchema<'de> {
2635 type Natural = crate::natural::ElementSchema;
2636 }
2637
2638 #[repr(C)]
2640 pub struct LeaseDependency<'de> {
2641 pub(crate) table: ::fidl_next::wire::Table<'de>,
2642 }
2643
2644 impl<'de> Drop for LeaseDependency<'de> {
2645 fn drop(&mut self) {
2646 let _ = self.table.get(1).map(|envelope| unsafe {
2647 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2648 });
2649
2650 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2651
2652 let _ = self.table.get(3).map(|envelope| unsafe {
2653 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
2654 });
2655 }
2656 }
2657
2658 impl ::fidl_next::Constrained for LeaseDependency<'_> {
2659 type Constraint = ();
2660
2661 fn validate(
2662 _: ::fidl_next::Slot<'_, Self>,
2663 _: Self::Constraint,
2664 ) -> Result<(), ::fidl_next::ValidationError> {
2665 Ok(())
2666 }
2667 }
2668
2669 unsafe impl ::fidl_next::Wire for LeaseDependency<'static> {
2670 type Narrowed<'de> = LeaseDependency<'de>;
2671
2672 #[inline]
2673 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2674 ::fidl_next::munge!(let Self { table } = out);
2675 ::fidl_next::wire::Table::zero_padding(table);
2676 }
2677 }
2678
2679 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LeaseDependency<'de>
2680 where
2681 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2682 ___D: ::fidl_next::fuchsia::HandleDecoder,
2683 {
2684 fn decode(
2685 slot: ::fidl_next::Slot<'_, Self>,
2686 decoder: &mut ___D,
2687 _: (),
2688 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2689 ::fidl_next::munge!(let Self { table } = slot);
2690
2691 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2692 match ordinal {
2693 0 => unsafe { ::core::hint::unreachable_unchecked() },
2694
2695 1 => {
2696 ::fidl_next::wire::Envelope::decode_as::<
2697 ___D,
2698 ::fidl_next::wire::fuchsia::Event,
2699 >(slot.as_mut(), decoder, ())?;
2700
2701 Ok(())
2702 }
2703
2704 2 => {
2705 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2706 slot.as_mut(),
2707 decoder,
2708 (),
2709 )?;
2710
2711 Ok(())
2712 }
2713
2714 3 => {
2715 ::fidl_next::wire::Envelope::decode_as::<
2716 ___D,
2717 ::fidl_next::wire::Vector<'de, u8>,
2718 >(slot.as_mut(), decoder, (256, ()))?;
2719
2720 let value = unsafe {
2721 slot.deref_unchecked()
2722 .deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
2723 };
2724
2725 if value.len() > 256 {
2726 return Err(::fidl_next::DecodeError::VectorTooLong {
2727 size: value.len() as u64,
2728 limit: 256,
2729 });
2730 }
2731
2732 Ok(())
2733 }
2734
2735 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2736 }
2737 })
2738 }
2739 }
2740
2741 impl<'de> LeaseDependency<'de> {
2742 pub fn requires_token(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2743 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2744 }
2745
2746 pub fn requires_level(&self) -> ::core::option::Option<&u8> {
2747 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2748 }
2749
2750 pub fn requires_level_by_preference(
2751 &self,
2752 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, u8>> {
2753 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2754 }
2755 }
2756
2757 impl<'de> ::core::fmt::Debug for LeaseDependency<'de> {
2758 fn fmt(
2759 &self,
2760 f: &mut ::core::fmt::Formatter<'_>,
2761 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2762 f.debug_struct("LeaseDependency")
2763 .field("requires_token", &self.requires_token())
2764 .field("requires_level", &self.requires_level())
2765 .field("requires_level_by_preference", &self.requires_level_by_preference())
2766 .finish()
2767 }
2768 }
2769
2770 impl<'de> ::fidl_next::IntoNatural for LeaseDependency<'de> {
2771 type Natural = crate::natural::LeaseDependency;
2772 }
2773
2774 #[repr(C)]
2776 pub struct LeaseSchema<'de> {
2777 pub(crate) table: ::fidl_next::wire::Table<'de>,
2778 }
2779
2780 impl<'de> Drop for LeaseSchema<'de> {
2781 fn drop(&mut self) {
2782 let _ = self.table.get(1).map(|envelope| unsafe {
2783 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
2784 });
2785
2786 let _ = self.table.get(2).map(|envelope| unsafe {
2787 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2788 });
2789
2790 let _ = self.table.get(3)
2791 .map(|envelope| unsafe {
2792 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LeaseDependency<'de>>>()
2793 });
2794
2795 let _ = self.table.get(4).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
2796 }
2797 }
2798
2799 impl ::fidl_next::Constrained for LeaseSchema<'_> {
2800 type Constraint = ();
2801
2802 fn validate(
2803 _: ::fidl_next::Slot<'_, Self>,
2804 _: Self::Constraint,
2805 ) -> Result<(), ::fidl_next::ValidationError> {
2806 Ok(())
2807 }
2808 }
2809
2810 unsafe impl ::fidl_next::Wire for LeaseSchema<'static> {
2811 type Narrowed<'de> = LeaseSchema<'de>;
2812
2813 #[inline]
2814 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2815 ::fidl_next::munge!(let Self { table } = out);
2816 ::fidl_next::wire::Table::zero_padding(table);
2817 }
2818 }
2819
2820 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LeaseSchema<'de>
2821 where
2822 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2823 ___D: ::fidl_next::fuchsia::HandleDecoder,
2824 {
2825 fn decode(
2826 slot: ::fidl_next::Slot<'_, Self>,
2827 decoder: &mut ___D,
2828 _: (),
2829 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2830 ::fidl_next::munge!(let Self { table } = slot);
2831
2832 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2833 match ordinal {
2834 0 => unsafe { ::core::hint::unreachable_unchecked() },
2835
2836 1 => {
2837 ::fidl_next::wire::Envelope::decode_as::<
2838 ___D,
2839 ::fidl_next::wire::fuchsia::EventPair,
2840 >(slot.as_mut(), decoder, ())?;
2841
2842 Ok(())
2843 }
2844
2845 2 => {
2846 ::fidl_next::wire::Envelope::decode_as::<
2847 ___D,
2848 ::fidl_next::wire::String<'de>,
2849 >(slot.as_mut(), decoder, 64)?;
2850
2851 let value = unsafe {
2852 slot.deref_unchecked()
2853 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2854 };
2855
2856 if value.len() > 64 {
2857 return Err(::fidl_next::DecodeError::VectorTooLong {
2858 size: value.len() as u64,
2859 limit: 64,
2860 });
2861 }
2862
2863 Ok(())
2864 }
2865
2866 3 => {
2867 ::fidl_next::wire::Envelope::decode_as::<
2868 ___D,
2869 ::fidl_next::wire::Vector<'de, crate::wire::LeaseDependency<'de>>,
2870 >(slot.as_mut(), decoder, (128, ()))?;
2871
2872 let value = unsafe {
2873 slot
2874 .deref_unchecked()
2875 .deref_unchecked::<
2876 ::fidl_next::wire::Vector<'_, crate::wire::LeaseDependency<'_>>
2877 >()
2878 };
2879
2880 if value.len() > 128 {
2881 return Err(::fidl_next::DecodeError::VectorTooLong {
2882 size: value.len() as u64,
2883 limit: 128,
2884 });
2885 }
2886
2887 Ok(())
2888 }
2889
2890 4 => {
2891 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
2892 slot.as_mut(),
2893 decoder,
2894 (),
2895 )?;
2896
2897 Ok(())
2898 }
2899
2900 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2901 }
2902 })
2903 }
2904 }
2905
2906 impl<'de> LeaseSchema<'de> {
2907 pub fn lease_token(
2908 &self,
2909 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
2910 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2911 }
2912
2913 pub fn lease_name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2914 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2915 }
2916
2917 pub fn dependencies(
2918 &self,
2919 ) -> ::core::option::Option<
2920 &::fidl_next::wire::Vector<'de, crate::wire::LeaseDependency<'de>>,
2921 > {
2922 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2923 }
2924
2925 pub fn should_return_pending_lease(&self) -> ::core::option::Option<&bool> {
2926 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2927 }
2928 }
2929
2930 impl<'de> ::core::fmt::Debug for LeaseSchema<'de> {
2931 fn fmt(
2932 &self,
2933 f: &mut ::core::fmt::Formatter<'_>,
2934 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2935 f.debug_struct("LeaseSchema")
2936 .field("lease_token", &self.lease_token())
2937 .field("lease_name", &self.lease_name())
2938 .field("dependencies", &self.dependencies())
2939 .field("should_return_pending_lease", &self.should_return_pending_lease())
2940 .finish()
2941 }
2942 }
2943
2944 impl<'de> ::fidl_next::IntoNatural for LeaseSchema<'de> {
2945 type Natural = crate::natural::LeaseSchema;
2946 }
2947
2948 #[derive(Debug)]
2950 #[repr(C)]
2951 pub struct LessorLeaseRequest {
2952 pub level: u8,
2953 }
2954
2955 static_assertions::const_assert_eq!(std::mem::size_of::<LessorLeaseRequest>(), 1);
2956 static_assertions::const_assert_eq!(std::mem::align_of::<LessorLeaseRequest>(), 1);
2957
2958 static_assertions::const_assert_eq!(std::mem::offset_of!(LessorLeaseRequest, level), 0);
2959
2960 impl ::fidl_next::Constrained for LessorLeaseRequest {
2961 type Constraint = ();
2962
2963 fn validate(
2964 _: ::fidl_next::Slot<'_, Self>,
2965 _: Self::Constraint,
2966 ) -> Result<(), ::fidl_next::ValidationError> {
2967 Ok(())
2968 }
2969 }
2970
2971 unsafe impl ::fidl_next::Wire for LessorLeaseRequest {
2972 type Narrowed<'de> = LessorLeaseRequest;
2973
2974 #[inline]
2975 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2976 ::fidl_next::munge! {
2977 let Self {
2978 level,
2979
2980 } = &mut *out_;
2981 }
2982
2983 ::fidl_next::Wire::zero_padding(level);
2984 }
2985 }
2986
2987 unsafe impl<___D> ::fidl_next::Decode<___D> for LessorLeaseRequest
2988 where
2989 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2990 ___D: ::fidl_next::fuchsia::HandleDecoder,
2991 {
2992 fn decode(
2993 slot_: ::fidl_next::Slot<'_, Self>,
2994 decoder_: &mut ___D,
2995 _: (),
2996 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2997 ::fidl_next::munge! {
2998 let Self {
2999 mut level,
3000
3001 } = slot_;
3002 }
3003
3004 let _field = level.as_mut();
3005
3006 ::fidl_next::Decode::decode(level.as_mut(), decoder_, ())?;
3007
3008 Ok(())
3009 }
3010 }
3011
3012 impl ::fidl_next::IntoNatural for LessorLeaseRequest {
3013 type Natural = crate::natural::LessorLeaseRequest;
3014 }
3015
3016 #[derive(Debug)]
3018 #[repr(C)]
3019 pub struct LessorLeaseResponse {
3020 pub lease_control:
3021 ::fidl_next::ClientEnd<crate::LeaseControl, ::fidl_next::wire::fuchsia::Channel>,
3022 }
3023
3024 static_assertions::const_assert_eq!(std::mem::size_of::<LessorLeaseResponse>(), 4);
3025 static_assertions::const_assert_eq!(std::mem::align_of::<LessorLeaseResponse>(), 4);
3026
3027 static_assertions::const_assert_eq!(
3028 std::mem::offset_of!(LessorLeaseResponse, lease_control),
3029 0
3030 );
3031
3032 impl ::fidl_next::Constrained for LessorLeaseResponse {
3033 type Constraint = ();
3034
3035 fn validate(
3036 _: ::fidl_next::Slot<'_, Self>,
3037 _: Self::Constraint,
3038 ) -> Result<(), ::fidl_next::ValidationError> {
3039 Ok(())
3040 }
3041 }
3042
3043 unsafe impl ::fidl_next::Wire for LessorLeaseResponse {
3044 type Narrowed<'de> = LessorLeaseResponse;
3045
3046 #[inline]
3047 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
3048 ::fidl_next::munge! {
3049 let Self {
3050 lease_control,
3051
3052 } = &mut *out_;
3053 }
3054
3055 ::fidl_next::Wire::zero_padding(lease_control);
3056 }
3057 }
3058
3059 unsafe impl<___D> ::fidl_next::Decode<___D> for LessorLeaseResponse
3060 where
3061 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3062 ___D: ::fidl_next::fuchsia::HandleDecoder,
3063 {
3064 fn decode(
3065 slot_: ::fidl_next::Slot<'_, Self>,
3066 decoder_: &mut ___D,
3067 _: (),
3068 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3069 ::fidl_next::munge! {
3070 let Self {
3071 mut lease_control,
3072
3073 } = slot_;
3074 }
3075
3076 let _field = lease_control.as_mut();
3077
3078 ::fidl_next::Decode::decode(lease_control.as_mut(), decoder_, ())?;
3079
3080 Ok(())
3081 }
3082 }
3083
3084 impl ::fidl_next::IntoNatural for LessorLeaseResponse {
3085 type Natural = crate::natural::LessorLeaseResponse;
3086 }
3087
3088 #[derive(Debug)]
3090 #[repr(C)]
3091 pub struct StatusWatchPowerLevelResponse {
3092 pub current_level: u8,
3093 }
3094
3095 static_assertions::const_assert_eq!(std::mem::size_of::<StatusWatchPowerLevelResponse>(), 1);
3096 static_assertions::const_assert_eq!(std::mem::align_of::<StatusWatchPowerLevelResponse>(), 1);
3097
3098 static_assertions::const_assert_eq!(
3099 std::mem::offset_of!(StatusWatchPowerLevelResponse, current_level),
3100 0
3101 );
3102
3103 impl ::fidl_next::Constrained for StatusWatchPowerLevelResponse {
3104 type Constraint = ();
3105
3106 fn validate(
3107 _: ::fidl_next::Slot<'_, Self>,
3108 _: Self::Constraint,
3109 ) -> Result<(), ::fidl_next::ValidationError> {
3110 Ok(())
3111 }
3112 }
3113
3114 unsafe impl ::fidl_next::Wire for StatusWatchPowerLevelResponse {
3115 type Narrowed<'de> = StatusWatchPowerLevelResponse;
3116
3117 #[inline]
3118 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
3119 ::fidl_next::munge! {
3120 let Self {
3121 current_level,
3122
3123 } = &mut *out_;
3124 }
3125
3126 ::fidl_next::Wire::zero_padding(current_level);
3127 }
3128 }
3129
3130 unsafe impl<___D> ::fidl_next::Decode<___D> for StatusWatchPowerLevelResponse
3131 where
3132 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3133 ___D: ::fidl_next::fuchsia::HandleDecoder,
3134 {
3135 fn decode(
3136 slot_: ::fidl_next::Slot<'_, Self>,
3137 decoder_: &mut ___D,
3138 _: (),
3139 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3140 ::fidl_next::munge! {
3141 let Self {
3142 mut current_level,
3143
3144 } = slot_;
3145 }
3146
3147 let _field = current_level.as_mut();
3148
3149 ::fidl_next::Decode::decode(current_level.as_mut(), decoder_, ())?;
3150
3151 Ok(())
3152 }
3153 }
3154
3155 impl ::fidl_next::IntoNatural for StatusWatchPowerLevelResponse {
3156 type Natural = crate::natural::StatusWatchPowerLevelResponse;
3157 }
3158}
3159
3160pub mod wire_optional {
3161
3162 pub use fidl_next_common_fuchsia_power_broker::wire_optional::*;
3163}
3164
3165pub mod generic {
3166
3167 pub use fidl_next_common_fuchsia_power_broker::generic::*;
3168
3169 pub struct ElementControlOpenStatusChannelRequest<T0> {
3171 pub status_channel: T0,
3172 }
3173
3174 unsafe impl<___E, T0>
3175 ::fidl_next::Encode<crate::wire::ElementControlOpenStatusChannelRequest, ___E>
3176 for ElementControlOpenStatusChannelRequest<T0>
3177 where
3178 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3179 ___E: ::fidl_next::fuchsia::HandleEncoder,
3180 T0: ::fidl_next::Encode<
3181 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
3182 ___E,
3183 >,
3184 {
3185 #[inline]
3186 fn encode(
3187 self,
3188 encoder_: &mut ___E,
3189 out_: &mut ::core::mem::MaybeUninit<
3190 crate::wire::ElementControlOpenStatusChannelRequest,
3191 >,
3192 _: (),
3193 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3194 ::fidl_next::munge! {
3195 let crate::wire::ElementControlOpenStatusChannelRequest {
3196 status_channel,
3197
3198 } = out_;
3199 }
3200
3201 ::fidl_next::Encode::encode(self.status_channel, encoder_, status_channel, ())?;
3202
3203 Ok(())
3204 }
3205 }
3206
3207 pub struct ElementControlRegisterDependencyTokenRequest<T0> {
3209 pub token: T0,
3210 }
3211
3212 unsafe impl<___E, T0>
3213 ::fidl_next::Encode<crate::wire::ElementControlRegisterDependencyTokenRequest, ___E>
3214 for ElementControlRegisterDependencyTokenRequest<T0>
3215 where
3216 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3217 ___E: ::fidl_next::fuchsia::HandleEncoder,
3218 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Event, ___E>,
3219 {
3220 #[inline]
3221 fn encode(
3222 self,
3223 encoder_: &mut ___E,
3224 out_: &mut ::core::mem::MaybeUninit<
3225 crate::wire::ElementControlRegisterDependencyTokenRequest,
3226 >,
3227 _: (),
3228 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3229 ::fidl_next::munge! {
3230 let crate::wire::ElementControlRegisterDependencyTokenRequest {
3231 token,
3232
3233 } = out_;
3234 }
3235
3236 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
3237
3238 Ok(())
3239 }
3240 }
3241
3242 pub struct ElementControlUnregisterDependencyTokenRequest<T0> {
3244 pub token: T0,
3245 }
3246
3247 unsafe impl<___E, T0>
3248 ::fidl_next::Encode<crate::wire::ElementControlUnregisterDependencyTokenRequest, ___E>
3249 for ElementControlUnregisterDependencyTokenRequest<T0>
3250 where
3251 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3252 ___E: ::fidl_next::fuchsia::HandleEncoder,
3253 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Event, ___E>,
3254 {
3255 #[inline]
3256 fn encode(
3257 self,
3258 encoder_: &mut ___E,
3259 out_: &mut ::core::mem::MaybeUninit<
3260 crate::wire::ElementControlUnregisterDependencyTokenRequest,
3261 >,
3262 _: (),
3263 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3264 ::fidl_next::munge! {
3265 let crate::wire::ElementControlUnregisterDependencyTokenRequest {
3266 token,
3267
3268 } = out_;
3269 }
3270
3271 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
3272
3273 Ok(())
3274 }
3275 }
3276
3277 pub struct ElementInfoProviderGetElementPowerLevelNamesResponse<T0> {
3279 pub level_names: T0,
3280 }
3281
3282 unsafe impl<___E, T0>
3283 ::fidl_next::Encode<
3284 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
3285 ___E,
3286 > for ElementInfoProviderGetElementPowerLevelNamesResponse<T0>
3287 where
3288 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3289 ___E: ::fidl_next::Encoder,
3290 ___E: ::fidl_next::fuchsia::HandleEncoder,
3291 T0: ::fidl_next::Encode<
3292 ::fidl_next::wire::Vector<'static, crate::wire::ElementPowerLevelNames<'static>>,
3293 ___E,
3294 >,
3295 {
3296 #[inline]
3297 fn encode(
3298 self,
3299 encoder_: &mut ___E,
3300 out_: &mut ::core::mem::MaybeUninit<
3301 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
3302 >,
3303 _: (),
3304 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3305 ::fidl_next::munge! {
3306 let crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse {
3307 level_names,
3308
3309 } = out_;
3310 }
3311
3312 ::fidl_next::Encode::encode(self.level_names, encoder_, level_names, (4294967295, ()))?;
3313
3314 Ok(())
3315 }
3316 }
3317
3318 pub struct ElementInfoProviderGetStatusEndpointsResponse<T0> {
3320 pub endpoints: T0,
3321 }
3322
3323 unsafe impl<___E, T0>
3324 ::fidl_next::Encode<
3325 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
3326 ___E,
3327 > for ElementInfoProviderGetStatusEndpointsResponse<T0>
3328 where
3329 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3330 ___E: ::fidl_next::Encoder,
3331 ___E: ::fidl_next::fuchsia::HandleEncoder,
3332 T0: ::fidl_next::Encode<
3333 ::fidl_next::wire::Vector<'static, crate::wire::ElementStatusEndpoint<'static>>,
3334 ___E,
3335 >,
3336 {
3337 #[inline]
3338 fn encode(
3339 self,
3340 encoder_: &mut ___E,
3341 out_: &mut ::core::mem::MaybeUninit<
3342 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
3343 >,
3344 _: (),
3345 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3346 ::fidl_next::munge! {
3347 let crate::wire::ElementInfoProviderGetStatusEndpointsResponse {
3348 endpoints,
3349
3350 } = out_;
3351 }
3352
3353 ::fidl_next::Encode::encode(self.endpoints, encoder_, endpoints, (4294967295, ()))?;
3354
3355 Ok(())
3356 }
3357 }
3358
3359 pub struct LessorLeaseRequest<T0> {
3361 pub level: T0,
3362 }
3363
3364 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::LessorLeaseRequest, ___E>
3365 for LessorLeaseRequest<T0>
3366 where
3367 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3368 ___E: ::fidl_next::fuchsia::HandleEncoder,
3369 T0: ::fidl_next::Encode<u8, ___E>,
3370 {
3371 #[inline]
3372 fn encode(
3373 self,
3374 encoder_: &mut ___E,
3375 out_: &mut ::core::mem::MaybeUninit<crate::wire::LessorLeaseRequest>,
3376 _: (),
3377 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3378 ::fidl_next::munge! {
3379 let crate::wire::LessorLeaseRequest {
3380 level,
3381
3382 } = out_;
3383 }
3384
3385 ::fidl_next::Encode::encode(self.level, encoder_, level, ())?;
3386
3387 Ok(())
3388 }
3389 }
3390
3391 pub struct LessorLeaseResponse<T0> {
3393 pub lease_control: T0,
3394 }
3395
3396 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::LessorLeaseResponse, ___E>
3397 for LessorLeaseResponse<T0>
3398 where
3399 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3400 ___E: ::fidl_next::fuchsia::HandleEncoder,
3401 T0: ::fidl_next::Encode<
3402 ::fidl_next::ClientEnd<crate::LeaseControl, ::fidl_next::wire::fuchsia::Channel>,
3403 ___E,
3404 >,
3405 {
3406 #[inline]
3407 fn encode(
3408 self,
3409 encoder_: &mut ___E,
3410 out_: &mut ::core::mem::MaybeUninit<crate::wire::LessorLeaseResponse>,
3411 _: (),
3412 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3413 ::fidl_next::munge! {
3414 let crate::wire::LessorLeaseResponse {
3415 lease_control,
3416
3417 } = out_;
3418 }
3419
3420 ::fidl_next::Encode::encode(self.lease_control, encoder_, lease_control, ())?;
3421
3422 Ok(())
3423 }
3424 }
3425
3426 pub struct StatusWatchPowerLevelResponse<T0> {
3428 pub current_level: T0,
3429 }
3430
3431 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::StatusWatchPowerLevelResponse, ___E>
3432 for StatusWatchPowerLevelResponse<T0>
3433 where
3434 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3435 ___E: ::fidl_next::fuchsia::HandleEncoder,
3436 T0: ::fidl_next::Encode<u8, ___E>,
3437 {
3438 #[inline]
3439 fn encode(
3440 self,
3441 encoder_: &mut ___E,
3442 out_: &mut ::core::mem::MaybeUninit<crate::wire::StatusWatchPowerLevelResponse>,
3443 _: (),
3444 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3445 ::fidl_next::munge! {
3446 let crate::wire::StatusWatchPowerLevelResponse {
3447 current_level,
3448
3449 } = out_;
3450 }
3451
3452 ::fidl_next::Encode::encode(self.current_level, encoder_, current_level, ())?;
3453
3454 Ok(())
3455 }
3456 }
3457}
3458
3459pub use self::natural::*;
3460
3461#[doc = " Provides element-scoped access to an element previously added via\n Topology.AddElement.\n"]
3463#[derive(PartialEq, Debug)]
3464pub struct ElementControl;
3465
3466#[cfg(target_os = "fuchsia")]
3467impl ::fidl_next::HasTransport for ElementControl {
3468 type Transport = ::fidl_next::fuchsia::zx::Channel;
3469}
3470
3471pub mod element_control {
3472 pub mod prelude {
3473 pub use crate::{
3474 ElementControl, ElementControlClientHandler, ElementControlLocalClientHandler,
3475 ElementControlLocalServerHandler, ElementControlServerHandler, element_control,
3476 };
3477
3478 pub use crate::natural::ElementControlOpenStatusChannelRequest;
3479
3480 pub use crate::natural::ElementControlRegisterDependencyTokenRequest;
3481
3482 pub use crate::natural::ElementControlUnregisterDependencyTokenRequest;
3483
3484 pub use crate::natural::ElementControlAddDependencyResponse;
3485
3486 pub use crate::natural::ElementControlRegisterDependencyTokenResponse;
3487
3488 pub use crate::natural::ElementControlUnregisterDependencyTokenResponse;
3489
3490 pub use crate::natural::LevelDependency;
3491
3492 pub use crate::natural::ModifyDependencyError;
3493
3494 pub use crate::natural::RegisterDependencyTokenError;
3495
3496 pub use crate::natural::UnregisterDependencyTokenError;
3497 }
3498
3499 pub struct OpenStatusChannel;
3500
3501 impl ::fidl_next::Method for OpenStatusChannel {
3502 const ORDINAL: u64 = 5582056609237590784;
3503 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3504 ::fidl_next::protocol::Flexibility::Flexible;
3505
3506 type Protocol = crate::ElementControl;
3507
3508 type Request = crate::wire::ElementControlOpenStatusChannelRequest;
3509 }
3510
3511 pub struct RegisterDependencyToken;
3512
3513 impl ::fidl_next::Method for RegisterDependencyToken {
3514 const ORDINAL: u64 = 4201883080704232801;
3515 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3516 ::fidl_next::protocol::Flexibility::Flexible;
3517
3518 type Protocol = crate::ElementControl;
3519
3520 type Request = crate::wire::ElementControlRegisterDependencyTokenRequest;
3521 }
3522
3523 impl ::fidl_next::TwoWayMethod for RegisterDependencyToken {
3524 type Response = ::fidl_next::wire::Result<
3525 'static,
3526 crate::wire::ElementControlRegisterDependencyTokenResponse,
3527 crate::wire::RegisterDependencyTokenError,
3528 >;
3529 }
3530
3531 impl<___R> ::fidl_next::Respond<___R> for RegisterDependencyToken {
3532 type Output = ::core::result::Result<___R, ::fidl_next::util::Never>;
3533
3534 fn respond(response: ___R) -> Self::Output {
3535 ::core::result::Result::Ok(response)
3536 }
3537 }
3538
3539 impl<___R> ::fidl_next::RespondErr<___R> for RegisterDependencyToken {
3540 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
3541
3542 fn respond_err(response: ___R) -> Self::Output {
3543 ::core::result::Result::Err(response)
3544 }
3545 }
3546
3547 pub struct UnregisterDependencyToken;
3548
3549 impl ::fidl_next::Method for UnregisterDependencyToken {
3550 const ORDINAL: u64 = 7323726239897326889;
3551 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3552 ::fidl_next::protocol::Flexibility::Flexible;
3553
3554 type Protocol = crate::ElementControl;
3555
3556 type Request = crate::wire::ElementControlUnregisterDependencyTokenRequest;
3557 }
3558
3559 impl ::fidl_next::TwoWayMethod for UnregisterDependencyToken {
3560 type Response = ::fidl_next::wire::Result<
3561 'static,
3562 crate::wire::ElementControlUnregisterDependencyTokenResponse,
3563 crate::wire::UnregisterDependencyTokenError,
3564 >;
3565 }
3566
3567 impl<___R> ::fidl_next::Respond<___R> for UnregisterDependencyToken {
3568 type Output = ::core::result::Result<___R, ::fidl_next::util::Never>;
3569
3570 fn respond(response: ___R) -> Self::Output {
3571 ::core::result::Result::Ok(response)
3572 }
3573 }
3574
3575 impl<___R> ::fidl_next::RespondErr<___R> for UnregisterDependencyToken {
3576 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
3577
3578 fn respond_err(response: ___R) -> Self::Output {
3579 ::core::result::Result::Err(response)
3580 }
3581 }
3582
3583 pub struct AddDependency;
3584
3585 impl ::fidl_next::Method for AddDependency {
3586 const ORDINAL: u64 = 4463546978076627444;
3587 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3588 ::fidl_next::protocol::Flexibility::Flexible;
3589
3590 type Protocol = crate::ElementControl;
3591
3592 type Request = crate::wire::LevelDependency<'static>;
3593 }
3594
3595 impl ::fidl_next::TwoWayMethod for AddDependency {
3596 type Response = ::fidl_next::wire::Result<
3597 'static,
3598 crate::wire::ElementControlAddDependencyResponse,
3599 crate::wire::ModifyDependencyError,
3600 >;
3601 }
3602
3603 impl<___R> ::fidl_next::Respond<___R> for AddDependency {
3604 type Output = ::core::result::Result<___R, ::fidl_next::util::Never>;
3605
3606 fn respond(response: ___R) -> Self::Output {
3607 ::core::result::Result::Ok(response)
3608 }
3609 }
3610
3611 impl<___R> ::fidl_next::RespondErr<___R> for AddDependency {
3612 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
3613
3614 fn respond_err(response: ___R) -> Self::Output {
3615 ::core::result::Result::Err(response)
3616 }
3617 }
3618
3619 mod ___detail {
3620 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ElementControl
3621 where
3622 ___T: ::fidl_next::Transport,
3623 {
3624 type Client = ElementControlClient<___T>;
3625 type Server = ElementControlServer<___T>;
3626 }
3627
3628 #[repr(transparent)]
3630 pub struct ElementControlClient<___T: ::fidl_next::Transport> {
3631 #[allow(dead_code)]
3632 client: ::fidl_next::protocol::Client<___T>,
3633 }
3634
3635 impl<___T> ElementControlClient<___T>
3636 where
3637 ___T: ::fidl_next::Transport,
3638 {
3639 #[doc = " Register a new Status channel on which Power Broker will send\n read-only updates of the element\'s current power level. This method\n is intended to allow element owners to give read-only access to the\n element\'s current power level to clients by opening and transferring\n this channel.\n"]
3640 pub fn open_status_channel(
3641 &self,
3642
3643 status_channel: impl ::fidl_next::Encode<
3644 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
3645 <___T as ::fidl_next::Transport>::SendBuffer,
3646 >,
3647 ) -> ::fidl_next::SendFuture<'_, ___T>
3648 where
3649 <___T as ::fidl_next::Transport>::SendBuffer:
3650 ::fidl_next::encoder::InternalHandleEncoder,
3651 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3652 {
3653 self.open_status_channel_with(
3654 crate::generic::ElementControlOpenStatusChannelRequest { status_channel },
3655 )
3656 }
3657
3658 #[doc = " Register a new Status channel on which Power Broker will send\n read-only updates of the element\'s current power level. This method\n is intended to allow element owners to give read-only access to the\n element\'s current power level to clients by opening and transferring\n this channel.\n"]
3659 pub fn open_status_channel_with<___R>(
3660 &self,
3661 request: ___R,
3662 ) -> ::fidl_next::SendFuture<'_, ___T>
3663 where
3664 ___R: ::fidl_next::Encode<
3665 crate::wire::ElementControlOpenStatusChannelRequest,
3666 <___T as ::fidl_next::Transport>::SendBuffer,
3667 >,
3668 {
3669 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
3670 5582056609237590784,
3671 <super::OpenStatusChannel as ::fidl_next::Method>::FLEXIBILITY,
3672 request,
3673 ))
3674 }
3675
3676 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3677 pub fn register_dependency_token(
3678 &self,
3679
3680 token: impl ::fidl_next::Encode<
3681 ::fidl_next::wire::fuchsia::Event,
3682 <___T as ::fidl_next::Transport>::SendBuffer,
3683 >,
3684 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterDependencyToken, ___T>
3685 where
3686 <___T as ::fidl_next::Transport>::SendBuffer:
3687 ::fidl_next::encoder::InternalHandleEncoder,
3688 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3689 {
3690 self.register_dependency_token_with(
3691 crate::generic::ElementControlRegisterDependencyTokenRequest { token },
3692 )
3693 }
3694
3695 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3696 pub fn register_dependency_token_with<___R>(
3697 &self,
3698 request: ___R,
3699 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterDependencyToken, ___T>
3700 where
3701 ___R: ::fidl_next::Encode<
3702 crate::wire::ElementControlRegisterDependencyTokenRequest,
3703 <___T as ::fidl_next::Transport>::SendBuffer,
3704 >,
3705 {
3706 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3707 4201883080704232801,
3708 <super::RegisterDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3709 request,
3710 ))
3711 }
3712
3713 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3714 pub fn unregister_dependency_token(
3715 &self,
3716
3717 token: impl ::fidl_next::Encode<
3718 ::fidl_next::wire::fuchsia::Event,
3719 <___T as ::fidl_next::Transport>::SendBuffer,
3720 >,
3721 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterDependencyToken, ___T>
3722 where
3723 <___T as ::fidl_next::Transport>::SendBuffer:
3724 ::fidl_next::encoder::InternalHandleEncoder,
3725 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3726 {
3727 self.unregister_dependency_token_with(
3728 crate::generic::ElementControlUnregisterDependencyTokenRequest { token },
3729 )
3730 }
3731
3732 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3733 pub fn unregister_dependency_token_with<___R>(
3734 &self,
3735 request: ___R,
3736 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterDependencyToken, ___T>
3737 where
3738 ___R: ::fidl_next::Encode<
3739 crate::wire::ElementControlUnregisterDependencyTokenRequest,
3740 <___T as ::fidl_next::Transport>::SendBuffer,
3741 >,
3742 {
3743 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3744 7323726239897326889,
3745 <super::UnregisterDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3746 request,
3747 ))
3748 }
3749
3750 #[doc = " Add a new dependency to an existing element.\n If any open leases would incorporate this dependency, the required\n element and any transitively required elements must complete all\n necessary transitions (via ElementRunner.SetLevel calls) before this\n method will return.\n"]
3751 pub fn add_dependency_with<___R>(
3752 &self,
3753 request: ___R,
3754 ) -> ::fidl_next::TwoWayFuture<'_, super::AddDependency, ___T>
3755 where
3756 ___R: ::fidl_next::Encode<
3757 crate::wire::LevelDependency<'static>,
3758 <___T as ::fidl_next::Transport>::SendBuffer,
3759 >,
3760 {
3761 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3762 4463546978076627444,
3763 <super::AddDependency as ::fidl_next::Method>::FLEXIBILITY,
3764 request,
3765 ))
3766 }
3767 }
3768
3769 #[repr(transparent)]
3771 pub struct ElementControlServer<___T: ::fidl_next::Transport> {
3772 server: ::fidl_next::protocol::Server<___T>,
3773 }
3774
3775 impl<___T> ElementControlServer<___T> where ___T: ::fidl_next::Transport {}
3776 }
3777}
3778
3779#[diagnostic::on_unimplemented(
3780 note = "If {Self} implements the non-local ElementControlClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3781)]
3782
3783pub trait ElementControlLocalClientHandler<
3787 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3788 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3789>
3790{
3791 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3792 ::core::future::ready(())
3793 }
3794}
3795
3796impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ElementControl
3797where
3798 ___H: ElementControlLocalClientHandler<___T>,
3799 ___T: ::fidl_next::Transport,
3800{
3801 async fn on_event(
3802 handler: &mut ___H,
3803 mut message: ::fidl_next::Message<___T>,
3804 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3805 match *message.header().ordinal {
3806 ordinal => {
3807 handler.on_unknown_interaction(ordinal).await;
3808 if ::core::matches!(
3809 message.header().flexibility(),
3810 ::fidl_next::protocol::Flexibility::Strict
3811 ) {
3812 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3813 } else {
3814 Ok(())
3815 }
3816 }
3817 }
3818 }
3819}
3820
3821#[diagnostic::on_unimplemented(
3822 note = "If {Self} implements the non-local ElementControlServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3823)]
3824
3825pub trait ElementControlLocalServerHandler<
3829 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3830 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3831>
3832{
3833 #[doc = " Register a new Status channel on which Power Broker will send\n read-only updates of the element\'s current power level. This method\n is intended to allow element owners to give read-only access to the\n element\'s current power level to clients by opening and transferring\n this channel.\n"]
3834 fn open_status_channel(
3835 &mut self,
3836
3837 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
3838 ) -> impl ::core::future::Future<Output = ()>;
3839
3840 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3841 fn register_dependency_token(
3842 &mut self,
3843
3844 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
3845
3846 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
3847 ) -> impl ::core::future::Future<Output = ()>;
3848
3849 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3850 fn unregister_dependency_token(
3851 &mut self,
3852
3853 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
3854
3855 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
3856 ) -> impl ::core::future::Future<Output = ()>;
3857
3858 #[doc = " Add a new dependency to an existing element.\n If any open leases would incorporate this dependency, the required\n element and any transitively required elements must complete all\n necessary transitions (via ElementRunner.SetLevel calls) before this\n method will return.\n"]
3859 fn add_dependency(
3860 &mut self,
3861
3862 request: ::fidl_next::Request<element_control::AddDependency, ___T>,
3863
3864 responder: ::fidl_next::Responder<element_control::AddDependency, ___T>,
3865 ) -> impl ::core::future::Future<Output = ()>;
3866
3867 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3868 ::core::future::ready(())
3869 }
3870}
3871
3872impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ElementControl
3873where
3874 ___H: ElementControlLocalServerHandler<___T>,
3875 ___T: ::fidl_next::Transport,
3876 for<'de> crate::wire::ElementControlOpenStatusChannelRequest: ::fidl_next::Decode<
3877 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3878 Constraint = (),
3879 >,
3880 for<'de> crate::wire::ElementControlRegisterDependencyTokenRequest: ::fidl_next::Decode<
3881 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3882 Constraint = (),
3883 >,
3884 for<'de> crate::wire::ElementControlUnregisterDependencyTokenRequest: ::fidl_next::Decode<
3885 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3886 Constraint = (),
3887 >,
3888 for<'de> crate::wire::LevelDependency<'de>: ::fidl_next::Decode<
3889 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3890 Constraint = (),
3891 >,
3892{
3893 async fn on_one_way(
3894 handler: &mut ___H,
3895 mut message: ::fidl_next::Message<___T>,
3896 ) -> ::core::result::Result<
3897 (),
3898 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3899 > {
3900 match *message.header().ordinal {
3901 5582056609237590784 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
3902 Ok(decoded) => {
3903 handler.open_status_channel(::fidl_next::Request::from_decoded(decoded)).await;
3904 Ok(())
3905 }
3906 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3907 ordinal: 5582056609237590784,
3908 error,
3909 }),
3910 },
3911
3912 ordinal => {
3913 handler.on_unknown_interaction(ordinal).await;
3914 if ::core::matches!(
3915 message.header().flexibility(),
3916 ::fidl_next::protocol::Flexibility::Strict
3917 ) {
3918 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3919 } else {
3920 Ok(())
3921 }
3922 }
3923 }
3924 }
3925
3926 async fn on_two_way(
3927 handler: &mut ___H,
3928 mut message: ::fidl_next::Message<___T>,
3929 responder: ::fidl_next::protocol::Responder<___T>,
3930 ) -> ::core::result::Result<
3931 (),
3932 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3933 > {
3934 match *message.header().ordinal {
3935 4201883080704232801 => {
3936 let responder = ::fidl_next::Responder::from_untyped(responder);
3937
3938 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3939 Ok(decoded) => {
3940 handler
3941 .register_dependency_token(
3942 ::fidl_next::Request::from_decoded(decoded),
3943 responder,
3944 )
3945 .await;
3946 Ok(())
3947 }
3948 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3949 ordinal: 4201883080704232801,
3950 error,
3951 }),
3952 }
3953 }
3954
3955 7323726239897326889 => {
3956 let responder = ::fidl_next::Responder::from_untyped(responder);
3957
3958 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3959 Ok(decoded) => {
3960 handler
3961 .unregister_dependency_token(
3962 ::fidl_next::Request::from_decoded(decoded),
3963 responder,
3964 )
3965 .await;
3966 Ok(())
3967 }
3968 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3969 ordinal: 7323726239897326889,
3970 error,
3971 }),
3972 }
3973 }
3974
3975 4463546978076627444 => {
3976 let responder = ::fidl_next::Responder::from_untyped(responder);
3977
3978 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3979 Ok(decoded) => {
3980 handler
3981 .add_dependency(::fidl_next::Request::from_decoded(decoded), responder)
3982 .await;
3983 Ok(())
3984 }
3985 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3986 ordinal: 4463546978076627444,
3987 error,
3988 }),
3989 }
3990 }
3991
3992 ordinal => {
3993 handler.on_unknown_interaction(ordinal).await;
3994 if ::core::matches!(
3995 message.header().flexibility(),
3996 ::fidl_next::protocol::Flexibility::Strict
3997 ) {
3998 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3999 } else {
4000 responder
4001 .respond_framework_error(
4002 ordinal,
4003 ::fidl_next::FrameworkError::UnknownMethod,
4004 )
4005 .expect("encoding a framework error should never fail")
4006 .await?;
4007 Ok(())
4008 }
4009 }
4010 }
4011 }
4012}
4013
4014pub trait ElementControlClientHandler<
4018 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4019 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4020>
4021{
4022 fn on_unknown_interaction(
4023 &mut self,
4024 ordinal: u64,
4025 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4026 ::core::future::ready(())
4027 }
4028}
4029
4030impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ElementControl
4031where
4032 ___H: ElementControlClientHandler<___T> + ::core::marker::Send,
4033 ___T: ::fidl_next::Transport,
4034{
4035 async fn on_event(
4036 handler: &mut ___H,
4037 mut message: ::fidl_next::Message<___T>,
4038 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4039 match *message.header().ordinal {
4040 ordinal => {
4041 handler.on_unknown_interaction(ordinal).await;
4042 if ::core::matches!(
4043 message.header().flexibility(),
4044 ::fidl_next::protocol::Flexibility::Strict
4045 ) {
4046 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4047 } else {
4048 Ok(())
4049 }
4050 }
4051 }
4052 }
4053}
4054
4055pub trait ElementControlServerHandler<
4059 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4060 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4061>
4062{
4063 #[doc = " Register a new Status channel on which Power Broker will send\n read-only updates of the element\'s current power level. This method\n is intended to allow element owners to give read-only access to the\n element\'s current power level to clients by opening and transferring\n this channel.\n"]
4064 fn open_status_channel(
4065 &mut self,
4066
4067 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
4068 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4069
4070 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
4071 fn register_dependency_token(
4072 &mut self,
4073
4074 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
4075
4076 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
4077 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4078
4079 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
4080 fn unregister_dependency_token(
4081 &mut self,
4082
4083 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
4084
4085 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
4086 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4087
4088 #[doc = " Add a new dependency to an existing element.\n If any open leases would incorporate this dependency, the required\n element and any transitively required elements must complete all\n necessary transitions (via ElementRunner.SetLevel calls) before this\n method will return.\n"]
4089 fn add_dependency(
4090 &mut self,
4091
4092 request: ::fidl_next::Request<element_control::AddDependency, ___T>,
4093
4094 responder: ::fidl_next::Responder<element_control::AddDependency, ___T>,
4095 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4096
4097 fn on_unknown_interaction(
4098 &mut self,
4099 ordinal: u64,
4100 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4101 ::core::future::ready(())
4102 }
4103}
4104
4105impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ElementControl
4106where
4107 ___H: ElementControlServerHandler<___T> + ::core::marker::Send,
4108 ___T: ::fidl_next::Transport,
4109 for<'de> crate::wire::ElementControlOpenStatusChannelRequest: ::fidl_next::Decode<
4110 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4111 Constraint = (),
4112 >,
4113 for<'de> crate::wire::ElementControlRegisterDependencyTokenRequest: ::fidl_next::Decode<
4114 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4115 Constraint = (),
4116 >,
4117 for<'de> crate::wire::ElementControlUnregisterDependencyTokenRequest: ::fidl_next::Decode<
4118 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4119 Constraint = (),
4120 >,
4121 for<'de> crate::wire::LevelDependency<'de>: ::fidl_next::Decode<
4122 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4123 Constraint = (),
4124 >,
4125{
4126 async fn on_one_way(
4127 handler: &mut ___H,
4128 mut message: ::fidl_next::Message<___T>,
4129 ) -> ::core::result::Result<
4130 (),
4131 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4132 > {
4133 match *message.header().ordinal {
4134 5582056609237590784 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
4135 Ok(decoded) => {
4136 handler.open_status_channel(::fidl_next::Request::from_decoded(decoded)).await;
4137 Ok(())
4138 }
4139 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4140 ordinal: 5582056609237590784,
4141 error,
4142 }),
4143 },
4144
4145 ordinal => {
4146 handler.on_unknown_interaction(ordinal).await;
4147 if ::core::matches!(
4148 message.header().flexibility(),
4149 ::fidl_next::protocol::Flexibility::Strict
4150 ) {
4151 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4152 } else {
4153 Ok(())
4154 }
4155 }
4156 }
4157 }
4158
4159 async fn on_two_way(
4160 handler: &mut ___H,
4161 mut message: ::fidl_next::Message<___T>,
4162 responder: ::fidl_next::protocol::Responder<___T>,
4163 ) -> ::core::result::Result<
4164 (),
4165 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4166 > {
4167 match *message.header().ordinal {
4168 4201883080704232801 => {
4169 let responder = ::fidl_next::Responder::from_untyped(responder);
4170
4171 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4172 Ok(decoded) => {
4173 handler
4174 .register_dependency_token(
4175 ::fidl_next::Request::from_decoded(decoded),
4176 responder,
4177 )
4178 .await;
4179 Ok(())
4180 }
4181 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4182 ordinal: 4201883080704232801,
4183 error,
4184 }),
4185 }
4186 }
4187
4188 7323726239897326889 => {
4189 let responder = ::fidl_next::Responder::from_untyped(responder);
4190
4191 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4192 Ok(decoded) => {
4193 handler
4194 .unregister_dependency_token(
4195 ::fidl_next::Request::from_decoded(decoded),
4196 responder,
4197 )
4198 .await;
4199 Ok(())
4200 }
4201 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4202 ordinal: 7323726239897326889,
4203 error,
4204 }),
4205 }
4206 }
4207
4208 4463546978076627444 => {
4209 let responder = ::fidl_next::Responder::from_untyped(responder);
4210
4211 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4212 Ok(decoded) => {
4213 handler
4214 .add_dependency(::fidl_next::Request::from_decoded(decoded), responder)
4215 .await;
4216 Ok(())
4217 }
4218 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4219 ordinal: 4463546978076627444,
4220 error,
4221 }),
4222 }
4223 }
4224
4225 ordinal => {
4226 handler.on_unknown_interaction(ordinal).await;
4227 if ::core::matches!(
4228 message.header().flexibility(),
4229 ::fidl_next::protocol::Flexibility::Strict
4230 ) {
4231 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4232 } else {
4233 responder
4234 .respond_framework_error(
4235 ordinal,
4236 ::fidl_next::FrameworkError::UnknownMethod,
4237 )
4238 .expect("encoding a framework error should never fail")
4239 .await?;
4240 Ok(())
4241 }
4242 }
4243 }
4244 }
4245}
4246
4247impl<___T> ElementControlClientHandler<___T> for ::fidl_next::IgnoreEvents
4248where
4249 ___T: ::fidl_next::Transport,
4250{
4251 async fn on_unknown_interaction(&mut self, _: u64) {}
4252}
4253
4254impl<___H, ___T> ElementControlLocalClientHandler<___T> for ::fidl_next::Local<___H>
4255where
4256 ___H: ElementControlClientHandler<___T>,
4257 ___T: ::fidl_next::Transport,
4258{
4259 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4260 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4261 }
4262}
4263
4264impl<___H, ___T> ElementControlLocalServerHandler<___T> for ::fidl_next::Local<___H>
4265where
4266 ___H: ElementControlServerHandler<___T>,
4267 ___T: ::fidl_next::Transport,
4268{
4269 async fn open_status_channel(
4270 &mut self,
4271
4272 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
4273 ) {
4274 ___H::open_status_channel(&mut self.0, request).await
4275 }
4276
4277 async fn register_dependency_token(
4278 &mut self,
4279
4280 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
4281
4282 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
4283 ) {
4284 ___H::register_dependency_token(&mut self.0, request, responder).await
4285 }
4286
4287 async fn unregister_dependency_token(
4288 &mut self,
4289
4290 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
4291
4292 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
4293 ) {
4294 ___H::unregister_dependency_token(&mut self.0, request, responder).await
4295 }
4296
4297 async fn add_dependency(
4298 &mut self,
4299
4300 request: ::fidl_next::Request<element_control::AddDependency, ___T>,
4301
4302 responder: ::fidl_next::Responder<element_control::AddDependency, ___T>,
4303 ) {
4304 ___H::add_dependency(&mut self.0, request, responder).await
4305 }
4306
4307 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4308 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4309 }
4310}
4311
4312#[doc = " Provides an interface to retrieve information about PowerElements managed by a component.\n"]
4314#[derive(PartialEq, Debug)]
4315pub struct ElementInfoProvider;
4316
4317impl ::fidl_next::Discoverable for ElementInfoProvider {
4318 const PROTOCOL_NAME: &'static str = "fuchsia.power.broker.ElementInfoProvider";
4319}
4320
4321#[cfg(target_os = "fuchsia")]
4322impl ::fidl_next::HasTransport for ElementInfoProvider {
4323 type Transport = ::fidl_next::fuchsia::zx::Channel;
4324}
4325
4326pub mod element_info_provider {
4327 pub mod prelude {
4328 pub use crate::{
4329 ElementInfoProvider, ElementInfoProviderClientHandler,
4330 ElementInfoProviderLocalClientHandler, ElementInfoProviderLocalServerHandler,
4331 ElementInfoProviderServerHandler, element_info_provider,
4332 };
4333
4334 pub use crate::natural::ElementInfoProviderError;
4335
4336 pub use crate::natural::ElementInfoProviderGetElementPowerLevelNamesResponse;
4337
4338 pub use crate::natural::ElementInfoProviderGetStatusEndpointsResponse;
4339 }
4340
4341 pub struct GetElementPowerLevelNames;
4342
4343 impl ::fidl_next::Method for GetElementPowerLevelNames {
4344 const ORDINAL: u64 = 2994721713524698441;
4345 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4346 ::fidl_next::protocol::Flexibility::Flexible;
4347
4348 type Protocol = crate::ElementInfoProvider;
4349
4350 type Request = ::fidl_next::wire::EmptyMessageBody;
4351 }
4352
4353 impl ::fidl_next::TwoWayMethod for GetElementPowerLevelNames {
4354 type Response = ::fidl_next::wire::Result<
4355 'static,
4356 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
4357 crate::wire::ElementInfoProviderError,
4358 >;
4359 }
4360
4361 impl<___R> ::fidl_next::Respond<___R> for GetElementPowerLevelNames {
4362 type Output = ::core::result::Result<
4363 crate::generic::ElementInfoProviderGetElementPowerLevelNamesResponse<___R>,
4364 ::fidl_next::util::Never,
4365 >;
4366
4367 fn respond(response: ___R) -> Self::Output {
4368 ::core::result::Result::Ok(
4369 crate::generic::ElementInfoProviderGetElementPowerLevelNamesResponse {
4370 level_names: response,
4371 },
4372 )
4373 }
4374 }
4375
4376 impl<___R> ::fidl_next::RespondErr<___R> for GetElementPowerLevelNames {
4377 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
4378
4379 fn respond_err(response: ___R) -> Self::Output {
4380 ::core::result::Result::Err(response)
4381 }
4382 }
4383
4384 pub struct GetStatusEndpoints;
4385
4386 impl ::fidl_next::Method for GetStatusEndpoints {
4387 const ORDINAL: u64 = 5003265455430858620;
4388 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4389 ::fidl_next::protocol::Flexibility::Flexible;
4390
4391 type Protocol = crate::ElementInfoProvider;
4392
4393 type Request = ::fidl_next::wire::EmptyMessageBody;
4394 }
4395
4396 impl ::fidl_next::TwoWayMethod for GetStatusEndpoints {
4397 type Response = ::fidl_next::wire::Result<
4398 'static,
4399 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
4400 crate::wire::ElementInfoProviderError,
4401 >;
4402 }
4403
4404 impl<___R> ::fidl_next::Respond<___R> for GetStatusEndpoints {
4405 type Output = ::core::result::Result<
4406 crate::generic::ElementInfoProviderGetStatusEndpointsResponse<___R>,
4407 ::fidl_next::util::Never,
4408 >;
4409
4410 fn respond(response: ___R) -> Self::Output {
4411 ::core::result::Result::Ok(
4412 crate::generic::ElementInfoProviderGetStatusEndpointsResponse {
4413 endpoints: response,
4414 },
4415 )
4416 }
4417 }
4418
4419 impl<___R> ::fidl_next::RespondErr<___R> for GetStatusEndpoints {
4420 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
4421
4422 fn respond_err(response: ___R) -> Self::Output {
4423 ::core::result::Result::Err(response)
4424 }
4425 }
4426
4427 mod ___detail {
4428 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ElementInfoProvider
4429 where
4430 ___T: ::fidl_next::Transport,
4431 {
4432 type Client = ElementInfoProviderClient<___T>;
4433 type Server = ElementInfoProviderServer<___T>;
4434 }
4435
4436 #[repr(transparent)]
4438 pub struct ElementInfoProviderClient<___T: ::fidl_next::Transport> {
4439 #[allow(dead_code)]
4440 client: ::fidl_next::protocol::Client<___T>,
4441 }
4442
4443 impl<___T> ElementInfoProviderClient<___T>
4444 where
4445 ___T: ::fidl_next::Transport,
4446 {
4447 #[doc = " Returns mappings of PowerLevels to plaintext names for each element managed\n by a component. Returns an error if no mappings can be returned.\n"]
4448 pub fn get_element_power_level_names(
4449 &self,
4450 ) -> ::fidl_next::TwoWayFuture<'_, super::GetElementPowerLevelNames, ___T> {
4451 ::fidl_next::TwoWayFuture::from_untyped(
4452 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4453 2994721713524698441,
4454 <super::GetElementPowerLevelNames as ::fidl_next::Method>::FLEXIBILITY,
4455 (),
4456 ),
4457 )
4458 }
4459
4460 #[doc = " Returns available Status client endpoints and stable identifiers for each\n element managed by a component. Returns an error if no endpoints can be\n returned (i.e. no elements were able to implement the Status channel).\n"]
4461 pub fn get_status_endpoints(
4462 &self,
4463 ) -> ::fidl_next::TwoWayFuture<'_, super::GetStatusEndpoints, ___T> {
4464 ::fidl_next::TwoWayFuture::from_untyped(
4465 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4466 5003265455430858620,
4467 <super::GetStatusEndpoints as ::fidl_next::Method>::FLEXIBILITY,
4468 (),
4469 ),
4470 )
4471 }
4472 }
4473
4474 #[repr(transparent)]
4476 pub struct ElementInfoProviderServer<___T: ::fidl_next::Transport> {
4477 server: ::fidl_next::protocol::Server<___T>,
4478 }
4479
4480 impl<___T> ElementInfoProviderServer<___T> where ___T: ::fidl_next::Transport {}
4481 }
4482}
4483
4484#[diagnostic::on_unimplemented(
4485 note = "If {Self} implements the non-local ElementInfoProviderClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4486)]
4487
4488pub trait ElementInfoProviderLocalClientHandler<
4492 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4493 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4494>
4495{
4496 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4497 ::core::future::ready(())
4498 }
4499}
4500
4501impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ElementInfoProvider
4502where
4503 ___H: ElementInfoProviderLocalClientHandler<___T>,
4504 ___T: ::fidl_next::Transport,
4505{
4506 async fn on_event(
4507 handler: &mut ___H,
4508 mut message: ::fidl_next::Message<___T>,
4509 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4510 match *message.header().ordinal {
4511 ordinal => {
4512 handler.on_unknown_interaction(ordinal).await;
4513 if ::core::matches!(
4514 message.header().flexibility(),
4515 ::fidl_next::protocol::Flexibility::Strict
4516 ) {
4517 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4518 } else {
4519 Ok(())
4520 }
4521 }
4522 }
4523 }
4524}
4525
4526#[diagnostic::on_unimplemented(
4527 note = "If {Self} implements the non-local ElementInfoProviderServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4528)]
4529
4530pub trait ElementInfoProviderLocalServerHandler<
4534 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4535 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4536>
4537{
4538 #[doc = " Returns mappings of PowerLevels to plaintext names for each element managed\n by a component. Returns an error if no mappings can be returned.\n"]
4539 fn get_element_power_level_names(
4540 &mut self,
4541
4542 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4543 ) -> impl ::core::future::Future<Output = ()>;
4544
4545 #[doc = " Returns available Status client endpoints and stable identifiers for each\n element managed by a component. Returns an error if no endpoints can be\n returned (i.e. no elements were able to implement the Status channel).\n"]
4546 fn get_status_endpoints(
4547 &mut self,
4548
4549 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4550 ) -> impl ::core::future::Future<Output = ()>;
4551
4552 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4553 ::core::future::ready(())
4554 }
4555}
4556
4557impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ElementInfoProvider
4558where
4559 ___H: ElementInfoProviderLocalServerHandler<___T>,
4560 ___T: ::fidl_next::Transport,
4561{
4562 async fn on_one_way(
4563 handler: &mut ___H,
4564 mut message: ::fidl_next::Message<___T>,
4565 ) -> ::core::result::Result<
4566 (),
4567 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4568 > {
4569 match *message.header().ordinal {
4570 ordinal => {
4571 handler.on_unknown_interaction(ordinal).await;
4572 if ::core::matches!(
4573 message.header().flexibility(),
4574 ::fidl_next::protocol::Flexibility::Strict
4575 ) {
4576 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4577 } else {
4578 Ok(())
4579 }
4580 }
4581 }
4582 }
4583
4584 async fn on_two_way(
4585 handler: &mut ___H,
4586 mut message: ::fidl_next::Message<___T>,
4587 responder: ::fidl_next::protocol::Responder<___T>,
4588 ) -> ::core::result::Result<
4589 (),
4590 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4591 > {
4592 match *message.header().ordinal {
4593 2994721713524698441 => {
4594 let responder = ::fidl_next::Responder::from_untyped(responder);
4595
4596 handler.get_element_power_level_names(responder).await;
4597 Ok(())
4598 }
4599
4600 5003265455430858620 => {
4601 let responder = ::fidl_next::Responder::from_untyped(responder);
4602
4603 handler.get_status_endpoints(responder).await;
4604 Ok(())
4605 }
4606
4607 ordinal => {
4608 handler.on_unknown_interaction(ordinal).await;
4609 if ::core::matches!(
4610 message.header().flexibility(),
4611 ::fidl_next::protocol::Flexibility::Strict
4612 ) {
4613 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4614 } else {
4615 responder
4616 .respond_framework_error(
4617 ordinal,
4618 ::fidl_next::FrameworkError::UnknownMethod,
4619 )
4620 .expect("encoding a framework error should never fail")
4621 .await?;
4622 Ok(())
4623 }
4624 }
4625 }
4626 }
4627}
4628
4629pub trait ElementInfoProviderClientHandler<
4633 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4634 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4635>
4636{
4637 fn on_unknown_interaction(
4638 &mut self,
4639 ordinal: u64,
4640 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4641 ::core::future::ready(())
4642 }
4643}
4644
4645impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ElementInfoProvider
4646where
4647 ___H: ElementInfoProviderClientHandler<___T> + ::core::marker::Send,
4648 ___T: ::fidl_next::Transport,
4649{
4650 async fn on_event(
4651 handler: &mut ___H,
4652 mut message: ::fidl_next::Message<___T>,
4653 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4654 match *message.header().ordinal {
4655 ordinal => {
4656 handler.on_unknown_interaction(ordinal).await;
4657 if ::core::matches!(
4658 message.header().flexibility(),
4659 ::fidl_next::protocol::Flexibility::Strict
4660 ) {
4661 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4662 } else {
4663 Ok(())
4664 }
4665 }
4666 }
4667 }
4668}
4669
4670pub trait ElementInfoProviderServerHandler<
4674 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4675 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4676>
4677{
4678 #[doc = " Returns mappings of PowerLevels to plaintext names for each element managed\n by a component. Returns an error if no mappings can be returned.\n"]
4679 fn get_element_power_level_names(
4680 &mut self,
4681
4682 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4683 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4684
4685 #[doc = " Returns available Status client endpoints and stable identifiers for each\n element managed by a component. Returns an error if no endpoints can be\n returned (i.e. no elements were able to implement the Status channel).\n"]
4686 fn get_status_endpoints(
4687 &mut self,
4688
4689 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4690 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4691
4692 fn on_unknown_interaction(
4693 &mut self,
4694 ordinal: u64,
4695 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4696 ::core::future::ready(())
4697 }
4698}
4699
4700impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ElementInfoProvider
4701where
4702 ___H: ElementInfoProviderServerHandler<___T> + ::core::marker::Send,
4703 ___T: ::fidl_next::Transport,
4704{
4705 async fn on_one_way(
4706 handler: &mut ___H,
4707 mut message: ::fidl_next::Message<___T>,
4708 ) -> ::core::result::Result<
4709 (),
4710 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4711 > {
4712 match *message.header().ordinal {
4713 ordinal => {
4714 handler.on_unknown_interaction(ordinal).await;
4715 if ::core::matches!(
4716 message.header().flexibility(),
4717 ::fidl_next::protocol::Flexibility::Strict
4718 ) {
4719 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4720 } else {
4721 Ok(())
4722 }
4723 }
4724 }
4725 }
4726
4727 async fn on_two_way(
4728 handler: &mut ___H,
4729 mut message: ::fidl_next::Message<___T>,
4730 responder: ::fidl_next::protocol::Responder<___T>,
4731 ) -> ::core::result::Result<
4732 (),
4733 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4734 > {
4735 match *message.header().ordinal {
4736 2994721713524698441 => {
4737 let responder = ::fidl_next::Responder::from_untyped(responder);
4738
4739 handler.get_element_power_level_names(responder).await;
4740 Ok(())
4741 }
4742
4743 5003265455430858620 => {
4744 let responder = ::fidl_next::Responder::from_untyped(responder);
4745
4746 handler.get_status_endpoints(responder).await;
4747 Ok(())
4748 }
4749
4750 ordinal => {
4751 handler.on_unknown_interaction(ordinal).await;
4752 if ::core::matches!(
4753 message.header().flexibility(),
4754 ::fidl_next::protocol::Flexibility::Strict
4755 ) {
4756 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4757 } else {
4758 responder
4759 .respond_framework_error(
4760 ordinal,
4761 ::fidl_next::FrameworkError::UnknownMethod,
4762 )
4763 .expect("encoding a framework error should never fail")
4764 .await?;
4765 Ok(())
4766 }
4767 }
4768 }
4769 }
4770}
4771
4772impl<___T> ElementInfoProviderClientHandler<___T> for ::fidl_next::IgnoreEvents
4773where
4774 ___T: ::fidl_next::Transport,
4775{
4776 async fn on_unknown_interaction(&mut self, _: u64) {}
4777}
4778
4779impl<___H, ___T> ElementInfoProviderLocalClientHandler<___T> for ::fidl_next::Local<___H>
4780where
4781 ___H: ElementInfoProviderClientHandler<___T>,
4782 ___T: ::fidl_next::Transport,
4783{
4784 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4785 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4786 }
4787}
4788
4789impl<___H, ___T> ElementInfoProviderLocalServerHandler<___T> for ::fidl_next::Local<___H>
4790where
4791 ___H: ElementInfoProviderServerHandler<___T>,
4792 ___T: ::fidl_next::Transport,
4793{
4794 async fn get_element_power_level_names(
4795 &mut self,
4796
4797 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4798 ) {
4799 ___H::get_element_power_level_names(&mut self.0, responder).await
4800 }
4801
4802 async fn get_status_endpoints(
4803 &mut self,
4804
4805 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4806 ) {
4807 ___H::get_status_endpoints(&mut self.0, responder).await
4808 }
4809
4810 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4811 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4812 }
4813}
4814
4815#[derive(Debug)]
4817pub struct ElementInfoProviderService;
4818
4819impl ::fidl_next::DiscoverableService for ElementInfoProviderService {
4820 const SERVICE_NAME: &'static str = "fuchsia.power.broker.ElementInfoProviderService";
4821 const MEMBER_NAMES: &'static [&'static str] = &["status_provider"];
4822}
4823
4824impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel>
4825 for ElementInfoProviderService
4826{
4827}
4828
4829impl<___C> ::fidl_next::Service<___C> for ElementInfoProviderService
4830where
4831 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
4832{
4833 type Connector = ElementInfoProviderServiceConnector<___C>;
4834}
4835
4836#[repr(transparent)]
4838pub struct ElementInfoProviderServiceConnector<___C> {
4839 #[allow(dead_code)]
4840 connector: ___C,
4841}
4842
4843impl<___C> ElementInfoProviderServiceConnector<___C>
4844where
4845 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
4846{
4847 pub fn status_provider(
4849 &self,
4850 server_end: ::fidl_next::ServerEnd<
4851 crate::ElementInfoProvider,
4852 ::fidl_next::fuchsia::zx::Channel,
4853 >,
4854 ) -> ::core::result::Result<
4855 (),
4856 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
4857 > {
4858 ::fidl_next::protocol::ServiceConnector::<
4859 ::fidl_next::fuchsia::zx::Channel
4860 >::connect_to_member(
4861 &self.connector,
4862 "status_provider",
4863 server_end.into_untyped(),
4864 )
4865 }
4866}
4867
4868pub trait ElementInfoProviderServiceHandler {
4870 fn status_provider(
4872 &self,
4873 server_end: ::fidl_next::ServerEnd<
4874 crate::ElementInfoProvider,
4875 ::fidl_next::fuchsia::zx::Channel,
4876 >,
4877 );
4878}
4879
4880impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for ElementInfoProviderService
4881where
4882 ___H: ElementInfoProviderServiceHandler,
4883 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
4884{
4885 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
4886 use ::fidl_next::InstanceFromServiceTransport;
4887 match member {
4888 "status_provider" => handler.status_provider(::fidl_next::ServerEnd::from_untyped(
4889 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
4890 )),
4891
4892 _ => unreachable!(),
4893 }
4894 }
4895}
4896
4897#[doc = " DEPRECATED. Use `Topology.Lease` instead.\n Provides element-scoped access to request leases to raise the levels of an\n element previously added via Topology.AddElement.\n"]
4899#[derive(PartialEq, Debug)]
4900pub struct Lessor;
4901
4902#[cfg(target_os = "fuchsia")]
4903impl ::fidl_next::HasTransport for Lessor {
4904 type Transport = ::fidl_next::fuchsia::zx::Channel;
4905}
4906
4907pub mod lessor {
4908 pub mod prelude {
4909 pub use crate::{
4910 Lessor, LessorClientHandler, LessorLocalClientHandler, LessorLocalServerHandler,
4911 LessorServerHandler, lessor,
4912 };
4913
4914 pub use crate::natural::LeaseError;
4915
4916 pub use crate::natural::LessorLeaseRequest;
4917
4918 pub use crate::natural::LessorLeaseResponse;
4919 }
4920
4921 pub struct Lease;
4922
4923 impl ::fidl_next::Method for Lease {
4924 const ORDINAL: u64 = 4078466329847396781;
4925 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4926 ::fidl_next::protocol::Flexibility::Flexible;
4927
4928 type Protocol = crate::Lessor;
4929
4930 type Request = crate::wire::LessorLeaseRequest;
4931 }
4932
4933 impl ::fidl_next::TwoWayMethod for Lease {
4934 type Response = ::fidl_next::wire::Result<
4935 'static,
4936 crate::wire::LessorLeaseResponse,
4937 crate::wire::LeaseError,
4938 >;
4939 }
4940
4941 impl<___R> ::fidl_next::Respond<___R> for Lease {
4942 type Output = ::core::result::Result<
4943 crate::generic::LessorLeaseResponse<___R>,
4944 ::fidl_next::util::Never,
4945 >;
4946
4947 fn respond(response: ___R) -> Self::Output {
4948 ::core::result::Result::Ok(crate::generic::LessorLeaseResponse {
4949 lease_control: response,
4950 })
4951 }
4952 }
4953
4954 impl<___R> ::fidl_next::RespondErr<___R> for Lease {
4955 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
4956
4957 fn respond_err(response: ___R) -> Self::Output {
4958 ::core::result::Result::Err(response)
4959 }
4960 }
4961
4962 mod ___detail {
4963 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Lessor
4964 where
4965 ___T: ::fidl_next::Transport,
4966 {
4967 type Client = LessorClient<___T>;
4968 type Server = LessorServer<___T>;
4969 }
4970
4971 #[repr(transparent)]
4973 pub struct LessorClient<___T: ::fidl_next::Transport> {
4974 #[allow(dead_code)]
4975 client: ::fidl_next::protocol::Client<___T>,
4976 }
4977
4978 impl<___T> LessorClient<___T>
4979 where
4980 ___T: ::fidl_next::Transport,
4981 {
4982 #[doc = " Request made to indicate the client wants the element raised to the given\n level. When the call returns, this **does** **not** mean the\n corresponding element is at the requested level, only that the requested\n level is valid and request is being worked on.\n\n Fulfilling the request will raise the level of all the level\'s direct\n and transitive power dependencies to their required levels. When\n `LeaseControl.WatchStatus` reports `LeaseStatus::SATISFIED` this means\n given element is at the level specified by the lease.\n\n Requesting an invalid level returns `LeaseError::INVALID_LEVEL`.\n"]
4983 pub fn lease(
4984 &self,
4985
4986 level: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
4987 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
4988 where
4989 <___T as ::fidl_next::Transport>::SendBuffer:
4990 ::fidl_next::encoder::InternalHandleEncoder,
4991 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
4992 {
4993 self.lease_with(crate::generic::LessorLeaseRequest { level })
4994 }
4995
4996 #[doc = " Request made to indicate the client wants the element raised to the given\n level. When the call returns, this **does** **not** mean the\n corresponding element is at the requested level, only that the requested\n level is valid and request is being worked on.\n\n Fulfilling the request will raise the level of all the level\'s direct\n and transitive power dependencies to their required levels. When\n `LeaseControl.WatchStatus` reports `LeaseStatus::SATISFIED` this means\n given element is at the level specified by the lease.\n\n Requesting an invalid level returns `LeaseError::INVALID_LEVEL`.\n"]
4997 pub fn lease_with<___R>(
4998 &self,
4999 request: ___R,
5000 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
5001 where
5002 ___R: ::fidl_next::Encode<
5003 crate::wire::LessorLeaseRequest,
5004 <___T as ::fidl_next::Transport>::SendBuffer,
5005 >,
5006 {
5007 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5008 4078466329847396781,
5009 <super::Lease as ::fidl_next::Method>::FLEXIBILITY,
5010 request,
5011 ))
5012 }
5013 }
5014
5015 #[repr(transparent)]
5017 pub struct LessorServer<___T: ::fidl_next::Transport> {
5018 server: ::fidl_next::protocol::Server<___T>,
5019 }
5020
5021 impl<___T> LessorServer<___T> where ___T: ::fidl_next::Transport {}
5022 }
5023}
5024
5025#[diagnostic::on_unimplemented(
5026 note = "If {Self} implements the non-local LessorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5027)]
5028
5029pub trait LessorLocalClientHandler<
5033 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5034 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5035>
5036{
5037 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5038 ::core::future::ready(())
5039 }
5040}
5041
5042impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Lessor
5043where
5044 ___H: LessorLocalClientHandler<___T>,
5045 ___T: ::fidl_next::Transport,
5046{
5047 async fn on_event(
5048 handler: &mut ___H,
5049 mut message: ::fidl_next::Message<___T>,
5050 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5051 match *message.header().ordinal {
5052 ordinal => {
5053 handler.on_unknown_interaction(ordinal).await;
5054 if ::core::matches!(
5055 message.header().flexibility(),
5056 ::fidl_next::protocol::Flexibility::Strict
5057 ) {
5058 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5059 } else {
5060 Ok(())
5061 }
5062 }
5063 }
5064 }
5065}
5066
5067#[diagnostic::on_unimplemented(
5068 note = "If {Self} implements the non-local LessorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5069)]
5070
5071pub trait LessorLocalServerHandler<
5075 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5076 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5077>
5078{
5079 #[doc = " Request made to indicate the client wants the element raised to the given\n level. When the call returns, this **does** **not** mean the\n corresponding element is at the requested level, only that the requested\n level is valid and request is being worked on.\n\n Fulfilling the request will raise the level of all the level\'s direct\n and transitive power dependencies to their required levels. When\n `LeaseControl.WatchStatus` reports `LeaseStatus::SATISFIED` this means\n given element is at the level specified by the lease.\n\n Requesting an invalid level returns `LeaseError::INVALID_LEVEL`.\n"]
5080 fn lease(
5081 &mut self,
5082
5083 request: ::fidl_next::Request<lessor::Lease, ___T>,
5084
5085 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
5086 ) -> impl ::core::future::Future<Output = ()>;
5087
5088 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5089 ::core::future::ready(())
5090 }
5091}
5092
5093impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Lessor
5094where
5095 ___H: LessorLocalServerHandler<___T>,
5096 ___T: ::fidl_next::Transport,
5097 for<'de> crate::wire::LessorLeaseRequest: ::fidl_next::Decode<
5098 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5099 Constraint = (),
5100 >,
5101{
5102 async fn on_one_way(
5103 handler: &mut ___H,
5104 mut message: ::fidl_next::Message<___T>,
5105 ) -> ::core::result::Result<
5106 (),
5107 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5108 > {
5109 match *message.header().ordinal {
5110 ordinal => {
5111 handler.on_unknown_interaction(ordinal).await;
5112 if ::core::matches!(
5113 message.header().flexibility(),
5114 ::fidl_next::protocol::Flexibility::Strict
5115 ) {
5116 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5117 } else {
5118 Ok(())
5119 }
5120 }
5121 }
5122 }
5123
5124 async fn on_two_way(
5125 handler: &mut ___H,
5126 mut message: ::fidl_next::Message<___T>,
5127 responder: ::fidl_next::protocol::Responder<___T>,
5128 ) -> ::core::result::Result<
5129 (),
5130 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5131 > {
5132 match *message.header().ordinal {
5133 4078466329847396781 => {
5134 let responder = ::fidl_next::Responder::from_untyped(responder);
5135
5136 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5137 Ok(decoded) => {
5138 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
5139 Ok(())
5140 }
5141 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5142 ordinal: 4078466329847396781,
5143 error,
5144 }),
5145 }
5146 }
5147
5148 ordinal => {
5149 handler.on_unknown_interaction(ordinal).await;
5150 if ::core::matches!(
5151 message.header().flexibility(),
5152 ::fidl_next::protocol::Flexibility::Strict
5153 ) {
5154 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5155 } else {
5156 responder
5157 .respond_framework_error(
5158 ordinal,
5159 ::fidl_next::FrameworkError::UnknownMethod,
5160 )
5161 .expect("encoding a framework error should never fail")
5162 .await?;
5163 Ok(())
5164 }
5165 }
5166 }
5167 }
5168}
5169
5170pub trait LessorClientHandler<
5174 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5175 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5176>
5177{
5178 fn on_unknown_interaction(
5179 &mut self,
5180 ordinal: u64,
5181 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5182 ::core::future::ready(())
5183 }
5184}
5185
5186impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Lessor
5187where
5188 ___H: LessorClientHandler<___T> + ::core::marker::Send,
5189 ___T: ::fidl_next::Transport,
5190{
5191 async fn on_event(
5192 handler: &mut ___H,
5193 mut message: ::fidl_next::Message<___T>,
5194 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5195 match *message.header().ordinal {
5196 ordinal => {
5197 handler.on_unknown_interaction(ordinal).await;
5198 if ::core::matches!(
5199 message.header().flexibility(),
5200 ::fidl_next::protocol::Flexibility::Strict
5201 ) {
5202 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5203 } else {
5204 Ok(())
5205 }
5206 }
5207 }
5208 }
5209}
5210
5211pub trait LessorServerHandler<
5215 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5216 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5217>
5218{
5219 #[doc = " Request made to indicate the client wants the element raised to the given\n level. When the call returns, this **does** **not** mean the\n corresponding element is at the requested level, only that the requested\n level is valid and request is being worked on.\n\n Fulfilling the request will raise the level of all the level\'s direct\n and transitive power dependencies to their required levels. When\n `LeaseControl.WatchStatus` reports `LeaseStatus::SATISFIED` this means\n given element is at the level specified by the lease.\n\n Requesting an invalid level returns `LeaseError::INVALID_LEVEL`.\n"]
5220 fn lease(
5221 &mut self,
5222
5223 request: ::fidl_next::Request<lessor::Lease, ___T>,
5224
5225 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
5226 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5227
5228 fn on_unknown_interaction(
5229 &mut self,
5230 ordinal: u64,
5231 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5232 ::core::future::ready(())
5233 }
5234}
5235
5236impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Lessor
5237where
5238 ___H: LessorServerHandler<___T> + ::core::marker::Send,
5239 ___T: ::fidl_next::Transport,
5240 for<'de> crate::wire::LessorLeaseRequest: ::fidl_next::Decode<
5241 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5242 Constraint = (),
5243 >,
5244{
5245 async fn on_one_way(
5246 handler: &mut ___H,
5247 mut message: ::fidl_next::Message<___T>,
5248 ) -> ::core::result::Result<
5249 (),
5250 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5251 > {
5252 match *message.header().ordinal {
5253 ordinal => {
5254 handler.on_unknown_interaction(ordinal).await;
5255 if ::core::matches!(
5256 message.header().flexibility(),
5257 ::fidl_next::protocol::Flexibility::Strict
5258 ) {
5259 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5260 } else {
5261 Ok(())
5262 }
5263 }
5264 }
5265 }
5266
5267 async fn on_two_way(
5268 handler: &mut ___H,
5269 mut message: ::fidl_next::Message<___T>,
5270 responder: ::fidl_next::protocol::Responder<___T>,
5271 ) -> ::core::result::Result<
5272 (),
5273 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5274 > {
5275 match *message.header().ordinal {
5276 4078466329847396781 => {
5277 let responder = ::fidl_next::Responder::from_untyped(responder);
5278
5279 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5280 Ok(decoded) => {
5281 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
5282 Ok(())
5283 }
5284 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5285 ordinal: 4078466329847396781,
5286 error,
5287 }),
5288 }
5289 }
5290
5291 ordinal => {
5292 handler.on_unknown_interaction(ordinal).await;
5293 if ::core::matches!(
5294 message.header().flexibility(),
5295 ::fidl_next::protocol::Flexibility::Strict
5296 ) {
5297 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5298 } else {
5299 responder
5300 .respond_framework_error(
5301 ordinal,
5302 ::fidl_next::FrameworkError::UnknownMethod,
5303 )
5304 .expect("encoding a framework error should never fail")
5305 .await?;
5306 Ok(())
5307 }
5308 }
5309 }
5310 }
5311}
5312
5313impl<___T> LessorClientHandler<___T> for ::fidl_next::IgnoreEvents
5314where
5315 ___T: ::fidl_next::Transport,
5316{
5317 async fn on_unknown_interaction(&mut self, _: u64) {}
5318}
5319
5320impl<___H, ___T> LessorLocalClientHandler<___T> for ::fidl_next::Local<___H>
5321where
5322 ___H: LessorClientHandler<___T>,
5323 ___T: ::fidl_next::Transport,
5324{
5325 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5326 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5327 }
5328}
5329
5330impl<___H, ___T> LessorLocalServerHandler<___T> for ::fidl_next::Local<___H>
5331where
5332 ___H: LessorServerHandler<___T>,
5333 ___T: ::fidl_next::Transport,
5334{
5335 async fn lease(
5336 &mut self,
5337
5338 request: ::fidl_next::Request<lessor::Lease, ___T>,
5339
5340 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
5341 ) {
5342 ___H::lease(&mut self.0, request, responder).await
5343 }
5344
5345 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5346 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5347 }
5348}
5349
5350#[doc = " Provides read-only access to the current PowerLevel of an element and the\n ability to watch changes to an element\'s power level. A new channel to\n this protocol can be obtained by calling OpenStatus on the element\'s\n ElementControl channel (and passed to other clients who need access\n to the element\'s current power level).\n"]
5352#[derive(PartialEq, Debug)]
5353pub struct Status;
5354
5355#[cfg(target_os = "fuchsia")]
5356impl ::fidl_next::HasTransport for Status {
5357 type Transport = ::fidl_next::fuchsia::zx::Channel;
5358}
5359
5360pub mod status {
5361 pub mod prelude {
5362 pub use crate::{
5363 Status, StatusClientHandler, StatusLocalClientHandler, StatusLocalServerHandler,
5364 StatusServerHandler, status,
5365 };
5366
5367 pub use crate::natural::StatusError;
5368
5369 pub use crate::natural::StatusWatchPowerLevelResponse;
5370 }
5371
5372 pub struct WatchPowerLevel;
5373
5374 impl ::fidl_next::Method for WatchPowerLevel {
5375 const ORDINAL: u64 = 3391697113329262926;
5376 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5377 ::fidl_next::protocol::Flexibility::Flexible;
5378
5379 type Protocol = crate::Status;
5380
5381 type Request = ::fidl_next::wire::EmptyMessageBody;
5382 }
5383
5384 impl ::fidl_next::TwoWayMethod for WatchPowerLevel {
5385 type Response = ::fidl_next::wire::Result<
5386 'static,
5387 crate::wire::StatusWatchPowerLevelResponse,
5388 crate::wire::StatusError,
5389 >;
5390 }
5391
5392 impl<___R> ::fidl_next::Respond<___R> for WatchPowerLevel {
5393 type Output = ::core::result::Result<
5394 crate::generic::StatusWatchPowerLevelResponse<___R>,
5395 ::fidl_next::util::Never,
5396 >;
5397
5398 fn respond(response: ___R) -> Self::Output {
5399 ::core::result::Result::Ok(crate::generic::StatusWatchPowerLevelResponse {
5400 current_level: response,
5401 })
5402 }
5403 }
5404
5405 impl<___R> ::fidl_next::RespondErr<___R> for WatchPowerLevel {
5406 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
5407
5408 fn respond_err(response: ___R) -> Self::Output {
5409 ::core::result::Result::Err(response)
5410 }
5411 }
5412
5413 mod ___detail {
5414 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Status
5415 where
5416 ___T: ::fidl_next::Transport,
5417 {
5418 type Client = StatusClient<___T>;
5419 type Server = StatusServer<___T>;
5420 }
5421
5422 #[repr(transparent)]
5424 pub struct StatusClient<___T: ::fidl_next::Transport> {
5425 #[allow(dead_code)]
5426 client: ::fidl_next::protocol::Client<___T>,
5427 }
5428
5429 impl<___T> StatusClient<___T>
5430 where
5431 ___T: ::fidl_next::Transport,
5432 {
5433 #[doc = " Returns the current power level for this element. The first call on\n this channel will return immediately. Subsequent calls will block until\n the current power level has changed.\n"]
5434 pub fn watch_power_level(
5435 &self,
5436 ) -> ::fidl_next::TwoWayFuture<'_, super::WatchPowerLevel, ___T> {
5437 ::fidl_next::TwoWayFuture::from_untyped(
5438 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
5439 3391697113329262926,
5440 <super::WatchPowerLevel as ::fidl_next::Method>::FLEXIBILITY,
5441 (),
5442 ),
5443 )
5444 }
5445 }
5446
5447 #[repr(transparent)]
5449 pub struct StatusServer<___T: ::fidl_next::Transport> {
5450 server: ::fidl_next::protocol::Server<___T>,
5451 }
5452
5453 impl<___T> StatusServer<___T> where ___T: ::fidl_next::Transport {}
5454 }
5455}
5456
5457#[diagnostic::on_unimplemented(
5458 note = "If {Self} implements the non-local StatusClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5459)]
5460
5461pub trait StatusLocalClientHandler<
5465 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5466 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5467>
5468{
5469 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5470 ::core::future::ready(())
5471 }
5472}
5473
5474impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Status
5475where
5476 ___H: StatusLocalClientHandler<___T>,
5477 ___T: ::fidl_next::Transport,
5478{
5479 async fn on_event(
5480 handler: &mut ___H,
5481 mut message: ::fidl_next::Message<___T>,
5482 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5483 match *message.header().ordinal {
5484 ordinal => {
5485 handler.on_unknown_interaction(ordinal).await;
5486 if ::core::matches!(
5487 message.header().flexibility(),
5488 ::fidl_next::protocol::Flexibility::Strict
5489 ) {
5490 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5491 } else {
5492 Ok(())
5493 }
5494 }
5495 }
5496 }
5497}
5498
5499#[diagnostic::on_unimplemented(
5500 note = "If {Self} implements the non-local StatusServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5501)]
5502
5503pub trait StatusLocalServerHandler<
5507 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5508 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5509>
5510{
5511 #[doc = " Returns the current power level for this element. The first call on\n this channel will return immediately. Subsequent calls will block until\n the current power level has changed.\n"]
5512 fn watch_power_level(
5513 &mut self,
5514
5515 responder: ::fidl_next::Responder<status::WatchPowerLevel, ___T>,
5516 ) -> impl ::core::future::Future<Output = ()>;
5517
5518 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5519 ::core::future::ready(())
5520 }
5521}
5522
5523impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Status
5524where
5525 ___H: StatusLocalServerHandler<___T>,
5526 ___T: ::fidl_next::Transport,
5527{
5528 async fn on_one_way(
5529 handler: &mut ___H,
5530 mut message: ::fidl_next::Message<___T>,
5531 ) -> ::core::result::Result<
5532 (),
5533 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5534 > {
5535 match *message.header().ordinal {
5536 ordinal => {
5537 handler.on_unknown_interaction(ordinal).await;
5538 if ::core::matches!(
5539 message.header().flexibility(),
5540 ::fidl_next::protocol::Flexibility::Strict
5541 ) {
5542 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5543 } else {
5544 Ok(())
5545 }
5546 }
5547 }
5548 }
5549
5550 async fn on_two_way(
5551 handler: &mut ___H,
5552 mut message: ::fidl_next::Message<___T>,
5553 responder: ::fidl_next::protocol::Responder<___T>,
5554 ) -> ::core::result::Result<
5555 (),
5556 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5557 > {
5558 match *message.header().ordinal {
5559 3391697113329262926 => {
5560 let responder = ::fidl_next::Responder::from_untyped(responder);
5561
5562 handler.watch_power_level(responder).await;
5563 Ok(())
5564 }
5565
5566 ordinal => {
5567 handler.on_unknown_interaction(ordinal).await;
5568 if ::core::matches!(
5569 message.header().flexibility(),
5570 ::fidl_next::protocol::Flexibility::Strict
5571 ) {
5572 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5573 } else {
5574 responder
5575 .respond_framework_error(
5576 ordinal,
5577 ::fidl_next::FrameworkError::UnknownMethod,
5578 )
5579 .expect("encoding a framework error should never fail")
5580 .await?;
5581 Ok(())
5582 }
5583 }
5584 }
5585 }
5586}
5587
5588pub trait StatusClientHandler<
5592 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5593 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5594>
5595{
5596 fn on_unknown_interaction(
5597 &mut self,
5598 ordinal: u64,
5599 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5600 ::core::future::ready(())
5601 }
5602}
5603
5604impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Status
5605where
5606 ___H: StatusClientHandler<___T> + ::core::marker::Send,
5607 ___T: ::fidl_next::Transport,
5608{
5609 async fn on_event(
5610 handler: &mut ___H,
5611 mut message: ::fidl_next::Message<___T>,
5612 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5613 match *message.header().ordinal {
5614 ordinal => {
5615 handler.on_unknown_interaction(ordinal).await;
5616 if ::core::matches!(
5617 message.header().flexibility(),
5618 ::fidl_next::protocol::Flexibility::Strict
5619 ) {
5620 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5621 } else {
5622 Ok(())
5623 }
5624 }
5625 }
5626 }
5627}
5628
5629pub trait StatusServerHandler<
5633 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5634 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5635>
5636{
5637 #[doc = " Returns the current power level for this element. The first call on\n this channel will return immediately. Subsequent calls will block until\n the current power level has changed.\n"]
5638 fn watch_power_level(
5639 &mut self,
5640
5641 responder: ::fidl_next::Responder<status::WatchPowerLevel, ___T>,
5642 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5643
5644 fn on_unknown_interaction(
5645 &mut self,
5646 ordinal: u64,
5647 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5648 ::core::future::ready(())
5649 }
5650}
5651
5652impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Status
5653where
5654 ___H: StatusServerHandler<___T> + ::core::marker::Send,
5655 ___T: ::fidl_next::Transport,
5656{
5657 async fn on_one_way(
5658 handler: &mut ___H,
5659 mut message: ::fidl_next::Message<___T>,
5660 ) -> ::core::result::Result<
5661 (),
5662 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5663 > {
5664 match *message.header().ordinal {
5665 ordinal => {
5666 handler.on_unknown_interaction(ordinal).await;
5667 if ::core::matches!(
5668 message.header().flexibility(),
5669 ::fidl_next::protocol::Flexibility::Strict
5670 ) {
5671 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5672 } else {
5673 Ok(())
5674 }
5675 }
5676 }
5677 }
5678
5679 async fn on_two_way(
5680 handler: &mut ___H,
5681 mut message: ::fidl_next::Message<___T>,
5682 responder: ::fidl_next::protocol::Responder<___T>,
5683 ) -> ::core::result::Result<
5684 (),
5685 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5686 > {
5687 match *message.header().ordinal {
5688 3391697113329262926 => {
5689 let responder = ::fidl_next::Responder::from_untyped(responder);
5690
5691 handler.watch_power_level(responder).await;
5692 Ok(())
5693 }
5694
5695 ordinal => {
5696 handler.on_unknown_interaction(ordinal).await;
5697 if ::core::matches!(
5698 message.header().flexibility(),
5699 ::fidl_next::protocol::Flexibility::Strict
5700 ) {
5701 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5702 } else {
5703 responder
5704 .respond_framework_error(
5705 ordinal,
5706 ::fidl_next::FrameworkError::UnknownMethod,
5707 )
5708 .expect("encoding a framework error should never fail")
5709 .await?;
5710 Ok(())
5711 }
5712 }
5713 }
5714 }
5715}
5716
5717impl<___T> StatusClientHandler<___T> for ::fidl_next::IgnoreEvents
5718where
5719 ___T: ::fidl_next::Transport,
5720{
5721 async fn on_unknown_interaction(&mut self, _: u64) {}
5722}
5723
5724impl<___H, ___T> StatusLocalClientHandler<___T> for ::fidl_next::Local<___H>
5725where
5726 ___H: StatusClientHandler<___T>,
5727 ___T: ::fidl_next::Transport,
5728{
5729 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5730 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5731 }
5732}
5733
5734impl<___H, ___T> StatusLocalServerHandler<___T> for ::fidl_next::Local<___H>
5735where
5736 ___H: StatusServerHandler<___T>,
5737 ___T: ::fidl_next::Transport,
5738{
5739 async fn watch_power_level(
5740 &mut self,
5741
5742 responder: ::fidl_next::Responder<status::WatchPowerLevel, ___T>,
5743 ) {
5744 ___H::watch_power_level(&mut self.0, responder).await
5745 }
5746
5747 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5748 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5749 }
5750}
5751
5752#[doc = " This is the primary initial protocol used by Power Element Owners to\n communicate with Power Broker. Power Element Owners should add the\n elements they own to the Power Topology through AddElement. All further\n interactions with Power Broker are done through channels opened by the\n AddElement call, which are scoped to the added element.\n"]
5754#[derive(PartialEq, Debug)]
5755pub struct Topology;
5756
5757impl ::fidl_next::Discoverable for Topology {
5758 const PROTOCOL_NAME: &'static str = "fuchsia.power.broker.Topology";
5759}
5760
5761#[cfg(target_os = "fuchsia")]
5762impl ::fidl_next::HasTransport for Topology {
5763 type Transport = ::fidl_next::fuchsia::zx::Channel;
5764}
5765
5766pub mod topology {
5767 pub mod prelude {
5768 pub use crate::{
5769 Topology, TopologyClientHandler, TopologyLocalClientHandler,
5770 TopologyLocalServerHandler, TopologyServerHandler, topology,
5771 };
5772
5773 pub use crate::natural::AddElementError;
5774
5775 pub use crate::natural::ElementSchema;
5776
5777 pub use crate::natural::LeaseError;
5778
5779 pub use crate::natural::LeaseSchema;
5780
5781 pub use crate::natural::TopologyAddElementResponse;
5782
5783 pub use crate::natural::TopologyLeaseResponse;
5784 }
5785
5786 pub struct AddElement;
5787
5788 impl ::fidl_next::Method for AddElement {
5789 const ORDINAL: u64 = 2782900474142521859;
5790 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5791 ::fidl_next::protocol::Flexibility::Flexible;
5792
5793 type Protocol = crate::Topology;
5794
5795 type Request = crate::wire::ElementSchema<'static>;
5796 }
5797
5798 impl ::fidl_next::TwoWayMethod for AddElement {
5799 type Response = ::fidl_next::wire::Result<
5800 'static,
5801 crate::wire::TopologyAddElementResponse,
5802 crate::wire::AddElementError,
5803 >;
5804 }
5805
5806 impl<___R> ::fidl_next::Respond<___R> for AddElement {
5807 type Output = ::core::result::Result<___R, ::fidl_next::util::Never>;
5808
5809 fn respond(response: ___R) -> Self::Output {
5810 ::core::result::Result::Ok(response)
5811 }
5812 }
5813
5814 impl<___R> ::fidl_next::RespondErr<___R> for AddElement {
5815 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
5816
5817 fn respond_err(response: ___R) -> Self::Output {
5818 ::core::result::Result::Err(response)
5819 }
5820 }
5821
5822 pub struct Lease;
5823
5824 impl ::fidl_next::Method for Lease {
5825 const ORDINAL: u64 = 9167569827696956208;
5826 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5827 ::fidl_next::protocol::Flexibility::Flexible;
5828
5829 type Protocol = crate::Topology;
5830
5831 type Request = crate::wire::LeaseSchema<'static>;
5832 }
5833
5834 impl ::fidl_next::TwoWayMethod for Lease {
5835 type Response = ::fidl_next::wire::Result<
5836 'static,
5837 crate::wire::TopologyLeaseResponse,
5838 crate::wire::LeaseError,
5839 >;
5840 }
5841
5842 impl<___R> ::fidl_next::Respond<___R> for Lease {
5843 type Output = ::core::result::Result<___R, ::fidl_next::util::Never>;
5844
5845 fn respond(response: ___R) -> Self::Output {
5846 ::core::result::Result::Ok(response)
5847 }
5848 }
5849
5850 impl<___R> ::fidl_next::RespondErr<___R> for Lease {
5851 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
5852
5853 fn respond_err(response: ___R) -> Self::Output {
5854 ::core::result::Result::Err(response)
5855 }
5856 }
5857
5858 mod ___detail {
5859 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Topology
5860 where
5861 ___T: ::fidl_next::Transport,
5862 {
5863 type Client = TopologyClient<___T>;
5864 type Server = TopologyServer<___T>;
5865 }
5866
5867 #[repr(transparent)]
5869 pub struct TopologyClient<___T: ::fidl_next::Transport> {
5870 #[allow(dead_code)]
5871 client: ::fidl_next::protocol::Client<___T>,
5872 }
5873
5874 impl<___T> TopologyClient<___T>
5875 where
5876 ___T: ::fidl_next::Transport,
5877 {
5878 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
5879 pub fn add_element_with<___R>(
5880 &self,
5881 request: ___R,
5882 ) -> ::fidl_next::TwoWayFuture<'_, super::AddElement, ___T>
5883 where
5884 ___R: ::fidl_next::Encode<
5885 crate::wire::ElementSchema<'static>,
5886 <___T as ::fidl_next::Transport>::SendBuffer,
5887 >,
5888 {
5889 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5890 2782900474142521859,
5891 <super::AddElement as ::fidl_next::Method>::FLEXIBILITY,
5892 request,
5893 ))
5894 }
5895
5896 #[doc = " Called by a client to directly open a lease on the given dependencies\n without the need for creating and managing a new element.\n"]
5897 pub fn lease_with<___R>(
5898 &self,
5899 request: ___R,
5900 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
5901 where
5902 ___R: ::fidl_next::Encode<
5903 crate::wire::LeaseSchema<'static>,
5904 <___T as ::fidl_next::Transport>::SendBuffer,
5905 >,
5906 {
5907 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5908 9167569827696956208,
5909 <super::Lease as ::fidl_next::Method>::FLEXIBILITY,
5910 request,
5911 ))
5912 }
5913 }
5914
5915 #[repr(transparent)]
5917 pub struct TopologyServer<___T: ::fidl_next::Transport> {
5918 server: ::fidl_next::protocol::Server<___T>,
5919 }
5920
5921 impl<___T> TopologyServer<___T> where ___T: ::fidl_next::Transport {}
5922 }
5923}
5924
5925#[diagnostic::on_unimplemented(
5926 note = "If {Self} implements the non-local TopologyClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5927)]
5928
5929pub trait TopologyLocalClientHandler<
5933 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5934 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5935>
5936{
5937 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5938 ::core::future::ready(())
5939 }
5940}
5941
5942impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Topology
5943where
5944 ___H: TopologyLocalClientHandler<___T>,
5945 ___T: ::fidl_next::Transport,
5946{
5947 async fn on_event(
5948 handler: &mut ___H,
5949 mut message: ::fidl_next::Message<___T>,
5950 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5951 match *message.header().ordinal {
5952 ordinal => {
5953 handler.on_unknown_interaction(ordinal).await;
5954 if ::core::matches!(
5955 message.header().flexibility(),
5956 ::fidl_next::protocol::Flexibility::Strict
5957 ) {
5958 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5959 } else {
5960 Ok(())
5961 }
5962 }
5963 }
5964 }
5965}
5966
5967#[diagnostic::on_unimplemented(
5968 note = "If {Self} implements the non-local TopologyServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5969)]
5970
5971pub trait TopologyLocalServerHandler<
5975 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5976 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5977>
5978{
5979 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
5980 fn add_element(
5981 &mut self,
5982
5983 request: ::fidl_next::Request<topology::AddElement, ___T>,
5984
5985 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
5986 ) -> impl ::core::future::Future<Output = ()>;
5987
5988 #[doc = " Called by a client to directly open a lease on the given dependencies\n without the need for creating and managing a new element.\n"]
5989 fn lease(
5990 &mut self,
5991
5992 request: ::fidl_next::Request<topology::Lease, ___T>,
5993
5994 responder: ::fidl_next::Responder<topology::Lease, ___T>,
5995 ) -> impl ::core::future::Future<Output = ()>;
5996
5997 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5998 ::core::future::ready(())
5999 }
6000}
6001
6002impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Topology
6003where
6004 ___H: TopologyLocalServerHandler<___T>,
6005 ___T: ::fidl_next::Transport,
6006 for<'de> crate::wire::ElementSchema<'de>: ::fidl_next::Decode<
6007 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6008 Constraint = (),
6009 >,
6010 for<'de> crate::wire::LeaseSchema<'de>: ::fidl_next::Decode<
6011 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6012 Constraint = (),
6013 >,
6014{
6015 async fn on_one_way(
6016 handler: &mut ___H,
6017 mut message: ::fidl_next::Message<___T>,
6018 ) -> ::core::result::Result<
6019 (),
6020 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6021 > {
6022 match *message.header().ordinal {
6023 ordinal => {
6024 handler.on_unknown_interaction(ordinal).await;
6025 if ::core::matches!(
6026 message.header().flexibility(),
6027 ::fidl_next::protocol::Flexibility::Strict
6028 ) {
6029 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6030 } else {
6031 Ok(())
6032 }
6033 }
6034 }
6035 }
6036
6037 async fn on_two_way(
6038 handler: &mut ___H,
6039 mut message: ::fidl_next::Message<___T>,
6040 responder: ::fidl_next::protocol::Responder<___T>,
6041 ) -> ::core::result::Result<
6042 (),
6043 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6044 > {
6045 match *message.header().ordinal {
6046 2782900474142521859 => {
6047 let responder = ::fidl_next::Responder::from_untyped(responder);
6048
6049 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6050 Ok(decoded) => {
6051 handler
6052 .add_element(::fidl_next::Request::from_decoded(decoded), responder)
6053 .await;
6054 Ok(())
6055 }
6056 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6057 ordinal: 2782900474142521859,
6058 error,
6059 }),
6060 }
6061 }
6062
6063 9167569827696956208 => {
6064 let responder = ::fidl_next::Responder::from_untyped(responder);
6065
6066 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6067 Ok(decoded) => {
6068 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
6069 Ok(())
6070 }
6071 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6072 ordinal: 9167569827696956208,
6073 error,
6074 }),
6075 }
6076 }
6077
6078 ordinal => {
6079 handler.on_unknown_interaction(ordinal).await;
6080 if ::core::matches!(
6081 message.header().flexibility(),
6082 ::fidl_next::protocol::Flexibility::Strict
6083 ) {
6084 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6085 } else {
6086 responder
6087 .respond_framework_error(
6088 ordinal,
6089 ::fidl_next::FrameworkError::UnknownMethod,
6090 )
6091 .expect("encoding a framework error should never fail")
6092 .await?;
6093 Ok(())
6094 }
6095 }
6096 }
6097 }
6098}
6099
6100pub trait TopologyClientHandler<
6104 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6105 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6106>
6107{
6108 fn on_unknown_interaction(
6109 &mut self,
6110 ordinal: u64,
6111 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
6112 ::core::future::ready(())
6113 }
6114}
6115
6116impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Topology
6117where
6118 ___H: TopologyClientHandler<___T> + ::core::marker::Send,
6119 ___T: ::fidl_next::Transport,
6120{
6121 async fn on_event(
6122 handler: &mut ___H,
6123 mut message: ::fidl_next::Message<___T>,
6124 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
6125 match *message.header().ordinal {
6126 ordinal => {
6127 handler.on_unknown_interaction(ordinal).await;
6128 if ::core::matches!(
6129 message.header().flexibility(),
6130 ::fidl_next::protocol::Flexibility::Strict
6131 ) {
6132 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6133 } else {
6134 Ok(())
6135 }
6136 }
6137 }
6138 }
6139}
6140
6141pub trait TopologyServerHandler<
6145 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6146 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6147>
6148{
6149 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
6150 fn add_element(
6151 &mut self,
6152
6153 request: ::fidl_next::Request<topology::AddElement, ___T>,
6154
6155 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
6156 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6157
6158 #[doc = " Called by a client to directly open a lease on the given dependencies\n without the need for creating and managing a new element.\n"]
6159 fn lease(
6160 &mut self,
6161
6162 request: ::fidl_next::Request<topology::Lease, ___T>,
6163
6164 responder: ::fidl_next::Responder<topology::Lease, ___T>,
6165 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6166
6167 fn on_unknown_interaction(
6168 &mut self,
6169 ordinal: u64,
6170 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
6171 ::core::future::ready(())
6172 }
6173}
6174
6175impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Topology
6176where
6177 ___H: TopologyServerHandler<___T> + ::core::marker::Send,
6178 ___T: ::fidl_next::Transport,
6179 for<'de> crate::wire::ElementSchema<'de>: ::fidl_next::Decode<
6180 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6181 Constraint = (),
6182 >,
6183 for<'de> crate::wire::LeaseSchema<'de>: ::fidl_next::Decode<
6184 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6185 Constraint = (),
6186 >,
6187{
6188 async fn on_one_way(
6189 handler: &mut ___H,
6190 mut message: ::fidl_next::Message<___T>,
6191 ) -> ::core::result::Result<
6192 (),
6193 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6194 > {
6195 match *message.header().ordinal {
6196 ordinal => {
6197 handler.on_unknown_interaction(ordinal).await;
6198 if ::core::matches!(
6199 message.header().flexibility(),
6200 ::fidl_next::protocol::Flexibility::Strict
6201 ) {
6202 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6203 } else {
6204 Ok(())
6205 }
6206 }
6207 }
6208 }
6209
6210 async fn on_two_way(
6211 handler: &mut ___H,
6212 mut message: ::fidl_next::Message<___T>,
6213 responder: ::fidl_next::protocol::Responder<___T>,
6214 ) -> ::core::result::Result<
6215 (),
6216 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6217 > {
6218 match *message.header().ordinal {
6219 2782900474142521859 => {
6220 let responder = ::fidl_next::Responder::from_untyped(responder);
6221
6222 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6223 Ok(decoded) => {
6224 handler
6225 .add_element(::fidl_next::Request::from_decoded(decoded), responder)
6226 .await;
6227 Ok(())
6228 }
6229 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6230 ordinal: 2782900474142521859,
6231 error,
6232 }),
6233 }
6234 }
6235
6236 9167569827696956208 => {
6237 let responder = ::fidl_next::Responder::from_untyped(responder);
6238
6239 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6240 Ok(decoded) => {
6241 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
6242 Ok(())
6243 }
6244 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6245 ordinal: 9167569827696956208,
6246 error,
6247 }),
6248 }
6249 }
6250
6251 ordinal => {
6252 handler.on_unknown_interaction(ordinal).await;
6253 if ::core::matches!(
6254 message.header().flexibility(),
6255 ::fidl_next::protocol::Flexibility::Strict
6256 ) {
6257 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6258 } else {
6259 responder
6260 .respond_framework_error(
6261 ordinal,
6262 ::fidl_next::FrameworkError::UnknownMethod,
6263 )
6264 .expect("encoding a framework error should never fail")
6265 .await?;
6266 Ok(())
6267 }
6268 }
6269 }
6270 }
6271}
6272
6273impl<___T> TopologyClientHandler<___T> for ::fidl_next::IgnoreEvents
6274where
6275 ___T: ::fidl_next::Transport,
6276{
6277 async fn on_unknown_interaction(&mut self, _: u64) {}
6278}
6279
6280impl<___H, ___T> TopologyLocalClientHandler<___T> for ::fidl_next::Local<___H>
6281where
6282 ___H: TopologyClientHandler<___T>,
6283 ___T: ::fidl_next::Transport,
6284{
6285 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6286 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6287 }
6288}
6289
6290impl<___H, ___T> TopologyLocalServerHandler<___T> for ::fidl_next::Local<___H>
6291where
6292 ___H: TopologyServerHandler<___T>,
6293 ___T: ::fidl_next::Transport,
6294{
6295 async fn add_element(
6296 &mut self,
6297
6298 request: ::fidl_next::Request<topology::AddElement, ___T>,
6299
6300 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
6301 ) {
6302 ___H::add_element(&mut self.0, request, responder).await
6303 }
6304
6305 async fn lease(
6306 &mut self,
6307
6308 request: ::fidl_next::Request<topology::Lease, ___T>,
6309
6310 responder: ::fidl_next::Responder<topology::Lease, ___T>,
6311 ) {
6312 ___H::lease(&mut self.0, request, responder).await
6313 }
6314
6315 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6316 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6317 }
6318}
6319
6320pub use fidl_next_common_fuchsia_power_broker::*;