Skip to main content

fidl_fuchsia_feedback/
fidl_fuchsia_feedback.rs

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