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_process_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct RegistryRegisterV1Request {
16 pub process: fidl::Process,
17 pub allocations_vmo: fidl::Vmo,
18 pub resources_vmo: fidl::Vmo,
19 pub snapshot_sink: fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RegistryRegisterV1Request {}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct SnapshotSinkV1StoreNamedSnapshotRequest {
26 pub snapshot_name: String,
27 pub allocations_vmo_snapshot: fidl::Vmo,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for SnapshotSinkV1StoreNamedSnapshotRequest
32{
33}
34
35#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
36pub struct RegistryMarker;
37
38impl fidl::endpoints::ProtocolMarker for RegistryMarker {
39 type Proxy = RegistryProxy;
40 type RequestStream = RegistryRequestStream;
41 #[cfg(target_os = "fuchsia")]
42 type SynchronousProxy = RegistrySynchronousProxy;
43
44 const DEBUG_NAME: &'static str = "fuchsia.memory.heapdump.process.Registry";
45}
46impl fidl::endpoints::DiscoverableProtocolMarker for RegistryMarker {}
47
48pub trait RegistryProxyInterface: Send + Sync {
49 fn r#register_v1(
50 &self,
51 process: fidl::Process,
52 allocations_vmo: fidl::Vmo,
53 resources_vmo: fidl::Vmo,
54 snapshot_sink: fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>,
55 ) -> Result<(), fidl::Error>;
56}
57#[derive(Debug)]
58#[cfg(target_os = "fuchsia")]
59pub struct RegistrySynchronousProxy {
60 client: fidl::client::sync::Client,
61}
62
63#[cfg(target_os = "fuchsia")]
64impl fidl::endpoints::SynchronousProxy for RegistrySynchronousProxy {
65 type Proxy = RegistryProxy;
66 type Protocol = RegistryMarker;
67
68 fn from_channel(inner: fidl::Channel) -> Self {
69 Self::new(inner)
70 }
71
72 fn into_channel(self) -> fidl::Channel {
73 self.client.into_channel()
74 }
75
76 fn as_channel(&self) -> &fidl::Channel {
77 self.client.as_channel()
78 }
79}
80
81#[cfg(target_os = "fuchsia")]
82impl RegistrySynchronousProxy {
83 pub fn new(channel: fidl::Channel) -> Self {
84 let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
85 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
86 }
87
88 pub fn into_channel(self) -> fidl::Channel {
89 self.client.into_channel()
90 }
91
92 pub fn wait_for_event(
95 &self,
96 deadline: zx::MonotonicInstant,
97 ) -> Result<RegistryEvent, fidl::Error> {
98 RegistryEvent::decode(self.client.wait_for_event(deadline)?)
99 }
100
101 pub fn r#register_v1(
103 &self,
104 mut process: fidl::Process,
105 mut allocations_vmo: fidl::Vmo,
106 mut resources_vmo: fidl::Vmo,
107 mut snapshot_sink: fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>,
108 ) -> Result<(), fidl::Error> {
109 self.client.send::<RegistryRegisterV1Request>(
110 (process, allocations_vmo, resources_vmo, snapshot_sink),
111 0x68626342c5d1afce,
112 fidl::encoding::DynamicFlags::empty(),
113 )
114 }
115}
116
117#[cfg(target_os = "fuchsia")]
118impl From<RegistrySynchronousProxy> for zx::Handle {
119 fn from(value: RegistrySynchronousProxy) -> Self {
120 value.into_channel().into()
121 }
122}
123
124#[cfg(target_os = "fuchsia")]
125impl From<fidl::Channel> for RegistrySynchronousProxy {
126 fn from(value: fidl::Channel) -> Self {
127 Self::new(value)
128 }
129}
130
131#[derive(Debug, Clone)]
132pub struct RegistryProxy {
133 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
134}
135
136impl fidl::endpoints::Proxy for RegistryProxy {
137 type Protocol = RegistryMarker;
138
139 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
140 Self::new(inner)
141 }
142
143 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
144 self.client.into_channel().map_err(|client| Self { client })
145 }
146
147 fn as_channel(&self) -> &::fidl::AsyncChannel {
148 self.client.as_channel()
149 }
150}
151
152impl RegistryProxy {
153 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
155 let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156 Self { client: fidl::client::Client::new(channel, protocol_name) }
157 }
158
159 pub fn take_event_stream(&self) -> RegistryEventStream {
165 RegistryEventStream { event_receiver: self.client.take_event_receiver() }
166 }
167
168 pub fn r#register_v1(
170 &self,
171 mut process: fidl::Process,
172 mut allocations_vmo: fidl::Vmo,
173 mut resources_vmo: fidl::Vmo,
174 mut snapshot_sink: fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>,
175 ) -> Result<(), fidl::Error> {
176 RegistryProxyInterface::r#register_v1(
177 self,
178 process,
179 allocations_vmo,
180 resources_vmo,
181 snapshot_sink,
182 )
183 }
184}
185
186impl RegistryProxyInterface for RegistryProxy {
187 fn r#register_v1(
188 &self,
189 mut process: fidl::Process,
190 mut allocations_vmo: fidl::Vmo,
191 mut resources_vmo: fidl::Vmo,
192 mut snapshot_sink: fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>,
193 ) -> Result<(), fidl::Error> {
194 self.client.send::<RegistryRegisterV1Request>(
195 (process, allocations_vmo, resources_vmo, snapshot_sink),
196 0x68626342c5d1afce,
197 fidl::encoding::DynamicFlags::empty(),
198 )
199 }
200}
201
202pub struct RegistryEventStream {
203 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
204}
205
206impl std::marker::Unpin for RegistryEventStream {}
207
208impl futures::stream::FusedStream for RegistryEventStream {
209 fn is_terminated(&self) -> bool {
210 self.event_receiver.is_terminated()
211 }
212}
213
214impl futures::Stream for RegistryEventStream {
215 type Item = Result<RegistryEvent, fidl::Error>;
216
217 fn poll_next(
218 mut self: std::pin::Pin<&mut Self>,
219 cx: &mut std::task::Context<'_>,
220 ) -> std::task::Poll<Option<Self::Item>> {
221 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
222 &mut self.event_receiver,
223 cx
224 )?) {
225 Some(buf) => std::task::Poll::Ready(Some(RegistryEvent::decode(buf))),
226 None => std::task::Poll::Ready(None),
227 }
228 }
229}
230
231#[derive(Debug)]
232pub enum RegistryEvent {}
233
234impl RegistryEvent {
235 fn decode(
237 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
238 ) -> Result<RegistryEvent, fidl::Error> {
239 let (bytes, _handles) = buf.split_mut();
240 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
241 debug_assert_eq!(tx_header.tx_id, 0);
242 match tx_header.ordinal {
243 _ => Err(fidl::Error::UnknownOrdinal {
244 ordinal: tx_header.ordinal,
245 protocol_name: <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
246 }),
247 }
248 }
249}
250
251pub struct RegistryRequestStream {
253 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
254 is_terminated: bool,
255}
256
257impl std::marker::Unpin for RegistryRequestStream {}
258
259impl futures::stream::FusedStream for RegistryRequestStream {
260 fn is_terminated(&self) -> bool {
261 self.is_terminated
262 }
263}
264
265impl fidl::endpoints::RequestStream for RegistryRequestStream {
266 type Protocol = RegistryMarker;
267 type ControlHandle = RegistryControlHandle;
268
269 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
270 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
271 }
272
273 fn control_handle(&self) -> Self::ControlHandle {
274 RegistryControlHandle { inner: self.inner.clone() }
275 }
276
277 fn into_inner(
278 self,
279 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
280 {
281 (self.inner, self.is_terminated)
282 }
283
284 fn from_inner(
285 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
286 is_terminated: bool,
287 ) -> Self {
288 Self { inner, is_terminated }
289 }
290}
291
292impl futures::Stream for RegistryRequestStream {
293 type Item = Result<RegistryRequest, fidl::Error>;
294
295 fn poll_next(
296 mut self: std::pin::Pin<&mut Self>,
297 cx: &mut std::task::Context<'_>,
298 ) -> std::task::Poll<Option<Self::Item>> {
299 let this = &mut *self;
300 if this.inner.check_shutdown(cx) {
301 this.is_terminated = true;
302 return std::task::Poll::Ready(None);
303 }
304 if this.is_terminated {
305 panic!("polled RegistryRequestStream after completion");
306 }
307 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
308 |bytes, handles| {
309 match this.inner.channel().read_etc(cx, bytes, handles) {
310 std::task::Poll::Ready(Ok(())) => {}
311 std::task::Poll::Pending => return std::task::Poll::Pending,
312 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
313 this.is_terminated = true;
314 return std::task::Poll::Ready(None);
315 }
316 std::task::Poll::Ready(Err(e)) => {
317 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
318 e.into(),
319 ))))
320 }
321 }
322
323 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
325
326 std::task::Poll::Ready(Some(match header.ordinal {
327 0x68626342c5d1afce => {
328 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
329 let mut req = fidl::new_empty!(
330 RegistryRegisterV1Request,
331 fidl::encoding::DefaultFuchsiaResourceDialect
332 );
333 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterV1Request>(&header, _body_bytes, handles, &mut req)?;
334 let control_handle = RegistryControlHandle { inner: this.inner.clone() };
335 Ok(RegistryRequest::RegisterV1 {
336 process: req.process,
337 allocations_vmo: req.allocations_vmo,
338 resources_vmo: req.resources_vmo,
339 snapshot_sink: req.snapshot_sink,
340
341 control_handle,
342 })
343 }
344 _ => Err(fidl::Error::UnknownOrdinal {
345 ordinal: header.ordinal,
346 protocol_name:
347 <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
348 }),
349 }))
350 },
351 )
352 }
353}
354
355#[derive(Debug)]
357pub enum RegistryRequest {
358 RegisterV1 {
360 process: fidl::Process,
361 allocations_vmo: fidl::Vmo,
362 resources_vmo: fidl::Vmo,
363 snapshot_sink: fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>,
364 control_handle: RegistryControlHandle,
365 },
366}
367
368impl RegistryRequest {
369 #[allow(irrefutable_let_patterns)]
370 pub fn into_register_v1(
371 self,
372 ) -> Option<(
373 fidl::Process,
374 fidl::Vmo,
375 fidl::Vmo,
376 fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>,
377 RegistryControlHandle,
378 )> {
379 if let RegistryRequest::RegisterV1 {
380 process,
381 allocations_vmo,
382 resources_vmo,
383 snapshot_sink,
384 control_handle,
385 } = self
386 {
387 Some((process, allocations_vmo, resources_vmo, snapshot_sink, control_handle))
388 } else {
389 None
390 }
391 }
392
393 pub fn method_name(&self) -> &'static str {
395 match *self {
396 RegistryRequest::RegisterV1 { .. } => "register_v1",
397 }
398 }
399}
400
401#[derive(Debug, Clone)]
402pub struct RegistryControlHandle {
403 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
404}
405
406impl fidl::endpoints::ControlHandle for RegistryControlHandle {
407 fn shutdown(&self) {
408 self.inner.shutdown()
409 }
410 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
411 self.inner.shutdown_with_epitaph(status)
412 }
413
414 fn is_closed(&self) -> bool {
415 self.inner.channel().is_closed()
416 }
417 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
418 self.inner.channel().on_closed()
419 }
420
421 #[cfg(target_os = "fuchsia")]
422 fn signal_peer(
423 &self,
424 clear_mask: zx::Signals,
425 set_mask: zx::Signals,
426 ) -> Result<(), zx_status::Status> {
427 use fidl::Peered;
428 self.inner.channel().signal_peer(clear_mask, set_mask)
429 }
430}
431
432impl RegistryControlHandle {}
433
434#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
435pub struct SnapshotSinkV1Marker;
436
437impl fidl::endpoints::ProtocolMarker for SnapshotSinkV1Marker {
438 type Proxy = SnapshotSinkV1Proxy;
439 type RequestStream = SnapshotSinkV1RequestStream;
440 #[cfg(target_os = "fuchsia")]
441 type SynchronousProxy = SnapshotSinkV1SynchronousProxy;
442
443 const DEBUG_NAME: &'static str = "(anonymous) SnapshotSinkV1";
444}
445
446pub trait SnapshotSinkV1ProxyInterface: Send + Sync {
447 fn r#store_named_snapshot(
448 &self,
449 snapshot_name: &str,
450 allocations_vmo_snapshot: fidl::Vmo,
451 ) -> Result<(), fidl::Error>;
452}
453#[derive(Debug)]
454#[cfg(target_os = "fuchsia")]
455pub struct SnapshotSinkV1SynchronousProxy {
456 client: fidl::client::sync::Client,
457}
458
459#[cfg(target_os = "fuchsia")]
460impl fidl::endpoints::SynchronousProxy for SnapshotSinkV1SynchronousProxy {
461 type Proxy = SnapshotSinkV1Proxy;
462 type Protocol = SnapshotSinkV1Marker;
463
464 fn from_channel(inner: fidl::Channel) -> Self {
465 Self::new(inner)
466 }
467
468 fn into_channel(self) -> fidl::Channel {
469 self.client.into_channel()
470 }
471
472 fn as_channel(&self) -> &fidl::Channel {
473 self.client.as_channel()
474 }
475}
476
477#[cfg(target_os = "fuchsia")]
478impl SnapshotSinkV1SynchronousProxy {
479 pub fn new(channel: fidl::Channel) -> Self {
480 let protocol_name = <SnapshotSinkV1Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
481 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
482 }
483
484 pub fn into_channel(self) -> fidl::Channel {
485 self.client.into_channel()
486 }
487
488 pub fn wait_for_event(
491 &self,
492 deadline: zx::MonotonicInstant,
493 ) -> Result<SnapshotSinkV1Event, fidl::Error> {
494 SnapshotSinkV1Event::decode(self.client.wait_for_event(deadline)?)
495 }
496
497 pub fn r#store_named_snapshot(
502 &self,
503 mut snapshot_name: &str,
504 mut allocations_vmo_snapshot: fidl::Vmo,
505 ) -> Result<(), fidl::Error> {
506 self.client.send::<SnapshotSinkV1StoreNamedSnapshotRequest>(
507 (snapshot_name, allocations_vmo_snapshot),
508 0x356eaec66aabbea5,
509 fidl::encoding::DynamicFlags::empty(),
510 )
511 }
512}
513
514#[cfg(target_os = "fuchsia")]
515impl From<SnapshotSinkV1SynchronousProxy> for zx::Handle {
516 fn from(value: SnapshotSinkV1SynchronousProxy) -> Self {
517 value.into_channel().into()
518 }
519}
520
521#[cfg(target_os = "fuchsia")]
522impl From<fidl::Channel> for SnapshotSinkV1SynchronousProxy {
523 fn from(value: fidl::Channel) -> Self {
524 Self::new(value)
525 }
526}
527
528#[derive(Debug, Clone)]
529pub struct SnapshotSinkV1Proxy {
530 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
531}
532
533impl fidl::endpoints::Proxy for SnapshotSinkV1Proxy {
534 type Protocol = SnapshotSinkV1Marker;
535
536 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
537 Self::new(inner)
538 }
539
540 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
541 self.client.into_channel().map_err(|client| Self { client })
542 }
543
544 fn as_channel(&self) -> &::fidl::AsyncChannel {
545 self.client.as_channel()
546 }
547}
548
549impl SnapshotSinkV1Proxy {
550 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
552 let protocol_name = <SnapshotSinkV1Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
553 Self { client: fidl::client::Client::new(channel, protocol_name) }
554 }
555
556 pub fn take_event_stream(&self) -> SnapshotSinkV1EventStream {
562 SnapshotSinkV1EventStream { event_receiver: self.client.take_event_receiver() }
563 }
564
565 pub fn r#store_named_snapshot(
570 &self,
571 mut snapshot_name: &str,
572 mut allocations_vmo_snapshot: fidl::Vmo,
573 ) -> Result<(), fidl::Error> {
574 SnapshotSinkV1ProxyInterface::r#store_named_snapshot(
575 self,
576 snapshot_name,
577 allocations_vmo_snapshot,
578 )
579 }
580}
581
582impl SnapshotSinkV1ProxyInterface for SnapshotSinkV1Proxy {
583 fn r#store_named_snapshot(
584 &self,
585 mut snapshot_name: &str,
586 mut allocations_vmo_snapshot: fidl::Vmo,
587 ) -> Result<(), fidl::Error> {
588 self.client.send::<SnapshotSinkV1StoreNamedSnapshotRequest>(
589 (snapshot_name, allocations_vmo_snapshot),
590 0x356eaec66aabbea5,
591 fidl::encoding::DynamicFlags::empty(),
592 )
593 }
594}
595
596pub struct SnapshotSinkV1EventStream {
597 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
598}
599
600impl std::marker::Unpin for SnapshotSinkV1EventStream {}
601
602impl futures::stream::FusedStream for SnapshotSinkV1EventStream {
603 fn is_terminated(&self) -> bool {
604 self.event_receiver.is_terminated()
605 }
606}
607
608impl futures::Stream for SnapshotSinkV1EventStream {
609 type Item = Result<SnapshotSinkV1Event, fidl::Error>;
610
611 fn poll_next(
612 mut self: std::pin::Pin<&mut Self>,
613 cx: &mut std::task::Context<'_>,
614 ) -> std::task::Poll<Option<Self::Item>> {
615 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
616 &mut self.event_receiver,
617 cx
618 )?) {
619 Some(buf) => std::task::Poll::Ready(Some(SnapshotSinkV1Event::decode(buf))),
620 None => std::task::Poll::Ready(None),
621 }
622 }
623}
624
625#[derive(Debug)]
626pub enum SnapshotSinkV1Event {}
627
628impl SnapshotSinkV1Event {
629 fn decode(
631 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
632 ) -> Result<SnapshotSinkV1Event, fidl::Error> {
633 let (bytes, _handles) = buf.split_mut();
634 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
635 debug_assert_eq!(tx_header.tx_id, 0);
636 match tx_header.ordinal {
637 _ => Err(fidl::Error::UnknownOrdinal {
638 ordinal: tx_header.ordinal,
639 protocol_name:
640 <SnapshotSinkV1Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
641 }),
642 }
643 }
644}
645
646pub struct SnapshotSinkV1RequestStream {
648 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
649 is_terminated: bool,
650}
651
652impl std::marker::Unpin for SnapshotSinkV1RequestStream {}
653
654impl futures::stream::FusedStream for SnapshotSinkV1RequestStream {
655 fn is_terminated(&self) -> bool {
656 self.is_terminated
657 }
658}
659
660impl fidl::endpoints::RequestStream for SnapshotSinkV1RequestStream {
661 type Protocol = SnapshotSinkV1Marker;
662 type ControlHandle = SnapshotSinkV1ControlHandle;
663
664 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
665 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
666 }
667
668 fn control_handle(&self) -> Self::ControlHandle {
669 SnapshotSinkV1ControlHandle { inner: self.inner.clone() }
670 }
671
672 fn into_inner(
673 self,
674 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
675 {
676 (self.inner, self.is_terminated)
677 }
678
679 fn from_inner(
680 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
681 is_terminated: bool,
682 ) -> Self {
683 Self { inner, is_terminated }
684 }
685}
686
687impl futures::Stream for SnapshotSinkV1RequestStream {
688 type Item = Result<SnapshotSinkV1Request, fidl::Error>;
689
690 fn poll_next(
691 mut self: std::pin::Pin<&mut Self>,
692 cx: &mut std::task::Context<'_>,
693 ) -> std::task::Poll<Option<Self::Item>> {
694 let this = &mut *self;
695 if this.inner.check_shutdown(cx) {
696 this.is_terminated = true;
697 return std::task::Poll::Ready(None);
698 }
699 if this.is_terminated {
700 panic!("polled SnapshotSinkV1RequestStream after completion");
701 }
702 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
703 |bytes, handles| {
704 match this.inner.channel().read_etc(cx, bytes, handles) {
705 std::task::Poll::Ready(Ok(())) => {}
706 std::task::Poll::Pending => return std::task::Poll::Pending,
707 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
708 this.is_terminated = true;
709 return std::task::Poll::Ready(None);
710 }
711 std::task::Poll::Ready(Err(e)) => {
712 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
713 e.into(),
714 ))))
715 }
716 }
717
718 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
720
721 std::task::Poll::Ready(Some(match header.ordinal {
722 0x356eaec66aabbea5 => {
723 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
724 let mut req = fidl::new_empty!(
725 SnapshotSinkV1StoreNamedSnapshotRequest,
726 fidl::encoding::DefaultFuchsiaResourceDialect
727 );
728 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnapshotSinkV1StoreNamedSnapshotRequest>(&header, _body_bytes, handles, &mut req)?;
729 let control_handle =
730 SnapshotSinkV1ControlHandle { inner: this.inner.clone() };
731 Ok(SnapshotSinkV1Request::StoreNamedSnapshot {
732 snapshot_name: req.snapshot_name,
733 allocations_vmo_snapshot: req.allocations_vmo_snapshot,
734
735 control_handle,
736 })
737 }
738 _ => Err(fidl::Error::UnknownOrdinal {
739 ordinal: header.ordinal,
740 protocol_name:
741 <SnapshotSinkV1Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
742 }),
743 }))
744 },
745 )
746 }
747}
748
749#[derive(Debug)]
753pub enum SnapshotSinkV1Request {
754 StoreNamedSnapshot {
759 snapshot_name: String,
760 allocations_vmo_snapshot: fidl::Vmo,
761 control_handle: SnapshotSinkV1ControlHandle,
762 },
763}
764
765impl SnapshotSinkV1Request {
766 #[allow(irrefutable_let_patterns)]
767 pub fn into_store_named_snapshot(
768 self,
769 ) -> Option<(String, fidl::Vmo, SnapshotSinkV1ControlHandle)> {
770 if let SnapshotSinkV1Request::StoreNamedSnapshot {
771 snapshot_name,
772 allocations_vmo_snapshot,
773 control_handle,
774 } = self
775 {
776 Some((snapshot_name, allocations_vmo_snapshot, control_handle))
777 } else {
778 None
779 }
780 }
781
782 pub fn method_name(&self) -> &'static str {
784 match *self {
785 SnapshotSinkV1Request::StoreNamedSnapshot { .. } => "store_named_snapshot",
786 }
787 }
788}
789
790#[derive(Debug, Clone)]
791pub struct SnapshotSinkV1ControlHandle {
792 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
793}
794
795impl fidl::endpoints::ControlHandle for SnapshotSinkV1ControlHandle {
796 fn shutdown(&self) {
797 self.inner.shutdown()
798 }
799 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
800 self.inner.shutdown_with_epitaph(status)
801 }
802
803 fn is_closed(&self) -> bool {
804 self.inner.channel().is_closed()
805 }
806 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
807 self.inner.channel().on_closed()
808 }
809
810 #[cfg(target_os = "fuchsia")]
811 fn signal_peer(
812 &self,
813 clear_mask: zx::Signals,
814 set_mask: zx::Signals,
815 ) -> Result<(), zx_status::Status> {
816 use fidl::Peered;
817 self.inner.channel().signal_peer(clear_mask, set_mask)
818 }
819}
820
821impl SnapshotSinkV1ControlHandle {}
822
823mod internal {
824 use super::*;
825
826 impl fidl::encoding::ResourceTypeMarker for RegistryRegisterV1Request {
827 type Borrowed<'a> = &'a mut Self;
828 fn take_or_borrow<'a>(
829 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
830 ) -> Self::Borrowed<'a> {
831 value
832 }
833 }
834
835 unsafe impl fidl::encoding::TypeMarker for RegistryRegisterV1Request {
836 type Owned = Self;
837
838 #[inline(always)]
839 fn inline_align(_context: fidl::encoding::Context) -> usize {
840 4
841 }
842
843 #[inline(always)]
844 fn inline_size(_context: fidl::encoding::Context) -> usize {
845 16
846 }
847 }
848
849 unsafe impl
850 fidl::encoding::Encode<
851 RegistryRegisterV1Request,
852 fidl::encoding::DefaultFuchsiaResourceDialect,
853 > for &mut RegistryRegisterV1Request
854 {
855 #[inline]
856 unsafe fn encode(
857 self,
858 encoder: &mut fidl::encoding::Encoder<
859 '_,
860 fidl::encoding::DefaultFuchsiaResourceDialect,
861 >,
862 offset: usize,
863 _depth: fidl::encoding::Depth,
864 ) -> fidl::Result<()> {
865 encoder.debug_check_bounds::<RegistryRegisterV1Request>(offset);
866 fidl::encoding::Encode::<RegistryRegisterV1Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
868 (
869 <fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 49231> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.process),
870 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.allocations_vmo),
871 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.resources_vmo),
872 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.snapshot_sink),
873 ),
874 encoder, offset, _depth
875 )
876 }
877 }
878 unsafe impl<
879 T0: fidl::encoding::Encode<
880 fidl::encoding::HandleType<
881 fidl::Process,
882 { fidl::ObjectType::PROCESS.into_raw() },
883 49231,
884 >,
885 fidl::encoding::DefaultFuchsiaResourceDialect,
886 >,
887 T1: fidl::encoding::Encode<
888 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
889 fidl::encoding::DefaultFuchsiaResourceDialect,
890 >,
891 T2: fidl::encoding::Encode<
892 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
893 fidl::encoding::DefaultFuchsiaResourceDialect,
894 >,
895 T3: fidl::encoding::Encode<
896 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>>,
897 fidl::encoding::DefaultFuchsiaResourceDialect,
898 >,
899 >
900 fidl::encoding::Encode<
901 RegistryRegisterV1Request,
902 fidl::encoding::DefaultFuchsiaResourceDialect,
903 > for (T0, T1, T2, T3)
904 {
905 #[inline]
906 unsafe fn encode(
907 self,
908 encoder: &mut fidl::encoding::Encoder<
909 '_,
910 fidl::encoding::DefaultFuchsiaResourceDialect,
911 >,
912 offset: usize,
913 depth: fidl::encoding::Depth,
914 ) -> fidl::Result<()> {
915 encoder.debug_check_bounds::<RegistryRegisterV1Request>(offset);
916 self.0.encode(encoder, offset + 0, depth)?;
920 self.1.encode(encoder, offset + 4, depth)?;
921 self.2.encode(encoder, offset + 8, depth)?;
922 self.3.encode(encoder, offset + 12, depth)?;
923 Ok(())
924 }
925 }
926
927 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
928 for RegistryRegisterV1Request
929 {
930 #[inline(always)]
931 fn new_empty() -> Self {
932 Self {
933 process: fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 49231>, fidl::encoding::DefaultFuchsiaResourceDialect),
934 allocations_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect),
935 resources_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect),
936 snapshot_sink: fidl::new_empty!(
937 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>>,
938 fidl::encoding::DefaultFuchsiaResourceDialect
939 ),
940 }
941 }
942
943 #[inline]
944 unsafe fn decode(
945 &mut self,
946 decoder: &mut fidl::encoding::Decoder<
947 '_,
948 fidl::encoding::DefaultFuchsiaResourceDialect,
949 >,
950 offset: usize,
951 _depth: fidl::encoding::Depth,
952 ) -> fidl::Result<()> {
953 decoder.debug_check_bounds::<Self>(offset);
954 fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 49231>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.process, decoder, offset + 0, _depth)?;
956 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.allocations_vmo, decoder, offset + 4, _depth)?;
957 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resources_vmo, decoder, offset + 8, _depth)?;
958 fidl::decode!(
959 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>>,
960 fidl::encoding::DefaultFuchsiaResourceDialect,
961 &mut self.snapshot_sink,
962 decoder,
963 offset + 12,
964 _depth
965 )?;
966 Ok(())
967 }
968 }
969
970 impl fidl::encoding::ResourceTypeMarker for SnapshotSinkV1StoreNamedSnapshotRequest {
971 type Borrowed<'a> = &'a mut Self;
972 fn take_or_borrow<'a>(
973 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
974 ) -> Self::Borrowed<'a> {
975 value
976 }
977 }
978
979 unsafe impl fidl::encoding::TypeMarker for SnapshotSinkV1StoreNamedSnapshotRequest {
980 type Owned = Self;
981
982 #[inline(always)]
983 fn inline_align(_context: fidl::encoding::Context) -> usize {
984 8
985 }
986
987 #[inline(always)]
988 fn inline_size(_context: fidl::encoding::Context) -> usize {
989 24
990 }
991 }
992
993 unsafe impl
994 fidl::encoding::Encode<
995 SnapshotSinkV1StoreNamedSnapshotRequest,
996 fidl::encoding::DefaultFuchsiaResourceDialect,
997 > for &mut SnapshotSinkV1StoreNamedSnapshotRequest
998 {
999 #[inline]
1000 unsafe fn encode(
1001 self,
1002 encoder: &mut fidl::encoding::Encoder<
1003 '_,
1004 fidl::encoding::DefaultFuchsiaResourceDialect,
1005 >,
1006 offset: usize,
1007 _depth: fidl::encoding::Depth,
1008 ) -> fidl::Result<()> {
1009 encoder.debug_check_bounds::<SnapshotSinkV1StoreNamedSnapshotRequest>(offset);
1010 fidl::encoding::Encode::<
1012 SnapshotSinkV1StoreNamedSnapshotRequest,
1013 fidl::encoding::DefaultFuchsiaResourceDialect,
1014 >::encode(
1015 (
1016 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
1017 &self.snapshot_name,
1018 ),
1019 <fidl::encoding::HandleType<
1020 fidl::Vmo,
1021 { fidl::ObjectType::VMO.into_raw() },
1022 49255,
1023 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1024 &mut self.allocations_vmo_snapshot,
1025 ),
1026 ),
1027 encoder,
1028 offset,
1029 _depth,
1030 )
1031 }
1032 }
1033 unsafe impl<
1034 T0: fidl::encoding::Encode<
1035 fidl::encoding::BoundedString<32>,
1036 fidl::encoding::DefaultFuchsiaResourceDialect,
1037 >,
1038 T1: fidl::encoding::Encode<
1039 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
1040 fidl::encoding::DefaultFuchsiaResourceDialect,
1041 >,
1042 >
1043 fidl::encoding::Encode<
1044 SnapshotSinkV1StoreNamedSnapshotRequest,
1045 fidl::encoding::DefaultFuchsiaResourceDialect,
1046 > for (T0, T1)
1047 {
1048 #[inline]
1049 unsafe fn encode(
1050 self,
1051 encoder: &mut fidl::encoding::Encoder<
1052 '_,
1053 fidl::encoding::DefaultFuchsiaResourceDialect,
1054 >,
1055 offset: usize,
1056 depth: fidl::encoding::Depth,
1057 ) -> fidl::Result<()> {
1058 encoder.debug_check_bounds::<SnapshotSinkV1StoreNamedSnapshotRequest>(offset);
1059 unsafe {
1062 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1063 (ptr as *mut u64).write_unaligned(0);
1064 }
1065 self.0.encode(encoder, offset + 0, depth)?;
1067 self.1.encode(encoder, offset + 16, depth)?;
1068 Ok(())
1069 }
1070 }
1071
1072 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1073 for SnapshotSinkV1StoreNamedSnapshotRequest
1074 {
1075 #[inline(always)]
1076 fn new_empty() -> Self {
1077 Self {
1078 snapshot_name: fidl::new_empty!(
1079 fidl::encoding::BoundedString<32>,
1080 fidl::encoding::DefaultFuchsiaResourceDialect
1081 ),
1082 allocations_vmo_snapshot: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect),
1083 }
1084 }
1085
1086 #[inline]
1087 unsafe fn decode(
1088 &mut self,
1089 decoder: &mut fidl::encoding::Decoder<
1090 '_,
1091 fidl::encoding::DefaultFuchsiaResourceDialect,
1092 >,
1093 offset: usize,
1094 _depth: fidl::encoding::Depth,
1095 ) -> fidl::Result<()> {
1096 decoder.debug_check_bounds::<Self>(offset);
1097 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1099 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1100 let mask = 0xffffffff00000000u64;
1101 let maskedval = padval & mask;
1102 if maskedval != 0 {
1103 return Err(fidl::Error::NonZeroPadding {
1104 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1105 });
1106 }
1107 fidl::decode!(
1108 fidl::encoding::BoundedString<32>,
1109 fidl::encoding::DefaultFuchsiaResourceDialect,
1110 &mut self.snapshot_name,
1111 decoder,
1112 offset + 0,
1113 _depth
1114 )?;
1115 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.allocations_vmo_snapshot, decoder, offset + 16, _depth)?;
1116 Ok(())
1117 }
1118 }
1119}