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