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