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::zx::Channel,
796 ::fidl_next_fuchsia_io::Directory,
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::WireChannel,
898 ::fidl_next_fuchsia_io::Directory,
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::WireChannel,
925 ::fidl_next_fuchsia_io::Directory,
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::WireChannel,
966 ::fidl_next_fuchsia_io::Directory,
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::WireChannel,
994 ::fidl_next_fuchsia_io::Directory,
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 ComponentControllerClientSender, ComponentControllerServerHandler,
1226 ComponentControllerServerSender,
1227 };
1228
1229 pub use crate::ComponentControllerOnEscrowRequest;
1230
1231 pub use crate::ComponentControllerOnPublishDiagnosticsRequest;
1232
1233 pub use crate::ComponentStopInfo;
1234 }
1235
1236 pub struct Stop;
1237
1238 impl ::fidl_next::Method for Stop {
1239 const ORDINAL: u64 = 4804506821232171874;
1240
1241 type Protocol = crate::ComponentController;
1242
1243 type Request = ();
1244
1245 type Response = ::fidl_next::Never;
1246 }
1247
1248 pub struct Kill;
1249
1250 impl ::fidl_next::Method for Kill {
1251 const ORDINAL: u64 = 4514346391631670964;
1252
1253 type Protocol = crate::ComponentController;
1254
1255 type Request = ();
1256
1257 type Response = ::fidl_next::Never;
1258 }
1259
1260 pub struct OnPublishDiagnostics;
1261
1262 impl ::fidl_next::Method for OnPublishDiagnostics {
1263 const ORDINAL: u64 = 2240216199992207687;
1264
1265 type Protocol = crate::ComponentController;
1266
1267 type Request = ::fidl_next::Never;
1268
1269 type Response = crate::WireComponentControllerOnPublishDiagnosticsRequest<'static>;
1270 }
1271
1272 pub struct OnEscrow;
1273
1274 impl ::fidl_next::Method for OnEscrow {
1275 const ORDINAL: u64 = 730448769712342012;
1276
1277 type Protocol = crate::ComponentController;
1278
1279 type Request = ::fidl_next::Never;
1280
1281 type Response = crate::WireComponentControllerOnEscrowRequest<'static>;
1282 }
1283
1284 pub struct OnStop;
1285
1286 impl ::fidl_next::Method for OnStop {
1287 const ORDINAL: u64 = 4322651556509354674;
1288
1289 type Protocol = crate::ComponentController;
1290
1291 type Request = ::fidl_next::Never;
1292
1293 type Response = crate::WireComponentStopInfo<'static>;
1294 }
1295}
1296
1297pub trait ComponentControllerClientSender {
1299 type Transport: ::fidl_next::Transport;
1300
1301 #[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"]
1302 fn stop(
1303 &self,
1304 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>;
1305
1306 #[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"]
1307 fn kill(
1308 &self,
1309 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>;
1310}
1311
1312impl<___T> ComponentControllerClientSender for ::fidl_next::ClientSender<___T, ComponentController>
1313where
1314 ___T: ::fidl_next::Transport,
1315{
1316 type Transport = ___T;
1317
1318 #[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"]
1319 fn stop(
1320 &self,
1321 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError> {
1322 self.as_untyped().send_one_way(4804506821232171874, ())
1323 }
1324
1325 #[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"]
1326 fn kill(
1327 &self,
1328 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError> {
1329 self.as_untyped().send_one_way(4514346391631670964, ())
1330 }
1331}
1332
1333pub trait ComponentControllerClientHandler<___T: ::fidl_next::Transport> {
1337 #[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"]
1338 fn on_publish_diagnostics(
1339 &mut self,
1340 sender: &::fidl_next::ClientSender<___T, ComponentController>,
1341
1342 event: ::fidl_next::Response<___T, component_controller::OnPublishDiagnostics>,
1343 );
1344
1345 #[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"]
1346 fn on_escrow(
1347 &mut self,
1348 sender: &::fidl_next::ClientSender<___T, ComponentController>,
1349
1350 event: ::fidl_next::Response<___T, component_controller::OnEscrow>,
1351 );
1352
1353 #[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"]
1354 fn on_stop(
1355 &mut self,
1356 sender: &::fidl_next::ClientSender<___T, ComponentController>,
1357
1358 event: ::fidl_next::Response<___T, component_controller::OnStop>,
1359 );
1360
1361 fn on_unknown_interaction(
1362 &mut self,
1363 sender: &::fidl_next::ClientSender<___T, ComponentController>,
1364 ordinal: u64,
1365 ) {
1366 sender.close();
1367 }
1368}
1369
1370impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for ComponentController
1371where
1372 ___T: ::fidl_next::Transport,
1373 ___H: ComponentControllerClientHandler<___T>,
1374
1375 <component_controller::OnPublishDiagnostics as ::fidl_next::Method>::Response:
1376 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1377
1378 <component_controller::OnEscrow as ::fidl_next::Method>::Response:
1379 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1380
1381 <component_controller::OnStop as ::fidl_next::Method>::Response:
1382 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1383{
1384 fn on_event(
1385 handler: &mut ___H,
1386 sender: &::fidl_next::ClientSender<___T, Self>,
1387 ordinal: u64,
1388 buffer: ___T::RecvBuffer,
1389 ) {
1390 match ordinal {
1391 2240216199992207687 => match ::fidl_next::DecoderExt::decode(buffer) {
1392 Ok(decoded) => handler.on_publish_diagnostics(sender, decoded),
1393 Err(e) => {
1394 sender.close();
1395 }
1396 },
1397
1398 730448769712342012 => match ::fidl_next::DecoderExt::decode(buffer) {
1399 Ok(decoded) => handler.on_escrow(sender, decoded),
1400 Err(e) => {
1401 sender.close();
1402 }
1403 },
1404
1405 4322651556509354674 => match ::fidl_next::DecoderExt::decode(buffer) {
1406 Ok(decoded) => handler.on_stop(sender, decoded),
1407 Err(e) => {
1408 sender.close();
1409 }
1410 },
1411
1412 ordinal => handler.on_unknown_interaction(sender, ordinal),
1413 }
1414 }
1415}
1416
1417pub trait ComponentControllerServerSender {
1419 type Transport: ::fidl_next::Transport;
1420
1421 #[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"]
1422
1423 fn on_publish_diagnostics<___R>(
1424 &self,
1425 request: ___R,
1426 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1427 where
1428 ___R: ::fidl_next::Encode<
1429 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1430 Encoded = <component_controller::OnPublishDiagnostics as ::fidl_next::Method>::Response,
1431 >;
1432
1433 #[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"]
1434
1435 fn on_escrow<___R>(
1436 &self,
1437 request: ___R,
1438 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1439 where
1440 ___R: ::fidl_next::Encode<
1441 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1442 Encoded = <component_controller::OnEscrow as ::fidl_next::Method>::Response,
1443 >;
1444
1445 #[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"]
1446
1447 fn on_stop<___R>(
1448 &self,
1449 request: ___R,
1450 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1451 where
1452 ___R: ::fidl_next::Encode<
1453 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1454 Encoded = <component_controller::OnStop as ::fidl_next::Method>::Response,
1455 >;
1456}
1457
1458impl<___T> ComponentControllerServerSender for ::fidl_next::ServerSender<___T, ComponentController>
1459where
1460 ___T: ::fidl_next::Transport,
1461{
1462 type Transport = ___T;
1463
1464 #[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"]
1465
1466 fn on_publish_diagnostics<___R>(
1467 &self,
1468 request: ___R,
1469 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1470 where
1471 ___R: ::fidl_next::Encode<
1472 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1473 Encoded = <component_controller::OnPublishDiagnostics as ::fidl_next::Method>::Response,
1474 >,
1475 {
1476 self.as_untyped().send_event(2240216199992207687, request)
1477 }
1478
1479 #[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"]
1480
1481 fn on_escrow<___R>(
1482 &self,
1483 request: ___R,
1484 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1485 where
1486 ___R: ::fidl_next::Encode<
1487 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1488 Encoded = <component_controller::OnEscrow as ::fidl_next::Method>::Response,
1489 >,
1490 {
1491 self.as_untyped().send_event(730448769712342012, request)
1492 }
1493
1494 #[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"]
1495
1496 fn on_stop<___R>(
1497 &self,
1498 request: ___R,
1499 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
1500 where
1501 ___R: ::fidl_next::Encode<
1502 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
1503 Encoded = <component_controller::OnStop as ::fidl_next::Method>::Response,
1504 >,
1505 {
1506 self.as_untyped().send_event(4322651556509354674, request)
1507 }
1508}
1509
1510pub trait ComponentControllerServerHandler<___T: ::fidl_next::Transport> {
1514 #[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"]
1515 fn stop(&mut self, sender: &::fidl_next::ServerSender<___T, ComponentController>);
1516
1517 #[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"]
1518 fn kill(&mut self, sender: &::fidl_next::ServerSender<___T, ComponentController>);
1519
1520 fn on_unknown_interaction(
1521 &mut self,
1522 sender: &::fidl_next::ServerSender<___T, ComponentController>,
1523 ordinal: u64,
1524 ) {
1525 sender.close();
1526 }
1527}
1528
1529impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for ComponentController
1530where
1531 ___T: ::fidl_next::Transport,
1532 ___H: ComponentControllerServerHandler<___T>,
1533{
1534 fn on_one_way(
1535 handler: &mut ___H,
1536 sender: &::fidl_next::ServerSender<___T, Self>,
1537 ordinal: u64,
1538 buffer: ___T::RecvBuffer,
1539 ) {
1540 match ordinal {
1541 4804506821232171874 => {
1542 handler.stop(sender);
1543 }
1544
1545 4514346391631670964 => {
1546 handler.kill(sender);
1547 }
1548
1549 ordinal => handler.on_unknown_interaction(sender, ordinal),
1550 }
1551 }
1552
1553 fn on_two_way(
1554 handler: &mut ___H,
1555 sender: &::fidl_next::ServerSender<___T, Self>,
1556 ordinal: u64,
1557 buffer: ___T::RecvBuffer,
1558 responder: ::fidl_next::protocol::Responder,
1559 ) {
1560 match ordinal {
1561 ordinal => handler.on_unknown_interaction(sender, ordinal),
1562 }
1563 }
1564}
1565
1566#[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"]
1567#[derive(Debug, Default)]
1568pub struct ComponentNamespaceEntry {
1569 pub path: Option<String>,
1570
1571 pub directory: Option<
1572 ::fidl_next::ClientEnd<
1573 ::fidl_next::fuchsia::zx::Channel,
1574 ::fidl_next_fuchsia_io::Directory,
1575 >,
1576 >,
1577}
1578
1579impl ComponentNamespaceEntry {
1580 fn __max_ordinal(&self) -> usize {
1581 if self.directory.is_some() {
1582 return 2;
1583 }
1584
1585 if self.path.is_some() {
1586 return 1;
1587 }
1588
1589 0
1590 }
1591}
1592
1593impl ::fidl_next::Encodable for ComponentNamespaceEntry {
1594 type Encoded = WireComponentNamespaceEntry<'static>;
1595}
1596
1597unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentNamespaceEntry
1598where
1599 ___E: ::fidl_next::Encoder + ?Sized,
1600
1601 ___E: ::fidl_next::fuchsia::HandleEncoder,
1602{
1603 #[inline]
1604 fn encode(
1605 mut self,
1606 encoder: &mut ___E,
1607 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1608 ) -> Result<(), ::fidl_next::EncodeError> {
1609 ::fidl_next::munge!(let WireComponentNamespaceEntry { table } = out);
1610
1611 let max_ord = self.__max_ordinal();
1612
1613 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
1614 ::fidl_next::Wire::zero_padding(&mut out);
1615
1616 let mut preallocated =
1617 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
1618
1619 for i in 1..=max_ord {
1620 match i {
1621 2 => {
1622 if let Some(directory) = self.directory.take() {
1623 ::fidl_next::WireEnvelope::encode_value(
1624 directory,
1625 preallocated.encoder,
1626 &mut out,
1627 )?;
1628 } else {
1629 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1630 }
1631 }
1632
1633 1 => {
1634 if let Some(path) = self.path.take() {
1635 ::fidl_next::WireEnvelope::encode_value(
1636 path,
1637 preallocated.encoder,
1638 &mut out,
1639 )?;
1640 } else {
1641 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1642 }
1643 }
1644
1645 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
1646 }
1647 unsafe {
1648 preallocated.write_next(out.assume_init_ref());
1649 }
1650 }
1651
1652 ::fidl_next::WireTable::encode_len(table, max_ord);
1653
1654 Ok(())
1655 }
1656}
1657
1658impl<'de> ::fidl_next::FromWire<WireComponentNamespaceEntry<'de>> for ComponentNamespaceEntry {
1659 #[inline]
1660 fn from_wire(wire: WireComponentNamespaceEntry<'de>) -> Self {
1661 let wire = ::core::mem::ManuallyDrop::new(wire);
1662
1663 let path = wire.table.get(1);
1664
1665 let directory = wire.table.get(2);
1666
1667 Self {
1668 path: path.map(|envelope| {
1669 ::fidl_next::FromWire::from_wire(unsafe {
1670 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
1671 })
1672 }),
1673
1674 directory: directory.map(|envelope| {
1675 ::fidl_next::FromWire::from_wire(unsafe {
1676 envelope.read_unchecked::<::fidl_next::ClientEnd<
1677 ::fidl_next::fuchsia::WireChannel,
1678 ::fidl_next_fuchsia_io::Directory,
1679 >>()
1680 })
1681 }),
1682 }
1683 }
1684}
1685
1686#[repr(C)]
1688pub struct WireComponentNamespaceEntry<'de> {
1689 table: ::fidl_next::WireTable<'de>,
1690}
1691
1692impl<'de> Drop for WireComponentNamespaceEntry<'de> {
1693 fn drop(&mut self) {
1694 let _ = self
1695 .table
1696 .get(1)
1697 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
1698
1699 let _ = self.table.get(2).map(|envelope| unsafe {
1700 envelope.read_unchecked::<::fidl_next::ClientEnd<
1701 ::fidl_next::fuchsia::WireChannel,
1702 ::fidl_next_fuchsia_io::Directory,
1703 >>()
1704 });
1705 }
1706}
1707
1708unsafe impl ::fidl_next::Wire for WireComponentNamespaceEntry<'static> {
1709 type Decoded<'de> = WireComponentNamespaceEntry<'de>;
1710
1711 #[inline]
1712 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1713 ::fidl_next::munge!(let Self { table } = out);
1714 ::fidl_next::WireTable::zero_padding(table);
1715 }
1716}
1717
1718unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentNamespaceEntry<'static>
1719where
1720 ___D: ::fidl_next::Decoder + ?Sized,
1721
1722 ___D: ::fidl_next::fuchsia::HandleDecoder,
1723{
1724 fn decode(
1725 slot: ::fidl_next::Slot<'_, Self>,
1726 decoder: &mut ___D,
1727 ) -> Result<(), ::fidl_next::DecodeError> {
1728 ::fidl_next::munge!(let Self { table } = slot);
1729
1730 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1731 match ordinal {
1732 0 => unsafe { ::core::hint::unreachable_unchecked() },
1733
1734 1 => {
1735 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
1736 slot.as_mut(),
1737 decoder,
1738 )?;
1739
1740 let path = unsafe {
1741 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
1742 };
1743
1744 if path.len() > 4095 {
1745 return Err(::fidl_next::DecodeError::VectorTooLong {
1746 size: path.len() as u64,
1747 limit: 4095,
1748 });
1749 }
1750
1751 Ok(())
1752 }
1753
1754 2 => {
1755 ::fidl_next::WireEnvelope::decode_as::<
1756 ___D,
1757 ::fidl_next::ClientEnd<
1758 ::fidl_next::fuchsia::WireChannel,
1759 ::fidl_next_fuchsia_io::Directory,
1760 >,
1761 >(slot.as_mut(), decoder)?;
1762
1763 Ok(())
1764 }
1765
1766 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
1767 }
1768 })
1769 }
1770}
1771
1772impl<'de> WireComponentNamespaceEntry<'de> {
1773 pub fn path(&self) -> Option<&::fidl_next::WireString<'de>> {
1774 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1775 }
1776
1777 pub fn directory(
1778 &self,
1779 ) -> Option<
1780 &::fidl_next::ClientEnd<
1781 ::fidl_next::fuchsia::WireChannel,
1782 ::fidl_next_fuchsia_io::Directory,
1783 >,
1784 > {
1785 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1786 }
1787}
1788
1789impl<'de> ::core::fmt::Debug for WireComponentNamespaceEntry<'de> {
1790 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
1791 f.debug_struct("ComponentNamespaceEntry")
1792 .field("path", &self.path())
1793 .field("directory", &self.directory())
1794 .finish()
1795 }
1796}
1797
1798pub const MAX_NAMESPACE_COUNT: u32 = 32;
1799
1800pub const MAX_HANDLE_COUNT: u32 = 128;
1801
1802#[doc = " Parameters for starting a new component instance.\n"]
1803#[derive(Debug, Default)]
1804pub struct ComponentStartInfo {
1805 pub resolved_url: Option<String>,
1806
1807 pub program: Option<::fidl_next_fuchsia_data::Dictionary>,
1808
1809 pub ns: Option<Vec<crate::ComponentNamespaceEntry>>,
1810
1811 pub outgoing_dir: Option<
1812 ::fidl_next::ServerEnd<
1813 ::fidl_next::fuchsia::zx::Channel,
1814 ::fidl_next_fuchsia_io::Directory,
1815 >,
1816 >,
1817
1818 pub runtime_dir: Option<
1819 ::fidl_next::ServerEnd<
1820 ::fidl_next::fuchsia::zx::Channel,
1821 ::fidl_next_fuchsia_io::Directory,
1822 >,
1823 >,
1824
1825 pub numbered_handles: Option<Vec<::fidl_next_fuchsia_process::HandleInfo>>,
1826
1827 pub encoded_config: Option<::fidl_next_fuchsia_mem::Data>,
1828
1829 pub break_on_start: Option<::fidl_next::fuchsia::zx::Handle>,
1830
1831 pub component_instance: Option<::fidl_next::fuchsia::zx::Handle>,
1832
1833 pub escrowed_dictionary: Option<::fidl_next_fuchsia_component_sandbox::DictionaryRef>,
1834}
1835
1836impl ComponentStartInfo {
1837 fn __max_ordinal(&self) -> usize {
1838 if self.escrowed_dictionary.is_some() {
1839 return 10;
1840 }
1841
1842 if self.component_instance.is_some() {
1843 return 9;
1844 }
1845
1846 if self.break_on_start.is_some() {
1847 return 8;
1848 }
1849
1850 if self.encoded_config.is_some() {
1851 return 7;
1852 }
1853
1854 if self.numbered_handles.is_some() {
1855 return 6;
1856 }
1857
1858 if self.runtime_dir.is_some() {
1859 return 5;
1860 }
1861
1862 if self.outgoing_dir.is_some() {
1863 return 4;
1864 }
1865
1866 if self.ns.is_some() {
1867 return 3;
1868 }
1869
1870 if self.program.is_some() {
1871 return 2;
1872 }
1873
1874 if self.resolved_url.is_some() {
1875 return 1;
1876 }
1877
1878 0
1879 }
1880}
1881
1882impl ::fidl_next::Encodable for ComponentStartInfo {
1883 type Encoded = WireComponentStartInfo<'static>;
1884}
1885
1886unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentStartInfo
1887where
1888 ___E: ::fidl_next::Encoder + ?Sized,
1889
1890 ___E: ::fidl_next::fuchsia::HandleEncoder,
1891{
1892 #[inline]
1893 fn encode(
1894 mut self,
1895 encoder: &mut ___E,
1896 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1897 ) -> Result<(), ::fidl_next::EncodeError> {
1898 ::fidl_next::munge!(let WireComponentStartInfo { table } = out);
1899
1900 let max_ord = self.__max_ordinal();
1901
1902 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
1903 ::fidl_next::Wire::zero_padding(&mut out);
1904
1905 let mut preallocated =
1906 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
1907
1908 for i in 1..=max_ord {
1909 match i {
1910 10 => {
1911 if let Some(escrowed_dictionary) = self.escrowed_dictionary.take() {
1912 ::fidl_next::WireEnvelope::encode_value(
1913 escrowed_dictionary,
1914 preallocated.encoder,
1915 &mut out,
1916 )?;
1917 } else {
1918 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1919 }
1920 }
1921
1922 9 => {
1923 if let Some(component_instance) = self.component_instance.take() {
1924 ::fidl_next::WireEnvelope::encode_value(
1925 component_instance,
1926 preallocated.encoder,
1927 &mut out,
1928 )?;
1929 } else {
1930 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1931 }
1932 }
1933
1934 8 => {
1935 if let Some(break_on_start) = self.break_on_start.take() {
1936 ::fidl_next::WireEnvelope::encode_value(
1937 break_on_start,
1938 preallocated.encoder,
1939 &mut out,
1940 )?;
1941 } else {
1942 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1943 }
1944 }
1945
1946 7 => {
1947 if let Some(encoded_config) = self.encoded_config.take() {
1948 ::fidl_next::WireEnvelope::encode_value(
1949 encoded_config,
1950 preallocated.encoder,
1951 &mut out,
1952 )?;
1953 } else {
1954 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1955 }
1956 }
1957
1958 6 => {
1959 if let Some(numbered_handles) = self.numbered_handles.take() {
1960 ::fidl_next::WireEnvelope::encode_value(
1961 numbered_handles,
1962 preallocated.encoder,
1963 &mut out,
1964 )?;
1965 } else {
1966 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1967 }
1968 }
1969
1970 5 => {
1971 if let Some(runtime_dir) = self.runtime_dir.take() {
1972 ::fidl_next::WireEnvelope::encode_value(
1973 runtime_dir,
1974 preallocated.encoder,
1975 &mut out,
1976 )?;
1977 } else {
1978 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1979 }
1980 }
1981
1982 4 => {
1983 if let Some(outgoing_dir) = self.outgoing_dir.take() {
1984 ::fidl_next::WireEnvelope::encode_value(
1985 outgoing_dir,
1986 preallocated.encoder,
1987 &mut out,
1988 )?;
1989 } else {
1990 ::fidl_next::WireEnvelope::encode_zero(&mut out)
1991 }
1992 }
1993
1994 3 => {
1995 if let Some(ns) = self.ns.take() {
1996 ::fidl_next::WireEnvelope::encode_value(
1997 ns,
1998 preallocated.encoder,
1999 &mut out,
2000 )?;
2001 } else {
2002 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2003 }
2004 }
2005
2006 2 => {
2007 if let Some(program) = self.program.take() {
2008 ::fidl_next::WireEnvelope::encode_value(
2009 program,
2010 preallocated.encoder,
2011 &mut out,
2012 )?;
2013 } else {
2014 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2015 }
2016 }
2017
2018 1 => {
2019 if let Some(resolved_url) = self.resolved_url.take() {
2020 ::fidl_next::WireEnvelope::encode_value(
2021 resolved_url,
2022 preallocated.encoder,
2023 &mut out,
2024 )?;
2025 } else {
2026 ::fidl_next::WireEnvelope::encode_zero(&mut out)
2027 }
2028 }
2029
2030 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
2031 }
2032 unsafe {
2033 preallocated.write_next(out.assume_init_ref());
2034 }
2035 }
2036
2037 ::fidl_next::WireTable::encode_len(table, max_ord);
2038
2039 Ok(())
2040 }
2041}
2042
2043impl<'de> ::fidl_next::FromWire<WireComponentStartInfo<'de>> for ComponentStartInfo {
2044 #[inline]
2045 fn from_wire(wire: WireComponentStartInfo<'de>) -> Self {
2046 let wire = ::core::mem::ManuallyDrop::new(wire);
2047
2048 let resolved_url = wire.table.get(1);
2049
2050 let program = wire.table.get(2);
2051
2052 let ns = wire.table.get(3);
2053
2054 let outgoing_dir = wire.table.get(4);
2055
2056 let runtime_dir = wire.table.get(5);
2057
2058 let numbered_handles = wire.table.get(6);
2059
2060 let encoded_config = wire.table.get(7);
2061
2062 let break_on_start = wire.table.get(8);
2063
2064 let component_instance = wire.table.get(9);
2065
2066 let escrowed_dictionary = wire.table.get(10);
2067
2068 Self {
2069
2070
2071 resolved_url: resolved_url.map(|envelope| ::fidl_next::FromWire::from_wire(
2072 unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }
2073 )),
2074
2075
2076 program: program.map(|envelope| ::fidl_next::FromWire::from_wire(
2077 unsafe { envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>() }
2078 )),
2079
2080
2081 ns: ns.map(|envelope| ::fidl_next::FromWire::from_wire(
2082 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireComponentNamespaceEntry<'de>>>() }
2083 )),
2084
2085
2086 outgoing_dir: outgoing_dir.map(|envelope| ::fidl_next::FromWire::from_wire(
2087 unsafe { envelope.read_unchecked::<::fidl_next::ServerEnd<::fidl_next::fuchsia::WireChannel,::fidl_next_fuchsia_io::Directory,
2088 >>() }
2089 )),
2090
2091
2092 runtime_dir: runtime_dir.map(|envelope| ::fidl_next::FromWire::from_wire(
2093 unsafe { envelope.read_unchecked::<::fidl_next::ServerEnd<::fidl_next::fuchsia::WireChannel,::fidl_next_fuchsia_io::Directory,
2094 >>() }
2095 )),
2096
2097
2098 numbered_handles: numbered_handles.map(|envelope| ::fidl_next::FromWire::from_wire(
2099 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next_fuchsia_process::WireHandleInfo>>() }
2100 )),
2101
2102
2103 encoded_config: encoded_config.map(|envelope| ::fidl_next::FromWire::from_wire(
2104 unsafe { envelope.read_unchecked::<::fidl_next_fuchsia_mem::WireData<'de>>() }
2105 )),
2106
2107
2108 break_on_start: break_on_start.map(|envelope| ::fidl_next::FromWire::from_wire(
2109 unsafe { envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>() }
2110 )),
2111
2112
2113 component_instance: component_instance.map(|envelope| ::fidl_next::FromWire::from_wire(
2114 unsafe { envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>() }
2115 )),
2116
2117
2118 escrowed_dictionary: escrowed_dictionary.map(|envelope| ::fidl_next::FromWire::from_wire(
2119 unsafe { envelope.read_unchecked::<::fidl_next_fuchsia_component_sandbox::WireDictionaryRef>() }
2120 )),
2121
2122 }
2123 }
2124}
2125
2126#[repr(C)]
2128pub struct WireComponentStartInfo<'de> {
2129 table: ::fidl_next::WireTable<'de>,
2130}
2131
2132impl<'de> Drop for WireComponentStartInfo<'de> {
2133 fn drop(&mut self) {
2134 let _ = self
2135 .table
2136 .get(1)
2137 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
2138
2139 let _ = self.table.get(2).map(|envelope| unsafe {
2140 envelope.read_unchecked::<::fidl_next_fuchsia_data::WireDictionary<'de>>()
2141 });
2142
2143 let _ = self.table.get(3)
2144 .map(|envelope| unsafe {
2145 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireComponentNamespaceEntry<'de>>>()
2146 });
2147
2148 let _ = self.table.get(4).map(|envelope| unsafe {
2149 envelope.read_unchecked::<::fidl_next::ServerEnd<
2150 ::fidl_next::fuchsia::WireChannel,
2151 ::fidl_next_fuchsia_io::Directory,
2152 >>()
2153 });
2154
2155 let _ = self.table.get(5).map(|envelope| unsafe {
2156 envelope.read_unchecked::<::fidl_next::ServerEnd<
2157 ::fidl_next::fuchsia::WireChannel,
2158 ::fidl_next_fuchsia_io::Directory,
2159 >>()
2160 });
2161
2162 let _ = self.table.get(6)
2163 .map(|envelope| unsafe {
2164 envelope.read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next_fuchsia_process::WireHandleInfo>>()
2165 });
2166
2167 let _ = self.table.get(7).map(|envelope| unsafe {
2168 envelope.read_unchecked::<::fidl_next_fuchsia_mem::WireData<'de>>()
2169 });
2170
2171 let _ = self.table.get(8).map(|envelope| unsafe {
2172 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
2173 });
2174
2175 let _ = self.table.get(9).map(|envelope| unsafe {
2176 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
2177 });
2178
2179 let _ = self.table.get(10).map(|envelope| unsafe {
2180 envelope.read_unchecked::<::fidl_next_fuchsia_component_sandbox::WireDictionaryRef>()
2181 });
2182 }
2183}
2184
2185unsafe impl ::fidl_next::Wire for WireComponentStartInfo<'static> {
2186 type Decoded<'de> = WireComponentStartInfo<'de>;
2187
2188 #[inline]
2189 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2190 ::fidl_next::munge!(let Self { table } = out);
2191 ::fidl_next::WireTable::zero_padding(table);
2192 }
2193}
2194
2195unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentStartInfo<'static>
2196where
2197 ___D: ::fidl_next::Decoder + ?Sized,
2198
2199 ___D: ::fidl_next::fuchsia::HandleDecoder,
2200{
2201 fn decode(
2202 slot: ::fidl_next::Slot<'_, Self>,
2203 decoder: &mut ___D,
2204 ) -> Result<(), ::fidl_next::DecodeError> {
2205 ::fidl_next::munge!(let Self { table } = slot);
2206
2207 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2208 match ordinal {
2209 0 => unsafe { ::core::hint::unreachable_unchecked() },
2210
2211 1 => {
2212 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
2213 slot.as_mut(),
2214 decoder,
2215 )?;
2216
2217 let resolved_url = unsafe {
2218 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
2219 };
2220
2221 if resolved_url.len() > 4096 {
2222 return Err(::fidl_next::DecodeError::VectorTooLong {
2223 size: resolved_url.len() as u64,
2224 limit: 4096,
2225 });
2226 }
2227
2228 Ok(())
2229 }
2230
2231 2 => {
2232 ::fidl_next::WireEnvelope::decode_as::<
2233 ___D,
2234 ::fidl_next_fuchsia_data::WireDictionary<'static>,
2235 >(slot.as_mut(), decoder)?;
2236
2237 Ok(())
2238 }
2239
2240 3 => {
2241 ::fidl_next::WireEnvelope::decode_as::<
2242 ___D,
2243 ::fidl_next::WireVector<
2244 'static,
2245 crate::WireComponentNamespaceEntry<'static>,
2246 >,
2247 >(slot.as_mut(), decoder)?;
2248
2249 let ns = unsafe {
2250 slot
2251 .deref_unchecked()
2252 .deref_unchecked::<
2253 ::fidl_next::WireVector<'_, crate::WireComponentNamespaceEntry<'_>>
2254 >()
2255 };
2256
2257 if ns.len() > 32 {
2258 return Err(::fidl_next::DecodeError::VectorTooLong {
2259 size: ns.len() as u64,
2260 limit: 32,
2261 });
2262 }
2263
2264 Ok(())
2265 }
2266
2267 4 => {
2268 ::fidl_next::WireEnvelope::decode_as::<
2269 ___D,
2270 ::fidl_next::ServerEnd<
2271 ::fidl_next::fuchsia::WireChannel,
2272 ::fidl_next_fuchsia_io::Directory,
2273 >,
2274 >(slot.as_mut(), decoder)?;
2275
2276 Ok(())
2277 }
2278
2279 5 => {
2280 ::fidl_next::WireEnvelope::decode_as::<
2281 ___D,
2282 ::fidl_next::ServerEnd<
2283 ::fidl_next::fuchsia::WireChannel,
2284 ::fidl_next_fuchsia_io::Directory,
2285 >,
2286 >(slot.as_mut(), decoder)?;
2287
2288 Ok(())
2289 }
2290
2291 6 => {
2292 ::fidl_next::WireEnvelope::decode_as::<
2293 ___D,
2294 ::fidl_next::WireVector<
2295 'static,
2296 ::fidl_next_fuchsia_process::WireHandleInfo,
2297 >,
2298 >(slot.as_mut(), decoder)?;
2299
2300 let numbered_handles = unsafe {
2301 slot
2302 .deref_unchecked()
2303 .deref_unchecked::<
2304 ::fidl_next::WireVector<'_, ::fidl_next_fuchsia_process::WireHandleInfo>
2305 >()
2306 };
2307
2308 if numbered_handles.len() > 128 {
2309 return Err(::fidl_next::DecodeError::VectorTooLong {
2310 size: numbered_handles.len() as u64,
2311 limit: 128,
2312 });
2313 }
2314
2315 Ok(())
2316 }
2317
2318 7 => {
2319 ::fidl_next::WireEnvelope::decode_as::<
2320 ___D,
2321 ::fidl_next_fuchsia_mem::WireData<'static>,
2322 >(slot.as_mut(), decoder)?;
2323
2324 Ok(())
2325 }
2326
2327 8 => {
2328 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
2329 slot.as_mut(),
2330 decoder,
2331 )?;
2332
2333 Ok(())
2334 }
2335
2336 9 => {
2337 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
2338 slot.as_mut(),
2339 decoder,
2340 )?;
2341
2342 Ok(())
2343 }
2344
2345 10 => {
2346 ::fidl_next::WireEnvelope::decode_as::<
2347 ___D,
2348 ::fidl_next_fuchsia_component_sandbox::WireDictionaryRef,
2349 >(slot.as_mut(), decoder)?;
2350
2351 Ok(())
2352 }
2353
2354 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
2355 }
2356 })
2357 }
2358}
2359
2360impl<'de> WireComponentStartInfo<'de> {
2361 pub fn resolved_url(&self) -> Option<&::fidl_next::WireString<'de>> {
2362 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2363 }
2364
2365 pub fn program(&self) -> Option<&::fidl_next_fuchsia_data::WireDictionary<'de>> {
2366 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2367 }
2368
2369 pub fn ns(
2370 &self,
2371 ) -> Option<&::fidl_next::WireVector<'de, crate::WireComponentNamespaceEntry<'de>>> {
2372 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2373 }
2374
2375 pub fn outgoing_dir(
2376 &self,
2377 ) -> Option<
2378 &::fidl_next::ServerEnd<
2379 ::fidl_next::fuchsia::WireChannel,
2380 ::fidl_next_fuchsia_io::Directory,
2381 >,
2382 > {
2383 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2384 }
2385
2386 pub fn runtime_dir(
2387 &self,
2388 ) -> Option<
2389 &::fidl_next::ServerEnd<
2390 ::fidl_next::fuchsia::WireChannel,
2391 ::fidl_next_fuchsia_io::Directory,
2392 >,
2393 > {
2394 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
2395 }
2396
2397 pub fn numbered_handles(
2398 &self,
2399 ) -> Option<&::fidl_next::WireVector<'de, ::fidl_next_fuchsia_process::WireHandleInfo>> {
2400 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
2401 }
2402
2403 pub fn encoded_config(&self) -> Option<&::fidl_next_fuchsia_mem::WireData<'de>> {
2404 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
2405 }
2406
2407 pub fn break_on_start(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
2408 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
2409 }
2410
2411 pub fn component_instance(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
2412 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
2413 }
2414
2415 pub fn escrowed_dictionary(
2416 &self,
2417 ) -> Option<&::fidl_next_fuchsia_component_sandbox::WireDictionaryRef> {
2418 unsafe { Some(self.table.get(10)?.deref_unchecked()) }
2419 }
2420}
2421
2422impl<'de> ::core::fmt::Debug for WireComponentStartInfo<'de> {
2423 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
2424 f.debug_struct("ComponentStartInfo")
2425 .field("resolved_url", &self.resolved_url())
2426 .field("program", &self.program())
2427 .field("ns", &self.ns())
2428 .field("outgoing_dir", &self.outgoing_dir())
2429 .field("runtime_dir", &self.runtime_dir())
2430 .field("numbered_handles", &self.numbered_handles())
2431 .field("encoded_config", &self.encoded_config())
2432 .field("break_on_start", &self.break_on_start())
2433 .field("component_instance", &self.component_instance())
2434 .field("escrowed_dictionary", &self.escrowed_dictionary())
2435 .finish()
2436 }
2437}
2438
2439#[derive(Debug)]
2440pub struct ComponentRunnerStartRequest {
2441 pub start_info: crate::ComponentStartInfo,
2442
2443 pub controller:
2444 ::fidl_next::ServerEnd<::fidl_next::fuchsia::zx::Channel, crate::ComponentController>,
2445}
2446
2447impl ::fidl_next::Encodable for ComponentRunnerStartRequest {
2448 type Encoded = WireComponentRunnerStartRequest<'static>;
2449}
2450
2451unsafe impl<___E> ::fidl_next::Encode<___E> for ComponentRunnerStartRequest
2452where
2453 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2454
2455 ___E: ::fidl_next::Encoder,
2456
2457 ___E: ::fidl_next::fuchsia::HandleEncoder,
2458{
2459 #[inline]
2460 fn encode(
2461 self,
2462 encoder: &mut ___E,
2463 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2464 ) -> Result<(), ::fidl_next::EncodeError> {
2465 ::fidl_next::munge! {
2466 let Self::Encoded {
2467 start_info,
2468 controller,
2469
2470 } = out;
2471 }
2472
2473 ::fidl_next::Encode::encode(self.start_info, encoder, start_info)?;
2474
2475 ::fidl_next::Encode::encode(self.controller, encoder, controller)?;
2476
2477 Ok(())
2478 }
2479}
2480
2481impl ::fidl_next::EncodableOption for ComponentRunnerStartRequest {
2482 type EncodedOption = ::fidl_next::WireBox<'static, WireComponentRunnerStartRequest<'static>>;
2483}
2484
2485unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ComponentRunnerStartRequest
2486where
2487 ___E: ::fidl_next::Encoder + ?Sized,
2488 ComponentRunnerStartRequest: ::fidl_next::Encode<___E>,
2489{
2490 #[inline]
2491 fn encode_option(
2492 this: Option<Self>,
2493 encoder: &mut ___E,
2494 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
2495 ) -> Result<(), ::fidl_next::EncodeError> {
2496 if let Some(inner) = this {
2497 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2498 ::fidl_next::WireBox::encode_present(out);
2499 } else {
2500 ::fidl_next::WireBox::encode_absent(out);
2501 }
2502
2503 Ok(())
2504 }
2505}
2506
2507impl<'de> ::fidl_next::FromWire<WireComponentRunnerStartRequest<'de>>
2508 for ComponentRunnerStartRequest
2509{
2510 #[inline]
2511 fn from_wire(wire: WireComponentRunnerStartRequest<'de>) -> Self {
2512 Self {
2513 start_info: ::fidl_next::FromWire::from_wire(wire.start_info),
2514
2515 controller: ::fidl_next::FromWire::from_wire(wire.controller),
2516 }
2517 }
2518}
2519
2520#[derive(Debug)]
2522#[repr(C)]
2523pub struct WireComponentRunnerStartRequest<'de> {
2524 pub start_info: crate::WireComponentStartInfo<'de>,
2525
2526 pub controller:
2527 ::fidl_next::ServerEnd<::fidl_next::fuchsia::WireChannel, crate::ComponentController>,
2528}
2529
2530unsafe impl ::fidl_next::Wire for WireComponentRunnerStartRequest<'static> {
2531 type Decoded<'de> = WireComponentRunnerStartRequest<'de>;
2532
2533 #[inline]
2534 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2535 unsafe {
2536 out.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
2537 }
2538 }
2539}
2540
2541unsafe impl<___D> ::fidl_next::Decode<___D> for WireComponentRunnerStartRequest<'static>
2542where
2543 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2544
2545 ___D: ::fidl_next::Decoder,
2546
2547 ___D: ::fidl_next::fuchsia::HandleDecoder,
2548{
2549 fn decode(
2550 slot: ::fidl_next::Slot<'_, Self>,
2551 decoder: &mut ___D,
2552 ) -> Result<(), ::fidl_next::DecodeError> {
2553 ::fidl_next::munge! {
2554 let Self {
2555 mut start_info,
2556 mut controller,
2557
2558 } = slot;
2559 }
2560
2561 ::fidl_next::Decode::decode(start_info.as_mut(), decoder)?;
2562
2563 ::fidl_next::Decode::decode(controller.as_mut(), decoder)?;
2564
2565 Ok(())
2566 }
2567}
2568
2569#[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"]
2571#[derive(Debug)]
2572pub struct ComponentRunner;
2573
2574impl ::fidl_next::Discoverable for ComponentRunner {
2575 const PROTOCOL_NAME: &'static str = "fuchsia.component.runner.ComponentRunner";
2576}
2577
2578pub mod component_runner {
2579 pub mod prelude {
2580 pub use crate::{
2581 component_runner, ComponentRunner, ComponentRunnerClientHandler,
2582 ComponentRunnerClientSender, ComponentRunnerServerHandler, ComponentRunnerServerSender,
2583 };
2584
2585 pub use crate::ComponentRunnerStartRequest;
2586 }
2587
2588 pub struct Start;
2589
2590 impl ::fidl_next::Method for Start {
2591 const ORDINAL: u64 = 780715659970866697;
2592
2593 type Protocol = crate::ComponentRunner;
2594
2595 type Request = crate::WireComponentRunnerStartRequest<'static>;
2596
2597 type Response = ::fidl_next::Never;
2598 }
2599}
2600
2601pub trait ComponentRunnerClientSender {
2603 type Transport: ::fidl_next::Transport;
2604
2605 #[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"]
2606 fn start<___R>(
2607 &self,
2608 request: ___R,
2609 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
2610 where
2611 ___R: ::fidl_next::Encode<
2612 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
2613 Encoded = crate::WireComponentRunnerStartRequest<'static>,
2614 >;
2615}
2616
2617impl<___T> ComponentRunnerClientSender for ::fidl_next::ClientSender<___T, ComponentRunner>
2618where
2619 ___T: ::fidl_next::Transport,
2620{
2621 type Transport = ___T;
2622
2623 #[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"]
2624 fn start<___R>(
2625 &self,
2626 request: ___R,
2627 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
2628 where
2629 ___R: ::fidl_next::Encode<
2630 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
2631 Encoded = crate::WireComponentRunnerStartRequest<'static>,
2632 >,
2633 {
2634 self.as_untyped().send_one_way(780715659970866697, request)
2635 }
2636}
2637
2638pub trait ComponentRunnerClientHandler<___T: ::fidl_next::Transport> {
2642 fn on_unknown_interaction(
2643 &mut self,
2644 sender: &::fidl_next::ClientSender<___T, ComponentRunner>,
2645 ordinal: u64,
2646 ) {
2647 sender.close();
2648 }
2649}
2650
2651impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for ComponentRunner
2652where
2653 ___T: ::fidl_next::Transport,
2654 ___H: ComponentRunnerClientHandler<___T>,
2655{
2656 fn on_event(
2657 handler: &mut ___H,
2658 sender: &::fidl_next::ClientSender<___T, Self>,
2659 ordinal: u64,
2660 buffer: ___T::RecvBuffer,
2661 ) {
2662 match ordinal {
2663 ordinal => handler.on_unknown_interaction(sender, ordinal),
2664 }
2665 }
2666}
2667
2668pub trait ComponentRunnerServerSender {
2670 type Transport: ::fidl_next::Transport;
2671}
2672
2673impl<___T> ComponentRunnerServerSender for ::fidl_next::ServerSender<___T, ComponentRunner>
2674where
2675 ___T: ::fidl_next::Transport,
2676{
2677 type Transport = ___T;
2678}
2679
2680pub trait ComponentRunnerServerHandler<___T: ::fidl_next::Transport> {
2684 #[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"]
2685 fn start(
2686 &mut self,
2687 sender: &::fidl_next::ServerSender<___T, ComponentRunner>,
2688
2689 request: ::fidl_next::Request<___T, component_runner::Start>,
2690 );
2691
2692 fn on_unknown_interaction(
2693 &mut self,
2694 sender: &::fidl_next::ServerSender<___T, ComponentRunner>,
2695 ordinal: u64,
2696 ) {
2697 sender.close();
2698 }
2699}
2700
2701impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for ComponentRunner
2702where
2703 ___T: ::fidl_next::Transport,
2704 ___H: ComponentRunnerServerHandler<___T>,
2705
2706 <component_runner::Start as ::fidl_next::Method>::Request:
2707 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
2708{
2709 fn on_one_way(
2710 handler: &mut ___H,
2711 sender: &::fidl_next::ServerSender<___T, Self>,
2712 ordinal: u64,
2713 buffer: ___T::RecvBuffer,
2714 ) {
2715 match ordinal {
2716 780715659970866697 => match ::fidl_next::DecoderExt::decode(buffer) {
2717 Ok(decoded) => handler.start(sender, decoded),
2718 Err(e) => {
2719 sender.close();
2720 }
2721 },
2722
2723 ordinal => handler.on_unknown_interaction(sender, ordinal),
2724 }
2725 }
2726
2727 fn on_two_way(
2728 handler: &mut ___H,
2729 sender: &::fidl_next::ServerSender<___T, Self>,
2730 ordinal: u64,
2731 buffer: ___T::RecvBuffer,
2732 responder: ::fidl_next::protocol::Responder,
2733 ) {
2734 match ordinal {
2735 ordinal => handler.on_unknown_interaction(sender, ordinal),
2736 }
2737 }
2738}
2739
2740#[derive(Debug)]
2741#[repr(C)]
2742pub struct TaskProviderGetJobResponse {
2743 pub job: ::fidl_next::fuchsia::zx::Handle,
2744}
2745
2746impl ::fidl_next::Encodable for TaskProviderGetJobResponse {
2747 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireTaskProviderGetJobResponse> = unsafe {
2748 ::fidl_next::CopyOptimization::enable_if(
2749 true && <::fidl_next::fuchsia::zx::Handle as ::fidl_next::Encodable>::COPY_OPTIMIZATION
2750 .is_enabled(),
2751 )
2752 };
2753
2754 type Encoded = WireTaskProviderGetJobResponse;
2755}
2756
2757unsafe impl<___E> ::fidl_next::Encode<___E> for TaskProviderGetJobResponse
2758where
2759 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2760
2761 ___E: ::fidl_next::fuchsia::HandleEncoder,
2762{
2763 #[inline]
2764 fn encode(
2765 self,
2766 encoder: &mut ___E,
2767 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
2768 ) -> Result<(), ::fidl_next::EncodeError> {
2769 ::fidl_next::munge! {
2770 let Self::Encoded {
2771 job,
2772
2773 } = out;
2774 }
2775
2776 ::fidl_next::Encode::encode(self.job, encoder, job)?;
2777
2778 Ok(())
2779 }
2780}
2781
2782impl ::fidl_next::EncodableOption for TaskProviderGetJobResponse {
2783 type EncodedOption = ::fidl_next::WireBox<'static, WireTaskProviderGetJobResponse>;
2784}
2785
2786unsafe impl<___E> ::fidl_next::EncodeOption<___E> for TaskProviderGetJobResponse
2787where
2788 ___E: ::fidl_next::Encoder + ?Sized,
2789 TaskProviderGetJobResponse: ::fidl_next::Encode<___E>,
2790{
2791 #[inline]
2792 fn encode_option(
2793 this: Option<Self>,
2794 encoder: &mut ___E,
2795 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
2796 ) -> Result<(), ::fidl_next::EncodeError> {
2797 if let Some(inner) = this {
2798 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2799 ::fidl_next::WireBox::encode_present(out);
2800 } else {
2801 ::fidl_next::WireBox::encode_absent(out);
2802 }
2803
2804 Ok(())
2805 }
2806}
2807
2808impl ::fidl_next::FromWire<WireTaskProviderGetJobResponse> for TaskProviderGetJobResponse {
2809 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireTaskProviderGetJobResponse, Self> = unsafe {
2810 ::fidl_next::CopyOptimization::enable_if(
2811 true && <::fidl_next::fuchsia::zx::Handle as ::fidl_next::FromWire<
2812 ::fidl_next::fuchsia::WireHandle,
2813 >>::COPY_OPTIMIZATION
2814 .is_enabled(),
2815 )
2816 };
2817
2818 #[inline]
2819 fn from_wire(wire: WireTaskProviderGetJobResponse) -> Self {
2820 Self { job: ::fidl_next::FromWire::from_wire(wire.job) }
2821 }
2822}
2823
2824#[derive(Debug)]
2826#[repr(C)]
2827pub struct WireTaskProviderGetJobResponse {
2828 pub job: ::fidl_next::fuchsia::WireHandle,
2829}
2830
2831unsafe impl ::fidl_next::Wire for WireTaskProviderGetJobResponse {
2832 type Decoded<'de> = WireTaskProviderGetJobResponse;
2833
2834 #[inline]
2835 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
2836}
2837
2838unsafe impl<___D> ::fidl_next::Decode<___D> for WireTaskProviderGetJobResponse
2839where
2840 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2841
2842 ___D: ::fidl_next::fuchsia::HandleDecoder,
2843{
2844 fn decode(
2845 slot: ::fidl_next::Slot<'_, Self>,
2846 decoder: &mut ___D,
2847 ) -> Result<(), ::fidl_next::DecodeError> {
2848 ::fidl_next::munge! {
2849 let Self {
2850 mut job,
2851
2852 } = slot;
2853 }
2854
2855 ::fidl_next::Decode::decode(job.as_mut(), decoder)?;
2856
2857 Ok(())
2858 }
2859}
2860
2861#[doc = " Served by runners that want to make a zircon job available through their runtime directory.\n"]
2863#[derive(Debug)]
2864pub struct TaskProvider;
2865
2866impl ::fidl_next::Discoverable for TaskProvider {
2867 const PROTOCOL_NAME: &'static str = "fuchsia.component.runner.TaskProvider";
2868}
2869
2870pub mod task_provider {
2871 pub mod prelude {
2872 pub use crate::{
2873 task_provider, TaskProvider, TaskProviderClientHandler, TaskProviderClientSender,
2874 TaskProviderServerHandler, TaskProviderServerSender,
2875 };
2876
2877 pub use crate::TaskProviderGetJobResponse;
2878 }
2879
2880 pub struct GetJob;
2881
2882 impl ::fidl_next::Method for GetJob {
2883 const ORDINAL: u64 = 5520468615388521389;
2884
2885 type Protocol = crate::TaskProvider;
2886
2887 type Request = ();
2888
2889 type Response = ::fidl_next::WireResult<
2890 'static,
2891 crate::WireTaskProviderGetJobResponse,
2892 ::fidl_next::WireI32,
2893 >;
2894 }
2895}
2896
2897pub trait TaskProviderClientSender {
2899 type Transport: ::fidl_next::Transport;
2900
2901 #[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"]
2902 fn get_job(
2903 &self,
2904 ) -> Result<
2905 ::fidl_next::ResponseFuture<'_, Self::Transport, task_provider::GetJob>,
2906 ::fidl_next::EncodeError,
2907 >;
2908}
2909
2910impl<___T> TaskProviderClientSender for ::fidl_next::ClientSender<___T, TaskProvider>
2911where
2912 ___T: ::fidl_next::Transport,
2913{
2914 type Transport = ___T;
2915
2916 #[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"]
2917 fn get_job(
2918 &self,
2919 ) -> Result<
2920 ::fidl_next::ResponseFuture<'_, Self::Transport, task_provider::GetJob>,
2921 ::fidl_next::EncodeError,
2922 > {
2923 self.as_untyped()
2924 .send_two_way(5520468615388521389, ())
2925 .map(::fidl_next::ResponseFuture::from_untyped)
2926 }
2927}
2928
2929pub trait TaskProviderClientHandler<___T: ::fidl_next::Transport> {
2933 fn on_unknown_interaction(
2934 &mut self,
2935 sender: &::fidl_next::ClientSender<___T, TaskProvider>,
2936 ordinal: u64,
2937 ) {
2938 sender.close();
2939 }
2940}
2941
2942impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for TaskProvider
2943where
2944 ___T: ::fidl_next::Transport,
2945 ___H: TaskProviderClientHandler<___T>,
2946
2947 <task_provider::GetJob as ::fidl_next::Method>::Response:
2948 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
2949{
2950 fn on_event(
2951 handler: &mut ___H,
2952 sender: &::fidl_next::ClientSender<___T, Self>,
2953 ordinal: u64,
2954 buffer: ___T::RecvBuffer,
2955 ) {
2956 match ordinal {
2957 ordinal => handler.on_unknown_interaction(sender, ordinal),
2958 }
2959 }
2960}
2961
2962pub trait TaskProviderServerSender {
2964 type Transport: ::fidl_next::Transport;
2965}
2966
2967impl<___T> TaskProviderServerSender for ::fidl_next::ServerSender<___T, TaskProvider>
2968where
2969 ___T: ::fidl_next::Transport,
2970{
2971 type Transport = ___T;
2972}
2973
2974pub trait TaskProviderServerHandler<___T: ::fidl_next::Transport> {
2978 #[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"]
2979 fn get_job(
2980 &mut self,
2981 sender: &::fidl_next::ServerSender<___T, TaskProvider>,
2982
2983 responder: ::fidl_next::Responder<task_provider::GetJob>,
2984 );
2985
2986 fn on_unknown_interaction(
2987 &mut self,
2988 sender: &::fidl_next::ServerSender<___T, TaskProvider>,
2989 ordinal: u64,
2990 ) {
2991 sender.close();
2992 }
2993}
2994
2995impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for TaskProvider
2996where
2997 ___T: ::fidl_next::Transport,
2998 ___H: TaskProviderServerHandler<___T>,
2999{
3000 fn on_one_way(
3001 handler: &mut ___H,
3002 sender: &::fidl_next::ServerSender<___T, Self>,
3003 ordinal: u64,
3004 buffer: ___T::RecvBuffer,
3005 ) {
3006 match ordinal {
3007 ordinal => handler.on_unknown_interaction(sender, ordinal),
3008 }
3009 }
3010
3011 fn on_two_way(
3012 handler: &mut ___H,
3013 sender: &::fidl_next::ServerSender<___T, Self>,
3014 ordinal: u64,
3015 buffer: ___T::RecvBuffer,
3016 responder: ::fidl_next::protocol::Responder,
3017 ) {
3018 match ordinal {
3019 5520468615388521389 => {
3020 let responder = ::fidl_next::Responder::from_untyped(responder);
3021
3022 handler.get_job(sender, responder);
3023 }
3024
3025 ordinal => handler.on_unknown_interaction(sender, ordinal),
3026 }
3027 }
3028}
3029
3030pub mod compat {
3032
3033 #[cfg(target_os = "fuchsia")]
3034 pub type ComponentControllerProxy =
3037 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::ComponentController>;
3038
3039 impl ::core::convert::From<crate::ComponentController>
3040 for ::fidl_fuchsia_component_runner::ComponentControllerMarker
3041 {
3042 #[inline]
3043 fn from(_: crate::ComponentController) -> Self {
3044 Self
3045 }
3046 }
3047
3048 #[cfg(target_os = "fuchsia")]
3049 pub type ComponentRunnerProxy =
3052 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::ComponentRunner>;
3053
3054 impl ::core::convert::From<crate::ComponentRunner>
3055 for ::fidl_fuchsia_component_runner::ComponentRunnerMarker
3056 {
3057 #[inline]
3058 fn from(_: crate::ComponentRunner) -> Self {
3059 Self
3060 }
3061 }
3062
3063 #[cfg(target_os = "fuchsia")]
3064 pub type TaskProviderProxy =
3067 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::TaskProvider>;
3068
3069 impl ::core::convert::From<crate::TaskProvider>
3070 for ::fidl_fuchsia_component_runner::TaskProviderMarker
3071 {
3072 #[inline]
3073 fn from(_: crate::TaskProvider) -> Self {
3074 Self
3075 }
3076 }
3077}