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_memory_heapdump_client__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct CollectorDownloadStoredSnapshotRequest {
16 pub snapshot_id: Option<u32>,
22 pub receiver: Option<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>,
26 #[doc(hidden)]
27 pub __source_breaking: fidl::marker::SourceBreaking,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for CollectorDownloadStoredSnapshotRequest
32{
33}
34
35#[derive(Debug, Default, PartialEq)]
36pub struct CollectorListStoredSnapshotsRequest {
37 pub iterator: Option<fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>>,
41 pub process_selector: Option<ProcessSelector>,
43 #[doc(hidden)]
44 pub __source_breaking: fidl::marker::SourceBreaking,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
48 for CollectorListStoredSnapshotsRequest
49{
50}
51
52#[derive(Debug, Default, PartialEq)]
53pub struct CollectorTakeLiveSnapshotRequest {
54 pub process_selector: Option<ProcessSelector>,
58 pub receiver: Option<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>,
62 pub with_contents: Option<bool>,
66 pub multi_process: Option<bool>,
73 #[doc(hidden)]
74 pub __source_breaking: fidl::marker::SourceBreaking,
75}
76
77impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
78 for CollectorTakeLiveSnapshotRequest
79{
80}
81
82#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
83pub struct CollectorMarker;
84
85impl fidl::endpoints::ProtocolMarker for CollectorMarker {
86 type Proxy = CollectorProxy;
87 type RequestStream = CollectorRequestStream;
88 #[cfg(target_os = "fuchsia")]
89 type SynchronousProxy = CollectorSynchronousProxy;
90
91 const DEBUG_NAME: &'static str = "fuchsia.memory.heapdump.client.Collector";
92}
93impl fidl::endpoints::DiscoverableProtocolMarker for CollectorMarker {}
94
95pub trait CollectorProxyInterface: Send + Sync {
96 fn r#take_live_snapshot(
97 &self,
98 payload: CollectorTakeLiveSnapshotRequest,
99 ) -> Result<(), fidl::Error>;
100 fn r#list_stored_snapshots(
101 &self,
102 payload: CollectorListStoredSnapshotsRequest,
103 ) -> Result<(), fidl::Error>;
104 fn r#download_stored_snapshot(
105 &self,
106 payload: CollectorDownloadStoredSnapshotRequest,
107 ) -> Result<(), fidl::Error>;
108}
109#[derive(Debug)]
110#[cfg(target_os = "fuchsia")]
111pub struct CollectorSynchronousProxy {
112 client: fidl::client::sync::Client,
113}
114
115#[cfg(target_os = "fuchsia")]
116impl fidl::endpoints::SynchronousProxy for CollectorSynchronousProxy {
117 type Proxy = CollectorProxy;
118 type Protocol = CollectorMarker;
119
120 fn from_channel(inner: fidl::Channel) -> Self {
121 Self::new(inner)
122 }
123
124 fn into_channel(self) -> fidl::Channel {
125 self.client.into_channel()
126 }
127
128 fn as_channel(&self) -> &fidl::Channel {
129 self.client.as_channel()
130 }
131}
132
133#[cfg(target_os = "fuchsia")]
134impl CollectorSynchronousProxy {
135 pub fn new(channel: fidl::Channel) -> Self {
136 let protocol_name = <CollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
137 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
138 }
139
140 pub fn into_channel(self) -> fidl::Channel {
141 self.client.into_channel()
142 }
143
144 pub fn wait_for_event(
147 &self,
148 deadline: zx::MonotonicInstant,
149 ) -> Result<CollectorEvent, fidl::Error> {
150 CollectorEvent::decode(self.client.wait_for_event(deadline)?)
151 }
152
153 pub fn r#take_live_snapshot(
155 &self,
156 mut payload: CollectorTakeLiveSnapshotRequest,
157 ) -> Result<(), fidl::Error> {
158 self.client.send::<CollectorTakeLiveSnapshotRequest>(
159 &mut payload,
160 0xa581ff8b75eaea3,
161 fidl::encoding::DynamicFlags::FLEXIBLE,
162 )
163 }
164
165 pub fn r#list_stored_snapshots(
167 &self,
168 mut payload: CollectorListStoredSnapshotsRequest,
169 ) -> Result<(), fidl::Error> {
170 self.client.send::<CollectorListStoredSnapshotsRequest>(
171 &mut payload,
172 0x13fd9211708b42e6,
173 fidl::encoding::DynamicFlags::FLEXIBLE,
174 )
175 }
176
177 pub fn r#download_stored_snapshot(
179 &self,
180 mut payload: CollectorDownloadStoredSnapshotRequest,
181 ) -> Result<(), fidl::Error> {
182 self.client.send::<CollectorDownloadStoredSnapshotRequest>(
183 &mut payload,
184 0x48e9792c6f7f1c2e,
185 fidl::encoding::DynamicFlags::FLEXIBLE,
186 )
187 }
188}
189
190#[cfg(target_os = "fuchsia")]
191impl From<CollectorSynchronousProxy> for zx::NullableHandle {
192 fn from(value: CollectorSynchronousProxy) -> Self {
193 value.into_channel().into()
194 }
195}
196
197#[cfg(target_os = "fuchsia")]
198impl From<fidl::Channel> for CollectorSynchronousProxy {
199 fn from(value: fidl::Channel) -> Self {
200 Self::new(value)
201 }
202}
203
204#[cfg(target_os = "fuchsia")]
205impl fidl::endpoints::FromClient for CollectorSynchronousProxy {
206 type Protocol = CollectorMarker;
207
208 fn from_client(value: fidl::endpoints::ClientEnd<CollectorMarker>) -> Self {
209 Self::new(value.into_channel())
210 }
211}
212
213#[derive(Debug, Clone)]
214pub struct CollectorProxy {
215 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
216}
217
218impl fidl::endpoints::Proxy for CollectorProxy {
219 type Protocol = CollectorMarker;
220
221 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
222 Self::new(inner)
223 }
224
225 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
226 self.client.into_channel().map_err(|client| Self { client })
227 }
228
229 fn as_channel(&self) -> &::fidl::AsyncChannel {
230 self.client.as_channel()
231 }
232}
233
234impl CollectorProxy {
235 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
237 let protocol_name = <CollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
238 Self { client: fidl::client::Client::new(channel, protocol_name) }
239 }
240
241 pub fn take_event_stream(&self) -> CollectorEventStream {
247 CollectorEventStream { event_receiver: self.client.take_event_receiver() }
248 }
249
250 pub fn r#take_live_snapshot(
252 &self,
253 mut payload: CollectorTakeLiveSnapshotRequest,
254 ) -> Result<(), fidl::Error> {
255 CollectorProxyInterface::r#take_live_snapshot(self, payload)
256 }
257
258 pub fn r#list_stored_snapshots(
260 &self,
261 mut payload: CollectorListStoredSnapshotsRequest,
262 ) -> Result<(), fidl::Error> {
263 CollectorProxyInterface::r#list_stored_snapshots(self, payload)
264 }
265
266 pub fn r#download_stored_snapshot(
268 &self,
269 mut payload: CollectorDownloadStoredSnapshotRequest,
270 ) -> Result<(), fidl::Error> {
271 CollectorProxyInterface::r#download_stored_snapshot(self, payload)
272 }
273}
274
275impl CollectorProxyInterface for CollectorProxy {
276 fn r#take_live_snapshot(
277 &self,
278 mut payload: CollectorTakeLiveSnapshotRequest,
279 ) -> Result<(), fidl::Error> {
280 self.client.send::<CollectorTakeLiveSnapshotRequest>(
281 &mut payload,
282 0xa581ff8b75eaea3,
283 fidl::encoding::DynamicFlags::FLEXIBLE,
284 )
285 }
286
287 fn r#list_stored_snapshots(
288 &self,
289 mut payload: CollectorListStoredSnapshotsRequest,
290 ) -> Result<(), fidl::Error> {
291 self.client.send::<CollectorListStoredSnapshotsRequest>(
292 &mut payload,
293 0x13fd9211708b42e6,
294 fidl::encoding::DynamicFlags::FLEXIBLE,
295 )
296 }
297
298 fn r#download_stored_snapshot(
299 &self,
300 mut payload: CollectorDownloadStoredSnapshotRequest,
301 ) -> Result<(), fidl::Error> {
302 self.client.send::<CollectorDownloadStoredSnapshotRequest>(
303 &mut payload,
304 0x48e9792c6f7f1c2e,
305 fidl::encoding::DynamicFlags::FLEXIBLE,
306 )
307 }
308}
309
310pub struct CollectorEventStream {
311 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
312}
313
314impl std::marker::Unpin for CollectorEventStream {}
315
316impl futures::stream::FusedStream for CollectorEventStream {
317 fn is_terminated(&self) -> bool {
318 self.event_receiver.is_terminated()
319 }
320}
321
322impl futures::Stream for CollectorEventStream {
323 type Item = Result<CollectorEvent, fidl::Error>;
324
325 fn poll_next(
326 mut self: std::pin::Pin<&mut Self>,
327 cx: &mut std::task::Context<'_>,
328 ) -> std::task::Poll<Option<Self::Item>> {
329 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
330 &mut self.event_receiver,
331 cx
332 )?) {
333 Some(buf) => std::task::Poll::Ready(Some(CollectorEvent::decode(buf))),
334 None => std::task::Poll::Ready(None),
335 }
336 }
337}
338
339#[derive(Debug)]
340pub enum CollectorEvent {
341 #[non_exhaustive]
342 _UnknownEvent {
343 ordinal: u64,
345 },
346}
347
348impl CollectorEvent {
349 fn decode(
351 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
352 ) -> Result<CollectorEvent, fidl::Error> {
353 let (bytes, _handles) = buf.split_mut();
354 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
355 debug_assert_eq!(tx_header.tx_id, 0);
356 match tx_header.ordinal {
357 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
358 Ok(CollectorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
359 }
360 _ => Err(fidl::Error::UnknownOrdinal {
361 ordinal: tx_header.ordinal,
362 protocol_name: <CollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
363 }),
364 }
365 }
366}
367
368pub struct CollectorRequestStream {
370 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
371 is_terminated: bool,
372}
373
374impl std::marker::Unpin for CollectorRequestStream {}
375
376impl futures::stream::FusedStream for CollectorRequestStream {
377 fn is_terminated(&self) -> bool {
378 self.is_terminated
379 }
380}
381
382impl fidl::endpoints::RequestStream for CollectorRequestStream {
383 type Protocol = CollectorMarker;
384 type ControlHandle = CollectorControlHandle;
385
386 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
387 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
388 }
389
390 fn control_handle(&self) -> Self::ControlHandle {
391 CollectorControlHandle { inner: self.inner.clone() }
392 }
393
394 fn into_inner(
395 self,
396 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
397 {
398 (self.inner, self.is_terminated)
399 }
400
401 fn from_inner(
402 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
403 is_terminated: bool,
404 ) -> Self {
405 Self { inner, is_terminated }
406 }
407}
408
409impl futures::Stream for CollectorRequestStream {
410 type Item = Result<CollectorRequest, fidl::Error>;
411
412 fn poll_next(
413 mut self: std::pin::Pin<&mut Self>,
414 cx: &mut std::task::Context<'_>,
415 ) -> std::task::Poll<Option<Self::Item>> {
416 let this = &mut *self;
417 if this.inner.check_shutdown(cx) {
418 this.is_terminated = true;
419 return std::task::Poll::Ready(None);
420 }
421 if this.is_terminated {
422 panic!("polled CollectorRequestStream after completion");
423 }
424 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
425 |bytes, handles| {
426 match this.inner.channel().read_etc(cx, bytes, handles) {
427 std::task::Poll::Ready(Ok(())) => {}
428 std::task::Poll::Pending => return std::task::Poll::Pending,
429 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
430 this.is_terminated = true;
431 return std::task::Poll::Ready(None);
432 }
433 std::task::Poll::Ready(Err(e)) => {
434 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
435 e.into(),
436 ))));
437 }
438 }
439
440 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
442
443 std::task::Poll::Ready(Some(match header.ordinal {
444 0xa581ff8b75eaea3 => {
445 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
446 let mut req = fidl::new_empty!(
447 CollectorTakeLiveSnapshotRequest,
448 fidl::encoding::DefaultFuchsiaResourceDialect
449 );
450 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CollectorTakeLiveSnapshotRequest>(&header, _body_bytes, handles, &mut req)?;
451 let control_handle = CollectorControlHandle { inner: this.inner.clone() };
452 Ok(CollectorRequest::TakeLiveSnapshot { payload: req, control_handle })
453 }
454 0x13fd9211708b42e6 => {
455 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
456 let mut req = fidl::new_empty!(
457 CollectorListStoredSnapshotsRequest,
458 fidl::encoding::DefaultFuchsiaResourceDialect
459 );
460 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CollectorListStoredSnapshotsRequest>(&header, _body_bytes, handles, &mut req)?;
461 let control_handle = CollectorControlHandle { inner: this.inner.clone() };
462 Ok(CollectorRequest::ListStoredSnapshots { payload: req, control_handle })
463 }
464 0x48e9792c6f7f1c2e => {
465 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
466 let mut req = fidl::new_empty!(
467 CollectorDownloadStoredSnapshotRequest,
468 fidl::encoding::DefaultFuchsiaResourceDialect
469 );
470 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CollectorDownloadStoredSnapshotRequest>(&header, _body_bytes, handles, &mut req)?;
471 let control_handle = CollectorControlHandle { inner: this.inner.clone() };
472 Ok(CollectorRequest::DownloadStoredSnapshot {
473 payload: req,
474 control_handle,
475 })
476 }
477 _ if header.tx_id == 0
478 && header
479 .dynamic_flags()
480 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
481 {
482 Ok(CollectorRequest::_UnknownMethod {
483 ordinal: header.ordinal,
484 control_handle: CollectorControlHandle { inner: this.inner.clone() },
485 method_type: fidl::MethodType::OneWay,
486 })
487 }
488 _ if header
489 .dynamic_flags()
490 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
491 {
492 this.inner.send_framework_err(
493 fidl::encoding::FrameworkErr::UnknownMethod,
494 header.tx_id,
495 header.ordinal,
496 header.dynamic_flags(),
497 (bytes, handles),
498 )?;
499 Ok(CollectorRequest::_UnknownMethod {
500 ordinal: header.ordinal,
501 control_handle: CollectorControlHandle { inner: this.inner.clone() },
502 method_type: fidl::MethodType::TwoWay,
503 })
504 }
505 _ => Err(fidl::Error::UnknownOrdinal {
506 ordinal: header.ordinal,
507 protocol_name:
508 <CollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
509 }),
510 }))
511 },
512 )
513 }
514}
515
516#[derive(Debug)]
518pub enum CollectorRequest {
519 TakeLiveSnapshot {
521 payload: CollectorTakeLiveSnapshotRequest,
522 control_handle: CollectorControlHandle,
523 },
524 ListStoredSnapshots {
526 payload: CollectorListStoredSnapshotsRequest,
527 control_handle: CollectorControlHandle,
528 },
529 DownloadStoredSnapshot {
531 payload: CollectorDownloadStoredSnapshotRequest,
532 control_handle: CollectorControlHandle,
533 },
534 #[non_exhaustive]
536 _UnknownMethod {
537 ordinal: u64,
539 control_handle: CollectorControlHandle,
540 method_type: fidl::MethodType,
541 },
542}
543
544impl CollectorRequest {
545 #[allow(irrefutable_let_patterns)]
546 pub fn into_take_live_snapshot(
547 self,
548 ) -> Option<(CollectorTakeLiveSnapshotRequest, CollectorControlHandle)> {
549 if let CollectorRequest::TakeLiveSnapshot { payload, control_handle } = self {
550 Some((payload, control_handle))
551 } else {
552 None
553 }
554 }
555
556 #[allow(irrefutable_let_patterns)]
557 pub fn into_list_stored_snapshots(
558 self,
559 ) -> Option<(CollectorListStoredSnapshotsRequest, CollectorControlHandle)> {
560 if let CollectorRequest::ListStoredSnapshots { payload, control_handle } = self {
561 Some((payload, control_handle))
562 } else {
563 None
564 }
565 }
566
567 #[allow(irrefutable_let_patterns)]
568 pub fn into_download_stored_snapshot(
569 self,
570 ) -> Option<(CollectorDownloadStoredSnapshotRequest, CollectorControlHandle)> {
571 if let CollectorRequest::DownloadStoredSnapshot { payload, control_handle } = self {
572 Some((payload, control_handle))
573 } else {
574 None
575 }
576 }
577
578 pub fn method_name(&self) -> &'static str {
580 match *self {
581 CollectorRequest::TakeLiveSnapshot { .. } => "take_live_snapshot",
582 CollectorRequest::ListStoredSnapshots { .. } => "list_stored_snapshots",
583 CollectorRequest::DownloadStoredSnapshot { .. } => "download_stored_snapshot",
584 CollectorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
585 "unknown one-way method"
586 }
587 CollectorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
588 "unknown two-way method"
589 }
590 }
591 }
592}
593
594#[derive(Debug, Clone)]
595pub struct CollectorControlHandle {
596 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
597}
598
599impl fidl::endpoints::ControlHandle for CollectorControlHandle {
600 fn shutdown(&self) {
601 self.inner.shutdown()
602 }
603 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
604 self.inner.shutdown_with_epitaph(status)
605 }
606
607 fn is_closed(&self) -> bool {
608 self.inner.channel().is_closed()
609 }
610 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
611 self.inner.channel().on_closed()
612 }
613
614 #[cfg(target_os = "fuchsia")]
615 fn signal_peer(
616 &self,
617 clear_mask: zx::Signals,
618 set_mask: zx::Signals,
619 ) -> Result<(), zx_status::Status> {
620 use fidl::Peered;
621 self.inner.channel().signal_peer(clear_mask, set_mask)
622 }
623}
624
625impl CollectorControlHandle {}
626
627#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
628pub struct SnapshotReceiverMarker;
629
630impl fidl::endpoints::ProtocolMarker for SnapshotReceiverMarker {
631 type Proxy = SnapshotReceiverProxy;
632 type RequestStream = SnapshotReceiverRequestStream;
633 #[cfg(target_os = "fuchsia")]
634 type SynchronousProxy = SnapshotReceiverSynchronousProxy;
635
636 const DEBUG_NAME: &'static str = "(anonymous) SnapshotReceiver";
637}
638
639pub trait SnapshotReceiverProxyInterface: Send + Sync {
640 type BatchResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
641 fn r#batch(&self, batch: &[SnapshotElement]) -> Self::BatchResponseFut;
642 type ReportErrorResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
643 fn r#report_error(&self, error: CollectorError) -> Self::ReportErrorResponseFut;
644}
645#[derive(Debug)]
646#[cfg(target_os = "fuchsia")]
647pub struct SnapshotReceiverSynchronousProxy {
648 client: fidl::client::sync::Client,
649}
650
651#[cfg(target_os = "fuchsia")]
652impl fidl::endpoints::SynchronousProxy for SnapshotReceiverSynchronousProxy {
653 type Proxy = SnapshotReceiverProxy;
654 type Protocol = SnapshotReceiverMarker;
655
656 fn from_channel(inner: fidl::Channel) -> Self {
657 Self::new(inner)
658 }
659
660 fn into_channel(self) -> fidl::Channel {
661 self.client.into_channel()
662 }
663
664 fn as_channel(&self) -> &fidl::Channel {
665 self.client.as_channel()
666 }
667}
668
669#[cfg(target_os = "fuchsia")]
670impl SnapshotReceiverSynchronousProxy {
671 pub fn new(channel: fidl::Channel) -> Self {
672 let protocol_name = <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
673 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
674 }
675
676 pub fn into_channel(self) -> fidl::Channel {
677 self.client.into_channel()
678 }
679
680 pub fn wait_for_event(
683 &self,
684 deadline: zx::MonotonicInstant,
685 ) -> Result<SnapshotReceiverEvent, fidl::Error> {
686 SnapshotReceiverEvent::decode(self.client.wait_for_event(deadline)?)
687 }
688
689 pub fn r#batch(
699 &self,
700 mut batch: &[SnapshotElement],
701 ___deadline: zx::MonotonicInstant,
702 ) -> Result<(), fidl::Error> {
703 let _response =
704 self.client.send_query::<SnapshotReceiverBatchRequest, fidl::encoding::EmptyPayload>(
705 (batch,),
706 0x4e2a7b07ec4bf37e,
707 fidl::encoding::DynamicFlags::empty(),
708 ___deadline,
709 )?;
710 Ok(_response)
711 }
712
713 pub fn r#report_error(
715 &self,
716 mut error: CollectorError,
717 ___deadline: zx::MonotonicInstant,
718 ) -> Result<(), fidl::Error> {
719 let _response = self
720 .client
721 .send_query::<SnapshotReceiverReportErrorRequest, fidl::encoding::EmptyPayload>(
722 (error,),
723 0x7bc3329e0ec250c4,
724 fidl::encoding::DynamicFlags::empty(),
725 ___deadline,
726 )?;
727 Ok(_response)
728 }
729}
730
731#[cfg(target_os = "fuchsia")]
732impl From<SnapshotReceiverSynchronousProxy> for zx::NullableHandle {
733 fn from(value: SnapshotReceiverSynchronousProxy) -> Self {
734 value.into_channel().into()
735 }
736}
737
738#[cfg(target_os = "fuchsia")]
739impl From<fidl::Channel> for SnapshotReceiverSynchronousProxy {
740 fn from(value: fidl::Channel) -> Self {
741 Self::new(value)
742 }
743}
744
745#[cfg(target_os = "fuchsia")]
746impl fidl::endpoints::FromClient for SnapshotReceiverSynchronousProxy {
747 type Protocol = SnapshotReceiverMarker;
748
749 fn from_client(value: fidl::endpoints::ClientEnd<SnapshotReceiverMarker>) -> Self {
750 Self::new(value.into_channel())
751 }
752}
753
754#[derive(Debug, Clone)]
755pub struct SnapshotReceiverProxy {
756 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
757}
758
759impl fidl::endpoints::Proxy for SnapshotReceiverProxy {
760 type Protocol = SnapshotReceiverMarker;
761
762 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
763 Self::new(inner)
764 }
765
766 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
767 self.client.into_channel().map_err(|client| Self { client })
768 }
769
770 fn as_channel(&self) -> &::fidl::AsyncChannel {
771 self.client.as_channel()
772 }
773}
774
775impl SnapshotReceiverProxy {
776 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
778 let protocol_name = <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
779 Self { client: fidl::client::Client::new(channel, protocol_name) }
780 }
781
782 pub fn take_event_stream(&self) -> SnapshotReceiverEventStream {
788 SnapshotReceiverEventStream { event_receiver: self.client.take_event_receiver() }
789 }
790
791 pub fn r#batch(
801 &self,
802 mut batch: &[SnapshotElement],
803 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
804 SnapshotReceiverProxyInterface::r#batch(self, batch)
805 }
806
807 pub fn r#report_error(
809 &self,
810 mut error: CollectorError,
811 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
812 SnapshotReceiverProxyInterface::r#report_error(self, error)
813 }
814}
815
816impl SnapshotReceiverProxyInterface for SnapshotReceiverProxy {
817 type BatchResponseFut =
818 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
819 fn r#batch(&self, mut batch: &[SnapshotElement]) -> Self::BatchResponseFut {
820 fn _decode(
821 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
822 ) -> Result<(), fidl::Error> {
823 let _response = fidl::client::decode_transaction_body::<
824 fidl::encoding::EmptyPayload,
825 fidl::encoding::DefaultFuchsiaResourceDialect,
826 0x4e2a7b07ec4bf37e,
827 >(_buf?)?;
828 Ok(_response)
829 }
830 self.client.send_query_and_decode::<SnapshotReceiverBatchRequest, ()>(
831 (batch,),
832 0x4e2a7b07ec4bf37e,
833 fidl::encoding::DynamicFlags::empty(),
834 _decode,
835 )
836 }
837
838 type ReportErrorResponseFut =
839 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
840 fn r#report_error(&self, mut error: CollectorError) -> Self::ReportErrorResponseFut {
841 fn _decode(
842 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
843 ) -> Result<(), fidl::Error> {
844 let _response = fidl::client::decode_transaction_body::<
845 fidl::encoding::EmptyPayload,
846 fidl::encoding::DefaultFuchsiaResourceDialect,
847 0x7bc3329e0ec250c4,
848 >(_buf?)?;
849 Ok(_response)
850 }
851 self.client.send_query_and_decode::<SnapshotReceiverReportErrorRequest, ()>(
852 (error,),
853 0x7bc3329e0ec250c4,
854 fidl::encoding::DynamicFlags::empty(),
855 _decode,
856 )
857 }
858}
859
860pub struct SnapshotReceiverEventStream {
861 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
862}
863
864impl std::marker::Unpin for SnapshotReceiverEventStream {}
865
866impl futures::stream::FusedStream for SnapshotReceiverEventStream {
867 fn is_terminated(&self) -> bool {
868 self.event_receiver.is_terminated()
869 }
870}
871
872impl futures::Stream for SnapshotReceiverEventStream {
873 type Item = Result<SnapshotReceiverEvent, fidl::Error>;
874
875 fn poll_next(
876 mut self: std::pin::Pin<&mut Self>,
877 cx: &mut std::task::Context<'_>,
878 ) -> std::task::Poll<Option<Self::Item>> {
879 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
880 &mut self.event_receiver,
881 cx
882 )?) {
883 Some(buf) => std::task::Poll::Ready(Some(SnapshotReceiverEvent::decode(buf))),
884 None => std::task::Poll::Ready(None),
885 }
886 }
887}
888
889#[derive(Debug)]
890pub enum SnapshotReceiverEvent {}
891
892impl SnapshotReceiverEvent {
893 fn decode(
895 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
896 ) -> Result<SnapshotReceiverEvent, fidl::Error> {
897 let (bytes, _handles) = buf.split_mut();
898 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
899 debug_assert_eq!(tx_header.tx_id, 0);
900 match tx_header.ordinal {
901 _ => Err(fidl::Error::UnknownOrdinal {
902 ordinal: tx_header.ordinal,
903 protocol_name:
904 <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
905 }),
906 }
907 }
908}
909
910pub struct SnapshotReceiverRequestStream {
912 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
913 is_terminated: bool,
914}
915
916impl std::marker::Unpin for SnapshotReceiverRequestStream {}
917
918impl futures::stream::FusedStream for SnapshotReceiverRequestStream {
919 fn is_terminated(&self) -> bool {
920 self.is_terminated
921 }
922}
923
924impl fidl::endpoints::RequestStream for SnapshotReceiverRequestStream {
925 type Protocol = SnapshotReceiverMarker;
926 type ControlHandle = SnapshotReceiverControlHandle;
927
928 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
929 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
930 }
931
932 fn control_handle(&self) -> Self::ControlHandle {
933 SnapshotReceiverControlHandle { inner: self.inner.clone() }
934 }
935
936 fn into_inner(
937 self,
938 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
939 {
940 (self.inner, self.is_terminated)
941 }
942
943 fn from_inner(
944 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
945 is_terminated: bool,
946 ) -> Self {
947 Self { inner, is_terminated }
948 }
949}
950
951impl futures::Stream for SnapshotReceiverRequestStream {
952 type Item = Result<SnapshotReceiverRequest, fidl::Error>;
953
954 fn poll_next(
955 mut self: std::pin::Pin<&mut Self>,
956 cx: &mut std::task::Context<'_>,
957 ) -> std::task::Poll<Option<Self::Item>> {
958 let this = &mut *self;
959 if this.inner.check_shutdown(cx) {
960 this.is_terminated = true;
961 return std::task::Poll::Ready(None);
962 }
963 if this.is_terminated {
964 panic!("polled SnapshotReceiverRequestStream after completion");
965 }
966 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
967 |bytes, handles| {
968 match this.inner.channel().read_etc(cx, bytes, handles) {
969 std::task::Poll::Ready(Ok(())) => {}
970 std::task::Poll::Pending => return std::task::Poll::Pending,
971 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
972 this.is_terminated = true;
973 return std::task::Poll::Ready(None);
974 }
975 std::task::Poll::Ready(Err(e)) => {
976 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
977 e.into(),
978 ))));
979 }
980 }
981
982 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
984
985 std::task::Poll::Ready(Some(match header.ordinal {
986 0x4e2a7b07ec4bf37e => {
987 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
988 let mut req = fidl::new_empty!(
989 SnapshotReceiverBatchRequest,
990 fidl::encoding::DefaultFuchsiaResourceDialect
991 );
992 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnapshotReceiverBatchRequest>(&header, _body_bytes, handles, &mut req)?;
993 let control_handle =
994 SnapshotReceiverControlHandle { inner: this.inner.clone() };
995 Ok(SnapshotReceiverRequest::Batch {
996 batch: req.batch,
997
998 responder: SnapshotReceiverBatchResponder {
999 control_handle: std::mem::ManuallyDrop::new(control_handle),
1000 tx_id: header.tx_id,
1001 },
1002 })
1003 }
1004 0x7bc3329e0ec250c4 => {
1005 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1006 let mut req = fidl::new_empty!(
1007 SnapshotReceiverReportErrorRequest,
1008 fidl::encoding::DefaultFuchsiaResourceDialect
1009 );
1010 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnapshotReceiverReportErrorRequest>(&header, _body_bytes, handles, &mut req)?;
1011 let control_handle =
1012 SnapshotReceiverControlHandle { inner: this.inner.clone() };
1013 Ok(SnapshotReceiverRequest::ReportError {
1014 error: req.error,
1015
1016 responder: SnapshotReceiverReportErrorResponder {
1017 control_handle: std::mem::ManuallyDrop::new(control_handle),
1018 tx_id: header.tx_id,
1019 },
1020 })
1021 }
1022 _ => Err(fidl::Error::UnknownOrdinal {
1023 ordinal: header.ordinal,
1024 protocol_name:
1025 <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1026 }),
1027 }))
1028 },
1029 )
1030 }
1031}
1032
1033#[derive(Debug)]
1035pub enum SnapshotReceiverRequest {
1036 Batch { batch: Vec<SnapshotElement>, responder: SnapshotReceiverBatchResponder },
1046 ReportError { error: CollectorError, responder: SnapshotReceiverReportErrorResponder },
1048}
1049
1050impl SnapshotReceiverRequest {
1051 #[allow(irrefutable_let_patterns)]
1052 pub fn into_batch(self) -> Option<(Vec<SnapshotElement>, SnapshotReceiverBatchResponder)> {
1053 if let SnapshotReceiverRequest::Batch { batch, responder } = self {
1054 Some((batch, responder))
1055 } else {
1056 None
1057 }
1058 }
1059
1060 #[allow(irrefutable_let_patterns)]
1061 pub fn into_report_error(
1062 self,
1063 ) -> Option<(CollectorError, SnapshotReceiverReportErrorResponder)> {
1064 if let SnapshotReceiverRequest::ReportError { error, responder } = self {
1065 Some((error, responder))
1066 } else {
1067 None
1068 }
1069 }
1070
1071 pub fn method_name(&self) -> &'static str {
1073 match *self {
1074 SnapshotReceiverRequest::Batch { .. } => "batch",
1075 SnapshotReceiverRequest::ReportError { .. } => "report_error",
1076 }
1077 }
1078}
1079
1080#[derive(Debug, Clone)]
1081pub struct SnapshotReceiverControlHandle {
1082 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1083}
1084
1085impl fidl::endpoints::ControlHandle for SnapshotReceiverControlHandle {
1086 fn shutdown(&self) {
1087 self.inner.shutdown()
1088 }
1089 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1090 self.inner.shutdown_with_epitaph(status)
1091 }
1092
1093 fn is_closed(&self) -> bool {
1094 self.inner.channel().is_closed()
1095 }
1096 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1097 self.inner.channel().on_closed()
1098 }
1099
1100 #[cfg(target_os = "fuchsia")]
1101 fn signal_peer(
1102 &self,
1103 clear_mask: zx::Signals,
1104 set_mask: zx::Signals,
1105 ) -> Result<(), zx_status::Status> {
1106 use fidl::Peered;
1107 self.inner.channel().signal_peer(clear_mask, set_mask)
1108 }
1109}
1110
1111impl SnapshotReceiverControlHandle {}
1112
1113#[must_use = "FIDL methods require a response to be sent"]
1114#[derive(Debug)]
1115pub struct SnapshotReceiverBatchResponder {
1116 control_handle: std::mem::ManuallyDrop<SnapshotReceiverControlHandle>,
1117 tx_id: u32,
1118}
1119
1120impl std::ops::Drop for SnapshotReceiverBatchResponder {
1124 fn drop(&mut self) {
1125 self.control_handle.shutdown();
1126 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1128 }
1129}
1130
1131impl fidl::endpoints::Responder for SnapshotReceiverBatchResponder {
1132 type ControlHandle = SnapshotReceiverControlHandle;
1133
1134 fn control_handle(&self) -> &SnapshotReceiverControlHandle {
1135 &self.control_handle
1136 }
1137
1138 fn drop_without_shutdown(mut self) {
1139 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1141 std::mem::forget(self);
1143 }
1144}
1145
1146impl SnapshotReceiverBatchResponder {
1147 pub fn send(self) -> Result<(), fidl::Error> {
1151 let _result = self.send_raw();
1152 if _result.is_err() {
1153 self.control_handle.shutdown();
1154 }
1155 self.drop_without_shutdown();
1156 _result
1157 }
1158
1159 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1161 let _result = self.send_raw();
1162 self.drop_without_shutdown();
1163 _result
1164 }
1165
1166 fn send_raw(&self) -> Result<(), fidl::Error> {
1167 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1168 (),
1169 self.tx_id,
1170 0x4e2a7b07ec4bf37e,
1171 fidl::encoding::DynamicFlags::empty(),
1172 )
1173 }
1174}
1175
1176#[must_use = "FIDL methods require a response to be sent"]
1177#[derive(Debug)]
1178pub struct SnapshotReceiverReportErrorResponder {
1179 control_handle: std::mem::ManuallyDrop<SnapshotReceiverControlHandle>,
1180 tx_id: u32,
1181}
1182
1183impl std::ops::Drop for SnapshotReceiverReportErrorResponder {
1187 fn drop(&mut self) {
1188 self.control_handle.shutdown();
1189 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1191 }
1192}
1193
1194impl fidl::endpoints::Responder for SnapshotReceiverReportErrorResponder {
1195 type ControlHandle = SnapshotReceiverControlHandle;
1196
1197 fn control_handle(&self) -> &SnapshotReceiverControlHandle {
1198 &self.control_handle
1199 }
1200
1201 fn drop_without_shutdown(mut self) {
1202 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1204 std::mem::forget(self);
1206 }
1207}
1208
1209impl SnapshotReceiverReportErrorResponder {
1210 pub fn send(self) -> Result<(), fidl::Error> {
1214 let _result = self.send_raw();
1215 if _result.is_err() {
1216 self.control_handle.shutdown();
1217 }
1218 self.drop_without_shutdown();
1219 _result
1220 }
1221
1222 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1224 let _result = self.send_raw();
1225 self.drop_without_shutdown();
1226 _result
1227 }
1228
1229 fn send_raw(&self) -> Result<(), fidl::Error> {
1230 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1231 (),
1232 self.tx_id,
1233 0x7bc3329e0ec250c4,
1234 fidl::encoding::DynamicFlags::empty(),
1235 )
1236 }
1237}
1238
1239#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1240pub struct StoredSnapshotIteratorMarker;
1241
1242impl fidl::endpoints::ProtocolMarker for StoredSnapshotIteratorMarker {
1243 type Proxy = StoredSnapshotIteratorProxy;
1244 type RequestStream = StoredSnapshotIteratorRequestStream;
1245 #[cfg(target_os = "fuchsia")]
1246 type SynchronousProxy = StoredSnapshotIteratorSynchronousProxy;
1247
1248 const DEBUG_NAME: &'static str = "(anonymous) StoredSnapshotIterator";
1249}
1250pub type StoredSnapshotIteratorGetNextResult = Result<Vec<StoredSnapshot>, CollectorError>;
1251
1252pub trait StoredSnapshotIteratorProxyInterface: Send + Sync {
1253 type GetNextResponseFut: std::future::Future<Output = Result<StoredSnapshotIteratorGetNextResult, fidl::Error>>
1254 + Send;
1255 fn r#get_next(&self) -> Self::GetNextResponseFut;
1256}
1257#[derive(Debug)]
1258#[cfg(target_os = "fuchsia")]
1259pub struct StoredSnapshotIteratorSynchronousProxy {
1260 client: fidl::client::sync::Client,
1261}
1262
1263#[cfg(target_os = "fuchsia")]
1264impl fidl::endpoints::SynchronousProxy for StoredSnapshotIteratorSynchronousProxy {
1265 type Proxy = StoredSnapshotIteratorProxy;
1266 type Protocol = StoredSnapshotIteratorMarker;
1267
1268 fn from_channel(inner: fidl::Channel) -> Self {
1269 Self::new(inner)
1270 }
1271
1272 fn into_channel(self) -> fidl::Channel {
1273 self.client.into_channel()
1274 }
1275
1276 fn as_channel(&self) -> &fidl::Channel {
1277 self.client.as_channel()
1278 }
1279}
1280
1281#[cfg(target_os = "fuchsia")]
1282impl StoredSnapshotIteratorSynchronousProxy {
1283 pub fn new(channel: fidl::Channel) -> Self {
1284 let protocol_name =
1285 <StoredSnapshotIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1286 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1287 }
1288
1289 pub fn into_channel(self) -> fidl::Channel {
1290 self.client.into_channel()
1291 }
1292
1293 pub fn wait_for_event(
1296 &self,
1297 deadline: zx::MonotonicInstant,
1298 ) -> Result<StoredSnapshotIteratorEvent, fidl::Error> {
1299 StoredSnapshotIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1300 }
1301
1302 pub fn r#get_next(
1306 &self,
1307 ___deadline: zx::MonotonicInstant,
1308 ) -> Result<StoredSnapshotIteratorGetNextResult, fidl::Error> {
1309 let _response =
1310 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1311 StoredSnapshotIteratorGetNextResponse,
1312 CollectorError,
1313 >>(
1314 (),
1315 0x486d0c7d309d2474,
1316 fidl::encoding::DynamicFlags::empty(),
1317 ___deadline,
1318 )?;
1319 Ok(_response.map(|x| x.batch))
1320 }
1321}
1322
1323#[cfg(target_os = "fuchsia")]
1324impl From<StoredSnapshotIteratorSynchronousProxy> for zx::NullableHandle {
1325 fn from(value: StoredSnapshotIteratorSynchronousProxy) -> Self {
1326 value.into_channel().into()
1327 }
1328}
1329
1330#[cfg(target_os = "fuchsia")]
1331impl From<fidl::Channel> for StoredSnapshotIteratorSynchronousProxy {
1332 fn from(value: fidl::Channel) -> Self {
1333 Self::new(value)
1334 }
1335}
1336
1337#[cfg(target_os = "fuchsia")]
1338impl fidl::endpoints::FromClient for StoredSnapshotIteratorSynchronousProxy {
1339 type Protocol = StoredSnapshotIteratorMarker;
1340
1341 fn from_client(value: fidl::endpoints::ClientEnd<StoredSnapshotIteratorMarker>) -> Self {
1342 Self::new(value.into_channel())
1343 }
1344}
1345
1346#[derive(Debug, Clone)]
1347pub struct StoredSnapshotIteratorProxy {
1348 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1349}
1350
1351impl fidl::endpoints::Proxy for StoredSnapshotIteratorProxy {
1352 type Protocol = StoredSnapshotIteratorMarker;
1353
1354 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1355 Self::new(inner)
1356 }
1357
1358 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1359 self.client.into_channel().map_err(|client| Self { client })
1360 }
1361
1362 fn as_channel(&self) -> &::fidl::AsyncChannel {
1363 self.client.as_channel()
1364 }
1365}
1366
1367impl StoredSnapshotIteratorProxy {
1368 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1370 let protocol_name =
1371 <StoredSnapshotIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1372 Self { client: fidl::client::Client::new(channel, protocol_name) }
1373 }
1374
1375 pub fn take_event_stream(&self) -> StoredSnapshotIteratorEventStream {
1381 StoredSnapshotIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1382 }
1383
1384 pub fn r#get_next(
1388 &self,
1389 ) -> fidl::client::QueryResponseFut<
1390 StoredSnapshotIteratorGetNextResult,
1391 fidl::encoding::DefaultFuchsiaResourceDialect,
1392 > {
1393 StoredSnapshotIteratorProxyInterface::r#get_next(self)
1394 }
1395}
1396
1397impl StoredSnapshotIteratorProxyInterface for StoredSnapshotIteratorProxy {
1398 type GetNextResponseFut = fidl::client::QueryResponseFut<
1399 StoredSnapshotIteratorGetNextResult,
1400 fidl::encoding::DefaultFuchsiaResourceDialect,
1401 >;
1402 fn r#get_next(&self) -> Self::GetNextResponseFut {
1403 fn _decode(
1404 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1405 ) -> Result<StoredSnapshotIteratorGetNextResult, fidl::Error> {
1406 let _response = fidl::client::decode_transaction_body::<
1407 fidl::encoding::ResultType<StoredSnapshotIteratorGetNextResponse, CollectorError>,
1408 fidl::encoding::DefaultFuchsiaResourceDialect,
1409 0x486d0c7d309d2474,
1410 >(_buf?)?;
1411 Ok(_response.map(|x| x.batch))
1412 }
1413 self.client.send_query_and_decode::<
1414 fidl::encoding::EmptyPayload,
1415 StoredSnapshotIteratorGetNextResult,
1416 >(
1417 (),
1418 0x486d0c7d309d2474,
1419 fidl::encoding::DynamicFlags::empty(),
1420 _decode,
1421 )
1422 }
1423}
1424
1425pub struct StoredSnapshotIteratorEventStream {
1426 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1427}
1428
1429impl std::marker::Unpin for StoredSnapshotIteratorEventStream {}
1430
1431impl futures::stream::FusedStream for StoredSnapshotIteratorEventStream {
1432 fn is_terminated(&self) -> bool {
1433 self.event_receiver.is_terminated()
1434 }
1435}
1436
1437impl futures::Stream for StoredSnapshotIteratorEventStream {
1438 type Item = Result<StoredSnapshotIteratorEvent, fidl::Error>;
1439
1440 fn poll_next(
1441 mut self: std::pin::Pin<&mut Self>,
1442 cx: &mut std::task::Context<'_>,
1443 ) -> std::task::Poll<Option<Self::Item>> {
1444 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1445 &mut self.event_receiver,
1446 cx
1447 )?) {
1448 Some(buf) => std::task::Poll::Ready(Some(StoredSnapshotIteratorEvent::decode(buf))),
1449 None => std::task::Poll::Ready(None),
1450 }
1451 }
1452}
1453
1454#[derive(Debug)]
1455pub enum StoredSnapshotIteratorEvent {}
1456
1457impl StoredSnapshotIteratorEvent {
1458 fn decode(
1460 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1461 ) -> Result<StoredSnapshotIteratorEvent, fidl::Error> {
1462 let (bytes, _handles) = buf.split_mut();
1463 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1464 debug_assert_eq!(tx_header.tx_id, 0);
1465 match tx_header.ordinal {
1466 _ => Err(fidl::Error::UnknownOrdinal {
1467 ordinal: tx_header.ordinal,
1468 protocol_name:
1469 <StoredSnapshotIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1470 }),
1471 }
1472 }
1473}
1474
1475pub struct StoredSnapshotIteratorRequestStream {
1477 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1478 is_terminated: bool,
1479}
1480
1481impl std::marker::Unpin for StoredSnapshotIteratorRequestStream {}
1482
1483impl futures::stream::FusedStream for StoredSnapshotIteratorRequestStream {
1484 fn is_terminated(&self) -> bool {
1485 self.is_terminated
1486 }
1487}
1488
1489impl fidl::endpoints::RequestStream for StoredSnapshotIteratorRequestStream {
1490 type Protocol = StoredSnapshotIteratorMarker;
1491 type ControlHandle = StoredSnapshotIteratorControlHandle;
1492
1493 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1494 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1495 }
1496
1497 fn control_handle(&self) -> Self::ControlHandle {
1498 StoredSnapshotIteratorControlHandle { inner: self.inner.clone() }
1499 }
1500
1501 fn into_inner(
1502 self,
1503 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1504 {
1505 (self.inner, self.is_terminated)
1506 }
1507
1508 fn from_inner(
1509 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1510 is_terminated: bool,
1511 ) -> Self {
1512 Self { inner, is_terminated }
1513 }
1514}
1515
1516impl futures::Stream for StoredSnapshotIteratorRequestStream {
1517 type Item = Result<StoredSnapshotIteratorRequest, fidl::Error>;
1518
1519 fn poll_next(
1520 mut self: std::pin::Pin<&mut Self>,
1521 cx: &mut std::task::Context<'_>,
1522 ) -> std::task::Poll<Option<Self::Item>> {
1523 let this = &mut *self;
1524 if this.inner.check_shutdown(cx) {
1525 this.is_terminated = true;
1526 return std::task::Poll::Ready(None);
1527 }
1528 if this.is_terminated {
1529 panic!("polled StoredSnapshotIteratorRequestStream after completion");
1530 }
1531 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1532 |bytes, handles| {
1533 match this.inner.channel().read_etc(cx, bytes, handles) {
1534 std::task::Poll::Ready(Ok(())) => {}
1535 std::task::Poll::Pending => return std::task::Poll::Pending,
1536 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1537 this.is_terminated = true;
1538 return std::task::Poll::Ready(None);
1539 }
1540 std::task::Poll::Ready(Err(e)) => {
1541 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1542 e.into(),
1543 ))));
1544 }
1545 }
1546
1547 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1549
1550 std::task::Poll::Ready(Some(match header.ordinal {
1551 0x486d0c7d309d2474 => {
1552 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1553 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1554 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1555 let control_handle = StoredSnapshotIteratorControlHandle {
1556 inner: this.inner.clone(),
1557 };
1558 Ok(StoredSnapshotIteratorRequest::GetNext {
1559 responder: StoredSnapshotIteratorGetNextResponder {
1560 control_handle: std::mem::ManuallyDrop::new(control_handle),
1561 tx_id: header.tx_id,
1562 },
1563 })
1564 }
1565 _ => Err(fidl::Error::UnknownOrdinal {
1566 ordinal: header.ordinal,
1567 protocol_name: <StoredSnapshotIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1568 }),
1569 }))
1570 },
1571 )
1572 }
1573}
1574
1575#[derive(Debug)]
1577pub enum StoredSnapshotIteratorRequest {
1578 GetNext { responder: StoredSnapshotIteratorGetNextResponder },
1582}
1583
1584impl StoredSnapshotIteratorRequest {
1585 #[allow(irrefutable_let_patterns)]
1586 pub fn into_get_next(self) -> Option<(StoredSnapshotIteratorGetNextResponder)> {
1587 if let StoredSnapshotIteratorRequest::GetNext { responder } = self {
1588 Some((responder))
1589 } else {
1590 None
1591 }
1592 }
1593
1594 pub fn method_name(&self) -> &'static str {
1596 match *self {
1597 StoredSnapshotIteratorRequest::GetNext { .. } => "get_next",
1598 }
1599 }
1600}
1601
1602#[derive(Debug, Clone)]
1603pub struct StoredSnapshotIteratorControlHandle {
1604 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1605}
1606
1607impl fidl::endpoints::ControlHandle for StoredSnapshotIteratorControlHandle {
1608 fn shutdown(&self) {
1609 self.inner.shutdown()
1610 }
1611 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1612 self.inner.shutdown_with_epitaph(status)
1613 }
1614
1615 fn is_closed(&self) -> bool {
1616 self.inner.channel().is_closed()
1617 }
1618 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1619 self.inner.channel().on_closed()
1620 }
1621
1622 #[cfg(target_os = "fuchsia")]
1623 fn signal_peer(
1624 &self,
1625 clear_mask: zx::Signals,
1626 set_mask: zx::Signals,
1627 ) -> Result<(), zx_status::Status> {
1628 use fidl::Peered;
1629 self.inner.channel().signal_peer(clear_mask, set_mask)
1630 }
1631}
1632
1633impl StoredSnapshotIteratorControlHandle {}
1634
1635#[must_use = "FIDL methods require a response to be sent"]
1636#[derive(Debug)]
1637pub struct StoredSnapshotIteratorGetNextResponder {
1638 control_handle: std::mem::ManuallyDrop<StoredSnapshotIteratorControlHandle>,
1639 tx_id: u32,
1640}
1641
1642impl std::ops::Drop for StoredSnapshotIteratorGetNextResponder {
1646 fn drop(&mut self) {
1647 self.control_handle.shutdown();
1648 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1650 }
1651}
1652
1653impl fidl::endpoints::Responder for StoredSnapshotIteratorGetNextResponder {
1654 type ControlHandle = StoredSnapshotIteratorControlHandle;
1655
1656 fn control_handle(&self) -> &StoredSnapshotIteratorControlHandle {
1657 &self.control_handle
1658 }
1659
1660 fn drop_without_shutdown(mut self) {
1661 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1663 std::mem::forget(self);
1665 }
1666}
1667
1668impl StoredSnapshotIteratorGetNextResponder {
1669 pub fn send(
1673 self,
1674 mut result: Result<&[StoredSnapshot], CollectorError>,
1675 ) -> Result<(), fidl::Error> {
1676 let _result = self.send_raw(result);
1677 if _result.is_err() {
1678 self.control_handle.shutdown();
1679 }
1680 self.drop_without_shutdown();
1681 _result
1682 }
1683
1684 pub fn send_no_shutdown_on_err(
1686 self,
1687 mut result: Result<&[StoredSnapshot], CollectorError>,
1688 ) -> Result<(), fidl::Error> {
1689 let _result = self.send_raw(result);
1690 self.drop_without_shutdown();
1691 _result
1692 }
1693
1694 fn send_raw(
1695 &self,
1696 mut result: Result<&[StoredSnapshot], CollectorError>,
1697 ) -> Result<(), fidl::Error> {
1698 self.control_handle.inner.send::<fidl::encoding::ResultType<
1699 StoredSnapshotIteratorGetNextResponse,
1700 CollectorError,
1701 >>(
1702 result.map(|batch| (batch,)),
1703 self.tx_id,
1704 0x486d0c7d309d2474,
1705 fidl::encoding::DynamicFlags::empty(),
1706 )
1707 }
1708}
1709
1710mod internal {
1711 use super::*;
1712
1713 impl CollectorDownloadStoredSnapshotRequest {
1714 #[inline(always)]
1715 fn max_ordinal_present(&self) -> u64 {
1716 if let Some(_) = self.receiver {
1717 return 2;
1718 }
1719 if let Some(_) = self.snapshot_id {
1720 return 1;
1721 }
1722 0
1723 }
1724 }
1725
1726 impl fidl::encoding::ResourceTypeMarker for CollectorDownloadStoredSnapshotRequest {
1727 type Borrowed<'a> = &'a mut Self;
1728 fn take_or_borrow<'a>(
1729 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1730 ) -> Self::Borrowed<'a> {
1731 value
1732 }
1733 }
1734
1735 unsafe impl fidl::encoding::TypeMarker for CollectorDownloadStoredSnapshotRequest {
1736 type Owned = Self;
1737
1738 #[inline(always)]
1739 fn inline_align(_context: fidl::encoding::Context) -> usize {
1740 8
1741 }
1742
1743 #[inline(always)]
1744 fn inline_size(_context: fidl::encoding::Context) -> usize {
1745 16
1746 }
1747 }
1748
1749 unsafe impl
1750 fidl::encoding::Encode<
1751 CollectorDownloadStoredSnapshotRequest,
1752 fidl::encoding::DefaultFuchsiaResourceDialect,
1753 > for &mut CollectorDownloadStoredSnapshotRequest
1754 {
1755 unsafe fn encode(
1756 self,
1757 encoder: &mut fidl::encoding::Encoder<
1758 '_,
1759 fidl::encoding::DefaultFuchsiaResourceDialect,
1760 >,
1761 offset: usize,
1762 mut depth: fidl::encoding::Depth,
1763 ) -> fidl::Result<()> {
1764 encoder.debug_check_bounds::<CollectorDownloadStoredSnapshotRequest>(offset);
1765 let max_ordinal: u64 = self.max_ordinal_present();
1767 encoder.write_num(max_ordinal, offset);
1768 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1769 if max_ordinal == 0 {
1771 return Ok(());
1772 }
1773 depth.increment()?;
1774 let envelope_size = 8;
1775 let bytes_len = max_ordinal as usize * envelope_size;
1776 #[allow(unused_variables)]
1777 let offset = encoder.out_of_line_offset(bytes_len);
1778 let mut _prev_end_offset: usize = 0;
1779 if 1 > max_ordinal {
1780 return Ok(());
1781 }
1782
1783 let cur_offset: usize = (1 - 1) * envelope_size;
1786
1787 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1789
1790 fidl::encoding::encode_in_envelope_optional::<
1795 u32,
1796 fidl::encoding::DefaultFuchsiaResourceDialect,
1797 >(
1798 self.snapshot_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1799 encoder,
1800 offset + cur_offset,
1801 depth,
1802 )?;
1803
1804 _prev_end_offset = cur_offset + envelope_size;
1805 if 2 > max_ordinal {
1806 return Ok(());
1807 }
1808
1809 let cur_offset: usize = (2 - 1) * envelope_size;
1812
1813 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1815
1816 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1821 self.receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1822 encoder, offset + cur_offset, depth
1823 )?;
1824
1825 _prev_end_offset = cur_offset + envelope_size;
1826
1827 Ok(())
1828 }
1829 }
1830
1831 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1832 for CollectorDownloadStoredSnapshotRequest
1833 {
1834 #[inline(always)]
1835 fn new_empty() -> Self {
1836 Self::default()
1837 }
1838
1839 unsafe fn decode(
1840 &mut self,
1841 decoder: &mut fidl::encoding::Decoder<
1842 '_,
1843 fidl::encoding::DefaultFuchsiaResourceDialect,
1844 >,
1845 offset: usize,
1846 mut depth: fidl::encoding::Depth,
1847 ) -> fidl::Result<()> {
1848 decoder.debug_check_bounds::<Self>(offset);
1849 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1850 None => return Err(fidl::Error::NotNullable),
1851 Some(len) => len,
1852 };
1853 if len == 0 {
1855 return Ok(());
1856 };
1857 depth.increment()?;
1858 let envelope_size = 8;
1859 let bytes_len = len * envelope_size;
1860 let offset = decoder.out_of_line_offset(bytes_len)?;
1861 let mut _next_ordinal_to_read = 0;
1863 let mut next_offset = offset;
1864 let end_offset = offset + bytes_len;
1865 _next_ordinal_to_read += 1;
1866 if next_offset >= end_offset {
1867 return Ok(());
1868 }
1869
1870 while _next_ordinal_to_read < 1 {
1872 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1873 _next_ordinal_to_read += 1;
1874 next_offset += envelope_size;
1875 }
1876
1877 let next_out_of_line = decoder.next_out_of_line();
1878 let handles_before = decoder.remaining_handles();
1879 if let Some((inlined, num_bytes, num_handles)) =
1880 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1881 {
1882 let member_inline_size =
1883 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1884 if inlined != (member_inline_size <= 4) {
1885 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1886 }
1887 let inner_offset;
1888 let mut inner_depth = depth.clone();
1889 if inlined {
1890 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1891 inner_offset = next_offset;
1892 } else {
1893 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1894 inner_depth.increment()?;
1895 }
1896 let val_ref = self.snapshot_id.get_or_insert_with(|| {
1897 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
1898 });
1899 fidl::decode!(
1900 u32,
1901 fidl::encoding::DefaultFuchsiaResourceDialect,
1902 val_ref,
1903 decoder,
1904 inner_offset,
1905 inner_depth
1906 )?;
1907 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1908 {
1909 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1910 }
1911 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1912 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1913 }
1914 }
1915
1916 next_offset += envelope_size;
1917 _next_ordinal_to_read += 1;
1918 if next_offset >= end_offset {
1919 return Ok(());
1920 }
1921
1922 while _next_ordinal_to_read < 2 {
1924 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1925 _next_ordinal_to_read += 1;
1926 next_offset += envelope_size;
1927 }
1928
1929 let next_out_of_line = decoder.next_out_of_line();
1930 let handles_before = decoder.remaining_handles();
1931 if let Some((inlined, num_bytes, num_handles)) =
1932 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1933 {
1934 let member_inline_size = <fidl::encoding::Endpoint<
1935 fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
1936 > as fidl::encoding::TypeMarker>::inline_size(
1937 decoder.context
1938 );
1939 if inlined != (member_inline_size <= 4) {
1940 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1941 }
1942 let inner_offset;
1943 let mut inner_depth = depth.clone();
1944 if inlined {
1945 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1946 inner_offset = next_offset;
1947 } else {
1948 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1949 inner_depth.increment()?;
1950 }
1951 let val_ref = self.receiver.get_or_insert_with(|| {
1952 fidl::new_empty!(
1953 fidl::encoding::Endpoint<
1954 fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
1955 >,
1956 fidl::encoding::DefaultFuchsiaResourceDialect
1957 )
1958 });
1959 fidl::decode!(
1960 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>,
1961 fidl::encoding::DefaultFuchsiaResourceDialect,
1962 val_ref,
1963 decoder,
1964 inner_offset,
1965 inner_depth
1966 )?;
1967 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1968 {
1969 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1970 }
1971 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1972 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1973 }
1974 }
1975
1976 next_offset += envelope_size;
1977
1978 while next_offset < end_offset {
1980 _next_ordinal_to_read += 1;
1981 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1982 next_offset += envelope_size;
1983 }
1984
1985 Ok(())
1986 }
1987 }
1988
1989 impl CollectorListStoredSnapshotsRequest {
1990 #[inline(always)]
1991 fn max_ordinal_present(&self) -> u64 {
1992 if let Some(_) = self.process_selector {
1993 return 2;
1994 }
1995 if let Some(_) = self.iterator {
1996 return 1;
1997 }
1998 0
1999 }
2000 }
2001
2002 impl fidl::encoding::ResourceTypeMarker for CollectorListStoredSnapshotsRequest {
2003 type Borrowed<'a> = &'a mut Self;
2004 fn take_or_borrow<'a>(
2005 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2006 ) -> Self::Borrowed<'a> {
2007 value
2008 }
2009 }
2010
2011 unsafe impl fidl::encoding::TypeMarker for CollectorListStoredSnapshotsRequest {
2012 type Owned = Self;
2013
2014 #[inline(always)]
2015 fn inline_align(_context: fidl::encoding::Context) -> usize {
2016 8
2017 }
2018
2019 #[inline(always)]
2020 fn inline_size(_context: fidl::encoding::Context) -> usize {
2021 16
2022 }
2023 }
2024
2025 unsafe impl
2026 fidl::encoding::Encode<
2027 CollectorListStoredSnapshotsRequest,
2028 fidl::encoding::DefaultFuchsiaResourceDialect,
2029 > for &mut CollectorListStoredSnapshotsRequest
2030 {
2031 unsafe fn encode(
2032 self,
2033 encoder: &mut fidl::encoding::Encoder<
2034 '_,
2035 fidl::encoding::DefaultFuchsiaResourceDialect,
2036 >,
2037 offset: usize,
2038 mut depth: fidl::encoding::Depth,
2039 ) -> fidl::Result<()> {
2040 encoder.debug_check_bounds::<CollectorListStoredSnapshotsRequest>(offset);
2041 let max_ordinal: u64 = self.max_ordinal_present();
2043 encoder.write_num(max_ordinal, offset);
2044 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2045 if max_ordinal == 0 {
2047 return Ok(());
2048 }
2049 depth.increment()?;
2050 let envelope_size = 8;
2051 let bytes_len = max_ordinal as usize * envelope_size;
2052 #[allow(unused_variables)]
2053 let offset = encoder.out_of_line_offset(bytes_len);
2054 let mut _prev_end_offset: usize = 0;
2055 if 1 > max_ordinal {
2056 return Ok(());
2057 }
2058
2059 let cur_offset: usize = (1 - 1) * envelope_size;
2062
2063 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2065
2066 fidl::encoding::encode_in_envelope_optional::<
2071 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>>,
2072 fidl::encoding::DefaultFuchsiaResourceDialect,
2073 >(
2074 self.iterator.as_mut().map(
2075 <fidl::encoding::Endpoint<
2076 fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>,
2077 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2078 ),
2079 encoder,
2080 offset + cur_offset,
2081 depth,
2082 )?;
2083
2084 _prev_end_offset = cur_offset + envelope_size;
2085 if 2 > max_ordinal {
2086 return Ok(());
2087 }
2088
2089 let cur_offset: usize = (2 - 1) * envelope_size;
2092
2093 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2095
2096 fidl::encoding::encode_in_envelope_optional::<
2101 ProcessSelector,
2102 fidl::encoding::DefaultFuchsiaResourceDialect,
2103 >(
2104 self.process_selector
2105 .as_ref()
2106 .map(<ProcessSelector as fidl::encoding::ValueTypeMarker>::borrow),
2107 encoder,
2108 offset + cur_offset,
2109 depth,
2110 )?;
2111
2112 _prev_end_offset = cur_offset + envelope_size;
2113
2114 Ok(())
2115 }
2116 }
2117
2118 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2119 for CollectorListStoredSnapshotsRequest
2120 {
2121 #[inline(always)]
2122 fn new_empty() -> Self {
2123 Self::default()
2124 }
2125
2126 unsafe fn decode(
2127 &mut self,
2128 decoder: &mut fidl::encoding::Decoder<
2129 '_,
2130 fidl::encoding::DefaultFuchsiaResourceDialect,
2131 >,
2132 offset: usize,
2133 mut depth: fidl::encoding::Depth,
2134 ) -> fidl::Result<()> {
2135 decoder.debug_check_bounds::<Self>(offset);
2136 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2137 None => return Err(fidl::Error::NotNullable),
2138 Some(len) => len,
2139 };
2140 if len == 0 {
2142 return Ok(());
2143 };
2144 depth.increment()?;
2145 let envelope_size = 8;
2146 let bytes_len = len * envelope_size;
2147 let offset = decoder.out_of_line_offset(bytes_len)?;
2148 let mut _next_ordinal_to_read = 0;
2150 let mut next_offset = offset;
2151 let end_offset = offset + bytes_len;
2152 _next_ordinal_to_read += 1;
2153 if next_offset >= end_offset {
2154 return Ok(());
2155 }
2156
2157 while _next_ordinal_to_read < 1 {
2159 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2160 _next_ordinal_to_read += 1;
2161 next_offset += envelope_size;
2162 }
2163
2164 let next_out_of_line = decoder.next_out_of_line();
2165 let handles_before = decoder.remaining_handles();
2166 if let Some((inlined, num_bytes, num_handles)) =
2167 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2168 {
2169 let member_inline_size = <fidl::encoding::Endpoint<
2170 fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>,
2171 > as fidl::encoding::TypeMarker>::inline_size(
2172 decoder.context
2173 );
2174 if inlined != (member_inline_size <= 4) {
2175 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2176 }
2177 let inner_offset;
2178 let mut inner_depth = depth.clone();
2179 if inlined {
2180 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2181 inner_offset = next_offset;
2182 } else {
2183 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2184 inner_depth.increment()?;
2185 }
2186 let val_ref = self.iterator.get_or_insert_with(|| {
2187 fidl::new_empty!(
2188 fidl::encoding::Endpoint<
2189 fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>,
2190 >,
2191 fidl::encoding::DefaultFuchsiaResourceDialect
2192 )
2193 });
2194 fidl::decode!(
2195 fidl::encoding::Endpoint<
2196 fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>,
2197 >,
2198 fidl::encoding::DefaultFuchsiaResourceDialect,
2199 val_ref,
2200 decoder,
2201 inner_offset,
2202 inner_depth
2203 )?;
2204 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2205 {
2206 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2207 }
2208 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2209 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2210 }
2211 }
2212
2213 next_offset += envelope_size;
2214 _next_ordinal_to_read += 1;
2215 if next_offset >= end_offset {
2216 return Ok(());
2217 }
2218
2219 while _next_ordinal_to_read < 2 {
2221 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2222 _next_ordinal_to_read += 1;
2223 next_offset += envelope_size;
2224 }
2225
2226 let next_out_of_line = decoder.next_out_of_line();
2227 let handles_before = decoder.remaining_handles();
2228 if let Some((inlined, num_bytes, num_handles)) =
2229 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2230 {
2231 let member_inline_size =
2232 <ProcessSelector as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2233 if inlined != (member_inline_size <= 4) {
2234 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2235 }
2236 let inner_offset;
2237 let mut inner_depth = depth.clone();
2238 if inlined {
2239 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2240 inner_offset = next_offset;
2241 } else {
2242 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2243 inner_depth.increment()?;
2244 }
2245 let val_ref = self.process_selector.get_or_insert_with(|| {
2246 fidl::new_empty!(ProcessSelector, fidl::encoding::DefaultFuchsiaResourceDialect)
2247 });
2248 fidl::decode!(
2249 ProcessSelector,
2250 fidl::encoding::DefaultFuchsiaResourceDialect,
2251 val_ref,
2252 decoder,
2253 inner_offset,
2254 inner_depth
2255 )?;
2256 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2257 {
2258 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2259 }
2260 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2261 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2262 }
2263 }
2264
2265 next_offset += envelope_size;
2266
2267 while next_offset < end_offset {
2269 _next_ordinal_to_read += 1;
2270 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2271 next_offset += envelope_size;
2272 }
2273
2274 Ok(())
2275 }
2276 }
2277
2278 impl CollectorTakeLiveSnapshotRequest {
2279 #[inline(always)]
2280 fn max_ordinal_present(&self) -> u64 {
2281 if let Some(_) = self.multi_process {
2282 return 4;
2283 }
2284 if let Some(_) = self.with_contents {
2285 return 3;
2286 }
2287 if let Some(_) = self.receiver {
2288 return 2;
2289 }
2290 if let Some(_) = self.process_selector {
2291 return 1;
2292 }
2293 0
2294 }
2295 }
2296
2297 impl fidl::encoding::ResourceTypeMarker for CollectorTakeLiveSnapshotRequest {
2298 type Borrowed<'a> = &'a mut Self;
2299 fn take_or_borrow<'a>(
2300 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2301 ) -> Self::Borrowed<'a> {
2302 value
2303 }
2304 }
2305
2306 unsafe impl fidl::encoding::TypeMarker for CollectorTakeLiveSnapshotRequest {
2307 type Owned = Self;
2308
2309 #[inline(always)]
2310 fn inline_align(_context: fidl::encoding::Context) -> usize {
2311 8
2312 }
2313
2314 #[inline(always)]
2315 fn inline_size(_context: fidl::encoding::Context) -> usize {
2316 16
2317 }
2318 }
2319
2320 unsafe impl
2321 fidl::encoding::Encode<
2322 CollectorTakeLiveSnapshotRequest,
2323 fidl::encoding::DefaultFuchsiaResourceDialect,
2324 > for &mut CollectorTakeLiveSnapshotRequest
2325 {
2326 unsafe fn encode(
2327 self,
2328 encoder: &mut fidl::encoding::Encoder<
2329 '_,
2330 fidl::encoding::DefaultFuchsiaResourceDialect,
2331 >,
2332 offset: usize,
2333 mut depth: fidl::encoding::Depth,
2334 ) -> fidl::Result<()> {
2335 encoder.debug_check_bounds::<CollectorTakeLiveSnapshotRequest>(offset);
2336 let max_ordinal: u64 = self.max_ordinal_present();
2338 encoder.write_num(max_ordinal, offset);
2339 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2340 if max_ordinal == 0 {
2342 return Ok(());
2343 }
2344 depth.increment()?;
2345 let envelope_size = 8;
2346 let bytes_len = max_ordinal as usize * envelope_size;
2347 #[allow(unused_variables)]
2348 let offset = encoder.out_of_line_offset(bytes_len);
2349 let mut _prev_end_offset: usize = 0;
2350 if 1 > max_ordinal {
2351 return Ok(());
2352 }
2353
2354 let cur_offset: usize = (1 - 1) * envelope_size;
2357
2358 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2360
2361 fidl::encoding::encode_in_envelope_optional::<
2366 ProcessSelector,
2367 fidl::encoding::DefaultFuchsiaResourceDialect,
2368 >(
2369 self.process_selector
2370 .as_ref()
2371 .map(<ProcessSelector as fidl::encoding::ValueTypeMarker>::borrow),
2372 encoder,
2373 offset + cur_offset,
2374 depth,
2375 )?;
2376
2377 _prev_end_offset = cur_offset + envelope_size;
2378 if 2 > max_ordinal {
2379 return Ok(());
2380 }
2381
2382 let cur_offset: usize = (2 - 1) * envelope_size;
2385
2386 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2388
2389 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2394 self.receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2395 encoder, offset + cur_offset, depth
2396 )?;
2397
2398 _prev_end_offset = cur_offset + envelope_size;
2399 if 3 > max_ordinal {
2400 return Ok(());
2401 }
2402
2403 let cur_offset: usize = (3 - 1) * envelope_size;
2406
2407 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2409
2410 fidl::encoding::encode_in_envelope_optional::<
2415 bool,
2416 fidl::encoding::DefaultFuchsiaResourceDialect,
2417 >(
2418 self.with_contents.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2419 encoder,
2420 offset + cur_offset,
2421 depth,
2422 )?;
2423
2424 _prev_end_offset = cur_offset + envelope_size;
2425 if 4 > max_ordinal {
2426 return Ok(());
2427 }
2428
2429 let cur_offset: usize = (4 - 1) * envelope_size;
2432
2433 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2435
2436 fidl::encoding::encode_in_envelope_optional::<
2441 bool,
2442 fidl::encoding::DefaultFuchsiaResourceDialect,
2443 >(
2444 self.multi_process.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2445 encoder,
2446 offset + cur_offset,
2447 depth,
2448 )?;
2449
2450 _prev_end_offset = cur_offset + envelope_size;
2451
2452 Ok(())
2453 }
2454 }
2455
2456 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2457 for CollectorTakeLiveSnapshotRequest
2458 {
2459 #[inline(always)]
2460 fn new_empty() -> Self {
2461 Self::default()
2462 }
2463
2464 unsafe fn decode(
2465 &mut self,
2466 decoder: &mut fidl::encoding::Decoder<
2467 '_,
2468 fidl::encoding::DefaultFuchsiaResourceDialect,
2469 >,
2470 offset: usize,
2471 mut depth: fidl::encoding::Depth,
2472 ) -> fidl::Result<()> {
2473 decoder.debug_check_bounds::<Self>(offset);
2474 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2475 None => return Err(fidl::Error::NotNullable),
2476 Some(len) => len,
2477 };
2478 if len == 0 {
2480 return Ok(());
2481 };
2482 depth.increment()?;
2483 let envelope_size = 8;
2484 let bytes_len = len * envelope_size;
2485 let offset = decoder.out_of_line_offset(bytes_len)?;
2486 let mut _next_ordinal_to_read = 0;
2488 let mut next_offset = offset;
2489 let end_offset = offset + bytes_len;
2490 _next_ordinal_to_read += 1;
2491 if next_offset >= end_offset {
2492 return Ok(());
2493 }
2494
2495 while _next_ordinal_to_read < 1 {
2497 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2498 _next_ordinal_to_read += 1;
2499 next_offset += envelope_size;
2500 }
2501
2502 let next_out_of_line = decoder.next_out_of_line();
2503 let handles_before = decoder.remaining_handles();
2504 if let Some((inlined, num_bytes, num_handles)) =
2505 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2506 {
2507 let member_inline_size =
2508 <ProcessSelector as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2509 if inlined != (member_inline_size <= 4) {
2510 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2511 }
2512 let inner_offset;
2513 let mut inner_depth = depth.clone();
2514 if inlined {
2515 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2516 inner_offset = next_offset;
2517 } else {
2518 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2519 inner_depth.increment()?;
2520 }
2521 let val_ref = self.process_selector.get_or_insert_with(|| {
2522 fidl::new_empty!(ProcessSelector, fidl::encoding::DefaultFuchsiaResourceDialect)
2523 });
2524 fidl::decode!(
2525 ProcessSelector,
2526 fidl::encoding::DefaultFuchsiaResourceDialect,
2527 val_ref,
2528 decoder,
2529 inner_offset,
2530 inner_depth
2531 )?;
2532 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2533 {
2534 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2535 }
2536 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2537 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2538 }
2539 }
2540
2541 next_offset += envelope_size;
2542 _next_ordinal_to_read += 1;
2543 if next_offset >= end_offset {
2544 return Ok(());
2545 }
2546
2547 while _next_ordinal_to_read < 2 {
2549 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2550 _next_ordinal_to_read += 1;
2551 next_offset += envelope_size;
2552 }
2553
2554 let next_out_of_line = decoder.next_out_of_line();
2555 let handles_before = decoder.remaining_handles();
2556 if let Some((inlined, num_bytes, num_handles)) =
2557 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2558 {
2559 let member_inline_size = <fidl::encoding::Endpoint<
2560 fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
2561 > as fidl::encoding::TypeMarker>::inline_size(
2562 decoder.context
2563 );
2564 if inlined != (member_inline_size <= 4) {
2565 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2566 }
2567 let inner_offset;
2568 let mut inner_depth = depth.clone();
2569 if inlined {
2570 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2571 inner_offset = next_offset;
2572 } else {
2573 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2574 inner_depth.increment()?;
2575 }
2576 let val_ref = self.receiver.get_or_insert_with(|| {
2577 fidl::new_empty!(
2578 fidl::encoding::Endpoint<
2579 fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
2580 >,
2581 fidl::encoding::DefaultFuchsiaResourceDialect
2582 )
2583 });
2584 fidl::decode!(
2585 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>,
2586 fidl::encoding::DefaultFuchsiaResourceDialect,
2587 val_ref,
2588 decoder,
2589 inner_offset,
2590 inner_depth
2591 )?;
2592 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2593 {
2594 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2595 }
2596 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2597 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2598 }
2599 }
2600
2601 next_offset += envelope_size;
2602 _next_ordinal_to_read += 1;
2603 if next_offset >= end_offset {
2604 return Ok(());
2605 }
2606
2607 while _next_ordinal_to_read < 3 {
2609 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2610 _next_ordinal_to_read += 1;
2611 next_offset += envelope_size;
2612 }
2613
2614 let next_out_of_line = decoder.next_out_of_line();
2615 let handles_before = decoder.remaining_handles();
2616 if let Some((inlined, num_bytes, num_handles)) =
2617 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2618 {
2619 let member_inline_size =
2620 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2621 if inlined != (member_inline_size <= 4) {
2622 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2623 }
2624 let inner_offset;
2625 let mut inner_depth = depth.clone();
2626 if inlined {
2627 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2628 inner_offset = next_offset;
2629 } else {
2630 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2631 inner_depth.increment()?;
2632 }
2633 let val_ref = self.with_contents.get_or_insert_with(|| {
2634 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2635 });
2636 fidl::decode!(
2637 bool,
2638 fidl::encoding::DefaultFuchsiaResourceDialect,
2639 val_ref,
2640 decoder,
2641 inner_offset,
2642 inner_depth
2643 )?;
2644 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2645 {
2646 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2647 }
2648 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2649 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2650 }
2651 }
2652
2653 next_offset += envelope_size;
2654 _next_ordinal_to_read += 1;
2655 if next_offset >= end_offset {
2656 return Ok(());
2657 }
2658
2659 while _next_ordinal_to_read < 4 {
2661 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2662 _next_ordinal_to_read += 1;
2663 next_offset += envelope_size;
2664 }
2665
2666 let next_out_of_line = decoder.next_out_of_line();
2667 let handles_before = decoder.remaining_handles();
2668 if let Some((inlined, num_bytes, num_handles)) =
2669 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2670 {
2671 let member_inline_size =
2672 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2673 if inlined != (member_inline_size <= 4) {
2674 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2675 }
2676 let inner_offset;
2677 let mut inner_depth = depth.clone();
2678 if inlined {
2679 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2680 inner_offset = next_offset;
2681 } else {
2682 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2683 inner_depth.increment()?;
2684 }
2685 let val_ref = self.multi_process.get_or_insert_with(|| {
2686 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2687 });
2688 fidl::decode!(
2689 bool,
2690 fidl::encoding::DefaultFuchsiaResourceDialect,
2691 val_ref,
2692 decoder,
2693 inner_offset,
2694 inner_depth
2695 )?;
2696 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2697 {
2698 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2699 }
2700 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2701 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2702 }
2703 }
2704
2705 next_offset += envelope_size;
2706
2707 while next_offset < end_offset {
2709 _next_ordinal_to_read += 1;
2710 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2711 next_offset += envelope_size;
2712 }
2713
2714 Ok(())
2715 }
2716 }
2717}