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 fidl::endpoints::ControlHandle for RegistryControlHandle {
415 fn shutdown(&self) {
416 self.inner.shutdown()
417 }
418
419 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
420 self.inner.shutdown_with_epitaph(status)
421 }
422
423 fn is_closed(&self) -> bool {
424 self.inner.channel().is_closed()
425 }
426 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
427 self.inner.channel().on_closed()
428 }
429
430 #[cfg(target_os = "fuchsia")]
431 fn signal_peer(
432 &self,
433 clear_mask: zx::Signals,
434 set_mask: zx::Signals,
435 ) -> Result<(), zx_status::Status> {
436 use fidl::Peered;
437 self.inner.channel().signal_peer(clear_mask, set_mask)
438 }
439}
440
441impl RegistryControlHandle {}
442
443#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
444pub struct SnapshotSinkV1Marker;
445
446impl fidl::endpoints::ProtocolMarker for SnapshotSinkV1Marker {
447 type Proxy = SnapshotSinkV1Proxy;
448 type RequestStream = SnapshotSinkV1RequestStream;
449 #[cfg(target_os = "fuchsia")]
450 type SynchronousProxy = SnapshotSinkV1SynchronousProxy;
451
452 const DEBUG_NAME: &'static str = "(anonymous) SnapshotSinkV1";
453}
454
455pub trait SnapshotSinkV1ProxyInterface: Send + Sync {
456 fn r#store_named_snapshot(
457 &self,
458 snapshot_name: &str,
459 allocations_vmo_snapshot: fidl::Vmo,
460 ) -> Result<(), fidl::Error>;
461}
462#[derive(Debug)]
463#[cfg(target_os = "fuchsia")]
464pub struct SnapshotSinkV1SynchronousProxy {
465 client: fidl::client::sync::Client,
466}
467
468#[cfg(target_os = "fuchsia")]
469impl fidl::endpoints::SynchronousProxy for SnapshotSinkV1SynchronousProxy {
470 type Proxy = SnapshotSinkV1Proxy;
471 type Protocol = SnapshotSinkV1Marker;
472
473 fn from_channel(inner: fidl::Channel) -> Self {
474 Self::new(inner)
475 }
476
477 fn into_channel(self) -> fidl::Channel {
478 self.client.into_channel()
479 }
480
481 fn as_channel(&self) -> &fidl::Channel {
482 self.client.as_channel()
483 }
484}
485
486#[cfg(target_os = "fuchsia")]
487impl SnapshotSinkV1SynchronousProxy {
488 pub fn new(channel: fidl::Channel) -> Self {
489 Self { client: fidl::client::sync::Client::new(channel) }
490 }
491
492 pub fn into_channel(self) -> fidl::Channel {
493 self.client.into_channel()
494 }
495
496 pub fn wait_for_event(
499 &self,
500 deadline: zx::MonotonicInstant,
501 ) -> Result<SnapshotSinkV1Event, fidl::Error> {
502 SnapshotSinkV1Event::decode(self.client.wait_for_event::<SnapshotSinkV1Marker>(deadline)?)
503 }
504
505 pub fn r#store_named_snapshot(
510 &self,
511 mut snapshot_name: &str,
512 mut allocations_vmo_snapshot: fidl::Vmo,
513 ) -> Result<(), fidl::Error> {
514 self.client.send::<SnapshotSinkV1StoreNamedSnapshotRequest>(
515 (snapshot_name, allocations_vmo_snapshot),
516 0x356eaec66aabbea5,
517 fidl::encoding::DynamicFlags::empty(),
518 )
519 }
520}
521
522#[cfg(target_os = "fuchsia")]
523impl From<SnapshotSinkV1SynchronousProxy> for zx::NullableHandle {
524 fn from(value: SnapshotSinkV1SynchronousProxy) -> Self {
525 value.into_channel().into()
526 }
527}
528
529#[cfg(target_os = "fuchsia")]
530impl From<fidl::Channel> for SnapshotSinkV1SynchronousProxy {
531 fn from(value: fidl::Channel) -> Self {
532 Self::new(value)
533 }
534}
535
536#[cfg(target_os = "fuchsia")]
537impl fidl::endpoints::FromClient for SnapshotSinkV1SynchronousProxy {
538 type Protocol = SnapshotSinkV1Marker;
539
540 fn from_client(value: fidl::endpoints::ClientEnd<SnapshotSinkV1Marker>) -> Self {
541 Self::new(value.into_channel())
542 }
543}
544
545#[derive(Debug, Clone)]
546pub struct SnapshotSinkV1Proxy {
547 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
548}
549
550impl fidl::endpoints::Proxy for SnapshotSinkV1Proxy {
551 type Protocol = SnapshotSinkV1Marker;
552
553 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
554 Self::new(inner)
555 }
556
557 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
558 self.client.into_channel().map_err(|client| Self { client })
559 }
560
561 fn as_channel(&self) -> &::fidl::AsyncChannel {
562 self.client.as_channel()
563 }
564}
565
566impl SnapshotSinkV1Proxy {
567 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
569 let protocol_name = <SnapshotSinkV1Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
570 Self { client: fidl::client::Client::new(channel, protocol_name) }
571 }
572
573 pub fn take_event_stream(&self) -> SnapshotSinkV1EventStream {
579 SnapshotSinkV1EventStream { event_receiver: self.client.take_event_receiver() }
580 }
581
582 pub fn r#store_named_snapshot(
587 &self,
588 mut snapshot_name: &str,
589 mut allocations_vmo_snapshot: fidl::Vmo,
590 ) -> Result<(), fidl::Error> {
591 SnapshotSinkV1ProxyInterface::r#store_named_snapshot(
592 self,
593 snapshot_name,
594 allocations_vmo_snapshot,
595 )
596 }
597}
598
599impl SnapshotSinkV1ProxyInterface for SnapshotSinkV1Proxy {
600 fn r#store_named_snapshot(
601 &self,
602 mut snapshot_name: &str,
603 mut allocations_vmo_snapshot: fidl::Vmo,
604 ) -> Result<(), fidl::Error> {
605 self.client.send::<SnapshotSinkV1StoreNamedSnapshotRequest>(
606 (snapshot_name, allocations_vmo_snapshot),
607 0x356eaec66aabbea5,
608 fidl::encoding::DynamicFlags::empty(),
609 )
610 }
611}
612
613pub struct SnapshotSinkV1EventStream {
614 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
615}
616
617impl std::marker::Unpin for SnapshotSinkV1EventStream {}
618
619impl futures::stream::FusedStream for SnapshotSinkV1EventStream {
620 fn is_terminated(&self) -> bool {
621 self.event_receiver.is_terminated()
622 }
623}
624
625impl futures::Stream for SnapshotSinkV1EventStream {
626 type Item = Result<SnapshotSinkV1Event, fidl::Error>;
627
628 fn poll_next(
629 mut self: std::pin::Pin<&mut Self>,
630 cx: &mut std::task::Context<'_>,
631 ) -> std::task::Poll<Option<Self::Item>> {
632 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
633 &mut self.event_receiver,
634 cx
635 )?) {
636 Some(buf) => std::task::Poll::Ready(Some(SnapshotSinkV1Event::decode(buf))),
637 None => std::task::Poll::Ready(None),
638 }
639 }
640}
641
642#[derive(Debug)]
643pub enum SnapshotSinkV1Event {}
644
645impl SnapshotSinkV1Event {
646 fn decode(
648 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
649 ) -> Result<SnapshotSinkV1Event, fidl::Error> {
650 let (bytes, _handles) = buf.split_mut();
651 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
652 debug_assert_eq!(tx_header.tx_id, 0);
653 match tx_header.ordinal {
654 _ => Err(fidl::Error::UnknownOrdinal {
655 ordinal: tx_header.ordinal,
656 protocol_name:
657 <SnapshotSinkV1Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
658 }),
659 }
660 }
661}
662
663pub struct SnapshotSinkV1RequestStream {
665 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
666 is_terminated: bool,
667}
668
669impl std::marker::Unpin for SnapshotSinkV1RequestStream {}
670
671impl futures::stream::FusedStream for SnapshotSinkV1RequestStream {
672 fn is_terminated(&self) -> bool {
673 self.is_terminated
674 }
675}
676
677impl fidl::endpoints::RequestStream for SnapshotSinkV1RequestStream {
678 type Protocol = SnapshotSinkV1Marker;
679 type ControlHandle = SnapshotSinkV1ControlHandle;
680
681 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
682 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
683 }
684
685 fn control_handle(&self) -> Self::ControlHandle {
686 SnapshotSinkV1ControlHandle { inner: self.inner.clone() }
687 }
688
689 fn into_inner(
690 self,
691 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
692 {
693 (self.inner, self.is_terminated)
694 }
695
696 fn from_inner(
697 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
698 is_terminated: bool,
699 ) -> Self {
700 Self { inner, is_terminated }
701 }
702}
703
704impl futures::Stream for SnapshotSinkV1RequestStream {
705 type Item = Result<SnapshotSinkV1Request, fidl::Error>;
706
707 fn poll_next(
708 mut self: std::pin::Pin<&mut Self>,
709 cx: &mut std::task::Context<'_>,
710 ) -> std::task::Poll<Option<Self::Item>> {
711 let this = &mut *self;
712 if this.inner.check_shutdown(cx) {
713 this.is_terminated = true;
714 return std::task::Poll::Ready(None);
715 }
716 if this.is_terminated {
717 panic!("polled SnapshotSinkV1RequestStream after completion");
718 }
719 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
720 |bytes, handles| {
721 match this.inner.channel().read_etc(cx, bytes, handles) {
722 std::task::Poll::Ready(Ok(())) => {}
723 std::task::Poll::Pending => return std::task::Poll::Pending,
724 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
725 this.is_terminated = true;
726 return std::task::Poll::Ready(None);
727 }
728 std::task::Poll::Ready(Err(e)) => {
729 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
730 e.into(),
731 ))));
732 }
733 }
734
735 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
737
738 std::task::Poll::Ready(Some(match header.ordinal {
739 0x356eaec66aabbea5 => {
740 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
741 let mut req = fidl::new_empty!(
742 SnapshotSinkV1StoreNamedSnapshotRequest,
743 fidl::encoding::DefaultFuchsiaResourceDialect
744 );
745 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnapshotSinkV1StoreNamedSnapshotRequest>(&header, _body_bytes, handles, &mut req)?;
746 let control_handle =
747 SnapshotSinkV1ControlHandle { inner: this.inner.clone() };
748 Ok(SnapshotSinkV1Request::StoreNamedSnapshot {
749 snapshot_name: req.snapshot_name,
750 allocations_vmo_snapshot: req.allocations_vmo_snapshot,
751
752 control_handle,
753 })
754 }
755 _ => Err(fidl::Error::UnknownOrdinal {
756 ordinal: header.ordinal,
757 protocol_name:
758 <SnapshotSinkV1Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
759 }),
760 }))
761 },
762 )
763 }
764}
765
766#[derive(Debug)]
770pub enum SnapshotSinkV1Request {
771 StoreNamedSnapshot {
776 snapshot_name: String,
777 allocations_vmo_snapshot: fidl::Vmo,
778 control_handle: SnapshotSinkV1ControlHandle,
779 },
780}
781
782impl SnapshotSinkV1Request {
783 #[allow(irrefutable_let_patterns)]
784 pub fn into_store_named_snapshot(
785 self,
786 ) -> Option<(String, fidl::Vmo, SnapshotSinkV1ControlHandle)> {
787 if let SnapshotSinkV1Request::StoreNamedSnapshot {
788 snapshot_name,
789 allocations_vmo_snapshot,
790 control_handle,
791 } = self
792 {
793 Some((snapshot_name, allocations_vmo_snapshot, control_handle))
794 } else {
795 None
796 }
797 }
798
799 pub fn method_name(&self) -> &'static str {
801 match *self {
802 SnapshotSinkV1Request::StoreNamedSnapshot { .. } => "store_named_snapshot",
803 }
804 }
805}
806
807#[derive(Debug, Clone)]
808pub struct SnapshotSinkV1ControlHandle {
809 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
810}
811
812impl fidl::endpoints::ControlHandle for SnapshotSinkV1ControlHandle {
813 fn shutdown(&self) {
814 self.inner.shutdown()
815 }
816
817 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
818 self.inner.shutdown_with_epitaph(status)
819 }
820
821 fn is_closed(&self) -> bool {
822 self.inner.channel().is_closed()
823 }
824 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
825 self.inner.channel().on_closed()
826 }
827
828 #[cfg(target_os = "fuchsia")]
829 fn signal_peer(
830 &self,
831 clear_mask: zx::Signals,
832 set_mask: zx::Signals,
833 ) -> Result<(), zx_status::Status> {
834 use fidl::Peered;
835 self.inner.channel().signal_peer(clear_mask, set_mask)
836 }
837}
838
839impl SnapshotSinkV1ControlHandle {}
840
841mod internal {
842 use super::*;
843
844 impl fidl::encoding::ResourceTypeMarker for RegistryRegisterV1Request {
845 type Borrowed<'a> = &'a mut Self;
846 fn take_or_borrow<'a>(
847 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
848 ) -> Self::Borrowed<'a> {
849 value
850 }
851 }
852
853 unsafe impl fidl::encoding::TypeMarker for RegistryRegisterV1Request {
854 type Owned = Self;
855
856 #[inline(always)]
857 fn inline_align(_context: fidl::encoding::Context) -> usize {
858 4
859 }
860
861 #[inline(always)]
862 fn inline_size(_context: fidl::encoding::Context) -> usize {
863 16
864 }
865 }
866
867 unsafe impl
868 fidl::encoding::Encode<
869 RegistryRegisterV1Request,
870 fidl::encoding::DefaultFuchsiaResourceDialect,
871 > for &mut RegistryRegisterV1Request
872 {
873 #[inline]
874 unsafe fn encode(
875 self,
876 encoder: &mut fidl::encoding::Encoder<
877 '_,
878 fidl::encoding::DefaultFuchsiaResourceDialect,
879 >,
880 offset: usize,
881 _depth: fidl::encoding::Depth,
882 ) -> fidl::Result<()> {
883 encoder.debug_check_bounds::<RegistryRegisterV1Request>(offset);
884 fidl::encoding::Encode::<RegistryRegisterV1Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
886 (
887 <fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 49231> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.process),
888 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.allocations_vmo),
889 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.resources_vmo),
890 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.snapshot_sink),
891 ),
892 encoder, offset, _depth
893 )
894 }
895 }
896 unsafe impl<
897 T0: fidl::encoding::Encode<
898 fidl::encoding::HandleType<
899 fidl::Process,
900 { fidl::ObjectType::PROCESS.into_raw() },
901 49231,
902 >,
903 fidl::encoding::DefaultFuchsiaResourceDialect,
904 >,
905 T1: fidl::encoding::Encode<
906 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
907 fidl::encoding::DefaultFuchsiaResourceDialect,
908 >,
909 T2: fidl::encoding::Encode<
910 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
911 fidl::encoding::DefaultFuchsiaResourceDialect,
912 >,
913 T3: fidl::encoding::Encode<
914 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>>,
915 fidl::encoding::DefaultFuchsiaResourceDialect,
916 >,
917 >
918 fidl::encoding::Encode<
919 RegistryRegisterV1Request,
920 fidl::encoding::DefaultFuchsiaResourceDialect,
921 > for (T0, T1, T2, T3)
922 {
923 #[inline]
924 unsafe fn encode(
925 self,
926 encoder: &mut fidl::encoding::Encoder<
927 '_,
928 fidl::encoding::DefaultFuchsiaResourceDialect,
929 >,
930 offset: usize,
931 depth: fidl::encoding::Depth,
932 ) -> fidl::Result<()> {
933 encoder.debug_check_bounds::<RegistryRegisterV1Request>(offset);
934 self.0.encode(encoder, offset + 0, depth)?;
938 self.1.encode(encoder, offset + 4, depth)?;
939 self.2.encode(encoder, offset + 8, depth)?;
940 self.3.encode(encoder, offset + 12, depth)?;
941 Ok(())
942 }
943 }
944
945 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
946 for RegistryRegisterV1Request
947 {
948 #[inline(always)]
949 fn new_empty() -> Self {
950 Self {
951 process: fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 49231>, fidl::encoding::DefaultFuchsiaResourceDialect),
952 allocations_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect),
953 resources_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect),
954 snapshot_sink: fidl::new_empty!(
955 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>>,
956 fidl::encoding::DefaultFuchsiaResourceDialect
957 ),
958 }
959 }
960
961 #[inline]
962 unsafe fn decode(
963 &mut self,
964 decoder: &mut fidl::encoding::Decoder<
965 '_,
966 fidl::encoding::DefaultFuchsiaResourceDialect,
967 >,
968 offset: usize,
969 _depth: fidl::encoding::Depth,
970 ) -> fidl::Result<()> {
971 decoder.debug_check_bounds::<Self>(offset);
972 fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 49231>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.process, decoder, offset + 0, _depth)?;
974 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.allocations_vmo, decoder, offset + 4, _depth)?;
975 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resources_vmo, decoder, offset + 8, _depth)?;
976 fidl::decode!(
977 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SnapshotSinkV1Marker>>,
978 fidl::encoding::DefaultFuchsiaResourceDialect,
979 &mut self.snapshot_sink,
980 decoder,
981 offset + 12,
982 _depth
983 )?;
984 Ok(())
985 }
986 }
987
988 impl fidl::encoding::ResourceTypeMarker for SnapshotSinkV1StoreNamedSnapshotRequest {
989 type Borrowed<'a> = &'a mut Self;
990 fn take_or_borrow<'a>(
991 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
992 ) -> Self::Borrowed<'a> {
993 value
994 }
995 }
996
997 unsafe impl fidl::encoding::TypeMarker for SnapshotSinkV1StoreNamedSnapshotRequest {
998 type Owned = Self;
999
1000 #[inline(always)]
1001 fn inline_align(_context: fidl::encoding::Context) -> usize {
1002 8
1003 }
1004
1005 #[inline(always)]
1006 fn inline_size(_context: fidl::encoding::Context) -> usize {
1007 24
1008 }
1009 }
1010
1011 unsafe impl
1012 fidl::encoding::Encode<
1013 SnapshotSinkV1StoreNamedSnapshotRequest,
1014 fidl::encoding::DefaultFuchsiaResourceDialect,
1015 > for &mut SnapshotSinkV1StoreNamedSnapshotRequest
1016 {
1017 #[inline]
1018 unsafe fn encode(
1019 self,
1020 encoder: &mut fidl::encoding::Encoder<
1021 '_,
1022 fidl::encoding::DefaultFuchsiaResourceDialect,
1023 >,
1024 offset: usize,
1025 _depth: fidl::encoding::Depth,
1026 ) -> fidl::Result<()> {
1027 encoder.debug_check_bounds::<SnapshotSinkV1StoreNamedSnapshotRequest>(offset);
1028 fidl::encoding::Encode::<
1030 SnapshotSinkV1StoreNamedSnapshotRequest,
1031 fidl::encoding::DefaultFuchsiaResourceDialect,
1032 >::encode(
1033 (
1034 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
1035 &self.snapshot_name,
1036 ),
1037 <fidl::encoding::HandleType<
1038 fidl::Vmo,
1039 { fidl::ObjectType::VMO.into_raw() },
1040 49255,
1041 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1042 &mut self.allocations_vmo_snapshot,
1043 ),
1044 ),
1045 encoder,
1046 offset,
1047 _depth,
1048 )
1049 }
1050 }
1051 unsafe impl<
1052 T0: fidl::encoding::Encode<
1053 fidl::encoding::BoundedString<32>,
1054 fidl::encoding::DefaultFuchsiaResourceDialect,
1055 >,
1056 T1: fidl::encoding::Encode<
1057 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
1058 fidl::encoding::DefaultFuchsiaResourceDialect,
1059 >,
1060 >
1061 fidl::encoding::Encode<
1062 SnapshotSinkV1StoreNamedSnapshotRequest,
1063 fidl::encoding::DefaultFuchsiaResourceDialect,
1064 > for (T0, T1)
1065 {
1066 #[inline]
1067 unsafe fn encode(
1068 self,
1069 encoder: &mut fidl::encoding::Encoder<
1070 '_,
1071 fidl::encoding::DefaultFuchsiaResourceDialect,
1072 >,
1073 offset: usize,
1074 depth: fidl::encoding::Depth,
1075 ) -> fidl::Result<()> {
1076 encoder.debug_check_bounds::<SnapshotSinkV1StoreNamedSnapshotRequest>(offset);
1077 unsafe {
1080 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1081 (ptr as *mut u64).write_unaligned(0);
1082 }
1083 self.0.encode(encoder, offset + 0, depth)?;
1085 self.1.encode(encoder, offset + 16, depth)?;
1086 Ok(())
1087 }
1088 }
1089
1090 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1091 for SnapshotSinkV1StoreNamedSnapshotRequest
1092 {
1093 #[inline(always)]
1094 fn new_empty() -> Self {
1095 Self {
1096 snapshot_name: fidl::new_empty!(
1097 fidl::encoding::BoundedString<32>,
1098 fidl::encoding::DefaultFuchsiaResourceDialect
1099 ),
1100 allocations_vmo_snapshot: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect),
1101 }
1102 }
1103
1104 #[inline]
1105 unsafe fn decode(
1106 &mut self,
1107 decoder: &mut fidl::encoding::Decoder<
1108 '_,
1109 fidl::encoding::DefaultFuchsiaResourceDialect,
1110 >,
1111 offset: usize,
1112 _depth: fidl::encoding::Depth,
1113 ) -> fidl::Result<()> {
1114 decoder.debug_check_bounds::<Self>(offset);
1115 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1117 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1118 let mask = 0xffffffff00000000u64;
1119 let maskedval = padval & mask;
1120 if maskedval != 0 {
1121 return Err(fidl::Error::NonZeroPadding {
1122 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1123 });
1124 }
1125 fidl::decode!(
1126 fidl::encoding::BoundedString<32>,
1127 fidl::encoding::DefaultFuchsiaResourceDialect,
1128 &mut self.snapshot_name,
1129 decoder,
1130 offset + 0,
1131 _depth
1132 )?;
1133 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)?;
1134 Ok(())
1135 }
1136 }
1137}