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