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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, Default, PartialEq)]
15pub struct SuspendStats {
16 pub success_count: Option<u64>,
18 pub fail_count: Option<u64>,
20 pub last_failed_error: Option<i32>,
22 pub last_time_in_suspend: Option<i64>,
25 pub last_time_in_suspend_operations: Option<i64>,
30 #[doc(hidden)]
31 pub __source_breaking: fidl::marker::SourceBreaking,
32}
33
34impl fidl::Persistable for SuspendStats {}
35
36#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
37pub struct StatsMarker;
38
39impl fidl::endpoints::ProtocolMarker for StatsMarker {
40 type Proxy = StatsProxy;
41 type RequestStream = StatsRequestStream;
42 #[cfg(target_os = "fuchsia")]
43 type SynchronousProxy = StatsSynchronousProxy;
44
45 const DEBUG_NAME: &'static str = "fuchsia.power.suspend.Stats";
46}
47impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
48
49pub trait StatsProxyInterface: Send + Sync {
50 type WatchResponseFut: std::future::Future<Output = Result<SuspendStats, fidl::Error>> + Send;
51 fn r#watch(&self) -> Self::WatchResponseFut;
52}
53#[derive(Debug)]
54#[cfg(target_os = "fuchsia")]
55pub struct StatsSynchronousProxy {
56 client: fidl::client::sync::Client,
57}
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
61 type Proxy = StatsProxy;
62 type Protocol = StatsMarker;
63
64 fn from_channel(inner: fidl::Channel) -> Self {
65 Self::new(inner)
66 }
67
68 fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 fn as_channel(&self) -> &fidl::Channel {
73 self.client.as_channel()
74 }
75}
76
77#[cfg(target_os = "fuchsia")]
78impl StatsSynchronousProxy {
79 pub fn new(channel: fidl::Channel) -> Self {
80 let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
81 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
82 }
83
84 pub fn into_channel(self) -> fidl::Channel {
85 self.client.into_channel()
86 }
87
88 pub fn wait_for_event(
91 &self,
92 deadline: zx::MonotonicInstant,
93 ) -> Result<StatsEvent, fidl::Error> {
94 StatsEvent::decode(self.client.wait_for_event(deadline)?)
95 }
96
97 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<SuspendStats, fidl::Error> {
103 let _response = self.client.send_query::<fidl::encoding::EmptyPayload, SuspendStats>(
104 (),
105 0x1c90507c87636a84,
106 fidl::encoding::DynamicFlags::empty(),
107 ___deadline,
108 )?;
109 Ok(_response)
110 }
111}
112
113#[derive(Debug, Clone)]
114pub struct StatsProxy {
115 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
116}
117
118impl fidl::endpoints::Proxy for StatsProxy {
119 type Protocol = StatsMarker;
120
121 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
122 Self::new(inner)
123 }
124
125 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
126 self.client.into_channel().map_err(|client| Self { client })
127 }
128
129 fn as_channel(&self) -> &::fidl::AsyncChannel {
130 self.client.as_channel()
131 }
132}
133
134impl StatsProxy {
135 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
137 let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
138 Self { client: fidl::client::Client::new(channel, protocol_name) }
139 }
140
141 pub fn take_event_stream(&self) -> StatsEventStream {
147 StatsEventStream { event_receiver: self.client.take_event_receiver() }
148 }
149
150 pub fn r#watch(
156 &self,
157 ) -> fidl::client::QueryResponseFut<SuspendStats, fidl::encoding::DefaultFuchsiaResourceDialect>
158 {
159 StatsProxyInterface::r#watch(self)
160 }
161}
162
163impl StatsProxyInterface for StatsProxy {
164 type WatchResponseFut =
165 fidl::client::QueryResponseFut<SuspendStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
166 fn r#watch(&self) -> Self::WatchResponseFut {
167 fn _decode(
168 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
169 ) -> Result<SuspendStats, fidl::Error> {
170 let _response = fidl::client::decode_transaction_body::<
171 SuspendStats,
172 fidl::encoding::DefaultFuchsiaResourceDialect,
173 0x1c90507c87636a84,
174 >(_buf?)?;
175 Ok(_response)
176 }
177 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SuspendStats>(
178 (),
179 0x1c90507c87636a84,
180 fidl::encoding::DynamicFlags::empty(),
181 _decode,
182 )
183 }
184}
185
186pub struct StatsEventStream {
187 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
188}
189
190impl std::marker::Unpin for StatsEventStream {}
191
192impl futures::stream::FusedStream for StatsEventStream {
193 fn is_terminated(&self) -> bool {
194 self.event_receiver.is_terminated()
195 }
196}
197
198impl futures::Stream for StatsEventStream {
199 type Item = Result<StatsEvent, fidl::Error>;
200
201 fn poll_next(
202 mut self: std::pin::Pin<&mut Self>,
203 cx: &mut std::task::Context<'_>,
204 ) -> std::task::Poll<Option<Self::Item>> {
205 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
206 &mut self.event_receiver,
207 cx
208 )?) {
209 Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
210 None => std::task::Poll::Ready(None),
211 }
212 }
213}
214
215#[derive(Debug)]
216pub enum StatsEvent {
217 #[non_exhaustive]
218 _UnknownEvent {
219 ordinal: u64,
221 },
222}
223
224impl StatsEvent {
225 fn decode(
227 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
228 ) -> Result<StatsEvent, fidl::Error> {
229 let (bytes, _handles) = buf.split_mut();
230 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
231 debug_assert_eq!(tx_header.tx_id, 0);
232 match tx_header.ordinal {
233 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
234 Ok(StatsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
235 }
236 _ => Err(fidl::Error::UnknownOrdinal {
237 ordinal: tx_header.ordinal,
238 protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
239 }),
240 }
241 }
242}
243
244pub struct StatsRequestStream {
246 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
247 is_terminated: bool,
248}
249
250impl std::marker::Unpin for StatsRequestStream {}
251
252impl futures::stream::FusedStream for StatsRequestStream {
253 fn is_terminated(&self) -> bool {
254 self.is_terminated
255 }
256}
257
258impl fidl::endpoints::RequestStream for StatsRequestStream {
259 type Protocol = StatsMarker;
260 type ControlHandle = StatsControlHandle;
261
262 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
263 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
264 }
265
266 fn control_handle(&self) -> Self::ControlHandle {
267 StatsControlHandle { inner: self.inner.clone() }
268 }
269
270 fn into_inner(
271 self,
272 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
273 {
274 (self.inner, self.is_terminated)
275 }
276
277 fn from_inner(
278 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
279 is_terminated: bool,
280 ) -> Self {
281 Self { inner, is_terminated }
282 }
283}
284
285impl futures::Stream for StatsRequestStream {
286 type Item = Result<StatsRequest, fidl::Error>;
287
288 fn poll_next(
289 mut self: std::pin::Pin<&mut Self>,
290 cx: &mut std::task::Context<'_>,
291 ) -> std::task::Poll<Option<Self::Item>> {
292 let this = &mut *self;
293 if this.inner.check_shutdown(cx) {
294 this.is_terminated = true;
295 return std::task::Poll::Ready(None);
296 }
297 if this.is_terminated {
298 panic!("polled StatsRequestStream after completion");
299 }
300 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
301 |bytes, handles| {
302 match this.inner.channel().read_etc(cx, bytes, handles) {
303 std::task::Poll::Ready(Ok(())) => {}
304 std::task::Poll::Pending => return std::task::Poll::Pending,
305 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
306 this.is_terminated = true;
307 return std::task::Poll::Ready(None);
308 }
309 std::task::Poll::Ready(Err(e)) => {
310 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
311 e.into(),
312 ))))
313 }
314 }
315
316 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
318
319 std::task::Poll::Ready(Some(match header.ordinal {
320 0x1c90507c87636a84 => {
321 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
322 let mut req = fidl::new_empty!(
323 fidl::encoding::EmptyPayload,
324 fidl::encoding::DefaultFuchsiaResourceDialect
325 );
326 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
327 let control_handle = StatsControlHandle { inner: this.inner.clone() };
328 Ok(StatsRequest::Watch {
329 responder: StatsWatchResponder {
330 control_handle: std::mem::ManuallyDrop::new(control_handle),
331 tx_id: header.tx_id,
332 },
333 })
334 }
335 _ if header.tx_id == 0
336 && header
337 .dynamic_flags()
338 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
339 {
340 Ok(StatsRequest::_UnknownMethod {
341 ordinal: header.ordinal,
342 control_handle: StatsControlHandle { inner: this.inner.clone() },
343 method_type: fidl::MethodType::OneWay,
344 })
345 }
346 _ if header
347 .dynamic_flags()
348 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
349 {
350 this.inner.send_framework_err(
351 fidl::encoding::FrameworkErr::UnknownMethod,
352 header.tx_id,
353 header.ordinal,
354 header.dynamic_flags(),
355 (bytes, handles),
356 )?;
357 Ok(StatsRequest::_UnknownMethod {
358 ordinal: header.ordinal,
359 control_handle: StatsControlHandle { inner: this.inner.clone() },
360 method_type: fidl::MethodType::TwoWay,
361 })
362 }
363 _ => Err(fidl::Error::UnknownOrdinal {
364 ordinal: header.ordinal,
365 protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
366 }),
367 }))
368 },
369 )
370 }
371}
372
373#[derive(Debug)]
375pub enum StatsRequest {
376 Watch { responder: StatsWatchResponder },
382 #[non_exhaustive]
384 _UnknownMethod {
385 ordinal: u64,
387 control_handle: StatsControlHandle,
388 method_type: fidl::MethodType,
389 },
390}
391
392impl StatsRequest {
393 #[allow(irrefutable_let_patterns)]
394 pub fn into_watch(self) -> Option<(StatsWatchResponder)> {
395 if let StatsRequest::Watch { responder } = self {
396 Some((responder))
397 } else {
398 None
399 }
400 }
401
402 pub fn method_name(&self) -> &'static str {
404 match *self {
405 StatsRequest::Watch { .. } => "watch",
406 StatsRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
407 "unknown one-way method"
408 }
409 StatsRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
410 "unknown two-way method"
411 }
412 }
413 }
414}
415
416#[derive(Debug, Clone)]
417pub struct StatsControlHandle {
418 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
419}
420
421impl fidl::endpoints::ControlHandle for StatsControlHandle {
422 fn shutdown(&self) {
423 self.inner.shutdown()
424 }
425 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
426 self.inner.shutdown_with_epitaph(status)
427 }
428
429 fn is_closed(&self) -> bool {
430 self.inner.channel().is_closed()
431 }
432 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
433 self.inner.channel().on_closed()
434 }
435
436 #[cfg(target_os = "fuchsia")]
437 fn signal_peer(
438 &self,
439 clear_mask: zx::Signals,
440 set_mask: zx::Signals,
441 ) -> Result<(), zx_status::Status> {
442 use fidl::Peered;
443 self.inner.channel().signal_peer(clear_mask, set_mask)
444 }
445}
446
447impl StatsControlHandle {}
448
449#[must_use = "FIDL methods require a response to be sent"]
450#[derive(Debug)]
451pub struct StatsWatchResponder {
452 control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
453 tx_id: u32,
454}
455
456impl std::ops::Drop for StatsWatchResponder {
460 fn drop(&mut self) {
461 self.control_handle.shutdown();
462 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
464 }
465}
466
467impl fidl::endpoints::Responder for StatsWatchResponder {
468 type ControlHandle = StatsControlHandle;
469
470 fn control_handle(&self) -> &StatsControlHandle {
471 &self.control_handle
472 }
473
474 fn drop_without_shutdown(mut self) {
475 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
477 std::mem::forget(self);
479 }
480}
481
482impl StatsWatchResponder {
483 pub fn send(self, mut payload: &SuspendStats) -> Result<(), fidl::Error> {
487 let _result = self.send_raw(payload);
488 if _result.is_err() {
489 self.control_handle.shutdown();
490 }
491 self.drop_without_shutdown();
492 _result
493 }
494
495 pub fn send_no_shutdown_on_err(self, mut payload: &SuspendStats) -> Result<(), fidl::Error> {
497 let _result = self.send_raw(payload);
498 self.drop_without_shutdown();
499 _result
500 }
501
502 fn send_raw(&self, mut payload: &SuspendStats) -> Result<(), fidl::Error> {
503 self.control_handle.inner.send::<SuspendStats>(
504 payload,
505 self.tx_id,
506 0x1c90507c87636a84,
507 fidl::encoding::DynamicFlags::empty(),
508 )
509 }
510}
511
512mod internal {
513 use super::*;
514
515 impl SuspendStats {
516 #[inline(always)]
517 fn max_ordinal_present(&self) -> u64 {
518 if let Some(_) = self.last_time_in_suspend_operations {
519 return 5;
520 }
521 if let Some(_) = self.last_time_in_suspend {
522 return 4;
523 }
524 if let Some(_) = self.last_failed_error {
525 return 3;
526 }
527 if let Some(_) = self.fail_count {
528 return 2;
529 }
530 if let Some(_) = self.success_count {
531 return 1;
532 }
533 0
534 }
535 }
536
537 impl fidl::encoding::ValueTypeMarker for SuspendStats {
538 type Borrowed<'a> = &'a Self;
539 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
540 value
541 }
542 }
543
544 unsafe impl fidl::encoding::TypeMarker for SuspendStats {
545 type Owned = Self;
546
547 #[inline(always)]
548 fn inline_align(_context: fidl::encoding::Context) -> usize {
549 8
550 }
551
552 #[inline(always)]
553 fn inline_size(_context: fidl::encoding::Context) -> usize {
554 16
555 }
556 }
557
558 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SuspendStats, D>
559 for &SuspendStats
560 {
561 unsafe fn encode(
562 self,
563 encoder: &mut fidl::encoding::Encoder<'_, D>,
564 offset: usize,
565 mut depth: fidl::encoding::Depth,
566 ) -> fidl::Result<()> {
567 encoder.debug_check_bounds::<SuspendStats>(offset);
568 let max_ordinal: u64 = self.max_ordinal_present();
570 encoder.write_num(max_ordinal, offset);
571 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
572 if max_ordinal == 0 {
574 return Ok(());
575 }
576 depth.increment()?;
577 let envelope_size = 8;
578 let bytes_len = max_ordinal as usize * envelope_size;
579 #[allow(unused_variables)]
580 let offset = encoder.out_of_line_offset(bytes_len);
581 let mut _prev_end_offset: usize = 0;
582 if 1 > max_ordinal {
583 return Ok(());
584 }
585
586 let cur_offset: usize = (1 - 1) * envelope_size;
589
590 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
592
593 fidl::encoding::encode_in_envelope_optional::<u64, D>(
598 self.success_count.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
599 encoder,
600 offset + cur_offset,
601 depth,
602 )?;
603
604 _prev_end_offset = cur_offset + envelope_size;
605 if 2 > max_ordinal {
606 return Ok(());
607 }
608
609 let cur_offset: usize = (2 - 1) * envelope_size;
612
613 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
615
616 fidl::encoding::encode_in_envelope_optional::<u64, D>(
621 self.fail_count.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
622 encoder,
623 offset + cur_offset,
624 depth,
625 )?;
626
627 _prev_end_offset = cur_offset + envelope_size;
628 if 3 > max_ordinal {
629 return Ok(());
630 }
631
632 let cur_offset: usize = (3 - 1) * envelope_size;
635
636 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
638
639 fidl::encoding::encode_in_envelope_optional::<i32, D>(
644 self.last_failed_error
645 .as_ref()
646 .map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
647 encoder,
648 offset + cur_offset,
649 depth,
650 )?;
651
652 _prev_end_offset = cur_offset + envelope_size;
653 if 4 > max_ordinal {
654 return Ok(());
655 }
656
657 let cur_offset: usize = (4 - 1) * envelope_size;
660
661 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
663
664 fidl::encoding::encode_in_envelope_optional::<i64, D>(
669 self.last_time_in_suspend
670 .as_ref()
671 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
672 encoder,
673 offset + cur_offset,
674 depth,
675 )?;
676
677 _prev_end_offset = cur_offset + envelope_size;
678 if 5 > max_ordinal {
679 return Ok(());
680 }
681
682 let cur_offset: usize = (5 - 1) * envelope_size;
685
686 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
688
689 fidl::encoding::encode_in_envelope_optional::<i64, D>(
694 self.last_time_in_suspend_operations
695 .as_ref()
696 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
697 encoder,
698 offset + cur_offset,
699 depth,
700 )?;
701
702 _prev_end_offset = cur_offset + envelope_size;
703
704 Ok(())
705 }
706 }
707
708 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SuspendStats {
709 #[inline(always)]
710 fn new_empty() -> Self {
711 Self::default()
712 }
713
714 unsafe fn decode(
715 &mut self,
716 decoder: &mut fidl::encoding::Decoder<'_, D>,
717 offset: usize,
718 mut depth: fidl::encoding::Depth,
719 ) -> fidl::Result<()> {
720 decoder.debug_check_bounds::<Self>(offset);
721 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
722 None => return Err(fidl::Error::NotNullable),
723 Some(len) => len,
724 };
725 if len == 0 {
727 return Ok(());
728 };
729 depth.increment()?;
730 let envelope_size = 8;
731 let bytes_len = len * envelope_size;
732 let offset = decoder.out_of_line_offset(bytes_len)?;
733 let mut _next_ordinal_to_read = 0;
735 let mut next_offset = offset;
736 let end_offset = offset + bytes_len;
737 _next_ordinal_to_read += 1;
738 if next_offset >= end_offset {
739 return Ok(());
740 }
741
742 while _next_ordinal_to_read < 1 {
744 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
745 _next_ordinal_to_read += 1;
746 next_offset += envelope_size;
747 }
748
749 let next_out_of_line = decoder.next_out_of_line();
750 let handles_before = decoder.remaining_handles();
751 if let Some((inlined, num_bytes, num_handles)) =
752 fidl::encoding::decode_envelope_header(decoder, next_offset)?
753 {
754 let member_inline_size =
755 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
756 if inlined != (member_inline_size <= 4) {
757 return Err(fidl::Error::InvalidInlineBitInEnvelope);
758 }
759 let inner_offset;
760 let mut inner_depth = depth.clone();
761 if inlined {
762 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
763 inner_offset = next_offset;
764 } else {
765 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
766 inner_depth.increment()?;
767 }
768 let val_ref = self.success_count.get_or_insert_with(|| fidl::new_empty!(u64, D));
769 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
770 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
771 {
772 return Err(fidl::Error::InvalidNumBytesInEnvelope);
773 }
774 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
775 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
776 }
777 }
778
779 next_offset += envelope_size;
780 _next_ordinal_to_read += 1;
781 if next_offset >= end_offset {
782 return Ok(());
783 }
784
785 while _next_ordinal_to_read < 2 {
787 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
788 _next_ordinal_to_read += 1;
789 next_offset += envelope_size;
790 }
791
792 let next_out_of_line = decoder.next_out_of_line();
793 let handles_before = decoder.remaining_handles();
794 if let Some((inlined, num_bytes, num_handles)) =
795 fidl::encoding::decode_envelope_header(decoder, next_offset)?
796 {
797 let member_inline_size =
798 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
799 if inlined != (member_inline_size <= 4) {
800 return Err(fidl::Error::InvalidInlineBitInEnvelope);
801 }
802 let inner_offset;
803 let mut inner_depth = depth.clone();
804 if inlined {
805 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
806 inner_offset = next_offset;
807 } else {
808 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
809 inner_depth.increment()?;
810 }
811 let val_ref = self.fail_count.get_or_insert_with(|| fidl::new_empty!(u64, D));
812 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
813 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
814 {
815 return Err(fidl::Error::InvalidNumBytesInEnvelope);
816 }
817 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
818 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
819 }
820 }
821
822 next_offset += envelope_size;
823 _next_ordinal_to_read += 1;
824 if next_offset >= end_offset {
825 return Ok(());
826 }
827
828 while _next_ordinal_to_read < 3 {
830 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
831 _next_ordinal_to_read += 1;
832 next_offset += envelope_size;
833 }
834
835 let next_out_of_line = decoder.next_out_of_line();
836 let handles_before = decoder.remaining_handles();
837 if let Some((inlined, num_bytes, num_handles)) =
838 fidl::encoding::decode_envelope_header(decoder, next_offset)?
839 {
840 let member_inline_size =
841 <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
842 if inlined != (member_inline_size <= 4) {
843 return Err(fidl::Error::InvalidInlineBitInEnvelope);
844 }
845 let inner_offset;
846 let mut inner_depth = depth.clone();
847 if inlined {
848 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
849 inner_offset = next_offset;
850 } else {
851 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
852 inner_depth.increment()?;
853 }
854 let val_ref =
855 self.last_failed_error.get_or_insert_with(|| fidl::new_empty!(i32, D));
856 fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
857 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
858 {
859 return Err(fidl::Error::InvalidNumBytesInEnvelope);
860 }
861 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
862 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
863 }
864 }
865
866 next_offset += envelope_size;
867 _next_ordinal_to_read += 1;
868 if next_offset >= end_offset {
869 return Ok(());
870 }
871
872 while _next_ordinal_to_read < 4 {
874 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
875 _next_ordinal_to_read += 1;
876 next_offset += envelope_size;
877 }
878
879 let next_out_of_line = decoder.next_out_of_line();
880 let handles_before = decoder.remaining_handles();
881 if let Some((inlined, num_bytes, num_handles)) =
882 fidl::encoding::decode_envelope_header(decoder, next_offset)?
883 {
884 let member_inline_size =
885 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
886 if inlined != (member_inline_size <= 4) {
887 return Err(fidl::Error::InvalidInlineBitInEnvelope);
888 }
889 let inner_offset;
890 let mut inner_depth = depth.clone();
891 if inlined {
892 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
893 inner_offset = next_offset;
894 } else {
895 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
896 inner_depth.increment()?;
897 }
898 let val_ref =
899 self.last_time_in_suspend.get_or_insert_with(|| fidl::new_empty!(i64, D));
900 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
901 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
902 {
903 return Err(fidl::Error::InvalidNumBytesInEnvelope);
904 }
905 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
906 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
907 }
908 }
909
910 next_offset += envelope_size;
911 _next_ordinal_to_read += 1;
912 if next_offset >= end_offset {
913 return Ok(());
914 }
915
916 while _next_ordinal_to_read < 5 {
918 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
919 _next_ordinal_to_read += 1;
920 next_offset += envelope_size;
921 }
922
923 let next_out_of_line = decoder.next_out_of_line();
924 let handles_before = decoder.remaining_handles();
925 if let Some((inlined, num_bytes, num_handles)) =
926 fidl::encoding::decode_envelope_header(decoder, next_offset)?
927 {
928 let member_inline_size =
929 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
930 if inlined != (member_inline_size <= 4) {
931 return Err(fidl::Error::InvalidInlineBitInEnvelope);
932 }
933 let inner_offset;
934 let mut inner_depth = depth.clone();
935 if inlined {
936 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
937 inner_offset = next_offset;
938 } else {
939 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
940 inner_depth.increment()?;
941 }
942 let val_ref = self
943 .last_time_in_suspend_operations
944 .get_or_insert_with(|| fidl::new_empty!(i64, D));
945 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
946 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
947 {
948 return Err(fidl::Error::InvalidNumBytesInEnvelope);
949 }
950 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
951 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
952 }
953 }
954
955 next_offset += envelope_size;
956
957 while next_offset < end_offset {
959 _next_ordinal_to_read += 1;
960 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
961 next_offset += envelope_size;
962 }
963
964 Ok(())
965 }
966 }
967}