Skip to main content

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