Skip to main content

fidl_next_common_fuchsia_component_resolution/
fidl_next_common_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
5pub mod natural {
6
7    #[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"]
8    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9    pub struct Context {
10        pub bytes: ::std::vec::Vec<u8>,
11    }
12
13    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Context<'static>, ___E> for Context
14    where
15        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
16        ___E: ::fidl_next::Encoder,
17    {
18        #[inline]
19        fn encode(
20            self,
21            encoder_: &mut ___E,
22            out_: &mut ::core::mem::MaybeUninit<crate::wire::Context<'static>>,
23            _: (),
24        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
25            ::fidl_next::munge! {
26                let crate::wire::Context {
27                    bytes,
28
29                } = out_;
30            }
31
32            ::fidl_next::Encode::encode(self.bytes, encoder_, bytes, (8192, ()))?;
33
34            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(bytes.as_mut_ptr()) };
35            ::fidl_next::Constrained::validate(_field, (8192, ()))?;
36
37            Ok(())
38        }
39    }
40
41    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Context<'static>, ___E> for &'a Context
42    where
43        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
44        ___E: ::fidl_next::Encoder,
45    {
46        #[inline]
47        fn encode(
48            self,
49            encoder_: &mut ___E,
50            out_: &mut ::core::mem::MaybeUninit<crate::wire::Context<'static>>,
51            _: (),
52        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
53            ::fidl_next::munge! {
54                let crate::wire::Context {
55
56                    bytes,
57
58                } = out_;
59            }
60
61            ::fidl_next::Encode::encode(&self.bytes, encoder_, bytes, (8192, ()))?;
62
63            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(bytes.as_mut_ptr()) };
64            ::fidl_next::Constrained::validate(_field, (8192, ()))?;
65
66            Ok(())
67        }
68    }
69
70    unsafe impl<___E>
71        ::fidl_next::EncodeOption<
72            ::fidl_next::wire::Box<'static, crate::wire::Context<'static>>,
73            ___E,
74        > for Context
75    where
76        ___E: ::fidl_next::Encoder + ?Sized,
77        Context: ::fidl_next::Encode<crate::wire::Context<'static>, ___E>,
78    {
79        #[inline]
80        fn encode_option(
81            this: ::core::option::Option<Self>,
82            encoder: &mut ___E,
83            out: &mut ::core::mem::MaybeUninit<
84                ::fidl_next::wire::Box<'static, crate::wire::Context<'static>>,
85            >,
86            _: (),
87        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
88            if let Some(inner) = this {
89                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
90                ::fidl_next::wire::Box::encode_present(out);
91            } else {
92                ::fidl_next::wire::Box::encode_absent(out);
93            }
94
95            Ok(())
96        }
97    }
98
99    unsafe impl<'a, ___E>
100        ::fidl_next::EncodeOption<
101            ::fidl_next::wire::Box<'static, crate::wire::Context<'static>>,
102            ___E,
103        > for &'a Context
104    where
105        ___E: ::fidl_next::Encoder + ?Sized,
106        &'a Context: ::fidl_next::Encode<crate::wire::Context<'static>, ___E>,
107    {
108        #[inline]
109        fn encode_option(
110            this: ::core::option::Option<Self>,
111            encoder: &mut ___E,
112            out: &mut ::core::mem::MaybeUninit<
113                ::fidl_next::wire::Box<'static, crate::wire::Context<'static>>,
114            >,
115            _: (),
116        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
117            if let Some(inner) = this {
118                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
119                ::fidl_next::wire::Box::encode_present(out);
120            } else {
121                ::fidl_next::wire::Box::encode_absent(out);
122            }
123
124            Ok(())
125        }
126    }
127
128    impl<'de> ::fidl_next::FromWire<crate::wire::Context<'de>> for Context {
129        #[inline]
130        fn from_wire(wire: crate::wire::Context<'de>) -> Self {
131            Self { bytes: ::fidl_next::FromWire::from_wire(wire.bytes) }
132        }
133    }
134
135    impl<'de> ::fidl_next::FromWireRef<crate::wire::Context<'de>> for Context {
136        #[inline]
137        fn from_wire_ref(wire: &crate::wire::Context<'de>) -> Self {
138            Self { bytes: ::fidl_next::FromWireRef::from_wire_ref(&wire.bytes) }
139        }
140    }
141
142    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
143    pub struct ResolverResolveRequest {
144        pub component_url: ::std::string::String,
145    }
146
147    unsafe impl<___E> ::fidl_next::Encode<crate::wire::ResolverResolveRequest<'static>, ___E>
148        for ResolverResolveRequest
149    where
150        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
151        ___E: ::fidl_next::Encoder,
152    {
153        #[inline]
154        fn encode(
155            self,
156            encoder_: &mut ___E,
157            out_: &mut ::core::mem::MaybeUninit<crate::wire::ResolverResolveRequest<'static>>,
158            _: (),
159        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
160            ::fidl_next::munge! {
161                let crate::wire::ResolverResolveRequest {
162                    component_url,
163
164                } = out_;
165            }
166
167            ::fidl_next::Encode::encode(self.component_url, encoder_, component_url, 2083)?;
168
169            let mut _field =
170                unsafe { ::fidl_next::Slot::new_unchecked(component_url.as_mut_ptr()) };
171            ::fidl_next::Constrained::validate(_field, 2083)?;
172
173            Ok(())
174        }
175    }
176
177    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ResolverResolveRequest<'static>, ___E>
178        for &'a ResolverResolveRequest
179    where
180        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
181        ___E: ::fidl_next::Encoder,
182    {
183        #[inline]
184        fn encode(
185            self,
186            encoder_: &mut ___E,
187            out_: &mut ::core::mem::MaybeUninit<crate::wire::ResolverResolveRequest<'static>>,
188            _: (),
189        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
190            ::fidl_next::munge! {
191                let crate::wire::ResolverResolveRequest {
192
193                    component_url,
194
195                } = out_;
196            }
197
198            ::fidl_next::Encode::encode(&self.component_url, encoder_, component_url, 2083)?;
199
200            let mut _field =
201                unsafe { ::fidl_next::Slot::new_unchecked(component_url.as_mut_ptr()) };
202            ::fidl_next::Constrained::validate(_field, 2083)?;
203
204            Ok(())
205        }
206    }
207
208    unsafe impl<___E>
209        ::fidl_next::EncodeOption<
210            ::fidl_next::wire::Box<'static, crate::wire::ResolverResolveRequest<'static>>,
211            ___E,
212        > for ResolverResolveRequest
213    where
214        ___E: ::fidl_next::Encoder + ?Sized,
215        ResolverResolveRequest:
216            ::fidl_next::Encode<crate::wire::ResolverResolveRequest<'static>, ___E>,
217    {
218        #[inline]
219        fn encode_option(
220            this: ::core::option::Option<Self>,
221            encoder: &mut ___E,
222            out: &mut ::core::mem::MaybeUninit<
223                ::fidl_next::wire::Box<'static, crate::wire::ResolverResolveRequest<'static>>,
224            >,
225            _: (),
226        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
227            if let Some(inner) = this {
228                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
229                ::fidl_next::wire::Box::encode_present(out);
230            } else {
231                ::fidl_next::wire::Box::encode_absent(out);
232            }
233
234            Ok(())
235        }
236    }
237
238    unsafe impl<'a, ___E>
239        ::fidl_next::EncodeOption<
240            ::fidl_next::wire::Box<'static, crate::wire::ResolverResolveRequest<'static>>,
241            ___E,
242        > for &'a ResolverResolveRequest
243    where
244        ___E: ::fidl_next::Encoder + ?Sized,
245        &'a ResolverResolveRequest:
246            ::fidl_next::Encode<crate::wire::ResolverResolveRequest<'static>, ___E>,
247    {
248        #[inline]
249        fn encode_option(
250            this: ::core::option::Option<Self>,
251            encoder: &mut ___E,
252            out: &mut ::core::mem::MaybeUninit<
253                ::fidl_next::wire::Box<'static, crate::wire::ResolverResolveRequest<'static>>,
254            >,
255            _: (),
256        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
257            if let Some(inner) = this {
258                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
259                ::fidl_next::wire::Box::encode_present(out);
260            } else {
261                ::fidl_next::wire::Box::encode_absent(out);
262            }
263
264            Ok(())
265        }
266    }
267
268    impl<'de> ::fidl_next::FromWire<crate::wire::ResolverResolveRequest<'de>>
269        for ResolverResolveRequest
270    {
271        #[inline]
272        fn from_wire(wire: crate::wire::ResolverResolveRequest<'de>) -> Self {
273            Self { component_url: ::fidl_next::FromWire::from_wire(wire.component_url) }
274        }
275    }
276
277    impl<'de> ::fidl_next::FromWireRef<crate::wire::ResolverResolveRequest<'de>>
278        for ResolverResolveRequest
279    {
280        #[inline]
281        fn from_wire_ref(wire: &crate::wire::ResolverResolveRequest<'de>) -> Self {
282            Self { component_url: ::fidl_next::FromWireRef::from_wire_ref(&wire.component_url) }
283        }
284    }
285
286    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
287    pub struct ResolverResolveWithContextRequest {
288        pub component_url: ::std::string::String,
289
290        pub context: crate::natural::Context,
291    }
292
293    unsafe impl<___E>
294        ::fidl_next::Encode<crate::wire::ResolverResolveWithContextRequest<'static>, ___E>
295        for ResolverResolveWithContextRequest
296    where
297        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
298        ___E: ::fidl_next::Encoder,
299    {
300        #[inline]
301        fn encode(
302            self,
303            encoder_: &mut ___E,
304            out_: &mut ::core::mem::MaybeUninit<
305                crate::wire::ResolverResolveWithContextRequest<'static>,
306            >,
307            _: (),
308        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
309            ::fidl_next::munge! {
310                let crate::wire::ResolverResolveWithContextRequest {
311                    component_url,
312                    context,
313
314                } = out_;
315            }
316
317            ::fidl_next::Encode::encode(self.component_url, encoder_, component_url, 2083)?;
318
319            let mut _field =
320                unsafe { ::fidl_next::Slot::new_unchecked(component_url.as_mut_ptr()) };
321            ::fidl_next::Constrained::validate(_field, 2083)?;
322
323            ::fidl_next::Encode::encode(self.context, encoder_, context, ())?;
324
325            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(context.as_mut_ptr()) };
326
327            Ok(())
328        }
329    }
330
331    unsafe impl<'a, ___E>
332        ::fidl_next::Encode<crate::wire::ResolverResolveWithContextRequest<'static>, ___E>
333        for &'a ResolverResolveWithContextRequest
334    where
335        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
336        ___E: ::fidl_next::Encoder,
337    {
338        #[inline]
339        fn encode(
340            self,
341            encoder_: &mut ___E,
342            out_: &mut ::core::mem::MaybeUninit<
343                crate::wire::ResolverResolveWithContextRequest<'static>,
344            >,
345            _: (),
346        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
347            ::fidl_next::munge! {
348                let crate::wire::ResolverResolveWithContextRequest {
349
350                    component_url,
351                    context,
352
353                } = out_;
354            }
355
356            ::fidl_next::Encode::encode(&self.component_url, encoder_, component_url, 2083)?;
357
358            let mut _field =
359                unsafe { ::fidl_next::Slot::new_unchecked(component_url.as_mut_ptr()) };
360            ::fidl_next::Constrained::validate(_field, 2083)?;
361
362            ::fidl_next::Encode::encode(&self.context, encoder_, context, ())?;
363
364            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(context.as_mut_ptr()) };
365
366            Ok(())
367        }
368    }
369
370    unsafe impl<___E>
371        ::fidl_next::EncodeOption<
372            ::fidl_next::wire::Box<
373                'static,
374                crate::wire::ResolverResolveWithContextRequest<'static>,
375            >,
376            ___E,
377        > for ResolverResolveWithContextRequest
378    where
379        ___E: ::fidl_next::Encoder + ?Sized,
380        ResolverResolveWithContextRequest:
381            ::fidl_next::Encode<crate::wire::ResolverResolveWithContextRequest<'static>, ___E>,
382    {
383        #[inline]
384        fn encode_option(
385            this: ::core::option::Option<Self>,
386            encoder: &mut ___E,
387            out: &mut ::core::mem::MaybeUninit<
388                ::fidl_next::wire::Box<
389                    'static,
390                    crate::wire::ResolverResolveWithContextRequest<'static>,
391                >,
392            >,
393            _: (),
394        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
395            if let Some(inner) = this {
396                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
397                ::fidl_next::wire::Box::encode_present(out);
398            } else {
399                ::fidl_next::wire::Box::encode_absent(out);
400            }
401
402            Ok(())
403        }
404    }
405
406    unsafe impl<'a, ___E>
407        ::fidl_next::EncodeOption<
408            ::fidl_next::wire::Box<
409                'static,
410                crate::wire::ResolverResolveWithContextRequest<'static>,
411            >,
412            ___E,
413        > for &'a ResolverResolveWithContextRequest
414    where
415        ___E: ::fidl_next::Encoder + ?Sized,
416        &'a ResolverResolveWithContextRequest:
417            ::fidl_next::Encode<crate::wire::ResolverResolveWithContextRequest<'static>, ___E>,
418    {
419        #[inline]
420        fn encode_option(
421            this: ::core::option::Option<Self>,
422            encoder: &mut ___E,
423            out: &mut ::core::mem::MaybeUninit<
424                ::fidl_next::wire::Box<
425                    'static,
426                    crate::wire::ResolverResolveWithContextRequest<'static>,
427                >,
428            >,
429            _: (),
430        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
431            if let Some(inner) = this {
432                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
433                ::fidl_next::wire::Box::encode_present(out);
434            } else {
435                ::fidl_next::wire::Box::encode_absent(out);
436            }
437
438            Ok(())
439        }
440    }
441
442    impl<'de> ::fidl_next::FromWire<crate::wire::ResolverResolveWithContextRequest<'de>>
443        for ResolverResolveWithContextRequest
444    {
445        #[inline]
446        fn from_wire(wire: crate::wire::ResolverResolveWithContextRequest<'de>) -> Self {
447            Self {
448                component_url: ::fidl_next::FromWire::from_wire(wire.component_url),
449
450                context: ::fidl_next::FromWire::from_wire(wire.context),
451            }
452        }
453    }
454
455    impl<'de> ::fidl_next::FromWireRef<crate::wire::ResolverResolveWithContextRequest<'de>>
456        for ResolverResolveWithContextRequest
457    {
458        #[inline]
459        fn from_wire_ref(wire: &crate::wire::ResolverResolveWithContextRequest<'de>) -> Self {
460            Self {
461                component_url: ::fidl_next::FromWireRef::from_wire_ref(&wire.component_url),
462
463                context: ::fidl_next::FromWireRef::from_wire_ref(&wire.context),
464            }
465        }
466    }
467
468    #[doc = " The possible error conditions returned by ComponentResolver.\n"]
469    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
470    #[repr(u32)]
471    pub enum ResolverError {
472        Internal = 1,
473        Io = 2,
474        InvalidArgs = 3,
475        NotSupported = 4,
476        ManifestNotFound = 5,
477        PackageNotFound = 6,
478        NoSpace = 7,
479        ResourceUnavailable = 8,
480        InvalidManifest = 9,
481        ConfigValuesNotFound = 10,
482        AbiRevisionNotFound = 11,
483        InvalidAbiRevision = 12,
484    }
485    impl ::core::convert::TryFrom<u32> for ResolverError {
486        type Error = ::fidl_next::UnknownStrictEnumMemberError;
487        fn try_from(
488            value: u32,
489        ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
490            match value {
491                1 => Ok(Self::Internal),
492                2 => Ok(Self::Io),
493                3 => Ok(Self::InvalidArgs),
494                4 => Ok(Self::NotSupported),
495                5 => Ok(Self::ManifestNotFound),
496                6 => Ok(Self::PackageNotFound),
497                7 => Ok(Self::NoSpace),
498                8 => Ok(Self::ResourceUnavailable),
499                9 => Ok(Self::InvalidManifest),
500                10 => Ok(Self::ConfigValuesNotFound),
501                11 => Ok(Self::AbiRevisionNotFound),
502                12 => Ok(Self::InvalidAbiRevision),
503
504                _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
505            }
506        }
507    }
508
509    unsafe impl<___E> ::fidl_next::Encode<crate::wire::ResolverError, ___E> for ResolverError
510    where
511        ___E: ?Sized,
512    {
513        #[inline]
514        fn encode(
515            self,
516            encoder: &mut ___E,
517            out: &mut ::core::mem::MaybeUninit<crate::wire::ResolverError>,
518            _: (),
519        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
520            ::fidl_next::Encode::encode(&self, encoder, out, ())
521        }
522    }
523
524    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ResolverError, ___E> for &'a ResolverError
525    where
526        ___E: ?Sized,
527    {
528        #[inline]
529        fn encode(
530            self,
531            encoder: &mut ___E,
532            out: &mut ::core::mem::MaybeUninit<crate::wire::ResolverError>,
533            _: (),
534        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
535            ::fidl_next::munge!(let crate::wire::ResolverError { value } = out);
536            let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
537                ResolverError::Internal => 1,
538
539                ResolverError::Io => 2,
540
541                ResolverError::InvalidArgs => 3,
542
543                ResolverError::NotSupported => 4,
544
545                ResolverError::ManifestNotFound => 5,
546
547                ResolverError::PackageNotFound => 6,
548
549                ResolverError::NoSpace => 7,
550
551                ResolverError::ResourceUnavailable => 8,
552
553                ResolverError::InvalidManifest => 9,
554
555                ResolverError::ConfigValuesNotFound => 10,
556
557                ResolverError::AbiRevisionNotFound => 11,
558
559                ResolverError::InvalidAbiRevision => 12,
560            }));
561
562            Ok(())
563        }
564    }
565
566    impl ::core::convert::From<crate::wire::ResolverError> for ResolverError {
567        fn from(wire: crate::wire::ResolverError) -> Self {
568            match u32::from(wire.value) {
569                1 => Self::Internal,
570
571                2 => Self::Io,
572
573                3 => Self::InvalidArgs,
574
575                4 => Self::NotSupported,
576
577                5 => Self::ManifestNotFound,
578
579                6 => Self::PackageNotFound,
580
581                7 => Self::NoSpace,
582
583                8 => Self::ResourceUnavailable,
584
585                9 => Self::InvalidManifest,
586
587                10 => Self::ConfigValuesNotFound,
588
589                11 => Self::AbiRevisionNotFound,
590
591                12 => Self::InvalidAbiRevision,
592
593                _ => unsafe { ::core::hint::unreachable_unchecked() },
594            }
595        }
596    }
597
598    impl ::fidl_next::FromWire<crate::wire::ResolverError> for ResolverError {
599        #[inline]
600        fn from_wire(wire: crate::wire::ResolverError) -> Self {
601            Self::from(wire)
602        }
603    }
604
605    impl ::fidl_next::FromWireRef<crate::wire::ResolverError> for ResolverError {
606        #[inline]
607        fn from_wire_ref(wire: &crate::wire::ResolverError) -> Self {
608            Self::from(*wire)
609        }
610    }
611}
612
613pub mod wire {
614
615    /// The wire type corresponding to [`Context`].
616    #[derive(Debug)]
617    #[repr(C)]
618    pub struct Context<'de> {
619        pub bytes: ::fidl_next::wire::Vector<'de, u8>,
620    }
621
622    static_assertions::const_assert_eq!(std::mem::size_of::<Context<'_>>(), 16);
623    static_assertions::const_assert_eq!(std::mem::align_of::<Context<'_>>(), 8);
624
625    static_assertions::const_assert_eq!(std::mem::offset_of!(Context<'_>, bytes), 0);
626
627    impl ::fidl_next::Constrained for Context<'_> {
628        type Constraint = ();
629
630        fn validate(
631            _: ::fidl_next::Slot<'_, Self>,
632            _: Self::Constraint,
633        ) -> Result<(), ::fidl_next::ValidationError> {
634            Ok(())
635        }
636    }
637
638    unsafe impl ::fidl_next::Wire for Context<'static> {
639        type Narrowed<'de> = Context<'de>;
640
641        #[inline]
642        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
643            ::fidl_next::munge! {
644                let Self {
645
646                    bytes,
647
648                } = &mut *out_;
649            }
650
651            ::fidl_next::Wire::zero_padding(bytes);
652        }
653    }
654
655    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Context<'de>
656    where
657        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
658        ___D: ::fidl_next::Decoder<'de>,
659    {
660        fn decode(
661            slot_: ::fidl_next::Slot<'_, Self>,
662            decoder_: &mut ___D,
663            _: (),
664        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
665            ::fidl_next::munge! {
666                let Self {
667
668                    mut bytes,
669
670                } = slot_;
671            }
672
673            let _field = bytes.as_mut();
674            ::fidl_next::Constrained::validate(_field, (8192, ()))?;
675            ::fidl_next::Decode::decode(bytes.as_mut(), decoder_, (8192, ()))?;
676
677            let bytes = unsafe { bytes.deref_unchecked() };
678
679            if bytes.len() > 8192 {
680                return Err(::fidl_next::DecodeError::VectorTooLong {
681                    size: bytes.len() as u64,
682                    limit: 8192,
683                });
684            }
685
686            Ok(())
687        }
688    }
689
690    impl<'de> ::fidl_next::IntoNatural for Context<'de> {
691        type Natural = crate::natural::Context;
692    }
693
694    /// The wire type corresponding to [`ResolverResolveRequest`].
695    #[derive(Debug)]
696    #[repr(C)]
697    pub struct ResolverResolveRequest<'de> {
698        pub component_url: ::fidl_next::wire::String<'de>,
699    }
700
701    static_assertions::const_assert_eq!(std::mem::size_of::<ResolverResolveRequest<'_>>(), 16);
702    static_assertions::const_assert_eq!(std::mem::align_of::<ResolverResolveRequest<'_>>(), 8);
703
704    static_assertions::const_assert_eq!(
705        std::mem::offset_of!(ResolverResolveRequest<'_>, component_url),
706        0
707    );
708
709    impl ::fidl_next::Constrained for ResolverResolveRequest<'_> {
710        type Constraint = ();
711
712        fn validate(
713            _: ::fidl_next::Slot<'_, Self>,
714            _: Self::Constraint,
715        ) -> Result<(), ::fidl_next::ValidationError> {
716            Ok(())
717        }
718    }
719
720    unsafe impl ::fidl_next::Wire for ResolverResolveRequest<'static> {
721        type Narrowed<'de> = ResolverResolveRequest<'de>;
722
723        #[inline]
724        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
725            ::fidl_next::munge! {
726                let Self {
727
728                    component_url,
729
730                } = &mut *out_;
731            }
732
733            ::fidl_next::Wire::zero_padding(component_url);
734        }
735    }
736
737    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ResolverResolveRequest<'de>
738    where
739        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
740        ___D: ::fidl_next::Decoder<'de>,
741    {
742        fn decode(
743            slot_: ::fidl_next::Slot<'_, Self>,
744            decoder_: &mut ___D,
745            _: (),
746        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
747            ::fidl_next::munge! {
748                let Self {
749
750                    mut component_url,
751
752                } = slot_;
753            }
754
755            let _field = component_url.as_mut();
756            ::fidl_next::Constrained::validate(_field, 2083)?;
757            ::fidl_next::Decode::decode(component_url.as_mut(), decoder_, 2083)?;
758
759            let component_url = unsafe { component_url.deref_unchecked() };
760
761            if component_url.len() > 2083 {
762                return Err(::fidl_next::DecodeError::VectorTooLong {
763                    size: component_url.len() as u64,
764                    limit: 2083,
765                });
766            }
767
768            Ok(())
769        }
770    }
771
772    impl<'de> ::fidl_next::IntoNatural for ResolverResolveRequest<'de> {
773        type Natural = crate::natural::ResolverResolveRequest;
774    }
775
776    /// The wire type corresponding to [`ResolverResolveWithContextRequest`].
777    #[derive(Debug)]
778    #[repr(C)]
779    pub struct ResolverResolveWithContextRequest<'de> {
780        pub component_url: ::fidl_next::wire::String<'de>,
781
782        pub context: crate::wire::Context<'de>,
783    }
784
785    static_assertions::const_assert_eq!(
786        std::mem::size_of::<ResolverResolveWithContextRequest<'_>>(),
787        32
788    );
789    static_assertions::const_assert_eq!(
790        std::mem::align_of::<ResolverResolveWithContextRequest<'_>>(),
791        8
792    );
793
794    static_assertions::const_assert_eq!(
795        std::mem::offset_of!(ResolverResolveWithContextRequest<'_>, component_url),
796        0
797    );
798
799    static_assertions::const_assert_eq!(
800        std::mem::offset_of!(ResolverResolveWithContextRequest<'_>, context),
801        16
802    );
803
804    impl ::fidl_next::Constrained for ResolverResolveWithContextRequest<'_> {
805        type Constraint = ();
806
807        fn validate(
808            _: ::fidl_next::Slot<'_, Self>,
809            _: Self::Constraint,
810        ) -> Result<(), ::fidl_next::ValidationError> {
811            Ok(())
812        }
813    }
814
815    unsafe impl ::fidl_next::Wire for ResolverResolveWithContextRequest<'static> {
816        type Narrowed<'de> = ResolverResolveWithContextRequest<'de>;
817
818        #[inline]
819        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
820            ::fidl_next::munge! {
821                let Self {
822
823                    component_url,
824                    context,
825
826                } = &mut *out_;
827            }
828
829            ::fidl_next::Wire::zero_padding(component_url);
830
831            ::fidl_next::Wire::zero_padding(context);
832        }
833    }
834
835    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ResolverResolveWithContextRequest<'de>
836    where
837        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
838        ___D: ::fidl_next::Decoder<'de>,
839    {
840        fn decode(
841            slot_: ::fidl_next::Slot<'_, Self>,
842            decoder_: &mut ___D,
843            _: (),
844        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
845            ::fidl_next::munge! {
846                let Self {
847
848                    mut component_url,
849                    mut context,
850
851                } = slot_;
852            }
853
854            let _field = component_url.as_mut();
855            ::fidl_next::Constrained::validate(_field, 2083)?;
856            ::fidl_next::Decode::decode(component_url.as_mut(), decoder_, 2083)?;
857
858            let component_url = unsafe { component_url.deref_unchecked() };
859
860            if component_url.len() > 2083 {
861                return Err(::fidl_next::DecodeError::VectorTooLong {
862                    size: component_url.len() as u64,
863                    limit: 2083,
864                });
865            }
866
867            let _field = context.as_mut();
868
869            ::fidl_next::Decode::decode(context.as_mut(), decoder_, ())?;
870
871            Ok(())
872        }
873    }
874
875    impl<'de> ::fidl_next::IntoNatural for ResolverResolveWithContextRequest<'de> {
876        type Natural = crate::natural::ResolverResolveWithContextRequest;
877    }
878
879    /// The wire type corresponding to [`ResolverError`].
880    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
881    #[repr(transparent)]
882    pub struct ResolverError {
883        pub(crate) value: ::fidl_next::wire::Uint32,
884    }
885
886    impl ::fidl_next::Constrained for ResolverError {
887        type Constraint = ();
888
889        fn validate(
890            _: ::fidl_next::Slot<'_, Self>,
891            _: Self::Constraint,
892        ) -> Result<(), ::fidl_next::ValidationError> {
893            Ok(())
894        }
895    }
896
897    unsafe impl ::fidl_next::Wire for ResolverError {
898        type Narrowed<'de> = Self;
899
900        #[inline]
901        fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
902            // Wire enums have no padding
903        }
904    }
905
906    impl ResolverError {
907        pub const INTERNAL: ResolverError = ResolverError { value: ::fidl_next::wire::Uint32(1) };
908
909        pub const IO: ResolverError = ResolverError { value: ::fidl_next::wire::Uint32(2) };
910
911        pub const INVALID_ARGS: ResolverError =
912            ResolverError { value: ::fidl_next::wire::Uint32(3) };
913
914        pub const NOT_SUPPORTED: ResolverError =
915            ResolverError { value: ::fidl_next::wire::Uint32(4) };
916
917        pub const MANIFEST_NOT_FOUND: ResolverError =
918            ResolverError { value: ::fidl_next::wire::Uint32(5) };
919
920        pub const PACKAGE_NOT_FOUND: ResolverError =
921            ResolverError { value: ::fidl_next::wire::Uint32(6) };
922
923        pub const NO_SPACE: ResolverError = ResolverError { value: ::fidl_next::wire::Uint32(7) };
924
925        pub const RESOURCE_UNAVAILABLE: ResolverError =
926            ResolverError { value: ::fidl_next::wire::Uint32(8) };
927
928        pub const INVALID_MANIFEST: ResolverError =
929            ResolverError { value: ::fidl_next::wire::Uint32(9) };
930
931        pub const CONFIG_VALUES_NOT_FOUND: ResolverError =
932            ResolverError { value: ::fidl_next::wire::Uint32(10) };
933
934        pub const ABI_REVISION_NOT_FOUND: ResolverError =
935            ResolverError { value: ::fidl_next::wire::Uint32(11) };
936
937        pub const INVALID_ABI_REVISION: ResolverError =
938            ResolverError { value: ::fidl_next::wire::Uint32(12) };
939    }
940
941    unsafe impl<___D> ::fidl_next::Decode<___D> for ResolverError
942    where
943        ___D: ?Sized,
944    {
945        fn decode(
946            slot: ::fidl_next::Slot<'_, Self>,
947            _: &mut ___D,
948            _: (),
949        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
950            ::fidl_next::munge!(let Self { value } = slot);
951
952            match u32::from(*value) {
953                1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 => (),
954                unknown => {
955                    return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
956                }
957            }
958
959            Ok(())
960        }
961    }
962
963    impl ::core::convert::From<crate::natural::ResolverError> for ResolverError {
964        fn from(natural: crate::natural::ResolverError) -> Self {
965            match natural {
966                crate::natural::ResolverError::Internal => ResolverError::INTERNAL,
967
968                crate::natural::ResolverError::Io => ResolverError::IO,
969
970                crate::natural::ResolverError::InvalidArgs => ResolverError::INVALID_ARGS,
971
972                crate::natural::ResolverError::NotSupported => ResolverError::NOT_SUPPORTED,
973
974                crate::natural::ResolverError::ManifestNotFound => {
975                    ResolverError::MANIFEST_NOT_FOUND
976                }
977
978                crate::natural::ResolverError::PackageNotFound => ResolverError::PACKAGE_NOT_FOUND,
979
980                crate::natural::ResolverError::NoSpace => ResolverError::NO_SPACE,
981
982                crate::natural::ResolverError::ResourceUnavailable => {
983                    ResolverError::RESOURCE_UNAVAILABLE
984                }
985
986                crate::natural::ResolverError::InvalidManifest => ResolverError::INVALID_MANIFEST,
987
988                crate::natural::ResolverError::ConfigValuesNotFound => {
989                    ResolverError::CONFIG_VALUES_NOT_FOUND
990                }
991
992                crate::natural::ResolverError::AbiRevisionNotFound => {
993                    ResolverError::ABI_REVISION_NOT_FOUND
994                }
995
996                crate::natural::ResolverError::InvalidAbiRevision => {
997                    ResolverError::INVALID_ABI_REVISION
998                }
999            }
1000        }
1001    }
1002
1003    impl ::fidl_next::IntoNatural for ResolverError {
1004        type Natural = crate::natural::ResolverError;
1005    }
1006}
1007
1008pub mod wire_optional {}
1009
1010pub mod generic {
1011
1012    pub struct Context<T0> {
1013        pub bytes: T0,
1014    }
1015
1016    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::Context<'static>, ___E> for Context<T0>
1017    where
1018        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1019        ___E: ::fidl_next::Encoder,
1020        T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1021    {
1022        #[inline]
1023        fn encode(
1024            self,
1025            encoder_: &mut ___E,
1026            out_: &mut ::core::mem::MaybeUninit<crate::wire::Context<'static>>,
1027            _: (),
1028        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1029            ::fidl_next::munge! {
1030                let crate::wire::Context {
1031
1032                    bytes,
1033
1034                } = out_;
1035            }
1036
1037            ::fidl_next::Encode::encode(self.bytes, encoder_, bytes, (8192, ()))?;
1038
1039            Ok(())
1040        }
1041    }
1042
1043    pub struct ResolverResolveRequest<T0> {
1044        pub component_url: T0,
1045    }
1046
1047    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::ResolverResolveRequest<'static>, ___E>
1048        for ResolverResolveRequest<T0>
1049    where
1050        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1051        ___E: ::fidl_next::Encoder,
1052        T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
1053    {
1054        #[inline]
1055        fn encode(
1056            self,
1057            encoder_: &mut ___E,
1058            out_: &mut ::core::mem::MaybeUninit<crate::wire::ResolverResolveRequest<'static>>,
1059            _: (),
1060        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1061            ::fidl_next::munge! {
1062                let crate::wire::ResolverResolveRequest {
1063
1064                    component_url,
1065
1066                } = out_;
1067            }
1068
1069            ::fidl_next::Encode::encode(self.component_url, encoder_, component_url, 2083)?;
1070
1071            Ok(())
1072        }
1073    }
1074
1075    pub struct ResolverResolveWithContextRequest<T0, T1> {
1076        pub component_url: T0,
1077
1078        pub context: T1,
1079    }
1080
1081    unsafe impl<___E, T0, T1>
1082        ::fidl_next::Encode<crate::wire::ResolverResolveWithContextRequest<'static>, ___E>
1083        for ResolverResolveWithContextRequest<T0, T1>
1084    where
1085        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1086        ___E: ::fidl_next::Encoder,
1087        T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
1088        T1: ::fidl_next::Encode<crate::wire::Context<'static>, ___E>,
1089    {
1090        #[inline]
1091        fn encode(
1092            self,
1093            encoder_: &mut ___E,
1094            out_: &mut ::core::mem::MaybeUninit<
1095                crate::wire::ResolverResolveWithContextRequest<'static>,
1096            >,
1097            _: (),
1098        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1099            ::fidl_next::munge! {
1100                let crate::wire::ResolverResolveWithContextRequest {
1101
1102                    component_url,
1103                    context,
1104
1105                } = out_;
1106            }
1107
1108            ::fidl_next::Encode::encode(self.component_url, encoder_, component_url, 2083)?;
1109
1110            ::fidl_next::Encode::encode(self.context, encoder_, context, ())?;
1111
1112            Ok(())
1113        }
1114    }
1115}
1116
1117pub use self::natural::*;
1118
1119#[doc = " Max length of component URL.\n"]
1120pub const MAX_COMPONENT_URL_LENGTH: u32 = 2083 as u32;
1121
1122#[doc = " The maximum number of bytes for a `Context`.\n"]
1123pub const MAX_RESOLUTION_CONTEXT_SIZE: u32 = 8192 as u32;
1124
1125/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
1126pub mod compat {
1127
1128    impl ::fidl_next::CompatFrom<crate::Context> for ::fidl_fuchsia_component_resolution::Context {
1129        #[inline]
1130        fn compat_from(value: crate::Context) -> Self {
1131            Self { bytes: ::fidl_next::CompatFrom::compat_from(value.bytes) }
1132        }
1133    }
1134
1135    impl ::fidl_next::CompatFrom<::fidl_fuchsia_component_resolution::Context> for crate::Context {
1136        #[inline]
1137        fn compat_from(value: ::fidl_fuchsia_component_resolution::Context) -> Self {
1138            Self { bytes: ::fidl_next::CompatFrom::compat_from(value.bytes) }
1139        }
1140    }
1141
1142    impl ::fidl_next::CompatFrom<crate::ResolverResolveRequest>
1143        for ::fidl_fuchsia_component_resolution::ResolverResolveRequest
1144    {
1145        #[inline]
1146        fn compat_from(value: crate::ResolverResolveRequest) -> Self {
1147            Self { component_url: ::fidl_next::CompatFrom::compat_from(value.component_url) }
1148        }
1149    }
1150
1151    impl ::fidl_next::CompatFrom<::fidl_fuchsia_component_resolution::ResolverResolveRequest>
1152        for crate::ResolverResolveRequest
1153    {
1154        #[inline]
1155        fn compat_from(value: ::fidl_fuchsia_component_resolution::ResolverResolveRequest) -> Self {
1156            Self { component_url: ::fidl_next::CompatFrom::compat_from(value.component_url) }
1157        }
1158    }
1159
1160    impl ::fidl_next::CompatFrom<crate::ResolverResolveWithContextRequest>
1161        for ::fidl_fuchsia_component_resolution::ResolverResolveWithContextRequest
1162    {
1163        #[inline]
1164        fn compat_from(value: crate::ResolverResolveWithContextRequest) -> Self {
1165            Self {
1166                component_url: ::fidl_next::CompatFrom::compat_from(value.component_url),
1167
1168                context: ::fidl_next::CompatFrom::compat_from(value.context),
1169            }
1170        }
1171    }
1172
1173    impl
1174        ::fidl_next::CompatFrom<
1175            ::fidl_fuchsia_component_resolution::ResolverResolveWithContextRequest,
1176        > for crate::ResolverResolveWithContextRequest
1177    {
1178        #[inline]
1179        fn compat_from(
1180            value: ::fidl_fuchsia_component_resolution::ResolverResolveWithContextRequest,
1181        ) -> Self {
1182            Self {
1183                component_url: ::fidl_next::CompatFrom::compat_from(value.component_url),
1184
1185                context: ::fidl_next::CompatFrom::compat_from(value.context),
1186            }
1187        }
1188    }
1189
1190    impl ::fidl_next::CompatFrom<crate::ResolverError>
1191        for ::fidl_fuchsia_component_resolution::ResolverError
1192    {
1193        fn compat_from(value: crate::ResolverError) -> Self {
1194            match value {
1195                crate::ResolverError::Internal => Self::Internal,
1196
1197                crate::ResolverError::Io => Self::Io,
1198
1199                crate::ResolverError::InvalidArgs => Self::InvalidArgs,
1200
1201                crate::ResolverError::NotSupported => Self::NotSupported,
1202
1203                crate::ResolverError::ManifestNotFound => Self::ManifestNotFound,
1204
1205                crate::ResolverError::PackageNotFound => Self::PackageNotFound,
1206
1207                crate::ResolverError::NoSpace => Self::NoSpace,
1208
1209                crate::ResolverError::ResourceUnavailable => Self::ResourceUnavailable,
1210
1211                crate::ResolverError::InvalidManifest => Self::InvalidManifest,
1212
1213                crate::ResolverError::ConfigValuesNotFound => Self::ConfigValuesNotFound,
1214
1215                crate::ResolverError::AbiRevisionNotFound => Self::AbiRevisionNotFound,
1216
1217                crate::ResolverError::InvalidAbiRevision => Self::InvalidAbiRevision,
1218            }
1219        }
1220    }
1221
1222    impl ::fidl_next::CompatFrom<::fidl_fuchsia_component_resolution::ResolverError>
1223        for crate::ResolverError
1224    {
1225        fn compat_from(value: ::fidl_fuchsia_component_resolution::ResolverError) -> Self {
1226            match value {
1227                ::fidl_fuchsia_component_resolution::ResolverError::Internal => Self::Internal,
1228
1229                ::fidl_fuchsia_component_resolution::ResolverError::Io => Self::Io,
1230
1231                ::fidl_fuchsia_component_resolution::ResolverError::InvalidArgs => {
1232                    Self::InvalidArgs
1233                }
1234
1235                ::fidl_fuchsia_component_resolution::ResolverError::NotSupported => {
1236                    Self::NotSupported
1237                }
1238
1239                ::fidl_fuchsia_component_resolution::ResolverError::ManifestNotFound => {
1240                    Self::ManifestNotFound
1241                }
1242
1243                ::fidl_fuchsia_component_resolution::ResolverError::PackageNotFound => {
1244                    Self::PackageNotFound
1245                }
1246
1247                ::fidl_fuchsia_component_resolution::ResolverError::NoSpace => Self::NoSpace,
1248
1249                ::fidl_fuchsia_component_resolution::ResolverError::ResourceUnavailable => {
1250                    Self::ResourceUnavailable
1251                }
1252
1253                ::fidl_fuchsia_component_resolution::ResolverError::InvalidManifest => {
1254                    Self::InvalidManifest
1255                }
1256
1257                ::fidl_fuchsia_component_resolution::ResolverError::ConfigValuesNotFound => {
1258                    Self::ConfigValuesNotFound
1259                }
1260
1261                ::fidl_fuchsia_component_resolution::ResolverError::AbiRevisionNotFound => {
1262                    Self::AbiRevisionNotFound
1263                }
1264
1265                ::fidl_fuchsia_component_resolution::ResolverError::InvalidAbiRevision => {
1266                    Self::InvalidAbiRevision
1267                }
1268            }
1269        }
1270    }
1271}