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::TakeFrom<WireAllowedOffers> for AllowedOffers {
76 #[inline]
77 fn take_from(from: &WireAllowedOffers) -> Self {
78 Self::from(*from)
79 }
80}
81
82#[derive(Clone, Copy, Debug, PartialEq, Eq)]
84#[repr(transparent)]
85pub struct WireAllowedOffers {
86 value: ::fidl_next::WireU32,
87}
88
89unsafe impl ::fidl_next::ZeroPadding for WireAllowedOffers {
90 #[inline]
91 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
92 }
94}
95
96impl WireAllowedOffers {
97 pub const STATIC_ONLY: WireAllowedOffers = WireAllowedOffers { value: ::fidl_next::WireU32(1) };
98
99 pub const STATIC_AND_DYNAMIC: WireAllowedOffers =
100 WireAllowedOffers { value: ::fidl_next::WireU32(2) };
101}
102
103unsafe impl<___D> ::fidl_next::Decode<___D> for WireAllowedOffers
104where
105 ___D: ?Sized,
106{
107 fn decode(
108 slot: ::fidl_next::Slot<'_, Self>,
109 _: &mut ___D,
110 ) -> Result<(), ::fidl_next::DecodeError> {
111 ::fidl_next::munge!(let Self { value } = slot);
112
113 match u32::from(*value) {
114 1 | 2 => (),
115 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
116 }
117
118 Ok(())
119 }
120}
121
122impl ::core::convert::From<AllowedOffers> for WireAllowedOffers {
123 fn from(natural: AllowedOffers) -> Self {
124 match natural {
125 AllowedOffers::StaticOnly => WireAllowedOffers::STATIC_ONLY,
126
127 AllowedOffers::StaticAndDynamic => WireAllowedOffers::STATIC_AND_DYNAMIC,
128 }
129 }
130}
131
132#[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"]
133#[derive(Clone, Copy, Debug, PartialEq, Eq)]
134#[repr(u32)]
135pub enum Availability {
136 Required = 1,
137 Optional = 2,
138 SameAsTarget = 3,
139 Transitional = 4,
140}
141
142impl ::fidl_next::Encodable for Availability {
143 type Encoded = WireAvailability;
144}
145impl ::std::convert::TryFrom<u32> for Availability {
146 type Error = ::fidl_next::UnknownStrictEnumMemberError;
147 fn try_from(value: u32) -> Result<Self, Self::Error> {
148 match value {
149 1 => Ok(Self::Required),
150 2 => Ok(Self::Optional),
151 3 => Ok(Self::SameAsTarget),
152 4 => Ok(Self::Transitional),
153
154 _ => Err(Self::Error::new(value.into())),
155 }
156 }
157}
158
159unsafe impl<___E> ::fidl_next::Encode<___E> for Availability
160where
161 ___E: ?Sized,
162{
163 #[inline]
164 fn encode(
165 self,
166 encoder: &mut ___E,
167 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
168 ) -> Result<(), ::fidl_next::EncodeError> {
169 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
170 }
171}
172
173unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Availability
174where
175 ___E: ?Sized,
176{
177 #[inline]
178 fn encode_ref(
179 &self,
180 encoder: &mut ___E,
181 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
182 ) -> Result<(), ::fidl_next::EncodeError> {
183 ::fidl_next::munge!(let WireAvailability { value } = out);
184 let _ = value.write(::fidl_next::WireU32::from(match *self {
185 Self::Required => 1,
186
187 Self::Optional => 2,
188
189 Self::SameAsTarget => 3,
190
191 Self::Transitional => 4,
192 }));
193
194 Ok(())
195 }
196}
197
198impl ::core::convert::From<WireAvailability> for Availability {
199 fn from(wire: WireAvailability) -> Self {
200 match u32::from(wire.value) {
201 1 => Self::Required,
202
203 2 => Self::Optional,
204
205 3 => Self::SameAsTarget,
206
207 4 => Self::Transitional,
208
209 _ => unsafe { ::core::hint::unreachable_unchecked() },
210 }
211 }
212}
213
214impl ::fidl_next::TakeFrom<WireAvailability> for Availability {
215 #[inline]
216 fn take_from(from: &WireAvailability) -> Self {
217 Self::from(*from)
218 }
219}
220
221#[derive(Clone, Copy, Debug, PartialEq, Eq)]
223#[repr(transparent)]
224pub struct WireAvailability {
225 value: ::fidl_next::WireU32,
226}
227
228unsafe impl ::fidl_next::ZeroPadding for WireAvailability {
229 #[inline]
230 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
231 }
233}
234
235impl WireAvailability {
236 pub const REQUIRED: WireAvailability = WireAvailability { value: ::fidl_next::WireU32(1) };
237
238 pub const OPTIONAL: WireAvailability = WireAvailability { value: ::fidl_next::WireU32(2) };
239
240 pub const SAME_AS_TARGET: WireAvailability =
241 WireAvailability { value: ::fidl_next::WireU32(3) };
242
243 pub const TRANSITIONAL: WireAvailability = WireAvailability { value: ::fidl_next::WireU32(4) };
244}
245
246unsafe impl<___D> ::fidl_next::Decode<___D> for WireAvailability
247where
248 ___D: ?Sized,
249{
250 fn decode(
251 slot: ::fidl_next::Slot<'_, Self>,
252 _: &mut ___D,
253 ) -> Result<(), ::fidl_next::DecodeError> {
254 ::fidl_next::munge!(let Self { value } = slot);
255
256 match u32::from(*value) {
257 1 | 2 | 3 | 4 => (),
258 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
259 }
260
261 Ok(())
262 }
263}
264
265impl ::core::convert::From<Availability> for WireAvailability {
266 fn from(natural: Availability) -> Self {
267 match natural {
268 Availability::Required => WireAvailability::REQUIRED,
269
270 Availability::Optional => WireAvailability::OPTIONAL,
271
272 Availability::SameAsTarget => WireAvailability::SAME_AS_TARGET,
273
274 Availability::Transitional => WireAvailability::TRANSITIONAL,
275 }
276 }
277}
278
279#[doc = " Config keys can only consist of these many bytes\n"]
280pub const CONFIG_KEY_MAX_SIZE: u32 = 64;
281
282pub const MAX_NAME_LENGTH: u32 = 100;
283
284pub type Name = String;
285
286pub type WireName = ::fidl_next::WireString;
288
289pub const MAX_PATH_LENGTH: u32 = 1024;
290
291#[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"]
292#[derive(Clone, Debug, Default)]
293pub struct Service {
294 pub name: Option<String>,
295
296 pub source_path: Option<String>,
297}
298
299impl Service {
300 fn __max_ordinal(&self) -> usize {
301 if self.name.is_some() {
302 return 1;
303 }
304
305 if self.source_path.is_some() {
306 return 2;
307 }
308
309 0
310 }
311}
312
313impl ::fidl_next::Encodable for Service {
314 type Encoded = WireService;
315}
316
317unsafe impl<___E> ::fidl_next::Encode<___E> for Service
318where
319 ___E: ::fidl_next::Encoder + ?Sized,
320{
321 #[inline]
322 fn encode(
323 mut self,
324 encoder: &mut ___E,
325 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
326 ) -> Result<(), ::fidl_next::EncodeError> {
327 ::fidl_next::munge!(let WireService { table } = out);
328
329 let max_ord = self.__max_ordinal();
330
331 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
332 ::fidl_next::ZeroPadding::zero_padding(&mut out);
333
334 let mut preallocated =
335 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
336
337 for i in 1..=max_ord {
338 match i {
339 2 => {
340 if let Some(source_path) = self.source_path.take() {
341 ::fidl_next::WireEnvelope::encode_value(
342 source_path,
343 preallocated.encoder,
344 &mut out,
345 )?;
346 } else {
347 ::fidl_next::WireEnvelope::encode_zero(&mut out)
348 }
349 }
350
351 1 => {
352 if let Some(name) = self.name.take() {
353 ::fidl_next::WireEnvelope::encode_value(
354 name,
355 preallocated.encoder,
356 &mut out,
357 )?;
358 } else {
359 ::fidl_next::WireEnvelope::encode_zero(&mut out)
360 }
361 }
362
363 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
364 }
365 unsafe {
366 preallocated.write_next(out.assume_init_ref());
367 }
368 }
369
370 ::fidl_next::WireTable::encode_len(table, max_ord);
371
372 Ok(())
373 }
374}
375
376unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Service
377where
378 ___E: ::fidl_next::Encoder + ?Sized,
379{
380 #[inline]
381 fn encode_ref(
382 &self,
383 encoder: &mut ___E,
384 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
385 ) -> Result<(), ::fidl_next::EncodeError> {
386 ::fidl_next::munge!(let WireService { table } = out);
387
388 let max_ord = self.__max_ordinal();
389
390 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
391 ::fidl_next::ZeroPadding::zero_padding(&mut out);
392
393 let mut preallocated =
394 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
395
396 for i in 1..=max_ord {
397 match i {
398 2 => {
399 if let Some(source_path) = &self.source_path {
400 ::fidl_next::WireEnvelope::encode_value(
401 source_path,
402 preallocated.encoder,
403 &mut out,
404 )?;
405 } else {
406 ::fidl_next::WireEnvelope::encode_zero(&mut out)
407 }
408 }
409
410 1 => {
411 if let Some(name) = &self.name {
412 ::fidl_next::WireEnvelope::encode_value(
413 name,
414 preallocated.encoder,
415 &mut out,
416 )?;
417 } else {
418 ::fidl_next::WireEnvelope::encode_zero(&mut out)
419 }
420 }
421
422 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
423 }
424 unsafe {
425 preallocated.write_next(out.assume_init_ref());
426 }
427 }
428
429 ::fidl_next::WireTable::encode_len(table, max_ord);
430
431 Ok(())
432 }
433}
434
435impl ::fidl_next::TakeFrom<WireService> for Service {
436 #[inline]
437 fn take_from(from: &WireService) -> Self {
438 Self {
439 name: from.name().map(::fidl_next::TakeFrom::take_from),
440
441 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
442 }
443 }
444}
445
446#[repr(C)]
448pub struct WireService {
449 table: ::fidl_next::WireTable,
450}
451
452unsafe impl ::fidl_next::ZeroPadding for WireService {
453 #[inline]
454 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
455 ::fidl_next::munge!(let Self { table } = out);
456 ::fidl_next::WireTable::zero_padding(table);
457 }
458}
459
460unsafe impl<___D> ::fidl_next::Decode<___D> for WireService
461where
462 ___D: ::fidl_next::Decoder + ?Sized,
463{
464 fn decode(
465 slot: ::fidl_next::Slot<'_, Self>,
466 decoder: &mut ___D,
467 ) -> Result<(), ::fidl_next::DecodeError> {
468 ::fidl_next::munge!(let Self { table } = slot);
469
470 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
471 match ordinal {
472 0 => unsafe { ::core::hint::unreachable_unchecked() },
473
474 1 => {
475 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
476 slot.as_mut(),
477 decoder,
478 )?;
479
480 let name = unsafe {
481 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
482 };
483
484 if name.len() > 100 {
485 return Err(::fidl_next::DecodeError::VectorTooLong {
486 size: name.len() as u64,
487 limit: 100,
488 });
489 }
490
491 Ok(())
492 }
493
494 2 => {
495 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
496 slot.as_mut(),
497 decoder,
498 )?;
499
500 let source_path = unsafe {
501 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
502 };
503
504 if source_path.len() > 1024 {
505 return Err(::fidl_next::DecodeError::VectorTooLong {
506 size: source_path.len() as u64,
507 limit: 1024,
508 });
509 }
510
511 Ok(())
512 }
513
514 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
515 }
516 })
517 }
518}
519
520impl WireService {
521 pub fn name(&self) -> Option<&::fidl_next::WireString> {
522 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
523 }
524
525 pub fn source_path(&self) -> Option<&::fidl_next::WireString> {
526 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
527 }
528}
529
530impl ::core::fmt::Debug for WireService {
531 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
532 f.debug_struct("Service")
533 .field("name", &self.name())
534 .field("source_path", &self.source_path())
535 .finish()
536 }
537}
538
539#[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"]
540#[derive(Clone, Debug, Default)]
541pub struct Directory {
542 pub name: Option<String>,
543
544 pub source_path: Option<String>,
545
546 pub rights: Option<::fidl_next_fuchsia_io::Operations>,
547}
548
549impl Directory {
550 fn __max_ordinal(&self) -> usize {
551 if self.name.is_some() {
552 return 1;
553 }
554
555 if self.source_path.is_some() {
556 return 2;
557 }
558
559 if self.rights.is_some() {
560 return 3;
561 }
562
563 0
564 }
565}
566
567impl ::fidl_next::Encodable for Directory {
568 type Encoded = WireDirectory;
569}
570
571unsafe impl<___E> ::fidl_next::Encode<___E> for Directory
572where
573 ___E: ::fidl_next::Encoder + ?Sized,
574{
575 #[inline]
576 fn encode(
577 mut self,
578 encoder: &mut ___E,
579 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
580 ) -> Result<(), ::fidl_next::EncodeError> {
581 ::fidl_next::munge!(let WireDirectory { table } = out);
582
583 let max_ord = self.__max_ordinal();
584
585 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
586 ::fidl_next::ZeroPadding::zero_padding(&mut out);
587
588 let mut preallocated =
589 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
590
591 for i in 1..=max_ord {
592 match i {
593 3 => {
594 if let Some(rights) = self.rights.take() {
595 ::fidl_next::WireEnvelope::encode_value(
596 rights,
597 preallocated.encoder,
598 &mut out,
599 )?;
600 } else {
601 ::fidl_next::WireEnvelope::encode_zero(&mut out)
602 }
603 }
604
605 2 => {
606 if let Some(source_path) = self.source_path.take() {
607 ::fidl_next::WireEnvelope::encode_value(
608 source_path,
609 preallocated.encoder,
610 &mut out,
611 )?;
612 } else {
613 ::fidl_next::WireEnvelope::encode_zero(&mut out)
614 }
615 }
616
617 1 => {
618 if let Some(name) = self.name.take() {
619 ::fidl_next::WireEnvelope::encode_value(
620 name,
621 preallocated.encoder,
622 &mut out,
623 )?;
624 } else {
625 ::fidl_next::WireEnvelope::encode_zero(&mut out)
626 }
627 }
628
629 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
630 }
631 unsafe {
632 preallocated.write_next(out.assume_init_ref());
633 }
634 }
635
636 ::fidl_next::WireTable::encode_len(table, max_ord);
637
638 Ok(())
639 }
640}
641
642unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Directory
643where
644 ___E: ::fidl_next::Encoder + ?Sized,
645{
646 #[inline]
647 fn encode_ref(
648 &self,
649 encoder: &mut ___E,
650 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
651 ) -> Result<(), ::fidl_next::EncodeError> {
652 ::fidl_next::munge!(let WireDirectory { table } = out);
653
654 let max_ord = self.__max_ordinal();
655
656 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
657 ::fidl_next::ZeroPadding::zero_padding(&mut out);
658
659 let mut preallocated =
660 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
661
662 for i in 1..=max_ord {
663 match i {
664 3 => {
665 if let Some(rights) = &self.rights {
666 ::fidl_next::WireEnvelope::encode_value(
667 rights,
668 preallocated.encoder,
669 &mut out,
670 )?;
671 } else {
672 ::fidl_next::WireEnvelope::encode_zero(&mut out)
673 }
674 }
675
676 2 => {
677 if let Some(source_path) = &self.source_path {
678 ::fidl_next::WireEnvelope::encode_value(
679 source_path,
680 preallocated.encoder,
681 &mut out,
682 )?;
683 } else {
684 ::fidl_next::WireEnvelope::encode_zero(&mut out)
685 }
686 }
687
688 1 => {
689 if let Some(name) = &self.name {
690 ::fidl_next::WireEnvelope::encode_value(
691 name,
692 preallocated.encoder,
693 &mut out,
694 )?;
695 } else {
696 ::fidl_next::WireEnvelope::encode_zero(&mut out)
697 }
698 }
699
700 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
701 }
702 unsafe {
703 preallocated.write_next(out.assume_init_ref());
704 }
705 }
706
707 ::fidl_next::WireTable::encode_len(table, max_ord);
708
709 Ok(())
710 }
711}
712
713impl ::fidl_next::TakeFrom<WireDirectory> for Directory {
714 #[inline]
715 fn take_from(from: &WireDirectory) -> Self {
716 Self {
717 name: from.name().map(::fidl_next::TakeFrom::take_from),
718
719 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
720
721 rights: from.rights().map(::fidl_next::TakeFrom::take_from),
722 }
723 }
724}
725
726#[repr(C)]
728pub struct WireDirectory {
729 table: ::fidl_next::WireTable,
730}
731
732unsafe impl ::fidl_next::ZeroPadding for WireDirectory {
733 #[inline]
734 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
735 ::fidl_next::munge!(let Self { table } = out);
736 ::fidl_next::WireTable::zero_padding(table);
737 }
738}
739
740unsafe impl<___D> ::fidl_next::Decode<___D> for WireDirectory
741where
742 ___D: ::fidl_next::Decoder + ?Sized,
743{
744 fn decode(
745 slot: ::fidl_next::Slot<'_, Self>,
746 decoder: &mut ___D,
747 ) -> Result<(), ::fidl_next::DecodeError> {
748 ::fidl_next::munge!(let Self { table } = slot);
749
750 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
751 match ordinal {
752 0 => unsafe { ::core::hint::unreachable_unchecked() },
753
754 1 => {
755 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
756 slot.as_mut(),
757 decoder,
758 )?;
759
760 let name = unsafe {
761 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
762 };
763
764 if name.len() > 100 {
765 return Err(::fidl_next::DecodeError::VectorTooLong {
766 size: name.len() as u64,
767 limit: 100,
768 });
769 }
770
771 Ok(())
772 }
773
774 2 => {
775 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
776 slot.as_mut(),
777 decoder,
778 )?;
779
780 let source_path = unsafe {
781 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
782 };
783
784 if source_path.len() > 1024 {
785 return Err(::fidl_next::DecodeError::VectorTooLong {
786 size: source_path.len() as u64,
787 limit: 1024,
788 });
789 }
790
791 Ok(())
792 }
793
794 3 => {
795 ::fidl_next::WireEnvelope::decode_as::<
796 ___D,
797 ::fidl_next_fuchsia_io::WireOperations,
798 >(slot.as_mut(), decoder)?;
799
800 Ok(())
801 }
802
803 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
804 }
805 })
806 }
807}
808
809impl WireDirectory {
810 pub fn name(&self) -> Option<&::fidl_next::WireString> {
811 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
812 }
813
814 pub fn source_path(&self) -> Option<&::fidl_next::WireString> {
815 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
816 }
817
818 pub fn rights(&self) -> Option<&::fidl_next_fuchsia_io::WireOperations> {
819 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
820 }
821}
822
823impl ::core::fmt::Debug for WireDirectory {
824 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
825 f.debug_struct("Directory")
826 .field("name", &self.name())
827 .field("source_path", &self.source_path())
828 .field("rights", &self.rights())
829 .finish()
830 }
831}
832
833#[doc = " A reference to a component\'s parent instance.\n"]
834#[derive(Clone, Debug)]
835#[repr(C)]
836pub struct ParentRef {}
837
838impl ::fidl_next::Encodable for ParentRef {
839 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
840 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
841
842 type Encoded = WireParentRef;
843}
844
845unsafe impl<___E> ::fidl_next::Encode<___E> for ParentRef
846where
847 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
848{
849 #[inline]
850 fn encode(
851 self,
852 encoder: &mut ___E,
853 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
854 ) -> Result<(), ::fidl_next::EncodeError> {
855 ::fidl_next::munge! {
856 let Self::Encoded {
857
858 } = out;
859 }
860
861 Ok(())
862 }
863}
864
865unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ParentRef
866where
867 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
868{
869 #[inline]
870 fn encode_ref(
871 &self,
872 encoder: &mut ___E,
873 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
874 ) -> Result<(), ::fidl_next::EncodeError> {
875 ::fidl_next::munge! {
876 let Self::Encoded {
877
878 } = out;
879 }
880
881 Ok(())
882 }
883}
884
885impl ::fidl_next::EncodableOption for Box<ParentRef> {
886 type EncodedOption = ::fidl_next::WireBox<WireParentRef>;
887}
888
889unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ParentRef>
890where
891 ___E: ::fidl_next::Encoder + ?Sized,
892 ParentRef: ::fidl_next::Encode<___E>,
893{
894 #[inline]
895 fn encode_option(
896 this: Option<Self>,
897 encoder: &mut ___E,
898 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
899 ) -> Result<(), ::fidl_next::EncodeError> {
900 if let Some(inner) = this {
901 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
902 ::fidl_next::WireBox::encode_present(out);
903 } else {
904 ::fidl_next::WireBox::encode_absent(out);
905 }
906
907 Ok(())
908 }
909}
910
911unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ParentRef>
912where
913 ___E: ::fidl_next::Encoder + ?Sized,
914 ParentRef: ::fidl_next::EncodeRef<___E>,
915{
916 #[inline]
917 fn encode_option_ref(
918 this: Option<&Self>,
919 encoder: &mut ___E,
920 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
921 ) -> Result<(), ::fidl_next::EncodeError> {
922 if let Some(inner) = this {
923 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
924 ::fidl_next::WireBox::encode_present(out);
925 } else {
926 ::fidl_next::WireBox::encode_absent(out);
927 }
928
929 Ok(())
930 }
931}
932
933impl ::fidl_next::TakeFrom<WireParentRef> for ParentRef {
934 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
935 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
936
937 #[inline]
938 fn take_from(from: &WireParentRef) -> Self {
939 Self {}
940 }
941}
942
943#[derive(Clone, Debug)]
945#[repr(C)]
946pub struct WireParentRef {}
947
948unsafe impl ::fidl_next::ZeroPadding for WireParentRef {
949 #[inline]
950 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
951}
952
953unsafe impl<___D> ::fidl_next::Decode<___D> for WireParentRef
954where
955 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
956{
957 fn decode(
958 slot: ::fidl_next::Slot<'_, Self>,
959 decoder: &mut ___D,
960 ) -> Result<(), ::fidl_next::DecodeError> {
961 ::fidl_next::munge! {
962 let Self {
963
964 } = slot;
965 }
966
967 Ok(())
968 }
969}
970
971#[doc = " A reference to the component itself.\n"]
972#[derive(Clone, Debug)]
973#[repr(C)]
974pub struct SelfRef {}
975
976impl ::fidl_next::Encodable for SelfRef {
977 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
978 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
979
980 type Encoded = WireSelfRef;
981}
982
983unsafe impl<___E> ::fidl_next::Encode<___E> for SelfRef
984where
985 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
986{
987 #[inline]
988 fn encode(
989 self,
990 encoder: &mut ___E,
991 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
992 ) -> Result<(), ::fidl_next::EncodeError> {
993 ::fidl_next::munge! {
994 let Self::Encoded {
995
996 } = out;
997 }
998
999 Ok(())
1000 }
1001}
1002
1003unsafe impl<___E> ::fidl_next::EncodeRef<___E> for SelfRef
1004where
1005 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1006{
1007 #[inline]
1008 fn encode_ref(
1009 &self,
1010 encoder: &mut ___E,
1011 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1012 ) -> Result<(), ::fidl_next::EncodeError> {
1013 ::fidl_next::munge! {
1014 let Self::Encoded {
1015
1016 } = out;
1017 }
1018
1019 Ok(())
1020 }
1021}
1022
1023impl ::fidl_next::EncodableOption for Box<SelfRef> {
1024 type EncodedOption = ::fidl_next::WireBox<WireSelfRef>;
1025}
1026
1027unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<SelfRef>
1028where
1029 ___E: ::fidl_next::Encoder + ?Sized,
1030 SelfRef: ::fidl_next::Encode<___E>,
1031{
1032 #[inline]
1033 fn encode_option(
1034 this: Option<Self>,
1035 encoder: &mut ___E,
1036 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1037 ) -> Result<(), ::fidl_next::EncodeError> {
1038 if let Some(inner) = this {
1039 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
1040 ::fidl_next::WireBox::encode_present(out);
1041 } else {
1042 ::fidl_next::WireBox::encode_absent(out);
1043 }
1044
1045 Ok(())
1046 }
1047}
1048
1049unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<SelfRef>
1050where
1051 ___E: ::fidl_next::Encoder + ?Sized,
1052 SelfRef: ::fidl_next::EncodeRef<___E>,
1053{
1054 #[inline]
1055 fn encode_option_ref(
1056 this: Option<&Self>,
1057 encoder: &mut ___E,
1058 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1059 ) -> Result<(), ::fidl_next::EncodeError> {
1060 if let Some(inner) = this {
1061 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1062 ::fidl_next::WireBox::encode_present(out);
1063 } else {
1064 ::fidl_next::WireBox::encode_absent(out);
1065 }
1066
1067 Ok(())
1068 }
1069}
1070
1071impl ::fidl_next::TakeFrom<WireSelfRef> for SelfRef {
1072 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
1073 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1074
1075 #[inline]
1076 fn take_from(from: &WireSelfRef) -> Self {
1077 Self {}
1078 }
1079}
1080
1081#[derive(Clone, Debug)]
1083#[repr(C)]
1084pub struct WireSelfRef {}
1085
1086unsafe impl ::fidl_next::ZeroPadding for WireSelfRef {
1087 #[inline]
1088 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1089}
1090
1091unsafe impl<___D> ::fidl_next::Decode<___D> for WireSelfRef
1092where
1093 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1094{
1095 fn decode(
1096 slot: ::fidl_next::Slot<'_, Self>,
1097 decoder: &mut ___D,
1098 ) -> Result<(), ::fidl_next::DecodeError> {
1099 ::fidl_next::munge! {
1100 let Self {
1101
1102 } = slot;
1103 }
1104
1105 Ok(())
1106 }
1107}
1108
1109pub const MAX_CHILD_NAME_LENGTH: u32 = 1024;
1110
1111pub type ChildName = String;
1112
1113pub type WireChildName = ::fidl_next::WireString;
1115
1116#[doc = " A reference to one of the component\'s child instances.\n"]
1117#[derive(Clone, Debug)]
1118pub struct ChildRef {
1119 pub name: String,
1120
1121 pub collection: Option<String>,
1122}
1123
1124impl ::fidl_next::Encodable for ChildRef {
1125 type Encoded = WireChildRef;
1126}
1127
1128unsafe impl<___E> ::fidl_next::Encode<___E> for ChildRef
1129where
1130 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1131
1132 ___E: ::fidl_next::Encoder,
1133{
1134 #[inline]
1135 fn encode(
1136 self,
1137 encoder: &mut ___E,
1138 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1139 ) -> Result<(), ::fidl_next::EncodeError> {
1140 ::fidl_next::munge! {
1141 let Self::Encoded {
1142 name,
1143 collection,
1144
1145 } = out;
1146 }
1147
1148 ::fidl_next::Encode::encode(self.name, encoder, name)?;
1149
1150 ::fidl_next::Encode::encode(self.collection, encoder, collection)?;
1151
1152 Ok(())
1153 }
1154}
1155
1156unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ChildRef
1157where
1158 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1159
1160 ___E: ::fidl_next::Encoder,
1161{
1162 #[inline]
1163 fn encode_ref(
1164 &self,
1165 encoder: &mut ___E,
1166 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1167 ) -> Result<(), ::fidl_next::EncodeError> {
1168 ::fidl_next::munge! {
1169 let Self::Encoded {
1170 name,
1171 collection,
1172
1173 } = out;
1174 }
1175
1176 ::fidl_next::EncodeRef::encode_ref(&self.name, encoder, name)?;
1177
1178 ::fidl_next::EncodeRef::encode_ref(&self.collection, encoder, collection)?;
1179
1180 Ok(())
1181 }
1182}
1183
1184impl ::fidl_next::EncodableOption for Box<ChildRef> {
1185 type EncodedOption = ::fidl_next::WireBox<WireChildRef>;
1186}
1187
1188unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ChildRef>
1189where
1190 ___E: ::fidl_next::Encoder + ?Sized,
1191 ChildRef: ::fidl_next::Encode<___E>,
1192{
1193 #[inline]
1194 fn encode_option(
1195 this: Option<Self>,
1196 encoder: &mut ___E,
1197 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1198 ) -> Result<(), ::fidl_next::EncodeError> {
1199 if let Some(inner) = this {
1200 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
1201 ::fidl_next::WireBox::encode_present(out);
1202 } else {
1203 ::fidl_next::WireBox::encode_absent(out);
1204 }
1205
1206 Ok(())
1207 }
1208}
1209
1210unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ChildRef>
1211where
1212 ___E: ::fidl_next::Encoder + ?Sized,
1213 ChildRef: ::fidl_next::EncodeRef<___E>,
1214{
1215 #[inline]
1216 fn encode_option_ref(
1217 this: Option<&Self>,
1218 encoder: &mut ___E,
1219 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1220 ) -> Result<(), ::fidl_next::EncodeError> {
1221 if let Some(inner) = this {
1222 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1223 ::fidl_next::WireBox::encode_present(out);
1224 } else {
1225 ::fidl_next::WireBox::encode_absent(out);
1226 }
1227
1228 Ok(())
1229 }
1230}
1231
1232impl ::fidl_next::TakeFrom<WireChildRef> for ChildRef {
1233 #[inline]
1234 fn take_from(from: &WireChildRef) -> Self {
1235 Self {
1236 name: ::fidl_next::TakeFrom::take_from(&from.name),
1237
1238 collection: ::fidl_next::TakeFrom::take_from(&from.collection),
1239 }
1240 }
1241}
1242
1243#[derive(Debug)]
1245#[repr(C)]
1246pub struct WireChildRef {
1247 pub name: ::fidl_next::WireString,
1248
1249 pub collection: ::fidl_next::WireOptionalString,
1250}
1251
1252unsafe impl ::fidl_next::ZeroPadding for WireChildRef {
1253 #[inline]
1254 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1255}
1256
1257unsafe impl<___D> ::fidl_next::Decode<___D> for WireChildRef
1258where
1259 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1260
1261 ___D: ::fidl_next::Decoder,
1262{
1263 fn decode(
1264 slot: ::fidl_next::Slot<'_, Self>,
1265 decoder: &mut ___D,
1266 ) -> Result<(), ::fidl_next::DecodeError> {
1267 ::fidl_next::munge! {
1268 let Self {
1269 mut name,
1270 mut collection,
1271
1272 } = slot;
1273 }
1274
1275 ::fidl_next::Decode::decode(name.as_mut(), decoder)?;
1276
1277 let name = unsafe { name.deref_unchecked() };
1278
1279 if name.len() > 1024 {
1280 return Err(::fidl_next::DecodeError::VectorTooLong {
1281 size: name.len() as u64,
1282 limit: 1024,
1283 });
1284 }
1285
1286 ::fidl_next::Decode::decode(collection.as_mut(), decoder)?;
1287
1288 let collection = unsafe { collection.deref_unchecked() };
1289
1290 if let Some(collection) = collection.as_ref() {
1291 if collection.len() > 100 {
1292 return Err(::fidl_next::DecodeError::VectorTooLong {
1293 size: collection.len() as u64,
1294 limit: 100,
1295 });
1296 }
1297 }
1298
1299 Ok(())
1300 }
1301}
1302
1303#[doc = " A reference to one of the component\'s collections.\n"]
1304#[derive(Clone, Debug)]
1305pub struct CollectionRef {
1306 pub name: String,
1307}
1308
1309impl ::fidl_next::Encodable for CollectionRef {
1310 type Encoded = WireCollectionRef;
1311}
1312
1313unsafe impl<___E> ::fidl_next::Encode<___E> for CollectionRef
1314where
1315 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1316
1317 ___E: ::fidl_next::Encoder,
1318{
1319 #[inline]
1320 fn encode(
1321 self,
1322 encoder: &mut ___E,
1323 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1324 ) -> Result<(), ::fidl_next::EncodeError> {
1325 ::fidl_next::munge! {
1326 let Self::Encoded {
1327 name,
1328
1329 } = out;
1330 }
1331
1332 ::fidl_next::Encode::encode(self.name, encoder, name)?;
1333
1334 Ok(())
1335 }
1336}
1337
1338unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CollectionRef
1339where
1340 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1341
1342 ___E: ::fidl_next::Encoder,
1343{
1344 #[inline]
1345 fn encode_ref(
1346 &self,
1347 encoder: &mut ___E,
1348 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1349 ) -> Result<(), ::fidl_next::EncodeError> {
1350 ::fidl_next::munge! {
1351 let Self::Encoded {
1352 name,
1353
1354 } = out;
1355 }
1356
1357 ::fidl_next::EncodeRef::encode_ref(&self.name, encoder, name)?;
1358
1359 Ok(())
1360 }
1361}
1362
1363impl ::fidl_next::EncodableOption for Box<CollectionRef> {
1364 type EncodedOption = ::fidl_next::WireBox<WireCollectionRef>;
1365}
1366
1367unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<CollectionRef>
1368where
1369 ___E: ::fidl_next::Encoder + ?Sized,
1370 CollectionRef: ::fidl_next::Encode<___E>,
1371{
1372 #[inline]
1373 fn encode_option(
1374 this: Option<Self>,
1375 encoder: &mut ___E,
1376 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1377 ) -> Result<(), ::fidl_next::EncodeError> {
1378 if let Some(inner) = this {
1379 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
1380 ::fidl_next::WireBox::encode_present(out);
1381 } else {
1382 ::fidl_next::WireBox::encode_absent(out);
1383 }
1384
1385 Ok(())
1386 }
1387}
1388
1389unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<CollectionRef>
1390where
1391 ___E: ::fidl_next::Encoder + ?Sized,
1392 CollectionRef: ::fidl_next::EncodeRef<___E>,
1393{
1394 #[inline]
1395 fn encode_option_ref(
1396 this: Option<&Self>,
1397 encoder: &mut ___E,
1398 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1399 ) -> Result<(), ::fidl_next::EncodeError> {
1400 if let Some(inner) = this {
1401 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1402 ::fidl_next::WireBox::encode_present(out);
1403 } else {
1404 ::fidl_next::WireBox::encode_absent(out);
1405 }
1406
1407 Ok(())
1408 }
1409}
1410
1411impl ::fidl_next::TakeFrom<WireCollectionRef> for CollectionRef {
1412 #[inline]
1413 fn take_from(from: &WireCollectionRef) -> Self {
1414 Self { name: ::fidl_next::TakeFrom::take_from(&from.name) }
1415 }
1416}
1417
1418#[derive(Debug)]
1420#[repr(C)]
1421pub struct WireCollectionRef {
1422 pub name: ::fidl_next::WireString,
1423}
1424
1425unsafe impl ::fidl_next::ZeroPadding for WireCollectionRef {
1426 #[inline]
1427 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1428}
1429
1430unsafe impl<___D> ::fidl_next::Decode<___D> for WireCollectionRef
1431where
1432 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1433
1434 ___D: ::fidl_next::Decoder,
1435{
1436 fn decode(
1437 slot: ::fidl_next::Slot<'_, Self>,
1438 decoder: &mut ___D,
1439 ) -> Result<(), ::fidl_next::DecodeError> {
1440 ::fidl_next::munge! {
1441 let Self {
1442 mut name,
1443
1444 } = slot;
1445 }
1446
1447 ::fidl_next::Decode::decode(name.as_mut(), decoder)?;
1448
1449 let name = unsafe { name.deref_unchecked() };
1450
1451 if name.len() > 100 {
1452 return Err(::fidl_next::DecodeError::VectorTooLong {
1453 size: name.len() as u64,
1454 limit: 100,
1455 });
1456 }
1457
1458 Ok(())
1459 }
1460}
1461
1462#[doc = " A reference to the component framework itself.\n"]
1463#[derive(Clone, Debug)]
1464#[repr(C)]
1465pub struct FrameworkRef {}
1466
1467impl ::fidl_next::Encodable for FrameworkRef {
1468 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
1469 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1470
1471 type Encoded = WireFrameworkRef;
1472}
1473
1474unsafe impl<___E> ::fidl_next::Encode<___E> for FrameworkRef
1475where
1476 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1477{
1478 #[inline]
1479 fn encode(
1480 self,
1481 encoder: &mut ___E,
1482 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1483 ) -> Result<(), ::fidl_next::EncodeError> {
1484 ::fidl_next::munge! {
1485 let Self::Encoded {
1486
1487 } = out;
1488 }
1489
1490 Ok(())
1491 }
1492}
1493
1494unsafe impl<___E> ::fidl_next::EncodeRef<___E> for FrameworkRef
1495where
1496 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1497{
1498 #[inline]
1499 fn encode_ref(
1500 &self,
1501 encoder: &mut ___E,
1502 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1503 ) -> Result<(), ::fidl_next::EncodeError> {
1504 ::fidl_next::munge! {
1505 let Self::Encoded {
1506
1507 } = out;
1508 }
1509
1510 Ok(())
1511 }
1512}
1513
1514impl ::fidl_next::EncodableOption for Box<FrameworkRef> {
1515 type EncodedOption = ::fidl_next::WireBox<WireFrameworkRef>;
1516}
1517
1518unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<FrameworkRef>
1519where
1520 ___E: ::fidl_next::Encoder + ?Sized,
1521 FrameworkRef: ::fidl_next::Encode<___E>,
1522{
1523 #[inline]
1524 fn encode_option(
1525 this: Option<Self>,
1526 encoder: &mut ___E,
1527 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1528 ) -> Result<(), ::fidl_next::EncodeError> {
1529 if let Some(inner) = this {
1530 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
1531 ::fidl_next::WireBox::encode_present(out);
1532 } else {
1533 ::fidl_next::WireBox::encode_absent(out);
1534 }
1535
1536 Ok(())
1537 }
1538}
1539
1540unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<FrameworkRef>
1541where
1542 ___E: ::fidl_next::Encoder + ?Sized,
1543 FrameworkRef: ::fidl_next::EncodeRef<___E>,
1544{
1545 #[inline]
1546 fn encode_option_ref(
1547 this: Option<&Self>,
1548 encoder: &mut ___E,
1549 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1550 ) -> Result<(), ::fidl_next::EncodeError> {
1551 if let Some(inner) = this {
1552 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1553 ::fidl_next::WireBox::encode_present(out);
1554 } else {
1555 ::fidl_next::WireBox::encode_absent(out);
1556 }
1557
1558 Ok(())
1559 }
1560}
1561
1562impl ::fidl_next::TakeFrom<WireFrameworkRef> for FrameworkRef {
1563 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
1564 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1565
1566 #[inline]
1567 fn take_from(from: &WireFrameworkRef) -> Self {
1568 Self {}
1569 }
1570}
1571
1572#[derive(Clone, Debug)]
1574#[repr(C)]
1575pub struct WireFrameworkRef {}
1576
1577unsafe impl ::fidl_next::ZeroPadding for WireFrameworkRef {
1578 #[inline]
1579 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1580}
1581
1582unsafe impl<___D> ::fidl_next::Decode<___D> for WireFrameworkRef
1583where
1584 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1585{
1586 fn decode(
1587 slot: ::fidl_next::Slot<'_, Self>,
1588 decoder: &mut ___D,
1589 ) -> Result<(), ::fidl_next::DecodeError> {
1590 ::fidl_next::munge! {
1591 let Self {
1592
1593 } = slot;
1594 }
1595
1596 Ok(())
1597 }
1598}
1599
1600#[doc = " A reference to a capability declared in this component.\n"]
1601#[derive(Clone, Debug)]
1602pub struct CapabilityRef {
1603 pub name: String,
1604}
1605
1606impl ::fidl_next::Encodable for CapabilityRef {
1607 type Encoded = WireCapabilityRef;
1608}
1609
1610unsafe impl<___E> ::fidl_next::Encode<___E> for CapabilityRef
1611where
1612 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1613
1614 ___E: ::fidl_next::Encoder,
1615{
1616 #[inline]
1617 fn encode(
1618 self,
1619 encoder: &mut ___E,
1620 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1621 ) -> Result<(), ::fidl_next::EncodeError> {
1622 ::fidl_next::munge! {
1623 let Self::Encoded {
1624 name,
1625
1626 } = out;
1627 }
1628
1629 ::fidl_next::Encode::encode(self.name, encoder, name)?;
1630
1631 Ok(())
1632 }
1633}
1634
1635unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CapabilityRef
1636where
1637 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1638
1639 ___E: ::fidl_next::Encoder,
1640{
1641 #[inline]
1642 fn encode_ref(
1643 &self,
1644 encoder: &mut ___E,
1645 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1646 ) -> Result<(), ::fidl_next::EncodeError> {
1647 ::fidl_next::munge! {
1648 let Self::Encoded {
1649 name,
1650
1651 } = out;
1652 }
1653
1654 ::fidl_next::EncodeRef::encode_ref(&self.name, encoder, name)?;
1655
1656 Ok(())
1657 }
1658}
1659
1660impl ::fidl_next::EncodableOption for Box<CapabilityRef> {
1661 type EncodedOption = ::fidl_next::WireBox<WireCapabilityRef>;
1662}
1663
1664unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<CapabilityRef>
1665where
1666 ___E: ::fidl_next::Encoder + ?Sized,
1667 CapabilityRef: ::fidl_next::Encode<___E>,
1668{
1669 #[inline]
1670 fn encode_option(
1671 this: Option<Self>,
1672 encoder: &mut ___E,
1673 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1674 ) -> Result<(), ::fidl_next::EncodeError> {
1675 if let Some(inner) = this {
1676 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
1677 ::fidl_next::WireBox::encode_present(out);
1678 } else {
1679 ::fidl_next::WireBox::encode_absent(out);
1680 }
1681
1682 Ok(())
1683 }
1684}
1685
1686unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<CapabilityRef>
1687where
1688 ___E: ::fidl_next::Encoder + ?Sized,
1689 CapabilityRef: ::fidl_next::EncodeRef<___E>,
1690{
1691 #[inline]
1692 fn encode_option_ref(
1693 this: Option<&Self>,
1694 encoder: &mut ___E,
1695 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1696 ) -> Result<(), ::fidl_next::EncodeError> {
1697 if let Some(inner) = this {
1698 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1699 ::fidl_next::WireBox::encode_present(out);
1700 } else {
1701 ::fidl_next::WireBox::encode_absent(out);
1702 }
1703
1704 Ok(())
1705 }
1706}
1707
1708impl ::fidl_next::TakeFrom<WireCapabilityRef> for CapabilityRef {
1709 #[inline]
1710 fn take_from(from: &WireCapabilityRef) -> Self {
1711 Self { name: ::fidl_next::TakeFrom::take_from(&from.name) }
1712 }
1713}
1714
1715#[derive(Debug)]
1717#[repr(C)]
1718pub struct WireCapabilityRef {
1719 pub name: ::fidl_next::WireString,
1720}
1721
1722unsafe impl ::fidl_next::ZeroPadding for WireCapabilityRef {
1723 #[inline]
1724 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1725}
1726
1727unsafe impl<___D> ::fidl_next::Decode<___D> for WireCapabilityRef
1728where
1729 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1730
1731 ___D: ::fidl_next::Decoder,
1732{
1733 fn decode(
1734 slot: ::fidl_next::Slot<'_, Self>,
1735 decoder: &mut ___D,
1736 ) -> Result<(), ::fidl_next::DecodeError> {
1737 ::fidl_next::munge! {
1738 let Self {
1739 mut name,
1740
1741 } = slot;
1742 }
1743
1744 ::fidl_next::Decode::decode(name.as_mut(), decoder)?;
1745
1746 let name = unsafe { name.deref_unchecked() };
1747
1748 if name.len() > 100 {
1749 return Err(::fidl_next::DecodeError::VectorTooLong {
1750 size: name.len() as u64,
1751 limit: 100,
1752 });
1753 }
1754
1755 Ok(())
1756 }
1757}
1758
1759#[doc = " A reference to the environment\'s debug capabilities.\n"]
1760#[derive(Clone, Debug)]
1761#[repr(C)]
1762pub struct DebugRef {}
1763
1764impl ::fidl_next::Encodable for DebugRef {
1765 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
1766 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1767
1768 type Encoded = WireDebugRef;
1769}
1770
1771unsafe impl<___E> ::fidl_next::Encode<___E> for DebugRef
1772where
1773 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1774{
1775 #[inline]
1776 fn encode(
1777 self,
1778 encoder: &mut ___E,
1779 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1780 ) -> Result<(), ::fidl_next::EncodeError> {
1781 ::fidl_next::munge! {
1782 let Self::Encoded {
1783
1784 } = out;
1785 }
1786
1787 Ok(())
1788 }
1789}
1790
1791unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DebugRef
1792where
1793 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1794{
1795 #[inline]
1796 fn encode_ref(
1797 &self,
1798 encoder: &mut ___E,
1799 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1800 ) -> Result<(), ::fidl_next::EncodeError> {
1801 ::fidl_next::munge! {
1802 let Self::Encoded {
1803
1804 } = out;
1805 }
1806
1807 Ok(())
1808 }
1809}
1810
1811impl ::fidl_next::EncodableOption for Box<DebugRef> {
1812 type EncodedOption = ::fidl_next::WireBox<WireDebugRef>;
1813}
1814
1815unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<DebugRef>
1816where
1817 ___E: ::fidl_next::Encoder + ?Sized,
1818 DebugRef: ::fidl_next::Encode<___E>,
1819{
1820 #[inline]
1821 fn encode_option(
1822 this: Option<Self>,
1823 encoder: &mut ___E,
1824 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1825 ) -> Result<(), ::fidl_next::EncodeError> {
1826 if let Some(inner) = this {
1827 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
1828 ::fidl_next::WireBox::encode_present(out);
1829 } else {
1830 ::fidl_next::WireBox::encode_absent(out);
1831 }
1832
1833 Ok(())
1834 }
1835}
1836
1837unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<DebugRef>
1838where
1839 ___E: ::fidl_next::Encoder + ?Sized,
1840 DebugRef: ::fidl_next::EncodeRef<___E>,
1841{
1842 #[inline]
1843 fn encode_option_ref(
1844 this: Option<&Self>,
1845 encoder: &mut ___E,
1846 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1847 ) -> Result<(), ::fidl_next::EncodeError> {
1848 if let Some(inner) = this {
1849 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1850 ::fidl_next::WireBox::encode_present(out);
1851 } else {
1852 ::fidl_next::WireBox::encode_absent(out);
1853 }
1854
1855 Ok(())
1856 }
1857}
1858
1859impl ::fidl_next::TakeFrom<WireDebugRef> for DebugRef {
1860 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
1861 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1862
1863 #[inline]
1864 fn take_from(from: &WireDebugRef) -> Self {
1865 Self {}
1866 }
1867}
1868
1869#[derive(Clone, Debug)]
1871#[repr(C)]
1872pub struct WireDebugRef {}
1873
1874unsafe impl ::fidl_next::ZeroPadding for WireDebugRef {
1875 #[inline]
1876 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1877}
1878
1879unsafe impl<___D> ::fidl_next::Decode<___D> for WireDebugRef
1880where
1881 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1882{
1883 fn decode(
1884 slot: ::fidl_next::Slot<'_, Self>,
1885 decoder: &mut ___D,
1886 ) -> Result<(), ::fidl_next::DecodeError> {
1887 ::fidl_next::munge! {
1888 let Self {
1889
1890 } = slot;
1891 }
1892
1893 Ok(())
1894 }
1895}
1896
1897#[doc = " A reference to an intentionally missing offer source.\n"]
1898#[derive(Clone, Debug)]
1899#[repr(C)]
1900pub struct VoidRef {}
1901
1902impl ::fidl_next::Encodable for VoidRef {
1903 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
1904 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
1905
1906 type Encoded = WireVoidRef;
1907}
1908
1909unsafe impl<___E> ::fidl_next::Encode<___E> for VoidRef
1910where
1911 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1912{
1913 #[inline]
1914 fn encode(
1915 self,
1916 encoder: &mut ___E,
1917 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1918 ) -> Result<(), ::fidl_next::EncodeError> {
1919 ::fidl_next::munge! {
1920 let Self::Encoded {
1921
1922 } = out;
1923 }
1924
1925 Ok(())
1926 }
1927}
1928
1929unsafe impl<___E> ::fidl_next::EncodeRef<___E> for VoidRef
1930where
1931 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1932{
1933 #[inline]
1934 fn encode_ref(
1935 &self,
1936 encoder: &mut ___E,
1937 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1938 ) -> Result<(), ::fidl_next::EncodeError> {
1939 ::fidl_next::munge! {
1940 let Self::Encoded {
1941
1942 } = out;
1943 }
1944
1945 Ok(())
1946 }
1947}
1948
1949impl ::fidl_next::EncodableOption for Box<VoidRef> {
1950 type EncodedOption = ::fidl_next::WireBox<WireVoidRef>;
1951}
1952
1953unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<VoidRef>
1954where
1955 ___E: ::fidl_next::Encoder + ?Sized,
1956 VoidRef: ::fidl_next::Encode<___E>,
1957{
1958 #[inline]
1959 fn encode_option(
1960 this: Option<Self>,
1961 encoder: &mut ___E,
1962 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1963 ) -> Result<(), ::fidl_next::EncodeError> {
1964 if let Some(inner) = this {
1965 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
1966 ::fidl_next::WireBox::encode_present(out);
1967 } else {
1968 ::fidl_next::WireBox::encode_absent(out);
1969 }
1970
1971 Ok(())
1972 }
1973}
1974
1975unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<VoidRef>
1976where
1977 ___E: ::fidl_next::Encoder + ?Sized,
1978 VoidRef: ::fidl_next::EncodeRef<___E>,
1979{
1980 #[inline]
1981 fn encode_option_ref(
1982 this: Option<&Self>,
1983 encoder: &mut ___E,
1984 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1985 ) -> Result<(), ::fidl_next::EncodeError> {
1986 if let Some(inner) = this {
1987 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1988 ::fidl_next::WireBox::encode_present(out);
1989 } else {
1990 ::fidl_next::WireBox::encode_absent(out);
1991 }
1992
1993 Ok(())
1994 }
1995}
1996
1997impl ::fidl_next::TakeFrom<WireVoidRef> for VoidRef {
1998 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
1999 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
2000
2001 #[inline]
2002 fn take_from(from: &WireVoidRef) -> Self {
2003 Self {}
2004 }
2005}
2006
2007#[derive(Clone, Debug)]
2009#[repr(C)]
2010pub struct WireVoidRef {}
2011
2012unsafe impl ::fidl_next::ZeroPadding for WireVoidRef {
2013 #[inline]
2014 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
2015}
2016
2017unsafe impl<___D> ::fidl_next::Decode<___D> for WireVoidRef
2018where
2019 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2020{
2021 fn decode(
2022 slot: ::fidl_next::Slot<'_, Self>,
2023 decoder: &mut ___D,
2024 ) -> Result<(), ::fidl_next::DecodeError> {
2025 ::fidl_next::munge! {
2026 let Self {
2027
2028 } = slot;
2029 }
2030
2031 Ok(())
2032 }
2033}
2034
2035#[doc = " Declares which identifier to use to key a component\'s isolated storage\n directory.\n"]
2036#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2037#[repr(u32)]
2038pub enum StorageId {
2039 StaticInstanceId = 1,
2040 StaticInstanceIdOrMoniker = 2,
2041}
2042
2043impl ::fidl_next::Encodable for StorageId {
2044 type Encoded = WireStorageId;
2045}
2046impl ::std::convert::TryFrom<u32> for StorageId {
2047 type Error = ::fidl_next::UnknownStrictEnumMemberError;
2048 fn try_from(value: u32) -> Result<Self, Self::Error> {
2049 match value {
2050 1 => Ok(Self::StaticInstanceId),
2051 2 => Ok(Self::StaticInstanceIdOrMoniker),
2052
2053 _ => Err(Self::Error::new(value.into())),
2054 }
2055 }
2056}
2057
2058unsafe impl<___E> ::fidl_next::Encode<___E> for StorageId
2059where
2060 ___E: ?Sized,
2061{
2062 #[inline]
2063 fn encode(
2064 self,
2065 encoder: &mut ___E,
2066 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2067 ) -> Result<(), ::fidl_next::EncodeError> {
2068 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
2069 }
2070}
2071
2072unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StorageId
2073where
2074 ___E: ?Sized,
2075{
2076 #[inline]
2077 fn encode_ref(
2078 &self,
2079 encoder: &mut ___E,
2080 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2081 ) -> Result<(), ::fidl_next::EncodeError> {
2082 ::fidl_next::munge!(let WireStorageId { value } = out);
2083 let _ = value.write(::fidl_next::WireU32::from(match *self {
2084 Self::StaticInstanceId => 1,
2085
2086 Self::StaticInstanceIdOrMoniker => 2,
2087 }));
2088
2089 Ok(())
2090 }
2091}
2092
2093impl ::core::convert::From<WireStorageId> for StorageId {
2094 fn from(wire: WireStorageId) -> Self {
2095 match u32::from(wire.value) {
2096 1 => Self::StaticInstanceId,
2097
2098 2 => Self::StaticInstanceIdOrMoniker,
2099
2100 _ => unsafe { ::core::hint::unreachable_unchecked() },
2101 }
2102 }
2103}
2104
2105impl ::fidl_next::TakeFrom<WireStorageId> for StorageId {
2106 #[inline]
2107 fn take_from(from: &WireStorageId) -> Self {
2108 Self::from(*from)
2109 }
2110}
2111
2112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2114#[repr(transparent)]
2115pub struct WireStorageId {
2116 value: ::fidl_next::WireU32,
2117}
2118
2119unsafe impl ::fidl_next::ZeroPadding for WireStorageId {
2120 #[inline]
2121 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2122 }
2124}
2125
2126impl WireStorageId {
2127 pub const STATIC_INSTANCE_ID: WireStorageId = WireStorageId { value: ::fidl_next::WireU32(1) };
2128
2129 pub const STATIC_INSTANCE_ID_OR_MONIKER: WireStorageId =
2130 WireStorageId { value: ::fidl_next::WireU32(2) };
2131}
2132
2133unsafe impl<___D> ::fidl_next::Decode<___D> for WireStorageId
2134where
2135 ___D: ?Sized,
2136{
2137 fn decode(
2138 slot: ::fidl_next::Slot<'_, Self>,
2139 _: &mut ___D,
2140 ) -> Result<(), ::fidl_next::DecodeError> {
2141 ::fidl_next::munge!(let Self { value } = slot);
2142
2143 match u32::from(*value) {
2144 1 | 2 => (),
2145 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
2146 }
2147
2148 Ok(())
2149 }
2150}
2151
2152impl ::core::convert::From<StorageId> for WireStorageId {
2153 fn from(natural: StorageId) -> Self {
2154 match natural {
2155 StorageId::StaticInstanceId => WireStorageId::STATIC_INSTANCE_ID,
2156
2157 StorageId::StaticInstanceIdOrMoniker => WireStorageId::STATIC_INSTANCE_ID_OR_MONIKER,
2158 }
2159 }
2160}
2161
2162#[doc = " Declares a runner capability backed by a service.\n"]
2163#[derive(Clone, Debug, Default)]
2164pub struct Runner {
2165 pub name: Option<String>,
2166
2167 pub source_path: Option<String>,
2168}
2169
2170impl Runner {
2171 fn __max_ordinal(&self) -> usize {
2172 if self.name.is_some() {
2173 return 1;
2174 }
2175
2176 if self.source_path.is_some() {
2177 return 2;
2178 }
2179
2180 0
2181 }
2182}
2183
2184impl ::fidl_next::Encodable for Runner {
2185 type Encoded = WireRunner;
2186}
2187
2188unsafe impl<___E> ::fidl_next::Encode<___E> for Runner
2189where
2190 ___E: ::fidl_next::Encoder + ?Sized,
2191{
2192 #[inline]
2193 fn encode(
2194 mut self,
2195 encoder: &mut ___E,
2196 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2197 ) -> Result<(), ::fidl_next::EncodeError> {
2198 ::fidl_next::munge!(let WireRunner { table } = out);
2199
2200 let max_ord = self.__max_ordinal();
2201
2202 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2203 ::fidl_next::ZeroPadding::zero_padding(&mut out);
2204
2205 let mut preallocated =
2206 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2207
2208 for i in 1..=max_ord {
2209 match i {
2210 2 => {
2211 if let Some(source_path) = self.source_path.take() {
2212 ::fidl_next::WireEnvelope::encode_value(
2213 source_path,
2214 preallocated.encoder,
2215 &mut out,
2216 )?;
2217 } else {
2218 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2219 }
2220 }
2221
2222 1 => {
2223 if let Some(name) = self.name.take() {
2224 ::fidl_next::WireEnvelope::encode_value(
2225 name,
2226 preallocated.encoder,
2227 &mut out,
2228 )?;
2229 } else {
2230 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2231 }
2232 }
2233
2234 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2235 }
2236 unsafe {
2237 preallocated.write_next(out.assume_init_ref());
2238 }
2239 }
2240
2241 ::fidl_next::WireTable::encode_len(table, max_ord);
2242
2243 Ok(())
2244 }
2245}
2246
2247unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Runner
2248where
2249 ___E: ::fidl_next::Encoder + ?Sized,
2250{
2251 #[inline]
2252 fn encode_ref(
2253 &self,
2254 encoder: &mut ___E,
2255 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2256 ) -> Result<(), ::fidl_next::EncodeError> {
2257 ::fidl_next::munge!(let WireRunner { table } = out);
2258
2259 let max_ord = self.__max_ordinal();
2260
2261 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2262 ::fidl_next::ZeroPadding::zero_padding(&mut out);
2263
2264 let mut preallocated =
2265 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2266
2267 for i in 1..=max_ord {
2268 match i {
2269 2 => {
2270 if let Some(source_path) = &self.source_path {
2271 ::fidl_next::WireEnvelope::encode_value(
2272 source_path,
2273 preallocated.encoder,
2274 &mut out,
2275 )?;
2276 } else {
2277 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2278 }
2279 }
2280
2281 1 => {
2282 if let Some(name) = &self.name {
2283 ::fidl_next::WireEnvelope::encode_value(
2284 name,
2285 preallocated.encoder,
2286 &mut out,
2287 )?;
2288 } else {
2289 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2290 }
2291 }
2292
2293 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2294 }
2295 unsafe {
2296 preallocated.write_next(out.assume_init_ref());
2297 }
2298 }
2299
2300 ::fidl_next::WireTable::encode_len(table, max_ord);
2301
2302 Ok(())
2303 }
2304}
2305
2306impl ::fidl_next::TakeFrom<WireRunner> for Runner {
2307 #[inline]
2308 fn take_from(from: &WireRunner) -> Self {
2309 Self {
2310 name: from.name().map(::fidl_next::TakeFrom::take_from),
2311
2312 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
2313 }
2314 }
2315}
2316
2317#[repr(C)]
2319pub struct WireRunner {
2320 table: ::fidl_next::WireTable,
2321}
2322
2323unsafe impl ::fidl_next::ZeroPadding for WireRunner {
2324 #[inline]
2325 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2326 ::fidl_next::munge!(let Self { table } = out);
2327 ::fidl_next::WireTable::zero_padding(table);
2328 }
2329}
2330
2331unsafe impl<___D> ::fidl_next::Decode<___D> for WireRunner
2332where
2333 ___D: ::fidl_next::Decoder + ?Sized,
2334{
2335 fn decode(
2336 slot: ::fidl_next::Slot<'_, Self>,
2337 decoder: &mut ___D,
2338 ) -> Result<(), ::fidl_next::DecodeError> {
2339 ::fidl_next::munge!(let Self { table } = slot);
2340
2341 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2342 match ordinal {
2343 0 => unsafe { ::core::hint::unreachable_unchecked() },
2344
2345 1 => {
2346 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
2347 slot.as_mut(),
2348 decoder,
2349 )?;
2350
2351 let name = unsafe {
2352 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
2353 };
2354
2355 if name.len() > 100 {
2356 return Err(::fidl_next::DecodeError::VectorTooLong {
2357 size: name.len() as u64,
2358 limit: 100,
2359 });
2360 }
2361
2362 Ok(())
2363 }
2364
2365 2 => {
2366 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
2367 slot.as_mut(),
2368 decoder,
2369 )?;
2370
2371 let source_path = unsafe {
2372 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
2373 };
2374
2375 if source_path.len() > 1024 {
2376 return Err(::fidl_next::DecodeError::VectorTooLong {
2377 size: source_path.len() as u64,
2378 limit: 1024,
2379 });
2380 }
2381
2382 Ok(())
2383 }
2384
2385 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
2386 }
2387 })
2388 }
2389}
2390
2391impl WireRunner {
2392 pub fn name(&self) -> Option<&::fidl_next::WireString> {
2393 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2394 }
2395
2396 pub fn source_path(&self) -> Option<&::fidl_next::WireString> {
2397 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2398 }
2399}
2400
2401impl ::core::fmt::Debug for WireRunner {
2402 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
2403 f.debug_struct("Runner")
2404 .field("name", &self.name())
2405 .field("source_path", &self.source_path())
2406 .finish()
2407 }
2408}
2409
2410#[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"]
2411#[derive(Clone, Debug, Default)]
2412pub struct Resolver {
2413 pub name: Option<String>,
2414
2415 pub source_path: Option<String>,
2416}
2417
2418impl Resolver {
2419 fn __max_ordinal(&self) -> usize {
2420 if self.name.is_some() {
2421 return 1;
2422 }
2423
2424 if self.source_path.is_some() {
2425 return 2;
2426 }
2427
2428 0
2429 }
2430}
2431
2432impl ::fidl_next::Encodable for Resolver {
2433 type Encoded = WireResolver;
2434}
2435
2436unsafe impl<___E> ::fidl_next::Encode<___E> for Resolver
2437where
2438 ___E: ::fidl_next::Encoder + ?Sized,
2439{
2440 #[inline]
2441 fn encode(
2442 mut self,
2443 encoder: &mut ___E,
2444 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2445 ) -> Result<(), ::fidl_next::EncodeError> {
2446 ::fidl_next::munge!(let WireResolver { table } = out);
2447
2448 let max_ord = self.__max_ordinal();
2449
2450 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2451 ::fidl_next::ZeroPadding::zero_padding(&mut out);
2452
2453 let mut preallocated =
2454 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2455
2456 for i in 1..=max_ord {
2457 match i {
2458 2 => {
2459 if let Some(source_path) = self.source_path.take() {
2460 ::fidl_next::WireEnvelope::encode_value(
2461 source_path,
2462 preallocated.encoder,
2463 &mut out,
2464 )?;
2465 } else {
2466 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2467 }
2468 }
2469
2470 1 => {
2471 if let Some(name) = self.name.take() {
2472 ::fidl_next::WireEnvelope::encode_value(
2473 name,
2474 preallocated.encoder,
2475 &mut out,
2476 )?;
2477 } else {
2478 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2479 }
2480 }
2481
2482 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2483 }
2484 unsafe {
2485 preallocated.write_next(out.assume_init_ref());
2486 }
2487 }
2488
2489 ::fidl_next::WireTable::encode_len(table, max_ord);
2490
2491 Ok(())
2492 }
2493}
2494
2495unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Resolver
2496where
2497 ___E: ::fidl_next::Encoder + ?Sized,
2498{
2499 #[inline]
2500 fn encode_ref(
2501 &self,
2502 encoder: &mut ___E,
2503 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2504 ) -> Result<(), ::fidl_next::EncodeError> {
2505 ::fidl_next::munge!(let WireResolver { table } = out);
2506
2507 let max_ord = self.__max_ordinal();
2508
2509 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2510 ::fidl_next::ZeroPadding::zero_padding(&mut out);
2511
2512 let mut preallocated =
2513 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2514
2515 for i in 1..=max_ord {
2516 match i {
2517 2 => {
2518 if let Some(source_path) = &self.source_path {
2519 ::fidl_next::WireEnvelope::encode_value(
2520 source_path,
2521 preallocated.encoder,
2522 &mut out,
2523 )?;
2524 } else {
2525 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2526 }
2527 }
2528
2529 1 => {
2530 if let Some(name) = &self.name {
2531 ::fidl_next::WireEnvelope::encode_value(
2532 name,
2533 preallocated.encoder,
2534 &mut out,
2535 )?;
2536 } else {
2537 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2538 }
2539 }
2540
2541 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2542 }
2543 unsafe {
2544 preallocated.write_next(out.assume_init_ref());
2545 }
2546 }
2547
2548 ::fidl_next::WireTable::encode_len(table, max_ord);
2549
2550 Ok(())
2551 }
2552}
2553
2554impl ::fidl_next::TakeFrom<WireResolver> for Resolver {
2555 #[inline]
2556 fn take_from(from: &WireResolver) -> Self {
2557 Self {
2558 name: from.name().map(::fidl_next::TakeFrom::take_from),
2559
2560 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
2561 }
2562 }
2563}
2564
2565#[repr(C)]
2567pub struct WireResolver {
2568 table: ::fidl_next::WireTable,
2569}
2570
2571unsafe impl ::fidl_next::ZeroPadding for WireResolver {
2572 #[inline]
2573 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2574 ::fidl_next::munge!(let Self { table } = out);
2575 ::fidl_next::WireTable::zero_padding(table);
2576 }
2577}
2578
2579unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolver
2580where
2581 ___D: ::fidl_next::Decoder + ?Sized,
2582{
2583 fn decode(
2584 slot: ::fidl_next::Slot<'_, Self>,
2585 decoder: &mut ___D,
2586 ) -> Result<(), ::fidl_next::DecodeError> {
2587 ::fidl_next::munge!(let Self { table } = slot);
2588
2589 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2590 match ordinal {
2591 0 => unsafe { ::core::hint::unreachable_unchecked() },
2592
2593 1 => {
2594 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
2595 slot.as_mut(),
2596 decoder,
2597 )?;
2598
2599 let name = unsafe {
2600 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
2601 };
2602
2603 if name.len() > 100 {
2604 return Err(::fidl_next::DecodeError::VectorTooLong {
2605 size: name.len() as u64,
2606 limit: 100,
2607 });
2608 }
2609
2610 Ok(())
2611 }
2612
2613 2 => {
2614 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
2615 slot.as_mut(),
2616 decoder,
2617 )?;
2618
2619 let source_path = unsafe {
2620 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
2621 };
2622
2623 if source_path.len() > 1024 {
2624 return Err(::fidl_next::DecodeError::VectorTooLong {
2625 size: source_path.len() as u64,
2626 limit: 1024,
2627 });
2628 }
2629
2630 Ok(())
2631 }
2632
2633 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
2634 }
2635 })
2636 }
2637}
2638
2639impl WireResolver {
2640 pub fn name(&self) -> Option<&::fidl_next::WireString> {
2641 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2642 }
2643
2644 pub fn source_path(&self) -> Option<&::fidl_next::WireString> {
2645 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2646 }
2647}
2648
2649impl ::core::fmt::Debug for WireResolver {
2650 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
2651 f.debug_struct("Resolver")
2652 .field("name", &self.name())
2653 .field("source_path", &self.source_path())
2654 .finish()
2655 }
2656}
2657
2658#[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"]
2659#[derive(Clone, Debug, Default)]
2660pub struct EventStream {
2661 pub name: Option<String>,
2662}
2663
2664impl EventStream {
2665 fn __max_ordinal(&self) -> usize {
2666 if self.name.is_some() {
2667 return 1;
2668 }
2669
2670 0
2671 }
2672}
2673
2674impl ::fidl_next::Encodable for EventStream {
2675 type Encoded = WireEventStream;
2676}
2677
2678unsafe impl<___E> ::fidl_next::Encode<___E> for EventStream
2679where
2680 ___E: ::fidl_next::Encoder + ?Sized,
2681{
2682 #[inline]
2683 fn encode(
2684 mut self,
2685 encoder: &mut ___E,
2686 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2687 ) -> Result<(), ::fidl_next::EncodeError> {
2688 ::fidl_next::munge!(let WireEventStream { table } = out);
2689
2690 let max_ord = self.__max_ordinal();
2691
2692 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2693 ::fidl_next::ZeroPadding::zero_padding(&mut out);
2694
2695 let mut preallocated =
2696 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2697
2698 for i in 1..=max_ord {
2699 match i {
2700 1 => {
2701 if let Some(name) = self.name.take() {
2702 ::fidl_next::WireEnvelope::encode_value(
2703 name,
2704 preallocated.encoder,
2705 &mut out,
2706 )?;
2707 } else {
2708 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2709 }
2710 }
2711
2712 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2713 }
2714 unsafe {
2715 preallocated.write_next(out.assume_init_ref());
2716 }
2717 }
2718
2719 ::fidl_next::WireTable::encode_len(table, max_ord);
2720
2721 Ok(())
2722 }
2723}
2724
2725unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EventStream
2726where
2727 ___E: ::fidl_next::Encoder + ?Sized,
2728{
2729 #[inline]
2730 fn encode_ref(
2731 &self,
2732 encoder: &mut ___E,
2733 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2734 ) -> Result<(), ::fidl_next::EncodeError> {
2735 ::fidl_next::munge!(let WireEventStream { table } = out);
2736
2737 let max_ord = self.__max_ordinal();
2738
2739 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
2740 ::fidl_next::ZeroPadding::zero_padding(&mut out);
2741
2742 let mut preallocated =
2743 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
2744
2745 for i in 1..=max_ord {
2746 match i {
2747 1 => {
2748 if let Some(name) = &self.name {
2749 ::fidl_next::WireEnvelope::encode_value(
2750 name,
2751 preallocated.encoder,
2752 &mut out,
2753 )?;
2754 } else {
2755 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2756 }
2757 }
2758
2759 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2760 }
2761 unsafe {
2762 preallocated.write_next(out.assume_init_ref());
2763 }
2764 }
2765
2766 ::fidl_next::WireTable::encode_len(table, max_ord);
2767
2768 Ok(())
2769 }
2770}
2771
2772impl ::fidl_next::TakeFrom<WireEventStream> for EventStream {
2773 #[inline]
2774 fn take_from(from: &WireEventStream) -> Self {
2775 Self { name: from.name().map(::fidl_next::TakeFrom::take_from) }
2776 }
2777}
2778
2779#[repr(C)]
2781pub struct WireEventStream {
2782 table: ::fidl_next::WireTable,
2783}
2784
2785unsafe impl ::fidl_next::ZeroPadding for WireEventStream {
2786 #[inline]
2787 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2788 ::fidl_next::munge!(let Self { table } = out);
2789 ::fidl_next::WireTable::zero_padding(table);
2790 }
2791}
2792
2793unsafe impl<___D> ::fidl_next::Decode<___D> for WireEventStream
2794where
2795 ___D: ::fidl_next::Decoder + ?Sized,
2796{
2797 fn decode(
2798 slot: ::fidl_next::Slot<'_, Self>,
2799 decoder: &mut ___D,
2800 ) -> Result<(), ::fidl_next::DecodeError> {
2801 ::fidl_next::munge!(let Self { table } = slot);
2802
2803 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2804 match ordinal {
2805 0 => unsafe { ::core::hint::unreachable_unchecked() },
2806
2807 1 => {
2808 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
2809 slot.as_mut(),
2810 decoder,
2811 )?;
2812
2813 let name = unsafe {
2814 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
2815 };
2816
2817 if name.len() > 100 {
2818 return Err(::fidl_next::DecodeError::VectorTooLong {
2819 size: name.len() as u64,
2820 limit: 100,
2821 });
2822 }
2823
2824 Ok(())
2825 }
2826
2827 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
2828 }
2829 })
2830 }
2831}
2832
2833impl WireEventStream {
2834 pub fn name(&self) -> Option<&::fidl_next::WireString> {
2835 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2836 }
2837}
2838
2839impl ::core::fmt::Debug for WireEventStream {
2840 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
2841 f.debug_struct("EventStream").field("name", &self.name()).finish()
2842 }
2843}
2844
2845#[doc = " A single configuration value.\n"]
2846#[derive(Clone, Debug)]
2847pub enum ConfigSingleValue {
2848 Bool(bool),
2849
2850 Uint8(u8),
2851
2852 Uint16(u16),
2853
2854 Uint32(u32),
2855
2856 Uint64(u64),
2857
2858 Int8(i8),
2859
2860 Int16(i16),
2861
2862 Int32(i32),
2863
2864 Int64(i64),
2865
2866 String(String),
2867
2868 UnknownOrdinal_(u64),
2869}
2870
2871impl ::fidl_next::Encodable for ConfigSingleValue {
2872 type Encoded = WireConfigSingleValue;
2873}
2874
2875unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigSingleValue
2876where
2877 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2878
2879 ___E: ::fidl_next::Encoder,
2880{
2881 #[inline]
2882 fn encode(
2883 self,
2884 encoder: &mut ___E,
2885 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2886 ) -> Result<(), ::fidl_next::EncodeError> {
2887 ::fidl_next::munge!(let WireConfigSingleValue { raw } = out);
2888
2889 match self {
2890 Self::Bool(value) => {
2891 ::fidl_next::RawWireUnion::encode_as::<___E, bool>(value, 1, encoder, raw)?
2892 }
2893
2894 Self::Uint8(value) => {
2895 ::fidl_next::RawWireUnion::encode_as::<___E, u8>(value, 2, encoder, raw)?
2896 }
2897
2898 Self::Uint16(value) => {
2899 ::fidl_next::RawWireUnion::encode_as::<___E, u16>(value, 3, encoder, raw)?
2900 }
2901
2902 Self::Uint32(value) => {
2903 ::fidl_next::RawWireUnion::encode_as::<___E, u32>(value, 4, encoder, raw)?
2904 }
2905
2906 Self::Uint64(value) => {
2907 ::fidl_next::RawWireUnion::encode_as::<___E, u64>(value, 5, encoder, raw)?
2908 }
2909
2910 Self::Int8(value) => {
2911 ::fidl_next::RawWireUnion::encode_as::<___E, i8>(value, 6, encoder, raw)?
2912 }
2913
2914 Self::Int16(value) => {
2915 ::fidl_next::RawWireUnion::encode_as::<___E, i16>(value, 7, encoder, raw)?
2916 }
2917
2918 Self::Int32(value) => {
2919 ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 8, encoder, raw)?
2920 }
2921
2922 Self::Int64(value) => {
2923 ::fidl_next::RawWireUnion::encode_as::<___E, i64>(value, 9, encoder, raw)?
2924 }
2925
2926 Self::String(value) => {
2927 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 10, encoder, raw)?
2928 }
2929
2930 Self::UnknownOrdinal_(ordinal) => {
2931 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
2932 }
2933 }
2934
2935 Ok(())
2936 }
2937}
2938
2939unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigSingleValue
2940where
2941 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2942
2943 ___E: ::fidl_next::Encoder,
2944{
2945 #[inline]
2946 fn encode_ref(
2947 &self,
2948 encoder: &mut ___E,
2949 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2950 ) -> Result<(), ::fidl_next::EncodeError> {
2951 ::fidl_next::munge!(let WireConfigSingleValue { raw } = out);
2952
2953 match self {
2954 Self::Bool(value) => {
2955 ::fidl_next::RawWireUnion::encode_as::<___E, &bool>(value, 1, encoder, raw)?
2956 }
2957
2958 Self::Uint8(value) => {
2959 ::fidl_next::RawWireUnion::encode_as::<___E, &u8>(value, 2, encoder, raw)?
2960 }
2961
2962 Self::Uint16(value) => {
2963 ::fidl_next::RawWireUnion::encode_as::<___E, &u16>(value, 3, encoder, raw)?
2964 }
2965
2966 Self::Uint32(value) => {
2967 ::fidl_next::RawWireUnion::encode_as::<___E, &u32>(value, 4, encoder, raw)?
2968 }
2969
2970 Self::Uint64(value) => {
2971 ::fidl_next::RawWireUnion::encode_as::<___E, &u64>(value, 5, encoder, raw)?
2972 }
2973
2974 Self::Int8(value) => {
2975 ::fidl_next::RawWireUnion::encode_as::<___E, &i8>(value, 6, encoder, raw)?
2976 }
2977
2978 Self::Int16(value) => {
2979 ::fidl_next::RawWireUnion::encode_as::<___E, &i16>(value, 7, encoder, raw)?
2980 }
2981
2982 Self::Int32(value) => {
2983 ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 8, encoder, raw)?
2984 }
2985
2986 Self::Int64(value) => {
2987 ::fidl_next::RawWireUnion::encode_as::<___E, &i64>(value, 9, encoder, raw)?
2988 }
2989
2990 Self::String(value) => {
2991 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 10, encoder, raw)?
2992 }
2993
2994 Self::UnknownOrdinal_(ordinal) => {
2995 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
2996 }
2997 }
2998
2999 Ok(())
3000 }
3001}
3002
3003impl ::fidl_next::EncodableOption for Box<ConfigSingleValue> {
3004 type EncodedOption = WireOptionalConfigSingleValue;
3005}
3006
3007unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ConfigSingleValue>
3008where
3009 ___E: ?Sized,
3010 ConfigSingleValue: ::fidl_next::Encode<___E>,
3011{
3012 #[inline]
3013 fn encode_option(
3014 this: Option<Self>,
3015 encoder: &mut ___E,
3016 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
3017 ) -> Result<(), ::fidl_next::EncodeError> {
3018 ::fidl_next::munge!(let WireOptionalConfigSingleValue { raw } = &mut *out);
3019
3020 if let Some(inner) = this {
3021 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
3022 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
3023 } else {
3024 ::fidl_next::RawWireUnion::encode_absent(raw);
3025 }
3026
3027 Ok(())
3028 }
3029}
3030
3031unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ConfigSingleValue>
3032where
3033 ___E: ?Sized,
3034 ConfigSingleValue: ::fidl_next::EncodeRef<___E>,
3035{
3036 #[inline]
3037 fn encode_option_ref(
3038 this: Option<&Self>,
3039 encoder: &mut ___E,
3040 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
3041 ) -> Result<(), ::fidl_next::EncodeError> {
3042 ::fidl_next::munge!(let WireOptionalConfigSingleValue { raw } = &mut *out);
3043
3044 if let Some(inner) = this {
3045 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
3046 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
3047 } else {
3048 ::fidl_next::RawWireUnion::encode_absent(raw);
3049 }
3050
3051 Ok(())
3052 }
3053}
3054
3055impl ::fidl_next::TakeFrom<WireConfigSingleValue> for ConfigSingleValue {
3056 #[inline]
3057 fn take_from(from: &WireConfigSingleValue) -> Self {
3058 match from.raw.ordinal() {
3059 1 => Self::Bool(::fidl_next::TakeFrom::take_from(unsafe {
3060 from.raw.get().deref_unchecked::<bool>()
3061 })),
3062
3063 2 => Self::Uint8(::fidl_next::TakeFrom::take_from(unsafe {
3064 from.raw.get().deref_unchecked::<u8>()
3065 })),
3066
3067 3 => Self::Uint16(::fidl_next::TakeFrom::take_from(unsafe {
3068 from.raw.get().deref_unchecked::<::fidl_next::WireU16>()
3069 })),
3070
3071 4 => Self::Uint32(::fidl_next::TakeFrom::take_from(unsafe {
3072 from.raw.get().deref_unchecked::<::fidl_next::WireU32>()
3073 })),
3074
3075 5 => Self::Uint64(::fidl_next::TakeFrom::take_from(unsafe {
3076 from.raw.get().deref_unchecked::<::fidl_next::WireU64>()
3077 })),
3078
3079 6 => Self::Int8(::fidl_next::TakeFrom::take_from(unsafe {
3080 from.raw.get().deref_unchecked::<i8>()
3081 })),
3082
3083 7 => Self::Int16(::fidl_next::TakeFrom::take_from(unsafe {
3084 from.raw.get().deref_unchecked::<::fidl_next::WireI16>()
3085 })),
3086
3087 8 => Self::Int32(::fidl_next::TakeFrom::take_from(unsafe {
3088 from.raw.get().deref_unchecked::<::fidl_next::WireI32>()
3089 })),
3090
3091 9 => Self::Int64(::fidl_next::TakeFrom::take_from(unsafe {
3092 from.raw.get().deref_unchecked::<::fidl_next::WireI64>()
3093 })),
3094
3095 10 => Self::String(::fidl_next::TakeFrom::take_from(unsafe {
3096 from.raw.get().deref_unchecked::<::fidl_next::WireString>()
3097 })),
3098
3099 _ => unsafe { ::core::hint::unreachable_unchecked() },
3100 }
3101 }
3102}
3103
3104impl ::fidl_next::TakeFrom<WireOptionalConfigSingleValue> for Option<Box<ConfigSingleValue>> {
3105 #[inline]
3106 fn take_from(from: &WireOptionalConfigSingleValue) -> Self {
3107 if let Some(inner) = from.as_ref() {
3108 Some(::fidl_next::TakeFrom::take_from(inner))
3109 } else {
3110 None
3111 }
3112 }
3113}
3114
3115#[repr(transparent)]
3117pub struct WireConfigSingleValue {
3118 raw: ::fidl_next::RawWireUnion,
3119}
3120
3121unsafe impl ::fidl_next::ZeroPadding for WireConfigSingleValue {
3122 #[inline]
3123 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3124 ::fidl_next::munge!(let Self { raw } = out);
3125 ::fidl_next::RawWireUnion::zero_padding(raw);
3126 }
3127}
3128
3129pub mod config_single_value {
3130 pub enum Ref<'union> {
3131 Bool(&'union bool),
3132
3133 Uint8(&'union u8),
3134
3135 Uint16(&'union ::fidl_next::WireU16),
3136
3137 Uint32(&'union ::fidl_next::WireU32),
3138
3139 Uint64(&'union ::fidl_next::WireU64),
3140
3141 Int8(&'union i8),
3142
3143 Int16(&'union ::fidl_next::WireI16),
3144
3145 Int32(&'union ::fidl_next::WireI32),
3146
3147 Int64(&'union ::fidl_next::WireI64),
3148
3149 String(&'union ::fidl_next::WireString),
3150
3151 UnknownOrdinal_(u64),
3152 }
3153}
3154
3155impl WireConfigSingleValue {
3156 pub fn as_ref(&self) -> crate::config_single_value::Ref<'_> {
3157 match self.raw.ordinal() {
3158 1 => crate::config_single_value::Ref::Bool(unsafe {
3159 self.raw.get().deref_unchecked::<bool>()
3160 }),
3161
3162 2 => crate::config_single_value::Ref::Uint8(unsafe {
3163 self.raw.get().deref_unchecked::<u8>()
3164 }),
3165
3166 3 => crate::config_single_value::Ref::Uint16(unsafe {
3167 self.raw.get().deref_unchecked::<::fidl_next::WireU16>()
3168 }),
3169
3170 4 => crate::config_single_value::Ref::Uint32(unsafe {
3171 self.raw.get().deref_unchecked::<::fidl_next::WireU32>()
3172 }),
3173
3174 5 => crate::config_single_value::Ref::Uint64(unsafe {
3175 self.raw.get().deref_unchecked::<::fidl_next::WireU64>()
3176 }),
3177
3178 6 => crate::config_single_value::Ref::Int8(unsafe {
3179 self.raw.get().deref_unchecked::<i8>()
3180 }),
3181
3182 7 => crate::config_single_value::Ref::Int16(unsafe {
3183 self.raw.get().deref_unchecked::<::fidl_next::WireI16>()
3184 }),
3185
3186 8 => crate::config_single_value::Ref::Int32(unsafe {
3187 self.raw.get().deref_unchecked::<::fidl_next::WireI32>()
3188 }),
3189
3190 9 => crate::config_single_value::Ref::Int64(unsafe {
3191 self.raw.get().deref_unchecked::<::fidl_next::WireI64>()
3192 }),
3193
3194 10 => crate::config_single_value::Ref::String(unsafe {
3195 self.raw.get().deref_unchecked::<::fidl_next::WireString>()
3196 }),
3197
3198 unknown => crate::config_single_value::Ref::UnknownOrdinal_(unknown),
3199 }
3200 }
3201}
3202
3203unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigSingleValue
3204where
3205 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3206
3207 ___D: ::fidl_next::Decoder,
3208{
3209 fn decode(
3210 mut slot: ::fidl_next::Slot<'_, Self>,
3211 decoder: &mut ___D,
3212 ) -> Result<(), ::fidl_next::DecodeError> {
3213 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
3214 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
3215 1 => ::fidl_next::RawWireUnion::decode_as::<___D, bool>(raw, decoder)?,
3216
3217 2 => ::fidl_next::RawWireUnion::decode_as::<___D, u8>(raw, decoder)?,
3218
3219 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU16>(raw, decoder)?,
3220
3221 4 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(raw, decoder)?,
3222
3223 5 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU64>(raw, decoder)?,
3224
3225 6 => ::fidl_next::RawWireUnion::decode_as::<___D, i8>(raw, decoder)?,
3226
3227 7 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI16>(raw, decoder)?,
3228
3229 8 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?,
3230
3231 9 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI64>(raw, decoder)?,
3232
3233 10 => {
3234 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString>(raw, decoder)?
3235 }
3236
3237 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
3238 }
3239
3240 Ok(())
3241 }
3242}
3243
3244impl ::core::fmt::Debug for WireConfigSingleValue {
3245 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3246 match self.raw.ordinal() {
3247 1 => unsafe { self.raw.get().deref_unchecked::<bool>().fmt(f) },
3248 2 => unsafe { self.raw.get().deref_unchecked::<u8>().fmt(f) },
3249 3 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU16>().fmt(f) },
3250 4 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) },
3251 5 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU64>().fmt(f) },
3252 6 => unsafe { self.raw.get().deref_unchecked::<i8>().fmt(f) },
3253 7 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI16>().fmt(f) },
3254 8 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI32>().fmt(f) },
3255 9 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI64>().fmt(f) },
3256 10 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString>().fmt(f) },
3257 _ => unsafe { ::core::hint::unreachable_unchecked() },
3258 }
3259 }
3260}
3261
3262#[repr(transparent)]
3263pub struct WireOptionalConfigSingleValue {
3264 raw: ::fidl_next::RawWireUnion,
3265}
3266
3267unsafe impl ::fidl_next::ZeroPadding for WireOptionalConfigSingleValue {
3268 #[inline]
3269 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3270 ::fidl_next::munge!(let Self { raw } = out);
3271 ::fidl_next::RawWireUnion::zero_padding(raw);
3272 }
3273}
3274
3275impl WireOptionalConfigSingleValue {
3276 pub fn is_some(&self) -> bool {
3277 self.raw.is_some()
3278 }
3279
3280 pub fn is_none(&self) -> bool {
3281 self.raw.is_none()
3282 }
3283
3284 pub fn as_ref(&self) -> Option<&WireConfigSingleValue> {
3285 if self.is_some() {
3286 Some(unsafe { &*(self as *const Self).cast() })
3287 } else {
3288 None
3289 }
3290 }
3291}
3292
3293unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigSingleValue
3294where
3295 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3296
3297 ___D: ::fidl_next::Decoder,
3298{
3299 fn decode(
3300 mut slot: ::fidl_next::Slot<'_, Self>,
3301 decoder: &mut ___D,
3302 ) -> Result<(), ::fidl_next::DecodeError> {
3303 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
3304 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
3305 1 => ::fidl_next::RawWireUnion::decode_as::<___D, bool>(raw, decoder)?,
3306
3307 2 => ::fidl_next::RawWireUnion::decode_as::<___D, u8>(raw, decoder)?,
3308
3309 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU16>(raw, decoder)?,
3310
3311 4 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(raw, decoder)?,
3312
3313 5 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU64>(raw, decoder)?,
3314
3315 6 => ::fidl_next::RawWireUnion::decode_as::<___D, i8>(raw, decoder)?,
3316
3317 7 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI16>(raw, decoder)?,
3318
3319 8 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?,
3320
3321 9 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI64>(raw, decoder)?,
3322
3323 10 => {
3324 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString>(raw, decoder)?
3325 }
3326
3327 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
3328 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
3329 }
3330
3331 Ok(())
3332 }
3333}
3334
3335impl ::core::fmt::Debug for WireOptionalConfigSingleValue {
3336 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3337 self.as_ref().fmt(f)
3338 }
3339}
3340
3341#[doc = " A vector configuration value.\n"]
3342#[derive(Clone, Debug)]
3343pub enum ConfigVectorValue {
3344 BoolVector(Vec<bool>),
3345
3346 Uint8Vector(Vec<u8>),
3347
3348 Uint16Vector(Vec<u16>),
3349
3350 Uint32Vector(Vec<u32>),
3351
3352 Uint64Vector(Vec<u64>),
3353
3354 Int8Vector(Vec<i8>),
3355
3356 Int16Vector(Vec<i16>),
3357
3358 Int32Vector(Vec<i32>),
3359
3360 Int64Vector(Vec<i64>),
3361
3362 StringVector(Vec<String>),
3363
3364 UnknownOrdinal_(u64),
3365}
3366
3367impl ::fidl_next::Encodable for ConfigVectorValue {
3368 type Encoded = WireConfigVectorValue;
3369}
3370
3371unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigVectorValue
3372where
3373 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3374
3375 ___E: ::fidl_next::Encoder,
3376{
3377 #[inline]
3378 fn encode(
3379 self,
3380 encoder: &mut ___E,
3381 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3382 ) -> Result<(), ::fidl_next::EncodeError> {
3383 ::fidl_next::munge!(let WireConfigVectorValue { raw } = out);
3384
3385 match self {
3386 Self::BoolVector(value) => {
3387 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<bool>>(value, 1, encoder, raw)?
3388 }
3389
3390 Self::Uint8Vector(value) => {
3391 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u8>>(value, 2, encoder, raw)?
3392 }
3393
3394 Self::Uint16Vector(value) => {
3395 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u16>>(value, 3, encoder, raw)?
3396 }
3397
3398 Self::Uint32Vector(value) => {
3399 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u32>>(value, 4, encoder, raw)?
3400 }
3401
3402 Self::Uint64Vector(value) => {
3403 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<u64>>(value, 5, encoder, raw)?
3404 }
3405
3406 Self::Int8Vector(value) => {
3407 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<i8>>(value, 6, encoder, raw)?
3408 }
3409
3410 Self::Int16Vector(value) => {
3411 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<i16>>(value, 7, encoder, raw)?
3412 }
3413
3414 Self::Int32Vector(value) => {
3415 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<i32>>(value, 8, encoder, raw)?
3416 }
3417
3418 Self::Int64Vector(value) => {
3419 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<i64>>(value, 9, encoder, raw)?
3420 }
3421
3422 Self::StringVector(value) => {
3423 ::fidl_next::RawWireUnion::encode_as::<___E, Vec<String>>(value, 10, encoder, raw)?
3424 }
3425
3426 Self::UnknownOrdinal_(ordinal) => {
3427 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
3428 }
3429 }
3430
3431 Ok(())
3432 }
3433}
3434
3435unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigVectorValue
3436where
3437 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3438
3439 ___E: ::fidl_next::Encoder,
3440{
3441 #[inline]
3442 fn encode_ref(
3443 &self,
3444 encoder: &mut ___E,
3445 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3446 ) -> Result<(), ::fidl_next::EncodeError> {
3447 ::fidl_next::munge!(let WireConfigVectorValue { raw } = out);
3448
3449 match self {
3450 Self::BoolVector(value) => {
3451 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<bool>>(value, 1, encoder, raw)?
3452 }
3453
3454 Self::Uint8Vector(value) => {
3455 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u8>>(value, 2, encoder, raw)?
3456 }
3457
3458 Self::Uint16Vector(value) => {
3459 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u16>>(value, 3, encoder, raw)?
3460 }
3461
3462 Self::Uint32Vector(value) => {
3463 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u32>>(value, 4, encoder, raw)?
3464 }
3465
3466 Self::Uint64Vector(value) => {
3467 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<u64>>(value, 5, encoder, raw)?
3468 }
3469
3470 Self::Int8Vector(value) => {
3471 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<i8>>(value, 6, encoder, raw)?
3472 }
3473
3474 Self::Int16Vector(value) => {
3475 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<i16>>(value, 7, encoder, raw)?
3476 }
3477
3478 Self::Int32Vector(value) => {
3479 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<i32>>(value, 8, encoder, raw)?
3480 }
3481
3482 Self::Int64Vector(value) => {
3483 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<i64>>(value, 9, encoder, raw)?
3484 }
3485
3486 Self::StringVector(value) => {
3487 ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<String>>(value, 10, encoder, raw)?
3488 }
3489
3490 Self::UnknownOrdinal_(ordinal) => {
3491 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
3492 }
3493 }
3494
3495 Ok(())
3496 }
3497}
3498
3499impl ::fidl_next::EncodableOption for Box<ConfigVectorValue> {
3500 type EncodedOption = WireOptionalConfigVectorValue;
3501}
3502
3503unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ConfigVectorValue>
3504where
3505 ___E: ?Sized,
3506 ConfigVectorValue: ::fidl_next::Encode<___E>,
3507{
3508 #[inline]
3509 fn encode_option(
3510 this: Option<Self>,
3511 encoder: &mut ___E,
3512 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
3513 ) -> Result<(), ::fidl_next::EncodeError> {
3514 ::fidl_next::munge!(let WireOptionalConfigVectorValue { raw } = &mut *out);
3515
3516 if let Some(inner) = this {
3517 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
3518 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
3519 } else {
3520 ::fidl_next::RawWireUnion::encode_absent(raw);
3521 }
3522
3523 Ok(())
3524 }
3525}
3526
3527unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ConfigVectorValue>
3528where
3529 ___E: ?Sized,
3530 ConfigVectorValue: ::fidl_next::EncodeRef<___E>,
3531{
3532 #[inline]
3533 fn encode_option_ref(
3534 this: Option<&Self>,
3535 encoder: &mut ___E,
3536 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
3537 ) -> Result<(), ::fidl_next::EncodeError> {
3538 ::fidl_next::munge!(let WireOptionalConfigVectorValue { raw } = &mut *out);
3539
3540 if let Some(inner) = this {
3541 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
3542 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
3543 } else {
3544 ::fidl_next::RawWireUnion::encode_absent(raw);
3545 }
3546
3547 Ok(())
3548 }
3549}
3550
3551impl ::fidl_next::TakeFrom<WireConfigVectorValue> for ConfigVectorValue {
3552 #[inline]
3553 fn take_from(from: &WireConfigVectorValue) -> Self {
3554 match from.raw.ordinal() {
3555 1 => Self::BoolVector(::fidl_next::TakeFrom::take_from(unsafe {
3556 from.raw.get().deref_unchecked::<::fidl_next::WireVector<bool>>()
3557 })),
3558
3559 2 => Self::Uint8Vector(::fidl_next::TakeFrom::take_from(unsafe {
3560 from.raw.get().deref_unchecked::<::fidl_next::WireVector<u8>>()
3561 })),
3562
3563 3 => Self::Uint16Vector(::fidl_next::TakeFrom::take_from(unsafe {
3564 from.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU16>>()
3565 })),
3566
3567 4 => Self::Uint32Vector(::fidl_next::TakeFrom::take_from(unsafe {
3568 from.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU32>>()
3569 })),
3570
3571 5 => Self::Uint64Vector(::fidl_next::TakeFrom::take_from(unsafe {
3572 from.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU64>>()
3573 })),
3574
3575 6 => Self::Int8Vector(::fidl_next::TakeFrom::take_from(unsafe {
3576 from.raw.get().deref_unchecked::<::fidl_next::WireVector<i8>>()
3577 })),
3578
3579 7 => Self::Int16Vector(::fidl_next::TakeFrom::take_from(unsafe {
3580 from.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI16>>()
3581 })),
3582
3583 8 => Self::Int32Vector(::fidl_next::TakeFrom::take_from(unsafe {
3584 from.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI32>>()
3585 })),
3586
3587 9 => Self::Int64Vector(::fidl_next::TakeFrom::take_from(unsafe {
3588 from.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI64>>()
3589 })),
3590
3591 10 => Self::StringVector(::fidl_next::TakeFrom::take_from(unsafe {
3592 from.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireString>>()
3593 })),
3594
3595 _ => unsafe { ::core::hint::unreachable_unchecked() },
3596 }
3597 }
3598}
3599
3600impl ::fidl_next::TakeFrom<WireOptionalConfigVectorValue> for Option<Box<ConfigVectorValue>> {
3601 #[inline]
3602 fn take_from(from: &WireOptionalConfigVectorValue) -> Self {
3603 if let Some(inner) = from.as_ref() {
3604 Some(::fidl_next::TakeFrom::take_from(inner))
3605 } else {
3606 None
3607 }
3608 }
3609}
3610
3611#[repr(transparent)]
3613pub struct WireConfigVectorValue {
3614 raw: ::fidl_next::RawWireUnion,
3615}
3616
3617unsafe impl ::fidl_next::ZeroPadding for WireConfigVectorValue {
3618 #[inline]
3619 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3620 ::fidl_next::munge!(let Self { raw } = out);
3621 ::fidl_next::RawWireUnion::zero_padding(raw);
3622 }
3623}
3624
3625pub mod config_vector_value {
3626 pub enum Ref<'union> {
3627 BoolVector(&'union ::fidl_next::WireVector<bool>),
3628
3629 Uint8Vector(&'union ::fidl_next::WireVector<u8>),
3630
3631 Uint16Vector(&'union ::fidl_next::WireVector<::fidl_next::WireU16>),
3632
3633 Uint32Vector(&'union ::fidl_next::WireVector<::fidl_next::WireU32>),
3634
3635 Uint64Vector(&'union ::fidl_next::WireVector<::fidl_next::WireU64>),
3636
3637 Int8Vector(&'union ::fidl_next::WireVector<i8>),
3638
3639 Int16Vector(&'union ::fidl_next::WireVector<::fidl_next::WireI16>),
3640
3641 Int32Vector(&'union ::fidl_next::WireVector<::fidl_next::WireI32>),
3642
3643 Int64Vector(&'union ::fidl_next::WireVector<::fidl_next::WireI64>),
3644
3645 StringVector(&'union ::fidl_next::WireVector<::fidl_next::WireString>),
3646
3647 UnknownOrdinal_(u64),
3648 }
3649}
3650
3651impl WireConfigVectorValue {
3652 pub fn as_ref(&self) -> crate::config_vector_value::Ref<'_> {
3653 match self.raw.ordinal() {
3654 1 => crate::config_vector_value::Ref::BoolVector(unsafe {
3655 self.raw.get().deref_unchecked::<::fidl_next::WireVector<bool>>()
3656 }),
3657
3658 2 => crate::config_vector_value::Ref::Uint8Vector(unsafe {
3659 self.raw.get().deref_unchecked::<::fidl_next::WireVector<u8>>()
3660 }),
3661
3662 3 => crate::config_vector_value::Ref::Uint16Vector(unsafe {
3663 self.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU16>>()
3664 }),
3665
3666 4 => crate::config_vector_value::Ref::Uint32Vector(unsafe {
3667 self.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU32>>()
3668 }),
3669
3670 5 => crate::config_vector_value::Ref::Uint64Vector(unsafe {
3671 self.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU64>>()
3672 }),
3673
3674 6 => crate::config_vector_value::Ref::Int8Vector(unsafe {
3675 self.raw.get().deref_unchecked::<::fidl_next::WireVector<i8>>()
3676 }),
3677
3678 7 => crate::config_vector_value::Ref::Int16Vector(unsafe {
3679 self.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI16>>()
3680 }),
3681
3682 8 => crate::config_vector_value::Ref::Int32Vector(unsafe {
3683 self.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI32>>()
3684 }),
3685
3686 9 => crate::config_vector_value::Ref::Int64Vector(unsafe {
3687 self.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI64>>()
3688 }),
3689
3690 10 => crate::config_vector_value::Ref::StringVector(unsafe {
3691 self.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireString>>()
3692 }),
3693
3694 unknown => crate::config_vector_value::Ref::UnknownOrdinal_(unknown),
3695 }
3696 }
3697}
3698
3699unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigVectorValue
3700where
3701 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3702
3703 ___D: ::fidl_next::Decoder,
3704{
3705 fn decode(
3706 mut slot: ::fidl_next::Slot<'_, Self>,
3707 decoder: &mut ___D,
3708 ) -> Result<(), ::fidl_next::DecodeError> {
3709 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
3710 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
3711 1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<bool>>(
3712 raw, decoder,
3713 )?,
3714
3715 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<u8>>(
3716 raw, decoder,
3717 )?,
3718
3719 3 => ::fidl_next::RawWireUnion::decode_as::<
3720 ___D,
3721 ::fidl_next::WireVector<::fidl_next::WireU16>,
3722 >(raw, decoder)?,
3723
3724 4 => ::fidl_next::RawWireUnion::decode_as::<
3725 ___D,
3726 ::fidl_next::WireVector<::fidl_next::WireU32>,
3727 >(raw, decoder)?,
3728
3729 5 => ::fidl_next::RawWireUnion::decode_as::<
3730 ___D,
3731 ::fidl_next::WireVector<::fidl_next::WireU64>,
3732 >(raw, decoder)?,
3733
3734 6 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<i8>>(
3735 raw, decoder,
3736 )?,
3737
3738 7 => ::fidl_next::RawWireUnion::decode_as::<
3739 ___D,
3740 ::fidl_next::WireVector<::fidl_next::WireI16>,
3741 >(raw, decoder)?,
3742
3743 8 => ::fidl_next::RawWireUnion::decode_as::<
3744 ___D,
3745 ::fidl_next::WireVector<::fidl_next::WireI32>,
3746 >(raw, decoder)?,
3747
3748 9 => ::fidl_next::RawWireUnion::decode_as::<
3749 ___D,
3750 ::fidl_next::WireVector<::fidl_next::WireI64>,
3751 >(raw, decoder)?,
3752
3753 10 => ::fidl_next::RawWireUnion::decode_as::<
3754 ___D,
3755 ::fidl_next::WireVector<::fidl_next::WireString>,
3756 >(raw, decoder)?,
3757
3758 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
3759 }
3760
3761 Ok(())
3762 }
3763}
3764
3765impl ::core::fmt::Debug for WireConfigVectorValue {
3766 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3767 match self.raw.ordinal() {
3768 1 => unsafe {
3769 self.raw.get().deref_unchecked::<::fidl_next::WireVector<bool>>().fmt(f)
3770 },
3771 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireVector<u8>>().fmt(f) },
3772 3 => unsafe {
3773 self.raw
3774 .get()
3775 .deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU16>>()
3776 .fmt(f)
3777 },
3778 4 => unsafe {
3779 self.raw
3780 .get()
3781 .deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU32>>()
3782 .fmt(f)
3783 },
3784 5 => unsafe {
3785 self.raw
3786 .get()
3787 .deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireU64>>()
3788 .fmt(f)
3789 },
3790 6 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireVector<i8>>().fmt(f) },
3791 7 => unsafe {
3792 self.raw
3793 .get()
3794 .deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI16>>()
3795 .fmt(f)
3796 },
3797 8 => unsafe {
3798 self.raw
3799 .get()
3800 .deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI32>>()
3801 .fmt(f)
3802 },
3803 9 => unsafe {
3804 self.raw
3805 .get()
3806 .deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireI64>>()
3807 .fmt(f)
3808 },
3809 10 => unsafe {
3810 self.raw
3811 .get()
3812 .deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireString>>()
3813 .fmt(f)
3814 },
3815 _ => unsafe { ::core::hint::unreachable_unchecked() },
3816 }
3817 }
3818}
3819
3820#[repr(transparent)]
3821pub struct WireOptionalConfigVectorValue {
3822 raw: ::fidl_next::RawWireUnion,
3823}
3824
3825unsafe impl ::fidl_next::ZeroPadding for WireOptionalConfigVectorValue {
3826 #[inline]
3827 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3828 ::fidl_next::munge!(let Self { raw } = out);
3829 ::fidl_next::RawWireUnion::zero_padding(raw);
3830 }
3831}
3832
3833impl WireOptionalConfigVectorValue {
3834 pub fn is_some(&self) -> bool {
3835 self.raw.is_some()
3836 }
3837
3838 pub fn is_none(&self) -> bool {
3839 self.raw.is_none()
3840 }
3841
3842 pub fn as_ref(&self) -> Option<&WireConfigVectorValue> {
3843 if self.is_some() {
3844 Some(unsafe { &*(self as *const Self).cast() })
3845 } else {
3846 None
3847 }
3848 }
3849}
3850
3851unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigVectorValue
3852where
3853 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3854
3855 ___D: ::fidl_next::Decoder,
3856{
3857 fn decode(
3858 mut slot: ::fidl_next::Slot<'_, Self>,
3859 decoder: &mut ___D,
3860 ) -> Result<(), ::fidl_next::DecodeError> {
3861 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
3862 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
3863 1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<bool>>(
3864 raw, decoder,
3865 )?,
3866
3867 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<u8>>(
3868 raw, decoder,
3869 )?,
3870
3871 3 => ::fidl_next::RawWireUnion::decode_as::<
3872 ___D,
3873 ::fidl_next::WireVector<::fidl_next::WireU16>,
3874 >(raw, decoder)?,
3875
3876 4 => ::fidl_next::RawWireUnion::decode_as::<
3877 ___D,
3878 ::fidl_next::WireVector<::fidl_next::WireU32>,
3879 >(raw, decoder)?,
3880
3881 5 => ::fidl_next::RawWireUnion::decode_as::<
3882 ___D,
3883 ::fidl_next::WireVector<::fidl_next::WireU64>,
3884 >(raw, decoder)?,
3885
3886 6 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireVector<i8>>(
3887 raw, decoder,
3888 )?,
3889
3890 7 => ::fidl_next::RawWireUnion::decode_as::<
3891 ___D,
3892 ::fidl_next::WireVector<::fidl_next::WireI16>,
3893 >(raw, decoder)?,
3894
3895 8 => ::fidl_next::RawWireUnion::decode_as::<
3896 ___D,
3897 ::fidl_next::WireVector<::fidl_next::WireI32>,
3898 >(raw, decoder)?,
3899
3900 9 => ::fidl_next::RawWireUnion::decode_as::<
3901 ___D,
3902 ::fidl_next::WireVector<::fidl_next::WireI64>,
3903 >(raw, decoder)?,
3904
3905 10 => ::fidl_next::RawWireUnion::decode_as::<
3906 ___D,
3907 ::fidl_next::WireVector<::fidl_next::WireString>,
3908 >(raw, decoder)?,
3909
3910 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
3911 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
3912 }
3913
3914 Ok(())
3915 }
3916}
3917
3918impl ::core::fmt::Debug for WireOptionalConfigVectorValue {
3919 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3920 self.as_ref().fmt(f)
3921 }
3922}
3923
3924#[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"]
3925#[derive(Clone, Debug)]
3926pub enum ConfigValue {
3927 Single(crate::ConfigSingleValue),
3928
3929 Vector(crate::ConfigVectorValue),
3930
3931 UnknownOrdinal_(u64),
3932}
3933
3934impl ::fidl_next::Encodable for ConfigValue {
3935 type Encoded = WireConfigValue;
3936}
3937
3938unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigValue
3939where
3940 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3941
3942 ___E: ::fidl_next::Encoder,
3943{
3944 #[inline]
3945 fn encode(
3946 self,
3947 encoder: &mut ___E,
3948 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3949 ) -> Result<(), ::fidl_next::EncodeError> {
3950 ::fidl_next::munge!(let WireConfigValue { raw } = out);
3951
3952 match self {
3953 Self::Single(value) => ::fidl_next::RawWireUnion::encode_as::<
3954 ___E,
3955 crate::ConfigSingleValue,
3956 >(value, 1, encoder, raw)?,
3957
3958 Self::Vector(value) => ::fidl_next::RawWireUnion::encode_as::<
3959 ___E,
3960 crate::ConfigVectorValue,
3961 >(value, 2, encoder, raw)?,
3962
3963 Self::UnknownOrdinal_(ordinal) => {
3964 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
3965 }
3966 }
3967
3968 Ok(())
3969 }
3970}
3971
3972unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigValue
3973where
3974 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3975
3976 ___E: ::fidl_next::Encoder,
3977{
3978 #[inline]
3979 fn encode_ref(
3980 &self,
3981 encoder: &mut ___E,
3982 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
3983 ) -> Result<(), ::fidl_next::EncodeError> {
3984 ::fidl_next::munge!(let WireConfigValue { raw } = out);
3985
3986 match self {
3987 Self::Single(value) => ::fidl_next::RawWireUnion::encode_as::<
3988 ___E,
3989 &crate::ConfigSingleValue,
3990 >(value, 1, encoder, raw)?,
3991
3992 Self::Vector(value) => ::fidl_next::RawWireUnion::encode_as::<
3993 ___E,
3994 &crate::ConfigVectorValue,
3995 >(value, 2, encoder, raw)?,
3996
3997 Self::UnknownOrdinal_(ordinal) => {
3998 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
3999 }
4000 }
4001
4002 Ok(())
4003 }
4004}
4005
4006impl ::fidl_next::EncodableOption for Box<ConfigValue> {
4007 type EncodedOption = WireOptionalConfigValue;
4008}
4009
4010unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ConfigValue>
4011where
4012 ___E: ?Sized,
4013 ConfigValue: ::fidl_next::Encode<___E>,
4014{
4015 #[inline]
4016 fn encode_option(
4017 this: Option<Self>,
4018 encoder: &mut ___E,
4019 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4020 ) -> Result<(), ::fidl_next::EncodeError> {
4021 ::fidl_next::munge!(let WireOptionalConfigValue { raw } = &mut *out);
4022
4023 if let Some(inner) = this {
4024 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
4025 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
4026 } else {
4027 ::fidl_next::RawWireUnion::encode_absent(raw);
4028 }
4029
4030 Ok(())
4031 }
4032}
4033
4034unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ConfigValue>
4035where
4036 ___E: ?Sized,
4037 ConfigValue: ::fidl_next::EncodeRef<___E>,
4038{
4039 #[inline]
4040 fn encode_option_ref(
4041 this: Option<&Self>,
4042 encoder: &mut ___E,
4043 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4044 ) -> Result<(), ::fidl_next::EncodeError> {
4045 ::fidl_next::munge!(let WireOptionalConfigValue { raw } = &mut *out);
4046
4047 if let Some(inner) = this {
4048 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
4049 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
4050 } else {
4051 ::fidl_next::RawWireUnion::encode_absent(raw);
4052 }
4053
4054 Ok(())
4055 }
4056}
4057
4058impl ::fidl_next::TakeFrom<WireConfigValue> for ConfigValue {
4059 #[inline]
4060 fn take_from(from: &WireConfigValue) -> Self {
4061 match from.raw.ordinal() {
4062 1 => Self::Single(::fidl_next::TakeFrom::take_from(unsafe {
4063 from.raw.get().deref_unchecked::<crate::WireConfigSingleValue>()
4064 })),
4065
4066 2 => Self::Vector(::fidl_next::TakeFrom::take_from(unsafe {
4067 from.raw.get().deref_unchecked::<crate::WireConfigVectorValue>()
4068 })),
4069
4070 _ => unsafe { ::core::hint::unreachable_unchecked() },
4071 }
4072 }
4073}
4074
4075impl ::fidl_next::TakeFrom<WireOptionalConfigValue> for Option<Box<ConfigValue>> {
4076 #[inline]
4077 fn take_from(from: &WireOptionalConfigValue) -> Self {
4078 if let Some(inner) = from.as_ref() {
4079 Some(::fidl_next::TakeFrom::take_from(inner))
4080 } else {
4081 None
4082 }
4083 }
4084}
4085
4086#[repr(transparent)]
4088pub struct WireConfigValue {
4089 raw: ::fidl_next::RawWireUnion,
4090}
4091
4092unsafe impl ::fidl_next::ZeroPadding for WireConfigValue {
4093 #[inline]
4094 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4095 ::fidl_next::munge!(let Self { raw } = out);
4096 ::fidl_next::RawWireUnion::zero_padding(raw);
4097 }
4098}
4099
4100pub mod config_value {
4101 pub enum Ref<'union> {
4102 Single(&'union crate::WireConfigSingleValue),
4103
4104 Vector(&'union crate::WireConfigVectorValue),
4105
4106 UnknownOrdinal_(u64),
4107 }
4108}
4109
4110impl WireConfigValue {
4111 pub fn as_ref(&self) -> crate::config_value::Ref<'_> {
4112 match self.raw.ordinal() {
4113 1 => crate::config_value::Ref::Single(unsafe {
4114 self.raw.get().deref_unchecked::<crate::WireConfigSingleValue>()
4115 }),
4116
4117 2 => crate::config_value::Ref::Vector(unsafe {
4118 self.raw.get().deref_unchecked::<crate::WireConfigVectorValue>()
4119 }),
4120
4121 unknown => crate::config_value::Ref::UnknownOrdinal_(unknown),
4122 }
4123 }
4124}
4125
4126unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigValue
4127where
4128 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4129
4130 ___D: ::fidl_next::Decoder,
4131{
4132 fn decode(
4133 mut slot: ::fidl_next::Slot<'_, Self>,
4134 decoder: &mut ___D,
4135 ) -> Result<(), ::fidl_next::DecodeError> {
4136 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
4137 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
4138 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigSingleValue>(
4139 raw, decoder,
4140 )?,
4141
4142 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigVectorValue>(
4143 raw, decoder,
4144 )?,
4145
4146 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
4147 }
4148
4149 Ok(())
4150 }
4151}
4152
4153impl ::core::fmt::Debug for WireConfigValue {
4154 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4155 match self.raw.ordinal() {
4156 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireConfigSingleValue>().fmt(f) },
4157 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireConfigVectorValue>().fmt(f) },
4158 _ => unsafe { ::core::hint::unreachable_unchecked() },
4159 }
4160 }
4161}
4162
4163#[repr(transparent)]
4164pub struct WireOptionalConfigValue {
4165 raw: ::fidl_next::RawWireUnion,
4166}
4167
4168unsafe impl ::fidl_next::ZeroPadding for WireOptionalConfigValue {
4169 #[inline]
4170 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4171 ::fidl_next::munge!(let Self { raw } = out);
4172 ::fidl_next::RawWireUnion::zero_padding(raw);
4173 }
4174}
4175
4176impl WireOptionalConfigValue {
4177 pub fn is_some(&self) -> bool {
4178 self.raw.is_some()
4179 }
4180
4181 pub fn is_none(&self) -> bool {
4182 self.raw.is_none()
4183 }
4184
4185 pub fn as_ref(&self) -> Option<&WireConfigValue> {
4186 if self.is_some() {
4187 Some(unsafe { &*(self as *const Self).cast() })
4188 } else {
4189 None
4190 }
4191 }
4192}
4193
4194unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigValue
4195where
4196 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4197
4198 ___D: ::fidl_next::Decoder,
4199{
4200 fn decode(
4201 mut slot: ::fidl_next::Slot<'_, Self>,
4202 decoder: &mut ___D,
4203 ) -> Result<(), ::fidl_next::DecodeError> {
4204 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
4205 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
4206 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigSingleValue>(
4207 raw, decoder,
4208 )?,
4209
4210 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigVectorValue>(
4211 raw, decoder,
4212 )?,
4213
4214 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
4215 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
4216 }
4217
4218 Ok(())
4219 }
4220}
4221
4222impl ::core::fmt::Debug for WireOptionalConfigValue {
4223 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4224 self.as_ref().fmt(f)
4225 }
4226}
4227
4228#[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"]
4229#[derive(Clone, Debug, Default)]
4230pub struct Configuration {
4231 pub name: Option<String>,
4232
4233 pub value: Option<crate::ConfigValue>,
4234}
4235
4236impl Configuration {
4237 fn __max_ordinal(&self) -> usize {
4238 if self.name.is_some() {
4239 return 1;
4240 }
4241
4242 if self.value.is_some() {
4243 return 2;
4244 }
4245
4246 0
4247 }
4248}
4249
4250impl ::fidl_next::Encodable for Configuration {
4251 type Encoded = WireConfiguration;
4252}
4253
4254unsafe impl<___E> ::fidl_next::Encode<___E> for Configuration
4255where
4256 ___E: ::fidl_next::Encoder + ?Sized,
4257{
4258 #[inline]
4259 fn encode(
4260 mut self,
4261 encoder: &mut ___E,
4262 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4263 ) -> Result<(), ::fidl_next::EncodeError> {
4264 ::fidl_next::munge!(let WireConfiguration { table } = out);
4265
4266 let max_ord = self.__max_ordinal();
4267
4268 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
4269 ::fidl_next::ZeroPadding::zero_padding(&mut out);
4270
4271 let mut preallocated =
4272 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
4273
4274 for i in 1..=max_ord {
4275 match i {
4276 2 => {
4277 if let Some(value) = self.value.take() {
4278 ::fidl_next::WireEnvelope::encode_value(
4279 value,
4280 preallocated.encoder,
4281 &mut out,
4282 )?;
4283 } else {
4284 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4285 }
4286 }
4287
4288 1 => {
4289 if let Some(name) = self.name.take() {
4290 ::fidl_next::WireEnvelope::encode_value(
4291 name,
4292 preallocated.encoder,
4293 &mut out,
4294 )?;
4295 } else {
4296 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4297 }
4298 }
4299
4300 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
4301 }
4302 unsafe {
4303 preallocated.write_next(out.assume_init_ref());
4304 }
4305 }
4306
4307 ::fidl_next::WireTable::encode_len(table, max_ord);
4308
4309 Ok(())
4310 }
4311}
4312
4313unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Configuration
4314where
4315 ___E: ::fidl_next::Encoder + ?Sized,
4316{
4317 #[inline]
4318 fn encode_ref(
4319 &self,
4320 encoder: &mut ___E,
4321 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4322 ) -> Result<(), ::fidl_next::EncodeError> {
4323 ::fidl_next::munge!(let WireConfiguration { table } = out);
4324
4325 let max_ord = self.__max_ordinal();
4326
4327 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
4328 ::fidl_next::ZeroPadding::zero_padding(&mut out);
4329
4330 let mut preallocated =
4331 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
4332
4333 for i in 1..=max_ord {
4334 match i {
4335 2 => {
4336 if let Some(value) = &self.value {
4337 ::fidl_next::WireEnvelope::encode_value(
4338 value,
4339 preallocated.encoder,
4340 &mut out,
4341 )?;
4342 } else {
4343 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4344 }
4345 }
4346
4347 1 => {
4348 if let Some(name) = &self.name {
4349 ::fidl_next::WireEnvelope::encode_value(
4350 name,
4351 preallocated.encoder,
4352 &mut out,
4353 )?;
4354 } else {
4355 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4356 }
4357 }
4358
4359 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
4360 }
4361 unsafe {
4362 preallocated.write_next(out.assume_init_ref());
4363 }
4364 }
4365
4366 ::fidl_next::WireTable::encode_len(table, max_ord);
4367
4368 Ok(())
4369 }
4370}
4371
4372impl ::fidl_next::TakeFrom<WireConfiguration> for Configuration {
4373 #[inline]
4374 fn take_from(from: &WireConfiguration) -> Self {
4375 Self {
4376 name: from.name().map(::fidl_next::TakeFrom::take_from),
4377
4378 value: from.value().map(::fidl_next::TakeFrom::take_from),
4379 }
4380 }
4381}
4382
4383#[repr(C)]
4385pub struct WireConfiguration {
4386 table: ::fidl_next::WireTable,
4387}
4388
4389unsafe impl ::fidl_next::ZeroPadding for WireConfiguration {
4390 #[inline]
4391 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4392 ::fidl_next::munge!(let Self { table } = out);
4393 ::fidl_next::WireTable::zero_padding(table);
4394 }
4395}
4396
4397unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfiguration
4398where
4399 ___D: ::fidl_next::Decoder + ?Sized,
4400{
4401 fn decode(
4402 slot: ::fidl_next::Slot<'_, Self>,
4403 decoder: &mut ___D,
4404 ) -> Result<(), ::fidl_next::DecodeError> {
4405 ::fidl_next::munge!(let Self { table } = slot);
4406
4407 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4408 match ordinal {
4409 0 => unsafe { ::core::hint::unreachable_unchecked() },
4410
4411 1 => {
4412 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
4413 slot.as_mut(),
4414 decoder,
4415 )?;
4416
4417 let name = unsafe {
4418 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
4419 };
4420
4421 if name.len() > 100 {
4422 return Err(::fidl_next::DecodeError::VectorTooLong {
4423 size: name.len() as u64,
4424 limit: 100,
4425 });
4426 }
4427
4428 Ok(())
4429 }
4430
4431 2 => {
4432 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValue>(
4433 slot.as_mut(),
4434 decoder,
4435 )?;
4436
4437 Ok(())
4438 }
4439
4440 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
4441 }
4442 })
4443 }
4444}
4445
4446impl WireConfiguration {
4447 pub fn name(&self) -> Option<&::fidl_next::WireString> {
4448 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4449 }
4450
4451 pub fn value(&self) -> Option<&crate::WireConfigValue> {
4452 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4453 }
4454}
4455
4456impl ::core::fmt::Debug for WireConfiguration {
4457 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
4458 f.debug_struct("Configuration")
4459 .field("name", &self.name())
4460 .field("value", &self.value())
4461 .finish()
4462 }
4463}
4464
4465#[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"]
4466pub type DictionaryPath = String;
4467
4468pub type WireDictionaryPath = ::fidl_next::WireString;
4470
4471#[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"]
4472#[derive(Clone, Copy, Debug, PartialEq, Eq)]
4473#[repr(u32)]
4474pub enum DeliveryType {
4475 Immediate = 0,
4476 OnReadable = 1,
4477 UnknownOrdinal_(u32),
4478}
4479
4480impl ::fidl_next::Encodable for DeliveryType {
4481 type Encoded = WireDeliveryType;
4482}
4483impl ::std::convert::From<u32> for DeliveryType {
4484 fn from(value: u32) -> Self {
4485 match value {
4486 0 => Self::Immediate,
4487 1 => Self::OnReadable,
4488
4489 _ => Self::UnknownOrdinal_(value),
4490 }
4491 }
4492}
4493
4494unsafe impl<___E> ::fidl_next::Encode<___E> for DeliveryType
4495where
4496 ___E: ?Sized,
4497{
4498 #[inline]
4499 fn encode(
4500 self,
4501 encoder: &mut ___E,
4502 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4503 ) -> Result<(), ::fidl_next::EncodeError> {
4504 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
4505 }
4506}
4507
4508unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DeliveryType
4509where
4510 ___E: ?Sized,
4511{
4512 #[inline]
4513 fn encode_ref(
4514 &self,
4515 encoder: &mut ___E,
4516 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4517 ) -> Result<(), ::fidl_next::EncodeError> {
4518 ::fidl_next::munge!(let WireDeliveryType { value } = out);
4519 let _ = value.write(::fidl_next::WireU32::from(match *self {
4520 Self::Immediate => 0,
4521
4522 Self::OnReadable => 1,
4523
4524 Self::UnknownOrdinal_(value) => value,
4525 }));
4526
4527 Ok(())
4528 }
4529}
4530
4531impl ::core::convert::From<WireDeliveryType> for DeliveryType {
4532 fn from(wire: WireDeliveryType) -> Self {
4533 match u32::from(wire.value) {
4534 0 => Self::Immediate,
4535
4536 1 => Self::OnReadable,
4537
4538 value => Self::UnknownOrdinal_(value),
4539 }
4540 }
4541}
4542
4543impl ::fidl_next::TakeFrom<WireDeliveryType> for DeliveryType {
4544 #[inline]
4545 fn take_from(from: &WireDeliveryType) -> Self {
4546 Self::from(*from)
4547 }
4548}
4549
4550#[derive(Clone, Copy, Debug, PartialEq, Eq)]
4552#[repr(transparent)]
4553pub struct WireDeliveryType {
4554 value: ::fidl_next::WireU32,
4555}
4556
4557unsafe impl ::fidl_next::ZeroPadding for WireDeliveryType {
4558 #[inline]
4559 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
4560 }
4562}
4563
4564impl WireDeliveryType {
4565 pub const IMMEDIATE: WireDeliveryType = WireDeliveryType { value: ::fidl_next::WireU32(0) };
4566
4567 pub const ON_READABLE: WireDeliveryType = WireDeliveryType { value: ::fidl_next::WireU32(1) };
4568}
4569
4570unsafe impl<___D> ::fidl_next::Decode<___D> for WireDeliveryType
4571where
4572 ___D: ?Sized,
4573{
4574 fn decode(
4575 slot: ::fidl_next::Slot<'_, Self>,
4576 _: &mut ___D,
4577 ) -> Result<(), ::fidl_next::DecodeError> {
4578 Ok(())
4579 }
4580}
4581
4582impl ::core::convert::From<DeliveryType> for WireDeliveryType {
4583 fn from(natural: DeliveryType) -> Self {
4584 match natural {
4585 DeliveryType::Immediate => WireDeliveryType::IMMEDIATE,
4586
4587 DeliveryType::OnReadable => WireDeliveryType::ON_READABLE,
4588
4589 DeliveryType::UnknownOrdinal_(value) => {
4590 WireDeliveryType { value: ::fidl_next::WireU32::from(value) }
4591 }
4592 }
4593 }
4594}
4595
4596#[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"]
4597#[derive(Clone, Debug, Default)]
4598pub struct Protocol {
4599 pub name: Option<String>,
4600
4601 pub source_path: Option<String>,
4602
4603 pub delivery: Option<crate::DeliveryType>,
4604}
4605
4606impl Protocol {
4607 fn __max_ordinal(&self) -> usize {
4608 if self.name.is_some() {
4609 return 1;
4610 }
4611
4612 if self.source_path.is_some() {
4613 return 2;
4614 }
4615
4616 if self.delivery.is_some() {
4617 return 3;
4618 }
4619
4620 0
4621 }
4622}
4623
4624impl ::fidl_next::Encodable for Protocol {
4625 type Encoded = WireProtocol;
4626}
4627
4628unsafe impl<___E> ::fidl_next::Encode<___E> for Protocol
4629where
4630 ___E: ::fidl_next::Encoder + ?Sized,
4631{
4632 #[inline]
4633 fn encode(
4634 mut self,
4635 encoder: &mut ___E,
4636 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4637 ) -> Result<(), ::fidl_next::EncodeError> {
4638 ::fidl_next::munge!(let WireProtocol { table } = out);
4639
4640 let max_ord = self.__max_ordinal();
4641
4642 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
4643 ::fidl_next::ZeroPadding::zero_padding(&mut out);
4644
4645 let mut preallocated =
4646 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
4647
4648 for i in 1..=max_ord {
4649 match i {
4650 3 => {
4651 if let Some(delivery) = self.delivery.take() {
4652 ::fidl_next::WireEnvelope::encode_value(
4653 delivery,
4654 preallocated.encoder,
4655 &mut out,
4656 )?;
4657 } else {
4658 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4659 }
4660 }
4661
4662 2 => {
4663 if let Some(source_path) = self.source_path.take() {
4664 ::fidl_next::WireEnvelope::encode_value(
4665 source_path,
4666 preallocated.encoder,
4667 &mut out,
4668 )?;
4669 } else {
4670 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4671 }
4672 }
4673
4674 1 => {
4675 if let Some(name) = self.name.take() {
4676 ::fidl_next::WireEnvelope::encode_value(
4677 name,
4678 preallocated.encoder,
4679 &mut out,
4680 )?;
4681 } else {
4682 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4683 }
4684 }
4685
4686 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
4687 }
4688 unsafe {
4689 preallocated.write_next(out.assume_init_ref());
4690 }
4691 }
4692
4693 ::fidl_next::WireTable::encode_len(table, max_ord);
4694
4695 Ok(())
4696 }
4697}
4698
4699unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Protocol
4700where
4701 ___E: ::fidl_next::Encoder + ?Sized,
4702{
4703 #[inline]
4704 fn encode_ref(
4705 &self,
4706 encoder: &mut ___E,
4707 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4708 ) -> Result<(), ::fidl_next::EncodeError> {
4709 ::fidl_next::munge!(let WireProtocol { table } = out);
4710
4711 let max_ord = self.__max_ordinal();
4712
4713 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
4714 ::fidl_next::ZeroPadding::zero_padding(&mut out);
4715
4716 let mut preallocated =
4717 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
4718
4719 for i in 1..=max_ord {
4720 match i {
4721 3 => {
4722 if let Some(delivery) = &self.delivery {
4723 ::fidl_next::WireEnvelope::encode_value(
4724 delivery,
4725 preallocated.encoder,
4726 &mut out,
4727 )?;
4728 } else {
4729 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4730 }
4731 }
4732
4733 2 => {
4734 if let Some(source_path) = &self.source_path {
4735 ::fidl_next::WireEnvelope::encode_value(
4736 source_path,
4737 preallocated.encoder,
4738 &mut out,
4739 )?;
4740 } else {
4741 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4742 }
4743 }
4744
4745 1 => {
4746 if let Some(name) = &self.name {
4747 ::fidl_next::WireEnvelope::encode_value(
4748 name,
4749 preallocated.encoder,
4750 &mut out,
4751 )?;
4752 } else {
4753 ::fidl_next::WireEnvelope::encode_zero(&mut out)
4754 }
4755 }
4756
4757 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
4758 }
4759 unsafe {
4760 preallocated.write_next(out.assume_init_ref());
4761 }
4762 }
4763
4764 ::fidl_next::WireTable::encode_len(table, max_ord);
4765
4766 Ok(())
4767 }
4768}
4769
4770impl ::fidl_next::TakeFrom<WireProtocol> for Protocol {
4771 #[inline]
4772 fn take_from(from: &WireProtocol) -> Self {
4773 Self {
4774 name: from.name().map(::fidl_next::TakeFrom::take_from),
4775
4776 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
4777
4778 delivery: from.delivery().map(::fidl_next::TakeFrom::take_from),
4779 }
4780 }
4781}
4782
4783#[repr(C)]
4785pub struct WireProtocol {
4786 table: ::fidl_next::WireTable,
4787}
4788
4789unsafe impl ::fidl_next::ZeroPadding for WireProtocol {
4790 #[inline]
4791 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4792 ::fidl_next::munge!(let Self { table } = out);
4793 ::fidl_next::WireTable::zero_padding(table);
4794 }
4795}
4796
4797unsafe impl<___D> ::fidl_next::Decode<___D> for WireProtocol
4798where
4799 ___D: ::fidl_next::Decoder + ?Sized,
4800{
4801 fn decode(
4802 slot: ::fidl_next::Slot<'_, Self>,
4803 decoder: &mut ___D,
4804 ) -> Result<(), ::fidl_next::DecodeError> {
4805 ::fidl_next::munge!(let Self { table } = slot);
4806
4807 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4808 match ordinal {
4809 0 => unsafe { ::core::hint::unreachable_unchecked() },
4810
4811 1 => {
4812 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
4813 slot.as_mut(),
4814 decoder,
4815 )?;
4816
4817 let name = unsafe {
4818 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
4819 };
4820
4821 if name.len() > 100 {
4822 return Err(::fidl_next::DecodeError::VectorTooLong {
4823 size: name.len() as u64,
4824 limit: 100,
4825 });
4826 }
4827
4828 Ok(())
4829 }
4830
4831 2 => {
4832 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
4833 slot.as_mut(),
4834 decoder,
4835 )?;
4836
4837 let source_path = unsafe {
4838 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
4839 };
4840
4841 if source_path.len() > 1024 {
4842 return Err(::fidl_next::DecodeError::VectorTooLong {
4843 size: source_path.len() as u64,
4844 limit: 1024,
4845 });
4846 }
4847
4848 Ok(())
4849 }
4850
4851 3 => {
4852 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDeliveryType>(
4853 slot.as_mut(),
4854 decoder,
4855 )?;
4856
4857 Ok(())
4858 }
4859
4860 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
4861 }
4862 })
4863 }
4864}
4865
4866impl WireProtocol {
4867 pub fn name(&self) -> Option<&::fidl_next::WireString> {
4868 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4869 }
4870
4871 pub fn source_path(&self) -> Option<&::fidl_next::WireString> {
4872 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4873 }
4874
4875 pub fn delivery(&self) -> Option<&crate::WireDeliveryType> {
4876 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
4877 }
4878}
4879
4880impl ::core::fmt::Debug for WireProtocol {
4881 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
4882 f.debug_struct("Protocol")
4883 .field("name", &self.name())
4884 .field("source_path", &self.source_path())
4885 .field("delivery", &self.delivery())
4886 .finish()
4887 }
4888}
4889
4890#[doc = " A reference to the environment.\n"]
4891#[derive(Clone, Debug)]
4892#[repr(C)]
4893pub struct EnvironmentRef {}
4894
4895impl ::fidl_next::Encodable for EnvironmentRef {
4896 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
4897 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
4898
4899 type Encoded = WireEnvironmentRef;
4900}
4901
4902unsafe impl<___E> ::fidl_next::Encode<___E> for EnvironmentRef
4903where
4904 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4905{
4906 #[inline]
4907 fn encode(
4908 self,
4909 encoder: &mut ___E,
4910 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4911 ) -> Result<(), ::fidl_next::EncodeError> {
4912 ::fidl_next::munge! {
4913 let Self::Encoded {
4914
4915 } = out;
4916 }
4917
4918 Ok(())
4919 }
4920}
4921
4922unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EnvironmentRef
4923where
4924 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
4925{
4926 #[inline]
4927 fn encode_ref(
4928 &self,
4929 encoder: &mut ___E,
4930 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
4931 ) -> Result<(), ::fidl_next::EncodeError> {
4932 ::fidl_next::munge! {
4933 let Self::Encoded {
4934
4935 } = out;
4936 }
4937
4938 Ok(())
4939 }
4940}
4941
4942impl ::fidl_next::EncodableOption for Box<EnvironmentRef> {
4943 type EncodedOption = ::fidl_next::WireBox<WireEnvironmentRef>;
4944}
4945
4946unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<EnvironmentRef>
4947where
4948 ___E: ::fidl_next::Encoder + ?Sized,
4949 EnvironmentRef: ::fidl_next::Encode<___E>,
4950{
4951 #[inline]
4952 fn encode_option(
4953 this: Option<Self>,
4954 encoder: &mut ___E,
4955 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4956 ) -> Result<(), ::fidl_next::EncodeError> {
4957 if let Some(inner) = this {
4958 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
4959 ::fidl_next::WireBox::encode_present(out);
4960 } else {
4961 ::fidl_next::WireBox::encode_absent(out);
4962 }
4963
4964 Ok(())
4965 }
4966}
4967
4968unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<EnvironmentRef>
4969where
4970 ___E: ::fidl_next::Encoder + ?Sized,
4971 EnvironmentRef: ::fidl_next::EncodeRef<___E>,
4972{
4973 #[inline]
4974 fn encode_option_ref(
4975 this: Option<&Self>,
4976 encoder: &mut ___E,
4977 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
4978 ) -> Result<(), ::fidl_next::EncodeError> {
4979 if let Some(inner) = this {
4980 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
4981 ::fidl_next::WireBox::encode_present(out);
4982 } else {
4983 ::fidl_next::WireBox::encode_absent(out);
4984 }
4985
4986 Ok(())
4987 }
4988}
4989
4990impl ::fidl_next::TakeFrom<WireEnvironmentRef> for EnvironmentRef {
4991 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> =
4992 unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
4993
4994 #[inline]
4995 fn take_from(from: &WireEnvironmentRef) -> Self {
4996 Self {}
4997 }
4998}
4999
5000#[derive(Clone, Debug)]
5002#[repr(C)]
5003pub struct WireEnvironmentRef {}
5004
5005unsafe impl ::fidl_next::ZeroPadding for WireEnvironmentRef {
5006 #[inline]
5007 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
5008}
5009
5010unsafe impl<___D> ::fidl_next::Decode<___D> for WireEnvironmentRef
5011where
5012 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5013{
5014 fn decode(
5015 slot: ::fidl_next::Slot<'_, Self>,
5016 decoder: &mut ___D,
5017 ) -> Result<(), ::fidl_next::DecodeError> {
5018 ::fidl_next::munge! {
5019 let Self {
5020
5021 } = slot;
5022 }
5023
5024 Ok(())
5025 }
5026}
5027
5028#[doc = " A reference to a capability source or destination relative to this\n component.\n"]
5029#[derive(Clone, Debug)]
5030pub enum Ref {
5031 Parent(crate::ParentRef),
5032
5033 Self_(crate::SelfRef),
5034
5035 Child(crate::ChildRef),
5036
5037 Collection(crate::CollectionRef),
5038
5039 Framework(crate::FrameworkRef),
5040
5041 Capability(crate::CapabilityRef),
5042
5043 Debug(crate::DebugRef),
5044
5045 VoidType(crate::VoidRef),
5046
5047 Environment(crate::EnvironmentRef),
5048
5049 UnknownOrdinal_(u64),
5050}
5051
5052impl ::fidl_next::Encodable for Ref {
5053 type Encoded = WireRef;
5054}
5055
5056unsafe impl<___E> ::fidl_next::Encode<___E> for Ref
5057where
5058 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
5059
5060 ___E: ::fidl_next::Encoder,
5061{
5062 #[inline]
5063 fn encode(
5064 self,
5065 encoder: &mut ___E,
5066 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5067 ) -> Result<(), ::fidl_next::EncodeError> {
5068 ::fidl_next::munge!(let WireRef { raw } = out);
5069
5070 match self {
5071 Self::Parent(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::ParentRef>(
5072 value, 1, encoder, raw,
5073 )?,
5074
5075 Self::Self_(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::SelfRef>(
5076 value, 2, encoder, raw,
5077 )?,
5078
5079 Self::Child(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::ChildRef>(
5080 value, 3, encoder, raw,
5081 )?,
5082
5083 Self::Collection(value) => ::fidl_next::RawWireUnion::encode_as::<
5084 ___E,
5085 crate::CollectionRef,
5086 >(value, 4, encoder, raw)?,
5087
5088 Self::Framework(value) => ::fidl_next::RawWireUnion::encode_as::<
5089 ___E,
5090 crate::FrameworkRef,
5091 >(value, 5, encoder, raw)?,
5092
5093 Self::Capability(value) => ::fidl_next::RawWireUnion::encode_as::<
5094 ___E,
5095 crate::CapabilityRef,
5096 >(value, 6, encoder, raw)?,
5097
5098 Self::Debug(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::DebugRef>(
5099 value, 7, encoder, raw,
5100 )?,
5101
5102 Self::VoidType(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::VoidRef>(
5103 value, 8, encoder, raw,
5104 )?,
5105
5106 Self::Environment(value) => ::fidl_next::RawWireUnion::encode_as::<
5107 ___E,
5108 crate::EnvironmentRef,
5109 >(value, 9, encoder, raw)?,
5110
5111 Self::UnknownOrdinal_(ordinal) => {
5112 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
5113 }
5114 }
5115
5116 Ok(())
5117 }
5118}
5119
5120unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Ref
5121where
5122 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
5123
5124 ___E: ::fidl_next::Encoder,
5125{
5126 #[inline]
5127 fn encode_ref(
5128 &self,
5129 encoder: &mut ___E,
5130 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5131 ) -> Result<(), ::fidl_next::EncodeError> {
5132 ::fidl_next::munge!(let WireRef { raw } = out);
5133
5134 match self {
5135 Self::Parent(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::ParentRef>(
5136 value, 1, encoder, raw,
5137 )?,
5138
5139 Self::Self_(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::SelfRef>(
5140 value, 2, encoder, raw,
5141 )?,
5142
5143 Self::Child(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::ChildRef>(
5144 value, 3, encoder, raw,
5145 )?,
5146
5147 Self::Collection(value) => ::fidl_next::RawWireUnion::encode_as::<
5148 ___E,
5149 &crate::CollectionRef,
5150 >(value, 4, encoder, raw)?,
5151
5152 Self::Framework(value) => ::fidl_next::RawWireUnion::encode_as::<
5153 ___E,
5154 &crate::FrameworkRef,
5155 >(value, 5, encoder, raw)?,
5156
5157 Self::Capability(value) => ::fidl_next::RawWireUnion::encode_as::<
5158 ___E,
5159 &crate::CapabilityRef,
5160 >(value, 6, encoder, raw)?,
5161
5162 Self::Debug(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::DebugRef>(
5163 value, 7, encoder, raw,
5164 )?,
5165
5166 Self::VoidType(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::VoidRef>(
5167 value, 8, encoder, raw,
5168 )?,
5169
5170 Self::Environment(value) => ::fidl_next::RawWireUnion::encode_as::<
5171 ___E,
5172 &crate::EnvironmentRef,
5173 >(value, 9, encoder, raw)?,
5174
5175 Self::UnknownOrdinal_(ordinal) => {
5176 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
5177 }
5178 }
5179
5180 Ok(())
5181 }
5182}
5183
5184impl ::fidl_next::EncodableOption for Box<Ref> {
5185 type EncodedOption = WireOptionalRef;
5186}
5187
5188unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<Ref>
5189where
5190 ___E: ?Sized,
5191 Ref: ::fidl_next::Encode<___E>,
5192{
5193 #[inline]
5194 fn encode_option(
5195 this: Option<Self>,
5196 encoder: &mut ___E,
5197 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
5198 ) -> Result<(), ::fidl_next::EncodeError> {
5199 ::fidl_next::munge!(let WireOptionalRef { raw } = &mut *out);
5200
5201 if let Some(inner) = this {
5202 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
5203 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
5204 } else {
5205 ::fidl_next::RawWireUnion::encode_absent(raw);
5206 }
5207
5208 Ok(())
5209 }
5210}
5211
5212unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<Ref>
5213where
5214 ___E: ?Sized,
5215 Ref: ::fidl_next::EncodeRef<___E>,
5216{
5217 #[inline]
5218 fn encode_option_ref(
5219 this: Option<&Self>,
5220 encoder: &mut ___E,
5221 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
5222 ) -> Result<(), ::fidl_next::EncodeError> {
5223 ::fidl_next::munge!(let WireOptionalRef { raw } = &mut *out);
5224
5225 if let Some(inner) = this {
5226 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
5227 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
5228 } else {
5229 ::fidl_next::RawWireUnion::encode_absent(raw);
5230 }
5231
5232 Ok(())
5233 }
5234}
5235
5236impl ::fidl_next::TakeFrom<WireRef> for Ref {
5237 #[inline]
5238 fn take_from(from: &WireRef) -> Self {
5239 match from.raw.ordinal() {
5240 1 => Self::Parent(::fidl_next::TakeFrom::take_from(unsafe {
5241 from.raw.get().deref_unchecked::<crate::WireParentRef>()
5242 })),
5243
5244 2 => Self::Self_(::fidl_next::TakeFrom::take_from(unsafe {
5245 from.raw.get().deref_unchecked::<crate::WireSelfRef>()
5246 })),
5247
5248 3 => Self::Child(::fidl_next::TakeFrom::take_from(unsafe {
5249 from.raw.get().deref_unchecked::<crate::WireChildRef>()
5250 })),
5251
5252 4 => Self::Collection(::fidl_next::TakeFrom::take_from(unsafe {
5253 from.raw.get().deref_unchecked::<crate::WireCollectionRef>()
5254 })),
5255
5256 5 => Self::Framework(::fidl_next::TakeFrom::take_from(unsafe {
5257 from.raw.get().deref_unchecked::<crate::WireFrameworkRef>()
5258 })),
5259
5260 6 => Self::Capability(::fidl_next::TakeFrom::take_from(unsafe {
5261 from.raw.get().deref_unchecked::<crate::WireCapabilityRef>()
5262 })),
5263
5264 7 => Self::Debug(::fidl_next::TakeFrom::take_from(unsafe {
5265 from.raw.get().deref_unchecked::<crate::WireDebugRef>()
5266 })),
5267
5268 8 => Self::VoidType(::fidl_next::TakeFrom::take_from(unsafe {
5269 from.raw.get().deref_unchecked::<crate::WireVoidRef>()
5270 })),
5271
5272 9 => Self::Environment(::fidl_next::TakeFrom::take_from(unsafe {
5273 from.raw.get().deref_unchecked::<crate::WireEnvironmentRef>()
5274 })),
5275
5276 _ => unsafe { ::core::hint::unreachable_unchecked() },
5277 }
5278 }
5279}
5280
5281impl ::fidl_next::TakeFrom<WireOptionalRef> for Option<Box<Ref>> {
5282 #[inline]
5283 fn take_from(from: &WireOptionalRef) -> Self {
5284 if let Some(inner) = from.as_ref() {
5285 Some(::fidl_next::TakeFrom::take_from(inner))
5286 } else {
5287 None
5288 }
5289 }
5290}
5291
5292#[repr(transparent)]
5294pub struct WireRef {
5295 raw: ::fidl_next::RawWireUnion,
5296}
5297
5298unsafe impl ::fidl_next::ZeroPadding for WireRef {
5299 #[inline]
5300 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5301 ::fidl_next::munge!(let Self { raw } = out);
5302 ::fidl_next::RawWireUnion::zero_padding(raw);
5303 }
5304}
5305
5306pub mod ref_ {
5307 pub enum Ref<'union> {
5308 Parent(&'union crate::WireParentRef),
5309
5310 Self_(&'union crate::WireSelfRef),
5311
5312 Child(&'union crate::WireChildRef),
5313
5314 Collection(&'union crate::WireCollectionRef),
5315
5316 Framework(&'union crate::WireFrameworkRef),
5317
5318 Capability(&'union crate::WireCapabilityRef),
5319
5320 Debug(&'union crate::WireDebugRef),
5321
5322 VoidType(&'union crate::WireVoidRef),
5323
5324 Environment(&'union crate::WireEnvironmentRef),
5325
5326 UnknownOrdinal_(u64),
5327 }
5328}
5329
5330impl WireRef {
5331 pub fn as_ref(&self) -> crate::ref_::Ref<'_> {
5332 match self.raw.ordinal() {
5333 1 => crate::ref_::Ref::Parent(unsafe {
5334 self.raw.get().deref_unchecked::<crate::WireParentRef>()
5335 }),
5336
5337 2 => crate::ref_::Ref::Self_(unsafe {
5338 self.raw.get().deref_unchecked::<crate::WireSelfRef>()
5339 }),
5340
5341 3 => crate::ref_::Ref::Child(unsafe {
5342 self.raw.get().deref_unchecked::<crate::WireChildRef>()
5343 }),
5344
5345 4 => crate::ref_::Ref::Collection(unsafe {
5346 self.raw.get().deref_unchecked::<crate::WireCollectionRef>()
5347 }),
5348
5349 5 => crate::ref_::Ref::Framework(unsafe {
5350 self.raw.get().deref_unchecked::<crate::WireFrameworkRef>()
5351 }),
5352
5353 6 => crate::ref_::Ref::Capability(unsafe {
5354 self.raw.get().deref_unchecked::<crate::WireCapabilityRef>()
5355 }),
5356
5357 7 => crate::ref_::Ref::Debug(unsafe {
5358 self.raw.get().deref_unchecked::<crate::WireDebugRef>()
5359 }),
5360
5361 8 => crate::ref_::Ref::VoidType(unsafe {
5362 self.raw.get().deref_unchecked::<crate::WireVoidRef>()
5363 }),
5364
5365 9 => crate::ref_::Ref::Environment(unsafe {
5366 self.raw.get().deref_unchecked::<crate::WireEnvironmentRef>()
5367 }),
5368
5369 unknown => crate::ref_::Ref::UnknownOrdinal_(unknown),
5370 }
5371 }
5372}
5373
5374unsafe impl<___D> ::fidl_next::Decode<___D> for WireRef
5375where
5376 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5377
5378 ___D: ::fidl_next::Decoder,
5379{
5380 fn decode(
5381 mut slot: ::fidl_next::Slot<'_, Self>,
5382 decoder: &mut ___D,
5383 ) -> Result<(), ::fidl_next::DecodeError> {
5384 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
5385 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
5386 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireParentRef>(raw, decoder)?,
5387
5388 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireSelfRef>(raw, decoder)?,
5389
5390 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireChildRef>(raw, decoder)?,
5391
5392 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireCollectionRef>(
5393 raw, decoder,
5394 )?,
5395
5396 5 => {
5397 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireFrameworkRef>(raw, decoder)?
5398 }
5399
5400 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireCapabilityRef>(
5401 raw, decoder,
5402 )?,
5403
5404 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDebugRef>(raw, decoder)?,
5405
5406 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireVoidRef>(raw, decoder)?,
5407
5408 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireEnvironmentRef>(
5409 raw, decoder,
5410 )?,
5411
5412 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
5413 }
5414
5415 Ok(())
5416 }
5417}
5418
5419impl ::core::fmt::Debug for WireRef {
5420 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5421 match self.raw.ordinal() {
5422 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireParentRef>().fmt(f) },
5423 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireSelfRef>().fmt(f) },
5424 3 => unsafe { self.raw.get().deref_unchecked::<crate::WireChildRef>().fmt(f) },
5425 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireCollectionRef>().fmt(f) },
5426 5 => unsafe { self.raw.get().deref_unchecked::<crate::WireFrameworkRef>().fmt(f) },
5427 6 => unsafe { self.raw.get().deref_unchecked::<crate::WireCapabilityRef>().fmt(f) },
5428 7 => unsafe { self.raw.get().deref_unchecked::<crate::WireDebugRef>().fmt(f) },
5429 8 => unsafe { self.raw.get().deref_unchecked::<crate::WireVoidRef>().fmt(f) },
5430 9 => unsafe { self.raw.get().deref_unchecked::<crate::WireEnvironmentRef>().fmt(f) },
5431 _ => unsafe { ::core::hint::unreachable_unchecked() },
5432 }
5433 }
5434}
5435
5436#[repr(transparent)]
5437pub struct WireOptionalRef {
5438 raw: ::fidl_next::RawWireUnion,
5439}
5440
5441unsafe impl ::fidl_next::ZeroPadding for WireOptionalRef {
5442 #[inline]
5443 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5444 ::fidl_next::munge!(let Self { raw } = out);
5445 ::fidl_next::RawWireUnion::zero_padding(raw);
5446 }
5447}
5448
5449impl WireOptionalRef {
5450 pub fn is_some(&self) -> bool {
5451 self.raw.is_some()
5452 }
5453
5454 pub fn is_none(&self) -> bool {
5455 self.raw.is_none()
5456 }
5457
5458 pub fn as_ref(&self) -> Option<&WireRef> {
5459 if self.is_some() {
5460 Some(unsafe { &*(self as *const Self).cast() })
5461 } else {
5462 None
5463 }
5464 }
5465}
5466
5467unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalRef
5468where
5469 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5470
5471 ___D: ::fidl_next::Decoder,
5472{
5473 fn decode(
5474 mut slot: ::fidl_next::Slot<'_, Self>,
5475 decoder: &mut ___D,
5476 ) -> Result<(), ::fidl_next::DecodeError> {
5477 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
5478 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
5479 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireParentRef>(raw, decoder)?,
5480
5481 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireSelfRef>(raw, decoder)?,
5482
5483 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireChildRef>(raw, decoder)?,
5484
5485 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireCollectionRef>(
5486 raw, decoder,
5487 )?,
5488
5489 5 => {
5490 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireFrameworkRef>(raw, decoder)?
5491 }
5492
5493 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireCapabilityRef>(
5494 raw, decoder,
5495 )?,
5496
5497 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDebugRef>(raw, decoder)?,
5498
5499 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireVoidRef>(raw, decoder)?,
5500
5501 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireEnvironmentRef>(
5502 raw, decoder,
5503 )?,
5504
5505 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
5506 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
5507 }
5508
5509 Ok(())
5510 }
5511}
5512
5513impl ::core::fmt::Debug for WireOptionalRef {
5514 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5515 self.as_ref().fmt(f)
5516 }
5517}
5518
5519#[doc = " Declares a storage capability backed by a directory from which data, cache,\n or meta storage can be offered.\n"]
5520#[derive(Clone, Debug, Default)]
5521pub struct Storage {
5522 pub name: Option<String>,
5523
5524 pub source: Option<crate::Ref>,
5525
5526 pub backing_dir: Option<String>,
5527
5528 pub subdir: Option<String>,
5529
5530 pub storage_id: Option<crate::StorageId>,
5531}
5532
5533impl Storage {
5534 fn __max_ordinal(&self) -> usize {
5535 if self.name.is_some() {
5536 return 1;
5537 }
5538
5539 if self.source.is_some() {
5540 return 2;
5541 }
5542
5543 if self.backing_dir.is_some() {
5544 return 3;
5545 }
5546
5547 if self.subdir.is_some() {
5548 return 4;
5549 }
5550
5551 if self.storage_id.is_some() {
5552 return 5;
5553 }
5554
5555 0
5556 }
5557}
5558
5559impl ::fidl_next::Encodable for Storage {
5560 type Encoded = WireStorage;
5561}
5562
5563unsafe impl<___E> ::fidl_next::Encode<___E> for Storage
5564where
5565 ___E: ::fidl_next::Encoder + ?Sized,
5566{
5567 #[inline]
5568 fn encode(
5569 mut self,
5570 encoder: &mut ___E,
5571 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5572 ) -> Result<(), ::fidl_next::EncodeError> {
5573 ::fidl_next::munge!(let WireStorage { table } = out);
5574
5575 let max_ord = self.__max_ordinal();
5576
5577 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5578 ::fidl_next::ZeroPadding::zero_padding(&mut out);
5579
5580 let mut preallocated =
5581 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5582
5583 for i in 1..=max_ord {
5584 match i {
5585 5 => {
5586 if let Some(storage_id) = self.storage_id.take() {
5587 ::fidl_next::WireEnvelope::encode_value(
5588 storage_id,
5589 preallocated.encoder,
5590 &mut out,
5591 )?;
5592 } else {
5593 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5594 }
5595 }
5596
5597 4 => {
5598 if let Some(subdir) = self.subdir.take() {
5599 ::fidl_next::WireEnvelope::encode_value(
5600 subdir,
5601 preallocated.encoder,
5602 &mut out,
5603 )?;
5604 } else {
5605 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5606 }
5607 }
5608
5609 3 => {
5610 if let Some(backing_dir) = self.backing_dir.take() {
5611 ::fidl_next::WireEnvelope::encode_value(
5612 backing_dir,
5613 preallocated.encoder,
5614 &mut out,
5615 )?;
5616 } else {
5617 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5618 }
5619 }
5620
5621 2 => {
5622 if let Some(source) = self.source.take() {
5623 ::fidl_next::WireEnvelope::encode_value(
5624 source,
5625 preallocated.encoder,
5626 &mut out,
5627 )?;
5628 } else {
5629 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5630 }
5631 }
5632
5633 1 => {
5634 if let Some(name) = self.name.take() {
5635 ::fidl_next::WireEnvelope::encode_value(
5636 name,
5637 preallocated.encoder,
5638 &mut out,
5639 )?;
5640 } else {
5641 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5642 }
5643 }
5644
5645 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5646 }
5647 unsafe {
5648 preallocated.write_next(out.assume_init_ref());
5649 }
5650 }
5651
5652 ::fidl_next::WireTable::encode_len(table, max_ord);
5653
5654 Ok(())
5655 }
5656}
5657
5658unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Storage
5659where
5660 ___E: ::fidl_next::Encoder + ?Sized,
5661{
5662 #[inline]
5663 fn encode_ref(
5664 &self,
5665 encoder: &mut ___E,
5666 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5667 ) -> Result<(), ::fidl_next::EncodeError> {
5668 ::fidl_next::munge!(let WireStorage { table } = out);
5669
5670 let max_ord = self.__max_ordinal();
5671
5672 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5673 ::fidl_next::ZeroPadding::zero_padding(&mut out);
5674
5675 let mut preallocated =
5676 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5677
5678 for i in 1..=max_ord {
5679 match i {
5680 5 => {
5681 if let Some(storage_id) = &self.storage_id {
5682 ::fidl_next::WireEnvelope::encode_value(
5683 storage_id,
5684 preallocated.encoder,
5685 &mut out,
5686 )?;
5687 } else {
5688 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5689 }
5690 }
5691
5692 4 => {
5693 if let Some(subdir) = &self.subdir {
5694 ::fidl_next::WireEnvelope::encode_value(
5695 subdir,
5696 preallocated.encoder,
5697 &mut out,
5698 )?;
5699 } else {
5700 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5701 }
5702 }
5703
5704 3 => {
5705 if let Some(backing_dir) = &self.backing_dir {
5706 ::fidl_next::WireEnvelope::encode_value(
5707 backing_dir,
5708 preallocated.encoder,
5709 &mut out,
5710 )?;
5711 } else {
5712 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5713 }
5714 }
5715
5716 2 => {
5717 if let Some(source) = &self.source {
5718 ::fidl_next::WireEnvelope::encode_value(
5719 source,
5720 preallocated.encoder,
5721 &mut out,
5722 )?;
5723 } else {
5724 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5725 }
5726 }
5727
5728 1 => {
5729 if let Some(name) = &self.name {
5730 ::fidl_next::WireEnvelope::encode_value(
5731 name,
5732 preallocated.encoder,
5733 &mut out,
5734 )?;
5735 } else {
5736 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5737 }
5738 }
5739
5740 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
5741 }
5742 unsafe {
5743 preallocated.write_next(out.assume_init_ref());
5744 }
5745 }
5746
5747 ::fidl_next::WireTable::encode_len(table, max_ord);
5748
5749 Ok(())
5750 }
5751}
5752
5753impl ::fidl_next::TakeFrom<WireStorage> for Storage {
5754 #[inline]
5755 fn take_from(from: &WireStorage) -> Self {
5756 Self {
5757 name: from.name().map(::fidl_next::TakeFrom::take_from),
5758
5759 source: from.source().map(::fidl_next::TakeFrom::take_from),
5760
5761 backing_dir: from.backing_dir().map(::fidl_next::TakeFrom::take_from),
5762
5763 subdir: from.subdir().map(::fidl_next::TakeFrom::take_from),
5764
5765 storage_id: from.storage_id().map(::fidl_next::TakeFrom::take_from),
5766 }
5767 }
5768}
5769
5770#[repr(C)]
5772pub struct WireStorage {
5773 table: ::fidl_next::WireTable,
5774}
5775
5776unsafe impl ::fidl_next::ZeroPadding for WireStorage {
5777 #[inline]
5778 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5779 ::fidl_next::munge!(let Self { table } = out);
5780 ::fidl_next::WireTable::zero_padding(table);
5781 }
5782}
5783
5784unsafe impl<___D> ::fidl_next::Decode<___D> for WireStorage
5785where
5786 ___D: ::fidl_next::Decoder + ?Sized,
5787{
5788 fn decode(
5789 slot: ::fidl_next::Slot<'_, Self>,
5790 decoder: &mut ___D,
5791 ) -> Result<(), ::fidl_next::DecodeError> {
5792 ::fidl_next::munge!(let Self { table } = slot);
5793
5794 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
5795 match ordinal {
5796 0 => unsafe { ::core::hint::unreachable_unchecked() },
5797
5798 1 => {
5799 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
5800 slot.as_mut(),
5801 decoder,
5802 )?;
5803
5804 let name = unsafe {
5805 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
5806 };
5807
5808 if name.len() > 100 {
5809 return Err(::fidl_next::DecodeError::VectorTooLong {
5810 size: name.len() as u64,
5811 limit: 100,
5812 });
5813 }
5814
5815 Ok(())
5816 }
5817
5818 2 => {
5819 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
5820 slot.as_mut(),
5821 decoder,
5822 )?;
5823
5824 Ok(())
5825 }
5826
5827 3 => {
5828 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
5829 slot.as_mut(),
5830 decoder,
5831 )?;
5832
5833 let backing_dir = unsafe {
5834 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
5835 };
5836
5837 if backing_dir.len() > 100 {
5838 return Err(::fidl_next::DecodeError::VectorTooLong {
5839 size: backing_dir.len() as u64,
5840 limit: 100,
5841 });
5842 }
5843
5844 Ok(())
5845 }
5846
5847 4 => {
5848 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
5849 slot.as_mut(),
5850 decoder,
5851 )?;
5852
5853 let subdir = unsafe {
5854 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
5855 };
5856
5857 if subdir.len() > 1024 {
5858 return Err(::fidl_next::DecodeError::VectorTooLong {
5859 size: subdir.len() as u64,
5860 limit: 1024,
5861 });
5862 }
5863
5864 Ok(())
5865 }
5866
5867 5 => {
5868 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireStorageId>(
5869 slot.as_mut(),
5870 decoder,
5871 )?;
5872
5873 Ok(())
5874 }
5875
5876 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
5877 }
5878 })
5879 }
5880}
5881
5882impl WireStorage {
5883 pub fn name(&self) -> Option<&::fidl_next::WireString> {
5884 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5885 }
5886
5887 pub fn source(&self) -> Option<&crate::WireRef> {
5888 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5889 }
5890
5891 pub fn backing_dir(&self) -> Option<&::fidl_next::WireString> {
5892 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
5893 }
5894
5895 pub fn subdir(&self) -> Option<&::fidl_next::WireString> {
5896 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
5897 }
5898
5899 pub fn storage_id(&self) -> Option<&crate::WireStorageId> {
5900 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
5901 }
5902}
5903
5904impl ::core::fmt::Debug for WireStorage {
5905 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
5906 f.debug_struct("Storage")
5907 .field("name", &self.name())
5908 .field("source", &self.source())
5909 .field("backing_dir", &self.backing_dir())
5910 .field("subdir", &self.subdir())
5911 .field("storage_id", &self.storage_id())
5912 .finish()
5913 }
5914}
5915
5916#[doc = " Declares a dictionary capability.\n"]
5917#[derive(Clone, Debug, Default)]
5918pub struct Dictionary {
5919 pub name: Option<String>,
5920
5921 pub source: Option<crate::Ref>,
5922
5923 pub source_dictionary: Option<String>,
5924
5925 pub source_path: Option<String>,
5926}
5927
5928impl Dictionary {
5929 fn __max_ordinal(&self) -> usize {
5930 if self.name.is_some() {
5931 return 1;
5932 }
5933
5934 if self.source.is_some() {
5935 return 2;
5936 }
5937
5938 if self.source_dictionary.is_some() {
5939 return 3;
5940 }
5941
5942 if self.source_path.is_some() {
5943 return 4;
5944 }
5945
5946 0
5947 }
5948}
5949
5950impl ::fidl_next::Encodable for Dictionary {
5951 type Encoded = WireDictionary;
5952}
5953
5954unsafe impl<___E> ::fidl_next::Encode<___E> for Dictionary
5955where
5956 ___E: ::fidl_next::Encoder + ?Sized,
5957{
5958 #[inline]
5959 fn encode(
5960 mut self,
5961 encoder: &mut ___E,
5962 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
5963 ) -> Result<(), ::fidl_next::EncodeError> {
5964 ::fidl_next::munge!(let WireDictionary { table } = out);
5965
5966 let max_ord = self.__max_ordinal();
5967
5968 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
5969 ::fidl_next::ZeroPadding::zero_padding(&mut out);
5970
5971 let mut preallocated =
5972 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
5973
5974 for i in 1..=max_ord {
5975 match i {
5976 4 => {
5977 if let Some(source_path) = self.source_path.take() {
5978 ::fidl_next::WireEnvelope::encode_value(
5979 source_path,
5980 preallocated.encoder,
5981 &mut out,
5982 )?;
5983 } else {
5984 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5985 }
5986 }
5987
5988 3 => {
5989 if let Some(source_dictionary) = self.source_dictionary.take() {
5990 ::fidl_next::WireEnvelope::encode_value(
5991 source_dictionary,
5992 preallocated.encoder,
5993 &mut out,
5994 )?;
5995 } else {
5996 ::fidl_next::WireEnvelope::encode_zero(&mut out)
5997 }
5998 }
5999
6000 2 => {
6001 if let Some(source) = self.source.take() {
6002 ::fidl_next::WireEnvelope::encode_value(
6003 source,
6004 preallocated.encoder,
6005 &mut out,
6006 )?;
6007 } else {
6008 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6009 }
6010 }
6011
6012 1 => {
6013 if let Some(name) = self.name.take() {
6014 ::fidl_next::WireEnvelope::encode_value(
6015 name,
6016 preallocated.encoder,
6017 &mut out,
6018 )?;
6019 } else {
6020 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6021 }
6022 }
6023
6024 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
6025 }
6026 unsafe {
6027 preallocated.write_next(out.assume_init_ref());
6028 }
6029 }
6030
6031 ::fidl_next::WireTable::encode_len(table, max_ord);
6032
6033 Ok(())
6034 }
6035}
6036
6037unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Dictionary
6038where
6039 ___E: ::fidl_next::Encoder + ?Sized,
6040{
6041 #[inline]
6042 fn encode_ref(
6043 &self,
6044 encoder: &mut ___E,
6045 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6046 ) -> Result<(), ::fidl_next::EncodeError> {
6047 ::fidl_next::munge!(let WireDictionary { table } = out);
6048
6049 let max_ord = self.__max_ordinal();
6050
6051 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
6052 ::fidl_next::ZeroPadding::zero_padding(&mut out);
6053
6054 let mut preallocated =
6055 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
6056
6057 for i in 1..=max_ord {
6058 match i {
6059 4 => {
6060 if let Some(source_path) = &self.source_path {
6061 ::fidl_next::WireEnvelope::encode_value(
6062 source_path,
6063 preallocated.encoder,
6064 &mut out,
6065 )?;
6066 } else {
6067 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6068 }
6069 }
6070
6071 3 => {
6072 if let Some(source_dictionary) = &self.source_dictionary {
6073 ::fidl_next::WireEnvelope::encode_value(
6074 source_dictionary,
6075 preallocated.encoder,
6076 &mut out,
6077 )?;
6078 } else {
6079 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6080 }
6081 }
6082
6083 2 => {
6084 if let Some(source) = &self.source {
6085 ::fidl_next::WireEnvelope::encode_value(
6086 source,
6087 preallocated.encoder,
6088 &mut out,
6089 )?;
6090 } else {
6091 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6092 }
6093 }
6094
6095 1 => {
6096 if let Some(name) = &self.name {
6097 ::fidl_next::WireEnvelope::encode_value(
6098 name,
6099 preallocated.encoder,
6100 &mut out,
6101 )?;
6102 } else {
6103 ::fidl_next::WireEnvelope::encode_zero(&mut out)
6104 }
6105 }
6106
6107 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
6108 }
6109 unsafe {
6110 preallocated.write_next(out.assume_init_ref());
6111 }
6112 }
6113
6114 ::fidl_next::WireTable::encode_len(table, max_ord);
6115
6116 Ok(())
6117 }
6118}
6119
6120impl ::fidl_next::TakeFrom<WireDictionary> for Dictionary {
6121 #[inline]
6122 fn take_from(from: &WireDictionary) -> Self {
6123 Self {
6124 name: from.name().map(::fidl_next::TakeFrom::take_from),
6125
6126 source: from.source().map(::fidl_next::TakeFrom::take_from),
6127
6128 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
6129
6130 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
6131 }
6132 }
6133}
6134
6135#[repr(C)]
6137pub struct WireDictionary {
6138 table: ::fidl_next::WireTable,
6139}
6140
6141unsafe impl ::fidl_next::ZeroPadding for WireDictionary {
6142 #[inline]
6143 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6144 ::fidl_next::munge!(let Self { table } = out);
6145 ::fidl_next::WireTable::zero_padding(table);
6146 }
6147}
6148
6149unsafe impl<___D> ::fidl_next::Decode<___D> for WireDictionary
6150where
6151 ___D: ::fidl_next::Decoder + ?Sized,
6152{
6153 fn decode(
6154 slot: ::fidl_next::Slot<'_, Self>,
6155 decoder: &mut ___D,
6156 ) -> Result<(), ::fidl_next::DecodeError> {
6157 ::fidl_next::munge!(let Self { table } = slot);
6158
6159 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
6160 match ordinal {
6161 0 => unsafe { ::core::hint::unreachable_unchecked() },
6162
6163 1 => {
6164 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
6165 slot.as_mut(),
6166 decoder,
6167 )?;
6168
6169 let name = unsafe {
6170 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
6171 };
6172
6173 if name.len() > 100 {
6174 return Err(::fidl_next::DecodeError::VectorTooLong {
6175 size: name.len() as u64,
6176 limit: 100,
6177 });
6178 }
6179
6180 Ok(())
6181 }
6182
6183 2 => {
6184 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
6185 slot.as_mut(),
6186 decoder,
6187 )?;
6188
6189 Ok(())
6190 }
6191
6192 3 => {
6193 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
6194 slot.as_mut(),
6195 decoder,
6196 )?;
6197
6198 let source_dictionary = unsafe {
6199 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
6200 };
6201
6202 if source_dictionary.len() > 1024 {
6203 return Err(::fidl_next::DecodeError::VectorTooLong {
6204 size: source_dictionary.len() as u64,
6205 limit: 1024,
6206 });
6207 }
6208
6209 Ok(())
6210 }
6211
6212 4 => {
6213 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
6214 slot.as_mut(),
6215 decoder,
6216 )?;
6217
6218 let source_path = unsafe {
6219 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
6220 };
6221
6222 if source_path.len() > 1024 {
6223 return Err(::fidl_next::DecodeError::VectorTooLong {
6224 size: source_path.len() as u64,
6225 limit: 1024,
6226 });
6227 }
6228
6229 Ok(())
6230 }
6231
6232 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
6233 }
6234 })
6235 }
6236}
6237
6238impl WireDictionary {
6239 pub fn name(&self) -> Option<&::fidl_next::WireString> {
6240 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
6241 }
6242
6243 pub fn source(&self) -> Option<&crate::WireRef> {
6244 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
6245 }
6246
6247 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
6248 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
6249 }
6250
6251 pub fn source_path(&self) -> Option<&::fidl_next::WireString> {
6252 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
6253 }
6254}
6255
6256impl ::core::fmt::Debug for WireDictionary {
6257 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
6258 f.debug_struct("Dictionary")
6259 .field("name", &self.name())
6260 .field("source", &self.source())
6261 .field("source_dictionary", &self.source_dictionary())
6262 .field("source_path", &self.source_path())
6263 .finish()
6264 }
6265}
6266
6267#[doc = " Declares a capability defined by this component.\n"]
6268#[derive(Clone, Debug)]
6269pub enum Capability {
6270 Service(crate::Service),
6271
6272 Protocol(crate::Protocol),
6273
6274 Directory(crate::Directory),
6275
6276 Storage(crate::Storage),
6277
6278 Runner(crate::Runner),
6279
6280 Resolver(crate::Resolver),
6281
6282 EventStream(crate::EventStream),
6283
6284 Dictionary(crate::Dictionary),
6285
6286 Config(crate::Configuration),
6287
6288 UnknownOrdinal_(u64),
6289}
6290
6291impl ::fidl_next::Encodable for Capability {
6292 type Encoded = WireCapability;
6293}
6294
6295unsafe impl<___E> ::fidl_next::Encode<___E> for Capability
6296where
6297 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6298
6299 ___E: ::fidl_next::Encoder,
6300{
6301 #[inline]
6302 fn encode(
6303 self,
6304 encoder: &mut ___E,
6305 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6306 ) -> Result<(), ::fidl_next::EncodeError> {
6307 ::fidl_next::munge!(let WireCapability { raw } = out);
6308
6309 match self {
6310 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::Service>(
6311 value, 1, encoder, raw,
6312 )?,
6313
6314 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::Protocol>(
6315 value, 2, encoder, raw,
6316 )?,
6317
6318 Self::Directory(value) => {
6319 ::fidl_next::RawWireUnion::encode_as::<___E, crate::Directory>(
6320 value, 3, encoder, raw,
6321 )?
6322 }
6323
6324 Self::Storage(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::Storage>(
6325 value, 4, encoder, raw,
6326 )?,
6327
6328 Self::Runner(value) => {
6329 ::fidl_next::RawWireUnion::encode_as::<___E, crate::Runner>(value, 5, encoder, raw)?
6330 }
6331
6332 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::Resolver>(
6333 value, 6, encoder, raw,
6334 )?,
6335
6336 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
6337 ___E,
6338 crate::EventStream,
6339 >(value, 8, encoder, raw)?,
6340
6341 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
6342 ___E,
6343 crate::Dictionary,
6344 >(value, 9, encoder, raw)?,
6345
6346 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
6347 ___E,
6348 crate::Configuration,
6349 >(value, 10, encoder, raw)?,
6350
6351 Self::UnknownOrdinal_(ordinal) => {
6352 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
6353 }
6354 }
6355
6356 Ok(())
6357 }
6358}
6359
6360unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Capability
6361where
6362 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6363
6364 ___E: ::fidl_next::Encoder,
6365{
6366 #[inline]
6367 fn encode_ref(
6368 &self,
6369 encoder: &mut ___E,
6370 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6371 ) -> Result<(), ::fidl_next::EncodeError> {
6372 ::fidl_next::munge!(let WireCapability { raw } = out);
6373
6374 match self {
6375 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Service>(
6376 value, 1, encoder, raw,
6377 )?,
6378
6379 Self::Protocol(value) => {
6380 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Protocol>(
6381 value, 2, encoder, raw,
6382 )?
6383 }
6384
6385 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
6386 ___E,
6387 &crate::Directory,
6388 >(value, 3, encoder, raw)?,
6389
6390 Self::Storage(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Storage>(
6391 value, 4, encoder, raw,
6392 )?,
6393
6394 Self::Runner(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Runner>(
6395 value, 5, encoder, raw,
6396 )?,
6397
6398 Self::Resolver(value) => {
6399 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Resolver>(
6400 value, 6, encoder, raw,
6401 )?
6402 }
6403
6404 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
6405 ___E,
6406 &crate::EventStream,
6407 >(value, 8, encoder, raw)?,
6408
6409 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
6410 ___E,
6411 &crate::Dictionary,
6412 >(value, 9, encoder, raw)?,
6413
6414 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
6415 ___E,
6416 &crate::Configuration,
6417 >(value, 10, encoder, raw)?,
6418
6419 Self::UnknownOrdinal_(ordinal) => {
6420 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
6421 }
6422 }
6423
6424 Ok(())
6425 }
6426}
6427
6428impl ::fidl_next::EncodableOption for Box<Capability> {
6429 type EncodedOption = WireOptionalCapability;
6430}
6431
6432unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<Capability>
6433where
6434 ___E: ?Sized,
6435 Capability: ::fidl_next::Encode<___E>,
6436{
6437 #[inline]
6438 fn encode_option(
6439 this: Option<Self>,
6440 encoder: &mut ___E,
6441 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
6442 ) -> Result<(), ::fidl_next::EncodeError> {
6443 ::fidl_next::munge!(let WireOptionalCapability { raw } = &mut *out);
6444
6445 if let Some(inner) = this {
6446 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
6447 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
6448 } else {
6449 ::fidl_next::RawWireUnion::encode_absent(raw);
6450 }
6451
6452 Ok(())
6453 }
6454}
6455
6456unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<Capability>
6457where
6458 ___E: ?Sized,
6459 Capability: ::fidl_next::EncodeRef<___E>,
6460{
6461 #[inline]
6462 fn encode_option_ref(
6463 this: Option<&Self>,
6464 encoder: &mut ___E,
6465 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
6466 ) -> Result<(), ::fidl_next::EncodeError> {
6467 ::fidl_next::munge!(let WireOptionalCapability { raw } = &mut *out);
6468
6469 if let Some(inner) = this {
6470 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
6471 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
6472 } else {
6473 ::fidl_next::RawWireUnion::encode_absent(raw);
6474 }
6475
6476 Ok(())
6477 }
6478}
6479
6480impl ::fidl_next::TakeFrom<WireCapability> for Capability {
6481 #[inline]
6482 fn take_from(from: &WireCapability) -> Self {
6483 match from.raw.ordinal() {
6484 1 => Self::Service(::fidl_next::TakeFrom::take_from(unsafe {
6485 from.raw.get().deref_unchecked::<crate::WireService>()
6486 })),
6487
6488 2 => Self::Protocol(::fidl_next::TakeFrom::take_from(unsafe {
6489 from.raw.get().deref_unchecked::<crate::WireProtocol>()
6490 })),
6491
6492 3 => Self::Directory(::fidl_next::TakeFrom::take_from(unsafe {
6493 from.raw.get().deref_unchecked::<crate::WireDirectory>()
6494 })),
6495
6496 4 => Self::Storage(::fidl_next::TakeFrom::take_from(unsafe {
6497 from.raw.get().deref_unchecked::<crate::WireStorage>()
6498 })),
6499
6500 5 => Self::Runner(::fidl_next::TakeFrom::take_from(unsafe {
6501 from.raw.get().deref_unchecked::<crate::WireRunner>()
6502 })),
6503
6504 6 => Self::Resolver(::fidl_next::TakeFrom::take_from(unsafe {
6505 from.raw.get().deref_unchecked::<crate::WireResolver>()
6506 })),
6507
6508 8 => Self::EventStream(::fidl_next::TakeFrom::take_from(unsafe {
6509 from.raw.get().deref_unchecked::<crate::WireEventStream>()
6510 })),
6511
6512 9 => Self::Dictionary(::fidl_next::TakeFrom::take_from(unsafe {
6513 from.raw.get().deref_unchecked::<crate::WireDictionary>()
6514 })),
6515
6516 10 => Self::Config(::fidl_next::TakeFrom::take_from(unsafe {
6517 from.raw.get().deref_unchecked::<crate::WireConfiguration>()
6518 })),
6519
6520 _ => unsafe { ::core::hint::unreachable_unchecked() },
6521 }
6522 }
6523}
6524
6525impl ::fidl_next::TakeFrom<WireOptionalCapability> for Option<Box<Capability>> {
6526 #[inline]
6527 fn take_from(from: &WireOptionalCapability) -> Self {
6528 if let Some(inner) = from.as_ref() {
6529 Some(::fidl_next::TakeFrom::take_from(inner))
6530 } else {
6531 None
6532 }
6533 }
6534}
6535
6536#[repr(transparent)]
6538pub struct WireCapability {
6539 raw: ::fidl_next::RawWireUnion,
6540}
6541
6542unsafe impl ::fidl_next::ZeroPadding for WireCapability {
6543 #[inline]
6544 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6545 ::fidl_next::munge!(let Self { raw } = out);
6546 ::fidl_next::RawWireUnion::zero_padding(raw);
6547 }
6548}
6549
6550pub mod capability {
6551 pub enum Ref<'union> {
6552 Service(&'union crate::WireService),
6553
6554 Protocol(&'union crate::WireProtocol),
6555
6556 Directory(&'union crate::WireDirectory),
6557
6558 Storage(&'union crate::WireStorage),
6559
6560 Runner(&'union crate::WireRunner),
6561
6562 Resolver(&'union crate::WireResolver),
6563
6564 EventStream(&'union crate::WireEventStream),
6565
6566 Dictionary(&'union crate::WireDictionary),
6567
6568 Config(&'union crate::WireConfiguration),
6569
6570 UnknownOrdinal_(u64),
6571 }
6572}
6573
6574impl WireCapability {
6575 pub fn as_ref(&self) -> crate::capability::Ref<'_> {
6576 match self.raw.ordinal() {
6577 1 => crate::capability::Ref::Service(unsafe {
6578 self.raw.get().deref_unchecked::<crate::WireService>()
6579 }),
6580
6581 2 => crate::capability::Ref::Protocol(unsafe {
6582 self.raw.get().deref_unchecked::<crate::WireProtocol>()
6583 }),
6584
6585 3 => crate::capability::Ref::Directory(unsafe {
6586 self.raw.get().deref_unchecked::<crate::WireDirectory>()
6587 }),
6588
6589 4 => crate::capability::Ref::Storage(unsafe {
6590 self.raw.get().deref_unchecked::<crate::WireStorage>()
6591 }),
6592
6593 5 => crate::capability::Ref::Runner(unsafe {
6594 self.raw.get().deref_unchecked::<crate::WireRunner>()
6595 }),
6596
6597 6 => crate::capability::Ref::Resolver(unsafe {
6598 self.raw.get().deref_unchecked::<crate::WireResolver>()
6599 }),
6600
6601 8 => crate::capability::Ref::EventStream(unsafe {
6602 self.raw.get().deref_unchecked::<crate::WireEventStream>()
6603 }),
6604
6605 9 => crate::capability::Ref::Dictionary(unsafe {
6606 self.raw.get().deref_unchecked::<crate::WireDictionary>()
6607 }),
6608
6609 10 => crate::capability::Ref::Config(unsafe {
6610 self.raw.get().deref_unchecked::<crate::WireConfiguration>()
6611 }),
6612
6613 unknown => crate::capability::Ref::UnknownOrdinal_(unknown),
6614 }
6615 }
6616}
6617
6618unsafe impl<___D> ::fidl_next::Decode<___D> for WireCapability
6619where
6620 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6621
6622 ___D: ::fidl_next::Decoder,
6623{
6624 fn decode(
6625 mut slot: ::fidl_next::Slot<'_, Self>,
6626 decoder: &mut ___D,
6627 ) -> Result<(), ::fidl_next::DecodeError> {
6628 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
6629 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
6630 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireService>(raw, decoder)?,
6631
6632 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireProtocol>(raw, decoder)?,
6633
6634 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDirectory>(raw, decoder)?,
6635
6636 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireStorage>(raw, decoder)?,
6637
6638 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireRunner>(raw, decoder)?,
6639
6640 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireResolver>(raw, decoder)?,
6641
6642 8 => {
6643 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireEventStream>(raw, decoder)?
6644 }
6645
6646 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDictionary>(raw, decoder)?,
6647
6648 10 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfiguration>(
6649 raw, decoder,
6650 )?,
6651
6652 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
6653 }
6654
6655 Ok(())
6656 }
6657}
6658
6659impl ::core::fmt::Debug for WireCapability {
6660 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6661 match self.raw.ordinal() {
6662 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireService>().fmt(f) },
6663 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireProtocol>().fmt(f) },
6664 3 => unsafe { self.raw.get().deref_unchecked::<crate::WireDirectory>().fmt(f) },
6665 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireStorage>().fmt(f) },
6666 5 => unsafe { self.raw.get().deref_unchecked::<crate::WireRunner>().fmt(f) },
6667 6 => unsafe { self.raw.get().deref_unchecked::<crate::WireResolver>().fmt(f) },
6668 8 => unsafe { self.raw.get().deref_unchecked::<crate::WireEventStream>().fmt(f) },
6669 9 => unsafe { self.raw.get().deref_unchecked::<crate::WireDictionary>().fmt(f) },
6670 10 => unsafe { self.raw.get().deref_unchecked::<crate::WireConfiguration>().fmt(f) },
6671 _ => unsafe { ::core::hint::unreachable_unchecked() },
6672 }
6673 }
6674}
6675
6676#[repr(transparent)]
6677pub struct WireOptionalCapability {
6678 raw: ::fidl_next::RawWireUnion,
6679}
6680
6681unsafe impl ::fidl_next::ZeroPadding for WireOptionalCapability {
6682 #[inline]
6683 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6684 ::fidl_next::munge!(let Self { raw } = out);
6685 ::fidl_next::RawWireUnion::zero_padding(raw);
6686 }
6687}
6688
6689impl WireOptionalCapability {
6690 pub fn is_some(&self) -> bool {
6691 self.raw.is_some()
6692 }
6693
6694 pub fn is_none(&self) -> bool {
6695 self.raw.is_none()
6696 }
6697
6698 pub fn as_ref(&self) -> Option<&WireCapability> {
6699 if self.is_some() {
6700 Some(unsafe { &*(self as *const Self).cast() })
6701 } else {
6702 None
6703 }
6704 }
6705}
6706
6707unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalCapability
6708where
6709 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6710
6711 ___D: ::fidl_next::Decoder,
6712{
6713 fn decode(
6714 mut slot: ::fidl_next::Slot<'_, Self>,
6715 decoder: &mut ___D,
6716 ) -> Result<(), ::fidl_next::DecodeError> {
6717 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
6718 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
6719 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireService>(raw, decoder)?,
6720
6721 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireProtocol>(raw, decoder)?,
6722
6723 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDirectory>(raw, decoder)?,
6724
6725 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireStorage>(raw, decoder)?,
6726
6727 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireRunner>(raw, decoder)?,
6728
6729 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireResolver>(raw, decoder)?,
6730
6731 8 => {
6732 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireEventStream>(raw, decoder)?
6733 }
6734
6735 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDictionary>(raw, decoder)?,
6736
6737 10 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfiguration>(
6738 raw, decoder,
6739 )?,
6740
6741 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
6742 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
6743 }
6744
6745 Ok(())
6746 }
6747}
6748
6749impl ::core::fmt::Debug for WireOptionalCapability {
6750 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6751 self.as_ref().fmt(f)
6752 }
6753}
6754
6755#[doc = " Describes under what conditions the component may be started.\n"]
6756#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6757#[repr(u32)]
6758pub enum StartupMode {
6759 Lazy = 0,
6760 Eager = 1,
6761}
6762
6763impl ::fidl_next::Encodable for StartupMode {
6764 type Encoded = WireStartupMode;
6765}
6766impl ::std::convert::TryFrom<u32> for StartupMode {
6767 type Error = ::fidl_next::UnknownStrictEnumMemberError;
6768 fn try_from(value: u32) -> Result<Self, Self::Error> {
6769 match value {
6770 0 => Ok(Self::Lazy),
6771 1 => Ok(Self::Eager),
6772
6773 _ => Err(Self::Error::new(value.into())),
6774 }
6775 }
6776}
6777
6778unsafe impl<___E> ::fidl_next::Encode<___E> for StartupMode
6779where
6780 ___E: ?Sized,
6781{
6782 #[inline]
6783 fn encode(
6784 self,
6785 encoder: &mut ___E,
6786 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6787 ) -> Result<(), ::fidl_next::EncodeError> {
6788 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
6789 }
6790}
6791
6792unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StartupMode
6793where
6794 ___E: ?Sized,
6795{
6796 #[inline]
6797 fn encode_ref(
6798 &self,
6799 encoder: &mut ___E,
6800 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6801 ) -> Result<(), ::fidl_next::EncodeError> {
6802 ::fidl_next::munge!(let WireStartupMode { value } = out);
6803 let _ = value.write(::fidl_next::WireU32::from(match *self {
6804 Self::Lazy => 0,
6805
6806 Self::Eager => 1,
6807 }));
6808
6809 Ok(())
6810 }
6811}
6812
6813impl ::core::convert::From<WireStartupMode> for StartupMode {
6814 fn from(wire: WireStartupMode) -> Self {
6815 match u32::from(wire.value) {
6816 0 => Self::Lazy,
6817
6818 1 => Self::Eager,
6819
6820 _ => unsafe { ::core::hint::unreachable_unchecked() },
6821 }
6822 }
6823}
6824
6825impl ::fidl_next::TakeFrom<WireStartupMode> for StartupMode {
6826 #[inline]
6827 fn take_from(from: &WireStartupMode) -> Self {
6828 Self::from(*from)
6829 }
6830}
6831
6832#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6834#[repr(transparent)]
6835pub struct WireStartupMode {
6836 value: ::fidl_next::WireU32,
6837}
6838
6839unsafe impl ::fidl_next::ZeroPadding for WireStartupMode {
6840 #[inline]
6841 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
6842 }
6844}
6845
6846impl WireStartupMode {
6847 pub const LAZY: WireStartupMode = WireStartupMode { value: ::fidl_next::WireU32(0) };
6848
6849 pub const EAGER: WireStartupMode = WireStartupMode { value: ::fidl_next::WireU32(1) };
6850}
6851
6852unsafe impl<___D> ::fidl_next::Decode<___D> for WireStartupMode
6853where
6854 ___D: ?Sized,
6855{
6856 fn decode(
6857 slot: ::fidl_next::Slot<'_, Self>,
6858 _: &mut ___D,
6859 ) -> Result<(), ::fidl_next::DecodeError> {
6860 ::fidl_next::munge!(let Self { value } = slot);
6861
6862 match u32::from(*value) {
6863 0 | 1 => (),
6864 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
6865 }
6866
6867 Ok(())
6868 }
6869}
6870
6871impl ::core::convert::From<StartupMode> for WireStartupMode {
6872 fn from(natural: StartupMode) -> Self {
6873 match natural {
6874 StartupMode::Lazy => WireStartupMode::LAZY,
6875
6876 StartupMode::Eager => WireStartupMode::EAGER,
6877 }
6878 }
6879}
6880
6881#[doc = " Describes the action to take if this component instance terminates\n unexpectedly.\n"]
6882#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6883#[repr(u32)]
6884pub enum OnTerminate {
6885 None = 0,
6886 Reboot = 1,
6887}
6888
6889impl ::fidl_next::Encodable for OnTerminate {
6890 type Encoded = WireOnTerminate;
6891}
6892impl ::std::convert::TryFrom<u32> for OnTerminate {
6893 type Error = ::fidl_next::UnknownStrictEnumMemberError;
6894 fn try_from(value: u32) -> Result<Self, Self::Error> {
6895 match value {
6896 0 => Ok(Self::None),
6897 1 => Ok(Self::Reboot),
6898
6899 _ => Err(Self::Error::new(value.into())),
6900 }
6901 }
6902}
6903
6904unsafe impl<___E> ::fidl_next::Encode<___E> for OnTerminate
6905where
6906 ___E: ?Sized,
6907{
6908 #[inline]
6909 fn encode(
6910 self,
6911 encoder: &mut ___E,
6912 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6913 ) -> Result<(), ::fidl_next::EncodeError> {
6914 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
6915 }
6916}
6917
6918unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OnTerminate
6919where
6920 ___E: ?Sized,
6921{
6922 #[inline]
6923 fn encode_ref(
6924 &self,
6925 encoder: &mut ___E,
6926 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
6927 ) -> Result<(), ::fidl_next::EncodeError> {
6928 ::fidl_next::munge!(let WireOnTerminate { value } = out);
6929 let _ = value.write(::fidl_next::WireU32::from(match *self {
6930 Self::None => 0,
6931
6932 Self::Reboot => 1,
6933 }));
6934
6935 Ok(())
6936 }
6937}
6938
6939impl ::core::convert::From<WireOnTerminate> for OnTerminate {
6940 fn from(wire: WireOnTerminate) -> Self {
6941 match u32::from(wire.value) {
6942 0 => Self::None,
6943
6944 1 => Self::Reboot,
6945
6946 _ => unsafe { ::core::hint::unreachable_unchecked() },
6947 }
6948 }
6949}
6950
6951impl ::fidl_next::TakeFrom<WireOnTerminate> for OnTerminate {
6952 #[inline]
6953 fn take_from(from: &WireOnTerminate) -> Self {
6954 Self::from(*from)
6955 }
6956}
6957
6958#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6960#[repr(transparent)]
6961pub struct WireOnTerminate {
6962 value: ::fidl_next::WireU32,
6963}
6964
6965unsafe impl ::fidl_next::ZeroPadding for WireOnTerminate {
6966 #[inline]
6967 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
6968 }
6970}
6971
6972impl WireOnTerminate {
6973 pub const NONE: WireOnTerminate = WireOnTerminate { value: ::fidl_next::WireU32(0) };
6974
6975 pub const REBOOT: WireOnTerminate = WireOnTerminate { value: ::fidl_next::WireU32(1) };
6976}
6977
6978unsafe impl<___D> ::fidl_next::Decode<___D> for WireOnTerminate
6979where
6980 ___D: ?Sized,
6981{
6982 fn decode(
6983 slot: ::fidl_next::Slot<'_, Self>,
6984 _: &mut ___D,
6985 ) -> Result<(), ::fidl_next::DecodeError> {
6986 ::fidl_next::munge!(let Self { value } = slot);
6987
6988 match u32::from(*value) {
6989 0 | 1 => (),
6990 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
6991 }
6992
6993 Ok(())
6994 }
6995}
6996
6997impl ::core::convert::From<OnTerminate> for WireOnTerminate {
6998 fn from(natural: OnTerminate) -> Self {
6999 match natural {
7000 OnTerminate::None => WireOnTerminate::NONE,
7001
7002 OnTerminate::Reboot => WireOnTerminate::REBOOT,
7003 }
7004 }
7005}
7006
7007#[doc = " The string identifier for a config field.\n"]
7008pub type ConfigKey = String;
7009
7010pub type WireConfigKey = ::fidl_next::WireString;
7012
7013#[doc = " A directive to override the value of a particular configuration field in the child.\n"]
7014#[derive(Clone, Debug, Default)]
7015pub struct ConfigOverride {
7016 pub key: Option<String>,
7017
7018 pub value: Option<crate::ConfigValue>,
7019}
7020
7021impl ConfigOverride {
7022 fn __max_ordinal(&self) -> usize {
7023 if self.key.is_some() {
7024 return 1;
7025 }
7026
7027 if self.value.is_some() {
7028 return 2;
7029 }
7030
7031 0
7032 }
7033}
7034
7035impl ::fidl_next::Encodable for ConfigOverride {
7036 type Encoded = WireConfigOverride;
7037}
7038
7039unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigOverride
7040where
7041 ___E: ::fidl_next::Encoder + ?Sized,
7042{
7043 #[inline]
7044 fn encode(
7045 mut self,
7046 encoder: &mut ___E,
7047 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7048 ) -> Result<(), ::fidl_next::EncodeError> {
7049 ::fidl_next::munge!(let WireConfigOverride { table } = out);
7050
7051 let max_ord = self.__max_ordinal();
7052
7053 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7054 ::fidl_next::ZeroPadding::zero_padding(&mut out);
7055
7056 let mut preallocated =
7057 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7058
7059 for i in 1..=max_ord {
7060 match i {
7061 2 => {
7062 if let Some(value) = self.value.take() {
7063 ::fidl_next::WireEnvelope::encode_value(
7064 value,
7065 preallocated.encoder,
7066 &mut out,
7067 )?;
7068 } else {
7069 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7070 }
7071 }
7072
7073 1 => {
7074 if let Some(key) = self.key.take() {
7075 ::fidl_next::WireEnvelope::encode_value(
7076 key,
7077 preallocated.encoder,
7078 &mut out,
7079 )?;
7080 } else {
7081 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7082 }
7083 }
7084
7085 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7086 }
7087 unsafe {
7088 preallocated.write_next(out.assume_init_ref());
7089 }
7090 }
7091
7092 ::fidl_next::WireTable::encode_len(table, max_ord);
7093
7094 Ok(())
7095 }
7096}
7097
7098unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigOverride
7099where
7100 ___E: ::fidl_next::Encoder + ?Sized,
7101{
7102 #[inline]
7103 fn encode_ref(
7104 &self,
7105 encoder: &mut ___E,
7106 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7107 ) -> Result<(), ::fidl_next::EncodeError> {
7108 ::fidl_next::munge!(let WireConfigOverride { table } = out);
7109
7110 let max_ord = self.__max_ordinal();
7111
7112 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7113 ::fidl_next::ZeroPadding::zero_padding(&mut out);
7114
7115 let mut preallocated =
7116 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7117
7118 for i in 1..=max_ord {
7119 match i {
7120 2 => {
7121 if let Some(value) = &self.value {
7122 ::fidl_next::WireEnvelope::encode_value(
7123 value,
7124 preallocated.encoder,
7125 &mut out,
7126 )?;
7127 } else {
7128 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7129 }
7130 }
7131
7132 1 => {
7133 if let Some(key) = &self.key {
7134 ::fidl_next::WireEnvelope::encode_value(
7135 key,
7136 preallocated.encoder,
7137 &mut out,
7138 )?;
7139 } else {
7140 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7141 }
7142 }
7143
7144 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7145 }
7146 unsafe {
7147 preallocated.write_next(out.assume_init_ref());
7148 }
7149 }
7150
7151 ::fidl_next::WireTable::encode_len(table, max_ord);
7152
7153 Ok(())
7154 }
7155}
7156
7157impl ::fidl_next::TakeFrom<WireConfigOverride> for ConfigOverride {
7158 #[inline]
7159 fn take_from(from: &WireConfigOverride) -> Self {
7160 Self {
7161 key: from.key().map(::fidl_next::TakeFrom::take_from),
7162
7163 value: from.value().map(::fidl_next::TakeFrom::take_from),
7164 }
7165 }
7166}
7167
7168#[repr(C)]
7170pub struct WireConfigOverride {
7171 table: ::fidl_next::WireTable,
7172}
7173
7174unsafe impl ::fidl_next::ZeroPadding for WireConfigOverride {
7175 #[inline]
7176 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
7177 ::fidl_next::munge!(let Self { table } = out);
7178 ::fidl_next::WireTable::zero_padding(table);
7179 }
7180}
7181
7182unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigOverride
7183where
7184 ___D: ::fidl_next::Decoder + ?Sized,
7185{
7186 fn decode(
7187 slot: ::fidl_next::Slot<'_, Self>,
7188 decoder: &mut ___D,
7189 ) -> Result<(), ::fidl_next::DecodeError> {
7190 ::fidl_next::munge!(let Self { table } = slot);
7191
7192 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
7193 match ordinal {
7194 0 => unsafe { ::core::hint::unreachable_unchecked() },
7195
7196 1 => {
7197 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
7198 slot.as_mut(),
7199 decoder,
7200 )?;
7201
7202 let key = unsafe {
7203 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
7204 };
7205
7206 if key.len() > 64 {
7207 return Err(::fidl_next::DecodeError::VectorTooLong {
7208 size: key.len() as u64,
7209 limit: 64,
7210 });
7211 }
7212
7213 Ok(())
7214 }
7215
7216 2 => {
7217 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValue>(
7218 slot.as_mut(),
7219 decoder,
7220 )?;
7221
7222 Ok(())
7223 }
7224
7225 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
7226 }
7227 })
7228 }
7229}
7230
7231impl WireConfigOverride {
7232 pub fn key(&self) -> Option<&::fidl_next::WireString> {
7233 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
7234 }
7235
7236 pub fn value(&self) -> Option<&crate::WireConfigValue> {
7237 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
7238 }
7239}
7240
7241impl ::core::fmt::Debug for WireConfigOverride {
7242 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
7243 f.debug_struct("ConfigOverride")
7244 .field("key", &self.key())
7245 .field("value", &self.value())
7246 .finish()
7247 }
7248}
7249
7250#[doc = " Statically declares a child component instance.\n"]
7251#[derive(Clone, Debug, Default)]
7252pub struct Child {
7253 pub name: Option<String>,
7254
7255 pub url: Option<String>,
7256
7257 pub startup: Option<crate::StartupMode>,
7258
7259 pub environment: Option<String>,
7260
7261 pub on_terminate: Option<crate::OnTerminate>,
7262
7263 pub config_overrides: Option<Vec<crate::ConfigOverride>>,
7264}
7265
7266impl Child {
7267 fn __max_ordinal(&self) -> usize {
7268 if self.name.is_some() {
7269 return 1;
7270 }
7271
7272 if self.url.is_some() {
7273 return 2;
7274 }
7275
7276 if self.startup.is_some() {
7277 return 3;
7278 }
7279
7280 if self.environment.is_some() {
7281 return 4;
7282 }
7283
7284 if self.on_terminate.is_some() {
7285 return 5;
7286 }
7287
7288 if self.config_overrides.is_some() {
7289 return 6;
7290 }
7291
7292 0
7293 }
7294}
7295
7296impl ::fidl_next::Encodable for Child {
7297 type Encoded = WireChild;
7298}
7299
7300unsafe impl<___E> ::fidl_next::Encode<___E> for Child
7301where
7302 ___E: ::fidl_next::Encoder + ?Sized,
7303{
7304 #[inline]
7305 fn encode(
7306 mut self,
7307 encoder: &mut ___E,
7308 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7309 ) -> Result<(), ::fidl_next::EncodeError> {
7310 ::fidl_next::munge!(let WireChild { table } = out);
7311
7312 let max_ord = self.__max_ordinal();
7313
7314 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7315 ::fidl_next::ZeroPadding::zero_padding(&mut out);
7316
7317 let mut preallocated =
7318 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7319
7320 for i in 1..=max_ord {
7321 match i {
7322 6 => {
7323 if let Some(config_overrides) = self.config_overrides.take() {
7324 ::fidl_next::WireEnvelope::encode_value(
7325 config_overrides,
7326 preallocated.encoder,
7327 &mut out,
7328 )?;
7329 } else {
7330 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7331 }
7332 }
7333
7334 5 => {
7335 if let Some(on_terminate) = self.on_terminate.take() {
7336 ::fidl_next::WireEnvelope::encode_value(
7337 on_terminate,
7338 preallocated.encoder,
7339 &mut out,
7340 )?;
7341 } else {
7342 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7343 }
7344 }
7345
7346 4 => {
7347 if let Some(environment) = self.environment.take() {
7348 ::fidl_next::WireEnvelope::encode_value(
7349 environment,
7350 preallocated.encoder,
7351 &mut out,
7352 )?;
7353 } else {
7354 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7355 }
7356 }
7357
7358 3 => {
7359 if let Some(startup) = self.startup.take() {
7360 ::fidl_next::WireEnvelope::encode_value(
7361 startup,
7362 preallocated.encoder,
7363 &mut out,
7364 )?;
7365 } else {
7366 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7367 }
7368 }
7369
7370 2 => {
7371 if let Some(url) = self.url.take() {
7372 ::fidl_next::WireEnvelope::encode_value(
7373 url,
7374 preallocated.encoder,
7375 &mut out,
7376 )?;
7377 } else {
7378 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7379 }
7380 }
7381
7382 1 => {
7383 if let Some(name) = self.name.take() {
7384 ::fidl_next::WireEnvelope::encode_value(
7385 name,
7386 preallocated.encoder,
7387 &mut out,
7388 )?;
7389 } else {
7390 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7391 }
7392 }
7393
7394 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7395 }
7396 unsafe {
7397 preallocated.write_next(out.assume_init_ref());
7398 }
7399 }
7400
7401 ::fidl_next::WireTable::encode_len(table, max_ord);
7402
7403 Ok(())
7404 }
7405}
7406
7407unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Child
7408where
7409 ___E: ::fidl_next::Encoder + ?Sized,
7410{
7411 #[inline]
7412 fn encode_ref(
7413 &self,
7414 encoder: &mut ___E,
7415 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7416 ) -> Result<(), ::fidl_next::EncodeError> {
7417 ::fidl_next::munge!(let WireChild { table } = out);
7418
7419 let max_ord = self.__max_ordinal();
7420
7421 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7422 ::fidl_next::ZeroPadding::zero_padding(&mut out);
7423
7424 let mut preallocated =
7425 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7426
7427 for i in 1..=max_ord {
7428 match i {
7429 6 => {
7430 if let Some(config_overrides) = &self.config_overrides {
7431 ::fidl_next::WireEnvelope::encode_value(
7432 config_overrides,
7433 preallocated.encoder,
7434 &mut out,
7435 )?;
7436 } else {
7437 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7438 }
7439 }
7440
7441 5 => {
7442 if let Some(on_terminate) = &self.on_terminate {
7443 ::fidl_next::WireEnvelope::encode_value(
7444 on_terminate,
7445 preallocated.encoder,
7446 &mut out,
7447 )?;
7448 } else {
7449 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7450 }
7451 }
7452
7453 4 => {
7454 if let Some(environment) = &self.environment {
7455 ::fidl_next::WireEnvelope::encode_value(
7456 environment,
7457 preallocated.encoder,
7458 &mut out,
7459 )?;
7460 } else {
7461 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7462 }
7463 }
7464
7465 3 => {
7466 if let Some(startup) = &self.startup {
7467 ::fidl_next::WireEnvelope::encode_value(
7468 startup,
7469 preallocated.encoder,
7470 &mut out,
7471 )?;
7472 } else {
7473 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7474 }
7475 }
7476
7477 2 => {
7478 if let Some(url) = &self.url {
7479 ::fidl_next::WireEnvelope::encode_value(
7480 url,
7481 preallocated.encoder,
7482 &mut out,
7483 )?;
7484 } else {
7485 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7486 }
7487 }
7488
7489 1 => {
7490 if let Some(name) = &self.name {
7491 ::fidl_next::WireEnvelope::encode_value(
7492 name,
7493 preallocated.encoder,
7494 &mut out,
7495 )?;
7496 } else {
7497 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7498 }
7499 }
7500
7501 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7502 }
7503 unsafe {
7504 preallocated.write_next(out.assume_init_ref());
7505 }
7506 }
7507
7508 ::fidl_next::WireTable::encode_len(table, max_ord);
7509
7510 Ok(())
7511 }
7512}
7513
7514impl ::fidl_next::TakeFrom<WireChild> for Child {
7515 #[inline]
7516 fn take_from(from: &WireChild) -> Self {
7517 Self {
7518 name: from.name().map(::fidl_next::TakeFrom::take_from),
7519
7520 url: from.url().map(::fidl_next::TakeFrom::take_from),
7521
7522 startup: from.startup().map(::fidl_next::TakeFrom::take_from),
7523
7524 environment: from.environment().map(::fidl_next::TakeFrom::take_from),
7525
7526 on_terminate: from.on_terminate().map(::fidl_next::TakeFrom::take_from),
7527
7528 config_overrides: from.config_overrides().map(::fidl_next::TakeFrom::take_from),
7529 }
7530 }
7531}
7532
7533#[repr(C)]
7535pub struct WireChild {
7536 table: ::fidl_next::WireTable,
7537}
7538
7539unsafe impl ::fidl_next::ZeroPadding for WireChild {
7540 #[inline]
7541 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
7542 ::fidl_next::munge!(let Self { table } = out);
7543 ::fidl_next::WireTable::zero_padding(table);
7544 }
7545}
7546
7547unsafe impl<___D> ::fidl_next::Decode<___D> for WireChild
7548where
7549 ___D: ::fidl_next::Decoder + ?Sized,
7550{
7551 fn decode(
7552 slot: ::fidl_next::Slot<'_, Self>,
7553 decoder: &mut ___D,
7554 ) -> Result<(), ::fidl_next::DecodeError> {
7555 ::fidl_next::munge!(let Self { table } = slot);
7556
7557 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
7558 match ordinal {
7559 0 => unsafe { ::core::hint::unreachable_unchecked() },
7560
7561 1 => {
7562 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
7563 slot.as_mut(),
7564 decoder,
7565 )?;
7566
7567 let name = unsafe {
7568 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
7569 };
7570
7571 if name.len() > 1024 {
7572 return Err(::fidl_next::DecodeError::VectorTooLong {
7573 size: name.len() as u64,
7574 limit: 1024,
7575 });
7576 }
7577
7578 Ok(())
7579 }
7580
7581 2 => {
7582 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
7583 slot.as_mut(),
7584 decoder,
7585 )?;
7586
7587 let url = unsafe {
7588 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
7589 };
7590
7591 if url.len() > 4096 {
7592 return Err(::fidl_next::DecodeError::VectorTooLong {
7593 size: url.len() as u64,
7594 limit: 4096,
7595 });
7596 }
7597
7598 Ok(())
7599 }
7600
7601 3 => {
7602 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireStartupMode>(
7603 slot.as_mut(),
7604 decoder,
7605 )?;
7606
7607 Ok(())
7608 }
7609
7610 4 => {
7611 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
7612 slot.as_mut(),
7613 decoder,
7614 )?;
7615
7616 let environment = unsafe {
7617 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
7618 };
7619
7620 if environment.len() > 100 {
7621 return Err(::fidl_next::DecodeError::VectorTooLong {
7622 size: environment.len() as u64,
7623 limit: 100,
7624 });
7625 }
7626
7627 Ok(())
7628 }
7629
7630 5 => {
7631 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireOnTerminate>(
7632 slot.as_mut(),
7633 decoder,
7634 )?;
7635
7636 Ok(())
7637 }
7638
7639 6 => {
7640 ::fidl_next::WireEnvelope::decode_as::<
7641 ___D,
7642 ::fidl_next::WireVector<crate::WireConfigOverride>,
7643 >(slot.as_mut(), decoder)?;
7644
7645 Ok(())
7646 }
7647
7648 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
7649 }
7650 })
7651 }
7652}
7653
7654impl WireChild {
7655 pub fn name(&self) -> Option<&::fidl_next::WireString> {
7656 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
7657 }
7658
7659 pub fn url(&self) -> Option<&::fidl_next::WireString> {
7660 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
7661 }
7662
7663 pub fn startup(&self) -> Option<&crate::WireStartupMode> {
7664 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
7665 }
7666
7667 pub fn environment(&self) -> Option<&::fidl_next::WireString> {
7668 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
7669 }
7670
7671 pub fn on_terminate(&self) -> Option<&crate::WireOnTerminate> {
7672 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
7673 }
7674
7675 pub fn config_overrides(&self) -> Option<&::fidl_next::WireVector<crate::WireConfigOverride>> {
7676 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
7677 }
7678}
7679
7680impl ::core::fmt::Debug for WireChild {
7681 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
7682 f.debug_struct("Child")
7683 .field("name", &self.name())
7684 .field("url", &self.url())
7685 .field("startup", &self.startup())
7686 .field("environment", &self.environment())
7687 .field("on_terminate", &self.on_terminate())
7688 .field("config_overrides", &self.config_overrides())
7689 .finish()
7690 }
7691}
7692
7693#[doc = " The durability of component instances created in a collection.\n"]
7694#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7695#[repr(u32)]
7696pub enum Durability {
7697 Transient = 2,
7698 SingleRun = 3,
7699}
7700
7701impl ::fidl_next::Encodable for Durability {
7702 type Encoded = WireDurability;
7703}
7704impl ::std::convert::TryFrom<u32> for Durability {
7705 type Error = ::fidl_next::UnknownStrictEnumMemberError;
7706 fn try_from(value: u32) -> Result<Self, Self::Error> {
7707 match value {
7708 2 => Ok(Self::Transient),
7709 3 => Ok(Self::SingleRun),
7710
7711 _ => Err(Self::Error::new(value.into())),
7712 }
7713 }
7714}
7715
7716unsafe impl<___E> ::fidl_next::Encode<___E> for Durability
7717where
7718 ___E: ?Sized,
7719{
7720 #[inline]
7721 fn encode(
7722 self,
7723 encoder: &mut ___E,
7724 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7725 ) -> Result<(), ::fidl_next::EncodeError> {
7726 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
7727 }
7728}
7729
7730unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Durability
7731where
7732 ___E: ?Sized,
7733{
7734 #[inline]
7735 fn encode_ref(
7736 &self,
7737 encoder: &mut ___E,
7738 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7739 ) -> Result<(), ::fidl_next::EncodeError> {
7740 ::fidl_next::munge!(let WireDurability { value } = out);
7741 let _ = value.write(::fidl_next::WireU32::from(match *self {
7742 Self::Transient => 2,
7743
7744 Self::SingleRun => 3,
7745 }));
7746
7747 Ok(())
7748 }
7749}
7750
7751impl ::core::convert::From<WireDurability> for Durability {
7752 fn from(wire: WireDurability) -> Self {
7753 match u32::from(wire.value) {
7754 2 => Self::Transient,
7755
7756 3 => Self::SingleRun,
7757
7758 _ => unsafe { ::core::hint::unreachable_unchecked() },
7759 }
7760 }
7761}
7762
7763impl ::fidl_next::TakeFrom<WireDurability> for Durability {
7764 #[inline]
7765 fn take_from(from: &WireDurability) -> Self {
7766 Self::from(*from)
7767 }
7768}
7769
7770#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7772#[repr(transparent)]
7773pub struct WireDurability {
7774 value: ::fidl_next::WireU32,
7775}
7776
7777unsafe impl ::fidl_next::ZeroPadding for WireDurability {
7778 #[inline]
7779 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
7780 }
7782}
7783
7784impl WireDurability {
7785 pub const TRANSIENT: WireDurability = WireDurability { value: ::fidl_next::WireU32(2) };
7786
7787 pub const SINGLE_RUN: WireDurability = WireDurability { value: ::fidl_next::WireU32(3) };
7788}
7789
7790unsafe impl<___D> ::fidl_next::Decode<___D> for WireDurability
7791where
7792 ___D: ?Sized,
7793{
7794 fn decode(
7795 slot: ::fidl_next::Slot<'_, Self>,
7796 _: &mut ___D,
7797 ) -> Result<(), ::fidl_next::DecodeError> {
7798 ::fidl_next::munge!(let Self { value } = slot);
7799
7800 match u32::from(*value) {
7801 2 | 3 => (),
7802 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
7803 }
7804
7805 Ok(())
7806 }
7807}
7808
7809impl ::core::convert::From<Durability> for WireDurability {
7810 fn from(natural: Durability) -> Self {
7811 match natural {
7812 Durability::Transient => WireDurability::TRANSIENT,
7813
7814 Durability::SingleRun => WireDurability::SINGLE_RUN,
7815 }
7816 }
7817}
7818
7819#[doc = " Statically declares a component instance collection.\n"]
7820#[derive(Clone, Debug, Default)]
7821pub struct Collection {
7822 pub name: Option<String>,
7823
7824 pub durability: Option<crate::Durability>,
7825
7826 pub environment: Option<String>,
7827
7828 pub allowed_offers: Option<crate::AllowedOffers>,
7829
7830 pub allow_long_names: Option<bool>,
7831
7832 pub persistent_storage: Option<bool>,
7833}
7834
7835impl Collection {
7836 fn __max_ordinal(&self) -> usize {
7837 if self.name.is_some() {
7838 return 1;
7839 }
7840
7841 if self.durability.is_some() {
7842 return 2;
7843 }
7844
7845 if self.environment.is_some() {
7846 return 3;
7847 }
7848
7849 if self.allowed_offers.is_some() {
7850 return 4;
7851 }
7852
7853 if self.allow_long_names.is_some() {
7854 return 5;
7855 }
7856
7857 if self.persistent_storage.is_some() {
7858 return 6;
7859 }
7860
7861 0
7862 }
7863}
7864
7865impl ::fidl_next::Encodable for Collection {
7866 type Encoded = WireCollection;
7867}
7868
7869unsafe impl<___E> ::fidl_next::Encode<___E> for Collection
7870where
7871 ___E: ::fidl_next::Encoder + ?Sized,
7872{
7873 #[inline]
7874 fn encode(
7875 mut self,
7876 encoder: &mut ___E,
7877 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7878 ) -> Result<(), ::fidl_next::EncodeError> {
7879 ::fidl_next::munge!(let WireCollection { table } = out);
7880
7881 let max_ord = self.__max_ordinal();
7882
7883 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7884 ::fidl_next::ZeroPadding::zero_padding(&mut out);
7885
7886 let mut preallocated =
7887 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7888
7889 for i in 1..=max_ord {
7890 match i {
7891 6 => {
7892 if let Some(persistent_storage) = self.persistent_storage.take() {
7893 ::fidl_next::WireEnvelope::encode_value(
7894 persistent_storage,
7895 preallocated.encoder,
7896 &mut out,
7897 )?;
7898 } else {
7899 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7900 }
7901 }
7902
7903 5 => {
7904 if let Some(allow_long_names) = self.allow_long_names.take() {
7905 ::fidl_next::WireEnvelope::encode_value(
7906 allow_long_names,
7907 preallocated.encoder,
7908 &mut out,
7909 )?;
7910 } else {
7911 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7912 }
7913 }
7914
7915 4 => {
7916 if let Some(allowed_offers) = self.allowed_offers.take() {
7917 ::fidl_next::WireEnvelope::encode_value(
7918 allowed_offers,
7919 preallocated.encoder,
7920 &mut out,
7921 )?;
7922 } else {
7923 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7924 }
7925 }
7926
7927 3 => {
7928 if let Some(environment) = self.environment.take() {
7929 ::fidl_next::WireEnvelope::encode_value(
7930 environment,
7931 preallocated.encoder,
7932 &mut out,
7933 )?;
7934 } else {
7935 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7936 }
7937 }
7938
7939 2 => {
7940 if let Some(durability) = self.durability.take() {
7941 ::fidl_next::WireEnvelope::encode_value(
7942 durability,
7943 preallocated.encoder,
7944 &mut out,
7945 )?;
7946 } else {
7947 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7948 }
7949 }
7950
7951 1 => {
7952 if let Some(name) = self.name.take() {
7953 ::fidl_next::WireEnvelope::encode_value(
7954 name,
7955 preallocated.encoder,
7956 &mut out,
7957 )?;
7958 } else {
7959 ::fidl_next::WireEnvelope::encode_zero(&mut out)
7960 }
7961 }
7962
7963 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
7964 }
7965 unsafe {
7966 preallocated.write_next(out.assume_init_ref());
7967 }
7968 }
7969
7970 ::fidl_next::WireTable::encode_len(table, max_ord);
7971
7972 Ok(())
7973 }
7974}
7975
7976unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Collection
7977where
7978 ___E: ::fidl_next::Encoder + ?Sized,
7979{
7980 #[inline]
7981 fn encode_ref(
7982 &self,
7983 encoder: &mut ___E,
7984 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
7985 ) -> Result<(), ::fidl_next::EncodeError> {
7986 ::fidl_next::munge!(let WireCollection { table } = out);
7987
7988 let max_ord = self.__max_ordinal();
7989
7990 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
7991 ::fidl_next::ZeroPadding::zero_padding(&mut out);
7992
7993 let mut preallocated =
7994 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
7995
7996 for i in 1..=max_ord {
7997 match i {
7998 6 => {
7999 if let Some(persistent_storage) = &self.persistent_storage {
8000 ::fidl_next::WireEnvelope::encode_value(
8001 persistent_storage,
8002 preallocated.encoder,
8003 &mut out,
8004 )?;
8005 } else {
8006 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8007 }
8008 }
8009
8010 5 => {
8011 if let Some(allow_long_names) = &self.allow_long_names {
8012 ::fidl_next::WireEnvelope::encode_value(
8013 allow_long_names,
8014 preallocated.encoder,
8015 &mut out,
8016 )?;
8017 } else {
8018 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8019 }
8020 }
8021
8022 4 => {
8023 if let Some(allowed_offers) = &self.allowed_offers {
8024 ::fidl_next::WireEnvelope::encode_value(
8025 allowed_offers,
8026 preallocated.encoder,
8027 &mut out,
8028 )?;
8029 } else {
8030 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8031 }
8032 }
8033
8034 3 => {
8035 if let Some(environment) = &self.environment {
8036 ::fidl_next::WireEnvelope::encode_value(
8037 environment,
8038 preallocated.encoder,
8039 &mut out,
8040 )?;
8041 } else {
8042 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8043 }
8044 }
8045
8046 2 => {
8047 if let Some(durability) = &self.durability {
8048 ::fidl_next::WireEnvelope::encode_value(
8049 durability,
8050 preallocated.encoder,
8051 &mut out,
8052 )?;
8053 } else {
8054 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8055 }
8056 }
8057
8058 1 => {
8059 if let Some(name) = &self.name {
8060 ::fidl_next::WireEnvelope::encode_value(
8061 name,
8062 preallocated.encoder,
8063 &mut out,
8064 )?;
8065 } else {
8066 ::fidl_next::WireEnvelope::encode_zero(&mut out)
8067 }
8068 }
8069
8070 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
8071 }
8072 unsafe {
8073 preallocated.write_next(out.assume_init_ref());
8074 }
8075 }
8076
8077 ::fidl_next::WireTable::encode_len(table, max_ord);
8078
8079 Ok(())
8080 }
8081}
8082
8083impl ::fidl_next::TakeFrom<WireCollection> for Collection {
8084 #[inline]
8085 fn take_from(from: &WireCollection) -> Self {
8086 Self {
8087 name: from.name().map(::fidl_next::TakeFrom::take_from),
8088
8089 durability: from.durability().map(::fidl_next::TakeFrom::take_from),
8090
8091 environment: from.environment().map(::fidl_next::TakeFrom::take_from),
8092
8093 allowed_offers: from.allowed_offers().map(::fidl_next::TakeFrom::take_from),
8094
8095 allow_long_names: from.allow_long_names().map(::fidl_next::TakeFrom::take_from),
8096
8097 persistent_storage: from.persistent_storage().map(::fidl_next::TakeFrom::take_from),
8098 }
8099 }
8100}
8101
8102#[repr(C)]
8104pub struct WireCollection {
8105 table: ::fidl_next::WireTable,
8106}
8107
8108unsafe impl ::fidl_next::ZeroPadding for WireCollection {
8109 #[inline]
8110 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
8111 ::fidl_next::munge!(let Self { table } = out);
8112 ::fidl_next::WireTable::zero_padding(table);
8113 }
8114}
8115
8116unsafe impl<___D> ::fidl_next::Decode<___D> for WireCollection
8117where
8118 ___D: ::fidl_next::Decoder + ?Sized,
8119{
8120 fn decode(
8121 slot: ::fidl_next::Slot<'_, Self>,
8122 decoder: &mut ___D,
8123 ) -> Result<(), ::fidl_next::DecodeError> {
8124 ::fidl_next::munge!(let Self { table } = slot);
8125
8126 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
8127 match ordinal {
8128 0 => unsafe { ::core::hint::unreachable_unchecked() },
8129
8130 1 => {
8131 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
8132 slot.as_mut(),
8133 decoder,
8134 )?;
8135
8136 let name = unsafe {
8137 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
8138 };
8139
8140 if name.len() > 100 {
8141 return Err(::fidl_next::DecodeError::VectorTooLong {
8142 size: name.len() as u64,
8143 limit: 100,
8144 });
8145 }
8146
8147 Ok(())
8148 }
8149
8150 2 => {
8151 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDurability>(
8152 slot.as_mut(),
8153 decoder,
8154 )?;
8155
8156 Ok(())
8157 }
8158
8159 3 => {
8160 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
8161 slot.as_mut(),
8162 decoder,
8163 )?;
8164
8165 let environment = unsafe {
8166 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
8167 };
8168
8169 if environment.len() > 100 {
8170 return Err(::fidl_next::DecodeError::VectorTooLong {
8171 size: environment.len() as u64,
8172 limit: 100,
8173 });
8174 }
8175
8176 Ok(())
8177 }
8178
8179 4 => {
8180 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAllowedOffers>(
8181 slot.as_mut(),
8182 decoder,
8183 )?;
8184
8185 Ok(())
8186 }
8187
8188 5 => {
8189 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
8190
8191 Ok(())
8192 }
8193
8194 6 => {
8195 ::fidl_next::WireEnvelope::decode_as::<___D, bool>(slot.as_mut(), decoder)?;
8196
8197 Ok(())
8198 }
8199
8200 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
8201 }
8202 })
8203 }
8204}
8205
8206impl WireCollection {
8207 pub fn name(&self) -> Option<&::fidl_next::WireString> {
8208 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
8209 }
8210
8211 pub fn durability(&self) -> Option<&crate::WireDurability> {
8212 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
8213 }
8214
8215 pub fn environment(&self) -> Option<&::fidl_next::WireString> {
8216 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
8217 }
8218
8219 pub fn allowed_offers(&self) -> Option<&crate::WireAllowedOffers> {
8220 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
8221 }
8222
8223 pub fn allow_long_names(&self) -> Option<&bool> {
8224 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
8225 }
8226
8227 pub fn persistent_storage(&self) -> Option<&bool> {
8228 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
8229 }
8230}
8231
8232impl ::core::fmt::Debug for WireCollection {
8233 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
8234 f.debug_struct("Collection")
8235 .field("name", &self.name())
8236 .field("durability", &self.durability())
8237 .field("environment", &self.environment())
8238 .field("allowed_offers", &self.allowed_offers())
8239 .field("allow_long_names", &self.allow_long_names())
8240 .field("persistent_storage", &self.persistent_storage())
8241 .finish()
8242 }
8243}
8244
8245#[doc = " Describes the type of dependency implied by the capability.\n"]
8246#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8247#[repr(u32)]
8248pub enum DependencyType {
8249 Strong = 1,
8250 Weak = 2,
8251}
8252
8253impl ::fidl_next::Encodable for DependencyType {
8254 type Encoded = WireDependencyType;
8255}
8256impl ::std::convert::TryFrom<u32> for DependencyType {
8257 type Error = ::fidl_next::UnknownStrictEnumMemberError;
8258 fn try_from(value: u32) -> Result<Self, Self::Error> {
8259 match value {
8260 1 => Ok(Self::Strong),
8261 2 => Ok(Self::Weak),
8262
8263 _ => Err(Self::Error::new(value.into())),
8264 }
8265 }
8266}
8267
8268unsafe impl<___E> ::fidl_next::Encode<___E> for DependencyType
8269where
8270 ___E: ?Sized,
8271{
8272 #[inline]
8273 fn encode(
8274 self,
8275 encoder: &mut ___E,
8276 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8277 ) -> Result<(), ::fidl_next::EncodeError> {
8278 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
8279 }
8280}
8281
8282unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DependencyType
8283where
8284 ___E: ?Sized,
8285{
8286 #[inline]
8287 fn encode_ref(
8288 &self,
8289 encoder: &mut ___E,
8290 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8291 ) -> Result<(), ::fidl_next::EncodeError> {
8292 ::fidl_next::munge!(let WireDependencyType { value } = out);
8293 let _ = value.write(::fidl_next::WireU32::from(match *self {
8294 Self::Strong => 1,
8295
8296 Self::Weak => 2,
8297 }));
8298
8299 Ok(())
8300 }
8301}
8302
8303impl ::core::convert::From<WireDependencyType> for DependencyType {
8304 fn from(wire: WireDependencyType) -> Self {
8305 match u32::from(wire.value) {
8306 1 => Self::Strong,
8307
8308 2 => Self::Weak,
8309
8310 _ => unsafe { ::core::hint::unreachable_unchecked() },
8311 }
8312 }
8313}
8314
8315impl ::fidl_next::TakeFrom<WireDependencyType> for DependencyType {
8316 #[inline]
8317 fn take_from(from: &WireDependencyType) -> Self {
8318 Self::from(*from)
8319 }
8320}
8321
8322#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8324#[repr(transparent)]
8325pub struct WireDependencyType {
8326 value: ::fidl_next::WireU32,
8327}
8328
8329unsafe impl ::fidl_next::ZeroPadding for WireDependencyType {
8330 #[inline]
8331 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
8332 }
8334}
8335
8336impl WireDependencyType {
8337 pub const STRONG: WireDependencyType = WireDependencyType { value: ::fidl_next::WireU32(1) };
8338
8339 pub const WEAK: WireDependencyType = WireDependencyType { value: ::fidl_next::WireU32(2) };
8340}
8341
8342unsafe impl<___D> ::fidl_next::Decode<___D> for WireDependencyType
8343where
8344 ___D: ?Sized,
8345{
8346 fn decode(
8347 slot: ::fidl_next::Slot<'_, Self>,
8348 _: &mut ___D,
8349 ) -> Result<(), ::fidl_next::DecodeError> {
8350 ::fidl_next::munge!(let Self { value } = slot);
8351
8352 match u32::from(*value) {
8353 1 | 2 => (),
8354 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
8355 }
8356
8357 Ok(())
8358 }
8359}
8360
8361impl ::core::convert::From<DependencyType> for WireDependencyType {
8362 fn from(natural: DependencyType) -> Self {
8363 match natural {
8364 DependencyType::Strong => WireDependencyType::STRONG,
8365
8366 DependencyType::Weak => WireDependencyType::WEAK,
8367 }
8368 }
8369}
8370
8371#[doc = " Type used to create a mapping between 2 names. Used to rename service or component instances\n in FIDL declarations.\n"]
8372#[derive(Clone, Debug)]
8373pub struct NameMapping {
8374 pub source_name: String,
8375
8376 pub target_name: String,
8377}
8378
8379impl ::fidl_next::Encodable for NameMapping {
8380 type Encoded = WireNameMapping;
8381}
8382
8383unsafe impl<___E> ::fidl_next::Encode<___E> for NameMapping
8384where
8385 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
8386
8387 ___E: ::fidl_next::Encoder,
8388{
8389 #[inline]
8390 fn encode(
8391 self,
8392 encoder: &mut ___E,
8393 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8394 ) -> Result<(), ::fidl_next::EncodeError> {
8395 ::fidl_next::munge! {
8396 let Self::Encoded {
8397 source_name,
8398 target_name,
8399
8400 } = out;
8401 }
8402
8403 ::fidl_next::Encode::encode(self.source_name, encoder, source_name)?;
8404
8405 ::fidl_next::Encode::encode(self.target_name, encoder, target_name)?;
8406
8407 Ok(())
8408 }
8409}
8410
8411unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NameMapping
8412where
8413 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
8414
8415 ___E: ::fidl_next::Encoder,
8416{
8417 #[inline]
8418 fn encode_ref(
8419 &self,
8420 encoder: &mut ___E,
8421 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8422 ) -> Result<(), ::fidl_next::EncodeError> {
8423 ::fidl_next::munge! {
8424 let Self::Encoded {
8425 source_name,
8426 target_name,
8427
8428 } = out;
8429 }
8430
8431 ::fidl_next::EncodeRef::encode_ref(&self.source_name, encoder, source_name)?;
8432
8433 ::fidl_next::EncodeRef::encode_ref(&self.target_name, encoder, target_name)?;
8434
8435 Ok(())
8436 }
8437}
8438
8439impl ::fidl_next::EncodableOption for Box<NameMapping> {
8440 type EncodedOption = ::fidl_next::WireBox<WireNameMapping>;
8441}
8442
8443unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<NameMapping>
8444where
8445 ___E: ::fidl_next::Encoder + ?Sized,
8446 NameMapping: ::fidl_next::Encode<___E>,
8447{
8448 #[inline]
8449 fn encode_option(
8450 this: Option<Self>,
8451 encoder: &mut ___E,
8452 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
8453 ) -> Result<(), ::fidl_next::EncodeError> {
8454 if let Some(inner) = this {
8455 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
8456 ::fidl_next::WireBox::encode_present(out);
8457 } else {
8458 ::fidl_next::WireBox::encode_absent(out);
8459 }
8460
8461 Ok(())
8462 }
8463}
8464
8465unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<NameMapping>
8466where
8467 ___E: ::fidl_next::Encoder + ?Sized,
8468 NameMapping: ::fidl_next::EncodeRef<___E>,
8469{
8470 #[inline]
8471 fn encode_option_ref(
8472 this: Option<&Self>,
8473 encoder: &mut ___E,
8474 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
8475 ) -> Result<(), ::fidl_next::EncodeError> {
8476 if let Some(inner) = this {
8477 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
8478 ::fidl_next::WireBox::encode_present(out);
8479 } else {
8480 ::fidl_next::WireBox::encode_absent(out);
8481 }
8482
8483 Ok(())
8484 }
8485}
8486
8487impl ::fidl_next::TakeFrom<WireNameMapping> for NameMapping {
8488 #[inline]
8489 fn take_from(from: &WireNameMapping) -> Self {
8490 Self {
8491 source_name: ::fidl_next::TakeFrom::take_from(&from.source_name),
8492
8493 target_name: ::fidl_next::TakeFrom::take_from(&from.target_name),
8494 }
8495 }
8496}
8497
8498#[derive(Debug)]
8500#[repr(C)]
8501pub struct WireNameMapping {
8502 pub source_name: ::fidl_next::WireString,
8503
8504 pub target_name: ::fidl_next::WireString,
8505}
8506
8507unsafe impl ::fidl_next::ZeroPadding for WireNameMapping {
8508 #[inline]
8509 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
8510}
8511
8512unsafe impl<___D> ::fidl_next::Decode<___D> for WireNameMapping
8513where
8514 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
8515
8516 ___D: ::fidl_next::Decoder,
8517{
8518 fn decode(
8519 slot: ::fidl_next::Slot<'_, Self>,
8520 decoder: &mut ___D,
8521 ) -> Result<(), ::fidl_next::DecodeError> {
8522 ::fidl_next::munge! {
8523 let Self {
8524 mut source_name,
8525 mut target_name,
8526
8527 } = slot;
8528 }
8529
8530 ::fidl_next::Decode::decode(source_name.as_mut(), decoder)?;
8531
8532 let source_name = unsafe { source_name.deref_unchecked() };
8533
8534 if source_name.len() > 100 {
8535 return Err(::fidl_next::DecodeError::VectorTooLong {
8536 size: source_name.len() as u64,
8537 limit: 100,
8538 });
8539 }
8540
8541 ::fidl_next::Decode::decode(target_name.as_mut(), decoder)?;
8542
8543 let target_name = unsafe { target_name.deref_unchecked() };
8544
8545 if target_name.len() > 100 {
8546 return Err(::fidl_next::DecodeError::VectorTooLong {
8547 size: target_name.len() as u64,
8548 limit: 100,
8549 });
8550 }
8551
8552 Ok(())
8553 }
8554}
8555
8556#[doc = " Specifies how a declared environment\'s initial set of properties are assigned.\n"]
8557#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8558#[repr(u32)]
8559pub enum EnvironmentExtends {
8560 None = 0,
8561 Realm = 1,
8562}
8563
8564impl ::fidl_next::Encodable for EnvironmentExtends {
8565 type Encoded = WireEnvironmentExtends;
8566}
8567impl ::std::convert::TryFrom<u32> for EnvironmentExtends {
8568 type Error = ::fidl_next::UnknownStrictEnumMemberError;
8569 fn try_from(value: u32) -> Result<Self, Self::Error> {
8570 match value {
8571 0 => Ok(Self::None),
8572 1 => Ok(Self::Realm),
8573
8574 _ => Err(Self::Error::new(value.into())),
8575 }
8576 }
8577}
8578
8579unsafe impl<___E> ::fidl_next::Encode<___E> for EnvironmentExtends
8580where
8581 ___E: ?Sized,
8582{
8583 #[inline]
8584 fn encode(
8585 self,
8586 encoder: &mut ___E,
8587 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8588 ) -> Result<(), ::fidl_next::EncodeError> {
8589 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
8590 }
8591}
8592
8593unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EnvironmentExtends
8594where
8595 ___E: ?Sized,
8596{
8597 #[inline]
8598 fn encode_ref(
8599 &self,
8600 encoder: &mut ___E,
8601 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8602 ) -> Result<(), ::fidl_next::EncodeError> {
8603 ::fidl_next::munge!(let WireEnvironmentExtends { value } = out);
8604 let _ = value.write(::fidl_next::WireU32::from(match *self {
8605 Self::None => 0,
8606
8607 Self::Realm => 1,
8608 }));
8609
8610 Ok(())
8611 }
8612}
8613
8614impl ::core::convert::From<WireEnvironmentExtends> for EnvironmentExtends {
8615 fn from(wire: WireEnvironmentExtends) -> Self {
8616 match u32::from(wire.value) {
8617 0 => Self::None,
8618
8619 1 => Self::Realm,
8620
8621 _ => unsafe { ::core::hint::unreachable_unchecked() },
8622 }
8623 }
8624}
8625
8626impl ::fidl_next::TakeFrom<WireEnvironmentExtends> for EnvironmentExtends {
8627 #[inline]
8628 fn take_from(from: &WireEnvironmentExtends) -> Self {
8629 Self::from(*from)
8630 }
8631}
8632
8633#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8635#[repr(transparent)]
8636pub struct WireEnvironmentExtends {
8637 value: ::fidl_next::WireU32,
8638}
8639
8640unsafe impl ::fidl_next::ZeroPadding for WireEnvironmentExtends {
8641 #[inline]
8642 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
8643 }
8645}
8646
8647impl WireEnvironmentExtends {
8648 pub const NONE: WireEnvironmentExtends =
8649 WireEnvironmentExtends { value: ::fidl_next::WireU32(0) };
8650
8651 pub const REALM: WireEnvironmentExtends =
8652 WireEnvironmentExtends { value: ::fidl_next::WireU32(1) };
8653}
8654
8655unsafe impl<___D> ::fidl_next::Decode<___D> for WireEnvironmentExtends
8656where
8657 ___D: ?Sized,
8658{
8659 fn decode(
8660 slot: ::fidl_next::Slot<'_, Self>,
8661 _: &mut ___D,
8662 ) -> Result<(), ::fidl_next::DecodeError> {
8663 ::fidl_next::munge!(let Self { value } = slot);
8664
8665 match u32::from(*value) {
8666 0 | 1 => (),
8667 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
8668 }
8669
8670 Ok(())
8671 }
8672}
8673
8674impl ::core::convert::From<EnvironmentExtends> for WireEnvironmentExtends {
8675 fn from(natural: EnvironmentExtends) -> Self {
8676 match natural {
8677 EnvironmentExtends::None => WireEnvironmentExtends::NONE,
8678
8679 EnvironmentExtends::Realm => WireEnvironmentExtends::REALM,
8680 }
8681 }
8682}
8683
8684pub const MAX_URL_SCHEME_LENGTH: u32 = 100;
8685
8686pub type UrlScheme = String;
8687
8688pub type WireUrlScheme = ::fidl_next::WireString;
8690
8691#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8692#[repr(u32)]
8693pub enum ConfigTypeLayout {
8694 Bool = 1,
8695 Uint8 = 2,
8696 Uint16 = 3,
8697 Uint32 = 4,
8698 Uint64 = 5,
8699 Int8 = 6,
8700 Int16 = 7,
8701 Int32 = 8,
8702 Int64 = 9,
8703 String = 10,
8704 Vector = 11,
8705 UnknownOrdinal_(u32),
8706}
8707
8708impl ::fidl_next::Encodable for ConfigTypeLayout {
8709 type Encoded = WireConfigTypeLayout;
8710}
8711impl ::std::convert::From<u32> for ConfigTypeLayout {
8712 fn from(value: u32) -> Self {
8713 match value {
8714 1 => Self::Bool,
8715 2 => Self::Uint8,
8716 3 => Self::Uint16,
8717 4 => Self::Uint32,
8718 5 => Self::Uint64,
8719 6 => Self::Int8,
8720 7 => Self::Int16,
8721 8 => Self::Int32,
8722 9 => Self::Int64,
8723 10 => Self::String,
8724 11 => Self::Vector,
8725
8726 _ => Self::UnknownOrdinal_(value),
8727 }
8728 }
8729}
8730
8731unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigTypeLayout
8732where
8733 ___E: ?Sized,
8734{
8735 #[inline]
8736 fn encode(
8737 self,
8738 encoder: &mut ___E,
8739 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8740 ) -> Result<(), ::fidl_next::EncodeError> {
8741 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
8742 }
8743}
8744
8745unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigTypeLayout
8746where
8747 ___E: ?Sized,
8748{
8749 #[inline]
8750 fn encode_ref(
8751 &self,
8752 encoder: &mut ___E,
8753 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8754 ) -> Result<(), ::fidl_next::EncodeError> {
8755 ::fidl_next::munge!(let WireConfigTypeLayout { value } = out);
8756 let _ = value.write(::fidl_next::WireU32::from(match *self {
8757 Self::Bool => 1,
8758
8759 Self::Uint8 => 2,
8760
8761 Self::Uint16 => 3,
8762
8763 Self::Uint32 => 4,
8764
8765 Self::Uint64 => 5,
8766
8767 Self::Int8 => 6,
8768
8769 Self::Int16 => 7,
8770
8771 Self::Int32 => 8,
8772
8773 Self::Int64 => 9,
8774
8775 Self::String => 10,
8776
8777 Self::Vector => 11,
8778
8779 Self::UnknownOrdinal_(value) => value,
8780 }));
8781
8782 Ok(())
8783 }
8784}
8785
8786impl ::core::convert::From<WireConfigTypeLayout> for ConfigTypeLayout {
8787 fn from(wire: WireConfigTypeLayout) -> Self {
8788 match u32::from(wire.value) {
8789 1 => Self::Bool,
8790
8791 2 => Self::Uint8,
8792
8793 3 => Self::Uint16,
8794
8795 4 => Self::Uint32,
8796
8797 5 => Self::Uint64,
8798
8799 6 => Self::Int8,
8800
8801 7 => Self::Int16,
8802
8803 8 => Self::Int32,
8804
8805 9 => Self::Int64,
8806
8807 10 => Self::String,
8808
8809 11 => Self::Vector,
8810
8811 value => Self::UnknownOrdinal_(value),
8812 }
8813 }
8814}
8815
8816impl ::fidl_next::TakeFrom<WireConfigTypeLayout> for ConfigTypeLayout {
8817 #[inline]
8818 fn take_from(from: &WireConfigTypeLayout) -> Self {
8819 Self::from(*from)
8820 }
8821}
8822
8823#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8825#[repr(transparent)]
8826pub struct WireConfigTypeLayout {
8827 value: ::fidl_next::WireU32,
8828}
8829
8830unsafe impl ::fidl_next::ZeroPadding for WireConfigTypeLayout {
8831 #[inline]
8832 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
8833 }
8835}
8836
8837impl WireConfigTypeLayout {
8838 pub const BOOL: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(1) };
8839
8840 pub const UINT8: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(2) };
8841
8842 pub const UINT16: WireConfigTypeLayout =
8843 WireConfigTypeLayout { value: ::fidl_next::WireU32(3) };
8844
8845 pub const UINT32: WireConfigTypeLayout =
8846 WireConfigTypeLayout { value: ::fidl_next::WireU32(4) };
8847
8848 pub const UINT64: WireConfigTypeLayout =
8849 WireConfigTypeLayout { value: ::fidl_next::WireU32(5) };
8850
8851 pub const INT8: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(6) };
8852
8853 pub const INT16: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(7) };
8854
8855 pub const INT32: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(8) };
8856
8857 pub const INT64: WireConfigTypeLayout = WireConfigTypeLayout { value: ::fidl_next::WireU32(9) };
8858
8859 pub const STRING: WireConfigTypeLayout =
8860 WireConfigTypeLayout { value: ::fidl_next::WireU32(10) };
8861
8862 pub const VECTOR: WireConfigTypeLayout =
8863 WireConfigTypeLayout { value: ::fidl_next::WireU32(11) };
8864}
8865
8866unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigTypeLayout
8867where
8868 ___D: ?Sized,
8869{
8870 fn decode(
8871 slot: ::fidl_next::Slot<'_, Self>,
8872 _: &mut ___D,
8873 ) -> Result<(), ::fidl_next::DecodeError> {
8874 Ok(())
8875 }
8876}
8877
8878impl ::core::convert::From<ConfigTypeLayout> for WireConfigTypeLayout {
8879 fn from(natural: ConfigTypeLayout) -> Self {
8880 match natural {
8881 ConfigTypeLayout::Bool => WireConfigTypeLayout::BOOL,
8882
8883 ConfigTypeLayout::Uint8 => WireConfigTypeLayout::UINT8,
8884
8885 ConfigTypeLayout::Uint16 => WireConfigTypeLayout::UINT16,
8886
8887 ConfigTypeLayout::Uint32 => WireConfigTypeLayout::UINT32,
8888
8889 ConfigTypeLayout::Uint64 => WireConfigTypeLayout::UINT64,
8890
8891 ConfigTypeLayout::Int8 => WireConfigTypeLayout::INT8,
8892
8893 ConfigTypeLayout::Int16 => WireConfigTypeLayout::INT16,
8894
8895 ConfigTypeLayout::Int32 => WireConfigTypeLayout::INT32,
8896
8897 ConfigTypeLayout::Int64 => WireConfigTypeLayout::INT64,
8898
8899 ConfigTypeLayout::String => WireConfigTypeLayout::STRING,
8900
8901 ConfigTypeLayout::Vector => WireConfigTypeLayout::VECTOR,
8902
8903 ConfigTypeLayout::UnknownOrdinal_(value) => {
8904 WireConfigTypeLayout { value: ::fidl_next::WireU32::from(value) }
8905 }
8906 }
8907 }
8908}
8909
8910#[derive(Clone, Debug)]
8911pub enum LayoutConstraint {
8912 MaxSize(u32),
8913
8914 UnknownOrdinal_(u64),
8915}
8916
8917impl ::fidl_next::Encodable for LayoutConstraint {
8918 type Encoded = WireLayoutConstraint;
8919}
8920
8921unsafe impl<___E> ::fidl_next::Encode<___E> for LayoutConstraint
8922where
8923 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
8924{
8925 #[inline]
8926 fn encode(
8927 self,
8928 encoder: &mut ___E,
8929 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8930 ) -> Result<(), ::fidl_next::EncodeError> {
8931 ::fidl_next::munge!(let WireLayoutConstraint { raw } = out);
8932
8933 match self {
8934 Self::MaxSize(value) => {
8935 ::fidl_next::RawWireUnion::encode_as_static::<___E, u32>(value, 1, encoder, raw)?
8936 }
8937
8938 Self::UnknownOrdinal_(ordinal) => {
8939 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
8940 }
8941 }
8942
8943 Ok(())
8944 }
8945}
8946
8947unsafe impl<___E> ::fidl_next::EncodeRef<___E> for LayoutConstraint
8948where
8949 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
8950{
8951 #[inline]
8952 fn encode_ref(
8953 &self,
8954 encoder: &mut ___E,
8955 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
8956 ) -> Result<(), ::fidl_next::EncodeError> {
8957 ::fidl_next::munge!(let WireLayoutConstraint { raw } = out);
8958
8959 match self {
8960 Self::MaxSize(value) => {
8961 ::fidl_next::RawWireUnion::encode_as_static::<___E, &u32>(value, 1, encoder, raw)?
8962 }
8963
8964 Self::UnknownOrdinal_(ordinal) => {
8965 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
8966 }
8967 }
8968
8969 Ok(())
8970 }
8971}
8972
8973impl ::fidl_next::EncodableOption for Box<LayoutConstraint> {
8974 type EncodedOption = WireOptionalLayoutConstraint;
8975}
8976
8977unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<LayoutConstraint>
8978where
8979 ___E: ?Sized,
8980 LayoutConstraint: ::fidl_next::Encode<___E>,
8981{
8982 #[inline]
8983 fn encode_option(
8984 this: Option<Self>,
8985 encoder: &mut ___E,
8986 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
8987 ) -> Result<(), ::fidl_next::EncodeError> {
8988 ::fidl_next::munge!(let WireOptionalLayoutConstraint { raw } = &mut *out);
8989
8990 if let Some(inner) = this {
8991 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
8992 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
8993 } else {
8994 ::fidl_next::RawWireUnion::encode_absent(raw);
8995 }
8996
8997 Ok(())
8998 }
8999}
9000
9001unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<LayoutConstraint>
9002where
9003 ___E: ?Sized,
9004 LayoutConstraint: ::fidl_next::EncodeRef<___E>,
9005{
9006 #[inline]
9007 fn encode_option_ref(
9008 this: Option<&Self>,
9009 encoder: &mut ___E,
9010 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
9011 ) -> Result<(), ::fidl_next::EncodeError> {
9012 ::fidl_next::munge!(let WireOptionalLayoutConstraint { raw } = &mut *out);
9013
9014 if let Some(inner) = this {
9015 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
9016 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
9017 } else {
9018 ::fidl_next::RawWireUnion::encode_absent(raw);
9019 }
9020
9021 Ok(())
9022 }
9023}
9024
9025impl ::fidl_next::TakeFrom<WireLayoutConstraint> for LayoutConstraint {
9026 #[inline]
9027 fn take_from(from: &WireLayoutConstraint) -> Self {
9028 match from.raw.ordinal() {
9029 1 => Self::MaxSize(::fidl_next::TakeFrom::take_from(unsafe {
9030 from.raw.get().deref_unchecked::<::fidl_next::WireU32>()
9031 })),
9032
9033 _ => unsafe { ::core::hint::unreachable_unchecked() },
9034 }
9035 }
9036}
9037
9038impl ::fidl_next::TakeFrom<WireOptionalLayoutConstraint> for Option<Box<LayoutConstraint>> {
9039 #[inline]
9040 fn take_from(from: &WireOptionalLayoutConstraint) -> Self {
9041 if let Some(inner) = from.as_ref() {
9042 Some(::fidl_next::TakeFrom::take_from(inner))
9043 } else {
9044 None
9045 }
9046 }
9047}
9048
9049#[repr(transparent)]
9051pub struct WireLayoutConstraint {
9052 raw: ::fidl_next::RawWireUnion,
9053}
9054
9055unsafe impl ::fidl_next::ZeroPadding for WireLayoutConstraint {
9056 #[inline]
9057 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9058 ::fidl_next::munge!(let Self { raw } = out);
9059 ::fidl_next::RawWireUnion::zero_padding(raw);
9060 }
9061}
9062
9063pub mod layout_constraint {
9064 pub enum Ref<'union> {
9065 MaxSize(&'union ::fidl_next::WireU32),
9066
9067 UnknownOrdinal_(u64),
9068 }
9069}
9070
9071impl WireLayoutConstraint {
9072 pub fn as_ref(&self) -> crate::layout_constraint::Ref<'_> {
9073 match self.raw.ordinal() {
9074 1 => crate::layout_constraint::Ref::MaxSize(unsafe {
9075 self.raw.get().deref_unchecked::<::fidl_next::WireU32>()
9076 }),
9077
9078 unknown => crate::layout_constraint::Ref::UnknownOrdinal_(unknown),
9079 }
9080 }
9081}
9082
9083impl Clone for WireLayoutConstraint {
9084 fn clone(&self) -> Self {
9085 match self.raw.ordinal() {
9086 1 => Self { raw: unsafe { self.raw.clone_unchecked::<::fidl_next::WireU32>() } },
9087
9088 _ => Self { raw: unsafe { self.raw.clone_unchecked::<()>() } },
9089 }
9090 }
9091}
9092
9093unsafe impl<___D> ::fidl_next::Decode<___D> for WireLayoutConstraint
9094where
9095 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
9096{
9097 fn decode(
9098 mut slot: ::fidl_next::Slot<'_, Self>,
9099 decoder: &mut ___D,
9100 ) -> Result<(), ::fidl_next::DecodeError> {
9101 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
9102 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
9103 1 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireU32>(
9104 raw, decoder,
9105 )?,
9106
9107 _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?,
9108 }
9109
9110 Ok(())
9111 }
9112}
9113
9114impl ::core::fmt::Debug for WireLayoutConstraint {
9115 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
9116 match self.raw.ordinal() {
9117 1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) },
9118 _ => unsafe { ::core::hint::unreachable_unchecked() },
9119 }
9120 }
9121}
9122
9123#[repr(transparent)]
9124pub struct WireOptionalLayoutConstraint {
9125 raw: ::fidl_next::RawWireUnion,
9126}
9127
9128unsafe impl ::fidl_next::ZeroPadding for WireOptionalLayoutConstraint {
9129 #[inline]
9130 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9131 ::fidl_next::munge!(let Self { raw } = out);
9132 ::fidl_next::RawWireUnion::zero_padding(raw);
9133 }
9134}
9135
9136impl WireOptionalLayoutConstraint {
9137 pub fn is_some(&self) -> bool {
9138 self.raw.is_some()
9139 }
9140
9141 pub fn is_none(&self) -> bool {
9142 self.raw.is_none()
9143 }
9144
9145 pub fn as_ref(&self) -> Option<&WireLayoutConstraint> {
9146 if self.is_some() {
9147 Some(unsafe { &*(self as *const Self).cast() })
9148 } else {
9149 None
9150 }
9151 }
9152}
9153
9154impl Clone for WireOptionalLayoutConstraint {
9155 fn clone(&self) -> Self {
9156 if self.is_none() {
9157 return WireOptionalLayoutConstraint { raw: ::fidl_next::RawWireUnion::absent() };
9158 }
9159
9160 match self.raw.ordinal() {
9161 1 => Self { raw: unsafe { self.raw.clone_unchecked::<::fidl_next::WireU32>() } },
9162
9163 _ => Self { raw: unsafe { self.raw.clone_unchecked::<()>() } },
9164 }
9165 }
9166}
9167
9168unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalLayoutConstraint
9169where
9170 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
9171{
9172 fn decode(
9173 mut slot: ::fidl_next::Slot<'_, Self>,
9174 decoder: &mut ___D,
9175 ) -> Result<(), ::fidl_next::DecodeError> {
9176 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
9177 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
9178 1 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireU32>(
9179 raw, decoder,
9180 )?,
9181
9182 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
9183 _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?,
9184 }
9185
9186 Ok(())
9187 }
9188}
9189
9190impl ::core::fmt::Debug for WireOptionalLayoutConstraint {
9191 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
9192 self.as_ref().fmt(f)
9193 }
9194}
9195
9196#[derive(Clone, Debug)]
9197pub struct ConfigType {
9198 pub layout: crate::ConfigTypeLayout,
9199
9200 pub parameters: Option<Vec<crate::LayoutParameter>>,
9201
9202 pub constraints: Vec<crate::LayoutConstraint>,
9203}
9204
9205impl ::fidl_next::Encodable for ConfigType {
9206 type Encoded = WireConfigType;
9207}
9208
9209unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigType
9210where
9211 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
9212
9213 ___E: ::fidl_next::Encoder,
9214{
9215 #[inline]
9216 fn encode(
9217 self,
9218 encoder: &mut ___E,
9219 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9220 ) -> Result<(), ::fidl_next::EncodeError> {
9221 ::fidl_next::munge! {
9222 let Self::Encoded {
9223 layout,
9224 parameters,
9225 constraints,
9226
9227 } = out;
9228 }
9229
9230 ::fidl_next::Encode::encode(self.layout, encoder, layout)?;
9231
9232 ::fidl_next::Encode::encode(self.parameters, encoder, parameters)?;
9233
9234 ::fidl_next::Encode::encode(self.constraints, encoder, constraints)?;
9235
9236 Ok(())
9237 }
9238}
9239
9240unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigType
9241where
9242 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
9243
9244 ___E: ::fidl_next::Encoder,
9245{
9246 #[inline]
9247 fn encode_ref(
9248 &self,
9249 encoder: &mut ___E,
9250 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9251 ) -> Result<(), ::fidl_next::EncodeError> {
9252 ::fidl_next::munge! {
9253 let Self::Encoded {
9254 layout,
9255 parameters,
9256 constraints,
9257
9258 } = out;
9259 }
9260
9261 ::fidl_next::EncodeRef::encode_ref(&self.layout, encoder, layout)?;
9262
9263 ::fidl_next::EncodeRef::encode_ref(&self.parameters, encoder, parameters)?;
9264
9265 ::fidl_next::EncodeRef::encode_ref(&self.constraints, encoder, constraints)?;
9266
9267 Ok(())
9268 }
9269}
9270
9271impl ::fidl_next::EncodableOption for Box<ConfigType> {
9272 type EncodedOption = ::fidl_next::WireBox<WireConfigType>;
9273}
9274
9275unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ConfigType>
9276where
9277 ___E: ::fidl_next::Encoder + ?Sized,
9278 ConfigType: ::fidl_next::Encode<___E>,
9279{
9280 #[inline]
9281 fn encode_option(
9282 this: Option<Self>,
9283 encoder: &mut ___E,
9284 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
9285 ) -> Result<(), ::fidl_next::EncodeError> {
9286 if let Some(inner) = this {
9287 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
9288 ::fidl_next::WireBox::encode_present(out);
9289 } else {
9290 ::fidl_next::WireBox::encode_absent(out);
9291 }
9292
9293 Ok(())
9294 }
9295}
9296
9297unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ConfigType>
9298where
9299 ___E: ::fidl_next::Encoder + ?Sized,
9300 ConfigType: ::fidl_next::EncodeRef<___E>,
9301{
9302 #[inline]
9303 fn encode_option_ref(
9304 this: Option<&Self>,
9305 encoder: &mut ___E,
9306 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
9307 ) -> Result<(), ::fidl_next::EncodeError> {
9308 if let Some(inner) = this {
9309 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
9310 ::fidl_next::WireBox::encode_present(out);
9311 } else {
9312 ::fidl_next::WireBox::encode_absent(out);
9313 }
9314
9315 Ok(())
9316 }
9317}
9318
9319impl ::fidl_next::TakeFrom<WireConfigType> for ConfigType {
9320 #[inline]
9321 fn take_from(from: &WireConfigType) -> Self {
9322 Self {
9323 layout: ::fidl_next::TakeFrom::take_from(&from.layout),
9324
9325 parameters: ::fidl_next::TakeFrom::take_from(&from.parameters),
9326
9327 constraints: ::fidl_next::TakeFrom::take_from(&from.constraints),
9328 }
9329 }
9330}
9331
9332#[derive(Debug)]
9334#[repr(C)]
9335pub struct WireConfigType {
9336 pub layout: crate::WireConfigTypeLayout,
9337
9338 pub parameters: ::fidl_next::WireOptionalVector<crate::WireLayoutParameter>,
9339
9340 pub constraints: ::fidl_next::WireVector<crate::WireLayoutConstraint>,
9341}
9342
9343unsafe impl ::fidl_next::ZeroPadding for WireConfigType {
9344 #[inline]
9345 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9346 unsafe {
9347 out.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4);
9348 }
9349 }
9350}
9351
9352unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigType
9353where
9354 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
9355
9356 ___D: ::fidl_next::Decoder,
9357{
9358 fn decode(
9359 slot: ::fidl_next::Slot<'_, Self>,
9360 decoder: &mut ___D,
9361 ) -> Result<(), ::fidl_next::DecodeError> {
9362 ::fidl_next::munge! {
9363 let Self {
9364 mut layout,
9365 mut parameters,
9366 mut constraints,
9367
9368 } = slot;
9369 }
9370
9371 ::fidl_next::Decode::decode(layout.as_mut(), decoder)?;
9372
9373 ::fidl_next::Decode::decode(parameters.as_mut(), decoder)?;
9374
9375 ::fidl_next::Decode::decode(constraints.as_mut(), decoder)?;
9376
9377 Ok(())
9378 }
9379}
9380
9381#[doc = " The checksum produced for a configuration interface.\n Two configuration interfaces are the same if their checksums are the same.\n"]
9382#[derive(Clone, Debug)]
9383pub enum ConfigChecksum {
9384 Sha256([u8; 32]),
9385
9386 UnknownOrdinal_(u64),
9387}
9388
9389impl ::fidl_next::Encodable for ConfigChecksum {
9390 type Encoded = WireConfigChecksum;
9391}
9392
9393unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigChecksum
9394where
9395 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
9396
9397 ___E: ::fidl_next::Encoder,
9398{
9399 #[inline]
9400 fn encode(
9401 self,
9402 encoder: &mut ___E,
9403 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9404 ) -> Result<(), ::fidl_next::EncodeError> {
9405 ::fidl_next::munge!(let WireConfigChecksum { raw } = out);
9406
9407 match self {
9408 Self::Sha256(value) => {
9409 ::fidl_next::RawWireUnion::encode_as::<___E, [u8; 32]>(value, 1, encoder, raw)?
9410 }
9411
9412 Self::UnknownOrdinal_(ordinal) => {
9413 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
9414 }
9415 }
9416
9417 Ok(())
9418 }
9419}
9420
9421unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigChecksum
9422where
9423 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
9424
9425 ___E: ::fidl_next::Encoder,
9426{
9427 #[inline]
9428 fn encode_ref(
9429 &self,
9430 encoder: &mut ___E,
9431 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9432 ) -> Result<(), ::fidl_next::EncodeError> {
9433 ::fidl_next::munge!(let WireConfigChecksum { raw } = out);
9434
9435 match self {
9436 Self::Sha256(value) => {
9437 ::fidl_next::RawWireUnion::encode_as::<___E, &[u8; 32]>(value, 1, encoder, raw)?
9438 }
9439
9440 Self::UnknownOrdinal_(ordinal) => {
9441 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
9442 }
9443 }
9444
9445 Ok(())
9446 }
9447}
9448
9449impl ::fidl_next::EncodableOption for Box<ConfigChecksum> {
9450 type EncodedOption = WireOptionalConfigChecksum;
9451}
9452
9453unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ConfigChecksum>
9454where
9455 ___E: ?Sized,
9456 ConfigChecksum: ::fidl_next::Encode<___E>,
9457{
9458 #[inline]
9459 fn encode_option(
9460 this: Option<Self>,
9461 encoder: &mut ___E,
9462 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
9463 ) -> Result<(), ::fidl_next::EncodeError> {
9464 ::fidl_next::munge!(let WireOptionalConfigChecksum { raw } = &mut *out);
9465
9466 if let Some(inner) = this {
9467 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
9468 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
9469 } else {
9470 ::fidl_next::RawWireUnion::encode_absent(raw);
9471 }
9472
9473 Ok(())
9474 }
9475}
9476
9477unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ConfigChecksum>
9478where
9479 ___E: ?Sized,
9480 ConfigChecksum: ::fidl_next::EncodeRef<___E>,
9481{
9482 #[inline]
9483 fn encode_option_ref(
9484 this: Option<&Self>,
9485 encoder: &mut ___E,
9486 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
9487 ) -> Result<(), ::fidl_next::EncodeError> {
9488 ::fidl_next::munge!(let WireOptionalConfigChecksum { raw } = &mut *out);
9489
9490 if let Some(inner) = this {
9491 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
9492 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
9493 } else {
9494 ::fidl_next::RawWireUnion::encode_absent(raw);
9495 }
9496
9497 Ok(())
9498 }
9499}
9500
9501impl ::fidl_next::TakeFrom<WireConfigChecksum> for ConfigChecksum {
9502 #[inline]
9503 fn take_from(from: &WireConfigChecksum) -> Self {
9504 match from.raw.ordinal() {
9505 1 => Self::Sha256(::fidl_next::TakeFrom::take_from(unsafe {
9506 from.raw.get().deref_unchecked::<[u8; 32]>()
9507 })),
9508
9509 _ => unsafe { ::core::hint::unreachable_unchecked() },
9510 }
9511 }
9512}
9513
9514impl ::fidl_next::TakeFrom<WireOptionalConfigChecksum> for Option<Box<ConfigChecksum>> {
9515 #[inline]
9516 fn take_from(from: &WireOptionalConfigChecksum) -> Self {
9517 if let Some(inner) = from.as_ref() {
9518 Some(::fidl_next::TakeFrom::take_from(inner))
9519 } else {
9520 None
9521 }
9522 }
9523}
9524
9525#[repr(transparent)]
9527pub struct WireConfigChecksum {
9528 raw: ::fidl_next::RawWireUnion,
9529}
9530
9531unsafe impl ::fidl_next::ZeroPadding for WireConfigChecksum {
9532 #[inline]
9533 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9534 ::fidl_next::munge!(let Self { raw } = out);
9535 ::fidl_next::RawWireUnion::zero_padding(raw);
9536 }
9537}
9538
9539pub mod config_checksum {
9540 pub enum Ref<'union> {
9541 Sha256(&'union [u8; 32]),
9542
9543 UnknownOrdinal_(u64),
9544 }
9545}
9546
9547impl WireConfigChecksum {
9548 pub fn as_ref(&self) -> crate::config_checksum::Ref<'_> {
9549 match self.raw.ordinal() {
9550 1 => crate::config_checksum::Ref::Sha256(unsafe {
9551 self.raw.get().deref_unchecked::<[u8; 32]>()
9552 }),
9553
9554 unknown => crate::config_checksum::Ref::UnknownOrdinal_(unknown),
9555 }
9556 }
9557}
9558
9559unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigChecksum
9560where
9561 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
9562
9563 ___D: ::fidl_next::Decoder,
9564{
9565 fn decode(
9566 mut slot: ::fidl_next::Slot<'_, Self>,
9567 decoder: &mut ___D,
9568 ) -> Result<(), ::fidl_next::DecodeError> {
9569 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
9570 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
9571 1 => ::fidl_next::RawWireUnion::decode_as::<___D, [u8; 32]>(raw, decoder)?,
9572
9573 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
9574 }
9575
9576 Ok(())
9577 }
9578}
9579
9580impl ::core::fmt::Debug for WireConfigChecksum {
9581 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
9582 match self.raw.ordinal() {
9583 1 => unsafe { self.raw.get().deref_unchecked::<[u8; 32]>().fmt(f) },
9584 _ => unsafe { ::core::hint::unreachable_unchecked() },
9585 }
9586 }
9587}
9588
9589#[repr(transparent)]
9590pub struct WireOptionalConfigChecksum {
9591 raw: ::fidl_next::RawWireUnion,
9592}
9593
9594unsafe impl ::fidl_next::ZeroPadding for WireOptionalConfigChecksum {
9595 #[inline]
9596 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9597 ::fidl_next::munge!(let Self { raw } = out);
9598 ::fidl_next::RawWireUnion::zero_padding(raw);
9599 }
9600}
9601
9602impl WireOptionalConfigChecksum {
9603 pub fn is_some(&self) -> bool {
9604 self.raw.is_some()
9605 }
9606
9607 pub fn is_none(&self) -> bool {
9608 self.raw.is_none()
9609 }
9610
9611 pub fn as_ref(&self) -> Option<&WireConfigChecksum> {
9612 if self.is_some() {
9613 Some(unsafe { &*(self as *const Self).cast() })
9614 } else {
9615 None
9616 }
9617 }
9618}
9619
9620unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigChecksum
9621where
9622 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
9623
9624 ___D: ::fidl_next::Decoder,
9625{
9626 fn decode(
9627 mut slot: ::fidl_next::Slot<'_, Self>,
9628 decoder: &mut ___D,
9629 ) -> Result<(), ::fidl_next::DecodeError> {
9630 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
9631 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
9632 1 => ::fidl_next::RawWireUnion::decode_as::<___D, [u8; 32]>(raw, decoder)?,
9633
9634 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
9635 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
9636 }
9637
9638 Ok(())
9639 }
9640}
9641
9642impl ::core::fmt::Debug for WireOptionalConfigChecksum {
9643 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
9644 self.as_ref().fmt(f)
9645 }
9646}
9647
9648#[doc = " Declares storage used by a component, which was offered to it.\n"]
9649#[derive(Clone, Debug, Default)]
9650pub struct UseStorage {
9651 pub source_name: Option<String>,
9652
9653 pub target_path: Option<String>,
9654
9655 pub availability: Option<crate::Availability>,
9656}
9657
9658impl UseStorage {
9659 fn __max_ordinal(&self) -> usize {
9660 if self.source_name.is_some() {
9661 return 1;
9662 }
9663
9664 if self.target_path.is_some() {
9665 return 2;
9666 }
9667
9668 if self.availability.is_some() {
9669 return 3;
9670 }
9671
9672 0
9673 }
9674}
9675
9676impl ::fidl_next::Encodable for UseStorage {
9677 type Encoded = WireUseStorage;
9678}
9679
9680unsafe impl<___E> ::fidl_next::Encode<___E> for UseStorage
9681where
9682 ___E: ::fidl_next::Encoder + ?Sized,
9683{
9684 #[inline]
9685 fn encode(
9686 mut self,
9687 encoder: &mut ___E,
9688 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9689 ) -> Result<(), ::fidl_next::EncodeError> {
9690 ::fidl_next::munge!(let WireUseStorage { table } = out);
9691
9692 let max_ord = self.__max_ordinal();
9693
9694 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
9695 ::fidl_next::ZeroPadding::zero_padding(&mut out);
9696
9697 let mut preallocated =
9698 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
9699
9700 for i in 1..=max_ord {
9701 match i {
9702 3 => {
9703 if let Some(availability) = self.availability.take() {
9704 ::fidl_next::WireEnvelope::encode_value(
9705 availability,
9706 preallocated.encoder,
9707 &mut out,
9708 )?;
9709 } else {
9710 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9711 }
9712 }
9713
9714 2 => {
9715 if let Some(target_path) = self.target_path.take() {
9716 ::fidl_next::WireEnvelope::encode_value(
9717 target_path,
9718 preallocated.encoder,
9719 &mut out,
9720 )?;
9721 } else {
9722 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9723 }
9724 }
9725
9726 1 => {
9727 if let Some(source_name) = self.source_name.take() {
9728 ::fidl_next::WireEnvelope::encode_value(
9729 source_name,
9730 preallocated.encoder,
9731 &mut out,
9732 )?;
9733 } else {
9734 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9735 }
9736 }
9737
9738 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
9739 }
9740 unsafe {
9741 preallocated.write_next(out.assume_init_ref());
9742 }
9743 }
9744
9745 ::fidl_next::WireTable::encode_len(table, max_ord);
9746
9747 Ok(())
9748 }
9749}
9750
9751unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseStorage
9752where
9753 ___E: ::fidl_next::Encoder + ?Sized,
9754{
9755 #[inline]
9756 fn encode_ref(
9757 &self,
9758 encoder: &mut ___E,
9759 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9760 ) -> Result<(), ::fidl_next::EncodeError> {
9761 ::fidl_next::munge!(let WireUseStorage { table } = out);
9762
9763 let max_ord = self.__max_ordinal();
9764
9765 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
9766 ::fidl_next::ZeroPadding::zero_padding(&mut out);
9767
9768 let mut preallocated =
9769 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
9770
9771 for i in 1..=max_ord {
9772 match i {
9773 3 => {
9774 if let Some(availability) = &self.availability {
9775 ::fidl_next::WireEnvelope::encode_value(
9776 availability,
9777 preallocated.encoder,
9778 &mut out,
9779 )?;
9780 } else {
9781 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9782 }
9783 }
9784
9785 2 => {
9786 if let Some(target_path) = &self.target_path {
9787 ::fidl_next::WireEnvelope::encode_value(
9788 target_path,
9789 preallocated.encoder,
9790 &mut out,
9791 )?;
9792 } else {
9793 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9794 }
9795 }
9796
9797 1 => {
9798 if let Some(source_name) = &self.source_name {
9799 ::fidl_next::WireEnvelope::encode_value(
9800 source_name,
9801 preallocated.encoder,
9802 &mut out,
9803 )?;
9804 } else {
9805 ::fidl_next::WireEnvelope::encode_zero(&mut out)
9806 }
9807 }
9808
9809 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
9810 }
9811 unsafe {
9812 preallocated.write_next(out.assume_init_ref());
9813 }
9814 }
9815
9816 ::fidl_next::WireTable::encode_len(table, max_ord);
9817
9818 Ok(())
9819 }
9820}
9821
9822impl ::fidl_next::TakeFrom<WireUseStorage> for UseStorage {
9823 #[inline]
9824 fn take_from(from: &WireUseStorage) -> Self {
9825 Self {
9826 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
9827
9828 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
9829
9830 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
9831 }
9832 }
9833}
9834
9835#[repr(C)]
9837pub struct WireUseStorage {
9838 table: ::fidl_next::WireTable,
9839}
9840
9841unsafe impl ::fidl_next::ZeroPadding for WireUseStorage {
9842 #[inline]
9843 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
9844 ::fidl_next::munge!(let Self { table } = out);
9845 ::fidl_next::WireTable::zero_padding(table);
9846 }
9847}
9848
9849unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseStorage
9850where
9851 ___D: ::fidl_next::Decoder + ?Sized,
9852{
9853 fn decode(
9854 slot: ::fidl_next::Slot<'_, Self>,
9855 decoder: &mut ___D,
9856 ) -> Result<(), ::fidl_next::DecodeError> {
9857 ::fidl_next::munge!(let Self { table } = slot);
9858
9859 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
9860 match ordinal {
9861 0 => unsafe { ::core::hint::unreachable_unchecked() },
9862
9863 1 => {
9864 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
9865 slot.as_mut(),
9866 decoder,
9867 )?;
9868
9869 let source_name = unsafe {
9870 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
9871 };
9872
9873 if source_name.len() > 100 {
9874 return Err(::fidl_next::DecodeError::VectorTooLong {
9875 size: source_name.len() as u64,
9876 limit: 100,
9877 });
9878 }
9879
9880 Ok(())
9881 }
9882
9883 2 => {
9884 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
9885 slot.as_mut(),
9886 decoder,
9887 )?;
9888
9889 let target_path = unsafe {
9890 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
9891 };
9892
9893 if target_path.len() > 1024 {
9894 return Err(::fidl_next::DecodeError::VectorTooLong {
9895 size: target_path.len() as u64,
9896 limit: 1024,
9897 });
9898 }
9899
9900 Ok(())
9901 }
9902
9903 3 => {
9904 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
9905 slot.as_mut(),
9906 decoder,
9907 )?;
9908
9909 Ok(())
9910 }
9911
9912 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
9913 }
9914 })
9915 }
9916}
9917
9918impl WireUseStorage {
9919 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
9920 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
9921 }
9922
9923 pub fn target_path(&self) -> Option<&::fidl_next::WireString> {
9924 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
9925 }
9926
9927 pub fn availability(&self) -> Option<&crate::WireAvailability> {
9928 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
9929 }
9930}
9931
9932impl ::core::fmt::Debug for WireUseStorage {
9933 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
9934 f.debug_struct("UseStorage")
9935 .field("source_name", &self.source_name())
9936 .field("target_path", &self.target_path())
9937 .field("availability", &self.availability())
9938 .finish()
9939 }
9940}
9941
9942::fidl_next::bitflags! {
9943 #[doc = " Allowed sources for runtime overrides of a config field\'s value.\n"]#[derive(
9944 Clone,
9945 Copy,
9946 Debug,
9947 PartialEq,
9948 Eq,
9949 Hash,
9950 )]
9951 pub struct ConfigMutability: u32 {
9952 #[doc = " Allow parent components to provide overrides for the configuration field.\n"]const PARENT = 1;
9953 const _ = !0;
9954 }
9955}
9956
9957impl ::fidl_next::Encodable for ConfigMutability {
9958 type Encoded = WireConfigMutability;
9959}
9960
9961unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigMutability
9962where
9963 ___E: ?Sized,
9964{
9965 #[inline]
9966 fn encode(
9967 self,
9968 encoder: &mut ___E,
9969 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9970 ) -> Result<(), ::fidl_next::EncodeError> {
9971 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
9972 }
9973}
9974
9975unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigMutability
9976where
9977 ___E: ?Sized,
9978{
9979 #[inline]
9980 fn encode_ref(
9981 &self,
9982 _: &mut ___E,
9983 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
9984 ) -> Result<(), ::fidl_next::EncodeError> {
9985 ::fidl_next::munge!(let WireConfigMutability { value } = out);
9986 let _ = value.write(::fidl_next::WireU32::from(self.bits()));
9987 Ok(())
9988 }
9989}
9990
9991impl ::core::convert::From<WireConfigMutability> for ConfigMutability {
9992 fn from(wire: WireConfigMutability) -> Self {
9993 Self::from_bits_retain(u32::from(wire.value))
9994 }
9995}
9996
9997impl ::fidl_next::TakeFrom<WireConfigMutability> for ConfigMutability {
9998 #[inline]
9999 fn take_from(from: &WireConfigMutability) -> Self {
10000 Self::from(*from)
10001 }
10002}
10003
10004#[derive(Clone, Copy, Debug)]
10006#[repr(transparent)]
10007pub struct WireConfigMutability {
10008 value: ::fidl_next::WireU32,
10009}
10010
10011unsafe impl ::fidl_next::ZeroPadding for WireConfigMutability {
10012 #[inline]
10013 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
10014 }
10016}
10017
10018unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigMutability
10019where
10020 ___D: ?Sized,
10021{
10022 fn decode(
10023 slot: ::fidl_next::Slot<'_, Self>,
10024 _: &mut ___D,
10025 ) -> Result<(), ::fidl_next::DecodeError> {
10026 Ok(())
10027 }
10028}
10029
10030impl ::core::convert::From<ConfigMutability> for WireConfigMutability {
10031 fn from(natural: ConfigMutability) -> Self {
10032 Self { value: ::fidl_next::WireU32::from(natural.bits()) }
10033 }
10034}
10035
10036#[doc = " Declares a single config field (key + type)\n"]
10037#[derive(Clone, Debug, Default)]
10038pub struct ConfigField {
10039 pub key: Option<String>,
10040
10041 pub type_: Option<crate::ConfigType>,
10042
10043 pub mutability: Option<crate::ConfigMutability>,
10044}
10045
10046impl ConfigField {
10047 fn __max_ordinal(&self) -> usize {
10048 if self.key.is_some() {
10049 return 1;
10050 }
10051
10052 if self.type_.is_some() {
10053 return 2;
10054 }
10055
10056 if self.mutability.is_some() {
10057 return 3;
10058 }
10059
10060 0
10061 }
10062}
10063
10064impl ::fidl_next::Encodable for ConfigField {
10065 type Encoded = WireConfigField;
10066}
10067
10068unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigField
10069where
10070 ___E: ::fidl_next::Encoder + ?Sized,
10071{
10072 #[inline]
10073 fn encode(
10074 mut self,
10075 encoder: &mut ___E,
10076 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10077 ) -> Result<(), ::fidl_next::EncodeError> {
10078 ::fidl_next::munge!(let WireConfigField { table } = out);
10079
10080 let max_ord = self.__max_ordinal();
10081
10082 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10083 ::fidl_next::ZeroPadding::zero_padding(&mut out);
10084
10085 let mut preallocated =
10086 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10087
10088 for i in 1..=max_ord {
10089 match i {
10090 3 => {
10091 if let Some(mutability) = self.mutability.take() {
10092 ::fidl_next::WireEnvelope::encode_value(
10093 mutability,
10094 preallocated.encoder,
10095 &mut out,
10096 )?;
10097 } else {
10098 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10099 }
10100 }
10101
10102 2 => {
10103 if let Some(type_) = self.type_.take() {
10104 ::fidl_next::WireEnvelope::encode_value(
10105 type_,
10106 preallocated.encoder,
10107 &mut out,
10108 )?;
10109 } else {
10110 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10111 }
10112 }
10113
10114 1 => {
10115 if let Some(key) = self.key.take() {
10116 ::fidl_next::WireEnvelope::encode_value(
10117 key,
10118 preallocated.encoder,
10119 &mut out,
10120 )?;
10121 } else {
10122 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10123 }
10124 }
10125
10126 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10127 }
10128 unsafe {
10129 preallocated.write_next(out.assume_init_ref());
10130 }
10131 }
10132
10133 ::fidl_next::WireTable::encode_len(table, max_ord);
10134
10135 Ok(())
10136 }
10137}
10138
10139unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigField
10140where
10141 ___E: ::fidl_next::Encoder + ?Sized,
10142{
10143 #[inline]
10144 fn encode_ref(
10145 &self,
10146 encoder: &mut ___E,
10147 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10148 ) -> Result<(), ::fidl_next::EncodeError> {
10149 ::fidl_next::munge!(let WireConfigField { table } = out);
10150
10151 let max_ord = self.__max_ordinal();
10152
10153 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10154 ::fidl_next::ZeroPadding::zero_padding(&mut out);
10155
10156 let mut preallocated =
10157 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10158
10159 for i in 1..=max_ord {
10160 match i {
10161 3 => {
10162 if let Some(mutability) = &self.mutability {
10163 ::fidl_next::WireEnvelope::encode_value(
10164 mutability,
10165 preallocated.encoder,
10166 &mut out,
10167 )?;
10168 } else {
10169 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10170 }
10171 }
10172
10173 2 => {
10174 if let Some(type_) = &self.type_ {
10175 ::fidl_next::WireEnvelope::encode_value(
10176 type_,
10177 preallocated.encoder,
10178 &mut out,
10179 )?;
10180 } else {
10181 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10182 }
10183 }
10184
10185 1 => {
10186 if let Some(key) = &self.key {
10187 ::fidl_next::WireEnvelope::encode_value(
10188 key,
10189 preallocated.encoder,
10190 &mut out,
10191 )?;
10192 } else {
10193 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10194 }
10195 }
10196
10197 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10198 }
10199 unsafe {
10200 preallocated.write_next(out.assume_init_ref());
10201 }
10202 }
10203
10204 ::fidl_next::WireTable::encode_len(table, max_ord);
10205
10206 Ok(())
10207 }
10208}
10209
10210impl ::fidl_next::TakeFrom<WireConfigField> for ConfigField {
10211 #[inline]
10212 fn take_from(from: &WireConfigField) -> Self {
10213 Self {
10214 key: from.key().map(::fidl_next::TakeFrom::take_from),
10215
10216 type_: from.type_().map(::fidl_next::TakeFrom::take_from),
10217
10218 mutability: from.mutability().map(::fidl_next::TakeFrom::take_from),
10219 }
10220 }
10221}
10222
10223#[repr(C)]
10225pub struct WireConfigField {
10226 table: ::fidl_next::WireTable,
10227}
10228
10229unsafe impl ::fidl_next::ZeroPadding for WireConfigField {
10230 #[inline]
10231 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10232 ::fidl_next::munge!(let Self { table } = out);
10233 ::fidl_next::WireTable::zero_padding(table);
10234 }
10235}
10236
10237unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigField
10238where
10239 ___D: ::fidl_next::Decoder + ?Sized,
10240{
10241 fn decode(
10242 slot: ::fidl_next::Slot<'_, Self>,
10243 decoder: &mut ___D,
10244 ) -> Result<(), ::fidl_next::DecodeError> {
10245 ::fidl_next::munge!(let Self { table } = slot);
10246
10247 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
10248 match ordinal {
10249 0 => unsafe { ::core::hint::unreachable_unchecked() },
10250
10251 1 => {
10252 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
10253 slot.as_mut(),
10254 decoder,
10255 )?;
10256
10257 let key = unsafe {
10258 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
10259 };
10260
10261 if key.len() > 64 {
10262 return Err(::fidl_next::DecodeError::VectorTooLong {
10263 size: key.len() as u64,
10264 limit: 64,
10265 });
10266 }
10267
10268 Ok(())
10269 }
10270
10271 2 => {
10272 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigType>(
10273 slot.as_mut(),
10274 decoder,
10275 )?;
10276
10277 Ok(())
10278 }
10279
10280 3 => {
10281 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigMutability>(
10282 slot.as_mut(),
10283 decoder,
10284 )?;
10285
10286 Ok(())
10287 }
10288
10289 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
10290 }
10291 })
10292 }
10293}
10294
10295impl WireConfigField {
10296 pub fn key(&self) -> Option<&::fidl_next::WireString> {
10297 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
10298 }
10299
10300 pub fn type_(&self) -> Option<&crate::WireConfigType> {
10301 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
10302 }
10303
10304 pub fn mutability(&self) -> Option<&crate::WireConfigMutability> {
10305 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
10306 }
10307}
10308
10309impl ::core::fmt::Debug for WireConfigField {
10310 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
10311 f.debug_struct("ConfigField")
10312 .field("key", &self.key())
10313 .field("type_", &self.type_())
10314 .field("mutability", &self.mutability())
10315 .finish()
10316 }
10317}
10318
10319#[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"]
10320#[derive(Clone, Debug, Default)]
10321pub struct Program {
10322 pub runner: Option<String>,
10323
10324 pub info: Option<::fidl_next_fuchsia_data::Dictionary>,
10325}
10326
10327impl Program {
10328 fn __max_ordinal(&self) -> usize {
10329 if self.runner.is_some() {
10330 return 1;
10331 }
10332
10333 if self.info.is_some() {
10334 return 2;
10335 }
10336
10337 0
10338 }
10339}
10340
10341impl ::fidl_next::Encodable for Program {
10342 type Encoded = WireProgram;
10343}
10344
10345unsafe impl<___E> ::fidl_next::Encode<___E> for Program
10346where
10347 ___E: ::fidl_next::Encoder + ?Sized,
10348{
10349 #[inline]
10350 fn encode(
10351 mut self,
10352 encoder: &mut ___E,
10353 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10354 ) -> Result<(), ::fidl_next::EncodeError> {
10355 ::fidl_next::munge!(let WireProgram { table } = out);
10356
10357 let max_ord = self.__max_ordinal();
10358
10359 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10360 ::fidl_next::ZeroPadding::zero_padding(&mut out);
10361
10362 let mut preallocated =
10363 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10364
10365 for i in 1..=max_ord {
10366 match i {
10367 2 => {
10368 if let Some(info) = self.info.take() {
10369 ::fidl_next::WireEnvelope::encode_value(
10370 info,
10371 preallocated.encoder,
10372 &mut out,
10373 )?;
10374 } else {
10375 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10376 }
10377 }
10378
10379 1 => {
10380 if let Some(runner) = self.runner.take() {
10381 ::fidl_next::WireEnvelope::encode_value(
10382 runner,
10383 preallocated.encoder,
10384 &mut out,
10385 )?;
10386 } else {
10387 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10388 }
10389 }
10390
10391 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10392 }
10393 unsafe {
10394 preallocated.write_next(out.assume_init_ref());
10395 }
10396 }
10397
10398 ::fidl_next::WireTable::encode_len(table, max_ord);
10399
10400 Ok(())
10401 }
10402}
10403
10404unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Program
10405where
10406 ___E: ::fidl_next::Encoder + ?Sized,
10407{
10408 #[inline]
10409 fn encode_ref(
10410 &self,
10411 encoder: &mut ___E,
10412 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10413 ) -> Result<(), ::fidl_next::EncodeError> {
10414 ::fidl_next::munge!(let WireProgram { table } = out);
10415
10416 let max_ord = self.__max_ordinal();
10417
10418 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10419 ::fidl_next::ZeroPadding::zero_padding(&mut out);
10420
10421 let mut preallocated =
10422 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10423
10424 for i in 1..=max_ord {
10425 match i {
10426 2 => {
10427 if let Some(info) = &self.info {
10428 ::fidl_next::WireEnvelope::encode_value(
10429 info,
10430 preallocated.encoder,
10431 &mut out,
10432 )?;
10433 } else {
10434 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10435 }
10436 }
10437
10438 1 => {
10439 if let Some(runner) = &self.runner {
10440 ::fidl_next::WireEnvelope::encode_value(
10441 runner,
10442 preallocated.encoder,
10443 &mut out,
10444 )?;
10445 } else {
10446 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10447 }
10448 }
10449
10450 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10451 }
10452 unsafe {
10453 preallocated.write_next(out.assume_init_ref());
10454 }
10455 }
10456
10457 ::fidl_next::WireTable::encode_len(table, max_ord);
10458
10459 Ok(())
10460 }
10461}
10462
10463impl ::fidl_next::TakeFrom<WireProgram> for Program {
10464 #[inline]
10465 fn take_from(from: &WireProgram) -> Self {
10466 Self {
10467 runner: from.runner().map(::fidl_next::TakeFrom::take_from),
10468
10469 info: from.info().map(::fidl_next::TakeFrom::take_from),
10470 }
10471 }
10472}
10473
10474#[repr(C)]
10476pub struct WireProgram {
10477 table: ::fidl_next::WireTable,
10478}
10479
10480unsafe impl ::fidl_next::ZeroPadding for WireProgram {
10481 #[inline]
10482 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10483 ::fidl_next::munge!(let Self { table } = out);
10484 ::fidl_next::WireTable::zero_padding(table);
10485 }
10486}
10487
10488unsafe impl<___D> ::fidl_next::Decode<___D> for WireProgram
10489where
10490 ___D: ::fidl_next::Decoder + ?Sized,
10491{
10492 fn decode(
10493 slot: ::fidl_next::Slot<'_, Self>,
10494 decoder: &mut ___D,
10495 ) -> Result<(), ::fidl_next::DecodeError> {
10496 ::fidl_next::munge!(let Self { table } = slot);
10497
10498 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
10499 match ordinal {
10500 0 => unsafe { ::core::hint::unreachable_unchecked() },
10501
10502 1 => {
10503 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
10504 slot.as_mut(),
10505 decoder,
10506 )?;
10507
10508 let runner = unsafe {
10509 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
10510 };
10511
10512 if runner.len() > 100 {
10513 return Err(::fidl_next::DecodeError::VectorTooLong {
10514 size: runner.len() as u64,
10515 limit: 100,
10516 });
10517 }
10518
10519 Ok(())
10520 }
10521
10522 2 => {
10523 ::fidl_next::WireEnvelope::decode_as::<
10524 ___D,
10525 ::fidl_next_fuchsia_data::WireDictionary,
10526 >(slot.as_mut(), decoder)?;
10527
10528 Ok(())
10529 }
10530
10531 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
10532 }
10533 })
10534 }
10535}
10536
10537impl WireProgram {
10538 pub fn runner(&self) -> Option<&::fidl_next::WireString> {
10539 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
10540 }
10541
10542 pub fn info(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary> {
10543 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
10544 }
10545}
10546
10547impl ::core::fmt::Debug for WireProgram {
10548 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
10549 f.debug_struct("Program")
10550 .field("runner", &self.runner())
10551 .field("info", &self.info())
10552 .finish()
10553 }
10554}
10555
10556#[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"]
10557#[derive(Clone, Debug, Default)]
10558pub struct UseService {
10559 pub source: Option<crate::Ref>,
10560
10561 pub source_name: Option<String>,
10562
10563 pub target_path: Option<String>,
10564
10565 pub dependency_type: Option<crate::DependencyType>,
10566
10567 pub availability: Option<crate::Availability>,
10568
10569 pub source_dictionary: Option<String>,
10570}
10571
10572impl UseService {
10573 fn __max_ordinal(&self) -> usize {
10574 if self.source.is_some() {
10575 return 1;
10576 }
10577
10578 if self.source_name.is_some() {
10579 return 2;
10580 }
10581
10582 if self.target_path.is_some() {
10583 return 3;
10584 }
10585
10586 if self.dependency_type.is_some() {
10587 return 4;
10588 }
10589
10590 if self.availability.is_some() {
10591 return 5;
10592 }
10593
10594 if self.source_dictionary.is_some() {
10595 return 6;
10596 }
10597
10598 0
10599 }
10600}
10601
10602impl ::fidl_next::Encodable for UseService {
10603 type Encoded = WireUseService;
10604}
10605
10606unsafe impl<___E> ::fidl_next::Encode<___E> for UseService
10607where
10608 ___E: ::fidl_next::Encoder + ?Sized,
10609{
10610 #[inline]
10611 fn encode(
10612 mut self,
10613 encoder: &mut ___E,
10614 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10615 ) -> Result<(), ::fidl_next::EncodeError> {
10616 ::fidl_next::munge!(let WireUseService { table } = out);
10617
10618 let max_ord = self.__max_ordinal();
10619
10620 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10621 ::fidl_next::ZeroPadding::zero_padding(&mut out);
10622
10623 let mut preallocated =
10624 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10625
10626 for i in 1..=max_ord {
10627 match i {
10628 6 => {
10629 if let Some(source_dictionary) = self.source_dictionary.take() {
10630 ::fidl_next::WireEnvelope::encode_value(
10631 source_dictionary,
10632 preallocated.encoder,
10633 &mut out,
10634 )?;
10635 } else {
10636 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10637 }
10638 }
10639
10640 5 => {
10641 if let Some(availability) = self.availability.take() {
10642 ::fidl_next::WireEnvelope::encode_value(
10643 availability,
10644 preallocated.encoder,
10645 &mut out,
10646 )?;
10647 } else {
10648 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10649 }
10650 }
10651
10652 4 => {
10653 if let Some(dependency_type) = self.dependency_type.take() {
10654 ::fidl_next::WireEnvelope::encode_value(
10655 dependency_type,
10656 preallocated.encoder,
10657 &mut out,
10658 )?;
10659 } else {
10660 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10661 }
10662 }
10663
10664 3 => {
10665 if let Some(target_path) = self.target_path.take() {
10666 ::fidl_next::WireEnvelope::encode_value(
10667 target_path,
10668 preallocated.encoder,
10669 &mut out,
10670 )?;
10671 } else {
10672 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10673 }
10674 }
10675
10676 2 => {
10677 if let Some(source_name) = self.source_name.take() {
10678 ::fidl_next::WireEnvelope::encode_value(
10679 source_name,
10680 preallocated.encoder,
10681 &mut out,
10682 )?;
10683 } else {
10684 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10685 }
10686 }
10687
10688 1 => {
10689 if let Some(source) = self.source.take() {
10690 ::fidl_next::WireEnvelope::encode_value(
10691 source,
10692 preallocated.encoder,
10693 &mut out,
10694 )?;
10695 } else {
10696 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10697 }
10698 }
10699
10700 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10701 }
10702 unsafe {
10703 preallocated.write_next(out.assume_init_ref());
10704 }
10705 }
10706
10707 ::fidl_next::WireTable::encode_len(table, max_ord);
10708
10709 Ok(())
10710 }
10711}
10712
10713unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseService
10714where
10715 ___E: ::fidl_next::Encoder + ?Sized,
10716{
10717 #[inline]
10718 fn encode_ref(
10719 &self,
10720 encoder: &mut ___E,
10721 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
10722 ) -> Result<(), ::fidl_next::EncodeError> {
10723 ::fidl_next::munge!(let WireUseService { table } = out);
10724
10725 let max_ord = self.__max_ordinal();
10726
10727 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
10728 ::fidl_next::ZeroPadding::zero_padding(&mut out);
10729
10730 let mut preallocated =
10731 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
10732
10733 for i in 1..=max_ord {
10734 match i {
10735 6 => {
10736 if let Some(source_dictionary) = &self.source_dictionary {
10737 ::fidl_next::WireEnvelope::encode_value(
10738 source_dictionary,
10739 preallocated.encoder,
10740 &mut out,
10741 )?;
10742 } else {
10743 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10744 }
10745 }
10746
10747 5 => {
10748 if let Some(availability) = &self.availability {
10749 ::fidl_next::WireEnvelope::encode_value(
10750 availability,
10751 preallocated.encoder,
10752 &mut out,
10753 )?;
10754 } else {
10755 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10756 }
10757 }
10758
10759 4 => {
10760 if let Some(dependency_type) = &self.dependency_type {
10761 ::fidl_next::WireEnvelope::encode_value(
10762 dependency_type,
10763 preallocated.encoder,
10764 &mut out,
10765 )?;
10766 } else {
10767 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10768 }
10769 }
10770
10771 3 => {
10772 if let Some(target_path) = &self.target_path {
10773 ::fidl_next::WireEnvelope::encode_value(
10774 target_path,
10775 preallocated.encoder,
10776 &mut out,
10777 )?;
10778 } else {
10779 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10780 }
10781 }
10782
10783 2 => {
10784 if let Some(source_name) = &self.source_name {
10785 ::fidl_next::WireEnvelope::encode_value(
10786 source_name,
10787 preallocated.encoder,
10788 &mut out,
10789 )?;
10790 } else {
10791 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10792 }
10793 }
10794
10795 1 => {
10796 if let Some(source) = &self.source {
10797 ::fidl_next::WireEnvelope::encode_value(
10798 source,
10799 preallocated.encoder,
10800 &mut out,
10801 )?;
10802 } else {
10803 ::fidl_next::WireEnvelope::encode_zero(&mut out)
10804 }
10805 }
10806
10807 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
10808 }
10809 unsafe {
10810 preallocated.write_next(out.assume_init_ref());
10811 }
10812 }
10813
10814 ::fidl_next::WireTable::encode_len(table, max_ord);
10815
10816 Ok(())
10817 }
10818}
10819
10820impl ::fidl_next::TakeFrom<WireUseService> for UseService {
10821 #[inline]
10822 fn take_from(from: &WireUseService) -> Self {
10823 Self {
10824 source: from.source().map(::fidl_next::TakeFrom::take_from),
10825
10826 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
10827
10828 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
10829
10830 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
10831
10832 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
10833
10834 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
10835 }
10836 }
10837}
10838
10839#[repr(C)]
10841pub struct WireUseService {
10842 table: ::fidl_next::WireTable,
10843}
10844
10845unsafe impl ::fidl_next::ZeroPadding for WireUseService {
10846 #[inline]
10847 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
10848 ::fidl_next::munge!(let Self { table } = out);
10849 ::fidl_next::WireTable::zero_padding(table);
10850 }
10851}
10852
10853unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseService
10854where
10855 ___D: ::fidl_next::Decoder + ?Sized,
10856{
10857 fn decode(
10858 slot: ::fidl_next::Slot<'_, Self>,
10859 decoder: &mut ___D,
10860 ) -> Result<(), ::fidl_next::DecodeError> {
10861 ::fidl_next::munge!(let Self { table } = slot);
10862
10863 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
10864 match ordinal {
10865 0 => unsafe { ::core::hint::unreachable_unchecked() },
10866
10867 1 => {
10868 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
10869 slot.as_mut(),
10870 decoder,
10871 )?;
10872
10873 Ok(())
10874 }
10875
10876 2 => {
10877 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
10878 slot.as_mut(),
10879 decoder,
10880 )?;
10881
10882 let source_name = unsafe {
10883 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
10884 };
10885
10886 if source_name.len() > 100 {
10887 return Err(::fidl_next::DecodeError::VectorTooLong {
10888 size: source_name.len() as u64,
10889 limit: 100,
10890 });
10891 }
10892
10893 Ok(())
10894 }
10895
10896 3 => {
10897 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
10898 slot.as_mut(),
10899 decoder,
10900 )?;
10901
10902 let target_path = unsafe {
10903 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
10904 };
10905
10906 if target_path.len() > 1024 {
10907 return Err(::fidl_next::DecodeError::VectorTooLong {
10908 size: target_path.len() as u64,
10909 limit: 1024,
10910 });
10911 }
10912
10913 Ok(())
10914 }
10915
10916 4 => {
10917 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
10918 slot.as_mut(),
10919 decoder,
10920 )?;
10921
10922 Ok(())
10923 }
10924
10925 5 => {
10926 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
10927 slot.as_mut(),
10928 decoder,
10929 )?;
10930
10931 Ok(())
10932 }
10933
10934 6 => {
10935 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
10936 slot.as_mut(),
10937 decoder,
10938 )?;
10939
10940 let source_dictionary = unsafe {
10941 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
10942 };
10943
10944 if source_dictionary.len() > 1024 {
10945 return Err(::fidl_next::DecodeError::VectorTooLong {
10946 size: source_dictionary.len() as u64,
10947 limit: 1024,
10948 });
10949 }
10950
10951 Ok(())
10952 }
10953
10954 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
10955 }
10956 })
10957 }
10958}
10959
10960impl WireUseService {
10961 pub fn source(&self) -> Option<&crate::WireRef> {
10962 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
10963 }
10964
10965 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
10966 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
10967 }
10968
10969 pub fn target_path(&self) -> Option<&::fidl_next::WireString> {
10970 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
10971 }
10972
10973 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
10974 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
10975 }
10976
10977 pub fn availability(&self) -> Option<&crate::WireAvailability> {
10978 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
10979 }
10980
10981 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
10982 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
10983 }
10984}
10985
10986impl ::core::fmt::Debug for WireUseService {
10987 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
10988 f.debug_struct("UseService")
10989 .field("source", &self.source())
10990 .field("source_name", &self.source_name())
10991 .field("target_path", &self.target_path())
10992 .field("dependency_type", &self.dependency_type())
10993 .field("availability", &self.availability())
10994 .field("source_dictionary", &self.source_dictionary())
10995 .finish()
10996 }
10997}
10998
10999#[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"]
11000#[derive(Clone, Debug, Default)]
11001pub struct UseProtocol {
11002 pub source: Option<crate::Ref>,
11003
11004 pub source_name: Option<String>,
11005
11006 pub target_path: Option<String>,
11007
11008 pub dependency_type: Option<crate::DependencyType>,
11009
11010 pub availability: Option<crate::Availability>,
11011
11012 pub source_dictionary: Option<String>,
11013}
11014
11015impl UseProtocol {
11016 fn __max_ordinal(&self) -> usize {
11017 if self.source.is_some() {
11018 return 1;
11019 }
11020
11021 if self.source_name.is_some() {
11022 return 2;
11023 }
11024
11025 if self.target_path.is_some() {
11026 return 3;
11027 }
11028
11029 if self.dependency_type.is_some() {
11030 return 4;
11031 }
11032
11033 if self.availability.is_some() {
11034 return 5;
11035 }
11036
11037 if self.source_dictionary.is_some() {
11038 return 6;
11039 }
11040
11041 0
11042 }
11043}
11044
11045impl ::fidl_next::Encodable for UseProtocol {
11046 type Encoded = WireUseProtocol;
11047}
11048
11049unsafe impl<___E> ::fidl_next::Encode<___E> for UseProtocol
11050where
11051 ___E: ::fidl_next::Encoder + ?Sized,
11052{
11053 #[inline]
11054 fn encode(
11055 mut self,
11056 encoder: &mut ___E,
11057 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11058 ) -> Result<(), ::fidl_next::EncodeError> {
11059 ::fidl_next::munge!(let WireUseProtocol { table } = out);
11060
11061 let max_ord = self.__max_ordinal();
11062
11063 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
11064 ::fidl_next::ZeroPadding::zero_padding(&mut out);
11065
11066 let mut preallocated =
11067 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
11068
11069 for i in 1..=max_ord {
11070 match i {
11071 6 => {
11072 if let Some(source_dictionary) = self.source_dictionary.take() {
11073 ::fidl_next::WireEnvelope::encode_value(
11074 source_dictionary,
11075 preallocated.encoder,
11076 &mut out,
11077 )?;
11078 } else {
11079 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11080 }
11081 }
11082
11083 5 => {
11084 if let Some(availability) = self.availability.take() {
11085 ::fidl_next::WireEnvelope::encode_value(
11086 availability,
11087 preallocated.encoder,
11088 &mut out,
11089 )?;
11090 } else {
11091 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11092 }
11093 }
11094
11095 4 => {
11096 if let Some(dependency_type) = self.dependency_type.take() {
11097 ::fidl_next::WireEnvelope::encode_value(
11098 dependency_type,
11099 preallocated.encoder,
11100 &mut out,
11101 )?;
11102 } else {
11103 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11104 }
11105 }
11106
11107 3 => {
11108 if let Some(target_path) = self.target_path.take() {
11109 ::fidl_next::WireEnvelope::encode_value(
11110 target_path,
11111 preallocated.encoder,
11112 &mut out,
11113 )?;
11114 } else {
11115 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11116 }
11117 }
11118
11119 2 => {
11120 if let Some(source_name) = self.source_name.take() {
11121 ::fidl_next::WireEnvelope::encode_value(
11122 source_name,
11123 preallocated.encoder,
11124 &mut out,
11125 )?;
11126 } else {
11127 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11128 }
11129 }
11130
11131 1 => {
11132 if let Some(source) = self.source.take() {
11133 ::fidl_next::WireEnvelope::encode_value(
11134 source,
11135 preallocated.encoder,
11136 &mut out,
11137 )?;
11138 } else {
11139 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11140 }
11141 }
11142
11143 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
11144 }
11145 unsafe {
11146 preallocated.write_next(out.assume_init_ref());
11147 }
11148 }
11149
11150 ::fidl_next::WireTable::encode_len(table, max_ord);
11151
11152 Ok(())
11153 }
11154}
11155
11156unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseProtocol
11157where
11158 ___E: ::fidl_next::Encoder + ?Sized,
11159{
11160 #[inline]
11161 fn encode_ref(
11162 &self,
11163 encoder: &mut ___E,
11164 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11165 ) -> Result<(), ::fidl_next::EncodeError> {
11166 ::fidl_next::munge!(let WireUseProtocol { table } = out);
11167
11168 let max_ord = self.__max_ordinal();
11169
11170 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
11171 ::fidl_next::ZeroPadding::zero_padding(&mut out);
11172
11173 let mut preallocated =
11174 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
11175
11176 for i in 1..=max_ord {
11177 match i {
11178 6 => {
11179 if let Some(source_dictionary) = &self.source_dictionary {
11180 ::fidl_next::WireEnvelope::encode_value(
11181 source_dictionary,
11182 preallocated.encoder,
11183 &mut out,
11184 )?;
11185 } else {
11186 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11187 }
11188 }
11189
11190 5 => {
11191 if let Some(availability) = &self.availability {
11192 ::fidl_next::WireEnvelope::encode_value(
11193 availability,
11194 preallocated.encoder,
11195 &mut out,
11196 )?;
11197 } else {
11198 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11199 }
11200 }
11201
11202 4 => {
11203 if let Some(dependency_type) = &self.dependency_type {
11204 ::fidl_next::WireEnvelope::encode_value(
11205 dependency_type,
11206 preallocated.encoder,
11207 &mut out,
11208 )?;
11209 } else {
11210 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11211 }
11212 }
11213
11214 3 => {
11215 if let Some(target_path) = &self.target_path {
11216 ::fidl_next::WireEnvelope::encode_value(
11217 target_path,
11218 preallocated.encoder,
11219 &mut out,
11220 )?;
11221 } else {
11222 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11223 }
11224 }
11225
11226 2 => {
11227 if let Some(source_name) = &self.source_name {
11228 ::fidl_next::WireEnvelope::encode_value(
11229 source_name,
11230 preallocated.encoder,
11231 &mut out,
11232 )?;
11233 } else {
11234 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11235 }
11236 }
11237
11238 1 => {
11239 if let Some(source) = &self.source {
11240 ::fidl_next::WireEnvelope::encode_value(
11241 source,
11242 preallocated.encoder,
11243 &mut out,
11244 )?;
11245 } else {
11246 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11247 }
11248 }
11249
11250 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
11251 }
11252 unsafe {
11253 preallocated.write_next(out.assume_init_ref());
11254 }
11255 }
11256
11257 ::fidl_next::WireTable::encode_len(table, max_ord);
11258
11259 Ok(())
11260 }
11261}
11262
11263impl ::fidl_next::TakeFrom<WireUseProtocol> for UseProtocol {
11264 #[inline]
11265 fn take_from(from: &WireUseProtocol) -> Self {
11266 Self {
11267 source: from.source().map(::fidl_next::TakeFrom::take_from),
11268
11269 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
11270
11271 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
11272
11273 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
11274
11275 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
11276
11277 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
11278 }
11279 }
11280}
11281
11282#[repr(C)]
11284pub struct WireUseProtocol {
11285 table: ::fidl_next::WireTable,
11286}
11287
11288unsafe impl ::fidl_next::ZeroPadding for WireUseProtocol {
11289 #[inline]
11290 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
11291 ::fidl_next::munge!(let Self { table } = out);
11292 ::fidl_next::WireTable::zero_padding(table);
11293 }
11294}
11295
11296unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseProtocol
11297where
11298 ___D: ::fidl_next::Decoder + ?Sized,
11299{
11300 fn decode(
11301 slot: ::fidl_next::Slot<'_, Self>,
11302 decoder: &mut ___D,
11303 ) -> Result<(), ::fidl_next::DecodeError> {
11304 ::fidl_next::munge!(let Self { table } = slot);
11305
11306 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
11307 match ordinal {
11308 0 => unsafe { ::core::hint::unreachable_unchecked() },
11309
11310 1 => {
11311 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
11312 slot.as_mut(),
11313 decoder,
11314 )?;
11315
11316 Ok(())
11317 }
11318
11319 2 => {
11320 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
11321 slot.as_mut(),
11322 decoder,
11323 )?;
11324
11325 let source_name = unsafe {
11326 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
11327 };
11328
11329 if source_name.len() > 100 {
11330 return Err(::fidl_next::DecodeError::VectorTooLong {
11331 size: source_name.len() as u64,
11332 limit: 100,
11333 });
11334 }
11335
11336 Ok(())
11337 }
11338
11339 3 => {
11340 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
11341 slot.as_mut(),
11342 decoder,
11343 )?;
11344
11345 let target_path = unsafe {
11346 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
11347 };
11348
11349 if target_path.len() > 1024 {
11350 return Err(::fidl_next::DecodeError::VectorTooLong {
11351 size: target_path.len() as u64,
11352 limit: 1024,
11353 });
11354 }
11355
11356 Ok(())
11357 }
11358
11359 4 => {
11360 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
11361 slot.as_mut(),
11362 decoder,
11363 )?;
11364
11365 Ok(())
11366 }
11367
11368 5 => {
11369 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
11370 slot.as_mut(),
11371 decoder,
11372 )?;
11373
11374 Ok(())
11375 }
11376
11377 6 => {
11378 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
11379 slot.as_mut(),
11380 decoder,
11381 )?;
11382
11383 let source_dictionary = unsafe {
11384 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
11385 };
11386
11387 if source_dictionary.len() > 1024 {
11388 return Err(::fidl_next::DecodeError::VectorTooLong {
11389 size: source_dictionary.len() as u64,
11390 limit: 1024,
11391 });
11392 }
11393
11394 Ok(())
11395 }
11396
11397 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
11398 }
11399 })
11400 }
11401}
11402
11403impl WireUseProtocol {
11404 pub fn source(&self) -> Option<&crate::WireRef> {
11405 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
11406 }
11407
11408 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
11409 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
11410 }
11411
11412 pub fn target_path(&self) -> Option<&::fidl_next::WireString> {
11413 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
11414 }
11415
11416 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
11417 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
11418 }
11419
11420 pub fn availability(&self) -> Option<&crate::WireAvailability> {
11421 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
11422 }
11423
11424 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
11425 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
11426 }
11427}
11428
11429impl ::core::fmt::Debug for WireUseProtocol {
11430 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
11431 f.debug_struct("UseProtocol")
11432 .field("source", &self.source())
11433 .field("source_name", &self.source_name())
11434 .field("target_path", &self.target_path())
11435 .field("dependency_type", &self.dependency_type())
11436 .field("availability", &self.availability())
11437 .field("source_dictionary", &self.source_dictionary())
11438 .finish()
11439 }
11440}
11441
11442#[doc = " Declares a directory used by a component, which was offered to it.\n"]
11443#[derive(Clone, Debug, Default)]
11444pub struct UseDirectory {
11445 pub source: Option<crate::Ref>,
11446
11447 pub source_name: Option<String>,
11448
11449 pub target_path: Option<String>,
11450
11451 pub rights: Option<::fidl_next_fuchsia_io::Operations>,
11452
11453 pub subdir: Option<String>,
11454
11455 pub dependency_type: Option<crate::DependencyType>,
11456
11457 pub availability: Option<crate::Availability>,
11458
11459 pub source_dictionary: Option<String>,
11460}
11461
11462impl UseDirectory {
11463 fn __max_ordinal(&self) -> usize {
11464 if self.source.is_some() {
11465 return 1;
11466 }
11467
11468 if self.source_name.is_some() {
11469 return 2;
11470 }
11471
11472 if self.target_path.is_some() {
11473 return 3;
11474 }
11475
11476 if self.rights.is_some() {
11477 return 4;
11478 }
11479
11480 if self.subdir.is_some() {
11481 return 5;
11482 }
11483
11484 if self.dependency_type.is_some() {
11485 return 6;
11486 }
11487
11488 if self.availability.is_some() {
11489 return 7;
11490 }
11491
11492 if self.source_dictionary.is_some() {
11493 return 8;
11494 }
11495
11496 0
11497 }
11498}
11499
11500impl ::fidl_next::Encodable for UseDirectory {
11501 type Encoded = WireUseDirectory;
11502}
11503
11504unsafe impl<___E> ::fidl_next::Encode<___E> for UseDirectory
11505where
11506 ___E: ::fidl_next::Encoder + ?Sized,
11507{
11508 #[inline]
11509 fn encode(
11510 mut self,
11511 encoder: &mut ___E,
11512 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11513 ) -> Result<(), ::fidl_next::EncodeError> {
11514 ::fidl_next::munge!(let WireUseDirectory { table } = out);
11515
11516 let max_ord = self.__max_ordinal();
11517
11518 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
11519 ::fidl_next::ZeroPadding::zero_padding(&mut out);
11520
11521 let mut preallocated =
11522 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
11523
11524 for i in 1..=max_ord {
11525 match i {
11526 8 => {
11527 if let Some(source_dictionary) = self.source_dictionary.take() {
11528 ::fidl_next::WireEnvelope::encode_value(
11529 source_dictionary,
11530 preallocated.encoder,
11531 &mut out,
11532 )?;
11533 } else {
11534 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11535 }
11536 }
11537
11538 7 => {
11539 if let Some(availability) = self.availability.take() {
11540 ::fidl_next::WireEnvelope::encode_value(
11541 availability,
11542 preallocated.encoder,
11543 &mut out,
11544 )?;
11545 } else {
11546 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11547 }
11548 }
11549
11550 6 => {
11551 if let Some(dependency_type) = self.dependency_type.take() {
11552 ::fidl_next::WireEnvelope::encode_value(
11553 dependency_type,
11554 preallocated.encoder,
11555 &mut out,
11556 )?;
11557 } else {
11558 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11559 }
11560 }
11561
11562 5 => {
11563 if let Some(subdir) = self.subdir.take() {
11564 ::fidl_next::WireEnvelope::encode_value(
11565 subdir,
11566 preallocated.encoder,
11567 &mut out,
11568 )?;
11569 } else {
11570 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11571 }
11572 }
11573
11574 4 => {
11575 if let Some(rights) = self.rights.take() {
11576 ::fidl_next::WireEnvelope::encode_value(
11577 rights,
11578 preallocated.encoder,
11579 &mut out,
11580 )?;
11581 } else {
11582 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11583 }
11584 }
11585
11586 3 => {
11587 if let Some(target_path) = self.target_path.take() {
11588 ::fidl_next::WireEnvelope::encode_value(
11589 target_path,
11590 preallocated.encoder,
11591 &mut out,
11592 )?;
11593 } else {
11594 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11595 }
11596 }
11597
11598 2 => {
11599 if let Some(source_name) = self.source_name.take() {
11600 ::fidl_next::WireEnvelope::encode_value(
11601 source_name,
11602 preallocated.encoder,
11603 &mut out,
11604 )?;
11605 } else {
11606 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11607 }
11608 }
11609
11610 1 => {
11611 if let Some(source) = self.source.take() {
11612 ::fidl_next::WireEnvelope::encode_value(
11613 source,
11614 preallocated.encoder,
11615 &mut out,
11616 )?;
11617 } else {
11618 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11619 }
11620 }
11621
11622 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
11623 }
11624 unsafe {
11625 preallocated.write_next(out.assume_init_ref());
11626 }
11627 }
11628
11629 ::fidl_next::WireTable::encode_len(table, max_ord);
11630
11631 Ok(())
11632 }
11633}
11634
11635unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseDirectory
11636where
11637 ___E: ::fidl_next::Encoder + ?Sized,
11638{
11639 #[inline]
11640 fn encode_ref(
11641 &self,
11642 encoder: &mut ___E,
11643 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
11644 ) -> Result<(), ::fidl_next::EncodeError> {
11645 ::fidl_next::munge!(let WireUseDirectory { table } = out);
11646
11647 let max_ord = self.__max_ordinal();
11648
11649 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
11650 ::fidl_next::ZeroPadding::zero_padding(&mut out);
11651
11652 let mut preallocated =
11653 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
11654
11655 for i in 1..=max_ord {
11656 match i {
11657 8 => {
11658 if let Some(source_dictionary) = &self.source_dictionary {
11659 ::fidl_next::WireEnvelope::encode_value(
11660 source_dictionary,
11661 preallocated.encoder,
11662 &mut out,
11663 )?;
11664 } else {
11665 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11666 }
11667 }
11668
11669 7 => {
11670 if let Some(availability) = &self.availability {
11671 ::fidl_next::WireEnvelope::encode_value(
11672 availability,
11673 preallocated.encoder,
11674 &mut out,
11675 )?;
11676 } else {
11677 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11678 }
11679 }
11680
11681 6 => {
11682 if let Some(dependency_type) = &self.dependency_type {
11683 ::fidl_next::WireEnvelope::encode_value(
11684 dependency_type,
11685 preallocated.encoder,
11686 &mut out,
11687 )?;
11688 } else {
11689 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11690 }
11691 }
11692
11693 5 => {
11694 if let Some(subdir) = &self.subdir {
11695 ::fidl_next::WireEnvelope::encode_value(
11696 subdir,
11697 preallocated.encoder,
11698 &mut out,
11699 )?;
11700 } else {
11701 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11702 }
11703 }
11704
11705 4 => {
11706 if let Some(rights) = &self.rights {
11707 ::fidl_next::WireEnvelope::encode_value(
11708 rights,
11709 preallocated.encoder,
11710 &mut out,
11711 )?;
11712 } else {
11713 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11714 }
11715 }
11716
11717 3 => {
11718 if let Some(target_path) = &self.target_path {
11719 ::fidl_next::WireEnvelope::encode_value(
11720 target_path,
11721 preallocated.encoder,
11722 &mut out,
11723 )?;
11724 } else {
11725 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11726 }
11727 }
11728
11729 2 => {
11730 if let Some(source_name) = &self.source_name {
11731 ::fidl_next::WireEnvelope::encode_value(
11732 source_name,
11733 preallocated.encoder,
11734 &mut out,
11735 )?;
11736 } else {
11737 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11738 }
11739 }
11740
11741 1 => {
11742 if let Some(source) = &self.source {
11743 ::fidl_next::WireEnvelope::encode_value(
11744 source,
11745 preallocated.encoder,
11746 &mut out,
11747 )?;
11748 } else {
11749 ::fidl_next::WireEnvelope::encode_zero(&mut out)
11750 }
11751 }
11752
11753 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
11754 }
11755 unsafe {
11756 preallocated.write_next(out.assume_init_ref());
11757 }
11758 }
11759
11760 ::fidl_next::WireTable::encode_len(table, max_ord);
11761
11762 Ok(())
11763 }
11764}
11765
11766impl ::fidl_next::TakeFrom<WireUseDirectory> for UseDirectory {
11767 #[inline]
11768 fn take_from(from: &WireUseDirectory) -> Self {
11769 Self {
11770 source: from.source().map(::fidl_next::TakeFrom::take_from),
11771
11772 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
11773
11774 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
11775
11776 rights: from.rights().map(::fidl_next::TakeFrom::take_from),
11777
11778 subdir: from.subdir().map(::fidl_next::TakeFrom::take_from),
11779
11780 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
11781
11782 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
11783
11784 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
11785 }
11786 }
11787}
11788
11789#[repr(C)]
11791pub struct WireUseDirectory {
11792 table: ::fidl_next::WireTable,
11793}
11794
11795unsafe impl ::fidl_next::ZeroPadding for WireUseDirectory {
11796 #[inline]
11797 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
11798 ::fidl_next::munge!(let Self { table } = out);
11799 ::fidl_next::WireTable::zero_padding(table);
11800 }
11801}
11802
11803unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseDirectory
11804where
11805 ___D: ::fidl_next::Decoder + ?Sized,
11806{
11807 fn decode(
11808 slot: ::fidl_next::Slot<'_, Self>,
11809 decoder: &mut ___D,
11810 ) -> Result<(), ::fidl_next::DecodeError> {
11811 ::fidl_next::munge!(let Self { table } = slot);
11812
11813 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
11814 match ordinal {
11815 0 => unsafe { ::core::hint::unreachable_unchecked() },
11816
11817 1 => {
11818 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
11819 slot.as_mut(),
11820 decoder,
11821 )?;
11822
11823 Ok(())
11824 }
11825
11826 2 => {
11827 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
11828 slot.as_mut(),
11829 decoder,
11830 )?;
11831
11832 let source_name = unsafe {
11833 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
11834 };
11835
11836 if source_name.len() > 100 {
11837 return Err(::fidl_next::DecodeError::VectorTooLong {
11838 size: source_name.len() as u64,
11839 limit: 100,
11840 });
11841 }
11842
11843 Ok(())
11844 }
11845
11846 3 => {
11847 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
11848 slot.as_mut(),
11849 decoder,
11850 )?;
11851
11852 let target_path = unsafe {
11853 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
11854 };
11855
11856 if target_path.len() > 1024 {
11857 return Err(::fidl_next::DecodeError::VectorTooLong {
11858 size: target_path.len() as u64,
11859 limit: 1024,
11860 });
11861 }
11862
11863 Ok(())
11864 }
11865
11866 4 => {
11867 ::fidl_next::WireEnvelope::decode_as::<
11868 ___D,
11869 ::fidl_next_fuchsia_io::WireOperations,
11870 >(slot.as_mut(), decoder)?;
11871
11872 Ok(())
11873 }
11874
11875 5 => {
11876 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
11877 slot.as_mut(),
11878 decoder,
11879 )?;
11880
11881 let subdir = unsafe {
11882 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
11883 };
11884
11885 if subdir.len() > 1024 {
11886 return Err(::fidl_next::DecodeError::VectorTooLong {
11887 size: subdir.len() as u64,
11888 limit: 1024,
11889 });
11890 }
11891
11892 Ok(())
11893 }
11894
11895 6 => {
11896 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
11897 slot.as_mut(),
11898 decoder,
11899 )?;
11900
11901 Ok(())
11902 }
11903
11904 7 => {
11905 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
11906 slot.as_mut(),
11907 decoder,
11908 )?;
11909
11910 Ok(())
11911 }
11912
11913 8 => {
11914 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
11915 slot.as_mut(),
11916 decoder,
11917 )?;
11918
11919 let source_dictionary = unsafe {
11920 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
11921 };
11922
11923 if source_dictionary.len() > 1024 {
11924 return Err(::fidl_next::DecodeError::VectorTooLong {
11925 size: source_dictionary.len() as u64,
11926 limit: 1024,
11927 });
11928 }
11929
11930 Ok(())
11931 }
11932
11933 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
11934 }
11935 })
11936 }
11937}
11938
11939impl WireUseDirectory {
11940 pub fn source(&self) -> Option<&crate::WireRef> {
11941 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
11942 }
11943
11944 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
11945 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
11946 }
11947
11948 pub fn target_path(&self) -> Option<&::fidl_next::WireString> {
11949 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
11950 }
11951
11952 pub fn rights(&self) -> Option<&::fidl_next_fuchsia_io::WireOperations> {
11953 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
11954 }
11955
11956 pub fn subdir(&self) -> Option<&::fidl_next::WireString> {
11957 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
11958 }
11959
11960 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
11961 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
11962 }
11963
11964 pub fn availability(&self) -> Option<&crate::WireAvailability> {
11965 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
11966 }
11967
11968 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
11969 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
11970 }
11971}
11972
11973impl ::core::fmt::Debug for WireUseDirectory {
11974 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
11975 f.debug_struct("UseDirectory")
11976 .field("source", &self.source())
11977 .field("source_name", &self.source_name())
11978 .field("target_path", &self.target_path())
11979 .field("rights", &self.rights())
11980 .field("subdir", &self.subdir())
11981 .field("dependency_type", &self.dependency_type())
11982 .field("availability", &self.availability())
11983 .field("source_dictionary", &self.source_dictionary())
11984 .finish()
11985 }
11986}
11987
11988#[doc = " Declares an EventStream used by a component.\n"]
11989#[derive(Clone, Debug, Default)]
11990pub struct UseEventStream {
11991 pub source_name: Option<String>,
11992
11993 pub source: Option<crate::Ref>,
11994
11995 pub scope: Option<Vec<crate::Ref>>,
11996
11997 pub target_path: Option<String>,
11998
11999 pub availability: Option<crate::Availability>,
12000
12001 pub filter: Option<::fidl_next_fuchsia_data::Dictionary>,
12002}
12003
12004impl UseEventStream {
12005 fn __max_ordinal(&self) -> usize {
12006 if self.source_name.is_some() {
12007 return 1;
12008 }
12009
12010 if self.source.is_some() {
12011 return 2;
12012 }
12013
12014 if self.scope.is_some() {
12015 return 3;
12016 }
12017
12018 if self.target_path.is_some() {
12019 return 4;
12020 }
12021
12022 if self.availability.is_some() {
12023 return 5;
12024 }
12025
12026 if self.filter.is_some() {
12027 return 6;
12028 }
12029
12030 0
12031 }
12032}
12033
12034impl ::fidl_next::Encodable for UseEventStream {
12035 type Encoded = WireUseEventStream;
12036}
12037
12038unsafe impl<___E> ::fidl_next::Encode<___E> for UseEventStream
12039where
12040 ___E: ::fidl_next::Encoder + ?Sized,
12041{
12042 #[inline]
12043 fn encode(
12044 mut self,
12045 encoder: &mut ___E,
12046 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12047 ) -> Result<(), ::fidl_next::EncodeError> {
12048 ::fidl_next::munge!(let WireUseEventStream { table } = out);
12049
12050 let max_ord = self.__max_ordinal();
12051
12052 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12053 ::fidl_next::ZeroPadding::zero_padding(&mut out);
12054
12055 let mut preallocated =
12056 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12057
12058 for i in 1..=max_ord {
12059 match i {
12060 6 => {
12061 if let Some(filter) = self.filter.take() {
12062 ::fidl_next::WireEnvelope::encode_value(
12063 filter,
12064 preallocated.encoder,
12065 &mut out,
12066 )?;
12067 } else {
12068 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12069 }
12070 }
12071
12072 5 => {
12073 if let Some(availability) = self.availability.take() {
12074 ::fidl_next::WireEnvelope::encode_value(
12075 availability,
12076 preallocated.encoder,
12077 &mut out,
12078 )?;
12079 } else {
12080 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12081 }
12082 }
12083
12084 4 => {
12085 if let Some(target_path) = self.target_path.take() {
12086 ::fidl_next::WireEnvelope::encode_value(
12087 target_path,
12088 preallocated.encoder,
12089 &mut out,
12090 )?;
12091 } else {
12092 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12093 }
12094 }
12095
12096 3 => {
12097 if let Some(scope) = self.scope.take() {
12098 ::fidl_next::WireEnvelope::encode_value(
12099 scope,
12100 preallocated.encoder,
12101 &mut out,
12102 )?;
12103 } else {
12104 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12105 }
12106 }
12107
12108 2 => {
12109 if let Some(source) = self.source.take() {
12110 ::fidl_next::WireEnvelope::encode_value(
12111 source,
12112 preallocated.encoder,
12113 &mut out,
12114 )?;
12115 } else {
12116 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12117 }
12118 }
12119
12120 1 => {
12121 if let Some(source_name) = self.source_name.take() {
12122 ::fidl_next::WireEnvelope::encode_value(
12123 source_name,
12124 preallocated.encoder,
12125 &mut out,
12126 )?;
12127 } else {
12128 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12129 }
12130 }
12131
12132 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12133 }
12134 unsafe {
12135 preallocated.write_next(out.assume_init_ref());
12136 }
12137 }
12138
12139 ::fidl_next::WireTable::encode_len(table, max_ord);
12140
12141 Ok(())
12142 }
12143}
12144
12145unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseEventStream
12146where
12147 ___E: ::fidl_next::Encoder + ?Sized,
12148{
12149 #[inline]
12150 fn encode_ref(
12151 &self,
12152 encoder: &mut ___E,
12153 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12154 ) -> Result<(), ::fidl_next::EncodeError> {
12155 ::fidl_next::munge!(let WireUseEventStream { table } = out);
12156
12157 let max_ord = self.__max_ordinal();
12158
12159 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12160 ::fidl_next::ZeroPadding::zero_padding(&mut out);
12161
12162 let mut preallocated =
12163 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12164
12165 for i in 1..=max_ord {
12166 match i {
12167 6 => {
12168 if let Some(filter) = &self.filter {
12169 ::fidl_next::WireEnvelope::encode_value(
12170 filter,
12171 preallocated.encoder,
12172 &mut out,
12173 )?;
12174 } else {
12175 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12176 }
12177 }
12178
12179 5 => {
12180 if let Some(availability) = &self.availability {
12181 ::fidl_next::WireEnvelope::encode_value(
12182 availability,
12183 preallocated.encoder,
12184 &mut out,
12185 )?;
12186 } else {
12187 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12188 }
12189 }
12190
12191 4 => {
12192 if let Some(target_path) = &self.target_path {
12193 ::fidl_next::WireEnvelope::encode_value(
12194 target_path,
12195 preallocated.encoder,
12196 &mut out,
12197 )?;
12198 } else {
12199 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12200 }
12201 }
12202
12203 3 => {
12204 if let Some(scope) = &self.scope {
12205 ::fidl_next::WireEnvelope::encode_value(
12206 scope,
12207 preallocated.encoder,
12208 &mut out,
12209 )?;
12210 } else {
12211 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12212 }
12213 }
12214
12215 2 => {
12216 if let Some(source) = &self.source {
12217 ::fidl_next::WireEnvelope::encode_value(
12218 source,
12219 preallocated.encoder,
12220 &mut out,
12221 )?;
12222 } else {
12223 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12224 }
12225 }
12226
12227 1 => {
12228 if let Some(source_name) = &self.source_name {
12229 ::fidl_next::WireEnvelope::encode_value(
12230 source_name,
12231 preallocated.encoder,
12232 &mut out,
12233 )?;
12234 } else {
12235 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12236 }
12237 }
12238
12239 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12240 }
12241 unsafe {
12242 preallocated.write_next(out.assume_init_ref());
12243 }
12244 }
12245
12246 ::fidl_next::WireTable::encode_len(table, max_ord);
12247
12248 Ok(())
12249 }
12250}
12251
12252impl ::fidl_next::TakeFrom<WireUseEventStream> for UseEventStream {
12253 #[inline]
12254 fn take_from(from: &WireUseEventStream) -> Self {
12255 Self {
12256 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
12257
12258 source: from.source().map(::fidl_next::TakeFrom::take_from),
12259
12260 scope: from.scope().map(::fidl_next::TakeFrom::take_from),
12261
12262 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
12263
12264 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
12265
12266 filter: from.filter().map(::fidl_next::TakeFrom::take_from),
12267 }
12268 }
12269}
12270
12271#[repr(C)]
12273pub struct WireUseEventStream {
12274 table: ::fidl_next::WireTable,
12275}
12276
12277unsafe impl ::fidl_next::ZeroPadding for WireUseEventStream {
12278 #[inline]
12279 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
12280 ::fidl_next::munge!(let Self { table } = out);
12281 ::fidl_next::WireTable::zero_padding(table);
12282 }
12283}
12284
12285unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseEventStream
12286where
12287 ___D: ::fidl_next::Decoder + ?Sized,
12288{
12289 fn decode(
12290 slot: ::fidl_next::Slot<'_, Self>,
12291 decoder: &mut ___D,
12292 ) -> Result<(), ::fidl_next::DecodeError> {
12293 ::fidl_next::munge!(let Self { table } = slot);
12294
12295 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
12296 match ordinal {
12297 0 => unsafe { ::core::hint::unreachable_unchecked() },
12298
12299 1 => {
12300 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
12301 slot.as_mut(),
12302 decoder,
12303 )?;
12304
12305 let source_name = unsafe {
12306 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
12307 };
12308
12309 if source_name.len() > 100 {
12310 return Err(::fidl_next::DecodeError::VectorTooLong {
12311 size: source_name.len() as u64,
12312 limit: 100,
12313 });
12314 }
12315
12316 Ok(())
12317 }
12318
12319 2 => {
12320 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
12321 slot.as_mut(),
12322 decoder,
12323 )?;
12324
12325 Ok(())
12326 }
12327
12328 3 => {
12329 ::fidl_next::WireEnvelope::decode_as::<
12330 ___D,
12331 ::fidl_next::WireVector<crate::WireRef>,
12332 >(slot.as_mut(), decoder)?;
12333
12334 Ok(())
12335 }
12336
12337 4 => {
12338 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
12339 slot.as_mut(),
12340 decoder,
12341 )?;
12342
12343 let target_path = unsafe {
12344 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
12345 };
12346
12347 if target_path.len() > 100 {
12348 return Err(::fidl_next::DecodeError::VectorTooLong {
12349 size: target_path.len() as u64,
12350 limit: 100,
12351 });
12352 }
12353
12354 Ok(())
12355 }
12356
12357 5 => {
12358 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
12359 slot.as_mut(),
12360 decoder,
12361 )?;
12362
12363 Ok(())
12364 }
12365
12366 6 => {
12367 ::fidl_next::WireEnvelope::decode_as::<
12368 ___D,
12369 ::fidl_next_fuchsia_data::WireDictionary,
12370 >(slot.as_mut(), decoder)?;
12371
12372 Ok(())
12373 }
12374
12375 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
12376 }
12377 })
12378 }
12379}
12380
12381impl WireUseEventStream {
12382 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
12383 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
12384 }
12385
12386 pub fn source(&self) -> Option<&crate::WireRef> {
12387 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
12388 }
12389
12390 pub fn scope(&self) -> Option<&::fidl_next::WireVector<crate::WireRef>> {
12391 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
12392 }
12393
12394 pub fn target_path(&self) -> Option<&::fidl_next::WireString> {
12395 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
12396 }
12397
12398 pub fn availability(&self) -> Option<&crate::WireAvailability> {
12399 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
12400 }
12401
12402 pub fn filter(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary> {
12403 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
12404 }
12405}
12406
12407impl ::core::fmt::Debug for WireUseEventStream {
12408 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
12409 f.debug_struct("UseEventStream")
12410 .field("source_name", &self.source_name())
12411 .field("source", &self.source())
12412 .field("scope", &self.scope())
12413 .field("target_path", &self.target_path())
12414 .field("availability", &self.availability())
12415 .field("filter", &self.filter())
12416 .finish()
12417 }
12418}
12419
12420#[doc = " Declares runner used by a component.\n"]
12421#[derive(Clone, Debug, Default)]
12422pub struct UseRunner {
12423 pub source: Option<crate::Ref>,
12424
12425 pub source_name: Option<String>,
12426
12427 pub source_dictionary: Option<String>,
12428}
12429
12430impl UseRunner {
12431 fn __max_ordinal(&self) -> usize {
12432 if self.source.is_some() {
12433 return 1;
12434 }
12435
12436 if self.source_name.is_some() {
12437 return 2;
12438 }
12439
12440 if self.source_dictionary.is_some() {
12441 return 3;
12442 }
12443
12444 0
12445 }
12446}
12447
12448impl ::fidl_next::Encodable for UseRunner {
12449 type Encoded = WireUseRunner;
12450}
12451
12452unsafe impl<___E> ::fidl_next::Encode<___E> for UseRunner
12453where
12454 ___E: ::fidl_next::Encoder + ?Sized,
12455{
12456 #[inline]
12457 fn encode(
12458 mut self,
12459 encoder: &mut ___E,
12460 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12461 ) -> Result<(), ::fidl_next::EncodeError> {
12462 ::fidl_next::munge!(let WireUseRunner { table } = out);
12463
12464 let max_ord = self.__max_ordinal();
12465
12466 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12467 ::fidl_next::ZeroPadding::zero_padding(&mut out);
12468
12469 let mut preallocated =
12470 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12471
12472 for i in 1..=max_ord {
12473 match i {
12474 3 => {
12475 if let Some(source_dictionary) = self.source_dictionary.take() {
12476 ::fidl_next::WireEnvelope::encode_value(
12477 source_dictionary,
12478 preallocated.encoder,
12479 &mut out,
12480 )?;
12481 } else {
12482 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12483 }
12484 }
12485
12486 2 => {
12487 if let Some(source_name) = self.source_name.take() {
12488 ::fidl_next::WireEnvelope::encode_value(
12489 source_name,
12490 preallocated.encoder,
12491 &mut out,
12492 )?;
12493 } else {
12494 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12495 }
12496 }
12497
12498 1 => {
12499 if let Some(source) = self.source.take() {
12500 ::fidl_next::WireEnvelope::encode_value(
12501 source,
12502 preallocated.encoder,
12503 &mut out,
12504 )?;
12505 } else {
12506 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12507 }
12508 }
12509
12510 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12511 }
12512 unsafe {
12513 preallocated.write_next(out.assume_init_ref());
12514 }
12515 }
12516
12517 ::fidl_next::WireTable::encode_len(table, max_ord);
12518
12519 Ok(())
12520 }
12521}
12522
12523unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseRunner
12524where
12525 ___E: ::fidl_next::Encoder + ?Sized,
12526{
12527 #[inline]
12528 fn encode_ref(
12529 &self,
12530 encoder: &mut ___E,
12531 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12532 ) -> Result<(), ::fidl_next::EncodeError> {
12533 ::fidl_next::munge!(let WireUseRunner { table } = out);
12534
12535 let max_ord = self.__max_ordinal();
12536
12537 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12538 ::fidl_next::ZeroPadding::zero_padding(&mut out);
12539
12540 let mut preallocated =
12541 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12542
12543 for i in 1..=max_ord {
12544 match i {
12545 3 => {
12546 if let Some(source_dictionary) = &self.source_dictionary {
12547 ::fidl_next::WireEnvelope::encode_value(
12548 source_dictionary,
12549 preallocated.encoder,
12550 &mut out,
12551 )?;
12552 } else {
12553 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12554 }
12555 }
12556
12557 2 => {
12558 if let Some(source_name) = &self.source_name {
12559 ::fidl_next::WireEnvelope::encode_value(
12560 source_name,
12561 preallocated.encoder,
12562 &mut out,
12563 )?;
12564 } else {
12565 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12566 }
12567 }
12568
12569 1 => {
12570 if let Some(source) = &self.source {
12571 ::fidl_next::WireEnvelope::encode_value(
12572 source,
12573 preallocated.encoder,
12574 &mut out,
12575 )?;
12576 } else {
12577 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12578 }
12579 }
12580
12581 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12582 }
12583 unsafe {
12584 preallocated.write_next(out.assume_init_ref());
12585 }
12586 }
12587
12588 ::fidl_next::WireTable::encode_len(table, max_ord);
12589
12590 Ok(())
12591 }
12592}
12593
12594impl ::fidl_next::TakeFrom<WireUseRunner> for UseRunner {
12595 #[inline]
12596 fn take_from(from: &WireUseRunner) -> Self {
12597 Self {
12598 source: from.source().map(::fidl_next::TakeFrom::take_from),
12599
12600 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
12601
12602 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
12603 }
12604 }
12605}
12606
12607#[repr(C)]
12609pub struct WireUseRunner {
12610 table: ::fidl_next::WireTable,
12611}
12612
12613unsafe impl ::fidl_next::ZeroPadding for WireUseRunner {
12614 #[inline]
12615 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
12616 ::fidl_next::munge!(let Self { table } = out);
12617 ::fidl_next::WireTable::zero_padding(table);
12618 }
12619}
12620
12621unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseRunner
12622where
12623 ___D: ::fidl_next::Decoder + ?Sized,
12624{
12625 fn decode(
12626 slot: ::fidl_next::Slot<'_, Self>,
12627 decoder: &mut ___D,
12628 ) -> Result<(), ::fidl_next::DecodeError> {
12629 ::fidl_next::munge!(let Self { table } = slot);
12630
12631 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
12632 match ordinal {
12633 0 => unsafe { ::core::hint::unreachable_unchecked() },
12634
12635 1 => {
12636 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
12637 slot.as_mut(),
12638 decoder,
12639 )?;
12640
12641 Ok(())
12642 }
12643
12644 2 => {
12645 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
12646 slot.as_mut(),
12647 decoder,
12648 )?;
12649
12650 let source_name = unsafe {
12651 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
12652 };
12653
12654 if source_name.len() > 100 {
12655 return Err(::fidl_next::DecodeError::VectorTooLong {
12656 size: source_name.len() as u64,
12657 limit: 100,
12658 });
12659 }
12660
12661 Ok(())
12662 }
12663
12664 3 => {
12665 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
12666 slot.as_mut(),
12667 decoder,
12668 )?;
12669
12670 let source_dictionary = unsafe {
12671 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
12672 };
12673
12674 if source_dictionary.len() > 1024 {
12675 return Err(::fidl_next::DecodeError::VectorTooLong {
12676 size: source_dictionary.len() as u64,
12677 limit: 1024,
12678 });
12679 }
12680
12681 Ok(())
12682 }
12683
12684 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
12685 }
12686 })
12687 }
12688}
12689
12690impl WireUseRunner {
12691 pub fn source(&self) -> Option<&crate::WireRef> {
12692 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
12693 }
12694
12695 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
12696 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
12697 }
12698
12699 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
12700 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
12701 }
12702}
12703
12704impl ::core::fmt::Debug for WireUseRunner {
12705 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
12706 f.debug_struct("UseRunner")
12707 .field("source", &self.source())
12708 .field("source_name", &self.source_name())
12709 .field("source_dictionary", &self.source_dictionary())
12710 .finish()
12711 }
12712}
12713
12714#[derive(Clone, Debug, Default)]
12715pub struct UseConfiguration {
12716 pub source: Option<crate::Ref>,
12717
12718 pub source_name: Option<String>,
12719
12720 pub target_name: Option<String>,
12721
12722 pub availability: Option<crate::Availability>,
12723
12724 pub type_: Option<crate::ConfigType>,
12725
12726 pub default: Option<crate::ConfigValue>,
12727
12728 pub source_dictionary: Option<String>,
12729}
12730
12731impl UseConfiguration {
12732 fn __max_ordinal(&self) -> usize {
12733 if self.source.is_some() {
12734 return 1;
12735 }
12736
12737 if self.source_name.is_some() {
12738 return 2;
12739 }
12740
12741 if self.target_name.is_some() {
12742 return 3;
12743 }
12744
12745 if self.availability.is_some() {
12746 return 4;
12747 }
12748
12749 if self.type_.is_some() {
12750 return 5;
12751 }
12752
12753 if self.default.is_some() {
12754 return 6;
12755 }
12756
12757 if self.source_dictionary.is_some() {
12758 return 7;
12759 }
12760
12761 0
12762 }
12763}
12764
12765impl ::fidl_next::Encodable for UseConfiguration {
12766 type Encoded = WireUseConfiguration;
12767}
12768
12769unsafe impl<___E> ::fidl_next::Encode<___E> for UseConfiguration
12770where
12771 ___E: ::fidl_next::Encoder + ?Sized,
12772{
12773 #[inline]
12774 fn encode(
12775 mut self,
12776 encoder: &mut ___E,
12777 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12778 ) -> Result<(), ::fidl_next::EncodeError> {
12779 ::fidl_next::munge!(let WireUseConfiguration { table } = out);
12780
12781 let max_ord = self.__max_ordinal();
12782
12783 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12784 ::fidl_next::ZeroPadding::zero_padding(&mut out);
12785
12786 let mut preallocated =
12787 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12788
12789 for i in 1..=max_ord {
12790 match i {
12791 7 => {
12792 if let Some(source_dictionary) = self.source_dictionary.take() {
12793 ::fidl_next::WireEnvelope::encode_value(
12794 source_dictionary,
12795 preallocated.encoder,
12796 &mut out,
12797 )?;
12798 } else {
12799 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12800 }
12801 }
12802
12803 6 => {
12804 if let Some(default) = self.default.take() {
12805 ::fidl_next::WireEnvelope::encode_value(
12806 default,
12807 preallocated.encoder,
12808 &mut out,
12809 )?;
12810 } else {
12811 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12812 }
12813 }
12814
12815 5 => {
12816 if let Some(type_) = self.type_.take() {
12817 ::fidl_next::WireEnvelope::encode_value(
12818 type_,
12819 preallocated.encoder,
12820 &mut out,
12821 )?;
12822 } else {
12823 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12824 }
12825 }
12826
12827 4 => {
12828 if let Some(availability) = self.availability.take() {
12829 ::fidl_next::WireEnvelope::encode_value(
12830 availability,
12831 preallocated.encoder,
12832 &mut out,
12833 )?;
12834 } else {
12835 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12836 }
12837 }
12838
12839 3 => {
12840 if let Some(target_name) = self.target_name.take() {
12841 ::fidl_next::WireEnvelope::encode_value(
12842 target_name,
12843 preallocated.encoder,
12844 &mut out,
12845 )?;
12846 } else {
12847 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12848 }
12849 }
12850
12851 2 => {
12852 if let Some(source_name) = self.source_name.take() {
12853 ::fidl_next::WireEnvelope::encode_value(
12854 source_name,
12855 preallocated.encoder,
12856 &mut out,
12857 )?;
12858 } else {
12859 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12860 }
12861 }
12862
12863 1 => {
12864 if let Some(source) = self.source.take() {
12865 ::fidl_next::WireEnvelope::encode_value(
12866 source,
12867 preallocated.encoder,
12868 &mut out,
12869 )?;
12870 } else {
12871 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12872 }
12873 }
12874
12875 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12876 }
12877 unsafe {
12878 preallocated.write_next(out.assume_init_ref());
12879 }
12880 }
12881
12882 ::fidl_next::WireTable::encode_len(table, max_ord);
12883
12884 Ok(())
12885 }
12886}
12887
12888unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UseConfiguration
12889where
12890 ___E: ::fidl_next::Encoder + ?Sized,
12891{
12892 #[inline]
12893 fn encode_ref(
12894 &self,
12895 encoder: &mut ___E,
12896 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
12897 ) -> Result<(), ::fidl_next::EncodeError> {
12898 ::fidl_next::munge!(let WireUseConfiguration { table } = out);
12899
12900 let max_ord = self.__max_ordinal();
12901
12902 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
12903 ::fidl_next::ZeroPadding::zero_padding(&mut out);
12904
12905 let mut preallocated =
12906 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
12907
12908 for i in 1..=max_ord {
12909 match i {
12910 7 => {
12911 if let Some(source_dictionary) = &self.source_dictionary {
12912 ::fidl_next::WireEnvelope::encode_value(
12913 source_dictionary,
12914 preallocated.encoder,
12915 &mut out,
12916 )?;
12917 } else {
12918 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12919 }
12920 }
12921
12922 6 => {
12923 if let Some(default) = &self.default {
12924 ::fidl_next::WireEnvelope::encode_value(
12925 default,
12926 preallocated.encoder,
12927 &mut out,
12928 )?;
12929 } else {
12930 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12931 }
12932 }
12933
12934 5 => {
12935 if let Some(type_) = &self.type_ {
12936 ::fidl_next::WireEnvelope::encode_value(
12937 type_,
12938 preallocated.encoder,
12939 &mut out,
12940 )?;
12941 } else {
12942 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12943 }
12944 }
12945
12946 4 => {
12947 if let Some(availability) = &self.availability {
12948 ::fidl_next::WireEnvelope::encode_value(
12949 availability,
12950 preallocated.encoder,
12951 &mut out,
12952 )?;
12953 } else {
12954 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12955 }
12956 }
12957
12958 3 => {
12959 if let Some(target_name) = &self.target_name {
12960 ::fidl_next::WireEnvelope::encode_value(
12961 target_name,
12962 preallocated.encoder,
12963 &mut out,
12964 )?;
12965 } else {
12966 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12967 }
12968 }
12969
12970 2 => {
12971 if let Some(source_name) = &self.source_name {
12972 ::fidl_next::WireEnvelope::encode_value(
12973 source_name,
12974 preallocated.encoder,
12975 &mut out,
12976 )?;
12977 } else {
12978 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12979 }
12980 }
12981
12982 1 => {
12983 if let Some(source) = &self.source {
12984 ::fidl_next::WireEnvelope::encode_value(
12985 source,
12986 preallocated.encoder,
12987 &mut out,
12988 )?;
12989 } else {
12990 ::fidl_next::WireEnvelope::encode_zero(&mut out)
12991 }
12992 }
12993
12994 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
12995 }
12996 unsafe {
12997 preallocated.write_next(out.assume_init_ref());
12998 }
12999 }
13000
13001 ::fidl_next::WireTable::encode_len(table, max_ord);
13002
13003 Ok(())
13004 }
13005}
13006
13007impl ::fidl_next::TakeFrom<WireUseConfiguration> for UseConfiguration {
13008 #[inline]
13009 fn take_from(from: &WireUseConfiguration) -> Self {
13010 Self {
13011 source: from.source().map(::fidl_next::TakeFrom::take_from),
13012
13013 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
13014
13015 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
13016
13017 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
13018
13019 type_: from.type_().map(::fidl_next::TakeFrom::take_from),
13020
13021 default: from.default().map(::fidl_next::TakeFrom::take_from),
13022
13023 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
13024 }
13025 }
13026}
13027
13028#[repr(C)]
13030pub struct WireUseConfiguration {
13031 table: ::fidl_next::WireTable,
13032}
13033
13034unsafe impl ::fidl_next::ZeroPadding for WireUseConfiguration {
13035 #[inline]
13036 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
13037 ::fidl_next::munge!(let Self { table } = out);
13038 ::fidl_next::WireTable::zero_padding(table);
13039 }
13040}
13041
13042unsafe impl<___D> ::fidl_next::Decode<___D> for WireUseConfiguration
13043where
13044 ___D: ::fidl_next::Decoder + ?Sized,
13045{
13046 fn decode(
13047 slot: ::fidl_next::Slot<'_, Self>,
13048 decoder: &mut ___D,
13049 ) -> Result<(), ::fidl_next::DecodeError> {
13050 ::fidl_next::munge!(let Self { table } = slot);
13051
13052 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
13053 match ordinal {
13054 0 => unsafe { ::core::hint::unreachable_unchecked() },
13055
13056 1 => {
13057 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
13058 slot.as_mut(),
13059 decoder,
13060 )?;
13061
13062 Ok(())
13063 }
13064
13065 2 => {
13066 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
13067 slot.as_mut(),
13068 decoder,
13069 )?;
13070
13071 let source_name = unsafe {
13072 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
13073 };
13074
13075 if source_name.len() > 100 {
13076 return Err(::fidl_next::DecodeError::VectorTooLong {
13077 size: source_name.len() as u64,
13078 limit: 100,
13079 });
13080 }
13081
13082 Ok(())
13083 }
13084
13085 3 => {
13086 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
13087 slot.as_mut(),
13088 decoder,
13089 )?;
13090
13091 let target_name = unsafe {
13092 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
13093 };
13094
13095 if target_name.len() > 100 {
13096 return Err(::fidl_next::DecodeError::VectorTooLong {
13097 size: target_name.len() as u64,
13098 limit: 100,
13099 });
13100 }
13101
13102 Ok(())
13103 }
13104
13105 4 => {
13106 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
13107 slot.as_mut(),
13108 decoder,
13109 )?;
13110
13111 Ok(())
13112 }
13113
13114 5 => {
13115 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigType>(
13116 slot.as_mut(),
13117 decoder,
13118 )?;
13119
13120 Ok(())
13121 }
13122
13123 6 => {
13124 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValue>(
13125 slot.as_mut(),
13126 decoder,
13127 )?;
13128
13129 Ok(())
13130 }
13131
13132 7 => {
13133 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
13134 slot.as_mut(),
13135 decoder,
13136 )?;
13137
13138 let source_dictionary = unsafe {
13139 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
13140 };
13141
13142 if source_dictionary.len() > 1024 {
13143 return Err(::fidl_next::DecodeError::VectorTooLong {
13144 size: source_dictionary.len() as u64,
13145 limit: 1024,
13146 });
13147 }
13148
13149 Ok(())
13150 }
13151
13152 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
13153 }
13154 })
13155 }
13156}
13157
13158impl WireUseConfiguration {
13159 pub fn source(&self) -> Option<&crate::WireRef> {
13160 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
13161 }
13162
13163 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
13164 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
13165 }
13166
13167 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
13168 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
13169 }
13170
13171 pub fn availability(&self) -> Option<&crate::WireAvailability> {
13172 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
13173 }
13174
13175 pub fn type_(&self) -> Option<&crate::WireConfigType> {
13176 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
13177 }
13178
13179 pub fn default(&self) -> Option<&crate::WireConfigValue> {
13180 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
13181 }
13182
13183 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
13184 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
13185 }
13186}
13187
13188impl ::core::fmt::Debug for WireUseConfiguration {
13189 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
13190 f.debug_struct("UseConfiguration")
13191 .field("source", &self.source())
13192 .field("source_name", &self.source_name())
13193 .field("target_name", &self.target_name())
13194 .field("availability", &self.availability())
13195 .field("type_", &self.type_())
13196 .field("default", &self.default())
13197 .field("source_dictionary", &self.source_dictionary())
13198 .finish()
13199 }
13200}
13201
13202#[doc = " Declares a capability used by a component, which was offered to it.\n"]
13203#[derive(Clone, Debug)]
13204pub enum Use {
13205 Service(crate::UseService),
13206
13207 Protocol(crate::UseProtocol),
13208
13209 Directory(crate::UseDirectory),
13210
13211 Storage(crate::UseStorage),
13212
13213 EventStream(crate::UseEventStream),
13214
13215 Runner(crate::UseRunner),
13216
13217 Config(crate::UseConfiguration),
13218
13219 UnknownOrdinal_(u64),
13220}
13221
13222impl ::fidl_next::Encodable for Use {
13223 type Encoded = WireUse;
13224}
13225
13226unsafe impl<___E> ::fidl_next::Encode<___E> for Use
13227where
13228 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
13229
13230 ___E: ::fidl_next::Encoder,
13231{
13232 #[inline]
13233 fn encode(
13234 self,
13235 encoder: &mut ___E,
13236 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
13237 ) -> Result<(), ::fidl_next::EncodeError> {
13238 ::fidl_next::munge!(let WireUse { raw } = out);
13239
13240 match self {
13241 Self::Service(value) => {
13242 ::fidl_next::RawWireUnion::encode_as::<___E, crate::UseService>(
13243 value, 1, encoder, raw,
13244 )?
13245 }
13246
13247 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
13248 ___E,
13249 crate::UseProtocol,
13250 >(value, 2, encoder, raw)?,
13251
13252 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
13253 ___E,
13254 crate::UseDirectory,
13255 >(value, 3, encoder, raw)?,
13256
13257 Self::Storage(value) => {
13258 ::fidl_next::RawWireUnion::encode_as::<___E, crate::UseStorage>(
13259 value, 4, encoder, raw,
13260 )?
13261 }
13262
13263 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
13264 ___E,
13265 crate::UseEventStream,
13266 >(value, 7, encoder, raw)?,
13267
13268 Self::Runner(value) => ::fidl_next::RawWireUnion::encode_as::<___E, crate::UseRunner>(
13269 value, 8, encoder, raw,
13270 )?,
13271
13272 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
13273 ___E,
13274 crate::UseConfiguration,
13275 >(value, 9, encoder, raw)?,
13276
13277 Self::UnknownOrdinal_(ordinal) => {
13278 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
13279 }
13280 }
13281
13282 Ok(())
13283 }
13284}
13285
13286unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Use
13287where
13288 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
13289
13290 ___E: ::fidl_next::Encoder,
13291{
13292 #[inline]
13293 fn encode_ref(
13294 &self,
13295 encoder: &mut ___E,
13296 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
13297 ) -> Result<(), ::fidl_next::EncodeError> {
13298 ::fidl_next::munge!(let WireUse { raw } = out);
13299
13300 match self {
13301 Self::Service(value) => {
13302 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::UseService>(
13303 value, 1, encoder, raw,
13304 )?
13305 }
13306
13307 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
13308 ___E,
13309 &crate::UseProtocol,
13310 >(value, 2, encoder, raw)?,
13311
13312 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
13313 ___E,
13314 &crate::UseDirectory,
13315 >(value, 3, encoder, raw)?,
13316
13317 Self::Storage(value) => {
13318 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::UseStorage>(
13319 value, 4, encoder, raw,
13320 )?
13321 }
13322
13323 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
13324 ___E,
13325 &crate::UseEventStream,
13326 >(value, 7, encoder, raw)?,
13327
13328 Self::Runner(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &crate::UseRunner>(
13329 value, 8, encoder, raw,
13330 )?,
13331
13332 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
13333 ___E,
13334 &crate::UseConfiguration,
13335 >(value, 9, encoder, raw)?,
13336
13337 Self::UnknownOrdinal_(ordinal) => {
13338 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
13339 }
13340 }
13341
13342 Ok(())
13343 }
13344}
13345
13346impl ::fidl_next::EncodableOption for Box<Use> {
13347 type EncodedOption = WireOptionalUse;
13348}
13349
13350unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<Use>
13351where
13352 ___E: ?Sized,
13353 Use: ::fidl_next::Encode<___E>,
13354{
13355 #[inline]
13356 fn encode_option(
13357 this: Option<Self>,
13358 encoder: &mut ___E,
13359 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
13360 ) -> Result<(), ::fidl_next::EncodeError> {
13361 ::fidl_next::munge!(let WireOptionalUse { raw } = &mut *out);
13362
13363 if let Some(inner) = this {
13364 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
13365 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
13366 } else {
13367 ::fidl_next::RawWireUnion::encode_absent(raw);
13368 }
13369
13370 Ok(())
13371 }
13372}
13373
13374unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<Use>
13375where
13376 ___E: ?Sized,
13377 Use: ::fidl_next::EncodeRef<___E>,
13378{
13379 #[inline]
13380 fn encode_option_ref(
13381 this: Option<&Self>,
13382 encoder: &mut ___E,
13383 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
13384 ) -> Result<(), ::fidl_next::EncodeError> {
13385 ::fidl_next::munge!(let WireOptionalUse { raw } = &mut *out);
13386
13387 if let Some(inner) = this {
13388 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
13389 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
13390 } else {
13391 ::fidl_next::RawWireUnion::encode_absent(raw);
13392 }
13393
13394 Ok(())
13395 }
13396}
13397
13398impl ::fidl_next::TakeFrom<WireUse> for Use {
13399 #[inline]
13400 fn take_from(from: &WireUse) -> Self {
13401 match from.raw.ordinal() {
13402 1 => Self::Service(::fidl_next::TakeFrom::take_from(unsafe {
13403 from.raw.get().deref_unchecked::<crate::WireUseService>()
13404 })),
13405
13406 2 => Self::Protocol(::fidl_next::TakeFrom::take_from(unsafe {
13407 from.raw.get().deref_unchecked::<crate::WireUseProtocol>()
13408 })),
13409
13410 3 => Self::Directory(::fidl_next::TakeFrom::take_from(unsafe {
13411 from.raw.get().deref_unchecked::<crate::WireUseDirectory>()
13412 })),
13413
13414 4 => Self::Storage(::fidl_next::TakeFrom::take_from(unsafe {
13415 from.raw.get().deref_unchecked::<crate::WireUseStorage>()
13416 })),
13417
13418 7 => Self::EventStream(::fidl_next::TakeFrom::take_from(unsafe {
13419 from.raw.get().deref_unchecked::<crate::WireUseEventStream>()
13420 })),
13421
13422 8 => Self::Runner(::fidl_next::TakeFrom::take_from(unsafe {
13423 from.raw.get().deref_unchecked::<crate::WireUseRunner>()
13424 })),
13425
13426 9 => Self::Config(::fidl_next::TakeFrom::take_from(unsafe {
13427 from.raw.get().deref_unchecked::<crate::WireUseConfiguration>()
13428 })),
13429
13430 _ => unsafe { ::core::hint::unreachable_unchecked() },
13431 }
13432 }
13433}
13434
13435impl ::fidl_next::TakeFrom<WireOptionalUse> for Option<Box<Use>> {
13436 #[inline]
13437 fn take_from(from: &WireOptionalUse) -> Self {
13438 if let Some(inner) = from.as_ref() {
13439 Some(::fidl_next::TakeFrom::take_from(inner))
13440 } else {
13441 None
13442 }
13443 }
13444}
13445
13446#[repr(transparent)]
13448pub struct WireUse {
13449 raw: ::fidl_next::RawWireUnion,
13450}
13451
13452unsafe impl ::fidl_next::ZeroPadding for WireUse {
13453 #[inline]
13454 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
13455 ::fidl_next::munge!(let Self { raw } = out);
13456 ::fidl_next::RawWireUnion::zero_padding(raw);
13457 }
13458}
13459
13460pub mod use_ {
13461 pub enum Ref<'union> {
13462 Service(&'union crate::WireUseService),
13463
13464 Protocol(&'union crate::WireUseProtocol),
13465
13466 Directory(&'union crate::WireUseDirectory),
13467
13468 Storage(&'union crate::WireUseStorage),
13469
13470 EventStream(&'union crate::WireUseEventStream),
13471
13472 Runner(&'union crate::WireUseRunner),
13473
13474 Config(&'union crate::WireUseConfiguration),
13475
13476 UnknownOrdinal_(u64),
13477 }
13478}
13479
13480impl WireUse {
13481 pub fn as_ref(&self) -> crate::use_::Ref<'_> {
13482 match self.raw.ordinal() {
13483 1 => crate::use_::Ref::Service(unsafe {
13484 self.raw.get().deref_unchecked::<crate::WireUseService>()
13485 }),
13486
13487 2 => crate::use_::Ref::Protocol(unsafe {
13488 self.raw.get().deref_unchecked::<crate::WireUseProtocol>()
13489 }),
13490
13491 3 => crate::use_::Ref::Directory(unsafe {
13492 self.raw.get().deref_unchecked::<crate::WireUseDirectory>()
13493 }),
13494
13495 4 => crate::use_::Ref::Storage(unsafe {
13496 self.raw.get().deref_unchecked::<crate::WireUseStorage>()
13497 }),
13498
13499 7 => crate::use_::Ref::EventStream(unsafe {
13500 self.raw.get().deref_unchecked::<crate::WireUseEventStream>()
13501 }),
13502
13503 8 => crate::use_::Ref::Runner(unsafe {
13504 self.raw.get().deref_unchecked::<crate::WireUseRunner>()
13505 }),
13506
13507 9 => crate::use_::Ref::Config(unsafe {
13508 self.raw.get().deref_unchecked::<crate::WireUseConfiguration>()
13509 }),
13510
13511 unknown => crate::use_::Ref::UnknownOrdinal_(unknown),
13512 }
13513 }
13514}
13515
13516unsafe impl<___D> ::fidl_next::Decode<___D> for WireUse
13517where
13518 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
13519
13520 ___D: ::fidl_next::Decoder,
13521{
13522 fn decode(
13523 mut slot: ::fidl_next::Slot<'_, Self>,
13524 decoder: &mut ___D,
13525 ) -> Result<(), ::fidl_next::DecodeError> {
13526 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
13527 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
13528 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseService>(raw, decoder)?,
13529
13530 2 => {
13531 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseProtocol>(raw, decoder)?
13532 }
13533
13534 3 => {
13535 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseDirectory>(raw, decoder)?
13536 }
13537
13538 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseStorage>(raw, decoder)?,
13539
13540 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseEventStream>(
13541 raw, decoder,
13542 )?,
13543
13544 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseRunner>(raw, decoder)?,
13545
13546 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseConfiguration>(
13547 raw, decoder,
13548 )?,
13549
13550 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
13551 }
13552
13553 Ok(())
13554 }
13555}
13556
13557impl ::core::fmt::Debug for WireUse {
13558 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
13559 match self.raw.ordinal() {
13560 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseService>().fmt(f) },
13561 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseProtocol>().fmt(f) },
13562 3 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseDirectory>().fmt(f) },
13563 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseStorage>().fmt(f) },
13564 7 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseEventStream>().fmt(f) },
13565 8 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseRunner>().fmt(f) },
13566 9 => unsafe { self.raw.get().deref_unchecked::<crate::WireUseConfiguration>().fmt(f) },
13567 _ => unsafe { ::core::hint::unreachable_unchecked() },
13568 }
13569 }
13570}
13571
13572#[repr(transparent)]
13573pub struct WireOptionalUse {
13574 raw: ::fidl_next::RawWireUnion,
13575}
13576
13577unsafe impl ::fidl_next::ZeroPadding for WireOptionalUse {
13578 #[inline]
13579 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
13580 ::fidl_next::munge!(let Self { raw } = out);
13581 ::fidl_next::RawWireUnion::zero_padding(raw);
13582 }
13583}
13584
13585impl WireOptionalUse {
13586 pub fn is_some(&self) -> bool {
13587 self.raw.is_some()
13588 }
13589
13590 pub fn is_none(&self) -> bool {
13591 self.raw.is_none()
13592 }
13593
13594 pub fn as_ref(&self) -> Option<&WireUse> {
13595 if self.is_some() {
13596 Some(unsafe { &*(self as *const Self).cast() })
13597 } else {
13598 None
13599 }
13600 }
13601}
13602
13603unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalUse
13604where
13605 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
13606
13607 ___D: ::fidl_next::Decoder,
13608{
13609 fn decode(
13610 mut slot: ::fidl_next::Slot<'_, Self>,
13611 decoder: &mut ___D,
13612 ) -> Result<(), ::fidl_next::DecodeError> {
13613 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
13614 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
13615 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseService>(raw, decoder)?,
13616
13617 2 => {
13618 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseProtocol>(raw, decoder)?
13619 }
13620
13621 3 => {
13622 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseDirectory>(raw, decoder)?
13623 }
13624
13625 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseStorage>(raw, decoder)?,
13626
13627 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseEventStream>(
13628 raw, decoder,
13629 )?,
13630
13631 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseRunner>(raw, decoder)?,
13632
13633 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireUseConfiguration>(
13634 raw, decoder,
13635 )?,
13636
13637 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
13638 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
13639 }
13640
13641 Ok(())
13642 }
13643}
13644
13645impl ::core::fmt::Debug for WireOptionalUse {
13646 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
13647 self.as_ref().fmt(f)
13648 }
13649}
13650
13651#[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"]
13652#[derive(Clone, Debug, Default)]
13653pub struct ExposeService {
13654 pub source: Option<crate::Ref>,
13655
13656 pub source_name: Option<String>,
13657
13658 pub target: Option<crate::Ref>,
13659
13660 pub target_name: Option<String>,
13661
13662 pub availability: Option<crate::Availability>,
13663
13664 pub source_dictionary: Option<String>,
13665}
13666
13667impl ExposeService {
13668 fn __max_ordinal(&self) -> usize {
13669 if self.source.is_some() {
13670 return 1;
13671 }
13672
13673 if self.source_name.is_some() {
13674 return 2;
13675 }
13676
13677 if self.target.is_some() {
13678 return 3;
13679 }
13680
13681 if self.target_name.is_some() {
13682 return 4;
13683 }
13684
13685 if self.availability.is_some() {
13686 return 5;
13687 }
13688
13689 if self.source_dictionary.is_some() {
13690 return 6;
13691 }
13692
13693 0
13694 }
13695}
13696
13697impl ::fidl_next::Encodable for ExposeService {
13698 type Encoded = WireExposeService;
13699}
13700
13701unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeService
13702where
13703 ___E: ::fidl_next::Encoder + ?Sized,
13704{
13705 #[inline]
13706 fn encode(
13707 mut self,
13708 encoder: &mut ___E,
13709 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
13710 ) -> Result<(), ::fidl_next::EncodeError> {
13711 ::fidl_next::munge!(let WireExposeService { table } = out);
13712
13713 let max_ord = self.__max_ordinal();
13714
13715 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
13716 ::fidl_next::ZeroPadding::zero_padding(&mut out);
13717
13718 let mut preallocated =
13719 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
13720
13721 for i in 1..=max_ord {
13722 match i {
13723 6 => {
13724 if let Some(source_dictionary) = self.source_dictionary.take() {
13725 ::fidl_next::WireEnvelope::encode_value(
13726 source_dictionary,
13727 preallocated.encoder,
13728 &mut out,
13729 )?;
13730 } else {
13731 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13732 }
13733 }
13734
13735 5 => {
13736 if let Some(availability) = self.availability.take() {
13737 ::fidl_next::WireEnvelope::encode_value(
13738 availability,
13739 preallocated.encoder,
13740 &mut out,
13741 )?;
13742 } else {
13743 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13744 }
13745 }
13746
13747 4 => {
13748 if let Some(target_name) = self.target_name.take() {
13749 ::fidl_next::WireEnvelope::encode_value(
13750 target_name,
13751 preallocated.encoder,
13752 &mut out,
13753 )?;
13754 } else {
13755 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13756 }
13757 }
13758
13759 3 => {
13760 if let Some(target) = self.target.take() {
13761 ::fidl_next::WireEnvelope::encode_value(
13762 target,
13763 preallocated.encoder,
13764 &mut out,
13765 )?;
13766 } else {
13767 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13768 }
13769 }
13770
13771 2 => {
13772 if let Some(source_name) = self.source_name.take() {
13773 ::fidl_next::WireEnvelope::encode_value(
13774 source_name,
13775 preallocated.encoder,
13776 &mut out,
13777 )?;
13778 } else {
13779 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13780 }
13781 }
13782
13783 1 => {
13784 if let Some(source) = self.source.take() {
13785 ::fidl_next::WireEnvelope::encode_value(
13786 source,
13787 preallocated.encoder,
13788 &mut out,
13789 )?;
13790 } else {
13791 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13792 }
13793 }
13794
13795 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
13796 }
13797 unsafe {
13798 preallocated.write_next(out.assume_init_ref());
13799 }
13800 }
13801
13802 ::fidl_next::WireTable::encode_len(table, max_ord);
13803
13804 Ok(())
13805 }
13806}
13807
13808unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeService
13809where
13810 ___E: ::fidl_next::Encoder + ?Sized,
13811{
13812 #[inline]
13813 fn encode_ref(
13814 &self,
13815 encoder: &mut ___E,
13816 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
13817 ) -> Result<(), ::fidl_next::EncodeError> {
13818 ::fidl_next::munge!(let WireExposeService { table } = out);
13819
13820 let max_ord = self.__max_ordinal();
13821
13822 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
13823 ::fidl_next::ZeroPadding::zero_padding(&mut out);
13824
13825 let mut preallocated =
13826 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
13827
13828 for i in 1..=max_ord {
13829 match i {
13830 6 => {
13831 if let Some(source_dictionary) = &self.source_dictionary {
13832 ::fidl_next::WireEnvelope::encode_value(
13833 source_dictionary,
13834 preallocated.encoder,
13835 &mut out,
13836 )?;
13837 } else {
13838 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13839 }
13840 }
13841
13842 5 => {
13843 if let Some(availability) = &self.availability {
13844 ::fidl_next::WireEnvelope::encode_value(
13845 availability,
13846 preallocated.encoder,
13847 &mut out,
13848 )?;
13849 } else {
13850 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13851 }
13852 }
13853
13854 4 => {
13855 if let Some(target_name) = &self.target_name {
13856 ::fidl_next::WireEnvelope::encode_value(
13857 target_name,
13858 preallocated.encoder,
13859 &mut out,
13860 )?;
13861 } else {
13862 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13863 }
13864 }
13865
13866 3 => {
13867 if let Some(target) = &self.target {
13868 ::fidl_next::WireEnvelope::encode_value(
13869 target,
13870 preallocated.encoder,
13871 &mut out,
13872 )?;
13873 } else {
13874 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13875 }
13876 }
13877
13878 2 => {
13879 if let Some(source_name) = &self.source_name {
13880 ::fidl_next::WireEnvelope::encode_value(
13881 source_name,
13882 preallocated.encoder,
13883 &mut out,
13884 )?;
13885 } else {
13886 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13887 }
13888 }
13889
13890 1 => {
13891 if let Some(source) = &self.source {
13892 ::fidl_next::WireEnvelope::encode_value(
13893 source,
13894 preallocated.encoder,
13895 &mut out,
13896 )?;
13897 } else {
13898 ::fidl_next::WireEnvelope::encode_zero(&mut out)
13899 }
13900 }
13901
13902 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
13903 }
13904 unsafe {
13905 preallocated.write_next(out.assume_init_ref());
13906 }
13907 }
13908
13909 ::fidl_next::WireTable::encode_len(table, max_ord);
13910
13911 Ok(())
13912 }
13913}
13914
13915impl ::fidl_next::TakeFrom<WireExposeService> for ExposeService {
13916 #[inline]
13917 fn take_from(from: &WireExposeService) -> Self {
13918 Self {
13919 source: from.source().map(::fidl_next::TakeFrom::take_from),
13920
13921 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
13922
13923 target: from.target().map(::fidl_next::TakeFrom::take_from),
13924
13925 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
13926
13927 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
13928
13929 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
13930 }
13931 }
13932}
13933
13934#[repr(C)]
13936pub struct WireExposeService {
13937 table: ::fidl_next::WireTable,
13938}
13939
13940unsafe impl ::fidl_next::ZeroPadding for WireExposeService {
13941 #[inline]
13942 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
13943 ::fidl_next::munge!(let Self { table } = out);
13944 ::fidl_next::WireTable::zero_padding(table);
13945 }
13946}
13947
13948unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeService
13949where
13950 ___D: ::fidl_next::Decoder + ?Sized,
13951{
13952 fn decode(
13953 slot: ::fidl_next::Slot<'_, Self>,
13954 decoder: &mut ___D,
13955 ) -> Result<(), ::fidl_next::DecodeError> {
13956 ::fidl_next::munge!(let Self { table } = slot);
13957
13958 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
13959 match ordinal {
13960 0 => unsafe { ::core::hint::unreachable_unchecked() },
13961
13962 1 => {
13963 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
13964 slot.as_mut(),
13965 decoder,
13966 )?;
13967
13968 Ok(())
13969 }
13970
13971 2 => {
13972 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
13973 slot.as_mut(),
13974 decoder,
13975 )?;
13976
13977 let source_name = unsafe {
13978 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
13979 };
13980
13981 if source_name.len() > 100 {
13982 return Err(::fidl_next::DecodeError::VectorTooLong {
13983 size: source_name.len() as u64,
13984 limit: 100,
13985 });
13986 }
13987
13988 Ok(())
13989 }
13990
13991 3 => {
13992 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
13993 slot.as_mut(),
13994 decoder,
13995 )?;
13996
13997 Ok(())
13998 }
13999
14000 4 => {
14001 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
14002 slot.as_mut(),
14003 decoder,
14004 )?;
14005
14006 let target_name = unsafe {
14007 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
14008 };
14009
14010 if target_name.len() > 100 {
14011 return Err(::fidl_next::DecodeError::VectorTooLong {
14012 size: target_name.len() as u64,
14013 limit: 100,
14014 });
14015 }
14016
14017 Ok(())
14018 }
14019
14020 5 => {
14021 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
14022 slot.as_mut(),
14023 decoder,
14024 )?;
14025
14026 Ok(())
14027 }
14028
14029 6 => {
14030 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
14031 slot.as_mut(),
14032 decoder,
14033 )?;
14034
14035 let source_dictionary = unsafe {
14036 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
14037 };
14038
14039 if source_dictionary.len() > 1024 {
14040 return Err(::fidl_next::DecodeError::VectorTooLong {
14041 size: source_dictionary.len() as u64,
14042 limit: 1024,
14043 });
14044 }
14045
14046 Ok(())
14047 }
14048
14049 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
14050 }
14051 })
14052 }
14053}
14054
14055impl WireExposeService {
14056 pub fn source(&self) -> Option<&crate::WireRef> {
14057 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
14058 }
14059
14060 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
14061 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
14062 }
14063
14064 pub fn target(&self) -> Option<&crate::WireRef> {
14065 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
14066 }
14067
14068 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
14069 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
14070 }
14071
14072 pub fn availability(&self) -> Option<&crate::WireAvailability> {
14073 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
14074 }
14075
14076 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
14077 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
14078 }
14079}
14080
14081impl ::core::fmt::Debug for WireExposeService {
14082 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
14083 f.debug_struct("ExposeService")
14084 .field("source", &self.source())
14085 .field("source_name", &self.source_name())
14086 .field("target", &self.target())
14087 .field("target_name", &self.target_name())
14088 .field("availability", &self.availability())
14089 .field("source_dictionary", &self.source_dictionary())
14090 .finish()
14091 }
14092}
14093
14094#[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"]
14095#[derive(Clone, Debug, Default)]
14096pub struct ExposeProtocol {
14097 pub source: Option<crate::Ref>,
14098
14099 pub source_name: Option<String>,
14100
14101 pub target: Option<crate::Ref>,
14102
14103 pub target_name: Option<String>,
14104
14105 pub availability: Option<crate::Availability>,
14106
14107 pub source_dictionary: Option<String>,
14108}
14109
14110impl ExposeProtocol {
14111 fn __max_ordinal(&self) -> usize {
14112 if self.source.is_some() {
14113 return 1;
14114 }
14115
14116 if self.source_name.is_some() {
14117 return 2;
14118 }
14119
14120 if self.target.is_some() {
14121 return 3;
14122 }
14123
14124 if self.target_name.is_some() {
14125 return 4;
14126 }
14127
14128 if self.availability.is_some() {
14129 return 5;
14130 }
14131
14132 if self.source_dictionary.is_some() {
14133 return 6;
14134 }
14135
14136 0
14137 }
14138}
14139
14140impl ::fidl_next::Encodable for ExposeProtocol {
14141 type Encoded = WireExposeProtocol;
14142}
14143
14144unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeProtocol
14145where
14146 ___E: ::fidl_next::Encoder + ?Sized,
14147{
14148 #[inline]
14149 fn encode(
14150 mut self,
14151 encoder: &mut ___E,
14152 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
14153 ) -> Result<(), ::fidl_next::EncodeError> {
14154 ::fidl_next::munge!(let WireExposeProtocol { table } = out);
14155
14156 let max_ord = self.__max_ordinal();
14157
14158 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
14159 ::fidl_next::ZeroPadding::zero_padding(&mut out);
14160
14161 let mut preallocated =
14162 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
14163
14164 for i in 1..=max_ord {
14165 match i {
14166 6 => {
14167 if let Some(source_dictionary) = self.source_dictionary.take() {
14168 ::fidl_next::WireEnvelope::encode_value(
14169 source_dictionary,
14170 preallocated.encoder,
14171 &mut out,
14172 )?;
14173 } else {
14174 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14175 }
14176 }
14177
14178 5 => {
14179 if let Some(availability) = self.availability.take() {
14180 ::fidl_next::WireEnvelope::encode_value(
14181 availability,
14182 preallocated.encoder,
14183 &mut out,
14184 )?;
14185 } else {
14186 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14187 }
14188 }
14189
14190 4 => {
14191 if let Some(target_name) = self.target_name.take() {
14192 ::fidl_next::WireEnvelope::encode_value(
14193 target_name,
14194 preallocated.encoder,
14195 &mut out,
14196 )?;
14197 } else {
14198 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14199 }
14200 }
14201
14202 3 => {
14203 if let Some(target) = self.target.take() {
14204 ::fidl_next::WireEnvelope::encode_value(
14205 target,
14206 preallocated.encoder,
14207 &mut out,
14208 )?;
14209 } else {
14210 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14211 }
14212 }
14213
14214 2 => {
14215 if let Some(source_name) = self.source_name.take() {
14216 ::fidl_next::WireEnvelope::encode_value(
14217 source_name,
14218 preallocated.encoder,
14219 &mut out,
14220 )?;
14221 } else {
14222 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14223 }
14224 }
14225
14226 1 => {
14227 if let Some(source) = self.source.take() {
14228 ::fidl_next::WireEnvelope::encode_value(
14229 source,
14230 preallocated.encoder,
14231 &mut out,
14232 )?;
14233 } else {
14234 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14235 }
14236 }
14237
14238 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
14239 }
14240 unsafe {
14241 preallocated.write_next(out.assume_init_ref());
14242 }
14243 }
14244
14245 ::fidl_next::WireTable::encode_len(table, max_ord);
14246
14247 Ok(())
14248 }
14249}
14250
14251unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeProtocol
14252where
14253 ___E: ::fidl_next::Encoder + ?Sized,
14254{
14255 #[inline]
14256 fn encode_ref(
14257 &self,
14258 encoder: &mut ___E,
14259 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
14260 ) -> Result<(), ::fidl_next::EncodeError> {
14261 ::fidl_next::munge!(let WireExposeProtocol { table } = out);
14262
14263 let max_ord = self.__max_ordinal();
14264
14265 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
14266 ::fidl_next::ZeroPadding::zero_padding(&mut out);
14267
14268 let mut preallocated =
14269 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
14270
14271 for i in 1..=max_ord {
14272 match i {
14273 6 => {
14274 if let Some(source_dictionary) = &self.source_dictionary {
14275 ::fidl_next::WireEnvelope::encode_value(
14276 source_dictionary,
14277 preallocated.encoder,
14278 &mut out,
14279 )?;
14280 } else {
14281 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14282 }
14283 }
14284
14285 5 => {
14286 if let Some(availability) = &self.availability {
14287 ::fidl_next::WireEnvelope::encode_value(
14288 availability,
14289 preallocated.encoder,
14290 &mut out,
14291 )?;
14292 } else {
14293 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14294 }
14295 }
14296
14297 4 => {
14298 if let Some(target_name) = &self.target_name {
14299 ::fidl_next::WireEnvelope::encode_value(
14300 target_name,
14301 preallocated.encoder,
14302 &mut out,
14303 )?;
14304 } else {
14305 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14306 }
14307 }
14308
14309 3 => {
14310 if let Some(target) = &self.target {
14311 ::fidl_next::WireEnvelope::encode_value(
14312 target,
14313 preallocated.encoder,
14314 &mut out,
14315 )?;
14316 } else {
14317 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14318 }
14319 }
14320
14321 2 => {
14322 if let Some(source_name) = &self.source_name {
14323 ::fidl_next::WireEnvelope::encode_value(
14324 source_name,
14325 preallocated.encoder,
14326 &mut out,
14327 )?;
14328 } else {
14329 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14330 }
14331 }
14332
14333 1 => {
14334 if let Some(source) = &self.source {
14335 ::fidl_next::WireEnvelope::encode_value(
14336 source,
14337 preallocated.encoder,
14338 &mut out,
14339 )?;
14340 } else {
14341 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14342 }
14343 }
14344
14345 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
14346 }
14347 unsafe {
14348 preallocated.write_next(out.assume_init_ref());
14349 }
14350 }
14351
14352 ::fidl_next::WireTable::encode_len(table, max_ord);
14353
14354 Ok(())
14355 }
14356}
14357
14358impl ::fidl_next::TakeFrom<WireExposeProtocol> for ExposeProtocol {
14359 #[inline]
14360 fn take_from(from: &WireExposeProtocol) -> Self {
14361 Self {
14362 source: from.source().map(::fidl_next::TakeFrom::take_from),
14363
14364 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
14365
14366 target: from.target().map(::fidl_next::TakeFrom::take_from),
14367
14368 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
14369
14370 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
14371
14372 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
14373 }
14374 }
14375}
14376
14377#[repr(C)]
14379pub struct WireExposeProtocol {
14380 table: ::fidl_next::WireTable,
14381}
14382
14383unsafe impl ::fidl_next::ZeroPadding for WireExposeProtocol {
14384 #[inline]
14385 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
14386 ::fidl_next::munge!(let Self { table } = out);
14387 ::fidl_next::WireTable::zero_padding(table);
14388 }
14389}
14390
14391unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeProtocol
14392where
14393 ___D: ::fidl_next::Decoder + ?Sized,
14394{
14395 fn decode(
14396 slot: ::fidl_next::Slot<'_, Self>,
14397 decoder: &mut ___D,
14398 ) -> Result<(), ::fidl_next::DecodeError> {
14399 ::fidl_next::munge!(let Self { table } = slot);
14400
14401 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
14402 match ordinal {
14403 0 => unsafe { ::core::hint::unreachable_unchecked() },
14404
14405 1 => {
14406 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
14407 slot.as_mut(),
14408 decoder,
14409 )?;
14410
14411 Ok(())
14412 }
14413
14414 2 => {
14415 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
14416 slot.as_mut(),
14417 decoder,
14418 )?;
14419
14420 let source_name = unsafe {
14421 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
14422 };
14423
14424 if source_name.len() > 100 {
14425 return Err(::fidl_next::DecodeError::VectorTooLong {
14426 size: source_name.len() as u64,
14427 limit: 100,
14428 });
14429 }
14430
14431 Ok(())
14432 }
14433
14434 3 => {
14435 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
14436 slot.as_mut(),
14437 decoder,
14438 )?;
14439
14440 Ok(())
14441 }
14442
14443 4 => {
14444 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
14445 slot.as_mut(),
14446 decoder,
14447 )?;
14448
14449 let target_name = unsafe {
14450 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
14451 };
14452
14453 if target_name.len() > 100 {
14454 return Err(::fidl_next::DecodeError::VectorTooLong {
14455 size: target_name.len() as u64,
14456 limit: 100,
14457 });
14458 }
14459
14460 Ok(())
14461 }
14462
14463 5 => {
14464 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
14465 slot.as_mut(),
14466 decoder,
14467 )?;
14468
14469 Ok(())
14470 }
14471
14472 6 => {
14473 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
14474 slot.as_mut(),
14475 decoder,
14476 )?;
14477
14478 let source_dictionary = unsafe {
14479 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
14480 };
14481
14482 if source_dictionary.len() > 1024 {
14483 return Err(::fidl_next::DecodeError::VectorTooLong {
14484 size: source_dictionary.len() as u64,
14485 limit: 1024,
14486 });
14487 }
14488
14489 Ok(())
14490 }
14491
14492 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
14493 }
14494 })
14495 }
14496}
14497
14498impl WireExposeProtocol {
14499 pub fn source(&self) -> Option<&crate::WireRef> {
14500 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
14501 }
14502
14503 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
14504 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
14505 }
14506
14507 pub fn target(&self) -> Option<&crate::WireRef> {
14508 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
14509 }
14510
14511 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
14512 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
14513 }
14514
14515 pub fn availability(&self) -> Option<&crate::WireAvailability> {
14516 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
14517 }
14518
14519 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
14520 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
14521 }
14522}
14523
14524impl ::core::fmt::Debug for WireExposeProtocol {
14525 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
14526 f.debug_struct("ExposeProtocol")
14527 .field("source", &self.source())
14528 .field("source_name", &self.source_name())
14529 .field("target", &self.target())
14530 .field("target_name", &self.target_name())
14531 .field("availability", &self.availability())
14532 .field("source_dictionary", &self.source_dictionary())
14533 .finish()
14534 }
14535}
14536
14537#[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"]
14538#[derive(Clone, Debug, Default)]
14539pub struct ExposeDirectory {
14540 pub source: Option<crate::Ref>,
14541
14542 pub source_name: Option<String>,
14543
14544 pub target: Option<crate::Ref>,
14545
14546 pub target_name: Option<String>,
14547
14548 pub rights: Option<::fidl_next_fuchsia_io::Operations>,
14549
14550 pub subdir: Option<String>,
14551
14552 pub availability: Option<crate::Availability>,
14553
14554 pub source_dictionary: Option<String>,
14555}
14556
14557impl ExposeDirectory {
14558 fn __max_ordinal(&self) -> usize {
14559 if self.source.is_some() {
14560 return 1;
14561 }
14562
14563 if self.source_name.is_some() {
14564 return 2;
14565 }
14566
14567 if self.target.is_some() {
14568 return 3;
14569 }
14570
14571 if self.target_name.is_some() {
14572 return 4;
14573 }
14574
14575 if self.rights.is_some() {
14576 return 5;
14577 }
14578
14579 if self.subdir.is_some() {
14580 return 6;
14581 }
14582
14583 if self.availability.is_some() {
14584 return 7;
14585 }
14586
14587 if self.source_dictionary.is_some() {
14588 return 8;
14589 }
14590
14591 0
14592 }
14593}
14594
14595impl ::fidl_next::Encodable for ExposeDirectory {
14596 type Encoded = WireExposeDirectory;
14597}
14598
14599unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeDirectory
14600where
14601 ___E: ::fidl_next::Encoder + ?Sized,
14602{
14603 #[inline]
14604 fn encode(
14605 mut self,
14606 encoder: &mut ___E,
14607 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
14608 ) -> Result<(), ::fidl_next::EncodeError> {
14609 ::fidl_next::munge!(let WireExposeDirectory { table } = out);
14610
14611 let max_ord = self.__max_ordinal();
14612
14613 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
14614 ::fidl_next::ZeroPadding::zero_padding(&mut out);
14615
14616 let mut preallocated =
14617 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
14618
14619 for i in 1..=max_ord {
14620 match i {
14621 8 => {
14622 if let Some(source_dictionary) = self.source_dictionary.take() {
14623 ::fidl_next::WireEnvelope::encode_value(
14624 source_dictionary,
14625 preallocated.encoder,
14626 &mut out,
14627 )?;
14628 } else {
14629 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14630 }
14631 }
14632
14633 7 => {
14634 if let Some(availability) = self.availability.take() {
14635 ::fidl_next::WireEnvelope::encode_value(
14636 availability,
14637 preallocated.encoder,
14638 &mut out,
14639 )?;
14640 } else {
14641 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14642 }
14643 }
14644
14645 6 => {
14646 if let Some(subdir) = self.subdir.take() {
14647 ::fidl_next::WireEnvelope::encode_value(
14648 subdir,
14649 preallocated.encoder,
14650 &mut out,
14651 )?;
14652 } else {
14653 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14654 }
14655 }
14656
14657 5 => {
14658 if let Some(rights) = self.rights.take() {
14659 ::fidl_next::WireEnvelope::encode_value(
14660 rights,
14661 preallocated.encoder,
14662 &mut out,
14663 )?;
14664 } else {
14665 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14666 }
14667 }
14668
14669 4 => {
14670 if let Some(target_name) = self.target_name.take() {
14671 ::fidl_next::WireEnvelope::encode_value(
14672 target_name,
14673 preallocated.encoder,
14674 &mut out,
14675 )?;
14676 } else {
14677 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14678 }
14679 }
14680
14681 3 => {
14682 if let Some(target) = self.target.take() {
14683 ::fidl_next::WireEnvelope::encode_value(
14684 target,
14685 preallocated.encoder,
14686 &mut out,
14687 )?;
14688 } else {
14689 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14690 }
14691 }
14692
14693 2 => {
14694 if let Some(source_name) = self.source_name.take() {
14695 ::fidl_next::WireEnvelope::encode_value(
14696 source_name,
14697 preallocated.encoder,
14698 &mut out,
14699 )?;
14700 } else {
14701 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14702 }
14703 }
14704
14705 1 => {
14706 if let Some(source) = self.source.take() {
14707 ::fidl_next::WireEnvelope::encode_value(
14708 source,
14709 preallocated.encoder,
14710 &mut out,
14711 )?;
14712 } else {
14713 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14714 }
14715 }
14716
14717 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
14718 }
14719 unsafe {
14720 preallocated.write_next(out.assume_init_ref());
14721 }
14722 }
14723
14724 ::fidl_next::WireTable::encode_len(table, max_ord);
14725
14726 Ok(())
14727 }
14728}
14729
14730unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeDirectory
14731where
14732 ___E: ::fidl_next::Encoder + ?Sized,
14733{
14734 #[inline]
14735 fn encode_ref(
14736 &self,
14737 encoder: &mut ___E,
14738 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
14739 ) -> Result<(), ::fidl_next::EncodeError> {
14740 ::fidl_next::munge!(let WireExposeDirectory { table } = out);
14741
14742 let max_ord = self.__max_ordinal();
14743
14744 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
14745 ::fidl_next::ZeroPadding::zero_padding(&mut out);
14746
14747 let mut preallocated =
14748 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
14749
14750 for i in 1..=max_ord {
14751 match i {
14752 8 => {
14753 if let Some(source_dictionary) = &self.source_dictionary {
14754 ::fidl_next::WireEnvelope::encode_value(
14755 source_dictionary,
14756 preallocated.encoder,
14757 &mut out,
14758 )?;
14759 } else {
14760 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14761 }
14762 }
14763
14764 7 => {
14765 if let Some(availability) = &self.availability {
14766 ::fidl_next::WireEnvelope::encode_value(
14767 availability,
14768 preallocated.encoder,
14769 &mut out,
14770 )?;
14771 } else {
14772 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14773 }
14774 }
14775
14776 6 => {
14777 if let Some(subdir) = &self.subdir {
14778 ::fidl_next::WireEnvelope::encode_value(
14779 subdir,
14780 preallocated.encoder,
14781 &mut out,
14782 )?;
14783 } else {
14784 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14785 }
14786 }
14787
14788 5 => {
14789 if let Some(rights) = &self.rights {
14790 ::fidl_next::WireEnvelope::encode_value(
14791 rights,
14792 preallocated.encoder,
14793 &mut out,
14794 )?;
14795 } else {
14796 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14797 }
14798 }
14799
14800 4 => {
14801 if let Some(target_name) = &self.target_name {
14802 ::fidl_next::WireEnvelope::encode_value(
14803 target_name,
14804 preallocated.encoder,
14805 &mut out,
14806 )?;
14807 } else {
14808 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14809 }
14810 }
14811
14812 3 => {
14813 if let Some(target) = &self.target {
14814 ::fidl_next::WireEnvelope::encode_value(
14815 target,
14816 preallocated.encoder,
14817 &mut out,
14818 )?;
14819 } else {
14820 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14821 }
14822 }
14823
14824 2 => {
14825 if let Some(source_name) = &self.source_name {
14826 ::fidl_next::WireEnvelope::encode_value(
14827 source_name,
14828 preallocated.encoder,
14829 &mut out,
14830 )?;
14831 } else {
14832 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14833 }
14834 }
14835
14836 1 => {
14837 if let Some(source) = &self.source {
14838 ::fidl_next::WireEnvelope::encode_value(
14839 source,
14840 preallocated.encoder,
14841 &mut out,
14842 )?;
14843 } else {
14844 ::fidl_next::WireEnvelope::encode_zero(&mut out)
14845 }
14846 }
14847
14848 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
14849 }
14850 unsafe {
14851 preallocated.write_next(out.assume_init_ref());
14852 }
14853 }
14854
14855 ::fidl_next::WireTable::encode_len(table, max_ord);
14856
14857 Ok(())
14858 }
14859}
14860
14861impl ::fidl_next::TakeFrom<WireExposeDirectory> for ExposeDirectory {
14862 #[inline]
14863 fn take_from(from: &WireExposeDirectory) -> Self {
14864 Self {
14865 source: from.source().map(::fidl_next::TakeFrom::take_from),
14866
14867 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
14868
14869 target: from.target().map(::fidl_next::TakeFrom::take_from),
14870
14871 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
14872
14873 rights: from.rights().map(::fidl_next::TakeFrom::take_from),
14874
14875 subdir: from.subdir().map(::fidl_next::TakeFrom::take_from),
14876
14877 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
14878
14879 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
14880 }
14881 }
14882}
14883
14884#[repr(C)]
14886pub struct WireExposeDirectory {
14887 table: ::fidl_next::WireTable,
14888}
14889
14890unsafe impl ::fidl_next::ZeroPadding for WireExposeDirectory {
14891 #[inline]
14892 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
14893 ::fidl_next::munge!(let Self { table } = out);
14894 ::fidl_next::WireTable::zero_padding(table);
14895 }
14896}
14897
14898unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeDirectory
14899where
14900 ___D: ::fidl_next::Decoder + ?Sized,
14901{
14902 fn decode(
14903 slot: ::fidl_next::Slot<'_, Self>,
14904 decoder: &mut ___D,
14905 ) -> Result<(), ::fidl_next::DecodeError> {
14906 ::fidl_next::munge!(let Self { table } = slot);
14907
14908 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
14909 match ordinal {
14910 0 => unsafe { ::core::hint::unreachable_unchecked() },
14911
14912 1 => {
14913 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
14914 slot.as_mut(),
14915 decoder,
14916 )?;
14917
14918 Ok(())
14919 }
14920
14921 2 => {
14922 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
14923 slot.as_mut(),
14924 decoder,
14925 )?;
14926
14927 let source_name = unsafe {
14928 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
14929 };
14930
14931 if source_name.len() > 100 {
14932 return Err(::fidl_next::DecodeError::VectorTooLong {
14933 size: source_name.len() as u64,
14934 limit: 100,
14935 });
14936 }
14937
14938 Ok(())
14939 }
14940
14941 3 => {
14942 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
14943 slot.as_mut(),
14944 decoder,
14945 )?;
14946
14947 Ok(())
14948 }
14949
14950 4 => {
14951 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
14952 slot.as_mut(),
14953 decoder,
14954 )?;
14955
14956 let target_name = unsafe {
14957 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
14958 };
14959
14960 if target_name.len() > 100 {
14961 return Err(::fidl_next::DecodeError::VectorTooLong {
14962 size: target_name.len() as u64,
14963 limit: 100,
14964 });
14965 }
14966
14967 Ok(())
14968 }
14969
14970 5 => {
14971 ::fidl_next::WireEnvelope::decode_as::<
14972 ___D,
14973 ::fidl_next_fuchsia_io::WireOperations,
14974 >(slot.as_mut(), decoder)?;
14975
14976 Ok(())
14977 }
14978
14979 6 => {
14980 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
14981 slot.as_mut(),
14982 decoder,
14983 )?;
14984
14985 let subdir = unsafe {
14986 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
14987 };
14988
14989 if subdir.len() > 1024 {
14990 return Err(::fidl_next::DecodeError::VectorTooLong {
14991 size: subdir.len() as u64,
14992 limit: 1024,
14993 });
14994 }
14995
14996 Ok(())
14997 }
14998
14999 7 => {
15000 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
15001 slot.as_mut(),
15002 decoder,
15003 )?;
15004
15005 Ok(())
15006 }
15007
15008 8 => {
15009 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
15010 slot.as_mut(),
15011 decoder,
15012 )?;
15013
15014 let source_dictionary = unsafe {
15015 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
15016 };
15017
15018 if source_dictionary.len() > 1024 {
15019 return Err(::fidl_next::DecodeError::VectorTooLong {
15020 size: source_dictionary.len() as u64,
15021 limit: 1024,
15022 });
15023 }
15024
15025 Ok(())
15026 }
15027
15028 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
15029 }
15030 })
15031 }
15032}
15033
15034impl WireExposeDirectory {
15035 pub fn source(&self) -> Option<&crate::WireRef> {
15036 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
15037 }
15038
15039 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
15040 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
15041 }
15042
15043 pub fn target(&self) -> Option<&crate::WireRef> {
15044 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
15045 }
15046
15047 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
15048 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
15049 }
15050
15051 pub fn rights(&self) -> Option<&::fidl_next_fuchsia_io::WireOperations> {
15052 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
15053 }
15054
15055 pub fn subdir(&self) -> Option<&::fidl_next::WireString> {
15056 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
15057 }
15058
15059 pub fn availability(&self) -> Option<&crate::WireAvailability> {
15060 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
15061 }
15062
15063 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
15064 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
15065 }
15066}
15067
15068impl ::core::fmt::Debug for WireExposeDirectory {
15069 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
15070 f.debug_struct("ExposeDirectory")
15071 .field("source", &self.source())
15072 .field("source_name", &self.source_name())
15073 .field("target", &self.target())
15074 .field("target_name", &self.target_name())
15075 .field("rights", &self.rights())
15076 .field("subdir", &self.subdir())
15077 .field("availability", &self.availability())
15078 .field("source_dictionary", &self.source_dictionary())
15079 .finish()
15080 }
15081}
15082
15083#[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"]
15084#[derive(Clone, Debug, Default)]
15085pub struct ExposeRunner {
15086 pub source: Option<crate::Ref>,
15087
15088 pub source_name: Option<String>,
15089
15090 pub target: Option<crate::Ref>,
15091
15092 pub target_name: Option<String>,
15093
15094 pub source_dictionary: Option<String>,
15095}
15096
15097impl ExposeRunner {
15098 fn __max_ordinal(&self) -> usize {
15099 if self.source.is_some() {
15100 return 1;
15101 }
15102
15103 if self.source_name.is_some() {
15104 return 2;
15105 }
15106
15107 if self.target.is_some() {
15108 return 3;
15109 }
15110
15111 if self.target_name.is_some() {
15112 return 4;
15113 }
15114
15115 if self.source_dictionary.is_some() {
15116 return 6;
15117 }
15118
15119 0
15120 }
15121}
15122
15123impl ::fidl_next::Encodable for ExposeRunner {
15124 type Encoded = WireExposeRunner;
15125}
15126
15127unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeRunner
15128where
15129 ___E: ::fidl_next::Encoder + ?Sized,
15130{
15131 #[inline]
15132 fn encode(
15133 mut self,
15134 encoder: &mut ___E,
15135 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15136 ) -> Result<(), ::fidl_next::EncodeError> {
15137 ::fidl_next::munge!(let WireExposeRunner { table } = out);
15138
15139 let max_ord = self.__max_ordinal();
15140
15141 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
15142 ::fidl_next::ZeroPadding::zero_padding(&mut out);
15143
15144 let mut preallocated =
15145 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
15146
15147 for i in 1..=max_ord {
15148 match i {
15149 6 => {
15150 if let Some(source_dictionary) = self.source_dictionary.take() {
15151 ::fidl_next::WireEnvelope::encode_value(
15152 source_dictionary,
15153 preallocated.encoder,
15154 &mut out,
15155 )?;
15156 } else {
15157 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15158 }
15159 }
15160
15161 4 => {
15162 if let Some(target_name) = self.target_name.take() {
15163 ::fidl_next::WireEnvelope::encode_value(
15164 target_name,
15165 preallocated.encoder,
15166 &mut out,
15167 )?;
15168 } else {
15169 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15170 }
15171 }
15172
15173 3 => {
15174 if let Some(target) = self.target.take() {
15175 ::fidl_next::WireEnvelope::encode_value(
15176 target,
15177 preallocated.encoder,
15178 &mut out,
15179 )?;
15180 } else {
15181 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15182 }
15183 }
15184
15185 2 => {
15186 if let Some(source_name) = self.source_name.take() {
15187 ::fidl_next::WireEnvelope::encode_value(
15188 source_name,
15189 preallocated.encoder,
15190 &mut out,
15191 )?;
15192 } else {
15193 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15194 }
15195 }
15196
15197 1 => {
15198 if let Some(source) = self.source.take() {
15199 ::fidl_next::WireEnvelope::encode_value(
15200 source,
15201 preallocated.encoder,
15202 &mut out,
15203 )?;
15204 } else {
15205 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15206 }
15207 }
15208
15209 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
15210 }
15211 unsafe {
15212 preallocated.write_next(out.assume_init_ref());
15213 }
15214 }
15215
15216 ::fidl_next::WireTable::encode_len(table, max_ord);
15217
15218 Ok(())
15219 }
15220}
15221
15222unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeRunner
15223where
15224 ___E: ::fidl_next::Encoder + ?Sized,
15225{
15226 #[inline]
15227 fn encode_ref(
15228 &self,
15229 encoder: &mut ___E,
15230 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15231 ) -> Result<(), ::fidl_next::EncodeError> {
15232 ::fidl_next::munge!(let WireExposeRunner { table } = out);
15233
15234 let max_ord = self.__max_ordinal();
15235
15236 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
15237 ::fidl_next::ZeroPadding::zero_padding(&mut out);
15238
15239 let mut preallocated =
15240 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
15241
15242 for i in 1..=max_ord {
15243 match i {
15244 6 => {
15245 if let Some(source_dictionary) = &self.source_dictionary {
15246 ::fidl_next::WireEnvelope::encode_value(
15247 source_dictionary,
15248 preallocated.encoder,
15249 &mut out,
15250 )?;
15251 } else {
15252 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15253 }
15254 }
15255
15256 4 => {
15257 if let Some(target_name) = &self.target_name {
15258 ::fidl_next::WireEnvelope::encode_value(
15259 target_name,
15260 preallocated.encoder,
15261 &mut out,
15262 )?;
15263 } else {
15264 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15265 }
15266 }
15267
15268 3 => {
15269 if let Some(target) = &self.target {
15270 ::fidl_next::WireEnvelope::encode_value(
15271 target,
15272 preallocated.encoder,
15273 &mut out,
15274 )?;
15275 } else {
15276 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15277 }
15278 }
15279
15280 2 => {
15281 if let Some(source_name) = &self.source_name {
15282 ::fidl_next::WireEnvelope::encode_value(
15283 source_name,
15284 preallocated.encoder,
15285 &mut out,
15286 )?;
15287 } else {
15288 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15289 }
15290 }
15291
15292 1 => {
15293 if let Some(source) = &self.source {
15294 ::fidl_next::WireEnvelope::encode_value(
15295 source,
15296 preallocated.encoder,
15297 &mut out,
15298 )?;
15299 } else {
15300 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15301 }
15302 }
15303
15304 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
15305 }
15306 unsafe {
15307 preallocated.write_next(out.assume_init_ref());
15308 }
15309 }
15310
15311 ::fidl_next::WireTable::encode_len(table, max_ord);
15312
15313 Ok(())
15314 }
15315}
15316
15317impl ::fidl_next::TakeFrom<WireExposeRunner> for ExposeRunner {
15318 #[inline]
15319 fn take_from(from: &WireExposeRunner) -> Self {
15320 Self {
15321 source: from.source().map(::fidl_next::TakeFrom::take_from),
15322
15323 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
15324
15325 target: from.target().map(::fidl_next::TakeFrom::take_from),
15326
15327 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
15328
15329 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
15330 }
15331 }
15332}
15333
15334#[repr(C)]
15336pub struct WireExposeRunner {
15337 table: ::fidl_next::WireTable,
15338}
15339
15340unsafe impl ::fidl_next::ZeroPadding for WireExposeRunner {
15341 #[inline]
15342 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
15343 ::fidl_next::munge!(let Self { table } = out);
15344 ::fidl_next::WireTable::zero_padding(table);
15345 }
15346}
15347
15348unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeRunner
15349where
15350 ___D: ::fidl_next::Decoder + ?Sized,
15351{
15352 fn decode(
15353 slot: ::fidl_next::Slot<'_, Self>,
15354 decoder: &mut ___D,
15355 ) -> Result<(), ::fidl_next::DecodeError> {
15356 ::fidl_next::munge!(let Self { table } = slot);
15357
15358 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
15359 match ordinal {
15360 0 => unsafe { ::core::hint::unreachable_unchecked() },
15361
15362 1 => {
15363 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
15364 slot.as_mut(),
15365 decoder,
15366 )?;
15367
15368 Ok(())
15369 }
15370
15371 2 => {
15372 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
15373 slot.as_mut(),
15374 decoder,
15375 )?;
15376
15377 let source_name = unsafe {
15378 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
15379 };
15380
15381 if source_name.len() > 100 {
15382 return Err(::fidl_next::DecodeError::VectorTooLong {
15383 size: source_name.len() as u64,
15384 limit: 100,
15385 });
15386 }
15387
15388 Ok(())
15389 }
15390
15391 3 => {
15392 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
15393 slot.as_mut(),
15394 decoder,
15395 )?;
15396
15397 Ok(())
15398 }
15399
15400 4 => {
15401 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
15402 slot.as_mut(),
15403 decoder,
15404 )?;
15405
15406 let target_name = unsafe {
15407 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
15408 };
15409
15410 if target_name.len() > 100 {
15411 return Err(::fidl_next::DecodeError::VectorTooLong {
15412 size: target_name.len() as u64,
15413 limit: 100,
15414 });
15415 }
15416
15417 Ok(())
15418 }
15419
15420 6 => {
15421 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
15422 slot.as_mut(),
15423 decoder,
15424 )?;
15425
15426 let source_dictionary = unsafe {
15427 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
15428 };
15429
15430 if source_dictionary.len() > 1024 {
15431 return Err(::fidl_next::DecodeError::VectorTooLong {
15432 size: source_dictionary.len() as u64,
15433 limit: 1024,
15434 });
15435 }
15436
15437 Ok(())
15438 }
15439
15440 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
15441 }
15442 })
15443 }
15444}
15445
15446impl WireExposeRunner {
15447 pub fn source(&self) -> Option<&crate::WireRef> {
15448 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
15449 }
15450
15451 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
15452 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
15453 }
15454
15455 pub fn target(&self) -> Option<&crate::WireRef> {
15456 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
15457 }
15458
15459 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
15460 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
15461 }
15462
15463 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
15464 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
15465 }
15466}
15467
15468impl ::core::fmt::Debug for WireExposeRunner {
15469 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
15470 f.debug_struct("ExposeRunner")
15471 .field("source", &self.source())
15472 .field("source_name", &self.source_name())
15473 .field("target", &self.target())
15474 .field("target_name", &self.target_name())
15475 .field("source_dictionary", &self.source_dictionary())
15476 .finish()
15477 }
15478}
15479
15480#[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"]
15481#[derive(Clone, Debug, Default)]
15482pub struct ExposeResolver {
15483 pub source: Option<crate::Ref>,
15484
15485 pub source_name: Option<String>,
15486
15487 pub target: Option<crate::Ref>,
15488
15489 pub target_name: Option<String>,
15490
15491 pub source_dictionary: Option<String>,
15492}
15493
15494impl ExposeResolver {
15495 fn __max_ordinal(&self) -> usize {
15496 if self.source.is_some() {
15497 return 1;
15498 }
15499
15500 if self.source_name.is_some() {
15501 return 2;
15502 }
15503
15504 if self.target.is_some() {
15505 return 3;
15506 }
15507
15508 if self.target_name.is_some() {
15509 return 4;
15510 }
15511
15512 if self.source_dictionary.is_some() {
15513 return 6;
15514 }
15515
15516 0
15517 }
15518}
15519
15520impl ::fidl_next::Encodable for ExposeResolver {
15521 type Encoded = WireExposeResolver;
15522}
15523
15524unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeResolver
15525where
15526 ___E: ::fidl_next::Encoder + ?Sized,
15527{
15528 #[inline]
15529 fn encode(
15530 mut self,
15531 encoder: &mut ___E,
15532 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15533 ) -> Result<(), ::fidl_next::EncodeError> {
15534 ::fidl_next::munge!(let WireExposeResolver { table } = out);
15535
15536 let max_ord = self.__max_ordinal();
15537
15538 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
15539 ::fidl_next::ZeroPadding::zero_padding(&mut out);
15540
15541 let mut preallocated =
15542 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
15543
15544 for i in 1..=max_ord {
15545 match i {
15546 6 => {
15547 if let Some(source_dictionary) = self.source_dictionary.take() {
15548 ::fidl_next::WireEnvelope::encode_value(
15549 source_dictionary,
15550 preallocated.encoder,
15551 &mut out,
15552 )?;
15553 } else {
15554 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15555 }
15556 }
15557
15558 4 => {
15559 if let Some(target_name) = self.target_name.take() {
15560 ::fidl_next::WireEnvelope::encode_value(
15561 target_name,
15562 preallocated.encoder,
15563 &mut out,
15564 )?;
15565 } else {
15566 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15567 }
15568 }
15569
15570 3 => {
15571 if let Some(target) = self.target.take() {
15572 ::fidl_next::WireEnvelope::encode_value(
15573 target,
15574 preallocated.encoder,
15575 &mut out,
15576 )?;
15577 } else {
15578 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15579 }
15580 }
15581
15582 2 => {
15583 if let Some(source_name) = self.source_name.take() {
15584 ::fidl_next::WireEnvelope::encode_value(
15585 source_name,
15586 preallocated.encoder,
15587 &mut out,
15588 )?;
15589 } else {
15590 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15591 }
15592 }
15593
15594 1 => {
15595 if let Some(source) = self.source.take() {
15596 ::fidl_next::WireEnvelope::encode_value(
15597 source,
15598 preallocated.encoder,
15599 &mut out,
15600 )?;
15601 } else {
15602 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15603 }
15604 }
15605
15606 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
15607 }
15608 unsafe {
15609 preallocated.write_next(out.assume_init_ref());
15610 }
15611 }
15612
15613 ::fidl_next::WireTable::encode_len(table, max_ord);
15614
15615 Ok(())
15616 }
15617}
15618
15619unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeResolver
15620where
15621 ___E: ::fidl_next::Encoder + ?Sized,
15622{
15623 #[inline]
15624 fn encode_ref(
15625 &self,
15626 encoder: &mut ___E,
15627 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15628 ) -> Result<(), ::fidl_next::EncodeError> {
15629 ::fidl_next::munge!(let WireExposeResolver { table } = out);
15630
15631 let max_ord = self.__max_ordinal();
15632
15633 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
15634 ::fidl_next::ZeroPadding::zero_padding(&mut out);
15635
15636 let mut preallocated =
15637 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
15638
15639 for i in 1..=max_ord {
15640 match i {
15641 6 => {
15642 if let Some(source_dictionary) = &self.source_dictionary {
15643 ::fidl_next::WireEnvelope::encode_value(
15644 source_dictionary,
15645 preallocated.encoder,
15646 &mut out,
15647 )?;
15648 } else {
15649 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15650 }
15651 }
15652
15653 4 => {
15654 if let Some(target_name) = &self.target_name {
15655 ::fidl_next::WireEnvelope::encode_value(
15656 target_name,
15657 preallocated.encoder,
15658 &mut out,
15659 )?;
15660 } else {
15661 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15662 }
15663 }
15664
15665 3 => {
15666 if let Some(target) = &self.target {
15667 ::fidl_next::WireEnvelope::encode_value(
15668 target,
15669 preallocated.encoder,
15670 &mut out,
15671 )?;
15672 } else {
15673 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15674 }
15675 }
15676
15677 2 => {
15678 if let Some(source_name) = &self.source_name {
15679 ::fidl_next::WireEnvelope::encode_value(
15680 source_name,
15681 preallocated.encoder,
15682 &mut out,
15683 )?;
15684 } else {
15685 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15686 }
15687 }
15688
15689 1 => {
15690 if let Some(source) = &self.source {
15691 ::fidl_next::WireEnvelope::encode_value(
15692 source,
15693 preallocated.encoder,
15694 &mut out,
15695 )?;
15696 } else {
15697 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15698 }
15699 }
15700
15701 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
15702 }
15703 unsafe {
15704 preallocated.write_next(out.assume_init_ref());
15705 }
15706 }
15707
15708 ::fidl_next::WireTable::encode_len(table, max_ord);
15709
15710 Ok(())
15711 }
15712}
15713
15714impl ::fidl_next::TakeFrom<WireExposeResolver> for ExposeResolver {
15715 #[inline]
15716 fn take_from(from: &WireExposeResolver) -> Self {
15717 Self {
15718 source: from.source().map(::fidl_next::TakeFrom::take_from),
15719
15720 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
15721
15722 target: from.target().map(::fidl_next::TakeFrom::take_from),
15723
15724 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
15725
15726 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
15727 }
15728 }
15729}
15730
15731#[repr(C)]
15733pub struct WireExposeResolver {
15734 table: ::fidl_next::WireTable,
15735}
15736
15737unsafe impl ::fidl_next::ZeroPadding for WireExposeResolver {
15738 #[inline]
15739 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
15740 ::fidl_next::munge!(let Self { table } = out);
15741 ::fidl_next::WireTable::zero_padding(table);
15742 }
15743}
15744
15745unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeResolver
15746where
15747 ___D: ::fidl_next::Decoder + ?Sized,
15748{
15749 fn decode(
15750 slot: ::fidl_next::Slot<'_, Self>,
15751 decoder: &mut ___D,
15752 ) -> Result<(), ::fidl_next::DecodeError> {
15753 ::fidl_next::munge!(let Self { table } = slot);
15754
15755 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
15756 match ordinal {
15757 0 => unsafe { ::core::hint::unreachable_unchecked() },
15758
15759 1 => {
15760 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
15761 slot.as_mut(),
15762 decoder,
15763 )?;
15764
15765 Ok(())
15766 }
15767
15768 2 => {
15769 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
15770 slot.as_mut(),
15771 decoder,
15772 )?;
15773
15774 let source_name = unsafe {
15775 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
15776 };
15777
15778 if source_name.len() > 100 {
15779 return Err(::fidl_next::DecodeError::VectorTooLong {
15780 size: source_name.len() as u64,
15781 limit: 100,
15782 });
15783 }
15784
15785 Ok(())
15786 }
15787
15788 3 => {
15789 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
15790 slot.as_mut(),
15791 decoder,
15792 )?;
15793
15794 Ok(())
15795 }
15796
15797 4 => {
15798 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
15799 slot.as_mut(),
15800 decoder,
15801 )?;
15802
15803 let target_name = unsafe {
15804 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
15805 };
15806
15807 if target_name.len() > 100 {
15808 return Err(::fidl_next::DecodeError::VectorTooLong {
15809 size: target_name.len() as u64,
15810 limit: 100,
15811 });
15812 }
15813
15814 Ok(())
15815 }
15816
15817 6 => {
15818 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
15819 slot.as_mut(),
15820 decoder,
15821 )?;
15822
15823 let source_dictionary = unsafe {
15824 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
15825 };
15826
15827 if source_dictionary.len() > 1024 {
15828 return Err(::fidl_next::DecodeError::VectorTooLong {
15829 size: source_dictionary.len() as u64,
15830 limit: 1024,
15831 });
15832 }
15833
15834 Ok(())
15835 }
15836
15837 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
15838 }
15839 })
15840 }
15841}
15842
15843impl WireExposeResolver {
15844 pub fn source(&self) -> Option<&crate::WireRef> {
15845 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
15846 }
15847
15848 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
15849 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
15850 }
15851
15852 pub fn target(&self) -> Option<&crate::WireRef> {
15853 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
15854 }
15855
15856 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
15857 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
15858 }
15859
15860 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
15861 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
15862 }
15863}
15864
15865impl ::core::fmt::Debug for WireExposeResolver {
15866 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
15867 f.debug_struct("ExposeResolver")
15868 .field("source", &self.source())
15869 .field("source_name", &self.source_name())
15870 .field("target", &self.target())
15871 .field("target_name", &self.target_name())
15872 .field("source_dictionary", &self.source_dictionary())
15873 .finish()
15874 }
15875}
15876
15877#[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"]
15878#[derive(Clone, Debug, Default)]
15879pub struct ExposeDictionary {
15880 pub source: Option<crate::Ref>,
15881
15882 pub source_name: Option<String>,
15883
15884 pub target: Option<crate::Ref>,
15885
15886 pub target_name: Option<String>,
15887
15888 pub availability: Option<crate::Availability>,
15889
15890 pub source_dictionary: Option<String>,
15891}
15892
15893impl ExposeDictionary {
15894 fn __max_ordinal(&self) -> usize {
15895 if self.source.is_some() {
15896 return 1;
15897 }
15898
15899 if self.source_name.is_some() {
15900 return 2;
15901 }
15902
15903 if self.target.is_some() {
15904 return 3;
15905 }
15906
15907 if self.target_name.is_some() {
15908 return 4;
15909 }
15910
15911 if self.availability.is_some() {
15912 return 5;
15913 }
15914
15915 if self.source_dictionary.is_some() {
15916 return 6;
15917 }
15918
15919 0
15920 }
15921}
15922
15923impl ::fidl_next::Encodable for ExposeDictionary {
15924 type Encoded = WireExposeDictionary;
15925}
15926
15927unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeDictionary
15928where
15929 ___E: ::fidl_next::Encoder + ?Sized,
15930{
15931 #[inline]
15932 fn encode(
15933 mut self,
15934 encoder: &mut ___E,
15935 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
15936 ) -> Result<(), ::fidl_next::EncodeError> {
15937 ::fidl_next::munge!(let WireExposeDictionary { table } = out);
15938
15939 let max_ord = self.__max_ordinal();
15940
15941 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
15942 ::fidl_next::ZeroPadding::zero_padding(&mut out);
15943
15944 let mut preallocated =
15945 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
15946
15947 for i in 1..=max_ord {
15948 match i {
15949 6 => {
15950 if let Some(source_dictionary) = self.source_dictionary.take() {
15951 ::fidl_next::WireEnvelope::encode_value(
15952 source_dictionary,
15953 preallocated.encoder,
15954 &mut out,
15955 )?;
15956 } else {
15957 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15958 }
15959 }
15960
15961 5 => {
15962 if let Some(availability) = self.availability.take() {
15963 ::fidl_next::WireEnvelope::encode_value(
15964 availability,
15965 preallocated.encoder,
15966 &mut out,
15967 )?;
15968 } else {
15969 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15970 }
15971 }
15972
15973 4 => {
15974 if let Some(target_name) = self.target_name.take() {
15975 ::fidl_next::WireEnvelope::encode_value(
15976 target_name,
15977 preallocated.encoder,
15978 &mut out,
15979 )?;
15980 } else {
15981 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15982 }
15983 }
15984
15985 3 => {
15986 if let Some(target) = self.target.take() {
15987 ::fidl_next::WireEnvelope::encode_value(
15988 target,
15989 preallocated.encoder,
15990 &mut out,
15991 )?;
15992 } else {
15993 ::fidl_next::WireEnvelope::encode_zero(&mut out)
15994 }
15995 }
15996
15997 2 => {
15998 if let Some(source_name) = self.source_name.take() {
15999 ::fidl_next::WireEnvelope::encode_value(
16000 source_name,
16001 preallocated.encoder,
16002 &mut out,
16003 )?;
16004 } else {
16005 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16006 }
16007 }
16008
16009 1 => {
16010 if let Some(source) = self.source.take() {
16011 ::fidl_next::WireEnvelope::encode_value(
16012 source,
16013 preallocated.encoder,
16014 &mut out,
16015 )?;
16016 } else {
16017 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16018 }
16019 }
16020
16021 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
16022 }
16023 unsafe {
16024 preallocated.write_next(out.assume_init_ref());
16025 }
16026 }
16027
16028 ::fidl_next::WireTable::encode_len(table, max_ord);
16029
16030 Ok(())
16031 }
16032}
16033
16034unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeDictionary
16035where
16036 ___E: ::fidl_next::Encoder + ?Sized,
16037{
16038 #[inline]
16039 fn encode_ref(
16040 &self,
16041 encoder: &mut ___E,
16042 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
16043 ) -> Result<(), ::fidl_next::EncodeError> {
16044 ::fidl_next::munge!(let WireExposeDictionary { table } = out);
16045
16046 let max_ord = self.__max_ordinal();
16047
16048 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
16049 ::fidl_next::ZeroPadding::zero_padding(&mut out);
16050
16051 let mut preallocated =
16052 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
16053
16054 for i in 1..=max_ord {
16055 match i {
16056 6 => {
16057 if let Some(source_dictionary) = &self.source_dictionary {
16058 ::fidl_next::WireEnvelope::encode_value(
16059 source_dictionary,
16060 preallocated.encoder,
16061 &mut out,
16062 )?;
16063 } else {
16064 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16065 }
16066 }
16067
16068 5 => {
16069 if let Some(availability) = &self.availability {
16070 ::fidl_next::WireEnvelope::encode_value(
16071 availability,
16072 preallocated.encoder,
16073 &mut out,
16074 )?;
16075 } else {
16076 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16077 }
16078 }
16079
16080 4 => {
16081 if let Some(target_name) = &self.target_name {
16082 ::fidl_next::WireEnvelope::encode_value(
16083 target_name,
16084 preallocated.encoder,
16085 &mut out,
16086 )?;
16087 } else {
16088 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16089 }
16090 }
16091
16092 3 => {
16093 if let Some(target) = &self.target {
16094 ::fidl_next::WireEnvelope::encode_value(
16095 target,
16096 preallocated.encoder,
16097 &mut out,
16098 )?;
16099 } else {
16100 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16101 }
16102 }
16103
16104 2 => {
16105 if let Some(source_name) = &self.source_name {
16106 ::fidl_next::WireEnvelope::encode_value(
16107 source_name,
16108 preallocated.encoder,
16109 &mut out,
16110 )?;
16111 } else {
16112 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16113 }
16114 }
16115
16116 1 => {
16117 if let Some(source) = &self.source {
16118 ::fidl_next::WireEnvelope::encode_value(
16119 source,
16120 preallocated.encoder,
16121 &mut out,
16122 )?;
16123 } else {
16124 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16125 }
16126 }
16127
16128 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
16129 }
16130 unsafe {
16131 preallocated.write_next(out.assume_init_ref());
16132 }
16133 }
16134
16135 ::fidl_next::WireTable::encode_len(table, max_ord);
16136
16137 Ok(())
16138 }
16139}
16140
16141impl ::fidl_next::TakeFrom<WireExposeDictionary> for ExposeDictionary {
16142 #[inline]
16143 fn take_from(from: &WireExposeDictionary) -> Self {
16144 Self {
16145 source: from.source().map(::fidl_next::TakeFrom::take_from),
16146
16147 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
16148
16149 target: from.target().map(::fidl_next::TakeFrom::take_from),
16150
16151 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
16152
16153 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
16154
16155 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
16156 }
16157 }
16158}
16159
16160#[repr(C)]
16162pub struct WireExposeDictionary {
16163 table: ::fidl_next::WireTable,
16164}
16165
16166unsafe impl ::fidl_next::ZeroPadding for WireExposeDictionary {
16167 #[inline]
16168 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
16169 ::fidl_next::munge!(let Self { table } = out);
16170 ::fidl_next::WireTable::zero_padding(table);
16171 }
16172}
16173
16174unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeDictionary
16175where
16176 ___D: ::fidl_next::Decoder + ?Sized,
16177{
16178 fn decode(
16179 slot: ::fidl_next::Slot<'_, Self>,
16180 decoder: &mut ___D,
16181 ) -> Result<(), ::fidl_next::DecodeError> {
16182 ::fidl_next::munge!(let Self { table } = slot);
16183
16184 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
16185 match ordinal {
16186 0 => unsafe { ::core::hint::unreachable_unchecked() },
16187
16188 1 => {
16189 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
16190 slot.as_mut(),
16191 decoder,
16192 )?;
16193
16194 Ok(())
16195 }
16196
16197 2 => {
16198 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
16199 slot.as_mut(),
16200 decoder,
16201 )?;
16202
16203 let source_name = unsafe {
16204 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
16205 };
16206
16207 if source_name.len() > 100 {
16208 return Err(::fidl_next::DecodeError::VectorTooLong {
16209 size: source_name.len() as u64,
16210 limit: 100,
16211 });
16212 }
16213
16214 Ok(())
16215 }
16216
16217 3 => {
16218 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
16219 slot.as_mut(),
16220 decoder,
16221 )?;
16222
16223 Ok(())
16224 }
16225
16226 4 => {
16227 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
16228 slot.as_mut(),
16229 decoder,
16230 )?;
16231
16232 let target_name = unsafe {
16233 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
16234 };
16235
16236 if target_name.len() > 100 {
16237 return Err(::fidl_next::DecodeError::VectorTooLong {
16238 size: target_name.len() as u64,
16239 limit: 100,
16240 });
16241 }
16242
16243 Ok(())
16244 }
16245
16246 5 => {
16247 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
16248 slot.as_mut(),
16249 decoder,
16250 )?;
16251
16252 Ok(())
16253 }
16254
16255 6 => {
16256 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
16257 slot.as_mut(),
16258 decoder,
16259 )?;
16260
16261 let source_dictionary = unsafe {
16262 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
16263 };
16264
16265 if source_dictionary.len() > 1024 {
16266 return Err(::fidl_next::DecodeError::VectorTooLong {
16267 size: source_dictionary.len() as u64,
16268 limit: 1024,
16269 });
16270 }
16271
16272 Ok(())
16273 }
16274
16275 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
16276 }
16277 })
16278 }
16279}
16280
16281impl WireExposeDictionary {
16282 pub fn source(&self) -> Option<&crate::WireRef> {
16283 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
16284 }
16285
16286 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
16287 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
16288 }
16289
16290 pub fn target(&self) -> Option<&crate::WireRef> {
16291 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
16292 }
16293
16294 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
16295 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
16296 }
16297
16298 pub fn availability(&self) -> Option<&crate::WireAvailability> {
16299 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
16300 }
16301
16302 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
16303 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
16304 }
16305}
16306
16307impl ::core::fmt::Debug for WireExposeDictionary {
16308 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
16309 f.debug_struct("ExposeDictionary")
16310 .field("source", &self.source())
16311 .field("source_name", &self.source_name())
16312 .field("target", &self.target())
16313 .field("target_name", &self.target_name())
16314 .field("availability", &self.availability())
16315 .field("source_dictionary", &self.source_dictionary())
16316 .finish()
16317 }
16318}
16319
16320#[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"]
16321#[derive(Clone, Debug, Default)]
16322pub struct ExposeConfiguration {
16323 pub source: Option<crate::Ref>,
16324
16325 pub source_name: Option<String>,
16326
16327 pub target: Option<crate::Ref>,
16328
16329 pub target_name: Option<String>,
16330
16331 pub availability: Option<crate::Availability>,
16332
16333 pub source_dictionary: Option<String>,
16334}
16335
16336impl ExposeConfiguration {
16337 fn __max_ordinal(&self) -> usize {
16338 if self.source.is_some() {
16339 return 1;
16340 }
16341
16342 if self.source_name.is_some() {
16343 return 2;
16344 }
16345
16346 if self.target.is_some() {
16347 return 3;
16348 }
16349
16350 if self.target_name.is_some() {
16351 return 4;
16352 }
16353
16354 if self.availability.is_some() {
16355 return 5;
16356 }
16357
16358 if self.source_dictionary.is_some() {
16359 return 6;
16360 }
16361
16362 0
16363 }
16364}
16365
16366impl ::fidl_next::Encodable for ExposeConfiguration {
16367 type Encoded = WireExposeConfiguration;
16368}
16369
16370unsafe impl<___E> ::fidl_next::Encode<___E> for ExposeConfiguration
16371where
16372 ___E: ::fidl_next::Encoder + ?Sized,
16373{
16374 #[inline]
16375 fn encode(
16376 mut self,
16377 encoder: &mut ___E,
16378 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
16379 ) -> Result<(), ::fidl_next::EncodeError> {
16380 ::fidl_next::munge!(let WireExposeConfiguration { table } = out);
16381
16382 let max_ord = self.__max_ordinal();
16383
16384 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
16385 ::fidl_next::ZeroPadding::zero_padding(&mut out);
16386
16387 let mut preallocated =
16388 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
16389
16390 for i in 1..=max_ord {
16391 match i {
16392 6 => {
16393 if let Some(source_dictionary) = self.source_dictionary.take() {
16394 ::fidl_next::WireEnvelope::encode_value(
16395 source_dictionary,
16396 preallocated.encoder,
16397 &mut out,
16398 )?;
16399 } else {
16400 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16401 }
16402 }
16403
16404 5 => {
16405 if let Some(availability) = self.availability.take() {
16406 ::fidl_next::WireEnvelope::encode_value(
16407 availability,
16408 preallocated.encoder,
16409 &mut out,
16410 )?;
16411 } else {
16412 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16413 }
16414 }
16415
16416 4 => {
16417 if let Some(target_name) = self.target_name.take() {
16418 ::fidl_next::WireEnvelope::encode_value(
16419 target_name,
16420 preallocated.encoder,
16421 &mut out,
16422 )?;
16423 } else {
16424 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16425 }
16426 }
16427
16428 3 => {
16429 if let Some(target) = self.target.take() {
16430 ::fidl_next::WireEnvelope::encode_value(
16431 target,
16432 preallocated.encoder,
16433 &mut out,
16434 )?;
16435 } else {
16436 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16437 }
16438 }
16439
16440 2 => {
16441 if let Some(source_name) = self.source_name.take() {
16442 ::fidl_next::WireEnvelope::encode_value(
16443 source_name,
16444 preallocated.encoder,
16445 &mut out,
16446 )?;
16447 } else {
16448 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16449 }
16450 }
16451
16452 1 => {
16453 if let Some(source) = self.source.take() {
16454 ::fidl_next::WireEnvelope::encode_value(
16455 source,
16456 preallocated.encoder,
16457 &mut out,
16458 )?;
16459 } else {
16460 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16461 }
16462 }
16463
16464 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
16465 }
16466 unsafe {
16467 preallocated.write_next(out.assume_init_ref());
16468 }
16469 }
16470
16471 ::fidl_next::WireTable::encode_len(table, max_ord);
16472
16473 Ok(())
16474 }
16475}
16476
16477unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExposeConfiguration
16478where
16479 ___E: ::fidl_next::Encoder + ?Sized,
16480{
16481 #[inline]
16482 fn encode_ref(
16483 &self,
16484 encoder: &mut ___E,
16485 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
16486 ) -> Result<(), ::fidl_next::EncodeError> {
16487 ::fidl_next::munge!(let WireExposeConfiguration { table } = out);
16488
16489 let max_ord = self.__max_ordinal();
16490
16491 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
16492 ::fidl_next::ZeroPadding::zero_padding(&mut out);
16493
16494 let mut preallocated =
16495 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
16496
16497 for i in 1..=max_ord {
16498 match i {
16499 6 => {
16500 if let Some(source_dictionary) = &self.source_dictionary {
16501 ::fidl_next::WireEnvelope::encode_value(
16502 source_dictionary,
16503 preallocated.encoder,
16504 &mut out,
16505 )?;
16506 } else {
16507 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16508 }
16509 }
16510
16511 5 => {
16512 if let Some(availability) = &self.availability {
16513 ::fidl_next::WireEnvelope::encode_value(
16514 availability,
16515 preallocated.encoder,
16516 &mut out,
16517 )?;
16518 } else {
16519 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16520 }
16521 }
16522
16523 4 => {
16524 if let Some(target_name) = &self.target_name {
16525 ::fidl_next::WireEnvelope::encode_value(
16526 target_name,
16527 preallocated.encoder,
16528 &mut out,
16529 )?;
16530 } else {
16531 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16532 }
16533 }
16534
16535 3 => {
16536 if let Some(target) = &self.target {
16537 ::fidl_next::WireEnvelope::encode_value(
16538 target,
16539 preallocated.encoder,
16540 &mut out,
16541 )?;
16542 } else {
16543 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16544 }
16545 }
16546
16547 2 => {
16548 if let Some(source_name) = &self.source_name {
16549 ::fidl_next::WireEnvelope::encode_value(
16550 source_name,
16551 preallocated.encoder,
16552 &mut out,
16553 )?;
16554 } else {
16555 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16556 }
16557 }
16558
16559 1 => {
16560 if let Some(source) = &self.source {
16561 ::fidl_next::WireEnvelope::encode_value(
16562 source,
16563 preallocated.encoder,
16564 &mut out,
16565 )?;
16566 } else {
16567 ::fidl_next::WireEnvelope::encode_zero(&mut out)
16568 }
16569 }
16570
16571 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
16572 }
16573 unsafe {
16574 preallocated.write_next(out.assume_init_ref());
16575 }
16576 }
16577
16578 ::fidl_next::WireTable::encode_len(table, max_ord);
16579
16580 Ok(())
16581 }
16582}
16583
16584impl ::fidl_next::TakeFrom<WireExposeConfiguration> for ExposeConfiguration {
16585 #[inline]
16586 fn take_from(from: &WireExposeConfiguration) -> Self {
16587 Self {
16588 source: from.source().map(::fidl_next::TakeFrom::take_from),
16589
16590 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
16591
16592 target: from.target().map(::fidl_next::TakeFrom::take_from),
16593
16594 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
16595
16596 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
16597
16598 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
16599 }
16600 }
16601}
16602
16603#[repr(C)]
16605pub struct WireExposeConfiguration {
16606 table: ::fidl_next::WireTable,
16607}
16608
16609unsafe impl ::fidl_next::ZeroPadding for WireExposeConfiguration {
16610 #[inline]
16611 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
16612 ::fidl_next::munge!(let Self { table } = out);
16613 ::fidl_next::WireTable::zero_padding(table);
16614 }
16615}
16616
16617unsafe impl<___D> ::fidl_next::Decode<___D> for WireExposeConfiguration
16618where
16619 ___D: ::fidl_next::Decoder + ?Sized,
16620{
16621 fn decode(
16622 slot: ::fidl_next::Slot<'_, Self>,
16623 decoder: &mut ___D,
16624 ) -> Result<(), ::fidl_next::DecodeError> {
16625 ::fidl_next::munge!(let Self { table } = slot);
16626
16627 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
16628 match ordinal {
16629 0 => unsafe { ::core::hint::unreachable_unchecked() },
16630
16631 1 => {
16632 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
16633 slot.as_mut(),
16634 decoder,
16635 )?;
16636
16637 Ok(())
16638 }
16639
16640 2 => {
16641 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
16642 slot.as_mut(),
16643 decoder,
16644 )?;
16645
16646 let source_name = unsafe {
16647 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
16648 };
16649
16650 if source_name.len() > 100 {
16651 return Err(::fidl_next::DecodeError::VectorTooLong {
16652 size: source_name.len() as u64,
16653 limit: 100,
16654 });
16655 }
16656
16657 Ok(())
16658 }
16659
16660 3 => {
16661 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
16662 slot.as_mut(),
16663 decoder,
16664 )?;
16665
16666 Ok(())
16667 }
16668
16669 4 => {
16670 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
16671 slot.as_mut(),
16672 decoder,
16673 )?;
16674
16675 let target_name = unsafe {
16676 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
16677 };
16678
16679 if target_name.len() > 100 {
16680 return Err(::fidl_next::DecodeError::VectorTooLong {
16681 size: target_name.len() as u64,
16682 limit: 100,
16683 });
16684 }
16685
16686 Ok(())
16687 }
16688
16689 5 => {
16690 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
16691 slot.as_mut(),
16692 decoder,
16693 )?;
16694
16695 Ok(())
16696 }
16697
16698 6 => {
16699 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
16700 slot.as_mut(),
16701 decoder,
16702 )?;
16703
16704 let source_dictionary = unsafe {
16705 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
16706 };
16707
16708 if source_dictionary.len() > 1024 {
16709 return Err(::fidl_next::DecodeError::VectorTooLong {
16710 size: source_dictionary.len() as u64,
16711 limit: 1024,
16712 });
16713 }
16714
16715 Ok(())
16716 }
16717
16718 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
16719 }
16720 })
16721 }
16722}
16723
16724impl WireExposeConfiguration {
16725 pub fn source(&self) -> Option<&crate::WireRef> {
16726 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
16727 }
16728
16729 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
16730 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
16731 }
16732
16733 pub fn target(&self) -> Option<&crate::WireRef> {
16734 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
16735 }
16736
16737 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
16738 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
16739 }
16740
16741 pub fn availability(&self) -> Option<&crate::WireAvailability> {
16742 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
16743 }
16744
16745 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
16746 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
16747 }
16748}
16749
16750impl ::core::fmt::Debug for WireExposeConfiguration {
16751 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
16752 f.debug_struct("ExposeConfiguration")
16753 .field("source", &self.source())
16754 .field("source_name", &self.source_name())
16755 .field("target", &self.target())
16756 .field("target_name", &self.target_name())
16757 .field("availability", &self.availability())
16758 .field("source_dictionary", &self.source_dictionary())
16759 .finish()
16760 }
16761}
16762
16763#[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"]
16764#[derive(Clone, Debug)]
16765pub enum Expose {
16766 Service(crate::ExposeService),
16767
16768 Protocol(crate::ExposeProtocol),
16769
16770 Directory(crate::ExposeDirectory),
16771
16772 Runner(crate::ExposeRunner),
16773
16774 Resolver(crate::ExposeResolver),
16775
16776 Dictionary(crate::ExposeDictionary),
16777
16778 Config(crate::ExposeConfiguration),
16779
16780 UnknownOrdinal_(u64),
16781}
16782
16783impl ::fidl_next::Encodable for Expose {
16784 type Encoded = WireExpose;
16785}
16786
16787unsafe impl<___E> ::fidl_next::Encode<___E> for Expose
16788where
16789 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
16790
16791 ___E: ::fidl_next::Encoder,
16792{
16793 #[inline]
16794 fn encode(
16795 self,
16796 encoder: &mut ___E,
16797 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
16798 ) -> Result<(), ::fidl_next::EncodeError> {
16799 ::fidl_next::munge!(let WireExpose { raw } = out);
16800
16801 match self {
16802 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<
16803 ___E,
16804 crate::ExposeService,
16805 >(value, 1, encoder, raw)?,
16806
16807 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
16808 ___E,
16809 crate::ExposeProtocol,
16810 >(value, 2, encoder, raw)?,
16811
16812 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
16813 ___E,
16814 crate::ExposeDirectory,
16815 >(value, 3, encoder, raw)?,
16816
16817 Self::Runner(value) => {
16818 ::fidl_next::RawWireUnion::encode_as::<___E, crate::ExposeRunner>(
16819 value, 4, encoder, raw,
16820 )?
16821 }
16822
16823 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<
16824 ___E,
16825 crate::ExposeResolver,
16826 >(value, 5, encoder, raw)?,
16827
16828 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
16829 ___E,
16830 crate::ExposeDictionary,
16831 >(value, 7, encoder, raw)?,
16832
16833 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
16834 ___E,
16835 crate::ExposeConfiguration,
16836 >(value, 8, encoder, raw)?,
16837
16838 Self::UnknownOrdinal_(ordinal) => {
16839 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
16840 }
16841 }
16842
16843 Ok(())
16844 }
16845}
16846
16847unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Expose
16848where
16849 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
16850
16851 ___E: ::fidl_next::Encoder,
16852{
16853 #[inline]
16854 fn encode_ref(
16855 &self,
16856 encoder: &mut ___E,
16857 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
16858 ) -> Result<(), ::fidl_next::EncodeError> {
16859 ::fidl_next::munge!(let WireExpose { raw } = out);
16860
16861 match self {
16862 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<
16863 ___E,
16864 &crate::ExposeService,
16865 >(value, 1, encoder, raw)?,
16866
16867 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
16868 ___E,
16869 &crate::ExposeProtocol,
16870 >(value, 2, encoder, raw)?,
16871
16872 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
16873 ___E,
16874 &crate::ExposeDirectory,
16875 >(value, 3, encoder, raw)?,
16876
16877 Self::Runner(value) => ::fidl_next::RawWireUnion::encode_as::<
16878 ___E,
16879 &crate::ExposeRunner,
16880 >(value, 4, encoder, raw)?,
16881
16882 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<
16883 ___E,
16884 &crate::ExposeResolver,
16885 >(value, 5, encoder, raw)?,
16886
16887 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
16888 ___E,
16889 &crate::ExposeDictionary,
16890 >(value, 7, encoder, raw)?,
16891
16892 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
16893 ___E,
16894 &crate::ExposeConfiguration,
16895 >(value, 8, encoder, raw)?,
16896
16897 Self::UnknownOrdinal_(ordinal) => {
16898 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
16899 }
16900 }
16901
16902 Ok(())
16903 }
16904}
16905
16906impl ::fidl_next::EncodableOption for Box<Expose> {
16907 type EncodedOption = WireOptionalExpose;
16908}
16909
16910unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<Expose>
16911where
16912 ___E: ?Sized,
16913 Expose: ::fidl_next::Encode<___E>,
16914{
16915 #[inline]
16916 fn encode_option(
16917 this: Option<Self>,
16918 encoder: &mut ___E,
16919 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
16920 ) -> Result<(), ::fidl_next::EncodeError> {
16921 ::fidl_next::munge!(let WireOptionalExpose { raw } = &mut *out);
16922
16923 if let Some(inner) = this {
16924 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
16925 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
16926 } else {
16927 ::fidl_next::RawWireUnion::encode_absent(raw);
16928 }
16929
16930 Ok(())
16931 }
16932}
16933
16934unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<Expose>
16935where
16936 ___E: ?Sized,
16937 Expose: ::fidl_next::EncodeRef<___E>,
16938{
16939 #[inline]
16940 fn encode_option_ref(
16941 this: Option<&Self>,
16942 encoder: &mut ___E,
16943 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
16944 ) -> Result<(), ::fidl_next::EncodeError> {
16945 ::fidl_next::munge!(let WireOptionalExpose { raw } = &mut *out);
16946
16947 if let Some(inner) = this {
16948 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
16949 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
16950 } else {
16951 ::fidl_next::RawWireUnion::encode_absent(raw);
16952 }
16953
16954 Ok(())
16955 }
16956}
16957
16958impl ::fidl_next::TakeFrom<WireExpose> for Expose {
16959 #[inline]
16960 fn take_from(from: &WireExpose) -> Self {
16961 match from.raw.ordinal() {
16962 1 => Self::Service(::fidl_next::TakeFrom::take_from(unsafe {
16963 from.raw.get().deref_unchecked::<crate::WireExposeService>()
16964 })),
16965
16966 2 => Self::Protocol(::fidl_next::TakeFrom::take_from(unsafe {
16967 from.raw.get().deref_unchecked::<crate::WireExposeProtocol>()
16968 })),
16969
16970 3 => Self::Directory(::fidl_next::TakeFrom::take_from(unsafe {
16971 from.raw.get().deref_unchecked::<crate::WireExposeDirectory>()
16972 })),
16973
16974 4 => Self::Runner(::fidl_next::TakeFrom::take_from(unsafe {
16975 from.raw.get().deref_unchecked::<crate::WireExposeRunner>()
16976 })),
16977
16978 5 => Self::Resolver(::fidl_next::TakeFrom::take_from(unsafe {
16979 from.raw.get().deref_unchecked::<crate::WireExposeResolver>()
16980 })),
16981
16982 7 => Self::Dictionary(::fidl_next::TakeFrom::take_from(unsafe {
16983 from.raw.get().deref_unchecked::<crate::WireExposeDictionary>()
16984 })),
16985
16986 8 => Self::Config(::fidl_next::TakeFrom::take_from(unsafe {
16987 from.raw.get().deref_unchecked::<crate::WireExposeConfiguration>()
16988 })),
16989
16990 _ => unsafe { ::core::hint::unreachable_unchecked() },
16991 }
16992 }
16993}
16994
16995impl ::fidl_next::TakeFrom<WireOptionalExpose> for Option<Box<Expose>> {
16996 #[inline]
16997 fn take_from(from: &WireOptionalExpose) -> Self {
16998 if let Some(inner) = from.as_ref() {
16999 Some(::fidl_next::TakeFrom::take_from(inner))
17000 } else {
17001 None
17002 }
17003 }
17004}
17005
17006#[repr(transparent)]
17008pub struct WireExpose {
17009 raw: ::fidl_next::RawWireUnion,
17010}
17011
17012unsafe impl ::fidl_next::ZeroPadding for WireExpose {
17013 #[inline]
17014 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
17015 ::fidl_next::munge!(let Self { raw } = out);
17016 ::fidl_next::RawWireUnion::zero_padding(raw);
17017 }
17018}
17019
17020pub mod expose {
17021 pub enum Ref<'union> {
17022 Service(&'union crate::WireExposeService),
17023
17024 Protocol(&'union crate::WireExposeProtocol),
17025
17026 Directory(&'union crate::WireExposeDirectory),
17027
17028 Runner(&'union crate::WireExposeRunner),
17029
17030 Resolver(&'union crate::WireExposeResolver),
17031
17032 Dictionary(&'union crate::WireExposeDictionary),
17033
17034 Config(&'union crate::WireExposeConfiguration),
17035
17036 UnknownOrdinal_(u64),
17037 }
17038}
17039
17040impl WireExpose {
17041 pub fn as_ref(&self) -> crate::expose::Ref<'_> {
17042 match self.raw.ordinal() {
17043 1 => crate::expose::Ref::Service(unsafe {
17044 self.raw.get().deref_unchecked::<crate::WireExposeService>()
17045 }),
17046
17047 2 => crate::expose::Ref::Protocol(unsafe {
17048 self.raw.get().deref_unchecked::<crate::WireExposeProtocol>()
17049 }),
17050
17051 3 => crate::expose::Ref::Directory(unsafe {
17052 self.raw.get().deref_unchecked::<crate::WireExposeDirectory>()
17053 }),
17054
17055 4 => crate::expose::Ref::Runner(unsafe {
17056 self.raw.get().deref_unchecked::<crate::WireExposeRunner>()
17057 }),
17058
17059 5 => crate::expose::Ref::Resolver(unsafe {
17060 self.raw.get().deref_unchecked::<crate::WireExposeResolver>()
17061 }),
17062
17063 7 => crate::expose::Ref::Dictionary(unsafe {
17064 self.raw.get().deref_unchecked::<crate::WireExposeDictionary>()
17065 }),
17066
17067 8 => crate::expose::Ref::Config(unsafe {
17068 self.raw.get().deref_unchecked::<crate::WireExposeConfiguration>()
17069 }),
17070
17071 unknown => crate::expose::Ref::UnknownOrdinal_(unknown),
17072 }
17073 }
17074}
17075
17076unsafe impl<___D> ::fidl_next::Decode<___D> for WireExpose
17077where
17078 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
17079
17080 ___D: ::fidl_next::Decoder,
17081{
17082 fn decode(
17083 mut slot: ::fidl_next::Slot<'_, Self>,
17084 decoder: &mut ___D,
17085 ) -> Result<(), ::fidl_next::DecodeError> {
17086 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
17087 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
17088 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeService>(
17089 raw, decoder,
17090 )?,
17091
17092 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeProtocol>(
17093 raw, decoder,
17094 )?,
17095
17096 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeDirectory>(
17097 raw, decoder,
17098 )?,
17099
17100 4 => {
17101 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeRunner>(raw, decoder)?
17102 }
17103
17104 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeResolver>(
17105 raw, decoder,
17106 )?,
17107
17108 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeDictionary>(
17109 raw, decoder,
17110 )?,
17111
17112 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeConfiguration>(
17113 raw, decoder,
17114 )?,
17115
17116 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
17117 }
17118
17119 Ok(())
17120 }
17121}
17122
17123impl ::core::fmt::Debug for WireExpose {
17124 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
17125 match self.raw.ordinal() {
17126 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireExposeService>().fmt(f) },
17127 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireExposeProtocol>().fmt(f) },
17128 3 => unsafe { self.raw.get().deref_unchecked::<crate::WireExposeDirectory>().fmt(f) },
17129 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireExposeRunner>().fmt(f) },
17130 5 => unsafe { self.raw.get().deref_unchecked::<crate::WireExposeResolver>().fmt(f) },
17131 7 => unsafe { self.raw.get().deref_unchecked::<crate::WireExposeDictionary>().fmt(f) },
17132 8 => unsafe {
17133 self.raw.get().deref_unchecked::<crate::WireExposeConfiguration>().fmt(f)
17134 },
17135 _ => unsafe { ::core::hint::unreachable_unchecked() },
17136 }
17137 }
17138}
17139
17140#[repr(transparent)]
17141pub struct WireOptionalExpose {
17142 raw: ::fidl_next::RawWireUnion,
17143}
17144
17145unsafe impl ::fidl_next::ZeroPadding for WireOptionalExpose {
17146 #[inline]
17147 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
17148 ::fidl_next::munge!(let Self { raw } = out);
17149 ::fidl_next::RawWireUnion::zero_padding(raw);
17150 }
17151}
17152
17153impl WireOptionalExpose {
17154 pub fn is_some(&self) -> bool {
17155 self.raw.is_some()
17156 }
17157
17158 pub fn is_none(&self) -> bool {
17159 self.raw.is_none()
17160 }
17161
17162 pub fn as_ref(&self) -> Option<&WireExpose> {
17163 if self.is_some() {
17164 Some(unsafe { &*(self as *const Self).cast() })
17165 } else {
17166 None
17167 }
17168 }
17169}
17170
17171unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExpose
17172where
17173 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
17174
17175 ___D: ::fidl_next::Decoder,
17176{
17177 fn decode(
17178 mut slot: ::fidl_next::Slot<'_, Self>,
17179 decoder: &mut ___D,
17180 ) -> Result<(), ::fidl_next::DecodeError> {
17181 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
17182 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
17183 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeService>(
17184 raw, decoder,
17185 )?,
17186
17187 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeProtocol>(
17188 raw, decoder,
17189 )?,
17190
17191 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeDirectory>(
17192 raw, decoder,
17193 )?,
17194
17195 4 => {
17196 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeRunner>(raw, decoder)?
17197 }
17198
17199 5 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeResolver>(
17200 raw, decoder,
17201 )?,
17202
17203 7 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeDictionary>(
17204 raw, decoder,
17205 )?,
17206
17207 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireExposeConfiguration>(
17208 raw, decoder,
17209 )?,
17210
17211 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
17212 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
17213 }
17214
17215 Ok(())
17216 }
17217}
17218
17219impl ::core::fmt::Debug for WireOptionalExpose {
17220 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
17221 self.as_ref().fmt(f)
17222 }
17223}
17224
17225#[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"]
17226#[derive(Clone, Debug, Default)]
17227pub struct OfferService {
17228 pub source: Option<crate::Ref>,
17229
17230 pub source_name: Option<String>,
17231
17232 pub target: Option<crate::Ref>,
17233
17234 pub target_name: Option<String>,
17235
17236 pub source_instance_filter: Option<Vec<String>>,
17237
17238 pub renamed_instances: Option<Vec<crate::NameMapping>>,
17239
17240 pub availability: Option<crate::Availability>,
17241
17242 pub source_dictionary: Option<String>,
17243
17244 pub dependency_type: Option<crate::DependencyType>,
17245}
17246
17247impl OfferService {
17248 fn __max_ordinal(&self) -> usize {
17249 if self.source.is_some() {
17250 return 1;
17251 }
17252
17253 if self.source_name.is_some() {
17254 return 2;
17255 }
17256
17257 if self.target.is_some() {
17258 return 3;
17259 }
17260
17261 if self.target_name.is_some() {
17262 return 4;
17263 }
17264
17265 if self.source_instance_filter.is_some() {
17266 return 5;
17267 }
17268
17269 if self.renamed_instances.is_some() {
17270 return 6;
17271 }
17272
17273 if self.availability.is_some() {
17274 return 7;
17275 }
17276
17277 if self.source_dictionary.is_some() {
17278 return 8;
17279 }
17280
17281 if self.dependency_type.is_some() {
17282 return 9;
17283 }
17284
17285 0
17286 }
17287}
17288
17289impl ::fidl_next::Encodable for OfferService {
17290 type Encoded = WireOfferService;
17291}
17292
17293unsafe impl<___E> ::fidl_next::Encode<___E> for OfferService
17294where
17295 ___E: ::fidl_next::Encoder + ?Sized,
17296{
17297 #[inline]
17298 fn encode(
17299 mut self,
17300 encoder: &mut ___E,
17301 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
17302 ) -> Result<(), ::fidl_next::EncodeError> {
17303 ::fidl_next::munge!(let WireOfferService { table } = out);
17304
17305 let max_ord = self.__max_ordinal();
17306
17307 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
17308 ::fidl_next::ZeroPadding::zero_padding(&mut out);
17309
17310 let mut preallocated =
17311 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
17312
17313 for i in 1..=max_ord {
17314 match i {
17315 9 => {
17316 if let Some(dependency_type) = self.dependency_type.take() {
17317 ::fidl_next::WireEnvelope::encode_value(
17318 dependency_type,
17319 preallocated.encoder,
17320 &mut out,
17321 )?;
17322 } else {
17323 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17324 }
17325 }
17326
17327 8 => {
17328 if let Some(source_dictionary) = self.source_dictionary.take() {
17329 ::fidl_next::WireEnvelope::encode_value(
17330 source_dictionary,
17331 preallocated.encoder,
17332 &mut out,
17333 )?;
17334 } else {
17335 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17336 }
17337 }
17338
17339 7 => {
17340 if let Some(availability) = self.availability.take() {
17341 ::fidl_next::WireEnvelope::encode_value(
17342 availability,
17343 preallocated.encoder,
17344 &mut out,
17345 )?;
17346 } else {
17347 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17348 }
17349 }
17350
17351 6 => {
17352 if let Some(renamed_instances) = self.renamed_instances.take() {
17353 ::fidl_next::WireEnvelope::encode_value(
17354 renamed_instances,
17355 preallocated.encoder,
17356 &mut out,
17357 )?;
17358 } else {
17359 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17360 }
17361 }
17362
17363 5 => {
17364 if let Some(source_instance_filter) = self.source_instance_filter.take() {
17365 ::fidl_next::WireEnvelope::encode_value(
17366 source_instance_filter,
17367 preallocated.encoder,
17368 &mut out,
17369 )?;
17370 } else {
17371 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17372 }
17373 }
17374
17375 4 => {
17376 if let Some(target_name) = self.target_name.take() {
17377 ::fidl_next::WireEnvelope::encode_value(
17378 target_name,
17379 preallocated.encoder,
17380 &mut out,
17381 )?;
17382 } else {
17383 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17384 }
17385 }
17386
17387 3 => {
17388 if let Some(target) = self.target.take() {
17389 ::fidl_next::WireEnvelope::encode_value(
17390 target,
17391 preallocated.encoder,
17392 &mut out,
17393 )?;
17394 } else {
17395 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17396 }
17397 }
17398
17399 2 => {
17400 if let Some(source_name) = self.source_name.take() {
17401 ::fidl_next::WireEnvelope::encode_value(
17402 source_name,
17403 preallocated.encoder,
17404 &mut out,
17405 )?;
17406 } else {
17407 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17408 }
17409 }
17410
17411 1 => {
17412 if let Some(source) = self.source.take() {
17413 ::fidl_next::WireEnvelope::encode_value(
17414 source,
17415 preallocated.encoder,
17416 &mut out,
17417 )?;
17418 } else {
17419 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17420 }
17421 }
17422
17423 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
17424 }
17425 unsafe {
17426 preallocated.write_next(out.assume_init_ref());
17427 }
17428 }
17429
17430 ::fidl_next::WireTable::encode_len(table, max_ord);
17431
17432 Ok(())
17433 }
17434}
17435
17436unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferService
17437where
17438 ___E: ::fidl_next::Encoder + ?Sized,
17439{
17440 #[inline]
17441 fn encode_ref(
17442 &self,
17443 encoder: &mut ___E,
17444 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
17445 ) -> Result<(), ::fidl_next::EncodeError> {
17446 ::fidl_next::munge!(let WireOfferService { table } = out);
17447
17448 let max_ord = self.__max_ordinal();
17449
17450 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
17451 ::fidl_next::ZeroPadding::zero_padding(&mut out);
17452
17453 let mut preallocated =
17454 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
17455
17456 for i in 1..=max_ord {
17457 match i {
17458 9 => {
17459 if let Some(dependency_type) = &self.dependency_type {
17460 ::fidl_next::WireEnvelope::encode_value(
17461 dependency_type,
17462 preallocated.encoder,
17463 &mut out,
17464 )?;
17465 } else {
17466 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17467 }
17468 }
17469
17470 8 => {
17471 if let Some(source_dictionary) = &self.source_dictionary {
17472 ::fidl_next::WireEnvelope::encode_value(
17473 source_dictionary,
17474 preallocated.encoder,
17475 &mut out,
17476 )?;
17477 } else {
17478 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17479 }
17480 }
17481
17482 7 => {
17483 if let Some(availability) = &self.availability {
17484 ::fidl_next::WireEnvelope::encode_value(
17485 availability,
17486 preallocated.encoder,
17487 &mut out,
17488 )?;
17489 } else {
17490 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17491 }
17492 }
17493
17494 6 => {
17495 if let Some(renamed_instances) = &self.renamed_instances {
17496 ::fidl_next::WireEnvelope::encode_value(
17497 renamed_instances,
17498 preallocated.encoder,
17499 &mut out,
17500 )?;
17501 } else {
17502 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17503 }
17504 }
17505
17506 5 => {
17507 if let Some(source_instance_filter) = &self.source_instance_filter {
17508 ::fidl_next::WireEnvelope::encode_value(
17509 source_instance_filter,
17510 preallocated.encoder,
17511 &mut out,
17512 )?;
17513 } else {
17514 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17515 }
17516 }
17517
17518 4 => {
17519 if let Some(target_name) = &self.target_name {
17520 ::fidl_next::WireEnvelope::encode_value(
17521 target_name,
17522 preallocated.encoder,
17523 &mut out,
17524 )?;
17525 } else {
17526 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17527 }
17528 }
17529
17530 3 => {
17531 if let Some(target) = &self.target {
17532 ::fidl_next::WireEnvelope::encode_value(
17533 target,
17534 preallocated.encoder,
17535 &mut out,
17536 )?;
17537 } else {
17538 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17539 }
17540 }
17541
17542 2 => {
17543 if let Some(source_name) = &self.source_name {
17544 ::fidl_next::WireEnvelope::encode_value(
17545 source_name,
17546 preallocated.encoder,
17547 &mut out,
17548 )?;
17549 } else {
17550 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17551 }
17552 }
17553
17554 1 => {
17555 if let Some(source) = &self.source {
17556 ::fidl_next::WireEnvelope::encode_value(
17557 source,
17558 preallocated.encoder,
17559 &mut out,
17560 )?;
17561 } else {
17562 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17563 }
17564 }
17565
17566 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
17567 }
17568 unsafe {
17569 preallocated.write_next(out.assume_init_ref());
17570 }
17571 }
17572
17573 ::fidl_next::WireTable::encode_len(table, max_ord);
17574
17575 Ok(())
17576 }
17577}
17578
17579impl ::fidl_next::TakeFrom<WireOfferService> for OfferService {
17580 #[inline]
17581 fn take_from(from: &WireOfferService) -> Self {
17582 Self {
17583 source: from.source().map(::fidl_next::TakeFrom::take_from),
17584
17585 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
17586
17587 target: from.target().map(::fidl_next::TakeFrom::take_from),
17588
17589 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
17590
17591 source_instance_filter: from
17592 .source_instance_filter()
17593 .map(::fidl_next::TakeFrom::take_from),
17594
17595 renamed_instances: from.renamed_instances().map(::fidl_next::TakeFrom::take_from),
17596
17597 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
17598
17599 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
17600
17601 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
17602 }
17603 }
17604}
17605
17606#[repr(C)]
17608pub struct WireOfferService {
17609 table: ::fidl_next::WireTable,
17610}
17611
17612unsafe impl ::fidl_next::ZeroPadding for WireOfferService {
17613 #[inline]
17614 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
17615 ::fidl_next::munge!(let Self { table } = out);
17616 ::fidl_next::WireTable::zero_padding(table);
17617 }
17618}
17619
17620unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferService
17621where
17622 ___D: ::fidl_next::Decoder + ?Sized,
17623{
17624 fn decode(
17625 slot: ::fidl_next::Slot<'_, Self>,
17626 decoder: &mut ___D,
17627 ) -> Result<(), ::fidl_next::DecodeError> {
17628 ::fidl_next::munge!(let Self { table } = slot);
17629
17630 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
17631 match ordinal {
17632 0 => unsafe { ::core::hint::unreachable_unchecked() },
17633
17634 1 => {
17635 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
17636 slot.as_mut(),
17637 decoder,
17638 )?;
17639
17640 Ok(())
17641 }
17642
17643 2 => {
17644 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
17645 slot.as_mut(),
17646 decoder,
17647 )?;
17648
17649 let source_name = unsafe {
17650 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
17651 };
17652
17653 if source_name.len() > 100 {
17654 return Err(::fidl_next::DecodeError::VectorTooLong {
17655 size: source_name.len() as u64,
17656 limit: 100,
17657 });
17658 }
17659
17660 Ok(())
17661 }
17662
17663 3 => {
17664 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
17665 slot.as_mut(),
17666 decoder,
17667 )?;
17668
17669 Ok(())
17670 }
17671
17672 4 => {
17673 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
17674 slot.as_mut(),
17675 decoder,
17676 )?;
17677
17678 let target_name = unsafe {
17679 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
17680 };
17681
17682 if target_name.len() > 100 {
17683 return Err(::fidl_next::DecodeError::VectorTooLong {
17684 size: target_name.len() as u64,
17685 limit: 100,
17686 });
17687 }
17688
17689 Ok(())
17690 }
17691
17692 5 => {
17693 ::fidl_next::WireEnvelope::decode_as::<
17694 ___D,
17695 ::fidl_next::WireVector<::fidl_next::WireString>,
17696 >(slot.as_mut(), decoder)?;
17697
17698 Ok(())
17699 }
17700
17701 6 => {
17702 ::fidl_next::WireEnvelope::decode_as::<
17703 ___D,
17704 ::fidl_next::WireVector<crate::WireNameMapping>,
17705 >(slot.as_mut(), decoder)?;
17706
17707 Ok(())
17708 }
17709
17710 7 => {
17711 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
17712 slot.as_mut(),
17713 decoder,
17714 )?;
17715
17716 Ok(())
17717 }
17718
17719 8 => {
17720 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
17721 slot.as_mut(),
17722 decoder,
17723 )?;
17724
17725 let source_dictionary = unsafe {
17726 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
17727 };
17728
17729 if source_dictionary.len() > 1024 {
17730 return Err(::fidl_next::DecodeError::VectorTooLong {
17731 size: source_dictionary.len() as u64,
17732 limit: 1024,
17733 });
17734 }
17735
17736 Ok(())
17737 }
17738
17739 9 => {
17740 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
17741 slot.as_mut(),
17742 decoder,
17743 )?;
17744
17745 Ok(())
17746 }
17747
17748 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
17749 }
17750 })
17751 }
17752}
17753
17754impl WireOfferService {
17755 pub fn source(&self) -> Option<&crate::WireRef> {
17756 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
17757 }
17758
17759 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
17760 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
17761 }
17762
17763 pub fn target(&self) -> Option<&crate::WireRef> {
17764 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
17765 }
17766
17767 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
17768 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
17769 }
17770
17771 pub fn source_instance_filter(
17772 &self,
17773 ) -> Option<&::fidl_next::WireVector<::fidl_next::WireString>> {
17774 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
17775 }
17776
17777 pub fn renamed_instances(&self) -> Option<&::fidl_next::WireVector<crate::WireNameMapping>> {
17778 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
17779 }
17780
17781 pub fn availability(&self) -> Option<&crate::WireAvailability> {
17782 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
17783 }
17784
17785 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
17786 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
17787 }
17788
17789 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
17790 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
17791 }
17792}
17793
17794impl ::core::fmt::Debug for WireOfferService {
17795 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
17796 f.debug_struct("OfferService")
17797 .field("source", &self.source())
17798 .field("source_name", &self.source_name())
17799 .field("target", &self.target())
17800 .field("target_name", &self.target_name())
17801 .field("source_instance_filter", &self.source_instance_filter())
17802 .field("renamed_instances", &self.renamed_instances())
17803 .field("availability", &self.availability())
17804 .field("source_dictionary", &self.source_dictionary())
17805 .field("dependency_type", &self.dependency_type())
17806 .finish()
17807 }
17808}
17809
17810#[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"]
17811#[derive(Clone, Debug, Default)]
17812pub struct OfferProtocol {
17813 pub source: Option<crate::Ref>,
17814
17815 pub source_name: Option<String>,
17816
17817 pub target: Option<crate::Ref>,
17818
17819 pub target_name: Option<String>,
17820
17821 pub dependency_type: Option<crate::DependencyType>,
17822
17823 pub availability: Option<crate::Availability>,
17824
17825 pub source_dictionary: Option<String>,
17826}
17827
17828impl OfferProtocol {
17829 fn __max_ordinal(&self) -> usize {
17830 if self.source.is_some() {
17831 return 1;
17832 }
17833
17834 if self.source_name.is_some() {
17835 return 2;
17836 }
17837
17838 if self.target.is_some() {
17839 return 3;
17840 }
17841
17842 if self.target_name.is_some() {
17843 return 4;
17844 }
17845
17846 if self.dependency_type.is_some() {
17847 return 5;
17848 }
17849
17850 if self.availability.is_some() {
17851 return 6;
17852 }
17853
17854 if self.source_dictionary.is_some() {
17855 return 7;
17856 }
17857
17858 0
17859 }
17860}
17861
17862impl ::fidl_next::Encodable for OfferProtocol {
17863 type Encoded = WireOfferProtocol;
17864}
17865
17866unsafe impl<___E> ::fidl_next::Encode<___E> for OfferProtocol
17867where
17868 ___E: ::fidl_next::Encoder + ?Sized,
17869{
17870 #[inline]
17871 fn encode(
17872 mut self,
17873 encoder: &mut ___E,
17874 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
17875 ) -> Result<(), ::fidl_next::EncodeError> {
17876 ::fidl_next::munge!(let WireOfferProtocol { table } = out);
17877
17878 let max_ord = self.__max_ordinal();
17879
17880 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
17881 ::fidl_next::ZeroPadding::zero_padding(&mut out);
17882
17883 let mut preallocated =
17884 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
17885
17886 for i in 1..=max_ord {
17887 match i {
17888 7 => {
17889 if let Some(source_dictionary) = self.source_dictionary.take() {
17890 ::fidl_next::WireEnvelope::encode_value(
17891 source_dictionary,
17892 preallocated.encoder,
17893 &mut out,
17894 )?;
17895 } else {
17896 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17897 }
17898 }
17899
17900 6 => {
17901 if let Some(availability) = self.availability.take() {
17902 ::fidl_next::WireEnvelope::encode_value(
17903 availability,
17904 preallocated.encoder,
17905 &mut out,
17906 )?;
17907 } else {
17908 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17909 }
17910 }
17911
17912 5 => {
17913 if let Some(dependency_type) = self.dependency_type.take() {
17914 ::fidl_next::WireEnvelope::encode_value(
17915 dependency_type,
17916 preallocated.encoder,
17917 &mut out,
17918 )?;
17919 } else {
17920 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17921 }
17922 }
17923
17924 4 => {
17925 if let Some(target_name) = self.target_name.take() {
17926 ::fidl_next::WireEnvelope::encode_value(
17927 target_name,
17928 preallocated.encoder,
17929 &mut out,
17930 )?;
17931 } else {
17932 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17933 }
17934 }
17935
17936 3 => {
17937 if let Some(target) = self.target.take() {
17938 ::fidl_next::WireEnvelope::encode_value(
17939 target,
17940 preallocated.encoder,
17941 &mut out,
17942 )?;
17943 } else {
17944 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17945 }
17946 }
17947
17948 2 => {
17949 if let Some(source_name) = self.source_name.take() {
17950 ::fidl_next::WireEnvelope::encode_value(
17951 source_name,
17952 preallocated.encoder,
17953 &mut out,
17954 )?;
17955 } else {
17956 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17957 }
17958 }
17959
17960 1 => {
17961 if let Some(source) = self.source.take() {
17962 ::fidl_next::WireEnvelope::encode_value(
17963 source,
17964 preallocated.encoder,
17965 &mut out,
17966 )?;
17967 } else {
17968 ::fidl_next::WireEnvelope::encode_zero(&mut out)
17969 }
17970 }
17971
17972 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
17973 }
17974 unsafe {
17975 preallocated.write_next(out.assume_init_ref());
17976 }
17977 }
17978
17979 ::fidl_next::WireTable::encode_len(table, max_ord);
17980
17981 Ok(())
17982 }
17983}
17984
17985unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferProtocol
17986where
17987 ___E: ::fidl_next::Encoder + ?Sized,
17988{
17989 #[inline]
17990 fn encode_ref(
17991 &self,
17992 encoder: &mut ___E,
17993 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
17994 ) -> Result<(), ::fidl_next::EncodeError> {
17995 ::fidl_next::munge!(let WireOfferProtocol { table } = out);
17996
17997 let max_ord = self.__max_ordinal();
17998
17999 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
18000 ::fidl_next::ZeroPadding::zero_padding(&mut out);
18001
18002 let mut preallocated =
18003 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
18004
18005 for i in 1..=max_ord {
18006 match i {
18007 7 => {
18008 if let Some(source_dictionary) = &self.source_dictionary {
18009 ::fidl_next::WireEnvelope::encode_value(
18010 source_dictionary,
18011 preallocated.encoder,
18012 &mut out,
18013 )?;
18014 } else {
18015 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18016 }
18017 }
18018
18019 6 => {
18020 if let Some(availability) = &self.availability {
18021 ::fidl_next::WireEnvelope::encode_value(
18022 availability,
18023 preallocated.encoder,
18024 &mut out,
18025 )?;
18026 } else {
18027 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18028 }
18029 }
18030
18031 5 => {
18032 if let Some(dependency_type) = &self.dependency_type {
18033 ::fidl_next::WireEnvelope::encode_value(
18034 dependency_type,
18035 preallocated.encoder,
18036 &mut out,
18037 )?;
18038 } else {
18039 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18040 }
18041 }
18042
18043 4 => {
18044 if let Some(target_name) = &self.target_name {
18045 ::fidl_next::WireEnvelope::encode_value(
18046 target_name,
18047 preallocated.encoder,
18048 &mut out,
18049 )?;
18050 } else {
18051 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18052 }
18053 }
18054
18055 3 => {
18056 if let Some(target) = &self.target {
18057 ::fidl_next::WireEnvelope::encode_value(
18058 target,
18059 preallocated.encoder,
18060 &mut out,
18061 )?;
18062 } else {
18063 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18064 }
18065 }
18066
18067 2 => {
18068 if let Some(source_name) = &self.source_name {
18069 ::fidl_next::WireEnvelope::encode_value(
18070 source_name,
18071 preallocated.encoder,
18072 &mut out,
18073 )?;
18074 } else {
18075 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18076 }
18077 }
18078
18079 1 => {
18080 if let Some(source) = &self.source {
18081 ::fidl_next::WireEnvelope::encode_value(
18082 source,
18083 preallocated.encoder,
18084 &mut out,
18085 )?;
18086 } else {
18087 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18088 }
18089 }
18090
18091 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
18092 }
18093 unsafe {
18094 preallocated.write_next(out.assume_init_ref());
18095 }
18096 }
18097
18098 ::fidl_next::WireTable::encode_len(table, max_ord);
18099
18100 Ok(())
18101 }
18102}
18103
18104impl ::fidl_next::TakeFrom<WireOfferProtocol> for OfferProtocol {
18105 #[inline]
18106 fn take_from(from: &WireOfferProtocol) -> Self {
18107 Self {
18108 source: from.source().map(::fidl_next::TakeFrom::take_from),
18109
18110 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
18111
18112 target: from.target().map(::fidl_next::TakeFrom::take_from),
18113
18114 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
18115
18116 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
18117
18118 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
18119
18120 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
18121 }
18122 }
18123}
18124
18125#[repr(C)]
18127pub struct WireOfferProtocol {
18128 table: ::fidl_next::WireTable,
18129}
18130
18131unsafe impl ::fidl_next::ZeroPadding for WireOfferProtocol {
18132 #[inline]
18133 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
18134 ::fidl_next::munge!(let Self { table } = out);
18135 ::fidl_next::WireTable::zero_padding(table);
18136 }
18137}
18138
18139unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferProtocol
18140where
18141 ___D: ::fidl_next::Decoder + ?Sized,
18142{
18143 fn decode(
18144 slot: ::fidl_next::Slot<'_, Self>,
18145 decoder: &mut ___D,
18146 ) -> Result<(), ::fidl_next::DecodeError> {
18147 ::fidl_next::munge!(let Self { table } = slot);
18148
18149 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
18150 match ordinal {
18151 0 => unsafe { ::core::hint::unreachable_unchecked() },
18152
18153 1 => {
18154 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
18155 slot.as_mut(),
18156 decoder,
18157 )?;
18158
18159 Ok(())
18160 }
18161
18162 2 => {
18163 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
18164 slot.as_mut(),
18165 decoder,
18166 )?;
18167
18168 let source_name = unsafe {
18169 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
18170 };
18171
18172 if source_name.len() > 100 {
18173 return Err(::fidl_next::DecodeError::VectorTooLong {
18174 size: source_name.len() as u64,
18175 limit: 100,
18176 });
18177 }
18178
18179 Ok(())
18180 }
18181
18182 3 => {
18183 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
18184 slot.as_mut(),
18185 decoder,
18186 )?;
18187
18188 Ok(())
18189 }
18190
18191 4 => {
18192 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
18193 slot.as_mut(),
18194 decoder,
18195 )?;
18196
18197 let target_name = unsafe {
18198 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
18199 };
18200
18201 if target_name.len() > 100 {
18202 return Err(::fidl_next::DecodeError::VectorTooLong {
18203 size: target_name.len() as u64,
18204 limit: 100,
18205 });
18206 }
18207
18208 Ok(())
18209 }
18210
18211 5 => {
18212 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
18213 slot.as_mut(),
18214 decoder,
18215 )?;
18216
18217 Ok(())
18218 }
18219
18220 6 => {
18221 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
18222 slot.as_mut(),
18223 decoder,
18224 )?;
18225
18226 Ok(())
18227 }
18228
18229 7 => {
18230 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
18231 slot.as_mut(),
18232 decoder,
18233 )?;
18234
18235 let source_dictionary = unsafe {
18236 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
18237 };
18238
18239 if source_dictionary.len() > 1024 {
18240 return Err(::fidl_next::DecodeError::VectorTooLong {
18241 size: source_dictionary.len() as u64,
18242 limit: 1024,
18243 });
18244 }
18245
18246 Ok(())
18247 }
18248
18249 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
18250 }
18251 })
18252 }
18253}
18254
18255impl WireOfferProtocol {
18256 pub fn source(&self) -> Option<&crate::WireRef> {
18257 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
18258 }
18259
18260 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
18261 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
18262 }
18263
18264 pub fn target(&self) -> Option<&crate::WireRef> {
18265 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
18266 }
18267
18268 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
18269 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
18270 }
18271
18272 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
18273 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
18274 }
18275
18276 pub fn availability(&self) -> Option<&crate::WireAvailability> {
18277 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
18278 }
18279
18280 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
18281 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
18282 }
18283}
18284
18285impl ::core::fmt::Debug for WireOfferProtocol {
18286 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
18287 f.debug_struct("OfferProtocol")
18288 .field("source", &self.source())
18289 .field("source_name", &self.source_name())
18290 .field("target", &self.target())
18291 .field("target_name", &self.target_name())
18292 .field("dependency_type", &self.dependency_type())
18293 .field("availability", &self.availability())
18294 .field("source_dictionary", &self.source_dictionary())
18295 .finish()
18296 }
18297}
18298
18299#[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"]
18300#[derive(Clone, Debug, Default)]
18301pub struct OfferDirectory {
18302 pub source: Option<crate::Ref>,
18303
18304 pub source_name: Option<String>,
18305
18306 pub target: Option<crate::Ref>,
18307
18308 pub target_name: Option<String>,
18309
18310 pub rights: Option<::fidl_next_fuchsia_io::Operations>,
18311
18312 pub subdir: Option<String>,
18313
18314 pub dependency_type: Option<crate::DependencyType>,
18315
18316 pub availability: Option<crate::Availability>,
18317
18318 pub source_dictionary: Option<String>,
18319}
18320
18321impl OfferDirectory {
18322 fn __max_ordinal(&self) -> usize {
18323 if self.source.is_some() {
18324 return 1;
18325 }
18326
18327 if self.source_name.is_some() {
18328 return 2;
18329 }
18330
18331 if self.target.is_some() {
18332 return 3;
18333 }
18334
18335 if self.target_name.is_some() {
18336 return 4;
18337 }
18338
18339 if self.rights.is_some() {
18340 return 5;
18341 }
18342
18343 if self.subdir.is_some() {
18344 return 6;
18345 }
18346
18347 if self.dependency_type.is_some() {
18348 return 7;
18349 }
18350
18351 if self.availability.is_some() {
18352 return 8;
18353 }
18354
18355 if self.source_dictionary.is_some() {
18356 return 9;
18357 }
18358
18359 0
18360 }
18361}
18362
18363impl ::fidl_next::Encodable for OfferDirectory {
18364 type Encoded = WireOfferDirectory;
18365}
18366
18367unsafe impl<___E> ::fidl_next::Encode<___E> for OfferDirectory
18368where
18369 ___E: ::fidl_next::Encoder + ?Sized,
18370{
18371 #[inline]
18372 fn encode(
18373 mut self,
18374 encoder: &mut ___E,
18375 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
18376 ) -> Result<(), ::fidl_next::EncodeError> {
18377 ::fidl_next::munge!(let WireOfferDirectory { table } = out);
18378
18379 let max_ord = self.__max_ordinal();
18380
18381 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
18382 ::fidl_next::ZeroPadding::zero_padding(&mut out);
18383
18384 let mut preallocated =
18385 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
18386
18387 for i in 1..=max_ord {
18388 match i {
18389 9 => {
18390 if let Some(source_dictionary) = self.source_dictionary.take() {
18391 ::fidl_next::WireEnvelope::encode_value(
18392 source_dictionary,
18393 preallocated.encoder,
18394 &mut out,
18395 )?;
18396 } else {
18397 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18398 }
18399 }
18400
18401 8 => {
18402 if let Some(availability) = self.availability.take() {
18403 ::fidl_next::WireEnvelope::encode_value(
18404 availability,
18405 preallocated.encoder,
18406 &mut out,
18407 )?;
18408 } else {
18409 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18410 }
18411 }
18412
18413 7 => {
18414 if let Some(dependency_type) = self.dependency_type.take() {
18415 ::fidl_next::WireEnvelope::encode_value(
18416 dependency_type,
18417 preallocated.encoder,
18418 &mut out,
18419 )?;
18420 } else {
18421 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18422 }
18423 }
18424
18425 6 => {
18426 if let Some(subdir) = self.subdir.take() {
18427 ::fidl_next::WireEnvelope::encode_value(
18428 subdir,
18429 preallocated.encoder,
18430 &mut out,
18431 )?;
18432 } else {
18433 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18434 }
18435 }
18436
18437 5 => {
18438 if let Some(rights) = self.rights.take() {
18439 ::fidl_next::WireEnvelope::encode_value(
18440 rights,
18441 preallocated.encoder,
18442 &mut out,
18443 )?;
18444 } else {
18445 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18446 }
18447 }
18448
18449 4 => {
18450 if let Some(target_name) = self.target_name.take() {
18451 ::fidl_next::WireEnvelope::encode_value(
18452 target_name,
18453 preallocated.encoder,
18454 &mut out,
18455 )?;
18456 } else {
18457 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18458 }
18459 }
18460
18461 3 => {
18462 if let Some(target) = self.target.take() {
18463 ::fidl_next::WireEnvelope::encode_value(
18464 target,
18465 preallocated.encoder,
18466 &mut out,
18467 )?;
18468 } else {
18469 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18470 }
18471 }
18472
18473 2 => {
18474 if let Some(source_name) = self.source_name.take() {
18475 ::fidl_next::WireEnvelope::encode_value(
18476 source_name,
18477 preallocated.encoder,
18478 &mut out,
18479 )?;
18480 } else {
18481 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18482 }
18483 }
18484
18485 1 => {
18486 if let Some(source) = self.source.take() {
18487 ::fidl_next::WireEnvelope::encode_value(
18488 source,
18489 preallocated.encoder,
18490 &mut out,
18491 )?;
18492 } else {
18493 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18494 }
18495 }
18496
18497 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
18498 }
18499 unsafe {
18500 preallocated.write_next(out.assume_init_ref());
18501 }
18502 }
18503
18504 ::fidl_next::WireTable::encode_len(table, max_ord);
18505
18506 Ok(())
18507 }
18508}
18509
18510unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferDirectory
18511where
18512 ___E: ::fidl_next::Encoder + ?Sized,
18513{
18514 #[inline]
18515 fn encode_ref(
18516 &self,
18517 encoder: &mut ___E,
18518 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
18519 ) -> Result<(), ::fidl_next::EncodeError> {
18520 ::fidl_next::munge!(let WireOfferDirectory { table } = out);
18521
18522 let max_ord = self.__max_ordinal();
18523
18524 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
18525 ::fidl_next::ZeroPadding::zero_padding(&mut out);
18526
18527 let mut preallocated =
18528 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
18529
18530 for i in 1..=max_ord {
18531 match i {
18532 9 => {
18533 if let Some(source_dictionary) = &self.source_dictionary {
18534 ::fidl_next::WireEnvelope::encode_value(
18535 source_dictionary,
18536 preallocated.encoder,
18537 &mut out,
18538 )?;
18539 } else {
18540 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18541 }
18542 }
18543
18544 8 => {
18545 if let Some(availability) = &self.availability {
18546 ::fidl_next::WireEnvelope::encode_value(
18547 availability,
18548 preallocated.encoder,
18549 &mut out,
18550 )?;
18551 } else {
18552 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18553 }
18554 }
18555
18556 7 => {
18557 if let Some(dependency_type) = &self.dependency_type {
18558 ::fidl_next::WireEnvelope::encode_value(
18559 dependency_type,
18560 preallocated.encoder,
18561 &mut out,
18562 )?;
18563 } else {
18564 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18565 }
18566 }
18567
18568 6 => {
18569 if let Some(subdir) = &self.subdir {
18570 ::fidl_next::WireEnvelope::encode_value(
18571 subdir,
18572 preallocated.encoder,
18573 &mut out,
18574 )?;
18575 } else {
18576 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18577 }
18578 }
18579
18580 5 => {
18581 if let Some(rights) = &self.rights {
18582 ::fidl_next::WireEnvelope::encode_value(
18583 rights,
18584 preallocated.encoder,
18585 &mut out,
18586 )?;
18587 } else {
18588 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18589 }
18590 }
18591
18592 4 => {
18593 if let Some(target_name) = &self.target_name {
18594 ::fidl_next::WireEnvelope::encode_value(
18595 target_name,
18596 preallocated.encoder,
18597 &mut out,
18598 )?;
18599 } else {
18600 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18601 }
18602 }
18603
18604 3 => {
18605 if let Some(target) = &self.target {
18606 ::fidl_next::WireEnvelope::encode_value(
18607 target,
18608 preallocated.encoder,
18609 &mut out,
18610 )?;
18611 } else {
18612 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18613 }
18614 }
18615
18616 2 => {
18617 if let Some(source_name) = &self.source_name {
18618 ::fidl_next::WireEnvelope::encode_value(
18619 source_name,
18620 preallocated.encoder,
18621 &mut out,
18622 )?;
18623 } else {
18624 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18625 }
18626 }
18627
18628 1 => {
18629 if let Some(source) = &self.source {
18630 ::fidl_next::WireEnvelope::encode_value(
18631 source,
18632 preallocated.encoder,
18633 &mut out,
18634 )?;
18635 } else {
18636 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18637 }
18638 }
18639
18640 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
18641 }
18642 unsafe {
18643 preallocated.write_next(out.assume_init_ref());
18644 }
18645 }
18646
18647 ::fidl_next::WireTable::encode_len(table, max_ord);
18648
18649 Ok(())
18650 }
18651}
18652
18653impl ::fidl_next::TakeFrom<WireOfferDirectory> for OfferDirectory {
18654 #[inline]
18655 fn take_from(from: &WireOfferDirectory) -> Self {
18656 Self {
18657 source: from.source().map(::fidl_next::TakeFrom::take_from),
18658
18659 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
18660
18661 target: from.target().map(::fidl_next::TakeFrom::take_from),
18662
18663 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
18664
18665 rights: from.rights().map(::fidl_next::TakeFrom::take_from),
18666
18667 subdir: from.subdir().map(::fidl_next::TakeFrom::take_from),
18668
18669 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
18670
18671 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
18672
18673 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
18674 }
18675 }
18676}
18677
18678#[repr(C)]
18680pub struct WireOfferDirectory {
18681 table: ::fidl_next::WireTable,
18682}
18683
18684unsafe impl ::fidl_next::ZeroPadding for WireOfferDirectory {
18685 #[inline]
18686 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
18687 ::fidl_next::munge!(let Self { table } = out);
18688 ::fidl_next::WireTable::zero_padding(table);
18689 }
18690}
18691
18692unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferDirectory
18693where
18694 ___D: ::fidl_next::Decoder + ?Sized,
18695{
18696 fn decode(
18697 slot: ::fidl_next::Slot<'_, Self>,
18698 decoder: &mut ___D,
18699 ) -> Result<(), ::fidl_next::DecodeError> {
18700 ::fidl_next::munge!(let Self { table } = slot);
18701
18702 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
18703 match ordinal {
18704 0 => unsafe { ::core::hint::unreachable_unchecked() },
18705
18706 1 => {
18707 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
18708 slot.as_mut(),
18709 decoder,
18710 )?;
18711
18712 Ok(())
18713 }
18714
18715 2 => {
18716 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
18717 slot.as_mut(),
18718 decoder,
18719 )?;
18720
18721 let source_name = unsafe {
18722 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
18723 };
18724
18725 if source_name.len() > 100 {
18726 return Err(::fidl_next::DecodeError::VectorTooLong {
18727 size: source_name.len() as u64,
18728 limit: 100,
18729 });
18730 }
18731
18732 Ok(())
18733 }
18734
18735 3 => {
18736 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
18737 slot.as_mut(),
18738 decoder,
18739 )?;
18740
18741 Ok(())
18742 }
18743
18744 4 => {
18745 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
18746 slot.as_mut(),
18747 decoder,
18748 )?;
18749
18750 let target_name = unsafe {
18751 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
18752 };
18753
18754 if target_name.len() > 100 {
18755 return Err(::fidl_next::DecodeError::VectorTooLong {
18756 size: target_name.len() as u64,
18757 limit: 100,
18758 });
18759 }
18760
18761 Ok(())
18762 }
18763
18764 5 => {
18765 ::fidl_next::WireEnvelope::decode_as::<
18766 ___D,
18767 ::fidl_next_fuchsia_io::WireOperations,
18768 >(slot.as_mut(), decoder)?;
18769
18770 Ok(())
18771 }
18772
18773 6 => {
18774 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
18775 slot.as_mut(),
18776 decoder,
18777 )?;
18778
18779 let subdir = unsafe {
18780 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
18781 };
18782
18783 if subdir.len() > 1024 {
18784 return Err(::fidl_next::DecodeError::VectorTooLong {
18785 size: subdir.len() as u64,
18786 limit: 1024,
18787 });
18788 }
18789
18790 Ok(())
18791 }
18792
18793 7 => {
18794 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
18795 slot.as_mut(),
18796 decoder,
18797 )?;
18798
18799 Ok(())
18800 }
18801
18802 8 => {
18803 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
18804 slot.as_mut(),
18805 decoder,
18806 )?;
18807
18808 Ok(())
18809 }
18810
18811 9 => {
18812 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
18813 slot.as_mut(),
18814 decoder,
18815 )?;
18816
18817 let source_dictionary = unsafe {
18818 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
18819 };
18820
18821 if source_dictionary.len() > 1024 {
18822 return Err(::fidl_next::DecodeError::VectorTooLong {
18823 size: source_dictionary.len() as u64,
18824 limit: 1024,
18825 });
18826 }
18827
18828 Ok(())
18829 }
18830
18831 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
18832 }
18833 })
18834 }
18835}
18836
18837impl WireOfferDirectory {
18838 pub fn source(&self) -> Option<&crate::WireRef> {
18839 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
18840 }
18841
18842 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
18843 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
18844 }
18845
18846 pub fn target(&self) -> Option<&crate::WireRef> {
18847 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
18848 }
18849
18850 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
18851 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
18852 }
18853
18854 pub fn rights(&self) -> Option<&::fidl_next_fuchsia_io::WireOperations> {
18855 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
18856 }
18857
18858 pub fn subdir(&self) -> Option<&::fidl_next::WireString> {
18859 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
18860 }
18861
18862 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
18863 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
18864 }
18865
18866 pub fn availability(&self) -> Option<&crate::WireAvailability> {
18867 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
18868 }
18869
18870 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
18871 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
18872 }
18873}
18874
18875impl ::core::fmt::Debug for WireOfferDirectory {
18876 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
18877 f.debug_struct("OfferDirectory")
18878 .field("source", &self.source())
18879 .field("source_name", &self.source_name())
18880 .field("target", &self.target())
18881 .field("target_name", &self.target_name())
18882 .field("rights", &self.rights())
18883 .field("subdir", &self.subdir())
18884 .field("dependency_type", &self.dependency_type())
18885 .field("availability", &self.availability())
18886 .field("source_dictionary", &self.source_dictionary())
18887 .finish()
18888 }
18889}
18890
18891#[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"]
18892#[derive(Clone, Debug, Default)]
18893pub struct OfferStorage {
18894 pub source_name: Option<String>,
18895
18896 pub source: Option<crate::Ref>,
18897
18898 pub target: Option<crate::Ref>,
18899
18900 pub target_name: Option<String>,
18901
18902 pub availability: Option<crate::Availability>,
18903}
18904
18905impl OfferStorage {
18906 fn __max_ordinal(&self) -> usize {
18907 if self.source_name.is_some() {
18908 return 1;
18909 }
18910
18911 if self.source.is_some() {
18912 return 2;
18913 }
18914
18915 if self.target.is_some() {
18916 return 3;
18917 }
18918
18919 if self.target_name.is_some() {
18920 return 4;
18921 }
18922
18923 if self.availability.is_some() {
18924 return 5;
18925 }
18926
18927 0
18928 }
18929}
18930
18931impl ::fidl_next::Encodable for OfferStorage {
18932 type Encoded = WireOfferStorage;
18933}
18934
18935unsafe impl<___E> ::fidl_next::Encode<___E> for OfferStorage
18936where
18937 ___E: ::fidl_next::Encoder + ?Sized,
18938{
18939 #[inline]
18940 fn encode(
18941 mut self,
18942 encoder: &mut ___E,
18943 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
18944 ) -> Result<(), ::fidl_next::EncodeError> {
18945 ::fidl_next::munge!(let WireOfferStorage { table } = out);
18946
18947 let max_ord = self.__max_ordinal();
18948
18949 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
18950 ::fidl_next::ZeroPadding::zero_padding(&mut out);
18951
18952 let mut preallocated =
18953 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
18954
18955 for i in 1..=max_ord {
18956 match i {
18957 5 => {
18958 if let Some(availability) = self.availability.take() {
18959 ::fidl_next::WireEnvelope::encode_value(
18960 availability,
18961 preallocated.encoder,
18962 &mut out,
18963 )?;
18964 } else {
18965 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18966 }
18967 }
18968
18969 4 => {
18970 if let Some(target_name) = self.target_name.take() {
18971 ::fidl_next::WireEnvelope::encode_value(
18972 target_name,
18973 preallocated.encoder,
18974 &mut out,
18975 )?;
18976 } else {
18977 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18978 }
18979 }
18980
18981 3 => {
18982 if let Some(target) = self.target.take() {
18983 ::fidl_next::WireEnvelope::encode_value(
18984 target,
18985 preallocated.encoder,
18986 &mut out,
18987 )?;
18988 } else {
18989 ::fidl_next::WireEnvelope::encode_zero(&mut out)
18990 }
18991 }
18992
18993 2 => {
18994 if let Some(source) = self.source.take() {
18995 ::fidl_next::WireEnvelope::encode_value(
18996 source,
18997 preallocated.encoder,
18998 &mut out,
18999 )?;
19000 } else {
19001 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19002 }
19003 }
19004
19005 1 => {
19006 if let Some(source_name) = self.source_name.take() {
19007 ::fidl_next::WireEnvelope::encode_value(
19008 source_name,
19009 preallocated.encoder,
19010 &mut out,
19011 )?;
19012 } else {
19013 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19014 }
19015 }
19016
19017 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19018 }
19019 unsafe {
19020 preallocated.write_next(out.assume_init_ref());
19021 }
19022 }
19023
19024 ::fidl_next::WireTable::encode_len(table, max_ord);
19025
19026 Ok(())
19027 }
19028}
19029
19030unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferStorage
19031where
19032 ___E: ::fidl_next::Encoder + ?Sized,
19033{
19034 #[inline]
19035 fn encode_ref(
19036 &self,
19037 encoder: &mut ___E,
19038 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
19039 ) -> Result<(), ::fidl_next::EncodeError> {
19040 ::fidl_next::munge!(let WireOfferStorage { table } = out);
19041
19042 let max_ord = self.__max_ordinal();
19043
19044 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
19045 ::fidl_next::ZeroPadding::zero_padding(&mut out);
19046
19047 let mut preallocated =
19048 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
19049
19050 for i in 1..=max_ord {
19051 match i {
19052 5 => {
19053 if let Some(availability) = &self.availability {
19054 ::fidl_next::WireEnvelope::encode_value(
19055 availability,
19056 preallocated.encoder,
19057 &mut out,
19058 )?;
19059 } else {
19060 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19061 }
19062 }
19063
19064 4 => {
19065 if let Some(target_name) = &self.target_name {
19066 ::fidl_next::WireEnvelope::encode_value(
19067 target_name,
19068 preallocated.encoder,
19069 &mut out,
19070 )?;
19071 } else {
19072 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19073 }
19074 }
19075
19076 3 => {
19077 if let Some(target) = &self.target {
19078 ::fidl_next::WireEnvelope::encode_value(
19079 target,
19080 preallocated.encoder,
19081 &mut out,
19082 )?;
19083 } else {
19084 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19085 }
19086 }
19087
19088 2 => {
19089 if let Some(source) = &self.source {
19090 ::fidl_next::WireEnvelope::encode_value(
19091 source,
19092 preallocated.encoder,
19093 &mut out,
19094 )?;
19095 } else {
19096 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19097 }
19098 }
19099
19100 1 => {
19101 if let Some(source_name) = &self.source_name {
19102 ::fidl_next::WireEnvelope::encode_value(
19103 source_name,
19104 preallocated.encoder,
19105 &mut out,
19106 )?;
19107 } else {
19108 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19109 }
19110 }
19111
19112 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19113 }
19114 unsafe {
19115 preallocated.write_next(out.assume_init_ref());
19116 }
19117 }
19118
19119 ::fidl_next::WireTable::encode_len(table, max_ord);
19120
19121 Ok(())
19122 }
19123}
19124
19125impl ::fidl_next::TakeFrom<WireOfferStorage> for OfferStorage {
19126 #[inline]
19127 fn take_from(from: &WireOfferStorage) -> Self {
19128 Self {
19129 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
19130
19131 source: from.source().map(::fidl_next::TakeFrom::take_from),
19132
19133 target: from.target().map(::fidl_next::TakeFrom::take_from),
19134
19135 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
19136
19137 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
19138 }
19139 }
19140}
19141
19142#[repr(C)]
19144pub struct WireOfferStorage {
19145 table: ::fidl_next::WireTable,
19146}
19147
19148unsafe impl ::fidl_next::ZeroPadding for WireOfferStorage {
19149 #[inline]
19150 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
19151 ::fidl_next::munge!(let Self { table } = out);
19152 ::fidl_next::WireTable::zero_padding(table);
19153 }
19154}
19155
19156unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferStorage
19157where
19158 ___D: ::fidl_next::Decoder + ?Sized,
19159{
19160 fn decode(
19161 slot: ::fidl_next::Slot<'_, Self>,
19162 decoder: &mut ___D,
19163 ) -> Result<(), ::fidl_next::DecodeError> {
19164 ::fidl_next::munge!(let Self { table } = slot);
19165
19166 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
19167 match ordinal {
19168 0 => unsafe { ::core::hint::unreachable_unchecked() },
19169
19170 1 => {
19171 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
19172 slot.as_mut(),
19173 decoder,
19174 )?;
19175
19176 let source_name = unsafe {
19177 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
19178 };
19179
19180 if source_name.len() > 100 {
19181 return Err(::fidl_next::DecodeError::VectorTooLong {
19182 size: source_name.len() as u64,
19183 limit: 100,
19184 });
19185 }
19186
19187 Ok(())
19188 }
19189
19190 2 => {
19191 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
19192 slot.as_mut(),
19193 decoder,
19194 )?;
19195
19196 Ok(())
19197 }
19198
19199 3 => {
19200 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
19201 slot.as_mut(),
19202 decoder,
19203 )?;
19204
19205 Ok(())
19206 }
19207
19208 4 => {
19209 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
19210 slot.as_mut(),
19211 decoder,
19212 )?;
19213
19214 let target_name = unsafe {
19215 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
19216 };
19217
19218 if target_name.len() > 100 {
19219 return Err(::fidl_next::DecodeError::VectorTooLong {
19220 size: target_name.len() as u64,
19221 limit: 100,
19222 });
19223 }
19224
19225 Ok(())
19226 }
19227
19228 5 => {
19229 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
19230 slot.as_mut(),
19231 decoder,
19232 )?;
19233
19234 Ok(())
19235 }
19236
19237 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
19238 }
19239 })
19240 }
19241}
19242
19243impl WireOfferStorage {
19244 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
19245 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
19246 }
19247
19248 pub fn source(&self) -> Option<&crate::WireRef> {
19249 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
19250 }
19251
19252 pub fn target(&self) -> Option<&crate::WireRef> {
19253 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
19254 }
19255
19256 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
19257 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
19258 }
19259
19260 pub fn availability(&self) -> Option<&crate::WireAvailability> {
19261 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
19262 }
19263}
19264
19265impl ::core::fmt::Debug for WireOfferStorage {
19266 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
19267 f.debug_struct("OfferStorage")
19268 .field("source_name", &self.source_name())
19269 .field("source", &self.source())
19270 .field("target", &self.target())
19271 .field("target_name", &self.target_name())
19272 .field("availability", &self.availability())
19273 .finish()
19274 }
19275}
19276
19277#[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"]
19278#[derive(Clone, Debug, Default)]
19279pub struct OfferRunner {
19280 pub source: Option<crate::Ref>,
19281
19282 pub source_name: Option<String>,
19283
19284 pub target: Option<crate::Ref>,
19285
19286 pub target_name: Option<String>,
19287
19288 pub source_dictionary: Option<String>,
19289}
19290
19291impl OfferRunner {
19292 fn __max_ordinal(&self) -> usize {
19293 if self.source.is_some() {
19294 return 1;
19295 }
19296
19297 if self.source_name.is_some() {
19298 return 2;
19299 }
19300
19301 if self.target.is_some() {
19302 return 3;
19303 }
19304
19305 if self.target_name.is_some() {
19306 return 4;
19307 }
19308
19309 if self.source_dictionary.is_some() {
19310 return 5;
19311 }
19312
19313 0
19314 }
19315}
19316
19317impl ::fidl_next::Encodable for OfferRunner {
19318 type Encoded = WireOfferRunner;
19319}
19320
19321unsafe impl<___E> ::fidl_next::Encode<___E> for OfferRunner
19322where
19323 ___E: ::fidl_next::Encoder + ?Sized,
19324{
19325 #[inline]
19326 fn encode(
19327 mut self,
19328 encoder: &mut ___E,
19329 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
19330 ) -> Result<(), ::fidl_next::EncodeError> {
19331 ::fidl_next::munge!(let WireOfferRunner { table } = out);
19332
19333 let max_ord = self.__max_ordinal();
19334
19335 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
19336 ::fidl_next::ZeroPadding::zero_padding(&mut out);
19337
19338 let mut preallocated =
19339 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
19340
19341 for i in 1..=max_ord {
19342 match i {
19343 5 => {
19344 if let Some(source_dictionary) = self.source_dictionary.take() {
19345 ::fidl_next::WireEnvelope::encode_value(
19346 source_dictionary,
19347 preallocated.encoder,
19348 &mut out,
19349 )?;
19350 } else {
19351 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19352 }
19353 }
19354
19355 4 => {
19356 if let Some(target_name) = self.target_name.take() {
19357 ::fidl_next::WireEnvelope::encode_value(
19358 target_name,
19359 preallocated.encoder,
19360 &mut out,
19361 )?;
19362 } else {
19363 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19364 }
19365 }
19366
19367 3 => {
19368 if let Some(target) = self.target.take() {
19369 ::fidl_next::WireEnvelope::encode_value(
19370 target,
19371 preallocated.encoder,
19372 &mut out,
19373 )?;
19374 } else {
19375 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19376 }
19377 }
19378
19379 2 => {
19380 if let Some(source_name) = self.source_name.take() {
19381 ::fidl_next::WireEnvelope::encode_value(
19382 source_name,
19383 preallocated.encoder,
19384 &mut out,
19385 )?;
19386 } else {
19387 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19388 }
19389 }
19390
19391 1 => {
19392 if let Some(source) = self.source.take() {
19393 ::fidl_next::WireEnvelope::encode_value(
19394 source,
19395 preallocated.encoder,
19396 &mut out,
19397 )?;
19398 } else {
19399 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19400 }
19401 }
19402
19403 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19404 }
19405 unsafe {
19406 preallocated.write_next(out.assume_init_ref());
19407 }
19408 }
19409
19410 ::fidl_next::WireTable::encode_len(table, max_ord);
19411
19412 Ok(())
19413 }
19414}
19415
19416unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferRunner
19417where
19418 ___E: ::fidl_next::Encoder + ?Sized,
19419{
19420 #[inline]
19421 fn encode_ref(
19422 &self,
19423 encoder: &mut ___E,
19424 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
19425 ) -> Result<(), ::fidl_next::EncodeError> {
19426 ::fidl_next::munge!(let WireOfferRunner { table } = out);
19427
19428 let max_ord = self.__max_ordinal();
19429
19430 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
19431 ::fidl_next::ZeroPadding::zero_padding(&mut out);
19432
19433 let mut preallocated =
19434 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
19435
19436 for i in 1..=max_ord {
19437 match i {
19438 5 => {
19439 if let Some(source_dictionary) = &self.source_dictionary {
19440 ::fidl_next::WireEnvelope::encode_value(
19441 source_dictionary,
19442 preallocated.encoder,
19443 &mut out,
19444 )?;
19445 } else {
19446 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19447 }
19448 }
19449
19450 4 => {
19451 if let Some(target_name) = &self.target_name {
19452 ::fidl_next::WireEnvelope::encode_value(
19453 target_name,
19454 preallocated.encoder,
19455 &mut out,
19456 )?;
19457 } else {
19458 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19459 }
19460 }
19461
19462 3 => {
19463 if let Some(target) = &self.target {
19464 ::fidl_next::WireEnvelope::encode_value(
19465 target,
19466 preallocated.encoder,
19467 &mut out,
19468 )?;
19469 } else {
19470 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19471 }
19472 }
19473
19474 2 => {
19475 if let Some(source_name) = &self.source_name {
19476 ::fidl_next::WireEnvelope::encode_value(
19477 source_name,
19478 preallocated.encoder,
19479 &mut out,
19480 )?;
19481 } else {
19482 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19483 }
19484 }
19485
19486 1 => {
19487 if let Some(source) = &self.source {
19488 ::fidl_next::WireEnvelope::encode_value(
19489 source,
19490 preallocated.encoder,
19491 &mut out,
19492 )?;
19493 } else {
19494 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19495 }
19496 }
19497
19498 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19499 }
19500 unsafe {
19501 preallocated.write_next(out.assume_init_ref());
19502 }
19503 }
19504
19505 ::fidl_next::WireTable::encode_len(table, max_ord);
19506
19507 Ok(())
19508 }
19509}
19510
19511impl ::fidl_next::TakeFrom<WireOfferRunner> for OfferRunner {
19512 #[inline]
19513 fn take_from(from: &WireOfferRunner) -> Self {
19514 Self {
19515 source: from.source().map(::fidl_next::TakeFrom::take_from),
19516
19517 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
19518
19519 target: from.target().map(::fidl_next::TakeFrom::take_from),
19520
19521 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
19522
19523 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
19524 }
19525 }
19526}
19527
19528#[repr(C)]
19530pub struct WireOfferRunner {
19531 table: ::fidl_next::WireTable,
19532}
19533
19534unsafe impl ::fidl_next::ZeroPadding for WireOfferRunner {
19535 #[inline]
19536 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
19537 ::fidl_next::munge!(let Self { table } = out);
19538 ::fidl_next::WireTable::zero_padding(table);
19539 }
19540}
19541
19542unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferRunner
19543where
19544 ___D: ::fidl_next::Decoder + ?Sized,
19545{
19546 fn decode(
19547 slot: ::fidl_next::Slot<'_, Self>,
19548 decoder: &mut ___D,
19549 ) -> Result<(), ::fidl_next::DecodeError> {
19550 ::fidl_next::munge!(let Self { table } = slot);
19551
19552 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
19553 match ordinal {
19554 0 => unsafe { ::core::hint::unreachable_unchecked() },
19555
19556 1 => {
19557 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
19558 slot.as_mut(),
19559 decoder,
19560 )?;
19561
19562 Ok(())
19563 }
19564
19565 2 => {
19566 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
19567 slot.as_mut(),
19568 decoder,
19569 )?;
19570
19571 let source_name = unsafe {
19572 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
19573 };
19574
19575 if source_name.len() > 100 {
19576 return Err(::fidl_next::DecodeError::VectorTooLong {
19577 size: source_name.len() as u64,
19578 limit: 100,
19579 });
19580 }
19581
19582 Ok(())
19583 }
19584
19585 3 => {
19586 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
19587 slot.as_mut(),
19588 decoder,
19589 )?;
19590
19591 Ok(())
19592 }
19593
19594 4 => {
19595 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
19596 slot.as_mut(),
19597 decoder,
19598 )?;
19599
19600 let target_name = unsafe {
19601 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
19602 };
19603
19604 if target_name.len() > 100 {
19605 return Err(::fidl_next::DecodeError::VectorTooLong {
19606 size: target_name.len() as u64,
19607 limit: 100,
19608 });
19609 }
19610
19611 Ok(())
19612 }
19613
19614 5 => {
19615 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
19616 slot.as_mut(),
19617 decoder,
19618 )?;
19619
19620 let source_dictionary = unsafe {
19621 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
19622 };
19623
19624 if source_dictionary.len() > 1024 {
19625 return Err(::fidl_next::DecodeError::VectorTooLong {
19626 size: source_dictionary.len() as u64,
19627 limit: 1024,
19628 });
19629 }
19630
19631 Ok(())
19632 }
19633
19634 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
19635 }
19636 })
19637 }
19638}
19639
19640impl WireOfferRunner {
19641 pub fn source(&self) -> Option<&crate::WireRef> {
19642 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
19643 }
19644
19645 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
19646 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
19647 }
19648
19649 pub fn target(&self) -> Option<&crate::WireRef> {
19650 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
19651 }
19652
19653 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
19654 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
19655 }
19656
19657 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
19658 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
19659 }
19660}
19661
19662impl ::core::fmt::Debug for WireOfferRunner {
19663 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
19664 f.debug_struct("OfferRunner")
19665 .field("source", &self.source())
19666 .field("source_name", &self.source_name())
19667 .field("target", &self.target())
19668 .field("target_name", &self.target_name())
19669 .field("source_dictionary", &self.source_dictionary())
19670 .finish()
19671 }
19672}
19673
19674#[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"]
19675#[derive(Clone, Debug, Default)]
19676pub struct OfferResolver {
19677 pub source: Option<crate::Ref>,
19678
19679 pub source_name: Option<String>,
19680
19681 pub target: Option<crate::Ref>,
19682
19683 pub target_name: Option<String>,
19684
19685 pub source_dictionary: Option<String>,
19686}
19687
19688impl OfferResolver {
19689 fn __max_ordinal(&self) -> usize {
19690 if self.source.is_some() {
19691 return 1;
19692 }
19693
19694 if self.source_name.is_some() {
19695 return 2;
19696 }
19697
19698 if self.target.is_some() {
19699 return 3;
19700 }
19701
19702 if self.target_name.is_some() {
19703 return 4;
19704 }
19705
19706 if self.source_dictionary.is_some() {
19707 return 5;
19708 }
19709
19710 0
19711 }
19712}
19713
19714impl ::fidl_next::Encodable for OfferResolver {
19715 type Encoded = WireOfferResolver;
19716}
19717
19718unsafe impl<___E> ::fidl_next::Encode<___E> for OfferResolver
19719where
19720 ___E: ::fidl_next::Encoder + ?Sized,
19721{
19722 #[inline]
19723 fn encode(
19724 mut self,
19725 encoder: &mut ___E,
19726 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
19727 ) -> Result<(), ::fidl_next::EncodeError> {
19728 ::fidl_next::munge!(let WireOfferResolver { table } = out);
19729
19730 let max_ord = self.__max_ordinal();
19731
19732 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
19733 ::fidl_next::ZeroPadding::zero_padding(&mut out);
19734
19735 let mut preallocated =
19736 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
19737
19738 for i in 1..=max_ord {
19739 match i {
19740 5 => {
19741 if let Some(source_dictionary) = self.source_dictionary.take() {
19742 ::fidl_next::WireEnvelope::encode_value(
19743 source_dictionary,
19744 preallocated.encoder,
19745 &mut out,
19746 )?;
19747 } else {
19748 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19749 }
19750 }
19751
19752 4 => {
19753 if let Some(target_name) = self.target_name.take() {
19754 ::fidl_next::WireEnvelope::encode_value(
19755 target_name,
19756 preallocated.encoder,
19757 &mut out,
19758 )?;
19759 } else {
19760 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19761 }
19762 }
19763
19764 3 => {
19765 if let Some(target) = self.target.take() {
19766 ::fidl_next::WireEnvelope::encode_value(
19767 target,
19768 preallocated.encoder,
19769 &mut out,
19770 )?;
19771 } else {
19772 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19773 }
19774 }
19775
19776 2 => {
19777 if let Some(source_name) = self.source_name.take() {
19778 ::fidl_next::WireEnvelope::encode_value(
19779 source_name,
19780 preallocated.encoder,
19781 &mut out,
19782 )?;
19783 } else {
19784 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19785 }
19786 }
19787
19788 1 => {
19789 if let Some(source) = self.source.take() {
19790 ::fidl_next::WireEnvelope::encode_value(
19791 source,
19792 preallocated.encoder,
19793 &mut out,
19794 )?;
19795 } else {
19796 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19797 }
19798 }
19799
19800 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19801 }
19802 unsafe {
19803 preallocated.write_next(out.assume_init_ref());
19804 }
19805 }
19806
19807 ::fidl_next::WireTable::encode_len(table, max_ord);
19808
19809 Ok(())
19810 }
19811}
19812
19813unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferResolver
19814where
19815 ___E: ::fidl_next::Encoder + ?Sized,
19816{
19817 #[inline]
19818 fn encode_ref(
19819 &self,
19820 encoder: &mut ___E,
19821 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
19822 ) -> Result<(), ::fidl_next::EncodeError> {
19823 ::fidl_next::munge!(let WireOfferResolver { table } = out);
19824
19825 let max_ord = self.__max_ordinal();
19826
19827 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
19828 ::fidl_next::ZeroPadding::zero_padding(&mut out);
19829
19830 let mut preallocated =
19831 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
19832
19833 for i in 1..=max_ord {
19834 match i {
19835 5 => {
19836 if let Some(source_dictionary) = &self.source_dictionary {
19837 ::fidl_next::WireEnvelope::encode_value(
19838 source_dictionary,
19839 preallocated.encoder,
19840 &mut out,
19841 )?;
19842 } else {
19843 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19844 }
19845 }
19846
19847 4 => {
19848 if let Some(target_name) = &self.target_name {
19849 ::fidl_next::WireEnvelope::encode_value(
19850 target_name,
19851 preallocated.encoder,
19852 &mut out,
19853 )?;
19854 } else {
19855 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19856 }
19857 }
19858
19859 3 => {
19860 if let Some(target) = &self.target {
19861 ::fidl_next::WireEnvelope::encode_value(
19862 target,
19863 preallocated.encoder,
19864 &mut out,
19865 )?;
19866 } else {
19867 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19868 }
19869 }
19870
19871 2 => {
19872 if let Some(source_name) = &self.source_name {
19873 ::fidl_next::WireEnvelope::encode_value(
19874 source_name,
19875 preallocated.encoder,
19876 &mut out,
19877 )?;
19878 } else {
19879 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19880 }
19881 }
19882
19883 1 => {
19884 if let Some(source) = &self.source {
19885 ::fidl_next::WireEnvelope::encode_value(
19886 source,
19887 preallocated.encoder,
19888 &mut out,
19889 )?;
19890 } else {
19891 ::fidl_next::WireEnvelope::encode_zero(&mut out)
19892 }
19893 }
19894
19895 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
19896 }
19897 unsafe {
19898 preallocated.write_next(out.assume_init_ref());
19899 }
19900 }
19901
19902 ::fidl_next::WireTable::encode_len(table, max_ord);
19903
19904 Ok(())
19905 }
19906}
19907
19908impl ::fidl_next::TakeFrom<WireOfferResolver> for OfferResolver {
19909 #[inline]
19910 fn take_from(from: &WireOfferResolver) -> Self {
19911 Self {
19912 source: from.source().map(::fidl_next::TakeFrom::take_from),
19913
19914 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
19915
19916 target: from.target().map(::fidl_next::TakeFrom::take_from),
19917
19918 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
19919
19920 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
19921 }
19922 }
19923}
19924
19925#[repr(C)]
19927pub struct WireOfferResolver {
19928 table: ::fidl_next::WireTable,
19929}
19930
19931unsafe impl ::fidl_next::ZeroPadding for WireOfferResolver {
19932 #[inline]
19933 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
19934 ::fidl_next::munge!(let Self { table } = out);
19935 ::fidl_next::WireTable::zero_padding(table);
19936 }
19937}
19938
19939unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferResolver
19940where
19941 ___D: ::fidl_next::Decoder + ?Sized,
19942{
19943 fn decode(
19944 slot: ::fidl_next::Slot<'_, Self>,
19945 decoder: &mut ___D,
19946 ) -> Result<(), ::fidl_next::DecodeError> {
19947 ::fidl_next::munge!(let Self { table } = slot);
19948
19949 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
19950 match ordinal {
19951 0 => unsafe { ::core::hint::unreachable_unchecked() },
19952
19953 1 => {
19954 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
19955 slot.as_mut(),
19956 decoder,
19957 )?;
19958
19959 Ok(())
19960 }
19961
19962 2 => {
19963 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
19964 slot.as_mut(),
19965 decoder,
19966 )?;
19967
19968 let source_name = unsafe {
19969 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
19970 };
19971
19972 if source_name.len() > 100 {
19973 return Err(::fidl_next::DecodeError::VectorTooLong {
19974 size: source_name.len() as u64,
19975 limit: 100,
19976 });
19977 }
19978
19979 Ok(())
19980 }
19981
19982 3 => {
19983 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
19984 slot.as_mut(),
19985 decoder,
19986 )?;
19987
19988 Ok(())
19989 }
19990
19991 4 => {
19992 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
19993 slot.as_mut(),
19994 decoder,
19995 )?;
19996
19997 let target_name = unsafe {
19998 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
19999 };
20000
20001 if target_name.len() > 100 {
20002 return Err(::fidl_next::DecodeError::VectorTooLong {
20003 size: target_name.len() as u64,
20004 limit: 100,
20005 });
20006 }
20007
20008 Ok(())
20009 }
20010
20011 5 => {
20012 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
20013 slot.as_mut(),
20014 decoder,
20015 )?;
20016
20017 let source_dictionary = unsafe {
20018 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
20019 };
20020
20021 if source_dictionary.len() > 1024 {
20022 return Err(::fidl_next::DecodeError::VectorTooLong {
20023 size: source_dictionary.len() as u64,
20024 limit: 1024,
20025 });
20026 }
20027
20028 Ok(())
20029 }
20030
20031 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
20032 }
20033 })
20034 }
20035}
20036
20037impl WireOfferResolver {
20038 pub fn source(&self) -> Option<&crate::WireRef> {
20039 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
20040 }
20041
20042 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
20043 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
20044 }
20045
20046 pub fn target(&self) -> Option<&crate::WireRef> {
20047 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
20048 }
20049
20050 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
20051 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
20052 }
20053
20054 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
20055 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
20056 }
20057}
20058
20059impl ::core::fmt::Debug for WireOfferResolver {
20060 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
20061 f.debug_struct("OfferResolver")
20062 .field("source", &self.source())
20063 .field("source_name", &self.source_name())
20064 .field("target", &self.target())
20065 .field("target_name", &self.target_name())
20066 .field("source_dictionary", &self.source_dictionary())
20067 .finish()
20068 }
20069}
20070
20071#[doc = " Declares an event stream offered by a component.\n"]
20072#[derive(Clone, Debug, Default)]
20073pub struct OfferEventStream {
20074 pub source: Option<crate::Ref>,
20075
20076 pub source_name: Option<String>,
20077
20078 pub scope: Option<Vec<crate::Ref>>,
20079
20080 pub target: Option<crate::Ref>,
20081
20082 pub target_name: Option<String>,
20083
20084 pub availability: Option<crate::Availability>,
20085}
20086
20087impl OfferEventStream {
20088 fn __max_ordinal(&self) -> usize {
20089 if self.source.is_some() {
20090 return 1;
20091 }
20092
20093 if self.source_name.is_some() {
20094 return 2;
20095 }
20096
20097 if self.scope.is_some() {
20098 return 3;
20099 }
20100
20101 if self.target.is_some() {
20102 return 4;
20103 }
20104
20105 if self.target_name.is_some() {
20106 return 5;
20107 }
20108
20109 if self.availability.is_some() {
20110 return 7;
20111 }
20112
20113 0
20114 }
20115}
20116
20117impl ::fidl_next::Encodable for OfferEventStream {
20118 type Encoded = WireOfferEventStream;
20119}
20120
20121unsafe impl<___E> ::fidl_next::Encode<___E> for OfferEventStream
20122where
20123 ___E: ::fidl_next::Encoder + ?Sized,
20124{
20125 #[inline]
20126 fn encode(
20127 mut self,
20128 encoder: &mut ___E,
20129 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
20130 ) -> Result<(), ::fidl_next::EncodeError> {
20131 ::fidl_next::munge!(let WireOfferEventStream { table } = out);
20132
20133 let max_ord = self.__max_ordinal();
20134
20135 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
20136 ::fidl_next::ZeroPadding::zero_padding(&mut out);
20137
20138 let mut preallocated =
20139 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
20140
20141 for i in 1..=max_ord {
20142 match i {
20143 7 => {
20144 if let Some(availability) = self.availability.take() {
20145 ::fidl_next::WireEnvelope::encode_value(
20146 availability,
20147 preallocated.encoder,
20148 &mut out,
20149 )?;
20150 } else {
20151 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20152 }
20153 }
20154
20155 5 => {
20156 if let Some(target_name) = self.target_name.take() {
20157 ::fidl_next::WireEnvelope::encode_value(
20158 target_name,
20159 preallocated.encoder,
20160 &mut out,
20161 )?;
20162 } else {
20163 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20164 }
20165 }
20166
20167 4 => {
20168 if let Some(target) = self.target.take() {
20169 ::fidl_next::WireEnvelope::encode_value(
20170 target,
20171 preallocated.encoder,
20172 &mut out,
20173 )?;
20174 } else {
20175 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20176 }
20177 }
20178
20179 3 => {
20180 if let Some(scope) = self.scope.take() {
20181 ::fidl_next::WireEnvelope::encode_value(
20182 scope,
20183 preallocated.encoder,
20184 &mut out,
20185 )?;
20186 } else {
20187 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20188 }
20189 }
20190
20191 2 => {
20192 if let Some(source_name) = self.source_name.take() {
20193 ::fidl_next::WireEnvelope::encode_value(
20194 source_name,
20195 preallocated.encoder,
20196 &mut out,
20197 )?;
20198 } else {
20199 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20200 }
20201 }
20202
20203 1 => {
20204 if let Some(source) = self.source.take() {
20205 ::fidl_next::WireEnvelope::encode_value(
20206 source,
20207 preallocated.encoder,
20208 &mut out,
20209 )?;
20210 } else {
20211 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20212 }
20213 }
20214
20215 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
20216 }
20217 unsafe {
20218 preallocated.write_next(out.assume_init_ref());
20219 }
20220 }
20221
20222 ::fidl_next::WireTable::encode_len(table, max_ord);
20223
20224 Ok(())
20225 }
20226}
20227
20228unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferEventStream
20229where
20230 ___E: ::fidl_next::Encoder + ?Sized,
20231{
20232 #[inline]
20233 fn encode_ref(
20234 &self,
20235 encoder: &mut ___E,
20236 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
20237 ) -> Result<(), ::fidl_next::EncodeError> {
20238 ::fidl_next::munge!(let WireOfferEventStream { table } = out);
20239
20240 let max_ord = self.__max_ordinal();
20241
20242 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
20243 ::fidl_next::ZeroPadding::zero_padding(&mut out);
20244
20245 let mut preallocated =
20246 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
20247
20248 for i in 1..=max_ord {
20249 match i {
20250 7 => {
20251 if let Some(availability) = &self.availability {
20252 ::fidl_next::WireEnvelope::encode_value(
20253 availability,
20254 preallocated.encoder,
20255 &mut out,
20256 )?;
20257 } else {
20258 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20259 }
20260 }
20261
20262 5 => {
20263 if let Some(target_name) = &self.target_name {
20264 ::fidl_next::WireEnvelope::encode_value(
20265 target_name,
20266 preallocated.encoder,
20267 &mut out,
20268 )?;
20269 } else {
20270 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20271 }
20272 }
20273
20274 4 => {
20275 if let Some(target) = &self.target {
20276 ::fidl_next::WireEnvelope::encode_value(
20277 target,
20278 preallocated.encoder,
20279 &mut out,
20280 )?;
20281 } else {
20282 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20283 }
20284 }
20285
20286 3 => {
20287 if let Some(scope) = &self.scope {
20288 ::fidl_next::WireEnvelope::encode_value(
20289 scope,
20290 preallocated.encoder,
20291 &mut out,
20292 )?;
20293 } else {
20294 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20295 }
20296 }
20297
20298 2 => {
20299 if let Some(source_name) = &self.source_name {
20300 ::fidl_next::WireEnvelope::encode_value(
20301 source_name,
20302 preallocated.encoder,
20303 &mut out,
20304 )?;
20305 } else {
20306 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20307 }
20308 }
20309
20310 1 => {
20311 if let Some(source) = &self.source {
20312 ::fidl_next::WireEnvelope::encode_value(
20313 source,
20314 preallocated.encoder,
20315 &mut out,
20316 )?;
20317 } else {
20318 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20319 }
20320 }
20321
20322 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
20323 }
20324 unsafe {
20325 preallocated.write_next(out.assume_init_ref());
20326 }
20327 }
20328
20329 ::fidl_next::WireTable::encode_len(table, max_ord);
20330
20331 Ok(())
20332 }
20333}
20334
20335impl ::fidl_next::TakeFrom<WireOfferEventStream> for OfferEventStream {
20336 #[inline]
20337 fn take_from(from: &WireOfferEventStream) -> Self {
20338 Self {
20339 source: from.source().map(::fidl_next::TakeFrom::take_from),
20340
20341 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
20342
20343 scope: from.scope().map(::fidl_next::TakeFrom::take_from),
20344
20345 target: from.target().map(::fidl_next::TakeFrom::take_from),
20346
20347 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
20348
20349 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
20350 }
20351 }
20352}
20353
20354#[repr(C)]
20356pub struct WireOfferEventStream {
20357 table: ::fidl_next::WireTable,
20358}
20359
20360unsafe impl ::fidl_next::ZeroPadding for WireOfferEventStream {
20361 #[inline]
20362 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
20363 ::fidl_next::munge!(let Self { table } = out);
20364 ::fidl_next::WireTable::zero_padding(table);
20365 }
20366}
20367
20368unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferEventStream
20369where
20370 ___D: ::fidl_next::Decoder + ?Sized,
20371{
20372 fn decode(
20373 slot: ::fidl_next::Slot<'_, Self>,
20374 decoder: &mut ___D,
20375 ) -> Result<(), ::fidl_next::DecodeError> {
20376 ::fidl_next::munge!(let Self { table } = slot);
20377
20378 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
20379 match ordinal {
20380 0 => unsafe { ::core::hint::unreachable_unchecked() },
20381
20382 1 => {
20383 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
20384 slot.as_mut(),
20385 decoder,
20386 )?;
20387
20388 Ok(())
20389 }
20390
20391 2 => {
20392 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
20393 slot.as_mut(),
20394 decoder,
20395 )?;
20396
20397 let source_name = unsafe {
20398 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
20399 };
20400
20401 if source_name.len() > 100 {
20402 return Err(::fidl_next::DecodeError::VectorTooLong {
20403 size: source_name.len() as u64,
20404 limit: 100,
20405 });
20406 }
20407
20408 Ok(())
20409 }
20410
20411 3 => {
20412 ::fidl_next::WireEnvelope::decode_as::<
20413 ___D,
20414 ::fidl_next::WireVector<crate::WireRef>,
20415 >(slot.as_mut(), decoder)?;
20416
20417 Ok(())
20418 }
20419
20420 4 => {
20421 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
20422 slot.as_mut(),
20423 decoder,
20424 )?;
20425
20426 Ok(())
20427 }
20428
20429 5 => {
20430 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
20431 slot.as_mut(),
20432 decoder,
20433 )?;
20434
20435 let target_name = unsafe {
20436 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
20437 };
20438
20439 if target_name.len() > 100 {
20440 return Err(::fidl_next::DecodeError::VectorTooLong {
20441 size: target_name.len() as u64,
20442 limit: 100,
20443 });
20444 }
20445
20446 Ok(())
20447 }
20448
20449 7 => {
20450 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
20451 slot.as_mut(),
20452 decoder,
20453 )?;
20454
20455 Ok(())
20456 }
20457
20458 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
20459 }
20460 })
20461 }
20462}
20463
20464impl WireOfferEventStream {
20465 pub fn source(&self) -> Option<&crate::WireRef> {
20466 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
20467 }
20468
20469 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
20470 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
20471 }
20472
20473 pub fn scope(&self) -> Option<&::fidl_next::WireVector<crate::WireRef>> {
20474 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
20475 }
20476
20477 pub fn target(&self) -> Option<&crate::WireRef> {
20478 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
20479 }
20480
20481 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
20482 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
20483 }
20484
20485 pub fn availability(&self) -> Option<&crate::WireAvailability> {
20486 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
20487 }
20488}
20489
20490impl ::core::fmt::Debug for WireOfferEventStream {
20491 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
20492 f.debug_struct("OfferEventStream")
20493 .field("source", &self.source())
20494 .field("source_name", &self.source_name())
20495 .field("scope", &self.scope())
20496 .field("target", &self.target())
20497 .field("target_name", &self.target_name())
20498 .field("availability", &self.availability())
20499 .finish()
20500 }
20501}
20502
20503#[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"]
20504#[derive(Clone, Debug, Default)]
20505pub struct OfferDictionary {
20506 pub source: Option<crate::Ref>,
20507
20508 pub source_name: Option<String>,
20509
20510 pub target: Option<crate::Ref>,
20511
20512 pub target_name: Option<String>,
20513
20514 pub dependency_type: Option<crate::DependencyType>,
20515
20516 pub availability: Option<crate::Availability>,
20517
20518 pub source_dictionary: Option<String>,
20519}
20520
20521impl OfferDictionary {
20522 fn __max_ordinal(&self) -> usize {
20523 if self.source.is_some() {
20524 return 1;
20525 }
20526
20527 if self.source_name.is_some() {
20528 return 2;
20529 }
20530
20531 if self.target.is_some() {
20532 return 3;
20533 }
20534
20535 if self.target_name.is_some() {
20536 return 4;
20537 }
20538
20539 if self.dependency_type.is_some() {
20540 return 5;
20541 }
20542
20543 if self.availability.is_some() {
20544 return 6;
20545 }
20546
20547 if self.source_dictionary.is_some() {
20548 return 7;
20549 }
20550
20551 0
20552 }
20553}
20554
20555impl ::fidl_next::Encodable for OfferDictionary {
20556 type Encoded = WireOfferDictionary;
20557}
20558
20559unsafe impl<___E> ::fidl_next::Encode<___E> for OfferDictionary
20560where
20561 ___E: ::fidl_next::Encoder + ?Sized,
20562{
20563 #[inline]
20564 fn encode(
20565 mut self,
20566 encoder: &mut ___E,
20567 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
20568 ) -> Result<(), ::fidl_next::EncodeError> {
20569 ::fidl_next::munge!(let WireOfferDictionary { table } = out);
20570
20571 let max_ord = self.__max_ordinal();
20572
20573 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
20574 ::fidl_next::ZeroPadding::zero_padding(&mut out);
20575
20576 let mut preallocated =
20577 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
20578
20579 for i in 1..=max_ord {
20580 match i {
20581 7 => {
20582 if let Some(source_dictionary) = self.source_dictionary.take() {
20583 ::fidl_next::WireEnvelope::encode_value(
20584 source_dictionary,
20585 preallocated.encoder,
20586 &mut out,
20587 )?;
20588 } else {
20589 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20590 }
20591 }
20592
20593 6 => {
20594 if let Some(availability) = self.availability.take() {
20595 ::fidl_next::WireEnvelope::encode_value(
20596 availability,
20597 preallocated.encoder,
20598 &mut out,
20599 )?;
20600 } else {
20601 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20602 }
20603 }
20604
20605 5 => {
20606 if let Some(dependency_type) = self.dependency_type.take() {
20607 ::fidl_next::WireEnvelope::encode_value(
20608 dependency_type,
20609 preallocated.encoder,
20610 &mut out,
20611 )?;
20612 } else {
20613 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20614 }
20615 }
20616
20617 4 => {
20618 if let Some(target_name) = self.target_name.take() {
20619 ::fidl_next::WireEnvelope::encode_value(
20620 target_name,
20621 preallocated.encoder,
20622 &mut out,
20623 )?;
20624 } else {
20625 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20626 }
20627 }
20628
20629 3 => {
20630 if let Some(target) = self.target.take() {
20631 ::fidl_next::WireEnvelope::encode_value(
20632 target,
20633 preallocated.encoder,
20634 &mut out,
20635 )?;
20636 } else {
20637 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20638 }
20639 }
20640
20641 2 => {
20642 if let Some(source_name) = self.source_name.take() {
20643 ::fidl_next::WireEnvelope::encode_value(
20644 source_name,
20645 preallocated.encoder,
20646 &mut out,
20647 )?;
20648 } else {
20649 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20650 }
20651 }
20652
20653 1 => {
20654 if let Some(source) = self.source.take() {
20655 ::fidl_next::WireEnvelope::encode_value(
20656 source,
20657 preallocated.encoder,
20658 &mut out,
20659 )?;
20660 } else {
20661 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20662 }
20663 }
20664
20665 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
20666 }
20667 unsafe {
20668 preallocated.write_next(out.assume_init_ref());
20669 }
20670 }
20671
20672 ::fidl_next::WireTable::encode_len(table, max_ord);
20673
20674 Ok(())
20675 }
20676}
20677
20678unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferDictionary
20679where
20680 ___E: ::fidl_next::Encoder + ?Sized,
20681{
20682 #[inline]
20683 fn encode_ref(
20684 &self,
20685 encoder: &mut ___E,
20686 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
20687 ) -> Result<(), ::fidl_next::EncodeError> {
20688 ::fidl_next::munge!(let WireOfferDictionary { table } = out);
20689
20690 let max_ord = self.__max_ordinal();
20691
20692 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
20693 ::fidl_next::ZeroPadding::zero_padding(&mut out);
20694
20695 let mut preallocated =
20696 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
20697
20698 for i in 1..=max_ord {
20699 match i {
20700 7 => {
20701 if let Some(source_dictionary) = &self.source_dictionary {
20702 ::fidl_next::WireEnvelope::encode_value(
20703 source_dictionary,
20704 preallocated.encoder,
20705 &mut out,
20706 )?;
20707 } else {
20708 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20709 }
20710 }
20711
20712 6 => {
20713 if let Some(availability) = &self.availability {
20714 ::fidl_next::WireEnvelope::encode_value(
20715 availability,
20716 preallocated.encoder,
20717 &mut out,
20718 )?;
20719 } else {
20720 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20721 }
20722 }
20723
20724 5 => {
20725 if let Some(dependency_type) = &self.dependency_type {
20726 ::fidl_next::WireEnvelope::encode_value(
20727 dependency_type,
20728 preallocated.encoder,
20729 &mut out,
20730 )?;
20731 } else {
20732 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20733 }
20734 }
20735
20736 4 => {
20737 if let Some(target_name) = &self.target_name {
20738 ::fidl_next::WireEnvelope::encode_value(
20739 target_name,
20740 preallocated.encoder,
20741 &mut out,
20742 )?;
20743 } else {
20744 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20745 }
20746 }
20747
20748 3 => {
20749 if let Some(target) = &self.target {
20750 ::fidl_next::WireEnvelope::encode_value(
20751 target,
20752 preallocated.encoder,
20753 &mut out,
20754 )?;
20755 } else {
20756 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20757 }
20758 }
20759
20760 2 => {
20761 if let Some(source_name) = &self.source_name {
20762 ::fidl_next::WireEnvelope::encode_value(
20763 source_name,
20764 preallocated.encoder,
20765 &mut out,
20766 )?;
20767 } else {
20768 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20769 }
20770 }
20771
20772 1 => {
20773 if let Some(source) = &self.source {
20774 ::fidl_next::WireEnvelope::encode_value(
20775 source,
20776 preallocated.encoder,
20777 &mut out,
20778 )?;
20779 } else {
20780 ::fidl_next::WireEnvelope::encode_zero(&mut out)
20781 }
20782 }
20783
20784 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
20785 }
20786 unsafe {
20787 preallocated.write_next(out.assume_init_ref());
20788 }
20789 }
20790
20791 ::fidl_next::WireTable::encode_len(table, max_ord);
20792
20793 Ok(())
20794 }
20795}
20796
20797impl ::fidl_next::TakeFrom<WireOfferDictionary> for OfferDictionary {
20798 #[inline]
20799 fn take_from(from: &WireOfferDictionary) -> Self {
20800 Self {
20801 source: from.source().map(::fidl_next::TakeFrom::take_from),
20802
20803 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
20804
20805 target: from.target().map(::fidl_next::TakeFrom::take_from),
20806
20807 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
20808
20809 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
20810
20811 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
20812
20813 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
20814 }
20815 }
20816}
20817
20818#[repr(C)]
20820pub struct WireOfferDictionary {
20821 table: ::fidl_next::WireTable,
20822}
20823
20824unsafe impl ::fidl_next::ZeroPadding for WireOfferDictionary {
20825 #[inline]
20826 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
20827 ::fidl_next::munge!(let Self { table } = out);
20828 ::fidl_next::WireTable::zero_padding(table);
20829 }
20830}
20831
20832unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferDictionary
20833where
20834 ___D: ::fidl_next::Decoder + ?Sized,
20835{
20836 fn decode(
20837 slot: ::fidl_next::Slot<'_, Self>,
20838 decoder: &mut ___D,
20839 ) -> Result<(), ::fidl_next::DecodeError> {
20840 ::fidl_next::munge!(let Self { table } = slot);
20841
20842 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
20843 match ordinal {
20844 0 => unsafe { ::core::hint::unreachable_unchecked() },
20845
20846 1 => {
20847 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
20848 slot.as_mut(),
20849 decoder,
20850 )?;
20851
20852 Ok(())
20853 }
20854
20855 2 => {
20856 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
20857 slot.as_mut(),
20858 decoder,
20859 )?;
20860
20861 let source_name = unsafe {
20862 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
20863 };
20864
20865 if source_name.len() > 100 {
20866 return Err(::fidl_next::DecodeError::VectorTooLong {
20867 size: source_name.len() as u64,
20868 limit: 100,
20869 });
20870 }
20871
20872 Ok(())
20873 }
20874
20875 3 => {
20876 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
20877 slot.as_mut(),
20878 decoder,
20879 )?;
20880
20881 Ok(())
20882 }
20883
20884 4 => {
20885 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
20886 slot.as_mut(),
20887 decoder,
20888 )?;
20889
20890 let target_name = unsafe {
20891 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
20892 };
20893
20894 if target_name.len() > 100 {
20895 return Err(::fidl_next::DecodeError::VectorTooLong {
20896 size: target_name.len() as u64,
20897 limit: 100,
20898 });
20899 }
20900
20901 Ok(())
20902 }
20903
20904 5 => {
20905 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireDependencyType>(
20906 slot.as_mut(),
20907 decoder,
20908 )?;
20909
20910 Ok(())
20911 }
20912
20913 6 => {
20914 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
20915 slot.as_mut(),
20916 decoder,
20917 )?;
20918
20919 Ok(())
20920 }
20921
20922 7 => {
20923 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
20924 slot.as_mut(),
20925 decoder,
20926 )?;
20927
20928 let source_dictionary = unsafe {
20929 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
20930 };
20931
20932 if source_dictionary.len() > 1024 {
20933 return Err(::fidl_next::DecodeError::VectorTooLong {
20934 size: source_dictionary.len() as u64,
20935 limit: 1024,
20936 });
20937 }
20938
20939 Ok(())
20940 }
20941
20942 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
20943 }
20944 })
20945 }
20946}
20947
20948impl WireOfferDictionary {
20949 pub fn source(&self) -> Option<&crate::WireRef> {
20950 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
20951 }
20952
20953 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
20954 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
20955 }
20956
20957 pub fn target(&self) -> Option<&crate::WireRef> {
20958 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
20959 }
20960
20961 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
20962 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
20963 }
20964
20965 pub fn dependency_type(&self) -> Option<&crate::WireDependencyType> {
20966 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
20967 }
20968
20969 pub fn availability(&self) -> Option<&crate::WireAvailability> {
20970 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
20971 }
20972
20973 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
20974 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
20975 }
20976}
20977
20978impl ::core::fmt::Debug for WireOfferDictionary {
20979 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
20980 f.debug_struct("OfferDictionary")
20981 .field("source", &self.source())
20982 .field("source_name", &self.source_name())
20983 .field("target", &self.target())
20984 .field("target_name", &self.target_name())
20985 .field("dependency_type", &self.dependency_type())
20986 .field("availability", &self.availability())
20987 .field("source_dictionary", &self.source_dictionary())
20988 .finish()
20989 }
20990}
20991
20992#[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"]
20993#[derive(Clone, Debug, Default)]
20994pub struct OfferConfiguration {
20995 pub source: Option<crate::Ref>,
20996
20997 pub source_name: Option<String>,
20998
20999 pub target: Option<crate::Ref>,
21000
21001 pub target_name: Option<String>,
21002
21003 pub availability: Option<crate::Availability>,
21004
21005 pub source_dictionary: Option<String>,
21006}
21007
21008impl OfferConfiguration {
21009 fn __max_ordinal(&self) -> usize {
21010 if self.source.is_some() {
21011 return 1;
21012 }
21013
21014 if self.source_name.is_some() {
21015 return 2;
21016 }
21017
21018 if self.target.is_some() {
21019 return 3;
21020 }
21021
21022 if self.target_name.is_some() {
21023 return 4;
21024 }
21025
21026 if self.availability.is_some() {
21027 return 5;
21028 }
21029
21030 if self.source_dictionary.is_some() {
21031 return 6;
21032 }
21033
21034 0
21035 }
21036}
21037
21038impl ::fidl_next::Encodable for OfferConfiguration {
21039 type Encoded = WireOfferConfiguration;
21040}
21041
21042unsafe impl<___E> ::fidl_next::Encode<___E> for OfferConfiguration
21043where
21044 ___E: ::fidl_next::Encoder + ?Sized,
21045{
21046 #[inline]
21047 fn encode(
21048 mut self,
21049 encoder: &mut ___E,
21050 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
21051 ) -> Result<(), ::fidl_next::EncodeError> {
21052 ::fidl_next::munge!(let WireOfferConfiguration { table } = out);
21053
21054 let max_ord = self.__max_ordinal();
21055
21056 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
21057 ::fidl_next::ZeroPadding::zero_padding(&mut out);
21058
21059 let mut preallocated =
21060 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
21061
21062 for i in 1..=max_ord {
21063 match i {
21064 6 => {
21065 if let Some(source_dictionary) = self.source_dictionary.take() {
21066 ::fidl_next::WireEnvelope::encode_value(
21067 source_dictionary,
21068 preallocated.encoder,
21069 &mut out,
21070 )?;
21071 } else {
21072 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21073 }
21074 }
21075
21076 5 => {
21077 if let Some(availability) = self.availability.take() {
21078 ::fidl_next::WireEnvelope::encode_value(
21079 availability,
21080 preallocated.encoder,
21081 &mut out,
21082 )?;
21083 } else {
21084 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21085 }
21086 }
21087
21088 4 => {
21089 if let Some(target_name) = self.target_name.take() {
21090 ::fidl_next::WireEnvelope::encode_value(
21091 target_name,
21092 preallocated.encoder,
21093 &mut out,
21094 )?;
21095 } else {
21096 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21097 }
21098 }
21099
21100 3 => {
21101 if let Some(target) = self.target.take() {
21102 ::fidl_next::WireEnvelope::encode_value(
21103 target,
21104 preallocated.encoder,
21105 &mut out,
21106 )?;
21107 } else {
21108 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21109 }
21110 }
21111
21112 2 => {
21113 if let Some(source_name) = self.source_name.take() {
21114 ::fidl_next::WireEnvelope::encode_value(
21115 source_name,
21116 preallocated.encoder,
21117 &mut out,
21118 )?;
21119 } else {
21120 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21121 }
21122 }
21123
21124 1 => {
21125 if let Some(source) = self.source.take() {
21126 ::fidl_next::WireEnvelope::encode_value(
21127 source,
21128 preallocated.encoder,
21129 &mut out,
21130 )?;
21131 } else {
21132 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21133 }
21134 }
21135
21136 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
21137 }
21138 unsafe {
21139 preallocated.write_next(out.assume_init_ref());
21140 }
21141 }
21142
21143 ::fidl_next::WireTable::encode_len(table, max_ord);
21144
21145 Ok(())
21146 }
21147}
21148
21149unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OfferConfiguration
21150where
21151 ___E: ::fidl_next::Encoder + ?Sized,
21152{
21153 #[inline]
21154 fn encode_ref(
21155 &self,
21156 encoder: &mut ___E,
21157 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
21158 ) -> Result<(), ::fidl_next::EncodeError> {
21159 ::fidl_next::munge!(let WireOfferConfiguration { table } = out);
21160
21161 let max_ord = self.__max_ordinal();
21162
21163 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
21164 ::fidl_next::ZeroPadding::zero_padding(&mut out);
21165
21166 let mut preallocated =
21167 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
21168
21169 for i in 1..=max_ord {
21170 match i {
21171 6 => {
21172 if let Some(source_dictionary) = &self.source_dictionary {
21173 ::fidl_next::WireEnvelope::encode_value(
21174 source_dictionary,
21175 preallocated.encoder,
21176 &mut out,
21177 )?;
21178 } else {
21179 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21180 }
21181 }
21182
21183 5 => {
21184 if let Some(availability) = &self.availability {
21185 ::fidl_next::WireEnvelope::encode_value(
21186 availability,
21187 preallocated.encoder,
21188 &mut out,
21189 )?;
21190 } else {
21191 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21192 }
21193 }
21194
21195 4 => {
21196 if let Some(target_name) = &self.target_name {
21197 ::fidl_next::WireEnvelope::encode_value(
21198 target_name,
21199 preallocated.encoder,
21200 &mut out,
21201 )?;
21202 } else {
21203 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21204 }
21205 }
21206
21207 3 => {
21208 if let Some(target) = &self.target {
21209 ::fidl_next::WireEnvelope::encode_value(
21210 target,
21211 preallocated.encoder,
21212 &mut out,
21213 )?;
21214 } else {
21215 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21216 }
21217 }
21218
21219 2 => {
21220 if let Some(source_name) = &self.source_name {
21221 ::fidl_next::WireEnvelope::encode_value(
21222 source_name,
21223 preallocated.encoder,
21224 &mut out,
21225 )?;
21226 } else {
21227 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21228 }
21229 }
21230
21231 1 => {
21232 if let Some(source) = &self.source {
21233 ::fidl_next::WireEnvelope::encode_value(
21234 source,
21235 preallocated.encoder,
21236 &mut out,
21237 )?;
21238 } else {
21239 ::fidl_next::WireEnvelope::encode_zero(&mut out)
21240 }
21241 }
21242
21243 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
21244 }
21245 unsafe {
21246 preallocated.write_next(out.assume_init_ref());
21247 }
21248 }
21249
21250 ::fidl_next::WireTable::encode_len(table, max_ord);
21251
21252 Ok(())
21253 }
21254}
21255
21256impl ::fidl_next::TakeFrom<WireOfferConfiguration> for OfferConfiguration {
21257 #[inline]
21258 fn take_from(from: &WireOfferConfiguration) -> Self {
21259 Self {
21260 source: from.source().map(::fidl_next::TakeFrom::take_from),
21261
21262 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
21263
21264 target: from.target().map(::fidl_next::TakeFrom::take_from),
21265
21266 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
21267
21268 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
21269
21270 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
21271 }
21272 }
21273}
21274
21275#[repr(C)]
21277pub struct WireOfferConfiguration {
21278 table: ::fidl_next::WireTable,
21279}
21280
21281unsafe impl ::fidl_next::ZeroPadding for WireOfferConfiguration {
21282 #[inline]
21283 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
21284 ::fidl_next::munge!(let Self { table } = out);
21285 ::fidl_next::WireTable::zero_padding(table);
21286 }
21287}
21288
21289unsafe impl<___D> ::fidl_next::Decode<___D> for WireOfferConfiguration
21290where
21291 ___D: ::fidl_next::Decoder + ?Sized,
21292{
21293 fn decode(
21294 slot: ::fidl_next::Slot<'_, Self>,
21295 decoder: &mut ___D,
21296 ) -> Result<(), ::fidl_next::DecodeError> {
21297 ::fidl_next::munge!(let Self { table } = slot);
21298
21299 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
21300 match ordinal {
21301 0 => unsafe { ::core::hint::unreachable_unchecked() },
21302
21303 1 => {
21304 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
21305 slot.as_mut(),
21306 decoder,
21307 )?;
21308
21309 Ok(())
21310 }
21311
21312 2 => {
21313 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
21314 slot.as_mut(),
21315 decoder,
21316 )?;
21317
21318 let source_name = unsafe {
21319 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
21320 };
21321
21322 if source_name.len() > 100 {
21323 return Err(::fidl_next::DecodeError::VectorTooLong {
21324 size: source_name.len() as u64,
21325 limit: 100,
21326 });
21327 }
21328
21329 Ok(())
21330 }
21331
21332 3 => {
21333 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
21334 slot.as_mut(),
21335 decoder,
21336 )?;
21337
21338 Ok(())
21339 }
21340
21341 4 => {
21342 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
21343 slot.as_mut(),
21344 decoder,
21345 )?;
21346
21347 let target_name = unsafe {
21348 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
21349 };
21350
21351 if target_name.len() > 100 {
21352 return Err(::fidl_next::DecodeError::VectorTooLong {
21353 size: target_name.len() as u64,
21354 limit: 100,
21355 });
21356 }
21357
21358 Ok(())
21359 }
21360
21361 5 => {
21362 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireAvailability>(
21363 slot.as_mut(),
21364 decoder,
21365 )?;
21366
21367 Ok(())
21368 }
21369
21370 6 => {
21371 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
21372 slot.as_mut(),
21373 decoder,
21374 )?;
21375
21376 let source_dictionary = unsafe {
21377 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
21378 };
21379
21380 if source_dictionary.len() > 1024 {
21381 return Err(::fidl_next::DecodeError::VectorTooLong {
21382 size: source_dictionary.len() as u64,
21383 limit: 1024,
21384 });
21385 }
21386
21387 Ok(())
21388 }
21389
21390 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
21391 }
21392 })
21393 }
21394}
21395
21396impl WireOfferConfiguration {
21397 pub fn source(&self) -> Option<&crate::WireRef> {
21398 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
21399 }
21400
21401 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
21402 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
21403 }
21404
21405 pub fn target(&self) -> Option<&crate::WireRef> {
21406 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
21407 }
21408
21409 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
21410 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
21411 }
21412
21413 pub fn availability(&self) -> Option<&crate::WireAvailability> {
21414 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
21415 }
21416
21417 pub fn source_dictionary(&self) -> Option<&::fidl_next::WireString> {
21418 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
21419 }
21420}
21421
21422impl ::core::fmt::Debug for WireOfferConfiguration {
21423 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
21424 f.debug_struct("OfferConfiguration")
21425 .field("source", &self.source())
21426 .field("source_name", &self.source_name())
21427 .field("target", &self.target())
21428 .field("target_name", &self.target_name())
21429 .field("availability", &self.availability())
21430 .field("source_dictionary", &self.source_dictionary())
21431 .finish()
21432 }
21433}
21434
21435#[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"]
21436#[derive(Clone, Debug)]
21437pub enum Offer {
21438 Service(crate::OfferService),
21439
21440 Protocol(crate::OfferProtocol),
21441
21442 Directory(crate::OfferDirectory),
21443
21444 Storage(crate::OfferStorage),
21445
21446 Runner(crate::OfferRunner),
21447
21448 Resolver(crate::OfferResolver),
21449
21450 EventStream(crate::OfferEventStream),
21451
21452 Dictionary(crate::OfferDictionary),
21453
21454 Config(crate::OfferConfiguration),
21455
21456 UnknownOrdinal_(u64),
21457}
21458
21459impl ::fidl_next::Encodable for Offer {
21460 type Encoded = WireOffer;
21461}
21462
21463unsafe impl<___E> ::fidl_next::Encode<___E> for Offer
21464where
21465 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
21466
21467 ___E: ::fidl_next::Encoder,
21468{
21469 #[inline]
21470 fn encode(
21471 self,
21472 encoder: &mut ___E,
21473 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
21474 ) -> Result<(), ::fidl_next::EncodeError> {
21475 ::fidl_next::munge!(let WireOffer { raw } = out);
21476
21477 match self {
21478 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<
21479 ___E,
21480 crate::OfferService,
21481 >(value, 1, encoder, raw)?,
21482
21483 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
21484 ___E,
21485 crate::OfferProtocol,
21486 >(value, 2, encoder, raw)?,
21487
21488 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
21489 ___E,
21490 crate::OfferDirectory,
21491 >(value, 3, encoder, raw)?,
21492
21493 Self::Storage(value) => ::fidl_next::RawWireUnion::encode_as::<
21494 ___E,
21495 crate::OfferStorage,
21496 >(value, 4, encoder, raw)?,
21497
21498 Self::Runner(value) => {
21499 ::fidl_next::RawWireUnion::encode_as::<___E, crate::OfferRunner>(
21500 value, 5, encoder, raw,
21501 )?
21502 }
21503
21504 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<
21505 ___E,
21506 crate::OfferResolver,
21507 >(value, 6, encoder, raw)?,
21508
21509 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
21510 ___E,
21511 crate::OfferEventStream,
21512 >(value, 8, encoder, raw)?,
21513
21514 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
21515 ___E,
21516 crate::OfferDictionary,
21517 >(value, 9, encoder, raw)?,
21518
21519 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
21520 ___E,
21521 crate::OfferConfiguration,
21522 >(value, 10, encoder, raw)?,
21523
21524 Self::UnknownOrdinal_(ordinal) => {
21525 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
21526 }
21527 }
21528
21529 Ok(())
21530 }
21531}
21532
21533unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Offer
21534where
21535 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
21536
21537 ___E: ::fidl_next::Encoder,
21538{
21539 #[inline]
21540 fn encode_ref(
21541 &self,
21542 encoder: &mut ___E,
21543 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
21544 ) -> Result<(), ::fidl_next::EncodeError> {
21545 ::fidl_next::munge!(let WireOffer { raw } = out);
21546
21547 match self {
21548 Self::Service(value) => ::fidl_next::RawWireUnion::encode_as::<
21549 ___E,
21550 &crate::OfferService,
21551 >(value, 1, encoder, raw)?,
21552
21553 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
21554 ___E,
21555 &crate::OfferProtocol,
21556 >(value, 2, encoder, raw)?,
21557
21558 Self::Directory(value) => ::fidl_next::RawWireUnion::encode_as::<
21559 ___E,
21560 &crate::OfferDirectory,
21561 >(value, 3, encoder, raw)?,
21562
21563 Self::Storage(value) => ::fidl_next::RawWireUnion::encode_as::<
21564 ___E,
21565 &crate::OfferStorage,
21566 >(value, 4, encoder, raw)?,
21567
21568 Self::Runner(value) => {
21569 ::fidl_next::RawWireUnion::encode_as::<___E, &crate::OfferRunner>(
21570 value, 5, encoder, raw,
21571 )?
21572 }
21573
21574 Self::Resolver(value) => ::fidl_next::RawWireUnion::encode_as::<
21575 ___E,
21576 &crate::OfferResolver,
21577 >(value, 6, encoder, raw)?,
21578
21579 Self::EventStream(value) => ::fidl_next::RawWireUnion::encode_as::<
21580 ___E,
21581 &crate::OfferEventStream,
21582 >(value, 8, encoder, raw)?,
21583
21584 Self::Dictionary(value) => ::fidl_next::RawWireUnion::encode_as::<
21585 ___E,
21586 &crate::OfferDictionary,
21587 >(value, 9, encoder, raw)?,
21588
21589 Self::Config(value) => ::fidl_next::RawWireUnion::encode_as::<
21590 ___E,
21591 &crate::OfferConfiguration,
21592 >(value, 10, encoder, raw)?,
21593
21594 Self::UnknownOrdinal_(ordinal) => {
21595 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
21596 }
21597 }
21598
21599 Ok(())
21600 }
21601}
21602
21603impl ::fidl_next::EncodableOption for Box<Offer> {
21604 type EncodedOption = WireOptionalOffer;
21605}
21606
21607unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<Offer>
21608where
21609 ___E: ?Sized,
21610 Offer: ::fidl_next::Encode<___E>,
21611{
21612 #[inline]
21613 fn encode_option(
21614 this: Option<Self>,
21615 encoder: &mut ___E,
21616 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
21617 ) -> Result<(), ::fidl_next::EncodeError> {
21618 ::fidl_next::munge!(let WireOptionalOffer { raw } = &mut *out);
21619
21620 if let Some(inner) = this {
21621 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
21622 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
21623 } else {
21624 ::fidl_next::RawWireUnion::encode_absent(raw);
21625 }
21626
21627 Ok(())
21628 }
21629}
21630
21631unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<Offer>
21632where
21633 ___E: ?Sized,
21634 Offer: ::fidl_next::EncodeRef<___E>,
21635{
21636 #[inline]
21637 fn encode_option_ref(
21638 this: Option<&Self>,
21639 encoder: &mut ___E,
21640 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
21641 ) -> Result<(), ::fidl_next::EncodeError> {
21642 ::fidl_next::munge!(let WireOptionalOffer { raw } = &mut *out);
21643
21644 if let Some(inner) = this {
21645 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
21646 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
21647 } else {
21648 ::fidl_next::RawWireUnion::encode_absent(raw);
21649 }
21650
21651 Ok(())
21652 }
21653}
21654
21655impl ::fidl_next::TakeFrom<WireOffer> for Offer {
21656 #[inline]
21657 fn take_from(from: &WireOffer) -> Self {
21658 match from.raw.ordinal() {
21659 1 => Self::Service(::fidl_next::TakeFrom::take_from(unsafe {
21660 from.raw.get().deref_unchecked::<crate::WireOfferService>()
21661 })),
21662
21663 2 => Self::Protocol(::fidl_next::TakeFrom::take_from(unsafe {
21664 from.raw.get().deref_unchecked::<crate::WireOfferProtocol>()
21665 })),
21666
21667 3 => Self::Directory(::fidl_next::TakeFrom::take_from(unsafe {
21668 from.raw.get().deref_unchecked::<crate::WireOfferDirectory>()
21669 })),
21670
21671 4 => Self::Storage(::fidl_next::TakeFrom::take_from(unsafe {
21672 from.raw.get().deref_unchecked::<crate::WireOfferStorage>()
21673 })),
21674
21675 5 => Self::Runner(::fidl_next::TakeFrom::take_from(unsafe {
21676 from.raw.get().deref_unchecked::<crate::WireOfferRunner>()
21677 })),
21678
21679 6 => Self::Resolver(::fidl_next::TakeFrom::take_from(unsafe {
21680 from.raw.get().deref_unchecked::<crate::WireOfferResolver>()
21681 })),
21682
21683 8 => Self::EventStream(::fidl_next::TakeFrom::take_from(unsafe {
21684 from.raw.get().deref_unchecked::<crate::WireOfferEventStream>()
21685 })),
21686
21687 9 => Self::Dictionary(::fidl_next::TakeFrom::take_from(unsafe {
21688 from.raw.get().deref_unchecked::<crate::WireOfferDictionary>()
21689 })),
21690
21691 10 => Self::Config(::fidl_next::TakeFrom::take_from(unsafe {
21692 from.raw.get().deref_unchecked::<crate::WireOfferConfiguration>()
21693 })),
21694
21695 _ => unsafe { ::core::hint::unreachable_unchecked() },
21696 }
21697 }
21698}
21699
21700impl ::fidl_next::TakeFrom<WireOptionalOffer> for Option<Box<Offer>> {
21701 #[inline]
21702 fn take_from(from: &WireOptionalOffer) -> Self {
21703 if let Some(inner) = from.as_ref() {
21704 Some(::fidl_next::TakeFrom::take_from(inner))
21705 } else {
21706 None
21707 }
21708 }
21709}
21710
21711#[repr(transparent)]
21713pub struct WireOffer {
21714 raw: ::fidl_next::RawWireUnion,
21715}
21716
21717unsafe impl ::fidl_next::ZeroPadding for WireOffer {
21718 #[inline]
21719 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
21720 ::fidl_next::munge!(let Self { raw } = out);
21721 ::fidl_next::RawWireUnion::zero_padding(raw);
21722 }
21723}
21724
21725pub mod offer {
21726 pub enum Ref<'union> {
21727 Service(&'union crate::WireOfferService),
21728
21729 Protocol(&'union crate::WireOfferProtocol),
21730
21731 Directory(&'union crate::WireOfferDirectory),
21732
21733 Storage(&'union crate::WireOfferStorage),
21734
21735 Runner(&'union crate::WireOfferRunner),
21736
21737 Resolver(&'union crate::WireOfferResolver),
21738
21739 EventStream(&'union crate::WireOfferEventStream),
21740
21741 Dictionary(&'union crate::WireOfferDictionary),
21742
21743 Config(&'union crate::WireOfferConfiguration),
21744
21745 UnknownOrdinal_(u64),
21746 }
21747}
21748
21749impl WireOffer {
21750 pub fn as_ref(&self) -> crate::offer::Ref<'_> {
21751 match self.raw.ordinal() {
21752 1 => crate::offer::Ref::Service(unsafe {
21753 self.raw.get().deref_unchecked::<crate::WireOfferService>()
21754 }),
21755
21756 2 => crate::offer::Ref::Protocol(unsafe {
21757 self.raw.get().deref_unchecked::<crate::WireOfferProtocol>()
21758 }),
21759
21760 3 => crate::offer::Ref::Directory(unsafe {
21761 self.raw.get().deref_unchecked::<crate::WireOfferDirectory>()
21762 }),
21763
21764 4 => crate::offer::Ref::Storage(unsafe {
21765 self.raw.get().deref_unchecked::<crate::WireOfferStorage>()
21766 }),
21767
21768 5 => crate::offer::Ref::Runner(unsafe {
21769 self.raw.get().deref_unchecked::<crate::WireOfferRunner>()
21770 }),
21771
21772 6 => crate::offer::Ref::Resolver(unsafe {
21773 self.raw.get().deref_unchecked::<crate::WireOfferResolver>()
21774 }),
21775
21776 8 => crate::offer::Ref::EventStream(unsafe {
21777 self.raw.get().deref_unchecked::<crate::WireOfferEventStream>()
21778 }),
21779
21780 9 => crate::offer::Ref::Dictionary(unsafe {
21781 self.raw.get().deref_unchecked::<crate::WireOfferDictionary>()
21782 }),
21783
21784 10 => crate::offer::Ref::Config(unsafe {
21785 self.raw.get().deref_unchecked::<crate::WireOfferConfiguration>()
21786 }),
21787
21788 unknown => crate::offer::Ref::UnknownOrdinal_(unknown),
21789 }
21790 }
21791}
21792
21793unsafe impl<___D> ::fidl_next::Decode<___D> for WireOffer
21794where
21795 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
21796
21797 ___D: ::fidl_next::Decoder,
21798{
21799 fn decode(
21800 mut slot: ::fidl_next::Slot<'_, Self>,
21801 decoder: &mut ___D,
21802 ) -> Result<(), ::fidl_next::DecodeError> {
21803 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
21804 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
21805 1 => {
21806 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferService>(raw, decoder)?
21807 }
21808
21809 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferProtocol>(
21810 raw, decoder,
21811 )?,
21812
21813 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferDirectory>(
21814 raw, decoder,
21815 )?,
21816
21817 4 => {
21818 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferStorage>(raw, decoder)?
21819 }
21820
21821 5 => {
21822 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferRunner>(raw, decoder)?
21823 }
21824
21825 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferResolver>(
21826 raw, decoder,
21827 )?,
21828
21829 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferEventStream>(
21830 raw, decoder,
21831 )?,
21832
21833 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferDictionary>(
21834 raw, decoder,
21835 )?,
21836
21837 10 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferConfiguration>(
21838 raw, decoder,
21839 )?,
21840
21841 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
21842 }
21843
21844 Ok(())
21845 }
21846}
21847
21848impl ::core::fmt::Debug for WireOffer {
21849 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
21850 match self.raw.ordinal() {
21851 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferService>().fmt(f) },
21852 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferProtocol>().fmt(f) },
21853 3 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferDirectory>().fmt(f) },
21854 4 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferStorage>().fmt(f) },
21855 5 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferRunner>().fmt(f) },
21856 6 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferResolver>().fmt(f) },
21857 8 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferEventStream>().fmt(f) },
21858 9 => unsafe { self.raw.get().deref_unchecked::<crate::WireOfferDictionary>().fmt(f) },
21859 10 => unsafe {
21860 self.raw.get().deref_unchecked::<crate::WireOfferConfiguration>().fmt(f)
21861 },
21862 _ => unsafe { ::core::hint::unreachable_unchecked() },
21863 }
21864 }
21865}
21866
21867#[repr(transparent)]
21868pub struct WireOptionalOffer {
21869 raw: ::fidl_next::RawWireUnion,
21870}
21871
21872unsafe impl ::fidl_next::ZeroPadding for WireOptionalOffer {
21873 #[inline]
21874 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
21875 ::fidl_next::munge!(let Self { raw } = out);
21876 ::fidl_next::RawWireUnion::zero_padding(raw);
21877 }
21878}
21879
21880impl WireOptionalOffer {
21881 pub fn is_some(&self) -> bool {
21882 self.raw.is_some()
21883 }
21884
21885 pub fn is_none(&self) -> bool {
21886 self.raw.is_none()
21887 }
21888
21889 pub fn as_ref(&self) -> Option<&WireOffer> {
21890 if self.is_some() {
21891 Some(unsafe { &*(self as *const Self).cast() })
21892 } else {
21893 None
21894 }
21895 }
21896}
21897
21898unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalOffer
21899where
21900 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
21901
21902 ___D: ::fidl_next::Decoder,
21903{
21904 fn decode(
21905 mut slot: ::fidl_next::Slot<'_, Self>,
21906 decoder: &mut ___D,
21907 ) -> Result<(), ::fidl_next::DecodeError> {
21908 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
21909 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
21910 1 => {
21911 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferService>(raw, decoder)?
21912 }
21913
21914 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferProtocol>(
21915 raw, decoder,
21916 )?,
21917
21918 3 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferDirectory>(
21919 raw, decoder,
21920 )?,
21921
21922 4 => {
21923 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferStorage>(raw, decoder)?
21924 }
21925
21926 5 => {
21927 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferRunner>(raw, decoder)?
21928 }
21929
21930 6 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferResolver>(
21931 raw, decoder,
21932 )?,
21933
21934 8 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferEventStream>(
21935 raw, decoder,
21936 )?,
21937
21938 9 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferDictionary>(
21939 raw, decoder,
21940 )?,
21941
21942 10 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOfferConfiguration>(
21943 raw, decoder,
21944 )?,
21945
21946 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
21947 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
21948 }
21949
21950 Ok(())
21951 }
21952}
21953
21954impl ::core::fmt::Debug for WireOptionalOffer {
21955 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
21956 self.as_ref().fmt(f)
21957 }
21958}
21959
21960#[doc = " A repository of the runners available in an environment.\n"]
21961#[derive(Clone, Debug, Default)]
21962pub struct RunnerRegistration {
21963 pub source_name: Option<String>,
21964
21965 pub source: Option<crate::Ref>,
21966
21967 pub target_name: Option<String>,
21968}
21969
21970impl RunnerRegistration {
21971 fn __max_ordinal(&self) -> usize {
21972 if self.source_name.is_some() {
21973 return 1;
21974 }
21975
21976 if self.source.is_some() {
21977 return 2;
21978 }
21979
21980 if self.target_name.is_some() {
21981 return 3;
21982 }
21983
21984 0
21985 }
21986}
21987
21988impl ::fidl_next::Encodable for RunnerRegistration {
21989 type Encoded = WireRunnerRegistration;
21990}
21991
21992unsafe impl<___E> ::fidl_next::Encode<___E> for RunnerRegistration
21993where
21994 ___E: ::fidl_next::Encoder + ?Sized,
21995{
21996 #[inline]
21997 fn encode(
21998 mut self,
21999 encoder: &mut ___E,
22000 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22001 ) -> Result<(), ::fidl_next::EncodeError> {
22002 ::fidl_next::munge!(let WireRunnerRegistration { table } = out);
22003
22004 let max_ord = self.__max_ordinal();
22005
22006 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
22007 ::fidl_next::ZeroPadding::zero_padding(&mut out);
22008
22009 let mut preallocated =
22010 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
22011
22012 for i in 1..=max_ord {
22013 match i {
22014 3 => {
22015 if let Some(target_name) = self.target_name.take() {
22016 ::fidl_next::WireEnvelope::encode_value(
22017 target_name,
22018 preallocated.encoder,
22019 &mut out,
22020 )?;
22021 } else {
22022 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22023 }
22024 }
22025
22026 2 => {
22027 if let Some(source) = self.source.take() {
22028 ::fidl_next::WireEnvelope::encode_value(
22029 source,
22030 preallocated.encoder,
22031 &mut out,
22032 )?;
22033 } else {
22034 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22035 }
22036 }
22037
22038 1 => {
22039 if let Some(source_name) = self.source_name.take() {
22040 ::fidl_next::WireEnvelope::encode_value(
22041 source_name,
22042 preallocated.encoder,
22043 &mut out,
22044 )?;
22045 } else {
22046 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22047 }
22048 }
22049
22050 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22051 }
22052 unsafe {
22053 preallocated.write_next(out.assume_init_ref());
22054 }
22055 }
22056
22057 ::fidl_next::WireTable::encode_len(table, max_ord);
22058
22059 Ok(())
22060 }
22061}
22062
22063unsafe impl<___E> ::fidl_next::EncodeRef<___E> for RunnerRegistration
22064where
22065 ___E: ::fidl_next::Encoder + ?Sized,
22066{
22067 #[inline]
22068 fn encode_ref(
22069 &self,
22070 encoder: &mut ___E,
22071 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22072 ) -> Result<(), ::fidl_next::EncodeError> {
22073 ::fidl_next::munge!(let WireRunnerRegistration { table } = out);
22074
22075 let max_ord = self.__max_ordinal();
22076
22077 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
22078 ::fidl_next::ZeroPadding::zero_padding(&mut out);
22079
22080 let mut preallocated =
22081 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
22082
22083 for i in 1..=max_ord {
22084 match i {
22085 3 => {
22086 if let Some(target_name) = &self.target_name {
22087 ::fidl_next::WireEnvelope::encode_value(
22088 target_name,
22089 preallocated.encoder,
22090 &mut out,
22091 )?;
22092 } else {
22093 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22094 }
22095 }
22096
22097 2 => {
22098 if let Some(source) = &self.source {
22099 ::fidl_next::WireEnvelope::encode_value(
22100 source,
22101 preallocated.encoder,
22102 &mut out,
22103 )?;
22104 } else {
22105 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22106 }
22107 }
22108
22109 1 => {
22110 if let Some(source_name) = &self.source_name {
22111 ::fidl_next::WireEnvelope::encode_value(
22112 source_name,
22113 preallocated.encoder,
22114 &mut out,
22115 )?;
22116 } else {
22117 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22118 }
22119 }
22120
22121 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22122 }
22123 unsafe {
22124 preallocated.write_next(out.assume_init_ref());
22125 }
22126 }
22127
22128 ::fidl_next::WireTable::encode_len(table, max_ord);
22129
22130 Ok(())
22131 }
22132}
22133
22134impl ::fidl_next::TakeFrom<WireRunnerRegistration> for RunnerRegistration {
22135 #[inline]
22136 fn take_from(from: &WireRunnerRegistration) -> Self {
22137 Self {
22138 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
22139
22140 source: from.source().map(::fidl_next::TakeFrom::take_from),
22141
22142 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
22143 }
22144 }
22145}
22146
22147#[repr(C)]
22149pub struct WireRunnerRegistration {
22150 table: ::fidl_next::WireTable,
22151}
22152
22153unsafe impl ::fidl_next::ZeroPadding for WireRunnerRegistration {
22154 #[inline]
22155 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
22156 ::fidl_next::munge!(let Self { table } = out);
22157 ::fidl_next::WireTable::zero_padding(table);
22158 }
22159}
22160
22161unsafe impl<___D> ::fidl_next::Decode<___D> for WireRunnerRegistration
22162where
22163 ___D: ::fidl_next::Decoder + ?Sized,
22164{
22165 fn decode(
22166 slot: ::fidl_next::Slot<'_, Self>,
22167 decoder: &mut ___D,
22168 ) -> Result<(), ::fidl_next::DecodeError> {
22169 ::fidl_next::munge!(let Self { table } = slot);
22170
22171 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
22172 match ordinal {
22173 0 => unsafe { ::core::hint::unreachable_unchecked() },
22174
22175 1 => {
22176 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
22177 slot.as_mut(),
22178 decoder,
22179 )?;
22180
22181 let source_name = unsafe {
22182 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
22183 };
22184
22185 if source_name.len() > 100 {
22186 return Err(::fidl_next::DecodeError::VectorTooLong {
22187 size: source_name.len() as u64,
22188 limit: 100,
22189 });
22190 }
22191
22192 Ok(())
22193 }
22194
22195 2 => {
22196 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
22197 slot.as_mut(),
22198 decoder,
22199 )?;
22200
22201 Ok(())
22202 }
22203
22204 3 => {
22205 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
22206 slot.as_mut(),
22207 decoder,
22208 )?;
22209
22210 let target_name = unsafe {
22211 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
22212 };
22213
22214 if target_name.len() > 100 {
22215 return Err(::fidl_next::DecodeError::VectorTooLong {
22216 size: target_name.len() as u64,
22217 limit: 100,
22218 });
22219 }
22220
22221 Ok(())
22222 }
22223
22224 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
22225 }
22226 })
22227 }
22228}
22229
22230impl WireRunnerRegistration {
22231 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
22232 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
22233 }
22234
22235 pub fn source(&self) -> Option<&crate::WireRef> {
22236 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
22237 }
22238
22239 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
22240 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
22241 }
22242}
22243
22244impl ::core::fmt::Debug for WireRunnerRegistration {
22245 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
22246 f.debug_struct("RunnerRegistration")
22247 .field("source_name", &self.source_name())
22248 .field("source", &self.source())
22249 .field("target_name", &self.target_name())
22250 .finish()
22251 }
22252}
22253
22254#[doc = " A mapping of URL scheme to resolver name.\n"]
22255#[derive(Clone, Debug, Default)]
22256pub struct ResolverRegistration {
22257 pub resolver: Option<String>,
22258
22259 pub source: Option<crate::Ref>,
22260
22261 pub scheme: Option<String>,
22262}
22263
22264impl ResolverRegistration {
22265 fn __max_ordinal(&self) -> usize {
22266 if self.resolver.is_some() {
22267 return 1;
22268 }
22269
22270 if self.source.is_some() {
22271 return 2;
22272 }
22273
22274 if self.scheme.is_some() {
22275 return 3;
22276 }
22277
22278 0
22279 }
22280}
22281
22282impl ::fidl_next::Encodable for ResolverRegistration {
22283 type Encoded = WireResolverRegistration;
22284}
22285
22286unsafe impl<___E> ::fidl_next::Encode<___E> for ResolverRegistration
22287where
22288 ___E: ::fidl_next::Encoder + ?Sized,
22289{
22290 #[inline]
22291 fn encode(
22292 mut self,
22293 encoder: &mut ___E,
22294 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22295 ) -> Result<(), ::fidl_next::EncodeError> {
22296 ::fidl_next::munge!(let WireResolverRegistration { table } = out);
22297
22298 let max_ord = self.__max_ordinal();
22299
22300 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
22301 ::fidl_next::ZeroPadding::zero_padding(&mut out);
22302
22303 let mut preallocated =
22304 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
22305
22306 for i in 1..=max_ord {
22307 match i {
22308 3 => {
22309 if let Some(scheme) = self.scheme.take() {
22310 ::fidl_next::WireEnvelope::encode_value(
22311 scheme,
22312 preallocated.encoder,
22313 &mut out,
22314 )?;
22315 } else {
22316 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22317 }
22318 }
22319
22320 2 => {
22321 if let Some(source) = self.source.take() {
22322 ::fidl_next::WireEnvelope::encode_value(
22323 source,
22324 preallocated.encoder,
22325 &mut out,
22326 )?;
22327 } else {
22328 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22329 }
22330 }
22331
22332 1 => {
22333 if let Some(resolver) = self.resolver.take() {
22334 ::fidl_next::WireEnvelope::encode_value(
22335 resolver,
22336 preallocated.encoder,
22337 &mut out,
22338 )?;
22339 } else {
22340 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22341 }
22342 }
22343
22344 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22345 }
22346 unsafe {
22347 preallocated.write_next(out.assume_init_ref());
22348 }
22349 }
22350
22351 ::fidl_next::WireTable::encode_len(table, max_ord);
22352
22353 Ok(())
22354 }
22355}
22356
22357unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolverRegistration
22358where
22359 ___E: ::fidl_next::Encoder + ?Sized,
22360{
22361 #[inline]
22362 fn encode_ref(
22363 &self,
22364 encoder: &mut ___E,
22365 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22366 ) -> Result<(), ::fidl_next::EncodeError> {
22367 ::fidl_next::munge!(let WireResolverRegistration { table } = out);
22368
22369 let max_ord = self.__max_ordinal();
22370
22371 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
22372 ::fidl_next::ZeroPadding::zero_padding(&mut out);
22373
22374 let mut preallocated =
22375 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
22376
22377 for i in 1..=max_ord {
22378 match i {
22379 3 => {
22380 if let Some(scheme) = &self.scheme {
22381 ::fidl_next::WireEnvelope::encode_value(
22382 scheme,
22383 preallocated.encoder,
22384 &mut out,
22385 )?;
22386 } else {
22387 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22388 }
22389 }
22390
22391 2 => {
22392 if let Some(source) = &self.source {
22393 ::fidl_next::WireEnvelope::encode_value(
22394 source,
22395 preallocated.encoder,
22396 &mut out,
22397 )?;
22398 } else {
22399 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22400 }
22401 }
22402
22403 1 => {
22404 if let Some(resolver) = &self.resolver {
22405 ::fidl_next::WireEnvelope::encode_value(
22406 resolver,
22407 preallocated.encoder,
22408 &mut out,
22409 )?;
22410 } else {
22411 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22412 }
22413 }
22414
22415 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22416 }
22417 unsafe {
22418 preallocated.write_next(out.assume_init_ref());
22419 }
22420 }
22421
22422 ::fidl_next::WireTable::encode_len(table, max_ord);
22423
22424 Ok(())
22425 }
22426}
22427
22428impl ::fidl_next::TakeFrom<WireResolverRegistration> for ResolverRegistration {
22429 #[inline]
22430 fn take_from(from: &WireResolverRegistration) -> Self {
22431 Self {
22432 resolver: from.resolver().map(::fidl_next::TakeFrom::take_from),
22433
22434 source: from.source().map(::fidl_next::TakeFrom::take_from),
22435
22436 scheme: from.scheme().map(::fidl_next::TakeFrom::take_from),
22437 }
22438 }
22439}
22440
22441#[repr(C)]
22443pub struct WireResolverRegistration {
22444 table: ::fidl_next::WireTable,
22445}
22446
22447unsafe impl ::fidl_next::ZeroPadding for WireResolverRegistration {
22448 #[inline]
22449 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
22450 ::fidl_next::munge!(let Self { table } = out);
22451 ::fidl_next::WireTable::zero_padding(table);
22452 }
22453}
22454
22455unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolverRegistration
22456where
22457 ___D: ::fidl_next::Decoder + ?Sized,
22458{
22459 fn decode(
22460 slot: ::fidl_next::Slot<'_, Self>,
22461 decoder: &mut ___D,
22462 ) -> Result<(), ::fidl_next::DecodeError> {
22463 ::fidl_next::munge!(let Self { table } = slot);
22464
22465 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
22466 match ordinal {
22467 0 => unsafe { ::core::hint::unreachable_unchecked() },
22468
22469 1 => {
22470 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
22471 slot.as_mut(),
22472 decoder,
22473 )?;
22474
22475 let resolver = unsafe {
22476 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
22477 };
22478
22479 if resolver.len() > 100 {
22480 return Err(::fidl_next::DecodeError::VectorTooLong {
22481 size: resolver.len() as u64,
22482 limit: 100,
22483 });
22484 }
22485
22486 Ok(())
22487 }
22488
22489 2 => {
22490 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
22491 slot.as_mut(),
22492 decoder,
22493 )?;
22494
22495 Ok(())
22496 }
22497
22498 3 => {
22499 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
22500 slot.as_mut(),
22501 decoder,
22502 )?;
22503
22504 let scheme = unsafe {
22505 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
22506 };
22507
22508 if scheme.len() > 100 {
22509 return Err(::fidl_next::DecodeError::VectorTooLong {
22510 size: scheme.len() as u64,
22511 limit: 100,
22512 });
22513 }
22514
22515 Ok(())
22516 }
22517
22518 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
22519 }
22520 })
22521 }
22522}
22523
22524impl WireResolverRegistration {
22525 pub fn resolver(&self) -> Option<&::fidl_next::WireString> {
22526 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
22527 }
22528
22529 pub fn source(&self) -> Option<&crate::WireRef> {
22530 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
22531 }
22532
22533 pub fn scheme(&self) -> Option<&::fidl_next::WireString> {
22534 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
22535 }
22536}
22537
22538impl ::core::fmt::Debug for WireResolverRegistration {
22539 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
22540 f.debug_struct("ResolverRegistration")
22541 .field("resolver", &self.resolver())
22542 .field("source", &self.source())
22543 .field("scheme", &self.scheme())
22544 .finish()
22545 }
22546}
22547
22548#[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"]
22549#[derive(Clone, Debug, Default)]
22550pub struct DebugProtocolRegistration {
22551 pub source: Option<crate::Ref>,
22552
22553 pub source_name: Option<String>,
22554
22555 pub target_name: Option<String>,
22556}
22557
22558impl DebugProtocolRegistration {
22559 fn __max_ordinal(&self) -> usize {
22560 if self.source.is_some() {
22561 return 1;
22562 }
22563
22564 if self.source_name.is_some() {
22565 return 2;
22566 }
22567
22568 if self.target_name.is_some() {
22569 return 3;
22570 }
22571
22572 0
22573 }
22574}
22575
22576impl ::fidl_next::Encodable for DebugProtocolRegistration {
22577 type Encoded = WireDebugProtocolRegistration;
22578}
22579
22580unsafe impl<___E> ::fidl_next::Encode<___E> for DebugProtocolRegistration
22581where
22582 ___E: ::fidl_next::Encoder + ?Sized,
22583{
22584 #[inline]
22585 fn encode(
22586 mut self,
22587 encoder: &mut ___E,
22588 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22589 ) -> Result<(), ::fidl_next::EncodeError> {
22590 ::fidl_next::munge!(let WireDebugProtocolRegistration { table } = out);
22591
22592 let max_ord = self.__max_ordinal();
22593
22594 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
22595 ::fidl_next::ZeroPadding::zero_padding(&mut out);
22596
22597 let mut preallocated =
22598 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
22599
22600 for i in 1..=max_ord {
22601 match i {
22602 3 => {
22603 if let Some(target_name) = self.target_name.take() {
22604 ::fidl_next::WireEnvelope::encode_value(
22605 target_name,
22606 preallocated.encoder,
22607 &mut out,
22608 )?;
22609 } else {
22610 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22611 }
22612 }
22613
22614 2 => {
22615 if let Some(source_name) = self.source_name.take() {
22616 ::fidl_next::WireEnvelope::encode_value(
22617 source_name,
22618 preallocated.encoder,
22619 &mut out,
22620 )?;
22621 } else {
22622 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22623 }
22624 }
22625
22626 1 => {
22627 if let Some(source) = self.source.take() {
22628 ::fidl_next::WireEnvelope::encode_value(
22629 source,
22630 preallocated.encoder,
22631 &mut out,
22632 )?;
22633 } else {
22634 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22635 }
22636 }
22637
22638 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22639 }
22640 unsafe {
22641 preallocated.write_next(out.assume_init_ref());
22642 }
22643 }
22644
22645 ::fidl_next::WireTable::encode_len(table, max_ord);
22646
22647 Ok(())
22648 }
22649}
22650
22651unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DebugProtocolRegistration
22652where
22653 ___E: ::fidl_next::Encoder + ?Sized,
22654{
22655 #[inline]
22656 fn encode_ref(
22657 &self,
22658 encoder: &mut ___E,
22659 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22660 ) -> Result<(), ::fidl_next::EncodeError> {
22661 ::fidl_next::munge!(let WireDebugProtocolRegistration { table } = out);
22662
22663 let max_ord = self.__max_ordinal();
22664
22665 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
22666 ::fidl_next::ZeroPadding::zero_padding(&mut out);
22667
22668 let mut preallocated =
22669 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
22670
22671 for i in 1..=max_ord {
22672 match i {
22673 3 => {
22674 if let Some(target_name) = &self.target_name {
22675 ::fidl_next::WireEnvelope::encode_value(
22676 target_name,
22677 preallocated.encoder,
22678 &mut out,
22679 )?;
22680 } else {
22681 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22682 }
22683 }
22684
22685 2 => {
22686 if let Some(source_name) = &self.source_name {
22687 ::fidl_next::WireEnvelope::encode_value(
22688 source_name,
22689 preallocated.encoder,
22690 &mut out,
22691 )?;
22692 } else {
22693 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22694 }
22695 }
22696
22697 1 => {
22698 if let Some(source) = &self.source {
22699 ::fidl_next::WireEnvelope::encode_value(
22700 source,
22701 preallocated.encoder,
22702 &mut out,
22703 )?;
22704 } else {
22705 ::fidl_next::WireEnvelope::encode_zero(&mut out)
22706 }
22707 }
22708
22709 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
22710 }
22711 unsafe {
22712 preallocated.write_next(out.assume_init_ref());
22713 }
22714 }
22715
22716 ::fidl_next::WireTable::encode_len(table, max_ord);
22717
22718 Ok(())
22719 }
22720}
22721
22722impl ::fidl_next::TakeFrom<WireDebugProtocolRegistration> for DebugProtocolRegistration {
22723 #[inline]
22724 fn take_from(from: &WireDebugProtocolRegistration) -> Self {
22725 Self {
22726 source: from.source().map(::fidl_next::TakeFrom::take_from),
22727
22728 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
22729
22730 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
22731 }
22732 }
22733}
22734
22735#[repr(C)]
22737pub struct WireDebugProtocolRegistration {
22738 table: ::fidl_next::WireTable,
22739}
22740
22741unsafe impl ::fidl_next::ZeroPadding for WireDebugProtocolRegistration {
22742 #[inline]
22743 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
22744 ::fidl_next::munge!(let Self { table } = out);
22745 ::fidl_next::WireTable::zero_padding(table);
22746 }
22747}
22748
22749unsafe impl<___D> ::fidl_next::Decode<___D> for WireDebugProtocolRegistration
22750where
22751 ___D: ::fidl_next::Decoder + ?Sized,
22752{
22753 fn decode(
22754 slot: ::fidl_next::Slot<'_, Self>,
22755 decoder: &mut ___D,
22756 ) -> Result<(), ::fidl_next::DecodeError> {
22757 ::fidl_next::munge!(let Self { table } = slot);
22758
22759 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
22760 match ordinal {
22761 0 => unsafe { ::core::hint::unreachable_unchecked() },
22762
22763 1 => {
22764 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireRef>(
22765 slot.as_mut(),
22766 decoder,
22767 )?;
22768
22769 Ok(())
22770 }
22771
22772 2 => {
22773 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
22774 slot.as_mut(),
22775 decoder,
22776 )?;
22777
22778 let source_name = unsafe {
22779 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
22780 };
22781
22782 if source_name.len() > 100 {
22783 return Err(::fidl_next::DecodeError::VectorTooLong {
22784 size: source_name.len() as u64,
22785 limit: 100,
22786 });
22787 }
22788
22789 Ok(())
22790 }
22791
22792 3 => {
22793 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
22794 slot.as_mut(),
22795 decoder,
22796 )?;
22797
22798 let target_name = unsafe {
22799 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
22800 };
22801
22802 if target_name.len() > 100 {
22803 return Err(::fidl_next::DecodeError::VectorTooLong {
22804 size: target_name.len() as u64,
22805 limit: 100,
22806 });
22807 }
22808
22809 Ok(())
22810 }
22811
22812 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
22813 }
22814 })
22815 }
22816}
22817
22818impl WireDebugProtocolRegistration {
22819 pub fn source(&self) -> Option<&crate::WireRef> {
22820 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
22821 }
22822
22823 pub fn source_name(&self) -> Option<&::fidl_next::WireString> {
22824 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
22825 }
22826
22827 pub fn target_name(&self) -> Option<&::fidl_next::WireString> {
22828 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
22829 }
22830}
22831
22832impl ::core::fmt::Debug for WireDebugProtocolRegistration {
22833 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
22834 f.debug_struct("DebugProtocolRegistration")
22835 .field("source", &self.source())
22836 .field("source_name", &self.source_name())
22837 .field("target_name", &self.target_name())
22838 .finish()
22839 }
22840}
22841
22842#[doc = " Declares a capability registered in the debug section of an environment.\n"]
22843#[derive(Clone, Debug)]
22844pub enum DebugRegistration {
22845 Protocol(crate::DebugProtocolRegistration),
22846
22847 UnknownOrdinal_(u64),
22848}
22849
22850impl ::fidl_next::Encodable for DebugRegistration {
22851 type Encoded = WireDebugRegistration;
22852}
22853
22854unsafe impl<___E> ::fidl_next::Encode<___E> for DebugRegistration
22855where
22856 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
22857
22858 ___E: ::fidl_next::Encoder,
22859{
22860 #[inline]
22861 fn encode(
22862 self,
22863 encoder: &mut ___E,
22864 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22865 ) -> Result<(), ::fidl_next::EncodeError> {
22866 ::fidl_next::munge!(let WireDebugRegistration { raw } = out);
22867
22868 match self {
22869 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
22870 ___E,
22871 crate::DebugProtocolRegistration,
22872 >(value, 1, encoder, raw)?,
22873
22874 Self::UnknownOrdinal_(ordinal) => {
22875 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
22876 }
22877 }
22878
22879 Ok(())
22880 }
22881}
22882
22883unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DebugRegistration
22884where
22885 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
22886
22887 ___E: ::fidl_next::Encoder,
22888{
22889 #[inline]
22890 fn encode_ref(
22891 &self,
22892 encoder: &mut ___E,
22893 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
22894 ) -> Result<(), ::fidl_next::EncodeError> {
22895 ::fidl_next::munge!(let WireDebugRegistration { raw } = out);
22896
22897 match self {
22898 Self::Protocol(value) => ::fidl_next::RawWireUnion::encode_as::<
22899 ___E,
22900 &crate::DebugProtocolRegistration,
22901 >(value, 1, encoder, raw)?,
22902
22903 Self::UnknownOrdinal_(ordinal) => {
22904 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
22905 }
22906 }
22907
22908 Ok(())
22909 }
22910}
22911
22912impl ::fidl_next::EncodableOption for Box<DebugRegistration> {
22913 type EncodedOption = WireOptionalDebugRegistration;
22914}
22915
22916unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<DebugRegistration>
22917where
22918 ___E: ?Sized,
22919 DebugRegistration: ::fidl_next::Encode<___E>,
22920{
22921 #[inline]
22922 fn encode_option(
22923 this: Option<Self>,
22924 encoder: &mut ___E,
22925 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
22926 ) -> Result<(), ::fidl_next::EncodeError> {
22927 ::fidl_next::munge!(let WireOptionalDebugRegistration { raw } = &mut *out);
22928
22929 if let Some(inner) = this {
22930 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
22931 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
22932 } else {
22933 ::fidl_next::RawWireUnion::encode_absent(raw);
22934 }
22935
22936 Ok(())
22937 }
22938}
22939
22940unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<DebugRegistration>
22941where
22942 ___E: ?Sized,
22943 DebugRegistration: ::fidl_next::EncodeRef<___E>,
22944{
22945 #[inline]
22946 fn encode_option_ref(
22947 this: Option<&Self>,
22948 encoder: &mut ___E,
22949 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
22950 ) -> Result<(), ::fidl_next::EncodeError> {
22951 ::fidl_next::munge!(let WireOptionalDebugRegistration { raw } = &mut *out);
22952
22953 if let Some(inner) = this {
22954 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
22955 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
22956 } else {
22957 ::fidl_next::RawWireUnion::encode_absent(raw);
22958 }
22959
22960 Ok(())
22961 }
22962}
22963
22964impl ::fidl_next::TakeFrom<WireDebugRegistration> for DebugRegistration {
22965 #[inline]
22966 fn take_from(from: &WireDebugRegistration) -> Self {
22967 match from.raw.ordinal() {
22968 1 => Self::Protocol(::fidl_next::TakeFrom::take_from(unsafe {
22969 from.raw.get().deref_unchecked::<crate::WireDebugProtocolRegistration>()
22970 })),
22971
22972 _ => unsafe { ::core::hint::unreachable_unchecked() },
22973 }
22974 }
22975}
22976
22977impl ::fidl_next::TakeFrom<WireOptionalDebugRegistration> for Option<Box<DebugRegistration>> {
22978 #[inline]
22979 fn take_from(from: &WireOptionalDebugRegistration) -> Self {
22980 if let Some(inner) = from.as_ref() {
22981 Some(::fidl_next::TakeFrom::take_from(inner))
22982 } else {
22983 None
22984 }
22985 }
22986}
22987
22988#[repr(transparent)]
22990pub struct WireDebugRegistration {
22991 raw: ::fidl_next::RawWireUnion,
22992}
22993
22994unsafe impl ::fidl_next::ZeroPadding for WireDebugRegistration {
22995 #[inline]
22996 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
22997 ::fidl_next::munge!(let Self { raw } = out);
22998 ::fidl_next::RawWireUnion::zero_padding(raw);
22999 }
23000}
23001
23002pub mod debug_registration {
23003 pub enum Ref<'union> {
23004 Protocol(&'union crate::WireDebugProtocolRegistration),
23005
23006 UnknownOrdinal_(u64),
23007 }
23008}
23009
23010impl WireDebugRegistration {
23011 pub fn as_ref(&self) -> crate::debug_registration::Ref<'_> {
23012 match self.raw.ordinal() {
23013 1 => crate::debug_registration::Ref::Protocol(unsafe {
23014 self.raw.get().deref_unchecked::<crate::WireDebugProtocolRegistration>()
23015 }),
23016
23017 unknown => crate::debug_registration::Ref::UnknownOrdinal_(unknown),
23018 }
23019 }
23020}
23021
23022unsafe impl<___D> ::fidl_next::Decode<___D> for WireDebugRegistration
23023where
23024 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
23025
23026 ___D: ::fidl_next::Decoder,
23027{
23028 fn decode(
23029 mut slot: ::fidl_next::Slot<'_, Self>,
23030 decoder: &mut ___D,
23031 ) -> Result<(), ::fidl_next::DecodeError> {
23032 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
23033 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
23034 1 => {
23035 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDebugProtocolRegistration>(
23036 raw, decoder,
23037 )?
23038 }
23039
23040 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
23041 }
23042
23043 Ok(())
23044 }
23045}
23046
23047impl ::core::fmt::Debug for WireDebugRegistration {
23048 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
23049 match self.raw.ordinal() {
23050 1 => unsafe {
23051 self.raw.get().deref_unchecked::<crate::WireDebugProtocolRegistration>().fmt(f)
23052 },
23053 _ => unsafe { ::core::hint::unreachable_unchecked() },
23054 }
23055 }
23056}
23057
23058#[repr(transparent)]
23059pub struct WireOptionalDebugRegistration {
23060 raw: ::fidl_next::RawWireUnion,
23061}
23062
23063unsafe impl ::fidl_next::ZeroPadding for WireOptionalDebugRegistration {
23064 #[inline]
23065 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
23066 ::fidl_next::munge!(let Self { raw } = out);
23067 ::fidl_next::RawWireUnion::zero_padding(raw);
23068 }
23069}
23070
23071impl WireOptionalDebugRegistration {
23072 pub fn is_some(&self) -> bool {
23073 self.raw.is_some()
23074 }
23075
23076 pub fn is_none(&self) -> bool {
23077 self.raw.is_none()
23078 }
23079
23080 pub fn as_ref(&self) -> Option<&WireDebugRegistration> {
23081 if self.is_some() {
23082 Some(unsafe { &*(self as *const Self).cast() })
23083 } else {
23084 None
23085 }
23086 }
23087}
23088
23089unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalDebugRegistration
23090where
23091 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
23092
23093 ___D: ::fidl_next::Decoder,
23094{
23095 fn decode(
23096 mut slot: ::fidl_next::Slot<'_, Self>,
23097 decoder: &mut ___D,
23098 ) -> Result<(), ::fidl_next::DecodeError> {
23099 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
23100 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
23101 1 => {
23102 ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireDebugProtocolRegistration>(
23103 raw, decoder,
23104 )?
23105 }
23106
23107 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
23108 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
23109 }
23110
23111 Ok(())
23112 }
23113}
23114
23115impl ::core::fmt::Debug for WireOptionalDebugRegistration {
23116 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
23117 self.as_ref().fmt(f)
23118 }
23119}
23120
23121#[doc = " Declares an environment which configures a realm.\n"]
23122#[derive(Clone, Debug, Default)]
23123pub struct Environment {
23124 pub name: Option<String>,
23125
23126 pub extends: Option<crate::EnvironmentExtends>,
23127
23128 pub runners: Option<Vec<crate::RunnerRegistration>>,
23129
23130 pub resolvers: Option<Vec<crate::ResolverRegistration>>,
23131
23132 pub debug_capabilities: Option<Vec<crate::DebugRegistration>>,
23133
23134 pub stop_timeout_ms: Option<u32>,
23135}
23136
23137impl Environment {
23138 fn __max_ordinal(&self) -> usize {
23139 if self.name.is_some() {
23140 return 1;
23141 }
23142
23143 if self.extends.is_some() {
23144 return 2;
23145 }
23146
23147 if self.runners.is_some() {
23148 return 3;
23149 }
23150
23151 if self.resolvers.is_some() {
23152 return 4;
23153 }
23154
23155 if self.debug_capabilities.is_some() {
23156 return 5;
23157 }
23158
23159 if self.stop_timeout_ms.is_some() {
23160 return 6;
23161 }
23162
23163 0
23164 }
23165}
23166
23167impl ::fidl_next::Encodable for Environment {
23168 type Encoded = WireEnvironment;
23169}
23170
23171unsafe impl<___E> ::fidl_next::Encode<___E> for Environment
23172where
23173 ___E: ::fidl_next::Encoder + ?Sized,
23174{
23175 #[inline]
23176 fn encode(
23177 mut self,
23178 encoder: &mut ___E,
23179 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23180 ) -> Result<(), ::fidl_next::EncodeError> {
23181 ::fidl_next::munge!(let WireEnvironment { table } = out);
23182
23183 let max_ord = self.__max_ordinal();
23184
23185 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
23186 ::fidl_next::ZeroPadding::zero_padding(&mut out);
23187
23188 let mut preallocated =
23189 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
23190
23191 for i in 1..=max_ord {
23192 match i {
23193 6 => {
23194 if let Some(stop_timeout_ms) = self.stop_timeout_ms.take() {
23195 ::fidl_next::WireEnvelope::encode_value(
23196 stop_timeout_ms,
23197 preallocated.encoder,
23198 &mut out,
23199 )?;
23200 } else {
23201 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23202 }
23203 }
23204
23205 5 => {
23206 if let Some(debug_capabilities) = self.debug_capabilities.take() {
23207 ::fidl_next::WireEnvelope::encode_value(
23208 debug_capabilities,
23209 preallocated.encoder,
23210 &mut out,
23211 )?;
23212 } else {
23213 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23214 }
23215 }
23216
23217 4 => {
23218 if let Some(resolvers) = self.resolvers.take() {
23219 ::fidl_next::WireEnvelope::encode_value(
23220 resolvers,
23221 preallocated.encoder,
23222 &mut out,
23223 )?;
23224 } else {
23225 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23226 }
23227 }
23228
23229 3 => {
23230 if let Some(runners) = self.runners.take() {
23231 ::fidl_next::WireEnvelope::encode_value(
23232 runners,
23233 preallocated.encoder,
23234 &mut out,
23235 )?;
23236 } else {
23237 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23238 }
23239 }
23240
23241 2 => {
23242 if let Some(extends) = self.extends.take() {
23243 ::fidl_next::WireEnvelope::encode_value(
23244 extends,
23245 preallocated.encoder,
23246 &mut out,
23247 )?;
23248 } else {
23249 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23250 }
23251 }
23252
23253 1 => {
23254 if let Some(name) = self.name.take() {
23255 ::fidl_next::WireEnvelope::encode_value(
23256 name,
23257 preallocated.encoder,
23258 &mut out,
23259 )?;
23260 } else {
23261 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23262 }
23263 }
23264
23265 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
23266 }
23267 unsafe {
23268 preallocated.write_next(out.assume_init_ref());
23269 }
23270 }
23271
23272 ::fidl_next::WireTable::encode_len(table, max_ord);
23273
23274 Ok(())
23275 }
23276}
23277
23278unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Environment
23279where
23280 ___E: ::fidl_next::Encoder + ?Sized,
23281{
23282 #[inline]
23283 fn encode_ref(
23284 &self,
23285 encoder: &mut ___E,
23286 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23287 ) -> Result<(), ::fidl_next::EncodeError> {
23288 ::fidl_next::munge!(let WireEnvironment { table } = out);
23289
23290 let max_ord = self.__max_ordinal();
23291
23292 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
23293 ::fidl_next::ZeroPadding::zero_padding(&mut out);
23294
23295 let mut preallocated =
23296 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
23297
23298 for i in 1..=max_ord {
23299 match i {
23300 6 => {
23301 if let Some(stop_timeout_ms) = &self.stop_timeout_ms {
23302 ::fidl_next::WireEnvelope::encode_value(
23303 stop_timeout_ms,
23304 preallocated.encoder,
23305 &mut out,
23306 )?;
23307 } else {
23308 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23309 }
23310 }
23311
23312 5 => {
23313 if let Some(debug_capabilities) = &self.debug_capabilities {
23314 ::fidl_next::WireEnvelope::encode_value(
23315 debug_capabilities,
23316 preallocated.encoder,
23317 &mut out,
23318 )?;
23319 } else {
23320 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23321 }
23322 }
23323
23324 4 => {
23325 if let Some(resolvers) = &self.resolvers {
23326 ::fidl_next::WireEnvelope::encode_value(
23327 resolvers,
23328 preallocated.encoder,
23329 &mut out,
23330 )?;
23331 } else {
23332 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23333 }
23334 }
23335
23336 3 => {
23337 if let Some(runners) = &self.runners {
23338 ::fidl_next::WireEnvelope::encode_value(
23339 runners,
23340 preallocated.encoder,
23341 &mut out,
23342 )?;
23343 } else {
23344 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23345 }
23346 }
23347
23348 2 => {
23349 if let Some(extends) = &self.extends {
23350 ::fidl_next::WireEnvelope::encode_value(
23351 extends,
23352 preallocated.encoder,
23353 &mut out,
23354 )?;
23355 } else {
23356 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23357 }
23358 }
23359
23360 1 => {
23361 if let Some(name) = &self.name {
23362 ::fidl_next::WireEnvelope::encode_value(
23363 name,
23364 preallocated.encoder,
23365 &mut out,
23366 )?;
23367 } else {
23368 ::fidl_next::WireEnvelope::encode_zero(&mut out)
23369 }
23370 }
23371
23372 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
23373 }
23374 unsafe {
23375 preallocated.write_next(out.assume_init_ref());
23376 }
23377 }
23378
23379 ::fidl_next::WireTable::encode_len(table, max_ord);
23380
23381 Ok(())
23382 }
23383}
23384
23385impl ::fidl_next::TakeFrom<WireEnvironment> for Environment {
23386 #[inline]
23387 fn take_from(from: &WireEnvironment) -> Self {
23388 Self {
23389 name: from.name().map(::fidl_next::TakeFrom::take_from),
23390
23391 extends: from.extends().map(::fidl_next::TakeFrom::take_from),
23392
23393 runners: from.runners().map(::fidl_next::TakeFrom::take_from),
23394
23395 resolvers: from.resolvers().map(::fidl_next::TakeFrom::take_from),
23396
23397 debug_capabilities: from.debug_capabilities().map(::fidl_next::TakeFrom::take_from),
23398
23399 stop_timeout_ms: from.stop_timeout_ms().map(::fidl_next::TakeFrom::take_from),
23400 }
23401 }
23402}
23403
23404#[repr(C)]
23406pub struct WireEnvironment {
23407 table: ::fidl_next::WireTable,
23408}
23409
23410unsafe impl ::fidl_next::ZeroPadding for WireEnvironment {
23411 #[inline]
23412 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
23413 ::fidl_next::munge!(let Self { table } = out);
23414 ::fidl_next::WireTable::zero_padding(table);
23415 }
23416}
23417
23418unsafe impl<___D> ::fidl_next::Decode<___D> for WireEnvironment
23419where
23420 ___D: ::fidl_next::Decoder + ?Sized,
23421{
23422 fn decode(
23423 slot: ::fidl_next::Slot<'_, Self>,
23424 decoder: &mut ___D,
23425 ) -> Result<(), ::fidl_next::DecodeError> {
23426 ::fidl_next::munge!(let Self { table } = slot);
23427
23428 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
23429 match ordinal {
23430 0 => unsafe { ::core::hint::unreachable_unchecked() },
23431
23432 1 => {
23433 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
23434 slot.as_mut(),
23435 decoder,
23436 )?;
23437
23438 let name = unsafe {
23439 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
23440 };
23441
23442 if name.len() > 100 {
23443 return Err(::fidl_next::DecodeError::VectorTooLong {
23444 size: name.len() as u64,
23445 limit: 100,
23446 });
23447 }
23448
23449 Ok(())
23450 }
23451
23452 2 => {
23453 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireEnvironmentExtends>(
23454 slot.as_mut(),
23455 decoder,
23456 )?;
23457
23458 Ok(())
23459 }
23460
23461 3 => {
23462 ::fidl_next::WireEnvelope::decode_as::<
23463 ___D,
23464 ::fidl_next::WireVector<crate::WireRunnerRegistration>,
23465 >(slot.as_mut(), decoder)?;
23466
23467 Ok(())
23468 }
23469
23470 4 => {
23471 ::fidl_next::WireEnvelope::decode_as::<
23472 ___D,
23473 ::fidl_next::WireVector<crate::WireResolverRegistration>,
23474 >(slot.as_mut(), decoder)?;
23475
23476 Ok(())
23477 }
23478
23479 5 => {
23480 ::fidl_next::WireEnvelope::decode_as::<
23481 ___D,
23482 ::fidl_next::WireVector<crate::WireDebugRegistration>,
23483 >(slot.as_mut(), decoder)?;
23484
23485 Ok(())
23486 }
23487
23488 6 => {
23489 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireU32>(
23490 slot.as_mut(),
23491 decoder,
23492 )?;
23493
23494 Ok(())
23495 }
23496
23497 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
23498 }
23499 })
23500 }
23501}
23502
23503impl WireEnvironment {
23504 pub fn name(&self) -> Option<&::fidl_next::WireString> {
23505 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
23506 }
23507
23508 pub fn extends(&self) -> Option<&crate::WireEnvironmentExtends> {
23509 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
23510 }
23511
23512 pub fn runners(&self) -> Option<&::fidl_next::WireVector<crate::WireRunnerRegistration>> {
23513 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
23514 }
23515
23516 pub fn resolvers(&self) -> Option<&::fidl_next::WireVector<crate::WireResolverRegistration>> {
23517 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
23518 }
23519
23520 pub fn debug_capabilities(
23521 &self,
23522 ) -> Option<&::fidl_next::WireVector<crate::WireDebugRegistration>> {
23523 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
23524 }
23525
23526 pub fn stop_timeout_ms(&self) -> Option<&::fidl_next::WireU32> {
23527 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
23528 }
23529}
23530
23531impl ::core::fmt::Debug for WireEnvironment {
23532 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
23533 f.debug_struct("Environment")
23534 .field("name", &self.name())
23535 .field("extends", &self.extends())
23536 .field("runners", &self.runners())
23537 .field("resolvers", &self.resolvers())
23538 .field("debug_capabilities", &self.debug_capabilities())
23539 .field("stop_timeout_ms", &self.stop_timeout_ms())
23540 .finish()
23541 }
23542}
23543
23544#[derive(Clone, Debug, Default)]
23545pub struct ConfigSourceCapabilities {}
23546
23547impl ConfigSourceCapabilities {
23548 fn __max_ordinal(&self) -> usize {
23549 0
23550 }
23551}
23552
23553impl ::fidl_next::Encodable for ConfigSourceCapabilities {
23554 type Encoded = WireConfigSourceCapabilities;
23555}
23556
23557unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigSourceCapabilities
23558where
23559 ___E: ::fidl_next::Encoder + ?Sized,
23560{
23561 #[inline]
23562 fn encode(
23563 mut self,
23564 encoder: &mut ___E,
23565 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23566 ) -> Result<(), ::fidl_next::EncodeError> {
23567 ::fidl_next::munge!(let WireConfigSourceCapabilities { table } = out);
23568
23569 let max_ord = self.__max_ordinal();
23570
23571 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
23572 ::fidl_next::ZeroPadding::zero_padding(&mut out);
23573
23574 let mut preallocated =
23575 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
23576
23577 for i in 1..=max_ord {
23578 match i {
23579 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
23580 }
23581 unsafe {
23582 preallocated.write_next(out.assume_init_ref());
23583 }
23584 }
23585
23586 ::fidl_next::WireTable::encode_len(table, max_ord);
23587
23588 Ok(())
23589 }
23590}
23591
23592unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigSourceCapabilities
23593where
23594 ___E: ::fidl_next::Encoder + ?Sized,
23595{
23596 #[inline]
23597 fn encode_ref(
23598 &self,
23599 encoder: &mut ___E,
23600 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23601 ) -> Result<(), ::fidl_next::EncodeError> {
23602 ::fidl_next::munge!(let WireConfigSourceCapabilities { table } = out);
23603
23604 let max_ord = self.__max_ordinal();
23605
23606 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
23607 ::fidl_next::ZeroPadding::zero_padding(&mut out);
23608
23609 let mut preallocated =
23610 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
23611
23612 for i in 1..=max_ord {
23613 match i {
23614 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
23615 }
23616 unsafe {
23617 preallocated.write_next(out.assume_init_ref());
23618 }
23619 }
23620
23621 ::fidl_next::WireTable::encode_len(table, max_ord);
23622
23623 Ok(())
23624 }
23625}
23626
23627impl ::fidl_next::TakeFrom<WireConfigSourceCapabilities> for ConfigSourceCapabilities {
23628 #[inline]
23629 fn take_from(from: &WireConfigSourceCapabilities) -> Self {
23630 Self {}
23631 }
23632}
23633
23634#[repr(C)]
23636pub struct WireConfigSourceCapabilities {
23637 table: ::fidl_next::WireTable,
23638}
23639
23640unsafe impl ::fidl_next::ZeroPadding for WireConfigSourceCapabilities {
23641 #[inline]
23642 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
23643 ::fidl_next::munge!(let Self { table } = out);
23644 ::fidl_next::WireTable::zero_padding(table);
23645 }
23646}
23647
23648unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigSourceCapabilities
23649where
23650 ___D: ::fidl_next::Decoder + ?Sized,
23651{
23652 fn decode(
23653 slot: ::fidl_next::Slot<'_, Self>,
23654 decoder: &mut ___D,
23655 ) -> Result<(), ::fidl_next::DecodeError> {
23656 ::fidl_next::munge!(let Self { table } = slot);
23657
23658 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
23659 match ordinal {
23660 0 => unsafe { ::core::hint::unreachable_unchecked() },
23661
23662 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
23663 }
23664 })
23665 }
23666}
23667
23668impl WireConfigSourceCapabilities {}
23669
23670impl ::core::fmt::Debug for WireConfigSourceCapabilities {
23671 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
23672 f.debug_struct("ConfigSourceCapabilities").finish()
23673 }
23674}
23675
23676#[doc = " Strategies available for resolving configuration values.\n"]
23677#[derive(Clone, Debug)]
23678pub enum ConfigValueSource {
23679 PackagePath(String),
23680
23681 Capabilities(crate::ConfigSourceCapabilities),
23682
23683 UnknownOrdinal_(u64),
23684}
23685
23686impl ::fidl_next::Encodable for ConfigValueSource {
23687 type Encoded = WireConfigValueSource;
23688}
23689
23690unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigValueSource
23691where
23692 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
23693
23694 ___E: ::fidl_next::Encoder,
23695{
23696 #[inline]
23697 fn encode(
23698 self,
23699 encoder: &mut ___E,
23700 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23701 ) -> Result<(), ::fidl_next::EncodeError> {
23702 ::fidl_next::munge!(let WireConfigValueSource { raw } = out);
23703
23704 match self {
23705 Self::PackagePath(value) => {
23706 ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 1, encoder, raw)?
23707 }
23708
23709 Self::Capabilities(value) => ::fidl_next::RawWireUnion::encode_as::<
23710 ___E,
23711 crate::ConfigSourceCapabilities,
23712 >(value, 2, encoder, raw)?,
23713
23714 Self::UnknownOrdinal_(ordinal) => {
23715 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
23716 }
23717 }
23718
23719 Ok(())
23720 }
23721}
23722
23723unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigValueSource
23724where
23725 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
23726
23727 ___E: ::fidl_next::Encoder,
23728{
23729 #[inline]
23730 fn encode_ref(
23731 &self,
23732 encoder: &mut ___E,
23733 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
23734 ) -> Result<(), ::fidl_next::EncodeError> {
23735 ::fidl_next::munge!(let WireConfigValueSource { raw } = out);
23736
23737 match self {
23738 Self::PackagePath(value) => {
23739 ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 1, encoder, raw)?
23740 }
23741
23742 Self::Capabilities(value) => ::fidl_next::RawWireUnion::encode_as::<
23743 ___E,
23744 &crate::ConfigSourceCapabilities,
23745 >(value, 2, encoder, raw)?,
23746
23747 Self::UnknownOrdinal_(ordinal) => {
23748 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
23749 }
23750 }
23751
23752 Ok(())
23753 }
23754}
23755
23756impl ::fidl_next::EncodableOption for Box<ConfigValueSource> {
23757 type EncodedOption = WireOptionalConfigValueSource;
23758}
23759
23760unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ConfigValueSource>
23761where
23762 ___E: ?Sized,
23763 ConfigValueSource: ::fidl_next::Encode<___E>,
23764{
23765 #[inline]
23766 fn encode_option(
23767 this: Option<Self>,
23768 encoder: &mut ___E,
23769 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
23770 ) -> Result<(), ::fidl_next::EncodeError> {
23771 ::fidl_next::munge!(let WireOptionalConfigValueSource { raw } = &mut *out);
23772
23773 if let Some(inner) = this {
23774 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
23775 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
23776 } else {
23777 ::fidl_next::RawWireUnion::encode_absent(raw);
23778 }
23779
23780 Ok(())
23781 }
23782}
23783
23784unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ConfigValueSource>
23785where
23786 ___E: ?Sized,
23787 ConfigValueSource: ::fidl_next::EncodeRef<___E>,
23788{
23789 #[inline]
23790 fn encode_option_ref(
23791 this: Option<&Self>,
23792 encoder: &mut ___E,
23793 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
23794 ) -> Result<(), ::fidl_next::EncodeError> {
23795 ::fidl_next::munge!(let WireOptionalConfigValueSource { raw } = &mut *out);
23796
23797 if let Some(inner) = this {
23798 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
23799 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
23800 } else {
23801 ::fidl_next::RawWireUnion::encode_absent(raw);
23802 }
23803
23804 Ok(())
23805 }
23806}
23807
23808impl ::fidl_next::TakeFrom<WireConfigValueSource> for ConfigValueSource {
23809 #[inline]
23810 fn take_from(from: &WireConfigValueSource) -> Self {
23811 match from.raw.ordinal() {
23812 1 => Self::PackagePath(::fidl_next::TakeFrom::take_from(unsafe {
23813 from.raw.get().deref_unchecked::<::fidl_next::WireString>()
23814 })),
23815
23816 2 => Self::Capabilities(::fidl_next::TakeFrom::take_from(unsafe {
23817 from.raw.get().deref_unchecked::<crate::WireConfigSourceCapabilities>()
23818 })),
23819
23820 _ => unsafe { ::core::hint::unreachable_unchecked() },
23821 }
23822 }
23823}
23824
23825impl ::fidl_next::TakeFrom<WireOptionalConfigValueSource> for Option<Box<ConfigValueSource>> {
23826 #[inline]
23827 fn take_from(from: &WireOptionalConfigValueSource) -> Self {
23828 if let Some(inner) = from.as_ref() {
23829 Some(::fidl_next::TakeFrom::take_from(inner))
23830 } else {
23831 None
23832 }
23833 }
23834}
23835
23836#[repr(transparent)]
23838pub struct WireConfigValueSource {
23839 raw: ::fidl_next::RawWireUnion,
23840}
23841
23842unsafe impl ::fidl_next::ZeroPadding for WireConfigValueSource {
23843 #[inline]
23844 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
23845 ::fidl_next::munge!(let Self { raw } = out);
23846 ::fidl_next::RawWireUnion::zero_padding(raw);
23847 }
23848}
23849
23850pub mod config_value_source {
23851 pub enum Ref<'union> {
23852 PackagePath(&'union ::fidl_next::WireString),
23853
23854 Capabilities(&'union crate::WireConfigSourceCapabilities),
23855
23856 UnknownOrdinal_(u64),
23857 }
23858}
23859
23860impl WireConfigValueSource {
23861 pub fn as_ref(&self) -> crate::config_value_source::Ref<'_> {
23862 match self.raw.ordinal() {
23863 1 => crate::config_value_source::Ref::PackagePath(unsafe {
23864 self.raw.get().deref_unchecked::<::fidl_next::WireString>()
23865 }),
23866
23867 2 => crate::config_value_source::Ref::Capabilities(unsafe {
23868 self.raw.get().deref_unchecked::<crate::WireConfigSourceCapabilities>()
23869 }),
23870
23871 unknown => crate::config_value_source::Ref::UnknownOrdinal_(unknown),
23872 }
23873 }
23874}
23875
23876unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigValueSource
23877where
23878 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
23879
23880 ___D: ::fidl_next::Decoder,
23881{
23882 fn decode(
23883 mut slot: ::fidl_next::Slot<'_, Self>,
23884 decoder: &mut ___D,
23885 ) -> Result<(), ::fidl_next::DecodeError> {
23886 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
23887 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
23888 1 => {
23889 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString>(raw, decoder)?
23890 }
23891
23892 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigSourceCapabilities>(
23893 raw, decoder,
23894 )?,
23895
23896 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
23897 }
23898
23899 Ok(())
23900 }
23901}
23902
23903impl ::core::fmt::Debug for WireConfigValueSource {
23904 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
23905 match self.raw.ordinal() {
23906 1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString>().fmt(f) },
23907 2 => unsafe {
23908 self.raw.get().deref_unchecked::<crate::WireConfigSourceCapabilities>().fmt(f)
23909 },
23910 _ => unsafe { ::core::hint::unreachable_unchecked() },
23911 }
23912 }
23913}
23914
23915#[repr(transparent)]
23916pub struct WireOptionalConfigValueSource {
23917 raw: ::fidl_next::RawWireUnion,
23918}
23919
23920unsafe impl ::fidl_next::ZeroPadding for WireOptionalConfigValueSource {
23921 #[inline]
23922 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
23923 ::fidl_next::munge!(let Self { raw } = out);
23924 ::fidl_next::RawWireUnion::zero_padding(raw);
23925 }
23926}
23927
23928impl WireOptionalConfigValueSource {
23929 pub fn is_some(&self) -> bool {
23930 self.raw.is_some()
23931 }
23932
23933 pub fn is_none(&self) -> bool {
23934 self.raw.is_none()
23935 }
23936
23937 pub fn as_ref(&self) -> Option<&WireConfigValueSource> {
23938 if self.is_some() {
23939 Some(unsafe { &*(self as *const Self).cast() })
23940 } else {
23941 None
23942 }
23943 }
23944}
23945
23946unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalConfigValueSource
23947where
23948 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
23949
23950 ___D: ::fidl_next::Decoder,
23951{
23952 fn decode(
23953 mut slot: ::fidl_next::Slot<'_, Self>,
23954 decoder: &mut ___D,
23955 ) -> Result<(), ::fidl_next::DecodeError> {
23956 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
23957 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
23958 1 => {
23959 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString>(raw, decoder)?
23960 }
23961
23962 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigSourceCapabilities>(
23963 raw, decoder,
23964 )?,
23965
23966 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
23967 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
23968 }
23969
23970 Ok(())
23971 }
23972}
23973
23974impl ::core::fmt::Debug for WireOptionalConfigValueSource {
23975 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
23976 self.as_ref().fmt(f)
23977 }
23978}
23979
23980#[doc = " The schema of a component\'s configuration interface.\n"]
23981#[derive(Clone, Debug, Default)]
23982pub struct ConfigSchema {
23983 pub fields: Option<Vec<crate::ConfigField>>,
23984
23985 pub checksum: Option<crate::ConfigChecksum>,
23986
23987 pub value_source: Option<crate::ConfigValueSource>,
23988}
23989
23990impl ConfigSchema {
23991 fn __max_ordinal(&self) -> usize {
23992 if self.fields.is_some() {
23993 return 1;
23994 }
23995
23996 if self.checksum.is_some() {
23997 return 2;
23998 }
23999
24000 if self.value_source.is_some() {
24001 return 3;
24002 }
24003
24004 0
24005 }
24006}
24007
24008impl ::fidl_next::Encodable for ConfigSchema {
24009 type Encoded = WireConfigSchema;
24010}
24011
24012unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigSchema
24013where
24014 ___E: ::fidl_next::Encoder + ?Sized,
24015{
24016 #[inline]
24017 fn encode(
24018 mut self,
24019 encoder: &mut ___E,
24020 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24021 ) -> Result<(), ::fidl_next::EncodeError> {
24022 ::fidl_next::munge!(let WireConfigSchema { table } = out);
24023
24024 let max_ord = self.__max_ordinal();
24025
24026 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24027 ::fidl_next::ZeroPadding::zero_padding(&mut out);
24028
24029 let mut preallocated =
24030 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24031
24032 for i in 1..=max_ord {
24033 match i {
24034 3 => {
24035 if let Some(value_source) = self.value_source.take() {
24036 ::fidl_next::WireEnvelope::encode_value(
24037 value_source,
24038 preallocated.encoder,
24039 &mut out,
24040 )?;
24041 } else {
24042 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24043 }
24044 }
24045
24046 2 => {
24047 if let Some(checksum) = self.checksum.take() {
24048 ::fidl_next::WireEnvelope::encode_value(
24049 checksum,
24050 preallocated.encoder,
24051 &mut out,
24052 )?;
24053 } else {
24054 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24055 }
24056 }
24057
24058 1 => {
24059 if let Some(fields) = self.fields.take() {
24060 ::fidl_next::WireEnvelope::encode_value(
24061 fields,
24062 preallocated.encoder,
24063 &mut out,
24064 )?;
24065 } else {
24066 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24067 }
24068 }
24069
24070 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24071 }
24072 unsafe {
24073 preallocated.write_next(out.assume_init_ref());
24074 }
24075 }
24076
24077 ::fidl_next::WireTable::encode_len(table, max_ord);
24078
24079 Ok(())
24080 }
24081}
24082
24083unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigSchema
24084where
24085 ___E: ::fidl_next::Encoder + ?Sized,
24086{
24087 #[inline]
24088 fn encode_ref(
24089 &self,
24090 encoder: &mut ___E,
24091 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24092 ) -> Result<(), ::fidl_next::EncodeError> {
24093 ::fidl_next::munge!(let WireConfigSchema { table } = out);
24094
24095 let max_ord = self.__max_ordinal();
24096
24097 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24098 ::fidl_next::ZeroPadding::zero_padding(&mut out);
24099
24100 let mut preallocated =
24101 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24102
24103 for i in 1..=max_ord {
24104 match i {
24105 3 => {
24106 if let Some(value_source) = &self.value_source {
24107 ::fidl_next::WireEnvelope::encode_value(
24108 value_source,
24109 preallocated.encoder,
24110 &mut out,
24111 )?;
24112 } else {
24113 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24114 }
24115 }
24116
24117 2 => {
24118 if let Some(checksum) = &self.checksum {
24119 ::fidl_next::WireEnvelope::encode_value(
24120 checksum,
24121 preallocated.encoder,
24122 &mut out,
24123 )?;
24124 } else {
24125 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24126 }
24127 }
24128
24129 1 => {
24130 if let Some(fields) = &self.fields {
24131 ::fidl_next::WireEnvelope::encode_value(
24132 fields,
24133 preallocated.encoder,
24134 &mut out,
24135 )?;
24136 } else {
24137 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24138 }
24139 }
24140
24141 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24142 }
24143 unsafe {
24144 preallocated.write_next(out.assume_init_ref());
24145 }
24146 }
24147
24148 ::fidl_next::WireTable::encode_len(table, max_ord);
24149
24150 Ok(())
24151 }
24152}
24153
24154impl ::fidl_next::TakeFrom<WireConfigSchema> for ConfigSchema {
24155 #[inline]
24156 fn take_from(from: &WireConfigSchema) -> Self {
24157 Self {
24158 fields: from.fields().map(::fidl_next::TakeFrom::take_from),
24159
24160 checksum: from.checksum().map(::fidl_next::TakeFrom::take_from),
24161
24162 value_source: from.value_source().map(::fidl_next::TakeFrom::take_from),
24163 }
24164 }
24165}
24166
24167#[repr(C)]
24169pub struct WireConfigSchema {
24170 table: ::fidl_next::WireTable,
24171}
24172
24173unsafe impl ::fidl_next::ZeroPadding for WireConfigSchema {
24174 #[inline]
24175 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
24176 ::fidl_next::munge!(let Self { table } = out);
24177 ::fidl_next::WireTable::zero_padding(table);
24178 }
24179}
24180
24181unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigSchema
24182where
24183 ___D: ::fidl_next::Decoder + ?Sized,
24184{
24185 fn decode(
24186 slot: ::fidl_next::Slot<'_, Self>,
24187 decoder: &mut ___D,
24188 ) -> Result<(), ::fidl_next::DecodeError> {
24189 ::fidl_next::munge!(let Self { table } = slot);
24190
24191 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
24192 match ordinal {
24193 0 => unsafe { ::core::hint::unreachable_unchecked() },
24194
24195 1 => {
24196 ::fidl_next::WireEnvelope::decode_as::<
24197 ___D,
24198 ::fidl_next::WireVector<crate::WireConfigField>,
24199 >(slot.as_mut(), decoder)?;
24200
24201 Ok(())
24202 }
24203
24204 2 => {
24205 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigChecksum>(
24206 slot.as_mut(),
24207 decoder,
24208 )?;
24209
24210 Ok(())
24211 }
24212
24213 3 => {
24214 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValueSource>(
24215 slot.as_mut(),
24216 decoder,
24217 )?;
24218
24219 Ok(())
24220 }
24221
24222 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
24223 }
24224 })
24225 }
24226}
24227
24228impl WireConfigSchema {
24229 pub fn fields(&self) -> Option<&::fidl_next::WireVector<crate::WireConfigField>> {
24230 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
24231 }
24232
24233 pub fn checksum(&self) -> Option<&crate::WireConfigChecksum> {
24234 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
24235 }
24236
24237 pub fn value_source(&self) -> Option<&crate::WireConfigValueSource> {
24238 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
24239 }
24240}
24241
24242impl ::core::fmt::Debug for WireConfigSchema {
24243 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
24244 f.debug_struct("ConfigSchema")
24245 .field("fields", &self.fields())
24246 .field("checksum", &self.checksum())
24247 .field("value_source", &self.value_source())
24248 .finish()
24249 }
24250}
24251
24252#[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"]
24253#[derive(Clone, Debug, Default)]
24254pub struct Component {
24255 pub program: Option<crate::Program>,
24256
24257 pub uses: Option<Vec<crate::Use>>,
24258
24259 pub exposes: Option<Vec<crate::Expose>>,
24260
24261 pub offers: Option<Vec<crate::Offer>>,
24262
24263 pub capabilities: Option<Vec<crate::Capability>>,
24264
24265 pub children: Option<Vec<crate::Child>>,
24266
24267 pub collections: Option<Vec<crate::Collection>>,
24268
24269 pub environments: Option<Vec<crate::Environment>>,
24270
24271 pub facets: Option<::fidl_next_fuchsia_data::Dictionary>,
24272
24273 pub config: Option<crate::ConfigSchema>,
24274}
24275
24276impl Component {
24277 fn __max_ordinal(&self) -> usize {
24278 if self.program.is_some() {
24279 return 1;
24280 }
24281
24282 if self.uses.is_some() {
24283 return 2;
24284 }
24285
24286 if self.exposes.is_some() {
24287 return 3;
24288 }
24289
24290 if self.offers.is_some() {
24291 return 4;
24292 }
24293
24294 if self.capabilities.is_some() {
24295 return 5;
24296 }
24297
24298 if self.children.is_some() {
24299 return 6;
24300 }
24301
24302 if self.collections.is_some() {
24303 return 7;
24304 }
24305
24306 if self.environments.is_some() {
24307 return 8;
24308 }
24309
24310 if self.facets.is_some() {
24311 return 9;
24312 }
24313
24314 if self.config.is_some() {
24315 return 10;
24316 }
24317
24318 0
24319 }
24320}
24321
24322impl ::fidl_next::Encodable for Component {
24323 type Encoded = WireComponent;
24324}
24325
24326unsafe impl<___E> ::fidl_next::Encode<___E> for Component
24327where
24328 ___E: ::fidl_next::Encoder + ?Sized,
24329{
24330 #[inline]
24331 fn encode(
24332 mut self,
24333 encoder: &mut ___E,
24334 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24335 ) -> Result<(), ::fidl_next::EncodeError> {
24336 ::fidl_next::munge!(let WireComponent { table } = out);
24337
24338 let max_ord = self.__max_ordinal();
24339
24340 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24341 ::fidl_next::ZeroPadding::zero_padding(&mut out);
24342
24343 let mut preallocated =
24344 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24345
24346 for i in 1..=max_ord {
24347 match i {
24348 10 => {
24349 if let Some(config) = self.config.take() {
24350 ::fidl_next::WireEnvelope::encode_value(
24351 config,
24352 preallocated.encoder,
24353 &mut out,
24354 )?;
24355 } else {
24356 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24357 }
24358 }
24359
24360 9 => {
24361 if let Some(facets) = self.facets.take() {
24362 ::fidl_next::WireEnvelope::encode_value(
24363 facets,
24364 preallocated.encoder,
24365 &mut out,
24366 )?;
24367 } else {
24368 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24369 }
24370 }
24371
24372 8 => {
24373 if let Some(environments) = self.environments.take() {
24374 ::fidl_next::WireEnvelope::encode_value(
24375 environments,
24376 preallocated.encoder,
24377 &mut out,
24378 )?;
24379 } else {
24380 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24381 }
24382 }
24383
24384 7 => {
24385 if let Some(collections) = self.collections.take() {
24386 ::fidl_next::WireEnvelope::encode_value(
24387 collections,
24388 preallocated.encoder,
24389 &mut out,
24390 )?;
24391 } else {
24392 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24393 }
24394 }
24395
24396 6 => {
24397 if let Some(children) = self.children.take() {
24398 ::fidl_next::WireEnvelope::encode_value(
24399 children,
24400 preallocated.encoder,
24401 &mut out,
24402 )?;
24403 } else {
24404 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24405 }
24406 }
24407
24408 5 => {
24409 if let Some(capabilities) = self.capabilities.take() {
24410 ::fidl_next::WireEnvelope::encode_value(
24411 capabilities,
24412 preallocated.encoder,
24413 &mut out,
24414 )?;
24415 } else {
24416 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24417 }
24418 }
24419
24420 4 => {
24421 if let Some(offers) = self.offers.take() {
24422 ::fidl_next::WireEnvelope::encode_value(
24423 offers,
24424 preallocated.encoder,
24425 &mut out,
24426 )?;
24427 } else {
24428 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24429 }
24430 }
24431
24432 3 => {
24433 if let Some(exposes) = self.exposes.take() {
24434 ::fidl_next::WireEnvelope::encode_value(
24435 exposes,
24436 preallocated.encoder,
24437 &mut out,
24438 )?;
24439 } else {
24440 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24441 }
24442 }
24443
24444 2 => {
24445 if let Some(uses) = self.uses.take() {
24446 ::fidl_next::WireEnvelope::encode_value(
24447 uses,
24448 preallocated.encoder,
24449 &mut out,
24450 )?;
24451 } else {
24452 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24453 }
24454 }
24455
24456 1 => {
24457 if let Some(program) = self.program.take() {
24458 ::fidl_next::WireEnvelope::encode_value(
24459 program,
24460 preallocated.encoder,
24461 &mut out,
24462 )?;
24463 } else {
24464 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24465 }
24466 }
24467
24468 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24469 }
24470 unsafe {
24471 preallocated.write_next(out.assume_init_ref());
24472 }
24473 }
24474
24475 ::fidl_next::WireTable::encode_len(table, max_ord);
24476
24477 Ok(())
24478 }
24479}
24480
24481unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Component
24482where
24483 ___E: ::fidl_next::Encoder + ?Sized,
24484{
24485 #[inline]
24486 fn encode_ref(
24487 &self,
24488 encoder: &mut ___E,
24489 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24490 ) -> Result<(), ::fidl_next::EncodeError> {
24491 ::fidl_next::munge!(let WireComponent { table } = out);
24492
24493 let max_ord = self.__max_ordinal();
24494
24495 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24496 ::fidl_next::ZeroPadding::zero_padding(&mut out);
24497
24498 let mut preallocated =
24499 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24500
24501 for i in 1..=max_ord {
24502 match i {
24503 10 => {
24504 if let Some(config) = &self.config {
24505 ::fidl_next::WireEnvelope::encode_value(
24506 config,
24507 preallocated.encoder,
24508 &mut out,
24509 )?;
24510 } else {
24511 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24512 }
24513 }
24514
24515 9 => {
24516 if let Some(facets) = &self.facets {
24517 ::fidl_next::WireEnvelope::encode_value(
24518 facets,
24519 preallocated.encoder,
24520 &mut out,
24521 )?;
24522 } else {
24523 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24524 }
24525 }
24526
24527 8 => {
24528 if let Some(environments) = &self.environments {
24529 ::fidl_next::WireEnvelope::encode_value(
24530 environments,
24531 preallocated.encoder,
24532 &mut out,
24533 )?;
24534 } else {
24535 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24536 }
24537 }
24538
24539 7 => {
24540 if let Some(collections) = &self.collections {
24541 ::fidl_next::WireEnvelope::encode_value(
24542 collections,
24543 preallocated.encoder,
24544 &mut out,
24545 )?;
24546 } else {
24547 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24548 }
24549 }
24550
24551 6 => {
24552 if let Some(children) = &self.children {
24553 ::fidl_next::WireEnvelope::encode_value(
24554 children,
24555 preallocated.encoder,
24556 &mut out,
24557 )?;
24558 } else {
24559 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24560 }
24561 }
24562
24563 5 => {
24564 if let Some(capabilities) = &self.capabilities {
24565 ::fidl_next::WireEnvelope::encode_value(
24566 capabilities,
24567 preallocated.encoder,
24568 &mut out,
24569 )?;
24570 } else {
24571 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24572 }
24573 }
24574
24575 4 => {
24576 if let Some(offers) = &self.offers {
24577 ::fidl_next::WireEnvelope::encode_value(
24578 offers,
24579 preallocated.encoder,
24580 &mut out,
24581 )?;
24582 } else {
24583 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24584 }
24585 }
24586
24587 3 => {
24588 if let Some(exposes) = &self.exposes {
24589 ::fidl_next::WireEnvelope::encode_value(
24590 exposes,
24591 preallocated.encoder,
24592 &mut out,
24593 )?;
24594 } else {
24595 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24596 }
24597 }
24598
24599 2 => {
24600 if let Some(uses) = &self.uses {
24601 ::fidl_next::WireEnvelope::encode_value(
24602 uses,
24603 preallocated.encoder,
24604 &mut out,
24605 )?;
24606 } else {
24607 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24608 }
24609 }
24610
24611 1 => {
24612 if let Some(program) = &self.program {
24613 ::fidl_next::WireEnvelope::encode_value(
24614 program,
24615 preallocated.encoder,
24616 &mut out,
24617 )?;
24618 } else {
24619 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24620 }
24621 }
24622
24623 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24624 }
24625 unsafe {
24626 preallocated.write_next(out.assume_init_ref());
24627 }
24628 }
24629
24630 ::fidl_next::WireTable::encode_len(table, max_ord);
24631
24632 Ok(())
24633 }
24634}
24635
24636impl ::fidl_next::TakeFrom<WireComponent> for Component {
24637 #[inline]
24638 fn take_from(from: &WireComponent) -> Self {
24639 Self {
24640 program: from.program().map(::fidl_next::TakeFrom::take_from),
24641
24642 uses: from.uses().map(::fidl_next::TakeFrom::take_from),
24643
24644 exposes: from.exposes().map(::fidl_next::TakeFrom::take_from),
24645
24646 offers: from.offers().map(::fidl_next::TakeFrom::take_from),
24647
24648 capabilities: from.capabilities().map(::fidl_next::TakeFrom::take_from),
24649
24650 children: from.children().map(::fidl_next::TakeFrom::take_from),
24651
24652 collections: from.collections().map(::fidl_next::TakeFrom::take_from),
24653
24654 environments: from.environments().map(::fidl_next::TakeFrom::take_from),
24655
24656 facets: from.facets().map(::fidl_next::TakeFrom::take_from),
24657
24658 config: from.config().map(::fidl_next::TakeFrom::take_from),
24659 }
24660 }
24661}
24662
24663#[repr(C)]
24665pub struct WireComponent {
24666 table: ::fidl_next::WireTable,
24667}
24668
24669unsafe impl ::fidl_next::ZeroPadding for WireComponent {
24670 #[inline]
24671 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
24672 ::fidl_next::munge!(let Self { table } = out);
24673 ::fidl_next::WireTable::zero_padding(table);
24674 }
24675}
24676
24677unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponent
24678where
24679 ___D: ::fidl_next::Decoder + ?Sized,
24680{
24681 fn decode(
24682 slot: ::fidl_next::Slot<'_, Self>,
24683 decoder: &mut ___D,
24684 ) -> Result<(), ::fidl_next::DecodeError> {
24685 ::fidl_next::munge!(let Self { table } = slot);
24686
24687 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
24688 match ordinal {
24689 0 => unsafe { ::core::hint::unreachable_unchecked() },
24690
24691 1 => {
24692 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireProgram>(
24693 slot.as_mut(),
24694 decoder,
24695 )?;
24696
24697 Ok(())
24698 }
24699
24700 2 => {
24701 ::fidl_next::WireEnvelope::decode_as::<
24702 ___D,
24703 ::fidl_next::WireVector<crate::WireUse>,
24704 >(slot.as_mut(), decoder)?;
24705
24706 Ok(())
24707 }
24708
24709 3 => {
24710 ::fidl_next::WireEnvelope::decode_as::<
24711 ___D,
24712 ::fidl_next::WireVector<crate::WireExpose>,
24713 >(slot.as_mut(), decoder)?;
24714
24715 Ok(())
24716 }
24717
24718 4 => {
24719 ::fidl_next::WireEnvelope::decode_as::<
24720 ___D,
24721 ::fidl_next::WireVector<crate::WireOffer>,
24722 >(slot.as_mut(), decoder)?;
24723
24724 Ok(())
24725 }
24726
24727 5 => {
24728 ::fidl_next::WireEnvelope::decode_as::<
24729 ___D,
24730 ::fidl_next::WireVector<crate::WireCapability>,
24731 >(slot.as_mut(), decoder)?;
24732
24733 Ok(())
24734 }
24735
24736 6 => {
24737 ::fidl_next::WireEnvelope::decode_as::<
24738 ___D,
24739 ::fidl_next::WireVector<crate::WireChild>,
24740 >(slot.as_mut(), decoder)?;
24741
24742 Ok(())
24743 }
24744
24745 7 => {
24746 ::fidl_next::WireEnvelope::decode_as::<
24747 ___D,
24748 ::fidl_next::WireVector<crate::WireCollection>,
24749 >(slot.as_mut(), decoder)?;
24750
24751 Ok(())
24752 }
24753
24754 8 => {
24755 ::fidl_next::WireEnvelope::decode_as::<
24756 ___D,
24757 ::fidl_next::WireVector<crate::WireEnvironment>,
24758 >(slot.as_mut(), decoder)?;
24759
24760 Ok(())
24761 }
24762
24763 9 => {
24764 ::fidl_next::WireEnvelope::decode_as::<
24765 ___D,
24766 ::fidl_next_fuchsia_data::WireDictionary,
24767 >(slot.as_mut(), decoder)?;
24768
24769 Ok(())
24770 }
24771
24772 10 => {
24773 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigSchema>(
24774 slot.as_mut(),
24775 decoder,
24776 )?;
24777
24778 Ok(())
24779 }
24780
24781 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
24782 }
24783 })
24784 }
24785}
24786
24787impl WireComponent {
24788 pub fn program(&self) -> Option<&crate::WireProgram> {
24789 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
24790 }
24791
24792 pub fn uses(&self) -> Option<&::fidl_next::WireVector<crate::WireUse>> {
24793 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
24794 }
24795
24796 pub fn exposes(&self) -> Option<&::fidl_next::WireVector<crate::WireExpose>> {
24797 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
24798 }
24799
24800 pub fn offers(&self) -> Option<&::fidl_next::WireVector<crate::WireOffer>> {
24801 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
24802 }
24803
24804 pub fn capabilities(&self) -> Option<&::fidl_next::WireVector<crate::WireCapability>> {
24805 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
24806 }
24807
24808 pub fn children(&self) -> Option<&::fidl_next::WireVector<crate::WireChild>> {
24809 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
24810 }
24811
24812 pub fn collections(&self) -> Option<&::fidl_next::WireVector<crate::WireCollection>> {
24813 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
24814 }
24815
24816 pub fn environments(&self) -> Option<&::fidl_next::WireVector<crate::WireEnvironment>> {
24817 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
24818 }
24819
24820 pub fn facets(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary> {
24821 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
24822 }
24823
24824 pub fn config(&self) -> Option<&crate::WireConfigSchema> {
24825 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
24826 }
24827}
24828
24829impl ::core::fmt::Debug for WireComponent {
24830 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
24831 f.debug_struct("Component")
24832 .field("program", &self.program())
24833 .field("uses", &self.uses())
24834 .field("exposes", &self.exposes())
24835 .field("offers", &self.offers())
24836 .field("capabilities", &self.capabilities())
24837 .field("children", &self.children())
24838 .field("collections", &self.collections())
24839 .field("environments", &self.environments())
24840 .field("facets", &self.facets())
24841 .field("config", &self.config())
24842 .finish()
24843 }
24844}
24845
24846#[doc = " An individual configuration value. It is matched against a specific configuration field based\n on its offset within `ValuesData.values`.\n"]
24847#[derive(Clone, Debug, Default)]
24848pub struct ConfigValueSpec {
24849 pub value: Option<crate::ConfigValue>,
24850}
24851
24852impl ConfigValueSpec {
24853 fn __max_ordinal(&self) -> usize {
24854 if self.value.is_some() {
24855 return 1;
24856 }
24857
24858 0
24859 }
24860}
24861
24862impl ::fidl_next::Encodable for ConfigValueSpec {
24863 type Encoded = WireConfigValueSpec;
24864}
24865
24866unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigValueSpec
24867where
24868 ___E: ::fidl_next::Encoder + ?Sized,
24869{
24870 #[inline]
24871 fn encode(
24872 mut self,
24873 encoder: &mut ___E,
24874 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24875 ) -> Result<(), ::fidl_next::EncodeError> {
24876 ::fidl_next::munge!(let WireConfigValueSpec { table } = out);
24877
24878 let max_ord = self.__max_ordinal();
24879
24880 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24881 ::fidl_next::ZeroPadding::zero_padding(&mut out);
24882
24883 let mut preallocated =
24884 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24885
24886 for i in 1..=max_ord {
24887 match i {
24888 1 => {
24889 if let Some(value) = self.value.take() {
24890 ::fidl_next::WireEnvelope::encode_value(
24891 value,
24892 preallocated.encoder,
24893 &mut out,
24894 )?;
24895 } else {
24896 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24897 }
24898 }
24899
24900 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24901 }
24902 unsafe {
24903 preallocated.write_next(out.assume_init_ref());
24904 }
24905 }
24906
24907 ::fidl_next::WireTable::encode_len(table, max_ord);
24908
24909 Ok(())
24910 }
24911}
24912
24913unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigValueSpec
24914where
24915 ___E: ::fidl_next::Encoder + ?Sized,
24916{
24917 #[inline]
24918 fn encode_ref(
24919 &self,
24920 encoder: &mut ___E,
24921 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
24922 ) -> Result<(), ::fidl_next::EncodeError> {
24923 ::fidl_next::munge!(let WireConfigValueSpec { table } = out);
24924
24925 let max_ord = self.__max_ordinal();
24926
24927 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
24928 ::fidl_next::ZeroPadding::zero_padding(&mut out);
24929
24930 let mut preallocated =
24931 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
24932
24933 for i in 1..=max_ord {
24934 match i {
24935 1 => {
24936 if let Some(value) = &self.value {
24937 ::fidl_next::WireEnvelope::encode_value(
24938 value,
24939 preallocated.encoder,
24940 &mut out,
24941 )?;
24942 } else {
24943 ::fidl_next::WireEnvelope::encode_zero(&mut out)
24944 }
24945 }
24946
24947 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
24948 }
24949 unsafe {
24950 preallocated.write_next(out.assume_init_ref());
24951 }
24952 }
24953
24954 ::fidl_next::WireTable::encode_len(table, max_ord);
24955
24956 Ok(())
24957 }
24958}
24959
24960impl ::fidl_next::TakeFrom<WireConfigValueSpec> for ConfigValueSpec {
24961 #[inline]
24962 fn take_from(from: &WireConfigValueSpec) -> Self {
24963 Self { value: from.value().map(::fidl_next::TakeFrom::take_from) }
24964 }
24965}
24966
24967#[repr(C)]
24969pub struct WireConfigValueSpec {
24970 table: ::fidl_next::WireTable,
24971}
24972
24973unsafe impl ::fidl_next::ZeroPadding for WireConfigValueSpec {
24974 #[inline]
24975 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
24976 ::fidl_next::munge!(let Self { table } = out);
24977 ::fidl_next::WireTable::zero_padding(table);
24978 }
24979}
24980
24981unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigValueSpec
24982where
24983 ___D: ::fidl_next::Decoder + ?Sized,
24984{
24985 fn decode(
24986 slot: ::fidl_next::Slot<'_, Self>,
24987 decoder: &mut ___D,
24988 ) -> Result<(), ::fidl_next::DecodeError> {
24989 ::fidl_next::munge!(let Self { table } = slot);
24990
24991 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
24992 match ordinal {
24993 0 => unsafe { ::core::hint::unreachable_unchecked() },
24994
24995 1 => {
24996 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigValue>(
24997 slot.as_mut(),
24998 decoder,
24999 )?;
25000
25001 Ok(())
25002 }
25003
25004 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
25005 }
25006 })
25007 }
25008}
25009
25010impl WireConfigValueSpec {
25011 pub fn value(&self) -> Option<&crate::WireConfigValue> {
25012 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
25013 }
25014}
25015
25016impl ::core::fmt::Debug for WireConfigValueSpec {
25017 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
25018 f.debug_struct("ConfigValueSpec").field("value", &self.value()).finish()
25019 }
25020}
25021
25022#[doc = " Contents of the configuration value file. Defines the base values for a component\'s config.\n"]
25023#[derive(Clone, Debug, Default)]
25024pub struct ConfigValuesData {
25025 pub values: Option<Vec<crate::ConfigValueSpec>>,
25026
25027 pub checksum: Option<crate::ConfigChecksum>,
25028}
25029
25030impl ConfigValuesData {
25031 fn __max_ordinal(&self) -> usize {
25032 if self.values.is_some() {
25033 return 1;
25034 }
25035
25036 if self.checksum.is_some() {
25037 return 2;
25038 }
25039
25040 0
25041 }
25042}
25043
25044impl ::fidl_next::Encodable for ConfigValuesData {
25045 type Encoded = WireConfigValuesData;
25046}
25047
25048unsafe impl<___E> ::fidl_next::Encode<___E> for ConfigValuesData
25049where
25050 ___E: ::fidl_next::Encoder + ?Sized,
25051{
25052 #[inline]
25053 fn encode(
25054 mut self,
25055 encoder: &mut ___E,
25056 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25057 ) -> Result<(), ::fidl_next::EncodeError> {
25058 ::fidl_next::munge!(let WireConfigValuesData { table } = out);
25059
25060 let max_ord = self.__max_ordinal();
25061
25062 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
25063 ::fidl_next::ZeroPadding::zero_padding(&mut out);
25064
25065 let mut preallocated =
25066 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
25067
25068 for i in 1..=max_ord {
25069 match i {
25070 2 => {
25071 if let Some(checksum) = self.checksum.take() {
25072 ::fidl_next::WireEnvelope::encode_value(
25073 checksum,
25074 preallocated.encoder,
25075 &mut out,
25076 )?;
25077 } else {
25078 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25079 }
25080 }
25081
25082 1 => {
25083 if let Some(values) = self.values.take() {
25084 ::fidl_next::WireEnvelope::encode_value(
25085 values,
25086 preallocated.encoder,
25087 &mut out,
25088 )?;
25089 } else {
25090 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25091 }
25092 }
25093
25094 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
25095 }
25096 unsafe {
25097 preallocated.write_next(out.assume_init_ref());
25098 }
25099 }
25100
25101 ::fidl_next::WireTable::encode_len(table, max_ord);
25102
25103 Ok(())
25104 }
25105}
25106
25107unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConfigValuesData
25108where
25109 ___E: ::fidl_next::Encoder + ?Sized,
25110{
25111 #[inline]
25112 fn encode_ref(
25113 &self,
25114 encoder: &mut ___E,
25115 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25116 ) -> Result<(), ::fidl_next::EncodeError> {
25117 ::fidl_next::munge!(let WireConfigValuesData { table } = out);
25118
25119 let max_ord = self.__max_ordinal();
25120
25121 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
25122 ::fidl_next::ZeroPadding::zero_padding(&mut out);
25123
25124 let mut preallocated =
25125 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
25126
25127 for i in 1..=max_ord {
25128 match i {
25129 2 => {
25130 if let Some(checksum) = &self.checksum {
25131 ::fidl_next::WireEnvelope::encode_value(
25132 checksum,
25133 preallocated.encoder,
25134 &mut out,
25135 )?;
25136 } else {
25137 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25138 }
25139 }
25140
25141 1 => {
25142 if let Some(values) = &self.values {
25143 ::fidl_next::WireEnvelope::encode_value(
25144 values,
25145 preallocated.encoder,
25146 &mut out,
25147 )?;
25148 } else {
25149 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25150 }
25151 }
25152
25153 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
25154 }
25155 unsafe {
25156 preallocated.write_next(out.assume_init_ref());
25157 }
25158 }
25159
25160 ::fidl_next::WireTable::encode_len(table, max_ord);
25161
25162 Ok(())
25163 }
25164}
25165
25166impl ::fidl_next::TakeFrom<WireConfigValuesData> for ConfigValuesData {
25167 #[inline]
25168 fn take_from(from: &WireConfigValuesData) -> Self {
25169 Self {
25170 values: from.values().map(::fidl_next::TakeFrom::take_from),
25171
25172 checksum: from.checksum().map(::fidl_next::TakeFrom::take_from),
25173 }
25174 }
25175}
25176
25177#[repr(C)]
25179pub struct WireConfigValuesData {
25180 table: ::fidl_next::WireTable,
25181}
25182
25183unsafe impl ::fidl_next::ZeroPadding for WireConfigValuesData {
25184 #[inline]
25185 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
25186 ::fidl_next::munge!(let Self { table } = out);
25187 ::fidl_next::WireTable::zero_padding(table);
25188 }
25189}
25190
25191unsafe impl<___D> ::fidl_next::Decode<___D> for WireConfigValuesData
25192where
25193 ___D: ::fidl_next::Decoder + ?Sized,
25194{
25195 fn decode(
25196 slot: ::fidl_next::Slot<'_, Self>,
25197 decoder: &mut ___D,
25198 ) -> Result<(), ::fidl_next::DecodeError> {
25199 ::fidl_next::munge!(let Self { table } = slot);
25200
25201 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
25202 match ordinal {
25203 0 => unsafe { ::core::hint::unreachable_unchecked() },
25204
25205 1 => {
25206 ::fidl_next::WireEnvelope::decode_as::<
25207 ___D,
25208 ::fidl_next::WireVector<crate::WireConfigValueSpec>,
25209 >(slot.as_mut(), decoder)?;
25210
25211 Ok(())
25212 }
25213
25214 2 => {
25215 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConfigChecksum>(
25216 slot.as_mut(),
25217 decoder,
25218 )?;
25219
25220 Ok(())
25221 }
25222
25223 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
25224 }
25225 })
25226 }
25227}
25228
25229impl WireConfigValuesData {
25230 pub fn values(&self) -> Option<&::fidl_next::WireVector<crate::WireConfigValueSpec>> {
25231 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
25232 }
25233
25234 pub fn checksum(&self) -> Option<&crate::WireConfigChecksum> {
25235 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
25236 }
25237}
25238
25239impl ::core::fmt::Debug for WireConfigValuesData {
25240 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
25241 f.debug_struct("ConfigValuesData")
25242 .field("values", &self.values())
25243 .field("checksum", &self.checksum())
25244 .finish()
25245 }
25246}
25247
25248#[doc = " Indicates the event name to subscribe to with a given event mode.\n"]
25249#[derive(Clone, Debug, Default)]
25250pub struct EventSubscription {
25251 pub event_name: Option<String>,
25252}
25253
25254impl EventSubscription {
25255 fn __max_ordinal(&self) -> usize {
25256 if self.event_name.is_some() {
25257 return 1;
25258 }
25259
25260 0
25261 }
25262}
25263
25264impl ::fidl_next::Encodable for EventSubscription {
25265 type Encoded = WireEventSubscription;
25266}
25267
25268unsafe impl<___E> ::fidl_next::Encode<___E> for EventSubscription
25269where
25270 ___E: ::fidl_next::Encoder + ?Sized,
25271{
25272 #[inline]
25273 fn encode(
25274 mut self,
25275 encoder: &mut ___E,
25276 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25277 ) -> Result<(), ::fidl_next::EncodeError> {
25278 ::fidl_next::munge!(let WireEventSubscription { table } = out);
25279
25280 let max_ord = self.__max_ordinal();
25281
25282 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
25283 ::fidl_next::ZeroPadding::zero_padding(&mut out);
25284
25285 let mut preallocated =
25286 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
25287
25288 for i in 1..=max_ord {
25289 match i {
25290 1 => {
25291 if let Some(event_name) = self.event_name.take() {
25292 ::fidl_next::WireEnvelope::encode_value(
25293 event_name,
25294 preallocated.encoder,
25295 &mut out,
25296 )?;
25297 } else {
25298 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25299 }
25300 }
25301
25302 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
25303 }
25304 unsafe {
25305 preallocated.write_next(out.assume_init_ref());
25306 }
25307 }
25308
25309 ::fidl_next::WireTable::encode_len(table, max_ord);
25310
25311 Ok(())
25312 }
25313}
25314
25315unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EventSubscription
25316where
25317 ___E: ::fidl_next::Encoder + ?Sized,
25318{
25319 #[inline]
25320 fn encode_ref(
25321 &self,
25322 encoder: &mut ___E,
25323 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25324 ) -> Result<(), ::fidl_next::EncodeError> {
25325 ::fidl_next::munge!(let WireEventSubscription { table } = out);
25326
25327 let max_ord = self.__max_ordinal();
25328
25329 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
25330 ::fidl_next::ZeroPadding::zero_padding(&mut out);
25331
25332 let mut preallocated =
25333 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
25334
25335 for i in 1..=max_ord {
25336 match i {
25337 1 => {
25338 if let Some(event_name) = &self.event_name {
25339 ::fidl_next::WireEnvelope::encode_value(
25340 event_name,
25341 preallocated.encoder,
25342 &mut out,
25343 )?;
25344 } else {
25345 ::fidl_next::WireEnvelope::encode_zero(&mut out)
25346 }
25347 }
25348
25349 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
25350 }
25351 unsafe {
25352 preallocated.write_next(out.assume_init_ref());
25353 }
25354 }
25355
25356 ::fidl_next::WireTable::encode_len(table, max_ord);
25357
25358 Ok(())
25359 }
25360}
25361
25362impl ::fidl_next::TakeFrom<WireEventSubscription> for EventSubscription {
25363 #[inline]
25364 fn take_from(from: &WireEventSubscription) -> Self {
25365 Self { event_name: from.event_name().map(::fidl_next::TakeFrom::take_from) }
25366 }
25367}
25368
25369#[repr(C)]
25371pub struct WireEventSubscription {
25372 table: ::fidl_next::WireTable,
25373}
25374
25375unsafe impl ::fidl_next::ZeroPadding for WireEventSubscription {
25376 #[inline]
25377 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
25378 ::fidl_next::munge!(let Self { table } = out);
25379 ::fidl_next::WireTable::zero_padding(table);
25380 }
25381}
25382
25383unsafe impl<___D> ::fidl_next::Decode<___D> for WireEventSubscription
25384where
25385 ___D: ::fidl_next::Decoder + ?Sized,
25386{
25387 fn decode(
25388 slot: ::fidl_next::Slot<'_, Self>,
25389 decoder: &mut ___D,
25390 ) -> Result<(), ::fidl_next::DecodeError> {
25391 ::fidl_next::munge!(let Self { table } = slot);
25392
25393 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
25394 match ordinal {
25395 0 => unsafe { ::core::hint::unreachable_unchecked() },
25396
25397 1 => {
25398 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
25399 slot.as_mut(),
25400 decoder,
25401 )?;
25402
25403 let event_name = unsafe {
25404 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
25405 };
25406
25407 if event_name.len() > 100 {
25408 return Err(::fidl_next::DecodeError::VectorTooLong {
25409 size: event_name.len() as u64,
25410 limit: 100,
25411 });
25412 }
25413
25414 Ok(())
25415 }
25416
25417 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
25418 }
25419 })
25420 }
25421}
25422
25423impl WireEventSubscription {
25424 pub fn event_name(&self) -> Option<&::fidl_next::WireString> {
25425 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
25426 }
25427}
25428
25429impl ::core::fmt::Debug for WireEventSubscription {
25430 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
25431 f.debug_struct("EventSubscription").field("event_name", &self.event_name()).finish()
25432 }
25433}
25434
25435#[derive(Clone, Debug)]
25436pub enum LayoutParameter {
25437 NestedType(crate::ConfigType),
25438
25439 UnknownOrdinal_(u64),
25440}
25441
25442impl ::fidl_next::Encodable for LayoutParameter {
25443 type Encoded = WireLayoutParameter;
25444}
25445
25446unsafe impl<___E> ::fidl_next::Encode<___E> for LayoutParameter
25447where
25448 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
25449
25450 ___E: ::fidl_next::Encoder,
25451{
25452 #[inline]
25453 fn encode(
25454 self,
25455 encoder: &mut ___E,
25456 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25457 ) -> Result<(), ::fidl_next::EncodeError> {
25458 ::fidl_next::munge!(let WireLayoutParameter { raw } = out);
25459
25460 match self {
25461 Self::NestedType(value) => ::fidl_next::RawWireUnion::encode_as::<
25462 ___E,
25463 crate::ConfigType,
25464 >(value, 1, encoder, raw)?,
25465
25466 Self::UnknownOrdinal_(ordinal) => {
25467 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
25468 }
25469 }
25470
25471 Ok(())
25472 }
25473}
25474
25475unsafe impl<___E> ::fidl_next::EncodeRef<___E> for LayoutParameter
25476where
25477 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
25478
25479 ___E: ::fidl_next::Encoder,
25480{
25481 #[inline]
25482 fn encode_ref(
25483 &self,
25484 encoder: &mut ___E,
25485 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25486 ) -> Result<(), ::fidl_next::EncodeError> {
25487 ::fidl_next::munge!(let WireLayoutParameter { raw } = out);
25488
25489 match self {
25490 Self::NestedType(value) => ::fidl_next::RawWireUnion::encode_as::<
25491 ___E,
25492 &crate::ConfigType,
25493 >(value, 1, encoder, raw)?,
25494
25495 Self::UnknownOrdinal_(ordinal) => {
25496 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
25497 }
25498 }
25499
25500 Ok(())
25501 }
25502}
25503
25504impl ::fidl_next::EncodableOption for Box<LayoutParameter> {
25505 type EncodedOption = WireOptionalLayoutParameter;
25506}
25507
25508unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<LayoutParameter>
25509where
25510 ___E: ?Sized,
25511 LayoutParameter: ::fidl_next::Encode<___E>,
25512{
25513 #[inline]
25514 fn encode_option(
25515 this: Option<Self>,
25516 encoder: &mut ___E,
25517 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
25518 ) -> Result<(), ::fidl_next::EncodeError> {
25519 ::fidl_next::munge!(let WireOptionalLayoutParameter { raw } = &mut *out);
25520
25521 if let Some(inner) = this {
25522 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
25523 ::fidl_next::Encode::encode(inner, encoder, value_out)?;
25524 } else {
25525 ::fidl_next::RawWireUnion::encode_absent(raw);
25526 }
25527
25528 Ok(())
25529 }
25530}
25531
25532unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<LayoutParameter>
25533where
25534 ___E: ?Sized,
25535 LayoutParameter: ::fidl_next::EncodeRef<___E>,
25536{
25537 #[inline]
25538 fn encode_option_ref(
25539 this: Option<&Self>,
25540 encoder: &mut ___E,
25541 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
25542 ) -> Result<(), ::fidl_next::EncodeError> {
25543 ::fidl_next::munge!(let WireOptionalLayoutParameter { raw } = &mut *out);
25544
25545 if let Some(inner) = this {
25546 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
25547 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
25548 } else {
25549 ::fidl_next::RawWireUnion::encode_absent(raw);
25550 }
25551
25552 Ok(())
25553 }
25554}
25555
25556impl ::fidl_next::TakeFrom<WireLayoutParameter> for LayoutParameter {
25557 #[inline]
25558 fn take_from(from: &WireLayoutParameter) -> Self {
25559 match from.raw.ordinal() {
25560 1 => Self::NestedType(::fidl_next::TakeFrom::take_from(unsafe {
25561 from.raw.get().deref_unchecked::<crate::WireConfigType>()
25562 })),
25563
25564 _ => unsafe { ::core::hint::unreachable_unchecked() },
25565 }
25566 }
25567}
25568
25569impl ::fidl_next::TakeFrom<WireOptionalLayoutParameter> for Option<Box<LayoutParameter>> {
25570 #[inline]
25571 fn take_from(from: &WireOptionalLayoutParameter) -> Self {
25572 if let Some(inner) = from.as_ref() {
25573 Some(::fidl_next::TakeFrom::take_from(inner))
25574 } else {
25575 None
25576 }
25577 }
25578}
25579
25580#[repr(transparent)]
25582pub struct WireLayoutParameter {
25583 raw: ::fidl_next::RawWireUnion,
25584}
25585
25586unsafe impl ::fidl_next::ZeroPadding for WireLayoutParameter {
25587 #[inline]
25588 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
25589 ::fidl_next::munge!(let Self { raw } = out);
25590 ::fidl_next::RawWireUnion::zero_padding(raw);
25591 }
25592}
25593
25594pub mod layout_parameter {
25595 pub enum Ref<'union> {
25596 NestedType(&'union crate::WireConfigType),
25597
25598 UnknownOrdinal_(u64),
25599 }
25600}
25601
25602impl WireLayoutParameter {
25603 pub fn as_ref(&self) -> crate::layout_parameter::Ref<'_> {
25604 match self.raw.ordinal() {
25605 1 => crate::layout_parameter::Ref::NestedType(unsafe {
25606 self.raw.get().deref_unchecked::<crate::WireConfigType>()
25607 }),
25608
25609 unknown => crate::layout_parameter::Ref::UnknownOrdinal_(unknown),
25610 }
25611 }
25612}
25613
25614unsafe impl<___D> ::fidl_next::Decode<___D> for WireLayoutParameter
25615where
25616 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
25617
25618 ___D: ::fidl_next::Decoder,
25619{
25620 fn decode(
25621 mut slot: ::fidl_next::Slot<'_, Self>,
25622 decoder: &mut ___D,
25623 ) -> Result<(), ::fidl_next::DecodeError> {
25624 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
25625 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
25626 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigType>(raw, decoder)?,
25627
25628 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
25629 }
25630
25631 Ok(())
25632 }
25633}
25634
25635impl ::core::fmt::Debug for WireLayoutParameter {
25636 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
25637 match self.raw.ordinal() {
25638 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireConfigType>().fmt(f) },
25639 _ => unsafe { ::core::hint::unreachable_unchecked() },
25640 }
25641 }
25642}
25643
25644#[repr(transparent)]
25645pub struct WireOptionalLayoutParameter {
25646 raw: ::fidl_next::RawWireUnion,
25647}
25648
25649unsafe impl ::fidl_next::ZeroPadding for WireOptionalLayoutParameter {
25650 #[inline]
25651 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
25652 ::fidl_next::munge!(let Self { raw } = out);
25653 ::fidl_next::RawWireUnion::zero_padding(raw);
25654 }
25655}
25656
25657impl WireOptionalLayoutParameter {
25658 pub fn is_some(&self) -> bool {
25659 self.raw.is_some()
25660 }
25661
25662 pub fn is_none(&self) -> bool {
25663 self.raw.is_none()
25664 }
25665
25666 pub fn as_ref(&self) -> Option<&WireLayoutParameter> {
25667 if self.is_some() {
25668 Some(unsafe { &*(self as *const Self).cast() })
25669 } else {
25670 None
25671 }
25672 }
25673}
25674
25675unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalLayoutParameter
25676where
25677 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
25678
25679 ___D: ::fidl_next::Decoder,
25680{
25681 fn decode(
25682 mut slot: ::fidl_next::Slot<'_, Self>,
25683 decoder: &mut ___D,
25684 ) -> Result<(), ::fidl_next::DecodeError> {
25685 ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
25686 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
25687 1 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireConfigType>(raw, decoder)?,
25688
25689 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
25690 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
25691 }
25692
25693 Ok(())
25694 }
25695}
25696
25697impl ::core::fmt::Debug for WireOptionalLayoutParameter {
25698 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
25699 self.as_ref().fmt(f)
25700 }
25701}
25702
25703pub const MAX_MONIKER_LENGTH: u32 = 4096;
25704
25705#[doc = " The maximum number of EventSubscriptions in an EventStream.\n"]
25706pub const MAX_NUM_EVENT_STREAM_SUBSCRIPTIONS: u64 = 100;
25707
25708#[derive(Clone, Debug)]
25709pub struct ResolvedConfigField {
25710 pub key: String,
25711
25712 pub value: crate::ConfigValue,
25713}
25714
25715impl ::fidl_next::Encodable for ResolvedConfigField {
25716 type Encoded = WireResolvedConfigField;
25717}
25718
25719unsafe impl<___E> ::fidl_next::Encode<___E> for ResolvedConfigField
25720where
25721 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
25722
25723 ___E: ::fidl_next::Encoder,
25724{
25725 #[inline]
25726 fn encode(
25727 self,
25728 encoder: &mut ___E,
25729 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25730 ) -> Result<(), ::fidl_next::EncodeError> {
25731 ::fidl_next::munge! {
25732 let Self::Encoded {
25733 key,
25734 value,
25735
25736 } = out;
25737 }
25738
25739 ::fidl_next::Encode::encode(self.key, encoder, key)?;
25740
25741 ::fidl_next::Encode::encode(self.value, encoder, value)?;
25742
25743 Ok(())
25744 }
25745}
25746
25747unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolvedConfigField
25748where
25749 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
25750
25751 ___E: ::fidl_next::Encoder,
25752{
25753 #[inline]
25754 fn encode_ref(
25755 &self,
25756 encoder: &mut ___E,
25757 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25758 ) -> Result<(), ::fidl_next::EncodeError> {
25759 ::fidl_next::munge! {
25760 let Self::Encoded {
25761 key,
25762 value,
25763
25764 } = out;
25765 }
25766
25767 ::fidl_next::EncodeRef::encode_ref(&self.key, encoder, key)?;
25768
25769 ::fidl_next::EncodeRef::encode_ref(&self.value, encoder, value)?;
25770
25771 Ok(())
25772 }
25773}
25774
25775impl ::fidl_next::EncodableOption for Box<ResolvedConfigField> {
25776 type EncodedOption = ::fidl_next::WireBox<WireResolvedConfigField>;
25777}
25778
25779unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ResolvedConfigField>
25780where
25781 ___E: ::fidl_next::Encoder + ?Sized,
25782 ResolvedConfigField: ::fidl_next::Encode<___E>,
25783{
25784 #[inline]
25785 fn encode_option(
25786 this: Option<Self>,
25787 encoder: &mut ___E,
25788 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
25789 ) -> Result<(), ::fidl_next::EncodeError> {
25790 if let Some(inner) = this {
25791 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
25792 ::fidl_next::WireBox::encode_present(out);
25793 } else {
25794 ::fidl_next::WireBox::encode_absent(out);
25795 }
25796
25797 Ok(())
25798 }
25799}
25800
25801unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ResolvedConfigField>
25802where
25803 ___E: ::fidl_next::Encoder + ?Sized,
25804 ResolvedConfigField: ::fidl_next::EncodeRef<___E>,
25805{
25806 #[inline]
25807 fn encode_option_ref(
25808 this: Option<&Self>,
25809 encoder: &mut ___E,
25810 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
25811 ) -> Result<(), ::fidl_next::EncodeError> {
25812 if let Some(inner) = this {
25813 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
25814 ::fidl_next::WireBox::encode_present(out);
25815 } else {
25816 ::fidl_next::WireBox::encode_absent(out);
25817 }
25818
25819 Ok(())
25820 }
25821}
25822
25823impl ::fidl_next::TakeFrom<WireResolvedConfigField> for ResolvedConfigField {
25824 #[inline]
25825 fn take_from(from: &WireResolvedConfigField) -> Self {
25826 Self {
25827 key: ::fidl_next::TakeFrom::take_from(&from.key),
25828
25829 value: ::fidl_next::TakeFrom::take_from(&from.value),
25830 }
25831 }
25832}
25833
25834#[derive(Debug)]
25836#[repr(C)]
25837pub struct WireResolvedConfigField {
25838 pub key: ::fidl_next::WireString,
25839
25840 pub value: crate::WireConfigValue,
25841}
25842
25843unsafe impl ::fidl_next::ZeroPadding for WireResolvedConfigField {
25844 #[inline]
25845 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
25846}
25847
25848unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolvedConfigField
25849where
25850 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
25851
25852 ___D: ::fidl_next::Decoder,
25853{
25854 fn decode(
25855 slot: ::fidl_next::Slot<'_, Self>,
25856 decoder: &mut ___D,
25857 ) -> Result<(), ::fidl_next::DecodeError> {
25858 ::fidl_next::munge! {
25859 let Self {
25860 mut key,
25861 mut value,
25862
25863 } = slot;
25864 }
25865
25866 ::fidl_next::Decode::decode(key.as_mut(), decoder)?;
25867
25868 ::fidl_next::Decode::decode(value.as_mut(), decoder)?;
25869
25870 Ok(())
25871 }
25872}
25873
25874#[doc = " A configuration that has been completely resolved by component manager.\n"]
25875#[derive(Clone, Debug)]
25876pub struct ResolvedConfig {
25877 pub fields: Vec<crate::ResolvedConfigField>,
25878
25879 pub checksum: crate::ConfigChecksum,
25880}
25881
25882impl ::fidl_next::Encodable for ResolvedConfig {
25883 type Encoded = WireResolvedConfig;
25884}
25885
25886unsafe impl<___E> ::fidl_next::Encode<___E> for ResolvedConfig
25887where
25888 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
25889
25890 ___E: ::fidl_next::Encoder,
25891{
25892 #[inline]
25893 fn encode(
25894 self,
25895 encoder: &mut ___E,
25896 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25897 ) -> Result<(), ::fidl_next::EncodeError> {
25898 ::fidl_next::munge! {
25899 let Self::Encoded {
25900 fields,
25901 checksum,
25902
25903 } = out;
25904 }
25905
25906 ::fidl_next::Encode::encode(self.fields, encoder, fields)?;
25907
25908 ::fidl_next::Encode::encode(self.checksum, encoder, checksum)?;
25909
25910 Ok(())
25911 }
25912}
25913
25914unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolvedConfig
25915where
25916 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
25917
25918 ___E: ::fidl_next::Encoder,
25919{
25920 #[inline]
25921 fn encode_ref(
25922 &self,
25923 encoder: &mut ___E,
25924 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
25925 ) -> Result<(), ::fidl_next::EncodeError> {
25926 ::fidl_next::munge! {
25927 let Self::Encoded {
25928 fields,
25929 checksum,
25930
25931 } = out;
25932 }
25933
25934 ::fidl_next::EncodeRef::encode_ref(&self.fields, encoder, fields)?;
25935
25936 ::fidl_next::EncodeRef::encode_ref(&self.checksum, encoder, checksum)?;
25937
25938 Ok(())
25939 }
25940}
25941
25942impl ::fidl_next::EncodableOption for Box<ResolvedConfig> {
25943 type EncodedOption = ::fidl_next::WireBox<WireResolvedConfig>;
25944}
25945
25946unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ResolvedConfig>
25947where
25948 ___E: ::fidl_next::Encoder + ?Sized,
25949 ResolvedConfig: ::fidl_next::Encode<___E>,
25950{
25951 #[inline]
25952 fn encode_option(
25953 this: Option<Self>,
25954 encoder: &mut ___E,
25955 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
25956 ) -> Result<(), ::fidl_next::EncodeError> {
25957 if let Some(inner) = this {
25958 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
25959 ::fidl_next::WireBox::encode_present(out);
25960 } else {
25961 ::fidl_next::WireBox::encode_absent(out);
25962 }
25963
25964 Ok(())
25965 }
25966}
25967
25968unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<ResolvedConfig>
25969where
25970 ___E: ::fidl_next::Encoder + ?Sized,
25971 ResolvedConfig: ::fidl_next::EncodeRef<___E>,
25972{
25973 #[inline]
25974 fn encode_option_ref(
25975 this: Option<&Self>,
25976 encoder: &mut ___E,
25977 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
25978 ) -> Result<(), ::fidl_next::EncodeError> {
25979 if let Some(inner) = this {
25980 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
25981 ::fidl_next::WireBox::encode_present(out);
25982 } else {
25983 ::fidl_next::WireBox::encode_absent(out);
25984 }
25985
25986 Ok(())
25987 }
25988}
25989
25990impl ::fidl_next::TakeFrom<WireResolvedConfig> for ResolvedConfig {
25991 #[inline]
25992 fn take_from(from: &WireResolvedConfig) -> Self {
25993 Self {
25994 fields: ::fidl_next::TakeFrom::take_from(&from.fields),
25995
25996 checksum: ::fidl_next::TakeFrom::take_from(&from.checksum),
25997 }
25998 }
25999}
26000
26001#[derive(Debug)]
26003#[repr(C)]
26004pub struct WireResolvedConfig {
26005 pub fields: ::fidl_next::WireVector<crate::WireResolvedConfigField>,
26006
26007 pub checksum: crate::WireConfigChecksum,
26008}
26009
26010unsafe impl ::fidl_next::ZeroPadding for WireResolvedConfig {
26011 #[inline]
26012 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
26013}
26014
26015unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolvedConfig
26016where
26017 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
26018
26019 ___D: ::fidl_next::Decoder,
26020{
26021 fn decode(
26022 slot: ::fidl_next::Slot<'_, Self>,
26023 decoder: &mut ___D,
26024 ) -> Result<(), ::fidl_next::DecodeError> {
26025 ::fidl_next::munge! {
26026 let Self {
26027 mut fields,
26028 mut checksum,
26029
26030 } = slot;
26031 }
26032
26033 ::fidl_next::Decode::decode(fields.as_mut(), decoder)?;
26034
26035 ::fidl_next::Decode::decode(checksum.as_mut(), decoder)?;
26036
26037 Ok(())
26038 }
26039}
26040
26041pub mod compat {
26043
26044 impl ::fidl_next::TakeFrom<crate::WireAllowedOffers>
26045 for ::fidl_fuchsia_component_decl::AllowedOffers
26046 {
26047 #[inline]
26048 fn take_from(from: &crate::WireAllowedOffers) -> Self {
26049 match crate::AllowedOffers::from(*from) {
26050 crate::AllowedOffers::StaticOnly => Self::StaticOnly,
26051
26052 crate::AllowedOffers::StaticAndDynamic => Self::StaticAndDynamic,
26053 }
26054 }
26055 }
26056
26057 impl ::fidl_next::TakeFrom<crate::WireAvailability>
26058 for ::fidl_fuchsia_component_decl::Availability
26059 {
26060 #[inline]
26061 fn take_from(from: &crate::WireAvailability) -> Self {
26062 match crate::Availability::from(*from) {
26063 crate::Availability::Required => Self::Required,
26064
26065 crate::Availability::Optional => Self::Optional,
26066
26067 crate::Availability::SameAsTarget => Self::SameAsTarget,
26068
26069 crate::Availability::Transitional => Self::Transitional,
26070 }
26071 }
26072 }
26073
26074 impl ::fidl_next::TakeFrom<crate::WireService> for ::fidl_fuchsia_component_decl::Service {
26075 #[inline]
26076 fn take_from(from: &crate::WireService) -> Self {
26077 Self {
26078 name: from.name().map(::fidl_next::TakeFrom::take_from),
26079
26080 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
26081
26082 __source_breaking: ::fidl::marker::SourceBreaking,
26083 }
26084 }
26085 }
26086
26087 impl ::fidl_next::TakeFrom<crate::WireDirectory> for ::fidl_fuchsia_component_decl::Directory {
26088 #[inline]
26089 fn take_from(from: &crate::WireDirectory) -> Self {
26090 Self {
26091 name: from.name().map(::fidl_next::TakeFrom::take_from),
26092
26093 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
26094
26095 rights: from.rights().map(::fidl_next::TakeFrom::take_from),
26096
26097 __source_breaking: ::fidl::marker::SourceBreaking,
26098 }
26099 }
26100 }
26101
26102 impl ::fidl_next::TakeFrom<crate::WireParentRef> for ::fidl_fuchsia_component_decl::ParentRef {
26103 #[inline]
26104 fn take_from(from: &crate::WireParentRef) -> Self {
26105 Self {}
26106 }
26107 }
26108
26109 impl ::fidl_next::TakeFrom<crate::WireSelfRef> for ::fidl_fuchsia_component_decl::SelfRef {
26110 #[inline]
26111 fn take_from(from: &crate::WireSelfRef) -> Self {
26112 Self {}
26113 }
26114 }
26115
26116 impl ::fidl_next::TakeFrom<crate::WireChildRef> for ::fidl_fuchsia_component_decl::ChildRef {
26117 #[inline]
26118 fn take_from(from: &crate::WireChildRef) -> Self {
26119 Self {
26120 name: ::fidl_next::TakeFrom::take_from(&from.name),
26121
26122 collection: ::fidl_next::TakeFrom::take_from(&from.collection),
26123 }
26124 }
26125 }
26126
26127 impl ::fidl_next::TakeFrom<crate::WireCollectionRef>
26128 for ::fidl_fuchsia_component_decl::CollectionRef
26129 {
26130 #[inline]
26131 fn take_from(from: &crate::WireCollectionRef) -> Self {
26132 Self { name: ::fidl_next::TakeFrom::take_from(&from.name) }
26133 }
26134 }
26135
26136 impl ::fidl_next::TakeFrom<crate::WireFrameworkRef>
26137 for ::fidl_fuchsia_component_decl::FrameworkRef
26138 {
26139 #[inline]
26140 fn take_from(from: &crate::WireFrameworkRef) -> Self {
26141 Self {}
26142 }
26143 }
26144
26145 impl ::fidl_next::TakeFrom<crate::WireCapabilityRef>
26146 for ::fidl_fuchsia_component_decl::CapabilityRef
26147 {
26148 #[inline]
26149 fn take_from(from: &crate::WireCapabilityRef) -> Self {
26150 Self { name: ::fidl_next::TakeFrom::take_from(&from.name) }
26151 }
26152 }
26153
26154 impl ::fidl_next::TakeFrom<crate::WireDebugRef> for ::fidl_fuchsia_component_decl::DebugRef {
26155 #[inline]
26156 fn take_from(from: &crate::WireDebugRef) -> Self {
26157 Self {}
26158 }
26159 }
26160
26161 impl ::fidl_next::TakeFrom<crate::WireVoidRef> for ::fidl_fuchsia_component_decl::VoidRef {
26162 #[inline]
26163 fn take_from(from: &crate::WireVoidRef) -> Self {
26164 Self {}
26165 }
26166 }
26167
26168 impl ::fidl_next::TakeFrom<crate::WireStorageId> for ::fidl_fuchsia_component_decl::StorageId {
26169 #[inline]
26170 fn take_from(from: &crate::WireStorageId) -> Self {
26171 match crate::StorageId::from(*from) {
26172 crate::StorageId::StaticInstanceId => Self::StaticInstanceId,
26173
26174 crate::StorageId::StaticInstanceIdOrMoniker => Self::StaticInstanceIdOrMoniker,
26175 }
26176 }
26177 }
26178
26179 impl ::fidl_next::TakeFrom<crate::WireRunner> for ::fidl_fuchsia_component_decl::Runner {
26180 #[inline]
26181 fn take_from(from: &crate::WireRunner) -> Self {
26182 Self {
26183 name: from.name().map(::fidl_next::TakeFrom::take_from),
26184
26185 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
26186
26187 __source_breaking: ::fidl::marker::SourceBreaking,
26188 }
26189 }
26190 }
26191
26192 impl ::fidl_next::TakeFrom<crate::WireResolver> for ::fidl_fuchsia_component_decl::Resolver {
26193 #[inline]
26194 fn take_from(from: &crate::WireResolver) -> Self {
26195 Self {
26196 name: from.name().map(::fidl_next::TakeFrom::take_from),
26197
26198 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
26199
26200 __source_breaking: ::fidl::marker::SourceBreaking,
26201 }
26202 }
26203 }
26204
26205 impl ::fidl_next::TakeFrom<crate::WireEventStream> for ::fidl_fuchsia_component_decl::EventStream {
26206 #[inline]
26207 fn take_from(from: &crate::WireEventStream) -> Self {
26208 Self {
26209 name: from.name().map(::fidl_next::TakeFrom::take_from),
26210
26211 __source_breaking: ::fidl::marker::SourceBreaking,
26212 }
26213 }
26214 }
26215
26216 impl ::fidl_next::TakeFrom<crate::WireConfigSingleValue>
26217 for ::fidl_fuchsia_component_decl::ConfigSingleValue
26218 {
26219 #[inline]
26220 fn take_from(from: &crate::WireConfigSingleValue) -> Self {
26221 match from.as_ref() {
26222 crate::config_single_value::Ref::Bool(value) => {
26223 Self::Bool(::fidl_next::TakeFrom::take_from(value))
26224 }
26225
26226 crate::config_single_value::Ref::Uint8(value) => {
26227 Self::Uint8(::fidl_next::TakeFrom::take_from(value))
26228 }
26229
26230 crate::config_single_value::Ref::Uint16(value) => {
26231 Self::Uint16(::fidl_next::TakeFrom::take_from(value))
26232 }
26233
26234 crate::config_single_value::Ref::Uint32(value) => {
26235 Self::Uint32(::fidl_next::TakeFrom::take_from(value))
26236 }
26237
26238 crate::config_single_value::Ref::Uint64(value) => {
26239 Self::Uint64(::fidl_next::TakeFrom::take_from(value))
26240 }
26241
26242 crate::config_single_value::Ref::Int8(value) => {
26243 Self::Int8(::fidl_next::TakeFrom::take_from(value))
26244 }
26245
26246 crate::config_single_value::Ref::Int16(value) => {
26247 Self::Int16(::fidl_next::TakeFrom::take_from(value))
26248 }
26249
26250 crate::config_single_value::Ref::Int32(value) => {
26251 Self::Int32(::fidl_next::TakeFrom::take_from(value))
26252 }
26253
26254 crate::config_single_value::Ref::Int64(value) => {
26255 Self::Int64(::fidl_next::TakeFrom::take_from(value))
26256 }
26257
26258 crate::config_single_value::Ref::String(value) => {
26259 Self::String(::fidl_next::TakeFrom::take_from(value))
26260 }
26261
26262 crate::config_single_value::Ref::UnknownOrdinal_(unknown_ordinal) => {
26263 Self::__SourceBreaking { unknown_ordinal }
26264 }
26265 }
26266 }
26267 }
26268
26269 impl ::fidl_next::TakeFrom<crate::WireOptionalConfigSingleValue>
26270 for Option<Box<::fidl_fuchsia_component_decl::ConfigSingleValue>>
26271 {
26272 #[inline]
26273 fn take_from(from: &crate::WireOptionalConfigSingleValue) -> Self {
26274 if let Some(inner) = from.as_ref() {
26275 Some(::fidl_next::TakeFrom::take_from(inner))
26276 } else {
26277 None
26278 }
26279 }
26280 }
26281
26282 impl ::fidl_next::TakeFrom<crate::WireConfigVectorValue>
26283 for ::fidl_fuchsia_component_decl::ConfigVectorValue
26284 {
26285 #[inline]
26286 fn take_from(from: &crate::WireConfigVectorValue) -> Self {
26287 match from.as_ref() {
26288 crate::config_vector_value::Ref::BoolVector(value) => {
26289 Self::BoolVector(::fidl_next::TakeFrom::take_from(value))
26290 }
26291
26292 crate::config_vector_value::Ref::Uint8Vector(value) => {
26293 Self::Uint8Vector(::fidl_next::TakeFrom::take_from(value))
26294 }
26295
26296 crate::config_vector_value::Ref::Uint16Vector(value) => {
26297 Self::Uint16Vector(::fidl_next::TakeFrom::take_from(value))
26298 }
26299
26300 crate::config_vector_value::Ref::Uint32Vector(value) => {
26301 Self::Uint32Vector(::fidl_next::TakeFrom::take_from(value))
26302 }
26303
26304 crate::config_vector_value::Ref::Uint64Vector(value) => {
26305 Self::Uint64Vector(::fidl_next::TakeFrom::take_from(value))
26306 }
26307
26308 crate::config_vector_value::Ref::Int8Vector(value) => {
26309 Self::Int8Vector(::fidl_next::TakeFrom::take_from(value))
26310 }
26311
26312 crate::config_vector_value::Ref::Int16Vector(value) => {
26313 Self::Int16Vector(::fidl_next::TakeFrom::take_from(value))
26314 }
26315
26316 crate::config_vector_value::Ref::Int32Vector(value) => {
26317 Self::Int32Vector(::fidl_next::TakeFrom::take_from(value))
26318 }
26319
26320 crate::config_vector_value::Ref::Int64Vector(value) => {
26321 Self::Int64Vector(::fidl_next::TakeFrom::take_from(value))
26322 }
26323
26324 crate::config_vector_value::Ref::StringVector(value) => {
26325 Self::StringVector(::fidl_next::TakeFrom::take_from(value))
26326 }
26327
26328 crate::config_vector_value::Ref::UnknownOrdinal_(unknown_ordinal) => {
26329 Self::__SourceBreaking { unknown_ordinal }
26330 }
26331 }
26332 }
26333 }
26334
26335 impl ::fidl_next::TakeFrom<crate::WireOptionalConfigVectorValue>
26336 for Option<Box<::fidl_fuchsia_component_decl::ConfigVectorValue>>
26337 {
26338 #[inline]
26339 fn take_from(from: &crate::WireOptionalConfigVectorValue) -> Self {
26340 if let Some(inner) = from.as_ref() {
26341 Some(::fidl_next::TakeFrom::take_from(inner))
26342 } else {
26343 None
26344 }
26345 }
26346 }
26347
26348 impl ::fidl_next::TakeFrom<crate::WireConfigValue> for ::fidl_fuchsia_component_decl::ConfigValue {
26349 #[inline]
26350 fn take_from(from: &crate::WireConfigValue) -> Self {
26351 match from.as_ref() {
26352 crate::config_value::Ref::Single(value) => {
26353 Self::Single(::fidl_next::TakeFrom::take_from(value))
26354 }
26355
26356 crate::config_value::Ref::Vector(value) => {
26357 Self::Vector(::fidl_next::TakeFrom::take_from(value))
26358 }
26359
26360 crate::config_value::Ref::UnknownOrdinal_(unknown_ordinal) => {
26361 Self::__SourceBreaking { unknown_ordinal }
26362 }
26363 }
26364 }
26365 }
26366
26367 impl ::fidl_next::TakeFrom<crate::WireOptionalConfigValue>
26368 for Option<Box<::fidl_fuchsia_component_decl::ConfigValue>>
26369 {
26370 #[inline]
26371 fn take_from(from: &crate::WireOptionalConfigValue) -> Self {
26372 if let Some(inner) = from.as_ref() {
26373 Some(::fidl_next::TakeFrom::take_from(inner))
26374 } else {
26375 None
26376 }
26377 }
26378 }
26379
26380 impl ::fidl_next::TakeFrom<crate::WireConfiguration>
26381 for ::fidl_fuchsia_component_decl::Configuration
26382 {
26383 #[inline]
26384 fn take_from(from: &crate::WireConfiguration) -> Self {
26385 Self {
26386 name: from.name().map(::fidl_next::TakeFrom::take_from),
26387
26388 value: from.value().map(::fidl_next::TakeFrom::take_from),
26389
26390 __source_breaking: ::fidl::marker::SourceBreaking,
26391 }
26392 }
26393 }
26394
26395 impl ::fidl_next::TakeFrom<crate::WireDeliveryType>
26396 for ::fidl_fuchsia_component_decl::DeliveryType
26397 {
26398 #[inline]
26399 fn take_from(from: &crate::WireDeliveryType) -> Self {
26400 match crate::DeliveryType::from(*from) {
26401 crate::DeliveryType::Immediate => Self::Immediate,
26402
26403 crate::DeliveryType::OnReadable => Self::OnReadable,
26404
26405 crate::DeliveryType::UnknownOrdinal_(value) => {
26406 Self::__SourceBreaking { unknown_ordinal: value }
26407 }
26408 }
26409 }
26410 }
26411
26412 impl ::fidl_next::TakeFrom<crate::WireProtocol> for ::fidl_fuchsia_component_decl::Protocol {
26413 #[inline]
26414 fn take_from(from: &crate::WireProtocol) -> Self {
26415 Self {
26416 name: from.name().map(::fidl_next::TakeFrom::take_from),
26417
26418 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
26419
26420 delivery: from.delivery().map(::fidl_next::TakeFrom::take_from),
26421
26422 __source_breaking: ::fidl::marker::SourceBreaking,
26423 }
26424 }
26425 }
26426
26427 impl ::fidl_next::TakeFrom<crate::WireEnvironmentRef>
26428 for ::fidl_fuchsia_component_decl::EnvironmentRef
26429 {
26430 #[inline]
26431 fn take_from(from: &crate::WireEnvironmentRef) -> Self {
26432 Self {}
26433 }
26434 }
26435
26436 impl ::fidl_next::TakeFrom<crate::WireRef> for ::fidl_fuchsia_component_decl::Ref {
26437 #[inline]
26438 fn take_from(from: &crate::WireRef) -> Self {
26439 match from.as_ref() {
26440 crate::ref_::Ref::Parent(value) => {
26441 Self::Parent(::fidl_next::TakeFrom::take_from(value))
26442 }
26443
26444 crate::ref_::Ref::Self_(value) => {
26445 Self::Self_(::fidl_next::TakeFrom::take_from(value))
26446 }
26447
26448 crate::ref_::Ref::Child(value) => {
26449 Self::Child(::fidl_next::TakeFrom::take_from(value))
26450 }
26451
26452 crate::ref_::Ref::Collection(value) => {
26453 Self::Collection(::fidl_next::TakeFrom::take_from(value))
26454 }
26455
26456 crate::ref_::Ref::Framework(value) => {
26457 Self::Framework(::fidl_next::TakeFrom::take_from(value))
26458 }
26459
26460 crate::ref_::Ref::Capability(value) => {
26461 Self::Capability(::fidl_next::TakeFrom::take_from(value))
26462 }
26463
26464 crate::ref_::Ref::Debug(value) => {
26465 Self::Debug(::fidl_next::TakeFrom::take_from(value))
26466 }
26467
26468 crate::ref_::Ref::VoidType(value) => {
26469 Self::VoidType(::fidl_next::TakeFrom::take_from(value))
26470 }
26471
26472 crate::ref_::Ref::Environment(value) => {
26473 Self::Environment(::fidl_next::TakeFrom::take_from(value))
26474 }
26475
26476 crate::ref_::Ref::UnknownOrdinal_(unknown_ordinal) => {
26477 Self::__SourceBreaking { unknown_ordinal }
26478 }
26479 }
26480 }
26481 }
26482
26483 impl ::fidl_next::TakeFrom<crate::WireOptionalRef>
26484 for Option<Box<::fidl_fuchsia_component_decl::Ref>>
26485 {
26486 #[inline]
26487 fn take_from(from: &crate::WireOptionalRef) -> Self {
26488 if let Some(inner) = from.as_ref() {
26489 Some(::fidl_next::TakeFrom::take_from(inner))
26490 } else {
26491 None
26492 }
26493 }
26494 }
26495
26496 impl ::fidl_next::TakeFrom<crate::WireStorage> for ::fidl_fuchsia_component_decl::Storage {
26497 #[inline]
26498 fn take_from(from: &crate::WireStorage) -> Self {
26499 Self {
26500 name: from.name().map(::fidl_next::TakeFrom::take_from),
26501
26502 source: from.source().map(::fidl_next::TakeFrom::take_from),
26503
26504 backing_dir: from.backing_dir().map(::fidl_next::TakeFrom::take_from),
26505
26506 subdir: from.subdir().map(::fidl_next::TakeFrom::take_from),
26507
26508 storage_id: from.storage_id().map(::fidl_next::TakeFrom::take_from),
26509
26510 __source_breaking: ::fidl::marker::SourceBreaking,
26511 }
26512 }
26513 }
26514
26515 impl ::fidl_next::TakeFrom<crate::WireDictionary> for ::fidl_fuchsia_component_decl::Dictionary {
26516 #[inline]
26517 fn take_from(from: &crate::WireDictionary) -> Self {
26518 Self {
26519 name: from.name().map(::fidl_next::TakeFrom::take_from),
26520
26521 source: from.source().map(::fidl_next::TakeFrom::take_from),
26522
26523 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
26524
26525 source_path: from.source_path().map(::fidl_next::TakeFrom::take_from),
26526
26527 __source_breaking: ::fidl::marker::SourceBreaking,
26528 }
26529 }
26530 }
26531
26532 impl ::fidl_next::TakeFrom<crate::WireCapability> for ::fidl_fuchsia_component_decl::Capability {
26533 #[inline]
26534 fn take_from(from: &crate::WireCapability) -> Self {
26535 match from.as_ref() {
26536 crate::capability::Ref::Service(value) => {
26537 Self::Service(::fidl_next::TakeFrom::take_from(value))
26538 }
26539
26540 crate::capability::Ref::Protocol(value) => {
26541 Self::Protocol(::fidl_next::TakeFrom::take_from(value))
26542 }
26543
26544 crate::capability::Ref::Directory(value) => {
26545 Self::Directory(::fidl_next::TakeFrom::take_from(value))
26546 }
26547
26548 crate::capability::Ref::Storage(value) => {
26549 Self::Storage(::fidl_next::TakeFrom::take_from(value))
26550 }
26551
26552 crate::capability::Ref::Runner(value) => {
26553 Self::Runner(::fidl_next::TakeFrom::take_from(value))
26554 }
26555
26556 crate::capability::Ref::Resolver(value) => {
26557 Self::Resolver(::fidl_next::TakeFrom::take_from(value))
26558 }
26559
26560 crate::capability::Ref::EventStream(value) => {
26561 Self::EventStream(::fidl_next::TakeFrom::take_from(value))
26562 }
26563
26564 crate::capability::Ref::Dictionary(value) => {
26565 Self::Dictionary(::fidl_next::TakeFrom::take_from(value))
26566 }
26567
26568 crate::capability::Ref::Config(value) => {
26569 Self::Config(::fidl_next::TakeFrom::take_from(value))
26570 }
26571
26572 crate::capability::Ref::UnknownOrdinal_(unknown_ordinal) => {
26573 Self::__SourceBreaking { unknown_ordinal }
26574 }
26575 }
26576 }
26577 }
26578
26579 impl ::fidl_next::TakeFrom<crate::WireOptionalCapability>
26580 for Option<Box<::fidl_fuchsia_component_decl::Capability>>
26581 {
26582 #[inline]
26583 fn take_from(from: &crate::WireOptionalCapability) -> Self {
26584 if let Some(inner) = from.as_ref() {
26585 Some(::fidl_next::TakeFrom::take_from(inner))
26586 } else {
26587 None
26588 }
26589 }
26590 }
26591
26592 impl ::fidl_next::TakeFrom<crate::WireStartupMode> for ::fidl_fuchsia_component_decl::StartupMode {
26593 #[inline]
26594 fn take_from(from: &crate::WireStartupMode) -> Self {
26595 match crate::StartupMode::from(*from) {
26596 crate::StartupMode::Lazy => Self::Lazy,
26597
26598 crate::StartupMode::Eager => Self::Eager,
26599 }
26600 }
26601 }
26602
26603 impl ::fidl_next::TakeFrom<crate::WireOnTerminate> for ::fidl_fuchsia_component_decl::OnTerminate {
26604 #[inline]
26605 fn take_from(from: &crate::WireOnTerminate) -> Self {
26606 match crate::OnTerminate::from(*from) {
26607 crate::OnTerminate::None => Self::None,
26608
26609 crate::OnTerminate::Reboot => Self::Reboot,
26610 }
26611 }
26612 }
26613
26614 impl ::fidl_next::TakeFrom<crate::WireConfigOverride>
26615 for ::fidl_fuchsia_component_decl::ConfigOverride
26616 {
26617 #[inline]
26618 fn take_from(from: &crate::WireConfigOverride) -> Self {
26619 Self {
26620 key: from.key().map(::fidl_next::TakeFrom::take_from),
26621
26622 value: from.value().map(::fidl_next::TakeFrom::take_from),
26623
26624 __source_breaking: ::fidl::marker::SourceBreaking,
26625 }
26626 }
26627 }
26628
26629 impl ::fidl_next::TakeFrom<crate::WireChild> for ::fidl_fuchsia_component_decl::Child {
26630 #[inline]
26631 fn take_from(from: &crate::WireChild) -> Self {
26632 Self {
26633 name: from.name().map(::fidl_next::TakeFrom::take_from),
26634
26635 url: from.url().map(::fidl_next::TakeFrom::take_from),
26636
26637 startup: from.startup().map(::fidl_next::TakeFrom::take_from),
26638
26639 environment: from.environment().map(::fidl_next::TakeFrom::take_from),
26640
26641 on_terminate: from.on_terminate().map(::fidl_next::TakeFrom::take_from),
26642
26643 config_overrides: from.config_overrides().map(::fidl_next::TakeFrom::take_from),
26644
26645 __source_breaking: ::fidl::marker::SourceBreaking,
26646 }
26647 }
26648 }
26649
26650 impl ::fidl_next::TakeFrom<crate::WireDurability> for ::fidl_fuchsia_component_decl::Durability {
26651 #[inline]
26652 fn take_from(from: &crate::WireDurability) -> Self {
26653 match crate::Durability::from(*from) {
26654 crate::Durability::Transient => Self::Transient,
26655
26656 crate::Durability::SingleRun => Self::SingleRun,
26657 }
26658 }
26659 }
26660
26661 impl ::fidl_next::TakeFrom<crate::WireCollection> for ::fidl_fuchsia_component_decl::Collection {
26662 #[inline]
26663 fn take_from(from: &crate::WireCollection) -> Self {
26664 Self {
26665 name: from.name().map(::fidl_next::TakeFrom::take_from),
26666
26667 durability: from.durability().map(::fidl_next::TakeFrom::take_from),
26668
26669 environment: from.environment().map(::fidl_next::TakeFrom::take_from),
26670
26671 allowed_offers: from.allowed_offers().map(::fidl_next::TakeFrom::take_from),
26672
26673 allow_long_names: from.allow_long_names().map(::fidl_next::TakeFrom::take_from),
26674
26675 persistent_storage: from.persistent_storage().map(::fidl_next::TakeFrom::take_from),
26676
26677 __source_breaking: ::fidl::marker::SourceBreaking,
26678 }
26679 }
26680 }
26681
26682 impl ::fidl_next::TakeFrom<crate::WireDependencyType>
26683 for ::fidl_fuchsia_component_decl::DependencyType
26684 {
26685 #[inline]
26686 fn take_from(from: &crate::WireDependencyType) -> Self {
26687 match crate::DependencyType::from(*from) {
26688 crate::DependencyType::Strong => Self::Strong,
26689
26690 crate::DependencyType::Weak => Self::Weak,
26691 }
26692 }
26693 }
26694
26695 impl ::fidl_next::TakeFrom<crate::WireNameMapping> for ::fidl_fuchsia_component_decl::NameMapping {
26696 #[inline]
26697 fn take_from(from: &crate::WireNameMapping) -> Self {
26698 Self {
26699 source_name: ::fidl_next::TakeFrom::take_from(&from.source_name),
26700
26701 target_name: ::fidl_next::TakeFrom::take_from(&from.target_name),
26702 }
26703 }
26704 }
26705
26706 impl ::fidl_next::TakeFrom<crate::WireEnvironmentExtends>
26707 for ::fidl_fuchsia_component_decl::EnvironmentExtends
26708 {
26709 #[inline]
26710 fn take_from(from: &crate::WireEnvironmentExtends) -> Self {
26711 match crate::EnvironmentExtends::from(*from) {
26712 crate::EnvironmentExtends::None => Self::None,
26713
26714 crate::EnvironmentExtends::Realm => Self::Realm,
26715 }
26716 }
26717 }
26718
26719 impl ::fidl_next::TakeFrom<crate::WireConfigTypeLayout>
26720 for ::fidl_fuchsia_component_decl::ConfigTypeLayout
26721 {
26722 #[inline]
26723 fn take_from(from: &crate::WireConfigTypeLayout) -> Self {
26724 match crate::ConfigTypeLayout::from(*from) {
26725 crate::ConfigTypeLayout::Bool => Self::Bool,
26726
26727 crate::ConfigTypeLayout::Uint8 => Self::Uint8,
26728
26729 crate::ConfigTypeLayout::Uint16 => Self::Uint16,
26730
26731 crate::ConfigTypeLayout::Uint32 => Self::Uint32,
26732
26733 crate::ConfigTypeLayout::Uint64 => Self::Uint64,
26734
26735 crate::ConfigTypeLayout::Int8 => Self::Int8,
26736
26737 crate::ConfigTypeLayout::Int16 => Self::Int16,
26738
26739 crate::ConfigTypeLayout::Int32 => Self::Int32,
26740
26741 crate::ConfigTypeLayout::Int64 => Self::Int64,
26742
26743 crate::ConfigTypeLayout::String => Self::String,
26744
26745 crate::ConfigTypeLayout::Vector => Self::Vector,
26746
26747 crate::ConfigTypeLayout::UnknownOrdinal_(value) => {
26748 Self::__SourceBreaking { unknown_ordinal: value }
26749 }
26750 }
26751 }
26752 }
26753
26754 impl ::fidl_next::TakeFrom<crate::WireLayoutConstraint>
26755 for ::fidl_fuchsia_component_decl::LayoutConstraint
26756 {
26757 #[inline]
26758 fn take_from(from: &crate::WireLayoutConstraint) -> Self {
26759 match from.as_ref() {
26760 crate::layout_constraint::Ref::MaxSize(value) => {
26761 Self::MaxSize(::fidl_next::TakeFrom::take_from(value))
26762 }
26763
26764 crate::layout_constraint::Ref::UnknownOrdinal_(unknown_ordinal) => {
26765 Self::__SourceBreaking { unknown_ordinal }
26766 }
26767 }
26768 }
26769 }
26770
26771 impl ::fidl_next::TakeFrom<crate::WireOptionalLayoutConstraint>
26772 for Option<Box<::fidl_fuchsia_component_decl::LayoutConstraint>>
26773 {
26774 #[inline]
26775 fn take_from(from: &crate::WireOptionalLayoutConstraint) -> Self {
26776 if let Some(inner) = from.as_ref() {
26777 Some(::fidl_next::TakeFrom::take_from(inner))
26778 } else {
26779 None
26780 }
26781 }
26782 }
26783
26784 impl ::fidl_next::TakeFrom<crate::WireConfigType> for ::fidl_fuchsia_component_decl::ConfigType {
26785 #[inline]
26786 fn take_from(from: &crate::WireConfigType) -> Self {
26787 Self {
26788 layout: ::fidl_next::TakeFrom::take_from(&from.layout),
26789
26790 parameters: ::fidl_next::TakeFrom::take_from(&from.parameters),
26791
26792 constraints: ::fidl_next::TakeFrom::take_from(&from.constraints),
26793 }
26794 }
26795 }
26796
26797 impl ::fidl_next::TakeFrom<crate::WireConfigChecksum>
26798 for ::fidl_fuchsia_component_decl::ConfigChecksum
26799 {
26800 #[inline]
26801 fn take_from(from: &crate::WireConfigChecksum) -> Self {
26802 match from.as_ref() {
26803 crate::config_checksum::Ref::Sha256(value) => {
26804 Self::Sha256(::fidl_next::TakeFrom::take_from(value))
26805 }
26806
26807 crate::config_checksum::Ref::UnknownOrdinal_(unknown_ordinal) => {
26808 Self::__SourceBreaking { unknown_ordinal }
26809 }
26810 }
26811 }
26812 }
26813
26814 impl ::fidl_next::TakeFrom<crate::WireOptionalConfigChecksum>
26815 for Option<Box<::fidl_fuchsia_component_decl::ConfigChecksum>>
26816 {
26817 #[inline]
26818 fn take_from(from: &crate::WireOptionalConfigChecksum) -> Self {
26819 if let Some(inner) = from.as_ref() {
26820 Some(::fidl_next::TakeFrom::take_from(inner))
26821 } else {
26822 None
26823 }
26824 }
26825 }
26826
26827 impl ::fidl_next::TakeFrom<crate::WireUseStorage> for ::fidl_fuchsia_component_decl::UseStorage {
26828 #[inline]
26829 fn take_from(from: &crate::WireUseStorage) -> Self {
26830 Self {
26831 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
26832
26833 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
26834
26835 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
26836
26837 __source_breaking: ::fidl::marker::SourceBreaking,
26838 }
26839 }
26840 }
26841
26842 impl ::fidl_next::TakeFrom<crate::WireConfigMutability>
26843 for ::fidl_fuchsia_component_decl::ConfigMutability
26844 {
26845 #[inline]
26846 fn take_from(from: &crate::WireConfigMutability) -> Self {
26847 Self::from_bits_retain(from.value.into())
26848 }
26849 }
26850
26851 impl ::fidl_next::TakeFrom<crate::WireConfigField> for ::fidl_fuchsia_component_decl::ConfigField {
26852 #[inline]
26853 fn take_from(from: &crate::WireConfigField) -> Self {
26854 Self {
26855 key: from.key().map(::fidl_next::TakeFrom::take_from),
26856
26857 type_: from.type_().map(::fidl_next::TakeFrom::take_from),
26858
26859 mutability: from.mutability().map(::fidl_next::TakeFrom::take_from),
26860
26861 __source_breaking: ::fidl::marker::SourceBreaking,
26862 }
26863 }
26864 }
26865
26866 impl ::fidl_next::TakeFrom<crate::WireProgram> for ::fidl_fuchsia_component_decl::Program {
26867 #[inline]
26868 fn take_from(from: &crate::WireProgram) -> Self {
26869 Self {
26870 runner: from.runner().map(::fidl_next::TakeFrom::take_from),
26871
26872 info: from.info().map(::fidl_next::TakeFrom::take_from),
26873
26874 __source_breaking: ::fidl::marker::SourceBreaking,
26875 }
26876 }
26877 }
26878
26879 impl ::fidl_next::TakeFrom<crate::WireUseService> for ::fidl_fuchsia_component_decl::UseService {
26880 #[inline]
26881 fn take_from(from: &crate::WireUseService) -> Self {
26882 Self {
26883 source: from.source().map(::fidl_next::TakeFrom::take_from),
26884
26885 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
26886
26887 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
26888
26889 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
26890
26891 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
26892
26893 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
26894
26895 __source_breaking: ::fidl::marker::SourceBreaking,
26896 }
26897 }
26898 }
26899
26900 impl ::fidl_next::TakeFrom<crate::WireUseProtocol> for ::fidl_fuchsia_component_decl::UseProtocol {
26901 #[inline]
26902 fn take_from(from: &crate::WireUseProtocol) -> Self {
26903 Self {
26904 source: from.source().map(::fidl_next::TakeFrom::take_from),
26905
26906 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
26907
26908 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
26909
26910 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
26911
26912 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
26913
26914 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
26915
26916 __source_breaking: ::fidl::marker::SourceBreaking,
26917 }
26918 }
26919 }
26920
26921 impl ::fidl_next::TakeFrom<crate::WireUseDirectory>
26922 for ::fidl_fuchsia_component_decl::UseDirectory
26923 {
26924 #[inline]
26925 fn take_from(from: &crate::WireUseDirectory) -> Self {
26926 Self {
26927 source: from.source().map(::fidl_next::TakeFrom::take_from),
26928
26929 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
26930
26931 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
26932
26933 rights: from.rights().map(::fidl_next::TakeFrom::take_from),
26934
26935 subdir: from.subdir().map(::fidl_next::TakeFrom::take_from),
26936
26937 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
26938
26939 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
26940
26941 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
26942
26943 __source_breaking: ::fidl::marker::SourceBreaking,
26944 }
26945 }
26946 }
26947
26948 impl ::fidl_next::TakeFrom<crate::WireUseEventStream>
26949 for ::fidl_fuchsia_component_decl::UseEventStream
26950 {
26951 #[inline]
26952 fn take_from(from: &crate::WireUseEventStream) -> Self {
26953 Self {
26954 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
26955
26956 source: from.source().map(::fidl_next::TakeFrom::take_from),
26957
26958 scope: from.scope().map(::fidl_next::TakeFrom::take_from),
26959
26960 target_path: from.target_path().map(::fidl_next::TakeFrom::take_from),
26961
26962 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
26963
26964 filter: from.filter().map(::fidl_next::TakeFrom::take_from),
26965
26966 __source_breaking: ::fidl::marker::SourceBreaking,
26967 }
26968 }
26969 }
26970
26971 impl ::fidl_next::TakeFrom<crate::WireUseRunner> for ::fidl_fuchsia_component_decl::UseRunner {
26972 #[inline]
26973 fn take_from(from: &crate::WireUseRunner) -> Self {
26974 Self {
26975 source: from.source().map(::fidl_next::TakeFrom::take_from),
26976
26977 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
26978
26979 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
26980
26981 __source_breaking: ::fidl::marker::SourceBreaking,
26982 }
26983 }
26984 }
26985
26986 impl ::fidl_next::TakeFrom<crate::WireUseConfiguration>
26987 for ::fidl_fuchsia_component_decl::UseConfiguration
26988 {
26989 #[inline]
26990 fn take_from(from: &crate::WireUseConfiguration) -> Self {
26991 Self {
26992 source: from.source().map(::fidl_next::TakeFrom::take_from),
26993
26994 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
26995
26996 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
26997
26998 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
26999
27000 type_: from.type_().map(::fidl_next::TakeFrom::take_from),
27001
27002 default: from.default().map(::fidl_next::TakeFrom::take_from),
27003
27004 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27005
27006 __source_breaking: ::fidl::marker::SourceBreaking,
27007 }
27008 }
27009 }
27010
27011 impl ::fidl_next::TakeFrom<crate::WireUse> for ::fidl_fuchsia_component_decl::Use {
27012 #[inline]
27013 fn take_from(from: &crate::WireUse) -> Self {
27014 match from.as_ref() {
27015 crate::use_::Ref::Service(value) => {
27016 Self::Service(::fidl_next::TakeFrom::take_from(value))
27017 }
27018
27019 crate::use_::Ref::Protocol(value) => {
27020 Self::Protocol(::fidl_next::TakeFrom::take_from(value))
27021 }
27022
27023 crate::use_::Ref::Directory(value) => {
27024 Self::Directory(::fidl_next::TakeFrom::take_from(value))
27025 }
27026
27027 crate::use_::Ref::Storage(value) => {
27028 Self::Storage(::fidl_next::TakeFrom::take_from(value))
27029 }
27030
27031 crate::use_::Ref::EventStream(value) => {
27032 Self::EventStream(::fidl_next::TakeFrom::take_from(value))
27033 }
27034
27035 crate::use_::Ref::Runner(value) => {
27036 Self::Runner(::fidl_next::TakeFrom::take_from(value))
27037 }
27038
27039 crate::use_::Ref::Config(value) => {
27040 Self::Config(::fidl_next::TakeFrom::take_from(value))
27041 }
27042
27043 crate::use_::Ref::UnknownOrdinal_(unknown_ordinal) => {
27044 Self::__SourceBreaking { unknown_ordinal }
27045 }
27046 }
27047 }
27048 }
27049
27050 impl ::fidl_next::TakeFrom<crate::WireOptionalUse>
27051 for Option<Box<::fidl_fuchsia_component_decl::Use>>
27052 {
27053 #[inline]
27054 fn take_from(from: &crate::WireOptionalUse) -> Self {
27055 if let Some(inner) = from.as_ref() {
27056 Some(::fidl_next::TakeFrom::take_from(inner))
27057 } else {
27058 None
27059 }
27060 }
27061 }
27062
27063 impl ::fidl_next::TakeFrom<crate::WireExposeService>
27064 for ::fidl_fuchsia_component_decl::ExposeService
27065 {
27066 #[inline]
27067 fn take_from(from: &crate::WireExposeService) -> Self {
27068 Self {
27069 source: from.source().map(::fidl_next::TakeFrom::take_from),
27070
27071 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27072
27073 target: from.target().map(::fidl_next::TakeFrom::take_from),
27074
27075 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27076
27077 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27078
27079 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27080
27081 __source_breaking: ::fidl::marker::SourceBreaking,
27082 }
27083 }
27084 }
27085
27086 impl ::fidl_next::TakeFrom<crate::WireExposeProtocol>
27087 for ::fidl_fuchsia_component_decl::ExposeProtocol
27088 {
27089 #[inline]
27090 fn take_from(from: &crate::WireExposeProtocol) -> Self {
27091 Self {
27092 source: from.source().map(::fidl_next::TakeFrom::take_from),
27093
27094 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27095
27096 target: from.target().map(::fidl_next::TakeFrom::take_from),
27097
27098 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27099
27100 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27101
27102 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27103
27104 __source_breaking: ::fidl::marker::SourceBreaking,
27105 }
27106 }
27107 }
27108
27109 impl ::fidl_next::TakeFrom<crate::WireExposeDirectory>
27110 for ::fidl_fuchsia_component_decl::ExposeDirectory
27111 {
27112 #[inline]
27113 fn take_from(from: &crate::WireExposeDirectory) -> Self {
27114 Self {
27115 source: from.source().map(::fidl_next::TakeFrom::take_from),
27116
27117 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27118
27119 target: from.target().map(::fidl_next::TakeFrom::take_from),
27120
27121 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27122
27123 rights: from.rights().map(::fidl_next::TakeFrom::take_from),
27124
27125 subdir: from.subdir().map(::fidl_next::TakeFrom::take_from),
27126
27127 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27128
27129 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27130
27131 __source_breaking: ::fidl::marker::SourceBreaking,
27132 }
27133 }
27134 }
27135
27136 impl ::fidl_next::TakeFrom<crate::WireExposeRunner>
27137 for ::fidl_fuchsia_component_decl::ExposeRunner
27138 {
27139 #[inline]
27140 fn take_from(from: &crate::WireExposeRunner) -> Self {
27141 Self {
27142 source: from.source().map(::fidl_next::TakeFrom::take_from),
27143
27144 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27145
27146 target: from.target().map(::fidl_next::TakeFrom::take_from),
27147
27148 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27149
27150 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27151
27152 __source_breaking: ::fidl::marker::SourceBreaking,
27153 }
27154 }
27155 }
27156
27157 impl ::fidl_next::TakeFrom<crate::WireExposeResolver>
27158 for ::fidl_fuchsia_component_decl::ExposeResolver
27159 {
27160 #[inline]
27161 fn take_from(from: &crate::WireExposeResolver) -> Self {
27162 Self {
27163 source: from.source().map(::fidl_next::TakeFrom::take_from),
27164
27165 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27166
27167 target: from.target().map(::fidl_next::TakeFrom::take_from),
27168
27169 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27170
27171 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27172
27173 __source_breaking: ::fidl::marker::SourceBreaking,
27174 }
27175 }
27176 }
27177
27178 impl ::fidl_next::TakeFrom<crate::WireExposeDictionary>
27179 for ::fidl_fuchsia_component_decl::ExposeDictionary
27180 {
27181 #[inline]
27182 fn take_from(from: &crate::WireExposeDictionary) -> Self {
27183 Self {
27184 source: from.source().map(::fidl_next::TakeFrom::take_from),
27185
27186 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27187
27188 target: from.target().map(::fidl_next::TakeFrom::take_from),
27189
27190 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27191
27192 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27193
27194 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27195
27196 __source_breaking: ::fidl::marker::SourceBreaking,
27197 }
27198 }
27199 }
27200
27201 impl ::fidl_next::TakeFrom<crate::WireExposeConfiguration>
27202 for ::fidl_fuchsia_component_decl::ExposeConfiguration
27203 {
27204 #[inline]
27205 fn take_from(from: &crate::WireExposeConfiguration) -> Self {
27206 Self {
27207 source: from.source().map(::fidl_next::TakeFrom::take_from),
27208
27209 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27210
27211 target: from.target().map(::fidl_next::TakeFrom::take_from),
27212
27213 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27214
27215 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27216
27217 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27218
27219 __source_breaking: ::fidl::marker::SourceBreaking,
27220 }
27221 }
27222 }
27223
27224 impl ::fidl_next::TakeFrom<crate::WireExpose> for ::fidl_fuchsia_component_decl::Expose {
27225 #[inline]
27226 fn take_from(from: &crate::WireExpose) -> Self {
27227 match from.as_ref() {
27228 crate::expose::Ref::Service(value) => {
27229 Self::Service(::fidl_next::TakeFrom::take_from(value))
27230 }
27231
27232 crate::expose::Ref::Protocol(value) => {
27233 Self::Protocol(::fidl_next::TakeFrom::take_from(value))
27234 }
27235
27236 crate::expose::Ref::Directory(value) => {
27237 Self::Directory(::fidl_next::TakeFrom::take_from(value))
27238 }
27239
27240 crate::expose::Ref::Runner(value) => {
27241 Self::Runner(::fidl_next::TakeFrom::take_from(value))
27242 }
27243
27244 crate::expose::Ref::Resolver(value) => {
27245 Self::Resolver(::fidl_next::TakeFrom::take_from(value))
27246 }
27247
27248 crate::expose::Ref::Dictionary(value) => {
27249 Self::Dictionary(::fidl_next::TakeFrom::take_from(value))
27250 }
27251
27252 crate::expose::Ref::Config(value) => {
27253 Self::Config(::fidl_next::TakeFrom::take_from(value))
27254 }
27255
27256 crate::expose::Ref::UnknownOrdinal_(unknown_ordinal) => {
27257 Self::__SourceBreaking { unknown_ordinal }
27258 }
27259 }
27260 }
27261 }
27262
27263 impl ::fidl_next::TakeFrom<crate::WireOptionalExpose>
27264 for Option<Box<::fidl_fuchsia_component_decl::Expose>>
27265 {
27266 #[inline]
27267 fn take_from(from: &crate::WireOptionalExpose) -> Self {
27268 if let Some(inner) = from.as_ref() {
27269 Some(::fidl_next::TakeFrom::take_from(inner))
27270 } else {
27271 None
27272 }
27273 }
27274 }
27275
27276 impl ::fidl_next::TakeFrom<crate::WireOfferService>
27277 for ::fidl_fuchsia_component_decl::OfferService
27278 {
27279 #[inline]
27280 fn take_from(from: &crate::WireOfferService) -> Self {
27281 Self {
27282 source: from.source().map(::fidl_next::TakeFrom::take_from),
27283
27284 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27285
27286 target: from.target().map(::fidl_next::TakeFrom::take_from),
27287
27288 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27289
27290 source_instance_filter: from
27291 .source_instance_filter()
27292 .map(::fidl_next::TakeFrom::take_from),
27293
27294 renamed_instances: from.renamed_instances().map(::fidl_next::TakeFrom::take_from),
27295
27296 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27297
27298 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27299
27300 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
27301
27302 __source_breaking: ::fidl::marker::SourceBreaking,
27303 }
27304 }
27305 }
27306
27307 impl ::fidl_next::TakeFrom<crate::WireOfferProtocol>
27308 for ::fidl_fuchsia_component_decl::OfferProtocol
27309 {
27310 #[inline]
27311 fn take_from(from: &crate::WireOfferProtocol) -> Self {
27312 Self {
27313 source: from.source().map(::fidl_next::TakeFrom::take_from),
27314
27315 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27316
27317 target: from.target().map(::fidl_next::TakeFrom::take_from),
27318
27319 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27320
27321 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
27322
27323 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27324
27325 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27326
27327 __source_breaking: ::fidl::marker::SourceBreaking,
27328 }
27329 }
27330 }
27331
27332 impl ::fidl_next::TakeFrom<crate::WireOfferDirectory>
27333 for ::fidl_fuchsia_component_decl::OfferDirectory
27334 {
27335 #[inline]
27336 fn take_from(from: &crate::WireOfferDirectory) -> Self {
27337 Self {
27338 source: from.source().map(::fidl_next::TakeFrom::take_from),
27339
27340 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27341
27342 target: from.target().map(::fidl_next::TakeFrom::take_from),
27343
27344 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27345
27346 rights: from.rights().map(::fidl_next::TakeFrom::take_from),
27347
27348 subdir: from.subdir().map(::fidl_next::TakeFrom::take_from),
27349
27350 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
27351
27352 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27353
27354 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27355
27356 __source_breaking: ::fidl::marker::SourceBreaking,
27357 }
27358 }
27359 }
27360
27361 impl ::fidl_next::TakeFrom<crate::WireOfferStorage>
27362 for ::fidl_fuchsia_component_decl::OfferStorage
27363 {
27364 #[inline]
27365 fn take_from(from: &crate::WireOfferStorage) -> Self {
27366 Self {
27367 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27368
27369 source: from.source().map(::fidl_next::TakeFrom::take_from),
27370
27371 target: from.target().map(::fidl_next::TakeFrom::take_from),
27372
27373 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27374
27375 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27376
27377 __source_breaking: ::fidl::marker::SourceBreaking,
27378 }
27379 }
27380 }
27381
27382 impl ::fidl_next::TakeFrom<crate::WireOfferRunner> for ::fidl_fuchsia_component_decl::OfferRunner {
27383 #[inline]
27384 fn take_from(from: &crate::WireOfferRunner) -> Self {
27385 Self {
27386 source: from.source().map(::fidl_next::TakeFrom::take_from),
27387
27388 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27389
27390 target: from.target().map(::fidl_next::TakeFrom::take_from),
27391
27392 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27393
27394 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27395
27396 __source_breaking: ::fidl::marker::SourceBreaking,
27397 }
27398 }
27399 }
27400
27401 impl ::fidl_next::TakeFrom<crate::WireOfferResolver>
27402 for ::fidl_fuchsia_component_decl::OfferResolver
27403 {
27404 #[inline]
27405 fn take_from(from: &crate::WireOfferResolver) -> Self {
27406 Self {
27407 source: from.source().map(::fidl_next::TakeFrom::take_from),
27408
27409 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27410
27411 target: from.target().map(::fidl_next::TakeFrom::take_from),
27412
27413 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27414
27415 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27416
27417 __source_breaking: ::fidl::marker::SourceBreaking,
27418 }
27419 }
27420 }
27421
27422 impl ::fidl_next::TakeFrom<crate::WireOfferEventStream>
27423 for ::fidl_fuchsia_component_decl::OfferEventStream
27424 {
27425 #[inline]
27426 fn take_from(from: &crate::WireOfferEventStream) -> Self {
27427 Self {
27428 source: from.source().map(::fidl_next::TakeFrom::take_from),
27429
27430 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27431
27432 scope: from.scope().map(::fidl_next::TakeFrom::take_from),
27433
27434 target: from.target().map(::fidl_next::TakeFrom::take_from),
27435
27436 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27437
27438 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27439
27440 __source_breaking: ::fidl::marker::SourceBreaking,
27441 }
27442 }
27443 }
27444
27445 impl ::fidl_next::TakeFrom<crate::WireOfferDictionary>
27446 for ::fidl_fuchsia_component_decl::OfferDictionary
27447 {
27448 #[inline]
27449 fn take_from(from: &crate::WireOfferDictionary) -> Self {
27450 Self {
27451 source: from.source().map(::fidl_next::TakeFrom::take_from),
27452
27453 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27454
27455 target: from.target().map(::fidl_next::TakeFrom::take_from),
27456
27457 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27458
27459 dependency_type: from.dependency_type().map(::fidl_next::TakeFrom::take_from),
27460
27461 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27462
27463 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27464
27465 __source_breaking: ::fidl::marker::SourceBreaking,
27466 }
27467 }
27468 }
27469
27470 impl ::fidl_next::TakeFrom<crate::WireOfferConfiguration>
27471 for ::fidl_fuchsia_component_decl::OfferConfiguration
27472 {
27473 #[inline]
27474 fn take_from(from: &crate::WireOfferConfiguration) -> Self {
27475 Self {
27476 source: from.source().map(::fidl_next::TakeFrom::take_from),
27477
27478 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27479
27480 target: from.target().map(::fidl_next::TakeFrom::take_from),
27481
27482 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27483
27484 availability: from.availability().map(::fidl_next::TakeFrom::take_from),
27485
27486 source_dictionary: from.source_dictionary().map(::fidl_next::TakeFrom::take_from),
27487
27488 __source_breaking: ::fidl::marker::SourceBreaking,
27489 }
27490 }
27491 }
27492
27493 impl ::fidl_next::TakeFrom<crate::WireOffer> for ::fidl_fuchsia_component_decl::Offer {
27494 #[inline]
27495 fn take_from(from: &crate::WireOffer) -> Self {
27496 match from.as_ref() {
27497 crate::offer::Ref::Service(value) => {
27498 Self::Service(::fidl_next::TakeFrom::take_from(value))
27499 }
27500
27501 crate::offer::Ref::Protocol(value) => {
27502 Self::Protocol(::fidl_next::TakeFrom::take_from(value))
27503 }
27504
27505 crate::offer::Ref::Directory(value) => {
27506 Self::Directory(::fidl_next::TakeFrom::take_from(value))
27507 }
27508
27509 crate::offer::Ref::Storage(value) => {
27510 Self::Storage(::fidl_next::TakeFrom::take_from(value))
27511 }
27512
27513 crate::offer::Ref::Runner(value) => {
27514 Self::Runner(::fidl_next::TakeFrom::take_from(value))
27515 }
27516
27517 crate::offer::Ref::Resolver(value) => {
27518 Self::Resolver(::fidl_next::TakeFrom::take_from(value))
27519 }
27520
27521 crate::offer::Ref::EventStream(value) => {
27522 Self::EventStream(::fidl_next::TakeFrom::take_from(value))
27523 }
27524
27525 crate::offer::Ref::Dictionary(value) => {
27526 Self::Dictionary(::fidl_next::TakeFrom::take_from(value))
27527 }
27528
27529 crate::offer::Ref::Config(value) => {
27530 Self::Config(::fidl_next::TakeFrom::take_from(value))
27531 }
27532
27533 crate::offer::Ref::UnknownOrdinal_(unknown_ordinal) => {
27534 Self::__SourceBreaking { unknown_ordinal }
27535 }
27536 }
27537 }
27538 }
27539
27540 impl ::fidl_next::TakeFrom<crate::WireOptionalOffer>
27541 for Option<Box<::fidl_fuchsia_component_decl::Offer>>
27542 {
27543 #[inline]
27544 fn take_from(from: &crate::WireOptionalOffer) -> Self {
27545 if let Some(inner) = from.as_ref() {
27546 Some(::fidl_next::TakeFrom::take_from(inner))
27547 } else {
27548 None
27549 }
27550 }
27551 }
27552
27553 impl ::fidl_next::TakeFrom<crate::WireRunnerRegistration>
27554 for ::fidl_fuchsia_component_decl::RunnerRegistration
27555 {
27556 #[inline]
27557 fn take_from(from: &crate::WireRunnerRegistration) -> Self {
27558 Self {
27559 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27560
27561 source: from.source().map(::fidl_next::TakeFrom::take_from),
27562
27563 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27564
27565 __source_breaking: ::fidl::marker::SourceBreaking,
27566 }
27567 }
27568 }
27569
27570 impl ::fidl_next::TakeFrom<crate::WireResolverRegistration>
27571 for ::fidl_fuchsia_component_decl::ResolverRegistration
27572 {
27573 #[inline]
27574 fn take_from(from: &crate::WireResolverRegistration) -> Self {
27575 Self {
27576 resolver: from.resolver().map(::fidl_next::TakeFrom::take_from),
27577
27578 source: from.source().map(::fidl_next::TakeFrom::take_from),
27579
27580 scheme: from.scheme().map(::fidl_next::TakeFrom::take_from),
27581
27582 __source_breaking: ::fidl::marker::SourceBreaking,
27583 }
27584 }
27585 }
27586
27587 impl ::fidl_next::TakeFrom<crate::WireDebugProtocolRegistration>
27588 for ::fidl_fuchsia_component_decl::DebugProtocolRegistration
27589 {
27590 #[inline]
27591 fn take_from(from: &crate::WireDebugProtocolRegistration) -> Self {
27592 Self {
27593 source: from.source().map(::fidl_next::TakeFrom::take_from),
27594
27595 source_name: from.source_name().map(::fidl_next::TakeFrom::take_from),
27596
27597 target_name: from.target_name().map(::fidl_next::TakeFrom::take_from),
27598
27599 __source_breaking: ::fidl::marker::SourceBreaking,
27600 }
27601 }
27602 }
27603
27604 impl ::fidl_next::TakeFrom<crate::WireDebugRegistration>
27605 for ::fidl_fuchsia_component_decl::DebugRegistration
27606 {
27607 #[inline]
27608 fn take_from(from: &crate::WireDebugRegistration) -> Self {
27609 match from.as_ref() {
27610 crate::debug_registration::Ref::Protocol(value) => {
27611 Self::Protocol(::fidl_next::TakeFrom::take_from(value))
27612 }
27613
27614 crate::debug_registration::Ref::UnknownOrdinal_(unknown_ordinal) => {
27615 Self::__SourceBreaking { unknown_ordinal }
27616 }
27617 }
27618 }
27619 }
27620
27621 impl ::fidl_next::TakeFrom<crate::WireOptionalDebugRegistration>
27622 for Option<Box<::fidl_fuchsia_component_decl::DebugRegistration>>
27623 {
27624 #[inline]
27625 fn take_from(from: &crate::WireOptionalDebugRegistration) -> Self {
27626 if let Some(inner) = from.as_ref() {
27627 Some(::fidl_next::TakeFrom::take_from(inner))
27628 } else {
27629 None
27630 }
27631 }
27632 }
27633
27634 impl ::fidl_next::TakeFrom<crate::WireEnvironment> for ::fidl_fuchsia_component_decl::Environment {
27635 #[inline]
27636 fn take_from(from: &crate::WireEnvironment) -> Self {
27637 Self {
27638 name: from.name().map(::fidl_next::TakeFrom::take_from),
27639
27640 extends: from.extends().map(::fidl_next::TakeFrom::take_from),
27641
27642 runners: from.runners().map(::fidl_next::TakeFrom::take_from),
27643
27644 resolvers: from.resolvers().map(::fidl_next::TakeFrom::take_from),
27645
27646 debug_capabilities: from.debug_capabilities().map(::fidl_next::TakeFrom::take_from),
27647
27648 stop_timeout_ms: from.stop_timeout_ms().map(::fidl_next::TakeFrom::take_from),
27649
27650 __source_breaking: ::fidl::marker::SourceBreaking,
27651 }
27652 }
27653 }
27654
27655 impl ::fidl_next::TakeFrom<crate::WireConfigSourceCapabilities>
27656 for ::fidl_fuchsia_component_decl::ConfigSourceCapabilities
27657 {
27658 #[inline]
27659 fn take_from(from: &crate::WireConfigSourceCapabilities) -> Self {
27660 Self { __source_breaking: ::fidl::marker::SourceBreaking }
27661 }
27662 }
27663
27664 impl ::fidl_next::TakeFrom<crate::WireConfigValueSource>
27665 for ::fidl_fuchsia_component_decl::ConfigValueSource
27666 {
27667 #[inline]
27668 fn take_from(from: &crate::WireConfigValueSource) -> Self {
27669 match from.as_ref() {
27670 crate::config_value_source::Ref::PackagePath(value) => {
27671 Self::PackagePath(::fidl_next::TakeFrom::take_from(value))
27672 }
27673
27674 crate::config_value_source::Ref::Capabilities(value) => {
27675 Self::Capabilities(::fidl_next::TakeFrom::take_from(value))
27676 }
27677
27678 crate::config_value_source::Ref::UnknownOrdinal_(unknown_ordinal) => {
27679 Self::__SourceBreaking { unknown_ordinal }
27680 }
27681 }
27682 }
27683 }
27684
27685 impl ::fidl_next::TakeFrom<crate::WireOptionalConfigValueSource>
27686 for Option<Box<::fidl_fuchsia_component_decl::ConfigValueSource>>
27687 {
27688 #[inline]
27689 fn take_from(from: &crate::WireOptionalConfigValueSource) -> Self {
27690 if let Some(inner) = from.as_ref() {
27691 Some(::fidl_next::TakeFrom::take_from(inner))
27692 } else {
27693 None
27694 }
27695 }
27696 }
27697
27698 impl ::fidl_next::TakeFrom<crate::WireConfigSchema>
27699 for ::fidl_fuchsia_component_decl::ConfigSchema
27700 {
27701 #[inline]
27702 fn take_from(from: &crate::WireConfigSchema) -> Self {
27703 Self {
27704 fields: from.fields().map(::fidl_next::TakeFrom::take_from),
27705
27706 checksum: from.checksum().map(::fidl_next::TakeFrom::take_from),
27707
27708 value_source: from.value_source().map(::fidl_next::TakeFrom::take_from),
27709
27710 __source_breaking: ::fidl::marker::SourceBreaking,
27711 }
27712 }
27713 }
27714
27715 impl ::fidl_next::TakeFrom<crate::WireComponent> for ::fidl_fuchsia_component_decl::Component {
27716 #[inline]
27717 fn take_from(from: &crate::WireComponent) -> Self {
27718 Self {
27719 program: from.program().map(::fidl_next::TakeFrom::take_from),
27720
27721 uses: from.uses().map(::fidl_next::TakeFrom::take_from),
27722
27723 exposes: from.exposes().map(::fidl_next::TakeFrom::take_from),
27724
27725 offers: from.offers().map(::fidl_next::TakeFrom::take_from),
27726
27727 capabilities: from.capabilities().map(::fidl_next::TakeFrom::take_from),
27728
27729 children: from.children().map(::fidl_next::TakeFrom::take_from),
27730
27731 collections: from.collections().map(::fidl_next::TakeFrom::take_from),
27732
27733 environments: from.environments().map(::fidl_next::TakeFrom::take_from),
27734
27735 facets: from.facets().map(::fidl_next::TakeFrom::take_from),
27736
27737 config: from.config().map(::fidl_next::TakeFrom::take_from),
27738
27739 __source_breaking: ::fidl::marker::SourceBreaking,
27740 }
27741 }
27742 }
27743
27744 impl ::fidl_next::TakeFrom<crate::WireConfigValueSpec>
27745 for ::fidl_fuchsia_component_decl::ConfigValueSpec
27746 {
27747 #[inline]
27748 fn take_from(from: &crate::WireConfigValueSpec) -> Self {
27749 Self {
27750 value: from.value().map(::fidl_next::TakeFrom::take_from),
27751
27752 __source_breaking: ::fidl::marker::SourceBreaking,
27753 }
27754 }
27755 }
27756
27757 impl ::fidl_next::TakeFrom<crate::WireConfigValuesData>
27758 for ::fidl_fuchsia_component_decl::ConfigValuesData
27759 {
27760 #[inline]
27761 fn take_from(from: &crate::WireConfigValuesData) -> Self {
27762 Self {
27763 values: from.values().map(::fidl_next::TakeFrom::take_from),
27764
27765 checksum: from.checksum().map(::fidl_next::TakeFrom::take_from),
27766
27767 __source_breaking: ::fidl::marker::SourceBreaking,
27768 }
27769 }
27770 }
27771
27772 impl ::fidl_next::TakeFrom<crate::WireEventSubscription>
27773 for ::fidl_fuchsia_component_decl::EventSubscription
27774 {
27775 #[inline]
27776 fn take_from(from: &crate::WireEventSubscription) -> Self {
27777 Self {
27778 event_name: from.event_name().map(::fidl_next::TakeFrom::take_from),
27779
27780 __source_breaking: ::fidl::marker::SourceBreaking,
27781 }
27782 }
27783 }
27784
27785 impl ::fidl_next::TakeFrom<crate::WireLayoutParameter>
27786 for ::fidl_fuchsia_component_decl::LayoutParameter
27787 {
27788 #[inline]
27789 fn take_from(from: &crate::WireLayoutParameter) -> Self {
27790 match from.as_ref() {
27791 crate::layout_parameter::Ref::NestedType(value) => {
27792 Self::NestedType(::fidl_next::TakeFrom::take_from(value))
27793 }
27794
27795 crate::layout_parameter::Ref::UnknownOrdinal_(unknown_ordinal) => {
27796 Self::__SourceBreaking { unknown_ordinal }
27797 }
27798 }
27799 }
27800 }
27801
27802 impl ::fidl_next::TakeFrom<crate::WireOptionalLayoutParameter>
27803 for Option<Box<::fidl_fuchsia_component_decl::LayoutParameter>>
27804 {
27805 #[inline]
27806 fn take_from(from: &crate::WireOptionalLayoutParameter) -> Self {
27807 if let Some(inner) = from.as_ref() {
27808 Some(::fidl_next::TakeFrom::take_from(inner))
27809 } else {
27810 None
27811 }
27812 }
27813 }
27814
27815 impl ::fidl_next::TakeFrom<crate::WireResolvedConfigField>
27816 for ::fidl_fuchsia_component_decl::ResolvedConfigField
27817 {
27818 #[inline]
27819 fn take_from(from: &crate::WireResolvedConfigField) -> Self {
27820 Self {
27821 key: ::fidl_next::TakeFrom::take_from(&from.key),
27822
27823 value: ::fidl_next::TakeFrom::take_from(&from.value),
27824 }
27825 }
27826 }
27827
27828 impl ::fidl_next::TakeFrom<crate::WireResolvedConfig>
27829 for ::fidl_fuchsia_component_decl::ResolvedConfig
27830 {
27831 #[inline]
27832 fn take_from(from: &crate::WireResolvedConfig) -> Self {
27833 Self {
27834 fields: ::fidl_next::TakeFrom::take_from(&from.fields),
27835
27836 checksum: ::fidl_next::TakeFrom::take_from(&from.checksum),
27837 }
27838 }
27839 }
27840}