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 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
335 pub struct ElementInfoProviderGetElementPowerLevelNamesResponse {
336 pub level_names: ::std::vec::Vec<crate::natural::ElementPowerLevelNames>,
337 }
338
339 unsafe impl<___E>
340 ::fidl_next::Encode<
341 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
342 ___E,
343 > for ElementInfoProviderGetElementPowerLevelNamesResponse
344 where
345 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
346 ___E: ::fidl_next::Encoder,
347 ___E: ::fidl_next::fuchsia::HandleEncoder,
348 {
349 #[inline]
350 fn encode(
351 self,
352 encoder_: &mut ___E,
353 out_: &mut ::core::mem::MaybeUninit<
354 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
355 >,
356 _: (),
357 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
358 ::fidl_next::munge! {
359 let crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse {
360 level_names,
361
362 } = out_;
363 }
364
365 ::fidl_next::Encode::encode(self.level_names, encoder_, level_names, (4294967295, ()))?;
366
367 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(level_names.as_mut_ptr()) };
368 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
369
370 Ok(())
371 }
372 }
373
374 unsafe impl<___E>
375 ::fidl_next::EncodeOption<
376 ::fidl_next::wire::Box<
377 'static,
378 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
379 >,
380 ___E,
381 > for ElementInfoProviderGetElementPowerLevelNamesResponse
382 where
383 ___E: ::fidl_next::Encoder + ?Sized,
384 ElementInfoProviderGetElementPowerLevelNamesResponse: ::fidl_next::Encode<
385 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
386 ___E,
387 >,
388 {
389 #[inline]
390 fn encode_option(
391 this: ::core::option::Option<Self>,
392 encoder: &mut ___E,
393 out: &mut ::core::mem::MaybeUninit<
394 ::fidl_next::wire::Box<
395 'static,
396 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
397 >,
398 >,
399 _: (),
400 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
401 if let Some(inner) = this {
402 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
403 ::fidl_next::wire::Box::encode_present(out);
404 } else {
405 ::fidl_next::wire::Box::encode_absent(out);
406 }
407
408 Ok(())
409 }
410 }
411
412 impl<'de>
413 ::fidl_next::FromWire<
414 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'de>,
415 > for ElementInfoProviderGetElementPowerLevelNamesResponse
416 {
417 #[inline]
418 fn from_wire(
419 wire: crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'de>,
420 ) -> Self {
421 Self { level_names: ::fidl_next::FromWire::from_wire(wire.level_names) }
422 }
423 }
424
425 #[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"]
426 #[derive(Debug, Default, PartialEq)]
427 pub struct ElementStatusEndpoint {
428 pub identifier: ::core::option::Option<::std::string::String>,
429
430 pub status: ::core::option::Option<
431 ::fidl_next::ClientEnd<crate::Status, ::fidl_next::fuchsia::zx::Channel>,
432 >,
433 }
434
435 impl ElementStatusEndpoint {
436 fn __max_ordinal(&self) -> usize {
437 if self.status.is_some() {
438 return 2;
439 }
440
441 if self.identifier.is_some() {
442 return 1;
443 }
444
445 0
446 }
447 }
448
449 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ElementStatusEndpoint<'static>, ___E>
450 for ElementStatusEndpoint
451 where
452 ___E: ::fidl_next::Encoder + ?Sized,
453 ___E: ::fidl_next::fuchsia::HandleEncoder,
454 {
455 #[inline]
456 fn encode(
457 mut self,
458 encoder: &mut ___E,
459 out: &mut ::core::mem::MaybeUninit<crate::wire::ElementStatusEndpoint<'static>>,
460 _: (),
461 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
462 ::fidl_next::munge!(let crate::wire::ElementStatusEndpoint { table } = out);
463
464 let max_ord = self.__max_ordinal();
465
466 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
467 ::fidl_next::Wire::zero_padding(&mut out);
468
469 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
470 ::fidl_next::wire::Envelope,
471 >(encoder, max_ord);
472
473 for i in 1..=max_ord {
474 match i {
475 2 => {
476 if let Some(value) = self.status.take() {
477 ::fidl_next::wire::Envelope::encode_value::<
478 ::fidl_next::ClientEnd<
479 crate::Status,
480 ::fidl_next::wire::fuchsia::Channel,
481 >,
482 ___E,
483 >(
484 value, preallocated.encoder, &mut out, ()
485 )?;
486 } else {
487 ::fidl_next::wire::Envelope::encode_zero(&mut out)
488 }
489 }
490
491 1 => {
492 if let Some(value) = self.identifier.take() {
493 ::fidl_next::wire::Envelope::encode_value::<
494 ::fidl_next::wire::String<'static>,
495 ___E,
496 >(
497 value, preallocated.encoder, &mut out, 64
498 )?;
499 } else {
500 ::fidl_next::wire::Envelope::encode_zero(&mut out)
501 }
502 }
503
504 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
505 }
506 unsafe {
507 preallocated.write_next(out.assume_init_ref());
508 }
509 }
510
511 ::fidl_next::wire::Table::encode_len(table, max_ord);
512
513 Ok(())
514 }
515 }
516
517 impl<'de> ::fidl_next::FromWire<crate::wire::ElementStatusEndpoint<'de>> for ElementStatusEndpoint {
518 #[inline]
519 fn from_wire(wire_: crate::wire::ElementStatusEndpoint<'de>) -> Self {
520 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
521
522 let identifier = wire_.table.get(1);
523
524 let status = wire_.table.get(2);
525
526 Self {
527 identifier: identifier.map(|envelope| {
528 ::fidl_next::FromWire::from_wire(unsafe {
529 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
530 })
531 }),
532
533 status: status.map(|envelope| {
534 ::fidl_next::FromWire::from_wire(unsafe {
535 envelope.read_unchecked::<::fidl_next::ClientEnd<
536 crate::Status,
537 ::fidl_next::wire::fuchsia::Channel,
538 >>()
539 })
540 }),
541 }
542 }
543 }
544
545 #[derive(Debug, PartialEq)]
546 pub struct ElementInfoProviderGetStatusEndpointsResponse {
547 pub endpoints: ::std::vec::Vec<crate::natural::ElementStatusEndpoint>,
548 }
549
550 unsafe impl<___E>
551 ::fidl_next::Encode<
552 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
553 ___E,
554 > for ElementInfoProviderGetStatusEndpointsResponse
555 where
556 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
557 ___E: ::fidl_next::Encoder,
558 ___E: ::fidl_next::fuchsia::HandleEncoder,
559 {
560 #[inline]
561 fn encode(
562 self,
563 encoder_: &mut ___E,
564 out_: &mut ::core::mem::MaybeUninit<
565 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
566 >,
567 _: (),
568 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
569 ::fidl_next::munge! {
570 let crate::wire::ElementInfoProviderGetStatusEndpointsResponse {
571 endpoints,
572
573 } = out_;
574 }
575
576 ::fidl_next::Encode::encode(self.endpoints, encoder_, endpoints, (4294967295, ()))?;
577
578 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(endpoints.as_mut_ptr()) };
579 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
580
581 Ok(())
582 }
583 }
584
585 unsafe impl<___E>
586 ::fidl_next::EncodeOption<
587 ::fidl_next::wire::Box<
588 'static,
589 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
590 >,
591 ___E,
592 > for ElementInfoProviderGetStatusEndpointsResponse
593 where
594 ___E: ::fidl_next::Encoder + ?Sized,
595 ElementInfoProviderGetStatusEndpointsResponse: ::fidl_next::Encode<
596 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
597 ___E,
598 >,
599 {
600 #[inline]
601 fn encode_option(
602 this: ::core::option::Option<Self>,
603 encoder: &mut ___E,
604 out: &mut ::core::mem::MaybeUninit<
605 ::fidl_next::wire::Box<
606 'static,
607 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
608 >,
609 >,
610 _: (),
611 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
612 if let Some(inner) = this {
613 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
614 ::fidl_next::wire::Box::encode_present(out);
615 } else {
616 ::fidl_next::wire::Box::encode_absent(out);
617 }
618
619 Ok(())
620 }
621 }
622
623 impl<'de> ::fidl_next::FromWire<crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'de>>
624 for ElementInfoProviderGetStatusEndpointsResponse
625 {
626 #[inline]
627 fn from_wire(
628 wire: crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'de>,
629 ) -> Self {
630 Self { endpoints: ::fidl_next::FromWire::from_wire(wire.endpoints) }
631 }
632 }
633
634 #[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"]
635 #[derive(Debug, PartialEq)]
636 pub struct LevelDependency {
637 pub dependent_level: u8,
638
639 pub requires_token: ::fidl_next::fuchsia::zx::Event,
640
641 pub requires_level_by_preference: ::std::vec::Vec<u8>,
642 }
643
644 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LevelDependency<'static>, ___E>
645 for LevelDependency
646 where
647 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
648 ___E: ::fidl_next::Encoder,
649 ___E: ::fidl_next::fuchsia::HandleEncoder,
650 {
651 #[inline]
652 fn encode(
653 self,
654 encoder_: &mut ___E,
655 out_: &mut ::core::mem::MaybeUninit<crate::wire::LevelDependency<'static>>,
656 _: (),
657 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
658 ::fidl_next::munge! {
659 let crate::wire::LevelDependency {
660 dependent_level,
661 requires_token,
662 requires_level_by_preference,
663
664 } = out_;
665 }
666
667 ::fidl_next::Encode::encode(self.dependent_level, encoder_, dependent_level, ())?;
668
669 let mut _field =
670 unsafe { ::fidl_next::Slot::new_unchecked(dependent_level.as_mut_ptr()) };
671
672 ::fidl_next::Encode::encode(self.requires_token, encoder_, requires_token, ())?;
673
674 let mut _field =
675 unsafe { ::fidl_next::Slot::new_unchecked(requires_token.as_mut_ptr()) };
676
677 ::fidl_next::Encode::encode(
678 self.requires_level_by_preference,
679 encoder_,
680 requires_level_by_preference,
681 (256, ()),
682 )?;
683
684 let mut _field = unsafe {
685 ::fidl_next::Slot::new_unchecked(requires_level_by_preference.as_mut_ptr())
686 };
687 ::fidl_next::Constrained::validate(_field, (256, ()))?;
688
689 Ok(())
690 }
691 }
692
693 unsafe impl<___E>
694 ::fidl_next::EncodeOption<
695 ::fidl_next::wire::Box<'static, crate::wire::LevelDependency<'static>>,
696 ___E,
697 > for LevelDependency
698 where
699 ___E: ::fidl_next::Encoder + ?Sized,
700 LevelDependency: ::fidl_next::Encode<crate::wire::LevelDependency<'static>, ___E>,
701 {
702 #[inline]
703 fn encode_option(
704 this: ::core::option::Option<Self>,
705 encoder: &mut ___E,
706 out: &mut ::core::mem::MaybeUninit<
707 ::fidl_next::wire::Box<'static, crate::wire::LevelDependency<'static>>,
708 >,
709 _: (),
710 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
711 if let Some(inner) = this {
712 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
713 ::fidl_next::wire::Box::encode_present(out);
714 } else {
715 ::fidl_next::wire::Box::encode_absent(out);
716 }
717
718 Ok(())
719 }
720 }
721
722 impl<'de> ::fidl_next::FromWire<crate::wire::LevelDependency<'de>> for LevelDependency {
723 #[inline]
724 fn from_wire(wire: crate::wire::LevelDependency<'de>) -> Self {
725 Self {
726 dependent_level: ::fidl_next::FromWire::from_wire(wire.dependent_level),
727
728 requires_token: ::fidl_next::FromWire::from_wire(wire.requires_token),
729
730 requires_level_by_preference: ::fidl_next::FromWire::from_wire(
731 wire.requires_level_by_preference,
732 ),
733 }
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 ElementInfoProviderGetElementPowerLevelNamesResponse<'de> {
1858 pub level_names: ::fidl_next::wire::Vector<'de, crate::wire::ElementPowerLevelNames<'de>>,
1859 }
1860
1861 static_assertions::const_assert_eq!(
1862 std::mem::size_of::<ElementInfoProviderGetElementPowerLevelNamesResponse<'_>>(),
1863 16
1864 );
1865 static_assertions::const_assert_eq!(
1866 std::mem::align_of::<ElementInfoProviderGetElementPowerLevelNamesResponse<'_>>(),
1867 8
1868 );
1869
1870 static_assertions::const_assert_eq!(
1871 std::mem::offset_of!(ElementInfoProviderGetElementPowerLevelNamesResponse<'_>, level_names),
1872 0
1873 );
1874
1875 impl ::fidl_next::Constrained for ElementInfoProviderGetElementPowerLevelNamesResponse<'_> {
1876 type Constraint = ();
1877
1878 fn validate(
1879 _: ::fidl_next::Slot<'_, Self>,
1880 _: Self::Constraint,
1881 ) -> Result<(), ::fidl_next::ValidationError> {
1882 Ok(())
1883 }
1884 }
1885
1886 unsafe impl ::fidl_next::Wire for ElementInfoProviderGetElementPowerLevelNamesResponse<'static> {
1887 type Narrowed<'de> = ElementInfoProviderGetElementPowerLevelNamesResponse<'de>;
1888
1889 #[inline]
1890 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1891 ::fidl_next::munge! {
1892 let Self {
1893 level_names,
1894
1895 } = &mut *out_;
1896 }
1897
1898 ::fidl_next::Wire::zero_padding(level_names);
1899 }
1900 }
1901
1902 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
1903 for ElementInfoProviderGetElementPowerLevelNamesResponse<'de>
1904 where
1905 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1906 ___D: ::fidl_next::Decoder<'de>,
1907 ___D: ::fidl_next::fuchsia::HandleDecoder,
1908 {
1909 fn decode(
1910 slot_: ::fidl_next::Slot<'_, Self>,
1911 decoder_: &mut ___D,
1912 _: (),
1913 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1914 ::fidl_next::munge! {
1915 let Self {
1916 mut level_names,
1917
1918 } = slot_;
1919 }
1920
1921 let _field = level_names.as_mut();
1922 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
1923 ::fidl_next::Decode::decode(level_names.as_mut(), decoder_, (4294967295, ()))?;
1924
1925 Ok(())
1926 }
1927 }
1928
1929 impl<'de> ::fidl_next::IntoNatural for ElementInfoProviderGetElementPowerLevelNamesResponse<'de> {
1930 type Natural = crate::natural::ElementInfoProviderGetElementPowerLevelNamesResponse;
1931 }
1932
1933 #[repr(C)]
1935 pub struct ElementStatusEndpoint<'de> {
1936 pub(crate) table: ::fidl_next::wire::Table<'de>,
1937 }
1938
1939 impl<'de> Drop for ElementStatusEndpoint<'de> {
1940 fn drop(&mut self) {
1941 let _ = self.table.get(1).map(|envelope| unsafe {
1942 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
1943 });
1944
1945 let _ = self.table.get(2)
1946 .map(|envelope| unsafe {
1947 envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>>()
1948 });
1949 }
1950 }
1951
1952 impl ::fidl_next::Constrained for ElementStatusEndpoint<'_> {
1953 type Constraint = ();
1954
1955 fn validate(
1956 _: ::fidl_next::Slot<'_, Self>,
1957 _: Self::Constraint,
1958 ) -> Result<(), ::fidl_next::ValidationError> {
1959 Ok(())
1960 }
1961 }
1962
1963 unsafe impl ::fidl_next::Wire for ElementStatusEndpoint<'static> {
1964 type Narrowed<'de> = ElementStatusEndpoint<'de>;
1965
1966 #[inline]
1967 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1968 ::fidl_next::munge!(let Self { table } = out);
1969 ::fidl_next::wire::Table::zero_padding(table);
1970 }
1971 }
1972
1973 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ElementStatusEndpoint<'de>
1974 where
1975 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1976 ___D: ::fidl_next::fuchsia::HandleDecoder,
1977 {
1978 fn decode(
1979 slot: ::fidl_next::Slot<'_, Self>,
1980 decoder: &mut ___D,
1981 _: (),
1982 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1983 ::fidl_next::munge!(let Self { table } = slot);
1984
1985 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1986 match ordinal {
1987 0 => unsafe { ::core::hint::unreachable_unchecked() },
1988
1989 1 => {
1990 ::fidl_next::wire::Envelope::decode_as::<
1991 ___D,
1992 ::fidl_next::wire::String<'de>,
1993 >(slot.as_mut(), decoder, 64)?;
1994
1995 let value = unsafe {
1996 slot.deref_unchecked()
1997 .deref_unchecked::<::fidl_next::wire::String<'_>>()
1998 };
1999
2000 if value.len() > 64 {
2001 return Err(::fidl_next::DecodeError::VectorTooLong {
2002 size: value.len() as u64,
2003 limit: 64,
2004 });
2005 }
2006
2007 Ok(())
2008 }
2009
2010 2 => {
2011 ::fidl_next::wire::Envelope::decode_as::<
2012 ___D,
2013 ::fidl_next::ClientEnd<
2014 crate::Status,
2015 ::fidl_next::wire::fuchsia::Channel,
2016 >,
2017 >(slot.as_mut(), decoder, ())?;
2018
2019 Ok(())
2020 }
2021
2022 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2023 }
2024 })
2025 }
2026 }
2027
2028 impl<'de> ElementStatusEndpoint<'de> {
2029 pub fn identifier(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2030 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2031 }
2032
2033 pub fn status(
2034 &self,
2035 ) -> ::core::option::Option<
2036 &::fidl_next::ClientEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
2037 > {
2038 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2039 }
2040 }
2041
2042 impl<'de> ::core::fmt::Debug for ElementStatusEndpoint<'de> {
2043 fn fmt(
2044 &self,
2045 f: &mut ::core::fmt::Formatter<'_>,
2046 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2047 f.debug_struct("ElementStatusEndpoint")
2048 .field("identifier", &self.identifier())
2049 .field("status", &self.status())
2050 .finish()
2051 }
2052 }
2053
2054 impl<'de> ::fidl_next::IntoNatural for ElementStatusEndpoint<'de> {
2055 type Natural = crate::natural::ElementStatusEndpoint;
2056 }
2057
2058 #[derive(Debug)]
2060 #[repr(C)]
2061 pub struct ElementInfoProviderGetStatusEndpointsResponse<'de> {
2062 pub endpoints: ::fidl_next::wire::Vector<'de, crate::wire::ElementStatusEndpoint<'de>>,
2063 }
2064
2065 static_assertions::const_assert_eq!(
2066 std::mem::size_of::<ElementInfoProviderGetStatusEndpointsResponse<'_>>(),
2067 16
2068 );
2069 static_assertions::const_assert_eq!(
2070 std::mem::align_of::<ElementInfoProviderGetStatusEndpointsResponse<'_>>(),
2071 8
2072 );
2073
2074 static_assertions::const_assert_eq!(
2075 std::mem::offset_of!(ElementInfoProviderGetStatusEndpointsResponse<'_>, endpoints),
2076 0
2077 );
2078
2079 impl ::fidl_next::Constrained for ElementInfoProviderGetStatusEndpointsResponse<'_> {
2080 type Constraint = ();
2081
2082 fn validate(
2083 _: ::fidl_next::Slot<'_, Self>,
2084 _: Self::Constraint,
2085 ) -> Result<(), ::fidl_next::ValidationError> {
2086 Ok(())
2087 }
2088 }
2089
2090 unsafe impl ::fidl_next::Wire for ElementInfoProviderGetStatusEndpointsResponse<'static> {
2091 type Narrowed<'de> = ElementInfoProviderGetStatusEndpointsResponse<'de>;
2092
2093 #[inline]
2094 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2095 ::fidl_next::munge! {
2096 let Self {
2097 endpoints,
2098
2099 } = &mut *out_;
2100 }
2101
2102 ::fidl_next::Wire::zero_padding(endpoints);
2103 }
2104 }
2105
2106 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2107 for ElementInfoProviderGetStatusEndpointsResponse<'de>
2108 where
2109 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2110 ___D: ::fidl_next::Decoder<'de>,
2111 ___D: ::fidl_next::fuchsia::HandleDecoder,
2112 {
2113 fn decode(
2114 slot_: ::fidl_next::Slot<'_, Self>,
2115 decoder_: &mut ___D,
2116 _: (),
2117 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2118 ::fidl_next::munge! {
2119 let Self {
2120 mut endpoints,
2121
2122 } = slot_;
2123 }
2124
2125 let _field = endpoints.as_mut();
2126 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
2127 ::fidl_next::Decode::decode(endpoints.as_mut(), decoder_, (4294967295, ()))?;
2128
2129 Ok(())
2130 }
2131 }
2132
2133 impl<'de> ::fidl_next::IntoNatural for ElementInfoProviderGetStatusEndpointsResponse<'de> {
2134 type Natural = crate::natural::ElementInfoProviderGetStatusEndpointsResponse;
2135 }
2136
2137 #[derive(Debug)]
2139 #[repr(C)]
2140 pub struct LevelDependency<'de> {
2141 pub dependent_level: u8,
2142
2143 pub requires_token: ::fidl_next::wire::fuchsia::Event,
2144
2145 pub requires_level_by_preference: ::fidl_next::wire::Vector<'de, u8>,
2146 }
2147
2148 static_assertions::const_assert_eq!(std::mem::size_of::<LevelDependency<'_>>(), 24);
2149 static_assertions::const_assert_eq!(std::mem::align_of::<LevelDependency<'_>>(), 8);
2150
2151 static_assertions::const_assert_eq!(
2152 std::mem::offset_of!(LevelDependency<'_>, dependent_level),
2153 0
2154 );
2155
2156 static_assertions::const_assert_eq!(
2157 std::mem::offset_of!(LevelDependency<'_>, requires_token),
2158 4
2159 );
2160
2161 static_assertions::const_assert_eq!(
2162 std::mem::offset_of!(LevelDependency<'_>, requires_level_by_preference),
2163 8
2164 );
2165
2166 impl ::fidl_next::Constrained for LevelDependency<'_> {
2167 type Constraint = ();
2168
2169 fn validate(
2170 _: ::fidl_next::Slot<'_, Self>,
2171 _: Self::Constraint,
2172 ) -> Result<(), ::fidl_next::ValidationError> {
2173 Ok(())
2174 }
2175 }
2176
2177 unsafe impl ::fidl_next::Wire for LevelDependency<'static> {
2178 type Narrowed<'de> = LevelDependency<'de>;
2179
2180 #[inline]
2181 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2182 ::fidl_next::munge! {
2183 let Self {
2184 dependent_level,
2185 requires_token,
2186 requires_level_by_preference,
2187
2188 } = &mut *out_;
2189 }
2190
2191 ::fidl_next::Wire::zero_padding(dependent_level);
2192
2193 ::fidl_next::Wire::zero_padding(requires_token);
2194
2195 ::fidl_next::Wire::zero_padding(requires_level_by_preference);
2196
2197 unsafe {
2198 out_.as_mut_ptr().cast::<u8>().add(1).write_bytes(0, 3);
2199 }
2200 }
2201 }
2202
2203 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LevelDependency<'de>
2204 where
2205 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2206 ___D: ::fidl_next::Decoder<'de>,
2207 ___D: ::fidl_next::fuchsia::HandleDecoder,
2208 {
2209 fn decode(
2210 slot_: ::fidl_next::Slot<'_, Self>,
2211 decoder_: &mut ___D,
2212 _: (),
2213 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2214 if slot_.as_bytes()[1..4] != [0u8; 3] {
2215 return Err(::fidl_next::DecodeError::InvalidPadding);
2216 }
2217
2218 ::fidl_next::munge! {
2219 let Self {
2220 mut dependent_level,
2221 mut requires_token,
2222 mut requires_level_by_preference,
2223
2224 } = slot_;
2225 }
2226
2227 let _field = dependent_level.as_mut();
2228
2229 ::fidl_next::Decode::decode(dependent_level.as_mut(), decoder_, ())?;
2230
2231 let _field = requires_token.as_mut();
2232
2233 ::fidl_next::Decode::decode(requires_token.as_mut(), decoder_, ())?;
2234
2235 let _field = requires_level_by_preference.as_mut();
2236 ::fidl_next::Constrained::validate(_field, (256, ()))?;
2237 ::fidl_next::Decode::decode(
2238 requires_level_by_preference.as_mut(),
2239 decoder_,
2240 (256, ()),
2241 )?;
2242
2243 let requires_level_by_preference =
2244 unsafe { requires_level_by_preference.deref_unchecked() };
2245
2246 if requires_level_by_preference.len() > 256 {
2247 return Err(::fidl_next::DecodeError::VectorTooLong {
2248 size: requires_level_by_preference.len() as u64,
2249 limit: 256,
2250 });
2251 }
2252
2253 Ok(())
2254 }
2255 }
2256
2257 impl<'de> ::fidl_next::IntoNatural for LevelDependency<'de> {
2258 type Natural = crate::natural::LevelDependency;
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 ElementInfoProviderGetElementPowerLevelNamesResponse<T0> {
3191 pub level_names: T0,
3192 }
3193
3194 unsafe impl<___E, T0>
3195 ::fidl_next::Encode<
3196 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
3197 ___E,
3198 > for ElementInfoProviderGetElementPowerLevelNamesResponse<T0>
3199 where
3200 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3201 ___E: ::fidl_next::Encoder,
3202 ___E: ::fidl_next::fuchsia::HandleEncoder,
3203 T0: ::fidl_next::Encode<
3204 ::fidl_next::wire::Vector<'static, crate::wire::ElementPowerLevelNames<'static>>,
3205 ___E,
3206 >,
3207 {
3208 #[inline]
3209 fn encode(
3210 self,
3211 encoder_: &mut ___E,
3212 out_: &mut ::core::mem::MaybeUninit<
3213 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
3214 >,
3215 _: (),
3216 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3217 ::fidl_next::munge! {
3218 let crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse {
3219 level_names,
3220
3221 } = out_;
3222 }
3223
3224 ::fidl_next::Encode::encode(self.level_names, encoder_, level_names, (4294967295, ()))?;
3225
3226 Ok(())
3227 }
3228 }
3229
3230 pub struct ElementInfoProviderGetStatusEndpointsResponse<T0> {
3232 pub endpoints: T0,
3233 }
3234
3235 unsafe impl<___E, T0>
3236 ::fidl_next::Encode<
3237 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
3238 ___E,
3239 > for ElementInfoProviderGetStatusEndpointsResponse<T0>
3240 where
3241 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3242 ___E: ::fidl_next::Encoder,
3243 ___E: ::fidl_next::fuchsia::HandleEncoder,
3244 T0: ::fidl_next::Encode<
3245 ::fidl_next::wire::Vector<'static, crate::wire::ElementStatusEndpoint<'static>>,
3246 ___E,
3247 >,
3248 {
3249 #[inline]
3250 fn encode(
3251 self,
3252 encoder_: &mut ___E,
3253 out_: &mut ::core::mem::MaybeUninit<
3254 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
3255 >,
3256 _: (),
3257 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3258 ::fidl_next::munge! {
3259 let crate::wire::ElementInfoProviderGetStatusEndpointsResponse {
3260 endpoints,
3261
3262 } = out_;
3263 }
3264
3265 ::fidl_next::Encode::encode(self.endpoints, encoder_, endpoints, (4294967295, ()))?;
3266
3267 Ok(())
3268 }
3269 }
3270
3271 pub struct LevelDependency<T0, T1, T2> {
3273 pub dependent_level: T0,
3274
3275 pub requires_token: T1,
3276
3277 pub requires_level_by_preference: T2,
3278 }
3279
3280 unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::LevelDependency<'static>, ___E>
3281 for LevelDependency<T0, T1, T2>
3282 where
3283 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3284 ___E: ::fidl_next::Encoder,
3285 ___E: ::fidl_next::fuchsia::HandleEncoder,
3286 T0: ::fidl_next::Encode<u8, ___E>,
3287 T1: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Event, ___E>,
3288 T2: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
3289 {
3290 #[inline]
3291 fn encode(
3292 self,
3293 encoder_: &mut ___E,
3294 out_: &mut ::core::mem::MaybeUninit<crate::wire::LevelDependency<'static>>,
3295 _: (),
3296 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3297 ::fidl_next::munge! {
3298 let crate::wire::LevelDependency {
3299 dependent_level,
3300 requires_token,
3301 requires_level_by_preference,
3302
3303 } = out_;
3304 }
3305
3306 ::fidl_next::Encode::encode(self.dependent_level, encoder_, dependent_level, ())?;
3307
3308 ::fidl_next::Encode::encode(self.requires_token, encoder_, requires_token, ())?;
3309
3310 ::fidl_next::Encode::encode(
3311 self.requires_level_by_preference,
3312 encoder_,
3313 requires_level_by_preference,
3314 (256, ()),
3315 )?;
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::ElementControlRegisterDependencyTokenResponse;
3447
3448 pub use crate::natural::ElementControlUnregisterDependencyTokenResponse;
3449
3450 pub use crate::natural::RegisterDependencyTokenError;
3451
3452 pub use crate::natural::UnregisterDependencyTokenError;
3453 }
3454
3455 pub struct OpenStatusChannel;
3456
3457 impl ::fidl_next::Method for OpenStatusChannel {
3458 const ORDINAL: u64 = 5582056609237590784;
3459 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3460 ::fidl_next::protocol::Flexibility::Flexible;
3461
3462 type Protocol = crate::ElementControl;
3463
3464 type Request = crate::wire::ElementControlOpenStatusChannelRequest;
3465 }
3466
3467 pub struct RegisterDependencyToken;
3468
3469 impl ::fidl_next::Method for RegisterDependencyToken {
3470 const ORDINAL: u64 = 4201883080704232801;
3471 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3472 ::fidl_next::protocol::Flexibility::Flexible;
3473
3474 type Protocol = crate::ElementControl;
3475
3476 type Request = crate::wire::ElementControlRegisterDependencyTokenRequest;
3477 }
3478
3479 impl ::fidl_next::TwoWayMethod for RegisterDependencyToken {
3480 type Response = ::fidl_next::wire::FlexibleResult<
3481 'static,
3482 crate::wire::ElementControlRegisterDependencyTokenResponse,
3483 crate::wire::RegisterDependencyTokenError,
3484 >;
3485 }
3486
3487 impl<___R> ::fidl_next::Respond<___R> for RegisterDependencyToken {
3488 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
3489
3490 fn respond(response: ___R) -> Self::Output {
3491 ::fidl_next::FlexibleResult::Ok(response)
3492 }
3493 }
3494
3495 impl<___R> ::fidl_next::RespondErr<___R> for RegisterDependencyToken {
3496 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
3497
3498 fn respond_err(response: ___R) -> Self::Output {
3499 ::fidl_next::FlexibleResult::Err(response)
3500 }
3501 }
3502
3503 pub struct UnregisterDependencyToken;
3504
3505 impl ::fidl_next::Method for UnregisterDependencyToken {
3506 const ORDINAL: u64 = 7323726239897326889;
3507 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3508 ::fidl_next::protocol::Flexibility::Flexible;
3509
3510 type Protocol = crate::ElementControl;
3511
3512 type Request = crate::wire::ElementControlUnregisterDependencyTokenRequest;
3513 }
3514
3515 impl ::fidl_next::TwoWayMethod for UnregisterDependencyToken {
3516 type Response = ::fidl_next::wire::FlexibleResult<
3517 'static,
3518 crate::wire::ElementControlUnregisterDependencyTokenResponse,
3519 crate::wire::UnregisterDependencyTokenError,
3520 >;
3521 }
3522
3523 impl<___R> ::fidl_next::Respond<___R> for UnregisterDependencyToken {
3524 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
3525
3526 fn respond(response: ___R) -> Self::Output {
3527 ::fidl_next::FlexibleResult::Ok(response)
3528 }
3529 }
3530
3531 impl<___R> ::fidl_next::RespondErr<___R> for UnregisterDependencyToken {
3532 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
3533
3534 fn respond_err(response: ___R) -> Self::Output {
3535 ::fidl_next::FlexibleResult::Err(response)
3536 }
3537 }
3538
3539 mod ___detail {
3540 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ElementControl
3541 where
3542 ___T: ::fidl_next::Transport,
3543 {
3544 type Client = ElementControlClient<___T>;
3545 type Server = ElementControlServer<___T>;
3546 }
3547
3548 #[repr(transparent)]
3550 pub struct ElementControlClient<___T: ::fidl_next::Transport> {
3551 #[allow(dead_code)]
3552 client: ::fidl_next::protocol::Client<___T>,
3553 }
3554
3555 impl<___T> ElementControlClient<___T>
3556 where
3557 ___T: ::fidl_next::Transport,
3558 {
3559 #[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"]
3560 pub fn open_status_channel(
3561 &self,
3562
3563 status_channel: impl ::fidl_next::Encode<
3564 ::fidl_next::ServerEnd<crate::Status, ::fidl_next::wire::fuchsia::Channel>,
3565 <___T as ::fidl_next::Transport>::SendBuffer,
3566 >,
3567 ) -> ::fidl_next::SendFuture<'_, ___T>
3568 where
3569 <___T as ::fidl_next::Transport>::SendBuffer:
3570 ::fidl_next::encoder::InternalHandleEncoder,
3571 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3572 {
3573 self.open_status_channel_with(
3574 crate::generic::ElementControlOpenStatusChannelRequest { status_channel },
3575 )
3576 }
3577
3578 #[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"]
3579 pub fn open_status_channel_with<___R>(
3580 &self,
3581 request: ___R,
3582 ) -> ::fidl_next::SendFuture<'_, ___T>
3583 where
3584 ___R: ::fidl_next::Encode<
3585 crate::wire::ElementControlOpenStatusChannelRequest,
3586 <___T as ::fidl_next::Transport>::SendBuffer,
3587 >,
3588 {
3589 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
3590 5582056609237590784,
3591 <super::OpenStatusChannel as ::fidl_next::Method>::FLEXIBILITY,
3592 request,
3593 ))
3594 }
3595
3596 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3597 pub fn register_dependency_token(
3598 &self,
3599
3600 token: impl ::fidl_next::Encode<
3601 ::fidl_next::wire::fuchsia::Event,
3602 <___T as ::fidl_next::Transport>::SendBuffer,
3603 >,
3604 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterDependencyToken, ___T>
3605 where
3606 <___T as ::fidl_next::Transport>::SendBuffer:
3607 ::fidl_next::encoder::InternalHandleEncoder,
3608 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3609 {
3610 self.register_dependency_token_with(
3611 crate::generic::ElementControlRegisterDependencyTokenRequest { token },
3612 )
3613 }
3614
3615 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3616 pub fn register_dependency_token_with<___R>(
3617 &self,
3618 request: ___R,
3619 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterDependencyToken, ___T>
3620 where
3621 ___R: ::fidl_next::Encode<
3622 crate::wire::ElementControlRegisterDependencyTokenRequest,
3623 <___T as ::fidl_next::Transport>::SendBuffer,
3624 >,
3625 {
3626 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3627 4201883080704232801,
3628 <super::RegisterDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3629 request,
3630 ))
3631 }
3632
3633 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3634 pub fn unregister_dependency_token(
3635 &self,
3636
3637 token: impl ::fidl_next::Encode<
3638 ::fidl_next::wire::fuchsia::Event,
3639 <___T as ::fidl_next::Transport>::SendBuffer,
3640 >,
3641 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterDependencyToken, ___T>
3642 where
3643 <___T as ::fidl_next::Transport>::SendBuffer:
3644 ::fidl_next::encoder::InternalHandleEncoder,
3645 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3646 {
3647 self.unregister_dependency_token_with(
3648 crate::generic::ElementControlUnregisterDependencyTokenRequest { token },
3649 )
3650 }
3651
3652 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3653 pub fn unregister_dependency_token_with<___R>(
3654 &self,
3655 request: ___R,
3656 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterDependencyToken, ___T>
3657 where
3658 ___R: ::fidl_next::Encode<
3659 crate::wire::ElementControlUnregisterDependencyTokenRequest,
3660 <___T as ::fidl_next::Transport>::SendBuffer,
3661 >,
3662 {
3663 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3664 7323726239897326889,
3665 <super::UnregisterDependencyToken as ::fidl_next::Method>::FLEXIBILITY,
3666 request,
3667 ))
3668 }
3669 }
3670
3671 #[repr(transparent)]
3673 pub struct ElementControlServer<___T: ::fidl_next::Transport> {
3674 server: ::fidl_next::protocol::Server<___T>,
3675 }
3676
3677 impl<___T> ElementControlServer<___T> where ___T: ::fidl_next::Transport {}
3678 }
3679}
3680
3681#[diagnostic::on_unimplemented(
3682 note = "If {Self} implements the non-local ElementControlClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3683)]
3684
3685pub trait ElementControlLocalClientHandler<
3689 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3690 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3691>
3692{
3693 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3694 ::core::future::ready(())
3695 }
3696}
3697
3698impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ElementControl
3699where
3700 ___H: ElementControlLocalClientHandler<___T>,
3701 ___T: ::fidl_next::Transport,
3702{
3703 async fn on_event(
3704 handler: &mut ___H,
3705 ordinal: u64,
3706 flexibility: ::fidl_next::protocol::Flexibility,
3707 body: ::fidl_next::Body<___T>,
3708 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3709 match ordinal {
3710 ordinal => {
3711 handler.on_unknown_interaction(ordinal).await;
3712 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3713 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3714 } else {
3715 Ok(())
3716 }
3717 }
3718 }
3719 }
3720}
3721
3722#[diagnostic::on_unimplemented(
3723 note = "If {Self} implements the non-local ElementControlServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3724)]
3725
3726pub trait ElementControlLocalServerHandler<
3730 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3731 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3732>
3733{
3734 #[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"]
3735 fn open_status_channel(
3736 &mut self,
3737
3738 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
3739 ) -> impl ::core::future::Future<Output = ()>;
3740
3741 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3742 fn register_dependency_token(
3743 &mut self,
3744
3745 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
3746
3747 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
3748 ) -> impl ::core::future::Future<Output = ()>;
3749
3750 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3751 fn unregister_dependency_token(
3752 &mut self,
3753
3754 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
3755
3756 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
3757 ) -> impl ::core::future::Future<Output = ()>;
3758
3759 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3760 ::core::future::ready(())
3761 }
3762}
3763
3764impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ElementControl
3765where
3766 ___H: ElementControlLocalServerHandler<___T>,
3767 ___T: ::fidl_next::Transport,
3768 for<'de> crate::wire::ElementControlOpenStatusChannelRequest: ::fidl_next::Decode<
3769 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3770 Constraint = (),
3771 >,
3772 for<'de> crate::wire::ElementControlRegisterDependencyTokenRequest: ::fidl_next::Decode<
3773 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3774 Constraint = (),
3775 >,
3776 for<'de> crate::wire::ElementControlUnregisterDependencyTokenRequest: ::fidl_next::Decode<
3777 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3778 Constraint = (),
3779 >,
3780{
3781 async fn on_one_way(
3782 handler: &mut ___H,
3783 ordinal: u64,
3784 flexibility: ::fidl_next::protocol::Flexibility,
3785 body: ::fidl_next::Body<___T>,
3786 ) -> ::core::result::Result<
3787 (),
3788 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3789 > {
3790 match ordinal {
3791 5582056609237590784 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
3792 Ok(decoded) => {
3793 handler.open_status_channel(::fidl_next::Request::from_decoded(decoded)).await;
3794 Ok(())
3795 }
3796 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3797 ordinal: 5582056609237590784,
3798 error,
3799 }),
3800 },
3801
3802 ordinal => {
3803 handler.on_unknown_interaction(ordinal).await;
3804 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3805 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3806 } else {
3807 Ok(())
3808 }
3809 }
3810 }
3811 }
3812
3813 async fn on_two_way(
3814 handler: &mut ___H,
3815 ordinal: u64,
3816 flexibility: ::fidl_next::protocol::Flexibility,
3817 body: ::fidl_next::Body<___T>,
3818 responder: ::fidl_next::protocol::Responder<___T>,
3819 ) -> ::core::result::Result<
3820 (),
3821 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3822 > {
3823 match ordinal {
3824 4201883080704232801 => {
3825 let responder = ::fidl_next::Responder::from_untyped(responder);
3826
3827 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3828 Ok(decoded) => {
3829 handler
3830 .register_dependency_token(
3831 ::fidl_next::Request::from_decoded(decoded),
3832 responder,
3833 )
3834 .await;
3835 Ok(())
3836 }
3837 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3838 ordinal: 4201883080704232801,
3839 error,
3840 }),
3841 }
3842 }
3843
3844 7323726239897326889 => {
3845 let responder = ::fidl_next::Responder::from_untyped(responder);
3846
3847 match ::fidl_next::AsDecoderExt::into_decoded(body) {
3848 Ok(decoded) => {
3849 handler
3850 .unregister_dependency_token(
3851 ::fidl_next::Request::from_decoded(decoded),
3852 responder,
3853 )
3854 .await;
3855 Ok(())
3856 }
3857 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3858 ordinal: 7323726239897326889,
3859 error,
3860 }),
3861 }
3862 }
3863
3864 ordinal => {
3865 handler.on_unknown_interaction(ordinal).await;
3866 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3867 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3868 } else {
3869 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
3870 ordinal,
3871 flexibility,
3872 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
3873 )
3874 .expect("encoding a framework error should never fail")
3875 .await?;
3876 Ok(())
3877 }
3878 }
3879 }
3880 }
3881}
3882
3883pub trait ElementControlClientHandler<
3887 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3888 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3889>
3890{
3891 fn on_unknown_interaction(
3892 &mut self,
3893 ordinal: u64,
3894 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3895 ::core::future::ready(())
3896 }
3897}
3898
3899impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ElementControl
3900where
3901 ___H: ElementControlClientHandler<___T> + ::core::marker::Send,
3902 ___T: ::fidl_next::Transport,
3903{
3904 async fn on_event(
3905 handler: &mut ___H,
3906 ordinal: u64,
3907 flexibility: ::fidl_next::protocol::Flexibility,
3908 body: ::fidl_next::Body<___T>,
3909 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3910 match ordinal {
3911 ordinal => {
3912 handler.on_unknown_interaction(ordinal).await;
3913 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3914 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3915 } else {
3916 Ok(())
3917 }
3918 }
3919 }
3920 }
3921}
3922
3923pub trait ElementControlServerHandler<
3927 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3928 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3929>
3930{
3931 #[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"]
3932 fn open_status_channel(
3933 &mut self,
3934
3935 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
3936 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3937
3938 #[doc = " Register a token which will permit the bearer to add either a\n dependency upon this element.\n"]
3939 fn register_dependency_token(
3940 &mut self,
3941
3942 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
3943
3944 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
3945 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3946
3947 #[doc = " Unregister a token previously registered via RegisterDependencyToken.\n"]
3948 fn unregister_dependency_token(
3949 &mut self,
3950
3951 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
3952
3953 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
3954 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3955
3956 fn on_unknown_interaction(
3957 &mut self,
3958 ordinal: u64,
3959 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
3960 ::core::future::ready(())
3961 }
3962}
3963
3964impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ElementControl
3965where
3966 ___H: ElementControlServerHandler<___T> + ::core::marker::Send,
3967 ___T: ::fidl_next::Transport,
3968 for<'de> crate::wire::ElementControlOpenStatusChannelRequest: ::fidl_next::Decode<
3969 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3970 Constraint = (),
3971 >,
3972 for<'de> crate::wire::ElementControlRegisterDependencyTokenRequest: ::fidl_next::Decode<
3973 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3974 Constraint = (),
3975 >,
3976 for<'de> crate::wire::ElementControlUnregisterDependencyTokenRequest: ::fidl_next::Decode<
3977 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3978 Constraint = (),
3979 >,
3980{
3981 async fn on_one_way(
3982 handler: &mut ___H,
3983 ordinal: u64,
3984 flexibility: ::fidl_next::protocol::Flexibility,
3985 body: ::fidl_next::Body<___T>,
3986 ) -> ::core::result::Result<
3987 (),
3988 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3989 > {
3990 match ordinal {
3991 5582056609237590784 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
3992 Ok(decoded) => {
3993 handler.open_status_channel(::fidl_next::Request::from_decoded(decoded)).await;
3994 Ok(())
3995 }
3996 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3997 ordinal: 5582056609237590784,
3998 error,
3999 }),
4000 },
4001
4002 ordinal => {
4003 handler.on_unknown_interaction(ordinal).await;
4004 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4005 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4006 } else {
4007 Ok(())
4008 }
4009 }
4010 }
4011 }
4012
4013 async fn on_two_way(
4014 handler: &mut ___H,
4015 ordinal: u64,
4016 flexibility: ::fidl_next::protocol::Flexibility,
4017 body: ::fidl_next::Body<___T>,
4018 responder: ::fidl_next::protocol::Responder<___T>,
4019 ) -> ::core::result::Result<
4020 (),
4021 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4022 > {
4023 match ordinal {
4024 4201883080704232801 => {
4025 let responder = ::fidl_next::Responder::from_untyped(responder);
4026
4027 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4028 Ok(decoded) => {
4029 handler
4030 .register_dependency_token(
4031 ::fidl_next::Request::from_decoded(decoded),
4032 responder,
4033 )
4034 .await;
4035 Ok(())
4036 }
4037 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4038 ordinal: 4201883080704232801,
4039 error,
4040 }),
4041 }
4042 }
4043
4044 7323726239897326889 => {
4045 let responder = ::fidl_next::Responder::from_untyped(responder);
4046
4047 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4048 Ok(decoded) => {
4049 handler
4050 .unregister_dependency_token(
4051 ::fidl_next::Request::from_decoded(decoded),
4052 responder,
4053 )
4054 .await;
4055 Ok(())
4056 }
4057 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4058 ordinal: 7323726239897326889,
4059 error,
4060 }),
4061 }
4062 }
4063
4064 ordinal => {
4065 handler.on_unknown_interaction(ordinal).await;
4066 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4067 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4068 } else {
4069 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4070 ordinal,
4071 flexibility,
4072 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4073 )
4074 .expect("encoding a framework error should never fail")
4075 .await?;
4076 Ok(())
4077 }
4078 }
4079 }
4080 }
4081}
4082
4083impl<___T> ElementControlClientHandler<___T> for ::fidl_next::IgnoreEvents
4084where
4085 ___T: ::fidl_next::Transport,
4086{
4087 async fn on_unknown_interaction(&mut self, _: u64) {}
4088}
4089
4090impl<___H, ___T> ElementControlLocalClientHandler<___T> for ::fidl_next::Local<___H>
4091where
4092 ___H: ElementControlClientHandler<___T>,
4093 ___T: ::fidl_next::Transport,
4094{
4095 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4096 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4097 }
4098}
4099
4100impl<___H, ___T> ElementControlLocalServerHandler<___T> for ::fidl_next::Local<___H>
4101where
4102 ___H: ElementControlServerHandler<___T>,
4103 ___T: ::fidl_next::Transport,
4104{
4105 async fn open_status_channel(
4106 &mut self,
4107
4108 request: ::fidl_next::Request<element_control::OpenStatusChannel, ___T>,
4109 ) {
4110 ___H::open_status_channel(&mut self.0, request).await
4111 }
4112
4113 async fn register_dependency_token(
4114 &mut self,
4115
4116 request: ::fidl_next::Request<element_control::RegisterDependencyToken, ___T>,
4117
4118 responder: ::fidl_next::Responder<element_control::RegisterDependencyToken, ___T>,
4119 ) {
4120 ___H::register_dependency_token(&mut self.0, request, responder).await
4121 }
4122
4123 async fn unregister_dependency_token(
4124 &mut self,
4125
4126 request: ::fidl_next::Request<element_control::UnregisterDependencyToken, ___T>,
4127
4128 responder: ::fidl_next::Responder<element_control::UnregisterDependencyToken, ___T>,
4129 ) {
4130 ___H::unregister_dependency_token(&mut self.0, request, responder).await
4131 }
4132
4133 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4134 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4135 }
4136}
4137
4138#[doc = " Provides an interface to retrieve information about PowerElements managed by a component.\n"]
4140#[derive(PartialEq, Debug)]
4141pub struct ElementInfoProvider;
4142
4143impl ::fidl_next::Discoverable for ElementInfoProvider {
4144 const PROTOCOL_NAME: &'static str = "fuchsia.power.broker.ElementInfoProvider";
4145}
4146
4147#[cfg(target_os = "fuchsia")]
4148impl ::fidl_next::HasTransport for ElementInfoProvider {
4149 type Transport = ::fidl_next::fuchsia::zx::Channel;
4150}
4151
4152pub mod element_info_provider {
4153 pub mod prelude {
4154 pub use crate::{
4155 ElementInfoProvider, ElementInfoProviderClientHandler,
4156 ElementInfoProviderLocalClientHandler, ElementInfoProviderLocalServerHandler,
4157 ElementInfoProviderServerHandler, element_info_provider,
4158 };
4159
4160 pub use crate::natural::ElementInfoProviderError;
4161
4162 pub use crate::natural::ElementInfoProviderGetElementPowerLevelNamesResponse;
4163
4164 pub use crate::natural::ElementInfoProviderGetStatusEndpointsResponse;
4165 }
4166
4167 pub struct GetElementPowerLevelNames;
4168
4169 impl ::fidl_next::Method for GetElementPowerLevelNames {
4170 const ORDINAL: u64 = 2994721713524698441;
4171 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4172 ::fidl_next::protocol::Flexibility::Flexible;
4173
4174 type Protocol = crate::ElementInfoProvider;
4175
4176 type Request = ::fidl_next::wire::EmptyMessageBody;
4177 }
4178
4179 impl ::fidl_next::TwoWayMethod for GetElementPowerLevelNames {
4180 type Response = ::fidl_next::wire::FlexibleResult<
4181 'static,
4182 crate::wire::ElementInfoProviderGetElementPowerLevelNamesResponse<'static>,
4183 crate::wire::ElementInfoProviderError,
4184 >;
4185 }
4186
4187 impl<___R> ::fidl_next::Respond<___R> for GetElementPowerLevelNames {
4188 type Output = ::fidl_next::FlexibleResult<
4189 crate::generic::ElementInfoProviderGetElementPowerLevelNamesResponse<___R>,
4190 ::fidl_next::util::Never,
4191 >;
4192
4193 fn respond(response: ___R) -> Self::Output {
4194 ::fidl_next::FlexibleResult::Ok(
4195 crate::generic::ElementInfoProviderGetElementPowerLevelNamesResponse {
4196 level_names: response,
4197 },
4198 )
4199 }
4200 }
4201
4202 impl<___R> ::fidl_next::RespondErr<___R> for GetElementPowerLevelNames {
4203 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
4204
4205 fn respond_err(response: ___R) -> Self::Output {
4206 ::fidl_next::FlexibleResult::Err(response)
4207 }
4208 }
4209
4210 pub struct GetStatusEndpoints;
4211
4212 impl ::fidl_next::Method for GetStatusEndpoints {
4213 const ORDINAL: u64 = 5003265455430858620;
4214 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4215 ::fidl_next::protocol::Flexibility::Flexible;
4216
4217 type Protocol = crate::ElementInfoProvider;
4218
4219 type Request = ::fidl_next::wire::EmptyMessageBody;
4220 }
4221
4222 impl ::fidl_next::TwoWayMethod for GetStatusEndpoints {
4223 type Response = ::fidl_next::wire::FlexibleResult<
4224 'static,
4225 crate::wire::ElementInfoProviderGetStatusEndpointsResponse<'static>,
4226 crate::wire::ElementInfoProviderError,
4227 >;
4228 }
4229
4230 impl<___R> ::fidl_next::Respond<___R> for GetStatusEndpoints {
4231 type Output = ::fidl_next::FlexibleResult<
4232 crate::generic::ElementInfoProviderGetStatusEndpointsResponse<___R>,
4233 ::fidl_next::util::Never,
4234 >;
4235
4236 fn respond(response: ___R) -> Self::Output {
4237 ::fidl_next::FlexibleResult::Ok(
4238 crate::generic::ElementInfoProviderGetStatusEndpointsResponse {
4239 endpoints: response,
4240 },
4241 )
4242 }
4243 }
4244
4245 impl<___R> ::fidl_next::RespondErr<___R> for GetStatusEndpoints {
4246 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
4247
4248 fn respond_err(response: ___R) -> Self::Output {
4249 ::fidl_next::FlexibleResult::Err(response)
4250 }
4251 }
4252
4253 mod ___detail {
4254 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ElementInfoProvider
4255 where
4256 ___T: ::fidl_next::Transport,
4257 {
4258 type Client = ElementInfoProviderClient<___T>;
4259 type Server = ElementInfoProviderServer<___T>;
4260 }
4261
4262 #[repr(transparent)]
4264 pub struct ElementInfoProviderClient<___T: ::fidl_next::Transport> {
4265 #[allow(dead_code)]
4266 client: ::fidl_next::protocol::Client<___T>,
4267 }
4268
4269 impl<___T> ElementInfoProviderClient<___T>
4270 where
4271 ___T: ::fidl_next::Transport,
4272 {
4273 #[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"]
4274 pub fn get_element_power_level_names(
4275 &self,
4276 ) -> ::fidl_next::TwoWayFuture<'_, super::GetElementPowerLevelNames, ___T> {
4277 ::fidl_next::TwoWayFuture::from_untyped(
4278 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4279 2994721713524698441,
4280 <super::GetElementPowerLevelNames as ::fidl_next::Method>::FLEXIBILITY,
4281 (),
4282 ),
4283 )
4284 }
4285
4286 #[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"]
4287 pub fn get_status_endpoints(
4288 &self,
4289 ) -> ::fidl_next::TwoWayFuture<'_, super::GetStatusEndpoints, ___T> {
4290 ::fidl_next::TwoWayFuture::from_untyped(
4291 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4292 5003265455430858620,
4293 <super::GetStatusEndpoints as ::fidl_next::Method>::FLEXIBILITY,
4294 (),
4295 ),
4296 )
4297 }
4298 }
4299
4300 #[repr(transparent)]
4302 pub struct ElementInfoProviderServer<___T: ::fidl_next::Transport> {
4303 server: ::fidl_next::protocol::Server<___T>,
4304 }
4305
4306 impl<___T> ElementInfoProviderServer<___T> where ___T: ::fidl_next::Transport {}
4307 }
4308}
4309
4310#[diagnostic::on_unimplemented(
4311 note = "If {Self} implements the non-local ElementInfoProviderClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4312)]
4313
4314pub trait ElementInfoProviderLocalClientHandler<
4318 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4319 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4320>
4321{
4322 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4323 ::core::future::ready(())
4324 }
4325}
4326
4327impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ElementInfoProvider
4328where
4329 ___H: ElementInfoProviderLocalClientHandler<___T>,
4330 ___T: ::fidl_next::Transport,
4331{
4332 async fn on_event(
4333 handler: &mut ___H,
4334 ordinal: u64,
4335 flexibility: ::fidl_next::protocol::Flexibility,
4336 body: ::fidl_next::Body<___T>,
4337 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4338 match ordinal {
4339 ordinal => {
4340 handler.on_unknown_interaction(ordinal).await;
4341 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4342 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4343 } else {
4344 Ok(())
4345 }
4346 }
4347 }
4348 }
4349}
4350
4351#[diagnostic::on_unimplemented(
4352 note = "If {Self} implements the non-local ElementInfoProviderServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4353)]
4354
4355pub trait ElementInfoProviderLocalServerHandler<
4359 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4360 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4361>
4362{
4363 #[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"]
4364 fn get_element_power_level_names(
4365 &mut self,
4366
4367 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4368 ) -> impl ::core::future::Future<Output = ()>;
4369
4370 #[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"]
4371 fn get_status_endpoints(
4372 &mut self,
4373
4374 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4375 ) -> impl ::core::future::Future<Output = ()>;
4376
4377 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4378 ::core::future::ready(())
4379 }
4380}
4381
4382impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ElementInfoProvider
4383where
4384 ___H: ElementInfoProviderLocalServerHandler<___T>,
4385 ___T: ::fidl_next::Transport,
4386{
4387 async fn on_one_way(
4388 handler: &mut ___H,
4389 ordinal: u64,
4390 flexibility: ::fidl_next::protocol::Flexibility,
4391 body: ::fidl_next::Body<___T>,
4392 ) -> ::core::result::Result<
4393 (),
4394 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4395 > {
4396 match ordinal {
4397 ordinal => {
4398 handler.on_unknown_interaction(ordinal).await;
4399 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4400 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4401 } else {
4402 Ok(())
4403 }
4404 }
4405 }
4406 }
4407
4408 async fn on_two_way(
4409 handler: &mut ___H,
4410 ordinal: u64,
4411 flexibility: ::fidl_next::protocol::Flexibility,
4412 body: ::fidl_next::Body<___T>,
4413 responder: ::fidl_next::protocol::Responder<___T>,
4414 ) -> ::core::result::Result<
4415 (),
4416 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4417 > {
4418 match ordinal {
4419 2994721713524698441 => {
4420 let responder = ::fidl_next::Responder::from_untyped(responder);
4421
4422 handler.get_element_power_level_names(responder).await;
4423 Ok(())
4424 }
4425
4426 5003265455430858620 => {
4427 let responder = ::fidl_next::Responder::from_untyped(responder);
4428
4429 handler.get_status_endpoints(responder).await;
4430 Ok(())
4431 }
4432
4433 ordinal => {
4434 handler.on_unknown_interaction(ordinal).await;
4435 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4436 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4437 } else {
4438 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4439 ordinal,
4440 flexibility,
4441 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4442 )
4443 .expect("encoding a framework error should never fail")
4444 .await?;
4445 Ok(())
4446 }
4447 }
4448 }
4449 }
4450}
4451
4452pub trait ElementInfoProviderClientHandler<
4456 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4457 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4458>
4459{
4460 fn on_unknown_interaction(
4461 &mut self,
4462 ordinal: u64,
4463 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4464 ::core::future::ready(())
4465 }
4466}
4467
4468impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ElementInfoProvider
4469where
4470 ___H: ElementInfoProviderClientHandler<___T> + ::core::marker::Send,
4471 ___T: ::fidl_next::Transport,
4472{
4473 async fn on_event(
4474 handler: &mut ___H,
4475 ordinal: u64,
4476 flexibility: ::fidl_next::protocol::Flexibility,
4477 body: ::fidl_next::Body<___T>,
4478 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4479 match ordinal {
4480 ordinal => {
4481 handler.on_unknown_interaction(ordinal).await;
4482 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4483 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4484 } else {
4485 Ok(())
4486 }
4487 }
4488 }
4489 }
4490}
4491
4492pub trait ElementInfoProviderServerHandler<
4496 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4497 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4498>
4499{
4500 #[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"]
4501 fn get_element_power_level_names(
4502 &mut self,
4503
4504 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4505 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4506
4507 #[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"]
4508 fn get_status_endpoints(
4509 &mut self,
4510
4511 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4512 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4513
4514 fn on_unknown_interaction(
4515 &mut self,
4516 ordinal: u64,
4517 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4518 ::core::future::ready(())
4519 }
4520}
4521
4522impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ElementInfoProvider
4523where
4524 ___H: ElementInfoProviderServerHandler<___T> + ::core::marker::Send,
4525 ___T: ::fidl_next::Transport,
4526{
4527 async fn on_one_way(
4528 handler: &mut ___H,
4529 ordinal: u64,
4530 flexibility: ::fidl_next::protocol::Flexibility,
4531 body: ::fidl_next::Body<___T>,
4532 ) -> ::core::result::Result<
4533 (),
4534 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4535 > {
4536 match ordinal {
4537 ordinal => {
4538 handler.on_unknown_interaction(ordinal).await;
4539 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4540 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4541 } else {
4542 Ok(())
4543 }
4544 }
4545 }
4546 }
4547
4548 async fn on_two_way(
4549 handler: &mut ___H,
4550 ordinal: u64,
4551 flexibility: ::fidl_next::protocol::Flexibility,
4552 body: ::fidl_next::Body<___T>,
4553 responder: ::fidl_next::protocol::Responder<___T>,
4554 ) -> ::core::result::Result<
4555 (),
4556 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4557 > {
4558 match ordinal {
4559 2994721713524698441 => {
4560 let responder = ::fidl_next::Responder::from_untyped(responder);
4561
4562 handler.get_element_power_level_names(responder).await;
4563 Ok(())
4564 }
4565
4566 5003265455430858620 => {
4567 let responder = ::fidl_next::Responder::from_untyped(responder);
4568
4569 handler.get_status_endpoints(responder).await;
4570 Ok(())
4571 }
4572
4573 ordinal => {
4574 handler.on_unknown_interaction(ordinal).await;
4575 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4576 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4577 } else {
4578 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4579 ordinal,
4580 flexibility,
4581 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4582 )
4583 .expect("encoding a framework error should never fail")
4584 .await?;
4585 Ok(())
4586 }
4587 }
4588 }
4589 }
4590}
4591
4592impl<___T> ElementInfoProviderClientHandler<___T> for ::fidl_next::IgnoreEvents
4593where
4594 ___T: ::fidl_next::Transport,
4595{
4596 async fn on_unknown_interaction(&mut self, _: u64) {}
4597}
4598
4599impl<___H, ___T> ElementInfoProviderLocalClientHandler<___T> for ::fidl_next::Local<___H>
4600where
4601 ___H: ElementInfoProviderClientHandler<___T>,
4602 ___T: ::fidl_next::Transport,
4603{
4604 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4605 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4606 }
4607}
4608
4609impl<___H, ___T> ElementInfoProviderLocalServerHandler<___T> for ::fidl_next::Local<___H>
4610where
4611 ___H: ElementInfoProviderServerHandler<___T>,
4612 ___T: ::fidl_next::Transport,
4613{
4614 async fn get_element_power_level_names(
4615 &mut self,
4616
4617 responder: ::fidl_next::Responder<element_info_provider::GetElementPowerLevelNames, ___T>,
4618 ) {
4619 ___H::get_element_power_level_names(&mut self.0, responder).await
4620 }
4621
4622 async fn get_status_endpoints(
4623 &mut self,
4624
4625 responder: ::fidl_next::Responder<element_info_provider::GetStatusEndpoints, ___T>,
4626 ) {
4627 ___H::get_status_endpoints(&mut self.0, responder).await
4628 }
4629
4630 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4631 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4632 }
4633}
4634
4635#[derive(Debug)]
4637pub struct ElementInfoProviderService;
4638
4639impl ::fidl_next::DiscoverableService for ElementInfoProviderService {
4640 const SERVICE_NAME: &'static str = "fuchsia.power.broker.ElementInfoProviderService";
4641 const MEMBER_NAMES: &'static [&'static str] = &["status_provider"];
4642}
4643
4644impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel>
4645 for ElementInfoProviderService
4646{
4647}
4648
4649impl<___C> ::fidl_next::Service<___C> for ElementInfoProviderService
4650where
4651 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
4652{
4653 type Connector = ElementInfoProviderServiceConnector<___C>;
4654}
4655
4656#[repr(transparent)]
4658pub struct ElementInfoProviderServiceConnector<___C> {
4659 #[allow(dead_code)]
4660 connector: ___C,
4661}
4662
4663impl<___C> ElementInfoProviderServiceConnector<___C>
4664where
4665 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
4666{
4667 pub fn status_provider(
4669 &self,
4670 server_end: ::fidl_next::ServerEnd<
4671 crate::ElementInfoProvider,
4672 ::fidl_next::fuchsia::zx::Channel,
4673 >,
4674 ) -> ::core::result::Result<
4675 (),
4676 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
4677 > {
4678 ::fidl_next::protocol::ServiceConnector::<
4679 ::fidl_next::fuchsia::zx::Channel
4680 >::connect_to_member(
4681 &self.connector,
4682 "status_provider",
4683 server_end.into_untyped(),
4684 )
4685 }
4686}
4687
4688pub trait ElementInfoProviderServiceHandler {
4690 fn status_provider(
4692 &self,
4693 server_end: ::fidl_next::ServerEnd<
4694 crate::ElementInfoProvider,
4695 ::fidl_next::fuchsia::zx::Channel,
4696 >,
4697 );
4698}
4699
4700impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for ElementInfoProviderService
4701where
4702 ___H: ElementInfoProviderServiceHandler,
4703 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
4704{
4705 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
4706 use ::fidl_next::InstanceFromServiceTransport;
4707 match member {
4708 "status_provider" => handler.status_provider(::fidl_next::ServerEnd::from_untyped(
4709 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
4710 )),
4711
4712 _ => unreachable!(),
4713 }
4714 }
4715}
4716
4717#[doc = " Provides element-scoped access to request leases to raise the levels of an\n element previously added via Topology.AddElement.\n"]
4719#[derive(PartialEq, Debug)]
4720pub struct Lessor;
4721
4722#[cfg(target_os = "fuchsia")]
4723impl ::fidl_next::HasTransport for Lessor {
4724 type Transport = ::fidl_next::fuchsia::zx::Channel;
4725}
4726
4727pub mod lessor {
4728 pub mod prelude {
4729 pub use crate::{
4730 Lessor, LessorClientHandler, LessorLocalClientHandler, LessorLocalServerHandler,
4731 LessorServerHandler, lessor,
4732 };
4733
4734 pub use crate::natural::LeaseError;
4735
4736 pub use crate::natural::LessorLeaseRequest;
4737
4738 pub use crate::natural::LessorLeaseResponse;
4739 }
4740
4741 pub struct Lease;
4742
4743 impl ::fidl_next::Method for Lease {
4744 const ORDINAL: u64 = 4078466329847396781;
4745 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4746 ::fidl_next::protocol::Flexibility::Flexible;
4747
4748 type Protocol = crate::Lessor;
4749
4750 type Request = crate::wire::LessorLeaseRequest;
4751 }
4752
4753 impl ::fidl_next::TwoWayMethod for Lease {
4754 type Response = ::fidl_next::wire::FlexibleResult<
4755 'static,
4756 crate::wire::LessorLeaseResponse,
4757 crate::wire::LeaseError,
4758 >;
4759 }
4760
4761 impl<___R> ::fidl_next::Respond<___R> for Lease {
4762 type Output = ::fidl_next::FlexibleResult<
4763 crate::generic::LessorLeaseResponse<___R>,
4764 ::fidl_next::util::Never,
4765 >;
4766
4767 fn respond(response: ___R) -> Self::Output {
4768 ::fidl_next::FlexibleResult::Ok(crate::generic::LessorLeaseResponse {
4769 lease_control: response,
4770 })
4771 }
4772 }
4773
4774 impl<___R> ::fidl_next::RespondErr<___R> for Lease {
4775 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
4776
4777 fn respond_err(response: ___R) -> Self::Output {
4778 ::fidl_next::FlexibleResult::Err(response)
4779 }
4780 }
4781
4782 mod ___detail {
4783 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Lessor
4784 where
4785 ___T: ::fidl_next::Transport,
4786 {
4787 type Client = LessorClient<___T>;
4788 type Server = LessorServer<___T>;
4789 }
4790
4791 #[repr(transparent)]
4793 pub struct LessorClient<___T: ::fidl_next::Transport> {
4794 #[allow(dead_code)]
4795 client: ::fidl_next::protocol::Client<___T>,
4796 }
4797
4798 impl<___T> LessorClient<___T>
4799 where
4800 ___T: ::fidl_next::Transport,
4801 {
4802 #[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"]
4803 pub fn lease(
4804 &self,
4805
4806 level: impl ::fidl_next::Encode<u8, <___T as ::fidl_next::Transport>::SendBuffer>,
4807 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
4808 where
4809 <___T as ::fidl_next::Transport>::SendBuffer:
4810 ::fidl_next::encoder::InternalHandleEncoder,
4811 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
4812 {
4813 self.lease_with(crate::generic::LessorLeaseRequest { level })
4814 }
4815
4816 #[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"]
4817 pub fn lease_with<___R>(
4818 &self,
4819 request: ___R,
4820 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
4821 where
4822 ___R: ::fidl_next::Encode<
4823 crate::wire::LessorLeaseRequest,
4824 <___T as ::fidl_next::Transport>::SendBuffer,
4825 >,
4826 {
4827 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
4828 4078466329847396781,
4829 <super::Lease as ::fidl_next::Method>::FLEXIBILITY,
4830 request,
4831 ))
4832 }
4833 }
4834
4835 #[repr(transparent)]
4837 pub struct LessorServer<___T: ::fidl_next::Transport> {
4838 server: ::fidl_next::protocol::Server<___T>,
4839 }
4840
4841 impl<___T> LessorServer<___T> where ___T: ::fidl_next::Transport {}
4842 }
4843}
4844
4845#[diagnostic::on_unimplemented(
4846 note = "If {Self} implements the non-local LessorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4847)]
4848
4849pub trait LessorLocalClientHandler<
4853 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4854 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4855>
4856{
4857 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4858 ::core::future::ready(())
4859 }
4860}
4861
4862impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Lessor
4863where
4864 ___H: LessorLocalClientHandler<___T>,
4865 ___T: ::fidl_next::Transport,
4866{
4867 async fn on_event(
4868 handler: &mut ___H,
4869 ordinal: u64,
4870 flexibility: ::fidl_next::protocol::Flexibility,
4871 body: ::fidl_next::Body<___T>,
4872 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4873 match ordinal {
4874 ordinal => {
4875 handler.on_unknown_interaction(ordinal).await;
4876 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4877 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4878 } else {
4879 Ok(())
4880 }
4881 }
4882 }
4883 }
4884}
4885
4886#[diagnostic::on_unimplemented(
4887 note = "If {Self} implements the non-local LessorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4888)]
4889
4890pub trait LessorLocalServerHandler<
4894 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4895 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4896>
4897{
4898 #[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"]
4899 fn lease(
4900 &mut self,
4901
4902 request: ::fidl_next::Request<lessor::Lease, ___T>,
4903
4904 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
4905 ) -> impl ::core::future::Future<Output = ()>;
4906
4907 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4908 ::core::future::ready(())
4909 }
4910}
4911
4912impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Lessor
4913where
4914 ___H: LessorLocalServerHandler<___T>,
4915 ___T: ::fidl_next::Transport,
4916 for<'de> crate::wire::LessorLeaseRequest: ::fidl_next::Decode<
4917 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4918 Constraint = (),
4919 >,
4920{
4921 async fn on_one_way(
4922 handler: &mut ___H,
4923 ordinal: u64,
4924 flexibility: ::fidl_next::protocol::Flexibility,
4925 body: ::fidl_next::Body<___T>,
4926 ) -> ::core::result::Result<
4927 (),
4928 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4929 > {
4930 match ordinal {
4931 ordinal => {
4932 handler.on_unknown_interaction(ordinal).await;
4933 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4934 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4935 } else {
4936 Ok(())
4937 }
4938 }
4939 }
4940 }
4941
4942 async fn on_two_way(
4943 handler: &mut ___H,
4944 ordinal: u64,
4945 flexibility: ::fidl_next::protocol::Flexibility,
4946 body: ::fidl_next::Body<___T>,
4947 responder: ::fidl_next::protocol::Responder<___T>,
4948 ) -> ::core::result::Result<
4949 (),
4950 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4951 > {
4952 match ordinal {
4953 4078466329847396781 => {
4954 let responder = ::fidl_next::Responder::from_untyped(responder);
4955
4956 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4957 Ok(decoded) => {
4958 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
4959 Ok(())
4960 }
4961 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4962 ordinal: 4078466329847396781,
4963 error,
4964 }),
4965 }
4966 }
4967
4968 ordinal => {
4969 handler.on_unknown_interaction(ordinal).await;
4970 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4971 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4972 } else {
4973 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4974 ordinal,
4975 flexibility,
4976 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4977 )
4978 .expect("encoding a framework error should never fail")
4979 .await?;
4980 Ok(())
4981 }
4982 }
4983 }
4984 }
4985}
4986
4987pub trait LessorClientHandler<
4991 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4992 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4993>
4994{
4995 fn on_unknown_interaction(
4996 &mut self,
4997 ordinal: u64,
4998 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4999 ::core::future::ready(())
5000 }
5001}
5002
5003impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Lessor
5004where
5005 ___H: LessorClientHandler<___T> + ::core::marker::Send,
5006 ___T: ::fidl_next::Transport,
5007{
5008 async fn on_event(
5009 handler: &mut ___H,
5010 ordinal: u64,
5011 flexibility: ::fidl_next::protocol::Flexibility,
5012 body: ::fidl_next::Body<___T>,
5013 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5014 match ordinal {
5015 ordinal => {
5016 handler.on_unknown_interaction(ordinal).await;
5017 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5018 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5019 } else {
5020 Ok(())
5021 }
5022 }
5023 }
5024 }
5025}
5026
5027pub trait LessorServerHandler<
5031 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5032 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5033>
5034{
5035 #[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"]
5036 fn lease(
5037 &mut self,
5038
5039 request: ::fidl_next::Request<lessor::Lease, ___T>,
5040
5041 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
5042 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5043
5044 fn on_unknown_interaction(
5045 &mut self,
5046 ordinal: u64,
5047 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5048 ::core::future::ready(())
5049 }
5050}
5051
5052impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Lessor
5053where
5054 ___H: LessorServerHandler<___T> + ::core::marker::Send,
5055 ___T: ::fidl_next::Transport,
5056 for<'de> crate::wire::LessorLeaseRequest: ::fidl_next::Decode<
5057 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5058 Constraint = (),
5059 >,
5060{
5061 async fn on_one_way(
5062 handler: &mut ___H,
5063 ordinal: u64,
5064 flexibility: ::fidl_next::protocol::Flexibility,
5065 body: ::fidl_next::Body<___T>,
5066 ) -> ::core::result::Result<
5067 (),
5068 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5069 > {
5070 match ordinal {
5071 ordinal => {
5072 handler.on_unknown_interaction(ordinal).await;
5073 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5074 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5075 } else {
5076 Ok(())
5077 }
5078 }
5079 }
5080 }
5081
5082 async fn on_two_way(
5083 handler: &mut ___H,
5084 ordinal: u64,
5085 flexibility: ::fidl_next::protocol::Flexibility,
5086 body: ::fidl_next::Body<___T>,
5087 responder: ::fidl_next::protocol::Responder<___T>,
5088 ) -> ::core::result::Result<
5089 (),
5090 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5091 > {
5092 match ordinal {
5093 4078466329847396781 => {
5094 let responder = ::fidl_next::Responder::from_untyped(responder);
5095
5096 match ::fidl_next::AsDecoderExt::into_decoded(body) {
5097 Ok(decoded) => {
5098 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
5099 Ok(())
5100 }
5101 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5102 ordinal: 4078466329847396781,
5103 error,
5104 }),
5105 }
5106 }
5107
5108 ordinal => {
5109 handler.on_unknown_interaction(ordinal).await;
5110 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5111 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5112 } else {
5113 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
5114 ordinal,
5115 flexibility,
5116 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
5117 )
5118 .expect("encoding a framework error should never fail")
5119 .await?;
5120 Ok(())
5121 }
5122 }
5123 }
5124 }
5125}
5126
5127impl<___T> LessorClientHandler<___T> for ::fidl_next::IgnoreEvents
5128where
5129 ___T: ::fidl_next::Transport,
5130{
5131 async fn on_unknown_interaction(&mut self, _: u64) {}
5132}
5133
5134impl<___H, ___T> LessorLocalClientHandler<___T> for ::fidl_next::Local<___H>
5135where
5136 ___H: LessorClientHandler<___T>,
5137 ___T: ::fidl_next::Transport,
5138{
5139 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5140 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5141 }
5142}
5143
5144impl<___H, ___T> LessorLocalServerHandler<___T> for ::fidl_next::Local<___H>
5145where
5146 ___H: LessorServerHandler<___T>,
5147 ___T: ::fidl_next::Transport,
5148{
5149 async fn lease(
5150 &mut self,
5151
5152 request: ::fidl_next::Request<lessor::Lease, ___T>,
5153
5154 responder: ::fidl_next::Responder<lessor::Lease, ___T>,
5155 ) {
5156 ___H::lease(&mut self.0, request, responder).await
5157 }
5158
5159 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5160 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5161 }
5162}
5163
5164#[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"]
5166#[derive(PartialEq, Debug)]
5167pub struct Status;
5168
5169#[cfg(target_os = "fuchsia")]
5170impl ::fidl_next::HasTransport for Status {
5171 type Transport = ::fidl_next::fuchsia::zx::Channel;
5172}
5173
5174pub mod status {
5175 pub mod prelude {
5176 pub use crate::{
5177 Status, StatusClientHandler, StatusLocalClientHandler, StatusLocalServerHandler,
5178 StatusServerHandler, status,
5179 };
5180
5181 pub use crate::natural::StatusError;
5182
5183 pub use crate::natural::StatusWatchPowerLevelResponse;
5184 }
5185
5186 pub struct WatchPowerLevel;
5187
5188 impl ::fidl_next::Method for WatchPowerLevel {
5189 const ORDINAL: u64 = 3391697113329262926;
5190 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5191 ::fidl_next::protocol::Flexibility::Flexible;
5192
5193 type Protocol = crate::Status;
5194
5195 type Request = ::fidl_next::wire::EmptyMessageBody;
5196 }
5197
5198 impl ::fidl_next::TwoWayMethod for WatchPowerLevel {
5199 type Response = ::fidl_next::wire::FlexibleResult<
5200 'static,
5201 crate::wire::StatusWatchPowerLevelResponse,
5202 crate::wire::StatusError,
5203 >;
5204 }
5205
5206 impl<___R> ::fidl_next::Respond<___R> for WatchPowerLevel {
5207 type Output = ::fidl_next::FlexibleResult<
5208 crate::generic::StatusWatchPowerLevelResponse<___R>,
5209 ::fidl_next::util::Never,
5210 >;
5211
5212 fn respond(response: ___R) -> Self::Output {
5213 ::fidl_next::FlexibleResult::Ok(crate::generic::StatusWatchPowerLevelResponse {
5214 current_level: response,
5215 })
5216 }
5217 }
5218
5219 impl<___R> ::fidl_next::RespondErr<___R> for WatchPowerLevel {
5220 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
5221
5222 fn respond_err(response: ___R) -> Self::Output {
5223 ::fidl_next::FlexibleResult::Err(response)
5224 }
5225 }
5226
5227 mod ___detail {
5228 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Status
5229 where
5230 ___T: ::fidl_next::Transport,
5231 {
5232 type Client = StatusClient<___T>;
5233 type Server = StatusServer<___T>;
5234 }
5235
5236 #[repr(transparent)]
5238 pub struct StatusClient<___T: ::fidl_next::Transport> {
5239 #[allow(dead_code)]
5240 client: ::fidl_next::protocol::Client<___T>,
5241 }
5242
5243 impl<___T> StatusClient<___T>
5244 where
5245 ___T: ::fidl_next::Transport,
5246 {
5247 #[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"]
5248 pub fn watch_power_level(
5249 &self,
5250 ) -> ::fidl_next::TwoWayFuture<'_, super::WatchPowerLevel, ___T> {
5251 ::fidl_next::TwoWayFuture::from_untyped(
5252 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
5253 3391697113329262926,
5254 <super::WatchPowerLevel as ::fidl_next::Method>::FLEXIBILITY,
5255 (),
5256 ),
5257 )
5258 }
5259 }
5260
5261 #[repr(transparent)]
5263 pub struct StatusServer<___T: ::fidl_next::Transport> {
5264 server: ::fidl_next::protocol::Server<___T>,
5265 }
5266
5267 impl<___T> StatusServer<___T> where ___T: ::fidl_next::Transport {}
5268 }
5269}
5270
5271#[diagnostic::on_unimplemented(
5272 note = "If {Self} implements the non-local StatusClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5273)]
5274
5275pub trait StatusLocalClientHandler<
5279 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5280 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5281>
5282{
5283 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5284 ::core::future::ready(())
5285 }
5286}
5287
5288impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Status
5289where
5290 ___H: StatusLocalClientHandler<___T>,
5291 ___T: ::fidl_next::Transport,
5292{
5293 async fn on_event(
5294 handler: &mut ___H,
5295 ordinal: u64,
5296 flexibility: ::fidl_next::protocol::Flexibility,
5297 body: ::fidl_next::Body<___T>,
5298 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5299 match ordinal {
5300 ordinal => {
5301 handler.on_unknown_interaction(ordinal).await;
5302 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5303 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5304 } else {
5305 Ok(())
5306 }
5307 }
5308 }
5309 }
5310}
5311
5312#[diagnostic::on_unimplemented(
5313 note = "If {Self} implements the non-local StatusServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5314)]
5315
5316pub trait StatusLocalServerHandler<
5320 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5321 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5322>
5323{
5324 #[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"]
5325 fn watch_power_level(
5326 &mut self,
5327
5328 responder: ::fidl_next::Responder<status::WatchPowerLevel, ___T>,
5329 ) -> impl ::core::future::Future<Output = ()>;
5330
5331 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5332 ::core::future::ready(())
5333 }
5334}
5335
5336impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Status
5337where
5338 ___H: StatusLocalServerHandler<___T>,
5339 ___T: ::fidl_next::Transport,
5340{
5341 async fn on_one_way(
5342 handler: &mut ___H,
5343 ordinal: u64,
5344 flexibility: ::fidl_next::protocol::Flexibility,
5345 body: ::fidl_next::Body<___T>,
5346 ) -> ::core::result::Result<
5347 (),
5348 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5349 > {
5350 match ordinal {
5351 ordinal => {
5352 handler.on_unknown_interaction(ordinal).await;
5353 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5354 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5355 } else {
5356 Ok(())
5357 }
5358 }
5359 }
5360 }
5361
5362 async fn on_two_way(
5363 handler: &mut ___H,
5364 ordinal: u64,
5365 flexibility: ::fidl_next::protocol::Flexibility,
5366 body: ::fidl_next::Body<___T>,
5367 responder: ::fidl_next::protocol::Responder<___T>,
5368 ) -> ::core::result::Result<
5369 (),
5370 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5371 > {
5372 match ordinal {
5373 3391697113329262926 => {
5374 let responder = ::fidl_next::Responder::from_untyped(responder);
5375
5376 handler.watch_power_level(responder).await;
5377 Ok(())
5378 }
5379
5380 ordinal => {
5381 handler.on_unknown_interaction(ordinal).await;
5382 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5383 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5384 } else {
5385 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
5386 ordinal,
5387 flexibility,
5388 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
5389 )
5390 .expect("encoding a framework error should never fail")
5391 .await?;
5392 Ok(())
5393 }
5394 }
5395 }
5396 }
5397}
5398
5399pub trait StatusClientHandler<
5403 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5404 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5405>
5406{
5407 fn on_unknown_interaction(
5408 &mut self,
5409 ordinal: u64,
5410 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5411 ::core::future::ready(())
5412 }
5413}
5414
5415impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Status
5416where
5417 ___H: StatusClientHandler<___T> + ::core::marker::Send,
5418 ___T: ::fidl_next::Transport,
5419{
5420 async fn on_event(
5421 handler: &mut ___H,
5422 ordinal: u64,
5423 flexibility: ::fidl_next::protocol::Flexibility,
5424 body: ::fidl_next::Body<___T>,
5425 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5426 match ordinal {
5427 ordinal => {
5428 handler.on_unknown_interaction(ordinal).await;
5429 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5430 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5431 } else {
5432 Ok(())
5433 }
5434 }
5435 }
5436 }
5437}
5438
5439pub trait StatusServerHandler<
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 #[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"]
5448 fn watch_power_level(
5449 &mut self,
5450
5451 responder: ::fidl_next::Responder<status::WatchPowerLevel, ___T>,
5452 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5453
5454 fn on_unknown_interaction(
5455 &mut self,
5456 ordinal: u64,
5457 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5458 ::core::future::ready(())
5459 }
5460}
5461
5462impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Status
5463where
5464 ___H: StatusServerHandler<___T> + ::core::marker::Send,
5465 ___T: ::fidl_next::Transport,
5466{
5467 async fn on_one_way(
5468 handler: &mut ___H,
5469 ordinal: u64,
5470 flexibility: ::fidl_next::protocol::Flexibility,
5471 body: ::fidl_next::Body<___T>,
5472 ) -> ::core::result::Result<
5473 (),
5474 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5475 > {
5476 match ordinal {
5477 ordinal => {
5478 handler.on_unknown_interaction(ordinal).await;
5479 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5480 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5481 } else {
5482 Ok(())
5483 }
5484 }
5485 }
5486 }
5487
5488 async fn on_two_way(
5489 handler: &mut ___H,
5490 ordinal: u64,
5491 flexibility: ::fidl_next::protocol::Flexibility,
5492 body: ::fidl_next::Body<___T>,
5493 responder: ::fidl_next::protocol::Responder<___T>,
5494 ) -> ::core::result::Result<
5495 (),
5496 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5497 > {
5498 match ordinal {
5499 3391697113329262926 => {
5500 let responder = ::fidl_next::Responder::from_untyped(responder);
5501
5502 handler.watch_power_level(responder).await;
5503 Ok(())
5504 }
5505
5506 ordinal => {
5507 handler.on_unknown_interaction(ordinal).await;
5508 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5509 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5510 } else {
5511 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
5512 ordinal,
5513 flexibility,
5514 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
5515 )
5516 .expect("encoding a framework error should never fail")
5517 .await?;
5518 Ok(())
5519 }
5520 }
5521 }
5522 }
5523}
5524
5525impl<___T> StatusClientHandler<___T> for ::fidl_next::IgnoreEvents
5526where
5527 ___T: ::fidl_next::Transport,
5528{
5529 async fn on_unknown_interaction(&mut self, _: u64) {}
5530}
5531
5532impl<___H, ___T> StatusLocalClientHandler<___T> for ::fidl_next::Local<___H>
5533where
5534 ___H: StatusClientHandler<___T>,
5535 ___T: ::fidl_next::Transport,
5536{
5537 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5538 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5539 }
5540}
5541
5542impl<___H, ___T> StatusLocalServerHandler<___T> for ::fidl_next::Local<___H>
5543where
5544 ___H: StatusServerHandler<___T>,
5545 ___T: ::fidl_next::Transport,
5546{
5547 async fn watch_power_level(
5548 &mut self,
5549
5550 responder: ::fidl_next::Responder<status::WatchPowerLevel, ___T>,
5551 ) {
5552 ___H::watch_power_level(&mut self.0, responder).await
5553 }
5554
5555 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5556 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5557 }
5558}
5559
5560#[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"]
5562#[derive(PartialEq, Debug)]
5563pub struct Topology;
5564
5565impl ::fidl_next::Discoverable for Topology {
5566 const PROTOCOL_NAME: &'static str = "fuchsia.power.broker.Topology";
5567}
5568
5569#[cfg(target_os = "fuchsia")]
5570impl ::fidl_next::HasTransport for Topology {
5571 type Transport = ::fidl_next::fuchsia::zx::Channel;
5572}
5573
5574pub mod topology {
5575 pub mod prelude {
5576 pub use crate::{
5577 Topology, TopologyClientHandler, TopologyLocalClientHandler,
5578 TopologyLocalServerHandler, TopologyServerHandler, topology,
5579 };
5580
5581 pub use crate::natural::AddElementError;
5582
5583 pub use crate::natural::ElementSchema;
5584
5585 pub use crate::natural::LeaseError;
5586
5587 pub use crate::natural::LeaseSchema;
5588
5589 pub use crate::natural::TopologyAddElementResponse;
5590
5591 pub use crate::natural::TopologyLeaseResponse;
5592 }
5593
5594 pub struct AddElement;
5595
5596 impl ::fidl_next::Method for AddElement {
5597 const ORDINAL: u64 = 2782900474142521859;
5598 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5599 ::fidl_next::protocol::Flexibility::Flexible;
5600
5601 type Protocol = crate::Topology;
5602
5603 type Request = crate::wire::ElementSchema<'static>;
5604 }
5605
5606 impl ::fidl_next::TwoWayMethod for AddElement {
5607 type Response = ::fidl_next::wire::FlexibleResult<
5608 'static,
5609 crate::wire::TopologyAddElementResponse,
5610 crate::wire::AddElementError,
5611 >;
5612 }
5613
5614 impl<___R> ::fidl_next::Respond<___R> for AddElement {
5615 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
5616
5617 fn respond(response: ___R) -> Self::Output {
5618 ::fidl_next::FlexibleResult::Ok(response)
5619 }
5620 }
5621
5622 impl<___R> ::fidl_next::RespondErr<___R> for AddElement {
5623 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
5624
5625 fn respond_err(response: ___R) -> Self::Output {
5626 ::fidl_next::FlexibleResult::Err(response)
5627 }
5628 }
5629
5630 pub struct Lease;
5631
5632 impl ::fidl_next::Method for Lease {
5633 const ORDINAL: u64 = 9167569827696956208;
5634 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5635 ::fidl_next::protocol::Flexibility::Flexible;
5636
5637 type Protocol = crate::Topology;
5638
5639 type Request = crate::wire::LeaseSchema<'static>;
5640 }
5641
5642 impl ::fidl_next::TwoWayMethod for Lease {
5643 type Response = ::fidl_next::wire::FlexibleResult<
5644 'static,
5645 crate::wire::TopologyLeaseResponse,
5646 crate::wire::LeaseError,
5647 >;
5648 }
5649
5650 impl<___R> ::fidl_next::Respond<___R> for Lease {
5651 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
5652
5653 fn respond(response: ___R) -> Self::Output {
5654 ::fidl_next::FlexibleResult::Ok(response)
5655 }
5656 }
5657
5658 impl<___R> ::fidl_next::RespondErr<___R> for Lease {
5659 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
5660
5661 fn respond_err(response: ___R) -> Self::Output {
5662 ::fidl_next::FlexibleResult::Err(response)
5663 }
5664 }
5665
5666 mod ___detail {
5667 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Topology
5668 where
5669 ___T: ::fidl_next::Transport,
5670 {
5671 type Client = TopologyClient<___T>;
5672 type Server = TopologyServer<___T>;
5673 }
5674
5675 #[repr(transparent)]
5677 pub struct TopologyClient<___T: ::fidl_next::Transport> {
5678 #[allow(dead_code)]
5679 client: ::fidl_next::protocol::Client<___T>,
5680 }
5681
5682 impl<___T> TopologyClient<___T>
5683 where
5684 ___T: ::fidl_next::Transport,
5685 {
5686 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
5687 pub fn add_element_with<___R>(
5688 &self,
5689 request: ___R,
5690 ) -> ::fidl_next::TwoWayFuture<'_, super::AddElement, ___T>
5691 where
5692 ___R: ::fidl_next::Encode<
5693 crate::wire::ElementSchema<'static>,
5694 <___T as ::fidl_next::Transport>::SendBuffer,
5695 >,
5696 {
5697 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5698 2782900474142521859,
5699 <super::AddElement as ::fidl_next::Method>::FLEXIBILITY,
5700 request,
5701 ))
5702 }
5703
5704 #[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"]
5705 pub fn lease_with<___R>(
5706 &self,
5707 request: ___R,
5708 ) -> ::fidl_next::TwoWayFuture<'_, super::Lease, ___T>
5709 where
5710 ___R: ::fidl_next::Encode<
5711 crate::wire::LeaseSchema<'static>,
5712 <___T as ::fidl_next::Transport>::SendBuffer,
5713 >,
5714 {
5715 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5716 9167569827696956208,
5717 <super::Lease as ::fidl_next::Method>::FLEXIBILITY,
5718 request,
5719 ))
5720 }
5721 }
5722
5723 #[repr(transparent)]
5725 pub struct TopologyServer<___T: ::fidl_next::Transport> {
5726 server: ::fidl_next::protocol::Server<___T>,
5727 }
5728
5729 impl<___T> TopologyServer<___T> where ___T: ::fidl_next::Transport {}
5730 }
5731}
5732
5733#[diagnostic::on_unimplemented(
5734 note = "If {Self} implements the non-local TopologyClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5735)]
5736
5737pub trait TopologyLocalClientHandler<
5741 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5742 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5743>
5744{
5745 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5746 ::core::future::ready(())
5747 }
5748}
5749
5750impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Topology
5751where
5752 ___H: TopologyLocalClientHandler<___T>,
5753 ___T: ::fidl_next::Transport,
5754{
5755 async fn on_event(
5756 handler: &mut ___H,
5757 ordinal: u64,
5758 flexibility: ::fidl_next::protocol::Flexibility,
5759 body: ::fidl_next::Body<___T>,
5760 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5761 match ordinal {
5762 ordinal => {
5763 handler.on_unknown_interaction(ordinal).await;
5764 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5765 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5766 } else {
5767 Ok(())
5768 }
5769 }
5770 }
5771 }
5772}
5773
5774#[diagnostic::on_unimplemented(
5775 note = "If {Self} implements the non-local TopologyServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5776)]
5777
5778pub trait TopologyLocalServerHandler<
5782 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5783 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5784>
5785{
5786 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
5787 fn add_element(
5788 &mut self,
5789
5790 request: ::fidl_next::Request<topology::AddElement, ___T>,
5791
5792 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
5793 ) -> impl ::core::future::Future<Output = ()>;
5794
5795 #[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"]
5796 fn lease(
5797 &mut self,
5798
5799 request: ::fidl_next::Request<topology::Lease, ___T>,
5800
5801 responder: ::fidl_next::Responder<topology::Lease, ___T>,
5802 ) -> impl ::core::future::Future<Output = ()>;
5803
5804 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5805 ::core::future::ready(())
5806 }
5807}
5808
5809impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Topology
5810where
5811 ___H: TopologyLocalServerHandler<___T>,
5812 ___T: ::fidl_next::Transport,
5813 for<'de> crate::wire::ElementSchema<'de>: ::fidl_next::Decode<
5814 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5815 Constraint = (),
5816 >,
5817 for<'de> crate::wire::LeaseSchema<'de>: ::fidl_next::Decode<
5818 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5819 Constraint = (),
5820 >,
5821{
5822 async fn on_one_way(
5823 handler: &mut ___H,
5824 ordinal: u64,
5825 flexibility: ::fidl_next::protocol::Flexibility,
5826 body: ::fidl_next::Body<___T>,
5827 ) -> ::core::result::Result<
5828 (),
5829 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5830 > {
5831 match ordinal {
5832 ordinal => {
5833 handler.on_unknown_interaction(ordinal).await;
5834 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5835 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5836 } else {
5837 Ok(())
5838 }
5839 }
5840 }
5841 }
5842
5843 async fn on_two_way(
5844 handler: &mut ___H,
5845 ordinal: u64,
5846 flexibility: ::fidl_next::protocol::Flexibility,
5847 body: ::fidl_next::Body<___T>,
5848 responder: ::fidl_next::protocol::Responder<___T>,
5849 ) -> ::core::result::Result<
5850 (),
5851 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5852 > {
5853 match ordinal {
5854 2782900474142521859 => {
5855 let responder = ::fidl_next::Responder::from_untyped(responder);
5856
5857 match ::fidl_next::AsDecoderExt::into_decoded(body) {
5858 Ok(decoded) => {
5859 handler
5860 .add_element(::fidl_next::Request::from_decoded(decoded), responder)
5861 .await;
5862 Ok(())
5863 }
5864 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5865 ordinal: 2782900474142521859,
5866 error,
5867 }),
5868 }
5869 }
5870
5871 9167569827696956208 => {
5872 let responder = ::fidl_next::Responder::from_untyped(responder);
5873
5874 match ::fidl_next::AsDecoderExt::into_decoded(body) {
5875 Ok(decoded) => {
5876 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
5877 Ok(())
5878 }
5879 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5880 ordinal: 9167569827696956208,
5881 error,
5882 }),
5883 }
5884 }
5885
5886 ordinal => {
5887 handler.on_unknown_interaction(ordinal).await;
5888 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5889 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5890 } else {
5891 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
5892 ordinal,
5893 flexibility,
5894 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
5895 )
5896 .expect("encoding a framework error should never fail")
5897 .await?;
5898 Ok(())
5899 }
5900 }
5901 }
5902 }
5903}
5904
5905pub trait TopologyClientHandler<
5909 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5910 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5911>
5912{
5913 fn on_unknown_interaction(
5914 &mut self,
5915 ordinal: u64,
5916 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5917 ::core::future::ready(())
5918 }
5919}
5920
5921impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Topology
5922where
5923 ___H: TopologyClientHandler<___T> + ::core::marker::Send,
5924 ___T: ::fidl_next::Transport,
5925{
5926 async fn on_event(
5927 handler: &mut ___H,
5928 ordinal: u64,
5929 flexibility: ::fidl_next::protocol::Flexibility,
5930 body: ::fidl_next::Body<___T>,
5931 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5932 match ordinal {
5933 ordinal => {
5934 handler.on_unknown_interaction(ordinal).await;
5935 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5936 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5937 } else {
5938 Ok(())
5939 }
5940 }
5941 }
5942 }
5943}
5944
5945pub trait TopologyServerHandler<
5949 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5950 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5951>
5952{
5953 #[doc = " Called by a Power Element owner to register a new Power Element and\n open control channels for that element.\n"]
5954 fn add_element(
5955 &mut self,
5956
5957 request: ::fidl_next::Request<topology::AddElement, ___T>,
5958
5959 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
5960 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5961
5962 #[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"]
5963 fn lease(
5964 &mut self,
5965
5966 request: ::fidl_next::Request<topology::Lease, ___T>,
5967
5968 responder: ::fidl_next::Responder<topology::Lease, ___T>,
5969 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5970
5971 fn on_unknown_interaction(
5972 &mut self,
5973 ordinal: u64,
5974 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5975 ::core::future::ready(())
5976 }
5977}
5978
5979impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Topology
5980where
5981 ___H: TopologyServerHandler<___T> + ::core::marker::Send,
5982 ___T: ::fidl_next::Transport,
5983 for<'de> crate::wire::ElementSchema<'de>: ::fidl_next::Decode<
5984 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5985 Constraint = (),
5986 >,
5987 for<'de> crate::wire::LeaseSchema<'de>: ::fidl_next::Decode<
5988 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5989 Constraint = (),
5990 >,
5991{
5992 async fn on_one_way(
5993 handler: &mut ___H,
5994 ordinal: u64,
5995 flexibility: ::fidl_next::protocol::Flexibility,
5996 body: ::fidl_next::Body<___T>,
5997 ) -> ::core::result::Result<
5998 (),
5999 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6000 > {
6001 match ordinal {
6002 ordinal => {
6003 handler.on_unknown_interaction(ordinal).await;
6004 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
6005 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6006 } else {
6007 Ok(())
6008 }
6009 }
6010 }
6011 }
6012
6013 async fn on_two_way(
6014 handler: &mut ___H,
6015 ordinal: u64,
6016 flexibility: ::fidl_next::protocol::Flexibility,
6017 body: ::fidl_next::Body<___T>,
6018 responder: ::fidl_next::protocol::Responder<___T>,
6019 ) -> ::core::result::Result<
6020 (),
6021 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6022 > {
6023 match ordinal {
6024 2782900474142521859 => {
6025 let responder = ::fidl_next::Responder::from_untyped(responder);
6026
6027 match ::fidl_next::AsDecoderExt::into_decoded(body) {
6028 Ok(decoded) => {
6029 handler
6030 .add_element(::fidl_next::Request::from_decoded(decoded), responder)
6031 .await;
6032 Ok(())
6033 }
6034 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6035 ordinal: 2782900474142521859,
6036 error,
6037 }),
6038 }
6039 }
6040
6041 9167569827696956208 => {
6042 let responder = ::fidl_next::Responder::from_untyped(responder);
6043
6044 match ::fidl_next::AsDecoderExt::into_decoded(body) {
6045 Ok(decoded) => {
6046 handler.lease(::fidl_next::Request::from_decoded(decoded), responder).await;
6047 Ok(())
6048 }
6049 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6050 ordinal: 9167569827696956208,
6051 error,
6052 }),
6053 }
6054 }
6055
6056 ordinal => {
6057 handler.on_unknown_interaction(ordinal).await;
6058 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
6059 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6060 } else {
6061 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
6062 ordinal,
6063 flexibility,
6064 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
6065 )
6066 .expect("encoding a framework error should never fail")
6067 .await?;
6068 Ok(())
6069 }
6070 }
6071 }
6072 }
6073}
6074
6075impl<___T> TopologyClientHandler<___T> for ::fidl_next::IgnoreEvents
6076where
6077 ___T: ::fidl_next::Transport,
6078{
6079 async fn on_unknown_interaction(&mut self, _: u64) {}
6080}
6081
6082impl<___H, ___T> TopologyLocalClientHandler<___T> for ::fidl_next::Local<___H>
6083where
6084 ___H: TopologyClientHandler<___T>,
6085 ___T: ::fidl_next::Transport,
6086{
6087 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6088 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6089 }
6090}
6091
6092impl<___H, ___T> TopologyLocalServerHandler<___T> for ::fidl_next::Local<___H>
6093where
6094 ___H: TopologyServerHandler<___T>,
6095 ___T: ::fidl_next::Transport,
6096{
6097 async fn add_element(
6098 &mut self,
6099
6100 request: ::fidl_next::Request<topology::AddElement, ___T>,
6101
6102 responder: ::fidl_next::Responder<topology::AddElement, ___T>,
6103 ) {
6104 ___H::add_element(&mut self.0, request, responder).await
6105 }
6106
6107 async fn lease(
6108 &mut self,
6109
6110 request: ::fidl_next::Request<topology::Lease, ___T>,
6111
6112 responder: ::fidl_next::Responder<topology::Lease, ___T>,
6113 ) {
6114 ___H::lease(&mut self.0, request, responder).await
6115 }
6116
6117 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6118 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6119 }
6120}
6121
6122pub use fidl_next_common_fuchsia_power_broker::*;