Skip to main content

fidl_fuchsia_memory_stacktrack_client/
fidl_fuchsia_memory_stacktrack_client.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_memory_stacktrack_client__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct CollectorGetStackTracesRequest {
16    /// The process to gather data about.
17    ///
18    /// If not set, any process will be considered a match.
19    pub process_selector: Option<ProcessSelector>,
20    /// The receiver that will accept the stack traces.
21    ///
22    /// Required.
23    pub receiver: Option<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>,
24    #[doc(hidden)]
25    pub __source_breaking: fidl::marker::SourceBreaking,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
29    for CollectorGetStackTracesRequest
30{
31}
32
33#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
34pub struct CollectorMarker;
35
36impl fidl::endpoints::ProtocolMarker for CollectorMarker {
37    type Proxy = CollectorProxy;
38    type RequestStream = CollectorRequestStream;
39    #[cfg(target_os = "fuchsia")]
40    type SynchronousProxy = CollectorSynchronousProxy;
41
42    const DEBUG_NAME: &'static str = "fuchsia.memory.stacktrack.client.Collector";
43}
44impl fidl::endpoints::DiscoverableProtocolMarker for CollectorMarker {}
45
46pub trait CollectorProxyInterface: Send + Sync {
47    fn r#get_stack_traces(
48        &self,
49        payload: CollectorGetStackTracesRequest,
50    ) -> Result<(), fidl::Error>;
51}
52#[derive(Debug)]
53#[cfg(target_os = "fuchsia")]
54pub struct CollectorSynchronousProxy {
55    client: fidl::client::sync::Client,
56}
57
58#[cfg(target_os = "fuchsia")]
59impl fidl::endpoints::SynchronousProxy for CollectorSynchronousProxy {
60    type Proxy = CollectorProxy;
61    type Protocol = CollectorMarker;
62
63    fn from_channel(inner: fidl::Channel) -> Self {
64        Self::new(inner)
65    }
66
67    fn into_channel(self) -> fidl::Channel {
68        self.client.into_channel()
69    }
70
71    fn as_channel(&self) -> &fidl::Channel {
72        self.client.as_channel()
73    }
74}
75
76#[cfg(target_os = "fuchsia")]
77impl CollectorSynchronousProxy {
78    pub fn new(channel: fidl::Channel) -> Self {
79        Self { client: fidl::client::sync::Client::new(channel) }
80    }
81
82    pub fn into_channel(self) -> fidl::Channel {
83        self.client.into_channel()
84    }
85
86    /// Waits until an event arrives and returns it. It is safe for other
87    /// threads to make concurrent requests while waiting for an event.
88    pub fn wait_for_event(
89        &self,
90        deadline: zx::MonotonicInstant,
91    ) -> Result<CollectorEvent, fidl::Error> {
92        CollectorEvent::decode(self.client.wait_for_event::<CollectorMarker>(deadline)?)
93    }
94
95    /// Returns stack traces for the specified process.
96    pub fn r#get_stack_traces(
97        &self,
98        mut payload: CollectorGetStackTracesRequest,
99    ) -> Result<(), fidl::Error> {
100        self.client.send::<CollectorGetStackTracesRequest>(
101            &mut payload,
102            0x1f23d82090761a91,
103            fidl::encoding::DynamicFlags::FLEXIBLE,
104        )
105    }
106}
107
108#[cfg(target_os = "fuchsia")]
109impl From<CollectorSynchronousProxy> for zx::NullableHandle {
110    fn from(value: CollectorSynchronousProxy) -> Self {
111        value.into_channel().into()
112    }
113}
114
115#[cfg(target_os = "fuchsia")]
116impl From<fidl::Channel> for CollectorSynchronousProxy {
117    fn from(value: fidl::Channel) -> Self {
118        Self::new(value)
119    }
120}
121
122#[cfg(target_os = "fuchsia")]
123impl fidl::endpoints::FromClient for CollectorSynchronousProxy {
124    type Protocol = CollectorMarker;
125
126    fn from_client(value: fidl::endpoints::ClientEnd<CollectorMarker>) -> Self {
127        Self::new(value.into_channel())
128    }
129}
130
131#[derive(Debug, Clone)]
132pub struct CollectorProxy {
133    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
134}
135
136impl fidl::endpoints::Proxy for CollectorProxy {
137    type Protocol = CollectorMarker;
138
139    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
140        Self::new(inner)
141    }
142
143    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
144        self.client.into_channel().map_err(|client| Self { client })
145    }
146
147    fn as_channel(&self) -> &::fidl::AsyncChannel {
148        self.client.as_channel()
149    }
150}
151
152impl CollectorProxy {
153    /// Create a new Proxy for fuchsia.memory.stacktrack.client/Collector.
154    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
155        let protocol_name = <CollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156        Self { client: fidl::client::Client::new(channel, protocol_name) }
157    }
158
159    /// Get a Stream of events from the remote end of the protocol.
160    ///
161    /// # Panics
162    ///
163    /// Panics if the event stream was already taken.
164    pub fn take_event_stream(&self) -> CollectorEventStream {
165        CollectorEventStream { event_receiver: self.client.take_event_receiver() }
166    }
167
168    /// Returns stack traces for the specified process.
169    pub fn r#get_stack_traces(
170        &self,
171        mut payload: CollectorGetStackTracesRequest,
172    ) -> Result<(), fidl::Error> {
173        CollectorProxyInterface::r#get_stack_traces(self, payload)
174    }
175}
176
177impl CollectorProxyInterface for CollectorProxy {
178    fn r#get_stack_traces(
179        &self,
180        mut payload: CollectorGetStackTracesRequest,
181    ) -> Result<(), fidl::Error> {
182        self.client.send::<CollectorGetStackTracesRequest>(
183            &mut payload,
184            0x1f23d82090761a91,
185            fidl::encoding::DynamicFlags::FLEXIBLE,
186        )
187    }
188}
189
190pub struct CollectorEventStream {
191    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
192}
193
194impl std::marker::Unpin for CollectorEventStream {}
195
196impl futures::stream::FusedStream for CollectorEventStream {
197    fn is_terminated(&self) -> bool {
198        self.event_receiver.is_terminated()
199    }
200}
201
202impl futures::Stream for CollectorEventStream {
203    type Item = Result<CollectorEvent, fidl::Error>;
204
205    fn poll_next(
206        mut self: std::pin::Pin<&mut Self>,
207        cx: &mut std::task::Context<'_>,
208    ) -> std::task::Poll<Option<Self::Item>> {
209        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
210            &mut self.event_receiver,
211            cx
212        )?) {
213            Some(buf) => std::task::Poll::Ready(Some(CollectorEvent::decode(buf))),
214            None => std::task::Poll::Ready(None),
215        }
216    }
217}
218
219#[derive(Debug)]
220pub enum CollectorEvent {
221    #[non_exhaustive]
222    _UnknownEvent {
223        /// Ordinal of the event that was sent.
224        ordinal: u64,
225    },
226}
227
228impl CollectorEvent {
229    /// Decodes a message buffer as a [`CollectorEvent`].
230    fn decode(
231        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
232    ) -> Result<CollectorEvent, fidl::Error> {
233        let (bytes, _handles) = buf.split_mut();
234        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
235        debug_assert_eq!(tx_header.tx_id, 0);
236        match tx_header.ordinal {
237            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
238                Ok(CollectorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
239            }
240            _ => Err(fidl::Error::UnknownOrdinal {
241                ordinal: tx_header.ordinal,
242                protocol_name: <CollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
243            }),
244        }
245    }
246}
247
248/// A Stream of incoming requests for fuchsia.memory.stacktrack.client/Collector.
249pub struct CollectorRequestStream {
250    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
251    is_terminated: bool,
252}
253
254impl std::marker::Unpin for CollectorRequestStream {}
255
256impl futures::stream::FusedStream for CollectorRequestStream {
257    fn is_terminated(&self) -> bool {
258        self.is_terminated
259    }
260}
261
262impl fidl::endpoints::RequestStream for CollectorRequestStream {
263    type Protocol = CollectorMarker;
264    type ControlHandle = CollectorControlHandle;
265
266    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
267        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
268    }
269
270    fn control_handle(&self) -> Self::ControlHandle {
271        CollectorControlHandle { inner: self.inner.clone() }
272    }
273
274    fn into_inner(
275        self,
276    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
277    {
278        (self.inner, self.is_terminated)
279    }
280
281    fn from_inner(
282        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
283        is_terminated: bool,
284    ) -> Self {
285        Self { inner, is_terminated }
286    }
287}
288
289impl futures::Stream for CollectorRequestStream {
290    type Item = Result<CollectorRequest, fidl::Error>;
291
292    fn poll_next(
293        mut self: std::pin::Pin<&mut Self>,
294        cx: &mut std::task::Context<'_>,
295    ) -> std::task::Poll<Option<Self::Item>> {
296        let this = &mut *self;
297        if this.inner.check_shutdown(cx) {
298            this.is_terminated = true;
299            return std::task::Poll::Ready(None);
300        }
301        if this.is_terminated {
302            panic!("polled CollectorRequestStream after completion");
303        }
304        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
305            |bytes, handles| {
306                match this.inner.channel().read_etc(cx, bytes, handles) {
307                    std::task::Poll::Ready(Ok(())) => {}
308                    std::task::Poll::Pending => return std::task::Poll::Pending,
309                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
310                        this.is_terminated = true;
311                        return std::task::Poll::Ready(None);
312                    }
313                    std::task::Poll::Ready(Err(e)) => {
314                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
315                            e.into(),
316                        ))));
317                    }
318                }
319
320                // A message has been received from the channel
321                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
322
323                std::task::Poll::Ready(Some(match header.ordinal {
324                    0x1f23d82090761a91 => {
325                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
326                        let mut req = fidl::new_empty!(
327                            CollectorGetStackTracesRequest,
328                            fidl::encoding::DefaultFuchsiaResourceDialect
329                        );
330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CollectorGetStackTracesRequest>(&header, _body_bytes, handles, &mut req)?;
331                        let control_handle = CollectorControlHandle { inner: this.inner.clone() };
332                        Ok(CollectorRequest::GetStackTraces { payload: req, control_handle })
333                    }
334                    _ if header.tx_id == 0
335                        && header
336                            .dynamic_flags()
337                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
338                    {
339                        Ok(CollectorRequest::_UnknownMethod {
340                            ordinal: header.ordinal,
341                            control_handle: CollectorControlHandle { inner: this.inner.clone() },
342                            method_type: fidl::MethodType::OneWay,
343                        })
344                    }
345                    _ if header
346                        .dynamic_flags()
347                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
348                    {
349                        this.inner.send_framework_err(
350                            fidl::encoding::FrameworkErr::UnknownMethod,
351                            header.tx_id,
352                            header.ordinal,
353                            header.dynamic_flags(),
354                            (bytes, handles),
355                        )?;
356                        Ok(CollectorRequest::_UnknownMethod {
357                            ordinal: header.ordinal,
358                            control_handle: CollectorControlHandle { inner: this.inner.clone() },
359                            method_type: fidl::MethodType::TwoWay,
360                        })
361                    }
362                    _ => Err(fidl::Error::UnknownOrdinal {
363                        ordinal: header.ordinal,
364                        protocol_name:
365                            <CollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
366                    }),
367                }))
368            },
369        )
370    }
371}
372
373#[derive(Debug)]
374pub enum CollectorRequest {
375    /// Returns stack traces for the specified process.
376    GetStackTraces {
377        payload: CollectorGetStackTracesRequest,
378        control_handle: CollectorControlHandle,
379    },
380    /// An interaction was received which does not match any known method.
381    #[non_exhaustive]
382    _UnknownMethod {
383        /// Ordinal of the method that was called.
384        ordinal: u64,
385        control_handle: CollectorControlHandle,
386        method_type: fidl::MethodType,
387    },
388}
389
390impl CollectorRequest {
391    #[allow(irrefutable_let_patterns)]
392    pub fn into_get_stack_traces(
393        self,
394    ) -> Option<(CollectorGetStackTracesRequest, CollectorControlHandle)> {
395        if let CollectorRequest::GetStackTraces { payload, control_handle } = self {
396            Some((payload, control_handle))
397        } else {
398            None
399        }
400    }
401
402    /// Name of the method defined in FIDL
403    pub fn method_name(&self) -> &'static str {
404        match *self {
405            CollectorRequest::GetStackTraces { .. } => "get_stack_traces",
406            CollectorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
407                "unknown one-way method"
408            }
409            CollectorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
410                "unknown two-way method"
411            }
412        }
413    }
414}
415
416#[derive(Debug, Clone)]
417pub struct CollectorControlHandle {
418    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
419}
420
421impl fidl::endpoints::ControlHandle for CollectorControlHandle {
422    fn shutdown(&self) {
423        self.inner.shutdown()
424    }
425
426    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
427        self.inner.shutdown_with_epitaph(status)
428    }
429
430    fn is_closed(&self) -> bool {
431        self.inner.channel().is_closed()
432    }
433    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
434        self.inner.channel().on_closed()
435    }
436
437    #[cfg(target_os = "fuchsia")]
438    fn signal_peer(
439        &self,
440        clear_mask: zx::Signals,
441        set_mask: zx::Signals,
442    ) -> Result<(), zx_status::Status> {
443        use fidl::Peered;
444        self.inner.channel().signal_peer(clear_mask, set_mask)
445    }
446}
447
448impl CollectorControlHandle {}
449
450#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
451pub struct SnapshotReceiverMarker;
452
453impl fidl::endpoints::ProtocolMarker for SnapshotReceiverMarker {
454    type Proxy = SnapshotReceiverProxy;
455    type RequestStream = SnapshotReceiverRequestStream;
456    #[cfg(target_os = "fuchsia")]
457    type SynchronousProxy = SnapshotReceiverSynchronousProxy;
458
459    const DEBUG_NAME: &'static str = "(anonymous) SnapshotReceiver";
460}
461
462pub trait SnapshotReceiverProxyInterface: Send + Sync {
463    type BatchResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
464    fn r#batch(&self, batch: &[SnapshotElement]) -> Self::BatchResponseFut;
465    type ReportErrorResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
466    fn r#report_error(&self, error: CollectorError) -> Self::ReportErrorResponseFut;
467}
468#[derive(Debug)]
469#[cfg(target_os = "fuchsia")]
470pub struct SnapshotReceiverSynchronousProxy {
471    client: fidl::client::sync::Client,
472}
473
474#[cfg(target_os = "fuchsia")]
475impl fidl::endpoints::SynchronousProxy for SnapshotReceiverSynchronousProxy {
476    type Proxy = SnapshotReceiverProxy;
477    type Protocol = SnapshotReceiverMarker;
478
479    fn from_channel(inner: fidl::Channel) -> Self {
480        Self::new(inner)
481    }
482
483    fn into_channel(self) -> fidl::Channel {
484        self.client.into_channel()
485    }
486
487    fn as_channel(&self) -> &fidl::Channel {
488        self.client.as_channel()
489    }
490}
491
492#[cfg(target_os = "fuchsia")]
493impl SnapshotReceiverSynchronousProxy {
494    pub fn new(channel: fidl::Channel) -> Self {
495        Self { client: fidl::client::sync::Client::new(channel) }
496    }
497
498    pub fn into_channel(self) -> fidl::Channel {
499        self.client.into_channel()
500    }
501
502    /// Waits until an event arrives and returns it. It is safe for other
503    /// threads to make concurrent requests while waiting for an event.
504    pub fn wait_for_event(
505        &self,
506        deadline: zx::MonotonicInstant,
507    ) -> Result<SnapshotReceiverEvent, fidl::Error> {
508        SnapshotReceiverEvent::decode(
509            self.client.wait_for_event::<SnapshotReceiverMarker>(deadline)?,
510        )
511    }
512
513    /// Delivers a batch of snapshot elements.
514    pub fn r#batch(
515        &self,
516        mut batch: &[SnapshotElement],
517        ___deadline: zx::MonotonicInstant,
518    ) -> Result<(), fidl::Error> {
519        let _response = self.client.send_query::<
520            SnapshotReceiverBatchRequest,
521            fidl::encoding::EmptyPayload,
522            SnapshotReceiverMarker,
523        >(
524            (batch,),
525            0x4251379bcb445d20,
526            fidl::encoding::DynamicFlags::empty(),
527            ___deadline,
528        )?;
529        Ok(_response)
530    }
531
532    /// Reports an error. No other batches or errors will follow.
533    pub fn r#report_error(
534        &self,
535        mut error: CollectorError,
536        ___deadline: zx::MonotonicInstant,
537    ) -> Result<(), fidl::Error> {
538        let _response = self.client.send_query::<
539            SnapshotReceiverReportErrorRequest,
540            fidl::encoding::EmptyPayload,
541            SnapshotReceiverMarker,
542        >(
543            (error,),
544            0x28423f6f135756ad,
545            fidl::encoding::DynamicFlags::empty(),
546            ___deadline,
547        )?;
548        Ok(_response)
549    }
550}
551
552#[cfg(target_os = "fuchsia")]
553impl From<SnapshotReceiverSynchronousProxy> for zx::NullableHandle {
554    fn from(value: SnapshotReceiverSynchronousProxy) -> Self {
555        value.into_channel().into()
556    }
557}
558
559#[cfg(target_os = "fuchsia")]
560impl From<fidl::Channel> for SnapshotReceiverSynchronousProxy {
561    fn from(value: fidl::Channel) -> Self {
562        Self::new(value)
563    }
564}
565
566#[cfg(target_os = "fuchsia")]
567impl fidl::endpoints::FromClient for SnapshotReceiverSynchronousProxy {
568    type Protocol = SnapshotReceiverMarker;
569
570    fn from_client(value: fidl::endpoints::ClientEnd<SnapshotReceiverMarker>) -> Self {
571        Self::new(value.into_channel())
572    }
573}
574
575#[derive(Debug, Clone)]
576pub struct SnapshotReceiverProxy {
577    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
578}
579
580impl fidl::endpoints::Proxy for SnapshotReceiverProxy {
581    type Protocol = SnapshotReceiverMarker;
582
583    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
584        Self::new(inner)
585    }
586
587    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
588        self.client.into_channel().map_err(|client| Self { client })
589    }
590
591    fn as_channel(&self) -> &::fidl::AsyncChannel {
592        self.client.as_channel()
593    }
594}
595
596impl SnapshotReceiverProxy {
597    /// Create a new Proxy for fuchsia.memory.stacktrack.client/SnapshotReceiver.
598    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
599        let protocol_name = <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
600        Self { client: fidl::client::Client::new(channel, protocol_name) }
601    }
602
603    /// Get a Stream of events from the remote end of the protocol.
604    ///
605    /// # Panics
606    ///
607    /// Panics if the event stream was already taken.
608    pub fn take_event_stream(&self) -> SnapshotReceiverEventStream {
609        SnapshotReceiverEventStream { event_receiver: self.client.take_event_receiver() }
610    }
611
612    /// Delivers a batch of snapshot elements.
613    pub fn r#batch(
614        &self,
615        mut batch: &[SnapshotElement],
616    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
617        SnapshotReceiverProxyInterface::r#batch(self, batch)
618    }
619
620    /// Reports an error. No other batches or errors will follow.
621    pub fn r#report_error(
622        &self,
623        mut error: CollectorError,
624    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
625        SnapshotReceiverProxyInterface::r#report_error(self, error)
626    }
627}
628
629impl SnapshotReceiverProxyInterface for SnapshotReceiverProxy {
630    type BatchResponseFut =
631        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
632    fn r#batch(&self, mut batch: &[SnapshotElement]) -> Self::BatchResponseFut {
633        fn _decode(
634            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
635        ) -> Result<(), fidl::Error> {
636            let _response = fidl::client::decode_transaction_body::<
637                fidl::encoding::EmptyPayload,
638                fidl::encoding::DefaultFuchsiaResourceDialect,
639                0x4251379bcb445d20,
640            >(_buf?)?;
641            Ok(_response)
642        }
643        self.client.send_query_and_decode::<SnapshotReceiverBatchRequest, ()>(
644            (batch,),
645            0x4251379bcb445d20,
646            fidl::encoding::DynamicFlags::empty(),
647            _decode,
648        )
649    }
650
651    type ReportErrorResponseFut =
652        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
653    fn r#report_error(&self, mut error: CollectorError) -> Self::ReportErrorResponseFut {
654        fn _decode(
655            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
656        ) -> Result<(), fidl::Error> {
657            let _response = fidl::client::decode_transaction_body::<
658                fidl::encoding::EmptyPayload,
659                fidl::encoding::DefaultFuchsiaResourceDialect,
660                0x28423f6f135756ad,
661            >(_buf?)?;
662            Ok(_response)
663        }
664        self.client.send_query_and_decode::<SnapshotReceiverReportErrorRequest, ()>(
665            (error,),
666            0x28423f6f135756ad,
667            fidl::encoding::DynamicFlags::empty(),
668            _decode,
669        )
670    }
671}
672
673pub struct SnapshotReceiverEventStream {
674    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
675}
676
677impl std::marker::Unpin for SnapshotReceiverEventStream {}
678
679impl futures::stream::FusedStream for SnapshotReceiverEventStream {
680    fn is_terminated(&self) -> bool {
681        self.event_receiver.is_terminated()
682    }
683}
684
685impl futures::Stream for SnapshotReceiverEventStream {
686    type Item = Result<SnapshotReceiverEvent, fidl::Error>;
687
688    fn poll_next(
689        mut self: std::pin::Pin<&mut Self>,
690        cx: &mut std::task::Context<'_>,
691    ) -> std::task::Poll<Option<Self::Item>> {
692        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
693            &mut self.event_receiver,
694            cx
695        )?) {
696            Some(buf) => std::task::Poll::Ready(Some(SnapshotReceiverEvent::decode(buf))),
697            None => std::task::Poll::Ready(None),
698        }
699    }
700}
701
702#[derive(Debug)]
703pub enum SnapshotReceiverEvent {}
704
705impl SnapshotReceiverEvent {
706    /// Decodes a message buffer as a [`SnapshotReceiverEvent`].
707    fn decode(
708        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
709    ) -> Result<SnapshotReceiverEvent, fidl::Error> {
710        let (bytes, _handles) = buf.split_mut();
711        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
712        debug_assert_eq!(tx_header.tx_id, 0);
713        match tx_header.ordinal {
714            _ => Err(fidl::Error::UnknownOrdinal {
715                ordinal: tx_header.ordinal,
716                protocol_name:
717                    <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
718            }),
719        }
720    }
721}
722
723/// A Stream of incoming requests for fuchsia.memory.stacktrack.client/SnapshotReceiver.
724pub struct SnapshotReceiverRequestStream {
725    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
726    is_terminated: bool,
727}
728
729impl std::marker::Unpin for SnapshotReceiverRequestStream {}
730
731impl futures::stream::FusedStream for SnapshotReceiverRequestStream {
732    fn is_terminated(&self) -> bool {
733        self.is_terminated
734    }
735}
736
737impl fidl::endpoints::RequestStream for SnapshotReceiverRequestStream {
738    type Protocol = SnapshotReceiverMarker;
739    type ControlHandle = SnapshotReceiverControlHandle;
740
741    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
742        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
743    }
744
745    fn control_handle(&self) -> Self::ControlHandle {
746        SnapshotReceiverControlHandle { inner: self.inner.clone() }
747    }
748
749    fn into_inner(
750        self,
751    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
752    {
753        (self.inner, self.is_terminated)
754    }
755
756    fn from_inner(
757        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
758        is_terminated: bool,
759    ) -> Self {
760        Self { inner, is_terminated }
761    }
762}
763
764impl futures::Stream for SnapshotReceiverRequestStream {
765    type Item = Result<SnapshotReceiverRequest, fidl::Error>;
766
767    fn poll_next(
768        mut self: std::pin::Pin<&mut Self>,
769        cx: &mut std::task::Context<'_>,
770    ) -> std::task::Poll<Option<Self::Item>> {
771        let this = &mut *self;
772        if this.inner.check_shutdown(cx) {
773            this.is_terminated = true;
774            return std::task::Poll::Ready(None);
775        }
776        if this.is_terminated {
777            panic!("polled SnapshotReceiverRequestStream after completion");
778        }
779        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
780            |bytes, handles| {
781                match this.inner.channel().read_etc(cx, bytes, handles) {
782                    std::task::Poll::Ready(Ok(())) => {}
783                    std::task::Poll::Pending => return std::task::Poll::Pending,
784                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
785                        this.is_terminated = true;
786                        return std::task::Poll::Ready(None);
787                    }
788                    std::task::Poll::Ready(Err(e)) => {
789                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
790                            e.into(),
791                        ))));
792                    }
793                }
794
795                // A message has been received from the channel
796                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
797
798                std::task::Poll::Ready(Some(match header.ordinal {
799                    0x4251379bcb445d20 => {
800                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
801                        let mut req = fidl::new_empty!(
802                            SnapshotReceiverBatchRequest,
803                            fidl::encoding::DefaultFuchsiaResourceDialect
804                        );
805                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnapshotReceiverBatchRequest>(&header, _body_bytes, handles, &mut req)?;
806                        let control_handle =
807                            SnapshotReceiverControlHandle { inner: this.inner.clone() };
808                        Ok(SnapshotReceiverRequest::Batch {
809                            batch: req.batch,
810
811                            responder: SnapshotReceiverBatchResponder {
812                                control_handle: std::mem::ManuallyDrop::new(control_handle),
813                                tx_id: header.tx_id,
814                            },
815                        })
816                    }
817                    0x28423f6f135756ad => {
818                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
819                        let mut req = fidl::new_empty!(
820                            SnapshotReceiverReportErrorRequest,
821                            fidl::encoding::DefaultFuchsiaResourceDialect
822                        );
823                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnapshotReceiverReportErrorRequest>(&header, _body_bytes, handles, &mut req)?;
824                        let control_handle =
825                            SnapshotReceiverControlHandle { inner: this.inner.clone() };
826                        Ok(SnapshotReceiverRequest::ReportError {
827                            error: req.error,
828
829                            responder: SnapshotReceiverReportErrorResponder {
830                                control_handle: std::mem::ManuallyDrop::new(control_handle),
831                                tx_id: header.tx_id,
832                            },
833                        })
834                    }
835                    _ => Err(fidl::Error::UnknownOrdinal {
836                        ordinal: header.ordinal,
837                        protocol_name:
838                            <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
839                    }),
840                }))
841            },
842        )
843    }
844}
845
846/// Protocol to transmit snapshot(s) as a stream of elements.
847#[derive(Debug)]
848pub enum SnapshotReceiverRequest {
849    /// Delivers a batch of snapshot elements.
850    Batch { batch: Vec<SnapshotElement>, responder: SnapshotReceiverBatchResponder },
851    /// Reports an error. No other batches or errors will follow.
852    ReportError { error: CollectorError, responder: SnapshotReceiverReportErrorResponder },
853}
854
855impl SnapshotReceiverRequest {
856    #[allow(irrefutable_let_patterns)]
857    pub fn into_batch(self) -> Option<(Vec<SnapshotElement>, SnapshotReceiverBatchResponder)> {
858        if let SnapshotReceiverRequest::Batch { batch, responder } = self {
859            Some((batch, responder))
860        } else {
861            None
862        }
863    }
864
865    #[allow(irrefutable_let_patterns)]
866    pub fn into_report_error(
867        self,
868    ) -> Option<(CollectorError, SnapshotReceiverReportErrorResponder)> {
869        if let SnapshotReceiverRequest::ReportError { error, responder } = self {
870            Some((error, responder))
871        } else {
872            None
873        }
874    }
875
876    /// Name of the method defined in FIDL
877    pub fn method_name(&self) -> &'static str {
878        match *self {
879            SnapshotReceiverRequest::Batch { .. } => "batch",
880            SnapshotReceiverRequest::ReportError { .. } => "report_error",
881        }
882    }
883}
884
885#[derive(Debug, Clone)]
886pub struct SnapshotReceiverControlHandle {
887    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
888}
889
890impl fidl::endpoints::ControlHandle for SnapshotReceiverControlHandle {
891    fn shutdown(&self) {
892        self.inner.shutdown()
893    }
894
895    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
896        self.inner.shutdown_with_epitaph(status)
897    }
898
899    fn is_closed(&self) -> bool {
900        self.inner.channel().is_closed()
901    }
902    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
903        self.inner.channel().on_closed()
904    }
905
906    #[cfg(target_os = "fuchsia")]
907    fn signal_peer(
908        &self,
909        clear_mask: zx::Signals,
910        set_mask: zx::Signals,
911    ) -> Result<(), zx_status::Status> {
912        use fidl::Peered;
913        self.inner.channel().signal_peer(clear_mask, set_mask)
914    }
915}
916
917impl SnapshotReceiverControlHandle {}
918
919#[must_use = "FIDL methods require a response to be sent"]
920#[derive(Debug)]
921pub struct SnapshotReceiverBatchResponder {
922    control_handle: std::mem::ManuallyDrop<SnapshotReceiverControlHandle>,
923    tx_id: u32,
924}
925
926/// Set the the channel to be shutdown (see [`SnapshotReceiverControlHandle::shutdown`])
927/// if the responder is dropped without sending a response, so that the client
928/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
929impl std::ops::Drop for SnapshotReceiverBatchResponder {
930    fn drop(&mut self) {
931        self.control_handle.shutdown();
932        // Safety: drops once, never accessed again
933        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
934    }
935}
936
937impl fidl::endpoints::Responder for SnapshotReceiverBatchResponder {
938    type ControlHandle = SnapshotReceiverControlHandle;
939
940    fn control_handle(&self) -> &SnapshotReceiverControlHandle {
941        &self.control_handle
942    }
943
944    fn drop_without_shutdown(mut self) {
945        // Safety: drops once, never accessed again due to mem::forget
946        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
947        // Prevent Drop from running (which would shut down the channel)
948        std::mem::forget(self);
949    }
950}
951
952impl SnapshotReceiverBatchResponder {
953    /// Sends a response to the FIDL transaction.
954    ///
955    /// Sets the channel to shutdown if an error occurs.
956    pub fn send(self) -> Result<(), fidl::Error> {
957        let _result = self.send_raw();
958        if _result.is_err() {
959            self.control_handle.shutdown();
960        }
961        self.drop_without_shutdown();
962        _result
963    }
964
965    /// Similar to "send" but does not shutdown the channel if an error occurs.
966    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
967        let _result = self.send_raw();
968        self.drop_without_shutdown();
969        _result
970    }
971
972    fn send_raw(&self) -> Result<(), fidl::Error> {
973        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
974            (),
975            self.tx_id,
976            0x4251379bcb445d20,
977            fidl::encoding::DynamicFlags::empty(),
978        )
979    }
980}
981
982#[must_use = "FIDL methods require a response to be sent"]
983#[derive(Debug)]
984pub struct SnapshotReceiverReportErrorResponder {
985    control_handle: std::mem::ManuallyDrop<SnapshotReceiverControlHandle>,
986    tx_id: u32,
987}
988
989/// Set the the channel to be shutdown (see [`SnapshotReceiverControlHandle::shutdown`])
990/// if the responder is dropped without sending a response, so that the client
991/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
992impl std::ops::Drop for SnapshotReceiverReportErrorResponder {
993    fn drop(&mut self) {
994        self.control_handle.shutdown();
995        // Safety: drops once, never accessed again
996        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
997    }
998}
999
1000impl fidl::endpoints::Responder for SnapshotReceiverReportErrorResponder {
1001    type ControlHandle = SnapshotReceiverControlHandle;
1002
1003    fn control_handle(&self) -> &SnapshotReceiverControlHandle {
1004        &self.control_handle
1005    }
1006
1007    fn drop_without_shutdown(mut self) {
1008        // Safety: drops once, never accessed again due to mem::forget
1009        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1010        // Prevent Drop from running (which would shut down the channel)
1011        std::mem::forget(self);
1012    }
1013}
1014
1015impl SnapshotReceiverReportErrorResponder {
1016    /// Sends a response to the FIDL transaction.
1017    ///
1018    /// Sets the channel to shutdown if an error occurs.
1019    pub fn send(self) -> Result<(), fidl::Error> {
1020        let _result = self.send_raw();
1021        if _result.is_err() {
1022            self.control_handle.shutdown();
1023        }
1024        self.drop_without_shutdown();
1025        _result
1026    }
1027
1028    /// Similar to "send" but does not shutdown the channel if an error occurs.
1029    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1030        let _result = self.send_raw();
1031        self.drop_without_shutdown();
1032        _result
1033    }
1034
1035    fn send_raw(&self) -> Result<(), fidl::Error> {
1036        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1037            (),
1038            self.tx_id,
1039            0x28423f6f135756ad,
1040            fidl::encoding::DynamicFlags::empty(),
1041        )
1042    }
1043}
1044
1045mod internal {
1046    use super::*;
1047
1048    impl CollectorGetStackTracesRequest {
1049        #[inline(always)]
1050        fn max_ordinal_present(&self) -> u64 {
1051            if let Some(_) = self.receiver {
1052                return 2;
1053            }
1054            if let Some(_) = self.process_selector {
1055                return 1;
1056            }
1057            0
1058        }
1059    }
1060
1061    impl fidl::encoding::ResourceTypeMarker for CollectorGetStackTracesRequest {
1062        type Borrowed<'a> = &'a mut Self;
1063        fn take_or_borrow<'a>(
1064            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1065        ) -> Self::Borrowed<'a> {
1066            value
1067        }
1068    }
1069
1070    unsafe impl fidl::encoding::TypeMarker for CollectorGetStackTracesRequest {
1071        type Owned = Self;
1072
1073        #[inline(always)]
1074        fn inline_align(_context: fidl::encoding::Context) -> usize {
1075            8
1076        }
1077
1078        #[inline(always)]
1079        fn inline_size(_context: fidl::encoding::Context) -> usize {
1080            16
1081        }
1082    }
1083
1084    unsafe impl
1085        fidl::encoding::Encode<
1086            CollectorGetStackTracesRequest,
1087            fidl::encoding::DefaultFuchsiaResourceDialect,
1088        > for &mut CollectorGetStackTracesRequest
1089    {
1090        unsafe fn encode(
1091            self,
1092            encoder: &mut fidl::encoding::Encoder<
1093                '_,
1094                fidl::encoding::DefaultFuchsiaResourceDialect,
1095            >,
1096            offset: usize,
1097            mut depth: fidl::encoding::Depth,
1098        ) -> fidl::Result<()> {
1099            encoder.debug_check_bounds::<CollectorGetStackTracesRequest>(offset);
1100            // Vector header
1101            let max_ordinal: u64 = self.max_ordinal_present();
1102            encoder.write_num(max_ordinal, offset);
1103            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1104            // Calling encoder.out_of_line_offset(0) is not allowed.
1105            if max_ordinal == 0 {
1106                return Ok(());
1107            }
1108            depth.increment()?;
1109            let envelope_size = 8;
1110            let bytes_len = max_ordinal as usize * envelope_size;
1111            #[allow(unused_variables)]
1112            let offset = encoder.out_of_line_offset(bytes_len);
1113            let mut _prev_end_offset: usize = 0;
1114            if 1 > max_ordinal {
1115                return Ok(());
1116            }
1117
1118            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1119            // are envelope_size bytes.
1120            let cur_offset: usize = (1 - 1) * envelope_size;
1121
1122            // Zero reserved fields.
1123            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1124
1125            // Safety:
1126            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1127            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1128            //   envelope_size bytes, there is always sufficient room.
1129            fidl::encoding::encode_in_envelope_optional::<
1130                ProcessSelector,
1131                fidl::encoding::DefaultFuchsiaResourceDialect,
1132            >(
1133                self.process_selector
1134                    .as_ref()
1135                    .map(<ProcessSelector as fidl::encoding::ValueTypeMarker>::borrow),
1136                encoder,
1137                offset + cur_offset,
1138                depth,
1139            )?;
1140
1141            _prev_end_offset = cur_offset + envelope_size;
1142            if 2 > max_ordinal {
1143                return Ok(());
1144            }
1145
1146            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1147            // are envelope_size bytes.
1148            let cur_offset: usize = (2 - 1) * envelope_size;
1149
1150            // Zero reserved fields.
1151            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1152
1153            // Safety:
1154            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1155            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1156            //   envelope_size bytes, there is always sufficient room.
1157            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1158            self.receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1159            encoder, offset + cur_offset, depth
1160        )?;
1161
1162            _prev_end_offset = cur_offset + envelope_size;
1163
1164            Ok(())
1165        }
1166    }
1167
1168    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1169        for CollectorGetStackTracesRequest
1170    {
1171        #[inline(always)]
1172        fn new_empty() -> Self {
1173            Self::default()
1174        }
1175
1176        unsafe fn decode(
1177            &mut self,
1178            decoder: &mut fidl::encoding::Decoder<
1179                '_,
1180                fidl::encoding::DefaultFuchsiaResourceDialect,
1181            >,
1182            offset: usize,
1183            mut depth: fidl::encoding::Depth,
1184        ) -> fidl::Result<()> {
1185            decoder.debug_check_bounds::<Self>(offset);
1186            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1187                None => return Err(fidl::Error::NotNullable),
1188                Some(len) => len,
1189            };
1190            // Calling decoder.out_of_line_offset(0) is not allowed.
1191            if len == 0 {
1192                return Ok(());
1193            };
1194            depth.increment()?;
1195            let envelope_size = 8;
1196            let bytes_len = len * envelope_size;
1197            let offset = decoder.out_of_line_offset(bytes_len)?;
1198            // Decode the envelope for each type.
1199            let mut _next_ordinal_to_read = 0;
1200            let mut next_offset = offset;
1201            let end_offset = offset + bytes_len;
1202            _next_ordinal_to_read += 1;
1203            if next_offset >= end_offset {
1204                return Ok(());
1205            }
1206
1207            // Decode unknown envelopes for gaps in ordinals.
1208            while _next_ordinal_to_read < 1 {
1209                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1210                _next_ordinal_to_read += 1;
1211                next_offset += envelope_size;
1212            }
1213
1214            let next_out_of_line = decoder.next_out_of_line();
1215            let handles_before = decoder.remaining_handles();
1216            if let Some((inlined, num_bytes, num_handles)) =
1217                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1218            {
1219                let member_inline_size =
1220                    <ProcessSelector as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1221                if inlined != (member_inline_size <= 4) {
1222                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1223                }
1224                let inner_offset;
1225                let mut inner_depth = depth.clone();
1226                if inlined {
1227                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1228                    inner_offset = next_offset;
1229                } else {
1230                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1231                    inner_depth.increment()?;
1232                }
1233                let val_ref = self.process_selector.get_or_insert_with(|| {
1234                    fidl::new_empty!(ProcessSelector, fidl::encoding::DefaultFuchsiaResourceDialect)
1235                });
1236                fidl::decode!(
1237                    ProcessSelector,
1238                    fidl::encoding::DefaultFuchsiaResourceDialect,
1239                    val_ref,
1240                    decoder,
1241                    inner_offset,
1242                    inner_depth
1243                )?;
1244                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1245                {
1246                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1247                }
1248                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1249                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1250                }
1251            }
1252
1253            next_offset += envelope_size;
1254            _next_ordinal_to_read += 1;
1255            if next_offset >= end_offset {
1256                return Ok(());
1257            }
1258
1259            // Decode unknown envelopes for gaps in ordinals.
1260            while _next_ordinal_to_read < 2 {
1261                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1262                _next_ordinal_to_read += 1;
1263                next_offset += envelope_size;
1264            }
1265
1266            let next_out_of_line = decoder.next_out_of_line();
1267            let handles_before = decoder.remaining_handles();
1268            if let Some((inlined, num_bytes, num_handles)) =
1269                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1270            {
1271                let member_inline_size = <fidl::encoding::Endpoint<
1272                    fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
1273                > as fidl::encoding::TypeMarker>::inline_size(
1274                    decoder.context
1275                );
1276                if inlined != (member_inline_size <= 4) {
1277                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1278                }
1279                let inner_offset;
1280                let mut inner_depth = depth.clone();
1281                if inlined {
1282                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1283                    inner_offset = next_offset;
1284                } else {
1285                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1286                    inner_depth.increment()?;
1287                }
1288                let val_ref = self.receiver.get_or_insert_with(|| {
1289                    fidl::new_empty!(
1290                        fidl::encoding::Endpoint<
1291                            fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
1292                        >,
1293                        fidl::encoding::DefaultFuchsiaResourceDialect
1294                    )
1295                });
1296                fidl::decode!(
1297                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>,
1298                    fidl::encoding::DefaultFuchsiaResourceDialect,
1299                    val_ref,
1300                    decoder,
1301                    inner_offset,
1302                    inner_depth
1303                )?;
1304                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1305                {
1306                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1307                }
1308                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1309                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1310                }
1311            }
1312
1313            next_offset += envelope_size;
1314
1315            // Decode the remaining unknown envelopes.
1316            while next_offset < end_offset {
1317                _next_ordinal_to_read += 1;
1318                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1319                next_offset += envelope_size;
1320            }
1321
1322            Ok(())
1323        }
1324    }
1325}