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::NullableHandle {
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 { Some((responder)) } else { None }
747 }
748
749 #[allow(irrefutable_let_patterns)]
750 pub fn into_reset(self) -> Option<(SessionResetResponder)> {
751 if let SessionRequest::Reset { responder } = self { Some((responder)) } else { None }
752 }
753
754 pub fn method_name(&self) -> &'static str {
756 match *self {
757 SessionRequest::Configure { .. } => "configure",
758 SessionRequest::Start { .. } => "start",
759 SessionRequest::Stop { .. } => "stop",
760 SessionRequest::Reset { .. } => "reset",
761 }
762 }
763}
764
765#[derive(Debug, Clone)]
766pub struct SessionControlHandle {
767 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
768}
769
770impl fidl::endpoints::ControlHandle for SessionControlHandle {
771 fn shutdown(&self) {
772 self.inner.shutdown()
773 }
774
775 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
776 self.inner.shutdown_with_epitaph(status)
777 }
778
779 fn is_closed(&self) -> bool {
780 self.inner.channel().is_closed()
781 }
782 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
783 self.inner.channel().on_closed()
784 }
785
786 #[cfg(target_os = "fuchsia")]
787 fn signal_peer(
788 &self,
789 clear_mask: zx::Signals,
790 set_mask: zx::Signals,
791 ) -> Result<(), zx_status::Status> {
792 use fidl::Peered;
793 self.inner.channel().signal_peer(clear_mask, set_mask)
794 }
795}
796
797impl SessionControlHandle {}
798
799#[must_use = "FIDL methods require a response to be sent"]
800#[derive(Debug)]
801pub struct SessionConfigureResponder {
802 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
803 tx_id: u32,
804}
805
806impl std::ops::Drop for SessionConfigureResponder {
810 fn drop(&mut self) {
811 self.control_handle.shutdown();
812 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
814 }
815}
816
817impl fidl::endpoints::Responder for SessionConfigureResponder {
818 type ControlHandle = SessionControlHandle;
819
820 fn control_handle(&self) -> &SessionControlHandle {
821 &self.control_handle
822 }
823
824 fn drop_without_shutdown(mut self) {
825 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
827 std::mem::forget(self);
829 }
830}
831
832impl SessionConfigureResponder {
833 pub fn send(self, mut result: Result<(), SessionConfigureError>) -> Result<(), fidl::Error> {
837 let _result = self.send_raw(result);
838 if _result.is_err() {
839 self.control_handle.shutdown();
840 }
841 self.drop_without_shutdown();
842 _result
843 }
844
845 pub fn send_no_shutdown_on_err(
847 self,
848 mut result: Result<(), SessionConfigureError>,
849 ) -> Result<(), fidl::Error> {
850 let _result = self.send_raw(result);
851 self.drop_without_shutdown();
852 _result
853 }
854
855 fn send_raw(&self, mut result: Result<(), SessionConfigureError>) -> Result<(), fidl::Error> {
856 self.control_handle.inner.send::<fidl::encoding::ResultType<
857 fidl::encoding::EmptyStruct,
858 SessionConfigureError,
859 >>(
860 result,
861 self.tx_id,
862 0x67e7e28a9b959ce8,
863 fidl::encoding::DynamicFlags::empty(),
864 )
865 }
866}
867
868#[must_use = "FIDL methods require a response to be sent"]
869#[derive(Debug)]
870pub struct SessionStartResponder {
871 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
872 tx_id: u32,
873}
874
875impl std::ops::Drop for SessionStartResponder {
879 fn drop(&mut self) {
880 self.control_handle.shutdown();
881 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
883 }
884}
885
886impl fidl::endpoints::Responder for SessionStartResponder {
887 type ControlHandle = SessionControlHandle;
888
889 fn control_handle(&self) -> &SessionControlHandle {
890 &self.control_handle
891 }
892
893 fn drop_without_shutdown(mut self) {
894 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
896 std::mem::forget(self);
898 }
899}
900
901impl SessionStartResponder {
902 pub fn send(self, mut result: Result<(), SessionStartError>) -> Result<(), fidl::Error> {
906 let _result = self.send_raw(result);
907 if _result.is_err() {
908 self.control_handle.shutdown();
909 }
910 self.drop_without_shutdown();
911 _result
912 }
913
914 pub fn send_no_shutdown_on_err(
916 self,
917 mut result: Result<(), SessionStartError>,
918 ) -> Result<(), fidl::Error> {
919 let _result = self.send_raw(result);
920 self.drop_without_shutdown();
921 _result
922 }
923
924 fn send_raw(&self, mut result: Result<(), SessionStartError>) -> Result<(), fidl::Error> {
925 self.control_handle.inner.send::<fidl::encoding::ResultType<
926 fidl::encoding::EmptyStruct,
927 SessionStartError,
928 >>(
929 result,
930 self.tx_id,
931 0x4e82f9133a968ad5,
932 fidl::encoding::DynamicFlags::empty(),
933 )
934 }
935}
936
937#[must_use = "FIDL methods require a response to be sent"]
938#[derive(Debug)]
939pub struct SessionStopResponder {
940 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
941 tx_id: u32,
942}
943
944impl std::ops::Drop for SessionStopResponder {
948 fn drop(&mut self) {
949 self.control_handle.shutdown();
950 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
952 }
953}
954
955impl fidl::endpoints::Responder for SessionStopResponder {
956 type ControlHandle = SessionControlHandle;
957
958 fn control_handle(&self) -> &SessionControlHandle {
959 &self.control_handle
960 }
961
962 fn drop_without_shutdown(mut self) {
963 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
965 std::mem::forget(self);
967 }
968}
969
970impl SessionStopResponder {
971 pub fn send(self, mut payload: &SessionStopResponse) -> Result<(), fidl::Error> {
975 let _result = self.send_raw(payload);
976 if _result.is_err() {
977 self.control_handle.shutdown();
978 }
979 self.drop_without_shutdown();
980 _result
981 }
982
983 pub fn send_no_shutdown_on_err(
985 self,
986 mut payload: &SessionStopResponse,
987 ) -> Result<(), fidl::Error> {
988 let _result = self.send_raw(payload);
989 self.drop_without_shutdown();
990 _result
991 }
992
993 fn send_raw(&self, mut payload: &SessionStopResponse) -> Result<(), fidl::Error> {
994 self.control_handle.inner.send::<SessionStopResponse>(
995 payload,
996 self.tx_id,
997 0x76aa8dd59cb61e89,
998 fidl::encoding::DynamicFlags::empty(),
999 )
1000 }
1001}
1002
1003#[must_use = "FIDL methods require a response to be sent"]
1004#[derive(Debug)]
1005pub struct SessionResetResponder {
1006 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1007 tx_id: u32,
1008}
1009
1010impl std::ops::Drop for SessionResetResponder {
1014 fn drop(&mut self) {
1015 self.control_handle.shutdown();
1016 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1018 }
1019}
1020
1021impl fidl::endpoints::Responder for SessionResetResponder {
1022 type ControlHandle = SessionControlHandle;
1023
1024 fn control_handle(&self) -> &SessionControlHandle {
1025 &self.control_handle
1026 }
1027
1028 fn drop_without_shutdown(mut self) {
1029 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1031 std::mem::forget(self);
1033 }
1034}
1035
1036impl SessionResetResponder {
1037 pub fn send(self) -> Result<(), fidl::Error> {
1041 let _result = self.send_raw();
1042 if _result.is_err() {
1043 self.control_handle.shutdown();
1044 }
1045 self.drop_without_shutdown();
1046 _result
1047 }
1048
1049 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1051 let _result = self.send_raw();
1052 self.drop_without_shutdown();
1053 _result
1054 }
1055
1056 fn send_raw(&self) -> Result<(), fidl::Error> {
1057 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1058 (),
1059 self.tx_id,
1060 0x5f522fde537356fa,
1061 fidl::encoding::DynamicFlags::empty(),
1062 )
1063 }
1064}
1065
1066mod internal {
1067 use super::*;
1068
1069 impl Config {
1070 #[inline(always)]
1071 fn max_ordinal_present(&self) -> u64 {
1072 if let Some(_) = self.target {
1073 return 2;
1074 }
1075 if let Some(_) = self.configs {
1076 return 1;
1077 }
1078 0
1079 }
1080 }
1081
1082 impl fidl::encoding::ResourceTypeMarker for Config {
1083 type Borrowed<'a> = &'a mut Self;
1084 fn take_or_borrow<'a>(
1085 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1086 ) -> Self::Borrowed<'a> {
1087 value
1088 }
1089 }
1090
1091 unsafe impl fidl::encoding::TypeMarker for Config {
1092 type Owned = Self;
1093
1094 #[inline(always)]
1095 fn inline_align(_context: fidl::encoding::Context) -> usize {
1096 8
1097 }
1098
1099 #[inline(always)]
1100 fn inline_size(_context: fidl::encoding::Context) -> usize {
1101 16
1102 }
1103 }
1104
1105 unsafe impl fidl::encoding::Encode<Config, fidl::encoding::DefaultFuchsiaResourceDialect>
1106 for &mut Config
1107 {
1108 unsafe fn encode(
1109 self,
1110 encoder: &mut fidl::encoding::Encoder<
1111 '_,
1112 fidl::encoding::DefaultFuchsiaResourceDialect,
1113 >,
1114 offset: usize,
1115 mut depth: fidl::encoding::Depth,
1116 ) -> fidl::Result<()> {
1117 encoder.debug_check_bounds::<Config>(offset);
1118 let max_ordinal: u64 = self.max_ordinal_present();
1120 encoder.write_num(max_ordinal, offset);
1121 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1122 if max_ordinal == 0 {
1124 return Ok(());
1125 }
1126 depth.increment()?;
1127 let envelope_size = 8;
1128 let bytes_len = max_ordinal as usize * envelope_size;
1129 #[allow(unused_variables)]
1130 let offset = encoder.out_of_line_offset(bytes_len);
1131 let mut _prev_end_offset: usize = 0;
1132 if 1 > max_ordinal {
1133 return Ok(());
1134 }
1135
1136 let cur_offset: usize = (1 - 1) * envelope_size;
1139
1140 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1142
1143 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1148 self.configs.as_ref().map(<fidl::encoding::Vector<SamplingConfig, 64> as fidl::encoding::ValueTypeMarker>::borrow),
1149 encoder, offset + cur_offset, depth
1150 )?;
1151
1152 _prev_end_offset = cur_offset + envelope_size;
1153 if 2 > max_ordinal {
1154 return Ok(());
1155 }
1156
1157 let cur_offset: usize = (2 - 1) * envelope_size;
1160
1161 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1163
1164 fidl::encoding::encode_in_envelope_optional::<
1169 TargetConfig,
1170 fidl::encoding::DefaultFuchsiaResourceDialect,
1171 >(
1172 self.target
1173 .as_mut()
1174 .map(<TargetConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1175 encoder,
1176 offset + cur_offset,
1177 depth,
1178 )?;
1179
1180 _prev_end_offset = cur_offset + envelope_size;
1181
1182 Ok(())
1183 }
1184 }
1185
1186 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Config {
1187 #[inline(always)]
1188 fn new_empty() -> Self {
1189 Self::default()
1190 }
1191
1192 unsafe fn decode(
1193 &mut self,
1194 decoder: &mut fidl::encoding::Decoder<
1195 '_,
1196 fidl::encoding::DefaultFuchsiaResourceDialect,
1197 >,
1198 offset: usize,
1199 mut depth: fidl::encoding::Depth,
1200 ) -> fidl::Result<()> {
1201 decoder.debug_check_bounds::<Self>(offset);
1202 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1203 None => return Err(fidl::Error::NotNullable),
1204 Some(len) => len,
1205 };
1206 if len == 0 {
1208 return Ok(());
1209 };
1210 depth.increment()?;
1211 let envelope_size = 8;
1212 let bytes_len = len * envelope_size;
1213 let offset = decoder.out_of_line_offset(bytes_len)?;
1214 let mut _next_ordinal_to_read = 0;
1216 let mut next_offset = offset;
1217 let end_offset = offset + bytes_len;
1218 _next_ordinal_to_read += 1;
1219 if next_offset >= end_offset {
1220 return Ok(());
1221 }
1222
1223 while _next_ordinal_to_read < 1 {
1225 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1226 _next_ordinal_to_read += 1;
1227 next_offset += envelope_size;
1228 }
1229
1230 let next_out_of_line = decoder.next_out_of_line();
1231 let handles_before = decoder.remaining_handles();
1232 if let Some((inlined, num_bytes, num_handles)) =
1233 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1234 {
1235 let member_inline_size = <fidl::encoding::Vector<SamplingConfig, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1236 if inlined != (member_inline_size <= 4) {
1237 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1238 }
1239 let inner_offset;
1240 let mut inner_depth = depth.clone();
1241 if inlined {
1242 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1243 inner_offset = next_offset;
1244 } else {
1245 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1246 inner_depth.increment()?;
1247 }
1248 let val_ref =
1249 self.configs.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
1250 fidl::decode!(fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1251 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1252 {
1253 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1254 }
1255 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1256 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1257 }
1258 }
1259
1260 next_offset += envelope_size;
1261 _next_ordinal_to_read += 1;
1262 if next_offset >= end_offset {
1263 return Ok(());
1264 }
1265
1266 while _next_ordinal_to_read < 2 {
1268 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1269 _next_ordinal_to_read += 1;
1270 next_offset += envelope_size;
1271 }
1272
1273 let next_out_of_line = decoder.next_out_of_line();
1274 let handles_before = decoder.remaining_handles();
1275 if let Some((inlined, num_bytes, num_handles)) =
1276 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1277 {
1278 let member_inline_size =
1279 <TargetConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1280 if inlined != (member_inline_size <= 4) {
1281 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1282 }
1283 let inner_offset;
1284 let mut inner_depth = depth.clone();
1285 if inlined {
1286 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1287 inner_offset = next_offset;
1288 } else {
1289 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1290 inner_depth.increment()?;
1291 }
1292 let val_ref = self.target.get_or_insert_with(|| {
1293 fidl::new_empty!(TargetConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
1294 });
1295 fidl::decode!(
1296 TargetConfig,
1297 fidl::encoding::DefaultFuchsiaResourceDialect,
1298 val_ref,
1299 decoder,
1300 inner_offset,
1301 inner_depth
1302 )?;
1303 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1304 {
1305 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1306 }
1307 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1308 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1309 }
1310 }
1311
1312 next_offset += envelope_size;
1313
1314 while next_offset < end_offset {
1316 _next_ordinal_to_read += 1;
1317 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1318 next_offset += envelope_size;
1319 }
1320
1321 Ok(())
1322 }
1323 }
1324
1325 impl LaunchTest {
1326 #[inline(always)]
1327 fn max_ordinal_present(&self) -> u64 {
1328 if let Some(_) = self.options {
1329 return 2;
1330 }
1331 if let Some(_) = self.url {
1332 return 1;
1333 }
1334 0
1335 }
1336 }
1337
1338 impl fidl::encoding::ResourceTypeMarker for LaunchTest {
1339 type Borrowed<'a> = &'a mut Self;
1340 fn take_or_borrow<'a>(
1341 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1342 ) -> Self::Borrowed<'a> {
1343 value
1344 }
1345 }
1346
1347 unsafe impl fidl::encoding::TypeMarker for LaunchTest {
1348 type Owned = Self;
1349
1350 #[inline(always)]
1351 fn inline_align(_context: fidl::encoding::Context) -> usize {
1352 8
1353 }
1354
1355 #[inline(always)]
1356 fn inline_size(_context: fidl::encoding::Context) -> usize {
1357 16
1358 }
1359 }
1360
1361 unsafe impl fidl::encoding::Encode<LaunchTest, fidl::encoding::DefaultFuchsiaResourceDialect>
1362 for &mut LaunchTest
1363 {
1364 unsafe fn encode(
1365 self,
1366 encoder: &mut fidl::encoding::Encoder<
1367 '_,
1368 fidl::encoding::DefaultFuchsiaResourceDialect,
1369 >,
1370 offset: usize,
1371 mut depth: fidl::encoding::Depth,
1372 ) -> fidl::Result<()> {
1373 encoder.debug_check_bounds::<LaunchTest>(offset);
1374 let max_ordinal: u64 = self.max_ordinal_present();
1376 encoder.write_num(max_ordinal, offset);
1377 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1378 if max_ordinal == 0 {
1380 return Ok(());
1381 }
1382 depth.increment()?;
1383 let envelope_size = 8;
1384 let bytes_len = max_ordinal as usize * envelope_size;
1385 #[allow(unused_variables)]
1386 let offset = encoder.out_of_line_offset(bytes_len);
1387 let mut _prev_end_offset: usize = 0;
1388 if 1 > max_ordinal {
1389 return Ok(());
1390 }
1391
1392 let cur_offset: usize = (1 - 1) * envelope_size;
1395
1396 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1398
1399 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1404 self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
1405 encoder, offset + cur_offset, depth
1406 )?;
1407
1408 _prev_end_offset = cur_offset + envelope_size;
1409 if 2 > max_ordinal {
1410 return Ok(());
1411 }
1412
1413 let cur_offset: usize = (2 - 1) * envelope_size;
1416
1417 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1419
1420 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_test_manager::RunSuiteOptions, fidl::encoding::DefaultFuchsiaResourceDialect>(
1425 self.options.as_mut().map(<fidl_fuchsia_test_manager::RunSuiteOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1426 encoder, offset + cur_offset, depth
1427 )?;
1428
1429 _prev_end_offset = cur_offset + envelope_size;
1430
1431 Ok(())
1432 }
1433 }
1434
1435 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchTest {
1436 #[inline(always)]
1437 fn new_empty() -> Self {
1438 Self::default()
1439 }
1440
1441 unsafe fn decode(
1442 &mut self,
1443 decoder: &mut fidl::encoding::Decoder<
1444 '_,
1445 fidl::encoding::DefaultFuchsiaResourceDialect,
1446 >,
1447 offset: usize,
1448 mut depth: fidl::encoding::Depth,
1449 ) -> fidl::Result<()> {
1450 decoder.debug_check_bounds::<Self>(offset);
1451 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1452 None => return Err(fidl::Error::NotNullable),
1453 Some(len) => len,
1454 };
1455 if len == 0 {
1457 return Ok(());
1458 };
1459 depth.increment()?;
1460 let envelope_size = 8;
1461 let bytes_len = len * envelope_size;
1462 let offset = decoder.out_of_line_offset(bytes_len)?;
1463 let mut _next_ordinal_to_read = 0;
1465 let mut next_offset = offset;
1466 let end_offset = offset + bytes_len;
1467 _next_ordinal_to_read += 1;
1468 if next_offset >= end_offset {
1469 return Ok(());
1470 }
1471
1472 while _next_ordinal_to_read < 1 {
1474 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1475 _next_ordinal_to_read += 1;
1476 next_offset += envelope_size;
1477 }
1478
1479 let next_out_of_line = decoder.next_out_of_line();
1480 let handles_before = decoder.remaining_handles();
1481 if let Some((inlined, num_bytes, num_handles)) =
1482 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1483 {
1484 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1485 if inlined != (member_inline_size <= 4) {
1486 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1487 }
1488 let inner_offset;
1489 let mut inner_depth = depth.clone();
1490 if inlined {
1491 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1492 inner_offset = next_offset;
1493 } else {
1494 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1495 inner_depth.increment()?;
1496 }
1497 let val_ref = self.url.get_or_insert_with(|| {
1498 fidl::new_empty!(
1499 fidl::encoding::BoundedString<4096>,
1500 fidl::encoding::DefaultFuchsiaResourceDialect
1501 )
1502 });
1503 fidl::decode!(
1504 fidl::encoding::BoundedString<4096>,
1505 fidl::encoding::DefaultFuchsiaResourceDialect,
1506 val_ref,
1507 decoder,
1508 inner_offset,
1509 inner_depth
1510 )?;
1511 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1512 {
1513 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1514 }
1515 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1516 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1517 }
1518 }
1519
1520 next_offset += envelope_size;
1521 _next_ordinal_to_read += 1;
1522 if next_offset >= end_offset {
1523 return Ok(());
1524 }
1525
1526 while _next_ordinal_to_read < 2 {
1528 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1529 _next_ordinal_to_read += 1;
1530 next_offset += envelope_size;
1531 }
1532
1533 let next_out_of_line = decoder.next_out_of_line();
1534 let handles_before = decoder.remaining_handles();
1535 if let Some((inlined, num_bytes, num_handles)) =
1536 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1537 {
1538 let member_inline_size = <fidl_fuchsia_test_manager::RunSuiteOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1539 if inlined != (member_inline_size <= 4) {
1540 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1541 }
1542 let inner_offset;
1543 let mut inner_depth = depth.clone();
1544 if inlined {
1545 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1546 inner_offset = next_offset;
1547 } else {
1548 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1549 inner_depth.increment()?;
1550 }
1551 let val_ref = self.options.get_or_insert_with(|| {
1552 fidl::new_empty!(
1553 fidl_fuchsia_test_manager::RunSuiteOptions,
1554 fidl::encoding::DefaultFuchsiaResourceDialect
1555 )
1556 });
1557 fidl::decode!(
1558 fidl_fuchsia_test_manager::RunSuiteOptions,
1559 fidl::encoding::DefaultFuchsiaResourceDialect,
1560 val_ref,
1561 decoder,
1562 inner_offset,
1563 inner_depth
1564 )?;
1565 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1566 {
1567 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1568 }
1569 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1570 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1571 }
1572 }
1573
1574 next_offset += envelope_size;
1575
1576 while next_offset < end_offset {
1578 _next_ordinal_to_read += 1;
1579 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1580 next_offset += envelope_size;
1581 }
1582
1583 Ok(())
1584 }
1585 }
1586
1587 impl SessionConfigureRequest {
1588 #[inline(always)]
1589 fn max_ordinal_present(&self) -> u64 {
1590 if let Some(_) = self.config {
1591 return 2;
1592 }
1593 if let Some(_) = self.output {
1594 return 1;
1595 }
1596 0
1597 }
1598 }
1599
1600 impl fidl::encoding::ResourceTypeMarker for SessionConfigureRequest {
1601 type Borrowed<'a> = &'a mut Self;
1602 fn take_or_borrow<'a>(
1603 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1604 ) -> Self::Borrowed<'a> {
1605 value
1606 }
1607 }
1608
1609 unsafe impl fidl::encoding::TypeMarker for SessionConfigureRequest {
1610 type Owned = Self;
1611
1612 #[inline(always)]
1613 fn inline_align(_context: fidl::encoding::Context) -> usize {
1614 8
1615 }
1616
1617 #[inline(always)]
1618 fn inline_size(_context: fidl::encoding::Context) -> usize {
1619 16
1620 }
1621 }
1622
1623 unsafe impl
1624 fidl::encoding::Encode<
1625 SessionConfigureRequest,
1626 fidl::encoding::DefaultFuchsiaResourceDialect,
1627 > for &mut SessionConfigureRequest
1628 {
1629 unsafe fn encode(
1630 self,
1631 encoder: &mut fidl::encoding::Encoder<
1632 '_,
1633 fidl::encoding::DefaultFuchsiaResourceDialect,
1634 >,
1635 offset: usize,
1636 mut depth: fidl::encoding::Depth,
1637 ) -> fidl::Result<()> {
1638 encoder.debug_check_bounds::<SessionConfigureRequest>(offset);
1639 let max_ordinal: u64 = self.max_ordinal_present();
1641 encoder.write_num(max_ordinal, offset);
1642 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1643 if max_ordinal == 0 {
1645 return Ok(());
1646 }
1647 depth.increment()?;
1648 let envelope_size = 8;
1649 let bytes_len = max_ordinal as usize * envelope_size;
1650 #[allow(unused_variables)]
1651 let offset = encoder.out_of_line_offset(bytes_len);
1652 let mut _prev_end_offset: usize = 0;
1653 if 1 > max_ordinal {
1654 return Ok(());
1655 }
1656
1657 let cur_offset: usize = (1 - 1) * envelope_size;
1660
1661 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1663
1664 fidl::encoding::encode_in_envelope_optional::<
1669 fidl::encoding::HandleType<
1670 fidl::Socket,
1671 { fidl::ObjectType::SOCKET.into_raw() },
1672 2147483648,
1673 >,
1674 fidl::encoding::DefaultFuchsiaResourceDialect,
1675 >(
1676 self.output.as_mut().map(
1677 <fidl::encoding::HandleType<
1678 fidl::Socket,
1679 { fidl::ObjectType::SOCKET.into_raw() },
1680 2147483648,
1681 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1682 ),
1683 encoder,
1684 offset + cur_offset,
1685 depth,
1686 )?;
1687
1688 _prev_end_offset = cur_offset + envelope_size;
1689 if 2 > max_ordinal {
1690 return Ok(());
1691 }
1692
1693 let cur_offset: usize = (2 - 1) * envelope_size;
1696
1697 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1699
1700 fidl::encoding::encode_in_envelope_optional::<
1705 Config,
1706 fidl::encoding::DefaultFuchsiaResourceDialect,
1707 >(
1708 self.config
1709 .as_mut()
1710 .map(<Config as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1711 encoder,
1712 offset + cur_offset,
1713 depth,
1714 )?;
1715
1716 _prev_end_offset = cur_offset + envelope_size;
1717
1718 Ok(())
1719 }
1720 }
1721
1722 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1723 for SessionConfigureRequest
1724 {
1725 #[inline(always)]
1726 fn new_empty() -> Self {
1727 Self::default()
1728 }
1729
1730 unsafe fn decode(
1731 &mut self,
1732 decoder: &mut fidl::encoding::Decoder<
1733 '_,
1734 fidl::encoding::DefaultFuchsiaResourceDialect,
1735 >,
1736 offset: usize,
1737 mut depth: fidl::encoding::Depth,
1738 ) -> fidl::Result<()> {
1739 decoder.debug_check_bounds::<Self>(offset);
1740 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1741 None => return Err(fidl::Error::NotNullable),
1742 Some(len) => len,
1743 };
1744 if len == 0 {
1746 return Ok(());
1747 };
1748 depth.increment()?;
1749 let envelope_size = 8;
1750 let bytes_len = len * envelope_size;
1751 let offset = decoder.out_of_line_offset(bytes_len)?;
1752 let mut _next_ordinal_to_read = 0;
1754 let mut next_offset = offset;
1755 let end_offset = offset + bytes_len;
1756 _next_ordinal_to_read += 1;
1757 if next_offset >= end_offset {
1758 return Ok(());
1759 }
1760
1761 while _next_ordinal_to_read < 1 {
1763 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1764 _next_ordinal_to_read += 1;
1765 next_offset += envelope_size;
1766 }
1767
1768 let next_out_of_line = decoder.next_out_of_line();
1769 let handles_before = decoder.remaining_handles();
1770 if let Some((inlined, num_bytes, num_handles)) =
1771 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1772 {
1773 let member_inline_size = <fidl::encoding::HandleType<
1774 fidl::Socket,
1775 { fidl::ObjectType::SOCKET.into_raw() },
1776 2147483648,
1777 > as fidl::encoding::TypeMarker>::inline_size(
1778 decoder.context
1779 );
1780 if inlined != (member_inline_size <= 4) {
1781 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1782 }
1783 let inner_offset;
1784 let mut inner_depth = depth.clone();
1785 if inlined {
1786 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1787 inner_offset = next_offset;
1788 } else {
1789 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1790 inner_depth.increment()?;
1791 }
1792 let val_ref =
1793 self.output.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1794 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1795 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1796 {
1797 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1798 }
1799 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1800 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1801 }
1802 }
1803
1804 next_offset += envelope_size;
1805 _next_ordinal_to_read += 1;
1806 if next_offset >= end_offset {
1807 return Ok(());
1808 }
1809
1810 while _next_ordinal_to_read < 2 {
1812 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1813 _next_ordinal_to_read += 1;
1814 next_offset += envelope_size;
1815 }
1816
1817 let next_out_of_line = decoder.next_out_of_line();
1818 let handles_before = decoder.remaining_handles();
1819 if let Some((inlined, num_bytes, num_handles)) =
1820 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1821 {
1822 let member_inline_size =
1823 <Config as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1824 if inlined != (member_inline_size <= 4) {
1825 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1826 }
1827 let inner_offset;
1828 let mut inner_depth = depth.clone();
1829 if inlined {
1830 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1831 inner_offset = next_offset;
1832 } else {
1833 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1834 inner_depth.increment()?;
1835 }
1836 let val_ref = self.config.get_or_insert_with(|| {
1837 fidl::new_empty!(Config, fidl::encoding::DefaultFuchsiaResourceDialect)
1838 });
1839 fidl::decode!(
1840 Config,
1841 fidl::encoding::DefaultFuchsiaResourceDialect,
1842 val_ref,
1843 decoder,
1844 inner_offset,
1845 inner_depth
1846 )?;
1847 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1848 {
1849 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1850 }
1851 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1852 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1853 }
1854 }
1855
1856 next_offset += envelope_size;
1857
1858 while next_offset < end_offset {
1860 _next_ordinal_to_read += 1;
1861 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1862 next_offset += envelope_size;
1863 }
1864
1865 Ok(())
1866 }
1867 }
1868
1869 impl fidl::encoding::ResourceTypeMarker for AttachConfig {
1870 type Borrowed<'a> = &'a mut Self;
1871 fn take_or_borrow<'a>(
1872 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1873 ) -> Self::Borrowed<'a> {
1874 value
1875 }
1876 }
1877
1878 unsafe impl fidl::encoding::TypeMarker for AttachConfig {
1879 type Owned = Self;
1880
1881 #[inline(always)]
1882 fn inline_align(_context: fidl::encoding::Context) -> usize {
1883 8
1884 }
1885
1886 #[inline(always)]
1887 fn inline_size(_context: fidl::encoding::Context) -> usize {
1888 16
1889 }
1890 }
1891
1892 unsafe impl fidl::encoding::Encode<AttachConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1893 for &mut AttachConfig
1894 {
1895 #[inline]
1896 unsafe fn encode(
1897 self,
1898 encoder: &mut fidl::encoding::Encoder<
1899 '_,
1900 fidl::encoding::DefaultFuchsiaResourceDialect,
1901 >,
1902 offset: usize,
1903 _depth: fidl::encoding::Depth,
1904 ) -> fidl::Result<()> {
1905 encoder.debug_check_bounds::<AttachConfig>(offset);
1906 encoder.write_num::<u64>(self.ordinal(), offset);
1907 match self {
1908 AttachConfig::LaunchComponent(ref val) => {
1909 fidl::encoding::encode_in_envelope::<LaunchComponent, fidl::encoding::DefaultFuchsiaResourceDialect>(
1910 <LaunchComponent as fidl::encoding::ValueTypeMarker>::borrow(val),
1911 encoder, offset + 8, _depth
1912 )
1913 }
1914 AttachConfig::AttachToComponentMoniker(ref val) => {
1915 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1916 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
1917 encoder, offset + 8, _depth
1918 )
1919 }
1920 AttachConfig::AttachToComponentUrl(ref val) => {
1921 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1922 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
1923 encoder, offset + 8, _depth
1924 )
1925 }
1926 AttachConfig::LaunchTest(ref mut val) => {
1927 fidl::encoding::encode_in_envelope::<LaunchTest, fidl::encoding::DefaultFuchsiaResourceDialect>(
1928 <LaunchTest as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
1929 encoder, offset + 8, _depth
1930 )
1931 }
1932 AttachConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1933 }
1934 }
1935 }
1936
1937 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for AttachConfig {
1938 #[inline(always)]
1939 fn new_empty() -> Self {
1940 Self::__SourceBreaking { unknown_ordinal: 0 }
1941 }
1942
1943 #[inline]
1944 unsafe fn decode(
1945 &mut self,
1946 decoder: &mut fidl::encoding::Decoder<
1947 '_,
1948 fidl::encoding::DefaultFuchsiaResourceDialect,
1949 >,
1950 offset: usize,
1951 mut depth: fidl::encoding::Depth,
1952 ) -> fidl::Result<()> {
1953 decoder.debug_check_bounds::<Self>(offset);
1954 #[allow(unused_variables)]
1955 let next_out_of_line = decoder.next_out_of_line();
1956 let handles_before = decoder.remaining_handles();
1957 let (ordinal, inlined, num_bytes, num_handles) =
1958 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1959
1960 let member_inline_size = match ordinal {
1961 1 => <LaunchComponent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1962 2 => {
1963 <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
1964 decoder.context,
1965 )
1966 }
1967 3 => {
1968 <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
1969 decoder.context,
1970 )
1971 }
1972 4 => <LaunchTest as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1973 0 => return Err(fidl::Error::UnknownUnionTag),
1974 _ => num_bytes as usize,
1975 };
1976
1977 if inlined != (member_inline_size <= 4) {
1978 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1979 }
1980 let _inner_offset;
1981 if inlined {
1982 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1983 _inner_offset = offset + 8;
1984 } else {
1985 depth.increment()?;
1986 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1987 }
1988 match ordinal {
1989 1 => {
1990 #[allow(irrefutable_let_patterns)]
1991 if let AttachConfig::LaunchComponent(_) = self {
1992 } else {
1994 *self = AttachConfig::LaunchComponent(fidl::new_empty!(
1996 LaunchComponent,
1997 fidl::encoding::DefaultFuchsiaResourceDialect
1998 ));
1999 }
2000 #[allow(irrefutable_let_patterns)]
2001 if let AttachConfig::LaunchComponent(ref mut val) = self {
2002 fidl::decode!(
2003 LaunchComponent,
2004 fidl::encoding::DefaultFuchsiaResourceDialect,
2005 val,
2006 decoder,
2007 _inner_offset,
2008 depth
2009 )?;
2010 } else {
2011 unreachable!()
2012 }
2013 }
2014 2 => {
2015 #[allow(irrefutable_let_patterns)]
2016 if let AttachConfig::AttachToComponentMoniker(_) = self {
2017 } else {
2019 *self = AttachConfig::AttachToComponentMoniker(fidl::new_empty!(
2021 fidl::encoding::BoundedString<4096>,
2022 fidl::encoding::DefaultFuchsiaResourceDialect
2023 ));
2024 }
2025 #[allow(irrefutable_let_patterns)]
2026 if let AttachConfig::AttachToComponentMoniker(ref mut val) = self {
2027 fidl::decode!(
2028 fidl::encoding::BoundedString<4096>,
2029 fidl::encoding::DefaultFuchsiaResourceDialect,
2030 val,
2031 decoder,
2032 _inner_offset,
2033 depth
2034 )?;
2035 } else {
2036 unreachable!()
2037 }
2038 }
2039 3 => {
2040 #[allow(irrefutable_let_patterns)]
2041 if let AttachConfig::AttachToComponentUrl(_) = self {
2042 } else {
2044 *self = AttachConfig::AttachToComponentUrl(fidl::new_empty!(
2046 fidl::encoding::BoundedString<4096>,
2047 fidl::encoding::DefaultFuchsiaResourceDialect
2048 ));
2049 }
2050 #[allow(irrefutable_let_patterns)]
2051 if let AttachConfig::AttachToComponentUrl(ref mut val) = self {
2052 fidl::decode!(
2053 fidl::encoding::BoundedString<4096>,
2054 fidl::encoding::DefaultFuchsiaResourceDialect,
2055 val,
2056 decoder,
2057 _inner_offset,
2058 depth
2059 )?;
2060 } else {
2061 unreachable!()
2062 }
2063 }
2064 4 => {
2065 #[allow(irrefutable_let_patterns)]
2066 if let AttachConfig::LaunchTest(_) = self {
2067 } else {
2069 *self = AttachConfig::LaunchTest(fidl::new_empty!(
2071 LaunchTest,
2072 fidl::encoding::DefaultFuchsiaResourceDialect
2073 ));
2074 }
2075 #[allow(irrefutable_let_patterns)]
2076 if let AttachConfig::LaunchTest(ref mut val) = self {
2077 fidl::decode!(
2078 LaunchTest,
2079 fidl::encoding::DefaultFuchsiaResourceDialect,
2080 val,
2081 decoder,
2082 _inner_offset,
2083 depth
2084 )?;
2085 } else {
2086 unreachable!()
2087 }
2088 }
2089 #[allow(deprecated)]
2090 ordinal => {
2091 for _ in 0..num_handles {
2092 decoder.drop_next_handle()?;
2093 }
2094 *self = AttachConfig::__SourceBreaking { unknown_ordinal: ordinal };
2095 }
2096 }
2097 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2098 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2099 }
2100 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2101 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2102 }
2103 Ok(())
2104 }
2105 }
2106
2107 impl fidl::encoding::ResourceTypeMarker for TargetConfig {
2108 type Borrowed<'a> = &'a mut Self;
2109 fn take_or_borrow<'a>(
2110 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2111 ) -> Self::Borrowed<'a> {
2112 value
2113 }
2114 }
2115
2116 unsafe impl fidl::encoding::TypeMarker for TargetConfig {
2117 type Owned = Self;
2118
2119 #[inline(always)]
2120 fn inline_align(_context: fidl::encoding::Context) -> usize {
2121 8
2122 }
2123
2124 #[inline(always)]
2125 fn inline_size(_context: fidl::encoding::Context) -> usize {
2126 16
2127 }
2128 }
2129
2130 unsafe impl fidl::encoding::Encode<TargetConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
2131 for &mut TargetConfig
2132 {
2133 #[inline]
2134 unsafe fn encode(
2135 self,
2136 encoder: &mut fidl::encoding::Encoder<
2137 '_,
2138 fidl::encoding::DefaultFuchsiaResourceDialect,
2139 >,
2140 offset: usize,
2141 _depth: fidl::encoding::Depth,
2142 ) -> fidl::Result<()> {
2143 encoder.debug_check_bounds::<TargetConfig>(offset);
2144 encoder.write_num::<u64>(self.ordinal(), offset);
2145 match self {
2146 TargetConfig::Tasks(ref val) => fidl::encoding::encode_in_envelope::<
2147 fidl::encoding::Vector<Task, 64>,
2148 fidl::encoding::DefaultFuchsiaResourceDialect,
2149 >(
2150 <fidl::encoding::Vector<Task, 64> as fidl::encoding::ValueTypeMarker>::borrow(
2151 val,
2152 ),
2153 encoder,
2154 offset + 8,
2155 _depth,
2156 ),
2157 TargetConfig::Component(ref mut val) => fidl::encoding::encode_in_envelope::<
2158 AttachConfig,
2159 fidl::encoding::DefaultFuchsiaResourceDialect,
2160 >(
2161 <AttachConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2162 encoder,
2163 offset + 8,
2164 _depth,
2165 ),
2166 TargetConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2167 }
2168 }
2169 }
2170
2171 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for TargetConfig {
2172 #[inline(always)]
2173 fn new_empty() -> Self {
2174 Self::__SourceBreaking { unknown_ordinal: 0 }
2175 }
2176
2177 #[inline]
2178 unsafe fn decode(
2179 &mut self,
2180 decoder: &mut fidl::encoding::Decoder<
2181 '_,
2182 fidl::encoding::DefaultFuchsiaResourceDialect,
2183 >,
2184 offset: usize,
2185 mut depth: fidl::encoding::Depth,
2186 ) -> fidl::Result<()> {
2187 decoder.debug_check_bounds::<Self>(offset);
2188 #[allow(unused_variables)]
2189 let next_out_of_line = decoder.next_out_of_line();
2190 let handles_before = decoder.remaining_handles();
2191 let (ordinal, inlined, num_bytes, num_handles) =
2192 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2193
2194 let member_inline_size = match ordinal {
2195 1 => <fidl::encoding::Vector<Task, 64> as fidl::encoding::TypeMarker>::inline_size(
2196 decoder.context,
2197 ),
2198 2 => <AttachConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2199 0 => return Err(fidl::Error::UnknownUnionTag),
2200 _ => num_bytes as usize,
2201 };
2202
2203 if inlined != (member_inline_size <= 4) {
2204 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2205 }
2206 let _inner_offset;
2207 if inlined {
2208 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2209 _inner_offset = offset + 8;
2210 } else {
2211 depth.increment()?;
2212 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2213 }
2214 match ordinal {
2215 1 => {
2216 #[allow(irrefutable_let_patterns)]
2217 if let TargetConfig::Tasks(_) = self {
2218 } else {
2220 *self = TargetConfig::Tasks(
2222 fidl::new_empty!(fidl::encoding::Vector<Task, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
2223 );
2224 }
2225 #[allow(irrefutable_let_patterns)]
2226 if let TargetConfig::Tasks(ref mut val) = self {
2227 fidl::decode!(fidl::encoding::Vector<Task, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2228 } else {
2229 unreachable!()
2230 }
2231 }
2232 2 => {
2233 #[allow(irrefutable_let_patterns)]
2234 if let TargetConfig::Component(_) = self {
2235 } else {
2237 *self = TargetConfig::Component(fidl::new_empty!(
2239 AttachConfig,
2240 fidl::encoding::DefaultFuchsiaResourceDialect
2241 ));
2242 }
2243 #[allow(irrefutable_let_patterns)]
2244 if let TargetConfig::Component(ref mut val) = self {
2245 fidl::decode!(
2246 AttachConfig,
2247 fidl::encoding::DefaultFuchsiaResourceDialect,
2248 val,
2249 decoder,
2250 _inner_offset,
2251 depth
2252 )?;
2253 } else {
2254 unreachable!()
2255 }
2256 }
2257 #[allow(deprecated)]
2258 ordinal => {
2259 for _ in 0..num_handles {
2260 decoder.drop_next_handle()?;
2261 }
2262 *self = TargetConfig::__SourceBreaking { unknown_ordinal: ordinal };
2263 }
2264 }
2265 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2266 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2267 }
2268 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2269 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2270 }
2271 Ok(())
2272 }
2273 }
2274}