1#![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_firmware_crash_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct Crash {
16 pub subsystem_name: Option<String>,
18 pub timestamp: Option<fidl::BootInstant>,
20 pub reason: Option<String>,
22 pub count: Option<u32>,
26 pub firmware_version: Option<String>,
28 pub crash_dump: Option<fidl::Vmo>,
30 #[doc(hidden)]
31 pub __source_breaking: fidl::marker::SourceBreaking,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Crash {}
35
36#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
37pub struct ReporterMarker;
38
39impl fidl::endpoints::ProtocolMarker for ReporterMarker {
40 type Proxy = ReporterProxy;
41 type RequestStream = ReporterRequestStream;
42 #[cfg(target_os = "fuchsia")]
43 type SynchronousProxy = ReporterSynchronousProxy;
44
45 const DEBUG_NAME: &'static str = "fuchsia.firmware.crash.Reporter";
46}
47impl fidl::endpoints::DiscoverableProtocolMarker for ReporterMarker {}
48
49pub trait ReporterProxyInterface: Send + Sync {
50 fn r#report(&self, payload: Crash) -> Result<(), fidl::Error>;
51}
52#[derive(Debug)]
53#[cfg(target_os = "fuchsia")]
54pub struct ReporterSynchronousProxy {
55 client: fidl::client::sync::Client,
56}
57
58#[cfg(target_os = "fuchsia")]
59impl fidl::endpoints::SynchronousProxy for ReporterSynchronousProxy {
60 type Proxy = ReporterProxy;
61 type Protocol = ReporterMarker;
62
63 fn from_channel(inner: fidl::Channel) -> Self {
64 Self::new(inner)
65 }
66
67 fn into_channel(self) -> fidl::Channel {
68 self.client.into_channel()
69 }
70
71 fn as_channel(&self) -> &fidl::Channel {
72 self.client.as_channel()
73 }
74}
75
76#[cfg(target_os = "fuchsia")]
77impl ReporterSynchronousProxy {
78 pub fn new(channel: fidl::Channel) -> Self {
79 Self { client: fidl::client::sync::Client::new(channel) }
80 }
81
82 pub fn into_channel(self) -> fidl::Channel {
83 self.client.into_channel()
84 }
85
86 pub fn wait_for_event(
89 &self,
90 deadline: zx::MonotonicInstant,
91 ) -> Result<ReporterEvent, fidl::Error> {
92 ReporterEvent::decode(self.client.wait_for_event::<ReporterMarker>(deadline)?)
93 }
94
95 pub fn r#report(&self, mut payload: Crash) -> Result<(), fidl::Error> {
97 self.client.send::<Crash>(
98 &mut payload,
99 0x6283d741761d9fe5,
100 fidl::encoding::DynamicFlags::FLEXIBLE,
101 )
102 }
103}
104
105#[cfg(target_os = "fuchsia")]
106impl From<ReporterSynchronousProxy> for zx::NullableHandle {
107 fn from(value: ReporterSynchronousProxy) -> Self {
108 value.into_channel().into()
109 }
110}
111
112#[cfg(target_os = "fuchsia")]
113impl From<fidl::Channel> for ReporterSynchronousProxy {
114 fn from(value: fidl::Channel) -> Self {
115 Self::new(value)
116 }
117}
118
119#[cfg(target_os = "fuchsia")]
120impl fidl::endpoints::FromClient for ReporterSynchronousProxy {
121 type Protocol = ReporterMarker;
122
123 fn from_client(value: fidl::endpoints::ClientEnd<ReporterMarker>) -> Self {
124 Self::new(value.into_channel())
125 }
126}
127
128#[derive(Debug, Clone)]
129pub struct ReporterProxy {
130 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
131}
132
133impl fidl::endpoints::Proxy for ReporterProxy {
134 type Protocol = ReporterMarker;
135
136 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
137 Self::new(inner)
138 }
139
140 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
141 self.client.into_channel().map_err(|client| Self { client })
142 }
143
144 fn as_channel(&self) -> &::fidl::AsyncChannel {
145 self.client.as_channel()
146 }
147}
148
149impl ReporterProxy {
150 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
152 let protocol_name = <ReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
153 Self { client: fidl::client::Client::new(channel, protocol_name) }
154 }
155
156 pub fn take_event_stream(&self) -> ReporterEventStream {
162 ReporterEventStream { event_receiver: self.client.take_event_receiver() }
163 }
164
165 pub fn r#report(&self, mut payload: Crash) -> Result<(), fidl::Error> {
167 ReporterProxyInterface::r#report(self, payload)
168 }
169}
170
171impl ReporterProxyInterface for ReporterProxy {
172 fn r#report(&self, mut payload: Crash) -> Result<(), fidl::Error> {
173 self.client.send::<Crash>(
174 &mut payload,
175 0x6283d741761d9fe5,
176 fidl::encoding::DynamicFlags::FLEXIBLE,
177 )
178 }
179}
180
181pub struct ReporterEventStream {
182 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
183}
184
185impl std::marker::Unpin for ReporterEventStream {}
186
187impl futures::stream::FusedStream for ReporterEventStream {
188 fn is_terminated(&self) -> bool {
189 self.event_receiver.is_terminated()
190 }
191}
192
193impl futures::Stream for ReporterEventStream {
194 type Item = Result<ReporterEvent, fidl::Error>;
195
196 fn poll_next(
197 mut self: std::pin::Pin<&mut Self>,
198 cx: &mut std::task::Context<'_>,
199 ) -> std::task::Poll<Option<Self::Item>> {
200 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
201 &mut self.event_receiver,
202 cx
203 )?) {
204 Some(buf) => std::task::Poll::Ready(Some(ReporterEvent::decode(buf))),
205 None => std::task::Poll::Ready(None),
206 }
207 }
208}
209
210#[derive(Debug)]
211pub enum ReporterEvent {
212 #[non_exhaustive]
213 _UnknownEvent {
214 ordinal: u64,
216 },
217}
218
219impl ReporterEvent {
220 fn decode(
222 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
223 ) -> Result<ReporterEvent, fidl::Error> {
224 let (bytes, _handles) = buf.split_mut();
225 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
226 debug_assert_eq!(tx_header.tx_id, 0);
227 match tx_header.ordinal {
228 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
229 Ok(ReporterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
230 }
231 _ => Err(fidl::Error::UnknownOrdinal {
232 ordinal: tx_header.ordinal,
233 protocol_name: <ReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
234 }),
235 }
236 }
237}
238
239pub struct ReporterRequestStream {
241 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
242 is_terminated: bool,
243}
244
245impl std::marker::Unpin for ReporterRequestStream {}
246
247impl futures::stream::FusedStream for ReporterRequestStream {
248 fn is_terminated(&self) -> bool {
249 self.is_terminated
250 }
251}
252
253impl fidl::endpoints::RequestStream for ReporterRequestStream {
254 type Protocol = ReporterMarker;
255 type ControlHandle = ReporterControlHandle;
256
257 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
258 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
259 }
260
261 fn control_handle(&self) -> Self::ControlHandle {
262 ReporterControlHandle { inner: self.inner.clone() }
263 }
264
265 fn into_inner(
266 self,
267 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
268 {
269 (self.inner, self.is_terminated)
270 }
271
272 fn from_inner(
273 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
274 is_terminated: bool,
275 ) -> Self {
276 Self { inner, is_terminated }
277 }
278}
279
280impl futures::Stream for ReporterRequestStream {
281 type Item = Result<ReporterRequest, fidl::Error>;
282
283 fn poll_next(
284 mut self: std::pin::Pin<&mut Self>,
285 cx: &mut std::task::Context<'_>,
286 ) -> std::task::Poll<Option<Self::Item>> {
287 let this = &mut *self;
288 if this.inner.check_shutdown(cx) {
289 this.is_terminated = true;
290 return std::task::Poll::Ready(None);
291 }
292 if this.is_terminated {
293 panic!("polled ReporterRequestStream after completion");
294 }
295 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
296 |bytes, handles| {
297 match this.inner.channel().read_etc(cx, bytes, handles) {
298 std::task::Poll::Ready(Ok(())) => {}
299 std::task::Poll::Pending => return std::task::Poll::Pending,
300 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
301 this.is_terminated = true;
302 return std::task::Poll::Ready(None);
303 }
304 std::task::Poll::Ready(Err(e)) => {
305 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
306 e.into(),
307 ))));
308 }
309 }
310
311 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
313
314 std::task::Poll::Ready(Some(match header.ordinal {
315 0x6283d741761d9fe5 => {
316 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
317 let mut req =
318 fidl::new_empty!(Crash, fidl::encoding::DefaultFuchsiaResourceDialect);
319 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Crash>(&header, _body_bytes, handles, &mut req)?;
320 let control_handle = ReporterControlHandle { inner: this.inner.clone() };
321 Ok(ReporterRequest::Report { payload: req, control_handle })
322 }
323 _ if header.tx_id == 0
324 && header
325 .dynamic_flags()
326 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
327 {
328 Ok(ReporterRequest::_UnknownMethod {
329 ordinal: header.ordinal,
330 control_handle: ReporterControlHandle { inner: this.inner.clone() },
331 method_type: fidl::MethodType::OneWay,
332 })
333 }
334 _ if header
335 .dynamic_flags()
336 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
337 {
338 this.inner.send_framework_err(
339 fidl::encoding::FrameworkErr::UnknownMethod,
340 header.tx_id,
341 header.ordinal,
342 header.dynamic_flags(),
343 (bytes, handles),
344 )?;
345 Ok(ReporterRequest::_UnknownMethod {
346 ordinal: header.ordinal,
347 control_handle: ReporterControlHandle { inner: this.inner.clone() },
348 method_type: fidl::MethodType::TwoWay,
349 })
350 }
351 _ => Err(fidl::Error::UnknownOrdinal {
352 ordinal: header.ordinal,
353 protocol_name:
354 <ReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
355 }),
356 }))
357 },
358 )
359 }
360}
361
362#[derive(Debug)]
363pub enum ReporterRequest {
364 Report { payload: Crash, control_handle: ReporterControlHandle },
366 #[non_exhaustive]
368 _UnknownMethod {
369 ordinal: u64,
371 control_handle: ReporterControlHandle,
372 method_type: fidl::MethodType,
373 },
374}
375
376impl ReporterRequest {
377 #[allow(irrefutable_let_patterns)]
378 pub fn into_report(self) -> Option<(Crash, ReporterControlHandle)> {
379 if let ReporterRequest::Report { payload, control_handle } = self {
380 Some((payload, control_handle))
381 } else {
382 None
383 }
384 }
385
386 pub fn method_name(&self) -> &'static str {
388 match *self {
389 ReporterRequest::Report { .. } => "report",
390 ReporterRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
391 "unknown one-way method"
392 }
393 ReporterRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
394 "unknown two-way method"
395 }
396 }
397 }
398}
399
400#[derive(Debug, Clone)]
401pub struct ReporterControlHandle {
402 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
403}
404
405impl ReporterControlHandle {
406 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
407 self.inner.shutdown_with_epitaph(status.into())
408 }
409}
410
411impl fidl::endpoints::ControlHandle for ReporterControlHandle {
412 fn shutdown(&self) {
413 self.inner.shutdown()
414 }
415
416 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
417 self.inner.shutdown_with_epitaph(status)
418 }
419
420 fn is_closed(&self) -> bool {
421 self.inner.channel().is_closed()
422 }
423 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
424 self.inner.channel().on_closed()
425 }
426
427 #[cfg(target_os = "fuchsia")]
428 fn signal_peer(
429 &self,
430 clear_mask: zx::Signals,
431 set_mask: zx::Signals,
432 ) -> Result<(), zx_status::Status> {
433 use fidl::Peered;
434 self.inner.channel().signal_peer(clear_mask, set_mask)
435 }
436}
437
438impl ReporterControlHandle {}
439
440#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
441pub struct WatcherMarker;
442
443impl fidl::endpoints::ProtocolMarker for WatcherMarker {
444 type Proxy = WatcherProxy;
445 type RequestStream = WatcherRequestStream;
446 #[cfg(target_os = "fuchsia")]
447 type SynchronousProxy = WatcherSynchronousProxy;
448
449 const DEBUG_NAME: &'static str = "fuchsia.firmware.crash.Watcher";
450}
451impl fidl::endpoints::DiscoverableProtocolMarker for WatcherMarker {}
452pub type WatcherGetCrashResult = Result<Crash, Error>;
453
454pub trait WatcherProxyInterface: Send + Sync {
455 type GetCrashResponseFut: std::future::Future<Output = Result<WatcherGetCrashResult, fidl::Error>>
456 + Send;
457 fn r#get_crash(&self) -> Self::GetCrashResponseFut;
458}
459#[derive(Debug)]
460#[cfg(target_os = "fuchsia")]
461pub struct WatcherSynchronousProxy {
462 client: fidl::client::sync::Client,
463}
464
465#[cfg(target_os = "fuchsia")]
466impl fidl::endpoints::SynchronousProxy for WatcherSynchronousProxy {
467 type Proxy = WatcherProxy;
468 type Protocol = WatcherMarker;
469
470 fn from_channel(inner: fidl::Channel) -> Self {
471 Self::new(inner)
472 }
473
474 fn into_channel(self) -> fidl::Channel {
475 self.client.into_channel()
476 }
477
478 fn as_channel(&self) -> &fidl::Channel {
479 self.client.as_channel()
480 }
481}
482
483#[cfg(target_os = "fuchsia")]
484impl WatcherSynchronousProxy {
485 pub fn new(channel: fidl::Channel) -> Self {
486 Self { client: fidl::client::sync::Client::new(channel) }
487 }
488
489 pub fn into_channel(self) -> fidl::Channel {
490 self.client.into_channel()
491 }
492
493 pub fn wait_for_event(
496 &self,
497 deadline: zx::MonotonicInstant,
498 ) -> Result<WatcherEvent, fidl::Error> {
499 WatcherEvent::decode(self.client.wait_for_event::<WatcherMarker>(deadline)?)
500 }
501
502 pub fn r#get_crash(
504 &self,
505 ___deadline: zx::MonotonicInstant,
506 ) -> Result<WatcherGetCrashResult, fidl::Error> {
507 let _response = self.client.send_query::<
508 fidl::encoding::EmptyPayload,
509 fidl::encoding::FlexibleResultType<Crash, Error>,
510 WatcherMarker,
511 >(
512 (),
513 0x3958bce1352d0890,
514 fidl::encoding::DynamicFlags::FLEXIBLE,
515 ___deadline,
516 )?
517 .into_result::<WatcherMarker>("get_crash")?;
518 Ok(_response.map(|x| x))
519 }
520}
521
522#[cfg(target_os = "fuchsia")]
523impl From<WatcherSynchronousProxy> for zx::NullableHandle {
524 fn from(value: WatcherSynchronousProxy) -> Self {
525 value.into_channel().into()
526 }
527}
528
529#[cfg(target_os = "fuchsia")]
530impl From<fidl::Channel> for WatcherSynchronousProxy {
531 fn from(value: fidl::Channel) -> Self {
532 Self::new(value)
533 }
534}
535
536#[cfg(target_os = "fuchsia")]
537impl fidl::endpoints::FromClient for WatcherSynchronousProxy {
538 type Protocol = WatcherMarker;
539
540 fn from_client(value: fidl::endpoints::ClientEnd<WatcherMarker>) -> Self {
541 Self::new(value.into_channel())
542 }
543}
544
545#[derive(Debug, Clone)]
546pub struct WatcherProxy {
547 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
548}
549
550impl fidl::endpoints::Proxy for WatcherProxy {
551 type Protocol = WatcherMarker;
552
553 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
554 Self::new(inner)
555 }
556
557 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
558 self.client.into_channel().map_err(|client| Self { client })
559 }
560
561 fn as_channel(&self) -> &::fidl::AsyncChannel {
562 self.client.as_channel()
563 }
564}
565
566impl WatcherProxy {
567 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
569 let protocol_name = <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
570 Self { client: fidl::client::Client::new(channel, protocol_name) }
571 }
572
573 pub fn take_event_stream(&self) -> WatcherEventStream {
579 WatcherEventStream { event_receiver: self.client.take_event_receiver() }
580 }
581
582 pub fn r#get_crash(
584 &self,
585 ) -> fidl::client::QueryResponseFut<
586 WatcherGetCrashResult,
587 fidl::encoding::DefaultFuchsiaResourceDialect,
588 > {
589 WatcherProxyInterface::r#get_crash(self)
590 }
591}
592
593impl WatcherProxyInterface for WatcherProxy {
594 type GetCrashResponseFut = fidl::client::QueryResponseFut<
595 WatcherGetCrashResult,
596 fidl::encoding::DefaultFuchsiaResourceDialect,
597 >;
598 fn r#get_crash(&self) -> Self::GetCrashResponseFut {
599 fn _decode(
600 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
601 ) -> Result<WatcherGetCrashResult, fidl::Error> {
602 let _response = fidl::client::decode_transaction_body::<
603 fidl::encoding::FlexibleResultType<Crash, Error>,
604 fidl::encoding::DefaultFuchsiaResourceDialect,
605 0x3958bce1352d0890,
606 >(_buf?)?
607 .into_result::<WatcherMarker>("get_crash")?;
608 Ok(_response.map(|x| x))
609 }
610 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WatcherGetCrashResult>(
611 (),
612 0x3958bce1352d0890,
613 fidl::encoding::DynamicFlags::FLEXIBLE,
614 _decode,
615 )
616 }
617}
618
619pub struct WatcherEventStream {
620 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
621}
622
623impl std::marker::Unpin for WatcherEventStream {}
624
625impl futures::stream::FusedStream for WatcherEventStream {
626 fn is_terminated(&self) -> bool {
627 self.event_receiver.is_terminated()
628 }
629}
630
631impl futures::Stream for WatcherEventStream {
632 type Item = Result<WatcherEvent, fidl::Error>;
633
634 fn poll_next(
635 mut self: std::pin::Pin<&mut Self>,
636 cx: &mut std::task::Context<'_>,
637 ) -> std::task::Poll<Option<Self::Item>> {
638 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
639 &mut self.event_receiver,
640 cx
641 )?) {
642 Some(buf) => std::task::Poll::Ready(Some(WatcherEvent::decode(buf))),
643 None => std::task::Poll::Ready(None),
644 }
645 }
646}
647
648#[derive(Debug)]
649pub enum WatcherEvent {
650 #[non_exhaustive]
651 _UnknownEvent {
652 ordinal: u64,
654 },
655}
656
657impl WatcherEvent {
658 fn decode(
660 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
661 ) -> Result<WatcherEvent, fidl::Error> {
662 let (bytes, _handles) = buf.split_mut();
663 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
664 debug_assert_eq!(tx_header.tx_id, 0);
665 match tx_header.ordinal {
666 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
667 Ok(WatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
668 }
669 _ => Err(fidl::Error::UnknownOrdinal {
670 ordinal: tx_header.ordinal,
671 protocol_name: <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
672 }),
673 }
674 }
675}
676
677pub struct WatcherRequestStream {
679 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
680 is_terminated: bool,
681}
682
683impl std::marker::Unpin for WatcherRequestStream {}
684
685impl futures::stream::FusedStream for WatcherRequestStream {
686 fn is_terminated(&self) -> bool {
687 self.is_terminated
688 }
689}
690
691impl fidl::endpoints::RequestStream for WatcherRequestStream {
692 type Protocol = WatcherMarker;
693 type ControlHandle = WatcherControlHandle;
694
695 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
696 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
697 }
698
699 fn control_handle(&self) -> Self::ControlHandle {
700 WatcherControlHandle { inner: self.inner.clone() }
701 }
702
703 fn into_inner(
704 self,
705 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
706 {
707 (self.inner, self.is_terminated)
708 }
709
710 fn from_inner(
711 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
712 is_terminated: bool,
713 ) -> Self {
714 Self { inner, is_terminated }
715 }
716}
717
718impl futures::Stream for WatcherRequestStream {
719 type Item = Result<WatcherRequest, fidl::Error>;
720
721 fn poll_next(
722 mut self: std::pin::Pin<&mut Self>,
723 cx: &mut std::task::Context<'_>,
724 ) -> std::task::Poll<Option<Self::Item>> {
725 let this = &mut *self;
726 if this.inner.check_shutdown(cx) {
727 this.is_terminated = true;
728 return std::task::Poll::Ready(None);
729 }
730 if this.is_terminated {
731 panic!("polled WatcherRequestStream after completion");
732 }
733 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
734 |bytes, handles| {
735 match this.inner.channel().read_etc(cx, bytes, handles) {
736 std::task::Poll::Ready(Ok(())) => {}
737 std::task::Poll::Pending => return std::task::Poll::Pending,
738 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
739 this.is_terminated = true;
740 return std::task::Poll::Ready(None);
741 }
742 std::task::Poll::Ready(Err(e)) => {
743 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
744 e.into(),
745 ))));
746 }
747 }
748
749 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
751
752 std::task::Poll::Ready(Some(match header.ordinal {
753 0x3958bce1352d0890 => {
754 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
755 let mut req = fidl::new_empty!(
756 fidl::encoding::EmptyPayload,
757 fidl::encoding::DefaultFuchsiaResourceDialect
758 );
759 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
760 let control_handle = WatcherControlHandle { inner: this.inner.clone() };
761 Ok(WatcherRequest::GetCrash {
762 responder: WatcherGetCrashResponder {
763 control_handle: std::mem::ManuallyDrop::new(control_handle),
764 tx_id: header.tx_id,
765 },
766 })
767 }
768 _ if header.tx_id == 0
769 && header
770 .dynamic_flags()
771 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
772 {
773 Ok(WatcherRequest::_UnknownMethod {
774 ordinal: header.ordinal,
775 control_handle: WatcherControlHandle { inner: this.inner.clone() },
776 method_type: fidl::MethodType::OneWay,
777 })
778 }
779 _ if header
780 .dynamic_flags()
781 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
782 {
783 this.inner.send_framework_err(
784 fidl::encoding::FrameworkErr::UnknownMethod,
785 header.tx_id,
786 header.ordinal,
787 header.dynamic_flags(),
788 (bytes, handles),
789 )?;
790 Ok(WatcherRequest::_UnknownMethod {
791 ordinal: header.ordinal,
792 control_handle: WatcherControlHandle { inner: this.inner.clone() },
793 method_type: fidl::MethodType::TwoWay,
794 })
795 }
796 _ => Err(fidl::Error::UnknownOrdinal {
797 ordinal: header.ordinal,
798 protocol_name:
799 <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
800 }),
801 }))
802 },
803 )
804 }
805}
806
807#[derive(Debug)]
808pub enum WatcherRequest {
809 GetCrash { responder: WatcherGetCrashResponder },
811 #[non_exhaustive]
813 _UnknownMethod {
814 ordinal: u64,
816 control_handle: WatcherControlHandle,
817 method_type: fidl::MethodType,
818 },
819}
820
821impl WatcherRequest {
822 #[allow(irrefutable_let_patterns)]
823 pub fn into_get_crash(self) -> Option<(WatcherGetCrashResponder)> {
824 if let WatcherRequest::GetCrash { responder } = self { Some((responder)) } else { None }
825 }
826
827 pub fn method_name(&self) -> &'static str {
829 match *self {
830 WatcherRequest::GetCrash { .. } => "get_crash",
831 WatcherRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
832 "unknown one-way method"
833 }
834 WatcherRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
835 "unknown two-way method"
836 }
837 }
838 }
839}
840
841#[derive(Debug, Clone)]
842pub struct WatcherControlHandle {
843 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
844}
845
846impl WatcherControlHandle {
847 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
848 self.inner.shutdown_with_epitaph(status.into())
849 }
850}
851
852impl fidl::endpoints::ControlHandle for WatcherControlHandle {
853 fn shutdown(&self) {
854 self.inner.shutdown()
855 }
856
857 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
858 self.inner.shutdown_with_epitaph(status)
859 }
860
861 fn is_closed(&self) -> bool {
862 self.inner.channel().is_closed()
863 }
864 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
865 self.inner.channel().on_closed()
866 }
867
868 #[cfg(target_os = "fuchsia")]
869 fn signal_peer(
870 &self,
871 clear_mask: zx::Signals,
872 set_mask: zx::Signals,
873 ) -> Result<(), zx_status::Status> {
874 use fidl::Peered;
875 self.inner.channel().signal_peer(clear_mask, set_mask)
876 }
877}
878
879impl WatcherControlHandle {}
880
881#[must_use = "FIDL methods require a response to be sent"]
882#[derive(Debug)]
883pub struct WatcherGetCrashResponder {
884 control_handle: std::mem::ManuallyDrop<WatcherControlHandle>,
885 tx_id: u32,
886}
887
888impl std::ops::Drop for WatcherGetCrashResponder {
892 fn drop(&mut self) {
893 self.control_handle.shutdown();
894 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
896 }
897}
898
899impl fidl::endpoints::Responder for WatcherGetCrashResponder {
900 type ControlHandle = WatcherControlHandle;
901
902 fn control_handle(&self) -> &WatcherControlHandle {
903 &self.control_handle
904 }
905
906 fn drop_without_shutdown(mut self) {
907 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
909 std::mem::forget(self);
911 }
912}
913
914impl WatcherGetCrashResponder {
915 pub fn send(self, mut result: Result<Crash, Error>) -> Result<(), fidl::Error> {
919 let _result = self.send_raw(result);
920 if _result.is_err() {
921 self.control_handle.shutdown();
922 }
923 self.drop_without_shutdown();
924 _result
925 }
926
927 pub fn send_no_shutdown_on_err(
929 self,
930 mut result: Result<Crash, Error>,
931 ) -> Result<(), fidl::Error> {
932 let _result = self.send_raw(result);
933 self.drop_without_shutdown();
934 _result
935 }
936
937 fn send_raw(&self, mut result: Result<Crash, Error>) -> Result<(), fidl::Error> {
938 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<Crash, Error>>(
939 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
940 self.tx_id,
941 0x3958bce1352d0890,
942 fidl::encoding::DynamicFlags::FLEXIBLE,
943 )
944 }
945}
946
947mod internal {
948 use super::*;
949
950 impl Crash {
951 #[inline(always)]
952 fn max_ordinal_present(&self) -> u64 {
953 if let Some(_) = self.crash_dump {
954 return 6;
955 }
956 if let Some(_) = self.firmware_version {
957 return 5;
958 }
959 if let Some(_) = self.count {
960 return 4;
961 }
962 if let Some(_) = self.reason {
963 return 3;
964 }
965 if let Some(_) = self.timestamp {
966 return 2;
967 }
968 if let Some(_) = self.subsystem_name {
969 return 1;
970 }
971 0
972 }
973 }
974
975 impl fidl::encoding::ResourceTypeMarker for Crash {
976 type Borrowed<'a> = &'a mut Self;
977 fn take_or_borrow<'a>(
978 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
979 ) -> Self::Borrowed<'a> {
980 value
981 }
982 }
983
984 unsafe impl fidl::encoding::TypeMarker for Crash {
985 type Owned = Self;
986
987 #[inline(always)]
988 fn inline_align(_context: fidl::encoding::Context) -> usize {
989 8
990 }
991
992 #[inline(always)]
993 fn inline_size(_context: fidl::encoding::Context) -> usize {
994 16
995 }
996 }
997
998 unsafe impl fidl::encoding::Encode<Crash, fidl::encoding::DefaultFuchsiaResourceDialect>
999 for &mut Crash
1000 {
1001 unsafe fn encode(
1002 self,
1003 encoder: &mut fidl::encoding::Encoder<
1004 '_,
1005 fidl::encoding::DefaultFuchsiaResourceDialect,
1006 >,
1007 offset: usize,
1008 mut depth: fidl::encoding::Depth,
1009 ) -> fidl::Result<()> {
1010 encoder.debug_check_bounds::<Crash>(offset);
1011 let max_ordinal: u64 = self.max_ordinal_present();
1013 encoder.write_num(max_ordinal, offset);
1014 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1015 if max_ordinal == 0 {
1017 return Ok(());
1018 }
1019 depth.increment()?;
1020 let envelope_size = 8;
1021 let bytes_len = max_ordinal as usize * envelope_size;
1022 #[allow(unused_variables)]
1023 let offset = encoder.out_of_line_offset(bytes_len);
1024 let mut _prev_end_offset: usize = 0;
1025 if 1 > max_ordinal {
1026 return Ok(());
1027 }
1028
1029 let cur_offset: usize = (1 - 1) * envelope_size;
1032
1033 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1035
1036 fidl::encoding::encode_in_envelope_optional::<
1041 fidl::encoding::BoundedString<64>,
1042 fidl::encoding::DefaultFuchsiaResourceDialect,
1043 >(
1044 self.subsystem_name.as_ref().map(
1045 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
1046 ),
1047 encoder,
1048 offset + cur_offset,
1049 depth,
1050 )?;
1051
1052 _prev_end_offset = cur_offset + envelope_size;
1053 if 2 > max_ordinal {
1054 return Ok(());
1055 }
1056
1057 let cur_offset: usize = (2 - 1) * envelope_size;
1060
1061 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1063
1064 fidl::encoding::encode_in_envelope_optional::<
1069 fidl::BootInstant,
1070 fidl::encoding::DefaultFuchsiaResourceDialect,
1071 >(
1072 self.timestamp
1073 .as_ref()
1074 .map(<fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow),
1075 encoder,
1076 offset + cur_offset,
1077 depth,
1078 )?;
1079
1080 _prev_end_offset = cur_offset + envelope_size;
1081 if 3 > max_ordinal {
1082 return Ok(());
1083 }
1084
1085 let cur_offset: usize = (3 - 1) * envelope_size;
1088
1089 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1091
1092 fidl::encoding::encode_in_envelope_optional::<
1097 fidl::encoding::BoundedString<128>,
1098 fidl::encoding::DefaultFuchsiaResourceDialect,
1099 >(
1100 self.reason.as_ref().map(
1101 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
1102 ),
1103 encoder,
1104 offset + cur_offset,
1105 depth,
1106 )?;
1107
1108 _prev_end_offset = cur_offset + envelope_size;
1109 if 4 > max_ordinal {
1110 return Ok(());
1111 }
1112
1113 let cur_offset: usize = (4 - 1) * envelope_size;
1116
1117 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1119
1120 fidl::encoding::encode_in_envelope_optional::<
1125 u32,
1126 fidl::encoding::DefaultFuchsiaResourceDialect,
1127 >(
1128 self.count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1129 encoder,
1130 offset + cur_offset,
1131 depth,
1132 )?;
1133
1134 _prev_end_offset = cur_offset + envelope_size;
1135 if 5 > max_ordinal {
1136 return Ok(());
1137 }
1138
1139 let cur_offset: usize = (5 - 1) * envelope_size;
1142
1143 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1145
1146 fidl::encoding::encode_in_envelope_optional::<
1151 fidl::encoding::BoundedString<32>,
1152 fidl::encoding::DefaultFuchsiaResourceDialect,
1153 >(
1154 self.firmware_version.as_ref().map(
1155 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
1156 ),
1157 encoder,
1158 offset + cur_offset,
1159 depth,
1160 )?;
1161
1162 _prev_end_offset = cur_offset + envelope_size;
1163 if 6 > max_ordinal {
1164 return Ok(());
1165 }
1166
1167 let cur_offset: usize = (6 - 1) * envelope_size;
1170
1171 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1173
1174 fidl::encoding::encode_in_envelope_optional::<
1179 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
1180 fidl::encoding::DefaultFuchsiaResourceDialect,
1181 >(
1182 self.crash_dump.as_mut().map(
1183 <fidl::encoding::HandleType<
1184 fidl::Vmo,
1185 { fidl::ObjectType::VMO.into_raw() },
1186 49255,
1187 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1188 ),
1189 encoder,
1190 offset + cur_offset,
1191 depth,
1192 )?;
1193
1194 _prev_end_offset = cur_offset + envelope_size;
1195
1196 Ok(())
1197 }
1198 }
1199
1200 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Crash {
1201 #[inline(always)]
1202 fn new_empty() -> Self {
1203 Self::default()
1204 }
1205
1206 unsafe fn decode(
1207 &mut self,
1208 decoder: &mut fidl::encoding::Decoder<
1209 '_,
1210 fidl::encoding::DefaultFuchsiaResourceDialect,
1211 >,
1212 offset: usize,
1213 mut depth: fidl::encoding::Depth,
1214 ) -> fidl::Result<()> {
1215 decoder.debug_check_bounds::<Self>(offset);
1216 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1217 None => return Err(fidl::Error::NotNullable),
1218 Some(len) => len,
1219 };
1220 if len == 0 {
1222 return Ok(());
1223 };
1224 depth.increment()?;
1225 let envelope_size = 8;
1226 let bytes_len = len * envelope_size;
1227 let offset = decoder.out_of_line_offset(bytes_len)?;
1228 let mut _next_ordinal_to_read = 0;
1230 let mut next_offset = offset;
1231 let end_offset = offset + bytes_len;
1232 _next_ordinal_to_read += 1;
1233 if next_offset >= end_offset {
1234 return Ok(());
1235 }
1236
1237 while _next_ordinal_to_read < 1 {
1239 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1240 _next_ordinal_to_read += 1;
1241 next_offset += envelope_size;
1242 }
1243
1244 let next_out_of_line = decoder.next_out_of_line();
1245 let handles_before = decoder.remaining_handles();
1246 if let Some((inlined, num_bytes, num_handles)) =
1247 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1248 {
1249 let member_inline_size =
1250 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
1251 decoder.context,
1252 );
1253 if inlined != (member_inline_size <= 4) {
1254 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1255 }
1256 let inner_offset;
1257 let mut inner_depth = depth.clone();
1258 if inlined {
1259 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1260 inner_offset = next_offset;
1261 } else {
1262 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1263 inner_depth.increment()?;
1264 }
1265 let val_ref = self.subsystem_name.get_or_insert_with(|| {
1266 fidl::new_empty!(
1267 fidl::encoding::BoundedString<64>,
1268 fidl::encoding::DefaultFuchsiaResourceDialect
1269 )
1270 });
1271 fidl::decode!(
1272 fidl::encoding::BoundedString<64>,
1273 fidl::encoding::DefaultFuchsiaResourceDialect,
1274 val_ref,
1275 decoder,
1276 inner_offset,
1277 inner_depth
1278 )?;
1279 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1280 {
1281 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1282 }
1283 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1284 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1285 }
1286 }
1287
1288 next_offset += envelope_size;
1289 _next_ordinal_to_read += 1;
1290 if next_offset >= end_offset {
1291 return Ok(());
1292 }
1293
1294 while _next_ordinal_to_read < 2 {
1296 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1297 _next_ordinal_to_read += 1;
1298 next_offset += envelope_size;
1299 }
1300
1301 let next_out_of_line = decoder.next_out_of_line();
1302 let handles_before = decoder.remaining_handles();
1303 if let Some((inlined, num_bytes, num_handles)) =
1304 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1305 {
1306 let member_inline_size =
1307 <fidl::BootInstant as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1308 if inlined != (member_inline_size <= 4) {
1309 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1310 }
1311 let inner_offset;
1312 let mut inner_depth = depth.clone();
1313 if inlined {
1314 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1315 inner_offset = next_offset;
1316 } else {
1317 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1318 inner_depth.increment()?;
1319 }
1320 let val_ref = self.timestamp.get_or_insert_with(|| {
1321 fidl::new_empty!(
1322 fidl::BootInstant,
1323 fidl::encoding::DefaultFuchsiaResourceDialect
1324 )
1325 });
1326 fidl::decode!(
1327 fidl::BootInstant,
1328 fidl::encoding::DefaultFuchsiaResourceDialect,
1329 val_ref,
1330 decoder,
1331 inner_offset,
1332 inner_depth
1333 )?;
1334 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1335 {
1336 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1337 }
1338 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1339 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1340 }
1341 }
1342
1343 next_offset += envelope_size;
1344 _next_ordinal_to_read += 1;
1345 if next_offset >= end_offset {
1346 return Ok(());
1347 }
1348
1349 while _next_ordinal_to_read < 3 {
1351 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1352 _next_ordinal_to_read += 1;
1353 next_offset += envelope_size;
1354 }
1355
1356 let next_out_of_line = decoder.next_out_of_line();
1357 let handles_before = decoder.remaining_handles();
1358 if let Some((inlined, num_bytes, num_handles)) =
1359 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1360 {
1361 let member_inline_size =
1362 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
1363 decoder.context,
1364 );
1365 if inlined != (member_inline_size <= 4) {
1366 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1367 }
1368 let inner_offset;
1369 let mut inner_depth = depth.clone();
1370 if inlined {
1371 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1372 inner_offset = next_offset;
1373 } else {
1374 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1375 inner_depth.increment()?;
1376 }
1377 let val_ref = self.reason.get_or_insert_with(|| {
1378 fidl::new_empty!(
1379 fidl::encoding::BoundedString<128>,
1380 fidl::encoding::DefaultFuchsiaResourceDialect
1381 )
1382 });
1383 fidl::decode!(
1384 fidl::encoding::BoundedString<128>,
1385 fidl::encoding::DefaultFuchsiaResourceDialect,
1386 val_ref,
1387 decoder,
1388 inner_offset,
1389 inner_depth
1390 )?;
1391 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1392 {
1393 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1394 }
1395 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1396 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1397 }
1398 }
1399
1400 next_offset += envelope_size;
1401 _next_ordinal_to_read += 1;
1402 if next_offset >= end_offset {
1403 return Ok(());
1404 }
1405
1406 while _next_ordinal_to_read < 4 {
1408 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1409 _next_ordinal_to_read += 1;
1410 next_offset += envelope_size;
1411 }
1412
1413 let next_out_of_line = decoder.next_out_of_line();
1414 let handles_before = decoder.remaining_handles();
1415 if let Some((inlined, num_bytes, num_handles)) =
1416 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1417 {
1418 let member_inline_size =
1419 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1420 if inlined != (member_inline_size <= 4) {
1421 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1422 }
1423 let inner_offset;
1424 let mut inner_depth = depth.clone();
1425 if inlined {
1426 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1427 inner_offset = next_offset;
1428 } else {
1429 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1430 inner_depth.increment()?;
1431 }
1432 let val_ref = self.count.get_or_insert_with(|| {
1433 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
1434 });
1435 fidl::decode!(
1436 u32,
1437 fidl::encoding::DefaultFuchsiaResourceDialect,
1438 val_ref,
1439 decoder,
1440 inner_offset,
1441 inner_depth
1442 )?;
1443 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1444 {
1445 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1446 }
1447 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1448 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1449 }
1450 }
1451
1452 next_offset += envelope_size;
1453 _next_ordinal_to_read += 1;
1454 if next_offset >= end_offset {
1455 return Ok(());
1456 }
1457
1458 while _next_ordinal_to_read < 5 {
1460 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1461 _next_ordinal_to_read += 1;
1462 next_offset += envelope_size;
1463 }
1464
1465 let next_out_of_line = decoder.next_out_of_line();
1466 let handles_before = decoder.remaining_handles();
1467 if let Some((inlined, num_bytes, num_handles)) =
1468 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1469 {
1470 let member_inline_size =
1471 <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
1472 decoder.context,
1473 );
1474 if inlined != (member_inline_size <= 4) {
1475 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1476 }
1477 let inner_offset;
1478 let mut inner_depth = depth.clone();
1479 if inlined {
1480 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1481 inner_offset = next_offset;
1482 } else {
1483 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1484 inner_depth.increment()?;
1485 }
1486 let val_ref = self.firmware_version.get_or_insert_with(|| {
1487 fidl::new_empty!(
1488 fidl::encoding::BoundedString<32>,
1489 fidl::encoding::DefaultFuchsiaResourceDialect
1490 )
1491 });
1492 fidl::decode!(
1493 fidl::encoding::BoundedString<32>,
1494 fidl::encoding::DefaultFuchsiaResourceDialect,
1495 val_ref,
1496 decoder,
1497 inner_offset,
1498 inner_depth
1499 )?;
1500 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1501 {
1502 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1503 }
1504 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1505 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1506 }
1507 }
1508
1509 next_offset += envelope_size;
1510 _next_ordinal_to_read += 1;
1511 if next_offset >= end_offset {
1512 return Ok(());
1513 }
1514
1515 while _next_ordinal_to_read < 6 {
1517 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1518 _next_ordinal_to_read += 1;
1519 next_offset += envelope_size;
1520 }
1521
1522 let next_out_of_line = decoder.next_out_of_line();
1523 let handles_before = decoder.remaining_handles();
1524 if let Some((inlined, num_bytes, num_handles)) =
1525 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1526 {
1527 let member_inline_size = <fidl::encoding::HandleType<
1528 fidl::Vmo,
1529 { fidl::ObjectType::VMO.into_raw() },
1530 49255,
1531 > as fidl::encoding::TypeMarker>::inline_size(
1532 decoder.context
1533 );
1534 if inlined != (member_inline_size <= 4) {
1535 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1536 }
1537 let inner_offset;
1538 let mut inner_depth = depth.clone();
1539 if inlined {
1540 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1541 inner_offset = next_offset;
1542 } else {
1543 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1544 inner_depth.increment()?;
1545 }
1546 let val_ref =
1547 self.crash_dump.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect));
1548 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1549 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1550 {
1551 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1552 }
1553 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1554 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1555 }
1556 }
1557
1558 next_offset += envelope_size;
1559
1560 while next_offset < end_offset {
1562 _next_ordinal_to_read += 1;
1563 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1564 next_offset += envelope_size;
1565 }
1566
1567 Ok(())
1568 }
1569 }
1570}