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