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