1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5#[doc = " The kinds of offers that can target the children in a collection.\n"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u32)]
8pub enum AllowedOffers {
9 StaticOnly = 1,
10 StaticAndDynamic = 2,
11}
12
13impl ::fidl_next::Encodable for AllowedOffers {
14 type Encoded = WireAllowedOffers;
15}
16impl ::std::convert::TryFrom<u32> for AllowedOffers {
17 type Error = ::fidl_next::UnknownStrictEnumMemberError;
18 fn try_from(value: u32) -> Result<Self, Self::Error> {
19 match value {
20 1 => Ok(Self::StaticOnly),
21 2 => Ok(Self::StaticAndDynamic),
22
23 _ => Err(Self::Error::new(value.into())),
24 }
25 }
26}
27
28unsafe impl<___E> ::fidl_next::Encode<___E> for AllowedOffers
29where
30 ___E: ?Sized,
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::EncodeRef::encode_ref(&self, encoder, out)
39 }
40}
41
42unsafe impl<___E> ::fidl_next::EncodeRef<___E> for AllowedOffers
43where
44 ___E: ?Sized,
45{
46 #[inline]
47 fn encode_ref(
48 &self,
49 encoder: &mut ___E,
50 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
51 ) -> Result<(), ::fidl_next::EncodeError> {
52 ::fidl_next::munge!(let WireAllowedOffers { value } = out);
53 let _ = value.write(::fidl_next::WireU32::from(match *self {
54 Self::StaticOnly => 1,
55
56 Self::StaticAndDynamic => 2,
57 }));
58
59 Ok(())
60 }
61}
62
63impl ::core::convert::From<WireAllowedOffers> for AllowedOffers {
64 fn from(wire: WireAllowedOffers) -> Self {
65 match u32::from(wire.value) {
66 1 => Self::StaticOnly,
67
68 2 => Self::StaticAndDynamic,
69
70 _ => unsafe { ::core::hint::unreachable_unchecked() },
71 }
72 }
73}
74
75impl ::fidl_next::FromWire<WireAllowedOffers> for AllowedOffers {
76 #[inline]
77 fn from_wire(wire: WireAllowedOffers) -> Self {
78 Self::from(wire)
79 }
80}
81
82impl ::fidl_next::FromWireRef<WireAllowedOffers> for AllowedOffers {
83 #[inline]
84 fn from_wire_ref(wire: &WireAllowedOffers) -> Self {
85 Self::from(*wire)
86 }
87}
88
89#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91#[repr(transparent)]
92pub struct WireAllowedOffers {
93 value: ::fidl_next::WireU32,
94}
95
96unsafe impl ::fidl_next::Wire for WireAllowedOffers {
97 type Decoded<'de> = Self;
98
99 #[inline]
100 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
101 }
103}
104
105impl WireAllowedOffers {
106 pub const STATIC_ONLY: WireAllowedOffers = WireAllowedOffers { value: ::fidl_next::WireU32(1) };
107
108 pub const STATIC_AND_DYNAMIC: WireAllowedOffers =
109 WireAllowedOffers { value: ::fidl_next::WireU32(2) };
110}
111
112unsafe impl<___D> ::fidl_next::Decode<___D> for WireAllowedOffers
113where
114 ___D: ?Sized,
115{
116 fn decode(
117 slot: ::fidl_next::Slot<'_, Self>,
118 _: &mut ___D,
119 ) -> Result<(), ::fidl_next::DecodeError> {
120 ::fidl_next::munge!(let Self { value } = slot);
121
122 match u32::from(*value) {
123 1 | 2 => (),
124 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
125 }
126
127 Ok(())
128 }
129}
130
131impl ::core::convert::From<AllowedOffers> for WireAllowedOffers {
132 fn from(natural: AllowedOffers) -> Self {
133 match natural {
134 AllowedOffers::StaticOnly => WireAllowedOffers::STATIC_ONLY,
135
136 AllowedOffers::StaticAndDynamic => WireAllowedOffers::STATIC_AND_DYNAMIC,
137 }
138 }
139}
140
141#[doc = " Describes the expected availability of the capability.\n\n Some capabilities may not be present on all system configurations. In those\n cases, the availability will be declared as `OPTIONAL` along the chains of\n exposes/offers/uses, and the capability would be routed from `void` on\n system configurations where it does not make sense to route or provide a\n particular capability (e.g. graphical capabilities on a headless system).\n"]
142#[derive(Clone, Copy, Debug, PartialEq, Eq)]
143#[repr(u32)]
144pub enum Availability {
145 Required = 1,
146 Optional = 2,
147 SameAsTarget = 3,
148 Transitional = 4,
149}
150
151impl ::fidl_next::Encodable for Availability {
152 type Encoded = WireAvailability;
153}
154impl ::std::convert::TryFrom<u32> for Availability {
155 type Error = ::fidl_next::UnknownStrictEnumMemberError;
156 fn try_from(value: u32) -> Result<Self, Self::Error> {
157 match value {
158 1 => Ok(Self::Required),
159 2 => Ok(Self::Optional),
160 3 => Ok(Self::SameAsTarget),
161 4 => Ok(Self::Transitional),
162
163 _ => Err(Self::Error::new(value.into())),
164 }
165 }
166}
167
168unsafe impl<___E> ::fidl_next::Encode<___E> for Availability
169where
170 ___E: ?Sized,
171{
172 #[inline]
173 fn encode(
174 self,
175 encoder: &mut ___E,
176 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
177 ) -> Result<(), ::fidl_next::EncodeError> {
178 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
179 }
180}
181
182unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Availability
183where
184 ___E: ?Sized,
185{
186 #[inline]
187 fn encode_ref(
188 &self,
189 encoder: &mut ___E,
190 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
191 ) -> Result<(), ::fidl_next::EncodeError> {
192 ::fidl_next::munge!(let WireAvailability { value } = out);
193 let _ = value.write(::fidl_next::WireU32::from(match *self {
194 Self::Required => 1,
195
196 Self::Optional => 2,
197
198 Self::SameAsTarget => 3,
199
200 Self::Transitional => 4,
201 }));
202
203 Ok(())
204 }
205}
206
207impl ::core::convert::From<WireAvailability> for Availability {
208 fn from(wire: WireAvailability) -> Self {
209 match u32::from(wire.value) {
210 1 => Self::Required,
211
212 2 => Self::Optional,
213
214 3 => Self::SameAsTarget,
215
216 4 => Self::Transitional,
217
218 _ => unsafe { ::core::hint::unreachable_unchecked() },
219 }
220 }
221}
222
223impl ::fidl_next::FromWire<WireAvailability> for Availability {
224 #[inline]
225 fn from_wire(wire: WireAvailability) -> Self {
226 Self::from(wire)
227 }
228}
229
230impl ::fidl_next::FromWireRef<WireAvailability> for Availability {
231 #[inline]
232 fn from_wire_ref(wire: &WireAvailability) -> Self {
233 Self::from(*wire)
234 }
235}
236
237#[derive(Clone, Copy, Debug, PartialEq, Eq)]
239#[repr(transparent)]
240pub struct WireAvailability {
241 value: ::fidl_next::WireU32,
242}
243
244unsafe impl ::fidl_next::Wire for WireAvailability {
245 type Decoded<'de> = Self;
246
247 #[inline]
248 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
249 }
251}
252
253impl WireAvailability {
254 pub const REQUIRED: WireAvailability = WireAvailability { value: ::fidl_next::WireU32(1) };
255
256 pub const OPTIONAL: WireAvailability = WireAvailability { value: ::fidl_next::WireU32(2) };
257
258 pub const SAME_AS_TARGET: WireAvailability =
259 WireAvailability { value: ::fidl_next::WireU32(3) };
260
261 pub const TRANSITIONAL: WireAvailability = WireAvailability { value: ::fidl_next::WireU32(4) };
262}
263
264unsafe impl<___D> ::fidl_next::Decode<___D> for WireAvailability
265where
266 ___D: ?Sized,
267{
268 fn decode(
269 slot: ::fidl_next::Slot<'_, Self>,
270 _: &mut ___D,
271 ) -> Result<(), ::fidl_next::DecodeError> {
272 ::fidl_next::munge!(let Self { value } = slot);
273
274 match u32::from(*value) {
275 1 | 2 | 3 | 4 => (),
276 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
277 }
278
279 Ok(())
280 }
281}
282
283impl ::core::convert::From<Availability> for WireAvailability {
284 fn from(natural: Availability) -> Self {
285 match natural {
286 Availability::Required => WireAvailability::REQUIRED,
287
288 Availability::Optional => WireAvailability::OPTIONAL,
289
290 Availability::SameAsTarget => WireAvailability::SAME_AS_TARGET,
291
292 Availability::Transitional => WireAvailability::TRANSITIONAL,
293 }
294 }
295}
296
297#[doc = " Config keys can only consist of these many bytes\n"]
298pub const CONFIG_KEY_MAX_SIZE: u32 = 64;
299
300pub const MAX_NAME_LENGTH: u32 = 100;
301
302pub type Name = String;
303
304pub type WireName<'de> = ::fidl_next::WireString<'de>;
306
307pub const MAX_PATH_LENGTH: u32 = 1024;
308
309#[doc = " Declares a service capability backed by this component.\n\n To learn more about services, see:\n https://fuchsia.dev/fuchsia-src/glossary#service\n"]
310#[derive(Clone, Debug, Default)]
311pub struct Service {
312 pub name: Option<String>,
313
314 pub source_path: Option<String>,
315}
316
317impl Service {
318 fn __max_ordinal(&self) -> usize {
319 if self.source_path.is_some() {
320 return 2;
321 }
322
323 if self.name.is_some() {
324 return 1;
325 }
326
327 0
328 }
329}
330
331impl ::fidl_next::Encodable for Service {
332 type Encoded = WireService<'static>;
333}
334
335unsafe impl<___E> ::fidl_next::Encode<___E> for Service
336where
337 ___E: ::fidl_next::Encoder + ?Sized,
338{
339 #[inline]
340 fn encode(
341 mut self,
342 encoder: &mut ___E,
343 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
344 ) -> Result<(), ::fidl_next::EncodeError> {
345 ::fidl_next::munge!(let WireService { table } = out);
346
347 let max_ord = self.__max_ordinal();
348
349 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
350 ::fidl_next::Wire::zero_padding(&mut out);
351
352 let mut preallocated =
353 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
354
355 for i in 1..=max_ord {
356 match i {
357 2 => {
358 if let Some(source_path) = self.source_path.take() {
359 ::fidl_next::WireEnvelope::encode_value(
360 source_path,
361 preallocated.encoder,
362 &mut out,
363 )?;
364 } else {
365 ::fidl_next::WireEnvelope::encode_zero(&mut out)
366 }
367 }
368
369 1 => {
370 if let Some(name) = self.name.take() {
371 ::fidl_next::WireEnvelope::encode_value(
372 name,
373 preallocated.encoder,
374 &mut out,
375 )?;
376 } else {
377 ::fidl_next::WireEnvelope::encode_zero(&mut out)
378 }
379 }
380
381 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
382 }
383 unsafe {
384 preallocated.write_next(out.assume_init_ref());
385 }
386 }
387
388 ::fidl_next::WireTable::encode_len(table, max_ord);
389
390 Ok(())
391 }
392}
393
394unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Service
395where
396 ___E: ::fidl_next::Encoder + ?Sized,
397{
398 #[inline]
399 fn encode_ref(
400 &self,
401 encoder: &mut ___E,
402 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
403 ) -> Result<(), ::fidl_next::EncodeError> {
404 ::fidl_next::munge!(let WireService { table } = out);
405
406 let max_ord = self.__max_ordinal();
407
408 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
409 ::fidl_next::Wire::zero_padding(&mut out);
410
411 let mut preallocated =
412 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
413
414 for i in 1..=max_ord {
415 match i {
416 2 => {
417 if let Some(source_path) = &self.source_path {
418 ::fidl_next::WireEnvelope::encode_value(
419 source_path,
420 preallocated.encoder,
421 &mut out,
422 )?;
423 } else {
424 ::fidl_next::WireEnvelope::encode_zero(&mut out)
425 }
426 }
427
428 1 => {
429 if let Some(name) = &self.name {
430 ::fidl_next::WireEnvelope::encode_value(
431 name,
432 preallocated.encoder,
433 &mut out,
434 )?;
435 } else {
436 ::fidl_next::WireEnvelope::encode_zero(&mut out)
437 }
438 }
439
440 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
441 }
442 unsafe {
443 preallocated.write_next(out.assume_init_ref());
444 }
445 }
446
447 ::fidl_next::WireTable::encode_len(table, max_ord);
448
449 Ok(())
450 }
451}
452
453impl<'de> ::fidl_next::FromWire<WireService<'de>> for Service {
454 #[inline]
455 fn from_wire(wire: WireService<'de>) -> Self {
456 let wire = ::core::mem::ManuallyDrop::new(wire);
457
458 let name = wire.table.get(1);
459
460 let source_path = wire.table.get(2);
461
462 Self {
463 name: name.map(|envelope| {
464 ::fidl_next::FromWire::from_wire(unsafe {
465 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
466 })
467 }),
468
469 source_path: source_path.map(|envelope| {
470 ::fidl_next::FromWire::from_wire(unsafe {
471 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
472 })
473 }),
474 }
475 }
476}
477
478impl<'de> ::fidl_next::FromWireRef<WireService<'de>> for Service {
479 #[inline]
480 fn from_wire_ref(wire: &WireService<'de>) -> Self {
481 Self {
482 name: wire.table.get(1).map(|envelope| {
483 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
484 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
485 })
486 }),
487
488 source_path: wire.table.get(2).map(|envelope| {
489 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
490 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
491 })
492 }),
493 }
494 }
495}
496
497#[repr(C)]
499pub struct WireService<'de> {
500 table: ::fidl_next::WireTable<'de>,
501}
502
503impl<'de> Drop for WireService<'de> {
504 fn drop(&mut self) {
505 let _ = self
506 .table
507 .get(1)
508 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
509
510 let _ = self
511 .table
512 .get(2)
513 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
514 }
515}
516
517unsafe impl ::fidl_next::Wire for WireService<'static> {
518 type Decoded<'de> = WireService<'de>;
519
520 #[inline]
521 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
522 ::fidl_next::munge!(let Self { table } = out);
523 ::fidl_next::WireTable::zero_padding(table);
524 }
525}
526
527unsafe impl<___D> ::fidl_next::Decode<___D> for WireService<'static>
528where
529 ___D: ::fidl_next::Decoder + ?Sized,
530{
531 fn decode(
532 slot: ::fidl_next::Slot<'_, Self>,
533 decoder: &mut ___D,
534 ) -> Result<(), ::fidl_next::DecodeError> {
535 ::fidl_next::munge!(let Self { table } = slot);
536
537 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
538 match ordinal {
539 0 => unsafe { ::core::hint::unreachable_unchecked() },
540
541 1 => {
542 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
543 slot.as_mut(),
544 decoder,
545 )?;
546
547 let name = unsafe {
548 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
549 };
550
551 if name.len() > 100 {
552 return Err(::fidl_next::DecodeError::VectorTooLong {
553 size: name.len() as u64,
554 limit: 100,
555 });
556 }
557
558 Ok(())
559 }
560
561 2 => {
562 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
563 slot.as_mut(),
564 decoder,
565 )?;
566
567 let source_path = unsafe {
568 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
569 };
570
571 if source_path.len() > 1024 {
572 return Err(::fidl_next::DecodeError::VectorTooLong {
573 size: source_path.len() as u64,
574 limit: 1024,
575 });
576 }
577
578 Ok(())
579 }
580
581 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
582 }
583 })
584 }
585}
586
587impl<'de> WireService<'de> {
588 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
589 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
590 }
591
592 pub fn source_path(&self) -> Option<&::fidl_next::WireString<'de>> {
593 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
594 }
595}
596
597impl<'de> ::core::fmt::Debug for WireService<'de> {
598 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
599 f.debug_struct("Service")
600 .field("name", &self.name())
601 .field("source_path", &self.source_path())
602 .finish()
603 }
604}
605
606#[doc = " Declares a directory capability backed by this component.\n\n To learn more about directories, see:\n https://fuchsia.dev/fuchsia-src/glossary#directory\n"]
607#[derive(Clone, Debug, Default)]
608pub struct Directory {
609 pub name: Option<String>,
610
611 pub source_path: Option<String>,
612
613 pub rights: Option<::fidl_next_fuchsia_io::Operations>,
614}
615
616impl Directory {
617 fn __max_ordinal(&self) -> usize {
618 if self.rights.is_some() {
619 return 3;
620 }
621
622 if self.source_path.is_some() {
623 return 2;
624 }
625
626 if self.name.is_some() {
627 return 1;
628 }
629
630 0
631 }
632}
633
634impl ::fidl_next::Encodable for Directory {
635 type Encoded = WireDirectory<'static>;
636}
637
638unsafe impl<___E> ::fidl_next::Encode<___E> for Directory
639where
640 ___E: ::fidl_next::Encoder + ?Sized,
641{
642 #[inline]
643 fn encode(
644 mut self,
645 encoder: &mut ___E,
646 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
647 ) -> Result<(), ::fidl_next::EncodeError> {
648 ::fidl_next::munge!(let WireDirectory { table } = out);
649
650 let max_ord = self.__max_ordinal();
651
652 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
653 ::fidl_next::Wire::zero_padding(&mut out);
654
655 let mut preallocated =
656 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
657
658 for i in 1..=max_ord {
659 match i {
660 3 => {
661 if let Some(rights) = self.rights.take() {
662 ::fidl_next::WireEnvelope::encode_value(
663 rights,
664 preallocated.encoder,
665 &mut out,
666 )?;
667 } else {
668 ::fidl_next::WireEnvelope::encode_zero(&mut out)
669 }
670 }
671
672 2 => {
673 if let Some(source_path) = self.source_path.take() {
674 ::fidl_next::WireEnvelope::encode_value(
675 source_path,
676 preallocated.encoder,
677 &mut out,
678 )?;
679 } else {
680 ::fidl_next::WireEnvelope::encode_zero(&mut out)
681 }
682 }
683
684 1 => {
685 if let Some(name) = self.name.take() {
686 ::fidl_next::WireEnvelope::encode_value(
687 name,
688 preallocated.encoder,
689 &mut out,
690 )?;
691 } else {
692 ::fidl_next::WireEnvelope::encode_zero(&mut out)
693 }
694 }
695
696 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
697 }
698 unsafe {
699 preallocated.write_next(out.assume_init_ref());
700 }
701 }
702
703 ::fidl_next::WireTable::encode_len(table, max_ord);
704
705 Ok(())
706 }
707}
708
709unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Directory
710where
711 ___E: ::fidl_next::Encoder + ?Sized,
712{
713 #[inline]
714 fn encode_ref(
715 &self,
716 encoder: &mut ___E,
717 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
718 ) -> Result<(), ::fidl_next::EncodeError> {
719 ::fidl_next::munge!(let WireDirectory { table } = out);
720
721 let max_ord = self.__max_ordinal();
722
723 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
724 ::fidl_next::Wire::zero_padding(&mut out);
725
726 let mut preallocated =
727 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
728
729 for i in 1..=max_ord {
730 match i {
731 3 => {
732 if let Some(rights) = &self.rights {
733 ::fidl_next::WireEnvelope::encode_value(
734 rights,
735 preallocated.encoder,
736 &mut out,
737 )?;
738 } else {
739 ::fidl_next::WireEnvelope::encode_zero(&mut out)
740 }
741 }
742
743 2 => {
744 if let Some(source_path) = &self.source_path {
745 ::fidl_next::WireEnvelope::encode_value(
746 source_path,
747 preallocated.encoder,
748 &mut out,
749 )?;
750 } else {
751 ::fidl_next::WireEnvelope::encode_zero(&mut out)
752 }
753 }
754
755 1 => {
756 if let Some(name) = &self.name {
757 ::fidl_next::WireEnvelope::encode_value(
758 name,
759 preallocated.encoder,
760 &mut out,
761 )?;
762 } else {
763 ::fidl_next::WireEnvelope::encode_zero(&mut out)
764 }
765 }
766
767 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
768 }
769 unsafe {
770 preallocated.write_next(out.assume_init_ref());
771 }
772 }
773
774 ::fidl_next::WireTable::encode_len(table, max_ord);
775
776 Ok(())
777 }
778}
779
780impl<'de> ::fidl_next::FromWire<WireDirectory<'de>> for Directory {
781 #[inline]
782 fn from_wire(wire: WireDirectory<'de>) -> Self {
783 let wire = ::core::mem::ManuallyDrop::new(wire);
784
785 let name = wire.table.get(1);
786
787 let source_path = wire.table.get(2);
788
789 let rights = wire.table.get(3);
790
791 Self {
792 name: name.map(|envelope| {
793 ::fidl_next::FromWire::from_wire(unsafe {
794 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
795 })
796 }),
797
798 source_path: source_path.map(|envelope| {
799 ::fidl_next::FromWire::from_wire(unsafe {
800 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
801 })
802 }),
803
804 rights: rights.map(|envelope| {
805 ::fidl_next::FromWire::from_wire(unsafe {
806 envelope.read_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
807 })
808 }),
809 }
810 }
811}
812
813impl<'de> ::fidl_next::FromWireRef<WireDirectory<'de>> for Directory {
814 #[inline]
815 fn from_wire_ref(wire: &WireDirectory<'de>) -> Self {
816 Self {
817 name: wire.table.get(1).map(|envelope| {
818 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
819 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
820 })
821 }),
822
823 source_path: wire.table.get(2).map(|envelope| {
824 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
825 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
826 })
827 }),
828
829 rights: wire.table.get(3).map(|envelope| {
830 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
831 envelope.deref_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
832 })
833 }),
834 }
835 }
836}
837
838#[repr(C)]
840pub struct WireDirectory<'de> {
841 table: ::fidl_next::WireTable<'de>,
842}
843
844impl<'de> Drop for WireDirectory<'de> {
845 fn drop(&mut self) {
846 let _ = self
847 .table
848 .get(1)
849 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
850
851 let _ = self
852 .table
853 .get(2)
854 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
855
856 let _ = self.table.get(3).map(|envelope| unsafe {
857 envelope.read_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
858 });
859 }
860}
861
862unsafe impl ::fidl_next::Wire for WireDirectory<'static> {
863 type Decoded<'de> = WireDirectory<'de>;
864
865 #[inline]
866 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
867 ::fidl_next::munge!(let Self { table } = out);
868 ::fidl_next::WireTable::zero_padding(table);
869 }
870}
871
872unsafe impl<___D> ::fidl_next::Decode<___D> for WireDirectory<'static>
873where
874 ___D: ::fidl_next::Decoder + ?Sized,
875{
876 fn decode(
877 slot: ::fidl_next::Slot<'_, Self>,
878 decoder: &mut ___D,
879 ) -> Result<(), ::fidl_next::DecodeError> {
880 ::fidl_next::munge!(let Self { table } = slot);
881
882 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
883 match ordinal {
884 0 => unsafe { ::core::hint::unreachable_unchecked() },
885
886 1 => {
887 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
888 slot.as_mut(),
889 decoder,
890 )?;
891
892 let name = unsafe {
893 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
894 };
895
896 if name.len() > 100 {
897 return Err(::fidl_next::DecodeError::VectorTooLong {
898 size: name.len() as u64,
899 limit: 100,
900 });
901 }
902
903 Ok(())
904 }
905
906 2 => {
907 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
908 slot.as_mut(),
909 decoder,
910 )?;
911
912 let source_path = unsafe {
913 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
914 };
915
916 if source_path.len() > 1024 {
917 return Err(::fidl_next::DecodeError::VectorTooLong {
918 size: source_path.len() as u64,
919 limit: 1024,
920 });
921 }
922
923 Ok(())
924 }
925
926 3 => {
927 ::fidl_next::WireEnvelope::decode_as::<
928 ___D,
929 ::fidl_next_fuchsia_io::WireOperations,
930 >(slot.as_mut(), decoder)?;
931
932 Ok(())
933 }
934
935 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
936 }
937 })
938 }
939}
940
941impl<'de> WireDirectory<'de> {
942 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
943 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
944 }
945
946 pub fn source_path(&self) -> Option<&::fidl_next::WireString<'de>> {
947 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
948 }
949
950 pub fn rights(&self) -> Option<&::fidl_next_fuchsia_io::WireOperations> {
951 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
952 }
953}
954
955impl<'de> ::core::fmt::Debug for WireDirectory<'de> {
956 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
957 f.debug_struct("Directory")
958 .field("name", &self.name())
959 .field("source_path", &self.source_path())
960 .field("rights", &self.rights())
961 .finish()
962 }
963}
964
965#[doc = " A reference to a component\'s parent instance.\n"]
966#[derive(Clone, Debug)]
967#[repr(C)]
968pub struct ParentRef {}
969
970impl ::fidl_next::Encodable for ParentRef {
971 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireParentRef> =
972 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
973
974 type Encoded = WireParentRef;
975}
976
977unsafe impl<___E> ::fidl_next::Encode<___E> for ParentRef
978where
979 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
980{
981 #[inline]
982 fn encode(
983 self,
984 encoder: &mut ___E,
985 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
986 ) -> Result<(), ::fidl_next::EncodeError> {
987 ::fidl_next::munge! {
988 let Self::Encoded {
989
990 } = out;
991 }
992
993 Ok(())
994 }
995}
996
997unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ParentRef
998where
999 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1000{
1001 #[inline]
1002 fn encode_ref(
1003 &self,
1004 encoder: &mut ___E,
1005 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1006 ) -> Result<(), ::fidl_next::EncodeError> {
1007 ::fidl_next::munge! {
1008 let Self::Encoded {
1009
1010 } = out;
1011 }
1012
1013 Ok(())
1014 }
1015}
1016
1017impl ::fidl_next::EncodableOption for ParentRef {
1018 type EncodedOption = ::fidl_next::WireBox<'static, WireParentRef>;
1019}
1020
1021unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ParentRef
1022where
1023 ___E: ::fidl_next::Encoder + ?Sized,
1024 ParentRef: ::fidl_next::Encode<___E>,
1025{
1026 #[inline]
1027 fn encode_option(
1028 this: Option<Self>,
1029 encoder: &mut ___E,
1030 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1031 ) -> Result<(), ::fidl_next::EncodeError> {
1032 if let Some(inner) = this {
1033 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1034 ::fidl_next::WireBox::encode_present(out);
1035 } else {
1036 ::fidl_next::WireBox::encode_absent(out);
1037 }
1038
1039 Ok(())
1040 }
1041}
1042
1043unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ParentRef
1044where
1045 ___E: ::fidl_next::Encoder + ?Sized,
1046 ParentRef: ::fidl_next::EncodeRef<___E>,
1047{
1048 #[inline]
1049 fn encode_option_ref(
1050 this: Option<&Self>,
1051 encoder: &mut ___E,
1052 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1053 ) -> Result<(), ::fidl_next::EncodeError> {
1054 if let Some(inner) = this {
1055 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1056 ::fidl_next::WireBox::encode_present(out);
1057 } else {
1058 ::fidl_next::WireBox::encode_absent(out);
1059 }
1060
1061 Ok(())
1062 }
1063}
1064
1065impl ::fidl_next::FromWire<WireParentRef> for ParentRef {
1066 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireParentRef, Self> =
1067 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1068
1069 #[inline]
1070 fn from_wire(wire: WireParentRef) -> Self {
1071 Self {}
1072 }
1073}
1074
1075impl ::fidl_next::FromWireRef<WireParentRef> for ParentRef {
1076 #[inline]
1077 fn from_wire_ref(wire: &WireParentRef) -> Self {
1078 Self {}
1079 }
1080}
1081
1082#[derive(Clone, Debug)]
1084#[repr(C)]
1085pub struct WireParentRef {}
1086
1087unsafe impl ::fidl_next::Wire for WireParentRef {
1088 type Decoded<'de> = WireParentRef;
1089
1090 #[inline]
1091 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1092}
1093
1094unsafe impl<___D> ::fidl_next::Decode<___D> for WireParentRef
1095where
1096 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1097{
1098 fn decode(
1099 slot: ::fidl_next::Slot<'_, Self>,
1100 decoder: &mut ___D,
1101 ) -> Result<(), ::fidl_next::DecodeError> {
1102 ::fidl_next::munge! {
1103 let Self {
1104
1105 } = slot;
1106 }
1107
1108 Ok(())
1109 }
1110}
1111
1112#[doc = " A reference to the component itself.\n"]
1113#[derive(Clone, Debug)]
1114#[repr(C)]
1115pub struct SelfRef {}
1116
1117impl ::fidl_next::Encodable for SelfRef {
1118 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireSelfRef> =
1119 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1120
1121 type Encoded = WireSelfRef;
1122}
1123
1124unsafe impl<___E> ::fidl_next::Encode<___E> for SelfRef
1125where
1126 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1127{
1128 #[inline]
1129 fn encode(
1130 self,
1131 encoder: &mut ___E,
1132 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1133 ) -> Result<(), ::fidl_next::EncodeError> {
1134 ::fidl_next::munge! {
1135 let Self::Encoded {
1136
1137 } = out;
1138 }
1139
1140 Ok(())
1141 }
1142}
1143
1144unsafe impl<___E> ::fidl_next::EncodeRef<___E> for SelfRef
1145where
1146 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1147{
1148 #[inline]
1149 fn encode_ref(
1150 &self,
1151 encoder: &mut ___E,
1152 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1153 ) -> Result<(), ::fidl_next::EncodeError> {
1154 ::fidl_next::munge! {
1155 let Self::Encoded {
1156
1157 } = out;
1158 }
1159
1160 Ok(())
1161 }
1162}
1163
1164impl ::fidl_next::EncodableOption for SelfRef {
1165 type EncodedOption = ::fidl_next::WireBox<'static, WireSelfRef>;
1166}
1167
1168unsafe impl<___E> ::fidl_next::EncodeOption<___E> for SelfRef
1169where
1170 ___E: ::fidl_next::Encoder + ?Sized,
1171 SelfRef: ::fidl_next::Encode<___E>,
1172{
1173 #[inline]
1174 fn encode_option(
1175 this: Option<Self>,
1176 encoder: &mut ___E,
1177 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1178 ) -> Result<(), ::fidl_next::EncodeError> {
1179 if let Some(inner) = this {
1180 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1181 ::fidl_next::WireBox::encode_present(out);
1182 } else {
1183 ::fidl_next::WireBox::encode_absent(out);
1184 }
1185
1186 Ok(())
1187 }
1188}
1189
1190unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for SelfRef
1191where
1192 ___E: ::fidl_next::Encoder + ?Sized,
1193 SelfRef: ::fidl_next::EncodeRef<___E>,
1194{
1195 #[inline]
1196 fn encode_option_ref(
1197 this: Option<&Self>,
1198 encoder: &mut ___E,
1199 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1200 ) -> Result<(), ::fidl_next::EncodeError> {
1201 if let Some(inner) = this {
1202 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1203 ::fidl_next::WireBox::encode_present(out);
1204 } else {
1205 ::fidl_next::WireBox::encode_absent(out);
1206 }
1207
1208 Ok(())
1209 }
1210}
1211
1212impl ::fidl_next::FromWire<WireSelfRef> for SelfRef {
1213 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireSelfRef, Self> =
1214 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1215
1216 #[inline]
1217 fn from_wire(wire: WireSelfRef) -> Self {
1218 Self {}
1219 }
1220}
1221
1222impl ::fidl_next::FromWireRef<WireSelfRef> for SelfRef {
1223 #[inline]
1224 fn from_wire_ref(wire: &WireSelfRef) -> Self {
1225 Self {}
1226 }
1227}
1228
1229#[derive(Clone, Debug)]
1231#[repr(C)]
1232pub struct WireSelfRef {}
1233
1234unsafe impl ::fidl_next::Wire for WireSelfRef {
1235 type Decoded<'de> = WireSelfRef;
1236
1237 #[inline]
1238 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1239}
1240
1241unsafe impl<___D> ::fidl_next::Decode<___D> for WireSelfRef
1242where
1243 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1244{
1245 fn decode(
1246 slot: ::fidl_next::Slot<'_, Self>,
1247 decoder: &mut ___D,
1248 ) -> Result<(), ::fidl_next::DecodeError> {
1249 ::fidl_next::munge! {
1250 let Self {
1251
1252 } = slot;
1253 }
1254
1255 Ok(())
1256 }
1257}
1258
1259pub const MAX_CHILD_NAME_LENGTH: u32 = 1024;
1260
1261pub type ChildName = String;
1262
1263pub type WireChildName<'de> = ::fidl_next::WireString<'de>;
1265
1266#[doc = " A reference to one of the component\'s child instances.\n"]
1267#[derive(Clone, Debug)]
1268pub struct ChildRef {
1269 pub name: String,
1270
1271 pub collection: Option<String>,
1272}
1273
1274impl ::fidl_next::Encodable for ChildRef {
1275 type Encoded = WireChildRef<'static>;
1276}
1277
1278unsafe impl<___E> ::fidl_next::Encode<___E> for ChildRef
1279where
1280 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1281
1282 ___E: ::fidl_next::Encoder,
1283{
1284 #[inline]
1285 fn encode(
1286 self,
1287 encoder: &mut ___E,
1288 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1289 ) -> Result<(), ::fidl_next::EncodeError> {
1290 ::fidl_next::munge! {
1291 let Self::Encoded {
1292 name,
1293 collection,
1294
1295 } = out;
1296 }
1297
1298 ::fidl_next::Encode::encode(self.name, encoder, name)?;
1299
1300 ::fidl_next::Encode::encode(self.collection, encoder, collection)?;
1301
1302 Ok(())
1303 }
1304}
1305
1306unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ChildRef
1307where
1308 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1309
1310 ___E: ::fidl_next::Encoder,
1311{
1312 #[inline]
1313 fn encode_ref(
1314 &self,
1315 encoder: &mut ___E,
1316 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1317 ) -> Result<(), ::fidl_next::EncodeError> {
1318 ::fidl_next::munge! {
1319 let Self::Encoded {
1320 name,
1321 collection,
1322
1323 } = out;
1324 }
1325
1326 ::fidl_next::EncodeRef::encode_ref(&self.name, encoder, name)?;
1327
1328 ::fidl_next::EncodeRef::encode_ref(&self.collection, encoder, collection)?;
1329
1330 Ok(())
1331 }
1332}
1333
1334impl ::fidl_next::EncodableOption for ChildRef {
1335 type EncodedOption = ::fidl_next::WireBox<'static, WireChildRef<'static>>;
1336}
1337
1338unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ChildRef
1339where
1340 ___E: ::fidl_next::Encoder + ?Sized,
1341 ChildRef: ::fidl_next::Encode<___E>,
1342{
1343 #[inline]
1344 fn encode_option(
1345 this: Option<Self>,
1346 encoder: &mut ___E,
1347 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1348 ) -> Result<(), ::fidl_next::EncodeError> {
1349 if let Some(inner) = this {
1350 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1351 ::fidl_next::WireBox::encode_present(out);
1352 } else {
1353 ::fidl_next::WireBox::encode_absent(out);
1354 }
1355
1356 Ok(())
1357 }
1358}
1359
1360unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ChildRef
1361where
1362 ___E: ::fidl_next::Encoder + ?Sized,
1363 ChildRef: ::fidl_next::EncodeRef<___E>,
1364{
1365 #[inline]
1366 fn encode_option_ref(
1367 this: Option<&Self>,
1368 encoder: &mut ___E,
1369 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1370 ) -> Result<(), ::fidl_next::EncodeError> {
1371 if let Some(inner) = this {
1372 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1373 ::fidl_next::WireBox::encode_present(out);
1374 } else {
1375 ::fidl_next::WireBox::encode_absent(out);
1376 }
1377
1378 Ok(())
1379 }
1380}
1381
1382impl<'de> ::fidl_next::FromWire<WireChildRef<'de>> for ChildRef {
1383 #[inline]
1384 fn from_wire(wire: WireChildRef<'de>) -> Self {
1385 Self {
1386 name: ::fidl_next::FromWire::from_wire(wire.name),
1387
1388 collection: ::fidl_next::FromWire::from_wire(wire.collection),
1389 }
1390 }
1391}
1392
1393impl<'de> ::fidl_next::FromWireRef<WireChildRef<'de>> for ChildRef {
1394 #[inline]
1395 fn from_wire_ref(wire: &WireChildRef<'de>) -> Self {
1396 Self {
1397 name: ::fidl_next::FromWireRef::from_wire_ref(&wire.name),
1398
1399 collection: ::fidl_next::FromWireRef::from_wire_ref(&wire.collection),
1400 }
1401 }
1402}
1403
1404#[derive(Debug)]
1406#[repr(C)]
1407pub struct WireChildRef<'de> {
1408 pub name: ::fidl_next::WireString<'de>,
1409
1410 pub collection: ::fidl_next::WireOptionalString<'de>,
1411}
1412
1413unsafe impl ::fidl_next::Wire for WireChildRef<'static> {
1414 type Decoded<'de> = WireChildRef<'de>;
1415
1416 #[inline]
1417 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1418}
1419
1420unsafe impl<___D> ::fidl_next::Decode<___D> for WireChildRef<'static>
1421where
1422 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1423
1424 ___D: ::fidl_next::Decoder,
1425{
1426 fn decode(
1427 slot: ::fidl_next::Slot<'_, Self>,
1428 decoder: &mut ___D,
1429 ) -> Result<(), ::fidl_next::DecodeError> {
1430 ::fidl_next::munge! {
1431 let Self {
1432 mut name,
1433 mut collection,
1434
1435 } = slot;
1436 }
1437
1438 ::fidl_next::Decode::decode(name.as_mut(), decoder)?;
1439
1440 let name = unsafe { name.deref_unchecked() };
1441
1442 if name.len() > 1024 {
1443 return Err(::fidl_next::DecodeError::VectorTooLong {
1444 size: name.len() as u64,
1445 limit: 1024,
1446 });
1447 }
1448
1449 ::fidl_next::Decode::decode(collection.as_mut(), decoder)?;
1450
1451 let collection = unsafe { collection.deref_unchecked() };
1452
1453 if let Some(collection) = collection.as_ref() {
1454 if collection.len() > 100 {
1455 return Err(::fidl_next::DecodeError::VectorTooLong {
1456 size: collection.len() as u64,
1457 limit: 100,
1458 });
1459 }
1460 }
1461
1462 Ok(())
1463 }
1464}
1465
1466#[doc = " A reference to one of the component\'s collections.\n"]
1467#[derive(Clone, Debug)]
1468pub struct CollectionRef {
1469 pub name: String,
1470}
1471
1472impl ::fidl_next::Encodable for CollectionRef {
1473 type Encoded = WireCollectionRef<'static>;
1474}
1475
1476unsafe impl<___E> ::fidl_next::Encode<___E> for CollectionRef
1477where
1478 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1479
1480 ___E: ::fidl_next::Encoder,
1481{
1482 #[inline]
1483 fn encode(
1484 self,
1485 encoder: &mut ___E,
1486 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1487 ) -> Result<(), ::fidl_next::EncodeError> {
1488 ::fidl_next::munge! {
1489 let Self::Encoded {
1490 name,
1491
1492 } = out;
1493 }
1494
1495 ::fidl_next::Encode::encode(self.name, encoder, name)?;
1496
1497 Ok(())
1498 }
1499}
1500
1501unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CollectionRef
1502where
1503 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1504
1505 ___E: ::fidl_next::Encoder,
1506{
1507 #[inline]
1508 fn encode_ref(
1509 &self,
1510 encoder: &mut ___E,
1511 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1512 ) -> Result<(), ::fidl_next::EncodeError> {
1513 ::fidl_next::munge! {
1514 let Self::Encoded {
1515 name,
1516
1517 } = out;
1518 }
1519
1520 ::fidl_next::EncodeRef::encode_ref(&self.name, encoder, name)?;
1521
1522 Ok(())
1523 }
1524}
1525
1526impl ::fidl_next::EncodableOption for CollectionRef {
1527 type EncodedOption = ::fidl_next::WireBox<'static, WireCollectionRef<'static>>;
1528}
1529
1530unsafe impl<___E> ::fidl_next::EncodeOption<___E> for CollectionRef
1531where
1532 ___E: ::fidl_next::Encoder + ?Sized,
1533 CollectionRef: ::fidl_next::Encode<___E>,
1534{
1535 #[inline]
1536 fn encode_option(
1537 this: Option<Self>,
1538 encoder: &mut ___E,
1539 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1540 ) -> Result<(), ::fidl_next::EncodeError> {
1541 if let Some(inner) = this {
1542 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1543 ::fidl_next::WireBox::encode_present(out);
1544 } else {
1545 ::fidl_next::WireBox::encode_absent(out);
1546 }
1547
1548 Ok(())
1549 }
1550}
1551
1552unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for CollectionRef
1553where
1554 ___E: ::fidl_next::Encoder + ?Sized,
1555 CollectionRef: ::fidl_next::EncodeRef<___E>,
1556{
1557 #[inline]
1558 fn encode_option_ref(
1559 this: Option<&Self>,
1560 encoder: &mut ___E,
1561 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1562 ) -> Result<(), ::fidl_next::EncodeError> {
1563 if let Some(inner) = this {
1564 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1565 ::fidl_next::WireBox::encode_present(out);
1566 } else {
1567 ::fidl_next::WireBox::encode_absent(out);
1568 }
1569
1570 Ok(())
1571 }
1572}
1573
1574impl<'de> ::fidl_next::FromWire<WireCollectionRef<'de>> for CollectionRef {
1575 #[inline]
1576 fn from_wire(wire: WireCollectionRef<'de>) -> Self {
1577 Self { name: ::fidl_next::FromWire::from_wire(wire.name) }
1578 }
1579}
1580
1581impl<'de> ::fidl_next::FromWireRef<WireCollectionRef<'de>> for CollectionRef {
1582 #[inline]
1583 fn from_wire_ref(wire: &WireCollectionRef<'de>) -> Self {
1584 Self { name: ::fidl_next::FromWireRef::from_wire_ref(&wire.name) }
1585 }
1586}
1587
1588#[derive(Debug)]
1590#[repr(C)]
1591pub struct WireCollectionRef<'de> {
1592 pub name: ::fidl_next::WireString<'de>,
1593}
1594
1595unsafe impl ::fidl_next::Wire for WireCollectionRef<'static> {
1596 type Decoded<'de> = WireCollectionRef<'de>;
1597
1598 #[inline]
1599 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1600}
1601
1602unsafe impl<___D> ::fidl_next::Decode<___D> for WireCollectionRef<'static>
1603where
1604 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1605
1606 ___D: ::fidl_next::Decoder,
1607{
1608 fn decode(
1609 slot: ::fidl_next::Slot<'_, Self>,
1610 decoder: &mut ___D,
1611 ) -> Result<(), ::fidl_next::DecodeError> {
1612 ::fidl_next::munge! {
1613 let Self {
1614 mut name,
1615
1616 } = slot;
1617 }
1618
1619 ::fidl_next::Decode::decode(name.as_mut(), decoder)?;
1620
1621 let name = unsafe { name.deref_unchecked() };
1622
1623 if name.len() > 100 {
1624 return Err(::fidl_next::DecodeError::VectorTooLong {
1625 size: name.len() as u64,
1626 limit: 100,
1627 });
1628 }
1629
1630 Ok(())
1631 }
1632}
1633
1634#[doc = " A reference to the component framework itself.\n"]
1635#[derive(Clone, Debug)]
1636#[repr(C)]
1637pub struct FrameworkRef {}
1638
1639impl ::fidl_next::Encodable for FrameworkRef {
1640 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireFrameworkRef> =
1641 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1642
1643 type Encoded = WireFrameworkRef;
1644}
1645
1646unsafe impl<___E> ::fidl_next::Encode<___E> for FrameworkRef
1647where
1648 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1649{
1650 #[inline]
1651 fn encode(
1652 self,
1653 encoder: &mut ___E,
1654 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1655 ) -> Result<(), ::fidl_next::EncodeError> {
1656 ::fidl_next::munge! {
1657 let Self::Encoded {
1658
1659 } = out;
1660 }
1661
1662 Ok(())
1663 }
1664}
1665
1666unsafe impl<___E> ::fidl_next::EncodeRef<___E> for FrameworkRef
1667where
1668 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1669{
1670 #[inline]
1671 fn encode_ref(
1672 &self,
1673 encoder: &mut ___E,
1674 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1675 ) -> Result<(), ::fidl_next::EncodeError> {
1676 ::fidl_next::munge! {
1677 let Self::Encoded {
1678
1679 } = out;
1680 }
1681
1682 Ok(())
1683 }
1684}
1685
1686impl ::fidl_next::EncodableOption for FrameworkRef {
1687 type EncodedOption = ::fidl_next::WireBox<'static, WireFrameworkRef>;
1688}
1689
1690unsafe impl<___E> ::fidl_next::EncodeOption<___E> for FrameworkRef
1691where
1692 ___E: ::fidl_next::Encoder + ?Sized,
1693 FrameworkRef: ::fidl_next::Encode<___E>,
1694{
1695 #[inline]
1696 fn encode_option(
1697 this: Option<Self>,
1698 encoder: &mut ___E,
1699 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1700 ) -> Result<(), ::fidl_next::EncodeError> {
1701 if let Some(inner) = this {
1702 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1703 ::fidl_next::WireBox::encode_present(out);
1704 } else {
1705 ::fidl_next::WireBox::encode_absent(out);
1706 }
1707
1708 Ok(())
1709 }
1710}
1711
1712unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for FrameworkRef
1713where
1714 ___E: ::fidl_next::Encoder + ?Sized,
1715 FrameworkRef: ::fidl_next::EncodeRef<___E>,
1716{
1717 #[inline]
1718 fn encode_option_ref(
1719 this: Option<&Self>,
1720 encoder: &mut ___E,
1721 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1722 ) -> Result<(), ::fidl_next::EncodeError> {
1723 if let Some(inner) = this {
1724 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1725 ::fidl_next::WireBox::encode_present(out);
1726 } else {
1727 ::fidl_next::WireBox::encode_absent(out);
1728 }
1729
1730 Ok(())
1731 }
1732}
1733
1734impl ::fidl_next::FromWire<WireFrameworkRef> for FrameworkRef {
1735 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireFrameworkRef, Self> =
1736 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1737
1738 #[inline]
1739 fn from_wire(wire: WireFrameworkRef) -> Self {
1740 Self {}
1741 }
1742}
1743
1744impl ::fidl_next::FromWireRef<WireFrameworkRef> for FrameworkRef {
1745 #[inline]
1746 fn from_wire_ref(wire: &WireFrameworkRef) -> Self {
1747 Self {}
1748 }
1749}
1750
1751#[derive(Clone, Debug)]
1753#[repr(C)]
1754pub struct WireFrameworkRef {}
1755
1756unsafe impl ::fidl_next::Wire for WireFrameworkRef {
1757 type Decoded<'de> = WireFrameworkRef;
1758
1759 #[inline]
1760 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1761}
1762
1763unsafe impl<___D> ::fidl_next::Decode<___D> for WireFrameworkRef
1764where
1765 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1766{
1767 fn decode(
1768 slot: ::fidl_next::Slot<'_, Self>,
1769 decoder: &mut ___D,
1770 ) -> Result<(), ::fidl_next::DecodeError> {
1771 ::fidl_next::munge! {
1772 let Self {
1773
1774 } = slot;
1775 }
1776
1777 Ok(())
1778 }
1779}
1780
1781#[doc = " A reference to a capability declared in this component.\n"]
1782#[derive(Clone, Debug)]
1783pub struct CapabilityRef {
1784 pub name: String,
1785}
1786
1787impl ::fidl_next::Encodable for CapabilityRef {
1788 type Encoded = WireCapabilityRef<'static>;
1789}
1790
1791unsafe impl<___E> ::fidl_next::Encode<___E> for CapabilityRef
1792where
1793 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1794
1795 ___E: ::fidl_next::Encoder,
1796{
1797 #[inline]
1798 fn encode(
1799 self,
1800 encoder: &mut ___E,
1801 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1802 ) -> Result<(), ::fidl_next::EncodeError> {
1803 ::fidl_next::munge! {
1804 let Self::Encoded {
1805 name,
1806
1807 } = out;
1808 }
1809
1810 ::fidl_next::Encode::encode(self.name, encoder, name)?;
1811
1812 Ok(())
1813 }
1814}
1815
1816unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CapabilityRef
1817where
1818 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1819
1820 ___E: ::fidl_next::Encoder,
1821{
1822 #[inline]
1823 fn encode_ref(
1824 &self,
1825 encoder: &mut ___E,
1826 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1827 ) -> Result<(), ::fidl_next::EncodeError> {
1828 ::fidl_next::munge! {
1829 let Self::Encoded {
1830 name,
1831
1832 } = out;
1833 }
1834
1835 ::fidl_next::EncodeRef::encode_ref(&self.name, encoder, name)?;
1836
1837 Ok(())
1838 }
1839}
1840
1841impl ::fidl_next::EncodableOption for CapabilityRef {
1842 type EncodedOption = ::fidl_next::WireBox<'static, WireCapabilityRef<'static>>;
1843}
1844
1845unsafe impl<___E> ::fidl_next::EncodeOption<___E> for CapabilityRef
1846where
1847 ___E: ::fidl_next::Encoder + ?Sized,
1848 CapabilityRef: ::fidl_next::Encode<___E>,
1849{
1850 #[inline]
1851 fn encode_option(
1852 this: Option<Self>,
1853 encoder: &mut ___E,
1854 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1855 ) -> Result<(), ::fidl_next::EncodeError> {
1856 if let Some(inner) = this {
1857 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1858 ::fidl_next::WireBox::encode_present(out);
1859 } else {
1860 ::fidl_next::WireBox::encode_absent(out);
1861 }
1862
1863 Ok(())
1864 }
1865}
1866
1867unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for CapabilityRef
1868where
1869 ___E: ::fidl_next::Encoder + ?Sized,
1870 CapabilityRef: ::fidl_next::EncodeRef<___E>,
1871{
1872 #[inline]
1873 fn encode_option_ref(
1874 this: Option<&Self>,
1875 encoder: &mut ___E,
1876 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1877 ) -> Result<(), ::fidl_next::EncodeError> {
1878 if let Some(inner) = this {
1879 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1880 ::fidl_next::WireBox::encode_present(out);
1881 } else {
1882 ::fidl_next::WireBox::encode_absent(out);
1883 }
1884
1885 Ok(())
1886 }
1887}
1888
1889impl<'de> ::fidl_next::FromWire<WireCapabilityRef<'de>> for CapabilityRef {
1890 #[inline]
1891 fn from_wire(wire: WireCapabilityRef<'de>) -> Self {
1892 Self { name: ::fidl_next::FromWire::from_wire(wire.name) }
1893 }
1894}
1895
1896impl<'de> ::fidl_next::FromWireRef<WireCapabilityRef<'de>> for CapabilityRef {
1897 #[inline]
1898 fn from_wire_ref(wire: &WireCapabilityRef<'de>) -> Self {
1899 Self { name: ::fidl_next::FromWireRef::from_wire_ref(&wire.name) }
1900 }
1901}
1902
1903#[derive(Debug)]
1905#[repr(C)]
1906pub struct WireCapabilityRef<'de> {
1907 pub name: ::fidl_next::WireString<'de>,
1908}
1909
1910unsafe impl ::fidl_next::Wire for WireCapabilityRef<'static> {
1911 type Decoded<'de> = WireCapabilityRef<'de>;
1912
1913 #[inline]
1914 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1915}
1916
1917unsafe impl<___D> ::fidl_next::Decode<___D> for WireCapabilityRef<'static>
1918where
1919 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1920
1921 ___D: ::fidl_next::Decoder,
1922{
1923 fn decode(
1924 slot: ::fidl_next::Slot<'_, Self>,
1925 decoder: &mut ___D,
1926 ) -> Result<(), ::fidl_next::DecodeError> {
1927 ::fidl_next::munge! {
1928 let Self {
1929 mut name,
1930
1931 } = slot;
1932 }
1933
1934 ::fidl_next::Decode::decode(name.as_mut(), decoder)?;
1935
1936 let name = unsafe { name.deref_unchecked() };
1937
1938 if name.len() > 100 {
1939 return Err(::fidl_next::DecodeError::VectorTooLong {
1940 size: name.len() as u64,
1941 limit: 100,
1942 });
1943 }
1944
1945 Ok(())
1946 }
1947}
1948
1949#[doc = " A reference to the environment\'s debug capabilities.\n"]
1950#[derive(Clone, Debug)]
1951#[repr(C)]
1952pub struct DebugRef {}
1953
1954impl ::fidl_next::Encodable for DebugRef {
1955 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireDebugRef> =
1956 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1957
1958 type Encoded = WireDebugRef;
1959}
1960
1961unsafe impl<___E> ::fidl_next::Encode<___E> for DebugRef
1962where
1963 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1964{
1965 #[inline]
1966 fn encode(
1967 self,
1968 encoder: &mut ___E,
1969 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1970 ) -> Result<(), ::fidl_next::EncodeError> {
1971 ::fidl_next::munge! {
1972 let Self::Encoded {
1973
1974 } = out;
1975 }
1976
1977 Ok(())
1978 }
1979}
1980
1981unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DebugRef
1982where
1983 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1984{
1985 #[inline]
1986 fn encode_ref(
1987 &self,
1988 encoder: &mut ___E,
1989 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1990 ) -> Result<(), ::fidl_next::EncodeError> {
1991 ::fidl_next::munge! {
1992 let Self::Encoded {
1993
1994 } = out;
1995 }
1996
1997 Ok(())
1998 }
1999}
2000
2001impl ::fidl_next::EncodableOption for DebugRef {
2002 type EncodedOption = ::fidl_next::WireBox<'static, WireDebugRef>;
2003}
2004
2005unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DebugRef
2006where
2007 ___E: ::fidl_next::Encoder + ?Sized,
2008 DebugRef: ::fidl_next::Encode<___E>,
2009{
2010 #[inline]
2011 fn encode_option(
2012 this: Option<Self>,
2013 encoder: &mut ___E,
2014 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
2015 ) -> Result<(), ::fidl_next::EncodeError> {
2016 if let Some(inner) = this {
2017 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2018 ::fidl_next::WireBox::encode_present(out);
2019 } else {
2020 ::fidl_next::WireBox::encode_absent(out);
2021 }
2022
2023 Ok(())
2024 }
2025}
2026
2027unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for DebugRef
2028where
2029 ___E: ::fidl_next::Encoder + ?Sized,
2030 DebugRef: ::fidl_next::EncodeRef<___E>,
2031{
2032 #[inline]
2033 fn encode_option_ref(
2034 this: Option<&Self>,
2035 encoder: &mut ___E,
2036 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
2037 ) -> Result<(), ::fidl_next::EncodeError> {
2038 if let Some(inner) = this {
2039 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2040 ::fidl_next::WireBox::encode_present(out);
2041 } else {
2042 ::fidl_next::WireBox::encode_absent(out);
2043 }
2044
2045 Ok(())
2046 }
2047}
2048
2049impl ::fidl_next::FromWire<WireDebugRef> for DebugRef {
2050 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireDebugRef, Self> =
2051 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
2052
2053 #[inline]
2054 fn from_wire(wire: WireDebugRef) -> Self {
2055 Self {}
2056 }
2057}
2058
2059impl ::fidl_next::FromWireRef<WireDebugRef> for DebugRef {
2060 #[inline]
2061 fn from_wire_ref(wire: &WireDebugRef) -> Self {
2062 Self {}
2063 }
2064}
2065
2066#[derive(Clone, Debug)]
2068#[repr(C)]
2069pub struct WireDebugRef {}
2070
2071unsafe impl ::fidl_next::Wire for WireDebugRef {
2072 type Decoded<'de> = WireDebugRef;
2073
2074 #[inline]
2075 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
2076}
2077
2078unsafe impl<___D> ::fidl_next::Decode<___D> for WireDebugRef
2079where
2080 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2081{
2082 fn decode(
2083 slot: ::fidl_next::Slot<'_, Self>,
2084 decoder: &mut ___D,
2085 ) -> Result<(), ::fidl_next::DecodeError> {
2086 ::fidl_next::munge! {
2087 let Self {
2088
2089 } = slot;
2090 }
2091
2092 Ok(())
2093 }
2094}
2095
2096#[doc = " A reference to an intentionally missing offer source.\n"]
2097#[derive(Clone, Debug)]
2098#[repr(C)]
2099pub struct VoidRef {}
2100
2101impl ::fidl_next::Encodable for VoidRef {
2102 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireVoidRef> =
2103 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
2104
2105 type Encoded = WireVoidRef;
2106}
2107
2108unsafe impl<___E> ::fidl_next::Encode<___E> for VoidRef
2109where
2110 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2111{
2112 #[inline]
2113 fn encode(
2114 self,
2115 encoder: &mut ___E,
2116 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2117 ) -> Result<(), ::fidl_next::EncodeError> {
2118 ::fidl_next::munge! {
2119 let Self::Encoded {
2120
2121 } = out;
2122 }
2123
2124 Ok(())
2125 }
2126}
2127
2128unsafe impl<___E> ::fidl_next::EncodeRef<___E> for VoidRef
2129where
2130 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2131{
2132 #[inline]
2133 fn encode_ref(
2134 &self,
2135 encoder: &mut ___E,
2136 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2137 ) -> Result<(), ::fidl_next::EncodeError> {
2138 ::fidl_next::munge! {
2139 let Self::Encoded {
2140
2141 } = out;
2142 }
2143
2144 Ok(())
2145 }
2146}
2147
2148impl ::fidl_next::EncodableOption for VoidRef {
2149 type EncodedOption = ::fidl_next::WireBox<'static, WireVoidRef>;
2150}
2151
2152unsafe impl<___E> ::fidl_next::EncodeOption<___E> for VoidRef
2153where
2154 ___E: ::fidl_next::Encoder + ?Sized,
2155 VoidRef: ::fidl_next::Encode<___E>,
2156{
2157 #[inline]
2158 fn encode_option(
2159 this: Option<Self>,
2160 encoder: &mut ___E,
2161 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
2162 ) -> Result<(), ::fidl_next::EncodeError> {
2163 if let Some(inner) = this {
2164 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2165 ::fidl_next::WireBox::encode_present(out);
2166 } else {
2167 ::fidl_next::WireBox::encode_absent(out);
2168 }
2169
2170 Ok(())
2171 }
2172}
2173
2174unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for VoidRef
2175where
2176 ___E: ::fidl_next::Encoder + ?Sized,
2177 VoidRef: ::fidl_next::EncodeRef<___E>,
2178{
2179 #[inline]
2180 fn encode_option_ref(
2181 this: Option<&Self>,
2182 encoder: &mut ___E,
2183 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
2184 ) -> Result<(), ::fidl_next::EncodeError> {
2185 if let Some(inner) = this {
2186 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2187 ::fidl_next::WireBox::encode_present(out);
2188 } else {
2189 ::fidl_next::WireBox::encode_absent(out);
2190 }
2191
2192 Ok(())
2193 }
2194}
2195
2196impl ::fidl_next::FromWire<WireVoidRef> for VoidRef {
2197 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireVoidRef, Self> =
2198 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
2199
2200 #[inline]
2201 fn from_wire(wire: WireVoidRef) -> Self {
2202 Self {}
2203 }
2204}
2205
2206impl ::fidl_next::FromWireRef<WireVoidRef> for VoidRef {
2207 #[inline]
2208 fn from_wire_ref(wire: &WireVoidRef) -> Self {
2209 Self {}
2210 }
2211}
2212
2213#[derive(Clone, Debug)]
2215#[repr(C)]
2216pub struct WireVoidRef {}
2217
2218unsafe impl ::fidl_next::Wire for WireVoidRef {
2219 type Decoded<'de> = WireVoidRef;
2220
2221 #[inline]
2222 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
2223}
2224
2225unsafe impl<___D> ::fidl_next::Decode<___D> for WireVoidRef
2226where
2227 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2228{
2229 fn decode(
2230 slot: ::fidl_next::Slot<'_, Self>,
2231 decoder: &mut ___D,
2232 ) -> Result<(), ::fidl_next::DecodeError> {
2233 ::fidl_next::munge! {
2234 let Self {
2235
2236 } = slot;
2237 }
2238
2239 Ok(())
2240 }
2241}
2242
2243#[doc = " Declares which identifier to use to key a component\'s isolated storage\n directory.\n"]
2244#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2245#[repr(u32)]
2246pub enum StorageId {
2247 StaticInstanceId = 1,
2248 StaticInstanceIdOrMoniker = 2,
2249}
2250
2251impl ::fidl_next::Encodable for StorageId {
2252 type Encoded = WireStorageId;
2253}
2254impl ::std::convert::TryFrom<u32> for StorageId {
2255 type Error = ::fidl_next::UnknownStrictEnumMemberError;
2256 fn try_from(value: u32) -> Result<Self, Self::Error> {
2257 match value {
2258 1 => Ok(Self::StaticInstanceId),
2259 2 => Ok(Self::StaticInstanceIdOrMoniker),
2260
2261 _ => Err(Self::Error::new(value.into())),
2262 }
2263 }
2264}
2265
2266unsafe impl<___E> ::fidl_next::Encode<___E> for StorageId
2267where
2268 ___E: ?Sized,
2269{
2270 #[inline]
2271 fn encode(
2272 self,
2273 encoder: &mut ___E,
2274 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2275 ) -> Result<(), ::fidl_next::EncodeError> {
2276 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
2277 }
2278}
2279
2280unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StorageId
2281where
2282 ___E: ?Sized,
2283{
2284 #[inline]
2285 fn encode_ref(
2286 &self,
2287 encoder: &mut ___E,
2288 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2289 ) -> Result<(), ::fidl_next::EncodeError> {
2290 ::fidl_next::munge!(let WireStorageId { value } = out);
2291 let _ = value.write(::fidl_next::WireU32::from(match *self {
2292 Self::StaticInstanceId => 1,
2293
2294 Self::StaticInstanceIdOrMoniker => 2,
2295 }));
2296
2297 Ok(())
2298 }
2299}
2300
2301impl ::core::convert::From<WireStorageId> for StorageId {
2302 fn from(wire: WireStorageId) -> Self {
2303 match u32::from(wire.value) {
2304 1 => Self::StaticInstanceId,
2305
2306 2 => Self::StaticInstanceIdOrMoniker,
2307
2308 _ => unsafe { ::core::hint::unreachable_unchecked() },
2309 }
2310 }
2311}
2312
2313impl ::fidl_next::FromWire<WireStorageId> for StorageId {
2314 #[inline]
2315 fn from_wire(wire: WireStorageId) -> Self {
2316 Self::from(wire)
2317 }
2318}
2319
2320impl ::fidl_next::FromWireRef<WireStorageId> for StorageId {
2321 #[inline]
2322 fn from_wire_ref(wire: &WireStorageId) -> Self {
2323 Self::from(*wire)
2324 }
2325}
2326
2327#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2329#[repr(transparent)]
2330pub struct WireStorageId {
2331 value: ::fidl_next::WireU32,
2332}
2333
2334unsafe impl ::fidl_next::Wire for WireStorageId {
2335 type Decoded<'de> = Self;
2336
2337 #[inline]
2338 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2339 }
2341}
2342
2343impl WireStorageId {
2344 pub const STATIC_INSTANCE_ID: WireStorageId = WireStorageId { value: ::fidl_next::WireU32(1) };
2345
2346 pub const STATIC_INSTANCE_ID_OR_MONIKER: WireStorageId =
2347 WireStorageId { value: ::fidl_next::WireU32(2) };
2348}
2349
2350unsafe impl<___D> ::fidl_next::Decode<___D> for WireStorageId
2351where
2352 ___D: ?Sized,
2353{
2354 fn decode(
2355 slot: ::fidl_next::Slot<'_, Self>,
2356 _: &mut ___D,
2357 ) -> Result<(), ::fidl_next::DecodeError> {
2358 ::fidl_next::munge!(let Self { value } = slot);
2359
2360 match u32::from(*value) {
2361 1 | 2 => (),
2362 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
2363 }
2364
2365 Ok(())
2366 }
2367}
2368
2369impl ::core::convert::From<StorageId> for WireStorageId {
2370 fn from(natural: StorageId) -> Self {
2371 match natural {
2372 StorageId::StaticInstanceId => WireStorageId::STATIC_INSTANCE_ID,
2373
2374 StorageId::StaticInstanceIdOrMoniker => WireStorageId::STATIC_INSTANCE_ID_OR_MONIKER,
2375 }
2376 }
2377}
2378
2379#[doc = " Declares a runner capability backed by a service.\n"]
2380#[derive(Clone, Debug, Default)]
2381pub struct Runner {
2382 pub name: Option<String>,
2383
2384 pub source_path: Option<String>,
2385}
2386
2387impl Runner {
2388 fn __max_ordinal(&self) -> usize {
2389 if self.source_path.is_some() {
2390 return 2;
2391 }
2392
2393 if self.name.is_some() {
2394 return 1;
2395 }
2396
2397 0
2398 }
2399}
2400
2401impl ::fidl_next::Encodable for Runner {
2402 type Encoded = WireRunner<'static>;
2403}
2404
2405unsafe impl<___E> ::fidl_next::Encode<___E> for Runner
2406where
2407 ___E: ::fidl_next::Encoder + ?Sized,
2408{
2409 #[inline]
2410 fn encode(
2411 mut self,
2412 encoder: &mut ___E,
2413 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2414 ) -> Result<(), ::fidl_next::EncodeError> {
2415 ::fidl_next::munge!(let WireRunner { table } = out);
2416
2417 let max_ord = self.__max_ordinal();
2418
2419 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2420 ::fidl_next::Wire::zero_padding(&mut out);
2421
2422 let mut preallocated =
2423 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2424
2425 for i in 1..=max_ord {
2426 match i {
2427 2 => {
2428 if let Some(source_path) = self.source_path.take() {
2429 ::fidl_next::WireEnvelope::encode_value(
2430 source_path,
2431 preallocated.encoder,
2432 &mut out,
2433 )?;
2434 } else {
2435 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2436 }
2437 }
2438
2439 1 => {
2440 if let Some(name) = self.name.take() {
2441 ::fidl_next::WireEnvelope::encode_value(
2442 name,
2443 preallocated.encoder,
2444 &mut out,
2445 )?;
2446 } else {
2447 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2448 }
2449 }
2450
2451 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2452 }
2453 unsafe {
2454 preallocated.write_next(out.assume_init_ref());
2455 }
2456 }
2457
2458 ::fidl_next::WireTable::encode_len(table, max_ord);
2459
2460 Ok(())
2461 }
2462}
2463
2464unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Runner
2465where
2466 ___E: ::fidl_next::Encoder + ?Sized,
2467{
2468 #[inline]
2469 fn encode_ref(
2470 &self,
2471 encoder: &mut ___E,
2472 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2473 ) -> Result<(), ::fidl_next::EncodeError> {
2474 ::fidl_next::munge!(let WireRunner { table } = out);
2475
2476 let max_ord = self.__max_ordinal();
2477
2478 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2479 ::fidl_next::Wire::zero_padding(&mut out);
2480
2481 let mut preallocated =
2482 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2483
2484 for i in 1..=max_ord {
2485 match i {
2486 2 => {
2487 if let Some(source_path) = &self.source_path {
2488 ::fidl_next::WireEnvelope::encode_value(
2489 source_path,
2490 preallocated.encoder,
2491 &mut out,
2492 )?;
2493 } else {
2494 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2495 }
2496 }
2497
2498 1 => {
2499 if let Some(name) = &self.name {
2500 ::fidl_next::WireEnvelope::encode_value(
2501 name,
2502 preallocated.encoder,
2503 &mut out,
2504 )?;
2505 } else {
2506 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2507 }
2508 }
2509
2510 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2511 }
2512 unsafe {
2513 preallocated.write_next(out.assume_init_ref());
2514 }
2515 }
2516
2517 ::fidl_next::WireTable::encode_len(table, max_ord);
2518
2519 Ok(())
2520 }
2521}
2522
2523impl<'de> ::fidl_next::FromWire<WireRunner<'de>> for Runner {
2524 #[inline]
2525 fn from_wire(wire: WireRunner<'de>) -> Self {
2526 let wire = ::core::mem::ManuallyDrop::new(wire);
2527
2528 let name = wire.table.get(1);
2529
2530 let source_path = wire.table.get(2);
2531
2532 Self {
2533 name: name.map(|envelope| {
2534 ::fidl_next::FromWire::from_wire(unsafe {
2535 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
2536 })
2537 }),
2538
2539 source_path: source_path.map(|envelope| {
2540 ::fidl_next::FromWire::from_wire(unsafe {
2541 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
2542 })
2543 }),
2544 }
2545 }
2546}
2547
2548impl<'de> ::fidl_next::FromWireRef<WireRunner<'de>> for Runner {
2549 #[inline]
2550 fn from_wire_ref(wire: &WireRunner<'de>) -> Self {
2551 Self {
2552 name: wire.table.get(1).map(|envelope| {
2553 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2554 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
2555 })
2556 }),
2557
2558 source_path: wire.table.get(2).map(|envelope| {
2559 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2560 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
2561 })
2562 }),
2563 }
2564 }
2565}
2566
2567#[repr(C)]
2569pub struct WireRunner<'de> {
2570 table: ::fidl_next::WireTable<'de>,
2571}
2572
2573impl<'de> Drop for WireRunner<'de> {
2574 fn drop(&mut self) {
2575 let _ = self
2576 .table
2577 .get(1)
2578 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
2579
2580 let _ = self
2581 .table
2582 .get(2)
2583 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
2584 }
2585}
2586
2587unsafe impl ::fidl_next::Wire for WireRunner<'static> {
2588 type Decoded<'de> = WireRunner<'de>;
2589
2590 #[inline]
2591 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2592 ::fidl_next::munge!(let Self { table } = out);
2593 ::fidl_next::WireTable::zero_padding(table);
2594 }
2595}
2596
2597unsafe impl<___D> ::fidl_next::Decode<___D> for WireRunner<'static>
2598where
2599 ___D: ::fidl_next::Decoder + ?Sized,
2600{
2601 fn decode(
2602 slot: ::fidl_next::Slot<'_, Self>,
2603 decoder: &mut ___D,
2604 ) -> Result<(), ::fidl_next::DecodeError> {
2605 ::fidl_next::munge!(let Self { table } = slot);
2606
2607 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2608 match ordinal {
2609 0 => unsafe { ::core::hint::unreachable_unchecked() },
2610
2611 1 => {
2612 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
2613 slot.as_mut(),
2614 decoder,
2615 )?;
2616
2617 let name = unsafe {
2618 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
2619 };
2620
2621 if name.len() > 100 {
2622 return Err(::fidl_next::DecodeError::VectorTooLong {
2623 size: name.len() as u64,
2624 limit: 100,
2625 });
2626 }
2627
2628 Ok(())
2629 }
2630
2631 2 => {
2632 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
2633 slot.as_mut(),
2634 decoder,
2635 )?;
2636
2637 let source_path = unsafe {
2638 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
2639 };
2640
2641 if source_path.len() > 1024 {
2642 return Err(::fidl_next::DecodeError::VectorTooLong {
2643 size: source_path.len() as u64,
2644 limit: 1024,
2645 });
2646 }
2647
2648 Ok(())
2649 }
2650
2651 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
2652 }
2653 })
2654 }
2655}
2656
2657impl<'de> WireRunner<'de> {
2658 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
2659 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2660 }
2661
2662 pub fn source_path(&self) -> Option<&::fidl_next::WireString<'de>> {
2663 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2664 }
2665}
2666
2667impl<'de> ::core::fmt::Debug for WireRunner<'de> {
2668 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
2669 f.debug_struct("Runner")
2670 .field("name", &self.name())
2671 .field("source_path", &self.source_path())
2672 .finish()
2673 }
2674}
2675
2676#[doc = " Declares a resolver which is responsible for resolving component URLs to\n actual components. See `fuchsia.component.resolution.Resolver` for the\n protocol resolvers are expected to implement.\n"]
2677#[derive(Clone, Debug, Default)]
2678pub struct Resolver {
2679 pub name: Option<String>,
2680
2681 pub source_path: Option<String>,
2682}
2683
2684impl Resolver {
2685 fn __max_ordinal(&self) -> usize {
2686 if self.source_path.is_some() {
2687 return 2;
2688 }
2689
2690 if self.name.is_some() {
2691 return 1;
2692 }
2693
2694 0
2695 }
2696}
2697
2698impl ::fidl_next::Encodable for Resolver {
2699 type Encoded = WireResolver<'static>;
2700}
2701
2702unsafe impl<___E> ::fidl_next::Encode<___E> for Resolver
2703where
2704 ___E: ::fidl_next::Encoder + ?Sized,
2705{
2706 #[inline]
2707 fn encode(
2708 mut self,
2709 encoder: &mut ___E,
2710 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2711 ) -> Result<(), ::fidl_next::EncodeError> {
2712 ::fidl_next::munge!(let WireResolver { table } = out);
2713
2714 let max_ord = self.__max_ordinal();
2715
2716 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2717 ::fidl_next::Wire::zero_padding(&mut out);
2718
2719 let mut preallocated =
2720 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2721
2722 for i in 1..=max_ord {
2723 match i {
2724 2 => {
2725 if let Some(source_path) = self.source_path.take() {
2726 ::fidl_next::WireEnvelope::encode_value(
2727 source_path,
2728 preallocated.encoder,
2729 &mut out,
2730 )?;
2731 } else {
2732 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2733 }
2734 }
2735
2736 1 => {
2737 if let Some(name) = self.name.take() {
2738 ::fidl_next::WireEnvelope::encode_value(
2739 name,
2740 preallocated.encoder,
2741 &mut out,
2742 )?;
2743 } else {
2744 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2745 }
2746 }
2747
2748 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2749 }
2750 unsafe {
2751 preallocated.write_next(out.assume_init_ref());
2752 }
2753 }
2754
2755 ::fidl_next::WireTable::encode_len(table, max_ord);
2756
2757 Ok(())
2758 }
2759}
2760
2761unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Resolver
2762where
2763 ___E: ::fidl_next::Encoder + ?Sized,
2764{
2765 #[inline]
2766 fn encode_ref(
2767 &self,
2768 encoder: &mut ___E,
2769 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2770 ) -> Result<(), ::fidl_next::EncodeError> {
2771 ::fidl_next::munge!(let WireResolver { table } = out);
2772
2773 let max_ord = self.__max_ordinal();
2774
2775 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2776 ::fidl_next::Wire::zero_padding(&mut out);
2777
2778 let mut preallocated =
2779 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2780
2781 for i in 1..=max_ord {
2782 match i {
2783 2 => {
2784 if let Some(source_path) = &self.source_path {
2785 ::fidl_next::WireEnvelope::encode_value(
2786 source_path,
2787 preallocated.encoder,
2788 &mut out,
2789 )?;
2790 } else {
2791 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2792 }
2793 }
2794
2795 1 => {
2796 if let Some(name) = &self.name {
2797 ::fidl_next::WireEnvelope::encode_value(
2798 name,
2799 preallocated.encoder,
2800 &mut out,
2801 )?;
2802 } else {
2803 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2804 }
2805 }
2806
2807 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2808 }
2809 unsafe {
2810 preallocated.write_next(out.assume_init_ref());
2811 }
2812 }
2813
2814 ::fidl_next::WireTable::encode_len(table, max_ord);
2815
2816 Ok(())
2817 }
2818}
2819
2820impl<'de> ::fidl_next::FromWire<WireResolver<'de>> for Resolver {
2821 #[inline]
2822 fn from_wire(wire: WireResolver<'de>) -> Self {
2823 let wire = ::core::mem::ManuallyDrop::new(wire);
2824
2825 let name = wire.table.get(1);
2826
2827 let source_path = wire.table.get(2);
2828
2829 Self {
2830 name: name.map(|envelope| {
2831 ::fidl_next::FromWire::from_wire(unsafe {
2832 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
2833 })
2834 }),
2835
2836 source_path: source_path.map(|envelope| {
2837 ::fidl_next::FromWire::from_wire(unsafe {
2838 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
2839 })
2840 }),
2841 }
2842 }
2843}
2844
2845impl<'de> ::fidl_next::FromWireRef<WireResolver<'de>> for Resolver {
2846 #[inline]
2847 fn from_wire_ref(wire: &WireResolver<'de>) -> Self {
2848 Self {
2849 name: wire.table.get(1).map(|envelope| {
2850 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2851 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
2852 })
2853 }),
2854
2855 source_path: wire.table.get(2).map(|envelope| {
2856 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
2857 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
2858 })
2859 }),
2860 }
2861 }
2862}
2863
2864#[repr(C)]
2866pub struct WireResolver<'de> {
2867 table: ::fidl_next::WireTable<'de>,
2868}
2869
2870impl<'de> Drop for WireResolver<'de> {
2871 fn drop(&mut self) {
2872 let _ = self
2873 .table
2874 .get(1)
2875 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
2876
2877 let _ = self
2878 .table
2879 .get(2)
2880 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
2881 }
2882}
2883
2884unsafe impl ::fidl_next::Wire for WireResolver<'static> {
2885 type Decoded<'de> = WireResolver<'de>;
2886
2887 #[inline]
2888 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2889 ::fidl_next::munge!(let Self { table } = out);
2890 ::fidl_next::WireTable::zero_padding(table);
2891 }
2892}
2893
2894unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolver<'static>
2895where
2896 ___D: ::fidl_next::Decoder + ?Sized,
2897{
2898 fn decode(
2899 slot: ::fidl_next::Slot<'_, Self>,
2900 decoder: &mut ___D,
2901 ) -> Result<(), ::fidl_next::DecodeError> {
2902 ::fidl_next::munge!(let Self { table } = slot);
2903
2904 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2905 match ordinal {
2906 0 => unsafe { ::core::hint::unreachable_unchecked() },
2907
2908 1 => {
2909 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
2910 slot.as_mut(),
2911 decoder,
2912 )?;
2913
2914 let name = unsafe {
2915 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
2916 };
2917
2918 if name.len() > 100 {
2919 return Err(::fidl_next::DecodeError::VectorTooLong {
2920 size: name.len() as u64,
2921 limit: 100,
2922 });
2923 }
2924
2925 Ok(())
2926 }
2927
2928 2 => {
2929 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
2930 slot.as_mut(),
2931 decoder,
2932 )?;
2933
2934 let source_path = unsafe {
2935 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
2936 };
2937
2938 if source_path.len() > 1024 {
2939 return Err(::fidl_next::DecodeError::VectorTooLong {
2940 size: source_path.len() as u64,
2941 limit: 1024,
2942 });
2943 }
2944
2945 Ok(())
2946 }
2947
2948 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
2949 }
2950 })
2951 }
2952}
2953
2954impl<'de> WireResolver<'de> {
2955 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
2956 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2957 }
2958
2959 pub fn source_path(&self) -> Option<&::fidl_next::WireString<'de>> {
2960 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2961 }
2962}
2963
2964impl<'de> ::core::fmt::Debug for WireResolver<'de> {
2965 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
2966 f.debug_struct("Resolver")
2967 .field("name", &self.name())
2968 .field("source_path", &self.source_path())
2969 .finish()
2970 }
2971}
2972
2973#[doc = " Declares an event_stream capability\n\n This type cannot be used in `fuchsia.component.decl.Component`. It is only\n used for the framework\'s built-in capabilities declared in\n `internal.Config`.\n"]
2974#[derive(Clone, Debug, Default)]
2975pub struct EventStream {
2976 pub name: Option<String>,
2977}
2978
2979impl EventStream {
2980 fn __max_ordinal(&self) -> usize {
2981 if self.name.is_some() {
2982 return 1;
2983 }
2984
2985 0
2986 }
2987}
2988
2989impl ::fidl_next::Encodable for EventStream {
2990 type Encoded = WireEventStream<'static>;
2991}
2992
2993unsafe impl<___E> ::fidl_next::Encode<___E> for EventStream
2994where
2995 ___E: ::fidl_next::Encoder + ?Sized,
2996{
2997 #[inline]
2998 fn encode(
2999 mut self,
3000 encoder: &mut ___E,
3001 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3002 ) -> Result<(), ::fidl_next::EncodeError> {
3003 ::fidl_next::munge!(let WireEventStream { table } = out);
3004
3005 let max_ord = self.__max_ordinal();
3006
3007 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
3008 ::fidl_next::Wire::zero_padding(&mut out);
3009
3010 let mut preallocated =
3011 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
3012
3013 for i in 1..=max_ord {
3014 match i {
3015 1 => {
3016 if let Some(name) = self.name.take() {
3017 ::fidl_next::WireEnvelope::encode_value(
3018 name,
3019 preallocated.encoder,
3020 &mut out,
3021 )?;
3022 } else {
3023 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3024 }
3025 }
3026
3027 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
3028 }
3029 unsafe {
3030 preallocated.write_next(out.assume_init_ref());
3031 }
3032 }
3033
3034 ::fidl_next::WireTable::encode_len(table, max_ord);
3035
3036 Ok(())
3037 }
3038}
3039
3040unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EventStream
3041where
3042 ___E: ::fidl_next::Encoder + ?Sized,
3043{
3044 #[inline]
3045 fn encode_ref(
3046 &self,
3047 encoder: &mut ___E,
3048 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3049 ) -> Result<(), ::fidl_next::EncodeError> {
3050 ::fidl_next::munge!(let WireEventStream { table } = out);
3051
3052 let max_ord = self.__max_ordinal();
3053
3054 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
3055 ::fidl_next::Wire::zero_padding(&mut out);
3056
3057 let mut preallocated =
3058 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
3059
3060 for i in 1..=max_ord {
3061 match i {
3062 1 => {
3063 if let Some(name) = &self.name {
3064 ::fidl_next::WireEnvelope::encode_value(
3065 name,
3066 preallocated.encoder,
3067 &mut out,
3068 )?;
3069 } else {
3070 ::fidl_next::WireEnvelope::encode_zero(&mut out)
3071 }
3072 }
3073
3074 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
3075 }
3076 unsafe {
3077 preallocated.write_next(out.assume_init_ref());
3078 }
3079 }
3080
3081 ::fidl_next::WireTable::encode_len(table, max_ord);
3082
3083 Ok(())
3084 }
3085}
3086
3087impl<'de> ::fidl_next::FromWire<WireEventStream<'de>> for EventStream {
3088 #[inline]
3089 fn from_wire(wire: WireEventStream<'de>) -> Self {
3090 let wire = ::core::mem::ManuallyDrop::new(wire);
3091
3092 let name = wire.table.get(1);
3093
3094 Self {
3095 name: name.map(|envelope| {
3096 ::fidl_next::FromWire::from_wire(unsafe {
3097 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
3098 })
3099 }),
3100 }
3101 }
3102}
3103
3104impl<'de> ::fidl_next::FromWireRef<WireEventStream<'de>> for EventStream {
3105 #[inline]
3106 fn from_wire_ref(wire: &WireEventStream<'de>) -> Self {
3107 Self {
3108 name: wire.table.get(1).map(|envelope| {
3109 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
3110 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
3111 })
3112 }),
3113 }
3114 }
3115}
3116
3117#[repr(C)]
3119pub struct WireEventStream<'de> {
3120 table: ::fidl_next::WireTable<'de>,
3121}
3122
3123impl<'de> Drop for WireEventStream<'de> {
3124 fn drop(&mut self) {
3125 let _ = self
3126 .table
3127 .get(1)
3128 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
3129 }
3130}
3131
3132unsafe impl ::fidl_next::Wire for WireEventStream<'static> {
3133 type Decoded<'de> = WireEventStream<'de>;
3134
3135 #[inline]
3136 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3137 ::fidl_next::munge!(let Self { table } = out);
3138 ::fidl_next::WireTable::zero_padding(table);
3139 }
3140}
3141
3142unsafe impl<___D> ::fidl_next::Decode<___D> for WireEventStream<'static>
3143where
3144 ___D: ::fidl_next::Decoder + ?Sized,
3145{
3146 fn decode(
3147 slot: ::fidl_next::Slot<'_, Self>,
3148 decoder: &mut ___D,
3149 ) -> Result<(), ::fidl_next::DecodeError> {
3150 ::fidl_next::munge!(let Self { table } = slot);
3151
3152 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3153 match ordinal {
3154 0 => unsafe { ::core::hint::unreachable_unchecked() },
3155
3156 1 => {
3157 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
3158 slot.as_mut(),
3159 decoder,
3160 )?;
3161
3162 let name = unsafe {
3163 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
3164 };
3165
3166 if name.len() > 100 {
3167 return Err(::fidl_next::DecodeError::VectorTooLong {
3168 size: name.len() as u64,
3169 limit: 100,
3170 });
3171 }
3172
3173 Ok(())
3174 }
3175
3176 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
3177 }
3178 })
3179 }
3180}
3181
3182impl<'de> WireEventStream<'de> {
3183 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
3184 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3185 }
3186}
3187
3188impl<'de> ::core::fmt::Debug for WireEventStream<'de> {
3189 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
3190 f.debug_struct("EventStream").field("name", &self.name()).finish()
3191 }
3192}
3193
3194#[doc = " A single configuration value.\n"]
3195#[derive(Clone, Debug)]
3196pub enum ConfigSingleValue {
3197 Bool(bool),
3198
3199 Uint8(u8),
3200
3201 Uint16(u16),
3202
3203 Uint32(u32),
3204
3205 Uint64(u64),
3206
3207 Int8(i8),
3208
3209 Int16(i16),
3210
3211 Int32(i32),
3212
3213 Int64(i64),
3214
3215 String(String),
3216
3217 UnknownOrdinal_(u64),
3218}
3219
3220impl ::fidl_next::Encodable for ConfigSingleValue {
3221 type Encoded = WireConfigSingleValue<'static>;
3222}
3223
3224unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigSingleValue
3225where
3226 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3227
3228 ___E: ::fidl_next::Encoder,
3229{
3230 #[inline]
3231 fn encode(
3232 self,
3233 encoder: &mut ___E,
3234 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3235 ) -> Result<(), ::fidl_next::EncodeError> {
3236 ::fidl_next::munge!(let WireConfigSingleValue { raw, _phantom: _ } = out);
3237
3238 match self {
3239 Self::Bool(value) => {
3240 ::fidl_next::RawWireUnion::encode_as::<___E, bool>(value, 1, encoder, raw)?
3241 }
3242
3243 Self::Uint8(value) => {
3244 ::fidl_next::RawWireUnion::encode_as::<___E, u8>(value, 2, encoder, raw)?
3245 }
3246
3247 Self::Uint16(value) => {
3248 ::fidl_next::RawWireUnion::encode_as::<___E, u16>(value, 3, encoder, raw)?
3249 }
3250
3251 Self::Uint32(value) => {
3252 ::fidl_next::RawWireUnion::encode_as::<___E, u32>(value, 4, encoder, raw)?
3253 }
3254
3255 Self::Uint64(value) => {
3256 ::fidl_next::RawWireUnion::encode_as::<___E, u64>(value, 5, encoder, raw)?
3257 }
3258
3259 Self::Int8(value) => {
3260 ::fidl_next::RawWireUnion::encode_as::<___E, i8>(value, 6, encoder, raw)?
3261 }
3262
3263 Self::Int16(value) => {
3264 ::fidl_next::RawWireUnion::encode_as::<___E, i16>(value, 7, encoder, raw)?
3265 }
3266
3267 Self::Int32(value) => {
3268 ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 8, encoder, raw)?
3269 }
3270
3271 Self::Int64(value) => {
3272 ::fidl_next::RawWireUnion::encode_as::<___E, i64>(value, 9, encoder, raw)?
3273 }
3274
3275 Self::String(value) => {
3276 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 10, encoder, raw)?
3277 }
3278
3279 Self::UnknownOrdinal_(ordinal) => {
3280 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
3281 }
3282 }
3283
3284 Ok(())
3285 }
3286}
3287
3288unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigSingleValue
3289where
3290 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3291
3292 ___E: ::fidl_next::Encoder,
3293{
3294 #[inline]
3295 fn encode_ref(
3296 &self,
3297 encoder: &mut ___E,
3298 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3299 ) -> Result<(), ::fidl_next::EncodeError> {
3300 ::fidl_next::munge!(let WireConfigSingleValue { raw, _phantom: _ } = out);
3301
3302 match self {
3303 Self::Bool(value) => {
3304 ::fidl_next::RawWireUnion::encode_as::<___E, &bool>(value, 1, encoder, raw)?
3305 }
3306
3307 Self::Uint8(value) => {
3308 ::fidl_next::RawWireUnion::encode_as::<___E, &u8>(value, 2, encoder, raw)?
3309 }
3310
3311 Self::Uint16(value) => {
3312 ::fidl_next::RawWireUnion::encode_as::<___E, &u16>(value, 3, encoder, raw)?
3313 }
3314
3315 Self::Uint32(value) => {
3316 ::fidl_next::RawWireUnion::encode_as::<___E, &u32>(value, 4, encoder, raw)?
3317 }
3318
3319 Self::Uint64(value) => {
3320 ::fidl_next::RawWireUnion::encode_as::<___E, &u64>(value, 5, encoder, raw)?
3321 }
3322
3323 Self::Int8(value) => {
3324 ::fidl_next::RawWireUnion::encode_as::<___E, &i8>(value, 6, encoder, raw)?
3325 }
3326
3327 Self::Int16(value) => {
3328 ::fidl_next::RawWireUnion::encode_as::<___E, &i16>(value, 7, encoder, raw)?
3329 }
3330
3331 Self::Int32(value) => {
3332 ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 8, encoder, raw)?
3333 }
3334
3335 Self::Int64(value) => {
3336 ::fidl_next::RawWireUnion::encode_as::<___E, &i64>(value, 9, encoder, raw)?
3337 }
3338
3339 Self::String(value) => {
3340 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 10, encoder, raw)?
3341 }
3342
3343 Self::UnknownOrdinal_(ordinal) => {
3344 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
3345 }
3346 }
3347
3348 Ok(())
3349 }
3350}
3351
3352impl ::fidl_next::EncodableOption for ConfigSingleValue {
3353 type EncodedOption = WireOptionalConfigSingleValue<'static>;
3354}
3355
3356unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ConfigSingleValue
3357where
3358 ___E: ?Sized,
3359 ConfigSingleValue: ::fidl_next::Encode<___E>,
3360{
3361 #[inline]
3362 fn encode_option(
3363 this: Option<Self>,
3364 encoder: &mut ___E,
3365 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
3366 ) -> Result<(), ::fidl_next::EncodeError> {
3367 ::fidl_next::munge!(let WireOptionalConfigSingleValue { raw, _phantom: _ } = &mut *out);
3368
3369 if let Some(inner) = this {
3370 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
3371 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
3372 } else {
3373 ::fidl_next::RawWireUnion::encode_absent(raw);
3374 }
3375
3376 Ok(())
3377 }
3378}
3379
3380unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ConfigSingleValue
3381where
3382 ___E: ?Sized,
3383 ConfigSingleValue: ::fidl_next::EncodeRef<___E>,
3384{
3385 #[inline]
3386 fn encode_option_ref(
3387 this: Option<&Self>,
3388 encoder: &mut ___E,
3389 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
3390 ) -> Result<(), ::fidl_next::EncodeError> {
3391 ::fidl_next::munge!(let WireOptionalConfigSingleValue { raw, _phantom: _ } = &mut *out);
3392
3393 if let Some(inner) = this {
3394 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
3395 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
3396 } else {
3397 ::fidl_next::RawWireUnion::encode_absent(raw);
3398 }
3399
3400 Ok(())
3401 }
3402}
3403
3404impl<'de> ::fidl_next::FromWire<WireConfigSingleValue<'de>> for ConfigSingleValue {
3405 #[inline]
3406 fn from_wire(wire: WireConfigSingleValue<'de>) -> Self {
3407 let wire = ::core::mem::ManuallyDrop::new(wire);
3408 match wire.raw.ordinal() {
3409 1 => Self::Bool(::fidl_next::FromWire::from_wire(unsafe {
3410 wire.raw.get().read_unchecked::<bool>()
3411 })),
3412
3413 2 => Self::Uint8(::fidl_next::FromWire::from_wire(unsafe {
3414 wire.raw.get().read_unchecked::<u8>()
3415 })),
3416
3417 3 => Self::Uint16(::fidl_next::FromWire::from_wire(unsafe {
3418 wire.raw.get().read_unchecked::<::fidl_next::WireU16>()
3419 })),
3420
3421 4 => Self::Uint32(::fidl_next::FromWire::from_wire(unsafe {
3422 wire.raw.get().read_unchecked::<::fidl_next::WireU32>()
3423 })),
3424
3425 5 => Self::Uint64(::fidl_next::FromWire::from_wire(unsafe {
3426 wire.raw.get().read_unchecked::<::fidl_next::WireU64>()
3427 })),
3428
3429 6 => Self::Int8(::fidl_next::FromWire::from_wire(unsafe {
3430 wire.raw.get().read_unchecked::<i8>()
3431 })),
3432
3433 7 => Self::Int16(::fidl_next::FromWire::from_wire(unsafe {
3434 wire.raw.get().read_unchecked::<::fidl_next::WireI16>()
3435 })),
3436
3437 8 => Self::Int32(::fidl_next::FromWire::from_wire(unsafe {
3438 wire.raw.get().read_unchecked::<::fidl_next::WireI32>()
3439 })),
3440
3441 9 => Self::Int64(::fidl_next::FromWire::from_wire(unsafe {
3442 wire.raw.get().read_unchecked::<::fidl_next::WireI64>()
3443 })),
3444
3445 10 => Self::String(::fidl_next::FromWire::from_wire(unsafe {
3446 wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
3447 })),
3448
3449 _ => unsafe { ::core::hint::unreachable_unchecked() },
3450 }
3451 }
3452}
3453
3454impl<'de> ::fidl_next::FromWireRef<WireConfigSingleValue<'de>> for ConfigSingleValue {
3455 #[inline]
3456 fn from_wire_ref(wire: &WireConfigSingleValue<'de>) -> Self {
3457 match wire.raw.ordinal() {
3458 1 => Self::Bool(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3459 wire.raw.get().deref_unchecked::<bool>()
3460 })),
3461
3462 2 => Self::Uint8(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3463 wire.raw.get().deref_unchecked::<u8>()
3464 })),
3465
3466 3 => Self::Uint16(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3467 wire.raw.get().deref_unchecked::<::fidl_next::WireU16>()
3468 })),
3469
3470 4 => Self::Uint32(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3471 wire.raw.get().deref_unchecked::<::fidl_next::WireU32>()
3472 })),
3473
3474 5 => Self::Uint64(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3475 wire.raw.get().deref_unchecked::<::fidl_next::WireU64>()
3476 })),
3477
3478 6 => Self::Int8(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3479 wire.raw.get().deref_unchecked::<i8>()
3480 })),
3481
3482 7 => Self::Int16(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3483 wire.raw.get().deref_unchecked::<::fidl_next::WireI16>()
3484 })),
3485
3486 8 => Self::Int32(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3487 wire.raw.get().deref_unchecked::<::fidl_next::WireI32>()
3488 })),
3489
3490 9 => Self::Int64(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3491 wire.raw.get().deref_unchecked::<::fidl_next::WireI64>()
3492 })),
3493
3494 10 => Self::String(::fidl_next::FromWireRef::from_wire_ref(unsafe {
3495 wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
3496 })),
3497
3498 _ => unsafe { ::core::hint::unreachable_unchecked() },
3499 }
3500 }
3501}
3502
3503impl<'de> ::fidl_next::FromWireOption<WireOptionalConfigSingleValue<'de>>
3504 for Box<ConfigSingleValue>
3505{
3506 #[inline]
3507 fn from_wire_option(wire: WireOptionalConfigSingleValue<'de>) -> Option<Self> {
3508 if let Some(inner) = wire.into_option() {
3509 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
3510 } else {
3511 None
3512 }
3513 }
3514}
3515
3516impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalConfigSingleValue<'de>>
3517 for Box<ConfigSingleValue>
3518{
3519 #[inline]
3520 fn from_wire_option_ref(wire: &WireOptionalConfigSingleValue<'de>) -> Option<Self> {
3521 if let Some(inner) = wire.as_ref() {
3522 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
3523 } else {
3524 None
3525 }
3526 }
3527}
3528
3529#[repr(transparent)]
3531pub struct WireConfigSingleValue<'de> {
3532 raw: ::fidl_next::RawWireUnion,
3533 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
3534}
3535
3536impl<'de> Drop for WireConfigSingleValue<'de> {
3537 fn drop(&mut self) {
3538 match self.raw.ordinal() {
3539 1 => {
3540 let _ = unsafe { self.raw.get().read_unchecked::<bool>() };
3541 }
3542
3543 2 => {
3544 let _ = unsafe { self.raw.get().read_unchecked::<u8>() };
3545 }
3546
3547 3 => {
3548 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU16>() };
3549 }
3550
3551 4 => {
3552 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() };
3553 }
3554
3555 5 => {
3556 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU64>() };
3557 }
3558
3559 6 => {
3560 let _ = unsafe { self.raw.get().read_unchecked::<i8>() };
3561 }
3562
3563 7 => {
3564 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI16>() };
3565 }
3566
3567 8 => {
3568 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() };
3569 }
3570
3571 9 => {
3572 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI64>() };
3573 }
3574
3575 10 => {
3576 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
3577 }
3578
3579 _ => (),
3580 }
3581 }
3582}
3583
3584unsafe impl ::fidl_next::Wire for WireConfigSingleValue<'static> {
3585 type Decoded<'de> = WireConfigSingleValue<'de>;
3586
3587 #[inline]
3588 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3589 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
3590 ::fidl_next::RawWireUnion::zero_padding(raw);
3591 }
3592}
3593
3594pub mod config_single_value {
3595 pub enum Ref<'de> {
3596 Bool(&'de bool),
3597
3598 Uint8(&'de u8),
3599
3600 Uint16(&'de ::fidl_next::WireU16),
3601
3602 Uint32(&'de ::fidl_next::WireU32),
3603
3604 Uint64(&'de ::fidl_next::WireU64),
3605
3606 Int8(&'de i8),
3607
3608 Int16(&'de ::fidl_next::WireI16),
3609
3610 Int32(&'de ::fidl_next::WireI32),
3611
3612 Int64(&'de ::fidl_next::WireI64),
3613
3614 String(&'de ::fidl_next::WireString<'de>),
3615
3616 UnknownOrdinal_(u64),
3617 }
3618}
3619
3620impl<'de> WireConfigSingleValue<'de> {
3621 pub fn as_ref(&self) -> crate::config_single_value::Ref<'_> {
3622 match self.raw.ordinal() {
3623 1 => crate::config_single_value::Ref::Bool(unsafe {
3624 self.raw.get().deref_unchecked::<bool>()
3625 }),
3626
3627 2 => crate::config_single_value::Ref::Uint8(unsafe {
3628 self.raw.get().deref_unchecked::<u8>()
3629 }),
3630
3631 3 => crate::config_single_value::Ref::Uint16(unsafe {
3632 self.raw.get().deref_unchecked::<::fidl_next::WireU16>()
3633 }),
3634
3635 4 => crate::config_single_value::Ref::Uint32(unsafe {
3636 self.raw.get().deref_unchecked::<::fidl_next::WireU32>()
3637 }),
3638
3639 5 => crate::config_single_value::Ref::Uint64(unsafe {
3640 self.raw.get().deref_unchecked::<::fidl_next::WireU64>()
3641 }),
3642
3643 6 => crate::config_single_value::Ref::Int8(unsafe {
3644 self.raw.get().deref_unchecked::<i8>()
3645 }),
3646
3647 7 => crate::config_single_value::Ref::Int16(unsafe {
3648 self.raw.get().deref_unchecked::<::fidl_next::WireI16>()
3649 }),
3650
3651 8 => crate::config_single_value::Ref::Int32(unsafe {
3652 self.raw.get().deref_unchecked::<::fidl_next::WireI32>()
3653 }),
3654
3655 9 => crate::config_single_value::Ref::Int64(unsafe {
3656 self.raw.get().deref_unchecked::<::fidl_next::WireI64>()
3657 }),
3658
3659 10 => crate::config_single_value::Ref::String(unsafe {
3660 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
3661 }),
3662
3663 unknown => crate::config_single_value::Ref::UnknownOrdinal_(unknown),
3664 }
3665 }
3666}
3667
3668unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigSingleValue<'static>
3669where
3670 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3671
3672 ___D: ::fidl_next::Decoder,
3673{
3674 fn decode(
3675 mut slot: ::fidl_next::Slot<'_, Self>,
3676 decoder: &mut ___D,
3677 ) -> Result<(), ::fidl_next::DecodeError> {
3678 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
3679 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
3680 1 => ::fidl_next::RawWireUnion::decode_as::<___D, bool>(raw, decoder)?,
3681
3682 2 => ::fidl_next::RawWireUnion::decode_as::<___D, u8>(raw, decoder)?,
3683
3684 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU16>(raw, decoder)?,
3685
3686 4 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(raw, decoder)?,
3687
3688 5 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU64>(raw, decoder)?,
3689
3690 6 => ::fidl_next::RawWireUnion::decode_as::<___D, i8>(raw, decoder)?,
3691
3692 7 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI16>(raw, decoder)?,
3693
3694 8 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?,
3695
3696 9 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI64>(raw, decoder)?,
3697
3698 10 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
3699 raw, decoder,
3700 )?,
3701
3702 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
3703 }
3704
3705 Ok(())
3706 }
3707}
3708
3709impl<'de> ::core::fmt::Debug for WireConfigSingleValue<'de> {
3710 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3711 match self.raw.ordinal() {
3712 1 => unsafe { self.raw.get().deref_unchecked::<bool>().fmt(f) },
3713 2 => unsafe { self.raw.get().deref_unchecked::<u8>().fmt(f) },
3714 3 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU16>().fmt(f) },
3715 4 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) },
3716 5 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU64>().fmt(f) },
3717 6 => unsafe { self.raw.get().deref_unchecked::<i8>().fmt(f) },
3718 7 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI16>().fmt(f) },
3719 8 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI32>().fmt(f) },
3720 9 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI64>().fmt(f) },
3721 10 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) },
3722 _ => unsafe { ::core::hint::unreachable_unchecked() },
3723 }
3724 }
3725}
3726
3727#[repr(transparent)]
3728pub struct WireOptionalConfigSingleValue<'de> {
3729 raw: ::fidl_next::RawWireUnion,
3730 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
3731}
3732
3733unsafe impl ::fidl_next::Wire for WireOptionalConfigSingleValue<'static> {
3734 type Decoded<'de> = WireOptionalConfigSingleValue<'de>;
3735
3736 #[inline]
3737 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3738 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
3739 ::fidl_next::RawWireUnion::zero_padding(raw);
3740 }
3741}
3742
3743impl<'de> WireOptionalConfigSingleValue<'de> {
3744 pub fn is_some(&self) -> bool {
3745 self.raw.is_some()
3746 }
3747
3748 pub fn is_none(&self) -> bool {
3749 self.raw.is_none()
3750 }
3751
3752 pub fn as_ref(&self) -> Option<&WireConfigSingleValue<'de>> {
3753 if self.is_some() {
3754 Some(unsafe { &*(self as *const Self).cast() })
3755 } else {
3756 None
3757 }
3758 }
3759
3760 pub fn into_option(self) -> Option<WireConfigSingleValue<'de>> {
3761 if self.is_some() {
3762 Some(WireConfigSingleValue { raw: self.raw, _phantom: ::core::marker::PhantomData })
3763 } else {
3764 None
3765 }
3766 }
3767}
3768
3769unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigSingleValue<'static>
3770where
3771 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3772
3773 ___D: ::fidl_next::Decoder,
3774{
3775 fn decode(
3776 mut slot: ::fidl_next::Slot<'_, Self>,
3777 decoder: &mut ___D,
3778 ) -> Result<(), ::fidl_next::DecodeError> {
3779 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
3780 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
3781 1 => ::fidl_next::RawWireUnion::decode_as::<___D, bool>(raw, decoder)?,
3782
3783 2 => ::fidl_next::RawWireUnion::decode_as::<___D, u8>(raw, decoder)?,
3784
3785 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU16>(raw, decoder)?,
3786
3787 4 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(raw, decoder)?,
3788
3789 5 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU64>(raw, decoder)?,
3790
3791 6 => ::fidl_next::RawWireUnion::decode_as::<___D, i8>(raw, decoder)?,
3792
3793 7 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI16>(raw, decoder)?,
3794
3795 8 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?,
3796
3797 9 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI64>(raw, decoder)?,
3798
3799 10 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
3800 raw, decoder,
3801 )?,
3802
3803 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
3804 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
3805 }
3806
3807 Ok(())
3808 }
3809}
3810
3811impl<'de> ::core::fmt::Debug for WireOptionalConfigSingleValue<'de> {
3812 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3813 self.as_ref().fmt(f)
3814 }
3815}
3816
3817#[doc = " A vector configuration value.\n"]
3818#[derive(Clone, Debug)]
3819pub enum ConfigVectorValue {
3820 BoolVector(Vec<bool>),
3821
3822 Uint8Vector(Vec<u8>),
3823
3824 Uint16Vector(Vec<u16>),
3825
3826 Uint32Vector(Vec<u32>),
3827
3828 Uint64Vector(Vec<u64>),
3829
3830 Int8Vector(Vec<i8>),
3831
3832 Int16Vector(Vec<i16>),
3833
3834 Int32Vector(Vec<i32>),
3835
3836 Int64Vector(Vec<i64>),
3837
3838 StringVector(Vec<String>),
3839
3840 UnknownOrdinal_(u64),
3841}
3842
3843impl ::fidl_next::Encodable for ConfigVectorValue {
3844 type Encoded = WireConfigVectorValue<'static>;
3845}
3846
3847unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigVectorValue
3848where
3849 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3850
3851 ___E: ::fidl_next::Encoder,
3852{
3853 #[inline]
3854 fn encode(
3855 self,
3856 encoder: &mut ___E,
3857 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3858 ) -> Result<(), ::fidl_next::EncodeError> {
3859 ::fidl_next::munge!(let WireConfigVectorValue { raw, _phantom: _ } = out);
3860
3861 match self {
3862 Self::BoolVector(value) => {
3863 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<bool>>(value, 1, encoder, raw)?
3864 }
3865
3866 Self::Uint8Vector(value) => {
3867 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u8>>(value, 2, encoder, raw)?
3868 }
3869
3870 Self::Uint16Vector(value) => {
3871 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u16>>(value, 3, encoder, raw)?
3872 }
3873
3874 Self::Uint32Vector(value) => {
3875 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u32>>(value, 4, encoder, raw)?
3876 }
3877
3878 Self::Uint64Vector(value) => {
3879 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u64>>(value, 5, encoder, raw)?
3880 }
3881
3882 Self::Int8Vector(value) => {
3883 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<i8>>(value, 6, encoder, raw)?
3884 }
3885
3886 Self::Int16Vector(value) => {
3887 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<i16>>(value, 7, encoder, raw)?
3888 }
3889
3890 Self::Int32Vector(value) => {
3891 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<i32>>(value, 8, encoder, raw)?
3892 }
3893
3894 Self::Int64Vector(value) => {
3895 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<i64>>(value, 9, encoder, raw)?
3896 }
3897
3898 Self::StringVector(value) => {
3899 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<String>>(value, 10, encoder, raw)?
3900 }
3901
3902 Self::UnknownOrdinal_(ordinal) => {
3903 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
3904 }
3905 }
3906
3907 Ok(())
3908 }
3909}
3910
3911unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigVectorValue
3912where
3913 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3914
3915 ___E: ::fidl_next::Encoder,
3916{
3917 #[inline]
3918 fn encode_ref(
3919 &self,
3920 encoder: &mut ___E,
3921 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3922 ) -> Result<(), ::fidl_next::EncodeError> {
3923 ::fidl_next::munge!(let WireConfigVectorValue { raw, _phantom: _ } = out);
3924
3925 match self {
3926 Self::BoolVector(value) => {
3927 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<bool>>(value, 1, encoder, raw)?
3928 }
3929
3930 Self::Uint8Vector(value) => {
3931 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u8>>(value, 2, encoder, raw)?
3932 }
3933
3934 Self::Uint16Vector(value) => {
3935 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u16>>(value, 3, encoder, raw)?
3936 }
3937
3938 Self::Uint32Vector(value) => {
3939 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u32>>(value, 4, encoder, raw)?
3940 }
3941
3942 Self::Uint64Vector(value) => {
3943 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u64>>(value, 5, encoder, raw)?
3944 }
3945
3946 Self::Int8Vector(value) => {
3947 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<i8>>(value, 6, encoder, raw)?
3948 }
3949
3950 Self::Int16Vector(value) => {
3951 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<i16>>(value, 7, encoder, raw)?
3952 }
3953
3954 Self::Int32Vector(value) => {
3955 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<i32>>(value, 8, encoder, raw)?
3956 }
3957
3958 Self::Int64Vector(value) => {
3959 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<i64>>(value, 9, encoder, raw)?
3960 }
3961
3962 Self::StringVector(value) => {
3963 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<String>>(value, 10, encoder, raw)?
3964 }
3965
3966 Self::UnknownOrdinal_(ordinal) => {
3967 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
3968 }
3969 }
3970
3971 Ok(())
3972 }
3973}
3974
3975impl ::fidl_next::EncodableOption for ConfigVectorValue {
3976 type EncodedOption = WireOptionalConfigVectorValue<'static>;
3977}
3978
3979unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ConfigVectorValue
3980where
3981 ___E: ?Sized,
3982 ConfigVectorValue: ::fidl_next::Encode<___E>,
3983{
3984 #[inline]
3985 fn encode_option(
3986 this: Option<Self>,
3987 encoder: &mut ___E,
3988 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
3989 ) -> Result<(), ::fidl_next::EncodeError> {
3990 ::fidl_next::munge!(let WireOptionalConfigVectorValue { raw, _phantom: _ } = &mut *out);
3991
3992 if let Some(inner) = this {
3993 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
3994 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
3995 } else {
3996 ::fidl_next::RawWireUnion::encode_absent(raw);
3997 }
3998
3999 Ok(())
4000 }
4001}
4002
4003unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ConfigVectorValue
4004where
4005 ___E: ?Sized,
4006 ConfigVectorValue: ::fidl_next::EncodeRef<___E>,
4007{
4008 #[inline]
4009 fn encode_option_ref(
4010 this: Option<&Self>,
4011 encoder: &mut ___E,
4012 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4013 ) -> Result<(), ::fidl_next::EncodeError> {
4014 ::fidl_next::munge!(let WireOptionalConfigVectorValue { raw, _phantom: _ } = &mut *out);
4015
4016 if let Some(inner) = this {
4017 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
4018 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
4019 } else {
4020 ::fidl_next::RawWireUnion::encode_absent(raw);
4021 }
4022
4023 Ok(())
4024 }
4025}
4026
4027impl<'de> ::fidl_next::FromWire<WireConfigVectorValue<'de>> for ConfigVectorValue {
4028 #[inline]
4029 fn from_wire(wire: WireConfigVectorValue<'de>) -> Self {
4030 let wire = ::core::mem::ManuallyDrop::new(wire);
4031 match wire.raw.ordinal() {
4032 1 => Self::BoolVector(::fidl_next::FromWire::from_wire(unsafe {
4033 wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, bool>>()
4034 })),
4035
4036 2 => Self::Uint8Vector(::fidl_next::FromWire::from_wire(unsafe {
4037 wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>()
4038 })),
4039
4040 3 => Self::Uint16Vector(::fidl_next::FromWire::from_wire(unsafe {
4041 wire.raw
4042 .get()
4043 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU16>>()
4044 })),
4045
4046 4 => Self::Uint32Vector(::fidl_next::FromWire::from_wire(unsafe {
4047 wire.raw
4048 .get()
4049 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU32>>()
4050 })),
4051
4052 5 => Self::Uint64Vector(::fidl_next::FromWire::from_wire(unsafe {
4053 wire.raw
4054 .get()
4055 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU64>>()
4056 })),
4057
4058 6 => Self::Int8Vector(::fidl_next::FromWire::from_wire(unsafe {
4059 wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, i8>>()
4060 })),
4061
4062 7 => Self::Int16Vector(::fidl_next::FromWire::from_wire(unsafe {
4063 wire.raw
4064 .get()
4065 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI16>>()
4066 })),
4067
4068 8 => Self::Int32Vector(::fidl_next::FromWire::from_wire(unsafe {
4069 wire.raw
4070 .get()
4071 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI32>>()
4072 })),
4073
4074 9 => Self::Int64Vector(::fidl_next::FromWire::from_wire(unsafe {
4075 wire.raw
4076 .get()
4077 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI64>>()
4078 })),
4079
4080 10 => {
4081 Self::StringVector(::fidl_next::FromWire::from_wire(unsafe {
4082 wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
4083 }))
4084 }
4085
4086 _ => unsafe { ::core::hint::unreachable_unchecked() },
4087 }
4088 }
4089}
4090
4091impl<'de> ::fidl_next::FromWireRef<WireConfigVectorValue<'de>> for ConfigVectorValue {
4092 #[inline]
4093 fn from_wire_ref(wire: &WireConfigVectorValue<'de>) -> Self {
4094 match wire.raw.ordinal() {
4095 1 => Self::BoolVector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4096 wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, bool>>()
4097 })),
4098
4099 2 => Self::Uint8Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4100 wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, u8>>()
4101 })),
4102
4103 3 => Self::Uint16Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4104 wire.raw
4105 .get()
4106 .deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU16>>()
4107 })),
4108
4109 4 => Self::Uint32Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4110 wire.raw
4111 .get()
4112 .deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU32>>()
4113 })),
4114
4115 5 => Self::Uint64Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4116 wire.raw
4117 .get()
4118 .deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU64>>()
4119 })),
4120
4121 6 => Self::Int8Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4122 wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, i8>>()
4123 })),
4124
4125 7 => Self::Int16Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4126 wire.raw
4127 .get()
4128 .deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI16>>()
4129 })),
4130
4131 8 => Self::Int32Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4132 wire.raw
4133 .get()
4134 .deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI32>>()
4135 })),
4136
4137 9 => Self::Int64Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4138 wire.raw
4139 .get()
4140 .deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI64>>()
4141 })),
4142
4143 10 => {
4144 Self::StringVector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4145 wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
4146 }))
4147 }
4148
4149 _ => unsafe { ::core::hint::unreachable_unchecked() },
4150 }
4151 }
4152}
4153
4154impl<'de> ::fidl_next::FromWireOption<WireOptionalConfigVectorValue<'de>>
4155 for Box<ConfigVectorValue>
4156{
4157 #[inline]
4158 fn from_wire_option(wire: WireOptionalConfigVectorValue<'de>) -> Option<Self> {
4159 if let Some(inner) = wire.into_option() {
4160 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
4161 } else {
4162 None
4163 }
4164 }
4165}
4166
4167impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalConfigVectorValue<'de>>
4168 for Box<ConfigVectorValue>
4169{
4170 #[inline]
4171 fn from_wire_option_ref(wire: &WireOptionalConfigVectorValue<'de>) -> Option<Self> {
4172 if let Some(inner) = wire.as_ref() {
4173 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
4174 } else {
4175 None
4176 }
4177 }
4178}
4179
4180#[repr(transparent)]
4182pub struct WireConfigVectorValue<'de> {
4183 raw: ::fidl_next::RawWireUnion,
4184 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
4185}
4186
4187impl<'de> Drop for WireConfigVectorValue<'de> {
4188 fn drop(&mut self) {
4189 match self.raw.ordinal() {
4190 1 => {
4191 let _ = unsafe {
4192 self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, bool>>()
4193 };
4194 }
4195
4196 2 => {
4197 let _ =
4198 unsafe { self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>() };
4199 }
4200
4201 3 => {
4202 let _ = unsafe {
4203 self.raw
4204 .get()
4205 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU16>>()
4206 };
4207 }
4208
4209 4 => {
4210 let _ = unsafe {
4211 self.raw
4212 .get()
4213 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU32>>()
4214 };
4215 }
4216
4217 5 => {
4218 let _ = unsafe {
4219 self.raw
4220 .get()
4221 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireU64>>()
4222 };
4223 }
4224
4225 6 => {
4226 let _ =
4227 unsafe { self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, i8>>() };
4228 }
4229
4230 7 => {
4231 let _ = unsafe {
4232 self.raw
4233 .get()
4234 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI16>>()
4235 };
4236 }
4237
4238 8 => {
4239 let _ = unsafe {
4240 self.raw
4241 .get()
4242 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI32>>()
4243 };
4244 }
4245
4246 9 => {
4247 let _ = unsafe {
4248 self.raw
4249 .get()
4250 .read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireI64>>()
4251 };
4252 }
4253
4254 10 => {
4255 let _ = unsafe {
4256 self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
4257 };
4258 }
4259
4260 _ => (),
4261 }
4262 }
4263}
4264
4265unsafe impl ::fidl_next::Wire for WireConfigVectorValue<'static> {
4266 type Decoded<'de> = WireConfigVectorValue<'de>;
4267
4268 #[inline]
4269 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4270 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
4271 ::fidl_next::RawWireUnion::zero_padding(raw);
4272 }
4273}
4274
4275pub mod config_vector_value {
4276 pub enum Ref<'de> {
4277 BoolVector(&'de ::fidl_next::WireVector<'de, bool>),
4278
4279 Uint8Vector(&'de ::fidl_next::WireVector<'de, u8>),
4280
4281 Uint16Vector(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireU16>),
4282
4283 Uint32Vector(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireU32>),
4284
4285 Uint64Vector(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireU64>),
4286
4287 Int8Vector(&'de ::fidl_next::WireVector<'de, i8>),
4288
4289 Int16Vector(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireI16>),
4290
4291 Int32Vector(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireI32>),
4292
4293 Int64Vector(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireI64>),
4294
4295 StringVector(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>),
4296
4297 UnknownOrdinal_(u64),
4298 }
4299}
4300
4301impl<'de> WireConfigVectorValue<'de> {
4302 pub fn as_ref(&self) -> crate::config_vector_value::Ref<'_> {
4303 match self.raw.ordinal() {
4304 1 => crate::config_vector_value::Ref::BoolVector(unsafe {
4305 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, bool>>()
4306 }),
4307
4308 2 => crate::config_vector_value::Ref::Uint8Vector(unsafe {
4309 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>()
4310 }),
4311
4312 3 => crate::config_vector_value::Ref::Uint16Vector(unsafe {
4313 self.raw
4314 .get()
4315 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireU16>>()
4316 }),
4317
4318 4 => crate::config_vector_value::Ref::Uint32Vector(unsafe {
4319 self.raw
4320 .get()
4321 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireU32>>()
4322 }),
4323
4324 5 => crate::config_vector_value::Ref::Uint64Vector(unsafe {
4325 self.raw
4326 .get()
4327 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireU64>>()
4328 }),
4329
4330 6 => crate::config_vector_value::Ref::Int8Vector(unsafe {
4331 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, i8>>()
4332 }),
4333
4334 7 => crate::config_vector_value::Ref::Int16Vector(unsafe {
4335 self.raw
4336 .get()
4337 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireI16>>()
4338 }),
4339
4340 8 => crate::config_vector_value::Ref::Int32Vector(unsafe {
4341 self.raw
4342 .get()
4343 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireI32>>()
4344 }),
4345
4346 9 => crate::config_vector_value::Ref::Int64Vector(unsafe {
4347 self.raw
4348 .get()
4349 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireI64>>()
4350 }),
4351
4352 10 => {
4353 crate::config_vector_value::Ref::StringVector(unsafe {
4354 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>()
4355 })
4356 }
4357
4358 unknown => crate::config_vector_value::Ref::UnknownOrdinal_(unknown),
4359 }
4360 }
4361}
4362
4363unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigVectorValue<'static>
4364where
4365 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4366
4367 ___D: ::fidl_next::Decoder,
4368{
4369 fn decode(
4370 mut slot: ::fidl_next::Slot<'_, Self>,
4371 decoder: &mut ___D,
4372 ) -> Result<(), ::fidl_next::DecodeError> {
4373 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
4374 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
4375 1 => ::fidl_next::RawWireUnion::decode_as::<
4376 ___D,
4377 ::fidl_next::WireVector<'static, bool>,
4378 >(raw, decoder)?,
4379
4380 2 => {
4381 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<'static, u8>>(
4382 raw, decoder,
4383 )?
4384 }
4385
4386 3 => ::fidl_next::RawWireUnion::decode_as::<
4387 ___D,
4388 ::fidl_next::WireVector<'static, ::fidl_next::WireU16>,
4389 >(raw, decoder)?,
4390
4391 4 => ::fidl_next::RawWireUnion::decode_as::<
4392 ___D,
4393 ::fidl_next::WireVector<'static, ::fidl_next::WireU32>,
4394 >(raw, decoder)?,
4395
4396 5 => ::fidl_next::RawWireUnion::decode_as::<
4397 ___D,
4398 ::fidl_next::WireVector<'static, ::fidl_next::WireU64>,
4399 >(raw, decoder)?,
4400
4401 6 => {
4402 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<'static, i8>>(
4403 raw, decoder,
4404 )?
4405 }
4406
4407 7 => ::fidl_next::RawWireUnion::decode_as::<
4408 ___D,
4409 ::fidl_next::WireVector<'static, ::fidl_next::WireI16>,
4410 >(raw, decoder)?,
4411
4412 8 => ::fidl_next::RawWireUnion::decode_as::<
4413 ___D,
4414 ::fidl_next::WireVector<'static, ::fidl_next::WireI32>,
4415 >(raw, decoder)?,
4416
4417 9 => ::fidl_next::RawWireUnion::decode_as::<
4418 ___D,
4419 ::fidl_next::WireVector<'static, ::fidl_next::WireI64>,
4420 >(raw, decoder)?,
4421
4422 10 => ::fidl_next::RawWireUnion::decode_as::<
4423 ___D,
4424 ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
4425 >(raw, decoder)?,
4426
4427 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
4428 }
4429
4430 Ok(())
4431 }
4432}
4433
4434impl<'de> ::core::fmt::Debug for WireConfigVectorValue<'de> {
4435 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4436 match self.raw.ordinal() {
4437 1 => unsafe {
4438 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, bool>>().fmt(f)
4439 },
4440 2 => unsafe {
4441 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>().fmt(f)
4442 },
4443 3 => unsafe {
4444 self.raw
4445 .get()
4446 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireU16>>()
4447 .fmt(f)
4448 },
4449 4 => unsafe {
4450 self.raw
4451 .get()
4452 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireU32>>()
4453 .fmt(f)
4454 },
4455 5 => unsafe {
4456 self.raw
4457 .get()
4458 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireU64>>()
4459 .fmt(f)
4460 },
4461 6 => unsafe {
4462 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, i8>>().fmt(f)
4463 },
4464 7 => unsafe {
4465 self.raw
4466 .get()
4467 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireI16>>()
4468 .fmt(f)
4469 },
4470 8 => unsafe {
4471 self.raw
4472 .get()
4473 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireI32>>()
4474 .fmt(f)
4475 },
4476 9 => unsafe {
4477 self.raw
4478 .get()
4479 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireI64>>()
4480 .fmt(f)
4481 },
4482 10 => unsafe {
4483 self.raw
4484 .get()
4485 .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>()
4486 .fmt(f)
4487 },
4488 _ => unsafe { ::core::hint::unreachable_unchecked() },
4489 }
4490 }
4491}
4492
4493#[repr(transparent)]
4494pub struct WireOptionalConfigVectorValue<'de> {
4495 raw: ::fidl_next::RawWireUnion,
4496 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
4497}
4498
4499unsafe impl ::fidl_next::Wire for WireOptionalConfigVectorValue<'static> {
4500 type Decoded<'de> = WireOptionalConfigVectorValue<'de>;
4501
4502 #[inline]
4503 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4504 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
4505 ::fidl_next::RawWireUnion::zero_padding(raw);
4506 }
4507}
4508
4509impl<'de> WireOptionalConfigVectorValue<'de> {
4510 pub fn is_some(&self) -> bool {
4511 self.raw.is_some()
4512 }
4513
4514 pub fn is_none(&self) -> bool {
4515 self.raw.is_none()
4516 }
4517
4518 pub fn as_ref(&self) -> Option<&WireConfigVectorValue<'de>> {
4519 if self.is_some() {
4520 Some(unsafe { &*(self as *const Self).cast() })
4521 } else {
4522 None
4523 }
4524 }
4525
4526 pub fn into_option(self) -> Option<WireConfigVectorValue<'de>> {
4527 if self.is_some() {
4528 Some(WireConfigVectorValue { raw: self.raw, _phantom: ::core::marker::PhantomData })
4529 } else {
4530 None
4531 }
4532 }
4533}
4534
4535unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigVectorValue<'static>
4536where
4537 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4538
4539 ___D: ::fidl_next::Decoder,
4540{
4541 fn decode(
4542 mut slot: ::fidl_next::Slot<'_, Self>,
4543 decoder: &mut ___D,
4544 ) -> Result<(), ::fidl_next::DecodeError> {
4545 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
4546 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
4547 1 => ::fidl_next::RawWireUnion::decode_as::<
4548 ___D,
4549 ::fidl_next::WireVector<'static, bool>,
4550 >(raw, decoder)?,
4551
4552 2 => {
4553 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<'static, u8>>(
4554 raw, decoder,
4555 )?
4556 }
4557
4558 3 => ::fidl_next::RawWireUnion::decode_as::<
4559 ___D,
4560 ::fidl_next::WireVector<'static, ::fidl_next::WireU16>,
4561 >(raw, decoder)?,
4562
4563 4 => ::fidl_next::RawWireUnion::decode_as::<
4564 ___D,
4565 ::fidl_next::WireVector<'static, ::fidl_next::WireU32>,
4566 >(raw, decoder)?,
4567
4568 5 => ::fidl_next::RawWireUnion::decode_as::<
4569 ___D,
4570 ::fidl_next::WireVector<'static, ::fidl_next::WireU64>,
4571 >(raw, decoder)?,
4572
4573 6 => {
4574 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<'static, i8>>(
4575 raw, decoder,
4576 )?
4577 }
4578
4579 7 => ::fidl_next::RawWireUnion::decode_as::<
4580 ___D,
4581 ::fidl_next::WireVector<'static, ::fidl_next::WireI16>,
4582 >(raw, decoder)?,
4583
4584 8 => ::fidl_next::RawWireUnion::decode_as::<
4585 ___D,
4586 ::fidl_next::WireVector<'static, ::fidl_next::WireI32>,
4587 >(raw, decoder)?,
4588
4589 9 => ::fidl_next::RawWireUnion::decode_as::<
4590 ___D,
4591 ::fidl_next::WireVector<'static, ::fidl_next::WireI64>,
4592 >(raw, decoder)?,
4593
4594 10 => ::fidl_next::RawWireUnion::decode_as::<
4595 ___D,
4596 ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
4597 >(raw, decoder)?,
4598
4599 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
4600 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
4601 }
4602
4603 Ok(())
4604 }
4605}
4606
4607impl<'de> ::core::fmt::Debug for WireOptionalConfigVectorValue<'de> {
4608 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4609 self.as_ref().fmt(f)
4610 }
4611}
4612
4613#[doc = " A configuration value which can be provided to a component.\n\n Used both for storing configuration at-rest and in runtime configuration APIs.\n"]
4614#[derive(Clone, Debug)]
4615pub enum ConfigValue {
4616 Single(crate::ConfigSingleValue),
4617
4618 Vector(crate::ConfigVectorValue),
4619
4620 UnknownOrdinal_(u64),
4621}
4622
4623impl ::fidl_next::Encodable for ConfigValue {
4624 type Encoded = WireConfigValue<'static>;
4625}
4626
4627unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigValue
4628where
4629 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4630
4631 ___E: ::fidl_next::Encoder,
4632{
4633 #[inline]
4634 fn encode(
4635 self,
4636 encoder: &mut ___E,
4637 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4638 ) -> Result<(), ::fidl_next::EncodeError> {
4639 ::fidl_next::munge!(let WireConfigValue { raw, _phantom: _ } = out);
4640
4641 match self {
4642 Self::Single(value) => ::fidl_next::RawWireUnion::encode_as::<
4643 ___E,
4644 crate::ConfigSingleValue,
4645 >(value, 1, encoder, raw)?,
4646
4647 Self::Vector(value) => ::fidl_next::RawWireUnion::encode_as::<
4648 ___E,
4649 crate::ConfigVectorValue,
4650 >(value, 2, encoder, raw)?,
4651
4652 Self::UnknownOrdinal_(ordinal) => {
4653 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
4654 }
4655 }
4656
4657 Ok(())
4658 }
4659}
4660
4661unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigValue
4662where
4663 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4664
4665 ___E: ::fidl_next::Encoder,
4666{
4667 #[inline]
4668 fn encode_ref(
4669 &self,
4670 encoder: &mut ___E,
4671 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4672 ) -> Result<(), ::fidl_next::EncodeError> {
4673 ::fidl_next::munge!(let WireConfigValue { raw, _phantom: _ } = out);
4674
4675 match self {
4676 Self::Single(value) => ::fidl_next::RawWireUnion::encode_as::<
4677 ___E,
4678 &crate::ConfigSingleValue,
4679 >(value, 1, encoder, raw)?,
4680
4681 Self::Vector(value) => ::fidl_next::RawWireUnion::encode_as::<
4682 ___E,
4683 &crate::ConfigVectorValue,
4684 >(value, 2, encoder, raw)?,
4685
4686 Self::UnknownOrdinal_(ordinal) => {
4687 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
4688 }
4689 }
4690
4691 Ok(())
4692 }
4693}
4694
4695impl ::fidl_next::EncodableOption for ConfigValue {
4696 type EncodedOption = WireOptionalConfigValue<'static>;
4697}
4698
4699unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ConfigValue
4700where
4701 ___E: ?Sized,
4702 ConfigValue: ::fidl_next::Encode<___E>,
4703{
4704 #[inline]
4705 fn encode_option(
4706 this: Option<Self>,
4707 encoder: &mut ___E,
4708 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4709 ) -> Result<(), ::fidl_next::EncodeError> {
4710 ::fidl_next::munge!(let WireOptionalConfigValue { raw, _phantom: _ } = &mut *out);
4711
4712 if let Some(inner) = this {
4713 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
4714 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
4715 } else {
4716 ::fidl_next::RawWireUnion::encode_absent(raw);
4717 }
4718
4719 Ok(())
4720 }
4721}
4722
4723unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ConfigValue
4724where
4725 ___E: ?Sized,
4726 ConfigValue: ::fidl_next::EncodeRef<___E>,
4727{
4728 #[inline]
4729 fn encode_option_ref(
4730 this: Option<&Self>,
4731 encoder: &mut ___E,
4732 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4733 ) -> Result<(), ::fidl_next::EncodeError> {
4734 ::fidl_next::munge!(let WireOptionalConfigValue { raw, _phantom: _ } = &mut *out);
4735
4736 if let Some(inner) = this {
4737 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
4738 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
4739 } else {
4740 ::fidl_next::RawWireUnion::encode_absent(raw);
4741 }
4742
4743 Ok(())
4744 }
4745}
4746
4747impl<'de> ::fidl_next::FromWire<WireConfigValue<'de>> for ConfigValue {
4748 #[inline]
4749 fn from_wire(wire: WireConfigValue<'de>) -> Self {
4750 let wire = ::core::mem::ManuallyDrop::new(wire);
4751 match wire.raw.ordinal() {
4752 1 => Self::Single(::fidl_next::FromWire::from_wire(unsafe {
4753 wire.raw.get().read_unchecked::<crate::WireConfigSingleValue<'de>>()
4754 })),
4755
4756 2 => Self::Vector(::fidl_next::FromWire::from_wire(unsafe {
4757 wire.raw.get().read_unchecked::<crate::WireConfigVectorValue<'de>>()
4758 })),
4759
4760 _ => unsafe { ::core::hint::unreachable_unchecked() },
4761 }
4762 }
4763}
4764
4765impl<'de> ::fidl_next::FromWireRef<WireConfigValue<'de>> for ConfigValue {
4766 #[inline]
4767 fn from_wire_ref(wire: &WireConfigValue<'de>) -> Self {
4768 match wire.raw.ordinal() {
4769 1 => Self::Single(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4770 wire.raw.get().deref_unchecked::<crate::WireConfigSingleValue<'de>>()
4771 })),
4772
4773 2 => Self::Vector(::fidl_next::FromWireRef::from_wire_ref(unsafe {
4774 wire.raw.get().deref_unchecked::<crate::WireConfigVectorValue<'de>>()
4775 })),
4776
4777 _ => unsafe { ::core::hint::unreachable_unchecked() },
4778 }
4779 }
4780}
4781
4782impl<'de> ::fidl_next::FromWireOption<WireOptionalConfigValue<'de>> for Box<ConfigValue> {
4783 #[inline]
4784 fn from_wire_option(wire: WireOptionalConfigValue<'de>) -> Option<Self> {
4785 if let Some(inner) = wire.into_option() {
4786 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
4787 } else {
4788 None
4789 }
4790 }
4791}
4792
4793impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalConfigValue<'de>> for Box<ConfigValue> {
4794 #[inline]
4795 fn from_wire_option_ref(wire: &WireOptionalConfigValue<'de>) -> Option<Self> {
4796 if let Some(inner) = wire.as_ref() {
4797 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
4798 } else {
4799 None
4800 }
4801 }
4802}
4803
4804#[repr(transparent)]
4806pub struct WireConfigValue<'de> {
4807 raw: ::fidl_next::RawWireUnion,
4808 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
4809}
4810
4811impl<'de> Drop for WireConfigValue<'de> {
4812 fn drop(&mut self) {
4813 match self.raw.ordinal() {
4814 1 => {
4815 let _ =
4816 unsafe { self.raw.get().read_unchecked::<crate::WireConfigSingleValue<'de>>() };
4817 }
4818
4819 2 => {
4820 let _ =
4821 unsafe { self.raw.get().read_unchecked::<crate::WireConfigVectorValue<'de>>() };
4822 }
4823
4824 _ => (),
4825 }
4826 }
4827}
4828
4829unsafe impl ::fidl_next::Wire for WireConfigValue<'static> {
4830 type Decoded<'de> = WireConfigValue<'de>;
4831
4832 #[inline]
4833 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4834 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
4835 ::fidl_next::RawWireUnion::zero_padding(raw);
4836 }
4837}
4838
4839pub mod config_value {
4840 pub enum Ref<'de> {
4841 Single(&'de crate::WireConfigSingleValue<'de>),
4842
4843 Vector(&'de crate::WireConfigVectorValue<'de>),
4844
4845 UnknownOrdinal_(u64),
4846 }
4847}
4848
4849impl<'de> WireConfigValue<'de> {
4850 pub fn as_ref(&self) -> crate::config_value::Ref<'_> {
4851 match self.raw.ordinal() {
4852 1 => crate::config_value::Ref::Single(unsafe {
4853 self.raw.get().deref_unchecked::<crate::WireConfigSingleValue<'_>>()
4854 }),
4855
4856 2 => crate::config_value::Ref::Vector(unsafe {
4857 self.raw.get().deref_unchecked::<crate::WireConfigVectorValue<'_>>()
4858 }),
4859
4860 unknown => crate::config_value::Ref::UnknownOrdinal_(unknown),
4861 }
4862 }
4863}
4864
4865unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigValue<'static>
4866where
4867 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4868
4869 ___D: ::fidl_next::Decoder,
4870{
4871 fn decode(
4872 mut slot: ::fidl_next::Slot<'_, Self>,
4873 decoder: &mut ___D,
4874 ) -> Result<(), ::fidl_next::DecodeError> {
4875 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
4876 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
4877 1 => {
4878 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigSingleValue<'static>>(
4879 raw, decoder,
4880 )?
4881 }
4882
4883 2 => {
4884 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigVectorValue<'static>>(
4885 raw, decoder,
4886 )?
4887 }
4888
4889 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
4890 }
4891
4892 Ok(())
4893 }
4894}
4895
4896impl<'de> ::core::fmt::Debug for WireConfigValue<'de> {
4897 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4898 match self.raw.ordinal() {
4899 1 => unsafe {
4900 self.raw.get().deref_unchecked::<crate::WireConfigSingleValue<'_>>().fmt(f)
4901 },
4902 2 => unsafe {
4903 self.raw.get().deref_unchecked::<crate::WireConfigVectorValue<'_>>().fmt(f)
4904 },
4905 _ => unsafe { ::core::hint::unreachable_unchecked() },
4906 }
4907 }
4908}
4909
4910#[repr(transparent)]
4911pub struct WireOptionalConfigValue<'de> {
4912 raw: ::fidl_next::RawWireUnion,
4913 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
4914}
4915
4916unsafe impl ::fidl_next::Wire for WireOptionalConfigValue<'static> {
4917 type Decoded<'de> = WireOptionalConfigValue<'de>;
4918
4919 #[inline]
4920 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4921 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
4922 ::fidl_next::RawWireUnion::zero_padding(raw);
4923 }
4924}
4925
4926impl<'de> WireOptionalConfigValue<'de> {
4927 pub fn is_some(&self) -> bool {
4928 self.raw.is_some()
4929 }
4930
4931 pub fn is_none(&self) -> bool {
4932 self.raw.is_none()
4933 }
4934
4935 pub fn as_ref(&self) -> Option<&WireConfigValue<'de>> {
4936 if self.is_some() {
4937 Some(unsafe { &*(self as *const Self).cast() })
4938 } else {
4939 None
4940 }
4941 }
4942
4943 pub fn into_option(self) -> Option<WireConfigValue<'de>> {
4944 if self.is_some() {
4945 Some(WireConfigValue { raw: self.raw, _phantom: ::core::marker::PhantomData })
4946 } else {
4947 None
4948 }
4949 }
4950}
4951
4952unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigValue<'static>
4953where
4954 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4955
4956 ___D: ::fidl_next::Decoder,
4957{
4958 fn decode(
4959 mut slot: ::fidl_next::Slot<'_, Self>,
4960 decoder: &mut ___D,
4961 ) -> Result<(), ::fidl_next::DecodeError> {
4962 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
4963 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
4964 1 => {
4965 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigSingleValue<'static>>(
4966 raw, decoder,
4967 )?
4968 }
4969
4970 2 => {
4971 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigVectorValue<'static>>(
4972 raw, decoder,
4973 )?
4974 }
4975
4976 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
4977 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
4978 }
4979
4980 Ok(())
4981 }
4982}
4983
4984impl<'de> ::core::fmt::Debug for WireOptionalConfigValue<'de> {
4985 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4986 self.as_ref().fmt(f)
4987 }
4988}
4989
4990#[doc = " Declares a configuration capability.\n\n To learn more about configuration capabilities, see:\n https://fuchsia.dev/fuchsia-src/glossary#configuration-capability\n or:\n https://fuchsia.dev/fuchsia-src/docs/concepts/components/v2/capabilities/configuration\n"]
4991#[derive(Clone, Debug, Default)]
4992pub struct Configuration {
4993 pub name: Option<String>,
4994
4995 pub value: Option<crate::ConfigValue>,
4996}
4997
4998impl Configuration {
4999 fn __max_ordinal(&self) -> usize {
5000 if self.value.is_some() {
5001 return 2;
5002 }
5003
5004 if self.name.is_some() {
5005 return 1;
5006 }
5007
5008 0
5009 }
5010}
5011
5012impl ::fidl_next::Encodable for Configuration {
5013 type Encoded = WireConfiguration<'static>;
5014}
5015
5016unsafe impl<___E> ::fidl_next::Encode<___E> for Configuration
5017where
5018 ___E: ::fidl_next::Encoder + ?Sized,
5019{
5020 #[inline]
5021 fn encode(
5022 mut self,
5023 encoder: &mut ___E,
5024 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5025 ) -> Result<(), ::fidl_next::EncodeError> {
5026 ::fidl_next::munge!(let WireConfiguration { table } = out);
5027
5028 let max_ord = self.__max_ordinal();
5029
5030 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5031 ::fidl_next::Wire::zero_padding(&mut out);
5032
5033 let mut preallocated =
5034 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5035
5036 for i in 1..=max_ord {
5037 match i {
5038 2 => {
5039 if let Some(value) = self.value.take() {
5040 ::fidl_next::WireEnvelope::encode_value(
5041 value,
5042 preallocated.encoder,
5043 &mut out,
5044 )?;
5045 } else {
5046 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5047 }
5048 }
5049
5050 1 => {
5051 if let Some(name) = self.name.take() {
5052 ::fidl_next::WireEnvelope::encode_value(
5053 name,
5054 preallocated.encoder,
5055 &mut out,
5056 )?;
5057 } else {
5058 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5059 }
5060 }
5061
5062 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5063 }
5064 unsafe {
5065 preallocated.write_next(out.assume_init_ref());
5066 }
5067 }
5068
5069 ::fidl_next::WireTable::encode_len(table, max_ord);
5070
5071 Ok(())
5072 }
5073}
5074
5075unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Configuration
5076where
5077 ___E: ::fidl_next::Encoder + ?Sized,
5078{
5079 #[inline]
5080 fn encode_ref(
5081 &self,
5082 encoder: &mut ___E,
5083 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5084 ) -> Result<(), ::fidl_next::EncodeError> {
5085 ::fidl_next::munge!(let WireConfiguration { table } = out);
5086
5087 let max_ord = self.__max_ordinal();
5088
5089 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5090 ::fidl_next::Wire::zero_padding(&mut out);
5091
5092 let mut preallocated =
5093 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5094
5095 for i in 1..=max_ord {
5096 match i {
5097 2 => {
5098 if let Some(value) = &self.value {
5099 ::fidl_next::WireEnvelope::encode_value(
5100 value,
5101 preallocated.encoder,
5102 &mut out,
5103 )?;
5104 } else {
5105 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5106 }
5107 }
5108
5109 1 => {
5110 if let Some(name) = &self.name {
5111 ::fidl_next::WireEnvelope::encode_value(
5112 name,
5113 preallocated.encoder,
5114 &mut out,
5115 )?;
5116 } else {
5117 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5118 }
5119 }
5120
5121 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5122 }
5123 unsafe {
5124 preallocated.write_next(out.assume_init_ref());
5125 }
5126 }
5127
5128 ::fidl_next::WireTable::encode_len(table, max_ord);
5129
5130 Ok(())
5131 }
5132}
5133
5134impl<'de> ::fidl_next::FromWire<WireConfiguration<'de>> for Configuration {
5135 #[inline]
5136 fn from_wire(wire: WireConfiguration<'de>) -> Self {
5137 let wire = ::core::mem::ManuallyDrop::new(wire);
5138
5139 let name = wire.table.get(1);
5140
5141 let value = wire.table.get(2);
5142
5143 Self {
5144 name: name.map(|envelope| {
5145 ::fidl_next::FromWire::from_wire(unsafe {
5146 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
5147 })
5148 }),
5149
5150 value: value.map(|envelope| {
5151 ::fidl_next::FromWire::from_wire(unsafe {
5152 envelope.read_unchecked::<crate::WireConfigValue<'de>>()
5153 })
5154 }),
5155 }
5156 }
5157}
5158
5159impl<'de> ::fidl_next::FromWireRef<WireConfiguration<'de>> for Configuration {
5160 #[inline]
5161 fn from_wire_ref(wire: &WireConfiguration<'de>) -> Self {
5162 Self {
5163 name: wire.table.get(1).map(|envelope| {
5164 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
5165 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
5166 })
5167 }),
5168
5169 value: wire.table.get(2).map(|envelope| {
5170 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
5171 envelope.deref_unchecked::<crate::WireConfigValue<'de>>()
5172 })
5173 }),
5174 }
5175 }
5176}
5177
5178#[repr(C)]
5180pub struct WireConfiguration<'de> {
5181 table: ::fidl_next::WireTable<'de>,
5182}
5183
5184impl<'de> Drop for WireConfiguration<'de> {
5185 fn drop(&mut self) {
5186 let _ = self
5187 .table
5188 .get(1)
5189 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
5190
5191 let _ = self
5192 .table
5193 .get(2)
5194 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigValue<'de>>() });
5195 }
5196}
5197
5198unsafe impl ::fidl_next::Wire for WireConfiguration<'static> {
5199 type Decoded<'de> = WireConfiguration<'de>;
5200
5201 #[inline]
5202 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5203 ::fidl_next::munge!(let Self { table } = out);
5204 ::fidl_next::WireTable::zero_padding(table);
5205 }
5206}
5207
5208unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfiguration<'static>
5209where
5210 ___D: ::fidl_next::Decoder + ?Sized,
5211{
5212 fn decode(
5213 slot: ::fidl_next::Slot<'_, Self>,
5214 decoder: &mut ___D,
5215 ) -> Result<(), ::fidl_next::DecodeError> {
5216 ::fidl_next::munge!(let Self { table } = slot);
5217
5218 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
5219 match ordinal {
5220 0 => unsafe { ::core::hint::unreachable_unchecked() },
5221
5222 1 => {
5223 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
5224 slot.as_mut(),
5225 decoder,
5226 )?;
5227
5228 let name = unsafe {
5229 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
5230 };
5231
5232 if name.len() > 100 {
5233 return Err(::fidl_next::DecodeError::VectorTooLong {
5234 size: name.len() as u64,
5235 limit: 100,
5236 });
5237 }
5238
5239 Ok(())
5240 }
5241
5242 2 => {
5243 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValue<'static>>(
5244 slot.as_mut(),
5245 decoder,
5246 )?;
5247
5248 Ok(())
5249 }
5250
5251 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
5252 }
5253 })
5254 }
5255}
5256
5257impl<'de> WireConfiguration<'de> {
5258 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
5259 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5260 }
5261
5262 pub fn value(&self) -> Option<&crate::WireConfigValue<'de>> {
5263 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5264 }
5265}
5266
5267impl<'de> ::core::fmt::Debug for WireConfiguration<'de> {
5268 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
5269 f.debug_struct("Configuration")
5270 .field("name", &self.name())
5271 .field("value", &self.value())
5272 .finish()
5273 }
5274}
5275
5276#[doc = " Path in a dictionary. The format is similar to a directory path, except no `.` or `..`.\n is allowed and each path segment must conform to the format of the `name` type.\n\n The \"dirname\" (first to the penultimate segment, or empty if there is one\n segment) represents a sequence of nested dictionaries.\n The \"basename\" (last segment) identifies a capability in the last nested\n dictionary.\n"]
5277pub type DictionaryPath = String;
5278
5279pub type WireDictionaryPath<'de> = ::fidl_next::WireString<'de>;
5281
5282#[doc = " `DeliveryType` may be used when declaring a capability, and specifies under\n what conditions the framework will open the capability from the provider\n component\'s outgoing directory when there is a request for this capability.\n"]
5283#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5284#[repr(u32)]
5285pub enum DeliveryType {
5286 Immediate = 0,
5287 OnReadable = 1,
5288 UnknownOrdinal_(u32),
5289}
5290
5291impl ::fidl_next::Encodable for DeliveryType {
5292 type Encoded = WireDeliveryType;
5293}
5294impl ::std::convert::From<u32> for DeliveryType {
5295 fn from(value: u32) -> Self {
5296 match value {
5297 0 => Self::Immediate,
5298 1 => Self::OnReadable,
5299
5300 _ => Self::UnknownOrdinal_(value),
5301 }
5302 }
5303}
5304
5305unsafe impl<___E> ::fidl_next::Encode<___E> for DeliveryType
5306where
5307 ___E: ?Sized,
5308{
5309 #[inline]
5310 fn encode(
5311 self,
5312 encoder: &mut ___E,
5313 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5314 ) -> Result<(), ::fidl_next::EncodeError> {
5315 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
5316 }
5317}
5318
5319unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DeliveryType
5320where
5321 ___E: ?Sized,
5322{
5323 #[inline]
5324 fn encode_ref(
5325 &self,
5326 encoder: &mut ___E,
5327 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5328 ) -> Result<(), ::fidl_next::EncodeError> {
5329 ::fidl_next::munge!(let WireDeliveryType { value } = out);
5330 let _ = value.write(::fidl_next::WireU32::from(match *self {
5331 Self::Immediate => 0,
5332
5333 Self::OnReadable => 1,
5334
5335 Self::UnknownOrdinal_(value) => value,
5336 }));
5337
5338 Ok(())
5339 }
5340}
5341
5342impl ::core::convert::From<WireDeliveryType> for DeliveryType {
5343 fn from(wire: WireDeliveryType) -> Self {
5344 match u32::from(wire.value) {
5345 0 => Self::Immediate,
5346
5347 1 => Self::OnReadable,
5348
5349 value => Self::UnknownOrdinal_(value),
5350 }
5351 }
5352}
5353
5354impl ::fidl_next::FromWire<WireDeliveryType> for DeliveryType {
5355 #[inline]
5356 fn from_wire(wire: WireDeliveryType) -> Self {
5357 Self::from(wire)
5358 }
5359}
5360
5361impl ::fidl_next::FromWireRef<WireDeliveryType> for DeliveryType {
5362 #[inline]
5363 fn from_wire_ref(wire: &WireDeliveryType) -> Self {
5364 Self::from(*wire)
5365 }
5366}
5367
5368#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5370#[repr(transparent)]
5371pub struct WireDeliveryType {
5372 value: ::fidl_next::WireU32,
5373}
5374
5375unsafe impl ::fidl_next::Wire for WireDeliveryType {
5376 type Decoded<'de> = Self;
5377
5378 #[inline]
5379 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
5380 }
5382}
5383
5384impl WireDeliveryType {
5385 pub const IMMEDIATE: WireDeliveryType = WireDeliveryType { value: ::fidl_next::WireU32(0) };
5386
5387 pub const ON_READABLE: WireDeliveryType = WireDeliveryType { value: ::fidl_next::WireU32(1) };
5388}
5389
5390unsafe impl<___D> ::fidl_next::Decode<___D> for WireDeliveryType
5391where
5392 ___D: ?Sized,
5393{
5394 fn decode(
5395 slot: ::fidl_next::Slot<'_, Self>,
5396 _: &mut ___D,
5397 ) -> Result<(), ::fidl_next::DecodeError> {
5398 Ok(())
5399 }
5400}
5401
5402impl ::core::convert::From<DeliveryType> for WireDeliveryType {
5403 fn from(natural: DeliveryType) -> Self {
5404 match natural {
5405 DeliveryType::Immediate => WireDeliveryType::IMMEDIATE,
5406
5407 DeliveryType::OnReadable => WireDeliveryType::ON_READABLE,
5408
5409 DeliveryType::UnknownOrdinal_(value) => {
5410 WireDeliveryType { value: ::fidl_next::WireU32::from(value) }
5411 }
5412 }
5413 }
5414}
5415
5416#[doc = " Declares a protocol capability backed by this component.\n\n To learn more about protocols, see:\n https://fuchsia.dev/fuchsia-src/glossary#protocol\n"]
5417#[derive(Clone, Debug, Default)]
5418pub struct Protocol {
5419 pub name: Option<String>,
5420
5421 pub source_path: Option<String>,
5422
5423 pub delivery: Option<crate::DeliveryType>,
5424}
5425
5426impl Protocol {
5427 fn __max_ordinal(&self) -> usize {
5428 if self.delivery.is_some() {
5429 return 3;
5430 }
5431
5432 if self.source_path.is_some() {
5433 return 2;
5434 }
5435
5436 if self.name.is_some() {
5437 return 1;
5438 }
5439
5440 0
5441 }
5442}
5443
5444impl ::fidl_next::Encodable for Protocol {
5445 type Encoded = WireProtocol<'static>;
5446}
5447
5448unsafe impl<___E> ::fidl_next::Encode<___E> for Protocol
5449where
5450 ___E: ::fidl_next::Encoder + ?Sized,
5451{
5452 #[inline]
5453 fn encode(
5454 mut self,
5455 encoder: &mut ___E,
5456 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5457 ) -> Result<(), ::fidl_next::EncodeError> {
5458 ::fidl_next::munge!(let WireProtocol { table } = out);
5459
5460 let max_ord = self.__max_ordinal();
5461
5462 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5463 ::fidl_next::Wire::zero_padding(&mut out);
5464
5465 let mut preallocated =
5466 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5467
5468 for i in 1..=max_ord {
5469 match i {
5470 3 => {
5471 if let Some(delivery) = self.delivery.take() {
5472 ::fidl_next::WireEnvelope::encode_value(
5473 delivery,
5474 preallocated.encoder,
5475 &mut out,
5476 )?;
5477 } else {
5478 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5479 }
5480 }
5481
5482 2 => {
5483 if let Some(source_path) = self.source_path.take() {
5484 ::fidl_next::WireEnvelope::encode_value(
5485 source_path,
5486 preallocated.encoder,
5487 &mut out,
5488 )?;
5489 } else {
5490 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5491 }
5492 }
5493
5494 1 => {
5495 if let Some(name) = self.name.take() {
5496 ::fidl_next::WireEnvelope::encode_value(
5497 name,
5498 preallocated.encoder,
5499 &mut out,
5500 )?;
5501 } else {
5502 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5503 }
5504 }
5505
5506 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5507 }
5508 unsafe {
5509 preallocated.write_next(out.assume_init_ref());
5510 }
5511 }
5512
5513 ::fidl_next::WireTable::encode_len(table, max_ord);
5514
5515 Ok(())
5516 }
5517}
5518
5519unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Protocol
5520where
5521 ___E: ::fidl_next::Encoder + ?Sized,
5522{
5523 #[inline]
5524 fn encode_ref(
5525 &self,
5526 encoder: &mut ___E,
5527 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5528 ) -> Result<(), ::fidl_next::EncodeError> {
5529 ::fidl_next::munge!(let WireProtocol { table } = out);
5530
5531 let max_ord = self.__max_ordinal();
5532
5533 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5534 ::fidl_next::Wire::zero_padding(&mut out);
5535
5536 let mut preallocated =
5537 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5538
5539 for i in 1..=max_ord {
5540 match i {
5541 3 => {
5542 if let Some(delivery) = &self.delivery {
5543 ::fidl_next::WireEnvelope::encode_value(
5544 delivery,
5545 preallocated.encoder,
5546 &mut out,
5547 )?;
5548 } else {
5549 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5550 }
5551 }
5552
5553 2 => {
5554 if let Some(source_path) = &self.source_path {
5555 ::fidl_next::WireEnvelope::encode_value(
5556 source_path,
5557 preallocated.encoder,
5558 &mut out,
5559 )?;
5560 } else {
5561 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5562 }
5563 }
5564
5565 1 => {
5566 if let Some(name) = &self.name {
5567 ::fidl_next::WireEnvelope::encode_value(
5568 name,
5569 preallocated.encoder,
5570 &mut out,
5571 )?;
5572 } else {
5573 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5574 }
5575 }
5576
5577 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5578 }
5579 unsafe {
5580 preallocated.write_next(out.assume_init_ref());
5581 }
5582 }
5583
5584 ::fidl_next::WireTable::encode_len(table, max_ord);
5585
5586 Ok(())
5587 }
5588}
5589
5590impl<'de> ::fidl_next::FromWire<WireProtocol<'de>> for Protocol {
5591 #[inline]
5592 fn from_wire(wire: WireProtocol<'de>) -> Self {
5593 let wire = ::core::mem::ManuallyDrop::new(wire);
5594
5595 let name = wire.table.get(1);
5596
5597 let source_path = wire.table.get(2);
5598
5599 let delivery = wire.table.get(3);
5600
5601 Self {
5602 name: name.map(|envelope| {
5603 ::fidl_next::FromWire::from_wire(unsafe {
5604 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
5605 })
5606 }),
5607
5608 source_path: source_path.map(|envelope| {
5609 ::fidl_next::FromWire::from_wire(unsafe {
5610 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
5611 })
5612 }),
5613
5614 delivery: delivery.map(|envelope| {
5615 ::fidl_next::FromWire::from_wire(unsafe {
5616 envelope.read_unchecked::<crate::WireDeliveryType>()
5617 })
5618 }),
5619 }
5620 }
5621}
5622
5623impl<'de> ::fidl_next::FromWireRef<WireProtocol<'de>> for Protocol {
5624 #[inline]
5625 fn from_wire_ref(wire: &WireProtocol<'de>) -> Self {
5626 Self {
5627 name: wire.table.get(1).map(|envelope| {
5628 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
5629 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
5630 })
5631 }),
5632
5633 source_path: wire.table.get(2).map(|envelope| {
5634 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
5635 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
5636 })
5637 }),
5638
5639 delivery: wire.table.get(3).map(|envelope| {
5640 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
5641 envelope.deref_unchecked::<crate::WireDeliveryType>()
5642 })
5643 }),
5644 }
5645 }
5646}
5647
5648#[repr(C)]
5650pub struct WireProtocol<'de> {
5651 table: ::fidl_next::WireTable<'de>,
5652}
5653
5654impl<'de> Drop for WireProtocol<'de> {
5655 fn drop(&mut self) {
5656 let _ = self
5657 .table
5658 .get(1)
5659 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
5660
5661 let _ = self
5662 .table
5663 .get(2)
5664 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
5665
5666 let _ = self
5667 .table
5668 .get(3)
5669 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDeliveryType>() });
5670 }
5671}
5672
5673unsafe impl ::fidl_next::Wire for WireProtocol<'static> {
5674 type Decoded<'de> = WireProtocol<'de>;
5675
5676 #[inline]
5677 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5678 ::fidl_next::munge!(let Self { table } = out);
5679 ::fidl_next::WireTable::zero_padding(table);
5680 }
5681}
5682
5683unsafe impl<___D> ::fidl_next::Decode<___D> for WireProtocol<'static>
5684where
5685 ___D: ::fidl_next::Decoder + ?Sized,
5686{
5687 fn decode(
5688 slot: ::fidl_next::Slot<'_, Self>,
5689 decoder: &mut ___D,
5690 ) -> Result<(), ::fidl_next::DecodeError> {
5691 ::fidl_next::munge!(let Self { table } = slot);
5692
5693 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
5694 match ordinal {
5695 0 => unsafe { ::core::hint::unreachable_unchecked() },
5696
5697 1 => {
5698 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
5699 slot.as_mut(),
5700 decoder,
5701 )?;
5702
5703 let name = unsafe {
5704 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
5705 };
5706
5707 if name.len() > 100 {
5708 return Err(::fidl_next::DecodeError::VectorTooLong {
5709 size: name.len() as u64,
5710 limit: 100,
5711 });
5712 }
5713
5714 Ok(())
5715 }
5716
5717 2 => {
5718 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
5719 slot.as_mut(),
5720 decoder,
5721 )?;
5722
5723 let source_path = unsafe {
5724 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
5725 };
5726
5727 if source_path.len() > 1024 {
5728 return Err(::fidl_next::DecodeError::VectorTooLong {
5729 size: source_path.len() as u64,
5730 limit: 1024,
5731 });
5732 }
5733
5734 Ok(())
5735 }
5736
5737 3 => {
5738 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDeliveryType>(
5739 slot.as_mut(),
5740 decoder,
5741 )?;
5742
5743 Ok(())
5744 }
5745
5746 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
5747 }
5748 })
5749 }
5750}
5751
5752impl<'de> WireProtocol<'de> {
5753 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
5754 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5755 }
5756
5757 pub fn source_path(&self) -> Option<&::fidl_next::WireString<'de>> {
5758 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5759 }
5760
5761 pub fn delivery(&self) -> Option<&crate::WireDeliveryType> {
5762 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
5763 }
5764}
5765
5766impl<'de> ::core::fmt::Debug for WireProtocol<'de> {
5767 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
5768 f.debug_struct("Protocol")
5769 .field("name", &self.name())
5770 .field("source_path", &self.source_path())
5771 .field("delivery", &self.delivery())
5772 .finish()
5773 }
5774}
5775
5776#[doc = " A reference to the environment.\n"]
5777#[derive(Clone, Debug)]
5778#[repr(C)]
5779pub struct EnvironmentRef {}
5780
5781impl ::fidl_next::Encodable for EnvironmentRef {
5782 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireEnvironmentRef> =
5783 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
5784
5785 type Encoded = WireEnvironmentRef;
5786}
5787
5788unsafe impl<___E> ::fidl_next::Encode<___E> for EnvironmentRef
5789where
5790 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
5791{
5792 #[inline]
5793 fn encode(
5794 self,
5795 encoder: &mut ___E,
5796 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5797 ) -> Result<(), ::fidl_next::EncodeError> {
5798 ::fidl_next::munge! {
5799 let Self::Encoded {
5800
5801 } = out;
5802 }
5803
5804 Ok(())
5805 }
5806}
5807
5808unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EnvironmentRef
5809where
5810 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
5811{
5812 #[inline]
5813 fn encode_ref(
5814 &self,
5815 encoder: &mut ___E,
5816 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5817 ) -> Result<(), ::fidl_next::EncodeError> {
5818 ::fidl_next::munge! {
5819 let Self::Encoded {
5820
5821 } = out;
5822 }
5823
5824 Ok(())
5825 }
5826}
5827
5828impl ::fidl_next::EncodableOption for EnvironmentRef {
5829 type EncodedOption = ::fidl_next::WireBox<'static, WireEnvironmentRef>;
5830}
5831
5832unsafe impl<___E> ::fidl_next::EncodeOption<___E> for EnvironmentRef
5833where
5834 ___E: ::fidl_next::Encoder + ?Sized,
5835 EnvironmentRef: ::fidl_next::Encode<___E>,
5836{
5837 #[inline]
5838 fn encode_option(
5839 this: Option<Self>,
5840 encoder: &mut ___E,
5841 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
5842 ) -> Result<(), ::fidl_next::EncodeError> {
5843 if let Some(inner) = this {
5844 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
5845 ::fidl_next::WireBox::encode_present(out);
5846 } else {
5847 ::fidl_next::WireBox::encode_absent(out);
5848 }
5849
5850 Ok(())
5851 }
5852}
5853
5854unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for EnvironmentRef
5855where
5856 ___E: ::fidl_next::Encoder + ?Sized,
5857 EnvironmentRef: ::fidl_next::EncodeRef<___E>,
5858{
5859 #[inline]
5860 fn encode_option_ref(
5861 this: Option<&Self>,
5862 encoder: &mut ___E,
5863 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
5864 ) -> Result<(), ::fidl_next::EncodeError> {
5865 if let Some(inner) = this {
5866 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
5867 ::fidl_next::WireBox::encode_present(out);
5868 } else {
5869 ::fidl_next::WireBox::encode_absent(out);
5870 }
5871
5872 Ok(())
5873 }
5874}
5875
5876impl ::fidl_next::FromWire<WireEnvironmentRef> for EnvironmentRef {
5877 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireEnvironmentRef, Self> =
5878 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
5879
5880 #[inline]
5881 fn from_wire(wire: WireEnvironmentRef) -> Self {
5882 Self {}
5883 }
5884}
5885
5886impl ::fidl_next::FromWireRef<WireEnvironmentRef> for EnvironmentRef {
5887 #[inline]
5888 fn from_wire_ref(wire: &WireEnvironmentRef) -> Self {
5889 Self {}
5890 }
5891}
5892
5893#[derive(Clone, Debug)]
5895#[repr(C)]
5896pub struct WireEnvironmentRef {}
5897
5898unsafe impl ::fidl_next::Wire for WireEnvironmentRef {
5899 type Decoded<'de> = WireEnvironmentRef;
5900
5901 #[inline]
5902 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
5903}
5904
5905unsafe impl<___D> ::fidl_next::Decode<___D> for WireEnvironmentRef
5906where
5907 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5908{
5909 fn decode(
5910 slot: ::fidl_next::Slot<'_, Self>,
5911 decoder: &mut ___D,
5912 ) -> Result<(), ::fidl_next::DecodeError> {
5913 ::fidl_next::munge! {
5914 let Self {
5915
5916 } = slot;
5917 }
5918
5919 Ok(())
5920 }
5921}
5922
5923#[doc = " A reference to a capability source or destination relative to this\n component.\n"]
5924#[derive(Clone, Debug)]
5925pub enum Ref {
5926 Parent(crate::ParentRef),
5927
5928 Self_(crate::SelfRef),
5929
5930 Child(crate::ChildRef),
5931
5932 Collection(crate::CollectionRef),
5933
5934 Framework(crate::FrameworkRef),
5935
5936 Capability(crate::CapabilityRef),
5937
5938 Debug(crate::DebugRef),
5939
5940 VoidType(crate::VoidRef),
5941
5942 Environment(crate::EnvironmentRef),
5943
5944 UnknownOrdinal_(u64),
5945}
5946
5947impl ::fidl_next::Encodable for Ref {
5948 type Encoded = WireRef<'static>;
5949}
5950
5951unsafe impl<___E> ::fidl_next::Encode<___E> for Ref
5952where
5953 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
5954
5955 ___E: ::fidl_next::Encoder,
5956{
5957 #[inline]
5958 fn encode(
5959 self,
5960 encoder: &mut ___E,
5961 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5962 ) -> Result<(), ::fidl_next::EncodeError> {
5963 ::fidl_next::munge!(let WireRef { raw, _phantom: _ } = out);
5964
5965 match self {
5966 Self::Parent(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::ParentRef>(
5967 value, 1, encoder, raw,
5968 )?,
5969
5970 Self::Self_(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::SelfRef>(
5971 value, 2, encoder, raw,
5972 )?,
5973
5974 Self::Child(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::ChildRef>(
5975 value, 3, encoder, raw,
5976 )?,
5977
5978 Self::Collection(value) => ::fidl_next::RawWireUnion::encode_as::<
5979 ___E,
5980 crate::CollectionRef,
5981 >(value, 4, encoder, raw)?,
5982
5983 Self::Framework(value) => ::fidl_next::RawWireUnion::encode_as::<
5984 ___E,
5985 crate::FrameworkRef,
5986 >(value, 5, encoder, raw)?,
5987
5988 Self::Capability(value) => ::fidl_next::RawWireUnion::encode_as::<
5989 ___E,
5990 crate::CapabilityRef,
5991 >(value, 6, encoder, raw)?,
5992
5993 Self::Debug(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::DebugRef>(
5994 value, 7, encoder, raw,
5995 )?,
5996
5997 Self::VoidType(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::VoidRef>(
5998 value, 8, encoder, raw,
5999 )?,
6000
6001 Self::Environment(value) => ::fidl_next::RawWireUnion::encode_as::<
6002 ___E,
6003 crate::EnvironmentRef,
6004 >(value, 9, encoder, raw)?,
6005
6006 Self::UnknownOrdinal_(ordinal) => {
6007 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
6008 }
6009 }
6010
6011 Ok(())
6012 }
6013}
6014
6015unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Ref
6016where
6017 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6018
6019 ___E: ::fidl_next::Encoder,
6020{
6021 #[inline]
6022 fn encode_ref(
6023 &self,
6024 encoder: &mut ___E,
6025 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6026 ) -> Result<(), ::fidl_next::EncodeError> {
6027 ::fidl_next::munge!(let WireRef { raw, _phantom: _ } = out);
6028
6029 match self {
6030 Self::Parent(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::ParentRef>(
6031 value, 1, encoder, raw,
6032 )?,
6033
6034 Self::Self_(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::SelfRef>(
6035 value, 2, encoder, raw,
6036 )?,
6037
6038 Self::Child(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::ChildRef>(
6039 value, 3, encoder, raw,
6040 )?,
6041
6042 Self::Collection(value) => ::fidl_next::RawWireUnion::encode_as::<
6043 ___E,
6044 &crate::CollectionRef,
6045 >(value, 4, encoder, raw)?,
6046
6047 Self::Framework(value) => ::fidl_next::RawWireUnion::encode_as::<
6048 ___E,
6049 &crate::FrameworkRef,
6050 >(value, 5, encoder, raw)?,
6051
6052 Self::Capability(value) => ::fidl_next::RawWireUnion::encode_as::<
6053 ___E,
6054 &crate::CapabilityRef,
6055 >(value, 6, encoder, raw)?,
6056
6057 Self::Debug(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::DebugRef>(
6058 value, 7, encoder, raw,
6059 )?,
6060
6061 Self::VoidType(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::VoidRef>(
6062 value, 8, encoder, raw,
6063 )?,
6064
6065 Self::Environment(value) => ::fidl_next::RawWireUnion::encode_as::<
6066 ___E,
6067 &crate::EnvironmentRef,
6068 >(value, 9, encoder, raw)?,
6069
6070 Self::UnknownOrdinal_(ordinal) => {
6071 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
6072 }
6073 }
6074
6075 Ok(())
6076 }
6077}
6078
6079impl ::fidl_next::EncodableOption for Ref {
6080 type EncodedOption = WireOptionalRef<'static>;
6081}
6082
6083unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Ref
6084where
6085 ___E: ?Sized,
6086 Ref: ::fidl_next::Encode<___E>,
6087{
6088 #[inline]
6089 fn encode_option(
6090 this: Option<Self>,
6091 encoder: &mut ___E,
6092 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
6093 ) -> Result<(), ::fidl_next::EncodeError> {
6094 ::fidl_next::munge!(let WireOptionalRef { raw, _phantom: _ } = &mut *out);
6095
6096 if let Some(inner) = this {
6097 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
6098 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
6099 } else {
6100 ::fidl_next::RawWireUnion::encode_absent(raw);
6101 }
6102
6103 Ok(())
6104 }
6105}
6106
6107unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Ref
6108where
6109 ___E: ?Sized,
6110 Ref: ::fidl_next::EncodeRef<___E>,
6111{
6112 #[inline]
6113 fn encode_option_ref(
6114 this: Option<&Self>,
6115 encoder: &mut ___E,
6116 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
6117 ) -> Result<(), ::fidl_next::EncodeError> {
6118 ::fidl_next::munge!(let WireOptionalRef { raw, _phantom: _ } = &mut *out);
6119
6120 if let Some(inner) = this {
6121 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
6122 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
6123 } else {
6124 ::fidl_next::RawWireUnion::encode_absent(raw);
6125 }
6126
6127 Ok(())
6128 }
6129}
6130
6131impl<'de> ::fidl_next::FromWire<WireRef<'de>> for Ref {
6132 #[inline]
6133 fn from_wire(wire: WireRef<'de>) -> Self {
6134 let wire = ::core::mem::ManuallyDrop::new(wire);
6135 match wire.raw.ordinal() {
6136 1 => Self::Parent(::fidl_next::FromWire::from_wire(unsafe {
6137 wire.raw.get().read_unchecked::<crate::WireParentRef>()
6138 })),
6139
6140 2 => Self::Self_(::fidl_next::FromWire::from_wire(unsafe {
6141 wire.raw.get().read_unchecked::<crate::WireSelfRef>()
6142 })),
6143
6144 3 => Self::Child(::fidl_next::FromWire::from_wire(unsafe {
6145 wire.raw.get().read_unchecked::<crate::WireChildRef<'de>>()
6146 })),
6147
6148 4 => Self::Collection(::fidl_next::FromWire::from_wire(unsafe {
6149 wire.raw.get().read_unchecked::<crate::WireCollectionRef<'de>>()
6150 })),
6151
6152 5 => Self::Framework(::fidl_next::FromWire::from_wire(unsafe {
6153 wire.raw.get().read_unchecked::<crate::WireFrameworkRef>()
6154 })),
6155
6156 6 => Self::Capability(::fidl_next::FromWire::from_wire(unsafe {
6157 wire.raw.get().read_unchecked::<crate::WireCapabilityRef<'de>>()
6158 })),
6159
6160 7 => Self::Debug(::fidl_next::FromWire::from_wire(unsafe {
6161 wire.raw.get().read_unchecked::<crate::WireDebugRef>()
6162 })),
6163
6164 8 => Self::VoidType(::fidl_next::FromWire::from_wire(unsafe {
6165 wire.raw.get().read_unchecked::<crate::WireVoidRef>()
6166 })),
6167
6168 9 => Self::Environment(::fidl_next::FromWire::from_wire(unsafe {
6169 wire.raw.get().read_unchecked::<crate::WireEnvironmentRef>()
6170 })),
6171
6172 _ => unsafe { ::core::hint::unreachable_unchecked() },
6173 }
6174 }
6175}
6176
6177impl<'de> ::fidl_next::FromWireRef<WireRef<'de>> for Ref {
6178 #[inline]
6179 fn from_wire_ref(wire: &WireRef<'de>) -> Self {
6180 match wire.raw.ordinal() {
6181 1 => Self::Parent(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6182 wire.raw.get().deref_unchecked::<crate::WireParentRef>()
6183 })),
6184
6185 2 => Self::Self_(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6186 wire.raw.get().deref_unchecked::<crate::WireSelfRef>()
6187 })),
6188
6189 3 => Self::Child(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6190 wire.raw.get().deref_unchecked::<crate::WireChildRef<'de>>()
6191 })),
6192
6193 4 => Self::Collection(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6194 wire.raw.get().deref_unchecked::<crate::WireCollectionRef<'de>>()
6195 })),
6196
6197 5 => Self::Framework(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6198 wire.raw.get().deref_unchecked::<crate::WireFrameworkRef>()
6199 })),
6200
6201 6 => Self::Capability(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6202 wire.raw.get().deref_unchecked::<crate::WireCapabilityRef<'de>>()
6203 })),
6204
6205 7 => Self::Debug(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6206 wire.raw.get().deref_unchecked::<crate::WireDebugRef>()
6207 })),
6208
6209 8 => Self::VoidType(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6210 wire.raw.get().deref_unchecked::<crate::WireVoidRef>()
6211 })),
6212
6213 9 => Self::Environment(::fidl_next::FromWireRef::from_wire_ref(unsafe {
6214 wire.raw.get().deref_unchecked::<crate::WireEnvironmentRef>()
6215 })),
6216
6217 _ => unsafe { ::core::hint::unreachable_unchecked() },
6218 }
6219 }
6220}
6221
6222impl<'de> ::fidl_next::FromWireOption<WireOptionalRef<'de>> for Box<Ref> {
6223 #[inline]
6224 fn from_wire_option(wire: WireOptionalRef<'de>) -> Option<Self> {
6225 if let Some(inner) = wire.into_option() {
6226 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
6227 } else {
6228 None
6229 }
6230 }
6231}
6232
6233impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalRef<'de>> for Box<Ref> {
6234 #[inline]
6235 fn from_wire_option_ref(wire: &WireOptionalRef<'de>) -> Option<Self> {
6236 if let Some(inner) = wire.as_ref() {
6237 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
6238 } else {
6239 None
6240 }
6241 }
6242}
6243
6244#[repr(transparent)]
6246pub struct WireRef<'de> {
6247 raw: ::fidl_next::RawWireUnion,
6248 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
6249}
6250
6251impl<'de> Drop for WireRef<'de> {
6252 fn drop(&mut self) {
6253 match self.raw.ordinal() {
6254 1 => {
6255 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireParentRef>() };
6256 }
6257
6258 2 => {
6259 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireSelfRef>() };
6260 }
6261
6262 3 => {
6263 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireChildRef<'de>>() };
6264 }
6265
6266 4 => {
6267 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireCollectionRef<'de>>() };
6268 }
6269
6270 5 => {
6271 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireFrameworkRef>() };
6272 }
6273
6274 6 => {
6275 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireCapabilityRef<'de>>() };
6276 }
6277
6278 7 => {
6279 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireDebugRef>() };
6280 }
6281
6282 8 => {
6283 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireVoidRef>() };
6284 }
6285
6286 9 => {
6287 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireEnvironmentRef>() };
6288 }
6289
6290 _ => (),
6291 }
6292 }
6293}
6294
6295unsafe impl ::fidl_next::Wire for WireRef<'static> {
6296 type Decoded<'de> = WireRef<'de>;
6297
6298 #[inline]
6299 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6300 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
6301 ::fidl_next::RawWireUnion::zero_padding(raw);
6302 }
6303}
6304
6305pub mod ref_ {
6306 pub enum Ref<'de> {
6307 Parent(&'de crate::WireParentRef),
6308
6309 Self_(&'de crate::WireSelfRef),
6310
6311 Child(&'de crate::WireChildRef<'de>),
6312
6313 Collection(&'de crate::WireCollectionRef<'de>),
6314
6315 Framework(&'de crate::WireFrameworkRef),
6316
6317 Capability(&'de crate::WireCapabilityRef<'de>),
6318
6319 Debug(&'de crate::WireDebugRef),
6320
6321 VoidType(&'de crate::WireVoidRef),
6322
6323 Environment(&'de crate::WireEnvironmentRef),
6324
6325 UnknownOrdinal_(u64),
6326 }
6327}
6328
6329impl<'de> WireRef<'de> {
6330 pub fn as_ref(&self) -> crate::ref_::Ref<'_> {
6331 match self.raw.ordinal() {
6332 1 => crate::ref_::Ref::Parent(unsafe {
6333 self.raw.get().deref_unchecked::<crate::WireParentRef>()
6334 }),
6335
6336 2 => crate::ref_::Ref::Self_(unsafe {
6337 self.raw.get().deref_unchecked::<crate::WireSelfRef>()
6338 }),
6339
6340 3 => crate::ref_::Ref::Child(unsafe {
6341 self.raw.get().deref_unchecked::<crate::WireChildRef<'_>>()
6342 }),
6343
6344 4 => crate::ref_::Ref::Collection(unsafe {
6345 self.raw.get().deref_unchecked::<crate::WireCollectionRef<'_>>()
6346 }),
6347
6348 5 => crate::ref_::Ref::Framework(unsafe {
6349 self.raw.get().deref_unchecked::<crate::WireFrameworkRef>()
6350 }),
6351
6352 6 => crate::ref_::Ref::Capability(unsafe {
6353 self.raw.get().deref_unchecked::<crate::WireCapabilityRef<'_>>()
6354 }),
6355
6356 7 => crate::ref_::Ref::Debug(unsafe {
6357 self.raw.get().deref_unchecked::<crate::WireDebugRef>()
6358 }),
6359
6360 8 => crate::ref_::Ref::VoidType(unsafe {
6361 self.raw.get().deref_unchecked::<crate::WireVoidRef>()
6362 }),
6363
6364 9 => crate::ref_::Ref::Environment(unsafe {
6365 self.raw.get().deref_unchecked::<crate::WireEnvironmentRef>()
6366 }),
6367
6368 unknown => crate::ref_::Ref::UnknownOrdinal_(unknown),
6369 }
6370 }
6371}
6372
6373unsafe impl<___D> ::fidl_next::Decode<___D> for WireRef<'static>
6374where
6375 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6376
6377 ___D: ::fidl_next::Decoder,
6378{
6379 fn decode(
6380 mut slot: ::fidl_next::Slot<'_, Self>,
6381 decoder: &mut ___D,
6382 ) -> Result<(), ::fidl_next::DecodeError> {
6383 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
6384 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
6385 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireParentRef>(raw, decoder)?,
6386
6387 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireSelfRef>(raw, decoder)?,
6388
6389 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireChildRef<'static>>(
6390 raw, decoder,
6391 )?,
6392
6393 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireCollectionRef<'static>>(
6394 raw, decoder,
6395 )?,
6396
6397 5 => {
6398 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireFrameworkRef>(raw, decoder)?
6399 }
6400
6401 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireCapabilityRef<'static>>(
6402 raw, decoder,
6403 )?,
6404
6405 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDebugRef>(raw, decoder)?,
6406
6407 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireVoidRef>(raw, decoder)?,
6408
6409 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireEnvironmentRef>(
6410 raw, decoder,
6411 )?,
6412
6413 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
6414 }
6415
6416 Ok(())
6417 }
6418}
6419
6420impl<'de> ::core::fmt::Debug for WireRef<'de> {
6421 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6422 match self.raw.ordinal() {
6423 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireParentRef>().fmt(f) },
6424 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireSelfRef>().fmt(f) },
6425 3 => unsafe { self.raw.get().deref_unchecked::<crate::WireChildRef<'_>>().fmt(f) },
6426 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireCollectionRef<'_>>().fmt(f) },
6427 5 => unsafe { self.raw.get().deref_unchecked::<crate::WireFrameworkRef>().fmt(f) },
6428 6 => unsafe { self.raw.get().deref_unchecked::<crate::WireCapabilityRef<'_>>().fmt(f) },
6429 7 => unsafe { self.raw.get().deref_unchecked::<crate::WireDebugRef>().fmt(f) },
6430 8 => unsafe { self.raw.get().deref_unchecked::<crate::WireVoidRef>().fmt(f) },
6431 9 => unsafe { self.raw.get().deref_unchecked::<crate::WireEnvironmentRef>().fmt(f) },
6432 _ => unsafe { ::core::hint::unreachable_unchecked() },
6433 }
6434 }
6435}
6436
6437#[repr(transparent)]
6438pub struct WireOptionalRef<'de> {
6439 raw: ::fidl_next::RawWireUnion,
6440 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
6441}
6442
6443unsafe impl ::fidl_next::Wire for WireOptionalRef<'static> {
6444 type Decoded<'de> = WireOptionalRef<'de>;
6445
6446 #[inline]
6447 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6448 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
6449 ::fidl_next::RawWireUnion::zero_padding(raw);
6450 }
6451}
6452
6453impl<'de> WireOptionalRef<'de> {
6454 pub fn is_some(&self) -> bool {
6455 self.raw.is_some()
6456 }
6457
6458 pub fn is_none(&self) -> bool {
6459 self.raw.is_none()
6460 }
6461
6462 pub fn as_ref(&self) -> Option<&WireRef<'de>> {
6463 if self.is_some() {
6464 Some(unsafe { &*(self as *const Self).cast() })
6465 } else {
6466 None
6467 }
6468 }
6469
6470 pub fn into_option(self) -> Option<WireRef<'de>> {
6471 if self.is_some() {
6472 Some(WireRef { raw: self.raw, _phantom: ::core::marker::PhantomData })
6473 } else {
6474 None
6475 }
6476 }
6477}
6478
6479unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalRef<'static>
6480where
6481 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6482
6483 ___D: ::fidl_next::Decoder,
6484{
6485 fn decode(
6486 mut slot: ::fidl_next::Slot<'_, Self>,
6487 decoder: &mut ___D,
6488 ) -> Result<(), ::fidl_next::DecodeError> {
6489 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
6490 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
6491 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireParentRef>(raw, decoder)?,
6492
6493 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireSelfRef>(raw, decoder)?,
6494
6495 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireChildRef<'static>>(
6496 raw, decoder,
6497 )?,
6498
6499 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireCollectionRef<'static>>(
6500 raw, decoder,
6501 )?,
6502
6503 5 => {
6504 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireFrameworkRef>(raw, decoder)?
6505 }
6506
6507 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireCapabilityRef<'static>>(
6508 raw, decoder,
6509 )?,
6510
6511 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDebugRef>(raw, decoder)?,
6512
6513 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireVoidRef>(raw, decoder)?,
6514
6515 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireEnvironmentRef>(
6516 raw, decoder,
6517 )?,
6518
6519 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
6520 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
6521 }
6522
6523 Ok(())
6524 }
6525}
6526
6527impl<'de> ::core::fmt::Debug for WireOptionalRef<'de> {
6528 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6529 self.as_ref().fmt(f)
6530 }
6531}
6532
6533#[doc = " Declares a storage capability backed by a directory from which data, cache,\n or meta storage can be offered.\n"]
6534#[derive(Clone, Debug, Default)]
6535pub struct Storage {
6536 pub name: Option<String>,
6537
6538 pub source: Option<crate::Ref>,
6539
6540 pub backing_dir: Option<String>,
6541
6542 pub subdir: Option<String>,
6543
6544 pub storage_id: Option<crate::StorageId>,
6545}
6546
6547impl Storage {
6548 fn __max_ordinal(&self) -> usize {
6549 if self.storage_id.is_some() {
6550 return 5;
6551 }
6552
6553 if self.subdir.is_some() {
6554 return 4;
6555 }
6556
6557 if self.backing_dir.is_some() {
6558 return 3;
6559 }
6560
6561 if self.source.is_some() {
6562 return 2;
6563 }
6564
6565 if self.name.is_some() {
6566 return 1;
6567 }
6568
6569 0
6570 }
6571}
6572
6573impl ::fidl_next::Encodable for Storage {
6574 type Encoded = WireStorage<'static>;
6575}
6576
6577unsafe impl<___E> ::fidl_next::Encode<___E> for Storage
6578where
6579 ___E: ::fidl_next::Encoder + ?Sized,
6580{
6581 #[inline]
6582 fn encode(
6583 mut self,
6584 encoder: &mut ___E,
6585 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6586 ) -> Result<(), ::fidl_next::EncodeError> {
6587 ::fidl_next::munge!(let WireStorage { table } = out);
6588
6589 let max_ord = self.__max_ordinal();
6590
6591 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
6592 ::fidl_next::Wire::zero_padding(&mut out);
6593
6594 let mut preallocated =
6595 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
6596
6597 for i in 1..=max_ord {
6598 match i {
6599 5 => {
6600 if let Some(storage_id) = self.storage_id.take() {
6601 ::fidl_next::WireEnvelope::encode_value(
6602 storage_id,
6603 preallocated.encoder,
6604 &mut out,
6605 )?;
6606 } else {
6607 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6608 }
6609 }
6610
6611 4 => {
6612 if let Some(subdir) = self.subdir.take() {
6613 ::fidl_next::WireEnvelope::encode_value(
6614 subdir,
6615 preallocated.encoder,
6616 &mut out,
6617 )?;
6618 } else {
6619 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6620 }
6621 }
6622
6623 3 => {
6624 if let Some(backing_dir) = self.backing_dir.take() {
6625 ::fidl_next::WireEnvelope::encode_value(
6626 backing_dir,
6627 preallocated.encoder,
6628 &mut out,
6629 )?;
6630 } else {
6631 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6632 }
6633 }
6634
6635 2 => {
6636 if let Some(source) = self.source.take() {
6637 ::fidl_next::WireEnvelope::encode_value(
6638 source,
6639 preallocated.encoder,
6640 &mut out,
6641 )?;
6642 } else {
6643 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6644 }
6645 }
6646
6647 1 => {
6648 if let Some(name) = self.name.take() {
6649 ::fidl_next::WireEnvelope::encode_value(
6650 name,
6651 preallocated.encoder,
6652 &mut out,
6653 )?;
6654 } else {
6655 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6656 }
6657 }
6658
6659 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
6660 }
6661 unsafe {
6662 preallocated.write_next(out.assume_init_ref());
6663 }
6664 }
6665
6666 ::fidl_next::WireTable::encode_len(table, max_ord);
6667
6668 Ok(())
6669 }
6670}
6671
6672unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Storage
6673where
6674 ___E: ::fidl_next::Encoder + ?Sized,
6675{
6676 #[inline]
6677 fn encode_ref(
6678 &self,
6679 encoder: &mut ___E,
6680 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6681 ) -> Result<(), ::fidl_next::EncodeError> {
6682 ::fidl_next::munge!(let WireStorage { table } = out);
6683
6684 let max_ord = self.__max_ordinal();
6685
6686 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
6687 ::fidl_next::Wire::zero_padding(&mut out);
6688
6689 let mut preallocated =
6690 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
6691
6692 for i in 1..=max_ord {
6693 match i {
6694 5 => {
6695 if let Some(storage_id) = &self.storage_id {
6696 ::fidl_next::WireEnvelope::encode_value(
6697 storage_id,
6698 preallocated.encoder,
6699 &mut out,
6700 )?;
6701 } else {
6702 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6703 }
6704 }
6705
6706 4 => {
6707 if let Some(subdir) = &self.subdir {
6708 ::fidl_next::WireEnvelope::encode_value(
6709 subdir,
6710 preallocated.encoder,
6711 &mut out,
6712 )?;
6713 } else {
6714 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6715 }
6716 }
6717
6718 3 => {
6719 if let Some(backing_dir) = &self.backing_dir {
6720 ::fidl_next::WireEnvelope::encode_value(
6721 backing_dir,
6722 preallocated.encoder,
6723 &mut out,
6724 )?;
6725 } else {
6726 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6727 }
6728 }
6729
6730 2 => {
6731 if let Some(source) = &self.source {
6732 ::fidl_next::WireEnvelope::encode_value(
6733 source,
6734 preallocated.encoder,
6735 &mut out,
6736 )?;
6737 } else {
6738 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6739 }
6740 }
6741
6742 1 => {
6743 if let Some(name) = &self.name {
6744 ::fidl_next::WireEnvelope::encode_value(
6745 name,
6746 preallocated.encoder,
6747 &mut out,
6748 )?;
6749 } else {
6750 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6751 }
6752 }
6753
6754 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
6755 }
6756 unsafe {
6757 preallocated.write_next(out.assume_init_ref());
6758 }
6759 }
6760
6761 ::fidl_next::WireTable::encode_len(table, max_ord);
6762
6763 Ok(())
6764 }
6765}
6766
6767impl<'de> ::fidl_next::FromWire<WireStorage<'de>> for Storage {
6768 #[inline]
6769 fn from_wire(wire: WireStorage<'de>) -> Self {
6770 let wire = ::core::mem::ManuallyDrop::new(wire);
6771
6772 let name = wire.table.get(1);
6773
6774 let source = wire.table.get(2);
6775
6776 let backing_dir = wire.table.get(3);
6777
6778 let subdir = wire.table.get(4);
6779
6780 let storage_id = wire.table.get(5);
6781
6782 Self {
6783 name: name.map(|envelope| {
6784 ::fidl_next::FromWire::from_wire(unsafe {
6785 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
6786 })
6787 }),
6788
6789 source: source.map(|envelope| {
6790 ::fidl_next::FromWire::from_wire(unsafe {
6791 envelope.read_unchecked::<crate::WireRef<'de>>()
6792 })
6793 }),
6794
6795 backing_dir: backing_dir.map(|envelope| {
6796 ::fidl_next::FromWire::from_wire(unsafe {
6797 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
6798 })
6799 }),
6800
6801 subdir: subdir.map(|envelope| {
6802 ::fidl_next::FromWire::from_wire(unsafe {
6803 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
6804 })
6805 }),
6806
6807 storage_id: storage_id.map(|envelope| {
6808 ::fidl_next::FromWire::from_wire(unsafe {
6809 envelope.read_unchecked::<crate::WireStorageId>()
6810 })
6811 }),
6812 }
6813 }
6814}
6815
6816impl<'de> ::fidl_next::FromWireRef<WireStorage<'de>> for Storage {
6817 #[inline]
6818 fn from_wire_ref(wire: &WireStorage<'de>) -> Self {
6819 Self {
6820 name: wire.table.get(1).map(|envelope| {
6821 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
6822 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
6823 })
6824 }),
6825
6826 source: wire.table.get(2).map(|envelope| {
6827 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
6828 envelope.deref_unchecked::<crate::WireRef<'de>>()
6829 })
6830 }),
6831
6832 backing_dir: wire.table.get(3).map(|envelope| {
6833 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
6834 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
6835 })
6836 }),
6837
6838 subdir: wire.table.get(4).map(|envelope| {
6839 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
6840 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
6841 })
6842 }),
6843
6844 storage_id: wire.table.get(5).map(|envelope| {
6845 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
6846 envelope.deref_unchecked::<crate::WireStorageId>()
6847 })
6848 }),
6849 }
6850 }
6851}
6852
6853#[repr(C)]
6855pub struct WireStorage<'de> {
6856 table: ::fidl_next::WireTable<'de>,
6857}
6858
6859impl<'de> Drop for WireStorage<'de> {
6860 fn drop(&mut self) {
6861 let _ = self
6862 .table
6863 .get(1)
6864 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
6865
6866 let _ = self
6867 .table
6868 .get(2)
6869 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
6870
6871 let _ = self
6872 .table
6873 .get(3)
6874 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
6875
6876 let _ = self
6877 .table
6878 .get(4)
6879 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
6880
6881 let _ = self
6882 .table
6883 .get(5)
6884 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireStorageId>() });
6885 }
6886}
6887
6888unsafe impl ::fidl_next::Wire for WireStorage<'static> {
6889 type Decoded<'de> = WireStorage<'de>;
6890
6891 #[inline]
6892 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6893 ::fidl_next::munge!(let Self { table } = out);
6894 ::fidl_next::WireTable::zero_padding(table);
6895 }
6896}
6897
6898unsafe impl<___D> ::fidl_next::Decode<___D> for WireStorage<'static>
6899where
6900 ___D: ::fidl_next::Decoder + ?Sized,
6901{
6902 fn decode(
6903 slot: ::fidl_next::Slot<'_, Self>,
6904 decoder: &mut ___D,
6905 ) -> Result<(), ::fidl_next::DecodeError> {
6906 ::fidl_next::munge!(let Self { table } = slot);
6907
6908 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
6909 match ordinal {
6910 0 => unsafe { ::core::hint::unreachable_unchecked() },
6911
6912 1 => {
6913 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
6914 slot.as_mut(),
6915 decoder,
6916 )?;
6917
6918 let name = unsafe {
6919 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
6920 };
6921
6922 if name.len() > 100 {
6923 return Err(::fidl_next::DecodeError::VectorTooLong {
6924 size: name.len() as u64,
6925 limit: 100,
6926 });
6927 }
6928
6929 Ok(())
6930 }
6931
6932 2 => {
6933 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
6934 slot.as_mut(),
6935 decoder,
6936 )?;
6937
6938 Ok(())
6939 }
6940
6941 3 => {
6942 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
6943 slot.as_mut(),
6944 decoder,
6945 )?;
6946
6947 let backing_dir = unsafe {
6948 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
6949 };
6950
6951 if backing_dir.len() > 100 {
6952 return Err(::fidl_next::DecodeError::VectorTooLong {
6953 size: backing_dir.len() as u64,
6954 limit: 100,
6955 });
6956 }
6957
6958 Ok(())
6959 }
6960
6961 4 => {
6962 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
6963 slot.as_mut(),
6964 decoder,
6965 )?;
6966
6967 let subdir = unsafe {
6968 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
6969 };
6970
6971 if subdir.len() > 1024 {
6972 return Err(::fidl_next::DecodeError::VectorTooLong {
6973 size: subdir.len() as u64,
6974 limit: 1024,
6975 });
6976 }
6977
6978 Ok(())
6979 }
6980
6981 5 => {
6982 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireStorageId>(
6983 slot.as_mut(),
6984 decoder,
6985 )?;
6986
6987 Ok(())
6988 }
6989
6990 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
6991 }
6992 })
6993 }
6994}
6995
6996impl<'de> WireStorage<'de> {
6997 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
6998 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
6999 }
7000
7001 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
7002 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
7003 }
7004
7005 pub fn backing_dir(&self) -> Option<&::fidl_next::WireString<'de>> {
7006 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
7007 }
7008
7009 pub fn subdir(&self) -> Option<&::fidl_next::WireString<'de>> {
7010 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
7011 }
7012
7013 pub fn storage_id(&self) -> Option<&crate::WireStorageId> {
7014 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
7015 }
7016}
7017
7018impl<'de> ::core::fmt::Debug for WireStorage<'de> {
7019 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
7020 f.debug_struct("Storage")
7021 .field("name", &self.name())
7022 .field("source", &self.source())
7023 .field("backing_dir", &self.backing_dir())
7024 .field("subdir", &self.subdir())
7025 .field("storage_id", &self.storage_id())
7026 .finish()
7027 }
7028}
7029
7030#[doc = " Declares a dictionary capability.\n"]
7031#[derive(Clone, Debug, Default)]
7032pub struct Dictionary {
7033 pub name: Option<String>,
7034
7035 pub source: Option<crate::Ref>,
7036
7037 pub source_dictionary: Option<String>,
7038
7039 pub source_path: Option<String>,
7040}
7041
7042impl Dictionary {
7043 fn __max_ordinal(&self) -> usize {
7044 if self.source_path.is_some() {
7045 return 4;
7046 }
7047
7048 if self.source_dictionary.is_some() {
7049 return 3;
7050 }
7051
7052 if self.source.is_some() {
7053 return 2;
7054 }
7055
7056 if self.name.is_some() {
7057 return 1;
7058 }
7059
7060 0
7061 }
7062}
7063
7064impl ::fidl_next::Encodable for Dictionary {
7065 type Encoded = WireDictionary<'static>;
7066}
7067
7068unsafe impl<___E> ::fidl_next::Encode<___E> for Dictionary
7069where
7070 ___E: ::fidl_next::Encoder + ?Sized,
7071{
7072 #[inline]
7073 fn encode(
7074 mut self,
7075 encoder: &mut ___E,
7076 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7077 ) -> Result<(), ::fidl_next::EncodeError> {
7078 ::fidl_next::munge!(let WireDictionary { table } = out);
7079
7080 let max_ord = self.__max_ordinal();
7081
7082 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7083 ::fidl_next::Wire::zero_padding(&mut out);
7084
7085 let mut preallocated =
7086 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7087
7088 for i in 1..=max_ord {
7089 match i {
7090 4 => {
7091 if let Some(source_path) = self.source_path.take() {
7092 ::fidl_next::WireEnvelope::encode_value(
7093 source_path,
7094 preallocated.encoder,
7095 &mut out,
7096 )?;
7097 } else {
7098 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7099 }
7100 }
7101
7102 3 => {
7103 if let Some(source_dictionary) = self.source_dictionary.take() {
7104 ::fidl_next::WireEnvelope::encode_value(
7105 source_dictionary,
7106 preallocated.encoder,
7107 &mut out,
7108 )?;
7109 } else {
7110 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7111 }
7112 }
7113
7114 2 => {
7115 if let Some(source) = self.source.take() {
7116 ::fidl_next::WireEnvelope::encode_value(
7117 source,
7118 preallocated.encoder,
7119 &mut out,
7120 )?;
7121 } else {
7122 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7123 }
7124 }
7125
7126 1 => {
7127 if let Some(name) = self.name.take() {
7128 ::fidl_next::WireEnvelope::encode_value(
7129 name,
7130 preallocated.encoder,
7131 &mut out,
7132 )?;
7133 } else {
7134 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7135 }
7136 }
7137
7138 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7139 }
7140 unsafe {
7141 preallocated.write_next(out.assume_init_ref());
7142 }
7143 }
7144
7145 ::fidl_next::WireTable::encode_len(table, max_ord);
7146
7147 Ok(())
7148 }
7149}
7150
7151unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Dictionary
7152where
7153 ___E: ::fidl_next::Encoder + ?Sized,
7154{
7155 #[inline]
7156 fn encode_ref(
7157 &self,
7158 encoder: &mut ___E,
7159 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7160 ) -> Result<(), ::fidl_next::EncodeError> {
7161 ::fidl_next::munge!(let WireDictionary { table } = out);
7162
7163 let max_ord = self.__max_ordinal();
7164
7165 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7166 ::fidl_next::Wire::zero_padding(&mut out);
7167
7168 let mut preallocated =
7169 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7170
7171 for i in 1..=max_ord {
7172 match i {
7173 4 => {
7174 if let Some(source_path) = &self.source_path {
7175 ::fidl_next::WireEnvelope::encode_value(
7176 source_path,
7177 preallocated.encoder,
7178 &mut out,
7179 )?;
7180 } else {
7181 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7182 }
7183 }
7184
7185 3 => {
7186 if let Some(source_dictionary) = &self.source_dictionary {
7187 ::fidl_next::WireEnvelope::encode_value(
7188 source_dictionary,
7189 preallocated.encoder,
7190 &mut out,
7191 )?;
7192 } else {
7193 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7194 }
7195 }
7196
7197 2 => {
7198 if let Some(source) = &self.source {
7199 ::fidl_next::WireEnvelope::encode_value(
7200 source,
7201 preallocated.encoder,
7202 &mut out,
7203 )?;
7204 } else {
7205 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7206 }
7207 }
7208
7209 1 => {
7210 if let Some(name) = &self.name {
7211 ::fidl_next::WireEnvelope::encode_value(
7212 name,
7213 preallocated.encoder,
7214 &mut out,
7215 )?;
7216 } else {
7217 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7218 }
7219 }
7220
7221 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7222 }
7223 unsafe {
7224 preallocated.write_next(out.assume_init_ref());
7225 }
7226 }
7227
7228 ::fidl_next::WireTable::encode_len(table, max_ord);
7229
7230 Ok(())
7231 }
7232}
7233
7234impl<'de> ::fidl_next::FromWire<WireDictionary<'de>> for Dictionary {
7235 #[inline]
7236 fn from_wire(wire: WireDictionary<'de>) -> Self {
7237 let wire = ::core::mem::ManuallyDrop::new(wire);
7238
7239 let name = wire.table.get(1);
7240
7241 let source = wire.table.get(2);
7242
7243 let source_dictionary = wire.table.get(3);
7244
7245 let source_path = wire.table.get(4);
7246
7247 Self {
7248 name: name.map(|envelope| {
7249 ::fidl_next::FromWire::from_wire(unsafe {
7250 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
7251 })
7252 }),
7253
7254 source: source.map(|envelope| {
7255 ::fidl_next::FromWire::from_wire(unsafe {
7256 envelope.read_unchecked::<crate::WireRef<'de>>()
7257 })
7258 }),
7259
7260 source_dictionary: source_dictionary.map(|envelope| {
7261 ::fidl_next::FromWire::from_wire(unsafe {
7262 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
7263 })
7264 }),
7265
7266 source_path: source_path.map(|envelope| {
7267 ::fidl_next::FromWire::from_wire(unsafe {
7268 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
7269 })
7270 }),
7271 }
7272 }
7273}
7274
7275impl<'de> ::fidl_next::FromWireRef<WireDictionary<'de>> for Dictionary {
7276 #[inline]
7277 fn from_wire_ref(wire: &WireDictionary<'de>) -> Self {
7278 Self {
7279 name: wire.table.get(1).map(|envelope| {
7280 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
7281 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
7282 })
7283 }),
7284
7285 source: wire.table.get(2).map(|envelope| {
7286 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
7287 envelope.deref_unchecked::<crate::WireRef<'de>>()
7288 })
7289 }),
7290
7291 source_dictionary: wire.table.get(3).map(|envelope| {
7292 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
7293 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
7294 })
7295 }),
7296
7297 source_path: wire.table.get(4).map(|envelope| {
7298 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
7299 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
7300 })
7301 }),
7302 }
7303 }
7304}
7305
7306#[repr(C)]
7308pub struct WireDictionary<'de> {
7309 table: ::fidl_next::WireTable<'de>,
7310}
7311
7312impl<'de> Drop for WireDictionary<'de> {
7313 fn drop(&mut self) {
7314 let _ = self
7315 .table
7316 .get(1)
7317 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
7318
7319 let _ = self
7320 .table
7321 .get(2)
7322 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
7323
7324 let _ = self
7325 .table
7326 .get(3)
7327 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
7328
7329 let _ = self
7330 .table
7331 .get(4)
7332 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
7333 }
7334}
7335
7336unsafe impl ::fidl_next::Wire for WireDictionary<'static> {
7337 type Decoded<'de> = WireDictionary<'de>;
7338
7339 #[inline]
7340 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
7341 ::fidl_next::munge!(let Self { table } = out);
7342 ::fidl_next::WireTable::zero_padding(table);
7343 }
7344}
7345
7346unsafe impl<___D> ::fidl_next::Decode<___D> for WireDictionary<'static>
7347where
7348 ___D: ::fidl_next::Decoder + ?Sized,
7349{
7350 fn decode(
7351 slot: ::fidl_next::Slot<'_, Self>,
7352 decoder: &mut ___D,
7353 ) -> Result<(), ::fidl_next::DecodeError> {
7354 ::fidl_next::munge!(let Self { table } = slot);
7355
7356 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
7357 match ordinal {
7358 0 => unsafe { ::core::hint::unreachable_unchecked() },
7359
7360 1 => {
7361 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
7362 slot.as_mut(),
7363 decoder,
7364 )?;
7365
7366 let name = unsafe {
7367 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
7368 };
7369
7370 if name.len() > 100 {
7371 return Err(::fidl_next::DecodeError::VectorTooLong {
7372 size: name.len() as u64,
7373 limit: 100,
7374 });
7375 }
7376
7377 Ok(())
7378 }
7379
7380 2 => {
7381 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
7382 slot.as_mut(),
7383 decoder,
7384 )?;
7385
7386 Ok(())
7387 }
7388
7389 3 => {
7390 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
7391 slot.as_mut(),
7392 decoder,
7393 )?;
7394
7395 let source_dictionary = unsafe {
7396 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
7397 };
7398
7399 if source_dictionary.len() > 1024 {
7400 return Err(::fidl_next::DecodeError::VectorTooLong {
7401 size: source_dictionary.len() as u64,
7402 limit: 1024,
7403 });
7404 }
7405
7406 Ok(())
7407 }
7408
7409 4 => {
7410 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
7411 slot.as_mut(),
7412 decoder,
7413 )?;
7414
7415 let source_path = unsafe {
7416 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
7417 };
7418
7419 if source_path.len() > 1024 {
7420 return Err(::fidl_next::DecodeError::VectorTooLong {
7421 size: source_path.len() as u64,
7422 limit: 1024,
7423 });
7424 }
7425
7426 Ok(())
7427 }
7428
7429 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
7430 }
7431 })
7432 }
7433}
7434
7435impl<'de> WireDictionary<'de> {
7436 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
7437 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
7438 }
7439
7440 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
7441 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
7442 }
7443
7444 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
7445 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
7446 }
7447
7448 pub fn source_path(&self) -> Option<&::fidl_next::WireString<'de>> {
7449 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
7450 }
7451}
7452
7453impl<'de> ::core::fmt::Debug for WireDictionary<'de> {
7454 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
7455 f.debug_struct("Dictionary")
7456 .field("name", &self.name())
7457 .field("source", &self.source())
7458 .field("source_dictionary", &self.source_dictionary())
7459 .field("source_path", &self.source_path())
7460 .finish()
7461 }
7462}
7463
7464#[doc = " Declares a capability defined by this component.\n"]
7465#[derive(Clone, Debug)]
7466pub enum Capability {
7467 Service(crate::Service),
7468
7469 Protocol(crate::Protocol),
7470
7471 Directory(crate::Directory),
7472
7473 Storage(crate::Storage),
7474
7475 Runner(crate::Runner),
7476
7477 Resolver(crate::Resolver),
7478
7479 EventStream(crate::EventStream),
7480
7481 Dictionary(crate::Dictionary),
7482
7483 Config(crate::Configuration),
7484
7485 UnknownOrdinal_(u64),
7486}
7487
7488impl ::fidl_next::Encodable for Capability {
7489 type Encoded = WireCapability<'static>;
7490}
7491
7492unsafe impl<___E> ::fidl_next::Encode<___E> for Capability
7493where
7494 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
7495
7496 ___E: ::fidl_next::Encoder,
7497{
7498 #[inline]
7499 fn encode(
7500 self,
7501 encoder: &mut ___E,
7502 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7503 ) -> Result<(), ::fidl_next::EncodeError> {
7504 ::fidl_next::munge!(let WireCapability { raw, _phantom: _ } = out);
7505
7506 match self {
7507 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::Service>(
7508 value, 1, encoder, raw,
7509 )?,
7510
7511 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::Protocol>(
7512 value, 2, encoder, raw,
7513 )?,
7514
7515 Self::Directory(value) => {
7516 ::fidl_next::RawWireUnion::encode_as::<___E, crate::Directory>(
7517 value, 3, encoder, raw,
7518 )?
7519 }
7520
7521 Self::Storage(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::Storage>(
7522 value, 4, encoder, raw,
7523 )?,
7524
7525 Self::Runner(value) => {
7526 ::fidl_next::RawWireUnion::encode_as::<___E, crate::Runner>(value, 5, encoder, raw)?
7527 }
7528
7529 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::Resolver>(
7530 value, 6, encoder, raw,
7531 )?,
7532
7533 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
7534 ___E,
7535 crate::EventStream,
7536 >(value, 8, encoder, raw)?,
7537
7538 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
7539 ___E,
7540 crate::Dictionary,
7541 >(value, 9, encoder, raw)?,
7542
7543 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
7544 ___E,
7545 crate::Configuration,
7546 >(value, 10, encoder, raw)?,
7547
7548 Self::UnknownOrdinal_(ordinal) => {
7549 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
7550 }
7551 }
7552
7553 Ok(())
7554 }
7555}
7556
7557unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Capability
7558where
7559 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
7560
7561 ___E: ::fidl_next::Encoder,
7562{
7563 #[inline]
7564 fn encode_ref(
7565 &self,
7566 encoder: &mut ___E,
7567 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7568 ) -> Result<(), ::fidl_next::EncodeError> {
7569 ::fidl_next::munge!(let WireCapability { raw, _phantom: _ } = out);
7570
7571 match self {
7572 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Service>(
7573 value, 1, encoder, raw,
7574 )?,
7575
7576 Self::Protocol(value) => {
7577 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Protocol>(
7578 value, 2, encoder, raw,
7579 )?
7580 }
7581
7582 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
7583 ___E,
7584 &crate::Directory,
7585 >(value, 3, encoder, raw)?,
7586
7587 Self::Storage(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Storage>(
7588 value, 4, encoder, raw,
7589 )?,
7590
7591 Self::Runner(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Runner>(
7592 value, 5, encoder, raw,
7593 )?,
7594
7595 Self::Resolver(value) => {
7596 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Resolver>(
7597 value, 6, encoder, raw,
7598 )?
7599 }
7600
7601 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
7602 ___E,
7603 &crate::EventStream,
7604 >(value, 8, encoder, raw)?,
7605
7606 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
7607 ___E,
7608 &crate::Dictionary,
7609 >(value, 9, encoder, raw)?,
7610
7611 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
7612 ___E,
7613 &crate::Configuration,
7614 >(value, 10, encoder, raw)?,
7615
7616 Self::UnknownOrdinal_(ordinal) => {
7617 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
7618 }
7619 }
7620
7621 Ok(())
7622 }
7623}
7624
7625impl ::fidl_next::EncodableOption for Capability {
7626 type EncodedOption = WireOptionalCapability<'static>;
7627}
7628
7629unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Capability
7630where
7631 ___E: ?Sized,
7632 Capability: ::fidl_next::Encode<___E>,
7633{
7634 #[inline]
7635 fn encode_option(
7636 this: Option<Self>,
7637 encoder: &mut ___E,
7638 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
7639 ) -> Result<(), ::fidl_next::EncodeError> {
7640 ::fidl_next::munge!(let WireOptionalCapability { raw, _phantom: _ } = &mut *out);
7641
7642 if let Some(inner) = this {
7643 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
7644 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
7645 } else {
7646 ::fidl_next::RawWireUnion::encode_absent(raw);
7647 }
7648
7649 Ok(())
7650 }
7651}
7652
7653unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Capability
7654where
7655 ___E: ?Sized,
7656 Capability: ::fidl_next::EncodeRef<___E>,
7657{
7658 #[inline]
7659 fn encode_option_ref(
7660 this: Option<&Self>,
7661 encoder: &mut ___E,
7662 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
7663 ) -> Result<(), ::fidl_next::EncodeError> {
7664 ::fidl_next::munge!(let WireOptionalCapability { raw, _phantom: _ } = &mut *out);
7665
7666 if let Some(inner) = this {
7667 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
7668 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
7669 } else {
7670 ::fidl_next::RawWireUnion::encode_absent(raw);
7671 }
7672
7673 Ok(())
7674 }
7675}
7676
7677impl<'de> ::fidl_next::FromWire<WireCapability<'de>> for Capability {
7678 #[inline]
7679 fn from_wire(wire: WireCapability<'de>) -> Self {
7680 let wire = ::core::mem::ManuallyDrop::new(wire);
7681 match wire.raw.ordinal() {
7682 1 => Self::Service(::fidl_next::FromWire::from_wire(unsafe {
7683 wire.raw.get().read_unchecked::<crate::WireService<'de>>()
7684 })),
7685
7686 2 => Self::Protocol(::fidl_next::FromWire::from_wire(unsafe {
7687 wire.raw.get().read_unchecked::<crate::WireProtocol<'de>>()
7688 })),
7689
7690 3 => Self::Directory(::fidl_next::FromWire::from_wire(unsafe {
7691 wire.raw.get().read_unchecked::<crate::WireDirectory<'de>>()
7692 })),
7693
7694 4 => Self::Storage(::fidl_next::FromWire::from_wire(unsafe {
7695 wire.raw.get().read_unchecked::<crate::WireStorage<'de>>()
7696 })),
7697
7698 5 => Self::Runner(::fidl_next::FromWire::from_wire(unsafe {
7699 wire.raw.get().read_unchecked::<crate::WireRunner<'de>>()
7700 })),
7701
7702 6 => Self::Resolver(::fidl_next::FromWire::from_wire(unsafe {
7703 wire.raw.get().read_unchecked::<crate::WireResolver<'de>>()
7704 })),
7705
7706 8 => Self::EventStream(::fidl_next::FromWire::from_wire(unsafe {
7707 wire.raw.get().read_unchecked::<crate::WireEventStream<'de>>()
7708 })),
7709
7710 9 => Self::Dictionary(::fidl_next::FromWire::from_wire(unsafe {
7711 wire.raw.get().read_unchecked::<crate::WireDictionary<'de>>()
7712 })),
7713
7714 10 => Self::Config(::fidl_next::FromWire::from_wire(unsafe {
7715 wire.raw.get().read_unchecked::<crate::WireConfiguration<'de>>()
7716 })),
7717
7718 _ => unsafe { ::core::hint::unreachable_unchecked() },
7719 }
7720 }
7721}
7722
7723impl<'de> ::fidl_next::FromWireRef<WireCapability<'de>> for Capability {
7724 #[inline]
7725 fn from_wire_ref(wire: &WireCapability<'de>) -> Self {
7726 match wire.raw.ordinal() {
7727 1 => Self::Service(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7728 wire.raw.get().deref_unchecked::<crate::WireService<'de>>()
7729 })),
7730
7731 2 => Self::Protocol(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7732 wire.raw.get().deref_unchecked::<crate::WireProtocol<'de>>()
7733 })),
7734
7735 3 => Self::Directory(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7736 wire.raw.get().deref_unchecked::<crate::WireDirectory<'de>>()
7737 })),
7738
7739 4 => Self::Storage(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7740 wire.raw.get().deref_unchecked::<crate::WireStorage<'de>>()
7741 })),
7742
7743 5 => Self::Runner(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7744 wire.raw.get().deref_unchecked::<crate::WireRunner<'de>>()
7745 })),
7746
7747 6 => Self::Resolver(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7748 wire.raw.get().deref_unchecked::<crate::WireResolver<'de>>()
7749 })),
7750
7751 8 => Self::EventStream(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7752 wire.raw.get().deref_unchecked::<crate::WireEventStream<'de>>()
7753 })),
7754
7755 9 => Self::Dictionary(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7756 wire.raw.get().deref_unchecked::<crate::WireDictionary<'de>>()
7757 })),
7758
7759 10 => Self::Config(::fidl_next::FromWireRef::from_wire_ref(unsafe {
7760 wire.raw.get().deref_unchecked::<crate::WireConfiguration<'de>>()
7761 })),
7762
7763 _ => unsafe { ::core::hint::unreachable_unchecked() },
7764 }
7765 }
7766}
7767
7768impl<'de> ::fidl_next::FromWireOption<WireOptionalCapability<'de>> for Box<Capability> {
7769 #[inline]
7770 fn from_wire_option(wire: WireOptionalCapability<'de>) -> Option<Self> {
7771 if let Some(inner) = wire.into_option() {
7772 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
7773 } else {
7774 None
7775 }
7776 }
7777}
7778
7779impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalCapability<'de>> for Box<Capability> {
7780 #[inline]
7781 fn from_wire_option_ref(wire: &WireOptionalCapability<'de>) -> Option<Self> {
7782 if let Some(inner) = wire.as_ref() {
7783 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
7784 } else {
7785 None
7786 }
7787 }
7788}
7789
7790#[repr(transparent)]
7792pub struct WireCapability<'de> {
7793 raw: ::fidl_next::RawWireUnion,
7794 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
7795}
7796
7797impl<'de> Drop for WireCapability<'de> {
7798 fn drop(&mut self) {
7799 match self.raw.ordinal() {
7800 1 => {
7801 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireService<'de>>() };
7802 }
7803
7804 2 => {
7805 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireProtocol<'de>>() };
7806 }
7807
7808 3 => {
7809 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireDirectory<'de>>() };
7810 }
7811
7812 4 => {
7813 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireStorage<'de>>() };
7814 }
7815
7816 5 => {
7817 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireRunner<'de>>() };
7818 }
7819
7820 6 => {
7821 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireResolver<'de>>() };
7822 }
7823
7824 8 => {
7825 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireEventStream<'de>>() };
7826 }
7827
7828 9 => {
7829 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireDictionary<'de>>() };
7830 }
7831
7832 10 => {
7833 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireConfiguration<'de>>() };
7834 }
7835
7836 _ => (),
7837 }
7838 }
7839}
7840
7841unsafe impl ::fidl_next::Wire for WireCapability<'static> {
7842 type Decoded<'de> = WireCapability<'de>;
7843
7844 #[inline]
7845 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
7846 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
7847 ::fidl_next::RawWireUnion::zero_padding(raw);
7848 }
7849}
7850
7851pub mod capability {
7852 pub enum Ref<'de> {
7853 Service(&'de crate::WireService<'de>),
7854
7855 Protocol(&'de crate::WireProtocol<'de>),
7856
7857 Directory(&'de crate::WireDirectory<'de>),
7858
7859 Storage(&'de crate::WireStorage<'de>),
7860
7861 Runner(&'de crate::WireRunner<'de>),
7862
7863 Resolver(&'de crate::WireResolver<'de>),
7864
7865 EventStream(&'de crate::WireEventStream<'de>),
7866
7867 Dictionary(&'de crate::WireDictionary<'de>),
7868
7869 Config(&'de crate::WireConfiguration<'de>),
7870
7871 UnknownOrdinal_(u64),
7872 }
7873}
7874
7875impl<'de> WireCapability<'de> {
7876 pub fn as_ref(&self) -> crate::capability::Ref<'_> {
7877 match self.raw.ordinal() {
7878 1 => crate::capability::Ref::Service(unsafe {
7879 self.raw.get().deref_unchecked::<crate::WireService<'_>>()
7880 }),
7881
7882 2 => crate::capability::Ref::Protocol(unsafe {
7883 self.raw.get().deref_unchecked::<crate::WireProtocol<'_>>()
7884 }),
7885
7886 3 => crate::capability::Ref::Directory(unsafe {
7887 self.raw.get().deref_unchecked::<crate::WireDirectory<'_>>()
7888 }),
7889
7890 4 => crate::capability::Ref::Storage(unsafe {
7891 self.raw.get().deref_unchecked::<crate::WireStorage<'_>>()
7892 }),
7893
7894 5 => crate::capability::Ref::Runner(unsafe {
7895 self.raw.get().deref_unchecked::<crate::WireRunner<'_>>()
7896 }),
7897
7898 6 => crate::capability::Ref::Resolver(unsafe {
7899 self.raw.get().deref_unchecked::<crate::WireResolver<'_>>()
7900 }),
7901
7902 8 => crate::capability::Ref::EventStream(unsafe {
7903 self.raw.get().deref_unchecked::<crate::WireEventStream<'_>>()
7904 }),
7905
7906 9 => crate::capability::Ref::Dictionary(unsafe {
7907 self.raw.get().deref_unchecked::<crate::WireDictionary<'_>>()
7908 }),
7909
7910 10 => crate::capability::Ref::Config(unsafe {
7911 self.raw.get().deref_unchecked::<crate::WireConfiguration<'_>>()
7912 }),
7913
7914 unknown => crate::capability::Ref::UnknownOrdinal_(unknown),
7915 }
7916 }
7917}
7918
7919unsafe impl<___D> ::fidl_next::Decode<___D> for WireCapability<'static>
7920where
7921 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
7922
7923 ___D: ::fidl_next::Decoder,
7924{
7925 fn decode(
7926 mut slot: ::fidl_next::Slot<'_, Self>,
7927 decoder: &mut ___D,
7928 ) -> Result<(), ::fidl_next::DecodeError> {
7929 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
7930 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
7931 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireService<'static>>(
7932 raw, decoder,
7933 )?,
7934
7935 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireProtocol<'static>>(
7936 raw, decoder,
7937 )?,
7938
7939 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDirectory<'static>>(
7940 raw, decoder,
7941 )?,
7942
7943 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireStorage<'static>>(
7944 raw, decoder,
7945 )?,
7946
7947 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireRunner<'static>>(
7948 raw, decoder,
7949 )?,
7950
7951 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireResolver<'static>>(
7952 raw, decoder,
7953 )?,
7954
7955 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireEventStream<'static>>(
7956 raw, decoder,
7957 )?,
7958
7959 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDictionary<'static>>(
7960 raw, decoder,
7961 )?,
7962
7963 10 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfiguration<'static>>(
7964 raw, decoder,
7965 )?,
7966
7967 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
7968 }
7969
7970 Ok(())
7971 }
7972}
7973
7974impl<'de> ::core::fmt::Debug for WireCapability<'de> {
7975 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7976 match self.raw.ordinal() {
7977 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireService<'_>>().fmt(f) },
7978 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireProtocol<'_>>().fmt(f) },
7979 3 => unsafe { self.raw.get().deref_unchecked::<crate::WireDirectory<'_>>().fmt(f) },
7980 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireStorage<'_>>().fmt(f) },
7981 5 => unsafe { self.raw.get().deref_unchecked::<crate::WireRunner<'_>>().fmt(f) },
7982 6 => unsafe { self.raw.get().deref_unchecked::<crate::WireResolver<'_>>().fmt(f) },
7983 8 => unsafe { self.raw.get().deref_unchecked::<crate::WireEventStream<'_>>().fmt(f) },
7984 9 => unsafe { self.raw.get().deref_unchecked::<crate::WireDictionary<'_>>().fmt(f) },
7985 10 => unsafe {
7986 self.raw.get().deref_unchecked::<crate::WireConfiguration<'_>>().fmt(f)
7987 },
7988 _ => unsafe { ::core::hint::unreachable_unchecked() },
7989 }
7990 }
7991}
7992
7993#[repr(transparent)]
7994pub struct WireOptionalCapability<'de> {
7995 raw: ::fidl_next::RawWireUnion,
7996 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
7997}
7998
7999unsafe impl ::fidl_next::Wire for WireOptionalCapability<'static> {
8000 type Decoded<'de> = WireOptionalCapability<'de>;
8001
8002 #[inline]
8003 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
8004 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
8005 ::fidl_next::RawWireUnion::zero_padding(raw);
8006 }
8007}
8008
8009impl<'de> WireOptionalCapability<'de> {
8010 pub fn is_some(&self) -> bool {
8011 self.raw.is_some()
8012 }
8013
8014 pub fn is_none(&self) -> bool {
8015 self.raw.is_none()
8016 }
8017
8018 pub fn as_ref(&self) -> Option<&WireCapability<'de>> {
8019 if self.is_some() {
8020 Some(unsafe { &*(self as *const Self).cast() })
8021 } else {
8022 None
8023 }
8024 }
8025
8026 pub fn into_option(self) -> Option<WireCapability<'de>> {
8027 if self.is_some() {
8028 Some(WireCapability { raw: self.raw, _phantom: ::core::marker::PhantomData })
8029 } else {
8030 None
8031 }
8032 }
8033}
8034
8035unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalCapability<'static>
8036where
8037 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
8038
8039 ___D: ::fidl_next::Decoder,
8040{
8041 fn decode(
8042 mut slot: ::fidl_next::Slot<'_, Self>,
8043 decoder: &mut ___D,
8044 ) -> Result<(), ::fidl_next::DecodeError> {
8045 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
8046 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
8047 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireService<'static>>(
8048 raw, decoder,
8049 )?,
8050
8051 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireProtocol<'static>>(
8052 raw, decoder,
8053 )?,
8054
8055 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDirectory<'static>>(
8056 raw, decoder,
8057 )?,
8058
8059 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireStorage<'static>>(
8060 raw, decoder,
8061 )?,
8062
8063 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireRunner<'static>>(
8064 raw, decoder,
8065 )?,
8066
8067 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireResolver<'static>>(
8068 raw, decoder,
8069 )?,
8070
8071 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireEventStream<'static>>(
8072 raw, decoder,
8073 )?,
8074
8075 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDictionary<'static>>(
8076 raw, decoder,
8077 )?,
8078
8079 10 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfiguration<'static>>(
8080 raw, decoder,
8081 )?,
8082
8083 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
8084 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
8085 }
8086
8087 Ok(())
8088 }
8089}
8090
8091impl<'de> ::core::fmt::Debug for WireOptionalCapability<'de> {
8092 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8093 self.as_ref().fmt(f)
8094 }
8095}
8096
8097#[doc = " Describes under what conditions the component may be started.\n"]
8098#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8099#[repr(u32)]
8100pub enum StartupMode {
8101 Lazy = 0,
8102 Eager = 1,
8103}
8104
8105impl ::fidl_next::Encodable for StartupMode {
8106 type Encoded = WireStartupMode;
8107}
8108impl ::std::convert::TryFrom<u32> for StartupMode {
8109 type Error = ::fidl_next::UnknownStrictEnumMemberError;
8110 fn try_from(value: u32) -> Result<Self, Self::Error> {
8111 match value {
8112 0 => Ok(Self::Lazy),
8113 1 => Ok(Self::Eager),
8114
8115 _ => Err(Self::Error::new(value.into())),
8116 }
8117 }
8118}
8119
8120unsafe impl<___E> ::fidl_next::Encode<___E> for StartupMode
8121where
8122 ___E: ?Sized,
8123{
8124 #[inline]
8125 fn encode(
8126 self,
8127 encoder: &mut ___E,
8128 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8129 ) -> Result<(), ::fidl_next::EncodeError> {
8130 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
8131 }
8132}
8133
8134unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StartupMode
8135where
8136 ___E: ?Sized,
8137{
8138 #[inline]
8139 fn encode_ref(
8140 &self,
8141 encoder: &mut ___E,
8142 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8143 ) -> Result<(), ::fidl_next::EncodeError> {
8144 ::fidl_next::munge!(let WireStartupMode { value } = out);
8145 let _ = value.write(::fidl_next::WireU32::from(match *self {
8146 Self::Lazy => 0,
8147
8148 Self::Eager => 1,
8149 }));
8150
8151 Ok(())
8152 }
8153}
8154
8155impl ::core::convert::From<WireStartupMode> for StartupMode {
8156 fn from(wire: WireStartupMode) -> Self {
8157 match u32::from(wire.value) {
8158 0 => Self::Lazy,
8159
8160 1 => Self::Eager,
8161
8162 _ => unsafe { ::core::hint::unreachable_unchecked() },
8163 }
8164 }
8165}
8166
8167impl ::fidl_next::FromWire<WireStartupMode> for StartupMode {
8168 #[inline]
8169 fn from_wire(wire: WireStartupMode) -> Self {
8170 Self::from(wire)
8171 }
8172}
8173
8174impl ::fidl_next::FromWireRef<WireStartupMode> for StartupMode {
8175 #[inline]
8176 fn from_wire_ref(wire: &WireStartupMode) -> Self {
8177 Self::from(*wire)
8178 }
8179}
8180
8181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8183#[repr(transparent)]
8184pub struct WireStartupMode {
8185 value: ::fidl_next::WireU32,
8186}
8187
8188unsafe impl ::fidl_next::Wire for WireStartupMode {
8189 type Decoded<'de> = Self;
8190
8191 #[inline]
8192 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
8193 }
8195}
8196
8197impl WireStartupMode {
8198 pub const LAZY: WireStartupMode = WireStartupMode { value: ::fidl_next::WireU32(0) };
8199
8200 pub const EAGER: WireStartupMode = WireStartupMode { value: ::fidl_next::WireU32(1) };
8201}
8202
8203unsafe impl<___D> ::fidl_next::Decode<___D> for WireStartupMode
8204where
8205 ___D: ?Sized,
8206{
8207 fn decode(
8208 slot: ::fidl_next::Slot<'_, Self>,
8209 _: &mut ___D,
8210 ) -> Result<(), ::fidl_next::DecodeError> {
8211 ::fidl_next::munge!(let Self { value } = slot);
8212
8213 match u32::from(*value) {
8214 0 | 1 => (),
8215 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
8216 }
8217
8218 Ok(())
8219 }
8220}
8221
8222impl ::core::convert::From<StartupMode> for WireStartupMode {
8223 fn from(natural: StartupMode) -> Self {
8224 match natural {
8225 StartupMode::Lazy => WireStartupMode::LAZY,
8226
8227 StartupMode::Eager => WireStartupMode::EAGER,
8228 }
8229 }
8230}
8231
8232#[doc = " Describes the action to take if this component instance terminates\n unexpectedly.\n"]
8233#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8234#[repr(u32)]
8235pub enum OnTerminate {
8236 None = 0,
8237 Reboot = 1,
8238}
8239
8240impl ::fidl_next::Encodable for OnTerminate {
8241 type Encoded = WireOnTerminate;
8242}
8243impl ::std::convert::TryFrom<u32> for OnTerminate {
8244 type Error = ::fidl_next::UnknownStrictEnumMemberError;
8245 fn try_from(value: u32) -> Result<Self, Self::Error> {
8246 match value {
8247 0 => Ok(Self::None),
8248 1 => Ok(Self::Reboot),
8249
8250 _ => Err(Self::Error::new(value.into())),
8251 }
8252 }
8253}
8254
8255unsafe impl<___E> ::fidl_next::Encode<___E> for OnTerminate
8256where
8257 ___E: ?Sized,
8258{
8259 #[inline]
8260 fn encode(
8261 self,
8262 encoder: &mut ___E,
8263 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8264 ) -> Result<(), ::fidl_next::EncodeError> {
8265 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
8266 }
8267}
8268
8269unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OnTerminate
8270where
8271 ___E: ?Sized,
8272{
8273 #[inline]
8274 fn encode_ref(
8275 &self,
8276 encoder: &mut ___E,
8277 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8278 ) -> Result<(), ::fidl_next::EncodeError> {
8279 ::fidl_next::munge!(let WireOnTerminate { value } = out);
8280 let _ = value.write(::fidl_next::WireU32::from(match *self {
8281 Self::None => 0,
8282
8283 Self::Reboot => 1,
8284 }));
8285
8286 Ok(())
8287 }
8288}
8289
8290impl ::core::convert::From<WireOnTerminate> for OnTerminate {
8291 fn from(wire: WireOnTerminate) -> Self {
8292 match u32::from(wire.value) {
8293 0 => Self::None,
8294
8295 1 => Self::Reboot,
8296
8297 _ => unsafe { ::core::hint::unreachable_unchecked() },
8298 }
8299 }
8300}
8301
8302impl ::fidl_next::FromWire<WireOnTerminate> for OnTerminate {
8303 #[inline]
8304 fn from_wire(wire: WireOnTerminate) -> Self {
8305 Self::from(wire)
8306 }
8307}
8308
8309impl ::fidl_next::FromWireRef<WireOnTerminate> for OnTerminate {
8310 #[inline]
8311 fn from_wire_ref(wire: &WireOnTerminate) -> Self {
8312 Self::from(*wire)
8313 }
8314}
8315
8316#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8318#[repr(transparent)]
8319pub struct WireOnTerminate {
8320 value: ::fidl_next::WireU32,
8321}
8322
8323unsafe impl ::fidl_next::Wire for WireOnTerminate {
8324 type Decoded<'de> = Self;
8325
8326 #[inline]
8327 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
8328 }
8330}
8331
8332impl WireOnTerminate {
8333 pub const NONE: WireOnTerminate = WireOnTerminate { value: ::fidl_next::WireU32(0) };
8334
8335 pub const REBOOT: WireOnTerminate = WireOnTerminate { value: ::fidl_next::WireU32(1) };
8336}
8337
8338unsafe impl<___D> ::fidl_next::Decode<___D> for WireOnTerminate
8339where
8340 ___D: ?Sized,
8341{
8342 fn decode(
8343 slot: ::fidl_next::Slot<'_, Self>,
8344 _: &mut ___D,
8345 ) -> Result<(), ::fidl_next::DecodeError> {
8346 ::fidl_next::munge!(let Self { value } = slot);
8347
8348 match u32::from(*value) {
8349 0 | 1 => (),
8350 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
8351 }
8352
8353 Ok(())
8354 }
8355}
8356
8357impl ::core::convert::From<OnTerminate> for WireOnTerminate {
8358 fn from(natural: OnTerminate) -> Self {
8359 match natural {
8360 OnTerminate::None => WireOnTerminate::NONE,
8361
8362 OnTerminate::Reboot => WireOnTerminate::REBOOT,
8363 }
8364 }
8365}
8366
8367#[doc = " The string identifier for a config field.\n"]
8368pub type ConfigKey = String;
8369
8370pub type WireConfigKey<'de> = ::fidl_next::WireString<'de>;
8372
8373#[doc = " A directive to override the value of a particular configuration field in the child.\n"]
8374#[derive(Clone, Debug, Default)]
8375pub struct ConfigOverride {
8376 pub key: Option<String>,
8377
8378 pub value: Option<crate::ConfigValue>,
8379}
8380
8381impl ConfigOverride {
8382 fn __max_ordinal(&self) -> usize {
8383 if self.value.is_some() {
8384 return 2;
8385 }
8386
8387 if self.key.is_some() {
8388 return 1;
8389 }
8390
8391 0
8392 }
8393}
8394
8395impl ::fidl_next::Encodable for ConfigOverride {
8396 type Encoded = WireConfigOverride<'static>;
8397}
8398
8399unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigOverride
8400where
8401 ___E: ::fidl_next::Encoder + ?Sized,
8402{
8403 #[inline]
8404 fn encode(
8405 mut self,
8406 encoder: &mut ___E,
8407 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8408 ) -> Result<(), ::fidl_next::EncodeError> {
8409 ::fidl_next::munge!(let WireConfigOverride { table } = out);
8410
8411 let max_ord = self.__max_ordinal();
8412
8413 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
8414 ::fidl_next::Wire::zero_padding(&mut out);
8415
8416 let mut preallocated =
8417 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
8418
8419 for i in 1..=max_ord {
8420 match i {
8421 2 => {
8422 if let Some(value) = self.value.take() {
8423 ::fidl_next::WireEnvelope::encode_value(
8424 value,
8425 preallocated.encoder,
8426 &mut out,
8427 )?;
8428 } else {
8429 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8430 }
8431 }
8432
8433 1 => {
8434 if let Some(key) = self.key.take() {
8435 ::fidl_next::WireEnvelope::encode_value(
8436 key,
8437 preallocated.encoder,
8438 &mut out,
8439 )?;
8440 } else {
8441 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8442 }
8443 }
8444
8445 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
8446 }
8447 unsafe {
8448 preallocated.write_next(out.assume_init_ref());
8449 }
8450 }
8451
8452 ::fidl_next::WireTable::encode_len(table, max_ord);
8453
8454 Ok(())
8455 }
8456}
8457
8458unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigOverride
8459where
8460 ___E: ::fidl_next::Encoder + ?Sized,
8461{
8462 #[inline]
8463 fn encode_ref(
8464 &self,
8465 encoder: &mut ___E,
8466 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8467 ) -> Result<(), ::fidl_next::EncodeError> {
8468 ::fidl_next::munge!(let WireConfigOverride { table } = out);
8469
8470 let max_ord = self.__max_ordinal();
8471
8472 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
8473 ::fidl_next::Wire::zero_padding(&mut out);
8474
8475 let mut preallocated =
8476 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
8477
8478 for i in 1..=max_ord {
8479 match i {
8480 2 => {
8481 if let Some(value) = &self.value {
8482 ::fidl_next::WireEnvelope::encode_value(
8483 value,
8484 preallocated.encoder,
8485 &mut out,
8486 )?;
8487 } else {
8488 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8489 }
8490 }
8491
8492 1 => {
8493 if let Some(key) = &self.key {
8494 ::fidl_next::WireEnvelope::encode_value(
8495 key,
8496 preallocated.encoder,
8497 &mut out,
8498 )?;
8499 } else {
8500 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8501 }
8502 }
8503
8504 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
8505 }
8506 unsafe {
8507 preallocated.write_next(out.assume_init_ref());
8508 }
8509 }
8510
8511 ::fidl_next::WireTable::encode_len(table, max_ord);
8512
8513 Ok(())
8514 }
8515}
8516
8517impl<'de> ::fidl_next::FromWire<WireConfigOverride<'de>> for ConfigOverride {
8518 #[inline]
8519 fn from_wire(wire: WireConfigOverride<'de>) -> Self {
8520 let wire = ::core::mem::ManuallyDrop::new(wire);
8521
8522 let key = wire.table.get(1);
8523
8524 let value = wire.table.get(2);
8525
8526 Self {
8527 key: key.map(|envelope| {
8528 ::fidl_next::FromWire::from_wire(unsafe {
8529 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
8530 })
8531 }),
8532
8533 value: value.map(|envelope| {
8534 ::fidl_next::FromWire::from_wire(unsafe {
8535 envelope.read_unchecked::<crate::WireConfigValue<'de>>()
8536 })
8537 }),
8538 }
8539 }
8540}
8541
8542impl<'de> ::fidl_next::FromWireRef<WireConfigOverride<'de>> for ConfigOverride {
8543 #[inline]
8544 fn from_wire_ref(wire: &WireConfigOverride<'de>) -> Self {
8545 Self {
8546 key: wire.table.get(1).map(|envelope| {
8547 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
8548 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
8549 })
8550 }),
8551
8552 value: wire.table.get(2).map(|envelope| {
8553 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
8554 envelope.deref_unchecked::<crate::WireConfigValue<'de>>()
8555 })
8556 }),
8557 }
8558 }
8559}
8560
8561#[repr(C)]
8563pub struct WireConfigOverride<'de> {
8564 table: ::fidl_next::WireTable<'de>,
8565}
8566
8567impl<'de> Drop for WireConfigOverride<'de> {
8568 fn drop(&mut self) {
8569 let _ = self
8570 .table
8571 .get(1)
8572 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
8573
8574 let _ = self
8575 .table
8576 .get(2)
8577 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigValue<'de>>() });
8578 }
8579}
8580
8581unsafe impl ::fidl_next::Wire for WireConfigOverride<'static> {
8582 type Decoded<'de> = WireConfigOverride<'de>;
8583
8584 #[inline]
8585 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
8586 ::fidl_next::munge!(let Self { table } = out);
8587 ::fidl_next::WireTable::zero_padding(table);
8588 }
8589}
8590
8591unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigOverride<'static>
8592where
8593 ___D: ::fidl_next::Decoder + ?Sized,
8594{
8595 fn decode(
8596 slot: ::fidl_next::Slot<'_, Self>,
8597 decoder: &mut ___D,
8598 ) -> Result<(), ::fidl_next::DecodeError> {
8599 ::fidl_next::munge!(let Self { table } = slot);
8600
8601 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
8602 match ordinal {
8603 0 => unsafe { ::core::hint::unreachable_unchecked() },
8604
8605 1 => {
8606 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
8607 slot.as_mut(),
8608 decoder,
8609 )?;
8610
8611 let key = unsafe {
8612 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
8613 };
8614
8615 if key.len() > 64 {
8616 return Err(::fidl_next::DecodeError::VectorTooLong {
8617 size: key.len() as u64,
8618 limit: 64,
8619 });
8620 }
8621
8622 Ok(())
8623 }
8624
8625 2 => {
8626 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValue<'static>>(
8627 slot.as_mut(),
8628 decoder,
8629 )?;
8630
8631 Ok(())
8632 }
8633
8634 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
8635 }
8636 })
8637 }
8638}
8639
8640impl<'de> WireConfigOverride<'de> {
8641 pub fn key(&self) -> Option<&::fidl_next::WireString<'de>> {
8642 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
8643 }
8644
8645 pub fn value(&self) -> Option<&crate::WireConfigValue<'de>> {
8646 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
8647 }
8648}
8649
8650impl<'de> ::core::fmt::Debug for WireConfigOverride<'de> {
8651 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
8652 f.debug_struct("ConfigOverride")
8653 .field("key", &self.key())
8654 .field("value", &self.value())
8655 .finish()
8656 }
8657}
8658
8659#[doc = " Statically declares a child component instance.\n"]
8660#[derive(Clone, Debug, Default)]
8661pub struct Child {
8662 pub name: Option<String>,
8663
8664 pub url: Option<String>,
8665
8666 pub startup: Option<crate::StartupMode>,
8667
8668 pub environment: Option<String>,
8669
8670 pub on_terminate: Option<crate::OnTerminate>,
8671
8672 pub config_overrides: Option<Vec<crate::ConfigOverride>>,
8673}
8674
8675impl Child {
8676 fn __max_ordinal(&self) -> usize {
8677 if self.config_overrides.is_some() {
8678 return 6;
8679 }
8680
8681 if self.on_terminate.is_some() {
8682 return 5;
8683 }
8684
8685 if self.environment.is_some() {
8686 return 4;
8687 }
8688
8689 if self.startup.is_some() {
8690 return 3;
8691 }
8692
8693 if self.url.is_some() {
8694 return 2;
8695 }
8696
8697 if self.name.is_some() {
8698 return 1;
8699 }
8700
8701 0
8702 }
8703}
8704
8705impl ::fidl_next::Encodable for Child {
8706 type Encoded = WireChild<'static>;
8707}
8708
8709unsafe impl<___E> ::fidl_next::Encode<___E> for Child
8710where
8711 ___E: ::fidl_next::Encoder + ?Sized,
8712{
8713 #[inline]
8714 fn encode(
8715 mut self,
8716 encoder: &mut ___E,
8717 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8718 ) -> Result<(), ::fidl_next::EncodeError> {
8719 ::fidl_next::munge!(let WireChild { table } = out);
8720
8721 let max_ord = self.__max_ordinal();
8722
8723 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
8724 ::fidl_next::Wire::zero_padding(&mut out);
8725
8726 let mut preallocated =
8727 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
8728
8729 for i in 1..=max_ord {
8730 match i {
8731 6 => {
8732 if let Some(config_overrides) = self.config_overrides.take() {
8733 ::fidl_next::WireEnvelope::encode_value(
8734 config_overrides,
8735 preallocated.encoder,
8736 &mut out,
8737 )?;
8738 } else {
8739 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8740 }
8741 }
8742
8743 5 => {
8744 if let Some(on_terminate) = self.on_terminate.take() {
8745 ::fidl_next::WireEnvelope::encode_value(
8746 on_terminate,
8747 preallocated.encoder,
8748 &mut out,
8749 )?;
8750 } else {
8751 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8752 }
8753 }
8754
8755 4 => {
8756 if let Some(environment) = self.environment.take() {
8757 ::fidl_next::WireEnvelope::encode_value(
8758 environment,
8759 preallocated.encoder,
8760 &mut out,
8761 )?;
8762 } else {
8763 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8764 }
8765 }
8766
8767 3 => {
8768 if let Some(startup) = self.startup.take() {
8769 ::fidl_next::WireEnvelope::encode_value(
8770 startup,
8771 preallocated.encoder,
8772 &mut out,
8773 )?;
8774 } else {
8775 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8776 }
8777 }
8778
8779 2 => {
8780 if let Some(url) = self.url.take() {
8781 ::fidl_next::WireEnvelope::encode_value(
8782 url,
8783 preallocated.encoder,
8784 &mut out,
8785 )?;
8786 } else {
8787 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8788 }
8789 }
8790
8791 1 => {
8792 if let Some(name) = self.name.take() {
8793 ::fidl_next::WireEnvelope::encode_value(
8794 name,
8795 preallocated.encoder,
8796 &mut out,
8797 )?;
8798 } else {
8799 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8800 }
8801 }
8802
8803 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
8804 }
8805 unsafe {
8806 preallocated.write_next(out.assume_init_ref());
8807 }
8808 }
8809
8810 ::fidl_next::WireTable::encode_len(table, max_ord);
8811
8812 Ok(())
8813 }
8814}
8815
8816unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Child
8817where
8818 ___E: ::fidl_next::Encoder + ?Sized,
8819{
8820 #[inline]
8821 fn encode_ref(
8822 &self,
8823 encoder: &mut ___E,
8824 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8825 ) -> Result<(), ::fidl_next::EncodeError> {
8826 ::fidl_next::munge!(let WireChild { table } = out);
8827
8828 let max_ord = self.__max_ordinal();
8829
8830 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
8831 ::fidl_next::Wire::zero_padding(&mut out);
8832
8833 let mut preallocated =
8834 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
8835
8836 for i in 1..=max_ord {
8837 match i {
8838 6 => {
8839 if let Some(config_overrides) = &self.config_overrides {
8840 ::fidl_next::WireEnvelope::encode_value(
8841 config_overrides,
8842 preallocated.encoder,
8843 &mut out,
8844 )?;
8845 } else {
8846 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8847 }
8848 }
8849
8850 5 => {
8851 if let Some(on_terminate) = &self.on_terminate {
8852 ::fidl_next::WireEnvelope::encode_value(
8853 on_terminate,
8854 preallocated.encoder,
8855 &mut out,
8856 )?;
8857 } else {
8858 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8859 }
8860 }
8861
8862 4 => {
8863 if let Some(environment) = &self.environment {
8864 ::fidl_next::WireEnvelope::encode_value(
8865 environment,
8866 preallocated.encoder,
8867 &mut out,
8868 )?;
8869 } else {
8870 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8871 }
8872 }
8873
8874 3 => {
8875 if let Some(startup) = &self.startup {
8876 ::fidl_next::WireEnvelope::encode_value(
8877 startup,
8878 preallocated.encoder,
8879 &mut out,
8880 )?;
8881 } else {
8882 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8883 }
8884 }
8885
8886 2 => {
8887 if let Some(url) = &self.url {
8888 ::fidl_next::WireEnvelope::encode_value(
8889 url,
8890 preallocated.encoder,
8891 &mut out,
8892 )?;
8893 } else {
8894 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8895 }
8896 }
8897
8898 1 => {
8899 if let Some(name) = &self.name {
8900 ::fidl_next::WireEnvelope::encode_value(
8901 name,
8902 preallocated.encoder,
8903 &mut out,
8904 )?;
8905 } else {
8906 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8907 }
8908 }
8909
8910 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
8911 }
8912 unsafe {
8913 preallocated.write_next(out.assume_init_ref());
8914 }
8915 }
8916
8917 ::fidl_next::WireTable::encode_len(table, max_ord);
8918
8919 Ok(())
8920 }
8921}
8922
8923impl<'de> ::fidl_next::FromWire<WireChild<'de>> for Child {
8924 #[inline]
8925 fn from_wire(wire: WireChild<'de>) -> Self {
8926 let wire = ::core::mem::ManuallyDrop::new(wire);
8927
8928 let name = wire.table.get(1);
8929
8930 let url = wire.table.get(2);
8931
8932 let startup = wire.table.get(3);
8933
8934 let environment = wire.table.get(4);
8935
8936 let on_terminate = wire.table.get(5);
8937
8938 let config_overrides = wire.table.get(6);
8939
8940 Self {
8941
8942
8943 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
8944 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
8945 )),
8946
8947
8948 url: url.map(|envelope| ::fidl_next::FromWire::from_wire(
8949 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
8950 )),
8951
8952
8953 startup: startup.map(|envelope| ::fidl_next::FromWire::from_wire(
8954 unsafe { envelope.read_unchecked::<crate::WireStartupMode>() }
8955 )),
8956
8957
8958 environment: environment.map(|envelope| ::fidl_next::FromWire::from_wire(
8959 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
8960 )),
8961
8962
8963 on_terminate: on_terminate.map(|envelope| ::fidl_next::FromWire::from_wire(
8964 unsafe { envelope.read_unchecked::<crate::WireOnTerminate>() }
8965 )),
8966
8967
8968 config_overrides: config_overrides.map(|envelope| ::fidl_next::FromWire::from_wire(
8969 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigOverride<'de>>>() }
8970 )),
8971
8972 }
8973 }
8974}
8975
8976impl<'de> ::fidl_next::FromWireRef<WireChild<'de>> for Child {
8977 #[inline]
8978 fn from_wire_ref(wire: &WireChild<'de>) -> Self {
8979 Self {
8980
8981
8982 name: wire.table.get(1)
8983 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
8984 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
8985 )),
8986
8987
8988 url: wire.table.get(2)
8989 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
8990 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
8991 )),
8992
8993
8994 startup: wire.table.get(3)
8995 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
8996 unsafe { envelope.deref_unchecked::<crate::WireStartupMode>() }
8997 )),
8998
8999
9000 environment: wire.table.get(4)
9001 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
9002 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
9003 )),
9004
9005
9006 on_terminate: wire.table.get(5)
9007 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
9008 unsafe { envelope.deref_unchecked::<crate::WireOnTerminate>() }
9009 )),
9010
9011
9012 config_overrides: wire.table.get(6)
9013 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
9014 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigOverride<'de>>>() }
9015 )),
9016
9017 }
9018 }
9019}
9020
9021#[repr(C)]
9023pub struct WireChild<'de> {
9024 table: ::fidl_next::WireTable<'de>,
9025}
9026
9027impl<'de> Drop for WireChild<'de> {
9028 fn drop(&mut self) {
9029 let _ = self
9030 .table
9031 .get(1)
9032 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
9033
9034 let _ = self
9035 .table
9036 .get(2)
9037 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
9038
9039 let _ = self
9040 .table
9041 .get(3)
9042 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireStartupMode>() });
9043
9044 let _ = self
9045 .table
9046 .get(4)
9047 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
9048
9049 let _ = self
9050 .table
9051 .get(5)
9052 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireOnTerminate>() });
9053
9054 let _ = self.table.get(6).map(|envelope| unsafe {
9055 envelope
9056 .read_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigOverride<'de>>>()
9057 });
9058 }
9059}
9060
9061unsafe impl ::fidl_next::Wire for WireChild<'static> {
9062 type Decoded<'de> = WireChild<'de>;
9063
9064 #[inline]
9065 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9066 ::fidl_next::munge!(let Self { table } = out);
9067 ::fidl_next::WireTable::zero_padding(table);
9068 }
9069}
9070
9071unsafe impl<___D> ::fidl_next::Decode<___D> for WireChild<'static>
9072where
9073 ___D: ::fidl_next::Decoder + ?Sized,
9074{
9075 fn decode(
9076 slot: ::fidl_next::Slot<'_, Self>,
9077 decoder: &mut ___D,
9078 ) -> Result<(), ::fidl_next::DecodeError> {
9079 ::fidl_next::munge!(let Self { table } = slot);
9080
9081 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
9082 match ordinal {
9083 0 => unsafe { ::core::hint::unreachable_unchecked() },
9084
9085 1 => {
9086 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
9087 slot.as_mut(),
9088 decoder,
9089 )?;
9090
9091 let name = unsafe {
9092 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
9093 };
9094
9095 if name.len() > 1024 {
9096 return Err(::fidl_next::DecodeError::VectorTooLong {
9097 size: name.len() as u64,
9098 limit: 1024,
9099 });
9100 }
9101
9102 Ok(())
9103 }
9104
9105 2 => {
9106 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
9107 slot.as_mut(),
9108 decoder,
9109 )?;
9110
9111 let url = unsafe {
9112 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
9113 };
9114
9115 if url.len() > 4096 {
9116 return Err(::fidl_next::DecodeError::VectorTooLong {
9117 size: url.len() as u64,
9118 limit: 4096,
9119 });
9120 }
9121
9122 Ok(())
9123 }
9124
9125 3 => {
9126 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireStartupMode>(
9127 slot.as_mut(),
9128 decoder,
9129 )?;
9130
9131 Ok(())
9132 }
9133
9134 4 => {
9135 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
9136 slot.as_mut(),
9137 decoder,
9138 )?;
9139
9140 let environment = unsafe {
9141 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
9142 };
9143
9144 if environment.len() > 100 {
9145 return Err(::fidl_next::DecodeError::VectorTooLong {
9146 size: environment.len() as u64,
9147 limit: 100,
9148 });
9149 }
9150
9151 Ok(())
9152 }
9153
9154 5 => {
9155 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireOnTerminate>(
9156 slot.as_mut(),
9157 decoder,
9158 )?;
9159
9160 Ok(())
9161 }
9162
9163 6 => {
9164 ::fidl_next::WireEnvelope::decode_as::<
9165 ___D,
9166 ::fidl_next::WireVector<'static, crate::WireConfigOverride<'static>>,
9167 >(slot.as_mut(), decoder)?;
9168
9169 Ok(())
9170 }
9171
9172 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
9173 }
9174 })
9175 }
9176}
9177
9178impl<'de> WireChild<'de> {
9179 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
9180 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
9181 }
9182
9183 pub fn url(&self) -> Option<&::fidl_next::WireString<'de>> {
9184 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
9185 }
9186
9187 pub fn startup(&self) -> Option<&crate::WireStartupMode> {
9188 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
9189 }
9190
9191 pub fn environment(&self) -> Option<&::fidl_next::WireString<'de>> {
9192 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
9193 }
9194
9195 pub fn on_terminate(&self) -> Option<&crate::WireOnTerminate> {
9196 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
9197 }
9198
9199 pub fn config_overrides(
9200 &self,
9201 ) -> Option<&::fidl_next::WireVector<'de, crate::WireConfigOverride<'de>>> {
9202 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
9203 }
9204}
9205
9206impl<'de> ::core::fmt::Debug for WireChild<'de> {
9207 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
9208 f.debug_struct("Child")
9209 .field("name", &self.name())
9210 .field("url", &self.url())
9211 .field("startup", &self.startup())
9212 .field("environment", &self.environment())
9213 .field("on_terminate", &self.on_terminate())
9214 .field("config_overrides", &self.config_overrides())
9215 .finish()
9216 }
9217}
9218
9219#[doc = " The durability of component instances created in a collection.\n"]
9220#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9221#[repr(u32)]
9222pub enum Durability {
9223 Transient = 2,
9224 SingleRun = 3,
9225}
9226
9227impl ::fidl_next::Encodable for Durability {
9228 type Encoded = WireDurability;
9229}
9230impl ::std::convert::TryFrom<u32> for Durability {
9231 type Error = ::fidl_next::UnknownStrictEnumMemberError;
9232 fn try_from(value: u32) -> Result<Self, Self::Error> {
9233 match value {
9234 2 => Ok(Self::Transient),
9235 3 => Ok(Self::SingleRun),
9236
9237 _ => Err(Self::Error::new(value.into())),
9238 }
9239 }
9240}
9241
9242unsafe impl<___E> ::fidl_next::Encode<___E> for Durability
9243where
9244 ___E: ?Sized,
9245{
9246 #[inline]
9247 fn encode(
9248 self,
9249 encoder: &mut ___E,
9250 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9251 ) -> Result<(), ::fidl_next::EncodeError> {
9252 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
9253 }
9254}
9255
9256unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Durability
9257where
9258 ___E: ?Sized,
9259{
9260 #[inline]
9261 fn encode_ref(
9262 &self,
9263 encoder: &mut ___E,
9264 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9265 ) -> Result<(), ::fidl_next::EncodeError> {
9266 ::fidl_next::munge!(let WireDurability { value } = out);
9267 let _ = value.write(::fidl_next::WireU32::from(match *self {
9268 Self::Transient => 2,
9269
9270 Self::SingleRun => 3,
9271 }));
9272
9273 Ok(())
9274 }
9275}
9276
9277impl ::core::convert::From<WireDurability> for Durability {
9278 fn from(wire: WireDurability) -> Self {
9279 match u32::from(wire.value) {
9280 2 => Self::Transient,
9281
9282 3 => Self::SingleRun,
9283
9284 _ => unsafe { ::core::hint::unreachable_unchecked() },
9285 }
9286 }
9287}
9288
9289impl ::fidl_next::FromWire<WireDurability> for Durability {
9290 #[inline]
9291 fn from_wire(wire: WireDurability) -> Self {
9292 Self::from(wire)
9293 }
9294}
9295
9296impl ::fidl_next::FromWireRef<WireDurability> for Durability {
9297 #[inline]
9298 fn from_wire_ref(wire: &WireDurability) -> Self {
9299 Self::from(*wire)
9300 }
9301}
9302
9303#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9305#[repr(transparent)]
9306pub struct WireDurability {
9307 value: ::fidl_next::WireU32,
9308}
9309
9310unsafe impl ::fidl_next::Wire for WireDurability {
9311 type Decoded<'de> = Self;
9312
9313 #[inline]
9314 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
9315 }
9317}
9318
9319impl WireDurability {
9320 pub const TRANSIENT: WireDurability = WireDurability { value: ::fidl_next::WireU32(2) };
9321
9322 pub const SINGLE_RUN: WireDurability = WireDurability { value: ::fidl_next::WireU32(3) };
9323}
9324
9325unsafe impl<___D> ::fidl_next::Decode<___D> for WireDurability
9326where
9327 ___D: ?Sized,
9328{
9329 fn decode(
9330 slot: ::fidl_next::Slot<'_, Self>,
9331 _: &mut ___D,
9332 ) -> Result<(), ::fidl_next::DecodeError> {
9333 ::fidl_next::munge!(let Self { value } = slot);
9334
9335 match u32::from(*value) {
9336 2 | 3 => (),
9337 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
9338 }
9339
9340 Ok(())
9341 }
9342}
9343
9344impl ::core::convert::From<Durability> for WireDurability {
9345 fn from(natural: Durability) -> Self {
9346 match natural {
9347 Durability::Transient => WireDurability::TRANSIENT,
9348
9349 Durability::SingleRun => WireDurability::SINGLE_RUN,
9350 }
9351 }
9352}
9353
9354#[doc = " Statically declares a component instance collection.\n"]
9355#[derive(Clone, Debug, Default)]
9356pub struct Collection {
9357 pub name: Option<String>,
9358
9359 pub durability: Option<crate::Durability>,
9360
9361 pub environment: Option<String>,
9362
9363 pub allowed_offers: Option<crate::AllowedOffers>,
9364
9365 pub allow_long_names: Option<bool>,
9366
9367 pub persistent_storage: Option<bool>,
9368}
9369
9370impl Collection {
9371 fn __max_ordinal(&self) -> usize {
9372 if self.persistent_storage.is_some() {
9373 return 6;
9374 }
9375
9376 if self.allow_long_names.is_some() {
9377 return 5;
9378 }
9379
9380 if self.allowed_offers.is_some() {
9381 return 4;
9382 }
9383
9384 if self.environment.is_some() {
9385 return 3;
9386 }
9387
9388 if self.durability.is_some() {
9389 return 2;
9390 }
9391
9392 if self.name.is_some() {
9393 return 1;
9394 }
9395
9396 0
9397 }
9398}
9399
9400impl ::fidl_next::Encodable for Collection {
9401 type Encoded = WireCollection<'static>;
9402}
9403
9404unsafe impl<___E> ::fidl_next::Encode<___E> for Collection
9405where
9406 ___E: ::fidl_next::Encoder + ?Sized,
9407{
9408 #[inline]
9409 fn encode(
9410 mut self,
9411 encoder: &mut ___E,
9412 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9413 ) -> Result<(), ::fidl_next::EncodeError> {
9414 ::fidl_next::munge!(let WireCollection { table } = out);
9415
9416 let max_ord = self.__max_ordinal();
9417
9418 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
9419 ::fidl_next::Wire::zero_padding(&mut out);
9420
9421 let mut preallocated =
9422 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
9423
9424 for i in 1..=max_ord {
9425 match i {
9426 6 => {
9427 if let Some(persistent_storage) = self.persistent_storage.take() {
9428 ::fidl_next::WireEnvelope::encode_value(
9429 persistent_storage,
9430 preallocated.encoder,
9431 &mut out,
9432 )?;
9433 } else {
9434 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9435 }
9436 }
9437
9438 5 => {
9439 if let Some(allow_long_names) = self.allow_long_names.take() {
9440 ::fidl_next::WireEnvelope::encode_value(
9441 allow_long_names,
9442 preallocated.encoder,
9443 &mut out,
9444 )?;
9445 } else {
9446 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9447 }
9448 }
9449
9450 4 => {
9451 if let Some(allowed_offers) = self.allowed_offers.take() {
9452 ::fidl_next::WireEnvelope::encode_value(
9453 allowed_offers,
9454 preallocated.encoder,
9455 &mut out,
9456 )?;
9457 } else {
9458 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9459 }
9460 }
9461
9462 3 => {
9463 if let Some(environment) = self.environment.take() {
9464 ::fidl_next::WireEnvelope::encode_value(
9465 environment,
9466 preallocated.encoder,
9467 &mut out,
9468 )?;
9469 } else {
9470 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9471 }
9472 }
9473
9474 2 => {
9475 if let Some(durability) = self.durability.take() {
9476 ::fidl_next::WireEnvelope::encode_value(
9477 durability,
9478 preallocated.encoder,
9479 &mut out,
9480 )?;
9481 } else {
9482 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9483 }
9484 }
9485
9486 1 => {
9487 if let Some(name) = self.name.take() {
9488 ::fidl_next::WireEnvelope::encode_value(
9489 name,
9490 preallocated.encoder,
9491 &mut out,
9492 )?;
9493 } else {
9494 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9495 }
9496 }
9497
9498 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
9499 }
9500 unsafe {
9501 preallocated.write_next(out.assume_init_ref());
9502 }
9503 }
9504
9505 ::fidl_next::WireTable::encode_len(table, max_ord);
9506
9507 Ok(())
9508 }
9509}
9510
9511unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Collection
9512where
9513 ___E: ::fidl_next::Encoder + ?Sized,
9514{
9515 #[inline]
9516 fn encode_ref(
9517 &self,
9518 encoder: &mut ___E,
9519 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9520 ) -> Result<(), ::fidl_next::EncodeError> {
9521 ::fidl_next::munge!(let WireCollection { table } = out);
9522
9523 let max_ord = self.__max_ordinal();
9524
9525 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
9526 ::fidl_next::Wire::zero_padding(&mut out);
9527
9528 let mut preallocated =
9529 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
9530
9531 for i in 1..=max_ord {
9532 match i {
9533 6 => {
9534 if let Some(persistent_storage) = &self.persistent_storage {
9535 ::fidl_next::WireEnvelope::encode_value(
9536 persistent_storage,
9537 preallocated.encoder,
9538 &mut out,
9539 )?;
9540 } else {
9541 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9542 }
9543 }
9544
9545 5 => {
9546 if let Some(allow_long_names) = &self.allow_long_names {
9547 ::fidl_next::WireEnvelope::encode_value(
9548 allow_long_names,
9549 preallocated.encoder,
9550 &mut out,
9551 )?;
9552 } else {
9553 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9554 }
9555 }
9556
9557 4 => {
9558 if let Some(allowed_offers) = &self.allowed_offers {
9559 ::fidl_next::WireEnvelope::encode_value(
9560 allowed_offers,
9561 preallocated.encoder,
9562 &mut out,
9563 )?;
9564 } else {
9565 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9566 }
9567 }
9568
9569 3 => {
9570 if let Some(environment) = &self.environment {
9571 ::fidl_next::WireEnvelope::encode_value(
9572 environment,
9573 preallocated.encoder,
9574 &mut out,
9575 )?;
9576 } else {
9577 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9578 }
9579 }
9580
9581 2 => {
9582 if let Some(durability) = &self.durability {
9583 ::fidl_next::WireEnvelope::encode_value(
9584 durability,
9585 preallocated.encoder,
9586 &mut out,
9587 )?;
9588 } else {
9589 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9590 }
9591 }
9592
9593 1 => {
9594 if let Some(name) = &self.name {
9595 ::fidl_next::WireEnvelope::encode_value(
9596 name,
9597 preallocated.encoder,
9598 &mut out,
9599 )?;
9600 } else {
9601 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9602 }
9603 }
9604
9605 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
9606 }
9607 unsafe {
9608 preallocated.write_next(out.assume_init_ref());
9609 }
9610 }
9611
9612 ::fidl_next::WireTable::encode_len(table, max_ord);
9613
9614 Ok(())
9615 }
9616}
9617
9618impl<'de> ::fidl_next::FromWire<WireCollection<'de>> for Collection {
9619 #[inline]
9620 fn from_wire(wire: WireCollection<'de>) -> Self {
9621 let wire = ::core::mem::ManuallyDrop::new(wire);
9622
9623 let name = wire.table.get(1);
9624
9625 let durability = wire.table.get(2);
9626
9627 let environment = wire.table.get(3);
9628
9629 let allowed_offers = wire.table.get(4);
9630
9631 let allow_long_names = wire.table.get(5);
9632
9633 let persistent_storage = wire.table.get(6);
9634
9635 Self {
9636 name: name.map(|envelope| {
9637 ::fidl_next::FromWire::from_wire(unsafe {
9638 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
9639 })
9640 }),
9641
9642 durability: durability.map(|envelope| {
9643 ::fidl_next::FromWire::from_wire(unsafe {
9644 envelope.read_unchecked::<crate::WireDurability>()
9645 })
9646 }),
9647
9648 environment: environment.map(|envelope| {
9649 ::fidl_next::FromWire::from_wire(unsafe {
9650 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
9651 })
9652 }),
9653
9654 allowed_offers: allowed_offers.map(|envelope| {
9655 ::fidl_next::FromWire::from_wire(unsafe {
9656 envelope.read_unchecked::<crate::WireAllowedOffers>()
9657 })
9658 }),
9659
9660 allow_long_names: allow_long_names.map(|envelope| {
9661 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
9662 }),
9663
9664 persistent_storage: persistent_storage.map(|envelope| {
9665 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
9666 }),
9667 }
9668 }
9669}
9670
9671impl<'de> ::fidl_next::FromWireRef<WireCollection<'de>> for Collection {
9672 #[inline]
9673 fn from_wire_ref(wire: &WireCollection<'de>) -> Self {
9674 Self {
9675 name: wire.table.get(1).map(|envelope| {
9676 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
9677 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
9678 })
9679 }),
9680
9681 durability: wire.table.get(2).map(|envelope| {
9682 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
9683 envelope.deref_unchecked::<crate::WireDurability>()
9684 })
9685 }),
9686
9687 environment: wire.table.get(3).map(|envelope| {
9688 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
9689 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
9690 })
9691 }),
9692
9693 allowed_offers: wire.table.get(4).map(|envelope| {
9694 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
9695 envelope.deref_unchecked::<crate::WireAllowedOffers>()
9696 })
9697 }),
9698
9699 allow_long_names: wire.table.get(5).map(|envelope| {
9700 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
9701 envelope.deref_unchecked::<bool>()
9702 })
9703 }),
9704
9705 persistent_storage: wire.table.get(6).map(|envelope| {
9706 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
9707 envelope.deref_unchecked::<bool>()
9708 })
9709 }),
9710 }
9711 }
9712}
9713
9714#[repr(C)]
9716pub struct WireCollection<'de> {
9717 table: ::fidl_next::WireTable<'de>,
9718}
9719
9720impl<'de> Drop for WireCollection<'de> {
9721 fn drop(&mut self) {
9722 let _ = self
9723 .table
9724 .get(1)
9725 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
9726
9727 let _ = self
9728 .table
9729 .get(2)
9730 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDurability>() });
9731
9732 let _ = self
9733 .table
9734 .get(3)
9735 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
9736
9737 let _ = self
9738 .table
9739 .get(4)
9740 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAllowedOffers>() });
9741
9742 let _ = self.table.get(5).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
9743
9744 let _ = self.table.get(6).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
9745 }
9746}
9747
9748unsafe impl ::fidl_next::Wire for WireCollection<'static> {
9749 type Decoded<'de> = WireCollection<'de>;
9750
9751 #[inline]
9752 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9753 ::fidl_next::munge!(let Self { table } = out);
9754 ::fidl_next::WireTable::zero_padding(table);
9755 }
9756}
9757
9758unsafe impl<___D> ::fidl_next::Decode<___D> for WireCollection<'static>
9759where
9760 ___D: ::fidl_next::Decoder + ?Sized,
9761{
9762 fn decode(
9763 slot: ::fidl_next::Slot<'_, Self>,
9764 decoder: &mut ___D,
9765 ) -> Result<(), ::fidl_next::DecodeError> {
9766 ::fidl_next::munge!(let Self { table } = slot);
9767
9768 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
9769 match ordinal {
9770 0 => unsafe { ::core::hint::unreachable_unchecked() },
9771
9772 1 => {
9773 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
9774 slot.as_mut(),
9775 decoder,
9776 )?;
9777
9778 let name = unsafe {
9779 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
9780 };
9781
9782 if name.len() > 100 {
9783 return Err(::fidl_next::DecodeError::VectorTooLong {
9784 size: name.len() as u64,
9785 limit: 100,
9786 });
9787 }
9788
9789 Ok(())
9790 }
9791
9792 2 => {
9793 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDurability>(
9794 slot.as_mut(),
9795 decoder,
9796 )?;
9797
9798 Ok(())
9799 }
9800
9801 3 => {
9802 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
9803 slot.as_mut(),
9804 decoder,
9805 )?;
9806
9807 let environment = unsafe {
9808 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
9809 };
9810
9811 if environment.len() > 100 {
9812 return Err(::fidl_next::DecodeError::VectorTooLong {
9813 size: environment.len() as u64,
9814 limit: 100,
9815 });
9816 }
9817
9818 Ok(())
9819 }
9820
9821 4 => {
9822 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAllowedOffers>(
9823 slot.as_mut(),
9824 decoder,
9825 )?;
9826
9827 Ok(())
9828 }
9829
9830 5 => {
9831 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
9832
9833 Ok(())
9834 }
9835
9836 6 => {
9837 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
9838
9839 Ok(())
9840 }
9841
9842 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
9843 }
9844 })
9845 }
9846}
9847
9848impl<'de> WireCollection<'de> {
9849 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
9850 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
9851 }
9852
9853 pub fn durability(&self) -> Option<&crate::WireDurability> {
9854 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
9855 }
9856
9857 pub fn environment(&self) -> Option<&::fidl_next::WireString<'de>> {
9858 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
9859 }
9860
9861 pub fn allowed_offers(&self) -> Option<&crate::WireAllowedOffers> {
9862 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
9863 }
9864
9865 pub fn allow_long_names(&self) -> Option<&bool> {
9866 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
9867 }
9868
9869 pub fn persistent_storage(&self) -> Option<&bool> {
9870 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
9871 }
9872}
9873
9874impl<'de> ::core::fmt::Debug for WireCollection<'de> {
9875 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
9876 f.debug_struct("Collection")
9877 .field("name", &self.name())
9878 .field("durability", &self.durability())
9879 .field("environment", &self.environment())
9880 .field("allowed_offers", &self.allowed_offers())
9881 .field("allow_long_names", &self.allow_long_names())
9882 .field("persistent_storage", &self.persistent_storage())
9883 .finish()
9884 }
9885}
9886
9887#[doc = " Describes the type of dependency implied by the capability.\n"]
9888#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9889#[repr(u32)]
9890pub enum DependencyType {
9891 Strong = 1,
9892 Weak = 2,
9893}
9894
9895impl ::fidl_next::Encodable for DependencyType {
9896 type Encoded = WireDependencyType;
9897}
9898impl ::std::convert::TryFrom<u32> for DependencyType {
9899 type Error = ::fidl_next::UnknownStrictEnumMemberError;
9900 fn try_from(value: u32) -> Result<Self, Self::Error> {
9901 match value {
9902 1 => Ok(Self::Strong),
9903 2 => Ok(Self::Weak),
9904
9905 _ => Err(Self::Error::new(value.into())),
9906 }
9907 }
9908}
9909
9910unsafe impl<___E> ::fidl_next::Encode<___E> for DependencyType
9911where
9912 ___E: ?Sized,
9913{
9914 #[inline]
9915 fn encode(
9916 self,
9917 encoder: &mut ___E,
9918 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9919 ) -> Result<(), ::fidl_next::EncodeError> {
9920 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
9921 }
9922}
9923
9924unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DependencyType
9925where
9926 ___E: ?Sized,
9927{
9928 #[inline]
9929 fn encode_ref(
9930 &self,
9931 encoder: &mut ___E,
9932 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9933 ) -> Result<(), ::fidl_next::EncodeError> {
9934 ::fidl_next::munge!(let WireDependencyType { value } = out);
9935 let _ = value.write(::fidl_next::WireU32::from(match *self {
9936 Self::Strong => 1,
9937
9938 Self::Weak => 2,
9939 }));
9940
9941 Ok(())
9942 }
9943}
9944
9945impl ::core::convert::From<WireDependencyType> for DependencyType {
9946 fn from(wire: WireDependencyType) -> Self {
9947 match u32::from(wire.value) {
9948 1 => Self::Strong,
9949
9950 2 => Self::Weak,
9951
9952 _ => unsafe { ::core::hint::unreachable_unchecked() },
9953 }
9954 }
9955}
9956
9957impl ::fidl_next::FromWire<WireDependencyType> for DependencyType {
9958 #[inline]
9959 fn from_wire(wire: WireDependencyType) -> Self {
9960 Self::from(wire)
9961 }
9962}
9963
9964impl ::fidl_next::FromWireRef<WireDependencyType> for DependencyType {
9965 #[inline]
9966 fn from_wire_ref(wire: &WireDependencyType) -> Self {
9967 Self::from(*wire)
9968 }
9969}
9970
9971#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9973#[repr(transparent)]
9974pub struct WireDependencyType {
9975 value: ::fidl_next::WireU32,
9976}
9977
9978unsafe impl ::fidl_next::Wire for WireDependencyType {
9979 type Decoded<'de> = Self;
9980
9981 #[inline]
9982 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
9983 }
9985}
9986
9987impl WireDependencyType {
9988 pub const STRONG: WireDependencyType = WireDependencyType { value: ::fidl_next::WireU32(1) };
9989
9990 pub const WEAK: WireDependencyType = WireDependencyType { value: ::fidl_next::WireU32(2) };
9991}
9992
9993unsafe impl<___D> ::fidl_next::Decode<___D> for WireDependencyType
9994where
9995 ___D: ?Sized,
9996{
9997 fn decode(
9998 slot: ::fidl_next::Slot<'_, Self>,
9999 _: &mut ___D,
10000 ) -> Result<(), ::fidl_next::DecodeError> {
10001 ::fidl_next::munge!(let Self { value } = slot);
10002
10003 match u32::from(*value) {
10004 1 | 2 => (),
10005 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
10006 }
10007
10008 Ok(())
10009 }
10010}
10011
10012impl ::core::convert::From<DependencyType> for WireDependencyType {
10013 fn from(natural: DependencyType) -> Self {
10014 match natural {
10015 DependencyType::Strong => WireDependencyType::STRONG,
10016
10017 DependencyType::Weak => WireDependencyType::WEAK,
10018 }
10019 }
10020}
10021
10022#[doc = " Type used to create a mapping between 2 names. Used to rename service or component instances\n in FIDL declarations.\n"]
10023#[derive(Clone, Debug)]
10024pub struct NameMapping {
10025 pub source_name: String,
10026
10027 pub target_name: String,
10028}
10029
10030impl ::fidl_next::Encodable for NameMapping {
10031 type Encoded = WireNameMapping<'static>;
10032}
10033
10034unsafe impl<___E> ::fidl_next::Encode<___E> for NameMapping
10035where
10036 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
10037
10038 ___E: ::fidl_next::Encoder,
10039{
10040 #[inline]
10041 fn encode(
10042 self,
10043 encoder: &mut ___E,
10044 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10045 ) -> Result<(), ::fidl_next::EncodeError> {
10046 ::fidl_next::munge! {
10047 let Self::Encoded {
10048 source_name,
10049 target_name,
10050
10051 } = out;
10052 }
10053
10054 ::fidl_next::Encode::encode(self.source_name, encoder, source_name)?;
10055
10056 ::fidl_next::Encode::encode(self.target_name, encoder, target_name)?;
10057
10058 Ok(())
10059 }
10060}
10061
10062unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NameMapping
10063where
10064 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
10065
10066 ___E: ::fidl_next::Encoder,
10067{
10068 #[inline]
10069 fn encode_ref(
10070 &self,
10071 encoder: &mut ___E,
10072 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10073 ) -> Result<(), ::fidl_next::EncodeError> {
10074 ::fidl_next::munge! {
10075 let Self::Encoded {
10076 source_name,
10077 target_name,
10078
10079 } = out;
10080 }
10081
10082 ::fidl_next::EncodeRef::encode_ref(&self.source_name, encoder, source_name)?;
10083
10084 ::fidl_next::EncodeRef::encode_ref(&self.target_name, encoder, target_name)?;
10085
10086 Ok(())
10087 }
10088}
10089
10090impl ::fidl_next::EncodableOption for NameMapping {
10091 type EncodedOption = ::fidl_next::WireBox<'static, WireNameMapping<'static>>;
10092}
10093
10094unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NameMapping
10095where
10096 ___E: ::fidl_next::Encoder + ?Sized,
10097 NameMapping: ::fidl_next::Encode<___E>,
10098{
10099 #[inline]
10100 fn encode_option(
10101 this: Option<Self>,
10102 encoder: &mut ___E,
10103 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
10104 ) -> Result<(), ::fidl_next::EncodeError> {
10105 if let Some(inner) = this {
10106 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
10107 ::fidl_next::WireBox::encode_present(out);
10108 } else {
10109 ::fidl_next::WireBox::encode_absent(out);
10110 }
10111
10112 Ok(())
10113 }
10114}
10115
10116unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for NameMapping
10117where
10118 ___E: ::fidl_next::Encoder + ?Sized,
10119 NameMapping: ::fidl_next::EncodeRef<___E>,
10120{
10121 #[inline]
10122 fn encode_option_ref(
10123 this: Option<&Self>,
10124 encoder: &mut ___E,
10125 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
10126 ) -> Result<(), ::fidl_next::EncodeError> {
10127 if let Some(inner) = this {
10128 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
10129 ::fidl_next::WireBox::encode_present(out);
10130 } else {
10131 ::fidl_next::WireBox::encode_absent(out);
10132 }
10133
10134 Ok(())
10135 }
10136}
10137
10138impl<'de> ::fidl_next::FromWire<WireNameMapping<'de>> for NameMapping {
10139 #[inline]
10140 fn from_wire(wire: WireNameMapping<'de>) -> Self {
10141 Self {
10142 source_name: ::fidl_next::FromWire::from_wire(wire.source_name),
10143
10144 target_name: ::fidl_next::FromWire::from_wire(wire.target_name),
10145 }
10146 }
10147}
10148
10149impl<'de> ::fidl_next::FromWireRef<WireNameMapping<'de>> for NameMapping {
10150 #[inline]
10151 fn from_wire_ref(wire: &WireNameMapping<'de>) -> Self {
10152 Self {
10153 source_name: ::fidl_next::FromWireRef::from_wire_ref(&wire.source_name),
10154
10155 target_name: ::fidl_next::FromWireRef::from_wire_ref(&wire.target_name),
10156 }
10157 }
10158}
10159
10160#[derive(Debug)]
10162#[repr(C)]
10163pub struct WireNameMapping<'de> {
10164 pub source_name: ::fidl_next::WireString<'de>,
10165
10166 pub target_name: ::fidl_next::WireString<'de>,
10167}
10168
10169unsafe impl ::fidl_next::Wire for WireNameMapping<'static> {
10170 type Decoded<'de> = WireNameMapping<'de>;
10171
10172 #[inline]
10173 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
10174}
10175
10176unsafe impl<___D> ::fidl_next::Decode<___D> for WireNameMapping<'static>
10177where
10178 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
10179
10180 ___D: ::fidl_next::Decoder,
10181{
10182 fn decode(
10183 slot: ::fidl_next::Slot<'_, Self>,
10184 decoder: &mut ___D,
10185 ) -> Result<(), ::fidl_next::DecodeError> {
10186 ::fidl_next::munge! {
10187 let Self {
10188 mut source_name,
10189 mut target_name,
10190
10191 } = slot;
10192 }
10193
10194 ::fidl_next::Decode::decode(source_name.as_mut(), decoder)?;
10195
10196 let source_name = unsafe { source_name.deref_unchecked() };
10197
10198 if source_name.len() > 100 {
10199 return Err(::fidl_next::DecodeError::VectorTooLong {
10200 size: source_name.len() as u64,
10201 limit: 100,
10202 });
10203 }
10204
10205 ::fidl_next::Decode::decode(target_name.as_mut(), decoder)?;
10206
10207 let target_name = unsafe { target_name.deref_unchecked() };
10208
10209 if target_name.len() > 100 {
10210 return Err(::fidl_next::DecodeError::VectorTooLong {
10211 size: target_name.len() as u64,
10212 limit: 100,
10213 });
10214 }
10215
10216 Ok(())
10217 }
10218}
10219
10220#[doc = " Specifies how a declared environment\'s initial set of properties are assigned.\n"]
10221#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10222#[repr(u32)]
10223pub enum EnvironmentExtends {
10224 None = 0,
10225 Realm = 1,
10226}
10227
10228impl ::fidl_next::Encodable for EnvironmentExtends {
10229 type Encoded = WireEnvironmentExtends;
10230}
10231impl ::std::convert::TryFrom<u32> for EnvironmentExtends {
10232 type Error = ::fidl_next::UnknownStrictEnumMemberError;
10233 fn try_from(value: u32) -> Result<Self, Self::Error> {
10234 match value {
10235 0 => Ok(Self::None),
10236 1 => Ok(Self::Realm),
10237
10238 _ => Err(Self::Error::new(value.into())),
10239 }
10240 }
10241}
10242
10243unsafe impl<___E> ::fidl_next::Encode<___E> for EnvironmentExtends
10244where
10245 ___E: ?Sized,
10246{
10247 #[inline]
10248 fn encode(
10249 self,
10250 encoder: &mut ___E,
10251 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10252 ) -> Result<(), ::fidl_next::EncodeError> {
10253 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
10254 }
10255}
10256
10257unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EnvironmentExtends
10258where
10259 ___E: ?Sized,
10260{
10261 #[inline]
10262 fn encode_ref(
10263 &self,
10264 encoder: &mut ___E,
10265 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10266 ) -> Result<(), ::fidl_next::EncodeError> {
10267 ::fidl_next::munge!(let WireEnvironmentExtends { value } = out);
10268 let _ = value.write(::fidl_next::WireU32::from(match *self {
10269 Self::None => 0,
10270
10271 Self::Realm => 1,
10272 }));
10273
10274 Ok(())
10275 }
10276}
10277
10278impl ::core::convert::From<WireEnvironmentExtends> for EnvironmentExtends {
10279 fn from(wire: WireEnvironmentExtends) -> Self {
10280 match u32::from(wire.value) {
10281 0 => Self::None,
10282
10283 1 => Self::Realm,
10284
10285 _ => unsafe { ::core::hint::unreachable_unchecked() },
10286 }
10287 }
10288}
10289
10290impl ::fidl_next::FromWire<WireEnvironmentExtends> for EnvironmentExtends {
10291 #[inline]
10292 fn from_wire(wire: WireEnvironmentExtends) -> Self {
10293 Self::from(wire)
10294 }
10295}
10296
10297impl ::fidl_next::FromWireRef<WireEnvironmentExtends> for EnvironmentExtends {
10298 #[inline]
10299 fn from_wire_ref(wire: &WireEnvironmentExtends) -> Self {
10300 Self::from(*wire)
10301 }
10302}
10303
10304#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10306#[repr(transparent)]
10307pub struct WireEnvironmentExtends {
10308 value: ::fidl_next::WireU32,
10309}
10310
10311unsafe impl ::fidl_next::Wire for WireEnvironmentExtends {
10312 type Decoded<'de> = Self;
10313
10314 #[inline]
10315 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
10316 }
10318}
10319
10320impl WireEnvironmentExtends {
10321 pub const NONE: WireEnvironmentExtends =
10322 WireEnvironmentExtends { value: ::fidl_next::WireU32(0) };
10323
10324 pub const REALM: WireEnvironmentExtends =
10325 WireEnvironmentExtends { value: ::fidl_next::WireU32(1) };
10326}
10327
10328unsafe impl<___D> ::fidl_next::Decode<___D> for WireEnvironmentExtends
10329where
10330 ___D: ?Sized,
10331{
10332 fn decode(
10333 slot: ::fidl_next::Slot<'_, Self>,
10334 _: &mut ___D,
10335 ) -> Result<(), ::fidl_next::DecodeError> {
10336 ::fidl_next::munge!(let Self { value } = slot);
10337
10338 match u32::from(*value) {
10339 0 | 1 => (),
10340 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
10341 }
10342
10343 Ok(())
10344 }
10345}
10346
10347impl ::core::convert::From<EnvironmentExtends> for WireEnvironmentExtends {
10348 fn from(natural: EnvironmentExtends) -> Self {
10349 match natural {
10350 EnvironmentExtends::None => WireEnvironmentExtends::NONE,
10351
10352 EnvironmentExtends::Realm => WireEnvironmentExtends::REALM,
10353 }
10354 }
10355}
10356
10357pub const MAX_URL_SCHEME_LENGTH: u32 = 100;
10358
10359pub type UrlScheme = String;
10360
10361pub type WireUrlScheme<'de> = ::fidl_next::WireString<'de>;
10363
10364#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10365#[repr(u32)]
10366pub enum ConfigTypeLayout {
10367 Bool = 1,
10368 Uint8 = 2,
10369 Uint16 = 3,
10370 Uint32 = 4,
10371 Uint64 = 5,
10372 Int8 = 6,
10373 Int16 = 7,
10374 Int32 = 8,
10375 Int64 = 9,
10376 String = 10,
10377 Vector = 11,
10378 UnknownOrdinal_(u32),
10379}
10380
10381impl ::fidl_next::Encodable for ConfigTypeLayout {
10382 type Encoded = WireConfigTypeLayout;
10383}
10384impl ::std::convert::From<u32> for ConfigTypeLayout {
10385 fn from(value: u32) -> Self {
10386 match value {
10387 1 => Self::Bool,
10388 2 => Self::Uint8,
10389 3 => Self::Uint16,
10390 4 => Self::Uint32,
10391 5 => Self::Uint64,
10392 6 => Self::Int8,
10393 7 => Self::Int16,
10394 8 => Self::Int32,
10395 9 => Self::Int64,
10396 10 => Self::String,
10397 11 => Self::Vector,
10398
10399 _ => Self::UnknownOrdinal_(value),
10400 }
10401 }
10402}
10403
10404unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigTypeLayout
10405where
10406 ___E: ?Sized,
10407{
10408 #[inline]
10409 fn encode(
10410 self,
10411 encoder: &mut ___E,
10412 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10413 ) -> Result<(), ::fidl_next::EncodeError> {
10414 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
10415 }
10416}
10417
10418unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigTypeLayout
10419where
10420 ___E: ?Sized,
10421{
10422 #[inline]
10423 fn encode_ref(
10424 &self,
10425 encoder: &mut ___E,
10426 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10427 ) -> Result<(), ::fidl_next::EncodeError> {
10428 ::fidl_next::munge!(let WireConfigTypeLayout { value } = out);
10429 let _ = value.write(::fidl_next::WireU32::from(match *self {
10430 Self::Bool => 1,
10431
10432 Self::Uint8 => 2,
10433
10434 Self::Uint16 => 3,
10435
10436 Self::Uint32 => 4,
10437
10438 Self::Uint64 => 5,
10439
10440 Self::Int8 => 6,
10441
10442 Self::Int16 => 7,
10443
10444 Self::Int32 => 8,
10445
10446 Self::Int64 => 9,
10447
10448 Self::String => 10,
10449
10450 Self::Vector => 11,
10451
10452 Self::UnknownOrdinal_(value) => value,
10453 }));
10454
10455 Ok(())
10456 }
10457}
10458
10459impl ::core::convert::From<WireConfigTypeLayout> for ConfigTypeLayout {
10460 fn from(wire: WireConfigTypeLayout) -> Self {
10461 match u32::from(wire.value) {
10462 1 => Self::Bool,
10463
10464 2 => Self::Uint8,
10465
10466 3 => Self::Uint16,
10467
10468 4 => Self::Uint32,
10469
10470 5 => Self::Uint64,
10471
10472 6 => Self::Int8,
10473
10474 7 => Self::Int16,
10475
10476 8 => Self::Int32,
10477
10478 9 => Self::Int64,
10479
10480 10 => Self::String,
10481
10482 11 => Self::Vector,
10483
10484 value => Self::UnknownOrdinal_(value),
10485 }
10486 }
10487}
10488
10489impl ::fidl_next::FromWire<WireConfigTypeLayout> for ConfigTypeLayout {
10490 #[inline]
10491 fn from_wire(wire: WireConfigTypeLayout) -> Self {
10492 Self::from(wire)
10493 }
10494}
10495
10496impl ::fidl_next::FromWireRef<WireConfigTypeLayout> for ConfigTypeLayout {
10497 #[inline]
10498 fn from_wire_ref(wire: &WireConfigTypeLayout) -> Self {
10499 Self::from(*wire)
10500 }
10501}
10502
10503#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10505#[repr(transparent)]
10506pub struct WireConfigTypeLayout {
10507 value: ::fidl_next::WireU32,
10508}
10509
10510unsafe impl ::fidl_next::Wire for WireConfigTypeLayout {
10511 type Decoded<'de> = Self;
10512
10513 #[inline]
10514 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
10515 }
10517}
10518
10519impl WireConfigTypeLayout {
10520 pub const BOOL: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(1) };
10521
10522 pub const UINT8: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(2) };
10523
10524 pub const UINT16: WireConfigTypeLayout =
10525 WireConfigTypeLayout { value: ::fidl_next::WireU32(3) };
10526
10527 pub const UINT32: WireConfigTypeLayout =
10528 WireConfigTypeLayout { value: ::fidl_next::WireU32(4) };
10529
10530 pub const UINT64: WireConfigTypeLayout =
10531 WireConfigTypeLayout { value: ::fidl_next::WireU32(5) };
10532
10533 pub const INT8: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(6) };
10534
10535 pub const INT16: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(7) };
10536
10537 pub const INT32: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(8) };
10538
10539 pub const INT64: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(9) };
10540
10541 pub const STRING: WireConfigTypeLayout =
10542 WireConfigTypeLayout { value: ::fidl_next::WireU32(10) };
10543
10544 pub const VECTOR: WireConfigTypeLayout =
10545 WireConfigTypeLayout { value: ::fidl_next::WireU32(11) };
10546}
10547
10548unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigTypeLayout
10549where
10550 ___D: ?Sized,
10551{
10552 fn decode(
10553 slot: ::fidl_next::Slot<'_, Self>,
10554 _: &mut ___D,
10555 ) -> Result<(), ::fidl_next::DecodeError> {
10556 Ok(())
10557 }
10558}
10559
10560impl ::core::convert::From<ConfigTypeLayout> for WireConfigTypeLayout {
10561 fn from(natural: ConfigTypeLayout) -> Self {
10562 match natural {
10563 ConfigTypeLayout::Bool => WireConfigTypeLayout::BOOL,
10564
10565 ConfigTypeLayout::Uint8 => WireConfigTypeLayout::UINT8,
10566
10567 ConfigTypeLayout::Uint16 => WireConfigTypeLayout::UINT16,
10568
10569 ConfigTypeLayout::Uint32 => WireConfigTypeLayout::UINT32,
10570
10571 ConfigTypeLayout::Uint64 => WireConfigTypeLayout::UINT64,
10572
10573 ConfigTypeLayout::Int8 => WireConfigTypeLayout::INT8,
10574
10575 ConfigTypeLayout::Int16 => WireConfigTypeLayout::INT16,
10576
10577 ConfigTypeLayout::Int32 => WireConfigTypeLayout::INT32,
10578
10579 ConfigTypeLayout::Int64 => WireConfigTypeLayout::INT64,
10580
10581 ConfigTypeLayout::String => WireConfigTypeLayout::STRING,
10582
10583 ConfigTypeLayout::Vector => WireConfigTypeLayout::VECTOR,
10584
10585 ConfigTypeLayout::UnknownOrdinal_(value) => {
10586 WireConfigTypeLayout { value: ::fidl_next::WireU32::from(value) }
10587 }
10588 }
10589 }
10590}
10591
10592#[derive(Clone, Debug)]
10593pub enum LayoutConstraint {
10594 MaxSize(u32),
10595
10596 UnknownOrdinal_(u64),
10597}
10598
10599impl ::fidl_next::Encodable for LayoutConstraint {
10600 type Encoded = WireLayoutConstraint;
10601}
10602
10603unsafe impl<___E> ::fidl_next::Encode<___E> for LayoutConstraint
10604where
10605 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
10606{
10607 #[inline]
10608 fn encode(
10609 self,
10610 encoder: &mut ___E,
10611 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10612 ) -> Result<(), ::fidl_next::EncodeError> {
10613 ::fidl_next::munge!(let WireLayoutConstraint { raw, _phantom: _ } = out);
10614
10615 match self {
10616 Self::MaxSize(value) => {
10617 ::fidl_next::RawWireUnion::encode_as_static::<___E, u32>(value, 1, encoder, raw)?
10618 }
10619
10620 Self::UnknownOrdinal_(ordinal) => {
10621 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
10622 }
10623 }
10624
10625 Ok(())
10626 }
10627}
10628
10629unsafe impl<___E> ::fidl_next::EncodeRef<___E> for LayoutConstraint
10630where
10631 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
10632{
10633 #[inline]
10634 fn encode_ref(
10635 &self,
10636 encoder: &mut ___E,
10637 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10638 ) -> Result<(), ::fidl_next::EncodeError> {
10639 ::fidl_next::munge!(let WireLayoutConstraint { raw, _phantom: _ } = out);
10640
10641 match self {
10642 Self::MaxSize(value) => {
10643 ::fidl_next::RawWireUnion::encode_as_static::<___E, &u32>(value, 1, encoder, raw)?
10644 }
10645
10646 Self::UnknownOrdinal_(ordinal) => {
10647 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
10648 }
10649 }
10650
10651 Ok(())
10652 }
10653}
10654
10655impl ::fidl_next::EncodableOption for LayoutConstraint {
10656 type EncodedOption = WireOptionalLayoutConstraint;
10657}
10658
10659unsafe impl<___E> ::fidl_next::EncodeOption<___E> for LayoutConstraint
10660where
10661 ___E: ?Sized,
10662 LayoutConstraint: ::fidl_next::Encode<___E>,
10663{
10664 #[inline]
10665 fn encode_option(
10666 this: Option<Self>,
10667 encoder: &mut ___E,
10668 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
10669 ) -> Result<(), ::fidl_next::EncodeError> {
10670 ::fidl_next::munge!(let WireOptionalLayoutConstraint { raw, _phantom: _ } = &mut *out);
10671
10672 if let Some(inner) = this {
10673 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
10674 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
10675 } else {
10676 ::fidl_next::RawWireUnion::encode_absent(raw);
10677 }
10678
10679 Ok(())
10680 }
10681}
10682
10683unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for LayoutConstraint
10684where
10685 ___E: ?Sized,
10686 LayoutConstraint: ::fidl_next::EncodeRef<___E>,
10687{
10688 #[inline]
10689 fn encode_option_ref(
10690 this: Option<&Self>,
10691 encoder: &mut ___E,
10692 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
10693 ) -> Result<(), ::fidl_next::EncodeError> {
10694 ::fidl_next::munge!(let WireOptionalLayoutConstraint { raw, _phantom: _ } = &mut *out);
10695
10696 if let Some(inner) = this {
10697 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
10698 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
10699 } else {
10700 ::fidl_next::RawWireUnion::encode_absent(raw);
10701 }
10702
10703 Ok(())
10704 }
10705}
10706
10707impl ::fidl_next::FromWire<WireLayoutConstraint> for LayoutConstraint {
10708 #[inline]
10709 fn from_wire(wire: WireLayoutConstraint) -> Self {
10710 let wire = ::core::mem::ManuallyDrop::new(wire);
10711 match wire.raw.ordinal() {
10712 1 => Self::MaxSize(::fidl_next::FromWire::from_wire(unsafe {
10713 wire.raw.get().read_unchecked::<::fidl_next::WireU32>()
10714 })),
10715
10716 _ => unsafe { ::core::hint::unreachable_unchecked() },
10717 }
10718 }
10719}
10720
10721impl ::fidl_next::FromWireRef<WireLayoutConstraint> for LayoutConstraint {
10722 #[inline]
10723 fn from_wire_ref(wire: &WireLayoutConstraint) -> Self {
10724 match wire.raw.ordinal() {
10725 1 => Self::MaxSize(::fidl_next::FromWireRef::from_wire_ref(unsafe {
10726 wire.raw.get().deref_unchecked::<::fidl_next::WireU32>()
10727 })),
10728
10729 _ => unsafe { ::core::hint::unreachable_unchecked() },
10730 }
10731 }
10732}
10733
10734impl ::fidl_next::FromWireOption<WireOptionalLayoutConstraint> for Box<LayoutConstraint> {
10735 #[inline]
10736 fn from_wire_option(wire: WireOptionalLayoutConstraint) -> Option<Self> {
10737 if let Some(inner) = wire.into_option() {
10738 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
10739 } else {
10740 None
10741 }
10742 }
10743}
10744
10745impl ::fidl_next::FromWireOptionRef<WireOptionalLayoutConstraint> for Box<LayoutConstraint> {
10746 #[inline]
10747 fn from_wire_option_ref(wire: &WireOptionalLayoutConstraint) -> Option<Self> {
10748 if let Some(inner) = wire.as_ref() {
10749 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
10750 } else {
10751 None
10752 }
10753 }
10754}
10755
10756#[repr(transparent)]
10758pub struct WireLayoutConstraint {
10759 raw: ::fidl_next::RawWireUnion,
10760 _phantom: ::core::marker::PhantomData<()>,
10761}
10762
10763impl Drop for WireLayoutConstraint {
10764 fn drop(&mut self) {
10765 match self.raw.ordinal() {
10766 1 => {
10767 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() };
10768 }
10769
10770 _ => (),
10771 }
10772 }
10773}
10774
10775unsafe impl ::fidl_next::Wire for WireLayoutConstraint {
10776 type Decoded<'de> = WireLayoutConstraint;
10777
10778 #[inline]
10779 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10780 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
10781 ::fidl_next::RawWireUnion::zero_padding(raw);
10782 }
10783}
10784
10785pub mod layout_constraint {
10786 pub enum Ref<'de> {
10787 MaxSize(&'de ::fidl_next::WireU32),
10788
10789 UnknownOrdinal_(u64),
10790 }
10791}
10792
10793impl WireLayoutConstraint {
10794 pub fn as_ref(&self) -> crate::layout_constraint::Ref<'_> {
10795 match self.raw.ordinal() {
10796 1 => crate::layout_constraint::Ref::MaxSize(unsafe {
10797 self.raw.get().deref_unchecked::<::fidl_next::WireU32>()
10798 }),
10799
10800 unknown => crate::layout_constraint::Ref::UnknownOrdinal_(unknown),
10801 }
10802 }
10803}
10804
10805impl Clone for WireLayoutConstraint {
10806 fn clone(&self) -> Self {
10807 match self.raw.ordinal() {
10808 1 => Self {
10809 raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireU32>() },
10810 _phantom: ::core::marker::PhantomData,
10811 },
10812
10813 _ => Self {
10814 raw: unsafe { self.raw.clone_inline_unchecked::<()>() },
10815 _phantom: ::core::marker::PhantomData,
10816 },
10817 }
10818 }
10819}
10820
10821unsafe impl<___D> ::fidl_next::Decode<___D> for WireLayoutConstraint
10822where
10823 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
10824{
10825 fn decode(
10826 mut slot: ::fidl_next::Slot<'_, Self>,
10827 decoder: &mut ___D,
10828 ) -> Result<(), ::fidl_next::DecodeError> {
10829 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
10830 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
10831 1 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireU32>(
10832 raw, decoder,
10833 )?,
10834
10835 _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?,
10836 }
10837
10838 Ok(())
10839 }
10840}
10841
10842impl ::core::fmt::Debug for WireLayoutConstraint {
10843 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
10844 match self.raw.ordinal() {
10845 1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) },
10846 _ => unsafe { ::core::hint::unreachable_unchecked() },
10847 }
10848 }
10849}
10850
10851#[repr(transparent)]
10852pub struct WireOptionalLayoutConstraint {
10853 raw: ::fidl_next::RawWireUnion,
10854 _phantom: ::core::marker::PhantomData<()>,
10855}
10856
10857unsafe impl ::fidl_next::Wire for WireOptionalLayoutConstraint {
10858 type Decoded<'de> = WireOptionalLayoutConstraint;
10859
10860 #[inline]
10861 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10862 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
10863 ::fidl_next::RawWireUnion::zero_padding(raw);
10864 }
10865}
10866
10867impl WireOptionalLayoutConstraint {
10868 pub fn is_some(&self) -> bool {
10869 self.raw.is_some()
10870 }
10871
10872 pub fn is_none(&self) -> bool {
10873 self.raw.is_none()
10874 }
10875
10876 pub fn as_ref(&self) -> Option<&WireLayoutConstraint> {
10877 if self.is_some() {
10878 Some(unsafe { &*(self as *const Self).cast() })
10879 } else {
10880 None
10881 }
10882 }
10883
10884 pub fn into_option(self) -> Option<WireLayoutConstraint> {
10885 if self.is_some() {
10886 Some(WireLayoutConstraint { raw: self.raw, _phantom: ::core::marker::PhantomData })
10887 } else {
10888 None
10889 }
10890 }
10891}
10892
10893impl Clone for WireOptionalLayoutConstraint {
10894 fn clone(&self) -> Self {
10895 if self.is_none() {
10896 return WireOptionalLayoutConstraint {
10897 raw: ::fidl_next::RawWireUnion::absent(),
10898 _phantom: ::core::marker::PhantomData,
10899 };
10900 }
10901
10902 match self.raw.ordinal() {
10903 1 => Self {
10904 raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireU32>() },
10905 _phantom: ::core::marker::PhantomData,
10906 },
10907
10908 _ => Self {
10909 raw: unsafe { self.raw.clone_inline_unchecked::<()>() },
10910 _phantom: ::core::marker::PhantomData,
10911 },
10912 }
10913 }
10914}
10915
10916unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalLayoutConstraint
10917where
10918 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
10919{
10920 fn decode(
10921 mut slot: ::fidl_next::Slot<'_, Self>,
10922 decoder: &mut ___D,
10923 ) -> Result<(), ::fidl_next::DecodeError> {
10924 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
10925 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
10926 1 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireU32>(
10927 raw, decoder,
10928 )?,
10929
10930 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
10931 _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?,
10932 }
10933
10934 Ok(())
10935 }
10936}
10937
10938impl ::core::fmt::Debug for WireOptionalLayoutConstraint {
10939 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
10940 self.as_ref().fmt(f)
10941 }
10942}
10943
10944#[derive(Clone, Debug)]
10945pub struct ConfigType {
10946 pub layout: crate::ConfigTypeLayout,
10947
10948 pub parameters: Option<Vec<crate::LayoutParameter>>,
10949
10950 pub constraints: Vec<crate::LayoutConstraint>,
10951}
10952
10953impl ::fidl_next::Encodable for ConfigType {
10954 type Encoded = WireConfigType<'static>;
10955}
10956
10957unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigType
10958where
10959 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
10960
10961 ___E: ::fidl_next::Encoder,
10962{
10963 #[inline]
10964 fn encode(
10965 self,
10966 encoder: &mut ___E,
10967 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10968 ) -> Result<(), ::fidl_next::EncodeError> {
10969 ::fidl_next::munge! {
10970 let Self::Encoded {
10971 layout,
10972 parameters,
10973 constraints,
10974
10975 } = out;
10976 }
10977
10978 ::fidl_next::Encode::encode(self.layout, encoder, layout)?;
10979
10980 ::fidl_next::Encode::encode(self.parameters, encoder, parameters)?;
10981
10982 ::fidl_next::Encode::encode(self.constraints, encoder, constraints)?;
10983
10984 Ok(())
10985 }
10986}
10987
10988unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigType
10989where
10990 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
10991
10992 ___E: ::fidl_next::Encoder,
10993{
10994 #[inline]
10995 fn encode_ref(
10996 &self,
10997 encoder: &mut ___E,
10998 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10999 ) -> Result<(), ::fidl_next::EncodeError> {
11000 ::fidl_next::munge! {
11001 let Self::Encoded {
11002 layout,
11003 parameters,
11004 constraints,
11005
11006 } = out;
11007 }
11008
11009 ::fidl_next::EncodeRef::encode_ref(&self.layout, encoder, layout)?;
11010
11011 ::fidl_next::EncodeRef::encode_ref(&self.parameters, encoder, parameters)?;
11012
11013 ::fidl_next::EncodeRef::encode_ref(&self.constraints, encoder, constraints)?;
11014
11015 Ok(())
11016 }
11017}
11018
11019impl ::fidl_next::EncodableOption for ConfigType {
11020 type EncodedOption = ::fidl_next::WireBox<'static, WireConfigType<'static>>;
11021}
11022
11023unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ConfigType
11024where
11025 ___E: ::fidl_next::Encoder + ?Sized,
11026 ConfigType: ::fidl_next::Encode<___E>,
11027{
11028 #[inline]
11029 fn encode_option(
11030 this: Option<Self>,
11031 encoder: &mut ___E,
11032 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
11033 ) -> Result<(), ::fidl_next::EncodeError> {
11034 if let Some(inner) = this {
11035 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
11036 ::fidl_next::WireBox::encode_present(out);
11037 } else {
11038 ::fidl_next::WireBox::encode_absent(out);
11039 }
11040
11041 Ok(())
11042 }
11043}
11044
11045unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ConfigType
11046where
11047 ___E: ::fidl_next::Encoder + ?Sized,
11048 ConfigType: ::fidl_next::EncodeRef<___E>,
11049{
11050 #[inline]
11051 fn encode_option_ref(
11052 this: Option<&Self>,
11053 encoder: &mut ___E,
11054 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
11055 ) -> Result<(), ::fidl_next::EncodeError> {
11056 if let Some(inner) = this {
11057 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
11058 ::fidl_next::WireBox::encode_present(out);
11059 } else {
11060 ::fidl_next::WireBox::encode_absent(out);
11061 }
11062
11063 Ok(())
11064 }
11065}
11066
11067impl<'de> ::fidl_next::FromWire<WireConfigType<'de>> for ConfigType {
11068 #[inline]
11069 fn from_wire(wire: WireConfigType<'de>) -> Self {
11070 Self {
11071 layout: ::fidl_next::FromWire::from_wire(wire.layout),
11072
11073 parameters: ::fidl_next::FromWire::from_wire(wire.parameters),
11074
11075 constraints: ::fidl_next::FromWire::from_wire(wire.constraints),
11076 }
11077 }
11078}
11079
11080impl<'de> ::fidl_next::FromWireRef<WireConfigType<'de>> for ConfigType {
11081 #[inline]
11082 fn from_wire_ref(wire: &WireConfigType<'de>) -> Self {
11083 Self {
11084 layout: ::fidl_next::FromWireRef::from_wire_ref(&wire.layout),
11085
11086 parameters: ::fidl_next::FromWireRef::from_wire_ref(&wire.parameters),
11087
11088 constraints: ::fidl_next::FromWireRef::from_wire_ref(&wire.constraints),
11089 }
11090 }
11091}
11092
11093#[derive(Debug)]
11095#[repr(C)]
11096pub struct WireConfigType<'de> {
11097 pub layout: crate::WireConfigTypeLayout,
11098
11099 pub parameters: ::fidl_next::WireOptionalVector<'de, crate::WireLayoutParameter<'de>>,
11100
11101 pub constraints: ::fidl_next::WireVector<'de, crate::WireLayoutConstraint>,
11102}
11103
11104unsafe impl ::fidl_next::Wire for WireConfigType<'static> {
11105 type Decoded<'de> = WireConfigType<'de>;
11106
11107 #[inline]
11108 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
11109 unsafe {
11110 out.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4);
11111 }
11112 }
11113}
11114
11115unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigType<'static>
11116where
11117 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
11118
11119 ___D: ::fidl_next::Decoder,
11120{
11121 fn decode(
11122 slot: ::fidl_next::Slot<'_, Self>,
11123 decoder: &mut ___D,
11124 ) -> Result<(), ::fidl_next::DecodeError> {
11125 ::fidl_next::munge! {
11126 let Self {
11127 mut layout,
11128 mut parameters,
11129 mut constraints,
11130
11131 } = slot;
11132 }
11133
11134 ::fidl_next::Decode::decode(layout.as_mut(), decoder)?;
11135
11136 ::fidl_next::Decode::decode(parameters.as_mut(), decoder)?;
11137
11138 ::fidl_next::Decode::decode(constraints.as_mut(), decoder)?;
11139
11140 Ok(())
11141 }
11142}
11143
11144#[doc = " The checksum produced for a configuration interface.\n Two configuration interfaces are the same if their checksums are the same.\n"]
11145#[derive(Clone, Debug)]
11146pub enum ConfigChecksum {
11147 Sha256([u8; 32]),
11148
11149 UnknownOrdinal_(u64),
11150}
11151
11152impl ::fidl_next::Encodable for ConfigChecksum {
11153 type Encoded = WireConfigChecksum<'static>;
11154}
11155
11156unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigChecksum
11157where
11158 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
11159
11160 ___E: ::fidl_next::Encoder,
11161{
11162 #[inline]
11163 fn encode(
11164 self,
11165 encoder: &mut ___E,
11166 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11167 ) -> Result<(), ::fidl_next::EncodeError> {
11168 ::fidl_next::munge!(let WireConfigChecksum { raw, _phantom: _ } = out);
11169
11170 match self {
11171 Self::Sha256(value) => {
11172 ::fidl_next::RawWireUnion::encode_as::<___E, [u8; 32]>(value, 1, encoder, raw)?
11173 }
11174
11175 Self::UnknownOrdinal_(ordinal) => {
11176 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
11177 }
11178 }
11179
11180 Ok(())
11181 }
11182}
11183
11184unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigChecksum
11185where
11186 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
11187
11188 ___E: ::fidl_next::Encoder,
11189{
11190 #[inline]
11191 fn encode_ref(
11192 &self,
11193 encoder: &mut ___E,
11194 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11195 ) -> Result<(), ::fidl_next::EncodeError> {
11196 ::fidl_next::munge!(let WireConfigChecksum { raw, _phantom: _ } = out);
11197
11198 match self {
11199 Self::Sha256(value) => {
11200 ::fidl_next::RawWireUnion::encode_as::<___E, &[u8; 32]>(value, 1, encoder, raw)?
11201 }
11202
11203 Self::UnknownOrdinal_(ordinal) => {
11204 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
11205 }
11206 }
11207
11208 Ok(())
11209 }
11210}
11211
11212impl ::fidl_next::EncodableOption for ConfigChecksum {
11213 type EncodedOption = WireOptionalConfigChecksum<'static>;
11214}
11215
11216unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ConfigChecksum
11217where
11218 ___E: ?Sized,
11219 ConfigChecksum: ::fidl_next::Encode<___E>,
11220{
11221 #[inline]
11222 fn encode_option(
11223 this: Option<Self>,
11224 encoder: &mut ___E,
11225 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
11226 ) -> Result<(), ::fidl_next::EncodeError> {
11227 ::fidl_next::munge!(let WireOptionalConfigChecksum { raw, _phantom: _ } = &mut *out);
11228
11229 if let Some(inner) = this {
11230 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
11231 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
11232 } else {
11233 ::fidl_next::RawWireUnion::encode_absent(raw);
11234 }
11235
11236 Ok(())
11237 }
11238}
11239
11240unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ConfigChecksum
11241where
11242 ___E: ?Sized,
11243 ConfigChecksum: ::fidl_next::EncodeRef<___E>,
11244{
11245 #[inline]
11246 fn encode_option_ref(
11247 this: Option<&Self>,
11248 encoder: &mut ___E,
11249 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
11250 ) -> Result<(), ::fidl_next::EncodeError> {
11251 ::fidl_next::munge!(let WireOptionalConfigChecksum { raw, _phantom: _ } = &mut *out);
11252
11253 if let Some(inner) = this {
11254 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
11255 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
11256 } else {
11257 ::fidl_next::RawWireUnion::encode_absent(raw);
11258 }
11259
11260 Ok(())
11261 }
11262}
11263
11264impl<'de> ::fidl_next::FromWire<WireConfigChecksum<'de>> for ConfigChecksum {
11265 #[inline]
11266 fn from_wire(wire: WireConfigChecksum<'de>) -> Self {
11267 let wire = ::core::mem::ManuallyDrop::new(wire);
11268 match wire.raw.ordinal() {
11269 1 => Self::Sha256(::fidl_next::FromWire::from_wire(unsafe {
11270 wire.raw.get().read_unchecked::<[u8; 32]>()
11271 })),
11272
11273 _ => unsafe { ::core::hint::unreachable_unchecked() },
11274 }
11275 }
11276}
11277
11278impl<'de> ::fidl_next::FromWireRef<WireConfigChecksum<'de>> for ConfigChecksum {
11279 #[inline]
11280 fn from_wire_ref(wire: &WireConfigChecksum<'de>) -> Self {
11281 match wire.raw.ordinal() {
11282 1 => Self::Sha256(::fidl_next::FromWireRef::from_wire_ref(unsafe {
11283 wire.raw.get().deref_unchecked::<[u8; 32]>()
11284 })),
11285
11286 _ => unsafe { ::core::hint::unreachable_unchecked() },
11287 }
11288 }
11289}
11290
11291impl<'de> ::fidl_next::FromWireOption<WireOptionalConfigChecksum<'de>> for Box<ConfigChecksum> {
11292 #[inline]
11293 fn from_wire_option(wire: WireOptionalConfigChecksum<'de>) -> Option<Self> {
11294 if let Some(inner) = wire.into_option() {
11295 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
11296 } else {
11297 None
11298 }
11299 }
11300}
11301
11302impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalConfigChecksum<'de>> for Box<ConfigChecksum> {
11303 #[inline]
11304 fn from_wire_option_ref(wire: &WireOptionalConfigChecksum<'de>) -> Option<Self> {
11305 if let Some(inner) = wire.as_ref() {
11306 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
11307 } else {
11308 None
11309 }
11310 }
11311}
11312
11313#[repr(transparent)]
11315pub struct WireConfigChecksum<'de> {
11316 raw: ::fidl_next::RawWireUnion,
11317 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
11318}
11319
11320impl<'de> Drop for WireConfigChecksum<'de> {
11321 fn drop(&mut self) {
11322 match self.raw.ordinal() {
11323 1 => {
11324 let _ = unsafe { self.raw.get().read_unchecked::<[u8; 32]>() };
11325 }
11326
11327 _ => (),
11328 }
11329 }
11330}
11331
11332unsafe impl ::fidl_next::Wire for WireConfigChecksum<'static> {
11333 type Decoded<'de> = WireConfigChecksum<'de>;
11334
11335 #[inline]
11336 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
11337 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
11338 ::fidl_next::RawWireUnion::zero_padding(raw);
11339 }
11340}
11341
11342pub mod config_checksum {
11343 pub enum Ref<'de> {
11344 Sha256(&'de [u8; 32]),
11345
11346 UnknownOrdinal_(u64),
11347 }
11348}
11349
11350impl<'de> WireConfigChecksum<'de> {
11351 pub fn as_ref(&self) -> crate::config_checksum::Ref<'_> {
11352 match self.raw.ordinal() {
11353 1 => crate::config_checksum::Ref::Sha256(unsafe {
11354 self.raw.get().deref_unchecked::<[u8; 32]>()
11355 }),
11356
11357 unknown => crate::config_checksum::Ref::UnknownOrdinal_(unknown),
11358 }
11359 }
11360}
11361
11362unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigChecksum<'static>
11363where
11364 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
11365
11366 ___D: ::fidl_next::Decoder,
11367{
11368 fn decode(
11369 mut slot: ::fidl_next::Slot<'_, Self>,
11370 decoder: &mut ___D,
11371 ) -> Result<(), ::fidl_next::DecodeError> {
11372 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
11373 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
11374 1 => ::fidl_next::RawWireUnion::decode_as::<___D, [u8; 32]>(raw, decoder)?,
11375
11376 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
11377 }
11378
11379 Ok(())
11380 }
11381}
11382
11383impl<'de> ::core::fmt::Debug for WireConfigChecksum<'de> {
11384 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
11385 match self.raw.ordinal() {
11386 1 => unsafe { self.raw.get().deref_unchecked::<[u8; 32]>().fmt(f) },
11387 _ => unsafe { ::core::hint::unreachable_unchecked() },
11388 }
11389 }
11390}
11391
11392#[repr(transparent)]
11393pub struct WireOptionalConfigChecksum<'de> {
11394 raw: ::fidl_next::RawWireUnion,
11395 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
11396}
11397
11398unsafe impl ::fidl_next::Wire for WireOptionalConfigChecksum<'static> {
11399 type Decoded<'de> = WireOptionalConfigChecksum<'de>;
11400
11401 #[inline]
11402 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
11403 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
11404 ::fidl_next::RawWireUnion::zero_padding(raw);
11405 }
11406}
11407
11408impl<'de> WireOptionalConfigChecksum<'de> {
11409 pub fn is_some(&self) -> bool {
11410 self.raw.is_some()
11411 }
11412
11413 pub fn is_none(&self) -> bool {
11414 self.raw.is_none()
11415 }
11416
11417 pub fn as_ref(&self) -> Option<&WireConfigChecksum<'de>> {
11418 if self.is_some() {
11419 Some(unsafe { &*(self as *const Self).cast() })
11420 } else {
11421 None
11422 }
11423 }
11424
11425 pub fn into_option(self) -> Option<WireConfigChecksum<'de>> {
11426 if self.is_some() {
11427 Some(WireConfigChecksum { raw: self.raw, _phantom: ::core::marker::PhantomData })
11428 } else {
11429 None
11430 }
11431 }
11432}
11433
11434unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigChecksum<'static>
11435where
11436 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
11437
11438 ___D: ::fidl_next::Decoder,
11439{
11440 fn decode(
11441 mut slot: ::fidl_next::Slot<'_, Self>,
11442 decoder: &mut ___D,
11443 ) -> Result<(), ::fidl_next::DecodeError> {
11444 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
11445 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
11446 1 => ::fidl_next::RawWireUnion::decode_as::<___D, [u8; 32]>(raw, decoder)?,
11447
11448 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
11449 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
11450 }
11451
11452 Ok(())
11453 }
11454}
11455
11456impl<'de> ::core::fmt::Debug for WireOptionalConfigChecksum<'de> {
11457 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
11458 self.as_ref().fmt(f)
11459 }
11460}
11461
11462#[doc = " Declares storage used by a component, which was offered to it.\n"]
11463#[derive(Clone, Debug, Default)]
11464pub struct UseStorage {
11465 pub source_name: Option<String>,
11466
11467 pub target_path: Option<String>,
11468
11469 pub availability: Option<crate::Availability>,
11470}
11471
11472impl UseStorage {
11473 fn __max_ordinal(&self) -> usize {
11474 if self.availability.is_some() {
11475 return 3;
11476 }
11477
11478 if self.target_path.is_some() {
11479 return 2;
11480 }
11481
11482 if self.source_name.is_some() {
11483 return 1;
11484 }
11485
11486 0
11487 }
11488}
11489
11490impl ::fidl_next::Encodable for UseStorage {
11491 type Encoded = WireUseStorage<'static>;
11492}
11493
11494unsafe impl<___E> ::fidl_next::Encode<___E> for UseStorage
11495where
11496 ___E: ::fidl_next::Encoder + ?Sized,
11497{
11498 #[inline]
11499 fn encode(
11500 mut self,
11501 encoder: &mut ___E,
11502 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11503 ) -> Result<(), ::fidl_next::EncodeError> {
11504 ::fidl_next::munge!(let WireUseStorage { table } = out);
11505
11506 let max_ord = self.__max_ordinal();
11507
11508 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
11509 ::fidl_next::Wire::zero_padding(&mut out);
11510
11511 let mut preallocated =
11512 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
11513
11514 for i in 1..=max_ord {
11515 match i {
11516 3 => {
11517 if let Some(availability) = self.availability.take() {
11518 ::fidl_next::WireEnvelope::encode_value(
11519 availability,
11520 preallocated.encoder,
11521 &mut out,
11522 )?;
11523 } else {
11524 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11525 }
11526 }
11527
11528 2 => {
11529 if let Some(target_path) = self.target_path.take() {
11530 ::fidl_next::WireEnvelope::encode_value(
11531 target_path,
11532 preallocated.encoder,
11533 &mut out,
11534 )?;
11535 } else {
11536 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11537 }
11538 }
11539
11540 1 => {
11541 if let Some(source_name) = self.source_name.take() {
11542 ::fidl_next::WireEnvelope::encode_value(
11543 source_name,
11544 preallocated.encoder,
11545 &mut out,
11546 )?;
11547 } else {
11548 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11549 }
11550 }
11551
11552 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
11553 }
11554 unsafe {
11555 preallocated.write_next(out.assume_init_ref());
11556 }
11557 }
11558
11559 ::fidl_next::WireTable::encode_len(table, max_ord);
11560
11561 Ok(())
11562 }
11563}
11564
11565unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseStorage
11566where
11567 ___E: ::fidl_next::Encoder + ?Sized,
11568{
11569 #[inline]
11570 fn encode_ref(
11571 &self,
11572 encoder: &mut ___E,
11573 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11574 ) -> Result<(), ::fidl_next::EncodeError> {
11575 ::fidl_next::munge!(let WireUseStorage { table } = out);
11576
11577 let max_ord = self.__max_ordinal();
11578
11579 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
11580 ::fidl_next::Wire::zero_padding(&mut out);
11581
11582 let mut preallocated =
11583 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
11584
11585 for i in 1..=max_ord {
11586 match i {
11587 3 => {
11588 if let Some(availability) = &self.availability {
11589 ::fidl_next::WireEnvelope::encode_value(
11590 availability,
11591 preallocated.encoder,
11592 &mut out,
11593 )?;
11594 } else {
11595 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11596 }
11597 }
11598
11599 2 => {
11600 if let Some(target_path) = &self.target_path {
11601 ::fidl_next::WireEnvelope::encode_value(
11602 target_path,
11603 preallocated.encoder,
11604 &mut out,
11605 )?;
11606 } else {
11607 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11608 }
11609 }
11610
11611 1 => {
11612 if let Some(source_name) = &self.source_name {
11613 ::fidl_next::WireEnvelope::encode_value(
11614 source_name,
11615 preallocated.encoder,
11616 &mut out,
11617 )?;
11618 } else {
11619 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11620 }
11621 }
11622
11623 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
11624 }
11625 unsafe {
11626 preallocated.write_next(out.assume_init_ref());
11627 }
11628 }
11629
11630 ::fidl_next::WireTable::encode_len(table, max_ord);
11631
11632 Ok(())
11633 }
11634}
11635
11636impl<'de> ::fidl_next::FromWire<WireUseStorage<'de>> for UseStorage {
11637 #[inline]
11638 fn from_wire(wire: WireUseStorage<'de>) -> Self {
11639 let wire = ::core::mem::ManuallyDrop::new(wire);
11640
11641 let source_name = wire.table.get(1);
11642
11643 let target_path = wire.table.get(2);
11644
11645 let availability = wire.table.get(3);
11646
11647 Self {
11648 source_name: source_name.map(|envelope| {
11649 ::fidl_next::FromWire::from_wire(unsafe {
11650 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
11651 })
11652 }),
11653
11654 target_path: target_path.map(|envelope| {
11655 ::fidl_next::FromWire::from_wire(unsafe {
11656 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
11657 })
11658 }),
11659
11660 availability: availability.map(|envelope| {
11661 ::fidl_next::FromWire::from_wire(unsafe {
11662 envelope.read_unchecked::<crate::WireAvailability>()
11663 })
11664 }),
11665 }
11666 }
11667}
11668
11669impl<'de> ::fidl_next::FromWireRef<WireUseStorage<'de>> for UseStorage {
11670 #[inline]
11671 fn from_wire_ref(wire: &WireUseStorage<'de>) -> Self {
11672 Self {
11673 source_name: wire.table.get(1).map(|envelope| {
11674 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
11675 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
11676 })
11677 }),
11678
11679 target_path: wire.table.get(2).map(|envelope| {
11680 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
11681 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
11682 })
11683 }),
11684
11685 availability: wire.table.get(3).map(|envelope| {
11686 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
11687 envelope.deref_unchecked::<crate::WireAvailability>()
11688 })
11689 }),
11690 }
11691 }
11692}
11693
11694#[repr(C)]
11696pub struct WireUseStorage<'de> {
11697 table: ::fidl_next::WireTable<'de>,
11698}
11699
11700impl<'de> Drop for WireUseStorage<'de> {
11701 fn drop(&mut self) {
11702 let _ = self
11703 .table
11704 .get(1)
11705 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
11706
11707 let _ = self
11708 .table
11709 .get(2)
11710 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
11711
11712 let _ = self
11713 .table
11714 .get(3)
11715 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
11716 }
11717}
11718
11719unsafe impl ::fidl_next::Wire for WireUseStorage<'static> {
11720 type Decoded<'de> = WireUseStorage<'de>;
11721
11722 #[inline]
11723 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
11724 ::fidl_next::munge!(let Self { table } = out);
11725 ::fidl_next::WireTable::zero_padding(table);
11726 }
11727}
11728
11729unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseStorage<'static>
11730where
11731 ___D: ::fidl_next::Decoder + ?Sized,
11732{
11733 fn decode(
11734 slot: ::fidl_next::Slot<'_, Self>,
11735 decoder: &mut ___D,
11736 ) -> Result<(), ::fidl_next::DecodeError> {
11737 ::fidl_next::munge!(let Self { table } = slot);
11738
11739 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
11740 match ordinal {
11741 0 => unsafe { ::core::hint::unreachable_unchecked() },
11742
11743 1 => {
11744 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
11745 slot.as_mut(),
11746 decoder,
11747 )?;
11748
11749 let source_name = unsafe {
11750 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
11751 };
11752
11753 if source_name.len() > 100 {
11754 return Err(::fidl_next::DecodeError::VectorTooLong {
11755 size: source_name.len() as u64,
11756 limit: 100,
11757 });
11758 }
11759
11760 Ok(())
11761 }
11762
11763 2 => {
11764 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
11765 slot.as_mut(),
11766 decoder,
11767 )?;
11768
11769 let target_path = unsafe {
11770 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
11771 };
11772
11773 if target_path.len() > 1024 {
11774 return Err(::fidl_next::DecodeError::VectorTooLong {
11775 size: target_path.len() as u64,
11776 limit: 1024,
11777 });
11778 }
11779
11780 Ok(())
11781 }
11782
11783 3 => {
11784 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
11785 slot.as_mut(),
11786 decoder,
11787 )?;
11788
11789 Ok(())
11790 }
11791
11792 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
11793 }
11794 })
11795 }
11796}
11797
11798impl<'de> WireUseStorage<'de> {
11799 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
11800 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
11801 }
11802
11803 pub fn target_path(&self) -> Option<&::fidl_next::WireString<'de>> {
11804 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
11805 }
11806
11807 pub fn availability(&self) -> Option<&crate::WireAvailability> {
11808 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
11809 }
11810}
11811
11812impl<'de> ::core::fmt::Debug for WireUseStorage<'de> {
11813 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
11814 f.debug_struct("UseStorage")
11815 .field("source_name", &self.source_name())
11816 .field("target_path", &self.target_path())
11817 .field("availability", &self.availability())
11818 .finish()
11819 }
11820}
11821
11822::fidl_next::bitflags! {
11823 #[doc = " Allowed sources for runtime overrides of a config field\'s value.\n"]#[derive(
11824 Clone,
11825 Copy,
11826 Debug,
11827 PartialEq,
11828 Eq,
11829 Hash,
11830 )]
11831 pub struct ConfigMutability: u32 {
11832 #[doc = " Allow parent components to provide overrides for the configuration field.\n"]const PARENT = 1;
11833 const _ = !0;
11834 }
11835}
11836
11837impl ::fidl_next::Encodable for ConfigMutability {
11838 type Encoded = WireConfigMutability;
11839}
11840
11841unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigMutability
11842where
11843 ___E: ?Sized,
11844{
11845 #[inline]
11846 fn encode(
11847 self,
11848 encoder: &mut ___E,
11849 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11850 ) -> Result<(), ::fidl_next::EncodeError> {
11851 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
11852 }
11853}
11854
11855unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigMutability
11856where
11857 ___E: ?Sized,
11858{
11859 #[inline]
11860 fn encode_ref(
11861 &self,
11862 _: &mut ___E,
11863 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11864 ) -> Result<(), ::fidl_next::EncodeError> {
11865 ::fidl_next::munge!(let WireConfigMutability { value } = out);
11866 let _ = value.write(::fidl_next::WireU32::from(self.bits()));
11867 Ok(())
11868 }
11869}
11870
11871impl ::core::convert::From<WireConfigMutability> for ConfigMutability {
11872 fn from(wire: WireConfigMutability) -> Self {
11873 Self::from_bits_retain(u32::from(wire.value))
11874 }
11875}
11876
11877impl ::fidl_next::FromWire<WireConfigMutability> for ConfigMutability {
11878 #[inline]
11879 fn from_wire(wire: WireConfigMutability) -> Self {
11880 Self::from(wire)
11881 }
11882}
11883
11884impl ::fidl_next::FromWireRef<WireConfigMutability> for ConfigMutability {
11885 #[inline]
11886 fn from_wire_ref(wire: &WireConfigMutability) -> Self {
11887 Self::from(*wire)
11888 }
11889}
11890
11891#[derive(Clone, Copy, Debug)]
11893#[repr(transparent)]
11894pub struct WireConfigMutability {
11895 value: ::fidl_next::WireU32,
11896}
11897
11898unsafe impl ::fidl_next::Wire for WireConfigMutability {
11899 type Decoded<'de> = Self;
11900
11901 #[inline]
11902 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
11903 }
11905}
11906
11907unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigMutability
11908where
11909 ___D: ?Sized,
11910{
11911 fn decode(
11912 slot: ::fidl_next::Slot<'_, Self>,
11913 _: &mut ___D,
11914 ) -> Result<(), ::fidl_next::DecodeError> {
11915 Ok(())
11916 }
11917}
11918
11919impl ::core::convert::From<ConfigMutability> for WireConfigMutability {
11920 fn from(natural: ConfigMutability) -> Self {
11921 Self { value: ::fidl_next::WireU32::from(natural.bits()) }
11922 }
11923}
11924
11925#[doc = " Declares a single config field (key + type)\n"]
11926#[derive(Clone, Debug, Default)]
11927pub struct ConfigField {
11928 pub key: Option<String>,
11929
11930 pub type_: Option<crate::ConfigType>,
11931
11932 pub mutability: Option<crate::ConfigMutability>,
11933}
11934
11935impl ConfigField {
11936 fn __max_ordinal(&self) -> usize {
11937 if self.mutability.is_some() {
11938 return 3;
11939 }
11940
11941 if self.type_.is_some() {
11942 return 2;
11943 }
11944
11945 if self.key.is_some() {
11946 return 1;
11947 }
11948
11949 0
11950 }
11951}
11952
11953impl ::fidl_next::Encodable for ConfigField {
11954 type Encoded = WireConfigField<'static>;
11955}
11956
11957unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigField
11958where
11959 ___E: ::fidl_next::Encoder + ?Sized,
11960{
11961 #[inline]
11962 fn encode(
11963 mut self,
11964 encoder: &mut ___E,
11965 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11966 ) -> Result<(), ::fidl_next::EncodeError> {
11967 ::fidl_next::munge!(let WireConfigField { table } = out);
11968
11969 let max_ord = self.__max_ordinal();
11970
11971 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
11972 ::fidl_next::Wire::zero_padding(&mut out);
11973
11974 let mut preallocated =
11975 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
11976
11977 for i in 1..=max_ord {
11978 match i {
11979 3 => {
11980 if let Some(mutability) = self.mutability.take() {
11981 ::fidl_next::WireEnvelope::encode_value(
11982 mutability,
11983 preallocated.encoder,
11984 &mut out,
11985 )?;
11986 } else {
11987 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11988 }
11989 }
11990
11991 2 => {
11992 if let Some(type_) = self.type_.take() {
11993 ::fidl_next::WireEnvelope::encode_value(
11994 type_,
11995 preallocated.encoder,
11996 &mut out,
11997 )?;
11998 } else {
11999 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12000 }
12001 }
12002
12003 1 => {
12004 if let Some(key) = self.key.take() {
12005 ::fidl_next::WireEnvelope::encode_value(
12006 key,
12007 preallocated.encoder,
12008 &mut out,
12009 )?;
12010 } else {
12011 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12012 }
12013 }
12014
12015 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12016 }
12017 unsafe {
12018 preallocated.write_next(out.assume_init_ref());
12019 }
12020 }
12021
12022 ::fidl_next::WireTable::encode_len(table, max_ord);
12023
12024 Ok(())
12025 }
12026}
12027
12028unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigField
12029where
12030 ___E: ::fidl_next::Encoder + ?Sized,
12031{
12032 #[inline]
12033 fn encode_ref(
12034 &self,
12035 encoder: &mut ___E,
12036 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12037 ) -> Result<(), ::fidl_next::EncodeError> {
12038 ::fidl_next::munge!(let WireConfigField { table } = out);
12039
12040 let max_ord = self.__max_ordinal();
12041
12042 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12043 ::fidl_next::Wire::zero_padding(&mut out);
12044
12045 let mut preallocated =
12046 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12047
12048 for i in 1..=max_ord {
12049 match i {
12050 3 => {
12051 if let Some(mutability) = &self.mutability {
12052 ::fidl_next::WireEnvelope::encode_value(
12053 mutability,
12054 preallocated.encoder,
12055 &mut out,
12056 )?;
12057 } else {
12058 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12059 }
12060 }
12061
12062 2 => {
12063 if let Some(type_) = &self.type_ {
12064 ::fidl_next::WireEnvelope::encode_value(
12065 type_,
12066 preallocated.encoder,
12067 &mut out,
12068 )?;
12069 } else {
12070 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12071 }
12072 }
12073
12074 1 => {
12075 if let Some(key) = &self.key {
12076 ::fidl_next::WireEnvelope::encode_value(
12077 key,
12078 preallocated.encoder,
12079 &mut out,
12080 )?;
12081 } else {
12082 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12083 }
12084 }
12085
12086 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12087 }
12088 unsafe {
12089 preallocated.write_next(out.assume_init_ref());
12090 }
12091 }
12092
12093 ::fidl_next::WireTable::encode_len(table, max_ord);
12094
12095 Ok(())
12096 }
12097}
12098
12099impl<'de> ::fidl_next::FromWire<WireConfigField<'de>> for ConfigField {
12100 #[inline]
12101 fn from_wire(wire: WireConfigField<'de>) -> Self {
12102 let wire = ::core::mem::ManuallyDrop::new(wire);
12103
12104 let key = wire.table.get(1);
12105
12106 let type_ = wire.table.get(2);
12107
12108 let mutability = wire.table.get(3);
12109
12110 Self {
12111 key: key.map(|envelope| {
12112 ::fidl_next::FromWire::from_wire(unsafe {
12113 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
12114 })
12115 }),
12116
12117 type_: type_.map(|envelope| {
12118 ::fidl_next::FromWire::from_wire(unsafe {
12119 envelope.read_unchecked::<crate::WireConfigType<'de>>()
12120 })
12121 }),
12122
12123 mutability: mutability.map(|envelope| {
12124 ::fidl_next::FromWire::from_wire(unsafe {
12125 envelope.read_unchecked::<crate::WireConfigMutability>()
12126 })
12127 }),
12128 }
12129 }
12130}
12131
12132impl<'de> ::fidl_next::FromWireRef<WireConfigField<'de>> for ConfigField {
12133 #[inline]
12134 fn from_wire_ref(wire: &WireConfigField<'de>) -> Self {
12135 Self {
12136 key: wire.table.get(1).map(|envelope| {
12137 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12138 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
12139 })
12140 }),
12141
12142 type_: wire.table.get(2).map(|envelope| {
12143 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12144 envelope.deref_unchecked::<crate::WireConfigType<'de>>()
12145 })
12146 }),
12147
12148 mutability: wire.table.get(3).map(|envelope| {
12149 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12150 envelope.deref_unchecked::<crate::WireConfigMutability>()
12151 })
12152 }),
12153 }
12154 }
12155}
12156
12157#[repr(C)]
12159pub struct WireConfigField<'de> {
12160 table: ::fidl_next::WireTable<'de>,
12161}
12162
12163impl<'de> Drop for WireConfigField<'de> {
12164 fn drop(&mut self) {
12165 let _ = self
12166 .table
12167 .get(1)
12168 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
12169
12170 let _ = self
12171 .table
12172 .get(2)
12173 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigType<'de>>() });
12174
12175 let _ = self
12176 .table
12177 .get(3)
12178 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigMutability>() });
12179 }
12180}
12181
12182unsafe impl ::fidl_next::Wire for WireConfigField<'static> {
12183 type Decoded<'de> = WireConfigField<'de>;
12184
12185 #[inline]
12186 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
12187 ::fidl_next::munge!(let Self { table } = out);
12188 ::fidl_next::WireTable::zero_padding(table);
12189 }
12190}
12191
12192unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigField<'static>
12193where
12194 ___D: ::fidl_next::Decoder + ?Sized,
12195{
12196 fn decode(
12197 slot: ::fidl_next::Slot<'_, Self>,
12198 decoder: &mut ___D,
12199 ) -> Result<(), ::fidl_next::DecodeError> {
12200 ::fidl_next::munge!(let Self { table } = slot);
12201
12202 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
12203 match ordinal {
12204 0 => unsafe { ::core::hint::unreachable_unchecked() },
12205
12206 1 => {
12207 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
12208 slot.as_mut(),
12209 decoder,
12210 )?;
12211
12212 let key = unsafe {
12213 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
12214 };
12215
12216 if key.len() > 64 {
12217 return Err(::fidl_next::DecodeError::VectorTooLong {
12218 size: key.len() as u64,
12219 limit: 64,
12220 });
12221 }
12222
12223 Ok(())
12224 }
12225
12226 2 => {
12227 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigType<'static>>(
12228 slot.as_mut(),
12229 decoder,
12230 )?;
12231
12232 Ok(())
12233 }
12234
12235 3 => {
12236 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigMutability>(
12237 slot.as_mut(),
12238 decoder,
12239 )?;
12240
12241 Ok(())
12242 }
12243
12244 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
12245 }
12246 })
12247 }
12248}
12249
12250impl<'de> WireConfigField<'de> {
12251 pub fn key(&self) -> Option<&::fidl_next::WireString<'de>> {
12252 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
12253 }
12254
12255 pub fn type_(&self) -> Option<&crate::WireConfigType<'de>> {
12256 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
12257 }
12258
12259 pub fn mutability(&self) -> Option<&crate::WireConfigMutability> {
12260 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
12261 }
12262}
12263
12264impl<'de> ::core::fmt::Debug for WireConfigField<'de> {
12265 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
12266 f.debug_struct("ConfigField")
12267 .field("key", &self.key())
12268 .field("type_", &self.type_())
12269 .field("mutability", &self.mutability())
12270 .finish()
12271 }
12272}
12273
12274#[doc = " A program declaration.\n\n This declaration is set by executable components to designate the runner to\n use and pass runner-specific program information to it.\n\n To learn more about runners, see:\n https://fuchsia.dev/fuchsia-src/glossary#runner\n"]
12275#[derive(Clone, Debug, Default)]
12276pub struct Program {
12277 pub runner: Option<String>,
12278
12279 pub info: Option<::fidl_next_fuchsia_data::Dictionary>,
12280}
12281
12282impl Program {
12283 fn __max_ordinal(&self) -> usize {
12284 if self.info.is_some() {
12285 return 2;
12286 }
12287
12288 if self.runner.is_some() {
12289 return 1;
12290 }
12291
12292 0
12293 }
12294}
12295
12296impl ::fidl_next::Encodable for Program {
12297 type Encoded = WireProgram<'static>;
12298}
12299
12300unsafe impl<___E> ::fidl_next::Encode<___E> for Program
12301where
12302 ___E: ::fidl_next::Encoder + ?Sized,
12303{
12304 #[inline]
12305 fn encode(
12306 mut self,
12307 encoder: &mut ___E,
12308 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12309 ) -> Result<(), ::fidl_next::EncodeError> {
12310 ::fidl_next::munge!(let WireProgram { table } = out);
12311
12312 let max_ord = self.__max_ordinal();
12313
12314 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12315 ::fidl_next::Wire::zero_padding(&mut out);
12316
12317 let mut preallocated =
12318 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12319
12320 for i in 1..=max_ord {
12321 match i {
12322 2 => {
12323 if let Some(info) = self.info.take() {
12324 ::fidl_next::WireEnvelope::encode_value(
12325 info,
12326 preallocated.encoder,
12327 &mut out,
12328 )?;
12329 } else {
12330 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12331 }
12332 }
12333
12334 1 => {
12335 if let Some(runner) = self.runner.take() {
12336 ::fidl_next::WireEnvelope::encode_value(
12337 runner,
12338 preallocated.encoder,
12339 &mut out,
12340 )?;
12341 } else {
12342 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12343 }
12344 }
12345
12346 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12347 }
12348 unsafe {
12349 preallocated.write_next(out.assume_init_ref());
12350 }
12351 }
12352
12353 ::fidl_next::WireTable::encode_len(table, max_ord);
12354
12355 Ok(())
12356 }
12357}
12358
12359unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Program
12360where
12361 ___E: ::fidl_next::Encoder + ?Sized,
12362{
12363 #[inline]
12364 fn encode_ref(
12365 &self,
12366 encoder: &mut ___E,
12367 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12368 ) -> Result<(), ::fidl_next::EncodeError> {
12369 ::fidl_next::munge!(let WireProgram { table } = out);
12370
12371 let max_ord = self.__max_ordinal();
12372
12373 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12374 ::fidl_next::Wire::zero_padding(&mut out);
12375
12376 let mut preallocated =
12377 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12378
12379 for i in 1..=max_ord {
12380 match i {
12381 2 => {
12382 if let Some(info) = &self.info {
12383 ::fidl_next::WireEnvelope::encode_value(
12384 info,
12385 preallocated.encoder,
12386 &mut out,
12387 )?;
12388 } else {
12389 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12390 }
12391 }
12392
12393 1 => {
12394 if let Some(runner) = &self.runner {
12395 ::fidl_next::WireEnvelope::encode_value(
12396 runner,
12397 preallocated.encoder,
12398 &mut out,
12399 )?;
12400 } else {
12401 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12402 }
12403 }
12404
12405 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12406 }
12407 unsafe {
12408 preallocated.write_next(out.assume_init_ref());
12409 }
12410 }
12411
12412 ::fidl_next::WireTable::encode_len(table, max_ord);
12413
12414 Ok(())
12415 }
12416}
12417
12418impl<'de> ::fidl_next::FromWire<WireProgram<'de>> for Program {
12419 #[inline]
12420 fn from_wire(wire: WireProgram<'de>) -> Self {
12421 let wire = ::core::mem::ManuallyDrop::new(wire);
12422
12423 let runner = wire.table.get(1);
12424
12425 let info = wire.table.get(2);
12426
12427 Self {
12428 runner: runner.map(|envelope| {
12429 ::fidl_next::FromWire::from_wire(unsafe {
12430 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
12431 })
12432 }),
12433
12434 info: info.map(|envelope| {
12435 ::fidl_next::FromWire::from_wire(unsafe {
12436 envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
12437 })
12438 }),
12439 }
12440 }
12441}
12442
12443impl<'de> ::fidl_next::FromWireRef<WireProgram<'de>> for Program {
12444 #[inline]
12445 fn from_wire_ref(wire: &WireProgram<'de>) -> Self {
12446 Self {
12447 runner: wire.table.get(1).map(|envelope| {
12448 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12449 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
12450 })
12451 }),
12452
12453 info: wire.table.get(2).map(|envelope| {
12454 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12455 envelope.deref_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
12456 })
12457 }),
12458 }
12459 }
12460}
12461
12462#[repr(C)]
12464pub struct WireProgram<'de> {
12465 table: ::fidl_next::WireTable<'de>,
12466}
12467
12468impl<'de> Drop for WireProgram<'de> {
12469 fn drop(&mut self) {
12470 let _ = self
12471 .table
12472 .get(1)
12473 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
12474
12475 let _ = self.table.get(2).map(|envelope| unsafe {
12476 envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
12477 });
12478 }
12479}
12480
12481unsafe impl ::fidl_next::Wire for WireProgram<'static> {
12482 type Decoded<'de> = WireProgram<'de>;
12483
12484 #[inline]
12485 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
12486 ::fidl_next::munge!(let Self { table } = out);
12487 ::fidl_next::WireTable::zero_padding(table);
12488 }
12489}
12490
12491unsafe impl<___D> ::fidl_next::Decode<___D> for WireProgram<'static>
12492where
12493 ___D: ::fidl_next::Decoder + ?Sized,
12494{
12495 fn decode(
12496 slot: ::fidl_next::Slot<'_, Self>,
12497 decoder: &mut ___D,
12498 ) -> Result<(), ::fidl_next::DecodeError> {
12499 ::fidl_next::munge!(let Self { table } = slot);
12500
12501 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
12502 match ordinal {
12503 0 => unsafe { ::core::hint::unreachable_unchecked() },
12504
12505 1 => {
12506 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
12507 slot.as_mut(),
12508 decoder,
12509 )?;
12510
12511 let runner = unsafe {
12512 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
12513 };
12514
12515 if runner.len() > 100 {
12516 return Err(::fidl_next::DecodeError::VectorTooLong {
12517 size: runner.len() as u64,
12518 limit: 100,
12519 });
12520 }
12521
12522 Ok(())
12523 }
12524
12525 2 => {
12526 ::fidl_next::WireEnvelope::decode_as::<
12527 ___D,
12528 ::fidl_next_fuchsia_data::WireDictionary<'static>,
12529 >(slot.as_mut(), decoder)?;
12530
12531 Ok(())
12532 }
12533
12534 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
12535 }
12536 })
12537 }
12538}
12539
12540impl<'de> WireProgram<'de> {
12541 pub fn runner(&self) -> Option<&::fidl_next::WireString<'de>> {
12542 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
12543 }
12544
12545 pub fn info(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary<'de>> {
12546 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
12547 }
12548}
12549
12550impl<'de> ::core::fmt::Debug for WireProgram<'de> {
12551 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
12552 f.debug_struct("Program")
12553 .field("runner", &self.runner())
12554 .field("info", &self.info())
12555 .finish()
12556 }
12557}
12558
12559#[doc = " Declares a service used by a component, which was offered to it.\n\n To learn more about services, see:\n https://fuchsia.dev/fuchsia-src/glossary#service\n"]
12560#[derive(Clone, Debug, Default)]
12561pub struct UseService {
12562 pub source: Option<crate::Ref>,
12563
12564 pub source_name: Option<String>,
12565
12566 pub target_path: Option<String>,
12567
12568 pub dependency_type: Option<crate::DependencyType>,
12569
12570 pub availability: Option<crate::Availability>,
12571
12572 pub source_dictionary: Option<String>,
12573}
12574
12575impl UseService {
12576 fn __max_ordinal(&self) -> usize {
12577 if self.source_dictionary.is_some() {
12578 return 6;
12579 }
12580
12581 if self.availability.is_some() {
12582 return 5;
12583 }
12584
12585 if self.dependency_type.is_some() {
12586 return 4;
12587 }
12588
12589 if self.target_path.is_some() {
12590 return 3;
12591 }
12592
12593 if self.source_name.is_some() {
12594 return 2;
12595 }
12596
12597 if self.source.is_some() {
12598 return 1;
12599 }
12600
12601 0
12602 }
12603}
12604
12605impl ::fidl_next::Encodable for UseService {
12606 type Encoded = WireUseService<'static>;
12607}
12608
12609unsafe impl<___E> ::fidl_next::Encode<___E> for UseService
12610where
12611 ___E: ::fidl_next::Encoder + ?Sized,
12612{
12613 #[inline]
12614 fn encode(
12615 mut self,
12616 encoder: &mut ___E,
12617 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12618 ) -> Result<(), ::fidl_next::EncodeError> {
12619 ::fidl_next::munge!(let WireUseService { table } = out);
12620
12621 let max_ord = self.__max_ordinal();
12622
12623 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12624 ::fidl_next::Wire::zero_padding(&mut out);
12625
12626 let mut preallocated =
12627 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12628
12629 for i in 1..=max_ord {
12630 match i {
12631 6 => {
12632 if let Some(source_dictionary) = self.source_dictionary.take() {
12633 ::fidl_next::WireEnvelope::encode_value(
12634 source_dictionary,
12635 preallocated.encoder,
12636 &mut out,
12637 )?;
12638 } else {
12639 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12640 }
12641 }
12642
12643 5 => {
12644 if let Some(availability) = self.availability.take() {
12645 ::fidl_next::WireEnvelope::encode_value(
12646 availability,
12647 preallocated.encoder,
12648 &mut out,
12649 )?;
12650 } else {
12651 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12652 }
12653 }
12654
12655 4 => {
12656 if let Some(dependency_type) = self.dependency_type.take() {
12657 ::fidl_next::WireEnvelope::encode_value(
12658 dependency_type,
12659 preallocated.encoder,
12660 &mut out,
12661 )?;
12662 } else {
12663 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12664 }
12665 }
12666
12667 3 => {
12668 if let Some(target_path) = self.target_path.take() {
12669 ::fidl_next::WireEnvelope::encode_value(
12670 target_path,
12671 preallocated.encoder,
12672 &mut out,
12673 )?;
12674 } else {
12675 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12676 }
12677 }
12678
12679 2 => {
12680 if let Some(source_name) = self.source_name.take() {
12681 ::fidl_next::WireEnvelope::encode_value(
12682 source_name,
12683 preallocated.encoder,
12684 &mut out,
12685 )?;
12686 } else {
12687 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12688 }
12689 }
12690
12691 1 => {
12692 if let Some(source) = self.source.take() {
12693 ::fidl_next::WireEnvelope::encode_value(
12694 source,
12695 preallocated.encoder,
12696 &mut out,
12697 )?;
12698 } else {
12699 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12700 }
12701 }
12702
12703 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12704 }
12705 unsafe {
12706 preallocated.write_next(out.assume_init_ref());
12707 }
12708 }
12709
12710 ::fidl_next::WireTable::encode_len(table, max_ord);
12711
12712 Ok(())
12713 }
12714}
12715
12716unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseService
12717where
12718 ___E: ::fidl_next::Encoder + ?Sized,
12719{
12720 #[inline]
12721 fn encode_ref(
12722 &self,
12723 encoder: &mut ___E,
12724 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12725 ) -> Result<(), ::fidl_next::EncodeError> {
12726 ::fidl_next::munge!(let WireUseService { table } = out);
12727
12728 let max_ord = self.__max_ordinal();
12729
12730 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12731 ::fidl_next::Wire::zero_padding(&mut out);
12732
12733 let mut preallocated =
12734 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12735
12736 for i in 1..=max_ord {
12737 match i {
12738 6 => {
12739 if let Some(source_dictionary) = &self.source_dictionary {
12740 ::fidl_next::WireEnvelope::encode_value(
12741 source_dictionary,
12742 preallocated.encoder,
12743 &mut out,
12744 )?;
12745 } else {
12746 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12747 }
12748 }
12749
12750 5 => {
12751 if let Some(availability) = &self.availability {
12752 ::fidl_next::WireEnvelope::encode_value(
12753 availability,
12754 preallocated.encoder,
12755 &mut out,
12756 )?;
12757 } else {
12758 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12759 }
12760 }
12761
12762 4 => {
12763 if let Some(dependency_type) = &self.dependency_type {
12764 ::fidl_next::WireEnvelope::encode_value(
12765 dependency_type,
12766 preallocated.encoder,
12767 &mut out,
12768 )?;
12769 } else {
12770 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12771 }
12772 }
12773
12774 3 => {
12775 if let Some(target_path) = &self.target_path {
12776 ::fidl_next::WireEnvelope::encode_value(
12777 target_path,
12778 preallocated.encoder,
12779 &mut out,
12780 )?;
12781 } else {
12782 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12783 }
12784 }
12785
12786 2 => {
12787 if let Some(source_name) = &self.source_name {
12788 ::fidl_next::WireEnvelope::encode_value(
12789 source_name,
12790 preallocated.encoder,
12791 &mut out,
12792 )?;
12793 } else {
12794 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12795 }
12796 }
12797
12798 1 => {
12799 if let Some(source) = &self.source {
12800 ::fidl_next::WireEnvelope::encode_value(
12801 source,
12802 preallocated.encoder,
12803 &mut out,
12804 )?;
12805 } else {
12806 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12807 }
12808 }
12809
12810 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12811 }
12812 unsafe {
12813 preallocated.write_next(out.assume_init_ref());
12814 }
12815 }
12816
12817 ::fidl_next::WireTable::encode_len(table, max_ord);
12818
12819 Ok(())
12820 }
12821}
12822
12823impl<'de> ::fidl_next::FromWire<WireUseService<'de>> for UseService {
12824 #[inline]
12825 fn from_wire(wire: WireUseService<'de>) -> Self {
12826 let wire = ::core::mem::ManuallyDrop::new(wire);
12827
12828 let source = wire.table.get(1);
12829
12830 let source_name = wire.table.get(2);
12831
12832 let target_path = wire.table.get(3);
12833
12834 let dependency_type = wire.table.get(4);
12835
12836 let availability = wire.table.get(5);
12837
12838 let source_dictionary = wire.table.get(6);
12839
12840 Self {
12841 source: source.map(|envelope| {
12842 ::fidl_next::FromWire::from_wire(unsafe {
12843 envelope.read_unchecked::<crate::WireRef<'de>>()
12844 })
12845 }),
12846
12847 source_name: source_name.map(|envelope| {
12848 ::fidl_next::FromWire::from_wire(unsafe {
12849 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
12850 })
12851 }),
12852
12853 target_path: target_path.map(|envelope| {
12854 ::fidl_next::FromWire::from_wire(unsafe {
12855 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
12856 })
12857 }),
12858
12859 dependency_type: dependency_type.map(|envelope| {
12860 ::fidl_next::FromWire::from_wire(unsafe {
12861 envelope.read_unchecked::<crate::WireDependencyType>()
12862 })
12863 }),
12864
12865 availability: availability.map(|envelope| {
12866 ::fidl_next::FromWire::from_wire(unsafe {
12867 envelope.read_unchecked::<crate::WireAvailability>()
12868 })
12869 }),
12870
12871 source_dictionary: source_dictionary.map(|envelope| {
12872 ::fidl_next::FromWire::from_wire(unsafe {
12873 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
12874 })
12875 }),
12876 }
12877 }
12878}
12879
12880impl<'de> ::fidl_next::FromWireRef<WireUseService<'de>> for UseService {
12881 #[inline]
12882 fn from_wire_ref(wire: &WireUseService<'de>) -> Self {
12883 Self {
12884 source: wire.table.get(1).map(|envelope| {
12885 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12886 envelope.deref_unchecked::<crate::WireRef<'de>>()
12887 })
12888 }),
12889
12890 source_name: wire.table.get(2).map(|envelope| {
12891 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12892 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
12893 })
12894 }),
12895
12896 target_path: wire.table.get(3).map(|envelope| {
12897 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12898 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
12899 })
12900 }),
12901
12902 dependency_type: wire.table.get(4).map(|envelope| {
12903 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12904 envelope.deref_unchecked::<crate::WireDependencyType>()
12905 })
12906 }),
12907
12908 availability: wire.table.get(5).map(|envelope| {
12909 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12910 envelope.deref_unchecked::<crate::WireAvailability>()
12911 })
12912 }),
12913
12914 source_dictionary: wire.table.get(6).map(|envelope| {
12915 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
12916 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
12917 })
12918 }),
12919 }
12920 }
12921}
12922
12923#[repr(C)]
12925pub struct WireUseService<'de> {
12926 table: ::fidl_next::WireTable<'de>,
12927}
12928
12929impl<'de> Drop for WireUseService<'de> {
12930 fn drop(&mut self) {
12931 let _ = self
12932 .table
12933 .get(1)
12934 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
12935
12936 let _ = self
12937 .table
12938 .get(2)
12939 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
12940
12941 let _ = self
12942 .table
12943 .get(3)
12944 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
12945
12946 let _ = self
12947 .table
12948 .get(4)
12949 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDependencyType>() });
12950
12951 let _ = self
12952 .table
12953 .get(5)
12954 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
12955
12956 let _ = self
12957 .table
12958 .get(6)
12959 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
12960 }
12961}
12962
12963unsafe impl ::fidl_next::Wire for WireUseService<'static> {
12964 type Decoded<'de> = WireUseService<'de>;
12965
12966 #[inline]
12967 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
12968 ::fidl_next::munge!(let Self { table } = out);
12969 ::fidl_next::WireTable::zero_padding(table);
12970 }
12971}
12972
12973unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseService<'static>
12974where
12975 ___D: ::fidl_next::Decoder + ?Sized,
12976{
12977 fn decode(
12978 slot: ::fidl_next::Slot<'_, Self>,
12979 decoder: &mut ___D,
12980 ) -> Result<(), ::fidl_next::DecodeError> {
12981 ::fidl_next::munge!(let Self { table } = slot);
12982
12983 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
12984 match ordinal {
12985 0 => unsafe { ::core::hint::unreachable_unchecked() },
12986
12987 1 => {
12988 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
12989 slot.as_mut(),
12990 decoder,
12991 )?;
12992
12993 Ok(())
12994 }
12995
12996 2 => {
12997 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
12998 slot.as_mut(),
12999 decoder,
13000 )?;
13001
13002 let source_name = unsafe {
13003 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
13004 };
13005
13006 if source_name.len() > 100 {
13007 return Err(::fidl_next::DecodeError::VectorTooLong {
13008 size: source_name.len() as u64,
13009 limit: 100,
13010 });
13011 }
13012
13013 Ok(())
13014 }
13015
13016 3 => {
13017 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
13018 slot.as_mut(),
13019 decoder,
13020 )?;
13021
13022 let target_path = unsafe {
13023 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
13024 };
13025
13026 if target_path.len() > 1024 {
13027 return Err(::fidl_next::DecodeError::VectorTooLong {
13028 size: target_path.len() as u64,
13029 limit: 1024,
13030 });
13031 }
13032
13033 Ok(())
13034 }
13035
13036 4 => {
13037 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
13038 slot.as_mut(),
13039 decoder,
13040 )?;
13041
13042 Ok(())
13043 }
13044
13045 5 => {
13046 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
13047 slot.as_mut(),
13048 decoder,
13049 )?;
13050
13051 Ok(())
13052 }
13053
13054 6 => {
13055 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
13056 slot.as_mut(),
13057 decoder,
13058 )?;
13059
13060 let source_dictionary = unsafe {
13061 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
13062 };
13063
13064 if source_dictionary.len() > 1024 {
13065 return Err(::fidl_next::DecodeError::VectorTooLong {
13066 size: source_dictionary.len() as u64,
13067 limit: 1024,
13068 });
13069 }
13070
13071 Ok(())
13072 }
13073
13074 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
13075 }
13076 })
13077 }
13078}
13079
13080impl<'de> WireUseService<'de> {
13081 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
13082 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
13083 }
13084
13085 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
13086 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
13087 }
13088
13089 pub fn target_path(&self) -> Option<&::fidl_next::WireString<'de>> {
13090 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
13091 }
13092
13093 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
13094 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
13095 }
13096
13097 pub fn availability(&self) -> Option<&crate::WireAvailability> {
13098 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
13099 }
13100
13101 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
13102 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
13103 }
13104}
13105
13106impl<'de> ::core::fmt::Debug for WireUseService<'de> {
13107 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
13108 f.debug_struct("UseService")
13109 .field("source", &self.source())
13110 .field("source_name", &self.source_name())
13111 .field("target_path", &self.target_path())
13112 .field("dependency_type", &self.dependency_type())
13113 .field("availability", &self.availability())
13114 .field("source_dictionary", &self.source_dictionary())
13115 .finish()
13116 }
13117}
13118
13119#[doc = " Declares a protocol used by a component, which was offered to it.\n\n A protocol is a service with a single instance, provided by a single FIDL\n protocol.\n"]
13120#[derive(Clone, Debug, Default)]
13121pub struct UseProtocol {
13122 pub source: Option<crate::Ref>,
13123
13124 pub source_name: Option<String>,
13125
13126 pub target_path: Option<String>,
13127
13128 pub dependency_type: Option<crate::DependencyType>,
13129
13130 pub availability: Option<crate::Availability>,
13131
13132 pub source_dictionary: Option<String>,
13133}
13134
13135impl UseProtocol {
13136 fn __max_ordinal(&self) -> usize {
13137 if self.source_dictionary.is_some() {
13138 return 6;
13139 }
13140
13141 if self.availability.is_some() {
13142 return 5;
13143 }
13144
13145 if self.dependency_type.is_some() {
13146 return 4;
13147 }
13148
13149 if self.target_path.is_some() {
13150 return 3;
13151 }
13152
13153 if self.source_name.is_some() {
13154 return 2;
13155 }
13156
13157 if self.source.is_some() {
13158 return 1;
13159 }
13160
13161 0
13162 }
13163}
13164
13165impl ::fidl_next::Encodable for UseProtocol {
13166 type Encoded = WireUseProtocol<'static>;
13167}
13168
13169unsafe impl<___E> ::fidl_next::Encode<___E> for UseProtocol
13170where
13171 ___E: ::fidl_next::Encoder + ?Sized,
13172{
13173 #[inline]
13174 fn encode(
13175 mut self,
13176 encoder: &mut ___E,
13177 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
13178 ) -> Result<(), ::fidl_next::EncodeError> {
13179 ::fidl_next::munge!(let WireUseProtocol { table } = out);
13180
13181 let max_ord = self.__max_ordinal();
13182
13183 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
13184 ::fidl_next::Wire::zero_padding(&mut out);
13185
13186 let mut preallocated =
13187 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
13188
13189 for i in 1..=max_ord {
13190 match i {
13191 6 => {
13192 if let Some(source_dictionary) = self.source_dictionary.take() {
13193 ::fidl_next::WireEnvelope::encode_value(
13194 source_dictionary,
13195 preallocated.encoder,
13196 &mut out,
13197 )?;
13198 } else {
13199 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13200 }
13201 }
13202
13203 5 => {
13204 if let Some(availability) = self.availability.take() {
13205 ::fidl_next::WireEnvelope::encode_value(
13206 availability,
13207 preallocated.encoder,
13208 &mut out,
13209 )?;
13210 } else {
13211 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13212 }
13213 }
13214
13215 4 => {
13216 if let Some(dependency_type) = self.dependency_type.take() {
13217 ::fidl_next::WireEnvelope::encode_value(
13218 dependency_type,
13219 preallocated.encoder,
13220 &mut out,
13221 )?;
13222 } else {
13223 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13224 }
13225 }
13226
13227 3 => {
13228 if let Some(target_path) = self.target_path.take() {
13229 ::fidl_next::WireEnvelope::encode_value(
13230 target_path,
13231 preallocated.encoder,
13232 &mut out,
13233 )?;
13234 } else {
13235 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13236 }
13237 }
13238
13239 2 => {
13240 if let Some(source_name) = self.source_name.take() {
13241 ::fidl_next::WireEnvelope::encode_value(
13242 source_name,
13243 preallocated.encoder,
13244 &mut out,
13245 )?;
13246 } else {
13247 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13248 }
13249 }
13250
13251 1 => {
13252 if let Some(source) = self.source.take() {
13253 ::fidl_next::WireEnvelope::encode_value(
13254 source,
13255 preallocated.encoder,
13256 &mut out,
13257 )?;
13258 } else {
13259 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13260 }
13261 }
13262
13263 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
13264 }
13265 unsafe {
13266 preallocated.write_next(out.assume_init_ref());
13267 }
13268 }
13269
13270 ::fidl_next::WireTable::encode_len(table, max_ord);
13271
13272 Ok(())
13273 }
13274}
13275
13276unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseProtocol
13277where
13278 ___E: ::fidl_next::Encoder + ?Sized,
13279{
13280 #[inline]
13281 fn encode_ref(
13282 &self,
13283 encoder: &mut ___E,
13284 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
13285 ) -> Result<(), ::fidl_next::EncodeError> {
13286 ::fidl_next::munge!(let WireUseProtocol { table } = out);
13287
13288 let max_ord = self.__max_ordinal();
13289
13290 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
13291 ::fidl_next::Wire::zero_padding(&mut out);
13292
13293 let mut preallocated =
13294 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
13295
13296 for i in 1..=max_ord {
13297 match i {
13298 6 => {
13299 if let Some(source_dictionary) = &self.source_dictionary {
13300 ::fidl_next::WireEnvelope::encode_value(
13301 source_dictionary,
13302 preallocated.encoder,
13303 &mut out,
13304 )?;
13305 } else {
13306 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13307 }
13308 }
13309
13310 5 => {
13311 if let Some(availability) = &self.availability {
13312 ::fidl_next::WireEnvelope::encode_value(
13313 availability,
13314 preallocated.encoder,
13315 &mut out,
13316 )?;
13317 } else {
13318 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13319 }
13320 }
13321
13322 4 => {
13323 if let Some(dependency_type) = &self.dependency_type {
13324 ::fidl_next::WireEnvelope::encode_value(
13325 dependency_type,
13326 preallocated.encoder,
13327 &mut out,
13328 )?;
13329 } else {
13330 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13331 }
13332 }
13333
13334 3 => {
13335 if let Some(target_path) = &self.target_path {
13336 ::fidl_next::WireEnvelope::encode_value(
13337 target_path,
13338 preallocated.encoder,
13339 &mut out,
13340 )?;
13341 } else {
13342 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13343 }
13344 }
13345
13346 2 => {
13347 if let Some(source_name) = &self.source_name {
13348 ::fidl_next::WireEnvelope::encode_value(
13349 source_name,
13350 preallocated.encoder,
13351 &mut out,
13352 )?;
13353 } else {
13354 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13355 }
13356 }
13357
13358 1 => {
13359 if let Some(source) = &self.source {
13360 ::fidl_next::WireEnvelope::encode_value(
13361 source,
13362 preallocated.encoder,
13363 &mut out,
13364 )?;
13365 } else {
13366 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13367 }
13368 }
13369
13370 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
13371 }
13372 unsafe {
13373 preallocated.write_next(out.assume_init_ref());
13374 }
13375 }
13376
13377 ::fidl_next::WireTable::encode_len(table, max_ord);
13378
13379 Ok(())
13380 }
13381}
13382
13383impl<'de> ::fidl_next::FromWire<WireUseProtocol<'de>> for UseProtocol {
13384 #[inline]
13385 fn from_wire(wire: WireUseProtocol<'de>) -> Self {
13386 let wire = ::core::mem::ManuallyDrop::new(wire);
13387
13388 let source = wire.table.get(1);
13389
13390 let source_name = wire.table.get(2);
13391
13392 let target_path = wire.table.get(3);
13393
13394 let dependency_type = wire.table.get(4);
13395
13396 let availability = wire.table.get(5);
13397
13398 let source_dictionary = wire.table.get(6);
13399
13400 Self {
13401 source: source.map(|envelope| {
13402 ::fidl_next::FromWire::from_wire(unsafe {
13403 envelope.read_unchecked::<crate::WireRef<'de>>()
13404 })
13405 }),
13406
13407 source_name: source_name.map(|envelope| {
13408 ::fidl_next::FromWire::from_wire(unsafe {
13409 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
13410 })
13411 }),
13412
13413 target_path: target_path.map(|envelope| {
13414 ::fidl_next::FromWire::from_wire(unsafe {
13415 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
13416 })
13417 }),
13418
13419 dependency_type: dependency_type.map(|envelope| {
13420 ::fidl_next::FromWire::from_wire(unsafe {
13421 envelope.read_unchecked::<crate::WireDependencyType>()
13422 })
13423 }),
13424
13425 availability: availability.map(|envelope| {
13426 ::fidl_next::FromWire::from_wire(unsafe {
13427 envelope.read_unchecked::<crate::WireAvailability>()
13428 })
13429 }),
13430
13431 source_dictionary: source_dictionary.map(|envelope| {
13432 ::fidl_next::FromWire::from_wire(unsafe {
13433 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
13434 })
13435 }),
13436 }
13437 }
13438}
13439
13440impl<'de> ::fidl_next::FromWireRef<WireUseProtocol<'de>> for UseProtocol {
13441 #[inline]
13442 fn from_wire_ref(wire: &WireUseProtocol<'de>) -> Self {
13443 Self {
13444 source: wire.table.get(1).map(|envelope| {
13445 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
13446 envelope.deref_unchecked::<crate::WireRef<'de>>()
13447 })
13448 }),
13449
13450 source_name: wire.table.get(2).map(|envelope| {
13451 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
13452 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
13453 })
13454 }),
13455
13456 target_path: wire.table.get(3).map(|envelope| {
13457 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
13458 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
13459 })
13460 }),
13461
13462 dependency_type: wire.table.get(4).map(|envelope| {
13463 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
13464 envelope.deref_unchecked::<crate::WireDependencyType>()
13465 })
13466 }),
13467
13468 availability: wire.table.get(5).map(|envelope| {
13469 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
13470 envelope.deref_unchecked::<crate::WireAvailability>()
13471 })
13472 }),
13473
13474 source_dictionary: wire.table.get(6).map(|envelope| {
13475 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
13476 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
13477 })
13478 }),
13479 }
13480 }
13481}
13482
13483#[repr(C)]
13485pub struct WireUseProtocol<'de> {
13486 table: ::fidl_next::WireTable<'de>,
13487}
13488
13489impl<'de> Drop for WireUseProtocol<'de> {
13490 fn drop(&mut self) {
13491 let _ = self
13492 .table
13493 .get(1)
13494 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
13495
13496 let _ = self
13497 .table
13498 .get(2)
13499 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
13500
13501 let _ = self
13502 .table
13503 .get(3)
13504 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
13505
13506 let _ = self
13507 .table
13508 .get(4)
13509 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDependencyType>() });
13510
13511 let _ = self
13512 .table
13513 .get(5)
13514 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
13515
13516 let _ = self
13517 .table
13518 .get(6)
13519 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
13520 }
13521}
13522
13523unsafe impl ::fidl_next::Wire for WireUseProtocol<'static> {
13524 type Decoded<'de> = WireUseProtocol<'de>;
13525
13526 #[inline]
13527 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
13528 ::fidl_next::munge!(let Self { table } = out);
13529 ::fidl_next::WireTable::zero_padding(table);
13530 }
13531}
13532
13533unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseProtocol<'static>
13534where
13535 ___D: ::fidl_next::Decoder + ?Sized,
13536{
13537 fn decode(
13538 slot: ::fidl_next::Slot<'_, Self>,
13539 decoder: &mut ___D,
13540 ) -> Result<(), ::fidl_next::DecodeError> {
13541 ::fidl_next::munge!(let Self { table } = slot);
13542
13543 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
13544 match ordinal {
13545 0 => unsafe { ::core::hint::unreachable_unchecked() },
13546
13547 1 => {
13548 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
13549 slot.as_mut(),
13550 decoder,
13551 )?;
13552
13553 Ok(())
13554 }
13555
13556 2 => {
13557 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
13558 slot.as_mut(),
13559 decoder,
13560 )?;
13561
13562 let source_name = unsafe {
13563 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
13564 };
13565
13566 if source_name.len() > 100 {
13567 return Err(::fidl_next::DecodeError::VectorTooLong {
13568 size: source_name.len() as u64,
13569 limit: 100,
13570 });
13571 }
13572
13573 Ok(())
13574 }
13575
13576 3 => {
13577 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
13578 slot.as_mut(),
13579 decoder,
13580 )?;
13581
13582 let target_path = unsafe {
13583 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
13584 };
13585
13586 if target_path.len() > 1024 {
13587 return Err(::fidl_next::DecodeError::VectorTooLong {
13588 size: target_path.len() as u64,
13589 limit: 1024,
13590 });
13591 }
13592
13593 Ok(())
13594 }
13595
13596 4 => {
13597 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
13598 slot.as_mut(),
13599 decoder,
13600 )?;
13601
13602 Ok(())
13603 }
13604
13605 5 => {
13606 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
13607 slot.as_mut(),
13608 decoder,
13609 )?;
13610
13611 Ok(())
13612 }
13613
13614 6 => {
13615 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
13616 slot.as_mut(),
13617 decoder,
13618 )?;
13619
13620 let source_dictionary = unsafe {
13621 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
13622 };
13623
13624 if source_dictionary.len() > 1024 {
13625 return Err(::fidl_next::DecodeError::VectorTooLong {
13626 size: source_dictionary.len() as u64,
13627 limit: 1024,
13628 });
13629 }
13630
13631 Ok(())
13632 }
13633
13634 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
13635 }
13636 })
13637 }
13638}
13639
13640impl<'de> WireUseProtocol<'de> {
13641 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
13642 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
13643 }
13644
13645 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
13646 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
13647 }
13648
13649 pub fn target_path(&self) -> Option<&::fidl_next::WireString<'de>> {
13650 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
13651 }
13652
13653 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
13654 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
13655 }
13656
13657 pub fn availability(&self) -> Option<&crate::WireAvailability> {
13658 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
13659 }
13660
13661 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
13662 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
13663 }
13664}
13665
13666impl<'de> ::core::fmt::Debug for WireUseProtocol<'de> {
13667 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
13668 f.debug_struct("UseProtocol")
13669 .field("source", &self.source())
13670 .field("source_name", &self.source_name())
13671 .field("target_path", &self.target_path())
13672 .field("dependency_type", &self.dependency_type())
13673 .field("availability", &self.availability())
13674 .field("source_dictionary", &self.source_dictionary())
13675 .finish()
13676 }
13677}
13678
13679#[doc = " Declares a directory used by a component, which was offered to it.\n"]
13680#[derive(Clone, Debug, Default)]
13681pub struct UseDirectory {
13682 pub source: Option<crate::Ref>,
13683
13684 pub source_name: Option<String>,
13685
13686 pub target_path: Option<String>,
13687
13688 pub rights: Option<::fidl_next_fuchsia_io::Operations>,
13689
13690 pub subdir: Option<String>,
13691
13692 pub dependency_type: Option<crate::DependencyType>,
13693
13694 pub availability: Option<crate::Availability>,
13695
13696 pub source_dictionary: Option<String>,
13697}
13698
13699impl UseDirectory {
13700 fn __max_ordinal(&self) -> usize {
13701 if self.source_dictionary.is_some() {
13702 return 8;
13703 }
13704
13705 if self.availability.is_some() {
13706 return 7;
13707 }
13708
13709 if self.dependency_type.is_some() {
13710 return 6;
13711 }
13712
13713 if self.subdir.is_some() {
13714 return 5;
13715 }
13716
13717 if self.rights.is_some() {
13718 return 4;
13719 }
13720
13721 if self.target_path.is_some() {
13722 return 3;
13723 }
13724
13725 if self.source_name.is_some() {
13726 return 2;
13727 }
13728
13729 if self.source.is_some() {
13730 return 1;
13731 }
13732
13733 0
13734 }
13735}
13736
13737impl ::fidl_next::Encodable for UseDirectory {
13738 type Encoded = WireUseDirectory<'static>;
13739}
13740
13741unsafe impl<___E> ::fidl_next::Encode<___E> for UseDirectory
13742where
13743 ___E: ::fidl_next::Encoder + ?Sized,
13744{
13745 #[inline]
13746 fn encode(
13747 mut self,
13748 encoder: &mut ___E,
13749 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
13750 ) -> Result<(), ::fidl_next::EncodeError> {
13751 ::fidl_next::munge!(let WireUseDirectory { table } = out);
13752
13753 let max_ord = self.__max_ordinal();
13754
13755 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
13756 ::fidl_next::Wire::zero_padding(&mut out);
13757
13758 let mut preallocated =
13759 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
13760
13761 for i in 1..=max_ord {
13762 match i {
13763 8 => {
13764 if let Some(source_dictionary) = self.source_dictionary.take() {
13765 ::fidl_next::WireEnvelope::encode_value(
13766 source_dictionary,
13767 preallocated.encoder,
13768 &mut out,
13769 )?;
13770 } else {
13771 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13772 }
13773 }
13774
13775 7 => {
13776 if let Some(availability) = self.availability.take() {
13777 ::fidl_next::WireEnvelope::encode_value(
13778 availability,
13779 preallocated.encoder,
13780 &mut out,
13781 )?;
13782 } else {
13783 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13784 }
13785 }
13786
13787 6 => {
13788 if let Some(dependency_type) = self.dependency_type.take() {
13789 ::fidl_next::WireEnvelope::encode_value(
13790 dependency_type,
13791 preallocated.encoder,
13792 &mut out,
13793 )?;
13794 } else {
13795 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13796 }
13797 }
13798
13799 5 => {
13800 if let Some(subdir) = self.subdir.take() {
13801 ::fidl_next::WireEnvelope::encode_value(
13802 subdir,
13803 preallocated.encoder,
13804 &mut out,
13805 )?;
13806 } else {
13807 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13808 }
13809 }
13810
13811 4 => {
13812 if let Some(rights) = self.rights.take() {
13813 ::fidl_next::WireEnvelope::encode_value(
13814 rights,
13815 preallocated.encoder,
13816 &mut out,
13817 )?;
13818 } else {
13819 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13820 }
13821 }
13822
13823 3 => {
13824 if let Some(target_path) = self.target_path.take() {
13825 ::fidl_next::WireEnvelope::encode_value(
13826 target_path,
13827 preallocated.encoder,
13828 &mut out,
13829 )?;
13830 } else {
13831 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13832 }
13833 }
13834
13835 2 => {
13836 if let Some(source_name) = self.source_name.take() {
13837 ::fidl_next::WireEnvelope::encode_value(
13838 source_name,
13839 preallocated.encoder,
13840 &mut out,
13841 )?;
13842 } else {
13843 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13844 }
13845 }
13846
13847 1 => {
13848 if let Some(source) = self.source.take() {
13849 ::fidl_next::WireEnvelope::encode_value(
13850 source,
13851 preallocated.encoder,
13852 &mut out,
13853 )?;
13854 } else {
13855 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13856 }
13857 }
13858
13859 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
13860 }
13861 unsafe {
13862 preallocated.write_next(out.assume_init_ref());
13863 }
13864 }
13865
13866 ::fidl_next::WireTable::encode_len(table, max_ord);
13867
13868 Ok(())
13869 }
13870}
13871
13872unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseDirectory
13873where
13874 ___E: ::fidl_next::Encoder + ?Sized,
13875{
13876 #[inline]
13877 fn encode_ref(
13878 &self,
13879 encoder: &mut ___E,
13880 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
13881 ) -> Result<(), ::fidl_next::EncodeError> {
13882 ::fidl_next::munge!(let WireUseDirectory { table } = out);
13883
13884 let max_ord = self.__max_ordinal();
13885
13886 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
13887 ::fidl_next::Wire::zero_padding(&mut out);
13888
13889 let mut preallocated =
13890 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
13891
13892 for i in 1..=max_ord {
13893 match i {
13894 8 => {
13895 if let Some(source_dictionary) = &self.source_dictionary {
13896 ::fidl_next::WireEnvelope::encode_value(
13897 source_dictionary,
13898 preallocated.encoder,
13899 &mut out,
13900 )?;
13901 } else {
13902 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13903 }
13904 }
13905
13906 7 => {
13907 if let Some(availability) = &self.availability {
13908 ::fidl_next::WireEnvelope::encode_value(
13909 availability,
13910 preallocated.encoder,
13911 &mut out,
13912 )?;
13913 } else {
13914 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13915 }
13916 }
13917
13918 6 => {
13919 if let Some(dependency_type) = &self.dependency_type {
13920 ::fidl_next::WireEnvelope::encode_value(
13921 dependency_type,
13922 preallocated.encoder,
13923 &mut out,
13924 )?;
13925 } else {
13926 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13927 }
13928 }
13929
13930 5 => {
13931 if let Some(subdir) = &self.subdir {
13932 ::fidl_next::WireEnvelope::encode_value(
13933 subdir,
13934 preallocated.encoder,
13935 &mut out,
13936 )?;
13937 } else {
13938 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13939 }
13940 }
13941
13942 4 => {
13943 if let Some(rights) = &self.rights {
13944 ::fidl_next::WireEnvelope::encode_value(
13945 rights,
13946 preallocated.encoder,
13947 &mut out,
13948 )?;
13949 } else {
13950 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13951 }
13952 }
13953
13954 3 => {
13955 if let Some(target_path) = &self.target_path {
13956 ::fidl_next::WireEnvelope::encode_value(
13957 target_path,
13958 preallocated.encoder,
13959 &mut out,
13960 )?;
13961 } else {
13962 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13963 }
13964 }
13965
13966 2 => {
13967 if let Some(source_name) = &self.source_name {
13968 ::fidl_next::WireEnvelope::encode_value(
13969 source_name,
13970 preallocated.encoder,
13971 &mut out,
13972 )?;
13973 } else {
13974 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13975 }
13976 }
13977
13978 1 => {
13979 if let Some(source) = &self.source {
13980 ::fidl_next::WireEnvelope::encode_value(
13981 source,
13982 preallocated.encoder,
13983 &mut out,
13984 )?;
13985 } else {
13986 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13987 }
13988 }
13989
13990 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
13991 }
13992 unsafe {
13993 preallocated.write_next(out.assume_init_ref());
13994 }
13995 }
13996
13997 ::fidl_next::WireTable::encode_len(table, max_ord);
13998
13999 Ok(())
14000 }
14001}
14002
14003impl<'de> ::fidl_next::FromWire<WireUseDirectory<'de>> for UseDirectory {
14004 #[inline]
14005 fn from_wire(wire: WireUseDirectory<'de>) -> Self {
14006 let wire = ::core::mem::ManuallyDrop::new(wire);
14007
14008 let source = wire.table.get(1);
14009
14010 let source_name = wire.table.get(2);
14011
14012 let target_path = wire.table.get(3);
14013
14014 let rights = wire.table.get(4);
14015
14016 let subdir = wire.table.get(5);
14017
14018 let dependency_type = wire.table.get(6);
14019
14020 let availability = wire.table.get(7);
14021
14022 let source_dictionary = wire.table.get(8);
14023
14024 Self {
14025 source: source.map(|envelope| {
14026 ::fidl_next::FromWire::from_wire(unsafe {
14027 envelope.read_unchecked::<crate::WireRef<'de>>()
14028 })
14029 }),
14030
14031 source_name: source_name.map(|envelope| {
14032 ::fidl_next::FromWire::from_wire(unsafe {
14033 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
14034 })
14035 }),
14036
14037 target_path: target_path.map(|envelope| {
14038 ::fidl_next::FromWire::from_wire(unsafe {
14039 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
14040 })
14041 }),
14042
14043 rights: rights.map(|envelope| {
14044 ::fidl_next::FromWire::from_wire(unsafe {
14045 envelope.read_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
14046 })
14047 }),
14048
14049 subdir: subdir.map(|envelope| {
14050 ::fidl_next::FromWire::from_wire(unsafe {
14051 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
14052 })
14053 }),
14054
14055 dependency_type: dependency_type.map(|envelope| {
14056 ::fidl_next::FromWire::from_wire(unsafe {
14057 envelope.read_unchecked::<crate::WireDependencyType>()
14058 })
14059 }),
14060
14061 availability: availability.map(|envelope| {
14062 ::fidl_next::FromWire::from_wire(unsafe {
14063 envelope.read_unchecked::<crate::WireAvailability>()
14064 })
14065 }),
14066
14067 source_dictionary: source_dictionary.map(|envelope| {
14068 ::fidl_next::FromWire::from_wire(unsafe {
14069 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
14070 })
14071 }),
14072 }
14073 }
14074}
14075
14076impl<'de> ::fidl_next::FromWireRef<WireUseDirectory<'de>> for UseDirectory {
14077 #[inline]
14078 fn from_wire_ref(wire: &WireUseDirectory<'de>) -> Self {
14079 Self {
14080 source: wire.table.get(1).map(|envelope| {
14081 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14082 envelope.deref_unchecked::<crate::WireRef<'de>>()
14083 })
14084 }),
14085
14086 source_name: wire.table.get(2).map(|envelope| {
14087 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14088 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
14089 })
14090 }),
14091
14092 target_path: wire.table.get(3).map(|envelope| {
14093 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14094 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
14095 })
14096 }),
14097
14098 rights: wire.table.get(4).map(|envelope| {
14099 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14100 envelope.deref_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
14101 })
14102 }),
14103
14104 subdir: wire.table.get(5).map(|envelope| {
14105 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14106 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
14107 })
14108 }),
14109
14110 dependency_type: wire.table.get(6).map(|envelope| {
14111 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14112 envelope.deref_unchecked::<crate::WireDependencyType>()
14113 })
14114 }),
14115
14116 availability: wire.table.get(7).map(|envelope| {
14117 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14118 envelope.deref_unchecked::<crate::WireAvailability>()
14119 })
14120 }),
14121
14122 source_dictionary: wire.table.get(8).map(|envelope| {
14123 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14124 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
14125 })
14126 }),
14127 }
14128 }
14129}
14130
14131#[repr(C)]
14133pub struct WireUseDirectory<'de> {
14134 table: ::fidl_next::WireTable<'de>,
14135}
14136
14137impl<'de> Drop for WireUseDirectory<'de> {
14138 fn drop(&mut self) {
14139 let _ = self
14140 .table
14141 .get(1)
14142 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
14143
14144 let _ = self
14145 .table
14146 .get(2)
14147 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
14148
14149 let _ = self
14150 .table
14151 .get(3)
14152 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
14153
14154 let _ = self.table.get(4).map(|envelope| unsafe {
14155 envelope.read_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
14156 });
14157
14158 let _ = self
14159 .table
14160 .get(5)
14161 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
14162
14163 let _ = self
14164 .table
14165 .get(6)
14166 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDependencyType>() });
14167
14168 let _ = self
14169 .table
14170 .get(7)
14171 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
14172
14173 let _ = self
14174 .table
14175 .get(8)
14176 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
14177 }
14178}
14179
14180unsafe impl ::fidl_next::Wire for WireUseDirectory<'static> {
14181 type Decoded<'de> = WireUseDirectory<'de>;
14182
14183 #[inline]
14184 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
14185 ::fidl_next::munge!(let Self { table } = out);
14186 ::fidl_next::WireTable::zero_padding(table);
14187 }
14188}
14189
14190unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseDirectory<'static>
14191where
14192 ___D: ::fidl_next::Decoder + ?Sized,
14193{
14194 fn decode(
14195 slot: ::fidl_next::Slot<'_, Self>,
14196 decoder: &mut ___D,
14197 ) -> Result<(), ::fidl_next::DecodeError> {
14198 ::fidl_next::munge!(let Self { table } = slot);
14199
14200 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
14201 match ordinal {
14202 0 => unsafe { ::core::hint::unreachable_unchecked() },
14203
14204 1 => {
14205 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
14206 slot.as_mut(),
14207 decoder,
14208 )?;
14209
14210 Ok(())
14211 }
14212
14213 2 => {
14214 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
14215 slot.as_mut(),
14216 decoder,
14217 )?;
14218
14219 let source_name = unsafe {
14220 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
14221 };
14222
14223 if source_name.len() > 100 {
14224 return Err(::fidl_next::DecodeError::VectorTooLong {
14225 size: source_name.len() as u64,
14226 limit: 100,
14227 });
14228 }
14229
14230 Ok(())
14231 }
14232
14233 3 => {
14234 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
14235 slot.as_mut(),
14236 decoder,
14237 )?;
14238
14239 let target_path = unsafe {
14240 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
14241 };
14242
14243 if target_path.len() > 1024 {
14244 return Err(::fidl_next::DecodeError::VectorTooLong {
14245 size: target_path.len() as u64,
14246 limit: 1024,
14247 });
14248 }
14249
14250 Ok(())
14251 }
14252
14253 4 => {
14254 ::fidl_next::WireEnvelope::decode_as::<
14255 ___D,
14256 ::fidl_next_fuchsia_io::WireOperations,
14257 >(slot.as_mut(), decoder)?;
14258
14259 Ok(())
14260 }
14261
14262 5 => {
14263 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
14264 slot.as_mut(),
14265 decoder,
14266 )?;
14267
14268 let subdir = unsafe {
14269 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
14270 };
14271
14272 if subdir.len() > 1024 {
14273 return Err(::fidl_next::DecodeError::VectorTooLong {
14274 size: subdir.len() as u64,
14275 limit: 1024,
14276 });
14277 }
14278
14279 Ok(())
14280 }
14281
14282 6 => {
14283 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
14284 slot.as_mut(),
14285 decoder,
14286 )?;
14287
14288 Ok(())
14289 }
14290
14291 7 => {
14292 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
14293 slot.as_mut(),
14294 decoder,
14295 )?;
14296
14297 Ok(())
14298 }
14299
14300 8 => {
14301 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
14302 slot.as_mut(),
14303 decoder,
14304 )?;
14305
14306 let source_dictionary = unsafe {
14307 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
14308 };
14309
14310 if source_dictionary.len() > 1024 {
14311 return Err(::fidl_next::DecodeError::VectorTooLong {
14312 size: source_dictionary.len() as u64,
14313 limit: 1024,
14314 });
14315 }
14316
14317 Ok(())
14318 }
14319
14320 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
14321 }
14322 })
14323 }
14324}
14325
14326impl<'de> WireUseDirectory<'de> {
14327 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
14328 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
14329 }
14330
14331 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
14332 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
14333 }
14334
14335 pub fn target_path(&self) -> Option<&::fidl_next::WireString<'de>> {
14336 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
14337 }
14338
14339 pub fn rights(&self) -> Option<&::fidl_next_fuchsia_io::WireOperations> {
14340 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
14341 }
14342
14343 pub fn subdir(&self) -> Option<&::fidl_next::WireString<'de>> {
14344 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
14345 }
14346
14347 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
14348 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
14349 }
14350
14351 pub fn availability(&self) -> Option<&crate::WireAvailability> {
14352 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
14353 }
14354
14355 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
14356 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
14357 }
14358}
14359
14360impl<'de> ::core::fmt::Debug for WireUseDirectory<'de> {
14361 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
14362 f.debug_struct("UseDirectory")
14363 .field("source", &self.source())
14364 .field("source_name", &self.source_name())
14365 .field("target_path", &self.target_path())
14366 .field("rights", &self.rights())
14367 .field("subdir", &self.subdir())
14368 .field("dependency_type", &self.dependency_type())
14369 .field("availability", &self.availability())
14370 .field("source_dictionary", &self.source_dictionary())
14371 .finish()
14372 }
14373}
14374
14375#[doc = " Declares an EventStream used by a component.\n"]
14376#[derive(Clone, Debug, Default)]
14377pub struct UseEventStream {
14378 pub source_name: Option<String>,
14379
14380 pub source: Option<crate::Ref>,
14381
14382 pub scope: Option<Vec<crate::Ref>>,
14383
14384 pub target_path: Option<String>,
14385
14386 pub availability: Option<crate::Availability>,
14387
14388 pub filter: Option<::fidl_next_fuchsia_data::Dictionary>,
14389}
14390
14391impl UseEventStream {
14392 fn __max_ordinal(&self) -> usize {
14393 if self.filter.is_some() {
14394 return 6;
14395 }
14396
14397 if self.availability.is_some() {
14398 return 5;
14399 }
14400
14401 if self.target_path.is_some() {
14402 return 4;
14403 }
14404
14405 if self.scope.is_some() {
14406 return 3;
14407 }
14408
14409 if self.source.is_some() {
14410 return 2;
14411 }
14412
14413 if self.source_name.is_some() {
14414 return 1;
14415 }
14416
14417 0
14418 }
14419}
14420
14421impl ::fidl_next::Encodable for UseEventStream {
14422 type Encoded = WireUseEventStream<'static>;
14423}
14424
14425unsafe impl<___E> ::fidl_next::Encode<___E> for UseEventStream
14426where
14427 ___E: ::fidl_next::Encoder + ?Sized,
14428{
14429 #[inline]
14430 fn encode(
14431 mut self,
14432 encoder: &mut ___E,
14433 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
14434 ) -> Result<(), ::fidl_next::EncodeError> {
14435 ::fidl_next::munge!(let WireUseEventStream { table } = out);
14436
14437 let max_ord = self.__max_ordinal();
14438
14439 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
14440 ::fidl_next::Wire::zero_padding(&mut out);
14441
14442 let mut preallocated =
14443 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
14444
14445 for i in 1..=max_ord {
14446 match i {
14447 6 => {
14448 if let Some(filter) = self.filter.take() {
14449 ::fidl_next::WireEnvelope::encode_value(
14450 filter,
14451 preallocated.encoder,
14452 &mut out,
14453 )?;
14454 } else {
14455 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14456 }
14457 }
14458
14459 5 => {
14460 if let Some(availability) = self.availability.take() {
14461 ::fidl_next::WireEnvelope::encode_value(
14462 availability,
14463 preallocated.encoder,
14464 &mut out,
14465 )?;
14466 } else {
14467 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14468 }
14469 }
14470
14471 4 => {
14472 if let Some(target_path) = self.target_path.take() {
14473 ::fidl_next::WireEnvelope::encode_value(
14474 target_path,
14475 preallocated.encoder,
14476 &mut out,
14477 )?;
14478 } else {
14479 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14480 }
14481 }
14482
14483 3 => {
14484 if let Some(scope) = self.scope.take() {
14485 ::fidl_next::WireEnvelope::encode_value(
14486 scope,
14487 preallocated.encoder,
14488 &mut out,
14489 )?;
14490 } else {
14491 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14492 }
14493 }
14494
14495 2 => {
14496 if let Some(source) = self.source.take() {
14497 ::fidl_next::WireEnvelope::encode_value(
14498 source,
14499 preallocated.encoder,
14500 &mut out,
14501 )?;
14502 } else {
14503 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14504 }
14505 }
14506
14507 1 => {
14508 if let Some(source_name) = self.source_name.take() {
14509 ::fidl_next::WireEnvelope::encode_value(
14510 source_name,
14511 preallocated.encoder,
14512 &mut out,
14513 )?;
14514 } else {
14515 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14516 }
14517 }
14518
14519 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
14520 }
14521 unsafe {
14522 preallocated.write_next(out.assume_init_ref());
14523 }
14524 }
14525
14526 ::fidl_next::WireTable::encode_len(table, max_ord);
14527
14528 Ok(())
14529 }
14530}
14531
14532unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseEventStream
14533where
14534 ___E: ::fidl_next::Encoder + ?Sized,
14535{
14536 #[inline]
14537 fn encode_ref(
14538 &self,
14539 encoder: &mut ___E,
14540 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
14541 ) -> Result<(), ::fidl_next::EncodeError> {
14542 ::fidl_next::munge!(let WireUseEventStream { table } = out);
14543
14544 let max_ord = self.__max_ordinal();
14545
14546 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
14547 ::fidl_next::Wire::zero_padding(&mut out);
14548
14549 let mut preallocated =
14550 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
14551
14552 for i in 1..=max_ord {
14553 match i {
14554 6 => {
14555 if let Some(filter) = &self.filter {
14556 ::fidl_next::WireEnvelope::encode_value(
14557 filter,
14558 preallocated.encoder,
14559 &mut out,
14560 )?;
14561 } else {
14562 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14563 }
14564 }
14565
14566 5 => {
14567 if let Some(availability) = &self.availability {
14568 ::fidl_next::WireEnvelope::encode_value(
14569 availability,
14570 preallocated.encoder,
14571 &mut out,
14572 )?;
14573 } else {
14574 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14575 }
14576 }
14577
14578 4 => {
14579 if let Some(target_path) = &self.target_path {
14580 ::fidl_next::WireEnvelope::encode_value(
14581 target_path,
14582 preallocated.encoder,
14583 &mut out,
14584 )?;
14585 } else {
14586 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14587 }
14588 }
14589
14590 3 => {
14591 if let Some(scope) = &self.scope {
14592 ::fidl_next::WireEnvelope::encode_value(
14593 scope,
14594 preallocated.encoder,
14595 &mut out,
14596 )?;
14597 } else {
14598 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14599 }
14600 }
14601
14602 2 => {
14603 if let Some(source) = &self.source {
14604 ::fidl_next::WireEnvelope::encode_value(
14605 source,
14606 preallocated.encoder,
14607 &mut out,
14608 )?;
14609 } else {
14610 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14611 }
14612 }
14613
14614 1 => {
14615 if let Some(source_name) = &self.source_name {
14616 ::fidl_next::WireEnvelope::encode_value(
14617 source_name,
14618 preallocated.encoder,
14619 &mut out,
14620 )?;
14621 } else {
14622 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14623 }
14624 }
14625
14626 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
14627 }
14628 unsafe {
14629 preallocated.write_next(out.assume_init_ref());
14630 }
14631 }
14632
14633 ::fidl_next::WireTable::encode_len(table, max_ord);
14634
14635 Ok(())
14636 }
14637}
14638
14639impl<'de> ::fidl_next::FromWire<WireUseEventStream<'de>> for UseEventStream {
14640 #[inline]
14641 fn from_wire(wire: WireUseEventStream<'de>) -> Self {
14642 let wire = ::core::mem::ManuallyDrop::new(wire);
14643
14644 let source_name = wire.table.get(1);
14645
14646 let source = wire.table.get(2);
14647
14648 let scope = wire.table.get(3);
14649
14650 let target_path = wire.table.get(4);
14651
14652 let availability = wire.table.get(5);
14653
14654 let filter = wire.table.get(6);
14655
14656 Self {
14657 source_name: source_name.map(|envelope| {
14658 ::fidl_next::FromWire::from_wire(unsafe {
14659 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
14660 })
14661 }),
14662
14663 source: source.map(|envelope| {
14664 ::fidl_next::FromWire::from_wire(unsafe {
14665 envelope.read_unchecked::<crate::WireRef<'de>>()
14666 })
14667 }),
14668
14669 scope: scope.map(|envelope| {
14670 ::fidl_next::FromWire::from_wire(unsafe {
14671 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireRef<'de>>>()
14672 })
14673 }),
14674
14675 target_path: target_path.map(|envelope| {
14676 ::fidl_next::FromWire::from_wire(unsafe {
14677 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
14678 })
14679 }),
14680
14681 availability: availability.map(|envelope| {
14682 ::fidl_next::FromWire::from_wire(unsafe {
14683 envelope.read_unchecked::<crate::WireAvailability>()
14684 })
14685 }),
14686
14687 filter: filter.map(|envelope| {
14688 ::fidl_next::FromWire::from_wire(unsafe {
14689 envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
14690 })
14691 }),
14692 }
14693 }
14694}
14695
14696impl<'de> ::fidl_next::FromWireRef<WireUseEventStream<'de>> for UseEventStream {
14697 #[inline]
14698 fn from_wire_ref(wire: &WireUseEventStream<'de>) -> Self {
14699 Self {
14700 source_name: wire.table.get(1).map(|envelope| {
14701 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14702 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
14703 })
14704 }),
14705
14706 source: wire.table.get(2).map(|envelope| {
14707 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14708 envelope.deref_unchecked::<crate::WireRef<'de>>()
14709 })
14710 }),
14711
14712 scope: wire.table.get(3).map(|envelope| {
14713 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14714 envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireRef<'de>>>()
14715 })
14716 }),
14717
14718 target_path: wire.table.get(4).map(|envelope| {
14719 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14720 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
14721 })
14722 }),
14723
14724 availability: wire.table.get(5).map(|envelope| {
14725 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14726 envelope.deref_unchecked::<crate::WireAvailability>()
14727 })
14728 }),
14729
14730 filter: wire.table.get(6).map(|envelope| {
14731 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
14732 envelope.deref_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
14733 })
14734 }),
14735 }
14736 }
14737}
14738
14739#[repr(C)]
14741pub struct WireUseEventStream<'de> {
14742 table: ::fidl_next::WireTable<'de>,
14743}
14744
14745impl<'de> Drop for WireUseEventStream<'de> {
14746 fn drop(&mut self) {
14747 let _ = self
14748 .table
14749 .get(1)
14750 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
14751
14752 let _ = self
14753 .table
14754 .get(2)
14755 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
14756
14757 let _ = self.table.get(3).map(|envelope| unsafe {
14758 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireRef<'de>>>()
14759 });
14760
14761 let _ = self
14762 .table
14763 .get(4)
14764 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
14765
14766 let _ = self
14767 .table
14768 .get(5)
14769 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
14770
14771 let _ = self.table.get(6).map(|envelope| unsafe {
14772 envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
14773 });
14774 }
14775}
14776
14777unsafe impl ::fidl_next::Wire for WireUseEventStream<'static> {
14778 type Decoded<'de> = WireUseEventStream<'de>;
14779
14780 #[inline]
14781 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
14782 ::fidl_next::munge!(let Self { table } = out);
14783 ::fidl_next::WireTable::zero_padding(table);
14784 }
14785}
14786
14787unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseEventStream<'static>
14788where
14789 ___D: ::fidl_next::Decoder + ?Sized,
14790{
14791 fn decode(
14792 slot: ::fidl_next::Slot<'_, Self>,
14793 decoder: &mut ___D,
14794 ) -> Result<(), ::fidl_next::DecodeError> {
14795 ::fidl_next::munge!(let Self { table } = slot);
14796
14797 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
14798 match ordinal {
14799 0 => unsafe { ::core::hint::unreachable_unchecked() },
14800
14801 1 => {
14802 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
14803 slot.as_mut(),
14804 decoder,
14805 )?;
14806
14807 let source_name = unsafe {
14808 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
14809 };
14810
14811 if source_name.len() > 100 {
14812 return Err(::fidl_next::DecodeError::VectorTooLong {
14813 size: source_name.len() as u64,
14814 limit: 100,
14815 });
14816 }
14817
14818 Ok(())
14819 }
14820
14821 2 => {
14822 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
14823 slot.as_mut(),
14824 decoder,
14825 )?;
14826
14827 Ok(())
14828 }
14829
14830 3 => {
14831 ::fidl_next::WireEnvelope::decode_as::<
14832 ___D,
14833 ::fidl_next::WireVector<'static, crate::WireRef<'static>>,
14834 >(slot.as_mut(), decoder)?;
14835
14836 Ok(())
14837 }
14838
14839 4 => {
14840 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
14841 slot.as_mut(),
14842 decoder,
14843 )?;
14844
14845 let target_path = unsafe {
14846 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
14847 };
14848
14849 if target_path.len() > 100 {
14850 return Err(::fidl_next::DecodeError::VectorTooLong {
14851 size: target_path.len() as u64,
14852 limit: 100,
14853 });
14854 }
14855
14856 Ok(())
14857 }
14858
14859 5 => {
14860 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
14861 slot.as_mut(),
14862 decoder,
14863 )?;
14864
14865 Ok(())
14866 }
14867
14868 6 => {
14869 ::fidl_next::WireEnvelope::decode_as::<
14870 ___D,
14871 ::fidl_next_fuchsia_data::WireDictionary<'static>,
14872 >(slot.as_mut(), decoder)?;
14873
14874 Ok(())
14875 }
14876
14877 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
14878 }
14879 })
14880 }
14881}
14882
14883impl<'de> WireUseEventStream<'de> {
14884 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
14885 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
14886 }
14887
14888 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
14889 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
14890 }
14891
14892 pub fn scope(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireRef<'de>>> {
14893 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
14894 }
14895
14896 pub fn target_path(&self) -> Option<&::fidl_next::WireString<'de>> {
14897 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
14898 }
14899
14900 pub fn availability(&self) -> Option<&crate::WireAvailability> {
14901 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
14902 }
14903
14904 pub fn filter(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary<'de>> {
14905 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
14906 }
14907}
14908
14909impl<'de> ::core::fmt::Debug for WireUseEventStream<'de> {
14910 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
14911 f.debug_struct("UseEventStream")
14912 .field("source_name", &self.source_name())
14913 .field("source", &self.source())
14914 .field("scope", &self.scope())
14915 .field("target_path", &self.target_path())
14916 .field("availability", &self.availability())
14917 .field("filter", &self.filter())
14918 .finish()
14919 }
14920}
14921
14922#[doc = " Declares runner used by a component.\n"]
14923#[derive(Clone, Debug, Default)]
14924pub struct UseRunner {
14925 pub source: Option<crate::Ref>,
14926
14927 pub source_name: Option<String>,
14928
14929 pub source_dictionary: Option<String>,
14930}
14931
14932impl UseRunner {
14933 fn __max_ordinal(&self) -> usize {
14934 if self.source_dictionary.is_some() {
14935 return 3;
14936 }
14937
14938 if self.source_name.is_some() {
14939 return 2;
14940 }
14941
14942 if self.source.is_some() {
14943 return 1;
14944 }
14945
14946 0
14947 }
14948}
14949
14950impl ::fidl_next::Encodable for UseRunner {
14951 type Encoded = WireUseRunner<'static>;
14952}
14953
14954unsafe impl<___E> ::fidl_next::Encode<___E> for UseRunner
14955where
14956 ___E: ::fidl_next::Encoder + ?Sized,
14957{
14958 #[inline]
14959 fn encode(
14960 mut self,
14961 encoder: &mut ___E,
14962 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
14963 ) -> Result<(), ::fidl_next::EncodeError> {
14964 ::fidl_next::munge!(let WireUseRunner { table } = out);
14965
14966 let max_ord = self.__max_ordinal();
14967
14968 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
14969 ::fidl_next::Wire::zero_padding(&mut out);
14970
14971 let mut preallocated =
14972 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
14973
14974 for i in 1..=max_ord {
14975 match i {
14976 3 => {
14977 if let Some(source_dictionary) = self.source_dictionary.take() {
14978 ::fidl_next::WireEnvelope::encode_value(
14979 source_dictionary,
14980 preallocated.encoder,
14981 &mut out,
14982 )?;
14983 } else {
14984 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14985 }
14986 }
14987
14988 2 => {
14989 if let Some(source_name) = self.source_name.take() {
14990 ::fidl_next::WireEnvelope::encode_value(
14991 source_name,
14992 preallocated.encoder,
14993 &mut out,
14994 )?;
14995 } else {
14996 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14997 }
14998 }
14999
15000 1 => {
15001 if let Some(source) = self.source.take() {
15002 ::fidl_next::WireEnvelope::encode_value(
15003 source,
15004 preallocated.encoder,
15005 &mut out,
15006 )?;
15007 } else {
15008 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15009 }
15010 }
15011
15012 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
15013 }
15014 unsafe {
15015 preallocated.write_next(out.assume_init_ref());
15016 }
15017 }
15018
15019 ::fidl_next::WireTable::encode_len(table, max_ord);
15020
15021 Ok(())
15022 }
15023}
15024
15025unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseRunner
15026where
15027 ___E: ::fidl_next::Encoder + ?Sized,
15028{
15029 #[inline]
15030 fn encode_ref(
15031 &self,
15032 encoder: &mut ___E,
15033 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15034 ) -> Result<(), ::fidl_next::EncodeError> {
15035 ::fidl_next::munge!(let WireUseRunner { table } = out);
15036
15037 let max_ord = self.__max_ordinal();
15038
15039 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
15040 ::fidl_next::Wire::zero_padding(&mut out);
15041
15042 let mut preallocated =
15043 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
15044
15045 for i in 1..=max_ord {
15046 match i {
15047 3 => {
15048 if let Some(source_dictionary) = &self.source_dictionary {
15049 ::fidl_next::WireEnvelope::encode_value(
15050 source_dictionary,
15051 preallocated.encoder,
15052 &mut out,
15053 )?;
15054 } else {
15055 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15056 }
15057 }
15058
15059 2 => {
15060 if let Some(source_name) = &self.source_name {
15061 ::fidl_next::WireEnvelope::encode_value(
15062 source_name,
15063 preallocated.encoder,
15064 &mut out,
15065 )?;
15066 } else {
15067 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15068 }
15069 }
15070
15071 1 => {
15072 if let Some(source) = &self.source {
15073 ::fidl_next::WireEnvelope::encode_value(
15074 source,
15075 preallocated.encoder,
15076 &mut out,
15077 )?;
15078 } else {
15079 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15080 }
15081 }
15082
15083 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
15084 }
15085 unsafe {
15086 preallocated.write_next(out.assume_init_ref());
15087 }
15088 }
15089
15090 ::fidl_next::WireTable::encode_len(table, max_ord);
15091
15092 Ok(())
15093 }
15094}
15095
15096impl<'de> ::fidl_next::FromWire<WireUseRunner<'de>> for UseRunner {
15097 #[inline]
15098 fn from_wire(wire: WireUseRunner<'de>) -> Self {
15099 let wire = ::core::mem::ManuallyDrop::new(wire);
15100
15101 let source = wire.table.get(1);
15102
15103 let source_name = wire.table.get(2);
15104
15105 let source_dictionary = wire.table.get(3);
15106
15107 Self {
15108 source: source.map(|envelope| {
15109 ::fidl_next::FromWire::from_wire(unsafe {
15110 envelope.read_unchecked::<crate::WireRef<'de>>()
15111 })
15112 }),
15113
15114 source_name: source_name.map(|envelope| {
15115 ::fidl_next::FromWire::from_wire(unsafe {
15116 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
15117 })
15118 }),
15119
15120 source_dictionary: source_dictionary.map(|envelope| {
15121 ::fidl_next::FromWire::from_wire(unsafe {
15122 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
15123 })
15124 }),
15125 }
15126 }
15127}
15128
15129impl<'de> ::fidl_next::FromWireRef<WireUseRunner<'de>> for UseRunner {
15130 #[inline]
15131 fn from_wire_ref(wire: &WireUseRunner<'de>) -> Self {
15132 Self {
15133 source: wire.table.get(1).map(|envelope| {
15134 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15135 envelope.deref_unchecked::<crate::WireRef<'de>>()
15136 })
15137 }),
15138
15139 source_name: wire.table.get(2).map(|envelope| {
15140 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15141 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
15142 })
15143 }),
15144
15145 source_dictionary: wire.table.get(3).map(|envelope| {
15146 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15147 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
15148 })
15149 }),
15150 }
15151 }
15152}
15153
15154#[repr(C)]
15156pub struct WireUseRunner<'de> {
15157 table: ::fidl_next::WireTable<'de>,
15158}
15159
15160impl<'de> Drop for WireUseRunner<'de> {
15161 fn drop(&mut self) {
15162 let _ = self
15163 .table
15164 .get(1)
15165 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
15166
15167 let _ = self
15168 .table
15169 .get(2)
15170 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
15171
15172 let _ = self
15173 .table
15174 .get(3)
15175 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
15176 }
15177}
15178
15179unsafe impl ::fidl_next::Wire for WireUseRunner<'static> {
15180 type Decoded<'de> = WireUseRunner<'de>;
15181
15182 #[inline]
15183 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
15184 ::fidl_next::munge!(let Self { table } = out);
15185 ::fidl_next::WireTable::zero_padding(table);
15186 }
15187}
15188
15189unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseRunner<'static>
15190where
15191 ___D: ::fidl_next::Decoder + ?Sized,
15192{
15193 fn decode(
15194 slot: ::fidl_next::Slot<'_, Self>,
15195 decoder: &mut ___D,
15196 ) -> Result<(), ::fidl_next::DecodeError> {
15197 ::fidl_next::munge!(let Self { table } = slot);
15198
15199 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
15200 match ordinal {
15201 0 => unsafe { ::core::hint::unreachable_unchecked() },
15202
15203 1 => {
15204 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
15205 slot.as_mut(),
15206 decoder,
15207 )?;
15208
15209 Ok(())
15210 }
15211
15212 2 => {
15213 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
15214 slot.as_mut(),
15215 decoder,
15216 )?;
15217
15218 let source_name = unsafe {
15219 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
15220 };
15221
15222 if source_name.len() > 100 {
15223 return Err(::fidl_next::DecodeError::VectorTooLong {
15224 size: source_name.len() as u64,
15225 limit: 100,
15226 });
15227 }
15228
15229 Ok(())
15230 }
15231
15232 3 => {
15233 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
15234 slot.as_mut(),
15235 decoder,
15236 )?;
15237
15238 let source_dictionary = unsafe {
15239 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
15240 };
15241
15242 if source_dictionary.len() > 1024 {
15243 return Err(::fidl_next::DecodeError::VectorTooLong {
15244 size: source_dictionary.len() as u64,
15245 limit: 1024,
15246 });
15247 }
15248
15249 Ok(())
15250 }
15251
15252 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
15253 }
15254 })
15255 }
15256}
15257
15258impl<'de> WireUseRunner<'de> {
15259 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
15260 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
15261 }
15262
15263 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
15264 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
15265 }
15266
15267 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
15268 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
15269 }
15270}
15271
15272impl<'de> ::core::fmt::Debug for WireUseRunner<'de> {
15273 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
15274 f.debug_struct("UseRunner")
15275 .field("source", &self.source())
15276 .field("source_name", &self.source_name())
15277 .field("source_dictionary", &self.source_dictionary())
15278 .finish()
15279 }
15280}
15281
15282#[derive(Clone, Debug, Default)]
15283pub struct UseConfiguration {
15284 pub source: Option<crate::Ref>,
15285
15286 pub source_name: Option<String>,
15287
15288 pub target_name: Option<String>,
15289
15290 pub availability: Option<crate::Availability>,
15291
15292 pub type_: Option<crate::ConfigType>,
15293
15294 pub default: Option<crate::ConfigValue>,
15295
15296 pub source_dictionary: Option<String>,
15297}
15298
15299impl UseConfiguration {
15300 fn __max_ordinal(&self) -> usize {
15301 if self.source_dictionary.is_some() {
15302 return 7;
15303 }
15304
15305 if self.default.is_some() {
15306 return 6;
15307 }
15308
15309 if self.type_.is_some() {
15310 return 5;
15311 }
15312
15313 if self.availability.is_some() {
15314 return 4;
15315 }
15316
15317 if self.target_name.is_some() {
15318 return 3;
15319 }
15320
15321 if self.source_name.is_some() {
15322 return 2;
15323 }
15324
15325 if self.source.is_some() {
15326 return 1;
15327 }
15328
15329 0
15330 }
15331}
15332
15333impl ::fidl_next::Encodable for UseConfiguration {
15334 type Encoded = WireUseConfiguration<'static>;
15335}
15336
15337unsafe impl<___E> ::fidl_next::Encode<___E> for UseConfiguration
15338where
15339 ___E: ::fidl_next::Encoder + ?Sized,
15340{
15341 #[inline]
15342 fn encode(
15343 mut self,
15344 encoder: &mut ___E,
15345 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15346 ) -> Result<(), ::fidl_next::EncodeError> {
15347 ::fidl_next::munge!(let WireUseConfiguration { table } = out);
15348
15349 let max_ord = self.__max_ordinal();
15350
15351 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
15352 ::fidl_next::Wire::zero_padding(&mut out);
15353
15354 let mut preallocated =
15355 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
15356
15357 for i in 1..=max_ord {
15358 match i {
15359 7 => {
15360 if let Some(source_dictionary) = self.source_dictionary.take() {
15361 ::fidl_next::WireEnvelope::encode_value(
15362 source_dictionary,
15363 preallocated.encoder,
15364 &mut out,
15365 )?;
15366 } else {
15367 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15368 }
15369 }
15370
15371 6 => {
15372 if let Some(default) = self.default.take() {
15373 ::fidl_next::WireEnvelope::encode_value(
15374 default,
15375 preallocated.encoder,
15376 &mut out,
15377 )?;
15378 } else {
15379 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15380 }
15381 }
15382
15383 5 => {
15384 if let Some(type_) = self.type_.take() {
15385 ::fidl_next::WireEnvelope::encode_value(
15386 type_,
15387 preallocated.encoder,
15388 &mut out,
15389 )?;
15390 } else {
15391 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15392 }
15393 }
15394
15395 4 => {
15396 if let Some(availability) = self.availability.take() {
15397 ::fidl_next::WireEnvelope::encode_value(
15398 availability,
15399 preallocated.encoder,
15400 &mut out,
15401 )?;
15402 } else {
15403 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15404 }
15405 }
15406
15407 3 => {
15408 if let Some(target_name) = self.target_name.take() {
15409 ::fidl_next::WireEnvelope::encode_value(
15410 target_name,
15411 preallocated.encoder,
15412 &mut out,
15413 )?;
15414 } else {
15415 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15416 }
15417 }
15418
15419 2 => {
15420 if let Some(source_name) = self.source_name.take() {
15421 ::fidl_next::WireEnvelope::encode_value(
15422 source_name,
15423 preallocated.encoder,
15424 &mut out,
15425 )?;
15426 } else {
15427 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15428 }
15429 }
15430
15431 1 => {
15432 if let Some(source) = self.source.take() {
15433 ::fidl_next::WireEnvelope::encode_value(
15434 source,
15435 preallocated.encoder,
15436 &mut out,
15437 )?;
15438 } else {
15439 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15440 }
15441 }
15442
15443 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
15444 }
15445 unsafe {
15446 preallocated.write_next(out.assume_init_ref());
15447 }
15448 }
15449
15450 ::fidl_next::WireTable::encode_len(table, max_ord);
15451
15452 Ok(())
15453 }
15454}
15455
15456unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseConfiguration
15457where
15458 ___E: ::fidl_next::Encoder + ?Sized,
15459{
15460 #[inline]
15461 fn encode_ref(
15462 &self,
15463 encoder: &mut ___E,
15464 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15465 ) -> Result<(), ::fidl_next::EncodeError> {
15466 ::fidl_next::munge!(let WireUseConfiguration { table } = out);
15467
15468 let max_ord = self.__max_ordinal();
15469
15470 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
15471 ::fidl_next::Wire::zero_padding(&mut out);
15472
15473 let mut preallocated =
15474 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
15475
15476 for i in 1..=max_ord {
15477 match i {
15478 7 => {
15479 if let Some(source_dictionary) = &self.source_dictionary {
15480 ::fidl_next::WireEnvelope::encode_value(
15481 source_dictionary,
15482 preallocated.encoder,
15483 &mut out,
15484 )?;
15485 } else {
15486 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15487 }
15488 }
15489
15490 6 => {
15491 if let Some(default) = &self.default {
15492 ::fidl_next::WireEnvelope::encode_value(
15493 default,
15494 preallocated.encoder,
15495 &mut out,
15496 )?;
15497 } else {
15498 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15499 }
15500 }
15501
15502 5 => {
15503 if let Some(type_) = &self.type_ {
15504 ::fidl_next::WireEnvelope::encode_value(
15505 type_,
15506 preallocated.encoder,
15507 &mut out,
15508 )?;
15509 } else {
15510 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15511 }
15512 }
15513
15514 4 => {
15515 if let Some(availability) = &self.availability {
15516 ::fidl_next::WireEnvelope::encode_value(
15517 availability,
15518 preallocated.encoder,
15519 &mut out,
15520 )?;
15521 } else {
15522 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15523 }
15524 }
15525
15526 3 => {
15527 if let Some(target_name) = &self.target_name {
15528 ::fidl_next::WireEnvelope::encode_value(
15529 target_name,
15530 preallocated.encoder,
15531 &mut out,
15532 )?;
15533 } else {
15534 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15535 }
15536 }
15537
15538 2 => {
15539 if let Some(source_name) = &self.source_name {
15540 ::fidl_next::WireEnvelope::encode_value(
15541 source_name,
15542 preallocated.encoder,
15543 &mut out,
15544 )?;
15545 } else {
15546 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15547 }
15548 }
15549
15550 1 => {
15551 if let Some(source) = &self.source {
15552 ::fidl_next::WireEnvelope::encode_value(
15553 source,
15554 preallocated.encoder,
15555 &mut out,
15556 )?;
15557 } else {
15558 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15559 }
15560 }
15561
15562 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
15563 }
15564 unsafe {
15565 preallocated.write_next(out.assume_init_ref());
15566 }
15567 }
15568
15569 ::fidl_next::WireTable::encode_len(table, max_ord);
15570
15571 Ok(())
15572 }
15573}
15574
15575impl<'de> ::fidl_next::FromWire<WireUseConfiguration<'de>> for UseConfiguration {
15576 #[inline]
15577 fn from_wire(wire: WireUseConfiguration<'de>) -> Self {
15578 let wire = ::core::mem::ManuallyDrop::new(wire);
15579
15580 let source = wire.table.get(1);
15581
15582 let source_name = wire.table.get(2);
15583
15584 let target_name = wire.table.get(3);
15585
15586 let availability = wire.table.get(4);
15587
15588 let type_ = wire.table.get(5);
15589
15590 let default = wire.table.get(6);
15591
15592 let source_dictionary = wire.table.get(7);
15593
15594 Self {
15595 source: source.map(|envelope| {
15596 ::fidl_next::FromWire::from_wire(unsafe {
15597 envelope.read_unchecked::<crate::WireRef<'de>>()
15598 })
15599 }),
15600
15601 source_name: source_name.map(|envelope| {
15602 ::fidl_next::FromWire::from_wire(unsafe {
15603 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
15604 })
15605 }),
15606
15607 target_name: target_name.map(|envelope| {
15608 ::fidl_next::FromWire::from_wire(unsafe {
15609 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
15610 })
15611 }),
15612
15613 availability: availability.map(|envelope| {
15614 ::fidl_next::FromWire::from_wire(unsafe {
15615 envelope.read_unchecked::<crate::WireAvailability>()
15616 })
15617 }),
15618
15619 type_: type_.map(|envelope| {
15620 ::fidl_next::FromWire::from_wire(unsafe {
15621 envelope.read_unchecked::<crate::WireConfigType<'de>>()
15622 })
15623 }),
15624
15625 default: default.map(|envelope| {
15626 ::fidl_next::FromWire::from_wire(unsafe {
15627 envelope.read_unchecked::<crate::WireConfigValue<'de>>()
15628 })
15629 }),
15630
15631 source_dictionary: source_dictionary.map(|envelope| {
15632 ::fidl_next::FromWire::from_wire(unsafe {
15633 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
15634 })
15635 }),
15636 }
15637 }
15638}
15639
15640impl<'de> ::fidl_next::FromWireRef<WireUseConfiguration<'de>> for UseConfiguration {
15641 #[inline]
15642 fn from_wire_ref(wire: &WireUseConfiguration<'de>) -> Self {
15643 Self {
15644 source: wire.table.get(1).map(|envelope| {
15645 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15646 envelope.deref_unchecked::<crate::WireRef<'de>>()
15647 })
15648 }),
15649
15650 source_name: wire.table.get(2).map(|envelope| {
15651 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15652 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
15653 })
15654 }),
15655
15656 target_name: wire.table.get(3).map(|envelope| {
15657 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15658 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
15659 })
15660 }),
15661
15662 availability: wire.table.get(4).map(|envelope| {
15663 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15664 envelope.deref_unchecked::<crate::WireAvailability>()
15665 })
15666 }),
15667
15668 type_: wire.table.get(5).map(|envelope| {
15669 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15670 envelope.deref_unchecked::<crate::WireConfigType<'de>>()
15671 })
15672 }),
15673
15674 default: wire.table.get(6).map(|envelope| {
15675 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15676 envelope.deref_unchecked::<crate::WireConfigValue<'de>>()
15677 })
15678 }),
15679
15680 source_dictionary: wire.table.get(7).map(|envelope| {
15681 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
15682 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
15683 })
15684 }),
15685 }
15686 }
15687}
15688
15689#[repr(C)]
15691pub struct WireUseConfiguration<'de> {
15692 table: ::fidl_next::WireTable<'de>,
15693}
15694
15695impl<'de> Drop for WireUseConfiguration<'de> {
15696 fn drop(&mut self) {
15697 let _ = self
15698 .table
15699 .get(1)
15700 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
15701
15702 let _ = self
15703 .table
15704 .get(2)
15705 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
15706
15707 let _ = self
15708 .table
15709 .get(3)
15710 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
15711
15712 let _ = self
15713 .table
15714 .get(4)
15715 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
15716
15717 let _ = self
15718 .table
15719 .get(5)
15720 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigType<'de>>() });
15721
15722 let _ = self
15723 .table
15724 .get(6)
15725 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigValue<'de>>() });
15726
15727 let _ = self
15728 .table
15729 .get(7)
15730 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
15731 }
15732}
15733
15734unsafe impl ::fidl_next::Wire for WireUseConfiguration<'static> {
15735 type Decoded<'de> = WireUseConfiguration<'de>;
15736
15737 #[inline]
15738 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
15739 ::fidl_next::munge!(let Self { table } = out);
15740 ::fidl_next::WireTable::zero_padding(table);
15741 }
15742}
15743
15744unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseConfiguration<'static>
15745where
15746 ___D: ::fidl_next::Decoder + ?Sized,
15747{
15748 fn decode(
15749 slot: ::fidl_next::Slot<'_, Self>,
15750 decoder: &mut ___D,
15751 ) -> Result<(), ::fidl_next::DecodeError> {
15752 ::fidl_next::munge!(let Self { table } = slot);
15753
15754 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
15755 match ordinal {
15756 0 => unsafe { ::core::hint::unreachable_unchecked() },
15757
15758 1 => {
15759 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
15760 slot.as_mut(),
15761 decoder,
15762 )?;
15763
15764 Ok(())
15765 }
15766
15767 2 => {
15768 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
15769 slot.as_mut(),
15770 decoder,
15771 )?;
15772
15773 let source_name = unsafe {
15774 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
15775 };
15776
15777 if source_name.len() > 100 {
15778 return Err(::fidl_next::DecodeError::VectorTooLong {
15779 size: source_name.len() as u64,
15780 limit: 100,
15781 });
15782 }
15783
15784 Ok(())
15785 }
15786
15787 3 => {
15788 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
15789 slot.as_mut(),
15790 decoder,
15791 )?;
15792
15793 let target_name = unsafe {
15794 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
15795 };
15796
15797 if target_name.len() > 100 {
15798 return Err(::fidl_next::DecodeError::VectorTooLong {
15799 size: target_name.len() as u64,
15800 limit: 100,
15801 });
15802 }
15803
15804 Ok(())
15805 }
15806
15807 4 => {
15808 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
15809 slot.as_mut(),
15810 decoder,
15811 )?;
15812
15813 Ok(())
15814 }
15815
15816 5 => {
15817 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigType<'static>>(
15818 slot.as_mut(),
15819 decoder,
15820 )?;
15821
15822 Ok(())
15823 }
15824
15825 6 => {
15826 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValue<'static>>(
15827 slot.as_mut(),
15828 decoder,
15829 )?;
15830
15831 Ok(())
15832 }
15833
15834 7 => {
15835 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
15836 slot.as_mut(),
15837 decoder,
15838 )?;
15839
15840 let source_dictionary = unsafe {
15841 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
15842 };
15843
15844 if source_dictionary.len() > 1024 {
15845 return Err(::fidl_next::DecodeError::VectorTooLong {
15846 size: source_dictionary.len() as u64,
15847 limit: 1024,
15848 });
15849 }
15850
15851 Ok(())
15852 }
15853
15854 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
15855 }
15856 })
15857 }
15858}
15859
15860impl<'de> WireUseConfiguration<'de> {
15861 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
15862 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
15863 }
15864
15865 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
15866 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
15867 }
15868
15869 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
15870 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
15871 }
15872
15873 pub fn availability(&self) -> Option<&crate::WireAvailability> {
15874 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
15875 }
15876
15877 pub fn type_(&self) -> Option<&crate::WireConfigType<'de>> {
15878 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
15879 }
15880
15881 pub fn default(&self) -> Option<&crate::WireConfigValue<'de>> {
15882 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
15883 }
15884
15885 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
15886 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
15887 }
15888}
15889
15890impl<'de> ::core::fmt::Debug for WireUseConfiguration<'de> {
15891 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
15892 f.debug_struct("UseConfiguration")
15893 .field("source", &self.source())
15894 .field("source_name", &self.source_name())
15895 .field("target_name", &self.target_name())
15896 .field("availability", &self.availability())
15897 .field("type_", &self.type_())
15898 .field("default", &self.default())
15899 .field("source_dictionary", &self.source_dictionary())
15900 .finish()
15901 }
15902}
15903
15904#[doc = " Declares a capability used by a component, which was offered to it.\n"]
15905#[derive(Clone, Debug)]
15906pub enum Use {
15907 Service(crate::UseService),
15908
15909 Protocol(crate::UseProtocol),
15910
15911 Directory(crate::UseDirectory),
15912
15913 Storage(crate::UseStorage),
15914
15915 EventStream(crate::UseEventStream),
15916
15917 Runner(crate::UseRunner),
15918
15919 Config(crate::UseConfiguration),
15920
15921 UnknownOrdinal_(u64),
15922}
15923
15924impl ::fidl_next::Encodable for Use {
15925 type Encoded = WireUse<'static>;
15926}
15927
15928unsafe impl<___E> ::fidl_next::Encode<___E> for Use
15929where
15930 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
15931
15932 ___E: ::fidl_next::Encoder,
15933{
15934 #[inline]
15935 fn encode(
15936 self,
15937 encoder: &mut ___E,
15938 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15939 ) -> Result<(), ::fidl_next::EncodeError> {
15940 ::fidl_next::munge!(let WireUse { raw, _phantom: _ } = out);
15941
15942 match self {
15943 Self::Service(value) => {
15944 ::fidl_next::RawWireUnion::encode_as::<___E, crate::UseService>(
15945 value, 1, encoder, raw,
15946 )?
15947 }
15948
15949 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
15950 ___E,
15951 crate::UseProtocol,
15952 >(value, 2, encoder, raw)?,
15953
15954 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
15955 ___E,
15956 crate::UseDirectory,
15957 >(value, 3, encoder, raw)?,
15958
15959 Self::Storage(value) => {
15960 ::fidl_next::RawWireUnion::encode_as::<___E, crate::UseStorage>(
15961 value, 4, encoder, raw,
15962 )?
15963 }
15964
15965 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
15966 ___E,
15967 crate::UseEventStream,
15968 >(value, 7, encoder, raw)?,
15969
15970 Self::Runner(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::UseRunner>(
15971 value, 8, encoder, raw,
15972 )?,
15973
15974 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
15975 ___E,
15976 crate::UseConfiguration,
15977 >(value, 9, encoder, raw)?,
15978
15979 Self::UnknownOrdinal_(ordinal) => {
15980 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
15981 }
15982 }
15983
15984 Ok(())
15985 }
15986}
15987
15988unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Use
15989where
15990 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
15991
15992 ___E: ::fidl_next::Encoder,
15993{
15994 #[inline]
15995 fn encode_ref(
15996 &self,
15997 encoder: &mut ___E,
15998 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15999 ) -> Result<(), ::fidl_next::EncodeError> {
16000 ::fidl_next::munge!(let WireUse { raw, _phantom: _ } = out);
16001
16002 match self {
16003 Self::Service(value) => {
16004 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::UseService>(
16005 value, 1, encoder, raw,
16006 )?
16007 }
16008
16009 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
16010 ___E,
16011 &crate::UseProtocol,
16012 >(value, 2, encoder, raw)?,
16013
16014 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
16015 ___E,
16016 &crate::UseDirectory,
16017 >(value, 3, encoder, raw)?,
16018
16019 Self::Storage(value) => {
16020 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::UseStorage>(
16021 value, 4, encoder, raw,
16022 )?
16023 }
16024
16025 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
16026 ___E,
16027 &crate::UseEventStream,
16028 >(value, 7, encoder, raw)?,
16029
16030 Self::Runner(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::UseRunner>(
16031 value, 8, encoder, raw,
16032 )?,
16033
16034 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
16035 ___E,
16036 &crate::UseConfiguration,
16037 >(value, 9, encoder, raw)?,
16038
16039 Self::UnknownOrdinal_(ordinal) => {
16040 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
16041 }
16042 }
16043
16044 Ok(())
16045 }
16046}
16047
16048impl ::fidl_next::EncodableOption for Use {
16049 type EncodedOption = WireOptionalUse<'static>;
16050}
16051
16052unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Use
16053where
16054 ___E: ?Sized,
16055 Use: ::fidl_next::Encode<___E>,
16056{
16057 #[inline]
16058 fn encode_option(
16059 this: Option<Self>,
16060 encoder: &mut ___E,
16061 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
16062 ) -> Result<(), ::fidl_next::EncodeError> {
16063 ::fidl_next::munge!(let WireOptionalUse { raw, _phantom: _ } = &mut *out);
16064
16065 if let Some(inner) = this {
16066 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
16067 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
16068 } else {
16069 ::fidl_next::RawWireUnion::encode_absent(raw);
16070 }
16071
16072 Ok(())
16073 }
16074}
16075
16076unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Use
16077where
16078 ___E: ?Sized,
16079 Use: ::fidl_next::EncodeRef<___E>,
16080{
16081 #[inline]
16082 fn encode_option_ref(
16083 this: Option<&Self>,
16084 encoder: &mut ___E,
16085 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
16086 ) -> Result<(), ::fidl_next::EncodeError> {
16087 ::fidl_next::munge!(let WireOptionalUse { raw, _phantom: _ } = &mut *out);
16088
16089 if let Some(inner) = this {
16090 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
16091 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
16092 } else {
16093 ::fidl_next::RawWireUnion::encode_absent(raw);
16094 }
16095
16096 Ok(())
16097 }
16098}
16099
16100impl<'de> ::fidl_next::FromWire<WireUse<'de>> for Use {
16101 #[inline]
16102 fn from_wire(wire: WireUse<'de>) -> Self {
16103 let wire = ::core::mem::ManuallyDrop::new(wire);
16104 match wire.raw.ordinal() {
16105 1 => Self::Service(::fidl_next::FromWire::from_wire(unsafe {
16106 wire.raw.get().read_unchecked::<crate::WireUseService<'de>>()
16107 })),
16108
16109 2 => Self::Protocol(::fidl_next::FromWire::from_wire(unsafe {
16110 wire.raw.get().read_unchecked::<crate::WireUseProtocol<'de>>()
16111 })),
16112
16113 3 => Self::Directory(::fidl_next::FromWire::from_wire(unsafe {
16114 wire.raw.get().read_unchecked::<crate::WireUseDirectory<'de>>()
16115 })),
16116
16117 4 => Self::Storage(::fidl_next::FromWire::from_wire(unsafe {
16118 wire.raw.get().read_unchecked::<crate::WireUseStorage<'de>>()
16119 })),
16120
16121 7 => Self::EventStream(::fidl_next::FromWire::from_wire(unsafe {
16122 wire.raw.get().read_unchecked::<crate::WireUseEventStream<'de>>()
16123 })),
16124
16125 8 => Self::Runner(::fidl_next::FromWire::from_wire(unsafe {
16126 wire.raw.get().read_unchecked::<crate::WireUseRunner<'de>>()
16127 })),
16128
16129 9 => Self::Config(::fidl_next::FromWire::from_wire(unsafe {
16130 wire.raw.get().read_unchecked::<crate::WireUseConfiguration<'de>>()
16131 })),
16132
16133 _ => unsafe { ::core::hint::unreachable_unchecked() },
16134 }
16135 }
16136}
16137
16138impl<'de> ::fidl_next::FromWireRef<WireUse<'de>> for Use {
16139 #[inline]
16140 fn from_wire_ref(wire: &WireUse<'de>) -> Self {
16141 match wire.raw.ordinal() {
16142 1 => Self::Service(::fidl_next::FromWireRef::from_wire_ref(unsafe {
16143 wire.raw.get().deref_unchecked::<crate::WireUseService<'de>>()
16144 })),
16145
16146 2 => Self::Protocol(::fidl_next::FromWireRef::from_wire_ref(unsafe {
16147 wire.raw.get().deref_unchecked::<crate::WireUseProtocol<'de>>()
16148 })),
16149
16150 3 => Self::Directory(::fidl_next::FromWireRef::from_wire_ref(unsafe {
16151 wire.raw.get().deref_unchecked::<crate::WireUseDirectory<'de>>()
16152 })),
16153
16154 4 => Self::Storage(::fidl_next::FromWireRef::from_wire_ref(unsafe {
16155 wire.raw.get().deref_unchecked::<crate::WireUseStorage<'de>>()
16156 })),
16157
16158 7 => Self::EventStream(::fidl_next::FromWireRef::from_wire_ref(unsafe {
16159 wire.raw.get().deref_unchecked::<crate::WireUseEventStream<'de>>()
16160 })),
16161
16162 8 => Self::Runner(::fidl_next::FromWireRef::from_wire_ref(unsafe {
16163 wire.raw.get().deref_unchecked::<crate::WireUseRunner<'de>>()
16164 })),
16165
16166 9 => Self::Config(::fidl_next::FromWireRef::from_wire_ref(unsafe {
16167 wire.raw.get().deref_unchecked::<crate::WireUseConfiguration<'de>>()
16168 })),
16169
16170 _ => unsafe { ::core::hint::unreachable_unchecked() },
16171 }
16172 }
16173}
16174
16175impl<'de> ::fidl_next::FromWireOption<WireOptionalUse<'de>> for Box<Use> {
16176 #[inline]
16177 fn from_wire_option(wire: WireOptionalUse<'de>) -> Option<Self> {
16178 if let Some(inner) = wire.into_option() {
16179 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
16180 } else {
16181 None
16182 }
16183 }
16184}
16185
16186impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalUse<'de>> for Box<Use> {
16187 #[inline]
16188 fn from_wire_option_ref(wire: &WireOptionalUse<'de>) -> Option<Self> {
16189 if let Some(inner) = wire.as_ref() {
16190 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
16191 } else {
16192 None
16193 }
16194 }
16195}
16196
16197#[repr(transparent)]
16199pub struct WireUse<'de> {
16200 raw: ::fidl_next::RawWireUnion,
16201 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
16202}
16203
16204impl<'de> Drop for WireUse<'de> {
16205 fn drop(&mut self) {
16206 match self.raw.ordinal() {
16207 1 => {
16208 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireUseService<'de>>() };
16209 }
16210
16211 2 => {
16212 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireUseProtocol<'de>>() };
16213 }
16214
16215 3 => {
16216 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireUseDirectory<'de>>() };
16217 }
16218
16219 4 => {
16220 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireUseStorage<'de>>() };
16221 }
16222
16223 7 => {
16224 let _ =
16225 unsafe { self.raw.get().read_unchecked::<crate::WireUseEventStream<'de>>() };
16226 }
16227
16228 8 => {
16229 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireUseRunner<'de>>() };
16230 }
16231
16232 9 => {
16233 let _ =
16234 unsafe { self.raw.get().read_unchecked::<crate::WireUseConfiguration<'de>>() };
16235 }
16236
16237 _ => (),
16238 }
16239 }
16240}
16241
16242unsafe impl ::fidl_next::Wire for WireUse<'static> {
16243 type Decoded<'de> = WireUse<'de>;
16244
16245 #[inline]
16246 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
16247 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
16248 ::fidl_next::RawWireUnion::zero_padding(raw);
16249 }
16250}
16251
16252pub mod use_ {
16253 pub enum Ref<'de> {
16254 Service(&'de crate::WireUseService<'de>),
16255
16256 Protocol(&'de crate::WireUseProtocol<'de>),
16257
16258 Directory(&'de crate::WireUseDirectory<'de>),
16259
16260 Storage(&'de crate::WireUseStorage<'de>),
16261
16262 EventStream(&'de crate::WireUseEventStream<'de>),
16263
16264 Runner(&'de crate::WireUseRunner<'de>),
16265
16266 Config(&'de crate::WireUseConfiguration<'de>),
16267
16268 UnknownOrdinal_(u64),
16269 }
16270}
16271
16272impl<'de> WireUse<'de> {
16273 pub fn as_ref(&self) -> crate::use_::Ref<'_> {
16274 match self.raw.ordinal() {
16275 1 => crate::use_::Ref::Service(unsafe {
16276 self.raw.get().deref_unchecked::<crate::WireUseService<'_>>()
16277 }),
16278
16279 2 => crate::use_::Ref::Protocol(unsafe {
16280 self.raw.get().deref_unchecked::<crate::WireUseProtocol<'_>>()
16281 }),
16282
16283 3 => crate::use_::Ref::Directory(unsafe {
16284 self.raw.get().deref_unchecked::<crate::WireUseDirectory<'_>>()
16285 }),
16286
16287 4 => crate::use_::Ref::Storage(unsafe {
16288 self.raw.get().deref_unchecked::<crate::WireUseStorage<'_>>()
16289 }),
16290
16291 7 => crate::use_::Ref::EventStream(unsafe {
16292 self.raw.get().deref_unchecked::<crate::WireUseEventStream<'_>>()
16293 }),
16294
16295 8 => crate::use_::Ref::Runner(unsafe {
16296 self.raw.get().deref_unchecked::<crate::WireUseRunner<'_>>()
16297 }),
16298
16299 9 => crate::use_::Ref::Config(unsafe {
16300 self.raw.get().deref_unchecked::<crate::WireUseConfiguration<'_>>()
16301 }),
16302
16303 unknown => crate::use_::Ref::UnknownOrdinal_(unknown),
16304 }
16305 }
16306}
16307
16308unsafe impl<___D> ::fidl_next::Decode<___D> for WireUse<'static>
16309where
16310 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
16311
16312 ___D: ::fidl_next::Decoder,
16313{
16314 fn decode(
16315 mut slot: ::fidl_next::Slot<'_, Self>,
16316 decoder: &mut ___D,
16317 ) -> Result<(), ::fidl_next::DecodeError> {
16318 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
16319 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
16320 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseService<'static>>(
16321 raw, decoder,
16322 )?,
16323
16324 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseProtocol<'static>>(
16325 raw, decoder,
16326 )?,
16327
16328 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseDirectory<'static>>(
16329 raw, decoder,
16330 )?,
16331
16332 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseStorage<'static>>(
16333 raw, decoder,
16334 )?,
16335
16336 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseEventStream<'static>>(
16337 raw, decoder,
16338 )?,
16339
16340 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseRunner<'static>>(
16341 raw, decoder,
16342 )?,
16343
16344 9 => {
16345 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseConfiguration<'static>>(
16346 raw, decoder,
16347 )?
16348 }
16349
16350 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
16351 }
16352
16353 Ok(())
16354 }
16355}
16356
16357impl<'de> ::core::fmt::Debug for WireUse<'de> {
16358 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
16359 match self.raw.ordinal() {
16360 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseService<'_>>().fmt(f) },
16361 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseProtocol<'_>>().fmt(f) },
16362 3 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseDirectory<'_>>().fmt(f) },
16363 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseStorage<'_>>().fmt(f) },
16364 7 => unsafe {
16365 self.raw.get().deref_unchecked::<crate::WireUseEventStream<'_>>().fmt(f)
16366 },
16367 8 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseRunner<'_>>().fmt(f) },
16368 9 => unsafe {
16369 self.raw.get().deref_unchecked::<crate::WireUseConfiguration<'_>>().fmt(f)
16370 },
16371 _ => unsafe { ::core::hint::unreachable_unchecked() },
16372 }
16373 }
16374}
16375
16376#[repr(transparent)]
16377pub struct WireOptionalUse<'de> {
16378 raw: ::fidl_next::RawWireUnion,
16379 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
16380}
16381
16382unsafe impl ::fidl_next::Wire for WireOptionalUse<'static> {
16383 type Decoded<'de> = WireOptionalUse<'de>;
16384
16385 #[inline]
16386 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
16387 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
16388 ::fidl_next::RawWireUnion::zero_padding(raw);
16389 }
16390}
16391
16392impl<'de> WireOptionalUse<'de> {
16393 pub fn is_some(&self) -> bool {
16394 self.raw.is_some()
16395 }
16396
16397 pub fn is_none(&self) -> bool {
16398 self.raw.is_none()
16399 }
16400
16401 pub fn as_ref(&self) -> Option<&WireUse<'de>> {
16402 if self.is_some() {
16403 Some(unsafe { &*(self as *const Self).cast() })
16404 } else {
16405 None
16406 }
16407 }
16408
16409 pub fn into_option(self) -> Option<WireUse<'de>> {
16410 if self.is_some() {
16411 Some(WireUse { raw: self.raw, _phantom: ::core::marker::PhantomData })
16412 } else {
16413 None
16414 }
16415 }
16416}
16417
16418unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalUse<'static>
16419where
16420 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
16421
16422 ___D: ::fidl_next::Decoder,
16423{
16424 fn decode(
16425 mut slot: ::fidl_next::Slot<'_, Self>,
16426 decoder: &mut ___D,
16427 ) -> Result<(), ::fidl_next::DecodeError> {
16428 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
16429 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
16430 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseService<'static>>(
16431 raw, decoder,
16432 )?,
16433
16434 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseProtocol<'static>>(
16435 raw, decoder,
16436 )?,
16437
16438 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseDirectory<'static>>(
16439 raw, decoder,
16440 )?,
16441
16442 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseStorage<'static>>(
16443 raw, decoder,
16444 )?,
16445
16446 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseEventStream<'static>>(
16447 raw, decoder,
16448 )?,
16449
16450 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseRunner<'static>>(
16451 raw, decoder,
16452 )?,
16453
16454 9 => {
16455 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseConfiguration<'static>>(
16456 raw, decoder,
16457 )?
16458 }
16459
16460 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
16461 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
16462 }
16463
16464 Ok(())
16465 }
16466}
16467
16468impl<'de> ::core::fmt::Debug for WireOptionalUse<'de> {
16469 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
16470 self.as_ref().fmt(f)
16471 }
16472}
16473
16474#[doc = " Declares a service exposed to a component\'s containing realm, such as a\n service exposed by the component or one of its children at runtime.\n\n To learn more about services, see:\n https://fuchsia.dev/fuchsia-src/glossary#service\n"]
16475#[derive(Clone, Debug, Default)]
16476pub struct ExposeService {
16477 pub source: Option<crate::Ref>,
16478
16479 pub source_name: Option<String>,
16480
16481 pub target: Option<crate::Ref>,
16482
16483 pub target_name: Option<String>,
16484
16485 pub availability: Option<crate::Availability>,
16486
16487 pub source_dictionary: Option<String>,
16488}
16489
16490impl ExposeService {
16491 fn __max_ordinal(&self) -> usize {
16492 if self.source_dictionary.is_some() {
16493 return 6;
16494 }
16495
16496 if self.availability.is_some() {
16497 return 5;
16498 }
16499
16500 if self.target_name.is_some() {
16501 return 4;
16502 }
16503
16504 if self.target.is_some() {
16505 return 3;
16506 }
16507
16508 if self.source_name.is_some() {
16509 return 2;
16510 }
16511
16512 if self.source.is_some() {
16513 return 1;
16514 }
16515
16516 0
16517 }
16518}
16519
16520impl ::fidl_next::Encodable for ExposeService {
16521 type Encoded = WireExposeService<'static>;
16522}
16523
16524unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeService
16525where
16526 ___E: ::fidl_next::Encoder + ?Sized,
16527{
16528 #[inline]
16529 fn encode(
16530 mut self,
16531 encoder: &mut ___E,
16532 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
16533 ) -> Result<(), ::fidl_next::EncodeError> {
16534 ::fidl_next::munge!(let WireExposeService { table } = out);
16535
16536 let max_ord = self.__max_ordinal();
16537
16538 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
16539 ::fidl_next::Wire::zero_padding(&mut out);
16540
16541 let mut preallocated =
16542 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
16543
16544 for i in 1..=max_ord {
16545 match i {
16546 6 => {
16547 if let Some(source_dictionary) = self.source_dictionary.take() {
16548 ::fidl_next::WireEnvelope::encode_value(
16549 source_dictionary,
16550 preallocated.encoder,
16551 &mut out,
16552 )?;
16553 } else {
16554 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16555 }
16556 }
16557
16558 5 => {
16559 if let Some(availability) = self.availability.take() {
16560 ::fidl_next::WireEnvelope::encode_value(
16561 availability,
16562 preallocated.encoder,
16563 &mut out,
16564 )?;
16565 } else {
16566 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16567 }
16568 }
16569
16570 4 => {
16571 if let Some(target_name) = self.target_name.take() {
16572 ::fidl_next::WireEnvelope::encode_value(
16573 target_name,
16574 preallocated.encoder,
16575 &mut out,
16576 )?;
16577 } else {
16578 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16579 }
16580 }
16581
16582 3 => {
16583 if let Some(target) = self.target.take() {
16584 ::fidl_next::WireEnvelope::encode_value(
16585 target,
16586 preallocated.encoder,
16587 &mut out,
16588 )?;
16589 } else {
16590 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16591 }
16592 }
16593
16594 2 => {
16595 if let Some(source_name) = self.source_name.take() {
16596 ::fidl_next::WireEnvelope::encode_value(
16597 source_name,
16598 preallocated.encoder,
16599 &mut out,
16600 )?;
16601 } else {
16602 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16603 }
16604 }
16605
16606 1 => {
16607 if let Some(source) = self.source.take() {
16608 ::fidl_next::WireEnvelope::encode_value(
16609 source,
16610 preallocated.encoder,
16611 &mut out,
16612 )?;
16613 } else {
16614 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16615 }
16616 }
16617
16618 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
16619 }
16620 unsafe {
16621 preallocated.write_next(out.assume_init_ref());
16622 }
16623 }
16624
16625 ::fidl_next::WireTable::encode_len(table, max_ord);
16626
16627 Ok(())
16628 }
16629}
16630
16631unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeService
16632where
16633 ___E: ::fidl_next::Encoder + ?Sized,
16634{
16635 #[inline]
16636 fn encode_ref(
16637 &self,
16638 encoder: &mut ___E,
16639 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
16640 ) -> Result<(), ::fidl_next::EncodeError> {
16641 ::fidl_next::munge!(let WireExposeService { table } = out);
16642
16643 let max_ord = self.__max_ordinal();
16644
16645 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
16646 ::fidl_next::Wire::zero_padding(&mut out);
16647
16648 let mut preallocated =
16649 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
16650
16651 for i in 1..=max_ord {
16652 match i {
16653 6 => {
16654 if let Some(source_dictionary) = &self.source_dictionary {
16655 ::fidl_next::WireEnvelope::encode_value(
16656 source_dictionary,
16657 preallocated.encoder,
16658 &mut out,
16659 )?;
16660 } else {
16661 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16662 }
16663 }
16664
16665 5 => {
16666 if let Some(availability) = &self.availability {
16667 ::fidl_next::WireEnvelope::encode_value(
16668 availability,
16669 preallocated.encoder,
16670 &mut out,
16671 )?;
16672 } else {
16673 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16674 }
16675 }
16676
16677 4 => {
16678 if let Some(target_name) = &self.target_name {
16679 ::fidl_next::WireEnvelope::encode_value(
16680 target_name,
16681 preallocated.encoder,
16682 &mut out,
16683 )?;
16684 } else {
16685 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16686 }
16687 }
16688
16689 3 => {
16690 if let Some(target) = &self.target {
16691 ::fidl_next::WireEnvelope::encode_value(
16692 target,
16693 preallocated.encoder,
16694 &mut out,
16695 )?;
16696 } else {
16697 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16698 }
16699 }
16700
16701 2 => {
16702 if let Some(source_name) = &self.source_name {
16703 ::fidl_next::WireEnvelope::encode_value(
16704 source_name,
16705 preallocated.encoder,
16706 &mut out,
16707 )?;
16708 } else {
16709 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16710 }
16711 }
16712
16713 1 => {
16714 if let Some(source) = &self.source {
16715 ::fidl_next::WireEnvelope::encode_value(
16716 source,
16717 preallocated.encoder,
16718 &mut out,
16719 )?;
16720 } else {
16721 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16722 }
16723 }
16724
16725 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
16726 }
16727 unsafe {
16728 preallocated.write_next(out.assume_init_ref());
16729 }
16730 }
16731
16732 ::fidl_next::WireTable::encode_len(table, max_ord);
16733
16734 Ok(())
16735 }
16736}
16737
16738impl<'de> ::fidl_next::FromWire<WireExposeService<'de>> for ExposeService {
16739 #[inline]
16740 fn from_wire(wire: WireExposeService<'de>) -> Self {
16741 let wire = ::core::mem::ManuallyDrop::new(wire);
16742
16743 let source = wire.table.get(1);
16744
16745 let source_name = wire.table.get(2);
16746
16747 let target = wire.table.get(3);
16748
16749 let target_name = wire.table.get(4);
16750
16751 let availability = wire.table.get(5);
16752
16753 let source_dictionary = wire.table.get(6);
16754
16755 Self {
16756 source: source.map(|envelope| {
16757 ::fidl_next::FromWire::from_wire(unsafe {
16758 envelope.read_unchecked::<crate::WireRef<'de>>()
16759 })
16760 }),
16761
16762 source_name: source_name.map(|envelope| {
16763 ::fidl_next::FromWire::from_wire(unsafe {
16764 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
16765 })
16766 }),
16767
16768 target: target.map(|envelope| {
16769 ::fidl_next::FromWire::from_wire(unsafe {
16770 envelope.read_unchecked::<crate::WireRef<'de>>()
16771 })
16772 }),
16773
16774 target_name: target_name.map(|envelope| {
16775 ::fidl_next::FromWire::from_wire(unsafe {
16776 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
16777 })
16778 }),
16779
16780 availability: availability.map(|envelope| {
16781 ::fidl_next::FromWire::from_wire(unsafe {
16782 envelope.read_unchecked::<crate::WireAvailability>()
16783 })
16784 }),
16785
16786 source_dictionary: source_dictionary.map(|envelope| {
16787 ::fidl_next::FromWire::from_wire(unsafe {
16788 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
16789 })
16790 }),
16791 }
16792 }
16793}
16794
16795impl<'de> ::fidl_next::FromWireRef<WireExposeService<'de>> for ExposeService {
16796 #[inline]
16797 fn from_wire_ref(wire: &WireExposeService<'de>) -> Self {
16798 Self {
16799 source: wire.table.get(1).map(|envelope| {
16800 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
16801 envelope.deref_unchecked::<crate::WireRef<'de>>()
16802 })
16803 }),
16804
16805 source_name: wire.table.get(2).map(|envelope| {
16806 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
16807 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
16808 })
16809 }),
16810
16811 target: wire.table.get(3).map(|envelope| {
16812 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
16813 envelope.deref_unchecked::<crate::WireRef<'de>>()
16814 })
16815 }),
16816
16817 target_name: wire.table.get(4).map(|envelope| {
16818 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
16819 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
16820 })
16821 }),
16822
16823 availability: wire.table.get(5).map(|envelope| {
16824 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
16825 envelope.deref_unchecked::<crate::WireAvailability>()
16826 })
16827 }),
16828
16829 source_dictionary: wire.table.get(6).map(|envelope| {
16830 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
16831 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
16832 })
16833 }),
16834 }
16835 }
16836}
16837
16838#[repr(C)]
16840pub struct WireExposeService<'de> {
16841 table: ::fidl_next::WireTable<'de>,
16842}
16843
16844impl<'de> Drop for WireExposeService<'de> {
16845 fn drop(&mut self) {
16846 let _ = self
16847 .table
16848 .get(1)
16849 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
16850
16851 let _ = self
16852 .table
16853 .get(2)
16854 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
16855
16856 let _ = self
16857 .table
16858 .get(3)
16859 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
16860
16861 let _ = self
16862 .table
16863 .get(4)
16864 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
16865
16866 let _ = self
16867 .table
16868 .get(5)
16869 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
16870
16871 let _ = self
16872 .table
16873 .get(6)
16874 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
16875 }
16876}
16877
16878unsafe impl ::fidl_next::Wire for WireExposeService<'static> {
16879 type Decoded<'de> = WireExposeService<'de>;
16880
16881 #[inline]
16882 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
16883 ::fidl_next::munge!(let Self { table } = out);
16884 ::fidl_next::WireTable::zero_padding(table);
16885 }
16886}
16887
16888unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeService<'static>
16889where
16890 ___D: ::fidl_next::Decoder + ?Sized,
16891{
16892 fn decode(
16893 slot: ::fidl_next::Slot<'_, Self>,
16894 decoder: &mut ___D,
16895 ) -> Result<(), ::fidl_next::DecodeError> {
16896 ::fidl_next::munge!(let Self { table } = slot);
16897
16898 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
16899 match ordinal {
16900 0 => unsafe { ::core::hint::unreachable_unchecked() },
16901
16902 1 => {
16903 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
16904 slot.as_mut(),
16905 decoder,
16906 )?;
16907
16908 Ok(())
16909 }
16910
16911 2 => {
16912 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
16913 slot.as_mut(),
16914 decoder,
16915 )?;
16916
16917 let source_name = unsafe {
16918 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
16919 };
16920
16921 if source_name.len() > 100 {
16922 return Err(::fidl_next::DecodeError::VectorTooLong {
16923 size: source_name.len() as u64,
16924 limit: 100,
16925 });
16926 }
16927
16928 Ok(())
16929 }
16930
16931 3 => {
16932 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
16933 slot.as_mut(),
16934 decoder,
16935 )?;
16936
16937 Ok(())
16938 }
16939
16940 4 => {
16941 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
16942 slot.as_mut(),
16943 decoder,
16944 )?;
16945
16946 let target_name = unsafe {
16947 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
16948 };
16949
16950 if target_name.len() > 100 {
16951 return Err(::fidl_next::DecodeError::VectorTooLong {
16952 size: target_name.len() as u64,
16953 limit: 100,
16954 });
16955 }
16956
16957 Ok(())
16958 }
16959
16960 5 => {
16961 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
16962 slot.as_mut(),
16963 decoder,
16964 )?;
16965
16966 Ok(())
16967 }
16968
16969 6 => {
16970 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
16971 slot.as_mut(),
16972 decoder,
16973 )?;
16974
16975 let source_dictionary = unsafe {
16976 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
16977 };
16978
16979 if source_dictionary.len() > 1024 {
16980 return Err(::fidl_next::DecodeError::VectorTooLong {
16981 size: source_dictionary.len() as u64,
16982 limit: 1024,
16983 });
16984 }
16985
16986 Ok(())
16987 }
16988
16989 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
16990 }
16991 })
16992 }
16993}
16994
16995impl<'de> WireExposeService<'de> {
16996 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
16997 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
16998 }
16999
17000 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
17001 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
17002 }
17003
17004 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
17005 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
17006 }
17007
17008 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
17009 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
17010 }
17011
17012 pub fn availability(&self) -> Option<&crate::WireAvailability> {
17013 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
17014 }
17015
17016 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
17017 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
17018 }
17019}
17020
17021impl<'de> ::core::fmt::Debug for WireExposeService<'de> {
17022 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
17023 f.debug_struct("ExposeService")
17024 .field("source", &self.source())
17025 .field("source_name", &self.source_name())
17026 .field("target", &self.target())
17027 .field("target_name", &self.target_name())
17028 .field("availability", &self.availability())
17029 .field("source_dictionary", &self.source_dictionary())
17030 .finish()
17031 }
17032}
17033
17034#[doc = " Declares a protocol exposed to a component\'s containing realm, such as\n a protocol exposed by the component or one of its children at runtime.\n\n To learn more about protocols, see:\n https://fuchsia.dev/fuchsia-src/glossary#protocol\n"]
17035#[derive(Clone, Debug, Default)]
17036pub struct ExposeProtocol {
17037 pub source: Option<crate::Ref>,
17038
17039 pub source_name: Option<String>,
17040
17041 pub target: Option<crate::Ref>,
17042
17043 pub target_name: Option<String>,
17044
17045 pub availability: Option<crate::Availability>,
17046
17047 pub source_dictionary: Option<String>,
17048}
17049
17050impl ExposeProtocol {
17051 fn __max_ordinal(&self) -> usize {
17052 if self.source_dictionary.is_some() {
17053 return 6;
17054 }
17055
17056 if self.availability.is_some() {
17057 return 5;
17058 }
17059
17060 if self.target_name.is_some() {
17061 return 4;
17062 }
17063
17064 if self.target.is_some() {
17065 return 3;
17066 }
17067
17068 if self.source_name.is_some() {
17069 return 2;
17070 }
17071
17072 if self.source.is_some() {
17073 return 1;
17074 }
17075
17076 0
17077 }
17078}
17079
17080impl ::fidl_next::Encodable for ExposeProtocol {
17081 type Encoded = WireExposeProtocol<'static>;
17082}
17083
17084unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeProtocol
17085where
17086 ___E: ::fidl_next::Encoder + ?Sized,
17087{
17088 #[inline]
17089 fn encode(
17090 mut self,
17091 encoder: &mut ___E,
17092 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
17093 ) -> Result<(), ::fidl_next::EncodeError> {
17094 ::fidl_next::munge!(let WireExposeProtocol { table } = out);
17095
17096 let max_ord = self.__max_ordinal();
17097
17098 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
17099 ::fidl_next::Wire::zero_padding(&mut out);
17100
17101 let mut preallocated =
17102 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
17103
17104 for i in 1..=max_ord {
17105 match i {
17106 6 => {
17107 if let Some(source_dictionary) = self.source_dictionary.take() {
17108 ::fidl_next::WireEnvelope::encode_value(
17109 source_dictionary,
17110 preallocated.encoder,
17111 &mut out,
17112 )?;
17113 } else {
17114 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17115 }
17116 }
17117
17118 5 => {
17119 if let Some(availability) = self.availability.take() {
17120 ::fidl_next::WireEnvelope::encode_value(
17121 availability,
17122 preallocated.encoder,
17123 &mut out,
17124 )?;
17125 } else {
17126 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17127 }
17128 }
17129
17130 4 => {
17131 if let Some(target_name) = self.target_name.take() {
17132 ::fidl_next::WireEnvelope::encode_value(
17133 target_name,
17134 preallocated.encoder,
17135 &mut out,
17136 )?;
17137 } else {
17138 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17139 }
17140 }
17141
17142 3 => {
17143 if let Some(target) = self.target.take() {
17144 ::fidl_next::WireEnvelope::encode_value(
17145 target,
17146 preallocated.encoder,
17147 &mut out,
17148 )?;
17149 } else {
17150 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17151 }
17152 }
17153
17154 2 => {
17155 if let Some(source_name) = self.source_name.take() {
17156 ::fidl_next::WireEnvelope::encode_value(
17157 source_name,
17158 preallocated.encoder,
17159 &mut out,
17160 )?;
17161 } else {
17162 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17163 }
17164 }
17165
17166 1 => {
17167 if let Some(source) = self.source.take() {
17168 ::fidl_next::WireEnvelope::encode_value(
17169 source,
17170 preallocated.encoder,
17171 &mut out,
17172 )?;
17173 } else {
17174 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17175 }
17176 }
17177
17178 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
17179 }
17180 unsafe {
17181 preallocated.write_next(out.assume_init_ref());
17182 }
17183 }
17184
17185 ::fidl_next::WireTable::encode_len(table, max_ord);
17186
17187 Ok(())
17188 }
17189}
17190
17191unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeProtocol
17192where
17193 ___E: ::fidl_next::Encoder + ?Sized,
17194{
17195 #[inline]
17196 fn encode_ref(
17197 &self,
17198 encoder: &mut ___E,
17199 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
17200 ) -> Result<(), ::fidl_next::EncodeError> {
17201 ::fidl_next::munge!(let WireExposeProtocol { table } = out);
17202
17203 let max_ord = self.__max_ordinal();
17204
17205 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
17206 ::fidl_next::Wire::zero_padding(&mut out);
17207
17208 let mut preallocated =
17209 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
17210
17211 for i in 1..=max_ord {
17212 match i {
17213 6 => {
17214 if let Some(source_dictionary) = &self.source_dictionary {
17215 ::fidl_next::WireEnvelope::encode_value(
17216 source_dictionary,
17217 preallocated.encoder,
17218 &mut out,
17219 )?;
17220 } else {
17221 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17222 }
17223 }
17224
17225 5 => {
17226 if let Some(availability) = &self.availability {
17227 ::fidl_next::WireEnvelope::encode_value(
17228 availability,
17229 preallocated.encoder,
17230 &mut out,
17231 )?;
17232 } else {
17233 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17234 }
17235 }
17236
17237 4 => {
17238 if let Some(target_name) = &self.target_name {
17239 ::fidl_next::WireEnvelope::encode_value(
17240 target_name,
17241 preallocated.encoder,
17242 &mut out,
17243 )?;
17244 } else {
17245 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17246 }
17247 }
17248
17249 3 => {
17250 if let Some(target) = &self.target {
17251 ::fidl_next::WireEnvelope::encode_value(
17252 target,
17253 preallocated.encoder,
17254 &mut out,
17255 )?;
17256 } else {
17257 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17258 }
17259 }
17260
17261 2 => {
17262 if let Some(source_name) = &self.source_name {
17263 ::fidl_next::WireEnvelope::encode_value(
17264 source_name,
17265 preallocated.encoder,
17266 &mut out,
17267 )?;
17268 } else {
17269 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17270 }
17271 }
17272
17273 1 => {
17274 if let Some(source) = &self.source {
17275 ::fidl_next::WireEnvelope::encode_value(
17276 source,
17277 preallocated.encoder,
17278 &mut out,
17279 )?;
17280 } else {
17281 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17282 }
17283 }
17284
17285 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
17286 }
17287 unsafe {
17288 preallocated.write_next(out.assume_init_ref());
17289 }
17290 }
17291
17292 ::fidl_next::WireTable::encode_len(table, max_ord);
17293
17294 Ok(())
17295 }
17296}
17297
17298impl<'de> ::fidl_next::FromWire<WireExposeProtocol<'de>> for ExposeProtocol {
17299 #[inline]
17300 fn from_wire(wire: WireExposeProtocol<'de>) -> Self {
17301 let wire = ::core::mem::ManuallyDrop::new(wire);
17302
17303 let source = wire.table.get(1);
17304
17305 let source_name = wire.table.get(2);
17306
17307 let target = wire.table.get(3);
17308
17309 let target_name = wire.table.get(4);
17310
17311 let availability = wire.table.get(5);
17312
17313 let source_dictionary = wire.table.get(6);
17314
17315 Self {
17316 source: source.map(|envelope| {
17317 ::fidl_next::FromWire::from_wire(unsafe {
17318 envelope.read_unchecked::<crate::WireRef<'de>>()
17319 })
17320 }),
17321
17322 source_name: source_name.map(|envelope| {
17323 ::fidl_next::FromWire::from_wire(unsafe {
17324 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
17325 })
17326 }),
17327
17328 target: target.map(|envelope| {
17329 ::fidl_next::FromWire::from_wire(unsafe {
17330 envelope.read_unchecked::<crate::WireRef<'de>>()
17331 })
17332 }),
17333
17334 target_name: target_name.map(|envelope| {
17335 ::fidl_next::FromWire::from_wire(unsafe {
17336 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
17337 })
17338 }),
17339
17340 availability: availability.map(|envelope| {
17341 ::fidl_next::FromWire::from_wire(unsafe {
17342 envelope.read_unchecked::<crate::WireAvailability>()
17343 })
17344 }),
17345
17346 source_dictionary: source_dictionary.map(|envelope| {
17347 ::fidl_next::FromWire::from_wire(unsafe {
17348 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
17349 })
17350 }),
17351 }
17352 }
17353}
17354
17355impl<'de> ::fidl_next::FromWireRef<WireExposeProtocol<'de>> for ExposeProtocol {
17356 #[inline]
17357 fn from_wire_ref(wire: &WireExposeProtocol<'de>) -> Self {
17358 Self {
17359 source: wire.table.get(1).map(|envelope| {
17360 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
17361 envelope.deref_unchecked::<crate::WireRef<'de>>()
17362 })
17363 }),
17364
17365 source_name: wire.table.get(2).map(|envelope| {
17366 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
17367 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
17368 })
17369 }),
17370
17371 target: wire.table.get(3).map(|envelope| {
17372 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
17373 envelope.deref_unchecked::<crate::WireRef<'de>>()
17374 })
17375 }),
17376
17377 target_name: wire.table.get(4).map(|envelope| {
17378 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
17379 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
17380 })
17381 }),
17382
17383 availability: wire.table.get(5).map(|envelope| {
17384 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
17385 envelope.deref_unchecked::<crate::WireAvailability>()
17386 })
17387 }),
17388
17389 source_dictionary: wire.table.get(6).map(|envelope| {
17390 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
17391 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
17392 })
17393 }),
17394 }
17395 }
17396}
17397
17398#[repr(C)]
17400pub struct WireExposeProtocol<'de> {
17401 table: ::fidl_next::WireTable<'de>,
17402}
17403
17404impl<'de> Drop for WireExposeProtocol<'de> {
17405 fn drop(&mut self) {
17406 let _ = self
17407 .table
17408 .get(1)
17409 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
17410
17411 let _ = self
17412 .table
17413 .get(2)
17414 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
17415
17416 let _ = self
17417 .table
17418 .get(3)
17419 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
17420
17421 let _ = self
17422 .table
17423 .get(4)
17424 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
17425
17426 let _ = self
17427 .table
17428 .get(5)
17429 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
17430
17431 let _ = self
17432 .table
17433 .get(6)
17434 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
17435 }
17436}
17437
17438unsafe impl ::fidl_next::Wire for WireExposeProtocol<'static> {
17439 type Decoded<'de> = WireExposeProtocol<'de>;
17440
17441 #[inline]
17442 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
17443 ::fidl_next::munge!(let Self { table } = out);
17444 ::fidl_next::WireTable::zero_padding(table);
17445 }
17446}
17447
17448unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeProtocol<'static>
17449where
17450 ___D: ::fidl_next::Decoder + ?Sized,
17451{
17452 fn decode(
17453 slot: ::fidl_next::Slot<'_, Self>,
17454 decoder: &mut ___D,
17455 ) -> Result<(), ::fidl_next::DecodeError> {
17456 ::fidl_next::munge!(let Self { table } = slot);
17457
17458 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
17459 match ordinal {
17460 0 => unsafe { ::core::hint::unreachable_unchecked() },
17461
17462 1 => {
17463 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
17464 slot.as_mut(),
17465 decoder,
17466 )?;
17467
17468 Ok(())
17469 }
17470
17471 2 => {
17472 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
17473 slot.as_mut(),
17474 decoder,
17475 )?;
17476
17477 let source_name = unsafe {
17478 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
17479 };
17480
17481 if source_name.len() > 100 {
17482 return Err(::fidl_next::DecodeError::VectorTooLong {
17483 size: source_name.len() as u64,
17484 limit: 100,
17485 });
17486 }
17487
17488 Ok(())
17489 }
17490
17491 3 => {
17492 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
17493 slot.as_mut(),
17494 decoder,
17495 )?;
17496
17497 Ok(())
17498 }
17499
17500 4 => {
17501 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
17502 slot.as_mut(),
17503 decoder,
17504 )?;
17505
17506 let target_name = unsafe {
17507 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
17508 };
17509
17510 if target_name.len() > 100 {
17511 return Err(::fidl_next::DecodeError::VectorTooLong {
17512 size: target_name.len() as u64,
17513 limit: 100,
17514 });
17515 }
17516
17517 Ok(())
17518 }
17519
17520 5 => {
17521 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
17522 slot.as_mut(),
17523 decoder,
17524 )?;
17525
17526 Ok(())
17527 }
17528
17529 6 => {
17530 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
17531 slot.as_mut(),
17532 decoder,
17533 )?;
17534
17535 let source_dictionary = unsafe {
17536 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
17537 };
17538
17539 if source_dictionary.len() > 1024 {
17540 return Err(::fidl_next::DecodeError::VectorTooLong {
17541 size: source_dictionary.len() as u64,
17542 limit: 1024,
17543 });
17544 }
17545
17546 Ok(())
17547 }
17548
17549 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
17550 }
17551 })
17552 }
17553}
17554
17555impl<'de> WireExposeProtocol<'de> {
17556 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
17557 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
17558 }
17559
17560 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
17561 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
17562 }
17563
17564 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
17565 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
17566 }
17567
17568 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
17569 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
17570 }
17571
17572 pub fn availability(&self) -> Option<&crate::WireAvailability> {
17573 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
17574 }
17575
17576 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
17577 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
17578 }
17579}
17580
17581impl<'de> ::core::fmt::Debug for WireExposeProtocol<'de> {
17582 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
17583 f.debug_struct("ExposeProtocol")
17584 .field("source", &self.source())
17585 .field("source_name", &self.source_name())
17586 .field("target", &self.target())
17587 .field("target_name", &self.target_name())
17588 .field("availability", &self.availability())
17589 .field("source_dictionary", &self.source_dictionary())
17590 .finish()
17591 }
17592}
17593
17594#[doc = " Declares a directory exposed to a component\'s containing realm, such as a\n directory exposed by the component or one of its children at runtime.\n"]
17595#[derive(Clone, Debug, Default)]
17596pub struct ExposeDirectory {
17597 pub source: Option<crate::Ref>,
17598
17599 pub source_name: Option<String>,
17600
17601 pub target: Option<crate::Ref>,
17602
17603 pub target_name: Option<String>,
17604
17605 pub rights: Option<::fidl_next_fuchsia_io::Operations>,
17606
17607 pub subdir: Option<String>,
17608
17609 pub availability: Option<crate::Availability>,
17610
17611 pub source_dictionary: Option<String>,
17612}
17613
17614impl ExposeDirectory {
17615 fn __max_ordinal(&self) -> usize {
17616 if self.source_dictionary.is_some() {
17617 return 8;
17618 }
17619
17620 if self.availability.is_some() {
17621 return 7;
17622 }
17623
17624 if self.subdir.is_some() {
17625 return 6;
17626 }
17627
17628 if self.rights.is_some() {
17629 return 5;
17630 }
17631
17632 if self.target_name.is_some() {
17633 return 4;
17634 }
17635
17636 if self.target.is_some() {
17637 return 3;
17638 }
17639
17640 if self.source_name.is_some() {
17641 return 2;
17642 }
17643
17644 if self.source.is_some() {
17645 return 1;
17646 }
17647
17648 0
17649 }
17650}
17651
17652impl ::fidl_next::Encodable for ExposeDirectory {
17653 type Encoded = WireExposeDirectory<'static>;
17654}
17655
17656unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeDirectory
17657where
17658 ___E: ::fidl_next::Encoder + ?Sized,
17659{
17660 #[inline]
17661 fn encode(
17662 mut self,
17663 encoder: &mut ___E,
17664 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
17665 ) -> Result<(), ::fidl_next::EncodeError> {
17666 ::fidl_next::munge!(let WireExposeDirectory { table } = out);
17667
17668 let max_ord = self.__max_ordinal();
17669
17670 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
17671 ::fidl_next::Wire::zero_padding(&mut out);
17672
17673 let mut preallocated =
17674 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
17675
17676 for i in 1..=max_ord {
17677 match i {
17678 8 => {
17679 if let Some(source_dictionary) = self.source_dictionary.take() {
17680 ::fidl_next::WireEnvelope::encode_value(
17681 source_dictionary,
17682 preallocated.encoder,
17683 &mut out,
17684 )?;
17685 } else {
17686 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17687 }
17688 }
17689
17690 7 => {
17691 if let Some(availability) = self.availability.take() {
17692 ::fidl_next::WireEnvelope::encode_value(
17693 availability,
17694 preallocated.encoder,
17695 &mut out,
17696 )?;
17697 } else {
17698 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17699 }
17700 }
17701
17702 6 => {
17703 if let Some(subdir) = self.subdir.take() {
17704 ::fidl_next::WireEnvelope::encode_value(
17705 subdir,
17706 preallocated.encoder,
17707 &mut out,
17708 )?;
17709 } else {
17710 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17711 }
17712 }
17713
17714 5 => {
17715 if let Some(rights) = self.rights.take() {
17716 ::fidl_next::WireEnvelope::encode_value(
17717 rights,
17718 preallocated.encoder,
17719 &mut out,
17720 )?;
17721 } else {
17722 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17723 }
17724 }
17725
17726 4 => {
17727 if let Some(target_name) = self.target_name.take() {
17728 ::fidl_next::WireEnvelope::encode_value(
17729 target_name,
17730 preallocated.encoder,
17731 &mut out,
17732 )?;
17733 } else {
17734 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17735 }
17736 }
17737
17738 3 => {
17739 if let Some(target) = self.target.take() {
17740 ::fidl_next::WireEnvelope::encode_value(
17741 target,
17742 preallocated.encoder,
17743 &mut out,
17744 )?;
17745 } else {
17746 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17747 }
17748 }
17749
17750 2 => {
17751 if let Some(source_name) = self.source_name.take() {
17752 ::fidl_next::WireEnvelope::encode_value(
17753 source_name,
17754 preallocated.encoder,
17755 &mut out,
17756 )?;
17757 } else {
17758 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17759 }
17760 }
17761
17762 1 => {
17763 if let Some(source) = self.source.take() {
17764 ::fidl_next::WireEnvelope::encode_value(
17765 source,
17766 preallocated.encoder,
17767 &mut out,
17768 )?;
17769 } else {
17770 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17771 }
17772 }
17773
17774 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
17775 }
17776 unsafe {
17777 preallocated.write_next(out.assume_init_ref());
17778 }
17779 }
17780
17781 ::fidl_next::WireTable::encode_len(table, max_ord);
17782
17783 Ok(())
17784 }
17785}
17786
17787unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeDirectory
17788where
17789 ___E: ::fidl_next::Encoder + ?Sized,
17790{
17791 #[inline]
17792 fn encode_ref(
17793 &self,
17794 encoder: &mut ___E,
17795 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
17796 ) -> Result<(), ::fidl_next::EncodeError> {
17797 ::fidl_next::munge!(let WireExposeDirectory { table } = out);
17798
17799 let max_ord = self.__max_ordinal();
17800
17801 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
17802 ::fidl_next::Wire::zero_padding(&mut out);
17803
17804 let mut preallocated =
17805 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
17806
17807 for i in 1..=max_ord {
17808 match i {
17809 8 => {
17810 if let Some(source_dictionary) = &self.source_dictionary {
17811 ::fidl_next::WireEnvelope::encode_value(
17812 source_dictionary,
17813 preallocated.encoder,
17814 &mut out,
17815 )?;
17816 } else {
17817 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17818 }
17819 }
17820
17821 7 => {
17822 if let Some(availability) = &self.availability {
17823 ::fidl_next::WireEnvelope::encode_value(
17824 availability,
17825 preallocated.encoder,
17826 &mut out,
17827 )?;
17828 } else {
17829 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17830 }
17831 }
17832
17833 6 => {
17834 if let Some(subdir) = &self.subdir {
17835 ::fidl_next::WireEnvelope::encode_value(
17836 subdir,
17837 preallocated.encoder,
17838 &mut out,
17839 )?;
17840 } else {
17841 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17842 }
17843 }
17844
17845 5 => {
17846 if let Some(rights) = &self.rights {
17847 ::fidl_next::WireEnvelope::encode_value(
17848 rights,
17849 preallocated.encoder,
17850 &mut out,
17851 )?;
17852 } else {
17853 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17854 }
17855 }
17856
17857 4 => {
17858 if let Some(target_name) = &self.target_name {
17859 ::fidl_next::WireEnvelope::encode_value(
17860 target_name,
17861 preallocated.encoder,
17862 &mut out,
17863 )?;
17864 } else {
17865 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17866 }
17867 }
17868
17869 3 => {
17870 if let Some(target) = &self.target {
17871 ::fidl_next::WireEnvelope::encode_value(
17872 target,
17873 preallocated.encoder,
17874 &mut out,
17875 )?;
17876 } else {
17877 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17878 }
17879 }
17880
17881 2 => {
17882 if let Some(source_name) = &self.source_name {
17883 ::fidl_next::WireEnvelope::encode_value(
17884 source_name,
17885 preallocated.encoder,
17886 &mut out,
17887 )?;
17888 } else {
17889 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17890 }
17891 }
17892
17893 1 => {
17894 if let Some(source) = &self.source {
17895 ::fidl_next::WireEnvelope::encode_value(
17896 source,
17897 preallocated.encoder,
17898 &mut out,
17899 )?;
17900 } else {
17901 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17902 }
17903 }
17904
17905 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
17906 }
17907 unsafe {
17908 preallocated.write_next(out.assume_init_ref());
17909 }
17910 }
17911
17912 ::fidl_next::WireTable::encode_len(table, max_ord);
17913
17914 Ok(())
17915 }
17916}
17917
17918impl<'de> ::fidl_next::FromWire<WireExposeDirectory<'de>> for ExposeDirectory {
17919 #[inline]
17920 fn from_wire(wire: WireExposeDirectory<'de>) -> Self {
17921 let wire = ::core::mem::ManuallyDrop::new(wire);
17922
17923 let source = wire.table.get(1);
17924
17925 let source_name = wire.table.get(2);
17926
17927 let target = wire.table.get(3);
17928
17929 let target_name = wire.table.get(4);
17930
17931 let rights = wire.table.get(5);
17932
17933 let subdir = wire.table.get(6);
17934
17935 let availability = wire.table.get(7);
17936
17937 let source_dictionary = wire.table.get(8);
17938
17939 Self {
17940 source: source.map(|envelope| {
17941 ::fidl_next::FromWire::from_wire(unsafe {
17942 envelope.read_unchecked::<crate::WireRef<'de>>()
17943 })
17944 }),
17945
17946 source_name: source_name.map(|envelope| {
17947 ::fidl_next::FromWire::from_wire(unsafe {
17948 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
17949 })
17950 }),
17951
17952 target: target.map(|envelope| {
17953 ::fidl_next::FromWire::from_wire(unsafe {
17954 envelope.read_unchecked::<crate::WireRef<'de>>()
17955 })
17956 }),
17957
17958 target_name: target_name.map(|envelope| {
17959 ::fidl_next::FromWire::from_wire(unsafe {
17960 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
17961 })
17962 }),
17963
17964 rights: rights.map(|envelope| {
17965 ::fidl_next::FromWire::from_wire(unsafe {
17966 envelope.read_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
17967 })
17968 }),
17969
17970 subdir: subdir.map(|envelope| {
17971 ::fidl_next::FromWire::from_wire(unsafe {
17972 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
17973 })
17974 }),
17975
17976 availability: availability.map(|envelope| {
17977 ::fidl_next::FromWire::from_wire(unsafe {
17978 envelope.read_unchecked::<crate::WireAvailability>()
17979 })
17980 }),
17981
17982 source_dictionary: source_dictionary.map(|envelope| {
17983 ::fidl_next::FromWire::from_wire(unsafe {
17984 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
17985 })
17986 }),
17987 }
17988 }
17989}
17990
17991impl<'de> ::fidl_next::FromWireRef<WireExposeDirectory<'de>> for ExposeDirectory {
17992 #[inline]
17993 fn from_wire_ref(wire: &WireExposeDirectory<'de>) -> Self {
17994 Self {
17995 source: wire.table.get(1).map(|envelope| {
17996 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
17997 envelope.deref_unchecked::<crate::WireRef<'de>>()
17998 })
17999 }),
18000
18001 source_name: wire.table.get(2).map(|envelope| {
18002 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18003 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
18004 })
18005 }),
18006
18007 target: wire.table.get(3).map(|envelope| {
18008 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18009 envelope.deref_unchecked::<crate::WireRef<'de>>()
18010 })
18011 }),
18012
18013 target_name: wire.table.get(4).map(|envelope| {
18014 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18015 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
18016 })
18017 }),
18018
18019 rights: wire.table.get(5).map(|envelope| {
18020 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18021 envelope.deref_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
18022 })
18023 }),
18024
18025 subdir: wire.table.get(6).map(|envelope| {
18026 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18027 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
18028 })
18029 }),
18030
18031 availability: wire.table.get(7).map(|envelope| {
18032 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18033 envelope.deref_unchecked::<crate::WireAvailability>()
18034 })
18035 }),
18036
18037 source_dictionary: wire.table.get(8).map(|envelope| {
18038 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18039 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
18040 })
18041 }),
18042 }
18043 }
18044}
18045
18046#[repr(C)]
18048pub struct WireExposeDirectory<'de> {
18049 table: ::fidl_next::WireTable<'de>,
18050}
18051
18052impl<'de> Drop for WireExposeDirectory<'de> {
18053 fn drop(&mut self) {
18054 let _ = self
18055 .table
18056 .get(1)
18057 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
18058
18059 let _ = self
18060 .table
18061 .get(2)
18062 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
18063
18064 let _ = self
18065 .table
18066 .get(3)
18067 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
18068
18069 let _ = self
18070 .table
18071 .get(4)
18072 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
18073
18074 let _ = self.table.get(5).map(|envelope| unsafe {
18075 envelope.read_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
18076 });
18077
18078 let _ = self
18079 .table
18080 .get(6)
18081 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
18082
18083 let _ = self
18084 .table
18085 .get(7)
18086 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
18087
18088 let _ = self
18089 .table
18090 .get(8)
18091 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
18092 }
18093}
18094
18095unsafe impl ::fidl_next::Wire for WireExposeDirectory<'static> {
18096 type Decoded<'de> = WireExposeDirectory<'de>;
18097
18098 #[inline]
18099 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
18100 ::fidl_next::munge!(let Self { table } = out);
18101 ::fidl_next::WireTable::zero_padding(table);
18102 }
18103}
18104
18105unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeDirectory<'static>
18106where
18107 ___D: ::fidl_next::Decoder + ?Sized,
18108{
18109 fn decode(
18110 slot: ::fidl_next::Slot<'_, Self>,
18111 decoder: &mut ___D,
18112 ) -> Result<(), ::fidl_next::DecodeError> {
18113 ::fidl_next::munge!(let Self { table } = slot);
18114
18115 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
18116 match ordinal {
18117 0 => unsafe { ::core::hint::unreachable_unchecked() },
18118
18119 1 => {
18120 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
18121 slot.as_mut(),
18122 decoder,
18123 )?;
18124
18125 Ok(())
18126 }
18127
18128 2 => {
18129 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
18130 slot.as_mut(),
18131 decoder,
18132 )?;
18133
18134 let source_name = unsafe {
18135 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
18136 };
18137
18138 if source_name.len() > 100 {
18139 return Err(::fidl_next::DecodeError::VectorTooLong {
18140 size: source_name.len() as u64,
18141 limit: 100,
18142 });
18143 }
18144
18145 Ok(())
18146 }
18147
18148 3 => {
18149 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
18150 slot.as_mut(),
18151 decoder,
18152 )?;
18153
18154 Ok(())
18155 }
18156
18157 4 => {
18158 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
18159 slot.as_mut(),
18160 decoder,
18161 )?;
18162
18163 let target_name = unsafe {
18164 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
18165 };
18166
18167 if target_name.len() > 100 {
18168 return Err(::fidl_next::DecodeError::VectorTooLong {
18169 size: target_name.len() as u64,
18170 limit: 100,
18171 });
18172 }
18173
18174 Ok(())
18175 }
18176
18177 5 => {
18178 ::fidl_next::WireEnvelope::decode_as::<
18179 ___D,
18180 ::fidl_next_fuchsia_io::WireOperations,
18181 >(slot.as_mut(), decoder)?;
18182
18183 Ok(())
18184 }
18185
18186 6 => {
18187 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
18188 slot.as_mut(),
18189 decoder,
18190 )?;
18191
18192 let subdir = unsafe {
18193 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
18194 };
18195
18196 if subdir.len() > 1024 {
18197 return Err(::fidl_next::DecodeError::VectorTooLong {
18198 size: subdir.len() as u64,
18199 limit: 1024,
18200 });
18201 }
18202
18203 Ok(())
18204 }
18205
18206 7 => {
18207 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
18208 slot.as_mut(),
18209 decoder,
18210 )?;
18211
18212 Ok(())
18213 }
18214
18215 8 => {
18216 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
18217 slot.as_mut(),
18218 decoder,
18219 )?;
18220
18221 let source_dictionary = unsafe {
18222 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
18223 };
18224
18225 if source_dictionary.len() > 1024 {
18226 return Err(::fidl_next::DecodeError::VectorTooLong {
18227 size: source_dictionary.len() as u64,
18228 limit: 1024,
18229 });
18230 }
18231
18232 Ok(())
18233 }
18234
18235 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
18236 }
18237 })
18238 }
18239}
18240
18241impl<'de> WireExposeDirectory<'de> {
18242 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
18243 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
18244 }
18245
18246 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
18247 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
18248 }
18249
18250 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
18251 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
18252 }
18253
18254 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
18255 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
18256 }
18257
18258 pub fn rights(&self) -> Option<&::fidl_next_fuchsia_io::WireOperations> {
18259 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
18260 }
18261
18262 pub fn subdir(&self) -> Option<&::fidl_next::WireString<'de>> {
18263 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
18264 }
18265
18266 pub fn availability(&self) -> Option<&crate::WireAvailability> {
18267 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
18268 }
18269
18270 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
18271 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
18272 }
18273}
18274
18275impl<'de> ::core::fmt::Debug for WireExposeDirectory<'de> {
18276 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
18277 f.debug_struct("ExposeDirectory")
18278 .field("source", &self.source())
18279 .field("source_name", &self.source_name())
18280 .field("target", &self.target())
18281 .field("target_name", &self.target_name())
18282 .field("rights", &self.rights())
18283 .field("subdir", &self.subdir())
18284 .field("availability", &self.availability())
18285 .field("source_dictionary", &self.source_dictionary())
18286 .finish()
18287 }
18288}
18289
18290#[doc = " Declares a runner exposed to a component\'s containing realm, such as a\n runner exposed by the component or one of its children at runtime.\n"]
18291#[derive(Clone, Debug, Default)]
18292pub struct ExposeRunner {
18293 pub source: Option<crate::Ref>,
18294
18295 pub source_name: Option<String>,
18296
18297 pub target: Option<crate::Ref>,
18298
18299 pub target_name: Option<String>,
18300
18301 pub source_dictionary: Option<String>,
18302}
18303
18304impl ExposeRunner {
18305 fn __max_ordinal(&self) -> usize {
18306 if self.source_dictionary.is_some() {
18307 return 6;
18308 }
18309
18310 if self.target_name.is_some() {
18311 return 4;
18312 }
18313
18314 if self.target.is_some() {
18315 return 3;
18316 }
18317
18318 if self.source_name.is_some() {
18319 return 2;
18320 }
18321
18322 if self.source.is_some() {
18323 return 1;
18324 }
18325
18326 0
18327 }
18328}
18329
18330impl ::fidl_next::Encodable for ExposeRunner {
18331 type Encoded = WireExposeRunner<'static>;
18332}
18333
18334unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeRunner
18335where
18336 ___E: ::fidl_next::Encoder + ?Sized,
18337{
18338 #[inline]
18339 fn encode(
18340 mut self,
18341 encoder: &mut ___E,
18342 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
18343 ) -> Result<(), ::fidl_next::EncodeError> {
18344 ::fidl_next::munge!(let WireExposeRunner { table } = out);
18345
18346 let max_ord = self.__max_ordinal();
18347
18348 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
18349 ::fidl_next::Wire::zero_padding(&mut out);
18350
18351 let mut preallocated =
18352 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
18353
18354 for i in 1..=max_ord {
18355 match i {
18356 6 => {
18357 if let Some(source_dictionary) = self.source_dictionary.take() {
18358 ::fidl_next::WireEnvelope::encode_value(
18359 source_dictionary,
18360 preallocated.encoder,
18361 &mut out,
18362 )?;
18363 } else {
18364 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18365 }
18366 }
18367
18368 4 => {
18369 if let Some(target_name) = self.target_name.take() {
18370 ::fidl_next::WireEnvelope::encode_value(
18371 target_name,
18372 preallocated.encoder,
18373 &mut out,
18374 )?;
18375 } else {
18376 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18377 }
18378 }
18379
18380 3 => {
18381 if let Some(target) = self.target.take() {
18382 ::fidl_next::WireEnvelope::encode_value(
18383 target,
18384 preallocated.encoder,
18385 &mut out,
18386 )?;
18387 } else {
18388 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18389 }
18390 }
18391
18392 2 => {
18393 if let Some(source_name) = self.source_name.take() {
18394 ::fidl_next::WireEnvelope::encode_value(
18395 source_name,
18396 preallocated.encoder,
18397 &mut out,
18398 )?;
18399 } else {
18400 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18401 }
18402 }
18403
18404 1 => {
18405 if let Some(source) = self.source.take() {
18406 ::fidl_next::WireEnvelope::encode_value(
18407 source,
18408 preallocated.encoder,
18409 &mut out,
18410 )?;
18411 } else {
18412 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18413 }
18414 }
18415
18416 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
18417 }
18418 unsafe {
18419 preallocated.write_next(out.assume_init_ref());
18420 }
18421 }
18422
18423 ::fidl_next::WireTable::encode_len(table, max_ord);
18424
18425 Ok(())
18426 }
18427}
18428
18429unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeRunner
18430where
18431 ___E: ::fidl_next::Encoder + ?Sized,
18432{
18433 #[inline]
18434 fn encode_ref(
18435 &self,
18436 encoder: &mut ___E,
18437 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
18438 ) -> Result<(), ::fidl_next::EncodeError> {
18439 ::fidl_next::munge!(let WireExposeRunner { table } = out);
18440
18441 let max_ord = self.__max_ordinal();
18442
18443 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
18444 ::fidl_next::Wire::zero_padding(&mut out);
18445
18446 let mut preallocated =
18447 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
18448
18449 for i in 1..=max_ord {
18450 match i {
18451 6 => {
18452 if let Some(source_dictionary) = &self.source_dictionary {
18453 ::fidl_next::WireEnvelope::encode_value(
18454 source_dictionary,
18455 preallocated.encoder,
18456 &mut out,
18457 )?;
18458 } else {
18459 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18460 }
18461 }
18462
18463 4 => {
18464 if let Some(target_name) = &self.target_name {
18465 ::fidl_next::WireEnvelope::encode_value(
18466 target_name,
18467 preallocated.encoder,
18468 &mut out,
18469 )?;
18470 } else {
18471 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18472 }
18473 }
18474
18475 3 => {
18476 if let Some(target) = &self.target {
18477 ::fidl_next::WireEnvelope::encode_value(
18478 target,
18479 preallocated.encoder,
18480 &mut out,
18481 )?;
18482 } else {
18483 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18484 }
18485 }
18486
18487 2 => {
18488 if let Some(source_name) = &self.source_name {
18489 ::fidl_next::WireEnvelope::encode_value(
18490 source_name,
18491 preallocated.encoder,
18492 &mut out,
18493 )?;
18494 } else {
18495 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18496 }
18497 }
18498
18499 1 => {
18500 if let Some(source) = &self.source {
18501 ::fidl_next::WireEnvelope::encode_value(
18502 source,
18503 preallocated.encoder,
18504 &mut out,
18505 )?;
18506 } else {
18507 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18508 }
18509 }
18510
18511 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
18512 }
18513 unsafe {
18514 preallocated.write_next(out.assume_init_ref());
18515 }
18516 }
18517
18518 ::fidl_next::WireTable::encode_len(table, max_ord);
18519
18520 Ok(())
18521 }
18522}
18523
18524impl<'de> ::fidl_next::FromWire<WireExposeRunner<'de>> for ExposeRunner {
18525 #[inline]
18526 fn from_wire(wire: WireExposeRunner<'de>) -> Self {
18527 let wire = ::core::mem::ManuallyDrop::new(wire);
18528
18529 let source = wire.table.get(1);
18530
18531 let source_name = wire.table.get(2);
18532
18533 let target = wire.table.get(3);
18534
18535 let target_name = wire.table.get(4);
18536
18537 let source_dictionary = wire.table.get(6);
18538
18539 Self {
18540 source: source.map(|envelope| {
18541 ::fidl_next::FromWire::from_wire(unsafe {
18542 envelope.read_unchecked::<crate::WireRef<'de>>()
18543 })
18544 }),
18545
18546 source_name: source_name.map(|envelope| {
18547 ::fidl_next::FromWire::from_wire(unsafe {
18548 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
18549 })
18550 }),
18551
18552 target: target.map(|envelope| {
18553 ::fidl_next::FromWire::from_wire(unsafe {
18554 envelope.read_unchecked::<crate::WireRef<'de>>()
18555 })
18556 }),
18557
18558 target_name: target_name.map(|envelope| {
18559 ::fidl_next::FromWire::from_wire(unsafe {
18560 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
18561 })
18562 }),
18563
18564 source_dictionary: source_dictionary.map(|envelope| {
18565 ::fidl_next::FromWire::from_wire(unsafe {
18566 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
18567 })
18568 }),
18569 }
18570 }
18571}
18572
18573impl<'de> ::fidl_next::FromWireRef<WireExposeRunner<'de>> for ExposeRunner {
18574 #[inline]
18575 fn from_wire_ref(wire: &WireExposeRunner<'de>) -> Self {
18576 Self {
18577 source: wire.table.get(1).map(|envelope| {
18578 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18579 envelope.deref_unchecked::<crate::WireRef<'de>>()
18580 })
18581 }),
18582
18583 source_name: wire.table.get(2).map(|envelope| {
18584 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18585 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
18586 })
18587 }),
18588
18589 target: wire.table.get(3).map(|envelope| {
18590 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18591 envelope.deref_unchecked::<crate::WireRef<'de>>()
18592 })
18593 }),
18594
18595 target_name: wire.table.get(4).map(|envelope| {
18596 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18597 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
18598 })
18599 }),
18600
18601 source_dictionary: wire.table.get(6).map(|envelope| {
18602 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
18603 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
18604 })
18605 }),
18606 }
18607 }
18608}
18609
18610#[repr(C)]
18612pub struct WireExposeRunner<'de> {
18613 table: ::fidl_next::WireTable<'de>,
18614}
18615
18616impl<'de> Drop for WireExposeRunner<'de> {
18617 fn drop(&mut self) {
18618 let _ = self
18619 .table
18620 .get(1)
18621 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
18622
18623 let _ = self
18624 .table
18625 .get(2)
18626 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
18627
18628 let _ = self
18629 .table
18630 .get(3)
18631 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
18632
18633 let _ = self
18634 .table
18635 .get(4)
18636 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
18637
18638 let _ = self
18639 .table
18640 .get(6)
18641 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
18642 }
18643}
18644
18645unsafe impl ::fidl_next::Wire for WireExposeRunner<'static> {
18646 type Decoded<'de> = WireExposeRunner<'de>;
18647
18648 #[inline]
18649 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
18650 ::fidl_next::munge!(let Self { table } = out);
18651 ::fidl_next::WireTable::zero_padding(table);
18652 }
18653}
18654
18655unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeRunner<'static>
18656where
18657 ___D: ::fidl_next::Decoder + ?Sized,
18658{
18659 fn decode(
18660 slot: ::fidl_next::Slot<'_, Self>,
18661 decoder: &mut ___D,
18662 ) -> Result<(), ::fidl_next::DecodeError> {
18663 ::fidl_next::munge!(let Self { table } = slot);
18664
18665 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
18666 match ordinal {
18667 0 => unsafe { ::core::hint::unreachable_unchecked() },
18668
18669 1 => {
18670 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
18671 slot.as_mut(),
18672 decoder,
18673 )?;
18674
18675 Ok(())
18676 }
18677
18678 2 => {
18679 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
18680 slot.as_mut(),
18681 decoder,
18682 )?;
18683
18684 let source_name = unsafe {
18685 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
18686 };
18687
18688 if source_name.len() > 100 {
18689 return Err(::fidl_next::DecodeError::VectorTooLong {
18690 size: source_name.len() as u64,
18691 limit: 100,
18692 });
18693 }
18694
18695 Ok(())
18696 }
18697
18698 3 => {
18699 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
18700 slot.as_mut(),
18701 decoder,
18702 )?;
18703
18704 Ok(())
18705 }
18706
18707 4 => {
18708 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
18709 slot.as_mut(),
18710 decoder,
18711 )?;
18712
18713 let target_name = unsafe {
18714 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
18715 };
18716
18717 if target_name.len() > 100 {
18718 return Err(::fidl_next::DecodeError::VectorTooLong {
18719 size: target_name.len() as u64,
18720 limit: 100,
18721 });
18722 }
18723
18724 Ok(())
18725 }
18726
18727 6 => {
18728 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
18729 slot.as_mut(),
18730 decoder,
18731 )?;
18732
18733 let source_dictionary = unsafe {
18734 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
18735 };
18736
18737 if source_dictionary.len() > 1024 {
18738 return Err(::fidl_next::DecodeError::VectorTooLong {
18739 size: source_dictionary.len() as u64,
18740 limit: 1024,
18741 });
18742 }
18743
18744 Ok(())
18745 }
18746
18747 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
18748 }
18749 })
18750 }
18751}
18752
18753impl<'de> WireExposeRunner<'de> {
18754 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
18755 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
18756 }
18757
18758 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
18759 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
18760 }
18761
18762 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
18763 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
18764 }
18765
18766 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
18767 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
18768 }
18769
18770 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
18771 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
18772 }
18773}
18774
18775impl<'de> ::core::fmt::Debug for WireExposeRunner<'de> {
18776 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
18777 f.debug_struct("ExposeRunner")
18778 .field("source", &self.source())
18779 .field("source_name", &self.source_name())
18780 .field("target", &self.target())
18781 .field("target_name", &self.target_name())
18782 .field("source_dictionary", &self.source_dictionary())
18783 .finish()
18784 }
18785}
18786
18787#[doc = " Declares a resolver exposed to a component\'s containing realm, such as a\n resolver exposed by the component or one of its children at runtime.\n"]
18788#[derive(Clone, Debug, Default)]
18789pub struct ExposeResolver {
18790 pub source: Option<crate::Ref>,
18791
18792 pub source_name: Option<String>,
18793
18794 pub target: Option<crate::Ref>,
18795
18796 pub target_name: Option<String>,
18797
18798 pub source_dictionary: Option<String>,
18799}
18800
18801impl ExposeResolver {
18802 fn __max_ordinal(&self) -> usize {
18803 if self.source_dictionary.is_some() {
18804 return 6;
18805 }
18806
18807 if self.target_name.is_some() {
18808 return 4;
18809 }
18810
18811 if self.target.is_some() {
18812 return 3;
18813 }
18814
18815 if self.source_name.is_some() {
18816 return 2;
18817 }
18818
18819 if self.source.is_some() {
18820 return 1;
18821 }
18822
18823 0
18824 }
18825}
18826
18827impl ::fidl_next::Encodable for ExposeResolver {
18828 type Encoded = WireExposeResolver<'static>;
18829}
18830
18831unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeResolver
18832where
18833 ___E: ::fidl_next::Encoder + ?Sized,
18834{
18835 #[inline]
18836 fn encode(
18837 mut self,
18838 encoder: &mut ___E,
18839 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
18840 ) -> Result<(), ::fidl_next::EncodeError> {
18841 ::fidl_next::munge!(let WireExposeResolver { table } = out);
18842
18843 let max_ord = self.__max_ordinal();
18844
18845 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
18846 ::fidl_next::Wire::zero_padding(&mut out);
18847
18848 let mut preallocated =
18849 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
18850
18851 for i in 1..=max_ord {
18852 match i {
18853 6 => {
18854 if let Some(source_dictionary) = self.source_dictionary.take() {
18855 ::fidl_next::WireEnvelope::encode_value(
18856 source_dictionary,
18857 preallocated.encoder,
18858 &mut out,
18859 )?;
18860 } else {
18861 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18862 }
18863 }
18864
18865 4 => {
18866 if let Some(target_name) = self.target_name.take() {
18867 ::fidl_next::WireEnvelope::encode_value(
18868 target_name,
18869 preallocated.encoder,
18870 &mut out,
18871 )?;
18872 } else {
18873 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18874 }
18875 }
18876
18877 3 => {
18878 if let Some(target) = self.target.take() {
18879 ::fidl_next::WireEnvelope::encode_value(
18880 target,
18881 preallocated.encoder,
18882 &mut out,
18883 )?;
18884 } else {
18885 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18886 }
18887 }
18888
18889 2 => {
18890 if let Some(source_name) = self.source_name.take() {
18891 ::fidl_next::WireEnvelope::encode_value(
18892 source_name,
18893 preallocated.encoder,
18894 &mut out,
18895 )?;
18896 } else {
18897 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18898 }
18899 }
18900
18901 1 => {
18902 if let Some(source) = self.source.take() {
18903 ::fidl_next::WireEnvelope::encode_value(
18904 source,
18905 preallocated.encoder,
18906 &mut out,
18907 )?;
18908 } else {
18909 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18910 }
18911 }
18912
18913 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
18914 }
18915 unsafe {
18916 preallocated.write_next(out.assume_init_ref());
18917 }
18918 }
18919
18920 ::fidl_next::WireTable::encode_len(table, max_ord);
18921
18922 Ok(())
18923 }
18924}
18925
18926unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeResolver
18927where
18928 ___E: ::fidl_next::Encoder + ?Sized,
18929{
18930 #[inline]
18931 fn encode_ref(
18932 &self,
18933 encoder: &mut ___E,
18934 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
18935 ) -> Result<(), ::fidl_next::EncodeError> {
18936 ::fidl_next::munge!(let WireExposeResolver { table } = out);
18937
18938 let max_ord = self.__max_ordinal();
18939
18940 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
18941 ::fidl_next::Wire::zero_padding(&mut out);
18942
18943 let mut preallocated =
18944 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
18945
18946 for i in 1..=max_ord {
18947 match i {
18948 6 => {
18949 if let Some(source_dictionary) = &self.source_dictionary {
18950 ::fidl_next::WireEnvelope::encode_value(
18951 source_dictionary,
18952 preallocated.encoder,
18953 &mut out,
18954 )?;
18955 } else {
18956 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18957 }
18958 }
18959
18960 4 => {
18961 if let Some(target_name) = &self.target_name {
18962 ::fidl_next::WireEnvelope::encode_value(
18963 target_name,
18964 preallocated.encoder,
18965 &mut out,
18966 )?;
18967 } else {
18968 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18969 }
18970 }
18971
18972 3 => {
18973 if let Some(target) = &self.target {
18974 ::fidl_next::WireEnvelope::encode_value(
18975 target,
18976 preallocated.encoder,
18977 &mut out,
18978 )?;
18979 } else {
18980 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18981 }
18982 }
18983
18984 2 => {
18985 if let Some(source_name) = &self.source_name {
18986 ::fidl_next::WireEnvelope::encode_value(
18987 source_name,
18988 preallocated.encoder,
18989 &mut out,
18990 )?;
18991 } else {
18992 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18993 }
18994 }
18995
18996 1 => {
18997 if let Some(source) = &self.source {
18998 ::fidl_next::WireEnvelope::encode_value(
18999 source,
19000 preallocated.encoder,
19001 &mut out,
19002 )?;
19003 } else {
19004 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19005 }
19006 }
19007
19008 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19009 }
19010 unsafe {
19011 preallocated.write_next(out.assume_init_ref());
19012 }
19013 }
19014
19015 ::fidl_next::WireTable::encode_len(table, max_ord);
19016
19017 Ok(())
19018 }
19019}
19020
19021impl<'de> ::fidl_next::FromWire<WireExposeResolver<'de>> for ExposeResolver {
19022 #[inline]
19023 fn from_wire(wire: WireExposeResolver<'de>) -> Self {
19024 let wire = ::core::mem::ManuallyDrop::new(wire);
19025
19026 let source = wire.table.get(1);
19027
19028 let source_name = wire.table.get(2);
19029
19030 let target = wire.table.get(3);
19031
19032 let target_name = wire.table.get(4);
19033
19034 let source_dictionary = wire.table.get(6);
19035
19036 Self {
19037 source: source.map(|envelope| {
19038 ::fidl_next::FromWire::from_wire(unsafe {
19039 envelope.read_unchecked::<crate::WireRef<'de>>()
19040 })
19041 }),
19042
19043 source_name: source_name.map(|envelope| {
19044 ::fidl_next::FromWire::from_wire(unsafe {
19045 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
19046 })
19047 }),
19048
19049 target: target.map(|envelope| {
19050 ::fidl_next::FromWire::from_wire(unsafe {
19051 envelope.read_unchecked::<crate::WireRef<'de>>()
19052 })
19053 }),
19054
19055 target_name: target_name.map(|envelope| {
19056 ::fidl_next::FromWire::from_wire(unsafe {
19057 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
19058 })
19059 }),
19060
19061 source_dictionary: source_dictionary.map(|envelope| {
19062 ::fidl_next::FromWire::from_wire(unsafe {
19063 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
19064 })
19065 }),
19066 }
19067 }
19068}
19069
19070impl<'de> ::fidl_next::FromWireRef<WireExposeResolver<'de>> for ExposeResolver {
19071 #[inline]
19072 fn from_wire_ref(wire: &WireExposeResolver<'de>) -> Self {
19073 Self {
19074 source: wire.table.get(1).map(|envelope| {
19075 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19076 envelope.deref_unchecked::<crate::WireRef<'de>>()
19077 })
19078 }),
19079
19080 source_name: wire.table.get(2).map(|envelope| {
19081 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19082 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
19083 })
19084 }),
19085
19086 target: wire.table.get(3).map(|envelope| {
19087 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19088 envelope.deref_unchecked::<crate::WireRef<'de>>()
19089 })
19090 }),
19091
19092 target_name: wire.table.get(4).map(|envelope| {
19093 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19094 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
19095 })
19096 }),
19097
19098 source_dictionary: wire.table.get(6).map(|envelope| {
19099 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19100 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
19101 })
19102 }),
19103 }
19104 }
19105}
19106
19107#[repr(C)]
19109pub struct WireExposeResolver<'de> {
19110 table: ::fidl_next::WireTable<'de>,
19111}
19112
19113impl<'de> Drop for WireExposeResolver<'de> {
19114 fn drop(&mut self) {
19115 let _ = self
19116 .table
19117 .get(1)
19118 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
19119
19120 let _ = self
19121 .table
19122 .get(2)
19123 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
19124
19125 let _ = self
19126 .table
19127 .get(3)
19128 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
19129
19130 let _ = self
19131 .table
19132 .get(4)
19133 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
19134
19135 let _ = self
19136 .table
19137 .get(6)
19138 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
19139 }
19140}
19141
19142unsafe impl ::fidl_next::Wire for WireExposeResolver<'static> {
19143 type Decoded<'de> = WireExposeResolver<'de>;
19144
19145 #[inline]
19146 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
19147 ::fidl_next::munge!(let Self { table } = out);
19148 ::fidl_next::WireTable::zero_padding(table);
19149 }
19150}
19151
19152unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeResolver<'static>
19153where
19154 ___D: ::fidl_next::Decoder + ?Sized,
19155{
19156 fn decode(
19157 slot: ::fidl_next::Slot<'_, Self>,
19158 decoder: &mut ___D,
19159 ) -> Result<(), ::fidl_next::DecodeError> {
19160 ::fidl_next::munge!(let Self { table } = slot);
19161
19162 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
19163 match ordinal {
19164 0 => unsafe { ::core::hint::unreachable_unchecked() },
19165
19166 1 => {
19167 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
19168 slot.as_mut(),
19169 decoder,
19170 )?;
19171
19172 Ok(())
19173 }
19174
19175 2 => {
19176 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
19177 slot.as_mut(),
19178 decoder,
19179 )?;
19180
19181 let source_name = unsafe {
19182 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
19183 };
19184
19185 if source_name.len() > 100 {
19186 return Err(::fidl_next::DecodeError::VectorTooLong {
19187 size: source_name.len() as u64,
19188 limit: 100,
19189 });
19190 }
19191
19192 Ok(())
19193 }
19194
19195 3 => {
19196 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
19197 slot.as_mut(),
19198 decoder,
19199 )?;
19200
19201 Ok(())
19202 }
19203
19204 4 => {
19205 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
19206 slot.as_mut(),
19207 decoder,
19208 )?;
19209
19210 let target_name = unsafe {
19211 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
19212 };
19213
19214 if target_name.len() > 100 {
19215 return Err(::fidl_next::DecodeError::VectorTooLong {
19216 size: target_name.len() as u64,
19217 limit: 100,
19218 });
19219 }
19220
19221 Ok(())
19222 }
19223
19224 6 => {
19225 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
19226 slot.as_mut(),
19227 decoder,
19228 )?;
19229
19230 let source_dictionary = unsafe {
19231 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
19232 };
19233
19234 if source_dictionary.len() > 1024 {
19235 return Err(::fidl_next::DecodeError::VectorTooLong {
19236 size: source_dictionary.len() as u64,
19237 limit: 1024,
19238 });
19239 }
19240
19241 Ok(())
19242 }
19243
19244 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
19245 }
19246 })
19247 }
19248}
19249
19250impl<'de> WireExposeResolver<'de> {
19251 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
19252 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
19253 }
19254
19255 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
19256 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
19257 }
19258
19259 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
19260 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
19261 }
19262
19263 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
19264 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
19265 }
19266
19267 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
19268 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
19269 }
19270}
19271
19272impl<'de> ::core::fmt::Debug for WireExposeResolver<'de> {
19273 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
19274 f.debug_struct("ExposeResolver")
19275 .field("source", &self.source())
19276 .field("source_name", &self.source_name())
19277 .field("target", &self.target())
19278 .field("target_name", &self.target_name())
19279 .field("source_dictionary", &self.source_dictionary())
19280 .finish()
19281 }
19282}
19283
19284#[doc = " Declares a dictionary exposed to a component\'s containing realm, such as\n a dictionary exposed by the component or one of its children at runtime.\n\n To learn more about dictionarys, see:\n https://fuchsia.dev/fuchsia-src/glossary#dictionary\n"]
19285#[derive(Clone, Debug, Default)]
19286pub struct ExposeDictionary {
19287 pub source: Option<crate::Ref>,
19288
19289 pub source_name: Option<String>,
19290
19291 pub target: Option<crate::Ref>,
19292
19293 pub target_name: Option<String>,
19294
19295 pub availability: Option<crate::Availability>,
19296
19297 pub source_dictionary: Option<String>,
19298}
19299
19300impl ExposeDictionary {
19301 fn __max_ordinal(&self) -> usize {
19302 if self.source_dictionary.is_some() {
19303 return 6;
19304 }
19305
19306 if self.availability.is_some() {
19307 return 5;
19308 }
19309
19310 if self.target_name.is_some() {
19311 return 4;
19312 }
19313
19314 if self.target.is_some() {
19315 return 3;
19316 }
19317
19318 if self.source_name.is_some() {
19319 return 2;
19320 }
19321
19322 if self.source.is_some() {
19323 return 1;
19324 }
19325
19326 0
19327 }
19328}
19329
19330impl ::fidl_next::Encodable for ExposeDictionary {
19331 type Encoded = WireExposeDictionary<'static>;
19332}
19333
19334unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeDictionary
19335where
19336 ___E: ::fidl_next::Encoder + ?Sized,
19337{
19338 #[inline]
19339 fn encode(
19340 mut self,
19341 encoder: &mut ___E,
19342 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
19343 ) -> Result<(), ::fidl_next::EncodeError> {
19344 ::fidl_next::munge!(let WireExposeDictionary { table } = out);
19345
19346 let max_ord = self.__max_ordinal();
19347
19348 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
19349 ::fidl_next::Wire::zero_padding(&mut out);
19350
19351 let mut preallocated =
19352 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
19353
19354 for i in 1..=max_ord {
19355 match i {
19356 6 => {
19357 if let Some(source_dictionary) = self.source_dictionary.take() {
19358 ::fidl_next::WireEnvelope::encode_value(
19359 source_dictionary,
19360 preallocated.encoder,
19361 &mut out,
19362 )?;
19363 } else {
19364 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19365 }
19366 }
19367
19368 5 => {
19369 if let Some(availability) = self.availability.take() {
19370 ::fidl_next::WireEnvelope::encode_value(
19371 availability,
19372 preallocated.encoder,
19373 &mut out,
19374 )?;
19375 } else {
19376 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19377 }
19378 }
19379
19380 4 => {
19381 if let Some(target_name) = self.target_name.take() {
19382 ::fidl_next::WireEnvelope::encode_value(
19383 target_name,
19384 preallocated.encoder,
19385 &mut out,
19386 )?;
19387 } else {
19388 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19389 }
19390 }
19391
19392 3 => {
19393 if let Some(target) = self.target.take() {
19394 ::fidl_next::WireEnvelope::encode_value(
19395 target,
19396 preallocated.encoder,
19397 &mut out,
19398 )?;
19399 } else {
19400 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19401 }
19402 }
19403
19404 2 => {
19405 if let Some(source_name) = self.source_name.take() {
19406 ::fidl_next::WireEnvelope::encode_value(
19407 source_name,
19408 preallocated.encoder,
19409 &mut out,
19410 )?;
19411 } else {
19412 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19413 }
19414 }
19415
19416 1 => {
19417 if let Some(source) = self.source.take() {
19418 ::fidl_next::WireEnvelope::encode_value(
19419 source,
19420 preallocated.encoder,
19421 &mut out,
19422 )?;
19423 } else {
19424 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19425 }
19426 }
19427
19428 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19429 }
19430 unsafe {
19431 preallocated.write_next(out.assume_init_ref());
19432 }
19433 }
19434
19435 ::fidl_next::WireTable::encode_len(table, max_ord);
19436
19437 Ok(())
19438 }
19439}
19440
19441unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeDictionary
19442where
19443 ___E: ::fidl_next::Encoder + ?Sized,
19444{
19445 #[inline]
19446 fn encode_ref(
19447 &self,
19448 encoder: &mut ___E,
19449 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
19450 ) -> Result<(), ::fidl_next::EncodeError> {
19451 ::fidl_next::munge!(let WireExposeDictionary { table } = out);
19452
19453 let max_ord = self.__max_ordinal();
19454
19455 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
19456 ::fidl_next::Wire::zero_padding(&mut out);
19457
19458 let mut preallocated =
19459 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
19460
19461 for i in 1..=max_ord {
19462 match i {
19463 6 => {
19464 if let Some(source_dictionary) = &self.source_dictionary {
19465 ::fidl_next::WireEnvelope::encode_value(
19466 source_dictionary,
19467 preallocated.encoder,
19468 &mut out,
19469 )?;
19470 } else {
19471 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19472 }
19473 }
19474
19475 5 => {
19476 if let Some(availability) = &self.availability {
19477 ::fidl_next::WireEnvelope::encode_value(
19478 availability,
19479 preallocated.encoder,
19480 &mut out,
19481 )?;
19482 } else {
19483 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19484 }
19485 }
19486
19487 4 => {
19488 if let Some(target_name) = &self.target_name {
19489 ::fidl_next::WireEnvelope::encode_value(
19490 target_name,
19491 preallocated.encoder,
19492 &mut out,
19493 )?;
19494 } else {
19495 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19496 }
19497 }
19498
19499 3 => {
19500 if let Some(target) = &self.target {
19501 ::fidl_next::WireEnvelope::encode_value(
19502 target,
19503 preallocated.encoder,
19504 &mut out,
19505 )?;
19506 } else {
19507 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19508 }
19509 }
19510
19511 2 => {
19512 if let Some(source_name) = &self.source_name {
19513 ::fidl_next::WireEnvelope::encode_value(
19514 source_name,
19515 preallocated.encoder,
19516 &mut out,
19517 )?;
19518 } else {
19519 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19520 }
19521 }
19522
19523 1 => {
19524 if let Some(source) = &self.source {
19525 ::fidl_next::WireEnvelope::encode_value(
19526 source,
19527 preallocated.encoder,
19528 &mut out,
19529 )?;
19530 } else {
19531 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19532 }
19533 }
19534
19535 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19536 }
19537 unsafe {
19538 preallocated.write_next(out.assume_init_ref());
19539 }
19540 }
19541
19542 ::fidl_next::WireTable::encode_len(table, max_ord);
19543
19544 Ok(())
19545 }
19546}
19547
19548impl<'de> ::fidl_next::FromWire<WireExposeDictionary<'de>> for ExposeDictionary {
19549 #[inline]
19550 fn from_wire(wire: WireExposeDictionary<'de>) -> Self {
19551 let wire = ::core::mem::ManuallyDrop::new(wire);
19552
19553 let source = wire.table.get(1);
19554
19555 let source_name = wire.table.get(2);
19556
19557 let target = wire.table.get(3);
19558
19559 let target_name = wire.table.get(4);
19560
19561 let availability = wire.table.get(5);
19562
19563 let source_dictionary = wire.table.get(6);
19564
19565 Self {
19566 source: source.map(|envelope| {
19567 ::fidl_next::FromWire::from_wire(unsafe {
19568 envelope.read_unchecked::<crate::WireRef<'de>>()
19569 })
19570 }),
19571
19572 source_name: source_name.map(|envelope| {
19573 ::fidl_next::FromWire::from_wire(unsafe {
19574 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
19575 })
19576 }),
19577
19578 target: target.map(|envelope| {
19579 ::fidl_next::FromWire::from_wire(unsafe {
19580 envelope.read_unchecked::<crate::WireRef<'de>>()
19581 })
19582 }),
19583
19584 target_name: target_name.map(|envelope| {
19585 ::fidl_next::FromWire::from_wire(unsafe {
19586 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
19587 })
19588 }),
19589
19590 availability: availability.map(|envelope| {
19591 ::fidl_next::FromWire::from_wire(unsafe {
19592 envelope.read_unchecked::<crate::WireAvailability>()
19593 })
19594 }),
19595
19596 source_dictionary: source_dictionary.map(|envelope| {
19597 ::fidl_next::FromWire::from_wire(unsafe {
19598 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
19599 })
19600 }),
19601 }
19602 }
19603}
19604
19605impl<'de> ::fidl_next::FromWireRef<WireExposeDictionary<'de>> for ExposeDictionary {
19606 #[inline]
19607 fn from_wire_ref(wire: &WireExposeDictionary<'de>) -> Self {
19608 Self {
19609 source: wire.table.get(1).map(|envelope| {
19610 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19611 envelope.deref_unchecked::<crate::WireRef<'de>>()
19612 })
19613 }),
19614
19615 source_name: wire.table.get(2).map(|envelope| {
19616 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19617 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
19618 })
19619 }),
19620
19621 target: wire.table.get(3).map(|envelope| {
19622 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19623 envelope.deref_unchecked::<crate::WireRef<'de>>()
19624 })
19625 }),
19626
19627 target_name: wire.table.get(4).map(|envelope| {
19628 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19629 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
19630 })
19631 }),
19632
19633 availability: wire.table.get(5).map(|envelope| {
19634 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19635 envelope.deref_unchecked::<crate::WireAvailability>()
19636 })
19637 }),
19638
19639 source_dictionary: wire.table.get(6).map(|envelope| {
19640 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
19641 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
19642 })
19643 }),
19644 }
19645 }
19646}
19647
19648#[repr(C)]
19650pub struct WireExposeDictionary<'de> {
19651 table: ::fidl_next::WireTable<'de>,
19652}
19653
19654impl<'de> Drop for WireExposeDictionary<'de> {
19655 fn drop(&mut self) {
19656 let _ = self
19657 .table
19658 .get(1)
19659 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
19660
19661 let _ = self
19662 .table
19663 .get(2)
19664 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
19665
19666 let _ = self
19667 .table
19668 .get(3)
19669 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
19670
19671 let _ = self
19672 .table
19673 .get(4)
19674 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
19675
19676 let _ = self
19677 .table
19678 .get(5)
19679 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
19680
19681 let _ = self
19682 .table
19683 .get(6)
19684 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
19685 }
19686}
19687
19688unsafe impl ::fidl_next::Wire for WireExposeDictionary<'static> {
19689 type Decoded<'de> = WireExposeDictionary<'de>;
19690
19691 #[inline]
19692 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
19693 ::fidl_next::munge!(let Self { table } = out);
19694 ::fidl_next::WireTable::zero_padding(table);
19695 }
19696}
19697
19698unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeDictionary<'static>
19699where
19700 ___D: ::fidl_next::Decoder + ?Sized,
19701{
19702 fn decode(
19703 slot: ::fidl_next::Slot<'_, Self>,
19704 decoder: &mut ___D,
19705 ) -> Result<(), ::fidl_next::DecodeError> {
19706 ::fidl_next::munge!(let Self { table } = slot);
19707
19708 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
19709 match ordinal {
19710 0 => unsafe { ::core::hint::unreachable_unchecked() },
19711
19712 1 => {
19713 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
19714 slot.as_mut(),
19715 decoder,
19716 )?;
19717
19718 Ok(())
19719 }
19720
19721 2 => {
19722 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
19723 slot.as_mut(),
19724 decoder,
19725 )?;
19726
19727 let source_name = unsafe {
19728 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
19729 };
19730
19731 if source_name.len() > 100 {
19732 return Err(::fidl_next::DecodeError::VectorTooLong {
19733 size: source_name.len() as u64,
19734 limit: 100,
19735 });
19736 }
19737
19738 Ok(())
19739 }
19740
19741 3 => {
19742 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
19743 slot.as_mut(),
19744 decoder,
19745 )?;
19746
19747 Ok(())
19748 }
19749
19750 4 => {
19751 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
19752 slot.as_mut(),
19753 decoder,
19754 )?;
19755
19756 let target_name = unsafe {
19757 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
19758 };
19759
19760 if target_name.len() > 100 {
19761 return Err(::fidl_next::DecodeError::VectorTooLong {
19762 size: target_name.len() as u64,
19763 limit: 100,
19764 });
19765 }
19766
19767 Ok(())
19768 }
19769
19770 5 => {
19771 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
19772 slot.as_mut(),
19773 decoder,
19774 )?;
19775
19776 Ok(())
19777 }
19778
19779 6 => {
19780 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
19781 slot.as_mut(),
19782 decoder,
19783 )?;
19784
19785 let source_dictionary = unsafe {
19786 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
19787 };
19788
19789 if source_dictionary.len() > 1024 {
19790 return Err(::fidl_next::DecodeError::VectorTooLong {
19791 size: source_dictionary.len() as u64,
19792 limit: 1024,
19793 });
19794 }
19795
19796 Ok(())
19797 }
19798
19799 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
19800 }
19801 })
19802 }
19803}
19804
19805impl<'de> WireExposeDictionary<'de> {
19806 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
19807 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
19808 }
19809
19810 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
19811 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
19812 }
19813
19814 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
19815 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
19816 }
19817
19818 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
19819 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
19820 }
19821
19822 pub fn availability(&self) -> Option<&crate::WireAvailability> {
19823 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
19824 }
19825
19826 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
19827 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
19828 }
19829}
19830
19831impl<'de> ::core::fmt::Debug for WireExposeDictionary<'de> {
19832 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
19833 f.debug_struct("ExposeDictionary")
19834 .field("source", &self.source())
19835 .field("source_name", &self.source_name())
19836 .field("target", &self.target())
19837 .field("target_name", &self.target_name())
19838 .field("availability", &self.availability())
19839 .field("source_dictionary", &self.source_dictionary())
19840 .finish()
19841 }
19842}
19843
19844#[doc = " Declares a configuration capability exposed to a component\'s containing realm, such as\n a capability exposed by the component or one of its children at runtime.\n"]
19845#[derive(Clone, Debug, Default)]
19846pub struct ExposeConfiguration {
19847 pub source: Option<crate::Ref>,
19848
19849 pub source_name: Option<String>,
19850
19851 pub target: Option<crate::Ref>,
19852
19853 pub target_name: Option<String>,
19854
19855 pub availability: Option<crate::Availability>,
19856
19857 pub source_dictionary: Option<String>,
19858}
19859
19860impl ExposeConfiguration {
19861 fn __max_ordinal(&self) -> usize {
19862 if self.source_dictionary.is_some() {
19863 return 6;
19864 }
19865
19866 if self.availability.is_some() {
19867 return 5;
19868 }
19869
19870 if self.target_name.is_some() {
19871 return 4;
19872 }
19873
19874 if self.target.is_some() {
19875 return 3;
19876 }
19877
19878 if self.source_name.is_some() {
19879 return 2;
19880 }
19881
19882 if self.source.is_some() {
19883 return 1;
19884 }
19885
19886 0
19887 }
19888}
19889
19890impl ::fidl_next::Encodable for ExposeConfiguration {
19891 type Encoded = WireExposeConfiguration<'static>;
19892}
19893
19894unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeConfiguration
19895where
19896 ___E: ::fidl_next::Encoder + ?Sized,
19897{
19898 #[inline]
19899 fn encode(
19900 mut self,
19901 encoder: &mut ___E,
19902 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
19903 ) -> Result<(), ::fidl_next::EncodeError> {
19904 ::fidl_next::munge!(let WireExposeConfiguration { table } = out);
19905
19906 let max_ord = self.__max_ordinal();
19907
19908 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
19909 ::fidl_next::Wire::zero_padding(&mut out);
19910
19911 let mut preallocated =
19912 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
19913
19914 for i in 1..=max_ord {
19915 match i {
19916 6 => {
19917 if let Some(source_dictionary) = self.source_dictionary.take() {
19918 ::fidl_next::WireEnvelope::encode_value(
19919 source_dictionary,
19920 preallocated.encoder,
19921 &mut out,
19922 )?;
19923 } else {
19924 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19925 }
19926 }
19927
19928 5 => {
19929 if let Some(availability) = self.availability.take() {
19930 ::fidl_next::WireEnvelope::encode_value(
19931 availability,
19932 preallocated.encoder,
19933 &mut out,
19934 )?;
19935 } else {
19936 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19937 }
19938 }
19939
19940 4 => {
19941 if let Some(target_name) = self.target_name.take() {
19942 ::fidl_next::WireEnvelope::encode_value(
19943 target_name,
19944 preallocated.encoder,
19945 &mut out,
19946 )?;
19947 } else {
19948 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19949 }
19950 }
19951
19952 3 => {
19953 if let Some(target) = self.target.take() {
19954 ::fidl_next::WireEnvelope::encode_value(
19955 target,
19956 preallocated.encoder,
19957 &mut out,
19958 )?;
19959 } else {
19960 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19961 }
19962 }
19963
19964 2 => {
19965 if let Some(source_name) = self.source_name.take() {
19966 ::fidl_next::WireEnvelope::encode_value(
19967 source_name,
19968 preallocated.encoder,
19969 &mut out,
19970 )?;
19971 } else {
19972 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19973 }
19974 }
19975
19976 1 => {
19977 if let Some(source) = self.source.take() {
19978 ::fidl_next::WireEnvelope::encode_value(
19979 source,
19980 preallocated.encoder,
19981 &mut out,
19982 )?;
19983 } else {
19984 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19985 }
19986 }
19987
19988 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19989 }
19990 unsafe {
19991 preallocated.write_next(out.assume_init_ref());
19992 }
19993 }
19994
19995 ::fidl_next::WireTable::encode_len(table, max_ord);
19996
19997 Ok(())
19998 }
19999}
20000
20001unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeConfiguration
20002where
20003 ___E: ::fidl_next::Encoder + ?Sized,
20004{
20005 #[inline]
20006 fn encode_ref(
20007 &self,
20008 encoder: &mut ___E,
20009 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
20010 ) -> Result<(), ::fidl_next::EncodeError> {
20011 ::fidl_next::munge!(let WireExposeConfiguration { table } = out);
20012
20013 let max_ord = self.__max_ordinal();
20014
20015 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
20016 ::fidl_next::Wire::zero_padding(&mut out);
20017
20018 let mut preallocated =
20019 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
20020
20021 for i in 1..=max_ord {
20022 match i {
20023 6 => {
20024 if let Some(source_dictionary) = &self.source_dictionary {
20025 ::fidl_next::WireEnvelope::encode_value(
20026 source_dictionary,
20027 preallocated.encoder,
20028 &mut out,
20029 )?;
20030 } else {
20031 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20032 }
20033 }
20034
20035 5 => {
20036 if let Some(availability) = &self.availability {
20037 ::fidl_next::WireEnvelope::encode_value(
20038 availability,
20039 preallocated.encoder,
20040 &mut out,
20041 )?;
20042 } else {
20043 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20044 }
20045 }
20046
20047 4 => {
20048 if let Some(target_name) = &self.target_name {
20049 ::fidl_next::WireEnvelope::encode_value(
20050 target_name,
20051 preallocated.encoder,
20052 &mut out,
20053 )?;
20054 } else {
20055 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20056 }
20057 }
20058
20059 3 => {
20060 if let Some(target) = &self.target {
20061 ::fidl_next::WireEnvelope::encode_value(
20062 target,
20063 preallocated.encoder,
20064 &mut out,
20065 )?;
20066 } else {
20067 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20068 }
20069 }
20070
20071 2 => {
20072 if let Some(source_name) = &self.source_name {
20073 ::fidl_next::WireEnvelope::encode_value(
20074 source_name,
20075 preallocated.encoder,
20076 &mut out,
20077 )?;
20078 } else {
20079 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20080 }
20081 }
20082
20083 1 => {
20084 if let Some(source) = &self.source {
20085 ::fidl_next::WireEnvelope::encode_value(
20086 source,
20087 preallocated.encoder,
20088 &mut out,
20089 )?;
20090 } else {
20091 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20092 }
20093 }
20094
20095 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
20096 }
20097 unsafe {
20098 preallocated.write_next(out.assume_init_ref());
20099 }
20100 }
20101
20102 ::fidl_next::WireTable::encode_len(table, max_ord);
20103
20104 Ok(())
20105 }
20106}
20107
20108impl<'de> ::fidl_next::FromWire<WireExposeConfiguration<'de>> for ExposeConfiguration {
20109 #[inline]
20110 fn from_wire(wire: WireExposeConfiguration<'de>) -> Self {
20111 let wire = ::core::mem::ManuallyDrop::new(wire);
20112
20113 let source = wire.table.get(1);
20114
20115 let source_name = wire.table.get(2);
20116
20117 let target = wire.table.get(3);
20118
20119 let target_name = wire.table.get(4);
20120
20121 let availability = wire.table.get(5);
20122
20123 let source_dictionary = wire.table.get(6);
20124
20125 Self {
20126 source: source.map(|envelope| {
20127 ::fidl_next::FromWire::from_wire(unsafe {
20128 envelope.read_unchecked::<crate::WireRef<'de>>()
20129 })
20130 }),
20131
20132 source_name: source_name.map(|envelope| {
20133 ::fidl_next::FromWire::from_wire(unsafe {
20134 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
20135 })
20136 }),
20137
20138 target: target.map(|envelope| {
20139 ::fidl_next::FromWire::from_wire(unsafe {
20140 envelope.read_unchecked::<crate::WireRef<'de>>()
20141 })
20142 }),
20143
20144 target_name: target_name.map(|envelope| {
20145 ::fidl_next::FromWire::from_wire(unsafe {
20146 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
20147 })
20148 }),
20149
20150 availability: availability.map(|envelope| {
20151 ::fidl_next::FromWire::from_wire(unsafe {
20152 envelope.read_unchecked::<crate::WireAvailability>()
20153 })
20154 }),
20155
20156 source_dictionary: source_dictionary.map(|envelope| {
20157 ::fidl_next::FromWire::from_wire(unsafe {
20158 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
20159 })
20160 }),
20161 }
20162 }
20163}
20164
20165impl<'de> ::fidl_next::FromWireRef<WireExposeConfiguration<'de>> for ExposeConfiguration {
20166 #[inline]
20167 fn from_wire_ref(wire: &WireExposeConfiguration<'de>) -> Self {
20168 Self {
20169 source: wire.table.get(1).map(|envelope| {
20170 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
20171 envelope.deref_unchecked::<crate::WireRef<'de>>()
20172 })
20173 }),
20174
20175 source_name: wire.table.get(2).map(|envelope| {
20176 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
20177 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
20178 })
20179 }),
20180
20181 target: wire.table.get(3).map(|envelope| {
20182 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
20183 envelope.deref_unchecked::<crate::WireRef<'de>>()
20184 })
20185 }),
20186
20187 target_name: wire.table.get(4).map(|envelope| {
20188 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
20189 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
20190 })
20191 }),
20192
20193 availability: wire.table.get(5).map(|envelope| {
20194 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
20195 envelope.deref_unchecked::<crate::WireAvailability>()
20196 })
20197 }),
20198
20199 source_dictionary: wire.table.get(6).map(|envelope| {
20200 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
20201 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
20202 })
20203 }),
20204 }
20205 }
20206}
20207
20208#[repr(C)]
20210pub struct WireExposeConfiguration<'de> {
20211 table: ::fidl_next::WireTable<'de>,
20212}
20213
20214impl<'de> Drop for WireExposeConfiguration<'de> {
20215 fn drop(&mut self) {
20216 let _ = self
20217 .table
20218 .get(1)
20219 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
20220
20221 let _ = self
20222 .table
20223 .get(2)
20224 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
20225
20226 let _ = self
20227 .table
20228 .get(3)
20229 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
20230
20231 let _ = self
20232 .table
20233 .get(4)
20234 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
20235
20236 let _ = self
20237 .table
20238 .get(5)
20239 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
20240
20241 let _ = self
20242 .table
20243 .get(6)
20244 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
20245 }
20246}
20247
20248unsafe impl ::fidl_next::Wire for WireExposeConfiguration<'static> {
20249 type Decoded<'de> = WireExposeConfiguration<'de>;
20250
20251 #[inline]
20252 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
20253 ::fidl_next::munge!(let Self { table } = out);
20254 ::fidl_next::WireTable::zero_padding(table);
20255 }
20256}
20257
20258unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeConfiguration<'static>
20259where
20260 ___D: ::fidl_next::Decoder + ?Sized,
20261{
20262 fn decode(
20263 slot: ::fidl_next::Slot<'_, Self>,
20264 decoder: &mut ___D,
20265 ) -> Result<(), ::fidl_next::DecodeError> {
20266 ::fidl_next::munge!(let Self { table } = slot);
20267
20268 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
20269 match ordinal {
20270 0 => unsafe { ::core::hint::unreachable_unchecked() },
20271
20272 1 => {
20273 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
20274 slot.as_mut(),
20275 decoder,
20276 )?;
20277
20278 Ok(())
20279 }
20280
20281 2 => {
20282 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
20283 slot.as_mut(),
20284 decoder,
20285 )?;
20286
20287 let source_name = unsafe {
20288 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
20289 };
20290
20291 if source_name.len() > 100 {
20292 return Err(::fidl_next::DecodeError::VectorTooLong {
20293 size: source_name.len() as u64,
20294 limit: 100,
20295 });
20296 }
20297
20298 Ok(())
20299 }
20300
20301 3 => {
20302 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
20303 slot.as_mut(),
20304 decoder,
20305 )?;
20306
20307 Ok(())
20308 }
20309
20310 4 => {
20311 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
20312 slot.as_mut(),
20313 decoder,
20314 )?;
20315
20316 let target_name = unsafe {
20317 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
20318 };
20319
20320 if target_name.len() > 100 {
20321 return Err(::fidl_next::DecodeError::VectorTooLong {
20322 size: target_name.len() as u64,
20323 limit: 100,
20324 });
20325 }
20326
20327 Ok(())
20328 }
20329
20330 5 => {
20331 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
20332 slot.as_mut(),
20333 decoder,
20334 )?;
20335
20336 Ok(())
20337 }
20338
20339 6 => {
20340 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
20341 slot.as_mut(),
20342 decoder,
20343 )?;
20344
20345 let source_dictionary = unsafe {
20346 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
20347 };
20348
20349 if source_dictionary.len() > 1024 {
20350 return Err(::fidl_next::DecodeError::VectorTooLong {
20351 size: source_dictionary.len() as u64,
20352 limit: 1024,
20353 });
20354 }
20355
20356 Ok(())
20357 }
20358
20359 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
20360 }
20361 })
20362 }
20363}
20364
20365impl<'de> WireExposeConfiguration<'de> {
20366 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
20367 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
20368 }
20369
20370 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
20371 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
20372 }
20373
20374 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
20375 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
20376 }
20377
20378 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
20379 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
20380 }
20381
20382 pub fn availability(&self) -> Option<&crate::WireAvailability> {
20383 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
20384 }
20385
20386 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
20387 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
20388 }
20389}
20390
20391impl<'de> ::core::fmt::Debug for WireExposeConfiguration<'de> {
20392 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
20393 f.debug_struct("ExposeConfiguration")
20394 .field("source", &self.source())
20395 .field("source_name", &self.source_name())
20396 .field("target", &self.target())
20397 .field("target_name", &self.target_name())
20398 .field("availability", &self.availability())
20399 .field("source_dictionary", &self.source_dictionary())
20400 .finish()
20401 }
20402}
20403
20404#[doc = " Declares a capability exposed to either a component\'s containing realm or to\n the framework. For example, a legacy service exposed by the component at\n runtime.\n"]
20405#[derive(Clone, Debug)]
20406pub enum Expose {
20407 Service(crate::ExposeService),
20408
20409 Protocol(crate::ExposeProtocol),
20410
20411 Directory(crate::ExposeDirectory),
20412
20413 Runner(crate::ExposeRunner),
20414
20415 Resolver(crate::ExposeResolver),
20416
20417 Dictionary(crate::ExposeDictionary),
20418
20419 Config(crate::ExposeConfiguration),
20420
20421 UnknownOrdinal_(u64),
20422}
20423
20424impl ::fidl_next::Encodable for Expose {
20425 type Encoded = WireExpose<'static>;
20426}
20427
20428unsafe impl<___E> ::fidl_next::Encode<___E> for Expose
20429where
20430 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
20431
20432 ___E: ::fidl_next::Encoder,
20433{
20434 #[inline]
20435 fn encode(
20436 self,
20437 encoder: &mut ___E,
20438 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
20439 ) -> Result<(), ::fidl_next::EncodeError> {
20440 ::fidl_next::munge!(let WireExpose { raw, _phantom: _ } = out);
20441
20442 match self {
20443 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<
20444 ___E,
20445 crate::ExposeService,
20446 >(value, 1, encoder, raw)?,
20447
20448 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
20449 ___E,
20450 crate::ExposeProtocol,
20451 >(value, 2, encoder, raw)?,
20452
20453 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
20454 ___E,
20455 crate::ExposeDirectory,
20456 >(value, 3, encoder, raw)?,
20457
20458 Self::Runner(value) => {
20459 ::fidl_next::RawWireUnion::encode_as::<___E, crate::ExposeRunner>(
20460 value, 4, encoder, raw,
20461 )?
20462 }
20463
20464 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<
20465 ___E,
20466 crate::ExposeResolver,
20467 >(value, 5, encoder, raw)?,
20468
20469 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
20470 ___E,
20471 crate::ExposeDictionary,
20472 >(value, 7, encoder, raw)?,
20473
20474 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
20475 ___E,
20476 crate::ExposeConfiguration,
20477 >(value, 8, encoder, raw)?,
20478
20479 Self::UnknownOrdinal_(ordinal) => {
20480 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
20481 }
20482 }
20483
20484 Ok(())
20485 }
20486}
20487
20488unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Expose
20489where
20490 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
20491
20492 ___E: ::fidl_next::Encoder,
20493{
20494 #[inline]
20495 fn encode_ref(
20496 &self,
20497 encoder: &mut ___E,
20498 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
20499 ) -> Result<(), ::fidl_next::EncodeError> {
20500 ::fidl_next::munge!(let WireExpose { raw, _phantom: _ } = out);
20501
20502 match self {
20503 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<
20504 ___E,
20505 &crate::ExposeService,
20506 >(value, 1, encoder, raw)?,
20507
20508 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
20509 ___E,
20510 &crate::ExposeProtocol,
20511 >(value, 2, encoder, raw)?,
20512
20513 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
20514 ___E,
20515 &crate::ExposeDirectory,
20516 >(value, 3, encoder, raw)?,
20517
20518 Self::Runner(value) => ::fidl_next::RawWireUnion::encode_as::<
20519 ___E,
20520 &crate::ExposeRunner,
20521 >(value, 4, encoder, raw)?,
20522
20523 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<
20524 ___E,
20525 &crate::ExposeResolver,
20526 >(value, 5, encoder, raw)?,
20527
20528 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
20529 ___E,
20530 &crate::ExposeDictionary,
20531 >(value, 7, encoder, raw)?,
20532
20533 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
20534 ___E,
20535 &crate::ExposeConfiguration,
20536 >(value, 8, encoder, raw)?,
20537
20538 Self::UnknownOrdinal_(ordinal) => {
20539 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
20540 }
20541 }
20542
20543 Ok(())
20544 }
20545}
20546
20547impl ::fidl_next::EncodableOption for Expose {
20548 type EncodedOption = WireOptionalExpose<'static>;
20549}
20550
20551unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Expose
20552where
20553 ___E: ?Sized,
20554 Expose: ::fidl_next::Encode<___E>,
20555{
20556 #[inline]
20557 fn encode_option(
20558 this: Option<Self>,
20559 encoder: &mut ___E,
20560 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
20561 ) -> Result<(), ::fidl_next::EncodeError> {
20562 ::fidl_next::munge!(let WireOptionalExpose { raw, _phantom: _ } = &mut *out);
20563
20564 if let Some(inner) = this {
20565 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
20566 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
20567 } else {
20568 ::fidl_next::RawWireUnion::encode_absent(raw);
20569 }
20570
20571 Ok(())
20572 }
20573}
20574
20575unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Expose
20576where
20577 ___E: ?Sized,
20578 Expose: ::fidl_next::EncodeRef<___E>,
20579{
20580 #[inline]
20581 fn encode_option_ref(
20582 this: Option<&Self>,
20583 encoder: &mut ___E,
20584 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
20585 ) -> Result<(), ::fidl_next::EncodeError> {
20586 ::fidl_next::munge!(let WireOptionalExpose { raw, _phantom: _ } = &mut *out);
20587
20588 if let Some(inner) = this {
20589 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
20590 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
20591 } else {
20592 ::fidl_next::RawWireUnion::encode_absent(raw);
20593 }
20594
20595 Ok(())
20596 }
20597}
20598
20599impl<'de> ::fidl_next::FromWire<WireExpose<'de>> for Expose {
20600 #[inline]
20601 fn from_wire(wire: WireExpose<'de>) -> Self {
20602 let wire = ::core::mem::ManuallyDrop::new(wire);
20603 match wire.raw.ordinal() {
20604 1 => Self::Service(::fidl_next::FromWire::from_wire(unsafe {
20605 wire.raw.get().read_unchecked::<crate::WireExposeService<'de>>()
20606 })),
20607
20608 2 => Self::Protocol(::fidl_next::FromWire::from_wire(unsafe {
20609 wire.raw.get().read_unchecked::<crate::WireExposeProtocol<'de>>()
20610 })),
20611
20612 3 => Self::Directory(::fidl_next::FromWire::from_wire(unsafe {
20613 wire.raw.get().read_unchecked::<crate::WireExposeDirectory<'de>>()
20614 })),
20615
20616 4 => Self::Runner(::fidl_next::FromWire::from_wire(unsafe {
20617 wire.raw.get().read_unchecked::<crate::WireExposeRunner<'de>>()
20618 })),
20619
20620 5 => Self::Resolver(::fidl_next::FromWire::from_wire(unsafe {
20621 wire.raw.get().read_unchecked::<crate::WireExposeResolver<'de>>()
20622 })),
20623
20624 7 => Self::Dictionary(::fidl_next::FromWire::from_wire(unsafe {
20625 wire.raw.get().read_unchecked::<crate::WireExposeDictionary<'de>>()
20626 })),
20627
20628 8 => Self::Config(::fidl_next::FromWire::from_wire(unsafe {
20629 wire.raw.get().read_unchecked::<crate::WireExposeConfiguration<'de>>()
20630 })),
20631
20632 _ => unsafe { ::core::hint::unreachable_unchecked() },
20633 }
20634 }
20635}
20636
20637impl<'de> ::fidl_next::FromWireRef<WireExpose<'de>> for Expose {
20638 #[inline]
20639 fn from_wire_ref(wire: &WireExpose<'de>) -> Self {
20640 match wire.raw.ordinal() {
20641 1 => Self::Service(::fidl_next::FromWireRef::from_wire_ref(unsafe {
20642 wire.raw.get().deref_unchecked::<crate::WireExposeService<'de>>()
20643 })),
20644
20645 2 => Self::Protocol(::fidl_next::FromWireRef::from_wire_ref(unsafe {
20646 wire.raw.get().deref_unchecked::<crate::WireExposeProtocol<'de>>()
20647 })),
20648
20649 3 => Self::Directory(::fidl_next::FromWireRef::from_wire_ref(unsafe {
20650 wire.raw.get().deref_unchecked::<crate::WireExposeDirectory<'de>>()
20651 })),
20652
20653 4 => Self::Runner(::fidl_next::FromWireRef::from_wire_ref(unsafe {
20654 wire.raw.get().deref_unchecked::<crate::WireExposeRunner<'de>>()
20655 })),
20656
20657 5 => Self::Resolver(::fidl_next::FromWireRef::from_wire_ref(unsafe {
20658 wire.raw.get().deref_unchecked::<crate::WireExposeResolver<'de>>()
20659 })),
20660
20661 7 => Self::Dictionary(::fidl_next::FromWireRef::from_wire_ref(unsafe {
20662 wire.raw.get().deref_unchecked::<crate::WireExposeDictionary<'de>>()
20663 })),
20664
20665 8 => Self::Config(::fidl_next::FromWireRef::from_wire_ref(unsafe {
20666 wire.raw.get().deref_unchecked::<crate::WireExposeConfiguration<'de>>()
20667 })),
20668
20669 _ => unsafe { ::core::hint::unreachable_unchecked() },
20670 }
20671 }
20672}
20673
20674impl<'de> ::fidl_next::FromWireOption<WireOptionalExpose<'de>> for Box<Expose> {
20675 #[inline]
20676 fn from_wire_option(wire: WireOptionalExpose<'de>) -> Option<Self> {
20677 if let Some(inner) = wire.into_option() {
20678 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
20679 } else {
20680 None
20681 }
20682 }
20683}
20684
20685impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalExpose<'de>> for Box<Expose> {
20686 #[inline]
20687 fn from_wire_option_ref(wire: &WireOptionalExpose<'de>) -> Option<Self> {
20688 if let Some(inner) = wire.as_ref() {
20689 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
20690 } else {
20691 None
20692 }
20693 }
20694}
20695
20696#[repr(transparent)]
20698pub struct WireExpose<'de> {
20699 raw: ::fidl_next::RawWireUnion,
20700 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
20701}
20702
20703impl<'de> Drop for WireExpose<'de> {
20704 fn drop(&mut self) {
20705 match self.raw.ordinal() {
20706 1 => {
20707 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireExposeService<'de>>() };
20708 }
20709
20710 2 => {
20711 let _ =
20712 unsafe { self.raw.get().read_unchecked::<crate::WireExposeProtocol<'de>>() };
20713 }
20714
20715 3 => {
20716 let _ =
20717 unsafe { self.raw.get().read_unchecked::<crate::WireExposeDirectory<'de>>() };
20718 }
20719
20720 4 => {
20721 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireExposeRunner<'de>>() };
20722 }
20723
20724 5 => {
20725 let _ =
20726 unsafe { self.raw.get().read_unchecked::<crate::WireExposeResolver<'de>>() };
20727 }
20728
20729 7 => {
20730 let _ =
20731 unsafe { self.raw.get().read_unchecked::<crate::WireExposeDictionary<'de>>() };
20732 }
20733
20734 8 => {
20735 let _ = unsafe {
20736 self.raw.get().read_unchecked::<crate::WireExposeConfiguration<'de>>()
20737 };
20738 }
20739
20740 _ => (),
20741 }
20742 }
20743}
20744
20745unsafe impl ::fidl_next::Wire for WireExpose<'static> {
20746 type Decoded<'de> = WireExpose<'de>;
20747
20748 #[inline]
20749 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
20750 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
20751 ::fidl_next::RawWireUnion::zero_padding(raw);
20752 }
20753}
20754
20755pub mod expose {
20756 pub enum Ref<'de> {
20757 Service(&'de crate::WireExposeService<'de>),
20758
20759 Protocol(&'de crate::WireExposeProtocol<'de>),
20760
20761 Directory(&'de crate::WireExposeDirectory<'de>),
20762
20763 Runner(&'de crate::WireExposeRunner<'de>),
20764
20765 Resolver(&'de crate::WireExposeResolver<'de>),
20766
20767 Dictionary(&'de crate::WireExposeDictionary<'de>),
20768
20769 Config(&'de crate::WireExposeConfiguration<'de>),
20770
20771 UnknownOrdinal_(u64),
20772 }
20773}
20774
20775impl<'de> WireExpose<'de> {
20776 pub fn as_ref(&self) -> crate::expose::Ref<'_> {
20777 match self.raw.ordinal() {
20778 1 => crate::expose::Ref::Service(unsafe {
20779 self.raw.get().deref_unchecked::<crate::WireExposeService<'_>>()
20780 }),
20781
20782 2 => crate::expose::Ref::Protocol(unsafe {
20783 self.raw.get().deref_unchecked::<crate::WireExposeProtocol<'_>>()
20784 }),
20785
20786 3 => crate::expose::Ref::Directory(unsafe {
20787 self.raw.get().deref_unchecked::<crate::WireExposeDirectory<'_>>()
20788 }),
20789
20790 4 => crate::expose::Ref::Runner(unsafe {
20791 self.raw.get().deref_unchecked::<crate::WireExposeRunner<'_>>()
20792 }),
20793
20794 5 => crate::expose::Ref::Resolver(unsafe {
20795 self.raw.get().deref_unchecked::<crate::WireExposeResolver<'_>>()
20796 }),
20797
20798 7 => crate::expose::Ref::Dictionary(unsafe {
20799 self.raw.get().deref_unchecked::<crate::WireExposeDictionary<'_>>()
20800 }),
20801
20802 8 => crate::expose::Ref::Config(unsafe {
20803 self.raw.get().deref_unchecked::<crate::WireExposeConfiguration<'_>>()
20804 }),
20805
20806 unknown => crate::expose::Ref::UnknownOrdinal_(unknown),
20807 }
20808 }
20809}
20810
20811unsafe impl<___D> ::fidl_next::Decode<___D> for WireExpose<'static>
20812where
20813 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
20814
20815 ___D: ::fidl_next::Decoder,
20816{
20817 fn decode(
20818 mut slot: ::fidl_next::Slot<'_, Self>,
20819 decoder: &mut ___D,
20820 ) -> Result<(), ::fidl_next::DecodeError> {
20821 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
20822 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
20823 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeService<'static>>(
20824 raw, decoder,
20825 )?,
20826
20827 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeProtocol<'static>>(
20828 raw, decoder,
20829 )?,
20830
20831 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeDirectory<'static>>(
20832 raw, decoder,
20833 )?,
20834
20835 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeRunner<'static>>(
20836 raw, decoder,
20837 )?,
20838
20839 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeResolver<'static>>(
20840 raw, decoder,
20841 )?,
20842
20843 7 => {
20844 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeDictionary<'static>>(
20845 raw, decoder,
20846 )?
20847 }
20848
20849 8 => ::fidl_next::RawWireUnion::decode_as::<
20850 ___D,
20851 crate::WireExposeConfiguration<'static>,
20852 >(raw, decoder)?,
20853
20854 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
20855 }
20856
20857 Ok(())
20858 }
20859}
20860
20861impl<'de> ::core::fmt::Debug for WireExpose<'de> {
20862 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
20863 match self.raw.ordinal() {
20864 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireExposeService<'_>>().fmt(f) },
20865 2 => unsafe {
20866 self.raw.get().deref_unchecked::<crate::WireExposeProtocol<'_>>().fmt(f)
20867 },
20868 3 => unsafe {
20869 self.raw.get().deref_unchecked::<crate::WireExposeDirectory<'_>>().fmt(f)
20870 },
20871 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireExposeRunner<'_>>().fmt(f) },
20872 5 => unsafe {
20873 self.raw.get().deref_unchecked::<crate::WireExposeResolver<'_>>().fmt(f)
20874 },
20875 7 => unsafe {
20876 self.raw.get().deref_unchecked::<crate::WireExposeDictionary<'_>>().fmt(f)
20877 },
20878 8 => unsafe {
20879 self.raw.get().deref_unchecked::<crate::WireExposeConfiguration<'_>>().fmt(f)
20880 },
20881 _ => unsafe { ::core::hint::unreachable_unchecked() },
20882 }
20883 }
20884}
20885
20886#[repr(transparent)]
20887pub struct WireOptionalExpose<'de> {
20888 raw: ::fidl_next::RawWireUnion,
20889 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
20890}
20891
20892unsafe impl ::fidl_next::Wire for WireOptionalExpose<'static> {
20893 type Decoded<'de> = WireOptionalExpose<'de>;
20894
20895 #[inline]
20896 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
20897 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
20898 ::fidl_next::RawWireUnion::zero_padding(raw);
20899 }
20900}
20901
20902impl<'de> WireOptionalExpose<'de> {
20903 pub fn is_some(&self) -> bool {
20904 self.raw.is_some()
20905 }
20906
20907 pub fn is_none(&self) -> bool {
20908 self.raw.is_none()
20909 }
20910
20911 pub fn as_ref(&self) -> Option<&WireExpose<'de>> {
20912 if self.is_some() {
20913 Some(unsafe { &*(self as *const Self).cast() })
20914 } else {
20915 None
20916 }
20917 }
20918
20919 pub fn into_option(self) -> Option<WireExpose<'de>> {
20920 if self.is_some() {
20921 Some(WireExpose { raw: self.raw, _phantom: ::core::marker::PhantomData })
20922 } else {
20923 None
20924 }
20925 }
20926}
20927
20928unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExpose<'static>
20929where
20930 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
20931
20932 ___D: ::fidl_next::Decoder,
20933{
20934 fn decode(
20935 mut slot: ::fidl_next::Slot<'_, Self>,
20936 decoder: &mut ___D,
20937 ) -> Result<(), ::fidl_next::DecodeError> {
20938 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
20939 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
20940 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeService<'static>>(
20941 raw, decoder,
20942 )?,
20943
20944 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeProtocol<'static>>(
20945 raw, decoder,
20946 )?,
20947
20948 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeDirectory<'static>>(
20949 raw, decoder,
20950 )?,
20951
20952 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeRunner<'static>>(
20953 raw, decoder,
20954 )?,
20955
20956 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeResolver<'static>>(
20957 raw, decoder,
20958 )?,
20959
20960 7 => {
20961 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeDictionary<'static>>(
20962 raw, decoder,
20963 )?
20964 }
20965
20966 8 => ::fidl_next::RawWireUnion::decode_as::<
20967 ___D,
20968 crate::WireExposeConfiguration<'static>,
20969 >(raw, decoder)?,
20970
20971 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
20972 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
20973 }
20974
20975 Ok(())
20976 }
20977}
20978
20979impl<'de> ::core::fmt::Debug for WireOptionalExpose<'de> {
20980 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
20981 self.as_ref().fmt(f)
20982 }
20983}
20984
20985#[doc = " Declares a service offered by a component to one of its children, which may\n have been offered by the component\'s containing realm, the component itself,\n or one of its other children.\n\n To learn more about services, see:\n https://fuchsia.dev/fuchsia-src/glossary#service\n"]
20986#[derive(Clone, Debug, Default)]
20987pub struct OfferService {
20988 pub source: Option<crate::Ref>,
20989
20990 pub source_name: Option<String>,
20991
20992 pub target: Option<crate::Ref>,
20993
20994 pub target_name: Option<String>,
20995
20996 pub source_instance_filter: Option<Vec<String>>,
20997
20998 pub renamed_instances: Option<Vec<crate::NameMapping>>,
20999
21000 pub availability: Option<crate::Availability>,
21001
21002 pub source_dictionary: Option<String>,
21003
21004 pub dependency_type: Option<crate::DependencyType>,
21005}
21006
21007impl OfferService {
21008 fn __max_ordinal(&self) -> usize {
21009 if self.dependency_type.is_some() {
21010 return 9;
21011 }
21012
21013 if self.source_dictionary.is_some() {
21014 return 8;
21015 }
21016
21017 if self.availability.is_some() {
21018 return 7;
21019 }
21020
21021 if self.renamed_instances.is_some() {
21022 return 6;
21023 }
21024
21025 if self.source_instance_filter.is_some() {
21026 return 5;
21027 }
21028
21029 if self.target_name.is_some() {
21030 return 4;
21031 }
21032
21033 if self.target.is_some() {
21034 return 3;
21035 }
21036
21037 if self.source_name.is_some() {
21038 return 2;
21039 }
21040
21041 if self.source.is_some() {
21042 return 1;
21043 }
21044
21045 0
21046 }
21047}
21048
21049impl ::fidl_next::Encodable for OfferService {
21050 type Encoded = WireOfferService<'static>;
21051}
21052
21053unsafe impl<___E> ::fidl_next::Encode<___E> for OfferService
21054where
21055 ___E: ::fidl_next::Encoder + ?Sized,
21056{
21057 #[inline]
21058 fn encode(
21059 mut self,
21060 encoder: &mut ___E,
21061 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
21062 ) -> Result<(), ::fidl_next::EncodeError> {
21063 ::fidl_next::munge!(let WireOfferService { table } = out);
21064
21065 let max_ord = self.__max_ordinal();
21066
21067 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
21068 ::fidl_next::Wire::zero_padding(&mut out);
21069
21070 let mut preallocated =
21071 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
21072
21073 for i in 1..=max_ord {
21074 match i {
21075 9 => {
21076 if let Some(dependency_type) = self.dependency_type.take() {
21077 ::fidl_next::WireEnvelope::encode_value(
21078 dependency_type,
21079 preallocated.encoder,
21080 &mut out,
21081 )?;
21082 } else {
21083 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21084 }
21085 }
21086
21087 8 => {
21088 if let Some(source_dictionary) = self.source_dictionary.take() {
21089 ::fidl_next::WireEnvelope::encode_value(
21090 source_dictionary,
21091 preallocated.encoder,
21092 &mut out,
21093 )?;
21094 } else {
21095 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21096 }
21097 }
21098
21099 7 => {
21100 if let Some(availability) = self.availability.take() {
21101 ::fidl_next::WireEnvelope::encode_value(
21102 availability,
21103 preallocated.encoder,
21104 &mut out,
21105 )?;
21106 } else {
21107 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21108 }
21109 }
21110
21111 6 => {
21112 if let Some(renamed_instances) = self.renamed_instances.take() {
21113 ::fidl_next::WireEnvelope::encode_value(
21114 renamed_instances,
21115 preallocated.encoder,
21116 &mut out,
21117 )?;
21118 } else {
21119 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21120 }
21121 }
21122
21123 5 => {
21124 if let Some(source_instance_filter) = self.source_instance_filter.take() {
21125 ::fidl_next::WireEnvelope::encode_value(
21126 source_instance_filter,
21127 preallocated.encoder,
21128 &mut out,
21129 )?;
21130 } else {
21131 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21132 }
21133 }
21134
21135 4 => {
21136 if let Some(target_name) = self.target_name.take() {
21137 ::fidl_next::WireEnvelope::encode_value(
21138 target_name,
21139 preallocated.encoder,
21140 &mut out,
21141 )?;
21142 } else {
21143 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21144 }
21145 }
21146
21147 3 => {
21148 if let Some(target) = self.target.take() {
21149 ::fidl_next::WireEnvelope::encode_value(
21150 target,
21151 preallocated.encoder,
21152 &mut out,
21153 )?;
21154 } else {
21155 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21156 }
21157 }
21158
21159 2 => {
21160 if let Some(source_name) = self.source_name.take() {
21161 ::fidl_next::WireEnvelope::encode_value(
21162 source_name,
21163 preallocated.encoder,
21164 &mut out,
21165 )?;
21166 } else {
21167 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21168 }
21169 }
21170
21171 1 => {
21172 if let Some(source) = self.source.take() {
21173 ::fidl_next::WireEnvelope::encode_value(
21174 source,
21175 preallocated.encoder,
21176 &mut out,
21177 )?;
21178 } else {
21179 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21180 }
21181 }
21182
21183 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
21184 }
21185 unsafe {
21186 preallocated.write_next(out.assume_init_ref());
21187 }
21188 }
21189
21190 ::fidl_next::WireTable::encode_len(table, max_ord);
21191
21192 Ok(())
21193 }
21194}
21195
21196unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferService
21197where
21198 ___E: ::fidl_next::Encoder + ?Sized,
21199{
21200 #[inline]
21201 fn encode_ref(
21202 &self,
21203 encoder: &mut ___E,
21204 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
21205 ) -> Result<(), ::fidl_next::EncodeError> {
21206 ::fidl_next::munge!(let WireOfferService { table } = out);
21207
21208 let max_ord = self.__max_ordinal();
21209
21210 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
21211 ::fidl_next::Wire::zero_padding(&mut out);
21212
21213 let mut preallocated =
21214 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
21215
21216 for i in 1..=max_ord {
21217 match i {
21218 9 => {
21219 if let Some(dependency_type) = &self.dependency_type {
21220 ::fidl_next::WireEnvelope::encode_value(
21221 dependency_type,
21222 preallocated.encoder,
21223 &mut out,
21224 )?;
21225 } else {
21226 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21227 }
21228 }
21229
21230 8 => {
21231 if let Some(source_dictionary) = &self.source_dictionary {
21232 ::fidl_next::WireEnvelope::encode_value(
21233 source_dictionary,
21234 preallocated.encoder,
21235 &mut out,
21236 )?;
21237 } else {
21238 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21239 }
21240 }
21241
21242 7 => {
21243 if let Some(availability) = &self.availability {
21244 ::fidl_next::WireEnvelope::encode_value(
21245 availability,
21246 preallocated.encoder,
21247 &mut out,
21248 )?;
21249 } else {
21250 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21251 }
21252 }
21253
21254 6 => {
21255 if let Some(renamed_instances) = &self.renamed_instances {
21256 ::fidl_next::WireEnvelope::encode_value(
21257 renamed_instances,
21258 preallocated.encoder,
21259 &mut out,
21260 )?;
21261 } else {
21262 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21263 }
21264 }
21265
21266 5 => {
21267 if let Some(source_instance_filter) = &self.source_instance_filter {
21268 ::fidl_next::WireEnvelope::encode_value(
21269 source_instance_filter,
21270 preallocated.encoder,
21271 &mut out,
21272 )?;
21273 } else {
21274 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21275 }
21276 }
21277
21278 4 => {
21279 if let Some(target_name) = &self.target_name {
21280 ::fidl_next::WireEnvelope::encode_value(
21281 target_name,
21282 preallocated.encoder,
21283 &mut out,
21284 )?;
21285 } else {
21286 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21287 }
21288 }
21289
21290 3 => {
21291 if let Some(target) = &self.target {
21292 ::fidl_next::WireEnvelope::encode_value(
21293 target,
21294 preallocated.encoder,
21295 &mut out,
21296 )?;
21297 } else {
21298 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21299 }
21300 }
21301
21302 2 => {
21303 if let Some(source_name) = &self.source_name {
21304 ::fidl_next::WireEnvelope::encode_value(
21305 source_name,
21306 preallocated.encoder,
21307 &mut out,
21308 )?;
21309 } else {
21310 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21311 }
21312 }
21313
21314 1 => {
21315 if let Some(source) = &self.source {
21316 ::fidl_next::WireEnvelope::encode_value(
21317 source,
21318 preallocated.encoder,
21319 &mut out,
21320 )?;
21321 } else {
21322 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21323 }
21324 }
21325
21326 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
21327 }
21328 unsafe {
21329 preallocated.write_next(out.assume_init_ref());
21330 }
21331 }
21332
21333 ::fidl_next::WireTable::encode_len(table, max_ord);
21334
21335 Ok(())
21336 }
21337}
21338
21339impl<'de> ::fidl_next::FromWire<WireOfferService<'de>> for OfferService {
21340 #[inline]
21341 fn from_wire(wire: WireOfferService<'de>) -> Self {
21342 let wire = ::core::mem::ManuallyDrop::new(wire);
21343
21344 let source = wire.table.get(1);
21345
21346 let source_name = wire.table.get(2);
21347
21348 let target = wire.table.get(3);
21349
21350 let target_name = wire.table.get(4);
21351
21352 let source_instance_filter = wire.table.get(5);
21353
21354 let renamed_instances = wire.table.get(6);
21355
21356 let availability = wire.table.get(7);
21357
21358 let source_dictionary = wire.table.get(8);
21359
21360 let dependency_type = wire.table.get(9);
21361
21362 Self {
21363
21364
21365 source: source.map(|envelope| ::fidl_next::FromWire::from_wire(
21366 unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() }
21367 )),
21368
21369
21370 source_name: source_name.map(|envelope| ::fidl_next::FromWire::from_wire(
21371 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
21372 )),
21373
21374
21375 target: target.map(|envelope| ::fidl_next::FromWire::from_wire(
21376 unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() }
21377 )),
21378
21379
21380 target_name: target_name.map(|envelope| ::fidl_next::FromWire::from_wire(
21381 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
21382 )),
21383
21384
21385 source_instance_filter: source_instance_filter.map(|envelope| ::fidl_next::FromWire::from_wire(
21386 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() }
21387 )),
21388
21389
21390 renamed_instances: renamed_instances.map(|envelope| ::fidl_next::FromWire::from_wire(
21391 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNameMapping<'de>>>() }
21392 )),
21393
21394
21395 availability: availability.map(|envelope| ::fidl_next::FromWire::from_wire(
21396 unsafe { envelope.read_unchecked::<crate::WireAvailability>() }
21397 )),
21398
21399
21400 source_dictionary: source_dictionary.map(|envelope| ::fidl_next::FromWire::from_wire(
21401 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
21402 )),
21403
21404
21405 dependency_type: dependency_type.map(|envelope| ::fidl_next::FromWire::from_wire(
21406 unsafe { envelope.read_unchecked::<crate::WireDependencyType>() }
21407 )),
21408
21409 }
21410 }
21411}
21412
21413impl<'de> ::fidl_next::FromWireRef<WireOfferService<'de>> for OfferService {
21414 #[inline]
21415 fn from_wire_ref(wire: &WireOfferService<'de>) -> Self {
21416 Self {
21417
21418
21419 source: wire.table.get(1)
21420 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21421 unsafe { envelope.deref_unchecked::<crate::WireRef<'de>>() }
21422 )),
21423
21424
21425 source_name: wire.table.get(2)
21426 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21427 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
21428 )),
21429
21430
21431 target: wire.table.get(3)
21432 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21433 unsafe { envelope.deref_unchecked::<crate::WireRef<'de>>() }
21434 )),
21435
21436
21437 target_name: wire.table.get(4)
21438 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21439 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
21440 )),
21441
21442
21443 source_instance_filter: wire.table.get(5)
21444 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21445 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() }
21446 )),
21447
21448
21449 renamed_instances: wire.table.get(6)
21450 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21451 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireNameMapping<'de>>>() }
21452 )),
21453
21454
21455 availability: wire.table.get(7)
21456 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21457 unsafe { envelope.deref_unchecked::<crate::WireAvailability>() }
21458 )),
21459
21460
21461 source_dictionary: wire.table.get(8)
21462 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21463 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
21464 )),
21465
21466
21467 dependency_type: wire.table.get(9)
21468 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
21469 unsafe { envelope.deref_unchecked::<crate::WireDependencyType>() }
21470 )),
21471
21472 }
21473 }
21474}
21475
21476#[repr(C)]
21478pub struct WireOfferService<'de> {
21479 table: ::fidl_next::WireTable<'de>,
21480}
21481
21482impl<'de> Drop for WireOfferService<'de> {
21483 fn drop(&mut self) {
21484 let _ = self
21485 .table
21486 .get(1)
21487 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
21488
21489 let _ = self
21490 .table
21491 .get(2)
21492 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
21493
21494 let _ = self
21495 .table
21496 .get(3)
21497 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
21498
21499 let _ = self
21500 .table
21501 .get(4)
21502 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
21503
21504 let _ = self.table.get(5).map(|envelope| unsafe {
21505 envelope.read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
21506 });
21507
21508 let _ = self.table.get(6).map(|envelope| unsafe {
21509 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireNameMapping<'de>>>()
21510 });
21511
21512 let _ = self
21513 .table
21514 .get(7)
21515 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
21516
21517 let _ = self
21518 .table
21519 .get(8)
21520 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
21521
21522 let _ = self
21523 .table
21524 .get(9)
21525 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDependencyType>() });
21526 }
21527}
21528
21529unsafe impl ::fidl_next::Wire for WireOfferService<'static> {
21530 type Decoded<'de> = WireOfferService<'de>;
21531
21532 #[inline]
21533 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
21534 ::fidl_next::munge!(let Self { table } = out);
21535 ::fidl_next::WireTable::zero_padding(table);
21536 }
21537}
21538
21539unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferService<'static>
21540where
21541 ___D: ::fidl_next::Decoder + ?Sized,
21542{
21543 fn decode(
21544 slot: ::fidl_next::Slot<'_, Self>,
21545 decoder: &mut ___D,
21546 ) -> Result<(), ::fidl_next::DecodeError> {
21547 ::fidl_next::munge!(let Self { table } = slot);
21548
21549 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
21550 match ordinal {
21551 0 => unsafe { ::core::hint::unreachable_unchecked() },
21552
21553 1 => {
21554 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
21555 slot.as_mut(),
21556 decoder,
21557 )?;
21558
21559 Ok(())
21560 }
21561
21562 2 => {
21563 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
21564 slot.as_mut(),
21565 decoder,
21566 )?;
21567
21568 let source_name = unsafe {
21569 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
21570 };
21571
21572 if source_name.len() > 100 {
21573 return Err(::fidl_next::DecodeError::VectorTooLong {
21574 size: source_name.len() as u64,
21575 limit: 100,
21576 });
21577 }
21578
21579 Ok(())
21580 }
21581
21582 3 => {
21583 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
21584 slot.as_mut(),
21585 decoder,
21586 )?;
21587
21588 Ok(())
21589 }
21590
21591 4 => {
21592 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
21593 slot.as_mut(),
21594 decoder,
21595 )?;
21596
21597 let target_name = unsafe {
21598 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
21599 };
21600
21601 if target_name.len() > 100 {
21602 return Err(::fidl_next::DecodeError::VectorTooLong {
21603 size: target_name.len() as u64,
21604 limit: 100,
21605 });
21606 }
21607
21608 Ok(())
21609 }
21610
21611 5 => {
21612 ::fidl_next::WireEnvelope::decode_as::<
21613 ___D,
21614 ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
21615 >(slot.as_mut(), decoder)?;
21616
21617 Ok(())
21618 }
21619
21620 6 => {
21621 ::fidl_next::WireEnvelope::decode_as::<
21622 ___D,
21623 ::fidl_next::WireVector<'static, crate::WireNameMapping<'static>>,
21624 >(slot.as_mut(), decoder)?;
21625
21626 Ok(())
21627 }
21628
21629 7 => {
21630 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
21631 slot.as_mut(),
21632 decoder,
21633 )?;
21634
21635 Ok(())
21636 }
21637
21638 8 => {
21639 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
21640 slot.as_mut(),
21641 decoder,
21642 )?;
21643
21644 let source_dictionary = unsafe {
21645 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
21646 };
21647
21648 if source_dictionary.len() > 1024 {
21649 return Err(::fidl_next::DecodeError::VectorTooLong {
21650 size: source_dictionary.len() as u64,
21651 limit: 1024,
21652 });
21653 }
21654
21655 Ok(())
21656 }
21657
21658 9 => {
21659 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
21660 slot.as_mut(),
21661 decoder,
21662 )?;
21663
21664 Ok(())
21665 }
21666
21667 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
21668 }
21669 })
21670 }
21671}
21672
21673impl<'de> WireOfferService<'de> {
21674 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
21675 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
21676 }
21677
21678 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
21679 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
21680 }
21681
21682 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
21683 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
21684 }
21685
21686 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
21687 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
21688 }
21689
21690 pub fn source_instance_filter(
21691 &self,
21692 ) -> Option<&::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>> {
21693 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
21694 }
21695
21696 pub fn renamed_instances(
21697 &self,
21698 ) -> Option<&::fidl_next::WireVector<'de, crate::WireNameMapping<'de>>> {
21699 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
21700 }
21701
21702 pub fn availability(&self) -> Option<&crate::WireAvailability> {
21703 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
21704 }
21705
21706 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
21707 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
21708 }
21709
21710 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
21711 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
21712 }
21713}
21714
21715impl<'de> ::core::fmt::Debug for WireOfferService<'de> {
21716 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
21717 f.debug_struct("OfferService")
21718 .field("source", &self.source())
21719 .field("source_name", &self.source_name())
21720 .field("target", &self.target())
21721 .field("target_name", &self.target_name())
21722 .field("source_instance_filter", &self.source_instance_filter())
21723 .field("renamed_instances", &self.renamed_instances())
21724 .field("availability", &self.availability())
21725 .field("source_dictionary", &self.source_dictionary())
21726 .field("dependency_type", &self.dependency_type())
21727 .finish()
21728 }
21729}
21730
21731#[doc = " Declares a protocol offered by a component to one of its children,\n which may have been offered by the component\'s containing realm, the\n component itself, or one of its other children.\n\n To learn more about protocols, see:\n https://fuchsia.dev/fuchsia-src/glossary#protocol\n"]
21732#[derive(Clone, Debug, Default)]
21733pub struct OfferProtocol {
21734 pub source: Option<crate::Ref>,
21735
21736 pub source_name: Option<String>,
21737
21738 pub target: Option<crate::Ref>,
21739
21740 pub target_name: Option<String>,
21741
21742 pub dependency_type: Option<crate::DependencyType>,
21743
21744 pub availability: Option<crate::Availability>,
21745
21746 pub source_dictionary: Option<String>,
21747}
21748
21749impl OfferProtocol {
21750 fn __max_ordinal(&self) -> usize {
21751 if self.source_dictionary.is_some() {
21752 return 7;
21753 }
21754
21755 if self.availability.is_some() {
21756 return 6;
21757 }
21758
21759 if self.dependency_type.is_some() {
21760 return 5;
21761 }
21762
21763 if self.target_name.is_some() {
21764 return 4;
21765 }
21766
21767 if self.target.is_some() {
21768 return 3;
21769 }
21770
21771 if self.source_name.is_some() {
21772 return 2;
21773 }
21774
21775 if self.source.is_some() {
21776 return 1;
21777 }
21778
21779 0
21780 }
21781}
21782
21783impl ::fidl_next::Encodable for OfferProtocol {
21784 type Encoded = WireOfferProtocol<'static>;
21785}
21786
21787unsafe impl<___E> ::fidl_next::Encode<___E> for OfferProtocol
21788where
21789 ___E: ::fidl_next::Encoder + ?Sized,
21790{
21791 #[inline]
21792 fn encode(
21793 mut self,
21794 encoder: &mut ___E,
21795 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
21796 ) -> Result<(), ::fidl_next::EncodeError> {
21797 ::fidl_next::munge!(let WireOfferProtocol { table } = out);
21798
21799 let max_ord = self.__max_ordinal();
21800
21801 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
21802 ::fidl_next::Wire::zero_padding(&mut out);
21803
21804 let mut preallocated =
21805 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
21806
21807 for i in 1..=max_ord {
21808 match i {
21809 7 => {
21810 if let Some(source_dictionary) = self.source_dictionary.take() {
21811 ::fidl_next::WireEnvelope::encode_value(
21812 source_dictionary,
21813 preallocated.encoder,
21814 &mut out,
21815 )?;
21816 } else {
21817 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21818 }
21819 }
21820
21821 6 => {
21822 if let Some(availability) = self.availability.take() {
21823 ::fidl_next::WireEnvelope::encode_value(
21824 availability,
21825 preallocated.encoder,
21826 &mut out,
21827 )?;
21828 } else {
21829 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21830 }
21831 }
21832
21833 5 => {
21834 if let Some(dependency_type) = self.dependency_type.take() {
21835 ::fidl_next::WireEnvelope::encode_value(
21836 dependency_type,
21837 preallocated.encoder,
21838 &mut out,
21839 )?;
21840 } else {
21841 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21842 }
21843 }
21844
21845 4 => {
21846 if let Some(target_name) = self.target_name.take() {
21847 ::fidl_next::WireEnvelope::encode_value(
21848 target_name,
21849 preallocated.encoder,
21850 &mut out,
21851 )?;
21852 } else {
21853 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21854 }
21855 }
21856
21857 3 => {
21858 if let Some(target) = self.target.take() {
21859 ::fidl_next::WireEnvelope::encode_value(
21860 target,
21861 preallocated.encoder,
21862 &mut out,
21863 )?;
21864 } else {
21865 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21866 }
21867 }
21868
21869 2 => {
21870 if let Some(source_name) = self.source_name.take() {
21871 ::fidl_next::WireEnvelope::encode_value(
21872 source_name,
21873 preallocated.encoder,
21874 &mut out,
21875 )?;
21876 } else {
21877 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21878 }
21879 }
21880
21881 1 => {
21882 if let Some(source) = self.source.take() {
21883 ::fidl_next::WireEnvelope::encode_value(
21884 source,
21885 preallocated.encoder,
21886 &mut out,
21887 )?;
21888 } else {
21889 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21890 }
21891 }
21892
21893 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
21894 }
21895 unsafe {
21896 preallocated.write_next(out.assume_init_ref());
21897 }
21898 }
21899
21900 ::fidl_next::WireTable::encode_len(table, max_ord);
21901
21902 Ok(())
21903 }
21904}
21905
21906unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferProtocol
21907where
21908 ___E: ::fidl_next::Encoder + ?Sized,
21909{
21910 #[inline]
21911 fn encode_ref(
21912 &self,
21913 encoder: &mut ___E,
21914 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
21915 ) -> Result<(), ::fidl_next::EncodeError> {
21916 ::fidl_next::munge!(let WireOfferProtocol { table } = out);
21917
21918 let max_ord = self.__max_ordinal();
21919
21920 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
21921 ::fidl_next::Wire::zero_padding(&mut out);
21922
21923 let mut preallocated =
21924 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
21925
21926 for i in 1..=max_ord {
21927 match i {
21928 7 => {
21929 if let Some(source_dictionary) = &self.source_dictionary {
21930 ::fidl_next::WireEnvelope::encode_value(
21931 source_dictionary,
21932 preallocated.encoder,
21933 &mut out,
21934 )?;
21935 } else {
21936 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21937 }
21938 }
21939
21940 6 => {
21941 if let Some(availability) = &self.availability {
21942 ::fidl_next::WireEnvelope::encode_value(
21943 availability,
21944 preallocated.encoder,
21945 &mut out,
21946 )?;
21947 } else {
21948 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21949 }
21950 }
21951
21952 5 => {
21953 if let Some(dependency_type) = &self.dependency_type {
21954 ::fidl_next::WireEnvelope::encode_value(
21955 dependency_type,
21956 preallocated.encoder,
21957 &mut out,
21958 )?;
21959 } else {
21960 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21961 }
21962 }
21963
21964 4 => {
21965 if let Some(target_name) = &self.target_name {
21966 ::fidl_next::WireEnvelope::encode_value(
21967 target_name,
21968 preallocated.encoder,
21969 &mut out,
21970 )?;
21971 } else {
21972 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21973 }
21974 }
21975
21976 3 => {
21977 if let Some(target) = &self.target {
21978 ::fidl_next::WireEnvelope::encode_value(
21979 target,
21980 preallocated.encoder,
21981 &mut out,
21982 )?;
21983 } else {
21984 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21985 }
21986 }
21987
21988 2 => {
21989 if let Some(source_name) = &self.source_name {
21990 ::fidl_next::WireEnvelope::encode_value(
21991 source_name,
21992 preallocated.encoder,
21993 &mut out,
21994 )?;
21995 } else {
21996 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21997 }
21998 }
21999
22000 1 => {
22001 if let Some(source) = &self.source {
22002 ::fidl_next::WireEnvelope::encode_value(
22003 source,
22004 preallocated.encoder,
22005 &mut out,
22006 )?;
22007 } else {
22008 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22009 }
22010 }
22011
22012 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22013 }
22014 unsafe {
22015 preallocated.write_next(out.assume_init_ref());
22016 }
22017 }
22018
22019 ::fidl_next::WireTable::encode_len(table, max_ord);
22020
22021 Ok(())
22022 }
22023}
22024
22025impl<'de> ::fidl_next::FromWire<WireOfferProtocol<'de>> for OfferProtocol {
22026 #[inline]
22027 fn from_wire(wire: WireOfferProtocol<'de>) -> Self {
22028 let wire = ::core::mem::ManuallyDrop::new(wire);
22029
22030 let source = wire.table.get(1);
22031
22032 let source_name = wire.table.get(2);
22033
22034 let target = wire.table.get(3);
22035
22036 let target_name = wire.table.get(4);
22037
22038 let dependency_type = wire.table.get(5);
22039
22040 let availability = wire.table.get(6);
22041
22042 let source_dictionary = wire.table.get(7);
22043
22044 Self {
22045 source: source.map(|envelope| {
22046 ::fidl_next::FromWire::from_wire(unsafe {
22047 envelope.read_unchecked::<crate::WireRef<'de>>()
22048 })
22049 }),
22050
22051 source_name: source_name.map(|envelope| {
22052 ::fidl_next::FromWire::from_wire(unsafe {
22053 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
22054 })
22055 }),
22056
22057 target: target.map(|envelope| {
22058 ::fidl_next::FromWire::from_wire(unsafe {
22059 envelope.read_unchecked::<crate::WireRef<'de>>()
22060 })
22061 }),
22062
22063 target_name: target_name.map(|envelope| {
22064 ::fidl_next::FromWire::from_wire(unsafe {
22065 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
22066 })
22067 }),
22068
22069 dependency_type: dependency_type.map(|envelope| {
22070 ::fidl_next::FromWire::from_wire(unsafe {
22071 envelope.read_unchecked::<crate::WireDependencyType>()
22072 })
22073 }),
22074
22075 availability: availability.map(|envelope| {
22076 ::fidl_next::FromWire::from_wire(unsafe {
22077 envelope.read_unchecked::<crate::WireAvailability>()
22078 })
22079 }),
22080
22081 source_dictionary: source_dictionary.map(|envelope| {
22082 ::fidl_next::FromWire::from_wire(unsafe {
22083 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
22084 })
22085 }),
22086 }
22087 }
22088}
22089
22090impl<'de> ::fidl_next::FromWireRef<WireOfferProtocol<'de>> for OfferProtocol {
22091 #[inline]
22092 fn from_wire_ref(wire: &WireOfferProtocol<'de>) -> Self {
22093 Self {
22094 source: wire.table.get(1).map(|envelope| {
22095 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22096 envelope.deref_unchecked::<crate::WireRef<'de>>()
22097 })
22098 }),
22099
22100 source_name: wire.table.get(2).map(|envelope| {
22101 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22102 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
22103 })
22104 }),
22105
22106 target: wire.table.get(3).map(|envelope| {
22107 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22108 envelope.deref_unchecked::<crate::WireRef<'de>>()
22109 })
22110 }),
22111
22112 target_name: wire.table.get(4).map(|envelope| {
22113 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22114 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
22115 })
22116 }),
22117
22118 dependency_type: wire.table.get(5).map(|envelope| {
22119 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22120 envelope.deref_unchecked::<crate::WireDependencyType>()
22121 })
22122 }),
22123
22124 availability: wire.table.get(6).map(|envelope| {
22125 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22126 envelope.deref_unchecked::<crate::WireAvailability>()
22127 })
22128 }),
22129
22130 source_dictionary: wire.table.get(7).map(|envelope| {
22131 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22132 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
22133 })
22134 }),
22135 }
22136 }
22137}
22138
22139#[repr(C)]
22141pub struct WireOfferProtocol<'de> {
22142 table: ::fidl_next::WireTable<'de>,
22143}
22144
22145impl<'de> Drop for WireOfferProtocol<'de> {
22146 fn drop(&mut self) {
22147 let _ = self
22148 .table
22149 .get(1)
22150 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
22151
22152 let _ = self
22153 .table
22154 .get(2)
22155 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
22156
22157 let _ = self
22158 .table
22159 .get(3)
22160 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
22161
22162 let _ = self
22163 .table
22164 .get(4)
22165 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
22166
22167 let _ = self
22168 .table
22169 .get(5)
22170 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDependencyType>() });
22171
22172 let _ = self
22173 .table
22174 .get(6)
22175 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
22176
22177 let _ = self
22178 .table
22179 .get(7)
22180 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
22181 }
22182}
22183
22184unsafe impl ::fidl_next::Wire for WireOfferProtocol<'static> {
22185 type Decoded<'de> = WireOfferProtocol<'de>;
22186
22187 #[inline]
22188 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
22189 ::fidl_next::munge!(let Self { table } = out);
22190 ::fidl_next::WireTable::zero_padding(table);
22191 }
22192}
22193
22194unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferProtocol<'static>
22195where
22196 ___D: ::fidl_next::Decoder + ?Sized,
22197{
22198 fn decode(
22199 slot: ::fidl_next::Slot<'_, Self>,
22200 decoder: &mut ___D,
22201 ) -> Result<(), ::fidl_next::DecodeError> {
22202 ::fidl_next::munge!(let Self { table } = slot);
22203
22204 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
22205 match ordinal {
22206 0 => unsafe { ::core::hint::unreachable_unchecked() },
22207
22208 1 => {
22209 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
22210 slot.as_mut(),
22211 decoder,
22212 )?;
22213
22214 Ok(())
22215 }
22216
22217 2 => {
22218 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
22219 slot.as_mut(),
22220 decoder,
22221 )?;
22222
22223 let source_name = unsafe {
22224 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
22225 };
22226
22227 if source_name.len() > 100 {
22228 return Err(::fidl_next::DecodeError::VectorTooLong {
22229 size: source_name.len() as u64,
22230 limit: 100,
22231 });
22232 }
22233
22234 Ok(())
22235 }
22236
22237 3 => {
22238 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
22239 slot.as_mut(),
22240 decoder,
22241 )?;
22242
22243 Ok(())
22244 }
22245
22246 4 => {
22247 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
22248 slot.as_mut(),
22249 decoder,
22250 )?;
22251
22252 let target_name = unsafe {
22253 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
22254 };
22255
22256 if target_name.len() > 100 {
22257 return Err(::fidl_next::DecodeError::VectorTooLong {
22258 size: target_name.len() as u64,
22259 limit: 100,
22260 });
22261 }
22262
22263 Ok(())
22264 }
22265
22266 5 => {
22267 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
22268 slot.as_mut(),
22269 decoder,
22270 )?;
22271
22272 Ok(())
22273 }
22274
22275 6 => {
22276 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
22277 slot.as_mut(),
22278 decoder,
22279 )?;
22280
22281 Ok(())
22282 }
22283
22284 7 => {
22285 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
22286 slot.as_mut(),
22287 decoder,
22288 )?;
22289
22290 let source_dictionary = unsafe {
22291 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
22292 };
22293
22294 if source_dictionary.len() > 1024 {
22295 return Err(::fidl_next::DecodeError::VectorTooLong {
22296 size: source_dictionary.len() as u64,
22297 limit: 1024,
22298 });
22299 }
22300
22301 Ok(())
22302 }
22303
22304 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
22305 }
22306 })
22307 }
22308}
22309
22310impl<'de> WireOfferProtocol<'de> {
22311 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
22312 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
22313 }
22314
22315 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
22316 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
22317 }
22318
22319 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
22320 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
22321 }
22322
22323 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
22324 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
22325 }
22326
22327 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
22328 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
22329 }
22330
22331 pub fn availability(&self) -> Option<&crate::WireAvailability> {
22332 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
22333 }
22334
22335 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
22336 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
22337 }
22338}
22339
22340impl<'de> ::core::fmt::Debug for WireOfferProtocol<'de> {
22341 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
22342 f.debug_struct("OfferProtocol")
22343 .field("source", &self.source())
22344 .field("source_name", &self.source_name())
22345 .field("target", &self.target())
22346 .field("target_name", &self.target_name())
22347 .field("dependency_type", &self.dependency_type())
22348 .field("availability", &self.availability())
22349 .field("source_dictionary", &self.source_dictionary())
22350 .finish()
22351 }
22352}
22353
22354#[doc = " Declares a directory offered by a component to one of its children, which\n may have been offered by the component\'s containing realm, the component\n itself, or one of its other children.\n"]
22355#[derive(Clone, Debug, Default)]
22356pub struct OfferDirectory {
22357 pub source: Option<crate::Ref>,
22358
22359 pub source_name: Option<String>,
22360
22361 pub target: Option<crate::Ref>,
22362
22363 pub target_name: Option<String>,
22364
22365 pub rights: Option<::fidl_next_fuchsia_io::Operations>,
22366
22367 pub subdir: Option<String>,
22368
22369 pub dependency_type: Option<crate::DependencyType>,
22370
22371 pub availability: Option<crate::Availability>,
22372
22373 pub source_dictionary: Option<String>,
22374}
22375
22376impl OfferDirectory {
22377 fn __max_ordinal(&self) -> usize {
22378 if self.source_dictionary.is_some() {
22379 return 9;
22380 }
22381
22382 if self.availability.is_some() {
22383 return 8;
22384 }
22385
22386 if self.dependency_type.is_some() {
22387 return 7;
22388 }
22389
22390 if self.subdir.is_some() {
22391 return 6;
22392 }
22393
22394 if self.rights.is_some() {
22395 return 5;
22396 }
22397
22398 if self.target_name.is_some() {
22399 return 4;
22400 }
22401
22402 if self.target.is_some() {
22403 return 3;
22404 }
22405
22406 if self.source_name.is_some() {
22407 return 2;
22408 }
22409
22410 if self.source.is_some() {
22411 return 1;
22412 }
22413
22414 0
22415 }
22416}
22417
22418impl ::fidl_next::Encodable for OfferDirectory {
22419 type Encoded = WireOfferDirectory<'static>;
22420}
22421
22422unsafe impl<___E> ::fidl_next::Encode<___E> for OfferDirectory
22423where
22424 ___E: ::fidl_next::Encoder + ?Sized,
22425{
22426 #[inline]
22427 fn encode(
22428 mut self,
22429 encoder: &mut ___E,
22430 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22431 ) -> Result<(), ::fidl_next::EncodeError> {
22432 ::fidl_next::munge!(let WireOfferDirectory { table } = out);
22433
22434 let max_ord = self.__max_ordinal();
22435
22436 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
22437 ::fidl_next::Wire::zero_padding(&mut out);
22438
22439 let mut preallocated =
22440 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
22441
22442 for i in 1..=max_ord {
22443 match i {
22444 9 => {
22445 if let Some(source_dictionary) = self.source_dictionary.take() {
22446 ::fidl_next::WireEnvelope::encode_value(
22447 source_dictionary,
22448 preallocated.encoder,
22449 &mut out,
22450 )?;
22451 } else {
22452 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22453 }
22454 }
22455
22456 8 => {
22457 if let Some(availability) = self.availability.take() {
22458 ::fidl_next::WireEnvelope::encode_value(
22459 availability,
22460 preallocated.encoder,
22461 &mut out,
22462 )?;
22463 } else {
22464 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22465 }
22466 }
22467
22468 7 => {
22469 if let Some(dependency_type) = self.dependency_type.take() {
22470 ::fidl_next::WireEnvelope::encode_value(
22471 dependency_type,
22472 preallocated.encoder,
22473 &mut out,
22474 )?;
22475 } else {
22476 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22477 }
22478 }
22479
22480 6 => {
22481 if let Some(subdir) = self.subdir.take() {
22482 ::fidl_next::WireEnvelope::encode_value(
22483 subdir,
22484 preallocated.encoder,
22485 &mut out,
22486 )?;
22487 } else {
22488 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22489 }
22490 }
22491
22492 5 => {
22493 if let Some(rights) = self.rights.take() {
22494 ::fidl_next::WireEnvelope::encode_value(
22495 rights,
22496 preallocated.encoder,
22497 &mut out,
22498 )?;
22499 } else {
22500 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22501 }
22502 }
22503
22504 4 => {
22505 if let Some(target_name) = self.target_name.take() {
22506 ::fidl_next::WireEnvelope::encode_value(
22507 target_name,
22508 preallocated.encoder,
22509 &mut out,
22510 )?;
22511 } else {
22512 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22513 }
22514 }
22515
22516 3 => {
22517 if let Some(target) = self.target.take() {
22518 ::fidl_next::WireEnvelope::encode_value(
22519 target,
22520 preallocated.encoder,
22521 &mut out,
22522 )?;
22523 } else {
22524 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22525 }
22526 }
22527
22528 2 => {
22529 if let Some(source_name) = self.source_name.take() {
22530 ::fidl_next::WireEnvelope::encode_value(
22531 source_name,
22532 preallocated.encoder,
22533 &mut out,
22534 )?;
22535 } else {
22536 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22537 }
22538 }
22539
22540 1 => {
22541 if let Some(source) = self.source.take() {
22542 ::fidl_next::WireEnvelope::encode_value(
22543 source,
22544 preallocated.encoder,
22545 &mut out,
22546 )?;
22547 } else {
22548 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22549 }
22550 }
22551
22552 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22553 }
22554 unsafe {
22555 preallocated.write_next(out.assume_init_ref());
22556 }
22557 }
22558
22559 ::fidl_next::WireTable::encode_len(table, max_ord);
22560
22561 Ok(())
22562 }
22563}
22564
22565unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferDirectory
22566where
22567 ___E: ::fidl_next::Encoder + ?Sized,
22568{
22569 #[inline]
22570 fn encode_ref(
22571 &self,
22572 encoder: &mut ___E,
22573 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22574 ) -> Result<(), ::fidl_next::EncodeError> {
22575 ::fidl_next::munge!(let WireOfferDirectory { table } = out);
22576
22577 let max_ord = self.__max_ordinal();
22578
22579 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
22580 ::fidl_next::Wire::zero_padding(&mut out);
22581
22582 let mut preallocated =
22583 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
22584
22585 for i in 1..=max_ord {
22586 match i {
22587 9 => {
22588 if let Some(source_dictionary) = &self.source_dictionary {
22589 ::fidl_next::WireEnvelope::encode_value(
22590 source_dictionary,
22591 preallocated.encoder,
22592 &mut out,
22593 )?;
22594 } else {
22595 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22596 }
22597 }
22598
22599 8 => {
22600 if let Some(availability) = &self.availability {
22601 ::fidl_next::WireEnvelope::encode_value(
22602 availability,
22603 preallocated.encoder,
22604 &mut out,
22605 )?;
22606 } else {
22607 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22608 }
22609 }
22610
22611 7 => {
22612 if let Some(dependency_type) = &self.dependency_type {
22613 ::fidl_next::WireEnvelope::encode_value(
22614 dependency_type,
22615 preallocated.encoder,
22616 &mut out,
22617 )?;
22618 } else {
22619 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22620 }
22621 }
22622
22623 6 => {
22624 if let Some(subdir) = &self.subdir {
22625 ::fidl_next::WireEnvelope::encode_value(
22626 subdir,
22627 preallocated.encoder,
22628 &mut out,
22629 )?;
22630 } else {
22631 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22632 }
22633 }
22634
22635 5 => {
22636 if let Some(rights) = &self.rights {
22637 ::fidl_next::WireEnvelope::encode_value(
22638 rights,
22639 preallocated.encoder,
22640 &mut out,
22641 )?;
22642 } else {
22643 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22644 }
22645 }
22646
22647 4 => {
22648 if let Some(target_name) = &self.target_name {
22649 ::fidl_next::WireEnvelope::encode_value(
22650 target_name,
22651 preallocated.encoder,
22652 &mut out,
22653 )?;
22654 } else {
22655 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22656 }
22657 }
22658
22659 3 => {
22660 if let Some(target) = &self.target {
22661 ::fidl_next::WireEnvelope::encode_value(
22662 target,
22663 preallocated.encoder,
22664 &mut out,
22665 )?;
22666 } else {
22667 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22668 }
22669 }
22670
22671 2 => {
22672 if let Some(source_name) = &self.source_name {
22673 ::fidl_next::WireEnvelope::encode_value(
22674 source_name,
22675 preallocated.encoder,
22676 &mut out,
22677 )?;
22678 } else {
22679 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22680 }
22681 }
22682
22683 1 => {
22684 if let Some(source) = &self.source {
22685 ::fidl_next::WireEnvelope::encode_value(
22686 source,
22687 preallocated.encoder,
22688 &mut out,
22689 )?;
22690 } else {
22691 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22692 }
22693 }
22694
22695 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22696 }
22697 unsafe {
22698 preallocated.write_next(out.assume_init_ref());
22699 }
22700 }
22701
22702 ::fidl_next::WireTable::encode_len(table, max_ord);
22703
22704 Ok(())
22705 }
22706}
22707
22708impl<'de> ::fidl_next::FromWire<WireOfferDirectory<'de>> for OfferDirectory {
22709 #[inline]
22710 fn from_wire(wire: WireOfferDirectory<'de>) -> Self {
22711 let wire = ::core::mem::ManuallyDrop::new(wire);
22712
22713 let source = wire.table.get(1);
22714
22715 let source_name = wire.table.get(2);
22716
22717 let target = wire.table.get(3);
22718
22719 let target_name = wire.table.get(4);
22720
22721 let rights = wire.table.get(5);
22722
22723 let subdir = wire.table.get(6);
22724
22725 let dependency_type = wire.table.get(7);
22726
22727 let availability = wire.table.get(8);
22728
22729 let source_dictionary = wire.table.get(9);
22730
22731 Self {
22732 source: source.map(|envelope| {
22733 ::fidl_next::FromWire::from_wire(unsafe {
22734 envelope.read_unchecked::<crate::WireRef<'de>>()
22735 })
22736 }),
22737
22738 source_name: source_name.map(|envelope| {
22739 ::fidl_next::FromWire::from_wire(unsafe {
22740 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
22741 })
22742 }),
22743
22744 target: target.map(|envelope| {
22745 ::fidl_next::FromWire::from_wire(unsafe {
22746 envelope.read_unchecked::<crate::WireRef<'de>>()
22747 })
22748 }),
22749
22750 target_name: target_name.map(|envelope| {
22751 ::fidl_next::FromWire::from_wire(unsafe {
22752 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
22753 })
22754 }),
22755
22756 rights: rights.map(|envelope| {
22757 ::fidl_next::FromWire::from_wire(unsafe {
22758 envelope.read_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
22759 })
22760 }),
22761
22762 subdir: subdir.map(|envelope| {
22763 ::fidl_next::FromWire::from_wire(unsafe {
22764 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
22765 })
22766 }),
22767
22768 dependency_type: dependency_type.map(|envelope| {
22769 ::fidl_next::FromWire::from_wire(unsafe {
22770 envelope.read_unchecked::<crate::WireDependencyType>()
22771 })
22772 }),
22773
22774 availability: availability.map(|envelope| {
22775 ::fidl_next::FromWire::from_wire(unsafe {
22776 envelope.read_unchecked::<crate::WireAvailability>()
22777 })
22778 }),
22779
22780 source_dictionary: source_dictionary.map(|envelope| {
22781 ::fidl_next::FromWire::from_wire(unsafe {
22782 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
22783 })
22784 }),
22785 }
22786 }
22787}
22788
22789impl<'de> ::fidl_next::FromWireRef<WireOfferDirectory<'de>> for OfferDirectory {
22790 #[inline]
22791 fn from_wire_ref(wire: &WireOfferDirectory<'de>) -> Self {
22792 Self {
22793 source: wire.table.get(1).map(|envelope| {
22794 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22795 envelope.deref_unchecked::<crate::WireRef<'de>>()
22796 })
22797 }),
22798
22799 source_name: wire.table.get(2).map(|envelope| {
22800 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22801 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
22802 })
22803 }),
22804
22805 target: wire.table.get(3).map(|envelope| {
22806 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22807 envelope.deref_unchecked::<crate::WireRef<'de>>()
22808 })
22809 }),
22810
22811 target_name: wire.table.get(4).map(|envelope| {
22812 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22813 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
22814 })
22815 }),
22816
22817 rights: wire.table.get(5).map(|envelope| {
22818 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22819 envelope.deref_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
22820 })
22821 }),
22822
22823 subdir: wire.table.get(6).map(|envelope| {
22824 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22825 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
22826 })
22827 }),
22828
22829 dependency_type: wire.table.get(7).map(|envelope| {
22830 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22831 envelope.deref_unchecked::<crate::WireDependencyType>()
22832 })
22833 }),
22834
22835 availability: wire.table.get(8).map(|envelope| {
22836 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22837 envelope.deref_unchecked::<crate::WireAvailability>()
22838 })
22839 }),
22840
22841 source_dictionary: wire.table.get(9).map(|envelope| {
22842 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
22843 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
22844 })
22845 }),
22846 }
22847 }
22848}
22849
22850#[repr(C)]
22852pub struct WireOfferDirectory<'de> {
22853 table: ::fidl_next::WireTable<'de>,
22854}
22855
22856impl<'de> Drop for WireOfferDirectory<'de> {
22857 fn drop(&mut self) {
22858 let _ = self
22859 .table
22860 .get(1)
22861 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
22862
22863 let _ = self
22864 .table
22865 .get(2)
22866 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
22867
22868 let _ = self
22869 .table
22870 .get(3)
22871 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
22872
22873 let _ = self
22874 .table
22875 .get(4)
22876 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
22877
22878 let _ = self.table.get(5).map(|envelope| unsafe {
22879 envelope.read_unchecked::<::fidl_next_fuchsia_io::WireOperations>()
22880 });
22881
22882 let _ = self
22883 .table
22884 .get(6)
22885 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
22886
22887 let _ = self
22888 .table
22889 .get(7)
22890 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDependencyType>() });
22891
22892 let _ = self
22893 .table
22894 .get(8)
22895 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
22896
22897 let _ = self
22898 .table
22899 .get(9)
22900 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
22901 }
22902}
22903
22904unsafe impl ::fidl_next::Wire for WireOfferDirectory<'static> {
22905 type Decoded<'de> = WireOfferDirectory<'de>;
22906
22907 #[inline]
22908 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
22909 ::fidl_next::munge!(let Self { table } = out);
22910 ::fidl_next::WireTable::zero_padding(table);
22911 }
22912}
22913
22914unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferDirectory<'static>
22915where
22916 ___D: ::fidl_next::Decoder + ?Sized,
22917{
22918 fn decode(
22919 slot: ::fidl_next::Slot<'_, Self>,
22920 decoder: &mut ___D,
22921 ) -> Result<(), ::fidl_next::DecodeError> {
22922 ::fidl_next::munge!(let Self { table } = slot);
22923
22924 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
22925 match ordinal {
22926 0 => unsafe { ::core::hint::unreachable_unchecked() },
22927
22928 1 => {
22929 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
22930 slot.as_mut(),
22931 decoder,
22932 )?;
22933
22934 Ok(())
22935 }
22936
22937 2 => {
22938 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
22939 slot.as_mut(),
22940 decoder,
22941 )?;
22942
22943 let source_name = unsafe {
22944 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
22945 };
22946
22947 if source_name.len() > 100 {
22948 return Err(::fidl_next::DecodeError::VectorTooLong {
22949 size: source_name.len() as u64,
22950 limit: 100,
22951 });
22952 }
22953
22954 Ok(())
22955 }
22956
22957 3 => {
22958 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
22959 slot.as_mut(),
22960 decoder,
22961 )?;
22962
22963 Ok(())
22964 }
22965
22966 4 => {
22967 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
22968 slot.as_mut(),
22969 decoder,
22970 )?;
22971
22972 let target_name = unsafe {
22973 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
22974 };
22975
22976 if target_name.len() > 100 {
22977 return Err(::fidl_next::DecodeError::VectorTooLong {
22978 size: target_name.len() as u64,
22979 limit: 100,
22980 });
22981 }
22982
22983 Ok(())
22984 }
22985
22986 5 => {
22987 ::fidl_next::WireEnvelope::decode_as::<
22988 ___D,
22989 ::fidl_next_fuchsia_io::WireOperations,
22990 >(slot.as_mut(), decoder)?;
22991
22992 Ok(())
22993 }
22994
22995 6 => {
22996 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
22997 slot.as_mut(),
22998 decoder,
22999 )?;
23000
23001 let subdir = unsafe {
23002 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
23003 };
23004
23005 if subdir.len() > 1024 {
23006 return Err(::fidl_next::DecodeError::VectorTooLong {
23007 size: subdir.len() as u64,
23008 limit: 1024,
23009 });
23010 }
23011
23012 Ok(())
23013 }
23014
23015 7 => {
23016 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
23017 slot.as_mut(),
23018 decoder,
23019 )?;
23020
23021 Ok(())
23022 }
23023
23024 8 => {
23025 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
23026 slot.as_mut(),
23027 decoder,
23028 )?;
23029
23030 Ok(())
23031 }
23032
23033 9 => {
23034 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
23035 slot.as_mut(),
23036 decoder,
23037 )?;
23038
23039 let source_dictionary = unsafe {
23040 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
23041 };
23042
23043 if source_dictionary.len() > 1024 {
23044 return Err(::fidl_next::DecodeError::VectorTooLong {
23045 size: source_dictionary.len() as u64,
23046 limit: 1024,
23047 });
23048 }
23049
23050 Ok(())
23051 }
23052
23053 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
23054 }
23055 })
23056 }
23057}
23058
23059impl<'de> WireOfferDirectory<'de> {
23060 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
23061 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
23062 }
23063
23064 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
23065 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
23066 }
23067
23068 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
23069 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
23070 }
23071
23072 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
23073 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
23074 }
23075
23076 pub fn rights(&self) -> Option<&::fidl_next_fuchsia_io::WireOperations> {
23077 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
23078 }
23079
23080 pub fn subdir(&self) -> Option<&::fidl_next::WireString<'de>> {
23081 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
23082 }
23083
23084 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
23085 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
23086 }
23087
23088 pub fn availability(&self) -> Option<&crate::WireAvailability> {
23089 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
23090 }
23091
23092 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
23093 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
23094 }
23095}
23096
23097impl<'de> ::core::fmt::Debug for WireOfferDirectory<'de> {
23098 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
23099 f.debug_struct("OfferDirectory")
23100 .field("source", &self.source())
23101 .field("source_name", &self.source_name())
23102 .field("target", &self.target())
23103 .field("target_name", &self.target_name())
23104 .field("rights", &self.rights())
23105 .field("subdir", &self.subdir())
23106 .field("dependency_type", &self.dependency_type())
23107 .field("availability", &self.availability())
23108 .field("source_dictionary", &self.source_dictionary())
23109 .finish()
23110 }
23111}
23112
23113#[doc = " Declares a storage capability offered by a component to one of its children,\n such as meta storage offered by the component\'s containing realm or cache\n storage offered by the component itself.\n"]
23114#[derive(Clone, Debug, Default)]
23115pub struct OfferStorage {
23116 pub source_name: Option<String>,
23117
23118 pub source: Option<crate::Ref>,
23119
23120 pub target: Option<crate::Ref>,
23121
23122 pub target_name: Option<String>,
23123
23124 pub availability: Option<crate::Availability>,
23125}
23126
23127impl OfferStorage {
23128 fn __max_ordinal(&self) -> usize {
23129 if self.availability.is_some() {
23130 return 5;
23131 }
23132
23133 if self.target_name.is_some() {
23134 return 4;
23135 }
23136
23137 if self.target.is_some() {
23138 return 3;
23139 }
23140
23141 if self.source.is_some() {
23142 return 2;
23143 }
23144
23145 if self.source_name.is_some() {
23146 return 1;
23147 }
23148
23149 0
23150 }
23151}
23152
23153impl ::fidl_next::Encodable for OfferStorage {
23154 type Encoded = WireOfferStorage<'static>;
23155}
23156
23157unsafe impl<___E> ::fidl_next::Encode<___E> for OfferStorage
23158where
23159 ___E: ::fidl_next::Encoder + ?Sized,
23160{
23161 #[inline]
23162 fn encode(
23163 mut self,
23164 encoder: &mut ___E,
23165 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23166 ) -> Result<(), ::fidl_next::EncodeError> {
23167 ::fidl_next::munge!(let WireOfferStorage { table } = out);
23168
23169 let max_ord = self.__max_ordinal();
23170
23171 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
23172 ::fidl_next::Wire::zero_padding(&mut out);
23173
23174 let mut preallocated =
23175 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
23176
23177 for i in 1..=max_ord {
23178 match i {
23179 5 => {
23180 if let Some(availability) = self.availability.take() {
23181 ::fidl_next::WireEnvelope::encode_value(
23182 availability,
23183 preallocated.encoder,
23184 &mut out,
23185 )?;
23186 } else {
23187 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23188 }
23189 }
23190
23191 4 => {
23192 if let Some(target_name) = self.target_name.take() {
23193 ::fidl_next::WireEnvelope::encode_value(
23194 target_name,
23195 preallocated.encoder,
23196 &mut out,
23197 )?;
23198 } else {
23199 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23200 }
23201 }
23202
23203 3 => {
23204 if let Some(target) = self.target.take() {
23205 ::fidl_next::WireEnvelope::encode_value(
23206 target,
23207 preallocated.encoder,
23208 &mut out,
23209 )?;
23210 } else {
23211 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23212 }
23213 }
23214
23215 2 => {
23216 if let Some(source) = self.source.take() {
23217 ::fidl_next::WireEnvelope::encode_value(
23218 source,
23219 preallocated.encoder,
23220 &mut out,
23221 )?;
23222 } else {
23223 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23224 }
23225 }
23226
23227 1 => {
23228 if let Some(source_name) = self.source_name.take() {
23229 ::fidl_next::WireEnvelope::encode_value(
23230 source_name,
23231 preallocated.encoder,
23232 &mut out,
23233 )?;
23234 } else {
23235 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23236 }
23237 }
23238
23239 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
23240 }
23241 unsafe {
23242 preallocated.write_next(out.assume_init_ref());
23243 }
23244 }
23245
23246 ::fidl_next::WireTable::encode_len(table, max_ord);
23247
23248 Ok(())
23249 }
23250}
23251
23252unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferStorage
23253where
23254 ___E: ::fidl_next::Encoder + ?Sized,
23255{
23256 #[inline]
23257 fn encode_ref(
23258 &self,
23259 encoder: &mut ___E,
23260 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23261 ) -> Result<(), ::fidl_next::EncodeError> {
23262 ::fidl_next::munge!(let WireOfferStorage { table } = out);
23263
23264 let max_ord = self.__max_ordinal();
23265
23266 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
23267 ::fidl_next::Wire::zero_padding(&mut out);
23268
23269 let mut preallocated =
23270 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
23271
23272 for i in 1..=max_ord {
23273 match i {
23274 5 => {
23275 if let Some(availability) = &self.availability {
23276 ::fidl_next::WireEnvelope::encode_value(
23277 availability,
23278 preallocated.encoder,
23279 &mut out,
23280 )?;
23281 } else {
23282 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23283 }
23284 }
23285
23286 4 => {
23287 if let Some(target_name) = &self.target_name {
23288 ::fidl_next::WireEnvelope::encode_value(
23289 target_name,
23290 preallocated.encoder,
23291 &mut out,
23292 )?;
23293 } else {
23294 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23295 }
23296 }
23297
23298 3 => {
23299 if let Some(target) = &self.target {
23300 ::fidl_next::WireEnvelope::encode_value(
23301 target,
23302 preallocated.encoder,
23303 &mut out,
23304 )?;
23305 } else {
23306 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23307 }
23308 }
23309
23310 2 => {
23311 if let Some(source) = &self.source {
23312 ::fidl_next::WireEnvelope::encode_value(
23313 source,
23314 preallocated.encoder,
23315 &mut out,
23316 )?;
23317 } else {
23318 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23319 }
23320 }
23321
23322 1 => {
23323 if let Some(source_name) = &self.source_name {
23324 ::fidl_next::WireEnvelope::encode_value(
23325 source_name,
23326 preallocated.encoder,
23327 &mut out,
23328 )?;
23329 } else {
23330 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23331 }
23332 }
23333
23334 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
23335 }
23336 unsafe {
23337 preallocated.write_next(out.assume_init_ref());
23338 }
23339 }
23340
23341 ::fidl_next::WireTable::encode_len(table, max_ord);
23342
23343 Ok(())
23344 }
23345}
23346
23347impl<'de> ::fidl_next::FromWire<WireOfferStorage<'de>> for OfferStorage {
23348 #[inline]
23349 fn from_wire(wire: WireOfferStorage<'de>) -> Self {
23350 let wire = ::core::mem::ManuallyDrop::new(wire);
23351
23352 let source_name = wire.table.get(1);
23353
23354 let source = wire.table.get(2);
23355
23356 let target = wire.table.get(3);
23357
23358 let target_name = wire.table.get(4);
23359
23360 let availability = wire.table.get(5);
23361
23362 Self {
23363 source_name: source_name.map(|envelope| {
23364 ::fidl_next::FromWire::from_wire(unsafe {
23365 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
23366 })
23367 }),
23368
23369 source: source.map(|envelope| {
23370 ::fidl_next::FromWire::from_wire(unsafe {
23371 envelope.read_unchecked::<crate::WireRef<'de>>()
23372 })
23373 }),
23374
23375 target: target.map(|envelope| {
23376 ::fidl_next::FromWire::from_wire(unsafe {
23377 envelope.read_unchecked::<crate::WireRef<'de>>()
23378 })
23379 }),
23380
23381 target_name: target_name.map(|envelope| {
23382 ::fidl_next::FromWire::from_wire(unsafe {
23383 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
23384 })
23385 }),
23386
23387 availability: availability.map(|envelope| {
23388 ::fidl_next::FromWire::from_wire(unsafe {
23389 envelope.read_unchecked::<crate::WireAvailability>()
23390 })
23391 }),
23392 }
23393 }
23394}
23395
23396impl<'de> ::fidl_next::FromWireRef<WireOfferStorage<'de>> for OfferStorage {
23397 #[inline]
23398 fn from_wire_ref(wire: &WireOfferStorage<'de>) -> Self {
23399 Self {
23400 source_name: wire.table.get(1).map(|envelope| {
23401 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23402 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
23403 })
23404 }),
23405
23406 source: wire.table.get(2).map(|envelope| {
23407 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23408 envelope.deref_unchecked::<crate::WireRef<'de>>()
23409 })
23410 }),
23411
23412 target: wire.table.get(3).map(|envelope| {
23413 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23414 envelope.deref_unchecked::<crate::WireRef<'de>>()
23415 })
23416 }),
23417
23418 target_name: wire.table.get(4).map(|envelope| {
23419 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23420 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
23421 })
23422 }),
23423
23424 availability: wire.table.get(5).map(|envelope| {
23425 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23426 envelope.deref_unchecked::<crate::WireAvailability>()
23427 })
23428 }),
23429 }
23430 }
23431}
23432
23433#[repr(C)]
23435pub struct WireOfferStorage<'de> {
23436 table: ::fidl_next::WireTable<'de>,
23437}
23438
23439impl<'de> Drop for WireOfferStorage<'de> {
23440 fn drop(&mut self) {
23441 let _ = self
23442 .table
23443 .get(1)
23444 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
23445
23446 let _ = self
23447 .table
23448 .get(2)
23449 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
23450
23451 let _ = self
23452 .table
23453 .get(3)
23454 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
23455
23456 let _ = self
23457 .table
23458 .get(4)
23459 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
23460
23461 let _ = self
23462 .table
23463 .get(5)
23464 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
23465 }
23466}
23467
23468unsafe impl ::fidl_next::Wire for WireOfferStorage<'static> {
23469 type Decoded<'de> = WireOfferStorage<'de>;
23470
23471 #[inline]
23472 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
23473 ::fidl_next::munge!(let Self { table } = out);
23474 ::fidl_next::WireTable::zero_padding(table);
23475 }
23476}
23477
23478unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferStorage<'static>
23479where
23480 ___D: ::fidl_next::Decoder + ?Sized,
23481{
23482 fn decode(
23483 slot: ::fidl_next::Slot<'_, Self>,
23484 decoder: &mut ___D,
23485 ) -> Result<(), ::fidl_next::DecodeError> {
23486 ::fidl_next::munge!(let Self { table } = slot);
23487
23488 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
23489 match ordinal {
23490 0 => unsafe { ::core::hint::unreachable_unchecked() },
23491
23492 1 => {
23493 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
23494 slot.as_mut(),
23495 decoder,
23496 )?;
23497
23498 let source_name = unsafe {
23499 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
23500 };
23501
23502 if source_name.len() > 100 {
23503 return Err(::fidl_next::DecodeError::VectorTooLong {
23504 size: source_name.len() as u64,
23505 limit: 100,
23506 });
23507 }
23508
23509 Ok(())
23510 }
23511
23512 2 => {
23513 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
23514 slot.as_mut(),
23515 decoder,
23516 )?;
23517
23518 Ok(())
23519 }
23520
23521 3 => {
23522 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
23523 slot.as_mut(),
23524 decoder,
23525 )?;
23526
23527 Ok(())
23528 }
23529
23530 4 => {
23531 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
23532 slot.as_mut(),
23533 decoder,
23534 )?;
23535
23536 let target_name = unsafe {
23537 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
23538 };
23539
23540 if target_name.len() > 100 {
23541 return Err(::fidl_next::DecodeError::VectorTooLong {
23542 size: target_name.len() as u64,
23543 limit: 100,
23544 });
23545 }
23546
23547 Ok(())
23548 }
23549
23550 5 => {
23551 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
23552 slot.as_mut(),
23553 decoder,
23554 )?;
23555
23556 Ok(())
23557 }
23558
23559 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
23560 }
23561 })
23562 }
23563}
23564
23565impl<'de> WireOfferStorage<'de> {
23566 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
23567 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
23568 }
23569
23570 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
23571 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
23572 }
23573
23574 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
23575 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
23576 }
23577
23578 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
23579 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
23580 }
23581
23582 pub fn availability(&self) -> Option<&crate::WireAvailability> {
23583 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
23584 }
23585}
23586
23587impl<'de> ::core::fmt::Debug for WireOfferStorage<'de> {
23588 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
23589 f.debug_struct("OfferStorage")
23590 .field("source_name", &self.source_name())
23591 .field("source", &self.source())
23592 .field("target", &self.target())
23593 .field("target_name", &self.target_name())
23594 .field("availability", &self.availability())
23595 .finish()
23596 }
23597}
23598
23599#[doc = " Declares a runner offered by a component to one of its children, which may\n have been offered by the component\'s containing realm, the component itself,\n or one of its other children.\n"]
23600#[derive(Clone, Debug, Default)]
23601pub struct OfferRunner {
23602 pub source: Option<crate::Ref>,
23603
23604 pub source_name: Option<String>,
23605
23606 pub target: Option<crate::Ref>,
23607
23608 pub target_name: Option<String>,
23609
23610 pub source_dictionary: Option<String>,
23611}
23612
23613impl OfferRunner {
23614 fn __max_ordinal(&self) -> usize {
23615 if self.source_dictionary.is_some() {
23616 return 5;
23617 }
23618
23619 if self.target_name.is_some() {
23620 return 4;
23621 }
23622
23623 if self.target.is_some() {
23624 return 3;
23625 }
23626
23627 if self.source_name.is_some() {
23628 return 2;
23629 }
23630
23631 if self.source.is_some() {
23632 return 1;
23633 }
23634
23635 0
23636 }
23637}
23638
23639impl ::fidl_next::Encodable for OfferRunner {
23640 type Encoded = WireOfferRunner<'static>;
23641}
23642
23643unsafe impl<___E> ::fidl_next::Encode<___E> for OfferRunner
23644where
23645 ___E: ::fidl_next::Encoder + ?Sized,
23646{
23647 #[inline]
23648 fn encode(
23649 mut self,
23650 encoder: &mut ___E,
23651 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23652 ) -> Result<(), ::fidl_next::EncodeError> {
23653 ::fidl_next::munge!(let WireOfferRunner { table } = out);
23654
23655 let max_ord = self.__max_ordinal();
23656
23657 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
23658 ::fidl_next::Wire::zero_padding(&mut out);
23659
23660 let mut preallocated =
23661 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
23662
23663 for i in 1..=max_ord {
23664 match i {
23665 5 => {
23666 if let Some(source_dictionary) = self.source_dictionary.take() {
23667 ::fidl_next::WireEnvelope::encode_value(
23668 source_dictionary,
23669 preallocated.encoder,
23670 &mut out,
23671 )?;
23672 } else {
23673 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23674 }
23675 }
23676
23677 4 => {
23678 if let Some(target_name) = self.target_name.take() {
23679 ::fidl_next::WireEnvelope::encode_value(
23680 target_name,
23681 preallocated.encoder,
23682 &mut out,
23683 )?;
23684 } else {
23685 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23686 }
23687 }
23688
23689 3 => {
23690 if let Some(target) = self.target.take() {
23691 ::fidl_next::WireEnvelope::encode_value(
23692 target,
23693 preallocated.encoder,
23694 &mut out,
23695 )?;
23696 } else {
23697 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23698 }
23699 }
23700
23701 2 => {
23702 if let Some(source_name) = self.source_name.take() {
23703 ::fidl_next::WireEnvelope::encode_value(
23704 source_name,
23705 preallocated.encoder,
23706 &mut out,
23707 )?;
23708 } else {
23709 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23710 }
23711 }
23712
23713 1 => {
23714 if let Some(source) = self.source.take() {
23715 ::fidl_next::WireEnvelope::encode_value(
23716 source,
23717 preallocated.encoder,
23718 &mut out,
23719 )?;
23720 } else {
23721 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23722 }
23723 }
23724
23725 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
23726 }
23727 unsafe {
23728 preallocated.write_next(out.assume_init_ref());
23729 }
23730 }
23731
23732 ::fidl_next::WireTable::encode_len(table, max_ord);
23733
23734 Ok(())
23735 }
23736}
23737
23738unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferRunner
23739where
23740 ___E: ::fidl_next::Encoder + ?Sized,
23741{
23742 #[inline]
23743 fn encode_ref(
23744 &self,
23745 encoder: &mut ___E,
23746 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23747 ) -> Result<(), ::fidl_next::EncodeError> {
23748 ::fidl_next::munge!(let WireOfferRunner { table } = out);
23749
23750 let max_ord = self.__max_ordinal();
23751
23752 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
23753 ::fidl_next::Wire::zero_padding(&mut out);
23754
23755 let mut preallocated =
23756 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
23757
23758 for i in 1..=max_ord {
23759 match i {
23760 5 => {
23761 if let Some(source_dictionary) = &self.source_dictionary {
23762 ::fidl_next::WireEnvelope::encode_value(
23763 source_dictionary,
23764 preallocated.encoder,
23765 &mut out,
23766 )?;
23767 } else {
23768 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23769 }
23770 }
23771
23772 4 => {
23773 if let Some(target_name) = &self.target_name {
23774 ::fidl_next::WireEnvelope::encode_value(
23775 target_name,
23776 preallocated.encoder,
23777 &mut out,
23778 )?;
23779 } else {
23780 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23781 }
23782 }
23783
23784 3 => {
23785 if let Some(target) = &self.target {
23786 ::fidl_next::WireEnvelope::encode_value(
23787 target,
23788 preallocated.encoder,
23789 &mut out,
23790 )?;
23791 } else {
23792 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23793 }
23794 }
23795
23796 2 => {
23797 if let Some(source_name) = &self.source_name {
23798 ::fidl_next::WireEnvelope::encode_value(
23799 source_name,
23800 preallocated.encoder,
23801 &mut out,
23802 )?;
23803 } else {
23804 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23805 }
23806 }
23807
23808 1 => {
23809 if let Some(source) = &self.source {
23810 ::fidl_next::WireEnvelope::encode_value(
23811 source,
23812 preallocated.encoder,
23813 &mut out,
23814 )?;
23815 } else {
23816 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23817 }
23818 }
23819
23820 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
23821 }
23822 unsafe {
23823 preallocated.write_next(out.assume_init_ref());
23824 }
23825 }
23826
23827 ::fidl_next::WireTable::encode_len(table, max_ord);
23828
23829 Ok(())
23830 }
23831}
23832
23833impl<'de> ::fidl_next::FromWire<WireOfferRunner<'de>> for OfferRunner {
23834 #[inline]
23835 fn from_wire(wire: WireOfferRunner<'de>) -> Self {
23836 let wire = ::core::mem::ManuallyDrop::new(wire);
23837
23838 let source = wire.table.get(1);
23839
23840 let source_name = wire.table.get(2);
23841
23842 let target = wire.table.get(3);
23843
23844 let target_name = wire.table.get(4);
23845
23846 let source_dictionary = wire.table.get(5);
23847
23848 Self {
23849 source: source.map(|envelope| {
23850 ::fidl_next::FromWire::from_wire(unsafe {
23851 envelope.read_unchecked::<crate::WireRef<'de>>()
23852 })
23853 }),
23854
23855 source_name: source_name.map(|envelope| {
23856 ::fidl_next::FromWire::from_wire(unsafe {
23857 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
23858 })
23859 }),
23860
23861 target: target.map(|envelope| {
23862 ::fidl_next::FromWire::from_wire(unsafe {
23863 envelope.read_unchecked::<crate::WireRef<'de>>()
23864 })
23865 }),
23866
23867 target_name: target_name.map(|envelope| {
23868 ::fidl_next::FromWire::from_wire(unsafe {
23869 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
23870 })
23871 }),
23872
23873 source_dictionary: source_dictionary.map(|envelope| {
23874 ::fidl_next::FromWire::from_wire(unsafe {
23875 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
23876 })
23877 }),
23878 }
23879 }
23880}
23881
23882impl<'de> ::fidl_next::FromWireRef<WireOfferRunner<'de>> for OfferRunner {
23883 #[inline]
23884 fn from_wire_ref(wire: &WireOfferRunner<'de>) -> Self {
23885 Self {
23886 source: wire.table.get(1).map(|envelope| {
23887 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23888 envelope.deref_unchecked::<crate::WireRef<'de>>()
23889 })
23890 }),
23891
23892 source_name: wire.table.get(2).map(|envelope| {
23893 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23894 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
23895 })
23896 }),
23897
23898 target: wire.table.get(3).map(|envelope| {
23899 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23900 envelope.deref_unchecked::<crate::WireRef<'de>>()
23901 })
23902 }),
23903
23904 target_name: wire.table.get(4).map(|envelope| {
23905 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23906 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
23907 })
23908 }),
23909
23910 source_dictionary: wire.table.get(5).map(|envelope| {
23911 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
23912 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
23913 })
23914 }),
23915 }
23916 }
23917}
23918
23919#[repr(C)]
23921pub struct WireOfferRunner<'de> {
23922 table: ::fidl_next::WireTable<'de>,
23923}
23924
23925impl<'de> Drop for WireOfferRunner<'de> {
23926 fn drop(&mut self) {
23927 let _ = self
23928 .table
23929 .get(1)
23930 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
23931
23932 let _ = self
23933 .table
23934 .get(2)
23935 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
23936
23937 let _ = self
23938 .table
23939 .get(3)
23940 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
23941
23942 let _ = self
23943 .table
23944 .get(4)
23945 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
23946
23947 let _ = self
23948 .table
23949 .get(5)
23950 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
23951 }
23952}
23953
23954unsafe impl ::fidl_next::Wire for WireOfferRunner<'static> {
23955 type Decoded<'de> = WireOfferRunner<'de>;
23956
23957 #[inline]
23958 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
23959 ::fidl_next::munge!(let Self { table } = out);
23960 ::fidl_next::WireTable::zero_padding(table);
23961 }
23962}
23963
23964unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferRunner<'static>
23965where
23966 ___D: ::fidl_next::Decoder + ?Sized,
23967{
23968 fn decode(
23969 slot: ::fidl_next::Slot<'_, Self>,
23970 decoder: &mut ___D,
23971 ) -> Result<(), ::fidl_next::DecodeError> {
23972 ::fidl_next::munge!(let Self { table } = slot);
23973
23974 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
23975 match ordinal {
23976 0 => unsafe { ::core::hint::unreachable_unchecked() },
23977
23978 1 => {
23979 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
23980 slot.as_mut(),
23981 decoder,
23982 )?;
23983
23984 Ok(())
23985 }
23986
23987 2 => {
23988 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
23989 slot.as_mut(),
23990 decoder,
23991 )?;
23992
23993 let source_name = unsafe {
23994 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
23995 };
23996
23997 if source_name.len() > 100 {
23998 return Err(::fidl_next::DecodeError::VectorTooLong {
23999 size: source_name.len() as u64,
24000 limit: 100,
24001 });
24002 }
24003
24004 Ok(())
24005 }
24006
24007 3 => {
24008 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
24009 slot.as_mut(),
24010 decoder,
24011 )?;
24012
24013 Ok(())
24014 }
24015
24016 4 => {
24017 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
24018 slot.as_mut(),
24019 decoder,
24020 )?;
24021
24022 let target_name = unsafe {
24023 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
24024 };
24025
24026 if target_name.len() > 100 {
24027 return Err(::fidl_next::DecodeError::VectorTooLong {
24028 size: target_name.len() as u64,
24029 limit: 100,
24030 });
24031 }
24032
24033 Ok(())
24034 }
24035
24036 5 => {
24037 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
24038 slot.as_mut(),
24039 decoder,
24040 )?;
24041
24042 let source_dictionary = unsafe {
24043 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
24044 };
24045
24046 if source_dictionary.len() > 1024 {
24047 return Err(::fidl_next::DecodeError::VectorTooLong {
24048 size: source_dictionary.len() as u64,
24049 limit: 1024,
24050 });
24051 }
24052
24053 Ok(())
24054 }
24055
24056 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
24057 }
24058 })
24059 }
24060}
24061
24062impl<'de> WireOfferRunner<'de> {
24063 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
24064 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
24065 }
24066
24067 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
24068 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
24069 }
24070
24071 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
24072 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
24073 }
24074
24075 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
24076 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
24077 }
24078
24079 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
24080 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
24081 }
24082}
24083
24084impl<'de> ::core::fmt::Debug for WireOfferRunner<'de> {
24085 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
24086 f.debug_struct("OfferRunner")
24087 .field("source", &self.source())
24088 .field("source_name", &self.source_name())
24089 .field("target", &self.target())
24090 .field("target_name", &self.target_name())
24091 .field("source_dictionary", &self.source_dictionary())
24092 .finish()
24093 }
24094}
24095
24096#[doc = " Declares a resolver capability offered by a component to one of its children, which\n may have been offered by the component\'s containing realm, the component itself,\n or one of its other children.\n"]
24097#[derive(Clone, Debug, Default)]
24098pub struct OfferResolver {
24099 pub source: Option<crate::Ref>,
24100
24101 pub source_name: Option<String>,
24102
24103 pub target: Option<crate::Ref>,
24104
24105 pub target_name: Option<String>,
24106
24107 pub source_dictionary: Option<String>,
24108}
24109
24110impl OfferResolver {
24111 fn __max_ordinal(&self) -> usize {
24112 if self.source_dictionary.is_some() {
24113 return 5;
24114 }
24115
24116 if self.target_name.is_some() {
24117 return 4;
24118 }
24119
24120 if self.target.is_some() {
24121 return 3;
24122 }
24123
24124 if self.source_name.is_some() {
24125 return 2;
24126 }
24127
24128 if self.source.is_some() {
24129 return 1;
24130 }
24131
24132 0
24133 }
24134}
24135
24136impl ::fidl_next::Encodable for OfferResolver {
24137 type Encoded = WireOfferResolver<'static>;
24138}
24139
24140unsafe impl<___E> ::fidl_next::Encode<___E> for OfferResolver
24141where
24142 ___E: ::fidl_next::Encoder + ?Sized,
24143{
24144 #[inline]
24145 fn encode(
24146 mut self,
24147 encoder: &mut ___E,
24148 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24149 ) -> Result<(), ::fidl_next::EncodeError> {
24150 ::fidl_next::munge!(let WireOfferResolver { table } = out);
24151
24152 let max_ord = self.__max_ordinal();
24153
24154 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24155 ::fidl_next::Wire::zero_padding(&mut out);
24156
24157 let mut preallocated =
24158 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24159
24160 for i in 1..=max_ord {
24161 match i {
24162 5 => {
24163 if let Some(source_dictionary) = self.source_dictionary.take() {
24164 ::fidl_next::WireEnvelope::encode_value(
24165 source_dictionary,
24166 preallocated.encoder,
24167 &mut out,
24168 )?;
24169 } else {
24170 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24171 }
24172 }
24173
24174 4 => {
24175 if let Some(target_name) = self.target_name.take() {
24176 ::fidl_next::WireEnvelope::encode_value(
24177 target_name,
24178 preallocated.encoder,
24179 &mut out,
24180 )?;
24181 } else {
24182 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24183 }
24184 }
24185
24186 3 => {
24187 if let Some(target) = self.target.take() {
24188 ::fidl_next::WireEnvelope::encode_value(
24189 target,
24190 preallocated.encoder,
24191 &mut out,
24192 )?;
24193 } else {
24194 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24195 }
24196 }
24197
24198 2 => {
24199 if let Some(source_name) = self.source_name.take() {
24200 ::fidl_next::WireEnvelope::encode_value(
24201 source_name,
24202 preallocated.encoder,
24203 &mut out,
24204 )?;
24205 } else {
24206 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24207 }
24208 }
24209
24210 1 => {
24211 if let Some(source) = self.source.take() {
24212 ::fidl_next::WireEnvelope::encode_value(
24213 source,
24214 preallocated.encoder,
24215 &mut out,
24216 )?;
24217 } else {
24218 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24219 }
24220 }
24221
24222 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24223 }
24224 unsafe {
24225 preallocated.write_next(out.assume_init_ref());
24226 }
24227 }
24228
24229 ::fidl_next::WireTable::encode_len(table, max_ord);
24230
24231 Ok(())
24232 }
24233}
24234
24235unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferResolver
24236where
24237 ___E: ::fidl_next::Encoder + ?Sized,
24238{
24239 #[inline]
24240 fn encode_ref(
24241 &self,
24242 encoder: &mut ___E,
24243 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24244 ) -> Result<(), ::fidl_next::EncodeError> {
24245 ::fidl_next::munge!(let WireOfferResolver { table } = out);
24246
24247 let max_ord = self.__max_ordinal();
24248
24249 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24250 ::fidl_next::Wire::zero_padding(&mut out);
24251
24252 let mut preallocated =
24253 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24254
24255 for i in 1..=max_ord {
24256 match i {
24257 5 => {
24258 if let Some(source_dictionary) = &self.source_dictionary {
24259 ::fidl_next::WireEnvelope::encode_value(
24260 source_dictionary,
24261 preallocated.encoder,
24262 &mut out,
24263 )?;
24264 } else {
24265 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24266 }
24267 }
24268
24269 4 => {
24270 if let Some(target_name) = &self.target_name {
24271 ::fidl_next::WireEnvelope::encode_value(
24272 target_name,
24273 preallocated.encoder,
24274 &mut out,
24275 )?;
24276 } else {
24277 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24278 }
24279 }
24280
24281 3 => {
24282 if let Some(target) = &self.target {
24283 ::fidl_next::WireEnvelope::encode_value(
24284 target,
24285 preallocated.encoder,
24286 &mut out,
24287 )?;
24288 } else {
24289 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24290 }
24291 }
24292
24293 2 => {
24294 if let Some(source_name) = &self.source_name {
24295 ::fidl_next::WireEnvelope::encode_value(
24296 source_name,
24297 preallocated.encoder,
24298 &mut out,
24299 )?;
24300 } else {
24301 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24302 }
24303 }
24304
24305 1 => {
24306 if let Some(source) = &self.source {
24307 ::fidl_next::WireEnvelope::encode_value(
24308 source,
24309 preallocated.encoder,
24310 &mut out,
24311 )?;
24312 } else {
24313 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24314 }
24315 }
24316
24317 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24318 }
24319 unsafe {
24320 preallocated.write_next(out.assume_init_ref());
24321 }
24322 }
24323
24324 ::fidl_next::WireTable::encode_len(table, max_ord);
24325
24326 Ok(())
24327 }
24328}
24329
24330impl<'de> ::fidl_next::FromWire<WireOfferResolver<'de>> for OfferResolver {
24331 #[inline]
24332 fn from_wire(wire: WireOfferResolver<'de>) -> Self {
24333 let wire = ::core::mem::ManuallyDrop::new(wire);
24334
24335 let source = wire.table.get(1);
24336
24337 let source_name = wire.table.get(2);
24338
24339 let target = wire.table.get(3);
24340
24341 let target_name = wire.table.get(4);
24342
24343 let source_dictionary = wire.table.get(5);
24344
24345 Self {
24346 source: source.map(|envelope| {
24347 ::fidl_next::FromWire::from_wire(unsafe {
24348 envelope.read_unchecked::<crate::WireRef<'de>>()
24349 })
24350 }),
24351
24352 source_name: source_name.map(|envelope| {
24353 ::fidl_next::FromWire::from_wire(unsafe {
24354 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
24355 })
24356 }),
24357
24358 target: target.map(|envelope| {
24359 ::fidl_next::FromWire::from_wire(unsafe {
24360 envelope.read_unchecked::<crate::WireRef<'de>>()
24361 })
24362 }),
24363
24364 target_name: target_name.map(|envelope| {
24365 ::fidl_next::FromWire::from_wire(unsafe {
24366 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
24367 })
24368 }),
24369
24370 source_dictionary: source_dictionary.map(|envelope| {
24371 ::fidl_next::FromWire::from_wire(unsafe {
24372 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
24373 })
24374 }),
24375 }
24376 }
24377}
24378
24379impl<'de> ::fidl_next::FromWireRef<WireOfferResolver<'de>> for OfferResolver {
24380 #[inline]
24381 fn from_wire_ref(wire: &WireOfferResolver<'de>) -> Self {
24382 Self {
24383 source: wire.table.get(1).map(|envelope| {
24384 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24385 envelope.deref_unchecked::<crate::WireRef<'de>>()
24386 })
24387 }),
24388
24389 source_name: wire.table.get(2).map(|envelope| {
24390 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24391 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
24392 })
24393 }),
24394
24395 target: wire.table.get(3).map(|envelope| {
24396 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24397 envelope.deref_unchecked::<crate::WireRef<'de>>()
24398 })
24399 }),
24400
24401 target_name: wire.table.get(4).map(|envelope| {
24402 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24403 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
24404 })
24405 }),
24406
24407 source_dictionary: wire.table.get(5).map(|envelope| {
24408 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24409 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
24410 })
24411 }),
24412 }
24413 }
24414}
24415
24416#[repr(C)]
24418pub struct WireOfferResolver<'de> {
24419 table: ::fidl_next::WireTable<'de>,
24420}
24421
24422impl<'de> Drop for WireOfferResolver<'de> {
24423 fn drop(&mut self) {
24424 let _ = self
24425 .table
24426 .get(1)
24427 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
24428
24429 let _ = self
24430 .table
24431 .get(2)
24432 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
24433
24434 let _ = self
24435 .table
24436 .get(3)
24437 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
24438
24439 let _ = self
24440 .table
24441 .get(4)
24442 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
24443
24444 let _ = self
24445 .table
24446 .get(5)
24447 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
24448 }
24449}
24450
24451unsafe impl ::fidl_next::Wire for WireOfferResolver<'static> {
24452 type Decoded<'de> = WireOfferResolver<'de>;
24453
24454 #[inline]
24455 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
24456 ::fidl_next::munge!(let Self { table } = out);
24457 ::fidl_next::WireTable::zero_padding(table);
24458 }
24459}
24460
24461unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferResolver<'static>
24462where
24463 ___D: ::fidl_next::Decoder + ?Sized,
24464{
24465 fn decode(
24466 slot: ::fidl_next::Slot<'_, Self>,
24467 decoder: &mut ___D,
24468 ) -> Result<(), ::fidl_next::DecodeError> {
24469 ::fidl_next::munge!(let Self { table } = slot);
24470
24471 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
24472 match ordinal {
24473 0 => unsafe { ::core::hint::unreachable_unchecked() },
24474
24475 1 => {
24476 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
24477 slot.as_mut(),
24478 decoder,
24479 )?;
24480
24481 Ok(())
24482 }
24483
24484 2 => {
24485 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
24486 slot.as_mut(),
24487 decoder,
24488 )?;
24489
24490 let source_name = unsafe {
24491 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
24492 };
24493
24494 if source_name.len() > 100 {
24495 return Err(::fidl_next::DecodeError::VectorTooLong {
24496 size: source_name.len() as u64,
24497 limit: 100,
24498 });
24499 }
24500
24501 Ok(())
24502 }
24503
24504 3 => {
24505 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
24506 slot.as_mut(),
24507 decoder,
24508 )?;
24509
24510 Ok(())
24511 }
24512
24513 4 => {
24514 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
24515 slot.as_mut(),
24516 decoder,
24517 )?;
24518
24519 let target_name = unsafe {
24520 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
24521 };
24522
24523 if target_name.len() > 100 {
24524 return Err(::fidl_next::DecodeError::VectorTooLong {
24525 size: target_name.len() as u64,
24526 limit: 100,
24527 });
24528 }
24529
24530 Ok(())
24531 }
24532
24533 5 => {
24534 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
24535 slot.as_mut(),
24536 decoder,
24537 )?;
24538
24539 let source_dictionary = unsafe {
24540 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
24541 };
24542
24543 if source_dictionary.len() > 1024 {
24544 return Err(::fidl_next::DecodeError::VectorTooLong {
24545 size: source_dictionary.len() as u64,
24546 limit: 1024,
24547 });
24548 }
24549
24550 Ok(())
24551 }
24552
24553 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
24554 }
24555 })
24556 }
24557}
24558
24559impl<'de> WireOfferResolver<'de> {
24560 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
24561 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
24562 }
24563
24564 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
24565 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
24566 }
24567
24568 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
24569 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
24570 }
24571
24572 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
24573 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
24574 }
24575
24576 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
24577 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
24578 }
24579}
24580
24581impl<'de> ::core::fmt::Debug for WireOfferResolver<'de> {
24582 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
24583 f.debug_struct("OfferResolver")
24584 .field("source", &self.source())
24585 .field("source_name", &self.source_name())
24586 .field("target", &self.target())
24587 .field("target_name", &self.target_name())
24588 .field("source_dictionary", &self.source_dictionary())
24589 .finish()
24590 }
24591}
24592
24593#[doc = " Declares an event stream offered by a component.\n"]
24594#[derive(Clone, Debug, Default)]
24595pub struct OfferEventStream {
24596 pub source: Option<crate::Ref>,
24597
24598 pub source_name: Option<String>,
24599
24600 pub scope: Option<Vec<crate::Ref>>,
24601
24602 pub target: Option<crate::Ref>,
24603
24604 pub target_name: Option<String>,
24605
24606 pub availability: Option<crate::Availability>,
24607}
24608
24609impl OfferEventStream {
24610 fn __max_ordinal(&self) -> usize {
24611 if self.availability.is_some() {
24612 return 7;
24613 }
24614
24615 if self.target_name.is_some() {
24616 return 5;
24617 }
24618
24619 if self.target.is_some() {
24620 return 4;
24621 }
24622
24623 if self.scope.is_some() {
24624 return 3;
24625 }
24626
24627 if self.source_name.is_some() {
24628 return 2;
24629 }
24630
24631 if self.source.is_some() {
24632 return 1;
24633 }
24634
24635 0
24636 }
24637}
24638
24639impl ::fidl_next::Encodable for OfferEventStream {
24640 type Encoded = WireOfferEventStream<'static>;
24641}
24642
24643unsafe impl<___E> ::fidl_next::Encode<___E> for OfferEventStream
24644where
24645 ___E: ::fidl_next::Encoder + ?Sized,
24646{
24647 #[inline]
24648 fn encode(
24649 mut self,
24650 encoder: &mut ___E,
24651 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24652 ) -> Result<(), ::fidl_next::EncodeError> {
24653 ::fidl_next::munge!(let WireOfferEventStream { table } = out);
24654
24655 let max_ord = self.__max_ordinal();
24656
24657 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24658 ::fidl_next::Wire::zero_padding(&mut out);
24659
24660 let mut preallocated =
24661 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24662
24663 for i in 1..=max_ord {
24664 match i {
24665 7 => {
24666 if let Some(availability) = self.availability.take() {
24667 ::fidl_next::WireEnvelope::encode_value(
24668 availability,
24669 preallocated.encoder,
24670 &mut out,
24671 )?;
24672 } else {
24673 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24674 }
24675 }
24676
24677 5 => {
24678 if let Some(target_name) = self.target_name.take() {
24679 ::fidl_next::WireEnvelope::encode_value(
24680 target_name,
24681 preallocated.encoder,
24682 &mut out,
24683 )?;
24684 } else {
24685 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24686 }
24687 }
24688
24689 4 => {
24690 if let Some(target) = self.target.take() {
24691 ::fidl_next::WireEnvelope::encode_value(
24692 target,
24693 preallocated.encoder,
24694 &mut out,
24695 )?;
24696 } else {
24697 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24698 }
24699 }
24700
24701 3 => {
24702 if let Some(scope) = self.scope.take() {
24703 ::fidl_next::WireEnvelope::encode_value(
24704 scope,
24705 preallocated.encoder,
24706 &mut out,
24707 )?;
24708 } else {
24709 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24710 }
24711 }
24712
24713 2 => {
24714 if let Some(source_name) = self.source_name.take() {
24715 ::fidl_next::WireEnvelope::encode_value(
24716 source_name,
24717 preallocated.encoder,
24718 &mut out,
24719 )?;
24720 } else {
24721 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24722 }
24723 }
24724
24725 1 => {
24726 if let Some(source) = self.source.take() {
24727 ::fidl_next::WireEnvelope::encode_value(
24728 source,
24729 preallocated.encoder,
24730 &mut out,
24731 )?;
24732 } else {
24733 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24734 }
24735 }
24736
24737 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24738 }
24739 unsafe {
24740 preallocated.write_next(out.assume_init_ref());
24741 }
24742 }
24743
24744 ::fidl_next::WireTable::encode_len(table, max_ord);
24745
24746 Ok(())
24747 }
24748}
24749
24750unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferEventStream
24751where
24752 ___E: ::fidl_next::Encoder + ?Sized,
24753{
24754 #[inline]
24755 fn encode_ref(
24756 &self,
24757 encoder: &mut ___E,
24758 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24759 ) -> Result<(), ::fidl_next::EncodeError> {
24760 ::fidl_next::munge!(let WireOfferEventStream { table } = out);
24761
24762 let max_ord = self.__max_ordinal();
24763
24764 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24765 ::fidl_next::Wire::zero_padding(&mut out);
24766
24767 let mut preallocated =
24768 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24769
24770 for i in 1..=max_ord {
24771 match i {
24772 7 => {
24773 if let Some(availability) = &self.availability {
24774 ::fidl_next::WireEnvelope::encode_value(
24775 availability,
24776 preallocated.encoder,
24777 &mut out,
24778 )?;
24779 } else {
24780 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24781 }
24782 }
24783
24784 5 => {
24785 if let Some(target_name) = &self.target_name {
24786 ::fidl_next::WireEnvelope::encode_value(
24787 target_name,
24788 preallocated.encoder,
24789 &mut out,
24790 )?;
24791 } else {
24792 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24793 }
24794 }
24795
24796 4 => {
24797 if let Some(target) = &self.target {
24798 ::fidl_next::WireEnvelope::encode_value(
24799 target,
24800 preallocated.encoder,
24801 &mut out,
24802 )?;
24803 } else {
24804 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24805 }
24806 }
24807
24808 3 => {
24809 if let Some(scope) = &self.scope {
24810 ::fidl_next::WireEnvelope::encode_value(
24811 scope,
24812 preallocated.encoder,
24813 &mut out,
24814 )?;
24815 } else {
24816 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24817 }
24818 }
24819
24820 2 => {
24821 if let Some(source_name) = &self.source_name {
24822 ::fidl_next::WireEnvelope::encode_value(
24823 source_name,
24824 preallocated.encoder,
24825 &mut out,
24826 )?;
24827 } else {
24828 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24829 }
24830 }
24831
24832 1 => {
24833 if let Some(source) = &self.source {
24834 ::fidl_next::WireEnvelope::encode_value(
24835 source,
24836 preallocated.encoder,
24837 &mut out,
24838 )?;
24839 } else {
24840 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24841 }
24842 }
24843
24844 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24845 }
24846 unsafe {
24847 preallocated.write_next(out.assume_init_ref());
24848 }
24849 }
24850
24851 ::fidl_next::WireTable::encode_len(table, max_ord);
24852
24853 Ok(())
24854 }
24855}
24856
24857impl<'de> ::fidl_next::FromWire<WireOfferEventStream<'de>> for OfferEventStream {
24858 #[inline]
24859 fn from_wire(wire: WireOfferEventStream<'de>) -> Self {
24860 let wire = ::core::mem::ManuallyDrop::new(wire);
24861
24862 let source = wire.table.get(1);
24863
24864 let source_name = wire.table.get(2);
24865
24866 let scope = wire.table.get(3);
24867
24868 let target = wire.table.get(4);
24869
24870 let target_name = wire.table.get(5);
24871
24872 let availability = wire.table.get(7);
24873
24874 Self {
24875 source: source.map(|envelope| {
24876 ::fidl_next::FromWire::from_wire(unsafe {
24877 envelope.read_unchecked::<crate::WireRef<'de>>()
24878 })
24879 }),
24880
24881 source_name: source_name.map(|envelope| {
24882 ::fidl_next::FromWire::from_wire(unsafe {
24883 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
24884 })
24885 }),
24886
24887 scope: scope.map(|envelope| {
24888 ::fidl_next::FromWire::from_wire(unsafe {
24889 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireRef<'de>>>()
24890 })
24891 }),
24892
24893 target: target.map(|envelope| {
24894 ::fidl_next::FromWire::from_wire(unsafe {
24895 envelope.read_unchecked::<crate::WireRef<'de>>()
24896 })
24897 }),
24898
24899 target_name: target_name.map(|envelope| {
24900 ::fidl_next::FromWire::from_wire(unsafe {
24901 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
24902 })
24903 }),
24904
24905 availability: availability.map(|envelope| {
24906 ::fidl_next::FromWire::from_wire(unsafe {
24907 envelope.read_unchecked::<crate::WireAvailability>()
24908 })
24909 }),
24910 }
24911 }
24912}
24913
24914impl<'de> ::fidl_next::FromWireRef<WireOfferEventStream<'de>> for OfferEventStream {
24915 #[inline]
24916 fn from_wire_ref(wire: &WireOfferEventStream<'de>) -> Self {
24917 Self {
24918 source: wire.table.get(1).map(|envelope| {
24919 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24920 envelope.deref_unchecked::<crate::WireRef<'de>>()
24921 })
24922 }),
24923
24924 source_name: wire.table.get(2).map(|envelope| {
24925 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24926 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
24927 })
24928 }),
24929
24930 scope: wire.table.get(3).map(|envelope| {
24931 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24932 envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireRef<'de>>>()
24933 })
24934 }),
24935
24936 target: wire.table.get(4).map(|envelope| {
24937 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24938 envelope.deref_unchecked::<crate::WireRef<'de>>()
24939 })
24940 }),
24941
24942 target_name: wire.table.get(5).map(|envelope| {
24943 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24944 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
24945 })
24946 }),
24947
24948 availability: wire.table.get(7).map(|envelope| {
24949 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
24950 envelope.deref_unchecked::<crate::WireAvailability>()
24951 })
24952 }),
24953 }
24954 }
24955}
24956
24957#[repr(C)]
24959pub struct WireOfferEventStream<'de> {
24960 table: ::fidl_next::WireTable<'de>,
24961}
24962
24963impl<'de> Drop for WireOfferEventStream<'de> {
24964 fn drop(&mut self) {
24965 let _ = self
24966 .table
24967 .get(1)
24968 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
24969
24970 let _ = self
24971 .table
24972 .get(2)
24973 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
24974
24975 let _ = self.table.get(3).map(|envelope| unsafe {
24976 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireRef<'de>>>()
24977 });
24978
24979 let _ = self
24980 .table
24981 .get(4)
24982 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
24983
24984 let _ = self
24985 .table
24986 .get(5)
24987 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
24988
24989 let _ = self
24990 .table
24991 .get(7)
24992 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
24993 }
24994}
24995
24996unsafe impl ::fidl_next::Wire for WireOfferEventStream<'static> {
24997 type Decoded<'de> = WireOfferEventStream<'de>;
24998
24999 #[inline]
25000 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
25001 ::fidl_next::munge!(let Self { table } = out);
25002 ::fidl_next::WireTable::zero_padding(table);
25003 }
25004}
25005
25006unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferEventStream<'static>
25007where
25008 ___D: ::fidl_next::Decoder + ?Sized,
25009{
25010 fn decode(
25011 slot: ::fidl_next::Slot<'_, Self>,
25012 decoder: &mut ___D,
25013 ) -> Result<(), ::fidl_next::DecodeError> {
25014 ::fidl_next::munge!(let Self { table } = slot);
25015
25016 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
25017 match ordinal {
25018 0 => unsafe { ::core::hint::unreachable_unchecked() },
25019
25020 1 => {
25021 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
25022 slot.as_mut(),
25023 decoder,
25024 )?;
25025
25026 Ok(())
25027 }
25028
25029 2 => {
25030 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
25031 slot.as_mut(),
25032 decoder,
25033 )?;
25034
25035 let source_name = unsafe {
25036 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
25037 };
25038
25039 if source_name.len() > 100 {
25040 return Err(::fidl_next::DecodeError::VectorTooLong {
25041 size: source_name.len() as u64,
25042 limit: 100,
25043 });
25044 }
25045
25046 Ok(())
25047 }
25048
25049 3 => {
25050 ::fidl_next::WireEnvelope::decode_as::<
25051 ___D,
25052 ::fidl_next::WireVector<'static, crate::WireRef<'static>>,
25053 >(slot.as_mut(), decoder)?;
25054
25055 Ok(())
25056 }
25057
25058 4 => {
25059 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
25060 slot.as_mut(),
25061 decoder,
25062 )?;
25063
25064 Ok(())
25065 }
25066
25067 5 => {
25068 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
25069 slot.as_mut(),
25070 decoder,
25071 )?;
25072
25073 let target_name = unsafe {
25074 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
25075 };
25076
25077 if target_name.len() > 100 {
25078 return Err(::fidl_next::DecodeError::VectorTooLong {
25079 size: target_name.len() as u64,
25080 limit: 100,
25081 });
25082 }
25083
25084 Ok(())
25085 }
25086
25087 7 => {
25088 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
25089 slot.as_mut(),
25090 decoder,
25091 )?;
25092
25093 Ok(())
25094 }
25095
25096 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
25097 }
25098 })
25099 }
25100}
25101
25102impl<'de> WireOfferEventStream<'de> {
25103 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
25104 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
25105 }
25106
25107 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
25108 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
25109 }
25110
25111 pub fn scope(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireRef<'de>>> {
25112 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
25113 }
25114
25115 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
25116 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
25117 }
25118
25119 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
25120 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
25121 }
25122
25123 pub fn availability(&self) -> Option<&crate::WireAvailability> {
25124 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
25125 }
25126}
25127
25128impl<'de> ::core::fmt::Debug for WireOfferEventStream<'de> {
25129 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
25130 f.debug_struct("OfferEventStream")
25131 .field("source", &self.source())
25132 .field("source_name", &self.source_name())
25133 .field("scope", &self.scope())
25134 .field("target", &self.target())
25135 .field("target_name", &self.target_name())
25136 .field("availability", &self.availability())
25137 .finish()
25138 }
25139}
25140
25141#[doc = " Declares a dictionary offered by a component to one of its children,\n which may have been offered by the component\'s containing realm, the\n component itself, or one of its other children.\n\n To learn more about dictionaries, see:\n https://fuchsia.dev/fuchsia-src/glossary#dictionary\n"]
25142#[derive(Clone, Debug, Default)]
25143pub struct OfferDictionary {
25144 pub source: Option<crate::Ref>,
25145
25146 pub source_name: Option<String>,
25147
25148 pub target: Option<crate::Ref>,
25149
25150 pub target_name: Option<String>,
25151
25152 pub dependency_type: Option<crate::DependencyType>,
25153
25154 pub availability: Option<crate::Availability>,
25155
25156 pub source_dictionary: Option<String>,
25157}
25158
25159impl OfferDictionary {
25160 fn __max_ordinal(&self) -> usize {
25161 if self.source_dictionary.is_some() {
25162 return 7;
25163 }
25164
25165 if self.availability.is_some() {
25166 return 6;
25167 }
25168
25169 if self.dependency_type.is_some() {
25170 return 5;
25171 }
25172
25173 if self.target_name.is_some() {
25174 return 4;
25175 }
25176
25177 if self.target.is_some() {
25178 return 3;
25179 }
25180
25181 if self.source_name.is_some() {
25182 return 2;
25183 }
25184
25185 if self.source.is_some() {
25186 return 1;
25187 }
25188
25189 0
25190 }
25191}
25192
25193impl ::fidl_next::Encodable for OfferDictionary {
25194 type Encoded = WireOfferDictionary<'static>;
25195}
25196
25197unsafe impl<___E> ::fidl_next::Encode<___E> for OfferDictionary
25198where
25199 ___E: ::fidl_next::Encoder + ?Sized,
25200{
25201 #[inline]
25202 fn encode(
25203 mut self,
25204 encoder: &mut ___E,
25205 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25206 ) -> Result<(), ::fidl_next::EncodeError> {
25207 ::fidl_next::munge!(let WireOfferDictionary { table } = out);
25208
25209 let max_ord = self.__max_ordinal();
25210
25211 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
25212 ::fidl_next::Wire::zero_padding(&mut out);
25213
25214 let mut preallocated =
25215 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
25216
25217 for i in 1..=max_ord {
25218 match i {
25219 7 => {
25220 if let Some(source_dictionary) = self.source_dictionary.take() {
25221 ::fidl_next::WireEnvelope::encode_value(
25222 source_dictionary,
25223 preallocated.encoder,
25224 &mut out,
25225 )?;
25226 } else {
25227 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25228 }
25229 }
25230
25231 6 => {
25232 if let Some(availability) = self.availability.take() {
25233 ::fidl_next::WireEnvelope::encode_value(
25234 availability,
25235 preallocated.encoder,
25236 &mut out,
25237 )?;
25238 } else {
25239 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25240 }
25241 }
25242
25243 5 => {
25244 if let Some(dependency_type) = self.dependency_type.take() {
25245 ::fidl_next::WireEnvelope::encode_value(
25246 dependency_type,
25247 preallocated.encoder,
25248 &mut out,
25249 )?;
25250 } else {
25251 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25252 }
25253 }
25254
25255 4 => {
25256 if let Some(target_name) = self.target_name.take() {
25257 ::fidl_next::WireEnvelope::encode_value(
25258 target_name,
25259 preallocated.encoder,
25260 &mut out,
25261 )?;
25262 } else {
25263 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25264 }
25265 }
25266
25267 3 => {
25268 if let Some(target) = self.target.take() {
25269 ::fidl_next::WireEnvelope::encode_value(
25270 target,
25271 preallocated.encoder,
25272 &mut out,
25273 )?;
25274 } else {
25275 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25276 }
25277 }
25278
25279 2 => {
25280 if let Some(source_name) = self.source_name.take() {
25281 ::fidl_next::WireEnvelope::encode_value(
25282 source_name,
25283 preallocated.encoder,
25284 &mut out,
25285 )?;
25286 } else {
25287 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25288 }
25289 }
25290
25291 1 => {
25292 if let Some(source) = self.source.take() {
25293 ::fidl_next::WireEnvelope::encode_value(
25294 source,
25295 preallocated.encoder,
25296 &mut out,
25297 )?;
25298 } else {
25299 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25300 }
25301 }
25302
25303 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
25304 }
25305 unsafe {
25306 preallocated.write_next(out.assume_init_ref());
25307 }
25308 }
25309
25310 ::fidl_next::WireTable::encode_len(table, max_ord);
25311
25312 Ok(())
25313 }
25314}
25315
25316unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferDictionary
25317where
25318 ___E: ::fidl_next::Encoder + ?Sized,
25319{
25320 #[inline]
25321 fn encode_ref(
25322 &self,
25323 encoder: &mut ___E,
25324 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25325 ) -> Result<(), ::fidl_next::EncodeError> {
25326 ::fidl_next::munge!(let WireOfferDictionary { table } = out);
25327
25328 let max_ord = self.__max_ordinal();
25329
25330 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
25331 ::fidl_next::Wire::zero_padding(&mut out);
25332
25333 let mut preallocated =
25334 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
25335
25336 for i in 1..=max_ord {
25337 match i {
25338 7 => {
25339 if let Some(source_dictionary) = &self.source_dictionary {
25340 ::fidl_next::WireEnvelope::encode_value(
25341 source_dictionary,
25342 preallocated.encoder,
25343 &mut out,
25344 )?;
25345 } else {
25346 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25347 }
25348 }
25349
25350 6 => {
25351 if let Some(availability) = &self.availability {
25352 ::fidl_next::WireEnvelope::encode_value(
25353 availability,
25354 preallocated.encoder,
25355 &mut out,
25356 )?;
25357 } else {
25358 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25359 }
25360 }
25361
25362 5 => {
25363 if let Some(dependency_type) = &self.dependency_type {
25364 ::fidl_next::WireEnvelope::encode_value(
25365 dependency_type,
25366 preallocated.encoder,
25367 &mut out,
25368 )?;
25369 } else {
25370 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25371 }
25372 }
25373
25374 4 => {
25375 if let Some(target_name) = &self.target_name {
25376 ::fidl_next::WireEnvelope::encode_value(
25377 target_name,
25378 preallocated.encoder,
25379 &mut out,
25380 )?;
25381 } else {
25382 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25383 }
25384 }
25385
25386 3 => {
25387 if let Some(target) = &self.target {
25388 ::fidl_next::WireEnvelope::encode_value(
25389 target,
25390 preallocated.encoder,
25391 &mut out,
25392 )?;
25393 } else {
25394 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25395 }
25396 }
25397
25398 2 => {
25399 if let Some(source_name) = &self.source_name {
25400 ::fidl_next::WireEnvelope::encode_value(
25401 source_name,
25402 preallocated.encoder,
25403 &mut out,
25404 )?;
25405 } else {
25406 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25407 }
25408 }
25409
25410 1 => {
25411 if let Some(source) = &self.source {
25412 ::fidl_next::WireEnvelope::encode_value(
25413 source,
25414 preallocated.encoder,
25415 &mut out,
25416 )?;
25417 } else {
25418 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25419 }
25420 }
25421
25422 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
25423 }
25424 unsafe {
25425 preallocated.write_next(out.assume_init_ref());
25426 }
25427 }
25428
25429 ::fidl_next::WireTable::encode_len(table, max_ord);
25430
25431 Ok(())
25432 }
25433}
25434
25435impl<'de> ::fidl_next::FromWire<WireOfferDictionary<'de>> for OfferDictionary {
25436 #[inline]
25437 fn from_wire(wire: WireOfferDictionary<'de>) -> Self {
25438 let wire = ::core::mem::ManuallyDrop::new(wire);
25439
25440 let source = wire.table.get(1);
25441
25442 let source_name = wire.table.get(2);
25443
25444 let target = wire.table.get(3);
25445
25446 let target_name = wire.table.get(4);
25447
25448 let dependency_type = wire.table.get(5);
25449
25450 let availability = wire.table.get(6);
25451
25452 let source_dictionary = wire.table.get(7);
25453
25454 Self {
25455 source: source.map(|envelope| {
25456 ::fidl_next::FromWire::from_wire(unsafe {
25457 envelope.read_unchecked::<crate::WireRef<'de>>()
25458 })
25459 }),
25460
25461 source_name: source_name.map(|envelope| {
25462 ::fidl_next::FromWire::from_wire(unsafe {
25463 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
25464 })
25465 }),
25466
25467 target: target.map(|envelope| {
25468 ::fidl_next::FromWire::from_wire(unsafe {
25469 envelope.read_unchecked::<crate::WireRef<'de>>()
25470 })
25471 }),
25472
25473 target_name: target_name.map(|envelope| {
25474 ::fidl_next::FromWire::from_wire(unsafe {
25475 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
25476 })
25477 }),
25478
25479 dependency_type: dependency_type.map(|envelope| {
25480 ::fidl_next::FromWire::from_wire(unsafe {
25481 envelope.read_unchecked::<crate::WireDependencyType>()
25482 })
25483 }),
25484
25485 availability: availability.map(|envelope| {
25486 ::fidl_next::FromWire::from_wire(unsafe {
25487 envelope.read_unchecked::<crate::WireAvailability>()
25488 })
25489 }),
25490
25491 source_dictionary: source_dictionary.map(|envelope| {
25492 ::fidl_next::FromWire::from_wire(unsafe {
25493 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
25494 })
25495 }),
25496 }
25497 }
25498}
25499
25500impl<'de> ::fidl_next::FromWireRef<WireOfferDictionary<'de>> for OfferDictionary {
25501 #[inline]
25502 fn from_wire_ref(wire: &WireOfferDictionary<'de>) -> Self {
25503 Self {
25504 source: wire.table.get(1).map(|envelope| {
25505 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
25506 envelope.deref_unchecked::<crate::WireRef<'de>>()
25507 })
25508 }),
25509
25510 source_name: wire.table.get(2).map(|envelope| {
25511 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
25512 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
25513 })
25514 }),
25515
25516 target: wire.table.get(3).map(|envelope| {
25517 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
25518 envelope.deref_unchecked::<crate::WireRef<'de>>()
25519 })
25520 }),
25521
25522 target_name: wire.table.get(4).map(|envelope| {
25523 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
25524 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
25525 })
25526 }),
25527
25528 dependency_type: wire.table.get(5).map(|envelope| {
25529 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
25530 envelope.deref_unchecked::<crate::WireDependencyType>()
25531 })
25532 }),
25533
25534 availability: wire.table.get(6).map(|envelope| {
25535 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
25536 envelope.deref_unchecked::<crate::WireAvailability>()
25537 })
25538 }),
25539
25540 source_dictionary: wire.table.get(7).map(|envelope| {
25541 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
25542 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
25543 })
25544 }),
25545 }
25546 }
25547}
25548
25549#[repr(C)]
25551pub struct WireOfferDictionary<'de> {
25552 table: ::fidl_next::WireTable<'de>,
25553}
25554
25555impl<'de> Drop for WireOfferDictionary<'de> {
25556 fn drop(&mut self) {
25557 let _ = self
25558 .table
25559 .get(1)
25560 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
25561
25562 let _ = self
25563 .table
25564 .get(2)
25565 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
25566
25567 let _ = self
25568 .table
25569 .get(3)
25570 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
25571
25572 let _ = self
25573 .table
25574 .get(4)
25575 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
25576
25577 let _ = self
25578 .table
25579 .get(5)
25580 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireDependencyType>() });
25581
25582 let _ = self
25583 .table
25584 .get(6)
25585 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
25586
25587 let _ = self
25588 .table
25589 .get(7)
25590 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
25591 }
25592}
25593
25594unsafe impl ::fidl_next::Wire for WireOfferDictionary<'static> {
25595 type Decoded<'de> = WireOfferDictionary<'de>;
25596
25597 #[inline]
25598 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
25599 ::fidl_next::munge!(let Self { table } = out);
25600 ::fidl_next::WireTable::zero_padding(table);
25601 }
25602}
25603
25604unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferDictionary<'static>
25605where
25606 ___D: ::fidl_next::Decoder + ?Sized,
25607{
25608 fn decode(
25609 slot: ::fidl_next::Slot<'_, Self>,
25610 decoder: &mut ___D,
25611 ) -> Result<(), ::fidl_next::DecodeError> {
25612 ::fidl_next::munge!(let Self { table } = slot);
25613
25614 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
25615 match ordinal {
25616 0 => unsafe { ::core::hint::unreachable_unchecked() },
25617
25618 1 => {
25619 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
25620 slot.as_mut(),
25621 decoder,
25622 )?;
25623
25624 Ok(())
25625 }
25626
25627 2 => {
25628 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
25629 slot.as_mut(),
25630 decoder,
25631 )?;
25632
25633 let source_name = unsafe {
25634 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
25635 };
25636
25637 if source_name.len() > 100 {
25638 return Err(::fidl_next::DecodeError::VectorTooLong {
25639 size: source_name.len() as u64,
25640 limit: 100,
25641 });
25642 }
25643
25644 Ok(())
25645 }
25646
25647 3 => {
25648 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
25649 slot.as_mut(),
25650 decoder,
25651 )?;
25652
25653 Ok(())
25654 }
25655
25656 4 => {
25657 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
25658 slot.as_mut(),
25659 decoder,
25660 )?;
25661
25662 let target_name = unsafe {
25663 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
25664 };
25665
25666 if target_name.len() > 100 {
25667 return Err(::fidl_next::DecodeError::VectorTooLong {
25668 size: target_name.len() as u64,
25669 limit: 100,
25670 });
25671 }
25672
25673 Ok(())
25674 }
25675
25676 5 => {
25677 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
25678 slot.as_mut(),
25679 decoder,
25680 )?;
25681
25682 Ok(())
25683 }
25684
25685 6 => {
25686 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
25687 slot.as_mut(),
25688 decoder,
25689 )?;
25690
25691 Ok(())
25692 }
25693
25694 7 => {
25695 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
25696 slot.as_mut(),
25697 decoder,
25698 )?;
25699
25700 let source_dictionary = unsafe {
25701 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
25702 };
25703
25704 if source_dictionary.len() > 1024 {
25705 return Err(::fidl_next::DecodeError::VectorTooLong {
25706 size: source_dictionary.len() as u64,
25707 limit: 1024,
25708 });
25709 }
25710
25711 Ok(())
25712 }
25713
25714 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
25715 }
25716 })
25717 }
25718}
25719
25720impl<'de> WireOfferDictionary<'de> {
25721 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
25722 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
25723 }
25724
25725 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
25726 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
25727 }
25728
25729 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
25730 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
25731 }
25732
25733 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
25734 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
25735 }
25736
25737 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
25738 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
25739 }
25740
25741 pub fn availability(&self) -> Option<&crate::WireAvailability> {
25742 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
25743 }
25744
25745 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
25746 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
25747 }
25748}
25749
25750impl<'de> ::core::fmt::Debug for WireOfferDictionary<'de> {
25751 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
25752 f.debug_struct("OfferDictionary")
25753 .field("source", &self.source())
25754 .field("source_name", &self.source_name())
25755 .field("target", &self.target())
25756 .field("target_name", &self.target_name())
25757 .field("dependency_type", &self.dependency_type())
25758 .field("availability", &self.availability())
25759 .field("source_dictionary", &self.source_dictionary())
25760 .finish()
25761 }
25762}
25763
25764#[doc = " Declares a configuration capability offered by a component to one of its children,\n which may have been offered by the component\'s containing realm, the\n component itself, or one of its other children.\n"]
25765#[derive(Clone, Debug, Default)]
25766pub struct OfferConfiguration {
25767 pub source: Option<crate::Ref>,
25768
25769 pub source_name: Option<String>,
25770
25771 pub target: Option<crate::Ref>,
25772
25773 pub target_name: Option<String>,
25774
25775 pub availability: Option<crate::Availability>,
25776
25777 pub source_dictionary: Option<String>,
25778}
25779
25780impl OfferConfiguration {
25781 fn __max_ordinal(&self) -> usize {
25782 if self.source_dictionary.is_some() {
25783 return 6;
25784 }
25785
25786 if self.availability.is_some() {
25787 return 5;
25788 }
25789
25790 if self.target_name.is_some() {
25791 return 4;
25792 }
25793
25794 if self.target.is_some() {
25795 return 3;
25796 }
25797
25798 if self.source_name.is_some() {
25799 return 2;
25800 }
25801
25802 if self.source.is_some() {
25803 return 1;
25804 }
25805
25806 0
25807 }
25808}
25809
25810impl ::fidl_next::Encodable for OfferConfiguration {
25811 type Encoded = WireOfferConfiguration<'static>;
25812}
25813
25814unsafe impl<___E> ::fidl_next::Encode<___E> for OfferConfiguration
25815where
25816 ___E: ::fidl_next::Encoder + ?Sized,
25817{
25818 #[inline]
25819 fn encode(
25820 mut self,
25821 encoder: &mut ___E,
25822 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25823 ) -> Result<(), ::fidl_next::EncodeError> {
25824 ::fidl_next::munge!(let WireOfferConfiguration { table } = out);
25825
25826 let max_ord = self.__max_ordinal();
25827
25828 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
25829 ::fidl_next::Wire::zero_padding(&mut out);
25830
25831 let mut preallocated =
25832 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
25833
25834 for i in 1..=max_ord {
25835 match i {
25836 6 => {
25837 if let Some(source_dictionary) = self.source_dictionary.take() {
25838 ::fidl_next::WireEnvelope::encode_value(
25839 source_dictionary,
25840 preallocated.encoder,
25841 &mut out,
25842 )?;
25843 } else {
25844 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25845 }
25846 }
25847
25848 5 => {
25849 if let Some(availability) = self.availability.take() {
25850 ::fidl_next::WireEnvelope::encode_value(
25851 availability,
25852 preallocated.encoder,
25853 &mut out,
25854 )?;
25855 } else {
25856 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25857 }
25858 }
25859
25860 4 => {
25861 if let Some(target_name) = self.target_name.take() {
25862 ::fidl_next::WireEnvelope::encode_value(
25863 target_name,
25864 preallocated.encoder,
25865 &mut out,
25866 )?;
25867 } else {
25868 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25869 }
25870 }
25871
25872 3 => {
25873 if let Some(target) = self.target.take() {
25874 ::fidl_next::WireEnvelope::encode_value(
25875 target,
25876 preallocated.encoder,
25877 &mut out,
25878 )?;
25879 } else {
25880 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25881 }
25882 }
25883
25884 2 => {
25885 if let Some(source_name) = self.source_name.take() {
25886 ::fidl_next::WireEnvelope::encode_value(
25887 source_name,
25888 preallocated.encoder,
25889 &mut out,
25890 )?;
25891 } else {
25892 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25893 }
25894 }
25895
25896 1 => {
25897 if let Some(source) = self.source.take() {
25898 ::fidl_next::WireEnvelope::encode_value(
25899 source,
25900 preallocated.encoder,
25901 &mut out,
25902 )?;
25903 } else {
25904 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25905 }
25906 }
25907
25908 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
25909 }
25910 unsafe {
25911 preallocated.write_next(out.assume_init_ref());
25912 }
25913 }
25914
25915 ::fidl_next::WireTable::encode_len(table, max_ord);
25916
25917 Ok(())
25918 }
25919}
25920
25921unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferConfiguration
25922where
25923 ___E: ::fidl_next::Encoder + ?Sized,
25924{
25925 #[inline]
25926 fn encode_ref(
25927 &self,
25928 encoder: &mut ___E,
25929 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25930 ) -> Result<(), ::fidl_next::EncodeError> {
25931 ::fidl_next::munge!(let WireOfferConfiguration { table } = out);
25932
25933 let max_ord = self.__max_ordinal();
25934
25935 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
25936 ::fidl_next::Wire::zero_padding(&mut out);
25937
25938 let mut preallocated =
25939 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
25940
25941 for i in 1..=max_ord {
25942 match i {
25943 6 => {
25944 if let Some(source_dictionary) = &self.source_dictionary {
25945 ::fidl_next::WireEnvelope::encode_value(
25946 source_dictionary,
25947 preallocated.encoder,
25948 &mut out,
25949 )?;
25950 } else {
25951 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25952 }
25953 }
25954
25955 5 => {
25956 if let Some(availability) = &self.availability {
25957 ::fidl_next::WireEnvelope::encode_value(
25958 availability,
25959 preallocated.encoder,
25960 &mut out,
25961 )?;
25962 } else {
25963 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25964 }
25965 }
25966
25967 4 => {
25968 if let Some(target_name) = &self.target_name {
25969 ::fidl_next::WireEnvelope::encode_value(
25970 target_name,
25971 preallocated.encoder,
25972 &mut out,
25973 )?;
25974 } else {
25975 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25976 }
25977 }
25978
25979 3 => {
25980 if let Some(target) = &self.target {
25981 ::fidl_next::WireEnvelope::encode_value(
25982 target,
25983 preallocated.encoder,
25984 &mut out,
25985 )?;
25986 } else {
25987 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25988 }
25989 }
25990
25991 2 => {
25992 if let Some(source_name) = &self.source_name {
25993 ::fidl_next::WireEnvelope::encode_value(
25994 source_name,
25995 preallocated.encoder,
25996 &mut out,
25997 )?;
25998 } else {
25999 ::fidl_next::WireEnvelope::encode_zero(&mut out)
26000 }
26001 }
26002
26003 1 => {
26004 if let Some(source) = &self.source {
26005 ::fidl_next::WireEnvelope::encode_value(
26006 source,
26007 preallocated.encoder,
26008 &mut out,
26009 )?;
26010 } else {
26011 ::fidl_next::WireEnvelope::encode_zero(&mut out)
26012 }
26013 }
26014
26015 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
26016 }
26017 unsafe {
26018 preallocated.write_next(out.assume_init_ref());
26019 }
26020 }
26021
26022 ::fidl_next::WireTable::encode_len(table, max_ord);
26023
26024 Ok(())
26025 }
26026}
26027
26028impl<'de> ::fidl_next::FromWire<WireOfferConfiguration<'de>> for OfferConfiguration {
26029 #[inline]
26030 fn from_wire(wire: WireOfferConfiguration<'de>) -> Self {
26031 let wire = ::core::mem::ManuallyDrop::new(wire);
26032
26033 let source = wire.table.get(1);
26034
26035 let source_name = wire.table.get(2);
26036
26037 let target = wire.table.get(3);
26038
26039 let target_name = wire.table.get(4);
26040
26041 let availability = wire.table.get(5);
26042
26043 let source_dictionary = wire.table.get(6);
26044
26045 Self {
26046 source: source.map(|envelope| {
26047 ::fidl_next::FromWire::from_wire(unsafe {
26048 envelope.read_unchecked::<crate::WireRef<'de>>()
26049 })
26050 }),
26051
26052 source_name: source_name.map(|envelope| {
26053 ::fidl_next::FromWire::from_wire(unsafe {
26054 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
26055 })
26056 }),
26057
26058 target: target.map(|envelope| {
26059 ::fidl_next::FromWire::from_wire(unsafe {
26060 envelope.read_unchecked::<crate::WireRef<'de>>()
26061 })
26062 }),
26063
26064 target_name: target_name.map(|envelope| {
26065 ::fidl_next::FromWire::from_wire(unsafe {
26066 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
26067 })
26068 }),
26069
26070 availability: availability.map(|envelope| {
26071 ::fidl_next::FromWire::from_wire(unsafe {
26072 envelope.read_unchecked::<crate::WireAvailability>()
26073 })
26074 }),
26075
26076 source_dictionary: source_dictionary.map(|envelope| {
26077 ::fidl_next::FromWire::from_wire(unsafe {
26078 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
26079 })
26080 }),
26081 }
26082 }
26083}
26084
26085impl<'de> ::fidl_next::FromWireRef<WireOfferConfiguration<'de>> for OfferConfiguration {
26086 #[inline]
26087 fn from_wire_ref(wire: &WireOfferConfiguration<'de>) -> Self {
26088 Self {
26089 source: wire.table.get(1).map(|envelope| {
26090 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
26091 envelope.deref_unchecked::<crate::WireRef<'de>>()
26092 })
26093 }),
26094
26095 source_name: wire.table.get(2).map(|envelope| {
26096 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
26097 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
26098 })
26099 }),
26100
26101 target: wire.table.get(3).map(|envelope| {
26102 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
26103 envelope.deref_unchecked::<crate::WireRef<'de>>()
26104 })
26105 }),
26106
26107 target_name: wire.table.get(4).map(|envelope| {
26108 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
26109 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
26110 })
26111 }),
26112
26113 availability: wire.table.get(5).map(|envelope| {
26114 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
26115 envelope.deref_unchecked::<crate::WireAvailability>()
26116 })
26117 }),
26118
26119 source_dictionary: wire.table.get(6).map(|envelope| {
26120 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
26121 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
26122 })
26123 }),
26124 }
26125 }
26126}
26127
26128#[repr(C)]
26130pub struct WireOfferConfiguration<'de> {
26131 table: ::fidl_next::WireTable<'de>,
26132}
26133
26134impl<'de> Drop for WireOfferConfiguration<'de> {
26135 fn drop(&mut self) {
26136 let _ = self
26137 .table
26138 .get(1)
26139 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
26140
26141 let _ = self
26142 .table
26143 .get(2)
26144 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
26145
26146 let _ = self
26147 .table
26148 .get(3)
26149 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
26150
26151 let _ = self
26152 .table
26153 .get(4)
26154 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
26155
26156 let _ = self
26157 .table
26158 .get(5)
26159 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireAvailability>() });
26160
26161 let _ = self
26162 .table
26163 .get(6)
26164 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
26165 }
26166}
26167
26168unsafe impl ::fidl_next::Wire for WireOfferConfiguration<'static> {
26169 type Decoded<'de> = WireOfferConfiguration<'de>;
26170
26171 #[inline]
26172 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
26173 ::fidl_next::munge!(let Self { table } = out);
26174 ::fidl_next::WireTable::zero_padding(table);
26175 }
26176}
26177
26178unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferConfiguration<'static>
26179where
26180 ___D: ::fidl_next::Decoder + ?Sized,
26181{
26182 fn decode(
26183 slot: ::fidl_next::Slot<'_, Self>,
26184 decoder: &mut ___D,
26185 ) -> Result<(), ::fidl_next::DecodeError> {
26186 ::fidl_next::munge!(let Self { table } = slot);
26187
26188 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
26189 match ordinal {
26190 0 => unsafe { ::core::hint::unreachable_unchecked() },
26191
26192 1 => {
26193 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
26194 slot.as_mut(),
26195 decoder,
26196 )?;
26197
26198 Ok(())
26199 }
26200
26201 2 => {
26202 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
26203 slot.as_mut(),
26204 decoder,
26205 )?;
26206
26207 let source_name = unsafe {
26208 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
26209 };
26210
26211 if source_name.len() > 100 {
26212 return Err(::fidl_next::DecodeError::VectorTooLong {
26213 size: source_name.len() as u64,
26214 limit: 100,
26215 });
26216 }
26217
26218 Ok(())
26219 }
26220
26221 3 => {
26222 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
26223 slot.as_mut(),
26224 decoder,
26225 )?;
26226
26227 Ok(())
26228 }
26229
26230 4 => {
26231 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
26232 slot.as_mut(),
26233 decoder,
26234 )?;
26235
26236 let target_name = unsafe {
26237 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
26238 };
26239
26240 if target_name.len() > 100 {
26241 return Err(::fidl_next::DecodeError::VectorTooLong {
26242 size: target_name.len() as u64,
26243 limit: 100,
26244 });
26245 }
26246
26247 Ok(())
26248 }
26249
26250 5 => {
26251 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
26252 slot.as_mut(),
26253 decoder,
26254 )?;
26255
26256 Ok(())
26257 }
26258
26259 6 => {
26260 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
26261 slot.as_mut(),
26262 decoder,
26263 )?;
26264
26265 let source_dictionary = unsafe {
26266 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
26267 };
26268
26269 if source_dictionary.len() > 1024 {
26270 return Err(::fidl_next::DecodeError::VectorTooLong {
26271 size: source_dictionary.len() as u64,
26272 limit: 1024,
26273 });
26274 }
26275
26276 Ok(())
26277 }
26278
26279 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
26280 }
26281 })
26282 }
26283}
26284
26285impl<'de> WireOfferConfiguration<'de> {
26286 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
26287 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
26288 }
26289
26290 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
26291 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
26292 }
26293
26294 pub fn target(&self) -> Option<&crate::WireRef<'de>> {
26295 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
26296 }
26297
26298 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
26299 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
26300 }
26301
26302 pub fn availability(&self) -> Option<&crate::WireAvailability> {
26303 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
26304 }
26305
26306 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString<'de>> {
26307 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
26308 }
26309}
26310
26311impl<'de> ::core::fmt::Debug for WireOfferConfiguration<'de> {
26312 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
26313 f.debug_struct("OfferConfiguration")
26314 .field("source", &self.source())
26315 .field("source_name", &self.source_name())
26316 .field("target", &self.target())
26317 .field("target_name", &self.target_name())
26318 .field("availability", &self.availability())
26319 .field("source_dictionary", &self.source_dictionary())
26320 .finish()
26321 }
26322}
26323
26324#[doc = " Declares a capability offered by a component to one of its children, which\n may have been offered by the component\'s containing realm, the component\n itself, or one of its other children.\n"]
26325#[derive(Clone, Debug)]
26326pub enum Offer {
26327 Service(crate::OfferService),
26328
26329 Protocol(crate::OfferProtocol),
26330
26331 Directory(crate::OfferDirectory),
26332
26333 Storage(crate::OfferStorage),
26334
26335 Runner(crate::OfferRunner),
26336
26337 Resolver(crate::OfferResolver),
26338
26339 EventStream(crate::OfferEventStream),
26340
26341 Dictionary(crate::OfferDictionary),
26342
26343 Config(crate::OfferConfiguration),
26344
26345 UnknownOrdinal_(u64),
26346}
26347
26348impl ::fidl_next::Encodable for Offer {
26349 type Encoded = WireOffer<'static>;
26350}
26351
26352unsafe impl<___E> ::fidl_next::Encode<___E> for Offer
26353where
26354 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
26355
26356 ___E: ::fidl_next::Encoder,
26357{
26358 #[inline]
26359 fn encode(
26360 self,
26361 encoder: &mut ___E,
26362 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
26363 ) -> Result<(), ::fidl_next::EncodeError> {
26364 ::fidl_next::munge!(let WireOffer { raw, _phantom: _ } = out);
26365
26366 match self {
26367 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<
26368 ___E,
26369 crate::OfferService,
26370 >(value, 1, encoder, raw)?,
26371
26372 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
26373 ___E,
26374 crate::OfferProtocol,
26375 >(value, 2, encoder, raw)?,
26376
26377 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
26378 ___E,
26379 crate::OfferDirectory,
26380 >(value, 3, encoder, raw)?,
26381
26382 Self::Storage(value) => ::fidl_next::RawWireUnion::encode_as::<
26383 ___E,
26384 crate::OfferStorage,
26385 >(value, 4, encoder, raw)?,
26386
26387 Self::Runner(value) => {
26388 ::fidl_next::RawWireUnion::encode_as::<___E, crate::OfferRunner>(
26389 value, 5, encoder, raw,
26390 )?
26391 }
26392
26393 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<
26394 ___E,
26395 crate::OfferResolver,
26396 >(value, 6, encoder, raw)?,
26397
26398 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
26399 ___E,
26400 crate::OfferEventStream,
26401 >(value, 8, encoder, raw)?,
26402
26403 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
26404 ___E,
26405 crate::OfferDictionary,
26406 >(value, 9, encoder, raw)?,
26407
26408 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
26409 ___E,
26410 crate::OfferConfiguration,
26411 >(value, 10, encoder, raw)?,
26412
26413 Self::UnknownOrdinal_(ordinal) => {
26414 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
26415 }
26416 }
26417
26418 Ok(())
26419 }
26420}
26421
26422unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Offer
26423where
26424 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
26425
26426 ___E: ::fidl_next::Encoder,
26427{
26428 #[inline]
26429 fn encode_ref(
26430 &self,
26431 encoder: &mut ___E,
26432 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
26433 ) -> Result<(), ::fidl_next::EncodeError> {
26434 ::fidl_next::munge!(let WireOffer { raw, _phantom: _ } = out);
26435
26436 match self {
26437 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<
26438 ___E,
26439 &crate::OfferService,
26440 >(value, 1, encoder, raw)?,
26441
26442 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
26443 ___E,
26444 &crate::OfferProtocol,
26445 >(value, 2, encoder, raw)?,
26446
26447 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
26448 ___E,
26449 &crate::OfferDirectory,
26450 >(value, 3, encoder, raw)?,
26451
26452 Self::Storage(value) => ::fidl_next::RawWireUnion::encode_as::<
26453 ___E,
26454 &crate::OfferStorage,
26455 >(value, 4, encoder, raw)?,
26456
26457 Self::Runner(value) => {
26458 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::OfferRunner>(
26459 value, 5, encoder, raw,
26460 )?
26461 }
26462
26463 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<
26464 ___E,
26465 &crate::OfferResolver,
26466 >(value, 6, encoder, raw)?,
26467
26468 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
26469 ___E,
26470 &crate::OfferEventStream,
26471 >(value, 8, encoder, raw)?,
26472
26473 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
26474 ___E,
26475 &crate::OfferDictionary,
26476 >(value, 9, encoder, raw)?,
26477
26478 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
26479 ___E,
26480 &crate::OfferConfiguration,
26481 >(value, 10, encoder, raw)?,
26482
26483 Self::UnknownOrdinal_(ordinal) => {
26484 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
26485 }
26486 }
26487
26488 Ok(())
26489 }
26490}
26491
26492impl ::fidl_next::EncodableOption for Offer {
26493 type EncodedOption = WireOptionalOffer<'static>;
26494}
26495
26496unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Offer
26497where
26498 ___E: ?Sized,
26499 Offer: ::fidl_next::Encode<___E>,
26500{
26501 #[inline]
26502 fn encode_option(
26503 this: Option<Self>,
26504 encoder: &mut ___E,
26505 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
26506 ) -> Result<(), ::fidl_next::EncodeError> {
26507 ::fidl_next::munge!(let WireOptionalOffer { raw, _phantom: _ } = &mut *out);
26508
26509 if let Some(inner) = this {
26510 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
26511 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
26512 } else {
26513 ::fidl_next::RawWireUnion::encode_absent(raw);
26514 }
26515
26516 Ok(())
26517 }
26518}
26519
26520unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Offer
26521where
26522 ___E: ?Sized,
26523 Offer: ::fidl_next::EncodeRef<___E>,
26524{
26525 #[inline]
26526 fn encode_option_ref(
26527 this: Option<&Self>,
26528 encoder: &mut ___E,
26529 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
26530 ) -> Result<(), ::fidl_next::EncodeError> {
26531 ::fidl_next::munge!(let WireOptionalOffer { raw, _phantom: _ } = &mut *out);
26532
26533 if let Some(inner) = this {
26534 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
26535 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
26536 } else {
26537 ::fidl_next::RawWireUnion::encode_absent(raw);
26538 }
26539
26540 Ok(())
26541 }
26542}
26543
26544impl<'de> ::fidl_next::FromWire<WireOffer<'de>> for Offer {
26545 #[inline]
26546 fn from_wire(wire: WireOffer<'de>) -> Self {
26547 let wire = ::core::mem::ManuallyDrop::new(wire);
26548 match wire.raw.ordinal() {
26549 1 => Self::Service(::fidl_next::FromWire::from_wire(unsafe {
26550 wire.raw.get().read_unchecked::<crate::WireOfferService<'de>>()
26551 })),
26552
26553 2 => Self::Protocol(::fidl_next::FromWire::from_wire(unsafe {
26554 wire.raw.get().read_unchecked::<crate::WireOfferProtocol<'de>>()
26555 })),
26556
26557 3 => Self::Directory(::fidl_next::FromWire::from_wire(unsafe {
26558 wire.raw.get().read_unchecked::<crate::WireOfferDirectory<'de>>()
26559 })),
26560
26561 4 => Self::Storage(::fidl_next::FromWire::from_wire(unsafe {
26562 wire.raw.get().read_unchecked::<crate::WireOfferStorage<'de>>()
26563 })),
26564
26565 5 => Self::Runner(::fidl_next::FromWire::from_wire(unsafe {
26566 wire.raw.get().read_unchecked::<crate::WireOfferRunner<'de>>()
26567 })),
26568
26569 6 => Self::Resolver(::fidl_next::FromWire::from_wire(unsafe {
26570 wire.raw.get().read_unchecked::<crate::WireOfferResolver<'de>>()
26571 })),
26572
26573 8 => Self::EventStream(::fidl_next::FromWire::from_wire(unsafe {
26574 wire.raw.get().read_unchecked::<crate::WireOfferEventStream<'de>>()
26575 })),
26576
26577 9 => Self::Dictionary(::fidl_next::FromWire::from_wire(unsafe {
26578 wire.raw.get().read_unchecked::<crate::WireOfferDictionary<'de>>()
26579 })),
26580
26581 10 => Self::Config(::fidl_next::FromWire::from_wire(unsafe {
26582 wire.raw.get().read_unchecked::<crate::WireOfferConfiguration<'de>>()
26583 })),
26584
26585 _ => unsafe { ::core::hint::unreachable_unchecked() },
26586 }
26587 }
26588}
26589
26590impl<'de> ::fidl_next::FromWireRef<WireOffer<'de>> for Offer {
26591 #[inline]
26592 fn from_wire_ref(wire: &WireOffer<'de>) -> Self {
26593 match wire.raw.ordinal() {
26594 1 => Self::Service(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26595 wire.raw.get().deref_unchecked::<crate::WireOfferService<'de>>()
26596 })),
26597
26598 2 => Self::Protocol(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26599 wire.raw.get().deref_unchecked::<crate::WireOfferProtocol<'de>>()
26600 })),
26601
26602 3 => Self::Directory(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26603 wire.raw.get().deref_unchecked::<crate::WireOfferDirectory<'de>>()
26604 })),
26605
26606 4 => Self::Storage(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26607 wire.raw.get().deref_unchecked::<crate::WireOfferStorage<'de>>()
26608 })),
26609
26610 5 => Self::Runner(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26611 wire.raw.get().deref_unchecked::<crate::WireOfferRunner<'de>>()
26612 })),
26613
26614 6 => Self::Resolver(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26615 wire.raw.get().deref_unchecked::<crate::WireOfferResolver<'de>>()
26616 })),
26617
26618 8 => Self::EventStream(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26619 wire.raw.get().deref_unchecked::<crate::WireOfferEventStream<'de>>()
26620 })),
26621
26622 9 => Self::Dictionary(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26623 wire.raw.get().deref_unchecked::<crate::WireOfferDictionary<'de>>()
26624 })),
26625
26626 10 => Self::Config(::fidl_next::FromWireRef::from_wire_ref(unsafe {
26627 wire.raw.get().deref_unchecked::<crate::WireOfferConfiguration<'de>>()
26628 })),
26629
26630 _ => unsafe { ::core::hint::unreachable_unchecked() },
26631 }
26632 }
26633}
26634
26635impl<'de> ::fidl_next::FromWireOption<WireOptionalOffer<'de>> for Box<Offer> {
26636 #[inline]
26637 fn from_wire_option(wire: WireOptionalOffer<'de>) -> Option<Self> {
26638 if let Some(inner) = wire.into_option() {
26639 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
26640 } else {
26641 None
26642 }
26643 }
26644}
26645
26646impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalOffer<'de>> for Box<Offer> {
26647 #[inline]
26648 fn from_wire_option_ref(wire: &WireOptionalOffer<'de>) -> Option<Self> {
26649 if let Some(inner) = wire.as_ref() {
26650 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
26651 } else {
26652 None
26653 }
26654 }
26655}
26656
26657#[repr(transparent)]
26659pub struct WireOffer<'de> {
26660 raw: ::fidl_next::RawWireUnion,
26661 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
26662}
26663
26664impl<'de> Drop for WireOffer<'de> {
26665 fn drop(&mut self) {
26666 match self.raw.ordinal() {
26667 1 => {
26668 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireOfferService<'de>>() };
26669 }
26670
26671 2 => {
26672 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireOfferProtocol<'de>>() };
26673 }
26674
26675 3 => {
26676 let _ =
26677 unsafe { self.raw.get().read_unchecked::<crate::WireOfferDirectory<'de>>() };
26678 }
26679
26680 4 => {
26681 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireOfferStorage<'de>>() };
26682 }
26683
26684 5 => {
26685 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireOfferRunner<'de>>() };
26686 }
26687
26688 6 => {
26689 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireOfferResolver<'de>>() };
26690 }
26691
26692 8 => {
26693 let _ =
26694 unsafe { self.raw.get().read_unchecked::<crate::WireOfferEventStream<'de>>() };
26695 }
26696
26697 9 => {
26698 let _ =
26699 unsafe { self.raw.get().read_unchecked::<crate::WireOfferDictionary<'de>>() };
26700 }
26701
26702 10 => {
26703 let _ = unsafe {
26704 self.raw.get().read_unchecked::<crate::WireOfferConfiguration<'de>>()
26705 };
26706 }
26707
26708 _ => (),
26709 }
26710 }
26711}
26712
26713unsafe impl ::fidl_next::Wire for WireOffer<'static> {
26714 type Decoded<'de> = WireOffer<'de>;
26715
26716 #[inline]
26717 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
26718 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
26719 ::fidl_next::RawWireUnion::zero_padding(raw);
26720 }
26721}
26722
26723pub mod offer {
26724 pub enum Ref<'de> {
26725 Service(&'de crate::WireOfferService<'de>),
26726
26727 Protocol(&'de crate::WireOfferProtocol<'de>),
26728
26729 Directory(&'de crate::WireOfferDirectory<'de>),
26730
26731 Storage(&'de crate::WireOfferStorage<'de>),
26732
26733 Runner(&'de crate::WireOfferRunner<'de>),
26734
26735 Resolver(&'de crate::WireOfferResolver<'de>),
26736
26737 EventStream(&'de crate::WireOfferEventStream<'de>),
26738
26739 Dictionary(&'de crate::WireOfferDictionary<'de>),
26740
26741 Config(&'de crate::WireOfferConfiguration<'de>),
26742
26743 UnknownOrdinal_(u64),
26744 }
26745}
26746
26747impl<'de> WireOffer<'de> {
26748 pub fn as_ref(&self) -> crate::offer::Ref<'_> {
26749 match self.raw.ordinal() {
26750 1 => crate::offer::Ref::Service(unsafe {
26751 self.raw.get().deref_unchecked::<crate::WireOfferService<'_>>()
26752 }),
26753
26754 2 => crate::offer::Ref::Protocol(unsafe {
26755 self.raw.get().deref_unchecked::<crate::WireOfferProtocol<'_>>()
26756 }),
26757
26758 3 => crate::offer::Ref::Directory(unsafe {
26759 self.raw.get().deref_unchecked::<crate::WireOfferDirectory<'_>>()
26760 }),
26761
26762 4 => crate::offer::Ref::Storage(unsafe {
26763 self.raw.get().deref_unchecked::<crate::WireOfferStorage<'_>>()
26764 }),
26765
26766 5 => crate::offer::Ref::Runner(unsafe {
26767 self.raw.get().deref_unchecked::<crate::WireOfferRunner<'_>>()
26768 }),
26769
26770 6 => crate::offer::Ref::Resolver(unsafe {
26771 self.raw.get().deref_unchecked::<crate::WireOfferResolver<'_>>()
26772 }),
26773
26774 8 => crate::offer::Ref::EventStream(unsafe {
26775 self.raw.get().deref_unchecked::<crate::WireOfferEventStream<'_>>()
26776 }),
26777
26778 9 => crate::offer::Ref::Dictionary(unsafe {
26779 self.raw.get().deref_unchecked::<crate::WireOfferDictionary<'_>>()
26780 }),
26781
26782 10 => crate::offer::Ref::Config(unsafe {
26783 self.raw.get().deref_unchecked::<crate::WireOfferConfiguration<'_>>()
26784 }),
26785
26786 unknown => crate::offer::Ref::UnknownOrdinal_(unknown),
26787 }
26788 }
26789}
26790
26791unsafe impl<___D> ::fidl_next::Decode<___D> for WireOffer<'static>
26792where
26793 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
26794
26795 ___D: ::fidl_next::Decoder,
26796{
26797 fn decode(
26798 mut slot: ::fidl_next::Slot<'_, Self>,
26799 decoder: &mut ___D,
26800 ) -> Result<(), ::fidl_next::DecodeError> {
26801 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
26802 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
26803 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferService<'static>>(
26804 raw, decoder,
26805 )?,
26806
26807 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferProtocol<'static>>(
26808 raw, decoder,
26809 )?,
26810
26811 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferDirectory<'static>>(
26812 raw, decoder,
26813 )?,
26814
26815 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferStorage<'static>>(
26816 raw, decoder,
26817 )?,
26818
26819 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferRunner<'static>>(
26820 raw, decoder,
26821 )?,
26822
26823 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferResolver<'static>>(
26824 raw, decoder,
26825 )?,
26826
26827 8 => {
26828 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferEventStream<'static>>(
26829 raw, decoder,
26830 )?
26831 }
26832
26833 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferDictionary<'static>>(
26834 raw, decoder,
26835 )?,
26836
26837 10 => ::fidl_next::RawWireUnion::decode_as::<
26838 ___D,
26839 crate::WireOfferConfiguration<'static>,
26840 >(raw, decoder)?,
26841
26842 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
26843 }
26844
26845 Ok(())
26846 }
26847}
26848
26849impl<'de> ::core::fmt::Debug for WireOffer<'de> {
26850 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
26851 match self.raw.ordinal() {
26852 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferService<'_>>().fmt(f) },
26853 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferProtocol<'_>>().fmt(f) },
26854 3 => unsafe {
26855 self.raw.get().deref_unchecked::<crate::WireOfferDirectory<'_>>().fmt(f)
26856 },
26857 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferStorage<'_>>().fmt(f) },
26858 5 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferRunner<'_>>().fmt(f) },
26859 6 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferResolver<'_>>().fmt(f) },
26860 8 => unsafe {
26861 self.raw.get().deref_unchecked::<crate::WireOfferEventStream<'_>>().fmt(f)
26862 },
26863 9 => unsafe {
26864 self.raw.get().deref_unchecked::<crate::WireOfferDictionary<'_>>().fmt(f)
26865 },
26866 10 => unsafe {
26867 self.raw.get().deref_unchecked::<crate::WireOfferConfiguration<'_>>().fmt(f)
26868 },
26869 _ => unsafe { ::core::hint::unreachable_unchecked() },
26870 }
26871 }
26872}
26873
26874#[repr(transparent)]
26875pub struct WireOptionalOffer<'de> {
26876 raw: ::fidl_next::RawWireUnion,
26877 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
26878}
26879
26880unsafe impl ::fidl_next::Wire for WireOptionalOffer<'static> {
26881 type Decoded<'de> = WireOptionalOffer<'de>;
26882
26883 #[inline]
26884 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
26885 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
26886 ::fidl_next::RawWireUnion::zero_padding(raw);
26887 }
26888}
26889
26890impl<'de> WireOptionalOffer<'de> {
26891 pub fn is_some(&self) -> bool {
26892 self.raw.is_some()
26893 }
26894
26895 pub fn is_none(&self) -> bool {
26896 self.raw.is_none()
26897 }
26898
26899 pub fn as_ref(&self) -> Option<&WireOffer<'de>> {
26900 if self.is_some() {
26901 Some(unsafe { &*(self as *const Self).cast() })
26902 } else {
26903 None
26904 }
26905 }
26906
26907 pub fn into_option(self) -> Option<WireOffer<'de>> {
26908 if self.is_some() {
26909 Some(WireOffer { raw: self.raw, _phantom: ::core::marker::PhantomData })
26910 } else {
26911 None
26912 }
26913 }
26914}
26915
26916unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalOffer<'static>
26917where
26918 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
26919
26920 ___D: ::fidl_next::Decoder,
26921{
26922 fn decode(
26923 mut slot: ::fidl_next::Slot<'_, Self>,
26924 decoder: &mut ___D,
26925 ) -> Result<(), ::fidl_next::DecodeError> {
26926 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
26927 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
26928 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferService<'static>>(
26929 raw, decoder,
26930 )?,
26931
26932 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferProtocol<'static>>(
26933 raw, decoder,
26934 )?,
26935
26936 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferDirectory<'static>>(
26937 raw, decoder,
26938 )?,
26939
26940 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferStorage<'static>>(
26941 raw, decoder,
26942 )?,
26943
26944 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferRunner<'static>>(
26945 raw, decoder,
26946 )?,
26947
26948 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferResolver<'static>>(
26949 raw, decoder,
26950 )?,
26951
26952 8 => {
26953 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferEventStream<'static>>(
26954 raw, decoder,
26955 )?
26956 }
26957
26958 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferDictionary<'static>>(
26959 raw, decoder,
26960 )?,
26961
26962 10 => ::fidl_next::RawWireUnion::decode_as::<
26963 ___D,
26964 crate::WireOfferConfiguration<'static>,
26965 >(raw, decoder)?,
26966
26967 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
26968 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
26969 }
26970
26971 Ok(())
26972 }
26973}
26974
26975impl<'de> ::core::fmt::Debug for WireOptionalOffer<'de> {
26976 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
26977 self.as_ref().fmt(f)
26978 }
26979}
26980
26981#[doc = " A repository of the runners available in an environment.\n"]
26982#[derive(Clone, Debug, Default)]
26983pub struct RunnerRegistration {
26984 pub source_name: Option<String>,
26985
26986 pub source: Option<crate::Ref>,
26987
26988 pub target_name: Option<String>,
26989}
26990
26991impl RunnerRegistration {
26992 fn __max_ordinal(&self) -> usize {
26993 if self.target_name.is_some() {
26994 return 3;
26995 }
26996
26997 if self.source.is_some() {
26998 return 2;
26999 }
27000
27001 if self.source_name.is_some() {
27002 return 1;
27003 }
27004
27005 0
27006 }
27007}
27008
27009impl ::fidl_next::Encodable for RunnerRegistration {
27010 type Encoded = WireRunnerRegistration<'static>;
27011}
27012
27013unsafe impl<___E> ::fidl_next::Encode<___E> for RunnerRegistration
27014where
27015 ___E: ::fidl_next::Encoder + ?Sized,
27016{
27017 #[inline]
27018 fn encode(
27019 mut self,
27020 encoder: &mut ___E,
27021 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
27022 ) -> Result<(), ::fidl_next::EncodeError> {
27023 ::fidl_next::munge!(let WireRunnerRegistration { table } = out);
27024
27025 let max_ord = self.__max_ordinal();
27026
27027 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
27028 ::fidl_next::Wire::zero_padding(&mut out);
27029
27030 let mut preallocated =
27031 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
27032
27033 for i in 1..=max_ord {
27034 match i {
27035 3 => {
27036 if let Some(target_name) = self.target_name.take() {
27037 ::fidl_next::WireEnvelope::encode_value(
27038 target_name,
27039 preallocated.encoder,
27040 &mut out,
27041 )?;
27042 } else {
27043 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27044 }
27045 }
27046
27047 2 => {
27048 if let Some(source) = self.source.take() {
27049 ::fidl_next::WireEnvelope::encode_value(
27050 source,
27051 preallocated.encoder,
27052 &mut out,
27053 )?;
27054 } else {
27055 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27056 }
27057 }
27058
27059 1 => {
27060 if let Some(source_name) = self.source_name.take() {
27061 ::fidl_next::WireEnvelope::encode_value(
27062 source_name,
27063 preallocated.encoder,
27064 &mut out,
27065 )?;
27066 } else {
27067 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27068 }
27069 }
27070
27071 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
27072 }
27073 unsafe {
27074 preallocated.write_next(out.assume_init_ref());
27075 }
27076 }
27077
27078 ::fidl_next::WireTable::encode_len(table, max_ord);
27079
27080 Ok(())
27081 }
27082}
27083
27084unsafe impl<___E> ::fidl_next::EncodeRef<___E> for RunnerRegistration
27085where
27086 ___E: ::fidl_next::Encoder + ?Sized,
27087{
27088 #[inline]
27089 fn encode_ref(
27090 &self,
27091 encoder: &mut ___E,
27092 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
27093 ) -> Result<(), ::fidl_next::EncodeError> {
27094 ::fidl_next::munge!(let WireRunnerRegistration { table } = out);
27095
27096 let max_ord = self.__max_ordinal();
27097
27098 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
27099 ::fidl_next::Wire::zero_padding(&mut out);
27100
27101 let mut preallocated =
27102 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
27103
27104 for i in 1..=max_ord {
27105 match i {
27106 3 => {
27107 if let Some(target_name) = &self.target_name {
27108 ::fidl_next::WireEnvelope::encode_value(
27109 target_name,
27110 preallocated.encoder,
27111 &mut out,
27112 )?;
27113 } else {
27114 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27115 }
27116 }
27117
27118 2 => {
27119 if let Some(source) = &self.source {
27120 ::fidl_next::WireEnvelope::encode_value(
27121 source,
27122 preallocated.encoder,
27123 &mut out,
27124 )?;
27125 } else {
27126 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27127 }
27128 }
27129
27130 1 => {
27131 if let Some(source_name) = &self.source_name {
27132 ::fidl_next::WireEnvelope::encode_value(
27133 source_name,
27134 preallocated.encoder,
27135 &mut out,
27136 )?;
27137 } else {
27138 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27139 }
27140 }
27141
27142 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
27143 }
27144 unsafe {
27145 preallocated.write_next(out.assume_init_ref());
27146 }
27147 }
27148
27149 ::fidl_next::WireTable::encode_len(table, max_ord);
27150
27151 Ok(())
27152 }
27153}
27154
27155impl<'de> ::fidl_next::FromWire<WireRunnerRegistration<'de>> for RunnerRegistration {
27156 #[inline]
27157 fn from_wire(wire: WireRunnerRegistration<'de>) -> Self {
27158 let wire = ::core::mem::ManuallyDrop::new(wire);
27159
27160 let source_name = wire.table.get(1);
27161
27162 let source = wire.table.get(2);
27163
27164 let target_name = wire.table.get(3);
27165
27166 Self {
27167 source_name: source_name.map(|envelope| {
27168 ::fidl_next::FromWire::from_wire(unsafe {
27169 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
27170 })
27171 }),
27172
27173 source: source.map(|envelope| {
27174 ::fidl_next::FromWire::from_wire(unsafe {
27175 envelope.read_unchecked::<crate::WireRef<'de>>()
27176 })
27177 }),
27178
27179 target_name: target_name.map(|envelope| {
27180 ::fidl_next::FromWire::from_wire(unsafe {
27181 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
27182 })
27183 }),
27184 }
27185 }
27186}
27187
27188impl<'de> ::fidl_next::FromWireRef<WireRunnerRegistration<'de>> for RunnerRegistration {
27189 #[inline]
27190 fn from_wire_ref(wire: &WireRunnerRegistration<'de>) -> Self {
27191 Self {
27192 source_name: wire.table.get(1).map(|envelope| {
27193 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27194 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
27195 })
27196 }),
27197
27198 source: wire.table.get(2).map(|envelope| {
27199 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27200 envelope.deref_unchecked::<crate::WireRef<'de>>()
27201 })
27202 }),
27203
27204 target_name: wire.table.get(3).map(|envelope| {
27205 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27206 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
27207 })
27208 }),
27209 }
27210 }
27211}
27212
27213#[repr(C)]
27215pub struct WireRunnerRegistration<'de> {
27216 table: ::fidl_next::WireTable<'de>,
27217}
27218
27219impl<'de> Drop for WireRunnerRegistration<'de> {
27220 fn drop(&mut self) {
27221 let _ = self
27222 .table
27223 .get(1)
27224 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
27225
27226 let _ = self
27227 .table
27228 .get(2)
27229 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
27230
27231 let _ = self
27232 .table
27233 .get(3)
27234 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
27235 }
27236}
27237
27238unsafe impl ::fidl_next::Wire for WireRunnerRegistration<'static> {
27239 type Decoded<'de> = WireRunnerRegistration<'de>;
27240
27241 #[inline]
27242 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
27243 ::fidl_next::munge!(let Self { table } = out);
27244 ::fidl_next::WireTable::zero_padding(table);
27245 }
27246}
27247
27248unsafe impl<___D> ::fidl_next::Decode<___D> for WireRunnerRegistration<'static>
27249where
27250 ___D: ::fidl_next::Decoder + ?Sized,
27251{
27252 fn decode(
27253 slot: ::fidl_next::Slot<'_, Self>,
27254 decoder: &mut ___D,
27255 ) -> Result<(), ::fidl_next::DecodeError> {
27256 ::fidl_next::munge!(let Self { table } = slot);
27257
27258 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
27259 match ordinal {
27260 0 => unsafe { ::core::hint::unreachable_unchecked() },
27261
27262 1 => {
27263 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
27264 slot.as_mut(),
27265 decoder,
27266 )?;
27267
27268 let source_name = unsafe {
27269 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
27270 };
27271
27272 if source_name.len() > 100 {
27273 return Err(::fidl_next::DecodeError::VectorTooLong {
27274 size: source_name.len() as u64,
27275 limit: 100,
27276 });
27277 }
27278
27279 Ok(())
27280 }
27281
27282 2 => {
27283 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
27284 slot.as_mut(),
27285 decoder,
27286 )?;
27287
27288 Ok(())
27289 }
27290
27291 3 => {
27292 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
27293 slot.as_mut(),
27294 decoder,
27295 )?;
27296
27297 let target_name = unsafe {
27298 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
27299 };
27300
27301 if target_name.len() > 100 {
27302 return Err(::fidl_next::DecodeError::VectorTooLong {
27303 size: target_name.len() as u64,
27304 limit: 100,
27305 });
27306 }
27307
27308 Ok(())
27309 }
27310
27311 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
27312 }
27313 })
27314 }
27315}
27316
27317impl<'de> WireRunnerRegistration<'de> {
27318 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
27319 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
27320 }
27321
27322 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
27323 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
27324 }
27325
27326 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
27327 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
27328 }
27329}
27330
27331impl<'de> ::core::fmt::Debug for WireRunnerRegistration<'de> {
27332 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
27333 f.debug_struct("RunnerRegistration")
27334 .field("source_name", &self.source_name())
27335 .field("source", &self.source())
27336 .field("target_name", &self.target_name())
27337 .finish()
27338 }
27339}
27340
27341#[doc = " A mapping of URL scheme to resolver name.\n"]
27342#[derive(Clone, Debug, Default)]
27343pub struct ResolverRegistration {
27344 pub resolver: Option<String>,
27345
27346 pub source: Option<crate::Ref>,
27347
27348 pub scheme: Option<String>,
27349}
27350
27351impl ResolverRegistration {
27352 fn __max_ordinal(&self) -> usize {
27353 if self.scheme.is_some() {
27354 return 3;
27355 }
27356
27357 if self.source.is_some() {
27358 return 2;
27359 }
27360
27361 if self.resolver.is_some() {
27362 return 1;
27363 }
27364
27365 0
27366 }
27367}
27368
27369impl ::fidl_next::Encodable for ResolverRegistration {
27370 type Encoded = WireResolverRegistration<'static>;
27371}
27372
27373unsafe impl<___E> ::fidl_next::Encode<___E> for ResolverRegistration
27374where
27375 ___E: ::fidl_next::Encoder + ?Sized,
27376{
27377 #[inline]
27378 fn encode(
27379 mut self,
27380 encoder: &mut ___E,
27381 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
27382 ) -> Result<(), ::fidl_next::EncodeError> {
27383 ::fidl_next::munge!(let WireResolverRegistration { table } = out);
27384
27385 let max_ord = self.__max_ordinal();
27386
27387 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
27388 ::fidl_next::Wire::zero_padding(&mut out);
27389
27390 let mut preallocated =
27391 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
27392
27393 for i in 1..=max_ord {
27394 match i {
27395 3 => {
27396 if let Some(scheme) = self.scheme.take() {
27397 ::fidl_next::WireEnvelope::encode_value(
27398 scheme,
27399 preallocated.encoder,
27400 &mut out,
27401 )?;
27402 } else {
27403 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27404 }
27405 }
27406
27407 2 => {
27408 if let Some(source) = self.source.take() {
27409 ::fidl_next::WireEnvelope::encode_value(
27410 source,
27411 preallocated.encoder,
27412 &mut out,
27413 )?;
27414 } else {
27415 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27416 }
27417 }
27418
27419 1 => {
27420 if let Some(resolver) = self.resolver.take() {
27421 ::fidl_next::WireEnvelope::encode_value(
27422 resolver,
27423 preallocated.encoder,
27424 &mut out,
27425 )?;
27426 } else {
27427 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27428 }
27429 }
27430
27431 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
27432 }
27433 unsafe {
27434 preallocated.write_next(out.assume_init_ref());
27435 }
27436 }
27437
27438 ::fidl_next::WireTable::encode_len(table, max_ord);
27439
27440 Ok(())
27441 }
27442}
27443
27444unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolverRegistration
27445where
27446 ___E: ::fidl_next::Encoder + ?Sized,
27447{
27448 #[inline]
27449 fn encode_ref(
27450 &self,
27451 encoder: &mut ___E,
27452 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
27453 ) -> Result<(), ::fidl_next::EncodeError> {
27454 ::fidl_next::munge!(let WireResolverRegistration { table } = out);
27455
27456 let max_ord = self.__max_ordinal();
27457
27458 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
27459 ::fidl_next::Wire::zero_padding(&mut out);
27460
27461 let mut preallocated =
27462 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
27463
27464 for i in 1..=max_ord {
27465 match i {
27466 3 => {
27467 if let Some(scheme) = &self.scheme {
27468 ::fidl_next::WireEnvelope::encode_value(
27469 scheme,
27470 preallocated.encoder,
27471 &mut out,
27472 )?;
27473 } else {
27474 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27475 }
27476 }
27477
27478 2 => {
27479 if let Some(source) = &self.source {
27480 ::fidl_next::WireEnvelope::encode_value(
27481 source,
27482 preallocated.encoder,
27483 &mut out,
27484 )?;
27485 } else {
27486 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27487 }
27488 }
27489
27490 1 => {
27491 if let Some(resolver) = &self.resolver {
27492 ::fidl_next::WireEnvelope::encode_value(
27493 resolver,
27494 preallocated.encoder,
27495 &mut out,
27496 )?;
27497 } else {
27498 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27499 }
27500 }
27501
27502 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
27503 }
27504 unsafe {
27505 preallocated.write_next(out.assume_init_ref());
27506 }
27507 }
27508
27509 ::fidl_next::WireTable::encode_len(table, max_ord);
27510
27511 Ok(())
27512 }
27513}
27514
27515impl<'de> ::fidl_next::FromWire<WireResolverRegistration<'de>> for ResolverRegistration {
27516 #[inline]
27517 fn from_wire(wire: WireResolverRegistration<'de>) -> Self {
27518 let wire = ::core::mem::ManuallyDrop::new(wire);
27519
27520 let resolver = wire.table.get(1);
27521
27522 let source = wire.table.get(2);
27523
27524 let scheme = wire.table.get(3);
27525
27526 Self {
27527 resolver: resolver.map(|envelope| {
27528 ::fidl_next::FromWire::from_wire(unsafe {
27529 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
27530 })
27531 }),
27532
27533 source: source.map(|envelope| {
27534 ::fidl_next::FromWire::from_wire(unsafe {
27535 envelope.read_unchecked::<crate::WireRef<'de>>()
27536 })
27537 }),
27538
27539 scheme: scheme.map(|envelope| {
27540 ::fidl_next::FromWire::from_wire(unsafe {
27541 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
27542 })
27543 }),
27544 }
27545 }
27546}
27547
27548impl<'de> ::fidl_next::FromWireRef<WireResolverRegistration<'de>> for ResolverRegistration {
27549 #[inline]
27550 fn from_wire_ref(wire: &WireResolverRegistration<'de>) -> Self {
27551 Self {
27552 resolver: wire.table.get(1).map(|envelope| {
27553 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27554 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
27555 })
27556 }),
27557
27558 source: wire.table.get(2).map(|envelope| {
27559 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27560 envelope.deref_unchecked::<crate::WireRef<'de>>()
27561 })
27562 }),
27563
27564 scheme: wire.table.get(3).map(|envelope| {
27565 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27566 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
27567 })
27568 }),
27569 }
27570 }
27571}
27572
27573#[repr(C)]
27575pub struct WireResolverRegistration<'de> {
27576 table: ::fidl_next::WireTable<'de>,
27577}
27578
27579impl<'de> Drop for WireResolverRegistration<'de> {
27580 fn drop(&mut self) {
27581 let _ = self
27582 .table
27583 .get(1)
27584 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
27585
27586 let _ = self
27587 .table
27588 .get(2)
27589 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
27590
27591 let _ = self
27592 .table
27593 .get(3)
27594 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
27595 }
27596}
27597
27598unsafe impl ::fidl_next::Wire for WireResolverRegistration<'static> {
27599 type Decoded<'de> = WireResolverRegistration<'de>;
27600
27601 #[inline]
27602 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
27603 ::fidl_next::munge!(let Self { table } = out);
27604 ::fidl_next::WireTable::zero_padding(table);
27605 }
27606}
27607
27608unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolverRegistration<'static>
27609where
27610 ___D: ::fidl_next::Decoder + ?Sized,
27611{
27612 fn decode(
27613 slot: ::fidl_next::Slot<'_, Self>,
27614 decoder: &mut ___D,
27615 ) -> Result<(), ::fidl_next::DecodeError> {
27616 ::fidl_next::munge!(let Self { table } = slot);
27617
27618 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
27619 match ordinal {
27620 0 => unsafe { ::core::hint::unreachable_unchecked() },
27621
27622 1 => {
27623 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
27624 slot.as_mut(),
27625 decoder,
27626 )?;
27627
27628 let resolver = unsafe {
27629 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
27630 };
27631
27632 if resolver.len() > 100 {
27633 return Err(::fidl_next::DecodeError::VectorTooLong {
27634 size: resolver.len() as u64,
27635 limit: 100,
27636 });
27637 }
27638
27639 Ok(())
27640 }
27641
27642 2 => {
27643 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
27644 slot.as_mut(),
27645 decoder,
27646 )?;
27647
27648 Ok(())
27649 }
27650
27651 3 => {
27652 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
27653 slot.as_mut(),
27654 decoder,
27655 )?;
27656
27657 let scheme = unsafe {
27658 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
27659 };
27660
27661 if scheme.len() > 100 {
27662 return Err(::fidl_next::DecodeError::VectorTooLong {
27663 size: scheme.len() as u64,
27664 limit: 100,
27665 });
27666 }
27667
27668 Ok(())
27669 }
27670
27671 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
27672 }
27673 })
27674 }
27675}
27676
27677impl<'de> WireResolverRegistration<'de> {
27678 pub fn resolver(&self) -> Option<&::fidl_next::WireString<'de>> {
27679 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
27680 }
27681
27682 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
27683 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
27684 }
27685
27686 pub fn scheme(&self) -> Option<&::fidl_next::WireString<'de>> {
27687 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
27688 }
27689}
27690
27691impl<'de> ::core::fmt::Debug for WireResolverRegistration<'de> {
27692 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
27693 f.debug_struct("ResolverRegistration")
27694 .field("resolver", &self.resolver())
27695 .field("source", &self.source())
27696 .field("scheme", &self.scheme())
27697 .finish()
27698 }
27699}
27700
27701#[doc = " Registers a protocol in the environment as a debug capability. This makes\n it available to any component in the environment that uses it with\n `source == debug`.\n\n To learn more about protocols, see:\n https://fuchsia.dev/fuchsia-src/glossary#protocol\n"]
27702#[derive(Clone, Debug, Default)]
27703pub struct DebugProtocolRegistration {
27704 pub source: Option<crate::Ref>,
27705
27706 pub source_name: Option<String>,
27707
27708 pub target_name: Option<String>,
27709}
27710
27711impl DebugProtocolRegistration {
27712 fn __max_ordinal(&self) -> usize {
27713 if self.target_name.is_some() {
27714 return 3;
27715 }
27716
27717 if self.source_name.is_some() {
27718 return 2;
27719 }
27720
27721 if self.source.is_some() {
27722 return 1;
27723 }
27724
27725 0
27726 }
27727}
27728
27729impl ::fidl_next::Encodable for DebugProtocolRegistration {
27730 type Encoded = WireDebugProtocolRegistration<'static>;
27731}
27732
27733unsafe impl<___E> ::fidl_next::Encode<___E> for DebugProtocolRegistration
27734where
27735 ___E: ::fidl_next::Encoder + ?Sized,
27736{
27737 #[inline]
27738 fn encode(
27739 mut self,
27740 encoder: &mut ___E,
27741 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
27742 ) -> Result<(), ::fidl_next::EncodeError> {
27743 ::fidl_next::munge!(let WireDebugProtocolRegistration { table } = out);
27744
27745 let max_ord = self.__max_ordinal();
27746
27747 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
27748 ::fidl_next::Wire::zero_padding(&mut out);
27749
27750 let mut preallocated =
27751 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
27752
27753 for i in 1..=max_ord {
27754 match i {
27755 3 => {
27756 if let Some(target_name) = self.target_name.take() {
27757 ::fidl_next::WireEnvelope::encode_value(
27758 target_name,
27759 preallocated.encoder,
27760 &mut out,
27761 )?;
27762 } else {
27763 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27764 }
27765 }
27766
27767 2 => {
27768 if let Some(source_name) = self.source_name.take() {
27769 ::fidl_next::WireEnvelope::encode_value(
27770 source_name,
27771 preallocated.encoder,
27772 &mut out,
27773 )?;
27774 } else {
27775 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27776 }
27777 }
27778
27779 1 => {
27780 if let Some(source) = self.source.take() {
27781 ::fidl_next::WireEnvelope::encode_value(
27782 source,
27783 preallocated.encoder,
27784 &mut out,
27785 )?;
27786 } else {
27787 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27788 }
27789 }
27790
27791 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
27792 }
27793 unsafe {
27794 preallocated.write_next(out.assume_init_ref());
27795 }
27796 }
27797
27798 ::fidl_next::WireTable::encode_len(table, max_ord);
27799
27800 Ok(())
27801 }
27802}
27803
27804unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DebugProtocolRegistration
27805where
27806 ___E: ::fidl_next::Encoder + ?Sized,
27807{
27808 #[inline]
27809 fn encode_ref(
27810 &self,
27811 encoder: &mut ___E,
27812 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
27813 ) -> Result<(), ::fidl_next::EncodeError> {
27814 ::fidl_next::munge!(let WireDebugProtocolRegistration { table } = out);
27815
27816 let max_ord = self.__max_ordinal();
27817
27818 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
27819 ::fidl_next::Wire::zero_padding(&mut out);
27820
27821 let mut preallocated =
27822 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
27823
27824 for i in 1..=max_ord {
27825 match i {
27826 3 => {
27827 if let Some(target_name) = &self.target_name {
27828 ::fidl_next::WireEnvelope::encode_value(
27829 target_name,
27830 preallocated.encoder,
27831 &mut out,
27832 )?;
27833 } else {
27834 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27835 }
27836 }
27837
27838 2 => {
27839 if let Some(source_name) = &self.source_name {
27840 ::fidl_next::WireEnvelope::encode_value(
27841 source_name,
27842 preallocated.encoder,
27843 &mut out,
27844 )?;
27845 } else {
27846 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27847 }
27848 }
27849
27850 1 => {
27851 if let Some(source) = &self.source {
27852 ::fidl_next::WireEnvelope::encode_value(
27853 source,
27854 preallocated.encoder,
27855 &mut out,
27856 )?;
27857 } else {
27858 ::fidl_next::WireEnvelope::encode_zero(&mut out)
27859 }
27860 }
27861
27862 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
27863 }
27864 unsafe {
27865 preallocated.write_next(out.assume_init_ref());
27866 }
27867 }
27868
27869 ::fidl_next::WireTable::encode_len(table, max_ord);
27870
27871 Ok(())
27872 }
27873}
27874
27875impl<'de> ::fidl_next::FromWire<WireDebugProtocolRegistration<'de>> for DebugProtocolRegistration {
27876 #[inline]
27877 fn from_wire(wire: WireDebugProtocolRegistration<'de>) -> Self {
27878 let wire = ::core::mem::ManuallyDrop::new(wire);
27879
27880 let source = wire.table.get(1);
27881
27882 let source_name = wire.table.get(2);
27883
27884 let target_name = wire.table.get(3);
27885
27886 Self {
27887 source: source.map(|envelope| {
27888 ::fidl_next::FromWire::from_wire(unsafe {
27889 envelope.read_unchecked::<crate::WireRef<'de>>()
27890 })
27891 }),
27892
27893 source_name: source_name.map(|envelope| {
27894 ::fidl_next::FromWire::from_wire(unsafe {
27895 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
27896 })
27897 }),
27898
27899 target_name: target_name.map(|envelope| {
27900 ::fidl_next::FromWire::from_wire(unsafe {
27901 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
27902 })
27903 }),
27904 }
27905 }
27906}
27907
27908impl<'de> ::fidl_next::FromWireRef<WireDebugProtocolRegistration<'de>>
27909 for DebugProtocolRegistration
27910{
27911 #[inline]
27912 fn from_wire_ref(wire: &WireDebugProtocolRegistration<'de>) -> Self {
27913 Self {
27914 source: wire.table.get(1).map(|envelope| {
27915 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27916 envelope.deref_unchecked::<crate::WireRef<'de>>()
27917 })
27918 }),
27919
27920 source_name: wire.table.get(2).map(|envelope| {
27921 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27922 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
27923 })
27924 }),
27925
27926 target_name: wire.table.get(3).map(|envelope| {
27927 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
27928 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
27929 })
27930 }),
27931 }
27932 }
27933}
27934
27935#[repr(C)]
27937pub struct WireDebugProtocolRegistration<'de> {
27938 table: ::fidl_next::WireTable<'de>,
27939}
27940
27941impl<'de> Drop for WireDebugProtocolRegistration<'de> {
27942 fn drop(&mut self) {
27943 let _ = self
27944 .table
27945 .get(1)
27946 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireRef<'de>>() });
27947
27948 let _ = self
27949 .table
27950 .get(2)
27951 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
27952
27953 let _ = self
27954 .table
27955 .get(3)
27956 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
27957 }
27958}
27959
27960unsafe impl ::fidl_next::Wire for WireDebugProtocolRegistration<'static> {
27961 type Decoded<'de> = WireDebugProtocolRegistration<'de>;
27962
27963 #[inline]
27964 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
27965 ::fidl_next::munge!(let Self { table } = out);
27966 ::fidl_next::WireTable::zero_padding(table);
27967 }
27968}
27969
27970unsafe impl<___D> ::fidl_next::Decode<___D> for WireDebugProtocolRegistration<'static>
27971where
27972 ___D: ::fidl_next::Decoder + ?Sized,
27973{
27974 fn decode(
27975 slot: ::fidl_next::Slot<'_, Self>,
27976 decoder: &mut ___D,
27977 ) -> Result<(), ::fidl_next::DecodeError> {
27978 ::fidl_next::munge!(let Self { table } = slot);
27979
27980 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
27981 match ordinal {
27982 0 => unsafe { ::core::hint::unreachable_unchecked() },
27983
27984 1 => {
27985 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef<'static>>(
27986 slot.as_mut(),
27987 decoder,
27988 )?;
27989
27990 Ok(())
27991 }
27992
27993 2 => {
27994 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
27995 slot.as_mut(),
27996 decoder,
27997 )?;
27998
27999 let source_name = unsafe {
28000 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
28001 };
28002
28003 if source_name.len() > 100 {
28004 return Err(::fidl_next::DecodeError::VectorTooLong {
28005 size: source_name.len() as u64,
28006 limit: 100,
28007 });
28008 }
28009
28010 Ok(())
28011 }
28012
28013 3 => {
28014 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
28015 slot.as_mut(),
28016 decoder,
28017 )?;
28018
28019 let target_name = unsafe {
28020 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
28021 };
28022
28023 if target_name.len() > 100 {
28024 return Err(::fidl_next::DecodeError::VectorTooLong {
28025 size: target_name.len() as u64,
28026 limit: 100,
28027 });
28028 }
28029
28030 Ok(())
28031 }
28032
28033 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
28034 }
28035 })
28036 }
28037}
28038
28039impl<'de> WireDebugProtocolRegistration<'de> {
28040 pub fn source(&self) -> Option<&crate::WireRef<'de>> {
28041 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
28042 }
28043
28044 pub fn source_name(&self) -> Option<&::fidl_next::WireString<'de>> {
28045 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
28046 }
28047
28048 pub fn target_name(&self) -> Option<&::fidl_next::WireString<'de>> {
28049 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
28050 }
28051}
28052
28053impl<'de> ::core::fmt::Debug for WireDebugProtocolRegistration<'de> {
28054 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
28055 f.debug_struct("DebugProtocolRegistration")
28056 .field("source", &self.source())
28057 .field("source_name", &self.source_name())
28058 .field("target_name", &self.target_name())
28059 .finish()
28060 }
28061}
28062
28063#[doc = " Declares a capability registered in the debug section of an environment.\n"]
28064#[derive(Clone, Debug)]
28065pub enum DebugRegistration {
28066 Protocol(crate::DebugProtocolRegistration),
28067
28068 UnknownOrdinal_(u64),
28069}
28070
28071impl ::fidl_next::Encodable for DebugRegistration {
28072 type Encoded = WireDebugRegistration<'static>;
28073}
28074
28075unsafe impl<___E> ::fidl_next::Encode<___E> for DebugRegistration
28076where
28077 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
28078
28079 ___E: ::fidl_next::Encoder,
28080{
28081 #[inline]
28082 fn encode(
28083 self,
28084 encoder: &mut ___E,
28085 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
28086 ) -> Result<(), ::fidl_next::EncodeError> {
28087 ::fidl_next::munge!(let WireDebugRegistration { raw, _phantom: _ } = out);
28088
28089 match self {
28090 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
28091 ___E,
28092 crate::DebugProtocolRegistration,
28093 >(value, 1, encoder, raw)?,
28094
28095 Self::UnknownOrdinal_(ordinal) => {
28096 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
28097 }
28098 }
28099
28100 Ok(())
28101 }
28102}
28103
28104unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DebugRegistration
28105where
28106 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
28107
28108 ___E: ::fidl_next::Encoder,
28109{
28110 #[inline]
28111 fn encode_ref(
28112 &self,
28113 encoder: &mut ___E,
28114 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
28115 ) -> Result<(), ::fidl_next::EncodeError> {
28116 ::fidl_next::munge!(let WireDebugRegistration { raw, _phantom: _ } = out);
28117
28118 match self {
28119 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
28120 ___E,
28121 &crate::DebugProtocolRegistration,
28122 >(value, 1, encoder, raw)?,
28123
28124 Self::UnknownOrdinal_(ordinal) => {
28125 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
28126 }
28127 }
28128
28129 Ok(())
28130 }
28131}
28132
28133impl ::fidl_next::EncodableOption for DebugRegistration {
28134 type EncodedOption = WireOptionalDebugRegistration<'static>;
28135}
28136
28137unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DebugRegistration
28138where
28139 ___E: ?Sized,
28140 DebugRegistration: ::fidl_next::Encode<___E>,
28141{
28142 #[inline]
28143 fn encode_option(
28144 this: Option<Self>,
28145 encoder: &mut ___E,
28146 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
28147 ) -> Result<(), ::fidl_next::EncodeError> {
28148 ::fidl_next::munge!(let WireOptionalDebugRegistration { raw, _phantom: _ } = &mut *out);
28149
28150 if let Some(inner) = this {
28151 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
28152 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
28153 } else {
28154 ::fidl_next::RawWireUnion::encode_absent(raw);
28155 }
28156
28157 Ok(())
28158 }
28159}
28160
28161unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for DebugRegistration
28162where
28163 ___E: ?Sized,
28164 DebugRegistration: ::fidl_next::EncodeRef<___E>,
28165{
28166 #[inline]
28167 fn encode_option_ref(
28168 this: Option<&Self>,
28169 encoder: &mut ___E,
28170 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
28171 ) -> Result<(), ::fidl_next::EncodeError> {
28172 ::fidl_next::munge!(let WireOptionalDebugRegistration { raw, _phantom: _ } = &mut *out);
28173
28174 if let Some(inner) = this {
28175 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
28176 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
28177 } else {
28178 ::fidl_next::RawWireUnion::encode_absent(raw);
28179 }
28180
28181 Ok(())
28182 }
28183}
28184
28185impl<'de> ::fidl_next::FromWire<WireDebugRegistration<'de>> for DebugRegistration {
28186 #[inline]
28187 fn from_wire(wire: WireDebugRegistration<'de>) -> Self {
28188 let wire = ::core::mem::ManuallyDrop::new(wire);
28189 match wire.raw.ordinal() {
28190 1 => Self::Protocol(::fidl_next::FromWire::from_wire(unsafe {
28191 wire.raw.get().read_unchecked::<crate::WireDebugProtocolRegistration<'de>>()
28192 })),
28193
28194 _ => unsafe { ::core::hint::unreachable_unchecked() },
28195 }
28196 }
28197}
28198
28199impl<'de> ::fidl_next::FromWireRef<WireDebugRegistration<'de>> for DebugRegistration {
28200 #[inline]
28201 fn from_wire_ref(wire: &WireDebugRegistration<'de>) -> Self {
28202 match wire.raw.ordinal() {
28203 1 => Self::Protocol(::fidl_next::FromWireRef::from_wire_ref(unsafe {
28204 wire.raw.get().deref_unchecked::<crate::WireDebugProtocolRegistration<'de>>()
28205 })),
28206
28207 _ => unsafe { ::core::hint::unreachable_unchecked() },
28208 }
28209 }
28210}
28211
28212impl<'de> ::fidl_next::FromWireOption<WireOptionalDebugRegistration<'de>>
28213 for Box<DebugRegistration>
28214{
28215 #[inline]
28216 fn from_wire_option(wire: WireOptionalDebugRegistration<'de>) -> Option<Self> {
28217 if let Some(inner) = wire.into_option() {
28218 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
28219 } else {
28220 None
28221 }
28222 }
28223}
28224
28225impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalDebugRegistration<'de>>
28226 for Box<DebugRegistration>
28227{
28228 #[inline]
28229 fn from_wire_option_ref(wire: &WireOptionalDebugRegistration<'de>) -> Option<Self> {
28230 if let Some(inner) = wire.as_ref() {
28231 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
28232 } else {
28233 None
28234 }
28235 }
28236}
28237
28238#[repr(transparent)]
28240pub struct WireDebugRegistration<'de> {
28241 raw: ::fidl_next::RawWireUnion,
28242 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
28243}
28244
28245impl<'de> Drop for WireDebugRegistration<'de> {
28246 fn drop(&mut self) {
28247 match self.raw.ordinal() {
28248 1 => {
28249 let _ = unsafe {
28250 self.raw.get().read_unchecked::<crate::WireDebugProtocolRegistration<'de>>()
28251 };
28252 }
28253
28254 _ => (),
28255 }
28256 }
28257}
28258
28259unsafe impl ::fidl_next::Wire for WireDebugRegistration<'static> {
28260 type Decoded<'de> = WireDebugRegistration<'de>;
28261
28262 #[inline]
28263 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
28264 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
28265 ::fidl_next::RawWireUnion::zero_padding(raw);
28266 }
28267}
28268
28269pub mod debug_registration {
28270 pub enum Ref<'de> {
28271 Protocol(&'de crate::WireDebugProtocolRegistration<'de>),
28272
28273 UnknownOrdinal_(u64),
28274 }
28275}
28276
28277impl<'de> WireDebugRegistration<'de> {
28278 pub fn as_ref(&self) -> crate::debug_registration::Ref<'_> {
28279 match self.raw.ordinal() {
28280 1 => crate::debug_registration::Ref::Protocol(unsafe {
28281 self.raw.get().deref_unchecked::<crate::WireDebugProtocolRegistration<'_>>()
28282 }),
28283
28284 unknown => crate::debug_registration::Ref::UnknownOrdinal_(unknown),
28285 }
28286 }
28287}
28288
28289unsafe impl<___D> ::fidl_next::Decode<___D> for WireDebugRegistration<'static>
28290where
28291 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
28292
28293 ___D: ::fidl_next::Decoder,
28294{
28295 fn decode(
28296 mut slot: ::fidl_next::Slot<'_, Self>,
28297 decoder: &mut ___D,
28298 ) -> Result<(), ::fidl_next::DecodeError> {
28299 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
28300 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
28301 1 => ::fidl_next::RawWireUnion::decode_as::<
28302 ___D,
28303 crate::WireDebugProtocolRegistration<'static>,
28304 >(raw, decoder)?,
28305
28306 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
28307 }
28308
28309 Ok(())
28310 }
28311}
28312
28313impl<'de> ::core::fmt::Debug for WireDebugRegistration<'de> {
28314 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
28315 match self.raw.ordinal() {
28316 1 => unsafe {
28317 self.raw.get().deref_unchecked::<crate::WireDebugProtocolRegistration<'_>>().fmt(f)
28318 },
28319 _ => unsafe { ::core::hint::unreachable_unchecked() },
28320 }
28321 }
28322}
28323
28324#[repr(transparent)]
28325pub struct WireOptionalDebugRegistration<'de> {
28326 raw: ::fidl_next::RawWireUnion,
28327 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
28328}
28329
28330unsafe impl ::fidl_next::Wire for WireOptionalDebugRegistration<'static> {
28331 type Decoded<'de> = WireOptionalDebugRegistration<'de>;
28332
28333 #[inline]
28334 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
28335 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
28336 ::fidl_next::RawWireUnion::zero_padding(raw);
28337 }
28338}
28339
28340impl<'de> WireOptionalDebugRegistration<'de> {
28341 pub fn is_some(&self) -> bool {
28342 self.raw.is_some()
28343 }
28344
28345 pub fn is_none(&self) -> bool {
28346 self.raw.is_none()
28347 }
28348
28349 pub fn as_ref(&self) -> Option<&WireDebugRegistration<'de>> {
28350 if self.is_some() {
28351 Some(unsafe { &*(self as *const Self).cast() })
28352 } else {
28353 None
28354 }
28355 }
28356
28357 pub fn into_option(self) -> Option<WireDebugRegistration<'de>> {
28358 if self.is_some() {
28359 Some(WireDebugRegistration { raw: self.raw, _phantom: ::core::marker::PhantomData })
28360 } else {
28361 None
28362 }
28363 }
28364}
28365
28366unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalDebugRegistration<'static>
28367where
28368 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
28369
28370 ___D: ::fidl_next::Decoder,
28371{
28372 fn decode(
28373 mut slot: ::fidl_next::Slot<'_, Self>,
28374 decoder: &mut ___D,
28375 ) -> Result<(), ::fidl_next::DecodeError> {
28376 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
28377 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
28378 1 => ::fidl_next::RawWireUnion::decode_as::<
28379 ___D,
28380 crate::WireDebugProtocolRegistration<'static>,
28381 >(raw, decoder)?,
28382
28383 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
28384 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
28385 }
28386
28387 Ok(())
28388 }
28389}
28390
28391impl<'de> ::core::fmt::Debug for WireOptionalDebugRegistration<'de> {
28392 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
28393 self.as_ref().fmt(f)
28394 }
28395}
28396
28397#[doc = " Declares an environment which configures a realm.\n"]
28398#[derive(Clone, Debug, Default)]
28399pub struct Environment {
28400 pub name: Option<String>,
28401
28402 pub extends: Option<crate::EnvironmentExtends>,
28403
28404 pub runners: Option<Vec<crate::RunnerRegistration>>,
28405
28406 pub resolvers: Option<Vec<crate::ResolverRegistration>>,
28407
28408 pub debug_capabilities: Option<Vec<crate::DebugRegistration>>,
28409
28410 pub stop_timeout_ms: Option<u32>,
28411}
28412
28413impl Environment {
28414 fn __max_ordinal(&self) -> usize {
28415 if self.stop_timeout_ms.is_some() {
28416 return 6;
28417 }
28418
28419 if self.debug_capabilities.is_some() {
28420 return 5;
28421 }
28422
28423 if self.resolvers.is_some() {
28424 return 4;
28425 }
28426
28427 if self.runners.is_some() {
28428 return 3;
28429 }
28430
28431 if self.extends.is_some() {
28432 return 2;
28433 }
28434
28435 if self.name.is_some() {
28436 return 1;
28437 }
28438
28439 0
28440 }
28441}
28442
28443impl ::fidl_next::Encodable for Environment {
28444 type Encoded = WireEnvironment<'static>;
28445}
28446
28447unsafe impl<___E> ::fidl_next::Encode<___E> for Environment
28448where
28449 ___E: ::fidl_next::Encoder + ?Sized,
28450{
28451 #[inline]
28452 fn encode(
28453 mut self,
28454 encoder: &mut ___E,
28455 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
28456 ) -> Result<(), ::fidl_next::EncodeError> {
28457 ::fidl_next::munge!(let WireEnvironment { table } = out);
28458
28459 let max_ord = self.__max_ordinal();
28460
28461 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
28462 ::fidl_next::Wire::zero_padding(&mut out);
28463
28464 let mut preallocated =
28465 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
28466
28467 for i in 1..=max_ord {
28468 match i {
28469 6 => {
28470 if let Some(stop_timeout_ms) = self.stop_timeout_ms.take() {
28471 ::fidl_next::WireEnvelope::encode_value(
28472 stop_timeout_ms,
28473 preallocated.encoder,
28474 &mut out,
28475 )?;
28476 } else {
28477 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28478 }
28479 }
28480
28481 5 => {
28482 if let Some(debug_capabilities) = self.debug_capabilities.take() {
28483 ::fidl_next::WireEnvelope::encode_value(
28484 debug_capabilities,
28485 preallocated.encoder,
28486 &mut out,
28487 )?;
28488 } else {
28489 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28490 }
28491 }
28492
28493 4 => {
28494 if let Some(resolvers) = self.resolvers.take() {
28495 ::fidl_next::WireEnvelope::encode_value(
28496 resolvers,
28497 preallocated.encoder,
28498 &mut out,
28499 )?;
28500 } else {
28501 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28502 }
28503 }
28504
28505 3 => {
28506 if let Some(runners) = self.runners.take() {
28507 ::fidl_next::WireEnvelope::encode_value(
28508 runners,
28509 preallocated.encoder,
28510 &mut out,
28511 )?;
28512 } else {
28513 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28514 }
28515 }
28516
28517 2 => {
28518 if let Some(extends) = self.extends.take() {
28519 ::fidl_next::WireEnvelope::encode_value(
28520 extends,
28521 preallocated.encoder,
28522 &mut out,
28523 )?;
28524 } else {
28525 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28526 }
28527 }
28528
28529 1 => {
28530 if let Some(name) = self.name.take() {
28531 ::fidl_next::WireEnvelope::encode_value(
28532 name,
28533 preallocated.encoder,
28534 &mut out,
28535 )?;
28536 } else {
28537 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28538 }
28539 }
28540
28541 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
28542 }
28543 unsafe {
28544 preallocated.write_next(out.assume_init_ref());
28545 }
28546 }
28547
28548 ::fidl_next::WireTable::encode_len(table, max_ord);
28549
28550 Ok(())
28551 }
28552}
28553
28554unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Environment
28555where
28556 ___E: ::fidl_next::Encoder + ?Sized,
28557{
28558 #[inline]
28559 fn encode_ref(
28560 &self,
28561 encoder: &mut ___E,
28562 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
28563 ) -> Result<(), ::fidl_next::EncodeError> {
28564 ::fidl_next::munge!(let WireEnvironment { table } = out);
28565
28566 let max_ord = self.__max_ordinal();
28567
28568 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
28569 ::fidl_next::Wire::zero_padding(&mut out);
28570
28571 let mut preallocated =
28572 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
28573
28574 for i in 1..=max_ord {
28575 match i {
28576 6 => {
28577 if let Some(stop_timeout_ms) = &self.stop_timeout_ms {
28578 ::fidl_next::WireEnvelope::encode_value(
28579 stop_timeout_ms,
28580 preallocated.encoder,
28581 &mut out,
28582 )?;
28583 } else {
28584 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28585 }
28586 }
28587
28588 5 => {
28589 if let Some(debug_capabilities) = &self.debug_capabilities {
28590 ::fidl_next::WireEnvelope::encode_value(
28591 debug_capabilities,
28592 preallocated.encoder,
28593 &mut out,
28594 )?;
28595 } else {
28596 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28597 }
28598 }
28599
28600 4 => {
28601 if let Some(resolvers) = &self.resolvers {
28602 ::fidl_next::WireEnvelope::encode_value(
28603 resolvers,
28604 preallocated.encoder,
28605 &mut out,
28606 )?;
28607 } else {
28608 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28609 }
28610 }
28611
28612 3 => {
28613 if let Some(runners) = &self.runners {
28614 ::fidl_next::WireEnvelope::encode_value(
28615 runners,
28616 preallocated.encoder,
28617 &mut out,
28618 )?;
28619 } else {
28620 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28621 }
28622 }
28623
28624 2 => {
28625 if let Some(extends) = &self.extends {
28626 ::fidl_next::WireEnvelope::encode_value(
28627 extends,
28628 preallocated.encoder,
28629 &mut out,
28630 )?;
28631 } else {
28632 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28633 }
28634 }
28635
28636 1 => {
28637 if let Some(name) = &self.name {
28638 ::fidl_next::WireEnvelope::encode_value(
28639 name,
28640 preallocated.encoder,
28641 &mut out,
28642 )?;
28643 } else {
28644 ::fidl_next::WireEnvelope::encode_zero(&mut out)
28645 }
28646 }
28647
28648 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
28649 }
28650 unsafe {
28651 preallocated.write_next(out.assume_init_ref());
28652 }
28653 }
28654
28655 ::fidl_next::WireTable::encode_len(table, max_ord);
28656
28657 Ok(())
28658 }
28659}
28660
28661impl<'de> ::fidl_next::FromWire<WireEnvironment<'de>> for Environment {
28662 #[inline]
28663 fn from_wire(wire: WireEnvironment<'de>) -> Self {
28664 let wire = ::core::mem::ManuallyDrop::new(wire);
28665
28666 let name = wire.table.get(1);
28667
28668 let extends = wire.table.get(2);
28669
28670 let runners = wire.table.get(3);
28671
28672 let resolvers = wire.table.get(4);
28673
28674 let debug_capabilities = wire.table.get(5);
28675
28676 let stop_timeout_ms = wire.table.get(6);
28677
28678 Self {
28679
28680
28681 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
28682 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
28683 )),
28684
28685
28686 extends: extends.map(|envelope| ::fidl_next::FromWire::from_wire(
28687 unsafe { envelope.read_unchecked::<crate::WireEnvironmentExtends>() }
28688 )),
28689
28690
28691 runners: runners.map(|envelope| ::fidl_next::FromWire::from_wire(
28692 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireRunnerRegistration<'de>>>() }
28693 )),
28694
28695
28696 resolvers: resolvers.map(|envelope| ::fidl_next::FromWire::from_wire(
28697 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireResolverRegistration<'de>>>() }
28698 )),
28699
28700
28701 debug_capabilities: debug_capabilities.map(|envelope| ::fidl_next::FromWire::from_wire(
28702 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireDebugRegistration<'de>>>() }
28703 )),
28704
28705
28706 stop_timeout_ms: stop_timeout_ms.map(|envelope| ::fidl_next::FromWire::from_wire(
28707 unsafe { envelope.read_unchecked::<::fidl_next::WireU32>() }
28708 )),
28709
28710 }
28711 }
28712}
28713
28714impl<'de> ::fidl_next::FromWireRef<WireEnvironment<'de>> for Environment {
28715 #[inline]
28716 fn from_wire_ref(wire: &WireEnvironment<'de>) -> Self {
28717 Self {
28718
28719
28720 name: wire.table.get(1)
28721 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
28722 unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() }
28723 )),
28724
28725
28726 extends: wire.table.get(2)
28727 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
28728 unsafe { envelope.deref_unchecked::<crate::WireEnvironmentExtends>() }
28729 )),
28730
28731
28732 runners: wire.table.get(3)
28733 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
28734 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireRunnerRegistration<'de>>>() }
28735 )),
28736
28737
28738 resolvers: wire.table.get(4)
28739 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
28740 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireResolverRegistration<'de>>>() }
28741 )),
28742
28743
28744 debug_capabilities: wire.table.get(5)
28745 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
28746 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireDebugRegistration<'de>>>() }
28747 )),
28748
28749
28750 stop_timeout_ms: wire.table.get(6)
28751 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
28752 unsafe { envelope.deref_unchecked::<::fidl_next::WireU32>() }
28753 )),
28754
28755 }
28756 }
28757}
28758
28759#[repr(C)]
28761pub struct WireEnvironment<'de> {
28762 table: ::fidl_next::WireTable<'de>,
28763}
28764
28765impl<'de> Drop for WireEnvironment<'de> {
28766 fn drop(&mut self) {
28767 let _ = self
28768 .table
28769 .get(1)
28770 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
28771
28772 let _ = self
28773 .table
28774 .get(2)
28775 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireEnvironmentExtends>() });
28776
28777 let _ = self.table.get(3).map(|envelope| unsafe {
28778 envelope
28779 .read_unchecked::<::fidl_next::WireVector<'de, crate::WireRunnerRegistration<'de>>>(
28780 )
28781 });
28782
28783 let _ = self.table.get(4)
28784 .map(|envelope| unsafe {
28785 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireResolverRegistration<'de>>>()
28786 });
28787
28788 let _ = self.table.get(5)
28789 .map(|envelope| unsafe {
28790 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireDebugRegistration<'de>>>()
28791 });
28792
28793 let _ = self
28794 .table
28795 .get(6)
28796 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireU32>() });
28797 }
28798}
28799
28800unsafe impl ::fidl_next::Wire for WireEnvironment<'static> {
28801 type Decoded<'de> = WireEnvironment<'de>;
28802
28803 #[inline]
28804 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
28805 ::fidl_next::munge!(let Self { table } = out);
28806 ::fidl_next::WireTable::zero_padding(table);
28807 }
28808}
28809
28810unsafe impl<___D> ::fidl_next::Decode<___D> for WireEnvironment<'static>
28811where
28812 ___D: ::fidl_next::Decoder + ?Sized,
28813{
28814 fn decode(
28815 slot: ::fidl_next::Slot<'_, Self>,
28816 decoder: &mut ___D,
28817 ) -> Result<(), ::fidl_next::DecodeError> {
28818 ::fidl_next::munge!(let Self { table } = slot);
28819
28820 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
28821 match ordinal {
28822 0 => unsafe { ::core::hint::unreachable_unchecked() },
28823
28824 1 => {
28825 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
28826 slot.as_mut(),
28827 decoder,
28828 )?;
28829
28830 let name = unsafe {
28831 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
28832 };
28833
28834 if name.len() > 100 {
28835 return Err(::fidl_next::DecodeError::VectorTooLong {
28836 size: name.len() as u64,
28837 limit: 100,
28838 });
28839 }
28840
28841 Ok(())
28842 }
28843
28844 2 => {
28845 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireEnvironmentExtends>(
28846 slot.as_mut(),
28847 decoder,
28848 )?;
28849
28850 Ok(())
28851 }
28852
28853 3 => {
28854 ::fidl_next::WireEnvelope::decode_as::<
28855 ___D,
28856 ::fidl_next::WireVector<'static, crate::WireRunnerRegistration<'static>>,
28857 >(slot.as_mut(), decoder)?;
28858
28859 Ok(())
28860 }
28861
28862 4 => {
28863 ::fidl_next::WireEnvelope::decode_as::<
28864 ___D,
28865 ::fidl_next::WireVector<'static, crate::WireResolverRegistration<'static>>,
28866 >(slot.as_mut(), decoder)?;
28867
28868 Ok(())
28869 }
28870
28871 5 => {
28872 ::fidl_next::WireEnvelope::decode_as::<
28873 ___D,
28874 ::fidl_next::WireVector<'static, crate::WireDebugRegistration<'static>>,
28875 >(slot.as_mut(), decoder)?;
28876
28877 Ok(())
28878 }
28879
28880 6 => {
28881 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireU32>(
28882 slot.as_mut(),
28883 decoder,
28884 )?;
28885
28886 Ok(())
28887 }
28888
28889 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
28890 }
28891 })
28892 }
28893}
28894
28895impl<'de> WireEnvironment<'de> {
28896 pub fn name(&self) -> Option<&::fidl_next::WireString<'de>> {
28897 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
28898 }
28899
28900 pub fn extends(&self) -> Option<&crate::WireEnvironmentExtends> {
28901 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
28902 }
28903
28904 pub fn runners(
28905 &self,
28906 ) -> Option<&::fidl_next::WireVector<'de, crate::WireRunnerRegistration<'de>>> {
28907 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
28908 }
28909
28910 pub fn resolvers(
28911 &self,
28912 ) -> Option<&::fidl_next::WireVector<'de, crate::WireResolverRegistration<'de>>> {
28913 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
28914 }
28915
28916 pub fn debug_capabilities(
28917 &self,
28918 ) -> Option<&::fidl_next::WireVector<'de, crate::WireDebugRegistration<'de>>> {
28919 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
28920 }
28921
28922 pub fn stop_timeout_ms(&self) -> Option<&::fidl_next::WireU32> {
28923 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
28924 }
28925}
28926
28927impl<'de> ::core::fmt::Debug for WireEnvironment<'de> {
28928 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
28929 f.debug_struct("Environment")
28930 .field("name", &self.name())
28931 .field("extends", &self.extends())
28932 .field("runners", &self.runners())
28933 .field("resolvers", &self.resolvers())
28934 .field("debug_capabilities", &self.debug_capabilities())
28935 .field("stop_timeout_ms", &self.stop_timeout_ms())
28936 .finish()
28937 }
28938}
28939
28940#[derive(Clone, Debug, Default)]
28941pub struct ConfigSourceCapabilities {}
28942
28943impl ConfigSourceCapabilities {
28944 fn __max_ordinal(&self) -> usize {
28945 0
28946 }
28947}
28948
28949impl ::fidl_next::Encodable for ConfigSourceCapabilities {
28950 type Encoded = WireConfigSourceCapabilities<'static>;
28951}
28952
28953unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigSourceCapabilities
28954where
28955 ___E: ::fidl_next::Encoder + ?Sized,
28956{
28957 #[inline]
28958 fn encode(
28959 mut self,
28960 encoder: &mut ___E,
28961 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
28962 ) -> Result<(), ::fidl_next::EncodeError> {
28963 ::fidl_next::munge!(let WireConfigSourceCapabilities { table } = out);
28964
28965 let max_ord = self.__max_ordinal();
28966
28967 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
28968 ::fidl_next::Wire::zero_padding(&mut out);
28969
28970 let mut preallocated =
28971 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
28972
28973 for i in 1..=max_ord {
28974 match i {
28975 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
28976 }
28977 unsafe {
28978 preallocated.write_next(out.assume_init_ref());
28979 }
28980 }
28981
28982 ::fidl_next::WireTable::encode_len(table, max_ord);
28983
28984 Ok(())
28985 }
28986}
28987
28988unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigSourceCapabilities
28989where
28990 ___E: ::fidl_next::Encoder + ?Sized,
28991{
28992 #[inline]
28993 fn encode_ref(
28994 &self,
28995 encoder: &mut ___E,
28996 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
28997 ) -> Result<(), ::fidl_next::EncodeError> {
28998 ::fidl_next::munge!(let WireConfigSourceCapabilities { table } = out);
28999
29000 let max_ord = self.__max_ordinal();
29001
29002 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
29003 ::fidl_next::Wire::zero_padding(&mut out);
29004
29005 let mut preallocated =
29006 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
29007
29008 for i in 1..=max_ord {
29009 match i {
29010 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
29011 }
29012 unsafe {
29013 preallocated.write_next(out.assume_init_ref());
29014 }
29015 }
29016
29017 ::fidl_next::WireTable::encode_len(table, max_ord);
29018
29019 Ok(())
29020 }
29021}
29022
29023impl<'de> ::fidl_next::FromWire<WireConfigSourceCapabilities<'de>> for ConfigSourceCapabilities {
29024 #[inline]
29025 fn from_wire(wire: WireConfigSourceCapabilities<'de>) -> Self {
29026 let wire = ::core::mem::ManuallyDrop::new(wire);
29027
29028 Self {}
29029 }
29030}
29031
29032impl<'de> ::fidl_next::FromWireRef<WireConfigSourceCapabilities<'de>> for ConfigSourceCapabilities {
29033 #[inline]
29034 fn from_wire_ref(wire: &WireConfigSourceCapabilities<'de>) -> Self {
29035 Self {}
29036 }
29037}
29038
29039#[repr(C)]
29041pub struct WireConfigSourceCapabilities<'de> {
29042 table: ::fidl_next::WireTable<'de>,
29043}
29044
29045impl<'de> Drop for WireConfigSourceCapabilities<'de> {
29046 fn drop(&mut self) {}
29047}
29048
29049unsafe impl ::fidl_next::Wire for WireConfigSourceCapabilities<'static> {
29050 type Decoded<'de> = WireConfigSourceCapabilities<'de>;
29051
29052 #[inline]
29053 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
29054 ::fidl_next::munge!(let Self { table } = out);
29055 ::fidl_next::WireTable::zero_padding(table);
29056 }
29057}
29058
29059unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigSourceCapabilities<'static>
29060where
29061 ___D: ::fidl_next::Decoder + ?Sized,
29062{
29063 fn decode(
29064 slot: ::fidl_next::Slot<'_, Self>,
29065 decoder: &mut ___D,
29066 ) -> Result<(), ::fidl_next::DecodeError> {
29067 ::fidl_next::munge!(let Self { table } = slot);
29068
29069 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
29070 match ordinal {
29071 0 => unsafe { ::core::hint::unreachable_unchecked() },
29072
29073 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
29074 }
29075 })
29076 }
29077}
29078
29079impl<'de> WireConfigSourceCapabilities<'de> {}
29080
29081impl<'de> ::core::fmt::Debug for WireConfigSourceCapabilities<'de> {
29082 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
29083 f.debug_struct("ConfigSourceCapabilities").finish()
29084 }
29085}
29086
29087#[doc = " Strategies available for resolving configuration values.\n"]
29088#[derive(Clone, Debug)]
29089pub enum ConfigValueSource {
29090 PackagePath(String),
29091
29092 Capabilities(crate::ConfigSourceCapabilities),
29093
29094 UnknownOrdinal_(u64),
29095}
29096
29097impl ::fidl_next::Encodable for ConfigValueSource {
29098 type Encoded = WireConfigValueSource<'static>;
29099}
29100
29101unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigValueSource
29102where
29103 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
29104
29105 ___E: ::fidl_next::Encoder,
29106{
29107 #[inline]
29108 fn encode(
29109 self,
29110 encoder: &mut ___E,
29111 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
29112 ) -> Result<(), ::fidl_next::EncodeError> {
29113 ::fidl_next::munge!(let WireConfigValueSource { raw, _phantom: _ } = out);
29114
29115 match self {
29116 Self::PackagePath(value) => {
29117 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 1, encoder, raw)?
29118 }
29119
29120 Self::Capabilities(value) => ::fidl_next::RawWireUnion::encode_as::<
29121 ___E,
29122 crate::ConfigSourceCapabilities,
29123 >(value, 2, encoder, raw)?,
29124
29125 Self::UnknownOrdinal_(ordinal) => {
29126 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
29127 }
29128 }
29129
29130 Ok(())
29131 }
29132}
29133
29134unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigValueSource
29135where
29136 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
29137
29138 ___E: ::fidl_next::Encoder,
29139{
29140 #[inline]
29141 fn encode_ref(
29142 &self,
29143 encoder: &mut ___E,
29144 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
29145 ) -> Result<(), ::fidl_next::EncodeError> {
29146 ::fidl_next::munge!(let WireConfigValueSource { raw, _phantom: _ } = out);
29147
29148 match self {
29149 Self::PackagePath(value) => {
29150 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 1, encoder, raw)?
29151 }
29152
29153 Self::Capabilities(value) => ::fidl_next::RawWireUnion::encode_as::<
29154 ___E,
29155 &crate::ConfigSourceCapabilities,
29156 >(value, 2, encoder, raw)?,
29157
29158 Self::UnknownOrdinal_(ordinal) => {
29159 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
29160 }
29161 }
29162
29163 Ok(())
29164 }
29165}
29166
29167impl ::fidl_next::EncodableOption for ConfigValueSource {
29168 type EncodedOption = WireOptionalConfigValueSource<'static>;
29169}
29170
29171unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ConfigValueSource
29172where
29173 ___E: ?Sized,
29174 ConfigValueSource: ::fidl_next::Encode<___E>,
29175{
29176 #[inline]
29177 fn encode_option(
29178 this: Option<Self>,
29179 encoder: &mut ___E,
29180 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
29181 ) -> Result<(), ::fidl_next::EncodeError> {
29182 ::fidl_next::munge!(let WireOptionalConfigValueSource { raw, _phantom: _ } = &mut *out);
29183
29184 if let Some(inner) = this {
29185 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
29186 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
29187 } else {
29188 ::fidl_next::RawWireUnion::encode_absent(raw);
29189 }
29190
29191 Ok(())
29192 }
29193}
29194
29195unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ConfigValueSource
29196where
29197 ___E: ?Sized,
29198 ConfigValueSource: ::fidl_next::EncodeRef<___E>,
29199{
29200 #[inline]
29201 fn encode_option_ref(
29202 this: Option<&Self>,
29203 encoder: &mut ___E,
29204 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
29205 ) -> Result<(), ::fidl_next::EncodeError> {
29206 ::fidl_next::munge!(let WireOptionalConfigValueSource { raw, _phantom: _ } = &mut *out);
29207
29208 if let Some(inner) = this {
29209 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
29210 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
29211 } else {
29212 ::fidl_next::RawWireUnion::encode_absent(raw);
29213 }
29214
29215 Ok(())
29216 }
29217}
29218
29219impl<'de> ::fidl_next::FromWire<WireConfigValueSource<'de>> for ConfigValueSource {
29220 #[inline]
29221 fn from_wire(wire: WireConfigValueSource<'de>) -> Self {
29222 let wire = ::core::mem::ManuallyDrop::new(wire);
29223 match wire.raw.ordinal() {
29224 1 => Self::PackagePath(::fidl_next::FromWire::from_wire(unsafe {
29225 wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
29226 })),
29227
29228 2 => Self::Capabilities(::fidl_next::FromWire::from_wire(unsafe {
29229 wire.raw.get().read_unchecked::<crate::WireConfigSourceCapabilities<'de>>()
29230 })),
29231
29232 _ => unsafe { ::core::hint::unreachable_unchecked() },
29233 }
29234 }
29235}
29236
29237impl<'de> ::fidl_next::FromWireRef<WireConfigValueSource<'de>> for ConfigValueSource {
29238 #[inline]
29239 fn from_wire_ref(wire: &WireConfigValueSource<'de>) -> Self {
29240 match wire.raw.ordinal() {
29241 1 => Self::PackagePath(::fidl_next::FromWireRef::from_wire_ref(unsafe {
29242 wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
29243 })),
29244
29245 2 => Self::Capabilities(::fidl_next::FromWireRef::from_wire_ref(unsafe {
29246 wire.raw.get().deref_unchecked::<crate::WireConfigSourceCapabilities<'de>>()
29247 })),
29248
29249 _ => unsafe { ::core::hint::unreachable_unchecked() },
29250 }
29251 }
29252}
29253
29254impl<'de> ::fidl_next::FromWireOption<WireOptionalConfigValueSource<'de>>
29255 for Box<ConfigValueSource>
29256{
29257 #[inline]
29258 fn from_wire_option(wire: WireOptionalConfigValueSource<'de>) -> Option<Self> {
29259 if let Some(inner) = wire.into_option() {
29260 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
29261 } else {
29262 None
29263 }
29264 }
29265}
29266
29267impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalConfigValueSource<'de>>
29268 for Box<ConfigValueSource>
29269{
29270 #[inline]
29271 fn from_wire_option_ref(wire: &WireOptionalConfigValueSource<'de>) -> Option<Self> {
29272 if let Some(inner) = wire.as_ref() {
29273 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
29274 } else {
29275 None
29276 }
29277 }
29278}
29279
29280#[repr(transparent)]
29282pub struct WireConfigValueSource<'de> {
29283 raw: ::fidl_next::RawWireUnion,
29284 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
29285}
29286
29287impl<'de> Drop for WireConfigValueSource<'de> {
29288 fn drop(&mut self) {
29289 match self.raw.ordinal() {
29290 1 => {
29291 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
29292 }
29293
29294 2 => {
29295 let _ = unsafe {
29296 self.raw.get().read_unchecked::<crate::WireConfigSourceCapabilities<'de>>()
29297 };
29298 }
29299
29300 _ => (),
29301 }
29302 }
29303}
29304
29305unsafe impl ::fidl_next::Wire for WireConfigValueSource<'static> {
29306 type Decoded<'de> = WireConfigValueSource<'de>;
29307
29308 #[inline]
29309 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
29310 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
29311 ::fidl_next::RawWireUnion::zero_padding(raw);
29312 }
29313}
29314
29315pub mod config_value_source {
29316 pub enum Ref<'de> {
29317 PackagePath(&'de ::fidl_next::WireString<'de>),
29318
29319 Capabilities(&'de crate::WireConfigSourceCapabilities<'de>),
29320
29321 UnknownOrdinal_(u64),
29322 }
29323}
29324
29325impl<'de> WireConfigValueSource<'de> {
29326 pub fn as_ref(&self) -> crate::config_value_source::Ref<'_> {
29327 match self.raw.ordinal() {
29328 1 => crate::config_value_source::Ref::PackagePath(unsafe {
29329 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
29330 }),
29331
29332 2 => crate::config_value_source::Ref::Capabilities(unsafe {
29333 self.raw.get().deref_unchecked::<crate::WireConfigSourceCapabilities<'_>>()
29334 }),
29335
29336 unknown => crate::config_value_source::Ref::UnknownOrdinal_(unknown),
29337 }
29338 }
29339}
29340
29341unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigValueSource<'static>
29342where
29343 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
29344
29345 ___D: ::fidl_next::Decoder,
29346{
29347 fn decode(
29348 mut slot: ::fidl_next::Slot<'_, Self>,
29349 decoder: &mut ___D,
29350 ) -> Result<(), ::fidl_next::DecodeError> {
29351 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
29352 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
29353 1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
29354 raw, decoder,
29355 )?,
29356
29357 2 => ::fidl_next::RawWireUnion::decode_as::<
29358 ___D,
29359 crate::WireConfigSourceCapabilities<'static>,
29360 >(raw, decoder)?,
29361
29362 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
29363 }
29364
29365 Ok(())
29366 }
29367}
29368
29369impl<'de> ::core::fmt::Debug for WireConfigValueSource<'de> {
29370 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
29371 match self.raw.ordinal() {
29372 1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) },
29373 2 => unsafe {
29374 self.raw.get().deref_unchecked::<crate::WireConfigSourceCapabilities<'_>>().fmt(f)
29375 },
29376 _ => unsafe { ::core::hint::unreachable_unchecked() },
29377 }
29378 }
29379}
29380
29381#[repr(transparent)]
29382pub struct WireOptionalConfigValueSource<'de> {
29383 raw: ::fidl_next::RawWireUnion,
29384 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
29385}
29386
29387unsafe impl ::fidl_next::Wire for WireOptionalConfigValueSource<'static> {
29388 type Decoded<'de> = WireOptionalConfigValueSource<'de>;
29389
29390 #[inline]
29391 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
29392 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
29393 ::fidl_next::RawWireUnion::zero_padding(raw);
29394 }
29395}
29396
29397impl<'de> WireOptionalConfigValueSource<'de> {
29398 pub fn is_some(&self) -> bool {
29399 self.raw.is_some()
29400 }
29401
29402 pub fn is_none(&self) -> bool {
29403 self.raw.is_none()
29404 }
29405
29406 pub fn as_ref(&self) -> Option<&WireConfigValueSource<'de>> {
29407 if self.is_some() {
29408 Some(unsafe { &*(self as *const Self).cast() })
29409 } else {
29410 None
29411 }
29412 }
29413
29414 pub fn into_option(self) -> Option<WireConfigValueSource<'de>> {
29415 if self.is_some() {
29416 Some(WireConfigValueSource { raw: self.raw, _phantom: ::core::marker::PhantomData })
29417 } else {
29418 None
29419 }
29420 }
29421}
29422
29423unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigValueSource<'static>
29424where
29425 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
29426
29427 ___D: ::fidl_next::Decoder,
29428{
29429 fn decode(
29430 mut slot: ::fidl_next::Slot<'_, Self>,
29431 decoder: &mut ___D,
29432 ) -> Result<(), ::fidl_next::DecodeError> {
29433 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
29434 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
29435 1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
29436 raw, decoder,
29437 )?,
29438
29439 2 => ::fidl_next::RawWireUnion::decode_as::<
29440 ___D,
29441 crate::WireConfigSourceCapabilities<'static>,
29442 >(raw, decoder)?,
29443
29444 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
29445 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
29446 }
29447
29448 Ok(())
29449 }
29450}
29451
29452impl<'de> ::core::fmt::Debug for WireOptionalConfigValueSource<'de> {
29453 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
29454 self.as_ref().fmt(f)
29455 }
29456}
29457
29458#[doc = " The schema of a component\'s configuration interface.\n"]
29459#[derive(Clone, Debug, Default)]
29460pub struct ConfigSchema {
29461 pub fields: Option<Vec<crate::ConfigField>>,
29462
29463 pub checksum: Option<crate::ConfigChecksum>,
29464
29465 pub value_source: Option<crate::ConfigValueSource>,
29466}
29467
29468impl ConfigSchema {
29469 fn __max_ordinal(&self) -> usize {
29470 if self.value_source.is_some() {
29471 return 3;
29472 }
29473
29474 if self.checksum.is_some() {
29475 return 2;
29476 }
29477
29478 if self.fields.is_some() {
29479 return 1;
29480 }
29481
29482 0
29483 }
29484}
29485
29486impl ::fidl_next::Encodable for ConfigSchema {
29487 type Encoded = WireConfigSchema<'static>;
29488}
29489
29490unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigSchema
29491where
29492 ___E: ::fidl_next::Encoder + ?Sized,
29493{
29494 #[inline]
29495 fn encode(
29496 mut self,
29497 encoder: &mut ___E,
29498 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
29499 ) -> Result<(), ::fidl_next::EncodeError> {
29500 ::fidl_next::munge!(let WireConfigSchema { table } = out);
29501
29502 let max_ord = self.__max_ordinal();
29503
29504 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
29505 ::fidl_next::Wire::zero_padding(&mut out);
29506
29507 let mut preallocated =
29508 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
29509
29510 for i in 1..=max_ord {
29511 match i {
29512 3 => {
29513 if let Some(value_source) = self.value_source.take() {
29514 ::fidl_next::WireEnvelope::encode_value(
29515 value_source,
29516 preallocated.encoder,
29517 &mut out,
29518 )?;
29519 } else {
29520 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29521 }
29522 }
29523
29524 2 => {
29525 if let Some(checksum) = self.checksum.take() {
29526 ::fidl_next::WireEnvelope::encode_value(
29527 checksum,
29528 preallocated.encoder,
29529 &mut out,
29530 )?;
29531 } else {
29532 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29533 }
29534 }
29535
29536 1 => {
29537 if let Some(fields) = self.fields.take() {
29538 ::fidl_next::WireEnvelope::encode_value(
29539 fields,
29540 preallocated.encoder,
29541 &mut out,
29542 )?;
29543 } else {
29544 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29545 }
29546 }
29547
29548 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
29549 }
29550 unsafe {
29551 preallocated.write_next(out.assume_init_ref());
29552 }
29553 }
29554
29555 ::fidl_next::WireTable::encode_len(table, max_ord);
29556
29557 Ok(())
29558 }
29559}
29560
29561unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigSchema
29562where
29563 ___E: ::fidl_next::Encoder + ?Sized,
29564{
29565 #[inline]
29566 fn encode_ref(
29567 &self,
29568 encoder: &mut ___E,
29569 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
29570 ) -> Result<(), ::fidl_next::EncodeError> {
29571 ::fidl_next::munge!(let WireConfigSchema { table } = out);
29572
29573 let max_ord = self.__max_ordinal();
29574
29575 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
29576 ::fidl_next::Wire::zero_padding(&mut out);
29577
29578 let mut preallocated =
29579 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
29580
29581 for i in 1..=max_ord {
29582 match i {
29583 3 => {
29584 if let Some(value_source) = &self.value_source {
29585 ::fidl_next::WireEnvelope::encode_value(
29586 value_source,
29587 preallocated.encoder,
29588 &mut out,
29589 )?;
29590 } else {
29591 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29592 }
29593 }
29594
29595 2 => {
29596 if let Some(checksum) = &self.checksum {
29597 ::fidl_next::WireEnvelope::encode_value(
29598 checksum,
29599 preallocated.encoder,
29600 &mut out,
29601 )?;
29602 } else {
29603 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29604 }
29605 }
29606
29607 1 => {
29608 if let Some(fields) = &self.fields {
29609 ::fidl_next::WireEnvelope::encode_value(
29610 fields,
29611 preallocated.encoder,
29612 &mut out,
29613 )?;
29614 } else {
29615 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29616 }
29617 }
29618
29619 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
29620 }
29621 unsafe {
29622 preallocated.write_next(out.assume_init_ref());
29623 }
29624 }
29625
29626 ::fidl_next::WireTable::encode_len(table, max_ord);
29627
29628 Ok(())
29629 }
29630}
29631
29632impl<'de> ::fidl_next::FromWire<WireConfigSchema<'de>> for ConfigSchema {
29633 #[inline]
29634 fn from_wire(wire: WireConfigSchema<'de>) -> Self {
29635 let wire = ::core::mem::ManuallyDrop::new(wire);
29636
29637 let fields = wire.table.get(1);
29638
29639 let checksum = wire.table.get(2);
29640
29641 let value_source = wire.table.get(3);
29642
29643 Self {
29644
29645
29646 fields: fields.map(|envelope| ::fidl_next::FromWire::from_wire(
29647 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigField<'de>>>() }
29648 )),
29649
29650
29651 checksum: checksum.map(|envelope| ::fidl_next::FromWire::from_wire(
29652 unsafe { envelope.read_unchecked::<crate::WireConfigChecksum<'de>>() }
29653 )),
29654
29655
29656 value_source: value_source.map(|envelope| ::fidl_next::FromWire::from_wire(
29657 unsafe { envelope.read_unchecked::<crate::WireConfigValueSource<'de>>() }
29658 )),
29659
29660 }
29661 }
29662}
29663
29664impl<'de> ::fidl_next::FromWireRef<WireConfigSchema<'de>> for ConfigSchema {
29665 #[inline]
29666 fn from_wire_ref(wire: &WireConfigSchema<'de>) -> Self {
29667 Self {
29668
29669
29670 fields: wire.table.get(1)
29671 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
29672 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigField<'de>>>() }
29673 )),
29674
29675
29676 checksum: wire.table.get(2)
29677 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
29678 unsafe { envelope.deref_unchecked::<crate::WireConfigChecksum<'de>>() }
29679 )),
29680
29681
29682 value_source: wire.table.get(3)
29683 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
29684 unsafe { envelope.deref_unchecked::<crate::WireConfigValueSource<'de>>() }
29685 )),
29686
29687 }
29688 }
29689}
29690
29691#[repr(C)]
29693pub struct WireConfigSchema<'de> {
29694 table: ::fidl_next::WireTable<'de>,
29695}
29696
29697impl<'de> Drop for WireConfigSchema<'de> {
29698 fn drop(&mut self) {
29699 let _ = self.table.get(1).map(|envelope| unsafe {
29700 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigField<'de>>>()
29701 });
29702
29703 let _ = self
29704 .table
29705 .get(2)
29706 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigChecksum<'de>>() });
29707
29708 let _ = self.table.get(3).map(|envelope| unsafe {
29709 envelope.read_unchecked::<crate::WireConfigValueSource<'de>>()
29710 });
29711 }
29712}
29713
29714unsafe impl ::fidl_next::Wire for WireConfigSchema<'static> {
29715 type Decoded<'de> = WireConfigSchema<'de>;
29716
29717 #[inline]
29718 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
29719 ::fidl_next::munge!(let Self { table } = out);
29720 ::fidl_next::WireTable::zero_padding(table);
29721 }
29722}
29723
29724unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigSchema<'static>
29725where
29726 ___D: ::fidl_next::Decoder + ?Sized,
29727{
29728 fn decode(
29729 slot: ::fidl_next::Slot<'_, Self>,
29730 decoder: &mut ___D,
29731 ) -> Result<(), ::fidl_next::DecodeError> {
29732 ::fidl_next::munge!(let Self { table } = slot);
29733
29734 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
29735 match ordinal {
29736 0 => unsafe { ::core::hint::unreachable_unchecked() },
29737
29738 1 => {
29739 ::fidl_next::WireEnvelope::decode_as::<
29740 ___D,
29741 ::fidl_next::WireVector<'static, crate::WireConfigField<'static>>,
29742 >(slot.as_mut(), decoder)?;
29743
29744 Ok(())
29745 }
29746
29747 2 => {
29748 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigChecksum<'static>>(
29749 slot.as_mut(),
29750 decoder,
29751 )?;
29752
29753 Ok(())
29754 }
29755
29756 3 => {
29757 ::fidl_next::WireEnvelope::decode_as::<
29758 ___D,
29759 crate::WireConfigValueSource<'static>,
29760 >(slot.as_mut(), decoder)?;
29761
29762 Ok(())
29763 }
29764
29765 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
29766 }
29767 })
29768 }
29769}
29770
29771impl<'de> WireConfigSchema<'de> {
29772 pub fn fields(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireConfigField<'de>>> {
29773 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
29774 }
29775
29776 pub fn checksum(&self) -> Option<&crate::WireConfigChecksum<'de>> {
29777 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
29778 }
29779
29780 pub fn value_source(&self) -> Option<&crate::WireConfigValueSource<'de>> {
29781 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
29782 }
29783}
29784
29785impl<'de> ::core::fmt::Debug for WireConfigSchema<'de> {
29786 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
29787 f.debug_struct("ConfigSchema")
29788 .field("fields", &self.fields())
29789 .field("checksum", &self.checksum())
29790 .field("value_source", &self.value_source())
29791 .finish()
29792 }
29793}
29794
29795#[doc = " A component declaration.\n\n This information is typically encoded in the component manifest (.cm file)\n if it has one or may be generated at runtime by a component resolver for\n those that don\'t.\n"]
29796#[derive(Clone, Debug, Default)]
29797pub struct Component {
29798 pub program: Option<crate::Program>,
29799
29800 pub uses: Option<Vec<crate::Use>>,
29801
29802 pub exposes: Option<Vec<crate::Expose>>,
29803
29804 pub offers: Option<Vec<crate::Offer>>,
29805
29806 pub capabilities: Option<Vec<crate::Capability>>,
29807
29808 pub children: Option<Vec<crate::Child>>,
29809
29810 pub collections: Option<Vec<crate::Collection>>,
29811
29812 pub environments: Option<Vec<crate::Environment>>,
29813
29814 pub facets: Option<::fidl_next_fuchsia_data::Dictionary>,
29815
29816 pub config: Option<crate::ConfigSchema>,
29817}
29818
29819impl Component {
29820 fn __max_ordinal(&self) -> usize {
29821 if self.config.is_some() {
29822 return 10;
29823 }
29824
29825 if self.facets.is_some() {
29826 return 9;
29827 }
29828
29829 if self.environments.is_some() {
29830 return 8;
29831 }
29832
29833 if self.collections.is_some() {
29834 return 7;
29835 }
29836
29837 if self.children.is_some() {
29838 return 6;
29839 }
29840
29841 if self.capabilities.is_some() {
29842 return 5;
29843 }
29844
29845 if self.offers.is_some() {
29846 return 4;
29847 }
29848
29849 if self.exposes.is_some() {
29850 return 3;
29851 }
29852
29853 if self.uses.is_some() {
29854 return 2;
29855 }
29856
29857 if self.program.is_some() {
29858 return 1;
29859 }
29860
29861 0
29862 }
29863}
29864
29865impl ::fidl_next::Encodable for Component {
29866 type Encoded = WireComponent<'static>;
29867}
29868
29869unsafe impl<___E> ::fidl_next::Encode<___E> for Component
29870where
29871 ___E: ::fidl_next::Encoder + ?Sized,
29872{
29873 #[inline]
29874 fn encode(
29875 mut self,
29876 encoder: &mut ___E,
29877 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
29878 ) -> Result<(), ::fidl_next::EncodeError> {
29879 ::fidl_next::munge!(let WireComponent { table } = out);
29880
29881 let max_ord = self.__max_ordinal();
29882
29883 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
29884 ::fidl_next::Wire::zero_padding(&mut out);
29885
29886 let mut preallocated =
29887 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
29888
29889 for i in 1..=max_ord {
29890 match i {
29891 10 => {
29892 if let Some(config) = self.config.take() {
29893 ::fidl_next::WireEnvelope::encode_value(
29894 config,
29895 preallocated.encoder,
29896 &mut out,
29897 )?;
29898 } else {
29899 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29900 }
29901 }
29902
29903 9 => {
29904 if let Some(facets) = self.facets.take() {
29905 ::fidl_next::WireEnvelope::encode_value(
29906 facets,
29907 preallocated.encoder,
29908 &mut out,
29909 )?;
29910 } else {
29911 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29912 }
29913 }
29914
29915 8 => {
29916 if let Some(environments) = self.environments.take() {
29917 ::fidl_next::WireEnvelope::encode_value(
29918 environments,
29919 preallocated.encoder,
29920 &mut out,
29921 )?;
29922 } else {
29923 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29924 }
29925 }
29926
29927 7 => {
29928 if let Some(collections) = self.collections.take() {
29929 ::fidl_next::WireEnvelope::encode_value(
29930 collections,
29931 preallocated.encoder,
29932 &mut out,
29933 )?;
29934 } else {
29935 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29936 }
29937 }
29938
29939 6 => {
29940 if let Some(children) = self.children.take() {
29941 ::fidl_next::WireEnvelope::encode_value(
29942 children,
29943 preallocated.encoder,
29944 &mut out,
29945 )?;
29946 } else {
29947 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29948 }
29949 }
29950
29951 5 => {
29952 if let Some(capabilities) = self.capabilities.take() {
29953 ::fidl_next::WireEnvelope::encode_value(
29954 capabilities,
29955 preallocated.encoder,
29956 &mut out,
29957 )?;
29958 } else {
29959 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29960 }
29961 }
29962
29963 4 => {
29964 if let Some(offers) = self.offers.take() {
29965 ::fidl_next::WireEnvelope::encode_value(
29966 offers,
29967 preallocated.encoder,
29968 &mut out,
29969 )?;
29970 } else {
29971 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29972 }
29973 }
29974
29975 3 => {
29976 if let Some(exposes) = self.exposes.take() {
29977 ::fidl_next::WireEnvelope::encode_value(
29978 exposes,
29979 preallocated.encoder,
29980 &mut out,
29981 )?;
29982 } else {
29983 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29984 }
29985 }
29986
29987 2 => {
29988 if let Some(uses) = self.uses.take() {
29989 ::fidl_next::WireEnvelope::encode_value(
29990 uses,
29991 preallocated.encoder,
29992 &mut out,
29993 )?;
29994 } else {
29995 ::fidl_next::WireEnvelope::encode_zero(&mut out)
29996 }
29997 }
29998
29999 1 => {
30000 if let Some(program) = self.program.take() {
30001 ::fidl_next::WireEnvelope::encode_value(
30002 program,
30003 preallocated.encoder,
30004 &mut out,
30005 )?;
30006 } else {
30007 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30008 }
30009 }
30010
30011 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
30012 }
30013 unsafe {
30014 preallocated.write_next(out.assume_init_ref());
30015 }
30016 }
30017
30018 ::fidl_next::WireTable::encode_len(table, max_ord);
30019
30020 Ok(())
30021 }
30022}
30023
30024unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Component
30025where
30026 ___E: ::fidl_next::Encoder + ?Sized,
30027{
30028 #[inline]
30029 fn encode_ref(
30030 &self,
30031 encoder: &mut ___E,
30032 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
30033 ) -> Result<(), ::fidl_next::EncodeError> {
30034 ::fidl_next::munge!(let WireComponent { table } = out);
30035
30036 let max_ord = self.__max_ordinal();
30037
30038 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
30039 ::fidl_next::Wire::zero_padding(&mut out);
30040
30041 let mut preallocated =
30042 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
30043
30044 for i in 1..=max_ord {
30045 match i {
30046 10 => {
30047 if let Some(config) = &self.config {
30048 ::fidl_next::WireEnvelope::encode_value(
30049 config,
30050 preallocated.encoder,
30051 &mut out,
30052 )?;
30053 } else {
30054 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30055 }
30056 }
30057
30058 9 => {
30059 if let Some(facets) = &self.facets {
30060 ::fidl_next::WireEnvelope::encode_value(
30061 facets,
30062 preallocated.encoder,
30063 &mut out,
30064 )?;
30065 } else {
30066 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30067 }
30068 }
30069
30070 8 => {
30071 if let Some(environments) = &self.environments {
30072 ::fidl_next::WireEnvelope::encode_value(
30073 environments,
30074 preallocated.encoder,
30075 &mut out,
30076 )?;
30077 } else {
30078 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30079 }
30080 }
30081
30082 7 => {
30083 if let Some(collections) = &self.collections {
30084 ::fidl_next::WireEnvelope::encode_value(
30085 collections,
30086 preallocated.encoder,
30087 &mut out,
30088 )?;
30089 } else {
30090 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30091 }
30092 }
30093
30094 6 => {
30095 if let Some(children) = &self.children {
30096 ::fidl_next::WireEnvelope::encode_value(
30097 children,
30098 preallocated.encoder,
30099 &mut out,
30100 )?;
30101 } else {
30102 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30103 }
30104 }
30105
30106 5 => {
30107 if let Some(capabilities) = &self.capabilities {
30108 ::fidl_next::WireEnvelope::encode_value(
30109 capabilities,
30110 preallocated.encoder,
30111 &mut out,
30112 )?;
30113 } else {
30114 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30115 }
30116 }
30117
30118 4 => {
30119 if let Some(offers) = &self.offers {
30120 ::fidl_next::WireEnvelope::encode_value(
30121 offers,
30122 preallocated.encoder,
30123 &mut out,
30124 )?;
30125 } else {
30126 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30127 }
30128 }
30129
30130 3 => {
30131 if let Some(exposes) = &self.exposes {
30132 ::fidl_next::WireEnvelope::encode_value(
30133 exposes,
30134 preallocated.encoder,
30135 &mut out,
30136 )?;
30137 } else {
30138 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30139 }
30140 }
30141
30142 2 => {
30143 if let Some(uses) = &self.uses {
30144 ::fidl_next::WireEnvelope::encode_value(
30145 uses,
30146 preallocated.encoder,
30147 &mut out,
30148 )?;
30149 } else {
30150 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30151 }
30152 }
30153
30154 1 => {
30155 if let Some(program) = &self.program {
30156 ::fidl_next::WireEnvelope::encode_value(
30157 program,
30158 preallocated.encoder,
30159 &mut out,
30160 )?;
30161 } else {
30162 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30163 }
30164 }
30165
30166 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
30167 }
30168 unsafe {
30169 preallocated.write_next(out.assume_init_ref());
30170 }
30171 }
30172
30173 ::fidl_next::WireTable::encode_len(table, max_ord);
30174
30175 Ok(())
30176 }
30177}
30178
30179impl<'de> ::fidl_next::FromWire<WireComponent<'de>> for Component {
30180 #[inline]
30181 fn from_wire(wire: WireComponent<'de>) -> Self {
30182 let wire = ::core::mem::ManuallyDrop::new(wire);
30183
30184 let program = wire.table.get(1);
30185
30186 let uses = wire.table.get(2);
30187
30188 let exposes = wire.table.get(3);
30189
30190 let offers = wire.table.get(4);
30191
30192 let capabilities = wire.table.get(5);
30193
30194 let children = wire.table.get(6);
30195
30196 let collections = wire.table.get(7);
30197
30198 let environments = wire.table.get(8);
30199
30200 let facets = wire.table.get(9);
30201
30202 let config = wire.table.get(10);
30203
30204 Self {
30205
30206
30207 program: program.map(|envelope| ::fidl_next::FromWire::from_wire(
30208 unsafe { envelope.read_unchecked::<crate::WireProgram<'de>>() }
30209 )),
30210
30211
30212 uses: uses.map(|envelope| ::fidl_next::FromWire::from_wire(
30213 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireUse<'de>>>() }
30214 )),
30215
30216
30217 exposes: exposes.map(|envelope| ::fidl_next::FromWire::from_wire(
30218 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireExpose<'de>>>() }
30219 )),
30220
30221
30222 offers: offers.map(|envelope| ::fidl_next::FromWire::from_wire(
30223 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>() }
30224 )),
30225
30226
30227 capabilities: capabilities.map(|envelope| ::fidl_next::FromWire::from_wire(
30228 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireCapability<'de>>>() }
30229 )),
30230
30231
30232 children: children.map(|envelope| ::fidl_next::FromWire::from_wire(
30233 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireChild<'de>>>() }
30234 )),
30235
30236
30237 collections: collections.map(|envelope| ::fidl_next::FromWire::from_wire(
30238 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireCollection<'de>>>() }
30239 )),
30240
30241
30242 environments: environments.map(|envelope| ::fidl_next::FromWire::from_wire(
30243 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireEnvironment<'de>>>() }
30244 )),
30245
30246
30247 facets: facets.map(|envelope| ::fidl_next::FromWire::from_wire(
30248 unsafe { envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>() }
30249 )),
30250
30251
30252 config: config.map(|envelope| ::fidl_next::FromWire::from_wire(
30253 unsafe { envelope.read_unchecked::<crate::WireConfigSchema<'de>>() }
30254 )),
30255
30256 }
30257 }
30258}
30259
30260impl<'de> ::fidl_next::FromWireRef<WireComponent<'de>> for Component {
30261 #[inline]
30262 fn from_wire_ref(wire: &WireComponent<'de>) -> Self {
30263 Self {
30264
30265
30266 program: wire.table.get(1)
30267 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30268 unsafe { envelope.deref_unchecked::<crate::WireProgram<'de>>() }
30269 )),
30270
30271
30272 uses: wire.table.get(2)
30273 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30274 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireUse<'de>>>() }
30275 )),
30276
30277
30278 exposes: wire.table.get(3)
30279 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30280 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireExpose<'de>>>() }
30281 )),
30282
30283
30284 offers: wire.table.get(4)
30285 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30286 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>() }
30287 )),
30288
30289
30290 capabilities: wire.table.get(5)
30291 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30292 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireCapability<'de>>>() }
30293 )),
30294
30295
30296 children: wire.table.get(6)
30297 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30298 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireChild<'de>>>() }
30299 )),
30300
30301
30302 collections: wire.table.get(7)
30303 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30304 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireCollection<'de>>>() }
30305 )),
30306
30307
30308 environments: wire.table.get(8)
30309 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30310 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireEnvironment<'de>>>() }
30311 )),
30312
30313
30314 facets: wire.table.get(9)
30315 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30316 unsafe { envelope.deref_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>() }
30317 )),
30318
30319
30320 config: wire.table.get(10)
30321 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30322 unsafe { envelope.deref_unchecked::<crate::WireConfigSchema<'de>>() }
30323 )),
30324
30325 }
30326 }
30327}
30328
30329#[repr(C)]
30331pub struct WireComponent<'de> {
30332 table: ::fidl_next::WireTable<'de>,
30333}
30334
30335impl<'de> Drop for WireComponent<'de> {
30336 fn drop(&mut self) {
30337 let _ = self
30338 .table
30339 .get(1)
30340 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireProgram<'de>>() });
30341
30342 let _ = self.table.get(2).map(|envelope| unsafe {
30343 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireUse<'de>>>()
30344 });
30345
30346 let _ = self.table.get(3).map(|envelope| unsafe {
30347 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireExpose<'de>>>()
30348 });
30349
30350 let _ = self.table.get(4).map(|envelope| unsafe {
30351 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOffer<'de>>>()
30352 });
30353
30354 let _ = self.table.get(5).map(|envelope| unsafe {
30355 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireCapability<'de>>>()
30356 });
30357
30358 let _ = self.table.get(6).map(|envelope| unsafe {
30359 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireChild<'de>>>()
30360 });
30361
30362 let _ = self.table.get(7).map(|envelope| unsafe {
30363 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireCollection<'de>>>()
30364 });
30365
30366 let _ = self.table.get(8).map(|envelope| unsafe {
30367 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireEnvironment<'de>>>()
30368 });
30369
30370 let _ = self.table.get(9).map(|envelope| unsafe {
30371 envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
30372 });
30373
30374 let _ = self
30375 .table
30376 .get(10)
30377 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigSchema<'de>>() });
30378 }
30379}
30380
30381unsafe impl ::fidl_next::Wire for WireComponent<'static> {
30382 type Decoded<'de> = WireComponent<'de>;
30383
30384 #[inline]
30385 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
30386 ::fidl_next::munge!(let Self { table } = out);
30387 ::fidl_next::WireTable::zero_padding(table);
30388 }
30389}
30390
30391unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponent<'static>
30392where
30393 ___D: ::fidl_next::Decoder + ?Sized,
30394{
30395 fn decode(
30396 slot: ::fidl_next::Slot<'_, Self>,
30397 decoder: &mut ___D,
30398 ) -> Result<(), ::fidl_next::DecodeError> {
30399 ::fidl_next::munge!(let Self { table } = slot);
30400
30401 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
30402 match ordinal {
30403 0 => unsafe { ::core::hint::unreachable_unchecked() },
30404
30405 1 => {
30406 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireProgram<'static>>(
30407 slot.as_mut(),
30408 decoder,
30409 )?;
30410
30411 Ok(())
30412 }
30413
30414 2 => {
30415 ::fidl_next::WireEnvelope::decode_as::<
30416 ___D,
30417 ::fidl_next::WireVector<'static, crate::WireUse<'static>>,
30418 >(slot.as_mut(), decoder)?;
30419
30420 Ok(())
30421 }
30422
30423 3 => {
30424 ::fidl_next::WireEnvelope::decode_as::<
30425 ___D,
30426 ::fidl_next::WireVector<'static, crate::WireExpose<'static>>,
30427 >(slot.as_mut(), decoder)?;
30428
30429 Ok(())
30430 }
30431
30432 4 => {
30433 ::fidl_next::WireEnvelope::decode_as::<
30434 ___D,
30435 ::fidl_next::WireVector<'static, crate::WireOffer<'static>>,
30436 >(slot.as_mut(), decoder)?;
30437
30438 Ok(())
30439 }
30440
30441 5 => {
30442 ::fidl_next::WireEnvelope::decode_as::<
30443 ___D,
30444 ::fidl_next::WireVector<'static, crate::WireCapability<'static>>,
30445 >(slot.as_mut(), decoder)?;
30446
30447 Ok(())
30448 }
30449
30450 6 => {
30451 ::fidl_next::WireEnvelope::decode_as::<
30452 ___D,
30453 ::fidl_next::WireVector<'static, crate::WireChild<'static>>,
30454 >(slot.as_mut(), decoder)?;
30455
30456 Ok(())
30457 }
30458
30459 7 => {
30460 ::fidl_next::WireEnvelope::decode_as::<
30461 ___D,
30462 ::fidl_next::WireVector<'static, crate::WireCollection<'static>>,
30463 >(slot.as_mut(), decoder)?;
30464
30465 Ok(())
30466 }
30467
30468 8 => {
30469 ::fidl_next::WireEnvelope::decode_as::<
30470 ___D,
30471 ::fidl_next::WireVector<'static, crate::WireEnvironment<'static>>,
30472 >(slot.as_mut(), decoder)?;
30473
30474 Ok(())
30475 }
30476
30477 9 => {
30478 ::fidl_next::WireEnvelope::decode_as::<
30479 ___D,
30480 ::fidl_next_fuchsia_data::WireDictionary<'static>,
30481 >(slot.as_mut(), decoder)?;
30482
30483 Ok(())
30484 }
30485
30486 10 => {
30487 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigSchema<'static>>(
30488 slot.as_mut(),
30489 decoder,
30490 )?;
30491
30492 Ok(())
30493 }
30494
30495 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
30496 }
30497 })
30498 }
30499}
30500
30501impl<'de> WireComponent<'de> {
30502 pub fn program(&self) -> Option<&crate::WireProgram<'de>> {
30503 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
30504 }
30505
30506 pub fn uses(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireUse<'de>>> {
30507 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
30508 }
30509
30510 pub fn exposes(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireExpose<'de>>> {
30511 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
30512 }
30513
30514 pub fn offers(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireOffer<'de>>> {
30515 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
30516 }
30517
30518 pub fn capabilities(
30519 &self,
30520 ) -> Option<&::fidl_next::WireVector<'de, crate::WireCapability<'de>>> {
30521 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
30522 }
30523
30524 pub fn children(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireChild<'de>>> {
30525 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
30526 }
30527
30528 pub fn collections(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireCollection<'de>>> {
30529 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
30530 }
30531
30532 pub fn environments(
30533 &self,
30534 ) -> Option<&::fidl_next::WireVector<'de, crate::WireEnvironment<'de>>> {
30535 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
30536 }
30537
30538 pub fn facets(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary<'de>> {
30539 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
30540 }
30541
30542 pub fn config(&self) -> Option<&crate::WireConfigSchema<'de>> {
30543 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
30544 }
30545}
30546
30547impl<'de> ::core::fmt::Debug for WireComponent<'de> {
30548 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
30549 f.debug_struct("Component")
30550 .field("program", &self.program())
30551 .field("uses", &self.uses())
30552 .field("exposes", &self.exposes())
30553 .field("offers", &self.offers())
30554 .field("capabilities", &self.capabilities())
30555 .field("children", &self.children())
30556 .field("collections", &self.collections())
30557 .field("environments", &self.environments())
30558 .field("facets", &self.facets())
30559 .field("config", &self.config())
30560 .finish()
30561 }
30562}
30563
30564#[doc = " An individual configuration value. It is matched against a specific configuration field based\n on its offset within `ValuesData.values`.\n"]
30565#[derive(Clone, Debug, Default)]
30566pub struct ConfigValueSpec {
30567 pub value: Option<crate::ConfigValue>,
30568}
30569
30570impl ConfigValueSpec {
30571 fn __max_ordinal(&self) -> usize {
30572 if self.value.is_some() {
30573 return 1;
30574 }
30575
30576 0
30577 }
30578}
30579
30580impl ::fidl_next::Encodable for ConfigValueSpec {
30581 type Encoded = WireConfigValueSpec<'static>;
30582}
30583
30584unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigValueSpec
30585where
30586 ___E: ::fidl_next::Encoder + ?Sized,
30587{
30588 #[inline]
30589 fn encode(
30590 mut self,
30591 encoder: &mut ___E,
30592 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
30593 ) -> Result<(), ::fidl_next::EncodeError> {
30594 ::fidl_next::munge!(let WireConfigValueSpec { table } = out);
30595
30596 let max_ord = self.__max_ordinal();
30597
30598 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
30599 ::fidl_next::Wire::zero_padding(&mut out);
30600
30601 let mut preallocated =
30602 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
30603
30604 for i in 1..=max_ord {
30605 match i {
30606 1 => {
30607 if let Some(value) = self.value.take() {
30608 ::fidl_next::WireEnvelope::encode_value(
30609 value,
30610 preallocated.encoder,
30611 &mut out,
30612 )?;
30613 } else {
30614 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30615 }
30616 }
30617
30618 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
30619 }
30620 unsafe {
30621 preallocated.write_next(out.assume_init_ref());
30622 }
30623 }
30624
30625 ::fidl_next::WireTable::encode_len(table, max_ord);
30626
30627 Ok(())
30628 }
30629}
30630
30631unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigValueSpec
30632where
30633 ___E: ::fidl_next::Encoder + ?Sized,
30634{
30635 #[inline]
30636 fn encode_ref(
30637 &self,
30638 encoder: &mut ___E,
30639 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
30640 ) -> Result<(), ::fidl_next::EncodeError> {
30641 ::fidl_next::munge!(let WireConfigValueSpec { table } = out);
30642
30643 let max_ord = self.__max_ordinal();
30644
30645 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
30646 ::fidl_next::Wire::zero_padding(&mut out);
30647
30648 let mut preallocated =
30649 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
30650
30651 for i in 1..=max_ord {
30652 match i {
30653 1 => {
30654 if let Some(value) = &self.value {
30655 ::fidl_next::WireEnvelope::encode_value(
30656 value,
30657 preallocated.encoder,
30658 &mut out,
30659 )?;
30660 } else {
30661 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30662 }
30663 }
30664
30665 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
30666 }
30667 unsafe {
30668 preallocated.write_next(out.assume_init_ref());
30669 }
30670 }
30671
30672 ::fidl_next::WireTable::encode_len(table, max_ord);
30673
30674 Ok(())
30675 }
30676}
30677
30678impl<'de> ::fidl_next::FromWire<WireConfigValueSpec<'de>> for ConfigValueSpec {
30679 #[inline]
30680 fn from_wire(wire: WireConfigValueSpec<'de>) -> Self {
30681 let wire = ::core::mem::ManuallyDrop::new(wire);
30682
30683 let value = wire.table.get(1);
30684
30685 Self {
30686 value: value.map(|envelope| {
30687 ::fidl_next::FromWire::from_wire(unsafe {
30688 envelope.read_unchecked::<crate::WireConfigValue<'de>>()
30689 })
30690 }),
30691 }
30692 }
30693}
30694
30695impl<'de> ::fidl_next::FromWireRef<WireConfigValueSpec<'de>> for ConfigValueSpec {
30696 #[inline]
30697 fn from_wire_ref(wire: &WireConfigValueSpec<'de>) -> Self {
30698 Self {
30699 value: wire.table.get(1).map(|envelope| {
30700 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
30701 envelope.deref_unchecked::<crate::WireConfigValue<'de>>()
30702 })
30703 }),
30704 }
30705 }
30706}
30707
30708#[repr(C)]
30710pub struct WireConfigValueSpec<'de> {
30711 table: ::fidl_next::WireTable<'de>,
30712}
30713
30714impl<'de> Drop for WireConfigValueSpec<'de> {
30715 fn drop(&mut self) {
30716 let _ = self
30717 .table
30718 .get(1)
30719 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigValue<'de>>() });
30720 }
30721}
30722
30723unsafe impl ::fidl_next::Wire for WireConfigValueSpec<'static> {
30724 type Decoded<'de> = WireConfigValueSpec<'de>;
30725
30726 #[inline]
30727 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
30728 ::fidl_next::munge!(let Self { table } = out);
30729 ::fidl_next::WireTable::zero_padding(table);
30730 }
30731}
30732
30733unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigValueSpec<'static>
30734where
30735 ___D: ::fidl_next::Decoder + ?Sized,
30736{
30737 fn decode(
30738 slot: ::fidl_next::Slot<'_, Self>,
30739 decoder: &mut ___D,
30740 ) -> Result<(), ::fidl_next::DecodeError> {
30741 ::fidl_next::munge!(let Self { table } = slot);
30742
30743 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
30744 match ordinal {
30745 0 => unsafe { ::core::hint::unreachable_unchecked() },
30746
30747 1 => {
30748 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValue<'static>>(
30749 slot.as_mut(),
30750 decoder,
30751 )?;
30752
30753 Ok(())
30754 }
30755
30756 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
30757 }
30758 })
30759 }
30760}
30761
30762impl<'de> WireConfigValueSpec<'de> {
30763 pub fn value(&self) -> Option<&crate::WireConfigValue<'de>> {
30764 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
30765 }
30766}
30767
30768impl<'de> ::core::fmt::Debug for WireConfigValueSpec<'de> {
30769 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
30770 f.debug_struct("ConfigValueSpec").field("value", &self.value()).finish()
30771 }
30772}
30773
30774#[doc = " Contents of the configuration value file. Defines the base values for a component\'s config.\n"]
30775#[derive(Clone, Debug, Default)]
30776pub struct ConfigValuesData {
30777 pub values: Option<Vec<crate::ConfigValueSpec>>,
30778
30779 pub checksum: Option<crate::ConfigChecksum>,
30780}
30781
30782impl ConfigValuesData {
30783 fn __max_ordinal(&self) -> usize {
30784 if self.checksum.is_some() {
30785 return 2;
30786 }
30787
30788 if self.values.is_some() {
30789 return 1;
30790 }
30791
30792 0
30793 }
30794}
30795
30796impl ::fidl_next::Encodable for ConfigValuesData {
30797 type Encoded = WireConfigValuesData<'static>;
30798}
30799
30800unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigValuesData
30801where
30802 ___E: ::fidl_next::Encoder + ?Sized,
30803{
30804 #[inline]
30805 fn encode(
30806 mut self,
30807 encoder: &mut ___E,
30808 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
30809 ) -> Result<(), ::fidl_next::EncodeError> {
30810 ::fidl_next::munge!(let WireConfigValuesData { table } = out);
30811
30812 let max_ord = self.__max_ordinal();
30813
30814 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
30815 ::fidl_next::Wire::zero_padding(&mut out);
30816
30817 let mut preallocated =
30818 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
30819
30820 for i in 1..=max_ord {
30821 match i {
30822 2 => {
30823 if let Some(checksum) = self.checksum.take() {
30824 ::fidl_next::WireEnvelope::encode_value(
30825 checksum,
30826 preallocated.encoder,
30827 &mut out,
30828 )?;
30829 } else {
30830 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30831 }
30832 }
30833
30834 1 => {
30835 if let Some(values) = self.values.take() {
30836 ::fidl_next::WireEnvelope::encode_value(
30837 values,
30838 preallocated.encoder,
30839 &mut out,
30840 )?;
30841 } else {
30842 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30843 }
30844 }
30845
30846 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
30847 }
30848 unsafe {
30849 preallocated.write_next(out.assume_init_ref());
30850 }
30851 }
30852
30853 ::fidl_next::WireTable::encode_len(table, max_ord);
30854
30855 Ok(())
30856 }
30857}
30858
30859unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigValuesData
30860where
30861 ___E: ::fidl_next::Encoder + ?Sized,
30862{
30863 #[inline]
30864 fn encode_ref(
30865 &self,
30866 encoder: &mut ___E,
30867 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
30868 ) -> Result<(), ::fidl_next::EncodeError> {
30869 ::fidl_next::munge!(let WireConfigValuesData { table } = out);
30870
30871 let max_ord = self.__max_ordinal();
30872
30873 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
30874 ::fidl_next::Wire::zero_padding(&mut out);
30875
30876 let mut preallocated =
30877 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
30878
30879 for i in 1..=max_ord {
30880 match i {
30881 2 => {
30882 if let Some(checksum) = &self.checksum {
30883 ::fidl_next::WireEnvelope::encode_value(
30884 checksum,
30885 preallocated.encoder,
30886 &mut out,
30887 )?;
30888 } else {
30889 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30890 }
30891 }
30892
30893 1 => {
30894 if let Some(values) = &self.values {
30895 ::fidl_next::WireEnvelope::encode_value(
30896 values,
30897 preallocated.encoder,
30898 &mut out,
30899 )?;
30900 } else {
30901 ::fidl_next::WireEnvelope::encode_zero(&mut out)
30902 }
30903 }
30904
30905 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
30906 }
30907 unsafe {
30908 preallocated.write_next(out.assume_init_ref());
30909 }
30910 }
30911
30912 ::fidl_next::WireTable::encode_len(table, max_ord);
30913
30914 Ok(())
30915 }
30916}
30917
30918impl<'de> ::fidl_next::FromWire<WireConfigValuesData<'de>> for ConfigValuesData {
30919 #[inline]
30920 fn from_wire(wire: WireConfigValuesData<'de>) -> Self {
30921 let wire = ::core::mem::ManuallyDrop::new(wire);
30922
30923 let values = wire.table.get(1);
30924
30925 let checksum = wire.table.get(2);
30926
30927 Self {
30928
30929
30930 values: values.map(|envelope| ::fidl_next::FromWire::from_wire(
30931 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigValueSpec<'de>>>() }
30932 )),
30933
30934
30935 checksum: checksum.map(|envelope| ::fidl_next::FromWire::from_wire(
30936 unsafe { envelope.read_unchecked::<crate::WireConfigChecksum<'de>>() }
30937 )),
30938
30939 }
30940 }
30941}
30942
30943impl<'de> ::fidl_next::FromWireRef<WireConfigValuesData<'de>> for ConfigValuesData {
30944 #[inline]
30945 fn from_wire_ref(wire: &WireConfigValuesData<'de>) -> Self {
30946 Self {
30947
30948
30949 values: wire.table.get(1)
30950 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30951 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigValueSpec<'de>>>() }
30952 )),
30953
30954
30955 checksum: wire.table.get(2)
30956 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
30957 unsafe { envelope.deref_unchecked::<crate::WireConfigChecksum<'de>>() }
30958 )),
30959
30960 }
30961 }
30962}
30963
30964#[repr(C)]
30966pub struct WireConfigValuesData<'de> {
30967 table: ::fidl_next::WireTable<'de>,
30968}
30969
30970impl<'de> Drop for WireConfigValuesData<'de> {
30971 fn drop(&mut self) {
30972 let _ = self.table.get(1)
30973 .map(|envelope| unsafe {
30974 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireConfigValueSpec<'de>>>()
30975 });
30976
30977 let _ = self
30978 .table
30979 .get(2)
30980 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConfigChecksum<'de>>() });
30981 }
30982}
30983
30984unsafe impl ::fidl_next::Wire for WireConfigValuesData<'static> {
30985 type Decoded<'de> = WireConfigValuesData<'de>;
30986
30987 #[inline]
30988 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
30989 ::fidl_next::munge!(let Self { table } = out);
30990 ::fidl_next::WireTable::zero_padding(table);
30991 }
30992}
30993
30994unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigValuesData<'static>
30995where
30996 ___D: ::fidl_next::Decoder + ?Sized,
30997{
30998 fn decode(
30999 slot: ::fidl_next::Slot<'_, Self>,
31000 decoder: &mut ___D,
31001 ) -> Result<(), ::fidl_next::DecodeError> {
31002 ::fidl_next::munge!(let Self { table } = slot);
31003
31004 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
31005 match ordinal {
31006 0 => unsafe { ::core::hint::unreachable_unchecked() },
31007
31008 1 => {
31009 ::fidl_next::WireEnvelope::decode_as::<
31010 ___D,
31011 ::fidl_next::WireVector<'static, crate::WireConfigValueSpec<'static>>,
31012 >(slot.as_mut(), decoder)?;
31013
31014 Ok(())
31015 }
31016
31017 2 => {
31018 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigChecksum<'static>>(
31019 slot.as_mut(),
31020 decoder,
31021 )?;
31022
31023 Ok(())
31024 }
31025
31026 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
31027 }
31028 })
31029 }
31030}
31031
31032impl<'de> WireConfigValuesData<'de> {
31033 pub fn values(&self) -> Option<&::fidl_next::WireVector<'de, crate::WireConfigValueSpec<'de>>> {
31034 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
31035 }
31036
31037 pub fn checksum(&self) -> Option<&crate::WireConfigChecksum<'de>> {
31038 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
31039 }
31040}
31041
31042impl<'de> ::core::fmt::Debug for WireConfigValuesData<'de> {
31043 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
31044 f.debug_struct("ConfigValuesData")
31045 .field("values", &self.values())
31046 .field("checksum", &self.checksum())
31047 .finish()
31048 }
31049}
31050
31051#[doc = " Indicates the event name to subscribe to with a given event mode.\n"]
31052#[derive(Clone, Debug, Default)]
31053pub struct EventSubscription {
31054 pub event_name: Option<String>,
31055}
31056
31057impl EventSubscription {
31058 fn __max_ordinal(&self) -> usize {
31059 if self.event_name.is_some() {
31060 return 1;
31061 }
31062
31063 0
31064 }
31065}
31066
31067impl ::fidl_next::Encodable for EventSubscription {
31068 type Encoded = WireEventSubscription<'static>;
31069}
31070
31071unsafe impl<___E> ::fidl_next::Encode<___E> for EventSubscription
31072where
31073 ___E: ::fidl_next::Encoder + ?Sized,
31074{
31075 #[inline]
31076 fn encode(
31077 mut self,
31078 encoder: &mut ___E,
31079 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31080 ) -> Result<(), ::fidl_next::EncodeError> {
31081 ::fidl_next::munge!(let WireEventSubscription { table } = out);
31082
31083 let max_ord = self.__max_ordinal();
31084
31085 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
31086 ::fidl_next::Wire::zero_padding(&mut out);
31087
31088 let mut preallocated =
31089 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
31090
31091 for i in 1..=max_ord {
31092 match i {
31093 1 => {
31094 if let Some(event_name) = self.event_name.take() {
31095 ::fidl_next::WireEnvelope::encode_value(
31096 event_name,
31097 preallocated.encoder,
31098 &mut out,
31099 )?;
31100 } else {
31101 ::fidl_next::WireEnvelope::encode_zero(&mut out)
31102 }
31103 }
31104
31105 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
31106 }
31107 unsafe {
31108 preallocated.write_next(out.assume_init_ref());
31109 }
31110 }
31111
31112 ::fidl_next::WireTable::encode_len(table, max_ord);
31113
31114 Ok(())
31115 }
31116}
31117
31118unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EventSubscription
31119where
31120 ___E: ::fidl_next::Encoder + ?Sized,
31121{
31122 #[inline]
31123 fn encode_ref(
31124 &self,
31125 encoder: &mut ___E,
31126 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31127 ) -> Result<(), ::fidl_next::EncodeError> {
31128 ::fidl_next::munge!(let WireEventSubscription { table } = out);
31129
31130 let max_ord = self.__max_ordinal();
31131
31132 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
31133 ::fidl_next::Wire::zero_padding(&mut out);
31134
31135 let mut preallocated =
31136 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
31137
31138 for i in 1..=max_ord {
31139 match i {
31140 1 => {
31141 if let Some(event_name) = &self.event_name {
31142 ::fidl_next::WireEnvelope::encode_value(
31143 event_name,
31144 preallocated.encoder,
31145 &mut out,
31146 )?;
31147 } else {
31148 ::fidl_next::WireEnvelope::encode_zero(&mut out)
31149 }
31150 }
31151
31152 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
31153 }
31154 unsafe {
31155 preallocated.write_next(out.assume_init_ref());
31156 }
31157 }
31158
31159 ::fidl_next::WireTable::encode_len(table, max_ord);
31160
31161 Ok(())
31162 }
31163}
31164
31165impl<'de> ::fidl_next::FromWire<WireEventSubscription<'de>> for EventSubscription {
31166 #[inline]
31167 fn from_wire(wire: WireEventSubscription<'de>) -> Self {
31168 let wire = ::core::mem::ManuallyDrop::new(wire);
31169
31170 let event_name = wire.table.get(1);
31171
31172 Self {
31173 event_name: event_name.map(|envelope| {
31174 ::fidl_next::FromWire::from_wire(unsafe {
31175 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
31176 })
31177 }),
31178 }
31179 }
31180}
31181
31182impl<'de> ::fidl_next::FromWireRef<WireEventSubscription<'de>> for EventSubscription {
31183 #[inline]
31184 fn from_wire_ref(wire: &WireEventSubscription<'de>) -> Self {
31185 Self {
31186 event_name: wire.table.get(1).map(|envelope| {
31187 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
31188 envelope.deref_unchecked::<::fidl_next::WireString<'de>>()
31189 })
31190 }),
31191 }
31192 }
31193}
31194
31195#[repr(C)]
31197pub struct WireEventSubscription<'de> {
31198 table: ::fidl_next::WireTable<'de>,
31199}
31200
31201impl<'de> Drop for WireEventSubscription<'de> {
31202 fn drop(&mut self) {
31203 let _ = self
31204 .table
31205 .get(1)
31206 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
31207 }
31208}
31209
31210unsafe impl ::fidl_next::Wire for WireEventSubscription<'static> {
31211 type Decoded<'de> = WireEventSubscription<'de>;
31212
31213 #[inline]
31214 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
31215 ::fidl_next::munge!(let Self { table } = out);
31216 ::fidl_next::WireTable::zero_padding(table);
31217 }
31218}
31219
31220unsafe impl<___D> ::fidl_next::Decode<___D> for WireEventSubscription<'static>
31221where
31222 ___D: ::fidl_next::Decoder + ?Sized,
31223{
31224 fn decode(
31225 slot: ::fidl_next::Slot<'_, Self>,
31226 decoder: &mut ___D,
31227 ) -> Result<(), ::fidl_next::DecodeError> {
31228 ::fidl_next::munge!(let Self { table } = slot);
31229
31230 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
31231 match ordinal {
31232 0 => unsafe { ::core::hint::unreachable_unchecked() },
31233
31234 1 => {
31235 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
31236 slot.as_mut(),
31237 decoder,
31238 )?;
31239
31240 let event_name = unsafe {
31241 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
31242 };
31243
31244 if event_name.len() > 100 {
31245 return Err(::fidl_next::DecodeError::VectorTooLong {
31246 size: event_name.len() as u64,
31247 limit: 100,
31248 });
31249 }
31250
31251 Ok(())
31252 }
31253
31254 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
31255 }
31256 })
31257 }
31258}
31259
31260impl<'de> WireEventSubscription<'de> {
31261 pub fn event_name(&self) -> Option<&::fidl_next::WireString<'de>> {
31262 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
31263 }
31264}
31265
31266impl<'de> ::core::fmt::Debug for WireEventSubscription<'de> {
31267 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
31268 f.debug_struct("EventSubscription").field("event_name", &self.event_name()).finish()
31269 }
31270}
31271
31272#[derive(Clone, Debug)]
31273pub enum LayoutParameter {
31274 NestedType(crate::ConfigType),
31275
31276 UnknownOrdinal_(u64),
31277}
31278
31279impl ::fidl_next::Encodable for LayoutParameter {
31280 type Encoded = WireLayoutParameter<'static>;
31281}
31282
31283unsafe impl<___E> ::fidl_next::Encode<___E> for LayoutParameter
31284where
31285 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
31286
31287 ___E: ::fidl_next::Encoder,
31288{
31289 #[inline]
31290 fn encode(
31291 self,
31292 encoder: &mut ___E,
31293 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31294 ) -> Result<(), ::fidl_next::EncodeError> {
31295 ::fidl_next::munge!(let WireLayoutParameter { raw, _phantom: _ } = out);
31296
31297 match self {
31298 Self::NestedType(value) => ::fidl_next::RawWireUnion::encode_as::<
31299 ___E,
31300 crate::ConfigType,
31301 >(value, 1, encoder, raw)?,
31302
31303 Self::UnknownOrdinal_(ordinal) => {
31304 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
31305 }
31306 }
31307
31308 Ok(())
31309 }
31310}
31311
31312unsafe impl<___E> ::fidl_next::EncodeRef<___E> for LayoutParameter
31313where
31314 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
31315
31316 ___E: ::fidl_next::Encoder,
31317{
31318 #[inline]
31319 fn encode_ref(
31320 &self,
31321 encoder: &mut ___E,
31322 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31323 ) -> Result<(), ::fidl_next::EncodeError> {
31324 ::fidl_next::munge!(let WireLayoutParameter { raw, _phantom: _ } = out);
31325
31326 match self {
31327 Self::NestedType(value) => ::fidl_next::RawWireUnion::encode_as::<
31328 ___E,
31329 &crate::ConfigType,
31330 >(value, 1, encoder, raw)?,
31331
31332 Self::UnknownOrdinal_(ordinal) => {
31333 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
31334 }
31335 }
31336
31337 Ok(())
31338 }
31339}
31340
31341impl ::fidl_next::EncodableOption for LayoutParameter {
31342 type EncodedOption = WireOptionalLayoutParameter<'static>;
31343}
31344
31345unsafe impl<___E> ::fidl_next::EncodeOption<___E> for LayoutParameter
31346where
31347 ___E: ?Sized,
31348 LayoutParameter: ::fidl_next::Encode<___E>,
31349{
31350 #[inline]
31351 fn encode_option(
31352 this: Option<Self>,
31353 encoder: &mut ___E,
31354 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
31355 ) -> Result<(), ::fidl_next::EncodeError> {
31356 ::fidl_next::munge!(let WireOptionalLayoutParameter { raw, _phantom: _ } = &mut *out);
31357
31358 if let Some(inner) = this {
31359 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
31360 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
31361 } else {
31362 ::fidl_next::RawWireUnion::encode_absent(raw);
31363 }
31364
31365 Ok(())
31366 }
31367}
31368
31369unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for LayoutParameter
31370where
31371 ___E: ?Sized,
31372 LayoutParameter: ::fidl_next::EncodeRef<___E>,
31373{
31374 #[inline]
31375 fn encode_option_ref(
31376 this: Option<&Self>,
31377 encoder: &mut ___E,
31378 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
31379 ) -> Result<(), ::fidl_next::EncodeError> {
31380 ::fidl_next::munge!(let WireOptionalLayoutParameter { raw, _phantom: _ } = &mut *out);
31381
31382 if let Some(inner) = this {
31383 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
31384 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
31385 } else {
31386 ::fidl_next::RawWireUnion::encode_absent(raw);
31387 }
31388
31389 Ok(())
31390 }
31391}
31392
31393impl<'de> ::fidl_next::FromWire<WireLayoutParameter<'de>> for LayoutParameter {
31394 #[inline]
31395 fn from_wire(wire: WireLayoutParameter<'de>) -> Self {
31396 let wire = ::core::mem::ManuallyDrop::new(wire);
31397 match wire.raw.ordinal() {
31398 1 => Self::NestedType(::fidl_next::FromWire::from_wire(unsafe {
31399 wire.raw.get().read_unchecked::<crate::WireConfigType<'de>>()
31400 })),
31401
31402 _ => unsafe { ::core::hint::unreachable_unchecked() },
31403 }
31404 }
31405}
31406
31407impl<'de> ::fidl_next::FromWireRef<WireLayoutParameter<'de>> for LayoutParameter {
31408 #[inline]
31409 fn from_wire_ref(wire: &WireLayoutParameter<'de>) -> Self {
31410 match wire.raw.ordinal() {
31411 1 => Self::NestedType(::fidl_next::FromWireRef::from_wire_ref(unsafe {
31412 wire.raw.get().deref_unchecked::<crate::WireConfigType<'de>>()
31413 })),
31414
31415 _ => unsafe { ::core::hint::unreachable_unchecked() },
31416 }
31417 }
31418}
31419
31420impl<'de> ::fidl_next::FromWireOption<WireOptionalLayoutParameter<'de>> for Box<LayoutParameter> {
31421 #[inline]
31422 fn from_wire_option(wire: WireOptionalLayoutParameter<'de>) -> Option<Self> {
31423 if let Some(inner) = wire.into_option() {
31424 Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
31425 } else {
31426 None
31427 }
31428 }
31429}
31430
31431impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalLayoutParameter<'de>>
31432 for Box<LayoutParameter>
31433{
31434 #[inline]
31435 fn from_wire_option_ref(wire: &WireOptionalLayoutParameter<'de>) -> Option<Self> {
31436 if let Some(inner) = wire.as_ref() {
31437 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
31438 } else {
31439 None
31440 }
31441 }
31442}
31443
31444#[repr(transparent)]
31446pub struct WireLayoutParameter<'de> {
31447 raw: ::fidl_next::RawWireUnion,
31448 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
31449}
31450
31451impl<'de> Drop for WireLayoutParameter<'de> {
31452 fn drop(&mut self) {
31453 match self.raw.ordinal() {
31454 1 => {
31455 let _ = unsafe { self.raw.get().read_unchecked::<crate::WireConfigType<'de>>() };
31456 }
31457
31458 _ => (),
31459 }
31460 }
31461}
31462
31463unsafe impl ::fidl_next::Wire for WireLayoutParameter<'static> {
31464 type Decoded<'de> = WireLayoutParameter<'de>;
31465
31466 #[inline]
31467 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
31468 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
31469 ::fidl_next::RawWireUnion::zero_padding(raw);
31470 }
31471}
31472
31473pub mod layout_parameter {
31474 pub enum Ref<'de> {
31475 NestedType(&'de crate::WireConfigType<'de>),
31476
31477 UnknownOrdinal_(u64),
31478 }
31479}
31480
31481impl<'de> WireLayoutParameter<'de> {
31482 pub fn as_ref(&self) -> crate::layout_parameter::Ref<'_> {
31483 match self.raw.ordinal() {
31484 1 => crate::layout_parameter::Ref::NestedType(unsafe {
31485 self.raw.get().deref_unchecked::<crate::WireConfigType<'_>>()
31486 }),
31487
31488 unknown => crate::layout_parameter::Ref::UnknownOrdinal_(unknown),
31489 }
31490 }
31491}
31492
31493unsafe impl<___D> ::fidl_next::Decode<___D> for WireLayoutParameter<'static>
31494where
31495 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
31496
31497 ___D: ::fidl_next::Decoder,
31498{
31499 fn decode(
31500 mut slot: ::fidl_next::Slot<'_, Self>,
31501 decoder: &mut ___D,
31502 ) -> Result<(), ::fidl_next::DecodeError> {
31503 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
31504 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
31505 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigType<'static>>(
31506 raw, decoder,
31507 )?,
31508
31509 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
31510 }
31511
31512 Ok(())
31513 }
31514}
31515
31516impl<'de> ::core::fmt::Debug for WireLayoutParameter<'de> {
31517 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
31518 match self.raw.ordinal() {
31519 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireConfigType<'_>>().fmt(f) },
31520 _ => unsafe { ::core::hint::unreachable_unchecked() },
31521 }
31522 }
31523}
31524
31525#[repr(transparent)]
31526pub struct WireOptionalLayoutParameter<'de> {
31527 raw: ::fidl_next::RawWireUnion,
31528 _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
31529}
31530
31531unsafe impl ::fidl_next::Wire for WireOptionalLayoutParameter<'static> {
31532 type Decoded<'de> = WireOptionalLayoutParameter<'de>;
31533
31534 #[inline]
31535 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
31536 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
31537 ::fidl_next::RawWireUnion::zero_padding(raw);
31538 }
31539}
31540
31541impl<'de> WireOptionalLayoutParameter<'de> {
31542 pub fn is_some(&self) -> bool {
31543 self.raw.is_some()
31544 }
31545
31546 pub fn is_none(&self) -> bool {
31547 self.raw.is_none()
31548 }
31549
31550 pub fn as_ref(&self) -> Option<&WireLayoutParameter<'de>> {
31551 if self.is_some() {
31552 Some(unsafe { &*(self as *const Self).cast() })
31553 } else {
31554 None
31555 }
31556 }
31557
31558 pub fn into_option(self) -> Option<WireLayoutParameter<'de>> {
31559 if self.is_some() {
31560 Some(WireLayoutParameter { raw: self.raw, _phantom: ::core::marker::PhantomData })
31561 } else {
31562 None
31563 }
31564 }
31565}
31566
31567unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalLayoutParameter<'static>
31568where
31569 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
31570
31571 ___D: ::fidl_next::Decoder,
31572{
31573 fn decode(
31574 mut slot: ::fidl_next::Slot<'_, Self>,
31575 decoder: &mut ___D,
31576 ) -> Result<(), ::fidl_next::DecodeError> {
31577 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
31578 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
31579 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigType<'static>>(
31580 raw, decoder,
31581 )?,
31582
31583 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
31584 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
31585 }
31586
31587 Ok(())
31588 }
31589}
31590
31591impl<'de> ::core::fmt::Debug for WireOptionalLayoutParameter<'de> {
31592 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
31593 self.as_ref().fmt(f)
31594 }
31595}
31596
31597pub const MAX_MONIKER_LENGTH: u32 = 4096;
31598
31599#[doc = " The maximum number of EventSubscriptions in an EventStream.\n"]
31600pub const MAX_NUM_EVENT_STREAM_SUBSCRIPTIONS: u64 = 100;
31601
31602#[derive(Clone, Debug)]
31603pub struct ResolvedConfigField {
31604 pub key: String,
31605
31606 pub value: crate::ConfigValue,
31607}
31608
31609impl ::fidl_next::Encodable for ResolvedConfigField {
31610 type Encoded = WireResolvedConfigField<'static>;
31611}
31612
31613unsafe impl<___E> ::fidl_next::Encode<___E> for ResolvedConfigField
31614where
31615 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
31616
31617 ___E: ::fidl_next::Encoder,
31618{
31619 #[inline]
31620 fn encode(
31621 self,
31622 encoder: &mut ___E,
31623 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31624 ) -> Result<(), ::fidl_next::EncodeError> {
31625 ::fidl_next::munge! {
31626 let Self::Encoded {
31627 key,
31628 value,
31629
31630 } = out;
31631 }
31632
31633 ::fidl_next::Encode::encode(self.key, encoder, key)?;
31634
31635 ::fidl_next::Encode::encode(self.value, encoder, value)?;
31636
31637 Ok(())
31638 }
31639}
31640
31641unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolvedConfigField
31642where
31643 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
31644
31645 ___E: ::fidl_next::Encoder,
31646{
31647 #[inline]
31648 fn encode_ref(
31649 &self,
31650 encoder: &mut ___E,
31651 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31652 ) -> Result<(), ::fidl_next::EncodeError> {
31653 ::fidl_next::munge! {
31654 let Self::Encoded {
31655 key,
31656 value,
31657
31658 } = out;
31659 }
31660
31661 ::fidl_next::EncodeRef::encode_ref(&self.key, encoder, key)?;
31662
31663 ::fidl_next::EncodeRef::encode_ref(&self.value, encoder, value)?;
31664
31665 Ok(())
31666 }
31667}
31668
31669impl ::fidl_next::EncodableOption for ResolvedConfigField {
31670 type EncodedOption = ::fidl_next::WireBox<'static, WireResolvedConfigField<'static>>;
31671}
31672
31673unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ResolvedConfigField
31674where
31675 ___E: ::fidl_next::Encoder + ?Sized,
31676 ResolvedConfigField: ::fidl_next::Encode<___E>,
31677{
31678 #[inline]
31679 fn encode_option(
31680 this: Option<Self>,
31681 encoder: &mut ___E,
31682 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
31683 ) -> Result<(), ::fidl_next::EncodeError> {
31684 if let Some(inner) = this {
31685 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
31686 ::fidl_next::WireBox::encode_present(out);
31687 } else {
31688 ::fidl_next::WireBox::encode_absent(out);
31689 }
31690
31691 Ok(())
31692 }
31693}
31694
31695unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ResolvedConfigField
31696where
31697 ___E: ::fidl_next::Encoder + ?Sized,
31698 ResolvedConfigField: ::fidl_next::EncodeRef<___E>,
31699{
31700 #[inline]
31701 fn encode_option_ref(
31702 this: Option<&Self>,
31703 encoder: &mut ___E,
31704 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
31705 ) -> Result<(), ::fidl_next::EncodeError> {
31706 if let Some(inner) = this {
31707 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
31708 ::fidl_next::WireBox::encode_present(out);
31709 } else {
31710 ::fidl_next::WireBox::encode_absent(out);
31711 }
31712
31713 Ok(())
31714 }
31715}
31716
31717impl<'de> ::fidl_next::FromWire<WireResolvedConfigField<'de>> for ResolvedConfigField {
31718 #[inline]
31719 fn from_wire(wire: WireResolvedConfigField<'de>) -> Self {
31720 Self {
31721 key: ::fidl_next::FromWire::from_wire(wire.key),
31722
31723 value: ::fidl_next::FromWire::from_wire(wire.value),
31724 }
31725 }
31726}
31727
31728impl<'de> ::fidl_next::FromWireRef<WireResolvedConfigField<'de>> for ResolvedConfigField {
31729 #[inline]
31730 fn from_wire_ref(wire: &WireResolvedConfigField<'de>) -> Self {
31731 Self {
31732 key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
31733
31734 value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value),
31735 }
31736 }
31737}
31738
31739#[derive(Debug)]
31741#[repr(C)]
31742pub struct WireResolvedConfigField<'de> {
31743 pub key: ::fidl_next::WireString<'de>,
31744
31745 pub value: crate::WireConfigValue<'de>,
31746}
31747
31748unsafe impl ::fidl_next::Wire for WireResolvedConfigField<'static> {
31749 type Decoded<'de> = WireResolvedConfigField<'de>;
31750
31751 #[inline]
31752 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
31753}
31754
31755unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolvedConfigField<'static>
31756where
31757 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
31758
31759 ___D: ::fidl_next::Decoder,
31760{
31761 fn decode(
31762 slot: ::fidl_next::Slot<'_, Self>,
31763 decoder: &mut ___D,
31764 ) -> Result<(), ::fidl_next::DecodeError> {
31765 ::fidl_next::munge! {
31766 let Self {
31767 mut key,
31768 mut value,
31769
31770 } = slot;
31771 }
31772
31773 ::fidl_next::Decode::decode(key.as_mut(), decoder)?;
31774
31775 ::fidl_next::Decode::decode(value.as_mut(), decoder)?;
31776
31777 Ok(())
31778 }
31779}
31780
31781#[doc = " A configuration that has been completely resolved by component manager.\n"]
31782#[derive(Clone, Debug)]
31783pub struct ResolvedConfig {
31784 pub fields: Vec<crate::ResolvedConfigField>,
31785
31786 pub checksum: crate::ConfigChecksum,
31787}
31788
31789impl ::fidl_next::Encodable for ResolvedConfig {
31790 type Encoded = WireResolvedConfig<'static>;
31791}
31792
31793unsafe impl<___E> ::fidl_next::Encode<___E> for ResolvedConfig
31794where
31795 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
31796
31797 ___E: ::fidl_next::Encoder,
31798{
31799 #[inline]
31800 fn encode(
31801 self,
31802 encoder: &mut ___E,
31803 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31804 ) -> Result<(), ::fidl_next::EncodeError> {
31805 ::fidl_next::munge! {
31806 let Self::Encoded {
31807 fields,
31808 checksum,
31809
31810 } = out;
31811 }
31812
31813 ::fidl_next::Encode::encode(self.fields, encoder, fields)?;
31814
31815 ::fidl_next::Encode::encode(self.checksum, encoder, checksum)?;
31816
31817 Ok(())
31818 }
31819}
31820
31821unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolvedConfig
31822where
31823 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
31824
31825 ___E: ::fidl_next::Encoder,
31826{
31827 #[inline]
31828 fn encode_ref(
31829 &self,
31830 encoder: &mut ___E,
31831 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31832 ) -> Result<(), ::fidl_next::EncodeError> {
31833 ::fidl_next::munge! {
31834 let Self::Encoded {
31835 fields,
31836 checksum,
31837
31838 } = out;
31839 }
31840
31841 ::fidl_next::EncodeRef::encode_ref(&self.fields, encoder, fields)?;
31842
31843 ::fidl_next::EncodeRef::encode_ref(&self.checksum, encoder, checksum)?;
31844
31845 Ok(())
31846 }
31847}
31848
31849impl ::fidl_next::EncodableOption for ResolvedConfig {
31850 type EncodedOption = ::fidl_next::WireBox<'static, WireResolvedConfig<'static>>;
31851}
31852
31853unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ResolvedConfig
31854where
31855 ___E: ::fidl_next::Encoder + ?Sized,
31856 ResolvedConfig: ::fidl_next::Encode<___E>,
31857{
31858 #[inline]
31859 fn encode_option(
31860 this: Option<Self>,
31861 encoder: &mut ___E,
31862 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
31863 ) -> Result<(), ::fidl_next::EncodeError> {
31864 if let Some(inner) = this {
31865 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
31866 ::fidl_next::WireBox::encode_present(out);
31867 } else {
31868 ::fidl_next::WireBox::encode_absent(out);
31869 }
31870
31871 Ok(())
31872 }
31873}
31874
31875unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ResolvedConfig
31876where
31877 ___E: ::fidl_next::Encoder + ?Sized,
31878 ResolvedConfig: ::fidl_next::EncodeRef<___E>,
31879{
31880 #[inline]
31881 fn encode_option_ref(
31882 this: Option<&Self>,
31883 encoder: &mut ___E,
31884 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
31885 ) -> Result<(), ::fidl_next::EncodeError> {
31886 if let Some(inner) = this {
31887 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
31888 ::fidl_next::WireBox::encode_present(out);
31889 } else {
31890 ::fidl_next::WireBox::encode_absent(out);
31891 }
31892
31893 Ok(())
31894 }
31895}
31896
31897impl<'de> ::fidl_next::FromWire<WireResolvedConfig<'de>> for ResolvedConfig {
31898 #[inline]
31899 fn from_wire(wire: WireResolvedConfig<'de>) -> Self {
31900 Self {
31901 fields: ::fidl_next::FromWire::from_wire(wire.fields),
31902
31903 checksum: ::fidl_next::FromWire::from_wire(wire.checksum),
31904 }
31905 }
31906}
31907
31908impl<'de> ::fidl_next::FromWireRef<WireResolvedConfig<'de>> for ResolvedConfig {
31909 #[inline]
31910 fn from_wire_ref(wire: &WireResolvedConfig<'de>) -> Self {
31911 Self {
31912 fields: ::fidl_next::FromWireRef::from_wire_ref(&wire.fields),
31913
31914 checksum: ::fidl_next::FromWireRef::from_wire_ref(&wire.checksum),
31915 }
31916 }
31917}
31918
31919#[derive(Debug)]
31921#[repr(C)]
31922pub struct WireResolvedConfig<'de> {
31923 pub fields: ::fidl_next::WireVector<'de, crate::WireResolvedConfigField<'de>>,
31924
31925 pub checksum: crate::WireConfigChecksum<'de>,
31926}
31927
31928unsafe impl ::fidl_next::Wire for WireResolvedConfig<'static> {
31929 type Decoded<'de> = WireResolvedConfig<'de>;
31930
31931 #[inline]
31932 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
31933}
31934
31935unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolvedConfig<'static>
31936where
31937 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
31938
31939 ___D: ::fidl_next::Decoder,
31940{
31941 fn decode(
31942 slot: ::fidl_next::Slot<'_, Self>,
31943 decoder: &mut ___D,
31944 ) -> Result<(), ::fidl_next::DecodeError> {
31945 ::fidl_next::munge! {
31946 let Self {
31947 mut fields,
31948 mut checksum,
31949
31950 } = slot;
31951 }
31952
31953 ::fidl_next::Decode::decode(fields.as_mut(), decoder)?;
31954
31955 ::fidl_next::Decode::decode(checksum.as_mut(), decoder)?;
31956
31957 Ok(())
31958 }
31959}
31960
31961pub mod compat {
31963
31964 impl ::core::convert::From<crate::AllowedOffers> for ::fidl_fuchsia_component_decl::AllowedOffers {
31965 #[inline]
31966 fn from(from: crate::AllowedOffers) -> Self {
31967 match crate::AllowedOffers::from(from) {
31968 crate::AllowedOffers::StaticOnly => Self::StaticOnly,
31969
31970 crate::AllowedOffers::StaticAndDynamic => Self::StaticAndDynamic,
31971 }
31972 }
31973 }
31974
31975 impl ::core::convert::From<crate::Availability> for ::fidl_fuchsia_component_decl::Availability {
31976 #[inline]
31977 fn from(from: crate::Availability) -> Self {
31978 match crate::Availability::from(from) {
31979 crate::Availability::Required => Self::Required,
31980
31981 crate::Availability::Optional => Self::Optional,
31982
31983 crate::Availability::SameAsTarget => Self::SameAsTarget,
31984
31985 crate::Availability::Transitional => Self::Transitional,
31986 }
31987 }
31988 }
31989
31990 impl ::core::convert::From<crate::StorageId> for ::fidl_fuchsia_component_decl::StorageId {
31991 #[inline]
31992 fn from(from: crate::StorageId) -> Self {
31993 match crate::StorageId::from(from) {
31994 crate::StorageId::StaticInstanceId => Self::StaticInstanceId,
31995
31996 crate::StorageId::StaticInstanceIdOrMoniker => Self::StaticInstanceIdOrMoniker,
31997 }
31998 }
31999 }
32000
32001 impl ::core::convert::From<crate::DeliveryType> for ::fidl_fuchsia_component_decl::DeliveryType {
32002 #[inline]
32003 fn from(from: crate::DeliveryType) -> Self {
32004 match crate::DeliveryType::from(from) {
32005 crate::DeliveryType::Immediate => Self::Immediate,
32006
32007 crate::DeliveryType::OnReadable => Self::OnReadable,
32008
32009 crate::DeliveryType::UnknownOrdinal_(value) => {
32010 Self::__SourceBreaking { unknown_ordinal: value }
32011 }
32012 }
32013 }
32014 }
32015
32016 impl ::core::convert::From<crate::StartupMode> for ::fidl_fuchsia_component_decl::StartupMode {
32017 #[inline]
32018 fn from(from: crate::StartupMode) -> Self {
32019 match crate::StartupMode::from(from) {
32020 crate::StartupMode::Lazy => Self::Lazy,
32021
32022 crate::StartupMode::Eager => Self::Eager,
32023 }
32024 }
32025 }
32026
32027 impl ::core::convert::From<crate::OnTerminate> for ::fidl_fuchsia_component_decl::OnTerminate {
32028 #[inline]
32029 fn from(from: crate::OnTerminate) -> Self {
32030 match crate::OnTerminate::from(from) {
32031 crate::OnTerminate::None => Self::None,
32032
32033 crate::OnTerminate::Reboot => Self::Reboot,
32034 }
32035 }
32036 }
32037
32038 impl ::core::convert::From<crate::Durability> for ::fidl_fuchsia_component_decl::Durability {
32039 #[inline]
32040 fn from(from: crate::Durability) -> Self {
32041 match crate::Durability::from(from) {
32042 crate::Durability::Transient => Self::Transient,
32043
32044 crate::Durability::SingleRun => Self::SingleRun,
32045 }
32046 }
32047 }
32048
32049 impl ::core::convert::From<crate::DependencyType>
32050 for ::fidl_fuchsia_component_decl::DependencyType
32051 {
32052 #[inline]
32053 fn from(from: crate::DependencyType) -> Self {
32054 match crate::DependencyType::from(from) {
32055 crate::DependencyType::Strong => Self::Strong,
32056
32057 crate::DependencyType::Weak => Self::Weak,
32058 }
32059 }
32060 }
32061
32062 impl ::core::convert::From<crate::EnvironmentExtends>
32063 for ::fidl_fuchsia_component_decl::EnvironmentExtends
32064 {
32065 #[inline]
32066 fn from(from: crate::EnvironmentExtends) -> Self {
32067 match crate::EnvironmentExtends::from(from) {
32068 crate::EnvironmentExtends::None => Self::None,
32069
32070 crate::EnvironmentExtends::Realm => Self::Realm,
32071 }
32072 }
32073 }
32074
32075 impl ::core::convert::From<crate::ConfigTypeLayout>
32076 for ::fidl_fuchsia_component_decl::ConfigTypeLayout
32077 {
32078 #[inline]
32079 fn from(from: crate::ConfigTypeLayout) -> Self {
32080 match crate::ConfigTypeLayout::from(from) {
32081 crate::ConfigTypeLayout::Bool => Self::Bool,
32082
32083 crate::ConfigTypeLayout::Uint8 => Self::Uint8,
32084
32085 crate::ConfigTypeLayout::Uint16 => Self::Uint16,
32086
32087 crate::ConfigTypeLayout::Uint32 => Self::Uint32,
32088
32089 crate::ConfigTypeLayout::Uint64 => Self::Uint64,
32090
32091 crate::ConfigTypeLayout::Int8 => Self::Int8,
32092
32093 crate::ConfigTypeLayout::Int16 => Self::Int16,
32094
32095 crate::ConfigTypeLayout::Int32 => Self::Int32,
32096
32097 crate::ConfigTypeLayout::Int64 => Self::Int64,
32098
32099 crate::ConfigTypeLayout::String => Self::String,
32100
32101 crate::ConfigTypeLayout::Vector => Self::Vector,
32102
32103 crate::ConfigTypeLayout::UnknownOrdinal_(value) => {
32104 Self::__SourceBreaking { unknown_ordinal: value }
32105 }
32106 }
32107 }
32108 }
32109
32110 impl ::core::convert::From<crate::ConfigMutability>
32111 for ::fidl_fuchsia_component_decl::ConfigMutability
32112 {
32113 #[inline]
32114 fn from(from: crate::ConfigMutability) -> Self {
32115 Self::from_bits_retain(from.bits())
32116 }
32117 }
32118}