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 take_dependent_level(&mut self) -> ::core::option::Option<u8> {
2034 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2035 }
2036
2037 pub fn requires_token(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2038 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2039 }
2040
2041 pub fn take_requires_token(
2042 &mut self,
2043 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2044 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2045 }
2046
2047 pub fn requires_level_by_preference(
2048 &self,
2049 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, u8>> {
2050 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2051 }
2052
2053 pub fn take_requires_level_by_preference(
2054 &mut self,
2055 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, u8>> {
2056 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
2057 }
2058
2059 pub fn remove_with_required_element(&self) -> ::core::option::Option<&bool> {
2060 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2061 }
2062
2063 pub fn take_remove_with_required_element(&mut self) -> ::core::option::Option<bool> {
2064 unsafe { Some(self.table.get_mut(4)?.take_unchecked()) }
2065 }
2066 }
2067
2068 impl<'de> ::core::fmt::Debug for LevelDependency<'de> {
2069 fn fmt(
2070 &self,
2071 f: &mut ::core::fmt::Formatter<'_>,
2072 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2073 f.debug_struct("LevelDependency")
2074 .field("dependent_level", &self.dependent_level())
2075 .field("requires_token", &self.requires_token())
2076 .field("requires_level_by_preference", &self.requires_level_by_preference())
2077 .field("remove_with_required_element", &self.remove_with_required_element())
2078 .finish()
2079 }
2080 }
2081
2082 impl<'de> ::fidl_next::IntoNatural for LevelDependency<'de> {
2083 type Natural = crate::natural::LevelDependency;
2084 }
2085
2086 #[derive(Debug)]
2088 #[repr(C)]
2089 pub struct ElementInfoProviderGetElementPowerLevelNamesResponse<'de> {
2090 pub level_names: ::fidl_next::wire::Vector<'de, crate::wire::ElementPowerLevelNames<'de>>,
2091 }
2092
2093 static_assertions::const_assert_eq!(
2094 std::mem::size_of::<ElementInfoProviderGetElementPowerLevelNamesResponse<'_>>(),
2095 16
2096 );
2097 static_assertions::const_assert_eq!(
2098 std::mem::align_of::<ElementInfoProviderGetElementPowerLevelNamesResponse<'_>>(),
2099 8
2100 );
2101
2102 static_assertions::const_assert_eq!(
2103 std::mem::offset_of!(ElementInfoProviderGetElementPowerLevelNamesResponse<'_>, level_names),
2104 0
2105 );
2106
2107 impl ::fidl_next::Constrained for ElementInfoProviderGetElementPowerLevelNamesResponse<'_> {
2108 type Constraint = ();
2109
2110 fn validate(
2111 _: ::fidl_next::Slot<'_, Self>,
2112 _: Self::Constraint,
2113 ) -> Result<(), ::fidl_next::ValidationError> {
2114 Ok(())
2115 }
2116 }
2117
2118 unsafe impl ::fidl_next::Wire for ElementInfoProviderGetElementPowerLevelNamesResponse<'static> {
2119 type Narrowed<'de> = ElementInfoProviderGetElementPowerLevelNamesResponse<'de>;
2120
2121 #[inline]
2122 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2123 ::fidl_next::munge! {
2124 let Self {
2125 level_names,
2126
2127 } = &mut *out_;
2128 }
2129
2130 ::fidl_next::Wire::zero_padding(level_names);
2131 }
2132 }
2133
2134 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2135 for ElementInfoProviderGetElementPowerLevelNamesResponse<'de>
2136 where
2137 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2138 ___D: ::fidl_next::Decoder<'de>,
2139 ___D: ::fidl_next::fuchsia::HandleDecoder,
2140 {
2141 fn decode(
2142 slot_: ::fidl_next::Slot<'_, Self>,
2143 decoder_: &mut ___D,
2144 _: (),
2145 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2146 ::fidl_next::munge! {
2147 let Self {
2148 mut level_names,
2149
2150 } = slot_;
2151 }
2152
2153 let _field = level_names.as_mut();
2154 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
2155 ::fidl_next::Decode::decode(level_names.as_mut(), decoder_, (4294967295, ()))?;
2156
2157 Ok(())
2158 }
2159 }
2160
2161 impl<'de> ::fidl_next::IntoNatural for ElementInfoProviderGetElementPowerLevelNamesResponse<'de> {
2162 type Natural = crate::natural::ElementInfoProviderGetElementPowerLevelNamesResponse;
2163 }
2164
2165 #[repr(C)]
2167 pub struct ElementStatusEndpoint<'de> {
2168 pub(crate) table: ::fidl_next::wire::Table<'de>,
2169 }
2170
2171 impl<'de> Drop for ElementStatusEndpoint<'de> {
2172 fn drop(&mut self) {
2173 let _ = self.table.get(1).map(|envelope| unsafe {
2174 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2175 });
2176
2177 let _ = self.table.get(2)
2178 .map(|envelope| unsafe {
2179 envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>>()
2180 });
2181 }
2182 }
2183
2184 impl ::fidl_next::Constrained for ElementStatusEndpoint<'_> {
2185 type Constraint = ();
2186
2187 fn validate(
2188 _: ::fidl_next::Slot<'_, Self>,
2189 _: Self::Constraint,
2190 ) -> Result<(), ::fidl_next::ValidationError> {
2191 Ok(())
2192 }
2193 }
2194
2195 unsafe impl ::fidl_next::Wire for ElementStatusEndpoint<'static> {
2196 type Narrowed<'de> = ElementStatusEndpoint<'de>;
2197
2198 #[inline]
2199 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2200 ::fidl_next::munge!(let Self { table } = out);
2201 ::fidl_next::wire::Table::zero_padding(table);
2202 }
2203 }
2204
2205 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ElementStatusEndpoint<'de>
2206 where
2207 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2208 ___D: ::fidl_next::fuchsia::HandleDecoder,
2209 {
2210 fn decode(
2211 slot: ::fidl_next::Slot<'_, Self>,
2212 decoder: &mut ___D,
2213 _: (),
2214 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2215 ::fidl_next::munge!(let Self { table } = slot);
2216
2217 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2218 match ordinal {
2219 0 => unsafe { ::core::hint::unreachable_unchecked() },
2220
2221 1 => {
2222 ::fidl_next::wire::Envelope::decode_as::<
2223 ___D,
2224 ::fidl_next::wire::String<'de>,
2225 >(slot.as_mut(), decoder, 64)?;
2226
2227 let value = unsafe {
2228 slot.deref_unchecked()
2229 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2230 };
2231
2232 if value.len() > 64 {
2233 return Err(::fidl_next::DecodeError::VectorTooLong {
2234 size: value.len() as u64,
2235 limit: 64,
2236 });
2237 }
2238
2239 Ok(())
2240 }
2241
2242 2 => {
2243 ::fidl_next::wire::Envelope::decode_as::<
2244 ___D,
2245 ::fidl_next::ClientEnd<
2246 crate::Status,
2247 ::fidl_next::wire::fuchsia::Channel,
2248 >,
2249 >(slot.as_mut(), decoder, ())?;
2250
2251 Ok(())
2252 }
2253
2254 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2255 }
2256 })
2257 }
2258 }
2259
2260 impl<'de> ElementStatusEndpoint<'de> {
2261 pub fn identifier(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2262 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2263 }
2264
2265 pub fn take_identifier(
2266 &mut self,
2267 ) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
2268 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2269 }
2270
2271 pub fn status(
2272 &self,
2273 ) -> ::core::option::Option<
2274 &::fidl_next::ClientEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
2275 > {
2276 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2277 }
2278
2279 pub fn take_status(
2280 &mut self,
2281 ) -> ::core::option::Option<
2282 ::fidl_next::ClientEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
2283 > {
2284 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2285 }
2286 }
2287
2288 impl<'de> ::core::fmt::Debug for ElementStatusEndpoint<'de> {
2289 fn fmt(
2290 &self,
2291 f: &mut ::core::fmt::Formatter<'_>,
2292 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2293 f.debug_struct("ElementStatusEndpoint")
2294 .field("identifier", &self.identifier())
2295 .field("status", &self.status())
2296 .finish()
2297 }
2298 }
2299
2300 impl<'de> ::fidl_next::IntoNatural for ElementStatusEndpoint<'de> {
2301 type Natural = crate::natural::ElementStatusEndpoint;
2302 }
2303
2304 #[derive(Debug)]
2306 #[repr(C)]
2307 pub struct ElementInfoProviderGetStatusEndpointsResponse<'de> {
2308 pub endpoints: ::fidl_next::wire::Vector<'de, crate::wire::ElementStatusEndpoint<'de>>,
2309 }
2310
2311 static_assertions::const_assert_eq!(
2312 std::mem::size_of::<ElementInfoProviderGetStatusEndpointsResponse<'_>>(),
2313 16
2314 );
2315 static_assertions::const_assert_eq!(
2316 std::mem::align_of::<ElementInfoProviderGetStatusEndpointsResponse<'_>>(),
2317 8
2318 );
2319
2320 static_assertions::const_assert_eq!(
2321 std::mem::offset_of!(ElementInfoProviderGetStatusEndpointsResponse<'_>, endpoints),
2322 0
2323 );
2324
2325 impl ::fidl_next::Constrained for ElementInfoProviderGetStatusEndpointsResponse<'_> {
2326 type Constraint = ();
2327
2328 fn validate(
2329 _: ::fidl_next::Slot<'_, Self>,
2330 _: Self::Constraint,
2331 ) -> Result<(), ::fidl_next::ValidationError> {
2332 Ok(())
2333 }
2334 }
2335
2336 unsafe impl ::fidl_next::Wire for ElementInfoProviderGetStatusEndpointsResponse<'static> {
2337 type Narrowed<'de> = ElementInfoProviderGetStatusEndpointsResponse<'de>;
2338
2339 #[inline]
2340 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2341 ::fidl_next::munge! {
2342 let Self {
2343 endpoints,
2344
2345 } = &mut *out_;
2346 }
2347
2348 ::fidl_next::Wire::zero_padding(endpoints);
2349 }
2350 }
2351
2352 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2353 for ElementInfoProviderGetStatusEndpointsResponse<'de>
2354 where
2355 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2356 ___D: ::fidl_next::Decoder<'de>,
2357 ___D: ::fidl_next::fuchsia::HandleDecoder,
2358 {
2359 fn decode(
2360 slot_: ::fidl_next::Slot<'_, Self>,
2361 decoder_: &mut ___D,
2362 _: (),
2363 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2364 ::fidl_next::munge! {
2365 let Self {
2366 mut endpoints,
2367
2368 } = slot_;
2369 }
2370
2371 let _field = endpoints.as_mut();
2372 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
2373 ::fidl_next::Decode::decode(endpoints.as_mut(), decoder_, (4294967295, ()))?;
2374
2375 Ok(())
2376 }
2377 }
2378
2379 impl<'de> ::fidl_next::IntoNatural for ElementInfoProviderGetStatusEndpointsResponse<'de> {
2380 type Natural = crate::natural::ElementInfoProviderGetStatusEndpointsResponse;
2381 }
2382
2383 pub type LeaseToken = ::fidl_next::wire::fuchsia::EventPair;
2385
2386 #[repr(C)]
2388 pub struct ElementSchema<'de> {
2389 pub(crate) table: ::fidl_next::wire::Table<'de>,
2390 }
2391
2392 impl<'de> Drop for ElementSchema<'de> {
2393 fn drop(&mut self) {
2394 let _ = self.table.get(1).map(|envelope| unsafe {
2395 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2396 });
2397
2398 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2399
2400 let _ = self.table.get(3).map(|envelope| unsafe {
2401 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
2402 });
2403
2404 let _ = self.table.get(4)
2405 .map(|envelope| unsafe {
2406 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LevelDependency<'de>>>()
2407 });
2408
2409 let _ = self.table.get(8)
2410 .map(|envelope| unsafe {
2411 envelope.read_unchecked::<::fidl_next::ServerEnd<crate::Lessor, ::fidl_next::wire::fuchsia::Channel>>()
2412 });
2413
2414 let _ = self.table.get(9).map(|envelope| unsafe {
2415 envelope.read_unchecked::<::fidl_next::ServerEnd<
2416 crate::ElementControl,
2417 ::fidl_next::wire::fuchsia::Channel,
2418 >>()
2419 });
2420
2421 let _ = self.table.get(10).map(|envelope| unsafe {
2422 envelope.read_unchecked::<::fidl_next::ClientEnd<
2423 crate::ElementRunner,
2424 ::fidl_next::wire::fuchsia::Channel,
2425 >>()
2426 });
2427
2428 let _ = self.table.get(11).map(|envelope| unsafe {
2429 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
2430 });
2431 }
2432 }
2433
2434 impl ::fidl_next::Constrained for ElementSchema<'_> {
2435 type Constraint = ();
2436
2437 fn validate(
2438 _: ::fidl_next::Slot<'_, Self>,
2439 _: Self::Constraint,
2440 ) -> Result<(), ::fidl_next::ValidationError> {
2441 Ok(())
2442 }
2443 }
2444
2445 unsafe impl ::fidl_next::Wire for ElementSchema<'static> {
2446 type Narrowed<'de> = ElementSchema<'de>;
2447
2448 #[inline]
2449 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2450 ::fidl_next::munge!(let Self { table } = out);
2451 ::fidl_next::wire::Table::zero_padding(table);
2452 }
2453 }
2454
2455 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ElementSchema<'de>
2456 where
2457 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2458 ___D: ::fidl_next::fuchsia::HandleDecoder,
2459 {
2460 fn decode(
2461 slot: ::fidl_next::Slot<'_, Self>,
2462 decoder: &mut ___D,
2463 _: (),
2464 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2465 ::fidl_next::munge!(let Self { table } = slot);
2466
2467 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2468 match ordinal {
2469 0 => unsafe { ::core::hint::unreachable_unchecked() },
2470
2471 1 => {
2472 ::fidl_next::wire::Envelope::decode_as::<
2473 ___D,
2474 ::fidl_next::wire::String<'de>,
2475 >(slot.as_mut(), decoder, 64)?;
2476
2477 let value = unsafe {
2478 slot.deref_unchecked()
2479 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2480 };
2481
2482 if value.len() > 64 {
2483 return Err(::fidl_next::DecodeError::VectorTooLong {
2484 size: value.len() as u64,
2485 limit: 64,
2486 });
2487 }
2488
2489 Ok(())
2490 }
2491
2492 2 => {
2493 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2494 slot.as_mut(),
2495 decoder,
2496 (),
2497 )?;
2498
2499 Ok(())
2500 }
2501
2502 3 => {
2503 ::fidl_next::wire::Envelope::decode_as::<
2504 ___D,
2505 ::fidl_next::wire::Vector<'de, u8>,
2506 >(slot.as_mut(), decoder, (256, ()))?;
2507
2508 let value = unsafe {
2509 slot.deref_unchecked()
2510 .deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
2511 };
2512
2513 if value.len() > 256 {
2514 return Err(::fidl_next::DecodeError::VectorTooLong {
2515 size: value.len() as u64,
2516 limit: 256,
2517 });
2518 }
2519
2520 Ok(())
2521 }
2522
2523 4 => {
2524 ::fidl_next::wire::Envelope::decode_as::<
2525 ___D,
2526 ::fidl_next::wire::Vector<'de, crate::wire::LevelDependency<'de>>,
2527 >(slot.as_mut(), decoder, (128, ()))?;
2528
2529 let value = unsafe {
2530 slot
2531 .deref_unchecked()
2532 .deref_unchecked::<
2533 ::fidl_next::wire::Vector<'_, crate::wire::LevelDependency<'_>>
2534 >()
2535 };
2536
2537 if value.len() > 128 {
2538 return Err(::fidl_next::DecodeError::VectorTooLong {
2539 size: value.len() as u64,
2540 limit: 128,
2541 });
2542 }
2543
2544 Ok(())
2545 }
2546
2547 8 => {
2548 ::fidl_next::wire::Envelope::decode_as::<
2549 ___D,
2550 ::fidl_next::ServerEnd<
2551 crate::Lessor,
2552 ::fidl_next::wire::fuchsia::Channel,
2553 >,
2554 >(slot.as_mut(), decoder, ())?;
2555
2556 Ok(())
2557 }
2558
2559 9 => {
2560 ::fidl_next::wire::Envelope::decode_as::<
2561 ___D,
2562 ::fidl_next::ServerEnd<
2563 crate::ElementControl,
2564 ::fidl_next::wire::fuchsia::Channel,
2565 >,
2566 >(slot.as_mut(), decoder, ())?;
2567
2568 Ok(())
2569 }
2570
2571 10 => {
2572 ::fidl_next::wire::Envelope::decode_as::<
2573 ___D,
2574 ::fidl_next::ClientEnd<
2575 crate::ElementRunner,
2576 ::fidl_next::wire::fuchsia::Channel,
2577 >,
2578 >(slot.as_mut(), decoder, ())?;
2579
2580 Ok(())
2581 }
2582
2583 11 => {
2584 ::fidl_next::wire::Envelope::decode_as::<
2585 ___D,
2586 ::fidl_next::wire::fuchsia::EventPair,
2587 >(slot.as_mut(), decoder, ())?;
2588
2589 Ok(())
2590 }
2591
2592 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2593 }
2594 })
2595 }
2596 }
2597
2598 impl<'de> ElementSchema<'de> {
2599 pub fn element_name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2600 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2601 }
2602
2603 pub fn take_element_name(
2604 &mut self,
2605 ) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
2606 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2607 }
2608
2609 pub fn initial_current_level(&self) -> ::core::option::Option<&u8> {
2610 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2611 }
2612
2613 pub fn take_initial_current_level(&mut self) -> ::core::option::Option<u8> {
2614 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2615 }
2616
2617 pub fn valid_levels(&self) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, u8>> {
2618 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2619 }
2620
2621 pub fn take_valid_levels(
2622 &mut self,
2623 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, u8>> {
2624 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
2625 }
2626
2627 pub fn dependencies(
2628 &self,
2629 ) -> ::core::option::Option<
2630 &::fidl_next::wire::Vector<'de, crate::wire::LevelDependency<'de>>,
2631 > {
2632 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2633 }
2634
2635 pub fn take_dependencies(
2636 &mut self,
2637 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::LevelDependency<'de>>>
2638 {
2639 unsafe { Some(self.table.get_mut(4)?.take_unchecked()) }
2640 }
2641
2642 pub fn lessor_channel(
2643 &self,
2644 ) -> ::core::option::Option<
2645 &::fidl_next::ServerEnd<crate::Lessor, ::fidl_next::wire::fuchsia::Channel>,
2646 > {
2647 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
2648 }
2649
2650 pub fn take_lessor_channel(
2651 &mut self,
2652 ) -> ::core::option::Option<
2653 ::fidl_next::ServerEnd<crate::Lessor, ::fidl_next::wire::fuchsia::Channel>,
2654 > {
2655 unsafe { Some(self.table.get_mut(8)?.take_unchecked()) }
2656 }
2657
2658 pub fn element_control(
2659 &self,
2660 ) -> ::core::option::Option<
2661 &::fidl_next::ServerEnd<crate::ElementControl, ::fidl_next::wire::fuchsia::Channel>,
2662 > {
2663 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
2664 }
2665
2666 pub fn take_element_control(
2667 &mut self,
2668 ) -> ::core::option::Option<
2669 ::fidl_next::ServerEnd<crate::ElementControl, ::fidl_next::wire::fuchsia::Channel>,
2670 > {
2671 unsafe { Some(self.table.get_mut(9)?.take_unchecked()) }
2672 }
2673
2674 pub fn element_runner(
2675 &self,
2676 ) -> ::core::option::Option<
2677 &::fidl_next::ClientEnd<crate::ElementRunner, ::fidl_next::wire::fuchsia::Channel>,
2678 > {
2679 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
2680 }
2681
2682 pub fn take_element_runner(
2683 &mut self,
2684 ) -> ::core::option::Option<
2685 ::fidl_next::ClientEnd<crate::ElementRunner, ::fidl_next::wire::fuchsia::Channel>,
2686 > {
2687 unsafe { Some(self.table.get_mut(10)?.take_unchecked()) }
2688 }
2689
2690 pub fn initial_lease_token(
2691 &self,
2692 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
2693 unsafe { Some(self.table.get(11)?.deref_unchecked()) }
2694 }
2695
2696 pub fn take_initial_lease_token(
2697 &mut self,
2698 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::EventPair> {
2699 unsafe { Some(self.table.get_mut(11)?.take_unchecked()) }
2700 }
2701 }
2702
2703 impl<'de> ::core::fmt::Debug for ElementSchema<'de> {
2704 fn fmt(
2705 &self,
2706 f: &mut ::core::fmt::Formatter<'_>,
2707 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2708 f.debug_struct("ElementSchema")
2709 .field("element_name", &self.element_name())
2710 .field("initial_current_level", &self.initial_current_level())
2711 .field("valid_levels", &self.valid_levels())
2712 .field("dependencies", &self.dependencies())
2713 .field("lessor_channel", &self.lessor_channel())
2714 .field("element_control", &self.element_control())
2715 .field("element_runner", &self.element_runner())
2716 .field("initial_lease_token", &self.initial_lease_token())
2717 .finish()
2718 }
2719 }
2720
2721 impl<'de> ::fidl_next::IntoNatural for ElementSchema<'de> {
2722 type Natural = crate::natural::ElementSchema;
2723 }
2724
2725 #[repr(C)]
2727 pub struct LeaseDependency<'de> {
2728 pub(crate) table: ::fidl_next::wire::Table<'de>,
2729 }
2730
2731 impl<'de> Drop for LeaseDependency<'de> {
2732 fn drop(&mut self) {
2733 let _ = self.table.get(1).map(|envelope| unsafe {
2734 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2735 });
2736
2737 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
2738
2739 let _ = self.table.get(3).map(|envelope| unsafe {
2740 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
2741 });
2742 }
2743 }
2744
2745 impl ::fidl_next::Constrained for LeaseDependency<'_> {
2746 type Constraint = ();
2747
2748 fn validate(
2749 _: ::fidl_next::Slot<'_, Self>,
2750 _: Self::Constraint,
2751 ) -> Result<(), ::fidl_next::ValidationError> {
2752 Ok(())
2753 }
2754 }
2755
2756 unsafe impl ::fidl_next::Wire for LeaseDependency<'static> {
2757 type Narrowed<'de> = LeaseDependency<'de>;
2758
2759 #[inline]
2760 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2761 ::fidl_next::munge!(let Self { table } = out);
2762 ::fidl_next::wire::Table::zero_padding(table);
2763 }
2764 }
2765
2766 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LeaseDependency<'de>
2767 where
2768 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2769 ___D: ::fidl_next::fuchsia::HandleDecoder,
2770 {
2771 fn decode(
2772 slot: ::fidl_next::Slot<'_, Self>,
2773 decoder: &mut ___D,
2774 _: (),
2775 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2776 ::fidl_next::munge!(let Self { table } = slot);
2777
2778 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2779 match ordinal {
2780 0 => unsafe { ::core::hint::unreachable_unchecked() },
2781
2782 1 => {
2783 ::fidl_next::wire::Envelope::decode_as::<
2784 ___D,
2785 ::fidl_next::wire::fuchsia::Event,
2786 >(slot.as_mut(), decoder, ())?;
2787
2788 Ok(())
2789 }
2790
2791 2 => {
2792 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
2793 slot.as_mut(),
2794 decoder,
2795 (),
2796 )?;
2797
2798 Ok(())
2799 }
2800
2801 3 => {
2802 ::fidl_next::wire::Envelope::decode_as::<
2803 ___D,
2804 ::fidl_next::wire::Vector<'de, u8>,
2805 >(slot.as_mut(), decoder, (256, ()))?;
2806
2807 let value = unsafe {
2808 slot.deref_unchecked()
2809 .deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
2810 };
2811
2812 if value.len() > 256 {
2813 return Err(::fidl_next::DecodeError::VectorTooLong {
2814 size: value.len() as u64,
2815 limit: 256,
2816 });
2817 }
2818
2819 Ok(())
2820 }
2821
2822 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2823 }
2824 })
2825 }
2826 }
2827
2828 impl<'de> LeaseDependency<'de> {
2829 pub fn requires_token(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2830 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2831 }
2832
2833 pub fn take_requires_token(
2834 &mut self,
2835 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
2836 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2837 }
2838
2839 pub fn requires_level(&self) -> ::core::option::Option<&u8> {
2840 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2841 }
2842
2843 pub fn take_requires_level(&mut self) -> ::core::option::Option<u8> {
2844 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2845 }
2846
2847 pub fn requires_level_by_preference(
2848 &self,
2849 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, u8>> {
2850 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2851 }
2852
2853 pub fn take_requires_level_by_preference(
2854 &mut self,
2855 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, u8>> {
2856 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
2857 }
2858 }
2859
2860 impl<'de> ::core::fmt::Debug for LeaseDependency<'de> {
2861 fn fmt(
2862 &self,
2863 f: &mut ::core::fmt::Formatter<'_>,
2864 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2865 f.debug_struct("LeaseDependency")
2866 .field("requires_token", &self.requires_token())
2867 .field("requires_level", &self.requires_level())
2868 .field("requires_level_by_preference", &self.requires_level_by_preference())
2869 .finish()
2870 }
2871 }
2872
2873 impl<'de> ::fidl_next::IntoNatural for LeaseDependency<'de> {
2874 type Natural = crate::natural::LeaseDependency;
2875 }
2876
2877 #[repr(C)]
2879 pub struct LeaseSchema<'de> {
2880 pub(crate) table: ::fidl_next::wire::Table<'de>,
2881 }
2882
2883 impl<'de> Drop for LeaseSchema<'de> {
2884 fn drop(&mut self) {
2885 let _ = self.table.get(1).map(|envelope| unsafe {
2886 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
2887 });
2888
2889 let _ = self.table.get(2).map(|envelope| unsafe {
2890 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2891 });
2892
2893 let _ = self.table.get(3)
2894 .map(|envelope| unsafe {
2895 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LeaseDependency<'de>>>()
2896 });
2897
2898 let _ = self.table.get(4).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
2899 }
2900 }
2901
2902 impl ::fidl_next::Constrained for LeaseSchema<'_> {
2903 type Constraint = ();
2904
2905 fn validate(
2906 _: ::fidl_next::Slot<'_, Self>,
2907 _: Self::Constraint,
2908 ) -> Result<(), ::fidl_next::ValidationError> {
2909 Ok(())
2910 }
2911 }
2912
2913 unsafe impl ::fidl_next::Wire for LeaseSchema<'static> {
2914 type Narrowed<'de> = LeaseSchema<'de>;
2915
2916 #[inline]
2917 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2918 ::fidl_next::munge!(let Self { table } = out);
2919 ::fidl_next::wire::Table::zero_padding(table);
2920 }
2921 }
2922
2923 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LeaseSchema<'de>
2924 where
2925 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2926 ___D: ::fidl_next::fuchsia::HandleDecoder,
2927 {
2928 fn decode(
2929 slot: ::fidl_next::Slot<'_, Self>,
2930 decoder: &mut ___D,
2931 _: (),
2932 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2933 ::fidl_next::munge!(let Self { table } = slot);
2934
2935 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2936 match ordinal {
2937 0 => unsafe { ::core::hint::unreachable_unchecked() },
2938
2939 1 => {
2940 ::fidl_next::wire::Envelope::decode_as::<
2941 ___D,
2942 ::fidl_next::wire::fuchsia::EventPair,
2943 >(slot.as_mut(), decoder, ())?;
2944
2945 Ok(())
2946 }
2947
2948 2 => {
2949 ::fidl_next::wire::Envelope::decode_as::<
2950 ___D,
2951 ::fidl_next::wire::String<'de>,
2952 >(slot.as_mut(), decoder, 64)?;
2953
2954 let value = unsafe {
2955 slot.deref_unchecked()
2956 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2957 };
2958
2959 if value.len() > 64 {
2960 return Err(::fidl_next::DecodeError::VectorTooLong {
2961 size: value.len() as u64,
2962 limit: 64,
2963 });
2964 }
2965
2966 Ok(())
2967 }
2968
2969 3 => {
2970 ::fidl_next::wire::Envelope::decode_as::<
2971 ___D,
2972 ::fidl_next::wire::Vector<'de, crate::wire::LeaseDependency<'de>>,
2973 >(slot.as_mut(), decoder, (128, ()))?;
2974
2975 let value = unsafe {
2976 slot
2977 .deref_unchecked()
2978 .deref_unchecked::<
2979 ::fidl_next::wire::Vector<'_, crate::wire::LeaseDependency<'_>>
2980 >()
2981 };
2982
2983 if value.len() > 128 {
2984 return Err(::fidl_next::DecodeError::VectorTooLong {
2985 size: value.len() as u64,
2986 limit: 128,
2987 });
2988 }
2989
2990 Ok(())
2991 }
2992
2993 4 => {
2994 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
2995 slot.as_mut(),
2996 decoder,
2997 (),
2998 )?;
2999
3000 Ok(())
3001 }
3002
3003 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3004 }
3005 })
3006 }
3007 }
3008
3009 impl<'de> LeaseSchema<'de> {
3010 pub fn lease_token(
3011 &self,
3012 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
3013 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3014 }
3015
3016 pub fn take_lease_token(
3017 &mut self,
3018 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::EventPair> {
3019 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
3020 }
3021
3022 pub fn lease_name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
3023 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3024 }
3025
3026 pub fn take_lease_name(
3027 &mut self,
3028 ) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
3029 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
3030 }
3031
3032 pub fn dependencies(
3033 &self,
3034 ) -> ::core::option::Option<
3035 &::fidl_next::wire::Vector<'de, crate::wire::LeaseDependency<'de>>,
3036 > {
3037 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
3038 }
3039
3040 pub fn take_dependencies(
3041 &mut self,
3042 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::LeaseDependency<'de>>>
3043 {
3044 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
3045 }
3046
3047 pub fn should_return_pending_lease(&self) -> ::core::option::Option<&bool> {
3048 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
3049 }
3050
3051 pub fn take_should_return_pending_lease(&mut self) -> ::core::option::Option<bool> {
3052 unsafe { Some(self.table.get_mut(4)?.take_unchecked()) }
3053 }
3054 }
3055
3056 impl<'de> ::core::fmt::Debug for LeaseSchema<'de> {
3057 fn fmt(
3058 &self,
3059 f: &mut ::core::fmt::Formatter<'_>,
3060 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3061 f.debug_struct("LeaseSchema")
3062 .field("lease_token", &self.lease_token())
3063 .field("lease_name", &self.lease_name())
3064 .field("dependencies", &self.dependencies())
3065 .field("should_return_pending_lease", &self.should_return_pending_lease())
3066 .finish()
3067 }
3068 }
3069
3070 impl<'de> ::fidl_next::IntoNatural for LeaseSchema<'de> {
3071 type Natural = crate::natural::LeaseSchema;
3072 }
3073
3074 #[derive(Debug)]
3076 #[repr(C)]
3077 pub struct LessorLeaseRequest {
3078 pub level: u8,
3079 }
3080
3081 static_assertions::const_assert_eq!(std::mem::size_of::<LessorLeaseRequest>(), 1);
3082 static_assertions::const_assert_eq!(std::mem::align_of::<LessorLeaseRequest>(), 1);
3083
3084 static_assertions::const_assert_eq!(std::mem::offset_of!(LessorLeaseRequest, level), 0);
3085
3086 impl ::fidl_next::Constrained for LessorLeaseRequest {
3087 type Constraint = ();
3088
3089 fn validate(
3090 _: ::fidl_next::Slot<'_, Self>,
3091 _: Self::Constraint,
3092 ) -> Result<(), ::fidl_next::ValidationError> {
3093 Ok(())
3094 }
3095 }
3096
3097 unsafe impl ::fidl_next::Wire for LessorLeaseRequest {
3098 type Narrowed<'de> = LessorLeaseRequest;
3099
3100 #[inline]
3101 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
3102 ::fidl_next::munge! {
3103 let Self {
3104 level,
3105
3106 } = &mut *out_;
3107 }
3108
3109 ::fidl_next::Wire::zero_padding(level);
3110 }
3111 }
3112
3113 unsafe impl<___D> ::fidl_next::Decode<___D> for LessorLeaseRequest
3114 where
3115 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3116 ___D: ::fidl_next::fuchsia::HandleDecoder,
3117 {
3118 fn decode(
3119 slot_: ::fidl_next::Slot<'_, Self>,
3120 decoder_: &mut ___D,
3121 _: (),
3122 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3123 ::fidl_next::munge! {
3124 let Self {
3125 mut level,
3126
3127 } = slot_;
3128 }
3129
3130 let _field = level.as_mut();
3131
3132 ::fidl_next::Decode::decode(level.as_mut(), decoder_, ())?;
3133
3134 Ok(())
3135 }
3136 }
3137
3138 impl ::fidl_next::IntoNatural for LessorLeaseRequest {
3139 type Natural = crate::natural::LessorLeaseRequest;
3140 }
3141
3142 #[derive(Debug)]
3144 #[repr(C)]
3145 pub struct LessorLeaseResponse {
3146 pub lease_control:
3147 ::fidl_next::ClientEnd<crate::LeaseControl, ::fidl_next::wire::fuchsia::Channel>,
3148 }
3149
3150 static_assertions::const_assert_eq!(std::mem::size_of::<LessorLeaseResponse>(), 4);
3151 static_assertions::const_assert_eq!(std::mem::align_of::<LessorLeaseResponse>(), 4);
3152
3153 static_assertions::const_assert_eq!(
3154 std::mem::offset_of!(LessorLeaseResponse, lease_control),
3155 0
3156 );
3157
3158 impl ::fidl_next::Constrained for LessorLeaseResponse {
3159 type Constraint = ();
3160
3161 fn validate(
3162 _: ::fidl_next::Slot<'_, Self>,
3163 _: Self::Constraint,
3164 ) -> Result<(), ::fidl_next::ValidationError> {
3165 Ok(())
3166 }
3167 }
3168
3169 unsafe impl ::fidl_next::Wire for LessorLeaseResponse {
3170 type Narrowed<'de> = LessorLeaseResponse;
3171
3172 #[inline]
3173 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
3174 ::fidl_next::munge! {
3175 let Self {
3176 lease_control,
3177
3178 } = &mut *out_;
3179 }
3180
3181 ::fidl_next::Wire::zero_padding(lease_control);
3182 }
3183 }
3184
3185 unsafe impl<___D> ::fidl_next::Decode<___D> for LessorLeaseResponse
3186 where
3187 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3188 ___D: ::fidl_next::fuchsia::HandleDecoder,
3189 {
3190 fn decode(
3191 slot_: ::fidl_next::Slot<'_, Self>,
3192 decoder_: &mut ___D,
3193 _: (),
3194 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3195 ::fidl_next::munge! {
3196 let Self {
3197 mut lease_control,
3198
3199 } = slot_;
3200 }
3201
3202 let _field = lease_control.as_mut();
3203
3204 ::fidl_next::Decode::decode(lease_control.as_mut(), decoder_, ())?;
3205
3206 Ok(())
3207 }
3208 }
3209
3210 impl ::fidl_next::IntoNatural for LessorLeaseResponse {
3211 type Natural = crate::natural::LessorLeaseResponse;
3212 }
3213
3214 #[derive(Debug)]
3216 #[repr(C)]
3217 pub struct StatusWatchPowerLevelResponse {
3218 pub current_level: u8,
3219 }
3220
3221 static_assertions::const_assert_eq!(std::mem::size_of::<StatusWatchPowerLevelResponse>(), 1);
3222 static_assertions::const_assert_eq!(std::mem::align_of::<StatusWatchPowerLevelResponse>(), 1);
3223
3224 static_assertions::const_assert_eq!(
3225 std::mem::offset_of!(StatusWatchPowerLevelResponse, current_level),
3226 0
3227 );
3228
3229 impl ::fidl_next::Constrained for StatusWatchPowerLevelResponse {
3230 type Constraint = ();
3231
3232 fn validate(
3233 _: ::fidl_next::Slot<'_, Self>,
3234 _: Self::Constraint,
3235 ) -> Result<(), ::fidl_next::ValidationError> {
3236 Ok(())
3237 }
3238 }
3239
3240 unsafe impl ::fidl_next::Wire for StatusWatchPowerLevelResponse {
3241 type Narrowed<'de> = StatusWatchPowerLevelResponse;
3242
3243 #[inline]
3244 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
3245 ::fidl_next::munge! {
3246 let Self {
3247 current_level,
3248
3249 } = &mut *out_;
3250 }
3251
3252 ::fidl_next::Wire::zero_padding(current_level);
3253 }
3254 }
3255
3256 unsafe impl<___D> ::fidl_next::Decode<___D> for StatusWatchPowerLevelResponse
3257 where
3258 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3259 ___D: ::fidl_next::fuchsia::HandleDecoder,
3260 {
3261 fn decode(
3262 slot_: ::fidl_next::Slot<'_, Self>,
3263 decoder_: &mut ___D,
3264 _: (),
3265 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3266 ::fidl_next::munge! {
3267 let Self {
3268 mut current_level,
3269
3270 } = slot_;
3271 }
3272
3273 let _field = current_level.as_mut();
3274
3275 ::fidl_next::Decode::decode(current_level.as_mut(), decoder_, ())?;
3276
3277 Ok(())
3278 }
3279 }
3280
3281 impl ::fidl_next::IntoNatural for StatusWatchPowerLevelResponse {
3282 type Natural = crate::natural::StatusWatchPowerLevelResponse;
3283 }
3284}
3285
3286pub mod wire_optional {
3287
3288 pub use fidl_next_common_fuchsia_power_broker::wire_optional::*;
3289}
3290
3291pub mod generic {
3292
3293 pub use fidl_next_common_fuchsia_power_broker::generic::*;
3294
3295 pub struct ElementControlOpenStatusChannelRequest<T0> {
3297 pub status_channel: T0,
3298 }
3299
3300 unsafe impl<___E, T0>
3301 ::fidl_next::Encode<crate::wire::ElementControlOpenStatusChannelRequest, ___E>
3302 for ElementControlOpenStatusChannelRequest<T0>
3303 where
3304 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3305 ___E: ::fidl_next::fuchsia::HandleEncoder,
3306 T0: ::fidl_next::Encode<
3307 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
3308 ___E,
3309 >,
3310 {
3311 #[inline]
3312 fn encode(
3313 self,
3314 encoder_: &mut ___E,
3315 out_: &mut ::core::mem::MaybeUninit<
3316 crate::wire::ElementControlOpenStatusChannelRequest,
3317 >,
3318 _: (),
3319 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3320 ::fidl_next::munge! {
3321 let crate::wire::ElementControlOpenStatusChannelRequest {
3322 status_channel,
3323
3324 } = out_;
3325 }
3326
3327 ::fidl_next::Encode::encode(self.status_channel, encoder_, status_channel, ())?;
3328
3329 Ok(())
3330 }
3331 }
3332
3333 pub struct ElementControlRegisterDependencyTokenRequest<T0> {
3335 pub token: T0,
3336 }
3337
3338 unsafe impl<___E, T0>
3339 ::fidl_next::Encode<crate::wire::ElementControlRegisterDependencyTokenRequest, ___E>
3340 for ElementControlRegisterDependencyTokenRequest<T0>
3341 where
3342 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3343 ___E: ::fidl_next::fuchsia::HandleEncoder,
3344 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Event, ___E>,
3345 {
3346 #[inline]
3347 fn encode(
3348 self,
3349 encoder_: &mut ___E,
3350 out_: &mut ::core::mem::MaybeUninit<
3351 crate::wire::ElementControlRegisterDependencyTokenRequest,
3352 >,
3353 _: (),
3354 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3355 ::fidl_next::munge! {
3356 let crate::wire::ElementControlRegisterDependencyTokenRequest {
3357 token,
3358
3359 } = out_;
3360 }
3361
3362 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
3363
3364 Ok(())
3365 }
3366 }
3367
3368 pub struct ElementControlUnregisterDependencyTokenRequest<T0> {
3370 pub token: T0,
3371 }
3372
3373 unsafe impl<___E, T0>
3374 ::fidl_next::Encode<crate::wire::ElementControlUnregisterDependencyTokenRequest, ___E>
3375 for ElementControlUnregisterDependencyTokenRequest<T0>
3376 where
3377 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3378 ___E: ::fidl_next::fuchsia::HandleEncoder,
3379 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Event, ___E>,
3380 {
3381 #[inline]
3382 fn encode(
3383 self,
3384 encoder_: &mut ___E,
3385 out_: &mut ::core::mem::MaybeUninit<
3386 crate::wire::ElementControlUnregisterDependencyTokenRequest,
3387 >,
3388 _: (),
3389 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3390 ::fidl_next::munge! {
3391 let crate::wire::ElementControlUnregisterDependencyTokenRequest {
3392 token,
3393
3394 } = out_;
3395 }
3396
3397 ::fidl_next::Encode::encode(self.token, encoder_, token, ())?;
3398
3399 Ok(())
3400 }
3401 }
3402
3403 pub struct ElementInfoProviderGetElementPowerLevelNamesResponse<T0> {
3405 pub level_names: T0,
3406 }
3407
3408 unsafe impl<___E, T0>
3409 ::fidl_next::Encode<
3410 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
3411 ___E,
3412 > for ElementInfoProviderGetElementPowerLevelNamesResponse<T0>
3413 where
3414 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3415 ___E: ::fidl_next::Encoder,
3416 ___E: ::fidl_next::fuchsia::HandleEncoder,
3417 T0: ::fidl_next::Encode<
3418 ::fidl_next::wire::Vector<'static, crate::wire::ElementPowerLevelNames<'static>>,
3419 ___E,
3420 >,
3421 {
3422 #[inline]
3423 fn encode(
3424 self,
3425 encoder_: &mut ___E,
3426 out_: &mut ::core::mem::MaybeUninit<
3427 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
3428 >,
3429 _: (),
3430 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3431 ::fidl_next::munge! {
3432 let crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse {
3433 level_names,
3434
3435 } = out_;
3436 }
3437
3438 ::fidl_next::Encode::encode(self.level_names, encoder_, level_names, (4294967295, ()))?;
3439
3440 Ok(())
3441 }
3442 }
3443
3444 pub struct ElementInfoProviderGetStatusEndpointsResponse<T0> {
3446 pub endpoints: T0,
3447 }
3448
3449 unsafe impl<___E, T0>
3450 ::fidl_next::Encode<
3451 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
3452 ___E,
3453 > for ElementInfoProviderGetStatusEndpointsResponse<T0>
3454 where
3455 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3456 ___E: ::fidl_next::Encoder,
3457 ___E: ::fidl_next::fuchsia::HandleEncoder,
3458 T0: ::fidl_next::Encode<
3459 ::fidl_next::wire::Vector<'static, crate::wire::ElementStatusEndpoint<'static>>,
3460 ___E,
3461 >,
3462 {
3463 #[inline]
3464 fn encode(
3465 self,
3466 encoder_: &mut ___E,
3467 out_: &mut ::core::mem::MaybeUninit<
3468 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
3469 >,
3470 _: (),
3471 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3472 ::fidl_next::munge! {
3473 let crate::wire::ElementInfoProviderGetStatusEndpointsResponse {
3474 endpoints,
3475
3476 } = out_;
3477 }
3478
3479 ::fidl_next::Encode::encode(self.endpoints, encoder_, endpoints, (4294967295, ()))?;
3480
3481 Ok(())
3482 }
3483 }
3484
3485 pub struct LessorLeaseRequest<T0> {
3487 pub level: T0,
3488 }
3489
3490 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::LessorLeaseRequest, ___E>
3491 for LessorLeaseRequest<T0>
3492 where
3493 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3494 ___E: ::fidl_next::fuchsia::HandleEncoder,
3495 T0: ::fidl_next::Encode<u8, ___E>,
3496 {
3497 #[inline]
3498 fn encode(
3499 self,
3500 encoder_: &mut ___E,
3501 out_: &mut ::core::mem::MaybeUninit<crate::wire::LessorLeaseRequest>,
3502 _: (),
3503 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3504 ::fidl_next::munge! {
3505 let crate::wire::LessorLeaseRequest {
3506 level,
3507
3508 } = out_;
3509 }
3510
3511 ::fidl_next::Encode::encode(self.level, encoder_, level, ())?;
3512
3513 Ok(())
3514 }
3515 }
3516
3517 pub struct LessorLeaseResponse<T0> {
3519 pub lease_control: T0,
3520 }
3521
3522 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::LessorLeaseResponse, ___E>
3523 for LessorLeaseResponse<T0>
3524 where
3525 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3526 ___E: ::fidl_next::fuchsia::HandleEncoder,
3527 T0: ::fidl_next::Encode<
3528 ::fidl_next::ClientEnd<crate::LeaseControl, ::fidl_next::wire::fuchsia::Channel>,
3529 ___E,
3530 >,
3531 {
3532 #[inline]
3533 fn encode(
3534 self,
3535 encoder_: &mut ___E,
3536 out_: &mut ::core::mem::MaybeUninit<crate::wire::LessorLeaseResponse>,
3537 _: (),
3538 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3539 ::fidl_next::munge! {
3540 let crate::wire::LessorLeaseResponse {
3541 lease_control,
3542
3543 } = out_;
3544 }
3545
3546 ::fidl_next::Encode::encode(self.lease_control, encoder_, lease_control, ())?;
3547
3548 Ok(())
3549 }
3550 }
3551
3552 pub struct StatusWatchPowerLevelResponse<T0> {
3554 pub current_level: T0,
3555 }
3556
3557 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::StatusWatchPowerLevelResponse, ___E>
3558 for StatusWatchPowerLevelResponse<T0>
3559 where
3560 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3561 ___E: ::fidl_next::fuchsia::HandleEncoder,
3562 T0: ::fidl_next::Encode<u8, ___E>,
3563 {
3564 #[inline]
3565 fn encode(
3566 self,
3567 encoder_: &mut ___E,
3568 out_: &mut ::core::mem::MaybeUninit<crate::wire::StatusWatchPowerLevelResponse>,
3569 _: (),
3570 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3571 ::fidl_next::munge! {
3572 let crate::wire::StatusWatchPowerLevelResponse {
3573 current_level,
3574
3575 } = out_;
3576 }
3577
3578 ::fidl_next::Encode::encode(self.current_level, encoder_, current_level, ())?;
3579
3580 Ok(())
3581 }
3582 }
3583}
3584
3585pub use self::natural::*;
3586
3587#[doc = " Provides element-scoped access to an element previously added via\n Topology.AddElement.\n"]
3589#[derive(PartialEq, Debug)]
3590pub struct ElementControl;
3591
3592#[cfg(target_os = "fuchsia")]
3593impl ::fidl_next::HasTransport for ElementControl {
3594 type Transport = ::fidl_next::fuchsia::zx::Channel;
3595}
3596
3597pub mod element_control {
3598 pub mod prelude {
3599 pub use crate::{
3600 ElementControl, ElementControlClientHandler, ElementControlLocalClientHandler,
3601 ElementControlLocalServerHandler, ElementControlServerHandler, element_control,
3602 };
3603
3604 pub use crate::natural::ElementControlOpenStatusChannelRequest;
3605
3606 pub use crate::natural::ElementControlRegisterDependencyTokenRequest;
3607
3608 pub use crate::natural::ElementControlUnregisterDependencyTokenRequest;
3609
3610 pub use crate::natural::ElementControlAddDependencyResponse;
3611
3612 pub use crate::natural::ElementControlRegisterDependencyTokenResponse;
3613
3614 pub use crate::natural::ElementControlUnregisterDependencyTokenResponse;
3615
3616 pub use crate::natural::LevelDependency;
3617
3618 pub use crate::natural::ModifyDependencyError;
3619
3620 pub use crate::natural::RegisterDependencyTokenError;
3621
3622 pub use crate::natural::UnregisterDependencyTokenError;
3623 }
3624
3625 pub struct OpenStatusChannel;
3626
3627 impl ::fidl_next::Method for OpenStatusChannel {
3628 const ORDINAL: u64 = 5582056609237590784;
3629 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3630 ::fidl_next::protocol::Flexibility::Flexible;
3631
3632 type Protocol = crate::ElementControl;
3633
3634 type Request = crate::wire::ElementControlOpenStatusChannelRequest;
3635 }
3636
3637 pub struct RegisterDependencyToken;
3638
3639 impl ::fidl_next::Method for RegisterDependencyToken {
3640 const ORDINAL: u64 = 4201883080704232801;
3641 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3642 ::fidl_next::protocol::Flexibility::Flexible;
3643
3644 type Protocol = crate::ElementControl;
3645
3646 type Request = crate::wire::ElementControlRegisterDependencyTokenRequest;
3647 }
3648
3649 impl ::fidl_next::TwoWayMethod for RegisterDependencyToken {
3650 type Response = ::fidl_next::wire::Result<
3651 'static,
3652 crate::wire::ElementControlRegisterDependencyTokenResponse,
3653 crate::wire::RegisterDependencyTokenError,
3654 >;
3655 }
3656
3657 impl<___R> ::fidl_next::Respond<___R> for RegisterDependencyToken {
3658 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
3659
3660 fn respond(response: ___R) -> Self::Output {
3661 ::core::result::Result::Ok(response)
3662 }
3663 }
3664
3665 impl<___R> ::fidl_next::RespondErr<___R> for RegisterDependencyToken {
3666 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3667
3668 fn respond_err(response: ___R) -> Self::Output {
3669 ::core::result::Result::Err(response)
3670 }
3671 }
3672
3673 pub struct UnregisterDependencyToken;
3674
3675 impl ::fidl_next::Method for UnregisterDependencyToken {
3676 const ORDINAL: u64 = 7323726239897326889;
3677 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3678 ::fidl_next::protocol::Flexibility::Flexible;
3679
3680 type Protocol = crate::ElementControl;
3681
3682 type Request = crate::wire::ElementControlUnregisterDependencyTokenRequest;
3683 }
3684
3685 impl ::fidl_next::TwoWayMethod for UnregisterDependencyToken {
3686 type Response = ::fidl_next::wire::Result<
3687 'static,
3688 crate::wire::ElementControlUnregisterDependencyTokenResponse,
3689 crate::wire::UnregisterDependencyTokenError,
3690 >;
3691 }
3692
3693 impl<___R> ::fidl_next::Respond<___R> for UnregisterDependencyToken {
3694 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
3695
3696 fn respond(response: ___R) -> Self::Output {
3697 ::core::result::Result::Ok(response)
3698 }
3699 }
3700
3701 impl<___R> ::fidl_next::RespondErr<___R> for UnregisterDependencyToken {
3702 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3703
3704 fn respond_err(response: ___R) -> Self::Output {
3705 ::core::result::Result::Err(response)
3706 }
3707 }
3708
3709 pub struct AddDependency;
3710
3711 impl ::fidl_next::Method for AddDependency {
3712 const ORDINAL: u64 = 4463546978076627444;
3713 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3714 ::fidl_next::protocol::Flexibility::Flexible;
3715
3716 type Protocol = crate::ElementControl;
3717
3718 type Request = crate::wire::LevelDependency<'static>;
3719 }
3720
3721 impl ::fidl_next::TwoWayMethod for AddDependency {
3722 type Response = ::fidl_next::wire::Result<
3723 'static,
3724 crate::wire::ElementControlAddDependencyResponse,
3725 crate::wire::ModifyDependencyError,
3726 >;
3727 }
3728
3729 impl<___R> ::fidl_next::Respond<___R> for AddDependency {
3730 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
3731
3732 fn respond(response: ___R) -> Self::Output {
3733 ::core::result::Result::Ok(response)
3734 }
3735 }
3736
3737 impl<___R> ::fidl_next::RespondErr<___R> for AddDependency {
3738 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3739
3740 fn respond_err(response: ___R) -> Self::Output {
3741 ::core::result::Result::Err(response)
3742 }
3743 }
3744
3745 mod ___detail {
3746 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ElementControl
3747 where
3748 ___T: ::fidl_next::Transport,
3749 {
3750 type Client = ElementControlClient<___T>;
3751 type Server = ElementControlServer<___T>;
3752 }
3753
3754 #[repr(transparent)]
3756 pub struct ElementControlClient<___T: ::fidl_next::Transport> {
3757 #[allow(dead_code)]
3758 client: ::fidl_next::protocol::Client<___T>,
3759 }
3760
3761 impl<___T> ElementControlClient<___T>
3762 where
3763 ___T: ::fidl_next::Transport,
3764 {
3765 #[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"]
3766 pub fn open_status_channel(
3767 &self,
3768
3769 status_channel: impl ::fidl_next::Encode<
3770 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
3771 <___T as ::fidl_next::Transport>::SendBuffer,
3772 >,
3773 ) -> ::fidl_next::SendFuture<'_, ___T>
3774 where
3775 <___T as ::fidl_next::Transport>::SendBuffer:
3776 ::fidl_next::encoder::InternalHandleEncoder,
3777 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3778 {
3779 self.open_status_channel_with(
3780 crate::generic::ElementControlOpenStatusChannelRequest { status_channel },
3781 )
3782 }
3783
3784 #[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"]
3785 pub fn open_status_channel_with<___R>(
3786 &self,
3787 request: ___R,
3788 ) -> ::fidl_next::SendFuture<'_, ___T>
3789 where
3790 ___R: ::fidl_next::Encode<
3791 crate::wire::ElementControlOpenStatusChannelRequest,
3792 <___T as ::fidl_next::Transport>::SendBuffer,
3793 >,
3794 {
3795 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
3796 5582056609237590784,
3797 <super::OpenStatusChannel as ::fidl_next::Method>::FLEXIBILITY,
3798 request,
3799 ))
3800 }
3801
3802 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3803 pub fn register_dependency_token(
3804 &self,
3805
3806 token: impl ::fidl_next::Encode<
3807 ::fidl_next::wire::fuchsia::Event,
3808 <___T as ::fidl_next::Transport>::SendBuffer,
3809 >,
3810 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterDependencyToken, ___T>
3811 where
3812 <___T as ::fidl_next::Transport>::SendBuffer:
3813 ::fidl_next::encoder::InternalHandleEncoder,
3814 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3815 {
3816 self.register_dependency_token_with(
3817 crate::generic::ElementControlRegisterDependencyTokenRequest { token },
3818 )
3819 }
3820
3821 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3822 pub fn register_dependency_token_with<___R>(
3823 &self,
3824 request: ___R,
3825 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterDependencyToken, ___T>
3826 where
3827 ___R: ::fidl_next::Encode<
3828 crate::wire::ElementControlRegisterDependencyTokenRequest,
3829 <___T as ::fidl_next::Transport>::SendBuffer,
3830 >,
3831 {
3832 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3833 4201883080704232801,
3834 <super::RegisterDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3835 request,
3836 ))
3837 }
3838
3839 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3840 pub fn unregister_dependency_token(
3841 &self,
3842
3843 token: impl ::fidl_next::Encode<
3844 ::fidl_next::wire::fuchsia::Event,
3845 <___T as ::fidl_next::Transport>::SendBuffer,
3846 >,
3847 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterDependencyToken, ___T>
3848 where
3849 <___T as ::fidl_next::Transport>::SendBuffer:
3850 ::fidl_next::encoder::InternalHandleEncoder,
3851 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3852 {
3853 self.unregister_dependency_token_with(
3854 crate::generic::ElementControlUnregisterDependencyTokenRequest { token },
3855 )
3856 }
3857
3858 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3859 pub fn unregister_dependency_token_with<___R>(
3860 &self,
3861 request: ___R,
3862 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterDependencyToken, ___T>
3863 where
3864 ___R: ::fidl_next::Encode<
3865 crate::wire::ElementControlUnregisterDependencyTokenRequest,
3866 <___T as ::fidl_next::Transport>::SendBuffer,
3867 >,
3868 {
3869 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3870 7323726239897326889,
3871 <super::UnregisterDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3872 request,
3873 ))
3874 }
3875
3876 #[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"]
3877 pub fn add_dependency_with<___R>(
3878 &self,
3879 request: ___R,
3880 ) -> ::fidl_next::TwoWayFuture<'_, super::AddDependency, ___T>
3881 where
3882 ___R: ::fidl_next::Encode<
3883 crate::wire::LevelDependency<'static>,
3884 <___T as ::fidl_next::Transport>::SendBuffer,
3885 >,
3886 {
3887 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3888 4463546978076627444,
3889 <super::AddDependency as ::fidl_next::Method>::FLEXIBILITY,
3890 request,
3891 ))
3892 }
3893 }
3894
3895 #[repr(transparent)]
3897 pub struct ElementControlServer<___T: ::fidl_next::Transport> {
3898 server: ::fidl_next::protocol::Server<___T>,
3899 }
3900
3901 impl<___T> ElementControlServer<___T> where ___T: ::fidl_next::Transport {}
3902 }
3903}
3904
3905#[diagnostic::on_unimplemented(
3906 note = "If {Self} implements the non-local ElementControlClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3907)]
3908
3909pub trait ElementControlLocalClientHandler<
3913 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3914 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3915>
3916{
3917 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3918 ::core::future::ready(())
3919 }
3920}
3921
3922impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ElementControl
3923where
3924 ___H: ElementControlLocalClientHandler<___T>,
3925 ___T: ::fidl_next::Transport,
3926{
3927 async fn on_event(
3928 handler: &mut ___H,
3929 mut message: ::fidl_next::Message<___T>,
3930 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3931 match *message.header().ordinal {
3932 ordinal => {
3933 handler.on_unknown_interaction(ordinal).await;
3934 if ::core::matches!(
3935 message.header().flexibility(),
3936 ::fidl_next::protocol::Flexibility::Strict
3937 ) {
3938 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3939 } else {
3940 Ok(())
3941 }
3942 }
3943 }
3944 }
3945}
3946
3947#[diagnostic::on_unimplemented(
3948 note = "If {Self} implements the non-local ElementControlServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3949)]
3950
3951pub trait ElementControlLocalServerHandler<
3955 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3956 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3957>
3958{
3959 #[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"]
3960 fn open_status_channel(
3961 &mut self,
3962
3963 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
3964 ) -> impl ::core::future::Future<Output = ()>;
3965
3966 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3967 fn register_dependency_token(
3968 &mut self,
3969
3970 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
3971
3972 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
3973 ) -> impl ::core::future::Future<Output = ()>;
3974
3975 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3976 fn unregister_dependency_token(
3977 &mut self,
3978
3979 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
3980
3981 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
3982 ) -> impl ::core::future::Future<Output = ()>;
3983
3984 #[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"]
3985 fn add_dependency(
3986 &mut self,
3987
3988 request: ::fidl_next::Request<element_control::AddDependency, ___T>,
3989
3990 responder: ::fidl_next::Responder<element_control::AddDependency, ___T>,
3991 ) -> impl ::core::future::Future<Output = ()>;
3992
3993 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3994 ::core::future::ready(())
3995 }
3996}
3997
3998impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ElementControl
3999where
4000 ___H: ElementControlLocalServerHandler<___T>,
4001 ___T: ::fidl_next::Transport,
4002 for<'de> crate::wire::ElementControlOpenStatusChannelRequest: ::fidl_next::Decode<
4003 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4004 Constraint = (),
4005 >,
4006 for<'de> crate::wire::ElementControlRegisterDependencyTokenRequest: ::fidl_next::Decode<
4007 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4008 Constraint = (),
4009 >,
4010 for<'de> crate::wire::ElementControlUnregisterDependencyTokenRequest: ::fidl_next::Decode<
4011 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4012 Constraint = (),
4013 >,
4014 for<'de> crate::wire::LevelDependency<'de>: ::fidl_next::Decode<
4015 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4016 Constraint = (),
4017 >,
4018{
4019 async fn on_one_way(
4020 handler: &mut ___H,
4021 mut message: ::fidl_next::Message<___T>,
4022 ) -> ::core::result::Result<
4023 (),
4024 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4025 > {
4026 match *message.header().ordinal {
4027 5582056609237590784 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
4028 Ok(decoded) => {
4029 handler.open_status_channel(::fidl_next::Request::from_decoded(decoded)).await;
4030 Ok(())
4031 }
4032 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4033 ordinal: 5582056609237590784,
4034 error,
4035 }),
4036 },
4037
4038 ordinal => {
4039 handler.on_unknown_interaction(ordinal).await;
4040 if ::core::matches!(
4041 message.header().flexibility(),
4042 ::fidl_next::protocol::Flexibility::Strict
4043 ) {
4044 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4045 } else {
4046 Ok(())
4047 }
4048 }
4049 }
4050 }
4051
4052 async fn on_two_way(
4053 handler: &mut ___H,
4054 mut message: ::fidl_next::Message<___T>,
4055 responder: ::fidl_next::protocol::Responder<___T>,
4056 ) -> ::core::result::Result<
4057 (),
4058 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4059 > {
4060 match *message.header().ordinal {
4061 4201883080704232801 => {
4062 let responder = ::fidl_next::Responder::from_untyped(responder);
4063
4064 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4065 Ok(decoded) => {
4066 handler
4067 .register_dependency_token(
4068 ::fidl_next::Request::from_decoded(decoded),
4069 responder,
4070 )
4071 .await;
4072 Ok(())
4073 }
4074 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4075 ordinal: 4201883080704232801,
4076 error,
4077 }),
4078 }
4079 }
4080
4081 7323726239897326889 => {
4082 let responder = ::fidl_next::Responder::from_untyped(responder);
4083
4084 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4085 Ok(decoded) => {
4086 handler
4087 .unregister_dependency_token(
4088 ::fidl_next::Request::from_decoded(decoded),
4089 responder,
4090 )
4091 .await;
4092 Ok(())
4093 }
4094 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4095 ordinal: 7323726239897326889,
4096 error,
4097 }),
4098 }
4099 }
4100
4101 4463546978076627444 => {
4102 let responder = ::fidl_next::Responder::from_untyped(responder);
4103
4104 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4105 Ok(decoded) => {
4106 handler
4107 .add_dependency(::fidl_next::Request::from_decoded(decoded), responder)
4108 .await;
4109 Ok(())
4110 }
4111 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4112 ordinal: 4463546978076627444,
4113 error,
4114 }),
4115 }
4116 }
4117
4118 ordinal => {
4119 handler.on_unknown_interaction(ordinal).await;
4120 if ::core::matches!(
4121 message.header().flexibility(),
4122 ::fidl_next::protocol::Flexibility::Strict
4123 ) {
4124 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4125 } else {
4126 responder
4127 .respond_framework_error(
4128 ordinal,
4129 ::fidl_next::FrameworkError::UnknownMethod,
4130 )
4131 .expect("encoding a framework error should never fail")
4132 .await?;
4133 Ok(())
4134 }
4135 }
4136 }
4137 }
4138}
4139
4140pub trait ElementControlClientHandler<
4144 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4145 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4146>
4147{
4148 fn on_unknown_interaction(
4149 &mut self,
4150 ordinal: u64,
4151 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4152 ::core::future::ready(())
4153 }
4154}
4155
4156impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ElementControl
4157where
4158 ___H: ElementControlClientHandler<___T> + ::core::marker::Send,
4159 ___T: ::fidl_next::Transport,
4160{
4161 async fn on_event(
4162 handler: &mut ___H,
4163 mut message: ::fidl_next::Message<___T>,
4164 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4165 match *message.header().ordinal {
4166 ordinal => {
4167 handler.on_unknown_interaction(ordinal).await;
4168 if ::core::matches!(
4169 message.header().flexibility(),
4170 ::fidl_next::protocol::Flexibility::Strict
4171 ) {
4172 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4173 } else {
4174 Ok(())
4175 }
4176 }
4177 }
4178 }
4179}
4180
4181pub trait ElementControlServerHandler<
4185 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4186 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4187>
4188{
4189 #[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"]
4190 fn open_status_channel(
4191 &mut self,
4192
4193 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
4194 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4195
4196 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
4197 fn register_dependency_token(
4198 &mut self,
4199
4200 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
4201
4202 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
4203 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4204
4205 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
4206 fn unregister_dependency_token(
4207 &mut self,
4208
4209 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
4210
4211 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
4212 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4213
4214 #[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"]
4215 fn add_dependency(
4216 &mut self,
4217
4218 request: ::fidl_next::Request<element_control::AddDependency, ___T>,
4219
4220 responder: ::fidl_next::Responder<element_control::AddDependency, ___T>,
4221 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4222
4223 fn on_unknown_interaction(
4224 &mut self,
4225 ordinal: u64,
4226 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4227 ::core::future::ready(())
4228 }
4229}
4230
4231impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ElementControl
4232where
4233 ___H: ElementControlServerHandler<___T> + ::core::marker::Send,
4234 ___T: ::fidl_next::Transport,
4235 for<'de> crate::wire::ElementControlOpenStatusChannelRequest: ::fidl_next::Decode<
4236 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4237 Constraint = (),
4238 >,
4239 for<'de> crate::wire::ElementControlRegisterDependencyTokenRequest: ::fidl_next::Decode<
4240 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4241 Constraint = (),
4242 >,
4243 for<'de> crate::wire::ElementControlUnregisterDependencyTokenRequest: ::fidl_next::Decode<
4244 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4245 Constraint = (),
4246 >,
4247 for<'de> crate::wire::LevelDependency<'de>: ::fidl_next::Decode<
4248 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4249 Constraint = (),
4250 >,
4251{
4252 async fn on_one_way(
4253 handler: &mut ___H,
4254 mut message: ::fidl_next::Message<___T>,
4255 ) -> ::core::result::Result<
4256 (),
4257 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4258 > {
4259 match *message.header().ordinal {
4260 5582056609237590784 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
4261 Ok(decoded) => {
4262 handler.open_status_channel(::fidl_next::Request::from_decoded(decoded)).await;
4263 Ok(())
4264 }
4265 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4266 ordinal: 5582056609237590784,
4267 error,
4268 }),
4269 },
4270
4271 ordinal => {
4272 handler.on_unknown_interaction(ordinal).await;
4273 if ::core::matches!(
4274 message.header().flexibility(),
4275 ::fidl_next::protocol::Flexibility::Strict
4276 ) {
4277 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4278 } else {
4279 Ok(())
4280 }
4281 }
4282 }
4283 }
4284
4285 async fn on_two_way(
4286 handler: &mut ___H,
4287 mut message: ::fidl_next::Message<___T>,
4288 responder: ::fidl_next::protocol::Responder<___T>,
4289 ) -> ::core::result::Result<
4290 (),
4291 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4292 > {
4293 match *message.header().ordinal {
4294 4201883080704232801 => {
4295 let responder = ::fidl_next::Responder::from_untyped(responder);
4296
4297 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4298 Ok(decoded) => {
4299 handler
4300 .register_dependency_token(
4301 ::fidl_next::Request::from_decoded(decoded),
4302 responder,
4303 )
4304 .await;
4305 Ok(())
4306 }
4307 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4308 ordinal: 4201883080704232801,
4309 error,
4310 }),
4311 }
4312 }
4313
4314 7323726239897326889 => {
4315 let responder = ::fidl_next::Responder::from_untyped(responder);
4316
4317 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4318 Ok(decoded) => {
4319 handler
4320 .unregister_dependency_token(
4321 ::fidl_next::Request::from_decoded(decoded),
4322 responder,
4323 )
4324 .await;
4325 Ok(())
4326 }
4327 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4328 ordinal: 7323726239897326889,
4329 error,
4330 }),
4331 }
4332 }
4333
4334 4463546978076627444 => {
4335 let responder = ::fidl_next::Responder::from_untyped(responder);
4336
4337 match ::fidl_next::AsDecoderExt::into_decoded(message) {
4338 Ok(decoded) => {
4339 handler
4340 .add_dependency(::fidl_next::Request::from_decoded(decoded), responder)
4341 .await;
4342 Ok(())
4343 }
4344 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4345 ordinal: 4463546978076627444,
4346 error,
4347 }),
4348 }
4349 }
4350
4351 ordinal => {
4352 handler.on_unknown_interaction(ordinal).await;
4353 if ::core::matches!(
4354 message.header().flexibility(),
4355 ::fidl_next::protocol::Flexibility::Strict
4356 ) {
4357 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4358 } else {
4359 responder
4360 .respond_framework_error(
4361 ordinal,
4362 ::fidl_next::FrameworkError::UnknownMethod,
4363 )
4364 .expect("encoding a framework error should never fail")
4365 .await?;
4366 Ok(())
4367 }
4368 }
4369 }
4370 }
4371}
4372
4373impl<___T> ElementControlClientHandler<___T> for ::fidl_next::IgnoreEvents
4374where
4375 ___T: ::fidl_next::Transport,
4376{
4377 async fn on_unknown_interaction(&mut self, _: u64) {}
4378}
4379
4380impl<___H, ___T> ElementControlLocalClientHandler<___T> for ::fidl_next::Local<___H>
4381where
4382 ___H: ElementControlClientHandler<___T>,
4383 ___T: ::fidl_next::Transport,
4384{
4385 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4386 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4387 }
4388}
4389
4390impl<___H, ___T> ElementControlLocalServerHandler<___T> for ::fidl_next::Local<___H>
4391where
4392 ___H: ElementControlServerHandler<___T>,
4393 ___T: ::fidl_next::Transport,
4394{
4395 async fn open_status_channel(
4396 &mut self,
4397
4398 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
4399 ) {
4400 ___H::open_status_channel(&mut self.0, request).await
4401 }
4402
4403 async fn register_dependency_token(
4404 &mut self,
4405
4406 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
4407
4408 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
4409 ) {
4410 ___H::register_dependency_token(&mut self.0, request, responder).await
4411 }
4412
4413 async fn unregister_dependency_token(
4414 &mut self,
4415
4416 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
4417
4418 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
4419 ) {
4420 ___H::unregister_dependency_token(&mut self.0, request, responder).await
4421 }
4422
4423 async fn add_dependency(
4424 &mut self,
4425
4426 request: ::fidl_next::Request<element_control::AddDependency, ___T>,
4427
4428 responder: ::fidl_next::Responder<element_control::AddDependency, ___T>,
4429 ) {
4430 ___H::add_dependency(&mut self.0, request, responder).await
4431 }
4432
4433 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4434 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4435 }
4436}
4437
4438#[doc = " Provides an interface to retrieve information about PowerElements managed by a component.\n"]
4440#[derive(PartialEq, Debug)]
4441pub struct ElementInfoProvider;
4442
4443impl ::fidl_next::Discoverable for ElementInfoProvider {
4444 const PROTOCOL_NAME: &'static str = "fuchsia.power.broker.ElementInfoProvider";
4445}
4446
4447#[cfg(target_os = "fuchsia")]
4448impl ::fidl_next::HasTransport for ElementInfoProvider {
4449 type Transport = ::fidl_next::fuchsia::zx::Channel;
4450}
4451
4452pub mod element_info_provider {
4453 pub mod prelude {
4454 pub use crate::{
4455 ElementInfoProvider, ElementInfoProviderClientHandler,
4456 ElementInfoProviderLocalClientHandler, ElementInfoProviderLocalServerHandler,
4457 ElementInfoProviderServerHandler, element_info_provider,
4458 };
4459
4460 pub use crate::natural::ElementInfoProviderError;
4461
4462 pub use crate::natural::ElementInfoProviderGetElementPowerLevelNamesResponse;
4463
4464 pub use crate::natural::ElementInfoProviderGetStatusEndpointsResponse;
4465 }
4466
4467 pub struct GetElementPowerLevelNames;
4468
4469 impl ::fidl_next::Method for GetElementPowerLevelNames {
4470 const ORDINAL: u64 = 2994721713524698441;
4471 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4472 ::fidl_next::protocol::Flexibility::Flexible;
4473
4474 type Protocol = crate::ElementInfoProvider;
4475
4476 type Request = ::fidl_next::wire::EmptyMessageBody;
4477 }
4478
4479 impl ::fidl_next::TwoWayMethod for GetElementPowerLevelNames {
4480 type Response = ::fidl_next::wire::Result<
4481 'static,
4482 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
4483 crate::wire::ElementInfoProviderError,
4484 >;
4485 }
4486
4487 impl<___R> ::fidl_next::Respond<___R> for GetElementPowerLevelNames {
4488 type Output = ::core::result::Result<
4489 crate::generic::ElementInfoProviderGetElementPowerLevelNamesResponse<___R>,
4490 ::fidl_next::never::Never,
4491 >;
4492
4493 fn respond(response: ___R) -> Self::Output {
4494 ::core::result::Result::Ok(
4495 crate::generic::ElementInfoProviderGetElementPowerLevelNamesResponse {
4496 level_names: response,
4497 },
4498 )
4499 }
4500 }
4501
4502 impl<___R> ::fidl_next::RespondErr<___R> for GetElementPowerLevelNames {
4503 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
4504
4505 fn respond_err(response: ___R) -> Self::Output {
4506 ::core::result::Result::Err(response)
4507 }
4508 }
4509
4510 pub struct GetStatusEndpoints;
4511
4512 impl ::fidl_next::Method for GetStatusEndpoints {
4513 const ORDINAL: u64 = 5003265455430858620;
4514 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4515 ::fidl_next::protocol::Flexibility::Flexible;
4516
4517 type Protocol = crate::ElementInfoProvider;
4518
4519 type Request = ::fidl_next::wire::EmptyMessageBody;
4520 }
4521
4522 impl ::fidl_next::TwoWayMethod for GetStatusEndpoints {
4523 type Response = ::fidl_next::wire::Result<
4524 'static,
4525 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
4526 crate::wire::ElementInfoProviderError,
4527 >;
4528 }
4529
4530 impl<___R> ::fidl_next::Respond<___R> for GetStatusEndpoints {
4531 type Output = ::core::result::Result<
4532 crate::generic::ElementInfoProviderGetStatusEndpointsResponse<___R>,
4533 ::fidl_next::never::Never,
4534 >;
4535
4536 fn respond(response: ___R) -> Self::Output {
4537 ::core::result::Result::Ok(
4538 crate::generic::ElementInfoProviderGetStatusEndpointsResponse {
4539 endpoints: response,
4540 },
4541 )
4542 }
4543 }
4544
4545 impl<___R> ::fidl_next::RespondErr<___R> for GetStatusEndpoints {
4546 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
4547
4548 fn respond_err(response: ___R) -> Self::Output {
4549 ::core::result::Result::Err(response)
4550 }
4551 }
4552
4553 mod ___detail {
4554 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ElementInfoProvider
4555 where
4556 ___T: ::fidl_next::Transport,
4557 {
4558 type Client = ElementInfoProviderClient<___T>;
4559 type Server = ElementInfoProviderServer<___T>;
4560 }
4561
4562 #[repr(transparent)]
4564 pub struct ElementInfoProviderClient<___T: ::fidl_next::Transport> {
4565 #[allow(dead_code)]
4566 client: ::fidl_next::protocol::Client<___T>,
4567 }
4568
4569 impl<___T> ElementInfoProviderClient<___T>
4570 where
4571 ___T: ::fidl_next::Transport,
4572 {
4573 #[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"]
4574 pub fn get_element_power_level_names(
4575 &self,
4576 ) -> ::fidl_next::TwoWayFuture<'_, super::GetElementPowerLevelNames, ___T> {
4577 ::fidl_next::TwoWayFuture::from_untyped(
4578 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4579 2994721713524698441,
4580 <super::GetElementPowerLevelNames as ::fidl_next::Method>::FLEXIBILITY,
4581 (),
4582 ),
4583 )
4584 }
4585
4586 #[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"]
4587 pub fn get_status_endpoints(
4588 &self,
4589 ) -> ::fidl_next::TwoWayFuture<'_, super::GetStatusEndpoints, ___T> {
4590 ::fidl_next::TwoWayFuture::from_untyped(
4591 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4592 5003265455430858620,
4593 <super::GetStatusEndpoints as ::fidl_next::Method>::FLEXIBILITY,
4594 (),
4595 ),
4596 )
4597 }
4598 }
4599
4600 #[repr(transparent)]
4602 pub struct ElementInfoProviderServer<___T: ::fidl_next::Transport> {
4603 server: ::fidl_next::protocol::Server<___T>,
4604 }
4605
4606 impl<___T> ElementInfoProviderServer<___T> where ___T: ::fidl_next::Transport {}
4607 }
4608}
4609
4610#[diagnostic::on_unimplemented(
4611 note = "If {Self} implements the non-local ElementInfoProviderClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4612)]
4613
4614pub trait ElementInfoProviderLocalClientHandler<
4618 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4619 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4620>
4621{
4622 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4623 ::core::future::ready(())
4624 }
4625}
4626
4627impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ElementInfoProvider
4628where
4629 ___H: ElementInfoProviderLocalClientHandler<___T>,
4630 ___T: ::fidl_next::Transport,
4631{
4632 async fn on_event(
4633 handler: &mut ___H,
4634 mut message: ::fidl_next::Message<___T>,
4635 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4636 match *message.header().ordinal {
4637 ordinal => {
4638 handler.on_unknown_interaction(ordinal).await;
4639 if ::core::matches!(
4640 message.header().flexibility(),
4641 ::fidl_next::protocol::Flexibility::Strict
4642 ) {
4643 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4644 } else {
4645 Ok(())
4646 }
4647 }
4648 }
4649 }
4650}
4651
4652#[diagnostic::on_unimplemented(
4653 note = "If {Self} implements the non-local ElementInfoProviderServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4654)]
4655
4656pub trait ElementInfoProviderLocalServerHandler<
4660 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4661 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4662>
4663{
4664 #[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"]
4665 fn get_element_power_level_names(
4666 &mut self,
4667
4668 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4669 ) -> impl ::core::future::Future<Output = ()>;
4670
4671 #[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"]
4672 fn get_status_endpoints(
4673 &mut self,
4674
4675 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4676 ) -> impl ::core::future::Future<Output = ()>;
4677
4678 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4679 ::core::future::ready(())
4680 }
4681}
4682
4683impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ElementInfoProvider
4684where
4685 ___H: ElementInfoProviderLocalServerHandler<___T>,
4686 ___T: ::fidl_next::Transport,
4687{
4688 async fn on_one_way(
4689 handler: &mut ___H,
4690 mut message: ::fidl_next::Message<___T>,
4691 ) -> ::core::result::Result<
4692 (),
4693 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4694 > {
4695 match *message.header().ordinal {
4696 ordinal => {
4697 handler.on_unknown_interaction(ordinal).await;
4698 if ::core::matches!(
4699 message.header().flexibility(),
4700 ::fidl_next::protocol::Flexibility::Strict
4701 ) {
4702 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4703 } else {
4704 Ok(())
4705 }
4706 }
4707 }
4708 }
4709
4710 async fn on_two_way(
4711 handler: &mut ___H,
4712 mut message: ::fidl_next::Message<___T>,
4713 responder: ::fidl_next::protocol::Responder<___T>,
4714 ) -> ::core::result::Result<
4715 (),
4716 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4717 > {
4718 match *message.header().ordinal {
4719 2994721713524698441 => {
4720 let responder = ::fidl_next::Responder::from_untyped(responder);
4721
4722 handler.get_element_power_level_names(responder).await;
4723 Ok(())
4724 }
4725
4726 5003265455430858620 => {
4727 let responder = ::fidl_next::Responder::from_untyped(responder);
4728
4729 handler.get_status_endpoints(responder).await;
4730 Ok(())
4731 }
4732
4733 ordinal => {
4734 handler.on_unknown_interaction(ordinal).await;
4735 if ::core::matches!(
4736 message.header().flexibility(),
4737 ::fidl_next::protocol::Flexibility::Strict
4738 ) {
4739 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4740 } else {
4741 responder
4742 .respond_framework_error(
4743 ordinal,
4744 ::fidl_next::FrameworkError::UnknownMethod,
4745 )
4746 .expect("encoding a framework error should never fail")
4747 .await?;
4748 Ok(())
4749 }
4750 }
4751 }
4752 }
4753}
4754
4755pub trait ElementInfoProviderClientHandler<
4759 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4760 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4761>
4762{
4763 fn on_unknown_interaction(
4764 &mut self,
4765 ordinal: u64,
4766 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4767 ::core::future::ready(())
4768 }
4769}
4770
4771impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ElementInfoProvider
4772where
4773 ___H: ElementInfoProviderClientHandler<___T> + ::core::marker::Send,
4774 ___T: ::fidl_next::Transport,
4775{
4776 async fn on_event(
4777 handler: &mut ___H,
4778 mut message: ::fidl_next::Message<___T>,
4779 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4780 match *message.header().ordinal {
4781 ordinal => {
4782 handler.on_unknown_interaction(ordinal).await;
4783 if ::core::matches!(
4784 message.header().flexibility(),
4785 ::fidl_next::protocol::Flexibility::Strict
4786 ) {
4787 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4788 } else {
4789 Ok(())
4790 }
4791 }
4792 }
4793 }
4794}
4795
4796pub trait ElementInfoProviderServerHandler<
4800 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4801 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4802>
4803{
4804 #[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"]
4805 fn get_element_power_level_names(
4806 &mut self,
4807
4808 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4809 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4810
4811 #[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"]
4812 fn get_status_endpoints(
4813 &mut self,
4814
4815 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4816 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4817
4818 fn on_unknown_interaction(
4819 &mut self,
4820 ordinal: u64,
4821 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4822 ::core::future::ready(())
4823 }
4824}
4825
4826impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ElementInfoProvider
4827where
4828 ___H: ElementInfoProviderServerHandler<___T> + ::core::marker::Send,
4829 ___T: ::fidl_next::Transport,
4830{
4831 async fn on_one_way(
4832 handler: &mut ___H,
4833 mut message: ::fidl_next::Message<___T>,
4834 ) -> ::core::result::Result<
4835 (),
4836 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4837 > {
4838 match *message.header().ordinal {
4839 ordinal => {
4840 handler.on_unknown_interaction(ordinal).await;
4841 if ::core::matches!(
4842 message.header().flexibility(),
4843 ::fidl_next::protocol::Flexibility::Strict
4844 ) {
4845 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4846 } else {
4847 Ok(())
4848 }
4849 }
4850 }
4851 }
4852
4853 async fn on_two_way(
4854 handler: &mut ___H,
4855 mut message: ::fidl_next::Message<___T>,
4856 responder: ::fidl_next::protocol::Responder<___T>,
4857 ) -> ::core::result::Result<
4858 (),
4859 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4860 > {
4861 match *message.header().ordinal {
4862 2994721713524698441 => {
4863 let responder = ::fidl_next::Responder::from_untyped(responder);
4864
4865 handler.get_element_power_level_names(responder).await;
4866 Ok(())
4867 }
4868
4869 5003265455430858620 => {
4870 let responder = ::fidl_next::Responder::from_untyped(responder);
4871
4872 handler.get_status_endpoints(responder).await;
4873 Ok(())
4874 }
4875
4876 ordinal => {
4877 handler.on_unknown_interaction(ordinal).await;
4878 if ::core::matches!(
4879 message.header().flexibility(),
4880 ::fidl_next::protocol::Flexibility::Strict
4881 ) {
4882 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4883 } else {
4884 responder
4885 .respond_framework_error(
4886 ordinal,
4887 ::fidl_next::FrameworkError::UnknownMethod,
4888 )
4889 .expect("encoding a framework error should never fail")
4890 .await?;
4891 Ok(())
4892 }
4893 }
4894 }
4895 }
4896}
4897
4898impl<___T> ElementInfoProviderClientHandler<___T> for ::fidl_next::IgnoreEvents
4899where
4900 ___T: ::fidl_next::Transport,
4901{
4902 async fn on_unknown_interaction(&mut self, _: u64) {}
4903}
4904
4905impl<___H, ___T> ElementInfoProviderLocalClientHandler<___T> for ::fidl_next::Local<___H>
4906where
4907 ___H: ElementInfoProviderClientHandler<___T>,
4908 ___T: ::fidl_next::Transport,
4909{
4910 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4911 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4912 }
4913}
4914
4915impl<___H, ___T> ElementInfoProviderLocalServerHandler<___T> for ::fidl_next::Local<___H>
4916where
4917 ___H: ElementInfoProviderServerHandler<___T>,
4918 ___T: ::fidl_next::Transport,
4919{
4920 async fn get_element_power_level_names(
4921 &mut self,
4922
4923 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4924 ) {
4925 ___H::get_element_power_level_names(&mut self.0, responder).await
4926 }
4927
4928 async fn get_status_endpoints(
4929 &mut self,
4930
4931 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4932 ) {
4933 ___H::get_status_endpoints(&mut self.0, responder).await
4934 }
4935
4936 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4937 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4938 }
4939}
4940
4941#[derive(Debug)]
4943pub struct ElementInfoProviderService;
4944
4945impl ::fidl_next::DiscoverableService for ElementInfoProviderService {
4946 const SERVICE_NAME: &'static str = "fuchsia.power.broker.ElementInfoProviderService";
4947 const MEMBER_NAMES: &'static [&'static str] = &["status_provider"];
4948}
4949
4950impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel>
4951 for ElementInfoProviderService
4952{
4953}
4954
4955impl<___C> ::fidl_next::Service<___C> for ElementInfoProviderService
4956where
4957 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
4958{
4959 type Connector = ElementInfoProviderServiceConnector<___C>;
4960}
4961
4962#[repr(transparent)]
4964pub struct ElementInfoProviderServiceConnector<___C> {
4965 #[allow(dead_code)]
4966 connector: ___C,
4967}
4968
4969impl<___C> ElementInfoProviderServiceConnector<___C>
4970where
4971 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
4972{
4973 pub fn status_provider(
4975 &self,
4976 server_end: ::fidl_next::ServerEnd<
4977 crate::ElementInfoProvider,
4978 ::fidl_next::fuchsia::zx::Channel,
4979 >,
4980 ) -> ::core::result::Result<
4981 (),
4982 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
4983 > {
4984 ::fidl_next::protocol::ServiceConnector::<
4985 ::fidl_next::fuchsia::zx::Channel
4986 >::connect_to_member(
4987 &self.connector,
4988 "status_provider",
4989 server_end.into_untyped(),
4990 )
4991 }
4992}
4993
4994pub trait ElementInfoProviderServiceHandler {
4996 fn status_provider(
4998 &self,
4999 server_end: ::fidl_next::ServerEnd<
5000 crate::ElementInfoProvider,
5001 ::fidl_next::fuchsia::zx::Channel,
5002 >,
5003 );
5004}
5005
5006impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for ElementInfoProviderService
5007where
5008 ___H: ElementInfoProviderServiceHandler,
5009 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
5010{
5011 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
5012 use ::fidl_next::InstanceFromServiceTransport;
5013 match member {
5014 "status_provider" => handler.status_provider(::fidl_next::ServerEnd::from_untyped(
5015 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
5016 )),
5017
5018 _ => unreachable!(),
5019 }
5020 }
5021}
5022
5023#[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"]
5025#[derive(PartialEq, Debug)]
5026pub struct Lessor;
5027
5028#[cfg(target_os = "fuchsia")]
5029impl ::fidl_next::HasTransport for Lessor {
5030 type Transport = ::fidl_next::fuchsia::zx::Channel;
5031}
5032
5033pub mod lessor {
5034 pub mod prelude {
5035 pub use crate::{
5036 Lessor, LessorClientHandler, LessorLocalClientHandler, LessorLocalServerHandler,
5037 LessorServerHandler, lessor,
5038 };
5039
5040 pub use crate::natural::LeaseError;
5041
5042 pub use crate::natural::LessorLeaseRequest;
5043
5044 pub use crate::natural::LessorLeaseResponse;
5045 }
5046
5047 pub struct Lease;
5048
5049 impl ::fidl_next::Method for Lease {
5050 const ORDINAL: u64 = 4078466329847396781;
5051 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5052 ::fidl_next::protocol::Flexibility::Flexible;
5053
5054 type Protocol = crate::Lessor;
5055
5056 type Request = crate::wire::LessorLeaseRequest;
5057 }
5058
5059 impl ::fidl_next::TwoWayMethod for Lease {
5060 type Response = ::fidl_next::wire::Result<
5061 'static,
5062 crate::wire::LessorLeaseResponse,
5063 crate::wire::LeaseError,
5064 >;
5065 }
5066
5067 impl<___R> ::fidl_next::Respond<___R> for Lease {
5068 type Output = ::core::result::Result<
5069 crate::generic::LessorLeaseResponse<___R>,
5070 ::fidl_next::never::Never,
5071 >;
5072
5073 fn respond(response: ___R) -> Self::Output {
5074 ::core::result::Result::Ok(crate::generic::LessorLeaseResponse {
5075 lease_control: response,
5076 })
5077 }
5078 }
5079
5080 impl<___R> ::fidl_next::RespondErr<___R> for Lease {
5081 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
5082
5083 fn respond_err(response: ___R) -> Self::Output {
5084 ::core::result::Result::Err(response)
5085 }
5086 }
5087
5088 mod ___detail {
5089 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Lessor
5090 where
5091 ___T: ::fidl_next::Transport,
5092 {
5093 type Client = LessorClient<___T>;
5094 type Server = LessorServer<___T>;
5095 }
5096
5097 #[repr(transparent)]
5099 pub struct LessorClient<___T: ::fidl_next::Transport> {
5100 #[allow(dead_code)]
5101 client: ::fidl_next::protocol::Client<___T>,
5102 }
5103
5104 impl<___T> LessorClient<___T>
5105 where
5106 ___T: ::fidl_next::Transport,
5107 {
5108 #[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"]
5109 pub fn lease(
5110 &self,
5111
5112 level: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
5113 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
5114 where
5115 <___T as ::fidl_next::Transport>::SendBuffer:
5116 ::fidl_next::encoder::InternalHandleEncoder,
5117 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
5118 {
5119 self.lease_with(crate::generic::LessorLeaseRequest { level })
5120 }
5121
5122 #[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"]
5123 pub fn lease_with<___R>(
5124 &self,
5125 request: ___R,
5126 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
5127 where
5128 ___R: ::fidl_next::Encode<
5129 crate::wire::LessorLeaseRequest,
5130 <___T as ::fidl_next::Transport>::SendBuffer,
5131 >,
5132 {
5133 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5134 4078466329847396781,
5135 <super::Lease as ::fidl_next::Method>::FLEXIBILITY,
5136 request,
5137 ))
5138 }
5139 }
5140
5141 #[repr(transparent)]
5143 pub struct LessorServer<___T: ::fidl_next::Transport> {
5144 server: ::fidl_next::protocol::Server<___T>,
5145 }
5146
5147 impl<___T> LessorServer<___T> where ___T: ::fidl_next::Transport {}
5148 }
5149}
5150
5151#[diagnostic::on_unimplemented(
5152 note = "If {Self} implements the non-local LessorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5153)]
5154
5155pub trait LessorLocalClientHandler<
5159 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5160 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5161>
5162{
5163 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5164 ::core::future::ready(())
5165 }
5166}
5167
5168impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Lessor
5169where
5170 ___H: LessorLocalClientHandler<___T>,
5171 ___T: ::fidl_next::Transport,
5172{
5173 async fn on_event(
5174 handler: &mut ___H,
5175 mut message: ::fidl_next::Message<___T>,
5176 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5177 match *message.header().ordinal {
5178 ordinal => {
5179 handler.on_unknown_interaction(ordinal).await;
5180 if ::core::matches!(
5181 message.header().flexibility(),
5182 ::fidl_next::protocol::Flexibility::Strict
5183 ) {
5184 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5185 } else {
5186 Ok(())
5187 }
5188 }
5189 }
5190 }
5191}
5192
5193#[diagnostic::on_unimplemented(
5194 note = "If {Self} implements the non-local LessorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5195)]
5196
5197pub trait LessorLocalServerHandler<
5201 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5202 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5203>
5204{
5205 #[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"]
5206 fn lease(
5207 &mut self,
5208
5209 request: ::fidl_next::Request<lessor::Lease, ___T>,
5210
5211 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
5212 ) -> impl ::core::future::Future<Output = ()>;
5213
5214 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5215 ::core::future::ready(())
5216 }
5217}
5218
5219impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Lessor
5220where
5221 ___H: LessorLocalServerHandler<___T>,
5222 ___T: ::fidl_next::Transport,
5223 for<'de> crate::wire::LessorLeaseRequest: ::fidl_next::Decode<
5224 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5225 Constraint = (),
5226 >,
5227{
5228 async fn on_one_way(
5229 handler: &mut ___H,
5230 mut message: ::fidl_next::Message<___T>,
5231 ) -> ::core::result::Result<
5232 (),
5233 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5234 > {
5235 match *message.header().ordinal {
5236 ordinal => {
5237 handler.on_unknown_interaction(ordinal).await;
5238 if ::core::matches!(
5239 message.header().flexibility(),
5240 ::fidl_next::protocol::Flexibility::Strict
5241 ) {
5242 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5243 } else {
5244 Ok(())
5245 }
5246 }
5247 }
5248 }
5249
5250 async fn on_two_way(
5251 handler: &mut ___H,
5252 mut message: ::fidl_next::Message<___T>,
5253 responder: ::fidl_next::protocol::Responder<___T>,
5254 ) -> ::core::result::Result<
5255 (),
5256 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5257 > {
5258 match *message.header().ordinal {
5259 4078466329847396781 => {
5260 let responder = ::fidl_next::Responder::from_untyped(responder);
5261
5262 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5263 Ok(decoded) => {
5264 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
5265 Ok(())
5266 }
5267 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5268 ordinal: 4078466329847396781,
5269 error,
5270 }),
5271 }
5272 }
5273
5274 ordinal => {
5275 handler.on_unknown_interaction(ordinal).await;
5276 if ::core::matches!(
5277 message.header().flexibility(),
5278 ::fidl_next::protocol::Flexibility::Strict
5279 ) {
5280 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5281 } else {
5282 responder
5283 .respond_framework_error(
5284 ordinal,
5285 ::fidl_next::FrameworkError::UnknownMethod,
5286 )
5287 .expect("encoding a framework error should never fail")
5288 .await?;
5289 Ok(())
5290 }
5291 }
5292 }
5293 }
5294}
5295
5296pub trait LessorClientHandler<
5300 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5301 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5302>
5303{
5304 fn on_unknown_interaction(
5305 &mut self,
5306 ordinal: u64,
5307 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5308 ::core::future::ready(())
5309 }
5310}
5311
5312impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Lessor
5313where
5314 ___H: LessorClientHandler<___T> + ::core::marker::Send,
5315 ___T: ::fidl_next::Transport,
5316{
5317 async fn on_event(
5318 handler: &mut ___H,
5319 mut message: ::fidl_next::Message<___T>,
5320 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5321 match *message.header().ordinal {
5322 ordinal => {
5323 handler.on_unknown_interaction(ordinal).await;
5324 if ::core::matches!(
5325 message.header().flexibility(),
5326 ::fidl_next::protocol::Flexibility::Strict
5327 ) {
5328 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5329 } else {
5330 Ok(())
5331 }
5332 }
5333 }
5334 }
5335}
5336
5337pub trait LessorServerHandler<
5341 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5342 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5343>
5344{
5345 #[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"]
5346 fn lease(
5347 &mut self,
5348
5349 request: ::fidl_next::Request<lessor::Lease, ___T>,
5350
5351 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
5352 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5353
5354 fn on_unknown_interaction(
5355 &mut self,
5356 ordinal: u64,
5357 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5358 ::core::future::ready(())
5359 }
5360}
5361
5362impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Lessor
5363where
5364 ___H: LessorServerHandler<___T> + ::core::marker::Send,
5365 ___T: ::fidl_next::Transport,
5366 for<'de> crate::wire::LessorLeaseRequest: ::fidl_next::Decode<
5367 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5368 Constraint = (),
5369 >,
5370{
5371 async fn on_one_way(
5372 handler: &mut ___H,
5373 mut message: ::fidl_next::Message<___T>,
5374 ) -> ::core::result::Result<
5375 (),
5376 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5377 > {
5378 match *message.header().ordinal {
5379 ordinal => {
5380 handler.on_unknown_interaction(ordinal).await;
5381 if ::core::matches!(
5382 message.header().flexibility(),
5383 ::fidl_next::protocol::Flexibility::Strict
5384 ) {
5385 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5386 } else {
5387 Ok(())
5388 }
5389 }
5390 }
5391 }
5392
5393 async fn on_two_way(
5394 handler: &mut ___H,
5395 mut message: ::fidl_next::Message<___T>,
5396 responder: ::fidl_next::protocol::Responder<___T>,
5397 ) -> ::core::result::Result<
5398 (),
5399 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5400 > {
5401 match *message.header().ordinal {
5402 4078466329847396781 => {
5403 let responder = ::fidl_next::Responder::from_untyped(responder);
5404
5405 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5406 Ok(decoded) => {
5407 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
5408 Ok(())
5409 }
5410 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5411 ordinal: 4078466329847396781,
5412 error,
5413 }),
5414 }
5415 }
5416
5417 ordinal => {
5418 handler.on_unknown_interaction(ordinal).await;
5419 if ::core::matches!(
5420 message.header().flexibility(),
5421 ::fidl_next::protocol::Flexibility::Strict
5422 ) {
5423 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5424 } else {
5425 responder
5426 .respond_framework_error(
5427 ordinal,
5428 ::fidl_next::FrameworkError::UnknownMethod,
5429 )
5430 .expect("encoding a framework error should never fail")
5431 .await?;
5432 Ok(())
5433 }
5434 }
5435 }
5436 }
5437}
5438
5439impl<___T> LessorClientHandler<___T> for ::fidl_next::IgnoreEvents
5440where
5441 ___T: ::fidl_next::Transport,
5442{
5443 async fn on_unknown_interaction(&mut self, _: u64) {}
5444}
5445
5446impl<___H, ___T> LessorLocalClientHandler<___T> for ::fidl_next::Local<___H>
5447where
5448 ___H: LessorClientHandler<___T>,
5449 ___T: ::fidl_next::Transport,
5450{
5451 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5452 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5453 }
5454}
5455
5456impl<___H, ___T> LessorLocalServerHandler<___T> for ::fidl_next::Local<___H>
5457where
5458 ___H: LessorServerHandler<___T>,
5459 ___T: ::fidl_next::Transport,
5460{
5461 async fn lease(
5462 &mut self,
5463
5464 request: ::fidl_next::Request<lessor::Lease, ___T>,
5465
5466 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
5467 ) {
5468 ___H::lease(&mut self.0, request, responder).await
5469 }
5470
5471 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5472 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5473 }
5474}
5475
5476#[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"]
5478#[derive(PartialEq, Debug)]
5479pub struct Status;
5480
5481#[cfg(target_os = "fuchsia")]
5482impl ::fidl_next::HasTransport for Status {
5483 type Transport = ::fidl_next::fuchsia::zx::Channel;
5484}
5485
5486pub mod status {
5487 pub mod prelude {
5488 pub use crate::{
5489 Status, StatusClientHandler, StatusLocalClientHandler, StatusLocalServerHandler,
5490 StatusServerHandler, status,
5491 };
5492
5493 pub use crate::natural::StatusError;
5494
5495 pub use crate::natural::StatusWatchPowerLevelResponse;
5496 }
5497
5498 pub struct WatchPowerLevel;
5499
5500 impl ::fidl_next::Method for WatchPowerLevel {
5501 const ORDINAL: u64 = 3391697113329262926;
5502 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5503 ::fidl_next::protocol::Flexibility::Flexible;
5504
5505 type Protocol = crate::Status;
5506
5507 type Request = ::fidl_next::wire::EmptyMessageBody;
5508 }
5509
5510 impl ::fidl_next::TwoWayMethod for WatchPowerLevel {
5511 type Response = ::fidl_next::wire::Result<
5512 'static,
5513 crate::wire::StatusWatchPowerLevelResponse,
5514 crate::wire::StatusError,
5515 >;
5516 }
5517
5518 impl<___R> ::fidl_next::Respond<___R> for WatchPowerLevel {
5519 type Output = ::core::result::Result<
5520 crate::generic::StatusWatchPowerLevelResponse<___R>,
5521 ::fidl_next::never::Never,
5522 >;
5523
5524 fn respond(response: ___R) -> Self::Output {
5525 ::core::result::Result::Ok(crate::generic::StatusWatchPowerLevelResponse {
5526 current_level: response,
5527 })
5528 }
5529 }
5530
5531 impl<___R> ::fidl_next::RespondErr<___R> for WatchPowerLevel {
5532 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
5533
5534 fn respond_err(response: ___R) -> Self::Output {
5535 ::core::result::Result::Err(response)
5536 }
5537 }
5538
5539 mod ___detail {
5540 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Status
5541 where
5542 ___T: ::fidl_next::Transport,
5543 {
5544 type Client = StatusClient<___T>;
5545 type Server = StatusServer<___T>;
5546 }
5547
5548 #[repr(transparent)]
5550 pub struct StatusClient<___T: ::fidl_next::Transport> {
5551 #[allow(dead_code)]
5552 client: ::fidl_next::protocol::Client<___T>,
5553 }
5554
5555 impl<___T> StatusClient<___T>
5556 where
5557 ___T: ::fidl_next::Transport,
5558 {
5559 #[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"]
5560 pub fn watch_power_level(
5561 &self,
5562 ) -> ::fidl_next::TwoWayFuture<'_, super::WatchPowerLevel, ___T> {
5563 ::fidl_next::TwoWayFuture::from_untyped(
5564 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
5565 3391697113329262926,
5566 <super::WatchPowerLevel as ::fidl_next::Method>::FLEXIBILITY,
5567 (),
5568 ),
5569 )
5570 }
5571 }
5572
5573 #[repr(transparent)]
5575 pub struct StatusServer<___T: ::fidl_next::Transport> {
5576 server: ::fidl_next::protocol::Server<___T>,
5577 }
5578
5579 impl<___T> StatusServer<___T> where ___T: ::fidl_next::Transport {}
5580 }
5581}
5582
5583#[diagnostic::on_unimplemented(
5584 note = "If {Self} implements the non-local StatusClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5585)]
5586
5587pub trait StatusLocalClientHandler<
5591 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5592 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5593>
5594{
5595 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5596 ::core::future::ready(())
5597 }
5598}
5599
5600impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Status
5601where
5602 ___H: StatusLocalClientHandler<___T>,
5603 ___T: ::fidl_next::Transport,
5604{
5605 async fn on_event(
5606 handler: &mut ___H,
5607 mut message: ::fidl_next::Message<___T>,
5608 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5609 match *message.header().ordinal {
5610 ordinal => {
5611 handler.on_unknown_interaction(ordinal).await;
5612 if ::core::matches!(
5613 message.header().flexibility(),
5614 ::fidl_next::protocol::Flexibility::Strict
5615 ) {
5616 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5617 } else {
5618 Ok(())
5619 }
5620 }
5621 }
5622 }
5623}
5624
5625#[diagnostic::on_unimplemented(
5626 note = "If {Self} implements the non-local StatusServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5627)]
5628
5629pub trait StatusLocalServerHandler<
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 = ()>;
5643
5644 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5645 ::core::future::ready(())
5646 }
5647}
5648
5649impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Status
5650where
5651 ___H: StatusLocalServerHandler<___T>,
5652 ___T: ::fidl_next::Transport,
5653{
5654 async fn on_one_way(
5655 handler: &mut ___H,
5656 mut message: ::fidl_next::Message<___T>,
5657 ) -> ::core::result::Result<
5658 (),
5659 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5660 > {
5661 match *message.header().ordinal {
5662 ordinal => {
5663 handler.on_unknown_interaction(ordinal).await;
5664 if ::core::matches!(
5665 message.header().flexibility(),
5666 ::fidl_next::protocol::Flexibility::Strict
5667 ) {
5668 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5669 } else {
5670 Ok(())
5671 }
5672 }
5673 }
5674 }
5675
5676 async fn on_two_way(
5677 handler: &mut ___H,
5678 mut message: ::fidl_next::Message<___T>,
5679 responder: ::fidl_next::protocol::Responder<___T>,
5680 ) -> ::core::result::Result<
5681 (),
5682 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5683 > {
5684 match *message.header().ordinal {
5685 3391697113329262926 => {
5686 let responder = ::fidl_next::Responder::from_untyped(responder);
5687
5688 handler.watch_power_level(responder).await;
5689 Ok(())
5690 }
5691
5692 ordinal => {
5693 handler.on_unknown_interaction(ordinal).await;
5694 if ::core::matches!(
5695 message.header().flexibility(),
5696 ::fidl_next::protocol::Flexibility::Strict
5697 ) {
5698 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5699 } else {
5700 responder
5701 .respond_framework_error(
5702 ordinal,
5703 ::fidl_next::FrameworkError::UnknownMethod,
5704 )
5705 .expect("encoding a framework error should never fail")
5706 .await?;
5707 Ok(())
5708 }
5709 }
5710 }
5711 }
5712}
5713
5714pub trait StatusClientHandler<
5718 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5719 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5720>
5721{
5722 fn on_unknown_interaction(
5723 &mut self,
5724 ordinal: u64,
5725 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5726 ::core::future::ready(())
5727 }
5728}
5729
5730impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Status
5731where
5732 ___H: StatusClientHandler<___T> + ::core::marker::Send,
5733 ___T: ::fidl_next::Transport,
5734{
5735 async fn on_event(
5736 handler: &mut ___H,
5737 mut message: ::fidl_next::Message<___T>,
5738 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5739 match *message.header().ordinal {
5740 ordinal => {
5741 handler.on_unknown_interaction(ordinal).await;
5742 if ::core::matches!(
5743 message.header().flexibility(),
5744 ::fidl_next::protocol::Flexibility::Strict
5745 ) {
5746 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5747 } else {
5748 Ok(())
5749 }
5750 }
5751 }
5752 }
5753}
5754
5755pub trait StatusServerHandler<
5759 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5760 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5761>
5762{
5763 #[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"]
5764 fn watch_power_level(
5765 &mut self,
5766
5767 responder: ::fidl_next::Responder<status::WatchPowerLevel, ___T>,
5768 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5769
5770 fn on_unknown_interaction(
5771 &mut self,
5772 ordinal: u64,
5773 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5774 ::core::future::ready(())
5775 }
5776}
5777
5778impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Status
5779where
5780 ___H: StatusServerHandler<___T> + ::core::marker::Send,
5781 ___T: ::fidl_next::Transport,
5782{
5783 async fn on_one_way(
5784 handler: &mut ___H,
5785 mut message: ::fidl_next::Message<___T>,
5786 ) -> ::core::result::Result<
5787 (),
5788 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5789 > {
5790 match *message.header().ordinal {
5791 ordinal => {
5792 handler.on_unknown_interaction(ordinal).await;
5793 if ::core::matches!(
5794 message.header().flexibility(),
5795 ::fidl_next::protocol::Flexibility::Strict
5796 ) {
5797 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5798 } else {
5799 Ok(())
5800 }
5801 }
5802 }
5803 }
5804
5805 async fn on_two_way(
5806 handler: &mut ___H,
5807 mut message: ::fidl_next::Message<___T>,
5808 responder: ::fidl_next::protocol::Responder<___T>,
5809 ) -> ::core::result::Result<
5810 (),
5811 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5812 > {
5813 match *message.header().ordinal {
5814 3391697113329262926 => {
5815 let responder = ::fidl_next::Responder::from_untyped(responder);
5816
5817 handler.watch_power_level(responder).await;
5818 Ok(())
5819 }
5820
5821 ordinal => {
5822 handler.on_unknown_interaction(ordinal).await;
5823 if ::core::matches!(
5824 message.header().flexibility(),
5825 ::fidl_next::protocol::Flexibility::Strict
5826 ) {
5827 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5828 } else {
5829 responder
5830 .respond_framework_error(
5831 ordinal,
5832 ::fidl_next::FrameworkError::UnknownMethod,
5833 )
5834 .expect("encoding a framework error should never fail")
5835 .await?;
5836 Ok(())
5837 }
5838 }
5839 }
5840 }
5841}
5842
5843impl<___T> StatusClientHandler<___T> for ::fidl_next::IgnoreEvents
5844where
5845 ___T: ::fidl_next::Transport,
5846{
5847 async fn on_unknown_interaction(&mut self, _: u64) {}
5848}
5849
5850impl<___H, ___T> StatusLocalClientHandler<___T> for ::fidl_next::Local<___H>
5851where
5852 ___H: StatusClientHandler<___T>,
5853 ___T: ::fidl_next::Transport,
5854{
5855 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5856 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5857 }
5858}
5859
5860impl<___H, ___T> StatusLocalServerHandler<___T> for ::fidl_next::Local<___H>
5861where
5862 ___H: StatusServerHandler<___T>,
5863 ___T: ::fidl_next::Transport,
5864{
5865 async fn watch_power_level(
5866 &mut self,
5867
5868 responder: ::fidl_next::Responder<status::WatchPowerLevel, ___T>,
5869 ) {
5870 ___H::watch_power_level(&mut self.0, responder).await
5871 }
5872
5873 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5874 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5875 }
5876}
5877
5878#[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"]
5880#[derive(PartialEq, Debug)]
5881pub struct Topology;
5882
5883impl ::fidl_next::Discoverable for Topology {
5884 const PROTOCOL_NAME: &'static str = "fuchsia.power.broker.Topology";
5885}
5886
5887#[cfg(target_os = "fuchsia")]
5888impl ::fidl_next::HasTransport for Topology {
5889 type Transport = ::fidl_next::fuchsia::zx::Channel;
5890}
5891
5892pub mod topology {
5893 pub mod prelude {
5894 pub use crate::{
5895 Topology, TopologyClientHandler, TopologyLocalClientHandler,
5896 TopologyLocalServerHandler, TopologyServerHandler, topology,
5897 };
5898
5899 pub use crate::natural::AddElementError;
5900
5901 pub use crate::natural::ElementSchema;
5902
5903 pub use crate::natural::LeaseError;
5904
5905 pub use crate::natural::LeaseSchema;
5906
5907 pub use crate::natural::TopologyAddElementResponse;
5908
5909 pub use crate::natural::TopologyLeaseResponse;
5910 }
5911
5912 pub struct AddElement;
5913
5914 impl ::fidl_next::Method for AddElement {
5915 const ORDINAL: u64 = 2782900474142521859;
5916 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5917 ::fidl_next::protocol::Flexibility::Flexible;
5918
5919 type Protocol = crate::Topology;
5920
5921 type Request = crate::wire::ElementSchema<'static>;
5922 }
5923
5924 impl ::fidl_next::TwoWayMethod for AddElement {
5925 type Response = ::fidl_next::wire::Result<
5926 'static,
5927 crate::wire::TopologyAddElementResponse,
5928 crate::wire::AddElementError,
5929 >;
5930 }
5931
5932 impl<___R> ::fidl_next::Respond<___R> for AddElement {
5933 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
5934
5935 fn respond(response: ___R) -> Self::Output {
5936 ::core::result::Result::Ok(response)
5937 }
5938 }
5939
5940 impl<___R> ::fidl_next::RespondErr<___R> for AddElement {
5941 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
5942
5943 fn respond_err(response: ___R) -> Self::Output {
5944 ::core::result::Result::Err(response)
5945 }
5946 }
5947
5948 pub struct Lease;
5949
5950 impl ::fidl_next::Method for Lease {
5951 const ORDINAL: u64 = 9167569827696956208;
5952 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5953 ::fidl_next::protocol::Flexibility::Flexible;
5954
5955 type Protocol = crate::Topology;
5956
5957 type Request = crate::wire::LeaseSchema<'static>;
5958 }
5959
5960 impl ::fidl_next::TwoWayMethod for Lease {
5961 type Response = ::fidl_next::wire::Result<
5962 'static,
5963 crate::wire::TopologyLeaseResponse,
5964 crate::wire::LeaseError,
5965 >;
5966 }
5967
5968 impl<___R> ::fidl_next::Respond<___R> for Lease {
5969 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
5970
5971 fn respond(response: ___R) -> Self::Output {
5972 ::core::result::Result::Ok(response)
5973 }
5974 }
5975
5976 impl<___R> ::fidl_next::RespondErr<___R> for Lease {
5977 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
5978
5979 fn respond_err(response: ___R) -> Self::Output {
5980 ::core::result::Result::Err(response)
5981 }
5982 }
5983
5984 mod ___detail {
5985 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Topology
5986 where
5987 ___T: ::fidl_next::Transport,
5988 {
5989 type Client = TopologyClient<___T>;
5990 type Server = TopologyServer<___T>;
5991 }
5992
5993 #[repr(transparent)]
5995 pub struct TopologyClient<___T: ::fidl_next::Transport> {
5996 #[allow(dead_code)]
5997 client: ::fidl_next::protocol::Client<___T>,
5998 }
5999
6000 impl<___T> TopologyClient<___T>
6001 where
6002 ___T: ::fidl_next::Transport,
6003 {
6004 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
6005 pub fn add_element_with<___R>(
6006 &self,
6007 request: ___R,
6008 ) -> ::fidl_next::TwoWayFuture<'_, super::AddElement, ___T>
6009 where
6010 ___R: ::fidl_next::Encode<
6011 crate::wire::ElementSchema<'static>,
6012 <___T as ::fidl_next::Transport>::SendBuffer,
6013 >,
6014 {
6015 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
6016 2782900474142521859,
6017 <super::AddElement as ::fidl_next::Method>::FLEXIBILITY,
6018 request,
6019 ))
6020 }
6021
6022 #[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"]
6023 pub fn lease_with<___R>(
6024 &self,
6025 request: ___R,
6026 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
6027 where
6028 ___R: ::fidl_next::Encode<
6029 crate::wire::LeaseSchema<'static>,
6030 <___T as ::fidl_next::Transport>::SendBuffer,
6031 >,
6032 {
6033 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
6034 9167569827696956208,
6035 <super::Lease as ::fidl_next::Method>::FLEXIBILITY,
6036 request,
6037 ))
6038 }
6039 }
6040
6041 #[repr(transparent)]
6043 pub struct TopologyServer<___T: ::fidl_next::Transport> {
6044 server: ::fidl_next::protocol::Server<___T>,
6045 }
6046
6047 impl<___T> TopologyServer<___T> where ___T: ::fidl_next::Transport {}
6048 }
6049}
6050
6051#[diagnostic::on_unimplemented(
6052 note = "If {Self} implements the non-local TopologyClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
6053)]
6054
6055pub trait TopologyLocalClientHandler<
6059 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6060 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6061>
6062{
6063 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
6064 ::core::future::ready(())
6065 }
6066}
6067
6068impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Topology
6069where
6070 ___H: TopologyLocalClientHandler<___T>,
6071 ___T: ::fidl_next::Transport,
6072{
6073 async fn on_event(
6074 handler: &mut ___H,
6075 mut message: ::fidl_next::Message<___T>,
6076 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
6077 match *message.header().ordinal {
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 Ok(())
6087 }
6088 }
6089 }
6090 }
6091}
6092
6093#[diagnostic::on_unimplemented(
6094 note = "If {Self} implements the non-local TopologyServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
6095)]
6096
6097pub trait TopologyLocalServerHandler<
6101 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6102 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6103>
6104{
6105 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
6106 fn add_element(
6107 &mut self,
6108
6109 request: ::fidl_next::Request<topology::AddElement, ___T>,
6110
6111 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
6112 ) -> impl ::core::future::Future<Output = ()>;
6113
6114 #[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"]
6115 fn lease(
6116 &mut self,
6117
6118 request: ::fidl_next::Request<topology::Lease, ___T>,
6119
6120 responder: ::fidl_next::Responder<topology::Lease, ___T>,
6121 ) -> impl ::core::future::Future<Output = ()>;
6122
6123 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
6124 ::core::future::ready(())
6125 }
6126}
6127
6128impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Topology
6129where
6130 ___H: TopologyLocalServerHandler<___T>,
6131 ___T: ::fidl_next::Transport,
6132 for<'de> crate::wire::ElementSchema<'de>: ::fidl_next::Decode<
6133 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6134 Constraint = (),
6135 >,
6136 for<'de> crate::wire::LeaseSchema<'de>: ::fidl_next::Decode<
6137 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6138 Constraint = (),
6139 >,
6140{
6141 async fn on_one_way(
6142 handler: &mut ___H,
6143 mut message: ::fidl_next::Message<___T>,
6144 ) -> ::core::result::Result<
6145 (),
6146 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6147 > {
6148 match *message.header().ordinal {
6149 ordinal => {
6150 handler.on_unknown_interaction(ordinal).await;
6151 if ::core::matches!(
6152 message.header().flexibility(),
6153 ::fidl_next::protocol::Flexibility::Strict
6154 ) {
6155 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6156 } else {
6157 Ok(())
6158 }
6159 }
6160 }
6161 }
6162
6163 async fn on_two_way(
6164 handler: &mut ___H,
6165 mut message: ::fidl_next::Message<___T>,
6166 responder: ::fidl_next::protocol::Responder<___T>,
6167 ) -> ::core::result::Result<
6168 (),
6169 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6170 > {
6171 match *message.header().ordinal {
6172 2782900474142521859 => {
6173 let responder = ::fidl_next::Responder::from_untyped(responder);
6174
6175 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6176 Ok(decoded) => {
6177 handler
6178 .add_element(::fidl_next::Request::from_decoded(decoded), responder)
6179 .await;
6180 Ok(())
6181 }
6182 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6183 ordinal: 2782900474142521859,
6184 error,
6185 }),
6186 }
6187 }
6188
6189 9167569827696956208 => {
6190 let responder = ::fidl_next::Responder::from_untyped(responder);
6191
6192 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6193 Ok(decoded) => {
6194 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
6195 Ok(())
6196 }
6197 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6198 ordinal: 9167569827696956208,
6199 error,
6200 }),
6201 }
6202 }
6203
6204 ordinal => {
6205 handler.on_unknown_interaction(ordinal).await;
6206 if ::core::matches!(
6207 message.header().flexibility(),
6208 ::fidl_next::protocol::Flexibility::Strict
6209 ) {
6210 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6211 } else {
6212 responder
6213 .respond_framework_error(
6214 ordinal,
6215 ::fidl_next::FrameworkError::UnknownMethod,
6216 )
6217 .expect("encoding a framework error should never fail")
6218 .await?;
6219 Ok(())
6220 }
6221 }
6222 }
6223 }
6224}
6225
6226pub trait TopologyClientHandler<
6230 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6231 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6232>
6233{
6234 fn on_unknown_interaction(
6235 &mut self,
6236 ordinal: u64,
6237 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
6238 ::core::future::ready(())
6239 }
6240}
6241
6242impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Topology
6243where
6244 ___H: TopologyClientHandler<___T> + ::core::marker::Send,
6245 ___T: ::fidl_next::Transport,
6246{
6247 async fn on_event(
6248 handler: &mut ___H,
6249 mut message: ::fidl_next::Message<___T>,
6250 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
6251 match *message.header().ordinal {
6252 ordinal => {
6253 handler.on_unknown_interaction(ordinal).await;
6254 if ::core::matches!(
6255 message.header().flexibility(),
6256 ::fidl_next::protocol::Flexibility::Strict
6257 ) {
6258 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6259 } else {
6260 Ok(())
6261 }
6262 }
6263 }
6264 }
6265}
6266
6267pub trait TopologyServerHandler<
6271 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6272 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6273>
6274{
6275 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
6276 fn add_element(
6277 &mut self,
6278
6279 request: ::fidl_next::Request<topology::AddElement, ___T>,
6280
6281 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
6282 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6283
6284 #[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"]
6285 fn lease(
6286 &mut self,
6287
6288 request: ::fidl_next::Request<topology::Lease, ___T>,
6289
6290 responder: ::fidl_next::Responder<topology::Lease, ___T>,
6291 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6292
6293 fn on_unknown_interaction(
6294 &mut self,
6295 ordinal: u64,
6296 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
6297 ::core::future::ready(())
6298 }
6299}
6300
6301impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Topology
6302where
6303 ___H: TopologyServerHandler<___T> + ::core::marker::Send,
6304 ___T: ::fidl_next::Transport,
6305 for<'de> crate::wire::ElementSchema<'de>: ::fidl_next::Decode<
6306 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6307 Constraint = (),
6308 >,
6309 for<'de> crate::wire::LeaseSchema<'de>: ::fidl_next::Decode<
6310 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6311 Constraint = (),
6312 >,
6313{
6314 async fn on_one_way(
6315 handler: &mut ___H,
6316 mut message: ::fidl_next::Message<___T>,
6317 ) -> ::core::result::Result<
6318 (),
6319 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6320 > {
6321 match *message.header().ordinal {
6322 ordinal => {
6323 handler.on_unknown_interaction(ordinal).await;
6324 if ::core::matches!(
6325 message.header().flexibility(),
6326 ::fidl_next::protocol::Flexibility::Strict
6327 ) {
6328 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6329 } else {
6330 Ok(())
6331 }
6332 }
6333 }
6334 }
6335
6336 async fn on_two_way(
6337 handler: &mut ___H,
6338 mut message: ::fidl_next::Message<___T>,
6339 responder: ::fidl_next::protocol::Responder<___T>,
6340 ) -> ::core::result::Result<
6341 (),
6342 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6343 > {
6344 match *message.header().ordinal {
6345 2782900474142521859 => {
6346 let responder = ::fidl_next::Responder::from_untyped(responder);
6347
6348 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6349 Ok(decoded) => {
6350 handler
6351 .add_element(::fidl_next::Request::from_decoded(decoded), responder)
6352 .await;
6353 Ok(())
6354 }
6355 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6356 ordinal: 2782900474142521859,
6357 error,
6358 }),
6359 }
6360 }
6361
6362 9167569827696956208 => {
6363 let responder = ::fidl_next::Responder::from_untyped(responder);
6364
6365 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6366 Ok(decoded) => {
6367 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
6368 Ok(())
6369 }
6370 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6371 ordinal: 9167569827696956208,
6372 error,
6373 }),
6374 }
6375 }
6376
6377 ordinal => {
6378 handler.on_unknown_interaction(ordinal).await;
6379 if ::core::matches!(
6380 message.header().flexibility(),
6381 ::fidl_next::protocol::Flexibility::Strict
6382 ) {
6383 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6384 } else {
6385 responder
6386 .respond_framework_error(
6387 ordinal,
6388 ::fidl_next::FrameworkError::UnknownMethod,
6389 )
6390 .expect("encoding a framework error should never fail")
6391 .await?;
6392 Ok(())
6393 }
6394 }
6395 }
6396 }
6397}
6398
6399impl<___T> TopologyClientHandler<___T> for ::fidl_next::IgnoreEvents
6400where
6401 ___T: ::fidl_next::Transport,
6402{
6403 async fn on_unknown_interaction(&mut self, _: u64) {}
6404}
6405
6406impl<___H, ___T> TopologyLocalClientHandler<___T> for ::fidl_next::Local<___H>
6407where
6408 ___H: TopologyClientHandler<___T>,
6409 ___T: ::fidl_next::Transport,
6410{
6411 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6412 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6413 }
6414}
6415
6416impl<___H, ___T> TopologyLocalServerHandler<___T> for ::fidl_next::Local<___H>
6417where
6418 ___H: TopologyServerHandler<___T>,
6419 ___T: ::fidl_next::Transport,
6420{
6421 async fn add_element(
6422 &mut self,
6423
6424 request: ::fidl_next::Request<topology::AddElement, ___T>,
6425
6426 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
6427 ) {
6428 ___H::add_element(&mut self.0, request, responder).await
6429 }
6430
6431 async fn lease(
6432 &mut self,
6433
6434 request: ::fidl_next::Request<topology::Lease, ___T>,
6435
6436 responder: ::fidl_next::Responder<topology::Lease, ___T>,
6437 ) {
6438 ___H::lease(&mut self.0, request, responder).await
6439 }
6440
6441 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6442 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6443 }
6444}
6445
6446pub use fidl_next_common_fuchsia_power_broker::*;