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_attribution_plugin__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct MemoryMonitorGetAbridgedSnapshotRequest {
16 pub snapshot: fidl::Socket,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for MemoryMonitorGetAbridgedSnapshotRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct MemoryMonitorGetSnapshotRequest {
27 pub snapshot: fidl::Socket,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for MemoryMonitorGetSnapshotRequest
33{
34}
35
36#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
37pub struct MemoryMonitorMarker;
38
39impl fidl::endpoints::ProtocolMarker for MemoryMonitorMarker {
40 type Proxy = MemoryMonitorProxy;
41 type RequestStream = MemoryMonitorRequestStream;
42 #[cfg(target_os = "fuchsia")]
43 type SynchronousProxy = MemoryMonitorSynchronousProxy;
44
45 const DEBUG_NAME: &'static str = "fuchsia.memory.attribution.plugin.MemoryMonitor";
46}
47impl fidl::endpoints::DiscoverableProtocolMarker for MemoryMonitorMarker {}
48
49pub trait MemoryMonitorProxyInterface: Send + Sync {
50 fn r#get_snapshot(&self, snapshot: fidl::Socket) -> Result<(), fidl::Error>;
51 type GetSystemStatisticsResponseFut: std::future::Future<Output = Result<MemoryStatistics, fidl::Error>>
52 + Send;
53 fn r#get_system_statistics(&self) -> Self::GetSystemStatisticsResponseFut;
54 fn r#get_abridged_snapshot(&self, snapshot: fidl::Socket) -> Result<(), fidl::Error>;
55}
56#[derive(Debug)]
57#[cfg(target_os = "fuchsia")]
58pub struct MemoryMonitorSynchronousProxy {
59 client: fidl::client::sync::Client,
60}
61
62#[cfg(target_os = "fuchsia")]
63impl fidl::endpoints::SynchronousProxy for MemoryMonitorSynchronousProxy {
64 type Proxy = MemoryMonitorProxy;
65 type Protocol = MemoryMonitorMarker;
66
67 fn from_channel(inner: fidl::Channel) -> Self {
68 Self::new(inner)
69 }
70
71 fn into_channel(self) -> fidl::Channel {
72 self.client.into_channel()
73 }
74
75 fn as_channel(&self) -> &fidl::Channel {
76 self.client.as_channel()
77 }
78}
79
80#[cfg(target_os = "fuchsia")]
81impl MemoryMonitorSynchronousProxy {
82 pub fn new(channel: fidl::Channel) -> Self {
83 Self { client: fidl::client::sync::Client::new(channel) }
84 }
85
86 pub fn into_channel(self) -> fidl::Channel {
87 self.client.into_channel()
88 }
89
90 pub fn wait_for_event(
93 &self,
94 deadline: zx::MonotonicInstant,
95 ) -> Result<MemoryMonitorEvent, fidl::Error> {
96 MemoryMonitorEvent::decode(self.client.wait_for_event::<MemoryMonitorMarker>(deadline)?)
97 }
98
99 pub fn r#get_snapshot(&self, mut snapshot: fidl::Socket) -> Result<(), fidl::Error> {
101 self.client.send::<MemoryMonitorGetSnapshotRequest>(
102 (snapshot,),
103 0x3af6caa4c6a6fdb7,
104 fidl::encoding::DynamicFlags::FLEXIBLE,
105 )
106 }
107
108 pub fn r#get_system_statistics(
111 &self,
112 ___deadline: zx::MonotonicInstant,
113 ) -> Result<MemoryStatistics, fidl::Error> {
114 let _response = self.client.send_query::<
115 fidl::encoding::EmptyPayload,
116 fidl::encoding::FlexibleType<MemoryMonitorGetSystemStatisticsResponse>,
117 MemoryMonitorMarker,
118 >(
119 (),
120 0x33e3c58dc277f92d,
121 fidl::encoding::DynamicFlags::FLEXIBLE,
122 ___deadline,
123 )?
124 .into_result::<MemoryMonitorMarker>("get_system_statistics")?;
125 Ok(_response.statistics)
126 }
127
128 pub fn r#get_abridged_snapshot(&self, mut snapshot: fidl::Socket) -> Result<(), fidl::Error> {
130 self.client.send::<MemoryMonitorGetAbridgedSnapshotRequest>(
131 (snapshot,),
132 0x2dc4ffad72b5fd7e,
133 fidl::encoding::DynamicFlags::FLEXIBLE,
134 )
135 }
136}
137
138#[cfg(target_os = "fuchsia")]
139impl From<MemoryMonitorSynchronousProxy> for zx::NullableHandle {
140 fn from(value: MemoryMonitorSynchronousProxy) -> Self {
141 value.into_channel().into()
142 }
143}
144
145#[cfg(target_os = "fuchsia")]
146impl From<fidl::Channel> for MemoryMonitorSynchronousProxy {
147 fn from(value: fidl::Channel) -> Self {
148 Self::new(value)
149 }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl fidl::endpoints::FromClient for MemoryMonitorSynchronousProxy {
154 type Protocol = MemoryMonitorMarker;
155
156 fn from_client(value: fidl::endpoints::ClientEnd<MemoryMonitorMarker>) -> Self {
157 Self::new(value.into_channel())
158 }
159}
160
161#[derive(Debug, Clone)]
162pub struct MemoryMonitorProxy {
163 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
164}
165
166impl fidl::endpoints::Proxy for MemoryMonitorProxy {
167 type Protocol = MemoryMonitorMarker;
168
169 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
170 Self::new(inner)
171 }
172
173 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
174 self.client.into_channel().map_err(|client| Self { client })
175 }
176
177 fn as_channel(&self) -> &::fidl::AsyncChannel {
178 self.client.as_channel()
179 }
180}
181
182impl MemoryMonitorProxy {
183 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
185 let protocol_name = <MemoryMonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
186 Self { client: fidl::client::Client::new(channel, protocol_name) }
187 }
188
189 pub fn take_event_stream(&self) -> MemoryMonitorEventStream {
195 MemoryMonitorEventStream { event_receiver: self.client.take_event_receiver() }
196 }
197
198 pub fn r#get_snapshot(&self, mut snapshot: fidl::Socket) -> Result<(), fidl::Error> {
200 MemoryMonitorProxyInterface::r#get_snapshot(self, snapshot)
201 }
202
203 pub fn r#get_system_statistics(
206 &self,
207 ) -> fidl::client::QueryResponseFut<
208 MemoryStatistics,
209 fidl::encoding::DefaultFuchsiaResourceDialect,
210 > {
211 MemoryMonitorProxyInterface::r#get_system_statistics(self)
212 }
213
214 pub fn r#get_abridged_snapshot(&self, mut snapshot: fidl::Socket) -> Result<(), fidl::Error> {
216 MemoryMonitorProxyInterface::r#get_abridged_snapshot(self, snapshot)
217 }
218}
219
220impl MemoryMonitorProxyInterface for MemoryMonitorProxy {
221 fn r#get_snapshot(&self, mut snapshot: fidl::Socket) -> Result<(), fidl::Error> {
222 self.client.send::<MemoryMonitorGetSnapshotRequest>(
223 (snapshot,),
224 0x3af6caa4c6a6fdb7,
225 fidl::encoding::DynamicFlags::FLEXIBLE,
226 )
227 }
228
229 type GetSystemStatisticsResponseFut = fidl::client::QueryResponseFut<
230 MemoryStatistics,
231 fidl::encoding::DefaultFuchsiaResourceDialect,
232 >;
233 fn r#get_system_statistics(&self) -> Self::GetSystemStatisticsResponseFut {
234 fn _decode(
235 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
236 ) -> Result<MemoryStatistics, fidl::Error> {
237 let _response = fidl::client::decode_transaction_body::<
238 fidl::encoding::FlexibleType<MemoryMonitorGetSystemStatisticsResponse>,
239 fidl::encoding::DefaultFuchsiaResourceDialect,
240 0x33e3c58dc277f92d,
241 >(_buf?)?
242 .into_result::<MemoryMonitorMarker>("get_system_statistics")?;
243 Ok(_response.statistics)
244 }
245 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatistics>(
246 (),
247 0x33e3c58dc277f92d,
248 fidl::encoding::DynamicFlags::FLEXIBLE,
249 _decode,
250 )
251 }
252
253 fn r#get_abridged_snapshot(&self, mut snapshot: fidl::Socket) -> Result<(), fidl::Error> {
254 self.client.send::<MemoryMonitorGetAbridgedSnapshotRequest>(
255 (snapshot,),
256 0x2dc4ffad72b5fd7e,
257 fidl::encoding::DynamicFlags::FLEXIBLE,
258 )
259 }
260}
261
262pub struct MemoryMonitorEventStream {
263 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
264}
265
266impl std::marker::Unpin for MemoryMonitorEventStream {}
267
268impl futures::stream::FusedStream for MemoryMonitorEventStream {
269 fn is_terminated(&self) -> bool {
270 self.event_receiver.is_terminated()
271 }
272}
273
274impl futures::Stream for MemoryMonitorEventStream {
275 type Item = Result<MemoryMonitorEvent, fidl::Error>;
276
277 fn poll_next(
278 mut self: std::pin::Pin<&mut Self>,
279 cx: &mut std::task::Context<'_>,
280 ) -> std::task::Poll<Option<Self::Item>> {
281 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
282 &mut self.event_receiver,
283 cx
284 )?) {
285 Some(buf) => std::task::Poll::Ready(Some(MemoryMonitorEvent::decode(buf))),
286 None => std::task::Poll::Ready(None),
287 }
288 }
289}
290
291#[derive(Debug)]
292pub enum MemoryMonitorEvent {
293 #[non_exhaustive]
294 _UnknownEvent {
295 ordinal: u64,
297 },
298}
299
300impl MemoryMonitorEvent {
301 fn decode(
303 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
304 ) -> Result<MemoryMonitorEvent, fidl::Error> {
305 let (bytes, _handles) = buf.split_mut();
306 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
307 debug_assert_eq!(tx_header.tx_id, 0);
308 match tx_header.ordinal {
309 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
310 Ok(MemoryMonitorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
311 }
312 _ => Err(fidl::Error::UnknownOrdinal {
313 ordinal: tx_header.ordinal,
314 protocol_name: <MemoryMonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
315 }),
316 }
317 }
318}
319
320pub struct MemoryMonitorRequestStream {
322 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
323 is_terminated: bool,
324}
325
326impl std::marker::Unpin for MemoryMonitorRequestStream {}
327
328impl futures::stream::FusedStream for MemoryMonitorRequestStream {
329 fn is_terminated(&self) -> bool {
330 self.is_terminated
331 }
332}
333
334impl fidl::endpoints::RequestStream for MemoryMonitorRequestStream {
335 type Protocol = MemoryMonitorMarker;
336 type ControlHandle = MemoryMonitorControlHandle;
337
338 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
339 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
340 }
341
342 fn control_handle(&self) -> Self::ControlHandle {
343 MemoryMonitorControlHandle { inner: self.inner.clone() }
344 }
345
346 fn into_inner(
347 self,
348 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
349 {
350 (self.inner, self.is_terminated)
351 }
352
353 fn from_inner(
354 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
355 is_terminated: bool,
356 ) -> Self {
357 Self { inner, is_terminated }
358 }
359}
360
361impl futures::Stream for MemoryMonitorRequestStream {
362 type Item = Result<MemoryMonitorRequest, fidl::Error>;
363
364 fn poll_next(
365 mut self: std::pin::Pin<&mut Self>,
366 cx: &mut std::task::Context<'_>,
367 ) -> std::task::Poll<Option<Self::Item>> {
368 let this = &mut *self;
369 if this.inner.check_shutdown(cx) {
370 this.is_terminated = true;
371 return std::task::Poll::Ready(None);
372 }
373 if this.is_terminated {
374 panic!("polled MemoryMonitorRequestStream after completion");
375 }
376 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
377 |bytes, handles| {
378 match this.inner.channel().read_etc(cx, bytes, handles) {
379 std::task::Poll::Ready(Ok(())) => {}
380 std::task::Poll::Pending => return std::task::Poll::Pending,
381 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
382 this.is_terminated = true;
383 return std::task::Poll::Ready(None);
384 }
385 std::task::Poll::Ready(Err(e)) => {
386 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
387 e.into(),
388 ))));
389 }
390 }
391
392 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
394
395 std::task::Poll::Ready(Some(match header.ordinal {
396 0x3af6caa4c6a6fdb7 => {
397 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
398 let mut req = fidl::new_empty!(
399 MemoryMonitorGetSnapshotRequest,
400 fidl::encoding::DefaultFuchsiaResourceDialect
401 );
402 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MemoryMonitorGetSnapshotRequest>(&header, _body_bytes, handles, &mut req)?;
403 let control_handle =
404 MemoryMonitorControlHandle { inner: this.inner.clone() };
405 Ok(MemoryMonitorRequest::GetSnapshot {
406 snapshot: req.snapshot,
407
408 control_handle,
409 })
410 }
411 0x33e3c58dc277f92d => {
412 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
413 let mut req = fidl::new_empty!(
414 fidl::encoding::EmptyPayload,
415 fidl::encoding::DefaultFuchsiaResourceDialect
416 );
417 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
418 let control_handle =
419 MemoryMonitorControlHandle { inner: this.inner.clone() };
420 Ok(MemoryMonitorRequest::GetSystemStatistics {
421 responder: MemoryMonitorGetSystemStatisticsResponder {
422 control_handle: std::mem::ManuallyDrop::new(control_handle),
423 tx_id: header.tx_id,
424 },
425 })
426 }
427 0x2dc4ffad72b5fd7e => {
428 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
429 let mut req = fidl::new_empty!(
430 MemoryMonitorGetAbridgedSnapshotRequest,
431 fidl::encoding::DefaultFuchsiaResourceDialect
432 );
433 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MemoryMonitorGetAbridgedSnapshotRequest>(&header, _body_bytes, handles, &mut req)?;
434 let control_handle =
435 MemoryMonitorControlHandle { inner: this.inner.clone() };
436 Ok(MemoryMonitorRequest::GetAbridgedSnapshot {
437 snapshot: req.snapshot,
438
439 control_handle,
440 })
441 }
442 _ if header.tx_id == 0
443 && header
444 .dynamic_flags()
445 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
446 {
447 Ok(MemoryMonitorRequest::_UnknownMethod {
448 ordinal: header.ordinal,
449 control_handle: MemoryMonitorControlHandle {
450 inner: this.inner.clone(),
451 },
452 method_type: fidl::MethodType::OneWay,
453 })
454 }
455 _ if header
456 .dynamic_flags()
457 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
458 {
459 this.inner.send_framework_err(
460 fidl::encoding::FrameworkErr::UnknownMethod,
461 header.tx_id,
462 header.ordinal,
463 header.dynamic_flags(),
464 (bytes, handles),
465 )?;
466 Ok(MemoryMonitorRequest::_UnknownMethod {
467 ordinal: header.ordinal,
468 control_handle: MemoryMonitorControlHandle {
469 inner: this.inner.clone(),
470 },
471 method_type: fidl::MethodType::TwoWay,
472 })
473 }
474 _ => Err(fidl::Error::UnknownOrdinal {
475 ordinal: header.ordinal,
476 protocol_name:
477 <MemoryMonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
478 }),
479 }))
480 },
481 )
482 }
483}
484
485#[derive(Debug)]
486pub enum MemoryMonitorRequest {
487 GetSnapshot { snapshot: fidl::Socket, control_handle: MemoryMonitorControlHandle },
489 GetSystemStatistics { responder: MemoryMonitorGetSystemStatisticsResponder },
492 GetAbridgedSnapshot { snapshot: fidl::Socket, control_handle: MemoryMonitorControlHandle },
494 #[non_exhaustive]
496 _UnknownMethod {
497 ordinal: u64,
499 control_handle: MemoryMonitorControlHandle,
500 method_type: fidl::MethodType,
501 },
502}
503
504impl MemoryMonitorRequest {
505 #[allow(irrefutable_let_patterns)]
506 pub fn into_get_snapshot(self) -> Option<(fidl::Socket, MemoryMonitorControlHandle)> {
507 if let MemoryMonitorRequest::GetSnapshot { snapshot, control_handle } = self {
508 Some((snapshot, control_handle))
509 } else {
510 None
511 }
512 }
513
514 #[allow(irrefutable_let_patterns)]
515 pub fn into_get_system_statistics(self) -> Option<(MemoryMonitorGetSystemStatisticsResponder)> {
516 if let MemoryMonitorRequest::GetSystemStatistics { responder } = self {
517 Some((responder))
518 } else {
519 None
520 }
521 }
522
523 #[allow(irrefutable_let_patterns)]
524 pub fn into_get_abridged_snapshot(self) -> Option<(fidl::Socket, MemoryMonitorControlHandle)> {
525 if let MemoryMonitorRequest::GetAbridgedSnapshot { snapshot, control_handle } = self {
526 Some((snapshot, control_handle))
527 } else {
528 None
529 }
530 }
531
532 pub fn method_name(&self) -> &'static str {
534 match *self {
535 MemoryMonitorRequest::GetSnapshot { .. } => "get_snapshot",
536 MemoryMonitorRequest::GetSystemStatistics { .. } => "get_system_statistics",
537 MemoryMonitorRequest::GetAbridgedSnapshot { .. } => "get_abridged_snapshot",
538 MemoryMonitorRequest::_UnknownMethod {
539 method_type: fidl::MethodType::OneWay, ..
540 } => "unknown one-way method",
541 MemoryMonitorRequest::_UnknownMethod {
542 method_type: fidl::MethodType::TwoWay, ..
543 } => "unknown two-way method",
544 }
545 }
546}
547
548#[derive(Debug, Clone)]
549pub struct MemoryMonitorControlHandle {
550 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
551}
552
553impl fidl::endpoints::ControlHandle for MemoryMonitorControlHandle {
554 fn shutdown(&self) {
555 self.inner.shutdown()
556 }
557
558 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
559 self.inner.shutdown_with_epitaph(status)
560 }
561
562 fn is_closed(&self) -> bool {
563 self.inner.channel().is_closed()
564 }
565 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
566 self.inner.channel().on_closed()
567 }
568
569 #[cfg(target_os = "fuchsia")]
570 fn signal_peer(
571 &self,
572 clear_mask: zx::Signals,
573 set_mask: zx::Signals,
574 ) -> Result<(), zx_status::Status> {
575 use fidl::Peered;
576 self.inner.channel().signal_peer(clear_mask, set_mask)
577 }
578}
579
580impl MemoryMonitorControlHandle {}
581
582#[must_use = "FIDL methods require a response to be sent"]
583#[derive(Debug)]
584pub struct MemoryMonitorGetSystemStatisticsResponder {
585 control_handle: std::mem::ManuallyDrop<MemoryMonitorControlHandle>,
586 tx_id: u32,
587}
588
589impl std::ops::Drop for MemoryMonitorGetSystemStatisticsResponder {
593 fn drop(&mut self) {
594 self.control_handle.shutdown();
595 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
597 }
598}
599
600impl fidl::endpoints::Responder for MemoryMonitorGetSystemStatisticsResponder {
601 type ControlHandle = MemoryMonitorControlHandle;
602
603 fn control_handle(&self) -> &MemoryMonitorControlHandle {
604 &self.control_handle
605 }
606
607 fn drop_without_shutdown(mut self) {
608 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
610 std::mem::forget(self);
612 }
613}
614
615impl MemoryMonitorGetSystemStatisticsResponder {
616 pub fn send(self, mut statistics: &MemoryStatistics) -> Result<(), fidl::Error> {
620 let _result = self.send_raw(statistics);
621 if _result.is_err() {
622 self.control_handle.shutdown();
623 }
624 self.drop_without_shutdown();
625 _result
626 }
627
628 pub fn send_no_shutdown_on_err(
630 self,
631 mut statistics: &MemoryStatistics,
632 ) -> Result<(), fidl::Error> {
633 let _result = self.send_raw(statistics);
634 self.drop_without_shutdown();
635 _result
636 }
637
638 fn send_raw(&self, mut statistics: &MemoryStatistics) -> Result<(), fidl::Error> {
639 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
640 MemoryMonitorGetSystemStatisticsResponse,
641 >>(
642 fidl::encoding::Flexible::new((statistics,)),
643 self.tx_id,
644 0x33e3c58dc277f92d,
645 fidl::encoding::DynamicFlags::FLEXIBLE,
646 )
647 }
648}
649
650mod internal {
651 use super::*;
652
653 impl fidl::encoding::ResourceTypeMarker for MemoryMonitorGetAbridgedSnapshotRequest {
654 type Borrowed<'a> = &'a mut Self;
655 fn take_or_borrow<'a>(
656 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
657 ) -> Self::Borrowed<'a> {
658 value
659 }
660 }
661
662 unsafe impl fidl::encoding::TypeMarker for MemoryMonitorGetAbridgedSnapshotRequest {
663 type Owned = Self;
664
665 #[inline(always)]
666 fn inline_align(_context: fidl::encoding::Context) -> usize {
667 4
668 }
669
670 #[inline(always)]
671 fn inline_size(_context: fidl::encoding::Context) -> usize {
672 4
673 }
674 }
675
676 unsafe impl
677 fidl::encoding::Encode<
678 MemoryMonitorGetAbridgedSnapshotRequest,
679 fidl::encoding::DefaultFuchsiaResourceDialect,
680 > for &mut MemoryMonitorGetAbridgedSnapshotRequest
681 {
682 #[inline]
683 unsafe fn encode(
684 self,
685 encoder: &mut fidl::encoding::Encoder<
686 '_,
687 fidl::encoding::DefaultFuchsiaResourceDialect,
688 >,
689 offset: usize,
690 _depth: fidl::encoding::Depth,
691 ) -> fidl::Result<()> {
692 encoder.debug_check_bounds::<MemoryMonitorGetAbridgedSnapshotRequest>(offset);
693 fidl::encoding::Encode::<
695 MemoryMonitorGetAbridgedSnapshotRequest,
696 fidl::encoding::DefaultFuchsiaResourceDialect,
697 >::encode(
698 (<fidl::encoding::HandleType<
699 fidl::Socket,
700 { fidl::ObjectType::SOCKET.into_raw() },
701 2147483648,
702 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
703 &mut self.snapshot
704 ),),
705 encoder,
706 offset,
707 _depth,
708 )
709 }
710 }
711 unsafe impl<
712 T0: fidl::encoding::Encode<
713 fidl::encoding::HandleType<
714 fidl::Socket,
715 { fidl::ObjectType::SOCKET.into_raw() },
716 2147483648,
717 >,
718 fidl::encoding::DefaultFuchsiaResourceDialect,
719 >,
720 >
721 fidl::encoding::Encode<
722 MemoryMonitorGetAbridgedSnapshotRequest,
723 fidl::encoding::DefaultFuchsiaResourceDialect,
724 > for (T0,)
725 {
726 #[inline]
727 unsafe fn encode(
728 self,
729 encoder: &mut fidl::encoding::Encoder<
730 '_,
731 fidl::encoding::DefaultFuchsiaResourceDialect,
732 >,
733 offset: usize,
734 depth: fidl::encoding::Depth,
735 ) -> fidl::Result<()> {
736 encoder.debug_check_bounds::<MemoryMonitorGetAbridgedSnapshotRequest>(offset);
737 self.0.encode(encoder, offset + 0, depth)?;
741 Ok(())
742 }
743 }
744
745 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
746 for MemoryMonitorGetAbridgedSnapshotRequest
747 {
748 #[inline(always)]
749 fn new_empty() -> Self {
750 Self {
751 snapshot: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
752 }
753 }
754
755 #[inline]
756 unsafe fn decode(
757 &mut self,
758 decoder: &mut fidl::encoding::Decoder<
759 '_,
760 fidl::encoding::DefaultFuchsiaResourceDialect,
761 >,
762 offset: usize,
763 _depth: fidl::encoding::Depth,
764 ) -> fidl::Result<()> {
765 decoder.debug_check_bounds::<Self>(offset);
766 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.snapshot, decoder, offset + 0, _depth)?;
768 Ok(())
769 }
770 }
771
772 impl fidl::encoding::ResourceTypeMarker for MemoryMonitorGetSnapshotRequest {
773 type Borrowed<'a> = &'a mut Self;
774 fn take_or_borrow<'a>(
775 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
776 ) -> Self::Borrowed<'a> {
777 value
778 }
779 }
780
781 unsafe impl fidl::encoding::TypeMarker for MemoryMonitorGetSnapshotRequest {
782 type Owned = Self;
783
784 #[inline(always)]
785 fn inline_align(_context: fidl::encoding::Context) -> usize {
786 4
787 }
788
789 #[inline(always)]
790 fn inline_size(_context: fidl::encoding::Context) -> usize {
791 4
792 }
793 }
794
795 unsafe impl
796 fidl::encoding::Encode<
797 MemoryMonitorGetSnapshotRequest,
798 fidl::encoding::DefaultFuchsiaResourceDialect,
799 > for &mut MemoryMonitorGetSnapshotRequest
800 {
801 #[inline]
802 unsafe fn encode(
803 self,
804 encoder: &mut fidl::encoding::Encoder<
805 '_,
806 fidl::encoding::DefaultFuchsiaResourceDialect,
807 >,
808 offset: usize,
809 _depth: fidl::encoding::Depth,
810 ) -> fidl::Result<()> {
811 encoder.debug_check_bounds::<MemoryMonitorGetSnapshotRequest>(offset);
812 fidl::encoding::Encode::<
814 MemoryMonitorGetSnapshotRequest,
815 fidl::encoding::DefaultFuchsiaResourceDialect,
816 >::encode(
817 (<fidl::encoding::HandleType<
818 fidl::Socket,
819 { fidl::ObjectType::SOCKET.into_raw() },
820 2147483648,
821 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
822 &mut self.snapshot
823 ),),
824 encoder,
825 offset,
826 _depth,
827 )
828 }
829 }
830 unsafe impl<
831 T0: fidl::encoding::Encode<
832 fidl::encoding::HandleType<
833 fidl::Socket,
834 { fidl::ObjectType::SOCKET.into_raw() },
835 2147483648,
836 >,
837 fidl::encoding::DefaultFuchsiaResourceDialect,
838 >,
839 >
840 fidl::encoding::Encode<
841 MemoryMonitorGetSnapshotRequest,
842 fidl::encoding::DefaultFuchsiaResourceDialect,
843 > for (T0,)
844 {
845 #[inline]
846 unsafe fn encode(
847 self,
848 encoder: &mut fidl::encoding::Encoder<
849 '_,
850 fidl::encoding::DefaultFuchsiaResourceDialect,
851 >,
852 offset: usize,
853 depth: fidl::encoding::Depth,
854 ) -> fidl::Result<()> {
855 encoder.debug_check_bounds::<MemoryMonitorGetSnapshotRequest>(offset);
856 self.0.encode(encoder, offset + 0, depth)?;
860 Ok(())
861 }
862 }
863
864 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
865 for MemoryMonitorGetSnapshotRequest
866 {
867 #[inline(always)]
868 fn new_empty() -> Self {
869 Self {
870 snapshot: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
871 }
872 }
873
874 #[inline]
875 unsafe fn decode(
876 &mut self,
877 decoder: &mut fidl::encoding::Decoder<
878 '_,
879 fidl::encoding::DefaultFuchsiaResourceDialect,
880 >,
881 offset: usize,
882 _depth: fidl::encoding::Depth,
883 ) -> fidl::Result<()> {
884 decoder.debug_check_bounds::<Self>(offset);
885 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.snapshot, decoder, offset + 0, _depth)?;
887 Ok(())
888 }
889 }
890}