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.address_stability.is_some() {
2272 return 3;
2273 }
2274
2275 if self.address.is_some() {
2276 return 2;
2277 }
2278
2279 if self.bus.is_some() {
2280 return 1;
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.subcategory.is_some() {
2761 return 2;
2762 }
2763
2764 if self.category.is_some() {
2765 return 1;
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.is_disabled.is_some() {
3050 return 9;
3051 }
3052
3053 if self.driver_framework_version.is_some() {
3054 return 8;
3055 }
3056
3057 if self.bind_rules_bytecode.is_some() {
3058 return 7;
3059 }
3060
3061 if self.device_categories.is_some() {
3062 return 6;
3063 }
3064
3065 if self.is_fallback.is_some() {
3066 return 5;
3067 }
3068
3069 if self.package_type.is_some() {
3070 return 4;
3071 }
3072
3073 if self.colocate.is_some() {
3074 return 3;
3075 }
3076
3077 if self.name.is_some() {
3078 return 2;
3079 }
3080
3081 if self.url.is_some() {
3082 return 1;
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.driver_info.is_some() {
3735 return 2;
3736 }
3737
3738 if self.composite_name.is_some() {
3739 return 1;
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.primary_parent_index.is_some() {
4012 return 3;
4013 }
4014
4015 if self.parent_names.is_some() {
4016 return 2;
4017 }
4018
4019 if self.composite_driver.is_some() {
4020 return 1;
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.parents2.is_some() {
5115 return 3;
5116 }
5117
5118 if self.parents.is_some() {
5119 return 2;
5120 }
5121
5122 if self.name.is_some() {
5123 return 1;
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.matched_driver.is_some() {
5450 return 2;
5451 }
5452
5453 if self.spec.is_some() {
5454 return 1;
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 = "fuchsia.driver.framework.CompositeNodeManager";
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<'_, composite_node_manager::AddSpec, Self::Transport>,
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<CompositeNodeManager, ___T>
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<'_, composite_node_manager::AddSpec, Self::Transport>,
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<CompositeNodeManager, ___T>,
5984 ordinal: u64,
5985 ) {
5986 sender.close();
5987 }
5988}
5989
5990impl<___H, ___T> ::fidl_next::ClientProtocol<___H, ___T> for CompositeNodeManager
5991where
5992 ___H: CompositeNodeManagerClientHandler<___T>,
5993 ___T: ::fidl_next::Transport,
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<Self, ___T>,
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<CompositeNodeManager, ___T>
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<CompositeNodeManager, ___T>,
6031
6032 request: ::fidl_next::Request<composite_node_manager::AddSpec, ___T>,
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<CompositeNodeManager, ___T>,
6040 ordinal: u64,
6041 ) {
6042 sender.close();
6043 }
6044}
6045
6046impl<___H, ___T> ::fidl_next::ServerProtocol<___H, ___T> for CompositeNodeManager
6047where
6048 ___H: CompositeNodeManagerServerHandler<___T>,
6049 ___T: ::fidl_next::Transport,
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<Self, ___T>,
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<Self, ___T>,
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.index.is_some() {
6100 return 2;
6101 }
6102
6103 if self.composite.is_some() {
6104 return 1;
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_device_fs::Connector,
6369 ::fidl_next::fuchsia::zx::Channel,
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_device_fs::Connector,
6382 ::fidl_next::fuchsia::zx::Channel,
6383 >,
6384 >,
6385}
6386
6387impl DevfsAddArgs {
6388 fn __max_ordinal(&self) -> usize {
6389 if self.controller_connector.is_some() {
6390 return 5;
6391 }
6392
6393 if self.connector_supports.is_some() {
6394 return 4;
6395 }
6396
6397 if self.inspect.is_some() {
6398 return 3;
6399 }
6400
6401 if self.class_name.is_some() {
6402 return 2;
6403 }
6404
6405 if self.connector.is_some() {
6406 return 1;
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_device_fs::Connector,
6534 ::fidl_next::fuchsia::WireChannel,
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_device_fs::Connector,
6561 ::fidl_next::fuchsia::WireChannel,
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_device_fs::Connector,
6580 ::fidl_next::fuchsia::WireChannel,
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_device_fs::Connector,
6600 ::fidl_next::fuchsia::WireChannel,
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_device_fs::Connector,
6637 ::fidl_next::fuchsia::WireChannel,
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_device_fs::Connector,
6687 ::fidl_next::fuchsia::WireChannel,
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_device_fs::Connector,
6706 ::fidl_next::fuchsia::WireChannel,
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_device_fs::Connector,
6729 ::fidl_next::fuchsia::WireChannel,
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.module_name.is_some() {
7201 return 3;
7202 }
7203
7204 if self.address.is_some() {
7205 return 2;
7206 }
7207
7208 if self.name.is_some() {
7209 return 1;
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<crate::Node, ::fidl_next::fuchsia::zx::Channel>>,
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_io::Directory,
7965 ::fidl_next::fuchsia::zx::Channel,
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_properties_2.is_some() {
7985 return 12;
7986 }
7987
7988 if self.node_token.is_some() {
7989 return 11;
7990 }
7991
7992 if self.node_offers.is_some() {
7993 return 10;
7994 }
7995
7996 if self.node_properties.is_some() {
7997 return 9;
7998 }
7999
8000 if self.node_name.is_some() {
8001 return 8;
8002 }
8003
8004 if self.config.is_some() {
8005 return 7;
8006 }
8007
8008 if self.outgoing_dir.is_some() {
8009 return 6;
8010 }
8011
8012 if self.incoming.is_some() {
8013 return 5;
8014 }
8015
8016 if self.program.is_some() {
8017 return 4;
8018 }
8019
8020 if self.url.is_some() {
8021 return 3;
8022 }
8023
8024 if self.symbols.is_some() {
8025 return 2;
8026 }
8027
8028 if self.node.is_some() {
8029 return 1;
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<
8255 crate::Node,::fidl_next::fuchsia::WireChannel,>>() }
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<
8281 ::fidl_next_fuchsia_io::Directory,::fidl_next::fuchsia::WireChannel,>>() }
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).map(|envelope| unsafe {
8327 envelope.read_unchecked::<::fidl_next::ClientEnd<
8328 crate::Node,::fidl_next::fuchsia::WireChannel,>>()
8329 });
8330
8331 let _ = self.table.get(2).map(|envelope| unsafe {
8332 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>>()
8333 });
8334
8335 let _ = self
8336 .table
8337 .get(3)
8338 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
8339
8340 let _ = self.table.get(4).map(|envelope| unsafe {
8341 envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
8342 });
8343
8344 let _ = self.table.get(5).map(|envelope| unsafe {
8345 envelope.read_unchecked::<::fidl_next::WireVector<
8346 'de,
8347 ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<'de>,
8348 >>()
8349 });
8350
8351 let _ = self.table.get(6).map(|envelope| unsafe {
8352 envelope.read_unchecked::<::fidl_next::ServerEnd<
8353 ::fidl_next_fuchsia_io::Directory,
8354 ::fidl_next::fuchsia::WireChannel,
8355 >>()
8356 });
8357
8358 let _ = self.table.get(7).map(|envelope| unsafe {
8359 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
8360 });
8361
8362 let _ = self
8363 .table
8364 .get(8)
8365 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
8366
8367 let _ = self.table.get(9)
8368 .map(|envelope| unsafe {
8369 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodePropertyEntry<'de>>>()
8370 });
8371
8372 let _ = self.table.get(10).map(|envelope| unsafe {
8373 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>()
8374 });
8375
8376 let _ = self.table.get(11).map(|envelope| unsafe {
8377 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
8378 });
8379
8380 let _ = self.table.get(12).map(|envelope| unsafe {
8381 envelope
8382 .read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodePropertyEntry2<'de>>>(
8383 )
8384 });
8385 }
8386}
8387
8388unsafe impl ::fidl_next::Wire for WireDriverStartArgs<'static> {
8389 type Decoded<'de> = WireDriverStartArgs<'de>;
8390
8391 #[inline]
8392 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
8393 ::fidl_next::munge!(let Self { table } = out);
8394 ::fidl_next::WireTable::zero_padding(table);
8395 }
8396}
8397
8398unsafe impl<___D> ::fidl_next::Decode<___D> for WireDriverStartArgs<'static>
8399where
8400 ___D: ::fidl_next::Decoder + ?Sized,
8401
8402 ___D: ::fidl_next::fuchsia::HandleDecoder,
8403{
8404 fn decode(
8405 slot: ::fidl_next::Slot<'_, Self>,
8406 decoder: &mut ___D,
8407 ) -> Result<(), ::fidl_next::DecodeError> {
8408 ::fidl_next::munge!(let Self { table } = slot);
8409
8410 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
8411 match ordinal {
8412 0 => unsafe { ::core::hint::unreachable_unchecked() },
8413
8414 1 => {
8415 ::fidl_next::WireEnvelope::decode_as::<
8416 ___D,
8417 ::fidl_next::ClientEnd<crate::Node, ::fidl_next::fuchsia::WireChannel>,
8418 >(slot.as_mut(), decoder)?;
8419
8420 Ok(())
8421 }
8422
8423 2 => {
8424 ::fidl_next::WireEnvelope::decode_as::<
8425 ___D,
8426 ::fidl_next::WireVector<'static, crate::WireNodeSymbol<'static>>,
8427 >(slot.as_mut(), decoder)?;
8428
8429 let symbols = unsafe {
8430 slot
8431 .deref_unchecked()
8432 .deref_unchecked::<
8433 ::fidl_next::WireVector<'_, crate::WireNodeSymbol<'_>>
8434 >()
8435 };
8436
8437 if symbols.len() > 64 {
8438 return Err(::fidl_next::DecodeError::VectorTooLong {
8439 size: symbols.len() as u64,
8440 limit: 64,
8441 });
8442 }
8443
8444 Ok(())
8445 }
8446
8447 3 => {
8448 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
8449 slot.as_mut(),
8450 decoder,
8451 )?;
8452
8453 let url = unsafe {
8454 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
8455 };
8456
8457 if url.len() > 4096 {
8458 return Err(::fidl_next::DecodeError::VectorTooLong {
8459 size: url.len() as u64,
8460 limit: 4096,
8461 });
8462 }
8463
8464 Ok(())
8465 }
8466
8467 4 => {
8468 ::fidl_next::WireEnvelope::decode_as::<
8469 ___D,
8470 ::fidl_next_fuchsia_data::WireDictionary<'static>,
8471 >(slot.as_mut(), decoder)?;
8472
8473 Ok(())
8474 }
8475
8476 5 => {
8477 ::fidl_next::WireEnvelope::decode_as::<
8478 ___D,
8479 ::fidl_next::WireVector<
8480 'static,
8481 ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<
8482 'static,
8483 >,
8484 >,
8485 >(slot.as_mut(), decoder)?;
8486
8487 let incoming = unsafe {
8488 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireVector<
8489 '_,
8490 ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<'_>,
8491 >>()
8492 };
8493
8494 if incoming.len() > 32 {
8495 return Err(::fidl_next::DecodeError::VectorTooLong {
8496 size: incoming.len() as u64,
8497 limit: 32,
8498 });
8499 }
8500
8501 Ok(())
8502 }
8503
8504 6 => {
8505 ::fidl_next::WireEnvelope::decode_as::<
8506 ___D,
8507 ::fidl_next::ServerEnd<
8508 ::fidl_next_fuchsia_io::Directory,
8509 ::fidl_next::fuchsia::WireChannel,
8510 >,
8511 >(slot.as_mut(), decoder)?;
8512
8513 Ok(())
8514 }
8515
8516 7 => {
8517 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
8518 slot.as_mut(),
8519 decoder,
8520 )?;
8521
8522 Ok(())
8523 }
8524
8525 8 => {
8526 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
8527 slot.as_mut(),
8528 decoder,
8529 )?;
8530
8531 Ok(())
8532 }
8533
8534 9 => {
8535 ::fidl_next::WireEnvelope::decode_as::<
8536 ___D,
8537 ::fidl_next::WireVector<'static, crate::WireNodePropertyEntry<'static>>,
8538 >(slot.as_mut(), decoder)?;
8539
8540 Ok(())
8541 }
8542
8543 10 => {
8544 ::fidl_next::WireEnvelope::decode_as::<
8545 ___D,
8546 ::fidl_next::WireVector<'static, crate::WireOffer<'static>>,
8547 >(slot.as_mut(), decoder)?;
8548
8549 let node_offers = unsafe {
8550 slot.deref_unchecked()
8551 .deref_unchecked::<::fidl_next::WireVector<'_, crate::WireOffer<'_>>>()
8552 };
8553
8554 if node_offers.len() > 128 {
8555 return Err(::fidl_next::DecodeError::VectorTooLong {
8556 size: node_offers.len() as u64,
8557 limit: 128,
8558 });
8559 }
8560
8561 Ok(())
8562 }
8563
8564 11 => {
8565 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
8566 slot.as_mut(),
8567 decoder,
8568 )?;
8569
8570 Ok(())
8571 }
8572
8573 12 => {
8574 ::fidl_next::WireEnvelope::decode_as::<
8575 ___D,
8576 ::fidl_next::WireVector<'static, crate::WireNodePropertyEntry2<'static>>,
8577 >(slot.as_mut(), decoder)?;
8578
8579 Ok(())
8580 }
8581
8582 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
8583 }
8584 })
8585 }
8586}
8587
8588impl<'de> WireDriverStartArgs<'de> {
8589 pub fn node(
8590 &self,
8591 ) -> Option<&::fidl_next::ClientEnd<crate::Node, ::fidl_next::fuchsia::WireChannel>> {
8592 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
8593 }
8594
8595 pub fn symbols(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>> {
8596 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
8597 }
8598
8599 pub fn url(&self) -> Option<&::fidl_next::WireString<'de>> {
8600 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
8601 }
8602
8603 pub fn program(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary<'de>> {
8604 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
8605 }
8606
8607 pub fn incoming(
8608 &self,
8609 ) -> Option<
8610 &::fidl_next::WireVector<
8611 'de,
8612 ::fidl_next_fuchsia_component_runner::WireComponentNamespaceEntry<'de>,
8613 >,
8614 > {
8615 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
8616 }
8617
8618 pub fn outgoing_dir(
8619 &self,
8620 ) -> Option<
8621 &::fidl_next::ServerEnd<
8622 ::fidl_next_fuchsia_io::Directory,
8623 ::fidl_next::fuchsia::WireChannel,
8624 >,
8625 > {
8626 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
8627 }
8628
8629 pub fn config(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
8630 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
8631 }
8632
8633 pub fn node_name(&self) -> Option<&::fidl_next::WireString<'de>> {
8634 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
8635 }
8636
8637 pub fn node_properties(
8638 &self,
8639 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNodePropertyEntry<'de>>> {
8640 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
8641 }
8642
8643 pub fn node_offers(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireOffer<'de>>> {
8644 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
8645 }
8646
8647 pub fn node_token(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
8648 unsafe { Some(self.table.get(11)?.deref_unchecked()) }
8649 }
8650
8651 pub fn node_properties_2(
8652 &self,
8653 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNodePropertyEntry2<'de>>> {
8654 unsafe { Some(self.table.get(12)?.deref_unchecked()) }
8655 }
8656}
8657
8658impl<'de> ::core::fmt::Debug for WireDriverStartArgs<'de> {
8659 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
8660 f.debug_struct("DriverStartArgs")
8661 .field("node", &self.node())
8662 .field("symbols", &self.symbols())
8663 .field("url", &self.url())
8664 .field("program", &self.program())
8665 .field("incoming", &self.incoming())
8666 .field("outgoing_dir", &self.outgoing_dir())
8667 .field("config", &self.config())
8668 .field("node_name", &self.node_name())
8669 .field("node_properties", &self.node_properties())
8670 .field("node_offers", &self.node_offers())
8671 .field("node_token", &self.node_token())
8672 .field("node_properties_2", &self.node_properties_2())
8673 .finish()
8674 }
8675}
8676
8677#[derive(Debug)]
8678pub struct DriverStartRequest {
8679 pub start_args: crate::DriverStartArgs,
8680}
8681
8682impl ::fidl_next::Encodable for DriverStartRequest {
8683 type Encoded = WireDriverStartRequest<'static>;
8684}
8685
8686unsafe impl<___E> ::fidl_next::Encode<___E> for DriverStartRequest
8687where
8688 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
8689
8690 ___E: ::fidl_next::Encoder,
8691
8692 ___E: ::fidl_next::fuchsia::HandleEncoder,
8693{
8694 #[inline]
8695 fn encode(
8696 self,
8697 encoder: &mut ___E,
8698 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8699 ) -> Result<(), ::fidl_next::EncodeError> {
8700 ::fidl_next::munge! {
8701 let Self::Encoded {
8702 start_args,
8703
8704 } = out;
8705 }
8706
8707 ::fidl_next::Encode::encode(self.start_args, encoder, start_args)?;
8708
8709 Ok(())
8710 }
8711}
8712
8713impl ::fidl_next::EncodableOption for DriverStartRequest {
8714 type EncodedOption = ::fidl_next::WireBox<'static, WireDriverStartRequest<'static>>;
8715}
8716
8717unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DriverStartRequest
8718where
8719 ___E: ::fidl_next::Encoder + ?Sized,
8720 DriverStartRequest: ::fidl_next::Encode<___E>,
8721{
8722 #[inline]
8723 fn encode_option(
8724 this: Option<Self>,
8725 encoder: &mut ___E,
8726 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
8727 ) -> Result<(), ::fidl_next::EncodeError> {
8728 if let Some(inner) = this {
8729 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
8730 ::fidl_next::WireBox::encode_present(out);
8731 } else {
8732 ::fidl_next::WireBox::encode_absent(out);
8733 }
8734
8735 Ok(())
8736 }
8737}
8738
8739impl<'de> ::fidl_next::FromWire<WireDriverStartRequest<'de>> for DriverStartRequest {
8740 #[inline]
8741 fn from_wire(wire: WireDriverStartRequest<'de>) -> Self {
8742 Self { start_args: ::fidl_next::FromWire::from_wire(wire.start_args) }
8743 }
8744}
8745
8746#[derive(Debug)]
8748#[repr(C)]
8749pub struct WireDriverStartRequest<'de> {
8750 pub start_args: crate::WireDriverStartArgs<'de>,
8751}
8752
8753unsafe impl ::fidl_next::Wire for WireDriverStartRequest<'static> {
8754 type Decoded<'de> = WireDriverStartRequest<'de>;
8755
8756 #[inline]
8757 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
8758}
8759
8760unsafe impl<___D> ::fidl_next::Decode<___D> for WireDriverStartRequest<'static>
8761where
8762 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
8763
8764 ___D: ::fidl_next::Decoder,
8765
8766 ___D: ::fidl_next::fuchsia::HandleDecoder,
8767{
8768 fn decode(
8769 slot: ::fidl_next::Slot<'_, Self>,
8770 decoder: &mut ___D,
8771 ) -> Result<(), ::fidl_next::DecodeError> {
8772 ::fidl_next::munge! {
8773 let Self {
8774 mut start_args,
8775
8776 } = slot;
8777 }
8778
8779 ::fidl_next::Decode::decode(start_args.as_mut(), decoder)?;
8780
8781 Ok(())
8782 }
8783}
8784
8785#[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"]
8787#[derive(Debug)]
8788pub struct Driver;
8789
8790pub mod driver {
8791 pub mod prelude {
8792 pub use crate::{
8793 driver, Driver, DriverClientHandler, DriverClientSender, DriverServerHandler,
8794 DriverServerSender,
8795 };
8796
8797 pub use crate::DriverStartRequest;
8798
8799 pub use crate::DriverStartResponse;
8800 }
8801
8802 pub struct Start;
8803
8804 impl ::fidl_next::Method for Start {
8805 const ORDINAL: u64 = 2863727161496985794;
8806
8807 type Protocol = crate::Driver;
8808
8809 type Request = crate::WireDriverStartRequest<'static>;
8810
8811 type Response = ::fidl_next::WireFlexibleResult<
8812 'static,
8813 crate::WireDriverStartResponse,
8814 ::fidl_next::WireI32,
8815 >;
8816 }
8817
8818 pub struct Stop;
8819
8820 impl ::fidl_next::Method for Stop {
8821 const ORDINAL: u64 = 5446759044519003197;
8822
8823 type Protocol = crate::Driver;
8824
8825 type Request = ();
8826
8827 type Response = ::fidl_next::Never;
8828 }
8829}
8830
8831pub trait DriverClientSender {
8833 type Transport: ::fidl_next::Transport;
8834
8835 #[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"]
8836 fn start<___R>(
8837 &self,
8838 request: ___R,
8839 ) -> Result<
8840 ::fidl_next::ResponseFuture<'_, driver::Start, Self::Transport>,
8841 ::fidl_next::EncodeError,
8842 >
8843 where
8844 ___R: ::fidl_next::Encode<
8845 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
8846 Encoded = crate::WireDriverStartRequest<'static>,
8847 >;
8848
8849 #[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"]
8850 fn stop(
8851 &self,
8852 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>;
8853}
8854
8855impl<___T> DriverClientSender for ::fidl_next::ClientSender<Driver, ___T>
8856where
8857 ___T: ::fidl_next::Transport,
8858{
8859 type Transport = ___T;
8860
8861 #[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"]
8862 fn start<___R>(
8863 &self,
8864 request: ___R,
8865 ) -> Result<
8866 ::fidl_next::ResponseFuture<'_, driver::Start, Self::Transport>,
8867 ::fidl_next::EncodeError,
8868 >
8869 where
8870 ___R: ::fidl_next::Encode<
8871 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
8872 Encoded = crate::WireDriverStartRequest<'static>,
8873 >,
8874 {
8875 self.as_untyped()
8876 .send_two_way(2863727161496985794, request)
8877 .map(::fidl_next::ResponseFuture::from_untyped)
8878 }
8879
8880 #[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"]
8881 fn stop(
8882 &self,
8883 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError> {
8884 self.as_untyped().send_one_way(5446759044519003197, ())
8885 }
8886}
8887
8888pub trait DriverClientHandler<___T: ::fidl_next::Transport> {
8892 fn on_unknown_interaction(
8893 &mut self,
8894 sender: &::fidl_next::ClientSender<Driver, ___T>,
8895 ordinal: u64,
8896 ) {
8897 sender.close();
8898 }
8899}
8900
8901impl<___H, ___T> ::fidl_next::ClientProtocol<___H, ___T> for Driver
8902where
8903 ___H: DriverClientHandler<___T>,
8904 ___T: ::fidl_next::Transport,
8905
8906 <driver::Start as ::fidl_next::Method>::Response:
8907 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
8908{
8909 fn on_event(
8910 handler: &mut ___H,
8911 sender: &::fidl_next::ClientSender<Self, ___T>,
8912 ordinal: u64,
8913 buffer: ___T::RecvBuffer,
8914 ) {
8915 match ordinal {
8916 ordinal => handler.on_unknown_interaction(sender, ordinal),
8917 }
8918 }
8919}
8920
8921pub trait DriverServerSender {
8923 type Transport: ::fidl_next::Transport;
8924}
8925
8926impl<___T> DriverServerSender for ::fidl_next::ServerSender<Driver, ___T>
8927where
8928 ___T: ::fidl_next::Transport,
8929{
8930 type Transport = ___T;
8931}
8932
8933pub trait DriverServerHandler<___T: ::fidl_next::Transport> {
8937 #[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"]
8938 fn start(
8939 &mut self,
8940 sender: &::fidl_next::ServerSender<Driver, ___T>,
8941
8942 request: ::fidl_next::Request<driver::Start, ___T>,
8943
8944 responder: ::fidl_next::Responder<driver::Start>,
8945 );
8946
8947 #[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"]
8948 fn stop(&mut self, sender: &::fidl_next::ServerSender<Driver, ___T>);
8949
8950 fn on_unknown_interaction(
8951 &mut self,
8952 sender: &::fidl_next::ServerSender<Driver, ___T>,
8953 ordinal: u64,
8954 ) {
8955 sender.close();
8956 }
8957}
8958
8959impl<___H, ___T> ::fidl_next::ServerProtocol<___H, ___T> for Driver
8960where
8961 ___H: DriverServerHandler<___T>,
8962 ___T: ::fidl_next::Transport,
8963
8964 <driver::Start as ::fidl_next::Method>::Request:
8965 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
8966{
8967 fn on_one_way(
8968 handler: &mut ___H,
8969 sender: &::fidl_next::ServerSender<Self, ___T>,
8970 ordinal: u64,
8971 buffer: ___T::RecvBuffer,
8972 ) {
8973 match ordinal {
8974 5446759044519003197 => {
8975 handler.stop(sender);
8976 }
8977
8978 ordinal => handler.on_unknown_interaction(sender, ordinal),
8979 }
8980 }
8981
8982 fn on_two_way(
8983 handler: &mut ___H,
8984 sender: &::fidl_next::ServerSender<Self, ___T>,
8985 ordinal: u64,
8986 buffer: ___T::RecvBuffer,
8987 responder: ::fidl_next::protocol::Responder,
8988 ) {
8989 match ordinal {
8990 2863727161496985794 => {
8991 let responder = ::fidl_next::Responder::from_untyped(responder);
8992
8993 match ::fidl_next::DecoderExt::decode(buffer) {
8994 Ok(decoded) => handler.start(sender, decoded, responder),
8995 Err(e) => {
8996 sender.close();
8997 }
8998 }
8999 }
9000
9001 ordinal => handler.on_unknown_interaction(sender, ordinal),
9002 }
9003 }
9004}
9005
9006pub const MAX_RESOURCE_NAME_LENGTH: u8 = 128;
9007
9008pub type NodeAddChildResponse = ();
9009
9010pub type WireNodeAddChildResponse = ();
9012
9013#[doc = " Error codes for the Node protocol.\n"]
9014#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9015#[repr(u32)]
9016pub enum NodeError {
9017 Internal = 1,
9018 NodeRemoved = 2,
9019 NameMissing = 3,
9020 NameInvalid = 4,
9021 NameAlreadyExists = 5,
9022 OfferSourceNameMissing = 6,
9023 OfferRefExists = 7,
9024 SymbolNameMissing = 8,
9025 SymbolAddressMissing = 9,
9026 SymbolAlreadyExists = 10,
9027 UnbindChildrenInProgress = 11,
9028 UnsupportedArgs = 12,
9029 DuplicatePropertyKeys = 13,
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 13 => Self::DuplicatePropertyKeys,
9052
9053 _ => Self::UnknownOrdinal_(value),
9054 }
9055 }
9056}
9057
9058unsafe impl<___E> ::fidl_next::Encode<___E> for NodeError
9059where
9060 ___E: ?Sized,
9061{
9062 #[inline]
9063 fn encode(
9064 self,
9065 encoder: &mut ___E,
9066 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9067 ) -> Result<(), ::fidl_next::EncodeError> {
9068 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
9069 }
9070}
9071
9072unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodeError
9073where
9074 ___E: ?Sized,
9075{
9076 #[inline]
9077 fn encode_ref(
9078 &self,
9079 encoder: &mut ___E,
9080 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9081 ) -> Result<(), ::fidl_next::EncodeError> {
9082 ::fidl_next::munge!(let WireNodeError { value } = out);
9083 let _ = value.write(::fidl_next::WireU32::from(match *self {
9084 Self::Internal => 1,
9085
9086 Self::NodeRemoved => 2,
9087
9088 Self::NameMissing => 3,
9089
9090 Self::NameInvalid => 4,
9091
9092 Self::NameAlreadyExists => 5,
9093
9094 Self::OfferSourceNameMissing => 6,
9095
9096 Self::OfferRefExists => 7,
9097
9098 Self::SymbolNameMissing => 8,
9099
9100 Self::SymbolAddressMissing => 9,
9101
9102 Self::SymbolAlreadyExists => 10,
9103
9104 Self::UnbindChildrenInProgress => 11,
9105
9106 Self::UnsupportedArgs => 12,
9107
9108 Self::DuplicatePropertyKeys => 13,
9109
9110 Self::UnknownOrdinal_(value) => value,
9111 }));
9112
9113 Ok(())
9114 }
9115}
9116
9117impl ::core::convert::From<WireNodeError> for NodeError {
9118 fn from(wire: WireNodeError) -> Self {
9119 match u32::from(wire.value) {
9120 1 => Self::Internal,
9121
9122 2 => Self::NodeRemoved,
9123
9124 3 => Self::NameMissing,
9125
9126 4 => Self::NameInvalid,
9127
9128 5 => Self::NameAlreadyExists,
9129
9130 6 => Self::OfferSourceNameMissing,
9131
9132 7 => Self::OfferRefExists,
9133
9134 8 => Self::SymbolNameMissing,
9135
9136 9 => Self::SymbolAddressMissing,
9137
9138 10 => Self::SymbolAlreadyExists,
9139
9140 11 => Self::UnbindChildrenInProgress,
9141
9142 12 => Self::UnsupportedArgs,
9143
9144 13 => Self::DuplicatePropertyKeys,
9145
9146 value => Self::UnknownOrdinal_(value),
9147 }
9148 }
9149}
9150
9151impl ::fidl_next::FromWire<WireNodeError> for NodeError {
9152 #[inline]
9153 fn from_wire(wire: WireNodeError) -> Self {
9154 Self::from(wire)
9155 }
9156}
9157
9158impl ::fidl_next::FromWireRef<WireNodeError> for NodeError {
9159 #[inline]
9160 fn from_wire_ref(wire: &WireNodeError) -> Self {
9161 Self::from(*wire)
9162 }
9163}
9164
9165#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9167#[repr(transparent)]
9168pub struct WireNodeError {
9169 value: ::fidl_next::WireU32,
9170}
9171
9172unsafe impl ::fidl_next::Wire for WireNodeError {
9173 type Decoded<'de> = Self;
9174
9175 #[inline]
9176 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
9177 }
9179}
9180
9181impl WireNodeError {
9182 pub const INTERNAL: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(1) };
9183
9184 pub const NODE_REMOVED: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(2) };
9185
9186 pub const NAME_MISSING: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(3) };
9187
9188 pub const NAME_INVALID: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(4) };
9189
9190 pub const NAME_ALREADY_EXISTS: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(5) };
9191
9192 pub const OFFER_SOURCE_NAME_MISSING: WireNodeError =
9193 WireNodeError { value: ::fidl_next::WireU32(6) };
9194
9195 pub const OFFER_REF_EXISTS: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(7) };
9196
9197 pub const SYMBOL_NAME_MISSING: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(8) };
9198
9199 pub const SYMBOL_ADDRESS_MISSING: WireNodeError =
9200 WireNodeError { value: ::fidl_next::WireU32(9) };
9201
9202 pub const SYMBOL_ALREADY_EXISTS: WireNodeError =
9203 WireNodeError { value: ::fidl_next::WireU32(10) };
9204
9205 pub const UNBIND_CHILDREN_IN_PROGRESS: WireNodeError =
9206 WireNodeError { value: ::fidl_next::WireU32(11) };
9207
9208 pub const UNSUPPORTED_ARGS: WireNodeError = WireNodeError { value: ::fidl_next::WireU32(12) };
9209
9210 pub const DUPLICATE_PROPERTY_KEYS: WireNodeError =
9211 WireNodeError { value: ::fidl_next::WireU32(13) };
9212}
9213
9214unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeError
9215where
9216 ___D: ?Sized,
9217{
9218 fn decode(
9219 slot: ::fidl_next::Slot<'_, Self>,
9220 _: &mut ___D,
9221 ) -> Result<(), ::fidl_next::DecodeError> {
9222 Ok(())
9223 }
9224}
9225
9226impl ::core::convert::From<NodeError> for WireNodeError {
9227 fn from(natural: NodeError) -> Self {
9228 match natural {
9229 NodeError::Internal => WireNodeError::INTERNAL,
9230
9231 NodeError::NodeRemoved => WireNodeError::NODE_REMOVED,
9232
9233 NodeError::NameMissing => WireNodeError::NAME_MISSING,
9234
9235 NodeError::NameInvalid => WireNodeError::NAME_INVALID,
9236
9237 NodeError::NameAlreadyExists => WireNodeError::NAME_ALREADY_EXISTS,
9238
9239 NodeError::OfferSourceNameMissing => WireNodeError::OFFER_SOURCE_NAME_MISSING,
9240
9241 NodeError::OfferRefExists => WireNodeError::OFFER_REF_EXISTS,
9242
9243 NodeError::SymbolNameMissing => WireNodeError::SYMBOL_NAME_MISSING,
9244
9245 NodeError::SymbolAddressMissing => WireNodeError::SYMBOL_ADDRESS_MISSING,
9246
9247 NodeError::SymbolAlreadyExists => WireNodeError::SYMBOL_ALREADY_EXISTS,
9248
9249 NodeError::UnbindChildrenInProgress => WireNodeError::UNBIND_CHILDREN_IN_PROGRESS,
9250
9251 NodeError::UnsupportedArgs => WireNodeError::UNSUPPORTED_ARGS,
9252
9253 NodeError::DuplicatePropertyKeys => WireNodeError::DUPLICATE_PROPERTY_KEYS,
9254
9255 NodeError::UnknownOrdinal_(value) => {
9256 WireNodeError { value: ::fidl_next::WireU32::from(value) }
9257 }
9258 }
9259 }
9260}
9261
9262#[doc = " Arguments for adding a node.\n"]
9263#[derive(Debug, Default)]
9264pub struct NodeAddArgs {
9265 pub name: Option<String>,
9266
9267 pub symbols: Option<Vec<crate::NodeSymbol>>,
9268
9269 pub properties: Option<Vec<crate::NodeProperty>>,
9270
9271 pub devfs_args: Option<crate::DevfsAddArgs>,
9272
9273 pub offers2: Option<Vec<crate::Offer>>,
9274
9275 pub bus_info: Option<crate::BusInfo>,
9276
9277 pub properties2: Option<Vec<crate::NodeProperty2>>,
9278}
9279
9280impl NodeAddArgs {
9281 fn __max_ordinal(&self) -> usize {
9282 if self.properties2.is_some() {
9283 return 8;
9284 }
9285
9286 if self.bus_info.is_some() {
9287 return 7;
9288 }
9289
9290 if self.offers2.is_some() {
9291 return 6;
9292 }
9293
9294 if self.devfs_args.is_some() {
9295 return 5;
9296 }
9297
9298 if self.properties.is_some() {
9299 return 4;
9300 }
9301
9302 if self.symbols.is_some() {
9303 return 3;
9304 }
9305
9306 if self.name.is_some() {
9307 return 1;
9308 }
9309
9310 0
9311 }
9312}
9313
9314impl ::fidl_next::Encodable for NodeAddArgs {
9315 type Encoded = WireNodeAddArgs<'static>;
9316}
9317
9318unsafe impl<___E> ::fidl_next::Encode<___E> for NodeAddArgs
9319where
9320 ___E: ::fidl_next::Encoder + ?Sized,
9321
9322 ___E: ::fidl_next::fuchsia::HandleEncoder,
9323{
9324 #[inline]
9325 fn encode(
9326 mut self,
9327 encoder: &mut ___E,
9328 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9329 ) -> Result<(), ::fidl_next::EncodeError> {
9330 ::fidl_next::munge!(let WireNodeAddArgs { table } = out);
9331
9332 let max_ord = self.__max_ordinal();
9333
9334 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
9335 ::fidl_next::Wire::zero_padding(&mut out);
9336
9337 let mut preallocated =
9338 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
9339
9340 for i in 1..=max_ord {
9341 match i {
9342 8 => {
9343 if let Some(properties2) = self.properties2.take() {
9344 ::fidl_next::WireEnvelope::encode_value(
9345 properties2,
9346 preallocated.encoder,
9347 &mut out,
9348 )?;
9349 } else {
9350 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9351 }
9352 }
9353
9354 7 => {
9355 if let Some(bus_info) = self.bus_info.take() {
9356 ::fidl_next::WireEnvelope::encode_value(
9357 bus_info,
9358 preallocated.encoder,
9359 &mut out,
9360 )?;
9361 } else {
9362 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9363 }
9364 }
9365
9366 6 => {
9367 if let Some(offers2) = self.offers2.take() {
9368 ::fidl_next::WireEnvelope::encode_value(
9369 offers2,
9370 preallocated.encoder,
9371 &mut out,
9372 )?;
9373 } else {
9374 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9375 }
9376 }
9377
9378 5 => {
9379 if let Some(devfs_args) = self.devfs_args.take() {
9380 ::fidl_next::WireEnvelope::encode_value(
9381 devfs_args,
9382 preallocated.encoder,
9383 &mut out,
9384 )?;
9385 } else {
9386 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9387 }
9388 }
9389
9390 4 => {
9391 if let Some(properties) = self.properties.take() {
9392 ::fidl_next::WireEnvelope::encode_value(
9393 properties,
9394 preallocated.encoder,
9395 &mut out,
9396 )?;
9397 } else {
9398 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9399 }
9400 }
9401
9402 3 => {
9403 if let Some(symbols) = self.symbols.take() {
9404 ::fidl_next::WireEnvelope::encode_value(
9405 symbols,
9406 preallocated.encoder,
9407 &mut out,
9408 )?;
9409 } else {
9410 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9411 }
9412 }
9413
9414 1 => {
9415 if let Some(name) = self.name.take() {
9416 ::fidl_next::WireEnvelope::encode_value(
9417 name,
9418 preallocated.encoder,
9419 &mut out,
9420 )?;
9421 } else {
9422 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9423 }
9424 }
9425
9426 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
9427 }
9428 unsafe {
9429 preallocated.write_next(out.assume_init_ref());
9430 }
9431 }
9432
9433 ::fidl_next::WireTable::encode_len(table, max_ord);
9434
9435 Ok(())
9436 }
9437}
9438
9439impl<'de> ::fidl_next::FromWire<WireNodeAddArgs<'de>> for NodeAddArgs {
9440 #[inline]
9441 fn from_wire(wire: WireNodeAddArgs<'de>) -> Self {
9442 let wire = ::core::mem::ManuallyDrop::new(wire);
9443
9444 let name = wire.table.get(1);
9445
9446 let symbols = wire.table.get(3);
9447
9448 let properties = wire.table.get(4);
9449
9450 let devfs_args = wire.table.get(5);
9451
9452 let offers2 = wire.table.get(6);
9453
9454 let bus_info = wire.table.get(7);
9455
9456 let properties2 = wire.table.get(8);
9457
9458 Self {
9459
9460
9461 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
9462 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
9463 )),
9464
9465
9466 symbols: symbols.map(|envelope| ::fidl_next::FromWire::from_wire(
9467 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>>() }
9468 )),
9469
9470
9471 properties: properties.map(|envelope| ::fidl_next::FromWire::from_wire(
9472 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>>() }
9473 )),
9474
9475
9476 devfs_args: devfs_args.map(|envelope| ::fidl_next::FromWire::from_wire(
9477 unsafe { envelope.read_unchecked::<crate::WireDevfsAddArgs<'de>>() }
9478 )),
9479
9480
9481 offers2: offers2.map(|envelope| ::fidl_next::FromWire::from_wire(
9482 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>() }
9483 )),
9484
9485
9486 bus_info: bus_info.map(|envelope| ::fidl_next::FromWire::from_wire(
9487 unsafe { envelope.read_unchecked::<crate::WireBusInfo<'de>>() }
9488 )),
9489
9490
9491 properties2: properties2.map(|envelope| ::fidl_next::FromWire::from_wire(
9492 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>>() }
9493 )),
9494
9495 }
9496 }
9497}
9498
9499#[repr(C)]
9501pub struct WireNodeAddArgs<'de> {
9502 table: ::fidl_next::WireTable<'de>,
9503}
9504
9505impl<'de> Drop for WireNodeAddArgs<'de> {
9506 fn drop(&mut self) {
9507 let _ = self
9508 .table
9509 .get(1)
9510 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
9511
9512 let _ = self.table.get(3).map(|envelope| unsafe {
9513 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>>()
9514 });
9515
9516 let _ = self.table.get(4).map(|envelope| unsafe {
9517 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>>()
9518 });
9519
9520 let _ = self
9521 .table
9522 .get(5)
9523 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDevfsAddArgs<'de>>() });
9524
9525 let _ = self.table.get(6).map(|envelope| unsafe {
9526 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>()
9527 });
9528
9529 let _ = self
9530 .table
9531 .get(7)
9532 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireBusInfo<'de>>() });
9533
9534 let _ = self.table.get(8).map(|envelope| unsafe {
9535 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>>()
9536 });
9537 }
9538}
9539
9540unsafe impl ::fidl_next::Wire for WireNodeAddArgs<'static> {
9541 type Decoded<'de> = WireNodeAddArgs<'de>;
9542
9543 #[inline]
9544 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9545 ::fidl_next::munge!(let Self { table } = out);
9546 ::fidl_next::WireTable::zero_padding(table);
9547 }
9548}
9549
9550unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeAddArgs<'static>
9551where
9552 ___D: ::fidl_next::Decoder + ?Sized,
9553
9554 ___D: ::fidl_next::fuchsia::HandleDecoder,
9555{
9556 fn decode(
9557 slot: ::fidl_next::Slot<'_, Self>,
9558 decoder: &mut ___D,
9559 ) -> Result<(), ::fidl_next::DecodeError> {
9560 ::fidl_next::munge!(let Self { table } = slot);
9561
9562 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
9563 match ordinal {
9564 0 => unsafe { ::core::hint::unreachable_unchecked() },
9565
9566 1 => {
9567 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
9568 slot.as_mut(),
9569 decoder,
9570 )?;
9571
9572 let name = unsafe {
9573 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
9574 };
9575
9576 if name.len() > 128 {
9577 return Err(::fidl_next::DecodeError::VectorTooLong {
9578 size: name.len() as u64,
9579 limit: 128,
9580 });
9581 }
9582
9583 Ok(())
9584 }
9585
9586 3 => {
9587 ::fidl_next::WireEnvelope::decode_as::<
9588 ___D,
9589 ::fidl_next::WireVector<'static, crate::WireNodeSymbol<'static>>,
9590 >(slot.as_mut(), decoder)?;
9591
9592 let symbols = unsafe {
9593 slot
9594 .deref_unchecked()
9595 .deref_unchecked::<
9596 ::fidl_next::WireVector<'_, crate::WireNodeSymbol<'_>>
9597 >()
9598 };
9599
9600 if symbols.len() > 64 {
9601 return Err(::fidl_next::DecodeError::VectorTooLong {
9602 size: symbols.len() as u64,
9603 limit: 64,
9604 });
9605 }
9606
9607 Ok(())
9608 }
9609
9610 4 => {
9611 ::fidl_next::WireEnvelope::decode_as::<
9612 ___D,
9613 ::fidl_next::WireVector<'static, crate::WireNodeProperty<'static>>,
9614 >(slot.as_mut(), decoder)?;
9615
9616 let properties = unsafe {
9617 slot
9618 .deref_unchecked()
9619 .deref_unchecked::<
9620 ::fidl_next::WireVector<'_, crate::WireNodeProperty<'_>>
9621 >()
9622 };
9623
9624 if properties.len() > 64 {
9625 return Err(::fidl_next::DecodeError::VectorTooLong {
9626 size: properties.len() as u64,
9627 limit: 64,
9628 });
9629 }
9630
9631 Ok(())
9632 }
9633
9634 5 => {
9635 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDevfsAddArgs<'static>>(
9636 slot.as_mut(),
9637 decoder,
9638 )?;
9639
9640 Ok(())
9641 }
9642
9643 6 => {
9644 ::fidl_next::WireEnvelope::decode_as::<
9645 ___D,
9646 ::fidl_next::WireVector<'static, crate::WireOffer<'static>>,
9647 >(slot.as_mut(), decoder)?;
9648
9649 let offers2 = unsafe {
9650 slot.deref_unchecked()
9651 .deref_unchecked::<::fidl_next::WireVector<'_, crate::WireOffer<'_>>>()
9652 };
9653
9654 if offers2.len() > 128 {
9655 return Err(::fidl_next::DecodeError::VectorTooLong {
9656 size: offers2.len() as u64,
9657 limit: 128,
9658 });
9659 }
9660
9661 Ok(())
9662 }
9663
9664 7 => {
9665 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireBusInfo<'static>>(
9666 slot.as_mut(),
9667 decoder,
9668 )?;
9669
9670 Ok(())
9671 }
9672
9673 8 => {
9674 ::fidl_next::WireEnvelope::decode_as::<
9675 ___D,
9676 ::fidl_next::WireVector<'static, crate::WireNodeProperty2<'static>>,
9677 >(slot.as_mut(), decoder)?;
9678
9679 let properties2 = unsafe {
9680 slot
9681 .deref_unchecked()
9682 .deref_unchecked::<
9683 ::fidl_next::WireVector<'_, crate::WireNodeProperty2<'_>>
9684 >()
9685 };
9686
9687 if properties2.len() > 64 {
9688 return Err(::fidl_next::DecodeError::VectorTooLong {
9689 size: properties2.len() as u64,
9690 limit: 64,
9691 });
9692 }
9693
9694 Ok(())
9695 }
9696
9697 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
9698 }
9699 })
9700 }
9701}
9702
9703impl<'de> WireNodeAddArgs<'de> {
9704 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
9705 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
9706 }
9707
9708 pub fn symbols(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireNodeSymbol<'de>>> {
9709 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
9710 }
9711
9712 pub fn properties(
9713 &self,
9714 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNodeProperty<'de>>> {
9715 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
9716 }
9717
9718 pub fn devfs_args(&self) -> Option<&crate::WireDevfsAddArgs<'de>> {
9719 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
9720 }
9721
9722 pub fn offers2(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireOffer<'de>>> {
9723 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
9724 }
9725
9726 pub fn bus_info(&self) -> Option<&crate::WireBusInfo<'de>> {
9727 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
9728 }
9729
9730 pub fn properties2(
9731 &self,
9732 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNodeProperty2<'de>>> {
9733 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
9734 }
9735}
9736
9737impl<'de> ::core::fmt::Debug for WireNodeAddArgs<'de> {
9738 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
9739 f.debug_struct("NodeAddArgs")
9740 .field("name", &self.name())
9741 .field("symbols", &self.symbols())
9742 .field("properties", &self.properties())
9743 .field("devfs_args", &self.devfs_args())
9744 .field("offers2", &self.offers2())
9745 .field("bus_info", &self.bus_info())
9746 .field("properties2", &self.properties2())
9747 .finish()
9748 }
9749}
9750
9751#[derive(Debug)]
9752pub struct NodeAddChildRequest {
9753 pub args: crate::NodeAddArgs,
9754
9755 pub controller:
9756 ::fidl_next::ServerEnd<crate::NodeController, ::fidl_next::fuchsia::zx::Channel>,
9757
9758 pub node: ::fidl_next::ServerEnd<crate::Node, Option<::fidl_next::fuchsia::zx::Channel>>,
9759}
9760
9761impl ::fidl_next::Encodable for NodeAddChildRequest {
9762 type Encoded = WireNodeAddChildRequest<'static>;
9763}
9764
9765unsafe impl<___E> ::fidl_next::Encode<___E> for NodeAddChildRequest
9766where
9767 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
9768
9769 ___E: ::fidl_next::Encoder,
9770
9771 ___E: ::fidl_next::fuchsia::HandleEncoder,
9772{
9773 #[inline]
9774 fn encode(
9775 self,
9776 encoder: &mut ___E,
9777 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9778 ) -> Result<(), ::fidl_next::EncodeError> {
9779 ::fidl_next::munge! {
9780 let Self::Encoded {
9781 args,
9782 controller,
9783 node,
9784
9785 } = out;
9786 }
9787
9788 ::fidl_next::Encode::encode(self.args, encoder, args)?;
9789
9790 ::fidl_next::Encode::encode(self.controller, encoder, controller)?;
9791
9792 ::fidl_next::Encode::encode(self.node, encoder, node)?;
9793
9794 Ok(())
9795 }
9796}
9797
9798impl ::fidl_next::EncodableOption for NodeAddChildRequest {
9799 type EncodedOption = ::fidl_next::WireBox<'static, WireNodeAddChildRequest<'static>>;
9800}
9801
9802unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NodeAddChildRequest
9803where
9804 ___E: ::fidl_next::Encoder + ?Sized,
9805 NodeAddChildRequest: ::fidl_next::Encode<___E>,
9806{
9807 #[inline]
9808 fn encode_option(
9809 this: Option<Self>,
9810 encoder: &mut ___E,
9811 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
9812 ) -> Result<(), ::fidl_next::EncodeError> {
9813 if let Some(inner) = this {
9814 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
9815 ::fidl_next::WireBox::encode_present(out);
9816 } else {
9817 ::fidl_next::WireBox::encode_absent(out);
9818 }
9819
9820 Ok(())
9821 }
9822}
9823
9824impl<'de> ::fidl_next::FromWire<WireNodeAddChildRequest<'de>> for NodeAddChildRequest {
9825 #[inline]
9826 fn from_wire(wire: WireNodeAddChildRequest<'de>) -> Self {
9827 Self {
9828 args: ::fidl_next::FromWire::from_wire(wire.args),
9829
9830 controller: ::fidl_next::FromWire::from_wire(wire.controller),
9831
9832 node: ::fidl_next::FromWire::from_wire(wire.node),
9833 }
9834 }
9835}
9836
9837#[derive(Debug)]
9839#[repr(C)]
9840pub struct WireNodeAddChildRequest<'de> {
9841 pub args: crate::WireNodeAddArgs<'de>,
9842
9843 pub controller:
9844 ::fidl_next::ServerEnd<crate::NodeController, ::fidl_next::fuchsia::WireChannel>,
9845
9846 pub node: ::fidl_next::ServerEnd<crate::Node, ::fidl_next::fuchsia::WireOptionalChannel>,
9847}
9848
9849unsafe impl ::fidl_next::Wire for WireNodeAddChildRequest<'static> {
9850 type Decoded<'de> = WireNodeAddChildRequest<'de>;
9851
9852 #[inline]
9853 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
9854}
9855
9856unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeAddChildRequest<'static>
9857where
9858 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
9859
9860 ___D: ::fidl_next::Decoder,
9861
9862 ___D: ::fidl_next::fuchsia::HandleDecoder,
9863{
9864 fn decode(
9865 slot: ::fidl_next::Slot<'_, Self>,
9866 decoder: &mut ___D,
9867 ) -> Result<(), ::fidl_next::DecodeError> {
9868 ::fidl_next::munge! {
9869 let Self {
9870 mut args,
9871 mut controller,
9872 mut node,
9873
9874 } = slot;
9875 }
9876
9877 ::fidl_next::Decode::decode(args.as_mut(), decoder)?;
9878
9879 ::fidl_next::Decode::decode(controller.as_mut(), decoder)?;
9880
9881 ::fidl_next::Decode::decode(node.as_mut(), decoder)?;
9882
9883 Ok(())
9884 }
9885}
9886
9887#[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"]
9889#[derive(Debug)]
9890pub struct Node;
9891
9892pub mod node {
9893 pub mod prelude {
9894 pub use crate::{
9895 node, Node, NodeClientHandler, NodeClientSender, NodeServerHandler, NodeServerSender,
9896 };
9897
9898 pub use crate::NodeAddChildRequest;
9899
9900 pub use crate::NodeError;
9901
9902 pub use crate::NodeAddChildResponse;
9903 }
9904
9905 pub struct AddChild;
9906
9907 impl ::fidl_next::Method for AddChild {
9908 const ORDINAL: u64 = 8633697350522413353;
9909
9910 type Protocol = crate::Node;
9911
9912 type Request = crate::WireNodeAddChildRequest<'static>;
9913
9914 type Response = ::fidl_next::WireFlexibleResult<
9915 'static,
9916 crate::WireNodeAddChildResponse,
9917 crate::WireNodeError,
9918 >;
9919 }
9920}
9921
9922pub trait NodeClientSender {
9924 type Transport: ::fidl_next::Transport;
9925
9926 #[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"]
9927 fn add_child<___R>(
9928 &self,
9929 request: ___R,
9930 ) -> Result<
9931 ::fidl_next::ResponseFuture<'_, node::AddChild, Self::Transport>,
9932 ::fidl_next::EncodeError,
9933 >
9934 where
9935 ___R: ::fidl_next::Encode<
9936 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
9937 Encoded = crate::WireNodeAddChildRequest<'static>,
9938 >;
9939}
9940
9941impl<___T> NodeClientSender for ::fidl_next::ClientSender<Node, ___T>
9942where
9943 ___T: ::fidl_next::Transport,
9944{
9945 type Transport = ___T;
9946
9947 #[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"]
9948 fn add_child<___R>(
9949 &self,
9950 request: ___R,
9951 ) -> Result<
9952 ::fidl_next::ResponseFuture<'_, node::AddChild, Self::Transport>,
9953 ::fidl_next::EncodeError,
9954 >
9955 where
9956 ___R: ::fidl_next::Encode<
9957 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
9958 Encoded = crate::WireNodeAddChildRequest<'static>,
9959 >,
9960 {
9961 self.as_untyped()
9962 .send_two_way(8633697350522413353, request)
9963 .map(::fidl_next::ResponseFuture::from_untyped)
9964 }
9965}
9966
9967pub trait NodeClientHandler<___T: ::fidl_next::Transport> {
9971 fn on_unknown_interaction(
9972 &mut self,
9973 sender: &::fidl_next::ClientSender<Node, ___T>,
9974 ordinal: u64,
9975 ) {
9976 sender.close();
9977 }
9978}
9979
9980impl<___H, ___T> ::fidl_next::ClientProtocol<___H, ___T> for Node
9981where
9982 ___H: NodeClientHandler<___T>,
9983 ___T: ::fidl_next::Transport,
9984
9985 <node::AddChild as ::fidl_next::Method>::Response:
9986 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
9987{
9988 fn on_event(
9989 handler: &mut ___H,
9990 sender: &::fidl_next::ClientSender<Self, ___T>,
9991 ordinal: u64,
9992 buffer: ___T::RecvBuffer,
9993 ) {
9994 match ordinal {
9995 ordinal => handler.on_unknown_interaction(sender, ordinal),
9996 }
9997 }
9998}
9999
10000pub trait NodeServerSender {
10002 type Transport: ::fidl_next::Transport;
10003}
10004
10005impl<___T> NodeServerSender for ::fidl_next::ServerSender<Node, ___T>
10006where
10007 ___T: ::fidl_next::Transport,
10008{
10009 type Transport = ___T;
10010}
10011
10012pub trait NodeServerHandler<___T: ::fidl_next::Transport> {
10016 #[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"]
10017 fn add_child(
10018 &mut self,
10019 sender: &::fidl_next::ServerSender<Node, ___T>,
10020
10021 request: ::fidl_next::Request<node::AddChild, ___T>,
10022
10023 responder: ::fidl_next::Responder<node::AddChild>,
10024 );
10025
10026 fn on_unknown_interaction(
10027 &mut self,
10028 sender: &::fidl_next::ServerSender<Node, ___T>,
10029 ordinal: u64,
10030 ) {
10031 sender.close();
10032 }
10033}
10034
10035impl<___H, ___T> ::fidl_next::ServerProtocol<___H, ___T> for Node
10036where
10037 ___H: NodeServerHandler<___T>,
10038 ___T: ::fidl_next::Transport,
10039
10040 <node::AddChild as ::fidl_next::Method>::Request:
10041 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
10042{
10043 fn on_one_way(
10044 handler: &mut ___H,
10045 sender: &::fidl_next::ServerSender<Self, ___T>,
10046 ordinal: u64,
10047 buffer: ___T::RecvBuffer,
10048 ) {
10049 match ordinal {
10050 ordinal => handler.on_unknown_interaction(sender, ordinal),
10051 }
10052 }
10053
10054 fn on_two_way(
10055 handler: &mut ___H,
10056 sender: &::fidl_next::ServerSender<Self, ___T>,
10057 ordinal: u64,
10058 buffer: ___T::RecvBuffer,
10059 responder: ::fidl_next::protocol::Responder,
10060 ) {
10061 match ordinal {
10062 8633697350522413353 => {
10063 let responder = ::fidl_next::Responder::from_untyped(responder);
10064
10065 match ::fidl_next::DecoderExt::decode(buffer) {
10066 Ok(decoded) => handler.add_child(sender, decoded, responder),
10067 Err(e) => {
10068 sender.close();
10069 }
10070 }
10071 }
10072
10073 ordinal => handler.on_unknown_interaction(sender, ordinal),
10074 }
10075 }
10076}
10077
10078#[derive(Clone, Debug, Default)]
10079pub struct NodeControllerRequestBindRequest {
10080 pub force_rebind: Option<bool>,
10081
10082 pub driver_url_suffix: Option<String>,
10083}
10084
10085impl NodeControllerRequestBindRequest {
10086 fn __max_ordinal(&self) -> usize {
10087 if self.driver_url_suffix.is_some() {
10088 return 2;
10089 }
10090
10091 if self.force_rebind.is_some() {
10092 return 1;
10093 }
10094
10095 0
10096 }
10097}
10098
10099impl ::fidl_next::Encodable for NodeControllerRequestBindRequest {
10100 type Encoded = WireNodeControllerRequestBindRequest<'static>;
10101}
10102
10103unsafe impl<___E> ::fidl_next::Encode<___E> for NodeControllerRequestBindRequest
10104where
10105 ___E: ::fidl_next::Encoder + ?Sized,
10106{
10107 #[inline]
10108 fn encode(
10109 mut self,
10110 encoder: &mut ___E,
10111 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10112 ) -> Result<(), ::fidl_next::EncodeError> {
10113 ::fidl_next::munge!(let WireNodeControllerRequestBindRequest { table } = out);
10114
10115 let max_ord = self.__max_ordinal();
10116
10117 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10118 ::fidl_next::Wire::zero_padding(&mut out);
10119
10120 let mut preallocated =
10121 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10122
10123 for i in 1..=max_ord {
10124 match i {
10125 2 => {
10126 if let Some(driver_url_suffix) = self.driver_url_suffix.take() {
10127 ::fidl_next::WireEnvelope::encode_value(
10128 driver_url_suffix,
10129 preallocated.encoder,
10130 &mut out,
10131 )?;
10132 } else {
10133 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10134 }
10135 }
10136
10137 1 => {
10138 if let Some(force_rebind) = self.force_rebind.take() {
10139 ::fidl_next::WireEnvelope::encode_value(
10140 force_rebind,
10141 preallocated.encoder,
10142 &mut out,
10143 )?;
10144 } else {
10145 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10146 }
10147 }
10148
10149 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10150 }
10151 unsafe {
10152 preallocated.write_next(out.assume_init_ref());
10153 }
10154 }
10155
10156 ::fidl_next::WireTable::encode_len(table, max_ord);
10157
10158 Ok(())
10159 }
10160}
10161
10162unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NodeControllerRequestBindRequest
10163where
10164 ___E: ::fidl_next::Encoder + ?Sized,
10165{
10166 #[inline]
10167 fn encode_ref(
10168 &self,
10169 encoder: &mut ___E,
10170 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10171 ) -> Result<(), ::fidl_next::EncodeError> {
10172 ::fidl_next::munge!(let WireNodeControllerRequestBindRequest { table } = out);
10173
10174 let max_ord = self.__max_ordinal();
10175
10176 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10177 ::fidl_next::Wire::zero_padding(&mut out);
10178
10179 let mut preallocated =
10180 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10181
10182 for i in 1..=max_ord {
10183 match i {
10184 2 => {
10185 if let Some(driver_url_suffix) = &self.driver_url_suffix {
10186 ::fidl_next::WireEnvelope::encode_value(
10187 driver_url_suffix,
10188 preallocated.encoder,
10189 &mut out,
10190 )?;
10191 } else {
10192 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10193 }
10194 }
10195
10196 1 => {
10197 if let Some(force_rebind) = &self.force_rebind {
10198 ::fidl_next::WireEnvelope::encode_value(
10199 force_rebind,
10200 preallocated.encoder,
10201 &mut out,
10202 )?;
10203 } else {
10204 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10205 }
10206 }
10207
10208 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10209 }
10210 unsafe {
10211 preallocated.write_next(out.assume_init_ref());
10212 }
10213 }
10214
10215 ::fidl_next::WireTable::encode_len(table, max_ord);
10216
10217 Ok(())
10218 }
10219}
10220
10221impl<'de> ::fidl_next::FromWire<WireNodeControllerRequestBindRequest<'de>>
10222 for NodeControllerRequestBindRequest
10223{
10224 #[inline]
10225 fn from_wire(wire: WireNodeControllerRequestBindRequest<'de>) -> Self {
10226 let wire = ::core::mem::ManuallyDrop::new(wire);
10227
10228 let force_rebind = wire.table.get(1);
10229
10230 let driver_url_suffix = wire.table.get(2);
10231
10232 Self {
10233 force_rebind: force_rebind.map(|envelope| {
10234 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
10235 }),
10236
10237 driver_url_suffix: driver_url_suffix.map(|envelope| {
10238 ::fidl_next::FromWire::from_wire(unsafe {
10239 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
10240 })
10241 }),
10242 }
10243 }
10244}
10245
10246impl<'de> ::fidl_next::FromWireRef<WireNodeControllerRequestBindRequest<'de>>
10247 for NodeControllerRequestBindRequest
10248{
10249 #[inline]
10250 fn from_wire_ref(wire: &WireNodeControllerRequestBindRequest<'de>) -> Self {
10251 Self {
10252 force_rebind: wire.table.get(1).map(|envelope| {
10253 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
10254 envelope.deref_unchecked::<bool>()
10255 })
10256 }),
10257
10258 driver_url_suffix: wire.table.get(2).map(|envelope| {
10259 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
10260 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
10261 })
10262 }),
10263 }
10264 }
10265}
10266
10267#[repr(C)]
10269pub struct WireNodeControllerRequestBindRequest<'de> {
10270 table: ::fidl_next::WireTable<'de>,
10271}
10272
10273impl<'de> Drop for WireNodeControllerRequestBindRequest<'de> {
10274 fn drop(&mut self) {
10275 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
10276
10277 let _ = self
10278 .table
10279 .get(2)
10280 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
10281 }
10282}
10283
10284unsafe impl ::fidl_next::Wire for WireNodeControllerRequestBindRequest<'static> {
10285 type Decoded<'de> = WireNodeControllerRequestBindRequest<'de>;
10286
10287 #[inline]
10288 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10289 ::fidl_next::munge!(let Self { table } = out);
10290 ::fidl_next::WireTable::zero_padding(table);
10291 }
10292}
10293
10294unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeControllerRequestBindRequest<'static>
10295where
10296 ___D: ::fidl_next::Decoder + ?Sized,
10297{
10298 fn decode(
10299 slot: ::fidl_next::Slot<'_, Self>,
10300 decoder: &mut ___D,
10301 ) -> Result<(), ::fidl_next::DecodeError> {
10302 ::fidl_next::munge!(let Self { table } = slot);
10303
10304 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
10305 match ordinal {
10306 0 => unsafe { ::core::hint::unreachable_unchecked() },
10307
10308 1 => {
10309 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
10310
10311 Ok(())
10312 }
10313
10314 2 => {
10315 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
10316 slot.as_mut(),
10317 decoder,
10318 )?;
10319
10320 Ok(())
10321 }
10322
10323 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
10324 }
10325 })
10326 }
10327}
10328
10329impl<'de> WireNodeControllerRequestBindRequest<'de> {
10330 pub fn force_rebind(&self) -> Option<&bool> {
10331 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
10332 }
10333
10334 pub fn driver_url_suffix(&self) -> Option<&::fidl_next::WireString<'de>> {
10335 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
10336 }
10337}
10338
10339impl<'de> ::core::fmt::Debug for WireNodeControllerRequestBindRequest<'de> {
10340 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
10341 f.debug_struct("NodeControllerRequestBindRequest")
10342 .field("force_rebind", &self.force_rebind())
10343 .field("driver_url_suffix", &self.driver_url_suffix())
10344 .finish()
10345 }
10346}
10347
10348pub type NodeControllerRequestBindResponse = ();
10349
10350pub type WireNodeControllerRequestBindResponse = ();
10352
10353#[derive(Debug, Default)]
10354pub struct NodeControllerOnBindRequest {
10355 pub node_token: Option<::fidl_next::fuchsia::zx::Handle>,
10356}
10357
10358impl NodeControllerOnBindRequest {
10359 fn __max_ordinal(&self) -> usize {
10360 if self.node_token.is_some() {
10361 return 1;
10362 }
10363
10364 0
10365 }
10366}
10367
10368impl ::fidl_next::Encodable for NodeControllerOnBindRequest {
10369 type Encoded = WireNodeControllerOnBindRequest<'static>;
10370}
10371
10372unsafe impl<___E> ::fidl_next::Encode<___E> for NodeControllerOnBindRequest
10373where
10374 ___E: ::fidl_next::Encoder + ?Sized,
10375
10376 ___E: ::fidl_next::fuchsia::HandleEncoder,
10377{
10378 #[inline]
10379 fn encode(
10380 mut self,
10381 encoder: &mut ___E,
10382 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10383 ) -> Result<(), ::fidl_next::EncodeError> {
10384 ::fidl_next::munge!(let WireNodeControllerOnBindRequest { table } = out);
10385
10386 let max_ord = self.__max_ordinal();
10387
10388 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10389 ::fidl_next::Wire::zero_padding(&mut out);
10390
10391 let mut preallocated =
10392 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10393
10394 for i in 1..=max_ord {
10395 match i {
10396 1 => {
10397 if let Some(node_token) = self.node_token.take() {
10398 ::fidl_next::WireEnvelope::encode_value(
10399 node_token,
10400 preallocated.encoder,
10401 &mut out,
10402 )?;
10403 } else {
10404 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10405 }
10406 }
10407
10408 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10409 }
10410 unsafe {
10411 preallocated.write_next(out.assume_init_ref());
10412 }
10413 }
10414
10415 ::fidl_next::WireTable::encode_len(table, max_ord);
10416
10417 Ok(())
10418 }
10419}
10420
10421impl<'de> ::fidl_next::FromWire<WireNodeControllerOnBindRequest<'de>>
10422 for NodeControllerOnBindRequest
10423{
10424 #[inline]
10425 fn from_wire(wire: WireNodeControllerOnBindRequest<'de>) -> Self {
10426 let wire = ::core::mem::ManuallyDrop::new(wire);
10427
10428 let node_token = wire.table.get(1);
10429
10430 Self {
10431 node_token: node_token.map(|envelope| {
10432 ::fidl_next::FromWire::from_wire(unsafe {
10433 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
10434 })
10435 }),
10436 }
10437 }
10438}
10439
10440#[repr(C)]
10442pub struct WireNodeControllerOnBindRequest<'de> {
10443 table: ::fidl_next::WireTable<'de>,
10444}
10445
10446impl<'de> Drop for WireNodeControllerOnBindRequest<'de> {
10447 fn drop(&mut self) {
10448 let _ = self.table.get(1).map(|envelope| unsafe {
10449 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
10450 });
10451 }
10452}
10453
10454unsafe impl ::fidl_next::Wire for WireNodeControllerOnBindRequest<'static> {
10455 type Decoded<'de> = WireNodeControllerOnBindRequest<'de>;
10456
10457 #[inline]
10458 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10459 ::fidl_next::munge!(let Self { table } = out);
10460 ::fidl_next::WireTable::zero_padding(table);
10461 }
10462}
10463
10464unsafe impl<___D> ::fidl_next::Decode<___D> for WireNodeControllerOnBindRequest<'static>
10465where
10466 ___D: ::fidl_next::Decoder + ?Sized,
10467
10468 ___D: ::fidl_next::fuchsia::HandleDecoder,
10469{
10470 fn decode(
10471 slot: ::fidl_next::Slot<'_, Self>,
10472 decoder: &mut ___D,
10473 ) -> Result<(), ::fidl_next::DecodeError> {
10474 ::fidl_next::munge!(let Self { table } = slot);
10475
10476 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
10477 match ordinal {
10478 0 => unsafe { ::core::hint::unreachable_unchecked() },
10479
10480 1 => {
10481 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
10482 slot.as_mut(),
10483 decoder,
10484 )?;
10485
10486 Ok(())
10487 }
10488
10489 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
10490 }
10491 })
10492 }
10493}
10494
10495impl<'de> WireNodeControllerOnBindRequest<'de> {
10496 pub fn node_token(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
10497 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
10498 }
10499}
10500
10501impl<'de> ::core::fmt::Debug for WireNodeControllerOnBindRequest<'de> {
10502 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
10503 f.debug_struct("NodeControllerOnBindRequest")
10504 .field("node_token", &self.node_token())
10505 .finish()
10506 }
10507}
10508
10509#[doc = " Protocol through which a parent node controls one of its children.\n"]
10511#[derive(Debug)]
10512pub struct NodeController;
10513
10514pub mod node_controller {
10515 pub mod prelude {
10516 pub use crate::{
10517 node_controller, NodeController, NodeControllerClientHandler,
10518 NodeControllerClientSender, NodeControllerServerHandler, NodeControllerServerSender,
10519 };
10520
10521 pub use crate::NodeControllerOnBindRequest;
10522
10523 pub use crate::NodeControllerRequestBindRequest;
10524
10525 pub use crate::NodeControllerRequestBindResponse;
10526 }
10527
10528 pub struct Remove;
10529
10530 impl ::fidl_next::Method for Remove {
10531 const ORDINAL: u64 = 6123359741742396225;
10532
10533 type Protocol = crate::NodeController;
10534
10535 type Request = ();
10536
10537 type Response = ::fidl_next::Never;
10538 }
10539
10540 pub struct RequestBind;
10541
10542 impl ::fidl_next::Method for RequestBind {
10543 const ORDINAL: u64 = 4735909333556220047;
10544
10545 type Protocol = crate::NodeController;
10546
10547 type Request = crate::WireNodeControllerRequestBindRequest<'static>;
10548
10549 type Response = ::fidl_next::WireFlexibleResult<
10550 'static,
10551 crate::WireNodeControllerRequestBindResponse,
10552 ::fidl_next::WireI32,
10553 >;
10554 }
10555
10556 pub struct OnBind;
10557
10558 impl ::fidl_next::Method for OnBind {
10559 const ORDINAL: u64 = 5905369594807853098;
10560
10561 type Protocol = crate::NodeController;
10562
10563 type Request = ::fidl_next::Never;
10564
10565 type Response = crate::WireNodeControllerOnBindRequest<'static>;
10566 }
10567}
10568
10569pub trait NodeControllerClientSender {
10571 type Transport: ::fidl_next::Transport;
10572
10573 #[doc = " Removes the node and all of its children.\n"]
10574 fn remove(
10575 &self,
10576 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>;
10577
10578 #[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"]
10579 fn request_bind<___R>(
10580 &self,
10581 request: ___R,
10582 ) -> Result<
10583 ::fidl_next::ResponseFuture<'_, node_controller::RequestBind, Self::Transport>,
10584 ::fidl_next::EncodeError,
10585 >
10586 where
10587 ___R: ::fidl_next::Encode<
10588 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
10589 Encoded = crate::WireNodeControllerRequestBindRequest<'static>,
10590 >;
10591}
10592
10593impl<___T> NodeControllerClientSender for ::fidl_next::ClientSender<NodeController, ___T>
10594where
10595 ___T: ::fidl_next::Transport,
10596{
10597 type Transport = ___T;
10598
10599 #[doc = " Removes the node and all of its children.\n"]
10600 fn remove(
10601 &self,
10602 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError> {
10603 self.as_untyped().send_one_way(6123359741742396225, ())
10604 }
10605
10606 #[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"]
10607 fn request_bind<___R>(
10608 &self,
10609 request: ___R,
10610 ) -> Result<
10611 ::fidl_next::ResponseFuture<'_, node_controller::RequestBind, Self::Transport>,
10612 ::fidl_next::EncodeError,
10613 >
10614 where
10615 ___R: ::fidl_next::Encode<
10616 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
10617 Encoded = crate::WireNodeControllerRequestBindRequest<'static>,
10618 >,
10619 {
10620 self.as_untyped()
10621 .send_two_way(4735909333556220047, request)
10622 .map(::fidl_next::ResponseFuture::from_untyped)
10623 }
10624}
10625
10626pub trait NodeControllerClientHandler<___T: ::fidl_next::Transport> {
10630 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n"]
10631 fn on_bind(
10632 &mut self,
10633 sender: &::fidl_next::ClientSender<NodeController, ___T>,
10634
10635 event: ::fidl_next::Response<node_controller::OnBind, ___T>,
10636 );
10637
10638 fn on_unknown_interaction(
10639 &mut self,
10640 sender: &::fidl_next::ClientSender<NodeController, ___T>,
10641 ordinal: u64,
10642 ) {
10643 sender.close();
10644 }
10645}
10646
10647impl<___H, ___T> ::fidl_next::ClientProtocol<___H, ___T> for NodeController
10648where
10649 ___H: NodeControllerClientHandler<___T>,
10650 ___T: ::fidl_next::Transport,
10651
10652 <node_controller::RequestBind as ::fidl_next::Method>::Response:
10653 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
10654
10655 <node_controller::OnBind as ::fidl_next::Method>::Response:
10656 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
10657{
10658 fn on_event(
10659 handler: &mut ___H,
10660 sender: &::fidl_next::ClientSender<Self, ___T>,
10661 ordinal: u64,
10662 buffer: ___T::RecvBuffer,
10663 ) {
10664 match ordinal {
10665 5905369594807853098 => match ::fidl_next::DecoderExt::decode(buffer) {
10666 Ok(decoded) => handler.on_bind(sender, decoded),
10667 Err(e) => {
10668 sender.close();
10669 }
10670 },
10671
10672 ordinal => handler.on_unknown_interaction(sender, ordinal),
10673 }
10674 }
10675}
10676
10677pub trait NodeControllerServerSender {
10679 type Transport: ::fidl_next::Transport;
10680
10681 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n"]
10682
10683 fn on_bind<___R>(
10684 &self,
10685 request: ___R,
10686 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
10687 where
10688 ___R: ::fidl_next::Encode<
10689 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
10690 Encoded = <node_controller::OnBind as ::fidl_next::Method>::Response,
10691 >;
10692}
10693
10694impl<___T> NodeControllerServerSender for ::fidl_next::ServerSender<NodeController, ___T>
10695where
10696 ___T: ::fidl_next::Transport,
10697{
10698 type Transport = ___T;
10699
10700 #[doc = " Event that is triggered when the associated `Node` is bound to a driver.\n"]
10701
10702 fn on_bind<___R>(
10703 &self,
10704 request: ___R,
10705 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
10706 where
10707 ___R: ::fidl_next::Encode<
10708 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
10709 Encoded = <node_controller::OnBind as ::fidl_next::Method>::Response,
10710 >,
10711 {
10712 self.as_untyped().send_event(5905369594807853098, request)
10713 }
10714}
10715
10716pub trait NodeControllerServerHandler<___T: ::fidl_next::Transport> {
10720 #[doc = " Removes the node and all of its children.\n"]
10721 fn remove(&mut self, sender: &::fidl_next::ServerSender<NodeController, ___T>);
10722
10723 #[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"]
10724 fn request_bind(
10725 &mut self,
10726 sender: &::fidl_next::ServerSender<NodeController, ___T>,
10727
10728 request: ::fidl_next::Request<node_controller::RequestBind, ___T>,
10729
10730 responder: ::fidl_next::Responder<node_controller::RequestBind>,
10731 );
10732
10733 fn on_unknown_interaction(
10734 &mut self,
10735 sender: &::fidl_next::ServerSender<NodeController, ___T>,
10736 ordinal: u64,
10737 ) {
10738 sender.close();
10739 }
10740}
10741
10742impl<___H, ___T> ::fidl_next::ServerProtocol<___H, ___T> for NodeController
10743where
10744 ___H: NodeControllerServerHandler<___T>,
10745 ___T: ::fidl_next::Transport,
10746
10747 <node_controller::RequestBind as ::fidl_next::Method>::Request:
10748 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
10749{
10750 fn on_one_way(
10751 handler: &mut ___H,
10752 sender: &::fidl_next::ServerSender<Self, ___T>,
10753 ordinal: u64,
10754 buffer: ___T::RecvBuffer,
10755 ) {
10756 match ordinal {
10757 6123359741742396225 => {
10758 handler.remove(sender);
10759 }
10760
10761 ordinal => handler.on_unknown_interaction(sender, ordinal),
10762 }
10763 }
10764
10765 fn on_two_way(
10766 handler: &mut ___H,
10767 sender: &::fidl_next::ServerSender<Self, ___T>,
10768 ordinal: u64,
10769 buffer: ___T::RecvBuffer,
10770 responder: ::fidl_next::protocol::Responder,
10771 ) {
10772 match ordinal {
10773 4735909333556220047 => {
10774 let responder = ::fidl_next::Responder::from_untyped(responder);
10775
10776 match ::fidl_next::DecoderExt::decode(buffer) {
10777 Ok(decoded) => handler.request_bind(sender, decoded, responder),
10778 Err(e) => {
10779 sender.close();
10780 }
10781 }
10782 }
10783
10784 ordinal => handler.on_unknown_interaction(sender, ordinal),
10785 }
10786 }
10787}
10788
10789pub mod compat {
10791
10792 impl ::core::convert::From<crate::Condition> for ::fidl_fuchsia_driver_framework::Condition {
10793 #[inline]
10794 fn from(from: crate::Condition) -> Self {
10795 match crate::Condition::from(from) {
10796 crate::Condition::Unknown => Self::Unknown,
10797
10798 crate::Condition::Accept => Self::Accept,
10799
10800 crate::Condition::Reject => Self::Reject,
10801 }
10802 }
10803 }
10804
10805 impl ::core::convert::From<crate::BusType> for ::fidl_fuchsia_driver_framework::BusType {
10806 #[inline]
10807 fn from(from: crate::BusType) -> Self {
10808 match crate::BusType::from(from) {
10809 crate::BusType::Platform => Self::Platform,
10810
10811 crate::BusType::Acpi => Self::Acpi,
10812
10813 crate::BusType::DeviceTree => Self::DeviceTree,
10814
10815 crate::BusType::Pci => Self::Pci,
10816
10817 crate::BusType::Usb => Self::Usb,
10818
10819 crate::BusType::Gpio => Self::Gpio,
10820
10821 crate::BusType::I2C => Self::I2C,
10822
10823 crate::BusType::Spi => Self::Spi,
10824
10825 crate::BusType::Sdio => Self::Sdio,
10826
10827 crate::BusType::Uart => Self::Uart,
10828
10829 crate::BusType::Spmi => Self::Spmi,
10830
10831 crate::BusType::UnknownOrdinal_(value) => {
10832 Self::__SourceBreaking { unknown_ordinal: value }
10833 }
10834 }
10835 }
10836 }
10837
10838 impl ::core::convert::From<crate::DeviceAddressStability>
10839 for ::fidl_fuchsia_driver_framework::DeviceAddressStability
10840 {
10841 #[inline]
10842 fn from(from: crate::DeviceAddressStability) -> Self {
10843 match crate::DeviceAddressStability::from(from) {
10844 crate::DeviceAddressStability::UnstableBetweenDriverRestart => {
10845 Self::UnstableBetweenDriverRestart
10846 }
10847
10848 crate::DeviceAddressStability::UnstableBetweenBoot => Self::UnstableBetweenBoot,
10849
10850 crate::DeviceAddressStability::UnstableBetweenSoftwareUpdate => {
10851 Self::UnstableBetweenSoftwareUpdate
10852 }
10853
10854 crate::DeviceAddressStability::Stable => Self::Stable,
10855
10856 crate::DeviceAddressStability::UnknownOrdinal_(value) => {
10857 Self::__SourceBreaking { unknown_ordinal: value }
10858 }
10859 }
10860 }
10861 }
10862
10863 impl ::core::convert::From<crate::DriverPackageType>
10864 for ::fidl_fuchsia_driver_framework::DriverPackageType
10865 {
10866 #[inline]
10867 fn from(from: crate::DriverPackageType) -> Self {
10868 match crate::DriverPackageType::from(from) {
10869 crate::DriverPackageType::Boot => Self::Boot,
10870
10871 crate::DriverPackageType::Base => Self::Base,
10872
10873 crate::DriverPackageType::Cached => Self::Cached,
10874
10875 crate::DriverPackageType::Universe => Self::Universe,
10876
10877 crate::DriverPackageType::UnknownOrdinal_(value) => {
10878 Self::__SourceBreaking { unknown_ordinal: value }
10879 }
10880 }
10881 }
10882 }
10883
10884 impl ::core::convert::From<crate::CompositeNodeSpecError>
10885 for ::fidl_fuchsia_driver_framework::CompositeNodeSpecError
10886 {
10887 #[inline]
10888 fn from(from: crate::CompositeNodeSpecError) -> Self {
10889 match crate::CompositeNodeSpecError::from(from) {
10890 crate::CompositeNodeSpecError::MissingArgs => Self::MissingArgs,
10891
10892 crate::CompositeNodeSpecError::EmptyNodes => Self::EmptyNodes,
10893
10894 crate::CompositeNodeSpecError::AlreadyExists => Self::AlreadyExists,
10895
10896 crate::CompositeNodeSpecError::DriverIndexFailure => Self::DriverIndexFailure,
10897
10898 crate::CompositeNodeSpecError::DuplicateParents => Self::DuplicateParents,
10899
10900 crate::CompositeNodeSpecError::UnknownOrdinal_(value) => {
10901 Self::__SourceBreaking { unknown_ordinal: value }
10902 }
10903 }
10904 }
10905 }
10906
10907 #[cfg(target_os = "fuchsia")]
10908 pub type CompositeNodeManagerProxy =
10911 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::CompositeNodeManager>;
10912
10913 impl ::core::convert::From<crate::CompositeNodeManager>
10914 for ::fidl_fuchsia_driver_framework::CompositeNodeManagerMarker
10915 {
10916 #[inline]
10917 fn from(_: crate::CompositeNodeManager) -> Self {
10918 Self
10919 }
10920 }
10921
10922 #[cfg(target_os = "fuchsia")]
10923 pub type DriverProxy =
10926 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::Driver>;
10927
10928 #[cfg(feature = "driver")]
10929 impl ::core::convert::From<crate::Driver> for ::fidl_fuchsia_driver_framework::DriverMarker {
10930 #[inline]
10931 fn from(_: crate::Driver) -> Self {
10932 Self
10933 }
10934 }
10935
10936 impl ::core::convert::From<crate::NodeError> for ::fidl_fuchsia_driver_framework::NodeError {
10937 #[inline]
10938 fn from(from: crate::NodeError) -> Self {
10939 match crate::NodeError::from(from) {
10940 crate::NodeError::Internal => Self::Internal,
10941
10942 crate::NodeError::NodeRemoved => Self::NodeRemoved,
10943
10944 crate::NodeError::NameMissing => Self::NameMissing,
10945
10946 crate::NodeError::NameInvalid => Self::NameInvalid,
10947
10948 crate::NodeError::NameAlreadyExists => Self::NameAlreadyExists,
10949
10950 crate::NodeError::OfferSourceNameMissing => Self::OfferSourceNameMissing,
10951
10952 crate::NodeError::OfferRefExists => Self::OfferRefExists,
10953
10954 crate::NodeError::SymbolNameMissing => Self::SymbolNameMissing,
10955
10956 crate::NodeError::SymbolAddressMissing => Self::SymbolAddressMissing,
10957
10958 crate::NodeError::SymbolAlreadyExists => Self::SymbolAlreadyExists,
10959
10960 crate::NodeError::UnbindChildrenInProgress => Self::UnbindChildrenInProgress,
10961
10962 crate::NodeError::UnsupportedArgs => Self::UnsupportedArgs,
10963
10964 crate::NodeError::DuplicatePropertyKeys => Self::DuplicatePropertyKeys,
10965
10966 crate::NodeError::UnknownOrdinal_(value) => {
10967 Self::__SourceBreaking { unknown_ordinal: value }
10968 }
10969 }
10970 }
10971 }
10972
10973 #[cfg(target_os = "fuchsia")]
10974 pub type NodeProxy = ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::Node>;
10977
10978 impl ::core::convert::From<crate::Node> for ::fidl_fuchsia_driver_framework::NodeMarker {
10979 #[inline]
10980 fn from(_: crate::Node) -> Self {
10981 Self
10982 }
10983 }
10984
10985 #[cfg(target_os = "fuchsia")]
10986 pub type NodeControllerProxy =
10989 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::NodeController>;
10990
10991 impl ::core::convert::From<crate::NodeController>
10992 for ::fidl_fuchsia_driver_framework::NodeControllerMarker
10993 {
10994 #[inline]
10995 fn from(_: crate::NodeController) -> Self {
10996 Self
10997 }
10998 }
10999}