fidl_fuchsia_tracing_controller/
fidl_fuchsia_tracing_controller.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_tracing_controller__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ProvisionerInitializeTracingRequest {
16    pub controller: fidl::endpoints::ServerEnd<SessionMarker>,
17    pub config: TraceConfig,
18    pub output: fidl::Socket,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for ProvisionerInitializeTracingRequest
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct SessionManagerEndTraceSessionRequest {
28    pub task_id: u64,
29    pub output: fidl::Socket,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33    for SessionManagerEndTraceSessionRequest
34{
35}
36
37#[derive(Debug, PartialEq)]
38pub struct SessionManagerStartTraceSessionOnBootRequest {
39    pub config: TraceConfig,
40    pub options: TraceOptions,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44    for SessionManagerStartTraceSessionOnBootRequest
45{
46}
47
48#[derive(Debug, PartialEq)]
49pub struct SessionManagerStartTraceSessionRequest {
50    pub config: TraceConfig,
51    pub options: TraceOptions,
52}
53
54impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
55    for SessionManagerStartTraceSessionRequest
56{
57}
58
59#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
60pub struct ProvisionerMarker;
61
62impl fidl::endpoints::ProtocolMarker for ProvisionerMarker {
63    type Proxy = ProvisionerProxy;
64    type RequestStream = ProvisionerRequestStream;
65    #[cfg(target_os = "fuchsia")]
66    type SynchronousProxy = ProvisionerSynchronousProxy;
67
68    const DEBUG_NAME: &'static str = "fuchsia.tracing.controller.Provisioner";
69}
70impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionerMarker {}
71
72pub trait ProvisionerProxyInterface: Send + Sync {
73    fn r#initialize_tracing(
74        &self,
75        controller: fidl::endpoints::ServerEnd<SessionMarker>,
76        config: &TraceConfig,
77        output: fidl::Socket,
78    ) -> Result<(), fidl::Error>;
79    type GetProvidersResponseFut: std::future::Future<Output = Result<Vec<ProviderInfo>, fidl::Error>>
80        + Send;
81    fn r#get_providers(&self) -> Self::GetProvidersResponseFut;
82    type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
83        + Send;
84    fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
85}
86#[derive(Debug)]
87#[cfg(target_os = "fuchsia")]
88pub struct ProvisionerSynchronousProxy {
89    client: fidl::client::sync::Client,
90}
91
92#[cfg(target_os = "fuchsia")]
93impl fidl::endpoints::SynchronousProxy for ProvisionerSynchronousProxy {
94    type Proxy = ProvisionerProxy;
95    type Protocol = ProvisionerMarker;
96
97    fn from_channel(inner: fidl::Channel) -> Self {
98        Self::new(inner)
99    }
100
101    fn into_channel(self) -> fidl::Channel {
102        self.client.into_channel()
103    }
104
105    fn as_channel(&self) -> &fidl::Channel {
106        self.client.as_channel()
107    }
108}
109
110#[cfg(target_os = "fuchsia")]
111impl ProvisionerSynchronousProxy {
112    pub fn new(channel: fidl::Channel) -> Self {
113        let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
114        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
115    }
116
117    pub fn into_channel(self) -> fidl::Channel {
118        self.client.into_channel()
119    }
120
121    /// Waits until an event arrives and returns it. It is safe for other
122    /// threads to make concurrent requests while waiting for an event.
123    pub fn wait_for_event(
124        &self,
125        deadline: zx::MonotonicInstant,
126    ) -> Result<ProvisionerEvent, fidl::Error> {
127        ProvisionerEvent::decode(self.client.wait_for_event(deadline)?)
128    }
129
130    /// Requests to initialize tracing with the specified `config`.
131    ///
132    /// A bad request will terminate the connection.
133    ///
134    /// Dropping the socket connection will abort and terminate the
135    /// existing trace Session.
136    ///
137    /// The trace controller emits trace data to `output` as a sequence of
138    /// binary formatted trace records.  Traces obtained from different providers
139    /// are delimited by metadata records within the stream.
140    pub fn r#initialize_tracing(
141        &self,
142        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
143        mut config: &TraceConfig,
144        mut output: fidl::Socket,
145    ) -> Result<(), fidl::Error> {
146        self.client.send::<ProvisionerInitializeTracingRequest>(
147            (controller, config, output),
148            0x3b046ed3a0684ab8,
149            fidl::encoding::DynamicFlags::FLEXIBLE,
150        )
151    }
152
153    /// Return the set of registered providers.
154    pub fn r#get_providers(
155        &self,
156        ___deadline: zx::MonotonicInstant,
157    ) -> Result<Vec<ProviderInfo>, fidl::Error> {
158        let _response = self.client.send_query::<
159            fidl::encoding::EmptyPayload,
160            fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
161        >(
162            (),
163            0xc4d4f36edc50d43,
164            fidl::encoding::DynamicFlags::FLEXIBLE,
165            ___deadline,
166        )?
167        .into_result::<ProvisionerMarker>("get_providers")?;
168        Ok(_response.providers)
169    }
170
171    pub fn r#get_known_categories(
172        &self,
173        ___deadline: zx::MonotonicInstant,
174    ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
175        let _response = self.client.send_query::<
176            fidl::encoding::EmptyPayload,
177            fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
178        >(
179            (),
180            0x41ef99397b945a4,
181            fidl::encoding::DynamicFlags::FLEXIBLE,
182            ___deadline,
183        )?
184        .into_result::<ProvisionerMarker>("get_known_categories")?;
185        Ok(_response.categories)
186    }
187}
188
189#[cfg(target_os = "fuchsia")]
190impl From<ProvisionerSynchronousProxy> for zx::Handle {
191    fn from(value: ProvisionerSynchronousProxy) -> Self {
192        value.into_channel().into()
193    }
194}
195
196#[cfg(target_os = "fuchsia")]
197impl From<fidl::Channel> for ProvisionerSynchronousProxy {
198    fn from(value: fidl::Channel) -> Self {
199        Self::new(value)
200    }
201}
202
203#[cfg(target_os = "fuchsia")]
204impl fidl::endpoints::FromClient for ProvisionerSynchronousProxy {
205    type Protocol = ProvisionerMarker;
206
207    fn from_client(value: fidl::endpoints::ClientEnd<ProvisionerMarker>) -> Self {
208        Self::new(value.into_channel())
209    }
210}
211
212#[derive(Debug, Clone)]
213pub struct ProvisionerProxy {
214    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
215}
216
217impl fidl::endpoints::Proxy for ProvisionerProxy {
218    type Protocol = ProvisionerMarker;
219
220    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
221        Self::new(inner)
222    }
223
224    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
225        self.client.into_channel().map_err(|client| Self { client })
226    }
227
228    fn as_channel(&self) -> &::fidl::AsyncChannel {
229        self.client.as_channel()
230    }
231}
232
233impl ProvisionerProxy {
234    /// Create a new Proxy for fuchsia.tracing.controller/Provisioner.
235    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
236        let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
237        Self { client: fidl::client::Client::new(channel, protocol_name) }
238    }
239
240    /// Get a Stream of events from the remote end of the protocol.
241    ///
242    /// # Panics
243    ///
244    /// Panics if the event stream was already taken.
245    pub fn take_event_stream(&self) -> ProvisionerEventStream {
246        ProvisionerEventStream { event_receiver: self.client.take_event_receiver() }
247    }
248
249    /// Requests to initialize tracing with the specified `config`.
250    ///
251    /// A bad request will terminate the connection.
252    ///
253    /// Dropping the socket connection will abort and terminate the
254    /// existing trace Session.
255    ///
256    /// The trace controller emits trace data to `output` as a sequence of
257    /// binary formatted trace records.  Traces obtained from different providers
258    /// are delimited by metadata records within the stream.
259    pub fn r#initialize_tracing(
260        &self,
261        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
262        mut config: &TraceConfig,
263        mut output: fidl::Socket,
264    ) -> Result<(), fidl::Error> {
265        ProvisionerProxyInterface::r#initialize_tracing(self, controller, config, output)
266    }
267
268    /// Return the set of registered providers.
269    pub fn r#get_providers(
270        &self,
271    ) -> fidl::client::QueryResponseFut<
272        Vec<ProviderInfo>,
273        fidl::encoding::DefaultFuchsiaResourceDialect,
274    > {
275        ProvisionerProxyInterface::r#get_providers(self)
276    }
277
278    pub fn r#get_known_categories(
279        &self,
280    ) -> fidl::client::QueryResponseFut<
281        Vec<fidl_fuchsia_tracing::KnownCategory>,
282        fidl::encoding::DefaultFuchsiaResourceDialect,
283    > {
284        ProvisionerProxyInterface::r#get_known_categories(self)
285    }
286}
287
288impl ProvisionerProxyInterface for ProvisionerProxy {
289    fn r#initialize_tracing(
290        &self,
291        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
292        mut config: &TraceConfig,
293        mut output: fidl::Socket,
294    ) -> Result<(), fidl::Error> {
295        self.client.send::<ProvisionerInitializeTracingRequest>(
296            (controller, config, output),
297            0x3b046ed3a0684ab8,
298            fidl::encoding::DynamicFlags::FLEXIBLE,
299        )
300    }
301
302    type GetProvidersResponseFut = fidl::client::QueryResponseFut<
303        Vec<ProviderInfo>,
304        fidl::encoding::DefaultFuchsiaResourceDialect,
305    >;
306    fn r#get_providers(&self) -> Self::GetProvidersResponseFut {
307        fn _decode(
308            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
309        ) -> Result<Vec<ProviderInfo>, fidl::Error> {
310            let _response = fidl::client::decode_transaction_body::<
311                fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
312                fidl::encoding::DefaultFuchsiaResourceDialect,
313                0xc4d4f36edc50d43,
314            >(_buf?)?
315            .into_result::<ProvisionerMarker>("get_providers")?;
316            Ok(_response.providers)
317        }
318        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ProviderInfo>>(
319            (),
320            0xc4d4f36edc50d43,
321            fidl::encoding::DynamicFlags::FLEXIBLE,
322            _decode,
323        )
324    }
325
326    type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
327        Vec<fidl_fuchsia_tracing::KnownCategory>,
328        fidl::encoding::DefaultFuchsiaResourceDialect,
329    >;
330    fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
331        fn _decode(
332            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
333        ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
334            let _response = fidl::client::decode_transaction_body::<
335                fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
336                fidl::encoding::DefaultFuchsiaResourceDialect,
337                0x41ef99397b945a4,
338            >(_buf?)?
339            .into_result::<ProvisionerMarker>("get_known_categories")?;
340            Ok(_response.categories)
341        }
342        self.client.send_query_and_decode::<
343            fidl::encoding::EmptyPayload,
344            Vec<fidl_fuchsia_tracing::KnownCategory>,
345        >(
346            (),
347            0x41ef99397b945a4,
348            fidl::encoding::DynamicFlags::FLEXIBLE,
349            _decode,
350        )
351    }
352}
353
354pub struct ProvisionerEventStream {
355    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
356}
357
358impl std::marker::Unpin for ProvisionerEventStream {}
359
360impl futures::stream::FusedStream for ProvisionerEventStream {
361    fn is_terminated(&self) -> bool {
362        self.event_receiver.is_terminated()
363    }
364}
365
366impl futures::Stream for ProvisionerEventStream {
367    type Item = Result<ProvisionerEvent, fidl::Error>;
368
369    fn poll_next(
370        mut self: std::pin::Pin<&mut Self>,
371        cx: &mut std::task::Context<'_>,
372    ) -> std::task::Poll<Option<Self::Item>> {
373        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
374            &mut self.event_receiver,
375            cx
376        )?) {
377            Some(buf) => std::task::Poll::Ready(Some(ProvisionerEvent::decode(buf))),
378            None => std::task::Poll::Ready(None),
379        }
380    }
381}
382
383#[derive(Debug)]
384pub enum ProvisionerEvent {
385    #[non_exhaustive]
386    _UnknownEvent {
387        /// Ordinal of the event that was sent.
388        ordinal: u64,
389    },
390}
391
392impl ProvisionerEvent {
393    /// Decodes a message buffer as a [`ProvisionerEvent`].
394    fn decode(
395        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
396    ) -> Result<ProvisionerEvent, fidl::Error> {
397        let (bytes, _handles) = buf.split_mut();
398        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
399        debug_assert_eq!(tx_header.tx_id, 0);
400        match tx_header.ordinal {
401            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
402                Ok(ProvisionerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
403            }
404            _ => Err(fidl::Error::UnknownOrdinal {
405                ordinal: tx_header.ordinal,
406                protocol_name: <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
407            }),
408        }
409    }
410}
411
412/// A Stream of incoming requests for fuchsia.tracing.controller/Provisioner.
413pub struct ProvisionerRequestStream {
414    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
415    is_terminated: bool,
416}
417
418impl std::marker::Unpin for ProvisionerRequestStream {}
419
420impl futures::stream::FusedStream for ProvisionerRequestStream {
421    fn is_terminated(&self) -> bool {
422        self.is_terminated
423    }
424}
425
426impl fidl::endpoints::RequestStream for ProvisionerRequestStream {
427    type Protocol = ProvisionerMarker;
428    type ControlHandle = ProvisionerControlHandle;
429
430    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
431        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
432    }
433
434    fn control_handle(&self) -> Self::ControlHandle {
435        ProvisionerControlHandle { inner: self.inner.clone() }
436    }
437
438    fn into_inner(
439        self,
440    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
441    {
442        (self.inner, self.is_terminated)
443    }
444
445    fn from_inner(
446        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
447        is_terminated: bool,
448    ) -> Self {
449        Self { inner, is_terminated }
450    }
451}
452
453impl futures::Stream for ProvisionerRequestStream {
454    type Item = Result<ProvisionerRequest, fidl::Error>;
455
456    fn poll_next(
457        mut self: std::pin::Pin<&mut Self>,
458        cx: &mut std::task::Context<'_>,
459    ) -> std::task::Poll<Option<Self::Item>> {
460        let this = &mut *self;
461        if this.inner.check_shutdown(cx) {
462            this.is_terminated = true;
463            return std::task::Poll::Ready(None);
464        }
465        if this.is_terminated {
466            panic!("polled ProvisionerRequestStream after completion");
467        }
468        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
469            |bytes, handles| {
470                match this.inner.channel().read_etc(cx, bytes, handles) {
471                    std::task::Poll::Ready(Ok(())) => {}
472                    std::task::Poll::Pending => return std::task::Poll::Pending,
473                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
474                        this.is_terminated = true;
475                        return std::task::Poll::Ready(None);
476                    }
477                    std::task::Poll::Ready(Err(e)) => {
478                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
479                            e.into(),
480                        ))));
481                    }
482                }
483
484                // A message has been received from the channel
485                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
486
487                std::task::Poll::Ready(Some(match header.ordinal {
488                    0x3b046ed3a0684ab8 => {
489                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
490                        let mut req = fidl::new_empty!(
491                            ProvisionerInitializeTracingRequest,
492                            fidl::encoding::DefaultFuchsiaResourceDialect
493                        );
494                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProvisionerInitializeTracingRequest>(&header, _body_bytes, handles, &mut req)?;
495                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
496                        Ok(ProvisionerRequest::InitializeTracing {
497                            controller: req.controller,
498                            config: req.config,
499                            output: req.output,
500
501                            control_handle,
502                        })
503                    }
504                    0xc4d4f36edc50d43 => {
505                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
506                        let mut req = fidl::new_empty!(
507                            fidl::encoding::EmptyPayload,
508                            fidl::encoding::DefaultFuchsiaResourceDialect
509                        );
510                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
511                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
512                        Ok(ProvisionerRequest::GetProviders {
513                            responder: ProvisionerGetProvidersResponder {
514                                control_handle: std::mem::ManuallyDrop::new(control_handle),
515                                tx_id: header.tx_id,
516                            },
517                        })
518                    }
519                    0x41ef99397b945a4 => {
520                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
521                        let mut req = fidl::new_empty!(
522                            fidl::encoding::EmptyPayload,
523                            fidl::encoding::DefaultFuchsiaResourceDialect
524                        );
525                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
526                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
527                        Ok(ProvisionerRequest::GetKnownCategories {
528                            responder: ProvisionerGetKnownCategoriesResponder {
529                                control_handle: std::mem::ManuallyDrop::new(control_handle),
530                                tx_id: header.tx_id,
531                            },
532                        })
533                    }
534                    _ if header.tx_id == 0
535                        && header
536                            .dynamic_flags()
537                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
538                    {
539                        Ok(ProvisionerRequest::_UnknownMethod {
540                            ordinal: header.ordinal,
541                            control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
542                            method_type: fidl::MethodType::OneWay,
543                        })
544                    }
545                    _ if header
546                        .dynamic_flags()
547                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
548                    {
549                        this.inner.send_framework_err(
550                            fidl::encoding::FrameworkErr::UnknownMethod,
551                            header.tx_id,
552                            header.ordinal,
553                            header.dynamic_flags(),
554                            (bytes, handles),
555                        )?;
556                        Ok(ProvisionerRequest::_UnknownMethod {
557                            ordinal: header.ordinal,
558                            control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
559                            method_type: fidl::MethodType::TwoWay,
560                        })
561                    }
562                    _ => Err(fidl::Error::UnknownOrdinal {
563                        ordinal: header.ordinal,
564                        protocol_name:
565                            <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
566                    }),
567                }))
568            },
569        )
570    }
571}
572
573/// The provisioner interface used to initialize a trace Session, that can
574/// then be started and stopped.
575///
576/// The provisioner is required to start a trace Session and bind the control
577/// to the client. It can also perform tasks like getting the list of registered
578/// providers and known categories, which can be performed without a existing
579/// trace Session.
580#[derive(Debug)]
581pub enum ProvisionerRequest {
582    /// Requests to initialize tracing with the specified `config`.
583    ///
584    /// A bad request will terminate the connection.
585    ///
586    /// Dropping the socket connection will abort and terminate the
587    /// existing trace Session.
588    ///
589    /// The trace controller emits trace data to `output` as a sequence of
590    /// binary formatted trace records.  Traces obtained from different providers
591    /// are delimited by metadata records within the stream.
592    InitializeTracing {
593        controller: fidl::endpoints::ServerEnd<SessionMarker>,
594        config: TraceConfig,
595        output: fidl::Socket,
596        control_handle: ProvisionerControlHandle,
597    },
598    /// Return the set of registered providers.
599    GetProviders {
600        responder: ProvisionerGetProvidersResponder,
601    },
602    GetKnownCategories {
603        responder: ProvisionerGetKnownCategoriesResponder,
604    },
605    /// An interaction was received which does not match any known method.
606    #[non_exhaustive]
607    _UnknownMethod {
608        /// Ordinal of the method that was called.
609        ordinal: u64,
610        control_handle: ProvisionerControlHandle,
611        method_type: fidl::MethodType,
612    },
613}
614
615impl ProvisionerRequest {
616    #[allow(irrefutable_let_patterns)]
617    pub fn into_initialize_tracing(
618        self,
619    ) -> Option<(
620        fidl::endpoints::ServerEnd<SessionMarker>,
621        TraceConfig,
622        fidl::Socket,
623        ProvisionerControlHandle,
624    )> {
625        if let ProvisionerRequest::InitializeTracing {
626            controller,
627            config,
628            output,
629            control_handle,
630        } = self
631        {
632            Some((controller, config, output, control_handle))
633        } else {
634            None
635        }
636    }
637
638    #[allow(irrefutable_let_patterns)]
639    pub fn into_get_providers(self) -> Option<(ProvisionerGetProvidersResponder)> {
640        if let ProvisionerRequest::GetProviders { responder } = self {
641            Some((responder))
642        } else {
643            None
644        }
645    }
646
647    #[allow(irrefutable_let_patterns)]
648    pub fn into_get_known_categories(self) -> Option<(ProvisionerGetKnownCategoriesResponder)> {
649        if let ProvisionerRequest::GetKnownCategories { responder } = self {
650            Some((responder))
651        } else {
652            None
653        }
654    }
655
656    /// Name of the method defined in FIDL
657    pub fn method_name(&self) -> &'static str {
658        match *self {
659            ProvisionerRequest::InitializeTracing { .. } => "initialize_tracing",
660            ProvisionerRequest::GetProviders { .. } => "get_providers",
661            ProvisionerRequest::GetKnownCategories { .. } => "get_known_categories",
662            ProvisionerRequest::_UnknownMethod {
663                method_type: fidl::MethodType::OneWay, ..
664            } => "unknown one-way method",
665            ProvisionerRequest::_UnknownMethod {
666                method_type: fidl::MethodType::TwoWay, ..
667            } => "unknown two-way method",
668        }
669    }
670}
671
672#[derive(Debug, Clone)]
673pub struct ProvisionerControlHandle {
674    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
675}
676
677impl fidl::endpoints::ControlHandle for ProvisionerControlHandle {
678    fn shutdown(&self) {
679        self.inner.shutdown()
680    }
681    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
682        self.inner.shutdown_with_epitaph(status)
683    }
684
685    fn is_closed(&self) -> bool {
686        self.inner.channel().is_closed()
687    }
688    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
689        self.inner.channel().on_closed()
690    }
691
692    #[cfg(target_os = "fuchsia")]
693    fn signal_peer(
694        &self,
695        clear_mask: zx::Signals,
696        set_mask: zx::Signals,
697    ) -> Result<(), zx_status::Status> {
698        use fidl::Peered;
699        self.inner.channel().signal_peer(clear_mask, set_mask)
700    }
701}
702
703impl ProvisionerControlHandle {}
704
705#[must_use = "FIDL methods require a response to be sent"]
706#[derive(Debug)]
707pub struct ProvisionerGetProvidersResponder {
708    control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
709    tx_id: u32,
710}
711
712/// Set the the channel to be shutdown (see [`ProvisionerControlHandle::shutdown`])
713/// if the responder is dropped without sending a response, so that the client
714/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
715impl std::ops::Drop for ProvisionerGetProvidersResponder {
716    fn drop(&mut self) {
717        self.control_handle.shutdown();
718        // Safety: drops once, never accessed again
719        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
720    }
721}
722
723impl fidl::endpoints::Responder for ProvisionerGetProvidersResponder {
724    type ControlHandle = ProvisionerControlHandle;
725
726    fn control_handle(&self) -> &ProvisionerControlHandle {
727        &self.control_handle
728    }
729
730    fn drop_without_shutdown(mut self) {
731        // Safety: drops once, never accessed again due to mem::forget
732        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
733        // Prevent Drop from running (which would shut down the channel)
734        std::mem::forget(self);
735    }
736}
737
738impl ProvisionerGetProvidersResponder {
739    /// Sends a response to the FIDL transaction.
740    ///
741    /// Sets the channel to shutdown if an error occurs.
742    pub fn send(self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
743        let _result = self.send_raw(providers);
744        if _result.is_err() {
745            self.control_handle.shutdown();
746        }
747        self.drop_without_shutdown();
748        _result
749    }
750
751    /// Similar to "send" but does not shutdown the channel if an error occurs.
752    pub fn send_no_shutdown_on_err(
753        self,
754        mut providers: &[ProviderInfo],
755    ) -> Result<(), fidl::Error> {
756        let _result = self.send_raw(providers);
757        self.drop_without_shutdown();
758        _result
759    }
760
761    fn send_raw(&self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
762        self.control_handle
763            .inner
764            .send::<fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>>(
765                fidl::encoding::Flexible::new((providers,)),
766                self.tx_id,
767                0xc4d4f36edc50d43,
768                fidl::encoding::DynamicFlags::FLEXIBLE,
769            )
770    }
771}
772
773#[must_use = "FIDL methods require a response to be sent"]
774#[derive(Debug)]
775pub struct ProvisionerGetKnownCategoriesResponder {
776    control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
777    tx_id: u32,
778}
779
780/// Set the the channel to be shutdown (see [`ProvisionerControlHandle::shutdown`])
781/// if the responder is dropped without sending a response, so that the client
782/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
783impl std::ops::Drop for ProvisionerGetKnownCategoriesResponder {
784    fn drop(&mut self) {
785        self.control_handle.shutdown();
786        // Safety: drops once, never accessed again
787        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
788    }
789}
790
791impl fidl::endpoints::Responder for ProvisionerGetKnownCategoriesResponder {
792    type ControlHandle = ProvisionerControlHandle;
793
794    fn control_handle(&self) -> &ProvisionerControlHandle {
795        &self.control_handle
796    }
797
798    fn drop_without_shutdown(mut self) {
799        // Safety: drops once, never accessed again due to mem::forget
800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
801        // Prevent Drop from running (which would shut down the channel)
802        std::mem::forget(self);
803    }
804}
805
806impl ProvisionerGetKnownCategoriesResponder {
807    /// Sends a response to the FIDL transaction.
808    ///
809    /// Sets the channel to shutdown if an error occurs.
810    pub fn send(
811        self,
812        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
813    ) -> Result<(), fidl::Error> {
814        let _result = self.send_raw(categories);
815        if _result.is_err() {
816            self.control_handle.shutdown();
817        }
818        self.drop_without_shutdown();
819        _result
820    }
821
822    /// Similar to "send" but does not shutdown the channel if an error occurs.
823    pub fn send_no_shutdown_on_err(
824        self,
825        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
826    ) -> Result<(), fidl::Error> {
827        let _result = self.send_raw(categories);
828        self.drop_without_shutdown();
829        _result
830    }
831
832    fn send_raw(
833        &self,
834        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
835    ) -> Result<(), fidl::Error> {
836        self.control_handle
837            .inner
838            .send::<fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>>(
839                fidl::encoding::Flexible::new((categories,)),
840                self.tx_id,
841                0x41ef99397b945a4,
842                fidl::encoding::DynamicFlags::FLEXIBLE,
843            )
844    }
845}
846
847#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
848pub struct SessionMarker;
849
850impl fidl::endpoints::ProtocolMarker for SessionMarker {
851    type Proxy = SessionProxy;
852    type RequestStream = SessionRequestStream;
853    #[cfg(target_os = "fuchsia")]
854    type SynchronousProxy = SessionSynchronousProxy;
855
856    const DEBUG_NAME: &'static str = "(anonymous) Session";
857}
858pub type SessionStartTracingResult = Result<(), StartError>;
859pub type SessionStopTracingResult = Result<StopResult, StopError>;
860
861pub trait SessionProxyInterface: Send + Sync {
862    type StartTracingResponseFut: std::future::Future<Output = Result<SessionStartTracingResult, fidl::Error>>
863        + Send;
864    fn r#start_tracing(&self, payload: &StartOptions) -> Self::StartTracingResponseFut;
865    type StopTracingResponseFut: std::future::Future<Output = Result<SessionStopTracingResult, fidl::Error>>
866        + Send;
867    fn r#stop_tracing(&self, payload: &StopOptions) -> Self::StopTracingResponseFut;
868    type WatchAlertResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
869    fn r#watch_alert(&self) -> Self::WatchAlertResponseFut;
870}
871#[derive(Debug)]
872#[cfg(target_os = "fuchsia")]
873pub struct SessionSynchronousProxy {
874    client: fidl::client::sync::Client,
875}
876
877#[cfg(target_os = "fuchsia")]
878impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
879    type Proxy = SessionProxy;
880    type Protocol = SessionMarker;
881
882    fn from_channel(inner: fidl::Channel) -> Self {
883        Self::new(inner)
884    }
885
886    fn into_channel(self) -> fidl::Channel {
887        self.client.into_channel()
888    }
889
890    fn as_channel(&self) -> &fidl::Channel {
891        self.client.as_channel()
892    }
893}
894
895#[cfg(target_os = "fuchsia")]
896impl SessionSynchronousProxy {
897    pub fn new(channel: fidl::Channel) -> Self {
898        let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
899        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
900    }
901
902    pub fn into_channel(self) -> fidl::Channel {
903        self.client.into_channel()
904    }
905
906    /// Waits until an event arrives and returns it. It is safe for other
907    /// threads to make concurrent requests while waiting for an event.
908    pub fn wait_for_event(
909        &self,
910        deadline: zx::MonotonicInstant,
911    ) -> Result<SessionEvent, fidl::Error> {
912        SessionEvent::decode(self.client.wait_for_event(deadline)?)
913    }
914
915    /// Requests to start tracing with the specified `options`.
916    ///
917    /// If tracing has already started then the request is ignored,
918    /// except to send back an error code.
919    ///
920    /// The trace Session acknowledges the request when all
921    /// registered providers have been started or after
922    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
923    /// One useful reason for the has-started acknowledgement is that the
924    /// trace program can start a program to trace knowing that all the
925    /// providers are started.
926    pub fn r#start_tracing(
927        &self,
928        mut payload: &StartOptions,
929        ___deadline: zx::MonotonicInstant,
930    ) -> Result<SessionStartTracingResult, fidl::Error> {
931        let _response = self.client.send_query::<
932            StartOptions,
933            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
934        >(
935            payload,
936            0xde9b6ccbe936631,
937            fidl::encoding::DynamicFlags::FLEXIBLE,
938            ___deadline,
939        )?
940        .into_result::<SessionMarker>("start_tracing")?;
941        Ok(_response.map(|x| x))
942    }
943
944    /// Requests to stop tracing.
945    ///
946    /// If tracing has already stopped then this does nothing.
947    /// Returning a result lets callers know when it's ok to, for example,
948    /// start tracing again.
949    pub fn r#stop_tracing(
950        &self,
951        mut payload: &StopOptions,
952        ___deadline: zx::MonotonicInstant,
953    ) -> Result<SessionStopTracingResult, fidl::Error> {
954        let _response = self
955            .client
956            .send_query::<StopOptions, fidl::encoding::FlexibleResultType<StopResult, StopError>>(
957                payload,
958                0x50fefc9b3ff9b03a,
959                fidl::encoding::DynamicFlags::FLEXIBLE,
960                ___deadline,
961            )?
962            .into_result::<SessionMarker>("stop_tracing")?;
963        Ok(_response.map(|x| x))
964    }
965
966    /// Returns the next alert when it arrives.
967    ///
968    /// Alerts received by the Session are queued until a WatchAlert
969    /// request is received. Alerts are sent to the caller in the order
970    /// they were received.
971    ///
972    /// WatchAlert requests are also queued until an alert is received
973    /// and the requests are serviced in the order they were received.
974    pub fn r#watch_alert(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
975        let _response = self.client.send_query::<
976            fidl::encoding::EmptyPayload,
977            fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
978        >(
979            (),
980            0x1f1c080716d92276,
981            fidl::encoding::DynamicFlags::FLEXIBLE,
982            ___deadline,
983        )?
984        .into_result::<SessionMarker>("watch_alert")?;
985        Ok(_response.alert_name)
986    }
987}
988
989#[cfg(target_os = "fuchsia")]
990impl From<SessionSynchronousProxy> for zx::Handle {
991    fn from(value: SessionSynchronousProxy) -> Self {
992        value.into_channel().into()
993    }
994}
995
996#[cfg(target_os = "fuchsia")]
997impl From<fidl::Channel> for SessionSynchronousProxy {
998    fn from(value: fidl::Channel) -> Self {
999        Self::new(value)
1000    }
1001}
1002
1003#[cfg(target_os = "fuchsia")]
1004impl fidl::endpoints::FromClient for SessionSynchronousProxy {
1005    type Protocol = SessionMarker;
1006
1007    fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
1008        Self::new(value.into_channel())
1009    }
1010}
1011
1012#[derive(Debug, Clone)]
1013pub struct SessionProxy {
1014    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1015}
1016
1017impl fidl::endpoints::Proxy for SessionProxy {
1018    type Protocol = SessionMarker;
1019
1020    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1021        Self::new(inner)
1022    }
1023
1024    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1025        self.client.into_channel().map_err(|client| Self { client })
1026    }
1027
1028    fn as_channel(&self) -> &::fidl::AsyncChannel {
1029        self.client.as_channel()
1030    }
1031}
1032
1033impl SessionProxy {
1034    /// Create a new Proxy for fuchsia.tracing.controller/Session.
1035    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1036        let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1037        Self { client: fidl::client::Client::new(channel, protocol_name) }
1038    }
1039
1040    /// Get a Stream of events from the remote end of the protocol.
1041    ///
1042    /// # Panics
1043    ///
1044    /// Panics if the event stream was already taken.
1045    pub fn take_event_stream(&self) -> SessionEventStream {
1046        SessionEventStream { event_receiver: self.client.take_event_receiver() }
1047    }
1048
1049    /// Requests to start tracing with the specified `options`.
1050    ///
1051    /// If tracing has already started then the request is ignored,
1052    /// except to send back an error code.
1053    ///
1054    /// The trace Session acknowledges the request when all
1055    /// registered providers have been started or after
1056    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
1057    /// One useful reason for the has-started acknowledgement is that the
1058    /// trace program can start a program to trace knowing that all the
1059    /// providers are started.
1060    pub fn r#start_tracing(
1061        &self,
1062        mut payload: &StartOptions,
1063    ) -> fidl::client::QueryResponseFut<
1064        SessionStartTracingResult,
1065        fidl::encoding::DefaultFuchsiaResourceDialect,
1066    > {
1067        SessionProxyInterface::r#start_tracing(self, payload)
1068    }
1069
1070    /// Requests to stop tracing.
1071    ///
1072    /// If tracing has already stopped then this does nothing.
1073    /// Returning a result lets callers know when it's ok to, for example,
1074    /// start tracing again.
1075    pub fn r#stop_tracing(
1076        &self,
1077        mut payload: &StopOptions,
1078    ) -> fidl::client::QueryResponseFut<
1079        SessionStopTracingResult,
1080        fidl::encoding::DefaultFuchsiaResourceDialect,
1081    > {
1082        SessionProxyInterface::r#stop_tracing(self, payload)
1083    }
1084
1085    /// Returns the next alert when it arrives.
1086    ///
1087    /// Alerts received by the Session are queued until a WatchAlert
1088    /// request is received. Alerts are sent to the caller in the order
1089    /// they were received.
1090    ///
1091    /// WatchAlert requests are also queued until an alert is received
1092    /// and the requests are serviced in the order they were received.
1093    pub fn r#watch_alert(
1094        &self,
1095    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1096        SessionProxyInterface::r#watch_alert(self)
1097    }
1098}
1099
1100impl SessionProxyInterface for SessionProxy {
1101    type StartTracingResponseFut = fidl::client::QueryResponseFut<
1102        SessionStartTracingResult,
1103        fidl::encoding::DefaultFuchsiaResourceDialect,
1104    >;
1105    fn r#start_tracing(&self, mut payload: &StartOptions) -> Self::StartTracingResponseFut {
1106        fn _decode(
1107            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1108        ) -> Result<SessionStartTracingResult, fidl::Error> {
1109            let _response = fidl::client::decode_transaction_body::<
1110                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
1111                fidl::encoding::DefaultFuchsiaResourceDialect,
1112                0xde9b6ccbe936631,
1113            >(_buf?)?
1114            .into_result::<SessionMarker>("start_tracing")?;
1115            Ok(_response.map(|x| x))
1116        }
1117        self.client.send_query_and_decode::<StartOptions, SessionStartTracingResult>(
1118            payload,
1119            0xde9b6ccbe936631,
1120            fidl::encoding::DynamicFlags::FLEXIBLE,
1121            _decode,
1122        )
1123    }
1124
1125    type StopTracingResponseFut = fidl::client::QueryResponseFut<
1126        SessionStopTracingResult,
1127        fidl::encoding::DefaultFuchsiaResourceDialect,
1128    >;
1129    fn r#stop_tracing(&self, mut payload: &StopOptions) -> Self::StopTracingResponseFut {
1130        fn _decode(
1131            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1132        ) -> Result<SessionStopTracingResult, fidl::Error> {
1133            let _response = fidl::client::decode_transaction_body::<
1134                fidl::encoding::FlexibleResultType<StopResult, StopError>,
1135                fidl::encoding::DefaultFuchsiaResourceDialect,
1136                0x50fefc9b3ff9b03a,
1137            >(_buf?)?
1138            .into_result::<SessionMarker>("stop_tracing")?;
1139            Ok(_response.map(|x| x))
1140        }
1141        self.client.send_query_and_decode::<StopOptions, SessionStopTracingResult>(
1142            payload,
1143            0x50fefc9b3ff9b03a,
1144            fidl::encoding::DynamicFlags::FLEXIBLE,
1145            _decode,
1146        )
1147    }
1148
1149    type WatchAlertResponseFut =
1150        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1151    fn r#watch_alert(&self) -> Self::WatchAlertResponseFut {
1152        fn _decode(
1153            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1154        ) -> Result<String, fidl::Error> {
1155            let _response = fidl::client::decode_transaction_body::<
1156                fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
1157                fidl::encoding::DefaultFuchsiaResourceDialect,
1158                0x1f1c080716d92276,
1159            >(_buf?)?
1160            .into_result::<SessionMarker>("watch_alert")?;
1161            Ok(_response.alert_name)
1162        }
1163        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1164            (),
1165            0x1f1c080716d92276,
1166            fidl::encoding::DynamicFlags::FLEXIBLE,
1167            _decode,
1168        )
1169    }
1170}
1171
1172pub struct SessionEventStream {
1173    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1174}
1175
1176impl std::marker::Unpin for SessionEventStream {}
1177
1178impl futures::stream::FusedStream for SessionEventStream {
1179    fn is_terminated(&self) -> bool {
1180        self.event_receiver.is_terminated()
1181    }
1182}
1183
1184impl futures::Stream for SessionEventStream {
1185    type Item = Result<SessionEvent, fidl::Error>;
1186
1187    fn poll_next(
1188        mut self: std::pin::Pin<&mut Self>,
1189        cx: &mut std::task::Context<'_>,
1190    ) -> std::task::Poll<Option<Self::Item>> {
1191        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1192            &mut self.event_receiver,
1193            cx
1194        )?) {
1195            Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
1196            None => std::task::Poll::Ready(None),
1197        }
1198    }
1199}
1200
1201#[derive(Debug)]
1202pub enum SessionEvent {
1203    OnSessionStateChange {
1204        state: SessionState,
1205    },
1206    #[non_exhaustive]
1207    _UnknownEvent {
1208        /// Ordinal of the event that was sent.
1209        ordinal: u64,
1210    },
1211}
1212
1213impl SessionEvent {
1214    #[allow(irrefutable_let_patterns)]
1215    pub fn into_on_session_state_change(self) -> Option<SessionState> {
1216        if let SessionEvent::OnSessionStateChange { state } = self { Some((state)) } else { None }
1217    }
1218
1219    /// Decodes a message buffer as a [`SessionEvent`].
1220    fn decode(
1221        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1222    ) -> Result<SessionEvent, fidl::Error> {
1223        let (bytes, _handles) = buf.split_mut();
1224        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1225        debug_assert_eq!(tx_header.tx_id, 0);
1226        match tx_header.ordinal {
1227            0x7ab1640718b971cd => {
1228                let mut out = fidl::new_empty!(
1229                    SessionOnSessionStateChangeRequest,
1230                    fidl::encoding::DefaultFuchsiaResourceDialect
1231                );
1232                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOnSessionStateChangeRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1233                Ok((SessionEvent::OnSessionStateChange { state: out.state }))
1234            }
1235            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1236                Ok(SessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1237            }
1238            _ => Err(fidl::Error::UnknownOrdinal {
1239                ordinal: tx_header.ordinal,
1240                protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1241            }),
1242        }
1243    }
1244}
1245
1246/// A Stream of incoming requests for fuchsia.tracing.controller/Session.
1247pub struct SessionRequestStream {
1248    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1249    is_terminated: bool,
1250}
1251
1252impl std::marker::Unpin for SessionRequestStream {}
1253
1254impl futures::stream::FusedStream for SessionRequestStream {
1255    fn is_terminated(&self) -> bool {
1256        self.is_terminated
1257    }
1258}
1259
1260impl fidl::endpoints::RequestStream for SessionRequestStream {
1261    type Protocol = SessionMarker;
1262    type ControlHandle = SessionControlHandle;
1263
1264    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1265        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1266    }
1267
1268    fn control_handle(&self) -> Self::ControlHandle {
1269        SessionControlHandle { inner: self.inner.clone() }
1270    }
1271
1272    fn into_inner(
1273        self,
1274    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1275    {
1276        (self.inner, self.is_terminated)
1277    }
1278
1279    fn from_inner(
1280        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1281        is_terminated: bool,
1282    ) -> Self {
1283        Self { inner, is_terminated }
1284    }
1285}
1286
1287impl futures::Stream for SessionRequestStream {
1288    type Item = Result<SessionRequest, fidl::Error>;
1289
1290    fn poll_next(
1291        mut self: std::pin::Pin<&mut Self>,
1292        cx: &mut std::task::Context<'_>,
1293    ) -> std::task::Poll<Option<Self::Item>> {
1294        let this = &mut *self;
1295        if this.inner.check_shutdown(cx) {
1296            this.is_terminated = true;
1297            return std::task::Poll::Ready(None);
1298        }
1299        if this.is_terminated {
1300            panic!("polled SessionRequestStream after completion");
1301        }
1302        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1303            |bytes, handles| {
1304                match this.inner.channel().read_etc(cx, bytes, handles) {
1305                    std::task::Poll::Ready(Ok(())) => {}
1306                    std::task::Poll::Pending => return std::task::Poll::Pending,
1307                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1308                        this.is_terminated = true;
1309                        return std::task::Poll::Ready(None);
1310                    }
1311                    std::task::Poll::Ready(Err(e)) => {
1312                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1313                            e.into(),
1314                        ))));
1315                    }
1316                }
1317
1318                // A message has been received from the channel
1319                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1320
1321                std::task::Poll::Ready(Some(match header.ordinal {
1322                    0xde9b6ccbe936631 => {
1323                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1324                        let mut req = fidl::new_empty!(
1325                            StartOptions,
1326                            fidl::encoding::DefaultFuchsiaResourceDialect
1327                        );
1328                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StartOptions>(&header, _body_bytes, handles, &mut req)?;
1329                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1330                        Ok(SessionRequest::StartTracing {
1331                            payload: req,
1332                            responder: SessionStartTracingResponder {
1333                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1334                                tx_id: header.tx_id,
1335                            },
1336                        })
1337                    }
1338                    0x50fefc9b3ff9b03a => {
1339                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1340                        let mut req = fidl::new_empty!(
1341                            StopOptions,
1342                            fidl::encoding::DefaultFuchsiaResourceDialect
1343                        );
1344                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StopOptions>(&header, _body_bytes, handles, &mut req)?;
1345                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1346                        Ok(SessionRequest::StopTracing {
1347                            payload: req,
1348                            responder: SessionStopTracingResponder {
1349                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1350                                tx_id: header.tx_id,
1351                            },
1352                        })
1353                    }
1354                    0x1f1c080716d92276 => {
1355                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1356                        let mut req = fidl::new_empty!(
1357                            fidl::encoding::EmptyPayload,
1358                            fidl::encoding::DefaultFuchsiaResourceDialect
1359                        );
1360                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1361                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1362                        Ok(SessionRequest::WatchAlert {
1363                            responder: SessionWatchAlertResponder {
1364                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1365                                tx_id: header.tx_id,
1366                            },
1367                        })
1368                    }
1369                    _ if header.tx_id == 0
1370                        && header
1371                            .dynamic_flags()
1372                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1373                    {
1374                        Ok(SessionRequest::_UnknownMethod {
1375                            ordinal: header.ordinal,
1376                            control_handle: SessionControlHandle { inner: this.inner.clone() },
1377                            method_type: fidl::MethodType::OneWay,
1378                        })
1379                    }
1380                    _ if header
1381                        .dynamic_flags()
1382                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1383                    {
1384                        this.inner.send_framework_err(
1385                            fidl::encoding::FrameworkErr::UnknownMethod,
1386                            header.tx_id,
1387                            header.ordinal,
1388                            header.dynamic_flags(),
1389                            (bytes, handles),
1390                        )?;
1391                        Ok(SessionRequest::_UnknownMethod {
1392                            ordinal: header.ordinal,
1393                            control_handle: SessionControlHandle { inner: this.inner.clone() },
1394                            method_type: fidl::MethodType::TwoWay,
1395                        })
1396                    }
1397                    _ => Err(fidl::Error::UnknownOrdinal {
1398                        ordinal: header.ordinal,
1399                        protocol_name:
1400                            <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1401                    }),
1402                }))
1403            },
1404        )
1405    }
1406}
1407
1408/// The session interface used by the trace tool to start/stop/terminate a trace Session.
1409///
1410/// The trace Session may lightly validate the structure of
1411/// trace records as it copies them from trace buffers into the output.
1412/// In particular, it may verify the size of each record header to ensure
1413/// that the framing of trace records in the data stream is maintained.
1414///
1415/// The trace Session does not validate the contents of the trace records
1416/// themselves.  For example, it does not try to check argument lengths in
1417/// events.  This ensures that the trace format can be extended without needing
1418/// to modify the trace Session.
1419///
1420/// The trace Session must be initialized from the provisioner. It can then be
1421/// used to start/stop tracing as many times as needed. Dropping the Session
1422/// will terminate tracing.
1423#[derive(Debug)]
1424pub enum SessionRequest {
1425    /// Requests to start tracing with the specified `options`.
1426    ///
1427    /// If tracing has already started then the request is ignored,
1428    /// except to send back an error code.
1429    ///
1430    /// The trace Session acknowledges the request when all
1431    /// registered providers have been started or after
1432    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
1433    /// One useful reason for the has-started acknowledgement is that the
1434    /// trace program can start a program to trace knowing that all the
1435    /// providers are started.
1436    StartTracing { payload: StartOptions, responder: SessionStartTracingResponder },
1437    /// Requests to stop tracing.
1438    ///
1439    /// If tracing has already stopped then this does nothing.
1440    /// Returning a result lets callers know when it's ok to, for example,
1441    /// start tracing again.
1442    StopTracing { payload: StopOptions, responder: SessionStopTracingResponder },
1443    /// Returns the next alert when it arrives.
1444    ///
1445    /// Alerts received by the Session are queued until a WatchAlert
1446    /// request is received. Alerts are sent to the caller in the order
1447    /// they were received.
1448    ///
1449    /// WatchAlert requests are also queued until an alert is received
1450    /// and the requests are serviced in the order they were received.
1451    WatchAlert { responder: SessionWatchAlertResponder },
1452    /// An interaction was received which does not match any known method.
1453    #[non_exhaustive]
1454    _UnknownMethod {
1455        /// Ordinal of the method that was called.
1456        ordinal: u64,
1457        control_handle: SessionControlHandle,
1458        method_type: fidl::MethodType,
1459    },
1460}
1461
1462impl SessionRequest {
1463    #[allow(irrefutable_let_patterns)]
1464    pub fn into_start_tracing(self) -> Option<(StartOptions, SessionStartTracingResponder)> {
1465        if let SessionRequest::StartTracing { payload, responder } = self {
1466            Some((payload, responder))
1467        } else {
1468            None
1469        }
1470    }
1471
1472    #[allow(irrefutable_let_patterns)]
1473    pub fn into_stop_tracing(self) -> Option<(StopOptions, SessionStopTracingResponder)> {
1474        if let SessionRequest::StopTracing { payload, responder } = self {
1475            Some((payload, responder))
1476        } else {
1477            None
1478        }
1479    }
1480
1481    #[allow(irrefutable_let_patterns)]
1482    pub fn into_watch_alert(self) -> Option<(SessionWatchAlertResponder)> {
1483        if let SessionRequest::WatchAlert { responder } = self { Some((responder)) } else { None }
1484    }
1485
1486    /// Name of the method defined in FIDL
1487    pub fn method_name(&self) -> &'static str {
1488        match *self {
1489            SessionRequest::StartTracing { .. } => "start_tracing",
1490            SessionRequest::StopTracing { .. } => "stop_tracing",
1491            SessionRequest::WatchAlert { .. } => "watch_alert",
1492            SessionRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1493                "unknown one-way method"
1494            }
1495            SessionRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1496                "unknown two-way method"
1497            }
1498        }
1499    }
1500}
1501
1502#[derive(Debug, Clone)]
1503pub struct SessionControlHandle {
1504    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1505}
1506
1507impl fidl::endpoints::ControlHandle for SessionControlHandle {
1508    fn shutdown(&self) {
1509        self.inner.shutdown()
1510    }
1511    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1512        self.inner.shutdown_with_epitaph(status)
1513    }
1514
1515    fn is_closed(&self) -> bool {
1516        self.inner.channel().is_closed()
1517    }
1518    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1519        self.inner.channel().on_closed()
1520    }
1521
1522    #[cfg(target_os = "fuchsia")]
1523    fn signal_peer(
1524        &self,
1525        clear_mask: zx::Signals,
1526        set_mask: zx::Signals,
1527    ) -> Result<(), zx_status::Status> {
1528        use fidl::Peered;
1529        self.inner.channel().signal_peer(clear_mask, set_mask)
1530    }
1531}
1532
1533impl SessionControlHandle {
1534    pub fn send_on_session_state_change(&self, mut state: SessionState) -> Result<(), fidl::Error> {
1535        self.inner.send::<SessionOnSessionStateChangeRequest>(
1536            (state,),
1537            0,
1538            0x7ab1640718b971cd,
1539            fidl::encoding::DynamicFlags::FLEXIBLE,
1540        )
1541    }
1542}
1543
1544#[must_use = "FIDL methods require a response to be sent"]
1545#[derive(Debug)]
1546pub struct SessionStartTracingResponder {
1547    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1548    tx_id: u32,
1549}
1550
1551/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1552/// if the responder is dropped without sending a response, so that the client
1553/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1554impl std::ops::Drop for SessionStartTracingResponder {
1555    fn drop(&mut self) {
1556        self.control_handle.shutdown();
1557        // Safety: drops once, never accessed again
1558        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1559    }
1560}
1561
1562impl fidl::endpoints::Responder for SessionStartTracingResponder {
1563    type ControlHandle = SessionControlHandle;
1564
1565    fn control_handle(&self) -> &SessionControlHandle {
1566        &self.control_handle
1567    }
1568
1569    fn drop_without_shutdown(mut self) {
1570        // Safety: drops once, never accessed again due to mem::forget
1571        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1572        // Prevent Drop from running (which would shut down the channel)
1573        std::mem::forget(self);
1574    }
1575}
1576
1577impl SessionStartTracingResponder {
1578    /// Sends a response to the FIDL transaction.
1579    ///
1580    /// Sets the channel to shutdown if an error occurs.
1581    pub fn send(self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1582        let _result = self.send_raw(result);
1583        if _result.is_err() {
1584            self.control_handle.shutdown();
1585        }
1586        self.drop_without_shutdown();
1587        _result
1588    }
1589
1590    /// Similar to "send" but does not shutdown the channel if an error occurs.
1591    pub fn send_no_shutdown_on_err(
1592        self,
1593        mut result: Result<(), StartError>,
1594    ) -> Result<(), fidl::Error> {
1595        let _result = self.send_raw(result);
1596        self.drop_without_shutdown();
1597        _result
1598    }
1599
1600    fn send_raw(&self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1601        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1602            fidl::encoding::EmptyStruct,
1603            StartError,
1604        >>(
1605            fidl::encoding::FlexibleResult::new(result),
1606            self.tx_id,
1607            0xde9b6ccbe936631,
1608            fidl::encoding::DynamicFlags::FLEXIBLE,
1609        )
1610    }
1611}
1612
1613#[must_use = "FIDL methods require a response to be sent"]
1614#[derive(Debug)]
1615pub struct SessionStopTracingResponder {
1616    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1617    tx_id: u32,
1618}
1619
1620/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1621/// if the responder is dropped without sending a response, so that the client
1622/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1623impl std::ops::Drop for SessionStopTracingResponder {
1624    fn drop(&mut self) {
1625        self.control_handle.shutdown();
1626        // Safety: drops once, never accessed again
1627        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1628    }
1629}
1630
1631impl fidl::endpoints::Responder for SessionStopTracingResponder {
1632    type ControlHandle = SessionControlHandle;
1633
1634    fn control_handle(&self) -> &SessionControlHandle {
1635        &self.control_handle
1636    }
1637
1638    fn drop_without_shutdown(mut self) {
1639        // Safety: drops once, never accessed again due to mem::forget
1640        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1641        // Prevent Drop from running (which would shut down the channel)
1642        std::mem::forget(self);
1643    }
1644}
1645
1646impl SessionStopTracingResponder {
1647    /// Sends a response to the FIDL transaction.
1648    ///
1649    /// Sets the channel to shutdown if an error occurs.
1650    pub fn send(self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1651        let _result = self.send_raw(result);
1652        if _result.is_err() {
1653            self.control_handle.shutdown();
1654        }
1655        self.drop_without_shutdown();
1656        _result
1657    }
1658
1659    /// Similar to "send" but does not shutdown the channel if an error occurs.
1660    pub fn send_no_shutdown_on_err(
1661        self,
1662        mut result: Result<&StopResult, StopError>,
1663    ) -> Result<(), fidl::Error> {
1664        let _result = self.send_raw(result);
1665        self.drop_without_shutdown();
1666        _result
1667    }
1668
1669    fn send_raw(&self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1670        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<StopResult, StopError>>(
1671            fidl::encoding::FlexibleResult::new(result),
1672            self.tx_id,
1673            0x50fefc9b3ff9b03a,
1674            fidl::encoding::DynamicFlags::FLEXIBLE,
1675        )
1676    }
1677}
1678
1679#[must_use = "FIDL methods require a response to be sent"]
1680#[derive(Debug)]
1681pub struct SessionWatchAlertResponder {
1682    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1683    tx_id: u32,
1684}
1685
1686/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1687/// if the responder is dropped without sending a response, so that the client
1688/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1689impl std::ops::Drop for SessionWatchAlertResponder {
1690    fn drop(&mut self) {
1691        self.control_handle.shutdown();
1692        // Safety: drops once, never accessed again
1693        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1694    }
1695}
1696
1697impl fidl::endpoints::Responder for SessionWatchAlertResponder {
1698    type ControlHandle = SessionControlHandle;
1699
1700    fn control_handle(&self) -> &SessionControlHandle {
1701        &self.control_handle
1702    }
1703
1704    fn drop_without_shutdown(mut self) {
1705        // Safety: drops once, never accessed again due to mem::forget
1706        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1707        // Prevent Drop from running (which would shut down the channel)
1708        std::mem::forget(self);
1709    }
1710}
1711
1712impl SessionWatchAlertResponder {
1713    /// Sends a response to the FIDL transaction.
1714    ///
1715    /// Sets the channel to shutdown if an error occurs.
1716    pub fn send(self, mut alert_name: &str) -> Result<(), fidl::Error> {
1717        let _result = self.send_raw(alert_name);
1718        if _result.is_err() {
1719            self.control_handle.shutdown();
1720        }
1721        self.drop_without_shutdown();
1722        _result
1723    }
1724
1725    /// Similar to "send" but does not shutdown the channel if an error occurs.
1726    pub fn send_no_shutdown_on_err(self, mut alert_name: &str) -> Result<(), fidl::Error> {
1727        let _result = self.send_raw(alert_name);
1728        self.drop_without_shutdown();
1729        _result
1730    }
1731
1732    fn send_raw(&self, mut alert_name: &str) -> Result<(), fidl::Error> {
1733        self.control_handle.inner.send::<fidl::encoding::FlexibleType<SessionWatchAlertResponse>>(
1734            fidl::encoding::Flexible::new((alert_name,)),
1735            self.tx_id,
1736            0x1f1c080716d92276,
1737            fidl::encoding::DynamicFlags::FLEXIBLE,
1738        )
1739    }
1740}
1741
1742#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1743pub struct SessionManagerMarker;
1744
1745impl fidl::endpoints::ProtocolMarker for SessionManagerMarker {
1746    type Proxy = SessionManagerProxy;
1747    type RequestStream = SessionManagerRequestStream;
1748    #[cfg(target_os = "fuchsia")]
1749    type SynchronousProxy = SessionManagerSynchronousProxy;
1750
1751    const DEBUG_NAME: &'static str = "fuchsia.tracing.controller.SessionManager";
1752}
1753impl fidl::endpoints::DiscoverableProtocolMarker for SessionManagerMarker {}
1754pub type SessionManagerStartTraceSessionResult = Result<u64, RecordingError>;
1755pub type SessionManagerStartTraceSessionOnBootResult = Result<(), RecordingError>;
1756pub type SessionManagerEndTraceSessionResult = Result<(TraceOptions, StopResult), RecordingError>;
1757pub type SessionManagerStatusResult = Result<TraceStatus, RecordingError>;
1758
1759pub trait SessionManagerProxyInterface: Send + Sync {
1760    type GetProvidersResponseFut: std::future::Future<Output = Result<Vec<ProviderInfo>, fidl::Error>>
1761        + Send;
1762    fn r#get_providers(&self) -> Self::GetProvidersResponseFut;
1763    type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
1764        + Send;
1765    fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
1766    type StartTraceSessionResponseFut: std::future::Future<Output = Result<SessionManagerStartTraceSessionResult, fidl::Error>>
1767        + Send;
1768    fn r#start_trace_session(
1769        &self,
1770        config: &TraceConfig,
1771        options: &TraceOptions,
1772    ) -> Self::StartTraceSessionResponseFut;
1773    type StartTraceSessionOnBootResponseFut: std::future::Future<
1774            Output = Result<SessionManagerStartTraceSessionOnBootResult, fidl::Error>,
1775        > + Send;
1776    fn r#start_trace_session_on_boot(
1777        &self,
1778        config: &TraceConfig,
1779        options: &TraceOptions,
1780    ) -> Self::StartTraceSessionOnBootResponseFut;
1781    type EndTraceSessionResponseFut: std::future::Future<Output = Result<SessionManagerEndTraceSessionResult, fidl::Error>>
1782        + Send;
1783    fn r#end_trace_session(
1784        &self,
1785        task_id: u64,
1786        output: fidl::Socket,
1787    ) -> Self::EndTraceSessionResponseFut;
1788    type StatusResponseFut: std::future::Future<Output = Result<SessionManagerStatusResult, fidl::Error>>
1789        + Send;
1790    fn r#status(&self) -> Self::StatusResponseFut;
1791}
1792#[derive(Debug)]
1793#[cfg(target_os = "fuchsia")]
1794pub struct SessionManagerSynchronousProxy {
1795    client: fidl::client::sync::Client,
1796}
1797
1798#[cfg(target_os = "fuchsia")]
1799impl fidl::endpoints::SynchronousProxy for SessionManagerSynchronousProxy {
1800    type Proxy = SessionManagerProxy;
1801    type Protocol = SessionManagerMarker;
1802
1803    fn from_channel(inner: fidl::Channel) -> Self {
1804        Self::new(inner)
1805    }
1806
1807    fn into_channel(self) -> fidl::Channel {
1808        self.client.into_channel()
1809    }
1810
1811    fn as_channel(&self) -> &fidl::Channel {
1812        self.client.as_channel()
1813    }
1814}
1815
1816#[cfg(target_os = "fuchsia")]
1817impl SessionManagerSynchronousProxy {
1818    pub fn new(channel: fidl::Channel) -> Self {
1819        let protocol_name = <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1820        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1821    }
1822
1823    pub fn into_channel(self) -> fidl::Channel {
1824        self.client.into_channel()
1825    }
1826
1827    /// Waits until an event arrives and returns it. It is safe for other
1828    /// threads to make concurrent requests while waiting for an event.
1829    pub fn wait_for_event(
1830        &self,
1831        deadline: zx::MonotonicInstant,
1832    ) -> Result<SessionManagerEvent, fidl::Error> {
1833        SessionManagerEvent::decode(self.client.wait_for_event(deadline)?)
1834    }
1835
1836    /// Return the set of registered providers.
1837    pub fn r#get_providers(
1838        &self,
1839        ___deadline: zx::MonotonicInstant,
1840    ) -> Result<Vec<ProviderInfo>, fidl::Error> {
1841        let _response = self.client.send_query::<
1842            fidl::encoding::EmptyPayload,
1843            fidl::encoding::FlexibleType<SessionManagerGetProvidersResponse>,
1844        >(
1845            (),
1846            0x61bd49c4eb1fa03,
1847            fidl::encoding::DynamicFlags::FLEXIBLE,
1848            ___deadline,
1849        )?
1850        .into_result::<SessionManagerMarker>("get_providers")?;
1851        Ok(_response.providers)
1852    }
1853
1854    /// Gets the known categories.
1855    pub fn r#get_known_categories(
1856        &self,
1857        ___deadline: zx::MonotonicInstant,
1858    ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
1859        let _response = self.client.send_query::<
1860            fidl::encoding::EmptyPayload,
1861            fidl::encoding::FlexibleType<SessionManagerGetKnownCategoriesResponse>,
1862        >(
1863            (),
1864            0x6f0abdb5401788b2,
1865            fidl::encoding::DynamicFlags::FLEXIBLE,
1866            ___deadline,
1867        )?
1868        .into_result::<SessionManagerMarker>("get_known_categories")?;
1869        Ok(_response.categories)
1870    }
1871
1872    /// Starts a Trace session.
1873    pub fn r#start_trace_session(
1874        &self,
1875        mut config: &TraceConfig,
1876        mut options: &TraceOptions,
1877        ___deadline: zx::MonotonicInstant,
1878    ) -> Result<SessionManagerStartTraceSessionResult, fidl::Error> {
1879        let _response = self.client.send_query::<
1880            SessionManagerStartTraceSessionRequest,
1881            fidl::encoding::FlexibleResultType<SessionManagerStartTraceSessionResponse, RecordingError>,
1882        >(
1883            (config, options,),
1884            0x54c39e0c173c0162,
1885            fidl::encoding::DynamicFlags::FLEXIBLE,
1886            ___deadline,
1887        )?
1888        .into_result::<SessionManagerMarker>("start_trace_session")?;
1889        Ok(_response.map(|x| x.task_id))
1890    }
1891
1892    /// Configure a Trace session to start when the component starts.
1893    pub fn r#start_trace_session_on_boot(
1894        &self,
1895        mut config: &TraceConfig,
1896        mut options: &TraceOptions,
1897        ___deadline: zx::MonotonicInstant,
1898    ) -> Result<SessionManagerStartTraceSessionOnBootResult, fidl::Error> {
1899        let _response = self.client.send_query::<
1900            SessionManagerStartTraceSessionOnBootRequest,
1901            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, RecordingError>,
1902        >(
1903            (config, options,),
1904            0x705558b5612fbf62,
1905            fidl::encoding::DynamicFlags::FLEXIBLE,
1906            ___deadline,
1907        )?
1908        .into_result::<SessionManagerMarker>("start_trace_session_on_boot")?;
1909        Ok(_response.map(|x| x))
1910    }
1911
1912    /// Ends the trace session.
1913    /// If task_id is non-zero, then only the trace task with the given id is checked.
1914    /// Note: Currently there is only 1 trace task active at a time, so the task_id is of
1915    /// little value at this time.
1916    pub fn r#end_trace_session(
1917        &self,
1918        mut task_id: u64,
1919        mut output: fidl::Socket,
1920        ___deadline: zx::MonotonicInstant,
1921    ) -> Result<SessionManagerEndTraceSessionResult, fidl::Error> {
1922        let _response = self
1923            .client
1924            .send_query::<SessionManagerEndTraceSessionRequest, fidl::encoding::FlexibleResultType<
1925                SessionManagerEndTraceSessionResponse,
1926                RecordingError,
1927            >>(
1928                (task_id, output),
1929                0x72d6ca80a0787577,
1930                fidl::encoding::DynamicFlags::FLEXIBLE,
1931                ___deadline,
1932            )?
1933            .into_result::<SessionManagerMarker>("end_trace_session")?;
1934        Ok(_response.map(|x| (x.options, x.result)))
1935    }
1936
1937    /// Returns the status of the current trace session.
1938    pub fn r#status(
1939        &self,
1940        ___deadline: zx::MonotonicInstant,
1941    ) -> Result<SessionManagerStatusResult, fidl::Error> {
1942        let _response = self.client.send_query::<
1943            fidl::encoding::EmptyPayload,
1944            fidl::encoding::FlexibleResultType<TraceStatus, RecordingError>,
1945        >(
1946            (),
1947            0x2ebc198b7af59063,
1948            fidl::encoding::DynamicFlags::FLEXIBLE,
1949            ___deadline,
1950        )?
1951        .into_result::<SessionManagerMarker>("status")?;
1952        Ok(_response.map(|x| x))
1953    }
1954}
1955
1956#[cfg(target_os = "fuchsia")]
1957impl From<SessionManagerSynchronousProxy> for zx::Handle {
1958    fn from(value: SessionManagerSynchronousProxy) -> Self {
1959        value.into_channel().into()
1960    }
1961}
1962
1963#[cfg(target_os = "fuchsia")]
1964impl From<fidl::Channel> for SessionManagerSynchronousProxy {
1965    fn from(value: fidl::Channel) -> Self {
1966        Self::new(value)
1967    }
1968}
1969
1970#[cfg(target_os = "fuchsia")]
1971impl fidl::endpoints::FromClient for SessionManagerSynchronousProxy {
1972    type Protocol = SessionManagerMarker;
1973
1974    fn from_client(value: fidl::endpoints::ClientEnd<SessionManagerMarker>) -> Self {
1975        Self::new(value.into_channel())
1976    }
1977}
1978
1979#[derive(Debug, Clone)]
1980pub struct SessionManagerProxy {
1981    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1982}
1983
1984impl fidl::endpoints::Proxy for SessionManagerProxy {
1985    type Protocol = SessionManagerMarker;
1986
1987    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1988        Self::new(inner)
1989    }
1990
1991    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1992        self.client.into_channel().map_err(|client| Self { client })
1993    }
1994
1995    fn as_channel(&self) -> &::fidl::AsyncChannel {
1996        self.client.as_channel()
1997    }
1998}
1999
2000impl SessionManagerProxy {
2001    /// Create a new Proxy for fuchsia.tracing.controller/SessionManager.
2002    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2003        let protocol_name = <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2004        Self { client: fidl::client::Client::new(channel, protocol_name) }
2005    }
2006
2007    /// Get a Stream of events from the remote end of the protocol.
2008    ///
2009    /// # Panics
2010    ///
2011    /// Panics if the event stream was already taken.
2012    pub fn take_event_stream(&self) -> SessionManagerEventStream {
2013        SessionManagerEventStream { event_receiver: self.client.take_event_receiver() }
2014    }
2015
2016    /// Return the set of registered providers.
2017    pub fn r#get_providers(
2018        &self,
2019    ) -> fidl::client::QueryResponseFut<
2020        Vec<ProviderInfo>,
2021        fidl::encoding::DefaultFuchsiaResourceDialect,
2022    > {
2023        SessionManagerProxyInterface::r#get_providers(self)
2024    }
2025
2026    /// Gets the known categories.
2027    pub fn r#get_known_categories(
2028        &self,
2029    ) -> fidl::client::QueryResponseFut<
2030        Vec<fidl_fuchsia_tracing::KnownCategory>,
2031        fidl::encoding::DefaultFuchsiaResourceDialect,
2032    > {
2033        SessionManagerProxyInterface::r#get_known_categories(self)
2034    }
2035
2036    /// Starts a Trace session.
2037    pub fn r#start_trace_session(
2038        &self,
2039        mut config: &TraceConfig,
2040        mut options: &TraceOptions,
2041    ) -> fidl::client::QueryResponseFut<
2042        SessionManagerStartTraceSessionResult,
2043        fidl::encoding::DefaultFuchsiaResourceDialect,
2044    > {
2045        SessionManagerProxyInterface::r#start_trace_session(self, config, options)
2046    }
2047
2048    /// Configure a Trace session to start when the component starts.
2049    pub fn r#start_trace_session_on_boot(
2050        &self,
2051        mut config: &TraceConfig,
2052        mut options: &TraceOptions,
2053    ) -> fidl::client::QueryResponseFut<
2054        SessionManagerStartTraceSessionOnBootResult,
2055        fidl::encoding::DefaultFuchsiaResourceDialect,
2056    > {
2057        SessionManagerProxyInterface::r#start_trace_session_on_boot(self, config, options)
2058    }
2059
2060    /// Ends the trace session.
2061    /// If task_id is non-zero, then only the trace task with the given id is checked.
2062    /// Note: Currently there is only 1 trace task active at a time, so the task_id is of
2063    /// little value at this time.
2064    pub fn r#end_trace_session(
2065        &self,
2066        mut task_id: u64,
2067        mut output: fidl::Socket,
2068    ) -> fidl::client::QueryResponseFut<
2069        SessionManagerEndTraceSessionResult,
2070        fidl::encoding::DefaultFuchsiaResourceDialect,
2071    > {
2072        SessionManagerProxyInterface::r#end_trace_session(self, task_id, output)
2073    }
2074
2075    /// Returns the status of the current trace session.
2076    pub fn r#status(
2077        &self,
2078    ) -> fidl::client::QueryResponseFut<
2079        SessionManagerStatusResult,
2080        fidl::encoding::DefaultFuchsiaResourceDialect,
2081    > {
2082        SessionManagerProxyInterface::r#status(self)
2083    }
2084}
2085
2086impl SessionManagerProxyInterface for SessionManagerProxy {
2087    type GetProvidersResponseFut = fidl::client::QueryResponseFut<
2088        Vec<ProviderInfo>,
2089        fidl::encoding::DefaultFuchsiaResourceDialect,
2090    >;
2091    fn r#get_providers(&self) -> Self::GetProvidersResponseFut {
2092        fn _decode(
2093            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2094        ) -> Result<Vec<ProviderInfo>, fidl::Error> {
2095            let _response = fidl::client::decode_transaction_body::<
2096                fidl::encoding::FlexibleType<SessionManagerGetProvidersResponse>,
2097                fidl::encoding::DefaultFuchsiaResourceDialect,
2098                0x61bd49c4eb1fa03,
2099            >(_buf?)?
2100            .into_result::<SessionManagerMarker>("get_providers")?;
2101            Ok(_response.providers)
2102        }
2103        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ProviderInfo>>(
2104            (),
2105            0x61bd49c4eb1fa03,
2106            fidl::encoding::DynamicFlags::FLEXIBLE,
2107            _decode,
2108        )
2109    }
2110
2111    type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
2112        Vec<fidl_fuchsia_tracing::KnownCategory>,
2113        fidl::encoding::DefaultFuchsiaResourceDialect,
2114    >;
2115    fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
2116        fn _decode(
2117            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2118        ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
2119            let _response = fidl::client::decode_transaction_body::<
2120                fidl::encoding::FlexibleType<SessionManagerGetKnownCategoriesResponse>,
2121                fidl::encoding::DefaultFuchsiaResourceDialect,
2122                0x6f0abdb5401788b2,
2123            >(_buf?)?
2124            .into_result::<SessionManagerMarker>("get_known_categories")?;
2125            Ok(_response.categories)
2126        }
2127        self.client.send_query_and_decode::<
2128            fidl::encoding::EmptyPayload,
2129            Vec<fidl_fuchsia_tracing::KnownCategory>,
2130        >(
2131            (),
2132            0x6f0abdb5401788b2,
2133            fidl::encoding::DynamicFlags::FLEXIBLE,
2134            _decode,
2135        )
2136    }
2137
2138    type StartTraceSessionResponseFut = fidl::client::QueryResponseFut<
2139        SessionManagerStartTraceSessionResult,
2140        fidl::encoding::DefaultFuchsiaResourceDialect,
2141    >;
2142    fn r#start_trace_session(
2143        &self,
2144        mut config: &TraceConfig,
2145        mut options: &TraceOptions,
2146    ) -> Self::StartTraceSessionResponseFut {
2147        fn _decode(
2148            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2149        ) -> Result<SessionManagerStartTraceSessionResult, fidl::Error> {
2150            let _response = fidl::client::decode_transaction_body::<
2151                fidl::encoding::FlexibleResultType<
2152                    SessionManagerStartTraceSessionResponse,
2153                    RecordingError,
2154                >,
2155                fidl::encoding::DefaultFuchsiaResourceDialect,
2156                0x54c39e0c173c0162,
2157            >(_buf?)?
2158            .into_result::<SessionManagerMarker>("start_trace_session")?;
2159            Ok(_response.map(|x| x.task_id))
2160        }
2161        self.client.send_query_and_decode::<
2162            SessionManagerStartTraceSessionRequest,
2163            SessionManagerStartTraceSessionResult,
2164        >(
2165            (config, options,),
2166            0x54c39e0c173c0162,
2167            fidl::encoding::DynamicFlags::FLEXIBLE,
2168            _decode,
2169        )
2170    }
2171
2172    type StartTraceSessionOnBootResponseFut = fidl::client::QueryResponseFut<
2173        SessionManagerStartTraceSessionOnBootResult,
2174        fidl::encoding::DefaultFuchsiaResourceDialect,
2175    >;
2176    fn r#start_trace_session_on_boot(
2177        &self,
2178        mut config: &TraceConfig,
2179        mut options: &TraceOptions,
2180    ) -> Self::StartTraceSessionOnBootResponseFut {
2181        fn _decode(
2182            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2183        ) -> Result<SessionManagerStartTraceSessionOnBootResult, fidl::Error> {
2184            let _response = fidl::client::decode_transaction_body::<
2185                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, RecordingError>,
2186                fidl::encoding::DefaultFuchsiaResourceDialect,
2187                0x705558b5612fbf62,
2188            >(_buf?)?
2189            .into_result::<SessionManagerMarker>("start_trace_session_on_boot")?;
2190            Ok(_response.map(|x| x))
2191        }
2192        self.client.send_query_and_decode::<
2193            SessionManagerStartTraceSessionOnBootRequest,
2194            SessionManagerStartTraceSessionOnBootResult,
2195        >(
2196            (config, options,),
2197            0x705558b5612fbf62,
2198            fidl::encoding::DynamicFlags::FLEXIBLE,
2199            _decode,
2200        )
2201    }
2202
2203    type EndTraceSessionResponseFut = fidl::client::QueryResponseFut<
2204        SessionManagerEndTraceSessionResult,
2205        fidl::encoding::DefaultFuchsiaResourceDialect,
2206    >;
2207    fn r#end_trace_session(
2208        &self,
2209        mut task_id: u64,
2210        mut output: fidl::Socket,
2211    ) -> Self::EndTraceSessionResponseFut {
2212        fn _decode(
2213            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2214        ) -> Result<SessionManagerEndTraceSessionResult, fidl::Error> {
2215            let _response = fidl::client::decode_transaction_body::<
2216                fidl::encoding::FlexibleResultType<
2217                    SessionManagerEndTraceSessionResponse,
2218                    RecordingError,
2219                >,
2220                fidl::encoding::DefaultFuchsiaResourceDialect,
2221                0x72d6ca80a0787577,
2222            >(_buf?)?
2223            .into_result::<SessionManagerMarker>("end_trace_session")?;
2224            Ok(_response.map(|x| (x.options, x.result)))
2225        }
2226        self.client.send_query_and_decode::<
2227            SessionManagerEndTraceSessionRequest,
2228            SessionManagerEndTraceSessionResult,
2229        >(
2230            (task_id, output,),
2231            0x72d6ca80a0787577,
2232            fidl::encoding::DynamicFlags::FLEXIBLE,
2233            _decode,
2234        )
2235    }
2236
2237    type StatusResponseFut = fidl::client::QueryResponseFut<
2238        SessionManagerStatusResult,
2239        fidl::encoding::DefaultFuchsiaResourceDialect,
2240    >;
2241    fn r#status(&self) -> Self::StatusResponseFut {
2242        fn _decode(
2243            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2244        ) -> Result<SessionManagerStatusResult, fidl::Error> {
2245            let _response = fidl::client::decode_transaction_body::<
2246                fidl::encoding::FlexibleResultType<TraceStatus, RecordingError>,
2247                fidl::encoding::DefaultFuchsiaResourceDialect,
2248                0x2ebc198b7af59063,
2249            >(_buf?)?
2250            .into_result::<SessionManagerMarker>("status")?;
2251            Ok(_response.map(|x| x))
2252        }
2253        self.client
2254            .send_query_and_decode::<fidl::encoding::EmptyPayload, SessionManagerStatusResult>(
2255                (),
2256                0x2ebc198b7af59063,
2257                fidl::encoding::DynamicFlags::FLEXIBLE,
2258                _decode,
2259            )
2260    }
2261}
2262
2263pub struct SessionManagerEventStream {
2264    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2265}
2266
2267impl std::marker::Unpin for SessionManagerEventStream {}
2268
2269impl futures::stream::FusedStream for SessionManagerEventStream {
2270    fn is_terminated(&self) -> bool {
2271        self.event_receiver.is_terminated()
2272    }
2273}
2274
2275impl futures::Stream for SessionManagerEventStream {
2276    type Item = Result<SessionManagerEvent, fidl::Error>;
2277
2278    fn poll_next(
2279        mut self: std::pin::Pin<&mut Self>,
2280        cx: &mut std::task::Context<'_>,
2281    ) -> std::task::Poll<Option<Self::Item>> {
2282        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2283            &mut self.event_receiver,
2284            cx
2285        )?) {
2286            Some(buf) => std::task::Poll::Ready(Some(SessionManagerEvent::decode(buf))),
2287            None => std::task::Poll::Ready(None),
2288        }
2289    }
2290}
2291
2292#[derive(Debug)]
2293pub enum SessionManagerEvent {
2294    #[non_exhaustive]
2295    _UnknownEvent {
2296        /// Ordinal of the event that was sent.
2297        ordinal: u64,
2298    },
2299}
2300
2301impl SessionManagerEvent {
2302    /// Decodes a message buffer as a [`SessionManagerEvent`].
2303    fn decode(
2304        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2305    ) -> Result<SessionManagerEvent, fidl::Error> {
2306        let (bytes, _handles) = buf.split_mut();
2307        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2308        debug_assert_eq!(tx_header.tx_id, 0);
2309        match tx_header.ordinal {
2310            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2311                Ok(SessionManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2312            }
2313            _ => Err(fidl::Error::UnknownOrdinal {
2314                ordinal: tx_header.ordinal,
2315                protocol_name:
2316                    <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2317            }),
2318        }
2319    }
2320}
2321
2322/// A Stream of incoming requests for fuchsia.tracing.controller/SessionManager.
2323pub struct SessionManagerRequestStream {
2324    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2325    is_terminated: bool,
2326}
2327
2328impl std::marker::Unpin for SessionManagerRequestStream {}
2329
2330impl futures::stream::FusedStream for SessionManagerRequestStream {
2331    fn is_terminated(&self) -> bool {
2332        self.is_terminated
2333    }
2334}
2335
2336impl fidl::endpoints::RequestStream for SessionManagerRequestStream {
2337    type Protocol = SessionManagerMarker;
2338    type ControlHandle = SessionManagerControlHandle;
2339
2340    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2341        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2342    }
2343
2344    fn control_handle(&self) -> Self::ControlHandle {
2345        SessionManagerControlHandle { inner: self.inner.clone() }
2346    }
2347
2348    fn into_inner(
2349        self,
2350    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2351    {
2352        (self.inner, self.is_terminated)
2353    }
2354
2355    fn from_inner(
2356        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2357        is_terminated: bool,
2358    ) -> Self {
2359        Self { inner, is_terminated }
2360    }
2361}
2362
2363impl futures::Stream for SessionManagerRequestStream {
2364    type Item = Result<SessionManagerRequest, fidl::Error>;
2365
2366    fn poll_next(
2367        mut self: std::pin::Pin<&mut Self>,
2368        cx: &mut std::task::Context<'_>,
2369    ) -> std::task::Poll<Option<Self::Item>> {
2370        let this = &mut *self;
2371        if this.inner.check_shutdown(cx) {
2372            this.is_terminated = true;
2373            return std::task::Poll::Ready(None);
2374        }
2375        if this.is_terminated {
2376            panic!("polled SessionManagerRequestStream after completion");
2377        }
2378        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2379            |bytes, handles| {
2380                match this.inner.channel().read_etc(cx, bytes, handles) {
2381                    std::task::Poll::Ready(Ok(())) => {}
2382                    std::task::Poll::Pending => return std::task::Poll::Pending,
2383                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2384                        this.is_terminated = true;
2385                        return std::task::Poll::Ready(None);
2386                    }
2387                    std::task::Poll::Ready(Err(e)) => {
2388                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2389                            e.into(),
2390                        ))));
2391                    }
2392                }
2393
2394                // A message has been received from the channel
2395                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2396
2397                std::task::Poll::Ready(Some(match header.ordinal {
2398                    0x61bd49c4eb1fa03 => {
2399                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2400                        let mut req = fidl::new_empty!(
2401                            fidl::encoding::EmptyPayload,
2402                            fidl::encoding::DefaultFuchsiaResourceDialect
2403                        );
2404                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2405                        let control_handle =
2406                            SessionManagerControlHandle { inner: this.inner.clone() };
2407                        Ok(SessionManagerRequest::GetProviders {
2408                            responder: SessionManagerGetProvidersResponder {
2409                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2410                                tx_id: header.tx_id,
2411                            },
2412                        })
2413                    }
2414                    0x6f0abdb5401788b2 => {
2415                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2416                        let mut req = fidl::new_empty!(
2417                            fidl::encoding::EmptyPayload,
2418                            fidl::encoding::DefaultFuchsiaResourceDialect
2419                        );
2420                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2421                        let control_handle =
2422                            SessionManagerControlHandle { inner: this.inner.clone() };
2423                        Ok(SessionManagerRequest::GetKnownCategories {
2424                            responder: SessionManagerGetKnownCategoriesResponder {
2425                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2426                                tx_id: header.tx_id,
2427                            },
2428                        })
2429                    }
2430                    0x54c39e0c173c0162 => {
2431                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2432                        let mut req = fidl::new_empty!(
2433                            SessionManagerStartTraceSessionRequest,
2434                            fidl::encoding::DefaultFuchsiaResourceDialect
2435                        );
2436                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerStartTraceSessionRequest>(&header, _body_bytes, handles, &mut req)?;
2437                        let control_handle =
2438                            SessionManagerControlHandle { inner: this.inner.clone() };
2439                        Ok(SessionManagerRequest::StartTraceSession {
2440                            config: req.config,
2441                            options: req.options,
2442
2443                            responder: SessionManagerStartTraceSessionResponder {
2444                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2445                                tx_id: header.tx_id,
2446                            },
2447                        })
2448                    }
2449                    0x705558b5612fbf62 => {
2450                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2451                        let mut req = fidl::new_empty!(
2452                            SessionManagerStartTraceSessionOnBootRequest,
2453                            fidl::encoding::DefaultFuchsiaResourceDialect
2454                        );
2455                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerStartTraceSessionOnBootRequest>(&header, _body_bytes, handles, &mut req)?;
2456                        let control_handle =
2457                            SessionManagerControlHandle { inner: this.inner.clone() };
2458                        Ok(SessionManagerRequest::StartTraceSessionOnBoot {
2459                            config: req.config,
2460                            options: req.options,
2461
2462                            responder: SessionManagerStartTraceSessionOnBootResponder {
2463                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2464                                tx_id: header.tx_id,
2465                            },
2466                        })
2467                    }
2468                    0x72d6ca80a0787577 => {
2469                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2470                        let mut req = fidl::new_empty!(
2471                            SessionManagerEndTraceSessionRequest,
2472                            fidl::encoding::DefaultFuchsiaResourceDialect
2473                        );
2474                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerEndTraceSessionRequest>(&header, _body_bytes, handles, &mut req)?;
2475                        let control_handle =
2476                            SessionManagerControlHandle { inner: this.inner.clone() };
2477                        Ok(SessionManagerRequest::EndTraceSession {
2478                            task_id: req.task_id,
2479                            output: req.output,
2480
2481                            responder: SessionManagerEndTraceSessionResponder {
2482                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2483                                tx_id: header.tx_id,
2484                            },
2485                        })
2486                    }
2487                    0x2ebc198b7af59063 => {
2488                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2489                        let mut req = fidl::new_empty!(
2490                            fidl::encoding::EmptyPayload,
2491                            fidl::encoding::DefaultFuchsiaResourceDialect
2492                        );
2493                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2494                        let control_handle =
2495                            SessionManagerControlHandle { inner: this.inner.clone() };
2496                        Ok(SessionManagerRequest::Status {
2497                            responder: SessionManagerStatusResponder {
2498                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2499                                tx_id: header.tx_id,
2500                            },
2501                        })
2502                    }
2503                    _ if header.tx_id == 0
2504                        && header
2505                            .dynamic_flags()
2506                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2507                    {
2508                        Ok(SessionManagerRequest::_UnknownMethod {
2509                            ordinal: header.ordinal,
2510                            control_handle: SessionManagerControlHandle {
2511                                inner: this.inner.clone(),
2512                            },
2513                            method_type: fidl::MethodType::OneWay,
2514                        })
2515                    }
2516                    _ if header
2517                        .dynamic_flags()
2518                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2519                    {
2520                        this.inner.send_framework_err(
2521                            fidl::encoding::FrameworkErr::UnknownMethod,
2522                            header.tx_id,
2523                            header.ordinal,
2524                            header.dynamic_flags(),
2525                            (bytes, handles),
2526                        )?;
2527                        Ok(SessionManagerRequest::_UnknownMethod {
2528                            ordinal: header.ordinal,
2529                            control_handle: SessionManagerControlHandle {
2530                                inner: this.inner.clone(),
2531                            },
2532                            method_type: fidl::MethodType::TwoWay,
2533                        })
2534                    }
2535                    _ => Err(fidl::Error::UnknownOrdinal {
2536                        ordinal: header.ordinal,
2537                        protocol_name:
2538                            <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2539                    }),
2540                }))
2541            },
2542        )
2543    }
2544}
2545
2546#[derive(Debug)]
2547pub enum SessionManagerRequest {
2548    /// Return the set of registered providers.
2549    GetProviders { responder: SessionManagerGetProvidersResponder },
2550    /// Gets the known categories.
2551    GetKnownCategories { responder: SessionManagerGetKnownCategoriesResponder },
2552    /// Starts a Trace session.
2553    StartTraceSession {
2554        config: TraceConfig,
2555        options: TraceOptions,
2556        responder: SessionManagerStartTraceSessionResponder,
2557    },
2558    /// Configure a Trace session to start when the component starts.
2559    StartTraceSessionOnBoot {
2560        config: TraceConfig,
2561        options: TraceOptions,
2562        responder: SessionManagerStartTraceSessionOnBootResponder,
2563    },
2564    /// Ends the trace session.
2565    /// If task_id is non-zero, then only the trace task with the given id is checked.
2566    /// Note: Currently there is only 1 trace task active at a time, so the task_id is of
2567    /// little value at this time.
2568    EndTraceSession {
2569        task_id: u64,
2570        output: fidl::Socket,
2571        responder: SessionManagerEndTraceSessionResponder,
2572    },
2573    /// Returns the status of the current trace session.
2574    Status { responder: SessionManagerStatusResponder },
2575    /// An interaction was received which does not match any known method.
2576    #[non_exhaustive]
2577    _UnknownMethod {
2578        /// Ordinal of the method that was called.
2579        ordinal: u64,
2580        control_handle: SessionManagerControlHandle,
2581        method_type: fidl::MethodType,
2582    },
2583}
2584
2585impl SessionManagerRequest {
2586    #[allow(irrefutable_let_patterns)]
2587    pub fn into_get_providers(self) -> Option<(SessionManagerGetProvidersResponder)> {
2588        if let SessionManagerRequest::GetProviders { responder } = self {
2589            Some((responder))
2590        } else {
2591            None
2592        }
2593    }
2594
2595    #[allow(irrefutable_let_patterns)]
2596    pub fn into_get_known_categories(self) -> Option<(SessionManagerGetKnownCategoriesResponder)> {
2597        if let SessionManagerRequest::GetKnownCategories { responder } = self {
2598            Some((responder))
2599        } else {
2600            None
2601        }
2602    }
2603
2604    #[allow(irrefutable_let_patterns)]
2605    pub fn into_start_trace_session(
2606        self,
2607    ) -> Option<(TraceConfig, TraceOptions, SessionManagerStartTraceSessionResponder)> {
2608        if let SessionManagerRequest::StartTraceSession { config, options, responder } = self {
2609            Some((config, options, responder))
2610        } else {
2611            None
2612        }
2613    }
2614
2615    #[allow(irrefutable_let_patterns)]
2616    pub fn into_start_trace_session_on_boot(
2617        self,
2618    ) -> Option<(TraceConfig, TraceOptions, SessionManagerStartTraceSessionOnBootResponder)> {
2619        if let SessionManagerRequest::StartTraceSessionOnBoot { config, options, responder } = self
2620        {
2621            Some((config, options, responder))
2622        } else {
2623            None
2624        }
2625    }
2626
2627    #[allow(irrefutable_let_patterns)]
2628    pub fn into_end_trace_session(
2629        self,
2630    ) -> Option<(u64, fidl::Socket, SessionManagerEndTraceSessionResponder)> {
2631        if let SessionManagerRequest::EndTraceSession { task_id, output, responder } = self {
2632            Some((task_id, output, responder))
2633        } else {
2634            None
2635        }
2636    }
2637
2638    #[allow(irrefutable_let_patterns)]
2639    pub fn into_status(self) -> Option<(SessionManagerStatusResponder)> {
2640        if let SessionManagerRequest::Status { responder } = self {
2641            Some((responder))
2642        } else {
2643            None
2644        }
2645    }
2646
2647    /// Name of the method defined in FIDL
2648    pub fn method_name(&self) -> &'static str {
2649        match *self {
2650            SessionManagerRequest::GetProviders { .. } => "get_providers",
2651            SessionManagerRequest::GetKnownCategories { .. } => "get_known_categories",
2652            SessionManagerRequest::StartTraceSession { .. } => "start_trace_session",
2653            SessionManagerRequest::StartTraceSessionOnBoot { .. } => "start_trace_session_on_boot",
2654            SessionManagerRequest::EndTraceSession { .. } => "end_trace_session",
2655            SessionManagerRequest::Status { .. } => "status",
2656            SessionManagerRequest::_UnknownMethod {
2657                method_type: fidl::MethodType::OneWay, ..
2658            } => "unknown one-way method",
2659            SessionManagerRequest::_UnknownMethod {
2660                method_type: fidl::MethodType::TwoWay, ..
2661            } => "unknown two-way method",
2662        }
2663    }
2664}
2665
2666#[derive(Debug, Clone)]
2667pub struct SessionManagerControlHandle {
2668    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2669}
2670
2671impl fidl::endpoints::ControlHandle for SessionManagerControlHandle {
2672    fn shutdown(&self) {
2673        self.inner.shutdown()
2674    }
2675    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2676        self.inner.shutdown_with_epitaph(status)
2677    }
2678
2679    fn is_closed(&self) -> bool {
2680        self.inner.channel().is_closed()
2681    }
2682    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2683        self.inner.channel().on_closed()
2684    }
2685
2686    #[cfg(target_os = "fuchsia")]
2687    fn signal_peer(
2688        &self,
2689        clear_mask: zx::Signals,
2690        set_mask: zx::Signals,
2691    ) -> Result<(), zx_status::Status> {
2692        use fidl::Peered;
2693        self.inner.channel().signal_peer(clear_mask, set_mask)
2694    }
2695}
2696
2697impl SessionManagerControlHandle {}
2698
2699#[must_use = "FIDL methods require a response to be sent"]
2700#[derive(Debug)]
2701pub struct SessionManagerGetProvidersResponder {
2702    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2703    tx_id: u32,
2704}
2705
2706/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2707/// if the responder is dropped without sending a response, so that the client
2708/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2709impl std::ops::Drop for SessionManagerGetProvidersResponder {
2710    fn drop(&mut self) {
2711        self.control_handle.shutdown();
2712        // Safety: drops once, never accessed again
2713        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2714    }
2715}
2716
2717impl fidl::endpoints::Responder for SessionManagerGetProvidersResponder {
2718    type ControlHandle = SessionManagerControlHandle;
2719
2720    fn control_handle(&self) -> &SessionManagerControlHandle {
2721        &self.control_handle
2722    }
2723
2724    fn drop_without_shutdown(mut self) {
2725        // Safety: drops once, never accessed again due to mem::forget
2726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2727        // Prevent Drop from running (which would shut down the channel)
2728        std::mem::forget(self);
2729    }
2730}
2731
2732impl SessionManagerGetProvidersResponder {
2733    /// Sends a response to the FIDL transaction.
2734    ///
2735    /// Sets the channel to shutdown if an error occurs.
2736    pub fn send(self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
2737        let _result = self.send_raw(providers);
2738        if _result.is_err() {
2739            self.control_handle.shutdown();
2740        }
2741        self.drop_without_shutdown();
2742        _result
2743    }
2744
2745    /// Similar to "send" but does not shutdown the channel if an error occurs.
2746    pub fn send_no_shutdown_on_err(
2747        self,
2748        mut providers: &[ProviderInfo],
2749    ) -> Result<(), fidl::Error> {
2750        let _result = self.send_raw(providers);
2751        self.drop_without_shutdown();
2752        _result
2753    }
2754
2755    fn send_raw(&self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
2756        self.control_handle
2757            .inner
2758            .send::<fidl::encoding::FlexibleType<SessionManagerGetProvidersResponse>>(
2759                fidl::encoding::Flexible::new((providers,)),
2760                self.tx_id,
2761                0x61bd49c4eb1fa03,
2762                fidl::encoding::DynamicFlags::FLEXIBLE,
2763            )
2764    }
2765}
2766
2767#[must_use = "FIDL methods require a response to be sent"]
2768#[derive(Debug)]
2769pub struct SessionManagerGetKnownCategoriesResponder {
2770    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2771    tx_id: u32,
2772}
2773
2774/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2775/// if the responder is dropped without sending a response, so that the client
2776/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2777impl std::ops::Drop for SessionManagerGetKnownCategoriesResponder {
2778    fn drop(&mut self) {
2779        self.control_handle.shutdown();
2780        // Safety: drops once, never accessed again
2781        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2782    }
2783}
2784
2785impl fidl::endpoints::Responder for SessionManagerGetKnownCategoriesResponder {
2786    type ControlHandle = SessionManagerControlHandle;
2787
2788    fn control_handle(&self) -> &SessionManagerControlHandle {
2789        &self.control_handle
2790    }
2791
2792    fn drop_without_shutdown(mut self) {
2793        // Safety: drops once, never accessed again due to mem::forget
2794        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2795        // Prevent Drop from running (which would shut down the channel)
2796        std::mem::forget(self);
2797    }
2798}
2799
2800impl SessionManagerGetKnownCategoriesResponder {
2801    /// Sends a response to the FIDL transaction.
2802    ///
2803    /// Sets the channel to shutdown if an error occurs.
2804    pub fn send(
2805        self,
2806        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
2807    ) -> Result<(), fidl::Error> {
2808        let _result = self.send_raw(categories);
2809        if _result.is_err() {
2810            self.control_handle.shutdown();
2811        }
2812        self.drop_without_shutdown();
2813        _result
2814    }
2815
2816    /// Similar to "send" but does not shutdown the channel if an error occurs.
2817    pub fn send_no_shutdown_on_err(
2818        self,
2819        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
2820    ) -> Result<(), fidl::Error> {
2821        let _result = self.send_raw(categories);
2822        self.drop_without_shutdown();
2823        _result
2824    }
2825
2826    fn send_raw(
2827        &self,
2828        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
2829    ) -> Result<(), fidl::Error> {
2830        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
2831            SessionManagerGetKnownCategoriesResponse,
2832        >>(
2833            fidl::encoding::Flexible::new((categories,)),
2834            self.tx_id,
2835            0x6f0abdb5401788b2,
2836            fidl::encoding::DynamicFlags::FLEXIBLE,
2837        )
2838    }
2839}
2840
2841#[must_use = "FIDL methods require a response to be sent"]
2842#[derive(Debug)]
2843pub struct SessionManagerStartTraceSessionResponder {
2844    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2845    tx_id: u32,
2846}
2847
2848/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2849/// if the responder is dropped without sending a response, so that the client
2850/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2851impl std::ops::Drop for SessionManagerStartTraceSessionResponder {
2852    fn drop(&mut self) {
2853        self.control_handle.shutdown();
2854        // Safety: drops once, never accessed again
2855        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2856    }
2857}
2858
2859impl fidl::endpoints::Responder for SessionManagerStartTraceSessionResponder {
2860    type ControlHandle = SessionManagerControlHandle;
2861
2862    fn control_handle(&self) -> &SessionManagerControlHandle {
2863        &self.control_handle
2864    }
2865
2866    fn drop_without_shutdown(mut self) {
2867        // Safety: drops once, never accessed again due to mem::forget
2868        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2869        // Prevent Drop from running (which would shut down the channel)
2870        std::mem::forget(self);
2871    }
2872}
2873
2874impl SessionManagerStartTraceSessionResponder {
2875    /// Sends a response to the FIDL transaction.
2876    ///
2877    /// Sets the channel to shutdown if an error occurs.
2878    pub fn send(self, mut result: Result<u64, RecordingError>) -> Result<(), fidl::Error> {
2879        let _result = self.send_raw(result);
2880        if _result.is_err() {
2881            self.control_handle.shutdown();
2882        }
2883        self.drop_without_shutdown();
2884        _result
2885    }
2886
2887    /// Similar to "send" but does not shutdown the channel if an error occurs.
2888    pub fn send_no_shutdown_on_err(
2889        self,
2890        mut result: Result<u64, RecordingError>,
2891    ) -> Result<(), fidl::Error> {
2892        let _result = self.send_raw(result);
2893        self.drop_without_shutdown();
2894        _result
2895    }
2896
2897    fn send_raw(&self, mut result: Result<u64, RecordingError>) -> Result<(), fidl::Error> {
2898        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2899            SessionManagerStartTraceSessionResponse,
2900            RecordingError,
2901        >>(
2902            fidl::encoding::FlexibleResult::new(result.map(|task_id| (task_id,))),
2903            self.tx_id,
2904            0x54c39e0c173c0162,
2905            fidl::encoding::DynamicFlags::FLEXIBLE,
2906        )
2907    }
2908}
2909
2910#[must_use = "FIDL methods require a response to be sent"]
2911#[derive(Debug)]
2912pub struct SessionManagerStartTraceSessionOnBootResponder {
2913    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2914    tx_id: u32,
2915}
2916
2917/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2918/// if the responder is dropped without sending a response, so that the client
2919/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2920impl std::ops::Drop for SessionManagerStartTraceSessionOnBootResponder {
2921    fn drop(&mut self) {
2922        self.control_handle.shutdown();
2923        // Safety: drops once, never accessed again
2924        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2925    }
2926}
2927
2928impl fidl::endpoints::Responder for SessionManagerStartTraceSessionOnBootResponder {
2929    type ControlHandle = SessionManagerControlHandle;
2930
2931    fn control_handle(&self) -> &SessionManagerControlHandle {
2932        &self.control_handle
2933    }
2934
2935    fn drop_without_shutdown(mut self) {
2936        // Safety: drops once, never accessed again due to mem::forget
2937        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2938        // Prevent Drop from running (which would shut down the channel)
2939        std::mem::forget(self);
2940    }
2941}
2942
2943impl SessionManagerStartTraceSessionOnBootResponder {
2944    /// Sends a response to the FIDL transaction.
2945    ///
2946    /// Sets the channel to shutdown if an error occurs.
2947    pub fn send(self, mut result: Result<(), RecordingError>) -> Result<(), fidl::Error> {
2948        let _result = self.send_raw(result);
2949        if _result.is_err() {
2950            self.control_handle.shutdown();
2951        }
2952        self.drop_without_shutdown();
2953        _result
2954    }
2955
2956    /// Similar to "send" but does not shutdown the channel if an error occurs.
2957    pub fn send_no_shutdown_on_err(
2958        self,
2959        mut result: Result<(), RecordingError>,
2960    ) -> Result<(), fidl::Error> {
2961        let _result = self.send_raw(result);
2962        self.drop_without_shutdown();
2963        _result
2964    }
2965
2966    fn send_raw(&self, mut result: Result<(), RecordingError>) -> Result<(), fidl::Error> {
2967        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2968            fidl::encoding::EmptyStruct,
2969            RecordingError,
2970        >>(
2971            fidl::encoding::FlexibleResult::new(result),
2972            self.tx_id,
2973            0x705558b5612fbf62,
2974            fidl::encoding::DynamicFlags::FLEXIBLE,
2975        )
2976    }
2977}
2978
2979#[must_use = "FIDL methods require a response to be sent"]
2980#[derive(Debug)]
2981pub struct SessionManagerEndTraceSessionResponder {
2982    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2983    tx_id: u32,
2984}
2985
2986/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
2987/// if the responder is dropped without sending a response, so that the client
2988/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2989impl std::ops::Drop for SessionManagerEndTraceSessionResponder {
2990    fn drop(&mut self) {
2991        self.control_handle.shutdown();
2992        // Safety: drops once, never accessed again
2993        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2994    }
2995}
2996
2997impl fidl::endpoints::Responder for SessionManagerEndTraceSessionResponder {
2998    type ControlHandle = SessionManagerControlHandle;
2999
3000    fn control_handle(&self) -> &SessionManagerControlHandle {
3001        &self.control_handle
3002    }
3003
3004    fn drop_without_shutdown(mut self) {
3005        // Safety: drops once, never accessed again due to mem::forget
3006        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3007        // Prevent Drop from running (which would shut down the channel)
3008        std::mem::forget(self);
3009    }
3010}
3011
3012impl SessionManagerEndTraceSessionResponder {
3013    /// Sends a response to the FIDL transaction.
3014    ///
3015    /// Sets the channel to shutdown if an error occurs.
3016    pub fn send(
3017        self,
3018        mut result: Result<(&TraceOptions, &StopResult), RecordingError>,
3019    ) -> Result<(), fidl::Error> {
3020        let _result = self.send_raw(result);
3021        if _result.is_err() {
3022            self.control_handle.shutdown();
3023        }
3024        self.drop_without_shutdown();
3025        _result
3026    }
3027
3028    /// Similar to "send" but does not shutdown the channel if an error occurs.
3029    pub fn send_no_shutdown_on_err(
3030        self,
3031        mut result: Result<(&TraceOptions, &StopResult), RecordingError>,
3032    ) -> Result<(), fidl::Error> {
3033        let _result = self.send_raw(result);
3034        self.drop_without_shutdown();
3035        _result
3036    }
3037
3038    fn send_raw(
3039        &self,
3040        mut result: Result<(&TraceOptions, &StopResult), RecordingError>,
3041    ) -> Result<(), fidl::Error> {
3042        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3043            SessionManagerEndTraceSessionResponse,
3044            RecordingError,
3045        >>(
3046            fidl::encoding::FlexibleResult::new(result),
3047            self.tx_id,
3048            0x72d6ca80a0787577,
3049            fidl::encoding::DynamicFlags::FLEXIBLE,
3050        )
3051    }
3052}
3053
3054#[must_use = "FIDL methods require a response to be sent"]
3055#[derive(Debug)]
3056pub struct SessionManagerStatusResponder {
3057    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
3058    tx_id: u32,
3059}
3060
3061/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
3062/// if the responder is dropped without sending a response, so that the client
3063/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3064impl std::ops::Drop for SessionManagerStatusResponder {
3065    fn drop(&mut self) {
3066        self.control_handle.shutdown();
3067        // Safety: drops once, never accessed again
3068        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3069    }
3070}
3071
3072impl fidl::endpoints::Responder for SessionManagerStatusResponder {
3073    type ControlHandle = SessionManagerControlHandle;
3074
3075    fn control_handle(&self) -> &SessionManagerControlHandle {
3076        &self.control_handle
3077    }
3078
3079    fn drop_without_shutdown(mut self) {
3080        // Safety: drops once, never accessed again due to mem::forget
3081        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3082        // Prevent Drop from running (which would shut down the channel)
3083        std::mem::forget(self);
3084    }
3085}
3086
3087impl SessionManagerStatusResponder {
3088    /// Sends a response to the FIDL transaction.
3089    ///
3090    /// Sets the channel to shutdown if an error occurs.
3091    pub fn send(self, mut result: Result<&TraceStatus, RecordingError>) -> Result<(), fidl::Error> {
3092        let _result = self.send_raw(result);
3093        if _result.is_err() {
3094            self.control_handle.shutdown();
3095        }
3096        self.drop_without_shutdown();
3097        _result
3098    }
3099
3100    /// Similar to "send" but does not shutdown the channel if an error occurs.
3101    pub fn send_no_shutdown_on_err(
3102        self,
3103        mut result: Result<&TraceStatus, RecordingError>,
3104    ) -> Result<(), fidl::Error> {
3105        let _result = self.send_raw(result);
3106        self.drop_without_shutdown();
3107        _result
3108    }
3109
3110    fn send_raw(
3111        &self,
3112        mut result: Result<&TraceStatus, RecordingError>,
3113    ) -> Result<(), fidl::Error> {
3114        self.control_handle
3115            .inner
3116            .send::<fidl::encoding::FlexibleResultType<TraceStatus, RecordingError>>(
3117                fidl::encoding::FlexibleResult::new(result),
3118                self.tx_id,
3119                0x2ebc198b7af59063,
3120                fidl::encoding::DynamicFlags::FLEXIBLE,
3121            )
3122    }
3123}
3124
3125mod internal {
3126    use super::*;
3127
3128    impl fidl::encoding::ResourceTypeMarker for ProvisionerInitializeTracingRequest {
3129        type Borrowed<'a> = &'a mut Self;
3130        fn take_or_borrow<'a>(
3131            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3132        ) -> Self::Borrowed<'a> {
3133            value
3134        }
3135    }
3136
3137    unsafe impl fidl::encoding::TypeMarker for ProvisionerInitializeTracingRequest {
3138        type Owned = Self;
3139
3140        #[inline(always)]
3141        fn inline_align(_context: fidl::encoding::Context) -> usize {
3142            8
3143        }
3144
3145        #[inline(always)]
3146        fn inline_size(_context: fidl::encoding::Context) -> usize {
3147            32
3148        }
3149    }
3150
3151    unsafe impl
3152        fidl::encoding::Encode<
3153            ProvisionerInitializeTracingRequest,
3154            fidl::encoding::DefaultFuchsiaResourceDialect,
3155        > for &mut ProvisionerInitializeTracingRequest
3156    {
3157        #[inline]
3158        unsafe fn encode(
3159            self,
3160            encoder: &mut fidl::encoding::Encoder<
3161                '_,
3162                fidl::encoding::DefaultFuchsiaResourceDialect,
3163            >,
3164            offset: usize,
3165            _depth: fidl::encoding::Depth,
3166        ) -> fidl::Result<()> {
3167            encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
3168            // Delegate to tuple encoding.
3169            fidl::encoding::Encode::<ProvisionerInitializeTracingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3170                (
3171                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
3172                    <TraceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
3173                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.output),
3174                ),
3175                encoder, offset, _depth
3176            )
3177        }
3178    }
3179    unsafe impl<
3180        T0: fidl::encoding::Encode<
3181                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3182                fidl::encoding::DefaultFuchsiaResourceDialect,
3183            >,
3184        T1: fidl::encoding::Encode<TraceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
3185        T2: fidl::encoding::Encode<
3186                fidl::encoding::HandleType<
3187                    fidl::Socket,
3188                    { fidl::ObjectType::SOCKET.into_raw() },
3189                    16392,
3190                >,
3191                fidl::encoding::DefaultFuchsiaResourceDialect,
3192            >,
3193    >
3194        fidl::encoding::Encode<
3195            ProvisionerInitializeTracingRequest,
3196            fidl::encoding::DefaultFuchsiaResourceDialect,
3197        > for (T0, T1, T2)
3198    {
3199        #[inline]
3200        unsafe fn encode(
3201            self,
3202            encoder: &mut fidl::encoding::Encoder<
3203                '_,
3204                fidl::encoding::DefaultFuchsiaResourceDialect,
3205            >,
3206            offset: usize,
3207            depth: fidl::encoding::Depth,
3208        ) -> fidl::Result<()> {
3209            encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
3210            // Zero out padding regions. There's no need to apply masks
3211            // because the unmasked parts will be overwritten by fields.
3212            unsafe {
3213                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3214                (ptr as *mut u64).write_unaligned(0);
3215            }
3216            unsafe {
3217                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3218                (ptr as *mut u64).write_unaligned(0);
3219            }
3220            // Write the fields.
3221            self.0.encode(encoder, offset + 0, depth)?;
3222            self.1.encode(encoder, offset + 8, depth)?;
3223            self.2.encode(encoder, offset + 24, depth)?;
3224            Ok(())
3225        }
3226    }
3227
3228    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3229        for ProvisionerInitializeTracingRequest
3230    {
3231        #[inline(always)]
3232        fn new_empty() -> Self {
3233            Self {
3234                controller: fidl::new_empty!(
3235                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3236                    fidl::encoding::DefaultFuchsiaResourceDialect
3237                ),
3238                config: fidl::new_empty!(
3239                    TraceConfig,
3240                    fidl::encoding::DefaultFuchsiaResourceDialect
3241                ),
3242                output: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
3243            }
3244        }
3245
3246        #[inline]
3247        unsafe fn decode(
3248            &mut self,
3249            decoder: &mut fidl::encoding::Decoder<
3250                '_,
3251                fidl::encoding::DefaultFuchsiaResourceDialect,
3252            >,
3253            offset: usize,
3254            _depth: fidl::encoding::Depth,
3255        ) -> fidl::Result<()> {
3256            decoder.debug_check_bounds::<Self>(offset);
3257            // Verify that padding bytes are zero.
3258            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3259            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3260            let mask = 0xffffffff00000000u64;
3261            let maskedval = padval & mask;
3262            if maskedval != 0 {
3263                return Err(fidl::Error::NonZeroPadding {
3264                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3265                });
3266            }
3267            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3268            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3269            let mask = 0xffffffff00000000u64;
3270            let maskedval = padval & mask;
3271            if maskedval != 0 {
3272                return Err(fidl::Error::NonZeroPadding {
3273                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3274                });
3275            }
3276            fidl::decode!(
3277                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3278                fidl::encoding::DefaultFuchsiaResourceDialect,
3279                &mut self.controller,
3280                decoder,
3281                offset + 0,
3282                _depth
3283            )?;
3284            fidl::decode!(
3285                TraceConfig,
3286                fidl::encoding::DefaultFuchsiaResourceDialect,
3287                &mut self.config,
3288                decoder,
3289                offset + 8,
3290                _depth
3291            )?;
3292            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.output, decoder, offset + 24, _depth)?;
3293            Ok(())
3294        }
3295    }
3296
3297    impl fidl::encoding::ResourceTypeMarker for SessionManagerEndTraceSessionRequest {
3298        type Borrowed<'a> = &'a mut Self;
3299        fn take_or_borrow<'a>(
3300            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3301        ) -> Self::Borrowed<'a> {
3302            value
3303        }
3304    }
3305
3306    unsafe impl fidl::encoding::TypeMarker for SessionManagerEndTraceSessionRequest {
3307        type Owned = Self;
3308
3309        #[inline(always)]
3310        fn inline_align(_context: fidl::encoding::Context) -> usize {
3311            8
3312        }
3313
3314        #[inline(always)]
3315        fn inline_size(_context: fidl::encoding::Context) -> usize {
3316            16
3317        }
3318    }
3319
3320    unsafe impl
3321        fidl::encoding::Encode<
3322            SessionManagerEndTraceSessionRequest,
3323            fidl::encoding::DefaultFuchsiaResourceDialect,
3324        > for &mut SessionManagerEndTraceSessionRequest
3325    {
3326        #[inline]
3327        unsafe fn encode(
3328            self,
3329            encoder: &mut fidl::encoding::Encoder<
3330                '_,
3331                fidl::encoding::DefaultFuchsiaResourceDialect,
3332            >,
3333            offset: usize,
3334            _depth: fidl::encoding::Depth,
3335        ) -> fidl::Result<()> {
3336            encoder.debug_check_bounds::<SessionManagerEndTraceSessionRequest>(offset);
3337            // Delegate to tuple encoding.
3338            fidl::encoding::Encode::<
3339                SessionManagerEndTraceSessionRequest,
3340                fidl::encoding::DefaultFuchsiaResourceDialect,
3341            >::encode(
3342                (
3343                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.task_id),
3344                    <fidl::encoding::HandleType<
3345                        fidl::Socket,
3346                        { fidl::ObjectType::SOCKET.into_raw() },
3347                        16394,
3348                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3349                        &mut self.output
3350                    ),
3351                ),
3352                encoder,
3353                offset,
3354                _depth,
3355            )
3356        }
3357    }
3358    unsafe impl<
3359        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3360        T1: fidl::encoding::Encode<
3361                fidl::encoding::HandleType<
3362                    fidl::Socket,
3363                    { fidl::ObjectType::SOCKET.into_raw() },
3364                    16394,
3365                >,
3366                fidl::encoding::DefaultFuchsiaResourceDialect,
3367            >,
3368    >
3369        fidl::encoding::Encode<
3370            SessionManagerEndTraceSessionRequest,
3371            fidl::encoding::DefaultFuchsiaResourceDialect,
3372        > for (T0, T1)
3373    {
3374        #[inline]
3375        unsafe fn encode(
3376            self,
3377            encoder: &mut fidl::encoding::Encoder<
3378                '_,
3379                fidl::encoding::DefaultFuchsiaResourceDialect,
3380            >,
3381            offset: usize,
3382            depth: fidl::encoding::Depth,
3383        ) -> fidl::Result<()> {
3384            encoder.debug_check_bounds::<SessionManagerEndTraceSessionRequest>(offset);
3385            // Zero out padding regions. There's no need to apply masks
3386            // because the unmasked parts will be overwritten by fields.
3387            unsafe {
3388                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3389                (ptr as *mut u64).write_unaligned(0);
3390            }
3391            // Write the fields.
3392            self.0.encode(encoder, offset + 0, depth)?;
3393            self.1.encode(encoder, offset + 8, depth)?;
3394            Ok(())
3395        }
3396    }
3397
3398    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3399        for SessionManagerEndTraceSessionRequest
3400    {
3401        #[inline(always)]
3402        fn new_empty() -> Self {
3403            Self {
3404                task_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3405                output: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16394>, fidl::encoding::DefaultFuchsiaResourceDialect),
3406            }
3407        }
3408
3409        #[inline]
3410        unsafe fn decode(
3411            &mut self,
3412            decoder: &mut fidl::encoding::Decoder<
3413                '_,
3414                fidl::encoding::DefaultFuchsiaResourceDialect,
3415            >,
3416            offset: usize,
3417            _depth: fidl::encoding::Depth,
3418        ) -> fidl::Result<()> {
3419            decoder.debug_check_bounds::<Self>(offset);
3420            // Verify that padding bytes are zero.
3421            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3422            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3423            let mask = 0xffffffff00000000u64;
3424            let maskedval = padval & mask;
3425            if maskedval != 0 {
3426                return Err(fidl::Error::NonZeroPadding {
3427                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3428                });
3429            }
3430            fidl::decode!(
3431                u64,
3432                fidl::encoding::DefaultFuchsiaResourceDialect,
3433                &mut self.task_id,
3434                decoder,
3435                offset + 0,
3436                _depth
3437            )?;
3438            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16394>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.output, decoder, offset + 8, _depth)?;
3439            Ok(())
3440        }
3441    }
3442
3443    impl fidl::encoding::ResourceTypeMarker for SessionManagerStartTraceSessionOnBootRequest {
3444        type Borrowed<'a> = &'a mut Self;
3445        fn take_or_borrow<'a>(
3446            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3447        ) -> Self::Borrowed<'a> {
3448            value
3449        }
3450    }
3451
3452    unsafe impl fidl::encoding::TypeMarker for SessionManagerStartTraceSessionOnBootRequest {
3453        type Owned = Self;
3454
3455        #[inline(always)]
3456        fn inline_align(_context: fidl::encoding::Context) -> usize {
3457            8
3458        }
3459
3460        #[inline(always)]
3461        fn inline_size(_context: fidl::encoding::Context) -> usize {
3462            32
3463        }
3464    }
3465
3466    unsafe impl
3467        fidl::encoding::Encode<
3468            SessionManagerStartTraceSessionOnBootRequest,
3469            fidl::encoding::DefaultFuchsiaResourceDialect,
3470        > for &mut SessionManagerStartTraceSessionOnBootRequest
3471    {
3472        #[inline]
3473        unsafe fn encode(
3474            self,
3475            encoder: &mut fidl::encoding::Encoder<
3476                '_,
3477                fidl::encoding::DefaultFuchsiaResourceDialect,
3478            >,
3479            offset: usize,
3480            _depth: fidl::encoding::Depth,
3481        ) -> fidl::Result<()> {
3482            encoder.debug_check_bounds::<SessionManagerStartTraceSessionOnBootRequest>(offset);
3483            // Delegate to tuple encoding.
3484            fidl::encoding::Encode::<
3485                SessionManagerStartTraceSessionOnBootRequest,
3486                fidl::encoding::DefaultFuchsiaResourceDialect,
3487            >::encode(
3488                (
3489                    <TraceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
3490                    <TraceOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3491                ),
3492                encoder,
3493                offset,
3494                _depth,
3495            )
3496        }
3497    }
3498    unsafe impl<
3499        T0: fidl::encoding::Encode<TraceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
3500        T1: fidl::encoding::Encode<TraceOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3501    >
3502        fidl::encoding::Encode<
3503            SessionManagerStartTraceSessionOnBootRequest,
3504            fidl::encoding::DefaultFuchsiaResourceDialect,
3505        > for (T0, T1)
3506    {
3507        #[inline]
3508        unsafe fn encode(
3509            self,
3510            encoder: &mut fidl::encoding::Encoder<
3511                '_,
3512                fidl::encoding::DefaultFuchsiaResourceDialect,
3513            >,
3514            offset: usize,
3515            depth: fidl::encoding::Depth,
3516        ) -> fidl::Result<()> {
3517            encoder.debug_check_bounds::<SessionManagerStartTraceSessionOnBootRequest>(offset);
3518            // Zero out padding regions. There's no need to apply masks
3519            // because the unmasked parts will be overwritten by fields.
3520            // Write the fields.
3521            self.0.encode(encoder, offset + 0, depth)?;
3522            self.1.encode(encoder, offset + 16, depth)?;
3523            Ok(())
3524        }
3525    }
3526
3527    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3528        for SessionManagerStartTraceSessionOnBootRequest
3529    {
3530        #[inline(always)]
3531        fn new_empty() -> Self {
3532            Self {
3533                config: fidl::new_empty!(
3534                    TraceConfig,
3535                    fidl::encoding::DefaultFuchsiaResourceDialect
3536                ),
3537                options: fidl::new_empty!(
3538                    TraceOptions,
3539                    fidl::encoding::DefaultFuchsiaResourceDialect
3540                ),
3541            }
3542        }
3543
3544        #[inline]
3545        unsafe fn decode(
3546            &mut self,
3547            decoder: &mut fidl::encoding::Decoder<
3548                '_,
3549                fidl::encoding::DefaultFuchsiaResourceDialect,
3550            >,
3551            offset: usize,
3552            _depth: fidl::encoding::Depth,
3553        ) -> fidl::Result<()> {
3554            decoder.debug_check_bounds::<Self>(offset);
3555            // Verify that padding bytes are zero.
3556            fidl::decode!(
3557                TraceConfig,
3558                fidl::encoding::DefaultFuchsiaResourceDialect,
3559                &mut self.config,
3560                decoder,
3561                offset + 0,
3562                _depth
3563            )?;
3564            fidl::decode!(
3565                TraceOptions,
3566                fidl::encoding::DefaultFuchsiaResourceDialect,
3567                &mut self.options,
3568                decoder,
3569                offset + 16,
3570                _depth
3571            )?;
3572            Ok(())
3573        }
3574    }
3575
3576    impl fidl::encoding::ResourceTypeMarker for SessionManagerStartTraceSessionRequest {
3577        type Borrowed<'a> = &'a mut Self;
3578        fn take_or_borrow<'a>(
3579            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3580        ) -> Self::Borrowed<'a> {
3581            value
3582        }
3583    }
3584
3585    unsafe impl fidl::encoding::TypeMarker for SessionManagerStartTraceSessionRequest {
3586        type Owned = Self;
3587
3588        #[inline(always)]
3589        fn inline_align(_context: fidl::encoding::Context) -> usize {
3590            8
3591        }
3592
3593        #[inline(always)]
3594        fn inline_size(_context: fidl::encoding::Context) -> usize {
3595            32
3596        }
3597    }
3598
3599    unsafe impl
3600        fidl::encoding::Encode<
3601            SessionManagerStartTraceSessionRequest,
3602            fidl::encoding::DefaultFuchsiaResourceDialect,
3603        > for &mut SessionManagerStartTraceSessionRequest
3604    {
3605        #[inline]
3606        unsafe fn encode(
3607            self,
3608            encoder: &mut fidl::encoding::Encoder<
3609                '_,
3610                fidl::encoding::DefaultFuchsiaResourceDialect,
3611            >,
3612            offset: usize,
3613            _depth: fidl::encoding::Depth,
3614        ) -> fidl::Result<()> {
3615            encoder.debug_check_bounds::<SessionManagerStartTraceSessionRequest>(offset);
3616            // Delegate to tuple encoding.
3617            fidl::encoding::Encode::<
3618                SessionManagerStartTraceSessionRequest,
3619                fidl::encoding::DefaultFuchsiaResourceDialect,
3620            >::encode(
3621                (
3622                    <TraceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
3623                    <TraceOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3624                ),
3625                encoder,
3626                offset,
3627                _depth,
3628            )
3629        }
3630    }
3631    unsafe impl<
3632        T0: fidl::encoding::Encode<TraceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
3633        T1: fidl::encoding::Encode<TraceOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3634    >
3635        fidl::encoding::Encode<
3636            SessionManagerStartTraceSessionRequest,
3637            fidl::encoding::DefaultFuchsiaResourceDialect,
3638        > for (T0, T1)
3639    {
3640        #[inline]
3641        unsafe fn encode(
3642            self,
3643            encoder: &mut fidl::encoding::Encoder<
3644                '_,
3645                fidl::encoding::DefaultFuchsiaResourceDialect,
3646            >,
3647            offset: usize,
3648            depth: fidl::encoding::Depth,
3649        ) -> fidl::Result<()> {
3650            encoder.debug_check_bounds::<SessionManagerStartTraceSessionRequest>(offset);
3651            // Zero out padding regions. There's no need to apply masks
3652            // because the unmasked parts will be overwritten by fields.
3653            // Write the fields.
3654            self.0.encode(encoder, offset + 0, depth)?;
3655            self.1.encode(encoder, offset + 16, depth)?;
3656            Ok(())
3657        }
3658    }
3659
3660    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3661        for SessionManagerStartTraceSessionRequest
3662    {
3663        #[inline(always)]
3664        fn new_empty() -> Self {
3665            Self {
3666                config: fidl::new_empty!(
3667                    TraceConfig,
3668                    fidl::encoding::DefaultFuchsiaResourceDialect
3669                ),
3670                options: fidl::new_empty!(
3671                    TraceOptions,
3672                    fidl::encoding::DefaultFuchsiaResourceDialect
3673                ),
3674            }
3675        }
3676
3677        #[inline]
3678        unsafe fn decode(
3679            &mut self,
3680            decoder: &mut fidl::encoding::Decoder<
3681                '_,
3682                fidl::encoding::DefaultFuchsiaResourceDialect,
3683            >,
3684            offset: usize,
3685            _depth: fidl::encoding::Depth,
3686        ) -> fidl::Result<()> {
3687            decoder.debug_check_bounds::<Self>(offset);
3688            // Verify that padding bytes are zero.
3689            fidl::decode!(
3690                TraceConfig,
3691                fidl::encoding::DefaultFuchsiaResourceDialect,
3692                &mut self.config,
3693                decoder,
3694                offset + 0,
3695                _depth
3696            )?;
3697            fidl::decode!(
3698                TraceOptions,
3699                fidl::encoding::DefaultFuchsiaResourceDialect,
3700                &mut self.options,
3701                decoder,
3702                offset + 16,
3703                _depth
3704            )?;
3705            Ok(())
3706        }
3707    }
3708}