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