fidl_next_fuchsia_component_resolution/
fidl_next_fuchsia_component_resolution.rs

1// DO NOT EDIT: This file is machine-generated by fidlgen
2#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5#[doc = " Max length of component URL.\n"]
6pub const MAX_COMPONENT_URL_LENGTH: u32 = 2083;
7
8#[doc = " The maximum number of bytes for a `Context`.\n"]
9pub const MAX_RESOLUTION_CONTEXT_SIZE: u32 = 8192;
10
11#[doc = " A component resolution context, used when resolving component URLs relative\n to another component. The context is stored in a byte array that persists a\n value used by the target `Resolver` to locate and resolve a component by\n relative path (for example, by a subpackage name).\n"]
12#[derive(Clone, Debug)]
13pub struct Context {
14    pub bytes: Vec<u8>,
15}
16
17impl ::fidl_next::Encodable for Context {
18    type Encoded = WireContext<'static>;
19}
20
21unsafe impl<___E> ::fidl_next::Encode<___E> for Context
22where
23    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
24
25    ___E: ::fidl_next::Encoder,
26{
27    #[inline]
28    fn encode(
29        self,
30        encoder: &mut ___E,
31        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
32    ) -> Result<(), ::fidl_next::EncodeError> {
33        ::fidl_next::munge! {
34            let Self::Encoded {
35                bytes,
36
37            } = out;
38        }
39
40        ::fidl_next::Encode::encode(self.bytes, encoder, bytes)?;
41
42        Ok(())
43    }
44}
45
46unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Context
47where
48    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
49
50    ___E: ::fidl_next::Encoder,
51{
52    #[inline]
53    fn encode_ref(
54        &self,
55        encoder: &mut ___E,
56        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
57    ) -> Result<(), ::fidl_next::EncodeError> {
58        ::fidl_next::munge! {
59            let Self::Encoded {
60                bytes,
61
62            } = out;
63        }
64
65        ::fidl_next::EncodeRef::encode_ref(&self.bytes, encoder, bytes)?;
66
67        Ok(())
68    }
69}
70
71impl ::fidl_next::EncodableOption for Context {
72    type EncodedOption = ::fidl_next::WireBox<'static, WireContext<'static>>;
73}
74
75unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Context
76where
77    ___E: ::fidl_next::Encoder + ?Sized,
78    Context: ::fidl_next::Encode<___E>,
79{
80    #[inline]
81    fn encode_option(
82        this: Option<Self>,
83        encoder: &mut ___E,
84        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
85    ) -> Result<(), ::fidl_next::EncodeError> {
86        if let Some(inner) = this {
87            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
88            ::fidl_next::WireBox::encode_present(out);
89        } else {
90            ::fidl_next::WireBox::encode_absent(out);
91        }
92
93        Ok(())
94    }
95}
96
97unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Context
98where
99    ___E: ::fidl_next::Encoder + ?Sized,
100    Context: ::fidl_next::EncodeRef<___E>,
101{
102    #[inline]
103    fn encode_option_ref(
104        this: Option<&Self>,
105        encoder: &mut ___E,
106        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
107    ) -> Result<(), ::fidl_next::EncodeError> {
108        if let Some(inner) = this {
109            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
110            ::fidl_next::WireBox::encode_present(out);
111        } else {
112            ::fidl_next::WireBox::encode_absent(out);
113        }
114
115        Ok(())
116    }
117}
118
119impl<'de> ::fidl_next::FromWire<WireContext<'de>> for Context {
120    #[inline]
121    fn from_wire(wire: WireContext<'de>) -> Self {
122        Self { bytes: ::fidl_next::FromWire::from_wire(wire.bytes) }
123    }
124}
125
126impl<'de> ::fidl_next::FromWireRef<WireContext<'de>> for Context {
127    #[inline]
128    fn from_wire_ref(wire: &WireContext<'de>) -> Self {
129        Self { bytes: ::fidl_next::FromWireRef::from_wire_ref(&wire.bytes) }
130    }
131}
132
133/// The wire type corresponding to [`Context`].
134#[derive(Debug)]
135#[repr(C)]
136pub struct WireContext<'de> {
137    pub bytes: ::fidl_next::WireVector<'de, u8>,
138}
139
140unsafe impl ::fidl_next::Wire for WireContext<'static> {
141    type Decoded<'de> = WireContext<'de>;
142
143    #[inline]
144    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
145}
146
147unsafe impl<___D> ::fidl_next::Decode<___D> for WireContext<'static>
148where
149    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
150
151    ___D: ::fidl_next::Decoder,
152{
153    fn decode(
154        slot: ::fidl_next::Slot<'_, Self>,
155        decoder: &mut ___D,
156    ) -> Result<(), ::fidl_next::DecodeError> {
157        ::fidl_next::munge! {
158            let Self {
159                mut bytes,
160
161            } = slot;
162        }
163
164        ::fidl_next::Decode::decode(bytes.as_mut(), decoder)?;
165
166        let bytes = unsafe { bytes.deref_unchecked() };
167
168        if bytes.len() > 8192 {
169            return Err(::fidl_next::DecodeError::VectorTooLong {
170                size: bytes.len() as u64,
171                limit: 8192,
172            });
173        }
174
175        Ok(())
176    }
177}
178
179#[doc = " A package is a signed collection of immutable files.\n\n This object provides access to a package\'s content and relevant metadata.\n"]
180#[derive(Debug, Default)]
181pub struct Package {
182    pub url: Option<String>,
183
184    pub directory: Option<
185        ::fidl_next::ClientEnd<
186            ::fidl_next::fuchsia::zx::Channel,
187            ::fidl_next_fuchsia_io::Directory,
188        >,
189    >,
190}
191
192impl Package {
193    fn __max_ordinal(&self) -> usize {
194        if self.directory.is_some() {
195            return 2;
196        }
197
198        if self.url.is_some() {
199            return 1;
200        }
201
202        0
203    }
204}
205
206impl ::fidl_next::Encodable for Package {
207    type Encoded = WirePackage<'static>;
208}
209
210unsafe impl<___E> ::fidl_next::Encode<___E> for Package
211where
212    ___E: ::fidl_next::Encoder + ?Sized,
213
214    ___E: ::fidl_next::fuchsia::HandleEncoder,
215{
216    #[inline]
217    fn encode(
218        mut self,
219        encoder: &mut ___E,
220        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
221    ) -> Result<(), ::fidl_next::EncodeError> {
222        ::fidl_next::munge!(let WirePackage { table } = out);
223
224        let max_ord = self.__max_ordinal();
225
226        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
227        ::fidl_next::Wire::zero_padding(&mut out);
228
229        let mut preallocated =
230            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
231
232        for i in 1..=max_ord {
233            match i {
234                2 => {
235                    if let Some(directory) = self.directory.take() {
236                        ::fidl_next::WireEnvelope::encode_value(
237                            directory,
238                            preallocated.encoder,
239                            &mut out,
240                        )?;
241                    } else {
242                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
243                    }
244                }
245
246                1 => {
247                    if let Some(url) = self.url.take() {
248                        ::fidl_next::WireEnvelope::encode_value(
249                            url,
250                            preallocated.encoder,
251                            &mut out,
252                        )?;
253                    } else {
254                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
255                    }
256                }
257
258                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
259            }
260            unsafe {
261                preallocated.write_next(out.assume_init_ref());
262            }
263        }
264
265        ::fidl_next::WireTable::encode_len(table, max_ord);
266
267        Ok(())
268    }
269}
270
271impl<'de> ::fidl_next::FromWire<WirePackage<'de>> for Package {
272    #[inline]
273    fn from_wire(wire: WirePackage<'de>) -> Self {
274        let wire = ::core::mem::ManuallyDrop::new(wire);
275
276        let url = wire.table.get(1);
277
278        let directory = wire.table.get(2);
279
280        Self {
281            url: url.map(|envelope| {
282                ::fidl_next::FromWire::from_wire(unsafe {
283                    envelope.read_unchecked::<::fidl_next::WireString<'de>>()
284                })
285            }),
286
287            directory: directory.map(|envelope| {
288                ::fidl_next::FromWire::from_wire(unsafe {
289                    envelope.read_unchecked::<::fidl_next::ClientEnd<
290                        ::fidl_next::fuchsia::WireChannel,
291                        ::fidl_next_fuchsia_io::Directory,
292                    >>()
293                })
294            }),
295        }
296    }
297}
298
299/// The wire type corresponding to [`Package`].
300#[repr(C)]
301pub struct WirePackage<'de> {
302    table: ::fidl_next::WireTable<'de>,
303}
304
305impl<'de> Drop for WirePackage<'de> {
306    fn drop(&mut self) {
307        let _ = self
308            .table
309            .get(1)
310            .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
311
312        let _ = self.table.get(2).map(|envelope| unsafe {
313            envelope.read_unchecked::<::fidl_next::ClientEnd<
314                ::fidl_next::fuchsia::WireChannel,
315                ::fidl_next_fuchsia_io::Directory,
316            >>()
317        });
318    }
319}
320
321unsafe impl ::fidl_next::Wire for WirePackage<'static> {
322    type Decoded<'de> = WirePackage<'de>;
323
324    #[inline]
325    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
326        ::fidl_next::munge!(let Self { table } = out);
327        ::fidl_next::WireTable::zero_padding(table);
328    }
329}
330
331unsafe impl<___D> ::fidl_next::Decode<___D> for WirePackage<'static>
332where
333    ___D: ::fidl_next::Decoder + ?Sized,
334
335    ___D: ::fidl_next::fuchsia::HandleDecoder,
336{
337    fn decode(
338        slot: ::fidl_next::Slot<'_, Self>,
339        decoder: &mut ___D,
340    ) -> Result<(), ::fidl_next::DecodeError> {
341        ::fidl_next::munge!(let Self { table } = slot);
342
343        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
344            match ordinal {
345                0 => unsafe { ::core::hint::unreachable_unchecked() },
346
347                1 => {
348                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
349                        slot.as_mut(),
350                        decoder,
351                    )?;
352
353                    let url = unsafe {
354                        slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
355                    };
356
357                    if url.len() > 2083 {
358                        return Err(::fidl_next::DecodeError::VectorTooLong {
359                            size: url.len() as u64,
360                            limit: 2083,
361                        });
362                    }
363
364                    Ok(())
365                }
366
367                2 => {
368                    ::fidl_next::WireEnvelope::decode_as::<
369                        ___D,
370                        ::fidl_next::ClientEnd<
371                            ::fidl_next::fuchsia::WireChannel,
372                            ::fidl_next_fuchsia_io::Directory,
373                        >,
374                    >(slot.as_mut(), decoder)?;
375
376                    Ok(())
377                }
378
379                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
380            }
381        })
382    }
383}
384
385impl<'de> WirePackage<'de> {
386    pub fn url(&self) -> Option<&::fidl_next::WireString<'de>> {
387        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
388    }
389
390    pub fn directory(
391        &self,
392    ) -> Option<
393        &::fidl_next::ClientEnd<
394            ::fidl_next::fuchsia::WireChannel,
395            ::fidl_next_fuchsia_io::Directory,
396        >,
397    > {
398        unsafe { Some(self.table.get(2)?.deref_unchecked()) }
399    }
400}
401
402impl<'de> ::core::fmt::Debug for WirePackage<'de> {
403    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
404        f.debug_struct("Package")
405            .field("url", &self.url())
406            .field("directory", &self.directory())
407            .finish()
408    }
409}
410
411#[doc = " A component is a unit of executable software.\n\n This object provides the component\'s declaration, access to its package\'s\n content, and relevant metadata as resolved `fuchsia.component.resolution.Resolver`.\n"]
412#[derive(Debug, Default)]
413pub struct Component {
414    pub url: Option<String>,
415
416    pub decl: Option<::fidl_next_fuchsia_mem::Data>,
417
418    pub package: Option<crate::Package>,
419
420    pub config_values: Option<::fidl_next_fuchsia_mem::Data>,
421
422    pub resolution_context: Option<crate::Context>,
423
424    pub abi_revision: Option<u64>,
425}
426
427impl Component {
428    fn __max_ordinal(&self) -> usize {
429        if self.abi_revision.is_some() {
430            return 6;
431        }
432
433        if self.resolution_context.is_some() {
434            return 5;
435        }
436
437        if self.config_values.is_some() {
438            return 4;
439        }
440
441        if self.package.is_some() {
442            return 3;
443        }
444
445        if self.decl.is_some() {
446            return 2;
447        }
448
449        if self.url.is_some() {
450            return 1;
451        }
452
453        0
454    }
455}
456
457impl ::fidl_next::Encodable for Component {
458    type Encoded = WireComponent<'static>;
459}
460
461unsafe impl<___E> ::fidl_next::Encode<___E> for Component
462where
463    ___E: ::fidl_next::Encoder + ?Sized,
464
465    ___E: ::fidl_next::fuchsia::HandleEncoder,
466{
467    #[inline]
468    fn encode(
469        mut self,
470        encoder: &mut ___E,
471        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
472    ) -> Result<(), ::fidl_next::EncodeError> {
473        ::fidl_next::munge!(let WireComponent { table } = out);
474
475        let max_ord = self.__max_ordinal();
476
477        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
478        ::fidl_next::Wire::zero_padding(&mut out);
479
480        let mut preallocated =
481            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
482
483        for i in 1..=max_ord {
484            match i {
485                6 => {
486                    if let Some(abi_revision) = self.abi_revision.take() {
487                        ::fidl_next::WireEnvelope::encode_value(
488                            abi_revision,
489                            preallocated.encoder,
490                            &mut out,
491                        )?;
492                    } else {
493                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
494                    }
495                }
496
497                5 => {
498                    if let Some(resolution_context) = self.resolution_context.take() {
499                        ::fidl_next::WireEnvelope::encode_value(
500                            resolution_context,
501                            preallocated.encoder,
502                            &mut out,
503                        )?;
504                    } else {
505                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
506                    }
507                }
508
509                4 => {
510                    if let Some(config_values) = self.config_values.take() {
511                        ::fidl_next::WireEnvelope::encode_value(
512                            config_values,
513                            preallocated.encoder,
514                            &mut out,
515                        )?;
516                    } else {
517                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
518                    }
519                }
520
521                3 => {
522                    if let Some(package) = self.package.take() {
523                        ::fidl_next::WireEnvelope::encode_value(
524                            package,
525                            preallocated.encoder,
526                            &mut out,
527                        )?;
528                    } else {
529                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
530                    }
531                }
532
533                2 => {
534                    if let Some(decl) = self.decl.take() {
535                        ::fidl_next::WireEnvelope::encode_value(
536                            decl,
537                            preallocated.encoder,
538                            &mut out,
539                        )?;
540                    } else {
541                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
542                    }
543                }
544
545                1 => {
546                    if let Some(url) = self.url.take() {
547                        ::fidl_next::WireEnvelope::encode_value(
548                            url,
549                            preallocated.encoder,
550                            &mut out,
551                        )?;
552                    } else {
553                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
554                    }
555                }
556
557                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
558            }
559            unsafe {
560                preallocated.write_next(out.assume_init_ref());
561            }
562        }
563
564        ::fidl_next::WireTable::encode_len(table, max_ord);
565
566        Ok(())
567    }
568}
569
570impl<'de> ::fidl_next::FromWire<WireComponent<'de>> for Component {
571    #[inline]
572    fn from_wire(wire: WireComponent<'de>) -> Self {
573        let wire = ::core::mem::ManuallyDrop::new(wire);
574
575        let url = wire.table.get(1);
576
577        let decl = wire.table.get(2);
578
579        let package = wire.table.get(3);
580
581        let config_values = wire.table.get(4);
582
583        let resolution_context = wire.table.get(5);
584
585        let abi_revision = wire.table.get(6);
586
587        Self {
588            url: url.map(|envelope| {
589                ::fidl_next::FromWire::from_wire(unsafe {
590                    envelope.read_unchecked::<::fidl_next::WireString<'de>>()
591                })
592            }),
593
594            decl: decl.map(|envelope| {
595                ::fidl_next::FromWire::from_wire(unsafe {
596                    envelope.read_unchecked::<::fidl_next_fuchsia_mem::WireData<'de>>()
597                })
598            }),
599
600            package: package.map(|envelope| {
601                ::fidl_next::FromWire::from_wire(unsafe {
602                    envelope.read_unchecked::<crate::WirePackage<'de>>()
603                })
604            }),
605
606            config_values: config_values.map(|envelope| {
607                ::fidl_next::FromWire::from_wire(unsafe {
608                    envelope.read_unchecked::<::fidl_next_fuchsia_mem::WireData<'de>>()
609                })
610            }),
611
612            resolution_context: resolution_context.map(|envelope| {
613                ::fidl_next::FromWire::from_wire(unsafe {
614                    envelope.read_unchecked::<crate::WireContext<'de>>()
615                })
616            }),
617
618            abi_revision: abi_revision.map(|envelope| {
619                ::fidl_next::FromWire::from_wire(unsafe {
620                    envelope.read_unchecked::<::fidl_next::WireU64>()
621                })
622            }),
623        }
624    }
625}
626
627/// The wire type corresponding to [`Component`].
628#[repr(C)]
629pub struct WireComponent<'de> {
630    table: ::fidl_next::WireTable<'de>,
631}
632
633impl<'de> Drop for WireComponent<'de> {
634    fn drop(&mut self) {
635        let _ = self
636            .table
637            .get(1)
638            .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
639
640        let _ = self.table.get(2).map(|envelope| unsafe {
641            envelope.read_unchecked::<::fidl_next_fuchsia_mem::WireData<'de>>()
642        });
643
644        let _ = self
645            .table
646            .get(3)
647            .map(|envelope| unsafe { envelope.read_unchecked::<crate::WirePackage<'de>>() });
648
649        let _ = self.table.get(4).map(|envelope| unsafe {
650            envelope.read_unchecked::<::fidl_next_fuchsia_mem::WireData<'de>>()
651        });
652
653        let _ = self
654            .table
655            .get(5)
656            .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireContext<'de>>() });
657
658        let _ = self
659            .table
660            .get(6)
661            .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireU64>() });
662    }
663}
664
665unsafe impl ::fidl_next::Wire for WireComponent<'static> {
666    type Decoded<'de> = WireComponent<'de>;
667
668    #[inline]
669    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
670        ::fidl_next::munge!(let Self { table } = out);
671        ::fidl_next::WireTable::zero_padding(table);
672    }
673}
674
675unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponent<'static>
676where
677    ___D: ::fidl_next::Decoder + ?Sized,
678
679    ___D: ::fidl_next::fuchsia::HandleDecoder,
680{
681    fn decode(
682        slot: ::fidl_next::Slot<'_, Self>,
683        decoder: &mut ___D,
684    ) -> Result<(), ::fidl_next::DecodeError> {
685        ::fidl_next::munge!(let Self { table } = slot);
686
687        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
688            match ordinal {
689                0 => unsafe { ::core::hint::unreachable_unchecked() },
690
691                1 => {
692                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
693                        slot.as_mut(),
694                        decoder,
695                    )?;
696
697                    let url = unsafe {
698                        slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
699                    };
700
701                    if url.len() > 2083 {
702                        return Err(::fidl_next::DecodeError::VectorTooLong {
703                            size: url.len() as u64,
704                            limit: 2083,
705                        });
706                    }
707
708                    Ok(())
709                }
710
711                2 => {
712                    ::fidl_next::WireEnvelope::decode_as::<
713                        ___D,
714                        ::fidl_next_fuchsia_mem::WireData<'static>,
715                    >(slot.as_mut(), decoder)?;
716
717                    Ok(())
718                }
719
720                3 => {
721                    ::fidl_next::WireEnvelope::decode_as::<___D, crate::WirePackage<'static>>(
722                        slot.as_mut(),
723                        decoder,
724                    )?;
725
726                    Ok(())
727                }
728
729                4 => {
730                    ::fidl_next::WireEnvelope::decode_as::<
731                        ___D,
732                        ::fidl_next_fuchsia_mem::WireData<'static>,
733                    >(slot.as_mut(), decoder)?;
734
735                    Ok(())
736                }
737
738                5 => {
739                    ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireContext<'static>>(
740                        slot.as_mut(),
741                        decoder,
742                    )?;
743
744                    Ok(())
745                }
746
747                6 => {
748                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireU64>(
749                        slot.as_mut(),
750                        decoder,
751                    )?;
752
753                    Ok(())
754                }
755
756                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
757            }
758        })
759    }
760}
761
762impl<'de> WireComponent<'de> {
763    pub fn url(&self) -> Option<&::fidl_next::WireString<'de>> {
764        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
765    }
766
767    pub fn decl(&self) -> Option<&::fidl_next_fuchsia_mem::WireData<'de>> {
768        unsafe { Some(self.table.get(2)?.deref_unchecked()) }
769    }
770
771    pub fn package(&self) -> Option<&crate::WirePackage<'de>> {
772        unsafe { Some(self.table.get(3)?.deref_unchecked()) }
773    }
774
775    pub fn config_values(&self) -> Option<&::fidl_next_fuchsia_mem::WireData<'de>> {
776        unsafe { Some(self.table.get(4)?.deref_unchecked()) }
777    }
778
779    pub fn resolution_context(&self) -> Option<&crate::WireContext<'de>> {
780        unsafe { Some(self.table.get(5)?.deref_unchecked()) }
781    }
782
783    pub fn abi_revision(&self) -> Option<&::fidl_next::WireU64> {
784        unsafe { Some(self.table.get(6)?.deref_unchecked()) }
785    }
786}
787
788impl<'de> ::core::fmt::Debug for WireComponent<'de> {
789    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
790        f.debug_struct("Component")
791            .field("url", &self.url())
792            .field("decl", &self.decl())
793            .field("package", &self.package())
794            .field("config_values", &self.config_values())
795            .field("resolution_context", &self.resolution_context())
796            .field("abi_revision", &self.abi_revision())
797            .finish()
798    }
799}
800
801#[derive(Clone, Debug)]
802pub struct ResolverResolveRequest {
803    pub component_url: String,
804}
805
806impl ::fidl_next::Encodable for ResolverResolveRequest {
807    type Encoded = WireResolverResolveRequest<'static>;
808}
809
810unsafe impl<___E> ::fidl_next::Encode<___E> for ResolverResolveRequest
811where
812    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
813
814    ___E: ::fidl_next::Encoder,
815{
816    #[inline]
817    fn encode(
818        self,
819        encoder: &mut ___E,
820        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
821    ) -> Result<(), ::fidl_next::EncodeError> {
822        ::fidl_next::munge! {
823            let Self::Encoded {
824                component_url,
825
826            } = out;
827        }
828
829        ::fidl_next::Encode::encode(self.component_url, encoder, component_url)?;
830
831        Ok(())
832    }
833}
834
835unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolverResolveRequest
836where
837    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
838
839    ___E: ::fidl_next::Encoder,
840{
841    #[inline]
842    fn encode_ref(
843        &self,
844        encoder: &mut ___E,
845        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
846    ) -> Result<(), ::fidl_next::EncodeError> {
847        ::fidl_next::munge! {
848            let Self::Encoded {
849                component_url,
850
851            } = out;
852        }
853
854        ::fidl_next::EncodeRef::encode_ref(&self.component_url, encoder, component_url)?;
855
856        Ok(())
857    }
858}
859
860impl ::fidl_next::EncodableOption for ResolverResolveRequest {
861    type EncodedOption = ::fidl_next::WireBox<'static, WireResolverResolveRequest<'static>>;
862}
863
864unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ResolverResolveRequest
865where
866    ___E: ::fidl_next::Encoder + ?Sized,
867    ResolverResolveRequest: ::fidl_next::Encode<___E>,
868{
869    #[inline]
870    fn encode_option(
871        this: Option<Self>,
872        encoder: &mut ___E,
873        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
874    ) -> Result<(), ::fidl_next::EncodeError> {
875        if let Some(inner) = this {
876            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
877            ::fidl_next::WireBox::encode_present(out);
878        } else {
879            ::fidl_next::WireBox::encode_absent(out);
880        }
881
882        Ok(())
883    }
884}
885
886unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ResolverResolveRequest
887where
888    ___E: ::fidl_next::Encoder + ?Sized,
889    ResolverResolveRequest: ::fidl_next::EncodeRef<___E>,
890{
891    #[inline]
892    fn encode_option_ref(
893        this: Option<&Self>,
894        encoder: &mut ___E,
895        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
896    ) -> Result<(), ::fidl_next::EncodeError> {
897        if let Some(inner) = this {
898            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
899            ::fidl_next::WireBox::encode_present(out);
900        } else {
901            ::fidl_next::WireBox::encode_absent(out);
902        }
903
904        Ok(())
905    }
906}
907
908impl<'de> ::fidl_next::FromWire<WireResolverResolveRequest<'de>> for ResolverResolveRequest {
909    #[inline]
910    fn from_wire(wire: WireResolverResolveRequest<'de>) -> Self {
911        Self { component_url: ::fidl_next::FromWire::from_wire(wire.component_url) }
912    }
913}
914
915impl<'de> ::fidl_next::FromWireRef<WireResolverResolveRequest<'de>> for ResolverResolveRequest {
916    #[inline]
917    fn from_wire_ref(wire: &WireResolverResolveRequest<'de>) -> Self {
918        Self { component_url: ::fidl_next::FromWireRef::from_wire_ref(&wire.component_url) }
919    }
920}
921
922/// The wire type corresponding to [`ResolverResolveRequest`].
923#[derive(Debug)]
924#[repr(C)]
925pub struct WireResolverResolveRequest<'de> {
926    pub component_url: ::fidl_next::WireString<'de>,
927}
928
929unsafe impl ::fidl_next::Wire for WireResolverResolveRequest<'static> {
930    type Decoded<'de> = WireResolverResolveRequest<'de>;
931
932    #[inline]
933    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
934}
935
936unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolverResolveRequest<'static>
937where
938    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
939
940    ___D: ::fidl_next::Decoder,
941{
942    fn decode(
943        slot: ::fidl_next::Slot<'_, Self>,
944        decoder: &mut ___D,
945    ) -> Result<(), ::fidl_next::DecodeError> {
946        ::fidl_next::munge! {
947            let Self {
948                mut component_url,
949
950            } = slot;
951        }
952
953        ::fidl_next::Decode::decode(component_url.as_mut(), decoder)?;
954
955        let component_url = unsafe { component_url.deref_unchecked() };
956
957        if component_url.len() > 2083 {
958            return Err(::fidl_next::DecodeError::VectorTooLong {
959                size: component_url.len() as u64,
960                limit: 2083,
961            });
962        }
963
964        Ok(())
965    }
966}
967
968#[derive(Clone, Debug)]
969pub struct ResolverResolveWithContextRequest {
970    pub component_url: String,
971
972    pub context: crate::Context,
973}
974
975impl ::fidl_next::Encodable for ResolverResolveWithContextRequest {
976    type Encoded = WireResolverResolveWithContextRequest<'static>;
977}
978
979unsafe impl<___E> ::fidl_next::Encode<___E> for ResolverResolveWithContextRequest
980where
981    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
982
983    ___E: ::fidl_next::Encoder,
984{
985    #[inline]
986    fn encode(
987        self,
988        encoder: &mut ___E,
989        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
990    ) -> Result<(), ::fidl_next::EncodeError> {
991        ::fidl_next::munge! {
992            let Self::Encoded {
993                component_url,
994                context,
995
996            } = out;
997        }
998
999        ::fidl_next::Encode::encode(self.component_url, encoder, component_url)?;
1000
1001        ::fidl_next::Encode::encode(self.context, encoder, context)?;
1002
1003        Ok(())
1004    }
1005}
1006
1007unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolverResolveWithContextRequest
1008where
1009    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1010
1011    ___E: ::fidl_next::Encoder,
1012{
1013    #[inline]
1014    fn encode_ref(
1015        &self,
1016        encoder: &mut ___E,
1017        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1018    ) -> Result<(), ::fidl_next::EncodeError> {
1019        ::fidl_next::munge! {
1020            let Self::Encoded {
1021                component_url,
1022                context,
1023
1024            } = out;
1025        }
1026
1027        ::fidl_next::EncodeRef::encode_ref(&self.component_url, encoder, component_url)?;
1028
1029        ::fidl_next::EncodeRef::encode_ref(&self.context, encoder, context)?;
1030
1031        Ok(())
1032    }
1033}
1034
1035impl ::fidl_next::EncodableOption for ResolverResolveWithContextRequest {
1036    type EncodedOption =
1037        ::fidl_next::WireBox<'static, WireResolverResolveWithContextRequest<'static>>;
1038}
1039
1040unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ResolverResolveWithContextRequest
1041where
1042    ___E: ::fidl_next::Encoder + ?Sized,
1043    ResolverResolveWithContextRequest: ::fidl_next::Encode<___E>,
1044{
1045    #[inline]
1046    fn encode_option(
1047        this: Option<Self>,
1048        encoder: &mut ___E,
1049        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1050    ) -> Result<(), ::fidl_next::EncodeError> {
1051        if let Some(inner) = this {
1052            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1053            ::fidl_next::WireBox::encode_present(out);
1054        } else {
1055            ::fidl_next::WireBox::encode_absent(out);
1056        }
1057
1058        Ok(())
1059    }
1060}
1061
1062unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for ResolverResolveWithContextRequest
1063where
1064    ___E: ::fidl_next::Encoder + ?Sized,
1065    ResolverResolveWithContextRequest: ::fidl_next::EncodeRef<___E>,
1066{
1067    #[inline]
1068    fn encode_option_ref(
1069        this: Option<&Self>,
1070        encoder: &mut ___E,
1071        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1072    ) -> Result<(), ::fidl_next::EncodeError> {
1073        if let Some(inner) = this {
1074            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1075            ::fidl_next::WireBox::encode_present(out);
1076        } else {
1077            ::fidl_next::WireBox::encode_absent(out);
1078        }
1079
1080        Ok(())
1081    }
1082}
1083
1084impl<'de> ::fidl_next::FromWire<WireResolverResolveWithContextRequest<'de>>
1085    for ResolverResolveWithContextRequest
1086{
1087    #[inline]
1088    fn from_wire(wire: WireResolverResolveWithContextRequest<'de>) -> Self {
1089        Self {
1090            component_url: ::fidl_next::FromWire::from_wire(wire.component_url),
1091
1092            context: ::fidl_next::FromWire::from_wire(wire.context),
1093        }
1094    }
1095}
1096
1097impl<'de> ::fidl_next::FromWireRef<WireResolverResolveWithContextRequest<'de>>
1098    for ResolverResolveWithContextRequest
1099{
1100    #[inline]
1101    fn from_wire_ref(wire: &WireResolverResolveWithContextRequest<'de>) -> Self {
1102        Self {
1103            component_url: ::fidl_next::FromWireRef::from_wire_ref(&wire.component_url),
1104
1105            context: ::fidl_next::FromWireRef::from_wire_ref(&wire.context),
1106        }
1107    }
1108}
1109
1110/// The wire type corresponding to [`ResolverResolveWithContextRequest`].
1111#[derive(Debug)]
1112#[repr(C)]
1113pub struct WireResolverResolveWithContextRequest<'de> {
1114    pub component_url: ::fidl_next::WireString<'de>,
1115
1116    pub context: crate::WireContext<'de>,
1117}
1118
1119unsafe impl ::fidl_next::Wire for WireResolverResolveWithContextRequest<'static> {
1120    type Decoded<'de> = WireResolverResolveWithContextRequest<'de>;
1121
1122    #[inline]
1123    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1124}
1125
1126unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolverResolveWithContextRequest<'static>
1127where
1128    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1129
1130    ___D: ::fidl_next::Decoder,
1131{
1132    fn decode(
1133        slot: ::fidl_next::Slot<'_, Self>,
1134        decoder: &mut ___D,
1135    ) -> Result<(), ::fidl_next::DecodeError> {
1136        ::fidl_next::munge! {
1137            let Self {
1138                mut component_url,
1139                mut context,
1140
1141            } = slot;
1142        }
1143
1144        ::fidl_next::Decode::decode(component_url.as_mut(), decoder)?;
1145
1146        let component_url = unsafe { component_url.deref_unchecked() };
1147
1148        if component_url.len() > 2083 {
1149            return Err(::fidl_next::DecodeError::VectorTooLong {
1150                size: component_url.len() as u64,
1151                limit: 2083,
1152            });
1153        }
1154
1155        ::fidl_next::Decode::decode(context.as_mut(), decoder)?;
1156
1157        Ok(())
1158    }
1159}
1160
1161#[doc = " The possible error conditions returned by ComponentResolver.\n"]
1162#[derive(Clone, Copy, Debug, PartialEq, Eq)]
1163#[repr(u32)]
1164pub enum ResolverError {
1165    Internal = 1,
1166    Io = 2,
1167    InvalidArgs = 3,
1168    NotSupported = 4,
1169    ManifestNotFound = 5,
1170    PackageNotFound = 6,
1171    NoSpace = 7,
1172    ResourceUnavailable = 8,
1173    InvalidManifest = 9,
1174    ConfigValuesNotFound = 10,
1175    AbiRevisionNotFound = 11,
1176    InvalidAbiRevision = 12,
1177}
1178
1179impl ::fidl_next::Encodable for ResolverError {
1180    type Encoded = WireResolverError;
1181}
1182impl ::std::convert::TryFrom<u32> for ResolverError {
1183    type Error = ::fidl_next::UnknownStrictEnumMemberError;
1184    fn try_from(value: u32) -> Result<Self, Self::Error> {
1185        match value {
1186            1 => Ok(Self::Internal),
1187            2 => Ok(Self::Io),
1188            3 => Ok(Self::InvalidArgs),
1189            4 => Ok(Self::NotSupported),
1190            5 => Ok(Self::ManifestNotFound),
1191            6 => Ok(Self::PackageNotFound),
1192            7 => Ok(Self::NoSpace),
1193            8 => Ok(Self::ResourceUnavailable),
1194            9 => Ok(Self::InvalidManifest),
1195            10 => Ok(Self::ConfigValuesNotFound),
1196            11 => Ok(Self::AbiRevisionNotFound),
1197            12 => Ok(Self::InvalidAbiRevision),
1198
1199            _ => Err(Self::Error::new(value.into())),
1200        }
1201    }
1202}
1203
1204unsafe impl<___E> ::fidl_next::Encode<___E> for ResolverError
1205where
1206    ___E: ?Sized,
1207{
1208    #[inline]
1209    fn encode(
1210        self,
1211        encoder: &mut ___E,
1212        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1213    ) -> Result<(), ::fidl_next::EncodeError> {
1214        ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
1215    }
1216}
1217
1218unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ResolverError
1219where
1220    ___E: ?Sized,
1221{
1222    #[inline]
1223    fn encode_ref(
1224        &self,
1225        encoder: &mut ___E,
1226        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1227    ) -> Result<(), ::fidl_next::EncodeError> {
1228        ::fidl_next::munge!(let WireResolverError { value } = out);
1229        let _ = value.write(::fidl_next::WireU32::from(match *self {
1230            Self::Internal => 1,
1231
1232            Self::Io => 2,
1233
1234            Self::InvalidArgs => 3,
1235
1236            Self::NotSupported => 4,
1237
1238            Self::ManifestNotFound => 5,
1239
1240            Self::PackageNotFound => 6,
1241
1242            Self::NoSpace => 7,
1243
1244            Self::ResourceUnavailable => 8,
1245
1246            Self::InvalidManifest => 9,
1247
1248            Self::ConfigValuesNotFound => 10,
1249
1250            Self::AbiRevisionNotFound => 11,
1251
1252            Self::InvalidAbiRevision => 12,
1253        }));
1254
1255        Ok(())
1256    }
1257}
1258
1259impl ::core::convert::From<WireResolverError> for ResolverError {
1260    fn from(wire: WireResolverError) -> Self {
1261        match u32::from(wire.value) {
1262            1 => Self::Internal,
1263
1264            2 => Self::Io,
1265
1266            3 => Self::InvalidArgs,
1267
1268            4 => Self::NotSupported,
1269
1270            5 => Self::ManifestNotFound,
1271
1272            6 => Self::PackageNotFound,
1273
1274            7 => Self::NoSpace,
1275
1276            8 => Self::ResourceUnavailable,
1277
1278            9 => Self::InvalidManifest,
1279
1280            10 => Self::ConfigValuesNotFound,
1281
1282            11 => Self::AbiRevisionNotFound,
1283
1284            12 => Self::InvalidAbiRevision,
1285
1286            _ => unsafe { ::core::hint::unreachable_unchecked() },
1287        }
1288    }
1289}
1290
1291impl ::fidl_next::FromWire<WireResolverError> for ResolverError {
1292    #[inline]
1293    fn from_wire(wire: WireResolverError) -> Self {
1294        Self::from(wire)
1295    }
1296}
1297
1298impl ::fidl_next::FromWireRef<WireResolverError> for ResolverError {
1299    #[inline]
1300    fn from_wire_ref(wire: &WireResolverError) -> Self {
1301        Self::from(*wire)
1302    }
1303}
1304
1305/// The wire type corresponding to [`ResolverError`].
1306#[derive(Clone, Copy, Debug, PartialEq, Eq)]
1307#[repr(transparent)]
1308pub struct WireResolverError {
1309    value: ::fidl_next::WireU32,
1310}
1311
1312unsafe impl ::fidl_next::Wire for WireResolverError {
1313    type Decoded<'de> = Self;
1314
1315    #[inline]
1316    fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1317        // Wire enums have no padding
1318    }
1319}
1320
1321impl WireResolverError {
1322    pub const INTERNAL: WireResolverError = WireResolverError { value: ::fidl_next::WireU32(1) };
1323
1324    pub const IO: WireResolverError = WireResolverError { value: ::fidl_next::WireU32(2) };
1325
1326    pub const INVALID_ARGS: WireResolverError =
1327        WireResolverError { value: ::fidl_next::WireU32(3) };
1328
1329    pub const NOT_SUPPORTED: WireResolverError =
1330        WireResolverError { value: ::fidl_next::WireU32(4) };
1331
1332    pub const MANIFEST_NOT_FOUND: WireResolverError =
1333        WireResolverError { value: ::fidl_next::WireU32(5) };
1334
1335    pub const PACKAGE_NOT_FOUND: WireResolverError =
1336        WireResolverError { value: ::fidl_next::WireU32(6) };
1337
1338    pub const NO_SPACE: WireResolverError = WireResolverError { value: ::fidl_next::WireU32(7) };
1339
1340    pub const RESOURCE_UNAVAILABLE: WireResolverError =
1341        WireResolverError { value: ::fidl_next::WireU32(8) };
1342
1343    pub const INVALID_MANIFEST: WireResolverError =
1344        WireResolverError { value: ::fidl_next::WireU32(9) };
1345
1346    pub const CONFIG_VALUES_NOT_FOUND: WireResolverError =
1347        WireResolverError { value: ::fidl_next::WireU32(10) };
1348
1349    pub const ABI_REVISION_NOT_FOUND: WireResolverError =
1350        WireResolverError { value: ::fidl_next::WireU32(11) };
1351
1352    pub const INVALID_ABI_REVISION: WireResolverError =
1353        WireResolverError { value: ::fidl_next::WireU32(12) };
1354}
1355
1356unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolverError
1357where
1358    ___D: ?Sized,
1359{
1360    fn decode(
1361        slot: ::fidl_next::Slot<'_, Self>,
1362        _: &mut ___D,
1363    ) -> Result<(), ::fidl_next::DecodeError> {
1364        ::fidl_next::munge!(let Self { value } = slot);
1365
1366        match u32::from(*value) {
1367            1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 => (),
1368            unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
1369        }
1370
1371        Ok(())
1372    }
1373}
1374
1375impl ::core::convert::From<ResolverError> for WireResolverError {
1376    fn from(natural: ResolverError) -> Self {
1377        match natural {
1378            ResolverError::Internal => WireResolverError::INTERNAL,
1379
1380            ResolverError::Io => WireResolverError::IO,
1381
1382            ResolverError::InvalidArgs => WireResolverError::INVALID_ARGS,
1383
1384            ResolverError::NotSupported => WireResolverError::NOT_SUPPORTED,
1385
1386            ResolverError::ManifestNotFound => WireResolverError::MANIFEST_NOT_FOUND,
1387
1388            ResolverError::PackageNotFound => WireResolverError::PACKAGE_NOT_FOUND,
1389
1390            ResolverError::NoSpace => WireResolverError::NO_SPACE,
1391
1392            ResolverError::ResourceUnavailable => WireResolverError::RESOURCE_UNAVAILABLE,
1393
1394            ResolverError::InvalidManifest => WireResolverError::INVALID_MANIFEST,
1395
1396            ResolverError::ConfigValuesNotFound => WireResolverError::CONFIG_VALUES_NOT_FOUND,
1397
1398            ResolverError::AbiRevisionNotFound => WireResolverError::ABI_REVISION_NOT_FOUND,
1399
1400            ResolverError::InvalidAbiRevision => WireResolverError::INVALID_ABI_REVISION,
1401        }
1402    }
1403}
1404
1405#[derive(Debug)]
1406pub struct ResolverResolveResponse {
1407    pub component: crate::Component,
1408}
1409
1410impl ::fidl_next::Encodable for ResolverResolveResponse {
1411    type Encoded = WireResolverResolveResponse<'static>;
1412}
1413
1414unsafe impl<___E> ::fidl_next::Encode<___E> for ResolverResolveResponse
1415where
1416    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1417
1418    ___E: ::fidl_next::Encoder,
1419
1420    ___E: ::fidl_next::fuchsia::HandleEncoder,
1421{
1422    #[inline]
1423    fn encode(
1424        self,
1425        encoder: &mut ___E,
1426        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1427    ) -> Result<(), ::fidl_next::EncodeError> {
1428        ::fidl_next::munge! {
1429            let Self::Encoded {
1430                component,
1431
1432            } = out;
1433        }
1434
1435        ::fidl_next::Encode::encode(self.component, encoder, component)?;
1436
1437        Ok(())
1438    }
1439}
1440
1441impl ::fidl_next::EncodableOption for ResolverResolveResponse {
1442    type EncodedOption = ::fidl_next::WireBox<'static, WireResolverResolveResponse<'static>>;
1443}
1444
1445unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ResolverResolveResponse
1446where
1447    ___E: ::fidl_next::Encoder + ?Sized,
1448    ResolverResolveResponse: ::fidl_next::Encode<___E>,
1449{
1450    #[inline]
1451    fn encode_option(
1452        this: Option<Self>,
1453        encoder: &mut ___E,
1454        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1455    ) -> Result<(), ::fidl_next::EncodeError> {
1456        if let Some(inner) = this {
1457            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1458            ::fidl_next::WireBox::encode_present(out);
1459        } else {
1460            ::fidl_next::WireBox::encode_absent(out);
1461        }
1462
1463        Ok(())
1464    }
1465}
1466
1467impl<'de> ::fidl_next::FromWire<WireResolverResolveResponse<'de>> for ResolverResolveResponse {
1468    #[inline]
1469    fn from_wire(wire: WireResolverResolveResponse<'de>) -> Self {
1470        Self { component: ::fidl_next::FromWire::from_wire(wire.component) }
1471    }
1472}
1473
1474/// The wire type corresponding to [`ResolverResolveResponse`].
1475#[derive(Debug)]
1476#[repr(C)]
1477pub struct WireResolverResolveResponse<'de> {
1478    pub component: crate::WireComponent<'de>,
1479}
1480
1481unsafe impl ::fidl_next::Wire for WireResolverResolveResponse<'static> {
1482    type Decoded<'de> = WireResolverResolveResponse<'de>;
1483
1484    #[inline]
1485    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1486}
1487
1488unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolverResolveResponse<'static>
1489where
1490    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1491
1492    ___D: ::fidl_next::Decoder,
1493
1494    ___D: ::fidl_next::fuchsia::HandleDecoder,
1495{
1496    fn decode(
1497        slot: ::fidl_next::Slot<'_, Self>,
1498        decoder: &mut ___D,
1499    ) -> Result<(), ::fidl_next::DecodeError> {
1500        ::fidl_next::munge! {
1501            let Self {
1502                mut component,
1503
1504            } = slot;
1505        }
1506
1507        ::fidl_next::Decode::decode(component.as_mut(), decoder)?;
1508
1509        Ok(())
1510    }
1511}
1512
1513#[derive(Debug)]
1514pub struct ResolverResolveWithContextResponse {
1515    pub component: crate::Component,
1516}
1517
1518impl ::fidl_next::Encodable for ResolverResolveWithContextResponse {
1519    type Encoded = WireResolverResolveWithContextResponse<'static>;
1520}
1521
1522unsafe impl<___E> ::fidl_next::Encode<___E> for ResolverResolveWithContextResponse
1523where
1524    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1525
1526    ___E: ::fidl_next::Encoder,
1527
1528    ___E: ::fidl_next::fuchsia::HandleEncoder,
1529{
1530    #[inline]
1531    fn encode(
1532        self,
1533        encoder: &mut ___E,
1534        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1535    ) -> Result<(), ::fidl_next::EncodeError> {
1536        ::fidl_next::munge! {
1537            let Self::Encoded {
1538                component,
1539
1540            } = out;
1541        }
1542
1543        ::fidl_next::Encode::encode(self.component, encoder, component)?;
1544
1545        Ok(())
1546    }
1547}
1548
1549impl ::fidl_next::EncodableOption for ResolverResolveWithContextResponse {
1550    type EncodedOption =
1551        ::fidl_next::WireBox<'static, WireResolverResolveWithContextResponse<'static>>;
1552}
1553
1554unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ResolverResolveWithContextResponse
1555where
1556    ___E: ::fidl_next::Encoder + ?Sized,
1557    ResolverResolveWithContextResponse: ::fidl_next::Encode<___E>,
1558{
1559    #[inline]
1560    fn encode_option(
1561        this: Option<Self>,
1562        encoder: &mut ___E,
1563        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
1564    ) -> Result<(), ::fidl_next::EncodeError> {
1565        if let Some(inner) = this {
1566            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1567            ::fidl_next::WireBox::encode_present(out);
1568        } else {
1569            ::fidl_next::WireBox::encode_absent(out);
1570        }
1571
1572        Ok(())
1573    }
1574}
1575
1576impl<'de> ::fidl_next::FromWire<WireResolverResolveWithContextResponse<'de>>
1577    for ResolverResolveWithContextResponse
1578{
1579    #[inline]
1580    fn from_wire(wire: WireResolverResolveWithContextResponse<'de>) -> Self {
1581        Self { component: ::fidl_next::FromWire::from_wire(wire.component) }
1582    }
1583}
1584
1585/// The wire type corresponding to [`ResolverResolveWithContextResponse`].
1586#[derive(Debug)]
1587#[repr(C)]
1588pub struct WireResolverResolveWithContextResponse<'de> {
1589    pub component: crate::WireComponent<'de>,
1590}
1591
1592unsafe impl ::fidl_next::Wire for WireResolverResolveWithContextResponse<'static> {
1593    type Decoded<'de> = WireResolverResolveWithContextResponse<'de>;
1594
1595    #[inline]
1596    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1597}
1598
1599unsafe impl<___D> ::fidl_next::Decode<___D> for WireResolverResolveWithContextResponse<'static>
1600where
1601    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1602
1603    ___D: ::fidl_next::Decoder,
1604
1605    ___D: ::fidl_next::fuchsia::HandleDecoder,
1606{
1607    fn decode(
1608        slot: ::fidl_next::Slot<'_, Self>,
1609        decoder: &mut ___D,
1610    ) -> Result<(), ::fidl_next::DecodeError> {
1611        ::fidl_next::munge! {
1612            let Self {
1613                mut component,
1614
1615            } = slot;
1616        }
1617
1618        ::fidl_next::Decode::decode(component.as_mut(), decoder)?;
1619
1620        Ok(())
1621    }
1622}
1623
1624/// The type corresponding to the Resolver protocol.
1625#[doc = " An interface for resolving a URL to a component.\n\n This interface is implemented by components that provide support\n for loading components with a particular URL scheme.   For example,\n the Fuchsia package component resolver exposes a service with this\n interface to resolve component URLs using the \"fuchsia-pkg://\" scheme.\n\n To use a resolver to resolve URLs within your realm, register it\n in your realm\'s manifest.\n\n Note: The component manager is the only intended direct client of this\n interface.\n"]
1626#[derive(Debug)]
1627pub struct Resolver;
1628
1629impl ::fidl_next::Discoverable for Resolver {
1630    const PROTOCOL_NAME: &'static str = "fuchsia.component.resolution.Resolver";
1631}
1632
1633pub mod resolver {
1634    pub mod prelude {
1635        pub use crate::{
1636            resolver, Resolver, ResolverClientHandler, ResolverClientSender, ResolverServerHandler,
1637            ResolverServerSender,
1638        };
1639
1640        pub use crate::ResolverError;
1641
1642        pub use crate::ResolverResolveRequest;
1643
1644        pub use crate::ResolverResolveWithContextRequest;
1645
1646        pub use crate::ResolverResolveWithContextResponse;
1647
1648        pub use crate::ResolverResolveResponse;
1649    }
1650
1651    pub struct Resolve;
1652
1653    impl ::fidl_next::Method for Resolve {
1654        const ORDINAL: u64 = 6339326548187935461;
1655
1656        type Protocol = crate::Resolver;
1657
1658        type Request = crate::WireResolverResolveRequest<'static>;
1659
1660        type Response = ::fidl_next::WireResult<
1661            'static,
1662            crate::WireResolverResolveResponse<'static>,
1663            crate::WireResolverError,
1664        >;
1665    }
1666
1667    pub struct ResolveWithContext;
1668
1669    impl ::fidl_next::Method for ResolveWithContext {
1670        const ORDINAL: u64 = 5576776708309151933;
1671
1672        type Protocol = crate::Resolver;
1673
1674        type Request = crate::WireResolverResolveWithContextRequest<'static>;
1675
1676        type Response = ::fidl_next::WireResult<
1677            'static,
1678            crate::WireResolverResolveWithContextResponse<'static>,
1679            crate::WireResolverError,
1680        >;
1681    }
1682}
1683
1684/// A helper trait for the `Resolver` client sender.
1685pub trait ResolverClientSender {
1686    type Transport: ::fidl_next::Transport;
1687
1688    #[doc = " Resolves a component with the given absolute URL.\n\n `component_url` is the unescaped URL of the component to resolve.\n\n If successful, returns information about the component\n that was resolved.\n\n On failure, returns a `ResolverError` error.\n"]
1689    fn resolve<___R>(
1690        &self,
1691        request: ___R,
1692    ) -> Result<
1693        ::fidl_next::ResponseFuture<'_, Self::Transport, resolver::Resolve>,
1694        ::fidl_next::EncodeError,
1695    >
1696    where
1697        ___R: ::fidl_next::Encode<
1698            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1699            Encoded = crate::WireResolverResolveRequest<'static>,
1700        >;
1701
1702    #[doc = " Resolves a component with the absolute or relative URL. If relative, the\n component will be resolved relative to the supplied `context`.\n\n `component_url` is the unescaped URL of the component to resolve, the\n format of which can be either:\n\n   * a fully-qualified absolute component URL; or\n   * a subpackaged-component reference, prefixed by a URI relative\n     path to its containing subpackage (for example,\n     `child_package#meta/some_component.cm`)\n\n `context` is the `resolution_context` of a previously-resolved\n `Component`, providing the context for resoving a relative URL.\n"]
1703    fn resolve_with_context<___R>(
1704        &self,
1705        request: ___R,
1706    ) -> Result<
1707        ::fidl_next::ResponseFuture<'_, Self::Transport, resolver::ResolveWithContext>,
1708        ::fidl_next::EncodeError,
1709    >
1710    where
1711        ___R: ::fidl_next::Encode<
1712            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1713            Encoded = crate::WireResolverResolveWithContextRequest<'static>,
1714        >;
1715}
1716
1717impl<___T> ResolverClientSender for ::fidl_next::ClientSender<___T, Resolver>
1718where
1719    ___T: ::fidl_next::Transport,
1720{
1721    type Transport = ___T;
1722
1723    #[doc = " Resolves a component with the given absolute URL.\n\n `component_url` is the unescaped URL of the component to resolve.\n\n If successful, returns information about the component\n that was resolved.\n\n On failure, returns a `ResolverError` error.\n"]
1724    fn resolve<___R>(
1725        &self,
1726        request: ___R,
1727    ) -> Result<
1728        ::fidl_next::ResponseFuture<'_, Self::Transport, resolver::Resolve>,
1729        ::fidl_next::EncodeError,
1730    >
1731    where
1732        ___R: ::fidl_next::Encode<
1733            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1734            Encoded = crate::WireResolverResolveRequest<'static>,
1735        >,
1736    {
1737        self.as_untyped()
1738            .send_two_way(6339326548187935461, request)
1739            .map(::fidl_next::ResponseFuture::from_untyped)
1740    }
1741
1742    #[doc = " Resolves a component with the absolute or relative URL. If relative, the\n component will be resolved relative to the supplied `context`.\n\n `component_url` is the unescaped URL of the component to resolve, the\n format of which can be either:\n\n   * a fully-qualified absolute component URL; or\n   * a subpackaged-component reference, prefixed by a URI relative\n     path to its containing subpackage (for example,\n     `child_package#meta/some_component.cm`)\n\n `context` is the `resolution_context` of a previously-resolved\n `Component`, providing the context for resoving a relative URL.\n"]
1743    fn resolve_with_context<___R>(
1744        &self,
1745        request: ___R,
1746    ) -> Result<
1747        ::fidl_next::ResponseFuture<'_, Self::Transport, resolver::ResolveWithContext>,
1748        ::fidl_next::EncodeError,
1749    >
1750    where
1751        ___R: ::fidl_next::Encode<
1752            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1753            Encoded = crate::WireResolverResolveWithContextRequest<'static>,
1754        >,
1755    {
1756        self.as_untyped()
1757            .send_two_way(5576776708309151933, request)
1758            .map(::fidl_next::ResponseFuture::from_untyped)
1759    }
1760}
1761
1762/// A client handler for the Resolver protocol.
1763///
1764/// See [`Resolver`] for more details.
1765pub trait ResolverClientHandler<___T: ::fidl_next::Transport> {
1766    fn on_unknown_interaction(
1767        &mut self,
1768        sender: &::fidl_next::ClientSender<___T, Resolver>,
1769        ordinal: u64,
1770    ) {
1771        sender.close();
1772    }
1773}
1774
1775impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for Resolver
1776where
1777    ___T: ::fidl_next::Transport,
1778    ___H: ResolverClientHandler<___T>,
1779
1780    <resolver::Resolve as ::fidl_next::Method>::Response:
1781        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1782
1783    <resolver::ResolveWithContext as ::fidl_next::Method>::Response:
1784        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1785{
1786    fn on_event(
1787        handler: &mut ___H,
1788        sender: &::fidl_next::ClientSender<___T, Self>,
1789        ordinal: u64,
1790        buffer: ___T::RecvBuffer,
1791    ) {
1792        match ordinal {
1793            ordinal => handler.on_unknown_interaction(sender, ordinal),
1794        }
1795    }
1796}
1797
1798/// A helper trait for the `Resolver` server sender.
1799pub trait ResolverServerSender {
1800    type Transport: ::fidl_next::Transport;
1801}
1802
1803impl<___T> ResolverServerSender for ::fidl_next::ServerSender<___T, Resolver>
1804where
1805    ___T: ::fidl_next::Transport,
1806{
1807    type Transport = ___T;
1808}
1809
1810/// A server handler for the Resolver protocol.
1811///
1812/// See [`Resolver`] for more details.
1813pub trait ResolverServerHandler<___T: ::fidl_next::Transport> {
1814    #[doc = " Resolves a component with the given absolute URL.\n\n `component_url` is the unescaped URL of the component to resolve.\n\n If successful, returns information about the component\n that was resolved.\n\n On failure, returns a `ResolverError` error.\n"]
1815    fn resolve(
1816        &mut self,
1817        sender: &::fidl_next::ServerSender<___T, Resolver>,
1818
1819        request: ::fidl_next::Request<___T, resolver::Resolve>,
1820
1821        responder: ::fidl_next::Responder<resolver::Resolve>,
1822    );
1823
1824    #[doc = " Resolves a component with the absolute or relative URL. If relative, the\n component will be resolved relative to the supplied `context`.\n\n `component_url` is the unescaped URL of the component to resolve, the\n format of which can be either:\n\n   * a fully-qualified absolute component URL; or\n   * a subpackaged-component reference, prefixed by a URI relative\n     path to its containing subpackage (for example,\n     `child_package#meta/some_component.cm`)\n\n `context` is the `resolution_context` of a previously-resolved\n `Component`, providing the context for resoving a relative URL.\n"]
1825    fn resolve_with_context(
1826        &mut self,
1827        sender: &::fidl_next::ServerSender<___T, Resolver>,
1828
1829        request: ::fidl_next::Request<___T, resolver::ResolveWithContext>,
1830
1831        responder: ::fidl_next::Responder<resolver::ResolveWithContext>,
1832    );
1833
1834    fn on_unknown_interaction(
1835        &mut self,
1836        sender: &::fidl_next::ServerSender<___T, Resolver>,
1837        ordinal: u64,
1838    ) {
1839        sender.close();
1840    }
1841}
1842
1843impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for Resolver
1844where
1845    ___T: ::fidl_next::Transport,
1846    ___H: ResolverServerHandler<___T>,
1847
1848    <resolver::Resolve as ::fidl_next::Method>::Request:
1849        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1850
1851    <resolver::ResolveWithContext as ::fidl_next::Method>::Request:
1852        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1853{
1854    fn on_one_way(
1855        handler: &mut ___H,
1856        sender: &::fidl_next::ServerSender<___T, Self>,
1857        ordinal: u64,
1858        buffer: ___T::RecvBuffer,
1859    ) {
1860        match ordinal {
1861            ordinal => handler.on_unknown_interaction(sender, ordinal),
1862        }
1863    }
1864
1865    fn on_two_way(
1866        handler: &mut ___H,
1867        sender: &::fidl_next::ServerSender<___T, Self>,
1868        ordinal: u64,
1869        buffer: ___T::RecvBuffer,
1870        responder: ::fidl_next::protocol::Responder,
1871    ) {
1872        match ordinal {
1873            6339326548187935461 => {
1874                let responder = ::fidl_next::Responder::from_untyped(responder);
1875
1876                match ::fidl_next::DecoderExt::decode(buffer) {
1877                    Ok(decoded) => handler.resolve(sender, decoded, responder),
1878                    Err(e) => {
1879                        sender.close();
1880                    }
1881                }
1882            }
1883
1884            5576776708309151933 => {
1885                let responder = ::fidl_next::Responder::from_untyped(responder);
1886
1887                match ::fidl_next::DecoderExt::decode(buffer) {
1888                    Ok(decoded) => handler.resolve_with_context(sender, decoded, responder),
1889                    Err(e) => {
1890                        sender.close();
1891                    }
1892                }
1893            }
1894
1895            ordinal => handler.on_unknown_interaction(sender, ordinal),
1896        }
1897    }
1898}
1899
1900/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
1901pub mod compat {
1902
1903    impl ::core::convert::From<crate::ResolverError>
1904        for ::fidl_fuchsia_component_resolution::ResolverError
1905    {
1906        #[inline]
1907        fn from(from: crate::ResolverError) -> Self {
1908            match crate::ResolverError::from(from) {
1909                crate::ResolverError::Internal => Self::Internal,
1910
1911                crate::ResolverError::Io => Self::Io,
1912
1913                crate::ResolverError::InvalidArgs => Self::InvalidArgs,
1914
1915                crate::ResolverError::NotSupported => Self::NotSupported,
1916
1917                crate::ResolverError::ManifestNotFound => Self::ManifestNotFound,
1918
1919                crate::ResolverError::PackageNotFound => Self::PackageNotFound,
1920
1921                crate::ResolverError::NoSpace => Self::NoSpace,
1922
1923                crate::ResolverError::ResourceUnavailable => Self::ResourceUnavailable,
1924
1925                crate::ResolverError::InvalidManifest => Self::InvalidManifest,
1926
1927                crate::ResolverError::ConfigValuesNotFound => Self::ConfigValuesNotFound,
1928
1929                crate::ResolverError::AbiRevisionNotFound => Self::AbiRevisionNotFound,
1930
1931                crate::ResolverError::InvalidAbiRevision => Self::InvalidAbiRevision,
1932            }
1933        }
1934    }
1935
1936    #[cfg(target_os = "fuchsia")]
1937    /// An alias for a client sender over `zx::Channel` for the `Resolver`
1938    /// protocol.
1939    pub type ResolverProxy =
1940        ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::Resolver>;
1941
1942    impl ::core::convert::From<crate::Resolver>
1943        for ::fidl_fuchsia_component_resolution::ResolverMarker
1944    {
1945        #[inline]
1946        fn from(_: crate::Resolver) -> Self {
1947            Self
1948        }
1949    }
1950}