Skip to main content

fidl_fuchsia_feedback/
fidl_fuchsia_feedback.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_feedback_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14/// An attachment and its plain ASCII string key.
15/// Attachments are larger objects, e.g., log files. They may be binary or text data.
16#[derive(Debug, PartialEq)]
17pub struct Attachment {
18    pub key: String,
19    pub value: fidl_fuchsia_mem::Buffer,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Attachment {}
23
24#[derive(Debug, PartialEq)]
25pub struct CrashReporterFileReportRequest {
26    pub report: CrashReport,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for CrashReporterFileReportRequest
31{
32}
33
34#[derive(Debug, PartialEq)]
35pub struct DataProviderGetSnapshotRequest {
36    pub params: GetSnapshotParameters,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40    for DataProviderGetSnapshotRequest
41{
42}
43
44#[derive(Debug, PartialEq)]
45pub struct DataProviderGetSnapshotResponse {
46    pub snapshot: Snapshot,
47}
48
49impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
50    for DataProviderGetSnapshotResponse
51{
52}
53
54/// Represents a crash report.
55#[derive(Debug, Default, PartialEq)]
56pub struct CrashReport {
57    /// The name of the program that crashed, e.g., the process or component's name.
58    ///
59    /// Internally, the program name is used to persist the report in case it can't be uploaded
60    /// immediately. As a result, it's sanitized when used as a filesystem path, e.g., stripped of
61    /// any fuchsia-pkg:// prefix. ZX_ERR_INVALID_ARGS will be returned if the sanitized program
62    /// name is any of the following:
63    ///  * ""
64    ///  * "."
65    ///  * ".."
66    pub program_name: Option<String>,
67    /// The specific report that depends on the type of crashes.
68    ///
69    /// This field should be set if additional information about the crashing program needs to be
70    /// sent, e.g., a minidump.
71    pub specific_report: Option<SpecificCrashReport>,
72    /// A vector of key-value string pairs representing arbitrary data that should be attached to a
73    /// crash report.
74    ///
75    /// Keys should be unique as only the latest value for a given key in the vector will be
76    /// considered.
77    pub annotations: Option<Vec<Annotation>>,
78    /// A vector of key-value string-to-VMO pairs representing arbitrary data that should be
79    /// attached to a crash report.
80    ///
81    /// Keys should be unique as only the latest value for a given key in the vector will be
82    /// considered.
83    ///
84    /// ZX_ERR_INVALID_ARGS will be returned if any of the following is true:
85    ///  * a key is ""
86    ///  * a key is "."
87    ///  * a key is ".."
88    ///  * a key contains a forward slash "/"
89    ///  * a key contains a space " "
90    ///  * a key contains characters other than printable ASCII
91    pub attachments: Option<Vec<Attachment>>,
92    /// A text ID that the crash server can use to group multiple crash reports related to the
93    /// same event.
94    ///
95    /// Unlike the crash signature, crash reports sharing the same ID correspond to different
96    /// crashes, but can be considered as belonging to the same event, e.g., a crash in a low-level
97    /// server causing a crash in a high-level UI widget.
98    pub event_id: Option<String>,
99    /// How long the program was running before it crashed.
100    pub program_uptime: Option<i64>,
101    /// A text signature that the crash server can use to track the same crash over time, e.g.,
102    /// "kernel-panic" or "oom". This signature will take precedence over any automated signature
103    /// derived from the rest of the data.
104    ///
105    /// Unlike the event ID, crash reports sharing the same signature correspond to the same crash,
106    /// but happening over multiple events, e.g., a null pointer exception in a server whenever
107    /// asked the same request.
108    ///
109    /// Must match [a-z][a-z\-]* i.e. only lowercase letters and hyphens or this will result in a
110    /// ZX_ERR_INVALID_ARGS epitaph.
111    pub crash_signature: Option<String>,
112    /// Indicates whether the crash report is for the atypical stop of a running process, component,
113    /// or the system itself.
114    ///
115    /// Examples of events that result in fatal crash reports are:
116    ///  * an ELF process crashing
117    ///  * the system rebooting because it ran out of memory.
118    ///  * the system rebooting because a critical component crashed.
119    ///  * the system rebooting because the device was too hot.
120    ///
121    /// Examples of events that result in non-fatal crash reports are:
122    ///  * an uncaught exception in a Dart program with many execution contexts. The runtime may
123    ///    chose to terminate that specific execution context and file a crash report for it instead
124    ///    of the whole program.
125    ///  * a component detecting a fatal event (like an OOM) may occur soon, but isn't guaranteed to
126    ///    occur.
127    ///
128    /// This field is primarily used for grouping crashes by fatal, not fatal, and unknown,
129    /// each corresponding to the field being set to true, set to false, or not set respectively.
130    pub is_fatal: Option<bool>,
131    /// Optional. Used to indicate that this report represents more than just this instance of the
132    /// crash. For example, this field should be set to 10 if choosing to only file 1 out of every
133    /// 10 instances of this crash type.
134    ///
135    /// A weight of 1 is used if the field is not set. An explicitly set value of 0 is invalid and
136    /// will be rejected.
137    pub weight: Option<u32>,
138    #[doc(hidden)]
139    pub __source_breaking: fidl::marker::SourceBreaking,
140}
141
142impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CrashReport {}
143
144/// Parameters for the DataProvider::GetSnapshot() method.
145#[derive(Debug, Default, PartialEq)]
146pub struct GetSnapshotParameters {
147    /// A snapshot aggregates various data from the platform (device uptime, logs, Inspect data,
148    /// etc.) that are collected in parallel. Internally, each data collection is done within a
149    /// timeout.
150    ///
151    /// `collection_timeout_per_data` allows clients to control how much time is given to each data
152    /// collection. It enables clients to get a partial yet valid snapshot under a certain time.
153    ///
154    /// Note that this does not control how much total time the snapshot generation may take,
155    /// which is by construction higher than `collection_timeout_per_data`, as clients can control
156    /// the total time by using a timeout on the call to GetSnapshot() on their side.
157    pub collection_timeout_per_data: Option<i64>,
158    /// If set, the snapshot archive will be sent as a |fuchsia.io.File| over this channel instead
159    /// of being set in the |archive| field in the |Snapshot| response. This is typically useful if
160    /// the client is on the host and does not support VMOs.
161    pub response_channel: Option<fidl::Channel>,
162    #[doc(hidden)]
163    pub __source_breaking: fidl::marker::SourceBreaking,
164}
165
166impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetSnapshotParameters {}
167
168/// Represents a crash report for a native exception out of which the client has built a minidump.
169#[derive(Debug, Default, PartialEq)]
170pub struct NativeCrashReport {
171    /// The core dump in the Minidump format.
172    pub minidump: Option<fidl_fuchsia_mem::Buffer>,
173    /// The name of the crashed process.
174    pub process_name: Option<String>,
175    /// The kernel object id of the crashed process.
176    pub process_koid: Option<u64>,
177    /// The name of the crashed thread.
178    pub thread_name: Option<String>,
179    /// The kernel object id of the crashed thread.
180    pub thread_koid: Option<u64>,
181    #[doc(hidden)]
182    pub __source_breaking: fidl::marker::SourceBreaking,
183}
184
185impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NativeCrashReport {}
186
187/// Represents a crash report for a runtime exception, applicable to most languages.
188#[derive(Debug, Default, PartialEq)]
189pub struct RuntimeCrashReport {
190    /// The exception type, e.g., "FileSystemException".
191    pub exception_type: Option<String>,
192    /// The exception message, e.g., "cannot open file".
193    pub exception_message: Option<String>,
194    /// The text representation of the exception stack trace.
195    pub exception_stack_trace: Option<fidl_fuchsia_mem::Buffer>,
196    #[doc(hidden)]
197    pub __source_breaking: fidl::marker::SourceBreaking,
198}
199
200impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RuntimeCrashReport {}
201
202/// Snapshot about the device's state.
203///
204/// Clients typically upload the data straight to servers. So the data comes in the form of
205/// arbitrary key-value pairs that clients can directly forward to the servers.
206#[derive(Debug, Default, PartialEq)]
207pub struct Snapshot {
208    /// A <filename, ZIP archive> pair.
209    ///
210    /// The ZIP archive contains several files corresponding to the various data it collected from
211    /// the platform. There is typically one file for all the annotations (device uptime, build
212    /// version, etc.) and one file per attachment (logs, Inspect data, etc.).
213    ///
214    /// Not set if |response_channel| was set in the request.
215    pub archive: Option<Attachment>,
216    /// A vector of key-value string pairs. Keys are guaranteed to be unique.
217    ///
218    /// While the annotations are included in the ZIP archive itself, some clients also want them
219    /// separately to index or augment them so we provide them separately as well.
220    pub annotations2: Option<Vec<Annotation>>,
221    #[doc(hidden)]
222    pub __source_breaking: fidl::marker::SourceBreaking,
223}
224
225impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Snapshot {}
226
227/// Represents a crash report with a text stack trace.
228#[derive(Debug, Default, PartialEq)]
229pub struct TextBacktraceCrashReport {
230    /// The text representation of the backtrace in Fuchsia's symbolization markup format.
231    pub fuchsia_backtrace: Option<fidl_fuchsia_mem::Buffer>,
232    /// The name of the crashed process.
233    pub process_name: Option<String>,
234    /// The kernel object id of the crashed process.
235    pub process_koid: Option<u64>,
236    /// The name of the crashed thread.
237    pub thread_name: Option<String>,
238    /// The kernel object id of the crashed thread.
239    pub thread_koid: Option<u64>,
240    #[doc(hidden)]
241    pub __source_breaking: fidl::marker::SourceBreaking,
242}
243
244impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TextBacktraceCrashReport {}
245
246/// Represents a specific crash report.
247///
248/// Add a new member when the server needs to special case how it handles certain annotations and
249/// attachments for a given type of crashes, e.g., a `RuntimeCrashReport` for Javascript.
250#[derive(Debug)]
251pub enum SpecificCrashReport {
252    /// Intended for a native exception.
253    Native(NativeCrashReport),
254    /// Intended for a Dart exception.
255    Dart(RuntimeCrashReport),
256    /// Intended for a text stack trace in Fuchsia's symbolization markup format.
257    TextBacktrace(TextBacktraceCrashReport),
258    #[doc(hidden)]
259    __SourceBreaking { unknown_ordinal: u64 },
260}
261
262/// Pattern that matches an unknown `SpecificCrashReport` member.
263#[macro_export]
264macro_rules! SpecificCrashReportUnknown {
265    () => {
266        _
267    };
268}
269
270// Custom PartialEq so that unknown variants are not equal to themselves.
271impl PartialEq for SpecificCrashReport {
272    fn eq(&self, other: &Self) -> bool {
273        match (self, other) {
274            (Self::Native(x), Self::Native(y)) => *x == *y,
275            (Self::Dart(x), Self::Dart(y)) => *x == *y,
276            (Self::TextBacktrace(x), Self::TextBacktrace(y)) => *x == *y,
277            _ => false,
278        }
279    }
280}
281
282impl SpecificCrashReport {
283    #[inline]
284    pub fn ordinal(&self) -> u64 {
285        match *self {
286            Self::Native(_) => 2,
287            Self::Dart(_) => 3,
288            Self::TextBacktrace(_) => 4,
289            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
290        }
291    }
292
293    #[inline]
294    pub fn unknown_variant_for_testing() -> Self {
295        Self::__SourceBreaking { unknown_ordinal: 0 }
296    }
297
298    #[inline]
299    pub fn is_unknown(&self) -> bool {
300        match self {
301            Self::__SourceBreaking { .. } => true,
302            _ => false,
303        }
304    }
305}
306
307impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SpecificCrashReport {}
308
309#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
310pub struct ComponentDataRegisterMarker;
311
312impl fidl::endpoints::ProtocolMarker for ComponentDataRegisterMarker {
313    type Proxy = ComponentDataRegisterProxy;
314    type RequestStream = ComponentDataRegisterRequestStream;
315    #[cfg(target_os = "fuchsia")]
316    type SynchronousProxy = ComponentDataRegisterSynchronousProxy;
317
318    const DEBUG_NAME: &'static str = "fuchsia.feedback.ComponentDataRegister";
319}
320impl fidl::endpoints::DiscoverableProtocolMarker for ComponentDataRegisterMarker {}
321
322pub trait ComponentDataRegisterProxyInterface: Send + Sync {
323    type UpsertResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
324    fn r#upsert(&self, data: &ComponentData) -> Self::UpsertResponseFut;
325}
326#[derive(Debug)]
327#[cfg(target_os = "fuchsia")]
328pub struct ComponentDataRegisterSynchronousProxy {
329    client: fidl::client::sync::Client,
330}
331
332#[cfg(target_os = "fuchsia")]
333impl fidl::endpoints::SynchronousProxy for ComponentDataRegisterSynchronousProxy {
334    type Proxy = ComponentDataRegisterProxy;
335    type Protocol = ComponentDataRegisterMarker;
336
337    fn from_channel(inner: fidl::Channel) -> Self {
338        Self::new(inner)
339    }
340
341    fn into_channel(self) -> fidl::Channel {
342        self.client.into_channel()
343    }
344
345    fn as_channel(&self) -> &fidl::Channel {
346        self.client.as_channel()
347    }
348}
349
350#[cfg(target_os = "fuchsia")]
351impl ComponentDataRegisterSynchronousProxy {
352    pub fn new(channel: fidl::Channel) -> Self {
353        Self { client: fidl::client::sync::Client::new(channel) }
354    }
355
356    pub fn into_channel(self) -> fidl::Channel {
357        self.client.into_channel()
358    }
359
360    /// Waits until an event arrives and returns it. It is safe for other
361    /// threads to make concurrent requests while waiting for an event.
362    pub fn wait_for_event(
363        &self,
364        deadline: zx::MonotonicInstant,
365    ) -> Result<ComponentDataRegisterEvent, fidl::Error> {
366        ComponentDataRegisterEvent::decode(
367            self.client.wait_for_event::<ComponentDataRegisterMarker>(deadline)?,
368        )
369    }
370
371    /// Upserts, i.e. updates or inserts, extra component data to be included in feedback reports.
372    ///
373    /// The namespace and each annotation key are used to decide whether to update or insert an
374    /// annotation. If an annotation is already present for a given key within the same namespace,
375    /// update the value, otherwise insert the annotation with that key under that namespace.
376    ///
377    /// For instance, assuming these are the data already held by the server (from previous calls
378    /// to Upsert()):
379    /// ```
380    /// {
381    ///   "bar": { # namespace
382    ///     "channel": "stable",
383    ///   },
384    ///   "foo": { # namespace
385    ///     "version": "0.2",
386    ///   }
387    /// }
388    /// ```
389    /// then:
390    /// ```
391    /// Upsert({
392    ///   "namespace": "bar",
393    ///   "annotations": [
394    ///     "version": "1.2.3.45",
395    ///     "channel": "beta",
396    ///   ]
397    /// })
398    /// ```
399    /// would result in the server now holding:
400    /// ```
401    /// {
402    ///   "bar": { # namespace
403    ///     "channel": "beta", # updated
404    ///     "version": "1.2.3.45" # inserted
405    ///   },
406    ///   "foo": { # namespace
407    ///     "version": "0.2", # untouched
408    ///   }
409    /// }
410    /// ```
411    ///
412    /// Note that the server will only hold at most MAX_NUM_ANNOTATIONS_PER_NAMESPACE distinct
413    /// annotation keys per namespace, picking up the latest values.
414    pub fn r#upsert(
415        &self,
416        mut data: &ComponentData,
417        ___deadline: zx::MonotonicInstant,
418    ) -> Result<(), fidl::Error> {
419        let _response = self.client.send_query::<
420            ComponentDataRegisterUpsertRequest,
421            fidl::encoding::EmptyPayload,
422            ComponentDataRegisterMarker,
423        >(
424            (data,),
425            0xa25b7c4e125c0a1,
426            fidl::encoding::DynamicFlags::empty(),
427            ___deadline,
428        )?;
429        Ok(_response)
430    }
431}
432
433#[cfg(target_os = "fuchsia")]
434impl From<ComponentDataRegisterSynchronousProxy> for zx::NullableHandle {
435    fn from(value: ComponentDataRegisterSynchronousProxy) -> Self {
436        value.into_channel().into()
437    }
438}
439
440#[cfg(target_os = "fuchsia")]
441impl From<fidl::Channel> for ComponentDataRegisterSynchronousProxy {
442    fn from(value: fidl::Channel) -> Self {
443        Self::new(value)
444    }
445}
446
447#[cfg(target_os = "fuchsia")]
448impl fidl::endpoints::FromClient for ComponentDataRegisterSynchronousProxy {
449    type Protocol = ComponentDataRegisterMarker;
450
451    fn from_client(value: fidl::endpoints::ClientEnd<ComponentDataRegisterMarker>) -> Self {
452        Self::new(value.into_channel())
453    }
454}
455
456#[derive(Debug, Clone)]
457pub struct ComponentDataRegisterProxy {
458    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
459}
460
461impl fidl::endpoints::Proxy for ComponentDataRegisterProxy {
462    type Protocol = ComponentDataRegisterMarker;
463
464    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
465        Self::new(inner)
466    }
467
468    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
469        self.client.into_channel().map_err(|client| Self { client })
470    }
471
472    fn as_channel(&self) -> &::fidl::AsyncChannel {
473        self.client.as_channel()
474    }
475}
476
477impl ComponentDataRegisterProxy {
478    /// Create a new Proxy for fuchsia.feedback/ComponentDataRegister.
479    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
480        let protocol_name =
481            <ComponentDataRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
482        Self { client: fidl::client::Client::new(channel, protocol_name) }
483    }
484
485    /// Get a Stream of events from the remote end of the protocol.
486    ///
487    /// # Panics
488    ///
489    /// Panics if the event stream was already taken.
490    pub fn take_event_stream(&self) -> ComponentDataRegisterEventStream {
491        ComponentDataRegisterEventStream { event_receiver: self.client.take_event_receiver() }
492    }
493
494    /// Upserts, i.e. updates or inserts, extra component data to be included in feedback reports.
495    ///
496    /// The namespace and each annotation key are used to decide whether to update or insert an
497    /// annotation. If an annotation is already present for a given key within the same namespace,
498    /// update the value, otherwise insert the annotation with that key under that namespace.
499    ///
500    /// For instance, assuming these are the data already held by the server (from previous calls
501    /// to Upsert()):
502    /// ```
503    /// {
504    ///   "bar": { # namespace
505    ///     "channel": "stable",
506    ///   },
507    ///   "foo": { # namespace
508    ///     "version": "0.2",
509    ///   }
510    /// }
511    /// ```
512    /// then:
513    /// ```
514    /// Upsert({
515    ///   "namespace": "bar",
516    ///   "annotations": [
517    ///     "version": "1.2.3.45",
518    ///     "channel": "beta",
519    ///   ]
520    /// })
521    /// ```
522    /// would result in the server now holding:
523    /// ```
524    /// {
525    ///   "bar": { # namespace
526    ///     "channel": "beta", # updated
527    ///     "version": "1.2.3.45" # inserted
528    ///   },
529    ///   "foo": { # namespace
530    ///     "version": "0.2", # untouched
531    ///   }
532    /// }
533    /// ```
534    ///
535    /// Note that the server will only hold at most MAX_NUM_ANNOTATIONS_PER_NAMESPACE distinct
536    /// annotation keys per namespace, picking up the latest values.
537    pub fn r#upsert(
538        &self,
539        mut data: &ComponentData,
540    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
541        ComponentDataRegisterProxyInterface::r#upsert(self, data)
542    }
543}
544
545impl ComponentDataRegisterProxyInterface for ComponentDataRegisterProxy {
546    type UpsertResponseFut =
547        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
548    fn r#upsert(&self, mut data: &ComponentData) -> Self::UpsertResponseFut {
549        fn _decode(
550            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
551        ) -> Result<(), fidl::Error> {
552            let _response = fidl::client::decode_transaction_body::<
553                fidl::encoding::EmptyPayload,
554                fidl::encoding::DefaultFuchsiaResourceDialect,
555                0xa25b7c4e125c0a1,
556            >(_buf?)?;
557            Ok(_response)
558        }
559        self.client.send_query_and_decode::<ComponentDataRegisterUpsertRequest, ()>(
560            (data,),
561            0xa25b7c4e125c0a1,
562            fidl::encoding::DynamicFlags::empty(),
563            _decode,
564        )
565    }
566}
567
568pub struct ComponentDataRegisterEventStream {
569    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
570}
571
572impl std::marker::Unpin for ComponentDataRegisterEventStream {}
573
574impl futures::stream::FusedStream for ComponentDataRegisterEventStream {
575    fn is_terminated(&self) -> bool {
576        self.event_receiver.is_terminated()
577    }
578}
579
580impl futures::Stream for ComponentDataRegisterEventStream {
581    type Item = Result<ComponentDataRegisterEvent, fidl::Error>;
582
583    fn poll_next(
584        mut self: std::pin::Pin<&mut Self>,
585        cx: &mut std::task::Context<'_>,
586    ) -> std::task::Poll<Option<Self::Item>> {
587        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
588            &mut self.event_receiver,
589            cx
590        )?) {
591            Some(buf) => std::task::Poll::Ready(Some(ComponentDataRegisterEvent::decode(buf))),
592            None => std::task::Poll::Ready(None),
593        }
594    }
595}
596
597#[derive(Debug)]
598pub enum ComponentDataRegisterEvent {}
599
600impl ComponentDataRegisterEvent {
601    /// Decodes a message buffer as a [`ComponentDataRegisterEvent`].
602    fn decode(
603        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
604    ) -> Result<ComponentDataRegisterEvent, fidl::Error> {
605        let (bytes, _handles) = buf.split_mut();
606        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
607        debug_assert_eq!(tx_header.tx_id, 0);
608        match tx_header.ordinal {
609            _ => Err(fidl::Error::UnknownOrdinal {
610                ordinal: tx_header.ordinal,
611                protocol_name:
612                    <ComponentDataRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
613            }),
614        }
615    }
616}
617
618/// A Stream of incoming requests for fuchsia.feedback/ComponentDataRegister.
619pub struct ComponentDataRegisterRequestStream {
620    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
621    is_terminated: bool,
622}
623
624impl std::marker::Unpin for ComponentDataRegisterRequestStream {}
625
626impl futures::stream::FusedStream for ComponentDataRegisterRequestStream {
627    fn is_terminated(&self) -> bool {
628        self.is_terminated
629    }
630}
631
632impl fidl::endpoints::RequestStream for ComponentDataRegisterRequestStream {
633    type Protocol = ComponentDataRegisterMarker;
634    type ControlHandle = ComponentDataRegisterControlHandle;
635
636    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
637        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
638    }
639
640    fn control_handle(&self) -> Self::ControlHandle {
641        ComponentDataRegisterControlHandle { inner: self.inner.clone() }
642    }
643
644    fn into_inner(
645        self,
646    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
647    {
648        (self.inner, self.is_terminated)
649    }
650
651    fn from_inner(
652        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
653        is_terminated: bool,
654    ) -> Self {
655        Self { inner, is_terminated }
656    }
657}
658
659impl futures::Stream for ComponentDataRegisterRequestStream {
660    type Item = Result<ComponentDataRegisterRequest, fidl::Error>;
661
662    fn poll_next(
663        mut self: std::pin::Pin<&mut Self>,
664        cx: &mut std::task::Context<'_>,
665    ) -> std::task::Poll<Option<Self::Item>> {
666        let this = &mut *self;
667        if this.inner.check_shutdown(cx) {
668            this.is_terminated = true;
669            return std::task::Poll::Ready(None);
670        }
671        if this.is_terminated {
672            panic!("polled ComponentDataRegisterRequestStream after completion");
673        }
674        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
675            |bytes, handles| {
676                match this.inner.channel().read_etc(cx, bytes, handles) {
677                    std::task::Poll::Ready(Ok(())) => {}
678                    std::task::Poll::Pending => return std::task::Poll::Pending,
679                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
680                        this.is_terminated = true;
681                        return std::task::Poll::Ready(None);
682                    }
683                    std::task::Poll::Ready(Err(e)) => {
684                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
685                            e.into(),
686                        ))));
687                    }
688                }
689
690                // A message has been received from the channel
691                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
692
693                std::task::Poll::Ready(Some(match header.ordinal {
694                0xa25b7c4e125c0a1 => {
695                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
696                    let mut req = fidl::new_empty!(ComponentDataRegisterUpsertRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
697                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComponentDataRegisterUpsertRequest>(&header, _body_bytes, handles, &mut req)?;
698                    let control_handle = ComponentDataRegisterControlHandle {
699                        inner: this.inner.clone(),
700                    };
701                    Ok(ComponentDataRegisterRequest::Upsert {data: req.data,
702
703                        responder: ComponentDataRegisterUpsertResponder {
704                            control_handle: std::mem::ManuallyDrop::new(control_handle),
705                            tx_id: header.tx_id,
706                        },
707                    })
708                }
709                _ => Err(fidl::Error::UnknownOrdinal {
710                    ordinal: header.ordinal,
711                    protocol_name: <ComponentDataRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
712                }),
713            }))
714            },
715        )
716    }
717}
718
719/// Registers data useful to attach in feedback reports (crash, user feedback or bug reports).
720///
721/// This can be used by components to augment the data attached to all feedback reports. By default
722/// the Feedback service attaches data exposed to the platform. This protocol is  useful for data
723/// known by certain components in certain products, but that is not exposed to the platform.
724///
725/// The epitaph ZX_ERR_INVALID_ARGS indicates that the client is sending invalid requests. See
726/// below for each request why they might be invalid.
727///
728/// The epitaph ZX_ERR_NO_RESOURCES indicates that the server can no longer store additional
729/// component data and will not service new connections.
730#[derive(Debug)]
731pub enum ComponentDataRegisterRequest {
732    /// Upserts, i.e. updates or inserts, extra component data to be included in feedback reports.
733    ///
734    /// The namespace and each annotation key are used to decide whether to update or insert an
735    /// annotation. If an annotation is already present for a given key within the same namespace,
736    /// update the value, otherwise insert the annotation with that key under that namespace.
737    ///
738    /// For instance, assuming these are the data already held by the server (from previous calls
739    /// to Upsert()):
740    /// ```
741    /// {
742    ///   "bar": { # namespace
743    ///     "channel": "stable",
744    ///   },
745    ///   "foo": { # namespace
746    ///     "version": "0.2",
747    ///   }
748    /// }
749    /// ```
750    /// then:
751    /// ```
752    /// Upsert({
753    ///   "namespace": "bar",
754    ///   "annotations": [
755    ///     "version": "1.2.3.45",
756    ///     "channel": "beta",
757    ///   ]
758    /// })
759    /// ```
760    /// would result in the server now holding:
761    /// ```
762    /// {
763    ///   "bar": { # namespace
764    ///     "channel": "beta", # updated
765    ///     "version": "1.2.3.45" # inserted
766    ///   },
767    ///   "foo": { # namespace
768    ///     "version": "0.2", # untouched
769    ///   }
770    /// }
771    /// ```
772    ///
773    /// Note that the server will only hold at most MAX_NUM_ANNOTATIONS_PER_NAMESPACE distinct
774    /// annotation keys per namespace, picking up the latest values.
775    Upsert { data: ComponentData, responder: ComponentDataRegisterUpsertResponder },
776}
777
778impl ComponentDataRegisterRequest {
779    #[allow(irrefutable_let_patterns)]
780    pub fn into_upsert(self) -> Option<(ComponentData, ComponentDataRegisterUpsertResponder)> {
781        if let ComponentDataRegisterRequest::Upsert { data, responder } = self {
782            Some((data, responder))
783        } else {
784            None
785        }
786    }
787
788    /// Name of the method defined in FIDL
789    pub fn method_name(&self) -> &'static str {
790        match *self {
791            ComponentDataRegisterRequest::Upsert { .. } => "upsert",
792        }
793    }
794}
795
796#[derive(Debug, Clone)]
797pub struct ComponentDataRegisterControlHandle {
798    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
799}
800
801impl fidl::endpoints::ControlHandle for ComponentDataRegisterControlHandle {
802    fn shutdown(&self) {
803        self.inner.shutdown()
804    }
805
806    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
807        self.inner.shutdown_with_epitaph(status)
808    }
809
810    fn is_closed(&self) -> bool {
811        self.inner.channel().is_closed()
812    }
813    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
814        self.inner.channel().on_closed()
815    }
816
817    #[cfg(target_os = "fuchsia")]
818    fn signal_peer(
819        &self,
820        clear_mask: zx::Signals,
821        set_mask: zx::Signals,
822    ) -> Result<(), zx_status::Status> {
823        use fidl::Peered;
824        self.inner.channel().signal_peer(clear_mask, set_mask)
825    }
826}
827
828impl ComponentDataRegisterControlHandle {}
829
830#[must_use = "FIDL methods require a response to be sent"]
831#[derive(Debug)]
832pub struct ComponentDataRegisterUpsertResponder {
833    control_handle: std::mem::ManuallyDrop<ComponentDataRegisterControlHandle>,
834    tx_id: u32,
835}
836
837/// Set the the channel to be shutdown (see [`ComponentDataRegisterControlHandle::shutdown`])
838/// if the responder is dropped without sending a response, so that the client
839/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
840impl std::ops::Drop for ComponentDataRegisterUpsertResponder {
841    fn drop(&mut self) {
842        self.control_handle.shutdown();
843        // Safety: drops once, never accessed again
844        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
845    }
846}
847
848impl fidl::endpoints::Responder for ComponentDataRegisterUpsertResponder {
849    type ControlHandle = ComponentDataRegisterControlHandle;
850
851    fn control_handle(&self) -> &ComponentDataRegisterControlHandle {
852        &self.control_handle
853    }
854
855    fn drop_without_shutdown(mut self) {
856        // Safety: drops once, never accessed again due to mem::forget
857        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
858        // Prevent Drop from running (which would shut down the channel)
859        std::mem::forget(self);
860    }
861}
862
863impl ComponentDataRegisterUpsertResponder {
864    /// Sends a response to the FIDL transaction.
865    ///
866    /// Sets the channel to shutdown if an error occurs.
867    pub fn send(self) -> Result<(), fidl::Error> {
868        let _result = self.send_raw();
869        if _result.is_err() {
870            self.control_handle.shutdown();
871        }
872        self.drop_without_shutdown();
873        _result
874    }
875
876    /// Similar to "send" but does not shutdown the channel if an error occurs.
877    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
878        let _result = self.send_raw();
879        self.drop_without_shutdown();
880        _result
881    }
882
883    fn send_raw(&self) -> Result<(), fidl::Error> {
884        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
885            (),
886            self.tx_id,
887            0xa25b7c4e125c0a1,
888            fidl::encoding::DynamicFlags::empty(),
889        )
890    }
891}
892
893#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
894pub struct CrashReporterMarker;
895
896impl fidl::endpoints::ProtocolMarker for CrashReporterMarker {
897    type Proxy = CrashReporterProxy;
898    type RequestStream = CrashReporterRequestStream;
899    #[cfg(target_os = "fuchsia")]
900    type SynchronousProxy = CrashReporterSynchronousProxy;
901
902    const DEBUG_NAME: &'static str = "fuchsia.feedback.CrashReporter";
903}
904impl fidl::endpoints::DiscoverableProtocolMarker for CrashReporterMarker {}
905pub type CrashReporterFileReportResult = Result<FileReportResults, FilingError>;
906
907pub trait CrashReporterProxyInterface: Send + Sync {
908    type FileReportResponseFut: std::future::Future<Output = Result<CrashReporterFileReportResult, fidl::Error>>
909        + Send;
910    fn r#file_report(&self, report: CrashReport) -> Self::FileReportResponseFut;
911}
912#[derive(Debug)]
913#[cfg(target_os = "fuchsia")]
914pub struct CrashReporterSynchronousProxy {
915    client: fidl::client::sync::Client,
916}
917
918#[cfg(target_os = "fuchsia")]
919impl fidl::endpoints::SynchronousProxy for CrashReporterSynchronousProxy {
920    type Proxy = CrashReporterProxy;
921    type Protocol = CrashReporterMarker;
922
923    fn from_channel(inner: fidl::Channel) -> Self {
924        Self::new(inner)
925    }
926
927    fn into_channel(self) -> fidl::Channel {
928        self.client.into_channel()
929    }
930
931    fn as_channel(&self) -> &fidl::Channel {
932        self.client.as_channel()
933    }
934}
935
936#[cfg(target_os = "fuchsia")]
937impl CrashReporterSynchronousProxy {
938    pub fn new(channel: fidl::Channel) -> Self {
939        Self { client: fidl::client::sync::Client::new(channel) }
940    }
941
942    pub fn into_channel(self) -> fidl::Channel {
943        self.client.into_channel()
944    }
945
946    /// Waits until an event arrives and returns it. It is safe for other
947    /// threads to make concurrent requests while waiting for an event.
948    pub fn wait_for_event(
949        &self,
950        deadline: zx::MonotonicInstant,
951    ) -> Result<CrashReporterEvent, fidl::Error> {
952        CrashReporterEvent::decode(self.client.wait_for_event::<CrashReporterMarker>(deadline)?)
953    }
954
955    /// Files a crash `report` and gives the final result of the operation.
956    ///
957    /// This could mean generating a crash report in a local crash report
958    /// database or uploading the crash report to a remote crash server
959    /// depending on the FIDL server's configuration.
960    ///
961    /// Warning: this could potentially take up to several minutes. Calling
962    /// this function in a synchronous manner is not recommended.
963    pub fn r#file_report(
964        &self,
965        mut report: CrashReport,
966        ___deadline: zx::MonotonicInstant,
967    ) -> Result<CrashReporterFileReportResult, fidl::Error> {
968        let _response = self.client.send_query::<
969            CrashReporterFileReportRequest,
970            fidl::encoding::ResultType<CrashReporterFileReportResponse, FilingError>,
971            CrashReporterMarker,
972        >(
973            (&mut report,),
974            0x6f660f55b3160dd4,
975            fidl::encoding::DynamicFlags::empty(),
976            ___deadline,
977        )?;
978        Ok(_response.map(|x| x.results))
979    }
980}
981
982#[cfg(target_os = "fuchsia")]
983impl From<CrashReporterSynchronousProxy> for zx::NullableHandle {
984    fn from(value: CrashReporterSynchronousProxy) -> Self {
985        value.into_channel().into()
986    }
987}
988
989#[cfg(target_os = "fuchsia")]
990impl From<fidl::Channel> for CrashReporterSynchronousProxy {
991    fn from(value: fidl::Channel) -> Self {
992        Self::new(value)
993    }
994}
995
996#[cfg(target_os = "fuchsia")]
997impl fidl::endpoints::FromClient for CrashReporterSynchronousProxy {
998    type Protocol = CrashReporterMarker;
999
1000    fn from_client(value: fidl::endpoints::ClientEnd<CrashReporterMarker>) -> Self {
1001        Self::new(value.into_channel())
1002    }
1003}
1004
1005#[derive(Debug, Clone)]
1006pub struct CrashReporterProxy {
1007    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1008}
1009
1010impl fidl::endpoints::Proxy for CrashReporterProxy {
1011    type Protocol = CrashReporterMarker;
1012
1013    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1014        Self::new(inner)
1015    }
1016
1017    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1018        self.client.into_channel().map_err(|client| Self { client })
1019    }
1020
1021    fn as_channel(&self) -> &::fidl::AsyncChannel {
1022        self.client.as_channel()
1023    }
1024}
1025
1026impl CrashReporterProxy {
1027    /// Create a new Proxy for fuchsia.feedback/CrashReporter.
1028    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1029        let protocol_name = <CrashReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1030        Self { client: fidl::client::Client::new(channel, protocol_name) }
1031    }
1032
1033    /// Get a Stream of events from the remote end of the protocol.
1034    ///
1035    /// # Panics
1036    ///
1037    /// Panics if the event stream was already taken.
1038    pub fn take_event_stream(&self) -> CrashReporterEventStream {
1039        CrashReporterEventStream { event_receiver: self.client.take_event_receiver() }
1040    }
1041
1042    /// Files a crash `report` and gives the final result of the operation.
1043    ///
1044    /// This could mean generating a crash report in a local crash report
1045    /// database or uploading the crash report to a remote crash server
1046    /// depending on the FIDL server's configuration.
1047    ///
1048    /// Warning: this could potentially take up to several minutes. Calling
1049    /// this function in a synchronous manner is not recommended.
1050    pub fn r#file_report(
1051        &self,
1052        mut report: CrashReport,
1053    ) -> fidl::client::QueryResponseFut<
1054        CrashReporterFileReportResult,
1055        fidl::encoding::DefaultFuchsiaResourceDialect,
1056    > {
1057        CrashReporterProxyInterface::r#file_report(self, report)
1058    }
1059}
1060
1061impl CrashReporterProxyInterface for CrashReporterProxy {
1062    type FileReportResponseFut = fidl::client::QueryResponseFut<
1063        CrashReporterFileReportResult,
1064        fidl::encoding::DefaultFuchsiaResourceDialect,
1065    >;
1066    fn r#file_report(&self, mut report: CrashReport) -> Self::FileReportResponseFut {
1067        fn _decode(
1068            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1069        ) -> Result<CrashReporterFileReportResult, fidl::Error> {
1070            let _response = fidl::client::decode_transaction_body::<
1071                fidl::encoding::ResultType<CrashReporterFileReportResponse, FilingError>,
1072                fidl::encoding::DefaultFuchsiaResourceDialect,
1073                0x6f660f55b3160dd4,
1074            >(_buf?)?;
1075            Ok(_response.map(|x| x.results))
1076        }
1077        self.client
1078            .send_query_and_decode::<CrashReporterFileReportRequest, CrashReporterFileReportResult>(
1079                (&mut report,),
1080                0x6f660f55b3160dd4,
1081                fidl::encoding::DynamicFlags::empty(),
1082                _decode,
1083            )
1084    }
1085}
1086
1087pub struct CrashReporterEventStream {
1088    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1089}
1090
1091impl std::marker::Unpin for CrashReporterEventStream {}
1092
1093impl futures::stream::FusedStream for CrashReporterEventStream {
1094    fn is_terminated(&self) -> bool {
1095        self.event_receiver.is_terminated()
1096    }
1097}
1098
1099impl futures::Stream for CrashReporterEventStream {
1100    type Item = Result<CrashReporterEvent, fidl::Error>;
1101
1102    fn poll_next(
1103        mut self: std::pin::Pin<&mut Self>,
1104        cx: &mut std::task::Context<'_>,
1105    ) -> std::task::Poll<Option<Self::Item>> {
1106        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1107            &mut self.event_receiver,
1108            cx
1109        )?) {
1110            Some(buf) => std::task::Poll::Ready(Some(CrashReporterEvent::decode(buf))),
1111            None => std::task::Poll::Ready(None),
1112        }
1113    }
1114}
1115
1116#[derive(Debug)]
1117pub enum CrashReporterEvent {}
1118
1119impl CrashReporterEvent {
1120    /// Decodes a message buffer as a [`CrashReporterEvent`].
1121    fn decode(
1122        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1123    ) -> Result<CrashReporterEvent, fidl::Error> {
1124        let (bytes, _handles) = buf.split_mut();
1125        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1126        debug_assert_eq!(tx_header.tx_id, 0);
1127        match tx_header.ordinal {
1128            _ => Err(fidl::Error::UnknownOrdinal {
1129                ordinal: tx_header.ordinal,
1130                protocol_name: <CrashReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1131            }),
1132        }
1133    }
1134}
1135
1136/// A Stream of incoming requests for fuchsia.feedback/CrashReporter.
1137pub struct CrashReporterRequestStream {
1138    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1139    is_terminated: bool,
1140}
1141
1142impl std::marker::Unpin for CrashReporterRequestStream {}
1143
1144impl futures::stream::FusedStream for CrashReporterRequestStream {
1145    fn is_terminated(&self) -> bool {
1146        self.is_terminated
1147    }
1148}
1149
1150impl fidl::endpoints::RequestStream for CrashReporterRequestStream {
1151    type Protocol = CrashReporterMarker;
1152    type ControlHandle = CrashReporterControlHandle;
1153
1154    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1155        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1156    }
1157
1158    fn control_handle(&self) -> Self::ControlHandle {
1159        CrashReporterControlHandle { inner: self.inner.clone() }
1160    }
1161
1162    fn into_inner(
1163        self,
1164    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1165    {
1166        (self.inner, self.is_terminated)
1167    }
1168
1169    fn from_inner(
1170        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1171        is_terminated: bool,
1172    ) -> Self {
1173        Self { inner, is_terminated }
1174    }
1175}
1176
1177impl futures::Stream for CrashReporterRequestStream {
1178    type Item = Result<CrashReporterRequest, fidl::Error>;
1179
1180    fn poll_next(
1181        mut self: std::pin::Pin<&mut Self>,
1182        cx: &mut std::task::Context<'_>,
1183    ) -> std::task::Poll<Option<Self::Item>> {
1184        let this = &mut *self;
1185        if this.inner.check_shutdown(cx) {
1186            this.is_terminated = true;
1187            return std::task::Poll::Ready(None);
1188        }
1189        if this.is_terminated {
1190            panic!("polled CrashReporterRequestStream after completion");
1191        }
1192        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1193            |bytes, handles| {
1194                match this.inner.channel().read_etc(cx, bytes, handles) {
1195                    std::task::Poll::Ready(Ok(())) => {}
1196                    std::task::Poll::Pending => return std::task::Poll::Pending,
1197                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1198                        this.is_terminated = true;
1199                        return std::task::Poll::Ready(None);
1200                    }
1201                    std::task::Poll::Ready(Err(e)) => {
1202                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1203                            e.into(),
1204                        ))));
1205                    }
1206                }
1207
1208                // A message has been received from the channel
1209                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1210
1211                std::task::Poll::Ready(Some(match header.ordinal {
1212                    0x6f660f55b3160dd4 => {
1213                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1214                        let mut req = fidl::new_empty!(
1215                            CrashReporterFileReportRequest,
1216                            fidl::encoding::DefaultFuchsiaResourceDialect
1217                        );
1218                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CrashReporterFileReportRequest>(&header, _body_bytes, handles, &mut req)?;
1219                        let control_handle =
1220                            CrashReporterControlHandle { inner: this.inner.clone() };
1221                        Ok(CrashReporterRequest::FileReport {
1222                            report: req.report,
1223
1224                            responder: CrashReporterFileReportResponder {
1225                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1226                                tx_id: header.tx_id,
1227                            },
1228                        })
1229                    }
1230                    _ => Err(fidl::Error::UnknownOrdinal {
1231                        ordinal: header.ordinal,
1232                        protocol_name:
1233                            <CrashReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1234                    }),
1235                }))
1236            },
1237        )
1238    }
1239}
1240
1241/// Provides the ability to file crash reports.
1242#[derive(Debug)]
1243pub enum CrashReporterRequest {
1244    /// Files a crash `report` and gives the final result of the operation.
1245    ///
1246    /// This could mean generating a crash report in a local crash report
1247    /// database or uploading the crash report to a remote crash server
1248    /// depending on the FIDL server's configuration.
1249    ///
1250    /// Warning: this could potentially take up to several minutes. Calling
1251    /// this function in a synchronous manner is not recommended.
1252    FileReport { report: CrashReport, responder: CrashReporterFileReportResponder },
1253}
1254
1255impl CrashReporterRequest {
1256    #[allow(irrefutable_let_patterns)]
1257    pub fn into_file_report(self) -> Option<(CrashReport, CrashReporterFileReportResponder)> {
1258        if let CrashReporterRequest::FileReport { report, responder } = self {
1259            Some((report, responder))
1260        } else {
1261            None
1262        }
1263    }
1264
1265    /// Name of the method defined in FIDL
1266    pub fn method_name(&self) -> &'static str {
1267        match *self {
1268            CrashReporterRequest::FileReport { .. } => "file_report",
1269        }
1270    }
1271}
1272
1273#[derive(Debug, Clone)]
1274pub struct CrashReporterControlHandle {
1275    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1276}
1277
1278impl fidl::endpoints::ControlHandle for CrashReporterControlHandle {
1279    fn shutdown(&self) {
1280        self.inner.shutdown()
1281    }
1282
1283    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1284        self.inner.shutdown_with_epitaph(status)
1285    }
1286
1287    fn is_closed(&self) -> bool {
1288        self.inner.channel().is_closed()
1289    }
1290    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1291        self.inner.channel().on_closed()
1292    }
1293
1294    #[cfg(target_os = "fuchsia")]
1295    fn signal_peer(
1296        &self,
1297        clear_mask: zx::Signals,
1298        set_mask: zx::Signals,
1299    ) -> Result<(), zx_status::Status> {
1300        use fidl::Peered;
1301        self.inner.channel().signal_peer(clear_mask, set_mask)
1302    }
1303}
1304
1305impl CrashReporterControlHandle {}
1306
1307#[must_use = "FIDL methods require a response to be sent"]
1308#[derive(Debug)]
1309pub struct CrashReporterFileReportResponder {
1310    control_handle: std::mem::ManuallyDrop<CrashReporterControlHandle>,
1311    tx_id: u32,
1312}
1313
1314/// Set the the channel to be shutdown (see [`CrashReporterControlHandle::shutdown`])
1315/// if the responder is dropped without sending a response, so that the client
1316/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1317impl std::ops::Drop for CrashReporterFileReportResponder {
1318    fn drop(&mut self) {
1319        self.control_handle.shutdown();
1320        // Safety: drops once, never accessed again
1321        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1322    }
1323}
1324
1325impl fidl::endpoints::Responder for CrashReporterFileReportResponder {
1326    type ControlHandle = CrashReporterControlHandle;
1327
1328    fn control_handle(&self) -> &CrashReporterControlHandle {
1329        &self.control_handle
1330    }
1331
1332    fn drop_without_shutdown(mut self) {
1333        // Safety: drops once, never accessed again due to mem::forget
1334        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1335        // Prevent Drop from running (which would shut down the channel)
1336        std::mem::forget(self);
1337    }
1338}
1339
1340impl CrashReporterFileReportResponder {
1341    /// Sends a response to the FIDL transaction.
1342    ///
1343    /// Sets the channel to shutdown if an error occurs.
1344    pub fn send(
1345        self,
1346        mut result: Result<&FileReportResults, FilingError>,
1347    ) -> Result<(), fidl::Error> {
1348        let _result = self.send_raw(result);
1349        if _result.is_err() {
1350            self.control_handle.shutdown();
1351        }
1352        self.drop_without_shutdown();
1353        _result
1354    }
1355
1356    /// Similar to "send" but does not shutdown the channel if an error occurs.
1357    pub fn send_no_shutdown_on_err(
1358        self,
1359        mut result: Result<&FileReportResults, FilingError>,
1360    ) -> Result<(), fidl::Error> {
1361        let _result = self.send_raw(result);
1362        self.drop_without_shutdown();
1363        _result
1364    }
1365
1366    fn send_raw(
1367        &self,
1368        mut result: Result<&FileReportResults, FilingError>,
1369    ) -> Result<(), fidl::Error> {
1370        self.control_handle.inner.send::<fidl::encoding::ResultType<
1371            CrashReporterFileReportResponse,
1372            FilingError,
1373        >>(
1374            result.map(|results| (results,)),
1375            self.tx_id,
1376            0x6f660f55b3160dd4,
1377            fidl::encoding::DynamicFlags::empty(),
1378        )
1379    }
1380}
1381
1382#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1383pub struct CrashReportingProductRegisterMarker;
1384
1385impl fidl::endpoints::ProtocolMarker for CrashReportingProductRegisterMarker {
1386    type Proxy = CrashReportingProductRegisterProxy;
1387    type RequestStream = CrashReportingProductRegisterRequestStream;
1388    #[cfg(target_os = "fuchsia")]
1389    type SynchronousProxy = CrashReportingProductRegisterSynchronousProxy;
1390
1391    const DEBUG_NAME: &'static str = "fuchsia.feedback.CrashReportingProductRegister";
1392}
1393impl fidl::endpoints::DiscoverableProtocolMarker for CrashReportingProductRegisterMarker {}
1394
1395pub trait CrashReportingProductRegisterProxyInterface: Send + Sync {
1396    fn r#upsert(
1397        &self,
1398        component_url: &str,
1399        product: &CrashReportingProduct,
1400    ) -> Result<(), fidl::Error>;
1401    type UpsertWithAckResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1402    fn r#upsert_with_ack(
1403        &self,
1404        component_url: &str,
1405        product: &CrashReportingProduct,
1406    ) -> Self::UpsertWithAckResponseFut;
1407}
1408#[derive(Debug)]
1409#[cfg(target_os = "fuchsia")]
1410pub struct CrashReportingProductRegisterSynchronousProxy {
1411    client: fidl::client::sync::Client,
1412}
1413
1414#[cfg(target_os = "fuchsia")]
1415impl fidl::endpoints::SynchronousProxy for CrashReportingProductRegisterSynchronousProxy {
1416    type Proxy = CrashReportingProductRegisterProxy;
1417    type Protocol = CrashReportingProductRegisterMarker;
1418
1419    fn from_channel(inner: fidl::Channel) -> Self {
1420        Self::new(inner)
1421    }
1422
1423    fn into_channel(self) -> fidl::Channel {
1424        self.client.into_channel()
1425    }
1426
1427    fn as_channel(&self) -> &fidl::Channel {
1428        self.client.as_channel()
1429    }
1430}
1431
1432#[cfg(target_os = "fuchsia")]
1433impl CrashReportingProductRegisterSynchronousProxy {
1434    pub fn new(channel: fidl::Channel) -> Self {
1435        Self { client: fidl::client::sync::Client::new(channel) }
1436    }
1437
1438    pub fn into_channel(self) -> fidl::Channel {
1439        self.client.into_channel()
1440    }
1441
1442    /// Waits until an event arrives and returns it. It is safe for other
1443    /// threads to make concurrent requests while waiting for an event.
1444    pub fn wait_for_event(
1445        &self,
1446        deadline: zx::MonotonicInstant,
1447    ) -> Result<CrashReportingProductRegisterEvent, fidl::Error> {
1448        CrashReportingProductRegisterEvent::decode(
1449            self.client.wait_for_event::<CrashReportingProductRegisterMarker>(deadline)?,
1450        )
1451    }
1452
1453    /// Upserts, i.e. updates or inserts, a crash reporting product for a given component URL.
1454    ///
1455    /// A subsequent call to Upsert() for the same component URL overwrites the
1456    /// `CrashReportingProduct` for that component.
1457    ///
1458    /// Prefer UpsertWithAck() if the component also files crash reports itself, to avoid race
1459    /// conditions and mis-attribution.
1460    pub fn r#upsert(
1461        &self,
1462        mut component_url: &str,
1463        mut product: &CrashReportingProduct,
1464    ) -> Result<(), fidl::Error> {
1465        self.client.send::<CrashReportingProductRegisterUpsertRequest>(
1466            (component_url, product),
1467            0x668cdc9615c91d7f,
1468            fidl::encoding::DynamicFlags::empty(),
1469        )
1470    }
1471
1472    /// Upserts (see above) and notifies the client when the operation is complete.
1473    ///
1474    /// This allows clients to prevent races between filing crash reports and calls to Upsert.
1475    /// Otherwise if a crash report is filed before the upsert completes, the crash report will be
1476    /// attributed to the wrong product, leading to potentially incorrect crash data.
1477    pub fn r#upsert_with_ack(
1478        &self,
1479        mut component_url: &str,
1480        mut product: &CrashReportingProduct,
1481        ___deadline: zx::MonotonicInstant,
1482    ) -> Result<(), fidl::Error> {
1483        let _response = self.client.send_query::<
1484            CrashReportingProductRegisterUpsertWithAckRequest,
1485            fidl::encoding::EmptyPayload,
1486            CrashReportingProductRegisterMarker,
1487        >(
1488            (component_url, product,),
1489            0x4a4f1279b3439c9d,
1490            fidl::encoding::DynamicFlags::empty(),
1491            ___deadline,
1492        )?;
1493        Ok(_response)
1494    }
1495}
1496
1497#[cfg(target_os = "fuchsia")]
1498impl From<CrashReportingProductRegisterSynchronousProxy> for zx::NullableHandle {
1499    fn from(value: CrashReportingProductRegisterSynchronousProxy) -> Self {
1500        value.into_channel().into()
1501    }
1502}
1503
1504#[cfg(target_os = "fuchsia")]
1505impl From<fidl::Channel> for CrashReportingProductRegisterSynchronousProxy {
1506    fn from(value: fidl::Channel) -> Self {
1507        Self::new(value)
1508    }
1509}
1510
1511#[cfg(target_os = "fuchsia")]
1512impl fidl::endpoints::FromClient for CrashReportingProductRegisterSynchronousProxy {
1513    type Protocol = CrashReportingProductRegisterMarker;
1514
1515    fn from_client(value: fidl::endpoints::ClientEnd<CrashReportingProductRegisterMarker>) -> Self {
1516        Self::new(value.into_channel())
1517    }
1518}
1519
1520#[derive(Debug, Clone)]
1521pub struct CrashReportingProductRegisterProxy {
1522    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1523}
1524
1525impl fidl::endpoints::Proxy for CrashReportingProductRegisterProxy {
1526    type Protocol = CrashReportingProductRegisterMarker;
1527
1528    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1529        Self::new(inner)
1530    }
1531
1532    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1533        self.client.into_channel().map_err(|client| Self { client })
1534    }
1535
1536    fn as_channel(&self) -> &::fidl::AsyncChannel {
1537        self.client.as_channel()
1538    }
1539}
1540
1541impl CrashReportingProductRegisterProxy {
1542    /// Create a new Proxy for fuchsia.feedback/CrashReportingProductRegister.
1543    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1544        let protocol_name =
1545            <CrashReportingProductRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1546        Self { client: fidl::client::Client::new(channel, protocol_name) }
1547    }
1548
1549    /// Get a Stream of events from the remote end of the protocol.
1550    ///
1551    /// # Panics
1552    ///
1553    /// Panics if the event stream was already taken.
1554    pub fn take_event_stream(&self) -> CrashReportingProductRegisterEventStream {
1555        CrashReportingProductRegisterEventStream {
1556            event_receiver: self.client.take_event_receiver(),
1557        }
1558    }
1559
1560    /// Upserts, i.e. updates or inserts, a crash reporting product for a given component URL.
1561    ///
1562    /// A subsequent call to Upsert() for the same component URL overwrites the
1563    /// `CrashReportingProduct` for that component.
1564    ///
1565    /// Prefer UpsertWithAck() if the component also files crash reports itself, to avoid race
1566    /// conditions and mis-attribution.
1567    pub fn r#upsert(
1568        &self,
1569        mut component_url: &str,
1570        mut product: &CrashReportingProduct,
1571    ) -> Result<(), fidl::Error> {
1572        CrashReportingProductRegisterProxyInterface::r#upsert(self, component_url, product)
1573    }
1574
1575    /// Upserts (see above) and notifies the client when the operation is complete.
1576    ///
1577    /// This allows clients to prevent races between filing crash reports and calls to Upsert.
1578    /// Otherwise if a crash report is filed before the upsert completes, the crash report will be
1579    /// attributed to the wrong product, leading to potentially incorrect crash data.
1580    pub fn r#upsert_with_ack(
1581        &self,
1582        mut component_url: &str,
1583        mut product: &CrashReportingProduct,
1584    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1585        CrashReportingProductRegisterProxyInterface::r#upsert_with_ack(self, component_url, product)
1586    }
1587}
1588
1589impl CrashReportingProductRegisterProxyInterface for CrashReportingProductRegisterProxy {
1590    fn r#upsert(
1591        &self,
1592        mut component_url: &str,
1593        mut product: &CrashReportingProduct,
1594    ) -> Result<(), fidl::Error> {
1595        self.client.send::<CrashReportingProductRegisterUpsertRequest>(
1596            (component_url, product),
1597            0x668cdc9615c91d7f,
1598            fidl::encoding::DynamicFlags::empty(),
1599        )
1600    }
1601
1602    type UpsertWithAckResponseFut =
1603        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1604    fn r#upsert_with_ack(
1605        &self,
1606        mut component_url: &str,
1607        mut product: &CrashReportingProduct,
1608    ) -> Self::UpsertWithAckResponseFut {
1609        fn _decode(
1610            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1611        ) -> Result<(), fidl::Error> {
1612            let _response = fidl::client::decode_transaction_body::<
1613                fidl::encoding::EmptyPayload,
1614                fidl::encoding::DefaultFuchsiaResourceDialect,
1615                0x4a4f1279b3439c9d,
1616            >(_buf?)?;
1617            Ok(_response)
1618        }
1619        self.client.send_query_and_decode::<CrashReportingProductRegisterUpsertWithAckRequest, ()>(
1620            (component_url, product),
1621            0x4a4f1279b3439c9d,
1622            fidl::encoding::DynamicFlags::empty(),
1623            _decode,
1624        )
1625    }
1626}
1627
1628pub struct CrashReportingProductRegisterEventStream {
1629    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1630}
1631
1632impl std::marker::Unpin for CrashReportingProductRegisterEventStream {}
1633
1634impl futures::stream::FusedStream for CrashReportingProductRegisterEventStream {
1635    fn is_terminated(&self) -> bool {
1636        self.event_receiver.is_terminated()
1637    }
1638}
1639
1640impl futures::Stream for CrashReportingProductRegisterEventStream {
1641    type Item = Result<CrashReportingProductRegisterEvent, fidl::Error>;
1642
1643    fn poll_next(
1644        mut self: std::pin::Pin<&mut Self>,
1645        cx: &mut std::task::Context<'_>,
1646    ) -> std::task::Poll<Option<Self::Item>> {
1647        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1648            &mut self.event_receiver,
1649            cx
1650        )?) {
1651            Some(buf) => {
1652                std::task::Poll::Ready(Some(CrashReportingProductRegisterEvent::decode(buf)))
1653            }
1654            None => std::task::Poll::Ready(None),
1655        }
1656    }
1657}
1658
1659#[derive(Debug)]
1660pub enum CrashReportingProductRegisterEvent {}
1661
1662impl CrashReportingProductRegisterEvent {
1663    /// Decodes a message buffer as a [`CrashReportingProductRegisterEvent`].
1664    fn decode(
1665        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1666    ) -> Result<CrashReportingProductRegisterEvent, fidl::Error> {
1667        let (bytes, _handles) = buf.split_mut();
1668        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1669        debug_assert_eq!(tx_header.tx_id, 0);
1670        match tx_header.ordinal {
1671            _ => Err(fidl::Error::UnknownOrdinal {
1672                ordinal: tx_header.ordinal,
1673                protocol_name: <CrashReportingProductRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1674            })
1675        }
1676    }
1677}
1678
1679/// A Stream of incoming requests for fuchsia.feedback/CrashReportingProductRegister.
1680pub struct CrashReportingProductRegisterRequestStream {
1681    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1682    is_terminated: bool,
1683}
1684
1685impl std::marker::Unpin for CrashReportingProductRegisterRequestStream {}
1686
1687impl futures::stream::FusedStream for CrashReportingProductRegisterRequestStream {
1688    fn is_terminated(&self) -> bool {
1689        self.is_terminated
1690    }
1691}
1692
1693impl fidl::endpoints::RequestStream for CrashReportingProductRegisterRequestStream {
1694    type Protocol = CrashReportingProductRegisterMarker;
1695    type ControlHandle = CrashReportingProductRegisterControlHandle;
1696
1697    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1698        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1699    }
1700
1701    fn control_handle(&self) -> Self::ControlHandle {
1702        CrashReportingProductRegisterControlHandle { inner: self.inner.clone() }
1703    }
1704
1705    fn into_inner(
1706        self,
1707    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1708    {
1709        (self.inner, self.is_terminated)
1710    }
1711
1712    fn from_inner(
1713        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1714        is_terminated: bool,
1715    ) -> Self {
1716        Self { inner, is_terminated }
1717    }
1718}
1719
1720impl futures::Stream for CrashReportingProductRegisterRequestStream {
1721    type Item = Result<CrashReportingProductRegisterRequest, fidl::Error>;
1722
1723    fn poll_next(
1724        mut self: std::pin::Pin<&mut Self>,
1725        cx: &mut std::task::Context<'_>,
1726    ) -> std::task::Poll<Option<Self::Item>> {
1727        let this = &mut *self;
1728        if this.inner.check_shutdown(cx) {
1729            this.is_terminated = true;
1730            return std::task::Poll::Ready(None);
1731        }
1732        if this.is_terminated {
1733            panic!("polled CrashReportingProductRegisterRequestStream after completion");
1734        }
1735        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1736            |bytes, handles| {
1737                match this.inner.channel().read_etc(cx, bytes, handles) {
1738                    std::task::Poll::Ready(Ok(())) => {}
1739                    std::task::Poll::Pending => return std::task::Poll::Pending,
1740                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1741                        this.is_terminated = true;
1742                        return std::task::Poll::Ready(None);
1743                    }
1744                    std::task::Poll::Ready(Err(e)) => {
1745                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1746                            e.into(),
1747                        ))));
1748                    }
1749                }
1750
1751                // A message has been received from the channel
1752                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1753
1754                std::task::Poll::Ready(Some(match header.ordinal {
1755                0x668cdc9615c91d7f => {
1756                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1757                    let mut req = fidl::new_empty!(CrashReportingProductRegisterUpsertRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1758                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CrashReportingProductRegisterUpsertRequest>(&header, _body_bytes, handles, &mut req)?;
1759                    let control_handle = CrashReportingProductRegisterControlHandle {
1760                        inner: this.inner.clone(),
1761                    };
1762                    Ok(CrashReportingProductRegisterRequest::Upsert {component_url: req.component_url,
1763product: req.product,
1764
1765                        control_handle,
1766                    })
1767                }
1768                0x4a4f1279b3439c9d => {
1769                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1770                    let mut req = fidl::new_empty!(CrashReportingProductRegisterUpsertWithAckRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1771                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CrashReportingProductRegisterUpsertWithAckRequest>(&header, _body_bytes, handles, &mut req)?;
1772                    let control_handle = CrashReportingProductRegisterControlHandle {
1773                        inner: this.inner.clone(),
1774                    };
1775                    Ok(CrashReportingProductRegisterRequest::UpsertWithAck {component_url: req.component_url,
1776product: req.product,
1777
1778                        responder: CrashReportingProductRegisterUpsertWithAckResponder {
1779                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1780                            tx_id: header.tx_id,
1781                        },
1782                    })
1783                }
1784                _ => Err(fidl::Error::UnknownOrdinal {
1785                    ordinal: header.ordinal,
1786                    protocol_name: <CrashReportingProductRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1787                }),
1788            }))
1789            },
1790        )
1791    }
1792}
1793
1794/// Allows a component to choose a different crash reporting product to file crashes for that
1795/// component under.
1796///
1797/// By default, all crashes detected by the platform are filed under a single product on the crash
1798/// server. This API allows components to choose their own product while still benefiting from the
1799/// platform's exception handling and crash reporting.
1800#[derive(Debug)]
1801pub enum CrashReportingProductRegisterRequest {
1802    /// Upserts, i.e. updates or inserts, a crash reporting product for a given component URL.
1803    ///
1804    /// A subsequent call to Upsert() for the same component URL overwrites the
1805    /// `CrashReportingProduct` for that component.
1806    ///
1807    /// Prefer UpsertWithAck() if the component also files crash reports itself, to avoid race
1808    /// conditions and mis-attribution.
1809    Upsert {
1810        component_url: String,
1811        product: CrashReportingProduct,
1812        control_handle: CrashReportingProductRegisterControlHandle,
1813    },
1814    /// Upserts (see above) and notifies the client when the operation is complete.
1815    ///
1816    /// This allows clients to prevent races between filing crash reports and calls to Upsert.
1817    /// Otherwise if a crash report is filed before the upsert completes, the crash report will be
1818    /// attributed to the wrong product, leading to potentially incorrect crash data.
1819    UpsertWithAck {
1820        component_url: String,
1821        product: CrashReportingProduct,
1822        responder: CrashReportingProductRegisterUpsertWithAckResponder,
1823    },
1824}
1825
1826impl CrashReportingProductRegisterRequest {
1827    #[allow(irrefutable_let_patterns)]
1828    pub fn into_upsert(
1829        self,
1830    ) -> Option<(String, CrashReportingProduct, CrashReportingProductRegisterControlHandle)> {
1831        if let CrashReportingProductRegisterRequest::Upsert {
1832            component_url,
1833            product,
1834            control_handle,
1835        } = self
1836        {
1837            Some((component_url, product, control_handle))
1838        } else {
1839            None
1840        }
1841    }
1842
1843    #[allow(irrefutable_let_patterns)]
1844    pub fn into_upsert_with_ack(
1845        self,
1846    ) -> Option<(String, CrashReportingProduct, CrashReportingProductRegisterUpsertWithAckResponder)>
1847    {
1848        if let CrashReportingProductRegisterRequest::UpsertWithAck {
1849            component_url,
1850            product,
1851            responder,
1852        } = self
1853        {
1854            Some((component_url, product, responder))
1855        } else {
1856            None
1857        }
1858    }
1859
1860    /// Name of the method defined in FIDL
1861    pub fn method_name(&self) -> &'static str {
1862        match *self {
1863            CrashReportingProductRegisterRequest::Upsert { .. } => "upsert",
1864            CrashReportingProductRegisterRequest::UpsertWithAck { .. } => "upsert_with_ack",
1865        }
1866    }
1867}
1868
1869#[derive(Debug, Clone)]
1870pub struct CrashReportingProductRegisterControlHandle {
1871    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1872}
1873
1874impl fidl::endpoints::ControlHandle for CrashReportingProductRegisterControlHandle {
1875    fn shutdown(&self) {
1876        self.inner.shutdown()
1877    }
1878
1879    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1880        self.inner.shutdown_with_epitaph(status)
1881    }
1882
1883    fn is_closed(&self) -> bool {
1884        self.inner.channel().is_closed()
1885    }
1886    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1887        self.inner.channel().on_closed()
1888    }
1889
1890    #[cfg(target_os = "fuchsia")]
1891    fn signal_peer(
1892        &self,
1893        clear_mask: zx::Signals,
1894        set_mask: zx::Signals,
1895    ) -> Result<(), zx_status::Status> {
1896        use fidl::Peered;
1897        self.inner.channel().signal_peer(clear_mask, set_mask)
1898    }
1899}
1900
1901impl CrashReportingProductRegisterControlHandle {}
1902
1903#[must_use = "FIDL methods require a response to be sent"]
1904#[derive(Debug)]
1905pub struct CrashReportingProductRegisterUpsertWithAckResponder {
1906    control_handle: std::mem::ManuallyDrop<CrashReportingProductRegisterControlHandle>,
1907    tx_id: u32,
1908}
1909
1910/// Set the the channel to be shutdown (see [`CrashReportingProductRegisterControlHandle::shutdown`])
1911/// if the responder is dropped without sending a response, so that the client
1912/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1913impl std::ops::Drop for CrashReportingProductRegisterUpsertWithAckResponder {
1914    fn drop(&mut self) {
1915        self.control_handle.shutdown();
1916        // Safety: drops once, never accessed again
1917        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1918    }
1919}
1920
1921impl fidl::endpoints::Responder for CrashReportingProductRegisterUpsertWithAckResponder {
1922    type ControlHandle = CrashReportingProductRegisterControlHandle;
1923
1924    fn control_handle(&self) -> &CrashReportingProductRegisterControlHandle {
1925        &self.control_handle
1926    }
1927
1928    fn drop_without_shutdown(mut self) {
1929        // Safety: drops once, never accessed again due to mem::forget
1930        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1931        // Prevent Drop from running (which would shut down the channel)
1932        std::mem::forget(self);
1933    }
1934}
1935
1936impl CrashReportingProductRegisterUpsertWithAckResponder {
1937    /// Sends a response to the FIDL transaction.
1938    ///
1939    /// Sets the channel to shutdown if an error occurs.
1940    pub fn send(self) -> Result<(), fidl::Error> {
1941        let _result = self.send_raw();
1942        if _result.is_err() {
1943            self.control_handle.shutdown();
1944        }
1945        self.drop_without_shutdown();
1946        _result
1947    }
1948
1949    /// Similar to "send" but does not shutdown the channel if an error occurs.
1950    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1951        let _result = self.send_raw();
1952        self.drop_without_shutdown();
1953        _result
1954    }
1955
1956    fn send_raw(&self) -> Result<(), fidl::Error> {
1957        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1958            (),
1959            self.tx_id,
1960            0x4a4f1279b3439c9d,
1961            fidl::encoding::DynamicFlags::empty(),
1962        )
1963    }
1964}
1965
1966#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1967pub struct DataProviderMarker;
1968
1969impl fidl::endpoints::ProtocolMarker for DataProviderMarker {
1970    type Proxy = DataProviderProxy;
1971    type RequestStream = DataProviderRequestStream;
1972    #[cfg(target_os = "fuchsia")]
1973    type SynchronousProxy = DataProviderSynchronousProxy;
1974
1975    const DEBUG_NAME: &'static str = "fuchsia.feedback.DataProvider";
1976}
1977impl fidl::endpoints::DiscoverableProtocolMarker for DataProviderMarker {}
1978
1979pub trait DataProviderProxyInterface: Send + Sync {
1980    type GetSnapshotResponseFut: std::future::Future<Output = Result<Snapshot, fidl::Error>> + Send;
1981    fn r#get_snapshot(&self, params: GetSnapshotParameters) -> Self::GetSnapshotResponseFut;
1982    type GetAnnotationsResponseFut: std::future::Future<Output = Result<Annotations, fidl::Error>>
1983        + Send;
1984    fn r#get_annotations(
1985        &self,
1986        params: &GetAnnotationsParameters,
1987    ) -> Self::GetAnnotationsResponseFut;
1988}
1989#[derive(Debug)]
1990#[cfg(target_os = "fuchsia")]
1991pub struct DataProviderSynchronousProxy {
1992    client: fidl::client::sync::Client,
1993}
1994
1995#[cfg(target_os = "fuchsia")]
1996impl fidl::endpoints::SynchronousProxy for DataProviderSynchronousProxy {
1997    type Proxy = DataProviderProxy;
1998    type Protocol = DataProviderMarker;
1999
2000    fn from_channel(inner: fidl::Channel) -> Self {
2001        Self::new(inner)
2002    }
2003
2004    fn into_channel(self) -> fidl::Channel {
2005        self.client.into_channel()
2006    }
2007
2008    fn as_channel(&self) -> &fidl::Channel {
2009        self.client.as_channel()
2010    }
2011}
2012
2013#[cfg(target_os = "fuchsia")]
2014impl DataProviderSynchronousProxy {
2015    pub fn new(channel: fidl::Channel) -> Self {
2016        Self { client: fidl::client::sync::Client::new(channel) }
2017    }
2018
2019    pub fn into_channel(self) -> fidl::Channel {
2020        self.client.into_channel()
2021    }
2022
2023    /// Waits until an event arrives and returns it. It is safe for other
2024    /// threads to make concurrent requests while waiting for an event.
2025    pub fn wait_for_event(
2026        &self,
2027        deadline: zx::MonotonicInstant,
2028    ) -> Result<DataProviderEvent, fidl::Error> {
2029        DataProviderEvent::decode(self.client.wait_for_event::<DataProviderMarker>(deadline)?)
2030    }
2031
2032    /// Returns a snapshot of the device's state.
2033    ///
2034    /// `snapshot` may be empty if there was an issue generating the snapshot.
2035    pub fn r#get_snapshot(
2036        &self,
2037        mut params: GetSnapshotParameters,
2038        ___deadline: zx::MonotonicInstant,
2039    ) -> Result<Snapshot, fidl::Error> {
2040        let _response = self.client.send_query::<
2041            DataProviderGetSnapshotRequest,
2042            DataProviderGetSnapshotResponse,
2043            DataProviderMarker,
2044        >(
2045            (&mut params,),
2046            0x753649a04e5d0bc0,
2047            fidl::encoding::DynamicFlags::empty(),
2048            ___deadline,
2049        )?;
2050        Ok(_response.snapshot)
2051    }
2052
2053    /// Returns a set of annotations about the device's state.
2054    ///
2055    /// `annotations` may be empty if there was an issue collecting them.
2056    ///
2057    /// These are the same annotations as provided through GetSnapshot() - some clients only want
2058    /// the annotations while others want both the annotations and the snapshot and generating the
2059    /// snapshot can take significantly more time than collecting the annotations, e.g., logs are
2060    /// only part of the snapshot and not part of the annotations and can take some time.
2061    pub fn r#get_annotations(
2062        &self,
2063        mut params: &GetAnnotationsParameters,
2064        ___deadline: zx::MonotonicInstant,
2065    ) -> Result<Annotations, fidl::Error> {
2066        let _response = self.client.send_query::<
2067            DataProviderGetAnnotationsRequest,
2068            DataProviderGetAnnotationsResponse,
2069            DataProviderMarker,
2070        >(
2071            (params,),
2072            0x367b4b6afe4345d8,
2073            fidl::encoding::DynamicFlags::empty(),
2074            ___deadline,
2075        )?;
2076        Ok(_response.annotations)
2077    }
2078}
2079
2080#[cfg(target_os = "fuchsia")]
2081impl From<DataProviderSynchronousProxy> for zx::NullableHandle {
2082    fn from(value: DataProviderSynchronousProxy) -> Self {
2083        value.into_channel().into()
2084    }
2085}
2086
2087#[cfg(target_os = "fuchsia")]
2088impl From<fidl::Channel> for DataProviderSynchronousProxy {
2089    fn from(value: fidl::Channel) -> Self {
2090        Self::new(value)
2091    }
2092}
2093
2094#[cfg(target_os = "fuchsia")]
2095impl fidl::endpoints::FromClient for DataProviderSynchronousProxy {
2096    type Protocol = DataProviderMarker;
2097
2098    fn from_client(value: fidl::endpoints::ClientEnd<DataProviderMarker>) -> Self {
2099        Self::new(value.into_channel())
2100    }
2101}
2102
2103#[derive(Debug, Clone)]
2104pub struct DataProviderProxy {
2105    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2106}
2107
2108impl fidl::endpoints::Proxy for DataProviderProxy {
2109    type Protocol = DataProviderMarker;
2110
2111    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2112        Self::new(inner)
2113    }
2114
2115    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2116        self.client.into_channel().map_err(|client| Self { client })
2117    }
2118
2119    fn as_channel(&self) -> &::fidl::AsyncChannel {
2120        self.client.as_channel()
2121    }
2122}
2123
2124impl DataProviderProxy {
2125    /// Create a new Proxy for fuchsia.feedback/DataProvider.
2126    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2127        let protocol_name = <DataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2128        Self { client: fidl::client::Client::new(channel, protocol_name) }
2129    }
2130
2131    /// Get a Stream of events from the remote end of the protocol.
2132    ///
2133    /// # Panics
2134    ///
2135    /// Panics if the event stream was already taken.
2136    pub fn take_event_stream(&self) -> DataProviderEventStream {
2137        DataProviderEventStream { event_receiver: self.client.take_event_receiver() }
2138    }
2139
2140    /// Returns a snapshot of the device's state.
2141    ///
2142    /// `snapshot` may be empty if there was an issue generating the snapshot.
2143    pub fn r#get_snapshot(
2144        &self,
2145        mut params: GetSnapshotParameters,
2146    ) -> fidl::client::QueryResponseFut<Snapshot, fidl::encoding::DefaultFuchsiaResourceDialect>
2147    {
2148        DataProviderProxyInterface::r#get_snapshot(self, params)
2149    }
2150
2151    /// Returns a set of annotations about the device's state.
2152    ///
2153    /// `annotations` may be empty if there was an issue collecting them.
2154    ///
2155    /// These are the same annotations as provided through GetSnapshot() - some clients only want
2156    /// the annotations while others want both the annotations and the snapshot and generating the
2157    /// snapshot can take significantly more time than collecting the annotations, e.g., logs are
2158    /// only part of the snapshot and not part of the annotations and can take some time.
2159    pub fn r#get_annotations(
2160        &self,
2161        mut params: &GetAnnotationsParameters,
2162    ) -> fidl::client::QueryResponseFut<Annotations, fidl::encoding::DefaultFuchsiaResourceDialect>
2163    {
2164        DataProviderProxyInterface::r#get_annotations(self, params)
2165    }
2166}
2167
2168impl DataProviderProxyInterface for DataProviderProxy {
2169    type GetSnapshotResponseFut =
2170        fidl::client::QueryResponseFut<Snapshot, fidl::encoding::DefaultFuchsiaResourceDialect>;
2171    fn r#get_snapshot(&self, mut params: GetSnapshotParameters) -> Self::GetSnapshotResponseFut {
2172        fn _decode(
2173            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2174        ) -> Result<Snapshot, fidl::Error> {
2175            let _response = fidl::client::decode_transaction_body::<
2176                DataProviderGetSnapshotResponse,
2177                fidl::encoding::DefaultFuchsiaResourceDialect,
2178                0x753649a04e5d0bc0,
2179            >(_buf?)?;
2180            Ok(_response.snapshot)
2181        }
2182        self.client.send_query_and_decode::<DataProviderGetSnapshotRequest, Snapshot>(
2183            (&mut params,),
2184            0x753649a04e5d0bc0,
2185            fidl::encoding::DynamicFlags::empty(),
2186            _decode,
2187        )
2188    }
2189
2190    type GetAnnotationsResponseFut =
2191        fidl::client::QueryResponseFut<Annotations, fidl::encoding::DefaultFuchsiaResourceDialect>;
2192    fn r#get_annotations(
2193        &self,
2194        mut params: &GetAnnotationsParameters,
2195    ) -> Self::GetAnnotationsResponseFut {
2196        fn _decode(
2197            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2198        ) -> Result<Annotations, fidl::Error> {
2199            let _response = fidl::client::decode_transaction_body::<
2200                DataProviderGetAnnotationsResponse,
2201                fidl::encoding::DefaultFuchsiaResourceDialect,
2202                0x367b4b6afe4345d8,
2203            >(_buf?)?;
2204            Ok(_response.annotations)
2205        }
2206        self.client.send_query_and_decode::<DataProviderGetAnnotationsRequest, Annotations>(
2207            (params,),
2208            0x367b4b6afe4345d8,
2209            fidl::encoding::DynamicFlags::empty(),
2210            _decode,
2211        )
2212    }
2213}
2214
2215pub struct DataProviderEventStream {
2216    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2217}
2218
2219impl std::marker::Unpin for DataProviderEventStream {}
2220
2221impl futures::stream::FusedStream for DataProviderEventStream {
2222    fn is_terminated(&self) -> bool {
2223        self.event_receiver.is_terminated()
2224    }
2225}
2226
2227impl futures::Stream for DataProviderEventStream {
2228    type Item = Result<DataProviderEvent, fidl::Error>;
2229
2230    fn poll_next(
2231        mut self: std::pin::Pin<&mut Self>,
2232        cx: &mut std::task::Context<'_>,
2233    ) -> std::task::Poll<Option<Self::Item>> {
2234        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2235            &mut self.event_receiver,
2236            cx
2237        )?) {
2238            Some(buf) => std::task::Poll::Ready(Some(DataProviderEvent::decode(buf))),
2239            None => std::task::Poll::Ready(None),
2240        }
2241    }
2242}
2243
2244#[derive(Debug)]
2245pub enum DataProviderEvent {}
2246
2247impl DataProviderEvent {
2248    /// Decodes a message buffer as a [`DataProviderEvent`].
2249    fn decode(
2250        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2251    ) -> Result<DataProviderEvent, fidl::Error> {
2252        let (bytes, _handles) = buf.split_mut();
2253        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2254        debug_assert_eq!(tx_header.tx_id, 0);
2255        match tx_header.ordinal {
2256            _ => Err(fidl::Error::UnknownOrdinal {
2257                ordinal: tx_header.ordinal,
2258                protocol_name: <DataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2259            }),
2260        }
2261    }
2262}
2263
2264/// A Stream of incoming requests for fuchsia.feedback/DataProvider.
2265pub struct DataProviderRequestStream {
2266    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2267    is_terminated: bool,
2268}
2269
2270impl std::marker::Unpin for DataProviderRequestStream {}
2271
2272impl futures::stream::FusedStream for DataProviderRequestStream {
2273    fn is_terminated(&self) -> bool {
2274        self.is_terminated
2275    }
2276}
2277
2278impl fidl::endpoints::RequestStream for DataProviderRequestStream {
2279    type Protocol = DataProviderMarker;
2280    type ControlHandle = DataProviderControlHandle;
2281
2282    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2283        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2284    }
2285
2286    fn control_handle(&self) -> Self::ControlHandle {
2287        DataProviderControlHandle { inner: self.inner.clone() }
2288    }
2289
2290    fn into_inner(
2291        self,
2292    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2293    {
2294        (self.inner, self.is_terminated)
2295    }
2296
2297    fn from_inner(
2298        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2299        is_terminated: bool,
2300    ) -> Self {
2301        Self { inner, is_terminated }
2302    }
2303}
2304
2305impl futures::Stream for DataProviderRequestStream {
2306    type Item = Result<DataProviderRequest, fidl::Error>;
2307
2308    fn poll_next(
2309        mut self: std::pin::Pin<&mut Self>,
2310        cx: &mut std::task::Context<'_>,
2311    ) -> std::task::Poll<Option<Self::Item>> {
2312        let this = &mut *self;
2313        if this.inner.check_shutdown(cx) {
2314            this.is_terminated = true;
2315            return std::task::Poll::Ready(None);
2316        }
2317        if this.is_terminated {
2318            panic!("polled DataProviderRequestStream after completion");
2319        }
2320        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2321            |bytes, handles| {
2322                match this.inner.channel().read_etc(cx, bytes, handles) {
2323                    std::task::Poll::Ready(Ok(())) => {}
2324                    std::task::Poll::Pending => return std::task::Poll::Pending,
2325                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2326                        this.is_terminated = true;
2327                        return std::task::Poll::Ready(None);
2328                    }
2329                    std::task::Poll::Ready(Err(e)) => {
2330                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2331                            e.into(),
2332                        ))));
2333                    }
2334                }
2335
2336                // A message has been received from the channel
2337                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2338
2339                std::task::Poll::Ready(Some(match header.ordinal {
2340                    0x753649a04e5d0bc0 => {
2341                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2342                        let mut req = fidl::new_empty!(
2343                            DataProviderGetSnapshotRequest,
2344                            fidl::encoding::DefaultFuchsiaResourceDialect
2345                        );
2346                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataProviderGetSnapshotRequest>(&header, _body_bytes, handles, &mut req)?;
2347                        let control_handle =
2348                            DataProviderControlHandle { inner: this.inner.clone() };
2349                        Ok(DataProviderRequest::GetSnapshot {
2350                            params: req.params,
2351
2352                            responder: DataProviderGetSnapshotResponder {
2353                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2354                                tx_id: header.tx_id,
2355                            },
2356                        })
2357                    }
2358                    0x367b4b6afe4345d8 => {
2359                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2360                        let mut req = fidl::new_empty!(
2361                            DataProviderGetAnnotationsRequest,
2362                            fidl::encoding::DefaultFuchsiaResourceDialect
2363                        );
2364                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataProviderGetAnnotationsRequest>(&header, _body_bytes, handles, &mut req)?;
2365                        let control_handle =
2366                            DataProviderControlHandle { inner: this.inner.clone() };
2367                        Ok(DataProviderRequest::GetAnnotations {
2368                            params: req.params,
2369
2370                            responder: DataProviderGetAnnotationsResponder {
2371                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2372                                tx_id: header.tx_id,
2373                            },
2374                        })
2375                    }
2376                    _ => Err(fidl::Error::UnknownOrdinal {
2377                        ordinal: header.ordinal,
2378                        protocol_name:
2379                            <DataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2380                    }),
2381                }))
2382            },
2383        )
2384    }
2385}
2386
2387/// Provides data useful to attach to feedback reports, e.g., a crash report filed by the system, a
2388/// user feedback report filed by a user or a bug report filed by a developer.
2389#[derive(Debug)]
2390pub enum DataProviderRequest {
2391    /// Returns a snapshot of the device's state.
2392    ///
2393    /// `snapshot` may be empty if there was an issue generating the snapshot.
2394    GetSnapshot { params: GetSnapshotParameters, responder: DataProviderGetSnapshotResponder },
2395    /// Returns a set of annotations about the device's state.
2396    ///
2397    /// `annotations` may be empty if there was an issue collecting them.
2398    ///
2399    /// These are the same annotations as provided through GetSnapshot() - some clients only want
2400    /// the annotations while others want both the annotations and the snapshot and generating the
2401    /// snapshot can take significantly more time than collecting the annotations, e.g., logs are
2402    /// only part of the snapshot and not part of the annotations and can take some time.
2403    GetAnnotations {
2404        params: GetAnnotationsParameters,
2405        responder: DataProviderGetAnnotationsResponder,
2406    },
2407}
2408
2409impl DataProviderRequest {
2410    #[allow(irrefutable_let_patterns)]
2411    pub fn into_get_snapshot(
2412        self,
2413    ) -> Option<(GetSnapshotParameters, DataProviderGetSnapshotResponder)> {
2414        if let DataProviderRequest::GetSnapshot { params, responder } = self {
2415            Some((params, responder))
2416        } else {
2417            None
2418        }
2419    }
2420
2421    #[allow(irrefutable_let_patterns)]
2422    pub fn into_get_annotations(
2423        self,
2424    ) -> Option<(GetAnnotationsParameters, DataProviderGetAnnotationsResponder)> {
2425        if let DataProviderRequest::GetAnnotations { params, responder } = self {
2426            Some((params, responder))
2427        } else {
2428            None
2429        }
2430    }
2431
2432    /// Name of the method defined in FIDL
2433    pub fn method_name(&self) -> &'static str {
2434        match *self {
2435            DataProviderRequest::GetSnapshot { .. } => "get_snapshot",
2436            DataProviderRequest::GetAnnotations { .. } => "get_annotations",
2437        }
2438    }
2439}
2440
2441#[derive(Debug, Clone)]
2442pub struct DataProviderControlHandle {
2443    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2444}
2445
2446impl fidl::endpoints::ControlHandle for DataProviderControlHandle {
2447    fn shutdown(&self) {
2448        self.inner.shutdown()
2449    }
2450
2451    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2452        self.inner.shutdown_with_epitaph(status)
2453    }
2454
2455    fn is_closed(&self) -> bool {
2456        self.inner.channel().is_closed()
2457    }
2458    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2459        self.inner.channel().on_closed()
2460    }
2461
2462    #[cfg(target_os = "fuchsia")]
2463    fn signal_peer(
2464        &self,
2465        clear_mask: zx::Signals,
2466        set_mask: zx::Signals,
2467    ) -> Result<(), zx_status::Status> {
2468        use fidl::Peered;
2469        self.inner.channel().signal_peer(clear_mask, set_mask)
2470    }
2471}
2472
2473impl DataProviderControlHandle {}
2474
2475#[must_use = "FIDL methods require a response to be sent"]
2476#[derive(Debug)]
2477pub struct DataProviderGetSnapshotResponder {
2478    control_handle: std::mem::ManuallyDrop<DataProviderControlHandle>,
2479    tx_id: u32,
2480}
2481
2482/// Set the the channel to be shutdown (see [`DataProviderControlHandle::shutdown`])
2483/// if the responder is dropped without sending a response, so that the client
2484/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2485impl std::ops::Drop for DataProviderGetSnapshotResponder {
2486    fn drop(&mut self) {
2487        self.control_handle.shutdown();
2488        // Safety: drops once, never accessed again
2489        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2490    }
2491}
2492
2493impl fidl::endpoints::Responder for DataProviderGetSnapshotResponder {
2494    type ControlHandle = DataProviderControlHandle;
2495
2496    fn control_handle(&self) -> &DataProviderControlHandle {
2497        &self.control_handle
2498    }
2499
2500    fn drop_without_shutdown(mut self) {
2501        // Safety: drops once, never accessed again due to mem::forget
2502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2503        // Prevent Drop from running (which would shut down the channel)
2504        std::mem::forget(self);
2505    }
2506}
2507
2508impl DataProviderGetSnapshotResponder {
2509    /// Sends a response to the FIDL transaction.
2510    ///
2511    /// Sets the channel to shutdown if an error occurs.
2512    pub fn send(self, mut snapshot: Snapshot) -> Result<(), fidl::Error> {
2513        let _result = self.send_raw(snapshot);
2514        if _result.is_err() {
2515            self.control_handle.shutdown();
2516        }
2517        self.drop_without_shutdown();
2518        _result
2519    }
2520
2521    /// Similar to "send" but does not shutdown the channel if an error occurs.
2522    pub fn send_no_shutdown_on_err(self, mut snapshot: Snapshot) -> Result<(), fidl::Error> {
2523        let _result = self.send_raw(snapshot);
2524        self.drop_without_shutdown();
2525        _result
2526    }
2527
2528    fn send_raw(&self, mut snapshot: Snapshot) -> Result<(), fidl::Error> {
2529        self.control_handle.inner.send::<DataProviderGetSnapshotResponse>(
2530            (&mut snapshot,),
2531            self.tx_id,
2532            0x753649a04e5d0bc0,
2533            fidl::encoding::DynamicFlags::empty(),
2534        )
2535    }
2536}
2537
2538#[must_use = "FIDL methods require a response to be sent"]
2539#[derive(Debug)]
2540pub struct DataProviderGetAnnotationsResponder {
2541    control_handle: std::mem::ManuallyDrop<DataProviderControlHandle>,
2542    tx_id: u32,
2543}
2544
2545/// Set the the channel to be shutdown (see [`DataProviderControlHandle::shutdown`])
2546/// if the responder is dropped without sending a response, so that the client
2547/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2548impl std::ops::Drop for DataProviderGetAnnotationsResponder {
2549    fn drop(&mut self) {
2550        self.control_handle.shutdown();
2551        // Safety: drops once, never accessed again
2552        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2553    }
2554}
2555
2556impl fidl::endpoints::Responder for DataProviderGetAnnotationsResponder {
2557    type ControlHandle = DataProviderControlHandle;
2558
2559    fn control_handle(&self) -> &DataProviderControlHandle {
2560        &self.control_handle
2561    }
2562
2563    fn drop_without_shutdown(mut self) {
2564        // Safety: drops once, never accessed again due to mem::forget
2565        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2566        // Prevent Drop from running (which would shut down the channel)
2567        std::mem::forget(self);
2568    }
2569}
2570
2571impl DataProviderGetAnnotationsResponder {
2572    /// Sends a response to the FIDL transaction.
2573    ///
2574    /// Sets the channel to shutdown if an error occurs.
2575    pub fn send(self, mut annotations: &Annotations) -> Result<(), fidl::Error> {
2576        let _result = self.send_raw(annotations);
2577        if _result.is_err() {
2578            self.control_handle.shutdown();
2579        }
2580        self.drop_without_shutdown();
2581        _result
2582    }
2583
2584    /// Similar to "send" but does not shutdown the channel if an error occurs.
2585    pub fn send_no_shutdown_on_err(self, mut annotations: &Annotations) -> Result<(), fidl::Error> {
2586        let _result = self.send_raw(annotations);
2587        self.drop_without_shutdown();
2588        _result
2589    }
2590
2591    fn send_raw(&self, mut annotations: &Annotations) -> Result<(), fidl::Error> {
2592        self.control_handle.inner.send::<DataProviderGetAnnotationsResponse>(
2593            (annotations,),
2594            self.tx_id,
2595            0x367b4b6afe4345d8,
2596            fidl::encoding::DynamicFlags::empty(),
2597        )
2598    }
2599}
2600
2601#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2602pub struct DeviceIdProviderMarker;
2603
2604impl fidl::endpoints::ProtocolMarker for DeviceIdProviderMarker {
2605    type Proxy = DeviceIdProviderProxy;
2606    type RequestStream = DeviceIdProviderRequestStream;
2607    #[cfg(target_os = "fuchsia")]
2608    type SynchronousProxy = DeviceIdProviderSynchronousProxy;
2609
2610    const DEBUG_NAME: &'static str = "fuchsia.feedback.DeviceIdProvider";
2611}
2612impl fidl::endpoints::DiscoverableProtocolMarker for DeviceIdProviderMarker {}
2613
2614pub trait DeviceIdProviderProxyInterface: Send + Sync {
2615    type GetIdResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
2616    fn r#get_id(&self) -> Self::GetIdResponseFut;
2617}
2618#[derive(Debug)]
2619#[cfg(target_os = "fuchsia")]
2620pub struct DeviceIdProviderSynchronousProxy {
2621    client: fidl::client::sync::Client,
2622}
2623
2624#[cfg(target_os = "fuchsia")]
2625impl fidl::endpoints::SynchronousProxy for DeviceIdProviderSynchronousProxy {
2626    type Proxy = DeviceIdProviderProxy;
2627    type Protocol = DeviceIdProviderMarker;
2628
2629    fn from_channel(inner: fidl::Channel) -> Self {
2630        Self::new(inner)
2631    }
2632
2633    fn into_channel(self) -> fidl::Channel {
2634        self.client.into_channel()
2635    }
2636
2637    fn as_channel(&self) -> &fidl::Channel {
2638        self.client.as_channel()
2639    }
2640}
2641
2642#[cfg(target_os = "fuchsia")]
2643impl DeviceIdProviderSynchronousProxy {
2644    pub fn new(channel: fidl::Channel) -> Self {
2645        Self { client: fidl::client::sync::Client::new(channel) }
2646    }
2647
2648    pub fn into_channel(self) -> fidl::Channel {
2649        self.client.into_channel()
2650    }
2651
2652    /// Waits until an event arrives and returns it. It is safe for other
2653    /// threads to make concurrent requests while waiting for an event.
2654    pub fn wait_for_event(
2655        &self,
2656        deadline: zx::MonotonicInstant,
2657    ) -> Result<DeviceIdProviderEvent, fidl::Error> {
2658        DeviceIdProviderEvent::decode(
2659            self.client.wait_for_event::<DeviceIdProviderMarker>(deadline)?,
2660        )
2661    }
2662
2663    /// Returns the device's feedback ID.
2664    ///
2665    /// This method follows the hanging-get pattern and won't return a value until the ID since the
2666    /// last call has changed.
2667    pub fn r#get_id(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
2668        let _response = self.client.send_query::<
2669            fidl::encoding::EmptyPayload,
2670            DeviceIdProviderGetIdResponse,
2671            DeviceIdProviderMarker,
2672        >(
2673            (),
2674            0xea7f28a243488dc,
2675            fidl::encoding::DynamicFlags::empty(),
2676            ___deadline,
2677        )?;
2678        Ok(_response.feedback_id)
2679    }
2680}
2681
2682#[cfg(target_os = "fuchsia")]
2683impl From<DeviceIdProviderSynchronousProxy> for zx::NullableHandle {
2684    fn from(value: DeviceIdProviderSynchronousProxy) -> Self {
2685        value.into_channel().into()
2686    }
2687}
2688
2689#[cfg(target_os = "fuchsia")]
2690impl From<fidl::Channel> for DeviceIdProviderSynchronousProxy {
2691    fn from(value: fidl::Channel) -> Self {
2692        Self::new(value)
2693    }
2694}
2695
2696#[cfg(target_os = "fuchsia")]
2697impl fidl::endpoints::FromClient for DeviceIdProviderSynchronousProxy {
2698    type Protocol = DeviceIdProviderMarker;
2699
2700    fn from_client(value: fidl::endpoints::ClientEnd<DeviceIdProviderMarker>) -> Self {
2701        Self::new(value.into_channel())
2702    }
2703}
2704
2705#[derive(Debug, Clone)]
2706pub struct DeviceIdProviderProxy {
2707    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2708}
2709
2710impl fidl::endpoints::Proxy for DeviceIdProviderProxy {
2711    type Protocol = DeviceIdProviderMarker;
2712
2713    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2714        Self::new(inner)
2715    }
2716
2717    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2718        self.client.into_channel().map_err(|client| Self { client })
2719    }
2720
2721    fn as_channel(&self) -> &::fidl::AsyncChannel {
2722        self.client.as_channel()
2723    }
2724}
2725
2726impl DeviceIdProviderProxy {
2727    /// Create a new Proxy for fuchsia.feedback/DeviceIdProvider.
2728    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2729        let protocol_name = <DeviceIdProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2730        Self { client: fidl::client::Client::new(channel, protocol_name) }
2731    }
2732
2733    /// Get a Stream of events from the remote end of the protocol.
2734    ///
2735    /// # Panics
2736    ///
2737    /// Panics if the event stream was already taken.
2738    pub fn take_event_stream(&self) -> DeviceIdProviderEventStream {
2739        DeviceIdProviderEventStream { event_receiver: self.client.take_event_receiver() }
2740    }
2741
2742    /// Returns the device's feedback ID.
2743    ///
2744    /// This method follows the hanging-get pattern and won't return a value until the ID since the
2745    /// last call has changed.
2746    pub fn r#get_id(
2747        &self,
2748    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
2749        DeviceIdProviderProxyInterface::r#get_id(self)
2750    }
2751}
2752
2753impl DeviceIdProviderProxyInterface for DeviceIdProviderProxy {
2754    type GetIdResponseFut =
2755        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
2756    fn r#get_id(&self) -> Self::GetIdResponseFut {
2757        fn _decode(
2758            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2759        ) -> Result<String, fidl::Error> {
2760            let _response = fidl::client::decode_transaction_body::<
2761                DeviceIdProviderGetIdResponse,
2762                fidl::encoding::DefaultFuchsiaResourceDialect,
2763                0xea7f28a243488dc,
2764            >(_buf?)?;
2765            Ok(_response.feedback_id)
2766        }
2767        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
2768            (),
2769            0xea7f28a243488dc,
2770            fidl::encoding::DynamicFlags::empty(),
2771            _decode,
2772        )
2773    }
2774}
2775
2776pub struct DeviceIdProviderEventStream {
2777    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2778}
2779
2780impl std::marker::Unpin for DeviceIdProviderEventStream {}
2781
2782impl futures::stream::FusedStream for DeviceIdProviderEventStream {
2783    fn is_terminated(&self) -> bool {
2784        self.event_receiver.is_terminated()
2785    }
2786}
2787
2788impl futures::Stream for DeviceIdProviderEventStream {
2789    type Item = Result<DeviceIdProviderEvent, fidl::Error>;
2790
2791    fn poll_next(
2792        mut self: std::pin::Pin<&mut Self>,
2793        cx: &mut std::task::Context<'_>,
2794    ) -> std::task::Poll<Option<Self::Item>> {
2795        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2796            &mut self.event_receiver,
2797            cx
2798        )?) {
2799            Some(buf) => std::task::Poll::Ready(Some(DeviceIdProviderEvent::decode(buf))),
2800            None => std::task::Poll::Ready(None),
2801        }
2802    }
2803}
2804
2805#[derive(Debug)]
2806pub enum DeviceIdProviderEvent {}
2807
2808impl DeviceIdProviderEvent {
2809    /// Decodes a message buffer as a [`DeviceIdProviderEvent`].
2810    fn decode(
2811        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2812    ) -> Result<DeviceIdProviderEvent, fidl::Error> {
2813        let (bytes, _handles) = buf.split_mut();
2814        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2815        debug_assert_eq!(tx_header.tx_id, 0);
2816        match tx_header.ordinal {
2817            _ => Err(fidl::Error::UnknownOrdinal {
2818                ordinal: tx_header.ordinal,
2819                protocol_name:
2820                    <DeviceIdProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2821            }),
2822        }
2823    }
2824}
2825
2826/// A Stream of incoming requests for fuchsia.feedback/DeviceIdProvider.
2827pub struct DeviceIdProviderRequestStream {
2828    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2829    is_terminated: bool,
2830}
2831
2832impl std::marker::Unpin for DeviceIdProviderRequestStream {}
2833
2834impl futures::stream::FusedStream for DeviceIdProviderRequestStream {
2835    fn is_terminated(&self) -> bool {
2836        self.is_terminated
2837    }
2838}
2839
2840impl fidl::endpoints::RequestStream for DeviceIdProviderRequestStream {
2841    type Protocol = DeviceIdProviderMarker;
2842    type ControlHandle = DeviceIdProviderControlHandle;
2843
2844    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2845        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2846    }
2847
2848    fn control_handle(&self) -> Self::ControlHandle {
2849        DeviceIdProviderControlHandle { inner: self.inner.clone() }
2850    }
2851
2852    fn into_inner(
2853        self,
2854    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2855    {
2856        (self.inner, self.is_terminated)
2857    }
2858
2859    fn from_inner(
2860        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2861        is_terminated: bool,
2862    ) -> Self {
2863        Self { inner, is_terminated }
2864    }
2865}
2866
2867impl futures::Stream for DeviceIdProviderRequestStream {
2868    type Item = Result<DeviceIdProviderRequest, fidl::Error>;
2869
2870    fn poll_next(
2871        mut self: std::pin::Pin<&mut Self>,
2872        cx: &mut std::task::Context<'_>,
2873    ) -> std::task::Poll<Option<Self::Item>> {
2874        let this = &mut *self;
2875        if this.inner.check_shutdown(cx) {
2876            this.is_terminated = true;
2877            return std::task::Poll::Ready(None);
2878        }
2879        if this.is_terminated {
2880            panic!("polled DeviceIdProviderRequestStream after completion");
2881        }
2882        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2883            |bytes, handles| {
2884                match this.inner.channel().read_etc(cx, bytes, handles) {
2885                    std::task::Poll::Ready(Ok(())) => {}
2886                    std::task::Poll::Pending => return std::task::Poll::Pending,
2887                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2888                        this.is_terminated = true;
2889                        return std::task::Poll::Ready(None);
2890                    }
2891                    std::task::Poll::Ready(Err(e)) => {
2892                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2893                            e.into(),
2894                        ))));
2895                    }
2896                }
2897
2898                // A message has been received from the channel
2899                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2900
2901                std::task::Poll::Ready(Some(match header.ordinal {
2902                    0xea7f28a243488dc => {
2903                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2904                        let mut req = fidl::new_empty!(
2905                            fidl::encoding::EmptyPayload,
2906                            fidl::encoding::DefaultFuchsiaResourceDialect
2907                        );
2908                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2909                        let control_handle =
2910                            DeviceIdProviderControlHandle { inner: this.inner.clone() };
2911                        Ok(DeviceIdProviderRequest::GetId {
2912                            responder: DeviceIdProviderGetIdResponder {
2913                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2914                                tx_id: header.tx_id,
2915                            },
2916                        })
2917                    }
2918                    _ => Err(fidl::Error::UnknownOrdinal {
2919                        ordinal: header.ordinal,
2920                        protocol_name:
2921                            <DeviceIdProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2922                    }),
2923                }))
2924            },
2925        )
2926    }
2927}
2928
2929/// Provides the device's feedback ID.
2930///
2931/// The feedback ID is a persisted UUID used to group feedback reports. The ID
2932/// is not intended to be used for any reporting purposes other than feedback,
2933/// e.g., not intended to be used for telemetry.
2934#[derive(Debug)]
2935pub enum DeviceIdProviderRequest {
2936    /// Returns the device's feedback ID.
2937    ///
2938    /// This method follows the hanging-get pattern and won't return a value until the ID since the
2939    /// last call has changed.
2940    GetId { responder: DeviceIdProviderGetIdResponder },
2941}
2942
2943impl DeviceIdProviderRequest {
2944    #[allow(irrefutable_let_patterns)]
2945    pub fn into_get_id(self) -> Option<(DeviceIdProviderGetIdResponder)> {
2946        if let DeviceIdProviderRequest::GetId { responder } = self {
2947            Some((responder))
2948        } else {
2949            None
2950        }
2951    }
2952
2953    /// Name of the method defined in FIDL
2954    pub fn method_name(&self) -> &'static str {
2955        match *self {
2956            DeviceIdProviderRequest::GetId { .. } => "get_id",
2957        }
2958    }
2959}
2960
2961#[derive(Debug, Clone)]
2962pub struct DeviceIdProviderControlHandle {
2963    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2964}
2965
2966impl fidl::endpoints::ControlHandle for DeviceIdProviderControlHandle {
2967    fn shutdown(&self) {
2968        self.inner.shutdown()
2969    }
2970
2971    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2972        self.inner.shutdown_with_epitaph(status)
2973    }
2974
2975    fn is_closed(&self) -> bool {
2976        self.inner.channel().is_closed()
2977    }
2978    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2979        self.inner.channel().on_closed()
2980    }
2981
2982    #[cfg(target_os = "fuchsia")]
2983    fn signal_peer(
2984        &self,
2985        clear_mask: zx::Signals,
2986        set_mask: zx::Signals,
2987    ) -> Result<(), zx_status::Status> {
2988        use fidl::Peered;
2989        self.inner.channel().signal_peer(clear_mask, set_mask)
2990    }
2991}
2992
2993impl DeviceIdProviderControlHandle {}
2994
2995#[must_use = "FIDL methods require a response to be sent"]
2996#[derive(Debug)]
2997pub struct DeviceIdProviderGetIdResponder {
2998    control_handle: std::mem::ManuallyDrop<DeviceIdProviderControlHandle>,
2999    tx_id: u32,
3000}
3001
3002/// Set the the channel to be shutdown (see [`DeviceIdProviderControlHandle::shutdown`])
3003/// if the responder is dropped without sending a response, so that the client
3004/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3005impl std::ops::Drop for DeviceIdProviderGetIdResponder {
3006    fn drop(&mut self) {
3007        self.control_handle.shutdown();
3008        // Safety: drops once, never accessed again
3009        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3010    }
3011}
3012
3013impl fidl::endpoints::Responder for DeviceIdProviderGetIdResponder {
3014    type ControlHandle = DeviceIdProviderControlHandle;
3015
3016    fn control_handle(&self) -> &DeviceIdProviderControlHandle {
3017        &self.control_handle
3018    }
3019
3020    fn drop_without_shutdown(mut self) {
3021        // Safety: drops once, never accessed again due to mem::forget
3022        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3023        // Prevent Drop from running (which would shut down the channel)
3024        std::mem::forget(self);
3025    }
3026}
3027
3028impl DeviceIdProviderGetIdResponder {
3029    /// Sends a response to the FIDL transaction.
3030    ///
3031    /// Sets the channel to shutdown if an error occurs.
3032    pub fn send(self, mut feedback_id: &str) -> Result<(), fidl::Error> {
3033        let _result = self.send_raw(feedback_id);
3034        if _result.is_err() {
3035            self.control_handle.shutdown();
3036        }
3037        self.drop_without_shutdown();
3038        _result
3039    }
3040
3041    /// Similar to "send" but does not shutdown the channel if an error occurs.
3042    pub fn send_no_shutdown_on_err(self, mut feedback_id: &str) -> Result<(), fidl::Error> {
3043        let _result = self.send_raw(feedback_id);
3044        self.drop_without_shutdown();
3045        _result
3046    }
3047
3048    fn send_raw(&self, mut feedback_id: &str) -> Result<(), fidl::Error> {
3049        self.control_handle.inner.send::<DeviceIdProviderGetIdResponse>(
3050            (feedback_id,),
3051            self.tx_id,
3052            0xea7f28a243488dc,
3053            fidl::encoding::DynamicFlags::empty(),
3054        )
3055    }
3056}
3057
3058#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3059pub struct LastRebootInfoProviderMarker;
3060
3061impl fidl::endpoints::ProtocolMarker for LastRebootInfoProviderMarker {
3062    type Proxy = LastRebootInfoProviderProxy;
3063    type RequestStream = LastRebootInfoProviderRequestStream;
3064    #[cfg(target_os = "fuchsia")]
3065    type SynchronousProxy = LastRebootInfoProviderSynchronousProxy;
3066
3067    const DEBUG_NAME: &'static str = "fuchsia.feedback.LastRebootInfoProvider";
3068}
3069impl fidl::endpoints::DiscoverableProtocolMarker for LastRebootInfoProviderMarker {}
3070
3071pub trait LastRebootInfoProviderProxyInterface: Send + Sync {
3072    type GetResponseFut: std::future::Future<Output = Result<LastReboot, fidl::Error>> + Send;
3073    fn r#get(&self) -> Self::GetResponseFut;
3074}
3075#[derive(Debug)]
3076#[cfg(target_os = "fuchsia")]
3077pub struct LastRebootInfoProviderSynchronousProxy {
3078    client: fidl::client::sync::Client,
3079}
3080
3081#[cfg(target_os = "fuchsia")]
3082impl fidl::endpoints::SynchronousProxy for LastRebootInfoProviderSynchronousProxy {
3083    type Proxy = LastRebootInfoProviderProxy;
3084    type Protocol = LastRebootInfoProviderMarker;
3085
3086    fn from_channel(inner: fidl::Channel) -> Self {
3087        Self::new(inner)
3088    }
3089
3090    fn into_channel(self) -> fidl::Channel {
3091        self.client.into_channel()
3092    }
3093
3094    fn as_channel(&self) -> &fidl::Channel {
3095        self.client.as_channel()
3096    }
3097}
3098
3099#[cfg(target_os = "fuchsia")]
3100impl LastRebootInfoProviderSynchronousProxy {
3101    pub fn new(channel: fidl::Channel) -> Self {
3102        Self { client: fidl::client::sync::Client::new(channel) }
3103    }
3104
3105    pub fn into_channel(self) -> fidl::Channel {
3106        self.client.into_channel()
3107    }
3108
3109    /// Waits until an event arrives and returns it. It is safe for other
3110    /// threads to make concurrent requests while waiting for an event.
3111    pub fn wait_for_event(
3112        &self,
3113        deadline: zx::MonotonicInstant,
3114    ) -> Result<LastRebootInfoProviderEvent, fidl::Error> {
3115        LastRebootInfoProviderEvent::decode(
3116            self.client.wait_for_event::<LastRebootInfoProviderMarker>(deadline)?,
3117        )
3118    }
3119
3120    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<LastReboot, fidl::Error> {
3121        let _response = self.client.send_query::<
3122            fidl::encoding::EmptyPayload,
3123            LastRebootInfoProviderGetResponse,
3124            LastRebootInfoProviderMarker,
3125        >(
3126            (),
3127            0xbc32d10e081ffac,
3128            fidl::encoding::DynamicFlags::empty(),
3129            ___deadline,
3130        )?;
3131        Ok(_response.last_reboot)
3132    }
3133}
3134
3135#[cfg(target_os = "fuchsia")]
3136impl From<LastRebootInfoProviderSynchronousProxy> for zx::NullableHandle {
3137    fn from(value: LastRebootInfoProviderSynchronousProxy) -> Self {
3138        value.into_channel().into()
3139    }
3140}
3141
3142#[cfg(target_os = "fuchsia")]
3143impl From<fidl::Channel> for LastRebootInfoProviderSynchronousProxy {
3144    fn from(value: fidl::Channel) -> Self {
3145        Self::new(value)
3146    }
3147}
3148
3149#[cfg(target_os = "fuchsia")]
3150impl fidl::endpoints::FromClient for LastRebootInfoProviderSynchronousProxy {
3151    type Protocol = LastRebootInfoProviderMarker;
3152
3153    fn from_client(value: fidl::endpoints::ClientEnd<LastRebootInfoProviderMarker>) -> Self {
3154        Self::new(value.into_channel())
3155    }
3156}
3157
3158#[derive(Debug, Clone)]
3159pub struct LastRebootInfoProviderProxy {
3160    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3161}
3162
3163impl fidl::endpoints::Proxy for LastRebootInfoProviderProxy {
3164    type Protocol = LastRebootInfoProviderMarker;
3165
3166    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3167        Self::new(inner)
3168    }
3169
3170    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3171        self.client.into_channel().map_err(|client| Self { client })
3172    }
3173
3174    fn as_channel(&self) -> &::fidl::AsyncChannel {
3175        self.client.as_channel()
3176    }
3177}
3178
3179impl LastRebootInfoProviderProxy {
3180    /// Create a new Proxy for fuchsia.feedback/LastRebootInfoProvider.
3181    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3182        let protocol_name =
3183            <LastRebootInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3184        Self { client: fidl::client::Client::new(channel, protocol_name) }
3185    }
3186
3187    /// Get a Stream of events from the remote end of the protocol.
3188    ///
3189    /// # Panics
3190    ///
3191    /// Panics if the event stream was already taken.
3192    pub fn take_event_stream(&self) -> LastRebootInfoProviderEventStream {
3193        LastRebootInfoProviderEventStream { event_receiver: self.client.take_event_receiver() }
3194    }
3195
3196    pub fn r#get(
3197        &self,
3198    ) -> fidl::client::QueryResponseFut<LastReboot, fidl::encoding::DefaultFuchsiaResourceDialect>
3199    {
3200        LastRebootInfoProviderProxyInterface::r#get(self)
3201    }
3202}
3203
3204impl LastRebootInfoProviderProxyInterface for LastRebootInfoProviderProxy {
3205    type GetResponseFut =
3206        fidl::client::QueryResponseFut<LastReboot, fidl::encoding::DefaultFuchsiaResourceDialect>;
3207    fn r#get(&self) -> Self::GetResponseFut {
3208        fn _decode(
3209            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3210        ) -> Result<LastReboot, fidl::Error> {
3211            let _response = fidl::client::decode_transaction_body::<
3212                LastRebootInfoProviderGetResponse,
3213                fidl::encoding::DefaultFuchsiaResourceDialect,
3214                0xbc32d10e081ffac,
3215            >(_buf?)?;
3216            Ok(_response.last_reboot)
3217        }
3218        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LastReboot>(
3219            (),
3220            0xbc32d10e081ffac,
3221            fidl::encoding::DynamicFlags::empty(),
3222            _decode,
3223        )
3224    }
3225}
3226
3227pub struct LastRebootInfoProviderEventStream {
3228    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3229}
3230
3231impl std::marker::Unpin for LastRebootInfoProviderEventStream {}
3232
3233impl futures::stream::FusedStream for LastRebootInfoProviderEventStream {
3234    fn is_terminated(&self) -> bool {
3235        self.event_receiver.is_terminated()
3236    }
3237}
3238
3239impl futures::Stream for LastRebootInfoProviderEventStream {
3240    type Item = Result<LastRebootInfoProviderEvent, fidl::Error>;
3241
3242    fn poll_next(
3243        mut self: std::pin::Pin<&mut Self>,
3244        cx: &mut std::task::Context<'_>,
3245    ) -> std::task::Poll<Option<Self::Item>> {
3246        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3247            &mut self.event_receiver,
3248            cx
3249        )?) {
3250            Some(buf) => std::task::Poll::Ready(Some(LastRebootInfoProviderEvent::decode(buf))),
3251            None => std::task::Poll::Ready(None),
3252        }
3253    }
3254}
3255
3256#[derive(Debug)]
3257pub enum LastRebootInfoProviderEvent {}
3258
3259impl LastRebootInfoProviderEvent {
3260    /// Decodes a message buffer as a [`LastRebootInfoProviderEvent`].
3261    fn decode(
3262        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3263    ) -> Result<LastRebootInfoProviderEvent, fidl::Error> {
3264        let (bytes, _handles) = buf.split_mut();
3265        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3266        debug_assert_eq!(tx_header.tx_id, 0);
3267        match tx_header.ordinal {
3268            _ => Err(fidl::Error::UnknownOrdinal {
3269                ordinal: tx_header.ordinal,
3270                protocol_name:
3271                    <LastRebootInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3272            }),
3273        }
3274    }
3275}
3276
3277/// A Stream of incoming requests for fuchsia.feedback/LastRebootInfoProvider.
3278pub struct LastRebootInfoProviderRequestStream {
3279    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3280    is_terminated: bool,
3281}
3282
3283impl std::marker::Unpin for LastRebootInfoProviderRequestStream {}
3284
3285impl futures::stream::FusedStream for LastRebootInfoProviderRequestStream {
3286    fn is_terminated(&self) -> bool {
3287        self.is_terminated
3288    }
3289}
3290
3291impl fidl::endpoints::RequestStream for LastRebootInfoProviderRequestStream {
3292    type Protocol = LastRebootInfoProviderMarker;
3293    type ControlHandle = LastRebootInfoProviderControlHandle;
3294
3295    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3296        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3297    }
3298
3299    fn control_handle(&self) -> Self::ControlHandle {
3300        LastRebootInfoProviderControlHandle { inner: self.inner.clone() }
3301    }
3302
3303    fn into_inner(
3304        self,
3305    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3306    {
3307        (self.inner, self.is_terminated)
3308    }
3309
3310    fn from_inner(
3311        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3312        is_terminated: bool,
3313    ) -> Self {
3314        Self { inner, is_terminated }
3315    }
3316}
3317
3318impl futures::Stream for LastRebootInfoProviderRequestStream {
3319    type Item = Result<LastRebootInfoProviderRequest, fidl::Error>;
3320
3321    fn poll_next(
3322        mut self: std::pin::Pin<&mut Self>,
3323        cx: &mut std::task::Context<'_>,
3324    ) -> std::task::Poll<Option<Self::Item>> {
3325        let this = &mut *self;
3326        if this.inner.check_shutdown(cx) {
3327            this.is_terminated = true;
3328            return std::task::Poll::Ready(None);
3329        }
3330        if this.is_terminated {
3331            panic!("polled LastRebootInfoProviderRequestStream after completion");
3332        }
3333        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3334            |bytes, handles| {
3335                match this.inner.channel().read_etc(cx, bytes, handles) {
3336                    std::task::Poll::Ready(Ok(())) => {}
3337                    std::task::Poll::Pending => return std::task::Poll::Pending,
3338                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3339                        this.is_terminated = true;
3340                        return std::task::Poll::Ready(None);
3341                    }
3342                    std::task::Poll::Ready(Err(e)) => {
3343                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3344                            e.into(),
3345                        ))));
3346                    }
3347                }
3348
3349                // A message has been received from the channel
3350                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3351
3352                std::task::Poll::Ready(Some(match header.ordinal {
3353                0xbc32d10e081ffac => {
3354                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3355                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3356                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3357                    let control_handle = LastRebootInfoProviderControlHandle {
3358                        inner: this.inner.clone(),
3359                    };
3360                    Ok(LastRebootInfoProviderRequest::Get {
3361                        responder: LastRebootInfoProviderGetResponder {
3362                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3363                            tx_id: header.tx_id,
3364                        },
3365                    })
3366                }
3367                _ => Err(fidl::Error::UnknownOrdinal {
3368                    ordinal: header.ordinal,
3369                    protocol_name: <LastRebootInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3370                }),
3371            }))
3372            },
3373        )
3374    }
3375}
3376
3377/// Get information about why a device last shutdown. The term reboot is used instead of shutdown
3378/// since many developers phrase their questions about shutdowns in terms of reboots and most
3379/// components are interested in knowing why the system just rebooted.
3380#[derive(Debug)]
3381pub enum LastRebootInfoProviderRequest {
3382    Get { responder: LastRebootInfoProviderGetResponder },
3383}
3384
3385impl LastRebootInfoProviderRequest {
3386    #[allow(irrefutable_let_patterns)]
3387    pub fn into_get(self) -> Option<(LastRebootInfoProviderGetResponder)> {
3388        if let LastRebootInfoProviderRequest::Get { responder } = self {
3389            Some((responder))
3390        } else {
3391            None
3392        }
3393    }
3394
3395    /// Name of the method defined in FIDL
3396    pub fn method_name(&self) -> &'static str {
3397        match *self {
3398            LastRebootInfoProviderRequest::Get { .. } => "get",
3399        }
3400    }
3401}
3402
3403#[derive(Debug, Clone)]
3404pub struct LastRebootInfoProviderControlHandle {
3405    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3406}
3407
3408impl fidl::endpoints::ControlHandle for LastRebootInfoProviderControlHandle {
3409    fn shutdown(&self) {
3410        self.inner.shutdown()
3411    }
3412
3413    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3414        self.inner.shutdown_with_epitaph(status)
3415    }
3416
3417    fn is_closed(&self) -> bool {
3418        self.inner.channel().is_closed()
3419    }
3420    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3421        self.inner.channel().on_closed()
3422    }
3423
3424    #[cfg(target_os = "fuchsia")]
3425    fn signal_peer(
3426        &self,
3427        clear_mask: zx::Signals,
3428        set_mask: zx::Signals,
3429    ) -> Result<(), zx_status::Status> {
3430        use fidl::Peered;
3431        self.inner.channel().signal_peer(clear_mask, set_mask)
3432    }
3433}
3434
3435impl LastRebootInfoProviderControlHandle {}
3436
3437#[must_use = "FIDL methods require a response to be sent"]
3438#[derive(Debug)]
3439pub struct LastRebootInfoProviderGetResponder {
3440    control_handle: std::mem::ManuallyDrop<LastRebootInfoProviderControlHandle>,
3441    tx_id: u32,
3442}
3443
3444/// Set the the channel to be shutdown (see [`LastRebootInfoProviderControlHandle::shutdown`])
3445/// if the responder is dropped without sending a response, so that the client
3446/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3447impl std::ops::Drop for LastRebootInfoProviderGetResponder {
3448    fn drop(&mut self) {
3449        self.control_handle.shutdown();
3450        // Safety: drops once, never accessed again
3451        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3452    }
3453}
3454
3455impl fidl::endpoints::Responder for LastRebootInfoProviderGetResponder {
3456    type ControlHandle = LastRebootInfoProviderControlHandle;
3457
3458    fn control_handle(&self) -> &LastRebootInfoProviderControlHandle {
3459        &self.control_handle
3460    }
3461
3462    fn drop_without_shutdown(mut self) {
3463        // Safety: drops once, never accessed again due to mem::forget
3464        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3465        // Prevent Drop from running (which would shut down the channel)
3466        std::mem::forget(self);
3467    }
3468}
3469
3470impl LastRebootInfoProviderGetResponder {
3471    /// Sends a response to the FIDL transaction.
3472    ///
3473    /// Sets the channel to shutdown if an error occurs.
3474    pub fn send(self, mut last_reboot: &LastReboot) -> Result<(), fidl::Error> {
3475        let _result = self.send_raw(last_reboot);
3476        if _result.is_err() {
3477            self.control_handle.shutdown();
3478        }
3479        self.drop_without_shutdown();
3480        _result
3481    }
3482
3483    /// Similar to "send" but does not shutdown the channel if an error occurs.
3484    pub fn send_no_shutdown_on_err(self, mut last_reboot: &LastReboot) -> Result<(), fidl::Error> {
3485        let _result = self.send_raw(last_reboot);
3486        self.drop_without_shutdown();
3487        _result
3488    }
3489
3490    fn send_raw(&self, mut last_reboot: &LastReboot) -> Result<(), fidl::Error> {
3491        self.control_handle.inner.send::<LastRebootInfoProviderGetResponse>(
3492            (last_reboot,),
3493            self.tx_id,
3494            0xbc32d10e081ffac,
3495            fidl::encoding::DynamicFlags::empty(),
3496        )
3497    }
3498}
3499
3500mod internal {
3501    use super::*;
3502
3503    impl fidl::encoding::ResourceTypeMarker for Attachment {
3504        type Borrowed<'a> = &'a mut Self;
3505        fn take_or_borrow<'a>(
3506            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3507        ) -> Self::Borrowed<'a> {
3508            value
3509        }
3510    }
3511
3512    unsafe impl fidl::encoding::TypeMarker for Attachment {
3513        type Owned = Self;
3514
3515        #[inline(always)]
3516        fn inline_align(_context: fidl::encoding::Context) -> usize {
3517            8
3518        }
3519
3520        #[inline(always)]
3521        fn inline_size(_context: fidl::encoding::Context) -> usize {
3522            32
3523        }
3524    }
3525
3526    unsafe impl fidl::encoding::Encode<Attachment, fidl::encoding::DefaultFuchsiaResourceDialect>
3527        for &mut Attachment
3528    {
3529        #[inline]
3530        unsafe fn encode(
3531            self,
3532            encoder: &mut fidl::encoding::Encoder<
3533                '_,
3534                fidl::encoding::DefaultFuchsiaResourceDialect,
3535            >,
3536            offset: usize,
3537            _depth: fidl::encoding::Depth,
3538        ) -> fidl::Result<()> {
3539            encoder.debug_check_bounds::<Attachment>(offset);
3540            // Delegate to tuple encoding.
3541            fidl::encoding::Encode::<Attachment, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3542                (
3543                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
3544                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.value),
3545                ),
3546                encoder, offset, _depth
3547            )
3548        }
3549    }
3550    unsafe impl<
3551        T0: fidl::encoding::Encode<
3552                fidl::encoding::BoundedString<128>,
3553                fidl::encoding::DefaultFuchsiaResourceDialect,
3554            >,
3555        T1: fidl::encoding::Encode<
3556                fidl_fuchsia_mem::Buffer,
3557                fidl::encoding::DefaultFuchsiaResourceDialect,
3558            >,
3559    > fidl::encoding::Encode<Attachment, fidl::encoding::DefaultFuchsiaResourceDialect>
3560        for (T0, T1)
3561    {
3562        #[inline]
3563        unsafe fn encode(
3564            self,
3565            encoder: &mut fidl::encoding::Encoder<
3566                '_,
3567                fidl::encoding::DefaultFuchsiaResourceDialect,
3568            >,
3569            offset: usize,
3570            depth: fidl::encoding::Depth,
3571        ) -> fidl::Result<()> {
3572            encoder.debug_check_bounds::<Attachment>(offset);
3573            // Zero out padding regions. There's no need to apply masks
3574            // because the unmasked parts will be overwritten by fields.
3575            // Write the fields.
3576            self.0.encode(encoder, offset + 0, depth)?;
3577            self.1.encode(encoder, offset + 16, depth)?;
3578            Ok(())
3579        }
3580    }
3581
3582    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Attachment {
3583        #[inline(always)]
3584        fn new_empty() -> Self {
3585            Self {
3586                key: fidl::new_empty!(
3587                    fidl::encoding::BoundedString<128>,
3588                    fidl::encoding::DefaultFuchsiaResourceDialect
3589                ),
3590                value: fidl::new_empty!(
3591                    fidl_fuchsia_mem::Buffer,
3592                    fidl::encoding::DefaultFuchsiaResourceDialect
3593                ),
3594            }
3595        }
3596
3597        #[inline]
3598        unsafe fn decode(
3599            &mut self,
3600            decoder: &mut fidl::encoding::Decoder<
3601                '_,
3602                fidl::encoding::DefaultFuchsiaResourceDialect,
3603            >,
3604            offset: usize,
3605            _depth: fidl::encoding::Depth,
3606        ) -> fidl::Result<()> {
3607            decoder.debug_check_bounds::<Self>(offset);
3608            // Verify that padding bytes are zero.
3609            fidl::decode!(
3610                fidl::encoding::BoundedString<128>,
3611                fidl::encoding::DefaultFuchsiaResourceDialect,
3612                &mut self.key,
3613                decoder,
3614                offset + 0,
3615                _depth
3616            )?;
3617            fidl::decode!(
3618                fidl_fuchsia_mem::Buffer,
3619                fidl::encoding::DefaultFuchsiaResourceDialect,
3620                &mut self.value,
3621                decoder,
3622                offset + 16,
3623                _depth
3624            )?;
3625            Ok(())
3626        }
3627    }
3628
3629    impl fidl::encoding::ResourceTypeMarker for CrashReporterFileReportRequest {
3630        type Borrowed<'a> = &'a mut Self;
3631        fn take_or_borrow<'a>(
3632            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3633        ) -> Self::Borrowed<'a> {
3634            value
3635        }
3636    }
3637
3638    unsafe impl fidl::encoding::TypeMarker for CrashReporterFileReportRequest {
3639        type Owned = Self;
3640
3641        #[inline(always)]
3642        fn inline_align(_context: fidl::encoding::Context) -> usize {
3643            8
3644        }
3645
3646        #[inline(always)]
3647        fn inline_size(_context: fidl::encoding::Context) -> usize {
3648            16
3649        }
3650    }
3651
3652    unsafe impl
3653        fidl::encoding::Encode<
3654            CrashReporterFileReportRequest,
3655            fidl::encoding::DefaultFuchsiaResourceDialect,
3656        > for &mut CrashReporterFileReportRequest
3657    {
3658        #[inline]
3659        unsafe fn encode(
3660            self,
3661            encoder: &mut fidl::encoding::Encoder<
3662                '_,
3663                fidl::encoding::DefaultFuchsiaResourceDialect,
3664            >,
3665            offset: usize,
3666            _depth: fidl::encoding::Depth,
3667        ) -> fidl::Result<()> {
3668            encoder.debug_check_bounds::<CrashReporterFileReportRequest>(offset);
3669            // Delegate to tuple encoding.
3670            fidl::encoding::Encode::<
3671                CrashReporterFileReportRequest,
3672                fidl::encoding::DefaultFuchsiaResourceDialect,
3673            >::encode(
3674                (<CrashReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3675                    &mut self.report,
3676                ),),
3677                encoder,
3678                offset,
3679                _depth,
3680            )
3681        }
3682    }
3683    unsafe impl<
3684        T0: fidl::encoding::Encode<CrashReport, fidl::encoding::DefaultFuchsiaResourceDialect>,
3685    >
3686        fidl::encoding::Encode<
3687            CrashReporterFileReportRequest,
3688            fidl::encoding::DefaultFuchsiaResourceDialect,
3689        > for (T0,)
3690    {
3691        #[inline]
3692        unsafe fn encode(
3693            self,
3694            encoder: &mut fidl::encoding::Encoder<
3695                '_,
3696                fidl::encoding::DefaultFuchsiaResourceDialect,
3697            >,
3698            offset: usize,
3699            depth: fidl::encoding::Depth,
3700        ) -> fidl::Result<()> {
3701            encoder.debug_check_bounds::<CrashReporterFileReportRequest>(offset);
3702            // Zero out padding regions. There's no need to apply masks
3703            // because the unmasked parts will be overwritten by fields.
3704            // Write the fields.
3705            self.0.encode(encoder, offset + 0, depth)?;
3706            Ok(())
3707        }
3708    }
3709
3710    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3711        for CrashReporterFileReportRequest
3712    {
3713        #[inline(always)]
3714        fn new_empty() -> Self {
3715            Self {
3716                report: fidl::new_empty!(
3717                    CrashReport,
3718                    fidl::encoding::DefaultFuchsiaResourceDialect
3719                ),
3720            }
3721        }
3722
3723        #[inline]
3724        unsafe fn decode(
3725            &mut self,
3726            decoder: &mut fidl::encoding::Decoder<
3727                '_,
3728                fidl::encoding::DefaultFuchsiaResourceDialect,
3729            >,
3730            offset: usize,
3731            _depth: fidl::encoding::Depth,
3732        ) -> fidl::Result<()> {
3733            decoder.debug_check_bounds::<Self>(offset);
3734            // Verify that padding bytes are zero.
3735            fidl::decode!(
3736                CrashReport,
3737                fidl::encoding::DefaultFuchsiaResourceDialect,
3738                &mut self.report,
3739                decoder,
3740                offset + 0,
3741                _depth
3742            )?;
3743            Ok(())
3744        }
3745    }
3746
3747    impl fidl::encoding::ResourceTypeMarker for DataProviderGetSnapshotRequest {
3748        type Borrowed<'a> = &'a mut Self;
3749        fn take_or_borrow<'a>(
3750            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3751        ) -> Self::Borrowed<'a> {
3752            value
3753        }
3754    }
3755
3756    unsafe impl fidl::encoding::TypeMarker for DataProviderGetSnapshotRequest {
3757        type Owned = Self;
3758
3759        #[inline(always)]
3760        fn inline_align(_context: fidl::encoding::Context) -> usize {
3761            8
3762        }
3763
3764        #[inline(always)]
3765        fn inline_size(_context: fidl::encoding::Context) -> usize {
3766            16
3767        }
3768    }
3769
3770    unsafe impl
3771        fidl::encoding::Encode<
3772            DataProviderGetSnapshotRequest,
3773            fidl::encoding::DefaultFuchsiaResourceDialect,
3774        > for &mut DataProviderGetSnapshotRequest
3775    {
3776        #[inline]
3777        unsafe fn encode(
3778            self,
3779            encoder: &mut fidl::encoding::Encoder<
3780                '_,
3781                fidl::encoding::DefaultFuchsiaResourceDialect,
3782            >,
3783            offset: usize,
3784            _depth: fidl::encoding::Depth,
3785        ) -> fidl::Result<()> {
3786            encoder.debug_check_bounds::<DataProviderGetSnapshotRequest>(offset);
3787            // Delegate to tuple encoding.
3788            fidl::encoding::Encode::<
3789                DataProviderGetSnapshotRequest,
3790                fidl::encoding::DefaultFuchsiaResourceDialect,
3791            >::encode(
3792                (<GetSnapshotParameters as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3793                    &mut self.params,
3794                ),),
3795                encoder,
3796                offset,
3797                _depth,
3798            )
3799        }
3800    }
3801    unsafe impl<
3802        T0: fidl::encoding::Encode<
3803                GetSnapshotParameters,
3804                fidl::encoding::DefaultFuchsiaResourceDialect,
3805            >,
3806    >
3807        fidl::encoding::Encode<
3808            DataProviderGetSnapshotRequest,
3809            fidl::encoding::DefaultFuchsiaResourceDialect,
3810        > for (T0,)
3811    {
3812        #[inline]
3813        unsafe fn encode(
3814            self,
3815            encoder: &mut fidl::encoding::Encoder<
3816                '_,
3817                fidl::encoding::DefaultFuchsiaResourceDialect,
3818            >,
3819            offset: usize,
3820            depth: fidl::encoding::Depth,
3821        ) -> fidl::Result<()> {
3822            encoder.debug_check_bounds::<DataProviderGetSnapshotRequest>(offset);
3823            // Zero out padding regions. There's no need to apply masks
3824            // because the unmasked parts will be overwritten by fields.
3825            // Write the fields.
3826            self.0.encode(encoder, offset + 0, depth)?;
3827            Ok(())
3828        }
3829    }
3830
3831    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3832        for DataProviderGetSnapshotRequest
3833    {
3834        #[inline(always)]
3835        fn new_empty() -> Self {
3836            Self {
3837                params: fidl::new_empty!(
3838                    GetSnapshotParameters,
3839                    fidl::encoding::DefaultFuchsiaResourceDialect
3840                ),
3841            }
3842        }
3843
3844        #[inline]
3845        unsafe fn decode(
3846            &mut self,
3847            decoder: &mut fidl::encoding::Decoder<
3848                '_,
3849                fidl::encoding::DefaultFuchsiaResourceDialect,
3850            >,
3851            offset: usize,
3852            _depth: fidl::encoding::Depth,
3853        ) -> fidl::Result<()> {
3854            decoder.debug_check_bounds::<Self>(offset);
3855            // Verify that padding bytes are zero.
3856            fidl::decode!(
3857                GetSnapshotParameters,
3858                fidl::encoding::DefaultFuchsiaResourceDialect,
3859                &mut self.params,
3860                decoder,
3861                offset + 0,
3862                _depth
3863            )?;
3864            Ok(())
3865        }
3866    }
3867
3868    impl fidl::encoding::ResourceTypeMarker for DataProviderGetSnapshotResponse {
3869        type Borrowed<'a> = &'a mut Self;
3870        fn take_or_borrow<'a>(
3871            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3872        ) -> Self::Borrowed<'a> {
3873            value
3874        }
3875    }
3876
3877    unsafe impl fidl::encoding::TypeMarker for DataProviderGetSnapshotResponse {
3878        type Owned = Self;
3879
3880        #[inline(always)]
3881        fn inline_align(_context: fidl::encoding::Context) -> usize {
3882            8
3883        }
3884
3885        #[inline(always)]
3886        fn inline_size(_context: fidl::encoding::Context) -> usize {
3887            16
3888        }
3889    }
3890
3891    unsafe impl
3892        fidl::encoding::Encode<
3893            DataProviderGetSnapshotResponse,
3894            fidl::encoding::DefaultFuchsiaResourceDialect,
3895        > for &mut DataProviderGetSnapshotResponse
3896    {
3897        #[inline]
3898        unsafe fn encode(
3899            self,
3900            encoder: &mut fidl::encoding::Encoder<
3901                '_,
3902                fidl::encoding::DefaultFuchsiaResourceDialect,
3903            >,
3904            offset: usize,
3905            _depth: fidl::encoding::Depth,
3906        ) -> fidl::Result<()> {
3907            encoder.debug_check_bounds::<DataProviderGetSnapshotResponse>(offset);
3908            // Delegate to tuple encoding.
3909            fidl::encoding::Encode::<
3910                DataProviderGetSnapshotResponse,
3911                fidl::encoding::DefaultFuchsiaResourceDialect,
3912            >::encode(
3913                (<Snapshot as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3914                    &mut self.snapshot,
3915                ),),
3916                encoder,
3917                offset,
3918                _depth,
3919            )
3920        }
3921    }
3922    unsafe impl<T0: fidl::encoding::Encode<Snapshot, fidl::encoding::DefaultFuchsiaResourceDialect>>
3923        fidl::encoding::Encode<
3924            DataProviderGetSnapshotResponse,
3925            fidl::encoding::DefaultFuchsiaResourceDialect,
3926        > for (T0,)
3927    {
3928        #[inline]
3929        unsafe fn encode(
3930            self,
3931            encoder: &mut fidl::encoding::Encoder<
3932                '_,
3933                fidl::encoding::DefaultFuchsiaResourceDialect,
3934            >,
3935            offset: usize,
3936            depth: fidl::encoding::Depth,
3937        ) -> fidl::Result<()> {
3938            encoder.debug_check_bounds::<DataProviderGetSnapshotResponse>(offset);
3939            // Zero out padding regions. There's no need to apply masks
3940            // because the unmasked parts will be overwritten by fields.
3941            // Write the fields.
3942            self.0.encode(encoder, offset + 0, depth)?;
3943            Ok(())
3944        }
3945    }
3946
3947    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3948        for DataProviderGetSnapshotResponse
3949    {
3950        #[inline(always)]
3951        fn new_empty() -> Self {
3952            Self {
3953                snapshot: fidl::new_empty!(Snapshot, fidl::encoding::DefaultFuchsiaResourceDialect),
3954            }
3955        }
3956
3957        #[inline]
3958        unsafe fn decode(
3959            &mut self,
3960            decoder: &mut fidl::encoding::Decoder<
3961                '_,
3962                fidl::encoding::DefaultFuchsiaResourceDialect,
3963            >,
3964            offset: usize,
3965            _depth: fidl::encoding::Depth,
3966        ) -> fidl::Result<()> {
3967            decoder.debug_check_bounds::<Self>(offset);
3968            // Verify that padding bytes are zero.
3969            fidl::decode!(
3970                Snapshot,
3971                fidl::encoding::DefaultFuchsiaResourceDialect,
3972                &mut self.snapshot,
3973                decoder,
3974                offset + 0,
3975                _depth
3976            )?;
3977            Ok(())
3978        }
3979    }
3980
3981    impl CrashReport {
3982        #[inline(always)]
3983        fn max_ordinal_present(&self) -> u64 {
3984            if let Some(_) = self.weight {
3985                return 9;
3986            }
3987            if let Some(_) = self.is_fatal {
3988                return 8;
3989            }
3990            if let Some(_) = self.crash_signature {
3991                return 7;
3992            }
3993            if let Some(_) = self.program_uptime {
3994                return 6;
3995            }
3996            if let Some(_) = self.event_id {
3997                return 5;
3998            }
3999            if let Some(_) = self.attachments {
4000                return 4;
4001            }
4002            if let Some(_) = self.annotations {
4003                return 3;
4004            }
4005            if let Some(_) = self.specific_report {
4006                return 2;
4007            }
4008            if let Some(_) = self.program_name {
4009                return 1;
4010            }
4011            0
4012        }
4013    }
4014
4015    impl fidl::encoding::ResourceTypeMarker for CrashReport {
4016        type Borrowed<'a> = &'a mut Self;
4017        fn take_or_borrow<'a>(
4018            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4019        ) -> Self::Borrowed<'a> {
4020            value
4021        }
4022    }
4023
4024    unsafe impl fidl::encoding::TypeMarker for CrashReport {
4025        type Owned = Self;
4026
4027        #[inline(always)]
4028        fn inline_align(_context: fidl::encoding::Context) -> usize {
4029            8
4030        }
4031
4032        #[inline(always)]
4033        fn inline_size(_context: fidl::encoding::Context) -> usize {
4034            16
4035        }
4036    }
4037
4038    unsafe impl fidl::encoding::Encode<CrashReport, fidl::encoding::DefaultFuchsiaResourceDialect>
4039        for &mut CrashReport
4040    {
4041        unsafe fn encode(
4042            self,
4043            encoder: &mut fidl::encoding::Encoder<
4044                '_,
4045                fidl::encoding::DefaultFuchsiaResourceDialect,
4046            >,
4047            offset: usize,
4048            mut depth: fidl::encoding::Depth,
4049        ) -> fidl::Result<()> {
4050            encoder.debug_check_bounds::<CrashReport>(offset);
4051            // Vector header
4052            let max_ordinal: u64 = self.max_ordinal_present();
4053            encoder.write_num(max_ordinal, offset);
4054            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4055            // Calling encoder.out_of_line_offset(0) is not allowed.
4056            if max_ordinal == 0 {
4057                return Ok(());
4058            }
4059            depth.increment()?;
4060            let envelope_size = 8;
4061            let bytes_len = max_ordinal as usize * envelope_size;
4062            #[allow(unused_variables)]
4063            let offset = encoder.out_of_line_offset(bytes_len);
4064            let mut _prev_end_offset: usize = 0;
4065            if 1 > max_ordinal {
4066                return Ok(());
4067            }
4068
4069            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4070            // are envelope_size bytes.
4071            let cur_offset: usize = (1 - 1) * envelope_size;
4072
4073            // Zero reserved fields.
4074            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4075
4076            // Safety:
4077            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4078            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4079            //   envelope_size bytes, there is always sufficient room.
4080            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4081            self.program_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
4082            encoder, offset + cur_offset, depth
4083        )?;
4084
4085            _prev_end_offset = cur_offset + envelope_size;
4086            if 2 > max_ordinal {
4087                return Ok(());
4088            }
4089
4090            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4091            // are envelope_size bytes.
4092            let cur_offset: usize = (2 - 1) * envelope_size;
4093
4094            // Zero reserved fields.
4095            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4096
4097            // Safety:
4098            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4099            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4100            //   envelope_size bytes, there is always sufficient room.
4101            fidl::encoding::encode_in_envelope_optional::<
4102                SpecificCrashReport,
4103                fidl::encoding::DefaultFuchsiaResourceDialect,
4104            >(
4105                self.specific_report.as_mut().map(
4106                    <SpecificCrashReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4107                ),
4108                encoder,
4109                offset + cur_offset,
4110                depth,
4111            )?;
4112
4113            _prev_end_offset = cur_offset + envelope_size;
4114            if 3 > max_ordinal {
4115                return Ok(());
4116            }
4117
4118            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4119            // are envelope_size bytes.
4120            let cur_offset: usize = (3 - 1) * envelope_size;
4121
4122            // Zero reserved fields.
4123            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4124
4125            // Safety:
4126            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4127            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4128            //   envelope_size bytes, there is always sufficient room.
4129            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Annotation, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4130            self.annotations.as_ref().map(<fidl::encoding::Vector<Annotation, 32> as fidl::encoding::ValueTypeMarker>::borrow),
4131            encoder, offset + cur_offset, depth
4132        )?;
4133
4134            _prev_end_offset = cur_offset + envelope_size;
4135            if 4 > max_ordinal {
4136                return Ok(());
4137            }
4138
4139            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4140            // are envelope_size bytes.
4141            let cur_offset: usize = (4 - 1) * envelope_size;
4142
4143            // Zero reserved fields.
4144            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4145
4146            // Safety:
4147            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4148            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4149            //   envelope_size bytes, there is always sufficient room.
4150            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Attachment, 16>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4151            self.attachments.as_mut().map(<fidl::encoding::Vector<Attachment, 16> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4152            encoder, offset + cur_offset, depth
4153        )?;
4154
4155            _prev_end_offset = cur_offset + envelope_size;
4156            if 5 > max_ordinal {
4157                return Ok(());
4158            }
4159
4160            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4161            // are envelope_size bytes.
4162            let cur_offset: usize = (5 - 1) * envelope_size;
4163
4164            // Zero reserved fields.
4165            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4166
4167            // Safety:
4168            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4169            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4170            //   envelope_size bytes, there is always sufficient room.
4171            fidl::encoding::encode_in_envelope_optional::<
4172                fidl::encoding::BoundedString<128>,
4173                fidl::encoding::DefaultFuchsiaResourceDialect,
4174            >(
4175                self.event_id.as_ref().map(
4176                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
4177                ),
4178                encoder,
4179                offset + cur_offset,
4180                depth,
4181            )?;
4182
4183            _prev_end_offset = cur_offset + envelope_size;
4184            if 6 > max_ordinal {
4185                return Ok(());
4186            }
4187
4188            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4189            // are envelope_size bytes.
4190            let cur_offset: usize = (6 - 1) * envelope_size;
4191
4192            // Zero reserved fields.
4193            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4194
4195            // Safety:
4196            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4197            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4198            //   envelope_size bytes, there is always sufficient room.
4199            fidl::encoding::encode_in_envelope_optional::<
4200                i64,
4201                fidl::encoding::DefaultFuchsiaResourceDialect,
4202            >(
4203                self.program_uptime.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4204                encoder,
4205                offset + cur_offset,
4206                depth,
4207            )?;
4208
4209            _prev_end_offset = cur_offset + envelope_size;
4210            if 7 > max_ordinal {
4211                return Ok(());
4212            }
4213
4214            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4215            // are envelope_size bytes.
4216            let cur_offset: usize = (7 - 1) * envelope_size;
4217
4218            // Zero reserved fields.
4219            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4220
4221            // Safety:
4222            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4223            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4224            //   envelope_size bytes, there is always sufficient room.
4225            fidl::encoding::encode_in_envelope_optional::<
4226                fidl::encoding::BoundedString<128>,
4227                fidl::encoding::DefaultFuchsiaResourceDialect,
4228            >(
4229                self.crash_signature.as_ref().map(
4230                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
4231                ),
4232                encoder,
4233                offset + cur_offset,
4234                depth,
4235            )?;
4236
4237            _prev_end_offset = cur_offset + envelope_size;
4238            if 8 > max_ordinal {
4239                return Ok(());
4240            }
4241
4242            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4243            // are envelope_size bytes.
4244            let cur_offset: usize = (8 - 1) * envelope_size;
4245
4246            // Zero reserved fields.
4247            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4248
4249            // Safety:
4250            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4251            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4252            //   envelope_size bytes, there is always sufficient room.
4253            fidl::encoding::encode_in_envelope_optional::<
4254                bool,
4255                fidl::encoding::DefaultFuchsiaResourceDialect,
4256            >(
4257                self.is_fatal.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4258                encoder,
4259                offset + cur_offset,
4260                depth,
4261            )?;
4262
4263            _prev_end_offset = cur_offset + envelope_size;
4264            if 9 > max_ordinal {
4265                return Ok(());
4266            }
4267
4268            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4269            // are envelope_size bytes.
4270            let cur_offset: usize = (9 - 1) * envelope_size;
4271
4272            // Zero reserved fields.
4273            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4274
4275            // Safety:
4276            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4277            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4278            //   envelope_size bytes, there is always sufficient room.
4279            fidl::encoding::encode_in_envelope_optional::<
4280                u32,
4281                fidl::encoding::DefaultFuchsiaResourceDialect,
4282            >(
4283                self.weight.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4284                encoder,
4285                offset + cur_offset,
4286                depth,
4287            )?;
4288
4289            _prev_end_offset = cur_offset + envelope_size;
4290
4291            Ok(())
4292        }
4293    }
4294
4295    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for CrashReport {
4296        #[inline(always)]
4297        fn new_empty() -> Self {
4298            Self::default()
4299        }
4300
4301        unsafe fn decode(
4302            &mut self,
4303            decoder: &mut fidl::encoding::Decoder<
4304                '_,
4305                fidl::encoding::DefaultFuchsiaResourceDialect,
4306            >,
4307            offset: usize,
4308            mut depth: fidl::encoding::Depth,
4309        ) -> fidl::Result<()> {
4310            decoder.debug_check_bounds::<Self>(offset);
4311            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4312                None => return Err(fidl::Error::NotNullable),
4313                Some(len) => len,
4314            };
4315            // Calling decoder.out_of_line_offset(0) is not allowed.
4316            if len == 0 {
4317                return Ok(());
4318            };
4319            depth.increment()?;
4320            let envelope_size = 8;
4321            let bytes_len = len * envelope_size;
4322            let offset = decoder.out_of_line_offset(bytes_len)?;
4323            // Decode the envelope for each type.
4324            let mut _next_ordinal_to_read = 0;
4325            let mut next_offset = offset;
4326            let end_offset = offset + bytes_len;
4327            _next_ordinal_to_read += 1;
4328            if next_offset >= end_offset {
4329                return Ok(());
4330            }
4331
4332            // Decode unknown envelopes for gaps in ordinals.
4333            while _next_ordinal_to_read < 1 {
4334                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4335                _next_ordinal_to_read += 1;
4336                next_offset += envelope_size;
4337            }
4338
4339            let next_out_of_line = decoder.next_out_of_line();
4340            let handles_before = decoder.remaining_handles();
4341            if let Some((inlined, num_bytes, num_handles)) =
4342                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4343            {
4344                let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4345                if inlined != (member_inline_size <= 4) {
4346                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4347                }
4348                let inner_offset;
4349                let mut inner_depth = depth.clone();
4350                if inlined {
4351                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4352                    inner_offset = next_offset;
4353                } else {
4354                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4355                    inner_depth.increment()?;
4356                }
4357                let val_ref = self.program_name.get_or_insert_with(|| {
4358                    fidl::new_empty!(
4359                        fidl::encoding::BoundedString<1024>,
4360                        fidl::encoding::DefaultFuchsiaResourceDialect
4361                    )
4362                });
4363                fidl::decode!(
4364                    fidl::encoding::BoundedString<1024>,
4365                    fidl::encoding::DefaultFuchsiaResourceDialect,
4366                    val_ref,
4367                    decoder,
4368                    inner_offset,
4369                    inner_depth
4370                )?;
4371                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4372                {
4373                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4374                }
4375                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4376                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4377                }
4378            }
4379
4380            next_offset += envelope_size;
4381            _next_ordinal_to_read += 1;
4382            if next_offset >= end_offset {
4383                return Ok(());
4384            }
4385
4386            // Decode unknown envelopes for gaps in ordinals.
4387            while _next_ordinal_to_read < 2 {
4388                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4389                _next_ordinal_to_read += 1;
4390                next_offset += envelope_size;
4391            }
4392
4393            let next_out_of_line = decoder.next_out_of_line();
4394            let handles_before = decoder.remaining_handles();
4395            if let Some((inlined, num_bytes, num_handles)) =
4396                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4397            {
4398                let member_inline_size =
4399                    <SpecificCrashReport as fidl::encoding::TypeMarker>::inline_size(
4400                        decoder.context,
4401                    );
4402                if inlined != (member_inline_size <= 4) {
4403                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4404                }
4405                let inner_offset;
4406                let mut inner_depth = depth.clone();
4407                if inlined {
4408                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4409                    inner_offset = next_offset;
4410                } else {
4411                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4412                    inner_depth.increment()?;
4413                }
4414                let val_ref = self.specific_report.get_or_insert_with(|| {
4415                    fidl::new_empty!(
4416                        SpecificCrashReport,
4417                        fidl::encoding::DefaultFuchsiaResourceDialect
4418                    )
4419                });
4420                fidl::decode!(
4421                    SpecificCrashReport,
4422                    fidl::encoding::DefaultFuchsiaResourceDialect,
4423                    val_ref,
4424                    decoder,
4425                    inner_offset,
4426                    inner_depth
4427                )?;
4428                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4429                {
4430                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4431                }
4432                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4433                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4434                }
4435            }
4436
4437            next_offset += envelope_size;
4438            _next_ordinal_to_read += 1;
4439            if next_offset >= end_offset {
4440                return Ok(());
4441            }
4442
4443            // Decode unknown envelopes for gaps in ordinals.
4444            while _next_ordinal_to_read < 3 {
4445                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4446                _next_ordinal_to_read += 1;
4447                next_offset += envelope_size;
4448            }
4449
4450            let next_out_of_line = decoder.next_out_of_line();
4451            let handles_before = decoder.remaining_handles();
4452            if let Some((inlined, num_bytes, num_handles)) =
4453                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4454            {
4455                let member_inline_size = <fidl::encoding::Vector<Annotation, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4456                if inlined != (member_inline_size <= 4) {
4457                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4458                }
4459                let inner_offset;
4460                let mut inner_depth = depth.clone();
4461                if inlined {
4462                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4463                    inner_offset = next_offset;
4464                } else {
4465                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4466                    inner_depth.increment()?;
4467                }
4468                let val_ref =
4469                self.annotations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Annotation, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
4470                fidl::decode!(fidl::encoding::Vector<Annotation, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4471                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4472                {
4473                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4474                }
4475                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4476                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4477                }
4478            }
4479
4480            next_offset += envelope_size;
4481            _next_ordinal_to_read += 1;
4482            if next_offset >= end_offset {
4483                return Ok(());
4484            }
4485
4486            // Decode unknown envelopes for gaps in ordinals.
4487            while _next_ordinal_to_read < 4 {
4488                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4489                _next_ordinal_to_read += 1;
4490                next_offset += envelope_size;
4491            }
4492
4493            let next_out_of_line = decoder.next_out_of_line();
4494            let handles_before = decoder.remaining_handles();
4495            if let Some((inlined, num_bytes, num_handles)) =
4496                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4497            {
4498                let member_inline_size = <fidl::encoding::Vector<Attachment, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4499                if inlined != (member_inline_size <= 4) {
4500                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4501                }
4502                let inner_offset;
4503                let mut inner_depth = depth.clone();
4504                if inlined {
4505                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4506                    inner_offset = next_offset;
4507                } else {
4508                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4509                    inner_depth.increment()?;
4510                }
4511                let val_ref =
4512                self.attachments.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Attachment, 16>, fidl::encoding::DefaultFuchsiaResourceDialect));
4513                fidl::decode!(fidl::encoding::Vector<Attachment, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4514                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4515                {
4516                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4517                }
4518                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4519                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4520                }
4521            }
4522
4523            next_offset += envelope_size;
4524            _next_ordinal_to_read += 1;
4525            if next_offset >= end_offset {
4526                return Ok(());
4527            }
4528
4529            // Decode unknown envelopes for gaps in ordinals.
4530            while _next_ordinal_to_read < 5 {
4531                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4532                _next_ordinal_to_read += 1;
4533                next_offset += envelope_size;
4534            }
4535
4536            let next_out_of_line = decoder.next_out_of_line();
4537            let handles_before = decoder.remaining_handles();
4538            if let Some((inlined, num_bytes, num_handles)) =
4539                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4540            {
4541                let member_inline_size =
4542                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
4543                        decoder.context,
4544                    );
4545                if inlined != (member_inline_size <= 4) {
4546                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4547                }
4548                let inner_offset;
4549                let mut inner_depth = depth.clone();
4550                if inlined {
4551                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4552                    inner_offset = next_offset;
4553                } else {
4554                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4555                    inner_depth.increment()?;
4556                }
4557                let val_ref = self.event_id.get_or_insert_with(|| {
4558                    fidl::new_empty!(
4559                        fidl::encoding::BoundedString<128>,
4560                        fidl::encoding::DefaultFuchsiaResourceDialect
4561                    )
4562                });
4563                fidl::decode!(
4564                    fidl::encoding::BoundedString<128>,
4565                    fidl::encoding::DefaultFuchsiaResourceDialect,
4566                    val_ref,
4567                    decoder,
4568                    inner_offset,
4569                    inner_depth
4570                )?;
4571                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4572                {
4573                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4574                }
4575                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4576                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4577                }
4578            }
4579
4580            next_offset += envelope_size;
4581            _next_ordinal_to_read += 1;
4582            if next_offset >= end_offset {
4583                return Ok(());
4584            }
4585
4586            // Decode unknown envelopes for gaps in ordinals.
4587            while _next_ordinal_to_read < 6 {
4588                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4589                _next_ordinal_to_read += 1;
4590                next_offset += envelope_size;
4591            }
4592
4593            let next_out_of_line = decoder.next_out_of_line();
4594            let handles_before = decoder.remaining_handles();
4595            if let Some((inlined, num_bytes, num_handles)) =
4596                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4597            {
4598                let member_inline_size =
4599                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4600                if inlined != (member_inline_size <= 4) {
4601                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4602                }
4603                let inner_offset;
4604                let mut inner_depth = depth.clone();
4605                if inlined {
4606                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4607                    inner_offset = next_offset;
4608                } else {
4609                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4610                    inner_depth.increment()?;
4611                }
4612                let val_ref = self.program_uptime.get_or_insert_with(|| {
4613                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
4614                });
4615                fidl::decode!(
4616                    i64,
4617                    fidl::encoding::DefaultFuchsiaResourceDialect,
4618                    val_ref,
4619                    decoder,
4620                    inner_offset,
4621                    inner_depth
4622                )?;
4623                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4624                {
4625                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4626                }
4627                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4628                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4629                }
4630            }
4631
4632            next_offset += envelope_size;
4633            _next_ordinal_to_read += 1;
4634            if next_offset >= end_offset {
4635                return Ok(());
4636            }
4637
4638            // Decode unknown envelopes for gaps in ordinals.
4639            while _next_ordinal_to_read < 7 {
4640                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4641                _next_ordinal_to_read += 1;
4642                next_offset += envelope_size;
4643            }
4644
4645            let next_out_of_line = decoder.next_out_of_line();
4646            let handles_before = decoder.remaining_handles();
4647            if let Some((inlined, num_bytes, num_handles)) =
4648                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4649            {
4650                let member_inline_size =
4651                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
4652                        decoder.context,
4653                    );
4654                if inlined != (member_inline_size <= 4) {
4655                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4656                }
4657                let inner_offset;
4658                let mut inner_depth = depth.clone();
4659                if inlined {
4660                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4661                    inner_offset = next_offset;
4662                } else {
4663                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4664                    inner_depth.increment()?;
4665                }
4666                let val_ref = self.crash_signature.get_or_insert_with(|| {
4667                    fidl::new_empty!(
4668                        fidl::encoding::BoundedString<128>,
4669                        fidl::encoding::DefaultFuchsiaResourceDialect
4670                    )
4671                });
4672                fidl::decode!(
4673                    fidl::encoding::BoundedString<128>,
4674                    fidl::encoding::DefaultFuchsiaResourceDialect,
4675                    val_ref,
4676                    decoder,
4677                    inner_offset,
4678                    inner_depth
4679                )?;
4680                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4681                {
4682                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4683                }
4684                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4685                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4686                }
4687            }
4688
4689            next_offset += envelope_size;
4690            _next_ordinal_to_read += 1;
4691            if next_offset >= end_offset {
4692                return Ok(());
4693            }
4694
4695            // Decode unknown envelopes for gaps in ordinals.
4696            while _next_ordinal_to_read < 8 {
4697                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4698                _next_ordinal_to_read += 1;
4699                next_offset += envelope_size;
4700            }
4701
4702            let next_out_of_line = decoder.next_out_of_line();
4703            let handles_before = decoder.remaining_handles();
4704            if let Some((inlined, num_bytes, num_handles)) =
4705                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4706            {
4707                let member_inline_size =
4708                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4709                if inlined != (member_inline_size <= 4) {
4710                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4711                }
4712                let inner_offset;
4713                let mut inner_depth = depth.clone();
4714                if inlined {
4715                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4716                    inner_offset = next_offset;
4717                } else {
4718                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4719                    inner_depth.increment()?;
4720                }
4721                let val_ref = self.is_fatal.get_or_insert_with(|| {
4722                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
4723                });
4724                fidl::decode!(
4725                    bool,
4726                    fidl::encoding::DefaultFuchsiaResourceDialect,
4727                    val_ref,
4728                    decoder,
4729                    inner_offset,
4730                    inner_depth
4731                )?;
4732                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4733                {
4734                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4735                }
4736                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4737                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4738                }
4739            }
4740
4741            next_offset += envelope_size;
4742            _next_ordinal_to_read += 1;
4743            if next_offset >= end_offset {
4744                return Ok(());
4745            }
4746
4747            // Decode unknown envelopes for gaps in ordinals.
4748            while _next_ordinal_to_read < 9 {
4749                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4750                _next_ordinal_to_read += 1;
4751                next_offset += envelope_size;
4752            }
4753
4754            let next_out_of_line = decoder.next_out_of_line();
4755            let handles_before = decoder.remaining_handles();
4756            if let Some((inlined, num_bytes, num_handles)) =
4757                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4758            {
4759                let member_inline_size =
4760                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4761                if inlined != (member_inline_size <= 4) {
4762                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4763                }
4764                let inner_offset;
4765                let mut inner_depth = depth.clone();
4766                if inlined {
4767                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4768                    inner_offset = next_offset;
4769                } else {
4770                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4771                    inner_depth.increment()?;
4772                }
4773                let val_ref = self.weight.get_or_insert_with(|| {
4774                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
4775                });
4776                fidl::decode!(
4777                    u32,
4778                    fidl::encoding::DefaultFuchsiaResourceDialect,
4779                    val_ref,
4780                    decoder,
4781                    inner_offset,
4782                    inner_depth
4783                )?;
4784                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4785                {
4786                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4787                }
4788                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4789                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4790                }
4791            }
4792
4793            next_offset += envelope_size;
4794
4795            // Decode the remaining unknown envelopes.
4796            while next_offset < end_offset {
4797                _next_ordinal_to_read += 1;
4798                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4799                next_offset += envelope_size;
4800            }
4801
4802            Ok(())
4803        }
4804    }
4805
4806    impl GetSnapshotParameters {
4807        #[inline(always)]
4808        fn max_ordinal_present(&self) -> u64 {
4809            if let Some(_) = self.response_channel {
4810                return 2;
4811            }
4812            if let Some(_) = self.collection_timeout_per_data {
4813                return 1;
4814            }
4815            0
4816        }
4817    }
4818
4819    impl fidl::encoding::ResourceTypeMarker for GetSnapshotParameters {
4820        type Borrowed<'a> = &'a mut Self;
4821        fn take_or_borrow<'a>(
4822            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4823        ) -> Self::Borrowed<'a> {
4824            value
4825        }
4826    }
4827
4828    unsafe impl fidl::encoding::TypeMarker for GetSnapshotParameters {
4829        type Owned = Self;
4830
4831        #[inline(always)]
4832        fn inline_align(_context: fidl::encoding::Context) -> usize {
4833            8
4834        }
4835
4836        #[inline(always)]
4837        fn inline_size(_context: fidl::encoding::Context) -> usize {
4838            16
4839        }
4840    }
4841
4842    unsafe impl
4843        fidl::encoding::Encode<GetSnapshotParameters, fidl::encoding::DefaultFuchsiaResourceDialect>
4844        for &mut GetSnapshotParameters
4845    {
4846        unsafe fn encode(
4847            self,
4848            encoder: &mut fidl::encoding::Encoder<
4849                '_,
4850                fidl::encoding::DefaultFuchsiaResourceDialect,
4851            >,
4852            offset: usize,
4853            mut depth: fidl::encoding::Depth,
4854        ) -> fidl::Result<()> {
4855            encoder.debug_check_bounds::<GetSnapshotParameters>(offset);
4856            // Vector header
4857            let max_ordinal: u64 = self.max_ordinal_present();
4858            encoder.write_num(max_ordinal, offset);
4859            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4860            // Calling encoder.out_of_line_offset(0) is not allowed.
4861            if max_ordinal == 0 {
4862                return Ok(());
4863            }
4864            depth.increment()?;
4865            let envelope_size = 8;
4866            let bytes_len = max_ordinal as usize * envelope_size;
4867            #[allow(unused_variables)]
4868            let offset = encoder.out_of_line_offset(bytes_len);
4869            let mut _prev_end_offset: usize = 0;
4870            if 1 > max_ordinal {
4871                return Ok(());
4872            }
4873
4874            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4875            // are envelope_size bytes.
4876            let cur_offset: usize = (1 - 1) * envelope_size;
4877
4878            // Zero reserved fields.
4879            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4880
4881            // Safety:
4882            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4883            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4884            //   envelope_size bytes, there is always sufficient room.
4885            fidl::encoding::encode_in_envelope_optional::<
4886                i64,
4887                fidl::encoding::DefaultFuchsiaResourceDialect,
4888            >(
4889                self.collection_timeout_per_data
4890                    .as_ref()
4891                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4892                encoder,
4893                offset + cur_offset,
4894                depth,
4895            )?;
4896
4897            _prev_end_offset = cur_offset + envelope_size;
4898            if 2 > max_ordinal {
4899                return Ok(());
4900            }
4901
4902            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4903            // are envelope_size bytes.
4904            let cur_offset: usize = (2 - 1) * envelope_size;
4905
4906            // Zero reserved fields.
4907            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4908
4909            // Safety:
4910            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4911            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4912            //   envelope_size bytes, there is always sufficient room.
4913            fidl::encoding::encode_in_envelope_optional::<
4914                fidl::encoding::HandleType<
4915                    fidl::Channel,
4916                    { fidl::ObjectType::CHANNEL.into_raw() },
4917                    2147483648,
4918                >,
4919                fidl::encoding::DefaultFuchsiaResourceDialect,
4920            >(
4921                self.response_channel.as_mut().map(
4922                    <fidl::encoding::HandleType<
4923                        fidl::Channel,
4924                        { fidl::ObjectType::CHANNEL.into_raw() },
4925                        2147483648,
4926                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4927                ),
4928                encoder,
4929                offset + cur_offset,
4930                depth,
4931            )?;
4932
4933            _prev_end_offset = cur_offset + envelope_size;
4934
4935            Ok(())
4936        }
4937    }
4938
4939    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4940        for GetSnapshotParameters
4941    {
4942        #[inline(always)]
4943        fn new_empty() -> Self {
4944            Self::default()
4945        }
4946
4947        unsafe fn decode(
4948            &mut self,
4949            decoder: &mut fidl::encoding::Decoder<
4950                '_,
4951                fidl::encoding::DefaultFuchsiaResourceDialect,
4952            >,
4953            offset: usize,
4954            mut depth: fidl::encoding::Depth,
4955        ) -> fidl::Result<()> {
4956            decoder.debug_check_bounds::<Self>(offset);
4957            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4958                None => return Err(fidl::Error::NotNullable),
4959                Some(len) => len,
4960            };
4961            // Calling decoder.out_of_line_offset(0) is not allowed.
4962            if len == 0 {
4963                return Ok(());
4964            };
4965            depth.increment()?;
4966            let envelope_size = 8;
4967            let bytes_len = len * envelope_size;
4968            let offset = decoder.out_of_line_offset(bytes_len)?;
4969            // Decode the envelope for each type.
4970            let mut _next_ordinal_to_read = 0;
4971            let mut next_offset = offset;
4972            let end_offset = offset + bytes_len;
4973            _next_ordinal_to_read += 1;
4974            if next_offset >= end_offset {
4975                return Ok(());
4976            }
4977
4978            // Decode unknown envelopes for gaps in ordinals.
4979            while _next_ordinal_to_read < 1 {
4980                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4981                _next_ordinal_to_read += 1;
4982                next_offset += envelope_size;
4983            }
4984
4985            let next_out_of_line = decoder.next_out_of_line();
4986            let handles_before = decoder.remaining_handles();
4987            if let Some((inlined, num_bytes, num_handles)) =
4988                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4989            {
4990                let member_inline_size =
4991                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4992                if inlined != (member_inline_size <= 4) {
4993                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4994                }
4995                let inner_offset;
4996                let mut inner_depth = depth.clone();
4997                if inlined {
4998                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4999                    inner_offset = next_offset;
5000                } else {
5001                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5002                    inner_depth.increment()?;
5003                }
5004                let val_ref = self.collection_timeout_per_data.get_or_insert_with(|| {
5005                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
5006                });
5007                fidl::decode!(
5008                    i64,
5009                    fidl::encoding::DefaultFuchsiaResourceDialect,
5010                    val_ref,
5011                    decoder,
5012                    inner_offset,
5013                    inner_depth
5014                )?;
5015                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5016                {
5017                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5018                }
5019                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5020                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5021                }
5022            }
5023
5024            next_offset += envelope_size;
5025            _next_ordinal_to_read += 1;
5026            if next_offset >= end_offset {
5027                return Ok(());
5028            }
5029
5030            // Decode unknown envelopes for gaps in ordinals.
5031            while _next_ordinal_to_read < 2 {
5032                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5033                _next_ordinal_to_read += 1;
5034                next_offset += envelope_size;
5035            }
5036
5037            let next_out_of_line = decoder.next_out_of_line();
5038            let handles_before = decoder.remaining_handles();
5039            if let Some((inlined, num_bytes, num_handles)) =
5040                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5041            {
5042                let member_inline_size = <fidl::encoding::HandleType<
5043                    fidl::Channel,
5044                    { fidl::ObjectType::CHANNEL.into_raw() },
5045                    2147483648,
5046                > as fidl::encoding::TypeMarker>::inline_size(
5047                    decoder.context
5048                );
5049                if inlined != (member_inline_size <= 4) {
5050                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5051                }
5052                let inner_offset;
5053                let mut inner_depth = depth.clone();
5054                if inlined {
5055                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5056                    inner_offset = next_offset;
5057                } else {
5058                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5059                    inner_depth.increment()?;
5060                }
5061                let val_ref =
5062                self.response_channel.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5063                fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5064                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5065                {
5066                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5067                }
5068                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5069                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5070                }
5071            }
5072
5073            next_offset += envelope_size;
5074
5075            // Decode the remaining unknown envelopes.
5076            while next_offset < end_offset {
5077                _next_ordinal_to_read += 1;
5078                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5079                next_offset += envelope_size;
5080            }
5081
5082            Ok(())
5083        }
5084    }
5085
5086    impl NativeCrashReport {
5087        #[inline(always)]
5088        fn max_ordinal_present(&self) -> u64 {
5089            if let Some(_) = self.thread_koid {
5090                return 5;
5091            }
5092            if let Some(_) = self.thread_name {
5093                return 4;
5094            }
5095            if let Some(_) = self.process_koid {
5096                return 3;
5097            }
5098            if let Some(_) = self.process_name {
5099                return 2;
5100            }
5101            if let Some(_) = self.minidump {
5102                return 1;
5103            }
5104            0
5105        }
5106    }
5107
5108    impl fidl::encoding::ResourceTypeMarker for NativeCrashReport {
5109        type Borrowed<'a> = &'a mut Self;
5110        fn take_or_borrow<'a>(
5111            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5112        ) -> Self::Borrowed<'a> {
5113            value
5114        }
5115    }
5116
5117    unsafe impl fidl::encoding::TypeMarker for NativeCrashReport {
5118        type Owned = Self;
5119
5120        #[inline(always)]
5121        fn inline_align(_context: fidl::encoding::Context) -> usize {
5122            8
5123        }
5124
5125        #[inline(always)]
5126        fn inline_size(_context: fidl::encoding::Context) -> usize {
5127            16
5128        }
5129    }
5130
5131    unsafe impl
5132        fidl::encoding::Encode<NativeCrashReport, fidl::encoding::DefaultFuchsiaResourceDialect>
5133        for &mut NativeCrashReport
5134    {
5135        unsafe fn encode(
5136            self,
5137            encoder: &mut fidl::encoding::Encoder<
5138                '_,
5139                fidl::encoding::DefaultFuchsiaResourceDialect,
5140            >,
5141            offset: usize,
5142            mut depth: fidl::encoding::Depth,
5143        ) -> fidl::Result<()> {
5144            encoder.debug_check_bounds::<NativeCrashReport>(offset);
5145            // Vector header
5146            let max_ordinal: u64 = self.max_ordinal_present();
5147            encoder.write_num(max_ordinal, offset);
5148            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5149            // Calling encoder.out_of_line_offset(0) is not allowed.
5150            if max_ordinal == 0 {
5151                return Ok(());
5152            }
5153            depth.increment()?;
5154            let envelope_size = 8;
5155            let bytes_len = max_ordinal as usize * envelope_size;
5156            #[allow(unused_variables)]
5157            let offset = encoder.out_of_line_offset(bytes_len);
5158            let mut _prev_end_offset: usize = 0;
5159            if 1 > max_ordinal {
5160                return Ok(());
5161            }
5162
5163            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5164            // are envelope_size bytes.
5165            let cur_offset: usize = (1 - 1) * envelope_size;
5166
5167            // Zero reserved fields.
5168            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5169
5170            // Safety:
5171            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5172            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5173            //   envelope_size bytes, there is always sufficient room.
5174            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
5175            self.minidump.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5176            encoder, offset + cur_offset, depth
5177        )?;
5178
5179            _prev_end_offset = cur_offset + envelope_size;
5180            if 2 > max_ordinal {
5181                return Ok(());
5182            }
5183
5184            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5185            // are envelope_size bytes.
5186            let cur_offset: usize = (2 - 1) * envelope_size;
5187
5188            // Zero reserved fields.
5189            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5190
5191            // Safety:
5192            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5193            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5194            //   envelope_size bytes, there is always sufficient room.
5195            fidl::encoding::encode_in_envelope_optional::<
5196                fidl::encoding::BoundedString<64>,
5197                fidl::encoding::DefaultFuchsiaResourceDialect,
5198            >(
5199                self.process_name.as_ref().map(
5200                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
5201                ),
5202                encoder,
5203                offset + cur_offset,
5204                depth,
5205            )?;
5206
5207            _prev_end_offset = cur_offset + envelope_size;
5208            if 3 > max_ordinal {
5209                return Ok(());
5210            }
5211
5212            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5213            // are envelope_size bytes.
5214            let cur_offset: usize = (3 - 1) * envelope_size;
5215
5216            // Zero reserved fields.
5217            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5218
5219            // Safety:
5220            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5221            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5222            //   envelope_size bytes, there is always sufficient room.
5223            fidl::encoding::encode_in_envelope_optional::<
5224                u64,
5225                fidl::encoding::DefaultFuchsiaResourceDialect,
5226            >(
5227                self.process_koid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5228                encoder,
5229                offset + cur_offset,
5230                depth,
5231            )?;
5232
5233            _prev_end_offset = cur_offset + envelope_size;
5234            if 4 > max_ordinal {
5235                return Ok(());
5236            }
5237
5238            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5239            // are envelope_size bytes.
5240            let cur_offset: usize = (4 - 1) * envelope_size;
5241
5242            // Zero reserved fields.
5243            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5244
5245            // Safety:
5246            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5247            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5248            //   envelope_size bytes, there is always sufficient room.
5249            fidl::encoding::encode_in_envelope_optional::<
5250                fidl::encoding::BoundedString<64>,
5251                fidl::encoding::DefaultFuchsiaResourceDialect,
5252            >(
5253                self.thread_name.as_ref().map(
5254                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
5255                ),
5256                encoder,
5257                offset + cur_offset,
5258                depth,
5259            )?;
5260
5261            _prev_end_offset = cur_offset + envelope_size;
5262            if 5 > max_ordinal {
5263                return Ok(());
5264            }
5265
5266            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5267            // are envelope_size bytes.
5268            let cur_offset: usize = (5 - 1) * envelope_size;
5269
5270            // Zero reserved fields.
5271            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5272
5273            // Safety:
5274            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5275            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5276            //   envelope_size bytes, there is always sufficient room.
5277            fidl::encoding::encode_in_envelope_optional::<
5278                u64,
5279                fidl::encoding::DefaultFuchsiaResourceDialect,
5280            >(
5281                self.thread_koid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5282                encoder,
5283                offset + cur_offset,
5284                depth,
5285            )?;
5286
5287            _prev_end_offset = cur_offset + envelope_size;
5288
5289            Ok(())
5290        }
5291    }
5292
5293    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5294        for NativeCrashReport
5295    {
5296        #[inline(always)]
5297        fn new_empty() -> Self {
5298            Self::default()
5299        }
5300
5301        unsafe fn decode(
5302            &mut self,
5303            decoder: &mut fidl::encoding::Decoder<
5304                '_,
5305                fidl::encoding::DefaultFuchsiaResourceDialect,
5306            >,
5307            offset: usize,
5308            mut depth: fidl::encoding::Depth,
5309        ) -> fidl::Result<()> {
5310            decoder.debug_check_bounds::<Self>(offset);
5311            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5312                None => return Err(fidl::Error::NotNullable),
5313                Some(len) => len,
5314            };
5315            // Calling decoder.out_of_line_offset(0) is not allowed.
5316            if len == 0 {
5317                return Ok(());
5318            };
5319            depth.increment()?;
5320            let envelope_size = 8;
5321            let bytes_len = len * envelope_size;
5322            let offset = decoder.out_of_line_offset(bytes_len)?;
5323            // Decode the envelope for each type.
5324            let mut _next_ordinal_to_read = 0;
5325            let mut next_offset = offset;
5326            let end_offset = offset + bytes_len;
5327            _next_ordinal_to_read += 1;
5328            if next_offset >= end_offset {
5329                return Ok(());
5330            }
5331
5332            // Decode unknown envelopes for gaps in ordinals.
5333            while _next_ordinal_to_read < 1 {
5334                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5335                _next_ordinal_to_read += 1;
5336                next_offset += envelope_size;
5337            }
5338
5339            let next_out_of_line = decoder.next_out_of_line();
5340            let handles_before = decoder.remaining_handles();
5341            if let Some((inlined, num_bytes, num_handles)) =
5342                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5343            {
5344                let member_inline_size =
5345                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
5346                        decoder.context,
5347                    );
5348                if inlined != (member_inline_size <= 4) {
5349                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5350                }
5351                let inner_offset;
5352                let mut inner_depth = depth.clone();
5353                if inlined {
5354                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5355                    inner_offset = next_offset;
5356                } else {
5357                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5358                    inner_depth.increment()?;
5359                }
5360                let val_ref = self.minidump.get_or_insert_with(|| {
5361                    fidl::new_empty!(
5362                        fidl_fuchsia_mem::Buffer,
5363                        fidl::encoding::DefaultFuchsiaResourceDialect
5364                    )
5365                });
5366                fidl::decode!(
5367                    fidl_fuchsia_mem::Buffer,
5368                    fidl::encoding::DefaultFuchsiaResourceDialect,
5369                    val_ref,
5370                    decoder,
5371                    inner_offset,
5372                    inner_depth
5373                )?;
5374                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5375                {
5376                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5377                }
5378                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5379                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5380                }
5381            }
5382
5383            next_offset += envelope_size;
5384            _next_ordinal_to_read += 1;
5385            if next_offset >= end_offset {
5386                return Ok(());
5387            }
5388
5389            // Decode unknown envelopes for gaps in ordinals.
5390            while _next_ordinal_to_read < 2 {
5391                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5392                _next_ordinal_to_read += 1;
5393                next_offset += envelope_size;
5394            }
5395
5396            let next_out_of_line = decoder.next_out_of_line();
5397            let handles_before = decoder.remaining_handles();
5398            if let Some((inlined, num_bytes, num_handles)) =
5399                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5400            {
5401                let member_inline_size =
5402                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
5403                        decoder.context,
5404                    );
5405                if inlined != (member_inline_size <= 4) {
5406                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5407                }
5408                let inner_offset;
5409                let mut inner_depth = depth.clone();
5410                if inlined {
5411                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5412                    inner_offset = next_offset;
5413                } else {
5414                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5415                    inner_depth.increment()?;
5416                }
5417                let val_ref = self.process_name.get_or_insert_with(|| {
5418                    fidl::new_empty!(
5419                        fidl::encoding::BoundedString<64>,
5420                        fidl::encoding::DefaultFuchsiaResourceDialect
5421                    )
5422                });
5423                fidl::decode!(
5424                    fidl::encoding::BoundedString<64>,
5425                    fidl::encoding::DefaultFuchsiaResourceDialect,
5426                    val_ref,
5427                    decoder,
5428                    inner_offset,
5429                    inner_depth
5430                )?;
5431                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5432                {
5433                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5434                }
5435                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5436                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5437                }
5438            }
5439
5440            next_offset += envelope_size;
5441            _next_ordinal_to_read += 1;
5442            if next_offset >= end_offset {
5443                return Ok(());
5444            }
5445
5446            // Decode unknown envelopes for gaps in ordinals.
5447            while _next_ordinal_to_read < 3 {
5448                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5449                _next_ordinal_to_read += 1;
5450                next_offset += envelope_size;
5451            }
5452
5453            let next_out_of_line = decoder.next_out_of_line();
5454            let handles_before = decoder.remaining_handles();
5455            if let Some((inlined, num_bytes, num_handles)) =
5456                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5457            {
5458                let member_inline_size =
5459                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5460                if inlined != (member_inline_size <= 4) {
5461                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5462                }
5463                let inner_offset;
5464                let mut inner_depth = depth.clone();
5465                if inlined {
5466                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5467                    inner_offset = next_offset;
5468                } else {
5469                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5470                    inner_depth.increment()?;
5471                }
5472                let val_ref = self.process_koid.get_or_insert_with(|| {
5473                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
5474                });
5475                fidl::decode!(
5476                    u64,
5477                    fidl::encoding::DefaultFuchsiaResourceDialect,
5478                    val_ref,
5479                    decoder,
5480                    inner_offset,
5481                    inner_depth
5482                )?;
5483                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5484                {
5485                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5486                }
5487                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5488                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5489                }
5490            }
5491
5492            next_offset += envelope_size;
5493            _next_ordinal_to_read += 1;
5494            if next_offset >= end_offset {
5495                return Ok(());
5496            }
5497
5498            // Decode unknown envelopes for gaps in ordinals.
5499            while _next_ordinal_to_read < 4 {
5500                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5501                _next_ordinal_to_read += 1;
5502                next_offset += envelope_size;
5503            }
5504
5505            let next_out_of_line = decoder.next_out_of_line();
5506            let handles_before = decoder.remaining_handles();
5507            if let Some((inlined, num_bytes, num_handles)) =
5508                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5509            {
5510                let member_inline_size =
5511                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
5512                        decoder.context,
5513                    );
5514                if inlined != (member_inline_size <= 4) {
5515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5516                }
5517                let inner_offset;
5518                let mut inner_depth = depth.clone();
5519                if inlined {
5520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5521                    inner_offset = next_offset;
5522                } else {
5523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5524                    inner_depth.increment()?;
5525                }
5526                let val_ref = self.thread_name.get_or_insert_with(|| {
5527                    fidl::new_empty!(
5528                        fidl::encoding::BoundedString<64>,
5529                        fidl::encoding::DefaultFuchsiaResourceDialect
5530                    )
5531                });
5532                fidl::decode!(
5533                    fidl::encoding::BoundedString<64>,
5534                    fidl::encoding::DefaultFuchsiaResourceDialect,
5535                    val_ref,
5536                    decoder,
5537                    inner_offset,
5538                    inner_depth
5539                )?;
5540                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5541                {
5542                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5543                }
5544                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5545                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5546                }
5547            }
5548
5549            next_offset += envelope_size;
5550            _next_ordinal_to_read += 1;
5551            if next_offset >= end_offset {
5552                return Ok(());
5553            }
5554
5555            // Decode unknown envelopes for gaps in ordinals.
5556            while _next_ordinal_to_read < 5 {
5557                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5558                _next_ordinal_to_read += 1;
5559                next_offset += envelope_size;
5560            }
5561
5562            let next_out_of_line = decoder.next_out_of_line();
5563            let handles_before = decoder.remaining_handles();
5564            if let Some((inlined, num_bytes, num_handles)) =
5565                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5566            {
5567                let member_inline_size =
5568                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5569                if inlined != (member_inline_size <= 4) {
5570                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5571                }
5572                let inner_offset;
5573                let mut inner_depth = depth.clone();
5574                if inlined {
5575                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5576                    inner_offset = next_offset;
5577                } else {
5578                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5579                    inner_depth.increment()?;
5580                }
5581                let val_ref = self.thread_koid.get_or_insert_with(|| {
5582                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
5583                });
5584                fidl::decode!(
5585                    u64,
5586                    fidl::encoding::DefaultFuchsiaResourceDialect,
5587                    val_ref,
5588                    decoder,
5589                    inner_offset,
5590                    inner_depth
5591                )?;
5592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5593                {
5594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5595                }
5596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5598                }
5599            }
5600
5601            next_offset += envelope_size;
5602
5603            // Decode the remaining unknown envelopes.
5604            while next_offset < end_offset {
5605                _next_ordinal_to_read += 1;
5606                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5607                next_offset += envelope_size;
5608            }
5609
5610            Ok(())
5611        }
5612    }
5613
5614    impl RuntimeCrashReport {
5615        #[inline(always)]
5616        fn max_ordinal_present(&self) -> u64 {
5617            if let Some(_) = self.exception_stack_trace {
5618                return 3;
5619            }
5620            if let Some(_) = self.exception_message {
5621                return 2;
5622            }
5623            if let Some(_) = self.exception_type {
5624                return 1;
5625            }
5626            0
5627        }
5628    }
5629
5630    impl fidl::encoding::ResourceTypeMarker for RuntimeCrashReport {
5631        type Borrowed<'a> = &'a mut Self;
5632        fn take_or_borrow<'a>(
5633            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5634        ) -> Self::Borrowed<'a> {
5635            value
5636        }
5637    }
5638
5639    unsafe impl fidl::encoding::TypeMarker for RuntimeCrashReport {
5640        type Owned = Self;
5641
5642        #[inline(always)]
5643        fn inline_align(_context: fidl::encoding::Context) -> usize {
5644            8
5645        }
5646
5647        #[inline(always)]
5648        fn inline_size(_context: fidl::encoding::Context) -> usize {
5649            16
5650        }
5651    }
5652
5653    unsafe impl
5654        fidl::encoding::Encode<RuntimeCrashReport, fidl::encoding::DefaultFuchsiaResourceDialect>
5655        for &mut RuntimeCrashReport
5656    {
5657        unsafe fn encode(
5658            self,
5659            encoder: &mut fidl::encoding::Encoder<
5660                '_,
5661                fidl::encoding::DefaultFuchsiaResourceDialect,
5662            >,
5663            offset: usize,
5664            mut depth: fidl::encoding::Depth,
5665        ) -> fidl::Result<()> {
5666            encoder.debug_check_bounds::<RuntimeCrashReport>(offset);
5667            // Vector header
5668            let max_ordinal: u64 = self.max_ordinal_present();
5669            encoder.write_num(max_ordinal, offset);
5670            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5671            // Calling encoder.out_of_line_offset(0) is not allowed.
5672            if max_ordinal == 0 {
5673                return Ok(());
5674            }
5675            depth.increment()?;
5676            let envelope_size = 8;
5677            let bytes_len = max_ordinal as usize * envelope_size;
5678            #[allow(unused_variables)]
5679            let offset = encoder.out_of_line_offset(bytes_len);
5680            let mut _prev_end_offset: usize = 0;
5681            if 1 > max_ordinal {
5682                return Ok(());
5683            }
5684
5685            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5686            // are envelope_size bytes.
5687            let cur_offset: usize = (1 - 1) * envelope_size;
5688
5689            // Zero reserved fields.
5690            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5691
5692            // Safety:
5693            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5694            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5695            //   envelope_size bytes, there is always sufficient room.
5696            fidl::encoding::encode_in_envelope_optional::<
5697                fidl::encoding::BoundedString<128>,
5698                fidl::encoding::DefaultFuchsiaResourceDialect,
5699            >(
5700                self.exception_type.as_ref().map(
5701                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
5702                ),
5703                encoder,
5704                offset + cur_offset,
5705                depth,
5706            )?;
5707
5708            _prev_end_offset = cur_offset + envelope_size;
5709            if 2 > max_ordinal {
5710                return Ok(());
5711            }
5712
5713            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5714            // are envelope_size bytes.
5715            let cur_offset: usize = (2 - 1) * envelope_size;
5716
5717            // Zero reserved fields.
5718            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5719
5720            // Safety:
5721            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5722            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5723            //   envelope_size bytes, there is always sufficient room.
5724            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5725            self.exception_message.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
5726            encoder, offset + cur_offset, depth
5727        )?;
5728
5729            _prev_end_offset = cur_offset + envelope_size;
5730            if 3 > max_ordinal {
5731                return Ok(());
5732            }
5733
5734            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5735            // are envelope_size bytes.
5736            let cur_offset: usize = (3 - 1) * envelope_size;
5737
5738            // Zero reserved fields.
5739            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5740
5741            // Safety:
5742            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5743            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5744            //   envelope_size bytes, there is always sufficient room.
5745            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
5746            self.exception_stack_trace.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5747            encoder, offset + cur_offset, depth
5748        )?;
5749
5750            _prev_end_offset = cur_offset + envelope_size;
5751
5752            Ok(())
5753        }
5754    }
5755
5756    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5757        for RuntimeCrashReport
5758    {
5759        #[inline(always)]
5760        fn new_empty() -> Self {
5761            Self::default()
5762        }
5763
5764        unsafe fn decode(
5765            &mut self,
5766            decoder: &mut fidl::encoding::Decoder<
5767                '_,
5768                fidl::encoding::DefaultFuchsiaResourceDialect,
5769            >,
5770            offset: usize,
5771            mut depth: fidl::encoding::Depth,
5772        ) -> fidl::Result<()> {
5773            decoder.debug_check_bounds::<Self>(offset);
5774            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5775                None => return Err(fidl::Error::NotNullable),
5776                Some(len) => len,
5777            };
5778            // Calling decoder.out_of_line_offset(0) is not allowed.
5779            if len == 0 {
5780                return Ok(());
5781            };
5782            depth.increment()?;
5783            let envelope_size = 8;
5784            let bytes_len = len * envelope_size;
5785            let offset = decoder.out_of_line_offset(bytes_len)?;
5786            // Decode the envelope for each type.
5787            let mut _next_ordinal_to_read = 0;
5788            let mut next_offset = offset;
5789            let end_offset = offset + bytes_len;
5790            _next_ordinal_to_read += 1;
5791            if next_offset >= end_offset {
5792                return Ok(());
5793            }
5794
5795            // Decode unknown envelopes for gaps in ordinals.
5796            while _next_ordinal_to_read < 1 {
5797                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5798                _next_ordinal_to_read += 1;
5799                next_offset += envelope_size;
5800            }
5801
5802            let next_out_of_line = decoder.next_out_of_line();
5803            let handles_before = decoder.remaining_handles();
5804            if let Some((inlined, num_bytes, num_handles)) =
5805                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5806            {
5807                let member_inline_size =
5808                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
5809                        decoder.context,
5810                    );
5811                if inlined != (member_inline_size <= 4) {
5812                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5813                }
5814                let inner_offset;
5815                let mut inner_depth = depth.clone();
5816                if inlined {
5817                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5818                    inner_offset = next_offset;
5819                } else {
5820                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5821                    inner_depth.increment()?;
5822                }
5823                let val_ref = self.exception_type.get_or_insert_with(|| {
5824                    fidl::new_empty!(
5825                        fidl::encoding::BoundedString<128>,
5826                        fidl::encoding::DefaultFuchsiaResourceDialect
5827                    )
5828                });
5829                fidl::decode!(
5830                    fidl::encoding::BoundedString<128>,
5831                    fidl::encoding::DefaultFuchsiaResourceDialect,
5832                    val_ref,
5833                    decoder,
5834                    inner_offset,
5835                    inner_depth
5836                )?;
5837                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5838                {
5839                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5840                }
5841                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5842                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5843                }
5844            }
5845
5846            next_offset += envelope_size;
5847            _next_ordinal_to_read += 1;
5848            if next_offset >= end_offset {
5849                return Ok(());
5850            }
5851
5852            // Decode unknown envelopes for gaps in ordinals.
5853            while _next_ordinal_to_read < 2 {
5854                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5855                _next_ordinal_to_read += 1;
5856                next_offset += envelope_size;
5857            }
5858
5859            let next_out_of_line = decoder.next_out_of_line();
5860            let handles_before = decoder.remaining_handles();
5861            if let Some((inlined, num_bytes, num_handles)) =
5862                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5863            {
5864                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5865                if inlined != (member_inline_size <= 4) {
5866                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5867                }
5868                let inner_offset;
5869                let mut inner_depth = depth.clone();
5870                if inlined {
5871                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5872                    inner_offset = next_offset;
5873                } else {
5874                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5875                    inner_depth.increment()?;
5876                }
5877                let val_ref = self.exception_message.get_or_insert_with(|| {
5878                    fidl::new_empty!(
5879                        fidl::encoding::BoundedString<4096>,
5880                        fidl::encoding::DefaultFuchsiaResourceDialect
5881                    )
5882                });
5883                fidl::decode!(
5884                    fidl::encoding::BoundedString<4096>,
5885                    fidl::encoding::DefaultFuchsiaResourceDialect,
5886                    val_ref,
5887                    decoder,
5888                    inner_offset,
5889                    inner_depth
5890                )?;
5891                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5892                {
5893                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5894                }
5895                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5896                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5897                }
5898            }
5899
5900            next_offset += envelope_size;
5901            _next_ordinal_to_read += 1;
5902            if next_offset >= end_offset {
5903                return Ok(());
5904            }
5905
5906            // Decode unknown envelopes for gaps in ordinals.
5907            while _next_ordinal_to_read < 3 {
5908                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5909                _next_ordinal_to_read += 1;
5910                next_offset += envelope_size;
5911            }
5912
5913            let next_out_of_line = decoder.next_out_of_line();
5914            let handles_before = decoder.remaining_handles();
5915            if let Some((inlined, num_bytes, num_handles)) =
5916                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5917            {
5918                let member_inline_size =
5919                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
5920                        decoder.context,
5921                    );
5922                if inlined != (member_inline_size <= 4) {
5923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5924                }
5925                let inner_offset;
5926                let mut inner_depth = depth.clone();
5927                if inlined {
5928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5929                    inner_offset = next_offset;
5930                } else {
5931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5932                    inner_depth.increment()?;
5933                }
5934                let val_ref = self.exception_stack_trace.get_or_insert_with(|| {
5935                    fidl::new_empty!(
5936                        fidl_fuchsia_mem::Buffer,
5937                        fidl::encoding::DefaultFuchsiaResourceDialect
5938                    )
5939                });
5940                fidl::decode!(
5941                    fidl_fuchsia_mem::Buffer,
5942                    fidl::encoding::DefaultFuchsiaResourceDialect,
5943                    val_ref,
5944                    decoder,
5945                    inner_offset,
5946                    inner_depth
5947                )?;
5948                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5949                {
5950                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5951                }
5952                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5953                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5954                }
5955            }
5956
5957            next_offset += envelope_size;
5958
5959            // Decode the remaining unknown envelopes.
5960            while next_offset < end_offset {
5961                _next_ordinal_to_read += 1;
5962                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5963                next_offset += envelope_size;
5964            }
5965
5966            Ok(())
5967        }
5968    }
5969
5970    impl Snapshot {
5971        #[inline(always)]
5972        fn max_ordinal_present(&self) -> u64 {
5973            if let Some(_) = self.annotations2 {
5974                return 3;
5975            }
5976            if let Some(_) = self.archive {
5977                return 1;
5978            }
5979            0
5980        }
5981    }
5982
5983    impl fidl::encoding::ResourceTypeMarker for Snapshot {
5984        type Borrowed<'a> = &'a mut Self;
5985        fn take_or_borrow<'a>(
5986            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5987        ) -> Self::Borrowed<'a> {
5988            value
5989        }
5990    }
5991
5992    unsafe impl fidl::encoding::TypeMarker for Snapshot {
5993        type Owned = Self;
5994
5995        #[inline(always)]
5996        fn inline_align(_context: fidl::encoding::Context) -> usize {
5997            8
5998        }
5999
6000        #[inline(always)]
6001        fn inline_size(_context: fidl::encoding::Context) -> usize {
6002            16
6003        }
6004    }
6005
6006    unsafe impl fidl::encoding::Encode<Snapshot, fidl::encoding::DefaultFuchsiaResourceDialect>
6007        for &mut Snapshot
6008    {
6009        unsafe fn encode(
6010            self,
6011            encoder: &mut fidl::encoding::Encoder<
6012                '_,
6013                fidl::encoding::DefaultFuchsiaResourceDialect,
6014            >,
6015            offset: usize,
6016            mut depth: fidl::encoding::Depth,
6017        ) -> fidl::Result<()> {
6018            encoder.debug_check_bounds::<Snapshot>(offset);
6019            // Vector header
6020            let max_ordinal: u64 = self.max_ordinal_present();
6021            encoder.write_num(max_ordinal, offset);
6022            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6023            // Calling encoder.out_of_line_offset(0) is not allowed.
6024            if max_ordinal == 0 {
6025                return Ok(());
6026            }
6027            depth.increment()?;
6028            let envelope_size = 8;
6029            let bytes_len = max_ordinal as usize * envelope_size;
6030            #[allow(unused_variables)]
6031            let offset = encoder.out_of_line_offset(bytes_len);
6032            let mut _prev_end_offset: usize = 0;
6033            if 1 > max_ordinal {
6034                return Ok(());
6035            }
6036
6037            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6038            // are envelope_size bytes.
6039            let cur_offset: usize = (1 - 1) * envelope_size;
6040
6041            // Zero reserved fields.
6042            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6043
6044            // Safety:
6045            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6046            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6047            //   envelope_size bytes, there is always sufficient room.
6048            fidl::encoding::encode_in_envelope_optional::<
6049                Attachment,
6050                fidl::encoding::DefaultFuchsiaResourceDialect,
6051            >(
6052                self.archive
6053                    .as_mut()
6054                    .map(<Attachment as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6055                encoder,
6056                offset + cur_offset,
6057                depth,
6058            )?;
6059
6060            _prev_end_offset = cur_offset + envelope_size;
6061            if 3 > max_ordinal {
6062                return Ok(());
6063            }
6064
6065            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6066            // are envelope_size bytes.
6067            let cur_offset: usize = (3 - 1) * envelope_size;
6068
6069            // Zero reserved fields.
6070            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6071
6072            // Safety:
6073            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6074            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6075            //   envelope_size bytes, there is always sufficient room.
6076            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Annotation, 512>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6077            self.annotations2.as_ref().map(<fidl::encoding::Vector<Annotation, 512> as fidl::encoding::ValueTypeMarker>::borrow),
6078            encoder, offset + cur_offset, depth
6079        )?;
6080
6081            _prev_end_offset = cur_offset + envelope_size;
6082
6083            Ok(())
6084        }
6085    }
6086
6087    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Snapshot {
6088        #[inline(always)]
6089        fn new_empty() -> Self {
6090            Self::default()
6091        }
6092
6093        unsafe fn decode(
6094            &mut self,
6095            decoder: &mut fidl::encoding::Decoder<
6096                '_,
6097                fidl::encoding::DefaultFuchsiaResourceDialect,
6098            >,
6099            offset: usize,
6100            mut depth: fidl::encoding::Depth,
6101        ) -> fidl::Result<()> {
6102            decoder.debug_check_bounds::<Self>(offset);
6103            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6104                None => return Err(fidl::Error::NotNullable),
6105                Some(len) => len,
6106            };
6107            // Calling decoder.out_of_line_offset(0) is not allowed.
6108            if len == 0 {
6109                return Ok(());
6110            };
6111            depth.increment()?;
6112            let envelope_size = 8;
6113            let bytes_len = len * envelope_size;
6114            let offset = decoder.out_of_line_offset(bytes_len)?;
6115            // Decode the envelope for each type.
6116            let mut _next_ordinal_to_read = 0;
6117            let mut next_offset = offset;
6118            let end_offset = offset + bytes_len;
6119            _next_ordinal_to_read += 1;
6120            if next_offset >= end_offset {
6121                return Ok(());
6122            }
6123
6124            // Decode unknown envelopes for gaps in ordinals.
6125            while _next_ordinal_to_read < 1 {
6126                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6127                _next_ordinal_to_read += 1;
6128                next_offset += envelope_size;
6129            }
6130
6131            let next_out_of_line = decoder.next_out_of_line();
6132            let handles_before = decoder.remaining_handles();
6133            if let Some((inlined, num_bytes, num_handles)) =
6134                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6135            {
6136                let member_inline_size =
6137                    <Attachment as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6138                if inlined != (member_inline_size <= 4) {
6139                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6140                }
6141                let inner_offset;
6142                let mut inner_depth = depth.clone();
6143                if inlined {
6144                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6145                    inner_offset = next_offset;
6146                } else {
6147                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6148                    inner_depth.increment()?;
6149                }
6150                let val_ref = self.archive.get_or_insert_with(|| {
6151                    fidl::new_empty!(Attachment, fidl::encoding::DefaultFuchsiaResourceDialect)
6152                });
6153                fidl::decode!(
6154                    Attachment,
6155                    fidl::encoding::DefaultFuchsiaResourceDialect,
6156                    val_ref,
6157                    decoder,
6158                    inner_offset,
6159                    inner_depth
6160                )?;
6161                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6162                {
6163                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6164                }
6165                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6166                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6167                }
6168            }
6169
6170            next_offset += envelope_size;
6171            _next_ordinal_to_read += 1;
6172            if next_offset >= end_offset {
6173                return Ok(());
6174            }
6175
6176            // Decode unknown envelopes for gaps in ordinals.
6177            while _next_ordinal_to_read < 3 {
6178                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6179                _next_ordinal_to_read += 1;
6180                next_offset += envelope_size;
6181            }
6182
6183            let next_out_of_line = decoder.next_out_of_line();
6184            let handles_before = decoder.remaining_handles();
6185            if let Some((inlined, num_bytes, num_handles)) =
6186                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6187            {
6188                let member_inline_size = <fidl::encoding::Vector<Annotation, 512> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6189                if inlined != (member_inline_size <= 4) {
6190                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6191                }
6192                let inner_offset;
6193                let mut inner_depth = depth.clone();
6194                if inlined {
6195                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6196                    inner_offset = next_offset;
6197                } else {
6198                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6199                    inner_depth.increment()?;
6200                }
6201                let val_ref =
6202                self.annotations2.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Annotation, 512>, fidl::encoding::DefaultFuchsiaResourceDialect));
6203                fidl::decode!(fidl::encoding::Vector<Annotation, 512>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6204                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6205                {
6206                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6207                }
6208                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6209                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6210                }
6211            }
6212
6213            next_offset += envelope_size;
6214
6215            // Decode the remaining unknown envelopes.
6216            while next_offset < end_offset {
6217                _next_ordinal_to_read += 1;
6218                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6219                next_offset += envelope_size;
6220            }
6221
6222            Ok(())
6223        }
6224    }
6225
6226    impl TextBacktraceCrashReport {
6227        #[inline(always)]
6228        fn max_ordinal_present(&self) -> u64 {
6229            if let Some(_) = self.thread_koid {
6230                return 5;
6231            }
6232            if let Some(_) = self.thread_name {
6233                return 4;
6234            }
6235            if let Some(_) = self.process_koid {
6236                return 3;
6237            }
6238            if let Some(_) = self.process_name {
6239                return 2;
6240            }
6241            if let Some(_) = self.fuchsia_backtrace {
6242                return 1;
6243            }
6244            0
6245        }
6246    }
6247
6248    impl fidl::encoding::ResourceTypeMarker for TextBacktraceCrashReport {
6249        type Borrowed<'a> = &'a mut Self;
6250        fn take_or_borrow<'a>(
6251            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6252        ) -> Self::Borrowed<'a> {
6253            value
6254        }
6255    }
6256
6257    unsafe impl fidl::encoding::TypeMarker for TextBacktraceCrashReport {
6258        type Owned = Self;
6259
6260        #[inline(always)]
6261        fn inline_align(_context: fidl::encoding::Context) -> usize {
6262            8
6263        }
6264
6265        #[inline(always)]
6266        fn inline_size(_context: fidl::encoding::Context) -> usize {
6267            16
6268        }
6269    }
6270
6271    unsafe impl
6272        fidl::encoding::Encode<
6273            TextBacktraceCrashReport,
6274            fidl::encoding::DefaultFuchsiaResourceDialect,
6275        > for &mut TextBacktraceCrashReport
6276    {
6277        unsafe fn encode(
6278            self,
6279            encoder: &mut fidl::encoding::Encoder<
6280                '_,
6281                fidl::encoding::DefaultFuchsiaResourceDialect,
6282            >,
6283            offset: usize,
6284            mut depth: fidl::encoding::Depth,
6285        ) -> fidl::Result<()> {
6286            encoder.debug_check_bounds::<TextBacktraceCrashReport>(offset);
6287            // Vector header
6288            let max_ordinal: u64 = self.max_ordinal_present();
6289            encoder.write_num(max_ordinal, offset);
6290            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6291            // Calling encoder.out_of_line_offset(0) is not allowed.
6292            if max_ordinal == 0 {
6293                return Ok(());
6294            }
6295            depth.increment()?;
6296            let envelope_size = 8;
6297            let bytes_len = max_ordinal as usize * envelope_size;
6298            #[allow(unused_variables)]
6299            let offset = encoder.out_of_line_offset(bytes_len);
6300            let mut _prev_end_offset: usize = 0;
6301            if 1 > max_ordinal {
6302                return Ok(());
6303            }
6304
6305            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6306            // are envelope_size bytes.
6307            let cur_offset: usize = (1 - 1) * envelope_size;
6308
6309            // Zero reserved fields.
6310            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6311
6312            // Safety:
6313            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6314            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6315            //   envelope_size bytes, there is always sufficient room.
6316            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
6317            self.fuchsia_backtrace.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6318            encoder, offset + cur_offset, depth
6319        )?;
6320
6321            _prev_end_offset = cur_offset + envelope_size;
6322            if 2 > max_ordinal {
6323                return Ok(());
6324            }
6325
6326            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6327            // are envelope_size bytes.
6328            let cur_offset: usize = (2 - 1) * envelope_size;
6329
6330            // Zero reserved fields.
6331            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6332
6333            // Safety:
6334            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6335            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6336            //   envelope_size bytes, there is always sufficient room.
6337            fidl::encoding::encode_in_envelope_optional::<
6338                fidl::encoding::BoundedString<64>,
6339                fidl::encoding::DefaultFuchsiaResourceDialect,
6340            >(
6341                self.process_name.as_ref().map(
6342                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
6343                ),
6344                encoder,
6345                offset + cur_offset,
6346                depth,
6347            )?;
6348
6349            _prev_end_offset = cur_offset + envelope_size;
6350            if 3 > max_ordinal {
6351                return Ok(());
6352            }
6353
6354            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6355            // are envelope_size bytes.
6356            let cur_offset: usize = (3 - 1) * envelope_size;
6357
6358            // Zero reserved fields.
6359            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6360
6361            // Safety:
6362            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6363            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6364            //   envelope_size bytes, there is always sufficient room.
6365            fidl::encoding::encode_in_envelope_optional::<
6366                u64,
6367                fidl::encoding::DefaultFuchsiaResourceDialect,
6368            >(
6369                self.process_koid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6370                encoder,
6371                offset + cur_offset,
6372                depth,
6373            )?;
6374
6375            _prev_end_offset = cur_offset + envelope_size;
6376            if 4 > max_ordinal {
6377                return Ok(());
6378            }
6379
6380            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6381            // are envelope_size bytes.
6382            let cur_offset: usize = (4 - 1) * envelope_size;
6383
6384            // Zero reserved fields.
6385            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6386
6387            // Safety:
6388            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6389            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6390            //   envelope_size bytes, there is always sufficient room.
6391            fidl::encoding::encode_in_envelope_optional::<
6392                fidl::encoding::BoundedString<64>,
6393                fidl::encoding::DefaultFuchsiaResourceDialect,
6394            >(
6395                self.thread_name.as_ref().map(
6396                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
6397                ),
6398                encoder,
6399                offset + cur_offset,
6400                depth,
6401            )?;
6402
6403            _prev_end_offset = cur_offset + envelope_size;
6404            if 5 > max_ordinal {
6405                return Ok(());
6406            }
6407
6408            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6409            // are envelope_size bytes.
6410            let cur_offset: usize = (5 - 1) * envelope_size;
6411
6412            // Zero reserved fields.
6413            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6414
6415            // Safety:
6416            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6417            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6418            //   envelope_size bytes, there is always sufficient room.
6419            fidl::encoding::encode_in_envelope_optional::<
6420                u64,
6421                fidl::encoding::DefaultFuchsiaResourceDialect,
6422            >(
6423                self.thread_koid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6424                encoder,
6425                offset + cur_offset,
6426                depth,
6427            )?;
6428
6429            _prev_end_offset = cur_offset + envelope_size;
6430
6431            Ok(())
6432        }
6433    }
6434
6435    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6436        for TextBacktraceCrashReport
6437    {
6438        #[inline(always)]
6439        fn new_empty() -> Self {
6440            Self::default()
6441        }
6442
6443        unsafe fn decode(
6444            &mut self,
6445            decoder: &mut fidl::encoding::Decoder<
6446                '_,
6447                fidl::encoding::DefaultFuchsiaResourceDialect,
6448            >,
6449            offset: usize,
6450            mut depth: fidl::encoding::Depth,
6451        ) -> fidl::Result<()> {
6452            decoder.debug_check_bounds::<Self>(offset);
6453            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6454                None => return Err(fidl::Error::NotNullable),
6455                Some(len) => len,
6456            };
6457            // Calling decoder.out_of_line_offset(0) is not allowed.
6458            if len == 0 {
6459                return Ok(());
6460            };
6461            depth.increment()?;
6462            let envelope_size = 8;
6463            let bytes_len = len * envelope_size;
6464            let offset = decoder.out_of_line_offset(bytes_len)?;
6465            // Decode the envelope for each type.
6466            let mut _next_ordinal_to_read = 0;
6467            let mut next_offset = offset;
6468            let end_offset = offset + bytes_len;
6469            _next_ordinal_to_read += 1;
6470            if next_offset >= end_offset {
6471                return Ok(());
6472            }
6473
6474            // Decode unknown envelopes for gaps in ordinals.
6475            while _next_ordinal_to_read < 1 {
6476                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6477                _next_ordinal_to_read += 1;
6478                next_offset += envelope_size;
6479            }
6480
6481            let next_out_of_line = decoder.next_out_of_line();
6482            let handles_before = decoder.remaining_handles();
6483            if let Some((inlined, num_bytes, num_handles)) =
6484                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6485            {
6486                let member_inline_size =
6487                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
6488                        decoder.context,
6489                    );
6490                if inlined != (member_inline_size <= 4) {
6491                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6492                }
6493                let inner_offset;
6494                let mut inner_depth = depth.clone();
6495                if inlined {
6496                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6497                    inner_offset = next_offset;
6498                } else {
6499                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6500                    inner_depth.increment()?;
6501                }
6502                let val_ref = self.fuchsia_backtrace.get_or_insert_with(|| {
6503                    fidl::new_empty!(
6504                        fidl_fuchsia_mem::Buffer,
6505                        fidl::encoding::DefaultFuchsiaResourceDialect
6506                    )
6507                });
6508                fidl::decode!(
6509                    fidl_fuchsia_mem::Buffer,
6510                    fidl::encoding::DefaultFuchsiaResourceDialect,
6511                    val_ref,
6512                    decoder,
6513                    inner_offset,
6514                    inner_depth
6515                )?;
6516                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6517                {
6518                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6519                }
6520                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6521                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6522                }
6523            }
6524
6525            next_offset += envelope_size;
6526            _next_ordinal_to_read += 1;
6527            if next_offset >= end_offset {
6528                return Ok(());
6529            }
6530
6531            // Decode unknown envelopes for gaps in ordinals.
6532            while _next_ordinal_to_read < 2 {
6533                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6534                _next_ordinal_to_read += 1;
6535                next_offset += envelope_size;
6536            }
6537
6538            let next_out_of_line = decoder.next_out_of_line();
6539            let handles_before = decoder.remaining_handles();
6540            if let Some((inlined, num_bytes, num_handles)) =
6541                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6542            {
6543                let member_inline_size =
6544                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
6545                        decoder.context,
6546                    );
6547                if inlined != (member_inline_size <= 4) {
6548                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6549                }
6550                let inner_offset;
6551                let mut inner_depth = depth.clone();
6552                if inlined {
6553                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6554                    inner_offset = next_offset;
6555                } else {
6556                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6557                    inner_depth.increment()?;
6558                }
6559                let val_ref = self.process_name.get_or_insert_with(|| {
6560                    fidl::new_empty!(
6561                        fidl::encoding::BoundedString<64>,
6562                        fidl::encoding::DefaultFuchsiaResourceDialect
6563                    )
6564                });
6565                fidl::decode!(
6566                    fidl::encoding::BoundedString<64>,
6567                    fidl::encoding::DefaultFuchsiaResourceDialect,
6568                    val_ref,
6569                    decoder,
6570                    inner_offset,
6571                    inner_depth
6572                )?;
6573                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6574                {
6575                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6576                }
6577                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6578                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6579                }
6580            }
6581
6582            next_offset += envelope_size;
6583            _next_ordinal_to_read += 1;
6584            if next_offset >= end_offset {
6585                return Ok(());
6586            }
6587
6588            // Decode unknown envelopes for gaps in ordinals.
6589            while _next_ordinal_to_read < 3 {
6590                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6591                _next_ordinal_to_read += 1;
6592                next_offset += envelope_size;
6593            }
6594
6595            let next_out_of_line = decoder.next_out_of_line();
6596            let handles_before = decoder.remaining_handles();
6597            if let Some((inlined, num_bytes, num_handles)) =
6598                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6599            {
6600                let member_inline_size =
6601                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6602                if inlined != (member_inline_size <= 4) {
6603                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6604                }
6605                let inner_offset;
6606                let mut inner_depth = depth.clone();
6607                if inlined {
6608                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6609                    inner_offset = next_offset;
6610                } else {
6611                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6612                    inner_depth.increment()?;
6613                }
6614                let val_ref = self.process_koid.get_or_insert_with(|| {
6615                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
6616                });
6617                fidl::decode!(
6618                    u64,
6619                    fidl::encoding::DefaultFuchsiaResourceDialect,
6620                    val_ref,
6621                    decoder,
6622                    inner_offset,
6623                    inner_depth
6624                )?;
6625                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6626                {
6627                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6628                }
6629                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6630                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6631                }
6632            }
6633
6634            next_offset += envelope_size;
6635            _next_ordinal_to_read += 1;
6636            if next_offset >= end_offset {
6637                return Ok(());
6638            }
6639
6640            // Decode unknown envelopes for gaps in ordinals.
6641            while _next_ordinal_to_read < 4 {
6642                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6643                _next_ordinal_to_read += 1;
6644                next_offset += envelope_size;
6645            }
6646
6647            let next_out_of_line = decoder.next_out_of_line();
6648            let handles_before = decoder.remaining_handles();
6649            if let Some((inlined, num_bytes, num_handles)) =
6650                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6651            {
6652                let member_inline_size =
6653                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
6654                        decoder.context,
6655                    );
6656                if inlined != (member_inline_size <= 4) {
6657                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6658                }
6659                let inner_offset;
6660                let mut inner_depth = depth.clone();
6661                if inlined {
6662                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6663                    inner_offset = next_offset;
6664                } else {
6665                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6666                    inner_depth.increment()?;
6667                }
6668                let val_ref = self.thread_name.get_or_insert_with(|| {
6669                    fidl::new_empty!(
6670                        fidl::encoding::BoundedString<64>,
6671                        fidl::encoding::DefaultFuchsiaResourceDialect
6672                    )
6673                });
6674                fidl::decode!(
6675                    fidl::encoding::BoundedString<64>,
6676                    fidl::encoding::DefaultFuchsiaResourceDialect,
6677                    val_ref,
6678                    decoder,
6679                    inner_offset,
6680                    inner_depth
6681                )?;
6682                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6683                {
6684                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6685                }
6686                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6687                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6688                }
6689            }
6690
6691            next_offset += envelope_size;
6692            _next_ordinal_to_read += 1;
6693            if next_offset >= end_offset {
6694                return Ok(());
6695            }
6696
6697            // Decode unknown envelopes for gaps in ordinals.
6698            while _next_ordinal_to_read < 5 {
6699                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6700                _next_ordinal_to_read += 1;
6701                next_offset += envelope_size;
6702            }
6703
6704            let next_out_of_line = decoder.next_out_of_line();
6705            let handles_before = decoder.remaining_handles();
6706            if let Some((inlined, num_bytes, num_handles)) =
6707                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6708            {
6709                let member_inline_size =
6710                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6711                if inlined != (member_inline_size <= 4) {
6712                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6713                }
6714                let inner_offset;
6715                let mut inner_depth = depth.clone();
6716                if inlined {
6717                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6718                    inner_offset = next_offset;
6719                } else {
6720                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6721                    inner_depth.increment()?;
6722                }
6723                let val_ref = self.thread_koid.get_or_insert_with(|| {
6724                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
6725                });
6726                fidl::decode!(
6727                    u64,
6728                    fidl::encoding::DefaultFuchsiaResourceDialect,
6729                    val_ref,
6730                    decoder,
6731                    inner_offset,
6732                    inner_depth
6733                )?;
6734                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6735                {
6736                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6737                }
6738                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6739                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6740                }
6741            }
6742
6743            next_offset += envelope_size;
6744
6745            // Decode the remaining unknown envelopes.
6746            while next_offset < end_offset {
6747                _next_ordinal_to_read += 1;
6748                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6749                next_offset += envelope_size;
6750            }
6751
6752            Ok(())
6753        }
6754    }
6755
6756    impl fidl::encoding::ResourceTypeMarker for SpecificCrashReport {
6757        type Borrowed<'a> = &'a mut Self;
6758        fn take_or_borrow<'a>(
6759            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6760        ) -> Self::Borrowed<'a> {
6761            value
6762        }
6763    }
6764
6765    unsafe impl fidl::encoding::TypeMarker for SpecificCrashReport {
6766        type Owned = Self;
6767
6768        #[inline(always)]
6769        fn inline_align(_context: fidl::encoding::Context) -> usize {
6770            8
6771        }
6772
6773        #[inline(always)]
6774        fn inline_size(_context: fidl::encoding::Context) -> usize {
6775            16
6776        }
6777    }
6778
6779    unsafe impl
6780        fidl::encoding::Encode<SpecificCrashReport, fidl::encoding::DefaultFuchsiaResourceDialect>
6781        for &mut SpecificCrashReport
6782    {
6783        #[inline]
6784        unsafe fn encode(
6785            self,
6786            encoder: &mut fidl::encoding::Encoder<
6787                '_,
6788                fidl::encoding::DefaultFuchsiaResourceDialect,
6789            >,
6790            offset: usize,
6791            _depth: fidl::encoding::Depth,
6792        ) -> fidl::Result<()> {
6793            encoder.debug_check_bounds::<SpecificCrashReport>(offset);
6794            encoder.write_num::<u64>(self.ordinal(), offset);
6795            match self {
6796            SpecificCrashReport::Native(ref mut val) => {
6797                fidl::encoding::encode_in_envelope::<NativeCrashReport, fidl::encoding::DefaultFuchsiaResourceDialect>(
6798                    <NativeCrashReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
6799                    encoder, offset + 8, _depth
6800                )
6801            }
6802            SpecificCrashReport::Dart(ref mut val) => {
6803                fidl::encoding::encode_in_envelope::<RuntimeCrashReport, fidl::encoding::DefaultFuchsiaResourceDialect>(
6804                    <RuntimeCrashReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
6805                    encoder, offset + 8, _depth
6806                )
6807            }
6808            SpecificCrashReport::TextBacktrace(ref mut val) => {
6809                fidl::encoding::encode_in_envelope::<TextBacktraceCrashReport, fidl::encoding::DefaultFuchsiaResourceDialect>(
6810                    <TextBacktraceCrashReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
6811                    encoder, offset + 8, _depth
6812                )
6813            }
6814            SpecificCrashReport::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6815        }
6816        }
6817    }
6818
6819    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6820        for SpecificCrashReport
6821    {
6822        #[inline(always)]
6823        fn new_empty() -> Self {
6824            Self::__SourceBreaking { unknown_ordinal: 0 }
6825        }
6826
6827        #[inline]
6828        unsafe fn decode(
6829            &mut self,
6830            decoder: &mut fidl::encoding::Decoder<
6831                '_,
6832                fidl::encoding::DefaultFuchsiaResourceDialect,
6833            >,
6834            offset: usize,
6835            mut depth: fidl::encoding::Depth,
6836        ) -> fidl::Result<()> {
6837            decoder.debug_check_bounds::<Self>(offset);
6838            #[allow(unused_variables)]
6839            let next_out_of_line = decoder.next_out_of_line();
6840            let handles_before = decoder.remaining_handles();
6841            let (ordinal, inlined, num_bytes, num_handles) =
6842                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6843
6844            let member_inline_size = match ordinal {
6845                2 => {
6846                    <NativeCrashReport as fidl::encoding::TypeMarker>::inline_size(decoder.context)
6847                }
6848                3 => {
6849                    <RuntimeCrashReport as fidl::encoding::TypeMarker>::inline_size(decoder.context)
6850                }
6851                4 => <TextBacktraceCrashReport as fidl::encoding::TypeMarker>::inline_size(
6852                    decoder.context,
6853                ),
6854                0 => return Err(fidl::Error::UnknownUnionTag),
6855                _ => num_bytes as usize,
6856            };
6857
6858            if inlined != (member_inline_size <= 4) {
6859                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6860            }
6861            let _inner_offset;
6862            if inlined {
6863                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6864                _inner_offset = offset + 8;
6865            } else {
6866                depth.increment()?;
6867                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6868            }
6869            match ordinal {
6870                2 => {
6871                    #[allow(irrefutable_let_patterns)]
6872                    if let SpecificCrashReport::Native(_) = self {
6873                        // Do nothing, read the value into the object
6874                    } else {
6875                        // Initialize `self` to the right variant
6876                        *self = SpecificCrashReport::Native(fidl::new_empty!(
6877                            NativeCrashReport,
6878                            fidl::encoding::DefaultFuchsiaResourceDialect
6879                        ));
6880                    }
6881                    #[allow(irrefutable_let_patterns)]
6882                    if let SpecificCrashReport::Native(ref mut val) = self {
6883                        fidl::decode!(
6884                            NativeCrashReport,
6885                            fidl::encoding::DefaultFuchsiaResourceDialect,
6886                            val,
6887                            decoder,
6888                            _inner_offset,
6889                            depth
6890                        )?;
6891                    } else {
6892                        unreachable!()
6893                    }
6894                }
6895                3 => {
6896                    #[allow(irrefutable_let_patterns)]
6897                    if let SpecificCrashReport::Dart(_) = self {
6898                        // Do nothing, read the value into the object
6899                    } else {
6900                        // Initialize `self` to the right variant
6901                        *self = SpecificCrashReport::Dart(fidl::new_empty!(
6902                            RuntimeCrashReport,
6903                            fidl::encoding::DefaultFuchsiaResourceDialect
6904                        ));
6905                    }
6906                    #[allow(irrefutable_let_patterns)]
6907                    if let SpecificCrashReport::Dart(ref mut val) = self {
6908                        fidl::decode!(
6909                            RuntimeCrashReport,
6910                            fidl::encoding::DefaultFuchsiaResourceDialect,
6911                            val,
6912                            decoder,
6913                            _inner_offset,
6914                            depth
6915                        )?;
6916                    } else {
6917                        unreachable!()
6918                    }
6919                }
6920                4 => {
6921                    #[allow(irrefutable_let_patterns)]
6922                    if let SpecificCrashReport::TextBacktrace(_) = self {
6923                        // Do nothing, read the value into the object
6924                    } else {
6925                        // Initialize `self` to the right variant
6926                        *self = SpecificCrashReport::TextBacktrace(fidl::new_empty!(
6927                            TextBacktraceCrashReport,
6928                            fidl::encoding::DefaultFuchsiaResourceDialect
6929                        ));
6930                    }
6931                    #[allow(irrefutable_let_patterns)]
6932                    if let SpecificCrashReport::TextBacktrace(ref mut val) = self {
6933                        fidl::decode!(
6934                            TextBacktraceCrashReport,
6935                            fidl::encoding::DefaultFuchsiaResourceDialect,
6936                            val,
6937                            decoder,
6938                            _inner_offset,
6939                            depth
6940                        )?;
6941                    } else {
6942                        unreachable!()
6943                    }
6944                }
6945                #[allow(deprecated)]
6946                ordinal => {
6947                    for _ in 0..num_handles {
6948                        decoder.drop_next_handle()?;
6949                    }
6950                    *self = SpecificCrashReport::__SourceBreaking { unknown_ordinal: ordinal };
6951                }
6952            }
6953            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6954                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6955            }
6956            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6957                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6958            }
6959            Ok(())
6960        }
6961    }
6962}