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