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