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_driver_framework::natural::*;
8
9 #[derive(Debug, Default, PartialEq)]
10 pub struct DevfsAddArgs {
11 pub connector: ::core::option::Option<
12 ::fidl_next::ClientEnd<
13 ::fidl_next_fuchsia_device_fs::Connector,
14 ::fidl_next::fuchsia::zx::Channel,
15 >,
16 >,
17
18 pub class_name: ::core::option::Option<::std::string::String>,
19
20 pub inspect: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
21
22 pub connector_supports:
23 ::core::option::Option<::fidl_next_fuchsia_device_fs::natural::ConnectionType>,
24
25 pub controller_connector: ::core::option::Option<
26 ::fidl_next::ClientEnd<
27 ::fidl_next_fuchsia_device_fs::Connector,
28 ::fidl_next::fuchsia::zx::Channel,
29 >,
30 >,
31 }
32
33 impl DevfsAddArgs {
34 fn __max_ordinal(&self) -> usize {
35 if self.controller_connector.is_some() {
36 return 5;
37 }
38
39 if self.connector_supports.is_some() {
40 return 4;
41 }
42
43 if self.inspect.is_some() {
44 return 3;
45 }
46
47 if self.class_name.is_some() {
48 return 2;
49 }
50
51 if self.connector.is_some() {
52 return 1;
53 }
54
55 0
56 }
57 }
58
59 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DevfsAddArgs<'static>, ___E> for DevfsAddArgs
60 where
61 ___E: ::fidl_next::Encoder + ?Sized,
62 ___E: ::fidl_next::fuchsia::HandleEncoder,
63 {
64 #[inline]
65 fn encode(
66 mut self,
67 encoder: &mut ___E,
68 out: &mut ::core::mem::MaybeUninit<crate::wire::DevfsAddArgs<'static>>,
69 _: (),
70 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
71 ::fidl_next::munge!(let crate::wire::DevfsAddArgs { table } = out);
72
73 let max_ord = self.__max_ordinal();
74
75 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
76 ::fidl_next::Wire::zero_padding(&mut out);
77
78 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
79 ::fidl_next::wire::Envelope,
80 >(encoder, max_ord);
81
82 for i in 1..=max_ord {
83 match i {
84 5 => {
85 if let Some(value) = self.controller_connector.take() {
86 ::fidl_next::wire::Envelope::encode_value::<
87 ::fidl_next::ClientEnd<
88 ::fidl_next_fuchsia_device_fs::Connector,
89 ::fidl_next::wire::fuchsia::Channel,
90 >,
91 ___E,
92 >(
93 value, preallocated.encoder, &mut out, ()
94 )?;
95 } else {
96 ::fidl_next::wire::Envelope::encode_zero(&mut out)
97 }
98 }
99
100 4 => {
101 if let Some(value) = self.connector_supports.take() {
102 ::fidl_next::wire::Envelope::encode_value::<
103 ::fidl_next_fuchsia_device_fs::wire::ConnectionType,
104 ___E,
105 >(
106 value, preallocated.encoder, &mut out, ()
107 )?;
108 } else {
109 ::fidl_next::wire::Envelope::encode_zero(&mut out)
110 }
111 }
112
113 3 => {
114 if let Some(value) = self.inspect.take() {
115 ::fidl_next::wire::Envelope::encode_value::<
116 ::fidl_next::wire::fuchsia::Vmo,
117 ___E,
118 >(
119 value, preallocated.encoder, &mut out, ()
120 )?;
121 } else {
122 ::fidl_next::wire::Envelope::encode_zero(&mut out)
123 }
124 }
125
126 2 => {
127 if let Some(value) = self.class_name.take() {
128 ::fidl_next::wire::Envelope::encode_value::<
129 ::fidl_next::wire::String<'static>,
130 ___E,
131 >(
132 value, preallocated.encoder, &mut out, 255
133 )?;
134 } else {
135 ::fidl_next::wire::Envelope::encode_zero(&mut out)
136 }
137 }
138
139 1 => {
140 if let Some(value) = self.connector.take() {
141 ::fidl_next::wire::Envelope::encode_value::<
142 ::fidl_next::ClientEnd<
143 ::fidl_next_fuchsia_device_fs::Connector,
144 ::fidl_next::wire::fuchsia::Channel,
145 >,
146 ___E,
147 >(
148 value, preallocated.encoder, &mut out, ()
149 )?;
150 } else {
151 ::fidl_next::wire::Envelope::encode_zero(&mut out)
152 }
153 }
154
155 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
156 }
157 unsafe {
158 preallocated.write_next(out.assume_init_ref());
159 }
160 }
161
162 ::fidl_next::wire::Table::encode_len(table, max_ord);
163
164 Ok(())
165 }
166 }
167
168 impl<'de> ::fidl_next::FromWire<crate::wire::DevfsAddArgs<'de>> for DevfsAddArgs {
169 #[inline]
170 fn from_wire(wire_: crate::wire::DevfsAddArgs<'de>) -> Self {
171 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
172
173 let connector = wire_.table.get(1);
174
175 let class_name = wire_.table.get(2);
176
177 let inspect = wire_.table.get(3);
178
179 let connector_supports = wire_.table.get(4);
180
181 let controller_connector = wire_.table.get(5);
182
183 Self {
184 connector: connector.map(|envelope| {
185 ::fidl_next::FromWire::from_wire(unsafe {
186 envelope.read_unchecked::<::fidl_next::ClientEnd<
187 ::fidl_next_fuchsia_device_fs::Connector,
188 ::fidl_next::wire::fuchsia::Channel,
189 >>()
190 })
191 }),
192
193 class_name: class_name.map(|envelope| {
194 ::fidl_next::FromWire::from_wire(unsafe {
195 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
196 })
197 }),
198
199 inspect: inspect.map(|envelope| {
200 ::fidl_next::FromWire::from_wire(unsafe {
201 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
202 })
203 }),
204
205 connector_supports: connector_supports.map(|envelope| {
206 ::fidl_next::FromWire::from_wire(unsafe {
207 envelope
208 .read_unchecked::<::fidl_next_fuchsia_device_fs::wire::ConnectionType>()
209 })
210 }),
211
212 controller_connector: controller_connector.map(|envelope| {
213 ::fidl_next::FromWire::from_wire(unsafe {
214 envelope.read_unchecked::<::fidl_next::ClientEnd<
215 ::fidl_next_fuchsia_device_fs::Connector,
216 ::fidl_next::wire::fuchsia::Channel,
217 >>()
218 })
219 }),
220 }
221 }
222 }
223
224 #[derive(Debug, Default, PartialEq)]
225 pub struct PowerElementArgs {
226 pub control_client: ::core::option::Option<
227 ::fidl_next::ClientEnd<
228 ::fidl_next_fuchsia_power_broker::ElementControl,
229 ::fidl_next::fuchsia::zx::Channel,
230 >,
231 >,
232
233 pub runner_server: ::core::option::Option<
234 ::fidl_next::ServerEnd<
235 ::fidl_next_fuchsia_power_broker::ElementRunner,
236 ::fidl_next::fuchsia::zx::Channel,
237 >,
238 >,
239
240 pub lessor_client: ::core::option::Option<
241 ::fidl_next::ClientEnd<
242 ::fidl_next_fuchsia_power_broker::Lessor,
243 ::fidl_next::fuchsia::zx::Channel,
244 >,
245 >,
246
247 pub token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
248 }
249
250 impl PowerElementArgs {
251 fn __max_ordinal(&self) -> usize {
252 if self.token.is_some() {
253 return 4;
254 }
255
256 if self.lessor_client.is_some() {
257 return 3;
258 }
259
260 if self.runner_server.is_some() {
261 return 2;
262 }
263
264 if self.control_client.is_some() {
265 return 1;
266 }
267
268 0
269 }
270 }
271
272 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerElementArgs<'static>, ___E>
273 for PowerElementArgs
274 where
275 ___E: ::fidl_next::Encoder + ?Sized,
276 ___E: ::fidl_next::fuchsia::HandleEncoder,
277 {
278 #[inline]
279 fn encode(
280 mut self,
281 encoder: &mut ___E,
282 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerElementArgs<'static>>,
283 _: (),
284 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
285 ::fidl_next::munge!(let crate::wire::PowerElementArgs { table } = out);
286
287 let max_ord = self.__max_ordinal();
288
289 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
290 ::fidl_next::Wire::zero_padding(&mut out);
291
292 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
293 ::fidl_next::wire::Envelope,
294 >(encoder, max_ord);
295
296 for i in 1..=max_ord {
297 match i {
298 4 => {
299 if let Some(value) = self.token.take() {
300 ::fidl_next::wire::Envelope::encode_value::<
301 ::fidl_next::wire::fuchsia::Event,
302 ___E,
303 >(
304 value, preallocated.encoder, &mut out, ()
305 )?;
306 } else {
307 ::fidl_next::wire::Envelope::encode_zero(&mut out)
308 }
309 }
310
311 3 => {
312 if let Some(value) = self.lessor_client.take() {
313 ::fidl_next::wire::Envelope::encode_value::<
314 ::fidl_next::ClientEnd<
315 ::fidl_next_fuchsia_power_broker::Lessor,
316 ::fidl_next::wire::fuchsia::Channel,
317 >,
318 ___E,
319 >(
320 value, preallocated.encoder, &mut out, ()
321 )?;
322 } else {
323 ::fidl_next::wire::Envelope::encode_zero(&mut out)
324 }
325 }
326
327 2 => {
328 if let Some(value) = self.runner_server.take() {
329 ::fidl_next::wire::Envelope::encode_value::<
330 ::fidl_next::ServerEnd<
331 ::fidl_next_fuchsia_power_broker::ElementRunner,
332 ::fidl_next::wire::fuchsia::Channel,
333 >,
334 ___E,
335 >(
336 value, preallocated.encoder, &mut out, ()
337 )?;
338 } else {
339 ::fidl_next::wire::Envelope::encode_zero(&mut out)
340 }
341 }
342
343 1 => {
344 if let Some(value) = self.control_client.take() {
345 ::fidl_next::wire::Envelope::encode_value::<
346 ::fidl_next::ClientEnd<
347 ::fidl_next_fuchsia_power_broker::ElementControl,
348 ::fidl_next::wire::fuchsia::Channel,
349 >,
350 ___E,
351 >(
352 value, preallocated.encoder, &mut out, ()
353 )?;
354 } else {
355 ::fidl_next::wire::Envelope::encode_zero(&mut out)
356 }
357 }
358
359 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
360 }
361 unsafe {
362 preallocated.write_next(out.assume_init_ref());
363 }
364 }
365
366 ::fidl_next::wire::Table::encode_len(table, max_ord);
367
368 Ok(())
369 }
370 }
371
372 impl<'de> ::fidl_next::FromWire<crate::wire::PowerElementArgs<'de>> for PowerElementArgs {
373 #[inline]
374 fn from_wire(wire_: crate::wire::PowerElementArgs<'de>) -> Self {
375 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
376
377 let control_client = wire_.table.get(1);
378
379 let runner_server = wire_.table.get(2);
380
381 let lessor_client = wire_.table.get(3);
382
383 let token = wire_.table.get(4);
384
385 Self {
386 control_client: control_client.map(|envelope| {
387 ::fidl_next::FromWire::from_wire(unsafe {
388 envelope.read_unchecked::<::fidl_next::ClientEnd<
389 ::fidl_next_fuchsia_power_broker::ElementControl,
390 ::fidl_next::wire::fuchsia::Channel,
391 >>()
392 })
393 }),
394
395 runner_server: runner_server.map(|envelope| {
396 ::fidl_next::FromWire::from_wire(unsafe {
397 envelope.read_unchecked::<::fidl_next::ServerEnd<
398 ::fidl_next_fuchsia_power_broker::ElementRunner,
399 ::fidl_next::wire::fuchsia::Channel,
400 >>()
401 })
402 }),
403
404 lessor_client: lessor_client.map(|envelope| {
405 ::fidl_next::FromWire::from_wire(unsafe {
406 envelope.read_unchecked::<::fidl_next::ClientEnd<
407 ::fidl_next_fuchsia_power_broker::Lessor,
408 ::fidl_next::wire::fuchsia::Channel,
409 >>()
410 })
411 }),
412
413 token: token.map(|envelope| {
414 ::fidl_next::FromWire::from_wire(unsafe {
415 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
416 })
417 }),
418 }
419 }
420 }
421
422 #[derive(Debug, PartialEq)]
423 #[repr(C)]
424 pub struct DriverResumeRequest {
425 pub power_element_lease: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
426 }
427
428 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DriverResumeRequest, ___E>
429 for DriverResumeRequest
430 where
431 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
432 ___E: ::fidl_next::fuchsia::HandleEncoder,
433 {
434 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
435 Self,
436 crate::wire::DriverResumeRequest,
437 > = unsafe {
438 ::fidl_next::CopyOptimization::enable_if(
439 true
440
441 && <
442 ::core::option::Option<::fidl_next::fuchsia::zx::EventPair> as ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>
443 >::COPY_OPTIMIZATION.is_enabled()
444
445 )
446 };
447
448 #[inline]
449 fn encode(
450 self,
451 encoder_: &mut ___E,
452 out_: &mut ::core::mem::MaybeUninit<crate::wire::DriverResumeRequest>,
453 _: (),
454 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
455 ::fidl_next::munge! {
456 let crate::wire::DriverResumeRequest {
457 power_element_lease,
458
459 } = out_;
460 }
461
462 ::fidl_next::Encode::encode(
463 self.power_element_lease,
464 encoder_,
465 power_element_lease,
466 (),
467 )?;
468
469 let mut _field =
470 unsafe { ::fidl_next::Slot::new_unchecked(power_element_lease.as_mut_ptr()) };
471
472 Ok(())
473 }
474 }
475
476 unsafe impl<___E>
477 ::fidl_next::EncodeOption<
478 ::fidl_next::wire::Box<'static, crate::wire::DriverResumeRequest>,
479 ___E,
480 > for DriverResumeRequest
481 where
482 ___E: ::fidl_next::Encoder + ?Sized,
483 DriverResumeRequest: ::fidl_next::Encode<crate::wire::DriverResumeRequest, ___E>,
484 {
485 #[inline]
486 fn encode_option(
487 this: ::core::option::Option<Self>,
488 encoder: &mut ___E,
489 out: &mut ::core::mem::MaybeUninit<
490 ::fidl_next::wire::Box<'static, crate::wire::DriverResumeRequest>,
491 >,
492 _: (),
493 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
494 if let Some(inner) = this {
495 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
496 ::fidl_next::wire::Box::encode_present(out);
497 } else {
498 ::fidl_next::wire::Box::encode_absent(out);
499 }
500
501 Ok(())
502 }
503 }
504
505 impl ::fidl_next::FromWire<crate::wire::DriverResumeRequest> for DriverResumeRequest {
506 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
507 crate::wire::DriverResumeRequest,
508 Self,
509 > = unsafe {
510 ::fidl_next::CopyOptimization::enable_if(
511 true
512
513 && <
514 ::core::option::Option<::fidl_next::fuchsia::zx::EventPair> as ::fidl_next::FromWire<::fidl_next::wire::fuchsia::OptionalEventPair>
515 >::COPY_OPTIMIZATION.is_enabled()
516
517 )
518 };
519
520 #[inline]
521 fn from_wire(wire: crate::wire::DriverResumeRequest) -> Self {
522 Self { power_element_lease: ::fidl_next::FromWire::from_wire(wire.power_element_lease) }
523 }
524 }
525
526 #[doc = " Arguments for starting a driver.\n"]
527 #[derive(Debug, Default, PartialEq)]
528 pub struct DriverStartArgs {
529 pub node: ::core::option::Option<
530 ::fidl_next::ClientEnd<crate::Node, ::fidl_next::fuchsia::zx::Channel>,
531 >,
532
533 pub symbols: ::core::option::Option<::std::vec::Vec<crate::natural::NodeSymbol>>,
534
535 pub url: ::core::option::Option<::std::string::String>,
536
537 pub program: ::core::option::Option<::fidl_next_fuchsia_data::natural::Dictionary>,
538
539 pub incoming: ::core::option::Option<
540 ::std::vec::Vec<::fidl_next_fuchsia_component_runner::natural::ComponentNamespaceEntry>,
541 >,
542
543 pub outgoing_dir: ::core::option::Option<
544 ::fidl_next::ServerEnd<
545 ::fidl_next_fuchsia_io::Directory,
546 ::fidl_next::fuchsia::zx::Channel,
547 >,
548 >,
549
550 pub config: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
551
552 pub node_name: ::core::option::Option<::std::string::String>,
553
554 pub node_properties:
555 ::core::option::Option<::std::vec::Vec<crate::natural::NodePropertyEntry>>,
556
557 pub node_offers: ::core::option::Option<::std::vec::Vec<crate::natural::Offer>>,
558
559 pub node_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
560
561 pub node_properties_2:
562 ::core::option::Option<::std::vec::Vec<crate::natural::NodePropertyEntry2>>,
563
564 pub vmar: ::core::option::Option<::fidl_next::fuchsia::zx::Vmar>,
565
566 pub power_element_args: ::core::option::Option<crate::natural::PowerElementArgs>,
567
568 pub log_sink: ::core::option::Option<
569 ::fidl_next::ClientEnd<
570 ::fidl_next_fuchsia_logger::LogSink,
571 ::fidl_next::fuchsia::zx::Channel,
572 >,
573 >,
574 }
575
576 impl DriverStartArgs {
577 fn __max_ordinal(&self) -> usize {
578 if self.log_sink.is_some() {
579 return 15;
580 }
581
582 if self.power_element_args.is_some() {
583 return 14;
584 }
585
586 if self.vmar.is_some() {
587 return 13;
588 }
589
590 if self.node_properties_2.is_some() {
591 return 12;
592 }
593
594 if self.node_token.is_some() {
595 return 11;
596 }
597
598 if self.node_offers.is_some() {
599 return 10;
600 }
601
602 if self.node_properties.is_some() {
603 return 9;
604 }
605
606 if self.node_name.is_some() {
607 return 8;
608 }
609
610 if self.config.is_some() {
611 return 7;
612 }
613
614 if self.outgoing_dir.is_some() {
615 return 6;
616 }
617
618 if self.incoming.is_some() {
619 return 5;
620 }
621
622 if self.program.is_some() {
623 return 4;
624 }
625
626 if self.url.is_some() {
627 return 3;
628 }
629
630 if self.symbols.is_some() {
631 return 2;
632 }
633
634 if self.node.is_some() {
635 return 1;
636 }
637
638 0
639 }
640 }
641
642 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DriverStartArgs<'static>, ___E>
643 for DriverStartArgs
644 where
645 ___E: ::fidl_next::Encoder + ?Sized,
646 ___E: ::fidl_next::fuchsia::HandleEncoder,
647 {
648 #[inline]
649 fn encode(
650 mut self,
651 encoder: &mut ___E,
652 out: &mut ::core::mem::MaybeUninit<crate::wire::DriverStartArgs<'static>>,
653 _: (),
654 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
655 ::fidl_next::munge!(let crate::wire::DriverStartArgs { table } = out);
656
657 let max_ord = self.__max_ordinal();
658
659 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
660 ::fidl_next::Wire::zero_padding(&mut out);
661
662 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
663 ::fidl_next::wire::Envelope,
664 >(encoder, max_ord);
665
666 for i in 1..=max_ord {
667 match i {
668 15 => {
669 if let Some(value) = self.log_sink.take() {
670 ::fidl_next::wire::Envelope::encode_value::<
671 ::fidl_next::ClientEnd<
672 ::fidl_next_fuchsia_logger::LogSink,
673 ::fidl_next::wire::fuchsia::Channel,
674 >,
675 ___E,
676 >(
677 value, preallocated.encoder, &mut out, ()
678 )?;
679 } else {
680 ::fidl_next::wire::Envelope::encode_zero(&mut out)
681 }
682 }
683
684 14 => {
685 if let Some(value) = self.power_element_args.take() {
686 ::fidl_next::wire::Envelope::encode_value::<
687 crate::wire::PowerElementArgs<'static>,
688 ___E,
689 >(
690 value, preallocated.encoder, &mut out, ()
691 )?;
692 } else {
693 ::fidl_next::wire::Envelope::encode_zero(&mut out)
694 }
695 }
696
697 13 => {
698 if let Some(value) = self.vmar.take() {
699 ::fidl_next::wire::Envelope::encode_value::<
700 ::fidl_next::wire::fuchsia::Vmar,
701 ___E,
702 >(
703 value, preallocated.encoder, &mut out, ()
704 )?;
705 } else {
706 ::fidl_next::wire::Envelope::encode_zero(&mut out)
707 }
708 }
709
710 12 => {
711 if let Some(value) = self.node_properties_2.take() {
712 ::fidl_next::wire::Envelope::encode_value::<
713 ::fidl_next::wire::Vector<
714 'static,
715 crate::wire::NodePropertyEntry2<'static>,
716 >,
717 ___E,
718 >(
719 value, preallocated.encoder, &mut out, (4294967295, ())
720 )?;
721 } else {
722 ::fidl_next::wire::Envelope::encode_zero(&mut out)
723 }
724 }
725
726 11 => {
727 if let Some(value) = self.node_token.take() {
728 ::fidl_next::wire::Envelope::encode_value::<
729 ::fidl_next::wire::fuchsia::Event,
730 ___E,
731 >(
732 value, preallocated.encoder, &mut out, ()
733 )?;
734 } else {
735 ::fidl_next::wire::Envelope::encode_zero(&mut out)
736 }
737 }
738
739 10 => {
740 if let Some(value) = self.node_offers.take() {
741 ::fidl_next::wire::Envelope::encode_value::<
742 ::fidl_next::wire::Vector<'static, crate::wire::Offer<'static>>,
743 ___E,
744 >(
745 value, preallocated.encoder, &mut out, (128, ())
746 )?;
747 } else {
748 ::fidl_next::wire::Envelope::encode_zero(&mut out)
749 }
750 }
751
752 9 => {
753 if let Some(value) = self.node_properties.take() {
754 ::fidl_next::wire::Envelope::encode_value::<
755 ::fidl_next::wire::Vector<
756 'static,
757 crate::wire::NodePropertyEntry<'static>,
758 >,
759 ___E,
760 >(
761 value, preallocated.encoder, &mut out, (4294967295, ())
762 )?;
763 } else {
764 ::fidl_next::wire::Envelope::encode_zero(&mut out)
765 }
766 }
767
768 8 => {
769 if let Some(value) = self.node_name.take() {
770 ::fidl_next::wire::Envelope::encode_value::<
771 ::fidl_next::wire::String<'static>,
772 ___E,
773 >(
774 value, preallocated.encoder, &mut out, 4294967295
775 )?;
776 } else {
777 ::fidl_next::wire::Envelope::encode_zero(&mut out)
778 }
779 }
780
781 7 => {
782 if let Some(value) = self.config.take() {
783 ::fidl_next::wire::Envelope::encode_value::<
784 ::fidl_next::wire::fuchsia::Vmo,
785 ___E,
786 >(
787 value, preallocated.encoder, &mut out, ()
788 )?;
789 } else {
790 ::fidl_next::wire::Envelope::encode_zero(&mut out)
791 }
792 }
793
794 6 => {
795 if let Some(value) = self.outgoing_dir.take() {
796 ::fidl_next::wire::Envelope::encode_value::<
797 ::fidl_next::ServerEnd<
798 ::fidl_next_fuchsia_io::Directory,
799 ::fidl_next::wire::fuchsia::Channel,
800 >,
801 ___E,
802 >(
803 value, preallocated.encoder, &mut out, ()
804 )?;
805 } else {
806 ::fidl_next::wire::Envelope::encode_zero(&mut out)
807 }
808 }
809
810 5 => {
811 if let Some(value) = self.incoming.take() {
812 ::fidl_next::wire::Envelope::encode_value::<::fidl_next::wire::Vector<'static, ::fidl_next_fuchsia_component_runner::wire::ComponentNamespaceEntry<'static>>, ___E>(
813 value,
814 preallocated.encoder,
815 &mut out,
816 (32, ()),
817 )?;
818 } else {
819 ::fidl_next::wire::Envelope::encode_zero(&mut out)
820 }
821 }
822
823 4 => {
824 if let Some(value) = self.program.take() {
825 ::fidl_next::wire::Envelope::encode_value::<
826 ::fidl_next_fuchsia_data::wire::Dictionary<'static>,
827 ___E,
828 >(
829 value, preallocated.encoder, &mut out, ()
830 )?;
831 } else {
832 ::fidl_next::wire::Envelope::encode_zero(&mut out)
833 }
834 }
835
836 3 => {
837 if let Some(value) = self.url.take() {
838 ::fidl_next::wire::Envelope::encode_value::<
839 ::fidl_next::wire::String<'static>,
840 ___E,
841 >(
842 value, preallocated.encoder, &mut out, 4096
843 )?;
844 } else {
845 ::fidl_next::wire::Envelope::encode_zero(&mut out)
846 }
847 }
848
849 2 => {
850 if let Some(value) = self.symbols.take() {
851 ::fidl_next::wire::Envelope::encode_value::<
852 ::fidl_next::wire::Vector<
853 'static,
854 crate::wire::NodeSymbol<'static>,
855 >,
856 ___E,
857 >(
858 value, preallocated.encoder, &mut out, (64, ())
859 )?;
860 } else {
861 ::fidl_next::wire::Envelope::encode_zero(&mut out)
862 }
863 }
864
865 1 => {
866 if let Some(value) = self.node.take() {
867 ::fidl_next::wire::Envelope::encode_value::<
868 ::fidl_next::ClientEnd<
869 crate::Node,
870 ::fidl_next::wire::fuchsia::Channel,
871 >,
872 ___E,
873 >(
874 value, preallocated.encoder, &mut out, ()
875 )?;
876 } else {
877 ::fidl_next::wire::Envelope::encode_zero(&mut out)
878 }
879 }
880
881 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
882 }
883 unsafe {
884 preallocated.write_next(out.assume_init_ref());
885 }
886 }
887
888 ::fidl_next::wire::Table::encode_len(table, max_ord);
889
890 Ok(())
891 }
892 }
893
894 impl<'de> ::fidl_next::FromWire<crate::wire::DriverStartArgs<'de>> for DriverStartArgs {
895 #[inline]
896 fn from_wire(wire_: crate::wire::DriverStartArgs<'de>) -> Self {
897 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
898
899 let node = wire_.table.get(1);
900
901 let symbols = wire_.table.get(2);
902
903 let url = wire_.table.get(3);
904
905 let program = wire_.table.get(4);
906
907 let incoming = wire_.table.get(5);
908
909 let outgoing_dir = wire_.table.get(6);
910
911 let config = wire_.table.get(7);
912
913 let node_name = wire_.table.get(8);
914
915 let node_properties = wire_.table.get(9);
916
917 let node_offers = wire_.table.get(10);
918
919 let node_token = wire_.table.get(11);
920
921 let node_properties_2 = wire_.table.get(12);
922
923 let vmar = wire_.table.get(13);
924
925 let power_element_args = wire_.table.get(14);
926
927 let log_sink = wire_.table.get(15);
928
929 Self {
930
931
932 node: node.map(|envelope| ::fidl_next::FromWire::from_wire(
933 unsafe { envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Node, ::fidl_next::wire::fuchsia::Channel>>() }
934 )),
935
936
937 symbols: symbols.map(|envelope| ::fidl_next::FromWire::from_wire(
938 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodeSymbol<'de>>>() }
939 )),
940
941
942 url: url.map(|envelope| ::fidl_next::FromWire::from_wire(
943 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
944 )),
945
946
947 program: program.map(|envelope| ::fidl_next::FromWire::from_wire(
948 unsafe { envelope.read_unchecked::<::fidl_next_fuchsia_data::wire::Dictionary<'de>>() }
949 )),
950
951
952 incoming: incoming.map(|envelope| ::fidl_next::FromWire::from_wire(
953 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, ::fidl_next_fuchsia_component_runner::wire::ComponentNamespaceEntry<'de>>>() }
954 )),
955
956
957 outgoing_dir: outgoing_dir.map(|envelope| ::fidl_next::FromWire::from_wire(
958 unsafe { envelope.read_unchecked::<::fidl_next::ServerEnd<::fidl_next_fuchsia_io::Directory, ::fidl_next::wire::fuchsia::Channel>>() }
959 )),
960
961
962 config: config.map(|envelope| ::fidl_next::FromWire::from_wire(
963 unsafe { envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>() }
964 )),
965
966
967 node_name: node_name.map(|envelope| ::fidl_next::FromWire::from_wire(
968 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
969 )),
970
971
972 node_properties: node_properties.map(|envelope| ::fidl_next::FromWire::from_wire(
973 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodePropertyEntry<'de>>>() }
974 )),
975
976
977 node_offers: node_offers.map(|envelope| ::fidl_next::FromWire::from_wire(
978 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Offer<'de>>>() }
979 )),
980
981
982 node_token: node_token.map(|envelope| ::fidl_next::FromWire::from_wire(
983 unsafe { envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>() }
984 )),
985
986
987 node_properties_2: node_properties_2.map(|envelope| ::fidl_next::FromWire::from_wire(
988 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodePropertyEntry2<'de>>>() }
989 )),
990
991
992 vmar: vmar.map(|envelope| ::fidl_next::FromWire::from_wire(
993 unsafe { envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmar>() }
994 )),
995
996
997 power_element_args: power_element_args.map(|envelope| ::fidl_next::FromWire::from_wire(
998 unsafe { envelope.read_unchecked::<crate::wire::PowerElementArgs<'de>>() }
999 )),
1000
1001
1002 log_sink: log_sink.map(|envelope| ::fidl_next::FromWire::from_wire(
1003 unsafe { envelope.read_unchecked::<::fidl_next::ClientEnd<::fidl_next_fuchsia_logger::LogSink, ::fidl_next::wire::fuchsia::Channel>>() }
1004 )),
1005
1006 }
1007 }
1008 }
1009
1010 #[derive(Debug, PartialEq)]
1011 pub struct DriverStartRequest {
1012 pub start_args: crate::natural::DriverStartArgs,
1013 }
1014
1015 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DriverStartRequest<'static>, ___E>
1016 for DriverStartRequest
1017 where
1018 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1019 ___E: ::fidl_next::Encoder,
1020 ___E: ::fidl_next::fuchsia::HandleEncoder,
1021 {
1022 #[inline]
1023 fn encode(
1024 self,
1025 encoder_: &mut ___E,
1026 out_: &mut ::core::mem::MaybeUninit<crate::wire::DriverStartRequest<'static>>,
1027 _: (),
1028 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1029 ::fidl_next::munge! {
1030 let crate::wire::DriverStartRequest {
1031 start_args,
1032
1033 } = out_;
1034 }
1035
1036 ::fidl_next::Encode::encode(self.start_args, encoder_, start_args, ())?;
1037
1038 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(start_args.as_mut_ptr()) };
1039
1040 Ok(())
1041 }
1042 }
1043
1044 unsafe impl<___E>
1045 ::fidl_next::EncodeOption<
1046 ::fidl_next::wire::Box<'static, crate::wire::DriverStartRequest<'static>>,
1047 ___E,
1048 > for DriverStartRequest
1049 where
1050 ___E: ::fidl_next::Encoder + ?Sized,
1051 DriverStartRequest: ::fidl_next::Encode<crate::wire::DriverStartRequest<'static>, ___E>,
1052 {
1053 #[inline]
1054 fn encode_option(
1055 this: ::core::option::Option<Self>,
1056 encoder: &mut ___E,
1057 out: &mut ::core::mem::MaybeUninit<
1058 ::fidl_next::wire::Box<'static, crate::wire::DriverStartRequest<'static>>,
1059 >,
1060 _: (),
1061 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1062 if let Some(inner) = this {
1063 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1064 ::fidl_next::wire::Box::encode_present(out);
1065 } else {
1066 ::fidl_next::wire::Box::encode_absent(out);
1067 }
1068
1069 Ok(())
1070 }
1071 }
1072
1073 impl<'de> ::fidl_next::FromWire<crate::wire::DriverStartRequest<'de>> for DriverStartRequest {
1074 #[inline]
1075 fn from_wire(wire: crate::wire::DriverStartRequest<'de>) -> Self {
1076 Self { start_args: ::fidl_next::FromWire::from_wire(wire.start_args) }
1077 }
1078 }
1079
1080 #[derive(Debug, PartialEq)]
1081 pub enum DriverResult {
1082 DriverStartedNodeToken(::fidl_next::fuchsia::zx::Event),
1083
1084 MatchError(i32),
1085
1086 StartError(i32),
1087
1088 UnknownOrdinal_(u64),
1089 }
1090
1091 impl DriverResult {
1092 pub fn is_unknown(&self) -> bool {
1093 #[allow(unreachable_patterns)]
1094 match self {
1095 Self::UnknownOrdinal_(_) => true,
1096 _ => false,
1097 }
1098 }
1099 }
1100
1101 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DriverResult<'static>, ___E> for DriverResult
1102 where
1103 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1104 ___E: ::fidl_next::Encoder,
1105 ___E: ::fidl_next::fuchsia::HandleEncoder,
1106 {
1107 #[inline]
1108 fn encode(
1109 self,
1110 encoder: &mut ___E,
1111 out: &mut ::core::mem::MaybeUninit<crate::wire::DriverResult<'static>>,
1112 _: (),
1113 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1114 ::fidl_next::munge!(let crate::wire::DriverResult { raw, _phantom: _ } = out);
1115
1116 match self {
1117 Self::DriverStartedNodeToken(value) => ::fidl_next::wire::Union::encode_as::<
1118 ___E,
1119 ::fidl_next::wire::fuchsia::Event,
1120 >(
1121 value, 1, encoder, raw, ()
1122 )?,
1123
1124 Self::MatchError(value) => ::fidl_next::wire::Union::encode_as::<
1125 ___E,
1126 ::fidl_next::wire::Int32,
1127 >(value, 2, encoder, raw, ())?,
1128
1129 Self::StartError(value) => ::fidl_next::wire::Union::encode_as::<
1130 ___E,
1131 ::fidl_next::wire::Int32,
1132 >(value, 3, encoder, raw, ())?,
1133
1134 Self::UnknownOrdinal_(ordinal) => {
1135 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize));
1136 }
1137 }
1138
1139 Ok(())
1140 }
1141 }
1142
1143 unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::DriverResult<'static>, ___E>
1144 for DriverResult
1145 where
1146 ___E: ?Sized,
1147 DriverResult: ::fidl_next::Encode<crate::wire::DriverResult<'static>, ___E>,
1148 {
1149 #[inline]
1150 fn encode_option(
1151 this: ::core::option::Option<Self>,
1152 encoder: &mut ___E,
1153 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DriverResult<'static>>,
1154 _: (),
1155 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1156 ::fidl_next::munge!(let crate::wire_optional::DriverResult { raw, _phantom: _ } = &mut *out);
1157
1158 if let Some(inner) = this {
1159 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
1160 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
1161 } else {
1162 ::fidl_next::wire::Union::encode_absent(raw);
1163 }
1164
1165 Ok(())
1166 }
1167 }
1168
1169 impl<'de> ::fidl_next::FromWire<crate::wire::DriverResult<'de>> for DriverResult {
1170 #[inline]
1171 fn from_wire(wire: crate::wire::DriverResult<'de>) -> Self {
1172 let wire = ::core::mem::ManuallyDrop::new(wire);
1173 match wire.raw.ordinal() {
1174 1 => Self::DriverStartedNodeToken(::fidl_next::FromWire::from_wire(unsafe {
1175 wire.raw.get().read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1176 })),
1177
1178 2 => Self::MatchError(::fidl_next::FromWire::from_wire(unsafe {
1179 wire.raw.get().read_unchecked::<::fidl_next::wire::Int32>()
1180 })),
1181
1182 3 => Self::StartError(::fidl_next::FromWire::from_wire(unsafe {
1183 wire.raw.get().read_unchecked::<::fidl_next::wire::Int32>()
1184 })),
1185
1186 ord => return Self::UnknownOrdinal_(ord as u64),
1187 }
1188 }
1189 }
1190
1191 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DriverResult<'de>> for DriverResult {
1192 #[inline]
1193 fn from_wire_option(
1194 wire: crate::wire_optional::DriverResult<'de>,
1195 ) -> ::core::option::Option<Self> {
1196 if let Some(inner) = wire.into_option() {
1197 Some(::fidl_next::FromWire::from_wire(inner))
1198 } else {
1199 None
1200 }
1201 }
1202 }
1203
1204 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DriverResult<'de>>
1205 for Box<DriverResult>
1206 {
1207 #[inline]
1208 fn from_wire_option(
1209 wire: crate::wire_optional::DriverResult<'de>,
1210 ) -> ::core::option::Option<Self> {
1211 <
1212 DriverResult as ::fidl_next::FromWireOption<crate::wire_optional::DriverResult<'de>>
1213 >::from_wire_option(wire).map(Box::new)
1214 }
1215 }
1216
1217 #[doc = " Arguments for adding a node.\n"]
1218 #[derive(Debug, Default, PartialEq)]
1219 pub struct NodeAddArgs {
1220 pub name: ::core::option::Option<::std::string::String>,
1221
1222 pub symbols: ::core::option::Option<::std::vec::Vec<crate::natural::NodeSymbol>>,
1223
1224 pub properties: ::core::option::Option<::std::vec::Vec<crate::natural::NodeProperty>>,
1225
1226 pub devfs_args: ::core::option::Option<crate::natural::DevfsAddArgs>,
1227
1228 pub offers2: ::core::option::Option<::std::vec::Vec<crate::natural::Offer>>,
1229
1230 pub bus_info: ::core::option::Option<crate::natural::BusInfo>,
1231
1232 pub properties2: ::core::option::Option<::std::vec::Vec<crate::natural::NodeProperty2>>,
1233
1234 pub offers_dictionary:
1235 ::core::option::Option<::fidl_next_fuchsia_component_sandbox::natural::DictionaryRef>,
1236
1237 pub driver_host: ::core::option::Option<::std::string::String>,
1238 }
1239
1240 impl NodeAddArgs {
1241 fn __max_ordinal(&self) -> usize {
1242 if self.driver_host.is_some() {
1243 return 10;
1244 }
1245
1246 if self.offers_dictionary.is_some() {
1247 return 9;
1248 }
1249
1250 if self.properties2.is_some() {
1251 return 8;
1252 }
1253
1254 if self.bus_info.is_some() {
1255 return 7;
1256 }
1257
1258 if self.offers2.is_some() {
1259 return 6;
1260 }
1261
1262 if self.devfs_args.is_some() {
1263 return 5;
1264 }
1265
1266 if self.properties.is_some() {
1267 return 4;
1268 }
1269
1270 if self.symbols.is_some() {
1271 return 3;
1272 }
1273
1274 if self.name.is_some() {
1275 return 1;
1276 }
1277
1278 0
1279 }
1280 }
1281
1282 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeAddArgs<'static>, ___E> for NodeAddArgs
1283 where
1284 ___E: ::fidl_next::Encoder + ?Sized,
1285 ___E: ::fidl_next::fuchsia::HandleEncoder,
1286 {
1287 #[inline]
1288 fn encode(
1289 mut self,
1290 encoder: &mut ___E,
1291 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeAddArgs<'static>>,
1292 _: (),
1293 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1294 ::fidl_next::munge!(let crate::wire::NodeAddArgs { table } = out);
1295
1296 let max_ord = self.__max_ordinal();
1297
1298 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1299 ::fidl_next::Wire::zero_padding(&mut out);
1300
1301 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1302 ::fidl_next::wire::Envelope,
1303 >(encoder, max_ord);
1304
1305 for i in 1..=max_ord {
1306 match i {
1307 10 => {
1308 if let Some(value) = self.driver_host.take() {
1309 ::fidl_next::wire::Envelope::encode_value::<
1310 ::fidl_next::wire::String<'static>,
1311 ___E,
1312 >(
1313 value, preallocated.encoder, &mut out, 128
1314 )?;
1315 } else {
1316 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1317 }
1318 }
1319
1320 9 => {
1321 if let Some(value) = self.offers_dictionary.take() {
1322 ::fidl_next::wire::Envelope::encode_value::<
1323 ::fidl_next_fuchsia_component_sandbox::wire::DictionaryRef,
1324 ___E,
1325 >(
1326 value, preallocated.encoder, &mut out, ()
1327 )?;
1328 } else {
1329 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1330 }
1331 }
1332
1333 8 => {
1334 if let Some(value) = self.properties2.take() {
1335 ::fidl_next::wire::Envelope::encode_value::<
1336 ::fidl_next::wire::Vector<
1337 'static,
1338 crate::wire::NodeProperty2<'static>,
1339 >,
1340 ___E,
1341 >(
1342 value, preallocated.encoder, &mut out, (64, ())
1343 )?;
1344 } else {
1345 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1346 }
1347 }
1348
1349 7 => {
1350 if let Some(value) = self.bus_info.take() {
1351 ::fidl_next::wire::Envelope::encode_value::<
1352 crate::wire::BusInfo<'static>,
1353 ___E,
1354 >(
1355 value, preallocated.encoder, &mut out, ()
1356 )?;
1357 } else {
1358 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1359 }
1360 }
1361
1362 6 => {
1363 if let Some(value) = self.offers2.take() {
1364 ::fidl_next::wire::Envelope::encode_value::<
1365 ::fidl_next::wire::Vector<'static, crate::wire::Offer<'static>>,
1366 ___E,
1367 >(
1368 value, preallocated.encoder, &mut out, (128, ())
1369 )?;
1370 } else {
1371 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1372 }
1373 }
1374
1375 5 => {
1376 if let Some(value) = self.devfs_args.take() {
1377 ::fidl_next::wire::Envelope::encode_value::<
1378 crate::wire::DevfsAddArgs<'static>,
1379 ___E,
1380 >(
1381 value, preallocated.encoder, &mut out, ()
1382 )?;
1383 } else {
1384 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1385 }
1386 }
1387
1388 4 => {
1389 if let Some(value) = self.properties.take() {
1390 ::fidl_next::wire::Envelope::encode_value::<
1391 ::fidl_next::wire::Vector<
1392 'static,
1393 crate::wire::NodeProperty<'static>,
1394 >,
1395 ___E,
1396 >(
1397 value, preallocated.encoder, &mut out, (64, ())
1398 )?;
1399 } else {
1400 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1401 }
1402 }
1403
1404 3 => {
1405 if let Some(value) = self.symbols.take() {
1406 ::fidl_next::wire::Envelope::encode_value::<
1407 ::fidl_next::wire::Vector<
1408 'static,
1409 crate::wire::NodeSymbol<'static>,
1410 >,
1411 ___E,
1412 >(
1413 value, preallocated.encoder, &mut out, (64, ())
1414 )?;
1415 } else {
1416 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1417 }
1418 }
1419
1420 1 => {
1421 if let Some(value) = self.name.take() {
1422 ::fidl_next::wire::Envelope::encode_value::<
1423 ::fidl_next::wire::String<'static>,
1424 ___E,
1425 >(
1426 value, preallocated.encoder, &mut out, 128
1427 )?;
1428 } else {
1429 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1430 }
1431 }
1432
1433 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1434 }
1435 unsafe {
1436 preallocated.write_next(out.assume_init_ref());
1437 }
1438 }
1439
1440 ::fidl_next::wire::Table::encode_len(table, max_ord);
1441
1442 Ok(())
1443 }
1444 }
1445
1446 impl<'de> ::fidl_next::FromWire<crate::wire::NodeAddArgs<'de>> for NodeAddArgs {
1447 #[inline]
1448 fn from_wire(wire_: crate::wire::NodeAddArgs<'de>) -> Self {
1449 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1450
1451 let name = wire_.table.get(1);
1452
1453 let symbols = wire_.table.get(3);
1454
1455 let properties = wire_.table.get(4);
1456
1457 let devfs_args = wire_.table.get(5);
1458
1459 let offers2 = wire_.table.get(6);
1460
1461 let bus_info = wire_.table.get(7);
1462
1463 let properties2 = wire_.table.get(8);
1464
1465 let offers_dictionary = wire_.table.get(9);
1466
1467 let driver_host = wire_.table.get(10);
1468
1469 Self {
1470
1471
1472 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
1473 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
1474 )),
1475
1476
1477 symbols: symbols.map(|envelope| ::fidl_next::FromWire::from_wire(
1478 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodeSymbol<'de>>>() }
1479 )),
1480
1481
1482 properties: properties.map(|envelope| ::fidl_next::FromWire::from_wire(
1483 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodeProperty<'de>>>() }
1484 )),
1485
1486
1487 devfs_args: devfs_args.map(|envelope| ::fidl_next::FromWire::from_wire(
1488 unsafe { envelope.read_unchecked::<crate::wire::DevfsAddArgs<'de>>() }
1489 )),
1490
1491
1492 offers2: offers2.map(|envelope| ::fidl_next::FromWire::from_wire(
1493 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Offer<'de>>>() }
1494 )),
1495
1496
1497 bus_info: bus_info.map(|envelope| ::fidl_next::FromWire::from_wire(
1498 unsafe { envelope.read_unchecked::<crate::wire::BusInfo<'de>>() }
1499 )),
1500
1501
1502 properties2: properties2.map(|envelope| ::fidl_next::FromWire::from_wire(
1503 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodeProperty2<'de>>>() }
1504 )),
1505
1506
1507 offers_dictionary: offers_dictionary.map(|envelope| ::fidl_next::FromWire::from_wire(
1508 unsafe { envelope.read_unchecked::<::fidl_next_fuchsia_component_sandbox::wire::DictionaryRef>() }
1509 )),
1510
1511
1512 driver_host: driver_host.map(|envelope| ::fidl_next::FromWire::from_wire(
1513 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
1514 )),
1515
1516 }
1517 }
1518 }
1519
1520 #[derive(Debug, PartialEq)]
1521 pub struct NodeAddChildRequest {
1522 pub args: crate::natural::NodeAddArgs,
1523
1524 pub controller:
1525 ::fidl_next::ServerEnd<crate::NodeController, ::fidl_next::fuchsia::zx::Channel>,
1526
1527 pub node: ::core::option::Option<
1528 ::fidl_next::ServerEnd<crate::Node, ::fidl_next::fuchsia::zx::Channel>,
1529 >,
1530 }
1531
1532 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeAddChildRequest<'static>, ___E>
1533 for NodeAddChildRequest
1534 where
1535 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1536 ___E: ::fidl_next::Encoder,
1537 ___E: ::fidl_next::fuchsia::HandleEncoder,
1538 {
1539 #[inline]
1540 fn encode(
1541 self,
1542 encoder_: &mut ___E,
1543 out_: &mut ::core::mem::MaybeUninit<crate::wire::NodeAddChildRequest<'static>>,
1544 _: (),
1545 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1546 ::fidl_next::munge! {
1547 let crate::wire::NodeAddChildRequest {
1548 args,
1549 controller,
1550 node,
1551
1552 } = out_;
1553 }
1554
1555 ::fidl_next::Encode::encode(self.args, encoder_, args, ())?;
1556
1557 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(args.as_mut_ptr()) };
1558
1559 ::fidl_next::Encode::encode(self.controller, encoder_, controller, ())?;
1560
1561 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(controller.as_mut_ptr()) };
1562
1563 ::fidl_next::Encode::encode(self.node, encoder_, node, ())?;
1564
1565 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(node.as_mut_ptr()) };
1566
1567 Ok(())
1568 }
1569 }
1570
1571 unsafe impl<___E>
1572 ::fidl_next::EncodeOption<
1573 ::fidl_next::wire::Box<'static, crate::wire::NodeAddChildRequest<'static>>,
1574 ___E,
1575 > for NodeAddChildRequest
1576 where
1577 ___E: ::fidl_next::Encoder + ?Sized,
1578 NodeAddChildRequest: ::fidl_next::Encode<crate::wire::NodeAddChildRequest<'static>, ___E>,
1579 {
1580 #[inline]
1581 fn encode_option(
1582 this: ::core::option::Option<Self>,
1583 encoder: &mut ___E,
1584 out: &mut ::core::mem::MaybeUninit<
1585 ::fidl_next::wire::Box<'static, crate::wire::NodeAddChildRequest<'static>>,
1586 >,
1587 _: (),
1588 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1589 if let Some(inner) = this {
1590 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1591 ::fidl_next::wire::Box::encode_present(out);
1592 } else {
1593 ::fidl_next::wire::Box::encode_absent(out);
1594 }
1595
1596 Ok(())
1597 }
1598 }
1599
1600 impl<'de> ::fidl_next::FromWire<crate::wire::NodeAddChildRequest<'de>> for NodeAddChildRequest {
1601 #[inline]
1602 fn from_wire(wire: crate::wire::NodeAddChildRequest<'de>) -> Self {
1603 Self {
1604 args: ::fidl_next::FromWire::from_wire(wire.args),
1605
1606 controller: ::fidl_next::FromWire::from_wire(wire.controller),
1607
1608 node: ::fidl_next::FromWire::from_wire(wire.node),
1609 }
1610 }
1611 }
1612
1613 #[derive(Debug, Default, PartialEq)]
1614 pub struct NodeControllerOnBindRequest {
1615 pub node_token: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
1616 }
1617
1618 impl NodeControllerOnBindRequest {
1619 fn __max_ordinal(&self) -> usize {
1620 if self.node_token.is_some() {
1621 return 1;
1622 }
1623
1624 0
1625 }
1626 }
1627
1628 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeControllerOnBindRequest<'static>, ___E>
1629 for NodeControllerOnBindRequest
1630 where
1631 ___E: ::fidl_next::Encoder + ?Sized,
1632 ___E: ::fidl_next::fuchsia::HandleEncoder,
1633 {
1634 #[inline]
1635 fn encode(
1636 mut self,
1637 encoder: &mut ___E,
1638 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeControllerOnBindRequest<'static>>,
1639 _: (),
1640 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1641 ::fidl_next::munge!(let crate::wire::NodeControllerOnBindRequest { table } = out);
1642
1643 let max_ord = self.__max_ordinal();
1644
1645 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1646 ::fidl_next::Wire::zero_padding(&mut out);
1647
1648 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1649 ::fidl_next::wire::Envelope,
1650 >(encoder, max_ord);
1651
1652 for i in 1..=max_ord {
1653 match i {
1654 1 => {
1655 if let Some(value) = self.node_token.take() {
1656 ::fidl_next::wire::Envelope::encode_value::<
1657 ::fidl_next::wire::fuchsia::Event,
1658 ___E,
1659 >(
1660 value, preallocated.encoder, &mut out, ()
1661 )?;
1662 } else {
1663 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1664 }
1665 }
1666
1667 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1668 }
1669 unsafe {
1670 preallocated.write_next(out.assume_init_ref());
1671 }
1672 }
1673
1674 ::fidl_next::wire::Table::encode_len(table, max_ord);
1675
1676 Ok(())
1677 }
1678 }
1679
1680 impl<'de> ::fidl_next::FromWire<crate::wire::NodeControllerOnBindRequest<'de>>
1681 for NodeControllerOnBindRequest
1682 {
1683 #[inline]
1684 fn from_wire(wire_: crate::wire::NodeControllerOnBindRequest<'de>) -> Self {
1685 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1686
1687 let node_token = wire_.table.get(1);
1688
1689 Self {
1690 node_token: node_token.map(|envelope| {
1691 ::fidl_next::FromWire::from_wire(unsafe {
1692 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1693 })
1694 }),
1695 }
1696 }
1697 }
1698}
1699
1700pub mod wire {
1701
1702 pub use fidl_next_common_fuchsia_driver_framework::wire::*;
1703
1704 #[repr(C)]
1706 pub struct DevfsAddArgs<'de> {
1707 pub(crate) table: ::fidl_next::wire::Table<'de>,
1708 }
1709
1710 impl<'de> Drop for DevfsAddArgs<'de> {
1711 fn drop(&mut self) {
1712 let _ = self.table.get(1).map(|envelope| unsafe {
1713 envelope.read_unchecked::<::fidl_next::ClientEnd<
1714 ::fidl_next_fuchsia_device_fs::Connector,
1715 ::fidl_next::wire::fuchsia::Channel,
1716 >>()
1717 });
1718
1719 let _ = self.table.get(2).map(|envelope| unsafe {
1720 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
1721 });
1722
1723 let _ = self.table.get(3).map(|envelope| unsafe {
1724 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
1725 });
1726
1727 let _ = self.table.get(4).map(|envelope| unsafe {
1728 envelope.read_unchecked::<::fidl_next_fuchsia_device_fs::wire::ConnectionType>()
1729 });
1730
1731 let _ = self.table.get(5).map(|envelope| unsafe {
1732 envelope.read_unchecked::<::fidl_next::ClientEnd<
1733 ::fidl_next_fuchsia_device_fs::Connector,
1734 ::fidl_next::wire::fuchsia::Channel,
1735 >>()
1736 });
1737 }
1738 }
1739
1740 impl ::fidl_next::Constrained for DevfsAddArgs<'_> {
1741 type Constraint = ();
1742
1743 fn validate(
1744 _: ::fidl_next::Slot<'_, Self>,
1745 _: Self::Constraint,
1746 ) -> Result<(), ::fidl_next::ValidationError> {
1747 Ok(())
1748 }
1749 }
1750
1751 unsafe impl ::fidl_next::Wire for DevfsAddArgs<'static> {
1752 type Narrowed<'de> = DevfsAddArgs<'de>;
1753
1754 #[inline]
1755 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1756 ::fidl_next::munge!(let Self { table } = out);
1757 ::fidl_next::wire::Table::zero_padding(table);
1758 }
1759 }
1760
1761 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DevfsAddArgs<'de>
1762 where
1763 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1764 ___D: ::fidl_next::fuchsia::HandleDecoder,
1765 {
1766 fn decode(
1767 slot: ::fidl_next::Slot<'_, Self>,
1768 decoder: &mut ___D,
1769 _: (),
1770 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1771 ::fidl_next::munge!(let Self { table } = slot);
1772
1773 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1774 match ordinal {
1775 0 => unsafe { ::core::hint::unreachable_unchecked() },
1776
1777 1 => {
1778 ::fidl_next::wire::Envelope::decode_as::<
1779 ___D,
1780 ::fidl_next::ClientEnd<
1781 ::fidl_next_fuchsia_device_fs::Connector,
1782 ::fidl_next::wire::fuchsia::Channel,
1783 >,
1784 >(slot.as_mut(), decoder, ())?;
1785
1786 Ok(())
1787 }
1788
1789 2 => {
1790 ::fidl_next::wire::Envelope::decode_as::<
1791 ___D,
1792 ::fidl_next::wire::String<'de>,
1793 >(slot.as_mut(), decoder, 255)?;
1794
1795 let value = unsafe {
1796 slot.deref_unchecked()
1797 .deref_unchecked::<::fidl_next::wire::String<'_>>()
1798 };
1799
1800 if value.len() > 255 {
1801 return Err(::fidl_next::DecodeError::VectorTooLong {
1802 size: value.len() as u64,
1803 limit: 255,
1804 });
1805 }
1806
1807 Ok(())
1808 }
1809
1810 3 => {
1811 ::fidl_next::wire::Envelope::decode_as::<
1812 ___D,
1813 ::fidl_next::wire::fuchsia::Vmo,
1814 >(slot.as_mut(), decoder, ())?;
1815
1816 Ok(())
1817 }
1818
1819 4 => {
1820 ::fidl_next::wire::Envelope::decode_as::<
1821 ___D,
1822 ::fidl_next_fuchsia_device_fs::wire::ConnectionType,
1823 >(slot.as_mut(), decoder, ())?;
1824
1825 Ok(())
1826 }
1827
1828 5 => {
1829 ::fidl_next::wire::Envelope::decode_as::<
1830 ___D,
1831 ::fidl_next::ClientEnd<
1832 ::fidl_next_fuchsia_device_fs::Connector,
1833 ::fidl_next::wire::fuchsia::Channel,
1834 >,
1835 >(slot.as_mut(), decoder, ())?;
1836
1837 Ok(())
1838 }
1839
1840 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1841 }
1842 })
1843 }
1844 }
1845
1846 impl<'de> DevfsAddArgs<'de> {
1847 pub fn connector(
1848 &self,
1849 ) -> ::core::option::Option<
1850 &::fidl_next::ClientEnd<
1851 ::fidl_next_fuchsia_device_fs::Connector,
1852 ::fidl_next::wire::fuchsia::Channel,
1853 >,
1854 > {
1855 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1856 }
1857
1858 pub fn class_name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
1859 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1860 }
1861
1862 pub fn inspect(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
1863 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
1864 }
1865
1866 pub fn connector_supports(
1867 &self,
1868 ) -> ::core::option::Option<&::fidl_next_fuchsia_device_fs::wire::ConnectionType> {
1869 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
1870 }
1871
1872 pub fn controller_connector(
1873 &self,
1874 ) -> ::core::option::Option<
1875 &::fidl_next::ClientEnd<
1876 ::fidl_next_fuchsia_device_fs::Connector,
1877 ::fidl_next::wire::fuchsia::Channel,
1878 >,
1879 > {
1880 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
1881 }
1882 }
1883
1884 impl<'de> ::core::fmt::Debug for DevfsAddArgs<'de> {
1885 fn fmt(
1886 &self,
1887 f: &mut ::core::fmt::Formatter<'_>,
1888 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1889 f.debug_struct("DevfsAddArgs")
1890 .field("connector", &self.connector())
1891 .field("class_name", &self.class_name())
1892 .field("inspect", &self.inspect())
1893 .field("connector_supports", &self.connector_supports())
1894 .field("controller_connector", &self.controller_connector())
1895 .finish()
1896 }
1897 }
1898
1899 impl<'de> ::fidl_next::IntoNatural for DevfsAddArgs<'de> {
1900 type Natural = crate::natural::DevfsAddArgs;
1901 }
1902
1903 #[repr(C)]
1905 pub struct PowerElementArgs<'de> {
1906 pub(crate) table: ::fidl_next::wire::Table<'de>,
1907 }
1908
1909 impl<'de> Drop for PowerElementArgs<'de> {
1910 fn drop(&mut self) {
1911 let _ = self.table.get(1).map(|envelope| unsafe {
1912 envelope.read_unchecked::<::fidl_next::ClientEnd<
1913 ::fidl_next_fuchsia_power_broker::ElementControl,
1914 ::fidl_next::wire::fuchsia::Channel,
1915 >>()
1916 });
1917
1918 let _ = self.table.get(2).map(|envelope| unsafe {
1919 envelope.read_unchecked::<::fidl_next::ServerEnd<
1920 ::fidl_next_fuchsia_power_broker::ElementRunner,
1921 ::fidl_next::wire::fuchsia::Channel,
1922 >>()
1923 });
1924
1925 let _ = self.table.get(3).map(|envelope| unsafe {
1926 envelope.read_unchecked::<::fidl_next::ClientEnd<
1927 ::fidl_next_fuchsia_power_broker::Lessor,
1928 ::fidl_next::wire::fuchsia::Channel,
1929 >>()
1930 });
1931
1932 let _ = self.table.get(4).map(|envelope| unsafe {
1933 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
1934 });
1935 }
1936 }
1937
1938 impl ::fidl_next::Constrained for PowerElementArgs<'_> {
1939 type Constraint = ();
1940
1941 fn validate(
1942 _: ::fidl_next::Slot<'_, Self>,
1943 _: Self::Constraint,
1944 ) -> Result<(), ::fidl_next::ValidationError> {
1945 Ok(())
1946 }
1947 }
1948
1949 unsafe impl ::fidl_next::Wire for PowerElementArgs<'static> {
1950 type Narrowed<'de> = PowerElementArgs<'de>;
1951
1952 #[inline]
1953 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1954 ::fidl_next::munge!(let Self { table } = out);
1955 ::fidl_next::wire::Table::zero_padding(table);
1956 }
1957 }
1958
1959 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElementArgs<'de>
1960 where
1961 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1962 ___D: ::fidl_next::fuchsia::HandleDecoder,
1963 {
1964 fn decode(
1965 slot: ::fidl_next::Slot<'_, Self>,
1966 decoder: &mut ___D,
1967 _: (),
1968 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1969 ::fidl_next::munge!(let Self { table } = slot);
1970
1971 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1972 match ordinal {
1973 0 => unsafe { ::core::hint::unreachable_unchecked() },
1974
1975 1 => {
1976 ::fidl_next::wire::Envelope::decode_as::<
1977 ___D,
1978 ::fidl_next::ClientEnd<
1979 ::fidl_next_fuchsia_power_broker::ElementControl,
1980 ::fidl_next::wire::fuchsia::Channel,
1981 >,
1982 >(slot.as_mut(), decoder, ())?;
1983
1984 Ok(())
1985 }
1986
1987 2 => {
1988 ::fidl_next::wire::Envelope::decode_as::<
1989 ___D,
1990 ::fidl_next::ServerEnd<
1991 ::fidl_next_fuchsia_power_broker::ElementRunner,
1992 ::fidl_next::wire::fuchsia::Channel,
1993 >,
1994 >(slot.as_mut(), decoder, ())?;
1995
1996 Ok(())
1997 }
1998
1999 3 => {
2000 ::fidl_next::wire::Envelope::decode_as::<
2001 ___D,
2002 ::fidl_next::ClientEnd<
2003 ::fidl_next_fuchsia_power_broker::Lessor,
2004 ::fidl_next::wire::fuchsia::Channel,
2005 >,
2006 >(slot.as_mut(), decoder, ())?;
2007
2008 Ok(())
2009 }
2010
2011 4 => {
2012 ::fidl_next::wire::Envelope::decode_as::<
2013 ___D,
2014 ::fidl_next::wire::fuchsia::Event,
2015 >(slot.as_mut(), decoder, ())?;
2016
2017 Ok(())
2018 }
2019
2020 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2021 }
2022 })
2023 }
2024 }
2025
2026 impl<'de> PowerElementArgs<'de> {
2027 pub fn control_client(
2028 &self,
2029 ) -> ::core::option::Option<
2030 &::fidl_next::ClientEnd<
2031 ::fidl_next_fuchsia_power_broker::ElementControl,
2032 ::fidl_next::wire::fuchsia::Channel,
2033 >,
2034 > {
2035 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2036 }
2037
2038 pub fn runner_server(
2039 &self,
2040 ) -> ::core::option::Option<
2041 &::fidl_next::ServerEnd<
2042 ::fidl_next_fuchsia_power_broker::ElementRunner,
2043 ::fidl_next::wire::fuchsia::Channel,
2044 >,
2045 > {
2046 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2047 }
2048
2049 pub fn lessor_client(
2050 &self,
2051 ) -> ::core::option::Option<
2052 &::fidl_next::ClientEnd<
2053 ::fidl_next_fuchsia_power_broker::Lessor,
2054 ::fidl_next::wire::fuchsia::Channel,
2055 >,
2056 > {
2057 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2058 }
2059
2060 pub fn token(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2061 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2062 }
2063 }
2064
2065 impl<'de> ::core::fmt::Debug for PowerElementArgs<'de> {
2066 fn fmt(
2067 &self,
2068 f: &mut ::core::fmt::Formatter<'_>,
2069 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2070 f.debug_struct("PowerElementArgs")
2071 .field("control_client", &self.control_client())
2072 .field("runner_server", &self.runner_server())
2073 .field("lessor_client", &self.lessor_client())
2074 .field("token", &self.token())
2075 .finish()
2076 }
2077 }
2078
2079 impl<'de> ::fidl_next::IntoNatural for PowerElementArgs<'de> {
2080 type Natural = crate::natural::PowerElementArgs;
2081 }
2082
2083 #[derive(Debug)]
2085 #[repr(C)]
2086 pub struct DriverResumeRequest {
2087 pub power_element_lease: ::fidl_next::wire::fuchsia::OptionalEventPair,
2088 }
2089
2090 static_assertions::const_assert_eq!(std::mem::size_of::<DriverResumeRequest>(), 4);
2091 static_assertions::const_assert_eq!(std::mem::align_of::<DriverResumeRequest>(), 4);
2092
2093 static_assertions::const_assert_eq!(
2094 std::mem::offset_of!(DriverResumeRequest, power_element_lease),
2095 0
2096 );
2097
2098 impl ::fidl_next::Constrained for DriverResumeRequest {
2099 type Constraint = ();
2100
2101 fn validate(
2102 _: ::fidl_next::Slot<'_, Self>,
2103 _: Self::Constraint,
2104 ) -> Result<(), ::fidl_next::ValidationError> {
2105 Ok(())
2106 }
2107 }
2108
2109 unsafe impl ::fidl_next::Wire for DriverResumeRequest {
2110 type Narrowed<'de> = DriverResumeRequest;
2111
2112 #[inline]
2113 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2114 ::fidl_next::munge! {
2115 let Self {
2116 power_element_lease,
2117
2118 } = &mut *out_;
2119 }
2120
2121 ::fidl_next::Wire::zero_padding(power_element_lease);
2122 }
2123 }
2124
2125 unsafe impl<___D> ::fidl_next::Decode<___D> for DriverResumeRequest
2126 where
2127 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2128 ___D: ::fidl_next::fuchsia::HandleDecoder,
2129 {
2130 fn decode(
2131 slot_: ::fidl_next::Slot<'_, Self>,
2132 decoder_: &mut ___D,
2133 _: (),
2134 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2135 ::fidl_next::munge! {
2136 let Self {
2137 mut power_element_lease,
2138
2139 } = slot_;
2140 }
2141
2142 let _field = power_element_lease.as_mut();
2143
2144 ::fidl_next::Decode::decode(power_element_lease.as_mut(), decoder_, ())?;
2145
2146 Ok(())
2147 }
2148 }
2149
2150 impl ::fidl_next::IntoNatural for DriverResumeRequest {
2151 type Natural = crate::natural::DriverResumeRequest;
2152 }
2153
2154 #[repr(C)]
2156 pub struct DriverStartArgs<'de> {
2157 pub(crate) table: ::fidl_next::wire::Table<'de>,
2158 }
2159
2160 impl<'de> Drop for DriverStartArgs<'de> {
2161 fn drop(&mut self) {
2162 let _ = self.table.get(1)
2163 .map(|envelope| unsafe {
2164 envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Node, ::fidl_next::wire::fuchsia::Channel>>()
2165 });
2166
2167 let _ = self.table.get(2).map(|envelope| unsafe {
2168 envelope
2169 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodeSymbol<'de>>>(
2170 )
2171 });
2172
2173 let _ = self.table.get(3).map(|envelope| unsafe {
2174 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2175 });
2176
2177 let _ = self.table.get(4).map(|envelope| unsafe {
2178 envelope.read_unchecked::<::fidl_next_fuchsia_data::wire::Dictionary<'de>>()
2179 });
2180
2181 let _ = self.table.get(5).map(|envelope| unsafe {
2182 envelope.read_unchecked::<::fidl_next::wire::Vector<
2183 'de,
2184 ::fidl_next_fuchsia_component_runner::wire::ComponentNamespaceEntry<'de>,
2185 >>()
2186 });
2187
2188 let _ = self.table.get(6).map(|envelope| unsafe {
2189 envelope.read_unchecked::<::fidl_next::ServerEnd<
2190 ::fidl_next_fuchsia_io::Directory,
2191 ::fidl_next::wire::fuchsia::Channel,
2192 >>()
2193 });
2194
2195 let _ = self.table.get(7).map(|envelope| unsafe {
2196 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
2197 });
2198
2199 let _ = self.table.get(8).map(|envelope| unsafe {
2200 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2201 });
2202
2203 let _ = self.table.get(9)
2204 .map(|envelope| unsafe {
2205 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodePropertyEntry<'de>>>()
2206 });
2207
2208 let _ = self.table.get(10).map(|envelope| unsafe {
2209 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Offer<'de>>>()
2210 });
2211
2212 let _ = self.table.get(11).map(|envelope| unsafe {
2213 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2214 });
2215
2216 let _ = self.table.get(12)
2217 .map(|envelope| unsafe {
2218 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodePropertyEntry2<'de>>>()
2219 });
2220
2221 let _ = self.table.get(13).map(|envelope| unsafe {
2222 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmar>()
2223 });
2224
2225 let _ = self.table.get(14).map(|envelope| unsafe {
2226 envelope.read_unchecked::<crate::wire::PowerElementArgs<'de>>()
2227 });
2228
2229 let _ = self.table.get(15).map(|envelope| unsafe {
2230 envelope.read_unchecked::<::fidl_next::ClientEnd<
2231 ::fidl_next_fuchsia_logger::LogSink,
2232 ::fidl_next::wire::fuchsia::Channel,
2233 >>()
2234 });
2235 }
2236 }
2237
2238 impl ::fidl_next::Constrained for DriverStartArgs<'_> {
2239 type Constraint = ();
2240
2241 fn validate(
2242 _: ::fidl_next::Slot<'_, Self>,
2243 _: Self::Constraint,
2244 ) -> Result<(), ::fidl_next::ValidationError> {
2245 Ok(())
2246 }
2247 }
2248
2249 unsafe impl ::fidl_next::Wire for DriverStartArgs<'static> {
2250 type Narrowed<'de> = DriverStartArgs<'de>;
2251
2252 #[inline]
2253 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2254 ::fidl_next::munge!(let Self { table } = out);
2255 ::fidl_next::wire::Table::zero_padding(table);
2256 }
2257 }
2258
2259 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DriverStartArgs<'de>
2260 where
2261 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2262 ___D: ::fidl_next::fuchsia::HandleDecoder,
2263 {
2264 fn decode(
2265 slot: ::fidl_next::Slot<'_, Self>,
2266 decoder: &mut ___D,
2267 _: (),
2268 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2269 ::fidl_next::munge!(let Self { table } = slot);
2270
2271 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2272 match ordinal {
2273 0 => unsafe { ::core::hint::unreachable_unchecked() },
2274
2275 1 => {
2276 ::fidl_next::wire::Envelope::decode_as::<
2277 ___D,
2278 ::fidl_next::ClientEnd<
2279 crate::Node,
2280 ::fidl_next::wire::fuchsia::Channel,
2281 >,
2282 >(slot.as_mut(), decoder, ())?;
2283
2284 Ok(())
2285 }
2286
2287 2 => {
2288 ::fidl_next::wire::Envelope::decode_as::<
2289 ___D,
2290 ::fidl_next::wire::Vector<'de, crate::wire::NodeSymbol<'de>>,
2291 >(slot.as_mut(), decoder, (64, ()))?;
2292
2293 let value = unsafe {
2294 slot
2295 .deref_unchecked()
2296 .deref_unchecked::<
2297 ::fidl_next::wire::Vector<'_, crate::wire::NodeSymbol<'_>>
2298 >()
2299 };
2300
2301 if value.len() > 64 {
2302 return Err(::fidl_next::DecodeError::VectorTooLong {
2303 size: value.len() as u64,
2304 limit: 64,
2305 });
2306 }
2307
2308 Ok(())
2309 }
2310
2311 3 => {
2312 ::fidl_next::wire::Envelope::decode_as::<
2313 ___D,
2314 ::fidl_next::wire::String<'de>,
2315 >(slot.as_mut(), decoder, 4096)?;
2316
2317 let value = unsafe {
2318 slot.deref_unchecked()
2319 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2320 };
2321
2322 if value.len() > 4096 {
2323 return Err(::fidl_next::DecodeError::VectorTooLong {
2324 size: value.len() as u64,
2325 limit: 4096,
2326 });
2327 }
2328
2329 Ok(())
2330 }
2331
2332 4 => {
2333 ::fidl_next::wire::Envelope::decode_as::<
2334 ___D,
2335 ::fidl_next_fuchsia_data::wire::Dictionary<'de>,
2336 >(slot.as_mut(), decoder, ())?;
2337
2338 Ok(())
2339 }
2340
2341 5 => {
2342 ::fidl_next::wire::Envelope::decode_as::<
2343 ___D,
2344 ::fidl_next::wire::Vector<
2345 'de,
2346 ::fidl_next_fuchsia_component_runner::wire::ComponentNamespaceEntry<
2347 'de,
2348 >,
2349 >,
2350 >(slot.as_mut(), decoder, (32, ()))?;
2351
2352 let value = unsafe {
2353 slot.deref_unchecked().deref_unchecked::<::fidl_next::wire::Vector<
2354 '_,
2355 ::fidl_next_fuchsia_component_runner::wire::ComponentNamespaceEntry<
2356 '_,
2357 >,
2358 >>()
2359 };
2360
2361 if value.len() > 32 {
2362 return Err(::fidl_next::DecodeError::VectorTooLong {
2363 size: value.len() as u64,
2364 limit: 32,
2365 });
2366 }
2367
2368 Ok(())
2369 }
2370
2371 6 => {
2372 ::fidl_next::wire::Envelope::decode_as::<
2373 ___D,
2374 ::fidl_next::ServerEnd<
2375 ::fidl_next_fuchsia_io::Directory,
2376 ::fidl_next::wire::fuchsia::Channel,
2377 >,
2378 >(slot.as_mut(), decoder, ())?;
2379
2380 Ok(())
2381 }
2382
2383 7 => {
2384 ::fidl_next::wire::Envelope::decode_as::<
2385 ___D,
2386 ::fidl_next::wire::fuchsia::Vmo,
2387 >(slot.as_mut(), decoder, ())?;
2388
2389 Ok(())
2390 }
2391
2392 8 => {
2393 ::fidl_next::wire::Envelope::decode_as::<
2394 ___D,
2395 ::fidl_next::wire::String<'de>,
2396 >(slot.as_mut(), decoder, 4294967295)?;
2397
2398 Ok(())
2399 }
2400
2401 9 => {
2402 ::fidl_next::wire::Envelope::decode_as::<
2403 ___D,
2404 ::fidl_next::wire::Vector<'de, crate::wire::NodePropertyEntry<'de>>,
2405 >(slot.as_mut(), decoder, (4294967295, ()))?;
2406
2407 Ok(())
2408 }
2409
2410 10 => {
2411 ::fidl_next::wire::Envelope::decode_as::<
2412 ___D,
2413 ::fidl_next::wire::Vector<'de, crate::wire::Offer<'de>>,
2414 >(slot.as_mut(), decoder, (128, ()))?;
2415
2416 let value = unsafe {
2417 slot
2418 .deref_unchecked()
2419 .deref_unchecked::<
2420 ::fidl_next::wire::Vector<'_, crate::wire::Offer<'_>>
2421 >()
2422 };
2423
2424 if value.len() > 128 {
2425 return Err(::fidl_next::DecodeError::VectorTooLong {
2426 size: value.len() as u64,
2427 limit: 128,
2428 });
2429 }
2430
2431 Ok(())
2432 }
2433
2434 11 => {
2435 ::fidl_next::wire::Envelope::decode_as::<
2436 ___D,
2437 ::fidl_next::wire::fuchsia::Event,
2438 >(slot.as_mut(), decoder, ())?;
2439
2440 Ok(())
2441 }
2442
2443 12 => {
2444 ::fidl_next::wire::Envelope::decode_as::<
2445 ___D,
2446 ::fidl_next::wire::Vector<'de, crate::wire::NodePropertyEntry2<'de>>,
2447 >(slot.as_mut(), decoder, (4294967295, ()))?;
2448
2449 Ok(())
2450 }
2451
2452 13 => {
2453 ::fidl_next::wire::Envelope::decode_as::<
2454 ___D,
2455 ::fidl_next::wire::fuchsia::Vmar,
2456 >(slot.as_mut(), decoder, ())?;
2457
2458 Ok(())
2459 }
2460
2461 14 => {
2462 ::fidl_next::wire::Envelope::decode_as::<
2463 ___D,
2464 crate::wire::PowerElementArgs<'de>,
2465 >(slot.as_mut(), decoder, ())?;
2466
2467 Ok(())
2468 }
2469
2470 15 => {
2471 ::fidl_next::wire::Envelope::decode_as::<
2472 ___D,
2473 ::fidl_next::ClientEnd<
2474 ::fidl_next_fuchsia_logger::LogSink,
2475 ::fidl_next::wire::fuchsia::Channel,
2476 >,
2477 >(slot.as_mut(), decoder, ())?;
2478
2479 Ok(())
2480 }
2481
2482 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2483 }
2484 })
2485 }
2486 }
2487
2488 impl<'de> DriverStartArgs<'de> {
2489 pub fn node(
2490 &self,
2491 ) -> ::core::option::Option<
2492 &::fidl_next::ClientEnd<crate::Node, ::fidl_next::wire::fuchsia::Channel>,
2493 > {
2494 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2495 }
2496
2497 pub fn symbols(
2498 &self,
2499 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::NodeSymbol<'de>>>
2500 {
2501 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2502 }
2503
2504 pub fn url(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2505 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2506 }
2507
2508 pub fn program(
2509 &self,
2510 ) -> ::core::option::Option<&::fidl_next_fuchsia_data::wire::Dictionary<'de>> {
2511 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2512 }
2513
2514 pub fn incoming(
2515 &self,
2516 ) -> ::core::option::Option<
2517 &::fidl_next::wire::Vector<
2518 'de,
2519 ::fidl_next_fuchsia_component_runner::wire::ComponentNamespaceEntry<'de>,
2520 >,
2521 > {
2522 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
2523 }
2524
2525 pub fn outgoing_dir(
2526 &self,
2527 ) -> ::core::option::Option<
2528 &::fidl_next::ServerEnd<
2529 ::fidl_next_fuchsia_io::Directory,
2530 ::fidl_next::wire::fuchsia::Channel,
2531 >,
2532 > {
2533 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
2534 }
2535
2536 pub fn config(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
2537 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
2538 }
2539
2540 pub fn node_name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
2541 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
2542 }
2543
2544 pub fn node_properties(
2545 &self,
2546 ) -> ::core::option::Option<
2547 &::fidl_next::wire::Vector<'de, crate::wire::NodePropertyEntry<'de>>,
2548 > {
2549 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
2550 }
2551
2552 pub fn node_offers(
2553 &self,
2554 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::Offer<'de>>>
2555 {
2556 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
2557 }
2558
2559 pub fn node_token(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2560 unsafe { Some(self.table.get(11)?.deref_unchecked()) }
2561 }
2562
2563 pub fn node_properties_2(
2564 &self,
2565 ) -> ::core::option::Option<
2566 &::fidl_next::wire::Vector<'de, crate::wire::NodePropertyEntry2<'de>>,
2567 > {
2568 unsafe { Some(self.table.get(12)?.deref_unchecked()) }
2569 }
2570
2571 pub fn vmar(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmar> {
2572 unsafe { Some(self.table.get(13)?.deref_unchecked()) }
2573 }
2574
2575 pub fn power_element_args(
2576 &self,
2577 ) -> ::core::option::Option<&crate::wire::PowerElementArgs<'de>> {
2578 unsafe { Some(self.table.get(14)?.deref_unchecked()) }
2579 }
2580
2581 pub fn log_sink(
2582 &self,
2583 ) -> ::core::option::Option<
2584 &::fidl_next::ClientEnd<
2585 ::fidl_next_fuchsia_logger::LogSink,
2586 ::fidl_next::wire::fuchsia::Channel,
2587 >,
2588 > {
2589 unsafe { Some(self.table.get(15)?.deref_unchecked()) }
2590 }
2591 }
2592
2593 impl<'de> ::core::fmt::Debug for DriverStartArgs<'de> {
2594 fn fmt(
2595 &self,
2596 f: &mut ::core::fmt::Formatter<'_>,
2597 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2598 f.debug_struct("DriverStartArgs")
2599 .field("node", &self.node())
2600 .field("symbols", &self.symbols())
2601 .field("url", &self.url())
2602 .field("program", &self.program())
2603 .field("incoming", &self.incoming())
2604 .field("outgoing_dir", &self.outgoing_dir())
2605 .field("config", &self.config())
2606 .field("node_name", &self.node_name())
2607 .field("node_properties", &self.node_properties())
2608 .field("node_offers", &self.node_offers())
2609 .field("node_token", &self.node_token())
2610 .field("node_properties_2", &self.node_properties_2())
2611 .field("vmar", &self.vmar())
2612 .field("power_element_args", &self.power_element_args())
2613 .field("log_sink", &self.log_sink())
2614 .finish()
2615 }
2616 }
2617
2618 impl<'de> ::fidl_next::IntoNatural for DriverStartArgs<'de> {
2619 type Natural = crate::natural::DriverStartArgs;
2620 }
2621
2622 #[derive(Debug)]
2624 #[repr(C)]
2625 pub struct DriverStartRequest<'de> {
2626 pub start_args: crate::wire::DriverStartArgs<'de>,
2627 }
2628
2629 static_assertions::const_assert_eq!(std::mem::size_of::<DriverStartRequest<'_>>(), 16);
2630 static_assertions::const_assert_eq!(std::mem::align_of::<DriverStartRequest<'_>>(), 8);
2631
2632 static_assertions::const_assert_eq!(
2633 std::mem::offset_of!(DriverStartRequest<'_>, start_args),
2634 0
2635 );
2636
2637 impl ::fidl_next::Constrained for DriverStartRequest<'_> {
2638 type Constraint = ();
2639
2640 fn validate(
2641 _: ::fidl_next::Slot<'_, Self>,
2642 _: Self::Constraint,
2643 ) -> Result<(), ::fidl_next::ValidationError> {
2644 Ok(())
2645 }
2646 }
2647
2648 unsafe impl ::fidl_next::Wire for DriverStartRequest<'static> {
2649 type Narrowed<'de> = DriverStartRequest<'de>;
2650
2651 #[inline]
2652 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2653 ::fidl_next::munge! {
2654 let Self {
2655 start_args,
2656
2657 } = &mut *out_;
2658 }
2659
2660 ::fidl_next::Wire::zero_padding(start_args);
2661 }
2662 }
2663
2664 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DriverStartRequest<'de>
2665 where
2666 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2667 ___D: ::fidl_next::Decoder<'de>,
2668 ___D: ::fidl_next::fuchsia::HandleDecoder,
2669 {
2670 fn decode(
2671 slot_: ::fidl_next::Slot<'_, Self>,
2672 decoder_: &mut ___D,
2673 _: (),
2674 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2675 ::fidl_next::munge! {
2676 let Self {
2677 mut start_args,
2678
2679 } = slot_;
2680 }
2681
2682 let _field = start_args.as_mut();
2683
2684 ::fidl_next::Decode::decode(start_args.as_mut(), decoder_, ())?;
2685
2686 Ok(())
2687 }
2688 }
2689
2690 impl<'de> ::fidl_next::IntoNatural for DriverStartRequest<'de> {
2691 type Natural = crate::natural::DriverStartRequest;
2692 }
2693
2694 #[repr(transparent)]
2696 pub struct DriverResult<'de> {
2697 pub(crate) raw: ::fidl_next::wire::Union,
2698 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
2699 }
2700
2701 impl<'de> Drop for DriverResult<'de> {
2702 fn drop(&mut self) {
2703 match self.raw.ordinal() {
2704 1 => {
2705 let _ = unsafe {
2706 self.raw.get().read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2707 };
2708 }
2709
2710 2 => {
2711 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::wire::Int32>() };
2712 }
2713
2714 3 => {
2715 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::wire::Int32>() };
2716 }
2717
2718 _ => (),
2719 }
2720 }
2721 }
2722
2723 impl ::fidl_next::Constrained for DriverResult<'_> {
2724 type Constraint = ();
2725
2726 fn validate(
2727 _: ::fidl_next::Slot<'_, Self>,
2728 _: Self::Constraint,
2729 ) -> Result<(), ::fidl_next::ValidationError> {
2730 Ok(())
2731 }
2732 }
2733
2734 unsafe impl ::fidl_next::Wire for DriverResult<'static> {
2735 type Narrowed<'de> = DriverResult<'de>;
2736
2737 #[inline]
2738 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2739 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
2740 ::fidl_next::wire::Union::zero_padding(raw);
2741 }
2742 }
2743
2744 pub mod driver_result {
2745 pub enum Ref<'de> {
2746 DriverStartedNodeToken(&'de ::fidl_next::wire::fuchsia::Event),
2747
2748 MatchError(&'de ::fidl_next::wire::Int32),
2749
2750 StartError(&'de ::fidl_next::wire::Int32),
2751
2752 UnknownOrdinal_(u64),
2753 }
2754 }
2755
2756 impl<'de> DriverResult<'de> {
2757 pub fn as_ref(&self) -> crate::wire::driver_result::Ref<'_> {
2758 match self.raw.ordinal() {
2759 1 => crate::wire::driver_result::Ref::DriverStartedNodeToken(unsafe {
2760 self.raw.get().deref_unchecked::<::fidl_next::wire::fuchsia::Event>()
2761 }),
2762
2763 2 => crate::wire::driver_result::Ref::MatchError(unsafe {
2764 self.raw.get().deref_unchecked::<::fidl_next::wire::Int32>()
2765 }),
2766
2767 3 => crate::wire::driver_result::Ref::StartError(unsafe {
2768 self.raw.get().deref_unchecked::<::fidl_next::wire::Int32>()
2769 }),
2770
2771 unknown => crate::wire::driver_result::Ref::UnknownOrdinal_(unknown),
2772 }
2773 }
2774 }
2775
2776 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DriverResult<'de>
2777 where
2778 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2779 ___D: ::fidl_next::Decoder<'de>,
2780 ___D: ::fidl_next::fuchsia::HandleDecoder,
2781 {
2782 fn decode(
2783 mut slot: ::fidl_next::Slot<'_, Self>,
2784 decoder: &mut ___D,
2785 _: (),
2786 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2787 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
2788 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
2789 1 => {
2790 ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::fuchsia::Event>(
2791 raw,
2792 decoder,
2793 (),
2794 )?
2795 }
2796
2797 2 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Int32>(
2798 raw,
2799 decoder,
2800 (),
2801 )?,
2802
2803 3 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Int32>(
2804 raw,
2805 decoder,
2806 (),
2807 )?,
2808
2809 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
2810 }
2811
2812 Ok(())
2813 }
2814 }
2815
2816 impl<'de> ::core::fmt::Debug for DriverResult<'de> {
2817 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2818 match self.raw.ordinal() {
2819 1 => unsafe {
2820 self.raw.get().deref_unchecked::<::fidl_next::wire::fuchsia::Event>().fmt(f)
2821 },
2822 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::wire::Int32>().fmt(f) },
2823 3 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::wire::Int32>().fmt(f) },
2824 _ => unsafe { ::core::hint::unreachable_unchecked() },
2825 }
2826 }
2827 }
2828
2829 impl<'de> ::fidl_next::IntoNatural for DriverResult<'de> {
2830 type Natural = crate::natural::DriverResult;
2831 }
2832
2833 #[repr(C)]
2835 pub struct NodeAddArgs<'de> {
2836 pub(crate) table: ::fidl_next::wire::Table<'de>,
2837 }
2838
2839 impl<'de> Drop for NodeAddArgs<'de> {
2840 fn drop(&mut self) {
2841 let _ = self.table.get(1).map(|envelope| unsafe {
2842 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2843 });
2844
2845 let _ = self.table.get(3).map(|envelope| unsafe {
2846 envelope
2847 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodeSymbol<'de>>>(
2848 )
2849 });
2850
2851 let _ = self.table.get(4)
2852 .map(|envelope| unsafe {
2853 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodeProperty<'de>>>()
2854 });
2855
2856 let _ = self.table.get(5).map(|envelope| unsafe {
2857 envelope.read_unchecked::<crate::wire::DevfsAddArgs<'de>>()
2858 });
2859
2860 let _ = self.table.get(6).map(|envelope| unsafe {
2861 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Offer<'de>>>()
2862 });
2863
2864 let _ = self
2865 .table
2866 .get(7)
2867 .map(|envelope| unsafe { envelope.read_unchecked::<crate::wire::BusInfo<'de>>() });
2868
2869 let _ = self.table.get(8)
2870 .map(|envelope| unsafe {
2871 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::NodeProperty2<'de>>>()
2872 });
2873
2874 let _ = self.table.get(9)
2875 .map(|envelope| unsafe {
2876 envelope.read_unchecked::<::fidl_next_fuchsia_component_sandbox::wire::DictionaryRef>()
2877 });
2878
2879 let _ = self.table.get(10).map(|envelope| unsafe {
2880 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
2881 });
2882 }
2883 }
2884
2885 impl ::fidl_next::Constrained for NodeAddArgs<'_> {
2886 type Constraint = ();
2887
2888 fn validate(
2889 _: ::fidl_next::Slot<'_, Self>,
2890 _: Self::Constraint,
2891 ) -> Result<(), ::fidl_next::ValidationError> {
2892 Ok(())
2893 }
2894 }
2895
2896 unsafe impl ::fidl_next::Wire for NodeAddArgs<'static> {
2897 type Narrowed<'de> = NodeAddArgs<'de>;
2898
2899 #[inline]
2900 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2901 ::fidl_next::munge!(let Self { table } = out);
2902 ::fidl_next::wire::Table::zero_padding(table);
2903 }
2904 }
2905
2906 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeAddArgs<'de>
2907 where
2908 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2909 ___D: ::fidl_next::fuchsia::HandleDecoder,
2910 {
2911 fn decode(
2912 slot: ::fidl_next::Slot<'_, Self>,
2913 decoder: &mut ___D,
2914 _: (),
2915 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2916 ::fidl_next::munge!(let Self { table } = slot);
2917
2918 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2919 match ordinal {
2920 0 => unsafe { ::core::hint::unreachable_unchecked() },
2921
2922 1 => {
2923 ::fidl_next::wire::Envelope::decode_as::<
2924 ___D,
2925 ::fidl_next::wire::String<'de>,
2926 >(slot.as_mut(), decoder, 128)?;
2927
2928 let value = unsafe {
2929 slot.deref_unchecked()
2930 .deref_unchecked::<::fidl_next::wire::String<'_>>()
2931 };
2932
2933 if value.len() > 128 {
2934 return Err(::fidl_next::DecodeError::VectorTooLong {
2935 size: value.len() as u64,
2936 limit: 128,
2937 });
2938 }
2939
2940 Ok(())
2941 }
2942
2943 3 => {
2944 ::fidl_next::wire::Envelope::decode_as::<
2945 ___D,
2946 ::fidl_next::wire::Vector<'de, crate::wire::NodeSymbol<'de>>,
2947 >(slot.as_mut(), decoder, (64, ()))?;
2948
2949 let value = unsafe {
2950 slot
2951 .deref_unchecked()
2952 .deref_unchecked::<
2953 ::fidl_next::wire::Vector<'_, crate::wire::NodeSymbol<'_>>
2954 >()
2955 };
2956
2957 if value.len() > 64 {
2958 return Err(::fidl_next::DecodeError::VectorTooLong {
2959 size: value.len() as u64,
2960 limit: 64,
2961 });
2962 }
2963
2964 Ok(())
2965 }
2966
2967 4 => {
2968 ::fidl_next::wire::Envelope::decode_as::<
2969 ___D,
2970 ::fidl_next::wire::Vector<'de, crate::wire::NodeProperty<'de>>,
2971 >(slot.as_mut(), decoder, (64, ()))?;
2972
2973 let value = unsafe {
2974 slot
2975 .deref_unchecked()
2976 .deref_unchecked::<
2977 ::fidl_next::wire::Vector<'_, crate::wire::NodeProperty<'_>>
2978 >()
2979 };
2980
2981 if value.len() > 64 {
2982 return Err(::fidl_next::DecodeError::VectorTooLong {
2983 size: value.len() as u64,
2984 limit: 64,
2985 });
2986 }
2987
2988 Ok(())
2989 }
2990
2991 5 => {
2992 ::fidl_next::wire::Envelope::decode_as::<
2993 ___D,
2994 crate::wire::DevfsAddArgs<'de>,
2995 >(slot.as_mut(), decoder, ())?;
2996
2997 Ok(())
2998 }
2999
3000 6 => {
3001 ::fidl_next::wire::Envelope::decode_as::<
3002 ___D,
3003 ::fidl_next::wire::Vector<'de, crate::wire::Offer<'de>>,
3004 >(slot.as_mut(), decoder, (128, ()))?;
3005
3006 let value = unsafe {
3007 slot
3008 .deref_unchecked()
3009 .deref_unchecked::<
3010 ::fidl_next::wire::Vector<'_, crate::wire::Offer<'_>>
3011 >()
3012 };
3013
3014 if value.len() > 128 {
3015 return Err(::fidl_next::DecodeError::VectorTooLong {
3016 size: value.len() as u64,
3017 limit: 128,
3018 });
3019 }
3020
3021 Ok(())
3022 }
3023
3024 7 => {
3025 ::fidl_next::wire::Envelope::decode_as::<___D, crate::wire::BusInfo<'de>>(
3026 slot.as_mut(),
3027 decoder,
3028 (),
3029 )?;
3030
3031 Ok(())
3032 }
3033
3034 8 => {
3035 ::fidl_next::wire::Envelope::decode_as::<
3036 ___D,
3037 ::fidl_next::wire::Vector<'de, crate::wire::NodeProperty2<'de>>,
3038 >(slot.as_mut(), decoder, (64, ()))?;
3039
3040 let value = unsafe {
3041 slot
3042 .deref_unchecked()
3043 .deref_unchecked::<
3044 ::fidl_next::wire::Vector<'_, crate::wire::NodeProperty2<'_>>
3045 >()
3046 };
3047
3048 if value.len() > 64 {
3049 return Err(::fidl_next::DecodeError::VectorTooLong {
3050 size: value.len() as u64,
3051 limit: 64,
3052 });
3053 }
3054
3055 Ok(())
3056 }
3057
3058 9 => {
3059 ::fidl_next::wire::Envelope::decode_as::<
3060 ___D,
3061 ::fidl_next_fuchsia_component_sandbox::wire::DictionaryRef,
3062 >(slot.as_mut(), decoder, ())?;
3063
3064 Ok(())
3065 }
3066
3067 10 => {
3068 ::fidl_next::wire::Envelope::decode_as::<
3069 ___D,
3070 ::fidl_next::wire::String<'de>,
3071 >(slot.as_mut(), decoder, 128)?;
3072
3073 let value = unsafe {
3074 slot.deref_unchecked()
3075 .deref_unchecked::<::fidl_next::wire::String<'_>>()
3076 };
3077
3078 if value.len() > 128 {
3079 return Err(::fidl_next::DecodeError::VectorTooLong {
3080 size: value.len() as u64,
3081 limit: 128,
3082 });
3083 }
3084
3085 Ok(())
3086 }
3087
3088 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3089 }
3090 })
3091 }
3092 }
3093
3094 impl<'de> NodeAddArgs<'de> {
3095 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
3096 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3097 }
3098
3099 pub fn symbols(
3100 &self,
3101 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::NodeSymbol<'de>>>
3102 {
3103 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
3104 }
3105
3106 pub fn properties(
3107 &self,
3108 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::NodeProperty<'de>>>
3109 {
3110 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
3111 }
3112
3113 pub fn devfs_args(&self) -> ::core::option::Option<&crate::wire::DevfsAddArgs<'de>> {
3114 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
3115 }
3116
3117 pub fn offers2(
3118 &self,
3119 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::Offer<'de>>>
3120 {
3121 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
3122 }
3123
3124 pub fn bus_info(&self) -> ::core::option::Option<&crate::wire::BusInfo<'de>> {
3125 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
3126 }
3127
3128 pub fn properties2(
3129 &self,
3130 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::NodeProperty2<'de>>>
3131 {
3132 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
3133 }
3134
3135 pub fn offers_dictionary(
3136 &self,
3137 ) -> ::core::option::Option<&::fidl_next_fuchsia_component_sandbox::wire::DictionaryRef>
3138 {
3139 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
3140 }
3141
3142 pub fn driver_host(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
3143 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
3144 }
3145 }
3146
3147 impl<'de> ::core::fmt::Debug for NodeAddArgs<'de> {
3148 fn fmt(
3149 &self,
3150 f: &mut ::core::fmt::Formatter<'_>,
3151 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3152 f.debug_struct("NodeAddArgs")
3153 .field("name", &self.name())
3154 .field("symbols", &self.symbols())
3155 .field("properties", &self.properties())
3156 .field("devfs_args", &self.devfs_args())
3157 .field("offers2", &self.offers2())
3158 .field("bus_info", &self.bus_info())
3159 .field("properties2", &self.properties2())
3160 .field("offers_dictionary", &self.offers_dictionary())
3161 .field("driver_host", &self.driver_host())
3162 .finish()
3163 }
3164 }
3165
3166 impl<'de> ::fidl_next::IntoNatural for NodeAddArgs<'de> {
3167 type Natural = crate::natural::NodeAddArgs;
3168 }
3169
3170 #[derive(Debug)]
3172 #[repr(C)]
3173 pub struct NodeAddChildRequest<'de> {
3174 pub args: crate::wire::NodeAddArgs<'de>,
3175
3176 pub controller:
3177 ::fidl_next::ServerEnd<crate::NodeController, ::fidl_next::wire::fuchsia::Channel>,
3178
3179 pub node: ::fidl_next::ServerEnd<crate::Node, ::fidl_next::wire::fuchsia::OptionalChannel>,
3180 }
3181
3182 static_assertions::const_assert_eq!(std::mem::size_of::<NodeAddChildRequest<'_>>(), 24);
3183 static_assertions::const_assert_eq!(std::mem::align_of::<NodeAddChildRequest<'_>>(), 8);
3184
3185 static_assertions::const_assert_eq!(std::mem::offset_of!(NodeAddChildRequest<'_>, args), 0);
3186
3187 static_assertions::const_assert_eq!(
3188 std::mem::offset_of!(NodeAddChildRequest<'_>, controller),
3189 16
3190 );
3191
3192 static_assertions::const_assert_eq!(std::mem::offset_of!(NodeAddChildRequest<'_>, node), 20);
3193
3194 impl ::fidl_next::Constrained for NodeAddChildRequest<'_> {
3195 type Constraint = ();
3196
3197 fn validate(
3198 _: ::fidl_next::Slot<'_, Self>,
3199 _: Self::Constraint,
3200 ) -> Result<(), ::fidl_next::ValidationError> {
3201 Ok(())
3202 }
3203 }
3204
3205 unsafe impl ::fidl_next::Wire for NodeAddChildRequest<'static> {
3206 type Narrowed<'de> = NodeAddChildRequest<'de>;
3207
3208 #[inline]
3209 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
3210 ::fidl_next::munge! {
3211 let Self {
3212 args,
3213 controller,
3214 node,
3215
3216 } = &mut *out_;
3217 }
3218
3219 ::fidl_next::Wire::zero_padding(args);
3220
3221 ::fidl_next::Wire::zero_padding(controller);
3222
3223 ::fidl_next::Wire::zero_padding(node);
3224 }
3225 }
3226
3227 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeAddChildRequest<'de>
3228 where
3229 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3230 ___D: ::fidl_next::Decoder<'de>,
3231 ___D: ::fidl_next::fuchsia::HandleDecoder,
3232 {
3233 fn decode(
3234 slot_: ::fidl_next::Slot<'_, Self>,
3235 decoder_: &mut ___D,
3236 _: (),
3237 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3238 ::fidl_next::munge! {
3239 let Self {
3240 mut args,
3241 mut controller,
3242 mut node,
3243
3244 } = slot_;
3245 }
3246
3247 let _field = args.as_mut();
3248
3249 ::fidl_next::Decode::decode(args.as_mut(), decoder_, ())?;
3250
3251 let _field = controller.as_mut();
3252
3253 ::fidl_next::Decode::decode(controller.as_mut(), decoder_, ())?;
3254
3255 let _field = node.as_mut();
3256
3257 ::fidl_next::Decode::decode(node.as_mut(), decoder_, ())?;
3258
3259 Ok(())
3260 }
3261 }
3262
3263 impl<'de> ::fidl_next::IntoNatural for NodeAddChildRequest<'de> {
3264 type Natural = crate::natural::NodeAddChildRequest;
3265 }
3266
3267 #[repr(C)]
3269 pub struct NodeControllerOnBindRequest<'de> {
3270 pub(crate) table: ::fidl_next::wire::Table<'de>,
3271 }
3272
3273 impl<'de> Drop for NodeControllerOnBindRequest<'de> {
3274 fn drop(&mut self) {
3275 let _ = self.table.get(1).map(|envelope| unsafe {
3276 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
3277 });
3278 }
3279 }
3280
3281 impl ::fidl_next::Constrained for NodeControllerOnBindRequest<'_> {
3282 type Constraint = ();
3283
3284 fn validate(
3285 _: ::fidl_next::Slot<'_, Self>,
3286 _: Self::Constraint,
3287 ) -> Result<(), ::fidl_next::ValidationError> {
3288 Ok(())
3289 }
3290 }
3291
3292 unsafe impl ::fidl_next::Wire for NodeControllerOnBindRequest<'static> {
3293 type Narrowed<'de> = NodeControllerOnBindRequest<'de>;
3294
3295 #[inline]
3296 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3297 ::fidl_next::munge!(let Self { table } = out);
3298 ::fidl_next::wire::Table::zero_padding(table);
3299 }
3300 }
3301
3302 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeControllerOnBindRequest<'de>
3303 where
3304 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3305 ___D: ::fidl_next::fuchsia::HandleDecoder,
3306 {
3307 fn decode(
3308 slot: ::fidl_next::Slot<'_, Self>,
3309 decoder: &mut ___D,
3310 _: (),
3311 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3312 ::fidl_next::munge!(let Self { table } = slot);
3313
3314 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3315 match ordinal {
3316 0 => unsafe { ::core::hint::unreachable_unchecked() },
3317
3318 1 => {
3319 ::fidl_next::wire::Envelope::decode_as::<
3320 ___D,
3321 ::fidl_next::wire::fuchsia::Event,
3322 >(slot.as_mut(), decoder, ())?;
3323
3324 Ok(())
3325 }
3326
3327 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3328 }
3329 })
3330 }
3331 }
3332
3333 impl<'de> NodeControllerOnBindRequest<'de> {
3334 pub fn node_token(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
3335 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3336 }
3337 }
3338
3339 impl<'de> ::core::fmt::Debug for NodeControllerOnBindRequest<'de> {
3340 fn fmt(
3341 &self,
3342 f: &mut ::core::fmt::Formatter<'_>,
3343 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3344 f.debug_struct("NodeControllerOnBindRequest")
3345 .field("node_token", &self.node_token())
3346 .finish()
3347 }
3348 }
3349
3350 impl<'de> ::fidl_next::IntoNatural for NodeControllerOnBindRequest<'de> {
3351 type Natural = crate::natural::NodeControllerOnBindRequest;
3352 }
3353}
3354
3355pub mod wire_optional {
3356
3357 pub use fidl_next_common_fuchsia_driver_framework::wire_optional::*;
3358
3359 #[repr(transparent)]
3360 pub struct DriverResult<'de> {
3361 pub(crate) raw: ::fidl_next::wire::Union,
3362 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
3363 }
3364
3365 impl ::fidl_next::Constrained for DriverResult<'_> {
3366 type Constraint = ();
3367
3368 fn validate(
3369 _: ::fidl_next::Slot<'_, Self>,
3370 _: Self::Constraint,
3371 ) -> Result<(), ::fidl_next::ValidationError> {
3372 Ok(())
3373 }
3374 }
3375
3376 unsafe impl ::fidl_next::Wire for DriverResult<'static> {
3377 type Narrowed<'de> = DriverResult<'de>;
3378
3379 #[inline]
3380 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3381 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
3382 ::fidl_next::wire::Union::zero_padding(raw);
3383 }
3384 }
3385
3386 impl<'de> DriverResult<'de> {
3387 pub fn is_some(&self) -> bool {
3388 self.raw.is_some()
3389 }
3390
3391 pub fn is_none(&self) -> bool {
3392 self.raw.is_none()
3393 }
3394
3395 pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::DriverResult<'de>> {
3396 if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
3397 }
3398
3399 pub fn into_option(self) -> ::core::option::Option<crate::wire::DriverResult<'de>> {
3400 if self.is_some() {
3401 Some(crate::wire::DriverResult {
3402 raw: self.raw,
3403 _phantom: ::core::marker::PhantomData,
3404 })
3405 } else {
3406 None
3407 }
3408 }
3409 }
3410
3411 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DriverResult<'de>
3412 where
3413 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3414 ___D: ::fidl_next::Decoder<'de>,
3415 ___D: ::fidl_next::fuchsia::HandleDecoder,
3416 {
3417 fn decode(
3418 mut slot: ::fidl_next::Slot<'_, Self>,
3419 decoder: &mut ___D,
3420 _: (),
3421 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3422 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
3423 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
3424 1 => {
3425 ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::fuchsia::Event>(
3426 raw,
3427 decoder,
3428 (),
3429 )?
3430 }
3431
3432 2 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Int32>(
3433 raw,
3434 decoder,
3435 (),
3436 )?,
3437
3438 3 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Int32>(
3439 raw,
3440 decoder,
3441 (),
3442 )?,
3443
3444 0 => ::fidl_next::wire::Union::decode_absent(raw)?,
3445 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
3446 }
3447
3448 Ok(())
3449 }
3450 }
3451
3452 impl<'de> ::core::fmt::Debug for DriverResult<'de> {
3453 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3454 self.as_ref().fmt(f)
3455 }
3456 }
3457
3458 impl<'de> ::fidl_next::IntoNatural for DriverResult<'de> {
3459 type Natural = ::core::option::Option<crate::natural::DriverResult>;
3460 }
3461}
3462
3463pub mod generic {
3464
3465 pub use fidl_next_common_fuchsia_driver_framework::generic::*;
3466
3467 pub struct DriverResumeRequest<T0> {
3469 pub power_element_lease: T0,
3470 }
3471
3472 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DriverResumeRequest, ___E>
3473 for DriverResumeRequest<T0>
3474 where
3475 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3476 ___E: ::fidl_next::fuchsia::HandleEncoder,
3477 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEventPair, ___E>,
3478 {
3479 #[inline]
3480 fn encode(
3481 self,
3482 encoder_: &mut ___E,
3483 out_: &mut ::core::mem::MaybeUninit<crate::wire::DriverResumeRequest>,
3484 _: (),
3485 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3486 ::fidl_next::munge! {
3487 let crate::wire::DriverResumeRequest {
3488 power_element_lease,
3489
3490 } = out_;
3491 }
3492
3493 ::fidl_next::Encode::encode(
3494 self.power_element_lease,
3495 encoder_,
3496 power_element_lease,
3497 (),
3498 )?;
3499
3500 Ok(())
3501 }
3502 }
3503
3504 pub struct DriverStartRequest<T0> {
3506 pub start_args: T0,
3507 }
3508
3509 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DriverStartRequest<'static>, ___E>
3510 for DriverStartRequest<T0>
3511 where
3512 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3513 ___E: ::fidl_next::Encoder,
3514 ___E: ::fidl_next::fuchsia::HandleEncoder,
3515 T0: ::fidl_next::Encode<crate::wire::DriverStartArgs<'static>, ___E>,
3516 {
3517 #[inline]
3518 fn encode(
3519 self,
3520 encoder_: &mut ___E,
3521 out_: &mut ::core::mem::MaybeUninit<crate::wire::DriverStartRequest<'static>>,
3522 _: (),
3523 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3524 ::fidl_next::munge! {
3525 let crate::wire::DriverStartRequest {
3526 start_args,
3527
3528 } = out_;
3529 }
3530
3531 ::fidl_next::Encode::encode(self.start_args, encoder_, start_args, ())?;
3532
3533 Ok(())
3534 }
3535 }
3536
3537 pub struct NodeAddChildRequest<T0, T1, T2> {
3539 pub args: T0,
3540
3541 pub controller: T1,
3542
3543 pub node: T2,
3544 }
3545
3546 unsafe impl<___E, T0, T1, T2>
3547 ::fidl_next::Encode<crate::wire::NodeAddChildRequest<'static>, ___E>
3548 for NodeAddChildRequest<T0, T1, T2>
3549 where
3550 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3551 ___E: ::fidl_next::Encoder,
3552 ___E: ::fidl_next::fuchsia::HandleEncoder,
3553 T0: ::fidl_next::Encode<crate::wire::NodeAddArgs<'static>, ___E>,
3554 T1: ::fidl_next::Encode<
3555 ::fidl_next::ServerEnd<crate::NodeController, ::fidl_next::wire::fuchsia::Channel>,
3556 ___E,
3557 >,
3558 T2: ::fidl_next::Encode<
3559 ::fidl_next::ServerEnd<crate::Node, ::fidl_next::wire::fuchsia::OptionalChannel>,
3560 ___E,
3561 >,
3562 {
3563 #[inline]
3564 fn encode(
3565 self,
3566 encoder_: &mut ___E,
3567 out_: &mut ::core::mem::MaybeUninit<crate::wire::NodeAddChildRequest<'static>>,
3568 _: (),
3569 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3570 ::fidl_next::munge! {
3571 let crate::wire::NodeAddChildRequest {
3572 args,
3573 controller,
3574 node,
3575
3576 } = out_;
3577 }
3578
3579 ::fidl_next::Encode::encode(self.args, encoder_, args, ())?;
3580
3581 ::fidl_next::Encode::encode(self.controller, encoder_, controller, ())?;
3582
3583 ::fidl_next::Encode::encode(self.node, encoder_, node, ())?;
3584
3585 Ok(())
3586 }
3587 }
3588}
3589
3590pub use self::natural::*;
3591
3592#[doc = " This protocol is used by the Driver Framework\'s Driver Host to communicate various messages and\n lifecycle hooks to the driver. The connection for this protocol is established through the\n |DriverRegistration| defined in the `driver_symbols` library.\n\n Once the driver has closed its server end, the Driver Framework will initiate the shutdown\n of all dispatchers belonging to this driver.\n"]
3594#[derive(PartialEq, Debug)]
3595pub struct Driver;
3596
3597#[cfg(feature = "driver")]
3598impl ::fidl_next::HasTransport for Driver {
3599 type Transport = ::fdf_fidl::DriverChannel;
3600}
3601
3602pub mod driver {
3603 pub mod prelude {
3604 pub use crate::{
3605 Driver, DriverClientHandler, DriverLocalClientHandler, DriverLocalServerHandler,
3606 DriverServerHandler, driver,
3607 };
3608
3609 pub use crate::natural::DriverResumeRequest;
3610
3611 pub use crate::natural::DriverStartRequest;
3612
3613 pub use crate::natural::DriverResumeResponse;
3614
3615 pub use crate::natural::DriverStartResponse;
3616
3617 pub use crate::natural::DriverSuspendResponse;
3618 }
3619
3620 pub struct Start;
3621
3622 impl ::fidl_next::Method for Start {
3623 const ORDINAL: u64 = 2863727161496985794;
3624 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3625 ::fidl_next::protocol::Flexibility::Flexible;
3626
3627 type Protocol = crate::Driver;
3628
3629 type Request = crate::wire::DriverStartRequest<'static>;
3630 }
3631
3632 impl ::fidl_next::TwoWayMethod for Start {
3633 type Response = ::fidl_next::wire::FlexibleResult<
3634 'static,
3635 crate::wire::DriverStartResponse,
3636 ::fidl_next::wire::Int32,
3637 >;
3638 }
3639
3640 impl<___R> ::fidl_next::Respond<___R> for Start {
3641 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
3642
3643 fn respond(response: ___R) -> Self::Output {
3644 ::fidl_next::FlexibleResult::Ok(response)
3645 }
3646 }
3647
3648 impl<___R> ::fidl_next::RespondErr<___R> for Start {
3649 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
3650
3651 fn respond_err(response: ___R) -> Self::Output {
3652 ::fidl_next::FlexibleResult::Err(response)
3653 }
3654 }
3655
3656 pub struct Stop;
3657
3658 impl ::fidl_next::Method for Stop {
3659 const ORDINAL: u64 = 5446759044519003197;
3660 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3661 ::fidl_next::protocol::Flexibility::Flexible;
3662
3663 type Protocol = crate::Driver;
3664
3665 type Request = ::fidl_next::wire::EmptyMessageBody;
3666 }
3667
3668 pub struct Suspend;
3669
3670 impl ::fidl_next::Method for Suspend {
3671 const ORDINAL: u64 = 5542715003953095352;
3672 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3673 ::fidl_next::protocol::Flexibility::Flexible;
3674
3675 type Protocol = crate::Driver;
3676
3677 type Request = ::fidl_next::wire::EmptyMessageBody;
3678 }
3679
3680 impl ::fidl_next::TwoWayMethod for Suspend {
3681 type Response = ::fidl_next::wire::FlexibleResult<
3682 'static,
3683 crate::wire::DriverSuspendResponse,
3684 ::fidl_next::wire::Int32,
3685 >;
3686 }
3687
3688 impl<___R> ::fidl_next::Respond<___R> for Suspend {
3689 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
3690
3691 fn respond(response: ___R) -> Self::Output {
3692 ::fidl_next::FlexibleResult::Ok(response)
3693 }
3694 }
3695
3696 impl<___R> ::fidl_next::RespondErr<___R> for Suspend {
3697 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
3698
3699 fn respond_err(response: ___R) -> Self::Output {
3700 ::fidl_next::FlexibleResult::Err(response)
3701 }
3702 }
3703
3704 pub struct Resume;
3705
3706 impl ::fidl_next::Method for Resume {
3707 const ORDINAL: u64 = 2681111055565410632;
3708 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3709 ::fidl_next::protocol::Flexibility::Flexible;
3710
3711 type Protocol = crate::Driver;
3712
3713 type Request = crate::wire::DriverResumeRequest;
3714 }
3715
3716 impl ::fidl_next::TwoWayMethod for Resume {
3717 type Response = ::fidl_next::wire::FlexibleResult<
3718 'static,
3719 crate::wire::DriverResumeResponse,
3720 ::fidl_next::wire::Int32,
3721 >;
3722 }
3723
3724 impl<___R> ::fidl_next::Respond<___R> for Resume {
3725 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
3726
3727 fn respond(response: ___R) -> Self::Output {
3728 ::fidl_next::FlexibleResult::Ok(response)
3729 }
3730 }
3731
3732 impl<___R> ::fidl_next::RespondErr<___R> for Resume {
3733 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
3734
3735 fn respond_err(response: ___R) -> Self::Output {
3736 ::fidl_next::FlexibleResult::Err(response)
3737 }
3738 }
3739
3740 mod ___detail {
3741 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Driver
3742 where
3743 ___T: ::fidl_next::Transport,
3744 {
3745 type Client = DriverClient<___T>;
3746 type Server = DriverServer<___T>;
3747 }
3748
3749 #[repr(transparent)]
3751 pub struct DriverClient<___T: ::fidl_next::Transport> {
3752 #[allow(dead_code)]
3753 client: ::fidl_next::protocol::Client<___T>,
3754 }
3755
3756 impl<___T> DriverClient<___T>
3757 where
3758 ___T: ::fidl_next::Transport,
3759 {
3760 #[doc = " Starts the driver with the given |start_args|.\n\n Drivers should finish their initial setup and enumeration before returning from |Start|.\n In particular they should enumerate all currently available nodes by utilizing\n `fuchsia.driver.framework/Node.AddChild` and waiting for all calls to be completed.\n\n The Framework will not consider the driver to be started until this call has returned\n successfully. Therefore a driver will not have |Stop| called on it until after it has\n replied to |Start| successfully.\n\n If a driver returns an error, it will not have |Stop| called on it before the\n Driver Framework initiates shutdown of the driver\'s dispatchers. Therefore it should have\n performed all necessary cleanup before returning an error.\n"]
3761 pub fn start(
3762 &self,
3763
3764 start_args: impl ::fidl_next::Encode<
3765 crate::wire::DriverStartArgs<'static>,
3766 <___T as ::fidl_next::Transport>::SendBuffer,
3767 >,
3768 ) -> ::fidl_next::TwoWayFuture<'_, super::Start, ___T>
3769 where
3770 <___T as ::fidl_next::Transport>::SendBuffer:
3771 ::fidl_next::encoder::InternalHandleEncoder,
3772 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
3773 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3774 {
3775 self.start_with(crate::generic::DriverStartRequest { start_args })
3776 }
3777
3778 #[doc = " Starts the driver with the given |start_args|.\n\n Drivers should finish their initial setup and enumeration before returning from |Start|.\n In particular they should enumerate all currently available nodes by utilizing\n `fuchsia.driver.framework/Node.AddChild` and waiting for all calls to be completed.\n\n The Framework will not consider the driver to be started until this call has returned\n successfully. Therefore a driver will not have |Stop| called on it until after it has\n replied to |Start| successfully.\n\n If a driver returns an error, it will not have |Stop| called on it before the\n Driver Framework initiates shutdown of the driver\'s dispatchers. Therefore it should have\n performed all necessary cleanup before returning an error.\n"]
3779 pub fn start_with<___R>(
3780 &self,
3781 request: ___R,
3782 ) -> ::fidl_next::TwoWayFuture<'_, super::Start, ___T>
3783 where
3784 ___R: ::fidl_next::Encode<
3785 crate::wire::DriverStartRequest<'static>,
3786 <___T as ::fidl_next::Transport>::SendBuffer,
3787 >,
3788 {
3789 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3790 2863727161496985794,
3791 <super::Start as ::fidl_next::Method>::FLEXIBILITY,
3792 request,
3793 ))
3794 }
3795
3796 #[doc = " Stops the driver. To stop, the driver should teardown any resources it set up in or after\n |Start|. This is a one-way FIDL method. When the driver has completed stopping, it should\n close its server end. Asynchronous operations should fully complete before closing\n the server end.\n"]
3797 pub fn stop(&self) -> ::fidl_next::SendFuture<'_, ___T> {
3798 ::fidl_next::SendFuture::from_untyped(
3799 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
3800 5446759044519003197,
3801 <super::Stop as ::fidl_next::Method>::FLEXIBILITY,
3802 (),
3803 ),
3804 )
3805 }
3806
3807 #[doc = " Returns when the driver has suspended the hardware.\n This is called when the power element requests the off power state.\n The driver should turn off the hardware as a response to this call.\n\n Note on execution order after a suspend is requested by the power element:\n - dispatchers stop accepting new work in the work queue\n - dispatcher drains previously queued work\n - Once all work is drained, this method is called\n\n The driver will not immediately |Stop| after it has been suspended.\n It will first go through |Resume| before it is told to |Stop|.\n"]
3808 pub fn suspend(&self) -> ::fidl_next::TwoWayFuture<'_, super::Suspend, ___T> {
3809 ::fidl_next::TwoWayFuture::from_untyped(
3810 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
3811 5542715003953095352,
3812 <super::Suspend as ::fidl_next::Method>::FLEXIBILITY,
3813 (),
3814 ),
3815 )
3816 }
3817
3818 #[doc = " Returns when the driver has resumed the hardware.\n This is called when the power framework requests the power element move to the on power state.\n The driver should turn the hardware back on as a response to this call.\n\n |power_element_lease| is the lease associated with the current wake if the\n wake was from a wake vector. Otherwise it is None.\n\n Note on execution order after a resume is requested by the power element:\n - This method is called (the dispatcher does not accept any other work at this point)\n - Once this method completes, dispatchers start accepting new work in the work queue\n"]
3819 pub fn resume(
3820 &self,
3821
3822 power_element_lease: impl ::fidl_next::Encode<
3823 ::fidl_next::wire::fuchsia::OptionalEventPair,
3824 <___T as ::fidl_next::Transport>::SendBuffer,
3825 >,
3826 ) -> ::fidl_next::TwoWayFuture<'_, super::Resume, ___T>
3827 where
3828 <___T as ::fidl_next::Transport>::SendBuffer:
3829 ::fidl_next::encoder::InternalHandleEncoder,
3830 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
3831 {
3832 self.resume_with(crate::generic::DriverResumeRequest { power_element_lease })
3833 }
3834
3835 #[doc = " Returns when the driver has resumed the hardware.\n This is called when the power framework requests the power element move to the on power state.\n The driver should turn the hardware back on as a response to this call.\n\n |power_element_lease| is the lease associated with the current wake if the\n wake was from a wake vector. Otherwise it is None.\n\n Note on execution order after a resume is requested by the power element:\n - This method is called (the dispatcher does not accept any other work at this point)\n - Once this method completes, dispatchers start accepting new work in the work queue\n"]
3836 pub fn resume_with<___R>(
3837 &self,
3838 request: ___R,
3839 ) -> ::fidl_next::TwoWayFuture<'_, super::Resume, ___T>
3840 where
3841 ___R: ::fidl_next::Encode<
3842 crate::wire::DriverResumeRequest,
3843 <___T as ::fidl_next::Transport>::SendBuffer,
3844 >,
3845 {
3846 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3847 2681111055565410632,
3848 <super::Resume as ::fidl_next::Method>::FLEXIBILITY,
3849 request,
3850 ))
3851 }
3852 }
3853
3854 #[repr(transparent)]
3856 pub struct DriverServer<___T: ::fidl_next::Transport> {
3857 server: ::fidl_next::protocol::Server<___T>,
3858 }
3859
3860 impl<___T> DriverServer<___T> where ___T: ::fidl_next::Transport {}
3861 }
3862}
3863
3864#[diagnostic::on_unimplemented(
3865 note = "If {Self} implements the non-local DriverClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3866)]
3867
3868pub trait DriverLocalClientHandler<
3872 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
3873 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
3874>
3875{
3876 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3877 ::core::future::ready(())
3878 }
3879}
3880
3881impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Driver
3882where
3883 ___H: DriverLocalClientHandler<___T>,
3884 ___T: ::fidl_next::Transport,
3885{
3886 async fn on_event(
3887 handler: &mut ___H,
3888 ordinal: u64,
3889 flexibility: ::fidl_next::protocol::Flexibility,
3890 body: ::fidl_next::Body<___T>,
3891 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3892 match ordinal {
3893 ordinal => {
3894 handler.on_unknown_interaction(ordinal).await;
3895 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3896 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3897 } else {
3898 Ok(())
3899 }
3900 }
3901 }
3902 }
3903}
3904
3905#[diagnostic::on_unimplemented(
3906 note = "If {Self} implements the non-local DriverServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3907)]
3908
3909pub trait DriverLocalServerHandler<
3913 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
3914 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
3915>
3916{
3917 #[doc = " Starts the driver with the given |start_args|.\n\n Drivers should finish their initial setup and enumeration before returning from |Start|.\n In particular they should enumerate all currently available nodes by utilizing\n `fuchsia.driver.framework/Node.AddChild` and waiting for all calls to be completed.\n\n The Framework will not consider the driver to be started until this call has returned\n successfully. Therefore a driver will not have |Stop| called on it until after it has\n replied to |Start| successfully.\n\n If a driver returns an error, it will not have |Stop| called on it before the\n Driver Framework initiates shutdown of the driver\'s dispatchers. Therefore it should have\n performed all necessary cleanup before returning an error.\n"]
3918 fn start(
3919 &mut self,
3920
3921 request: ::fidl_next::Request<driver::Start, ___T>,
3922
3923 responder: ::fidl_next::Responder<driver::Start, ___T>,
3924 ) -> impl ::core::future::Future<Output = ()>;
3925
3926 #[doc = " Stops the driver. To stop, the driver should teardown any resources it set up in or after\n |Start|. This is a one-way FIDL method. When the driver has completed stopping, it should\n close its server end. Asynchronous operations should fully complete before closing\n the server end.\n"]
3927 fn stop(&mut self) -> impl ::core::future::Future<Output = ()>;
3928
3929 #[doc = " Returns when the driver has suspended the hardware.\n This is called when the power element requests the off power state.\n The driver should turn off the hardware as a response to this call.\n\n Note on execution order after a suspend is requested by the power element:\n - dispatchers stop accepting new work in the work queue\n - dispatcher drains previously queued work\n - Once all work is drained, this method is called\n\n The driver will not immediately |Stop| after it has been suspended.\n It will first go through |Resume| before it is told to |Stop|.\n"]
3930 fn suspend(
3931 &mut self,
3932
3933 responder: ::fidl_next::Responder<driver::Suspend, ___T>,
3934 ) -> impl ::core::future::Future<Output = ()>;
3935
3936 #[doc = " Returns when the driver has resumed the hardware.\n This is called when the power framework requests the power element move to the on power state.\n The driver should turn the hardware back on as a response to this call.\n\n |power_element_lease| is the lease associated with the current wake if the\n wake was from a wake vector. Otherwise it is None.\n\n Note on execution order after a resume is requested by the power element:\n - This method is called (the dispatcher does not accept any other work at this point)\n - Once this method completes, dispatchers start accepting new work in the work queue\n"]
3937 fn resume(
3938 &mut self,
3939
3940 request: ::fidl_next::Request<driver::Resume, ___T>,
3941
3942 responder: ::fidl_next::Responder<driver::Resume, ___T>,
3943 ) -> impl ::core::future::Future<Output = ()>;
3944
3945 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
3946 ::core::future::ready(())
3947 }
3948}
3949
3950impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Driver
3951where
3952 ___H: DriverLocalServerHandler<___T>,
3953 ___T: ::fidl_next::Transport,
3954 for<'de> crate::wire::DriverStartRequest<'de>: ::fidl_next::Decode<
3955 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3956 Constraint = (),
3957 >,
3958 for<'de> crate::wire::DriverResumeRequest: ::fidl_next::Decode<
3959 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3960 Constraint = (),
3961 >,
3962{
3963 async fn on_one_way(
3964 handler: &mut ___H,
3965 ordinal: u64,
3966 flexibility: ::fidl_next::protocol::Flexibility,
3967 body: ::fidl_next::Body<___T>,
3968 ) -> ::core::result::Result<
3969 (),
3970 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3971 > {
3972 match ordinal {
3973 5446759044519003197 => {
3974 handler.stop().await;
3975 Ok(())
3976 }
3977
3978 ordinal => {
3979 handler.on_unknown_interaction(ordinal).await;
3980 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
3981 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
3982 } else {
3983 Ok(())
3984 }
3985 }
3986 }
3987 }
3988
3989 async fn on_two_way(
3990 handler: &mut ___H,
3991 ordinal: u64,
3992 flexibility: ::fidl_next::protocol::Flexibility,
3993 body: ::fidl_next::Body<___T>,
3994 responder: ::fidl_next::protocol::Responder<___T>,
3995 ) -> ::core::result::Result<
3996 (),
3997 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3998 > {
3999 match ordinal {
4000 2863727161496985794 => {
4001 let responder = ::fidl_next::Responder::from_untyped(responder);
4002
4003 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4004 Ok(decoded) => {
4005 handler.start(::fidl_next::Request::from_decoded(decoded), responder).await;
4006 Ok(())
4007 }
4008 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4009 ordinal: 2863727161496985794,
4010 error,
4011 }),
4012 }
4013 }
4014
4015 5542715003953095352 => {
4016 let responder = ::fidl_next::Responder::from_untyped(responder);
4017
4018 handler.suspend(responder).await;
4019 Ok(())
4020 }
4021
4022 2681111055565410632 => {
4023 let responder = ::fidl_next::Responder::from_untyped(responder);
4024
4025 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4026 Ok(decoded) => {
4027 handler
4028 .resume(::fidl_next::Request::from_decoded(decoded), responder)
4029 .await;
4030 Ok(())
4031 }
4032 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4033 ordinal: 2681111055565410632,
4034 error,
4035 }),
4036 }
4037 }
4038
4039 ordinal => {
4040 handler.on_unknown_interaction(ordinal).await;
4041 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4042 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4043 } else {
4044 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4045 ordinal,
4046 flexibility,
4047 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4048 )
4049 .expect("encoding a framework error should never fail")
4050 .await?;
4051 Ok(())
4052 }
4053 }
4054 }
4055 }
4056}
4057
4058pub trait DriverClientHandler<
4062 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
4063 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
4064>
4065{
4066 fn on_unknown_interaction(
4067 &mut self,
4068 ordinal: u64,
4069 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4070 ::core::future::ready(())
4071 }
4072}
4073
4074impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Driver
4075where
4076 ___H: DriverClientHandler<___T> + ::core::marker::Send,
4077 ___T: ::fidl_next::Transport,
4078{
4079 async fn on_event(
4080 handler: &mut ___H,
4081 ordinal: u64,
4082 flexibility: ::fidl_next::protocol::Flexibility,
4083 body: ::fidl_next::Body<___T>,
4084 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4085 match ordinal {
4086 ordinal => {
4087 handler.on_unknown_interaction(ordinal).await;
4088 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4089 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4090 } else {
4091 Ok(())
4092 }
4093 }
4094 }
4095 }
4096}
4097
4098pub trait DriverServerHandler<
4102 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
4103 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
4104>
4105{
4106 #[doc = " Starts the driver with the given |start_args|.\n\n Drivers should finish their initial setup and enumeration before returning from |Start|.\n In particular they should enumerate all currently available nodes by utilizing\n `fuchsia.driver.framework/Node.AddChild` and waiting for all calls to be completed.\n\n The Framework will not consider the driver to be started until this call has returned\n successfully. Therefore a driver will not have |Stop| called on it until after it has\n replied to |Start| successfully.\n\n If a driver returns an error, it will not have |Stop| called on it before the\n Driver Framework initiates shutdown of the driver\'s dispatchers. Therefore it should have\n performed all necessary cleanup before returning an error.\n"]
4107 fn start(
4108 &mut self,
4109
4110 request: ::fidl_next::Request<driver::Start, ___T>,
4111
4112 responder: ::fidl_next::Responder<driver::Start, ___T>,
4113 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4114
4115 #[doc = " Stops the driver. To stop, the driver should teardown any resources it set up in or after\n |Start|. This is a one-way FIDL method. When the driver has completed stopping, it should\n close its server end. Asynchronous operations should fully complete before closing\n the server end.\n"]
4116 fn stop(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4117
4118 #[doc = " Returns when the driver has suspended the hardware.\n This is called when the power element requests the off power state.\n The driver should turn off the hardware as a response to this call.\n\n Note on execution order after a suspend is requested by the power element:\n - dispatchers stop accepting new work in the work queue\n - dispatcher drains previously queued work\n - Once all work is drained, this method is called\n\n The driver will not immediately |Stop| after it has been suspended.\n It will first go through |Resume| before it is told to |Stop|.\n"]
4119 fn suspend(
4120 &mut self,
4121
4122 responder: ::fidl_next::Responder<driver::Suspend, ___T>,
4123 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4124
4125 #[doc = " Returns when the driver has resumed the hardware.\n This is called when the power framework requests the power element move to the on power state.\n The driver should turn the hardware back on as a response to this call.\n\n |power_element_lease| is the lease associated with the current wake if the\n wake was from a wake vector. Otherwise it is None.\n\n Note on execution order after a resume is requested by the power element:\n - This method is called (the dispatcher does not accept any other work at this point)\n - Once this method completes, dispatchers start accepting new work in the work queue\n"]
4126 fn resume(
4127 &mut self,
4128
4129 request: ::fidl_next::Request<driver::Resume, ___T>,
4130
4131 responder: ::fidl_next::Responder<driver::Resume, ___T>,
4132 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4133
4134 fn on_unknown_interaction(
4135 &mut self,
4136 ordinal: u64,
4137 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4138 ::core::future::ready(())
4139 }
4140}
4141
4142impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Driver
4143where
4144 ___H: DriverServerHandler<___T> + ::core::marker::Send,
4145 ___T: ::fidl_next::Transport,
4146 for<'de> crate::wire::DriverStartRequest<'de>: ::fidl_next::Decode<
4147 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4148 Constraint = (),
4149 >,
4150 for<'de> crate::wire::DriverResumeRequest: ::fidl_next::Decode<
4151 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4152 Constraint = (),
4153 >,
4154{
4155 async fn on_one_way(
4156 handler: &mut ___H,
4157 ordinal: u64,
4158 flexibility: ::fidl_next::protocol::Flexibility,
4159 body: ::fidl_next::Body<___T>,
4160 ) -> ::core::result::Result<
4161 (),
4162 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4163 > {
4164 match ordinal {
4165 5446759044519003197 => {
4166 handler.stop().await;
4167 Ok(())
4168 }
4169
4170 ordinal => {
4171 handler.on_unknown_interaction(ordinal).await;
4172 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4173 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4174 } else {
4175 Ok(())
4176 }
4177 }
4178 }
4179 }
4180
4181 async fn on_two_way(
4182 handler: &mut ___H,
4183 ordinal: u64,
4184 flexibility: ::fidl_next::protocol::Flexibility,
4185 body: ::fidl_next::Body<___T>,
4186 responder: ::fidl_next::protocol::Responder<___T>,
4187 ) -> ::core::result::Result<
4188 (),
4189 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4190 > {
4191 match ordinal {
4192 2863727161496985794 => {
4193 let responder = ::fidl_next::Responder::from_untyped(responder);
4194
4195 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4196 Ok(decoded) => {
4197 handler.start(::fidl_next::Request::from_decoded(decoded), responder).await;
4198 Ok(())
4199 }
4200 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4201 ordinal: 2863727161496985794,
4202 error,
4203 }),
4204 }
4205 }
4206
4207 5542715003953095352 => {
4208 let responder = ::fidl_next::Responder::from_untyped(responder);
4209
4210 handler.suspend(responder).await;
4211 Ok(())
4212 }
4213
4214 2681111055565410632 => {
4215 let responder = ::fidl_next::Responder::from_untyped(responder);
4216
4217 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4218 Ok(decoded) => {
4219 handler
4220 .resume(::fidl_next::Request::from_decoded(decoded), responder)
4221 .await;
4222 Ok(())
4223 }
4224 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4225 ordinal: 2681111055565410632,
4226 error,
4227 }),
4228 }
4229 }
4230
4231 ordinal => {
4232 handler.on_unknown_interaction(ordinal).await;
4233 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4234 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4235 } else {
4236 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4237 ordinal,
4238 flexibility,
4239 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4240 )
4241 .expect("encoding a framework error should never fail")
4242 .await?;
4243 Ok(())
4244 }
4245 }
4246 }
4247 }
4248}
4249
4250impl<___T> DriverClientHandler<___T> for ::fidl_next::IgnoreEvents
4251where
4252 ___T: ::fidl_next::Transport,
4253{
4254 async fn on_unknown_interaction(&mut self, _: u64) {}
4255}
4256
4257impl<___H, ___T> DriverLocalClientHandler<___T> for ::fidl_next::Local<___H>
4258where
4259 ___H: DriverClientHandler<___T>,
4260 ___T: ::fidl_next::Transport,
4261{
4262 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4263 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4264 }
4265}
4266
4267impl<___H, ___T> DriverLocalServerHandler<___T> for ::fidl_next::Local<___H>
4268where
4269 ___H: DriverServerHandler<___T>,
4270 ___T: ::fidl_next::Transport,
4271{
4272 async fn start(
4273 &mut self,
4274
4275 request: ::fidl_next::Request<driver::Start, ___T>,
4276
4277 responder: ::fidl_next::Responder<driver::Start, ___T>,
4278 ) {
4279 ___H::start(&mut self.0, request, responder).await
4280 }
4281
4282 async fn stop(&mut self) {
4283 ___H::stop(&mut self.0).await
4284 }
4285
4286 async fn suspend(&mut self, responder: ::fidl_next::Responder<driver::Suspend, ___T>) {
4287 ___H::suspend(&mut self.0, responder).await
4288 }
4289
4290 async fn resume(
4291 &mut self,
4292
4293 request: ::fidl_next::Request<driver::Resume, ___T>,
4294
4295 responder: ::fidl_next::Responder<driver::Resume, ___T>,
4296 ) {
4297 ___H::resume(&mut self.0, request, responder).await
4298 }
4299
4300 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4301 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4302 }
4303}
4304
4305#[doc = " Protocol through which a driver manages a node that it is bound to.\n Drivers should maintain their client connection to the node. Dropping\n the client connection while the driver is running will cause the\n driver framework to remove the driver and node from the topology.\n If the driver has set `host_restart_on_crash` to \"true\" in their\n component manifest, dropping the connection will initiate a restart of\n the driver host and driver.\n"]
4307#[derive(PartialEq, Debug)]
4308pub struct Node;
4309
4310#[cfg(target_os = "fuchsia")]
4311impl ::fidl_next::HasTransport for Node {
4312 type Transport = ::fidl_next::fuchsia::zx::Channel;
4313}
4314
4315pub mod node {
4316 pub mod prelude {
4317 pub use crate::{
4318 Node, NodeClientHandler, NodeLocalClientHandler, NodeLocalServerHandler,
4319 NodeServerHandler, node,
4320 };
4321
4322 pub use crate::natural::NodeAddChildRequest;
4323
4324 pub use crate::natural::NodeError;
4325
4326 pub use crate::natural::NodeAddChildResponse;
4327 }
4328
4329 pub struct AddChild;
4330
4331 impl ::fidl_next::Method for AddChild {
4332 const ORDINAL: u64 = 8633697350522413353;
4333 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4334 ::fidl_next::protocol::Flexibility::Flexible;
4335
4336 type Protocol = crate::Node;
4337
4338 type Request = crate::wire::NodeAddChildRequest<'static>;
4339 }
4340
4341 impl ::fidl_next::TwoWayMethod for AddChild {
4342 type Response = ::fidl_next::wire::FlexibleResult<
4343 'static,
4344 crate::wire::NodeAddChildResponse,
4345 crate::wire::NodeError,
4346 >;
4347 }
4348
4349 impl<___R> ::fidl_next::Respond<___R> for AddChild {
4350 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
4351
4352 fn respond(response: ___R) -> Self::Output {
4353 ::fidl_next::FlexibleResult::Ok(response)
4354 }
4355 }
4356
4357 impl<___R> ::fidl_next::RespondErr<___R> for AddChild {
4358 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
4359
4360 fn respond_err(response: ___R) -> Self::Output {
4361 ::fidl_next::FlexibleResult::Err(response)
4362 }
4363 }
4364
4365 mod ___detail {
4366 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Node
4367 where
4368 ___T: ::fidl_next::Transport,
4369 {
4370 type Client = NodeClient<___T>;
4371 type Server = NodeServer<___T>;
4372 }
4373
4374 #[repr(transparent)]
4376 pub struct NodeClient<___T: ::fidl_next::Transport> {
4377 #[allow(dead_code)]
4378 client: ::fidl_next::protocol::Client<___T>,
4379 }
4380
4381 impl<___T> NodeClient<___T>
4382 where
4383 ___T: ::fidl_next::Transport,
4384 {
4385 #[doc = " Adds a child node to this node.\n\n If `node` is present, this driver takes responsibility for binding to\n the newly created child. Otherwise, the driver framework will locate an\n appropriate driver to bind the child to.\n"]
4386 pub fn add_child(
4387 &self,
4388
4389 args: impl ::fidl_next::Encode<
4390 crate::wire::NodeAddArgs<'static>,
4391 <___T as ::fidl_next::Transport>::SendBuffer,
4392 >,
4393
4394 controller: impl ::fidl_next::Encode<
4395 ::fidl_next::ServerEnd<
4396 crate::NodeController,
4397 ::fidl_next::wire::fuchsia::Channel,
4398 >,
4399 <___T as ::fidl_next::Transport>::SendBuffer,
4400 >,
4401
4402 node: impl ::fidl_next::Encode<
4403 ::fidl_next::ServerEnd<
4404 crate::Node,
4405 ::fidl_next::wire::fuchsia::OptionalChannel,
4406 >,
4407 <___T as ::fidl_next::Transport>::SendBuffer,
4408 >,
4409 ) -> ::fidl_next::TwoWayFuture<'_, super::AddChild, ___T>
4410 where
4411 <___T as ::fidl_next::Transport>::SendBuffer:
4412 ::fidl_next::encoder::InternalHandleEncoder,
4413 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
4414 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
4415 {
4416 self.add_child_with(crate::generic::NodeAddChildRequest { args, controller, node })
4417 }
4418
4419 #[doc = " Adds a child node to this node.\n\n If `node` is present, this driver takes responsibility for binding to\n the newly created child. Otherwise, the driver framework will locate an\n appropriate driver to bind the child to.\n"]
4420 pub fn add_child_with<___R>(
4421 &self,
4422 request: ___R,
4423 ) -> ::fidl_next::TwoWayFuture<'_, super::AddChild, ___T>
4424 where
4425 ___R: ::fidl_next::Encode<
4426 crate::wire::NodeAddChildRequest<'static>,
4427 <___T as ::fidl_next::Transport>::SendBuffer,
4428 >,
4429 {
4430 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
4431 8633697350522413353,
4432 <super::AddChild as ::fidl_next::Method>::FLEXIBILITY,
4433 request,
4434 ))
4435 }
4436 }
4437
4438 #[repr(transparent)]
4440 pub struct NodeServer<___T: ::fidl_next::Transport> {
4441 server: ::fidl_next::protocol::Server<___T>,
4442 }
4443
4444 impl<___T> NodeServer<___T> where ___T: ::fidl_next::Transport {}
4445 }
4446}
4447
4448#[diagnostic::on_unimplemented(
4449 note = "If {Self} implements the non-local NodeClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4450)]
4451
4452pub trait NodeLocalClientHandler<
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(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4461 ::core::future::ready(())
4462 }
4463}
4464
4465impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Node
4466where
4467 ___H: NodeLocalClientHandler<___T>,
4468 ___T: ::fidl_next::Transport,
4469{
4470 async fn on_event(
4471 handler: &mut ___H,
4472 ordinal: u64,
4473 flexibility: ::fidl_next::protocol::Flexibility,
4474 body: ::fidl_next::Body<___T>,
4475 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4476 match ordinal {
4477 ordinal => {
4478 handler.on_unknown_interaction(ordinal).await;
4479 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4480 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4481 } else {
4482 Ok(())
4483 }
4484 }
4485 }
4486 }
4487}
4488
4489#[diagnostic::on_unimplemented(
4490 note = "If {Self} implements the non-local NodeServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4491)]
4492
4493pub trait NodeLocalServerHandler<
4497 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4498 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4499>
4500{
4501 #[doc = " Adds a child node to this node.\n\n If `node` is present, this driver takes responsibility for binding to\n the newly created child. Otherwise, the driver framework will locate an\n appropriate driver to bind the child to.\n"]
4502 fn add_child(
4503 &mut self,
4504
4505 request: ::fidl_next::Request<node::AddChild, ___T>,
4506
4507 responder: ::fidl_next::Responder<node::AddChild, ___T>,
4508 ) -> impl ::core::future::Future<Output = ()>;
4509
4510 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4511 ::core::future::ready(())
4512 }
4513}
4514
4515impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Node
4516where
4517 ___H: NodeLocalServerHandler<___T>,
4518 ___T: ::fidl_next::Transport,
4519 for<'de> crate::wire::NodeAddChildRequest<'de>: ::fidl_next::Decode<
4520 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4521 Constraint = (),
4522 >,
4523{
4524 async fn on_one_way(
4525 handler: &mut ___H,
4526 ordinal: u64,
4527 flexibility: ::fidl_next::protocol::Flexibility,
4528 body: ::fidl_next::Body<___T>,
4529 ) -> ::core::result::Result<
4530 (),
4531 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4532 > {
4533 match ordinal {
4534 ordinal => {
4535 handler.on_unknown_interaction(ordinal).await;
4536 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4537 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4538 } else {
4539 Ok(())
4540 }
4541 }
4542 }
4543 }
4544
4545 async fn on_two_way(
4546 handler: &mut ___H,
4547 ordinal: u64,
4548 flexibility: ::fidl_next::protocol::Flexibility,
4549 body: ::fidl_next::Body<___T>,
4550 responder: ::fidl_next::protocol::Responder<___T>,
4551 ) -> ::core::result::Result<
4552 (),
4553 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4554 > {
4555 match ordinal {
4556 8633697350522413353 => {
4557 let responder = ::fidl_next::Responder::from_untyped(responder);
4558
4559 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4560 Ok(decoded) => {
4561 handler
4562 .add_child(::fidl_next::Request::from_decoded(decoded), responder)
4563 .await;
4564 Ok(())
4565 }
4566 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4567 ordinal: 8633697350522413353,
4568 error,
4569 }),
4570 }
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
4592pub trait NodeClientHandler<
4596 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4597 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4598>
4599{
4600 fn on_unknown_interaction(
4601 &mut self,
4602 ordinal: u64,
4603 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4604 ::core::future::ready(())
4605 }
4606}
4607
4608impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Node
4609where
4610 ___H: NodeClientHandler<___T> + ::core::marker::Send,
4611 ___T: ::fidl_next::Transport,
4612{
4613 async fn on_event(
4614 handler: &mut ___H,
4615 ordinal: u64,
4616 flexibility: ::fidl_next::protocol::Flexibility,
4617 body: ::fidl_next::Body<___T>,
4618 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4619 match ordinal {
4620 ordinal => {
4621 handler.on_unknown_interaction(ordinal).await;
4622 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4623 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4624 } else {
4625 Ok(())
4626 }
4627 }
4628 }
4629 }
4630}
4631
4632pub trait NodeServerHandler<
4636 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4637 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4638>
4639{
4640 #[doc = " Adds a child node to this node.\n\n If `node` is present, this driver takes responsibility for binding to\n the newly created child. Otherwise, the driver framework will locate an\n appropriate driver to bind the child to.\n"]
4641 fn add_child(
4642 &mut self,
4643
4644 request: ::fidl_next::Request<node::AddChild, ___T>,
4645
4646 responder: ::fidl_next::Responder<node::AddChild, ___T>,
4647 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4648
4649 fn on_unknown_interaction(
4650 &mut self,
4651 ordinal: u64,
4652 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4653 ::core::future::ready(())
4654 }
4655}
4656
4657impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Node
4658where
4659 ___H: NodeServerHandler<___T> + ::core::marker::Send,
4660 ___T: ::fidl_next::Transport,
4661 for<'de> crate::wire::NodeAddChildRequest<'de>: ::fidl_next::Decode<
4662 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4663 Constraint = (),
4664 >,
4665{
4666 async fn on_one_way(
4667 handler: &mut ___H,
4668 ordinal: u64,
4669 flexibility: ::fidl_next::protocol::Flexibility,
4670 body: ::fidl_next::Body<___T>,
4671 ) -> ::core::result::Result<
4672 (),
4673 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4674 > {
4675 match ordinal {
4676 ordinal => {
4677 handler.on_unknown_interaction(ordinal).await;
4678 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4679 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4680 } else {
4681 Ok(())
4682 }
4683 }
4684 }
4685 }
4686
4687 async fn on_two_way(
4688 handler: &mut ___H,
4689 ordinal: u64,
4690 flexibility: ::fidl_next::protocol::Flexibility,
4691 body: ::fidl_next::Body<___T>,
4692 responder: ::fidl_next::protocol::Responder<___T>,
4693 ) -> ::core::result::Result<
4694 (),
4695 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4696 > {
4697 match ordinal {
4698 8633697350522413353 => {
4699 let responder = ::fidl_next::Responder::from_untyped(responder);
4700
4701 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4702 Ok(decoded) => {
4703 handler
4704 .add_child(::fidl_next::Request::from_decoded(decoded), responder)
4705 .await;
4706 Ok(())
4707 }
4708 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4709 ordinal: 8633697350522413353,
4710 error,
4711 }),
4712 }
4713 }
4714
4715 ordinal => {
4716 handler.on_unknown_interaction(ordinal).await;
4717 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4718 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4719 } else {
4720 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4721 ordinal,
4722 flexibility,
4723 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4724 )
4725 .expect("encoding a framework error should never fail")
4726 .await?;
4727 Ok(())
4728 }
4729 }
4730 }
4731 }
4732}
4733
4734impl<___T> NodeClientHandler<___T> for ::fidl_next::IgnoreEvents
4735where
4736 ___T: ::fidl_next::Transport,
4737{
4738 async fn on_unknown_interaction(&mut self, _: u64) {}
4739}
4740
4741impl<___H, ___T> NodeLocalClientHandler<___T> for ::fidl_next::Local<___H>
4742where
4743 ___H: NodeClientHandler<___T>,
4744 ___T: ::fidl_next::Transport,
4745{
4746 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4747 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4748 }
4749}
4750
4751impl<___H, ___T> NodeLocalServerHandler<___T> for ::fidl_next::Local<___H>
4752where
4753 ___H: NodeServerHandler<___T>,
4754 ___T: ::fidl_next::Transport,
4755{
4756 async fn add_child(
4757 &mut self,
4758
4759 request: ::fidl_next::Request<node::AddChild, ___T>,
4760
4761 responder: ::fidl_next::Responder<node::AddChild, ___T>,
4762 ) {
4763 ___H::add_child(&mut self.0, request, responder).await
4764 }
4765
4766 async fn on_unknown_interaction(&mut self, ordinal: u64) {
4767 ___H::on_unknown_interaction(&mut self.0, ordinal).await
4768 }
4769}
4770
4771#[doc = " Protocol through which a parent node controls one of its children.\n"]
4773#[derive(PartialEq, Debug)]
4774pub struct NodeController;
4775
4776#[cfg(target_os = "fuchsia")]
4777impl ::fidl_next::HasTransport for NodeController {
4778 type Transport = ::fidl_next::fuchsia::zx::Channel;
4779}
4780
4781pub mod node_controller {
4782 pub mod prelude {
4783 pub use crate::{
4784 NodeController, NodeControllerClientHandler, NodeControllerLocalClientHandler,
4785 NodeControllerLocalServerHandler, NodeControllerServerHandler, node_controller,
4786 };
4787
4788 pub use crate::natural::DriverResult;
4789
4790 pub use crate::natural::NodeControllerOnBindRequest;
4791
4792 pub use crate::natural::NodeControllerRequestBindRequest;
4793
4794 pub use crate::natural::NodeControllerRequestBindResponse;
4795 }
4796
4797 pub struct Remove;
4798
4799 impl ::fidl_next::Method for Remove {
4800 const ORDINAL: u64 = 6123359741742396225;
4801 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4802 ::fidl_next::protocol::Flexibility::Flexible;
4803
4804 type Protocol = crate::NodeController;
4805
4806 type Request = ::fidl_next::wire::EmptyMessageBody;
4807 }
4808
4809 pub struct RequestBind;
4810
4811 impl ::fidl_next::Method for RequestBind {
4812 const ORDINAL: u64 = 4735909333556220047;
4813 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4814 ::fidl_next::protocol::Flexibility::Flexible;
4815
4816 type Protocol = crate::NodeController;
4817
4818 type Request = crate::wire::NodeControllerRequestBindRequest<'static>;
4819 }
4820
4821 impl ::fidl_next::TwoWayMethod for RequestBind {
4822 type Response = ::fidl_next::wire::FlexibleResult<
4823 'static,
4824 crate::wire::NodeControllerRequestBindResponse,
4825 ::fidl_next::wire::Int32,
4826 >;
4827 }
4828
4829 impl<___R> ::fidl_next::Respond<___R> for RequestBind {
4830 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
4831
4832 fn respond(response: ___R) -> Self::Output {
4833 ::fidl_next::FlexibleResult::Ok(response)
4834 }
4835 }
4836
4837 impl<___R> ::fidl_next::RespondErr<___R> for RequestBind {
4838 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
4839
4840 fn respond_err(response: ___R) -> Self::Output {
4841 ::fidl_next::FlexibleResult::Err(response)
4842 }
4843 }
4844
4845 pub struct OnBind;
4846
4847 impl ::fidl_next::Method for OnBind {
4848 const ORDINAL: u64 = 5905369594807853098;
4849 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4850 ::fidl_next::protocol::Flexibility::Flexible;
4851
4852 type Protocol = crate::NodeController;
4853
4854 type Request = crate::wire::NodeControllerOnBindRequest<'static>;
4855 }
4856
4857 pub struct WaitForDriver;
4858
4859 impl ::fidl_next::Method for WaitForDriver {
4860 const ORDINAL: u64 = 7635589759067755399;
4861 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4862 ::fidl_next::protocol::Flexibility::Flexible;
4863
4864 type Protocol = crate::NodeController;
4865
4866 type Request = ::fidl_next::wire::EmptyMessageBody;
4867 }
4868
4869 impl ::fidl_next::TwoWayMethod for WaitForDriver {
4870 type Response = ::fidl_next::wire::FlexibleResult<
4871 'static,
4872 crate::wire::DriverResult<'static>,
4873 ::fidl_next::wire::Int32,
4874 >;
4875 }
4876
4877 impl<___R> ::fidl_next::Respond<___R> for WaitForDriver {
4878 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
4879
4880 fn respond(response: ___R) -> Self::Output {
4881 ::fidl_next::FlexibleResult::Ok(response)
4882 }
4883 }
4884
4885 impl<___R> ::fidl_next::RespondErr<___R> for WaitForDriver {
4886 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
4887
4888 fn respond_err(response: ___R) -> Self::Output {
4889 ::fidl_next::FlexibleResult::Err(response)
4890 }
4891 }
4892
4893 mod ___detail {
4894 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::NodeController
4895 where
4896 ___T: ::fidl_next::Transport,
4897 {
4898 type Client = NodeControllerClient<___T>;
4899 type Server = NodeControllerServer<___T>;
4900 }
4901
4902 #[repr(transparent)]
4904 pub struct NodeControllerClient<___T: ::fidl_next::Transport> {
4905 #[allow(dead_code)]
4906 client: ::fidl_next::protocol::Client<___T>,
4907 }
4908
4909 impl<___T> NodeControllerClient<___T>
4910 where
4911 ___T: ::fidl_next::Transport,
4912 {
4913 #[doc = " Removes the node and all of its children.\n"]
4914 pub fn remove(&self) -> ::fidl_next::SendFuture<'_, ___T> {
4915 ::fidl_next::SendFuture::from_untyped(
4916 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
4917 6123359741742396225,
4918 <super::Remove as ::fidl_next::Method>::FLEXIBILITY,
4919 (),
4920 ),
4921 )
4922 }
4923
4924 #[doc = " Request that the framework attempts to bind a driver to this node.\n This is an *additional* request for binding as the framework attempts to bind a node once\n when the node is created.\n * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.\n * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has\n not completed.\n"]
4925 pub fn request_bind_with<___R>(
4926 &self,
4927 request: ___R,
4928 ) -> ::fidl_next::TwoWayFuture<'_, super::RequestBind, ___T>
4929 where
4930 ___R: ::fidl_next::Encode<
4931 crate::wire::NodeControllerRequestBindRequest<'static>,
4932 <___T as ::fidl_next::Transport>::SendBuffer,
4933 >,
4934 {
4935 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
4936 4735909333556220047,
4937 <super::RequestBind as ::fidl_next::Method>::FLEXIBILITY,
4938 request,
4939 ))
4940 }
4941
4942 #[doc = " Hanging get style call that returns a terminal state for the associated `Node`,\n or the composite node that is parented by this node.\n For a successfully started driver this returns immediately with the token of the\n node that the driver started on.\n If an error happens we wait until bootup is complete, which is when all drivers that\n can bind and start have done so, before returning the error.\n"]
4943 pub fn wait_for_driver(
4944 &self,
4945 ) -> ::fidl_next::TwoWayFuture<'_, super::WaitForDriver, ___T> {
4946 ::fidl_next::TwoWayFuture::from_untyped(
4947 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
4948 7635589759067755399,
4949 <super::WaitForDriver as ::fidl_next::Method>::FLEXIBILITY,
4950 (),
4951 ),
4952 )
4953 }
4954 }
4955
4956 #[repr(transparent)]
4958 pub struct NodeControllerServer<___T: ::fidl_next::Transport> {
4959 server: ::fidl_next::protocol::Server<___T>,
4960 }
4961
4962 impl<___T> NodeControllerServer<___T>
4963 where
4964 ___T: ::fidl_next::Transport,
4965 {
4966 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n Replaced with WaitForDriver.\n"]
4967
4968 pub fn on_bind_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
4969 where
4970 ___R: ::fidl_next::Encode<
4971 <super::OnBind as ::fidl_next::Method>::Request,
4972 <___T as ::fidl_next::Transport>::SendBuffer,
4973 >,
4974 {
4975 ::fidl_next::SendFuture::from_untyped(self.server.send_event(
4976 5905369594807853098,
4977 <super::OnBind as ::fidl_next::Method>::FLEXIBILITY,
4978 request,
4979 ))
4980 }
4981 }
4982 }
4983}
4984
4985#[diagnostic::on_unimplemented(
4986 note = "If {Self} implements the non-local NodeControllerClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4987)]
4988
4989pub trait NodeControllerLocalClientHandler<
4993 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4994 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4995>
4996{
4997 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n Replaced with WaitForDriver.\n"]
4998 fn on_bind(
4999 &mut self,
5000
5001 request: ::fidl_next::Request<node_controller::OnBind, ___T>,
5002 ) -> impl ::core::future::Future<Output = ()>;
5003
5004 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5005 ::core::future::ready(())
5006 }
5007}
5008
5009impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for NodeController
5010where
5011 ___H: NodeControllerLocalClientHandler<___T>,
5012 ___T: ::fidl_next::Transport,
5013 for<'de> crate::wire::NodeControllerOnBindRequest<'de>: ::fidl_next::Decode<
5014 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5015 Constraint = (),
5016 >,
5017{
5018 async fn on_event(
5019 handler: &mut ___H,
5020 ordinal: u64,
5021 flexibility: ::fidl_next::protocol::Flexibility,
5022 body: ::fidl_next::Body<___T>,
5023 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5024 match ordinal {
5025 5905369594807853098 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5026 Ok(decoded) => {
5027 handler.on_bind(::fidl_next::Request::from_decoded(decoded)).await;
5028 Ok(())
5029 }
5030 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5031 ordinal: 5905369594807853098,
5032 error,
5033 }),
5034 },
5035
5036 ordinal => {
5037 handler.on_unknown_interaction(ordinal).await;
5038 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5039 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5040 } else {
5041 Ok(())
5042 }
5043 }
5044 }
5045 }
5046}
5047
5048#[diagnostic::on_unimplemented(
5049 note = "If {Self} implements the non-local NodeControllerServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5050)]
5051
5052pub trait NodeControllerLocalServerHandler<
5056 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5057 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5058>
5059{
5060 #[doc = " Removes the node and all of its children.\n"]
5061 fn remove(&mut self) -> impl ::core::future::Future<Output = ()>;
5062
5063 #[doc = " Request that the framework attempts to bind a driver to this node.\n This is an *additional* request for binding as the framework attempts to bind a node once\n when the node is created.\n * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.\n * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has\n not completed.\n"]
5064 fn request_bind(
5065 &mut self,
5066
5067 request: ::fidl_next::Request<node_controller::RequestBind, ___T>,
5068
5069 responder: ::fidl_next::Responder<node_controller::RequestBind, ___T>,
5070 ) -> impl ::core::future::Future<Output = ()>;
5071
5072 #[doc = " Hanging get style call that returns a terminal state for the associated `Node`,\n or the composite node that is parented by this node.\n For a successfully started driver this returns immediately with the token of the\n node that the driver started on.\n If an error happens we wait until bootup is complete, which is when all drivers that\n can bind and start have done so, before returning the error.\n"]
5073 fn wait_for_driver(
5074 &mut self,
5075
5076 responder: ::fidl_next::Responder<node_controller::WaitForDriver, ___T>,
5077 ) -> impl ::core::future::Future<Output = ()>;
5078
5079 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5080 ::core::future::ready(())
5081 }
5082}
5083
5084impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for NodeController
5085where
5086 ___H: NodeControllerLocalServerHandler<___T>,
5087 ___T: ::fidl_next::Transport,
5088 for<'de> crate::wire::NodeControllerRequestBindRequest<'de>: ::fidl_next::Decode<
5089 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5090 Constraint = (),
5091 >,
5092{
5093 async fn on_one_way(
5094 handler: &mut ___H,
5095 ordinal: u64,
5096 flexibility: ::fidl_next::protocol::Flexibility,
5097 body: ::fidl_next::Body<___T>,
5098 ) -> ::core::result::Result<
5099 (),
5100 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5101 > {
5102 match ordinal {
5103 6123359741742396225 => {
5104 handler.remove().await;
5105 Ok(())
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 Ok(())
5114 }
5115 }
5116 }
5117 }
5118
5119 async fn on_two_way(
5120 handler: &mut ___H,
5121 ordinal: u64,
5122 flexibility: ::fidl_next::protocol::Flexibility,
5123 body: ::fidl_next::Body<___T>,
5124 responder: ::fidl_next::protocol::Responder<___T>,
5125 ) -> ::core::result::Result<
5126 (),
5127 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5128 > {
5129 match ordinal {
5130 4735909333556220047 => {
5131 let responder = ::fidl_next::Responder::from_untyped(responder);
5132
5133 match ::fidl_next::AsDecoderExt::into_decoded(body) {
5134 Ok(decoded) => {
5135 handler
5136 .request_bind(::fidl_next::Request::from_decoded(decoded), responder)
5137 .await;
5138 Ok(())
5139 }
5140 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5141 ordinal: 4735909333556220047,
5142 error,
5143 }),
5144 }
5145 }
5146
5147 7635589759067755399 => {
5148 let responder = ::fidl_next::Responder::from_untyped(responder);
5149
5150 handler.wait_for_driver(responder).await;
5151 Ok(())
5152 }
5153
5154 ordinal => {
5155 handler.on_unknown_interaction(ordinal).await;
5156 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5157 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5158 } else {
5159 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
5160 ordinal,
5161 flexibility,
5162 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
5163 )
5164 .expect("encoding a framework error should never fail")
5165 .await?;
5166 Ok(())
5167 }
5168 }
5169 }
5170 }
5171}
5172
5173pub trait NodeControllerClientHandler<
5177 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5178 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5179>
5180{
5181 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n Replaced with WaitForDriver.\n"]
5182 fn on_bind(
5183 &mut self,
5184
5185 request: ::fidl_next::Request<node_controller::OnBind, ___T>,
5186 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5187
5188 fn on_unknown_interaction(
5189 &mut self,
5190 ordinal: u64,
5191 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5192 ::core::future::ready(())
5193 }
5194}
5195
5196impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for NodeController
5197where
5198 ___H: NodeControllerClientHandler<___T> + ::core::marker::Send,
5199 ___T: ::fidl_next::Transport,
5200 for<'de> crate::wire::NodeControllerOnBindRequest<'de>: ::fidl_next::Decode<
5201 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5202 Constraint = (),
5203 >,
5204{
5205 async fn on_event(
5206 handler: &mut ___H,
5207 ordinal: u64,
5208 flexibility: ::fidl_next::protocol::Flexibility,
5209 body: ::fidl_next::Body<___T>,
5210 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5211 match ordinal {
5212 5905369594807853098 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5213 Ok(decoded) => {
5214 handler.on_bind(::fidl_next::Request::from_decoded(decoded)).await;
5215 Ok(())
5216 }
5217 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5218 ordinal: 5905369594807853098,
5219 error,
5220 }),
5221 },
5222
5223 ordinal => {
5224 handler.on_unknown_interaction(ordinal).await;
5225 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5226 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5227 } else {
5228 Ok(())
5229 }
5230 }
5231 }
5232 }
5233}
5234
5235pub trait NodeControllerServerHandler<
5239 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5240 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5241>
5242{
5243 #[doc = " Removes the node and all of its children.\n"]
5244 fn remove(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5245
5246 #[doc = " Request that the framework attempts to bind a driver to this node.\n This is an *additional* request for binding as the framework attempts to bind a node once\n when the node is created.\n * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.\n * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has\n not completed.\n"]
5247 fn request_bind(
5248 &mut self,
5249
5250 request: ::fidl_next::Request<node_controller::RequestBind, ___T>,
5251
5252 responder: ::fidl_next::Responder<node_controller::RequestBind, ___T>,
5253 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5254
5255 #[doc = " Hanging get style call that returns a terminal state for the associated `Node`,\n or the composite node that is parented by this node.\n For a successfully started driver this returns immediately with the token of the\n node that the driver started on.\n If an error happens we wait until bootup is complete, which is when all drivers that\n can bind and start have done so, before returning the error.\n"]
5256 fn wait_for_driver(
5257 &mut self,
5258
5259 responder: ::fidl_next::Responder<node_controller::WaitForDriver, ___T>,
5260 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5261
5262 fn on_unknown_interaction(
5263 &mut self,
5264 ordinal: u64,
5265 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5266 ::core::future::ready(())
5267 }
5268}
5269
5270impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for NodeController
5271where
5272 ___H: NodeControllerServerHandler<___T> + ::core::marker::Send,
5273 ___T: ::fidl_next::Transport,
5274 for<'de> crate::wire::NodeControllerRequestBindRequest<'de>: ::fidl_next::Decode<
5275 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5276 Constraint = (),
5277 >,
5278{
5279 async fn on_one_way(
5280 handler: &mut ___H,
5281 ordinal: u64,
5282 flexibility: ::fidl_next::protocol::Flexibility,
5283 body: ::fidl_next::Body<___T>,
5284 ) -> ::core::result::Result<
5285 (),
5286 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5287 > {
5288 match ordinal {
5289 6123359741742396225 => {
5290 handler.remove().await;
5291 Ok(())
5292 }
5293
5294 ordinal => {
5295 handler.on_unknown_interaction(ordinal).await;
5296 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5297 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5298 } else {
5299 Ok(())
5300 }
5301 }
5302 }
5303 }
5304
5305 async fn on_two_way(
5306 handler: &mut ___H,
5307 ordinal: u64,
5308 flexibility: ::fidl_next::protocol::Flexibility,
5309 body: ::fidl_next::Body<___T>,
5310 responder: ::fidl_next::protocol::Responder<___T>,
5311 ) -> ::core::result::Result<
5312 (),
5313 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5314 > {
5315 match ordinal {
5316 4735909333556220047 => {
5317 let responder = ::fidl_next::Responder::from_untyped(responder);
5318
5319 match ::fidl_next::AsDecoderExt::into_decoded(body) {
5320 Ok(decoded) => {
5321 handler
5322 .request_bind(::fidl_next::Request::from_decoded(decoded), responder)
5323 .await;
5324 Ok(())
5325 }
5326 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5327 ordinal: 4735909333556220047,
5328 error,
5329 }),
5330 }
5331 }
5332
5333 7635589759067755399 => {
5334 let responder = ::fidl_next::Responder::from_untyped(responder);
5335
5336 handler.wait_for_driver(responder).await;
5337 Ok(())
5338 }
5339
5340 ordinal => {
5341 handler.on_unknown_interaction(ordinal).await;
5342 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5343 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5344 } else {
5345 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
5346 ordinal,
5347 flexibility,
5348 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
5349 )
5350 .expect("encoding a framework error should never fail")
5351 .await?;
5352 Ok(())
5353 }
5354 }
5355 }
5356 }
5357}
5358
5359impl<___T> NodeControllerClientHandler<___T> for ::fidl_next::IgnoreEvents
5360where
5361 ___T: ::fidl_next::Transport,
5362{
5363 async fn on_bind(&mut self, _: ::fidl_next::Request<node_controller::OnBind, ___T>) {}
5364
5365 async fn on_unknown_interaction(&mut self, _: u64) {}
5366}
5367
5368impl<___H, ___T> NodeControllerLocalClientHandler<___T> for ::fidl_next::Local<___H>
5369where
5370 ___H: NodeControllerClientHandler<___T>,
5371 ___T: ::fidl_next::Transport,
5372{
5373 async fn on_bind(&mut self, request: ::fidl_next::Request<node_controller::OnBind, ___T>) {
5374 ___H::on_bind(&mut self.0, request).await
5375 }
5376
5377 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5378 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5379 }
5380}
5381
5382impl<___H, ___T> NodeControllerLocalServerHandler<___T> for ::fidl_next::Local<___H>
5383where
5384 ___H: NodeControllerServerHandler<___T>,
5385 ___T: ::fidl_next::Transport,
5386{
5387 async fn remove(&mut self) {
5388 ___H::remove(&mut self.0).await
5389 }
5390
5391 async fn request_bind(
5392 &mut self,
5393
5394 request: ::fidl_next::Request<node_controller::RequestBind, ___T>,
5395
5396 responder: ::fidl_next::Responder<node_controller::RequestBind, ___T>,
5397 ) {
5398 ___H::request_bind(&mut self.0, request, responder).await
5399 }
5400
5401 async fn wait_for_driver(
5402 &mut self,
5403
5404 responder: ::fidl_next::Responder<node_controller::WaitForDriver, ___T>,
5405 ) {
5406 ___H::wait_for_driver(&mut self.0, responder).await
5407 }
5408
5409 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5410 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5411 }
5412}
5413
5414pub use fidl_next_common_fuchsia_driver_framework::*;