1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_cpu_profiler__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
17pub struct Config {
18 pub configs: Option<Vec<SamplingConfig>>,
19 pub target: Option<TargetConfig>,
20 #[doc(hidden)]
21 pub __source_breaking: fidl::marker::SourceBreaking,
22}
23
24impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Config {}
25
26#[derive(Debug, Default, PartialEq)]
27pub struct LaunchTest {
28 pub url: Option<String>,
30 pub options: Option<fidl_fuchsia_test_manager::RunSuiteOptions>,
32 #[doc(hidden)]
33 pub __source_breaking: fidl::marker::SourceBreaking,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchTest {}
37
38#[derive(Debug, Default, PartialEq)]
39pub struct SessionConfigureRequest {
40 pub output: Option<fidl::Socket>,
41 pub config: Option<Config>,
42 #[doc(hidden)]
43 pub __source_breaking: fidl::marker::SourceBreaking,
44}
45
46impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionConfigureRequest {}
47
48#[derive(Debug)]
50pub enum AttachConfig {
51 LaunchComponent(LaunchComponent),
54 AttachToComponentMoniker(String),
57 AttachToComponentUrl(String),
61 LaunchTest(LaunchTest),
65 #[doc(hidden)]
66 __SourceBreaking { unknown_ordinal: u64 },
67}
68
69#[macro_export]
71macro_rules! AttachConfigUnknown {
72 () => {
73 _
74 };
75}
76
77impl PartialEq for AttachConfig {
79 fn eq(&self, other: &Self) -> bool {
80 match (self, other) {
81 (Self::LaunchComponent(x), Self::LaunchComponent(y)) => *x == *y,
82 (Self::AttachToComponentMoniker(x), Self::AttachToComponentMoniker(y)) => *x == *y,
83 (Self::AttachToComponentUrl(x), Self::AttachToComponentUrl(y)) => *x == *y,
84 (Self::LaunchTest(x), Self::LaunchTest(y)) => *x == *y,
85 _ => false,
86 }
87 }
88}
89
90impl AttachConfig {
91 #[inline]
92 pub fn ordinal(&self) -> u64 {
93 match *self {
94 Self::LaunchComponent(_) => 1,
95 Self::AttachToComponentMoniker(_) => 2,
96 Self::AttachToComponentUrl(_) => 3,
97 Self::LaunchTest(_) => 4,
98 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
99 }
100 }
101
102 #[inline]
103 pub fn unknown_variant_for_testing() -> Self {
104 Self::__SourceBreaking { unknown_ordinal: 0 }
105 }
106
107 #[inline]
108 pub fn is_unknown(&self) -> bool {
109 match self {
110 Self::__SourceBreaking { .. } => true,
111 _ => false,
112 }
113 }
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AttachConfig {}
117
118#[derive(Debug)]
120pub enum TargetConfig {
121 Tasks(Vec<Task>),
123 Component(AttachConfig),
125 #[doc(hidden)]
126 __SourceBreaking { unknown_ordinal: u64 },
127}
128
129#[macro_export]
131macro_rules! TargetConfigUnknown {
132 () => {
133 _
134 };
135}
136
137impl PartialEq for TargetConfig {
139 fn eq(&self, other: &Self) -> bool {
140 match (self, other) {
141 (Self::Tasks(x), Self::Tasks(y)) => *x == *y,
142 (Self::Component(x), Self::Component(y)) => *x == *y,
143 _ => false,
144 }
145 }
146}
147
148impl TargetConfig {
149 #[inline]
150 pub fn ordinal(&self) -> u64 {
151 match *self {
152 Self::Tasks(_) => 1,
153 Self::Component(_) => 2,
154 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
155 }
156 }
157
158 #[inline]
159 pub fn unknown_variant_for_testing() -> Self {
160 Self::__SourceBreaking { unknown_ordinal: 0 }
161 }
162
163 #[inline]
164 pub fn is_unknown(&self) -> bool {
165 match self {
166 Self::__SourceBreaking { .. } => true,
167 _ => false,
168 }
169 }
170}
171
172impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TargetConfig {}
173
174#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
175pub struct SessionMarker;
176
177impl fidl::endpoints::ProtocolMarker for SessionMarker {
178 type Proxy = SessionProxy;
179 type RequestStream = SessionRequestStream;
180 #[cfg(target_os = "fuchsia")]
181 type SynchronousProxy = SessionSynchronousProxy;
182
183 const DEBUG_NAME: &'static str = "fuchsia.cpu.profiler.Session";
184}
185impl fidl::endpoints::DiscoverableProtocolMarker for SessionMarker {}
186pub type SessionConfigureResult = Result<(), SessionConfigureError>;
187pub type SessionStartResult = Result<(), SessionStartError>;
188
189pub trait SessionProxyInterface: Send + Sync {
190 type ConfigureResponseFut: std::future::Future<Output = Result<SessionConfigureResult, fidl::Error>>
191 + Send;
192 fn r#configure(&self, payload: SessionConfigureRequest) -> Self::ConfigureResponseFut;
193 type StartResponseFut: std::future::Future<Output = Result<SessionStartResult, fidl::Error>>
194 + Send;
195 fn r#start(&self, payload: &SessionStartRequest) -> Self::StartResponseFut;
196 type StopResponseFut: std::future::Future<Output = Result<SessionStopResponse, fidl::Error>>
197 + Send;
198 fn r#stop(&self) -> Self::StopResponseFut;
199 type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
200 fn r#reset(&self) -> Self::ResetResponseFut;
201}
202#[derive(Debug)]
203#[cfg(target_os = "fuchsia")]
204pub struct SessionSynchronousProxy {
205 client: fidl::client::sync::Client,
206}
207
208#[cfg(target_os = "fuchsia")]
209impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
210 type Proxy = SessionProxy;
211 type Protocol = SessionMarker;
212
213 fn from_channel(inner: fidl::Channel) -> Self {
214 Self::new(inner)
215 }
216
217 fn into_channel(self) -> fidl::Channel {
218 self.client.into_channel()
219 }
220
221 fn as_channel(&self) -> &fidl::Channel {
222 self.client.as_channel()
223 }
224}
225
226#[cfg(target_os = "fuchsia")]
227impl SessionSynchronousProxy {
228 pub fn new(channel: fidl::Channel) -> Self {
229 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
230 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
231 }
232
233 pub fn into_channel(self) -> fidl::Channel {
234 self.client.into_channel()
235 }
236
237 pub fn wait_for_event(
240 &self,
241 deadline: zx::MonotonicInstant,
242 ) -> Result<SessionEvent, fidl::Error> {
243 SessionEvent::decode(self.client.wait_for_event(deadline)?)
244 }
245
246 pub fn r#configure(
248 &self,
249 mut payload: SessionConfigureRequest,
250 ___deadline: zx::MonotonicInstant,
251 ) -> Result<SessionConfigureResult, fidl::Error> {
252 let _response =
253 self.client.send_query::<SessionConfigureRequest, fidl::encoding::ResultType<
254 fidl::encoding::EmptyStruct,
255 SessionConfigureError,
256 >>(
257 &mut payload,
258 0x67e7e28a9b959ce8,
259 fidl::encoding::DynamicFlags::empty(),
260 ___deadline,
261 )?;
262 Ok(_response.map(|x| x))
263 }
264
265 pub fn r#start(
268 &self,
269 mut payload: &SessionStartRequest,
270 ___deadline: zx::MonotonicInstant,
271 ) -> Result<SessionStartResult, fidl::Error> {
272 let _response = self.client.send_query::<SessionStartRequest, fidl::encoding::ResultType<
273 fidl::encoding::EmptyStruct,
274 SessionStartError,
275 >>(
276 payload,
277 0x4e82f9133a968ad5,
278 fidl::encoding::DynamicFlags::empty(),
279 ___deadline,
280 )?;
281 Ok(_response.map(|x| x))
282 }
283
284 pub fn r#stop(
287 &self,
288 ___deadline: zx::MonotonicInstant,
289 ) -> Result<SessionStopResponse, fidl::Error> {
290 let _response =
291 self.client.send_query::<fidl::encoding::EmptyPayload, SessionStopResponse>(
292 (),
293 0x76aa8dd59cb61e89,
294 fidl::encoding::DynamicFlags::empty(),
295 ___deadline,
296 )?;
297 Ok(_response)
298 }
299
300 pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
304 let _response =
305 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
306 (),
307 0x5f522fde537356fa,
308 fidl::encoding::DynamicFlags::empty(),
309 ___deadline,
310 )?;
311 Ok(_response)
312 }
313}
314
315#[cfg(target_os = "fuchsia")]
316impl From<SessionSynchronousProxy> for zx::Handle {
317 fn from(value: SessionSynchronousProxy) -> Self {
318 value.into_channel().into()
319 }
320}
321
322#[cfg(target_os = "fuchsia")]
323impl From<fidl::Channel> for SessionSynchronousProxy {
324 fn from(value: fidl::Channel) -> Self {
325 Self::new(value)
326 }
327}
328
329#[cfg(target_os = "fuchsia")]
330impl fidl::endpoints::FromClient for SessionSynchronousProxy {
331 type Protocol = SessionMarker;
332
333 fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
334 Self::new(value.into_channel())
335 }
336}
337
338#[derive(Debug, Clone)]
339pub struct SessionProxy {
340 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
341}
342
343impl fidl::endpoints::Proxy for SessionProxy {
344 type Protocol = SessionMarker;
345
346 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
347 Self::new(inner)
348 }
349
350 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
351 self.client.into_channel().map_err(|client| Self { client })
352 }
353
354 fn as_channel(&self) -> &::fidl::AsyncChannel {
355 self.client.as_channel()
356 }
357}
358
359impl SessionProxy {
360 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
362 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
363 Self { client: fidl::client::Client::new(channel, protocol_name) }
364 }
365
366 pub fn take_event_stream(&self) -> SessionEventStream {
372 SessionEventStream { event_receiver: self.client.take_event_receiver() }
373 }
374
375 pub fn r#configure(
377 &self,
378 mut payload: SessionConfigureRequest,
379 ) -> fidl::client::QueryResponseFut<
380 SessionConfigureResult,
381 fidl::encoding::DefaultFuchsiaResourceDialect,
382 > {
383 SessionProxyInterface::r#configure(self, payload)
384 }
385
386 pub fn r#start(
389 &self,
390 mut payload: &SessionStartRequest,
391 ) -> fidl::client::QueryResponseFut<
392 SessionStartResult,
393 fidl::encoding::DefaultFuchsiaResourceDialect,
394 > {
395 SessionProxyInterface::r#start(self, payload)
396 }
397
398 pub fn r#stop(
401 &self,
402 ) -> fidl::client::QueryResponseFut<
403 SessionStopResponse,
404 fidl::encoding::DefaultFuchsiaResourceDialect,
405 > {
406 SessionProxyInterface::r#stop(self)
407 }
408
409 pub fn r#reset(
413 &self,
414 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
415 SessionProxyInterface::r#reset(self)
416 }
417}
418
419impl SessionProxyInterface for SessionProxy {
420 type ConfigureResponseFut = fidl::client::QueryResponseFut<
421 SessionConfigureResult,
422 fidl::encoding::DefaultFuchsiaResourceDialect,
423 >;
424 fn r#configure(&self, mut payload: SessionConfigureRequest) -> Self::ConfigureResponseFut {
425 fn _decode(
426 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
427 ) -> Result<SessionConfigureResult, fidl::Error> {
428 let _response = fidl::client::decode_transaction_body::<
429 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SessionConfigureError>,
430 fidl::encoding::DefaultFuchsiaResourceDialect,
431 0x67e7e28a9b959ce8,
432 >(_buf?)?;
433 Ok(_response.map(|x| x))
434 }
435 self.client.send_query_and_decode::<SessionConfigureRequest, SessionConfigureResult>(
436 &mut payload,
437 0x67e7e28a9b959ce8,
438 fidl::encoding::DynamicFlags::empty(),
439 _decode,
440 )
441 }
442
443 type StartResponseFut = fidl::client::QueryResponseFut<
444 SessionStartResult,
445 fidl::encoding::DefaultFuchsiaResourceDialect,
446 >;
447 fn r#start(&self, mut payload: &SessionStartRequest) -> Self::StartResponseFut {
448 fn _decode(
449 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
450 ) -> Result<SessionStartResult, fidl::Error> {
451 let _response = fidl::client::decode_transaction_body::<
452 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SessionStartError>,
453 fidl::encoding::DefaultFuchsiaResourceDialect,
454 0x4e82f9133a968ad5,
455 >(_buf?)?;
456 Ok(_response.map(|x| x))
457 }
458 self.client.send_query_and_decode::<SessionStartRequest, SessionStartResult>(
459 payload,
460 0x4e82f9133a968ad5,
461 fidl::encoding::DynamicFlags::empty(),
462 _decode,
463 )
464 }
465
466 type StopResponseFut = fidl::client::QueryResponseFut<
467 SessionStopResponse,
468 fidl::encoding::DefaultFuchsiaResourceDialect,
469 >;
470 fn r#stop(&self) -> Self::StopResponseFut {
471 fn _decode(
472 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
473 ) -> Result<SessionStopResponse, fidl::Error> {
474 let _response = fidl::client::decode_transaction_body::<
475 SessionStopResponse,
476 fidl::encoding::DefaultFuchsiaResourceDialect,
477 0x76aa8dd59cb61e89,
478 >(_buf?)?;
479 Ok(_response)
480 }
481 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionStopResponse>(
482 (),
483 0x76aa8dd59cb61e89,
484 fidl::encoding::DynamicFlags::empty(),
485 _decode,
486 )
487 }
488
489 type ResetResponseFut =
490 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
491 fn r#reset(&self) -> Self::ResetResponseFut {
492 fn _decode(
493 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
494 ) -> Result<(), fidl::Error> {
495 let _response = fidl::client::decode_transaction_body::<
496 fidl::encoding::EmptyPayload,
497 fidl::encoding::DefaultFuchsiaResourceDialect,
498 0x5f522fde537356fa,
499 >(_buf?)?;
500 Ok(_response)
501 }
502 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
503 (),
504 0x5f522fde537356fa,
505 fidl::encoding::DynamicFlags::empty(),
506 _decode,
507 )
508 }
509}
510
511pub struct SessionEventStream {
512 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
513}
514
515impl std::marker::Unpin for SessionEventStream {}
516
517impl futures::stream::FusedStream for SessionEventStream {
518 fn is_terminated(&self) -> bool {
519 self.event_receiver.is_terminated()
520 }
521}
522
523impl futures::Stream for SessionEventStream {
524 type Item = Result<SessionEvent, fidl::Error>;
525
526 fn poll_next(
527 mut self: std::pin::Pin<&mut Self>,
528 cx: &mut std::task::Context<'_>,
529 ) -> std::task::Poll<Option<Self::Item>> {
530 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
531 &mut self.event_receiver,
532 cx
533 )?) {
534 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
535 None => std::task::Poll::Ready(None),
536 }
537 }
538}
539
540#[derive(Debug)]
541pub enum SessionEvent {}
542
543impl SessionEvent {
544 fn decode(
546 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
547 ) -> Result<SessionEvent, fidl::Error> {
548 let (bytes, _handles) = buf.split_mut();
549 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
550 debug_assert_eq!(tx_header.tx_id, 0);
551 match tx_header.ordinal {
552 _ => Err(fidl::Error::UnknownOrdinal {
553 ordinal: tx_header.ordinal,
554 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
555 }),
556 }
557 }
558}
559
560pub struct SessionRequestStream {
562 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
563 is_terminated: bool,
564}
565
566impl std::marker::Unpin for SessionRequestStream {}
567
568impl futures::stream::FusedStream for SessionRequestStream {
569 fn is_terminated(&self) -> bool {
570 self.is_terminated
571 }
572}
573
574impl fidl::endpoints::RequestStream for SessionRequestStream {
575 type Protocol = SessionMarker;
576 type ControlHandle = SessionControlHandle;
577
578 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
579 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
580 }
581
582 fn control_handle(&self) -> Self::ControlHandle {
583 SessionControlHandle { inner: self.inner.clone() }
584 }
585
586 fn into_inner(
587 self,
588 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
589 {
590 (self.inner, self.is_terminated)
591 }
592
593 fn from_inner(
594 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
595 is_terminated: bool,
596 ) -> Self {
597 Self { inner, is_terminated }
598 }
599}
600
601impl futures::Stream for SessionRequestStream {
602 type Item = Result<SessionRequest, fidl::Error>;
603
604 fn poll_next(
605 mut self: std::pin::Pin<&mut Self>,
606 cx: &mut std::task::Context<'_>,
607 ) -> std::task::Poll<Option<Self::Item>> {
608 let this = &mut *self;
609 if this.inner.check_shutdown(cx) {
610 this.is_terminated = true;
611 return std::task::Poll::Ready(None);
612 }
613 if this.is_terminated {
614 panic!("polled SessionRequestStream after completion");
615 }
616 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
617 |bytes, handles| {
618 match this.inner.channel().read_etc(cx, bytes, handles) {
619 std::task::Poll::Ready(Ok(())) => {}
620 std::task::Poll::Pending => return std::task::Poll::Pending,
621 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
622 this.is_terminated = true;
623 return std::task::Poll::Ready(None);
624 }
625 std::task::Poll::Ready(Err(e)) => {
626 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
627 e.into(),
628 ))))
629 }
630 }
631
632 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
634
635 std::task::Poll::Ready(Some(match header.ordinal {
636 0x67e7e28a9b959ce8 => {
637 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
638 let mut req = fidl::new_empty!(
639 SessionConfigureRequest,
640 fidl::encoding::DefaultFuchsiaResourceDialect
641 );
642 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionConfigureRequest>(&header, _body_bytes, handles, &mut req)?;
643 let control_handle = SessionControlHandle { inner: this.inner.clone() };
644 Ok(SessionRequest::Configure {
645 payload: req,
646 responder: SessionConfigureResponder {
647 control_handle: std::mem::ManuallyDrop::new(control_handle),
648 tx_id: header.tx_id,
649 },
650 })
651 }
652 0x4e82f9133a968ad5 => {
653 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
654 let mut req = fidl::new_empty!(
655 SessionStartRequest,
656 fidl::encoding::DefaultFuchsiaResourceDialect
657 );
658 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionStartRequest>(&header, _body_bytes, handles, &mut req)?;
659 let control_handle = SessionControlHandle { inner: this.inner.clone() };
660 Ok(SessionRequest::Start {
661 payload: req,
662 responder: SessionStartResponder {
663 control_handle: std::mem::ManuallyDrop::new(control_handle),
664 tx_id: header.tx_id,
665 },
666 })
667 }
668 0x76aa8dd59cb61e89 => {
669 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
670 let mut req = fidl::new_empty!(
671 fidl::encoding::EmptyPayload,
672 fidl::encoding::DefaultFuchsiaResourceDialect
673 );
674 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
675 let control_handle = SessionControlHandle { inner: this.inner.clone() };
676 Ok(SessionRequest::Stop {
677 responder: SessionStopResponder {
678 control_handle: std::mem::ManuallyDrop::new(control_handle),
679 tx_id: header.tx_id,
680 },
681 })
682 }
683 0x5f522fde537356fa => {
684 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
685 let mut req = fidl::new_empty!(
686 fidl::encoding::EmptyPayload,
687 fidl::encoding::DefaultFuchsiaResourceDialect
688 );
689 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
690 let control_handle = SessionControlHandle { inner: this.inner.clone() };
691 Ok(SessionRequest::Reset {
692 responder: SessionResetResponder {
693 control_handle: std::mem::ManuallyDrop::new(control_handle),
694 tx_id: header.tx_id,
695 },
696 })
697 }
698 _ => Err(fidl::Error::UnknownOrdinal {
699 ordinal: header.ordinal,
700 protocol_name:
701 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
702 }),
703 }))
704 },
705 )
706 }
707}
708
709#[derive(Debug)]
710pub enum SessionRequest {
711 Configure { payload: SessionConfigureRequest, responder: SessionConfigureResponder },
713 Start { payload: SessionStartRequest, responder: SessionStartResponder },
716 Stop { responder: SessionStopResponder },
719 Reset { responder: SessionResetResponder },
723}
724
725impl SessionRequest {
726 #[allow(irrefutable_let_patterns)]
727 pub fn into_configure(self) -> Option<(SessionConfigureRequest, SessionConfigureResponder)> {
728 if let SessionRequest::Configure { payload, responder } = self {
729 Some((payload, responder))
730 } else {
731 None
732 }
733 }
734
735 #[allow(irrefutable_let_patterns)]
736 pub fn into_start(self) -> Option<(SessionStartRequest, SessionStartResponder)> {
737 if let SessionRequest::Start { payload, responder } = self {
738 Some((payload, responder))
739 } else {
740 None
741 }
742 }
743
744 #[allow(irrefutable_let_patterns)]
745 pub fn into_stop(self) -> Option<(SessionStopResponder)> {
746 if let SessionRequest::Stop { responder } = self {
747 Some((responder))
748 } else {
749 None
750 }
751 }
752
753 #[allow(irrefutable_let_patterns)]
754 pub fn into_reset(self) -> Option<(SessionResetResponder)> {
755 if let SessionRequest::Reset { responder } = self {
756 Some((responder))
757 } else {
758 None
759 }
760 }
761
762 pub fn method_name(&self) -> &'static str {
764 match *self {
765 SessionRequest::Configure { .. } => "configure",
766 SessionRequest::Start { .. } => "start",
767 SessionRequest::Stop { .. } => "stop",
768 SessionRequest::Reset { .. } => "reset",
769 }
770 }
771}
772
773#[derive(Debug, Clone)]
774pub struct SessionControlHandle {
775 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
776}
777
778impl fidl::endpoints::ControlHandle for SessionControlHandle {
779 fn shutdown(&self) {
780 self.inner.shutdown()
781 }
782 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
783 self.inner.shutdown_with_epitaph(status)
784 }
785
786 fn is_closed(&self) -> bool {
787 self.inner.channel().is_closed()
788 }
789 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
790 self.inner.channel().on_closed()
791 }
792
793 #[cfg(target_os = "fuchsia")]
794 fn signal_peer(
795 &self,
796 clear_mask: zx::Signals,
797 set_mask: zx::Signals,
798 ) -> Result<(), zx_status::Status> {
799 use fidl::Peered;
800 self.inner.channel().signal_peer(clear_mask, set_mask)
801 }
802}
803
804impl SessionControlHandle {}
805
806#[must_use = "FIDL methods require a response to be sent"]
807#[derive(Debug)]
808pub struct SessionConfigureResponder {
809 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
810 tx_id: u32,
811}
812
813impl std::ops::Drop for SessionConfigureResponder {
817 fn drop(&mut self) {
818 self.control_handle.shutdown();
819 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
821 }
822}
823
824impl fidl::endpoints::Responder for SessionConfigureResponder {
825 type ControlHandle = SessionControlHandle;
826
827 fn control_handle(&self) -> &SessionControlHandle {
828 &self.control_handle
829 }
830
831 fn drop_without_shutdown(mut self) {
832 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
834 std::mem::forget(self);
836 }
837}
838
839impl SessionConfigureResponder {
840 pub fn send(self, mut result: Result<(), SessionConfigureError>) -> Result<(), fidl::Error> {
844 let _result = self.send_raw(result);
845 if _result.is_err() {
846 self.control_handle.shutdown();
847 }
848 self.drop_without_shutdown();
849 _result
850 }
851
852 pub fn send_no_shutdown_on_err(
854 self,
855 mut result: Result<(), SessionConfigureError>,
856 ) -> Result<(), fidl::Error> {
857 let _result = self.send_raw(result);
858 self.drop_without_shutdown();
859 _result
860 }
861
862 fn send_raw(&self, mut result: Result<(), SessionConfigureError>) -> Result<(), fidl::Error> {
863 self.control_handle.inner.send::<fidl::encoding::ResultType<
864 fidl::encoding::EmptyStruct,
865 SessionConfigureError,
866 >>(
867 result,
868 self.tx_id,
869 0x67e7e28a9b959ce8,
870 fidl::encoding::DynamicFlags::empty(),
871 )
872 }
873}
874
875#[must_use = "FIDL methods require a response to be sent"]
876#[derive(Debug)]
877pub struct SessionStartResponder {
878 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
879 tx_id: u32,
880}
881
882impl std::ops::Drop for SessionStartResponder {
886 fn drop(&mut self) {
887 self.control_handle.shutdown();
888 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
890 }
891}
892
893impl fidl::endpoints::Responder for SessionStartResponder {
894 type ControlHandle = SessionControlHandle;
895
896 fn control_handle(&self) -> &SessionControlHandle {
897 &self.control_handle
898 }
899
900 fn drop_without_shutdown(mut self) {
901 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
903 std::mem::forget(self);
905 }
906}
907
908impl SessionStartResponder {
909 pub fn send(self, mut result: Result<(), SessionStartError>) -> Result<(), fidl::Error> {
913 let _result = self.send_raw(result);
914 if _result.is_err() {
915 self.control_handle.shutdown();
916 }
917 self.drop_without_shutdown();
918 _result
919 }
920
921 pub fn send_no_shutdown_on_err(
923 self,
924 mut result: Result<(), SessionStartError>,
925 ) -> Result<(), fidl::Error> {
926 let _result = self.send_raw(result);
927 self.drop_without_shutdown();
928 _result
929 }
930
931 fn send_raw(&self, mut result: Result<(), SessionStartError>) -> Result<(), fidl::Error> {
932 self.control_handle.inner.send::<fidl::encoding::ResultType<
933 fidl::encoding::EmptyStruct,
934 SessionStartError,
935 >>(
936 result,
937 self.tx_id,
938 0x4e82f9133a968ad5,
939 fidl::encoding::DynamicFlags::empty(),
940 )
941 }
942}
943
944#[must_use = "FIDL methods require a response to be sent"]
945#[derive(Debug)]
946pub struct SessionStopResponder {
947 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
948 tx_id: u32,
949}
950
951impl std::ops::Drop for SessionStopResponder {
955 fn drop(&mut self) {
956 self.control_handle.shutdown();
957 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
959 }
960}
961
962impl fidl::endpoints::Responder for SessionStopResponder {
963 type ControlHandle = SessionControlHandle;
964
965 fn control_handle(&self) -> &SessionControlHandle {
966 &self.control_handle
967 }
968
969 fn drop_without_shutdown(mut self) {
970 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
972 std::mem::forget(self);
974 }
975}
976
977impl SessionStopResponder {
978 pub fn send(self, mut payload: &SessionStopResponse) -> Result<(), fidl::Error> {
982 let _result = self.send_raw(payload);
983 if _result.is_err() {
984 self.control_handle.shutdown();
985 }
986 self.drop_without_shutdown();
987 _result
988 }
989
990 pub fn send_no_shutdown_on_err(
992 self,
993 mut payload: &SessionStopResponse,
994 ) -> Result<(), fidl::Error> {
995 let _result = self.send_raw(payload);
996 self.drop_without_shutdown();
997 _result
998 }
999
1000 fn send_raw(&self, mut payload: &SessionStopResponse) -> Result<(), fidl::Error> {
1001 self.control_handle.inner.send::<SessionStopResponse>(
1002 payload,
1003 self.tx_id,
1004 0x76aa8dd59cb61e89,
1005 fidl::encoding::DynamicFlags::empty(),
1006 )
1007 }
1008}
1009
1010#[must_use = "FIDL methods require a response to be sent"]
1011#[derive(Debug)]
1012pub struct SessionResetResponder {
1013 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1014 tx_id: u32,
1015}
1016
1017impl std::ops::Drop for SessionResetResponder {
1021 fn drop(&mut self) {
1022 self.control_handle.shutdown();
1023 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025 }
1026}
1027
1028impl fidl::endpoints::Responder for SessionResetResponder {
1029 type ControlHandle = SessionControlHandle;
1030
1031 fn control_handle(&self) -> &SessionControlHandle {
1032 &self.control_handle
1033 }
1034
1035 fn drop_without_shutdown(mut self) {
1036 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1038 std::mem::forget(self);
1040 }
1041}
1042
1043impl SessionResetResponder {
1044 pub fn send(self) -> Result<(), fidl::Error> {
1048 let _result = self.send_raw();
1049 if _result.is_err() {
1050 self.control_handle.shutdown();
1051 }
1052 self.drop_without_shutdown();
1053 _result
1054 }
1055
1056 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1058 let _result = self.send_raw();
1059 self.drop_without_shutdown();
1060 _result
1061 }
1062
1063 fn send_raw(&self) -> Result<(), fidl::Error> {
1064 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1065 (),
1066 self.tx_id,
1067 0x5f522fde537356fa,
1068 fidl::encoding::DynamicFlags::empty(),
1069 )
1070 }
1071}
1072
1073mod internal {
1074 use super::*;
1075
1076 impl Config {
1077 #[inline(always)]
1078 fn max_ordinal_present(&self) -> u64 {
1079 if let Some(_) = self.target {
1080 return 2;
1081 }
1082 if let Some(_) = self.configs {
1083 return 1;
1084 }
1085 0
1086 }
1087 }
1088
1089 impl fidl::encoding::ResourceTypeMarker for Config {
1090 type Borrowed<'a> = &'a mut Self;
1091 fn take_or_borrow<'a>(
1092 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1093 ) -> Self::Borrowed<'a> {
1094 value
1095 }
1096 }
1097
1098 unsafe impl fidl::encoding::TypeMarker for Config {
1099 type Owned = Self;
1100
1101 #[inline(always)]
1102 fn inline_align(_context: fidl::encoding::Context) -> usize {
1103 8
1104 }
1105
1106 #[inline(always)]
1107 fn inline_size(_context: fidl::encoding::Context) -> usize {
1108 16
1109 }
1110 }
1111
1112 unsafe impl fidl::encoding::Encode<Config, fidl::encoding::DefaultFuchsiaResourceDialect>
1113 for &mut Config
1114 {
1115 unsafe fn encode(
1116 self,
1117 encoder: &mut fidl::encoding::Encoder<
1118 '_,
1119 fidl::encoding::DefaultFuchsiaResourceDialect,
1120 >,
1121 offset: usize,
1122 mut depth: fidl::encoding::Depth,
1123 ) -> fidl::Result<()> {
1124 encoder.debug_check_bounds::<Config>(offset);
1125 let max_ordinal: u64 = self.max_ordinal_present();
1127 encoder.write_num(max_ordinal, offset);
1128 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1129 if max_ordinal == 0 {
1131 return Ok(());
1132 }
1133 depth.increment()?;
1134 let envelope_size = 8;
1135 let bytes_len = max_ordinal as usize * envelope_size;
1136 #[allow(unused_variables)]
1137 let offset = encoder.out_of_line_offset(bytes_len);
1138 let mut _prev_end_offset: usize = 0;
1139 if 1 > max_ordinal {
1140 return Ok(());
1141 }
1142
1143 let cur_offset: usize = (1 - 1) * envelope_size;
1146
1147 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1149
1150 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1155 self.configs.as_ref().map(<fidl::encoding::Vector<SamplingConfig, 64> as fidl::encoding::ValueTypeMarker>::borrow),
1156 encoder, offset + cur_offset, depth
1157 )?;
1158
1159 _prev_end_offset = cur_offset + envelope_size;
1160 if 2 > max_ordinal {
1161 return Ok(());
1162 }
1163
1164 let cur_offset: usize = (2 - 1) * envelope_size;
1167
1168 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1170
1171 fidl::encoding::encode_in_envelope_optional::<
1176 TargetConfig,
1177 fidl::encoding::DefaultFuchsiaResourceDialect,
1178 >(
1179 self.target
1180 .as_mut()
1181 .map(<TargetConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1182 encoder,
1183 offset + cur_offset,
1184 depth,
1185 )?;
1186
1187 _prev_end_offset = cur_offset + envelope_size;
1188
1189 Ok(())
1190 }
1191 }
1192
1193 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Config {
1194 #[inline(always)]
1195 fn new_empty() -> Self {
1196 Self::default()
1197 }
1198
1199 unsafe fn decode(
1200 &mut self,
1201 decoder: &mut fidl::encoding::Decoder<
1202 '_,
1203 fidl::encoding::DefaultFuchsiaResourceDialect,
1204 >,
1205 offset: usize,
1206 mut depth: fidl::encoding::Depth,
1207 ) -> fidl::Result<()> {
1208 decoder.debug_check_bounds::<Self>(offset);
1209 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1210 None => return Err(fidl::Error::NotNullable),
1211 Some(len) => len,
1212 };
1213 if len == 0 {
1215 return Ok(());
1216 };
1217 depth.increment()?;
1218 let envelope_size = 8;
1219 let bytes_len = len * envelope_size;
1220 let offset = decoder.out_of_line_offset(bytes_len)?;
1221 let mut _next_ordinal_to_read = 0;
1223 let mut next_offset = offset;
1224 let end_offset = offset + bytes_len;
1225 _next_ordinal_to_read += 1;
1226 if next_offset >= end_offset {
1227 return Ok(());
1228 }
1229
1230 while _next_ordinal_to_read < 1 {
1232 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1233 _next_ordinal_to_read += 1;
1234 next_offset += envelope_size;
1235 }
1236
1237 let next_out_of_line = decoder.next_out_of_line();
1238 let handles_before = decoder.remaining_handles();
1239 if let Some((inlined, num_bytes, num_handles)) =
1240 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1241 {
1242 let member_inline_size = <fidl::encoding::Vector<SamplingConfig, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1243 if inlined != (member_inline_size <= 4) {
1244 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1245 }
1246 let inner_offset;
1247 let mut inner_depth = depth.clone();
1248 if inlined {
1249 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1250 inner_offset = next_offset;
1251 } else {
1252 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1253 inner_depth.increment()?;
1254 }
1255 let val_ref =
1256 self.configs.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
1257 fidl::decode!(fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1258 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1259 {
1260 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1261 }
1262 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1263 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1264 }
1265 }
1266
1267 next_offset += envelope_size;
1268 _next_ordinal_to_read += 1;
1269 if next_offset >= end_offset {
1270 return Ok(());
1271 }
1272
1273 while _next_ordinal_to_read < 2 {
1275 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1276 _next_ordinal_to_read += 1;
1277 next_offset += envelope_size;
1278 }
1279
1280 let next_out_of_line = decoder.next_out_of_line();
1281 let handles_before = decoder.remaining_handles();
1282 if let Some((inlined, num_bytes, num_handles)) =
1283 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1284 {
1285 let member_inline_size =
1286 <TargetConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1287 if inlined != (member_inline_size <= 4) {
1288 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1289 }
1290 let inner_offset;
1291 let mut inner_depth = depth.clone();
1292 if inlined {
1293 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1294 inner_offset = next_offset;
1295 } else {
1296 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1297 inner_depth.increment()?;
1298 }
1299 let val_ref = self.target.get_or_insert_with(|| {
1300 fidl::new_empty!(TargetConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
1301 });
1302 fidl::decode!(
1303 TargetConfig,
1304 fidl::encoding::DefaultFuchsiaResourceDialect,
1305 val_ref,
1306 decoder,
1307 inner_offset,
1308 inner_depth
1309 )?;
1310 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1311 {
1312 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1313 }
1314 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1315 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1316 }
1317 }
1318
1319 next_offset += envelope_size;
1320
1321 while next_offset < end_offset {
1323 _next_ordinal_to_read += 1;
1324 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1325 next_offset += envelope_size;
1326 }
1327
1328 Ok(())
1329 }
1330 }
1331
1332 impl LaunchTest {
1333 #[inline(always)]
1334 fn max_ordinal_present(&self) -> u64 {
1335 if let Some(_) = self.options {
1336 return 2;
1337 }
1338 if let Some(_) = self.url {
1339 return 1;
1340 }
1341 0
1342 }
1343 }
1344
1345 impl fidl::encoding::ResourceTypeMarker for LaunchTest {
1346 type Borrowed<'a> = &'a mut Self;
1347 fn take_or_borrow<'a>(
1348 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1349 ) -> Self::Borrowed<'a> {
1350 value
1351 }
1352 }
1353
1354 unsafe impl fidl::encoding::TypeMarker for LaunchTest {
1355 type Owned = Self;
1356
1357 #[inline(always)]
1358 fn inline_align(_context: fidl::encoding::Context) -> usize {
1359 8
1360 }
1361
1362 #[inline(always)]
1363 fn inline_size(_context: fidl::encoding::Context) -> usize {
1364 16
1365 }
1366 }
1367
1368 unsafe impl fidl::encoding::Encode<LaunchTest, fidl::encoding::DefaultFuchsiaResourceDialect>
1369 for &mut LaunchTest
1370 {
1371 unsafe fn encode(
1372 self,
1373 encoder: &mut fidl::encoding::Encoder<
1374 '_,
1375 fidl::encoding::DefaultFuchsiaResourceDialect,
1376 >,
1377 offset: usize,
1378 mut depth: fidl::encoding::Depth,
1379 ) -> fidl::Result<()> {
1380 encoder.debug_check_bounds::<LaunchTest>(offset);
1381 let max_ordinal: u64 = self.max_ordinal_present();
1383 encoder.write_num(max_ordinal, offset);
1384 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1385 if max_ordinal == 0 {
1387 return Ok(());
1388 }
1389 depth.increment()?;
1390 let envelope_size = 8;
1391 let bytes_len = max_ordinal as usize * envelope_size;
1392 #[allow(unused_variables)]
1393 let offset = encoder.out_of_line_offset(bytes_len);
1394 let mut _prev_end_offset: usize = 0;
1395 if 1 > max_ordinal {
1396 return Ok(());
1397 }
1398
1399 let cur_offset: usize = (1 - 1) * envelope_size;
1402
1403 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1405
1406 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1411 self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
1412 encoder, offset + cur_offset, depth
1413 )?;
1414
1415 _prev_end_offset = cur_offset + envelope_size;
1416 if 2 > max_ordinal {
1417 return Ok(());
1418 }
1419
1420 let cur_offset: usize = (2 - 1) * envelope_size;
1423
1424 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1426
1427 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_test_manager::RunSuiteOptions, fidl::encoding::DefaultFuchsiaResourceDialect>(
1432 self.options.as_mut().map(<fidl_fuchsia_test_manager::RunSuiteOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1433 encoder, offset + cur_offset, depth
1434 )?;
1435
1436 _prev_end_offset = cur_offset + envelope_size;
1437
1438 Ok(())
1439 }
1440 }
1441
1442 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchTest {
1443 #[inline(always)]
1444 fn new_empty() -> Self {
1445 Self::default()
1446 }
1447
1448 unsafe fn decode(
1449 &mut self,
1450 decoder: &mut fidl::encoding::Decoder<
1451 '_,
1452 fidl::encoding::DefaultFuchsiaResourceDialect,
1453 >,
1454 offset: usize,
1455 mut depth: fidl::encoding::Depth,
1456 ) -> fidl::Result<()> {
1457 decoder.debug_check_bounds::<Self>(offset);
1458 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1459 None => return Err(fidl::Error::NotNullable),
1460 Some(len) => len,
1461 };
1462 if len == 0 {
1464 return Ok(());
1465 };
1466 depth.increment()?;
1467 let envelope_size = 8;
1468 let bytes_len = len * envelope_size;
1469 let offset = decoder.out_of_line_offset(bytes_len)?;
1470 let mut _next_ordinal_to_read = 0;
1472 let mut next_offset = offset;
1473 let end_offset = offset + bytes_len;
1474 _next_ordinal_to_read += 1;
1475 if next_offset >= end_offset {
1476 return Ok(());
1477 }
1478
1479 while _next_ordinal_to_read < 1 {
1481 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1482 _next_ordinal_to_read += 1;
1483 next_offset += envelope_size;
1484 }
1485
1486 let next_out_of_line = decoder.next_out_of_line();
1487 let handles_before = decoder.remaining_handles();
1488 if let Some((inlined, num_bytes, num_handles)) =
1489 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1490 {
1491 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1492 if inlined != (member_inline_size <= 4) {
1493 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1494 }
1495 let inner_offset;
1496 let mut inner_depth = depth.clone();
1497 if inlined {
1498 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1499 inner_offset = next_offset;
1500 } else {
1501 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1502 inner_depth.increment()?;
1503 }
1504 let val_ref = self.url.get_or_insert_with(|| {
1505 fidl::new_empty!(
1506 fidl::encoding::BoundedString<4096>,
1507 fidl::encoding::DefaultFuchsiaResourceDialect
1508 )
1509 });
1510 fidl::decode!(
1511 fidl::encoding::BoundedString<4096>,
1512 fidl::encoding::DefaultFuchsiaResourceDialect,
1513 val_ref,
1514 decoder,
1515 inner_offset,
1516 inner_depth
1517 )?;
1518 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1519 {
1520 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1521 }
1522 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1523 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1524 }
1525 }
1526
1527 next_offset += envelope_size;
1528 _next_ordinal_to_read += 1;
1529 if next_offset >= end_offset {
1530 return Ok(());
1531 }
1532
1533 while _next_ordinal_to_read < 2 {
1535 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1536 _next_ordinal_to_read += 1;
1537 next_offset += envelope_size;
1538 }
1539
1540 let next_out_of_line = decoder.next_out_of_line();
1541 let handles_before = decoder.remaining_handles();
1542 if let Some((inlined, num_bytes, num_handles)) =
1543 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1544 {
1545 let member_inline_size = <fidl_fuchsia_test_manager::RunSuiteOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1546 if inlined != (member_inline_size <= 4) {
1547 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1548 }
1549 let inner_offset;
1550 let mut inner_depth = depth.clone();
1551 if inlined {
1552 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1553 inner_offset = next_offset;
1554 } else {
1555 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1556 inner_depth.increment()?;
1557 }
1558 let val_ref = self.options.get_or_insert_with(|| {
1559 fidl::new_empty!(
1560 fidl_fuchsia_test_manager::RunSuiteOptions,
1561 fidl::encoding::DefaultFuchsiaResourceDialect
1562 )
1563 });
1564 fidl::decode!(
1565 fidl_fuchsia_test_manager::RunSuiteOptions,
1566 fidl::encoding::DefaultFuchsiaResourceDialect,
1567 val_ref,
1568 decoder,
1569 inner_offset,
1570 inner_depth
1571 )?;
1572 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1573 {
1574 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1575 }
1576 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1577 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1578 }
1579 }
1580
1581 next_offset += envelope_size;
1582
1583 while next_offset < end_offset {
1585 _next_ordinal_to_read += 1;
1586 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1587 next_offset += envelope_size;
1588 }
1589
1590 Ok(())
1591 }
1592 }
1593
1594 impl SessionConfigureRequest {
1595 #[inline(always)]
1596 fn max_ordinal_present(&self) -> u64 {
1597 if let Some(_) = self.config {
1598 return 2;
1599 }
1600 if let Some(_) = self.output {
1601 return 1;
1602 }
1603 0
1604 }
1605 }
1606
1607 impl fidl::encoding::ResourceTypeMarker for SessionConfigureRequest {
1608 type Borrowed<'a> = &'a mut Self;
1609 fn take_or_borrow<'a>(
1610 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1611 ) -> Self::Borrowed<'a> {
1612 value
1613 }
1614 }
1615
1616 unsafe impl fidl::encoding::TypeMarker for SessionConfigureRequest {
1617 type Owned = Self;
1618
1619 #[inline(always)]
1620 fn inline_align(_context: fidl::encoding::Context) -> usize {
1621 8
1622 }
1623
1624 #[inline(always)]
1625 fn inline_size(_context: fidl::encoding::Context) -> usize {
1626 16
1627 }
1628 }
1629
1630 unsafe impl
1631 fidl::encoding::Encode<
1632 SessionConfigureRequest,
1633 fidl::encoding::DefaultFuchsiaResourceDialect,
1634 > for &mut SessionConfigureRequest
1635 {
1636 unsafe fn encode(
1637 self,
1638 encoder: &mut fidl::encoding::Encoder<
1639 '_,
1640 fidl::encoding::DefaultFuchsiaResourceDialect,
1641 >,
1642 offset: usize,
1643 mut depth: fidl::encoding::Depth,
1644 ) -> fidl::Result<()> {
1645 encoder.debug_check_bounds::<SessionConfigureRequest>(offset);
1646 let max_ordinal: u64 = self.max_ordinal_present();
1648 encoder.write_num(max_ordinal, offset);
1649 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1650 if max_ordinal == 0 {
1652 return Ok(());
1653 }
1654 depth.increment()?;
1655 let envelope_size = 8;
1656 let bytes_len = max_ordinal as usize * envelope_size;
1657 #[allow(unused_variables)]
1658 let offset = encoder.out_of_line_offset(bytes_len);
1659 let mut _prev_end_offset: usize = 0;
1660 if 1 > max_ordinal {
1661 return Ok(());
1662 }
1663
1664 let cur_offset: usize = (1 - 1) * envelope_size;
1667
1668 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1670
1671 fidl::encoding::encode_in_envelope_optional::<
1676 fidl::encoding::HandleType<
1677 fidl::Socket,
1678 { fidl::ObjectType::SOCKET.into_raw() },
1679 2147483648,
1680 >,
1681 fidl::encoding::DefaultFuchsiaResourceDialect,
1682 >(
1683 self.output.as_mut().map(
1684 <fidl::encoding::HandleType<
1685 fidl::Socket,
1686 { fidl::ObjectType::SOCKET.into_raw() },
1687 2147483648,
1688 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1689 ),
1690 encoder,
1691 offset + cur_offset,
1692 depth,
1693 )?;
1694
1695 _prev_end_offset = cur_offset + envelope_size;
1696 if 2 > max_ordinal {
1697 return Ok(());
1698 }
1699
1700 let cur_offset: usize = (2 - 1) * envelope_size;
1703
1704 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1706
1707 fidl::encoding::encode_in_envelope_optional::<
1712 Config,
1713 fidl::encoding::DefaultFuchsiaResourceDialect,
1714 >(
1715 self.config
1716 .as_mut()
1717 .map(<Config as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1718 encoder,
1719 offset + cur_offset,
1720 depth,
1721 )?;
1722
1723 _prev_end_offset = cur_offset + envelope_size;
1724
1725 Ok(())
1726 }
1727 }
1728
1729 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1730 for SessionConfigureRequest
1731 {
1732 #[inline(always)]
1733 fn new_empty() -> Self {
1734 Self::default()
1735 }
1736
1737 unsafe fn decode(
1738 &mut self,
1739 decoder: &mut fidl::encoding::Decoder<
1740 '_,
1741 fidl::encoding::DefaultFuchsiaResourceDialect,
1742 >,
1743 offset: usize,
1744 mut depth: fidl::encoding::Depth,
1745 ) -> fidl::Result<()> {
1746 decoder.debug_check_bounds::<Self>(offset);
1747 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1748 None => return Err(fidl::Error::NotNullable),
1749 Some(len) => len,
1750 };
1751 if len == 0 {
1753 return Ok(());
1754 };
1755 depth.increment()?;
1756 let envelope_size = 8;
1757 let bytes_len = len * envelope_size;
1758 let offset = decoder.out_of_line_offset(bytes_len)?;
1759 let mut _next_ordinal_to_read = 0;
1761 let mut next_offset = offset;
1762 let end_offset = offset + bytes_len;
1763 _next_ordinal_to_read += 1;
1764 if next_offset >= end_offset {
1765 return Ok(());
1766 }
1767
1768 while _next_ordinal_to_read < 1 {
1770 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1771 _next_ordinal_to_read += 1;
1772 next_offset += envelope_size;
1773 }
1774
1775 let next_out_of_line = decoder.next_out_of_line();
1776 let handles_before = decoder.remaining_handles();
1777 if let Some((inlined, num_bytes, num_handles)) =
1778 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1779 {
1780 let member_inline_size = <fidl::encoding::HandleType<
1781 fidl::Socket,
1782 { fidl::ObjectType::SOCKET.into_raw() },
1783 2147483648,
1784 > as fidl::encoding::TypeMarker>::inline_size(
1785 decoder.context
1786 );
1787 if inlined != (member_inline_size <= 4) {
1788 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1789 }
1790 let inner_offset;
1791 let mut inner_depth = depth.clone();
1792 if inlined {
1793 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1794 inner_offset = next_offset;
1795 } else {
1796 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1797 inner_depth.increment()?;
1798 }
1799 let val_ref =
1800 self.output.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1801 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1802 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1803 {
1804 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1805 }
1806 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1807 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1808 }
1809 }
1810
1811 next_offset += envelope_size;
1812 _next_ordinal_to_read += 1;
1813 if next_offset >= end_offset {
1814 return Ok(());
1815 }
1816
1817 while _next_ordinal_to_read < 2 {
1819 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1820 _next_ordinal_to_read += 1;
1821 next_offset += envelope_size;
1822 }
1823
1824 let next_out_of_line = decoder.next_out_of_line();
1825 let handles_before = decoder.remaining_handles();
1826 if let Some((inlined, num_bytes, num_handles)) =
1827 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1828 {
1829 let member_inline_size =
1830 <Config as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1831 if inlined != (member_inline_size <= 4) {
1832 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1833 }
1834 let inner_offset;
1835 let mut inner_depth = depth.clone();
1836 if inlined {
1837 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1838 inner_offset = next_offset;
1839 } else {
1840 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1841 inner_depth.increment()?;
1842 }
1843 let val_ref = self.config.get_or_insert_with(|| {
1844 fidl::new_empty!(Config, fidl::encoding::DefaultFuchsiaResourceDialect)
1845 });
1846 fidl::decode!(
1847 Config,
1848 fidl::encoding::DefaultFuchsiaResourceDialect,
1849 val_ref,
1850 decoder,
1851 inner_offset,
1852 inner_depth
1853 )?;
1854 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1855 {
1856 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1857 }
1858 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1859 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1860 }
1861 }
1862
1863 next_offset += envelope_size;
1864
1865 while next_offset < end_offset {
1867 _next_ordinal_to_read += 1;
1868 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1869 next_offset += envelope_size;
1870 }
1871
1872 Ok(())
1873 }
1874 }
1875
1876 impl fidl::encoding::ResourceTypeMarker for AttachConfig {
1877 type Borrowed<'a> = &'a mut Self;
1878 fn take_or_borrow<'a>(
1879 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1880 ) -> Self::Borrowed<'a> {
1881 value
1882 }
1883 }
1884
1885 unsafe impl fidl::encoding::TypeMarker for AttachConfig {
1886 type Owned = Self;
1887
1888 #[inline(always)]
1889 fn inline_align(_context: fidl::encoding::Context) -> usize {
1890 8
1891 }
1892
1893 #[inline(always)]
1894 fn inline_size(_context: fidl::encoding::Context) -> usize {
1895 16
1896 }
1897 }
1898
1899 unsafe impl fidl::encoding::Encode<AttachConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1900 for &mut AttachConfig
1901 {
1902 #[inline]
1903 unsafe fn encode(
1904 self,
1905 encoder: &mut fidl::encoding::Encoder<
1906 '_,
1907 fidl::encoding::DefaultFuchsiaResourceDialect,
1908 >,
1909 offset: usize,
1910 _depth: fidl::encoding::Depth,
1911 ) -> fidl::Result<()> {
1912 encoder.debug_check_bounds::<AttachConfig>(offset);
1913 encoder.write_num::<u64>(self.ordinal(), offset);
1914 match self {
1915 AttachConfig::LaunchComponent(ref val) => {
1916 fidl::encoding::encode_in_envelope::<LaunchComponent, fidl::encoding::DefaultFuchsiaResourceDialect>(
1917 <LaunchComponent as fidl::encoding::ValueTypeMarker>::borrow(val),
1918 encoder, offset + 8, _depth
1919 )
1920 }
1921 AttachConfig::AttachToComponentMoniker(ref val) => {
1922 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1923 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
1924 encoder, offset + 8, _depth
1925 )
1926 }
1927 AttachConfig::AttachToComponentUrl(ref val) => {
1928 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1929 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
1930 encoder, offset + 8, _depth
1931 )
1932 }
1933 AttachConfig::LaunchTest(ref mut val) => {
1934 fidl::encoding::encode_in_envelope::<LaunchTest, fidl::encoding::DefaultFuchsiaResourceDialect>(
1935 <LaunchTest as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
1936 encoder, offset + 8, _depth
1937 )
1938 }
1939 AttachConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1940 }
1941 }
1942 }
1943
1944 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for AttachConfig {
1945 #[inline(always)]
1946 fn new_empty() -> Self {
1947 Self::__SourceBreaking { unknown_ordinal: 0 }
1948 }
1949
1950 #[inline]
1951 unsafe fn decode(
1952 &mut self,
1953 decoder: &mut fidl::encoding::Decoder<
1954 '_,
1955 fidl::encoding::DefaultFuchsiaResourceDialect,
1956 >,
1957 offset: usize,
1958 mut depth: fidl::encoding::Depth,
1959 ) -> fidl::Result<()> {
1960 decoder.debug_check_bounds::<Self>(offset);
1961 #[allow(unused_variables)]
1962 let next_out_of_line = decoder.next_out_of_line();
1963 let handles_before = decoder.remaining_handles();
1964 let (ordinal, inlined, num_bytes, num_handles) =
1965 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1966
1967 let member_inline_size = match ordinal {
1968 1 => <LaunchComponent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1969 2 => {
1970 <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
1971 decoder.context,
1972 )
1973 }
1974 3 => {
1975 <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
1976 decoder.context,
1977 )
1978 }
1979 4 => <LaunchTest as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1980 0 => return Err(fidl::Error::UnknownUnionTag),
1981 _ => num_bytes as usize,
1982 };
1983
1984 if inlined != (member_inline_size <= 4) {
1985 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1986 }
1987 let _inner_offset;
1988 if inlined {
1989 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1990 _inner_offset = offset + 8;
1991 } else {
1992 depth.increment()?;
1993 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1994 }
1995 match ordinal {
1996 1 => {
1997 #[allow(irrefutable_let_patterns)]
1998 if let AttachConfig::LaunchComponent(_) = self {
1999 } else {
2001 *self = AttachConfig::LaunchComponent(fidl::new_empty!(
2003 LaunchComponent,
2004 fidl::encoding::DefaultFuchsiaResourceDialect
2005 ));
2006 }
2007 #[allow(irrefutable_let_patterns)]
2008 if let AttachConfig::LaunchComponent(ref mut val) = self {
2009 fidl::decode!(
2010 LaunchComponent,
2011 fidl::encoding::DefaultFuchsiaResourceDialect,
2012 val,
2013 decoder,
2014 _inner_offset,
2015 depth
2016 )?;
2017 } else {
2018 unreachable!()
2019 }
2020 }
2021 2 => {
2022 #[allow(irrefutable_let_patterns)]
2023 if let AttachConfig::AttachToComponentMoniker(_) = self {
2024 } else {
2026 *self = AttachConfig::AttachToComponentMoniker(fidl::new_empty!(
2028 fidl::encoding::BoundedString<4096>,
2029 fidl::encoding::DefaultFuchsiaResourceDialect
2030 ));
2031 }
2032 #[allow(irrefutable_let_patterns)]
2033 if let AttachConfig::AttachToComponentMoniker(ref mut val) = self {
2034 fidl::decode!(
2035 fidl::encoding::BoundedString<4096>,
2036 fidl::encoding::DefaultFuchsiaResourceDialect,
2037 val,
2038 decoder,
2039 _inner_offset,
2040 depth
2041 )?;
2042 } else {
2043 unreachable!()
2044 }
2045 }
2046 3 => {
2047 #[allow(irrefutable_let_patterns)]
2048 if let AttachConfig::AttachToComponentUrl(_) = self {
2049 } else {
2051 *self = AttachConfig::AttachToComponentUrl(fidl::new_empty!(
2053 fidl::encoding::BoundedString<4096>,
2054 fidl::encoding::DefaultFuchsiaResourceDialect
2055 ));
2056 }
2057 #[allow(irrefutable_let_patterns)]
2058 if let AttachConfig::AttachToComponentUrl(ref mut val) = self {
2059 fidl::decode!(
2060 fidl::encoding::BoundedString<4096>,
2061 fidl::encoding::DefaultFuchsiaResourceDialect,
2062 val,
2063 decoder,
2064 _inner_offset,
2065 depth
2066 )?;
2067 } else {
2068 unreachable!()
2069 }
2070 }
2071 4 => {
2072 #[allow(irrefutable_let_patterns)]
2073 if let AttachConfig::LaunchTest(_) = self {
2074 } else {
2076 *self = AttachConfig::LaunchTest(fidl::new_empty!(
2078 LaunchTest,
2079 fidl::encoding::DefaultFuchsiaResourceDialect
2080 ));
2081 }
2082 #[allow(irrefutable_let_patterns)]
2083 if let AttachConfig::LaunchTest(ref mut val) = self {
2084 fidl::decode!(
2085 LaunchTest,
2086 fidl::encoding::DefaultFuchsiaResourceDialect,
2087 val,
2088 decoder,
2089 _inner_offset,
2090 depth
2091 )?;
2092 } else {
2093 unreachable!()
2094 }
2095 }
2096 #[allow(deprecated)]
2097 ordinal => {
2098 for _ in 0..num_handles {
2099 decoder.drop_next_handle()?;
2100 }
2101 *self = AttachConfig::__SourceBreaking { unknown_ordinal: ordinal };
2102 }
2103 }
2104 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2105 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2106 }
2107 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2108 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2109 }
2110 Ok(())
2111 }
2112 }
2113
2114 impl fidl::encoding::ResourceTypeMarker for TargetConfig {
2115 type Borrowed<'a> = &'a mut Self;
2116 fn take_or_borrow<'a>(
2117 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2118 ) -> Self::Borrowed<'a> {
2119 value
2120 }
2121 }
2122
2123 unsafe impl fidl::encoding::TypeMarker for TargetConfig {
2124 type Owned = Self;
2125
2126 #[inline(always)]
2127 fn inline_align(_context: fidl::encoding::Context) -> usize {
2128 8
2129 }
2130
2131 #[inline(always)]
2132 fn inline_size(_context: fidl::encoding::Context) -> usize {
2133 16
2134 }
2135 }
2136
2137 unsafe impl fidl::encoding::Encode<TargetConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
2138 for &mut TargetConfig
2139 {
2140 #[inline]
2141 unsafe fn encode(
2142 self,
2143 encoder: &mut fidl::encoding::Encoder<
2144 '_,
2145 fidl::encoding::DefaultFuchsiaResourceDialect,
2146 >,
2147 offset: usize,
2148 _depth: fidl::encoding::Depth,
2149 ) -> fidl::Result<()> {
2150 encoder.debug_check_bounds::<TargetConfig>(offset);
2151 encoder.write_num::<u64>(self.ordinal(), offset);
2152 match self {
2153 TargetConfig::Tasks(ref val) => fidl::encoding::encode_in_envelope::<
2154 fidl::encoding::Vector<Task, 64>,
2155 fidl::encoding::DefaultFuchsiaResourceDialect,
2156 >(
2157 <fidl::encoding::Vector<Task, 64> as fidl::encoding::ValueTypeMarker>::borrow(
2158 val,
2159 ),
2160 encoder,
2161 offset + 8,
2162 _depth,
2163 ),
2164 TargetConfig::Component(ref mut val) => fidl::encoding::encode_in_envelope::<
2165 AttachConfig,
2166 fidl::encoding::DefaultFuchsiaResourceDialect,
2167 >(
2168 <AttachConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2169 encoder,
2170 offset + 8,
2171 _depth,
2172 ),
2173 TargetConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2174 }
2175 }
2176 }
2177
2178 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for TargetConfig {
2179 #[inline(always)]
2180 fn new_empty() -> Self {
2181 Self::__SourceBreaking { unknown_ordinal: 0 }
2182 }
2183
2184 #[inline]
2185 unsafe fn decode(
2186 &mut self,
2187 decoder: &mut fidl::encoding::Decoder<
2188 '_,
2189 fidl::encoding::DefaultFuchsiaResourceDialect,
2190 >,
2191 offset: usize,
2192 mut depth: fidl::encoding::Depth,
2193 ) -> fidl::Result<()> {
2194 decoder.debug_check_bounds::<Self>(offset);
2195 #[allow(unused_variables)]
2196 let next_out_of_line = decoder.next_out_of_line();
2197 let handles_before = decoder.remaining_handles();
2198 let (ordinal, inlined, num_bytes, num_handles) =
2199 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2200
2201 let member_inline_size = match ordinal {
2202 1 => <fidl::encoding::Vector<Task, 64> as fidl::encoding::TypeMarker>::inline_size(
2203 decoder.context,
2204 ),
2205 2 => <AttachConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2206 0 => return Err(fidl::Error::UnknownUnionTag),
2207 _ => num_bytes as usize,
2208 };
2209
2210 if inlined != (member_inline_size <= 4) {
2211 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2212 }
2213 let _inner_offset;
2214 if inlined {
2215 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2216 _inner_offset = offset + 8;
2217 } else {
2218 depth.increment()?;
2219 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2220 }
2221 match ordinal {
2222 1 => {
2223 #[allow(irrefutable_let_patterns)]
2224 if let TargetConfig::Tasks(_) = self {
2225 } else {
2227 *self = TargetConfig::Tasks(
2229 fidl::new_empty!(fidl::encoding::Vector<Task, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
2230 );
2231 }
2232 #[allow(irrefutable_let_patterns)]
2233 if let TargetConfig::Tasks(ref mut val) = self {
2234 fidl::decode!(fidl::encoding::Vector<Task, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2235 } else {
2236 unreachable!()
2237 }
2238 }
2239 2 => {
2240 #[allow(irrefutable_let_patterns)]
2241 if let TargetConfig::Component(_) = self {
2242 } else {
2244 *self = TargetConfig::Component(fidl::new_empty!(
2246 AttachConfig,
2247 fidl::encoding::DefaultFuchsiaResourceDialect
2248 ));
2249 }
2250 #[allow(irrefutable_let_patterns)]
2251 if let TargetConfig::Component(ref mut val) = self {
2252 fidl::decode!(
2253 AttachConfig,
2254 fidl::encoding::DefaultFuchsiaResourceDialect,
2255 val,
2256 decoder,
2257 _inner_offset,
2258 depth
2259 )?;
2260 } else {
2261 unreachable!()
2262 }
2263 }
2264 #[allow(deprecated)]
2265 ordinal => {
2266 for _ in 0..num_handles {
2267 decoder.drop_next_handle()?;
2268 }
2269 *self = TargetConfig::__SourceBreaking { unknown_ordinal: ordinal };
2270 }
2271 }
2272 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2273 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2274 }
2275 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2276 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2277 }
2278 Ok(())
2279 }
2280 }
2281}