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