1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub type NodePropertyKeyUint = u32;
6
7pub type WireNodePropertyKeyUint = ::fidl_next::WireU32;
9
10pub type NodePropertyKeyString = String;
11
12pub type WireNodePropertyKeyString<'de> = ::fidl_next::WireString<'de>;
14
15#[derive(Clone, Debug)]
16pub enum NodePropertyKey {
17 IntValue(u32),
18
19 StringValue(String),
20}
21
22impl ::fidl_next::Encodable for NodePropertyKey {
23 type Encoded = WireNodePropertyKey<'static>;
24}
25
26unsafe impl<___E> ::fidl_next::Encode<___E> for NodePropertyKey
27where
28 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
29
30 ___E: ::fidl_next::Encoder,
31{
32 #[inline]
33 fn encode(
34 self,
35 encoder: &mut ___E,
36 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
37 ) -> Result<(), ::fidl_next::EncodeError> {
38 ::fidl_next::munge!(let WireNodePropertyKey { raw, _phantom: _ } = out);
39
40 match self {
41 Self::IntValue(value) => {
42 ::fidl_next::RawWireUnion::encode_as::<___E, u32>(value, 1, encoder, raw)?
43 }
44
45 Self::StringValue(value) => {
46 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 2, encoder, raw)?
47 }
48 }
49
50 Ok(())
51 }
52}
53
54unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodePropertyKey
55where
56 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
57
58 ___E: ::fidl_next::Encoder,
59{
60 #[inline]
61 fn encode_ref(
62 &self,
63 encoder: &mut ___E,
64 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
65 ) -> Result<(), ::fidl_next::EncodeError> {
66 ::fidl_next::munge!(let WireNodePropertyKey { raw, _phantom: _ } = out);
67
68 match self {
69 Self::IntValue(value) => {
70 ::fidl_next::RawWireUnion::encode_as::<___E, &u32>(value, 1, encoder, raw)?
71 }
72
73 Self::StringValue(value) => {
74 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 2, encoder, raw)?
75 }
76 }
77
78 Ok(())
79 }
80}
81
82impl ::fidl_next::EncodableOption for NodePropertyKey {
83 type EncodedOption = WireOptionalNodePropertyKey<'static>;
84}
85
86unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NodePropertyKey
87where
88 ___E: ?Sized,
89 NodePropertyKey: ::fidl_next::Encode<___E>,
90{
91 #[inline]
92 fn encode_option(
93 this: Option<Self>,
94 encoder: &mut ___E,
95 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
96 ) -> Result<(), ::fidl_next::EncodeError> {
97 ::fidl_next::munge!(let WireOptionalNodePropertyKey { raw, _phantom: _ } = &mut *out);
98
99 if let Some(inner) = this {
100 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
101 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
102 } else {
103 ::fidl_next::RawWireUnion::encode_absent(raw);
104 }
105
106 Ok(())
107 }
108}
109
110unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for NodePropertyKey
111where
112 ___E: ?Sized,
113 NodePropertyKey: ::fidl_next::EncodeRef<___E>,
114{
115 #[inline]
116 fn encode_option_ref(
117 this: Option<&Self>,
118 encoder: &mut ___E,
119 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
120 ) -> Result<(), ::fidl_next::EncodeError> {
121 ::fidl_next::munge!(let WireOptionalNodePropertyKey { raw, _phantom: _ } = &mut *out);
122
123 if let Some(inner) = this {
124 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
125 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
126 } else {
127 ::fidl_next::RawWireUnion::encode_absent(raw);
128 }
129
130 Ok(())
131 }
132}
133
134impl<'de> ::fidl_next::FromWire<WireNodePropertyKey<'de>> for NodePropertyKey {
135 #[inline]
136 fn from_wire(wire: WireNodePropertyKey<'de>) -> Self {
137 let wire = ::core::mem::ManuallyDrop::new(wire);
138 match wire.raw.ordinal() {
139 1 => Self::IntValue(::fidl_next::FromWire::from_wire(unsafe {
140 wire.raw.get().read_unchecked::<::fidl_next::WireU32>()
141 })),
142
143 2 => Self::StringValue(::fidl_next::FromWire::from_wire(unsafe {
144 wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
145 })),
146
147 _ => unsafe { ::core::hint::unreachable_unchecked() },
148 }
149 }
150}
151
152impl<'de> ::fidl_next::FromWireRef<WireNodePropertyKey<'de>> for NodePropertyKey {
153 #[inline]
154 fn from_wire_ref(wire: &WireNodePropertyKey<'de>) -> Self {
155 match wire.raw.ordinal() {
156 1 => Self::IntValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
157 wire.raw.get().deref_unchecked::<::fidl_next::WireU32>()
158 })),
159
160 2 => Self::StringValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
161 wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
162 })),
163
164 _ => unsafe { ::core::hint::unreachable_unchecked() },
165 }
166 }
167}
168
169impl<'de> ::fidl_next::FromWireOption<WireOptionalNodePropertyKey<'de>> for Box<NodePropertyKey> {
170 #[inline]
171 fn from_wire_option(wire: WireOptionalNodePropertyKey<'de>) -> Option<Self> {
172 if let Some(inner) = wire.into_option() {
173 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
174 } else {
175 None
176 }
177 }
178}
179
180impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalNodePropertyKey<'de>>
181 for Box<NodePropertyKey>
182{
183 #[inline]
184 fn from_wire_option_ref(wire: &WireOptionalNodePropertyKey<'de>) -> Option<Self> {
185 if let Some(inner) = wire.as_ref() {
186 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
187 } else {
188 None
189 }
190 }
191}
192
193#[repr(transparent)]
195pub struct WireNodePropertyKey<'de> {
196 raw: ::fidl_next::RawWireUnion,
197 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
198}
199
200impl<'de> Drop for WireNodePropertyKey<'de> {
201 fn drop(&mut self) {
202 match self.raw.ordinal() {
203 1 => {
204 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() };
205 }
206
207 2 => {
208 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
209 }
210
211 _ => unsafe { ::core::hint::unreachable_unchecked() },
212 }
213 }
214}
215
216unsafe impl ::fidl_next::Wire for WireNodePropertyKey<'static> {
217 type Decoded<'de> = WireNodePropertyKey<'de>;
218
219 #[inline]
220 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
221 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
222 ::fidl_next::RawWireUnion::zero_padding(raw);
223 }
224}
225
226pub mod node_property_key {
227 pub enum Ref<'de> {
228 IntValue(&'de ::fidl_next::WireU32),
229
230 StringValue(&'de ::fidl_next::WireString<'de>),
231 }
232}
233
234impl<'de> WireNodePropertyKey<'de> {
235 pub fn as_ref(&self) -> crate::node_property_key::Ref<'_> {
236 match self.raw.ordinal() {
237 1 => crate::node_property_key::Ref::IntValue(unsafe {
238 self.raw.get().deref_unchecked::<::fidl_next::WireU32>()
239 }),
240
241 2 => crate::node_property_key::Ref::StringValue(unsafe {
242 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
243 }),
244
245 _ => unsafe { ::core::hint::unreachable_unchecked() },
246 }
247 }
248}
249
250unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodePropertyKey<'static>
251where
252 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
253
254 ___D: ::fidl_next::Decoder,
255{
256 fn decode(
257 mut slot: ::fidl_next::Slot<'_, Self>,
258 decoder: &mut ___D,
259 ) -> Result<(), ::fidl_next::DecodeError> {
260 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
261 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
262 1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(raw, decoder)?,
263
264 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
265 raw, decoder,
266 )?,
267
268 ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
269 }
270
271 Ok(())
272 }
273}
274
275impl<'de> ::core::fmt::Debug for WireNodePropertyKey<'de> {
276 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
277 match self.raw.ordinal() {
278 1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) },
279 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) },
280 _ => unsafe { ::core::hint::unreachable_unchecked() },
281 }
282 }
283}
284
285#[repr(transparent)]
286pub struct WireOptionalNodePropertyKey<'de> {
287 raw: ::fidl_next::RawWireUnion,
288 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
289}
290
291unsafe impl ::fidl_next::Wire for WireOptionalNodePropertyKey<'static> {
292 type Decoded<'de> = WireOptionalNodePropertyKey<'de>;
293
294 #[inline]
295 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
296 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
297 ::fidl_next::RawWireUnion::zero_padding(raw);
298 }
299}
300
301impl<'de> WireOptionalNodePropertyKey<'de> {
302 pub fn is_some(&self) -> bool {
303 self.raw.is_some()
304 }
305
306 pub fn is_none(&self) -> bool {
307 self.raw.is_none()
308 }
309
310 pub fn as_ref(&self) -> Option<&WireNodePropertyKey<'de>> {
311 if self.is_some() {
312 Some(unsafe { &*(self as *const Self).cast() })
313 } else {
314 None
315 }
316 }
317
318 pub fn into_option(self) -> Option<WireNodePropertyKey<'de>> {
319 if self.is_some() {
320 Some(WireNodePropertyKey { raw: self.raw, _phantom: ::core::marker::PhantomData })
321 } else {
322 None
323 }
324 }
325}
326
327unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalNodePropertyKey<'static>
328where
329 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
330
331 ___D: ::fidl_next::Decoder,
332{
333 fn decode(
334 mut slot: ::fidl_next::Slot<'_, Self>,
335 decoder: &mut ___D,
336 ) -> Result<(), ::fidl_next::DecodeError> {
337 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
338 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
339 1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(raw, decoder)?,
340
341 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
342 raw, decoder,
343 )?,
344
345 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
346 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
347 }
348
349 Ok(())
350 }
351}
352
353impl<'de> ::core::fmt::Debug for WireOptionalNodePropertyKey<'de> {
354 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
355 self.as_ref().fmt(f)
356 }
357}
358
359#[doc = " Represents a bind rule condition.\n"]
360#[derive(Clone, Copy, Debug, PartialEq, Eq)]
361#[repr(u32)]
362pub enum Condition {
363 Unknown = 0,
364 Accept = 1,
365 Reject = 2,
366}
367
368impl ::fidl_next::Encodable for Condition {
369 type Encoded = WireCondition;
370}
371impl ::std::convert::TryFrom<u32> for Condition {
372 type Error = ::fidl_next::UnknownStrictEnumMemberError;
373 fn try_from(value: u32) -> Result<Self, Self::Error> {
374 match value {
375 0 => Ok(Self::Unknown),
376 1 => Ok(Self::Accept),
377 2 => Ok(Self::Reject),
378
379 _ => Err(Self::Error::new(value.into())),
380 }
381 }
382}
383
384unsafe impl<___E> ::fidl_next::Encode<___E> for Condition
385where
386 ___E: ?Sized,
387{
388 #[inline]
389 fn encode(
390 self,
391 encoder: &mut ___E,
392 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
393 ) -> Result<(), ::fidl_next::EncodeError> {
394 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
395 }
396}
397
398unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Condition
399where
400 ___E: ?Sized,
401{
402 #[inline]
403 fn encode_ref(
404 &self,
405 encoder: &mut ___E,
406 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
407 ) -> Result<(), ::fidl_next::EncodeError> {
408 ::fidl_next::munge!(let WireCondition { value } = out);
409 let _ = value.write(::fidl_next::WireU32::from(match *self {
410 Self::Unknown => 0,
411
412 Self::Accept => 1,
413
414 Self::Reject => 2,
415 }));
416
417 Ok(())
418 }
419}
420
421impl ::core::convert::From<WireCondition> for Condition {
422 fn from(wire: WireCondition) -> Self {
423 match u32::from(wire.value) {
424 0 => Self::Unknown,
425
426 1 => Self::Accept,
427
428 2 => Self::Reject,
429
430 _ => unsafe { ::core::hint::unreachable_unchecked() },
431 }
432 }
433}
434
435impl ::fidl_next::FromWire<WireCondition> for Condition {
436 #[inline]
437 fn from_wire(wire: WireCondition) -> Self {
438 Self::from(wire)
439 }
440}
441
442impl ::fidl_next::FromWireRef<WireCondition> for Condition {
443 #[inline]
444 fn from_wire_ref(wire: &WireCondition) -> Self {
445 Self::from(*wire)
446 }
447}
448
449#[derive(Clone, Copy, Debug, PartialEq, Eq)]
451#[repr(transparent)]
452pub struct WireCondition {
453 value: ::fidl_next::WireU32,
454}
455
456unsafe impl ::fidl_next::Wire for WireCondition {
457 type Decoded<'de> = Self;
458
459 #[inline]
460 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
461 }
463}
464
465impl WireCondition {
466 pub const UNKNOWN: WireCondition = WireCondition { value: ::fidl_next::WireU32(0) };
467
468 pub const ACCEPT: WireCondition = WireCondition { value: ::fidl_next::WireU32(1) };
469
470 pub const REJECT: WireCondition = WireCondition { value: ::fidl_next::WireU32(2) };
471}
472
473unsafe impl<___D> ::fidl_next::Decode<___D> for WireCondition
474where
475 ___D: ?Sized,
476{
477 fn decode(
478 slot: ::fidl_next::Slot<'_, Self>,
479 _: &mut ___D,
480 ) -> Result<(), ::fidl_next::DecodeError> {
481 ::fidl_next::munge!(let Self { value } = slot);
482
483 match u32::from(*value) {
484 0 | 1 | 2 => (),
485 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
486 }
487
488 Ok(())
489 }
490}
491
492impl ::core::convert::From<Condition> for WireCondition {
493 fn from(natural: Condition) -> Self {
494 match natural {
495 Condition::Unknown => WireCondition::UNKNOWN,
496
497 Condition::Accept => WireCondition::ACCEPT,
498
499 Condition::Reject => WireCondition::REJECT,
500 }
501 }
502}
503
504pub type NodePropertyValueUint = u32;
505
506pub type WireNodePropertyValueUint = ::fidl_next::WireU32;
508
509pub type NodePropertyValueString = String;
510
511pub type WireNodePropertyValueString<'de> = ::fidl_next::WireString<'de>;
513
514pub type NodePropertyValueBool = bool;
515
516pub type WireNodePropertyValueBool = bool;
518
519pub type NodePropertyValueEnum = String;
520
521pub type WireNodePropertyValueEnum<'de> = ::fidl_next::WireString<'de>;
523
524#[derive(Clone, Debug)]
525pub enum NodePropertyValue {
526 IntValue(u32),
527
528 StringValue(String),
529
530 BoolValue(bool),
531
532 EnumValue(String),
533
534 UnknownOrdinal_(u64),
535}
536
537impl ::fidl_next::Encodable for NodePropertyValue {
538 type Encoded = WireNodePropertyValue<'static>;
539}
540
541unsafe impl<___E> ::fidl_next::Encode<___E> for NodePropertyValue
542where
543 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
544
545 ___E: ::fidl_next::Encoder,
546{
547 #[inline]
548 fn encode(
549 self,
550 encoder: &mut ___E,
551 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
552 ) -> Result<(), ::fidl_next::EncodeError> {
553 ::fidl_next::munge!(let WireNodePropertyValue { raw, _phantom: _ } = out);
554
555 match self {
556 Self::IntValue(value) => {
557 ::fidl_next::RawWireUnion::encode_as::<___E, u32>(value, 1, encoder, raw)?
558 }
559
560 Self::StringValue(value) => {
561 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 2, encoder, raw)?
562 }
563
564 Self::BoolValue(value) => {
565 ::fidl_next::RawWireUnion::encode_as::<___E, bool>(value, 3, encoder, raw)?
566 }
567
568 Self::EnumValue(value) => {
569 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 4, encoder, raw)?
570 }
571
572 Self::UnknownOrdinal_(ordinal) => {
573 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
574 }
575 }
576
577 Ok(())
578 }
579}
580
581unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodePropertyValue
582where
583 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
584
585 ___E: ::fidl_next::Encoder,
586{
587 #[inline]
588 fn encode_ref(
589 &self,
590 encoder: &mut ___E,
591 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
592 ) -> Result<(), ::fidl_next::EncodeError> {
593 ::fidl_next::munge!(let WireNodePropertyValue { raw, _phantom: _ } = out);
594
595 match self {
596 Self::IntValue(value) => {
597 ::fidl_next::RawWireUnion::encode_as::<___E, &u32>(value, 1, encoder, raw)?
598 }
599
600 Self::StringValue(value) => {
601 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 2, encoder, raw)?
602 }
603
604 Self::BoolValue(value) => {
605 ::fidl_next::RawWireUnion::encode_as::<___E, &bool>(value, 3, encoder, raw)?
606 }
607
608 Self::EnumValue(value) => {
609 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 4, encoder, raw)?
610 }
611
612 Self::UnknownOrdinal_(ordinal) => {
613 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
614 }
615 }
616
617 Ok(())
618 }
619}
620
621impl ::fidl_next::EncodableOption for NodePropertyValue {
622 type EncodedOption = WireOptionalNodePropertyValue<'static>;
623}
624
625unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NodePropertyValue
626where
627 ___E: ?Sized,
628 NodePropertyValue: ::fidl_next::Encode<___E>,
629{
630 #[inline]
631 fn encode_option(
632 this: Option<Self>,
633 encoder: &mut ___E,
634 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
635 ) -> Result<(), ::fidl_next::EncodeError> {
636 ::fidl_next::munge!(let WireOptionalNodePropertyValue { raw, _phantom: _ } = &mut *out);
637
638 if let Some(inner) = this {
639 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
640 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
641 } else {
642 ::fidl_next::RawWireUnion::encode_absent(raw);
643 }
644
645 Ok(())
646 }
647}
648
649unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for NodePropertyValue
650where
651 ___E: ?Sized,
652 NodePropertyValue: ::fidl_next::EncodeRef<___E>,
653{
654 #[inline]
655 fn encode_option_ref(
656 this: Option<&Self>,
657 encoder: &mut ___E,
658 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
659 ) -> Result<(), ::fidl_next::EncodeError> {
660 ::fidl_next::munge!(let WireOptionalNodePropertyValue { raw, _phantom: _ } = &mut *out);
661
662 if let Some(inner) = this {
663 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
664 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
665 } else {
666 ::fidl_next::RawWireUnion::encode_absent(raw);
667 }
668
669 Ok(())
670 }
671}
672
673impl<'de> ::fidl_next::FromWire<WireNodePropertyValue<'de>> for NodePropertyValue {
674 #[inline]
675 fn from_wire(wire: WireNodePropertyValue<'de>) -> Self {
676 let wire = ::core::mem::ManuallyDrop::new(wire);
677 match wire.raw.ordinal() {
678 1 => Self::IntValue(::fidl_next::FromWire::from_wire(unsafe {
679 wire.raw.get().read_unchecked::<::fidl_next::WireU32>()
680 })),
681
682 2 => Self::StringValue(::fidl_next::FromWire::from_wire(unsafe {
683 wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
684 })),
685
686 3 => Self::BoolValue(::fidl_next::FromWire::from_wire(unsafe {
687 wire.raw.get().read_unchecked::<bool>()
688 })),
689
690 4 => Self::EnumValue(::fidl_next::FromWire::from_wire(unsafe {
691 wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
692 })),
693
694 _ => unsafe { ::core::hint::unreachable_unchecked() },
695 }
696 }
697}
698
699impl<'de> ::fidl_next::FromWireRef<WireNodePropertyValue<'de>> for NodePropertyValue {
700 #[inline]
701 fn from_wire_ref(wire: &WireNodePropertyValue<'de>) -> Self {
702 match wire.raw.ordinal() {
703 1 => Self::IntValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
704 wire.raw.get().deref_unchecked::<::fidl_next::WireU32>()
705 })),
706
707 2 => Self::StringValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
708 wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
709 })),
710
711 3 => Self::BoolValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
712 wire.raw.get().deref_unchecked::<bool>()
713 })),
714
715 4 => Self::EnumValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
716 wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
717 })),
718
719 _ => unsafe { ::core::hint::unreachable_unchecked() },
720 }
721 }
722}
723
724impl<'de> ::fidl_next::FromWireOption<WireOptionalNodePropertyValue<'de>>
725 for Box<NodePropertyValue>
726{
727 #[inline]
728 fn from_wire_option(wire: WireOptionalNodePropertyValue<'de>) -> Option<Self> {
729 if let Some(inner) = wire.into_option() {
730 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
731 } else {
732 None
733 }
734 }
735}
736
737impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalNodePropertyValue<'de>>
738 for Box<NodePropertyValue>
739{
740 #[inline]
741 fn from_wire_option_ref(wire: &WireOptionalNodePropertyValue<'de>) -> Option<Self> {
742 if let Some(inner) = wire.as_ref() {
743 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
744 } else {
745 None
746 }
747 }
748}
749
750#[repr(transparent)]
752pub struct WireNodePropertyValue<'de> {
753 raw: ::fidl_next::RawWireUnion,
754 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
755}
756
757impl<'de> Drop for WireNodePropertyValue<'de> {
758 fn drop(&mut self) {
759 match self.raw.ordinal() {
760 1 => {
761 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() };
762 }
763
764 2 => {
765 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
766 }
767
768 3 => {
769 let _ = unsafe { self.raw.get().read_unchecked::<bool>() };
770 }
771
772 4 => {
773 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
774 }
775
776 _ => (),
777 }
778 }
779}
780
781unsafe impl ::fidl_next::Wire for WireNodePropertyValue<'static> {
782 type Decoded<'de> = WireNodePropertyValue<'de>;
783
784 #[inline]
785 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
786 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
787 ::fidl_next::RawWireUnion::zero_padding(raw);
788 }
789}
790
791pub mod node_property_value {
792 pub enum Ref<'de> {
793 IntValue(&'de ::fidl_next::WireU32),
794
795 StringValue(&'de ::fidl_next::WireString<'de>),
796
797 BoolValue(&'de bool),
798
799 EnumValue(&'de ::fidl_next::WireString<'de>),
800
801 UnknownOrdinal_(u64),
802 }
803}
804
805impl<'de> WireNodePropertyValue<'de> {
806 pub fn as_ref(&self) -> crate::node_property_value::Ref<'_> {
807 match self.raw.ordinal() {
808 1 => crate::node_property_value::Ref::IntValue(unsafe {
809 self.raw.get().deref_unchecked::<::fidl_next::WireU32>()
810 }),
811
812 2 => crate::node_property_value::Ref::StringValue(unsafe {
813 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
814 }),
815
816 3 => crate::node_property_value::Ref::BoolValue(unsafe {
817 self.raw.get().deref_unchecked::<bool>()
818 }),
819
820 4 => crate::node_property_value::Ref::EnumValue(unsafe {
821 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
822 }),
823
824 unknown => crate::node_property_value::Ref::UnknownOrdinal_(unknown),
825 }
826 }
827}
828
829unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodePropertyValue<'static>
830where
831 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
832
833 ___D: ::fidl_next::Decoder,
834{
835 fn decode(
836 mut slot: ::fidl_next::Slot<'_, Self>,
837 decoder: &mut ___D,
838 ) -> Result<(), ::fidl_next::DecodeError> {
839 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
840 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
841 1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(raw, decoder)?,
842
843 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
844 raw, decoder,
845 )?,
846
847 3 => ::fidl_next::RawWireUnion::decode_as::<___D, bool>(raw, decoder)?,
848
849 4 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
850 raw, decoder,
851 )?,
852
853 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
854 }
855
856 Ok(())
857 }
858}
859
860impl<'de> ::core::fmt::Debug for WireNodePropertyValue<'de> {
861 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
862 match self.raw.ordinal() {
863 1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) },
864 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) },
865 3 => unsafe { self.raw.get().deref_unchecked::<bool>().fmt(f) },
866 4 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) },
867 _ => unsafe { ::core::hint::unreachable_unchecked() },
868 }
869 }
870}
871
872#[repr(transparent)]
873pub struct WireOptionalNodePropertyValue<'de> {
874 raw: ::fidl_next::RawWireUnion,
875 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
876}
877
878unsafe impl ::fidl_next::Wire for WireOptionalNodePropertyValue<'static> {
879 type Decoded<'de> = WireOptionalNodePropertyValue<'de>;
880
881 #[inline]
882 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
883 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
884 ::fidl_next::RawWireUnion::zero_padding(raw);
885 }
886}
887
888impl<'de> WireOptionalNodePropertyValue<'de> {
889 pub fn is_some(&self) -> bool {
890 self.raw.is_some()
891 }
892
893 pub fn is_none(&self) -> bool {
894 self.raw.is_none()
895 }
896
897 pub fn as_ref(&self) -> Option<&WireNodePropertyValue<'de>> {
898 if self.is_some() {
899 Some(unsafe { &*(self as *const Self).cast() })
900 } else {
901 None
902 }
903 }
904
905 pub fn into_option(self) -> Option<WireNodePropertyValue<'de>> {
906 if self.is_some() {
907 Some(WireNodePropertyValue { raw: self.raw, _phantom: ::core::marker::PhantomData })
908 } else {
909 None
910 }
911 }
912}
913
914unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalNodePropertyValue<'static>
915where
916 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
917
918 ___D: ::fidl_next::Decoder,
919{
920 fn decode(
921 mut slot: ::fidl_next::Slot<'_, Self>,
922 decoder: &mut ___D,
923 ) -> Result<(), ::fidl_next::DecodeError> {
924 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
925 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
926 1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(raw, decoder)?,
927
928 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
929 raw, decoder,
930 )?,
931
932 3 => ::fidl_next::RawWireUnion::decode_as::<___D, bool>(raw, decoder)?,
933
934 4 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
935 raw, decoder,
936 )?,
937
938 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
939 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
940 }
941
942 Ok(())
943 }
944}
945
946impl<'de> ::core::fmt::Debug for WireOptionalNodePropertyValue<'de> {
947 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
948 self.as_ref().fmt(f)
949 }
950}
951
952pub const MAX_PROPERTY_COUNT: u8 = 64;
953
954#[doc = " Represents a bind rule in a parent specification.\n"]
955#[derive(Clone, Debug)]
956pub struct BindRule {
957 pub key: crate::NodePropertyKey,
958
959 pub condition: crate::Condition,
960
961 pub values: Vec<crate::NodePropertyValue>,
962}
963
964impl ::fidl_next::Encodable for BindRule {
965 type Encoded = WireBindRule<'static>;
966}
967
968unsafe impl<___E> ::fidl_next::Encode<___E> for BindRule
969where
970 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
971
972 ___E: ::fidl_next::Encoder,
973{
974 #[inline]
975 fn encode(
976 self,
977 encoder: &mut ___E,
978 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
979 ) -> Result<(), ::fidl_next::EncodeError> {
980 ::fidl_next::munge! {
981 let Self::Encoded {
982 key,
983 condition,
984 values,
985
986 } = out;
987 }
988
989 ::fidl_next::Encode::encode(self.key, encoder, key)?;
990
991 ::fidl_next::Encode::encode(self.condition, encoder, condition)?;
992
993 ::fidl_next::Encode::encode(self.values, encoder, values)?;
994
995 Ok(())
996 }
997}
998
999unsafe impl<___E> ::fidl_next::EncodeRef<___E> for BindRule
1000where
1001 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1002
1003 ___E: ::fidl_next::Encoder,
1004{
1005 #[inline]
1006 fn encode_ref(
1007 &self,
1008 encoder: &mut ___E,
1009 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1010 ) -> Result<(), ::fidl_next::EncodeError> {
1011 ::fidl_next::munge! {
1012 let Self::Encoded {
1013 key,
1014 condition,
1015 values,
1016
1017 } = out;
1018 }
1019
1020 ::fidl_next::EncodeRef::encode_ref(&self.key, encoder, key)?;
1021
1022 ::fidl_next::EncodeRef::encode_ref(&self.condition, encoder, condition)?;
1023
1024 ::fidl_next::EncodeRef::encode_ref(&self.values, encoder, values)?;
1025
1026 Ok(())
1027 }
1028}
1029
1030impl ::fidl_next::EncodableOption for BindRule {
1031 type EncodedOption = ::fidl_next::WireBox<'static, WireBindRule<'static>>;
1032}
1033
1034unsafe impl<___E> ::fidl_next::EncodeOption<___E> for BindRule
1035where
1036 ___E: ::fidl_next::Encoder + ?Sized,
1037 BindRule: ::fidl_next::Encode<___E>,
1038{
1039 #[inline]
1040 fn encode_option(
1041 this: Option<Self>,
1042 encoder: &mut ___E,
1043 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1044 ) -> Result<(), ::fidl_next::EncodeError> {
1045 if let Some(inner) = this {
1046 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1047 ::fidl_next::WireBox::encode_present(out);
1048 } else {
1049 ::fidl_next::WireBox::encode_absent(out);
1050 }
1051
1052 Ok(())
1053 }
1054}
1055
1056unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for BindRule
1057where
1058 ___E: ::fidl_next::Encoder + ?Sized,
1059 BindRule: ::fidl_next::EncodeRef<___E>,
1060{
1061 #[inline]
1062 fn encode_option_ref(
1063 this: Option<&Self>,
1064 encoder: &mut ___E,
1065 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1066 ) -> Result<(), ::fidl_next::EncodeError> {
1067 if let Some(inner) = this {
1068 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1069 ::fidl_next::WireBox::encode_present(out);
1070 } else {
1071 ::fidl_next::WireBox::encode_absent(out);
1072 }
1073
1074 Ok(())
1075 }
1076}
1077
1078impl<'de> ::fidl_next::FromWire<WireBindRule<'de>> for BindRule {
1079 #[inline]
1080 fn from_wire(wire: WireBindRule<'de>) -> Self {
1081 Self {
1082 key: ::fidl_next::FromWire::from_wire(wire.key),
1083
1084 condition: ::fidl_next::FromWire::from_wire(wire.condition),
1085
1086 values: ::fidl_next::FromWire::from_wire(wire.values),
1087 }
1088 }
1089}
1090
1091impl<'de> ::fidl_next::FromWireRef<WireBindRule<'de>> for BindRule {
1092 #[inline]
1093 fn from_wire_ref(wire: &WireBindRule<'de>) -> Self {
1094 Self {
1095 key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
1096
1097 condition: ::fidl_next::FromWireRef::from_wire_ref(&wire.condition),
1098
1099 values: ::fidl_next::FromWireRef::from_wire_ref(&wire.values),
1100 }
1101 }
1102}
1103
1104#[derive(Debug)]
1106#[repr(C)]
1107pub struct WireBindRule<'de> {
1108 pub key: crate::WireNodePropertyKey<'de>,
1109
1110 pub condition: crate::WireCondition,
1111
1112 pub values: ::fidl_next::WireVector<'de, crate::WireNodePropertyValue<'de>>,
1113}
1114
1115unsafe impl ::fidl_next::Wire for WireBindRule<'static> {
1116 type Decoded<'de> = WireBindRule<'de>;
1117
1118 #[inline]
1119 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1120 unsafe {
1121 out.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
1122 }
1123 }
1124}
1125
1126unsafe impl<___D> ::fidl_next::Decode<___D> for WireBindRule<'static>
1127where
1128 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1129
1130 ___D: ::fidl_next::Decoder,
1131{
1132 fn decode(
1133 slot: ::fidl_next::Slot<'_, Self>,
1134 decoder: &mut ___D,
1135 ) -> Result<(), ::fidl_next::DecodeError> {
1136 ::fidl_next::munge! {
1137 let Self {
1138 mut key,
1139 mut condition,
1140 mut values,
1141
1142 } = slot;
1143 }
1144
1145 ::fidl_next::Decode::decode(key.as_mut(), decoder)?;
1146
1147 ::fidl_next::Decode::decode(condition.as_mut(), decoder)?;
1148
1149 ::fidl_next::Decode::decode(values.as_mut(), decoder)?;
1150
1151 let values = unsafe { values.deref_unchecked() };
1152
1153 if values.len() > 64 {
1154 return Err(::fidl_next::DecodeError::VectorTooLong {
1155 size: values.len() as u64,
1156 limit: 64,
1157 });
1158 }
1159
1160 Ok(())
1161 }
1162}
1163
1164#[doc = " Represents a bind rule in a parent specification.\n"]
1165#[derive(Clone, Debug)]
1166pub struct BindRule2 {
1167 pub key: String,
1168
1169 pub condition: crate::Condition,
1170
1171 pub values: Vec<crate::NodePropertyValue>,
1172}
1173
1174impl ::fidl_next::Encodable for BindRule2 {
1175 type Encoded = WireBindRule2<'static>;
1176}
1177
1178unsafe impl<___E> ::fidl_next::Encode<___E> for BindRule2
1179where
1180 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1181
1182 ___E: ::fidl_next::Encoder,
1183{
1184 #[inline]
1185 fn encode(
1186 self,
1187 encoder: &mut ___E,
1188 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1189 ) -> Result<(), ::fidl_next::EncodeError> {
1190 ::fidl_next::munge! {
1191 let Self::Encoded {
1192 key,
1193 condition,
1194 values,
1195
1196 } = out;
1197 }
1198
1199 ::fidl_next::Encode::encode(self.key, encoder, key)?;
1200
1201 ::fidl_next::Encode::encode(self.condition, encoder, condition)?;
1202
1203 ::fidl_next::Encode::encode(self.values, encoder, values)?;
1204
1205 Ok(())
1206 }
1207}
1208
1209unsafe impl<___E> ::fidl_next::EncodeRef<___E> for BindRule2
1210where
1211 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1212
1213 ___E: ::fidl_next::Encoder,
1214{
1215 #[inline]
1216 fn encode_ref(
1217 &self,
1218 encoder: &mut ___E,
1219 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1220 ) -> Result<(), ::fidl_next::EncodeError> {
1221 ::fidl_next::munge! {
1222 let Self::Encoded {
1223 key,
1224 condition,
1225 values,
1226
1227 } = out;
1228 }
1229
1230 ::fidl_next::EncodeRef::encode_ref(&self.key, encoder, key)?;
1231
1232 ::fidl_next::EncodeRef::encode_ref(&self.condition, encoder, condition)?;
1233
1234 ::fidl_next::EncodeRef::encode_ref(&self.values, encoder, values)?;
1235
1236 Ok(())
1237 }
1238}
1239
1240impl ::fidl_next::EncodableOption for BindRule2 {
1241 type EncodedOption = ::fidl_next::WireBox<'static, WireBindRule2<'static>>;
1242}
1243
1244unsafe impl<___E> ::fidl_next::EncodeOption<___E> for BindRule2
1245where
1246 ___E: ::fidl_next::Encoder + ?Sized,
1247 BindRule2: ::fidl_next::Encode<___E>,
1248{
1249 #[inline]
1250 fn encode_option(
1251 this: Option<Self>,
1252 encoder: &mut ___E,
1253 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1254 ) -> Result<(), ::fidl_next::EncodeError> {
1255 if let Some(inner) = this {
1256 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1257 ::fidl_next::WireBox::encode_present(out);
1258 } else {
1259 ::fidl_next::WireBox::encode_absent(out);
1260 }
1261
1262 Ok(())
1263 }
1264}
1265
1266unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for BindRule2
1267where
1268 ___E: ::fidl_next::Encoder + ?Sized,
1269 BindRule2: ::fidl_next::EncodeRef<___E>,
1270{
1271 #[inline]
1272 fn encode_option_ref(
1273 this: Option<&Self>,
1274 encoder: &mut ___E,
1275 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1276 ) -> Result<(), ::fidl_next::EncodeError> {
1277 if let Some(inner) = this {
1278 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1279 ::fidl_next::WireBox::encode_present(out);
1280 } else {
1281 ::fidl_next::WireBox::encode_absent(out);
1282 }
1283
1284 Ok(())
1285 }
1286}
1287
1288impl<'de> ::fidl_next::FromWire<WireBindRule2<'de>> for BindRule2 {
1289 #[inline]
1290 fn from_wire(wire: WireBindRule2<'de>) -> Self {
1291 Self {
1292 key: ::fidl_next::FromWire::from_wire(wire.key),
1293
1294 condition: ::fidl_next::FromWire::from_wire(wire.condition),
1295
1296 values: ::fidl_next::FromWire::from_wire(wire.values),
1297 }
1298 }
1299}
1300
1301impl<'de> ::fidl_next::FromWireRef<WireBindRule2<'de>> for BindRule2 {
1302 #[inline]
1303 fn from_wire_ref(wire: &WireBindRule2<'de>) -> Self {
1304 Self {
1305 key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
1306
1307 condition: ::fidl_next::FromWireRef::from_wire_ref(&wire.condition),
1308
1309 values: ::fidl_next::FromWireRef::from_wire_ref(&wire.values),
1310 }
1311 }
1312}
1313
1314#[derive(Debug)]
1316#[repr(C)]
1317pub struct WireBindRule2<'de> {
1318 pub key: ::fidl_next::WireString<'de>,
1319
1320 pub condition: crate::WireCondition,
1321
1322 pub values: ::fidl_next::WireVector<'de, crate::WireNodePropertyValue<'de>>,
1323}
1324
1325unsafe impl ::fidl_next::Wire for WireBindRule2<'static> {
1326 type Decoded<'de> = WireBindRule2<'de>;
1327
1328 #[inline]
1329 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1330 unsafe {
1331 out.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
1332 }
1333 }
1334}
1335
1336unsafe impl<___D> ::fidl_next::Decode<___D> for WireBindRule2<'static>
1337where
1338 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1339
1340 ___D: ::fidl_next::Decoder,
1341{
1342 fn decode(
1343 slot: ::fidl_next::Slot<'_, Self>,
1344 decoder: &mut ___D,
1345 ) -> Result<(), ::fidl_next::DecodeError> {
1346 ::fidl_next::munge! {
1347 let Self {
1348 mut key,
1349 mut condition,
1350 mut values,
1351
1352 } = slot;
1353 }
1354
1355 ::fidl_next::Decode::decode(key.as_mut(), decoder)?;
1356
1357 let key = unsafe { key.deref_unchecked() };
1358
1359 if key.len() > 256 {
1360 return Err(::fidl_next::DecodeError::VectorTooLong {
1361 size: key.len() as u64,
1362 limit: 256,
1363 });
1364 }
1365
1366 ::fidl_next::Decode::decode(condition.as_mut(), decoder)?;
1367
1368 ::fidl_next::Decode::decode(values.as_mut(), decoder)?;
1369
1370 let values = unsafe { values.deref_unchecked() };
1371
1372 if values.len() > 64 {
1373 return Err(::fidl_next::DecodeError::VectorTooLong {
1374 size: values.len() as u64,
1375 limit: 64,
1376 });
1377 }
1378
1379 Ok(())
1380 }
1381}
1382
1383#[derive(Clone, Copy, Debug, PartialEq, Eq)]
1384#[repr(u32)]
1385pub enum BusType {
1386 Platform = 1,
1387 Acpi = 2,
1388 DeviceTree = 3,
1389 Pci = 4,
1390 Usb = 5,
1391 Gpio = 6,
1392 I2C = 7,
1393 Spi = 8,
1394 Sdio = 9,
1395 Uart = 10,
1396 Spmi = 11,
1397 UnknownOrdinal_(u32),
1398}
1399
1400impl ::fidl_next::Encodable for BusType {
1401 type Encoded = WireBusType;
1402}
1403impl ::std::convert::From<u32> for BusType {
1404 fn from(value: u32) -> Self {
1405 match value {
1406 1 => Self::Platform,
1407 2 => Self::Acpi,
1408 3 => Self::DeviceTree,
1409 4 => Self::Pci,
1410 5 => Self::Usb,
1411 6 => Self::Gpio,
1412 7 => Self::I2C,
1413 8 => Self::Spi,
1414 9 => Self::Sdio,
1415 10 => Self::Uart,
1416 11 => Self::Spmi,
1417
1418 _ => Self::UnknownOrdinal_(value),
1419 }
1420 }
1421}
1422
1423unsafe impl<___E> ::fidl_next::Encode<___E> for BusType
1424where
1425 ___E: ?Sized,
1426{
1427 #[inline]
1428 fn encode(
1429 self,
1430 encoder: &mut ___E,
1431 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1432 ) -> Result<(), ::fidl_next::EncodeError> {
1433 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
1434 }
1435}
1436
1437unsafe impl<___E> ::fidl_next::EncodeRef<___E> for BusType
1438where
1439 ___E: ?Sized,
1440{
1441 #[inline]
1442 fn encode_ref(
1443 &self,
1444 encoder: &mut ___E,
1445 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1446 ) -> Result<(), ::fidl_next::EncodeError> {
1447 ::fidl_next::munge!(let WireBusType { value } = out);
1448 let _ = value.write(::fidl_next::WireU32::from(match *self {
1449 Self::Platform => 1,
1450
1451 Self::Acpi => 2,
1452
1453 Self::DeviceTree => 3,
1454
1455 Self::Pci => 4,
1456
1457 Self::Usb => 5,
1458
1459 Self::Gpio => 6,
1460
1461 Self::I2C => 7,
1462
1463 Self::Spi => 8,
1464
1465 Self::Sdio => 9,
1466
1467 Self::Uart => 10,
1468
1469 Self::Spmi => 11,
1470
1471 Self::UnknownOrdinal_(value) => value,
1472 }));
1473
1474 Ok(())
1475 }
1476}
1477
1478impl ::core::convert::From<WireBusType> for BusType {
1479 fn from(wire: WireBusType) -> Self {
1480 match u32::from(wire.value) {
1481 1 => Self::Platform,
1482
1483 2 => Self::Acpi,
1484
1485 3 => Self::DeviceTree,
1486
1487 4 => Self::Pci,
1488
1489 5 => Self::Usb,
1490
1491 6 => Self::Gpio,
1492
1493 7 => Self::I2C,
1494
1495 8 => Self::Spi,
1496
1497 9 => Self::Sdio,
1498
1499 10 => Self::Uart,
1500
1501 11 => Self::Spmi,
1502
1503 value => Self::UnknownOrdinal_(value),
1504 }
1505 }
1506}
1507
1508impl ::fidl_next::FromWire<WireBusType> for BusType {
1509 #[inline]
1510 fn from_wire(wire: WireBusType) -> Self {
1511 Self::from(wire)
1512 }
1513}
1514
1515impl ::fidl_next::FromWireRef<WireBusType> for BusType {
1516 #[inline]
1517 fn from_wire_ref(wire: &WireBusType) -> Self {
1518 Self::from(*wire)
1519 }
1520}
1521
1522#[derive(Clone, Copy, Debug, PartialEq, Eq)]
1524#[repr(transparent)]
1525pub struct WireBusType {
1526 value: ::fidl_next::WireU32,
1527}
1528
1529unsafe impl ::fidl_next::Wire for WireBusType {
1530 type Decoded<'de> = Self;
1531
1532 #[inline]
1533 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1534 }
1536}
1537
1538impl WireBusType {
1539 pub const PLATFORM: WireBusType = WireBusType { value: ::fidl_next::WireU32(1) };
1540
1541 pub const ACPI: WireBusType = WireBusType { value: ::fidl_next::WireU32(2) };
1542
1543 pub const DEVICE_TREE: WireBusType = WireBusType { value: ::fidl_next::WireU32(3) };
1544
1545 pub const PCI: WireBusType = WireBusType { value: ::fidl_next::WireU32(4) };
1546
1547 pub const USB: WireBusType = WireBusType { value: ::fidl_next::WireU32(5) };
1548
1549 pub const GPIO: WireBusType = WireBusType { value: ::fidl_next::WireU32(6) };
1550
1551 pub const I2_C: WireBusType = WireBusType { value: ::fidl_next::WireU32(7) };
1552
1553 pub const SPI: WireBusType = WireBusType { value: ::fidl_next::WireU32(8) };
1554
1555 pub const SDIO: WireBusType = WireBusType { value: ::fidl_next::WireU32(9) };
1556
1557 pub const UART: WireBusType = WireBusType { value: ::fidl_next::WireU32(10) };
1558
1559 pub const SPMI: WireBusType = WireBusType { value: ::fidl_next::WireU32(11) };
1560}
1561
1562unsafe impl<___D> ::fidl_next::Decode<___D> for WireBusType
1563where
1564 ___D: ?Sized,
1565{
1566 fn decode(
1567 slot: ::fidl_next::Slot<'_, Self>,
1568 _: &mut ___D,
1569 ) -> Result<(), ::fidl_next::DecodeError> {
1570 Ok(())
1571 }
1572}
1573
1574impl ::core::convert::From<BusType> for WireBusType {
1575 fn from(natural: BusType) -> Self {
1576 match natural {
1577 BusType::Platform => WireBusType::PLATFORM,
1578
1579 BusType::Acpi => WireBusType::ACPI,
1580
1581 BusType::DeviceTree => WireBusType::DEVICE_TREE,
1582
1583 BusType::Pci => WireBusType::PCI,
1584
1585 BusType::Usb => WireBusType::USB,
1586
1587 BusType::Gpio => WireBusType::GPIO,
1588
1589 BusType::I2C => WireBusType::I2_C,
1590
1591 BusType::Spi => WireBusType::SPI,
1592
1593 BusType::Sdio => WireBusType::SDIO,
1594
1595 BusType::Uart => WireBusType::UART,
1596
1597 BusType::Spmi => WireBusType::SPMI,
1598
1599 BusType::UnknownOrdinal_(value) => {
1600 WireBusType { value: ::fidl_next::WireU32::from(value) }
1601 }
1602 }
1603 }
1604}
1605
1606pub const MAX_DEVICE_ADDRESS_ARRAY_LEN: u32 = 10;
1607
1608pub const MAX_DEVICE_ADDRESS_STR_LEN: u32 = 32;
1609
1610#[derive(Clone, Debug)]
1611pub enum DeviceAddress {
1612 IntValue(u8),
1613
1614 ArrayIntValue(Vec<u8>),
1615
1616 CharIntValue(String),
1617
1618 ArrayCharIntValue(Vec<String>),
1619
1620 StringValue(String),
1621
1622 UnknownOrdinal_(u64),
1623}
1624
1625impl ::fidl_next::Encodable for DeviceAddress {
1626 type Encoded = WireDeviceAddress<'static>;
1627}
1628
1629unsafe impl<___E> ::fidl_next::Encode<___E> for DeviceAddress
1630where
1631 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1632
1633 ___E: ::fidl_next::Encoder,
1634{
1635 #[inline]
1636 fn encode(
1637 self,
1638 encoder: &mut ___E,
1639 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1640 ) -> Result<(), ::fidl_next::EncodeError> {
1641 ::fidl_next::munge!(let WireDeviceAddress { raw, _phantom: _ } = out);
1642
1643 match self {
1644 Self::IntValue(value) => {
1645 ::fidl_next::RawWireUnion::encode_as::<___E, u8>(value, 1, encoder, raw)?
1646 }
1647
1648 Self::ArrayIntValue(value) => {
1649 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u8>>(value, 2, encoder, raw)?
1650 }
1651
1652 Self::CharIntValue(value) => {
1653 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 3, encoder, raw)?
1654 }
1655
1656 Self::ArrayCharIntValue(value) => {
1657 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<String>>(value, 4, encoder, raw)?
1658 }
1659
1660 Self::StringValue(value) => {
1661 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 5, encoder, raw)?
1662 }
1663
1664 Self::UnknownOrdinal_(ordinal) => {
1665 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
1666 }
1667 }
1668
1669 Ok(())
1670 }
1671}
1672
1673unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DeviceAddress
1674where
1675 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1676
1677 ___E: ::fidl_next::Encoder,
1678{
1679 #[inline]
1680 fn encode_ref(
1681 &self,
1682 encoder: &mut ___E,
1683 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1684 ) -> Result<(), ::fidl_next::EncodeError> {
1685 ::fidl_next::munge!(let WireDeviceAddress { raw, _phantom: _ } = out);
1686
1687 match self {
1688 Self::IntValue(value) => {
1689 ::fidl_next::RawWireUnion::encode_as::<___E, &u8>(value, 1, encoder, raw)?
1690 }
1691
1692 Self::ArrayIntValue(value) => {
1693 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u8>>(value, 2, encoder, raw)?
1694 }
1695
1696 Self::CharIntValue(value) => {
1697 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 3, encoder, raw)?
1698 }
1699
1700 Self::ArrayCharIntValue(value) => {
1701 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<String>>(value, 4, encoder, raw)?
1702 }
1703
1704 Self::StringValue(value) => {
1705 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 5, encoder, raw)?
1706 }
1707
1708 Self::UnknownOrdinal_(ordinal) => {
1709 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
1710 }
1711 }
1712
1713 Ok(())
1714 }
1715}
1716
1717impl ::fidl_next::EncodableOption for DeviceAddress {
1718 type EncodedOption = WireOptionalDeviceAddress<'static>;
1719}
1720
1721unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DeviceAddress
1722where
1723 ___E: ?Sized,
1724 DeviceAddress: ::fidl_next::Encode<___E>,
1725{
1726 #[inline]
1727 fn encode_option(
1728 this: Option<Self>,
1729 encoder: &mut ___E,
1730 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1731 ) -> Result<(), ::fidl_next::EncodeError> {
1732 ::fidl_next::munge!(let WireOptionalDeviceAddress { raw, _phantom: _ } = &mut *out);
1733
1734 if let Some(inner) = this {
1735 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
1736 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
1737 } else {
1738 ::fidl_next::RawWireUnion::encode_absent(raw);
1739 }
1740
1741 Ok(())
1742 }
1743}
1744
1745unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for DeviceAddress
1746where
1747 ___E: ?Sized,
1748 DeviceAddress: ::fidl_next::EncodeRef<___E>,
1749{
1750 #[inline]
1751 fn encode_option_ref(
1752 this: Option<&Self>,
1753 encoder: &mut ___E,
1754 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1755 ) -> Result<(), ::fidl_next::EncodeError> {
1756 ::fidl_next::munge!(let WireOptionalDeviceAddress { raw, _phantom: _ } = &mut *out);
1757
1758 if let Some(inner) = this {
1759 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
1760 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
1761 } else {
1762 ::fidl_next::RawWireUnion::encode_absent(raw);
1763 }
1764
1765 Ok(())
1766 }
1767}
1768
1769impl<'de> ::fidl_next::FromWire<WireDeviceAddress<'de>> for DeviceAddress {
1770 #[inline]
1771 fn from_wire(wire: WireDeviceAddress<'de>) -> Self {
1772 let wire = ::core::mem::ManuallyDrop::new(wire);
1773 match wire.raw.ordinal() {
1774 1 => Self::IntValue(::fidl_next::FromWire::from_wire(unsafe {
1775 wire.raw.get().read_unchecked::<u8>()
1776 })),
1777
1778 2 => Self::ArrayIntValue(::fidl_next::FromWire::from_wire(unsafe {
1779 wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>()
1780 })),
1781
1782 3 => Self::CharIntValue(::fidl_next::FromWire::from_wire(unsafe {
1783 wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
1784 })),
1785
1786 4 => {
1787 Self::ArrayCharIntValue(::fidl_next::FromWire::from_wire(unsafe {
1788 wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
1789 }))
1790 }
1791
1792 5 => Self::StringValue(::fidl_next::FromWire::from_wire(unsafe {
1793 wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
1794 })),
1795
1796 _ => unsafe { ::core::hint::unreachable_unchecked() },
1797 }
1798 }
1799}
1800
1801impl<'de> ::fidl_next::FromWireRef<WireDeviceAddress<'de>> for DeviceAddress {
1802 #[inline]
1803 fn from_wire_ref(wire: &WireDeviceAddress<'de>) -> Self {
1804 match wire.raw.ordinal() {
1805 1 => Self::IntValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
1806 wire.raw.get().deref_unchecked::<u8>()
1807 })),
1808
1809 2 => Self::ArrayIntValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
1810 wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, u8>>()
1811 })),
1812
1813 3 => Self::CharIntValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
1814 wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
1815 })),
1816
1817 4 => {
1818 Self::ArrayCharIntValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
1819 wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
1820 }))
1821 }
1822
1823 5 => Self::StringValue(::fidl_next::FromWireRef::from_wire_ref(unsafe {
1824 wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
1825 })),
1826
1827 _ => unsafe { ::core::hint::unreachable_unchecked() },
1828 }
1829 }
1830}
1831
1832impl<'de> ::fidl_next::FromWireOption<WireOptionalDeviceAddress<'de>> for Box<DeviceAddress> {
1833 #[inline]
1834 fn from_wire_option(wire: WireOptionalDeviceAddress<'de>) -> Option<Self> {
1835 if let Some(inner) = wire.into_option() {
1836 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
1837 } else {
1838 None
1839 }
1840 }
1841}
1842
1843impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalDeviceAddress<'de>> for Box<DeviceAddress> {
1844 #[inline]
1845 fn from_wire_option_ref(wire: &WireOptionalDeviceAddress<'de>) -> Option<Self> {
1846 if let Some(inner) = wire.as_ref() {
1847 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
1848 } else {
1849 None
1850 }
1851 }
1852}
1853
1854#[repr(transparent)]
1856pub struct WireDeviceAddress<'de> {
1857 raw: ::fidl_next::RawWireUnion,
1858 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
1859}
1860
1861impl<'de> Drop for WireDeviceAddress<'de> {
1862 fn drop(&mut self) {
1863 match self.raw.ordinal() {
1864 1 => {
1865 let _ = unsafe { self.raw.get().read_unchecked::<u8>() };
1866 }
1867
1868 2 => {
1869 let _ =
1870 unsafe { self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>() };
1871 }
1872
1873 3 => {
1874 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
1875 }
1876
1877 4 => {
1878 let _ = unsafe {
1879 self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
1880 };
1881 }
1882
1883 5 => {
1884 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
1885 }
1886
1887 _ => (),
1888 }
1889 }
1890}
1891
1892unsafe impl ::fidl_next::Wire for WireDeviceAddress<'static> {
1893 type Decoded<'de> = WireDeviceAddress<'de>;
1894
1895 #[inline]
1896 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1897 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1898 ::fidl_next::RawWireUnion::zero_padding(raw);
1899 }
1900}
1901
1902pub mod device_address {
1903 pub enum Ref<'de> {
1904 IntValue(&'de u8),
1905
1906 ArrayIntValue(&'de ::fidl_next::WireVector<'de, u8>),
1907
1908 CharIntValue(&'de ::fidl_next::WireString<'de>),
1909
1910 ArrayCharIntValue(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>),
1911
1912 StringValue(&'de ::fidl_next::WireString<'de>),
1913
1914 UnknownOrdinal_(u64),
1915 }
1916}
1917
1918impl<'de> WireDeviceAddress<'de> {
1919 pub fn as_ref(&self) -> crate::device_address::Ref<'_> {
1920 match self.raw.ordinal() {
1921 1 => crate::device_address::Ref::IntValue(unsafe {
1922 self.raw.get().deref_unchecked::<u8>()
1923 }),
1924
1925 2 => crate::device_address::Ref::ArrayIntValue(unsafe {
1926 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>()
1927 }),
1928
1929 3 => crate::device_address::Ref::CharIntValue(unsafe {
1930 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
1931 }),
1932
1933 4 => {
1934 crate::device_address::Ref::ArrayCharIntValue(unsafe {
1935 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>()
1936 })
1937 }
1938
1939 5 => crate::device_address::Ref::StringValue(unsafe {
1940 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
1941 }),
1942
1943 unknown => crate::device_address::Ref::UnknownOrdinal_(unknown),
1944 }
1945 }
1946}
1947
1948unsafe impl<___D> ::fidl_next::Decode<___D> for WireDeviceAddress<'static>
1949where
1950 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1951
1952 ___D: ::fidl_next::Decoder,
1953{
1954 fn decode(
1955 mut slot: ::fidl_next::Slot<'_, Self>,
1956 decoder: &mut ___D,
1957 ) -> Result<(), ::fidl_next::DecodeError> {
1958 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1959 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
1960 1 => ::fidl_next::RawWireUnion::decode_as::<___D, u8>(raw, decoder)?,
1961
1962 2 => {
1963 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<'static, u8>>(
1964 raw, decoder,
1965 )?
1966 }
1967
1968 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
1969 raw, decoder,
1970 )?,
1971
1972 4 => ::fidl_next::RawWireUnion::decode_as::<
1973 ___D,
1974 ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
1975 >(raw, decoder)?,
1976
1977 5 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
1978 raw, decoder,
1979 )?,
1980
1981 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
1982 }
1983
1984 Ok(())
1985 }
1986}
1987
1988impl<'de> ::core::fmt::Debug for WireDeviceAddress<'de> {
1989 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1990 match self.raw.ordinal() {
1991 1 => unsafe { self.raw.get().deref_unchecked::<u8>().fmt(f) },
1992 2 => unsafe {
1993 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>().fmt(f)
1994 },
1995 3 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) },
1996 4 => unsafe {
1997 self.raw
1998 .get()
1999 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>()
2000 .fmt(f)
2001 },
2002 5 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) },
2003 _ => unsafe { ::core::hint::unreachable_unchecked() },
2004 }
2005 }
2006}
2007
2008#[repr(transparent)]
2009pub struct WireOptionalDeviceAddress<'de> {
2010 raw: ::fidl_next::RawWireUnion,
2011 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
2012}
2013
2014unsafe impl ::fidl_next::Wire for WireOptionalDeviceAddress<'static> {
2015 type Decoded<'de> = WireOptionalDeviceAddress<'de>;
2016
2017 #[inline]
2018 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2019 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
2020 ::fidl_next::RawWireUnion::zero_padding(raw);
2021 }
2022}
2023
2024impl<'de> WireOptionalDeviceAddress<'de> {
2025 pub fn is_some(&self) -> bool {
2026 self.raw.is_some()
2027 }
2028
2029 pub fn is_none(&self) -> bool {
2030 self.raw.is_none()
2031 }
2032
2033 pub fn as_ref(&self) -> Option<&WireDeviceAddress<'de>> {
2034 if self.is_some() {
2035 Some(unsafe { &*(self as *const Self).cast() })
2036 } else {
2037 None
2038 }
2039 }
2040
2041 pub fn into_option(self) -> Option<WireDeviceAddress<'de>> {
2042 if self.is_some() {
2043 Some(WireDeviceAddress { raw: self.raw, _phantom: ::core::marker::PhantomData })
2044 } else {
2045 None
2046 }
2047 }
2048}
2049
2050unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalDeviceAddress<'static>
2051where
2052 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2053
2054 ___D: ::fidl_next::Decoder,
2055{
2056 fn decode(
2057 mut slot: ::fidl_next::Slot<'_, Self>,
2058 decoder: &mut ___D,
2059 ) -> Result<(), ::fidl_next::DecodeError> {
2060 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
2061 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
2062 1 => ::fidl_next::RawWireUnion::decode_as::<___D, u8>(raw, decoder)?,
2063
2064 2 => {
2065 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<'static, u8>>(
2066 raw, decoder,
2067 )?
2068 }
2069
2070 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
2071 raw, decoder,
2072 )?,
2073
2074 4 => ::fidl_next::RawWireUnion::decode_as::<
2075 ___D,
2076 ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
2077 >(raw, decoder)?,
2078
2079 5 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
2080 raw, decoder,
2081 )?,
2082
2083 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
2084 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
2085 }
2086
2087 Ok(())
2088 }
2089}
2090
2091impl<'de> ::core::fmt::Debug for WireOptionalDeviceAddress<'de> {
2092 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2093 self.as_ref().fmt(f)
2094 }
2095}
2096
2097#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2098#[repr(u32)]
2099pub enum DeviceAddressStability {
2100 UnstableBetweenDriverRestart = 0,
2101 UnstableBetweenBoot = 1,
2102 UnstableBetweenSoftwareUpdate = 2,
2103 Stable = 3,
2104 UnknownOrdinal_(u32),
2105}
2106
2107impl ::fidl_next::Encodable for DeviceAddressStability {
2108 type Encoded = WireDeviceAddressStability;
2109}
2110impl ::std::convert::From<u32> for DeviceAddressStability {
2111 fn from(value: u32) -> Self {
2112 match value {
2113 0 => Self::UnstableBetweenDriverRestart,
2114 1 => Self::UnstableBetweenBoot,
2115 2 => Self::UnstableBetweenSoftwareUpdate,
2116 3 => Self::Stable,
2117
2118 _ => Self::UnknownOrdinal_(value),
2119 }
2120 }
2121}
2122
2123unsafe impl<___E> ::fidl_next::Encode<___E> for DeviceAddressStability
2124where
2125 ___E: ?Sized,
2126{
2127 #[inline]
2128 fn encode(
2129 self,
2130 encoder: &mut ___E,
2131 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2132 ) -> Result<(), ::fidl_next::EncodeError> {
2133 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
2134 }
2135}
2136
2137unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DeviceAddressStability
2138where
2139 ___E: ?Sized,
2140{
2141 #[inline]
2142 fn encode_ref(
2143 &self,
2144 encoder: &mut ___E,
2145 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2146 ) -> Result<(), ::fidl_next::EncodeError> {
2147 ::fidl_next::munge!(let WireDeviceAddressStability { value } = out);
2148 let _ = value.write(::fidl_next::WireU32::from(match *self {
2149 Self::UnstableBetweenDriverRestart => 0,
2150
2151 Self::UnstableBetweenBoot => 1,
2152
2153 Self::UnstableBetweenSoftwareUpdate => 2,
2154
2155 Self::Stable => 3,
2156
2157 Self::UnknownOrdinal_(value) => value,
2158 }));
2159
2160 Ok(())
2161 }
2162}
2163
2164impl ::core::convert::From<WireDeviceAddressStability> for DeviceAddressStability {
2165 fn from(wire: WireDeviceAddressStability) -> Self {
2166 match u32::from(wire.value) {
2167 0 => Self::UnstableBetweenDriverRestart,
2168
2169 1 => Self::UnstableBetweenBoot,
2170
2171 2 => Self::UnstableBetweenSoftwareUpdate,
2172
2173 3 => Self::Stable,
2174
2175 value => Self::UnknownOrdinal_(value),
2176 }
2177 }
2178}
2179
2180impl ::fidl_next::FromWire<WireDeviceAddressStability> for DeviceAddressStability {
2181 #[inline]
2182 fn from_wire(wire: WireDeviceAddressStability) -> Self {
2183 Self::from(wire)
2184 }
2185}
2186
2187impl ::fidl_next::FromWireRef<WireDeviceAddressStability> for DeviceAddressStability {
2188 #[inline]
2189 fn from_wire_ref(wire: &WireDeviceAddressStability) -> Self {
2190 Self::from(*wire)
2191 }
2192}
2193
2194#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2196#[repr(transparent)]
2197pub struct WireDeviceAddressStability {
2198 value: ::fidl_next::WireU32,
2199}
2200
2201unsafe impl ::fidl_next::Wire for WireDeviceAddressStability {
2202 type Decoded<'de> = Self;
2203
2204 #[inline]
2205 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2206 }
2208}
2209
2210impl WireDeviceAddressStability {
2211 pub const UNSTABLE_BETWEEN_DRIVER_RESTART: WireDeviceAddressStability =
2212 WireDeviceAddressStability { value: ::fidl_next::WireU32(0) };
2213
2214 pub const UNSTABLE_BETWEEN_BOOT: WireDeviceAddressStability =
2215 WireDeviceAddressStability { value: ::fidl_next::WireU32(1) };
2216
2217 pub const UNSTABLE_BETWEEN_SOFTWARE_UPDATE: WireDeviceAddressStability =
2218 WireDeviceAddressStability { value: ::fidl_next::WireU32(2) };
2219
2220 pub const STABLE: WireDeviceAddressStability =
2221 WireDeviceAddressStability { value: ::fidl_next::WireU32(3) };
2222}
2223
2224unsafe impl<___D> ::fidl_next::Decode<___D> for WireDeviceAddressStability
2225where
2226 ___D: ?Sized,
2227{
2228 fn decode(
2229 slot: ::fidl_next::Slot<'_, Self>,
2230 _: &mut ___D,
2231 ) -> Result<(), ::fidl_next::DecodeError> {
2232 Ok(())
2233 }
2234}
2235
2236impl ::core::convert::From<DeviceAddressStability> for WireDeviceAddressStability {
2237 fn from(natural: DeviceAddressStability) -> Self {
2238 match natural {
2239 DeviceAddressStability::UnstableBetweenDriverRestart => {
2240 WireDeviceAddressStability::UNSTABLE_BETWEEN_DRIVER_RESTART
2241 }
2242
2243 DeviceAddressStability::UnstableBetweenBoot => {
2244 WireDeviceAddressStability::UNSTABLE_BETWEEN_BOOT
2245 }
2246
2247 DeviceAddressStability::UnstableBetweenSoftwareUpdate => {
2248 WireDeviceAddressStability::UNSTABLE_BETWEEN_SOFTWARE_UPDATE
2249 }
2250
2251 DeviceAddressStability::Stable => WireDeviceAddressStability::STABLE,
2252
2253 DeviceAddressStability::UnknownOrdinal_(value) => {
2254 WireDeviceAddressStability { value: ::fidl_next::WireU32::from(value) }
2255 }
2256 }
2257 }
2258}
2259
2260#[derive(Clone, Debug, Default)]
2261pub struct BusInfo {
2262 pub bus: Option<crate::BusType>,
2263
2264 pub address: Option<crate::DeviceAddress>,
2265
2266 pub address_stability: Option<crate::DeviceAddressStability>,
2267}
2268
2269impl BusInfo {
2270 fn __max_ordinal(&self) -> usize {
2271 if self.bus.is_some() {
2272 return 1;
2273 }
2274
2275 if self.address.is_some() {
2276 return 2;
2277 }
2278
2279 if self.address_stability.is_some() {
2280 return 3;
2281 }
2282
2283 0
2284 }
2285}
2286
2287impl ::fidl_next::Encodable for BusInfo {
2288 type Encoded = WireBusInfo<'static>;
2289}
2290
2291unsafe impl<___E> ::fidl_next::Encode<___E> for BusInfo
2292where
2293 ___E: ::fidl_next::Encoder + ?Sized,
2294{
2295 #[inline]
2296 fn encode(
2297 mut self,
2298 encoder: &mut ___E,
2299 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2300 ) -> Result<(), ::fidl_next::EncodeError> {
2301 ::fidl_next::munge!(let WireBusInfo { table } = out);
2302
2303 let max_ord = self.__max_ordinal();
2304
2305 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2306 ::fidl_next::Wire::zero_padding(&mut out);
2307
2308 let mut preallocated =
2309 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2310
2311 for i in 1..=max_ord {
2312 match i {
2313 3 => {
2314 if let Some(address_stability) = self.address_stability.take() {
2315 ::fidl_next::WireEnvelope::encode_value(
2316 address_stability,
2317 preallocated.encoder,
2318 &mut out,
2319 )?;
2320 } else {
2321 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2322 }
2323 }
2324
2325 2 => {
2326 if let Some(address) = self.address.take() {
2327 ::fidl_next::WireEnvelope::encode_value(
2328 address,
2329 preallocated.encoder,
2330 &mut out,
2331 )?;
2332 } else {
2333 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2334 }
2335 }
2336
2337 1 => {
2338 if let Some(bus) = self.bus.take() {
2339 ::fidl_next::WireEnvelope::encode_value(
2340 bus,
2341 preallocated.encoder,
2342 &mut out,
2343 )?;
2344 } else {
2345 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2346 }
2347 }
2348
2349 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2350 }
2351 unsafe {
2352 preallocated.write_next(out.assume_init_ref());
2353 }
2354 }
2355
2356 ::fidl_next::WireTable::encode_len(table, max_ord);
2357
2358 Ok(())
2359 }
2360}
2361
2362unsafe impl<___E> ::fidl_next::EncodeRef<___E> for BusInfo
2363where
2364 ___E: ::fidl_next::Encoder + ?Sized,
2365{
2366 #[inline]
2367 fn encode_ref(
2368 &self,
2369 encoder: &mut ___E,
2370 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2371 ) -> Result<(), ::fidl_next::EncodeError> {
2372 ::fidl_next::munge!(let WireBusInfo { table } = out);
2373
2374 let max_ord = self.__max_ordinal();
2375
2376 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2377 ::fidl_next::Wire::zero_padding(&mut out);
2378
2379 let mut preallocated =
2380 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2381
2382 for i in 1..=max_ord {
2383 match i {
2384 3 => {
2385 if let Some(address_stability) = &self.address_stability {
2386 ::fidl_next::WireEnvelope::encode_value(
2387 address_stability,
2388 preallocated.encoder,
2389 &mut out,
2390 )?;
2391 } else {
2392 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2393 }
2394 }
2395
2396 2 => {
2397 if let Some(address) = &self.address {
2398 ::fidl_next::WireEnvelope::encode_value(
2399 address,
2400 preallocated.encoder,
2401 &mut out,
2402 )?;
2403 } else {
2404 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2405 }
2406 }
2407
2408 1 => {
2409 if let Some(bus) = &self.bus {
2410 ::fidl_next::WireEnvelope::encode_value(
2411 bus,
2412 preallocated.encoder,
2413 &mut out,
2414 )?;
2415 } else {
2416 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2417 }
2418 }
2419
2420 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2421 }
2422 unsafe {
2423 preallocated.write_next(out.assume_init_ref());
2424 }
2425 }
2426
2427 ::fidl_next::WireTable::encode_len(table, max_ord);
2428
2429 Ok(())
2430 }
2431}
2432
2433impl<'de> ::fidl_next::FromWire<WireBusInfo<'de>> for BusInfo {
2434 #[inline]
2435 fn from_wire(wire: WireBusInfo<'de>) -> Self {
2436 let wire = ::core::mem::ManuallyDrop::new(wire);
2437
2438 let bus = wire.table.get(1);
2439
2440 let address = wire.table.get(2);
2441
2442 let address_stability = wire.table.get(3);
2443
2444 Self {
2445 bus: bus.map(|envelope| {
2446 ::fidl_next::FromWire::from_wire(unsafe {
2447 envelope.read_unchecked::<crate::WireBusType>()
2448 })
2449 }),
2450
2451 address: address.map(|envelope| {
2452 ::fidl_next::FromWire::from_wire(unsafe {
2453 envelope.read_unchecked::<crate::WireDeviceAddress<'de>>()
2454 })
2455 }),
2456
2457 address_stability: address_stability.map(|envelope| {
2458 ::fidl_next::FromWire::from_wire(unsafe {
2459 envelope.read_unchecked::<crate::WireDeviceAddressStability>()
2460 })
2461 }),
2462 }
2463 }
2464}
2465
2466impl<'de> ::fidl_next::FromWireRef<WireBusInfo<'de>> for BusInfo {
2467 #[inline]
2468 fn from_wire_ref(wire: &WireBusInfo<'de>) -> Self {
2469 Self {
2470 bus: wire.table.get(1).map(|envelope| {
2471 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2472 envelope.deref_unchecked::<crate::WireBusType>()
2473 })
2474 }),
2475
2476 address: wire.table.get(2).map(|envelope| {
2477 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2478 envelope.deref_unchecked::<crate::WireDeviceAddress<'de>>()
2479 })
2480 }),
2481
2482 address_stability: wire.table.get(3).map(|envelope| {
2483 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2484 envelope.deref_unchecked::<crate::WireDeviceAddressStability>()
2485 })
2486 }),
2487 }
2488 }
2489}
2490
2491#[repr(C)]
2493pub struct WireBusInfo<'de> {
2494 table: ::fidl_next::WireTable<'de>,
2495}
2496
2497impl<'de> Drop for WireBusInfo<'de> {
2498 fn drop(&mut self) {
2499 let _ = self
2500 .table
2501 .get(1)
2502 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireBusType>() });
2503
2504 let _ = self
2505 .table
2506 .get(2)
2507 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDeviceAddress<'de>>() });
2508
2509 let _ = self.table.get(3).map(|envelope| unsafe {
2510 envelope.read_unchecked::<crate::WireDeviceAddressStability>()
2511 });
2512 }
2513}
2514
2515unsafe impl ::fidl_next::Wire for WireBusInfo<'static> {
2516 type Decoded<'de> = WireBusInfo<'de>;
2517
2518 #[inline]
2519 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2520 ::fidl_next::munge!(let Self { table } = out);
2521 ::fidl_next::WireTable::zero_padding(table);
2522 }
2523}
2524
2525unsafe impl<___D> ::fidl_next::Decode<___D> for WireBusInfo<'static>
2526where
2527 ___D: ::fidl_next::Decoder + ?Sized,
2528{
2529 fn decode(
2530 slot: ::fidl_next::Slot<'_, Self>,
2531 decoder: &mut ___D,
2532 ) -> Result<(), ::fidl_next::DecodeError> {
2533 ::fidl_next::munge!(let Self { table } = slot);
2534
2535 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2536 match ordinal {
2537 0 => unsafe { ::core::hint::unreachable_unchecked() },
2538
2539 1 => {
2540 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireBusType>(
2541 slot.as_mut(),
2542 decoder,
2543 )?;
2544
2545 Ok(())
2546 }
2547
2548 2 => {
2549 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDeviceAddress<'static>>(
2550 slot.as_mut(),
2551 decoder,
2552 )?;
2553
2554 Ok(())
2555 }
2556
2557 3 => {
2558 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDeviceAddressStability>(
2559 slot.as_mut(),
2560 decoder,
2561 )?;
2562
2563 Ok(())
2564 }
2565
2566 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
2567 }
2568 })
2569 }
2570}
2571
2572impl<'de> WireBusInfo<'de> {
2573 pub fn bus(&self) -> Option<&crate::WireBusType> {
2574 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2575 }
2576
2577 pub fn address(&self) -> Option<&crate::WireDeviceAddress<'de>> {
2578 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2579 }
2580
2581 pub fn address_stability(&self) -> Option<&crate::WireDeviceAddressStability> {
2582 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2583 }
2584}
2585
2586impl<'de> ::core::fmt::Debug for WireBusInfo<'de> {
2587 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
2588 f.debug_struct("BusInfo")
2589 .field("bus", &self.bus())
2590 .field("address", &self.address())
2591 .field("address_stability", &self.address_stability())
2592 .finish()
2593 }
2594}
2595
2596#[doc = " The type of Fuchsia package that a driver component is inside of.\n More details about the various package categories are available at:\n https://fuchsia.dev/fuchsia-src/concepts/packages/package#types_of_packages\n"]
2597#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2598#[repr(u8)]
2599pub enum DriverPackageType {
2600 Boot = 0,
2601 Base = 1,
2602 Cached = 2,
2603 Universe = 3,
2604 UnknownOrdinal_(u8),
2605}
2606
2607impl ::fidl_next::Encodable for DriverPackageType {
2608 type Encoded = WireDriverPackageType;
2609}
2610impl ::std::convert::From<u8> for DriverPackageType {
2611 fn from(value: u8) -> Self {
2612 match value {
2613 0 => Self::Boot,
2614 1 => Self::Base,
2615 2 => Self::Cached,
2616 3 => Self::Universe,
2617
2618 _ => Self::UnknownOrdinal_(value),
2619 }
2620 }
2621}
2622
2623unsafe impl<___E> ::fidl_next::Encode<___E> for DriverPackageType
2624where
2625 ___E: ?Sized,
2626{
2627 #[inline]
2628 fn encode(
2629 self,
2630 encoder: &mut ___E,
2631 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2632 ) -> Result<(), ::fidl_next::EncodeError> {
2633 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
2634 }
2635}
2636
2637unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DriverPackageType
2638where
2639 ___E: ?Sized,
2640{
2641 #[inline]
2642 fn encode_ref(
2643 &self,
2644 encoder: &mut ___E,
2645 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2646 ) -> Result<(), ::fidl_next::EncodeError> {
2647 ::fidl_next::munge!(let WireDriverPackageType { value } = out);
2648 let _ = value.write(u8::from(match *self {
2649 Self::Boot => 0,
2650
2651 Self::Base => 1,
2652
2653 Self::Cached => 2,
2654
2655 Self::Universe => 3,
2656
2657 Self::UnknownOrdinal_(value) => value,
2658 }));
2659
2660 Ok(())
2661 }
2662}
2663
2664impl ::core::convert::From<WireDriverPackageType> for DriverPackageType {
2665 fn from(wire: WireDriverPackageType) -> Self {
2666 match u8::from(wire.value) {
2667 0 => Self::Boot,
2668
2669 1 => Self::Base,
2670
2671 2 => Self::Cached,
2672
2673 3 => Self::Universe,
2674
2675 value => Self::UnknownOrdinal_(value),
2676 }
2677 }
2678}
2679
2680impl ::fidl_next::FromWire<WireDriverPackageType> for DriverPackageType {
2681 #[inline]
2682 fn from_wire(wire: WireDriverPackageType) -> Self {
2683 Self::from(wire)
2684 }
2685}
2686
2687impl ::fidl_next::FromWireRef<WireDriverPackageType> for DriverPackageType {
2688 #[inline]
2689 fn from_wire_ref(wire: &WireDriverPackageType) -> Self {
2690 Self::from(*wire)
2691 }
2692}
2693
2694#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2696#[repr(transparent)]
2697pub struct WireDriverPackageType {
2698 value: u8,
2699}
2700
2701unsafe impl ::fidl_next::Wire for WireDriverPackageType {
2702 type Decoded<'de> = Self;
2703
2704 #[inline]
2705 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2706 }
2708}
2709
2710impl WireDriverPackageType {
2711 pub const BOOT: WireDriverPackageType = WireDriverPackageType { value: 0 };
2712
2713 pub const BASE: WireDriverPackageType = WireDriverPackageType { value: 1 };
2714
2715 pub const CACHED: WireDriverPackageType = WireDriverPackageType { value: 2 };
2716
2717 pub const UNIVERSE: WireDriverPackageType = WireDriverPackageType { value: 3 };
2718}
2719
2720unsafe impl<___D> ::fidl_next::Decode<___D> for WireDriverPackageType
2721where
2722 ___D: ?Sized,
2723{
2724 fn decode(
2725 slot: ::fidl_next::Slot<'_, Self>,
2726 _: &mut ___D,
2727 ) -> Result<(), ::fidl_next::DecodeError> {
2728 Ok(())
2729 }
2730}
2731
2732impl ::core::convert::From<DriverPackageType> for WireDriverPackageType {
2733 fn from(natural: DriverPackageType) -> Self {
2734 match natural {
2735 DriverPackageType::Boot => WireDriverPackageType::BOOT,
2736
2737 DriverPackageType::Base => WireDriverPackageType::BASE,
2738
2739 DriverPackageType::Cached => WireDriverPackageType::CACHED,
2740
2741 DriverPackageType::Universe => WireDriverPackageType::UNIVERSE,
2742
2743 DriverPackageType::UnknownOrdinal_(value) => {
2744 WireDriverPackageType { value: u8::from(value) }
2745 }
2746 }
2747 }
2748}
2749
2750#[doc = " Device categories as provided in the driver\'s component manifest.\n"]
2751#[derive(Clone, Debug, Default)]
2752pub struct DeviceCategory {
2753 pub category: Option<String>,
2754
2755 pub subcategory: Option<String>,
2756}
2757
2758impl DeviceCategory {
2759 fn __max_ordinal(&self) -> usize {
2760 if self.category.is_some() {
2761 return 1;
2762 }
2763
2764 if self.subcategory.is_some() {
2765 return 2;
2766 }
2767
2768 0
2769 }
2770}
2771
2772impl ::fidl_next::Encodable for DeviceCategory {
2773 type Encoded = WireDeviceCategory<'static>;
2774}
2775
2776unsafe impl<___E> ::fidl_next::Encode<___E> for DeviceCategory
2777where
2778 ___E: ::fidl_next::Encoder + ?Sized,
2779{
2780 #[inline]
2781 fn encode(
2782 mut self,
2783 encoder: &mut ___E,
2784 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2785 ) -> Result<(), ::fidl_next::EncodeError> {
2786 ::fidl_next::munge!(let WireDeviceCategory { table } = out);
2787
2788 let max_ord = self.__max_ordinal();
2789
2790 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2791 ::fidl_next::Wire::zero_padding(&mut out);
2792
2793 let mut preallocated =
2794 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2795
2796 for i in 1..=max_ord {
2797 match i {
2798 2 => {
2799 if let Some(subcategory) = self.subcategory.take() {
2800 ::fidl_next::WireEnvelope::encode_value(
2801 subcategory,
2802 preallocated.encoder,
2803 &mut out,
2804 )?;
2805 } else {
2806 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2807 }
2808 }
2809
2810 1 => {
2811 if let Some(category) = self.category.take() {
2812 ::fidl_next::WireEnvelope::encode_value(
2813 category,
2814 preallocated.encoder,
2815 &mut out,
2816 )?;
2817 } else {
2818 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2819 }
2820 }
2821
2822 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2823 }
2824 unsafe {
2825 preallocated.write_next(out.assume_init_ref());
2826 }
2827 }
2828
2829 ::fidl_next::WireTable::encode_len(table, max_ord);
2830
2831 Ok(())
2832 }
2833}
2834
2835unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DeviceCategory
2836where
2837 ___E: ::fidl_next::Encoder + ?Sized,
2838{
2839 #[inline]
2840 fn encode_ref(
2841 &self,
2842 encoder: &mut ___E,
2843 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2844 ) -> Result<(), ::fidl_next::EncodeError> {
2845 ::fidl_next::munge!(let WireDeviceCategory { table } = out);
2846
2847 let max_ord = self.__max_ordinal();
2848
2849 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2850 ::fidl_next::Wire::zero_padding(&mut out);
2851
2852 let mut preallocated =
2853 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2854
2855 for i in 1..=max_ord {
2856 match i {
2857 2 => {
2858 if let Some(subcategory) = &self.subcategory {
2859 ::fidl_next::WireEnvelope::encode_value(
2860 subcategory,
2861 preallocated.encoder,
2862 &mut out,
2863 )?;
2864 } else {
2865 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2866 }
2867 }
2868
2869 1 => {
2870 if let Some(category) = &self.category {
2871 ::fidl_next::WireEnvelope::encode_value(
2872 category,
2873 preallocated.encoder,
2874 &mut out,
2875 )?;
2876 } else {
2877 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2878 }
2879 }
2880
2881 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2882 }
2883 unsafe {
2884 preallocated.write_next(out.assume_init_ref());
2885 }
2886 }
2887
2888 ::fidl_next::WireTable::encode_len(table, max_ord);
2889
2890 Ok(())
2891 }
2892}
2893
2894impl<'de> ::fidl_next::FromWire<WireDeviceCategory<'de>> for DeviceCategory {
2895 #[inline]
2896 fn from_wire(wire: WireDeviceCategory<'de>) -> Self {
2897 let wire = ::core::mem::ManuallyDrop::new(wire);
2898
2899 let category = wire.table.get(1);
2900
2901 let subcategory = wire.table.get(2);
2902
2903 Self {
2904 category: category.map(|envelope| {
2905 ::fidl_next::FromWire::from_wire(unsafe {
2906 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
2907 })
2908 }),
2909
2910 subcategory: subcategory.map(|envelope| {
2911 ::fidl_next::FromWire::from_wire(unsafe {
2912 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
2913 })
2914 }),
2915 }
2916 }
2917}
2918
2919impl<'de> ::fidl_next::FromWireRef<WireDeviceCategory<'de>> for DeviceCategory {
2920 #[inline]
2921 fn from_wire_ref(wire: &WireDeviceCategory<'de>) -> Self {
2922 Self {
2923 category: wire.table.get(1).map(|envelope| {
2924 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2925 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
2926 })
2927 }),
2928
2929 subcategory: wire.table.get(2).map(|envelope| {
2930 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2931 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
2932 })
2933 }),
2934 }
2935 }
2936}
2937
2938#[repr(C)]
2940pub struct WireDeviceCategory<'de> {
2941 table: ::fidl_next::WireTable<'de>,
2942}
2943
2944impl<'de> Drop for WireDeviceCategory<'de> {
2945 fn drop(&mut self) {
2946 let _ = self
2947 .table
2948 .get(1)
2949 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
2950
2951 let _ = self
2952 .table
2953 .get(2)
2954 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
2955 }
2956}
2957
2958unsafe impl ::fidl_next::Wire for WireDeviceCategory<'static> {
2959 type Decoded<'de> = WireDeviceCategory<'de>;
2960
2961 #[inline]
2962 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2963 ::fidl_next::munge!(let Self { table } = out);
2964 ::fidl_next::WireTable::zero_padding(table);
2965 }
2966}
2967
2968unsafe impl<___D> ::fidl_next::Decode<___D> for WireDeviceCategory<'static>
2969where
2970 ___D: ::fidl_next::Decoder + ?Sized,
2971{
2972 fn decode(
2973 slot: ::fidl_next::Slot<'_, Self>,
2974 decoder: &mut ___D,
2975 ) -> Result<(), ::fidl_next::DecodeError> {
2976 ::fidl_next::munge!(let Self { table } = slot);
2977
2978 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2979 match ordinal {
2980 0 => unsafe { ::core::hint::unreachable_unchecked() },
2981
2982 1 => {
2983 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
2984 slot.as_mut(),
2985 decoder,
2986 )?;
2987
2988 Ok(())
2989 }
2990
2991 2 => {
2992 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
2993 slot.as_mut(),
2994 decoder,
2995 )?;
2996
2997 Ok(())
2998 }
2999
3000 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
3001 }
3002 })
3003 }
3004}
3005
3006impl<'de> WireDeviceCategory<'de> {
3007 pub fn category(&self) -> Option<&::fidl_next::WireString<'de>> {
3008 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3009 }
3010
3011 pub fn subcategory(&self) -> Option<&::fidl_next::WireString<'de>> {
3012 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3013 }
3014}
3015
3016impl<'de> ::core::fmt::Debug for WireDeviceCategory<'de> {
3017 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
3018 f.debug_struct("DeviceCategory")
3019 .field("category", &self.category())
3020 .field("subcategory", &self.subcategory())
3021 .finish()
3022 }
3023}
3024
3025#[doc = " General information for a driver, used with both composite and normal drivers.\n"]
3026#[derive(Clone, Debug, Default)]
3027pub struct DriverInfo {
3028 pub url: Option<String>,
3029
3030 pub name: Option<String>,
3031
3032 pub colocate: Option<bool>,
3033
3034 pub package_type: Option<crate::DriverPackageType>,
3035
3036 pub is_fallback: Option<bool>,
3037
3038 pub device_categories: Option<Vec<crate::DeviceCategory>>,
3039
3040 pub bind_rules_bytecode: Option<Vec<u8>>,
3041
3042 pub driver_framework_version: Option<u8>,
3043
3044 pub is_disabled: Option<bool>,
3045}
3046
3047impl DriverInfo {
3048 fn __max_ordinal(&self) -> usize {
3049 if self.url.is_some() {
3050 return 1;
3051 }
3052
3053 if self.name.is_some() {
3054 return 2;
3055 }
3056
3057 if self.colocate.is_some() {
3058 return 3;
3059 }
3060
3061 if self.package_type.is_some() {
3062 return 4;
3063 }
3064
3065 if self.is_fallback.is_some() {
3066 return 5;
3067 }
3068
3069 if self.device_categories.is_some() {
3070 return 6;
3071 }
3072
3073 if self.bind_rules_bytecode.is_some() {
3074 return 7;
3075 }
3076
3077 if self.driver_framework_version.is_some() {
3078 return 8;
3079 }
3080
3081 if self.is_disabled.is_some() {
3082 return 9;
3083 }
3084
3085 0
3086 }
3087}
3088
3089impl ::fidl_next::Encodable for DriverInfo {
3090 type Encoded = WireDriverInfo<'static>;
3091}
3092
3093unsafe impl<___E> ::fidl_next::Encode<___E> for DriverInfo
3094where
3095 ___E: ::fidl_next::Encoder + ?Sized,
3096{
3097 #[inline]
3098 fn encode(
3099 mut self,
3100 encoder: &mut ___E,
3101 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3102 ) -> Result<(), ::fidl_next::EncodeError> {
3103 ::fidl_next::munge!(let WireDriverInfo { table } = out);
3104
3105 let max_ord = self.__max_ordinal();
3106
3107 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
3108 ::fidl_next::Wire::zero_padding(&mut out);
3109
3110 let mut preallocated =
3111 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
3112
3113 for i in 1..=max_ord {
3114 match i {
3115 9 => {
3116 if let Some(is_disabled) = self.is_disabled.take() {
3117 ::fidl_next::WireEnvelope::encode_value(
3118 is_disabled,
3119 preallocated.encoder,
3120 &mut out,
3121 )?;
3122 } else {
3123 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3124 }
3125 }
3126
3127 8 => {
3128 if let Some(driver_framework_version) = self.driver_framework_version.take() {
3129 ::fidl_next::WireEnvelope::encode_value(
3130 driver_framework_version,
3131 preallocated.encoder,
3132 &mut out,
3133 )?;
3134 } else {
3135 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3136 }
3137 }
3138
3139 7 => {
3140 if let Some(bind_rules_bytecode) = self.bind_rules_bytecode.take() {
3141 ::fidl_next::WireEnvelope::encode_value(
3142 bind_rules_bytecode,
3143 preallocated.encoder,
3144 &mut out,
3145 )?;
3146 } else {
3147 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3148 }
3149 }
3150
3151 6 => {
3152 if let Some(device_categories) = self.device_categories.take() {
3153 ::fidl_next::WireEnvelope::encode_value(
3154 device_categories,
3155 preallocated.encoder,
3156 &mut out,
3157 )?;
3158 } else {
3159 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3160 }
3161 }
3162
3163 5 => {
3164 if let Some(is_fallback) = self.is_fallback.take() {
3165 ::fidl_next::WireEnvelope::encode_value(
3166 is_fallback,
3167 preallocated.encoder,
3168 &mut out,
3169 )?;
3170 } else {
3171 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3172 }
3173 }
3174
3175 4 => {
3176 if let Some(package_type) = self.package_type.take() {
3177 ::fidl_next::WireEnvelope::encode_value(
3178 package_type,
3179 preallocated.encoder,
3180 &mut out,
3181 )?;
3182 } else {
3183 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3184 }
3185 }
3186
3187 3 => {
3188 if let Some(colocate) = self.colocate.take() {
3189 ::fidl_next::WireEnvelope::encode_value(
3190 colocate,
3191 preallocated.encoder,
3192 &mut out,
3193 )?;
3194 } else {
3195 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3196 }
3197 }
3198
3199 2 => {
3200 if let Some(name) = self.name.take() {
3201 ::fidl_next::WireEnvelope::encode_value(
3202 name,
3203 preallocated.encoder,
3204 &mut out,
3205 )?;
3206 } else {
3207 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3208 }
3209 }
3210
3211 1 => {
3212 if let Some(url) = self.url.take() {
3213 ::fidl_next::WireEnvelope::encode_value(
3214 url,
3215 preallocated.encoder,
3216 &mut out,
3217 )?;
3218 } else {
3219 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3220 }
3221 }
3222
3223 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
3224 }
3225 unsafe {
3226 preallocated.write_next(out.assume_init_ref());
3227 }
3228 }
3229
3230 ::fidl_next::WireTable::encode_len(table, max_ord);
3231
3232 Ok(())
3233 }
3234}
3235
3236unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DriverInfo
3237where
3238 ___E: ::fidl_next::Encoder + ?Sized,
3239{
3240 #[inline]
3241 fn encode_ref(
3242 &self,
3243 encoder: &mut ___E,
3244 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3245 ) -> Result<(), ::fidl_next::EncodeError> {
3246 ::fidl_next::munge!(let WireDriverInfo { table } = out);
3247
3248 let max_ord = self.__max_ordinal();
3249
3250 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
3251 ::fidl_next::Wire::zero_padding(&mut out);
3252
3253 let mut preallocated =
3254 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
3255
3256 for i in 1..=max_ord {
3257 match i {
3258 9 => {
3259 if let Some(is_disabled) = &self.is_disabled {
3260 ::fidl_next::WireEnvelope::encode_value(
3261 is_disabled,
3262 preallocated.encoder,
3263 &mut out,
3264 )?;
3265 } else {
3266 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3267 }
3268 }
3269
3270 8 => {
3271 if let Some(driver_framework_version) = &self.driver_framework_version {
3272 ::fidl_next::WireEnvelope::encode_value(
3273 driver_framework_version,
3274 preallocated.encoder,
3275 &mut out,
3276 )?;
3277 } else {
3278 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3279 }
3280 }
3281
3282 7 => {
3283 if let Some(bind_rules_bytecode) = &self.bind_rules_bytecode {
3284 ::fidl_next::WireEnvelope::encode_value(
3285 bind_rules_bytecode,
3286 preallocated.encoder,
3287 &mut out,
3288 )?;
3289 } else {
3290 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3291 }
3292 }
3293
3294 6 => {
3295 if let Some(device_categories) = &self.device_categories {
3296 ::fidl_next::WireEnvelope::encode_value(
3297 device_categories,
3298 preallocated.encoder,
3299 &mut out,
3300 )?;
3301 } else {
3302 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3303 }
3304 }
3305
3306 5 => {
3307 if let Some(is_fallback) = &self.is_fallback {
3308 ::fidl_next::WireEnvelope::encode_value(
3309 is_fallback,
3310 preallocated.encoder,
3311 &mut out,
3312 )?;
3313 } else {
3314 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3315 }
3316 }
3317
3318 4 => {
3319 if let Some(package_type) = &self.package_type {
3320 ::fidl_next::WireEnvelope::encode_value(
3321 package_type,
3322 preallocated.encoder,
3323 &mut out,
3324 )?;
3325 } else {
3326 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3327 }
3328 }
3329
3330 3 => {
3331 if let Some(colocate) = &self.colocate {
3332 ::fidl_next::WireEnvelope::encode_value(
3333 colocate,
3334 preallocated.encoder,
3335 &mut out,
3336 )?;
3337 } else {
3338 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3339 }
3340 }
3341
3342 2 => {
3343 if let Some(name) = &self.name {
3344 ::fidl_next::WireEnvelope::encode_value(
3345 name,
3346 preallocated.encoder,
3347 &mut out,
3348 )?;
3349 } else {
3350 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3351 }
3352 }
3353
3354 1 => {
3355 if let Some(url) = &self.url {
3356 ::fidl_next::WireEnvelope::encode_value(
3357 url,
3358 preallocated.encoder,
3359 &mut out,
3360 )?;
3361 } else {
3362 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3363 }
3364 }
3365
3366 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
3367 }
3368 unsafe {
3369 preallocated.write_next(out.assume_init_ref());
3370 }
3371 }
3372
3373 ::fidl_next::WireTable::encode_len(table, max_ord);
3374
3375 Ok(())
3376 }
3377}
3378
3379impl<'de> ::fidl_next::FromWire<WireDriverInfo<'de>> for DriverInfo {
3380 #[inline]
3381 fn from_wire(wire: WireDriverInfo<'de>) -> Self {
3382 let wire = ::core::mem::ManuallyDrop::new(wire);
3383
3384 let url = wire.table.get(1);
3385
3386 let name = wire.table.get(2);
3387
3388 let colocate = wire.table.get(3);
3389
3390 let package_type = wire.table.get(4);
3391
3392 let is_fallback = wire.table.get(5);
3393
3394 let device_categories = wire.table.get(6);
3395
3396 let bind_rules_bytecode = wire.table.get(7);
3397
3398 let driver_framework_version = wire.table.get(8);
3399
3400 let is_disabled = wire.table.get(9);
3401
3402 Self {
3403
3404
3405 url: url.map(|envelope| ::fidl_next::FromWire::from_wire(
3406 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
3407 )),
3408
3409
3410 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
3411 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
3412 )),
3413
3414
3415 colocate: colocate.map(|envelope| ::fidl_next::FromWire::from_wire(
3416 unsafe { envelope.read_unchecked::<bool>() }
3417 )),
3418
3419
3420 package_type: package_type.map(|envelope| ::fidl_next::FromWire::from_wire(
3421 unsafe { envelope.read_unchecked::<crate::WireDriverPackageType>() }
3422 )),
3423
3424
3425 is_fallback: is_fallback.map(|envelope| ::fidl_next::FromWire::from_wire(
3426 unsafe { envelope.read_unchecked::<bool>() }
3427 )),
3428
3429
3430 device_categories: device_categories.map(|envelope| ::fidl_next::FromWire::from_wire(
3431 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireDeviceCategory<'de>>>() }
3432 )),
3433
3434
3435 bind_rules_bytecode: bind_rules_bytecode.map(|envelope| ::fidl_next::FromWire::from_wire(
3436 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, u8>>() }
3437 )),
3438
3439
3440 driver_framework_version: driver_framework_version.map(|envelope| ::fidl_next::FromWire::from_wire(
3441 unsafe { envelope.read_unchecked::<u8>() }
3442 )),
3443
3444
3445 is_disabled: is_disabled.map(|envelope| ::fidl_next::FromWire::from_wire(
3446 unsafe { envelope.read_unchecked::<bool>() }
3447 )),
3448
3449 }
3450 }
3451}
3452
3453impl<'de> ::fidl_next::FromWireRef<WireDriverInfo<'de>> for DriverInfo {
3454 #[inline]
3455 fn from_wire_ref(wire: &WireDriverInfo<'de>) -> Self {
3456 Self {
3457
3458
3459 url: wire.table.get(1)
3460 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3461 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
3462 )),
3463
3464
3465 name: wire.table.get(2)
3466 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3467 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
3468 )),
3469
3470
3471 colocate: wire.table.get(3)
3472 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3473 unsafe { envelope.deref_unchecked::<bool>() }
3474 )),
3475
3476
3477 package_type: wire.table.get(4)
3478 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3479 unsafe { envelope.deref_unchecked::<crate::WireDriverPackageType>() }
3480 )),
3481
3482
3483 is_fallback: wire.table.get(5)
3484 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3485 unsafe { envelope.deref_unchecked::<bool>() }
3486 )),
3487
3488
3489 device_categories: wire.table.get(6)
3490 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3491 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireDeviceCategory<'de>>>() }
3492 )),
3493
3494
3495 bind_rules_bytecode: wire.table.get(7)
3496 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3497 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, u8>>() }
3498 )),
3499
3500
3501 driver_framework_version: wire.table.get(8)
3502 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3503 unsafe { envelope.deref_unchecked::<u8>() }
3504 )),
3505
3506
3507 is_disabled: wire.table.get(9)
3508 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3509 unsafe { envelope.deref_unchecked::<bool>() }
3510 )),
3511
3512 }
3513 }
3514}
3515
3516#[repr(C)]
3518pub struct WireDriverInfo<'de> {
3519 table: ::fidl_next::WireTable<'de>,
3520}
3521
3522impl<'de> Drop for WireDriverInfo<'de> {
3523 fn drop(&mut self) {
3524 let _ = self
3525 .table
3526 .get(1)
3527 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
3528
3529 let _ = self
3530 .table
3531 .get(2)
3532 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
3533
3534 let _ = self.table.get(3).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
3535
3536 let _ = self
3537 .table
3538 .get(4)
3539 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDriverPackageType>() });
3540
3541 let _ = self.table.get(5).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
3542
3543 let _ = self.table.get(6).map(|envelope| unsafe {
3544 envelope
3545 .read_unchecked::<::fidl_next::WireVector<'de, crate::WireDeviceCategory<'de>>>()
3546 });
3547
3548 let _ = self.table.get(7).map(|envelope| unsafe {
3549 envelope.read_unchecked::<::fidl_next::WireVector<'de, u8>>()
3550 });
3551
3552 let _ = self.table.get(8).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
3553
3554 let _ = self.table.get(9).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
3555 }
3556}
3557
3558unsafe impl ::fidl_next::Wire for WireDriverInfo<'static> {
3559 type Decoded<'de> = WireDriverInfo<'de>;
3560
3561 #[inline]
3562 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3563 ::fidl_next::munge!(let Self { table } = out);
3564 ::fidl_next::WireTable::zero_padding(table);
3565 }
3566}
3567
3568unsafe impl<___D> ::fidl_next::Decode<___D> for WireDriverInfo<'static>
3569where
3570 ___D: ::fidl_next::Decoder + ?Sized,
3571{
3572 fn decode(
3573 slot: ::fidl_next::Slot<'_, Self>,
3574 decoder: &mut ___D,
3575 ) -> Result<(), ::fidl_next::DecodeError> {
3576 ::fidl_next::munge!(let Self { table } = slot);
3577
3578 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3579 match ordinal {
3580 0 => unsafe { ::core::hint::unreachable_unchecked() },
3581
3582 1 => {
3583 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
3584 slot.as_mut(),
3585 decoder,
3586 )?;
3587
3588 let url = unsafe {
3589 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
3590 };
3591
3592 if url.len() > 4096 {
3593 return Err(::fidl_next::DecodeError::VectorTooLong {
3594 size: url.len() as u64,
3595 limit: 4096,
3596 });
3597 }
3598
3599 Ok(())
3600 }
3601
3602 2 => {
3603 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
3604 slot.as_mut(),
3605 decoder,
3606 )?;
3607
3608 Ok(())
3609 }
3610
3611 3 => {
3612 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
3613
3614 Ok(())
3615 }
3616
3617 4 => {
3618 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDriverPackageType>(
3619 slot.as_mut(),
3620 decoder,
3621 )?;
3622
3623 Ok(())
3624 }
3625
3626 5 => {
3627 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
3628
3629 Ok(())
3630 }
3631
3632 6 => {
3633 ::fidl_next::WireEnvelope::decode_as::<
3634 ___D,
3635 ::fidl_next::WireVector<'static, crate::WireDeviceCategory<'static>>,
3636 >(slot.as_mut(), decoder)?;
3637
3638 Ok(())
3639 }
3640
3641 7 => {
3642 ::fidl_next::WireEnvelope::decode_as::<
3643 ___D,
3644 ::fidl_next::WireVector<'static, u8>,
3645 >(slot.as_mut(), decoder)?;
3646
3647 Ok(())
3648 }
3649
3650 8 => {
3651 ::fidl_next::WireEnvelope::decode_as::<___D, u8>(slot.as_mut(), decoder)?;
3652
3653 Ok(())
3654 }
3655
3656 9 => {
3657 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
3658
3659 Ok(())
3660 }
3661
3662 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
3663 }
3664 })
3665 }
3666}
3667
3668impl<'de> WireDriverInfo<'de> {
3669 pub fn url(&self) -> Option<&::fidl_next::WireString<'de>> {
3670 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3671 }
3672
3673 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
3674 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3675 }
3676
3677 pub fn colocate(&self) -> Option<&bool> {
3678 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
3679 }
3680
3681 pub fn package_type(&self) -> Option<&crate::WireDriverPackageType> {
3682 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
3683 }
3684
3685 pub fn is_fallback(&self) -> Option<&bool> {
3686 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
3687 }
3688
3689 pub fn device_categories(
3690 &self,
3691 ) -> Option<&::fidl_next::WireVector<'de, crate::WireDeviceCategory<'de>>> {
3692 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
3693 }
3694
3695 pub fn bind_rules_bytecode(&self) -> Option<&::fidl_next::WireVector<'de, u8>> {
3696 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
3697 }
3698
3699 pub fn driver_framework_version(&self) -> Option<&u8> {
3700 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
3701 }
3702
3703 pub fn is_disabled(&self) -> Option<&bool> {
3704 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
3705 }
3706}
3707
3708impl<'de> ::core::fmt::Debug for WireDriverInfo<'de> {
3709 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
3710 f.debug_struct("DriverInfo")
3711 .field("url", &self.url())
3712 .field("name", &self.name())
3713 .field("colocate", &self.colocate())
3714 .field("package_type", &self.package_type())
3715 .field("is_fallback", &self.is_fallback())
3716 .field("device_categories", &self.device_categories())
3717 .field("bind_rules_bytecode", &self.bind_rules_bytecode())
3718 .field("driver_framework_version", &self.driver_framework_version())
3719 .field("is_disabled", &self.is_disabled())
3720 .finish()
3721 }
3722}
3723
3724#[doc = " Information for a composite driver.\n"]
3725#[derive(Clone, Debug, Default)]
3726pub struct CompositeDriverInfo {
3727 pub composite_name: Option<String>,
3728
3729 pub driver_info: Option<crate::DriverInfo>,
3730}
3731
3732impl CompositeDriverInfo {
3733 fn __max_ordinal(&self) -> usize {
3734 if self.composite_name.is_some() {
3735 return 1;
3736 }
3737
3738 if self.driver_info.is_some() {
3739 return 2;
3740 }
3741
3742 0
3743 }
3744}
3745
3746impl ::fidl_next::Encodable for CompositeDriverInfo {
3747 type Encoded = WireCompositeDriverInfo<'static>;
3748}
3749
3750unsafe impl<___E> ::fidl_next::Encode<___E> for CompositeDriverInfo
3751where
3752 ___E: ::fidl_next::Encoder + ?Sized,
3753{
3754 #[inline]
3755 fn encode(
3756 mut self,
3757 encoder: &mut ___E,
3758 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3759 ) -> Result<(), ::fidl_next::EncodeError> {
3760 ::fidl_next::munge!(let WireCompositeDriverInfo { table } = out);
3761
3762 let max_ord = self.__max_ordinal();
3763
3764 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
3765 ::fidl_next::Wire::zero_padding(&mut out);
3766
3767 let mut preallocated =
3768 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
3769
3770 for i in 1..=max_ord {
3771 match i {
3772 2 => {
3773 if let Some(driver_info) = self.driver_info.take() {
3774 ::fidl_next::WireEnvelope::encode_value(
3775 driver_info,
3776 preallocated.encoder,
3777 &mut out,
3778 )?;
3779 } else {
3780 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3781 }
3782 }
3783
3784 1 => {
3785 if let Some(composite_name) = self.composite_name.take() {
3786 ::fidl_next::WireEnvelope::encode_value(
3787 composite_name,
3788 preallocated.encoder,
3789 &mut out,
3790 )?;
3791 } else {
3792 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3793 }
3794 }
3795
3796 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
3797 }
3798 unsafe {
3799 preallocated.write_next(out.assume_init_ref());
3800 }
3801 }
3802
3803 ::fidl_next::WireTable::encode_len(table, max_ord);
3804
3805 Ok(())
3806 }
3807}
3808
3809unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CompositeDriverInfo
3810where
3811 ___E: ::fidl_next::Encoder + ?Sized,
3812{
3813 #[inline]
3814 fn encode_ref(
3815 &self,
3816 encoder: &mut ___E,
3817 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3818 ) -> Result<(), ::fidl_next::EncodeError> {
3819 ::fidl_next::munge!(let WireCompositeDriverInfo { table } = out);
3820
3821 let max_ord = self.__max_ordinal();
3822
3823 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
3824 ::fidl_next::Wire::zero_padding(&mut out);
3825
3826 let mut preallocated =
3827 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
3828
3829 for i in 1..=max_ord {
3830 match i {
3831 2 => {
3832 if let Some(driver_info) = &self.driver_info {
3833 ::fidl_next::WireEnvelope::encode_value(
3834 driver_info,
3835 preallocated.encoder,
3836 &mut out,
3837 )?;
3838 } else {
3839 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3840 }
3841 }
3842
3843 1 => {
3844 if let Some(composite_name) = &self.composite_name {
3845 ::fidl_next::WireEnvelope::encode_value(
3846 composite_name,
3847 preallocated.encoder,
3848 &mut out,
3849 )?;
3850 } else {
3851 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3852 }
3853 }
3854
3855 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
3856 }
3857 unsafe {
3858 preallocated.write_next(out.assume_init_ref());
3859 }
3860 }
3861
3862 ::fidl_next::WireTable::encode_len(table, max_ord);
3863
3864 Ok(())
3865 }
3866}
3867
3868impl<'de> ::fidl_next::FromWire<WireCompositeDriverInfo<'de>> for CompositeDriverInfo {
3869 #[inline]
3870 fn from_wire(wire: WireCompositeDriverInfo<'de>) -> Self {
3871 let wire = ::core::mem::ManuallyDrop::new(wire);
3872
3873 let composite_name = wire.table.get(1);
3874
3875 let driver_info = wire.table.get(2);
3876
3877 Self {
3878 composite_name: composite_name.map(|envelope| {
3879 ::fidl_next::FromWire::from_wire(unsafe {
3880 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
3881 })
3882 }),
3883
3884 driver_info: driver_info.map(|envelope| {
3885 ::fidl_next::FromWire::from_wire(unsafe {
3886 envelope.read_unchecked::<crate::WireDriverInfo<'de>>()
3887 })
3888 }),
3889 }
3890 }
3891}
3892
3893impl<'de> ::fidl_next::FromWireRef<WireCompositeDriverInfo<'de>> for CompositeDriverInfo {
3894 #[inline]
3895 fn from_wire_ref(wire: &WireCompositeDriverInfo<'de>) -> Self {
3896 Self {
3897 composite_name: wire.table.get(1).map(|envelope| {
3898 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
3899 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
3900 })
3901 }),
3902
3903 driver_info: wire.table.get(2).map(|envelope| {
3904 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
3905 envelope.deref_unchecked::<crate::WireDriverInfo<'de>>()
3906 })
3907 }),
3908 }
3909 }
3910}
3911
3912#[repr(C)]
3914pub struct WireCompositeDriverInfo<'de> {
3915 table: ::fidl_next::WireTable<'de>,
3916}
3917
3918impl<'de> Drop for WireCompositeDriverInfo<'de> {
3919 fn drop(&mut self) {
3920 let _ = self
3921 .table
3922 .get(1)
3923 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
3924
3925 let _ = self
3926 .table
3927 .get(2)
3928 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDriverInfo<'de>>() });
3929 }
3930}
3931
3932unsafe impl ::fidl_next::Wire for WireCompositeDriverInfo<'static> {
3933 type Decoded<'de> = WireCompositeDriverInfo<'de>;
3934
3935 #[inline]
3936 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3937 ::fidl_next::munge!(let Self { table } = out);
3938 ::fidl_next::WireTable::zero_padding(table);
3939 }
3940}
3941
3942unsafe impl<___D> ::fidl_next::Decode<___D> for WireCompositeDriverInfo<'static>
3943where
3944 ___D: ::fidl_next::Decoder + ?Sized,
3945{
3946 fn decode(
3947 slot: ::fidl_next::Slot<'_, Self>,
3948 decoder: &mut ___D,
3949 ) -> Result<(), ::fidl_next::DecodeError> {
3950 ::fidl_next::munge!(let Self { table } = slot);
3951
3952 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3953 match ordinal {
3954 0 => unsafe { ::core::hint::unreachable_unchecked() },
3955
3956 1 => {
3957 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
3958 slot.as_mut(),
3959 decoder,
3960 )?;
3961
3962 Ok(())
3963 }
3964
3965 2 => {
3966 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDriverInfo<'static>>(
3967 slot.as_mut(),
3968 decoder,
3969 )?;
3970
3971 Ok(())
3972 }
3973
3974 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
3975 }
3976 })
3977 }
3978}
3979
3980impl<'de> WireCompositeDriverInfo<'de> {
3981 pub fn composite_name(&self) -> Option<&::fidl_next::WireString<'de>> {
3982 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3983 }
3984
3985 pub fn driver_info(&self) -> Option<&crate::WireDriverInfo<'de>> {
3986 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3987 }
3988}
3989
3990impl<'de> ::core::fmt::Debug for WireCompositeDriverInfo<'de> {
3991 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
3992 f.debug_struct("CompositeDriverInfo")
3993 .field("composite_name", &self.composite_name())
3994 .field("driver_info", &self.driver_info())
3995 .finish()
3996 }
3997}
3998
3999#[doc = " Information for a composite driver that has matched with a composite.\n"]
4000#[derive(Clone, Debug, Default)]
4001pub struct CompositeDriverMatch {
4002 pub composite_driver: Option<crate::CompositeDriverInfo>,
4003
4004 pub parent_names: Option<Vec<String>>,
4005
4006 pub primary_parent_index: Option<u32>,
4007}
4008
4009impl CompositeDriverMatch {
4010 fn __max_ordinal(&self) -> usize {
4011 if self.composite_driver.is_some() {
4012 return 1;
4013 }
4014
4015 if self.parent_names.is_some() {
4016 return 2;
4017 }
4018
4019 if self.primary_parent_index.is_some() {
4020 return 3;
4021 }
4022
4023 0
4024 }
4025}
4026
4027impl ::fidl_next::Encodable for CompositeDriverMatch {
4028 type Encoded = WireCompositeDriverMatch<'static>;
4029}
4030
4031unsafe impl<___E> ::fidl_next::Encode<___E> for CompositeDriverMatch
4032where
4033 ___E: ::fidl_next::Encoder + ?Sized,
4034{
4035 #[inline]
4036 fn encode(
4037 mut self,
4038 encoder: &mut ___E,
4039 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4040 ) -> Result<(), ::fidl_next::EncodeError> {
4041 ::fidl_next::munge!(let WireCompositeDriverMatch { table } = out);
4042
4043 let max_ord = self.__max_ordinal();
4044
4045 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
4046 ::fidl_next::Wire::zero_padding(&mut out);
4047
4048 let mut preallocated =
4049 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
4050
4051 for i in 1..=max_ord {
4052 match i {
4053 3 => {
4054 if let Some(primary_parent_index) = self.primary_parent_index.take() {
4055 ::fidl_next::WireEnvelope::encode_value(
4056 primary_parent_index,
4057 preallocated.encoder,
4058 &mut out,
4059 )?;
4060 } else {
4061 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4062 }
4063 }
4064
4065 2 => {
4066 if let Some(parent_names) = self.parent_names.take() {
4067 ::fidl_next::WireEnvelope::encode_value(
4068 parent_names,
4069 preallocated.encoder,
4070 &mut out,
4071 )?;
4072 } else {
4073 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4074 }
4075 }
4076
4077 1 => {
4078 if let Some(composite_driver) = self.composite_driver.take() {
4079 ::fidl_next::WireEnvelope::encode_value(
4080 composite_driver,
4081 preallocated.encoder,
4082 &mut out,
4083 )?;
4084 } else {
4085 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4086 }
4087 }
4088
4089 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
4090 }
4091 unsafe {
4092 preallocated.write_next(out.assume_init_ref());
4093 }
4094 }
4095
4096 ::fidl_next::WireTable::encode_len(table, max_ord);
4097
4098 Ok(())
4099 }
4100}
4101
4102unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CompositeDriverMatch
4103where
4104 ___E: ::fidl_next::Encoder + ?Sized,
4105{
4106 #[inline]
4107 fn encode_ref(
4108 &self,
4109 encoder: &mut ___E,
4110 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4111 ) -> Result<(), ::fidl_next::EncodeError> {
4112 ::fidl_next::munge!(let WireCompositeDriverMatch { table } = out);
4113
4114 let max_ord = self.__max_ordinal();
4115
4116 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
4117 ::fidl_next::Wire::zero_padding(&mut out);
4118
4119 let mut preallocated =
4120 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
4121
4122 for i in 1..=max_ord {
4123 match i {
4124 3 => {
4125 if let Some(primary_parent_index) = &self.primary_parent_index {
4126 ::fidl_next::WireEnvelope::encode_value(
4127 primary_parent_index,
4128 preallocated.encoder,
4129 &mut out,
4130 )?;
4131 } else {
4132 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4133 }
4134 }
4135
4136 2 => {
4137 if let Some(parent_names) = &self.parent_names {
4138 ::fidl_next::WireEnvelope::encode_value(
4139 parent_names,
4140 preallocated.encoder,
4141 &mut out,
4142 )?;
4143 } else {
4144 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4145 }
4146 }
4147
4148 1 => {
4149 if let Some(composite_driver) = &self.composite_driver {
4150 ::fidl_next::WireEnvelope::encode_value(
4151 composite_driver,
4152 preallocated.encoder,
4153 &mut out,
4154 )?;
4155 } else {
4156 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4157 }
4158 }
4159
4160 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
4161 }
4162 unsafe {
4163 preallocated.write_next(out.assume_init_ref());
4164 }
4165 }
4166
4167 ::fidl_next::WireTable::encode_len(table, max_ord);
4168
4169 Ok(())
4170 }
4171}
4172
4173impl<'de> ::fidl_next::FromWire<WireCompositeDriverMatch<'de>> for CompositeDriverMatch {
4174 #[inline]
4175 fn from_wire(wire: WireCompositeDriverMatch<'de>) -> Self {
4176 let wire = ::core::mem::ManuallyDrop::new(wire);
4177
4178 let composite_driver = wire.table.get(1);
4179
4180 let parent_names = wire.table.get(2);
4181
4182 let primary_parent_index = wire.table.get(3);
4183
4184 Self {
4185
4186
4187 composite_driver: composite_driver.map(|envelope| ::fidl_next::FromWire::from_wire(
4188 unsafe { envelope.read_unchecked::<crate::WireCompositeDriverInfo<'de>>() }
4189 )),
4190
4191
4192 parent_names: parent_names.map(|envelope| ::fidl_next::FromWire::from_wire(
4193 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() }
4194 )),
4195
4196
4197 primary_parent_index: primary_parent_index.map(|envelope| ::fidl_next::FromWire::from_wire(
4198 unsafe { envelope.read_unchecked::<::fidl_next::WireU32>() }
4199 )),
4200
4201 }
4202 }
4203}
4204
4205impl<'de> ::fidl_next::FromWireRef<WireCompositeDriverMatch<'de>> for CompositeDriverMatch {
4206 #[inline]
4207 fn from_wire_ref(wire: &WireCompositeDriverMatch<'de>) -> Self {
4208 Self {
4209
4210
4211 composite_driver: wire.table.get(1)
4212 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
4213 unsafe { envelope.deref_unchecked::<crate::WireCompositeDriverInfo<'de>>() }
4214 )),
4215
4216
4217 parent_names: wire.table.get(2)
4218 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
4219 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() }
4220 )),
4221
4222
4223 primary_parent_index: wire.table.get(3)
4224 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
4225 unsafe { envelope.deref_unchecked::<::fidl_next::WireU32>() }
4226 )),
4227
4228 }
4229 }
4230}
4231
4232#[repr(C)]
4234pub struct WireCompositeDriverMatch<'de> {
4235 table: ::fidl_next::WireTable<'de>,
4236}
4237
4238impl<'de> Drop for WireCompositeDriverMatch<'de> {
4239 fn drop(&mut self) {
4240 let _ = self.table.get(1).map(|envelope| unsafe {
4241 envelope.read_unchecked::<crate::WireCompositeDriverInfo<'de>>()
4242 });
4243
4244 let _ = self.table.get(2).map(|envelope| unsafe {
4245 envelope.read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
4246 });
4247
4248 let _ = self
4249 .table
4250 .get(3)
4251 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireU32>() });
4252 }
4253}
4254
4255unsafe impl ::fidl_next::Wire for WireCompositeDriverMatch<'static> {
4256 type Decoded<'de> = WireCompositeDriverMatch<'de>;
4257
4258 #[inline]
4259 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4260 ::fidl_next::munge!(let Self { table } = out);
4261 ::fidl_next::WireTable::zero_padding(table);
4262 }
4263}
4264
4265unsafe impl<___D> ::fidl_next::Decode<___D> for WireCompositeDriverMatch<'static>
4266where
4267 ___D: ::fidl_next::Decoder + ?Sized,
4268{
4269 fn decode(
4270 slot: ::fidl_next::Slot<'_, Self>,
4271 decoder: &mut ___D,
4272 ) -> Result<(), ::fidl_next::DecodeError> {
4273 ::fidl_next::munge!(let Self { table } = slot);
4274
4275 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4276 match ordinal {
4277 0 => unsafe { ::core::hint::unreachable_unchecked() },
4278
4279 1 => {
4280 ::fidl_next::WireEnvelope::decode_as::<
4281 ___D,
4282 crate::WireCompositeDriverInfo<'static>,
4283 >(slot.as_mut(), decoder)?;
4284
4285 Ok(())
4286 }
4287
4288 2 => {
4289 ::fidl_next::WireEnvelope::decode_as::<
4290 ___D,
4291 ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
4292 >(slot.as_mut(), decoder)?;
4293
4294 Ok(())
4295 }
4296
4297 3 => {
4298 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireU32>(
4299 slot.as_mut(),
4300 decoder,
4301 )?;
4302
4303 Ok(())
4304 }
4305
4306 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
4307 }
4308 })
4309 }
4310}
4311
4312impl<'de> WireCompositeDriverMatch<'de> {
4313 pub fn composite_driver(&self) -> Option<&crate::WireCompositeDriverInfo<'de>> {
4314 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4315 }
4316
4317 pub fn parent_names(
4318 &self,
4319 ) -> Option<&::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>> {
4320 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4321 }
4322
4323 pub fn primary_parent_index(&self) -> Option<&::fidl_next::WireU32> {
4324 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
4325 }
4326}
4327
4328impl<'de> ::core::fmt::Debug for WireCompositeDriverMatch<'de> {
4329 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
4330 f.debug_struct("CompositeDriverMatch")
4331 .field("composite_driver", &self.composite_driver())
4332 .field("parent_names", &self.parent_names())
4333 .field("primary_parent_index", &self.primary_parent_index())
4334 .finish()
4335 }
4336}
4337
4338#[doc = " Definition of a property for a node. A property is commonly used to match a\n node to a driver for driver binding.\n"]
4339#[derive(Clone, Debug)]
4340pub struct NodeProperty {
4341 pub key: crate::NodePropertyKey,
4342
4343 pub value: crate::NodePropertyValue,
4344}
4345
4346impl ::fidl_next::Encodable for NodeProperty {
4347 type Encoded = WireNodeProperty<'static>;
4348}
4349
4350unsafe impl<___E> ::fidl_next::Encode<___E> for NodeProperty
4351where
4352 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4353
4354 ___E: ::fidl_next::Encoder,
4355{
4356 #[inline]
4357 fn encode(
4358 self,
4359 encoder: &mut ___E,
4360 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4361 ) -> Result<(), ::fidl_next::EncodeError> {
4362 ::fidl_next::munge! {
4363 let Self::Encoded {
4364 key,
4365 value,
4366
4367 } = out;
4368 }
4369
4370 ::fidl_next::Encode::encode(self.key, encoder, key)?;
4371
4372 ::fidl_next::Encode::encode(self.value, encoder, value)?;
4373
4374 Ok(())
4375 }
4376}
4377
4378unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodeProperty
4379where
4380 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4381
4382 ___E: ::fidl_next::Encoder,
4383{
4384 #[inline]
4385 fn encode_ref(
4386 &self,
4387 encoder: &mut ___E,
4388 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4389 ) -> Result<(), ::fidl_next::EncodeError> {
4390 ::fidl_next::munge! {
4391 let Self::Encoded {
4392 key,
4393 value,
4394
4395 } = out;
4396 }
4397
4398 ::fidl_next::EncodeRef::encode_ref(&self.key, encoder, key)?;
4399
4400 ::fidl_next::EncodeRef::encode_ref(&self.value, encoder, value)?;
4401
4402 Ok(())
4403 }
4404}
4405
4406impl ::fidl_next::EncodableOption for NodeProperty {
4407 type EncodedOption = ::fidl_next::WireBox<'static, WireNodeProperty<'static>>;
4408}
4409
4410unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NodeProperty
4411where
4412 ___E: ::fidl_next::Encoder + ?Sized,
4413 NodeProperty: ::fidl_next::Encode<___E>,
4414{
4415 #[inline]
4416 fn encode_option(
4417 this: Option<Self>,
4418 encoder: &mut ___E,
4419 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4420 ) -> Result<(), ::fidl_next::EncodeError> {
4421 if let Some(inner) = this {
4422 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
4423 ::fidl_next::WireBox::encode_present(out);
4424 } else {
4425 ::fidl_next::WireBox::encode_absent(out);
4426 }
4427
4428 Ok(())
4429 }
4430}
4431
4432unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for NodeProperty
4433where
4434 ___E: ::fidl_next::Encoder + ?Sized,
4435 NodeProperty: ::fidl_next::EncodeRef<___E>,
4436{
4437 #[inline]
4438 fn encode_option_ref(
4439 this: Option<&Self>,
4440 encoder: &mut ___E,
4441 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4442 ) -> Result<(), ::fidl_next::EncodeError> {
4443 if let Some(inner) = this {
4444 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
4445 ::fidl_next::WireBox::encode_present(out);
4446 } else {
4447 ::fidl_next::WireBox::encode_absent(out);
4448 }
4449
4450 Ok(())
4451 }
4452}
4453
4454impl<'de> ::fidl_next::FromWire<WireNodeProperty<'de>> for NodeProperty {
4455 #[inline]
4456 fn from_wire(wire: WireNodeProperty<'de>) -> Self {
4457 Self {
4458 key: ::fidl_next::FromWire::from_wire(wire.key),
4459
4460 value: ::fidl_next::FromWire::from_wire(wire.value),
4461 }
4462 }
4463}
4464
4465impl<'de> ::fidl_next::FromWireRef<WireNodeProperty<'de>> for NodeProperty {
4466 #[inline]
4467 fn from_wire_ref(wire: &WireNodeProperty<'de>) -> Self {
4468 Self {
4469 key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
4470
4471 value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value),
4472 }
4473 }
4474}
4475
4476#[derive(Debug)]
4478#[repr(C)]
4479pub struct WireNodeProperty<'de> {
4480 pub key: crate::WireNodePropertyKey<'de>,
4481
4482 pub value: crate::WireNodePropertyValue<'de>,
4483}
4484
4485unsafe impl ::fidl_next::Wire for WireNodeProperty<'static> {
4486 type Decoded<'de> = WireNodeProperty<'de>;
4487
4488 #[inline]
4489 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
4490}
4491
4492unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeProperty<'static>
4493where
4494 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4495
4496 ___D: ::fidl_next::Decoder,
4497{
4498 fn decode(
4499 slot: ::fidl_next::Slot<'_, Self>,
4500 decoder: &mut ___D,
4501 ) -> Result<(), ::fidl_next::DecodeError> {
4502 ::fidl_next::munge! {
4503 let Self {
4504 mut key,
4505 mut value,
4506
4507 } = slot;
4508 }
4509
4510 ::fidl_next::Decode::decode(key.as_mut(), decoder)?;
4511
4512 ::fidl_next::Decode::decode(value.as_mut(), decoder)?;
4513
4514 Ok(())
4515 }
4516}
4517
4518#[doc = " Specification for a node that parents the composite node created from the\n composite node specification.\n"]
4519#[derive(Clone, Debug)]
4520pub struct ParentSpec {
4521 pub bind_rules: Vec<crate::BindRule>,
4522
4523 pub properties: Vec<crate::NodeProperty>,
4524}
4525
4526impl ::fidl_next::Encodable for ParentSpec {
4527 type Encoded = WireParentSpec<'static>;
4528}
4529
4530unsafe impl<___E> ::fidl_next::Encode<___E> for ParentSpec
4531where
4532 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4533
4534 ___E: ::fidl_next::Encoder,
4535{
4536 #[inline]
4537 fn encode(
4538 self,
4539 encoder: &mut ___E,
4540 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4541 ) -> Result<(), ::fidl_next::EncodeError> {
4542 ::fidl_next::munge! {
4543 let Self::Encoded {
4544 bind_rules,
4545 properties,
4546
4547 } = out;
4548 }
4549
4550 ::fidl_next::Encode::encode(self.bind_rules, encoder, bind_rules)?;
4551
4552 ::fidl_next::Encode::encode(self.properties, encoder, properties)?;
4553
4554 Ok(())
4555 }
4556}
4557
4558unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ParentSpec
4559where
4560 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4561
4562 ___E: ::fidl_next::Encoder,
4563{
4564 #[inline]
4565 fn encode_ref(
4566 &self,
4567 encoder: &mut ___E,
4568 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4569 ) -> Result<(), ::fidl_next::EncodeError> {
4570 ::fidl_next::munge! {
4571 let Self::Encoded {
4572 bind_rules,
4573 properties,
4574
4575 } = out;
4576 }
4577
4578 ::fidl_next::EncodeRef::encode_ref(&self.bind_rules, encoder, bind_rules)?;
4579
4580 ::fidl_next::EncodeRef::encode_ref(&self.properties, encoder, properties)?;
4581
4582 Ok(())
4583 }
4584}
4585
4586impl ::fidl_next::EncodableOption for ParentSpec {
4587 type EncodedOption = ::fidl_next::WireBox<'static, WireParentSpec<'static>>;
4588}
4589
4590unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ParentSpec
4591where
4592 ___E: ::fidl_next::Encoder + ?Sized,
4593 ParentSpec: ::fidl_next::Encode<___E>,
4594{
4595 #[inline]
4596 fn encode_option(
4597 this: Option<Self>,
4598 encoder: &mut ___E,
4599 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4600 ) -> Result<(), ::fidl_next::EncodeError> {
4601 if let Some(inner) = this {
4602 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
4603 ::fidl_next::WireBox::encode_present(out);
4604 } else {
4605 ::fidl_next::WireBox::encode_absent(out);
4606 }
4607
4608 Ok(())
4609 }
4610}
4611
4612unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ParentSpec
4613where
4614 ___E: ::fidl_next::Encoder + ?Sized,
4615 ParentSpec: ::fidl_next::EncodeRef<___E>,
4616{
4617 #[inline]
4618 fn encode_option_ref(
4619 this: Option<&Self>,
4620 encoder: &mut ___E,
4621 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4622 ) -> Result<(), ::fidl_next::EncodeError> {
4623 if let Some(inner) = this {
4624 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
4625 ::fidl_next::WireBox::encode_present(out);
4626 } else {
4627 ::fidl_next::WireBox::encode_absent(out);
4628 }
4629
4630 Ok(())
4631 }
4632}
4633
4634impl<'de> ::fidl_next::FromWire<WireParentSpec<'de>> for ParentSpec {
4635 #[inline]
4636 fn from_wire(wire: WireParentSpec<'de>) -> Self {
4637 Self {
4638 bind_rules: ::fidl_next::FromWire::from_wire(wire.bind_rules),
4639
4640 properties: ::fidl_next::FromWire::from_wire(wire.properties),
4641 }
4642 }
4643}
4644
4645impl<'de> ::fidl_next::FromWireRef<WireParentSpec<'de>> for ParentSpec {
4646 #[inline]
4647 fn from_wire_ref(wire: &WireParentSpec<'de>) -> Self {
4648 Self {
4649 bind_rules: ::fidl_next::FromWireRef::from_wire_ref(&wire.bind_rules),
4650
4651 properties: ::fidl_next::FromWireRef::from_wire_ref(&wire.properties),
4652 }
4653 }
4654}
4655
4656#[derive(Debug)]
4658#[repr(C)]
4659pub struct WireParentSpec<'de> {
4660 pub bind_rules: ::fidl_next::WireVector<'de, crate::WireBindRule<'de>>,
4661
4662 pub properties: ::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>,
4663}
4664
4665unsafe impl ::fidl_next::Wire for WireParentSpec<'static> {
4666 type Decoded<'de> = WireParentSpec<'de>;
4667
4668 #[inline]
4669 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
4670}
4671
4672unsafe impl<___D> ::fidl_next::Decode<___D> for WireParentSpec<'static>
4673where
4674 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4675
4676 ___D: ::fidl_next::Decoder,
4677{
4678 fn decode(
4679 slot: ::fidl_next::Slot<'_, Self>,
4680 decoder: &mut ___D,
4681 ) -> Result<(), ::fidl_next::DecodeError> {
4682 ::fidl_next::munge! {
4683 let Self {
4684 mut bind_rules,
4685 mut properties,
4686
4687 } = slot;
4688 }
4689
4690 ::fidl_next::Decode::decode(bind_rules.as_mut(), decoder)?;
4691
4692 let bind_rules = unsafe { bind_rules.deref_unchecked() };
4693
4694 if bind_rules.len() > 64 {
4695 return Err(::fidl_next::DecodeError::VectorTooLong {
4696 size: bind_rules.len() as u64,
4697 limit: 64,
4698 });
4699 }
4700
4701 ::fidl_next::Decode::decode(properties.as_mut(), decoder)?;
4702
4703 let properties = unsafe { properties.deref_unchecked() };
4704
4705 if properties.len() > 64 {
4706 return Err(::fidl_next::DecodeError::VectorTooLong {
4707 size: properties.len() as u64,
4708 limit: 64,
4709 });
4710 }
4711
4712 Ok(())
4713 }
4714}
4715
4716#[derive(Clone, Debug)]
4717pub struct NodeProperty2 {
4718 pub key: String,
4719
4720 pub value: crate::NodePropertyValue,
4721}
4722
4723impl ::fidl_next::Encodable for NodeProperty2 {
4724 type Encoded = WireNodeProperty2<'static>;
4725}
4726
4727unsafe impl<___E> ::fidl_next::Encode<___E> for NodeProperty2
4728where
4729 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4730
4731 ___E: ::fidl_next::Encoder,
4732{
4733 #[inline]
4734 fn encode(
4735 self,
4736 encoder: &mut ___E,
4737 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4738 ) -> Result<(), ::fidl_next::EncodeError> {
4739 ::fidl_next::munge! {
4740 let Self::Encoded {
4741 key,
4742 value,
4743
4744 } = out;
4745 }
4746
4747 ::fidl_next::Encode::encode(self.key, encoder, key)?;
4748
4749 ::fidl_next::Encode::encode(self.value, encoder, value)?;
4750
4751 Ok(())
4752 }
4753}
4754
4755unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodeProperty2
4756where
4757 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4758
4759 ___E: ::fidl_next::Encoder,
4760{
4761 #[inline]
4762 fn encode_ref(
4763 &self,
4764 encoder: &mut ___E,
4765 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4766 ) -> Result<(), ::fidl_next::EncodeError> {
4767 ::fidl_next::munge! {
4768 let Self::Encoded {
4769 key,
4770 value,
4771
4772 } = out;
4773 }
4774
4775 ::fidl_next::EncodeRef::encode_ref(&self.key, encoder, key)?;
4776
4777 ::fidl_next::EncodeRef::encode_ref(&self.value, encoder, value)?;
4778
4779 Ok(())
4780 }
4781}
4782
4783impl ::fidl_next::EncodableOption for NodeProperty2 {
4784 type EncodedOption = ::fidl_next::WireBox<'static, WireNodeProperty2<'static>>;
4785}
4786
4787unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NodeProperty2
4788where
4789 ___E: ::fidl_next::Encoder + ?Sized,
4790 NodeProperty2: ::fidl_next::Encode<___E>,
4791{
4792 #[inline]
4793 fn encode_option(
4794 this: Option<Self>,
4795 encoder: &mut ___E,
4796 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4797 ) -> Result<(), ::fidl_next::EncodeError> {
4798 if let Some(inner) = this {
4799 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
4800 ::fidl_next::WireBox::encode_present(out);
4801 } else {
4802 ::fidl_next::WireBox::encode_absent(out);
4803 }
4804
4805 Ok(())
4806 }
4807}
4808
4809unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for NodeProperty2
4810where
4811 ___E: ::fidl_next::Encoder + ?Sized,
4812 NodeProperty2: ::fidl_next::EncodeRef<___E>,
4813{
4814 #[inline]
4815 fn encode_option_ref(
4816 this: Option<&Self>,
4817 encoder: &mut ___E,
4818 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4819 ) -> Result<(), ::fidl_next::EncodeError> {
4820 if let Some(inner) = this {
4821 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
4822 ::fidl_next::WireBox::encode_present(out);
4823 } else {
4824 ::fidl_next::WireBox::encode_absent(out);
4825 }
4826
4827 Ok(())
4828 }
4829}
4830
4831impl<'de> ::fidl_next::FromWire<WireNodeProperty2<'de>> for NodeProperty2 {
4832 #[inline]
4833 fn from_wire(wire: WireNodeProperty2<'de>) -> Self {
4834 Self {
4835 key: ::fidl_next::FromWire::from_wire(wire.key),
4836
4837 value: ::fidl_next::FromWire::from_wire(wire.value),
4838 }
4839 }
4840}
4841
4842impl<'de> ::fidl_next::FromWireRef<WireNodeProperty2<'de>> for NodeProperty2 {
4843 #[inline]
4844 fn from_wire_ref(wire: &WireNodeProperty2<'de>) -> Self {
4845 Self {
4846 key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
4847
4848 value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value),
4849 }
4850 }
4851}
4852
4853#[derive(Debug)]
4855#[repr(C)]
4856pub struct WireNodeProperty2<'de> {
4857 pub key: ::fidl_next::WireString<'de>,
4858
4859 pub value: crate::WireNodePropertyValue<'de>,
4860}
4861
4862unsafe impl ::fidl_next::Wire for WireNodeProperty2<'static> {
4863 type Decoded<'de> = WireNodeProperty2<'de>;
4864
4865 #[inline]
4866 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
4867}
4868
4869unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeProperty2<'static>
4870where
4871 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4872
4873 ___D: ::fidl_next::Decoder,
4874{
4875 fn decode(
4876 slot: ::fidl_next::Slot<'_, Self>,
4877 decoder: &mut ___D,
4878 ) -> Result<(), ::fidl_next::DecodeError> {
4879 ::fidl_next::munge! {
4880 let Self {
4881 mut key,
4882 mut value,
4883
4884 } = slot;
4885 }
4886
4887 ::fidl_next::Decode::decode(key.as_mut(), decoder)?;
4888
4889 let key = unsafe { key.deref_unchecked() };
4890
4891 if key.len() > 256 {
4892 return Err(::fidl_next::DecodeError::VectorTooLong {
4893 size: key.len() as u64,
4894 limit: 256,
4895 });
4896 }
4897
4898 ::fidl_next::Decode::decode(value.as_mut(), decoder)?;
4899
4900 Ok(())
4901 }
4902}
4903
4904#[doc = " Specification for a node that parents the composite node created from the\n composite node specification.\n"]
4905#[derive(Clone, Debug)]
4906pub struct ParentSpec2 {
4907 pub bind_rules: Vec<crate::BindRule2>,
4908
4909 pub properties: Vec<crate::NodeProperty2>,
4910}
4911
4912impl ::fidl_next::Encodable for ParentSpec2 {
4913 type Encoded = WireParentSpec2<'static>;
4914}
4915
4916unsafe impl<___E> ::fidl_next::Encode<___E> for ParentSpec2
4917where
4918 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4919
4920 ___E: ::fidl_next::Encoder,
4921{
4922 #[inline]
4923 fn encode(
4924 self,
4925 encoder: &mut ___E,
4926 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4927 ) -> Result<(), ::fidl_next::EncodeError> {
4928 ::fidl_next::munge! {
4929 let Self::Encoded {
4930 bind_rules,
4931 properties,
4932
4933 } = out;
4934 }
4935
4936 ::fidl_next::Encode::encode(self.bind_rules, encoder, bind_rules)?;
4937
4938 ::fidl_next::Encode::encode(self.properties, encoder, properties)?;
4939
4940 Ok(())
4941 }
4942}
4943
4944unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ParentSpec2
4945where
4946 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4947
4948 ___E: ::fidl_next::Encoder,
4949{
4950 #[inline]
4951 fn encode_ref(
4952 &self,
4953 encoder: &mut ___E,
4954 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4955 ) -> Result<(), ::fidl_next::EncodeError> {
4956 ::fidl_next::munge! {
4957 let Self::Encoded {
4958 bind_rules,
4959 properties,
4960
4961 } = out;
4962 }
4963
4964 ::fidl_next::EncodeRef::encode_ref(&self.bind_rules, encoder, bind_rules)?;
4965
4966 ::fidl_next::EncodeRef::encode_ref(&self.properties, encoder, properties)?;
4967
4968 Ok(())
4969 }
4970}
4971
4972impl ::fidl_next::EncodableOption for ParentSpec2 {
4973 type EncodedOption = ::fidl_next::WireBox<'static, WireParentSpec2<'static>>;
4974}
4975
4976unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ParentSpec2
4977where
4978 ___E: ::fidl_next::Encoder + ?Sized,
4979 ParentSpec2: ::fidl_next::Encode<___E>,
4980{
4981 #[inline]
4982 fn encode_option(
4983 this: Option<Self>,
4984 encoder: &mut ___E,
4985 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4986 ) -> Result<(), ::fidl_next::EncodeError> {
4987 if let Some(inner) = this {
4988 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
4989 ::fidl_next::WireBox::encode_present(out);
4990 } else {
4991 ::fidl_next::WireBox::encode_absent(out);
4992 }
4993
4994 Ok(())
4995 }
4996}
4997
4998unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ParentSpec2
4999where
5000 ___E: ::fidl_next::Encoder + ?Sized,
5001 ParentSpec2: ::fidl_next::EncodeRef<___E>,
5002{
5003 #[inline]
5004 fn encode_option_ref(
5005 this: Option<&Self>,
5006 encoder: &mut ___E,
5007 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
5008 ) -> Result<(), ::fidl_next::EncodeError> {
5009 if let Some(inner) = this {
5010 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
5011 ::fidl_next::WireBox::encode_present(out);
5012 } else {
5013 ::fidl_next::WireBox::encode_absent(out);
5014 }
5015
5016 Ok(())
5017 }
5018}
5019
5020impl<'de> ::fidl_next::FromWire<WireParentSpec2<'de>> for ParentSpec2 {
5021 #[inline]
5022 fn from_wire(wire: WireParentSpec2<'de>) -> Self {
5023 Self {
5024 bind_rules: ::fidl_next::FromWire::from_wire(wire.bind_rules),
5025
5026 properties: ::fidl_next::FromWire::from_wire(wire.properties),
5027 }
5028 }
5029}
5030
5031impl<'de> ::fidl_next::FromWireRef<WireParentSpec2<'de>> for ParentSpec2 {
5032 #[inline]
5033 fn from_wire_ref(wire: &WireParentSpec2<'de>) -> Self {
5034 Self {
5035 bind_rules: ::fidl_next::FromWireRef::from_wire_ref(&wire.bind_rules),
5036
5037 properties: ::fidl_next::FromWireRef::from_wire_ref(&wire.properties),
5038 }
5039 }
5040}
5041
5042#[derive(Debug)]
5044#[repr(C)]
5045pub struct WireParentSpec2<'de> {
5046 pub bind_rules: ::fidl_next::WireVector<'de, crate::WireBindRule2<'de>>,
5047
5048 pub properties: ::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>,
5049}
5050
5051unsafe impl ::fidl_next::Wire for WireParentSpec2<'static> {
5052 type Decoded<'de> = WireParentSpec2<'de>;
5053
5054 #[inline]
5055 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
5056}
5057
5058unsafe impl<___D> ::fidl_next::Decode<___D> for WireParentSpec2<'static>
5059where
5060 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5061
5062 ___D: ::fidl_next::Decoder,
5063{
5064 fn decode(
5065 slot: ::fidl_next::Slot<'_, Self>,
5066 decoder: &mut ___D,
5067 ) -> Result<(), ::fidl_next::DecodeError> {
5068 ::fidl_next::munge! {
5069 let Self {
5070 mut bind_rules,
5071 mut properties,
5072
5073 } = slot;
5074 }
5075
5076 ::fidl_next::Decode::decode(bind_rules.as_mut(), decoder)?;
5077
5078 let bind_rules = unsafe { bind_rules.deref_unchecked() };
5079
5080 if bind_rules.len() > 64 {
5081 return Err(::fidl_next::DecodeError::VectorTooLong {
5082 size: bind_rules.len() as u64,
5083 limit: 64,
5084 });
5085 }
5086
5087 ::fidl_next::Decode::decode(properties.as_mut(), decoder)?;
5088
5089 let properties = unsafe { properties.deref_unchecked() };
5090
5091 if properties.len() > 64 {
5092 return Err(::fidl_next::DecodeError::VectorTooLong {
5093 size: properties.len() as u64,
5094 limit: 64,
5095 });
5096 }
5097
5098 Ok(())
5099 }
5100}
5101
5102#[doc = " Struct that represents a composite node specification.\n"]
5103#[derive(Clone, Debug, Default)]
5104pub struct CompositeNodeSpec {
5105 pub name: Option<String>,
5106
5107 pub parents: Option<Vec<crate::ParentSpec>>,
5108
5109 pub parents2: Option<Vec<crate::ParentSpec2>>,
5110}
5111
5112impl CompositeNodeSpec {
5113 fn __max_ordinal(&self) -> usize {
5114 if self.name.is_some() {
5115 return 1;
5116 }
5117
5118 if self.parents.is_some() {
5119 return 2;
5120 }
5121
5122 if self.parents2.is_some() {
5123 return 3;
5124 }
5125
5126 0
5127 }
5128}
5129
5130impl ::fidl_next::Encodable for CompositeNodeSpec {
5131 type Encoded = WireCompositeNodeSpec<'static>;
5132}
5133
5134unsafe impl<___E> ::fidl_next::Encode<___E> for CompositeNodeSpec
5135where
5136 ___E: ::fidl_next::Encoder + ?Sized,
5137{
5138 #[inline]
5139 fn encode(
5140 mut self,
5141 encoder: &mut ___E,
5142 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5143 ) -> Result<(), ::fidl_next::EncodeError> {
5144 ::fidl_next::munge!(let WireCompositeNodeSpec { table } = out);
5145
5146 let max_ord = self.__max_ordinal();
5147
5148 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5149 ::fidl_next::Wire::zero_padding(&mut out);
5150
5151 let mut preallocated =
5152 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5153
5154 for i in 1..=max_ord {
5155 match i {
5156 3 => {
5157 if let Some(parents2) = self.parents2.take() {
5158 ::fidl_next::WireEnvelope::encode_value(
5159 parents2,
5160 preallocated.encoder,
5161 &mut out,
5162 )?;
5163 } else {
5164 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5165 }
5166 }
5167
5168 2 => {
5169 if let Some(parents) = self.parents.take() {
5170 ::fidl_next::WireEnvelope::encode_value(
5171 parents,
5172 preallocated.encoder,
5173 &mut out,
5174 )?;
5175 } else {
5176 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5177 }
5178 }
5179
5180 1 => {
5181 if let Some(name) = self.name.take() {
5182 ::fidl_next::WireEnvelope::encode_value(
5183 name,
5184 preallocated.encoder,
5185 &mut out,
5186 )?;
5187 } else {
5188 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5189 }
5190 }
5191
5192 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5193 }
5194 unsafe {
5195 preallocated.write_next(out.assume_init_ref());
5196 }
5197 }
5198
5199 ::fidl_next::WireTable::encode_len(table, max_ord);
5200
5201 Ok(())
5202 }
5203}
5204
5205unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CompositeNodeSpec
5206where
5207 ___E: ::fidl_next::Encoder + ?Sized,
5208{
5209 #[inline]
5210 fn encode_ref(
5211 &self,
5212 encoder: &mut ___E,
5213 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5214 ) -> Result<(), ::fidl_next::EncodeError> {
5215 ::fidl_next::munge!(let WireCompositeNodeSpec { table } = out);
5216
5217 let max_ord = self.__max_ordinal();
5218
5219 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5220 ::fidl_next::Wire::zero_padding(&mut out);
5221
5222 let mut preallocated =
5223 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5224
5225 for i in 1..=max_ord {
5226 match i {
5227 3 => {
5228 if let Some(parents2) = &self.parents2 {
5229 ::fidl_next::WireEnvelope::encode_value(
5230 parents2,
5231 preallocated.encoder,
5232 &mut out,
5233 )?;
5234 } else {
5235 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5236 }
5237 }
5238
5239 2 => {
5240 if let Some(parents) = &self.parents {
5241 ::fidl_next::WireEnvelope::encode_value(
5242 parents,
5243 preallocated.encoder,
5244 &mut out,
5245 )?;
5246 } else {
5247 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5248 }
5249 }
5250
5251 1 => {
5252 if let Some(name) = &self.name {
5253 ::fidl_next::WireEnvelope::encode_value(
5254 name,
5255 preallocated.encoder,
5256 &mut out,
5257 )?;
5258 } else {
5259 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5260 }
5261 }
5262
5263 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5264 }
5265 unsafe {
5266 preallocated.write_next(out.assume_init_ref());
5267 }
5268 }
5269
5270 ::fidl_next::WireTable::encode_len(table, max_ord);
5271
5272 Ok(())
5273 }
5274}
5275
5276impl<'de> ::fidl_next::FromWire<WireCompositeNodeSpec<'de>> for CompositeNodeSpec {
5277 #[inline]
5278 fn from_wire(wire: WireCompositeNodeSpec<'de>) -> Self {
5279 let wire = ::core::mem::ManuallyDrop::new(wire);
5280
5281 let name = wire.table.get(1);
5282
5283 let parents = wire.table.get(2);
5284
5285 let parents2 = wire.table.get(3);
5286
5287 Self {
5288
5289
5290 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
5291 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
5292 )),
5293
5294
5295 parents: parents.map(|envelope| ::fidl_next::FromWire::from_wire(
5296 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireParentSpec<'de>>>() }
5297 )),
5298
5299
5300 parents2: parents2.map(|envelope| ::fidl_next::FromWire::from_wire(
5301 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireParentSpec2<'de>>>() }
5302 )),
5303
5304 }
5305 }
5306}
5307
5308impl<'de> ::fidl_next::FromWireRef<WireCompositeNodeSpec<'de>> for CompositeNodeSpec {
5309 #[inline]
5310 fn from_wire_ref(wire: &WireCompositeNodeSpec<'de>) -> Self {
5311 Self {
5312
5313
5314 name: wire.table.get(1)
5315 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
5316 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
5317 )),
5318
5319
5320 parents: wire.table.get(2)
5321 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
5322 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireParentSpec<'de>>>() }
5323 )),
5324
5325
5326 parents2: wire.table.get(3)
5327 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
5328 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireParentSpec2<'de>>>() }
5329 )),
5330
5331 }
5332 }
5333}
5334
5335#[repr(C)]
5337pub struct WireCompositeNodeSpec<'de> {
5338 table: ::fidl_next::WireTable<'de>,
5339}
5340
5341impl<'de> Drop for WireCompositeNodeSpec<'de> {
5342 fn drop(&mut self) {
5343 let _ = self
5344 .table
5345 .get(1)
5346 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
5347
5348 let _ = self.table.get(2).map(|envelope| unsafe {
5349 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireParentSpec<'de>>>()
5350 });
5351
5352 let _ = self.table.get(3).map(|envelope| unsafe {
5353 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireParentSpec2<'de>>>()
5354 });
5355 }
5356}
5357
5358unsafe impl ::fidl_next::Wire for WireCompositeNodeSpec<'static> {
5359 type Decoded<'de> = WireCompositeNodeSpec<'de>;
5360
5361 #[inline]
5362 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5363 ::fidl_next::munge!(let Self { table } = out);
5364 ::fidl_next::WireTable::zero_padding(table);
5365 }
5366}
5367
5368unsafe impl<___D> ::fidl_next::Decode<___D> for WireCompositeNodeSpec<'static>
5369where
5370 ___D: ::fidl_next::Decoder + ?Sized,
5371{
5372 fn decode(
5373 slot: ::fidl_next::Slot<'_, Self>,
5374 decoder: &mut ___D,
5375 ) -> Result<(), ::fidl_next::DecodeError> {
5376 ::fidl_next::munge!(let Self { table } = slot);
5377
5378 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
5379 match ordinal {
5380 0 => unsafe { ::core::hint::unreachable_unchecked() },
5381
5382 1 => {
5383 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
5384 slot.as_mut(),
5385 decoder,
5386 )?;
5387
5388 Ok(())
5389 }
5390
5391 2 => {
5392 ::fidl_next::WireEnvelope::decode_as::<
5393 ___D,
5394 ::fidl_next::WireVector<'static, crate::WireParentSpec<'static>>,
5395 >(slot.as_mut(), decoder)?;
5396
5397 Ok(())
5398 }
5399
5400 3 => {
5401 ::fidl_next::WireEnvelope::decode_as::<
5402 ___D,
5403 ::fidl_next::WireVector<'static, crate::WireParentSpec2<'static>>,
5404 >(slot.as_mut(), decoder)?;
5405
5406 Ok(())
5407 }
5408
5409 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
5410 }
5411 })
5412 }
5413}
5414
5415impl<'de> WireCompositeNodeSpec<'de> {
5416 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
5417 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5418 }
5419
5420 pub fn parents(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireParentSpec<'de>>> {
5421 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5422 }
5423
5424 pub fn parents2(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireParentSpec2<'de>>> {
5425 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
5426 }
5427}
5428
5429impl<'de> ::core::fmt::Debug for WireCompositeNodeSpec<'de> {
5430 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
5431 f.debug_struct("CompositeNodeSpec")
5432 .field("name", &self.name())
5433 .field("parents", &self.parents())
5434 .field("parents2", &self.parents2())
5435 .finish()
5436 }
5437}
5438
5439#[doc = " Information for a composite that is defined by a composite node spec.\n"]
5440#[derive(Clone, Debug, Default)]
5441pub struct CompositeInfo {
5442 pub spec: Option<crate::CompositeNodeSpec>,
5443
5444 pub matched_driver: Option<crate::CompositeDriverMatch>,
5445}
5446
5447impl CompositeInfo {
5448 fn __max_ordinal(&self) -> usize {
5449 if self.spec.is_some() {
5450 return 1;
5451 }
5452
5453 if self.matched_driver.is_some() {
5454 return 2;
5455 }
5456
5457 0
5458 }
5459}
5460
5461impl ::fidl_next::Encodable for CompositeInfo {
5462 type Encoded = WireCompositeInfo<'static>;
5463}
5464
5465unsafe impl<___E> ::fidl_next::Encode<___E> for CompositeInfo
5466where
5467 ___E: ::fidl_next::Encoder + ?Sized,
5468{
5469 #[inline]
5470 fn encode(
5471 mut self,
5472 encoder: &mut ___E,
5473 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5474 ) -> Result<(), ::fidl_next::EncodeError> {
5475 ::fidl_next::munge!(let WireCompositeInfo { table } = out);
5476
5477 let max_ord = self.__max_ordinal();
5478
5479 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5480 ::fidl_next::Wire::zero_padding(&mut out);
5481
5482 let mut preallocated =
5483 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5484
5485 for i in 1..=max_ord {
5486 match i {
5487 2 => {
5488 if let Some(matched_driver) = self.matched_driver.take() {
5489 ::fidl_next::WireEnvelope::encode_value(
5490 matched_driver,
5491 preallocated.encoder,
5492 &mut out,
5493 )?;
5494 } else {
5495 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5496 }
5497 }
5498
5499 1 => {
5500 if let Some(spec) = self.spec.take() {
5501 ::fidl_next::WireEnvelope::encode_value(
5502 spec,
5503 preallocated.encoder,
5504 &mut out,
5505 )?;
5506 } else {
5507 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5508 }
5509 }
5510
5511 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5512 }
5513 unsafe {
5514 preallocated.write_next(out.assume_init_ref());
5515 }
5516 }
5517
5518 ::fidl_next::WireTable::encode_len(table, max_ord);
5519
5520 Ok(())
5521 }
5522}
5523
5524unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CompositeInfo
5525where
5526 ___E: ::fidl_next::Encoder + ?Sized,
5527{
5528 #[inline]
5529 fn encode_ref(
5530 &self,
5531 encoder: &mut ___E,
5532 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5533 ) -> Result<(), ::fidl_next::EncodeError> {
5534 ::fidl_next::munge!(let WireCompositeInfo { table } = out);
5535
5536 let max_ord = self.__max_ordinal();
5537
5538 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5539 ::fidl_next::Wire::zero_padding(&mut out);
5540
5541 let mut preallocated =
5542 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5543
5544 for i in 1..=max_ord {
5545 match i {
5546 2 => {
5547 if let Some(matched_driver) = &self.matched_driver {
5548 ::fidl_next::WireEnvelope::encode_value(
5549 matched_driver,
5550 preallocated.encoder,
5551 &mut out,
5552 )?;
5553 } else {
5554 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5555 }
5556 }
5557
5558 1 => {
5559 if let Some(spec) = &self.spec {
5560 ::fidl_next::WireEnvelope::encode_value(
5561 spec,
5562 preallocated.encoder,
5563 &mut out,
5564 )?;
5565 } else {
5566 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5567 }
5568 }
5569
5570 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5571 }
5572 unsafe {
5573 preallocated.write_next(out.assume_init_ref());
5574 }
5575 }
5576
5577 ::fidl_next::WireTable::encode_len(table, max_ord);
5578
5579 Ok(())
5580 }
5581}
5582
5583impl<'de> ::fidl_next::FromWire<WireCompositeInfo<'de>> for CompositeInfo {
5584 #[inline]
5585 fn from_wire(wire: WireCompositeInfo<'de>) -> Self {
5586 let wire = ::core::mem::ManuallyDrop::new(wire);
5587
5588 let spec = wire.table.get(1);
5589
5590 let matched_driver = wire.table.get(2);
5591
5592 Self {
5593 spec: spec.map(|envelope| {
5594 ::fidl_next::FromWire::from_wire(unsafe {
5595 envelope.read_unchecked::<crate::WireCompositeNodeSpec<'de>>()
5596 })
5597 }),
5598
5599 matched_driver: matched_driver.map(|envelope| {
5600 ::fidl_next::FromWire::from_wire(unsafe {
5601 envelope.read_unchecked::<crate::WireCompositeDriverMatch<'de>>()
5602 })
5603 }),
5604 }
5605 }
5606}
5607
5608impl<'de> ::fidl_next::FromWireRef<WireCompositeInfo<'de>> for CompositeInfo {
5609 #[inline]
5610 fn from_wire_ref(wire: &WireCompositeInfo<'de>) -> Self {
5611 Self {
5612 spec: wire.table.get(1).map(|envelope| {
5613 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
5614 envelope.deref_unchecked::<crate::WireCompositeNodeSpec<'de>>()
5615 })
5616 }),
5617
5618 matched_driver: wire.table.get(2).map(|envelope| {
5619 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
5620 envelope.deref_unchecked::<crate::WireCompositeDriverMatch<'de>>()
5621 })
5622 }),
5623 }
5624 }
5625}
5626
5627#[repr(C)]
5629pub struct WireCompositeInfo<'de> {
5630 table: ::fidl_next::WireTable<'de>,
5631}
5632
5633impl<'de> Drop for WireCompositeInfo<'de> {
5634 fn drop(&mut self) {
5635 let _ = self.table.get(1).map(|envelope| unsafe {
5636 envelope.read_unchecked::<crate::WireCompositeNodeSpec<'de>>()
5637 });
5638
5639 let _ = self.table.get(2).map(|envelope| unsafe {
5640 envelope.read_unchecked::<crate::WireCompositeDriverMatch<'de>>()
5641 });
5642 }
5643}
5644
5645unsafe impl ::fidl_next::Wire for WireCompositeInfo<'static> {
5646 type Decoded<'de> = WireCompositeInfo<'de>;
5647
5648 #[inline]
5649 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5650 ::fidl_next::munge!(let Self { table } = out);
5651 ::fidl_next::WireTable::zero_padding(table);
5652 }
5653}
5654
5655unsafe impl<___D> ::fidl_next::Decode<___D> for WireCompositeInfo<'static>
5656where
5657 ___D: ::fidl_next::Decoder + ?Sized,
5658{
5659 fn decode(
5660 slot: ::fidl_next::Slot<'_, Self>,
5661 decoder: &mut ___D,
5662 ) -> Result<(), ::fidl_next::DecodeError> {
5663 ::fidl_next::munge!(let Self { table } = slot);
5664
5665 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
5666 match ordinal {
5667 0 => unsafe { ::core::hint::unreachable_unchecked() },
5668
5669 1 => {
5670 ::fidl_next::WireEnvelope::decode_as::<
5671 ___D,
5672 crate::WireCompositeNodeSpec<'static>,
5673 >(slot.as_mut(), decoder)?;
5674
5675 Ok(())
5676 }
5677
5678 2 => {
5679 ::fidl_next::WireEnvelope::decode_as::<
5680 ___D,
5681 crate::WireCompositeDriverMatch<'static>,
5682 >(slot.as_mut(), decoder)?;
5683
5684 Ok(())
5685 }
5686
5687 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
5688 }
5689 })
5690 }
5691}
5692
5693impl<'de> WireCompositeInfo<'de> {
5694 pub fn spec(&self) -> Option<&crate::WireCompositeNodeSpec<'de>> {
5695 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5696 }
5697
5698 pub fn matched_driver(&self) -> Option<&crate::WireCompositeDriverMatch<'de>> {
5699 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5700 }
5701}
5702
5703impl<'de> ::core::fmt::Debug for WireCompositeInfo<'de> {
5704 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
5705 f.debug_struct("CompositeInfo")
5706 .field("spec", &self.spec())
5707 .field("matched_driver", &self.matched_driver())
5708 .finish()
5709 }
5710}
5711
5712pub type CompositeNodeManagerAddSpecResponse = ();
5713
5714pub type WireCompositeNodeManagerAddSpecResponse = ();
5716
5717#[doc = " Error codes for the CompositeNodeManager protocol.\n"]
5718#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5719#[repr(u32)]
5720pub enum CompositeNodeSpecError {
5721 MissingArgs = 1,
5722 EmptyNodes = 2,
5723 AlreadyExists = 3,
5724 DriverIndexFailure = 4,
5725 DuplicateParents = 5,
5726 UnknownOrdinal_(u32),
5727}
5728
5729impl ::fidl_next::Encodable for CompositeNodeSpecError {
5730 type Encoded = WireCompositeNodeSpecError;
5731}
5732impl ::std::convert::From<u32> for CompositeNodeSpecError {
5733 fn from(value: u32) -> Self {
5734 match value {
5735 1 => Self::MissingArgs,
5736 2 => Self::EmptyNodes,
5737 3 => Self::AlreadyExists,
5738 4 => Self::DriverIndexFailure,
5739 5 => Self::DuplicateParents,
5740
5741 _ => Self::UnknownOrdinal_(value),
5742 }
5743 }
5744}
5745
5746unsafe impl<___E> ::fidl_next::Encode<___E> for CompositeNodeSpecError
5747where
5748 ___E: ?Sized,
5749{
5750 #[inline]
5751 fn encode(
5752 self,
5753 encoder: &mut ___E,
5754 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5755 ) -> Result<(), ::fidl_next::EncodeError> {
5756 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
5757 }
5758}
5759
5760unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CompositeNodeSpecError
5761where
5762 ___E: ?Sized,
5763{
5764 #[inline]
5765 fn encode_ref(
5766 &self,
5767 encoder: &mut ___E,
5768 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5769 ) -> Result<(), ::fidl_next::EncodeError> {
5770 ::fidl_next::munge!(let WireCompositeNodeSpecError { value } = out);
5771 let _ = value.write(::fidl_next::WireU32::from(match *self {
5772 Self::MissingArgs => 1,
5773
5774 Self::EmptyNodes => 2,
5775
5776 Self::AlreadyExists => 3,
5777
5778 Self::DriverIndexFailure => 4,
5779
5780 Self::DuplicateParents => 5,
5781
5782 Self::UnknownOrdinal_(value) => value,
5783 }));
5784
5785 Ok(())
5786 }
5787}
5788
5789impl ::core::convert::From<WireCompositeNodeSpecError> for CompositeNodeSpecError {
5790 fn from(wire: WireCompositeNodeSpecError) -> Self {
5791 match u32::from(wire.value) {
5792 1 => Self::MissingArgs,
5793
5794 2 => Self::EmptyNodes,
5795
5796 3 => Self::AlreadyExists,
5797
5798 4 => Self::DriverIndexFailure,
5799
5800 5 => Self::DuplicateParents,
5801
5802 value => Self::UnknownOrdinal_(value),
5803 }
5804 }
5805}
5806
5807impl ::fidl_next::FromWire<WireCompositeNodeSpecError> for CompositeNodeSpecError {
5808 #[inline]
5809 fn from_wire(wire: WireCompositeNodeSpecError) -> Self {
5810 Self::from(wire)
5811 }
5812}
5813
5814impl ::fidl_next::FromWireRef<WireCompositeNodeSpecError> for CompositeNodeSpecError {
5815 #[inline]
5816 fn from_wire_ref(wire: &WireCompositeNodeSpecError) -> Self {
5817 Self::from(*wire)
5818 }
5819}
5820
5821#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5823#[repr(transparent)]
5824pub struct WireCompositeNodeSpecError {
5825 value: ::fidl_next::WireU32,
5826}
5827
5828unsafe impl ::fidl_next::Wire for WireCompositeNodeSpecError {
5829 type Decoded<'de> = Self;
5830
5831 #[inline]
5832 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
5833 }
5835}
5836
5837impl WireCompositeNodeSpecError {
5838 pub const MISSING_ARGS: WireCompositeNodeSpecError =
5839 WireCompositeNodeSpecError { value: ::fidl_next::WireU32(1) };
5840
5841 pub const EMPTY_NODES: WireCompositeNodeSpecError =
5842 WireCompositeNodeSpecError { value: ::fidl_next::WireU32(2) };
5843
5844 pub const ALREADY_EXISTS: WireCompositeNodeSpecError =
5845 WireCompositeNodeSpecError { value: ::fidl_next::WireU32(3) };
5846
5847 pub const DRIVER_INDEX_FAILURE: WireCompositeNodeSpecError =
5848 WireCompositeNodeSpecError { value: ::fidl_next::WireU32(4) };
5849
5850 pub const DUPLICATE_PARENTS: WireCompositeNodeSpecError =
5851 WireCompositeNodeSpecError { value: ::fidl_next::WireU32(5) };
5852}
5853
5854unsafe impl<___D> ::fidl_next::Decode<___D> for WireCompositeNodeSpecError
5855where
5856 ___D: ?Sized,
5857{
5858 fn decode(
5859 slot: ::fidl_next::Slot<'_, Self>,
5860 _: &mut ___D,
5861 ) -> Result<(), ::fidl_next::DecodeError> {
5862 Ok(())
5863 }
5864}
5865
5866impl ::core::convert::From<CompositeNodeSpecError> for WireCompositeNodeSpecError {
5867 fn from(natural: CompositeNodeSpecError) -> Self {
5868 match natural {
5869 CompositeNodeSpecError::MissingArgs => WireCompositeNodeSpecError::MISSING_ARGS,
5870
5871 CompositeNodeSpecError::EmptyNodes => WireCompositeNodeSpecError::EMPTY_NODES,
5872
5873 CompositeNodeSpecError::AlreadyExists => WireCompositeNodeSpecError::ALREADY_EXISTS,
5874
5875 CompositeNodeSpecError::DriverIndexFailure => {
5876 WireCompositeNodeSpecError::DRIVER_INDEX_FAILURE
5877 }
5878
5879 CompositeNodeSpecError::DuplicateParents => {
5880 WireCompositeNodeSpecError::DUPLICATE_PARENTS
5881 }
5882
5883 CompositeNodeSpecError::UnknownOrdinal_(value) => {
5884 WireCompositeNodeSpecError { value: ::fidl_next::WireU32::from(value) }
5885 }
5886 }
5887 }
5888}
5889
5890#[doc = " Protocol through which board drivers can create composite node specs.\n\n Composite node specs are created at runtime to dynamically bridge the\n static bind rules of a composite driver with the dynamic bind properties\n of nodes in the system so that the driver bind rules are more generic and reusable.\n"]
5892#[derive(Debug)]
5893pub struct CompositeNodeManager;
5894
5895impl ::fidl_next::Discoverable for CompositeNodeManager {
5896 const PROTOCOL_NAME: &'static str = "composite_node_manager";
5897}
5898
5899pub mod composite_node_manager {
5900 pub mod prelude {
5901 pub use crate::{
5902 composite_node_manager, CompositeNodeManager, CompositeNodeManagerClientHandler,
5903 CompositeNodeManagerClientSender, CompositeNodeManagerServerHandler,
5904 CompositeNodeManagerServerSender,
5905 };
5906
5907 pub use crate::CompositeNodeManagerAddSpecResponse;
5908
5909 pub use crate::CompositeNodeSpec;
5910
5911 pub use crate::CompositeNodeSpecError;
5912 }
5913
5914 pub struct AddSpec;
5915
5916 impl ::fidl_next::Method for AddSpec {
5917 const ORDINAL: u64 = 5930736293275290740;
5918
5919 type Protocol = crate::CompositeNodeManager;
5920
5921 type Request = crate::WireCompositeNodeSpec<'static>;
5922
5923 type Response = ::fidl_next::WireFlexibleResult<
5924 'static,
5925 crate::WireCompositeNodeManagerAddSpecResponse,
5926 crate::WireCompositeNodeSpecError,
5927 >;
5928 }
5929}
5930
5931pub trait CompositeNodeManagerClientSender {
5933 type Transport: ::fidl_next::Transport;
5934
5935 #[doc = " Adds the given composite node specification to the driver framework.\n"]
5936 fn add_spec<___R>(
5937 &self,
5938 request: ___R,
5939 ) -> Result<
5940 ::fidl_next::ResponseFuture<'_, Self::Transport, composite_node_manager::AddSpec>,
5941 ::fidl_next::EncodeError,
5942 >
5943 where
5944 ___R: ::fidl_next::Encode<
5945 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
5946 Encoded = crate::WireCompositeNodeSpec<'static>,
5947 >;
5948}
5949
5950impl<___T> CompositeNodeManagerClientSender
5951 for ::fidl_next::ClientSender<___T, CompositeNodeManager>
5952where
5953 ___T: ::fidl_next::Transport,
5954{
5955 type Transport = ___T;
5956
5957 #[doc = " Adds the given composite node specification to the driver framework.\n"]
5958 fn add_spec<___R>(
5959 &self,
5960 request: ___R,
5961 ) -> Result<
5962 ::fidl_next::ResponseFuture<'_, Self::Transport, composite_node_manager::AddSpec>,
5963 ::fidl_next::EncodeError,
5964 >
5965 where
5966 ___R: ::fidl_next::Encode<
5967 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
5968 Encoded = crate::WireCompositeNodeSpec<'static>,
5969 >,
5970 {
5971 self.as_untyped()
5972 .send_two_way(5930736293275290740, request)
5973 .map(::fidl_next::ResponseFuture::from_untyped)
5974 }
5975}
5976
5977pub trait CompositeNodeManagerClientHandler<___T: ::fidl_next::Transport> {
5981 fn on_unknown_interaction(
5982 &mut self,
5983 sender: &::fidl_next::ClientSender<___T, CompositeNodeManager>,
5984 ordinal: u64,
5985 ) {
5986 sender.close();
5987 }
5988}
5989
5990impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for CompositeNodeManager
5991where
5992 ___T: ::fidl_next::Transport,
5993 ___H: CompositeNodeManagerClientHandler<___T>,
5994
5995 <composite_node_manager::AddSpec as ::fidl_next::Method>::Response:
5996 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
5997{
5998 fn on_event(
5999 handler: &mut ___H,
6000 sender: &::fidl_next::ClientSender<___T, Self>,
6001 ordinal: u64,
6002 buffer: ___T::RecvBuffer,
6003 ) {
6004 match ordinal {
6005 ordinal => handler.on_unknown_interaction(sender, ordinal),
6006 }
6007 }
6008}
6009
6010pub trait CompositeNodeManagerServerSender {
6012 type Transport: ::fidl_next::Transport;
6013}
6014
6015impl<___T> CompositeNodeManagerServerSender
6016 for ::fidl_next::ServerSender<___T, CompositeNodeManager>
6017where
6018 ___T: ::fidl_next::Transport,
6019{
6020 type Transport = ___T;
6021}
6022
6023pub trait CompositeNodeManagerServerHandler<___T: ::fidl_next::Transport> {
6027 #[doc = " Adds the given composite node specification to the driver framework.\n"]
6028 fn add_spec(
6029 &mut self,
6030 sender: &::fidl_next::ServerSender<___T, CompositeNodeManager>,
6031
6032 request: ::fidl_next::Request<___T, composite_node_manager::AddSpec>,
6033
6034 responder: ::fidl_next::Responder<composite_node_manager::AddSpec>,
6035 );
6036
6037 fn on_unknown_interaction(
6038 &mut self,
6039 sender: &::fidl_next::ServerSender<___T, CompositeNodeManager>,
6040 ordinal: u64,
6041 ) {
6042 sender.close();
6043 }
6044}
6045
6046impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for CompositeNodeManager
6047where
6048 ___T: ::fidl_next::Transport,
6049 ___H: CompositeNodeManagerServerHandler<___T>,
6050
6051 <composite_node_manager::AddSpec as ::fidl_next::Method>::Request:
6052 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
6053{
6054 fn on_one_way(
6055 handler: &mut ___H,
6056 sender: &::fidl_next::ServerSender<___T, Self>,
6057 ordinal: u64,
6058 buffer: ___T::RecvBuffer,
6059 ) {
6060 match ordinal {
6061 ordinal => handler.on_unknown_interaction(sender, ordinal),
6062 }
6063 }
6064
6065 fn on_two_way(
6066 handler: &mut ___H,
6067 sender: &::fidl_next::ServerSender<___T, Self>,
6068 ordinal: u64,
6069 buffer: ___T::RecvBuffer,
6070 responder: ::fidl_next::protocol::Responder,
6071 ) {
6072 match ordinal {
6073 5930736293275290740 => {
6074 let responder = ::fidl_next::Responder::from_untyped(responder);
6075
6076 match ::fidl_next::DecoderExt::decode(buffer) {
6077 Ok(decoded) => handler.add_spec(sender, decoded, responder),
6078 Err(e) => {
6079 sender.close();
6080 }
6081 }
6082 }
6083
6084 ordinal => handler.on_unknown_interaction(sender, ordinal),
6085 }
6086 }
6087}
6088
6089#[doc = " A parent to a composite that is defined by a composite node spec.\n"]
6090#[derive(Clone, Debug, Default)]
6091pub struct CompositeParent {
6092 pub composite: Option<crate::CompositeInfo>,
6093
6094 pub index: Option<u32>,
6095}
6096
6097impl CompositeParent {
6098 fn __max_ordinal(&self) -> usize {
6099 if self.composite.is_some() {
6100 return 1;
6101 }
6102
6103 if self.index.is_some() {
6104 return 2;
6105 }
6106
6107 0
6108 }
6109}
6110
6111impl ::fidl_next::Encodable for CompositeParent {
6112 type Encoded = WireCompositeParent<'static>;
6113}
6114
6115unsafe impl<___E> ::fidl_next::Encode<___E> for CompositeParent
6116where
6117 ___E: ::fidl_next::Encoder + ?Sized,
6118{
6119 #[inline]
6120 fn encode(
6121 mut self,
6122 encoder: &mut ___E,
6123 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6124 ) -> Result<(), ::fidl_next::EncodeError> {
6125 ::fidl_next::munge!(let WireCompositeParent { table } = out);
6126
6127 let max_ord = self.__max_ordinal();
6128
6129 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
6130 ::fidl_next::Wire::zero_padding(&mut out);
6131
6132 let mut preallocated =
6133 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
6134
6135 for i in 1..=max_ord {
6136 match i {
6137 2 => {
6138 if let Some(index) = self.index.take() {
6139 ::fidl_next::WireEnvelope::encode_value(
6140 index,
6141 preallocated.encoder,
6142 &mut out,
6143 )?;
6144 } else {
6145 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6146 }
6147 }
6148
6149 1 => {
6150 if let Some(composite) = self.composite.take() {
6151 ::fidl_next::WireEnvelope::encode_value(
6152 composite,
6153 preallocated.encoder,
6154 &mut out,
6155 )?;
6156 } else {
6157 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6158 }
6159 }
6160
6161 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
6162 }
6163 unsafe {
6164 preallocated.write_next(out.assume_init_ref());
6165 }
6166 }
6167
6168 ::fidl_next::WireTable::encode_len(table, max_ord);
6169
6170 Ok(())
6171 }
6172}
6173
6174unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CompositeParent
6175where
6176 ___E: ::fidl_next::Encoder + ?Sized,
6177{
6178 #[inline]
6179 fn encode_ref(
6180 &self,
6181 encoder: &mut ___E,
6182 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6183 ) -> Result<(), ::fidl_next::EncodeError> {
6184 ::fidl_next::munge!(let WireCompositeParent { table } = out);
6185
6186 let max_ord = self.__max_ordinal();
6187
6188 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
6189 ::fidl_next::Wire::zero_padding(&mut out);
6190
6191 let mut preallocated =
6192 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
6193
6194 for i in 1..=max_ord {
6195 match i {
6196 2 => {
6197 if let Some(index) = &self.index {
6198 ::fidl_next::WireEnvelope::encode_value(
6199 index,
6200 preallocated.encoder,
6201 &mut out,
6202 )?;
6203 } else {
6204 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6205 }
6206 }
6207
6208 1 => {
6209 if let Some(composite) = &self.composite {
6210 ::fidl_next::WireEnvelope::encode_value(
6211 composite,
6212 preallocated.encoder,
6213 &mut out,
6214 )?;
6215 } else {
6216 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6217 }
6218 }
6219
6220 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
6221 }
6222 unsafe {
6223 preallocated.write_next(out.assume_init_ref());
6224 }
6225 }
6226
6227 ::fidl_next::WireTable::encode_len(table, max_ord);
6228
6229 Ok(())
6230 }
6231}
6232
6233impl<'de> ::fidl_next::FromWire<WireCompositeParent<'de>> for CompositeParent {
6234 #[inline]
6235 fn from_wire(wire: WireCompositeParent<'de>) -> Self {
6236 let wire = ::core::mem::ManuallyDrop::new(wire);
6237
6238 let composite = wire.table.get(1);
6239
6240 let index = wire.table.get(2);
6241
6242 Self {
6243 composite: composite.map(|envelope| {
6244 ::fidl_next::FromWire::from_wire(unsafe {
6245 envelope.read_unchecked::<crate::WireCompositeInfo<'de>>()
6246 })
6247 }),
6248
6249 index: index.map(|envelope| {
6250 ::fidl_next::FromWire::from_wire(unsafe {
6251 envelope.read_unchecked::<::fidl_next::WireU32>()
6252 })
6253 }),
6254 }
6255 }
6256}
6257
6258impl<'de> ::fidl_next::FromWireRef<WireCompositeParent<'de>> for CompositeParent {
6259 #[inline]
6260 fn from_wire_ref(wire: &WireCompositeParent<'de>) -> Self {
6261 Self {
6262 composite: wire.table.get(1).map(|envelope| {
6263 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
6264 envelope.deref_unchecked::<crate::WireCompositeInfo<'de>>()
6265 })
6266 }),
6267
6268 index: wire.table.get(2).map(|envelope| {
6269 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
6270 envelope.deref_unchecked::<::fidl_next::WireU32>()
6271 })
6272 }),
6273 }
6274 }
6275}
6276
6277#[repr(C)]
6279pub struct WireCompositeParent<'de> {
6280 table: ::fidl_next::WireTable<'de>,
6281}
6282
6283impl<'de> Drop for WireCompositeParent<'de> {
6284 fn drop(&mut self) {
6285 let _ = self
6286 .table
6287 .get(1)
6288 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireCompositeInfo<'de>>() });
6289
6290 let _ = self
6291 .table
6292 .get(2)
6293 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireU32>() });
6294 }
6295}
6296
6297unsafe impl ::fidl_next::Wire for WireCompositeParent<'static> {
6298 type Decoded<'de> = WireCompositeParent<'de>;
6299
6300 #[inline]
6301 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6302 ::fidl_next::munge!(let Self { table } = out);
6303 ::fidl_next::WireTable::zero_padding(table);
6304 }
6305}
6306
6307unsafe impl<___D> ::fidl_next::Decode<___D> for WireCompositeParent<'static>
6308where
6309 ___D: ::fidl_next::Decoder + ?Sized,
6310{
6311 fn decode(
6312 slot: ::fidl_next::Slot<'_, Self>,
6313 decoder: &mut ___D,
6314 ) -> Result<(), ::fidl_next::DecodeError> {
6315 ::fidl_next::munge!(let Self { table } = slot);
6316
6317 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
6318 match ordinal {
6319 0 => unsafe { ::core::hint::unreachable_unchecked() },
6320
6321 1 => {
6322 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireCompositeInfo<'static>>(
6323 slot.as_mut(),
6324 decoder,
6325 )?;
6326
6327 Ok(())
6328 }
6329
6330 2 => {
6331 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireU32>(
6332 slot.as_mut(),
6333 decoder,
6334 )?;
6335
6336 Ok(())
6337 }
6338
6339 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
6340 }
6341 })
6342 }
6343}
6344
6345impl<'de> WireCompositeParent<'de> {
6346 pub fn composite(&self) -> Option<&crate::WireCompositeInfo<'de>> {
6347 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
6348 }
6349
6350 pub fn index(&self) -> Option<&::fidl_next::WireU32> {
6351 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
6352 }
6353}
6354
6355impl<'de> ::core::fmt::Debug for WireCompositeParent<'de> {
6356 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
6357 f.debug_struct("CompositeParent")
6358 .field("composite", &self.composite())
6359 .field("index", &self.index())
6360 .finish()
6361 }
6362}
6363
6364#[derive(Debug, Default)]
6365pub struct DevfsAddArgs {
6366 pub connector: Option<
6367 ::fidl_next::ClientEnd<
6368 ::fidl_next::fuchsia::zx::Channel,
6369 ::fidl_next_fuchsia_device_fs::Connector,
6370 >,
6371 >,
6372
6373 pub class_name: Option<String>,
6374
6375 pub inspect: Option<::fidl_next::fuchsia::zx::Handle>,
6376
6377 pub connector_supports: Option<::fidl_next_fuchsia_device_fs::ConnectionType>,
6378
6379 pub controller_connector: Option<
6380 ::fidl_next::ClientEnd<
6381 ::fidl_next::fuchsia::zx::Channel,
6382 ::fidl_next_fuchsia_device_fs::Connector,
6383 >,
6384 >,
6385}
6386
6387impl DevfsAddArgs {
6388 fn __max_ordinal(&self) -> usize {
6389 if self.connector.is_some() {
6390 return 1;
6391 }
6392
6393 if self.class_name.is_some() {
6394 return 2;
6395 }
6396
6397 if self.inspect.is_some() {
6398 return 3;
6399 }
6400
6401 if self.connector_supports.is_some() {
6402 return 4;
6403 }
6404
6405 if self.controller_connector.is_some() {
6406 return 5;
6407 }
6408
6409 0
6410 }
6411}
6412
6413impl ::fidl_next::Encodable for DevfsAddArgs {
6414 type Encoded = WireDevfsAddArgs<'static>;
6415}
6416
6417unsafe impl<___E> ::fidl_next::Encode<___E> for DevfsAddArgs
6418where
6419 ___E: ::fidl_next::Encoder + ?Sized,
6420
6421 ___E: ::fidl_next::fuchsia::HandleEncoder,
6422{
6423 #[inline]
6424 fn encode(
6425 mut self,
6426 encoder: &mut ___E,
6427 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6428 ) -> Result<(), ::fidl_next::EncodeError> {
6429 ::fidl_next::munge!(let WireDevfsAddArgs { table } = out);
6430
6431 let max_ord = self.__max_ordinal();
6432
6433 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
6434 ::fidl_next::Wire::zero_padding(&mut out);
6435
6436 let mut preallocated =
6437 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
6438
6439 for i in 1..=max_ord {
6440 match i {
6441 5 => {
6442 if let Some(controller_connector) = self.controller_connector.take() {
6443 ::fidl_next::WireEnvelope::encode_value(
6444 controller_connector,
6445 preallocated.encoder,
6446 &mut out,
6447 )?;
6448 } else {
6449 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6450 }
6451 }
6452
6453 4 => {
6454 if let Some(connector_supports) = self.connector_supports.take() {
6455 ::fidl_next::WireEnvelope::encode_value(
6456 connector_supports,
6457 preallocated.encoder,
6458 &mut out,
6459 )?;
6460 } else {
6461 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6462 }
6463 }
6464
6465 3 => {
6466 if let Some(inspect) = self.inspect.take() {
6467 ::fidl_next::WireEnvelope::encode_value(
6468 inspect,
6469 preallocated.encoder,
6470 &mut out,
6471 )?;
6472 } else {
6473 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6474 }
6475 }
6476
6477 2 => {
6478 if let Some(class_name) = self.class_name.take() {
6479 ::fidl_next::WireEnvelope::encode_value(
6480 class_name,
6481 preallocated.encoder,
6482 &mut out,
6483 )?;
6484 } else {
6485 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6486 }
6487 }
6488
6489 1 => {
6490 if let Some(connector) = self.connector.take() {
6491 ::fidl_next::WireEnvelope::encode_value(
6492 connector,
6493 preallocated.encoder,
6494 &mut out,
6495 )?;
6496 } else {
6497 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6498 }
6499 }
6500
6501 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
6502 }
6503 unsafe {
6504 preallocated.write_next(out.assume_init_ref());
6505 }
6506 }
6507
6508 ::fidl_next::WireTable::encode_len(table, max_ord);
6509
6510 Ok(())
6511 }
6512}
6513
6514impl<'de> ::fidl_next::FromWire<WireDevfsAddArgs<'de>> for DevfsAddArgs {
6515 #[inline]
6516 fn from_wire(wire: WireDevfsAddArgs<'de>) -> Self {
6517 let wire = ::core::mem::ManuallyDrop::new(wire);
6518
6519 let connector = wire.table.get(1);
6520
6521 let class_name = wire.table.get(2);
6522
6523 let inspect = wire.table.get(3);
6524
6525 let connector_supports = wire.table.get(4);
6526
6527 let controller_connector = wire.table.get(5);
6528
6529 Self {
6530 connector: connector.map(|envelope| {
6531 ::fidl_next::FromWire::from_wire(unsafe {
6532 envelope.read_unchecked::<::fidl_next::ClientEnd<
6533 ::fidl_next::fuchsia::WireChannel,
6534 ::fidl_next_fuchsia_device_fs::Connector,
6535 >>()
6536 })
6537 }),
6538
6539 class_name: class_name.map(|envelope| {
6540 ::fidl_next::FromWire::from_wire(unsafe {
6541 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
6542 })
6543 }),
6544
6545 inspect: inspect.map(|envelope| {
6546 ::fidl_next::FromWire::from_wire(unsafe {
6547 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
6548 })
6549 }),
6550
6551 connector_supports: connector_supports.map(|envelope| {
6552 ::fidl_next::FromWire::from_wire(unsafe {
6553 envelope.read_unchecked::<::fidl_next_fuchsia_device_fs::WireConnectionType>()
6554 })
6555 }),
6556
6557 controller_connector: controller_connector.map(|envelope| {
6558 ::fidl_next::FromWire::from_wire(unsafe {
6559 envelope.read_unchecked::<::fidl_next::ClientEnd<
6560 ::fidl_next::fuchsia::WireChannel,
6561 ::fidl_next_fuchsia_device_fs::Connector,
6562 >>()
6563 })
6564 }),
6565 }
6566 }
6567}
6568
6569#[repr(C)]
6571pub struct WireDevfsAddArgs<'de> {
6572 table: ::fidl_next::WireTable<'de>,
6573}
6574
6575impl<'de> Drop for WireDevfsAddArgs<'de> {
6576 fn drop(&mut self) {
6577 let _ = self.table.get(1).map(|envelope| unsafe {
6578 envelope.read_unchecked::<::fidl_next::ClientEnd<
6579 ::fidl_next::fuchsia::WireChannel,
6580 ::fidl_next_fuchsia_device_fs::Connector,
6581 >>()
6582 });
6583
6584 let _ = self
6585 .table
6586 .get(2)
6587 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
6588
6589 let _ = self.table.get(3).map(|envelope| unsafe {
6590 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
6591 });
6592
6593 let _ = self.table.get(4).map(|envelope| unsafe {
6594 envelope.read_unchecked::<::fidl_next_fuchsia_device_fs::WireConnectionType>()
6595 });
6596
6597 let _ = self.table.get(5).map(|envelope| unsafe {
6598 envelope.read_unchecked::<::fidl_next::ClientEnd<
6599 ::fidl_next::fuchsia::WireChannel,
6600 ::fidl_next_fuchsia_device_fs::Connector,
6601 >>()
6602 });
6603 }
6604}
6605
6606unsafe impl ::fidl_next::Wire for WireDevfsAddArgs<'static> {
6607 type Decoded<'de> = WireDevfsAddArgs<'de>;
6608
6609 #[inline]
6610 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6611 ::fidl_next::munge!(let Self { table } = out);
6612 ::fidl_next::WireTable::zero_padding(table);
6613 }
6614}
6615
6616unsafe impl<___D> ::fidl_next::Decode<___D> for WireDevfsAddArgs<'static>
6617where
6618 ___D: ::fidl_next::Decoder + ?Sized,
6619
6620 ___D: ::fidl_next::fuchsia::HandleDecoder,
6621{
6622 fn decode(
6623 slot: ::fidl_next::Slot<'_, Self>,
6624 decoder: &mut ___D,
6625 ) -> Result<(), ::fidl_next::DecodeError> {
6626 ::fidl_next::munge!(let Self { table } = slot);
6627
6628 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
6629 match ordinal {
6630 0 => unsafe { ::core::hint::unreachable_unchecked() },
6631
6632 1 => {
6633 ::fidl_next::WireEnvelope::decode_as::<
6634 ___D,
6635 ::fidl_next::ClientEnd<
6636 ::fidl_next::fuchsia::WireChannel,
6637 ::fidl_next_fuchsia_device_fs::Connector,
6638 >,
6639 >(slot.as_mut(), decoder)?;
6640
6641 Ok(())
6642 }
6643
6644 2 => {
6645 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
6646 slot.as_mut(),
6647 decoder,
6648 )?;
6649
6650 let class_name = unsafe {
6651 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
6652 };
6653
6654 if class_name.len() > 255 {
6655 return Err(::fidl_next::DecodeError::VectorTooLong {
6656 size: class_name.len() as u64,
6657 limit: 255,
6658 });
6659 }
6660
6661 Ok(())
6662 }
6663
6664 3 => {
6665 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
6666 slot.as_mut(),
6667 decoder,
6668 )?;
6669
6670 Ok(())
6671 }
6672
6673 4 => {
6674 ::fidl_next::WireEnvelope::decode_as::<
6675 ___D,
6676 ::fidl_next_fuchsia_device_fs::WireConnectionType,
6677 >(slot.as_mut(), decoder)?;
6678
6679 Ok(())
6680 }
6681
6682 5 => {
6683 ::fidl_next::WireEnvelope::decode_as::<
6684 ___D,
6685 ::fidl_next::ClientEnd<
6686 ::fidl_next::fuchsia::WireChannel,
6687 ::fidl_next_fuchsia_device_fs::Connector,
6688 >,
6689 >(slot.as_mut(), decoder)?;
6690
6691 Ok(())
6692 }
6693
6694 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
6695 }
6696 })
6697 }
6698}
6699
6700impl<'de> WireDevfsAddArgs<'de> {
6701 pub fn connector(
6702 &self,
6703 ) -> Option<
6704 &::fidl_next::ClientEnd<
6705 ::fidl_next::fuchsia::WireChannel,
6706 ::fidl_next_fuchsia_device_fs::Connector,
6707 >,
6708 > {
6709 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
6710 }
6711
6712 pub fn class_name(&self) -> Option<&::fidl_next::WireString<'de>> {
6713 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
6714 }
6715
6716 pub fn inspect(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
6717 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
6718 }
6719
6720 pub fn connector_supports(&self) -> Option<&::fidl_next_fuchsia_device_fs::WireConnectionType> {
6721 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
6722 }
6723
6724 pub fn controller_connector(
6725 &self,
6726 ) -> Option<
6727 &::fidl_next::ClientEnd<
6728 ::fidl_next::fuchsia::WireChannel,
6729 ::fidl_next_fuchsia_device_fs::Connector,
6730 >,
6731 > {
6732 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
6733 }
6734}
6735
6736impl<'de> ::core::fmt::Debug for WireDevfsAddArgs<'de> {
6737 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
6738 f.debug_struct("DevfsAddArgs")
6739 .field("connector", &self.connector())
6740 .field("class_name", &self.class_name())
6741 .field("inspect", &self.inspect())
6742 .field("connector_supports", &self.connector_supports())
6743 .field("controller_connector", &self.controller_connector())
6744 .finish()
6745 }
6746}
6747
6748pub const MAX_SYMBOL_NAME_LENGTH: u8 = 128;
6749
6750pub const MAX_SYMBOL_COUNT: u8 = 64;
6751
6752pub const MAX_NAMESPACE_COUNT: u32 = 32;
6753
6754pub type DriverStartResponse = ();
6755
6756pub type WireDriverStartResponse = ();
6758
6759pub const MAX_NODE_NAME_LENGTH: u8 = 128;
6760
6761pub type NodeName = String;
6762
6763pub type WireNodeName<'de> = ::fidl_next::WireString<'de>;
6765
6766pub type NodePropertyVector = Vec<crate::NodeProperty>;
6767
6768pub type WireNodePropertyVector<'de> = ::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>;
6770
6771pub const MAX_OFFER_COUNT: u32 = 128;
6772
6773#[doc = " Contains the node properties that belong to a node.\n"]
6774#[derive(Clone, Debug)]
6775pub struct NodePropertyEntry {
6776 pub name: String,
6777
6778 pub properties: Vec<crate::NodeProperty>,
6779}
6780
6781impl ::fidl_next::Encodable for NodePropertyEntry {
6782 type Encoded = WireNodePropertyEntry<'static>;
6783}
6784
6785unsafe impl<___E> ::fidl_next::Encode<___E> for NodePropertyEntry
6786where
6787 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6788
6789 ___E: ::fidl_next::Encoder,
6790{
6791 #[inline]
6792 fn encode(
6793 self,
6794 encoder: &mut ___E,
6795 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6796 ) -> Result<(), ::fidl_next::EncodeError> {
6797 ::fidl_next::munge! {
6798 let Self::Encoded {
6799 name,
6800 properties,
6801
6802 } = out;
6803 }
6804
6805 ::fidl_next::Encode::encode(self.name, encoder, name)?;
6806
6807 ::fidl_next::Encode::encode(self.properties, encoder, properties)?;
6808
6809 Ok(())
6810 }
6811}
6812
6813unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodePropertyEntry
6814where
6815 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6816
6817 ___E: ::fidl_next::Encoder,
6818{
6819 #[inline]
6820 fn encode_ref(
6821 &self,
6822 encoder: &mut ___E,
6823 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6824 ) -> Result<(), ::fidl_next::EncodeError> {
6825 ::fidl_next::munge! {
6826 let Self::Encoded {
6827 name,
6828 properties,
6829
6830 } = out;
6831 }
6832
6833 ::fidl_next::EncodeRef::encode_ref(&self.name, encoder, name)?;
6834
6835 ::fidl_next::EncodeRef::encode_ref(&self.properties, encoder, properties)?;
6836
6837 Ok(())
6838 }
6839}
6840
6841impl ::fidl_next::EncodableOption for NodePropertyEntry {
6842 type EncodedOption = ::fidl_next::WireBox<'static, WireNodePropertyEntry<'static>>;
6843}
6844
6845unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NodePropertyEntry
6846where
6847 ___E: ::fidl_next::Encoder + ?Sized,
6848 NodePropertyEntry: ::fidl_next::Encode<___E>,
6849{
6850 #[inline]
6851 fn encode_option(
6852 this: Option<Self>,
6853 encoder: &mut ___E,
6854 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
6855 ) -> Result<(), ::fidl_next::EncodeError> {
6856 if let Some(inner) = this {
6857 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
6858 ::fidl_next::WireBox::encode_present(out);
6859 } else {
6860 ::fidl_next::WireBox::encode_absent(out);
6861 }
6862
6863 Ok(())
6864 }
6865}
6866
6867unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for NodePropertyEntry
6868where
6869 ___E: ::fidl_next::Encoder + ?Sized,
6870 NodePropertyEntry: ::fidl_next::EncodeRef<___E>,
6871{
6872 #[inline]
6873 fn encode_option_ref(
6874 this: Option<&Self>,
6875 encoder: &mut ___E,
6876 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
6877 ) -> Result<(), ::fidl_next::EncodeError> {
6878 if let Some(inner) = this {
6879 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
6880 ::fidl_next::WireBox::encode_present(out);
6881 } else {
6882 ::fidl_next::WireBox::encode_absent(out);
6883 }
6884
6885 Ok(())
6886 }
6887}
6888
6889impl<'de> ::fidl_next::FromWire<WireNodePropertyEntry<'de>> for NodePropertyEntry {
6890 #[inline]
6891 fn from_wire(wire: WireNodePropertyEntry<'de>) -> Self {
6892 Self {
6893 name: ::fidl_next::FromWire::from_wire(wire.name),
6894
6895 properties: ::fidl_next::FromWire::from_wire(wire.properties),
6896 }
6897 }
6898}
6899
6900impl<'de> ::fidl_next::FromWireRef<WireNodePropertyEntry<'de>> for NodePropertyEntry {
6901 #[inline]
6902 fn from_wire_ref(wire: &WireNodePropertyEntry<'de>) -> Self {
6903 Self {
6904 name: ::fidl_next::FromWireRef::from_wire_ref(&wire.name),
6905
6906 properties: ::fidl_next::FromWireRef::from_wire_ref(&wire.properties),
6907 }
6908 }
6909}
6910
6911#[derive(Debug)]
6913#[repr(C)]
6914pub struct WireNodePropertyEntry<'de> {
6915 pub name: ::fidl_next::WireString<'de>,
6916
6917 pub properties: ::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>,
6918}
6919
6920unsafe impl ::fidl_next::Wire for WireNodePropertyEntry<'static> {
6921 type Decoded<'de> = WireNodePropertyEntry<'de>;
6922
6923 #[inline]
6924 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
6925}
6926
6927unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodePropertyEntry<'static>
6928where
6929 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6930
6931 ___D: ::fidl_next::Decoder,
6932{
6933 fn decode(
6934 slot: ::fidl_next::Slot<'_, Self>,
6935 decoder: &mut ___D,
6936 ) -> Result<(), ::fidl_next::DecodeError> {
6937 ::fidl_next::munge! {
6938 let Self {
6939 mut name,
6940 mut properties,
6941
6942 } = slot;
6943 }
6944
6945 ::fidl_next::Decode::decode(name.as_mut(), decoder)?;
6946
6947 let name = unsafe { name.deref_unchecked() };
6948
6949 if name.len() > 128 {
6950 return Err(::fidl_next::DecodeError::VectorTooLong {
6951 size: name.len() as u64,
6952 limit: 128,
6953 });
6954 }
6955
6956 ::fidl_next::Decode::decode(properties.as_mut(), decoder)?;
6957
6958 let properties = unsafe { properties.deref_unchecked() };
6959
6960 if properties.len() > 64 {
6961 return Err(::fidl_next::DecodeError::VectorTooLong {
6962 size: properties.len() as u64,
6963 limit: 64,
6964 });
6965 }
6966
6967 Ok(())
6968 }
6969}
6970
6971pub type NodePropertyDictionary = Vec<crate::NodePropertyEntry>;
6972
6973pub type WireNodePropertyDictionary<'de> =
6975 ::fidl_next::WireVector<'de, crate::WireNodePropertyEntry<'de>>;
6976
6977pub type NodeProperties = Vec<crate::NodeProperty2>;
6978
6979pub type WireNodeProperties<'de> = ::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>;
6981
6982#[doc = " Contains the node properties that belong to a node.\n"]
6983#[derive(Clone, Debug)]
6984pub struct NodePropertyEntry2 {
6985 pub name: String,
6986
6987 pub properties: Vec<crate::NodeProperty2>,
6988}
6989
6990impl ::fidl_next::Encodable for NodePropertyEntry2 {
6991 type Encoded = WireNodePropertyEntry2<'static>;
6992}
6993
6994unsafe impl<___E> ::fidl_next::Encode<___E> for NodePropertyEntry2
6995where
6996 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6997
6998 ___E: ::fidl_next::Encoder,
6999{
7000 #[inline]
7001 fn encode(
7002 self,
7003 encoder: &mut ___E,
7004 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7005 ) -> Result<(), ::fidl_next::EncodeError> {
7006 ::fidl_next::munge! {
7007 let Self::Encoded {
7008 name,
7009 properties,
7010
7011 } = out;
7012 }
7013
7014 ::fidl_next::Encode::encode(self.name, encoder, name)?;
7015
7016 ::fidl_next::Encode::encode(self.properties, encoder, properties)?;
7017
7018 Ok(())
7019 }
7020}
7021
7022unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodePropertyEntry2
7023where
7024 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
7025
7026 ___E: ::fidl_next::Encoder,
7027{
7028 #[inline]
7029 fn encode_ref(
7030 &self,
7031 encoder: &mut ___E,
7032 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7033 ) -> Result<(), ::fidl_next::EncodeError> {
7034 ::fidl_next::munge! {
7035 let Self::Encoded {
7036 name,
7037 properties,
7038
7039 } = out;
7040 }
7041
7042 ::fidl_next::EncodeRef::encode_ref(&self.name, encoder, name)?;
7043
7044 ::fidl_next::EncodeRef::encode_ref(&self.properties, encoder, properties)?;
7045
7046 Ok(())
7047 }
7048}
7049
7050impl ::fidl_next::EncodableOption for NodePropertyEntry2 {
7051 type EncodedOption = ::fidl_next::WireBox<'static, WireNodePropertyEntry2<'static>>;
7052}
7053
7054unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NodePropertyEntry2
7055where
7056 ___E: ::fidl_next::Encoder + ?Sized,
7057 NodePropertyEntry2: ::fidl_next::Encode<___E>,
7058{
7059 #[inline]
7060 fn encode_option(
7061 this: Option<Self>,
7062 encoder: &mut ___E,
7063 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
7064 ) -> Result<(), ::fidl_next::EncodeError> {
7065 if let Some(inner) = this {
7066 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
7067 ::fidl_next::WireBox::encode_present(out);
7068 } else {
7069 ::fidl_next::WireBox::encode_absent(out);
7070 }
7071
7072 Ok(())
7073 }
7074}
7075
7076unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for NodePropertyEntry2
7077where
7078 ___E: ::fidl_next::Encoder + ?Sized,
7079 NodePropertyEntry2: ::fidl_next::EncodeRef<___E>,
7080{
7081 #[inline]
7082 fn encode_option_ref(
7083 this: Option<&Self>,
7084 encoder: &mut ___E,
7085 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
7086 ) -> Result<(), ::fidl_next::EncodeError> {
7087 if let Some(inner) = this {
7088 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
7089 ::fidl_next::WireBox::encode_present(out);
7090 } else {
7091 ::fidl_next::WireBox::encode_absent(out);
7092 }
7093
7094 Ok(())
7095 }
7096}
7097
7098impl<'de> ::fidl_next::FromWire<WireNodePropertyEntry2<'de>> for NodePropertyEntry2 {
7099 #[inline]
7100 fn from_wire(wire: WireNodePropertyEntry2<'de>) -> Self {
7101 Self {
7102 name: ::fidl_next::FromWire::from_wire(wire.name),
7103
7104 properties: ::fidl_next::FromWire::from_wire(wire.properties),
7105 }
7106 }
7107}
7108
7109impl<'de> ::fidl_next::FromWireRef<WireNodePropertyEntry2<'de>> for NodePropertyEntry2 {
7110 #[inline]
7111 fn from_wire_ref(wire: &WireNodePropertyEntry2<'de>) -> Self {
7112 Self {
7113 name: ::fidl_next::FromWireRef::from_wire_ref(&wire.name),
7114
7115 properties: ::fidl_next::FromWireRef::from_wire_ref(&wire.properties),
7116 }
7117 }
7118}
7119
7120#[derive(Debug)]
7122#[repr(C)]
7123pub struct WireNodePropertyEntry2<'de> {
7124 pub name: ::fidl_next::WireString<'de>,
7125
7126 pub properties: ::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>,
7127}
7128
7129unsafe impl ::fidl_next::Wire for WireNodePropertyEntry2<'static> {
7130 type Decoded<'de> = WireNodePropertyEntry2<'de>;
7131
7132 #[inline]
7133 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
7134}
7135
7136unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodePropertyEntry2<'static>
7137where
7138 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
7139
7140 ___D: ::fidl_next::Decoder,
7141{
7142 fn decode(
7143 slot: ::fidl_next::Slot<'_, Self>,
7144 decoder: &mut ___D,
7145 ) -> Result<(), ::fidl_next::DecodeError> {
7146 ::fidl_next::munge! {
7147 let Self {
7148 mut name,
7149 mut properties,
7150
7151 } = slot;
7152 }
7153
7154 ::fidl_next::Decode::decode(name.as_mut(), decoder)?;
7155
7156 let name = unsafe { name.deref_unchecked() };
7157
7158 if name.len() > 128 {
7159 return Err(::fidl_next::DecodeError::VectorTooLong {
7160 size: name.len() as u64,
7161 limit: 128,
7162 });
7163 }
7164
7165 ::fidl_next::Decode::decode(properties.as_mut(), decoder)?;
7166
7167 let properties = unsafe { properties.deref_unchecked() };
7168
7169 if properties.len() > 64 {
7170 return Err(::fidl_next::DecodeError::VectorTooLong {
7171 size: properties.len() as u64,
7172 limit: 64,
7173 });
7174 }
7175
7176 Ok(())
7177 }
7178}
7179
7180pub type NodePropertyDictionary2 = Vec<crate::NodePropertyEntry2>;
7181
7182pub type WireNodePropertyDictionary2<'de> =
7184 ::fidl_next::WireVector<'de, crate::WireNodePropertyEntry2<'de>>;
7185
7186pub const MAX_MODULE_NAME_LENGTH: u8 = 128;
7187
7188#[doc = " Definition of a symbol provided by a driver for a node. A symbol is local to\n a driver host.\n"]
7189#[derive(Clone, Debug, Default)]
7190pub struct NodeSymbol {
7191 pub name: Option<String>,
7192
7193 pub address: Option<u64>,
7194
7195 pub module_name: Option<String>,
7196}
7197
7198impl NodeSymbol {
7199 fn __max_ordinal(&self) -> usize {
7200 if self.name.is_some() {
7201 return 1;
7202 }
7203
7204 if self.address.is_some() {
7205 return 2;
7206 }
7207
7208 if self.module_name.is_some() {
7209 return 3;
7210 }
7211
7212 0
7213 }
7214}
7215
7216impl ::fidl_next::Encodable for NodeSymbol {
7217 type Encoded = WireNodeSymbol<'static>;
7218}
7219
7220unsafe impl<___E> ::fidl_next::Encode<___E> for NodeSymbol
7221where
7222 ___E: ::fidl_next::Encoder + ?Sized,
7223{
7224 #[inline]
7225 fn encode(
7226 mut self,
7227 encoder: &mut ___E,
7228 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7229 ) -> Result<(), ::fidl_next::EncodeError> {
7230 ::fidl_next::munge!(let WireNodeSymbol { table } = out);
7231
7232 let max_ord = self.__max_ordinal();
7233
7234 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7235 ::fidl_next::Wire::zero_padding(&mut out);
7236
7237 let mut preallocated =
7238 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7239
7240 for i in 1..=max_ord {
7241 match i {
7242 3 => {
7243 if let Some(module_name) = self.module_name.take() {
7244 ::fidl_next::WireEnvelope::encode_value(
7245 module_name,
7246 preallocated.encoder,
7247 &mut out,
7248 )?;
7249 } else {
7250 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7251 }
7252 }
7253
7254 2 => {
7255 if let Some(address) = self.address.take() {
7256 ::fidl_next::WireEnvelope::encode_value(
7257 address,
7258 preallocated.encoder,
7259 &mut out,
7260 )?;
7261 } else {
7262 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7263 }
7264 }
7265
7266 1 => {
7267 if let Some(name) = self.name.take() {
7268 ::fidl_next::WireEnvelope::encode_value(
7269 name,
7270 preallocated.encoder,
7271 &mut out,
7272 )?;
7273 } else {
7274 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7275 }
7276 }
7277
7278 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7279 }
7280 unsafe {
7281 preallocated.write_next(out.assume_init_ref());
7282 }
7283 }
7284
7285 ::fidl_next::WireTable::encode_len(table, max_ord);
7286
7287 Ok(())
7288 }
7289}
7290
7291unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodeSymbol
7292where
7293 ___E: ::fidl_next::Encoder + ?Sized,
7294{
7295 #[inline]
7296 fn encode_ref(
7297 &self,
7298 encoder: &mut ___E,
7299 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7300 ) -> Result<(), ::fidl_next::EncodeError> {
7301 ::fidl_next::munge!(let WireNodeSymbol { table } = out);
7302
7303 let max_ord = self.__max_ordinal();
7304
7305 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7306 ::fidl_next::Wire::zero_padding(&mut out);
7307
7308 let mut preallocated =
7309 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7310
7311 for i in 1..=max_ord {
7312 match i {
7313 3 => {
7314 if let Some(module_name) = &self.module_name {
7315 ::fidl_next::WireEnvelope::encode_value(
7316 module_name,
7317 preallocated.encoder,
7318 &mut out,
7319 )?;
7320 } else {
7321 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7322 }
7323 }
7324
7325 2 => {
7326 if let Some(address) = &self.address {
7327 ::fidl_next::WireEnvelope::encode_value(
7328 address,
7329 preallocated.encoder,
7330 &mut out,
7331 )?;
7332 } else {
7333 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7334 }
7335 }
7336
7337 1 => {
7338 if let Some(name) = &self.name {
7339 ::fidl_next::WireEnvelope::encode_value(
7340 name,
7341 preallocated.encoder,
7342 &mut out,
7343 )?;
7344 } else {
7345 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7346 }
7347 }
7348
7349 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7350 }
7351 unsafe {
7352 preallocated.write_next(out.assume_init_ref());
7353 }
7354 }
7355
7356 ::fidl_next::WireTable::encode_len(table, max_ord);
7357
7358 Ok(())
7359 }
7360}
7361
7362impl<'de> ::fidl_next::FromWire<WireNodeSymbol<'de>> for NodeSymbol {
7363 #[inline]
7364 fn from_wire(wire: WireNodeSymbol<'de>) -> Self {
7365 let wire = ::core::mem::ManuallyDrop::new(wire);
7366
7367 let name = wire.table.get(1);
7368
7369 let address = wire.table.get(2);
7370
7371 let module_name = wire.table.get(3);
7372
7373 Self {
7374 name: name.map(|envelope| {
7375 ::fidl_next::FromWire::from_wire(unsafe {
7376 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
7377 })
7378 }),
7379
7380 address: address.map(|envelope| {
7381 ::fidl_next::FromWire::from_wire(unsafe {
7382 envelope.read_unchecked::<::fidl_next::WireU64>()
7383 })
7384 }),
7385
7386 module_name: module_name.map(|envelope| {
7387 ::fidl_next::FromWire::from_wire(unsafe {
7388 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
7389 })
7390 }),
7391 }
7392 }
7393}
7394
7395impl<'de> ::fidl_next::FromWireRef<WireNodeSymbol<'de>> for NodeSymbol {
7396 #[inline]
7397 fn from_wire_ref(wire: &WireNodeSymbol<'de>) -> Self {
7398 Self {
7399 name: wire.table.get(1).map(|envelope| {
7400 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
7401 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
7402 })
7403 }),
7404
7405 address: wire.table.get(2).map(|envelope| {
7406 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
7407 envelope.deref_unchecked::<::fidl_next::WireU64>()
7408 })
7409 }),
7410
7411 module_name: wire.table.get(3).map(|envelope| {
7412 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
7413 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
7414 })
7415 }),
7416 }
7417 }
7418}
7419
7420#[repr(C)]
7422pub struct WireNodeSymbol<'de> {
7423 table: ::fidl_next::WireTable<'de>,
7424}
7425
7426impl<'de> Drop for WireNodeSymbol<'de> {
7427 fn drop(&mut self) {
7428 let _ = self
7429 .table
7430 .get(1)
7431 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
7432
7433 let _ = self
7434 .table
7435 .get(2)
7436 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireU64>() });
7437
7438 let _ = self
7439 .table
7440 .get(3)
7441 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
7442 }
7443}
7444
7445unsafe impl ::fidl_next::Wire for WireNodeSymbol<'static> {
7446 type Decoded<'de> = WireNodeSymbol<'de>;
7447
7448 #[inline]
7449 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
7450 ::fidl_next::munge!(let Self { table } = out);
7451 ::fidl_next::WireTable::zero_padding(table);
7452 }
7453}
7454
7455unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeSymbol<'static>
7456where
7457 ___D: ::fidl_next::Decoder + ?Sized,
7458{
7459 fn decode(
7460 slot: ::fidl_next::Slot<'_, Self>,
7461 decoder: &mut ___D,
7462 ) -> Result<(), ::fidl_next::DecodeError> {
7463 ::fidl_next::munge!(let Self { table } = slot);
7464
7465 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
7466 match ordinal {
7467 0 => unsafe { ::core::hint::unreachable_unchecked() },
7468
7469 1 => {
7470 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
7471 slot.as_mut(),
7472 decoder,
7473 )?;
7474
7475 let name = unsafe {
7476 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
7477 };
7478
7479 if name.len() > 128 {
7480 return Err(::fidl_next::DecodeError::VectorTooLong {
7481 size: name.len() as u64,
7482 limit: 128,
7483 });
7484 }
7485
7486 Ok(())
7487 }
7488
7489 2 => {
7490 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireU64>(
7491 slot.as_mut(),
7492 decoder,
7493 )?;
7494
7495 Ok(())
7496 }
7497
7498 3 => {
7499 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
7500 slot.as_mut(),
7501 decoder,
7502 )?;
7503
7504 let module_name = unsafe {
7505 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
7506 };
7507
7508 if module_name.len() > 128 {
7509 return Err(::fidl_next::DecodeError::VectorTooLong {
7510 size: module_name.len() as u64,
7511 limit: 128,
7512 });
7513 }
7514
7515 Ok(())
7516 }
7517
7518 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
7519 }
7520 })
7521 }
7522}
7523
7524impl<'de> WireNodeSymbol<'de> {
7525 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
7526 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
7527 }
7528
7529 pub fn address(&self) -> Option<&::fidl_next::WireU64> {
7530 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
7531 }
7532
7533 pub fn module_name(&self) -> Option<&::fidl_next::WireString<'de>> {
7534 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
7535 }
7536}
7537
7538impl<'de> ::core::fmt::Debug for WireNodeSymbol<'de> {
7539 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
7540 f.debug_struct("NodeSymbol")
7541 .field("name", &self.name())
7542 .field("address", &self.address())
7543 .field("module_name", &self.module_name())
7544 .finish()
7545 }
7546}
7547
7548#[derive(Clone, Debug)]
7549pub enum Offer {
7550 ZirconTransport(::fidl_next_fuchsia_component_decl::Offer),
7551
7552 DriverTransport(::fidl_next_fuchsia_component_decl::Offer),
7553
7554 UnknownOrdinal_(u64),
7555}
7556
7557impl ::fidl_next::Encodable for Offer {
7558 type Encoded = WireOffer<'static>;
7559}
7560
7561unsafe impl<___E> ::fidl_next::Encode<___E> for Offer
7562where
7563 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
7564
7565 ___E: ::fidl_next::Encoder,
7566{
7567 #[inline]
7568 fn encode(
7569 self,
7570 encoder: &mut ___E,
7571 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7572 ) -> Result<(), ::fidl_next::EncodeError> {
7573 ::fidl_next::munge!(let WireOffer { raw, _phantom: _ } = out);
7574
7575 match self {
7576 Self::ZirconTransport(value) => ::fidl_next::RawWireUnion::encode_as::<
7577 ___E,
7578 ::fidl_next_fuchsia_component_decl::Offer,
7579 >(value, 1, encoder, raw)?,
7580
7581 Self::DriverTransport(value) => ::fidl_next::RawWireUnion::encode_as::<
7582 ___E,
7583 ::fidl_next_fuchsia_component_decl::Offer,
7584 >(value, 2, encoder, raw)?,
7585
7586 Self::UnknownOrdinal_(ordinal) => {
7587 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
7588 }
7589 }
7590
7591 Ok(())
7592 }
7593}
7594
7595unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Offer
7596where
7597 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
7598
7599 ___E: ::fidl_next::Encoder,
7600{
7601 #[inline]
7602 fn encode_ref(
7603 &self,
7604 encoder: &mut ___E,
7605 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7606 ) -> Result<(), ::fidl_next::EncodeError> {
7607 ::fidl_next::munge!(let WireOffer { raw, _phantom: _ } = out);
7608
7609 match self {
7610 Self::ZirconTransport(value) => ::fidl_next::RawWireUnion::encode_as::<
7611 ___E,
7612 &::fidl_next_fuchsia_component_decl::Offer,
7613 >(value, 1, encoder, raw)?,
7614
7615 Self::DriverTransport(value) => ::fidl_next::RawWireUnion::encode_as::<
7616 ___E,
7617 &::fidl_next_fuchsia_component_decl::Offer,
7618 >(value, 2, encoder, raw)?,
7619
7620 Self::UnknownOrdinal_(ordinal) => {
7621 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
7622 }
7623 }
7624
7625 Ok(())
7626 }
7627}
7628
7629impl ::fidl_next::EncodableOption for Offer {
7630 type EncodedOption = WireOptionalOffer<'static>;
7631}
7632
7633unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Offer
7634where
7635 ___E: ?Sized,
7636 Offer: ::fidl_next::Encode<___E>,
7637{
7638 #[inline]
7639 fn encode_option(
7640 this: Option<Self>,
7641 encoder: &mut ___E,
7642 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
7643 ) -> Result<(), ::fidl_next::EncodeError> {
7644 ::fidl_next::munge!(let WireOptionalOffer { raw, _phantom: _ } = &mut *out);
7645
7646 if let Some(inner) = this {
7647 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
7648 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
7649 } else {
7650 ::fidl_next::RawWireUnion::encode_absent(raw);
7651 }
7652
7653 Ok(())
7654 }
7655}
7656
7657unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Offer
7658where
7659 ___E: ?Sized,
7660 Offer: ::fidl_next::EncodeRef<___E>,
7661{
7662 #[inline]
7663 fn encode_option_ref(
7664 this: Option<&Self>,
7665 encoder: &mut ___E,
7666 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
7667 ) -> Result<(), ::fidl_next::EncodeError> {
7668 ::fidl_next::munge!(let WireOptionalOffer { raw, _phantom: _ } = &mut *out);
7669
7670 if let Some(inner) = this {
7671 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
7672 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
7673 } else {
7674 ::fidl_next::RawWireUnion::encode_absent(raw);
7675 }
7676
7677 Ok(())
7678 }
7679}
7680
7681impl<'de> ::fidl_next::FromWire<WireOffer<'de>> for Offer {
7682 #[inline]
7683 fn from_wire(wire: WireOffer<'de>) -> Self {
7684 let wire = ::core::mem::ManuallyDrop::new(wire);
7685 match wire.raw.ordinal() {
7686 1 => Self::ZirconTransport(::fidl_next::FromWire::from_wire(unsafe {
7687 wire.raw
7688 .get()
7689 .read_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'de>>()
7690 })),
7691
7692 2 => Self::DriverTransport(::fidl_next::FromWire::from_wire(unsafe {
7693 wire.raw
7694 .get()
7695 .read_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'de>>()
7696 })),
7697
7698 _ => unsafe { ::core::hint::unreachable_unchecked() },
7699 }
7700 }
7701}
7702
7703impl<'de> ::fidl_next::FromWireRef<WireOffer<'de>> for Offer {
7704 #[inline]
7705 fn from_wire_ref(wire: &WireOffer<'de>) -> Self {
7706 match wire.raw.ordinal() {
7707 1 => Self::ZirconTransport(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7708 wire.raw
7709 .get()
7710 .deref_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'de>>()
7711 })),
7712
7713 2 => Self::DriverTransport(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7714 wire.raw
7715 .get()
7716 .deref_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'de>>()
7717 })),
7718
7719 _ => unsafe { ::core::hint::unreachable_unchecked() },
7720 }
7721 }
7722}
7723
7724impl<'de> ::fidl_next::FromWireOption<WireOptionalOffer<'de>> for Box<Offer> {
7725 #[inline]
7726 fn from_wire_option(wire: WireOptionalOffer<'de>) -> Option<Self> {
7727 if let Some(inner) = wire.into_option() {
7728 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
7729 } else {
7730 None
7731 }
7732 }
7733}
7734
7735impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalOffer<'de>> for Box<Offer> {
7736 #[inline]
7737 fn from_wire_option_ref(wire: &WireOptionalOffer<'de>) -> Option<Self> {
7738 if let Some(inner) = wire.as_ref() {
7739 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
7740 } else {
7741 None
7742 }
7743 }
7744}
7745
7746#[repr(transparent)]
7748pub struct WireOffer<'de> {
7749 raw: ::fidl_next::RawWireUnion,
7750 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
7751}
7752
7753impl<'de> Drop for WireOffer<'de> {
7754 fn drop(&mut self) {
7755 match self.raw.ordinal() {
7756 1 => {
7757 let _ = unsafe {
7758 self.raw
7759 .get()
7760 .read_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'de>>()
7761 };
7762 }
7763
7764 2 => {
7765 let _ = unsafe {
7766 self.raw
7767 .get()
7768 .read_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'de>>()
7769 };
7770 }
7771
7772 _ => (),
7773 }
7774 }
7775}
7776
7777unsafe impl ::fidl_next::Wire for WireOffer<'static> {
7778 type Decoded<'de> = WireOffer<'de>;
7779
7780 #[inline]
7781 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
7782 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
7783 ::fidl_next::RawWireUnion::zero_padding(raw);
7784 }
7785}
7786
7787pub mod offer {
7788 pub enum Ref<'de> {
7789 ZirconTransport(&'de ::fidl_next_fuchsia_component_decl::WireOffer<'de>),
7790
7791 DriverTransport(&'de ::fidl_next_fuchsia_component_decl::WireOffer<'de>),
7792
7793 UnknownOrdinal_(u64),
7794 }
7795}
7796
7797impl<'de> WireOffer<'de> {
7798 pub fn as_ref(&self) -> crate::offer::Ref<'_> {
7799 match self.raw.ordinal() {
7800 1 => crate::offer::Ref::ZirconTransport(unsafe {
7801 self.raw
7802 .get()
7803 .deref_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'_>>()
7804 }),
7805
7806 2 => crate::offer::Ref::DriverTransport(unsafe {
7807 self.raw
7808 .get()
7809 .deref_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'_>>()
7810 }),
7811
7812 unknown => crate::offer::Ref::UnknownOrdinal_(unknown),
7813 }
7814 }
7815}
7816
7817unsafe impl<___D> ::fidl_next::Decode<___D> for WireOffer<'static>
7818where
7819 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
7820
7821 ___D: ::fidl_next::Decoder,
7822{
7823 fn decode(
7824 mut slot: ::fidl_next::Slot<'_, Self>,
7825 decoder: &mut ___D,
7826 ) -> Result<(), ::fidl_next::DecodeError> {
7827 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
7828 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
7829 1 => ::fidl_next::RawWireUnion::decode_as::<
7830 ___D,
7831 ::fidl_next_fuchsia_component_decl::WireOffer<'static>,
7832 >(raw, decoder)?,
7833
7834 2 => ::fidl_next::RawWireUnion::decode_as::<
7835 ___D,
7836 ::fidl_next_fuchsia_component_decl::WireOffer<'static>,
7837 >(raw, decoder)?,
7838
7839 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
7840 }
7841
7842 Ok(())
7843 }
7844}
7845
7846impl<'de> ::core::fmt::Debug for WireOffer<'de> {
7847 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7848 match self.raw.ordinal() {
7849 1 => unsafe {
7850 self.raw
7851 .get()
7852 .deref_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'_>>()
7853 .fmt(f)
7854 },
7855 2 => unsafe {
7856 self.raw
7857 .get()
7858 .deref_unchecked::<::fidl_next_fuchsia_component_decl::WireOffer<'_>>()
7859 .fmt(f)
7860 },
7861 _ => unsafe { ::core::hint::unreachable_unchecked() },
7862 }
7863 }
7864}
7865
7866#[repr(transparent)]
7867pub struct WireOptionalOffer<'de> {
7868 raw: ::fidl_next::RawWireUnion,
7869 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
7870}
7871
7872unsafe impl ::fidl_next::Wire for WireOptionalOffer<'static> {
7873 type Decoded<'de> = WireOptionalOffer<'de>;
7874
7875 #[inline]
7876 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
7877 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
7878 ::fidl_next::RawWireUnion::zero_padding(raw);
7879 }
7880}
7881
7882impl<'de> WireOptionalOffer<'de> {
7883 pub fn is_some(&self) -> bool {
7884 self.raw.is_some()
7885 }
7886
7887 pub fn is_none(&self) -> bool {
7888 self.raw.is_none()
7889 }
7890
7891 pub fn as_ref(&self) -> Option<&WireOffer<'de>> {
7892 if self.is_some() {
7893 Some(unsafe { &*(self as *const Self).cast() })
7894 } else {
7895 None
7896 }
7897 }
7898
7899 pub fn into_option(self) -> Option<WireOffer<'de>> {
7900 if self.is_some() {
7901 Some(WireOffer { raw: self.raw, _phantom: ::core::marker::PhantomData })
7902 } else {
7903 None
7904 }
7905 }
7906}
7907
7908unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalOffer<'static>
7909where
7910 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
7911
7912 ___D: ::fidl_next::Decoder,
7913{
7914 fn decode(
7915 mut slot: ::fidl_next::Slot<'_, Self>,
7916 decoder: &mut ___D,
7917 ) -> Result<(), ::fidl_next::DecodeError> {
7918 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
7919 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
7920 1 => ::fidl_next::RawWireUnion::decode_as::<
7921 ___D,
7922 ::fidl_next_fuchsia_component_decl::WireOffer<'static>,
7923 >(raw, decoder)?,
7924
7925 2 => ::fidl_next::RawWireUnion::decode_as::<
7926 ___D,
7927 ::fidl_next_fuchsia_component_decl::WireOffer<'static>,
7928 >(raw, decoder)?,
7929
7930 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
7931 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
7932 }
7933
7934 Ok(())
7935 }
7936}
7937
7938impl<'de> ::core::fmt::Debug for WireOptionalOffer<'de> {
7939 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7940 self.as_ref().fmt(f)
7941 }
7942}
7943
7944pub type NodeOffersVector = Vec<crate::Offer>;
7945
7946pub type WireNodeOffersVector<'de> = ::fidl_next::WireVector<'de, crate::WireOffer<'de>>;
7948
7949#[doc = " Arguments for starting a driver.\n"]
7950#[derive(Debug, Default)]
7951pub struct DriverStartArgs {
7952 pub node: Option<::fidl_next::ClientEnd<::fidl_next::fuchsia::zx::Channel, crate::Node>>,
7953
7954 pub symbols: Option<Vec<crate::NodeSymbol>>,
7955
7956 pub url: Option<String>,
7957
7958 pub program: Option<::fidl_next_fuchsia_data::Dictionary>,
7959
7960 pub incoming: Option<Vec<::fidl_next_fuchsia_component_runner::ComponentNamespaceEntry>>,
7961
7962 pub outgoing_dir: Option<
7963 ::fidl_next::ServerEnd<
7964 ::fidl_next::fuchsia::zx::Channel,
7965 ::fidl_next_fuchsia_io::Directory,
7966 >,
7967 >,
7968
7969 pub config: Option<::fidl_next::fuchsia::zx::Handle>,
7970
7971 pub node_name: Option<String>,
7972
7973 pub node_properties: Option<Vec<crate::NodePropertyEntry>>,
7974
7975 pub node_offers: Option<Vec<crate::Offer>>,
7976
7977 pub node_token: Option<::fidl_next::fuchsia::zx::Handle>,
7978
7979 pub node_properties_2: Option<Vec<crate::NodePropertyEntry2>>,
7980}
7981
7982impl DriverStartArgs {
7983 fn __max_ordinal(&self) -> usize {
7984 if self.node.is_some() {
7985 return 1;
7986 }
7987
7988 if self.symbols.is_some() {
7989 return 2;
7990 }
7991
7992 if self.url.is_some() {
7993 return 3;
7994 }
7995
7996 if self.program.is_some() {
7997 return 4;
7998 }
7999
8000 if self.incoming.is_some() {
8001 return 5;
8002 }
8003
8004 if self.outgoing_dir.is_some() {
8005 return 6;
8006 }
8007
8008 if self.config.is_some() {
8009 return 7;
8010 }
8011
8012 if self.node_name.is_some() {
8013 return 8;
8014 }
8015
8016 if self.node_properties.is_some() {
8017 return 9;
8018 }
8019
8020 if self.node_offers.is_some() {
8021 return 10;
8022 }
8023
8024 if self.node_token.is_some() {
8025 return 11;
8026 }
8027
8028 if self.node_properties_2.is_some() {
8029 return 12;
8030 }
8031
8032 0
8033 }
8034}
8035
8036impl ::fidl_next::Encodable for DriverStartArgs {
8037 type Encoded = WireDriverStartArgs<'static>;
8038}
8039
8040unsafe impl<___E> ::fidl_next::Encode<___E> for DriverStartArgs
8041where
8042 ___E: ::fidl_next::Encoder + ?Sized,
8043
8044 ___E: ::fidl_next::fuchsia::HandleEncoder,
8045{
8046 #[inline]
8047 fn encode(
8048 mut self,
8049 encoder: &mut ___E,
8050 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8051 ) -> Result<(), ::fidl_next::EncodeError> {
8052 ::fidl_next::munge!(let WireDriverStartArgs { table } = out);
8053
8054 let max_ord = self.__max_ordinal();
8055
8056 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
8057 ::fidl_next::Wire::zero_padding(&mut out);
8058
8059 let mut preallocated =
8060 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
8061
8062 for i in 1..=max_ord {
8063 match i {
8064 12 => {
8065 if let Some(node_properties_2) = self.node_properties_2.take() {
8066 ::fidl_next::WireEnvelope::encode_value(
8067 node_properties_2,
8068 preallocated.encoder,
8069 &mut out,
8070 )?;
8071 } else {
8072 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8073 }
8074 }
8075
8076 11 => {
8077 if let Some(node_token) = self.node_token.take() {
8078 ::fidl_next::WireEnvelope::encode_value(
8079 node_token,
8080 preallocated.encoder,
8081 &mut out,
8082 )?;
8083 } else {
8084 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8085 }
8086 }
8087
8088 10 => {
8089 if let Some(node_offers) = self.node_offers.take() {
8090 ::fidl_next::WireEnvelope::encode_value(
8091 node_offers,
8092 preallocated.encoder,
8093 &mut out,
8094 )?;
8095 } else {
8096 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8097 }
8098 }
8099
8100 9 => {
8101 if let Some(node_properties) = self.node_properties.take() {
8102 ::fidl_next::WireEnvelope::encode_value(
8103 node_properties,
8104 preallocated.encoder,
8105 &mut out,
8106 )?;
8107 } else {
8108 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8109 }
8110 }
8111
8112 8 => {
8113 if let Some(node_name) = self.node_name.take() {
8114 ::fidl_next::WireEnvelope::encode_value(
8115 node_name,
8116 preallocated.encoder,
8117 &mut out,
8118 )?;
8119 } else {
8120 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8121 }
8122 }
8123
8124 7 => {
8125 if let Some(config) = self.config.take() {
8126 ::fidl_next::WireEnvelope::encode_value(
8127 config,
8128 preallocated.encoder,
8129 &mut out,
8130 )?;
8131 } else {
8132 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8133 }
8134 }
8135
8136 6 => {
8137 if let Some(outgoing_dir) = self.outgoing_dir.take() {
8138 ::fidl_next::WireEnvelope::encode_value(
8139 outgoing_dir,
8140 preallocated.encoder,
8141 &mut out,
8142 )?;
8143 } else {
8144 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8145 }
8146 }
8147
8148 5 => {
8149 if let Some(incoming) = self.incoming.take() {
8150 ::fidl_next::WireEnvelope::encode_value(
8151 incoming,
8152 preallocated.encoder,
8153 &mut out,
8154 )?;
8155 } else {
8156 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8157 }
8158 }
8159
8160 4 => {
8161 if let Some(program) = self.program.take() {
8162 ::fidl_next::WireEnvelope::encode_value(
8163 program,
8164 preallocated.encoder,
8165 &mut out,
8166 )?;
8167 } else {
8168 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8169 }
8170 }
8171
8172 3 => {
8173 if let Some(url) = self.url.take() {
8174 ::fidl_next::WireEnvelope::encode_value(
8175 url,
8176 preallocated.encoder,
8177 &mut out,
8178 )?;
8179 } else {
8180 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8181 }
8182 }
8183
8184 2 => {
8185 if let Some(symbols) = self.symbols.take() {
8186 ::fidl_next::WireEnvelope::encode_value(
8187 symbols,
8188 preallocated.encoder,
8189 &mut out,
8190 )?;
8191 } else {
8192 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8193 }
8194 }
8195
8196 1 => {
8197 if let Some(node) = self.node.take() {
8198 ::fidl_next::WireEnvelope::encode_value(
8199 node,
8200 preallocated.encoder,
8201 &mut out,
8202 )?;
8203 } else {
8204 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8205 }
8206 }
8207
8208 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
8209 }
8210 unsafe {
8211 preallocated.write_next(out.assume_init_ref());
8212 }
8213 }
8214
8215 ::fidl_next::WireTable::encode_len(table, max_ord);
8216
8217 Ok(())
8218 }
8219}
8220
8221impl<'de> ::fidl_next::FromWire<WireDriverStartArgs<'de>> for DriverStartArgs {
8222 #[inline]
8223 fn from_wire(wire: WireDriverStartArgs<'de>) -> Self {
8224 let wire = ::core::mem::ManuallyDrop::new(wire);
8225
8226 let node = wire.table.get(1);
8227
8228 let symbols = wire.table.get(2);
8229
8230 let url = wire.table.get(3);
8231
8232 let program = wire.table.get(4);
8233
8234 let incoming = wire.table.get(5);
8235
8236 let outgoing_dir = wire.table.get(6);
8237
8238 let config = wire.table.get(7);
8239
8240 let node_name = wire.table.get(8);
8241
8242 let node_properties = wire.table.get(9);
8243
8244 let node_offers = wire.table.get(10);
8245
8246 let node_token = wire.table.get(11);
8247
8248 let node_properties_2 = wire.table.get(12);
8249
8250 Self {
8251
8252
8253 node: node.map(|envelope| ::fidl_next::FromWire::from_wire(
8254 unsafe { envelope.read_unchecked::<::fidl_next::ClientEnd<::fidl_next::fuchsia::WireChannel,crate::Node,
8255 >>() }
8256 )),
8257
8258
8259 symbols: symbols.map(|envelope| ::fidl_next::FromWire::from_wire(
8260 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>>() }
8261 )),
8262
8263
8264 url: url.map(|envelope| ::fidl_next::FromWire::from_wire(
8265 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
8266 )),
8267
8268
8269 program: program.map(|envelope| ::fidl_next::FromWire::from_wire(
8270 unsafe { envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>() }
8271 )),
8272
8273
8274 incoming: incoming.map(|envelope| ::fidl_next::FromWire::from_wire(
8275 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<'de>>>() }
8276 )),
8277
8278
8279 outgoing_dir: outgoing_dir.map(|envelope| ::fidl_next::FromWire::from_wire(
8280 unsafe { envelope.read_unchecked::<::fidl_next::ServerEnd<::fidl_next::fuchsia::WireChannel,::fidl_next_fuchsia_io::Directory,
8281 >>() }
8282 )),
8283
8284
8285 config: config.map(|envelope| ::fidl_next::FromWire::from_wire(
8286 unsafe { envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>() }
8287 )),
8288
8289
8290 node_name: node_name.map(|envelope| ::fidl_next::FromWire::from_wire(
8291 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
8292 )),
8293
8294
8295 node_properties: node_properties.map(|envelope| ::fidl_next::FromWire::from_wire(
8296 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodePropertyEntry<'de>>>() }
8297 )),
8298
8299
8300 node_offers: node_offers.map(|envelope| ::fidl_next::FromWire::from_wire(
8301 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>() }
8302 )),
8303
8304
8305 node_token: node_token.map(|envelope| ::fidl_next::FromWire::from_wire(
8306 unsafe { envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>() }
8307 )),
8308
8309
8310 node_properties_2: node_properties_2.map(|envelope| ::fidl_next::FromWire::from_wire(
8311 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodePropertyEntry2<'de>>>() }
8312 )),
8313
8314 }
8315 }
8316}
8317
8318#[repr(C)]
8320pub struct WireDriverStartArgs<'de> {
8321 table: ::fidl_next::WireTable<'de>,
8322}
8323
8324impl<'de> Drop for WireDriverStartArgs<'de> {
8325 fn drop(&mut self) {
8326 let _ = self.table.get(1)
8327 .map(|envelope| unsafe {
8328 envelope.read_unchecked::<::fidl_next::ClientEnd<::fidl_next::fuchsia::WireChannel,crate::Node,
8329 >>()
8330 });
8331
8332 let _ = self.table.get(2).map(|envelope| unsafe {
8333 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>>()
8334 });
8335
8336 let _ = self
8337 .table
8338 .get(3)
8339 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
8340
8341 let _ = self.table.get(4).map(|envelope| unsafe {
8342 envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
8343 });
8344
8345 let _ = self.table.get(5).map(|envelope| unsafe {
8346 envelope.read_unchecked::<::fidl_next::WireVector<
8347 'de,
8348 ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<'de>,
8349 >>()
8350 });
8351
8352 let _ = self.table.get(6).map(|envelope| unsafe {
8353 envelope.read_unchecked::<::fidl_next::ServerEnd<
8354 ::fidl_next::fuchsia::WireChannel,
8355 ::fidl_next_fuchsia_io::Directory,
8356 >>()
8357 });
8358
8359 let _ = self.table.get(7).map(|envelope| unsafe {
8360 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
8361 });
8362
8363 let _ = self
8364 .table
8365 .get(8)
8366 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
8367
8368 let _ = self.table.get(9)
8369 .map(|envelope| unsafe {
8370 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodePropertyEntry<'de>>>()
8371 });
8372
8373 let _ = self.table.get(10).map(|envelope| unsafe {
8374 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>()
8375 });
8376
8377 let _ = self.table.get(11).map(|envelope| unsafe {
8378 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
8379 });
8380
8381 let _ = self.table.get(12).map(|envelope| unsafe {
8382 envelope
8383 .read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodePropertyEntry2<'de>>>(
8384 )
8385 });
8386 }
8387}
8388
8389unsafe impl ::fidl_next::Wire for WireDriverStartArgs<'static> {
8390 type Decoded<'de> = WireDriverStartArgs<'de>;
8391
8392 #[inline]
8393 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
8394 ::fidl_next::munge!(let Self { table } = out);
8395 ::fidl_next::WireTable::zero_padding(table);
8396 }
8397}
8398
8399unsafe impl<___D> ::fidl_next::Decode<___D> for WireDriverStartArgs<'static>
8400where
8401 ___D: ::fidl_next::Decoder + ?Sized,
8402
8403 ___D: ::fidl_next::fuchsia::HandleDecoder,
8404{
8405 fn decode(
8406 slot: ::fidl_next::Slot<'_, Self>,
8407 decoder: &mut ___D,
8408 ) -> Result<(), ::fidl_next::DecodeError> {
8409 ::fidl_next::munge!(let Self { table } = slot);
8410
8411 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
8412 match ordinal {
8413 0 => unsafe { ::core::hint::unreachable_unchecked() },
8414
8415 1 => {
8416 ::fidl_next::WireEnvelope::decode_as::<
8417 ___D,
8418 ::fidl_next::ClientEnd<::fidl_next::fuchsia::WireChannel, crate::Node>,
8419 >(slot.as_mut(), decoder)?;
8420
8421 Ok(())
8422 }
8423
8424 2 => {
8425 ::fidl_next::WireEnvelope::decode_as::<
8426 ___D,
8427 ::fidl_next::WireVector<'static, crate::WireNodeSymbol<'static>>,
8428 >(slot.as_mut(), decoder)?;
8429
8430 let symbols = unsafe {
8431 slot
8432 .deref_unchecked()
8433 .deref_unchecked::<
8434 ::fidl_next::WireVector<'_, crate::WireNodeSymbol<'_>>
8435 >()
8436 };
8437
8438 if symbols.len() > 64 {
8439 return Err(::fidl_next::DecodeError::VectorTooLong {
8440 size: symbols.len() as u64,
8441 limit: 64,
8442 });
8443 }
8444
8445 Ok(())
8446 }
8447
8448 3 => {
8449 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
8450 slot.as_mut(),
8451 decoder,
8452 )?;
8453
8454 let url = unsafe {
8455 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
8456 };
8457
8458 if url.len() > 4096 {
8459 return Err(::fidl_next::DecodeError::VectorTooLong {
8460 size: url.len() as u64,
8461 limit: 4096,
8462 });
8463 }
8464
8465 Ok(())
8466 }
8467
8468 4 => {
8469 ::fidl_next::WireEnvelope::decode_as::<
8470 ___D,
8471 ::fidl_next_fuchsia_data::WireDictionary<'static>,
8472 >(slot.as_mut(), decoder)?;
8473
8474 Ok(())
8475 }
8476
8477 5 => {
8478 ::fidl_next::WireEnvelope::decode_as::<
8479 ___D,
8480 ::fidl_next::WireVector<
8481 'static,
8482 ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<
8483 'static,
8484 >,
8485 >,
8486 >(slot.as_mut(), decoder)?;
8487
8488 let incoming = unsafe {
8489 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireVector<
8490 '_,
8491 ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<'_>,
8492 >>()
8493 };
8494
8495 if incoming.len() > 32 {
8496 return Err(::fidl_next::DecodeError::VectorTooLong {
8497 size: incoming.len() as u64,
8498 limit: 32,
8499 });
8500 }
8501
8502 Ok(())
8503 }
8504
8505 6 => {
8506 ::fidl_next::WireEnvelope::decode_as::<
8507 ___D,
8508 ::fidl_next::ServerEnd<
8509 ::fidl_next::fuchsia::WireChannel,
8510 ::fidl_next_fuchsia_io::Directory,
8511 >,
8512 >(slot.as_mut(), decoder)?;
8513
8514 Ok(())
8515 }
8516
8517 7 => {
8518 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
8519 slot.as_mut(),
8520 decoder,
8521 )?;
8522
8523 Ok(())
8524 }
8525
8526 8 => {
8527 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
8528 slot.as_mut(),
8529 decoder,
8530 )?;
8531
8532 Ok(())
8533 }
8534
8535 9 => {
8536 ::fidl_next::WireEnvelope::decode_as::<
8537 ___D,
8538 ::fidl_next::WireVector<'static, crate::WireNodePropertyEntry<'static>>,
8539 >(slot.as_mut(), decoder)?;
8540
8541 Ok(())
8542 }
8543
8544 10 => {
8545 ::fidl_next::WireEnvelope::decode_as::<
8546 ___D,
8547 ::fidl_next::WireVector<'static, crate::WireOffer<'static>>,
8548 >(slot.as_mut(), decoder)?;
8549
8550 let node_offers = unsafe {
8551 slot.deref_unchecked()
8552 .deref_unchecked::<::fidl_next::WireVector<'_, crate::WireOffer<'_>>>()
8553 };
8554
8555 if node_offers.len() > 128 {
8556 return Err(::fidl_next::DecodeError::VectorTooLong {
8557 size: node_offers.len() as u64,
8558 limit: 128,
8559 });
8560 }
8561
8562 Ok(())
8563 }
8564
8565 11 => {
8566 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
8567 slot.as_mut(),
8568 decoder,
8569 )?;
8570
8571 Ok(())
8572 }
8573
8574 12 => {
8575 ::fidl_next::WireEnvelope::decode_as::<
8576 ___D,
8577 ::fidl_next::WireVector<'static, crate::WireNodePropertyEntry2<'static>>,
8578 >(slot.as_mut(), decoder)?;
8579
8580 Ok(())
8581 }
8582
8583 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
8584 }
8585 })
8586 }
8587}
8588
8589impl<'de> WireDriverStartArgs<'de> {
8590 pub fn node(
8591 &self,
8592 ) -> Option<&::fidl_next::ClientEnd<::fidl_next::fuchsia::WireChannel, crate::Node>> {
8593 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
8594 }
8595
8596 pub fn symbols(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>> {
8597 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
8598 }
8599
8600 pub fn url(&self) -> Option<&::fidl_next::WireString<'de>> {
8601 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
8602 }
8603
8604 pub fn program(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary<'de>> {
8605 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
8606 }
8607
8608 pub fn incoming(
8609 &self,
8610 ) -> Option<
8611 &::fidl_next::WireVector<
8612 'de,
8613 ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<'de>,
8614 >,
8615 > {
8616 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
8617 }
8618
8619 pub fn outgoing_dir(
8620 &self,
8621 ) -> Option<
8622 &::fidl_next::ServerEnd<
8623 ::fidl_next::fuchsia::WireChannel,
8624 ::fidl_next_fuchsia_io::Directory,
8625 >,
8626 > {
8627 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
8628 }
8629
8630 pub fn config(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
8631 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
8632 }
8633
8634 pub fn node_name(&self) -> Option<&::fidl_next::WireString<'de>> {
8635 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
8636 }
8637
8638 pub fn node_properties(
8639 &self,
8640 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNodePropertyEntry<'de>>> {
8641 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
8642 }
8643
8644 pub fn node_offers(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireOffer<'de>>> {
8645 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
8646 }
8647
8648 pub fn node_token(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
8649 unsafe { Some(self.table.get(11)?.deref_unchecked()) }
8650 }
8651
8652 pub fn node_properties_2(
8653 &self,
8654 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNodePropertyEntry2<'de>>> {
8655 unsafe { Some(self.table.get(12)?.deref_unchecked()) }
8656 }
8657}
8658
8659impl<'de> ::core::fmt::Debug for WireDriverStartArgs<'de> {
8660 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
8661 f.debug_struct("DriverStartArgs")
8662 .field("node", &self.node())
8663 .field("symbols", &self.symbols())
8664 .field("url", &self.url())
8665 .field("program", &self.program())
8666 .field("incoming", &self.incoming())
8667 .field("outgoing_dir", &self.outgoing_dir())
8668 .field("config", &self.config())
8669 .field("node_name", &self.node_name())
8670 .field("node_properties", &self.node_properties())
8671 .field("node_offers", &self.node_offers())
8672 .field("node_token", &self.node_token())
8673 .field("node_properties_2", &self.node_properties_2())
8674 .finish()
8675 }
8676}
8677
8678#[derive(Debug)]
8679pub struct DriverStartRequest {
8680 pub start_args: crate::DriverStartArgs,
8681}
8682
8683impl ::fidl_next::Encodable for DriverStartRequest {
8684 type Encoded = WireDriverStartRequest<'static>;
8685}
8686
8687unsafe impl<___E> ::fidl_next::Encode<___E> for DriverStartRequest
8688where
8689 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
8690
8691 ___E: ::fidl_next::Encoder,
8692
8693 ___E: ::fidl_next::fuchsia::HandleEncoder,
8694{
8695 #[inline]
8696 fn encode(
8697 self,
8698 encoder: &mut ___E,
8699 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8700 ) -> Result<(), ::fidl_next::EncodeError> {
8701 ::fidl_next::munge! {
8702 let Self::Encoded {
8703 start_args,
8704
8705 } = out;
8706 }
8707
8708 ::fidl_next::Encode::encode(self.start_args, encoder, start_args)?;
8709
8710 Ok(())
8711 }
8712}
8713
8714impl ::fidl_next::EncodableOption for DriverStartRequest {
8715 type EncodedOption = ::fidl_next::WireBox<'static, WireDriverStartRequest<'static>>;
8716}
8717
8718unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DriverStartRequest
8719where
8720 ___E: ::fidl_next::Encoder + ?Sized,
8721 DriverStartRequest: ::fidl_next::Encode<___E>,
8722{
8723 #[inline]
8724 fn encode_option(
8725 this: Option<Self>,
8726 encoder: &mut ___E,
8727 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
8728 ) -> Result<(), ::fidl_next::EncodeError> {
8729 if let Some(inner) = this {
8730 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
8731 ::fidl_next::WireBox::encode_present(out);
8732 } else {
8733 ::fidl_next::WireBox::encode_absent(out);
8734 }
8735
8736 Ok(())
8737 }
8738}
8739
8740impl<'de> ::fidl_next::FromWire<WireDriverStartRequest<'de>> for DriverStartRequest {
8741 #[inline]
8742 fn from_wire(wire: WireDriverStartRequest<'de>) -> Self {
8743 Self { start_args: ::fidl_next::FromWire::from_wire(wire.start_args) }
8744 }
8745}
8746
8747#[derive(Debug)]
8749#[repr(C)]
8750pub struct WireDriverStartRequest<'de> {
8751 pub start_args: crate::WireDriverStartArgs<'de>,
8752}
8753
8754unsafe impl ::fidl_next::Wire for WireDriverStartRequest<'static> {
8755 type Decoded<'de> = WireDriverStartRequest<'de>;
8756
8757 #[inline]
8758 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
8759}
8760
8761unsafe impl<___D> ::fidl_next::Decode<___D> for WireDriverStartRequest<'static>
8762where
8763 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
8764
8765 ___D: ::fidl_next::Decoder,
8766
8767 ___D: ::fidl_next::fuchsia::HandleDecoder,
8768{
8769 fn decode(
8770 slot: ::fidl_next::Slot<'_, Self>,
8771 decoder: &mut ___D,
8772 ) -> Result<(), ::fidl_next::DecodeError> {
8773 ::fidl_next::munge! {
8774 let Self {
8775 mut start_args,
8776
8777 } = slot;
8778 }
8779
8780 ::fidl_next::Decode::decode(start_args.as_mut(), decoder)?;
8781
8782 Ok(())
8783 }
8784}
8785
8786#[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"]
8788#[derive(Debug)]
8789pub struct Driver;
8790
8791pub mod driver {
8792 pub mod prelude {
8793 pub use crate::{
8794 driver, Driver, DriverClientHandler, DriverClientSender, DriverServerHandler,
8795 DriverServerSender,
8796 };
8797
8798 pub use crate::DriverStartRequest;
8799
8800 pub use crate::DriverStartResponse;
8801 }
8802
8803 pub struct Start;
8804
8805 impl ::fidl_next::Method for Start {
8806 const ORDINAL: u64 = 2863727161496985794;
8807
8808 type Protocol = crate::Driver;
8809
8810 type Request = crate::WireDriverStartRequest<'static>;
8811
8812 type Response = ::fidl_next::WireFlexibleResult<
8813 'static,
8814 crate::WireDriverStartResponse,
8815 ::fidl_next::WireI32,
8816 >;
8817 }
8818
8819 pub struct Stop;
8820
8821 impl ::fidl_next::Method for Stop {
8822 const ORDINAL: u64 = 5446759044519003197;
8823
8824 type Protocol = crate::Driver;
8825
8826 type Request = ();
8827
8828 type Response = ::fidl_next::Never;
8829 }
8830}
8831
8832pub trait DriverClientSender {
8834 type Transport: ::fidl_next::Transport;
8835
8836 #[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"]
8837 fn start<___R>(
8838 &self,
8839 request: ___R,
8840 ) -> Result<
8841 ::fidl_next::ResponseFuture<'_, Self::Transport, driver::Start>,
8842 ::fidl_next::EncodeError,
8843 >
8844 where
8845 ___R: ::fidl_next::Encode<
8846 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
8847 Encoded = crate::WireDriverStartRequest<'static>,
8848 >;
8849
8850 #[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"]
8851 fn stop(
8852 &self,
8853 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>;
8854}
8855
8856impl<___T> DriverClientSender for ::fidl_next::ClientSender<___T, Driver>
8857where
8858 ___T: ::fidl_next::Transport,
8859{
8860 type Transport = ___T;
8861
8862 #[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"]
8863 fn start<___R>(
8864 &self,
8865 request: ___R,
8866 ) -> Result<
8867 ::fidl_next::ResponseFuture<'_, Self::Transport, driver::Start>,
8868 ::fidl_next::EncodeError,
8869 >
8870 where
8871 ___R: ::fidl_next::Encode<
8872 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
8873 Encoded = crate::WireDriverStartRequest<'static>,
8874 >,
8875 {
8876 self.as_untyped()
8877 .send_two_way(2863727161496985794, request)
8878 .map(::fidl_next::ResponseFuture::from_untyped)
8879 }
8880
8881 #[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"]
8882 fn stop(
8883 &self,
8884 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError> {
8885 self.as_untyped().send_one_way(5446759044519003197, ())
8886 }
8887}
8888
8889pub trait DriverClientHandler<___T: ::fidl_next::Transport> {
8893 fn on_unknown_interaction(
8894 &mut self,
8895 sender: &::fidl_next::ClientSender<___T, Driver>,
8896 ordinal: u64,
8897 ) {
8898 sender.close();
8899 }
8900}
8901
8902impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for Driver
8903where
8904 ___T: ::fidl_next::Transport,
8905 ___H: DriverClientHandler<___T>,
8906
8907 <driver::Start as ::fidl_next::Method>::Response:
8908 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
8909{
8910 fn on_event(
8911 handler: &mut ___H,
8912 sender: &::fidl_next::ClientSender<___T, Self>,
8913 ordinal: u64,
8914 buffer: ___T::RecvBuffer,
8915 ) {
8916 match ordinal {
8917 ordinal => handler.on_unknown_interaction(sender, ordinal),
8918 }
8919 }
8920}
8921
8922pub trait DriverServerSender {
8924 type Transport: ::fidl_next::Transport;
8925}
8926
8927impl<___T> DriverServerSender for ::fidl_next::ServerSender<___T, Driver>
8928where
8929 ___T: ::fidl_next::Transport,
8930{
8931 type Transport = ___T;
8932}
8933
8934pub trait DriverServerHandler<___T: ::fidl_next::Transport> {
8938 #[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"]
8939 fn start(
8940 &mut self,
8941 sender: &::fidl_next::ServerSender<___T, Driver>,
8942
8943 request: ::fidl_next::Request<___T, driver::Start>,
8944
8945 responder: ::fidl_next::Responder<driver::Start>,
8946 );
8947
8948 #[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"]
8949 fn stop(&mut self, sender: &::fidl_next::ServerSender<___T, Driver>);
8950
8951 fn on_unknown_interaction(
8952 &mut self,
8953 sender: &::fidl_next::ServerSender<___T, Driver>,
8954 ordinal: u64,
8955 ) {
8956 sender.close();
8957 }
8958}
8959
8960impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for Driver
8961where
8962 ___T: ::fidl_next::Transport,
8963 ___H: DriverServerHandler<___T>,
8964
8965 <driver::Start as ::fidl_next::Method>::Request:
8966 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
8967{
8968 fn on_one_way(
8969 handler: &mut ___H,
8970 sender: &::fidl_next::ServerSender<___T, Self>,
8971 ordinal: u64,
8972 buffer: ___T::RecvBuffer,
8973 ) {
8974 match ordinal {
8975 5446759044519003197 => {
8976 handler.stop(sender);
8977 }
8978
8979 ordinal => handler.on_unknown_interaction(sender, ordinal),
8980 }
8981 }
8982
8983 fn on_two_way(
8984 handler: &mut ___H,
8985 sender: &::fidl_next::ServerSender<___T, Self>,
8986 ordinal: u64,
8987 buffer: ___T::RecvBuffer,
8988 responder: ::fidl_next::protocol::Responder,
8989 ) {
8990 match ordinal {
8991 2863727161496985794 => {
8992 let responder = ::fidl_next::Responder::from_untyped(responder);
8993
8994 match ::fidl_next::DecoderExt::decode(buffer) {
8995 Ok(decoded) => handler.start(sender, decoded, responder),
8996 Err(e) => {
8997 sender.close();
8998 }
8999 }
9000 }
9001
9002 ordinal => handler.on_unknown_interaction(sender, ordinal),
9003 }
9004 }
9005}
9006
9007pub const MAX_RESOURCE_NAME_LENGTH: u8 = 128;
9008
9009pub type NodeAddChildResponse = ();
9010
9011pub type WireNodeAddChildResponse = ();
9013
9014#[doc = " Error codes for the Node protocol.\n"]
9015#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9016#[repr(u32)]
9017pub enum NodeError {
9018 Internal = 1,
9019 NodeRemoved = 2,
9020 NameMissing = 3,
9021 NameInvalid = 4,
9022 NameAlreadyExists = 5,
9023 OfferSourceNameMissing = 6,
9024 OfferRefExists = 7,
9025 SymbolNameMissing = 8,
9026 SymbolAddressMissing = 9,
9027 SymbolAlreadyExists = 10,
9028 UnbindChildrenInProgress = 11,
9029 UnsupportedArgs = 12,
9030 UnknownOrdinal_(u32),
9031}
9032
9033impl ::fidl_next::Encodable for NodeError {
9034 type Encoded = WireNodeError;
9035}
9036impl ::std::convert::From<u32> for NodeError {
9037 fn from(value: u32) -> Self {
9038 match value {
9039 1 => Self::Internal,
9040 2 => Self::NodeRemoved,
9041 3 => Self::NameMissing,
9042 4 => Self::NameInvalid,
9043 5 => Self::NameAlreadyExists,
9044 6 => Self::OfferSourceNameMissing,
9045 7 => Self::OfferRefExists,
9046 8 => Self::SymbolNameMissing,
9047 9 => Self::SymbolAddressMissing,
9048 10 => Self::SymbolAlreadyExists,
9049 11 => Self::UnbindChildrenInProgress,
9050 12 => Self::UnsupportedArgs,
9051
9052 _ => Self::UnknownOrdinal_(value),
9053 }
9054 }
9055}
9056
9057unsafe impl<___E> ::fidl_next::Encode<___E> for NodeError
9058where
9059 ___E: ?Sized,
9060{
9061 #[inline]
9062 fn encode(
9063 self,
9064 encoder: &mut ___E,
9065 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9066 ) -> Result<(), ::fidl_next::EncodeError> {
9067 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
9068 }
9069}
9070
9071unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodeError
9072where
9073 ___E: ?Sized,
9074{
9075 #[inline]
9076 fn encode_ref(
9077 &self,
9078 encoder: &mut ___E,
9079 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9080 ) -> Result<(), ::fidl_next::EncodeError> {
9081 ::fidl_next::munge!(let WireNodeError { value } = out);
9082 let _ = value.write(::fidl_next::WireU32::from(match *self {
9083 Self::Internal => 1,
9084
9085 Self::NodeRemoved => 2,
9086
9087 Self::NameMissing => 3,
9088
9089 Self::NameInvalid => 4,
9090
9091 Self::NameAlreadyExists => 5,
9092
9093 Self::OfferSourceNameMissing => 6,
9094
9095 Self::OfferRefExists => 7,
9096
9097 Self::SymbolNameMissing => 8,
9098
9099 Self::SymbolAddressMissing => 9,
9100
9101 Self::SymbolAlreadyExists => 10,
9102
9103 Self::UnbindChildrenInProgress => 11,
9104
9105 Self::UnsupportedArgs => 12,
9106
9107 Self::UnknownOrdinal_(value) => value,
9108 }));
9109
9110 Ok(())
9111 }
9112}
9113
9114impl ::core::convert::From<WireNodeError> for NodeError {
9115 fn from(wire: WireNodeError) -> Self {
9116 match u32::from(wire.value) {
9117 1 => Self::Internal,
9118
9119 2 => Self::NodeRemoved,
9120
9121 3 => Self::NameMissing,
9122
9123 4 => Self::NameInvalid,
9124
9125 5 => Self::NameAlreadyExists,
9126
9127 6 => Self::OfferSourceNameMissing,
9128
9129 7 => Self::OfferRefExists,
9130
9131 8 => Self::SymbolNameMissing,
9132
9133 9 => Self::SymbolAddressMissing,
9134
9135 10 => Self::SymbolAlreadyExists,
9136
9137 11 => Self::UnbindChildrenInProgress,
9138
9139 12 => Self::UnsupportedArgs,
9140
9141 value => Self::UnknownOrdinal_(value),
9142 }
9143 }
9144}
9145
9146impl ::fidl_next::FromWire<WireNodeError> for NodeError {
9147 #[inline]
9148 fn from_wire(wire: WireNodeError) -> Self {
9149 Self::from(wire)
9150 }
9151}
9152
9153impl ::fidl_next::FromWireRef<WireNodeError> for NodeError {
9154 #[inline]
9155 fn from_wire_ref(wire: &WireNodeError) -> Self {
9156 Self::from(*wire)
9157 }
9158}
9159
9160#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9162#[repr(transparent)]
9163pub struct WireNodeError {
9164 value: ::fidl_next::WireU32,
9165}
9166
9167unsafe impl ::fidl_next::Wire for WireNodeError {
9168 type Decoded<'de> = Self;
9169
9170 #[inline]
9171 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
9172 }
9174}
9175
9176impl WireNodeError {
9177 pub const INTERNAL: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(1) };
9178
9179 pub const NODE_REMOVED: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(2) };
9180
9181 pub const NAME_MISSING: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(3) };
9182
9183 pub const NAME_INVALID: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(4) };
9184
9185 pub const NAME_ALREADY_EXISTS: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(5) };
9186
9187 pub const OFFER_SOURCE_NAME_MISSING: WireNodeError =
9188 WireNodeError { value: ::fidl_next::WireU32(6) };
9189
9190 pub const OFFER_REF_EXISTS: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(7) };
9191
9192 pub const SYMBOL_NAME_MISSING: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(8) };
9193
9194 pub const SYMBOL_ADDRESS_MISSING: WireNodeError =
9195 WireNodeError { value: ::fidl_next::WireU32(9) };
9196
9197 pub const SYMBOL_ALREADY_EXISTS: WireNodeError =
9198 WireNodeError { value: ::fidl_next::WireU32(10) };
9199
9200 pub const UNBIND_CHILDREN_IN_PROGRESS: WireNodeError =
9201 WireNodeError { value: ::fidl_next::WireU32(11) };
9202
9203 pub const UNSUPPORTED_ARGS: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(12) };
9204}
9205
9206unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeError
9207where
9208 ___D: ?Sized,
9209{
9210 fn decode(
9211 slot: ::fidl_next::Slot<'_, Self>,
9212 _: &mut ___D,
9213 ) -> Result<(), ::fidl_next::DecodeError> {
9214 Ok(())
9215 }
9216}
9217
9218impl ::core::convert::From<NodeError> for WireNodeError {
9219 fn from(natural: NodeError) -> Self {
9220 match natural {
9221 NodeError::Internal => WireNodeError::INTERNAL,
9222
9223 NodeError::NodeRemoved => WireNodeError::NODE_REMOVED,
9224
9225 NodeError::NameMissing => WireNodeError::NAME_MISSING,
9226
9227 NodeError::NameInvalid => WireNodeError::NAME_INVALID,
9228
9229 NodeError::NameAlreadyExists => WireNodeError::NAME_ALREADY_EXISTS,
9230
9231 NodeError::OfferSourceNameMissing => WireNodeError::OFFER_SOURCE_NAME_MISSING,
9232
9233 NodeError::OfferRefExists => WireNodeError::OFFER_REF_EXISTS,
9234
9235 NodeError::SymbolNameMissing => WireNodeError::SYMBOL_NAME_MISSING,
9236
9237 NodeError::SymbolAddressMissing => WireNodeError::SYMBOL_ADDRESS_MISSING,
9238
9239 NodeError::SymbolAlreadyExists => WireNodeError::SYMBOL_ALREADY_EXISTS,
9240
9241 NodeError::UnbindChildrenInProgress => WireNodeError::UNBIND_CHILDREN_IN_PROGRESS,
9242
9243 NodeError::UnsupportedArgs => WireNodeError::UNSUPPORTED_ARGS,
9244
9245 NodeError::UnknownOrdinal_(value) => {
9246 WireNodeError { value: ::fidl_next::WireU32::from(value) }
9247 }
9248 }
9249 }
9250}
9251
9252#[doc = " Arguments for adding a node.\n"]
9253#[derive(Debug, Default)]
9254pub struct NodeAddArgs {
9255 pub name: Option<String>,
9256
9257 pub symbols: Option<Vec<crate::NodeSymbol>>,
9258
9259 pub properties: Option<Vec<crate::NodeProperty>>,
9260
9261 pub devfs_args: Option<crate::DevfsAddArgs>,
9262
9263 pub offers2: Option<Vec<crate::Offer>>,
9264
9265 pub bus_info: Option<crate::BusInfo>,
9266
9267 pub properties2: Option<Vec<crate::NodeProperty2>>,
9268}
9269
9270impl NodeAddArgs {
9271 fn __max_ordinal(&self) -> usize {
9272 if self.name.is_some() {
9273 return 1;
9274 }
9275
9276 if self.symbols.is_some() {
9277 return 3;
9278 }
9279
9280 if self.properties.is_some() {
9281 return 4;
9282 }
9283
9284 if self.devfs_args.is_some() {
9285 return 5;
9286 }
9287
9288 if self.offers2.is_some() {
9289 return 6;
9290 }
9291
9292 if self.bus_info.is_some() {
9293 return 7;
9294 }
9295
9296 if self.properties2.is_some() {
9297 return 8;
9298 }
9299
9300 0
9301 }
9302}
9303
9304impl ::fidl_next::Encodable for NodeAddArgs {
9305 type Encoded = WireNodeAddArgs<'static>;
9306}
9307
9308unsafe impl<___E> ::fidl_next::Encode<___E> for NodeAddArgs
9309where
9310 ___E: ::fidl_next::Encoder + ?Sized,
9311
9312 ___E: ::fidl_next::fuchsia::HandleEncoder,
9313{
9314 #[inline]
9315 fn encode(
9316 mut self,
9317 encoder: &mut ___E,
9318 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9319 ) -> Result<(), ::fidl_next::EncodeError> {
9320 ::fidl_next::munge!(let WireNodeAddArgs { table } = out);
9321
9322 let max_ord = self.__max_ordinal();
9323
9324 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
9325 ::fidl_next::Wire::zero_padding(&mut out);
9326
9327 let mut preallocated =
9328 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
9329
9330 for i in 1..=max_ord {
9331 match i {
9332 8 => {
9333 if let Some(properties2) = self.properties2.take() {
9334 ::fidl_next::WireEnvelope::encode_value(
9335 properties2,
9336 preallocated.encoder,
9337 &mut out,
9338 )?;
9339 } else {
9340 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9341 }
9342 }
9343
9344 7 => {
9345 if let Some(bus_info) = self.bus_info.take() {
9346 ::fidl_next::WireEnvelope::encode_value(
9347 bus_info,
9348 preallocated.encoder,
9349 &mut out,
9350 )?;
9351 } else {
9352 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9353 }
9354 }
9355
9356 6 => {
9357 if let Some(offers2) = self.offers2.take() {
9358 ::fidl_next::WireEnvelope::encode_value(
9359 offers2,
9360 preallocated.encoder,
9361 &mut out,
9362 )?;
9363 } else {
9364 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9365 }
9366 }
9367
9368 5 => {
9369 if let Some(devfs_args) = self.devfs_args.take() {
9370 ::fidl_next::WireEnvelope::encode_value(
9371 devfs_args,
9372 preallocated.encoder,
9373 &mut out,
9374 )?;
9375 } else {
9376 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9377 }
9378 }
9379
9380 4 => {
9381 if let Some(properties) = self.properties.take() {
9382 ::fidl_next::WireEnvelope::encode_value(
9383 properties,
9384 preallocated.encoder,
9385 &mut out,
9386 )?;
9387 } else {
9388 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9389 }
9390 }
9391
9392 3 => {
9393 if let Some(symbols) = self.symbols.take() {
9394 ::fidl_next::WireEnvelope::encode_value(
9395 symbols,
9396 preallocated.encoder,
9397 &mut out,
9398 )?;
9399 } else {
9400 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9401 }
9402 }
9403
9404 1 => {
9405 if let Some(name) = self.name.take() {
9406 ::fidl_next::WireEnvelope::encode_value(
9407 name,
9408 preallocated.encoder,
9409 &mut out,
9410 )?;
9411 } else {
9412 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9413 }
9414 }
9415
9416 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
9417 }
9418 unsafe {
9419 preallocated.write_next(out.assume_init_ref());
9420 }
9421 }
9422
9423 ::fidl_next::WireTable::encode_len(table, max_ord);
9424
9425 Ok(())
9426 }
9427}
9428
9429impl<'de> ::fidl_next::FromWire<WireNodeAddArgs<'de>> for NodeAddArgs {
9430 #[inline]
9431 fn from_wire(wire: WireNodeAddArgs<'de>) -> Self {
9432 let wire = ::core::mem::ManuallyDrop::new(wire);
9433
9434 let name = wire.table.get(1);
9435
9436 let symbols = wire.table.get(3);
9437
9438 let properties = wire.table.get(4);
9439
9440 let devfs_args = wire.table.get(5);
9441
9442 let offers2 = wire.table.get(6);
9443
9444 let bus_info = wire.table.get(7);
9445
9446 let properties2 = wire.table.get(8);
9447
9448 Self {
9449
9450
9451 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
9452 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
9453 )),
9454
9455
9456 symbols: symbols.map(|envelope| ::fidl_next::FromWire::from_wire(
9457 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>>() }
9458 )),
9459
9460
9461 properties: properties.map(|envelope| ::fidl_next::FromWire::from_wire(
9462 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>>() }
9463 )),
9464
9465
9466 devfs_args: devfs_args.map(|envelope| ::fidl_next::FromWire::from_wire(
9467 unsafe { envelope.read_unchecked::<crate::WireDevfsAddArgs<'de>>() }
9468 )),
9469
9470
9471 offers2: offers2.map(|envelope| ::fidl_next::FromWire::from_wire(
9472 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>() }
9473 )),
9474
9475
9476 bus_info: bus_info.map(|envelope| ::fidl_next::FromWire::from_wire(
9477 unsafe { envelope.read_unchecked::<crate::WireBusInfo<'de>>() }
9478 )),
9479
9480
9481 properties2: properties2.map(|envelope| ::fidl_next::FromWire::from_wire(
9482 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>>() }
9483 )),
9484
9485 }
9486 }
9487}
9488
9489#[repr(C)]
9491pub struct WireNodeAddArgs<'de> {
9492 table: ::fidl_next::WireTable<'de>,
9493}
9494
9495impl<'de> Drop for WireNodeAddArgs<'de> {
9496 fn drop(&mut self) {
9497 let _ = self
9498 .table
9499 .get(1)
9500 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
9501
9502 let _ = self.table.get(3).map(|envelope| unsafe {
9503 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>>()
9504 });
9505
9506 let _ = self.table.get(4).map(|envelope| unsafe {
9507 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>>()
9508 });
9509
9510 let _ = self
9511 .table
9512 .get(5)
9513 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDevfsAddArgs<'de>>() });
9514
9515 let _ = self.table.get(6).map(|envelope| unsafe {
9516 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>()
9517 });
9518
9519 let _ = self
9520 .table
9521 .get(7)
9522 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireBusInfo<'de>>() });
9523
9524 let _ = self.table.get(8).map(|envelope| unsafe {
9525 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>>()
9526 });
9527 }
9528}
9529
9530unsafe impl ::fidl_next::Wire for WireNodeAddArgs<'static> {
9531 type Decoded<'de> = WireNodeAddArgs<'de>;
9532
9533 #[inline]
9534 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9535 ::fidl_next::munge!(let Self { table } = out);
9536 ::fidl_next::WireTable::zero_padding(table);
9537 }
9538}
9539
9540unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeAddArgs<'static>
9541where
9542 ___D: ::fidl_next::Decoder + ?Sized,
9543
9544 ___D: ::fidl_next::fuchsia::HandleDecoder,
9545{
9546 fn decode(
9547 slot: ::fidl_next::Slot<'_, Self>,
9548 decoder: &mut ___D,
9549 ) -> Result<(), ::fidl_next::DecodeError> {
9550 ::fidl_next::munge!(let Self { table } = slot);
9551
9552 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
9553 match ordinal {
9554 0 => unsafe { ::core::hint::unreachable_unchecked() },
9555
9556 1 => {
9557 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
9558 slot.as_mut(),
9559 decoder,
9560 )?;
9561
9562 let name = unsafe {
9563 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
9564 };
9565
9566 if name.len() > 128 {
9567 return Err(::fidl_next::DecodeError::VectorTooLong {
9568 size: name.len() as u64,
9569 limit: 128,
9570 });
9571 }
9572
9573 Ok(())
9574 }
9575
9576 3 => {
9577 ::fidl_next::WireEnvelope::decode_as::<
9578 ___D,
9579 ::fidl_next::WireVector<'static, crate::WireNodeSymbol<'static>>,
9580 >(slot.as_mut(), decoder)?;
9581
9582 let symbols = unsafe {
9583 slot
9584 .deref_unchecked()
9585 .deref_unchecked::<
9586 ::fidl_next::WireVector<'_, crate::WireNodeSymbol<'_>>
9587 >()
9588 };
9589
9590 if symbols.len() > 64 {
9591 return Err(::fidl_next::DecodeError::VectorTooLong {
9592 size: symbols.len() as u64,
9593 limit: 64,
9594 });
9595 }
9596
9597 Ok(())
9598 }
9599
9600 4 => {
9601 ::fidl_next::WireEnvelope::decode_as::<
9602 ___D,
9603 ::fidl_next::WireVector<'static, crate::WireNodeProperty<'static>>,
9604 >(slot.as_mut(), decoder)?;
9605
9606 let properties = unsafe {
9607 slot
9608 .deref_unchecked()
9609 .deref_unchecked::<
9610 ::fidl_next::WireVector<'_, crate::WireNodeProperty<'_>>
9611 >()
9612 };
9613
9614 if properties.len() > 64 {
9615 return Err(::fidl_next::DecodeError::VectorTooLong {
9616 size: properties.len() as u64,
9617 limit: 64,
9618 });
9619 }
9620
9621 Ok(())
9622 }
9623
9624 5 => {
9625 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDevfsAddArgs<'static>>(
9626 slot.as_mut(),
9627 decoder,
9628 )?;
9629
9630 Ok(())
9631 }
9632
9633 6 => {
9634 ::fidl_next::WireEnvelope::decode_as::<
9635 ___D,
9636 ::fidl_next::WireVector<'static, crate::WireOffer<'static>>,
9637 >(slot.as_mut(), decoder)?;
9638
9639 let offers2 = unsafe {
9640 slot.deref_unchecked()
9641 .deref_unchecked::<::fidl_next::WireVector<'_, crate::WireOffer<'_>>>()
9642 };
9643
9644 if offers2.len() > 128 {
9645 return Err(::fidl_next::DecodeError::VectorTooLong {
9646 size: offers2.len() as u64,
9647 limit: 128,
9648 });
9649 }
9650
9651 Ok(())
9652 }
9653
9654 7 => {
9655 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireBusInfo<'static>>(
9656 slot.as_mut(),
9657 decoder,
9658 )?;
9659
9660 Ok(())
9661 }
9662
9663 8 => {
9664 ::fidl_next::WireEnvelope::decode_as::<
9665 ___D,
9666 ::fidl_next::WireVector<'static, crate::WireNodeProperty2<'static>>,
9667 >(slot.as_mut(), decoder)?;
9668
9669 let properties2 = unsafe {
9670 slot
9671 .deref_unchecked()
9672 .deref_unchecked::<
9673 ::fidl_next::WireVector<'_, crate::WireNodeProperty2<'_>>
9674 >()
9675 };
9676
9677 if properties2.len() > 64 {
9678 return Err(::fidl_next::DecodeError::VectorTooLong {
9679 size: properties2.len() as u64,
9680 limit: 64,
9681 });
9682 }
9683
9684 Ok(())
9685 }
9686
9687 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
9688 }
9689 })
9690 }
9691}
9692
9693impl<'de> WireNodeAddArgs<'de> {
9694 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
9695 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
9696 }
9697
9698 pub fn symbols(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>> {
9699 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
9700 }
9701
9702 pub fn properties(
9703 &self,
9704 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>> {
9705 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
9706 }
9707
9708 pub fn devfs_args(&self) -> Option<&crate::WireDevfsAddArgs<'de>> {
9709 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
9710 }
9711
9712 pub fn offers2(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireOffer<'de>>> {
9713 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
9714 }
9715
9716 pub fn bus_info(&self) -> Option<&crate::WireBusInfo<'de>> {
9717 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
9718 }
9719
9720 pub fn properties2(
9721 &self,
9722 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>> {
9723 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
9724 }
9725}
9726
9727impl<'de> ::core::fmt::Debug for WireNodeAddArgs<'de> {
9728 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
9729 f.debug_struct("NodeAddArgs")
9730 .field("name", &self.name())
9731 .field("symbols", &self.symbols())
9732 .field("properties", &self.properties())
9733 .field("devfs_args", &self.devfs_args())
9734 .field("offers2", &self.offers2())
9735 .field("bus_info", &self.bus_info())
9736 .field("properties2", &self.properties2())
9737 .finish()
9738 }
9739}
9740
9741#[derive(Debug)]
9742pub struct NodeAddChildRequest {
9743 pub args: crate::NodeAddArgs,
9744
9745 pub controller:
9746 ::fidl_next::ServerEnd<::fidl_next::fuchsia::zx::Channel, crate::NodeController>,
9747
9748 pub node: ::fidl_next::ServerEnd<Option<::fidl_next::fuchsia::zx::Channel>, crate::Node>,
9749}
9750
9751impl ::fidl_next::Encodable for NodeAddChildRequest {
9752 type Encoded = WireNodeAddChildRequest<'static>;
9753}
9754
9755unsafe impl<___E> ::fidl_next::Encode<___E> for NodeAddChildRequest
9756where
9757 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
9758
9759 ___E: ::fidl_next::Encoder,
9760
9761 ___E: ::fidl_next::fuchsia::HandleEncoder,
9762{
9763 #[inline]
9764 fn encode(
9765 self,
9766 encoder: &mut ___E,
9767 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9768 ) -> Result<(), ::fidl_next::EncodeError> {
9769 ::fidl_next::munge! {
9770 let Self::Encoded {
9771 args,
9772 controller,
9773 node,
9774
9775 } = out;
9776 }
9777
9778 ::fidl_next::Encode::encode(self.args, encoder, args)?;
9779
9780 ::fidl_next::Encode::encode(self.controller, encoder, controller)?;
9781
9782 ::fidl_next::Encode::encode(self.node, encoder, node)?;
9783
9784 Ok(())
9785 }
9786}
9787
9788impl ::fidl_next::EncodableOption for NodeAddChildRequest {
9789 type EncodedOption = ::fidl_next::WireBox<'static, WireNodeAddChildRequest<'static>>;
9790}
9791
9792unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NodeAddChildRequest
9793where
9794 ___E: ::fidl_next::Encoder + ?Sized,
9795 NodeAddChildRequest: ::fidl_next::Encode<___E>,
9796{
9797 #[inline]
9798 fn encode_option(
9799 this: Option<Self>,
9800 encoder: &mut ___E,
9801 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
9802 ) -> Result<(), ::fidl_next::EncodeError> {
9803 if let Some(inner) = this {
9804 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
9805 ::fidl_next::WireBox::encode_present(out);
9806 } else {
9807 ::fidl_next::WireBox::encode_absent(out);
9808 }
9809
9810 Ok(())
9811 }
9812}
9813
9814impl<'de> ::fidl_next::FromWire<WireNodeAddChildRequest<'de>> for NodeAddChildRequest {
9815 #[inline]
9816 fn from_wire(wire: WireNodeAddChildRequest<'de>) -> Self {
9817 Self {
9818 args: ::fidl_next::FromWire::from_wire(wire.args),
9819
9820 controller: ::fidl_next::FromWire::from_wire(wire.controller),
9821
9822 node: ::fidl_next::FromWire::from_wire(wire.node),
9823 }
9824 }
9825}
9826
9827#[derive(Debug)]
9829#[repr(C)]
9830pub struct WireNodeAddChildRequest<'de> {
9831 pub args: crate::WireNodeAddArgs<'de>,
9832
9833 pub controller:
9834 ::fidl_next::ServerEnd<::fidl_next::fuchsia::WireChannel, crate::NodeController>,
9835
9836 pub node: ::fidl_next::ServerEnd<::fidl_next::fuchsia::WireOptionalChannel, crate::Node>,
9837}
9838
9839unsafe impl ::fidl_next::Wire for WireNodeAddChildRequest<'static> {
9840 type Decoded<'de> = WireNodeAddChildRequest<'de>;
9841
9842 #[inline]
9843 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
9844}
9845
9846unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeAddChildRequest<'static>
9847where
9848 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
9849
9850 ___D: ::fidl_next::Decoder,
9851
9852 ___D: ::fidl_next::fuchsia::HandleDecoder,
9853{
9854 fn decode(
9855 slot: ::fidl_next::Slot<'_, Self>,
9856 decoder: &mut ___D,
9857 ) -> Result<(), ::fidl_next::DecodeError> {
9858 ::fidl_next::munge! {
9859 let Self {
9860 mut args,
9861 mut controller,
9862 mut node,
9863
9864 } = slot;
9865 }
9866
9867 ::fidl_next::Decode::decode(args.as_mut(), decoder)?;
9868
9869 ::fidl_next::Decode::decode(controller.as_mut(), decoder)?;
9870
9871 ::fidl_next::Decode::decode(node.as_mut(), decoder)?;
9872
9873 Ok(())
9874 }
9875}
9876
9877#[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"]
9879#[derive(Debug)]
9880pub struct Node;
9881
9882pub mod node {
9883 pub mod prelude {
9884 pub use crate::{
9885 node, Node, NodeClientHandler, NodeClientSender, NodeServerHandler, NodeServerSender,
9886 };
9887
9888 pub use crate::NodeAddChildRequest;
9889
9890 pub use crate::NodeError;
9891
9892 pub use crate::NodeAddChildResponse;
9893 }
9894
9895 pub struct AddChild;
9896
9897 impl ::fidl_next::Method for AddChild {
9898 const ORDINAL: u64 = 8633697350522413353;
9899
9900 type Protocol = crate::Node;
9901
9902 type Request = crate::WireNodeAddChildRequest<'static>;
9903
9904 type Response = ::fidl_next::WireFlexibleResult<
9905 'static,
9906 crate::WireNodeAddChildResponse,
9907 crate::WireNodeError,
9908 >;
9909 }
9910}
9911
9912pub trait NodeClientSender {
9914 type Transport: ::fidl_next::Transport;
9915
9916 #[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"]
9917 fn add_child<___R>(
9918 &self,
9919 request: ___R,
9920 ) -> Result<
9921 ::fidl_next::ResponseFuture<'_, Self::Transport, node::AddChild>,
9922 ::fidl_next::EncodeError,
9923 >
9924 where
9925 ___R: ::fidl_next::Encode<
9926 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
9927 Encoded = crate::WireNodeAddChildRequest<'static>,
9928 >;
9929}
9930
9931impl<___T> NodeClientSender for ::fidl_next::ClientSender<___T, Node>
9932where
9933 ___T: ::fidl_next::Transport,
9934{
9935 type Transport = ___T;
9936
9937 #[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"]
9938 fn add_child<___R>(
9939 &self,
9940 request: ___R,
9941 ) -> Result<
9942 ::fidl_next::ResponseFuture<'_, Self::Transport, node::AddChild>,
9943 ::fidl_next::EncodeError,
9944 >
9945 where
9946 ___R: ::fidl_next::Encode<
9947 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
9948 Encoded = crate::WireNodeAddChildRequest<'static>,
9949 >,
9950 {
9951 self.as_untyped()
9952 .send_two_way(8633697350522413353, request)
9953 .map(::fidl_next::ResponseFuture::from_untyped)
9954 }
9955}
9956
9957pub trait NodeClientHandler<___T: ::fidl_next::Transport> {
9961 fn on_unknown_interaction(
9962 &mut self,
9963 sender: &::fidl_next::ClientSender<___T, Node>,
9964 ordinal: u64,
9965 ) {
9966 sender.close();
9967 }
9968}
9969
9970impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for Node
9971where
9972 ___T: ::fidl_next::Transport,
9973 ___H: NodeClientHandler<___T>,
9974
9975 <node::AddChild as ::fidl_next::Method>::Response:
9976 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
9977{
9978 fn on_event(
9979 handler: &mut ___H,
9980 sender: &::fidl_next::ClientSender<___T, Self>,
9981 ordinal: u64,
9982 buffer: ___T::RecvBuffer,
9983 ) {
9984 match ordinal {
9985 ordinal => handler.on_unknown_interaction(sender, ordinal),
9986 }
9987 }
9988}
9989
9990pub trait NodeServerSender {
9992 type Transport: ::fidl_next::Transport;
9993}
9994
9995impl<___T> NodeServerSender for ::fidl_next::ServerSender<___T, Node>
9996where
9997 ___T: ::fidl_next::Transport,
9998{
9999 type Transport = ___T;
10000}
10001
10002pub trait NodeServerHandler<___T: ::fidl_next::Transport> {
10006 #[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"]
10007 fn add_child(
10008 &mut self,
10009 sender: &::fidl_next::ServerSender<___T, Node>,
10010
10011 request: ::fidl_next::Request<___T, node::AddChild>,
10012
10013 responder: ::fidl_next::Responder<node::AddChild>,
10014 );
10015
10016 fn on_unknown_interaction(
10017 &mut self,
10018 sender: &::fidl_next::ServerSender<___T, Node>,
10019 ordinal: u64,
10020 ) {
10021 sender.close();
10022 }
10023}
10024
10025impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for Node
10026where
10027 ___T: ::fidl_next::Transport,
10028 ___H: NodeServerHandler<___T>,
10029
10030 <node::AddChild as ::fidl_next::Method>::Request:
10031 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
10032{
10033 fn on_one_way(
10034 handler: &mut ___H,
10035 sender: &::fidl_next::ServerSender<___T, Self>,
10036 ordinal: u64,
10037 buffer: ___T::RecvBuffer,
10038 ) {
10039 match ordinal {
10040 ordinal => handler.on_unknown_interaction(sender, ordinal),
10041 }
10042 }
10043
10044 fn on_two_way(
10045 handler: &mut ___H,
10046 sender: &::fidl_next::ServerSender<___T, Self>,
10047 ordinal: u64,
10048 buffer: ___T::RecvBuffer,
10049 responder: ::fidl_next::protocol::Responder,
10050 ) {
10051 match ordinal {
10052 8633697350522413353 => {
10053 let responder = ::fidl_next::Responder::from_untyped(responder);
10054
10055 match ::fidl_next::DecoderExt::decode(buffer) {
10056 Ok(decoded) => handler.add_child(sender, decoded, responder),
10057 Err(e) => {
10058 sender.close();
10059 }
10060 }
10061 }
10062
10063 ordinal => handler.on_unknown_interaction(sender, ordinal),
10064 }
10065 }
10066}
10067
10068#[derive(Clone, Debug, Default)]
10069pub struct NodeControllerRequestBindRequest {
10070 pub force_rebind: Option<bool>,
10071
10072 pub driver_url_suffix: Option<String>,
10073}
10074
10075impl NodeControllerRequestBindRequest {
10076 fn __max_ordinal(&self) -> usize {
10077 if self.force_rebind.is_some() {
10078 return 1;
10079 }
10080
10081 if self.driver_url_suffix.is_some() {
10082 return 2;
10083 }
10084
10085 0
10086 }
10087}
10088
10089impl ::fidl_next::Encodable for NodeControllerRequestBindRequest {
10090 type Encoded = WireNodeControllerRequestBindRequest<'static>;
10091}
10092
10093unsafe impl<___E> ::fidl_next::Encode<___E> for NodeControllerRequestBindRequest
10094where
10095 ___E: ::fidl_next::Encoder + ?Sized,
10096{
10097 #[inline]
10098 fn encode(
10099 mut self,
10100 encoder: &mut ___E,
10101 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10102 ) -> Result<(), ::fidl_next::EncodeError> {
10103 ::fidl_next::munge!(let WireNodeControllerRequestBindRequest { table } = out);
10104
10105 let max_ord = self.__max_ordinal();
10106
10107 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10108 ::fidl_next::Wire::zero_padding(&mut out);
10109
10110 let mut preallocated =
10111 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10112
10113 for i in 1..=max_ord {
10114 match i {
10115 2 => {
10116 if let Some(driver_url_suffix) = self.driver_url_suffix.take() {
10117 ::fidl_next::WireEnvelope::encode_value(
10118 driver_url_suffix,
10119 preallocated.encoder,
10120 &mut out,
10121 )?;
10122 } else {
10123 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10124 }
10125 }
10126
10127 1 => {
10128 if let Some(force_rebind) = self.force_rebind.take() {
10129 ::fidl_next::WireEnvelope::encode_value(
10130 force_rebind,
10131 preallocated.encoder,
10132 &mut out,
10133 )?;
10134 } else {
10135 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10136 }
10137 }
10138
10139 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10140 }
10141 unsafe {
10142 preallocated.write_next(out.assume_init_ref());
10143 }
10144 }
10145
10146 ::fidl_next::WireTable::encode_len(table, max_ord);
10147
10148 Ok(())
10149 }
10150}
10151
10152unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodeControllerRequestBindRequest
10153where
10154 ___E: ::fidl_next::Encoder + ?Sized,
10155{
10156 #[inline]
10157 fn encode_ref(
10158 &self,
10159 encoder: &mut ___E,
10160 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10161 ) -> Result<(), ::fidl_next::EncodeError> {
10162 ::fidl_next::munge!(let WireNodeControllerRequestBindRequest { table } = out);
10163
10164 let max_ord = self.__max_ordinal();
10165
10166 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10167 ::fidl_next::Wire::zero_padding(&mut out);
10168
10169 let mut preallocated =
10170 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10171
10172 for i in 1..=max_ord {
10173 match i {
10174 2 => {
10175 if let Some(driver_url_suffix) = &self.driver_url_suffix {
10176 ::fidl_next::WireEnvelope::encode_value(
10177 driver_url_suffix,
10178 preallocated.encoder,
10179 &mut out,
10180 )?;
10181 } else {
10182 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10183 }
10184 }
10185
10186 1 => {
10187 if let Some(force_rebind) = &self.force_rebind {
10188 ::fidl_next::WireEnvelope::encode_value(
10189 force_rebind,
10190 preallocated.encoder,
10191 &mut out,
10192 )?;
10193 } else {
10194 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10195 }
10196 }
10197
10198 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10199 }
10200 unsafe {
10201 preallocated.write_next(out.assume_init_ref());
10202 }
10203 }
10204
10205 ::fidl_next::WireTable::encode_len(table, max_ord);
10206
10207 Ok(())
10208 }
10209}
10210
10211impl<'de> ::fidl_next::FromWire<WireNodeControllerRequestBindRequest<'de>>
10212 for NodeControllerRequestBindRequest
10213{
10214 #[inline]
10215 fn from_wire(wire: WireNodeControllerRequestBindRequest<'de>) -> Self {
10216 let wire = ::core::mem::ManuallyDrop::new(wire);
10217
10218 let force_rebind = wire.table.get(1);
10219
10220 let driver_url_suffix = wire.table.get(2);
10221
10222 Self {
10223 force_rebind: force_rebind.map(|envelope| {
10224 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
10225 }),
10226
10227 driver_url_suffix: driver_url_suffix.map(|envelope| {
10228 ::fidl_next::FromWire::from_wire(unsafe {
10229 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
10230 })
10231 }),
10232 }
10233 }
10234}
10235
10236impl<'de> ::fidl_next::FromWireRef<WireNodeControllerRequestBindRequest<'de>>
10237 for NodeControllerRequestBindRequest
10238{
10239 #[inline]
10240 fn from_wire_ref(wire: &WireNodeControllerRequestBindRequest<'de>) -> Self {
10241 Self {
10242 force_rebind: wire.table.get(1).map(|envelope| {
10243 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
10244 envelope.deref_unchecked::<bool>()
10245 })
10246 }),
10247
10248 driver_url_suffix: wire.table.get(2).map(|envelope| {
10249 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
10250 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
10251 })
10252 }),
10253 }
10254 }
10255}
10256
10257#[repr(C)]
10259pub struct WireNodeControllerRequestBindRequest<'de> {
10260 table: ::fidl_next::WireTable<'de>,
10261}
10262
10263impl<'de> Drop for WireNodeControllerRequestBindRequest<'de> {
10264 fn drop(&mut self) {
10265 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
10266
10267 let _ = self
10268 .table
10269 .get(2)
10270 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
10271 }
10272}
10273
10274unsafe impl ::fidl_next::Wire for WireNodeControllerRequestBindRequest<'static> {
10275 type Decoded<'de> = WireNodeControllerRequestBindRequest<'de>;
10276
10277 #[inline]
10278 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10279 ::fidl_next::munge!(let Self { table } = out);
10280 ::fidl_next::WireTable::zero_padding(table);
10281 }
10282}
10283
10284unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeControllerRequestBindRequest<'static>
10285where
10286 ___D: ::fidl_next::Decoder + ?Sized,
10287{
10288 fn decode(
10289 slot: ::fidl_next::Slot<'_, Self>,
10290 decoder: &mut ___D,
10291 ) -> Result<(), ::fidl_next::DecodeError> {
10292 ::fidl_next::munge!(let Self { table } = slot);
10293
10294 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
10295 match ordinal {
10296 0 => unsafe { ::core::hint::unreachable_unchecked() },
10297
10298 1 => {
10299 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
10300
10301 Ok(())
10302 }
10303
10304 2 => {
10305 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
10306 slot.as_mut(),
10307 decoder,
10308 )?;
10309
10310 Ok(())
10311 }
10312
10313 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
10314 }
10315 })
10316 }
10317}
10318
10319impl<'de> WireNodeControllerRequestBindRequest<'de> {
10320 pub fn force_rebind(&self) -> Option<&bool> {
10321 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
10322 }
10323
10324 pub fn driver_url_suffix(&self) -> Option<&::fidl_next::WireString<'de>> {
10325 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
10326 }
10327}
10328
10329impl<'de> ::core::fmt::Debug for WireNodeControllerRequestBindRequest<'de> {
10330 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
10331 f.debug_struct("NodeControllerRequestBindRequest")
10332 .field("force_rebind", &self.force_rebind())
10333 .field("driver_url_suffix", &self.driver_url_suffix())
10334 .finish()
10335 }
10336}
10337
10338pub type NodeControllerRequestBindResponse = ();
10339
10340pub type WireNodeControllerRequestBindResponse = ();
10342
10343#[derive(Debug, Default)]
10344pub struct NodeControllerOnBindRequest {
10345 pub node_token: Option<::fidl_next::fuchsia::zx::Handle>,
10346}
10347
10348impl NodeControllerOnBindRequest {
10349 fn __max_ordinal(&self) -> usize {
10350 if self.node_token.is_some() {
10351 return 1;
10352 }
10353
10354 0
10355 }
10356}
10357
10358impl ::fidl_next::Encodable for NodeControllerOnBindRequest {
10359 type Encoded = WireNodeControllerOnBindRequest<'static>;
10360}
10361
10362unsafe impl<___E> ::fidl_next::Encode<___E> for NodeControllerOnBindRequest
10363where
10364 ___E: ::fidl_next::Encoder + ?Sized,
10365
10366 ___E: ::fidl_next::fuchsia::HandleEncoder,
10367{
10368 #[inline]
10369 fn encode(
10370 mut self,
10371 encoder: &mut ___E,
10372 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10373 ) -> Result<(), ::fidl_next::EncodeError> {
10374 ::fidl_next::munge!(let WireNodeControllerOnBindRequest { table } = out);
10375
10376 let max_ord = self.__max_ordinal();
10377
10378 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10379 ::fidl_next::Wire::zero_padding(&mut out);
10380
10381 let mut preallocated =
10382 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10383
10384 for i in 1..=max_ord {
10385 match i {
10386 1 => {
10387 if let Some(node_token) = self.node_token.take() {
10388 ::fidl_next::WireEnvelope::encode_value(
10389 node_token,
10390 preallocated.encoder,
10391 &mut out,
10392 )?;
10393 } else {
10394 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10395 }
10396 }
10397
10398 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10399 }
10400 unsafe {
10401 preallocated.write_next(out.assume_init_ref());
10402 }
10403 }
10404
10405 ::fidl_next::WireTable::encode_len(table, max_ord);
10406
10407 Ok(())
10408 }
10409}
10410
10411impl<'de> ::fidl_next::FromWire<WireNodeControllerOnBindRequest<'de>>
10412 for NodeControllerOnBindRequest
10413{
10414 #[inline]
10415 fn from_wire(wire: WireNodeControllerOnBindRequest<'de>) -> Self {
10416 let wire = ::core::mem::ManuallyDrop::new(wire);
10417
10418 let node_token = wire.table.get(1);
10419
10420 Self {
10421 node_token: node_token.map(|envelope| {
10422 ::fidl_next::FromWire::from_wire(unsafe {
10423 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
10424 })
10425 }),
10426 }
10427 }
10428}
10429
10430#[repr(C)]
10432pub struct WireNodeControllerOnBindRequest<'de> {
10433 table: ::fidl_next::WireTable<'de>,
10434}
10435
10436impl<'de> Drop for WireNodeControllerOnBindRequest<'de> {
10437 fn drop(&mut self) {
10438 let _ = self.table.get(1).map(|envelope| unsafe {
10439 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
10440 });
10441 }
10442}
10443
10444unsafe impl ::fidl_next::Wire for WireNodeControllerOnBindRequest<'static> {
10445 type Decoded<'de> = WireNodeControllerOnBindRequest<'de>;
10446
10447 #[inline]
10448 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10449 ::fidl_next::munge!(let Self { table } = out);
10450 ::fidl_next::WireTable::zero_padding(table);
10451 }
10452}
10453
10454unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeControllerOnBindRequest<'static>
10455where
10456 ___D: ::fidl_next::Decoder + ?Sized,
10457
10458 ___D: ::fidl_next::fuchsia::HandleDecoder,
10459{
10460 fn decode(
10461 slot: ::fidl_next::Slot<'_, Self>,
10462 decoder: &mut ___D,
10463 ) -> Result<(), ::fidl_next::DecodeError> {
10464 ::fidl_next::munge!(let Self { table } = slot);
10465
10466 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
10467 match ordinal {
10468 0 => unsafe { ::core::hint::unreachable_unchecked() },
10469
10470 1 => {
10471 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
10472 slot.as_mut(),
10473 decoder,
10474 )?;
10475
10476 Ok(())
10477 }
10478
10479 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
10480 }
10481 })
10482 }
10483}
10484
10485impl<'de> WireNodeControllerOnBindRequest<'de> {
10486 pub fn node_token(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
10487 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
10488 }
10489}
10490
10491impl<'de> ::core::fmt::Debug for WireNodeControllerOnBindRequest<'de> {
10492 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
10493 f.debug_struct("NodeControllerOnBindRequest")
10494 .field("node_token", &self.node_token())
10495 .finish()
10496 }
10497}
10498
10499#[doc = " Protocol through which a parent node controls one of its children.\n"]
10501#[derive(Debug)]
10502pub struct NodeController;
10503
10504pub mod node_controller {
10505 pub mod prelude {
10506 pub use crate::{
10507 node_controller, NodeController, NodeControllerClientHandler,
10508 NodeControllerClientSender, NodeControllerServerHandler, NodeControllerServerSender,
10509 };
10510
10511 pub use crate::NodeControllerOnBindRequest;
10512
10513 pub use crate::NodeControllerRequestBindRequest;
10514
10515 pub use crate::NodeControllerRequestBindResponse;
10516 }
10517
10518 pub struct Remove;
10519
10520 impl ::fidl_next::Method for Remove {
10521 const ORDINAL: u64 = 6123359741742396225;
10522
10523 type Protocol = crate::NodeController;
10524
10525 type Request = ();
10526
10527 type Response = ::fidl_next::Never;
10528 }
10529
10530 pub struct RequestBind;
10531
10532 impl ::fidl_next::Method for RequestBind {
10533 const ORDINAL: u64 = 4735909333556220047;
10534
10535 type Protocol = crate::NodeController;
10536
10537 type Request = crate::WireNodeControllerRequestBindRequest<'static>;
10538
10539 type Response = ::fidl_next::WireFlexibleResult<
10540 'static,
10541 crate::WireNodeControllerRequestBindResponse,
10542 ::fidl_next::WireI32,
10543 >;
10544 }
10545
10546 pub struct OnBind;
10547
10548 impl ::fidl_next::Method for OnBind {
10549 const ORDINAL: u64 = 5905369594807853098;
10550
10551 type Protocol = crate::NodeController;
10552
10553 type Request = ::fidl_next::Never;
10554
10555 type Response = crate::WireNodeControllerOnBindRequest<'static>;
10556 }
10557}
10558
10559pub trait NodeControllerClientSender {
10561 type Transport: ::fidl_next::Transport;
10562
10563 #[doc = " Removes the node and all of its children.\n"]
10564 fn remove(
10565 &self,
10566 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>;
10567
10568 #[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"]
10569 fn request_bind<___R>(
10570 &self,
10571 request: ___R,
10572 ) -> Result<
10573 ::fidl_next::ResponseFuture<'_, Self::Transport, node_controller::RequestBind>,
10574 ::fidl_next::EncodeError,
10575 >
10576 where
10577 ___R: ::fidl_next::Encode<
10578 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
10579 Encoded = crate::WireNodeControllerRequestBindRequest<'static>,
10580 >;
10581}
10582
10583impl<___T> NodeControllerClientSender for ::fidl_next::ClientSender<___T, NodeController>
10584where
10585 ___T: ::fidl_next::Transport,
10586{
10587 type Transport = ___T;
10588
10589 #[doc = " Removes the node and all of its children.\n"]
10590 fn remove(
10591 &self,
10592 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError> {
10593 self.as_untyped().send_one_way(6123359741742396225, ())
10594 }
10595
10596 #[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"]
10597 fn request_bind<___R>(
10598 &self,
10599 request: ___R,
10600 ) -> Result<
10601 ::fidl_next::ResponseFuture<'_, Self::Transport, node_controller::RequestBind>,
10602 ::fidl_next::EncodeError,
10603 >
10604 where
10605 ___R: ::fidl_next::Encode<
10606 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
10607 Encoded = crate::WireNodeControllerRequestBindRequest<'static>,
10608 >,
10609 {
10610 self.as_untyped()
10611 .send_two_way(4735909333556220047, request)
10612 .map(::fidl_next::ResponseFuture::from_untyped)
10613 }
10614}
10615
10616pub trait NodeControllerClientHandler<___T: ::fidl_next::Transport> {
10620 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n"]
10621 fn on_bind(
10622 &mut self,
10623 sender: &::fidl_next::ClientSender<___T, NodeController>,
10624
10625 event: ::fidl_next::Response<___T, node_controller::OnBind>,
10626 );
10627
10628 fn on_unknown_interaction(
10629 &mut self,
10630 sender: &::fidl_next::ClientSender<___T, NodeController>,
10631 ordinal: u64,
10632 ) {
10633 sender.close();
10634 }
10635}
10636
10637impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for NodeController
10638where
10639 ___T: ::fidl_next::Transport,
10640 ___H: NodeControllerClientHandler<___T>,
10641
10642 <node_controller::RequestBind as ::fidl_next::Method>::Response:
10643 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
10644
10645 <node_controller::OnBind as ::fidl_next::Method>::Response:
10646 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
10647{
10648 fn on_event(
10649 handler: &mut ___H,
10650 sender: &::fidl_next::ClientSender<___T, Self>,
10651 ordinal: u64,
10652 buffer: ___T::RecvBuffer,
10653 ) {
10654 match ordinal {
10655 5905369594807853098 => match ::fidl_next::DecoderExt::decode(buffer) {
10656 Ok(decoded) => handler.on_bind(sender, decoded),
10657 Err(e) => {
10658 sender.close();
10659 }
10660 },
10661
10662 ordinal => handler.on_unknown_interaction(sender, ordinal),
10663 }
10664 }
10665}
10666
10667pub trait NodeControllerServerSender {
10669 type Transport: ::fidl_next::Transport;
10670
10671 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n"]
10672
10673 fn on_bind<___R>(
10674 &self,
10675 request: ___R,
10676 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
10677 where
10678 ___R: ::fidl_next::Encode<
10679 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
10680 Encoded = <node_controller::OnBind as ::fidl_next::Method>::Response,
10681 >;
10682}
10683
10684impl<___T> NodeControllerServerSender for ::fidl_next::ServerSender<___T, NodeController>
10685where
10686 ___T: ::fidl_next::Transport,
10687{
10688 type Transport = ___T;
10689
10690 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n"]
10691
10692 fn on_bind<___R>(
10693 &self,
10694 request: ___R,
10695 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
10696 where
10697 ___R: ::fidl_next::Encode<
10698 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
10699 Encoded = <node_controller::OnBind as ::fidl_next::Method>::Response,
10700 >,
10701 {
10702 self.as_untyped().send_event(5905369594807853098, request)
10703 }
10704}
10705
10706pub trait NodeControllerServerHandler<___T: ::fidl_next::Transport> {
10710 #[doc = " Removes the node and all of its children.\n"]
10711 fn remove(&mut self, sender: &::fidl_next::ServerSender<___T, NodeController>);
10712
10713 #[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"]
10714 fn request_bind(
10715 &mut self,
10716 sender: &::fidl_next::ServerSender<___T, NodeController>,
10717
10718 request: ::fidl_next::Request<___T, node_controller::RequestBind>,
10719
10720 responder: ::fidl_next::Responder<node_controller::RequestBind>,
10721 );
10722
10723 fn on_unknown_interaction(
10724 &mut self,
10725 sender: &::fidl_next::ServerSender<___T, NodeController>,
10726 ordinal: u64,
10727 ) {
10728 sender.close();
10729 }
10730}
10731
10732impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for NodeController
10733where
10734 ___T: ::fidl_next::Transport,
10735 ___H: NodeControllerServerHandler<___T>,
10736
10737 <node_controller::RequestBind as ::fidl_next::Method>::Request:
10738 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
10739{
10740 fn on_one_way(
10741 handler: &mut ___H,
10742 sender: &::fidl_next::ServerSender<___T, Self>,
10743 ordinal: u64,
10744 buffer: ___T::RecvBuffer,
10745 ) {
10746 match ordinal {
10747 6123359741742396225 => {
10748 handler.remove(sender);
10749 }
10750
10751 ordinal => handler.on_unknown_interaction(sender, ordinal),
10752 }
10753 }
10754
10755 fn on_two_way(
10756 handler: &mut ___H,
10757 sender: &::fidl_next::ServerSender<___T, Self>,
10758 ordinal: u64,
10759 buffer: ___T::RecvBuffer,
10760 responder: ::fidl_next::protocol::Responder,
10761 ) {
10762 match ordinal {
10763 4735909333556220047 => {
10764 let responder = ::fidl_next::Responder::from_untyped(responder);
10765
10766 match ::fidl_next::DecoderExt::decode(buffer) {
10767 Ok(decoded) => handler.request_bind(sender, decoded, responder),
10768 Err(e) => {
10769 sender.close();
10770 }
10771 }
10772 }
10773
10774 ordinal => handler.on_unknown_interaction(sender, ordinal),
10775 }
10776 }
10777}
10778
10779pub mod compat {
10781
10782 impl ::core::convert::From<crate::Condition> for ::fidl_fuchsia_driver_framework::Condition {
10783 #[inline]
10784 fn from(from: crate::Condition) -> Self {
10785 match crate::Condition::from(from) {
10786 crate::Condition::Unknown => Self::Unknown,
10787
10788 crate::Condition::Accept => Self::Accept,
10789
10790 crate::Condition::Reject => Self::Reject,
10791 }
10792 }
10793 }
10794
10795 impl ::core::convert::From<crate::BusType> for ::fidl_fuchsia_driver_framework::BusType {
10796 #[inline]
10797 fn from(from: crate::BusType) -> Self {
10798 match crate::BusType::from(from) {
10799 crate::BusType::Platform => Self::Platform,
10800
10801 crate::BusType::Acpi => Self::Acpi,
10802
10803 crate::BusType::DeviceTree => Self::DeviceTree,
10804
10805 crate::BusType::Pci => Self::Pci,
10806
10807 crate::BusType::Usb => Self::Usb,
10808
10809 crate::BusType::Gpio => Self::Gpio,
10810
10811 crate::BusType::I2C => Self::I2C,
10812
10813 crate::BusType::Spi => Self::Spi,
10814
10815 crate::BusType::Sdio => Self::Sdio,
10816
10817 crate::BusType::Uart => Self::Uart,
10818
10819 crate::BusType::Spmi => Self::Spmi,
10820
10821 crate::BusType::UnknownOrdinal_(value) => {
10822 Self::__SourceBreaking { unknown_ordinal: value }
10823 }
10824 }
10825 }
10826 }
10827
10828 impl ::core::convert::From<crate::DeviceAddressStability>
10829 for ::fidl_fuchsia_driver_framework::DeviceAddressStability
10830 {
10831 #[inline]
10832 fn from(from: crate::DeviceAddressStability) -> Self {
10833 match crate::DeviceAddressStability::from(from) {
10834 crate::DeviceAddressStability::UnstableBetweenDriverRestart => {
10835 Self::UnstableBetweenDriverRestart
10836 }
10837
10838 crate::DeviceAddressStability::UnstableBetweenBoot => Self::UnstableBetweenBoot,
10839
10840 crate::DeviceAddressStability::UnstableBetweenSoftwareUpdate => {
10841 Self::UnstableBetweenSoftwareUpdate
10842 }
10843
10844 crate::DeviceAddressStability::Stable => Self::Stable,
10845
10846 crate::DeviceAddressStability::UnknownOrdinal_(value) => {
10847 Self::__SourceBreaking { unknown_ordinal: value }
10848 }
10849 }
10850 }
10851 }
10852
10853 impl ::core::convert::From<crate::DriverPackageType>
10854 for ::fidl_fuchsia_driver_framework::DriverPackageType
10855 {
10856 #[inline]
10857 fn from(from: crate::DriverPackageType) -> Self {
10858 match crate::DriverPackageType::from(from) {
10859 crate::DriverPackageType::Boot => Self::Boot,
10860
10861 crate::DriverPackageType::Base => Self::Base,
10862
10863 crate::DriverPackageType::Cached => Self::Cached,
10864
10865 crate::DriverPackageType::Universe => Self::Universe,
10866
10867 crate::DriverPackageType::UnknownOrdinal_(value) => {
10868 Self::__SourceBreaking { unknown_ordinal: value }
10869 }
10870 }
10871 }
10872 }
10873
10874 impl ::core::convert::From<crate::CompositeNodeSpecError>
10875 for ::fidl_fuchsia_driver_framework::CompositeNodeSpecError
10876 {
10877 #[inline]
10878 fn from(from: crate::CompositeNodeSpecError) -> Self {
10879 match crate::CompositeNodeSpecError::from(from) {
10880 crate::CompositeNodeSpecError::MissingArgs => Self::MissingArgs,
10881
10882 crate::CompositeNodeSpecError::EmptyNodes => Self::EmptyNodes,
10883
10884 crate::CompositeNodeSpecError::AlreadyExists => Self::AlreadyExists,
10885
10886 crate::CompositeNodeSpecError::DriverIndexFailure => Self::DriverIndexFailure,
10887
10888 crate::CompositeNodeSpecError::DuplicateParents => Self::DuplicateParents,
10889
10890 crate::CompositeNodeSpecError::UnknownOrdinal_(value) => {
10891 Self::__SourceBreaking { unknown_ordinal: value }
10892 }
10893 }
10894 }
10895 }
10896
10897 #[cfg(target_os = "fuchsia")]
10898 pub type CompositeNodeManagerProxy =
10901 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::CompositeNodeManager>;
10902
10903 impl ::core::convert::From<crate::CompositeNodeManager>
10904 for ::fidl_fuchsia_driver_framework::CompositeNodeManagerMarker
10905 {
10906 #[inline]
10907 fn from(_: crate::CompositeNodeManager) -> Self {
10908 Self
10909 }
10910 }
10911
10912 #[cfg(target_os = "fuchsia")]
10913 pub type DriverProxy =
10916 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::Driver>;
10917
10918 #[cfg(feature = "driver")]
10919 impl ::core::convert::From<crate::Driver> for ::fidl_fuchsia_driver_framework::DriverMarker {
10920 #[inline]
10921 fn from(_: crate::Driver) -> Self {
10922 Self
10923 }
10924 }
10925
10926 impl ::core::convert::From<crate::NodeError> for ::fidl_fuchsia_driver_framework::NodeError {
10927 #[inline]
10928 fn from(from: crate::NodeError) -> Self {
10929 match crate::NodeError::from(from) {
10930 crate::NodeError::Internal => Self::Internal,
10931
10932 crate::NodeError::NodeRemoved => Self::NodeRemoved,
10933
10934 crate::NodeError::NameMissing => Self::NameMissing,
10935
10936 crate::NodeError::NameInvalid => Self::NameInvalid,
10937
10938 crate::NodeError::NameAlreadyExists => Self::NameAlreadyExists,
10939
10940 crate::NodeError::OfferSourceNameMissing => Self::OfferSourceNameMissing,
10941
10942 crate::NodeError::OfferRefExists => Self::OfferRefExists,
10943
10944 crate::NodeError::SymbolNameMissing => Self::SymbolNameMissing,
10945
10946 crate::NodeError::SymbolAddressMissing => Self::SymbolAddressMissing,
10947
10948 crate::NodeError::SymbolAlreadyExists => Self::SymbolAlreadyExists,
10949
10950 crate::NodeError::UnbindChildrenInProgress => Self::UnbindChildrenInProgress,
10951
10952 crate::NodeError::UnsupportedArgs => Self::UnsupportedArgs,
10953
10954 crate::NodeError::UnknownOrdinal_(value) => {
10955 Self::__SourceBreaking { unknown_ordinal: value }
10956 }
10957 }
10958 }
10959 }
10960
10961 #[cfg(target_os = "fuchsia")]
10962 pub type NodeProxy = ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::Node>;
10965
10966 impl ::core::convert::From<crate::Node> for ::fidl_fuchsia_driver_framework::NodeMarker {
10967 #[inline]
10968 fn from(_: crate::Node) -> Self {
10969 Self
10970 }
10971 }
10972
10973 #[cfg(target_os = "fuchsia")]
10974 pub type NodeControllerProxy =
10977 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::NodeController>;
10978
10979 impl ::core::convert::From<crate::NodeController>
10980 for ::fidl_fuchsia_driver_framework::NodeControllerMarker
10981 {
10982 #[inline]
10983 fn from(_: crate::NodeController) -> Self {
10984 Self
10985 }
10986 }
10987}