Skip to main content

fidl_fuchsia_feedback/
fidl_fuchsia_feedback.rs

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