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 MemoryMonitorControlHandle {
554 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
555 self.inner.shutdown_with_epitaph(status.into())
556 }
557}
558
559impl fidl::endpoints::ControlHandle for MemoryMonitorControlHandle {
560 fn shutdown(&self) {
561 self.inner.shutdown()
562 }
563
564 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
565 self.inner.shutdown_with_epitaph(status)
566 }
567
568 fn is_closed(&self) -> bool {
569 self.inner.channel().is_closed()
570 }
571 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
572 self.inner.channel().on_closed()
573 }
574
575 #[cfg(target_os = "fuchsia")]
576 fn signal_peer(
577 &self,
578 clear_mask: zx::Signals,
579 set_mask: zx::Signals,
580 ) -> Result<(), zx_status::Status> {
581 use fidl::Peered;
582 self.inner.channel().signal_peer(clear_mask, set_mask)
583 }
584}
585
586impl MemoryMonitorControlHandle {}
587
588#[must_use = "FIDL methods require a response to be sent"]
589#[derive(Debug)]
590pub struct MemoryMonitorGetSystemStatisticsResponder {
591 control_handle: std::mem::ManuallyDrop<MemoryMonitorControlHandle>,
592 tx_id: u32,
593}
594
595impl std::ops::Drop for MemoryMonitorGetSystemStatisticsResponder {
599 fn drop(&mut self) {
600 self.control_handle.shutdown();
601 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
603 }
604}
605
606impl fidl::endpoints::Responder for MemoryMonitorGetSystemStatisticsResponder {
607 type ControlHandle = MemoryMonitorControlHandle;
608
609 fn control_handle(&self) -> &MemoryMonitorControlHandle {
610 &self.control_handle
611 }
612
613 fn drop_without_shutdown(mut self) {
614 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
616 std::mem::forget(self);
618 }
619}
620
621impl MemoryMonitorGetSystemStatisticsResponder {
622 pub fn send(self, mut statistics: &MemoryStatistics) -> Result<(), fidl::Error> {
626 let _result = self.send_raw(statistics);
627 if _result.is_err() {
628 self.control_handle.shutdown();
629 }
630 self.drop_without_shutdown();
631 _result
632 }
633
634 pub fn send_no_shutdown_on_err(
636 self,
637 mut statistics: &MemoryStatistics,
638 ) -> Result<(), fidl::Error> {
639 let _result = self.send_raw(statistics);
640 self.drop_without_shutdown();
641 _result
642 }
643
644 fn send_raw(&self, mut statistics: &MemoryStatistics) -> Result<(), fidl::Error> {
645 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
646 MemoryMonitorGetSystemStatisticsResponse,
647 >>(
648 fidl::encoding::Flexible::new((statistics,)),
649 self.tx_id,
650 0x33e3c58dc277f92d,
651 fidl::encoding::DynamicFlags::FLEXIBLE,
652 )
653 }
654}
655
656mod internal {
657 use super::*;
658
659 impl fidl::encoding::ResourceTypeMarker for MemoryMonitorGetAbridgedSnapshotRequest {
660 type Borrowed<'a> = &'a mut Self;
661 fn take_or_borrow<'a>(
662 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
663 ) -> Self::Borrowed<'a> {
664 value
665 }
666 }
667
668 unsafe impl fidl::encoding::TypeMarker for MemoryMonitorGetAbridgedSnapshotRequest {
669 type Owned = Self;
670
671 #[inline(always)]
672 fn inline_align(_context: fidl::encoding::Context) -> usize {
673 4
674 }
675
676 #[inline(always)]
677 fn inline_size(_context: fidl::encoding::Context) -> usize {
678 4
679 }
680 }
681
682 unsafe impl
683 fidl::encoding::Encode<
684 MemoryMonitorGetAbridgedSnapshotRequest,
685 fidl::encoding::DefaultFuchsiaResourceDialect,
686 > for &mut MemoryMonitorGetAbridgedSnapshotRequest
687 {
688 #[inline]
689 unsafe fn encode(
690 self,
691 encoder: &mut fidl::encoding::Encoder<
692 '_,
693 fidl::encoding::DefaultFuchsiaResourceDialect,
694 >,
695 offset: usize,
696 _depth: fidl::encoding::Depth,
697 ) -> fidl::Result<()> {
698 encoder.debug_check_bounds::<MemoryMonitorGetAbridgedSnapshotRequest>(offset);
699 fidl::encoding::Encode::<
701 MemoryMonitorGetAbridgedSnapshotRequest,
702 fidl::encoding::DefaultFuchsiaResourceDialect,
703 >::encode(
704 (<fidl::encoding::HandleType<
705 fidl::Socket,
706 { fidl::ObjectType::SOCKET.into_raw() },
707 2147483648,
708 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
709 &mut self.snapshot
710 ),),
711 encoder,
712 offset,
713 _depth,
714 )
715 }
716 }
717 unsafe impl<
718 T0: fidl::encoding::Encode<
719 fidl::encoding::HandleType<
720 fidl::Socket,
721 { fidl::ObjectType::SOCKET.into_raw() },
722 2147483648,
723 >,
724 fidl::encoding::DefaultFuchsiaResourceDialect,
725 >,
726 >
727 fidl::encoding::Encode<
728 MemoryMonitorGetAbridgedSnapshotRequest,
729 fidl::encoding::DefaultFuchsiaResourceDialect,
730 > for (T0,)
731 {
732 #[inline]
733 unsafe fn encode(
734 self,
735 encoder: &mut fidl::encoding::Encoder<
736 '_,
737 fidl::encoding::DefaultFuchsiaResourceDialect,
738 >,
739 offset: usize,
740 depth: fidl::encoding::Depth,
741 ) -> fidl::Result<()> {
742 encoder.debug_check_bounds::<MemoryMonitorGetAbridgedSnapshotRequest>(offset);
743 self.0.encode(encoder, offset + 0, depth)?;
747 Ok(())
748 }
749 }
750
751 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
752 for MemoryMonitorGetAbridgedSnapshotRequest
753 {
754 #[inline(always)]
755 fn new_empty() -> Self {
756 Self {
757 snapshot: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
758 }
759 }
760
761 #[inline]
762 unsafe fn decode(
763 &mut self,
764 decoder: &mut fidl::encoding::Decoder<
765 '_,
766 fidl::encoding::DefaultFuchsiaResourceDialect,
767 >,
768 offset: usize,
769 _depth: fidl::encoding::Depth,
770 ) -> fidl::Result<()> {
771 decoder.debug_check_bounds::<Self>(offset);
772 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.snapshot, decoder, offset + 0, _depth)?;
774 Ok(())
775 }
776 }
777
778 impl fidl::encoding::ResourceTypeMarker for MemoryMonitorGetSnapshotRequest {
779 type Borrowed<'a> = &'a mut Self;
780 fn take_or_borrow<'a>(
781 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
782 ) -> Self::Borrowed<'a> {
783 value
784 }
785 }
786
787 unsafe impl fidl::encoding::TypeMarker for MemoryMonitorGetSnapshotRequest {
788 type Owned = Self;
789
790 #[inline(always)]
791 fn inline_align(_context: fidl::encoding::Context) -> usize {
792 4
793 }
794
795 #[inline(always)]
796 fn inline_size(_context: fidl::encoding::Context) -> usize {
797 4
798 }
799 }
800
801 unsafe impl
802 fidl::encoding::Encode<
803 MemoryMonitorGetSnapshotRequest,
804 fidl::encoding::DefaultFuchsiaResourceDialect,
805 > for &mut MemoryMonitorGetSnapshotRequest
806 {
807 #[inline]
808 unsafe fn encode(
809 self,
810 encoder: &mut fidl::encoding::Encoder<
811 '_,
812 fidl::encoding::DefaultFuchsiaResourceDialect,
813 >,
814 offset: usize,
815 _depth: fidl::encoding::Depth,
816 ) -> fidl::Result<()> {
817 encoder.debug_check_bounds::<MemoryMonitorGetSnapshotRequest>(offset);
818 fidl::encoding::Encode::<
820 MemoryMonitorGetSnapshotRequest,
821 fidl::encoding::DefaultFuchsiaResourceDialect,
822 >::encode(
823 (<fidl::encoding::HandleType<
824 fidl::Socket,
825 { fidl::ObjectType::SOCKET.into_raw() },
826 2147483648,
827 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
828 &mut self.snapshot
829 ),),
830 encoder,
831 offset,
832 _depth,
833 )
834 }
835 }
836 unsafe impl<
837 T0: fidl::encoding::Encode<
838 fidl::encoding::HandleType<
839 fidl::Socket,
840 { fidl::ObjectType::SOCKET.into_raw() },
841 2147483648,
842 >,
843 fidl::encoding::DefaultFuchsiaResourceDialect,
844 >,
845 >
846 fidl::encoding::Encode<
847 MemoryMonitorGetSnapshotRequest,
848 fidl::encoding::DefaultFuchsiaResourceDialect,
849 > for (T0,)
850 {
851 #[inline]
852 unsafe fn encode(
853 self,
854 encoder: &mut fidl::encoding::Encoder<
855 '_,
856 fidl::encoding::DefaultFuchsiaResourceDialect,
857 >,
858 offset: usize,
859 depth: fidl::encoding::Depth,
860 ) -> fidl::Result<()> {
861 encoder.debug_check_bounds::<MemoryMonitorGetSnapshotRequest>(offset);
862 self.0.encode(encoder, offset + 0, depth)?;
866 Ok(())
867 }
868 }
869
870 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
871 for MemoryMonitorGetSnapshotRequest
872 {
873 #[inline(always)]
874 fn new_empty() -> Self {
875 Self {
876 snapshot: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
877 }
878 }
879
880 #[inline]
881 unsafe fn decode(
882 &mut self,
883 decoder: &mut fidl::encoding::Decoder<
884 '_,
885 fidl::encoding::DefaultFuchsiaResourceDialect,
886 >,
887 offset: usize,
888 _depth: fidl::encoding::Depth,
889 ) -> fidl::Result<()> {
890 decoder.debug_check_bounds::<Self>(offset);
891 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.snapshot, decoder, offset + 0, _depth)?;
893 Ok(())
894 }
895 }
896}