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