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