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