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