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