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, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
27pub struct ProvisionerMarker;
28
29impl fidl::endpoints::ProtocolMarker for ProvisionerMarker {
30    type Proxy = ProvisionerProxy;
31    type RequestStream = ProvisionerRequestStream;
32    #[cfg(target_os = "fuchsia")]
33    type SynchronousProxy = ProvisionerSynchronousProxy;
34
35    const DEBUG_NAME: &'static str = "fuchsia.tracing.controller.Provisioner";
36}
37impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionerMarker {}
38
39pub trait ProvisionerProxyInterface: Send + Sync {
40    fn r#initialize_tracing(
41        &self,
42        controller: fidl::endpoints::ServerEnd<SessionMarker>,
43        config: &TraceConfig,
44        output: fidl::Socket,
45    ) -> Result<(), fidl::Error>;
46    type GetProvidersResponseFut: std::future::Future<Output = Result<Vec<ProviderInfo>, fidl::Error>>
47        + Send;
48    fn r#get_providers(&self) -> Self::GetProvidersResponseFut;
49    type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
50        + Send;
51    fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
52}
53#[derive(Debug)]
54#[cfg(target_os = "fuchsia")]
55pub struct ProvisionerSynchronousProxy {
56    client: fidl::client::sync::Client,
57}
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::SynchronousProxy for ProvisionerSynchronousProxy {
61    type Proxy = ProvisionerProxy;
62    type Protocol = ProvisionerMarker;
63
64    fn from_channel(inner: fidl::Channel) -> Self {
65        Self::new(inner)
66    }
67
68    fn into_channel(self) -> fidl::Channel {
69        self.client.into_channel()
70    }
71
72    fn as_channel(&self) -> &fidl::Channel {
73        self.client.as_channel()
74    }
75}
76
77#[cfg(target_os = "fuchsia")]
78impl ProvisionerSynchronousProxy {
79    pub fn new(channel: fidl::Channel) -> Self {
80        let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
81        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
82    }
83
84    pub fn into_channel(self) -> fidl::Channel {
85        self.client.into_channel()
86    }
87
88    /// Waits until an event arrives and returns it. It is safe for other
89    /// threads to make concurrent requests while waiting for an event.
90    pub fn wait_for_event(
91        &self,
92        deadline: zx::MonotonicInstant,
93    ) -> Result<ProvisionerEvent, fidl::Error> {
94        ProvisionerEvent::decode(self.client.wait_for_event(deadline)?)
95    }
96
97    /// Requests to initialize tracing with the specified `config`.
98    ///
99    /// A bad request will terminate the connection.
100    ///
101    /// Dropping the socket connection will abort and terminate the
102    /// existing trace Session.
103    ///
104    /// The trace controller emits trace data to `output` as a sequence of
105    /// binary formatted trace records.  Traces obtained from different providers
106    /// are delimited by metadata records within the stream.
107    pub fn r#initialize_tracing(
108        &self,
109        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
110        mut config: &TraceConfig,
111        mut output: fidl::Socket,
112    ) -> Result<(), fidl::Error> {
113        self.client.send::<ProvisionerInitializeTracingRequest>(
114            (controller, config, output),
115            0x3b046ed3a0684ab8,
116            fidl::encoding::DynamicFlags::FLEXIBLE,
117        )
118    }
119
120    /// Return the set of registered providers.
121    pub fn r#get_providers(
122        &self,
123        ___deadline: zx::MonotonicInstant,
124    ) -> Result<Vec<ProviderInfo>, fidl::Error> {
125        let _response = self.client.send_query::<
126            fidl::encoding::EmptyPayload,
127            fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
128        >(
129            (),
130            0xc4d4f36edc50d43,
131            fidl::encoding::DynamicFlags::FLEXIBLE,
132            ___deadline,
133        )?
134        .into_result::<ProvisionerMarker>("get_providers")?;
135        Ok(_response.providers)
136    }
137
138    pub fn r#get_known_categories(
139        &self,
140        ___deadline: zx::MonotonicInstant,
141    ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
142        let _response = self.client.send_query::<
143            fidl::encoding::EmptyPayload,
144            fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
145        >(
146            (),
147            0x41ef99397b945a4,
148            fidl::encoding::DynamicFlags::FLEXIBLE,
149            ___deadline,
150        )?
151        .into_result::<ProvisionerMarker>("get_known_categories")?;
152        Ok(_response.categories)
153    }
154}
155
156#[cfg(target_os = "fuchsia")]
157impl From<ProvisionerSynchronousProxy> for zx::Handle {
158    fn from(value: ProvisionerSynchronousProxy) -> Self {
159        value.into_channel().into()
160    }
161}
162
163#[cfg(target_os = "fuchsia")]
164impl From<fidl::Channel> for ProvisionerSynchronousProxy {
165    fn from(value: fidl::Channel) -> Self {
166        Self::new(value)
167    }
168}
169
170#[cfg(target_os = "fuchsia")]
171impl fidl::endpoints::FromClient for ProvisionerSynchronousProxy {
172    type Protocol = ProvisionerMarker;
173
174    fn from_client(value: fidl::endpoints::ClientEnd<ProvisionerMarker>) -> Self {
175        Self::new(value.into_channel())
176    }
177}
178
179#[derive(Debug, Clone)]
180pub struct ProvisionerProxy {
181    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
182}
183
184impl fidl::endpoints::Proxy for ProvisionerProxy {
185    type Protocol = ProvisionerMarker;
186
187    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
188        Self::new(inner)
189    }
190
191    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
192        self.client.into_channel().map_err(|client| Self { client })
193    }
194
195    fn as_channel(&self) -> &::fidl::AsyncChannel {
196        self.client.as_channel()
197    }
198}
199
200impl ProvisionerProxy {
201    /// Create a new Proxy for fuchsia.tracing.controller/Provisioner.
202    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
203        let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
204        Self { client: fidl::client::Client::new(channel, protocol_name) }
205    }
206
207    /// Get a Stream of events from the remote end of the protocol.
208    ///
209    /// # Panics
210    ///
211    /// Panics if the event stream was already taken.
212    pub fn take_event_stream(&self) -> ProvisionerEventStream {
213        ProvisionerEventStream { event_receiver: self.client.take_event_receiver() }
214    }
215
216    /// Requests to initialize tracing with the specified `config`.
217    ///
218    /// A bad request will terminate the connection.
219    ///
220    /// Dropping the socket connection will abort and terminate the
221    /// existing trace Session.
222    ///
223    /// The trace controller emits trace data to `output` as a sequence of
224    /// binary formatted trace records.  Traces obtained from different providers
225    /// are delimited by metadata records within the stream.
226    pub fn r#initialize_tracing(
227        &self,
228        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
229        mut config: &TraceConfig,
230        mut output: fidl::Socket,
231    ) -> Result<(), fidl::Error> {
232        ProvisionerProxyInterface::r#initialize_tracing(self, controller, config, output)
233    }
234
235    /// Return the set of registered providers.
236    pub fn r#get_providers(
237        &self,
238    ) -> fidl::client::QueryResponseFut<
239        Vec<ProviderInfo>,
240        fidl::encoding::DefaultFuchsiaResourceDialect,
241    > {
242        ProvisionerProxyInterface::r#get_providers(self)
243    }
244
245    pub fn r#get_known_categories(
246        &self,
247    ) -> fidl::client::QueryResponseFut<
248        Vec<fidl_fuchsia_tracing::KnownCategory>,
249        fidl::encoding::DefaultFuchsiaResourceDialect,
250    > {
251        ProvisionerProxyInterface::r#get_known_categories(self)
252    }
253}
254
255impl ProvisionerProxyInterface for ProvisionerProxy {
256    fn r#initialize_tracing(
257        &self,
258        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
259        mut config: &TraceConfig,
260        mut output: fidl::Socket,
261    ) -> Result<(), fidl::Error> {
262        self.client.send::<ProvisionerInitializeTracingRequest>(
263            (controller, config, output),
264            0x3b046ed3a0684ab8,
265            fidl::encoding::DynamicFlags::FLEXIBLE,
266        )
267    }
268
269    type GetProvidersResponseFut = fidl::client::QueryResponseFut<
270        Vec<ProviderInfo>,
271        fidl::encoding::DefaultFuchsiaResourceDialect,
272    >;
273    fn r#get_providers(&self) -> Self::GetProvidersResponseFut {
274        fn _decode(
275            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
276        ) -> Result<Vec<ProviderInfo>, fidl::Error> {
277            let _response = fidl::client::decode_transaction_body::<
278                fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
279                fidl::encoding::DefaultFuchsiaResourceDialect,
280                0xc4d4f36edc50d43,
281            >(_buf?)?
282            .into_result::<ProvisionerMarker>("get_providers")?;
283            Ok(_response.providers)
284        }
285        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ProviderInfo>>(
286            (),
287            0xc4d4f36edc50d43,
288            fidl::encoding::DynamicFlags::FLEXIBLE,
289            _decode,
290        )
291    }
292
293    type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
294        Vec<fidl_fuchsia_tracing::KnownCategory>,
295        fidl::encoding::DefaultFuchsiaResourceDialect,
296    >;
297    fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
298        fn _decode(
299            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
300        ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
301            let _response = fidl::client::decode_transaction_body::<
302                fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
303                fidl::encoding::DefaultFuchsiaResourceDialect,
304                0x41ef99397b945a4,
305            >(_buf?)?
306            .into_result::<ProvisionerMarker>("get_known_categories")?;
307            Ok(_response.categories)
308        }
309        self.client.send_query_and_decode::<
310            fidl::encoding::EmptyPayload,
311            Vec<fidl_fuchsia_tracing::KnownCategory>,
312        >(
313            (),
314            0x41ef99397b945a4,
315            fidl::encoding::DynamicFlags::FLEXIBLE,
316            _decode,
317        )
318    }
319}
320
321pub struct ProvisionerEventStream {
322    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
323}
324
325impl std::marker::Unpin for ProvisionerEventStream {}
326
327impl futures::stream::FusedStream for ProvisionerEventStream {
328    fn is_terminated(&self) -> bool {
329        self.event_receiver.is_terminated()
330    }
331}
332
333impl futures::Stream for ProvisionerEventStream {
334    type Item = Result<ProvisionerEvent, fidl::Error>;
335
336    fn poll_next(
337        mut self: std::pin::Pin<&mut Self>,
338        cx: &mut std::task::Context<'_>,
339    ) -> std::task::Poll<Option<Self::Item>> {
340        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
341            &mut self.event_receiver,
342            cx
343        )?) {
344            Some(buf) => std::task::Poll::Ready(Some(ProvisionerEvent::decode(buf))),
345            None => std::task::Poll::Ready(None),
346        }
347    }
348}
349
350#[derive(Debug)]
351pub enum ProvisionerEvent {
352    #[non_exhaustive]
353    _UnknownEvent {
354        /// Ordinal of the event that was sent.
355        ordinal: u64,
356    },
357}
358
359impl ProvisionerEvent {
360    /// Decodes a message buffer as a [`ProvisionerEvent`].
361    fn decode(
362        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
363    ) -> Result<ProvisionerEvent, fidl::Error> {
364        let (bytes, _handles) = buf.split_mut();
365        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
366        debug_assert_eq!(tx_header.tx_id, 0);
367        match tx_header.ordinal {
368            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
369                Ok(ProvisionerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
370            }
371            _ => Err(fidl::Error::UnknownOrdinal {
372                ordinal: tx_header.ordinal,
373                protocol_name: <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
374            }),
375        }
376    }
377}
378
379/// A Stream of incoming requests for fuchsia.tracing.controller/Provisioner.
380pub struct ProvisionerRequestStream {
381    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
382    is_terminated: bool,
383}
384
385impl std::marker::Unpin for ProvisionerRequestStream {}
386
387impl futures::stream::FusedStream for ProvisionerRequestStream {
388    fn is_terminated(&self) -> bool {
389        self.is_terminated
390    }
391}
392
393impl fidl::endpoints::RequestStream for ProvisionerRequestStream {
394    type Protocol = ProvisionerMarker;
395    type ControlHandle = ProvisionerControlHandle;
396
397    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
398        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
399    }
400
401    fn control_handle(&self) -> Self::ControlHandle {
402        ProvisionerControlHandle { inner: self.inner.clone() }
403    }
404
405    fn into_inner(
406        self,
407    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
408    {
409        (self.inner, self.is_terminated)
410    }
411
412    fn from_inner(
413        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
414        is_terminated: bool,
415    ) -> Self {
416        Self { inner, is_terminated }
417    }
418}
419
420impl futures::Stream for ProvisionerRequestStream {
421    type Item = Result<ProvisionerRequest, fidl::Error>;
422
423    fn poll_next(
424        mut self: std::pin::Pin<&mut Self>,
425        cx: &mut std::task::Context<'_>,
426    ) -> std::task::Poll<Option<Self::Item>> {
427        let this = &mut *self;
428        if this.inner.check_shutdown(cx) {
429            this.is_terminated = true;
430            return std::task::Poll::Ready(None);
431        }
432        if this.is_terminated {
433            panic!("polled ProvisionerRequestStream after completion");
434        }
435        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
436            |bytes, handles| {
437                match this.inner.channel().read_etc(cx, bytes, handles) {
438                    std::task::Poll::Ready(Ok(())) => {}
439                    std::task::Poll::Pending => return std::task::Poll::Pending,
440                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
441                        this.is_terminated = true;
442                        return std::task::Poll::Ready(None);
443                    }
444                    std::task::Poll::Ready(Err(e)) => {
445                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
446                            e.into(),
447                        ))))
448                    }
449                }
450
451                // A message has been received from the channel
452                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
453
454                std::task::Poll::Ready(Some(match header.ordinal {
455                    0x3b046ed3a0684ab8 => {
456                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
457                        let mut req = fidl::new_empty!(
458                            ProvisionerInitializeTracingRequest,
459                            fidl::encoding::DefaultFuchsiaResourceDialect
460                        );
461                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProvisionerInitializeTracingRequest>(&header, _body_bytes, handles, &mut req)?;
462                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
463                        Ok(ProvisionerRequest::InitializeTracing {
464                            controller: req.controller,
465                            config: req.config,
466                            output: req.output,
467
468                            control_handle,
469                        })
470                    }
471                    0xc4d4f36edc50d43 => {
472                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
473                        let mut req = fidl::new_empty!(
474                            fidl::encoding::EmptyPayload,
475                            fidl::encoding::DefaultFuchsiaResourceDialect
476                        );
477                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
478                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
479                        Ok(ProvisionerRequest::GetProviders {
480                            responder: ProvisionerGetProvidersResponder {
481                                control_handle: std::mem::ManuallyDrop::new(control_handle),
482                                tx_id: header.tx_id,
483                            },
484                        })
485                    }
486                    0x41ef99397b945a4 => {
487                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
488                        let mut req = fidl::new_empty!(
489                            fidl::encoding::EmptyPayload,
490                            fidl::encoding::DefaultFuchsiaResourceDialect
491                        );
492                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
493                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
494                        Ok(ProvisionerRequest::GetKnownCategories {
495                            responder: ProvisionerGetKnownCategoriesResponder {
496                                control_handle: std::mem::ManuallyDrop::new(control_handle),
497                                tx_id: header.tx_id,
498                            },
499                        })
500                    }
501                    _ if header.tx_id == 0
502                        && header
503                            .dynamic_flags()
504                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
505                    {
506                        Ok(ProvisionerRequest::_UnknownMethod {
507                            ordinal: header.ordinal,
508                            control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
509                            method_type: fidl::MethodType::OneWay,
510                        })
511                    }
512                    _ if header
513                        .dynamic_flags()
514                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
515                    {
516                        this.inner.send_framework_err(
517                            fidl::encoding::FrameworkErr::UnknownMethod,
518                            header.tx_id,
519                            header.ordinal,
520                            header.dynamic_flags(),
521                            (bytes, handles),
522                        )?;
523                        Ok(ProvisionerRequest::_UnknownMethod {
524                            ordinal: header.ordinal,
525                            control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
526                            method_type: fidl::MethodType::TwoWay,
527                        })
528                    }
529                    _ => Err(fidl::Error::UnknownOrdinal {
530                        ordinal: header.ordinal,
531                        protocol_name:
532                            <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
533                    }),
534                }))
535            },
536        )
537    }
538}
539
540/// The provisioner interface used to initialize a trace Session, that can
541/// then be started and stopped.
542///
543/// The provisioner is required to start a trace Session and bind the control
544/// to the client. It can also perform tasks like getting the list of registered
545/// providers and known categories, which can be performed without a existing
546/// trace Session.
547#[derive(Debug)]
548pub enum ProvisionerRequest {
549    /// Requests to initialize tracing with the specified `config`.
550    ///
551    /// A bad request will terminate the connection.
552    ///
553    /// Dropping the socket connection will abort and terminate the
554    /// existing trace Session.
555    ///
556    /// The trace controller emits trace data to `output` as a sequence of
557    /// binary formatted trace records.  Traces obtained from different providers
558    /// are delimited by metadata records within the stream.
559    InitializeTracing {
560        controller: fidl::endpoints::ServerEnd<SessionMarker>,
561        config: TraceConfig,
562        output: fidl::Socket,
563        control_handle: ProvisionerControlHandle,
564    },
565    /// Return the set of registered providers.
566    GetProviders {
567        responder: ProvisionerGetProvidersResponder,
568    },
569    GetKnownCategories {
570        responder: ProvisionerGetKnownCategoriesResponder,
571    },
572    /// An interaction was received which does not match any known method.
573    #[non_exhaustive]
574    _UnknownMethod {
575        /// Ordinal of the method that was called.
576        ordinal: u64,
577        control_handle: ProvisionerControlHandle,
578        method_type: fidl::MethodType,
579    },
580}
581
582impl ProvisionerRequest {
583    #[allow(irrefutable_let_patterns)]
584    pub fn into_initialize_tracing(
585        self,
586    ) -> Option<(
587        fidl::endpoints::ServerEnd<SessionMarker>,
588        TraceConfig,
589        fidl::Socket,
590        ProvisionerControlHandle,
591    )> {
592        if let ProvisionerRequest::InitializeTracing {
593            controller,
594            config,
595            output,
596            control_handle,
597        } = self
598        {
599            Some((controller, config, output, control_handle))
600        } else {
601            None
602        }
603    }
604
605    #[allow(irrefutable_let_patterns)]
606    pub fn into_get_providers(self) -> Option<(ProvisionerGetProvidersResponder)> {
607        if let ProvisionerRequest::GetProviders { responder } = self {
608            Some((responder))
609        } else {
610            None
611        }
612    }
613
614    #[allow(irrefutable_let_patterns)]
615    pub fn into_get_known_categories(self) -> Option<(ProvisionerGetKnownCategoriesResponder)> {
616        if let ProvisionerRequest::GetKnownCategories { responder } = self {
617            Some((responder))
618        } else {
619            None
620        }
621    }
622
623    /// Name of the method defined in FIDL
624    pub fn method_name(&self) -> &'static str {
625        match *self {
626            ProvisionerRequest::InitializeTracing { .. } => "initialize_tracing",
627            ProvisionerRequest::GetProviders { .. } => "get_providers",
628            ProvisionerRequest::GetKnownCategories { .. } => "get_known_categories",
629            ProvisionerRequest::_UnknownMethod {
630                method_type: fidl::MethodType::OneWay, ..
631            } => "unknown one-way method",
632            ProvisionerRequest::_UnknownMethod {
633                method_type: fidl::MethodType::TwoWay, ..
634            } => "unknown two-way method",
635        }
636    }
637}
638
639#[derive(Debug, Clone)]
640pub struct ProvisionerControlHandle {
641    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
642}
643
644impl fidl::endpoints::ControlHandle for ProvisionerControlHandle {
645    fn shutdown(&self) {
646        self.inner.shutdown()
647    }
648    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
649        self.inner.shutdown_with_epitaph(status)
650    }
651
652    fn is_closed(&self) -> bool {
653        self.inner.channel().is_closed()
654    }
655    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
656        self.inner.channel().on_closed()
657    }
658
659    #[cfg(target_os = "fuchsia")]
660    fn signal_peer(
661        &self,
662        clear_mask: zx::Signals,
663        set_mask: zx::Signals,
664    ) -> Result<(), zx_status::Status> {
665        use fidl::Peered;
666        self.inner.channel().signal_peer(clear_mask, set_mask)
667    }
668}
669
670impl ProvisionerControlHandle {}
671
672#[must_use = "FIDL methods require a response to be sent"]
673#[derive(Debug)]
674pub struct ProvisionerGetProvidersResponder {
675    control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
676    tx_id: u32,
677}
678
679/// Set the the channel to be shutdown (see [`ProvisionerControlHandle::shutdown`])
680/// if the responder is dropped without sending a response, so that the client
681/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
682impl std::ops::Drop for ProvisionerGetProvidersResponder {
683    fn drop(&mut self) {
684        self.control_handle.shutdown();
685        // Safety: drops once, never accessed again
686        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
687    }
688}
689
690impl fidl::endpoints::Responder for ProvisionerGetProvidersResponder {
691    type ControlHandle = ProvisionerControlHandle;
692
693    fn control_handle(&self) -> &ProvisionerControlHandle {
694        &self.control_handle
695    }
696
697    fn drop_without_shutdown(mut self) {
698        // Safety: drops once, never accessed again due to mem::forget
699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
700        // Prevent Drop from running (which would shut down the channel)
701        std::mem::forget(self);
702    }
703}
704
705impl ProvisionerGetProvidersResponder {
706    /// Sends a response to the FIDL transaction.
707    ///
708    /// Sets the channel to shutdown if an error occurs.
709    pub fn send(self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
710        let _result = self.send_raw(providers);
711        if _result.is_err() {
712            self.control_handle.shutdown();
713        }
714        self.drop_without_shutdown();
715        _result
716    }
717
718    /// Similar to "send" but does not shutdown the channel if an error occurs.
719    pub fn send_no_shutdown_on_err(
720        self,
721        mut providers: &[ProviderInfo],
722    ) -> Result<(), fidl::Error> {
723        let _result = self.send_raw(providers);
724        self.drop_without_shutdown();
725        _result
726    }
727
728    fn send_raw(&self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
729        self.control_handle
730            .inner
731            .send::<fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>>(
732                fidl::encoding::Flexible::new((providers,)),
733                self.tx_id,
734                0xc4d4f36edc50d43,
735                fidl::encoding::DynamicFlags::FLEXIBLE,
736            )
737    }
738}
739
740#[must_use = "FIDL methods require a response to be sent"]
741#[derive(Debug)]
742pub struct ProvisionerGetKnownCategoriesResponder {
743    control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
744    tx_id: u32,
745}
746
747/// Set the the channel to be shutdown (see [`ProvisionerControlHandle::shutdown`])
748/// if the responder is dropped without sending a response, so that the client
749/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
750impl std::ops::Drop for ProvisionerGetKnownCategoriesResponder {
751    fn drop(&mut self) {
752        self.control_handle.shutdown();
753        // Safety: drops once, never accessed again
754        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
755    }
756}
757
758impl fidl::endpoints::Responder for ProvisionerGetKnownCategoriesResponder {
759    type ControlHandle = ProvisionerControlHandle;
760
761    fn control_handle(&self) -> &ProvisionerControlHandle {
762        &self.control_handle
763    }
764
765    fn drop_without_shutdown(mut self) {
766        // Safety: drops once, never accessed again due to mem::forget
767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
768        // Prevent Drop from running (which would shut down the channel)
769        std::mem::forget(self);
770    }
771}
772
773impl ProvisionerGetKnownCategoriesResponder {
774    /// Sends a response to the FIDL transaction.
775    ///
776    /// Sets the channel to shutdown if an error occurs.
777    pub fn send(
778        self,
779        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
780    ) -> Result<(), fidl::Error> {
781        let _result = self.send_raw(categories);
782        if _result.is_err() {
783            self.control_handle.shutdown();
784        }
785        self.drop_without_shutdown();
786        _result
787    }
788
789    /// Similar to "send" but does not shutdown the channel if an error occurs.
790    pub fn send_no_shutdown_on_err(
791        self,
792        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
793    ) -> Result<(), fidl::Error> {
794        let _result = self.send_raw(categories);
795        self.drop_without_shutdown();
796        _result
797    }
798
799    fn send_raw(
800        &self,
801        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
802    ) -> Result<(), fidl::Error> {
803        self.control_handle
804            .inner
805            .send::<fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>>(
806                fidl::encoding::Flexible::new((categories,)),
807                self.tx_id,
808                0x41ef99397b945a4,
809                fidl::encoding::DynamicFlags::FLEXIBLE,
810            )
811    }
812}
813
814#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
815pub struct SessionMarker;
816
817impl fidl::endpoints::ProtocolMarker for SessionMarker {
818    type Proxy = SessionProxy;
819    type RequestStream = SessionRequestStream;
820    #[cfg(target_os = "fuchsia")]
821    type SynchronousProxy = SessionSynchronousProxy;
822
823    const DEBUG_NAME: &'static str = "(anonymous) Session";
824}
825pub type SessionStartTracingResult = Result<(), StartError>;
826pub type SessionStopTracingResult = Result<StopResult, StopError>;
827
828pub trait SessionProxyInterface: Send + Sync {
829    type StartTracingResponseFut: std::future::Future<Output = Result<SessionStartTracingResult, fidl::Error>>
830        + Send;
831    fn r#start_tracing(&self, payload: &StartOptions) -> Self::StartTracingResponseFut;
832    type StopTracingResponseFut: std::future::Future<Output = Result<SessionStopTracingResult, fidl::Error>>
833        + Send;
834    fn r#stop_tracing(&self, payload: &StopOptions) -> Self::StopTracingResponseFut;
835    type WatchAlertResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
836    fn r#watch_alert(&self) -> Self::WatchAlertResponseFut;
837}
838#[derive(Debug)]
839#[cfg(target_os = "fuchsia")]
840pub struct SessionSynchronousProxy {
841    client: fidl::client::sync::Client,
842}
843
844#[cfg(target_os = "fuchsia")]
845impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
846    type Proxy = SessionProxy;
847    type Protocol = SessionMarker;
848
849    fn from_channel(inner: fidl::Channel) -> Self {
850        Self::new(inner)
851    }
852
853    fn into_channel(self) -> fidl::Channel {
854        self.client.into_channel()
855    }
856
857    fn as_channel(&self) -> &fidl::Channel {
858        self.client.as_channel()
859    }
860}
861
862#[cfg(target_os = "fuchsia")]
863impl SessionSynchronousProxy {
864    pub fn new(channel: fidl::Channel) -> Self {
865        let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
866        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
867    }
868
869    pub fn into_channel(self) -> fidl::Channel {
870        self.client.into_channel()
871    }
872
873    /// Waits until an event arrives and returns it. It is safe for other
874    /// threads to make concurrent requests while waiting for an event.
875    pub fn wait_for_event(
876        &self,
877        deadline: zx::MonotonicInstant,
878    ) -> Result<SessionEvent, fidl::Error> {
879        SessionEvent::decode(self.client.wait_for_event(deadline)?)
880    }
881
882    /// Requests to start tracing with the specified `options`.
883    ///
884    /// If tracing has already started then the request is ignored,
885    /// except to send back an error code.
886    ///
887    /// The trace Session acknowledges the request when all
888    /// registered providers have been started or after
889    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
890    /// One useful reason for the has-started acknowledgement is that the
891    /// trace program can start a program to trace knowing that all the
892    /// providers are started.
893    pub fn r#start_tracing(
894        &self,
895        mut payload: &StartOptions,
896        ___deadline: zx::MonotonicInstant,
897    ) -> Result<SessionStartTracingResult, fidl::Error> {
898        let _response = self.client.send_query::<
899            StartOptions,
900            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
901        >(
902            payload,
903            0xde9b6ccbe936631,
904            fidl::encoding::DynamicFlags::FLEXIBLE,
905            ___deadline,
906        )?
907        .into_result::<SessionMarker>("start_tracing")?;
908        Ok(_response.map(|x| x))
909    }
910
911    /// Requests to stop tracing.
912    ///
913    /// If tracing has already stopped then this does nothing.
914    /// Returning a result lets callers know when it's ok to, for example,
915    /// start tracing again.
916    pub fn r#stop_tracing(
917        &self,
918        mut payload: &StopOptions,
919        ___deadline: zx::MonotonicInstant,
920    ) -> Result<SessionStopTracingResult, fidl::Error> {
921        let _response = self
922            .client
923            .send_query::<StopOptions, fidl::encoding::FlexibleResultType<StopResult, StopError>>(
924                payload,
925                0x50fefc9b3ff9b03a,
926                fidl::encoding::DynamicFlags::FLEXIBLE,
927                ___deadline,
928            )?
929            .into_result::<SessionMarker>("stop_tracing")?;
930        Ok(_response.map(|x| x))
931    }
932
933    /// Returns the next alert when it arrives.
934    ///
935    /// Alerts received by the Session are queued until a WatchAlert
936    /// request is received. Alerts are sent to the caller in the order
937    /// they were received.
938    ///
939    /// WatchAlert requests are also queued until an alert is received
940    /// and the requests are serviced in the order they were received.
941    pub fn r#watch_alert(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
942        let _response = self.client.send_query::<
943            fidl::encoding::EmptyPayload,
944            fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
945        >(
946            (),
947            0x1f1c080716d92276,
948            fidl::encoding::DynamicFlags::FLEXIBLE,
949            ___deadline,
950        )?
951        .into_result::<SessionMarker>("watch_alert")?;
952        Ok(_response.alert_name)
953    }
954}
955
956#[cfg(target_os = "fuchsia")]
957impl From<SessionSynchronousProxy> for zx::Handle {
958    fn from(value: SessionSynchronousProxy) -> Self {
959        value.into_channel().into()
960    }
961}
962
963#[cfg(target_os = "fuchsia")]
964impl From<fidl::Channel> for SessionSynchronousProxy {
965    fn from(value: fidl::Channel) -> Self {
966        Self::new(value)
967    }
968}
969
970#[cfg(target_os = "fuchsia")]
971impl fidl::endpoints::FromClient for SessionSynchronousProxy {
972    type Protocol = SessionMarker;
973
974    fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
975        Self::new(value.into_channel())
976    }
977}
978
979#[derive(Debug, Clone)]
980pub struct SessionProxy {
981    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
982}
983
984impl fidl::endpoints::Proxy for SessionProxy {
985    type Protocol = SessionMarker;
986
987    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
988        Self::new(inner)
989    }
990
991    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
992        self.client.into_channel().map_err(|client| Self { client })
993    }
994
995    fn as_channel(&self) -> &::fidl::AsyncChannel {
996        self.client.as_channel()
997    }
998}
999
1000impl SessionProxy {
1001    /// Create a new Proxy for fuchsia.tracing.controller/Session.
1002    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1003        let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1004        Self { client: fidl::client::Client::new(channel, protocol_name) }
1005    }
1006
1007    /// Get a Stream of events from the remote end of the protocol.
1008    ///
1009    /// # Panics
1010    ///
1011    /// Panics if the event stream was already taken.
1012    pub fn take_event_stream(&self) -> SessionEventStream {
1013        SessionEventStream { event_receiver: self.client.take_event_receiver() }
1014    }
1015
1016    /// Requests to start tracing with the specified `options`.
1017    ///
1018    /// If tracing has already started then the request is ignored,
1019    /// except to send back an error code.
1020    ///
1021    /// The trace Session acknowledges the request when all
1022    /// registered providers have been started or after
1023    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
1024    /// One useful reason for the has-started acknowledgement is that the
1025    /// trace program can start a program to trace knowing that all the
1026    /// providers are started.
1027    pub fn r#start_tracing(
1028        &self,
1029        mut payload: &StartOptions,
1030    ) -> fidl::client::QueryResponseFut<
1031        SessionStartTracingResult,
1032        fidl::encoding::DefaultFuchsiaResourceDialect,
1033    > {
1034        SessionProxyInterface::r#start_tracing(self, payload)
1035    }
1036
1037    /// Requests to stop tracing.
1038    ///
1039    /// If tracing has already stopped then this does nothing.
1040    /// Returning a result lets callers know when it's ok to, for example,
1041    /// start tracing again.
1042    pub fn r#stop_tracing(
1043        &self,
1044        mut payload: &StopOptions,
1045    ) -> fidl::client::QueryResponseFut<
1046        SessionStopTracingResult,
1047        fidl::encoding::DefaultFuchsiaResourceDialect,
1048    > {
1049        SessionProxyInterface::r#stop_tracing(self, payload)
1050    }
1051
1052    /// Returns the next alert when it arrives.
1053    ///
1054    /// Alerts received by the Session are queued until a WatchAlert
1055    /// request is received. Alerts are sent to the caller in the order
1056    /// they were received.
1057    ///
1058    /// WatchAlert requests are also queued until an alert is received
1059    /// and the requests are serviced in the order they were received.
1060    pub fn r#watch_alert(
1061        &self,
1062    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1063        SessionProxyInterface::r#watch_alert(self)
1064    }
1065}
1066
1067impl SessionProxyInterface for SessionProxy {
1068    type StartTracingResponseFut = fidl::client::QueryResponseFut<
1069        SessionStartTracingResult,
1070        fidl::encoding::DefaultFuchsiaResourceDialect,
1071    >;
1072    fn r#start_tracing(&self, mut payload: &StartOptions) -> Self::StartTracingResponseFut {
1073        fn _decode(
1074            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1075        ) -> Result<SessionStartTracingResult, fidl::Error> {
1076            let _response = fidl::client::decode_transaction_body::<
1077                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
1078                fidl::encoding::DefaultFuchsiaResourceDialect,
1079                0xde9b6ccbe936631,
1080            >(_buf?)?
1081            .into_result::<SessionMarker>("start_tracing")?;
1082            Ok(_response.map(|x| x))
1083        }
1084        self.client.send_query_and_decode::<StartOptions, SessionStartTracingResult>(
1085            payload,
1086            0xde9b6ccbe936631,
1087            fidl::encoding::DynamicFlags::FLEXIBLE,
1088            _decode,
1089        )
1090    }
1091
1092    type StopTracingResponseFut = fidl::client::QueryResponseFut<
1093        SessionStopTracingResult,
1094        fidl::encoding::DefaultFuchsiaResourceDialect,
1095    >;
1096    fn r#stop_tracing(&self, mut payload: &StopOptions) -> Self::StopTracingResponseFut {
1097        fn _decode(
1098            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1099        ) -> Result<SessionStopTracingResult, fidl::Error> {
1100            let _response = fidl::client::decode_transaction_body::<
1101                fidl::encoding::FlexibleResultType<StopResult, StopError>,
1102                fidl::encoding::DefaultFuchsiaResourceDialect,
1103                0x50fefc9b3ff9b03a,
1104            >(_buf?)?
1105            .into_result::<SessionMarker>("stop_tracing")?;
1106            Ok(_response.map(|x| x))
1107        }
1108        self.client.send_query_and_decode::<StopOptions, SessionStopTracingResult>(
1109            payload,
1110            0x50fefc9b3ff9b03a,
1111            fidl::encoding::DynamicFlags::FLEXIBLE,
1112            _decode,
1113        )
1114    }
1115
1116    type WatchAlertResponseFut =
1117        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1118    fn r#watch_alert(&self) -> Self::WatchAlertResponseFut {
1119        fn _decode(
1120            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1121        ) -> Result<String, fidl::Error> {
1122            let _response = fidl::client::decode_transaction_body::<
1123                fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
1124                fidl::encoding::DefaultFuchsiaResourceDialect,
1125                0x1f1c080716d92276,
1126            >(_buf?)?
1127            .into_result::<SessionMarker>("watch_alert")?;
1128            Ok(_response.alert_name)
1129        }
1130        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1131            (),
1132            0x1f1c080716d92276,
1133            fidl::encoding::DynamicFlags::FLEXIBLE,
1134            _decode,
1135        )
1136    }
1137}
1138
1139pub struct SessionEventStream {
1140    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1141}
1142
1143impl std::marker::Unpin for SessionEventStream {}
1144
1145impl futures::stream::FusedStream for SessionEventStream {
1146    fn is_terminated(&self) -> bool {
1147        self.event_receiver.is_terminated()
1148    }
1149}
1150
1151impl futures::Stream for SessionEventStream {
1152    type Item = Result<SessionEvent, fidl::Error>;
1153
1154    fn poll_next(
1155        mut self: std::pin::Pin<&mut Self>,
1156        cx: &mut std::task::Context<'_>,
1157    ) -> std::task::Poll<Option<Self::Item>> {
1158        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1159            &mut self.event_receiver,
1160            cx
1161        )?) {
1162            Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
1163            None => std::task::Poll::Ready(None),
1164        }
1165    }
1166}
1167
1168#[derive(Debug)]
1169pub enum SessionEvent {
1170    OnSessionStateChange {
1171        state: SessionState,
1172    },
1173    #[non_exhaustive]
1174    _UnknownEvent {
1175        /// Ordinal of the event that was sent.
1176        ordinal: u64,
1177    },
1178}
1179
1180impl SessionEvent {
1181    #[allow(irrefutable_let_patterns)]
1182    pub fn into_on_session_state_change(self) -> Option<SessionState> {
1183        if let SessionEvent::OnSessionStateChange { state } = self {
1184            Some((state))
1185        } else {
1186            None
1187        }
1188    }
1189
1190    /// Decodes a message buffer as a [`SessionEvent`].
1191    fn decode(
1192        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1193    ) -> Result<SessionEvent, fidl::Error> {
1194        let (bytes, _handles) = buf.split_mut();
1195        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1196        debug_assert_eq!(tx_header.tx_id, 0);
1197        match tx_header.ordinal {
1198            0x7ab1640718b971cd => {
1199                let mut out = fidl::new_empty!(
1200                    SessionOnSessionStateChangeRequest,
1201                    fidl::encoding::DefaultFuchsiaResourceDialect
1202                );
1203                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOnSessionStateChangeRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1204                Ok((SessionEvent::OnSessionStateChange { state: out.state }))
1205            }
1206            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1207                Ok(SessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1208            }
1209            _ => Err(fidl::Error::UnknownOrdinal {
1210                ordinal: tx_header.ordinal,
1211                protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1212            }),
1213        }
1214    }
1215}
1216
1217/// A Stream of incoming requests for fuchsia.tracing.controller/Session.
1218pub struct SessionRequestStream {
1219    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1220    is_terminated: bool,
1221}
1222
1223impl std::marker::Unpin for SessionRequestStream {}
1224
1225impl futures::stream::FusedStream for SessionRequestStream {
1226    fn is_terminated(&self) -> bool {
1227        self.is_terminated
1228    }
1229}
1230
1231impl fidl::endpoints::RequestStream for SessionRequestStream {
1232    type Protocol = SessionMarker;
1233    type ControlHandle = SessionControlHandle;
1234
1235    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1236        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1237    }
1238
1239    fn control_handle(&self) -> Self::ControlHandle {
1240        SessionControlHandle { inner: self.inner.clone() }
1241    }
1242
1243    fn into_inner(
1244        self,
1245    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1246    {
1247        (self.inner, self.is_terminated)
1248    }
1249
1250    fn from_inner(
1251        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1252        is_terminated: bool,
1253    ) -> Self {
1254        Self { inner, is_terminated }
1255    }
1256}
1257
1258impl futures::Stream for SessionRequestStream {
1259    type Item = Result<SessionRequest, fidl::Error>;
1260
1261    fn poll_next(
1262        mut self: std::pin::Pin<&mut Self>,
1263        cx: &mut std::task::Context<'_>,
1264    ) -> std::task::Poll<Option<Self::Item>> {
1265        let this = &mut *self;
1266        if this.inner.check_shutdown(cx) {
1267            this.is_terminated = true;
1268            return std::task::Poll::Ready(None);
1269        }
1270        if this.is_terminated {
1271            panic!("polled SessionRequestStream after completion");
1272        }
1273        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1274            |bytes, handles| {
1275                match this.inner.channel().read_etc(cx, bytes, handles) {
1276                    std::task::Poll::Ready(Ok(())) => {}
1277                    std::task::Poll::Pending => return std::task::Poll::Pending,
1278                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1279                        this.is_terminated = true;
1280                        return std::task::Poll::Ready(None);
1281                    }
1282                    std::task::Poll::Ready(Err(e)) => {
1283                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1284                            e.into(),
1285                        ))))
1286                    }
1287                }
1288
1289                // A message has been received from the channel
1290                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1291
1292                std::task::Poll::Ready(Some(match header.ordinal {
1293                    0xde9b6ccbe936631 => {
1294                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1295                        let mut req = fidl::new_empty!(
1296                            StartOptions,
1297                            fidl::encoding::DefaultFuchsiaResourceDialect
1298                        );
1299                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StartOptions>(&header, _body_bytes, handles, &mut req)?;
1300                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1301                        Ok(SessionRequest::StartTracing {
1302                            payload: req,
1303                            responder: SessionStartTracingResponder {
1304                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1305                                tx_id: header.tx_id,
1306                            },
1307                        })
1308                    }
1309                    0x50fefc9b3ff9b03a => {
1310                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1311                        let mut req = fidl::new_empty!(
1312                            StopOptions,
1313                            fidl::encoding::DefaultFuchsiaResourceDialect
1314                        );
1315                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StopOptions>(&header, _body_bytes, handles, &mut req)?;
1316                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1317                        Ok(SessionRequest::StopTracing {
1318                            payload: req,
1319                            responder: SessionStopTracingResponder {
1320                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1321                                tx_id: header.tx_id,
1322                            },
1323                        })
1324                    }
1325                    0x1f1c080716d92276 => {
1326                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1327                        let mut req = fidl::new_empty!(
1328                            fidl::encoding::EmptyPayload,
1329                            fidl::encoding::DefaultFuchsiaResourceDialect
1330                        );
1331                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1332                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1333                        Ok(SessionRequest::WatchAlert {
1334                            responder: SessionWatchAlertResponder {
1335                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1336                                tx_id: header.tx_id,
1337                            },
1338                        })
1339                    }
1340                    _ if header.tx_id == 0
1341                        && header
1342                            .dynamic_flags()
1343                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1344                    {
1345                        Ok(SessionRequest::_UnknownMethod {
1346                            ordinal: header.ordinal,
1347                            control_handle: SessionControlHandle { inner: this.inner.clone() },
1348                            method_type: fidl::MethodType::OneWay,
1349                        })
1350                    }
1351                    _ if header
1352                        .dynamic_flags()
1353                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1354                    {
1355                        this.inner.send_framework_err(
1356                            fidl::encoding::FrameworkErr::UnknownMethod,
1357                            header.tx_id,
1358                            header.ordinal,
1359                            header.dynamic_flags(),
1360                            (bytes, handles),
1361                        )?;
1362                        Ok(SessionRequest::_UnknownMethod {
1363                            ordinal: header.ordinal,
1364                            control_handle: SessionControlHandle { inner: this.inner.clone() },
1365                            method_type: fidl::MethodType::TwoWay,
1366                        })
1367                    }
1368                    _ => Err(fidl::Error::UnknownOrdinal {
1369                        ordinal: header.ordinal,
1370                        protocol_name:
1371                            <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1372                    }),
1373                }))
1374            },
1375        )
1376    }
1377}
1378
1379/// The session interface used by the trace tool to start/stop/terminate a trace Session.
1380///
1381/// The trace Session may lightly validate the structure of
1382/// trace records as it copies them from trace buffers into the output.
1383/// In particular, it may verify the size of each record header to ensure
1384/// that the framing of trace records in the data stream is maintained.
1385///
1386/// The trace Session does not validate the contents of the trace records
1387/// themselves.  For example, it does not try to check argument lengths in
1388/// events.  This ensures that the trace format can be extended without needing
1389/// to modify the trace Session.
1390///
1391/// The trace Session must be initialized from the provisioner. It can then be
1392/// used to start/stop tracing as many times as needed. Dropping the Session
1393/// will terminate tracing.
1394#[derive(Debug)]
1395pub enum SessionRequest {
1396    /// Requests to start tracing with the specified `options`.
1397    ///
1398    /// If tracing has already started then the request is ignored,
1399    /// except to send back an error code.
1400    ///
1401    /// The trace Session acknowledges the request when all
1402    /// registered providers have been started or after
1403    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
1404    /// One useful reason for the has-started acknowledgement is that the
1405    /// trace program can start a program to trace knowing that all the
1406    /// providers are started.
1407    StartTracing { payload: StartOptions, responder: SessionStartTracingResponder },
1408    /// Requests to stop tracing.
1409    ///
1410    /// If tracing has already stopped then this does nothing.
1411    /// Returning a result lets callers know when it's ok to, for example,
1412    /// start tracing again.
1413    StopTracing { payload: StopOptions, responder: SessionStopTracingResponder },
1414    /// Returns the next alert when it arrives.
1415    ///
1416    /// Alerts received by the Session are queued until a WatchAlert
1417    /// request is received. Alerts are sent to the caller in the order
1418    /// they were received.
1419    ///
1420    /// WatchAlert requests are also queued until an alert is received
1421    /// and the requests are serviced in the order they were received.
1422    WatchAlert { responder: SessionWatchAlertResponder },
1423    /// An interaction was received which does not match any known method.
1424    #[non_exhaustive]
1425    _UnknownMethod {
1426        /// Ordinal of the method that was called.
1427        ordinal: u64,
1428        control_handle: SessionControlHandle,
1429        method_type: fidl::MethodType,
1430    },
1431}
1432
1433impl SessionRequest {
1434    #[allow(irrefutable_let_patterns)]
1435    pub fn into_start_tracing(self) -> Option<(StartOptions, SessionStartTracingResponder)> {
1436        if let SessionRequest::StartTracing { payload, responder } = self {
1437            Some((payload, responder))
1438        } else {
1439            None
1440        }
1441    }
1442
1443    #[allow(irrefutable_let_patterns)]
1444    pub fn into_stop_tracing(self) -> Option<(StopOptions, SessionStopTracingResponder)> {
1445        if let SessionRequest::StopTracing { payload, responder } = self {
1446            Some((payload, responder))
1447        } else {
1448            None
1449        }
1450    }
1451
1452    #[allow(irrefutable_let_patterns)]
1453    pub fn into_watch_alert(self) -> Option<(SessionWatchAlertResponder)> {
1454        if let SessionRequest::WatchAlert { responder } = self {
1455            Some((responder))
1456        } else {
1457            None
1458        }
1459    }
1460
1461    /// Name of the method defined in FIDL
1462    pub fn method_name(&self) -> &'static str {
1463        match *self {
1464            SessionRequest::StartTracing { .. } => "start_tracing",
1465            SessionRequest::StopTracing { .. } => "stop_tracing",
1466            SessionRequest::WatchAlert { .. } => "watch_alert",
1467            SessionRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1468                "unknown one-way method"
1469            }
1470            SessionRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1471                "unknown two-way method"
1472            }
1473        }
1474    }
1475}
1476
1477#[derive(Debug, Clone)]
1478pub struct SessionControlHandle {
1479    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1480}
1481
1482impl fidl::endpoints::ControlHandle for SessionControlHandle {
1483    fn shutdown(&self) {
1484        self.inner.shutdown()
1485    }
1486    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1487        self.inner.shutdown_with_epitaph(status)
1488    }
1489
1490    fn is_closed(&self) -> bool {
1491        self.inner.channel().is_closed()
1492    }
1493    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1494        self.inner.channel().on_closed()
1495    }
1496
1497    #[cfg(target_os = "fuchsia")]
1498    fn signal_peer(
1499        &self,
1500        clear_mask: zx::Signals,
1501        set_mask: zx::Signals,
1502    ) -> Result<(), zx_status::Status> {
1503        use fidl::Peered;
1504        self.inner.channel().signal_peer(clear_mask, set_mask)
1505    }
1506}
1507
1508impl SessionControlHandle {
1509    pub fn send_on_session_state_change(&self, mut state: SessionState) -> Result<(), fidl::Error> {
1510        self.inner.send::<SessionOnSessionStateChangeRequest>(
1511            (state,),
1512            0,
1513            0x7ab1640718b971cd,
1514            fidl::encoding::DynamicFlags::FLEXIBLE,
1515        )
1516    }
1517}
1518
1519#[must_use = "FIDL methods require a response to be sent"]
1520#[derive(Debug)]
1521pub struct SessionStartTracingResponder {
1522    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1523    tx_id: u32,
1524}
1525
1526/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1527/// if the responder is dropped without sending a response, so that the client
1528/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1529impl std::ops::Drop for SessionStartTracingResponder {
1530    fn drop(&mut self) {
1531        self.control_handle.shutdown();
1532        // Safety: drops once, never accessed again
1533        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1534    }
1535}
1536
1537impl fidl::endpoints::Responder for SessionStartTracingResponder {
1538    type ControlHandle = SessionControlHandle;
1539
1540    fn control_handle(&self) -> &SessionControlHandle {
1541        &self.control_handle
1542    }
1543
1544    fn drop_without_shutdown(mut self) {
1545        // Safety: drops once, never accessed again due to mem::forget
1546        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1547        // Prevent Drop from running (which would shut down the channel)
1548        std::mem::forget(self);
1549    }
1550}
1551
1552impl SessionStartTracingResponder {
1553    /// Sends a response to the FIDL transaction.
1554    ///
1555    /// Sets the channel to shutdown if an error occurs.
1556    pub fn send(self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1557        let _result = self.send_raw(result);
1558        if _result.is_err() {
1559            self.control_handle.shutdown();
1560        }
1561        self.drop_without_shutdown();
1562        _result
1563    }
1564
1565    /// Similar to "send" but does not shutdown the channel if an error occurs.
1566    pub fn send_no_shutdown_on_err(
1567        self,
1568        mut result: Result<(), StartError>,
1569    ) -> Result<(), fidl::Error> {
1570        let _result = self.send_raw(result);
1571        self.drop_without_shutdown();
1572        _result
1573    }
1574
1575    fn send_raw(&self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1576        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1577            fidl::encoding::EmptyStruct,
1578            StartError,
1579        >>(
1580            fidl::encoding::FlexibleResult::new(result),
1581            self.tx_id,
1582            0xde9b6ccbe936631,
1583            fidl::encoding::DynamicFlags::FLEXIBLE,
1584        )
1585    }
1586}
1587
1588#[must_use = "FIDL methods require a response to be sent"]
1589#[derive(Debug)]
1590pub struct SessionStopTracingResponder {
1591    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1592    tx_id: u32,
1593}
1594
1595/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1596/// if the responder is dropped without sending a response, so that the client
1597/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1598impl std::ops::Drop for SessionStopTracingResponder {
1599    fn drop(&mut self) {
1600        self.control_handle.shutdown();
1601        // Safety: drops once, never accessed again
1602        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1603    }
1604}
1605
1606impl fidl::endpoints::Responder for SessionStopTracingResponder {
1607    type ControlHandle = SessionControlHandle;
1608
1609    fn control_handle(&self) -> &SessionControlHandle {
1610        &self.control_handle
1611    }
1612
1613    fn drop_without_shutdown(mut self) {
1614        // Safety: drops once, never accessed again due to mem::forget
1615        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1616        // Prevent Drop from running (which would shut down the channel)
1617        std::mem::forget(self);
1618    }
1619}
1620
1621impl SessionStopTracingResponder {
1622    /// Sends a response to the FIDL transaction.
1623    ///
1624    /// Sets the channel to shutdown if an error occurs.
1625    pub fn send(self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1626        let _result = self.send_raw(result);
1627        if _result.is_err() {
1628            self.control_handle.shutdown();
1629        }
1630        self.drop_without_shutdown();
1631        _result
1632    }
1633
1634    /// Similar to "send" but does not shutdown the channel if an error occurs.
1635    pub fn send_no_shutdown_on_err(
1636        self,
1637        mut result: Result<&StopResult, StopError>,
1638    ) -> Result<(), fidl::Error> {
1639        let _result = self.send_raw(result);
1640        self.drop_without_shutdown();
1641        _result
1642    }
1643
1644    fn send_raw(&self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1645        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<StopResult, StopError>>(
1646            fidl::encoding::FlexibleResult::new(result),
1647            self.tx_id,
1648            0x50fefc9b3ff9b03a,
1649            fidl::encoding::DynamicFlags::FLEXIBLE,
1650        )
1651    }
1652}
1653
1654#[must_use = "FIDL methods require a response to be sent"]
1655#[derive(Debug)]
1656pub struct SessionWatchAlertResponder {
1657    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1658    tx_id: u32,
1659}
1660
1661/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1662/// if the responder is dropped without sending a response, so that the client
1663/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1664impl std::ops::Drop for SessionWatchAlertResponder {
1665    fn drop(&mut self) {
1666        self.control_handle.shutdown();
1667        // Safety: drops once, never accessed again
1668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1669    }
1670}
1671
1672impl fidl::endpoints::Responder for SessionWatchAlertResponder {
1673    type ControlHandle = SessionControlHandle;
1674
1675    fn control_handle(&self) -> &SessionControlHandle {
1676        &self.control_handle
1677    }
1678
1679    fn drop_without_shutdown(mut self) {
1680        // Safety: drops once, never accessed again due to mem::forget
1681        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1682        // Prevent Drop from running (which would shut down the channel)
1683        std::mem::forget(self);
1684    }
1685}
1686
1687impl SessionWatchAlertResponder {
1688    /// Sends a response to the FIDL transaction.
1689    ///
1690    /// Sets the channel to shutdown if an error occurs.
1691    pub fn send(self, mut alert_name: &str) -> Result<(), fidl::Error> {
1692        let _result = self.send_raw(alert_name);
1693        if _result.is_err() {
1694            self.control_handle.shutdown();
1695        }
1696        self.drop_without_shutdown();
1697        _result
1698    }
1699
1700    /// Similar to "send" but does not shutdown the channel if an error occurs.
1701    pub fn send_no_shutdown_on_err(self, mut alert_name: &str) -> Result<(), fidl::Error> {
1702        let _result = self.send_raw(alert_name);
1703        self.drop_without_shutdown();
1704        _result
1705    }
1706
1707    fn send_raw(&self, mut alert_name: &str) -> Result<(), fidl::Error> {
1708        self.control_handle.inner.send::<fidl::encoding::FlexibleType<SessionWatchAlertResponse>>(
1709            fidl::encoding::Flexible::new((alert_name,)),
1710            self.tx_id,
1711            0x1f1c080716d92276,
1712            fidl::encoding::DynamicFlags::FLEXIBLE,
1713        )
1714    }
1715}
1716
1717mod internal {
1718    use super::*;
1719
1720    impl fidl::encoding::ResourceTypeMarker for ProvisionerInitializeTracingRequest {
1721        type Borrowed<'a> = &'a mut Self;
1722        fn take_or_borrow<'a>(
1723            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1724        ) -> Self::Borrowed<'a> {
1725            value
1726        }
1727    }
1728
1729    unsafe impl fidl::encoding::TypeMarker for ProvisionerInitializeTracingRequest {
1730        type Owned = Self;
1731
1732        #[inline(always)]
1733        fn inline_align(_context: fidl::encoding::Context) -> usize {
1734            8
1735        }
1736
1737        #[inline(always)]
1738        fn inline_size(_context: fidl::encoding::Context) -> usize {
1739            32
1740        }
1741    }
1742
1743    unsafe impl
1744        fidl::encoding::Encode<
1745            ProvisionerInitializeTracingRequest,
1746            fidl::encoding::DefaultFuchsiaResourceDialect,
1747        > for &mut ProvisionerInitializeTracingRequest
1748    {
1749        #[inline]
1750        unsafe fn encode(
1751            self,
1752            encoder: &mut fidl::encoding::Encoder<
1753                '_,
1754                fidl::encoding::DefaultFuchsiaResourceDialect,
1755            >,
1756            offset: usize,
1757            _depth: fidl::encoding::Depth,
1758        ) -> fidl::Result<()> {
1759            encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
1760            // Delegate to tuple encoding.
1761            fidl::encoding::Encode::<ProvisionerInitializeTracingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1762                (
1763                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
1764                    <TraceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1765                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.output),
1766                ),
1767                encoder, offset, _depth
1768            )
1769        }
1770    }
1771    unsafe impl<
1772            T0: fidl::encoding::Encode<
1773                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
1774                fidl::encoding::DefaultFuchsiaResourceDialect,
1775            >,
1776            T1: fidl::encoding::Encode<TraceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
1777            T2: fidl::encoding::Encode<
1778                fidl::encoding::HandleType<
1779                    fidl::Socket,
1780                    { fidl::ObjectType::SOCKET.into_raw() },
1781                    16392,
1782                >,
1783                fidl::encoding::DefaultFuchsiaResourceDialect,
1784            >,
1785        >
1786        fidl::encoding::Encode<
1787            ProvisionerInitializeTracingRequest,
1788            fidl::encoding::DefaultFuchsiaResourceDialect,
1789        > for (T0, T1, T2)
1790    {
1791        #[inline]
1792        unsafe fn encode(
1793            self,
1794            encoder: &mut fidl::encoding::Encoder<
1795                '_,
1796                fidl::encoding::DefaultFuchsiaResourceDialect,
1797            >,
1798            offset: usize,
1799            depth: fidl::encoding::Depth,
1800        ) -> fidl::Result<()> {
1801            encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
1802            // Zero out padding regions. There's no need to apply masks
1803            // because the unmasked parts will be overwritten by fields.
1804            unsafe {
1805                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1806                (ptr as *mut u64).write_unaligned(0);
1807            }
1808            unsafe {
1809                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
1810                (ptr as *mut u64).write_unaligned(0);
1811            }
1812            // Write the fields.
1813            self.0.encode(encoder, offset + 0, depth)?;
1814            self.1.encode(encoder, offset + 8, depth)?;
1815            self.2.encode(encoder, offset + 24, depth)?;
1816            Ok(())
1817        }
1818    }
1819
1820    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1821        for ProvisionerInitializeTracingRequest
1822    {
1823        #[inline(always)]
1824        fn new_empty() -> Self {
1825            Self {
1826                controller: fidl::new_empty!(
1827                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
1828                    fidl::encoding::DefaultFuchsiaResourceDialect
1829                ),
1830                config: fidl::new_empty!(
1831                    TraceConfig,
1832                    fidl::encoding::DefaultFuchsiaResourceDialect
1833                ),
1834                output: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
1835            }
1836        }
1837
1838        #[inline]
1839        unsafe fn decode(
1840            &mut self,
1841            decoder: &mut fidl::encoding::Decoder<
1842                '_,
1843                fidl::encoding::DefaultFuchsiaResourceDialect,
1844            >,
1845            offset: usize,
1846            _depth: fidl::encoding::Depth,
1847        ) -> fidl::Result<()> {
1848            decoder.debug_check_bounds::<Self>(offset);
1849            // Verify that padding bytes are zero.
1850            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1851            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1852            let mask = 0xffffffff00000000u64;
1853            let maskedval = padval & mask;
1854            if maskedval != 0 {
1855                return Err(fidl::Error::NonZeroPadding {
1856                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1857                });
1858            }
1859            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1860            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1861            let mask = 0xffffffff00000000u64;
1862            let maskedval = padval & mask;
1863            if maskedval != 0 {
1864                return Err(fidl::Error::NonZeroPadding {
1865                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1866                });
1867            }
1868            fidl::decode!(
1869                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
1870                fidl::encoding::DefaultFuchsiaResourceDialect,
1871                &mut self.controller,
1872                decoder,
1873                offset + 0,
1874                _depth
1875            )?;
1876            fidl::decode!(
1877                TraceConfig,
1878                fidl::encoding::DefaultFuchsiaResourceDialect,
1879                &mut self.config,
1880                decoder,
1881                offset + 8,
1882                _depth
1883            )?;
1884            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.output, decoder, offset + 24, _depth)?;
1885            Ok(())
1886        }
1887    }
1888}