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