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