fidl_next_fuchsia_component_runner/
fidl_next_fuchsia_component_runner.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#[derive(Debug)]
6pub enum Task {
7    Job(::fidl_next::fuchsia::zx::Handle),
8
9    Process(::fidl_next::fuchsia::zx::Handle),
10
11    Thread(::fidl_next::fuchsia::zx::Handle),
12
13    UnknownOrdinal_(u64),
14}
15
16impl ::fidl_next::Encodable for Task {
17    type Encoded = WireTask;
18}
19
20unsafe impl<___E> ::fidl_next::Encode<___E> for Task
21where
22    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
23
24    ___E: ::fidl_next::fuchsia::HandleEncoder,
25{
26    #[inline]
27    fn encode(
28        &mut self,
29        encoder: &mut ___E,
30        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
31    ) -> Result<(), ::fidl_next::EncodeError> {
32        ::fidl_next::munge!(let WireTask { raw } = out);
33
34        match self {
35            Self::Job(value) => ::fidl_next::RawWireUnion::encode_as_static::<
36                ___E,
37                ::fidl_next::fuchsia::zx::Handle,
38            >(value, 1, encoder, raw)?,
39
40            Self::Process(value) => ::fidl_next::RawWireUnion::encode_as_static::<
41                ___E,
42                ::fidl_next::fuchsia::zx::Handle,
43            >(value, 2, encoder, raw)?,
44
45            Self::Thread(value) => ::fidl_next::RawWireUnion::encode_as_static::<
46                ___E,
47                ::fidl_next::fuchsia::zx::Handle,
48            >(value, 3, encoder, raw)?,
49
50            Self::UnknownOrdinal_(ordinal) => {
51                return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
52            }
53        }
54
55        Ok(())
56    }
57}
58
59impl ::fidl_next::EncodableOption for Box<Task> {
60    type EncodedOption = WireOptionalTask;
61}
62
63unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<Task>
64where
65    ___E: ?Sized,
66    Task: ::fidl_next::Encode<___E>,
67{
68    #[inline]
69    fn encode_option(
70        this: Option<&mut Self>,
71        encoder: &mut ___E,
72        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
73    ) -> Result<(), ::fidl_next::EncodeError> {
74        ::fidl_next::munge!(let WireOptionalTask { raw } = &mut *out);
75
76        if let Some(inner) = this {
77            let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
78            ::fidl_next::Encode::encode(&mut **inner, encoder, value_out)?;
79        } else {
80            ::fidl_next::RawWireUnion::encode_absent(raw);
81        }
82
83        Ok(())
84    }
85}
86
87impl ::fidl_next::TakeFrom<WireTask> for Task {
88    #[inline]
89    fn take_from(from: &WireTask) -> Self {
90        match from.raw.ordinal() {
91            1 => Self::Job(::fidl_next::TakeFrom::take_from(unsafe {
92                from.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>()
93            })),
94
95            2 => Self::Process(::fidl_next::TakeFrom::take_from(unsafe {
96                from.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>()
97            })),
98
99            3 => Self::Thread(::fidl_next::TakeFrom::take_from(unsafe {
100                from.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>()
101            })),
102
103            _ => unsafe { ::core::hint::unreachable_unchecked() },
104        }
105    }
106}
107
108impl ::fidl_next::TakeFrom<WireOptionalTask> for Option<Box<Task>> {
109    #[inline]
110    fn take_from(from: &WireOptionalTask) -> Self {
111        if let Some(inner) = from.as_ref() {
112            Some(::fidl_next::TakeFrom::take_from(inner))
113        } else {
114            None
115        }
116    }
117}
118
119/// The wire type corresponding to [`Task`].
120#[repr(transparent)]
121pub struct WireTask {
122    raw: ::fidl_next::RawWireUnion,
123}
124
125unsafe impl ::fidl_next::ZeroPadding for WireTask {
126    #[inline]
127    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
128        ::fidl_next::munge!(let Self { raw } = out);
129        ::fidl_next::RawWireUnion::zero_padding(raw);
130    }
131}
132
133pub mod task {
134    pub enum Ref<'union> {
135        Job(&'union ::fidl_next::fuchsia::WireHandle),
136
137        Process(&'union ::fidl_next::fuchsia::WireHandle),
138
139        Thread(&'union ::fidl_next::fuchsia::WireHandle),
140
141        UnknownOrdinal_(u64),
142    }
143}
144
145impl WireTask {
146    pub fn as_ref(&self) -> crate::task::Ref<'_> {
147        match self.raw.ordinal() {
148            1 => crate::task::Ref::Job(unsafe {
149                self.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>()
150            }),
151
152            2 => crate::task::Ref::Process(unsafe {
153                self.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>()
154            }),
155
156            3 => crate::task::Ref::Thread(unsafe {
157                self.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>()
158            }),
159
160            unknown => crate::task::Ref::UnknownOrdinal_(unknown),
161        }
162    }
163}
164
165unsafe impl<___D> ::fidl_next::Decode<___D> for WireTask
166where
167    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
168
169    ___D: ::fidl_next::fuchsia::HandleDecoder,
170{
171    fn decode(
172        mut slot: ::fidl_next::Slot<'_, Self>,
173        decoder: &mut ___D,
174    ) -> Result<(), ::fidl_next::DecodeError> {
175        ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
176        match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
177            1 => ::fidl_next::RawWireUnion::decode_as_static::<
178                ___D,
179                ::fidl_next::fuchsia::WireHandle,
180            >(raw, decoder)?,
181
182            2 => ::fidl_next::RawWireUnion::decode_as_static::<
183                ___D,
184                ::fidl_next::fuchsia::WireHandle,
185            >(raw, decoder)?,
186
187            3 => ::fidl_next::RawWireUnion::decode_as_static::<
188                ___D,
189                ::fidl_next::fuchsia::WireHandle,
190            >(raw, decoder)?,
191
192            _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?,
193        }
194
195        Ok(())
196    }
197}
198
199impl ::core::fmt::Debug for WireTask {
200    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
201        match self.raw.ordinal() {
202            1 => unsafe {
203                self.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>().fmt(f)
204            },
205            2 => unsafe {
206                self.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>().fmt(f)
207            },
208            3 => unsafe {
209                self.raw.get().deref_unchecked::<::fidl_next::fuchsia::WireHandle>().fmt(f)
210            },
211            _ => unsafe { ::core::hint::unreachable_unchecked() },
212        }
213    }
214}
215
216#[repr(transparent)]
217pub struct WireOptionalTask {
218    raw: ::fidl_next::RawWireUnion,
219}
220
221unsafe impl ::fidl_next::ZeroPadding for WireOptionalTask {
222    #[inline]
223    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
224        ::fidl_next::munge!(let Self { raw } = out);
225        ::fidl_next::RawWireUnion::zero_padding(raw);
226    }
227}
228
229impl WireOptionalTask {
230    pub fn is_some(&self) -> bool {
231        self.raw.is_some()
232    }
233
234    pub fn is_none(&self) -> bool {
235        self.raw.is_none()
236    }
237
238    pub fn as_ref(&self) -> Option<&WireTask> {
239        if self.is_some() {
240            Some(unsafe { &*(self as *const Self).cast() })
241        } else {
242            None
243        }
244    }
245}
246
247unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalTask
248where
249    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
250
251    ___D: ::fidl_next::fuchsia::HandleDecoder,
252{
253    fn decode(
254        mut slot: ::fidl_next::Slot<'_, Self>,
255        decoder: &mut ___D,
256    ) -> Result<(), ::fidl_next::DecodeError> {
257        ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
258        match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
259            1 => ::fidl_next::RawWireUnion::decode_as_static::<
260                ___D,
261                ::fidl_next::fuchsia::WireHandle,
262            >(raw, decoder)?,
263
264            2 => ::fidl_next::RawWireUnion::decode_as_static::<
265                ___D,
266                ::fidl_next::fuchsia::WireHandle,
267            >(raw, decoder)?,
268
269            3 => ::fidl_next::RawWireUnion::decode_as_static::<
270                ___D,
271                ::fidl_next::fuchsia::WireHandle,
272            >(raw, decoder)?,
273
274            0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
275            _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?,
276        }
277
278        Ok(())
279    }
280}
281
282impl ::core::fmt::Debug for WireOptionalTask {
283    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
284        self.as_ref().fmt(f)
285    }
286}
287
288#[derive(Debug)]
289pub struct ComponentTasks {
290    pub component_task: Option<crate::Task>,
291
292    pub parent_task: Option<crate::Task>,
293}
294
295impl ComponentTasks {
296    fn __max_ordinal(&self) -> usize {
297        if self.component_task.is_some() {
298            return 1;
299        }
300
301        if self.parent_task.is_some() {
302            return 2;
303        }
304
305        0
306    }
307}
308
309impl ::fidl_next::Encodable for ComponentTasks {
310    type Encoded = WireComponentTasks;
311}
312
313unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentTasks
314where
315    ___E: ::fidl_next::Encoder + ?Sized,
316
317    ___E: ::fidl_next::fuchsia::HandleEncoder,
318{
319    #[inline]
320    fn encode(
321        &mut self,
322        encoder: &mut ___E,
323        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
324    ) -> Result<(), ::fidl_next::EncodeError> {
325        ::fidl_next::munge!(let WireComponentTasks { table } = out);
326
327        let max_ord = self.__max_ordinal();
328
329        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
330        ::fidl_next::ZeroPadding::zero_padding(&mut out);
331
332        let mut preallocated =
333            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
334
335        for i in 1..=max_ord {
336            match i {
337                2 => {
338                    if let Some(parent_task) = &mut self.parent_task {
339                        ::fidl_next::WireEnvelope::encode_value(
340                            parent_task,
341                            preallocated.encoder,
342                            &mut out,
343                        )?;
344                    } else {
345                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
346                    }
347                }
348
349                1 => {
350                    if let Some(component_task) = &mut self.component_task {
351                        ::fidl_next::WireEnvelope::encode_value(
352                            component_task,
353                            preallocated.encoder,
354                            &mut out,
355                        )?;
356                    } else {
357                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
358                    }
359                }
360
361                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
362            }
363            unsafe {
364                preallocated.write_next(out.assume_init_ref());
365            }
366        }
367
368        ::fidl_next::WireTable::encode_len(table, max_ord);
369
370        Ok(())
371    }
372}
373
374impl ::fidl_next::TakeFrom<WireComponentTasks> for ComponentTasks {
375    #[inline]
376    fn take_from(from: &WireComponentTasks) -> Self {
377        Self {
378            component_task: from.component_task().map(::fidl_next::TakeFrom::take_from),
379
380            parent_task: from.parent_task().map(::fidl_next::TakeFrom::take_from),
381        }
382    }
383}
384
385/// The wire type corresponding to [`ComponentTasks`].
386#[repr(C)]
387pub struct WireComponentTasks {
388    table: ::fidl_next::WireTable,
389}
390
391unsafe impl ::fidl_next::ZeroPadding for WireComponentTasks {
392    #[inline]
393    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
394        ::fidl_next::munge!(let Self { table } = out);
395        ::fidl_next::WireTable::zero_padding(table);
396    }
397}
398
399unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentTasks
400where
401    ___D: ::fidl_next::Decoder + ?Sized,
402
403    ___D: ::fidl_next::fuchsia::HandleDecoder,
404{
405    fn decode(
406        slot: ::fidl_next::Slot<'_, Self>,
407        decoder: &mut ___D,
408    ) -> Result<(), ::fidl_next::DecodeError> {
409        ::fidl_next::munge!(let Self { table } = slot);
410
411        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
412            match ordinal {
413                0 => unsafe { ::core::hint::unreachable_unchecked() },
414
415                1 => {
416                    ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireTask>(
417                        slot.as_mut(),
418                        decoder,
419                    )?;
420
421                    Ok(())
422                }
423
424                2 => {
425                    ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireTask>(
426                        slot.as_mut(),
427                        decoder,
428                    )?;
429
430                    Ok(())
431                }
432
433                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
434            }
435        })
436    }
437}
438
439impl WireComponentTasks {
440    pub fn component_task(&self) -> Option<&crate::WireTask> {
441        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
442    }
443
444    pub fn parent_task(&self) -> Option<&crate::WireTask> {
445        unsafe { Some(self.table.get(2)?.deref_unchecked()) }
446    }
447}
448
449impl ::core::fmt::Debug for WireComponentTasks {
450    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
451        f.debug_struct("ComponentTasks")
452            .field("component_task", &self.component_task())
453            .field("parent_task", &self.parent_task())
454            .finish()
455    }
456}
457
458#[derive(Debug)]
459pub struct ComponentDiagnostics {
460    pub tasks: Option<crate::ComponentTasks>,
461}
462
463impl ComponentDiagnostics {
464    fn __max_ordinal(&self) -> usize {
465        if self.tasks.is_some() {
466            return 1;
467        }
468
469        0
470    }
471}
472
473impl ::fidl_next::Encodable for ComponentDiagnostics {
474    type Encoded = WireComponentDiagnostics;
475}
476
477unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentDiagnostics
478where
479    ___E: ::fidl_next::Encoder + ?Sized,
480
481    ___E: ::fidl_next::fuchsia::HandleEncoder,
482{
483    #[inline]
484    fn encode(
485        &mut self,
486        encoder: &mut ___E,
487        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
488    ) -> Result<(), ::fidl_next::EncodeError> {
489        ::fidl_next::munge!(let WireComponentDiagnostics { table } = out);
490
491        let max_ord = self.__max_ordinal();
492
493        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
494        ::fidl_next::ZeroPadding::zero_padding(&mut out);
495
496        let mut preallocated =
497            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
498
499        for i in 1..=max_ord {
500            match i {
501                1 => {
502                    if let Some(tasks) = &mut self.tasks {
503                        ::fidl_next::WireEnvelope::encode_value(
504                            tasks,
505                            preallocated.encoder,
506                            &mut out,
507                        )?;
508                    } else {
509                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
510                    }
511                }
512
513                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
514            }
515            unsafe {
516                preallocated.write_next(out.assume_init_ref());
517            }
518        }
519
520        ::fidl_next::WireTable::encode_len(table, max_ord);
521
522        Ok(())
523    }
524}
525
526impl ::fidl_next::TakeFrom<WireComponentDiagnostics> for ComponentDiagnostics {
527    #[inline]
528    fn take_from(from: &WireComponentDiagnostics) -> Self {
529        Self { tasks: from.tasks().map(::fidl_next::TakeFrom::take_from) }
530    }
531}
532
533/// The wire type corresponding to [`ComponentDiagnostics`].
534#[repr(C)]
535pub struct WireComponentDiagnostics {
536    table: ::fidl_next::WireTable,
537}
538
539unsafe impl ::fidl_next::ZeroPadding for WireComponentDiagnostics {
540    #[inline]
541    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
542        ::fidl_next::munge!(let Self { table } = out);
543        ::fidl_next::WireTable::zero_padding(table);
544    }
545}
546
547unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentDiagnostics
548where
549    ___D: ::fidl_next::Decoder + ?Sized,
550
551    ___D: ::fidl_next::fuchsia::HandleDecoder,
552{
553    fn decode(
554        slot: ::fidl_next::Slot<'_, Self>,
555        decoder: &mut ___D,
556    ) -> Result<(), ::fidl_next::DecodeError> {
557        ::fidl_next::munge!(let Self { table } = slot);
558
559        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
560            match ordinal {
561                0 => unsafe { ::core::hint::unreachable_unchecked() },
562
563                1 => {
564                    ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireComponentTasks>(
565                        slot.as_mut(),
566                        decoder,
567                    )?;
568
569                    Ok(())
570                }
571
572                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
573            }
574        })
575    }
576}
577
578impl WireComponentDiagnostics {
579    pub fn tasks(&self) -> Option<&crate::WireComponentTasks> {
580        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
581    }
582}
583
584impl ::core::fmt::Debug for WireComponentDiagnostics {
585    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
586        f.debug_struct("ComponentDiagnostics").field("tasks", &self.tasks()).finish()
587    }
588}
589
590#[derive(Debug)]
591pub struct ComponentControllerOnPublishDiagnosticsRequest {
592    pub payload: crate::ComponentDiagnostics,
593}
594
595impl ::fidl_next::Encodable for ComponentControllerOnPublishDiagnosticsRequest {
596    type Encoded = WireComponentControllerOnPublishDiagnosticsRequest;
597}
598
599unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentControllerOnPublishDiagnosticsRequest
600where
601    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
602
603    ___E: ::fidl_next::Encoder,
604
605    ___E: ::fidl_next::fuchsia::HandleEncoder,
606{
607    #[inline]
608    fn encode(
609        &mut self,
610        encoder: &mut ___E,
611        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
612    ) -> Result<(), ::fidl_next::EncodeError> {
613        ::fidl_next::munge! {
614            let Self::Encoded {
615                payload,
616
617            } = out;
618        }
619
620        ::fidl_next::Encode::encode(&mut self.payload, encoder, payload)?;
621
622        Ok(())
623    }
624}
625
626impl ::fidl_next::EncodableOption for Box<ComponentControllerOnPublishDiagnosticsRequest> {
627    type EncodedOption = ::fidl_next::WireBox<WireComponentControllerOnPublishDiagnosticsRequest>;
628}
629
630unsafe impl<___E> ::fidl_next::EncodeOption<___E>
631    for Box<ComponentControllerOnPublishDiagnosticsRequest>
632where
633    ___E: ::fidl_next::Encoder + ?Sized,
634    ComponentControllerOnPublishDiagnosticsRequest: ::fidl_next::Encode<___E>,
635{
636    #[inline]
637    fn encode_option(
638        this: Option<&mut Self>,
639        encoder: &mut ___E,
640        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
641    ) -> Result<(), ::fidl_next::EncodeError> {
642        if let Some(inner) = this {
643            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
644            ::fidl_next::WireBox::encode_present(out);
645        } else {
646            ::fidl_next::WireBox::encode_absent(out);
647        }
648
649        Ok(())
650    }
651}
652
653impl ::fidl_next::TakeFrom<WireComponentControllerOnPublishDiagnosticsRequest>
654    for ComponentControllerOnPublishDiagnosticsRequest
655{
656    #[inline]
657    fn take_from(from: &WireComponentControllerOnPublishDiagnosticsRequest) -> Self {
658        Self { payload: ::fidl_next::TakeFrom::take_from(&from.payload) }
659    }
660}
661
662/// The wire type corresponding to [`ComponentControllerOnPublishDiagnosticsRequest`].
663#[derive(Debug)]
664#[repr(C)]
665pub struct WireComponentControllerOnPublishDiagnosticsRequest {
666    pub payload: crate::WireComponentDiagnostics,
667}
668
669unsafe impl ::fidl_next::ZeroPadding for WireComponentControllerOnPublishDiagnosticsRequest {
670    #[inline]
671    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
672}
673
674unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentControllerOnPublishDiagnosticsRequest
675where
676    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
677
678    ___D: ::fidl_next::Decoder,
679
680    ___D: ::fidl_next::fuchsia::HandleDecoder,
681{
682    fn decode(
683        slot: ::fidl_next::Slot<'_, Self>,
684        decoder: &mut ___D,
685    ) -> Result<(), ::fidl_next::DecodeError> {
686        ::fidl_next::munge! {
687            let Self {
688                mut payload,
689
690            } = slot;
691        }
692
693        ::fidl_next::Decode::decode(payload.as_mut(), decoder)?;
694
695        Ok(())
696    }
697}
698
699#[derive(Debug)]
700pub struct ComponentControllerOnEscrowRequest {
701    pub outgoing_dir: Option<
702        ::fidl_next::ServerEnd<
703            ::fidl_next::fuchsia::zx::Channel,
704            ::fidl_next_fuchsia_io::Directory,
705        >,
706    >,
707
708    pub escrowed_dictionary: Option<::fidl_next_fuchsia_component_sandbox::DictionaryRef>,
709}
710
711impl ComponentControllerOnEscrowRequest {
712    fn __max_ordinal(&self) -> usize {
713        if self.outgoing_dir.is_some() {
714            return 1;
715        }
716
717        if self.escrowed_dictionary.is_some() {
718            return 2;
719        }
720
721        0
722    }
723}
724
725impl ::fidl_next::Encodable for ComponentControllerOnEscrowRequest {
726    type Encoded = WireComponentControllerOnEscrowRequest;
727}
728
729unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentControllerOnEscrowRequest
730where
731    ___E: ::fidl_next::Encoder + ?Sized,
732
733    ___E: ::fidl_next::fuchsia::HandleEncoder,
734{
735    #[inline]
736    fn encode(
737        &mut self,
738        encoder: &mut ___E,
739        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
740    ) -> Result<(), ::fidl_next::EncodeError> {
741        ::fidl_next::munge!(let WireComponentControllerOnEscrowRequest { table } = out);
742
743        let max_ord = self.__max_ordinal();
744
745        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
746        ::fidl_next::ZeroPadding::zero_padding(&mut out);
747
748        let mut preallocated =
749            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
750
751        for i in 1..=max_ord {
752            match i {
753                2 => {
754                    if let Some(escrowed_dictionary) = &mut self.escrowed_dictionary {
755                        ::fidl_next::WireEnvelope::encode_value(
756                            escrowed_dictionary,
757                            preallocated.encoder,
758                            &mut out,
759                        )?;
760                    } else {
761                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
762                    }
763                }
764
765                1 => {
766                    if let Some(outgoing_dir) = &mut self.outgoing_dir {
767                        ::fidl_next::WireEnvelope::encode_value(
768                            outgoing_dir,
769                            preallocated.encoder,
770                            &mut out,
771                        )?;
772                    } else {
773                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
774                    }
775                }
776
777                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
778            }
779            unsafe {
780                preallocated.write_next(out.assume_init_ref());
781            }
782        }
783
784        ::fidl_next::WireTable::encode_len(table, max_ord);
785
786        Ok(())
787    }
788}
789
790impl ::fidl_next::TakeFrom<WireComponentControllerOnEscrowRequest>
791    for ComponentControllerOnEscrowRequest
792{
793    #[inline]
794    fn take_from(from: &WireComponentControllerOnEscrowRequest) -> Self {
795        Self {
796            outgoing_dir: from.outgoing_dir().map(::fidl_next::TakeFrom::take_from),
797
798            escrowed_dictionary: from.escrowed_dictionary().map(::fidl_next::TakeFrom::take_from),
799        }
800    }
801}
802
803/// The wire type corresponding to [`ComponentControllerOnEscrowRequest`].
804#[repr(C)]
805pub struct WireComponentControllerOnEscrowRequest {
806    table: ::fidl_next::WireTable,
807}
808
809unsafe impl ::fidl_next::ZeroPadding for WireComponentControllerOnEscrowRequest {
810    #[inline]
811    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
812        ::fidl_next::munge!(let Self { table } = out);
813        ::fidl_next::WireTable::zero_padding(table);
814    }
815}
816
817unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentControllerOnEscrowRequest
818where
819    ___D: ::fidl_next::Decoder + ?Sized,
820
821    ___D: ::fidl_next::fuchsia::HandleDecoder,
822{
823    fn decode(
824        slot: ::fidl_next::Slot<'_, Self>,
825        decoder: &mut ___D,
826    ) -> Result<(), ::fidl_next::DecodeError> {
827        ::fidl_next::munge!(let Self { table } = slot);
828
829        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
830            match ordinal {
831                0 => unsafe { ::core::hint::unreachable_unchecked() },
832
833                1 => {
834                    ::fidl_next::WireEnvelope::decode_as::<
835                        ___D,
836                        ::fidl_next::ServerEnd<
837                            ::fidl_next::fuchsia::WireChannel,
838                            ::fidl_next_fuchsia_io::Directory,
839                        >,
840                    >(slot.as_mut(), decoder)?;
841
842                    Ok(())
843                }
844
845                2 => {
846                    ::fidl_next::WireEnvelope::decode_as::<
847                        ___D,
848                        ::fidl_next_fuchsia_component_sandbox::WireDictionaryRef,
849                    >(slot.as_mut(), decoder)?;
850
851                    Ok(())
852                }
853
854                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
855            }
856        })
857    }
858}
859
860impl WireComponentControllerOnEscrowRequest {
861    pub fn outgoing_dir(
862        &self,
863    ) -> Option<
864        &::fidl_next::ServerEnd<
865            ::fidl_next::fuchsia::WireChannel,
866            ::fidl_next_fuchsia_io::Directory,
867        >,
868    > {
869        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
870    }
871
872    pub fn escrowed_dictionary(
873        &self,
874    ) -> Option<&::fidl_next_fuchsia_component_sandbox::WireDictionaryRef> {
875        unsafe { Some(self.table.get(2)?.deref_unchecked()) }
876    }
877}
878
879impl ::core::fmt::Debug for WireComponentControllerOnEscrowRequest {
880    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
881        f.debug_struct("ComponentControllerOnEscrowRequest")
882            .field("outgoing_dir", &self.outgoing_dir())
883            .field("escrowed_dictionary", &self.escrowed_dictionary())
884            .finish()
885    }
886}
887
888#[derive(Debug)]
889pub struct ComponentStopInfo {
890    pub termination_status: Option<i32>,
891
892    pub exit_code: Option<i64>,
893}
894
895impl ComponentStopInfo {
896    fn __max_ordinal(&self) -> usize {
897        if self.termination_status.is_some() {
898            return 1;
899        }
900
901        if self.exit_code.is_some() {
902            return 2;
903        }
904
905        0
906    }
907}
908
909impl ::fidl_next::Encodable for ComponentStopInfo {
910    type Encoded = WireComponentStopInfo;
911}
912
913unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentStopInfo
914where
915    ___E: ::fidl_next::Encoder + ?Sized,
916
917    ___E: ::fidl_next::fuchsia::HandleEncoder,
918{
919    #[inline]
920    fn encode(
921        &mut self,
922        encoder: &mut ___E,
923        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
924    ) -> Result<(), ::fidl_next::EncodeError> {
925        ::fidl_next::munge!(let WireComponentStopInfo { table } = out);
926
927        let max_ord = self.__max_ordinal();
928
929        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
930        ::fidl_next::ZeroPadding::zero_padding(&mut out);
931
932        let mut preallocated =
933            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
934
935        for i in 1..=max_ord {
936            match i {
937                2 => {
938                    if let Some(exit_code) = &mut self.exit_code {
939                        ::fidl_next::WireEnvelope::encode_value(
940                            exit_code,
941                            preallocated.encoder,
942                            &mut out,
943                        )?;
944                    } else {
945                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
946                    }
947                }
948
949                1 => {
950                    if let Some(termination_status) = &mut self.termination_status {
951                        ::fidl_next::WireEnvelope::encode_value(
952                            termination_status,
953                            preallocated.encoder,
954                            &mut out,
955                        )?;
956                    } else {
957                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
958                    }
959                }
960
961                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
962            }
963            unsafe {
964                preallocated.write_next(out.assume_init_ref());
965            }
966        }
967
968        ::fidl_next::WireTable::encode_len(table, max_ord);
969
970        Ok(())
971    }
972}
973
974impl ::fidl_next::TakeFrom<WireComponentStopInfo> for ComponentStopInfo {
975    #[inline]
976    fn take_from(from: &WireComponentStopInfo) -> Self {
977        Self {
978            termination_status: from.termination_status().map(::fidl_next::TakeFrom::take_from),
979
980            exit_code: from.exit_code().map(::fidl_next::TakeFrom::take_from),
981        }
982    }
983}
984
985/// The wire type corresponding to [`ComponentStopInfo`].
986#[repr(C)]
987pub struct WireComponentStopInfo {
988    table: ::fidl_next::WireTable,
989}
990
991unsafe impl ::fidl_next::ZeroPadding for WireComponentStopInfo {
992    #[inline]
993    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
994        ::fidl_next::munge!(let Self { table } = out);
995        ::fidl_next::WireTable::zero_padding(table);
996    }
997}
998
999unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentStopInfo
1000where
1001    ___D: ::fidl_next::Decoder + ?Sized,
1002
1003    ___D: ::fidl_next::fuchsia::HandleDecoder,
1004{
1005    fn decode(
1006        slot: ::fidl_next::Slot<'_, Self>,
1007        decoder: &mut ___D,
1008    ) -> Result<(), ::fidl_next::DecodeError> {
1009        ::fidl_next::munge!(let Self { table } = slot);
1010
1011        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1012            match ordinal {
1013                0 => unsafe { ::core::hint::unreachable_unchecked() },
1014
1015                1 => {
1016                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireI32>(
1017                        slot.as_mut(),
1018                        decoder,
1019                    )?;
1020
1021                    Ok(())
1022                }
1023
1024                2 => {
1025                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireI64>(
1026                        slot.as_mut(),
1027                        decoder,
1028                    )?;
1029
1030                    Ok(())
1031                }
1032
1033                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
1034            }
1035        })
1036    }
1037}
1038
1039impl WireComponentStopInfo {
1040    pub fn termination_status(&self) -> Option<&::fidl_next::WireI32> {
1041        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1042    }
1043
1044    pub fn exit_code(&self) -> Option<&::fidl_next::WireI64> {
1045        unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1046    }
1047}
1048
1049impl ::core::fmt::Debug for WireComponentStopInfo {
1050    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
1051        f.debug_struct("ComponentStopInfo")
1052            .field("termination_status", &self.termination_status())
1053            .field("exit_code", &self.exit_code())
1054            .finish()
1055    }
1056}
1057
1058/// The type corresponding to the ComponentController protocol.
1059#[doc = " A protocol for binding and controlling the lifetime of a component instance\n started using `ComponentRunner.Start()`. The component manager is the\n intended direct client of this protocol.\n\n When the controlled component instance terminates or becomes inaccessible\n for any reason, the server closes the connection with an epitaph.\n\n # Lifecycle\n\n A component may exist in one of two states: `Started`, or `Stopped`. The\n component is `Started` from the time `ComponentRunner.Start()` is called\n until the ComponentRunner closes the ComponentController handle. The\n component then transitions to `Stopped`.\n\n Component manager uses ComponentController to terminate a component in two\n steps:\n\n 1.  Component manager calls `Stop()` to indicate that the ComponentRunner\n     should stop a component\'s execution and send the `OnStop` event.\n 2.  If after some time the ComponentController is not closed, component\n     manager calls `Kill()` to indicate that the ComponentRunner must halt a\n     component\'s execution immediately, and then send the `OnStop` event.\n     The component manager may wait some period of time after calling `Kill()`\n     before sending `OnStop`, but makes no guarantees it will wait or for how long.\n\n Component manager first waits for the ComponentController to close, and\n then tears down the namespace it hosts for the stopped component. Component\n manager may call `Kill()` without first having called `Stop()`.\n\n Before stopping, a component can optionally use `OnEscrow` to store some\n state in the framework, to receive those state again the next time it is\n started.\n\n When the component stops, the runner should send an `OnStop` event\n instead of just closing the channel, to report the component\'s termination status\n (see below) and (optionally) an exit code. Once the runner has sent `OnStop`\n it is free to close [ComponentRunner]; the component framework will close\n its end of the channel when it receives this event.\n\n ## Legacy\n\n Instead of sending `OnStop`, it is also legal for a runner to close the channel\n with with an epitaph equal to the termination status, but this is a legacy method\n for backward compatibility that\'s no longer recommended.\n\n # Termination status\n\n The termination status indicates the component\'s final disposition in the eyes of\n the runner.\n\n Note that termination status is _not_ synonymous with a component\'s exit code.\n A component\'s exit code, which is optional for a runner to report, is an\n integer that represents the program\'s own return code. For example, for ELF\n components, it is the value returned by main(). The termination status is\n the _runner_\'s status code for the component\'s termination, which may capture\n failure modes that occur in the context of the runner itself rather than the\n program.\n\n The following termination statuses may be sent by the server on error:\n\n - `ZX_OK`: The component exited successfully, typically because the\n   component was asked to stop or it decided independently to exit.\n - `INVALID_ARGUMENTS`:\n     * `start_info.resolved_url` is not supported by this\n       runner;\n     * `start_info` contains missing or invalid arguments.\n - `INSTANCE_CANNOT_START`: The runner could not start the component.\n   For example, a critical part of the program could not be found or\n   loaded, or the referenced binary was invalid for this runner.\n - `RESOURCE_UNAVAILABLE`: The component could not be launched due to\n   lack of resources.\n - `INTERNAL`: An unexpected internal runner error was encountered.\n - `INSTANCE_DIED`: The component instance was started but\n   subsequently terminated with an error.\n - Other status codes (e.g. `ZX_ERR_PEER_CLOSED`) may indicate a failure\n   of the component runner itself. The component manager may respond to such\n   failures by terminating the component runner\'s job to ensure system\n   stability.\n"]
1060#[derive(Debug)]
1061pub struct ComponentController;
1062
1063pub mod component_controller {
1064    pub mod prelude {
1065        pub use crate::{
1066            component_controller, ComponentController, ComponentControllerClientHandler,
1067            ComponentControllerClientSender, ComponentControllerServerHandler,
1068            ComponentControllerServerSender,
1069        };
1070
1071        pub use crate::ComponentControllerOnEscrowRequest;
1072
1073        pub use crate::ComponentControllerOnPublishDiagnosticsRequest;
1074
1075        pub use crate::ComponentStopInfo;
1076    }
1077
1078    pub struct Stop;
1079
1080    impl ::fidl_next::Method for Stop {
1081        const ORDINAL: u64 = 4804506821232171874;
1082
1083        type Protocol = crate::ComponentController;
1084
1085        type Request = ();
1086
1087        type Response = ::fidl_next::Never;
1088    }
1089
1090    pub struct Kill;
1091
1092    impl ::fidl_next::Method for Kill {
1093        const ORDINAL: u64 = 4514346391631670964;
1094
1095        type Protocol = crate::ComponentController;
1096
1097        type Request = ();
1098
1099        type Response = ::fidl_next::Never;
1100    }
1101
1102    pub struct OnPublishDiagnostics;
1103
1104    impl ::fidl_next::Method for OnPublishDiagnostics {
1105        const ORDINAL: u64 = 2240216199992207687;
1106
1107        type Protocol = crate::ComponentController;
1108
1109        type Request = ::fidl_next::Never;
1110
1111        type Response = crate::WireComponentControllerOnPublishDiagnosticsRequest;
1112    }
1113
1114    pub struct OnEscrow;
1115
1116    impl ::fidl_next::Method for OnEscrow {
1117        const ORDINAL: u64 = 730448769712342012;
1118
1119        type Protocol = crate::ComponentController;
1120
1121        type Request = ::fidl_next::Never;
1122
1123        type Response = crate::WireComponentControllerOnEscrowRequest;
1124    }
1125
1126    pub struct OnStop;
1127
1128    impl ::fidl_next::Method for OnStop {
1129        const ORDINAL: u64 = 4322651556509354674;
1130
1131        type Protocol = crate::ComponentController;
1132
1133        type Request = ::fidl_next::Never;
1134
1135        type Response = crate::WireComponentStopInfo;
1136    }
1137}
1138
1139/// A helper trait for the `ComponentController` client sender.
1140pub trait ComponentControllerClientSender {
1141    type Transport: ::fidl_next::Transport;
1142
1143    #[doc = " Request to stop the component instance.\n\n After stopping the component instance, the server should close this\n connection with an epitaph. After the connection\n closes, component manager considers this component instance to be\n Stopped and the component\'s namespace will be torn down.\n"]
1144    fn stop(
1145        &self,
1146    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>;
1147
1148    #[doc = " Stop this component instance immediately.\n\n The ComponentRunner must immediately kill the component instance, and\n then close this connection with an epitaph. After the connection\n closes, component manager considers this component instance to be\n Stopped and the component\'s namespace will be torn down.\n\n In some cases Kill() may be issued before Stop(), but that is not\n guaranteed.\n"]
1149    fn kill(
1150        &self,
1151    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>;
1152}
1153
1154impl<___T> ComponentControllerClientSender for ::fidl_next::ClientSender<___T, ComponentController>
1155where
1156    ___T: ::fidl_next::Transport,
1157{
1158    type Transport = ___T;
1159
1160    #[doc = " Request to stop the component instance.\n\n After stopping the component instance, the server should close this\n connection with an epitaph. After the connection\n closes, component manager considers this component instance to be\n Stopped and the component\'s namespace will be torn down.\n"]
1161    fn stop(
1162        &self,
1163    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError> {
1164        self.as_untyped().send_one_way(4804506821232171874, &mut ())
1165    }
1166
1167    #[doc = " Stop this component instance immediately.\n\n The ComponentRunner must immediately kill the component instance, and\n then close this connection with an epitaph. After the connection\n closes, component manager considers this component instance to be\n Stopped and the component\'s namespace will be torn down.\n\n In some cases Kill() may be issued before Stop(), but that is not\n guaranteed.\n"]
1168    fn kill(
1169        &self,
1170    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError> {
1171        self.as_untyped().send_one_way(4514346391631670964, &mut ())
1172    }
1173}
1174
1175/// A client handler for the ComponentController protocol.
1176///
1177/// See [`ComponentController`] for more details.
1178pub trait ComponentControllerClientHandler<___T: ::fidl_next::Transport> {
1179    #[doc = " Event for runners to publish diagnostics to the platform.\n\n This event signals to the platform that the runner for this\n component is publishing diagnostics about the runtime of the\n component. The component manager may optionally expose this data\n to clients.\n"]
1180    fn on_publish_diagnostics(
1181        &mut self,
1182        sender: &::fidl_next::ClientSender<___T, ComponentController>,
1183
1184        message: ::fidl_next::ResponseBuffer<___T, component_controller::OnPublishDiagnostics>,
1185    );
1186
1187    #[doc = " Store some of the component\'s state in the framework, to be redelivered\n to the component the next time it\'s started (a practice called\n \"escrowing\").\n\n When the framework receives this event, it will wait until the current\n execution of the component has finished, then start the component again\n when the `ZX_CHANNEL_READABLE` signal is observed on `outgoing_dir`.\n\n Repeated calls will replace the old escrowed value. This is discouraged.\n\n Handles escrowed via `OnEscrow` are always delivered to the next\n execution of the component.\n"]
1188    fn on_escrow(
1189        &mut self,
1190        sender: &::fidl_next::ClientSender<___T, ComponentController>,
1191
1192        message: ::fidl_next::ResponseBuffer<___T, component_controller::OnEscrow>,
1193    );
1194
1195    #[doc = " Report that the component has stopped, with data about its termination. This will\n cause the component to make a lifecycle transition to `Stopped`.\n\n Once the runner has sent `OnStop` it is free to close this [ComponentRunner]; the\n component framework will close its end of the channel when it receives this event.\n\n Alternatively, a runner may close the controller channel without this event to signal\n component stop, but this method is legacy and no longer recommended.\n"]
1196    fn on_stop(
1197        &mut self,
1198        sender: &::fidl_next::ClientSender<___T, ComponentController>,
1199
1200        message: ::fidl_next::ResponseBuffer<___T, component_controller::OnStop>,
1201    );
1202
1203    fn on_unknown_interaction(
1204        &mut self,
1205        sender: &::fidl_next::ClientSender<___T, ComponentController>,
1206        ordinal: u64,
1207    ) {
1208        sender.close();
1209    }
1210}
1211
1212impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for ComponentController
1213where
1214    ___T: ::fidl_next::Transport,
1215    ___H: ComponentControllerClientHandler<___T>,
1216
1217    <component_controller::OnPublishDiagnostics as ::fidl_next::Method>::Response:
1218        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1219
1220    <component_controller::OnEscrow as ::fidl_next::Method>::Response:
1221        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1222
1223    <component_controller::OnStop as ::fidl_next::Method>::Response:
1224        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1225{
1226    fn on_event(
1227        handler: &mut ___H,
1228        sender: &::fidl_next::ClientSender<___T, Self>,
1229        ordinal: u64,
1230        buffer: ___T::RecvBuffer,
1231    ) {
1232        match ordinal {
1233            2240216199992207687 => {
1234                let buffer = ::fidl_next::ResponseBuffer::from_untyped(buffer);
1235                handler.on_publish_diagnostics(sender, buffer);
1236            }
1237
1238            730448769712342012 => {
1239                let buffer = ::fidl_next::ResponseBuffer::from_untyped(buffer);
1240                handler.on_escrow(sender, buffer);
1241            }
1242
1243            4322651556509354674 => {
1244                let buffer = ::fidl_next::ResponseBuffer::from_untyped(buffer);
1245                handler.on_stop(sender, buffer);
1246            }
1247
1248            ordinal => handler.on_unknown_interaction(sender, ordinal),
1249        }
1250    }
1251}
1252
1253/// A helper trait for the `ComponentController` server sender.
1254pub trait ComponentControllerServerSender {
1255    type Transport: ::fidl_next::Transport;
1256
1257    #[doc = " Event for runners to publish diagnostics to the platform.\n\n This event signals to the platform that the runner for this\n component is publishing diagnostics about the runtime of the\n component. The component manager may optionally expose this data\n to clients.\n"]
1258
1259    fn on_publish_diagnostics<___R>(
1260        &self,
1261        request: &mut ___R,
1262    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1263    where
1264        ___R: ::fidl_next::Encode<
1265            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1266            Encoded = <component_controller::OnPublishDiagnostics as ::fidl_next::Method>::Response,
1267        >;
1268
1269    #[doc = " Store some of the component\'s state in the framework, to be redelivered\n to the component the next time it\'s started (a practice called\n \"escrowing\").\n\n When the framework receives this event, it will wait until the current\n execution of the component has finished, then start the component again\n when the `ZX_CHANNEL_READABLE` signal is observed on `outgoing_dir`.\n\n Repeated calls will replace the old escrowed value. This is discouraged.\n\n Handles escrowed via `OnEscrow` are always delivered to the next\n execution of the component.\n"]
1270
1271    fn on_escrow<___R>(
1272        &self,
1273        request: &mut ___R,
1274    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1275    where
1276        ___R: ::fidl_next::Encode<
1277            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1278            Encoded = <component_controller::OnEscrow as ::fidl_next::Method>::Response,
1279        >;
1280
1281    #[doc = " Report that the component has stopped, with data about its termination. This will\n cause the component to make a lifecycle transition to `Stopped`.\n\n Once the runner has sent `OnStop` it is free to close this [ComponentRunner]; the\n component framework will close its end of the channel when it receives this event.\n\n Alternatively, a runner may close the controller channel without this event to signal\n component stop, but this method is legacy and no longer recommended.\n"]
1282
1283    fn on_stop<___R>(
1284        &self,
1285        request: &mut ___R,
1286    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1287    where
1288        ___R: ::fidl_next::Encode<
1289            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1290            Encoded = <component_controller::OnStop as ::fidl_next::Method>::Response,
1291        >;
1292}
1293
1294impl<___T> ComponentControllerServerSender for ::fidl_next::ServerSender<___T, ComponentController>
1295where
1296    ___T: ::fidl_next::Transport,
1297{
1298    type Transport = ___T;
1299
1300    #[doc = " Event for runners to publish diagnostics to the platform.\n\n This event signals to the platform that the runner for this\n component is publishing diagnostics about the runtime of the\n component. The component manager may optionally expose this data\n to clients.\n"]
1301
1302    fn on_publish_diagnostics<___R>(
1303        &self,
1304        request: &mut ___R,
1305    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1306    where
1307        ___R: ::fidl_next::Encode<
1308            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1309            Encoded = <component_controller::OnPublishDiagnostics as ::fidl_next::Method>::Response,
1310        >,
1311    {
1312        self.as_untyped().send_event(2240216199992207687, request)
1313    }
1314
1315    #[doc = " Store some of the component\'s state in the framework, to be redelivered\n to the component the next time it\'s started (a practice called\n \"escrowing\").\n\n When the framework receives this event, it will wait until the current\n execution of the component has finished, then start the component again\n when the `ZX_CHANNEL_READABLE` signal is observed on `outgoing_dir`.\n\n Repeated calls will replace the old escrowed value. This is discouraged.\n\n Handles escrowed via `OnEscrow` are always delivered to the next\n execution of the component.\n"]
1316
1317    fn on_escrow<___R>(
1318        &self,
1319        request: &mut ___R,
1320    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1321    where
1322        ___R: ::fidl_next::Encode<
1323            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1324            Encoded = <component_controller::OnEscrow as ::fidl_next::Method>::Response,
1325        >,
1326    {
1327        self.as_untyped().send_event(730448769712342012, request)
1328    }
1329
1330    #[doc = " Report that the component has stopped, with data about its termination. This will\n cause the component to make a lifecycle transition to `Stopped`.\n\n Once the runner has sent `OnStop` it is free to close this [ComponentRunner]; the\n component framework will close its end of the channel when it receives this event.\n\n Alternatively, a runner may close the controller channel without this event to signal\n component stop, but this method is legacy and no longer recommended.\n"]
1331
1332    fn on_stop<___R>(
1333        &self,
1334        request: &mut ___R,
1335    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1336    where
1337        ___R: ::fidl_next::Encode<
1338            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1339            Encoded = <component_controller::OnStop as ::fidl_next::Method>::Response,
1340        >,
1341    {
1342        self.as_untyped().send_event(4322651556509354674, request)
1343    }
1344}
1345
1346/// A server handler for the ComponentController protocol.
1347///
1348/// See [`ComponentController`] for more details.
1349pub trait ComponentControllerServerHandler<___T: ::fidl_next::Transport> {
1350    #[doc = " Request to stop the component instance.\n\n After stopping the component instance, the server should close this\n connection with an epitaph. After the connection\n closes, component manager considers this component instance to be\n Stopped and the component\'s namespace will be torn down.\n"]
1351    fn stop(&mut self, sender: &::fidl_next::ServerSender<___T, ComponentController>);
1352
1353    #[doc = " Stop this component instance immediately.\n\n The ComponentRunner must immediately kill the component instance, and\n then close this connection with an epitaph. After the connection\n closes, component manager considers this component instance to be\n Stopped and the component\'s namespace will be torn down.\n\n In some cases Kill() may be issued before Stop(), but that is not\n guaranteed.\n"]
1354    fn kill(&mut self, sender: &::fidl_next::ServerSender<___T, ComponentController>);
1355
1356    fn on_unknown_interaction(
1357        &mut self,
1358        sender: &::fidl_next::ServerSender<___T, ComponentController>,
1359        ordinal: u64,
1360    ) {
1361        sender.close();
1362    }
1363}
1364
1365impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for ComponentController
1366where
1367    ___T: ::fidl_next::Transport,
1368    ___H: ComponentControllerServerHandler<___T>,
1369{
1370    fn on_one_way(
1371        handler: &mut ___H,
1372        sender: &::fidl_next::ServerSender<___T, Self>,
1373        ordinal: u64,
1374        buffer: ___T::RecvBuffer,
1375    ) {
1376        match ordinal {
1377            4804506821232171874 => {
1378                handler.stop(sender);
1379            }
1380
1381            4514346391631670964 => {
1382                handler.kill(sender);
1383            }
1384
1385            ordinal => handler.on_unknown_interaction(sender, ordinal),
1386        }
1387    }
1388
1389    fn on_two_way(
1390        handler: &mut ___H,
1391        sender: &::fidl_next::ServerSender<___T, Self>,
1392        ordinal: u64,
1393        buffer: ___T::RecvBuffer,
1394        responder: ::fidl_next::protocol::Responder,
1395    ) {
1396        match ordinal {
1397            ordinal => handler.on_unknown_interaction(sender, ordinal),
1398        }
1399    }
1400}
1401
1402#[doc = " A single component namespace entry, which describes a namespace mount point\n (`path`) and the directory backing it (`directory`). This type is usually\n composed inside a vector.  See `ComponentStartInfo.ns` for more details.\n"]
1403#[derive(Debug)]
1404pub struct ComponentNamespaceEntry {
1405    pub path: Option<String>,
1406
1407    pub directory: Option<
1408        ::fidl_next::ClientEnd<
1409            ::fidl_next::fuchsia::zx::Channel,
1410            ::fidl_next_fuchsia_io::Directory,
1411        >,
1412    >,
1413}
1414
1415impl ComponentNamespaceEntry {
1416    fn __max_ordinal(&self) -> usize {
1417        if self.path.is_some() {
1418            return 1;
1419        }
1420
1421        if self.directory.is_some() {
1422            return 2;
1423        }
1424
1425        0
1426    }
1427}
1428
1429impl ::fidl_next::Encodable for ComponentNamespaceEntry {
1430    type Encoded = WireComponentNamespaceEntry;
1431}
1432
1433unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentNamespaceEntry
1434where
1435    ___E: ::fidl_next::Encoder + ?Sized,
1436
1437    ___E: ::fidl_next::fuchsia::HandleEncoder,
1438{
1439    #[inline]
1440    fn encode(
1441        &mut self,
1442        encoder: &mut ___E,
1443        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1444    ) -> Result<(), ::fidl_next::EncodeError> {
1445        ::fidl_next::munge!(let WireComponentNamespaceEntry { table } = out);
1446
1447        let max_ord = self.__max_ordinal();
1448
1449        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
1450        ::fidl_next::ZeroPadding::zero_padding(&mut out);
1451
1452        let mut preallocated =
1453            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
1454
1455        for i in 1..=max_ord {
1456            match i {
1457                2 => {
1458                    if let Some(directory) = &mut self.directory {
1459                        ::fidl_next::WireEnvelope::encode_value(
1460                            directory,
1461                            preallocated.encoder,
1462                            &mut out,
1463                        )?;
1464                    } else {
1465                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1466                    }
1467                }
1468
1469                1 => {
1470                    if let Some(path) = &mut self.path {
1471                        ::fidl_next::WireEnvelope::encode_value(
1472                            path,
1473                            preallocated.encoder,
1474                            &mut out,
1475                        )?;
1476                    } else {
1477                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1478                    }
1479                }
1480
1481                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
1482            }
1483            unsafe {
1484                preallocated.write_next(out.assume_init_ref());
1485            }
1486        }
1487
1488        ::fidl_next::WireTable::encode_len(table, max_ord);
1489
1490        Ok(())
1491    }
1492}
1493
1494impl ::fidl_next::TakeFrom<WireComponentNamespaceEntry> for ComponentNamespaceEntry {
1495    #[inline]
1496    fn take_from(from: &WireComponentNamespaceEntry) -> Self {
1497        Self {
1498            path: from.path().map(::fidl_next::TakeFrom::take_from),
1499
1500            directory: from.directory().map(::fidl_next::TakeFrom::take_from),
1501        }
1502    }
1503}
1504
1505/// The wire type corresponding to [`ComponentNamespaceEntry`].
1506#[repr(C)]
1507pub struct WireComponentNamespaceEntry {
1508    table: ::fidl_next::WireTable,
1509}
1510
1511unsafe impl ::fidl_next::ZeroPadding for WireComponentNamespaceEntry {
1512    #[inline]
1513    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1514        ::fidl_next::munge!(let Self { table } = out);
1515        ::fidl_next::WireTable::zero_padding(table);
1516    }
1517}
1518
1519unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentNamespaceEntry
1520where
1521    ___D: ::fidl_next::Decoder + ?Sized,
1522
1523    ___D: ::fidl_next::fuchsia::HandleDecoder,
1524{
1525    fn decode(
1526        slot: ::fidl_next::Slot<'_, Self>,
1527        decoder: &mut ___D,
1528    ) -> Result<(), ::fidl_next::DecodeError> {
1529        ::fidl_next::munge!(let Self { table } = slot);
1530
1531        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1532            match ordinal {
1533                0 => unsafe { ::core::hint::unreachable_unchecked() },
1534
1535                1 => {
1536                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
1537                        slot.as_mut(),
1538                        decoder,
1539                    )?;
1540
1541                    let path = unsafe {
1542                        slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
1543                    };
1544
1545                    if path.len() > 4095 {
1546                        return Err(::fidl_next::DecodeError::VectorTooLong {
1547                            size: path.len() as u64,
1548                            limit: 4095,
1549                        });
1550                    }
1551
1552                    Ok(())
1553                }
1554
1555                2 => {
1556                    ::fidl_next::WireEnvelope::decode_as::<
1557                        ___D,
1558                        ::fidl_next::ClientEnd<
1559                            ::fidl_next::fuchsia::WireChannel,
1560                            ::fidl_next_fuchsia_io::Directory,
1561                        >,
1562                    >(slot.as_mut(), decoder)?;
1563
1564                    Ok(())
1565                }
1566
1567                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
1568            }
1569        })
1570    }
1571}
1572
1573impl WireComponentNamespaceEntry {
1574    pub fn path(&self) -> Option<&::fidl_next::WireString> {
1575        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1576    }
1577
1578    pub fn directory(
1579        &self,
1580    ) -> Option<
1581        &::fidl_next::ClientEnd<
1582            ::fidl_next::fuchsia::WireChannel,
1583            ::fidl_next_fuchsia_io::Directory,
1584        >,
1585    > {
1586        unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1587    }
1588}
1589
1590impl ::core::fmt::Debug for WireComponentNamespaceEntry {
1591    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
1592        f.debug_struct("ComponentNamespaceEntry")
1593            .field("path", &self.path())
1594            .field("directory", &self.directory())
1595            .finish()
1596    }
1597}
1598
1599pub const MAX_NAMESPACE_COUNT: u32 = 32;
1600
1601pub const MAX_HANDLE_COUNT: u32 = 128;
1602
1603#[doc = " Parameters for starting a new component instance.\n"]
1604#[derive(Debug)]
1605pub struct ComponentStartInfo {
1606    pub resolved_url: Option<String>,
1607
1608    pub program: Option<::fidl_next_fuchsia_data::Dictionary>,
1609
1610    pub ns: Option<Vec<crate::ComponentNamespaceEntry>>,
1611
1612    pub outgoing_dir: Option<
1613        ::fidl_next::ServerEnd<
1614            ::fidl_next::fuchsia::zx::Channel,
1615            ::fidl_next_fuchsia_io::Directory,
1616        >,
1617    >,
1618
1619    pub runtime_dir: Option<
1620        ::fidl_next::ServerEnd<
1621            ::fidl_next::fuchsia::zx::Channel,
1622            ::fidl_next_fuchsia_io::Directory,
1623        >,
1624    >,
1625
1626    pub numbered_handles: Option<Vec<::fidl_next_fuchsia_process::HandleInfo>>,
1627
1628    pub encoded_config: Option<::fidl_next_fuchsia_mem::Data>,
1629
1630    pub break_on_start: Option<::fidl_next::fuchsia::zx::Handle>,
1631
1632    pub component_instance: Option<::fidl_next::fuchsia::zx::Handle>,
1633
1634    pub escrowed_dictionary: Option<::fidl_next_fuchsia_component_sandbox::DictionaryRef>,
1635}
1636
1637impl ComponentStartInfo {
1638    fn __max_ordinal(&self) -> usize {
1639        if self.resolved_url.is_some() {
1640            return 1;
1641        }
1642
1643        if self.program.is_some() {
1644            return 2;
1645        }
1646
1647        if self.ns.is_some() {
1648            return 3;
1649        }
1650
1651        if self.outgoing_dir.is_some() {
1652            return 4;
1653        }
1654
1655        if self.runtime_dir.is_some() {
1656            return 5;
1657        }
1658
1659        if self.numbered_handles.is_some() {
1660            return 6;
1661        }
1662
1663        if self.encoded_config.is_some() {
1664            return 7;
1665        }
1666
1667        if self.break_on_start.is_some() {
1668            return 8;
1669        }
1670
1671        if self.component_instance.is_some() {
1672            return 9;
1673        }
1674
1675        if self.escrowed_dictionary.is_some() {
1676            return 10;
1677        }
1678
1679        0
1680    }
1681}
1682
1683impl ::fidl_next::Encodable for ComponentStartInfo {
1684    type Encoded = WireComponentStartInfo;
1685}
1686
1687unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentStartInfo
1688where
1689    ___E: ::fidl_next::Encoder + ?Sized,
1690
1691    ___E: ::fidl_next::fuchsia::HandleEncoder,
1692{
1693    #[inline]
1694    fn encode(
1695        &mut self,
1696        encoder: &mut ___E,
1697        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1698    ) -> Result<(), ::fidl_next::EncodeError> {
1699        ::fidl_next::munge!(let WireComponentStartInfo { table } = out);
1700
1701        let max_ord = self.__max_ordinal();
1702
1703        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
1704        ::fidl_next::ZeroPadding::zero_padding(&mut out);
1705
1706        let mut preallocated =
1707            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
1708
1709        for i in 1..=max_ord {
1710            match i {
1711                10 => {
1712                    if let Some(escrowed_dictionary) = &mut self.escrowed_dictionary {
1713                        ::fidl_next::WireEnvelope::encode_value(
1714                            escrowed_dictionary,
1715                            preallocated.encoder,
1716                            &mut out,
1717                        )?;
1718                    } else {
1719                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1720                    }
1721                }
1722
1723                9 => {
1724                    if let Some(component_instance) = &mut self.component_instance {
1725                        ::fidl_next::WireEnvelope::encode_value(
1726                            component_instance,
1727                            preallocated.encoder,
1728                            &mut out,
1729                        )?;
1730                    } else {
1731                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1732                    }
1733                }
1734
1735                8 => {
1736                    if let Some(break_on_start) = &mut self.break_on_start {
1737                        ::fidl_next::WireEnvelope::encode_value(
1738                            break_on_start,
1739                            preallocated.encoder,
1740                            &mut out,
1741                        )?;
1742                    } else {
1743                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1744                    }
1745                }
1746
1747                7 => {
1748                    if let Some(encoded_config) = &mut self.encoded_config {
1749                        ::fidl_next::WireEnvelope::encode_value(
1750                            encoded_config,
1751                            preallocated.encoder,
1752                            &mut out,
1753                        )?;
1754                    } else {
1755                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1756                    }
1757                }
1758
1759                6 => {
1760                    if let Some(numbered_handles) = &mut self.numbered_handles {
1761                        ::fidl_next::WireEnvelope::encode_value(
1762                            numbered_handles,
1763                            preallocated.encoder,
1764                            &mut out,
1765                        )?;
1766                    } else {
1767                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1768                    }
1769                }
1770
1771                5 => {
1772                    if let Some(runtime_dir) = &mut self.runtime_dir {
1773                        ::fidl_next::WireEnvelope::encode_value(
1774                            runtime_dir,
1775                            preallocated.encoder,
1776                            &mut out,
1777                        )?;
1778                    } else {
1779                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1780                    }
1781                }
1782
1783                4 => {
1784                    if let Some(outgoing_dir) = &mut self.outgoing_dir {
1785                        ::fidl_next::WireEnvelope::encode_value(
1786                            outgoing_dir,
1787                            preallocated.encoder,
1788                            &mut out,
1789                        )?;
1790                    } else {
1791                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1792                    }
1793                }
1794
1795                3 => {
1796                    if let Some(ns) = &mut self.ns {
1797                        ::fidl_next::WireEnvelope::encode_value(
1798                            ns,
1799                            preallocated.encoder,
1800                            &mut out,
1801                        )?;
1802                    } else {
1803                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1804                    }
1805                }
1806
1807                2 => {
1808                    if let Some(program) = &mut self.program {
1809                        ::fidl_next::WireEnvelope::encode_value(
1810                            program,
1811                            preallocated.encoder,
1812                            &mut out,
1813                        )?;
1814                    } else {
1815                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1816                    }
1817                }
1818
1819                1 => {
1820                    if let Some(resolved_url) = &mut self.resolved_url {
1821                        ::fidl_next::WireEnvelope::encode_value(
1822                            resolved_url,
1823                            preallocated.encoder,
1824                            &mut out,
1825                        )?;
1826                    } else {
1827                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
1828                    }
1829                }
1830
1831                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
1832            }
1833            unsafe {
1834                preallocated.write_next(out.assume_init_ref());
1835            }
1836        }
1837
1838        ::fidl_next::WireTable::encode_len(table, max_ord);
1839
1840        Ok(())
1841    }
1842}
1843
1844impl ::fidl_next::TakeFrom<WireComponentStartInfo> for ComponentStartInfo {
1845    #[inline]
1846    fn take_from(from: &WireComponentStartInfo) -> Self {
1847        Self {
1848            resolved_url: from.resolved_url().map(::fidl_next::TakeFrom::take_from),
1849
1850            program: from.program().map(::fidl_next::TakeFrom::take_from),
1851
1852            ns: from.ns().map(::fidl_next::TakeFrom::take_from),
1853
1854            outgoing_dir: from.outgoing_dir().map(::fidl_next::TakeFrom::take_from),
1855
1856            runtime_dir: from.runtime_dir().map(::fidl_next::TakeFrom::take_from),
1857
1858            numbered_handles: from.numbered_handles().map(::fidl_next::TakeFrom::take_from),
1859
1860            encoded_config: from.encoded_config().map(::fidl_next::TakeFrom::take_from),
1861
1862            break_on_start: from.break_on_start().map(::fidl_next::TakeFrom::take_from),
1863
1864            component_instance: from.component_instance().map(::fidl_next::TakeFrom::take_from),
1865
1866            escrowed_dictionary: from.escrowed_dictionary().map(::fidl_next::TakeFrom::take_from),
1867        }
1868    }
1869}
1870
1871/// The wire type corresponding to [`ComponentStartInfo`].
1872#[repr(C)]
1873pub struct WireComponentStartInfo {
1874    table: ::fidl_next::WireTable,
1875}
1876
1877unsafe impl ::fidl_next::ZeroPadding for WireComponentStartInfo {
1878    #[inline]
1879    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1880        ::fidl_next::munge!(let Self { table } = out);
1881        ::fidl_next::WireTable::zero_padding(table);
1882    }
1883}
1884
1885unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentStartInfo
1886where
1887    ___D: ::fidl_next::Decoder + ?Sized,
1888
1889    ___D: ::fidl_next::fuchsia::HandleDecoder,
1890{
1891    fn decode(
1892        slot: ::fidl_next::Slot<'_, Self>,
1893        decoder: &mut ___D,
1894    ) -> Result<(), ::fidl_next::DecodeError> {
1895        ::fidl_next::munge!(let Self { table } = slot);
1896
1897        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1898            match ordinal {
1899                0 => unsafe { ::core::hint::unreachable_unchecked() },
1900
1901                1 => {
1902                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
1903                        slot.as_mut(),
1904                        decoder,
1905                    )?;
1906
1907                    let resolved_url = unsafe {
1908                        slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
1909                    };
1910
1911                    if resolved_url.len() > 4096 {
1912                        return Err(::fidl_next::DecodeError::VectorTooLong {
1913                            size: resolved_url.len() as u64,
1914                            limit: 4096,
1915                        });
1916                    }
1917
1918                    Ok(())
1919                }
1920
1921                2 => {
1922                    ::fidl_next::WireEnvelope::decode_as::<
1923                        ___D,
1924                        ::fidl_next_fuchsia_data::WireDictionary,
1925                    >(slot.as_mut(), decoder)?;
1926
1927                    Ok(())
1928                }
1929
1930                3 => {
1931                    ::fidl_next::WireEnvelope::decode_as::<
1932                        ___D,
1933                        ::fidl_next::WireVector<crate::WireComponentNamespaceEntry>,
1934                    >(slot.as_mut(), decoder)?;
1935
1936                    let ns = unsafe {
1937                        slot
1938                                            .deref_unchecked()
1939                                            .deref_unchecked::<
1940                                                ::fidl_next::WireVector<crate::WireComponentNamespaceEntry>
1941                                            >()
1942                    };
1943
1944                    if ns.len() > 32 {
1945                        return Err(::fidl_next::DecodeError::VectorTooLong {
1946                            size: ns.len() as u64,
1947                            limit: 32,
1948                        });
1949                    }
1950
1951                    Ok(())
1952                }
1953
1954                4 => {
1955                    ::fidl_next::WireEnvelope::decode_as::<
1956                        ___D,
1957                        ::fidl_next::ServerEnd<
1958                            ::fidl_next::fuchsia::WireChannel,
1959                            ::fidl_next_fuchsia_io::Directory,
1960                        >,
1961                    >(slot.as_mut(), decoder)?;
1962
1963                    Ok(())
1964                }
1965
1966                5 => {
1967                    ::fidl_next::WireEnvelope::decode_as::<
1968                        ___D,
1969                        ::fidl_next::ServerEnd<
1970                            ::fidl_next::fuchsia::WireChannel,
1971                            ::fidl_next_fuchsia_io::Directory,
1972                        >,
1973                    >(slot.as_mut(), decoder)?;
1974
1975                    Ok(())
1976                }
1977
1978                6 => {
1979                    ::fidl_next::WireEnvelope::decode_as::<
1980                        ___D,
1981                        ::fidl_next::WireVector<::fidl_next_fuchsia_process::WireHandleInfo>,
1982                    >(slot.as_mut(), decoder)?;
1983
1984                    let numbered_handles = unsafe {
1985                        slot
1986                                            .deref_unchecked()
1987                                            .deref_unchecked::<
1988                                                ::fidl_next::WireVector<::fidl_next_fuchsia_process::WireHandleInfo>
1989                                            >()
1990                    };
1991
1992                    if numbered_handles.len() > 128 {
1993                        return Err(::fidl_next::DecodeError::VectorTooLong {
1994                            size: numbered_handles.len() as u64,
1995                            limit: 128,
1996                        });
1997                    }
1998
1999                    Ok(())
2000                }
2001
2002                7 => {
2003                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next_fuchsia_mem::WireData>(
2004                        slot.as_mut(),
2005                        decoder,
2006                    )?;
2007
2008                    Ok(())
2009                }
2010
2011                8 => {
2012                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
2013                        slot.as_mut(),
2014                        decoder,
2015                    )?;
2016
2017                    Ok(())
2018                }
2019
2020                9 => {
2021                    ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
2022                        slot.as_mut(),
2023                        decoder,
2024                    )?;
2025
2026                    Ok(())
2027                }
2028
2029                10 => {
2030                    ::fidl_next::WireEnvelope::decode_as::<
2031                        ___D,
2032                        ::fidl_next_fuchsia_component_sandbox::WireDictionaryRef,
2033                    >(slot.as_mut(), decoder)?;
2034
2035                    Ok(())
2036                }
2037
2038                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
2039            }
2040        })
2041    }
2042}
2043
2044impl WireComponentStartInfo {
2045    pub fn resolved_url(&self) -> Option<&::fidl_next::WireString> {
2046        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2047    }
2048
2049    pub fn program(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary> {
2050        unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2051    }
2052
2053    pub fn ns(&self) -> Option<&::fidl_next::WireVector<crate::WireComponentNamespaceEntry>> {
2054        unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2055    }
2056
2057    pub fn outgoing_dir(
2058        &self,
2059    ) -> Option<
2060        &::fidl_next::ServerEnd<
2061            ::fidl_next::fuchsia::WireChannel,
2062            ::fidl_next_fuchsia_io::Directory,
2063        >,
2064    > {
2065        unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2066    }
2067
2068    pub fn runtime_dir(
2069        &self,
2070    ) -> Option<
2071        &::fidl_next::ServerEnd<
2072            ::fidl_next::fuchsia::WireChannel,
2073            ::fidl_next_fuchsia_io::Directory,
2074        >,
2075    > {
2076        unsafe { Some(self.table.get(5)?.deref_unchecked()) }
2077    }
2078
2079    pub fn numbered_handles(
2080        &self,
2081    ) -> Option<&::fidl_next::WireVector<::fidl_next_fuchsia_process::WireHandleInfo>> {
2082        unsafe { Some(self.table.get(6)?.deref_unchecked()) }
2083    }
2084
2085    pub fn encoded_config(&self) -> Option<&::fidl_next_fuchsia_mem::WireData> {
2086        unsafe { Some(self.table.get(7)?.deref_unchecked()) }
2087    }
2088
2089    pub fn break_on_start(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
2090        unsafe { Some(self.table.get(8)?.deref_unchecked()) }
2091    }
2092
2093    pub fn component_instance(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
2094        unsafe { Some(self.table.get(9)?.deref_unchecked()) }
2095    }
2096
2097    pub fn escrowed_dictionary(
2098        &self,
2099    ) -> Option<&::fidl_next_fuchsia_component_sandbox::WireDictionaryRef> {
2100        unsafe { Some(self.table.get(10)?.deref_unchecked()) }
2101    }
2102}
2103
2104impl ::core::fmt::Debug for WireComponentStartInfo {
2105    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
2106        f.debug_struct("ComponentStartInfo")
2107            .field("resolved_url", &self.resolved_url())
2108            .field("program", &self.program())
2109            .field("ns", &self.ns())
2110            .field("outgoing_dir", &self.outgoing_dir())
2111            .field("runtime_dir", &self.runtime_dir())
2112            .field("numbered_handles", &self.numbered_handles())
2113            .field("encoded_config", &self.encoded_config())
2114            .field("break_on_start", &self.break_on_start())
2115            .field("component_instance", &self.component_instance())
2116            .field("escrowed_dictionary", &self.escrowed_dictionary())
2117            .finish()
2118    }
2119}
2120
2121#[derive(Debug)]
2122pub struct ComponentRunnerStartRequest {
2123    pub start_info: crate::ComponentStartInfo,
2124
2125    pub controller:
2126        ::fidl_next::ServerEnd<::fidl_next::fuchsia::zx::Channel, crate::ComponentController>,
2127}
2128
2129impl ::fidl_next::Encodable for ComponentRunnerStartRequest {
2130    type Encoded = WireComponentRunnerStartRequest;
2131}
2132
2133unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentRunnerStartRequest
2134where
2135    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2136
2137    ___E: ::fidl_next::Encoder,
2138
2139    ___E: ::fidl_next::fuchsia::HandleEncoder,
2140{
2141    #[inline]
2142    fn encode(
2143        &mut self,
2144        encoder: &mut ___E,
2145        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2146    ) -> Result<(), ::fidl_next::EncodeError> {
2147        ::fidl_next::munge! {
2148            let Self::Encoded {
2149                start_info,
2150                controller,
2151
2152            } = out;
2153        }
2154
2155        ::fidl_next::Encode::encode(&mut self.start_info, encoder, start_info)?;
2156
2157        ::fidl_next::Encode::encode(&mut self.controller, encoder, controller)?;
2158
2159        Ok(())
2160    }
2161}
2162
2163impl ::fidl_next::EncodableOption for Box<ComponentRunnerStartRequest> {
2164    type EncodedOption = ::fidl_next::WireBox<WireComponentRunnerStartRequest>;
2165}
2166
2167unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ComponentRunnerStartRequest>
2168where
2169    ___E: ::fidl_next::Encoder + ?Sized,
2170    ComponentRunnerStartRequest: ::fidl_next::Encode<___E>,
2171{
2172    #[inline]
2173    fn encode_option(
2174        this: Option<&mut Self>,
2175        encoder: &mut ___E,
2176        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
2177    ) -> Result<(), ::fidl_next::EncodeError> {
2178        if let Some(inner) = this {
2179            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2180            ::fidl_next::WireBox::encode_present(out);
2181        } else {
2182            ::fidl_next::WireBox::encode_absent(out);
2183        }
2184
2185        Ok(())
2186    }
2187}
2188
2189impl ::fidl_next::TakeFrom<WireComponentRunnerStartRequest> for ComponentRunnerStartRequest {
2190    #[inline]
2191    fn take_from(from: &WireComponentRunnerStartRequest) -> Self {
2192        Self {
2193            start_info: ::fidl_next::TakeFrom::take_from(&from.start_info),
2194
2195            controller: ::fidl_next::TakeFrom::take_from(&from.controller),
2196        }
2197    }
2198}
2199
2200/// The wire type corresponding to [`ComponentRunnerStartRequest`].
2201#[derive(Debug)]
2202#[repr(C)]
2203pub struct WireComponentRunnerStartRequest {
2204    pub start_info: crate::WireComponentStartInfo,
2205
2206    pub controller:
2207        ::fidl_next::ServerEnd<::fidl_next::fuchsia::WireChannel, crate::ComponentController>,
2208}
2209
2210unsafe impl ::fidl_next::ZeroPadding for WireComponentRunnerStartRequest {
2211    #[inline]
2212    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2213        unsafe {
2214            out.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
2215        }
2216    }
2217}
2218
2219unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentRunnerStartRequest
2220where
2221    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2222
2223    ___D: ::fidl_next::Decoder,
2224
2225    ___D: ::fidl_next::fuchsia::HandleDecoder,
2226{
2227    fn decode(
2228        slot: ::fidl_next::Slot<'_, Self>,
2229        decoder: &mut ___D,
2230    ) -> Result<(), ::fidl_next::DecodeError> {
2231        ::fidl_next::munge! {
2232            let Self {
2233                mut start_info,
2234                mut controller,
2235
2236            } = slot;
2237        }
2238
2239        ::fidl_next::Decode::decode(start_info.as_mut(), decoder)?;
2240
2241        ::fidl_next::Decode::decode(controller.as_mut(), decoder)?;
2242
2243        Ok(())
2244    }
2245}
2246
2247/// The type corresponding to the ComponentRunner protocol.
2248#[doc = " A protocol used for running components.\n\n This protocol is implemented by components which provide a runtime\n environment for other components.\n\n Note: The component manager is the only intended direct client of this\n interface.\n"]
2249#[derive(Debug)]
2250pub struct ComponentRunner;
2251
2252impl ::fidl_next::Discoverable for ComponentRunner {
2253    const PROTOCOL_NAME: &'static str = "component_runner";
2254}
2255
2256pub mod component_runner {
2257    pub mod prelude {
2258        pub use crate::{
2259            component_runner, ComponentRunner, ComponentRunnerClientHandler,
2260            ComponentRunnerClientSender, ComponentRunnerServerHandler, ComponentRunnerServerSender,
2261        };
2262
2263        pub use crate::ComponentRunnerStartRequest;
2264    }
2265
2266    pub struct Start;
2267
2268    impl ::fidl_next::Method for Start {
2269        const ORDINAL: u64 = 780715659970866697;
2270
2271        type Protocol = crate::ComponentRunner;
2272
2273        type Request = crate::WireComponentRunnerStartRequest;
2274
2275        type Response = ::fidl_next::Never;
2276    }
2277}
2278
2279/// A helper trait for the `ComponentRunner` client sender.
2280pub trait ComponentRunnerClientSender {
2281    type Transport: ::fidl_next::Transport;
2282
2283    #[doc = " Start running a component instance described by `start_info`.\n\n Component manager binds and uses `controller` to control the\n lifetime of the newly started component instance.\n\n Errors are delivered as epitaphs over the `ComponentController`\n protocol. In the event of an error, the runner must ensure that\n resources are cleaned up.\n"]
2284    fn start<___R>(
2285        &self,
2286        request: &mut ___R,
2287    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
2288    where
2289        ___R: ::fidl_next::Encode<
2290            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
2291            Encoded = crate::WireComponentRunnerStartRequest,
2292        >;
2293}
2294
2295impl<___T> ComponentRunnerClientSender for ::fidl_next::ClientSender<___T, ComponentRunner>
2296where
2297    ___T: ::fidl_next::Transport,
2298{
2299    type Transport = ___T;
2300
2301    #[doc = " Start running a component instance described by `start_info`.\n\n Component manager binds and uses `controller` to control the\n lifetime of the newly started component instance.\n\n Errors are delivered as epitaphs over the `ComponentController`\n protocol. In the event of an error, the runner must ensure that\n resources are cleaned up.\n"]
2302    fn start<___R>(
2303        &self,
2304        request: &mut ___R,
2305    ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
2306    where
2307        ___R: ::fidl_next::Encode<
2308            <Self::Transport as ::fidl_next::Transport>::SendBuffer,
2309            Encoded = crate::WireComponentRunnerStartRequest,
2310        >,
2311    {
2312        self.as_untyped().send_one_way(780715659970866697, request)
2313    }
2314}
2315
2316/// A client handler for the ComponentRunner protocol.
2317///
2318/// See [`ComponentRunner`] for more details.
2319pub trait ComponentRunnerClientHandler<___T: ::fidl_next::Transport> {
2320    fn on_unknown_interaction(
2321        &mut self,
2322        sender: &::fidl_next::ClientSender<___T, ComponentRunner>,
2323        ordinal: u64,
2324    ) {
2325        sender.close();
2326    }
2327}
2328
2329impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for ComponentRunner
2330where
2331    ___T: ::fidl_next::Transport,
2332    ___H: ComponentRunnerClientHandler<___T>,
2333{
2334    fn on_event(
2335        handler: &mut ___H,
2336        sender: &::fidl_next::ClientSender<___T, Self>,
2337        ordinal: u64,
2338        buffer: ___T::RecvBuffer,
2339    ) {
2340        match ordinal {
2341            ordinal => handler.on_unknown_interaction(sender, ordinal),
2342        }
2343    }
2344}
2345
2346/// A helper trait for the `ComponentRunner` server sender.
2347pub trait ComponentRunnerServerSender {
2348    type Transport: ::fidl_next::Transport;
2349}
2350
2351impl<___T> ComponentRunnerServerSender for ::fidl_next::ServerSender<___T, ComponentRunner>
2352where
2353    ___T: ::fidl_next::Transport,
2354{
2355    type Transport = ___T;
2356}
2357
2358/// A server handler for the ComponentRunner protocol.
2359///
2360/// See [`ComponentRunner`] for more details.
2361pub trait ComponentRunnerServerHandler<___T: ::fidl_next::Transport> {
2362    #[doc = " Start running a component instance described by `start_info`.\n\n Component manager binds and uses `controller` to control the\n lifetime of the newly started component instance.\n\n Errors are delivered as epitaphs over the `ComponentController`\n protocol. In the event of an error, the runner must ensure that\n resources are cleaned up.\n"]
2363    fn start(
2364        &mut self,
2365        sender: &::fidl_next::ServerSender<___T, ComponentRunner>,
2366
2367        request: ::fidl_next::RequestBuffer<___T, component_runner::Start>,
2368    );
2369
2370    fn on_unknown_interaction(
2371        &mut self,
2372        sender: &::fidl_next::ServerSender<___T, ComponentRunner>,
2373        ordinal: u64,
2374    ) {
2375        sender.close();
2376    }
2377}
2378
2379impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for ComponentRunner
2380where
2381    ___T: ::fidl_next::Transport,
2382    ___H: ComponentRunnerServerHandler<___T>,
2383
2384    crate::WireComponentRunnerStartRequest:
2385        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
2386{
2387    fn on_one_way(
2388        handler: &mut ___H,
2389        sender: &::fidl_next::ServerSender<___T, Self>,
2390        ordinal: u64,
2391        buffer: ___T::RecvBuffer,
2392    ) {
2393        match ordinal {
2394            780715659970866697 => {
2395                let buffer = ::fidl_next::RequestBuffer::from_untyped(buffer);
2396                handler.start(sender, buffer);
2397            }
2398
2399            ordinal => handler.on_unknown_interaction(sender, ordinal),
2400        }
2401    }
2402
2403    fn on_two_way(
2404        handler: &mut ___H,
2405        sender: &::fidl_next::ServerSender<___T, Self>,
2406        ordinal: u64,
2407        buffer: ___T::RecvBuffer,
2408        responder: ::fidl_next::protocol::Responder,
2409    ) {
2410        match ordinal {
2411            ordinal => handler.on_unknown_interaction(sender, ordinal),
2412        }
2413    }
2414}
2415
2416#[derive(Debug)]
2417#[repr(C)]
2418pub struct TaskProviderGetJobResponse {
2419    pub job: ::fidl_next::fuchsia::zx::Handle,
2420}
2421
2422impl ::fidl_next::Encodable for TaskProviderGetJobResponse {
2423    const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> = unsafe {
2424        ::fidl_next::CopyOptimization::enable_if(
2425            true && <::fidl_next::fuchsia::zx::Handle as ::fidl_next::Encodable>::COPY_OPTIMIZATION
2426                .is_enabled(),
2427        )
2428    };
2429
2430    type Encoded = WireTaskProviderGetJobResponse;
2431}
2432
2433unsafe impl<___E> ::fidl_next::Encode<___E> for TaskProviderGetJobResponse
2434where
2435    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2436
2437    ___E: ::fidl_next::fuchsia::HandleEncoder,
2438{
2439    #[inline]
2440    fn encode(
2441        &mut self,
2442        encoder: &mut ___E,
2443        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2444    ) -> Result<(), ::fidl_next::EncodeError> {
2445        ::fidl_next::munge! {
2446            let Self::Encoded {
2447                job,
2448
2449            } = out;
2450        }
2451
2452        ::fidl_next::Encode::encode(&mut self.job, encoder, job)?;
2453
2454        Ok(())
2455    }
2456}
2457
2458impl ::fidl_next::EncodableOption for Box<TaskProviderGetJobResponse> {
2459    type EncodedOption = ::fidl_next::WireBox<WireTaskProviderGetJobResponse>;
2460}
2461
2462unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<TaskProviderGetJobResponse>
2463where
2464    ___E: ::fidl_next::Encoder + ?Sized,
2465    TaskProviderGetJobResponse: ::fidl_next::Encode<___E>,
2466{
2467    #[inline]
2468    fn encode_option(
2469        this: Option<&mut Self>,
2470        encoder: &mut ___E,
2471        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
2472    ) -> Result<(), ::fidl_next::EncodeError> {
2473        if let Some(inner) = this {
2474            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2475            ::fidl_next::WireBox::encode_present(out);
2476        } else {
2477            ::fidl_next::WireBox::encode_absent(out);
2478        }
2479
2480        Ok(())
2481    }
2482}
2483
2484impl ::fidl_next::TakeFrom<WireTaskProviderGetJobResponse> for TaskProviderGetJobResponse {
2485    const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> = unsafe {
2486        ::fidl_next::CopyOptimization::enable_if(
2487            true && <::fidl_next::fuchsia::zx::Handle as ::fidl_next::Encodable>::COPY_OPTIMIZATION
2488                .is_enabled(),
2489        )
2490    };
2491
2492    #[inline]
2493    fn take_from(from: &WireTaskProviderGetJobResponse) -> Self {
2494        Self { job: ::fidl_next::TakeFrom::take_from(&from.job) }
2495    }
2496}
2497
2498/// The wire type corresponding to [`TaskProviderGetJobResponse`].
2499#[derive(Debug)]
2500#[repr(C)]
2501pub struct WireTaskProviderGetJobResponse {
2502    pub job: ::fidl_next::fuchsia::WireHandle,
2503}
2504
2505unsafe impl ::fidl_next::ZeroPadding for WireTaskProviderGetJobResponse {
2506    #[inline]
2507    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
2508}
2509
2510unsafe impl<___D> ::fidl_next::Decode<___D> for WireTaskProviderGetJobResponse
2511where
2512    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2513
2514    ___D: ::fidl_next::fuchsia::HandleDecoder,
2515{
2516    fn decode(
2517        slot: ::fidl_next::Slot<'_, Self>,
2518        decoder: &mut ___D,
2519    ) -> Result<(), ::fidl_next::DecodeError> {
2520        ::fidl_next::munge! {
2521            let Self {
2522                mut job,
2523
2524            } = slot;
2525        }
2526
2527        ::fidl_next::Decode::decode(job.as_mut(), decoder)?;
2528
2529        Ok(())
2530    }
2531}
2532
2533/// The type corresponding to the TaskProvider protocol.
2534#[doc = " Served by runners that want to make a zircon job available through their runtime directory.\n"]
2535#[derive(Debug)]
2536pub struct TaskProvider;
2537
2538impl ::fidl_next::Discoverable for TaskProvider {
2539    const PROTOCOL_NAME: &'static str = "task_provider";
2540}
2541
2542pub mod task_provider {
2543    pub mod prelude {
2544        pub use crate::{
2545            task_provider, TaskProvider, TaskProviderClientHandler, TaskProviderClientSender,
2546            TaskProviderServerHandler, TaskProviderServerSender,
2547        };
2548
2549        pub use crate::TaskProviderGetJobResponse;
2550    }
2551
2552    pub struct GetJob;
2553
2554    impl ::fidl_next::Method for GetJob {
2555        const ORDINAL: u64 = 5520468615388521389;
2556
2557        type Protocol = crate::TaskProvider;
2558
2559        type Request = ();
2560
2561        type Response =
2562            ::fidl_next::WireResult<crate::WireTaskProviderGetJobResponse, ::fidl_next::WireI32>;
2563    }
2564}
2565
2566/// A helper trait for the `TaskProvider` client sender.
2567pub trait TaskProviderClientSender {
2568    type Transport: ::fidl_next::Transport;
2569
2570    #[doc = " Returns a job handle for the component requested.\n\n On success, returns a handle with the same rights as the runner\'s.\n"]
2571    fn get_job(
2572        &self,
2573    ) -> Result<
2574        ::fidl_next::ResponseFuture<'_, Self::Transport, task_provider::GetJob>,
2575        ::fidl_next::EncodeError,
2576    >;
2577}
2578
2579impl<___T> TaskProviderClientSender for ::fidl_next::ClientSender<___T, TaskProvider>
2580where
2581    ___T: ::fidl_next::Transport,
2582{
2583    type Transport = ___T;
2584
2585    #[doc = " Returns a job handle for the component requested.\n\n On success, returns a handle with the same rights as the runner\'s.\n"]
2586    fn get_job(
2587        &self,
2588    ) -> Result<
2589        ::fidl_next::ResponseFuture<'_, Self::Transport, task_provider::GetJob>,
2590        ::fidl_next::EncodeError,
2591    > {
2592        self.as_untyped()
2593            .send_two_way(5520468615388521389, &mut ())
2594            .map(::fidl_next::ResponseFuture::from_untyped)
2595    }
2596}
2597
2598/// A client handler for the TaskProvider protocol.
2599///
2600/// See [`TaskProvider`] for more details.
2601pub trait TaskProviderClientHandler<___T: ::fidl_next::Transport> {
2602    fn on_unknown_interaction(
2603        &mut self,
2604        sender: &::fidl_next::ClientSender<___T, TaskProvider>,
2605        ordinal: u64,
2606    ) {
2607        sender.close();
2608    }
2609}
2610
2611impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for TaskProvider
2612where
2613    ___T: ::fidl_next::Transport,
2614    ___H: TaskProviderClientHandler<___T>,
2615
2616    <task_provider::GetJob as ::fidl_next::Method>::Response:
2617        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
2618{
2619    fn on_event(
2620        handler: &mut ___H,
2621        sender: &::fidl_next::ClientSender<___T, Self>,
2622        ordinal: u64,
2623        buffer: ___T::RecvBuffer,
2624    ) {
2625        match ordinal {
2626            ordinal => handler.on_unknown_interaction(sender, ordinal),
2627        }
2628    }
2629}
2630
2631/// A helper trait for the `TaskProvider` server sender.
2632pub trait TaskProviderServerSender {
2633    type Transport: ::fidl_next::Transport;
2634}
2635
2636impl<___T> TaskProviderServerSender for ::fidl_next::ServerSender<___T, TaskProvider>
2637where
2638    ___T: ::fidl_next::Transport,
2639{
2640    type Transport = ___T;
2641}
2642
2643/// A server handler for the TaskProvider protocol.
2644///
2645/// See [`TaskProvider`] for more details.
2646pub trait TaskProviderServerHandler<___T: ::fidl_next::Transport> {
2647    #[doc = " Returns a job handle for the component requested.\n\n On success, returns a handle with the same rights as the runner\'s.\n"]
2648    fn get_job(
2649        &mut self,
2650        sender: &::fidl_next::ServerSender<___T, TaskProvider>,
2651
2652        responder: ::fidl_next::Responder<task_provider::GetJob>,
2653    );
2654
2655    fn on_unknown_interaction(
2656        &mut self,
2657        sender: &::fidl_next::ServerSender<___T, TaskProvider>,
2658        ordinal: u64,
2659    ) {
2660        sender.close();
2661    }
2662}
2663
2664impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for TaskProvider
2665where
2666    ___T: ::fidl_next::Transport,
2667    ___H: TaskProviderServerHandler<___T>,
2668{
2669    fn on_one_way(
2670        handler: &mut ___H,
2671        sender: &::fidl_next::ServerSender<___T, Self>,
2672        ordinal: u64,
2673        buffer: ___T::RecvBuffer,
2674    ) {
2675        match ordinal {
2676            ordinal => handler.on_unknown_interaction(sender, ordinal),
2677        }
2678    }
2679
2680    fn on_two_way(
2681        handler: &mut ___H,
2682        sender: &::fidl_next::ServerSender<___T, Self>,
2683        ordinal: u64,
2684        buffer: ___T::RecvBuffer,
2685        responder: ::fidl_next::protocol::Responder,
2686    ) {
2687        match ordinal {
2688            5520468615388521389 => {
2689                let responder = ::fidl_next::Responder::from_untyped(responder);
2690
2691                handler.get_job(sender, responder);
2692            }
2693
2694            ordinal => handler.on_unknown_interaction(sender, ordinal),
2695        }
2696    }
2697}
2698
2699/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
2700pub mod compat {
2701
2702    impl ::fidl_next::TakeFrom<crate::WireTask> for ::fidl_fuchsia_component_runner::Task {
2703        #[inline]
2704        fn take_from(from: &crate::WireTask) -> Self {
2705            match from.as_ref() {
2706                crate::task::Ref::Job(value) => Self::Job(::fidl_next::TakeFrom::take_from(value)),
2707
2708                crate::task::Ref::Process(value) => {
2709                    Self::Process(::fidl_next::TakeFrom::take_from(value))
2710                }
2711
2712                crate::task::Ref::Thread(value) => {
2713                    Self::Thread(::fidl_next::TakeFrom::take_from(value))
2714                }
2715
2716                crate::task::Ref::UnknownOrdinal_(unknown_ordinal) => {
2717                    Self::__SourceBreaking { unknown_ordinal }
2718                }
2719            }
2720        }
2721    }
2722
2723    impl ::fidl_next::TakeFrom<crate::WireOptionalTask>
2724        for Option<Box<::fidl_fuchsia_component_runner::Task>>
2725    {
2726        #[inline]
2727        fn take_from(from: &crate::WireOptionalTask) -> Self {
2728            if let Some(inner) = from.as_ref() {
2729                Some(::fidl_next::TakeFrom::take_from(inner))
2730            } else {
2731                None
2732            }
2733        }
2734    }
2735
2736    impl ::fidl_next::TakeFrom<crate::WireComponentTasks>
2737        for ::fidl_fuchsia_component_runner::ComponentTasks
2738    {
2739        #[inline]
2740        fn take_from(from: &crate::WireComponentTasks) -> Self {
2741            Self {
2742                component_task: from.component_task().map(::fidl_next::TakeFrom::take_from),
2743
2744                parent_task: from.parent_task().map(::fidl_next::TakeFrom::take_from),
2745
2746                __source_breaking: ::fidl::marker::SourceBreaking,
2747            }
2748        }
2749    }
2750
2751    impl ::fidl_next::TakeFrom<crate::WireComponentDiagnostics>
2752        for ::fidl_fuchsia_component_runner::ComponentDiagnostics
2753    {
2754        #[inline]
2755        fn take_from(from: &crate::WireComponentDiagnostics) -> Self {
2756            Self {
2757                tasks: from.tasks().map(::fidl_next::TakeFrom::take_from),
2758
2759                __source_breaking: ::fidl::marker::SourceBreaking,
2760            }
2761        }
2762    }
2763
2764    impl ::fidl_next::TakeFrom<crate::WireComponentControllerOnPublishDiagnosticsRequest>
2765        for ::fidl_fuchsia_component_runner::ComponentControllerOnPublishDiagnosticsRequest
2766    {
2767        #[inline]
2768        fn take_from(from: &crate::WireComponentControllerOnPublishDiagnosticsRequest) -> Self {
2769            Self { payload: ::fidl_next::TakeFrom::take_from(&from.payload) }
2770        }
2771    }
2772
2773    impl ::fidl_next::TakeFrom<crate::WireComponentControllerOnEscrowRequest>
2774        for ::fidl_fuchsia_component_runner::ComponentControllerOnEscrowRequest
2775    {
2776        #[inline]
2777        fn take_from(from: &crate::WireComponentControllerOnEscrowRequest) -> Self {
2778            Self {
2779                outgoing_dir: from.outgoing_dir().map(::fidl_next::TakeFrom::take_from),
2780
2781                escrowed_dictionary: from
2782                    .escrowed_dictionary()
2783                    .map(::fidl_next::TakeFrom::take_from),
2784
2785                __source_breaking: ::fidl::marker::SourceBreaking,
2786            }
2787        }
2788    }
2789
2790    impl ::fidl_next::TakeFrom<crate::WireComponentStopInfo>
2791        for ::fidl_fuchsia_component_runner::ComponentStopInfo
2792    {
2793        #[inline]
2794        fn take_from(from: &crate::WireComponentStopInfo) -> Self {
2795            Self {
2796                termination_status: from.termination_status().map(::fidl_next::TakeFrom::take_from),
2797
2798                exit_code: from.exit_code().map(::fidl_next::TakeFrom::take_from),
2799
2800                __source_breaking: ::fidl::marker::SourceBreaking,
2801            }
2802        }
2803    }
2804
2805    #[cfg(target_os = "fuchsia")]
2806    /// An alias for a client sender over `zx::Channel` for the `ComponentController`
2807    /// protocol.
2808    pub type ComponentControllerProxy =
2809        ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::ComponentController>;
2810
2811    impl ::fidl_next::TakeFrom<crate::ComponentController>
2812        for ::fidl_fuchsia_component_runner::ComponentControllerMarker
2813    {
2814        #[inline]
2815        fn take_from(from: &crate::ComponentController) -> Self {
2816            Self
2817        }
2818    }
2819
2820    impl ::fidl_next::TakeFrom<crate::WireComponentNamespaceEntry>
2821        for ::fidl_fuchsia_component_runner::ComponentNamespaceEntry
2822    {
2823        #[inline]
2824        fn take_from(from: &crate::WireComponentNamespaceEntry) -> Self {
2825            Self {
2826                path: from.path().map(::fidl_next::TakeFrom::take_from),
2827
2828                directory: from.directory().map(::fidl_next::TakeFrom::take_from),
2829
2830                __source_breaking: ::fidl::marker::SourceBreaking,
2831            }
2832        }
2833    }
2834
2835    impl ::fidl_next::TakeFrom<crate::WireComponentStartInfo>
2836        for ::fidl_fuchsia_component_runner::ComponentStartInfo
2837    {
2838        #[inline]
2839        fn take_from(from: &crate::WireComponentStartInfo) -> Self {
2840            Self {
2841                resolved_url: from.resolved_url().map(::fidl_next::TakeFrom::take_from),
2842
2843                program: from.program().map(::fidl_next::TakeFrom::take_from),
2844
2845                ns: from.ns().map(::fidl_next::TakeFrom::take_from),
2846
2847                outgoing_dir: from.outgoing_dir().map(::fidl_next::TakeFrom::take_from),
2848
2849                runtime_dir: from.runtime_dir().map(::fidl_next::TakeFrom::take_from),
2850
2851                numbered_handles: from.numbered_handles().map(::fidl_next::TakeFrom::take_from),
2852
2853                encoded_config: from.encoded_config().map(::fidl_next::TakeFrom::take_from),
2854
2855                break_on_start: from.break_on_start().map(::fidl_next::TakeFrom::take_from),
2856
2857                component_instance: from.component_instance().map(::fidl_next::TakeFrom::take_from),
2858
2859                escrowed_dictionary: from
2860                    .escrowed_dictionary()
2861                    .map(::fidl_next::TakeFrom::take_from),
2862
2863                __source_breaking: ::fidl::marker::SourceBreaking,
2864            }
2865        }
2866    }
2867
2868    impl ::fidl_next::TakeFrom<crate::WireComponentRunnerStartRequest>
2869        for ::fidl_fuchsia_component_runner::ComponentRunnerStartRequest
2870    {
2871        #[inline]
2872        fn take_from(from: &crate::WireComponentRunnerStartRequest) -> Self {
2873            Self {
2874                start_info: ::fidl_next::TakeFrom::take_from(&from.start_info),
2875
2876                controller: ::fidl_next::TakeFrom::take_from(&from.controller),
2877            }
2878        }
2879    }
2880
2881    #[cfg(target_os = "fuchsia")]
2882    /// An alias for a client sender over `zx::Channel` for the `ComponentRunner`
2883    /// protocol.
2884    pub type ComponentRunnerProxy =
2885        ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::ComponentRunner>;
2886
2887    impl ::fidl_next::TakeFrom<crate::ComponentRunner>
2888        for ::fidl_fuchsia_component_runner::ComponentRunnerMarker
2889    {
2890        #[inline]
2891        fn take_from(from: &crate::ComponentRunner) -> Self {
2892            Self
2893        }
2894    }
2895
2896    impl ::fidl_next::TakeFrom<crate::WireTaskProviderGetJobResponse>
2897        for ::fidl_fuchsia_component_runner::TaskProviderGetJobResponse
2898    {
2899        #[inline]
2900        fn take_from(from: &crate::WireTaskProviderGetJobResponse) -> Self {
2901            Self { job: ::fidl_next::TakeFrom::take_from(&from.job) }
2902        }
2903    }
2904
2905    #[cfg(target_os = "fuchsia")]
2906    /// An alias for a client sender over `zx::Channel` for the `TaskProvider`
2907    /// protocol.
2908    pub type TaskProviderProxy =
2909        ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::TaskProvider>;
2910
2911    impl ::fidl_next::TakeFrom<crate::TaskProvider>
2912        for ::fidl_fuchsia_component_runner::TaskProviderMarker
2913    {
2914        #[inline]
2915        fn take_from(from: &crate::TaskProvider) -> Self {
2916            Self
2917        }
2918    }
2919}