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