Skip to main content

fidl_fuchsia_cpu_profiler/
fidl_fuchsia_cpu_profiler.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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/// SamplingConfig to the TargetConfig.
15#[derive(Debug, Default, PartialEq)]
16pub struct Config {
17    pub configs: Option<Vec<SamplingConfig>>,
18    pub target: Option<TargetConfig>,
19    #[doc(hidden)]
20    pub __source_breaking: fidl::marker::SourceBreaking,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Config {}
24
25#[derive(Debug, Default, PartialEq)]
26pub struct LaunchTest {
27    /// The url of the test to launch.
28    pub url: Option<String>,
29    /// Options specifying how the suite should be run
30    pub options: Option<fidl_fuchsia_test_manager::RunSuiteOptions>,
31    #[doc(hidden)]
32    pub __source_breaking: fidl::marker::SourceBreaking,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchTest {}
36
37#[derive(Debug, Default, PartialEq)]
38pub struct SessionConfigureRequest {
39    pub output: Option<fidl::Socket>,
40    pub config: Option<Config>,
41    #[doc(hidden)]
42    pub __source_breaking: fidl::marker::SourceBreaking,
43}
44
45impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionConfigureRequest {}
46
47#[derive(Debug, Default, PartialEq)]
48pub struct SessionManagerStartSessionRequest {
49    /// The profiling configuration.
50    pub config: Option<Config>,
51    #[doc(hidden)]
52    pub __source_breaking: fidl::marker::SourceBreaking,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
56    for SessionManagerStartSessionRequest
57{
58}
59
60#[derive(Debug, Default, PartialEq)]
61pub struct SessionManagerStopSessionRequest {
62    /// The ID of the session to retrieve.
63    pub task_id: Option<u64>,
64    /// The socket to write the profile data into.
65    pub output: Option<fidl::Socket>,
66    #[doc(hidden)]
67    pub __source_breaking: fidl::marker::SourceBreaking,
68}
69
70impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
71    for SessionManagerStopSessionRequest
72{
73}
74
75/// A component to optionally launch and attach to
76#[derive(Debug)]
77pub enum AttachConfig {
78    /// Launch a component with the given url and moniker then attach to it when
79    /// it's launched
80    LaunchComponent(LaunchComponent),
81    /// Attach to an existing component by moniker. If a component doesn't exist
82    /// at that moniker, wait for it to appear and attach to it when it does.
83    AttachToComponentMoniker(String),
84    /// Attach to an existing component by url. If the component doesn't
85    /// exist with the specified url, wait for it to appear and attach to it when
86    /// it does.
87    AttachToComponentUrl(String),
88    /// Connect to test_manager, launch a test with the given url, then attach
89    /// to it. Forwards the url and options to
90    /// `fuchsia.test.manager.SuiteRunner.Run`
91    LaunchTest(LaunchTest),
92    #[doc(hidden)]
93    __SourceBreaking { unknown_ordinal: u64 },
94}
95
96/// Pattern that matches an unknown `AttachConfig` member.
97#[macro_export]
98macro_rules! AttachConfigUnknown {
99    () => {
100        _
101    };
102}
103
104// Custom PartialEq so that unknown variants are not equal to themselves.
105impl PartialEq for AttachConfig {
106    fn eq(&self, other: &Self) -> bool {
107        match (self, other) {
108            (Self::LaunchComponent(x), Self::LaunchComponent(y)) => *x == *y,
109            (Self::AttachToComponentMoniker(x), Self::AttachToComponentMoniker(y)) => *x == *y,
110            (Self::AttachToComponentUrl(x), Self::AttachToComponentUrl(y)) => *x == *y,
111            (Self::LaunchTest(x), Self::LaunchTest(y)) => *x == *y,
112            _ => false,
113        }
114    }
115}
116
117impl AttachConfig {
118    #[inline]
119    pub fn ordinal(&self) -> u64 {
120        match *self {
121            Self::LaunchComponent(_) => 1,
122            Self::AttachToComponentMoniker(_) => 2,
123            Self::AttachToComponentUrl(_) => 3,
124            Self::LaunchTest(_) => 4,
125            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
126        }
127    }
128
129    #[inline]
130    pub fn unknown_variant_for_testing() -> Self {
131        Self::__SourceBreaking { unknown_ordinal: 0 }
132    }
133
134    #[inline]
135    pub fn is_unknown(&self) -> bool {
136        match self {
137            Self::__SourceBreaking { .. } => true,
138            _ => false,
139        }
140    }
141}
142
143impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AttachConfig {}
144
145/// A target may be an adhoc set of tasks, or one defined by a component/test
146#[derive(Debug)]
147pub enum TargetConfig {
148    /// An adhoc set of threads/processes/jobs
149    Tasks(Vec<Task>),
150    /// Profile a component and all tasks it launches
151    Component(AttachConfig),
152    #[doc(hidden)]
153    __SourceBreaking { unknown_ordinal: u64 },
154}
155
156/// Pattern that matches an unknown `TargetConfig` member.
157#[macro_export]
158macro_rules! TargetConfigUnknown {
159    () => {
160        _
161    };
162}
163
164// Custom PartialEq so that unknown variants are not equal to themselves.
165impl PartialEq for TargetConfig {
166    fn eq(&self, other: &Self) -> bool {
167        match (self, other) {
168            (Self::Tasks(x), Self::Tasks(y)) => *x == *y,
169            (Self::Component(x), Self::Component(y)) => *x == *y,
170            _ => false,
171        }
172    }
173}
174
175impl TargetConfig {
176    #[inline]
177    pub fn ordinal(&self) -> u64 {
178        match *self {
179            Self::Tasks(_) => 1,
180            Self::Component(_) => 2,
181            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
182        }
183    }
184
185    #[inline]
186    pub fn unknown_variant_for_testing() -> Self {
187        Self::__SourceBreaking { unknown_ordinal: 0 }
188    }
189
190    #[inline]
191    pub fn is_unknown(&self) -> bool {
192        match self {
193            Self::__SourceBreaking { .. } => true,
194            _ => false,
195        }
196    }
197}
198
199impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TargetConfig {}
200
201#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
202pub struct SessionMarker;
203
204impl fidl::endpoints::ProtocolMarker for SessionMarker {
205    type Proxy = SessionProxy;
206    type RequestStream = SessionRequestStream;
207    #[cfg(target_os = "fuchsia")]
208    type SynchronousProxy = SessionSynchronousProxy;
209
210    const DEBUG_NAME: &'static str = "fuchsia.cpu.profiler.Session";
211}
212impl fidl::endpoints::DiscoverableProtocolMarker for SessionMarker {}
213pub type SessionConfigureResult = Result<(), SessionConfigureError>;
214pub type SessionStartResult = Result<(), SessionStartError>;
215
216pub trait SessionProxyInterface: Send + Sync {
217    type ConfigureResponseFut: std::future::Future<Output = Result<SessionConfigureResult, fidl::Error>>
218        + Send;
219    fn r#configure(&self, payload: SessionConfigureRequest) -> Self::ConfigureResponseFut;
220    type StartResponseFut: std::future::Future<Output = Result<SessionStartResult, fidl::Error>>
221        + Send;
222    fn r#start(&self, payload: &SessionStartRequest) -> Self::StartResponseFut;
223    type StopResponseFut: std::future::Future<Output = Result<SessionResult, fidl::Error>> + Send;
224    fn r#stop(&self) -> Self::StopResponseFut;
225    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
226    fn r#reset(&self) -> Self::ResetResponseFut;
227}
228#[derive(Debug)]
229#[cfg(target_os = "fuchsia")]
230pub struct SessionSynchronousProxy {
231    client: fidl::client::sync::Client,
232}
233
234#[cfg(target_os = "fuchsia")]
235impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
236    type Proxy = SessionProxy;
237    type Protocol = SessionMarker;
238
239    fn from_channel(inner: fidl::Channel) -> Self {
240        Self::new(inner)
241    }
242
243    fn into_channel(self) -> fidl::Channel {
244        self.client.into_channel()
245    }
246
247    fn as_channel(&self) -> &fidl::Channel {
248        self.client.as_channel()
249    }
250}
251
252#[cfg(target_os = "fuchsia")]
253impl SessionSynchronousProxy {
254    pub fn new(channel: fidl::Channel) -> Self {
255        Self { client: fidl::client::sync::Client::new(channel) }
256    }
257
258    pub fn into_channel(self) -> fidl::Channel {
259        self.client.into_channel()
260    }
261
262    /// Waits until an event arrives and returns it. It is safe for other
263    /// threads to make concurrent requests while waiting for an event.
264    pub fn wait_for_event(
265        &self,
266        deadline: zx::MonotonicInstant,
267    ) -> Result<SessionEvent, fidl::Error> {
268        SessionEvent::decode(self.client.wait_for_event::<SessionMarker>(deadline)?)
269    }
270
271    /// Set up and prepare to profile
272    pub fn r#configure(
273        &self,
274        mut payload: SessionConfigureRequest,
275        ___deadline: zx::MonotonicInstant,
276    ) -> Result<SessionConfigureResult, fidl::Error> {
277        let _response =
278            self.client.send_query::<SessionConfigureRequest, fidl::encoding::ResultType<
279                fidl::encoding::EmptyStruct,
280                SessionConfigureError,
281            >, SessionMarker>(
282                &mut payload,
283                0x67e7e28a9b959ce8,
284                fidl::encoding::DynamicFlags::empty(),
285                ___deadline,
286            )?;
287        Ok(_response.map(|x| x))
288    }
289
290    /// Begin profiling and optionally begin writing data to the configured
291    /// socket
292    pub fn r#start(
293        &self,
294        mut payload: &SessionStartRequest,
295        ___deadline: zx::MonotonicInstant,
296    ) -> Result<SessionStartResult, fidl::Error> {
297        let _response = self.client.send_query::<SessionStartRequest, fidl::encoding::ResultType<
298            fidl::encoding::EmptyStruct,
299            SessionStartError,
300        >, SessionMarker>(
301            payload,
302            0x4e82f9133a968ad5,
303            fidl::encoding::DynamicFlags::empty(),
304            ___deadline,
305        )?;
306        Ok(_response.map(|x| x))
307    }
308
309    /// End the profiling session and write out data to the earlier
310    /// configured socket if not already writing.
311    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<SessionResult, fidl::Error> {
312        let _response =
313            self.client.send_query::<fidl::encoding::EmptyPayload, SessionResult, SessionMarker>(
314                (),
315                0x76aa8dd59cb61e89,
316                fidl::encoding::DynamicFlags::empty(),
317                ___deadline,
318            )?;
319        Ok(_response)
320    }
321
322    /// Clean up and unconfigure the profiler. Flushes the remaining data and
323    /// closes the provided socket. Doesn't return until all data has been
324    /// successfully written.
325    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
326        let _response = self.client.send_query::<
327            fidl::encoding::EmptyPayload,
328            fidl::encoding::EmptyPayload,
329            SessionMarker,
330        >(
331            (),
332            0x5f522fde537356fa,
333            fidl::encoding::DynamicFlags::empty(),
334            ___deadline,
335        )?;
336        Ok(_response)
337    }
338}
339
340#[cfg(target_os = "fuchsia")]
341impl From<SessionSynchronousProxy> for zx::NullableHandle {
342    fn from(value: SessionSynchronousProxy) -> Self {
343        value.into_channel().into()
344    }
345}
346
347#[cfg(target_os = "fuchsia")]
348impl From<fidl::Channel> for SessionSynchronousProxy {
349    fn from(value: fidl::Channel) -> Self {
350        Self::new(value)
351    }
352}
353
354#[cfg(target_os = "fuchsia")]
355impl fidl::endpoints::FromClient for SessionSynchronousProxy {
356    type Protocol = SessionMarker;
357
358    fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
359        Self::new(value.into_channel())
360    }
361}
362
363#[derive(Debug, Clone)]
364pub struct SessionProxy {
365    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
366}
367
368impl fidl::endpoints::Proxy for SessionProxy {
369    type Protocol = SessionMarker;
370
371    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
372        Self::new(inner)
373    }
374
375    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
376        self.client.into_channel().map_err(|client| Self { client })
377    }
378
379    fn as_channel(&self) -> &::fidl::AsyncChannel {
380        self.client.as_channel()
381    }
382}
383
384impl SessionProxy {
385    /// Create a new Proxy for fuchsia.cpu.profiler/Session.
386    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
387        let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
388        Self { client: fidl::client::Client::new(channel, protocol_name) }
389    }
390
391    /// Get a Stream of events from the remote end of the protocol.
392    ///
393    /// # Panics
394    ///
395    /// Panics if the event stream was already taken.
396    pub fn take_event_stream(&self) -> SessionEventStream {
397        SessionEventStream { event_receiver: self.client.take_event_receiver() }
398    }
399
400    /// Set up and prepare to profile
401    pub fn r#configure(
402        &self,
403        mut payload: SessionConfigureRequest,
404    ) -> fidl::client::QueryResponseFut<
405        SessionConfigureResult,
406        fidl::encoding::DefaultFuchsiaResourceDialect,
407    > {
408        SessionProxyInterface::r#configure(self, payload)
409    }
410
411    /// Begin profiling and optionally begin writing data to the configured
412    /// socket
413    pub fn r#start(
414        &self,
415        mut payload: &SessionStartRequest,
416    ) -> fidl::client::QueryResponseFut<
417        SessionStartResult,
418        fidl::encoding::DefaultFuchsiaResourceDialect,
419    > {
420        SessionProxyInterface::r#start(self, payload)
421    }
422
423    /// End the profiling session and write out data to the earlier
424    /// configured socket if not already writing.
425    pub fn r#stop(
426        &self,
427    ) -> fidl::client::QueryResponseFut<SessionResult, fidl::encoding::DefaultFuchsiaResourceDialect>
428    {
429        SessionProxyInterface::r#stop(self)
430    }
431
432    /// Clean up and unconfigure the profiler. Flushes the remaining data and
433    /// closes the provided socket. Doesn't return until all data has been
434    /// successfully written.
435    pub fn r#reset(
436        &self,
437    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
438        SessionProxyInterface::r#reset(self)
439    }
440}
441
442impl SessionProxyInterface for SessionProxy {
443    type ConfigureResponseFut = fidl::client::QueryResponseFut<
444        SessionConfigureResult,
445        fidl::encoding::DefaultFuchsiaResourceDialect,
446    >;
447    fn r#configure(&self, mut payload: SessionConfigureRequest) -> Self::ConfigureResponseFut {
448        fn _decode(
449            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
450        ) -> Result<SessionConfigureResult, fidl::Error> {
451            let _response = fidl::client::decode_transaction_body::<
452                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SessionConfigureError>,
453                fidl::encoding::DefaultFuchsiaResourceDialect,
454                0x67e7e28a9b959ce8,
455            >(_buf?)?;
456            Ok(_response.map(|x| x))
457        }
458        self.client.send_query_and_decode::<SessionConfigureRequest, SessionConfigureResult>(
459            &mut payload,
460            0x67e7e28a9b959ce8,
461            fidl::encoding::DynamicFlags::empty(),
462            _decode,
463        )
464    }
465
466    type StartResponseFut = fidl::client::QueryResponseFut<
467        SessionStartResult,
468        fidl::encoding::DefaultFuchsiaResourceDialect,
469    >;
470    fn r#start(&self, mut payload: &SessionStartRequest) -> Self::StartResponseFut {
471        fn _decode(
472            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
473        ) -> Result<SessionStartResult, fidl::Error> {
474            let _response = fidl::client::decode_transaction_body::<
475                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SessionStartError>,
476                fidl::encoding::DefaultFuchsiaResourceDialect,
477                0x4e82f9133a968ad5,
478            >(_buf?)?;
479            Ok(_response.map(|x| x))
480        }
481        self.client.send_query_and_decode::<SessionStartRequest, SessionStartResult>(
482            payload,
483            0x4e82f9133a968ad5,
484            fidl::encoding::DynamicFlags::empty(),
485            _decode,
486        )
487    }
488
489    type StopResponseFut = fidl::client::QueryResponseFut<
490        SessionResult,
491        fidl::encoding::DefaultFuchsiaResourceDialect,
492    >;
493    fn r#stop(&self) -> Self::StopResponseFut {
494        fn _decode(
495            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
496        ) -> Result<SessionResult, fidl::Error> {
497            let _response = fidl::client::decode_transaction_body::<
498                SessionResult,
499                fidl::encoding::DefaultFuchsiaResourceDialect,
500                0x76aa8dd59cb61e89,
501            >(_buf?)?;
502            Ok(_response)
503        }
504        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionResult>(
505            (),
506            0x76aa8dd59cb61e89,
507            fidl::encoding::DynamicFlags::empty(),
508            _decode,
509        )
510    }
511
512    type ResetResponseFut =
513        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
514    fn r#reset(&self) -> Self::ResetResponseFut {
515        fn _decode(
516            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
517        ) -> Result<(), fidl::Error> {
518            let _response = fidl::client::decode_transaction_body::<
519                fidl::encoding::EmptyPayload,
520                fidl::encoding::DefaultFuchsiaResourceDialect,
521                0x5f522fde537356fa,
522            >(_buf?)?;
523            Ok(_response)
524        }
525        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
526            (),
527            0x5f522fde537356fa,
528            fidl::encoding::DynamicFlags::empty(),
529            _decode,
530        )
531    }
532}
533
534pub struct SessionEventStream {
535    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
536}
537
538impl std::marker::Unpin for SessionEventStream {}
539
540impl futures::stream::FusedStream for SessionEventStream {
541    fn is_terminated(&self) -> bool {
542        self.event_receiver.is_terminated()
543    }
544}
545
546impl futures::Stream for SessionEventStream {
547    type Item = Result<SessionEvent, fidl::Error>;
548
549    fn poll_next(
550        mut self: std::pin::Pin<&mut Self>,
551        cx: &mut std::task::Context<'_>,
552    ) -> std::task::Poll<Option<Self::Item>> {
553        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
554            &mut self.event_receiver,
555            cx
556        )?) {
557            Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
558            None => std::task::Poll::Ready(None),
559        }
560    }
561}
562
563#[derive(Debug)]
564pub enum SessionEvent {}
565
566impl SessionEvent {
567    /// Decodes a message buffer as a [`SessionEvent`].
568    fn decode(
569        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
570    ) -> Result<SessionEvent, fidl::Error> {
571        let (bytes, _handles) = buf.split_mut();
572        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
573        debug_assert_eq!(tx_header.tx_id, 0);
574        match tx_header.ordinal {
575            _ => Err(fidl::Error::UnknownOrdinal {
576                ordinal: tx_header.ordinal,
577                protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
578            }),
579        }
580    }
581}
582
583/// A Stream of incoming requests for fuchsia.cpu.profiler/Session.
584pub struct SessionRequestStream {
585    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
586    is_terminated: bool,
587}
588
589impl std::marker::Unpin for SessionRequestStream {}
590
591impl futures::stream::FusedStream for SessionRequestStream {
592    fn is_terminated(&self) -> bool {
593        self.is_terminated
594    }
595}
596
597impl fidl::endpoints::RequestStream for SessionRequestStream {
598    type Protocol = SessionMarker;
599    type ControlHandle = SessionControlHandle;
600
601    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
602        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
603    }
604
605    fn control_handle(&self) -> Self::ControlHandle {
606        SessionControlHandle { inner: self.inner.clone() }
607    }
608
609    fn into_inner(
610        self,
611    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
612    {
613        (self.inner, self.is_terminated)
614    }
615
616    fn from_inner(
617        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
618        is_terminated: bool,
619    ) -> Self {
620        Self { inner, is_terminated }
621    }
622}
623
624impl futures::Stream for SessionRequestStream {
625    type Item = Result<SessionRequest, fidl::Error>;
626
627    fn poll_next(
628        mut self: std::pin::Pin<&mut Self>,
629        cx: &mut std::task::Context<'_>,
630    ) -> std::task::Poll<Option<Self::Item>> {
631        let this = &mut *self;
632        if this.inner.check_shutdown(cx) {
633            this.is_terminated = true;
634            return std::task::Poll::Ready(None);
635        }
636        if this.is_terminated {
637            panic!("polled SessionRequestStream after completion");
638        }
639        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
640            |bytes, handles| {
641                match this.inner.channel().read_etc(cx, bytes, handles) {
642                    std::task::Poll::Ready(Ok(())) => {}
643                    std::task::Poll::Pending => return std::task::Poll::Pending,
644                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
645                        this.is_terminated = true;
646                        return std::task::Poll::Ready(None);
647                    }
648                    std::task::Poll::Ready(Err(e)) => {
649                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
650                            e.into(),
651                        ))));
652                    }
653                }
654
655                // A message has been received from the channel
656                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
657
658                std::task::Poll::Ready(Some(match header.ordinal {
659                    0x67e7e28a9b959ce8 => {
660                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
661                        let mut req = fidl::new_empty!(
662                            SessionConfigureRequest,
663                            fidl::encoding::DefaultFuchsiaResourceDialect
664                        );
665                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionConfigureRequest>(&header, _body_bytes, handles, &mut req)?;
666                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
667                        Ok(SessionRequest::Configure {
668                            payload: req,
669                            responder: SessionConfigureResponder {
670                                control_handle: std::mem::ManuallyDrop::new(control_handle),
671                                tx_id: header.tx_id,
672                            },
673                        })
674                    }
675                    0x4e82f9133a968ad5 => {
676                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
677                        let mut req = fidl::new_empty!(
678                            SessionStartRequest,
679                            fidl::encoding::DefaultFuchsiaResourceDialect
680                        );
681                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionStartRequest>(&header, _body_bytes, handles, &mut req)?;
682                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
683                        Ok(SessionRequest::Start {
684                            payload: req,
685                            responder: SessionStartResponder {
686                                control_handle: std::mem::ManuallyDrop::new(control_handle),
687                                tx_id: header.tx_id,
688                            },
689                        })
690                    }
691                    0x76aa8dd59cb61e89 => {
692                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
693                        let mut req = fidl::new_empty!(
694                            fidl::encoding::EmptyPayload,
695                            fidl::encoding::DefaultFuchsiaResourceDialect
696                        );
697                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
698                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
699                        Ok(SessionRequest::Stop {
700                            responder: SessionStopResponder {
701                                control_handle: std::mem::ManuallyDrop::new(control_handle),
702                                tx_id: header.tx_id,
703                            },
704                        })
705                    }
706                    0x5f522fde537356fa => {
707                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
708                        let mut req = fidl::new_empty!(
709                            fidl::encoding::EmptyPayload,
710                            fidl::encoding::DefaultFuchsiaResourceDialect
711                        );
712                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
713                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
714                        Ok(SessionRequest::Reset {
715                            responder: SessionResetResponder {
716                                control_handle: std::mem::ManuallyDrop::new(control_handle),
717                                tx_id: header.tx_id,
718                            },
719                        })
720                    }
721                    _ => Err(fidl::Error::UnknownOrdinal {
722                        ordinal: header.ordinal,
723                        protocol_name:
724                            <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
725                    }),
726                }))
727            },
728        )
729    }
730}
731
732#[derive(Debug)]
733pub enum SessionRequest {
734    /// Set up and prepare to profile
735    Configure { payload: SessionConfigureRequest, responder: SessionConfigureResponder },
736    /// Begin profiling and optionally begin writing data to the configured
737    /// socket
738    Start { payload: SessionStartRequest, responder: SessionStartResponder },
739    /// End the profiling session and write out data to the earlier
740    /// configured socket if not already writing.
741    Stop { responder: SessionStopResponder },
742    /// Clean up and unconfigure the profiler. Flushes the remaining data and
743    /// closes the provided socket. Doesn't return until all data has been
744    /// successfully written.
745    Reset { responder: SessionResetResponder },
746}
747
748impl SessionRequest {
749    #[allow(irrefutable_let_patterns)]
750    pub fn into_configure(self) -> Option<(SessionConfigureRequest, SessionConfigureResponder)> {
751        if let SessionRequest::Configure { payload, responder } = self {
752            Some((payload, responder))
753        } else {
754            None
755        }
756    }
757
758    #[allow(irrefutable_let_patterns)]
759    pub fn into_start(self) -> Option<(SessionStartRequest, SessionStartResponder)> {
760        if let SessionRequest::Start { payload, responder } = self {
761            Some((payload, responder))
762        } else {
763            None
764        }
765    }
766
767    #[allow(irrefutable_let_patterns)]
768    pub fn into_stop(self) -> Option<(SessionStopResponder)> {
769        if let SessionRequest::Stop { responder } = self { Some((responder)) } else { None }
770    }
771
772    #[allow(irrefutable_let_patterns)]
773    pub fn into_reset(self) -> Option<(SessionResetResponder)> {
774        if let SessionRequest::Reset { responder } = self { Some((responder)) } else { None }
775    }
776
777    /// Name of the method defined in FIDL
778    pub fn method_name(&self) -> &'static str {
779        match *self {
780            SessionRequest::Configure { .. } => "configure",
781            SessionRequest::Start { .. } => "start",
782            SessionRequest::Stop { .. } => "stop",
783            SessionRequest::Reset { .. } => "reset",
784        }
785    }
786}
787
788#[derive(Debug, Clone)]
789pub struct SessionControlHandle {
790    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
791}
792
793impl SessionControlHandle {
794    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
795        self.inner.shutdown_with_epitaph(status.into())
796    }
797}
798
799impl fidl::endpoints::ControlHandle for SessionControlHandle {
800    fn shutdown(&self) {
801        self.inner.shutdown()
802    }
803
804    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
805        self.inner.shutdown_with_epitaph(status)
806    }
807
808    fn is_closed(&self) -> bool {
809        self.inner.channel().is_closed()
810    }
811    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
812        self.inner.channel().on_closed()
813    }
814
815    #[cfg(target_os = "fuchsia")]
816    fn signal_peer(
817        &self,
818        clear_mask: zx::Signals,
819        set_mask: zx::Signals,
820    ) -> Result<(), zx_status::Status> {
821        use fidl::Peered;
822        self.inner.channel().signal_peer(clear_mask, set_mask)
823    }
824}
825
826impl SessionControlHandle {}
827
828#[must_use = "FIDL methods require a response to be sent"]
829#[derive(Debug)]
830pub struct SessionConfigureResponder {
831    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
832    tx_id: u32,
833}
834
835/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
836/// if the responder is dropped without sending a response, so that the client
837/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
838impl std::ops::Drop for SessionConfigureResponder {
839    fn drop(&mut self) {
840        self.control_handle.shutdown();
841        // Safety: drops once, never accessed again
842        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
843    }
844}
845
846impl fidl::endpoints::Responder for SessionConfigureResponder {
847    type ControlHandle = SessionControlHandle;
848
849    fn control_handle(&self) -> &SessionControlHandle {
850        &self.control_handle
851    }
852
853    fn drop_without_shutdown(mut self) {
854        // Safety: drops once, never accessed again due to mem::forget
855        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
856        // Prevent Drop from running (which would shut down the channel)
857        std::mem::forget(self);
858    }
859}
860
861impl SessionConfigureResponder {
862    /// Sends a response to the FIDL transaction.
863    ///
864    /// Sets the channel to shutdown if an error occurs.
865    pub fn send(self, mut result: Result<(), SessionConfigureError>) -> Result<(), fidl::Error> {
866        let _result = self.send_raw(result);
867        if _result.is_err() {
868            self.control_handle.shutdown();
869        }
870        self.drop_without_shutdown();
871        _result
872    }
873
874    /// Similar to "send" but does not shutdown the channel if an error occurs.
875    pub fn send_no_shutdown_on_err(
876        self,
877        mut result: Result<(), SessionConfigureError>,
878    ) -> Result<(), fidl::Error> {
879        let _result = self.send_raw(result);
880        self.drop_without_shutdown();
881        _result
882    }
883
884    fn send_raw(&self, mut result: Result<(), SessionConfigureError>) -> Result<(), fidl::Error> {
885        self.control_handle.inner.send::<fidl::encoding::ResultType<
886            fidl::encoding::EmptyStruct,
887            SessionConfigureError,
888        >>(
889            result,
890            self.tx_id,
891            0x67e7e28a9b959ce8,
892            fidl::encoding::DynamicFlags::empty(),
893        )
894    }
895}
896
897#[must_use = "FIDL methods require a response to be sent"]
898#[derive(Debug)]
899pub struct SessionStartResponder {
900    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
901    tx_id: u32,
902}
903
904/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
905/// if the responder is dropped without sending a response, so that the client
906/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
907impl std::ops::Drop for SessionStartResponder {
908    fn drop(&mut self) {
909        self.control_handle.shutdown();
910        // Safety: drops once, never accessed again
911        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
912    }
913}
914
915impl fidl::endpoints::Responder for SessionStartResponder {
916    type ControlHandle = SessionControlHandle;
917
918    fn control_handle(&self) -> &SessionControlHandle {
919        &self.control_handle
920    }
921
922    fn drop_without_shutdown(mut self) {
923        // Safety: drops once, never accessed again due to mem::forget
924        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
925        // Prevent Drop from running (which would shut down the channel)
926        std::mem::forget(self);
927    }
928}
929
930impl SessionStartResponder {
931    /// Sends a response to the FIDL transaction.
932    ///
933    /// Sets the channel to shutdown if an error occurs.
934    pub fn send(self, mut result: Result<(), SessionStartError>) -> Result<(), fidl::Error> {
935        let _result = self.send_raw(result);
936        if _result.is_err() {
937            self.control_handle.shutdown();
938        }
939        self.drop_without_shutdown();
940        _result
941    }
942
943    /// Similar to "send" but does not shutdown the channel if an error occurs.
944    pub fn send_no_shutdown_on_err(
945        self,
946        mut result: Result<(), SessionStartError>,
947    ) -> Result<(), fidl::Error> {
948        let _result = self.send_raw(result);
949        self.drop_without_shutdown();
950        _result
951    }
952
953    fn send_raw(&self, mut result: Result<(), SessionStartError>) -> Result<(), fidl::Error> {
954        self.control_handle.inner.send::<fidl::encoding::ResultType<
955            fidl::encoding::EmptyStruct,
956            SessionStartError,
957        >>(
958            result,
959            self.tx_id,
960            0x4e82f9133a968ad5,
961            fidl::encoding::DynamicFlags::empty(),
962        )
963    }
964}
965
966#[must_use = "FIDL methods require a response to be sent"]
967#[derive(Debug)]
968pub struct SessionStopResponder {
969    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
970    tx_id: u32,
971}
972
973/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
974/// if the responder is dropped without sending a response, so that the client
975/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
976impl std::ops::Drop for SessionStopResponder {
977    fn drop(&mut self) {
978        self.control_handle.shutdown();
979        // Safety: drops once, never accessed again
980        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
981    }
982}
983
984impl fidl::endpoints::Responder for SessionStopResponder {
985    type ControlHandle = SessionControlHandle;
986
987    fn control_handle(&self) -> &SessionControlHandle {
988        &self.control_handle
989    }
990
991    fn drop_without_shutdown(mut self) {
992        // Safety: drops once, never accessed again due to mem::forget
993        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
994        // Prevent Drop from running (which would shut down the channel)
995        std::mem::forget(self);
996    }
997}
998
999impl SessionStopResponder {
1000    /// Sends a response to the FIDL transaction.
1001    ///
1002    /// Sets the channel to shutdown if an error occurs.
1003    pub fn send(self, mut payload: &SessionResult) -> Result<(), fidl::Error> {
1004        let _result = self.send_raw(payload);
1005        if _result.is_err() {
1006            self.control_handle.shutdown();
1007        }
1008        self.drop_without_shutdown();
1009        _result
1010    }
1011
1012    /// Similar to "send" but does not shutdown the channel if an error occurs.
1013    pub fn send_no_shutdown_on_err(self, mut payload: &SessionResult) -> Result<(), fidl::Error> {
1014        let _result = self.send_raw(payload);
1015        self.drop_without_shutdown();
1016        _result
1017    }
1018
1019    fn send_raw(&self, mut payload: &SessionResult) -> Result<(), fidl::Error> {
1020        self.control_handle.inner.send::<SessionResult>(
1021            payload,
1022            self.tx_id,
1023            0x76aa8dd59cb61e89,
1024            fidl::encoding::DynamicFlags::empty(),
1025        )
1026    }
1027}
1028
1029#[must_use = "FIDL methods require a response to be sent"]
1030#[derive(Debug)]
1031pub struct SessionResetResponder {
1032    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1033    tx_id: u32,
1034}
1035
1036/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1037/// if the responder is dropped without sending a response, so that the client
1038/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1039impl std::ops::Drop for SessionResetResponder {
1040    fn drop(&mut self) {
1041        self.control_handle.shutdown();
1042        // Safety: drops once, never accessed again
1043        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1044    }
1045}
1046
1047impl fidl::endpoints::Responder for SessionResetResponder {
1048    type ControlHandle = SessionControlHandle;
1049
1050    fn control_handle(&self) -> &SessionControlHandle {
1051        &self.control_handle
1052    }
1053
1054    fn drop_without_shutdown(mut self) {
1055        // Safety: drops once, never accessed again due to mem::forget
1056        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1057        // Prevent Drop from running (which would shut down the channel)
1058        std::mem::forget(self);
1059    }
1060}
1061
1062impl SessionResetResponder {
1063    /// Sends a response to the FIDL transaction.
1064    ///
1065    /// Sets the channel to shutdown if an error occurs.
1066    pub fn send(self) -> Result<(), fidl::Error> {
1067        let _result = self.send_raw();
1068        if _result.is_err() {
1069            self.control_handle.shutdown();
1070        }
1071        self.drop_without_shutdown();
1072        _result
1073    }
1074
1075    /// Similar to "send" but does not shutdown the channel if an error occurs.
1076    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1077        let _result = self.send_raw();
1078        self.drop_without_shutdown();
1079        _result
1080    }
1081
1082    fn send_raw(&self) -> Result<(), fidl::Error> {
1083        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1084            (),
1085            self.tx_id,
1086            0x5f522fde537356fa,
1087            fidl::encoding::DynamicFlags::empty(),
1088        )
1089    }
1090}
1091
1092#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1093pub struct SessionManagerMarker;
1094
1095impl fidl::endpoints::ProtocolMarker for SessionManagerMarker {
1096    type Proxy = SessionManagerProxy;
1097    type RequestStream = SessionManagerRequestStream;
1098    #[cfg(target_os = "fuchsia")]
1099    type SynchronousProxy = SessionManagerSynchronousProxy;
1100
1101    const DEBUG_NAME: &'static str = "fuchsia.cpu.profiler.SessionManager";
1102}
1103impl fidl::endpoints::DiscoverableProtocolMarker for SessionManagerMarker {}
1104pub type SessionManagerStartSessionResult =
1105    Result<SessionManagerStartSessionResponse, ManagerError>;
1106pub type SessionManagerStopSessionResult = Result<SessionResult, ManagerError>;
1107pub type SessionManagerAbortSessionResult = Result<(), ManagerError>;
1108pub type SessionManagerStatusResult = Result<SessionManagerStatusResponse, ManagerError>;
1109pub type SessionManagerStartSessionOnBootResult = Result<(), ManagerError>;
1110
1111pub trait SessionManagerProxyInterface: Send + Sync {
1112    type ConfigureResponseFut: std::future::Future<Output = Result<SessionConfigureResult, fidl::Error>>
1113        + Send;
1114    fn r#configure(&self, payload: SessionConfigureRequest) -> Self::ConfigureResponseFut;
1115    type StartResponseFut: std::future::Future<Output = Result<SessionStartResult, fidl::Error>>
1116        + Send;
1117    fn r#start(&self, payload: &SessionStartRequest) -> Self::StartResponseFut;
1118    type StopResponseFut: std::future::Future<Output = Result<SessionResult, fidl::Error>> + Send;
1119    fn r#stop(&self) -> Self::StopResponseFut;
1120    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1121    fn r#reset(&self) -> Self::ResetResponseFut;
1122    type StartSessionResponseFut: std::future::Future<Output = Result<SessionManagerStartSessionResult, fidl::Error>>
1123        + Send;
1124    fn r#start_session(
1125        &self,
1126        payload: SessionManagerStartSessionRequest,
1127    ) -> Self::StartSessionResponseFut;
1128    type StopSessionResponseFut: std::future::Future<Output = Result<SessionManagerStopSessionResult, fidl::Error>>
1129        + Send;
1130    fn r#stop_session(
1131        &self,
1132        payload: SessionManagerStopSessionRequest,
1133    ) -> Self::StopSessionResponseFut;
1134    type AbortSessionResponseFut: std::future::Future<Output = Result<SessionManagerAbortSessionResult, fidl::Error>>
1135        + Send;
1136    fn r#abort_session(
1137        &self,
1138        payload: &SessionManagerAbortSessionRequest,
1139    ) -> Self::AbortSessionResponseFut;
1140    type StatusResponseFut: std::future::Future<Output = Result<SessionManagerStatusResult, fidl::Error>>
1141        + Send;
1142    fn r#status(&self) -> Self::StatusResponseFut;
1143    type StartSessionOnBootResponseFut: std::future::Future<Output = Result<SessionManagerStartSessionOnBootResult, fidl::Error>>
1144        + Send;
1145    fn r#start_session_on_boot(
1146        &self,
1147        payload: &SessionManagerStartSessionOnBootRequest,
1148    ) -> Self::StartSessionOnBootResponseFut;
1149}
1150#[derive(Debug)]
1151#[cfg(target_os = "fuchsia")]
1152pub struct SessionManagerSynchronousProxy {
1153    client: fidl::client::sync::Client,
1154}
1155
1156#[cfg(target_os = "fuchsia")]
1157impl fidl::endpoints::SynchronousProxy for SessionManagerSynchronousProxy {
1158    type Proxy = SessionManagerProxy;
1159    type Protocol = SessionManagerMarker;
1160
1161    fn from_channel(inner: fidl::Channel) -> Self {
1162        Self::new(inner)
1163    }
1164
1165    fn into_channel(self) -> fidl::Channel {
1166        self.client.into_channel()
1167    }
1168
1169    fn as_channel(&self) -> &fidl::Channel {
1170        self.client.as_channel()
1171    }
1172}
1173
1174#[cfg(target_os = "fuchsia")]
1175impl SessionManagerSynchronousProxy {
1176    pub fn new(channel: fidl::Channel) -> Self {
1177        Self { client: fidl::client::sync::Client::new(channel) }
1178    }
1179
1180    pub fn into_channel(self) -> fidl::Channel {
1181        self.client.into_channel()
1182    }
1183
1184    /// Waits until an event arrives and returns it. It is safe for other
1185    /// threads to make concurrent requests while waiting for an event.
1186    pub fn wait_for_event(
1187        &self,
1188        deadline: zx::MonotonicInstant,
1189    ) -> Result<SessionManagerEvent, fidl::Error> {
1190        SessionManagerEvent::decode(self.client.wait_for_event::<SessionManagerMarker>(deadline)?)
1191    }
1192
1193    /// Set up and prepare to profile
1194    pub fn r#configure(
1195        &self,
1196        mut payload: SessionConfigureRequest,
1197        ___deadline: zx::MonotonicInstant,
1198    ) -> Result<SessionConfigureResult, fidl::Error> {
1199        let _response =
1200            self.client.send_query::<SessionConfigureRequest, fidl::encoding::ResultType<
1201                fidl::encoding::EmptyStruct,
1202                SessionConfigureError,
1203            >, SessionManagerMarker>(
1204                &mut payload,
1205                0x67e7e28a9b959ce8,
1206                fidl::encoding::DynamicFlags::empty(),
1207                ___deadline,
1208            )?;
1209        Ok(_response.map(|x| x))
1210    }
1211
1212    /// Begin profiling and optionally begin writing data to the configured
1213    /// socket
1214    pub fn r#start(
1215        &self,
1216        mut payload: &SessionStartRequest,
1217        ___deadline: zx::MonotonicInstant,
1218    ) -> Result<SessionStartResult, fidl::Error> {
1219        let _response = self.client.send_query::<SessionStartRequest, fidl::encoding::ResultType<
1220            fidl::encoding::EmptyStruct,
1221            SessionStartError,
1222        >, SessionManagerMarker>(
1223            payload,
1224            0x4e82f9133a968ad5,
1225            fidl::encoding::DynamicFlags::empty(),
1226            ___deadline,
1227        )?;
1228        Ok(_response.map(|x| x))
1229    }
1230
1231    /// End the profiling session and write out data to the earlier
1232    /// configured socket if not already writing.
1233    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<SessionResult, fidl::Error> {
1234        let _response = self
1235            .client
1236            .send_query::<fidl::encoding::EmptyPayload, SessionResult, SessionManagerMarker>(
1237                (),
1238                0x76aa8dd59cb61e89,
1239                fidl::encoding::DynamicFlags::empty(),
1240                ___deadline,
1241            )?;
1242        Ok(_response)
1243    }
1244
1245    /// Clean up and unconfigure the profiler. Flushes the remaining data and
1246    /// closes the provided socket. Doesn't return until all data has been
1247    /// successfully written.
1248    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1249        let _response = self.client.send_query::<
1250            fidl::encoding::EmptyPayload,
1251            fidl::encoding::EmptyPayload,
1252            SessionManagerMarker,
1253        >(
1254            (),
1255            0x5f522fde537356fa,
1256            fidl::encoding::DynamicFlags::empty(),
1257            ___deadline,
1258        )?;
1259        Ok(_response)
1260    }
1261
1262    /// Starts a standalone profiling session. This session runs independently
1263    /// of the client connection and buffers data internally.
1264    pub fn r#start_session(
1265        &self,
1266        mut payload: SessionManagerStartSessionRequest,
1267        ___deadline: zx::MonotonicInstant,
1268    ) -> Result<SessionManagerStartSessionResult, fidl::Error> {
1269        let _response = self.client.send_query::<
1270            SessionManagerStartSessionRequest,
1271            fidl::encoding::ResultType<SessionManagerStartSessionResponse, ManagerError>,
1272            SessionManagerMarker,
1273        >(
1274            &mut payload,
1275            0x637a4c897f1a2964,
1276            fidl::encoding::DynamicFlags::empty(),
1277            ___deadline,
1278        )?;
1279        Ok(_response.map(|x| x))
1280    }
1281
1282    /// Ends the profiling session and writes out the buffered data.
1283    pub fn r#stop_session(
1284        &self,
1285        mut payload: SessionManagerStopSessionRequest,
1286        ___deadline: zx::MonotonicInstant,
1287    ) -> Result<SessionManagerStopSessionResult, fidl::Error> {
1288        let _response = self.client.send_query::<
1289            SessionManagerStopSessionRequest,
1290            fidl::encoding::ResultType<SessionResult, ManagerError>,
1291            SessionManagerMarker,
1292        >(
1293            &mut payload,
1294            0x1a05081e2b79f023,
1295            fidl::encoding::DynamicFlags::empty(),
1296            ___deadline,
1297        )?;
1298        Ok(_response.map(|x| x))
1299    }
1300
1301    /// Aborts an ongoing trace session without saving results.
1302    pub fn r#abort_session(
1303        &self,
1304        mut payload: &SessionManagerAbortSessionRequest,
1305        ___deadline: zx::MonotonicInstant,
1306    ) -> Result<SessionManagerAbortSessionResult, fidl::Error> {
1307        let _response = self.client.send_query::<
1308            SessionManagerAbortSessionRequest,
1309            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ManagerError>,
1310            SessionManagerMarker,
1311        >(
1312            payload,
1313            0x6799fed94ce940be,
1314            fidl::encoding::DynamicFlags::empty(),
1315            ___deadline,
1316        )?;
1317        Ok(_response.map(|x| x))
1318    }
1319
1320    /// Returns the active profiling sessions. Currently assuming 1 active max,
1321    /// but returns a vector for future-proofing.
1322    pub fn r#status(
1323        &self,
1324        ___deadline: zx::MonotonicInstant,
1325    ) -> Result<SessionManagerStatusResult, fidl::Error> {
1326        let _response = self.client.send_query::<
1327            fidl::encoding::EmptyPayload,
1328            fidl::encoding::ResultType<SessionManagerStatusResponse, ManagerError>,
1329            SessionManagerMarker,
1330        >(
1331            (),
1332            0xc116d75f457cae2,
1333            fidl::encoding::DynamicFlags::empty(),
1334            ___deadline,
1335        )?;
1336        Ok(_response.map(|x| x))
1337    }
1338
1339    /// Configures an on-boot profiling session.
1340    pub fn r#start_session_on_boot(
1341        &self,
1342        mut payload: &SessionManagerStartSessionOnBootRequest,
1343        ___deadline: zx::MonotonicInstant,
1344    ) -> Result<SessionManagerStartSessionOnBootResult, fidl::Error> {
1345        let _response = self.client.send_query::<
1346            SessionManagerStartSessionOnBootRequest,
1347            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ManagerError>,
1348            SessionManagerMarker,
1349        >(
1350            payload,
1351            0x3af30d4844fd015b,
1352            fidl::encoding::DynamicFlags::empty(),
1353            ___deadline,
1354        )?;
1355        Ok(_response.map(|x| x))
1356    }
1357}
1358
1359#[cfg(target_os = "fuchsia")]
1360impl From<SessionManagerSynchronousProxy> for zx::NullableHandle {
1361    fn from(value: SessionManagerSynchronousProxy) -> Self {
1362        value.into_channel().into()
1363    }
1364}
1365
1366#[cfg(target_os = "fuchsia")]
1367impl From<fidl::Channel> for SessionManagerSynchronousProxy {
1368    fn from(value: fidl::Channel) -> Self {
1369        Self::new(value)
1370    }
1371}
1372
1373#[cfg(target_os = "fuchsia")]
1374impl fidl::endpoints::FromClient for SessionManagerSynchronousProxy {
1375    type Protocol = SessionManagerMarker;
1376
1377    fn from_client(value: fidl::endpoints::ClientEnd<SessionManagerMarker>) -> Self {
1378        Self::new(value.into_channel())
1379    }
1380}
1381
1382#[derive(Debug, Clone)]
1383pub struct SessionManagerProxy {
1384    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1385}
1386
1387impl fidl::endpoints::Proxy for SessionManagerProxy {
1388    type Protocol = SessionManagerMarker;
1389
1390    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1391        Self::new(inner)
1392    }
1393
1394    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1395        self.client.into_channel().map_err(|client| Self { client })
1396    }
1397
1398    fn as_channel(&self) -> &::fidl::AsyncChannel {
1399        self.client.as_channel()
1400    }
1401}
1402
1403impl SessionManagerProxy {
1404    /// Create a new Proxy for fuchsia.cpu.profiler/SessionManager.
1405    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1406        let protocol_name = <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1407        Self { client: fidl::client::Client::new(channel, protocol_name) }
1408    }
1409
1410    /// Get a Stream of events from the remote end of the protocol.
1411    ///
1412    /// # Panics
1413    ///
1414    /// Panics if the event stream was already taken.
1415    pub fn take_event_stream(&self) -> SessionManagerEventStream {
1416        SessionManagerEventStream { event_receiver: self.client.take_event_receiver() }
1417    }
1418
1419    /// Set up and prepare to profile
1420    pub fn r#configure(
1421        &self,
1422        mut payload: SessionConfigureRequest,
1423    ) -> fidl::client::QueryResponseFut<
1424        SessionConfigureResult,
1425        fidl::encoding::DefaultFuchsiaResourceDialect,
1426    > {
1427        SessionManagerProxyInterface::r#configure(self, payload)
1428    }
1429
1430    /// Begin profiling and optionally begin writing data to the configured
1431    /// socket
1432    pub fn r#start(
1433        &self,
1434        mut payload: &SessionStartRequest,
1435    ) -> fidl::client::QueryResponseFut<
1436        SessionStartResult,
1437        fidl::encoding::DefaultFuchsiaResourceDialect,
1438    > {
1439        SessionManagerProxyInterface::r#start(self, payload)
1440    }
1441
1442    /// End the profiling session and write out data to the earlier
1443    /// configured socket if not already writing.
1444    pub fn r#stop(
1445        &self,
1446    ) -> fidl::client::QueryResponseFut<SessionResult, fidl::encoding::DefaultFuchsiaResourceDialect>
1447    {
1448        SessionManagerProxyInterface::r#stop(self)
1449    }
1450
1451    /// Clean up and unconfigure the profiler. Flushes the remaining data and
1452    /// closes the provided socket. Doesn't return until all data has been
1453    /// successfully written.
1454    pub fn r#reset(
1455        &self,
1456    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1457        SessionManagerProxyInterface::r#reset(self)
1458    }
1459
1460    /// Starts a standalone profiling session. This session runs independently
1461    /// of the client connection and buffers data internally.
1462    pub fn r#start_session(
1463        &self,
1464        mut payload: SessionManagerStartSessionRequest,
1465    ) -> fidl::client::QueryResponseFut<
1466        SessionManagerStartSessionResult,
1467        fidl::encoding::DefaultFuchsiaResourceDialect,
1468    > {
1469        SessionManagerProxyInterface::r#start_session(self, payload)
1470    }
1471
1472    /// Ends the profiling session and writes out the buffered data.
1473    pub fn r#stop_session(
1474        &self,
1475        mut payload: SessionManagerStopSessionRequest,
1476    ) -> fidl::client::QueryResponseFut<
1477        SessionManagerStopSessionResult,
1478        fidl::encoding::DefaultFuchsiaResourceDialect,
1479    > {
1480        SessionManagerProxyInterface::r#stop_session(self, payload)
1481    }
1482
1483    /// Aborts an ongoing trace session without saving results.
1484    pub fn r#abort_session(
1485        &self,
1486        mut payload: &SessionManagerAbortSessionRequest,
1487    ) -> fidl::client::QueryResponseFut<
1488        SessionManagerAbortSessionResult,
1489        fidl::encoding::DefaultFuchsiaResourceDialect,
1490    > {
1491        SessionManagerProxyInterface::r#abort_session(self, payload)
1492    }
1493
1494    /// Returns the active profiling sessions. Currently assuming 1 active max,
1495    /// but returns a vector for future-proofing.
1496    pub fn r#status(
1497        &self,
1498    ) -> fidl::client::QueryResponseFut<
1499        SessionManagerStatusResult,
1500        fidl::encoding::DefaultFuchsiaResourceDialect,
1501    > {
1502        SessionManagerProxyInterface::r#status(self)
1503    }
1504
1505    /// Configures an on-boot profiling session.
1506    pub fn r#start_session_on_boot(
1507        &self,
1508        mut payload: &SessionManagerStartSessionOnBootRequest,
1509    ) -> fidl::client::QueryResponseFut<
1510        SessionManagerStartSessionOnBootResult,
1511        fidl::encoding::DefaultFuchsiaResourceDialect,
1512    > {
1513        SessionManagerProxyInterface::r#start_session_on_boot(self, payload)
1514    }
1515}
1516
1517impl SessionManagerProxyInterface for SessionManagerProxy {
1518    type ConfigureResponseFut = fidl::client::QueryResponseFut<
1519        SessionConfigureResult,
1520        fidl::encoding::DefaultFuchsiaResourceDialect,
1521    >;
1522    fn r#configure(&self, mut payload: SessionConfigureRequest) -> Self::ConfigureResponseFut {
1523        fn _decode(
1524            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1525        ) -> Result<SessionConfigureResult, fidl::Error> {
1526            let _response = fidl::client::decode_transaction_body::<
1527                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SessionConfigureError>,
1528                fidl::encoding::DefaultFuchsiaResourceDialect,
1529                0x67e7e28a9b959ce8,
1530            >(_buf?)?;
1531            Ok(_response.map(|x| x))
1532        }
1533        self.client.send_query_and_decode::<SessionConfigureRequest, SessionConfigureResult>(
1534            &mut payload,
1535            0x67e7e28a9b959ce8,
1536            fidl::encoding::DynamicFlags::empty(),
1537            _decode,
1538        )
1539    }
1540
1541    type StartResponseFut = fidl::client::QueryResponseFut<
1542        SessionStartResult,
1543        fidl::encoding::DefaultFuchsiaResourceDialect,
1544    >;
1545    fn r#start(&self, mut payload: &SessionStartRequest) -> Self::StartResponseFut {
1546        fn _decode(
1547            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1548        ) -> Result<SessionStartResult, fidl::Error> {
1549            let _response = fidl::client::decode_transaction_body::<
1550                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SessionStartError>,
1551                fidl::encoding::DefaultFuchsiaResourceDialect,
1552                0x4e82f9133a968ad5,
1553            >(_buf?)?;
1554            Ok(_response.map(|x| x))
1555        }
1556        self.client.send_query_and_decode::<SessionStartRequest, SessionStartResult>(
1557            payload,
1558            0x4e82f9133a968ad5,
1559            fidl::encoding::DynamicFlags::empty(),
1560            _decode,
1561        )
1562    }
1563
1564    type StopResponseFut = fidl::client::QueryResponseFut<
1565        SessionResult,
1566        fidl::encoding::DefaultFuchsiaResourceDialect,
1567    >;
1568    fn r#stop(&self) -> Self::StopResponseFut {
1569        fn _decode(
1570            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1571        ) -> Result<SessionResult, fidl::Error> {
1572            let _response = fidl::client::decode_transaction_body::<
1573                SessionResult,
1574                fidl::encoding::DefaultFuchsiaResourceDialect,
1575                0x76aa8dd59cb61e89,
1576            >(_buf?)?;
1577            Ok(_response)
1578        }
1579        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionResult>(
1580            (),
1581            0x76aa8dd59cb61e89,
1582            fidl::encoding::DynamicFlags::empty(),
1583            _decode,
1584        )
1585    }
1586
1587    type ResetResponseFut =
1588        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1589    fn r#reset(&self) -> Self::ResetResponseFut {
1590        fn _decode(
1591            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1592        ) -> Result<(), fidl::Error> {
1593            let _response = fidl::client::decode_transaction_body::<
1594                fidl::encoding::EmptyPayload,
1595                fidl::encoding::DefaultFuchsiaResourceDialect,
1596                0x5f522fde537356fa,
1597            >(_buf?)?;
1598            Ok(_response)
1599        }
1600        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1601            (),
1602            0x5f522fde537356fa,
1603            fidl::encoding::DynamicFlags::empty(),
1604            _decode,
1605        )
1606    }
1607
1608    type StartSessionResponseFut = fidl::client::QueryResponseFut<
1609        SessionManagerStartSessionResult,
1610        fidl::encoding::DefaultFuchsiaResourceDialect,
1611    >;
1612    fn r#start_session(
1613        &self,
1614        mut payload: SessionManagerStartSessionRequest,
1615    ) -> Self::StartSessionResponseFut {
1616        fn _decode(
1617            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1618        ) -> Result<SessionManagerStartSessionResult, fidl::Error> {
1619            let _response = fidl::client::decode_transaction_body::<
1620                fidl::encoding::ResultType<SessionManagerStartSessionResponse, ManagerError>,
1621                fidl::encoding::DefaultFuchsiaResourceDialect,
1622                0x637a4c897f1a2964,
1623            >(_buf?)?;
1624            Ok(_response.map(|x| x))
1625        }
1626        self.client.send_query_and_decode::<
1627            SessionManagerStartSessionRequest,
1628            SessionManagerStartSessionResult,
1629        >(
1630            &mut payload,
1631            0x637a4c897f1a2964,
1632            fidl::encoding::DynamicFlags::empty(),
1633            _decode,
1634        )
1635    }
1636
1637    type StopSessionResponseFut = fidl::client::QueryResponseFut<
1638        SessionManagerStopSessionResult,
1639        fidl::encoding::DefaultFuchsiaResourceDialect,
1640    >;
1641    fn r#stop_session(
1642        &self,
1643        mut payload: SessionManagerStopSessionRequest,
1644    ) -> Self::StopSessionResponseFut {
1645        fn _decode(
1646            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1647        ) -> Result<SessionManagerStopSessionResult, fidl::Error> {
1648            let _response = fidl::client::decode_transaction_body::<
1649                fidl::encoding::ResultType<SessionResult, ManagerError>,
1650                fidl::encoding::DefaultFuchsiaResourceDialect,
1651                0x1a05081e2b79f023,
1652            >(_buf?)?;
1653            Ok(_response.map(|x| x))
1654        }
1655        self.client.send_query_and_decode::<
1656            SessionManagerStopSessionRequest,
1657            SessionManagerStopSessionResult,
1658        >(
1659            &mut payload,
1660            0x1a05081e2b79f023,
1661            fidl::encoding::DynamicFlags::empty(),
1662            _decode,
1663        )
1664    }
1665
1666    type AbortSessionResponseFut = fidl::client::QueryResponseFut<
1667        SessionManagerAbortSessionResult,
1668        fidl::encoding::DefaultFuchsiaResourceDialect,
1669    >;
1670    fn r#abort_session(
1671        &self,
1672        mut payload: &SessionManagerAbortSessionRequest,
1673    ) -> Self::AbortSessionResponseFut {
1674        fn _decode(
1675            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1676        ) -> Result<SessionManagerAbortSessionResult, fidl::Error> {
1677            let _response = fidl::client::decode_transaction_body::<
1678                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ManagerError>,
1679                fidl::encoding::DefaultFuchsiaResourceDialect,
1680                0x6799fed94ce940be,
1681            >(_buf?)?;
1682            Ok(_response.map(|x| x))
1683        }
1684        self.client.send_query_and_decode::<
1685            SessionManagerAbortSessionRequest,
1686            SessionManagerAbortSessionResult,
1687        >(
1688            payload,
1689            0x6799fed94ce940be,
1690            fidl::encoding::DynamicFlags::empty(),
1691            _decode,
1692        )
1693    }
1694
1695    type StatusResponseFut = fidl::client::QueryResponseFut<
1696        SessionManagerStatusResult,
1697        fidl::encoding::DefaultFuchsiaResourceDialect,
1698    >;
1699    fn r#status(&self) -> Self::StatusResponseFut {
1700        fn _decode(
1701            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1702        ) -> Result<SessionManagerStatusResult, fidl::Error> {
1703            let _response = fidl::client::decode_transaction_body::<
1704                fidl::encoding::ResultType<SessionManagerStatusResponse, ManagerError>,
1705                fidl::encoding::DefaultFuchsiaResourceDialect,
1706                0xc116d75f457cae2,
1707            >(_buf?)?;
1708            Ok(_response.map(|x| x))
1709        }
1710        self.client
1711            .send_query_and_decode::<fidl::encoding::EmptyPayload, SessionManagerStatusResult>(
1712                (),
1713                0xc116d75f457cae2,
1714                fidl::encoding::DynamicFlags::empty(),
1715                _decode,
1716            )
1717    }
1718
1719    type StartSessionOnBootResponseFut = fidl::client::QueryResponseFut<
1720        SessionManagerStartSessionOnBootResult,
1721        fidl::encoding::DefaultFuchsiaResourceDialect,
1722    >;
1723    fn r#start_session_on_boot(
1724        &self,
1725        mut payload: &SessionManagerStartSessionOnBootRequest,
1726    ) -> Self::StartSessionOnBootResponseFut {
1727        fn _decode(
1728            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1729        ) -> Result<SessionManagerStartSessionOnBootResult, fidl::Error> {
1730            let _response = fidl::client::decode_transaction_body::<
1731                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ManagerError>,
1732                fidl::encoding::DefaultFuchsiaResourceDialect,
1733                0x3af30d4844fd015b,
1734            >(_buf?)?;
1735            Ok(_response.map(|x| x))
1736        }
1737        self.client.send_query_and_decode::<
1738            SessionManagerStartSessionOnBootRequest,
1739            SessionManagerStartSessionOnBootResult,
1740        >(
1741            payload,
1742            0x3af30d4844fd015b,
1743            fidl::encoding::DynamicFlags::empty(),
1744            _decode,
1745        )
1746    }
1747}
1748
1749pub struct SessionManagerEventStream {
1750    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1751}
1752
1753impl std::marker::Unpin for SessionManagerEventStream {}
1754
1755impl futures::stream::FusedStream for SessionManagerEventStream {
1756    fn is_terminated(&self) -> bool {
1757        self.event_receiver.is_terminated()
1758    }
1759}
1760
1761impl futures::Stream for SessionManagerEventStream {
1762    type Item = Result<SessionManagerEvent, fidl::Error>;
1763
1764    fn poll_next(
1765        mut self: std::pin::Pin<&mut Self>,
1766        cx: &mut std::task::Context<'_>,
1767    ) -> std::task::Poll<Option<Self::Item>> {
1768        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1769            &mut self.event_receiver,
1770            cx
1771        )?) {
1772            Some(buf) => std::task::Poll::Ready(Some(SessionManagerEvent::decode(buf))),
1773            None => std::task::Poll::Ready(None),
1774        }
1775    }
1776}
1777
1778#[derive(Debug)]
1779pub enum SessionManagerEvent {}
1780
1781impl SessionManagerEvent {
1782    /// Decodes a message buffer as a [`SessionManagerEvent`].
1783    fn decode(
1784        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1785    ) -> Result<SessionManagerEvent, fidl::Error> {
1786        let (bytes, _handles) = buf.split_mut();
1787        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1788        debug_assert_eq!(tx_header.tx_id, 0);
1789        match tx_header.ordinal {
1790            _ => Err(fidl::Error::UnknownOrdinal {
1791                ordinal: tx_header.ordinal,
1792                protocol_name:
1793                    <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1794            }),
1795        }
1796    }
1797}
1798
1799/// A Stream of incoming requests for fuchsia.cpu.profiler/SessionManager.
1800pub struct SessionManagerRequestStream {
1801    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1802    is_terminated: bool,
1803}
1804
1805impl std::marker::Unpin for SessionManagerRequestStream {}
1806
1807impl futures::stream::FusedStream for SessionManagerRequestStream {
1808    fn is_terminated(&self) -> bool {
1809        self.is_terminated
1810    }
1811}
1812
1813impl fidl::endpoints::RequestStream for SessionManagerRequestStream {
1814    type Protocol = SessionManagerMarker;
1815    type ControlHandle = SessionManagerControlHandle;
1816
1817    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1818        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1819    }
1820
1821    fn control_handle(&self) -> Self::ControlHandle {
1822        SessionManagerControlHandle { inner: self.inner.clone() }
1823    }
1824
1825    fn into_inner(
1826        self,
1827    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1828    {
1829        (self.inner, self.is_terminated)
1830    }
1831
1832    fn from_inner(
1833        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1834        is_terminated: bool,
1835    ) -> Self {
1836        Self { inner, is_terminated }
1837    }
1838}
1839
1840impl futures::Stream for SessionManagerRequestStream {
1841    type Item = Result<SessionManagerRequest, fidl::Error>;
1842
1843    fn poll_next(
1844        mut self: std::pin::Pin<&mut Self>,
1845        cx: &mut std::task::Context<'_>,
1846    ) -> std::task::Poll<Option<Self::Item>> {
1847        let this = &mut *self;
1848        if this.inner.check_shutdown(cx) {
1849            this.is_terminated = true;
1850            return std::task::Poll::Ready(None);
1851        }
1852        if this.is_terminated {
1853            panic!("polled SessionManagerRequestStream after completion");
1854        }
1855        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1856            |bytes, handles| {
1857                match this.inner.channel().read_etc(cx, bytes, handles) {
1858                    std::task::Poll::Ready(Ok(())) => {}
1859                    std::task::Poll::Pending => return std::task::Poll::Pending,
1860                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1861                        this.is_terminated = true;
1862                        return std::task::Poll::Ready(None);
1863                    }
1864                    std::task::Poll::Ready(Err(e)) => {
1865                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1866                            e.into(),
1867                        ))));
1868                    }
1869                }
1870
1871                // A message has been received from the channel
1872                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1873
1874                std::task::Poll::Ready(Some(match header.ordinal {
1875                    0x67e7e28a9b959ce8 => {
1876                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1877                        let mut req = fidl::new_empty!(
1878                            SessionConfigureRequest,
1879                            fidl::encoding::DefaultFuchsiaResourceDialect
1880                        );
1881                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionConfigureRequest>(&header, _body_bytes, handles, &mut req)?;
1882                        let control_handle =
1883                            SessionManagerControlHandle { inner: this.inner.clone() };
1884                        Ok(SessionManagerRequest::Configure {
1885                            payload: req,
1886                            responder: SessionManagerConfigureResponder {
1887                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1888                                tx_id: header.tx_id,
1889                            },
1890                        })
1891                    }
1892                    0x4e82f9133a968ad5 => {
1893                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1894                        let mut req = fidl::new_empty!(
1895                            SessionStartRequest,
1896                            fidl::encoding::DefaultFuchsiaResourceDialect
1897                        );
1898                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionStartRequest>(&header, _body_bytes, handles, &mut req)?;
1899                        let control_handle =
1900                            SessionManagerControlHandle { inner: this.inner.clone() };
1901                        Ok(SessionManagerRequest::Start {
1902                            payload: req,
1903                            responder: SessionManagerStartResponder {
1904                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1905                                tx_id: header.tx_id,
1906                            },
1907                        })
1908                    }
1909                    0x76aa8dd59cb61e89 => {
1910                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1911                        let mut req = fidl::new_empty!(
1912                            fidl::encoding::EmptyPayload,
1913                            fidl::encoding::DefaultFuchsiaResourceDialect
1914                        );
1915                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1916                        let control_handle =
1917                            SessionManagerControlHandle { inner: this.inner.clone() };
1918                        Ok(SessionManagerRequest::Stop {
1919                            responder: SessionManagerStopResponder {
1920                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1921                                tx_id: header.tx_id,
1922                            },
1923                        })
1924                    }
1925                    0x5f522fde537356fa => {
1926                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1927                        let mut req = fidl::new_empty!(
1928                            fidl::encoding::EmptyPayload,
1929                            fidl::encoding::DefaultFuchsiaResourceDialect
1930                        );
1931                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1932                        let control_handle =
1933                            SessionManagerControlHandle { inner: this.inner.clone() };
1934                        Ok(SessionManagerRequest::Reset {
1935                            responder: SessionManagerResetResponder {
1936                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1937                                tx_id: header.tx_id,
1938                            },
1939                        })
1940                    }
1941                    0x637a4c897f1a2964 => {
1942                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1943                        let mut req = fidl::new_empty!(
1944                            SessionManagerStartSessionRequest,
1945                            fidl::encoding::DefaultFuchsiaResourceDialect
1946                        );
1947                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerStartSessionRequest>(&header, _body_bytes, handles, &mut req)?;
1948                        let control_handle =
1949                            SessionManagerControlHandle { inner: this.inner.clone() };
1950                        Ok(SessionManagerRequest::StartSession {
1951                            payload: req,
1952                            responder: SessionManagerStartSessionResponder {
1953                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1954                                tx_id: header.tx_id,
1955                            },
1956                        })
1957                    }
1958                    0x1a05081e2b79f023 => {
1959                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1960                        let mut req = fidl::new_empty!(
1961                            SessionManagerStopSessionRequest,
1962                            fidl::encoding::DefaultFuchsiaResourceDialect
1963                        );
1964                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerStopSessionRequest>(&header, _body_bytes, handles, &mut req)?;
1965                        let control_handle =
1966                            SessionManagerControlHandle { inner: this.inner.clone() };
1967                        Ok(SessionManagerRequest::StopSession {
1968                            payload: req,
1969                            responder: SessionManagerStopSessionResponder {
1970                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1971                                tx_id: header.tx_id,
1972                            },
1973                        })
1974                    }
1975                    0x6799fed94ce940be => {
1976                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1977                        let mut req = fidl::new_empty!(
1978                            SessionManagerAbortSessionRequest,
1979                            fidl::encoding::DefaultFuchsiaResourceDialect
1980                        );
1981                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerAbortSessionRequest>(&header, _body_bytes, handles, &mut req)?;
1982                        let control_handle =
1983                            SessionManagerControlHandle { inner: this.inner.clone() };
1984                        Ok(SessionManagerRequest::AbortSession {
1985                            payload: req,
1986                            responder: SessionManagerAbortSessionResponder {
1987                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1988                                tx_id: header.tx_id,
1989                            },
1990                        })
1991                    }
1992                    0xc116d75f457cae2 => {
1993                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1994                        let mut req = fidl::new_empty!(
1995                            fidl::encoding::EmptyPayload,
1996                            fidl::encoding::DefaultFuchsiaResourceDialect
1997                        );
1998                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1999                        let control_handle =
2000                            SessionManagerControlHandle { inner: this.inner.clone() };
2001                        Ok(SessionManagerRequest::Status {
2002                            responder: SessionManagerStatusResponder {
2003                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2004                                tx_id: header.tx_id,
2005                            },
2006                        })
2007                    }
2008                    0x3af30d4844fd015b => {
2009                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2010                        let mut req = fidl::new_empty!(
2011                            SessionManagerStartSessionOnBootRequest,
2012                            fidl::encoding::DefaultFuchsiaResourceDialect
2013                        );
2014                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerStartSessionOnBootRequest>(&header, _body_bytes, handles, &mut req)?;
2015                        let control_handle =
2016                            SessionManagerControlHandle { inner: this.inner.clone() };
2017                        Ok(SessionManagerRequest::StartSessionOnBoot {
2018                            payload: req,
2019                            responder: SessionManagerStartSessionOnBootResponder {
2020                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2021                                tx_id: header.tx_id,
2022                            },
2023                        })
2024                    }
2025                    _ => Err(fidl::Error::UnknownOrdinal {
2026                        ordinal: header.ordinal,
2027                        protocol_name:
2028                            <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2029                    }),
2030                }))
2031            },
2032        )
2033    }
2034}
2035
2036#[derive(Debug)]
2037pub enum SessionManagerRequest {
2038    /// Set up and prepare to profile
2039    Configure { payload: SessionConfigureRequest, responder: SessionManagerConfigureResponder },
2040    /// Begin profiling and optionally begin writing data to the configured
2041    /// socket
2042    Start { payload: SessionStartRequest, responder: SessionManagerStartResponder },
2043    /// End the profiling session and write out data to the earlier
2044    /// configured socket if not already writing.
2045    Stop { responder: SessionManagerStopResponder },
2046    /// Clean up and unconfigure the profiler. Flushes the remaining data and
2047    /// closes the provided socket. Doesn't return until all data has been
2048    /// successfully written.
2049    Reset { responder: SessionManagerResetResponder },
2050    /// Starts a standalone profiling session. This session runs independently
2051    /// of the client connection and buffers data internally.
2052    StartSession {
2053        payload: SessionManagerStartSessionRequest,
2054        responder: SessionManagerStartSessionResponder,
2055    },
2056    /// Ends the profiling session and writes out the buffered data.
2057    StopSession {
2058        payload: SessionManagerStopSessionRequest,
2059        responder: SessionManagerStopSessionResponder,
2060    },
2061    /// Aborts an ongoing trace session without saving results.
2062    AbortSession {
2063        payload: SessionManagerAbortSessionRequest,
2064        responder: SessionManagerAbortSessionResponder,
2065    },
2066    /// Returns the active profiling sessions. Currently assuming 1 active max,
2067    /// but returns a vector for future-proofing.
2068    Status { responder: SessionManagerStatusResponder },
2069    /// Configures an on-boot profiling session.
2070    StartSessionOnBoot {
2071        payload: SessionManagerStartSessionOnBootRequest,
2072        responder: SessionManagerStartSessionOnBootResponder,
2073    },
2074}
2075
2076impl SessionManagerRequest {
2077    #[allow(irrefutable_let_patterns)]
2078    pub fn into_configure(
2079        self,
2080    ) -> Option<(SessionConfigureRequest, SessionManagerConfigureResponder)> {
2081        if let SessionManagerRequest::Configure { payload, responder } = self {
2082            Some((payload, responder))
2083        } else {
2084            None
2085        }
2086    }
2087
2088    #[allow(irrefutable_let_patterns)]
2089    pub fn into_start(self) -> Option<(SessionStartRequest, SessionManagerStartResponder)> {
2090        if let SessionManagerRequest::Start { payload, responder } = self {
2091            Some((payload, responder))
2092        } else {
2093            None
2094        }
2095    }
2096
2097    #[allow(irrefutable_let_patterns)]
2098    pub fn into_stop(self) -> Option<(SessionManagerStopResponder)> {
2099        if let SessionManagerRequest::Stop { responder } = self { Some((responder)) } else { None }
2100    }
2101
2102    #[allow(irrefutable_let_patterns)]
2103    pub fn into_reset(self) -> Option<(SessionManagerResetResponder)> {
2104        if let SessionManagerRequest::Reset { responder } = self { Some((responder)) } else { None }
2105    }
2106
2107    #[allow(irrefutable_let_patterns)]
2108    pub fn into_start_session(
2109        self,
2110    ) -> Option<(SessionManagerStartSessionRequest, SessionManagerStartSessionResponder)> {
2111        if let SessionManagerRequest::StartSession { payload, responder } = self {
2112            Some((payload, responder))
2113        } else {
2114            None
2115        }
2116    }
2117
2118    #[allow(irrefutable_let_patterns)]
2119    pub fn into_stop_session(
2120        self,
2121    ) -> Option<(SessionManagerStopSessionRequest, SessionManagerStopSessionResponder)> {
2122        if let SessionManagerRequest::StopSession { payload, responder } = self {
2123            Some((payload, responder))
2124        } else {
2125            None
2126        }
2127    }
2128
2129    #[allow(irrefutable_let_patterns)]
2130    pub fn into_abort_session(
2131        self,
2132    ) -> Option<(SessionManagerAbortSessionRequest, SessionManagerAbortSessionResponder)> {
2133        if let SessionManagerRequest::AbortSession { payload, responder } = self {
2134            Some((payload, responder))
2135        } else {
2136            None
2137        }
2138    }
2139
2140    #[allow(irrefutable_let_patterns)]
2141    pub fn into_status(self) -> Option<(SessionManagerStatusResponder)> {
2142        if let SessionManagerRequest::Status { responder } = self {
2143            Some((responder))
2144        } else {
2145            None
2146        }
2147    }
2148
2149    #[allow(irrefutable_let_patterns)]
2150    pub fn into_start_session_on_boot(
2151        self,
2152    ) -> Option<(SessionManagerStartSessionOnBootRequest, SessionManagerStartSessionOnBootResponder)>
2153    {
2154        if let SessionManagerRequest::StartSessionOnBoot { payload, responder } = self {
2155            Some((payload, responder))
2156        } else {
2157            None
2158        }
2159    }
2160
2161    /// Name of the method defined in FIDL
2162    pub fn method_name(&self) -> &'static str {
2163        match *self {
2164            SessionManagerRequest::Configure { .. } => "configure",
2165            SessionManagerRequest::Start { .. } => "start",
2166            SessionManagerRequest::Stop { .. } => "stop",
2167            SessionManagerRequest::Reset { .. } => "reset",
2168            SessionManagerRequest::StartSession { .. } => "start_session",
2169            SessionManagerRequest::StopSession { .. } => "stop_session",
2170            SessionManagerRequest::AbortSession { .. } => "abort_session",
2171            SessionManagerRequest::Status { .. } => "status",
2172            SessionManagerRequest::StartSessionOnBoot { .. } => "start_session_on_boot",
2173        }
2174    }
2175}
2176
2177#[derive(Debug, Clone)]
2178pub struct SessionManagerControlHandle {
2179    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2180}
2181
2182impl SessionManagerControlHandle {
2183    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2184        self.inner.shutdown_with_epitaph(status.into())
2185    }
2186}
2187
2188impl fidl::endpoints::ControlHandle for SessionManagerControlHandle {
2189    fn shutdown(&self) {
2190        self.inner.shutdown()
2191    }
2192
2193    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2194        self.inner.shutdown_with_epitaph(status)
2195    }
2196
2197    fn is_closed(&self) -> bool {
2198        self.inner.channel().is_closed()
2199    }
2200    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2201        self.inner.channel().on_closed()
2202    }
2203
2204    #[cfg(target_os = "fuchsia")]
2205    fn signal_peer(
2206        &self,
2207        clear_mask: zx::Signals,
2208        set_mask: zx::Signals,
2209    ) -> Result<(), zx_status::Status> {
2210        use fidl::Peered;
2211        self.inner.channel().signal_peer(clear_mask, set_mask)
2212    }
2213}
2214
2215impl SessionManagerControlHandle {}
2216
2217#[must_use = "FIDL methods require a response to be sent"]
2218#[derive(Debug)]
2219pub struct SessionManagerConfigureResponder {
2220    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2221    tx_id: u32,
2222}
2223
2224/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2225/// if the responder is dropped without sending a response, so that the client
2226/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2227impl std::ops::Drop for SessionManagerConfigureResponder {
2228    fn drop(&mut self) {
2229        self.control_handle.shutdown();
2230        // Safety: drops once, never accessed again
2231        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2232    }
2233}
2234
2235impl fidl::endpoints::Responder for SessionManagerConfigureResponder {
2236    type ControlHandle = SessionManagerControlHandle;
2237
2238    fn control_handle(&self) -> &SessionManagerControlHandle {
2239        &self.control_handle
2240    }
2241
2242    fn drop_without_shutdown(mut self) {
2243        // Safety: drops once, never accessed again due to mem::forget
2244        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2245        // Prevent Drop from running (which would shut down the channel)
2246        std::mem::forget(self);
2247    }
2248}
2249
2250impl SessionManagerConfigureResponder {
2251    /// Sends a response to the FIDL transaction.
2252    ///
2253    /// Sets the channel to shutdown if an error occurs.
2254    pub fn send(self, mut result: Result<(), SessionConfigureError>) -> Result<(), fidl::Error> {
2255        let _result = self.send_raw(result);
2256        if _result.is_err() {
2257            self.control_handle.shutdown();
2258        }
2259        self.drop_without_shutdown();
2260        _result
2261    }
2262
2263    /// Similar to "send" but does not shutdown the channel if an error occurs.
2264    pub fn send_no_shutdown_on_err(
2265        self,
2266        mut result: Result<(), SessionConfigureError>,
2267    ) -> Result<(), fidl::Error> {
2268        let _result = self.send_raw(result);
2269        self.drop_without_shutdown();
2270        _result
2271    }
2272
2273    fn send_raw(&self, mut result: Result<(), SessionConfigureError>) -> Result<(), fidl::Error> {
2274        self.control_handle.inner.send::<fidl::encoding::ResultType<
2275            fidl::encoding::EmptyStruct,
2276            SessionConfigureError,
2277        >>(
2278            result,
2279            self.tx_id,
2280            0x67e7e28a9b959ce8,
2281            fidl::encoding::DynamicFlags::empty(),
2282        )
2283    }
2284}
2285
2286#[must_use = "FIDL methods require a response to be sent"]
2287#[derive(Debug)]
2288pub struct SessionManagerStartResponder {
2289    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2290    tx_id: u32,
2291}
2292
2293/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2294/// if the responder is dropped without sending a response, so that the client
2295/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2296impl std::ops::Drop for SessionManagerStartResponder {
2297    fn drop(&mut self) {
2298        self.control_handle.shutdown();
2299        // Safety: drops once, never accessed again
2300        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2301    }
2302}
2303
2304impl fidl::endpoints::Responder for SessionManagerStartResponder {
2305    type ControlHandle = SessionManagerControlHandle;
2306
2307    fn control_handle(&self) -> &SessionManagerControlHandle {
2308        &self.control_handle
2309    }
2310
2311    fn drop_without_shutdown(mut self) {
2312        // Safety: drops once, never accessed again due to mem::forget
2313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2314        // Prevent Drop from running (which would shut down the channel)
2315        std::mem::forget(self);
2316    }
2317}
2318
2319impl SessionManagerStartResponder {
2320    /// Sends a response to the FIDL transaction.
2321    ///
2322    /// Sets the channel to shutdown if an error occurs.
2323    pub fn send(self, mut result: Result<(), SessionStartError>) -> Result<(), fidl::Error> {
2324        let _result = self.send_raw(result);
2325        if _result.is_err() {
2326            self.control_handle.shutdown();
2327        }
2328        self.drop_without_shutdown();
2329        _result
2330    }
2331
2332    /// Similar to "send" but does not shutdown the channel if an error occurs.
2333    pub fn send_no_shutdown_on_err(
2334        self,
2335        mut result: Result<(), SessionStartError>,
2336    ) -> Result<(), fidl::Error> {
2337        let _result = self.send_raw(result);
2338        self.drop_without_shutdown();
2339        _result
2340    }
2341
2342    fn send_raw(&self, mut result: Result<(), SessionStartError>) -> Result<(), fidl::Error> {
2343        self.control_handle.inner.send::<fidl::encoding::ResultType<
2344            fidl::encoding::EmptyStruct,
2345            SessionStartError,
2346        >>(
2347            result,
2348            self.tx_id,
2349            0x4e82f9133a968ad5,
2350            fidl::encoding::DynamicFlags::empty(),
2351        )
2352    }
2353}
2354
2355#[must_use = "FIDL methods require a response to be sent"]
2356#[derive(Debug)]
2357pub struct SessionManagerStopResponder {
2358    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2359    tx_id: u32,
2360}
2361
2362/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2363/// if the responder is dropped without sending a response, so that the client
2364/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2365impl std::ops::Drop for SessionManagerStopResponder {
2366    fn drop(&mut self) {
2367        self.control_handle.shutdown();
2368        // Safety: drops once, never accessed again
2369        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2370    }
2371}
2372
2373impl fidl::endpoints::Responder for SessionManagerStopResponder {
2374    type ControlHandle = SessionManagerControlHandle;
2375
2376    fn control_handle(&self) -> &SessionManagerControlHandle {
2377        &self.control_handle
2378    }
2379
2380    fn drop_without_shutdown(mut self) {
2381        // Safety: drops once, never accessed again due to mem::forget
2382        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2383        // Prevent Drop from running (which would shut down the channel)
2384        std::mem::forget(self);
2385    }
2386}
2387
2388impl SessionManagerStopResponder {
2389    /// Sends a response to the FIDL transaction.
2390    ///
2391    /// Sets the channel to shutdown if an error occurs.
2392    pub fn send(self, mut payload: &SessionResult) -> Result<(), fidl::Error> {
2393        let _result = self.send_raw(payload);
2394        if _result.is_err() {
2395            self.control_handle.shutdown();
2396        }
2397        self.drop_without_shutdown();
2398        _result
2399    }
2400
2401    /// Similar to "send" but does not shutdown the channel if an error occurs.
2402    pub fn send_no_shutdown_on_err(self, mut payload: &SessionResult) -> Result<(), fidl::Error> {
2403        let _result = self.send_raw(payload);
2404        self.drop_without_shutdown();
2405        _result
2406    }
2407
2408    fn send_raw(&self, mut payload: &SessionResult) -> Result<(), fidl::Error> {
2409        self.control_handle.inner.send::<SessionResult>(
2410            payload,
2411            self.tx_id,
2412            0x76aa8dd59cb61e89,
2413            fidl::encoding::DynamicFlags::empty(),
2414        )
2415    }
2416}
2417
2418#[must_use = "FIDL methods require a response to be sent"]
2419#[derive(Debug)]
2420pub struct SessionManagerResetResponder {
2421    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2422    tx_id: u32,
2423}
2424
2425/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2426/// if the responder is dropped without sending a response, so that the client
2427/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2428impl std::ops::Drop for SessionManagerResetResponder {
2429    fn drop(&mut self) {
2430        self.control_handle.shutdown();
2431        // Safety: drops once, never accessed again
2432        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2433    }
2434}
2435
2436impl fidl::endpoints::Responder for SessionManagerResetResponder {
2437    type ControlHandle = SessionManagerControlHandle;
2438
2439    fn control_handle(&self) -> &SessionManagerControlHandle {
2440        &self.control_handle
2441    }
2442
2443    fn drop_without_shutdown(mut self) {
2444        // Safety: drops once, never accessed again due to mem::forget
2445        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2446        // Prevent Drop from running (which would shut down the channel)
2447        std::mem::forget(self);
2448    }
2449}
2450
2451impl SessionManagerResetResponder {
2452    /// Sends a response to the FIDL transaction.
2453    ///
2454    /// Sets the channel to shutdown if an error occurs.
2455    pub fn send(self) -> Result<(), fidl::Error> {
2456        let _result = self.send_raw();
2457        if _result.is_err() {
2458            self.control_handle.shutdown();
2459        }
2460        self.drop_without_shutdown();
2461        _result
2462    }
2463
2464    /// Similar to "send" but does not shutdown the channel if an error occurs.
2465    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2466        let _result = self.send_raw();
2467        self.drop_without_shutdown();
2468        _result
2469    }
2470
2471    fn send_raw(&self) -> Result<(), fidl::Error> {
2472        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2473            (),
2474            self.tx_id,
2475            0x5f522fde537356fa,
2476            fidl::encoding::DynamicFlags::empty(),
2477        )
2478    }
2479}
2480
2481#[must_use = "FIDL methods require a response to be sent"]
2482#[derive(Debug)]
2483pub struct SessionManagerStartSessionResponder {
2484    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2485    tx_id: u32,
2486}
2487
2488/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2489/// if the responder is dropped without sending a response, so that the client
2490/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2491impl std::ops::Drop for SessionManagerStartSessionResponder {
2492    fn drop(&mut self) {
2493        self.control_handle.shutdown();
2494        // Safety: drops once, never accessed again
2495        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2496    }
2497}
2498
2499impl fidl::endpoints::Responder for SessionManagerStartSessionResponder {
2500    type ControlHandle = SessionManagerControlHandle;
2501
2502    fn control_handle(&self) -> &SessionManagerControlHandle {
2503        &self.control_handle
2504    }
2505
2506    fn drop_without_shutdown(mut self) {
2507        // Safety: drops once, never accessed again due to mem::forget
2508        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2509        // Prevent Drop from running (which would shut down the channel)
2510        std::mem::forget(self);
2511    }
2512}
2513
2514impl SessionManagerStartSessionResponder {
2515    /// Sends a response to the FIDL transaction.
2516    ///
2517    /// Sets the channel to shutdown if an error occurs.
2518    pub fn send(
2519        self,
2520        mut result: Result<&SessionManagerStartSessionResponse, ManagerError>,
2521    ) -> Result<(), fidl::Error> {
2522        let _result = self.send_raw(result);
2523        if _result.is_err() {
2524            self.control_handle.shutdown();
2525        }
2526        self.drop_without_shutdown();
2527        _result
2528    }
2529
2530    /// Similar to "send" but does not shutdown the channel if an error occurs.
2531    pub fn send_no_shutdown_on_err(
2532        self,
2533        mut result: Result<&SessionManagerStartSessionResponse, ManagerError>,
2534    ) -> Result<(), fidl::Error> {
2535        let _result = self.send_raw(result);
2536        self.drop_without_shutdown();
2537        _result
2538    }
2539
2540    fn send_raw(
2541        &self,
2542        mut result: Result<&SessionManagerStartSessionResponse, ManagerError>,
2543    ) -> Result<(), fidl::Error> {
2544        self.control_handle.inner.send::<fidl::encoding::ResultType<
2545            SessionManagerStartSessionResponse,
2546            ManagerError,
2547        >>(
2548            result,
2549            self.tx_id,
2550            0x637a4c897f1a2964,
2551            fidl::encoding::DynamicFlags::empty(),
2552        )
2553    }
2554}
2555
2556#[must_use = "FIDL methods require a response to be sent"]
2557#[derive(Debug)]
2558pub struct SessionManagerStopSessionResponder {
2559    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2560    tx_id: u32,
2561}
2562
2563/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2564/// if the responder is dropped without sending a response, so that the client
2565/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2566impl std::ops::Drop for SessionManagerStopSessionResponder {
2567    fn drop(&mut self) {
2568        self.control_handle.shutdown();
2569        // Safety: drops once, never accessed again
2570        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2571    }
2572}
2573
2574impl fidl::endpoints::Responder for SessionManagerStopSessionResponder {
2575    type ControlHandle = SessionManagerControlHandle;
2576
2577    fn control_handle(&self) -> &SessionManagerControlHandle {
2578        &self.control_handle
2579    }
2580
2581    fn drop_without_shutdown(mut self) {
2582        // Safety: drops once, never accessed again due to mem::forget
2583        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2584        // Prevent Drop from running (which would shut down the channel)
2585        std::mem::forget(self);
2586    }
2587}
2588
2589impl SessionManagerStopSessionResponder {
2590    /// Sends a response to the FIDL transaction.
2591    ///
2592    /// Sets the channel to shutdown if an error occurs.
2593    pub fn send(self, mut result: Result<&SessionResult, ManagerError>) -> Result<(), fidl::Error> {
2594        let _result = self.send_raw(result);
2595        if _result.is_err() {
2596            self.control_handle.shutdown();
2597        }
2598        self.drop_without_shutdown();
2599        _result
2600    }
2601
2602    /// Similar to "send" but does not shutdown the channel if an error occurs.
2603    pub fn send_no_shutdown_on_err(
2604        self,
2605        mut result: Result<&SessionResult, ManagerError>,
2606    ) -> Result<(), fidl::Error> {
2607        let _result = self.send_raw(result);
2608        self.drop_without_shutdown();
2609        _result
2610    }
2611
2612    fn send_raw(
2613        &self,
2614        mut result: Result<&SessionResult, ManagerError>,
2615    ) -> Result<(), fidl::Error> {
2616        self.control_handle.inner.send::<fidl::encoding::ResultType<SessionResult, ManagerError>>(
2617            result,
2618            self.tx_id,
2619            0x1a05081e2b79f023,
2620            fidl::encoding::DynamicFlags::empty(),
2621        )
2622    }
2623}
2624
2625#[must_use = "FIDL methods require a response to be sent"]
2626#[derive(Debug)]
2627pub struct SessionManagerAbortSessionResponder {
2628    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2629    tx_id: u32,
2630}
2631
2632/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2633/// if the responder is dropped without sending a response, so that the client
2634/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2635impl std::ops::Drop for SessionManagerAbortSessionResponder {
2636    fn drop(&mut self) {
2637        self.control_handle.shutdown();
2638        // Safety: drops once, never accessed again
2639        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2640    }
2641}
2642
2643impl fidl::endpoints::Responder for SessionManagerAbortSessionResponder {
2644    type ControlHandle = SessionManagerControlHandle;
2645
2646    fn control_handle(&self) -> &SessionManagerControlHandle {
2647        &self.control_handle
2648    }
2649
2650    fn drop_without_shutdown(mut self) {
2651        // Safety: drops once, never accessed again due to mem::forget
2652        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2653        // Prevent Drop from running (which would shut down the channel)
2654        std::mem::forget(self);
2655    }
2656}
2657
2658impl SessionManagerAbortSessionResponder {
2659    /// Sends a response to the FIDL transaction.
2660    ///
2661    /// Sets the channel to shutdown if an error occurs.
2662    pub fn send(self, mut result: Result<(), ManagerError>) -> Result<(), fidl::Error> {
2663        let _result = self.send_raw(result);
2664        if _result.is_err() {
2665            self.control_handle.shutdown();
2666        }
2667        self.drop_without_shutdown();
2668        _result
2669    }
2670
2671    /// Similar to "send" but does not shutdown the channel if an error occurs.
2672    pub fn send_no_shutdown_on_err(
2673        self,
2674        mut result: Result<(), ManagerError>,
2675    ) -> Result<(), fidl::Error> {
2676        let _result = self.send_raw(result);
2677        self.drop_without_shutdown();
2678        _result
2679    }
2680
2681    fn send_raw(&self, mut result: Result<(), ManagerError>) -> Result<(), fidl::Error> {
2682        self.control_handle.inner.send::<fidl::encoding::ResultType<
2683            fidl::encoding::EmptyStruct,
2684            ManagerError,
2685        >>(
2686            result,
2687            self.tx_id,
2688            0x6799fed94ce940be,
2689            fidl::encoding::DynamicFlags::empty(),
2690        )
2691    }
2692}
2693
2694#[must_use = "FIDL methods require a response to be sent"]
2695#[derive(Debug)]
2696pub struct SessionManagerStatusResponder {
2697    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2698    tx_id: u32,
2699}
2700
2701/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2702/// if the responder is dropped without sending a response, so that the client
2703/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2704impl std::ops::Drop for SessionManagerStatusResponder {
2705    fn drop(&mut self) {
2706        self.control_handle.shutdown();
2707        // Safety: drops once, never accessed again
2708        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2709    }
2710}
2711
2712impl fidl::endpoints::Responder for SessionManagerStatusResponder {
2713    type ControlHandle = SessionManagerControlHandle;
2714
2715    fn control_handle(&self) -> &SessionManagerControlHandle {
2716        &self.control_handle
2717    }
2718
2719    fn drop_without_shutdown(mut self) {
2720        // Safety: drops once, never accessed again due to mem::forget
2721        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2722        // Prevent Drop from running (which would shut down the channel)
2723        std::mem::forget(self);
2724    }
2725}
2726
2727impl SessionManagerStatusResponder {
2728    /// Sends a response to the FIDL transaction.
2729    ///
2730    /// Sets the channel to shutdown if an error occurs.
2731    pub fn send(
2732        self,
2733        mut result: Result<&SessionManagerStatusResponse, ManagerError>,
2734    ) -> Result<(), fidl::Error> {
2735        let _result = self.send_raw(result);
2736        if _result.is_err() {
2737            self.control_handle.shutdown();
2738        }
2739        self.drop_without_shutdown();
2740        _result
2741    }
2742
2743    /// Similar to "send" but does not shutdown the channel if an error occurs.
2744    pub fn send_no_shutdown_on_err(
2745        self,
2746        mut result: Result<&SessionManagerStatusResponse, ManagerError>,
2747    ) -> Result<(), fidl::Error> {
2748        let _result = self.send_raw(result);
2749        self.drop_without_shutdown();
2750        _result
2751    }
2752
2753    fn send_raw(
2754        &self,
2755        mut result: Result<&SessionManagerStatusResponse, ManagerError>,
2756    ) -> Result<(), fidl::Error> {
2757        self.control_handle.inner.send::<fidl::encoding::ResultType<
2758            SessionManagerStatusResponse,
2759            ManagerError,
2760        >>(
2761            result,
2762            self.tx_id,
2763            0xc116d75f457cae2,
2764            fidl::encoding::DynamicFlags::empty(),
2765        )
2766    }
2767}
2768
2769#[must_use = "FIDL methods require a response to be sent"]
2770#[derive(Debug)]
2771pub struct SessionManagerStartSessionOnBootResponder {
2772    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2773    tx_id: u32,
2774}
2775
2776/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2777/// if the responder is dropped without sending a response, so that the client
2778/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2779impl std::ops::Drop for SessionManagerStartSessionOnBootResponder {
2780    fn drop(&mut self) {
2781        self.control_handle.shutdown();
2782        // Safety: drops once, never accessed again
2783        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2784    }
2785}
2786
2787impl fidl::endpoints::Responder for SessionManagerStartSessionOnBootResponder {
2788    type ControlHandle = SessionManagerControlHandle;
2789
2790    fn control_handle(&self) -> &SessionManagerControlHandle {
2791        &self.control_handle
2792    }
2793
2794    fn drop_without_shutdown(mut self) {
2795        // Safety: drops once, never accessed again due to mem::forget
2796        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2797        // Prevent Drop from running (which would shut down the channel)
2798        std::mem::forget(self);
2799    }
2800}
2801
2802impl SessionManagerStartSessionOnBootResponder {
2803    /// Sends a response to the FIDL transaction.
2804    ///
2805    /// Sets the channel to shutdown if an error occurs.
2806    pub fn send(self, mut result: Result<(), ManagerError>) -> Result<(), fidl::Error> {
2807        let _result = self.send_raw(result);
2808        if _result.is_err() {
2809            self.control_handle.shutdown();
2810        }
2811        self.drop_without_shutdown();
2812        _result
2813    }
2814
2815    /// Similar to "send" but does not shutdown the channel if an error occurs.
2816    pub fn send_no_shutdown_on_err(
2817        self,
2818        mut result: Result<(), ManagerError>,
2819    ) -> Result<(), fidl::Error> {
2820        let _result = self.send_raw(result);
2821        self.drop_without_shutdown();
2822        _result
2823    }
2824
2825    fn send_raw(&self, mut result: Result<(), ManagerError>) -> Result<(), fidl::Error> {
2826        self.control_handle.inner.send::<fidl::encoding::ResultType<
2827            fidl::encoding::EmptyStruct,
2828            ManagerError,
2829        >>(
2830            result,
2831            self.tx_id,
2832            0x3af30d4844fd015b,
2833            fidl::encoding::DynamicFlags::empty(),
2834        )
2835    }
2836}
2837
2838mod internal {
2839    use super::*;
2840
2841    impl Config {
2842        #[inline(always)]
2843        fn max_ordinal_present(&self) -> u64 {
2844            if let Some(_) = self.target {
2845                return 2;
2846            }
2847            if let Some(_) = self.configs {
2848                return 1;
2849            }
2850            0
2851        }
2852    }
2853
2854    impl fidl::encoding::ResourceTypeMarker for Config {
2855        type Borrowed<'a> = &'a mut Self;
2856        fn take_or_borrow<'a>(
2857            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2858        ) -> Self::Borrowed<'a> {
2859            value
2860        }
2861    }
2862
2863    unsafe impl fidl::encoding::TypeMarker for Config {
2864        type Owned = Self;
2865
2866        #[inline(always)]
2867        fn inline_align(_context: fidl::encoding::Context) -> usize {
2868            8
2869        }
2870
2871        #[inline(always)]
2872        fn inline_size(_context: fidl::encoding::Context) -> usize {
2873            16
2874        }
2875    }
2876
2877    unsafe impl fidl::encoding::Encode<Config, fidl::encoding::DefaultFuchsiaResourceDialect>
2878        for &mut Config
2879    {
2880        unsafe fn encode(
2881            self,
2882            encoder: &mut fidl::encoding::Encoder<
2883                '_,
2884                fidl::encoding::DefaultFuchsiaResourceDialect,
2885            >,
2886            offset: usize,
2887            mut depth: fidl::encoding::Depth,
2888        ) -> fidl::Result<()> {
2889            encoder.debug_check_bounds::<Config>(offset);
2890            // Vector header
2891            let max_ordinal: u64 = self.max_ordinal_present();
2892            encoder.write_num(max_ordinal, offset);
2893            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2894            // Calling encoder.out_of_line_offset(0) is not allowed.
2895            if max_ordinal == 0 {
2896                return Ok(());
2897            }
2898            depth.increment()?;
2899            let envelope_size = 8;
2900            let bytes_len = max_ordinal as usize * envelope_size;
2901            #[allow(unused_variables)]
2902            let offset = encoder.out_of_line_offset(bytes_len);
2903            let mut _prev_end_offset: usize = 0;
2904            if 1 > max_ordinal {
2905                return Ok(());
2906            }
2907
2908            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2909            // are envelope_size bytes.
2910            let cur_offset: usize = (1 - 1) * envelope_size;
2911
2912            // Zero reserved fields.
2913            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2914
2915            // Safety:
2916            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2917            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2918            //   envelope_size bytes, there is always sufficient room.
2919            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2920            self.configs.as_ref().map(<fidl::encoding::Vector<SamplingConfig, 64> as fidl::encoding::ValueTypeMarker>::borrow),
2921            encoder, offset + cur_offset, depth
2922        )?;
2923
2924            _prev_end_offset = cur_offset + envelope_size;
2925            if 2 > max_ordinal {
2926                return Ok(());
2927            }
2928
2929            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2930            // are envelope_size bytes.
2931            let cur_offset: usize = (2 - 1) * envelope_size;
2932
2933            // Zero reserved fields.
2934            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2935
2936            // Safety:
2937            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2938            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2939            //   envelope_size bytes, there is always sufficient room.
2940            fidl::encoding::encode_in_envelope_optional::<
2941                TargetConfig,
2942                fidl::encoding::DefaultFuchsiaResourceDialect,
2943            >(
2944                self.target
2945                    .as_mut()
2946                    .map(<TargetConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2947                encoder,
2948                offset + cur_offset,
2949                depth,
2950            )?;
2951
2952            _prev_end_offset = cur_offset + envelope_size;
2953
2954            Ok(())
2955        }
2956    }
2957
2958    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Config {
2959        #[inline(always)]
2960        fn new_empty() -> Self {
2961            Self::default()
2962        }
2963
2964        unsafe fn decode(
2965            &mut self,
2966            decoder: &mut fidl::encoding::Decoder<
2967                '_,
2968                fidl::encoding::DefaultFuchsiaResourceDialect,
2969            >,
2970            offset: usize,
2971            mut depth: fidl::encoding::Depth,
2972        ) -> fidl::Result<()> {
2973            decoder.debug_check_bounds::<Self>(offset);
2974            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2975                None => return Err(fidl::Error::NotNullable),
2976                Some(len) => len,
2977            };
2978            // Calling decoder.out_of_line_offset(0) is not allowed.
2979            if len == 0 {
2980                return Ok(());
2981            };
2982            depth.increment()?;
2983            let envelope_size = 8;
2984            let bytes_len = len * envelope_size;
2985            let offset = decoder.out_of_line_offset(bytes_len)?;
2986            // Decode the envelope for each type.
2987            let mut _next_ordinal_to_read = 0;
2988            let mut next_offset = offset;
2989            let end_offset = offset + bytes_len;
2990            _next_ordinal_to_read += 1;
2991            if next_offset >= end_offset {
2992                return Ok(());
2993            }
2994
2995            // Decode unknown envelopes for gaps in ordinals.
2996            while _next_ordinal_to_read < 1 {
2997                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2998                _next_ordinal_to_read += 1;
2999                next_offset += envelope_size;
3000            }
3001
3002            let next_out_of_line = decoder.next_out_of_line();
3003            let handles_before = decoder.remaining_handles();
3004            if let Some((inlined, num_bytes, num_handles)) =
3005                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3006            {
3007                let member_inline_size = <fidl::encoding::Vector<SamplingConfig, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3008                if inlined != (member_inline_size <= 4) {
3009                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3010                }
3011                let inner_offset;
3012                let mut inner_depth = depth.clone();
3013                if inlined {
3014                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3015                    inner_offset = next_offset;
3016                } else {
3017                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3018                    inner_depth.increment()?;
3019                }
3020                let val_ref =
3021                self.configs.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
3022                fidl::decode!(fidl::encoding::Vector<SamplingConfig, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3023                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3024                {
3025                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3026                }
3027                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3028                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3029                }
3030            }
3031
3032            next_offset += envelope_size;
3033            _next_ordinal_to_read += 1;
3034            if next_offset >= end_offset {
3035                return Ok(());
3036            }
3037
3038            // Decode unknown envelopes for gaps in ordinals.
3039            while _next_ordinal_to_read < 2 {
3040                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3041                _next_ordinal_to_read += 1;
3042                next_offset += envelope_size;
3043            }
3044
3045            let next_out_of_line = decoder.next_out_of_line();
3046            let handles_before = decoder.remaining_handles();
3047            if let Some((inlined, num_bytes, num_handles)) =
3048                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3049            {
3050                let member_inline_size =
3051                    <TargetConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3052                if inlined != (member_inline_size <= 4) {
3053                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3054                }
3055                let inner_offset;
3056                let mut inner_depth = depth.clone();
3057                if inlined {
3058                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3059                    inner_offset = next_offset;
3060                } else {
3061                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3062                    inner_depth.increment()?;
3063                }
3064                let val_ref = self.target.get_or_insert_with(|| {
3065                    fidl::new_empty!(TargetConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
3066                });
3067                fidl::decode!(
3068                    TargetConfig,
3069                    fidl::encoding::DefaultFuchsiaResourceDialect,
3070                    val_ref,
3071                    decoder,
3072                    inner_offset,
3073                    inner_depth
3074                )?;
3075                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3076                {
3077                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3078                }
3079                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3080                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3081                }
3082            }
3083
3084            next_offset += envelope_size;
3085
3086            // Decode the remaining unknown envelopes.
3087            while next_offset < end_offset {
3088                _next_ordinal_to_read += 1;
3089                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3090                next_offset += envelope_size;
3091            }
3092
3093            Ok(())
3094        }
3095    }
3096
3097    impl LaunchTest {
3098        #[inline(always)]
3099        fn max_ordinal_present(&self) -> u64 {
3100            if let Some(_) = self.options {
3101                return 2;
3102            }
3103            if let Some(_) = self.url {
3104                return 1;
3105            }
3106            0
3107        }
3108    }
3109
3110    impl fidl::encoding::ResourceTypeMarker for LaunchTest {
3111        type Borrowed<'a> = &'a mut Self;
3112        fn take_or_borrow<'a>(
3113            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3114        ) -> Self::Borrowed<'a> {
3115            value
3116        }
3117    }
3118
3119    unsafe impl fidl::encoding::TypeMarker for LaunchTest {
3120        type Owned = Self;
3121
3122        #[inline(always)]
3123        fn inline_align(_context: fidl::encoding::Context) -> usize {
3124            8
3125        }
3126
3127        #[inline(always)]
3128        fn inline_size(_context: fidl::encoding::Context) -> usize {
3129            16
3130        }
3131    }
3132
3133    unsafe impl fidl::encoding::Encode<LaunchTest, fidl::encoding::DefaultFuchsiaResourceDialect>
3134        for &mut LaunchTest
3135    {
3136        unsafe fn encode(
3137            self,
3138            encoder: &mut fidl::encoding::Encoder<
3139                '_,
3140                fidl::encoding::DefaultFuchsiaResourceDialect,
3141            >,
3142            offset: usize,
3143            mut depth: fidl::encoding::Depth,
3144        ) -> fidl::Result<()> {
3145            encoder.debug_check_bounds::<LaunchTest>(offset);
3146            // Vector header
3147            let max_ordinal: u64 = self.max_ordinal_present();
3148            encoder.write_num(max_ordinal, offset);
3149            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3150            // Calling encoder.out_of_line_offset(0) is not allowed.
3151            if max_ordinal == 0 {
3152                return Ok(());
3153            }
3154            depth.increment()?;
3155            let envelope_size = 8;
3156            let bytes_len = max_ordinal as usize * envelope_size;
3157            #[allow(unused_variables)]
3158            let offset = encoder.out_of_line_offset(bytes_len);
3159            let mut _prev_end_offset: usize = 0;
3160            if 1 > max_ordinal {
3161                return Ok(());
3162            }
3163
3164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3165            // are envelope_size bytes.
3166            let cur_offset: usize = (1 - 1) * envelope_size;
3167
3168            // Zero reserved fields.
3169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3170
3171            // Safety:
3172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3174            //   envelope_size bytes, there is always sufficient room.
3175            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3176            self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
3177            encoder, offset + cur_offset, depth
3178        )?;
3179
3180            _prev_end_offset = cur_offset + envelope_size;
3181            if 2 > max_ordinal {
3182                return Ok(());
3183            }
3184
3185            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3186            // are envelope_size bytes.
3187            let cur_offset: usize = (2 - 1) * envelope_size;
3188
3189            // Zero reserved fields.
3190            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3191
3192            // Safety:
3193            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3194            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3195            //   envelope_size bytes, there is always sufficient room.
3196            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_test_manager::RunSuiteOptions, fidl::encoding::DefaultFuchsiaResourceDialect>(
3197            self.options.as_mut().map(<fidl_fuchsia_test_manager::RunSuiteOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3198            encoder, offset + cur_offset, depth
3199        )?;
3200
3201            _prev_end_offset = cur_offset + envelope_size;
3202
3203            Ok(())
3204        }
3205    }
3206
3207    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchTest {
3208        #[inline(always)]
3209        fn new_empty() -> Self {
3210            Self::default()
3211        }
3212
3213        unsafe fn decode(
3214            &mut self,
3215            decoder: &mut fidl::encoding::Decoder<
3216                '_,
3217                fidl::encoding::DefaultFuchsiaResourceDialect,
3218            >,
3219            offset: usize,
3220            mut depth: fidl::encoding::Depth,
3221        ) -> fidl::Result<()> {
3222            decoder.debug_check_bounds::<Self>(offset);
3223            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3224                None => return Err(fidl::Error::NotNullable),
3225                Some(len) => len,
3226            };
3227            // Calling decoder.out_of_line_offset(0) is not allowed.
3228            if len == 0 {
3229                return Ok(());
3230            };
3231            depth.increment()?;
3232            let envelope_size = 8;
3233            let bytes_len = len * envelope_size;
3234            let offset = decoder.out_of_line_offset(bytes_len)?;
3235            // Decode the envelope for each type.
3236            let mut _next_ordinal_to_read = 0;
3237            let mut next_offset = offset;
3238            let end_offset = offset + bytes_len;
3239            _next_ordinal_to_read += 1;
3240            if next_offset >= end_offset {
3241                return Ok(());
3242            }
3243
3244            // Decode unknown envelopes for gaps in ordinals.
3245            while _next_ordinal_to_read < 1 {
3246                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3247                _next_ordinal_to_read += 1;
3248                next_offset += envelope_size;
3249            }
3250
3251            let next_out_of_line = decoder.next_out_of_line();
3252            let handles_before = decoder.remaining_handles();
3253            if let Some((inlined, num_bytes, num_handles)) =
3254                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3255            {
3256                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3257                if inlined != (member_inline_size <= 4) {
3258                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3259                }
3260                let inner_offset;
3261                let mut inner_depth = depth.clone();
3262                if inlined {
3263                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3264                    inner_offset = next_offset;
3265                } else {
3266                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3267                    inner_depth.increment()?;
3268                }
3269                let val_ref = self.url.get_or_insert_with(|| {
3270                    fidl::new_empty!(
3271                        fidl::encoding::BoundedString<4096>,
3272                        fidl::encoding::DefaultFuchsiaResourceDialect
3273                    )
3274                });
3275                fidl::decode!(
3276                    fidl::encoding::BoundedString<4096>,
3277                    fidl::encoding::DefaultFuchsiaResourceDialect,
3278                    val_ref,
3279                    decoder,
3280                    inner_offset,
3281                    inner_depth
3282                )?;
3283                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3284                {
3285                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3286                }
3287                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3288                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3289                }
3290            }
3291
3292            next_offset += envelope_size;
3293            _next_ordinal_to_read += 1;
3294            if next_offset >= end_offset {
3295                return Ok(());
3296            }
3297
3298            // Decode unknown envelopes for gaps in ordinals.
3299            while _next_ordinal_to_read < 2 {
3300                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3301                _next_ordinal_to_read += 1;
3302                next_offset += envelope_size;
3303            }
3304
3305            let next_out_of_line = decoder.next_out_of_line();
3306            let handles_before = decoder.remaining_handles();
3307            if let Some((inlined, num_bytes, num_handles)) =
3308                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3309            {
3310                let member_inline_size = <fidl_fuchsia_test_manager::RunSuiteOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3311                if inlined != (member_inline_size <= 4) {
3312                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3313                }
3314                let inner_offset;
3315                let mut inner_depth = depth.clone();
3316                if inlined {
3317                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3318                    inner_offset = next_offset;
3319                } else {
3320                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3321                    inner_depth.increment()?;
3322                }
3323                let val_ref = self.options.get_or_insert_with(|| {
3324                    fidl::new_empty!(
3325                        fidl_fuchsia_test_manager::RunSuiteOptions,
3326                        fidl::encoding::DefaultFuchsiaResourceDialect
3327                    )
3328                });
3329                fidl::decode!(
3330                    fidl_fuchsia_test_manager::RunSuiteOptions,
3331                    fidl::encoding::DefaultFuchsiaResourceDialect,
3332                    val_ref,
3333                    decoder,
3334                    inner_offset,
3335                    inner_depth
3336                )?;
3337                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3338                {
3339                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3340                }
3341                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3342                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3343                }
3344            }
3345
3346            next_offset += envelope_size;
3347
3348            // Decode the remaining unknown envelopes.
3349            while next_offset < end_offset {
3350                _next_ordinal_to_read += 1;
3351                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3352                next_offset += envelope_size;
3353            }
3354
3355            Ok(())
3356        }
3357    }
3358
3359    impl SessionConfigureRequest {
3360        #[inline(always)]
3361        fn max_ordinal_present(&self) -> u64 {
3362            if let Some(_) = self.config {
3363                return 2;
3364            }
3365            if let Some(_) = self.output {
3366                return 1;
3367            }
3368            0
3369        }
3370    }
3371
3372    impl fidl::encoding::ResourceTypeMarker for SessionConfigureRequest {
3373        type Borrowed<'a> = &'a mut Self;
3374        fn take_or_borrow<'a>(
3375            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3376        ) -> Self::Borrowed<'a> {
3377            value
3378        }
3379    }
3380
3381    unsafe impl fidl::encoding::TypeMarker for SessionConfigureRequest {
3382        type Owned = Self;
3383
3384        #[inline(always)]
3385        fn inline_align(_context: fidl::encoding::Context) -> usize {
3386            8
3387        }
3388
3389        #[inline(always)]
3390        fn inline_size(_context: fidl::encoding::Context) -> usize {
3391            16
3392        }
3393    }
3394
3395    unsafe impl
3396        fidl::encoding::Encode<
3397            SessionConfigureRequest,
3398            fidl::encoding::DefaultFuchsiaResourceDialect,
3399        > for &mut SessionConfigureRequest
3400    {
3401        unsafe fn encode(
3402            self,
3403            encoder: &mut fidl::encoding::Encoder<
3404                '_,
3405                fidl::encoding::DefaultFuchsiaResourceDialect,
3406            >,
3407            offset: usize,
3408            mut depth: fidl::encoding::Depth,
3409        ) -> fidl::Result<()> {
3410            encoder.debug_check_bounds::<SessionConfigureRequest>(offset);
3411            // Vector header
3412            let max_ordinal: u64 = self.max_ordinal_present();
3413            encoder.write_num(max_ordinal, offset);
3414            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3415            // Calling encoder.out_of_line_offset(0) is not allowed.
3416            if max_ordinal == 0 {
3417                return Ok(());
3418            }
3419            depth.increment()?;
3420            let envelope_size = 8;
3421            let bytes_len = max_ordinal as usize * envelope_size;
3422            #[allow(unused_variables)]
3423            let offset = encoder.out_of_line_offset(bytes_len);
3424            let mut _prev_end_offset: usize = 0;
3425            if 1 > max_ordinal {
3426                return Ok(());
3427            }
3428
3429            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3430            // are envelope_size bytes.
3431            let cur_offset: usize = (1 - 1) * envelope_size;
3432
3433            // Zero reserved fields.
3434            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3435
3436            // Safety:
3437            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3438            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3439            //   envelope_size bytes, there is always sufficient room.
3440            fidl::encoding::encode_in_envelope_optional::<
3441                fidl::encoding::HandleType<
3442                    fidl::Socket,
3443                    { fidl::ObjectType::SOCKET.into_raw() },
3444                    2147483648,
3445                >,
3446                fidl::encoding::DefaultFuchsiaResourceDialect,
3447            >(
3448                self.output.as_mut().map(
3449                    <fidl::encoding::HandleType<
3450                        fidl::Socket,
3451                        { fidl::ObjectType::SOCKET.into_raw() },
3452                        2147483648,
3453                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3454                ),
3455                encoder,
3456                offset + cur_offset,
3457                depth,
3458            )?;
3459
3460            _prev_end_offset = cur_offset + envelope_size;
3461            if 2 > max_ordinal {
3462                return Ok(());
3463            }
3464
3465            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3466            // are envelope_size bytes.
3467            let cur_offset: usize = (2 - 1) * envelope_size;
3468
3469            // Zero reserved fields.
3470            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3471
3472            // Safety:
3473            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3474            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3475            //   envelope_size bytes, there is always sufficient room.
3476            fidl::encoding::encode_in_envelope_optional::<
3477                Config,
3478                fidl::encoding::DefaultFuchsiaResourceDialect,
3479            >(
3480                self.config
3481                    .as_mut()
3482                    .map(<Config as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3483                encoder,
3484                offset + cur_offset,
3485                depth,
3486            )?;
3487
3488            _prev_end_offset = cur_offset + envelope_size;
3489
3490            Ok(())
3491        }
3492    }
3493
3494    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3495        for SessionConfigureRequest
3496    {
3497        #[inline(always)]
3498        fn new_empty() -> Self {
3499            Self::default()
3500        }
3501
3502        unsafe fn decode(
3503            &mut self,
3504            decoder: &mut fidl::encoding::Decoder<
3505                '_,
3506                fidl::encoding::DefaultFuchsiaResourceDialect,
3507            >,
3508            offset: usize,
3509            mut depth: fidl::encoding::Depth,
3510        ) -> fidl::Result<()> {
3511            decoder.debug_check_bounds::<Self>(offset);
3512            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3513                None => return Err(fidl::Error::NotNullable),
3514                Some(len) => len,
3515            };
3516            // Calling decoder.out_of_line_offset(0) is not allowed.
3517            if len == 0 {
3518                return Ok(());
3519            };
3520            depth.increment()?;
3521            let envelope_size = 8;
3522            let bytes_len = len * envelope_size;
3523            let offset = decoder.out_of_line_offset(bytes_len)?;
3524            // Decode the envelope for each type.
3525            let mut _next_ordinal_to_read = 0;
3526            let mut next_offset = offset;
3527            let end_offset = offset + bytes_len;
3528            _next_ordinal_to_read += 1;
3529            if next_offset >= end_offset {
3530                return Ok(());
3531            }
3532
3533            // Decode unknown envelopes for gaps in ordinals.
3534            while _next_ordinal_to_read < 1 {
3535                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3536                _next_ordinal_to_read += 1;
3537                next_offset += envelope_size;
3538            }
3539
3540            let next_out_of_line = decoder.next_out_of_line();
3541            let handles_before = decoder.remaining_handles();
3542            if let Some((inlined, num_bytes, num_handles)) =
3543                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3544            {
3545                let member_inline_size = <fidl::encoding::HandleType<
3546                    fidl::Socket,
3547                    { fidl::ObjectType::SOCKET.into_raw() },
3548                    2147483648,
3549                > as fidl::encoding::TypeMarker>::inline_size(
3550                    decoder.context
3551                );
3552                if inlined != (member_inline_size <= 4) {
3553                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3554                }
3555                let inner_offset;
3556                let mut inner_depth = depth.clone();
3557                if inlined {
3558                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3559                    inner_offset = next_offset;
3560                } else {
3561                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3562                    inner_depth.increment()?;
3563                }
3564                let val_ref =
3565                self.output.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3566                fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3567                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3568                {
3569                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3570                }
3571                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3572                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3573                }
3574            }
3575
3576            next_offset += envelope_size;
3577            _next_ordinal_to_read += 1;
3578            if next_offset >= end_offset {
3579                return Ok(());
3580            }
3581
3582            // Decode unknown envelopes for gaps in ordinals.
3583            while _next_ordinal_to_read < 2 {
3584                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3585                _next_ordinal_to_read += 1;
3586                next_offset += envelope_size;
3587            }
3588
3589            let next_out_of_line = decoder.next_out_of_line();
3590            let handles_before = decoder.remaining_handles();
3591            if let Some((inlined, num_bytes, num_handles)) =
3592                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3593            {
3594                let member_inline_size =
3595                    <Config as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3596                if inlined != (member_inline_size <= 4) {
3597                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3598                }
3599                let inner_offset;
3600                let mut inner_depth = depth.clone();
3601                if inlined {
3602                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3603                    inner_offset = next_offset;
3604                } else {
3605                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3606                    inner_depth.increment()?;
3607                }
3608                let val_ref = self.config.get_or_insert_with(|| {
3609                    fidl::new_empty!(Config, fidl::encoding::DefaultFuchsiaResourceDialect)
3610                });
3611                fidl::decode!(
3612                    Config,
3613                    fidl::encoding::DefaultFuchsiaResourceDialect,
3614                    val_ref,
3615                    decoder,
3616                    inner_offset,
3617                    inner_depth
3618                )?;
3619                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3620                {
3621                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3622                }
3623                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3624                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3625                }
3626            }
3627
3628            next_offset += envelope_size;
3629
3630            // Decode the remaining unknown envelopes.
3631            while next_offset < end_offset {
3632                _next_ordinal_to_read += 1;
3633                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3634                next_offset += envelope_size;
3635            }
3636
3637            Ok(())
3638        }
3639    }
3640
3641    impl SessionManagerStartSessionRequest {
3642        #[inline(always)]
3643        fn max_ordinal_present(&self) -> u64 {
3644            if let Some(_) = self.config {
3645                return 1;
3646            }
3647            0
3648        }
3649    }
3650
3651    impl fidl::encoding::ResourceTypeMarker for SessionManagerStartSessionRequest {
3652        type Borrowed<'a> = &'a mut Self;
3653        fn take_or_borrow<'a>(
3654            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3655        ) -> Self::Borrowed<'a> {
3656            value
3657        }
3658    }
3659
3660    unsafe impl fidl::encoding::TypeMarker for SessionManagerStartSessionRequest {
3661        type Owned = Self;
3662
3663        #[inline(always)]
3664        fn inline_align(_context: fidl::encoding::Context) -> usize {
3665            8
3666        }
3667
3668        #[inline(always)]
3669        fn inline_size(_context: fidl::encoding::Context) -> usize {
3670            16
3671        }
3672    }
3673
3674    unsafe impl
3675        fidl::encoding::Encode<
3676            SessionManagerStartSessionRequest,
3677            fidl::encoding::DefaultFuchsiaResourceDialect,
3678        > for &mut SessionManagerStartSessionRequest
3679    {
3680        unsafe fn encode(
3681            self,
3682            encoder: &mut fidl::encoding::Encoder<
3683                '_,
3684                fidl::encoding::DefaultFuchsiaResourceDialect,
3685            >,
3686            offset: usize,
3687            mut depth: fidl::encoding::Depth,
3688        ) -> fidl::Result<()> {
3689            encoder.debug_check_bounds::<SessionManagerStartSessionRequest>(offset);
3690            // Vector header
3691            let max_ordinal: u64 = self.max_ordinal_present();
3692            encoder.write_num(max_ordinal, offset);
3693            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3694            // Calling encoder.out_of_line_offset(0) is not allowed.
3695            if max_ordinal == 0 {
3696                return Ok(());
3697            }
3698            depth.increment()?;
3699            let envelope_size = 8;
3700            let bytes_len = max_ordinal as usize * envelope_size;
3701            #[allow(unused_variables)]
3702            let offset = encoder.out_of_line_offset(bytes_len);
3703            let mut _prev_end_offset: usize = 0;
3704            if 1 > max_ordinal {
3705                return Ok(());
3706            }
3707
3708            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3709            // are envelope_size bytes.
3710            let cur_offset: usize = (1 - 1) * envelope_size;
3711
3712            // Zero reserved fields.
3713            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3714
3715            // Safety:
3716            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3717            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3718            //   envelope_size bytes, there is always sufficient room.
3719            fidl::encoding::encode_in_envelope_optional::<
3720                Config,
3721                fidl::encoding::DefaultFuchsiaResourceDialect,
3722            >(
3723                self.config
3724                    .as_mut()
3725                    .map(<Config as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3726                encoder,
3727                offset + cur_offset,
3728                depth,
3729            )?;
3730
3731            _prev_end_offset = cur_offset + envelope_size;
3732
3733            Ok(())
3734        }
3735    }
3736
3737    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3738        for SessionManagerStartSessionRequest
3739    {
3740        #[inline(always)]
3741        fn new_empty() -> Self {
3742            Self::default()
3743        }
3744
3745        unsafe fn decode(
3746            &mut self,
3747            decoder: &mut fidl::encoding::Decoder<
3748                '_,
3749                fidl::encoding::DefaultFuchsiaResourceDialect,
3750            >,
3751            offset: usize,
3752            mut depth: fidl::encoding::Depth,
3753        ) -> fidl::Result<()> {
3754            decoder.debug_check_bounds::<Self>(offset);
3755            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3756                None => return Err(fidl::Error::NotNullable),
3757                Some(len) => len,
3758            };
3759            // Calling decoder.out_of_line_offset(0) is not allowed.
3760            if len == 0 {
3761                return Ok(());
3762            };
3763            depth.increment()?;
3764            let envelope_size = 8;
3765            let bytes_len = len * envelope_size;
3766            let offset = decoder.out_of_line_offset(bytes_len)?;
3767            // Decode the envelope for each type.
3768            let mut _next_ordinal_to_read = 0;
3769            let mut next_offset = offset;
3770            let end_offset = offset + bytes_len;
3771            _next_ordinal_to_read += 1;
3772            if next_offset >= end_offset {
3773                return Ok(());
3774            }
3775
3776            // Decode unknown envelopes for gaps in ordinals.
3777            while _next_ordinal_to_read < 1 {
3778                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3779                _next_ordinal_to_read += 1;
3780                next_offset += envelope_size;
3781            }
3782
3783            let next_out_of_line = decoder.next_out_of_line();
3784            let handles_before = decoder.remaining_handles();
3785            if let Some((inlined, num_bytes, num_handles)) =
3786                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3787            {
3788                let member_inline_size =
3789                    <Config as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3790                if inlined != (member_inline_size <= 4) {
3791                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3792                }
3793                let inner_offset;
3794                let mut inner_depth = depth.clone();
3795                if inlined {
3796                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3797                    inner_offset = next_offset;
3798                } else {
3799                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3800                    inner_depth.increment()?;
3801                }
3802                let val_ref = self.config.get_or_insert_with(|| {
3803                    fidl::new_empty!(Config, fidl::encoding::DefaultFuchsiaResourceDialect)
3804                });
3805                fidl::decode!(
3806                    Config,
3807                    fidl::encoding::DefaultFuchsiaResourceDialect,
3808                    val_ref,
3809                    decoder,
3810                    inner_offset,
3811                    inner_depth
3812                )?;
3813                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3814                {
3815                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3816                }
3817                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3818                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3819                }
3820            }
3821
3822            next_offset += envelope_size;
3823
3824            // Decode the remaining unknown envelopes.
3825            while next_offset < end_offset {
3826                _next_ordinal_to_read += 1;
3827                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3828                next_offset += envelope_size;
3829            }
3830
3831            Ok(())
3832        }
3833    }
3834
3835    impl SessionManagerStopSessionRequest {
3836        #[inline(always)]
3837        fn max_ordinal_present(&self) -> u64 {
3838            if let Some(_) = self.output {
3839                return 2;
3840            }
3841            if let Some(_) = self.task_id {
3842                return 1;
3843            }
3844            0
3845        }
3846    }
3847
3848    impl fidl::encoding::ResourceTypeMarker for SessionManagerStopSessionRequest {
3849        type Borrowed<'a> = &'a mut Self;
3850        fn take_or_borrow<'a>(
3851            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3852        ) -> Self::Borrowed<'a> {
3853            value
3854        }
3855    }
3856
3857    unsafe impl fidl::encoding::TypeMarker for SessionManagerStopSessionRequest {
3858        type Owned = Self;
3859
3860        #[inline(always)]
3861        fn inline_align(_context: fidl::encoding::Context) -> usize {
3862            8
3863        }
3864
3865        #[inline(always)]
3866        fn inline_size(_context: fidl::encoding::Context) -> usize {
3867            16
3868        }
3869    }
3870
3871    unsafe impl
3872        fidl::encoding::Encode<
3873            SessionManagerStopSessionRequest,
3874            fidl::encoding::DefaultFuchsiaResourceDialect,
3875        > for &mut SessionManagerStopSessionRequest
3876    {
3877        unsafe fn encode(
3878            self,
3879            encoder: &mut fidl::encoding::Encoder<
3880                '_,
3881                fidl::encoding::DefaultFuchsiaResourceDialect,
3882            >,
3883            offset: usize,
3884            mut depth: fidl::encoding::Depth,
3885        ) -> fidl::Result<()> {
3886            encoder.debug_check_bounds::<SessionManagerStopSessionRequest>(offset);
3887            // Vector header
3888            let max_ordinal: u64 = self.max_ordinal_present();
3889            encoder.write_num(max_ordinal, offset);
3890            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3891            // Calling encoder.out_of_line_offset(0) is not allowed.
3892            if max_ordinal == 0 {
3893                return Ok(());
3894            }
3895            depth.increment()?;
3896            let envelope_size = 8;
3897            let bytes_len = max_ordinal as usize * envelope_size;
3898            #[allow(unused_variables)]
3899            let offset = encoder.out_of_line_offset(bytes_len);
3900            let mut _prev_end_offset: usize = 0;
3901            if 1 > max_ordinal {
3902                return Ok(());
3903            }
3904
3905            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3906            // are envelope_size bytes.
3907            let cur_offset: usize = (1 - 1) * envelope_size;
3908
3909            // Zero reserved fields.
3910            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3911
3912            // Safety:
3913            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3914            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3915            //   envelope_size bytes, there is always sufficient room.
3916            fidl::encoding::encode_in_envelope_optional::<
3917                u64,
3918                fidl::encoding::DefaultFuchsiaResourceDialect,
3919            >(
3920                self.task_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3921                encoder,
3922                offset + cur_offset,
3923                depth,
3924            )?;
3925
3926            _prev_end_offset = cur_offset + envelope_size;
3927            if 2 > max_ordinal {
3928                return Ok(());
3929            }
3930
3931            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3932            // are envelope_size bytes.
3933            let cur_offset: usize = (2 - 1) * envelope_size;
3934
3935            // Zero reserved fields.
3936            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3937
3938            // Safety:
3939            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3940            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3941            //   envelope_size bytes, there is always sufficient room.
3942            fidl::encoding::encode_in_envelope_optional::<
3943                fidl::encoding::HandleType<
3944                    fidl::Socket,
3945                    { fidl::ObjectType::SOCKET.into_raw() },
3946                    2147483648,
3947                >,
3948                fidl::encoding::DefaultFuchsiaResourceDialect,
3949            >(
3950                self.output.as_mut().map(
3951                    <fidl::encoding::HandleType<
3952                        fidl::Socket,
3953                        { fidl::ObjectType::SOCKET.into_raw() },
3954                        2147483648,
3955                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3956                ),
3957                encoder,
3958                offset + cur_offset,
3959                depth,
3960            )?;
3961
3962            _prev_end_offset = cur_offset + envelope_size;
3963
3964            Ok(())
3965        }
3966    }
3967
3968    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3969        for SessionManagerStopSessionRequest
3970    {
3971        #[inline(always)]
3972        fn new_empty() -> Self {
3973            Self::default()
3974        }
3975
3976        unsafe fn decode(
3977            &mut self,
3978            decoder: &mut fidl::encoding::Decoder<
3979                '_,
3980                fidl::encoding::DefaultFuchsiaResourceDialect,
3981            >,
3982            offset: usize,
3983            mut depth: fidl::encoding::Depth,
3984        ) -> fidl::Result<()> {
3985            decoder.debug_check_bounds::<Self>(offset);
3986            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3987                None => return Err(fidl::Error::NotNullable),
3988                Some(len) => len,
3989            };
3990            // Calling decoder.out_of_line_offset(0) is not allowed.
3991            if len == 0 {
3992                return Ok(());
3993            };
3994            depth.increment()?;
3995            let envelope_size = 8;
3996            let bytes_len = len * envelope_size;
3997            let offset = decoder.out_of_line_offset(bytes_len)?;
3998            // Decode the envelope for each type.
3999            let mut _next_ordinal_to_read = 0;
4000            let mut next_offset = offset;
4001            let end_offset = offset + bytes_len;
4002            _next_ordinal_to_read += 1;
4003            if next_offset >= end_offset {
4004                return Ok(());
4005            }
4006
4007            // Decode unknown envelopes for gaps in ordinals.
4008            while _next_ordinal_to_read < 1 {
4009                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4010                _next_ordinal_to_read += 1;
4011                next_offset += envelope_size;
4012            }
4013
4014            let next_out_of_line = decoder.next_out_of_line();
4015            let handles_before = decoder.remaining_handles();
4016            if let Some((inlined, num_bytes, num_handles)) =
4017                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4018            {
4019                let member_inline_size =
4020                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4021                if inlined != (member_inline_size <= 4) {
4022                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4023                }
4024                let inner_offset;
4025                let mut inner_depth = depth.clone();
4026                if inlined {
4027                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4028                    inner_offset = next_offset;
4029                } else {
4030                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4031                    inner_depth.increment()?;
4032                }
4033                let val_ref = self.task_id.get_or_insert_with(|| {
4034                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
4035                });
4036                fidl::decode!(
4037                    u64,
4038                    fidl::encoding::DefaultFuchsiaResourceDialect,
4039                    val_ref,
4040                    decoder,
4041                    inner_offset,
4042                    inner_depth
4043                )?;
4044                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4045                {
4046                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4047                }
4048                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4049                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4050                }
4051            }
4052
4053            next_offset += envelope_size;
4054            _next_ordinal_to_read += 1;
4055            if next_offset >= end_offset {
4056                return Ok(());
4057            }
4058
4059            // Decode unknown envelopes for gaps in ordinals.
4060            while _next_ordinal_to_read < 2 {
4061                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4062                _next_ordinal_to_read += 1;
4063                next_offset += envelope_size;
4064            }
4065
4066            let next_out_of_line = decoder.next_out_of_line();
4067            let handles_before = decoder.remaining_handles();
4068            if let Some((inlined, num_bytes, num_handles)) =
4069                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4070            {
4071                let member_inline_size = <fidl::encoding::HandleType<
4072                    fidl::Socket,
4073                    { fidl::ObjectType::SOCKET.into_raw() },
4074                    2147483648,
4075                > as fidl::encoding::TypeMarker>::inline_size(
4076                    decoder.context
4077                );
4078                if inlined != (member_inline_size <= 4) {
4079                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4080                }
4081                let inner_offset;
4082                let mut inner_depth = depth.clone();
4083                if inlined {
4084                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4085                    inner_offset = next_offset;
4086                } else {
4087                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4088                    inner_depth.increment()?;
4089                }
4090                let val_ref =
4091                self.output.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4092                fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4093                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4094                {
4095                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4096                }
4097                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4098                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4099                }
4100            }
4101
4102            next_offset += envelope_size;
4103
4104            // Decode the remaining unknown envelopes.
4105            while next_offset < end_offset {
4106                _next_ordinal_to_read += 1;
4107                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4108                next_offset += envelope_size;
4109            }
4110
4111            Ok(())
4112        }
4113    }
4114
4115    impl fidl::encoding::ResourceTypeMarker for AttachConfig {
4116        type Borrowed<'a> = &'a mut Self;
4117        fn take_or_borrow<'a>(
4118            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4119        ) -> Self::Borrowed<'a> {
4120            value
4121        }
4122    }
4123
4124    unsafe impl fidl::encoding::TypeMarker for AttachConfig {
4125        type Owned = Self;
4126
4127        #[inline(always)]
4128        fn inline_align(_context: fidl::encoding::Context) -> usize {
4129            8
4130        }
4131
4132        #[inline(always)]
4133        fn inline_size(_context: fidl::encoding::Context) -> usize {
4134            16
4135        }
4136    }
4137
4138    unsafe impl fidl::encoding::Encode<AttachConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
4139        for &mut AttachConfig
4140    {
4141        #[inline]
4142        unsafe fn encode(
4143            self,
4144            encoder: &mut fidl::encoding::Encoder<
4145                '_,
4146                fidl::encoding::DefaultFuchsiaResourceDialect,
4147            >,
4148            offset: usize,
4149            _depth: fidl::encoding::Depth,
4150        ) -> fidl::Result<()> {
4151            encoder.debug_check_bounds::<AttachConfig>(offset);
4152            encoder.write_num::<u64>(self.ordinal(), offset);
4153            match self {
4154            AttachConfig::LaunchComponent(ref val) => {
4155                fidl::encoding::encode_in_envelope::<LaunchComponent, fidl::encoding::DefaultFuchsiaResourceDialect>(
4156                    <LaunchComponent as fidl::encoding::ValueTypeMarker>::borrow(val),
4157                    encoder, offset + 8, _depth
4158                )
4159            }
4160            AttachConfig::AttachToComponentMoniker(ref val) => {
4161                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4162                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
4163                    encoder, offset + 8, _depth
4164                )
4165            }
4166            AttachConfig::AttachToComponentUrl(ref val) => {
4167                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4168                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
4169                    encoder, offset + 8, _depth
4170                )
4171            }
4172            AttachConfig::LaunchTest(ref mut val) => {
4173                fidl::encoding::encode_in_envelope::<LaunchTest, fidl::encoding::DefaultFuchsiaResourceDialect>(
4174                    <LaunchTest as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4175                    encoder, offset + 8, _depth
4176                )
4177            }
4178            AttachConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4179        }
4180        }
4181    }
4182
4183    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for AttachConfig {
4184        #[inline(always)]
4185        fn new_empty() -> Self {
4186            Self::__SourceBreaking { unknown_ordinal: 0 }
4187        }
4188
4189        #[inline]
4190        unsafe fn decode(
4191            &mut self,
4192            decoder: &mut fidl::encoding::Decoder<
4193                '_,
4194                fidl::encoding::DefaultFuchsiaResourceDialect,
4195            >,
4196            offset: usize,
4197            mut depth: fidl::encoding::Depth,
4198        ) -> fidl::Result<()> {
4199            decoder.debug_check_bounds::<Self>(offset);
4200            #[allow(unused_variables)]
4201            let next_out_of_line = decoder.next_out_of_line();
4202            let handles_before = decoder.remaining_handles();
4203            let (ordinal, inlined, num_bytes, num_handles) =
4204                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4205
4206            let member_inline_size = match ordinal {
4207                1 => <LaunchComponent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4208                2 => {
4209                    <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
4210                        decoder.context,
4211                    )
4212                }
4213                3 => {
4214                    <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
4215                        decoder.context,
4216                    )
4217                }
4218                4 => <LaunchTest as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4219                0 => return Err(fidl::Error::UnknownUnionTag),
4220                _ => num_bytes as usize,
4221            };
4222
4223            if inlined != (member_inline_size <= 4) {
4224                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4225            }
4226            let _inner_offset;
4227            if inlined {
4228                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4229                _inner_offset = offset + 8;
4230            } else {
4231                depth.increment()?;
4232                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4233            }
4234            match ordinal {
4235                1 => {
4236                    #[allow(irrefutable_let_patterns)]
4237                    if let AttachConfig::LaunchComponent(_) = self {
4238                        // Do nothing, read the value into the object
4239                    } else {
4240                        // Initialize `self` to the right variant
4241                        *self = AttachConfig::LaunchComponent(fidl::new_empty!(
4242                            LaunchComponent,
4243                            fidl::encoding::DefaultFuchsiaResourceDialect
4244                        ));
4245                    }
4246                    #[allow(irrefutable_let_patterns)]
4247                    if let AttachConfig::LaunchComponent(ref mut val) = self {
4248                        fidl::decode!(
4249                            LaunchComponent,
4250                            fidl::encoding::DefaultFuchsiaResourceDialect,
4251                            val,
4252                            decoder,
4253                            _inner_offset,
4254                            depth
4255                        )?;
4256                    } else {
4257                        unreachable!()
4258                    }
4259                }
4260                2 => {
4261                    #[allow(irrefutable_let_patterns)]
4262                    if let AttachConfig::AttachToComponentMoniker(_) = self {
4263                        // Do nothing, read the value into the object
4264                    } else {
4265                        // Initialize `self` to the right variant
4266                        *self = AttachConfig::AttachToComponentMoniker(fidl::new_empty!(
4267                            fidl::encoding::BoundedString<4096>,
4268                            fidl::encoding::DefaultFuchsiaResourceDialect
4269                        ));
4270                    }
4271                    #[allow(irrefutable_let_patterns)]
4272                    if let AttachConfig::AttachToComponentMoniker(ref mut val) = self {
4273                        fidl::decode!(
4274                            fidl::encoding::BoundedString<4096>,
4275                            fidl::encoding::DefaultFuchsiaResourceDialect,
4276                            val,
4277                            decoder,
4278                            _inner_offset,
4279                            depth
4280                        )?;
4281                    } else {
4282                        unreachable!()
4283                    }
4284                }
4285                3 => {
4286                    #[allow(irrefutable_let_patterns)]
4287                    if let AttachConfig::AttachToComponentUrl(_) = self {
4288                        // Do nothing, read the value into the object
4289                    } else {
4290                        // Initialize `self` to the right variant
4291                        *self = AttachConfig::AttachToComponentUrl(fidl::new_empty!(
4292                            fidl::encoding::BoundedString<4096>,
4293                            fidl::encoding::DefaultFuchsiaResourceDialect
4294                        ));
4295                    }
4296                    #[allow(irrefutable_let_patterns)]
4297                    if let AttachConfig::AttachToComponentUrl(ref mut val) = self {
4298                        fidl::decode!(
4299                            fidl::encoding::BoundedString<4096>,
4300                            fidl::encoding::DefaultFuchsiaResourceDialect,
4301                            val,
4302                            decoder,
4303                            _inner_offset,
4304                            depth
4305                        )?;
4306                    } else {
4307                        unreachable!()
4308                    }
4309                }
4310                4 => {
4311                    #[allow(irrefutable_let_patterns)]
4312                    if let AttachConfig::LaunchTest(_) = self {
4313                        // Do nothing, read the value into the object
4314                    } else {
4315                        // Initialize `self` to the right variant
4316                        *self = AttachConfig::LaunchTest(fidl::new_empty!(
4317                            LaunchTest,
4318                            fidl::encoding::DefaultFuchsiaResourceDialect
4319                        ));
4320                    }
4321                    #[allow(irrefutable_let_patterns)]
4322                    if let AttachConfig::LaunchTest(ref mut val) = self {
4323                        fidl::decode!(
4324                            LaunchTest,
4325                            fidl::encoding::DefaultFuchsiaResourceDialect,
4326                            val,
4327                            decoder,
4328                            _inner_offset,
4329                            depth
4330                        )?;
4331                    } else {
4332                        unreachable!()
4333                    }
4334                }
4335                #[allow(deprecated)]
4336                ordinal => {
4337                    for _ in 0..num_handles {
4338                        decoder.drop_next_handle()?;
4339                    }
4340                    *self = AttachConfig::__SourceBreaking { unknown_ordinal: ordinal };
4341                }
4342            }
4343            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4344                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4345            }
4346            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4347                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4348            }
4349            Ok(())
4350        }
4351    }
4352
4353    impl fidl::encoding::ResourceTypeMarker for TargetConfig {
4354        type Borrowed<'a> = &'a mut Self;
4355        fn take_or_borrow<'a>(
4356            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4357        ) -> Self::Borrowed<'a> {
4358            value
4359        }
4360    }
4361
4362    unsafe impl fidl::encoding::TypeMarker for TargetConfig {
4363        type Owned = Self;
4364
4365        #[inline(always)]
4366        fn inline_align(_context: fidl::encoding::Context) -> usize {
4367            8
4368        }
4369
4370        #[inline(always)]
4371        fn inline_size(_context: fidl::encoding::Context) -> usize {
4372            16
4373        }
4374    }
4375
4376    unsafe impl fidl::encoding::Encode<TargetConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
4377        for &mut TargetConfig
4378    {
4379        #[inline]
4380        unsafe fn encode(
4381            self,
4382            encoder: &mut fidl::encoding::Encoder<
4383                '_,
4384                fidl::encoding::DefaultFuchsiaResourceDialect,
4385            >,
4386            offset: usize,
4387            _depth: fidl::encoding::Depth,
4388        ) -> fidl::Result<()> {
4389            encoder.debug_check_bounds::<TargetConfig>(offset);
4390            encoder.write_num::<u64>(self.ordinal(), offset);
4391            match self {
4392                TargetConfig::Tasks(ref val) => fidl::encoding::encode_in_envelope::<
4393                    fidl::encoding::Vector<Task, 64>,
4394                    fidl::encoding::DefaultFuchsiaResourceDialect,
4395                >(
4396                    <fidl::encoding::Vector<Task, 64> as fidl::encoding::ValueTypeMarker>::borrow(
4397                        val,
4398                    ),
4399                    encoder,
4400                    offset + 8,
4401                    _depth,
4402                ),
4403                TargetConfig::Component(ref mut val) => fidl::encoding::encode_in_envelope::<
4404                    AttachConfig,
4405                    fidl::encoding::DefaultFuchsiaResourceDialect,
4406                >(
4407                    <AttachConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4408                    encoder,
4409                    offset + 8,
4410                    _depth,
4411                ),
4412                TargetConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4413            }
4414        }
4415    }
4416
4417    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for TargetConfig {
4418        #[inline(always)]
4419        fn new_empty() -> Self {
4420            Self::__SourceBreaking { unknown_ordinal: 0 }
4421        }
4422
4423        #[inline]
4424        unsafe fn decode(
4425            &mut self,
4426            decoder: &mut fidl::encoding::Decoder<
4427                '_,
4428                fidl::encoding::DefaultFuchsiaResourceDialect,
4429            >,
4430            offset: usize,
4431            mut depth: fidl::encoding::Depth,
4432        ) -> fidl::Result<()> {
4433            decoder.debug_check_bounds::<Self>(offset);
4434            #[allow(unused_variables)]
4435            let next_out_of_line = decoder.next_out_of_line();
4436            let handles_before = decoder.remaining_handles();
4437            let (ordinal, inlined, num_bytes, num_handles) =
4438                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4439
4440            let member_inline_size = match ordinal {
4441                1 => <fidl::encoding::Vector<Task, 64> as fidl::encoding::TypeMarker>::inline_size(
4442                    decoder.context,
4443                ),
4444                2 => <AttachConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4445                0 => return Err(fidl::Error::UnknownUnionTag),
4446                _ => num_bytes as usize,
4447            };
4448
4449            if inlined != (member_inline_size <= 4) {
4450                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4451            }
4452            let _inner_offset;
4453            if inlined {
4454                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4455                _inner_offset = offset + 8;
4456            } else {
4457                depth.increment()?;
4458                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4459            }
4460            match ordinal {
4461                1 => {
4462                    #[allow(irrefutable_let_patterns)]
4463                    if let TargetConfig::Tasks(_) = self {
4464                        // Do nothing, read the value into the object
4465                    } else {
4466                        // Initialize `self` to the right variant
4467                        *self = TargetConfig::Tasks(
4468                            fidl::new_empty!(fidl::encoding::Vector<Task, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
4469                        );
4470                    }
4471                    #[allow(irrefutable_let_patterns)]
4472                    if let TargetConfig::Tasks(ref mut val) = self {
4473                        fidl::decode!(fidl::encoding::Vector<Task, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
4474                    } else {
4475                        unreachable!()
4476                    }
4477                }
4478                2 => {
4479                    #[allow(irrefutable_let_patterns)]
4480                    if let TargetConfig::Component(_) = self {
4481                        // Do nothing, read the value into the object
4482                    } else {
4483                        // Initialize `self` to the right variant
4484                        *self = TargetConfig::Component(fidl::new_empty!(
4485                            AttachConfig,
4486                            fidl::encoding::DefaultFuchsiaResourceDialect
4487                        ));
4488                    }
4489                    #[allow(irrefutable_let_patterns)]
4490                    if let TargetConfig::Component(ref mut val) = self {
4491                        fidl::decode!(
4492                            AttachConfig,
4493                            fidl::encoding::DefaultFuchsiaResourceDialect,
4494                            val,
4495                            decoder,
4496                            _inner_offset,
4497                            depth
4498                        )?;
4499                    } else {
4500                        unreachable!()
4501                    }
4502                }
4503                #[allow(deprecated)]
4504                ordinal => {
4505                    for _ in 0..num_handles {
4506                        decoder.drop_next_handle()?;
4507                    }
4508                    *self = TargetConfig::__SourceBreaking { unknown_ordinal: ordinal };
4509                }
4510            }
4511            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4512                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4513            }
4514            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4515                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4516            }
4517            Ok(())
4518        }
4519    }
4520}