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
604 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
605 self.inner.shutdown_with_epitaph(status)
606 }
607
608 fn is_closed(&self) -> bool {
609 self.inner.channel().is_closed()
610 }
611 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
612 self.inner.channel().on_closed()
613 }
614
615 #[cfg(target_os = "fuchsia")]
616 fn signal_peer(
617 &self,
618 clear_mask: zx::Signals,
619 set_mask: zx::Signals,
620 ) -> Result<(), zx_status::Status> {
621 use fidl::Peered;
622 self.inner.channel().signal_peer(clear_mask, set_mask)
623 }
624}
625
626impl CollectorControlHandle {}
627
628#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
629pub struct SnapshotReceiverMarker;
630
631impl fidl::endpoints::ProtocolMarker for SnapshotReceiverMarker {
632 type Proxy = SnapshotReceiverProxy;
633 type RequestStream = SnapshotReceiverRequestStream;
634 #[cfg(target_os = "fuchsia")]
635 type SynchronousProxy = SnapshotReceiverSynchronousProxy;
636
637 const DEBUG_NAME: &'static str = "(anonymous) SnapshotReceiver";
638}
639
640pub trait SnapshotReceiverProxyInterface: Send + Sync {
641 type BatchResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
642 fn r#batch(&self, batch: &[SnapshotElement]) -> Self::BatchResponseFut;
643 type ReportErrorResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
644 fn r#report_error(&self, error: CollectorError) -> Self::ReportErrorResponseFut;
645}
646#[derive(Debug)]
647#[cfg(target_os = "fuchsia")]
648pub struct SnapshotReceiverSynchronousProxy {
649 client: fidl::client::sync::Client,
650}
651
652#[cfg(target_os = "fuchsia")]
653impl fidl::endpoints::SynchronousProxy for SnapshotReceiverSynchronousProxy {
654 type Proxy = SnapshotReceiverProxy;
655 type Protocol = SnapshotReceiverMarker;
656
657 fn from_channel(inner: fidl::Channel) -> Self {
658 Self::new(inner)
659 }
660
661 fn into_channel(self) -> fidl::Channel {
662 self.client.into_channel()
663 }
664
665 fn as_channel(&self) -> &fidl::Channel {
666 self.client.as_channel()
667 }
668}
669
670#[cfg(target_os = "fuchsia")]
671impl SnapshotReceiverSynchronousProxy {
672 pub fn new(channel: fidl::Channel) -> Self {
673 let protocol_name = <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
674 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
675 }
676
677 pub fn into_channel(self) -> fidl::Channel {
678 self.client.into_channel()
679 }
680
681 pub fn wait_for_event(
684 &self,
685 deadline: zx::MonotonicInstant,
686 ) -> Result<SnapshotReceiverEvent, fidl::Error> {
687 SnapshotReceiverEvent::decode(self.client.wait_for_event(deadline)?)
688 }
689
690 pub fn r#batch(
700 &self,
701 mut batch: &[SnapshotElement],
702 ___deadline: zx::MonotonicInstant,
703 ) -> Result<(), fidl::Error> {
704 let _response =
705 self.client.send_query::<SnapshotReceiverBatchRequest, fidl::encoding::EmptyPayload>(
706 (batch,),
707 0x4e2a7b07ec4bf37e,
708 fidl::encoding::DynamicFlags::empty(),
709 ___deadline,
710 )?;
711 Ok(_response)
712 }
713
714 pub fn r#report_error(
716 &self,
717 mut error: CollectorError,
718 ___deadline: zx::MonotonicInstant,
719 ) -> Result<(), fidl::Error> {
720 let _response = self
721 .client
722 .send_query::<SnapshotReceiverReportErrorRequest, fidl::encoding::EmptyPayload>(
723 (error,),
724 0x7bc3329e0ec250c4,
725 fidl::encoding::DynamicFlags::empty(),
726 ___deadline,
727 )?;
728 Ok(_response)
729 }
730}
731
732#[cfg(target_os = "fuchsia")]
733impl From<SnapshotReceiverSynchronousProxy> for zx::NullableHandle {
734 fn from(value: SnapshotReceiverSynchronousProxy) -> Self {
735 value.into_channel().into()
736 }
737}
738
739#[cfg(target_os = "fuchsia")]
740impl From<fidl::Channel> for SnapshotReceiverSynchronousProxy {
741 fn from(value: fidl::Channel) -> Self {
742 Self::new(value)
743 }
744}
745
746#[cfg(target_os = "fuchsia")]
747impl fidl::endpoints::FromClient for SnapshotReceiverSynchronousProxy {
748 type Protocol = SnapshotReceiverMarker;
749
750 fn from_client(value: fidl::endpoints::ClientEnd<SnapshotReceiverMarker>) -> Self {
751 Self::new(value.into_channel())
752 }
753}
754
755#[derive(Debug, Clone)]
756pub struct SnapshotReceiverProxy {
757 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
758}
759
760impl fidl::endpoints::Proxy for SnapshotReceiverProxy {
761 type Protocol = SnapshotReceiverMarker;
762
763 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
764 Self::new(inner)
765 }
766
767 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
768 self.client.into_channel().map_err(|client| Self { client })
769 }
770
771 fn as_channel(&self) -> &::fidl::AsyncChannel {
772 self.client.as_channel()
773 }
774}
775
776impl SnapshotReceiverProxy {
777 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
779 let protocol_name = <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
780 Self { client: fidl::client::Client::new(channel, protocol_name) }
781 }
782
783 pub fn take_event_stream(&self) -> SnapshotReceiverEventStream {
789 SnapshotReceiverEventStream { event_receiver: self.client.take_event_receiver() }
790 }
791
792 pub fn r#batch(
802 &self,
803 mut batch: &[SnapshotElement],
804 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
805 SnapshotReceiverProxyInterface::r#batch(self, batch)
806 }
807
808 pub fn r#report_error(
810 &self,
811 mut error: CollectorError,
812 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
813 SnapshotReceiverProxyInterface::r#report_error(self, error)
814 }
815}
816
817impl SnapshotReceiverProxyInterface for SnapshotReceiverProxy {
818 type BatchResponseFut =
819 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
820 fn r#batch(&self, mut batch: &[SnapshotElement]) -> Self::BatchResponseFut {
821 fn _decode(
822 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
823 ) -> Result<(), fidl::Error> {
824 let _response = fidl::client::decode_transaction_body::<
825 fidl::encoding::EmptyPayload,
826 fidl::encoding::DefaultFuchsiaResourceDialect,
827 0x4e2a7b07ec4bf37e,
828 >(_buf?)?;
829 Ok(_response)
830 }
831 self.client.send_query_and_decode::<SnapshotReceiverBatchRequest, ()>(
832 (batch,),
833 0x4e2a7b07ec4bf37e,
834 fidl::encoding::DynamicFlags::empty(),
835 _decode,
836 )
837 }
838
839 type ReportErrorResponseFut =
840 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
841 fn r#report_error(&self, mut error: CollectorError) -> Self::ReportErrorResponseFut {
842 fn _decode(
843 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
844 ) -> Result<(), fidl::Error> {
845 let _response = fidl::client::decode_transaction_body::<
846 fidl::encoding::EmptyPayload,
847 fidl::encoding::DefaultFuchsiaResourceDialect,
848 0x7bc3329e0ec250c4,
849 >(_buf?)?;
850 Ok(_response)
851 }
852 self.client.send_query_and_decode::<SnapshotReceiverReportErrorRequest, ()>(
853 (error,),
854 0x7bc3329e0ec250c4,
855 fidl::encoding::DynamicFlags::empty(),
856 _decode,
857 )
858 }
859}
860
861pub struct SnapshotReceiverEventStream {
862 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
863}
864
865impl std::marker::Unpin for SnapshotReceiverEventStream {}
866
867impl futures::stream::FusedStream for SnapshotReceiverEventStream {
868 fn is_terminated(&self) -> bool {
869 self.event_receiver.is_terminated()
870 }
871}
872
873impl futures::Stream for SnapshotReceiverEventStream {
874 type Item = Result<SnapshotReceiverEvent, fidl::Error>;
875
876 fn poll_next(
877 mut self: std::pin::Pin<&mut Self>,
878 cx: &mut std::task::Context<'_>,
879 ) -> std::task::Poll<Option<Self::Item>> {
880 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
881 &mut self.event_receiver,
882 cx
883 )?) {
884 Some(buf) => std::task::Poll::Ready(Some(SnapshotReceiverEvent::decode(buf))),
885 None => std::task::Poll::Ready(None),
886 }
887 }
888}
889
890#[derive(Debug)]
891pub enum SnapshotReceiverEvent {}
892
893impl SnapshotReceiverEvent {
894 fn decode(
896 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
897 ) -> Result<SnapshotReceiverEvent, fidl::Error> {
898 let (bytes, _handles) = buf.split_mut();
899 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
900 debug_assert_eq!(tx_header.tx_id, 0);
901 match tx_header.ordinal {
902 _ => Err(fidl::Error::UnknownOrdinal {
903 ordinal: tx_header.ordinal,
904 protocol_name:
905 <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
906 }),
907 }
908 }
909}
910
911pub struct SnapshotReceiverRequestStream {
913 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
914 is_terminated: bool,
915}
916
917impl std::marker::Unpin for SnapshotReceiverRequestStream {}
918
919impl futures::stream::FusedStream for SnapshotReceiverRequestStream {
920 fn is_terminated(&self) -> bool {
921 self.is_terminated
922 }
923}
924
925impl fidl::endpoints::RequestStream for SnapshotReceiverRequestStream {
926 type Protocol = SnapshotReceiverMarker;
927 type ControlHandle = SnapshotReceiverControlHandle;
928
929 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
930 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
931 }
932
933 fn control_handle(&self) -> Self::ControlHandle {
934 SnapshotReceiverControlHandle { inner: self.inner.clone() }
935 }
936
937 fn into_inner(
938 self,
939 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
940 {
941 (self.inner, self.is_terminated)
942 }
943
944 fn from_inner(
945 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
946 is_terminated: bool,
947 ) -> Self {
948 Self { inner, is_terminated }
949 }
950}
951
952impl futures::Stream for SnapshotReceiverRequestStream {
953 type Item = Result<SnapshotReceiverRequest, fidl::Error>;
954
955 fn poll_next(
956 mut self: std::pin::Pin<&mut Self>,
957 cx: &mut std::task::Context<'_>,
958 ) -> std::task::Poll<Option<Self::Item>> {
959 let this = &mut *self;
960 if this.inner.check_shutdown(cx) {
961 this.is_terminated = true;
962 return std::task::Poll::Ready(None);
963 }
964 if this.is_terminated {
965 panic!("polled SnapshotReceiverRequestStream after completion");
966 }
967 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
968 |bytes, handles| {
969 match this.inner.channel().read_etc(cx, bytes, handles) {
970 std::task::Poll::Ready(Ok(())) => {}
971 std::task::Poll::Pending => return std::task::Poll::Pending,
972 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
973 this.is_terminated = true;
974 return std::task::Poll::Ready(None);
975 }
976 std::task::Poll::Ready(Err(e)) => {
977 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
978 e.into(),
979 ))));
980 }
981 }
982
983 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
985
986 std::task::Poll::Ready(Some(match header.ordinal {
987 0x4e2a7b07ec4bf37e => {
988 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
989 let mut req = fidl::new_empty!(
990 SnapshotReceiverBatchRequest,
991 fidl::encoding::DefaultFuchsiaResourceDialect
992 );
993 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnapshotReceiverBatchRequest>(&header, _body_bytes, handles, &mut req)?;
994 let control_handle =
995 SnapshotReceiverControlHandle { inner: this.inner.clone() };
996 Ok(SnapshotReceiverRequest::Batch {
997 batch: req.batch,
998
999 responder: SnapshotReceiverBatchResponder {
1000 control_handle: std::mem::ManuallyDrop::new(control_handle),
1001 tx_id: header.tx_id,
1002 },
1003 })
1004 }
1005 0x7bc3329e0ec250c4 => {
1006 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1007 let mut req = fidl::new_empty!(
1008 SnapshotReceiverReportErrorRequest,
1009 fidl::encoding::DefaultFuchsiaResourceDialect
1010 );
1011 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnapshotReceiverReportErrorRequest>(&header, _body_bytes, handles, &mut req)?;
1012 let control_handle =
1013 SnapshotReceiverControlHandle { inner: this.inner.clone() };
1014 Ok(SnapshotReceiverRequest::ReportError {
1015 error: req.error,
1016
1017 responder: SnapshotReceiverReportErrorResponder {
1018 control_handle: std::mem::ManuallyDrop::new(control_handle),
1019 tx_id: header.tx_id,
1020 },
1021 })
1022 }
1023 _ => Err(fidl::Error::UnknownOrdinal {
1024 ordinal: header.ordinal,
1025 protocol_name:
1026 <SnapshotReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1027 }),
1028 }))
1029 },
1030 )
1031 }
1032}
1033
1034#[derive(Debug)]
1036pub enum SnapshotReceiverRequest {
1037 Batch { batch: Vec<SnapshotElement>, responder: SnapshotReceiverBatchResponder },
1047 ReportError { error: CollectorError, responder: SnapshotReceiverReportErrorResponder },
1049}
1050
1051impl SnapshotReceiverRequest {
1052 #[allow(irrefutable_let_patterns)]
1053 pub fn into_batch(self) -> Option<(Vec<SnapshotElement>, SnapshotReceiverBatchResponder)> {
1054 if let SnapshotReceiverRequest::Batch { batch, responder } = self {
1055 Some((batch, responder))
1056 } else {
1057 None
1058 }
1059 }
1060
1061 #[allow(irrefutable_let_patterns)]
1062 pub fn into_report_error(
1063 self,
1064 ) -> Option<(CollectorError, SnapshotReceiverReportErrorResponder)> {
1065 if let SnapshotReceiverRequest::ReportError { error, responder } = self {
1066 Some((error, responder))
1067 } else {
1068 None
1069 }
1070 }
1071
1072 pub fn method_name(&self) -> &'static str {
1074 match *self {
1075 SnapshotReceiverRequest::Batch { .. } => "batch",
1076 SnapshotReceiverRequest::ReportError { .. } => "report_error",
1077 }
1078 }
1079}
1080
1081#[derive(Debug, Clone)]
1082pub struct SnapshotReceiverControlHandle {
1083 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1084}
1085
1086impl fidl::endpoints::ControlHandle for SnapshotReceiverControlHandle {
1087 fn shutdown(&self) {
1088 self.inner.shutdown()
1089 }
1090
1091 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1092 self.inner.shutdown_with_epitaph(status)
1093 }
1094
1095 fn is_closed(&self) -> bool {
1096 self.inner.channel().is_closed()
1097 }
1098 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1099 self.inner.channel().on_closed()
1100 }
1101
1102 #[cfg(target_os = "fuchsia")]
1103 fn signal_peer(
1104 &self,
1105 clear_mask: zx::Signals,
1106 set_mask: zx::Signals,
1107 ) -> Result<(), zx_status::Status> {
1108 use fidl::Peered;
1109 self.inner.channel().signal_peer(clear_mask, set_mask)
1110 }
1111}
1112
1113impl SnapshotReceiverControlHandle {}
1114
1115#[must_use = "FIDL methods require a response to be sent"]
1116#[derive(Debug)]
1117pub struct SnapshotReceiverBatchResponder {
1118 control_handle: std::mem::ManuallyDrop<SnapshotReceiverControlHandle>,
1119 tx_id: u32,
1120}
1121
1122impl std::ops::Drop for SnapshotReceiverBatchResponder {
1126 fn drop(&mut self) {
1127 self.control_handle.shutdown();
1128 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1130 }
1131}
1132
1133impl fidl::endpoints::Responder for SnapshotReceiverBatchResponder {
1134 type ControlHandle = SnapshotReceiverControlHandle;
1135
1136 fn control_handle(&self) -> &SnapshotReceiverControlHandle {
1137 &self.control_handle
1138 }
1139
1140 fn drop_without_shutdown(mut self) {
1141 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1143 std::mem::forget(self);
1145 }
1146}
1147
1148impl SnapshotReceiverBatchResponder {
1149 pub fn send(self) -> Result<(), fidl::Error> {
1153 let _result = self.send_raw();
1154 if _result.is_err() {
1155 self.control_handle.shutdown();
1156 }
1157 self.drop_without_shutdown();
1158 _result
1159 }
1160
1161 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1163 let _result = self.send_raw();
1164 self.drop_without_shutdown();
1165 _result
1166 }
1167
1168 fn send_raw(&self) -> Result<(), fidl::Error> {
1169 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1170 (),
1171 self.tx_id,
1172 0x4e2a7b07ec4bf37e,
1173 fidl::encoding::DynamicFlags::empty(),
1174 )
1175 }
1176}
1177
1178#[must_use = "FIDL methods require a response to be sent"]
1179#[derive(Debug)]
1180pub struct SnapshotReceiverReportErrorResponder {
1181 control_handle: std::mem::ManuallyDrop<SnapshotReceiverControlHandle>,
1182 tx_id: u32,
1183}
1184
1185impl std::ops::Drop for SnapshotReceiverReportErrorResponder {
1189 fn drop(&mut self) {
1190 self.control_handle.shutdown();
1191 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1193 }
1194}
1195
1196impl fidl::endpoints::Responder for SnapshotReceiverReportErrorResponder {
1197 type ControlHandle = SnapshotReceiverControlHandle;
1198
1199 fn control_handle(&self) -> &SnapshotReceiverControlHandle {
1200 &self.control_handle
1201 }
1202
1203 fn drop_without_shutdown(mut self) {
1204 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1206 std::mem::forget(self);
1208 }
1209}
1210
1211impl SnapshotReceiverReportErrorResponder {
1212 pub fn send(self) -> Result<(), fidl::Error> {
1216 let _result = self.send_raw();
1217 if _result.is_err() {
1218 self.control_handle.shutdown();
1219 }
1220 self.drop_without_shutdown();
1221 _result
1222 }
1223
1224 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1226 let _result = self.send_raw();
1227 self.drop_without_shutdown();
1228 _result
1229 }
1230
1231 fn send_raw(&self) -> Result<(), fidl::Error> {
1232 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1233 (),
1234 self.tx_id,
1235 0x7bc3329e0ec250c4,
1236 fidl::encoding::DynamicFlags::empty(),
1237 )
1238 }
1239}
1240
1241#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1242pub struct StoredSnapshotIteratorMarker;
1243
1244impl fidl::endpoints::ProtocolMarker for StoredSnapshotIteratorMarker {
1245 type Proxy = StoredSnapshotIteratorProxy;
1246 type RequestStream = StoredSnapshotIteratorRequestStream;
1247 #[cfg(target_os = "fuchsia")]
1248 type SynchronousProxy = StoredSnapshotIteratorSynchronousProxy;
1249
1250 const DEBUG_NAME: &'static str = "(anonymous) StoredSnapshotIterator";
1251}
1252pub type StoredSnapshotIteratorGetNextResult = Result<Vec<StoredSnapshot>, CollectorError>;
1253
1254pub trait StoredSnapshotIteratorProxyInterface: Send + Sync {
1255 type GetNextResponseFut: std::future::Future<Output = Result<StoredSnapshotIteratorGetNextResult, fidl::Error>>
1256 + Send;
1257 fn r#get_next(&self) -> Self::GetNextResponseFut;
1258}
1259#[derive(Debug)]
1260#[cfg(target_os = "fuchsia")]
1261pub struct StoredSnapshotIteratorSynchronousProxy {
1262 client: fidl::client::sync::Client,
1263}
1264
1265#[cfg(target_os = "fuchsia")]
1266impl fidl::endpoints::SynchronousProxy for StoredSnapshotIteratorSynchronousProxy {
1267 type Proxy = StoredSnapshotIteratorProxy;
1268 type Protocol = StoredSnapshotIteratorMarker;
1269
1270 fn from_channel(inner: fidl::Channel) -> Self {
1271 Self::new(inner)
1272 }
1273
1274 fn into_channel(self) -> fidl::Channel {
1275 self.client.into_channel()
1276 }
1277
1278 fn as_channel(&self) -> &fidl::Channel {
1279 self.client.as_channel()
1280 }
1281}
1282
1283#[cfg(target_os = "fuchsia")]
1284impl StoredSnapshotIteratorSynchronousProxy {
1285 pub fn new(channel: fidl::Channel) -> Self {
1286 let protocol_name =
1287 <StoredSnapshotIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1288 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1289 }
1290
1291 pub fn into_channel(self) -> fidl::Channel {
1292 self.client.into_channel()
1293 }
1294
1295 pub fn wait_for_event(
1298 &self,
1299 deadline: zx::MonotonicInstant,
1300 ) -> Result<StoredSnapshotIteratorEvent, fidl::Error> {
1301 StoredSnapshotIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1302 }
1303
1304 pub fn r#get_next(
1308 &self,
1309 ___deadline: zx::MonotonicInstant,
1310 ) -> Result<StoredSnapshotIteratorGetNextResult, fidl::Error> {
1311 let _response =
1312 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1313 StoredSnapshotIteratorGetNextResponse,
1314 CollectorError,
1315 >>(
1316 (),
1317 0x486d0c7d309d2474,
1318 fidl::encoding::DynamicFlags::empty(),
1319 ___deadline,
1320 )?;
1321 Ok(_response.map(|x| x.batch))
1322 }
1323}
1324
1325#[cfg(target_os = "fuchsia")]
1326impl From<StoredSnapshotIteratorSynchronousProxy> for zx::NullableHandle {
1327 fn from(value: StoredSnapshotIteratorSynchronousProxy) -> Self {
1328 value.into_channel().into()
1329 }
1330}
1331
1332#[cfg(target_os = "fuchsia")]
1333impl From<fidl::Channel> for StoredSnapshotIteratorSynchronousProxy {
1334 fn from(value: fidl::Channel) -> Self {
1335 Self::new(value)
1336 }
1337}
1338
1339#[cfg(target_os = "fuchsia")]
1340impl fidl::endpoints::FromClient for StoredSnapshotIteratorSynchronousProxy {
1341 type Protocol = StoredSnapshotIteratorMarker;
1342
1343 fn from_client(value: fidl::endpoints::ClientEnd<StoredSnapshotIteratorMarker>) -> Self {
1344 Self::new(value.into_channel())
1345 }
1346}
1347
1348#[derive(Debug, Clone)]
1349pub struct StoredSnapshotIteratorProxy {
1350 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1351}
1352
1353impl fidl::endpoints::Proxy for StoredSnapshotIteratorProxy {
1354 type Protocol = StoredSnapshotIteratorMarker;
1355
1356 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1357 Self::new(inner)
1358 }
1359
1360 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1361 self.client.into_channel().map_err(|client| Self { client })
1362 }
1363
1364 fn as_channel(&self) -> &::fidl::AsyncChannel {
1365 self.client.as_channel()
1366 }
1367}
1368
1369impl StoredSnapshotIteratorProxy {
1370 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1372 let protocol_name =
1373 <StoredSnapshotIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1374 Self { client: fidl::client::Client::new(channel, protocol_name) }
1375 }
1376
1377 pub fn take_event_stream(&self) -> StoredSnapshotIteratorEventStream {
1383 StoredSnapshotIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1384 }
1385
1386 pub fn r#get_next(
1390 &self,
1391 ) -> fidl::client::QueryResponseFut<
1392 StoredSnapshotIteratorGetNextResult,
1393 fidl::encoding::DefaultFuchsiaResourceDialect,
1394 > {
1395 StoredSnapshotIteratorProxyInterface::r#get_next(self)
1396 }
1397}
1398
1399impl StoredSnapshotIteratorProxyInterface for StoredSnapshotIteratorProxy {
1400 type GetNextResponseFut = fidl::client::QueryResponseFut<
1401 StoredSnapshotIteratorGetNextResult,
1402 fidl::encoding::DefaultFuchsiaResourceDialect,
1403 >;
1404 fn r#get_next(&self) -> Self::GetNextResponseFut {
1405 fn _decode(
1406 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1407 ) -> Result<StoredSnapshotIteratorGetNextResult, fidl::Error> {
1408 let _response = fidl::client::decode_transaction_body::<
1409 fidl::encoding::ResultType<StoredSnapshotIteratorGetNextResponse, CollectorError>,
1410 fidl::encoding::DefaultFuchsiaResourceDialect,
1411 0x486d0c7d309d2474,
1412 >(_buf?)?;
1413 Ok(_response.map(|x| x.batch))
1414 }
1415 self.client.send_query_and_decode::<
1416 fidl::encoding::EmptyPayload,
1417 StoredSnapshotIteratorGetNextResult,
1418 >(
1419 (),
1420 0x486d0c7d309d2474,
1421 fidl::encoding::DynamicFlags::empty(),
1422 _decode,
1423 )
1424 }
1425}
1426
1427pub struct StoredSnapshotIteratorEventStream {
1428 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1429}
1430
1431impl std::marker::Unpin for StoredSnapshotIteratorEventStream {}
1432
1433impl futures::stream::FusedStream for StoredSnapshotIteratorEventStream {
1434 fn is_terminated(&self) -> bool {
1435 self.event_receiver.is_terminated()
1436 }
1437}
1438
1439impl futures::Stream for StoredSnapshotIteratorEventStream {
1440 type Item = Result<StoredSnapshotIteratorEvent, fidl::Error>;
1441
1442 fn poll_next(
1443 mut self: std::pin::Pin<&mut Self>,
1444 cx: &mut std::task::Context<'_>,
1445 ) -> std::task::Poll<Option<Self::Item>> {
1446 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1447 &mut self.event_receiver,
1448 cx
1449 )?) {
1450 Some(buf) => std::task::Poll::Ready(Some(StoredSnapshotIteratorEvent::decode(buf))),
1451 None => std::task::Poll::Ready(None),
1452 }
1453 }
1454}
1455
1456#[derive(Debug)]
1457pub enum StoredSnapshotIteratorEvent {}
1458
1459impl StoredSnapshotIteratorEvent {
1460 fn decode(
1462 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1463 ) -> Result<StoredSnapshotIteratorEvent, fidl::Error> {
1464 let (bytes, _handles) = buf.split_mut();
1465 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1466 debug_assert_eq!(tx_header.tx_id, 0);
1467 match tx_header.ordinal {
1468 _ => Err(fidl::Error::UnknownOrdinal {
1469 ordinal: tx_header.ordinal,
1470 protocol_name:
1471 <StoredSnapshotIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1472 }),
1473 }
1474 }
1475}
1476
1477pub struct StoredSnapshotIteratorRequestStream {
1479 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1480 is_terminated: bool,
1481}
1482
1483impl std::marker::Unpin for StoredSnapshotIteratorRequestStream {}
1484
1485impl futures::stream::FusedStream for StoredSnapshotIteratorRequestStream {
1486 fn is_terminated(&self) -> bool {
1487 self.is_terminated
1488 }
1489}
1490
1491impl fidl::endpoints::RequestStream for StoredSnapshotIteratorRequestStream {
1492 type Protocol = StoredSnapshotIteratorMarker;
1493 type ControlHandle = StoredSnapshotIteratorControlHandle;
1494
1495 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1496 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1497 }
1498
1499 fn control_handle(&self) -> Self::ControlHandle {
1500 StoredSnapshotIteratorControlHandle { inner: self.inner.clone() }
1501 }
1502
1503 fn into_inner(
1504 self,
1505 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1506 {
1507 (self.inner, self.is_terminated)
1508 }
1509
1510 fn from_inner(
1511 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1512 is_terminated: bool,
1513 ) -> Self {
1514 Self { inner, is_terminated }
1515 }
1516}
1517
1518impl futures::Stream for StoredSnapshotIteratorRequestStream {
1519 type Item = Result<StoredSnapshotIteratorRequest, fidl::Error>;
1520
1521 fn poll_next(
1522 mut self: std::pin::Pin<&mut Self>,
1523 cx: &mut std::task::Context<'_>,
1524 ) -> std::task::Poll<Option<Self::Item>> {
1525 let this = &mut *self;
1526 if this.inner.check_shutdown(cx) {
1527 this.is_terminated = true;
1528 return std::task::Poll::Ready(None);
1529 }
1530 if this.is_terminated {
1531 panic!("polled StoredSnapshotIteratorRequestStream after completion");
1532 }
1533 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1534 |bytes, handles| {
1535 match this.inner.channel().read_etc(cx, bytes, handles) {
1536 std::task::Poll::Ready(Ok(())) => {}
1537 std::task::Poll::Pending => return std::task::Poll::Pending,
1538 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1539 this.is_terminated = true;
1540 return std::task::Poll::Ready(None);
1541 }
1542 std::task::Poll::Ready(Err(e)) => {
1543 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1544 e.into(),
1545 ))));
1546 }
1547 }
1548
1549 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1551
1552 std::task::Poll::Ready(Some(match header.ordinal {
1553 0x486d0c7d309d2474 => {
1554 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1555 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1556 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1557 let control_handle = StoredSnapshotIteratorControlHandle {
1558 inner: this.inner.clone(),
1559 };
1560 Ok(StoredSnapshotIteratorRequest::GetNext {
1561 responder: StoredSnapshotIteratorGetNextResponder {
1562 control_handle: std::mem::ManuallyDrop::new(control_handle),
1563 tx_id: header.tx_id,
1564 },
1565 })
1566 }
1567 _ => Err(fidl::Error::UnknownOrdinal {
1568 ordinal: header.ordinal,
1569 protocol_name: <StoredSnapshotIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1570 }),
1571 }))
1572 },
1573 )
1574 }
1575}
1576
1577#[derive(Debug)]
1579pub enum StoredSnapshotIteratorRequest {
1580 GetNext { responder: StoredSnapshotIteratorGetNextResponder },
1584}
1585
1586impl StoredSnapshotIteratorRequest {
1587 #[allow(irrefutable_let_patterns)]
1588 pub fn into_get_next(self) -> Option<(StoredSnapshotIteratorGetNextResponder)> {
1589 if let StoredSnapshotIteratorRequest::GetNext { responder } = self {
1590 Some((responder))
1591 } else {
1592 None
1593 }
1594 }
1595
1596 pub fn method_name(&self) -> &'static str {
1598 match *self {
1599 StoredSnapshotIteratorRequest::GetNext { .. } => "get_next",
1600 }
1601 }
1602}
1603
1604#[derive(Debug, Clone)]
1605pub struct StoredSnapshotIteratorControlHandle {
1606 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1607}
1608
1609impl fidl::endpoints::ControlHandle for StoredSnapshotIteratorControlHandle {
1610 fn shutdown(&self) {
1611 self.inner.shutdown()
1612 }
1613
1614 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1615 self.inner.shutdown_with_epitaph(status)
1616 }
1617
1618 fn is_closed(&self) -> bool {
1619 self.inner.channel().is_closed()
1620 }
1621 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1622 self.inner.channel().on_closed()
1623 }
1624
1625 #[cfg(target_os = "fuchsia")]
1626 fn signal_peer(
1627 &self,
1628 clear_mask: zx::Signals,
1629 set_mask: zx::Signals,
1630 ) -> Result<(), zx_status::Status> {
1631 use fidl::Peered;
1632 self.inner.channel().signal_peer(clear_mask, set_mask)
1633 }
1634}
1635
1636impl StoredSnapshotIteratorControlHandle {}
1637
1638#[must_use = "FIDL methods require a response to be sent"]
1639#[derive(Debug)]
1640pub struct StoredSnapshotIteratorGetNextResponder {
1641 control_handle: std::mem::ManuallyDrop<StoredSnapshotIteratorControlHandle>,
1642 tx_id: u32,
1643}
1644
1645impl std::ops::Drop for StoredSnapshotIteratorGetNextResponder {
1649 fn drop(&mut self) {
1650 self.control_handle.shutdown();
1651 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1653 }
1654}
1655
1656impl fidl::endpoints::Responder for StoredSnapshotIteratorGetNextResponder {
1657 type ControlHandle = StoredSnapshotIteratorControlHandle;
1658
1659 fn control_handle(&self) -> &StoredSnapshotIteratorControlHandle {
1660 &self.control_handle
1661 }
1662
1663 fn drop_without_shutdown(mut self) {
1664 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1666 std::mem::forget(self);
1668 }
1669}
1670
1671impl StoredSnapshotIteratorGetNextResponder {
1672 pub fn send(
1676 self,
1677 mut result: Result<&[StoredSnapshot], CollectorError>,
1678 ) -> Result<(), fidl::Error> {
1679 let _result = self.send_raw(result);
1680 if _result.is_err() {
1681 self.control_handle.shutdown();
1682 }
1683 self.drop_without_shutdown();
1684 _result
1685 }
1686
1687 pub fn send_no_shutdown_on_err(
1689 self,
1690 mut result: Result<&[StoredSnapshot], CollectorError>,
1691 ) -> Result<(), fidl::Error> {
1692 let _result = self.send_raw(result);
1693 self.drop_without_shutdown();
1694 _result
1695 }
1696
1697 fn send_raw(
1698 &self,
1699 mut result: Result<&[StoredSnapshot], CollectorError>,
1700 ) -> Result<(), fidl::Error> {
1701 self.control_handle.inner.send::<fidl::encoding::ResultType<
1702 StoredSnapshotIteratorGetNextResponse,
1703 CollectorError,
1704 >>(
1705 result.map(|batch| (batch,)),
1706 self.tx_id,
1707 0x486d0c7d309d2474,
1708 fidl::encoding::DynamicFlags::empty(),
1709 )
1710 }
1711}
1712
1713mod internal {
1714 use super::*;
1715
1716 impl CollectorDownloadStoredSnapshotRequest {
1717 #[inline(always)]
1718 fn max_ordinal_present(&self) -> u64 {
1719 if let Some(_) = self.receiver {
1720 return 2;
1721 }
1722 if let Some(_) = self.snapshot_id {
1723 return 1;
1724 }
1725 0
1726 }
1727 }
1728
1729 impl fidl::encoding::ResourceTypeMarker for CollectorDownloadStoredSnapshotRequest {
1730 type Borrowed<'a> = &'a mut Self;
1731 fn take_or_borrow<'a>(
1732 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1733 ) -> Self::Borrowed<'a> {
1734 value
1735 }
1736 }
1737
1738 unsafe impl fidl::encoding::TypeMarker for CollectorDownloadStoredSnapshotRequest {
1739 type Owned = Self;
1740
1741 #[inline(always)]
1742 fn inline_align(_context: fidl::encoding::Context) -> usize {
1743 8
1744 }
1745
1746 #[inline(always)]
1747 fn inline_size(_context: fidl::encoding::Context) -> usize {
1748 16
1749 }
1750 }
1751
1752 unsafe impl
1753 fidl::encoding::Encode<
1754 CollectorDownloadStoredSnapshotRequest,
1755 fidl::encoding::DefaultFuchsiaResourceDialect,
1756 > for &mut CollectorDownloadStoredSnapshotRequest
1757 {
1758 unsafe fn encode(
1759 self,
1760 encoder: &mut fidl::encoding::Encoder<
1761 '_,
1762 fidl::encoding::DefaultFuchsiaResourceDialect,
1763 >,
1764 offset: usize,
1765 mut depth: fidl::encoding::Depth,
1766 ) -> fidl::Result<()> {
1767 encoder.debug_check_bounds::<CollectorDownloadStoredSnapshotRequest>(offset);
1768 let max_ordinal: u64 = self.max_ordinal_present();
1770 encoder.write_num(max_ordinal, offset);
1771 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1772 if max_ordinal == 0 {
1774 return Ok(());
1775 }
1776 depth.increment()?;
1777 let envelope_size = 8;
1778 let bytes_len = max_ordinal as usize * envelope_size;
1779 #[allow(unused_variables)]
1780 let offset = encoder.out_of_line_offset(bytes_len);
1781 let mut _prev_end_offset: usize = 0;
1782 if 1 > max_ordinal {
1783 return Ok(());
1784 }
1785
1786 let cur_offset: usize = (1 - 1) * envelope_size;
1789
1790 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1792
1793 fidl::encoding::encode_in_envelope_optional::<
1798 u32,
1799 fidl::encoding::DefaultFuchsiaResourceDialect,
1800 >(
1801 self.snapshot_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1802 encoder,
1803 offset + cur_offset,
1804 depth,
1805 )?;
1806
1807 _prev_end_offset = cur_offset + envelope_size;
1808 if 2 > max_ordinal {
1809 return Ok(());
1810 }
1811
1812 let cur_offset: usize = (2 - 1) * envelope_size;
1815
1816 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1818
1819 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1824 self.receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1825 encoder, offset + cur_offset, depth
1826 )?;
1827
1828 _prev_end_offset = cur_offset + envelope_size;
1829
1830 Ok(())
1831 }
1832 }
1833
1834 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1835 for CollectorDownloadStoredSnapshotRequest
1836 {
1837 #[inline(always)]
1838 fn new_empty() -> Self {
1839 Self::default()
1840 }
1841
1842 unsafe fn decode(
1843 &mut self,
1844 decoder: &mut fidl::encoding::Decoder<
1845 '_,
1846 fidl::encoding::DefaultFuchsiaResourceDialect,
1847 >,
1848 offset: usize,
1849 mut depth: fidl::encoding::Depth,
1850 ) -> fidl::Result<()> {
1851 decoder.debug_check_bounds::<Self>(offset);
1852 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1853 None => return Err(fidl::Error::NotNullable),
1854 Some(len) => len,
1855 };
1856 if len == 0 {
1858 return Ok(());
1859 };
1860 depth.increment()?;
1861 let envelope_size = 8;
1862 let bytes_len = len * envelope_size;
1863 let offset = decoder.out_of_line_offset(bytes_len)?;
1864 let mut _next_ordinal_to_read = 0;
1866 let mut next_offset = offset;
1867 let end_offset = offset + bytes_len;
1868 _next_ordinal_to_read += 1;
1869 if next_offset >= end_offset {
1870 return Ok(());
1871 }
1872
1873 while _next_ordinal_to_read < 1 {
1875 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1876 _next_ordinal_to_read += 1;
1877 next_offset += envelope_size;
1878 }
1879
1880 let next_out_of_line = decoder.next_out_of_line();
1881 let handles_before = decoder.remaining_handles();
1882 if let Some((inlined, num_bytes, num_handles)) =
1883 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1884 {
1885 let member_inline_size =
1886 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1887 if inlined != (member_inline_size <= 4) {
1888 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1889 }
1890 let inner_offset;
1891 let mut inner_depth = depth.clone();
1892 if inlined {
1893 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1894 inner_offset = next_offset;
1895 } else {
1896 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1897 inner_depth.increment()?;
1898 }
1899 let val_ref = self.snapshot_id.get_or_insert_with(|| {
1900 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
1901 });
1902 fidl::decode!(
1903 u32,
1904 fidl::encoding::DefaultFuchsiaResourceDialect,
1905 val_ref,
1906 decoder,
1907 inner_offset,
1908 inner_depth
1909 )?;
1910 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1911 {
1912 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1913 }
1914 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1915 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1916 }
1917 }
1918
1919 next_offset += envelope_size;
1920 _next_ordinal_to_read += 1;
1921 if next_offset >= end_offset {
1922 return Ok(());
1923 }
1924
1925 while _next_ordinal_to_read < 2 {
1927 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1928 _next_ordinal_to_read += 1;
1929 next_offset += envelope_size;
1930 }
1931
1932 let next_out_of_line = decoder.next_out_of_line();
1933 let handles_before = decoder.remaining_handles();
1934 if let Some((inlined, num_bytes, num_handles)) =
1935 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1936 {
1937 let member_inline_size = <fidl::encoding::Endpoint<
1938 fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
1939 > as fidl::encoding::TypeMarker>::inline_size(
1940 decoder.context
1941 );
1942 if inlined != (member_inline_size <= 4) {
1943 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1944 }
1945 let inner_offset;
1946 let mut inner_depth = depth.clone();
1947 if inlined {
1948 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1949 inner_offset = next_offset;
1950 } else {
1951 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1952 inner_depth.increment()?;
1953 }
1954 let val_ref = self.receiver.get_or_insert_with(|| {
1955 fidl::new_empty!(
1956 fidl::encoding::Endpoint<
1957 fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
1958 >,
1959 fidl::encoding::DefaultFuchsiaResourceDialect
1960 )
1961 });
1962 fidl::decode!(
1963 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>,
1964 fidl::encoding::DefaultFuchsiaResourceDialect,
1965 val_ref,
1966 decoder,
1967 inner_offset,
1968 inner_depth
1969 )?;
1970 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1971 {
1972 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1973 }
1974 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1975 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1976 }
1977 }
1978
1979 next_offset += envelope_size;
1980
1981 while next_offset < end_offset {
1983 _next_ordinal_to_read += 1;
1984 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1985 next_offset += envelope_size;
1986 }
1987
1988 Ok(())
1989 }
1990 }
1991
1992 impl CollectorListStoredSnapshotsRequest {
1993 #[inline(always)]
1994 fn max_ordinal_present(&self) -> u64 {
1995 if let Some(_) = self.process_selector {
1996 return 2;
1997 }
1998 if let Some(_) = self.iterator {
1999 return 1;
2000 }
2001 0
2002 }
2003 }
2004
2005 impl fidl::encoding::ResourceTypeMarker for CollectorListStoredSnapshotsRequest {
2006 type Borrowed<'a> = &'a mut Self;
2007 fn take_or_borrow<'a>(
2008 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2009 ) -> Self::Borrowed<'a> {
2010 value
2011 }
2012 }
2013
2014 unsafe impl fidl::encoding::TypeMarker for CollectorListStoredSnapshotsRequest {
2015 type Owned = Self;
2016
2017 #[inline(always)]
2018 fn inline_align(_context: fidl::encoding::Context) -> usize {
2019 8
2020 }
2021
2022 #[inline(always)]
2023 fn inline_size(_context: fidl::encoding::Context) -> usize {
2024 16
2025 }
2026 }
2027
2028 unsafe impl
2029 fidl::encoding::Encode<
2030 CollectorListStoredSnapshotsRequest,
2031 fidl::encoding::DefaultFuchsiaResourceDialect,
2032 > for &mut CollectorListStoredSnapshotsRequest
2033 {
2034 unsafe fn encode(
2035 self,
2036 encoder: &mut fidl::encoding::Encoder<
2037 '_,
2038 fidl::encoding::DefaultFuchsiaResourceDialect,
2039 >,
2040 offset: usize,
2041 mut depth: fidl::encoding::Depth,
2042 ) -> fidl::Result<()> {
2043 encoder.debug_check_bounds::<CollectorListStoredSnapshotsRequest>(offset);
2044 let max_ordinal: u64 = self.max_ordinal_present();
2046 encoder.write_num(max_ordinal, offset);
2047 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2048 if max_ordinal == 0 {
2050 return Ok(());
2051 }
2052 depth.increment()?;
2053 let envelope_size = 8;
2054 let bytes_len = max_ordinal as usize * envelope_size;
2055 #[allow(unused_variables)]
2056 let offset = encoder.out_of_line_offset(bytes_len);
2057 let mut _prev_end_offset: usize = 0;
2058 if 1 > max_ordinal {
2059 return Ok(());
2060 }
2061
2062 let cur_offset: usize = (1 - 1) * envelope_size;
2065
2066 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2068
2069 fidl::encoding::encode_in_envelope_optional::<
2074 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>>,
2075 fidl::encoding::DefaultFuchsiaResourceDialect,
2076 >(
2077 self.iterator.as_mut().map(
2078 <fidl::encoding::Endpoint<
2079 fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>,
2080 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2081 ),
2082 encoder,
2083 offset + cur_offset,
2084 depth,
2085 )?;
2086
2087 _prev_end_offset = cur_offset + envelope_size;
2088 if 2 > max_ordinal {
2089 return Ok(());
2090 }
2091
2092 let cur_offset: usize = (2 - 1) * envelope_size;
2095
2096 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2098
2099 fidl::encoding::encode_in_envelope_optional::<
2104 ProcessSelector,
2105 fidl::encoding::DefaultFuchsiaResourceDialect,
2106 >(
2107 self.process_selector
2108 .as_ref()
2109 .map(<ProcessSelector as fidl::encoding::ValueTypeMarker>::borrow),
2110 encoder,
2111 offset + cur_offset,
2112 depth,
2113 )?;
2114
2115 _prev_end_offset = cur_offset + envelope_size;
2116
2117 Ok(())
2118 }
2119 }
2120
2121 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2122 for CollectorListStoredSnapshotsRequest
2123 {
2124 #[inline(always)]
2125 fn new_empty() -> Self {
2126 Self::default()
2127 }
2128
2129 unsafe fn decode(
2130 &mut self,
2131 decoder: &mut fidl::encoding::Decoder<
2132 '_,
2133 fidl::encoding::DefaultFuchsiaResourceDialect,
2134 >,
2135 offset: usize,
2136 mut depth: fidl::encoding::Depth,
2137 ) -> fidl::Result<()> {
2138 decoder.debug_check_bounds::<Self>(offset);
2139 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2140 None => return Err(fidl::Error::NotNullable),
2141 Some(len) => len,
2142 };
2143 if len == 0 {
2145 return Ok(());
2146 };
2147 depth.increment()?;
2148 let envelope_size = 8;
2149 let bytes_len = len * envelope_size;
2150 let offset = decoder.out_of_line_offset(bytes_len)?;
2151 let mut _next_ordinal_to_read = 0;
2153 let mut next_offset = offset;
2154 let end_offset = offset + bytes_len;
2155 _next_ordinal_to_read += 1;
2156 if next_offset >= end_offset {
2157 return Ok(());
2158 }
2159
2160 while _next_ordinal_to_read < 1 {
2162 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2163 _next_ordinal_to_read += 1;
2164 next_offset += envelope_size;
2165 }
2166
2167 let next_out_of_line = decoder.next_out_of_line();
2168 let handles_before = decoder.remaining_handles();
2169 if let Some((inlined, num_bytes, num_handles)) =
2170 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2171 {
2172 let member_inline_size = <fidl::encoding::Endpoint<
2173 fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>,
2174 > as fidl::encoding::TypeMarker>::inline_size(
2175 decoder.context
2176 );
2177 if inlined != (member_inline_size <= 4) {
2178 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2179 }
2180 let inner_offset;
2181 let mut inner_depth = depth.clone();
2182 if inlined {
2183 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2184 inner_offset = next_offset;
2185 } else {
2186 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2187 inner_depth.increment()?;
2188 }
2189 let val_ref = self.iterator.get_or_insert_with(|| {
2190 fidl::new_empty!(
2191 fidl::encoding::Endpoint<
2192 fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>,
2193 >,
2194 fidl::encoding::DefaultFuchsiaResourceDialect
2195 )
2196 });
2197 fidl::decode!(
2198 fidl::encoding::Endpoint<
2199 fidl::endpoints::ServerEnd<StoredSnapshotIteratorMarker>,
2200 >,
2201 fidl::encoding::DefaultFuchsiaResourceDialect,
2202 val_ref,
2203 decoder,
2204 inner_offset,
2205 inner_depth
2206 )?;
2207 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2208 {
2209 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2210 }
2211 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2212 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2213 }
2214 }
2215
2216 next_offset += envelope_size;
2217 _next_ordinal_to_read += 1;
2218 if next_offset >= end_offset {
2219 return Ok(());
2220 }
2221
2222 while _next_ordinal_to_read < 2 {
2224 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2225 _next_ordinal_to_read += 1;
2226 next_offset += envelope_size;
2227 }
2228
2229 let next_out_of_line = decoder.next_out_of_line();
2230 let handles_before = decoder.remaining_handles();
2231 if let Some((inlined, num_bytes, num_handles)) =
2232 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2233 {
2234 let member_inline_size =
2235 <ProcessSelector as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2236 if inlined != (member_inline_size <= 4) {
2237 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2238 }
2239 let inner_offset;
2240 let mut inner_depth = depth.clone();
2241 if inlined {
2242 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2243 inner_offset = next_offset;
2244 } else {
2245 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2246 inner_depth.increment()?;
2247 }
2248 let val_ref = self.process_selector.get_or_insert_with(|| {
2249 fidl::new_empty!(ProcessSelector, fidl::encoding::DefaultFuchsiaResourceDialect)
2250 });
2251 fidl::decode!(
2252 ProcessSelector,
2253 fidl::encoding::DefaultFuchsiaResourceDialect,
2254 val_ref,
2255 decoder,
2256 inner_offset,
2257 inner_depth
2258 )?;
2259 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2260 {
2261 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2262 }
2263 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2264 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2265 }
2266 }
2267
2268 next_offset += envelope_size;
2269
2270 while next_offset < end_offset {
2272 _next_ordinal_to_read += 1;
2273 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2274 next_offset += envelope_size;
2275 }
2276
2277 Ok(())
2278 }
2279 }
2280
2281 impl CollectorTakeLiveSnapshotRequest {
2282 #[inline(always)]
2283 fn max_ordinal_present(&self) -> u64 {
2284 if let Some(_) = self.multi_process {
2285 return 4;
2286 }
2287 if let Some(_) = self.with_contents {
2288 return 3;
2289 }
2290 if let Some(_) = self.receiver {
2291 return 2;
2292 }
2293 if let Some(_) = self.process_selector {
2294 return 1;
2295 }
2296 0
2297 }
2298 }
2299
2300 impl fidl::encoding::ResourceTypeMarker for CollectorTakeLiveSnapshotRequest {
2301 type Borrowed<'a> = &'a mut Self;
2302 fn take_or_borrow<'a>(
2303 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2304 ) -> Self::Borrowed<'a> {
2305 value
2306 }
2307 }
2308
2309 unsafe impl fidl::encoding::TypeMarker for CollectorTakeLiveSnapshotRequest {
2310 type Owned = Self;
2311
2312 #[inline(always)]
2313 fn inline_align(_context: fidl::encoding::Context) -> usize {
2314 8
2315 }
2316
2317 #[inline(always)]
2318 fn inline_size(_context: fidl::encoding::Context) -> usize {
2319 16
2320 }
2321 }
2322
2323 unsafe impl
2324 fidl::encoding::Encode<
2325 CollectorTakeLiveSnapshotRequest,
2326 fidl::encoding::DefaultFuchsiaResourceDialect,
2327 > for &mut CollectorTakeLiveSnapshotRequest
2328 {
2329 unsafe fn encode(
2330 self,
2331 encoder: &mut fidl::encoding::Encoder<
2332 '_,
2333 fidl::encoding::DefaultFuchsiaResourceDialect,
2334 >,
2335 offset: usize,
2336 mut depth: fidl::encoding::Depth,
2337 ) -> fidl::Result<()> {
2338 encoder.debug_check_bounds::<CollectorTakeLiveSnapshotRequest>(offset);
2339 let max_ordinal: u64 = self.max_ordinal_present();
2341 encoder.write_num(max_ordinal, offset);
2342 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2343 if max_ordinal == 0 {
2345 return Ok(());
2346 }
2347 depth.increment()?;
2348 let envelope_size = 8;
2349 let bytes_len = max_ordinal as usize * envelope_size;
2350 #[allow(unused_variables)]
2351 let offset = encoder.out_of_line_offset(bytes_len);
2352 let mut _prev_end_offset: usize = 0;
2353 if 1 > max_ordinal {
2354 return Ok(());
2355 }
2356
2357 let cur_offset: usize = (1 - 1) * envelope_size;
2360
2361 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2363
2364 fidl::encoding::encode_in_envelope_optional::<
2369 ProcessSelector,
2370 fidl::encoding::DefaultFuchsiaResourceDialect,
2371 >(
2372 self.process_selector
2373 .as_ref()
2374 .map(<ProcessSelector as fidl::encoding::ValueTypeMarker>::borrow),
2375 encoder,
2376 offset + cur_offset,
2377 depth,
2378 )?;
2379
2380 _prev_end_offset = cur_offset + envelope_size;
2381 if 2 > max_ordinal {
2382 return Ok(());
2383 }
2384
2385 let cur_offset: usize = (2 - 1) * envelope_size;
2388
2389 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2391
2392 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2397 self.receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2398 encoder, offset + cur_offset, depth
2399 )?;
2400
2401 _prev_end_offset = cur_offset + envelope_size;
2402 if 3 > max_ordinal {
2403 return Ok(());
2404 }
2405
2406 let cur_offset: usize = (3 - 1) * envelope_size;
2409
2410 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2412
2413 fidl::encoding::encode_in_envelope_optional::<
2418 bool,
2419 fidl::encoding::DefaultFuchsiaResourceDialect,
2420 >(
2421 self.with_contents.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2422 encoder,
2423 offset + cur_offset,
2424 depth,
2425 )?;
2426
2427 _prev_end_offset = cur_offset + envelope_size;
2428 if 4 > max_ordinal {
2429 return Ok(());
2430 }
2431
2432 let cur_offset: usize = (4 - 1) * envelope_size;
2435
2436 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2438
2439 fidl::encoding::encode_in_envelope_optional::<
2444 bool,
2445 fidl::encoding::DefaultFuchsiaResourceDialect,
2446 >(
2447 self.multi_process.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2448 encoder,
2449 offset + cur_offset,
2450 depth,
2451 )?;
2452
2453 _prev_end_offset = cur_offset + envelope_size;
2454
2455 Ok(())
2456 }
2457 }
2458
2459 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2460 for CollectorTakeLiveSnapshotRequest
2461 {
2462 #[inline(always)]
2463 fn new_empty() -> Self {
2464 Self::default()
2465 }
2466
2467 unsafe fn decode(
2468 &mut self,
2469 decoder: &mut fidl::encoding::Decoder<
2470 '_,
2471 fidl::encoding::DefaultFuchsiaResourceDialect,
2472 >,
2473 offset: usize,
2474 mut depth: fidl::encoding::Depth,
2475 ) -> fidl::Result<()> {
2476 decoder.debug_check_bounds::<Self>(offset);
2477 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2478 None => return Err(fidl::Error::NotNullable),
2479 Some(len) => len,
2480 };
2481 if len == 0 {
2483 return Ok(());
2484 };
2485 depth.increment()?;
2486 let envelope_size = 8;
2487 let bytes_len = len * envelope_size;
2488 let offset = decoder.out_of_line_offset(bytes_len)?;
2489 let mut _next_ordinal_to_read = 0;
2491 let mut next_offset = offset;
2492 let end_offset = offset + bytes_len;
2493 _next_ordinal_to_read += 1;
2494 if next_offset >= end_offset {
2495 return Ok(());
2496 }
2497
2498 while _next_ordinal_to_read < 1 {
2500 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2501 _next_ordinal_to_read += 1;
2502 next_offset += envelope_size;
2503 }
2504
2505 let next_out_of_line = decoder.next_out_of_line();
2506 let handles_before = decoder.remaining_handles();
2507 if let Some((inlined, num_bytes, num_handles)) =
2508 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2509 {
2510 let member_inline_size =
2511 <ProcessSelector as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2512 if inlined != (member_inline_size <= 4) {
2513 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2514 }
2515 let inner_offset;
2516 let mut inner_depth = depth.clone();
2517 if inlined {
2518 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2519 inner_offset = next_offset;
2520 } else {
2521 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2522 inner_depth.increment()?;
2523 }
2524 let val_ref = self.process_selector.get_or_insert_with(|| {
2525 fidl::new_empty!(ProcessSelector, fidl::encoding::DefaultFuchsiaResourceDialect)
2526 });
2527 fidl::decode!(
2528 ProcessSelector,
2529 fidl::encoding::DefaultFuchsiaResourceDialect,
2530 val_ref,
2531 decoder,
2532 inner_offset,
2533 inner_depth
2534 )?;
2535 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2536 {
2537 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2538 }
2539 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2540 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2541 }
2542 }
2543
2544 next_offset += envelope_size;
2545 _next_ordinal_to_read += 1;
2546 if next_offset >= end_offset {
2547 return Ok(());
2548 }
2549
2550 while _next_ordinal_to_read < 2 {
2552 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2553 _next_ordinal_to_read += 1;
2554 next_offset += envelope_size;
2555 }
2556
2557 let next_out_of_line = decoder.next_out_of_line();
2558 let handles_before = decoder.remaining_handles();
2559 if let Some((inlined, num_bytes, num_handles)) =
2560 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2561 {
2562 let member_inline_size = <fidl::encoding::Endpoint<
2563 fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
2564 > as fidl::encoding::TypeMarker>::inline_size(
2565 decoder.context
2566 );
2567 if inlined != (member_inline_size <= 4) {
2568 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2569 }
2570 let inner_offset;
2571 let mut inner_depth = depth.clone();
2572 if inlined {
2573 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2574 inner_offset = next_offset;
2575 } else {
2576 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2577 inner_depth.increment()?;
2578 }
2579 let val_ref = self.receiver.get_or_insert_with(|| {
2580 fidl::new_empty!(
2581 fidl::encoding::Endpoint<
2582 fidl::endpoints::ClientEnd<SnapshotReceiverMarker>,
2583 >,
2584 fidl::encoding::DefaultFuchsiaResourceDialect
2585 )
2586 });
2587 fidl::decode!(
2588 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnapshotReceiverMarker>>,
2589 fidl::encoding::DefaultFuchsiaResourceDialect,
2590 val_ref,
2591 decoder,
2592 inner_offset,
2593 inner_depth
2594 )?;
2595 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2596 {
2597 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2598 }
2599 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2600 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2601 }
2602 }
2603
2604 next_offset += envelope_size;
2605 _next_ordinal_to_read += 1;
2606 if next_offset >= end_offset {
2607 return Ok(());
2608 }
2609
2610 while _next_ordinal_to_read < 3 {
2612 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2613 _next_ordinal_to_read += 1;
2614 next_offset += envelope_size;
2615 }
2616
2617 let next_out_of_line = decoder.next_out_of_line();
2618 let handles_before = decoder.remaining_handles();
2619 if let Some((inlined, num_bytes, num_handles)) =
2620 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2621 {
2622 let member_inline_size =
2623 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2624 if inlined != (member_inline_size <= 4) {
2625 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2626 }
2627 let inner_offset;
2628 let mut inner_depth = depth.clone();
2629 if inlined {
2630 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2631 inner_offset = next_offset;
2632 } else {
2633 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2634 inner_depth.increment()?;
2635 }
2636 let val_ref = self.with_contents.get_or_insert_with(|| {
2637 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2638 });
2639 fidl::decode!(
2640 bool,
2641 fidl::encoding::DefaultFuchsiaResourceDialect,
2642 val_ref,
2643 decoder,
2644 inner_offset,
2645 inner_depth
2646 )?;
2647 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2648 {
2649 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2650 }
2651 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2652 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2653 }
2654 }
2655
2656 next_offset += envelope_size;
2657 _next_ordinal_to_read += 1;
2658 if next_offset >= end_offset {
2659 return Ok(());
2660 }
2661
2662 while _next_ordinal_to_read < 4 {
2664 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2665 _next_ordinal_to_read += 1;
2666 next_offset += envelope_size;
2667 }
2668
2669 let next_out_of_line = decoder.next_out_of_line();
2670 let handles_before = decoder.remaining_handles();
2671 if let Some((inlined, num_bytes, num_handles)) =
2672 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2673 {
2674 let member_inline_size =
2675 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2676 if inlined != (member_inline_size <= 4) {
2677 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2678 }
2679 let inner_offset;
2680 let mut inner_depth = depth.clone();
2681 if inlined {
2682 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2683 inner_offset = next_offset;
2684 } else {
2685 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2686 inner_depth.increment()?;
2687 }
2688 let val_ref = self.multi_process.get_or_insert_with(|| {
2689 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2690 });
2691 fidl::decode!(
2692 bool,
2693 fidl::encoding::DefaultFuchsiaResourceDialect,
2694 val_ref,
2695 decoder,
2696 inner_offset,
2697 inner_depth
2698 )?;
2699 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2700 {
2701 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2702 }
2703 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2704 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2705 }
2706 }
2707
2708 next_offset += envelope_size;
2709
2710 while next_offset < end_offset {
2712 _next_ordinal_to_read += 1;
2713 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2714 next_offset += envelope_size;
2715 }
2716
2717 Ok(())
2718 }
2719 }
2720}