fidl_fuchsia_kernel/
fidl_fuchsia_kernel.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_kernel_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct CounterGetInspectVmoResponse {
16    pub status: i32,
17    pub buffer: fidl_fuchsia_mem::Buffer,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for CounterGetInspectVmoResponse
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct CpuResourceGetResponse {
27    pub resource: fidl::Resource,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CpuResourceGetResponse {}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct DebugResourceGetResponse {
34    pub resource: fidl::Resource,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugResourceGetResponse {}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct DebuglogResourceGetResponse {
41    pub resource: fidl::Resource,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for DebuglogResourceGetResponse
46{
47}
48
49#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct EnergyInfoResourceGetResponse {
51    pub resource: fidl::Resource,
52}
53
54impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
55    for EnergyInfoResourceGetResponse
56{
57}
58
59#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
60pub struct HypervisorResourceGetResponse {
61    pub resource: fidl::Resource,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
65    for HypervisorResourceGetResponse
66{
67}
68
69#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct InfoResourceGetResponse {
71    pub resource: fidl::Resource,
72}
73
74impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InfoResourceGetResponse {}
75
76#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct IommuResourceGetResponse {
78    pub resource: fidl::Resource,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IommuResourceGetResponse {}
82
83#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
84pub struct IoportResourceGetResponse {
85    pub resource: fidl::Resource,
86}
87
88impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IoportResourceGetResponse {}
89
90#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91pub struct IrqResourceGetResponse {
92    pub resource: fidl::Resource,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IrqResourceGetResponse {}
96
97#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct MexecResourceGetResponse {
99    pub resource: fidl::Resource,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MexecResourceGetResponse {}
103
104#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct MmioResourceGetResponse {
106    pub resource: fidl::Resource,
107}
108
109impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MmioResourceGetResponse {}
110
111#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
112pub struct MsiResourceGetResponse {
113    pub resource: fidl::Resource,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MsiResourceGetResponse {}
117
118#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct PowerResourceGetResponse {
120    pub resource: fidl::Resource,
121}
122
123impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PowerResourceGetResponse {}
124
125#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
126pub struct ProfileResourceGetResponse {
127    pub resource: fidl::Resource,
128}
129
130impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
131    for ProfileResourceGetResponse
132{
133}
134
135#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
136pub struct RootJobGetResponse {
137    pub job: fidl::Job,
138}
139
140impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RootJobGetResponse {}
141
142#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
143pub struct SmcResourceGetResponse {
144    pub resource: fidl::Resource,
145}
146
147impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SmcResourceGetResponse {}
148
149#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
150pub struct StallResourceGetResponse {
151    pub resource: fidl::Resource,
152}
153
154impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StallResourceGetResponse {}
155
156#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
157pub struct TracingResourceGetResponse {
158    pub resource: fidl::Resource,
159}
160
161impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
162    for TracingResourceGetResponse
163{
164}
165
166#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
167pub struct VmexResourceGetResponse {
168    pub resource: fidl::Resource,
169}
170
171impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VmexResourceGetResponse {}
172
173#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
174pub struct CounterMarker;
175
176impl fidl::endpoints::ProtocolMarker for CounterMarker {
177    type Proxy = CounterProxy;
178    type RequestStream = CounterRequestStream;
179    #[cfg(target_os = "fuchsia")]
180    type SynchronousProxy = CounterSynchronousProxy;
181
182    const DEBUG_NAME: &'static str = "fuchsia.kernel.Counter";
183}
184impl fidl::endpoints::DiscoverableProtocolMarker for CounterMarker {}
185
186pub trait CounterProxyInterface: Send + Sync {
187    type GetInspectVmoResponseFut: std::future::Future<Output = Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error>>
188        + Send;
189    fn r#get_inspect_vmo(&self) -> Self::GetInspectVmoResponseFut;
190    type UpdateInspectVmoResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
191    fn r#update_inspect_vmo(&self) -> Self::UpdateInspectVmoResponseFut;
192}
193#[derive(Debug)]
194#[cfg(target_os = "fuchsia")]
195pub struct CounterSynchronousProxy {
196    client: fidl::client::sync::Client,
197}
198
199#[cfg(target_os = "fuchsia")]
200impl fidl::endpoints::SynchronousProxy for CounterSynchronousProxy {
201    type Proxy = CounterProxy;
202    type Protocol = CounterMarker;
203
204    fn from_channel(inner: fidl::Channel) -> Self {
205        Self::new(inner)
206    }
207
208    fn into_channel(self) -> fidl::Channel {
209        self.client.into_channel()
210    }
211
212    fn as_channel(&self) -> &fidl::Channel {
213        self.client.as_channel()
214    }
215}
216
217#[cfg(target_os = "fuchsia")]
218impl CounterSynchronousProxy {
219    pub fn new(channel: fidl::Channel) -> Self {
220        let protocol_name = <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
221        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
222    }
223
224    pub fn into_channel(self) -> fidl::Channel {
225        self.client.into_channel()
226    }
227
228    /// Waits until an event arrives and returns it. It is safe for other
229    /// threads to make concurrent requests while waiting for an event.
230    pub fn wait_for_event(
231        &self,
232        deadline: zx::MonotonicInstant,
233    ) -> Result<CounterEvent, fidl::Error> {
234        CounterEvent::decode(self.client.wait_for_event(deadline)?)
235    }
236
237    /// Retrives a VMO containining summarized kcounter data. The vmo returned
238    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
239    pub fn r#get_inspect_vmo(
240        &self,
241        ___deadline: zx::MonotonicInstant,
242    ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
243        let _response =
244            self.client.send_query::<fidl::encoding::EmptyPayload, CounterGetInspectVmoResponse>(
245                (),
246                0x6ea9b2e6b2791b81,
247                fidl::encoding::DynamicFlags::empty(),
248                ___deadline,
249            )?;
250        Ok((_response.status, _response.buffer))
251    }
252
253    /// Request that the previously-returned VMO buffer's data be updated. The
254    /// data may not be updated if it was already recently updated (updates are
255    /// limited to an unspecified rate, but approximately every few seconds).
256    pub fn r#update_inspect_vmo(
257        &self,
258        ___deadline: zx::MonotonicInstant,
259    ) -> Result<i32, fidl::Error> {
260        let _response = self
261            .client
262            .send_query::<fidl::encoding::EmptyPayload, CounterUpdateInspectVmoResponse>(
263                (),
264                0x1d25eb7995a0539f,
265                fidl::encoding::DynamicFlags::empty(),
266                ___deadline,
267            )?;
268        Ok(_response.status)
269    }
270}
271
272#[derive(Debug, Clone)]
273pub struct CounterProxy {
274    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
275}
276
277impl fidl::endpoints::Proxy for CounterProxy {
278    type Protocol = CounterMarker;
279
280    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
281        Self::new(inner)
282    }
283
284    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
285        self.client.into_channel().map_err(|client| Self { client })
286    }
287
288    fn as_channel(&self) -> &::fidl::AsyncChannel {
289        self.client.as_channel()
290    }
291}
292
293impl CounterProxy {
294    /// Create a new Proxy for fuchsia.kernel/Counter.
295    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
296        let protocol_name = <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
297        Self { client: fidl::client::Client::new(channel, protocol_name) }
298    }
299
300    /// Get a Stream of events from the remote end of the protocol.
301    ///
302    /// # Panics
303    ///
304    /// Panics if the event stream was already taken.
305    pub fn take_event_stream(&self) -> CounterEventStream {
306        CounterEventStream { event_receiver: self.client.take_event_receiver() }
307    }
308
309    /// Retrives a VMO containining summarized kcounter data. The vmo returned
310    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
311    pub fn r#get_inspect_vmo(
312        &self,
313    ) -> fidl::client::QueryResponseFut<
314        (i32, fidl_fuchsia_mem::Buffer),
315        fidl::encoding::DefaultFuchsiaResourceDialect,
316    > {
317        CounterProxyInterface::r#get_inspect_vmo(self)
318    }
319
320    /// Request that the previously-returned VMO buffer's data be updated. The
321    /// data may not be updated if it was already recently updated (updates are
322    /// limited to an unspecified rate, but approximately every few seconds).
323    pub fn r#update_inspect_vmo(
324        &self,
325    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
326        CounterProxyInterface::r#update_inspect_vmo(self)
327    }
328}
329
330impl CounterProxyInterface for CounterProxy {
331    type GetInspectVmoResponseFut = fidl::client::QueryResponseFut<
332        (i32, fidl_fuchsia_mem::Buffer),
333        fidl::encoding::DefaultFuchsiaResourceDialect,
334    >;
335    fn r#get_inspect_vmo(&self) -> Self::GetInspectVmoResponseFut {
336        fn _decode(
337            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
338        ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
339            let _response = fidl::client::decode_transaction_body::<
340                CounterGetInspectVmoResponse,
341                fidl::encoding::DefaultFuchsiaResourceDialect,
342                0x6ea9b2e6b2791b81,
343            >(_buf?)?;
344            Ok((_response.status, _response.buffer))
345        }
346        self.client
347            .send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, fidl_fuchsia_mem::Buffer)>(
348                (),
349                0x6ea9b2e6b2791b81,
350                fidl::encoding::DynamicFlags::empty(),
351                _decode,
352            )
353    }
354
355    type UpdateInspectVmoResponseFut =
356        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
357    fn r#update_inspect_vmo(&self) -> Self::UpdateInspectVmoResponseFut {
358        fn _decode(
359            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
360        ) -> Result<i32, fidl::Error> {
361            let _response = fidl::client::decode_transaction_body::<
362                CounterUpdateInspectVmoResponse,
363                fidl::encoding::DefaultFuchsiaResourceDialect,
364                0x1d25eb7995a0539f,
365            >(_buf?)?;
366            Ok(_response.status)
367        }
368        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
369            (),
370            0x1d25eb7995a0539f,
371            fidl::encoding::DynamicFlags::empty(),
372            _decode,
373        )
374    }
375}
376
377pub struct CounterEventStream {
378    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
379}
380
381impl std::marker::Unpin for CounterEventStream {}
382
383impl futures::stream::FusedStream for CounterEventStream {
384    fn is_terminated(&self) -> bool {
385        self.event_receiver.is_terminated()
386    }
387}
388
389impl futures::Stream for CounterEventStream {
390    type Item = Result<CounterEvent, fidl::Error>;
391
392    fn poll_next(
393        mut self: std::pin::Pin<&mut Self>,
394        cx: &mut std::task::Context<'_>,
395    ) -> std::task::Poll<Option<Self::Item>> {
396        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
397            &mut self.event_receiver,
398            cx
399        )?) {
400            Some(buf) => std::task::Poll::Ready(Some(CounterEvent::decode(buf))),
401            None => std::task::Poll::Ready(None),
402        }
403    }
404}
405
406#[derive(Debug)]
407pub enum CounterEvent {}
408
409impl CounterEvent {
410    /// Decodes a message buffer as a [`CounterEvent`].
411    fn decode(
412        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
413    ) -> Result<CounterEvent, fidl::Error> {
414        let (bytes, _handles) = buf.split_mut();
415        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
416        debug_assert_eq!(tx_header.tx_id, 0);
417        match tx_header.ordinal {
418            _ => Err(fidl::Error::UnknownOrdinal {
419                ordinal: tx_header.ordinal,
420                protocol_name: <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
421            }),
422        }
423    }
424}
425
426/// A Stream of incoming requests for fuchsia.kernel/Counter.
427pub struct CounterRequestStream {
428    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
429    is_terminated: bool,
430}
431
432impl std::marker::Unpin for CounterRequestStream {}
433
434impl futures::stream::FusedStream for CounterRequestStream {
435    fn is_terminated(&self) -> bool {
436        self.is_terminated
437    }
438}
439
440impl fidl::endpoints::RequestStream for CounterRequestStream {
441    type Protocol = CounterMarker;
442    type ControlHandle = CounterControlHandle;
443
444    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
445        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
446    }
447
448    fn control_handle(&self) -> Self::ControlHandle {
449        CounterControlHandle { inner: self.inner.clone() }
450    }
451
452    fn into_inner(
453        self,
454    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
455    {
456        (self.inner, self.is_terminated)
457    }
458
459    fn from_inner(
460        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
461        is_terminated: bool,
462    ) -> Self {
463        Self { inner, is_terminated }
464    }
465}
466
467impl futures::Stream for CounterRequestStream {
468    type Item = Result<CounterRequest, fidl::Error>;
469
470    fn poll_next(
471        mut self: std::pin::Pin<&mut Self>,
472        cx: &mut std::task::Context<'_>,
473    ) -> std::task::Poll<Option<Self::Item>> {
474        let this = &mut *self;
475        if this.inner.check_shutdown(cx) {
476            this.is_terminated = true;
477            return std::task::Poll::Ready(None);
478        }
479        if this.is_terminated {
480            panic!("polled CounterRequestStream after completion");
481        }
482        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
483            |bytes, handles| {
484                match this.inner.channel().read_etc(cx, bytes, handles) {
485                    std::task::Poll::Ready(Ok(())) => {}
486                    std::task::Poll::Pending => return std::task::Poll::Pending,
487                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
488                        this.is_terminated = true;
489                        return std::task::Poll::Ready(None);
490                    }
491                    std::task::Poll::Ready(Err(e)) => {
492                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
493                            e.into(),
494                        ))))
495                    }
496                }
497
498                // A message has been received from the channel
499                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
500
501                std::task::Poll::Ready(Some(match header.ordinal {
502                    0x6ea9b2e6b2791b81 => {
503                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
504                        let mut req = fidl::new_empty!(
505                            fidl::encoding::EmptyPayload,
506                            fidl::encoding::DefaultFuchsiaResourceDialect
507                        );
508                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
509                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
510                        Ok(CounterRequest::GetInspectVmo {
511                            responder: CounterGetInspectVmoResponder {
512                                control_handle: std::mem::ManuallyDrop::new(control_handle),
513                                tx_id: header.tx_id,
514                            },
515                        })
516                    }
517                    0x1d25eb7995a0539f => {
518                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
519                        let mut req = fidl::new_empty!(
520                            fidl::encoding::EmptyPayload,
521                            fidl::encoding::DefaultFuchsiaResourceDialect
522                        );
523                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
524                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
525                        Ok(CounterRequest::UpdateInspectVmo {
526                            responder: CounterUpdateInspectVmoResponder {
527                                control_handle: std::mem::ManuallyDrop::new(control_handle),
528                                tx_id: header.tx_id,
529                            },
530                        })
531                    }
532                    _ => Err(fidl::Error::UnknownOrdinal {
533                        ordinal: header.ordinal,
534                        protocol_name:
535                            <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
536                    }),
537                }))
538            },
539        )
540    }
541}
542
543/// Protocol for retrieving kcounter information.
544#[derive(Debug)]
545pub enum CounterRequest {
546    /// Retrives a VMO containining summarized kcounter data. The vmo returned
547    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
548    GetInspectVmo { responder: CounterGetInspectVmoResponder },
549    /// Request that the previously-returned VMO buffer's data be updated. The
550    /// data may not be updated if it was already recently updated (updates are
551    /// limited to an unspecified rate, but approximately every few seconds).
552    UpdateInspectVmo { responder: CounterUpdateInspectVmoResponder },
553}
554
555impl CounterRequest {
556    #[allow(irrefutable_let_patterns)]
557    pub fn into_get_inspect_vmo(self) -> Option<(CounterGetInspectVmoResponder)> {
558        if let CounterRequest::GetInspectVmo { responder } = self {
559            Some((responder))
560        } else {
561            None
562        }
563    }
564
565    #[allow(irrefutable_let_patterns)]
566    pub fn into_update_inspect_vmo(self) -> Option<(CounterUpdateInspectVmoResponder)> {
567        if let CounterRequest::UpdateInspectVmo { responder } = self {
568            Some((responder))
569        } else {
570            None
571        }
572    }
573
574    /// Name of the method defined in FIDL
575    pub fn method_name(&self) -> &'static str {
576        match *self {
577            CounterRequest::GetInspectVmo { .. } => "get_inspect_vmo",
578            CounterRequest::UpdateInspectVmo { .. } => "update_inspect_vmo",
579        }
580    }
581}
582
583#[derive(Debug, Clone)]
584pub struct CounterControlHandle {
585    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
586}
587
588impl fidl::endpoints::ControlHandle for CounterControlHandle {
589    fn shutdown(&self) {
590        self.inner.shutdown()
591    }
592    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
593        self.inner.shutdown_with_epitaph(status)
594    }
595
596    fn is_closed(&self) -> bool {
597        self.inner.channel().is_closed()
598    }
599    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
600        self.inner.channel().on_closed()
601    }
602
603    #[cfg(target_os = "fuchsia")]
604    fn signal_peer(
605        &self,
606        clear_mask: zx::Signals,
607        set_mask: zx::Signals,
608    ) -> Result<(), zx_status::Status> {
609        use fidl::Peered;
610        self.inner.channel().signal_peer(clear_mask, set_mask)
611    }
612}
613
614impl CounterControlHandle {}
615
616#[must_use = "FIDL methods require a response to be sent"]
617#[derive(Debug)]
618pub struct CounterGetInspectVmoResponder {
619    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
620    tx_id: u32,
621}
622
623/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
624/// if the responder is dropped without sending a response, so that the client
625/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
626impl std::ops::Drop for CounterGetInspectVmoResponder {
627    fn drop(&mut self) {
628        self.control_handle.shutdown();
629        // Safety: drops once, never accessed again
630        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
631    }
632}
633
634impl fidl::endpoints::Responder for CounterGetInspectVmoResponder {
635    type ControlHandle = CounterControlHandle;
636
637    fn control_handle(&self) -> &CounterControlHandle {
638        &self.control_handle
639    }
640
641    fn drop_without_shutdown(mut self) {
642        // Safety: drops once, never accessed again due to mem::forget
643        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
644        // Prevent Drop from running (which would shut down the channel)
645        std::mem::forget(self);
646    }
647}
648
649impl CounterGetInspectVmoResponder {
650    /// Sends a response to the FIDL transaction.
651    ///
652    /// Sets the channel to shutdown if an error occurs.
653    pub fn send(
654        self,
655        mut status: i32,
656        mut buffer: fidl_fuchsia_mem::Buffer,
657    ) -> Result<(), fidl::Error> {
658        let _result = self.send_raw(status, buffer);
659        if _result.is_err() {
660            self.control_handle.shutdown();
661        }
662        self.drop_without_shutdown();
663        _result
664    }
665
666    /// Similar to "send" but does not shutdown the channel if an error occurs.
667    pub fn send_no_shutdown_on_err(
668        self,
669        mut status: i32,
670        mut buffer: fidl_fuchsia_mem::Buffer,
671    ) -> Result<(), fidl::Error> {
672        let _result = self.send_raw(status, buffer);
673        self.drop_without_shutdown();
674        _result
675    }
676
677    fn send_raw(
678        &self,
679        mut status: i32,
680        mut buffer: fidl_fuchsia_mem::Buffer,
681    ) -> Result<(), fidl::Error> {
682        self.control_handle.inner.send::<CounterGetInspectVmoResponse>(
683            (status, &mut buffer),
684            self.tx_id,
685            0x6ea9b2e6b2791b81,
686            fidl::encoding::DynamicFlags::empty(),
687        )
688    }
689}
690
691#[must_use = "FIDL methods require a response to be sent"]
692#[derive(Debug)]
693pub struct CounterUpdateInspectVmoResponder {
694    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
695    tx_id: u32,
696}
697
698/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
699/// if the responder is dropped without sending a response, so that the client
700/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
701impl std::ops::Drop for CounterUpdateInspectVmoResponder {
702    fn drop(&mut self) {
703        self.control_handle.shutdown();
704        // Safety: drops once, never accessed again
705        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
706    }
707}
708
709impl fidl::endpoints::Responder for CounterUpdateInspectVmoResponder {
710    type ControlHandle = CounterControlHandle;
711
712    fn control_handle(&self) -> &CounterControlHandle {
713        &self.control_handle
714    }
715
716    fn drop_without_shutdown(mut self) {
717        // Safety: drops once, never accessed again due to mem::forget
718        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
719        // Prevent Drop from running (which would shut down the channel)
720        std::mem::forget(self);
721    }
722}
723
724impl CounterUpdateInspectVmoResponder {
725    /// Sends a response to the FIDL transaction.
726    ///
727    /// Sets the channel to shutdown if an error occurs.
728    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
729        let _result = self.send_raw(status);
730        if _result.is_err() {
731            self.control_handle.shutdown();
732        }
733        self.drop_without_shutdown();
734        _result
735    }
736
737    /// Similar to "send" but does not shutdown the channel if an error occurs.
738    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
739        let _result = self.send_raw(status);
740        self.drop_without_shutdown();
741        _result
742    }
743
744    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
745        self.control_handle.inner.send::<CounterUpdateInspectVmoResponse>(
746            (status,),
747            self.tx_id,
748            0x1d25eb7995a0539f,
749            fidl::encoding::DynamicFlags::empty(),
750        )
751    }
752}
753
754#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
755pub struct CpuResourceMarker;
756
757impl fidl::endpoints::ProtocolMarker for CpuResourceMarker {
758    type Proxy = CpuResourceProxy;
759    type RequestStream = CpuResourceRequestStream;
760    #[cfg(target_os = "fuchsia")]
761    type SynchronousProxy = CpuResourceSynchronousProxy;
762
763    const DEBUG_NAME: &'static str = "fuchsia.kernel.CpuResource";
764}
765impl fidl::endpoints::DiscoverableProtocolMarker for CpuResourceMarker {}
766
767pub trait CpuResourceProxyInterface: Send + Sync {
768    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
769    fn r#get(&self) -> Self::GetResponseFut;
770}
771#[derive(Debug)]
772#[cfg(target_os = "fuchsia")]
773pub struct CpuResourceSynchronousProxy {
774    client: fidl::client::sync::Client,
775}
776
777#[cfg(target_os = "fuchsia")]
778impl fidl::endpoints::SynchronousProxy for CpuResourceSynchronousProxy {
779    type Proxy = CpuResourceProxy;
780    type Protocol = CpuResourceMarker;
781
782    fn from_channel(inner: fidl::Channel) -> Self {
783        Self::new(inner)
784    }
785
786    fn into_channel(self) -> fidl::Channel {
787        self.client.into_channel()
788    }
789
790    fn as_channel(&self) -> &fidl::Channel {
791        self.client.as_channel()
792    }
793}
794
795#[cfg(target_os = "fuchsia")]
796impl CpuResourceSynchronousProxy {
797    pub fn new(channel: fidl::Channel) -> Self {
798        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
799        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
800    }
801
802    pub fn into_channel(self) -> fidl::Channel {
803        self.client.into_channel()
804    }
805
806    /// Waits until an event arrives and returns it. It is safe for other
807    /// threads to make concurrent requests while waiting for an event.
808    pub fn wait_for_event(
809        &self,
810        deadline: zx::MonotonicInstant,
811    ) -> Result<CpuResourceEvent, fidl::Error> {
812        CpuResourceEvent::decode(self.client.wait_for_event(deadline)?)
813    }
814
815    /// Get a CPU resource handle.
816    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
817        let _response =
818            self.client.send_query::<fidl::encoding::EmptyPayload, CpuResourceGetResponse>(
819                (),
820                0x41e1103acf4215e4,
821                fidl::encoding::DynamicFlags::empty(),
822                ___deadline,
823            )?;
824        Ok(_response.resource)
825    }
826}
827
828#[derive(Debug, Clone)]
829pub struct CpuResourceProxy {
830    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
831}
832
833impl fidl::endpoints::Proxy for CpuResourceProxy {
834    type Protocol = CpuResourceMarker;
835
836    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
837        Self::new(inner)
838    }
839
840    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
841        self.client.into_channel().map_err(|client| Self { client })
842    }
843
844    fn as_channel(&self) -> &::fidl::AsyncChannel {
845        self.client.as_channel()
846    }
847}
848
849impl CpuResourceProxy {
850    /// Create a new Proxy for fuchsia.kernel/CpuResource.
851    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
852        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
853        Self { client: fidl::client::Client::new(channel, protocol_name) }
854    }
855
856    /// Get a Stream of events from the remote end of the protocol.
857    ///
858    /// # Panics
859    ///
860    /// Panics if the event stream was already taken.
861    pub fn take_event_stream(&self) -> CpuResourceEventStream {
862        CpuResourceEventStream { event_receiver: self.client.take_event_receiver() }
863    }
864
865    /// Get a CPU resource handle.
866    pub fn r#get(
867        &self,
868    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
869    {
870        CpuResourceProxyInterface::r#get(self)
871    }
872}
873
874impl CpuResourceProxyInterface for CpuResourceProxy {
875    type GetResponseFut = fidl::client::QueryResponseFut<
876        fidl::Resource,
877        fidl::encoding::DefaultFuchsiaResourceDialect,
878    >;
879    fn r#get(&self) -> Self::GetResponseFut {
880        fn _decode(
881            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
882        ) -> Result<fidl::Resource, fidl::Error> {
883            let _response = fidl::client::decode_transaction_body::<
884                CpuResourceGetResponse,
885                fidl::encoding::DefaultFuchsiaResourceDialect,
886                0x41e1103acf4215e4,
887            >(_buf?)?;
888            Ok(_response.resource)
889        }
890        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
891            (),
892            0x41e1103acf4215e4,
893            fidl::encoding::DynamicFlags::empty(),
894            _decode,
895        )
896    }
897}
898
899pub struct CpuResourceEventStream {
900    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
901}
902
903impl std::marker::Unpin for CpuResourceEventStream {}
904
905impl futures::stream::FusedStream for CpuResourceEventStream {
906    fn is_terminated(&self) -> bool {
907        self.event_receiver.is_terminated()
908    }
909}
910
911impl futures::Stream for CpuResourceEventStream {
912    type Item = Result<CpuResourceEvent, fidl::Error>;
913
914    fn poll_next(
915        mut self: std::pin::Pin<&mut Self>,
916        cx: &mut std::task::Context<'_>,
917    ) -> std::task::Poll<Option<Self::Item>> {
918        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
919            &mut self.event_receiver,
920            cx
921        )?) {
922            Some(buf) => std::task::Poll::Ready(Some(CpuResourceEvent::decode(buf))),
923            None => std::task::Poll::Ready(None),
924        }
925    }
926}
927
928#[derive(Debug)]
929pub enum CpuResourceEvent {}
930
931impl CpuResourceEvent {
932    /// Decodes a message buffer as a [`CpuResourceEvent`].
933    fn decode(
934        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
935    ) -> Result<CpuResourceEvent, fidl::Error> {
936        let (bytes, _handles) = buf.split_mut();
937        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
938        debug_assert_eq!(tx_header.tx_id, 0);
939        match tx_header.ordinal {
940            _ => Err(fidl::Error::UnknownOrdinal {
941                ordinal: tx_header.ordinal,
942                protocol_name: <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
943            }),
944        }
945    }
946}
947
948/// A Stream of incoming requests for fuchsia.kernel/CpuResource.
949pub struct CpuResourceRequestStream {
950    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
951    is_terminated: bool,
952}
953
954impl std::marker::Unpin for CpuResourceRequestStream {}
955
956impl futures::stream::FusedStream for CpuResourceRequestStream {
957    fn is_terminated(&self) -> bool {
958        self.is_terminated
959    }
960}
961
962impl fidl::endpoints::RequestStream for CpuResourceRequestStream {
963    type Protocol = CpuResourceMarker;
964    type ControlHandle = CpuResourceControlHandle;
965
966    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
967        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
968    }
969
970    fn control_handle(&self) -> Self::ControlHandle {
971        CpuResourceControlHandle { inner: self.inner.clone() }
972    }
973
974    fn into_inner(
975        self,
976    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
977    {
978        (self.inner, self.is_terminated)
979    }
980
981    fn from_inner(
982        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
983        is_terminated: bool,
984    ) -> Self {
985        Self { inner, is_terminated }
986    }
987}
988
989impl futures::Stream for CpuResourceRequestStream {
990    type Item = Result<CpuResourceRequest, fidl::Error>;
991
992    fn poll_next(
993        mut self: std::pin::Pin<&mut Self>,
994        cx: &mut std::task::Context<'_>,
995    ) -> std::task::Poll<Option<Self::Item>> {
996        let this = &mut *self;
997        if this.inner.check_shutdown(cx) {
998            this.is_terminated = true;
999            return std::task::Poll::Ready(None);
1000        }
1001        if this.is_terminated {
1002            panic!("polled CpuResourceRequestStream after completion");
1003        }
1004        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1005            |bytes, handles| {
1006                match this.inner.channel().read_etc(cx, bytes, handles) {
1007                    std::task::Poll::Ready(Ok(())) => {}
1008                    std::task::Poll::Pending => return std::task::Poll::Pending,
1009                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1010                        this.is_terminated = true;
1011                        return std::task::Poll::Ready(None);
1012                    }
1013                    std::task::Poll::Ready(Err(e)) => {
1014                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1015                            e.into(),
1016                        ))))
1017                    }
1018                }
1019
1020                // A message has been received from the channel
1021                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1022
1023                std::task::Poll::Ready(Some(match header.ordinal {
1024                    0x41e1103acf4215e4 => {
1025                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1026                        let mut req = fidl::new_empty!(
1027                            fidl::encoding::EmptyPayload,
1028                            fidl::encoding::DefaultFuchsiaResourceDialect
1029                        );
1030                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1031                        let control_handle = CpuResourceControlHandle { inner: this.inner.clone() };
1032                        Ok(CpuResourceRequest::Get {
1033                            responder: CpuResourceGetResponder {
1034                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1035                                tx_id: header.tx_id,
1036                            },
1037                        })
1038                    }
1039                    _ => Err(fidl::Error::UnknownOrdinal {
1040                        ordinal: header.ordinal,
1041                        protocol_name:
1042                            <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1043                    }),
1044                }))
1045            },
1046        )
1047    }
1048}
1049
1050/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
1051/// `ZX_RSRC_SYSTEM_CPU_BASE`.
1052#[derive(Debug)]
1053pub enum CpuResourceRequest {
1054    /// Get a CPU resource handle.
1055    Get { responder: CpuResourceGetResponder },
1056}
1057
1058impl CpuResourceRequest {
1059    #[allow(irrefutable_let_patterns)]
1060    pub fn into_get(self) -> Option<(CpuResourceGetResponder)> {
1061        if let CpuResourceRequest::Get { responder } = self {
1062            Some((responder))
1063        } else {
1064            None
1065        }
1066    }
1067
1068    /// Name of the method defined in FIDL
1069    pub fn method_name(&self) -> &'static str {
1070        match *self {
1071            CpuResourceRequest::Get { .. } => "get",
1072        }
1073    }
1074}
1075
1076#[derive(Debug, Clone)]
1077pub struct CpuResourceControlHandle {
1078    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1079}
1080
1081impl fidl::endpoints::ControlHandle for CpuResourceControlHandle {
1082    fn shutdown(&self) {
1083        self.inner.shutdown()
1084    }
1085    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1086        self.inner.shutdown_with_epitaph(status)
1087    }
1088
1089    fn is_closed(&self) -> bool {
1090        self.inner.channel().is_closed()
1091    }
1092    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1093        self.inner.channel().on_closed()
1094    }
1095
1096    #[cfg(target_os = "fuchsia")]
1097    fn signal_peer(
1098        &self,
1099        clear_mask: zx::Signals,
1100        set_mask: zx::Signals,
1101    ) -> Result<(), zx_status::Status> {
1102        use fidl::Peered;
1103        self.inner.channel().signal_peer(clear_mask, set_mask)
1104    }
1105}
1106
1107impl CpuResourceControlHandle {}
1108
1109#[must_use = "FIDL methods require a response to be sent"]
1110#[derive(Debug)]
1111pub struct CpuResourceGetResponder {
1112    control_handle: std::mem::ManuallyDrop<CpuResourceControlHandle>,
1113    tx_id: u32,
1114}
1115
1116/// Set the the channel to be shutdown (see [`CpuResourceControlHandle::shutdown`])
1117/// if the responder is dropped without sending a response, so that the client
1118/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1119impl std::ops::Drop for CpuResourceGetResponder {
1120    fn drop(&mut self) {
1121        self.control_handle.shutdown();
1122        // Safety: drops once, never accessed again
1123        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1124    }
1125}
1126
1127impl fidl::endpoints::Responder for CpuResourceGetResponder {
1128    type ControlHandle = CpuResourceControlHandle;
1129
1130    fn control_handle(&self) -> &CpuResourceControlHandle {
1131        &self.control_handle
1132    }
1133
1134    fn drop_without_shutdown(mut self) {
1135        // Safety: drops once, never accessed again due to mem::forget
1136        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1137        // Prevent Drop from running (which would shut down the channel)
1138        std::mem::forget(self);
1139    }
1140}
1141
1142impl CpuResourceGetResponder {
1143    /// Sends a response to the FIDL transaction.
1144    ///
1145    /// Sets the channel to shutdown if an error occurs.
1146    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1147        let _result = self.send_raw(resource);
1148        if _result.is_err() {
1149            self.control_handle.shutdown();
1150        }
1151        self.drop_without_shutdown();
1152        _result
1153    }
1154
1155    /// Similar to "send" but does not shutdown the channel if an error occurs.
1156    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1157        let _result = self.send_raw(resource);
1158        self.drop_without_shutdown();
1159        _result
1160    }
1161
1162    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1163        self.control_handle.inner.send::<CpuResourceGetResponse>(
1164            (resource,),
1165            self.tx_id,
1166            0x41e1103acf4215e4,
1167            fidl::encoding::DynamicFlags::empty(),
1168        )
1169    }
1170}
1171
1172#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1173pub struct DebugBrokerMarker;
1174
1175impl fidl::endpoints::ProtocolMarker for DebugBrokerMarker {
1176    type Proxy = DebugBrokerProxy;
1177    type RequestStream = DebugBrokerRequestStream;
1178    #[cfg(target_os = "fuchsia")]
1179    type SynchronousProxy = DebugBrokerSynchronousProxy;
1180
1181    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugBroker";
1182}
1183impl fidl::endpoints::DiscoverableProtocolMarker for DebugBrokerMarker {}
1184
1185pub trait DebugBrokerProxyInterface: Send + Sync {
1186    type SendDebugCommandResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1187    fn r#send_debug_command(&self, command: &str) -> Self::SendDebugCommandResponseFut;
1188    type SetTracingEnabledResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1189    fn r#set_tracing_enabled(&self, enabled: bool) -> Self::SetTracingEnabledResponseFut;
1190}
1191#[derive(Debug)]
1192#[cfg(target_os = "fuchsia")]
1193pub struct DebugBrokerSynchronousProxy {
1194    client: fidl::client::sync::Client,
1195}
1196
1197#[cfg(target_os = "fuchsia")]
1198impl fidl::endpoints::SynchronousProxy for DebugBrokerSynchronousProxy {
1199    type Proxy = DebugBrokerProxy;
1200    type Protocol = DebugBrokerMarker;
1201
1202    fn from_channel(inner: fidl::Channel) -> Self {
1203        Self::new(inner)
1204    }
1205
1206    fn into_channel(self) -> fidl::Channel {
1207        self.client.into_channel()
1208    }
1209
1210    fn as_channel(&self) -> &fidl::Channel {
1211        self.client.as_channel()
1212    }
1213}
1214
1215#[cfg(target_os = "fuchsia")]
1216impl DebugBrokerSynchronousProxy {
1217    pub fn new(channel: fidl::Channel) -> Self {
1218        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1219        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1220    }
1221
1222    pub fn into_channel(self) -> fidl::Channel {
1223        self.client.into_channel()
1224    }
1225
1226    /// Waits until an event arrives and returns it. It is safe for other
1227    /// threads to make concurrent requests while waiting for an event.
1228    pub fn wait_for_event(
1229        &self,
1230        deadline: zx::MonotonicInstant,
1231    ) -> Result<DebugBrokerEvent, fidl::Error> {
1232        DebugBrokerEvent::decode(self.client.wait_for_event(deadline)?)
1233    }
1234
1235    /// Pass debug command through to the kernel shell.
1236    /// Look at zx_debug_send_command syscall handling to find valid values.
1237    pub fn r#send_debug_command(
1238        &self,
1239        mut command: &str,
1240        ___deadline: zx::MonotonicInstant,
1241    ) -> Result<i32, fidl::Error> {
1242        let _response = self
1243            .client
1244            .send_query::<DebugBrokerSendDebugCommandRequest, DebugBrokerSendDebugCommandResponse>(
1245                (command,),
1246                0x1ee270f83b5d6ff6,
1247                fidl::encoding::DynamicFlags::empty(),
1248                ___deadline,
1249            )?;
1250        Ok(_response.status)
1251    }
1252
1253    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1254    pub fn r#set_tracing_enabled(
1255        &self,
1256        mut enabled: bool,
1257        ___deadline: zx::MonotonicInstant,
1258    ) -> Result<i32, fidl::Error> {
1259        let _response = self.client.send_query::<
1260            DebugBrokerSetTracingEnabledRequest,
1261            DebugBrokerSetTracingEnabledResponse,
1262        >(
1263            (enabled,),
1264            0x12e368d05329b30e,
1265            fidl::encoding::DynamicFlags::empty(),
1266            ___deadline,
1267        )?;
1268        Ok(_response.status)
1269    }
1270}
1271
1272#[derive(Debug, Clone)]
1273pub struct DebugBrokerProxy {
1274    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1275}
1276
1277impl fidl::endpoints::Proxy for DebugBrokerProxy {
1278    type Protocol = DebugBrokerMarker;
1279
1280    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1281        Self::new(inner)
1282    }
1283
1284    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1285        self.client.into_channel().map_err(|client| Self { client })
1286    }
1287
1288    fn as_channel(&self) -> &::fidl::AsyncChannel {
1289        self.client.as_channel()
1290    }
1291}
1292
1293impl DebugBrokerProxy {
1294    /// Create a new Proxy for fuchsia.kernel/DebugBroker.
1295    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1296        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1297        Self { client: fidl::client::Client::new(channel, protocol_name) }
1298    }
1299
1300    /// Get a Stream of events from the remote end of the protocol.
1301    ///
1302    /// # Panics
1303    ///
1304    /// Panics if the event stream was already taken.
1305    pub fn take_event_stream(&self) -> DebugBrokerEventStream {
1306        DebugBrokerEventStream { event_receiver: self.client.take_event_receiver() }
1307    }
1308
1309    /// Pass debug command through to the kernel shell.
1310    /// Look at zx_debug_send_command syscall handling to find valid values.
1311    pub fn r#send_debug_command(
1312        &self,
1313        mut command: &str,
1314    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1315        DebugBrokerProxyInterface::r#send_debug_command(self, command)
1316    }
1317
1318    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1319    pub fn r#set_tracing_enabled(
1320        &self,
1321        mut enabled: bool,
1322    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1323        DebugBrokerProxyInterface::r#set_tracing_enabled(self, enabled)
1324    }
1325}
1326
1327impl DebugBrokerProxyInterface for DebugBrokerProxy {
1328    type SendDebugCommandResponseFut =
1329        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1330    fn r#send_debug_command(&self, mut command: &str) -> Self::SendDebugCommandResponseFut {
1331        fn _decode(
1332            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1333        ) -> Result<i32, fidl::Error> {
1334            let _response = fidl::client::decode_transaction_body::<
1335                DebugBrokerSendDebugCommandResponse,
1336                fidl::encoding::DefaultFuchsiaResourceDialect,
1337                0x1ee270f83b5d6ff6,
1338            >(_buf?)?;
1339            Ok(_response.status)
1340        }
1341        self.client.send_query_and_decode::<DebugBrokerSendDebugCommandRequest, i32>(
1342            (command,),
1343            0x1ee270f83b5d6ff6,
1344            fidl::encoding::DynamicFlags::empty(),
1345            _decode,
1346        )
1347    }
1348
1349    type SetTracingEnabledResponseFut =
1350        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1351    fn r#set_tracing_enabled(&self, mut enabled: bool) -> Self::SetTracingEnabledResponseFut {
1352        fn _decode(
1353            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1354        ) -> Result<i32, fidl::Error> {
1355            let _response = fidl::client::decode_transaction_body::<
1356                DebugBrokerSetTracingEnabledResponse,
1357                fidl::encoding::DefaultFuchsiaResourceDialect,
1358                0x12e368d05329b30e,
1359            >(_buf?)?;
1360            Ok(_response.status)
1361        }
1362        self.client.send_query_and_decode::<DebugBrokerSetTracingEnabledRequest, i32>(
1363            (enabled,),
1364            0x12e368d05329b30e,
1365            fidl::encoding::DynamicFlags::empty(),
1366            _decode,
1367        )
1368    }
1369}
1370
1371pub struct DebugBrokerEventStream {
1372    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1373}
1374
1375impl std::marker::Unpin for DebugBrokerEventStream {}
1376
1377impl futures::stream::FusedStream for DebugBrokerEventStream {
1378    fn is_terminated(&self) -> bool {
1379        self.event_receiver.is_terminated()
1380    }
1381}
1382
1383impl futures::Stream for DebugBrokerEventStream {
1384    type Item = Result<DebugBrokerEvent, fidl::Error>;
1385
1386    fn poll_next(
1387        mut self: std::pin::Pin<&mut Self>,
1388        cx: &mut std::task::Context<'_>,
1389    ) -> std::task::Poll<Option<Self::Item>> {
1390        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1391            &mut self.event_receiver,
1392            cx
1393        )?) {
1394            Some(buf) => std::task::Poll::Ready(Some(DebugBrokerEvent::decode(buf))),
1395            None => std::task::Poll::Ready(None),
1396        }
1397    }
1398}
1399
1400#[derive(Debug)]
1401pub enum DebugBrokerEvent {}
1402
1403impl DebugBrokerEvent {
1404    /// Decodes a message buffer as a [`DebugBrokerEvent`].
1405    fn decode(
1406        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1407    ) -> Result<DebugBrokerEvent, fidl::Error> {
1408        let (bytes, _handles) = buf.split_mut();
1409        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1410        debug_assert_eq!(tx_header.tx_id, 0);
1411        match tx_header.ordinal {
1412            _ => Err(fidl::Error::UnknownOrdinal {
1413                ordinal: tx_header.ordinal,
1414                protocol_name: <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1415            }),
1416        }
1417    }
1418}
1419
1420/// A Stream of incoming requests for fuchsia.kernel/DebugBroker.
1421pub struct DebugBrokerRequestStream {
1422    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1423    is_terminated: bool,
1424}
1425
1426impl std::marker::Unpin for DebugBrokerRequestStream {}
1427
1428impl futures::stream::FusedStream for DebugBrokerRequestStream {
1429    fn is_terminated(&self) -> bool {
1430        self.is_terminated
1431    }
1432}
1433
1434impl fidl::endpoints::RequestStream for DebugBrokerRequestStream {
1435    type Protocol = DebugBrokerMarker;
1436    type ControlHandle = DebugBrokerControlHandle;
1437
1438    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1439        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1440    }
1441
1442    fn control_handle(&self) -> Self::ControlHandle {
1443        DebugBrokerControlHandle { inner: self.inner.clone() }
1444    }
1445
1446    fn into_inner(
1447        self,
1448    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1449    {
1450        (self.inner, self.is_terminated)
1451    }
1452
1453    fn from_inner(
1454        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1455        is_terminated: bool,
1456    ) -> Self {
1457        Self { inner, is_terminated }
1458    }
1459}
1460
1461impl futures::Stream for DebugBrokerRequestStream {
1462    type Item = Result<DebugBrokerRequest, fidl::Error>;
1463
1464    fn poll_next(
1465        mut self: std::pin::Pin<&mut Self>,
1466        cx: &mut std::task::Context<'_>,
1467    ) -> std::task::Poll<Option<Self::Item>> {
1468        let this = &mut *self;
1469        if this.inner.check_shutdown(cx) {
1470            this.is_terminated = true;
1471            return std::task::Poll::Ready(None);
1472        }
1473        if this.is_terminated {
1474            panic!("polled DebugBrokerRequestStream after completion");
1475        }
1476        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1477            |bytes, handles| {
1478                match this.inner.channel().read_etc(cx, bytes, handles) {
1479                    std::task::Poll::Ready(Ok(())) => {}
1480                    std::task::Poll::Pending => return std::task::Poll::Pending,
1481                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1482                        this.is_terminated = true;
1483                        return std::task::Poll::Ready(None);
1484                    }
1485                    std::task::Poll::Ready(Err(e)) => {
1486                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1487                            e.into(),
1488                        ))))
1489                    }
1490                }
1491
1492                // A message has been received from the channel
1493                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1494
1495                std::task::Poll::Ready(Some(match header.ordinal {
1496                    0x1ee270f83b5d6ff6 => {
1497                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1498                        let mut req = fidl::new_empty!(
1499                            DebugBrokerSendDebugCommandRequest,
1500                            fidl::encoding::DefaultFuchsiaResourceDialect
1501                        );
1502                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSendDebugCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1503                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1504                        Ok(DebugBrokerRequest::SendDebugCommand {
1505                            command: req.command,
1506
1507                            responder: DebugBrokerSendDebugCommandResponder {
1508                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1509                                tx_id: header.tx_id,
1510                            },
1511                        })
1512                    }
1513                    0x12e368d05329b30e => {
1514                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1515                        let mut req = fidl::new_empty!(
1516                            DebugBrokerSetTracingEnabledRequest,
1517                            fidl::encoding::DefaultFuchsiaResourceDialect
1518                        );
1519                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSetTracingEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1520                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1521                        Ok(DebugBrokerRequest::SetTracingEnabled {
1522                            enabled: req.enabled,
1523
1524                            responder: DebugBrokerSetTracingEnabledResponder {
1525                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1526                                tx_id: header.tx_id,
1527                            },
1528                        })
1529                    }
1530                    _ => Err(fidl::Error::UnknownOrdinal {
1531                        ordinal: header.ordinal,
1532                        protocol_name:
1533                            <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1534                    }),
1535                }))
1536            },
1537        )
1538    }
1539}
1540
1541/// Acts on behalf of the caller to interact with privileged debug system calls.
1542#[derive(Debug)]
1543pub enum DebugBrokerRequest {
1544    /// Pass debug command through to the kernel shell.
1545    /// Look at zx_debug_send_command syscall handling to find valid values.
1546    SendDebugCommand { command: String, responder: DebugBrokerSendDebugCommandResponder },
1547    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1548    SetTracingEnabled { enabled: bool, responder: DebugBrokerSetTracingEnabledResponder },
1549}
1550
1551impl DebugBrokerRequest {
1552    #[allow(irrefutable_let_patterns)]
1553    pub fn into_send_debug_command(self) -> Option<(String, DebugBrokerSendDebugCommandResponder)> {
1554        if let DebugBrokerRequest::SendDebugCommand { command, responder } = self {
1555            Some((command, responder))
1556        } else {
1557            None
1558        }
1559    }
1560
1561    #[allow(irrefutable_let_patterns)]
1562    pub fn into_set_tracing_enabled(self) -> Option<(bool, DebugBrokerSetTracingEnabledResponder)> {
1563        if let DebugBrokerRequest::SetTracingEnabled { enabled, responder } = self {
1564            Some((enabled, responder))
1565        } else {
1566            None
1567        }
1568    }
1569
1570    /// Name of the method defined in FIDL
1571    pub fn method_name(&self) -> &'static str {
1572        match *self {
1573            DebugBrokerRequest::SendDebugCommand { .. } => "send_debug_command",
1574            DebugBrokerRequest::SetTracingEnabled { .. } => "set_tracing_enabled",
1575        }
1576    }
1577}
1578
1579#[derive(Debug, Clone)]
1580pub struct DebugBrokerControlHandle {
1581    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1582}
1583
1584impl fidl::endpoints::ControlHandle for DebugBrokerControlHandle {
1585    fn shutdown(&self) {
1586        self.inner.shutdown()
1587    }
1588    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1589        self.inner.shutdown_with_epitaph(status)
1590    }
1591
1592    fn is_closed(&self) -> bool {
1593        self.inner.channel().is_closed()
1594    }
1595    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1596        self.inner.channel().on_closed()
1597    }
1598
1599    #[cfg(target_os = "fuchsia")]
1600    fn signal_peer(
1601        &self,
1602        clear_mask: zx::Signals,
1603        set_mask: zx::Signals,
1604    ) -> Result<(), zx_status::Status> {
1605        use fidl::Peered;
1606        self.inner.channel().signal_peer(clear_mask, set_mask)
1607    }
1608}
1609
1610impl DebugBrokerControlHandle {}
1611
1612#[must_use = "FIDL methods require a response to be sent"]
1613#[derive(Debug)]
1614pub struct DebugBrokerSendDebugCommandResponder {
1615    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1616    tx_id: u32,
1617}
1618
1619/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1620/// if the responder is dropped without sending a response, so that the client
1621/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1622impl std::ops::Drop for DebugBrokerSendDebugCommandResponder {
1623    fn drop(&mut self) {
1624        self.control_handle.shutdown();
1625        // Safety: drops once, never accessed again
1626        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1627    }
1628}
1629
1630impl fidl::endpoints::Responder for DebugBrokerSendDebugCommandResponder {
1631    type ControlHandle = DebugBrokerControlHandle;
1632
1633    fn control_handle(&self) -> &DebugBrokerControlHandle {
1634        &self.control_handle
1635    }
1636
1637    fn drop_without_shutdown(mut self) {
1638        // Safety: drops once, never accessed again due to mem::forget
1639        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1640        // Prevent Drop from running (which would shut down the channel)
1641        std::mem::forget(self);
1642    }
1643}
1644
1645impl DebugBrokerSendDebugCommandResponder {
1646    /// Sends a response to the FIDL transaction.
1647    ///
1648    /// Sets the channel to shutdown if an error occurs.
1649    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1650        let _result = self.send_raw(status);
1651        if _result.is_err() {
1652            self.control_handle.shutdown();
1653        }
1654        self.drop_without_shutdown();
1655        _result
1656    }
1657
1658    /// Similar to "send" but does not shutdown the channel if an error occurs.
1659    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1660        let _result = self.send_raw(status);
1661        self.drop_without_shutdown();
1662        _result
1663    }
1664
1665    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1666        self.control_handle.inner.send::<DebugBrokerSendDebugCommandResponse>(
1667            (status,),
1668            self.tx_id,
1669            0x1ee270f83b5d6ff6,
1670            fidl::encoding::DynamicFlags::empty(),
1671        )
1672    }
1673}
1674
1675#[must_use = "FIDL methods require a response to be sent"]
1676#[derive(Debug)]
1677pub struct DebugBrokerSetTracingEnabledResponder {
1678    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1679    tx_id: u32,
1680}
1681
1682/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1683/// if the responder is dropped without sending a response, so that the client
1684/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1685impl std::ops::Drop for DebugBrokerSetTracingEnabledResponder {
1686    fn drop(&mut self) {
1687        self.control_handle.shutdown();
1688        // Safety: drops once, never accessed again
1689        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1690    }
1691}
1692
1693impl fidl::endpoints::Responder for DebugBrokerSetTracingEnabledResponder {
1694    type ControlHandle = DebugBrokerControlHandle;
1695
1696    fn control_handle(&self) -> &DebugBrokerControlHandle {
1697        &self.control_handle
1698    }
1699
1700    fn drop_without_shutdown(mut self) {
1701        // Safety: drops once, never accessed again due to mem::forget
1702        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1703        // Prevent Drop from running (which would shut down the channel)
1704        std::mem::forget(self);
1705    }
1706}
1707
1708impl DebugBrokerSetTracingEnabledResponder {
1709    /// Sends a response to the FIDL transaction.
1710    ///
1711    /// Sets the channel to shutdown if an error occurs.
1712    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1713        let _result = self.send_raw(status);
1714        if _result.is_err() {
1715            self.control_handle.shutdown();
1716        }
1717        self.drop_without_shutdown();
1718        _result
1719    }
1720
1721    /// Similar to "send" but does not shutdown the channel if an error occurs.
1722    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1723        let _result = self.send_raw(status);
1724        self.drop_without_shutdown();
1725        _result
1726    }
1727
1728    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1729        self.control_handle.inner.send::<DebugBrokerSetTracingEnabledResponse>(
1730            (status,),
1731            self.tx_id,
1732            0x12e368d05329b30e,
1733            fidl::encoding::DynamicFlags::empty(),
1734        )
1735    }
1736}
1737
1738#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1739pub struct DebugResourceMarker;
1740
1741impl fidl::endpoints::ProtocolMarker for DebugResourceMarker {
1742    type Proxy = DebugResourceProxy;
1743    type RequestStream = DebugResourceRequestStream;
1744    #[cfg(target_os = "fuchsia")]
1745    type SynchronousProxy = DebugResourceSynchronousProxy;
1746
1747    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugResource";
1748}
1749impl fidl::endpoints::DiscoverableProtocolMarker for DebugResourceMarker {}
1750
1751pub trait DebugResourceProxyInterface: Send + Sync {
1752    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
1753    fn r#get(&self) -> Self::GetResponseFut;
1754}
1755#[derive(Debug)]
1756#[cfg(target_os = "fuchsia")]
1757pub struct DebugResourceSynchronousProxy {
1758    client: fidl::client::sync::Client,
1759}
1760
1761#[cfg(target_os = "fuchsia")]
1762impl fidl::endpoints::SynchronousProxy for DebugResourceSynchronousProxy {
1763    type Proxy = DebugResourceProxy;
1764    type Protocol = DebugResourceMarker;
1765
1766    fn from_channel(inner: fidl::Channel) -> Self {
1767        Self::new(inner)
1768    }
1769
1770    fn into_channel(self) -> fidl::Channel {
1771        self.client.into_channel()
1772    }
1773
1774    fn as_channel(&self) -> &fidl::Channel {
1775        self.client.as_channel()
1776    }
1777}
1778
1779#[cfg(target_os = "fuchsia")]
1780impl DebugResourceSynchronousProxy {
1781    pub fn new(channel: fidl::Channel) -> Self {
1782        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1783        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1784    }
1785
1786    pub fn into_channel(self) -> fidl::Channel {
1787        self.client.into_channel()
1788    }
1789
1790    /// Waits until an event arrives and returns it. It is safe for other
1791    /// threads to make concurrent requests while waiting for an event.
1792    pub fn wait_for_event(
1793        &self,
1794        deadline: zx::MonotonicInstant,
1795    ) -> Result<DebugResourceEvent, fidl::Error> {
1796        DebugResourceEvent::decode(self.client.wait_for_event(deadline)?)
1797    }
1798
1799    /// Get a debug resource handle.
1800    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
1801        let _response =
1802            self.client.send_query::<fidl::encoding::EmptyPayload, DebugResourceGetResponse>(
1803                (),
1804                0x1d79d77ea12a6474,
1805                fidl::encoding::DynamicFlags::empty(),
1806                ___deadline,
1807            )?;
1808        Ok(_response.resource)
1809    }
1810}
1811
1812#[derive(Debug, Clone)]
1813pub struct DebugResourceProxy {
1814    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1815}
1816
1817impl fidl::endpoints::Proxy for DebugResourceProxy {
1818    type Protocol = DebugResourceMarker;
1819
1820    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1821        Self::new(inner)
1822    }
1823
1824    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1825        self.client.into_channel().map_err(|client| Self { client })
1826    }
1827
1828    fn as_channel(&self) -> &::fidl::AsyncChannel {
1829        self.client.as_channel()
1830    }
1831}
1832
1833impl DebugResourceProxy {
1834    /// Create a new Proxy for fuchsia.kernel/DebugResource.
1835    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1836        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1837        Self { client: fidl::client::Client::new(channel, protocol_name) }
1838    }
1839
1840    /// Get a Stream of events from the remote end of the protocol.
1841    ///
1842    /// # Panics
1843    ///
1844    /// Panics if the event stream was already taken.
1845    pub fn take_event_stream(&self) -> DebugResourceEventStream {
1846        DebugResourceEventStream { event_receiver: self.client.take_event_receiver() }
1847    }
1848
1849    /// Get a debug resource handle.
1850    pub fn r#get(
1851        &self,
1852    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
1853    {
1854        DebugResourceProxyInterface::r#get(self)
1855    }
1856}
1857
1858impl DebugResourceProxyInterface for DebugResourceProxy {
1859    type GetResponseFut = fidl::client::QueryResponseFut<
1860        fidl::Resource,
1861        fidl::encoding::DefaultFuchsiaResourceDialect,
1862    >;
1863    fn r#get(&self) -> Self::GetResponseFut {
1864        fn _decode(
1865            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1866        ) -> Result<fidl::Resource, fidl::Error> {
1867            let _response = fidl::client::decode_transaction_body::<
1868                DebugResourceGetResponse,
1869                fidl::encoding::DefaultFuchsiaResourceDialect,
1870                0x1d79d77ea12a6474,
1871            >(_buf?)?;
1872            Ok(_response.resource)
1873        }
1874        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
1875            (),
1876            0x1d79d77ea12a6474,
1877            fidl::encoding::DynamicFlags::empty(),
1878            _decode,
1879        )
1880    }
1881}
1882
1883pub struct DebugResourceEventStream {
1884    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1885}
1886
1887impl std::marker::Unpin for DebugResourceEventStream {}
1888
1889impl futures::stream::FusedStream for DebugResourceEventStream {
1890    fn is_terminated(&self) -> bool {
1891        self.event_receiver.is_terminated()
1892    }
1893}
1894
1895impl futures::Stream for DebugResourceEventStream {
1896    type Item = Result<DebugResourceEvent, fidl::Error>;
1897
1898    fn poll_next(
1899        mut self: std::pin::Pin<&mut Self>,
1900        cx: &mut std::task::Context<'_>,
1901    ) -> std::task::Poll<Option<Self::Item>> {
1902        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1903            &mut self.event_receiver,
1904            cx
1905        )?) {
1906            Some(buf) => std::task::Poll::Ready(Some(DebugResourceEvent::decode(buf))),
1907            None => std::task::Poll::Ready(None),
1908        }
1909    }
1910}
1911
1912#[derive(Debug)]
1913pub enum DebugResourceEvent {}
1914
1915impl DebugResourceEvent {
1916    /// Decodes a message buffer as a [`DebugResourceEvent`].
1917    fn decode(
1918        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1919    ) -> Result<DebugResourceEvent, fidl::Error> {
1920        let (bytes, _handles) = buf.split_mut();
1921        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1922        debug_assert_eq!(tx_header.tx_id, 0);
1923        match tx_header.ordinal {
1924            _ => Err(fidl::Error::UnknownOrdinal {
1925                ordinal: tx_header.ordinal,
1926                protocol_name: <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1927            }),
1928        }
1929    }
1930}
1931
1932/// A Stream of incoming requests for fuchsia.kernel/DebugResource.
1933pub struct DebugResourceRequestStream {
1934    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1935    is_terminated: bool,
1936}
1937
1938impl std::marker::Unpin for DebugResourceRequestStream {}
1939
1940impl futures::stream::FusedStream for DebugResourceRequestStream {
1941    fn is_terminated(&self) -> bool {
1942        self.is_terminated
1943    }
1944}
1945
1946impl fidl::endpoints::RequestStream for DebugResourceRequestStream {
1947    type Protocol = DebugResourceMarker;
1948    type ControlHandle = DebugResourceControlHandle;
1949
1950    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1951        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1952    }
1953
1954    fn control_handle(&self) -> Self::ControlHandle {
1955        DebugResourceControlHandle { inner: self.inner.clone() }
1956    }
1957
1958    fn into_inner(
1959        self,
1960    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1961    {
1962        (self.inner, self.is_terminated)
1963    }
1964
1965    fn from_inner(
1966        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1967        is_terminated: bool,
1968    ) -> Self {
1969        Self { inner, is_terminated }
1970    }
1971}
1972
1973impl futures::Stream for DebugResourceRequestStream {
1974    type Item = Result<DebugResourceRequest, fidl::Error>;
1975
1976    fn poll_next(
1977        mut self: std::pin::Pin<&mut Self>,
1978        cx: &mut std::task::Context<'_>,
1979    ) -> std::task::Poll<Option<Self::Item>> {
1980        let this = &mut *self;
1981        if this.inner.check_shutdown(cx) {
1982            this.is_terminated = true;
1983            return std::task::Poll::Ready(None);
1984        }
1985        if this.is_terminated {
1986            panic!("polled DebugResourceRequestStream after completion");
1987        }
1988        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1989            |bytes, handles| {
1990                match this.inner.channel().read_etc(cx, bytes, handles) {
1991                    std::task::Poll::Ready(Ok(())) => {}
1992                    std::task::Poll::Pending => return std::task::Poll::Pending,
1993                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1994                        this.is_terminated = true;
1995                        return std::task::Poll::Ready(None);
1996                    }
1997                    std::task::Poll::Ready(Err(e)) => {
1998                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1999                            e.into(),
2000                        ))))
2001                    }
2002                }
2003
2004                // A message has been received from the channel
2005                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2006
2007                std::task::Poll::Ready(Some(match header.ordinal {
2008                    0x1d79d77ea12a6474 => {
2009                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2010                        let mut req = fidl::new_empty!(
2011                            fidl::encoding::EmptyPayload,
2012                            fidl::encoding::DefaultFuchsiaResourceDialect
2013                        );
2014                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2015                        let control_handle =
2016                            DebugResourceControlHandle { inner: this.inner.clone() };
2017                        Ok(DebugResourceRequest::Get {
2018                            responder: DebugResourceGetResponder {
2019                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2020                                tx_id: header.tx_id,
2021                            },
2022                        })
2023                    }
2024                    _ => Err(fidl::Error::UnknownOrdinal {
2025                        ordinal: header.ordinal,
2026                        protocol_name:
2027                            <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2028                    }),
2029                }))
2030            },
2031        )
2032    }
2033}
2034
2035/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2036/// `ZX_RSRC_SYSTEM_DEBUG_BASE`.
2037#[derive(Debug)]
2038pub enum DebugResourceRequest {
2039    /// Get a debug resource handle.
2040    Get { responder: DebugResourceGetResponder },
2041}
2042
2043impl DebugResourceRequest {
2044    #[allow(irrefutable_let_patterns)]
2045    pub fn into_get(self) -> Option<(DebugResourceGetResponder)> {
2046        if let DebugResourceRequest::Get { responder } = self {
2047            Some((responder))
2048        } else {
2049            None
2050        }
2051    }
2052
2053    /// Name of the method defined in FIDL
2054    pub fn method_name(&self) -> &'static str {
2055        match *self {
2056            DebugResourceRequest::Get { .. } => "get",
2057        }
2058    }
2059}
2060
2061#[derive(Debug, Clone)]
2062pub struct DebugResourceControlHandle {
2063    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2064}
2065
2066impl fidl::endpoints::ControlHandle for DebugResourceControlHandle {
2067    fn shutdown(&self) {
2068        self.inner.shutdown()
2069    }
2070    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2071        self.inner.shutdown_with_epitaph(status)
2072    }
2073
2074    fn is_closed(&self) -> bool {
2075        self.inner.channel().is_closed()
2076    }
2077    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2078        self.inner.channel().on_closed()
2079    }
2080
2081    #[cfg(target_os = "fuchsia")]
2082    fn signal_peer(
2083        &self,
2084        clear_mask: zx::Signals,
2085        set_mask: zx::Signals,
2086    ) -> Result<(), zx_status::Status> {
2087        use fidl::Peered;
2088        self.inner.channel().signal_peer(clear_mask, set_mask)
2089    }
2090}
2091
2092impl DebugResourceControlHandle {}
2093
2094#[must_use = "FIDL methods require a response to be sent"]
2095#[derive(Debug)]
2096pub struct DebugResourceGetResponder {
2097    control_handle: std::mem::ManuallyDrop<DebugResourceControlHandle>,
2098    tx_id: u32,
2099}
2100
2101/// Set the the channel to be shutdown (see [`DebugResourceControlHandle::shutdown`])
2102/// if the responder is dropped without sending a response, so that the client
2103/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2104impl std::ops::Drop for DebugResourceGetResponder {
2105    fn drop(&mut self) {
2106        self.control_handle.shutdown();
2107        // Safety: drops once, never accessed again
2108        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2109    }
2110}
2111
2112impl fidl::endpoints::Responder for DebugResourceGetResponder {
2113    type ControlHandle = DebugResourceControlHandle;
2114
2115    fn control_handle(&self) -> &DebugResourceControlHandle {
2116        &self.control_handle
2117    }
2118
2119    fn drop_without_shutdown(mut self) {
2120        // Safety: drops once, never accessed again due to mem::forget
2121        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2122        // Prevent Drop from running (which would shut down the channel)
2123        std::mem::forget(self);
2124    }
2125}
2126
2127impl DebugResourceGetResponder {
2128    /// Sends a response to the FIDL transaction.
2129    ///
2130    /// Sets the channel to shutdown if an error occurs.
2131    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2132        let _result = self.send_raw(resource);
2133        if _result.is_err() {
2134            self.control_handle.shutdown();
2135        }
2136        self.drop_without_shutdown();
2137        _result
2138    }
2139
2140    /// Similar to "send" but does not shutdown the channel if an error occurs.
2141    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2142        let _result = self.send_raw(resource);
2143        self.drop_without_shutdown();
2144        _result
2145    }
2146
2147    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2148        self.control_handle.inner.send::<DebugResourceGetResponse>(
2149            (resource,),
2150            self.tx_id,
2151            0x1d79d77ea12a6474,
2152            fidl::encoding::DynamicFlags::empty(),
2153        )
2154    }
2155}
2156
2157#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2158pub struct DebuglogResourceMarker;
2159
2160impl fidl::endpoints::ProtocolMarker for DebuglogResourceMarker {
2161    type Proxy = DebuglogResourceProxy;
2162    type RequestStream = DebuglogResourceRequestStream;
2163    #[cfg(target_os = "fuchsia")]
2164    type SynchronousProxy = DebuglogResourceSynchronousProxy;
2165
2166    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebuglogResource";
2167}
2168impl fidl::endpoints::DiscoverableProtocolMarker for DebuglogResourceMarker {}
2169
2170pub trait DebuglogResourceProxyInterface: Send + Sync {
2171    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2172    fn r#get(&self) -> Self::GetResponseFut;
2173}
2174#[derive(Debug)]
2175#[cfg(target_os = "fuchsia")]
2176pub struct DebuglogResourceSynchronousProxy {
2177    client: fidl::client::sync::Client,
2178}
2179
2180#[cfg(target_os = "fuchsia")]
2181impl fidl::endpoints::SynchronousProxy for DebuglogResourceSynchronousProxy {
2182    type Proxy = DebuglogResourceProxy;
2183    type Protocol = DebuglogResourceMarker;
2184
2185    fn from_channel(inner: fidl::Channel) -> Self {
2186        Self::new(inner)
2187    }
2188
2189    fn into_channel(self) -> fidl::Channel {
2190        self.client.into_channel()
2191    }
2192
2193    fn as_channel(&self) -> &fidl::Channel {
2194        self.client.as_channel()
2195    }
2196}
2197
2198#[cfg(target_os = "fuchsia")]
2199impl DebuglogResourceSynchronousProxy {
2200    pub fn new(channel: fidl::Channel) -> Self {
2201        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2202        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2203    }
2204
2205    pub fn into_channel(self) -> fidl::Channel {
2206        self.client.into_channel()
2207    }
2208
2209    /// Waits until an event arrives and returns it. It is safe for other
2210    /// threads to make concurrent requests while waiting for an event.
2211    pub fn wait_for_event(
2212        &self,
2213        deadline: zx::MonotonicInstant,
2214    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2215        DebuglogResourceEvent::decode(self.client.wait_for_event(deadline)?)
2216    }
2217
2218    /// Get a debuglog resource handle.
2219    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2220        let _response =
2221            self.client.send_query::<fidl::encoding::EmptyPayload, DebuglogResourceGetResponse>(
2222                (),
2223                0x6e78c1ff74765225,
2224                fidl::encoding::DynamicFlags::empty(),
2225                ___deadline,
2226            )?;
2227        Ok(_response.resource)
2228    }
2229}
2230
2231#[derive(Debug, Clone)]
2232pub struct DebuglogResourceProxy {
2233    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2234}
2235
2236impl fidl::endpoints::Proxy for DebuglogResourceProxy {
2237    type Protocol = DebuglogResourceMarker;
2238
2239    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2240        Self::new(inner)
2241    }
2242
2243    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2244        self.client.into_channel().map_err(|client| Self { client })
2245    }
2246
2247    fn as_channel(&self) -> &::fidl::AsyncChannel {
2248        self.client.as_channel()
2249    }
2250}
2251
2252impl DebuglogResourceProxy {
2253    /// Create a new Proxy for fuchsia.kernel/DebuglogResource.
2254    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2255        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2256        Self { client: fidl::client::Client::new(channel, protocol_name) }
2257    }
2258
2259    /// Get a Stream of events from the remote end of the protocol.
2260    ///
2261    /// # Panics
2262    ///
2263    /// Panics if the event stream was already taken.
2264    pub fn take_event_stream(&self) -> DebuglogResourceEventStream {
2265        DebuglogResourceEventStream { event_receiver: self.client.take_event_receiver() }
2266    }
2267
2268    /// Get a debuglog resource handle.
2269    pub fn r#get(
2270        &self,
2271    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2272    {
2273        DebuglogResourceProxyInterface::r#get(self)
2274    }
2275}
2276
2277impl DebuglogResourceProxyInterface for DebuglogResourceProxy {
2278    type GetResponseFut = fidl::client::QueryResponseFut<
2279        fidl::Resource,
2280        fidl::encoding::DefaultFuchsiaResourceDialect,
2281    >;
2282    fn r#get(&self) -> Self::GetResponseFut {
2283        fn _decode(
2284            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2285        ) -> Result<fidl::Resource, fidl::Error> {
2286            let _response = fidl::client::decode_transaction_body::<
2287                DebuglogResourceGetResponse,
2288                fidl::encoding::DefaultFuchsiaResourceDialect,
2289                0x6e78c1ff74765225,
2290            >(_buf?)?;
2291            Ok(_response.resource)
2292        }
2293        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2294            (),
2295            0x6e78c1ff74765225,
2296            fidl::encoding::DynamicFlags::empty(),
2297            _decode,
2298        )
2299    }
2300}
2301
2302pub struct DebuglogResourceEventStream {
2303    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2304}
2305
2306impl std::marker::Unpin for DebuglogResourceEventStream {}
2307
2308impl futures::stream::FusedStream for DebuglogResourceEventStream {
2309    fn is_terminated(&self) -> bool {
2310        self.event_receiver.is_terminated()
2311    }
2312}
2313
2314impl futures::Stream for DebuglogResourceEventStream {
2315    type Item = Result<DebuglogResourceEvent, fidl::Error>;
2316
2317    fn poll_next(
2318        mut self: std::pin::Pin<&mut Self>,
2319        cx: &mut std::task::Context<'_>,
2320    ) -> std::task::Poll<Option<Self::Item>> {
2321        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2322            &mut self.event_receiver,
2323            cx
2324        )?) {
2325            Some(buf) => std::task::Poll::Ready(Some(DebuglogResourceEvent::decode(buf))),
2326            None => std::task::Poll::Ready(None),
2327        }
2328    }
2329}
2330
2331#[derive(Debug)]
2332pub enum DebuglogResourceEvent {}
2333
2334impl DebuglogResourceEvent {
2335    /// Decodes a message buffer as a [`DebuglogResourceEvent`].
2336    fn decode(
2337        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2338    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2339        let (bytes, _handles) = buf.split_mut();
2340        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2341        debug_assert_eq!(tx_header.tx_id, 0);
2342        match tx_header.ordinal {
2343            _ => Err(fidl::Error::UnknownOrdinal {
2344                ordinal: tx_header.ordinal,
2345                protocol_name:
2346                    <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2347            }),
2348        }
2349    }
2350}
2351
2352/// A Stream of incoming requests for fuchsia.kernel/DebuglogResource.
2353pub struct DebuglogResourceRequestStream {
2354    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2355    is_terminated: bool,
2356}
2357
2358impl std::marker::Unpin for DebuglogResourceRequestStream {}
2359
2360impl futures::stream::FusedStream for DebuglogResourceRequestStream {
2361    fn is_terminated(&self) -> bool {
2362        self.is_terminated
2363    }
2364}
2365
2366impl fidl::endpoints::RequestStream for DebuglogResourceRequestStream {
2367    type Protocol = DebuglogResourceMarker;
2368    type ControlHandle = DebuglogResourceControlHandle;
2369
2370    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2371        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2372    }
2373
2374    fn control_handle(&self) -> Self::ControlHandle {
2375        DebuglogResourceControlHandle { inner: self.inner.clone() }
2376    }
2377
2378    fn into_inner(
2379        self,
2380    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2381    {
2382        (self.inner, self.is_terminated)
2383    }
2384
2385    fn from_inner(
2386        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2387        is_terminated: bool,
2388    ) -> Self {
2389        Self { inner, is_terminated }
2390    }
2391}
2392
2393impl futures::Stream for DebuglogResourceRequestStream {
2394    type Item = Result<DebuglogResourceRequest, fidl::Error>;
2395
2396    fn poll_next(
2397        mut self: std::pin::Pin<&mut Self>,
2398        cx: &mut std::task::Context<'_>,
2399    ) -> std::task::Poll<Option<Self::Item>> {
2400        let this = &mut *self;
2401        if this.inner.check_shutdown(cx) {
2402            this.is_terminated = true;
2403            return std::task::Poll::Ready(None);
2404        }
2405        if this.is_terminated {
2406            panic!("polled DebuglogResourceRequestStream after completion");
2407        }
2408        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2409            |bytes, handles| {
2410                match this.inner.channel().read_etc(cx, bytes, handles) {
2411                    std::task::Poll::Ready(Ok(())) => {}
2412                    std::task::Poll::Pending => return std::task::Poll::Pending,
2413                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2414                        this.is_terminated = true;
2415                        return std::task::Poll::Ready(None);
2416                    }
2417                    std::task::Poll::Ready(Err(e)) => {
2418                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2419                            e.into(),
2420                        ))))
2421                    }
2422                }
2423
2424                // A message has been received from the channel
2425                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2426
2427                std::task::Poll::Ready(Some(match header.ordinal {
2428                    0x6e78c1ff74765225 => {
2429                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2430                        let mut req = fidl::new_empty!(
2431                            fidl::encoding::EmptyPayload,
2432                            fidl::encoding::DefaultFuchsiaResourceDialect
2433                        );
2434                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2435                        let control_handle =
2436                            DebuglogResourceControlHandle { inner: this.inner.clone() };
2437                        Ok(DebuglogResourceRequest::Get {
2438                            responder: DebuglogResourceGetResponder {
2439                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2440                                tx_id: header.tx_id,
2441                            },
2442                        })
2443                    }
2444                    _ => Err(fidl::Error::UnknownOrdinal {
2445                        ordinal: header.ordinal,
2446                        protocol_name:
2447                            <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2448                    }),
2449                }))
2450            },
2451        )
2452    }
2453}
2454
2455/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2456/// `ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
2457#[derive(Debug)]
2458pub enum DebuglogResourceRequest {
2459    /// Get a debuglog resource handle.
2460    Get { responder: DebuglogResourceGetResponder },
2461}
2462
2463impl DebuglogResourceRequest {
2464    #[allow(irrefutable_let_patterns)]
2465    pub fn into_get(self) -> Option<(DebuglogResourceGetResponder)> {
2466        if let DebuglogResourceRequest::Get { responder } = self {
2467            Some((responder))
2468        } else {
2469            None
2470        }
2471    }
2472
2473    /// Name of the method defined in FIDL
2474    pub fn method_name(&self) -> &'static str {
2475        match *self {
2476            DebuglogResourceRequest::Get { .. } => "get",
2477        }
2478    }
2479}
2480
2481#[derive(Debug, Clone)]
2482pub struct DebuglogResourceControlHandle {
2483    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2484}
2485
2486impl fidl::endpoints::ControlHandle for DebuglogResourceControlHandle {
2487    fn shutdown(&self) {
2488        self.inner.shutdown()
2489    }
2490    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2491        self.inner.shutdown_with_epitaph(status)
2492    }
2493
2494    fn is_closed(&self) -> bool {
2495        self.inner.channel().is_closed()
2496    }
2497    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2498        self.inner.channel().on_closed()
2499    }
2500
2501    #[cfg(target_os = "fuchsia")]
2502    fn signal_peer(
2503        &self,
2504        clear_mask: zx::Signals,
2505        set_mask: zx::Signals,
2506    ) -> Result<(), zx_status::Status> {
2507        use fidl::Peered;
2508        self.inner.channel().signal_peer(clear_mask, set_mask)
2509    }
2510}
2511
2512impl DebuglogResourceControlHandle {}
2513
2514#[must_use = "FIDL methods require a response to be sent"]
2515#[derive(Debug)]
2516pub struct DebuglogResourceGetResponder {
2517    control_handle: std::mem::ManuallyDrop<DebuglogResourceControlHandle>,
2518    tx_id: u32,
2519}
2520
2521/// Set the the channel to be shutdown (see [`DebuglogResourceControlHandle::shutdown`])
2522/// if the responder is dropped without sending a response, so that the client
2523/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2524impl std::ops::Drop for DebuglogResourceGetResponder {
2525    fn drop(&mut self) {
2526        self.control_handle.shutdown();
2527        // Safety: drops once, never accessed again
2528        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2529    }
2530}
2531
2532impl fidl::endpoints::Responder for DebuglogResourceGetResponder {
2533    type ControlHandle = DebuglogResourceControlHandle;
2534
2535    fn control_handle(&self) -> &DebuglogResourceControlHandle {
2536        &self.control_handle
2537    }
2538
2539    fn drop_without_shutdown(mut self) {
2540        // Safety: drops once, never accessed again due to mem::forget
2541        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2542        // Prevent Drop from running (which would shut down the channel)
2543        std::mem::forget(self);
2544    }
2545}
2546
2547impl DebuglogResourceGetResponder {
2548    /// Sends a response to the FIDL transaction.
2549    ///
2550    /// Sets the channel to shutdown if an error occurs.
2551    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2552        let _result = self.send_raw(resource);
2553        if _result.is_err() {
2554            self.control_handle.shutdown();
2555        }
2556        self.drop_without_shutdown();
2557        _result
2558    }
2559
2560    /// Similar to "send" but does not shutdown the channel if an error occurs.
2561    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2562        let _result = self.send_raw(resource);
2563        self.drop_without_shutdown();
2564        _result
2565    }
2566
2567    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2568        self.control_handle.inner.send::<DebuglogResourceGetResponse>(
2569            (resource,),
2570            self.tx_id,
2571            0x6e78c1ff74765225,
2572            fidl::encoding::DynamicFlags::empty(),
2573        )
2574    }
2575}
2576
2577#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2578pub struct EnergyInfoResourceMarker;
2579
2580impl fidl::endpoints::ProtocolMarker for EnergyInfoResourceMarker {
2581    type Proxy = EnergyInfoResourceProxy;
2582    type RequestStream = EnergyInfoResourceRequestStream;
2583    #[cfg(target_os = "fuchsia")]
2584    type SynchronousProxy = EnergyInfoResourceSynchronousProxy;
2585
2586    const DEBUG_NAME: &'static str = "fuchsia.kernel.EnergyInfoResource";
2587}
2588impl fidl::endpoints::DiscoverableProtocolMarker for EnergyInfoResourceMarker {}
2589
2590pub trait EnergyInfoResourceProxyInterface: Send + Sync {
2591    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2592    fn r#get(&self) -> Self::GetResponseFut;
2593}
2594#[derive(Debug)]
2595#[cfg(target_os = "fuchsia")]
2596pub struct EnergyInfoResourceSynchronousProxy {
2597    client: fidl::client::sync::Client,
2598}
2599
2600#[cfg(target_os = "fuchsia")]
2601impl fidl::endpoints::SynchronousProxy for EnergyInfoResourceSynchronousProxy {
2602    type Proxy = EnergyInfoResourceProxy;
2603    type Protocol = EnergyInfoResourceMarker;
2604
2605    fn from_channel(inner: fidl::Channel) -> Self {
2606        Self::new(inner)
2607    }
2608
2609    fn into_channel(self) -> fidl::Channel {
2610        self.client.into_channel()
2611    }
2612
2613    fn as_channel(&self) -> &fidl::Channel {
2614        self.client.as_channel()
2615    }
2616}
2617
2618#[cfg(target_os = "fuchsia")]
2619impl EnergyInfoResourceSynchronousProxy {
2620    pub fn new(channel: fidl::Channel) -> Self {
2621        let protocol_name =
2622            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2623        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2624    }
2625
2626    pub fn into_channel(self) -> fidl::Channel {
2627        self.client.into_channel()
2628    }
2629
2630    /// Waits until an event arrives and returns it. It is safe for other
2631    /// threads to make concurrent requests while waiting for an event.
2632    pub fn wait_for_event(
2633        &self,
2634        deadline: zx::MonotonicInstant,
2635    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2636        EnergyInfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
2637    }
2638
2639    /// Get an EnergyInfo resource handle.
2640    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2641        let _response =
2642            self.client.send_query::<fidl::encoding::EmptyPayload, EnergyInfoResourceGetResponse>(
2643                (),
2644                0x5f5cc9f0745f61d0,
2645                fidl::encoding::DynamicFlags::empty(),
2646                ___deadline,
2647            )?;
2648        Ok(_response.resource)
2649    }
2650}
2651
2652#[derive(Debug, Clone)]
2653pub struct EnergyInfoResourceProxy {
2654    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2655}
2656
2657impl fidl::endpoints::Proxy for EnergyInfoResourceProxy {
2658    type Protocol = EnergyInfoResourceMarker;
2659
2660    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2661        Self::new(inner)
2662    }
2663
2664    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2665        self.client.into_channel().map_err(|client| Self { client })
2666    }
2667
2668    fn as_channel(&self) -> &::fidl::AsyncChannel {
2669        self.client.as_channel()
2670    }
2671}
2672
2673impl EnergyInfoResourceProxy {
2674    /// Create a new Proxy for fuchsia.kernel/EnergyInfoResource.
2675    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2676        let protocol_name =
2677            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2678        Self { client: fidl::client::Client::new(channel, protocol_name) }
2679    }
2680
2681    /// Get a Stream of events from the remote end of the protocol.
2682    ///
2683    /// # Panics
2684    ///
2685    /// Panics if the event stream was already taken.
2686    pub fn take_event_stream(&self) -> EnergyInfoResourceEventStream {
2687        EnergyInfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
2688    }
2689
2690    /// Get an EnergyInfo resource handle.
2691    pub fn r#get(
2692        &self,
2693    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2694    {
2695        EnergyInfoResourceProxyInterface::r#get(self)
2696    }
2697}
2698
2699impl EnergyInfoResourceProxyInterface for EnergyInfoResourceProxy {
2700    type GetResponseFut = fidl::client::QueryResponseFut<
2701        fidl::Resource,
2702        fidl::encoding::DefaultFuchsiaResourceDialect,
2703    >;
2704    fn r#get(&self) -> Self::GetResponseFut {
2705        fn _decode(
2706            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2707        ) -> Result<fidl::Resource, fidl::Error> {
2708            let _response = fidl::client::decode_transaction_body::<
2709                EnergyInfoResourceGetResponse,
2710                fidl::encoding::DefaultFuchsiaResourceDialect,
2711                0x5f5cc9f0745f61d0,
2712            >(_buf?)?;
2713            Ok(_response.resource)
2714        }
2715        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2716            (),
2717            0x5f5cc9f0745f61d0,
2718            fidl::encoding::DynamicFlags::empty(),
2719            _decode,
2720        )
2721    }
2722}
2723
2724pub struct EnergyInfoResourceEventStream {
2725    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2726}
2727
2728impl std::marker::Unpin for EnergyInfoResourceEventStream {}
2729
2730impl futures::stream::FusedStream for EnergyInfoResourceEventStream {
2731    fn is_terminated(&self) -> bool {
2732        self.event_receiver.is_terminated()
2733    }
2734}
2735
2736impl futures::Stream for EnergyInfoResourceEventStream {
2737    type Item = Result<EnergyInfoResourceEvent, fidl::Error>;
2738
2739    fn poll_next(
2740        mut self: std::pin::Pin<&mut Self>,
2741        cx: &mut std::task::Context<'_>,
2742    ) -> std::task::Poll<Option<Self::Item>> {
2743        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2744            &mut self.event_receiver,
2745            cx
2746        )?) {
2747            Some(buf) => std::task::Poll::Ready(Some(EnergyInfoResourceEvent::decode(buf))),
2748            None => std::task::Poll::Ready(None),
2749        }
2750    }
2751}
2752
2753#[derive(Debug)]
2754pub enum EnergyInfoResourceEvent {}
2755
2756impl EnergyInfoResourceEvent {
2757    /// Decodes a message buffer as a [`EnergyInfoResourceEvent`].
2758    fn decode(
2759        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2760    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2761        let (bytes, _handles) = buf.split_mut();
2762        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2763        debug_assert_eq!(tx_header.tx_id, 0);
2764        match tx_header.ordinal {
2765            _ => Err(fidl::Error::UnknownOrdinal {
2766                ordinal: tx_header.ordinal,
2767                protocol_name:
2768                    <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2769            }),
2770        }
2771    }
2772}
2773
2774/// A Stream of incoming requests for fuchsia.kernel/EnergyInfoResource.
2775pub struct EnergyInfoResourceRequestStream {
2776    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2777    is_terminated: bool,
2778}
2779
2780impl std::marker::Unpin for EnergyInfoResourceRequestStream {}
2781
2782impl futures::stream::FusedStream for EnergyInfoResourceRequestStream {
2783    fn is_terminated(&self) -> bool {
2784        self.is_terminated
2785    }
2786}
2787
2788impl fidl::endpoints::RequestStream for EnergyInfoResourceRequestStream {
2789    type Protocol = EnergyInfoResourceMarker;
2790    type ControlHandle = EnergyInfoResourceControlHandle;
2791
2792    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2793        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2794    }
2795
2796    fn control_handle(&self) -> Self::ControlHandle {
2797        EnergyInfoResourceControlHandle { inner: self.inner.clone() }
2798    }
2799
2800    fn into_inner(
2801        self,
2802    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2803    {
2804        (self.inner, self.is_terminated)
2805    }
2806
2807    fn from_inner(
2808        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2809        is_terminated: bool,
2810    ) -> Self {
2811        Self { inner, is_terminated }
2812    }
2813}
2814
2815impl futures::Stream for EnergyInfoResourceRequestStream {
2816    type Item = Result<EnergyInfoResourceRequest, fidl::Error>;
2817
2818    fn poll_next(
2819        mut self: std::pin::Pin<&mut Self>,
2820        cx: &mut std::task::Context<'_>,
2821    ) -> std::task::Poll<Option<Self::Item>> {
2822        let this = &mut *self;
2823        if this.inner.check_shutdown(cx) {
2824            this.is_terminated = true;
2825            return std::task::Poll::Ready(None);
2826        }
2827        if this.is_terminated {
2828            panic!("polled EnergyInfoResourceRequestStream after completion");
2829        }
2830        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2831            |bytes, handles| {
2832                match this.inner.channel().read_etc(cx, bytes, handles) {
2833                    std::task::Poll::Ready(Ok(())) => {}
2834                    std::task::Poll::Pending => return std::task::Poll::Pending,
2835                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2836                        this.is_terminated = true;
2837                        return std::task::Poll::Ready(None);
2838                    }
2839                    std::task::Poll::Ready(Err(e)) => {
2840                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2841                            e.into(),
2842                        ))))
2843                    }
2844                }
2845
2846                // A message has been received from the channel
2847                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2848
2849                std::task::Poll::Ready(Some(match header.ordinal {
2850                0x5f5cc9f0745f61d0 => {
2851                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2852                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2853                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2854                    let control_handle = EnergyInfoResourceControlHandle {
2855                        inner: this.inner.clone(),
2856                    };
2857                    Ok(EnergyInfoResourceRequest::Get {
2858                        responder: EnergyInfoResourceGetResponder {
2859                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2860                            tx_id: header.tx_id,
2861                        },
2862                    })
2863                }
2864                _ => Err(fidl::Error::UnknownOrdinal {
2865                    ordinal: header.ordinal,
2866                    protocol_name: <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2867                }),
2868            }))
2869            },
2870        )
2871    }
2872}
2873
2874/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2875/// `ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
2876#[derive(Debug)]
2877pub enum EnergyInfoResourceRequest {
2878    /// Get an EnergyInfo resource handle.
2879    Get { responder: EnergyInfoResourceGetResponder },
2880}
2881
2882impl EnergyInfoResourceRequest {
2883    #[allow(irrefutable_let_patterns)]
2884    pub fn into_get(self) -> Option<(EnergyInfoResourceGetResponder)> {
2885        if let EnergyInfoResourceRequest::Get { responder } = self {
2886            Some((responder))
2887        } else {
2888            None
2889        }
2890    }
2891
2892    /// Name of the method defined in FIDL
2893    pub fn method_name(&self) -> &'static str {
2894        match *self {
2895            EnergyInfoResourceRequest::Get { .. } => "get",
2896        }
2897    }
2898}
2899
2900#[derive(Debug, Clone)]
2901pub struct EnergyInfoResourceControlHandle {
2902    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2903}
2904
2905impl fidl::endpoints::ControlHandle for EnergyInfoResourceControlHandle {
2906    fn shutdown(&self) {
2907        self.inner.shutdown()
2908    }
2909    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2910        self.inner.shutdown_with_epitaph(status)
2911    }
2912
2913    fn is_closed(&self) -> bool {
2914        self.inner.channel().is_closed()
2915    }
2916    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2917        self.inner.channel().on_closed()
2918    }
2919
2920    #[cfg(target_os = "fuchsia")]
2921    fn signal_peer(
2922        &self,
2923        clear_mask: zx::Signals,
2924        set_mask: zx::Signals,
2925    ) -> Result<(), zx_status::Status> {
2926        use fidl::Peered;
2927        self.inner.channel().signal_peer(clear_mask, set_mask)
2928    }
2929}
2930
2931impl EnergyInfoResourceControlHandle {}
2932
2933#[must_use = "FIDL methods require a response to be sent"]
2934#[derive(Debug)]
2935pub struct EnergyInfoResourceGetResponder {
2936    control_handle: std::mem::ManuallyDrop<EnergyInfoResourceControlHandle>,
2937    tx_id: u32,
2938}
2939
2940/// Set the the channel to be shutdown (see [`EnergyInfoResourceControlHandle::shutdown`])
2941/// if the responder is dropped without sending a response, so that the client
2942/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2943impl std::ops::Drop for EnergyInfoResourceGetResponder {
2944    fn drop(&mut self) {
2945        self.control_handle.shutdown();
2946        // Safety: drops once, never accessed again
2947        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2948    }
2949}
2950
2951impl fidl::endpoints::Responder for EnergyInfoResourceGetResponder {
2952    type ControlHandle = EnergyInfoResourceControlHandle;
2953
2954    fn control_handle(&self) -> &EnergyInfoResourceControlHandle {
2955        &self.control_handle
2956    }
2957
2958    fn drop_without_shutdown(mut self) {
2959        // Safety: drops once, never accessed again due to mem::forget
2960        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2961        // Prevent Drop from running (which would shut down the channel)
2962        std::mem::forget(self);
2963    }
2964}
2965
2966impl EnergyInfoResourceGetResponder {
2967    /// Sends a response to the FIDL transaction.
2968    ///
2969    /// Sets the channel to shutdown if an error occurs.
2970    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2971        let _result = self.send_raw(resource);
2972        if _result.is_err() {
2973            self.control_handle.shutdown();
2974        }
2975        self.drop_without_shutdown();
2976        _result
2977    }
2978
2979    /// Similar to "send" but does not shutdown the channel if an error occurs.
2980    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2981        let _result = self.send_raw(resource);
2982        self.drop_without_shutdown();
2983        _result
2984    }
2985
2986    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2987        self.control_handle.inner.send::<EnergyInfoResourceGetResponse>(
2988            (resource,),
2989            self.tx_id,
2990            0x5f5cc9f0745f61d0,
2991            fidl::encoding::DynamicFlags::empty(),
2992        )
2993    }
2994}
2995
2996#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2997pub struct HypervisorResourceMarker;
2998
2999impl fidl::endpoints::ProtocolMarker for HypervisorResourceMarker {
3000    type Proxy = HypervisorResourceProxy;
3001    type RequestStream = HypervisorResourceRequestStream;
3002    #[cfg(target_os = "fuchsia")]
3003    type SynchronousProxy = HypervisorResourceSynchronousProxy;
3004
3005    const DEBUG_NAME: &'static str = "fuchsia.kernel.HypervisorResource";
3006}
3007impl fidl::endpoints::DiscoverableProtocolMarker for HypervisorResourceMarker {}
3008
3009pub trait HypervisorResourceProxyInterface: Send + Sync {
3010    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3011    fn r#get(&self) -> Self::GetResponseFut;
3012}
3013#[derive(Debug)]
3014#[cfg(target_os = "fuchsia")]
3015pub struct HypervisorResourceSynchronousProxy {
3016    client: fidl::client::sync::Client,
3017}
3018
3019#[cfg(target_os = "fuchsia")]
3020impl fidl::endpoints::SynchronousProxy for HypervisorResourceSynchronousProxy {
3021    type Proxy = HypervisorResourceProxy;
3022    type Protocol = HypervisorResourceMarker;
3023
3024    fn from_channel(inner: fidl::Channel) -> Self {
3025        Self::new(inner)
3026    }
3027
3028    fn into_channel(self) -> fidl::Channel {
3029        self.client.into_channel()
3030    }
3031
3032    fn as_channel(&self) -> &fidl::Channel {
3033        self.client.as_channel()
3034    }
3035}
3036
3037#[cfg(target_os = "fuchsia")]
3038impl HypervisorResourceSynchronousProxy {
3039    pub fn new(channel: fidl::Channel) -> Self {
3040        let protocol_name =
3041            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3042        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3043    }
3044
3045    pub fn into_channel(self) -> fidl::Channel {
3046        self.client.into_channel()
3047    }
3048
3049    /// Waits until an event arrives and returns it. It is safe for other
3050    /// threads to make concurrent requests while waiting for an event.
3051    pub fn wait_for_event(
3052        &self,
3053        deadline: zx::MonotonicInstant,
3054    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3055        HypervisorResourceEvent::decode(self.client.wait_for_event(deadline)?)
3056    }
3057
3058    /// Get a hypervisor resource handle.
3059    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3060        let _response =
3061            self.client.send_query::<fidl::encoding::EmptyPayload, HypervisorResourceGetResponse>(
3062                (),
3063                0x1c312131d3b824a2,
3064                fidl::encoding::DynamicFlags::empty(),
3065                ___deadline,
3066            )?;
3067        Ok(_response.resource)
3068    }
3069}
3070
3071#[derive(Debug, Clone)]
3072pub struct HypervisorResourceProxy {
3073    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3074}
3075
3076impl fidl::endpoints::Proxy for HypervisorResourceProxy {
3077    type Protocol = HypervisorResourceMarker;
3078
3079    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3080        Self::new(inner)
3081    }
3082
3083    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3084        self.client.into_channel().map_err(|client| Self { client })
3085    }
3086
3087    fn as_channel(&self) -> &::fidl::AsyncChannel {
3088        self.client.as_channel()
3089    }
3090}
3091
3092impl HypervisorResourceProxy {
3093    /// Create a new Proxy for fuchsia.kernel/HypervisorResource.
3094    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3095        let protocol_name =
3096            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3097        Self { client: fidl::client::Client::new(channel, protocol_name) }
3098    }
3099
3100    /// Get a Stream of events from the remote end of the protocol.
3101    ///
3102    /// # Panics
3103    ///
3104    /// Panics if the event stream was already taken.
3105    pub fn take_event_stream(&self) -> HypervisorResourceEventStream {
3106        HypervisorResourceEventStream { event_receiver: self.client.take_event_receiver() }
3107    }
3108
3109    /// Get a hypervisor resource handle.
3110    pub fn r#get(
3111        &self,
3112    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3113    {
3114        HypervisorResourceProxyInterface::r#get(self)
3115    }
3116}
3117
3118impl HypervisorResourceProxyInterface for HypervisorResourceProxy {
3119    type GetResponseFut = fidl::client::QueryResponseFut<
3120        fidl::Resource,
3121        fidl::encoding::DefaultFuchsiaResourceDialect,
3122    >;
3123    fn r#get(&self) -> Self::GetResponseFut {
3124        fn _decode(
3125            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3126        ) -> Result<fidl::Resource, fidl::Error> {
3127            let _response = fidl::client::decode_transaction_body::<
3128                HypervisorResourceGetResponse,
3129                fidl::encoding::DefaultFuchsiaResourceDialect,
3130                0x1c312131d3b824a2,
3131            >(_buf?)?;
3132            Ok(_response.resource)
3133        }
3134        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3135            (),
3136            0x1c312131d3b824a2,
3137            fidl::encoding::DynamicFlags::empty(),
3138            _decode,
3139        )
3140    }
3141}
3142
3143pub struct HypervisorResourceEventStream {
3144    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3145}
3146
3147impl std::marker::Unpin for HypervisorResourceEventStream {}
3148
3149impl futures::stream::FusedStream for HypervisorResourceEventStream {
3150    fn is_terminated(&self) -> bool {
3151        self.event_receiver.is_terminated()
3152    }
3153}
3154
3155impl futures::Stream for HypervisorResourceEventStream {
3156    type Item = Result<HypervisorResourceEvent, fidl::Error>;
3157
3158    fn poll_next(
3159        mut self: std::pin::Pin<&mut Self>,
3160        cx: &mut std::task::Context<'_>,
3161    ) -> std::task::Poll<Option<Self::Item>> {
3162        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3163            &mut self.event_receiver,
3164            cx
3165        )?) {
3166            Some(buf) => std::task::Poll::Ready(Some(HypervisorResourceEvent::decode(buf))),
3167            None => std::task::Poll::Ready(None),
3168        }
3169    }
3170}
3171
3172#[derive(Debug)]
3173pub enum HypervisorResourceEvent {}
3174
3175impl HypervisorResourceEvent {
3176    /// Decodes a message buffer as a [`HypervisorResourceEvent`].
3177    fn decode(
3178        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3179    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3180        let (bytes, _handles) = buf.split_mut();
3181        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3182        debug_assert_eq!(tx_header.tx_id, 0);
3183        match tx_header.ordinal {
3184            _ => Err(fidl::Error::UnknownOrdinal {
3185                ordinal: tx_header.ordinal,
3186                protocol_name:
3187                    <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3188            }),
3189        }
3190    }
3191}
3192
3193/// A Stream of incoming requests for fuchsia.kernel/HypervisorResource.
3194pub struct HypervisorResourceRequestStream {
3195    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3196    is_terminated: bool,
3197}
3198
3199impl std::marker::Unpin for HypervisorResourceRequestStream {}
3200
3201impl futures::stream::FusedStream for HypervisorResourceRequestStream {
3202    fn is_terminated(&self) -> bool {
3203        self.is_terminated
3204    }
3205}
3206
3207impl fidl::endpoints::RequestStream for HypervisorResourceRequestStream {
3208    type Protocol = HypervisorResourceMarker;
3209    type ControlHandle = HypervisorResourceControlHandle;
3210
3211    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3212        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3213    }
3214
3215    fn control_handle(&self) -> Self::ControlHandle {
3216        HypervisorResourceControlHandle { inner: self.inner.clone() }
3217    }
3218
3219    fn into_inner(
3220        self,
3221    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3222    {
3223        (self.inner, self.is_terminated)
3224    }
3225
3226    fn from_inner(
3227        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3228        is_terminated: bool,
3229    ) -> Self {
3230        Self { inner, is_terminated }
3231    }
3232}
3233
3234impl futures::Stream for HypervisorResourceRequestStream {
3235    type Item = Result<HypervisorResourceRequest, fidl::Error>;
3236
3237    fn poll_next(
3238        mut self: std::pin::Pin<&mut Self>,
3239        cx: &mut std::task::Context<'_>,
3240    ) -> std::task::Poll<Option<Self::Item>> {
3241        let this = &mut *self;
3242        if this.inner.check_shutdown(cx) {
3243            this.is_terminated = true;
3244            return std::task::Poll::Ready(None);
3245        }
3246        if this.is_terminated {
3247            panic!("polled HypervisorResourceRequestStream after completion");
3248        }
3249        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3250            |bytes, handles| {
3251                match this.inner.channel().read_etc(cx, bytes, handles) {
3252                    std::task::Poll::Ready(Ok(())) => {}
3253                    std::task::Poll::Pending => return std::task::Poll::Pending,
3254                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3255                        this.is_terminated = true;
3256                        return std::task::Poll::Ready(None);
3257                    }
3258                    std::task::Poll::Ready(Err(e)) => {
3259                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3260                            e.into(),
3261                        ))))
3262                    }
3263                }
3264
3265                // A message has been received from the channel
3266                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3267
3268                std::task::Poll::Ready(Some(match header.ordinal {
3269                0x1c312131d3b824a2 => {
3270                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3271                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3272                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3273                    let control_handle = HypervisorResourceControlHandle {
3274                        inner: this.inner.clone(),
3275                    };
3276                    Ok(HypervisorResourceRequest::Get {
3277                        responder: HypervisorResourceGetResponder {
3278                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3279                            tx_id: header.tx_id,
3280                        },
3281                    })
3282                }
3283                _ => Err(fidl::Error::UnknownOrdinal {
3284                    ordinal: header.ordinal,
3285                    protocol_name: <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3286                }),
3287            }))
3288            },
3289        )
3290    }
3291}
3292
3293/// Protocol for providing the hypervisor resource.
3294#[derive(Debug)]
3295pub enum HypervisorResourceRequest {
3296    /// Get a hypervisor resource handle.
3297    Get { responder: HypervisorResourceGetResponder },
3298}
3299
3300impl HypervisorResourceRequest {
3301    #[allow(irrefutable_let_patterns)]
3302    pub fn into_get(self) -> Option<(HypervisorResourceGetResponder)> {
3303        if let HypervisorResourceRequest::Get { responder } = self {
3304            Some((responder))
3305        } else {
3306            None
3307        }
3308    }
3309
3310    /// Name of the method defined in FIDL
3311    pub fn method_name(&self) -> &'static str {
3312        match *self {
3313            HypervisorResourceRequest::Get { .. } => "get",
3314        }
3315    }
3316}
3317
3318#[derive(Debug, Clone)]
3319pub struct HypervisorResourceControlHandle {
3320    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3321}
3322
3323impl fidl::endpoints::ControlHandle for HypervisorResourceControlHandle {
3324    fn shutdown(&self) {
3325        self.inner.shutdown()
3326    }
3327    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3328        self.inner.shutdown_with_epitaph(status)
3329    }
3330
3331    fn is_closed(&self) -> bool {
3332        self.inner.channel().is_closed()
3333    }
3334    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3335        self.inner.channel().on_closed()
3336    }
3337
3338    #[cfg(target_os = "fuchsia")]
3339    fn signal_peer(
3340        &self,
3341        clear_mask: zx::Signals,
3342        set_mask: zx::Signals,
3343    ) -> Result<(), zx_status::Status> {
3344        use fidl::Peered;
3345        self.inner.channel().signal_peer(clear_mask, set_mask)
3346    }
3347}
3348
3349impl HypervisorResourceControlHandle {}
3350
3351#[must_use = "FIDL methods require a response to be sent"]
3352#[derive(Debug)]
3353pub struct HypervisorResourceGetResponder {
3354    control_handle: std::mem::ManuallyDrop<HypervisorResourceControlHandle>,
3355    tx_id: u32,
3356}
3357
3358/// Set the the channel to be shutdown (see [`HypervisorResourceControlHandle::shutdown`])
3359/// if the responder is dropped without sending a response, so that the client
3360/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3361impl std::ops::Drop for HypervisorResourceGetResponder {
3362    fn drop(&mut self) {
3363        self.control_handle.shutdown();
3364        // Safety: drops once, never accessed again
3365        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3366    }
3367}
3368
3369impl fidl::endpoints::Responder for HypervisorResourceGetResponder {
3370    type ControlHandle = HypervisorResourceControlHandle;
3371
3372    fn control_handle(&self) -> &HypervisorResourceControlHandle {
3373        &self.control_handle
3374    }
3375
3376    fn drop_without_shutdown(mut self) {
3377        // Safety: drops once, never accessed again due to mem::forget
3378        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3379        // Prevent Drop from running (which would shut down the channel)
3380        std::mem::forget(self);
3381    }
3382}
3383
3384impl HypervisorResourceGetResponder {
3385    /// Sends a response to the FIDL transaction.
3386    ///
3387    /// Sets the channel to shutdown if an error occurs.
3388    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3389        let _result = self.send_raw(resource);
3390        if _result.is_err() {
3391            self.control_handle.shutdown();
3392        }
3393        self.drop_without_shutdown();
3394        _result
3395    }
3396
3397    /// Similar to "send" but does not shutdown the channel if an error occurs.
3398    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3399        let _result = self.send_raw(resource);
3400        self.drop_without_shutdown();
3401        _result
3402    }
3403
3404    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3405        self.control_handle.inner.send::<HypervisorResourceGetResponse>(
3406            (resource,),
3407            self.tx_id,
3408            0x1c312131d3b824a2,
3409            fidl::encoding::DynamicFlags::empty(),
3410        )
3411    }
3412}
3413
3414#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3415pub struct InfoResourceMarker;
3416
3417impl fidl::endpoints::ProtocolMarker for InfoResourceMarker {
3418    type Proxy = InfoResourceProxy;
3419    type RequestStream = InfoResourceRequestStream;
3420    #[cfg(target_os = "fuchsia")]
3421    type SynchronousProxy = InfoResourceSynchronousProxy;
3422
3423    const DEBUG_NAME: &'static str = "fuchsia.kernel.InfoResource";
3424}
3425impl fidl::endpoints::DiscoverableProtocolMarker for InfoResourceMarker {}
3426
3427pub trait InfoResourceProxyInterface: Send + Sync {
3428    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3429    fn r#get(&self) -> Self::GetResponseFut;
3430}
3431#[derive(Debug)]
3432#[cfg(target_os = "fuchsia")]
3433pub struct InfoResourceSynchronousProxy {
3434    client: fidl::client::sync::Client,
3435}
3436
3437#[cfg(target_os = "fuchsia")]
3438impl fidl::endpoints::SynchronousProxy for InfoResourceSynchronousProxy {
3439    type Proxy = InfoResourceProxy;
3440    type Protocol = InfoResourceMarker;
3441
3442    fn from_channel(inner: fidl::Channel) -> Self {
3443        Self::new(inner)
3444    }
3445
3446    fn into_channel(self) -> fidl::Channel {
3447        self.client.into_channel()
3448    }
3449
3450    fn as_channel(&self) -> &fidl::Channel {
3451        self.client.as_channel()
3452    }
3453}
3454
3455#[cfg(target_os = "fuchsia")]
3456impl InfoResourceSynchronousProxy {
3457    pub fn new(channel: fidl::Channel) -> Self {
3458        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3459        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3460    }
3461
3462    pub fn into_channel(self) -> fidl::Channel {
3463        self.client.into_channel()
3464    }
3465
3466    /// Waits until an event arrives and returns it. It is safe for other
3467    /// threads to make concurrent requests while waiting for an event.
3468    pub fn wait_for_event(
3469        &self,
3470        deadline: zx::MonotonicInstant,
3471    ) -> Result<InfoResourceEvent, fidl::Error> {
3472        InfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
3473    }
3474
3475    /// Get an info resource handle.
3476    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3477        let _response =
3478            self.client.send_query::<fidl::encoding::EmptyPayload, InfoResourceGetResponse>(
3479                (),
3480                0x1de8edcb4abc2067,
3481                fidl::encoding::DynamicFlags::empty(),
3482                ___deadline,
3483            )?;
3484        Ok(_response.resource)
3485    }
3486}
3487
3488#[derive(Debug, Clone)]
3489pub struct InfoResourceProxy {
3490    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3491}
3492
3493impl fidl::endpoints::Proxy for InfoResourceProxy {
3494    type Protocol = InfoResourceMarker;
3495
3496    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3497        Self::new(inner)
3498    }
3499
3500    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3501        self.client.into_channel().map_err(|client| Self { client })
3502    }
3503
3504    fn as_channel(&self) -> &::fidl::AsyncChannel {
3505        self.client.as_channel()
3506    }
3507}
3508
3509impl InfoResourceProxy {
3510    /// Create a new Proxy for fuchsia.kernel/InfoResource.
3511    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3512        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3513        Self { client: fidl::client::Client::new(channel, protocol_name) }
3514    }
3515
3516    /// Get a Stream of events from the remote end of the protocol.
3517    ///
3518    /// # Panics
3519    ///
3520    /// Panics if the event stream was already taken.
3521    pub fn take_event_stream(&self) -> InfoResourceEventStream {
3522        InfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
3523    }
3524
3525    /// Get an info resource handle.
3526    pub fn r#get(
3527        &self,
3528    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3529    {
3530        InfoResourceProxyInterface::r#get(self)
3531    }
3532}
3533
3534impl InfoResourceProxyInterface for InfoResourceProxy {
3535    type GetResponseFut = fidl::client::QueryResponseFut<
3536        fidl::Resource,
3537        fidl::encoding::DefaultFuchsiaResourceDialect,
3538    >;
3539    fn r#get(&self) -> Self::GetResponseFut {
3540        fn _decode(
3541            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3542        ) -> Result<fidl::Resource, fidl::Error> {
3543            let _response = fidl::client::decode_transaction_body::<
3544                InfoResourceGetResponse,
3545                fidl::encoding::DefaultFuchsiaResourceDialect,
3546                0x1de8edcb4abc2067,
3547            >(_buf?)?;
3548            Ok(_response.resource)
3549        }
3550        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3551            (),
3552            0x1de8edcb4abc2067,
3553            fidl::encoding::DynamicFlags::empty(),
3554            _decode,
3555        )
3556    }
3557}
3558
3559pub struct InfoResourceEventStream {
3560    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3561}
3562
3563impl std::marker::Unpin for InfoResourceEventStream {}
3564
3565impl futures::stream::FusedStream for InfoResourceEventStream {
3566    fn is_terminated(&self) -> bool {
3567        self.event_receiver.is_terminated()
3568    }
3569}
3570
3571impl futures::Stream for InfoResourceEventStream {
3572    type Item = Result<InfoResourceEvent, fidl::Error>;
3573
3574    fn poll_next(
3575        mut self: std::pin::Pin<&mut Self>,
3576        cx: &mut std::task::Context<'_>,
3577    ) -> std::task::Poll<Option<Self::Item>> {
3578        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3579            &mut self.event_receiver,
3580            cx
3581        )?) {
3582            Some(buf) => std::task::Poll::Ready(Some(InfoResourceEvent::decode(buf))),
3583            None => std::task::Poll::Ready(None),
3584        }
3585    }
3586}
3587
3588#[derive(Debug)]
3589pub enum InfoResourceEvent {}
3590
3591impl InfoResourceEvent {
3592    /// Decodes a message buffer as a [`InfoResourceEvent`].
3593    fn decode(
3594        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3595    ) -> Result<InfoResourceEvent, fidl::Error> {
3596        let (bytes, _handles) = buf.split_mut();
3597        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3598        debug_assert_eq!(tx_header.tx_id, 0);
3599        match tx_header.ordinal {
3600            _ => Err(fidl::Error::UnknownOrdinal {
3601                ordinal: tx_header.ordinal,
3602                protocol_name: <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3603            }),
3604        }
3605    }
3606}
3607
3608/// A Stream of incoming requests for fuchsia.kernel/InfoResource.
3609pub struct InfoResourceRequestStream {
3610    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3611    is_terminated: bool,
3612}
3613
3614impl std::marker::Unpin for InfoResourceRequestStream {}
3615
3616impl futures::stream::FusedStream for InfoResourceRequestStream {
3617    fn is_terminated(&self) -> bool {
3618        self.is_terminated
3619    }
3620}
3621
3622impl fidl::endpoints::RequestStream for InfoResourceRequestStream {
3623    type Protocol = InfoResourceMarker;
3624    type ControlHandle = InfoResourceControlHandle;
3625
3626    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3627        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3628    }
3629
3630    fn control_handle(&self) -> Self::ControlHandle {
3631        InfoResourceControlHandle { inner: self.inner.clone() }
3632    }
3633
3634    fn into_inner(
3635        self,
3636    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3637    {
3638        (self.inner, self.is_terminated)
3639    }
3640
3641    fn from_inner(
3642        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3643        is_terminated: bool,
3644    ) -> Self {
3645        Self { inner, is_terminated }
3646    }
3647}
3648
3649impl futures::Stream for InfoResourceRequestStream {
3650    type Item = Result<InfoResourceRequest, fidl::Error>;
3651
3652    fn poll_next(
3653        mut self: std::pin::Pin<&mut Self>,
3654        cx: &mut std::task::Context<'_>,
3655    ) -> std::task::Poll<Option<Self::Item>> {
3656        let this = &mut *self;
3657        if this.inner.check_shutdown(cx) {
3658            this.is_terminated = true;
3659            return std::task::Poll::Ready(None);
3660        }
3661        if this.is_terminated {
3662            panic!("polled InfoResourceRequestStream after completion");
3663        }
3664        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3665            |bytes, handles| {
3666                match this.inner.channel().read_etc(cx, bytes, handles) {
3667                    std::task::Poll::Ready(Ok(())) => {}
3668                    std::task::Poll::Pending => return std::task::Poll::Pending,
3669                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3670                        this.is_terminated = true;
3671                        return std::task::Poll::Ready(None);
3672                    }
3673                    std::task::Poll::Ready(Err(e)) => {
3674                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3675                            e.into(),
3676                        ))))
3677                    }
3678                }
3679
3680                // A message has been received from the channel
3681                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3682
3683                std::task::Poll::Ready(Some(match header.ordinal {
3684                    0x1de8edcb4abc2067 => {
3685                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3686                        let mut req = fidl::new_empty!(
3687                            fidl::encoding::EmptyPayload,
3688                            fidl::encoding::DefaultFuchsiaResourceDialect
3689                        );
3690                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3691                        let control_handle =
3692                            InfoResourceControlHandle { inner: this.inner.clone() };
3693                        Ok(InfoResourceRequest::Get {
3694                            responder: InfoResourceGetResponder {
3695                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3696                                tx_id: header.tx_id,
3697                            },
3698                        })
3699                    }
3700                    _ => Err(fidl::Error::UnknownOrdinal {
3701                        ordinal: header.ordinal,
3702                        protocol_name:
3703                            <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3704                    }),
3705                }))
3706            },
3707        )
3708    }
3709}
3710
3711/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3712/// `ZX_RSRC_SYSTEM_INFO_BASE`.
3713#[derive(Debug)]
3714pub enum InfoResourceRequest {
3715    /// Get an info resource handle.
3716    Get { responder: InfoResourceGetResponder },
3717}
3718
3719impl InfoResourceRequest {
3720    #[allow(irrefutable_let_patterns)]
3721    pub fn into_get(self) -> Option<(InfoResourceGetResponder)> {
3722        if let InfoResourceRequest::Get { responder } = self {
3723            Some((responder))
3724        } else {
3725            None
3726        }
3727    }
3728
3729    /// Name of the method defined in FIDL
3730    pub fn method_name(&self) -> &'static str {
3731        match *self {
3732            InfoResourceRequest::Get { .. } => "get",
3733        }
3734    }
3735}
3736
3737#[derive(Debug, Clone)]
3738pub struct InfoResourceControlHandle {
3739    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3740}
3741
3742impl fidl::endpoints::ControlHandle for InfoResourceControlHandle {
3743    fn shutdown(&self) {
3744        self.inner.shutdown()
3745    }
3746    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3747        self.inner.shutdown_with_epitaph(status)
3748    }
3749
3750    fn is_closed(&self) -> bool {
3751        self.inner.channel().is_closed()
3752    }
3753    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3754        self.inner.channel().on_closed()
3755    }
3756
3757    #[cfg(target_os = "fuchsia")]
3758    fn signal_peer(
3759        &self,
3760        clear_mask: zx::Signals,
3761        set_mask: zx::Signals,
3762    ) -> Result<(), zx_status::Status> {
3763        use fidl::Peered;
3764        self.inner.channel().signal_peer(clear_mask, set_mask)
3765    }
3766}
3767
3768impl InfoResourceControlHandle {}
3769
3770#[must_use = "FIDL methods require a response to be sent"]
3771#[derive(Debug)]
3772pub struct InfoResourceGetResponder {
3773    control_handle: std::mem::ManuallyDrop<InfoResourceControlHandle>,
3774    tx_id: u32,
3775}
3776
3777/// Set the the channel to be shutdown (see [`InfoResourceControlHandle::shutdown`])
3778/// if the responder is dropped without sending a response, so that the client
3779/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3780impl std::ops::Drop for InfoResourceGetResponder {
3781    fn drop(&mut self) {
3782        self.control_handle.shutdown();
3783        // Safety: drops once, never accessed again
3784        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3785    }
3786}
3787
3788impl fidl::endpoints::Responder for InfoResourceGetResponder {
3789    type ControlHandle = InfoResourceControlHandle;
3790
3791    fn control_handle(&self) -> &InfoResourceControlHandle {
3792        &self.control_handle
3793    }
3794
3795    fn drop_without_shutdown(mut self) {
3796        // Safety: drops once, never accessed again due to mem::forget
3797        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3798        // Prevent Drop from running (which would shut down the channel)
3799        std::mem::forget(self);
3800    }
3801}
3802
3803impl InfoResourceGetResponder {
3804    /// Sends a response to the FIDL transaction.
3805    ///
3806    /// Sets the channel to shutdown if an error occurs.
3807    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3808        let _result = self.send_raw(resource);
3809        if _result.is_err() {
3810            self.control_handle.shutdown();
3811        }
3812        self.drop_without_shutdown();
3813        _result
3814    }
3815
3816    /// Similar to "send" but does not shutdown the channel if an error occurs.
3817    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3818        let _result = self.send_raw(resource);
3819        self.drop_without_shutdown();
3820        _result
3821    }
3822
3823    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3824        self.control_handle.inner.send::<InfoResourceGetResponse>(
3825            (resource,),
3826            self.tx_id,
3827            0x1de8edcb4abc2067,
3828            fidl::encoding::DynamicFlags::empty(),
3829        )
3830    }
3831}
3832
3833#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3834pub struct IommuResourceMarker;
3835
3836impl fidl::endpoints::ProtocolMarker for IommuResourceMarker {
3837    type Proxy = IommuResourceProxy;
3838    type RequestStream = IommuResourceRequestStream;
3839    #[cfg(target_os = "fuchsia")]
3840    type SynchronousProxy = IommuResourceSynchronousProxy;
3841
3842    const DEBUG_NAME: &'static str = "fuchsia.kernel.IommuResource";
3843}
3844impl fidl::endpoints::DiscoverableProtocolMarker for IommuResourceMarker {}
3845
3846pub trait IommuResourceProxyInterface: Send + Sync {
3847    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3848    fn r#get(&self) -> Self::GetResponseFut;
3849}
3850#[derive(Debug)]
3851#[cfg(target_os = "fuchsia")]
3852pub struct IommuResourceSynchronousProxy {
3853    client: fidl::client::sync::Client,
3854}
3855
3856#[cfg(target_os = "fuchsia")]
3857impl fidl::endpoints::SynchronousProxy for IommuResourceSynchronousProxy {
3858    type Proxy = IommuResourceProxy;
3859    type Protocol = IommuResourceMarker;
3860
3861    fn from_channel(inner: fidl::Channel) -> Self {
3862        Self::new(inner)
3863    }
3864
3865    fn into_channel(self) -> fidl::Channel {
3866        self.client.into_channel()
3867    }
3868
3869    fn as_channel(&self) -> &fidl::Channel {
3870        self.client.as_channel()
3871    }
3872}
3873
3874#[cfg(target_os = "fuchsia")]
3875impl IommuResourceSynchronousProxy {
3876    pub fn new(channel: fidl::Channel) -> Self {
3877        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3878        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3879    }
3880
3881    pub fn into_channel(self) -> fidl::Channel {
3882        self.client.into_channel()
3883    }
3884
3885    /// Waits until an event arrives and returns it. It is safe for other
3886    /// threads to make concurrent requests while waiting for an event.
3887    pub fn wait_for_event(
3888        &self,
3889        deadline: zx::MonotonicInstant,
3890    ) -> Result<IommuResourceEvent, fidl::Error> {
3891        IommuResourceEvent::decode(self.client.wait_for_event(deadline)?)
3892    }
3893
3894    /// Get an iommu resource handle.
3895    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3896        let _response =
3897            self.client.send_query::<fidl::encoding::EmptyPayload, IommuResourceGetResponse>(
3898                (),
3899                0x5af309b619aa7c5b,
3900                fidl::encoding::DynamicFlags::empty(),
3901                ___deadline,
3902            )?;
3903        Ok(_response.resource)
3904    }
3905}
3906
3907#[derive(Debug, Clone)]
3908pub struct IommuResourceProxy {
3909    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3910}
3911
3912impl fidl::endpoints::Proxy for IommuResourceProxy {
3913    type Protocol = IommuResourceMarker;
3914
3915    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3916        Self::new(inner)
3917    }
3918
3919    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3920        self.client.into_channel().map_err(|client| Self { client })
3921    }
3922
3923    fn as_channel(&self) -> &::fidl::AsyncChannel {
3924        self.client.as_channel()
3925    }
3926}
3927
3928impl IommuResourceProxy {
3929    /// Create a new Proxy for fuchsia.kernel/IommuResource.
3930    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3931        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3932        Self { client: fidl::client::Client::new(channel, protocol_name) }
3933    }
3934
3935    /// Get a Stream of events from the remote end of the protocol.
3936    ///
3937    /// # Panics
3938    ///
3939    /// Panics if the event stream was already taken.
3940    pub fn take_event_stream(&self) -> IommuResourceEventStream {
3941        IommuResourceEventStream { event_receiver: self.client.take_event_receiver() }
3942    }
3943
3944    /// Get an iommu resource handle.
3945    pub fn r#get(
3946        &self,
3947    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3948    {
3949        IommuResourceProxyInterface::r#get(self)
3950    }
3951}
3952
3953impl IommuResourceProxyInterface for IommuResourceProxy {
3954    type GetResponseFut = fidl::client::QueryResponseFut<
3955        fidl::Resource,
3956        fidl::encoding::DefaultFuchsiaResourceDialect,
3957    >;
3958    fn r#get(&self) -> Self::GetResponseFut {
3959        fn _decode(
3960            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3961        ) -> Result<fidl::Resource, fidl::Error> {
3962            let _response = fidl::client::decode_transaction_body::<
3963                IommuResourceGetResponse,
3964                fidl::encoding::DefaultFuchsiaResourceDialect,
3965                0x5af309b619aa7c5b,
3966            >(_buf?)?;
3967            Ok(_response.resource)
3968        }
3969        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3970            (),
3971            0x5af309b619aa7c5b,
3972            fidl::encoding::DynamicFlags::empty(),
3973            _decode,
3974        )
3975    }
3976}
3977
3978pub struct IommuResourceEventStream {
3979    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3980}
3981
3982impl std::marker::Unpin for IommuResourceEventStream {}
3983
3984impl futures::stream::FusedStream for IommuResourceEventStream {
3985    fn is_terminated(&self) -> bool {
3986        self.event_receiver.is_terminated()
3987    }
3988}
3989
3990impl futures::Stream for IommuResourceEventStream {
3991    type Item = Result<IommuResourceEvent, fidl::Error>;
3992
3993    fn poll_next(
3994        mut self: std::pin::Pin<&mut Self>,
3995        cx: &mut std::task::Context<'_>,
3996    ) -> std::task::Poll<Option<Self::Item>> {
3997        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3998            &mut self.event_receiver,
3999            cx
4000        )?) {
4001            Some(buf) => std::task::Poll::Ready(Some(IommuResourceEvent::decode(buf))),
4002            None => std::task::Poll::Ready(None),
4003        }
4004    }
4005}
4006
4007#[derive(Debug)]
4008pub enum IommuResourceEvent {}
4009
4010impl IommuResourceEvent {
4011    /// Decodes a message buffer as a [`IommuResourceEvent`].
4012    fn decode(
4013        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4014    ) -> Result<IommuResourceEvent, fidl::Error> {
4015        let (bytes, _handles) = buf.split_mut();
4016        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4017        debug_assert_eq!(tx_header.tx_id, 0);
4018        match tx_header.ordinal {
4019            _ => Err(fidl::Error::UnknownOrdinal {
4020                ordinal: tx_header.ordinal,
4021                protocol_name: <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4022            }),
4023        }
4024    }
4025}
4026
4027/// A Stream of incoming requests for fuchsia.kernel/IommuResource.
4028pub struct IommuResourceRequestStream {
4029    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4030    is_terminated: bool,
4031}
4032
4033impl std::marker::Unpin for IommuResourceRequestStream {}
4034
4035impl futures::stream::FusedStream for IommuResourceRequestStream {
4036    fn is_terminated(&self) -> bool {
4037        self.is_terminated
4038    }
4039}
4040
4041impl fidl::endpoints::RequestStream for IommuResourceRequestStream {
4042    type Protocol = IommuResourceMarker;
4043    type ControlHandle = IommuResourceControlHandle;
4044
4045    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4046        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4047    }
4048
4049    fn control_handle(&self) -> Self::ControlHandle {
4050        IommuResourceControlHandle { inner: self.inner.clone() }
4051    }
4052
4053    fn into_inner(
4054        self,
4055    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4056    {
4057        (self.inner, self.is_terminated)
4058    }
4059
4060    fn from_inner(
4061        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4062        is_terminated: bool,
4063    ) -> Self {
4064        Self { inner, is_terminated }
4065    }
4066}
4067
4068impl futures::Stream for IommuResourceRequestStream {
4069    type Item = Result<IommuResourceRequest, fidl::Error>;
4070
4071    fn poll_next(
4072        mut self: std::pin::Pin<&mut Self>,
4073        cx: &mut std::task::Context<'_>,
4074    ) -> std::task::Poll<Option<Self::Item>> {
4075        let this = &mut *self;
4076        if this.inner.check_shutdown(cx) {
4077            this.is_terminated = true;
4078            return std::task::Poll::Ready(None);
4079        }
4080        if this.is_terminated {
4081            panic!("polled IommuResourceRequestStream after completion");
4082        }
4083        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4084            |bytes, handles| {
4085                match this.inner.channel().read_etc(cx, bytes, handles) {
4086                    std::task::Poll::Ready(Ok(())) => {}
4087                    std::task::Poll::Pending => return std::task::Poll::Pending,
4088                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4089                        this.is_terminated = true;
4090                        return std::task::Poll::Ready(None);
4091                    }
4092                    std::task::Poll::Ready(Err(e)) => {
4093                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4094                            e.into(),
4095                        ))))
4096                    }
4097                }
4098
4099                // A message has been received from the channel
4100                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4101
4102                std::task::Poll::Ready(Some(match header.ordinal {
4103                    0x5af309b619aa7c5b => {
4104                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4105                        let mut req = fidl::new_empty!(
4106                            fidl::encoding::EmptyPayload,
4107                            fidl::encoding::DefaultFuchsiaResourceDialect
4108                        );
4109                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4110                        let control_handle =
4111                            IommuResourceControlHandle { inner: this.inner.clone() };
4112                        Ok(IommuResourceRequest::Get {
4113                            responder: IommuResourceGetResponder {
4114                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4115                                tx_id: header.tx_id,
4116                            },
4117                        })
4118                    }
4119                    _ => Err(fidl::Error::UnknownOrdinal {
4120                        ordinal: header.ordinal,
4121                        protocol_name:
4122                            <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4123                    }),
4124                }))
4125            },
4126        )
4127    }
4128}
4129
4130/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
4131/// `ZX_RSRC_SYSTEM_IOMMU_BASE`.
4132#[derive(Debug)]
4133pub enum IommuResourceRequest {
4134    /// Get an iommu resource handle.
4135    Get { responder: IommuResourceGetResponder },
4136}
4137
4138impl IommuResourceRequest {
4139    #[allow(irrefutable_let_patterns)]
4140    pub fn into_get(self) -> Option<(IommuResourceGetResponder)> {
4141        if let IommuResourceRequest::Get { responder } = self {
4142            Some((responder))
4143        } else {
4144            None
4145        }
4146    }
4147
4148    /// Name of the method defined in FIDL
4149    pub fn method_name(&self) -> &'static str {
4150        match *self {
4151            IommuResourceRequest::Get { .. } => "get",
4152        }
4153    }
4154}
4155
4156#[derive(Debug, Clone)]
4157pub struct IommuResourceControlHandle {
4158    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4159}
4160
4161impl fidl::endpoints::ControlHandle for IommuResourceControlHandle {
4162    fn shutdown(&self) {
4163        self.inner.shutdown()
4164    }
4165    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4166        self.inner.shutdown_with_epitaph(status)
4167    }
4168
4169    fn is_closed(&self) -> bool {
4170        self.inner.channel().is_closed()
4171    }
4172    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4173        self.inner.channel().on_closed()
4174    }
4175
4176    #[cfg(target_os = "fuchsia")]
4177    fn signal_peer(
4178        &self,
4179        clear_mask: zx::Signals,
4180        set_mask: zx::Signals,
4181    ) -> Result<(), zx_status::Status> {
4182        use fidl::Peered;
4183        self.inner.channel().signal_peer(clear_mask, set_mask)
4184    }
4185}
4186
4187impl IommuResourceControlHandle {}
4188
4189#[must_use = "FIDL methods require a response to be sent"]
4190#[derive(Debug)]
4191pub struct IommuResourceGetResponder {
4192    control_handle: std::mem::ManuallyDrop<IommuResourceControlHandle>,
4193    tx_id: u32,
4194}
4195
4196/// Set the the channel to be shutdown (see [`IommuResourceControlHandle::shutdown`])
4197/// if the responder is dropped without sending a response, so that the client
4198/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4199impl std::ops::Drop for IommuResourceGetResponder {
4200    fn drop(&mut self) {
4201        self.control_handle.shutdown();
4202        // Safety: drops once, never accessed again
4203        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4204    }
4205}
4206
4207impl fidl::endpoints::Responder for IommuResourceGetResponder {
4208    type ControlHandle = IommuResourceControlHandle;
4209
4210    fn control_handle(&self) -> &IommuResourceControlHandle {
4211        &self.control_handle
4212    }
4213
4214    fn drop_without_shutdown(mut self) {
4215        // Safety: drops once, never accessed again due to mem::forget
4216        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4217        // Prevent Drop from running (which would shut down the channel)
4218        std::mem::forget(self);
4219    }
4220}
4221
4222impl IommuResourceGetResponder {
4223    /// Sends a response to the FIDL transaction.
4224    ///
4225    /// Sets the channel to shutdown if an error occurs.
4226    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4227        let _result = self.send_raw(resource);
4228        if _result.is_err() {
4229            self.control_handle.shutdown();
4230        }
4231        self.drop_without_shutdown();
4232        _result
4233    }
4234
4235    /// Similar to "send" but does not shutdown the channel if an error occurs.
4236    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4237        let _result = self.send_raw(resource);
4238        self.drop_without_shutdown();
4239        _result
4240    }
4241
4242    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4243        self.control_handle.inner.send::<IommuResourceGetResponse>(
4244            (resource,),
4245            self.tx_id,
4246            0x5af309b619aa7c5b,
4247            fidl::encoding::DynamicFlags::empty(),
4248        )
4249    }
4250}
4251
4252#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4253pub struct IoportResourceMarker;
4254
4255impl fidl::endpoints::ProtocolMarker for IoportResourceMarker {
4256    type Proxy = IoportResourceProxy;
4257    type RequestStream = IoportResourceRequestStream;
4258    #[cfg(target_os = "fuchsia")]
4259    type SynchronousProxy = IoportResourceSynchronousProxy;
4260
4261    const DEBUG_NAME: &'static str = "fuchsia.kernel.IoportResource";
4262}
4263impl fidl::endpoints::DiscoverableProtocolMarker for IoportResourceMarker {}
4264
4265pub trait IoportResourceProxyInterface: Send + Sync {
4266    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4267    fn r#get(&self) -> Self::GetResponseFut;
4268}
4269#[derive(Debug)]
4270#[cfg(target_os = "fuchsia")]
4271pub struct IoportResourceSynchronousProxy {
4272    client: fidl::client::sync::Client,
4273}
4274
4275#[cfg(target_os = "fuchsia")]
4276impl fidl::endpoints::SynchronousProxy for IoportResourceSynchronousProxy {
4277    type Proxy = IoportResourceProxy;
4278    type Protocol = IoportResourceMarker;
4279
4280    fn from_channel(inner: fidl::Channel) -> Self {
4281        Self::new(inner)
4282    }
4283
4284    fn into_channel(self) -> fidl::Channel {
4285        self.client.into_channel()
4286    }
4287
4288    fn as_channel(&self) -> &fidl::Channel {
4289        self.client.as_channel()
4290    }
4291}
4292
4293#[cfg(target_os = "fuchsia")]
4294impl IoportResourceSynchronousProxy {
4295    pub fn new(channel: fidl::Channel) -> Self {
4296        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4297        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4298    }
4299
4300    pub fn into_channel(self) -> fidl::Channel {
4301        self.client.into_channel()
4302    }
4303
4304    /// Waits until an event arrives and returns it. It is safe for other
4305    /// threads to make concurrent requests while waiting for an event.
4306    pub fn wait_for_event(
4307        &self,
4308        deadline: zx::MonotonicInstant,
4309    ) -> Result<IoportResourceEvent, fidl::Error> {
4310        IoportResourceEvent::decode(self.client.wait_for_event(deadline)?)
4311    }
4312
4313    /// Get an IO Port resource handle.
4314    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4315        let _response =
4316            self.client.send_query::<fidl::encoding::EmptyPayload, IoportResourceGetResponse>(
4317                (),
4318                0x4db20876b537c52b,
4319                fidl::encoding::DynamicFlags::empty(),
4320                ___deadline,
4321            )?;
4322        Ok(_response.resource)
4323    }
4324}
4325
4326#[derive(Debug, Clone)]
4327pub struct IoportResourceProxy {
4328    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4329}
4330
4331impl fidl::endpoints::Proxy for IoportResourceProxy {
4332    type Protocol = IoportResourceMarker;
4333
4334    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4335        Self::new(inner)
4336    }
4337
4338    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4339        self.client.into_channel().map_err(|client| Self { client })
4340    }
4341
4342    fn as_channel(&self) -> &::fidl::AsyncChannel {
4343        self.client.as_channel()
4344    }
4345}
4346
4347impl IoportResourceProxy {
4348    /// Create a new Proxy for fuchsia.kernel/IoportResource.
4349    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4350        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4351        Self { client: fidl::client::Client::new(channel, protocol_name) }
4352    }
4353
4354    /// Get a Stream of events from the remote end of the protocol.
4355    ///
4356    /// # Panics
4357    ///
4358    /// Panics if the event stream was already taken.
4359    pub fn take_event_stream(&self) -> IoportResourceEventStream {
4360        IoportResourceEventStream { event_receiver: self.client.take_event_receiver() }
4361    }
4362
4363    /// Get an IO Port resource handle.
4364    pub fn r#get(
4365        &self,
4366    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4367    {
4368        IoportResourceProxyInterface::r#get(self)
4369    }
4370}
4371
4372impl IoportResourceProxyInterface for IoportResourceProxy {
4373    type GetResponseFut = fidl::client::QueryResponseFut<
4374        fidl::Resource,
4375        fidl::encoding::DefaultFuchsiaResourceDialect,
4376    >;
4377    fn r#get(&self) -> Self::GetResponseFut {
4378        fn _decode(
4379            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4380        ) -> Result<fidl::Resource, fidl::Error> {
4381            let _response = fidl::client::decode_transaction_body::<
4382                IoportResourceGetResponse,
4383                fidl::encoding::DefaultFuchsiaResourceDialect,
4384                0x4db20876b537c52b,
4385            >(_buf?)?;
4386            Ok(_response.resource)
4387        }
4388        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4389            (),
4390            0x4db20876b537c52b,
4391            fidl::encoding::DynamicFlags::empty(),
4392            _decode,
4393        )
4394    }
4395}
4396
4397pub struct IoportResourceEventStream {
4398    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4399}
4400
4401impl std::marker::Unpin for IoportResourceEventStream {}
4402
4403impl futures::stream::FusedStream for IoportResourceEventStream {
4404    fn is_terminated(&self) -> bool {
4405        self.event_receiver.is_terminated()
4406    }
4407}
4408
4409impl futures::Stream for IoportResourceEventStream {
4410    type Item = Result<IoportResourceEvent, fidl::Error>;
4411
4412    fn poll_next(
4413        mut self: std::pin::Pin<&mut Self>,
4414        cx: &mut std::task::Context<'_>,
4415    ) -> std::task::Poll<Option<Self::Item>> {
4416        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4417            &mut self.event_receiver,
4418            cx
4419        )?) {
4420            Some(buf) => std::task::Poll::Ready(Some(IoportResourceEvent::decode(buf))),
4421            None => std::task::Poll::Ready(None),
4422        }
4423    }
4424}
4425
4426#[derive(Debug)]
4427pub enum IoportResourceEvent {}
4428
4429impl IoportResourceEvent {
4430    /// Decodes a message buffer as a [`IoportResourceEvent`].
4431    fn decode(
4432        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4433    ) -> Result<IoportResourceEvent, fidl::Error> {
4434        let (bytes, _handles) = buf.split_mut();
4435        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4436        debug_assert_eq!(tx_header.tx_id, 0);
4437        match tx_header.ordinal {
4438            _ => Err(fidl::Error::UnknownOrdinal {
4439                ordinal: tx_header.ordinal,
4440                protocol_name:
4441                    <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4442            }),
4443        }
4444    }
4445}
4446
4447/// A Stream of incoming requests for fuchsia.kernel/IoportResource.
4448pub struct IoportResourceRequestStream {
4449    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4450    is_terminated: bool,
4451}
4452
4453impl std::marker::Unpin for IoportResourceRequestStream {}
4454
4455impl futures::stream::FusedStream for IoportResourceRequestStream {
4456    fn is_terminated(&self) -> bool {
4457        self.is_terminated
4458    }
4459}
4460
4461impl fidl::endpoints::RequestStream for IoportResourceRequestStream {
4462    type Protocol = IoportResourceMarker;
4463    type ControlHandle = IoportResourceControlHandle;
4464
4465    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4466        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4467    }
4468
4469    fn control_handle(&self) -> Self::ControlHandle {
4470        IoportResourceControlHandle { inner: self.inner.clone() }
4471    }
4472
4473    fn into_inner(
4474        self,
4475    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4476    {
4477        (self.inner, self.is_terminated)
4478    }
4479
4480    fn from_inner(
4481        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4482        is_terminated: bool,
4483    ) -> Self {
4484        Self { inner, is_terminated }
4485    }
4486}
4487
4488impl futures::Stream for IoportResourceRequestStream {
4489    type Item = Result<IoportResourceRequest, fidl::Error>;
4490
4491    fn poll_next(
4492        mut self: std::pin::Pin<&mut Self>,
4493        cx: &mut std::task::Context<'_>,
4494    ) -> std::task::Poll<Option<Self::Item>> {
4495        let this = &mut *self;
4496        if this.inner.check_shutdown(cx) {
4497            this.is_terminated = true;
4498            return std::task::Poll::Ready(None);
4499        }
4500        if this.is_terminated {
4501            panic!("polled IoportResourceRequestStream after completion");
4502        }
4503        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4504            |bytes, handles| {
4505                match this.inner.channel().read_etc(cx, bytes, handles) {
4506                    std::task::Poll::Ready(Ok(())) => {}
4507                    std::task::Poll::Pending => return std::task::Poll::Pending,
4508                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4509                        this.is_terminated = true;
4510                        return std::task::Poll::Ready(None);
4511                    }
4512                    std::task::Poll::Ready(Err(e)) => {
4513                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4514                            e.into(),
4515                        ))))
4516                    }
4517                }
4518
4519                // A message has been received from the channel
4520                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4521
4522                std::task::Poll::Ready(Some(match header.ordinal {
4523                    0x4db20876b537c52b => {
4524                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4525                        let mut req = fidl::new_empty!(
4526                            fidl::encoding::EmptyPayload,
4527                            fidl::encoding::DefaultFuchsiaResourceDialect
4528                        );
4529                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4530                        let control_handle =
4531                            IoportResourceControlHandle { inner: this.inner.clone() };
4532                        Ok(IoportResourceRequest::Get {
4533                            responder: IoportResourceGetResponder {
4534                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4535                                tx_id: header.tx_id,
4536                            },
4537                        })
4538                    }
4539                    _ => Err(fidl::Error::UnknownOrdinal {
4540                        ordinal: header.ordinal,
4541                        protocol_name:
4542                            <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4543                    }),
4544                }))
4545            },
4546        )
4547    }
4548}
4549
4550/// Protocol for providing an IO Port resource with access to all valid ranges.
4551#[derive(Debug)]
4552pub enum IoportResourceRequest {
4553    /// Get an IO Port resource handle.
4554    Get { responder: IoportResourceGetResponder },
4555}
4556
4557impl IoportResourceRequest {
4558    #[allow(irrefutable_let_patterns)]
4559    pub fn into_get(self) -> Option<(IoportResourceGetResponder)> {
4560        if let IoportResourceRequest::Get { responder } = self {
4561            Some((responder))
4562        } else {
4563            None
4564        }
4565    }
4566
4567    /// Name of the method defined in FIDL
4568    pub fn method_name(&self) -> &'static str {
4569        match *self {
4570            IoportResourceRequest::Get { .. } => "get",
4571        }
4572    }
4573}
4574
4575#[derive(Debug, Clone)]
4576pub struct IoportResourceControlHandle {
4577    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4578}
4579
4580impl fidl::endpoints::ControlHandle for IoportResourceControlHandle {
4581    fn shutdown(&self) {
4582        self.inner.shutdown()
4583    }
4584    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4585        self.inner.shutdown_with_epitaph(status)
4586    }
4587
4588    fn is_closed(&self) -> bool {
4589        self.inner.channel().is_closed()
4590    }
4591    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4592        self.inner.channel().on_closed()
4593    }
4594
4595    #[cfg(target_os = "fuchsia")]
4596    fn signal_peer(
4597        &self,
4598        clear_mask: zx::Signals,
4599        set_mask: zx::Signals,
4600    ) -> Result<(), zx_status::Status> {
4601        use fidl::Peered;
4602        self.inner.channel().signal_peer(clear_mask, set_mask)
4603    }
4604}
4605
4606impl IoportResourceControlHandle {}
4607
4608#[must_use = "FIDL methods require a response to be sent"]
4609#[derive(Debug)]
4610pub struct IoportResourceGetResponder {
4611    control_handle: std::mem::ManuallyDrop<IoportResourceControlHandle>,
4612    tx_id: u32,
4613}
4614
4615/// Set the the channel to be shutdown (see [`IoportResourceControlHandle::shutdown`])
4616/// if the responder is dropped without sending a response, so that the client
4617/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4618impl std::ops::Drop for IoportResourceGetResponder {
4619    fn drop(&mut self) {
4620        self.control_handle.shutdown();
4621        // Safety: drops once, never accessed again
4622        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4623    }
4624}
4625
4626impl fidl::endpoints::Responder for IoportResourceGetResponder {
4627    type ControlHandle = IoportResourceControlHandle;
4628
4629    fn control_handle(&self) -> &IoportResourceControlHandle {
4630        &self.control_handle
4631    }
4632
4633    fn drop_without_shutdown(mut self) {
4634        // Safety: drops once, never accessed again due to mem::forget
4635        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4636        // Prevent Drop from running (which would shut down the channel)
4637        std::mem::forget(self);
4638    }
4639}
4640
4641impl IoportResourceGetResponder {
4642    /// Sends a response to the FIDL transaction.
4643    ///
4644    /// Sets the channel to shutdown if an error occurs.
4645    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4646        let _result = self.send_raw(resource);
4647        if _result.is_err() {
4648            self.control_handle.shutdown();
4649        }
4650        self.drop_without_shutdown();
4651        _result
4652    }
4653
4654    /// Similar to "send" but does not shutdown the channel if an error occurs.
4655    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4656        let _result = self.send_raw(resource);
4657        self.drop_without_shutdown();
4658        _result
4659    }
4660
4661    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4662        self.control_handle.inner.send::<IoportResourceGetResponse>(
4663            (resource,),
4664            self.tx_id,
4665            0x4db20876b537c52b,
4666            fidl::encoding::DynamicFlags::empty(),
4667        )
4668    }
4669}
4670
4671#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4672pub struct IrqResourceMarker;
4673
4674impl fidl::endpoints::ProtocolMarker for IrqResourceMarker {
4675    type Proxy = IrqResourceProxy;
4676    type RequestStream = IrqResourceRequestStream;
4677    #[cfg(target_os = "fuchsia")]
4678    type SynchronousProxy = IrqResourceSynchronousProxy;
4679
4680    const DEBUG_NAME: &'static str = "fuchsia.kernel.IrqResource";
4681}
4682impl fidl::endpoints::DiscoverableProtocolMarker for IrqResourceMarker {}
4683
4684pub trait IrqResourceProxyInterface: Send + Sync {
4685    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4686    fn r#get(&self) -> Self::GetResponseFut;
4687}
4688#[derive(Debug)]
4689#[cfg(target_os = "fuchsia")]
4690pub struct IrqResourceSynchronousProxy {
4691    client: fidl::client::sync::Client,
4692}
4693
4694#[cfg(target_os = "fuchsia")]
4695impl fidl::endpoints::SynchronousProxy for IrqResourceSynchronousProxy {
4696    type Proxy = IrqResourceProxy;
4697    type Protocol = IrqResourceMarker;
4698
4699    fn from_channel(inner: fidl::Channel) -> Self {
4700        Self::new(inner)
4701    }
4702
4703    fn into_channel(self) -> fidl::Channel {
4704        self.client.into_channel()
4705    }
4706
4707    fn as_channel(&self) -> &fidl::Channel {
4708        self.client.as_channel()
4709    }
4710}
4711
4712#[cfg(target_os = "fuchsia")]
4713impl IrqResourceSynchronousProxy {
4714    pub fn new(channel: fidl::Channel) -> Self {
4715        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4716        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4717    }
4718
4719    pub fn into_channel(self) -> fidl::Channel {
4720        self.client.into_channel()
4721    }
4722
4723    /// Waits until an event arrives and returns it. It is safe for other
4724    /// threads to make concurrent requests while waiting for an event.
4725    pub fn wait_for_event(
4726        &self,
4727        deadline: zx::MonotonicInstant,
4728    ) -> Result<IrqResourceEvent, fidl::Error> {
4729        IrqResourceEvent::decode(self.client.wait_for_event(deadline)?)
4730    }
4731
4732    /// Get an IRQ resource handle.
4733    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4734        let _response =
4735            self.client.send_query::<fidl::encoding::EmptyPayload, IrqResourceGetResponse>(
4736                (),
4737                0x491be54504b041e9,
4738                fidl::encoding::DynamicFlags::empty(),
4739                ___deadline,
4740            )?;
4741        Ok(_response.resource)
4742    }
4743}
4744
4745#[derive(Debug, Clone)]
4746pub struct IrqResourceProxy {
4747    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4748}
4749
4750impl fidl::endpoints::Proxy for IrqResourceProxy {
4751    type Protocol = IrqResourceMarker;
4752
4753    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4754        Self::new(inner)
4755    }
4756
4757    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4758        self.client.into_channel().map_err(|client| Self { client })
4759    }
4760
4761    fn as_channel(&self) -> &::fidl::AsyncChannel {
4762        self.client.as_channel()
4763    }
4764}
4765
4766impl IrqResourceProxy {
4767    /// Create a new Proxy for fuchsia.kernel/IrqResource.
4768    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4769        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4770        Self { client: fidl::client::Client::new(channel, protocol_name) }
4771    }
4772
4773    /// Get a Stream of events from the remote end of the protocol.
4774    ///
4775    /// # Panics
4776    ///
4777    /// Panics if the event stream was already taken.
4778    pub fn take_event_stream(&self) -> IrqResourceEventStream {
4779        IrqResourceEventStream { event_receiver: self.client.take_event_receiver() }
4780    }
4781
4782    /// Get an IRQ resource handle.
4783    pub fn r#get(
4784        &self,
4785    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4786    {
4787        IrqResourceProxyInterface::r#get(self)
4788    }
4789}
4790
4791impl IrqResourceProxyInterface for IrqResourceProxy {
4792    type GetResponseFut = fidl::client::QueryResponseFut<
4793        fidl::Resource,
4794        fidl::encoding::DefaultFuchsiaResourceDialect,
4795    >;
4796    fn r#get(&self) -> Self::GetResponseFut {
4797        fn _decode(
4798            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4799        ) -> Result<fidl::Resource, fidl::Error> {
4800            let _response = fidl::client::decode_transaction_body::<
4801                IrqResourceGetResponse,
4802                fidl::encoding::DefaultFuchsiaResourceDialect,
4803                0x491be54504b041e9,
4804            >(_buf?)?;
4805            Ok(_response.resource)
4806        }
4807        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4808            (),
4809            0x491be54504b041e9,
4810            fidl::encoding::DynamicFlags::empty(),
4811            _decode,
4812        )
4813    }
4814}
4815
4816pub struct IrqResourceEventStream {
4817    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4818}
4819
4820impl std::marker::Unpin for IrqResourceEventStream {}
4821
4822impl futures::stream::FusedStream for IrqResourceEventStream {
4823    fn is_terminated(&self) -> bool {
4824        self.event_receiver.is_terminated()
4825    }
4826}
4827
4828impl futures::Stream for IrqResourceEventStream {
4829    type Item = Result<IrqResourceEvent, fidl::Error>;
4830
4831    fn poll_next(
4832        mut self: std::pin::Pin<&mut Self>,
4833        cx: &mut std::task::Context<'_>,
4834    ) -> std::task::Poll<Option<Self::Item>> {
4835        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4836            &mut self.event_receiver,
4837            cx
4838        )?) {
4839            Some(buf) => std::task::Poll::Ready(Some(IrqResourceEvent::decode(buf))),
4840            None => std::task::Poll::Ready(None),
4841        }
4842    }
4843}
4844
4845#[derive(Debug)]
4846pub enum IrqResourceEvent {}
4847
4848impl IrqResourceEvent {
4849    /// Decodes a message buffer as a [`IrqResourceEvent`].
4850    fn decode(
4851        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4852    ) -> Result<IrqResourceEvent, fidl::Error> {
4853        let (bytes, _handles) = buf.split_mut();
4854        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4855        debug_assert_eq!(tx_header.tx_id, 0);
4856        match tx_header.ordinal {
4857            _ => Err(fidl::Error::UnknownOrdinal {
4858                ordinal: tx_header.ordinal,
4859                protocol_name: <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4860            }),
4861        }
4862    }
4863}
4864
4865/// A Stream of incoming requests for fuchsia.kernel/IrqResource.
4866pub struct IrqResourceRequestStream {
4867    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4868    is_terminated: bool,
4869}
4870
4871impl std::marker::Unpin for IrqResourceRequestStream {}
4872
4873impl futures::stream::FusedStream for IrqResourceRequestStream {
4874    fn is_terminated(&self) -> bool {
4875        self.is_terminated
4876    }
4877}
4878
4879impl fidl::endpoints::RequestStream for IrqResourceRequestStream {
4880    type Protocol = IrqResourceMarker;
4881    type ControlHandle = IrqResourceControlHandle;
4882
4883    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4884        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4885    }
4886
4887    fn control_handle(&self) -> Self::ControlHandle {
4888        IrqResourceControlHandle { inner: self.inner.clone() }
4889    }
4890
4891    fn into_inner(
4892        self,
4893    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4894    {
4895        (self.inner, self.is_terminated)
4896    }
4897
4898    fn from_inner(
4899        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4900        is_terminated: bool,
4901    ) -> Self {
4902        Self { inner, is_terminated }
4903    }
4904}
4905
4906impl futures::Stream for IrqResourceRequestStream {
4907    type Item = Result<IrqResourceRequest, fidl::Error>;
4908
4909    fn poll_next(
4910        mut self: std::pin::Pin<&mut Self>,
4911        cx: &mut std::task::Context<'_>,
4912    ) -> std::task::Poll<Option<Self::Item>> {
4913        let this = &mut *self;
4914        if this.inner.check_shutdown(cx) {
4915            this.is_terminated = true;
4916            return std::task::Poll::Ready(None);
4917        }
4918        if this.is_terminated {
4919            panic!("polled IrqResourceRequestStream after completion");
4920        }
4921        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4922            |bytes, handles| {
4923                match this.inner.channel().read_etc(cx, bytes, handles) {
4924                    std::task::Poll::Ready(Ok(())) => {}
4925                    std::task::Poll::Pending => return std::task::Poll::Pending,
4926                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4927                        this.is_terminated = true;
4928                        return std::task::Poll::Ready(None);
4929                    }
4930                    std::task::Poll::Ready(Err(e)) => {
4931                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4932                            e.into(),
4933                        ))))
4934                    }
4935                }
4936
4937                // A message has been received from the channel
4938                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4939
4940                std::task::Poll::Ready(Some(match header.ordinal {
4941                    0x491be54504b041e9 => {
4942                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4943                        let mut req = fidl::new_empty!(
4944                            fidl::encoding::EmptyPayload,
4945                            fidl::encoding::DefaultFuchsiaResourceDialect
4946                        );
4947                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4948                        let control_handle = IrqResourceControlHandle { inner: this.inner.clone() };
4949                        Ok(IrqResourceRequest::Get {
4950                            responder: IrqResourceGetResponder {
4951                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4952                                tx_id: header.tx_id,
4953                            },
4954                        })
4955                    }
4956                    _ => Err(fidl::Error::UnknownOrdinal {
4957                        ordinal: header.ordinal,
4958                        protocol_name:
4959                            <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4960                    }),
4961                }))
4962            },
4963        )
4964    }
4965}
4966
4967/// Protocol for providing an IRQ resource with access to all valid ranges.
4968#[derive(Debug)]
4969pub enum IrqResourceRequest {
4970    /// Get an IRQ resource handle.
4971    Get { responder: IrqResourceGetResponder },
4972}
4973
4974impl IrqResourceRequest {
4975    #[allow(irrefutable_let_patterns)]
4976    pub fn into_get(self) -> Option<(IrqResourceGetResponder)> {
4977        if let IrqResourceRequest::Get { responder } = self {
4978            Some((responder))
4979        } else {
4980            None
4981        }
4982    }
4983
4984    /// Name of the method defined in FIDL
4985    pub fn method_name(&self) -> &'static str {
4986        match *self {
4987            IrqResourceRequest::Get { .. } => "get",
4988        }
4989    }
4990}
4991
4992#[derive(Debug, Clone)]
4993pub struct IrqResourceControlHandle {
4994    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4995}
4996
4997impl fidl::endpoints::ControlHandle for IrqResourceControlHandle {
4998    fn shutdown(&self) {
4999        self.inner.shutdown()
5000    }
5001    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5002        self.inner.shutdown_with_epitaph(status)
5003    }
5004
5005    fn is_closed(&self) -> bool {
5006        self.inner.channel().is_closed()
5007    }
5008    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5009        self.inner.channel().on_closed()
5010    }
5011
5012    #[cfg(target_os = "fuchsia")]
5013    fn signal_peer(
5014        &self,
5015        clear_mask: zx::Signals,
5016        set_mask: zx::Signals,
5017    ) -> Result<(), zx_status::Status> {
5018        use fidl::Peered;
5019        self.inner.channel().signal_peer(clear_mask, set_mask)
5020    }
5021}
5022
5023impl IrqResourceControlHandle {}
5024
5025#[must_use = "FIDL methods require a response to be sent"]
5026#[derive(Debug)]
5027pub struct IrqResourceGetResponder {
5028    control_handle: std::mem::ManuallyDrop<IrqResourceControlHandle>,
5029    tx_id: u32,
5030}
5031
5032/// Set the the channel to be shutdown (see [`IrqResourceControlHandle::shutdown`])
5033/// if the responder is dropped without sending a response, so that the client
5034/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5035impl std::ops::Drop for IrqResourceGetResponder {
5036    fn drop(&mut self) {
5037        self.control_handle.shutdown();
5038        // Safety: drops once, never accessed again
5039        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5040    }
5041}
5042
5043impl fidl::endpoints::Responder for IrqResourceGetResponder {
5044    type ControlHandle = IrqResourceControlHandle;
5045
5046    fn control_handle(&self) -> &IrqResourceControlHandle {
5047        &self.control_handle
5048    }
5049
5050    fn drop_without_shutdown(mut self) {
5051        // Safety: drops once, never accessed again due to mem::forget
5052        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5053        // Prevent Drop from running (which would shut down the channel)
5054        std::mem::forget(self);
5055    }
5056}
5057
5058impl IrqResourceGetResponder {
5059    /// Sends a response to the FIDL transaction.
5060    ///
5061    /// Sets the channel to shutdown if an error occurs.
5062    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5063        let _result = self.send_raw(resource);
5064        if _result.is_err() {
5065            self.control_handle.shutdown();
5066        }
5067        self.drop_without_shutdown();
5068        _result
5069    }
5070
5071    /// Similar to "send" but does not shutdown the channel if an error occurs.
5072    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5073        let _result = self.send_raw(resource);
5074        self.drop_without_shutdown();
5075        _result
5076    }
5077
5078    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5079        self.control_handle.inner.send::<IrqResourceGetResponse>(
5080            (resource,),
5081            self.tx_id,
5082            0x491be54504b041e9,
5083            fidl::encoding::DynamicFlags::empty(),
5084        )
5085    }
5086}
5087
5088#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5089pub struct MexecResourceMarker;
5090
5091impl fidl::endpoints::ProtocolMarker for MexecResourceMarker {
5092    type Proxy = MexecResourceProxy;
5093    type RequestStream = MexecResourceRequestStream;
5094    #[cfg(target_os = "fuchsia")]
5095    type SynchronousProxy = MexecResourceSynchronousProxy;
5096
5097    const DEBUG_NAME: &'static str = "fuchsia.kernel.MexecResource";
5098}
5099impl fidl::endpoints::DiscoverableProtocolMarker for MexecResourceMarker {}
5100
5101pub trait MexecResourceProxyInterface: Send + Sync {
5102    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5103    fn r#get(&self) -> Self::GetResponseFut;
5104}
5105#[derive(Debug)]
5106#[cfg(target_os = "fuchsia")]
5107pub struct MexecResourceSynchronousProxy {
5108    client: fidl::client::sync::Client,
5109}
5110
5111#[cfg(target_os = "fuchsia")]
5112impl fidl::endpoints::SynchronousProxy for MexecResourceSynchronousProxy {
5113    type Proxy = MexecResourceProxy;
5114    type Protocol = MexecResourceMarker;
5115
5116    fn from_channel(inner: fidl::Channel) -> Self {
5117        Self::new(inner)
5118    }
5119
5120    fn into_channel(self) -> fidl::Channel {
5121        self.client.into_channel()
5122    }
5123
5124    fn as_channel(&self) -> &fidl::Channel {
5125        self.client.as_channel()
5126    }
5127}
5128
5129#[cfg(target_os = "fuchsia")]
5130impl MexecResourceSynchronousProxy {
5131    pub fn new(channel: fidl::Channel) -> Self {
5132        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5133        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5134    }
5135
5136    pub fn into_channel(self) -> fidl::Channel {
5137        self.client.into_channel()
5138    }
5139
5140    /// Waits until an event arrives and returns it. It is safe for other
5141    /// threads to make concurrent requests while waiting for an event.
5142    pub fn wait_for_event(
5143        &self,
5144        deadline: zx::MonotonicInstant,
5145    ) -> Result<MexecResourceEvent, fidl::Error> {
5146        MexecResourceEvent::decode(self.client.wait_for_event(deadline)?)
5147    }
5148
5149    /// Get an MEXEC resource handle as `resource`.
5150    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5151        let _response =
5152            self.client.send_query::<fidl::encoding::EmptyPayload, MexecResourceGetResponse>(
5153                (),
5154                0xff93e6722900f54,
5155                fidl::encoding::DynamicFlags::empty(),
5156                ___deadline,
5157            )?;
5158        Ok(_response.resource)
5159    }
5160}
5161
5162#[derive(Debug, Clone)]
5163pub struct MexecResourceProxy {
5164    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5165}
5166
5167impl fidl::endpoints::Proxy for MexecResourceProxy {
5168    type Protocol = MexecResourceMarker;
5169
5170    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5171        Self::new(inner)
5172    }
5173
5174    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5175        self.client.into_channel().map_err(|client| Self { client })
5176    }
5177
5178    fn as_channel(&self) -> &::fidl::AsyncChannel {
5179        self.client.as_channel()
5180    }
5181}
5182
5183impl MexecResourceProxy {
5184    /// Create a new Proxy for fuchsia.kernel/MexecResource.
5185    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5186        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5187        Self { client: fidl::client::Client::new(channel, protocol_name) }
5188    }
5189
5190    /// Get a Stream of events from the remote end of the protocol.
5191    ///
5192    /// # Panics
5193    ///
5194    /// Panics if the event stream was already taken.
5195    pub fn take_event_stream(&self) -> MexecResourceEventStream {
5196        MexecResourceEventStream { event_receiver: self.client.take_event_receiver() }
5197    }
5198
5199    /// Get an MEXEC resource handle as `resource`.
5200    pub fn r#get(
5201        &self,
5202    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5203    {
5204        MexecResourceProxyInterface::r#get(self)
5205    }
5206}
5207
5208impl MexecResourceProxyInterface for MexecResourceProxy {
5209    type GetResponseFut = fidl::client::QueryResponseFut<
5210        fidl::Resource,
5211        fidl::encoding::DefaultFuchsiaResourceDialect,
5212    >;
5213    fn r#get(&self) -> Self::GetResponseFut {
5214        fn _decode(
5215            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5216        ) -> Result<fidl::Resource, fidl::Error> {
5217            let _response = fidl::client::decode_transaction_body::<
5218                MexecResourceGetResponse,
5219                fidl::encoding::DefaultFuchsiaResourceDialect,
5220                0xff93e6722900f54,
5221            >(_buf?)?;
5222            Ok(_response.resource)
5223        }
5224        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5225            (),
5226            0xff93e6722900f54,
5227            fidl::encoding::DynamicFlags::empty(),
5228            _decode,
5229        )
5230    }
5231}
5232
5233pub struct MexecResourceEventStream {
5234    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5235}
5236
5237impl std::marker::Unpin for MexecResourceEventStream {}
5238
5239impl futures::stream::FusedStream for MexecResourceEventStream {
5240    fn is_terminated(&self) -> bool {
5241        self.event_receiver.is_terminated()
5242    }
5243}
5244
5245impl futures::Stream for MexecResourceEventStream {
5246    type Item = Result<MexecResourceEvent, fidl::Error>;
5247
5248    fn poll_next(
5249        mut self: std::pin::Pin<&mut Self>,
5250        cx: &mut std::task::Context<'_>,
5251    ) -> std::task::Poll<Option<Self::Item>> {
5252        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5253            &mut self.event_receiver,
5254            cx
5255        )?) {
5256            Some(buf) => std::task::Poll::Ready(Some(MexecResourceEvent::decode(buf))),
5257            None => std::task::Poll::Ready(None),
5258        }
5259    }
5260}
5261
5262#[derive(Debug)]
5263pub enum MexecResourceEvent {}
5264
5265impl MexecResourceEvent {
5266    /// Decodes a message buffer as a [`MexecResourceEvent`].
5267    fn decode(
5268        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5269    ) -> Result<MexecResourceEvent, fidl::Error> {
5270        let (bytes, _handles) = buf.split_mut();
5271        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5272        debug_assert_eq!(tx_header.tx_id, 0);
5273        match tx_header.ordinal {
5274            _ => Err(fidl::Error::UnknownOrdinal {
5275                ordinal: tx_header.ordinal,
5276                protocol_name: <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5277            }),
5278        }
5279    }
5280}
5281
5282/// A Stream of incoming requests for fuchsia.kernel/MexecResource.
5283pub struct MexecResourceRequestStream {
5284    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5285    is_terminated: bool,
5286}
5287
5288impl std::marker::Unpin for MexecResourceRequestStream {}
5289
5290impl futures::stream::FusedStream for MexecResourceRequestStream {
5291    fn is_terminated(&self) -> bool {
5292        self.is_terminated
5293    }
5294}
5295
5296impl fidl::endpoints::RequestStream for MexecResourceRequestStream {
5297    type Protocol = MexecResourceMarker;
5298    type ControlHandle = MexecResourceControlHandle;
5299
5300    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5301        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5302    }
5303
5304    fn control_handle(&self) -> Self::ControlHandle {
5305        MexecResourceControlHandle { inner: self.inner.clone() }
5306    }
5307
5308    fn into_inner(
5309        self,
5310    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5311    {
5312        (self.inner, self.is_terminated)
5313    }
5314
5315    fn from_inner(
5316        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5317        is_terminated: bool,
5318    ) -> Self {
5319        Self { inner, is_terminated }
5320    }
5321}
5322
5323impl futures::Stream for MexecResourceRequestStream {
5324    type Item = Result<MexecResourceRequest, fidl::Error>;
5325
5326    fn poll_next(
5327        mut self: std::pin::Pin<&mut Self>,
5328        cx: &mut std::task::Context<'_>,
5329    ) -> std::task::Poll<Option<Self::Item>> {
5330        let this = &mut *self;
5331        if this.inner.check_shutdown(cx) {
5332            this.is_terminated = true;
5333            return std::task::Poll::Ready(None);
5334        }
5335        if this.is_terminated {
5336            panic!("polled MexecResourceRequestStream after completion");
5337        }
5338        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5339            |bytes, handles| {
5340                match this.inner.channel().read_etc(cx, bytes, handles) {
5341                    std::task::Poll::Ready(Ok(())) => {}
5342                    std::task::Poll::Pending => return std::task::Poll::Pending,
5343                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5344                        this.is_terminated = true;
5345                        return std::task::Poll::Ready(None);
5346                    }
5347                    std::task::Poll::Ready(Err(e)) => {
5348                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5349                            e.into(),
5350                        ))))
5351                    }
5352                }
5353
5354                // A message has been received from the channel
5355                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5356
5357                std::task::Poll::Ready(Some(match header.ordinal {
5358                    0xff93e6722900f54 => {
5359                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5360                        let mut req = fidl::new_empty!(
5361                            fidl::encoding::EmptyPayload,
5362                            fidl::encoding::DefaultFuchsiaResourceDialect
5363                        );
5364                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5365                        let control_handle =
5366                            MexecResourceControlHandle { inner: this.inner.clone() };
5367                        Ok(MexecResourceRequest::Get {
5368                            responder: MexecResourceGetResponder {
5369                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5370                                tx_id: header.tx_id,
5371                            },
5372                        })
5373                    }
5374                    _ => Err(fidl::Error::UnknownOrdinal {
5375                        ordinal: header.ordinal,
5376                        protocol_name:
5377                            <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5378                    }),
5379                }))
5380            },
5381        )
5382    }
5383}
5384
5385/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
5386/// `ZX_RSRC_SYSTEM_MEXEC_BASE`.
5387#[derive(Debug)]
5388pub enum MexecResourceRequest {
5389    /// Get an MEXEC resource handle as `resource`.
5390    Get { responder: MexecResourceGetResponder },
5391}
5392
5393impl MexecResourceRequest {
5394    #[allow(irrefutable_let_patterns)]
5395    pub fn into_get(self) -> Option<(MexecResourceGetResponder)> {
5396        if let MexecResourceRequest::Get { responder } = self {
5397            Some((responder))
5398        } else {
5399            None
5400        }
5401    }
5402
5403    /// Name of the method defined in FIDL
5404    pub fn method_name(&self) -> &'static str {
5405        match *self {
5406            MexecResourceRequest::Get { .. } => "get",
5407        }
5408    }
5409}
5410
5411#[derive(Debug, Clone)]
5412pub struct MexecResourceControlHandle {
5413    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5414}
5415
5416impl fidl::endpoints::ControlHandle for MexecResourceControlHandle {
5417    fn shutdown(&self) {
5418        self.inner.shutdown()
5419    }
5420    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5421        self.inner.shutdown_with_epitaph(status)
5422    }
5423
5424    fn is_closed(&self) -> bool {
5425        self.inner.channel().is_closed()
5426    }
5427    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5428        self.inner.channel().on_closed()
5429    }
5430
5431    #[cfg(target_os = "fuchsia")]
5432    fn signal_peer(
5433        &self,
5434        clear_mask: zx::Signals,
5435        set_mask: zx::Signals,
5436    ) -> Result<(), zx_status::Status> {
5437        use fidl::Peered;
5438        self.inner.channel().signal_peer(clear_mask, set_mask)
5439    }
5440}
5441
5442impl MexecResourceControlHandle {}
5443
5444#[must_use = "FIDL methods require a response to be sent"]
5445#[derive(Debug)]
5446pub struct MexecResourceGetResponder {
5447    control_handle: std::mem::ManuallyDrop<MexecResourceControlHandle>,
5448    tx_id: u32,
5449}
5450
5451/// Set the the channel to be shutdown (see [`MexecResourceControlHandle::shutdown`])
5452/// if the responder is dropped without sending a response, so that the client
5453/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5454impl std::ops::Drop for MexecResourceGetResponder {
5455    fn drop(&mut self) {
5456        self.control_handle.shutdown();
5457        // Safety: drops once, never accessed again
5458        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5459    }
5460}
5461
5462impl fidl::endpoints::Responder for MexecResourceGetResponder {
5463    type ControlHandle = MexecResourceControlHandle;
5464
5465    fn control_handle(&self) -> &MexecResourceControlHandle {
5466        &self.control_handle
5467    }
5468
5469    fn drop_without_shutdown(mut self) {
5470        // Safety: drops once, never accessed again due to mem::forget
5471        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5472        // Prevent Drop from running (which would shut down the channel)
5473        std::mem::forget(self);
5474    }
5475}
5476
5477impl MexecResourceGetResponder {
5478    /// Sends a response to the FIDL transaction.
5479    ///
5480    /// Sets the channel to shutdown if an error occurs.
5481    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5482        let _result = self.send_raw(resource);
5483        if _result.is_err() {
5484            self.control_handle.shutdown();
5485        }
5486        self.drop_without_shutdown();
5487        _result
5488    }
5489
5490    /// Similar to "send" but does not shutdown the channel if an error occurs.
5491    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5492        let _result = self.send_raw(resource);
5493        self.drop_without_shutdown();
5494        _result
5495    }
5496
5497    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5498        self.control_handle.inner.send::<MexecResourceGetResponse>(
5499            (resource,),
5500            self.tx_id,
5501            0xff93e6722900f54,
5502            fidl::encoding::DynamicFlags::empty(),
5503        )
5504    }
5505}
5506
5507#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5508pub struct MmioResourceMarker;
5509
5510impl fidl::endpoints::ProtocolMarker for MmioResourceMarker {
5511    type Proxy = MmioResourceProxy;
5512    type RequestStream = MmioResourceRequestStream;
5513    #[cfg(target_os = "fuchsia")]
5514    type SynchronousProxy = MmioResourceSynchronousProxy;
5515
5516    const DEBUG_NAME: &'static str = "fuchsia.kernel.MmioResource";
5517}
5518impl fidl::endpoints::DiscoverableProtocolMarker for MmioResourceMarker {}
5519
5520pub trait MmioResourceProxyInterface: Send + Sync {
5521    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5522    fn r#get(&self) -> Self::GetResponseFut;
5523}
5524#[derive(Debug)]
5525#[cfg(target_os = "fuchsia")]
5526pub struct MmioResourceSynchronousProxy {
5527    client: fidl::client::sync::Client,
5528}
5529
5530#[cfg(target_os = "fuchsia")]
5531impl fidl::endpoints::SynchronousProxy for MmioResourceSynchronousProxy {
5532    type Proxy = MmioResourceProxy;
5533    type Protocol = MmioResourceMarker;
5534
5535    fn from_channel(inner: fidl::Channel) -> Self {
5536        Self::new(inner)
5537    }
5538
5539    fn into_channel(self) -> fidl::Channel {
5540        self.client.into_channel()
5541    }
5542
5543    fn as_channel(&self) -> &fidl::Channel {
5544        self.client.as_channel()
5545    }
5546}
5547
5548#[cfg(target_os = "fuchsia")]
5549impl MmioResourceSynchronousProxy {
5550    pub fn new(channel: fidl::Channel) -> Self {
5551        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5552        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5553    }
5554
5555    pub fn into_channel(self) -> fidl::Channel {
5556        self.client.into_channel()
5557    }
5558
5559    /// Waits until an event arrives and returns it. It is safe for other
5560    /// threads to make concurrent requests while waiting for an event.
5561    pub fn wait_for_event(
5562        &self,
5563        deadline: zx::MonotonicInstant,
5564    ) -> Result<MmioResourceEvent, fidl::Error> {
5565        MmioResourceEvent::decode(self.client.wait_for_event(deadline)?)
5566    }
5567
5568    /// Get an MMIO resource handle.
5569    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5570        let _response =
5571            self.client.send_query::<fidl::encoding::EmptyPayload, MmioResourceGetResponse>(
5572                (),
5573                0x66747b9c5a6dfe7b,
5574                fidl::encoding::DynamicFlags::empty(),
5575                ___deadline,
5576            )?;
5577        Ok(_response.resource)
5578    }
5579}
5580
5581#[derive(Debug, Clone)]
5582pub struct MmioResourceProxy {
5583    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5584}
5585
5586impl fidl::endpoints::Proxy for MmioResourceProxy {
5587    type Protocol = MmioResourceMarker;
5588
5589    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5590        Self::new(inner)
5591    }
5592
5593    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5594        self.client.into_channel().map_err(|client| Self { client })
5595    }
5596
5597    fn as_channel(&self) -> &::fidl::AsyncChannel {
5598        self.client.as_channel()
5599    }
5600}
5601
5602impl MmioResourceProxy {
5603    /// Create a new Proxy for fuchsia.kernel/MmioResource.
5604    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5605        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5606        Self { client: fidl::client::Client::new(channel, protocol_name) }
5607    }
5608
5609    /// Get a Stream of events from the remote end of the protocol.
5610    ///
5611    /// # Panics
5612    ///
5613    /// Panics if the event stream was already taken.
5614    pub fn take_event_stream(&self) -> MmioResourceEventStream {
5615        MmioResourceEventStream { event_receiver: self.client.take_event_receiver() }
5616    }
5617
5618    /// Get an MMIO resource handle.
5619    pub fn r#get(
5620        &self,
5621    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5622    {
5623        MmioResourceProxyInterface::r#get(self)
5624    }
5625}
5626
5627impl MmioResourceProxyInterface for MmioResourceProxy {
5628    type GetResponseFut = fidl::client::QueryResponseFut<
5629        fidl::Resource,
5630        fidl::encoding::DefaultFuchsiaResourceDialect,
5631    >;
5632    fn r#get(&self) -> Self::GetResponseFut {
5633        fn _decode(
5634            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5635        ) -> Result<fidl::Resource, fidl::Error> {
5636            let _response = fidl::client::decode_transaction_body::<
5637                MmioResourceGetResponse,
5638                fidl::encoding::DefaultFuchsiaResourceDialect,
5639                0x66747b9c5a6dfe7b,
5640            >(_buf?)?;
5641            Ok(_response.resource)
5642        }
5643        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5644            (),
5645            0x66747b9c5a6dfe7b,
5646            fidl::encoding::DynamicFlags::empty(),
5647            _decode,
5648        )
5649    }
5650}
5651
5652pub struct MmioResourceEventStream {
5653    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5654}
5655
5656impl std::marker::Unpin for MmioResourceEventStream {}
5657
5658impl futures::stream::FusedStream for MmioResourceEventStream {
5659    fn is_terminated(&self) -> bool {
5660        self.event_receiver.is_terminated()
5661    }
5662}
5663
5664impl futures::Stream for MmioResourceEventStream {
5665    type Item = Result<MmioResourceEvent, fidl::Error>;
5666
5667    fn poll_next(
5668        mut self: std::pin::Pin<&mut Self>,
5669        cx: &mut std::task::Context<'_>,
5670    ) -> std::task::Poll<Option<Self::Item>> {
5671        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5672            &mut self.event_receiver,
5673            cx
5674        )?) {
5675            Some(buf) => std::task::Poll::Ready(Some(MmioResourceEvent::decode(buf))),
5676            None => std::task::Poll::Ready(None),
5677        }
5678    }
5679}
5680
5681#[derive(Debug)]
5682pub enum MmioResourceEvent {}
5683
5684impl MmioResourceEvent {
5685    /// Decodes a message buffer as a [`MmioResourceEvent`].
5686    fn decode(
5687        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5688    ) -> Result<MmioResourceEvent, fidl::Error> {
5689        let (bytes, _handles) = buf.split_mut();
5690        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5691        debug_assert_eq!(tx_header.tx_id, 0);
5692        match tx_header.ordinal {
5693            _ => Err(fidl::Error::UnknownOrdinal {
5694                ordinal: tx_header.ordinal,
5695                protocol_name: <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5696            }),
5697        }
5698    }
5699}
5700
5701/// A Stream of incoming requests for fuchsia.kernel/MmioResource.
5702pub struct MmioResourceRequestStream {
5703    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5704    is_terminated: bool,
5705}
5706
5707impl std::marker::Unpin for MmioResourceRequestStream {}
5708
5709impl futures::stream::FusedStream for MmioResourceRequestStream {
5710    fn is_terminated(&self) -> bool {
5711        self.is_terminated
5712    }
5713}
5714
5715impl fidl::endpoints::RequestStream for MmioResourceRequestStream {
5716    type Protocol = MmioResourceMarker;
5717    type ControlHandle = MmioResourceControlHandle;
5718
5719    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5720        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5721    }
5722
5723    fn control_handle(&self) -> Self::ControlHandle {
5724        MmioResourceControlHandle { inner: self.inner.clone() }
5725    }
5726
5727    fn into_inner(
5728        self,
5729    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5730    {
5731        (self.inner, self.is_terminated)
5732    }
5733
5734    fn from_inner(
5735        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5736        is_terminated: bool,
5737    ) -> Self {
5738        Self { inner, is_terminated }
5739    }
5740}
5741
5742impl futures::Stream for MmioResourceRequestStream {
5743    type Item = Result<MmioResourceRequest, fidl::Error>;
5744
5745    fn poll_next(
5746        mut self: std::pin::Pin<&mut Self>,
5747        cx: &mut std::task::Context<'_>,
5748    ) -> std::task::Poll<Option<Self::Item>> {
5749        let this = &mut *self;
5750        if this.inner.check_shutdown(cx) {
5751            this.is_terminated = true;
5752            return std::task::Poll::Ready(None);
5753        }
5754        if this.is_terminated {
5755            panic!("polled MmioResourceRequestStream after completion");
5756        }
5757        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5758            |bytes, handles| {
5759                match this.inner.channel().read_etc(cx, bytes, handles) {
5760                    std::task::Poll::Ready(Ok(())) => {}
5761                    std::task::Poll::Pending => return std::task::Poll::Pending,
5762                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5763                        this.is_terminated = true;
5764                        return std::task::Poll::Ready(None);
5765                    }
5766                    std::task::Poll::Ready(Err(e)) => {
5767                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5768                            e.into(),
5769                        ))))
5770                    }
5771                }
5772
5773                // A message has been received from the channel
5774                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5775
5776                std::task::Poll::Ready(Some(match header.ordinal {
5777                    0x66747b9c5a6dfe7b => {
5778                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5779                        let mut req = fidl::new_empty!(
5780                            fidl::encoding::EmptyPayload,
5781                            fidl::encoding::DefaultFuchsiaResourceDialect
5782                        );
5783                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5784                        let control_handle =
5785                            MmioResourceControlHandle { inner: this.inner.clone() };
5786                        Ok(MmioResourceRequest::Get {
5787                            responder: MmioResourceGetResponder {
5788                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5789                                tx_id: header.tx_id,
5790                            },
5791                        })
5792                    }
5793                    _ => Err(fidl::Error::UnknownOrdinal {
5794                        ordinal: header.ordinal,
5795                        protocol_name:
5796                            <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5797                    }),
5798                }))
5799            },
5800        )
5801    }
5802}
5803
5804/// Protocol for providing an MMIO resource with access to all valid ranges.
5805#[derive(Debug)]
5806pub enum MmioResourceRequest {
5807    /// Get an MMIO resource handle.
5808    Get { responder: MmioResourceGetResponder },
5809}
5810
5811impl MmioResourceRequest {
5812    #[allow(irrefutable_let_patterns)]
5813    pub fn into_get(self) -> Option<(MmioResourceGetResponder)> {
5814        if let MmioResourceRequest::Get { responder } = self {
5815            Some((responder))
5816        } else {
5817            None
5818        }
5819    }
5820
5821    /// Name of the method defined in FIDL
5822    pub fn method_name(&self) -> &'static str {
5823        match *self {
5824            MmioResourceRequest::Get { .. } => "get",
5825        }
5826    }
5827}
5828
5829#[derive(Debug, Clone)]
5830pub struct MmioResourceControlHandle {
5831    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5832}
5833
5834impl fidl::endpoints::ControlHandle for MmioResourceControlHandle {
5835    fn shutdown(&self) {
5836        self.inner.shutdown()
5837    }
5838    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5839        self.inner.shutdown_with_epitaph(status)
5840    }
5841
5842    fn is_closed(&self) -> bool {
5843        self.inner.channel().is_closed()
5844    }
5845    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5846        self.inner.channel().on_closed()
5847    }
5848
5849    #[cfg(target_os = "fuchsia")]
5850    fn signal_peer(
5851        &self,
5852        clear_mask: zx::Signals,
5853        set_mask: zx::Signals,
5854    ) -> Result<(), zx_status::Status> {
5855        use fidl::Peered;
5856        self.inner.channel().signal_peer(clear_mask, set_mask)
5857    }
5858}
5859
5860impl MmioResourceControlHandle {}
5861
5862#[must_use = "FIDL methods require a response to be sent"]
5863#[derive(Debug)]
5864pub struct MmioResourceGetResponder {
5865    control_handle: std::mem::ManuallyDrop<MmioResourceControlHandle>,
5866    tx_id: u32,
5867}
5868
5869/// Set the the channel to be shutdown (see [`MmioResourceControlHandle::shutdown`])
5870/// if the responder is dropped without sending a response, so that the client
5871/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5872impl std::ops::Drop for MmioResourceGetResponder {
5873    fn drop(&mut self) {
5874        self.control_handle.shutdown();
5875        // Safety: drops once, never accessed again
5876        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5877    }
5878}
5879
5880impl fidl::endpoints::Responder for MmioResourceGetResponder {
5881    type ControlHandle = MmioResourceControlHandle;
5882
5883    fn control_handle(&self) -> &MmioResourceControlHandle {
5884        &self.control_handle
5885    }
5886
5887    fn drop_without_shutdown(mut self) {
5888        // Safety: drops once, never accessed again due to mem::forget
5889        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5890        // Prevent Drop from running (which would shut down the channel)
5891        std::mem::forget(self);
5892    }
5893}
5894
5895impl MmioResourceGetResponder {
5896    /// Sends a response to the FIDL transaction.
5897    ///
5898    /// Sets the channel to shutdown if an error occurs.
5899    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5900        let _result = self.send_raw(resource);
5901        if _result.is_err() {
5902            self.control_handle.shutdown();
5903        }
5904        self.drop_without_shutdown();
5905        _result
5906    }
5907
5908    /// Similar to "send" but does not shutdown the channel if an error occurs.
5909    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5910        let _result = self.send_raw(resource);
5911        self.drop_without_shutdown();
5912        _result
5913    }
5914
5915    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5916        self.control_handle.inner.send::<MmioResourceGetResponse>(
5917            (resource,),
5918            self.tx_id,
5919            0x66747b9c5a6dfe7b,
5920            fidl::encoding::DynamicFlags::empty(),
5921        )
5922    }
5923}
5924
5925#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5926pub struct MsiResourceMarker;
5927
5928impl fidl::endpoints::ProtocolMarker for MsiResourceMarker {
5929    type Proxy = MsiResourceProxy;
5930    type RequestStream = MsiResourceRequestStream;
5931    #[cfg(target_os = "fuchsia")]
5932    type SynchronousProxy = MsiResourceSynchronousProxy;
5933
5934    const DEBUG_NAME: &'static str = "fuchsia.kernel.MsiResource";
5935}
5936impl fidl::endpoints::DiscoverableProtocolMarker for MsiResourceMarker {}
5937
5938pub trait MsiResourceProxyInterface: Send + Sync {
5939    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5940    fn r#get(&self) -> Self::GetResponseFut;
5941}
5942#[derive(Debug)]
5943#[cfg(target_os = "fuchsia")]
5944pub struct MsiResourceSynchronousProxy {
5945    client: fidl::client::sync::Client,
5946}
5947
5948#[cfg(target_os = "fuchsia")]
5949impl fidl::endpoints::SynchronousProxy for MsiResourceSynchronousProxy {
5950    type Proxy = MsiResourceProxy;
5951    type Protocol = MsiResourceMarker;
5952
5953    fn from_channel(inner: fidl::Channel) -> Self {
5954        Self::new(inner)
5955    }
5956
5957    fn into_channel(self) -> fidl::Channel {
5958        self.client.into_channel()
5959    }
5960
5961    fn as_channel(&self) -> &fidl::Channel {
5962        self.client.as_channel()
5963    }
5964}
5965
5966#[cfg(target_os = "fuchsia")]
5967impl MsiResourceSynchronousProxy {
5968    pub fn new(channel: fidl::Channel) -> Self {
5969        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5970        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5971    }
5972
5973    pub fn into_channel(self) -> fidl::Channel {
5974        self.client.into_channel()
5975    }
5976
5977    /// Waits until an event arrives and returns it. It is safe for other
5978    /// threads to make concurrent requests while waiting for an event.
5979    pub fn wait_for_event(
5980        &self,
5981        deadline: zx::MonotonicInstant,
5982    ) -> Result<MsiResourceEvent, fidl::Error> {
5983        MsiResourceEvent::decode(self.client.wait_for_event(deadline)?)
5984    }
5985
5986    /// Get an msi resource handle.
5987    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5988        let _response =
5989            self.client.send_query::<fidl::encoding::EmptyPayload, MsiResourceGetResponse>(
5990                (),
5991                0x360a97e47e8c4f1f,
5992                fidl::encoding::DynamicFlags::empty(),
5993                ___deadline,
5994            )?;
5995        Ok(_response.resource)
5996    }
5997}
5998
5999#[derive(Debug, Clone)]
6000pub struct MsiResourceProxy {
6001    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6002}
6003
6004impl fidl::endpoints::Proxy for MsiResourceProxy {
6005    type Protocol = MsiResourceMarker;
6006
6007    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6008        Self::new(inner)
6009    }
6010
6011    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6012        self.client.into_channel().map_err(|client| Self { client })
6013    }
6014
6015    fn as_channel(&self) -> &::fidl::AsyncChannel {
6016        self.client.as_channel()
6017    }
6018}
6019
6020impl MsiResourceProxy {
6021    /// Create a new Proxy for fuchsia.kernel/MsiResource.
6022    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6023        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6024        Self { client: fidl::client::Client::new(channel, protocol_name) }
6025    }
6026
6027    /// Get a Stream of events from the remote end of the protocol.
6028    ///
6029    /// # Panics
6030    ///
6031    /// Panics if the event stream was already taken.
6032    pub fn take_event_stream(&self) -> MsiResourceEventStream {
6033        MsiResourceEventStream { event_receiver: self.client.take_event_receiver() }
6034    }
6035
6036    /// Get an msi resource handle.
6037    pub fn r#get(
6038        &self,
6039    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6040    {
6041        MsiResourceProxyInterface::r#get(self)
6042    }
6043}
6044
6045impl MsiResourceProxyInterface for MsiResourceProxy {
6046    type GetResponseFut = fidl::client::QueryResponseFut<
6047        fidl::Resource,
6048        fidl::encoding::DefaultFuchsiaResourceDialect,
6049    >;
6050    fn r#get(&self) -> Self::GetResponseFut {
6051        fn _decode(
6052            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6053        ) -> Result<fidl::Resource, fidl::Error> {
6054            let _response = fidl::client::decode_transaction_body::<
6055                MsiResourceGetResponse,
6056                fidl::encoding::DefaultFuchsiaResourceDialect,
6057                0x360a97e47e8c4f1f,
6058            >(_buf?)?;
6059            Ok(_response.resource)
6060        }
6061        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6062            (),
6063            0x360a97e47e8c4f1f,
6064            fidl::encoding::DynamicFlags::empty(),
6065            _decode,
6066        )
6067    }
6068}
6069
6070pub struct MsiResourceEventStream {
6071    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6072}
6073
6074impl std::marker::Unpin for MsiResourceEventStream {}
6075
6076impl futures::stream::FusedStream for MsiResourceEventStream {
6077    fn is_terminated(&self) -> bool {
6078        self.event_receiver.is_terminated()
6079    }
6080}
6081
6082impl futures::Stream for MsiResourceEventStream {
6083    type Item = Result<MsiResourceEvent, fidl::Error>;
6084
6085    fn poll_next(
6086        mut self: std::pin::Pin<&mut Self>,
6087        cx: &mut std::task::Context<'_>,
6088    ) -> std::task::Poll<Option<Self::Item>> {
6089        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6090            &mut self.event_receiver,
6091            cx
6092        )?) {
6093            Some(buf) => std::task::Poll::Ready(Some(MsiResourceEvent::decode(buf))),
6094            None => std::task::Poll::Ready(None),
6095        }
6096    }
6097}
6098
6099#[derive(Debug)]
6100pub enum MsiResourceEvent {}
6101
6102impl MsiResourceEvent {
6103    /// Decodes a message buffer as a [`MsiResourceEvent`].
6104    fn decode(
6105        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6106    ) -> Result<MsiResourceEvent, fidl::Error> {
6107        let (bytes, _handles) = buf.split_mut();
6108        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6109        debug_assert_eq!(tx_header.tx_id, 0);
6110        match tx_header.ordinal {
6111            _ => Err(fidl::Error::UnknownOrdinal {
6112                ordinal: tx_header.ordinal,
6113                protocol_name: <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6114            }),
6115        }
6116    }
6117}
6118
6119/// A Stream of incoming requests for fuchsia.kernel/MsiResource.
6120pub struct MsiResourceRequestStream {
6121    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6122    is_terminated: bool,
6123}
6124
6125impl std::marker::Unpin for MsiResourceRequestStream {}
6126
6127impl futures::stream::FusedStream for MsiResourceRequestStream {
6128    fn is_terminated(&self) -> bool {
6129        self.is_terminated
6130    }
6131}
6132
6133impl fidl::endpoints::RequestStream for MsiResourceRequestStream {
6134    type Protocol = MsiResourceMarker;
6135    type ControlHandle = MsiResourceControlHandle;
6136
6137    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6138        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6139    }
6140
6141    fn control_handle(&self) -> Self::ControlHandle {
6142        MsiResourceControlHandle { inner: self.inner.clone() }
6143    }
6144
6145    fn into_inner(
6146        self,
6147    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6148    {
6149        (self.inner, self.is_terminated)
6150    }
6151
6152    fn from_inner(
6153        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6154        is_terminated: bool,
6155    ) -> Self {
6156        Self { inner, is_terminated }
6157    }
6158}
6159
6160impl futures::Stream for MsiResourceRequestStream {
6161    type Item = Result<MsiResourceRequest, fidl::Error>;
6162
6163    fn poll_next(
6164        mut self: std::pin::Pin<&mut Self>,
6165        cx: &mut std::task::Context<'_>,
6166    ) -> std::task::Poll<Option<Self::Item>> {
6167        let this = &mut *self;
6168        if this.inner.check_shutdown(cx) {
6169            this.is_terminated = true;
6170            return std::task::Poll::Ready(None);
6171        }
6172        if this.is_terminated {
6173            panic!("polled MsiResourceRequestStream after completion");
6174        }
6175        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6176            |bytes, handles| {
6177                match this.inner.channel().read_etc(cx, bytes, handles) {
6178                    std::task::Poll::Ready(Ok(())) => {}
6179                    std::task::Poll::Pending => return std::task::Poll::Pending,
6180                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6181                        this.is_terminated = true;
6182                        return std::task::Poll::Ready(None);
6183                    }
6184                    std::task::Poll::Ready(Err(e)) => {
6185                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6186                            e.into(),
6187                        ))))
6188                    }
6189                }
6190
6191                // A message has been received from the channel
6192                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6193
6194                std::task::Poll::Ready(Some(match header.ordinal {
6195                    0x360a97e47e8c4f1f => {
6196                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6197                        let mut req = fidl::new_empty!(
6198                            fidl::encoding::EmptyPayload,
6199                            fidl::encoding::DefaultFuchsiaResourceDialect
6200                        );
6201                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6202                        let control_handle = MsiResourceControlHandle { inner: this.inner.clone() };
6203                        Ok(MsiResourceRequest::Get {
6204                            responder: MsiResourceGetResponder {
6205                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6206                                tx_id: header.tx_id,
6207                            },
6208                        })
6209                    }
6210                    _ => Err(fidl::Error::UnknownOrdinal {
6211                        ordinal: header.ordinal,
6212                        protocol_name:
6213                            <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6214                    }),
6215                }))
6216            },
6217        )
6218    }
6219}
6220
6221/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6222/// `ZX_RSRC_SYSTEM_MSI_BASE`.
6223#[derive(Debug)]
6224pub enum MsiResourceRequest {
6225    /// Get an msi resource handle.
6226    Get { responder: MsiResourceGetResponder },
6227}
6228
6229impl MsiResourceRequest {
6230    #[allow(irrefutable_let_patterns)]
6231    pub fn into_get(self) -> Option<(MsiResourceGetResponder)> {
6232        if let MsiResourceRequest::Get { responder } = self {
6233            Some((responder))
6234        } else {
6235            None
6236        }
6237    }
6238
6239    /// Name of the method defined in FIDL
6240    pub fn method_name(&self) -> &'static str {
6241        match *self {
6242            MsiResourceRequest::Get { .. } => "get",
6243        }
6244    }
6245}
6246
6247#[derive(Debug, Clone)]
6248pub struct MsiResourceControlHandle {
6249    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6250}
6251
6252impl fidl::endpoints::ControlHandle for MsiResourceControlHandle {
6253    fn shutdown(&self) {
6254        self.inner.shutdown()
6255    }
6256    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6257        self.inner.shutdown_with_epitaph(status)
6258    }
6259
6260    fn is_closed(&self) -> bool {
6261        self.inner.channel().is_closed()
6262    }
6263    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6264        self.inner.channel().on_closed()
6265    }
6266
6267    #[cfg(target_os = "fuchsia")]
6268    fn signal_peer(
6269        &self,
6270        clear_mask: zx::Signals,
6271        set_mask: zx::Signals,
6272    ) -> Result<(), zx_status::Status> {
6273        use fidl::Peered;
6274        self.inner.channel().signal_peer(clear_mask, set_mask)
6275    }
6276}
6277
6278impl MsiResourceControlHandle {}
6279
6280#[must_use = "FIDL methods require a response to be sent"]
6281#[derive(Debug)]
6282pub struct MsiResourceGetResponder {
6283    control_handle: std::mem::ManuallyDrop<MsiResourceControlHandle>,
6284    tx_id: u32,
6285}
6286
6287/// Set the the channel to be shutdown (see [`MsiResourceControlHandle::shutdown`])
6288/// if the responder is dropped without sending a response, so that the client
6289/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6290impl std::ops::Drop for MsiResourceGetResponder {
6291    fn drop(&mut self) {
6292        self.control_handle.shutdown();
6293        // Safety: drops once, never accessed again
6294        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6295    }
6296}
6297
6298impl fidl::endpoints::Responder for MsiResourceGetResponder {
6299    type ControlHandle = MsiResourceControlHandle;
6300
6301    fn control_handle(&self) -> &MsiResourceControlHandle {
6302        &self.control_handle
6303    }
6304
6305    fn drop_without_shutdown(mut self) {
6306        // Safety: drops once, never accessed again due to mem::forget
6307        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6308        // Prevent Drop from running (which would shut down the channel)
6309        std::mem::forget(self);
6310    }
6311}
6312
6313impl MsiResourceGetResponder {
6314    /// Sends a response to the FIDL transaction.
6315    ///
6316    /// Sets the channel to shutdown if an error occurs.
6317    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6318        let _result = self.send_raw(resource);
6319        if _result.is_err() {
6320            self.control_handle.shutdown();
6321        }
6322        self.drop_without_shutdown();
6323        _result
6324    }
6325
6326    /// Similar to "send" but does not shutdown the channel if an error occurs.
6327    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6328        let _result = self.send_raw(resource);
6329        self.drop_without_shutdown();
6330        _result
6331    }
6332
6333    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6334        self.control_handle.inner.send::<MsiResourceGetResponse>(
6335            (resource,),
6336            self.tx_id,
6337            0x360a97e47e8c4f1f,
6338            fidl::encoding::DynamicFlags::empty(),
6339        )
6340    }
6341}
6342
6343#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6344pub struct PowerResourceMarker;
6345
6346impl fidl::endpoints::ProtocolMarker for PowerResourceMarker {
6347    type Proxy = PowerResourceProxy;
6348    type RequestStream = PowerResourceRequestStream;
6349    #[cfg(target_os = "fuchsia")]
6350    type SynchronousProxy = PowerResourceSynchronousProxy;
6351
6352    const DEBUG_NAME: &'static str = "fuchsia.kernel.PowerResource";
6353}
6354impl fidl::endpoints::DiscoverableProtocolMarker for PowerResourceMarker {}
6355
6356pub trait PowerResourceProxyInterface: Send + Sync {
6357    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6358    fn r#get(&self) -> Self::GetResponseFut;
6359}
6360#[derive(Debug)]
6361#[cfg(target_os = "fuchsia")]
6362pub struct PowerResourceSynchronousProxy {
6363    client: fidl::client::sync::Client,
6364}
6365
6366#[cfg(target_os = "fuchsia")]
6367impl fidl::endpoints::SynchronousProxy for PowerResourceSynchronousProxy {
6368    type Proxy = PowerResourceProxy;
6369    type Protocol = PowerResourceMarker;
6370
6371    fn from_channel(inner: fidl::Channel) -> Self {
6372        Self::new(inner)
6373    }
6374
6375    fn into_channel(self) -> fidl::Channel {
6376        self.client.into_channel()
6377    }
6378
6379    fn as_channel(&self) -> &fidl::Channel {
6380        self.client.as_channel()
6381    }
6382}
6383
6384#[cfg(target_os = "fuchsia")]
6385impl PowerResourceSynchronousProxy {
6386    pub fn new(channel: fidl::Channel) -> Self {
6387        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6388        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6389    }
6390
6391    pub fn into_channel(self) -> fidl::Channel {
6392        self.client.into_channel()
6393    }
6394
6395    /// Waits until an event arrives and returns it. It is safe for other
6396    /// threads to make concurrent requests while waiting for an event.
6397    pub fn wait_for_event(
6398        &self,
6399        deadline: zx::MonotonicInstant,
6400    ) -> Result<PowerResourceEvent, fidl::Error> {
6401        PowerResourceEvent::decode(self.client.wait_for_event(deadline)?)
6402    }
6403
6404    /// Get a power resource handle.
6405    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6406        let _response =
6407            self.client.send_query::<fidl::encoding::EmptyPayload, PowerResourceGetResponse>(
6408                (),
6409                0x2b8df8ca24d1e866,
6410                fidl::encoding::DynamicFlags::empty(),
6411                ___deadline,
6412            )?;
6413        Ok(_response.resource)
6414    }
6415}
6416
6417#[derive(Debug, Clone)]
6418pub struct PowerResourceProxy {
6419    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6420}
6421
6422impl fidl::endpoints::Proxy for PowerResourceProxy {
6423    type Protocol = PowerResourceMarker;
6424
6425    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6426        Self::new(inner)
6427    }
6428
6429    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6430        self.client.into_channel().map_err(|client| Self { client })
6431    }
6432
6433    fn as_channel(&self) -> &::fidl::AsyncChannel {
6434        self.client.as_channel()
6435    }
6436}
6437
6438impl PowerResourceProxy {
6439    /// Create a new Proxy for fuchsia.kernel/PowerResource.
6440    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6441        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6442        Self { client: fidl::client::Client::new(channel, protocol_name) }
6443    }
6444
6445    /// Get a Stream of events from the remote end of the protocol.
6446    ///
6447    /// # Panics
6448    ///
6449    /// Panics if the event stream was already taken.
6450    pub fn take_event_stream(&self) -> PowerResourceEventStream {
6451        PowerResourceEventStream { event_receiver: self.client.take_event_receiver() }
6452    }
6453
6454    /// Get a power resource handle.
6455    pub fn r#get(
6456        &self,
6457    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6458    {
6459        PowerResourceProxyInterface::r#get(self)
6460    }
6461}
6462
6463impl PowerResourceProxyInterface for PowerResourceProxy {
6464    type GetResponseFut = fidl::client::QueryResponseFut<
6465        fidl::Resource,
6466        fidl::encoding::DefaultFuchsiaResourceDialect,
6467    >;
6468    fn r#get(&self) -> Self::GetResponseFut {
6469        fn _decode(
6470            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6471        ) -> Result<fidl::Resource, fidl::Error> {
6472            let _response = fidl::client::decode_transaction_body::<
6473                PowerResourceGetResponse,
6474                fidl::encoding::DefaultFuchsiaResourceDialect,
6475                0x2b8df8ca24d1e866,
6476            >(_buf?)?;
6477            Ok(_response.resource)
6478        }
6479        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6480            (),
6481            0x2b8df8ca24d1e866,
6482            fidl::encoding::DynamicFlags::empty(),
6483            _decode,
6484        )
6485    }
6486}
6487
6488pub struct PowerResourceEventStream {
6489    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6490}
6491
6492impl std::marker::Unpin for PowerResourceEventStream {}
6493
6494impl futures::stream::FusedStream for PowerResourceEventStream {
6495    fn is_terminated(&self) -> bool {
6496        self.event_receiver.is_terminated()
6497    }
6498}
6499
6500impl futures::Stream for PowerResourceEventStream {
6501    type Item = Result<PowerResourceEvent, fidl::Error>;
6502
6503    fn poll_next(
6504        mut self: std::pin::Pin<&mut Self>,
6505        cx: &mut std::task::Context<'_>,
6506    ) -> std::task::Poll<Option<Self::Item>> {
6507        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6508            &mut self.event_receiver,
6509            cx
6510        )?) {
6511            Some(buf) => std::task::Poll::Ready(Some(PowerResourceEvent::decode(buf))),
6512            None => std::task::Poll::Ready(None),
6513        }
6514    }
6515}
6516
6517#[derive(Debug)]
6518pub enum PowerResourceEvent {}
6519
6520impl PowerResourceEvent {
6521    /// Decodes a message buffer as a [`PowerResourceEvent`].
6522    fn decode(
6523        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6524    ) -> Result<PowerResourceEvent, fidl::Error> {
6525        let (bytes, _handles) = buf.split_mut();
6526        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6527        debug_assert_eq!(tx_header.tx_id, 0);
6528        match tx_header.ordinal {
6529            _ => Err(fidl::Error::UnknownOrdinal {
6530                ordinal: tx_header.ordinal,
6531                protocol_name: <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6532            }),
6533        }
6534    }
6535}
6536
6537/// A Stream of incoming requests for fuchsia.kernel/PowerResource.
6538pub struct PowerResourceRequestStream {
6539    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6540    is_terminated: bool,
6541}
6542
6543impl std::marker::Unpin for PowerResourceRequestStream {}
6544
6545impl futures::stream::FusedStream for PowerResourceRequestStream {
6546    fn is_terminated(&self) -> bool {
6547        self.is_terminated
6548    }
6549}
6550
6551impl fidl::endpoints::RequestStream for PowerResourceRequestStream {
6552    type Protocol = PowerResourceMarker;
6553    type ControlHandle = PowerResourceControlHandle;
6554
6555    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6556        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6557    }
6558
6559    fn control_handle(&self) -> Self::ControlHandle {
6560        PowerResourceControlHandle { inner: self.inner.clone() }
6561    }
6562
6563    fn into_inner(
6564        self,
6565    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6566    {
6567        (self.inner, self.is_terminated)
6568    }
6569
6570    fn from_inner(
6571        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6572        is_terminated: bool,
6573    ) -> Self {
6574        Self { inner, is_terminated }
6575    }
6576}
6577
6578impl futures::Stream for PowerResourceRequestStream {
6579    type Item = Result<PowerResourceRequest, fidl::Error>;
6580
6581    fn poll_next(
6582        mut self: std::pin::Pin<&mut Self>,
6583        cx: &mut std::task::Context<'_>,
6584    ) -> std::task::Poll<Option<Self::Item>> {
6585        let this = &mut *self;
6586        if this.inner.check_shutdown(cx) {
6587            this.is_terminated = true;
6588            return std::task::Poll::Ready(None);
6589        }
6590        if this.is_terminated {
6591            panic!("polled PowerResourceRequestStream after completion");
6592        }
6593        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6594            |bytes, handles| {
6595                match this.inner.channel().read_etc(cx, bytes, handles) {
6596                    std::task::Poll::Ready(Ok(())) => {}
6597                    std::task::Poll::Pending => return std::task::Poll::Pending,
6598                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6599                        this.is_terminated = true;
6600                        return std::task::Poll::Ready(None);
6601                    }
6602                    std::task::Poll::Ready(Err(e)) => {
6603                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6604                            e.into(),
6605                        ))))
6606                    }
6607                }
6608
6609                // A message has been received from the channel
6610                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6611
6612                std::task::Poll::Ready(Some(match header.ordinal {
6613                    0x2b8df8ca24d1e866 => {
6614                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6615                        let mut req = fidl::new_empty!(
6616                            fidl::encoding::EmptyPayload,
6617                            fidl::encoding::DefaultFuchsiaResourceDialect
6618                        );
6619                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6620                        let control_handle =
6621                            PowerResourceControlHandle { inner: this.inner.clone() };
6622                        Ok(PowerResourceRequest::Get {
6623                            responder: PowerResourceGetResponder {
6624                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6625                                tx_id: header.tx_id,
6626                            },
6627                        })
6628                    }
6629                    _ => Err(fidl::Error::UnknownOrdinal {
6630                        ordinal: header.ordinal,
6631                        protocol_name:
6632                            <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6633                    }),
6634                }))
6635            },
6636        )
6637    }
6638}
6639
6640/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6641/// `ZX_RSRC_SYSTEM_POWER_BASE`.
6642#[derive(Debug)]
6643pub enum PowerResourceRequest {
6644    /// Get a power resource handle.
6645    Get { responder: PowerResourceGetResponder },
6646}
6647
6648impl PowerResourceRequest {
6649    #[allow(irrefutable_let_patterns)]
6650    pub fn into_get(self) -> Option<(PowerResourceGetResponder)> {
6651        if let PowerResourceRequest::Get { responder } = self {
6652            Some((responder))
6653        } else {
6654            None
6655        }
6656    }
6657
6658    /// Name of the method defined in FIDL
6659    pub fn method_name(&self) -> &'static str {
6660        match *self {
6661            PowerResourceRequest::Get { .. } => "get",
6662        }
6663    }
6664}
6665
6666#[derive(Debug, Clone)]
6667pub struct PowerResourceControlHandle {
6668    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6669}
6670
6671impl fidl::endpoints::ControlHandle for PowerResourceControlHandle {
6672    fn shutdown(&self) {
6673        self.inner.shutdown()
6674    }
6675    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6676        self.inner.shutdown_with_epitaph(status)
6677    }
6678
6679    fn is_closed(&self) -> bool {
6680        self.inner.channel().is_closed()
6681    }
6682    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6683        self.inner.channel().on_closed()
6684    }
6685
6686    #[cfg(target_os = "fuchsia")]
6687    fn signal_peer(
6688        &self,
6689        clear_mask: zx::Signals,
6690        set_mask: zx::Signals,
6691    ) -> Result<(), zx_status::Status> {
6692        use fidl::Peered;
6693        self.inner.channel().signal_peer(clear_mask, set_mask)
6694    }
6695}
6696
6697impl PowerResourceControlHandle {}
6698
6699#[must_use = "FIDL methods require a response to be sent"]
6700#[derive(Debug)]
6701pub struct PowerResourceGetResponder {
6702    control_handle: std::mem::ManuallyDrop<PowerResourceControlHandle>,
6703    tx_id: u32,
6704}
6705
6706/// Set the the channel to be shutdown (see [`PowerResourceControlHandle::shutdown`])
6707/// if the responder is dropped without sending a response, so that the client
6708/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6709impl std::ops::Drop for PowerResourceGetResponder {
6710    fn drop(&mut self) {
6711        self.control_handle.shutdown();
6712        // Safety: drops once, never accessed again
6713        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6714    }
6715}
6716
6717impl fidl::endpoints::Responder for PowerResourceGetResponder {
6718    type ControlHandle = PowerResourceControlHandle;
6719
6720    fn control_handle(&self) -> &PowerResourceControlHandle {
6721        &self.control_handle
6722    }
6723
6724    fn drop_without_shutdown(mut self) {
6725        // Safety: drops once, never accessed again due to mem::forget
6726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6727        // Prevent Drop from running (which would shut down the channel)
6728        std::mem::forget(self);
6729    }
6730}
6731
6732impl PowerResourceGetResponder {
6733    /// Sends a response to the FIDL transaction.
6734    ///
6735    /// Sets the channel to shutdown if an error occurs.
6736    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6737        let _result = self.send_raw(resource);
6738        if _result.is_err() {
6739            self.control_handle.shutdown();
6740        }
6741        self.drop_without_shutdown();
6742        _result
6743    }
6744
6745    /// Similar to "send" but does not shutdown the channel if an error occurs.
6746    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6747        let _result = self.send_raw(resource);
6748        self.drop_without_shutdown();
6749        _result
6750    }
6751
6752    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6753        self.control_handle.inner.send::<PowerResourceGetResponse>(
6754            (resource,),
6755            self.tx_id,
6756            0x2b8df8ca24d1e866,
6757            fidl::encoding::DynamicFlags::empty(),
6758        )
6759    }
6760}
6761
6762#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6763pub struct ProfileResourceMarker;
6764
6765impl fidl::endpoints::ProtocolMarker for ProfileResourceMarker {
6766    type Proxy = ProfileResourceProxy;
6767    type RequestStream = ProfileResourceRequestStream;
6768    #[cfg(target_os = "fuchsia")]
6769    type SynchronousProxy = ProfileResourceSynchronousProxy;
6770
6771    const DEBUG_NAME: &'static str = "fuchsia.kernel.ProfileResource";
6772}
6773impl fidl::endpoints::DiscoverableProtocolMarker for ProfileResourceMarker {}
6774
6775pub trait ProfileResourceProxyInterface: Send + Sync {
6776    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6777    fn r#get(&self) -> Self::GetResponseFut;
6778}
6779#[derive(Debug)]
6780#[cfg(target_os = "fuchsia")]
6781pub struct ProfileResourceSynchronousProxy {
6782    client: fidl::client::sync::Client,
6783}
6784
6785#[cfg(target_os = "fuchsia")]
6786impl fidl::endpoints::SynchronousProxy for ProfileResourceSynchronousProxy {
6787    type Proxy = ProfileResourceProxy;
6788    type Protocol = ProfileResourceMarker;
6789
6790    fn from_channel(inner: fidl::Channel) -> Self {
6791        Self::new(inner)
6792    }
6793
6794    fn into_channel(self) -> fidl::Channel {
6795        self.client.into_channel()
6796    }
6797
6798    fn as_channel(&self) -> &fidl::Channel {
6799        self.client.as_channel()
6800    }
6801}
6802
6803#[cfg(target_os = "fuchsia")]
6804impl ProfileResourceSynchronousProxy {
6805    pub fn new(channel: fidl::Channel) -> Self {
6806        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6807        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6808    }
6809
6810    pub fn into_channel(self) -> fidl::Channel {
6811        self.client.into_channel()
6812    }
6813
6814    /// Waits until an event arrives and returns it. It is safe for other
6815    /// threads to make concurrent requests while waiting for an event.
6816    pub fn wait_for_event(
6817        &self,
6818        deadline: zx::MonotonicInstant,
6819    ) -> Result<ProfileResourceEvent, fidl::Error> {
6820        ProfileResourceEvent::decode(self.client.wait_for_event(deadline)?)
6821    }
6822
6823    /// Get a profile resource handle.
6824    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6825        let _response =
6826            self.client.send_query::<fidl::encoding::EmptyPayload, ProfileResourceGetResponse>(
6827                (),
6828                0x3003a0c14de1fa86,
6829                fidl::encoding::DynamicFlags::empty(),
6830                ___deadline,
6831            )?;
6832        Ok(_response.resource)
6833    }
6834}
6835
6836#[derive(Debug, Clone)]
6837pub struct ProfileResourceProxy {
6838    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6839}
6840
6841impl fidl::endpoints::Proxy for ProfileResourceProxy {
6842    type Protocol = ProfileResourceMarker;
6843
6844    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6845        Self::new(inner)
6846    }
6847
6848    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6849        self.client.into_channel().map_err(|client| Self { client })
6850    }
6851
6852    fn as_channel(&self) -> &::fidl::AsyncChannel {
6853        self.client.as_channel()
6854    }
6855}
6856
6857impl ProfileResourceProxy {
6858    /// Create a new Proxy for fuchsia.kernel/ProfileResource.
6859    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6860        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6861        Self { client: fidl::client::Client::new(channel, protocol_name) }
6862    }
6863
6864    /// Get a Stream of events from the remote end of the protocol.
6865    ///
6866    /// # Panics
6867    ///
6868    /// Panics if the event stream was already taken.
6869    pub fn take_event_stream(&self) -> ProfileResourceEventStream {
6870        ProfileResourceEventStream { event_receiver: self.client.take_event_receiver() }
6871    }
6872
6873    /// Get a profile resource handle.
6874    pub fn r#get(
6875        &self,
6876    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6877    {
6878        ProfileResourceProxyInterface::r#get(self)
6879    }
6880}
6881
6882impl ProfileResourceProxyInterface for ProfileResourceProxy {
6883    type GetResponseFut = fidl::client::QueryResponseFut<
6884        fidl::Resource,
6885        fidl::encoding::DefaultFuchsiaResourceDialect,
6886    >;
6887    fn r#get(&self) -> Self::GetResponseFut {
6888        fn _decode(
6889            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6890        ) -> Result<fidl::Resource, fidl::Error> {
6891            let _response = fidl::client::decode_transaction_body::<
6892                ProfileResourceGetResponse,
6893                fidl::encoding::DefaultFuchsiaResourceDialect,
6894                0x3003a0c14de1fa86,
6895            >(_buf?)?;
6896            Ok(_response.resource)
6897        }
6898        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6899            (),
6900            0x3003a0c14de1fa86,
6901            fidl::encoding::DynamicFlags::empty(),
6902            _decode,
6903        )
6904    }
6905}
6906
6907pub struct ProfileResourceEventStream {
6908    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6909}
6910
6911impl std::marker::Unpin for ProfileResourceEventStream {}
6912
6913impl futures::stream::FusedStream for ProfileResourceEventStream {
6914    fn is_terminated(&self) -> bool {
6915        self.event_receiver.is_terminated()
6916    }
6917}
6918
6919impl futures::Stream for ProfileResourceEventStream {
6920    type Item = Result<ProfileResourceEvent, fidl::Error>;
6921
6922    fn poll_next(
6923        mut self: std::pin::Pin<&mut Self>,
6924        cx: &mut std::task::Context<'_>,
6925    ) -> std::task::Poll<Option<Self::Item>> {
6926        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6927            &mut self.event_receiver,
6928            cx
6929        )?) {
6930            Some(buf) => std::task::Poll::Ready(Some(ProfileResourceEvent::decode(buf))),
6931            None => std::task::Poll::Ready(None),
6932        }
6933    }
6934}
6935
6936#[derive(Debug)]
6937pub enum ProfileResourceEvent {}
6938
6939impl ProfileResourceEvent {
6940    /// Decodes a message buffer as a [`ProfileResourceEvent`].
6941    fn decode(
6942        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6943    ) -> Result<ProfileResourceEvent, fidl::Error> {
6944        let (bytes, _handles) = buf.split_mut();
6945        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6946        debug_assert_eq!(tx_header.tx_id, 0);
6947        match tx_header.ordinal {
6948            _ => Err(fidl::Error::UnknownOrdinal {
6949                ordinal: tx_header.ordinal,
6950                protocol_name:
6951                    <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6952            }),
6953        }
6954    }
6955}
6956
6957/// A Stream of incoming requests for fuchsia.kernel/ProfileResource.
6958pub struct ProfileResourceRequestStream {
6959    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6960    is_terminated: bool,
6961}
6962
6963impl std::marker::Unpin for ProfileResourceRequestStream {}
6964
6965impl futures::stream::FusedStream for ProfileResourceRequestStream {
6966    fn is_terminated(&self) -> bool {
6967        self.is_terminated
6968    }
6969}
6970
6971impl fidl::endpoints::RequestStream for ProfileResourceRequestStream {
6972    type Protocol = ProfileResourceMarker;
6973    type ControlHandle = ProfileResourceControlHandle;
6974
6975    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6976        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6977    }
6978
6979    fn control_handle(&self) -> Self::ControlHandle {
6980        ProfileResourceControlHandle { inner: self.inner.clone() }
6981    }
6982
6983    fn into_inner(
6984        self,
6985    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6986    {
6987        (self.inner, self.is_terminated)
6988    }
6989
6990    fn from_inner(
6991        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6992        is_terminated: bool,
6993    ) -> Self {
6994        Self { inner, is_terminated }
6995    }
6996}
6997
6998impl futures::Stream for ProfileResourceRequestStream {
6999    type Item = Result<ProfileResourceRequest, fidl::Error>;
7000
7001    fn poll_next(
7002        mut self: std::pin::Pin<&mut Self>,
7003        cx: &mut std::task::Context<'_>,
7004    ) -> std::task::Poll<Option<Self::Item>> {
7005        let this = &mut *self;
7006        if this.inner.check_shutdown(cx) {
7007            this.is_terminated = true;
7008            return std::task::Poll::Ready(None);
7009        }
7010        if this.is_terminated {
7011            panic!("polled ProfileResourceRequestStream after completion");
7012        }
7013        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7014            |bytes, handles| {
7015                match this.inner.channel().read_etc(cx, bytes, handles) {
7016                    std::task::Poll::Ready(Ok(())) => {}
7017                    std::task::Poll::Pending => return std::task::Poll::Pending,
7018                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7019                        this.is_terminated = true;
7020                        return std::task::Poll::Ready(None);
7021                    }
7022                    std::task::Poll::Ready(Err(e)) => {
7023                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7024                            e.into(),
7025                        ))))
7026                    }
7027                }
7028
7029                // A message has been received from the channel
7030                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7031
7032                std::task::Poll::Ready(Some(match header.ordinal {
7033                    0x3003a0c14de1fa86 => {
7034                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7035                        let mut req = fidl::new_empty!(
7036                            fidl::encoding::EmptyPayload,
7037                            fidl::encoding::DefaultFuchsiaResourceDialect
7038                        );
7039                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7040                        let control_handle =
7041                            ProfileResourceControlHandle { inner: this.inner.clone() };
7042                        Ok(ProfileResourceRequest::Get {
7043                            responder: ProfileResourceGetResponder {
7044                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7045                                tx_id: header.tx_id,
7046                            },
7047                        })
7048                    }
7049                    _ => Err(fidl::Error::UnknownOrdinal {
7050                        ordinal: header.ordinal,
7051                        protocol_name:
7052                            <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7053                    }),
7054                }))
7055            },
7056        )
7057    }
7058}
7059
7060/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7061/// `ZX_RSRC_SYSTEM_PROFILE_BASE`.
7062#[derive(Debug)]
7063pub enum ProfileResourceRequest {
7064    /// Get a profile resource handle.
7065    Get { responder: ProfileResourceGetResponder },
7066}
7067
7068impl ProfileResourceRequest {
7069    #[allow(irrefutable_let_patterns)]
7070    pub fn into_get(self) -> Option<(ProfileResourceGetResponder)> {
7071        if let ProfileResourceRequest::Get { responder } = self {
7072            Some((responder))
7073        } else {
7074            None
7075        }
7076    }
7077
7078    /// Name of the method defined in FIDL
7079    pub fn method_name(&self) -> &'static str {
7080        match *self {
7081            ProfileResourceRequest::Get { .. } => "get",
7082        }
7083    }
7084}
7085
7086#[derive(Debug, Clone)]
7087pub struct ProfileResourceControlHandle {
7088    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7089}
7090
7091impl fidl::endpoints::ControlHandle for ProfileResourceControlHandle {
7092    fn shutdown(&self) {
7093        self.inner.shutdown()
7094    }
7095    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7096        self.inner.shutdown_with_epitaph(status)
7097    }
7098
7099    fn is_closed(&self) -> bool {
7100        self.inner.channel().is_closed()
7101    }
7102    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7103        self.inner.channel().on_closed()
7104    }
7105
7106    #[cfg(target_os = "fuchsia")]
7107    fn signal_peer(
7108        &self,
7109        clear_mask: zx::Signals,
7110        set_mask: zx::Signals,
7111    ) -> Result<(), zx_status::Status> {
7112        use fidl::Peered;
7113        self.inner.channel().signal_peer(clear_mask, set_mask)
7114    }
7115}
7116
7117impl ProfileResourceControlHandle {}
7118
7119#[must_use = "FIDL methods require a response to be sent"]
7120#[derive(Debug)]
7121pub struct ProfileResourceGetResponder {
7122    control_handle: std::mem::ManuallyDrop<ProfileResourceControlHandle>,
7123    tx_id: u32,
7124}
7125
7126/// Set the the channel to be shutdown (see [`ProfileResourceControlHandle::shutdown`])
7127/// if the responder is dropped without sending a response, so that the client
7128/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7129impl std::ops::Drop for ProfileResourceGetResponder {
7130    fn drop(&mut self) {
7131        self.control_handle.shutdown();
7132        // Safety: drops once, never accessed again
7133        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7134    }
7135}
7136
7137impl fidl::endpoints::Responder for ProfileResourceGetResponder {
7138    type ControlHandle = ProfileResourceControlHandle;
7139
7140    fn control_handle(&self) -> &ProfileResourceControlHandle {
7141        &self.control_handle
7142    }
7143
7144    fn drop_without_shutdown(mut self) {
7145        // Safety: drops once, never accessed again due to mem::forget
7146        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7147        // Prevent Drop from running (which would shut down the channel)
7148        std::mem::forget(self);
7149    }
7150}
7151
7152impl ProfileResourceGetResponder {
7153    /// Sends a response to the FIDL transaction.
7154    ///
7155    /// Sets the channel to shutdown if an error occurs.
7156    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7157        let _result = self.send_raw(resource);
7158        if _result.is_err() {
7159            self.control_handle.shutdown();
7160        }
7161        self.drop_without_shutdown();
7162        _result
7163    }
7164
7165    /// Similar to "send" but does not shutdown the channel if an error occurs.
7166    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7167        let _result = self.send_raw(resource);
7168        self.drop_without_shutdown();
7169        _result
7170    }
7171
7172    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7173        self.control_handle.inner.send::<ProfileResourceGetResponse>(
7174            (resource,),
7175            self.tx_id,
7176            0x3003a0c14de1fa86,
7177            fidl::encoding::DynamicFlags::empty(),
7178        )
7179    }
7180}
7181
7182#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7183pub struct RootJobMarker;
7184
7185impl fidl::endpoints::ProtocolMarker for RootJobMarker {
7186    type Proxy = RootJobProxy;
7187    type RequestStream = RootJobRequestStream;
7188    #[cfg(target_os = "fuchsia")]
7189    type SynchronousProxy = RootJobSynchronousProxy;
7190
7191    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJob";
7192}
7193impl fidl::endpoints::DiscoverableProtocolMarker for RootJobMarker {}
7194
7195pub trait RootJobProxyInterface: Send + Sync {
7196    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7197    fn r#get(&self) -> Self::GetResponseFut;
7198}
7199#[derive(Debug)]
7200#[cfg(target_os = "fuchsia")]
7201pub struct RootJobSynchronousProxy {
7202    client: fidl::client::sync::Client,
7203}
7204
7205#[cfg(target_os = "fuchsia")]
7206impl fidl::endpoints::SynchronousProxy for RootJobSynchronousProxy {
7207    type Proxy = RootJobProxy;
7208    type Protocol = RootJobMarker;
7209
7210    fn from_channel(inner: fidl::Channel) -> Self {
7211        Self::new(inner)
7212    }
7213
7214    fn into_channel(self) -> fidl::Channel {
7215        self.client.into_channel()
7216    }
7217
7218    fn as_channel(&self) -> &fidl::Channel {
7219        self.client.as_channel()
7220    }
7221}
7222
7223#[cfg(target_os = "fuchsia")]
7224impl RootJobSynchronousProxy {
7225    pub fn new(channel: fidl::Channel) -> Self {
7226        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7227        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7228    }
7229
7230    pub fn into_channel(self) -> fidl::Channel {
7231        self.client.into_channel()
7232    }
7233
7234    /// Waits until an event arrives and returns it. It is safe for other
7235    /// threads to make concurrent requests while waiting for an event.
7236    pub fn wait_for_event(
7237        &self,
7238        deadline: zx::MonotonicInstant,
7239    ) -> Result<RootJobEvent, fidl::Error> {
7240        RootJobEvent::decode(self.client.wait_for_event(deadline)?)
7241    }
7242
7243    /// Get the root `job`.
7244    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7245        let _response =
7246            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
7247                (),
7248                0x73acb63f93d53eac,
7249                fidl::encoding::DynamicFlags::empty(),
7250                ___deadline,
7251            )?;
7252        Ok(_response.job)
7253    }
7254}
7255
7256#[derive(Debug, Clone)]
7257pub struct RootJobProxy {
7258    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7259}
7260
7261impl fidl::endpoints::Proxy for RootJobProxy {
7262    type Protocol = RootJobMarker;
7263
7264    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7265        Self::new(inner)
7266    }
7267
7268    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7269        self.client.into_channel().map_err(|client| Self { client })
7270    }
7271
7272    fn as_channel(&self) -> &::fidl::AsyncChannel {
7273        self.client.as_channel()
7274    }
7275}
7276
7277impl RootJobProxy {
7278    /// Create a new Proxy for fuchsia.kernel/RootJob.
7279    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7280        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7281        Self { client: fidl::client::Client::new(channel, protocol_name) }
7282    }
7283
7284    /// Get a Stream of events from the remote end of the protocol.
7285    ///
7286    /// # Panics
7287    ///
7288    /// Panics if the event stream was already taken.
7289    pub fn take_event_stream(&self) -> RootJobEventStream {
7290        RootJobEventStream { event_receiver: self.client.take_event_receiver() }
7291    }
7292
7293    /// Get the root `job`.
7294    pub fn r#get(
7295        &self,
7296    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7297    {
7298        RootJobProxyInterface::r#get(self)
7299    }
7300}
7301
7302impl RootJobProxyInterface for RootJobProxy {
7303    type GetResponseFut =
7304        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7305    fn r#get(&self) -> Self::GetResponseFut {
7306        fn _decode(
7307            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7308        ) -> Result<fidl::Job, fidl::Error> {
7309            let _response = fidl::client::decode_transaction_body::<
7310                RootJobGetResponse,
7311                fidl::encoding::DefaultFuchsiaResourceDialect,
7312                0x73acb63f93d53eac,
7313            >(_buf?)?;
7314            Ok(_response.job)
7315        }
7316        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7317            (),
7318            0x73acb63f93d53eac,
7319            fidl::encoding::DynamicFlags::empty(),
7320            _decode,
7321        )
7322    }
7323}
7324
7325pub struct RootJobEventStream {
7326    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7327}
7328
7329impl std::marker::Unpin for RootJobEventStream {}
7330
7331impl futures::stream::FusedStream for RootJobEventStream {
7332    fn is_terminated(&self) -> bool {
7333        self.event_receiver.is_terminated()
7334    }
7335}
7336
7337impl futures::Stream for RootJobEventStream {
7338    type Item = Result<RootJobEvent, fidl::Error>;
7339
7340    fn poll_next(
7341        mut self: std::pin::Pin<&mut Self>,
7342        cx: &mut std::task::Context<'_>,
7343    ) -> std::task::Poll<Option<Self::Item>> {
7344        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7345            &mut self.event_receiver,
7346            cx
7347        )?) {
7348            Some(buf) => std::task::Poll::Ready(Some(RootJobEvent::decode(buf))),
7349            None => std::task::Poll::Ready(None),
7350        }
7351    }
7352}
7353
7354#[derive(Debug)]
7355pub enum RootJobEvent {}
7356
7357impl RootJobEvent {
7358    /// Decodes a message buffer as a [`RootJobEvent`].
7359    fn decode(
7360        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7361    ) -> Result<RootJobEvent, fidl::Error> {
7362        let (bytes, _handles) = buf.split_mut();
7363        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7364        debug_assert_eq!(tx_header.tx_id, 0);
7365        match tx_header.ordinal {
7366            _ => Err(fidl::Error::UnknownOrdinal {
7367                ordinal: tx_header.ordinal,
7368                protocol_name: <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7369            }),
7370        }
7371    }
7372}
7373
7374/// A Stream of incoming requests for fuchsia.kernel/RootJob.
7375pub struct RootJobRequestStream {
7376    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7377    is_terminated: bool,
7378}
7379
7380impl std::marker::Unpin for RootJobRequestStream {}
7381
7382impl futures::stream::FusedStream for RootJobRequestStream {
7383    fn is_terminated(&self) -> bool {
7384        self.is_terminated
7385    }
7386}
7387
7388impl fidl::endpoints::RequestStream for RootJobRequestStream {
7389    type Protocol = RootJobMarker;
7390    type ControlHandle = RootJobControlHandle;
7391
7392    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7393        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7394    }
7395
7396    fn control_handle(&self) -> Self::ControlHandle {
7397        RootJobControlHandle { inner: self.inner.clone() }
7398    }
7399
7400    fn into_inner(
7401        self,
7402    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7403    {
7404        (self.inner, self.is_terminated)
7405    }
7406
7407    fn from_inner(
7408        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7409        is_terminated: bool,
7410    ) -> Self {
7411        Self { inner, is_terminated }
7412    }
7413}
7414
7415impl futures::Stream for RootJobRequestStream {
7416    type Item = Result<RootJobRequest, fidl::Error>;
7417
7418    fn poll_next(
7419        mut self: std::pin::Pin<&mut Self>,
7420        cx: &mut std::task::Context<'_>,
7421    ) -> std::task::Poll<Option<Self::Item>> {
7422        let this = &mut *self;
7423        if this.inner.check_shutdown(cx) {
7424            this.is_terminated = true;
7425            return std::task::Poll::Ready(None);
7426        }
7427        if this.is_terminated {
7428            panic!("polled RootJobRequestStream after completion");
7429        }
7430        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7431            |bytes, handles| {
7432                match this.inner.channel().read_etc(cx, bytes, handles) {
7433                    std::task::Poll::Ready(Ok(())) => {}
7434                    std::task::Poll::Pending => return std::task::Poll::Pending,
7435                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7436                        this.is_terminated = true;
7437                        return std::task::Poll::Ready(None);
7438                    }
7439                    std::task::Poll::Ready(Err(e)) => {
7440                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7441                            e.into(),
7442                        ))))
7443                    }
7444                }
7445
7446                // A message has been received from the channel
7447                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7448
7449                std::task::Poll::Ready(Some(match header.ordinal {
7450                    0x73acb63f93d53eac => {
7451                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7452                        let mut req = fidl::new_empty!(
7453                            fidl::encoding::EmptyPayload,
7454                            fidl::encoding::DefaultFuchsiaResourceDialect
7455                        );
7456                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7457                        let control_handle = RootJobControlHandle { inner: this.inner.clone() };
7458                        Ok(RootJobRequest::Get {
7459                            responder: RootJobGetResponder {
7460                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7461                                tx_id: header.tx_id,
7462                            },
7463                        })
7464                    }
7465                    _ => Err(fidl::Error::UnknownOrdinal {
7466                        ordinal: header.ordinal,
7467                        protocol_name:
7468                            <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7469                    }),
7470                }))
7471            },
7472        )
7473    }
7474}
7475
7476/// Protocol for providing the root job.
7477///
7478/// TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.
7479#[derive(Debug)]
7480pub enum RootJobRequest {
7481    /// Get the root `job`.
7482    Get { responder: RootJobGetResponder },
7483}
7484
7485impl RootJobRequest {
7486    #[allow(irrefutable_let_patterns)]
7487    pub fn into_get(self) -> Option<(RootJobGetResponder)> {
7488        if let RootJobRequest::Get { responder } = self {
7489            Some((responder))
7490        } else {
7491            None
7492        }
7493    }
7494
7495    /// Name of the method defined in FIDL
7496    pub fn method_name(&self) -> &'static str {
7497        match *self {
7498            RootJobRequest::Get { .. } => "get",
7499        }
7500    }
7501}
7502
7503#[derive(Debug, Clone)]
7504pub struct RootJobControlHandle {
7505    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7506}
7507
7508impl fidl::endpoints::ControlHandle for RootJobControlHandle {
7509    fn shutdown(&self) {
7510        self.inner.shutdown()
7511    }
7512    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7513        self.inner.shutdown_with_epitaph(status)
7514    }
7515
7516    fn is_closed(&self) -> bool {
7517        self.inner.channel().is_closed()
7518    }
7519    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7520        self.inner.channel().on_closed()
7521    }
7522
7523    #[cfg(target_os = "fuchsia")]
7524    fn signal_peer(
7525        &self,
7526        clear_mask: zx::Signals,
7527        set_mask: zx::Signals,
7528    ) -> Result<(), zx_status::Status> {
7529        use fidl::Peered;
7530        self.inner.channel().signal_peer(clear_mask, set_mask)
7531    }
7532}
7533
7534impl RootJobControlHandle {}
7535
7536#[must_use = "FIDL methods require a response to be sent"]
7537#[derive(Debug)]
7538pub struct RootJobGetResponder {
7539    control_handle: std::mem::ManuallyDrop<RootJobControlHandle>,
7540    tx_id: u32,
7541}
7542
7543/// Set the the channel to be shutdown (see [`RootJobControlHandle::shutdown`])
7544/// if the responder is dropped without sending a response, so that the client
7545/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7546impl std::ops::Drop for RootJobGetResponder {
7547    fn drop(&mut self) {
7548        self.control_handle.shutdown();
7549        // Safety: drops once, never accessed again
7550        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7551    }
7552}
7553
7554impl fidl::endpoints::Responder for RootJobGetResponder {
7555    type ControlHandle = RootJobControlHandle;
7556
7557    fn control_handle(&self) -> &RootJobControlHandle {
7558        &self.control_handle
7559    }
7560
7561    fn drop_without_shutdown(mut self) {
7562        // Safety: drops once, never accessed again due to mem::forget
7563        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7564        // Prevent Drop from running (which would shut down the channel)
7565        std::mem::forget(self);
7566    }
7567}
7568
7569impl RootJobGetResponder {
7570    /// Sends a response to the FIDL transaction.
7571    ///
7572    /// Sets the channel to shutdown if an error occurs.
7573    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7574        let _result = self.send_raw(job);
7575        if _result.is_err() {
7576            self.control_handle.shutdown();
7577        }
7578        self.drop_without_shutdown();
7579        _result
7580    }
7581
7582    /// Similar to "send" but does not shutdown the channel if an error occurs.
7583    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7584        let _result = self.send_raw(job);
7585        self.drop_without_shutdown();
7586        _result
7587    }
7588
7589    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7590        self.control_handle.inner.send::<RootJobGetResponse>(
7591            (job,),
7592            self.tx_id,
7593            0x73acb63f93d53eac,
7594            fidl::encoding::DynamicFlags::empty(),
7595        )
7596    }
7597}
7598
7599#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7600pub struct RootJobForInspectMarker;
7601
7602impl fidl::endpoints::ProtocolMarker for RootJobForInspectMarker {
7603    type Proxy = RootJobForInspectProxy;
7604    type RequestStream = RootJobForInspectRequestStream;
7605    #[cfg(target_os = "fuchsia")]
7606    type SynchronousProxy = RootJobForInspectSynchronousProxy;
7607
7608    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJobForInspect";
7609}
7610impl fidl::endpoints::DiscoverableProtocolMarker for RootJobForInspectMarker {}
7611
7612pub trait RootJobForInspectProxyInterface: Send + Sync {
7613    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7614    fn r#get(&self) -> Self::GetResponseFut;
7615}
7616#[derive(Debug)]
7617#[cfg(target_os = "fuchsia")]
7618pub struct RootJobForInspectSynchronousProxy {
7619    client: fidl::client::sync::Client,
7620}
7621
7622#[cfg(target_os = "fuchsia")]
7623impl fidl::endpoints::SynchronousProxy for RootJobForInspectSynchronousProxy {
7624    type Proxy = RootJobForInspectProxy;
7625    type Protocol = RootJobForInspectMarker;
7626
7627    fn from_channel(inner: fidl::Channel) -> Self {
7628        Self::new(inner)
7629    }
7630
7631    fn into_channel(self) -> fidl::Channel {
7632        self.client.into_channel()
7633    }
7634
7635    fn as_channel(&self) -> &fidl::Channel {
7636        self.client.as_channel()
7637    }
7638}
7639
7640#[cfg(target_os = "fuchsia")]
7641impl RootJobForInspectSynchronousProxy {
7642    pub fn new(channel: fidl::Channel) -> Self {
7643        let protocol_name =
7644            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7645        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7646    }
7647
7648    pub fn into_channel(self) -> fidl::Channel {
7649        self.client.into_channel()
7650    }
7651
7652    /// Waits until an event arrives and returns it. It is safe for other
7653    /// threads to make concurrent requests while waiting for an event.
7654    pub fn wait_for_event(
7655        &self,
7656        deadline: zx::MonotonicInstant,
7657    ) -> Result<RootJobForInspectEvent, fidl::Error> {
7658        RootJobForInspectEvent::decode(self.client.wait_for_event(deadline)?)
7659    }
7660
7661    /// Get the root `job`.
7662    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7663        let _response =
7664            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
7665                (),
7666                0x73acb63f93d53eac,
7667                fidl::encoding::DynamicFlags::empty(),
7668                ___deadline,
7669            )?;
7670        Ok(_response.job)
7671    }
7672}
7673
7674#[derive(Debug, Clone)]
7675pub struct RootJobForInspectProxy {
7676    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7677}
7678
7679impl fidl::endpoints::Proxy for RootJobForInspectProxy {
7680    type Protocol = RootJobForInspectMarker;
7681
7682    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7683        Self::new(inner)
7684    }
7685
7686    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7687        self.client.into_channel().map_err(|client| Self { client })
7688    }
7689
7690    fn as_channel(&self) -> &::fidl::AsyncChannel {
7691        self.client.as_channel()
7692    }
7693}
7694
7695impl RootJobForInspectProxy {
7696    /// Create a new Proxy for fuchsia.kernel/RootJobForInspect.
7697    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7698        let protocol_name =
7699            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7700        Self { client: fidl::client::Client::new(channel, protocol_name) }
7701    }
7702
7703    /// Get a Stream of events from the remote end of the protocol.
7704    ///
7705    /// # Panics
7706    ///
7707    /// Panics if the event stream was already taken.
7708    pub fn take_event_stream(&self) -> RootJobForInspectEventStream {
7709        RootJobForInspectEventStream { event_receiver: self.client.take_event_receiver() }
7710    }
7711
7712    /// Get the root `job`.
7713    pub fn r#get(
7714        &self,
7715    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7716    {
7717        RootJobForInspectProxyInterface::r#get(self)
7718    }
7719}
7720
7721impl RootJobForInspectProxyInterface for RootJobForInspectProxy {
7722    type GetResponseFut =
7723        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7724    fn r#get(&self) -> Self::GetResponseFut {
7725        fn _decode(
7726            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7727        ) -> Result<fidl::Job, fidl::Error> {
7728            let _response = fidl::client::decode_transaction_body::<
7729                RootJobGetResponse,
7730                fidl::encoding::DefaultFuchsiaResourceDialect,
7731                0x73acb63f93d53eac,
7732            >(_buf?)?;
7733            Ok(_response.job)
7734        }
7735        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7736            (),
7737            0x73acb63f93d53eac,
7738            fidl::encoding::DynamicFlags::empty(),
7739            _decode,
7740        )
7741    }
7742}
7743
7744pub struct RootJobForInspectEventStream {
7745    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7746}
7747
7748impl std::marker::Unpin for RootJobForInspectEventStream {}
7749
7750impl futures::stream::FusedStream for RootJobForInspectEventStream {
7751    fn is_terminated(&self) -> bool {
7752        self.event_receiver.is_terminated()
7753    }
7754}
7755
7756impl futures::Stream for RootJobForInspectEventStream {
7757    type Item = Result<RootJobForInspectEvent, fidl::Error>;
7758
7759    fn poll_next(
7760        mut self: std::pin::Pin<&mut Self>,
7761        cx: &mut std::task::Context<'_>,
7762    ) -> std::task::Poll<Option<Self::Item>> {
7763        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7764            &mut self.event_receiver,
7765            cx
7766        )?) {
7767            Some(buf) => std::task::Poll::Ready(Some(RootJobForInspectEvent::decode(buf))),
7768            None => std::task::Poll::Ready(None),
7769        }
7770    }
7771}
7772
7773#[derive(Debug)]
7774pub enum RootJobForInspectEvent {}
7775
7776impl RootJobForInspectEvent {
7777    /// Decodes a message buffer as a [`RootJobForInspectEvent`].
7778    fn decode(
7779        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7780    ) -> Result<RootJobForInspectEvent, fidl::Error> {
7781        let (bytes, _handles) = buf.split_mut();
7782        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7783        debug_assert_eq!(tx_header.tx_id, 0);
7784        match tx_header.ordinal {
7785            _ => Err(fidl::Error::UnknownOrdinal {
7786                ordinal: tx_header.ordinal,
7787                protocol_name:
7788                    <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7789            }),
7790        }
7791    }
7792}
7793
7794/// A Stream of incoming requests for fuchsia.kernel/RootJobForInspect.
7795pub struct RootJobForInspectRequestStream {
7796    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7797    is_terminated: bool,
7798}
7799
7800impl std::marker::Unpin for RootJobForInspectRequestStream {}
7801
7802impl futures::stream::FusedStream for RootJobForInspectRequestStream {
7803    fn is_terminated(&self) -> bool {
7804        self.is_terminated
7805    }
7806}
7807
7808impl fidl::endpoints::RequestStream for RootJobForInspectRequestStream {
7809    type Protocol = RootJobForInspectMarker;
7810    type ControlHandle = RootJobForInspectControlHandle;
7811
7812    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7813        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7814    }
7815
7816    fn control_handle(&self) -> Self::ControlHandle {
7817        RootJobForInspectControlHandle { inner: self.inner.clone() }
7818    }
7819
7820    fn into_inner(
7821        self,
7822    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7823    {
7824        (self.inner, self.is_terminated)
7825    }
7826
7827    fn from_inner(
7828        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7829        is_terminated: bool,
7830    ) -> Self {
7831        Self { inner, is_terminated }
7832    }
7833}
7834
7835impl futures::Stream for RootJobForInspectRequestStream {
7836    type Item = Result<RootJobForInspectRequest, fidl::Error>;
7837
7838    fn poll_next(
7839        mut self: std::pin::Pin<&mut Self>,
7840        cx: &mut std::task::Context<'_>,
7841    ) -> std::task::Poll<Option<Self::Item>> {
7842        let this = &mut *self;
7843        if this.inner.check_shutdown(cx) {
7844            this.is_terminated = true;
7845            return std::task::Poll::Ready(None);
7846        }
7847        if this.is_terminated {
7848            panic!("polled RootJobForInspectRequestStream after completion");
7849        }
7850        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7851            |bytes, handles| {
7852                match this.inner.channel().read_etc(cx, bytes, handles) {
7853                    std::task::Poll::Ready(Ok(())) => {}
7854                    std::task::Poll::Pending => return std::task::Poll::Pending,
7855                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7856                        this.is_terminated = true;
7857                        return std::task::Poll::Ready(None);
7858                    }
7859                    std::task::Poll::Ready(Err(e)) => {
7860                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7861                            e.into(),
7862                        ))))
7863                    }
7864                }
7865
7866                // A message has been received from the channel
7867                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7868
7869                std::task::Poll::Ready(Some(match header.ordinal {
7870                    0x73acb63f93d53eac => {
7871                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7872                        let mut req = fidl::new_empty!(
7873                            fidl::encoding::EmptyPayload,
7874                            fidl::encoding::DefaultFuchsiaResourceDialect
7875                        );
7876                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7877                        let control_handle =
7878                            RootJobForInspectControlHandle { inner: this.inner.clone() };
7879                        Ok(RootJobForInspectRequest::Get {
7880                            responder: RootJobForInspectGetResponder {
7881                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7882                                tx_id: header.tx_id,
7883                            },
7884                        })
7885                    }
7886                    _ => Err(fidl::Error::UnknownOrdinal {
7887                        ordinal: header.ordinal,
7888                        protocol_name:
7889                            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7890                    }),
7891                }))
7892            },
7893        )
7894    }
7895}
7896
7897/// Protocol for providing the root job with restricted rights, specifically:
7898/// INSPECT | ENUMERATE | DUPLICATE | TRANSFER
7899#[derive(Debug)]
7900pub enum RootJobForInspectRequest {
7901    /// Get the root `job`.
7902    Get { responder: RootJobForInspectGetResponder },
7903}
7904
7905impl RootJobForInspectRequest {
7906    #[allow(irrefutable_let_patterns)]
7907    pub fn into_get(self) -> Option<(RootJobForInspectGetResponder)> {
7908        if let RootJobForInspectRequest::Get { responder } = self {
7909            Some((responder))
7910        } else {
7911            None
7912        }
7913    }
7914
7915    /// Name of the method defined in FIDL
7916    pub fn method_name(&self) -> &'static str {
7917        match *self {
7918            RootJobForInspectRequest::Get { .. } => "get",
7919        }
7920    }
7921}
7922
7923#[derive(Debug, Clone)]
7924pub struct RootJobForInspectControlHandle {
7925    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7926}
7927
7928impl fidl::endpoints::ControlHandle for RootJobForInspectControlHandle {
7929    fn shutdown(&self) {
7930        self.inner.shutdown()
7931    }
7932    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7933        self.inner.shutdown_with_epitaph(status)
7934    }
7935
7936    fn is_closed(&self) -> bool {
7937        self.inner.channel().is_closed()
7938    }
7939    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7940        self.inner.channel().on_closed()
7941    }
7942
7943    #[cfg(target_os = "fuchsia")]
7944    fn signal_peer(
7945        &self,
7946        clear_mask: zx::Signals,
7947        set_mask: zx::Signals,
7948    ) -> Result<(), zx_status::Status> {
7949        use fidl::Peered;
7950        self.inner.channel().signal_peer(clear_mask, set_mask)
7951    }
7952}
7953
7954impl RootJobForInspectControlHandle {}
7955
7956#[must_use = "FIDL methods require a response to be sent"]
7957#[derive(Debug)]
7958pub struct RootJobForInspectGetResponder {
7959    control_handle: std::mem::ManuallyDrop<RootJobForInspectControlHandle>,
7960    tx_id: u32,
7961}
7962
7963/// Set the the channel to be shutdown (see [`RootJobForInspectControlHandle::shutdown`])
7964/// if the responder is dropped without sending a response, so that the client
7965/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7966impl std::ops::Drop for RootJobForInspectGetResponder {
7967    fn drop(&mut self) {
7968        self.control_handle.shutdown();
7969        // Safety: drops once, never accessed again
7970        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7971    }
7972}
7973
7974impl fidl::endpoints::Responder for RootJobForInspectGetResponder {
7975    type ControlHandle = RootJobForInspectControlHandle;
7976
7977    fn control_handle(&self) -> &RootJobForInspectControlHandle {
7978        &self.control_handle
7979    }
7980
7981    fn drop_without_shutdown(mut self) {
7982        // Safety: drops once, never accessed again due to mem::forget
7983        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7984        // Prevent Drop from running (which would shut down the channel)
7985        std::mem::forget(self);
7986    }
7987}
7988
7989impl RootJobForInspectGetResponder {
7990    /// Sends a response to the FIDL transaction.
7991    ///
7992    /// Sets the channel to shutdown if an error occurs.
7993    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7994        let _result = self.send_raw(job);
7995        if _result.is_err() {
7996            self.control_handle.shutdown();
7997        }
7998        self.drop_without_shutdown();
7999        _result
8000    }
8001
8002    /// Similar to "send" but does not shutdown the channel if an error occurs.
8003    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8004        let _result = self.send_raw(job);
8005        self.drop_without_shutdown();
8006        _result
8007    }
8008
8009    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8010        self.control_handle.inner.send::<RootJobGetResponse>(
8011            (job,),
8012            self.tx_id,
8013            0x73acb63f93d53eac,
8014            fidl::encoding::DynamicFlags::empty(),
8015        )
8016    }
8017}
8018
8019#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8020pub struct SmcResourceMarker;
8021
8022impl fidl::endpoints::ProtocolMarker for SmcResourceMarker {
8023    type Proxy = SmcResourceProxy;
8024    type RequestStream = SmcResourceRequestStream;
8025    #[cfg(target_os = "fuchsia")]
8026    type SynchronousProxy = SmcResourceSynchronousProxy;
8027
8028    const DEBUG_NAME: &'static str = "fuchsia.kernel.SmcResource";
8029}
8030impl fidl::endpoints::DiscoverableProtocolMarker for SmcResourceMarker {}
8031
8032pub trait SmcResourceProxyInterface: Send + Sync {
8033    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8034    fn r#get(&self) -> Self::GetResponseFut;
8035}
8036#[derive(Debug)]
8037#[cfg(target_os = "fuchsia")]
8038pub struct SmcResourceSynchronousProxy {
8039    client: fidl::client::sync::Client,
8040}
8041
8042#[cfg(target_os = "fuchsia")]
8043impl fidl::endpoints::SynchronousProxy for SmcResourceSynchronousProxy {
8044    type Proxy = SmcResourceProxy;
8045    type Protocol = SmcResourceMarker;
8046
8047    fn from_channel(inner: fidl::Channel) -> Self {
8048        Self::new(inner)
8049    }
8050
8051    fn into_channel(self) -> fidl::Channel {
8052        self.client.into_channel()
8053    }
8054
8055    fn as_channel(&self) -> &fidl::Channel {
8056        self.client.as_channel()
8057    }
8058}
8059
8060#[cfg(target_os = "fuchsia")]
8061impl SmcResourceSynchronousProxy {
8062    pub fn new(channel: fidl::Channel) -> Self {
8063        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8064        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8065    }
8066
8067    pub fn into_channel(self) -> fidl::Channel {
8068        self.client.into_channel()
8069    }
8070
8071    /// Waits until an event arrives and returns it. It is safe for other
8072    /// threads to make concurrent requests while waiting for an event.
8073    pub fn wait_for_event(
8074        &self,
8075        deadline: zx::MonotonicInstant,
8076    ) -> Result<SmcResourceEvent, fidl::Error> {
8077        SmcResourceEvent::decode(self.client.wait_for_event(deadline)?)
8078    }
8079
8080    /// Get an SMC resource handle.
8081    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8082        let _response =
8083            self.client.send_query::<fidl::encoding::EmptyPayload, SmcResourceGetResponse>(
8084                (),
8085                0x392cbd495b84ede7,
8086                fidl::encoding::DynamicFlags::empty(),
8087                ___deadline,
8088            )?;
8089        Ok(_response.resource)
8090    }
8091}
8092
8093#[derive(Debug, Clone)]
8094pub struct SmcResourceProxy {
8095    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8096}
8097
8098impl fidl::endpoints::Proxy for SmcResourceProxy {
8099    type Protocol = SmcResourceMarker;
8100
8101    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8102        Self::new(inner)
8103    }
8104
8105    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8106        self.client.into_channel().map_err(|client| Self { client })
8107    }
8108
8109    fn as_channel(&self) -> &::fidl::AsyncChannel {
8110        self.client.as_channel()
8111    }
8112}
8113
8114impl SmcResourceProxy {
8115    /// Create a new Proxy for fuchsia.kernel/SmcResource.
8116    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8117        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8118        Self { client: fidl::client::Client::new(channel, protocol_name) }
8119    }
8120
8121    /// Get a Stream of events from the remote end of the protocol.
8122    ///
8123    /// # Panics
8124    ///
8125    /// Panics if the event stream was already taken.
8126    pub fn take_event_stream(&self) -> SmcResourceEventStream {
8127        SmcResourceEventStream { event_receiver: self.client.take_event_receiver() }
8128    }
8129
8130    /// Get an SMC resource handle.
8131    pub fn r#get(
8132        &self,
8133    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8134    {
8135        SmcResourceProxyInterface::r#get(self)
8136    }
8137}
8138
8139impl SmcResourceProxyInterface for SmcResourceProxy {
8140    type GetResponseFut = fidl::client::QueryResponseFut<
8141        fidl::Resource,
8142        fidl::encoding::DefaultFuchsiaResourceDialect,
8143    >;
8144    fn r#get(&self) -> Self::GetResponseFut {
8145        fn _decode(
8146            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8147        ) -> Result<fidl::Resource, fidl::Error> {
8148            let _response = fidl::client::decode_transaction_body::<
8149                SmcResourceGetResponse,
8150                fidl::encoding::DefaultFuchsiaResourceDialect,
8151                0x392cbd495b84ede7,
8152            >(_buf?)?;
8153            Ok(_response.resource)
8154        }
8155        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8156            (),
8157            0x392cbd495b84ede7,
8158            fidl::encoding::DynamicFlags::empty(),
8159            _decode,
8160        )
8161    }
8162}
8163
8164pub struct SmcResourceEventStream {
8165    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8166}
8167
8168impl std::marker::Unpin for SmcResourceEventStream {}
8169
8170impl futures::stream::FusedStream for SmcResourceEventStream {
8171    fn is_terminated(&self) -> bool {
8172        self.event_receiver.is_terminated()
8173    }
8174}
8175
8176impl futures::Stream for SmcResourceEventStream {
8177    type Item = Result<SmcResourceEvent, fidl::Error>;
8178
8179    fn poll_next(
8180        mut self: std::pin::Pin<&mut Self>,
8181        cx: &mut std::task::Context<'_>,
8182    ) -> std::task::Poll<Option<Self::Item>> {
8183        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8184            &mut self.event_receiver,
8185            cx
8186        )?) {
8187            Some(buf) => std::task::Poll::Ready(Some(SmcResourceEvent::decode(buf))),
8188            None => std::task::Poll::Ready(None),
8189        }
8190    }
8191}
8192
8193#[derive(Debug)]
8194pub enum SmcResourceEvent {}
8195
8196impl SmcResourceEvent {
8197    /// Decodes a message buffer as a [`SmcResourceEvent`].
8198    fn decode(
8199        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8200    ) -> Result<SmcResourceEvent, fidl::Error> {
8201        let (bytes, _handles) = buf.split_mut();
8202        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8203        debug_assert_eq!(tx_header.tx_id, 0);
8204        match tx_header.ordinal {
8205            _ => Err(fidl::Error::UnknownOrdinal {
8206                ordinal: tx_header.ordinal,
8207                protocol_name: <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8208            }),
8209        }
8210    }
8211}
8212
8213/// A Stream of incoming requests for fuchsia.kernel/SmcResource.
8214pub struct SmcResourceRequestStream {
8215    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8216    is_terminated: bool,
8217}
8218
8219impl std::marker::Unpin for SmcResourceRequestStream {}
8220
8221impl futures::stream::FusedStream for SmcResourceRequestStream {
8222    fn is_terminated(&self) -> bool {
8223        self.is_terminated
8224    }
8225}
8226
8227impl fidl::endpoints::RequestStream for SmcResourceRequestStream {
8228    type Protocol = SmcResourceMarker;
8229    type ControlHandle = SmcResourceControlHandle;
8230
8231    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8232        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8233    }
8234
8235    fn control_handle(&self) -> Self::ControlHandle {
8236        SmcResourceControlHandle { inner: self.inner.clone() }
8237    }
8238
8239    fn into_inner(
8240        self,
8241    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8242    {
8243        (self.inner, self.is_terminated)
8244    }
8245
8246    fn from_inner(
8247        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8248        is_terminated: bool,
8249    ) -> Self {
8250        Self { inner, is_terminated }
8251    }
8252}
8253
8254impl futures::Stream for SmcResourceRequestStream {
8255    type Item = Result<SmcResourceRequest, fidl::Error>;
8256
8257    fn poll_next(
8258        mut self: std::pin::Pin<&mut Self>,
8259        cx: &mut std::task::Context<'_>,
8260    ) -> std::task::Poll<Option<Self::Item>> {
8261        let this = &mut *self;
8262        if this.inner.check_shutdown(cx) {
8263            this.is_terminated = true;
8264            return std::task::Poll::Ready(None);
8265        }
8266        if this.is_terminated {
8267            panic!("polled SmcResourceRequestStream after completion");
8268        }
8269        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8270            |bytes, handles| {
8271                match this.inner.channel().read_etc(cx, bytes, handles) {
8272                    std::task::Poll::Ready(Ok(())) => {}
8273                    std::task::Poll::Pending => return std::task::Poll::Pending,
8274                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8275                        this.is_terminated = true;
8276                        return std::task::Poll::Ready(None);
8277                    }
8278                    std::task::Poll::Ready(Err(e)) => {
8279                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8280                            e.into(),
8281                        ))))
8282                    }
8283                }
8284
8285                // A message has been received from the channel
8286                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8287
8288                std::task::Poll::Ready(Some(match header.ordinal {
8289                    0x392cbd495b84ede7 => {
8290                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8291                        let mut req = fidl::new_empty!(
8292                            fidl::encoding::EmptyPayload,
8293                            fidl::encoding::DefaultFuchsiaResourceDialect
8294                        );
8295                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8296                        let control_handle = SmcResourceControlHandle { inner: this.inner.clone() };
8297                        Ok(SmcResourceRequest::Get {
8298                            responder: SmcResourceGetResponder {
8299                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8300                                tx_id: header.tx_id,
8301                            },
8302                        })
8303                    }
8304                    _ => Err(fidl::Error::UnknownOrdinal {
8305                        ordinal: header.ordinal,
8306                        protocol_name:
8307                            <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8308                    }),
8309                }))
8310            },
8311        )
8312    }
8313}
8314
8315/// Protocol for providing an SMC resource with access to all valid ranges.
8316#[derive(Debug)]
8317pub enum SmcResourceRequest {
8318    /// Get an SMC resource handle.
8319    Get { responder: SmcResourceGetResponder },
8320}
8321
8322impl SmcResourceRequest {
8323    #[allow(irrefutable_let_patterns)]
8324    pub fn into_get(self) -> Option<(SmcResourceGetResponder)> {
8325        if let SmcResourceRequest::Get { responder } = self {
8326            Some((responder))
8327        } else {
8328            None
8329        }
8330    }
8331
8332    /// Name of the method defined in FIDL
8333    pub fn method_name(&self) -> &'static str {
8334        match *self {
8335            SmcResourceRequest::Get { .. } => "get",
8336        }
8337    }
8338}
8339
8340#[derive(Debug, Clone)]
8341pub struct SmcResourceControlHandle {
8342    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8343}
8344
8345impl fidl::endpoints::ControlHandle for SmcResourceControlHandle {
8346    fn shutdown(&self) {
8347        self.inner.shutdown()
8348    }
8349    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8350        self.inner.shutdown_with_epitaph(status)
8351    }
8352
8353    fn is_closed(&self) -> bool {
8354        self.inner.channel().is_closed()
8355    }
8356    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8357        self.inner.channel().on_closed()
8358    }
8359
8360    #[cfg(target_os = "fuchsia")]
8361    fn signal_peer(
8362        &self,
8363        clear_mask: zx::Signals,
8364        set_mask: zx::Signals,
8365    ) -> Result<(), zx_status::Status> {
8366        use fidl::Peered;
8367        self.inner.channel().signal_peer(clear_mask, set_mask)
8368    }
8369}
8370
8371impl SmcResourceControlHandle {}
8372
8373#[must_use = "FIDL methods require a response to be sent"]
8374#[derive(Debug)]
8375pub struct SmcResourceGetResponder {
8376    control_handle: std::mem::ManuallyDrop<SmcResourceControlHandle>,
8377    tx_id: u32,
8378}
8379
8380/// Set the the channel to be shutdown (see [`SmcResourceControlHandle::shutdown`])
8381/// if the responder is dropped without sending a response, so that the client
8382/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8383impl std::ops::Drop for SmcResourceGetResponder {
8384    fn drop(&mut self) {
8385        self.control_handle.shutdown();
8386        // Safety: drops once, never accessed again
8387        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8388    }
8389}
8390
8391impl fidl::endpoints::Responder for SmcResourceGetResponder {
8392    type ControlHandle = SmcResourceControlHandle;
8393
8394    fn control_handle(&self) -> &SmcResourceControlHandle {
8395        &self.control_handle
8396    }
8397
8398    fn drop_without_shutdown(mut self) {
8399        // Safety: drops once, never accessed again due to mem::forget
8400        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8401        // Prevent Drop from running (which would shut down the channel)
8402        std::mem::forget(self);
8403    }
8404}
8405
8406impl SmcResourceGetResponder {
8407    /// Sends a response to the FIDL transaction.
8408    ///
8409    /// Sets the channel to shutdown if an error occurs.
8410    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8411        let _result = self.send_raw(resource);
8412        if _result.is_err() {
8413            self.control_handle.shutdown();
8414        }
8415        self.drop_without_shutdown();
8416        _result
8417    }
8418
8419    /// Similar to "send" but does not shutdown the channel if an error occurs.
8420    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8421        let _result = self.send_raw(resource);
8422        self.drop_without_shutdown();
8423        _result
8424    }
8425
8426    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8427        self.control_handle.inner.send::<SmcResourceGetResponse>(
8428            (resource,),
8429            self.tx_id,
8430            0x392cbd495b84ede7,
8431            fidl::encoding::DynamicFlags::empty(),
8432        )
8433    }
8434}
8435
8436#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8437pub struct StallResourceMarker;
8438
8439impl fidl::endpoints::ProtocolMarker for StallResourceMarker {
8440    type Proxy = StallResourceProxy;
8441    type RequestStream = StallResourceRequestStream;
8442    #[cfg(target_os = "fuchsia")]
8443    type SynchronousProxy = StallResourceSynchronousProxy;
8444
8445    const DEBUG_NAME: &'static str = "fuchsia.kernel.StallResource";
8446}
8447impl fidl::endpoints::DiscoverableProtocolMarker for StallResourceMarker {}
8448
8449pub trait StallResourceProxyInterface: Send + Sync {
8450    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8451    fn r#get(&self) -> Self::GetResponseFut;
8452}
8453#[derive(Debug)]
8454#[cfg(target_os = "fuchsia")]
8455pub struct StallResourceSynchronousProxy {
8456    client: fidl::client::sync::Client,
8457}
8458
8459#[cfg(target_os = "fuchsia")]
8460impl fidl::endpoints::SynchronousProxy for StallResourceSynchronousProxy {
8461    type Proxy = StallResourceProxy;
8462    type Protocol = StallResourceMarker;
8463
8464    fn from_channel(inner: fidl::Channel) -> Self {
8465        Self::new(inner)
8466    }
8467
8468    fn into_channel(self) -> fidl::Channel {
8469        self.client.into_channel()
8470    }
8471
8472    fn as_channel(&self) -> &fidl::Channel {
8473        self.client.as_channel()
8474    }
8475}
8476
8477#[cfg(target_os = "fuchsia")]
8478impl StallResourceSynchronousProxy {
8479    pub fn new(channel: fidl::Channel) -> Self {
8480        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8481        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8482    }
8483
8484    pub fn into_channel(self) -> fidl::Channel {
8485        self.client.into_channel()
8486    }
8487
8488    /// Waits until an event arrives and returns it. It is safe for other
8489    /// threads to make concurrent requests while waiting for an event.
8490    pub fn wait_for_event(
8491        &self,
8492        deadline: zx::MonotonicInstant,
8493    ) -> Result<StallResourceEvent, fidl::Error> {
8494        StallResourceEvent::decode(self.client.wait_for_event(deadline)?)
8495    }
8496
8497    /// Get a stall resource handle.
8498    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8499        let _response =
8500            self.client.send_query::<fidl::encoding::EmptyPayload, StallResourceGetResponse>(
8501                (),
8502                0x5edf4c8629a9781a,
8503                fidl::encoding::DynamicFlags::empty(),
8504                ___deadline,
8505            )?;
8506        Ok(_response.resource)
8507    }
8508}
8509
8510#[derive(Debug, Clone)]
8511pub struct StallResourceProxy {
8512    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8513}
8514
8515impl fidl::endpoints::Proxy for StallResourceProxy {
8516    type Protocol = StallResourceMarker;
8517
8518    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8519        Self::new(inner)
8520    }
8521
8522    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8523        self.client.into_channel().map_err(|client| Self { client })
8524    }
8525
8526    fn as_channel(&self) -> &::fidl::AsyncChannel {
8527        self.client.as_channel()
8528    }
8529}
8530
8531impl StallResourceProxy {
8532    /// Create a new Proxy for fuchsia.kernel/StallResource.
8533    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8534        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8535        Self { client: fidl::client::Client::new(channel, protocol_name) }
8536    }
8537
8538    /// Get a Stream of events from the remote end of the protocol.
8539    ///
8540    /// # Panics
8541    ///
8542    /// Panics if the event stream was already taken.
8543    pub fn take_event_stream(&self) -> StallResourceEventStream {
8544        StallResourceEventStream { event_receiver: self.client.take_event_receiver() }
8545    }
8546
8547    /// Get a stall resource handle.
8548    pub fn r#get(
8549        &self,
8550    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8551    {
8552        StallResourceProxyInterface::r#get(self)
8553    }
8554}
8555
8556impl StallResourceProxyInterface for StallResourceProxy {
8557    type GetResponseFut = fidl::client::QueryResponseFut<
8558        fidl::Resource,
8559        fidl::encoding::DefaultFuchsiaResourceDialect,
8560    >;
8561    fn r#get(&self) -> Self::GetResponseFut {
8562        fn _decode(
8563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8564        ) -> Result<fidl::Resource, fidl::Error> {
8565            let _response = fidl::client::decode_transaction_body::<
8566                StallResourceGetResponse,
8567                fidl::encoding::DefaultFuchsiaResourceDialect,
8568                0x5edf4c8629a9781a,
8569            >(_buf?)?;
8570            Ok(_response.resource)
8571        }
8572        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8573            (),
8574            0x5edf4c8629a9781a,
8575            fidl::encoding::DynamicFlags::empty(),
8576            _decode,
8577        )
8578    }
8579}
8580
8581pub struct StallResourceEventStream {
8582    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8583}
8584
8585impl std::marker::Unpin for StallResourceEventStream {}
8586
8587impl futures::stream::FusedStream for StallResourceEventStream {
8588    fn is_terminated(&self) -> bool {
8589        self.event_receiver.is_terminated()
8590    }
8591}
8592
8593impl futures::Stream for StallResourceEventStream {
8594    type Item = Result<StallResourceEvent, fidl::Error>;
8595
8596    fn poll_next(
8597        mut self: std::pin::Pin<&mut Self>,
8598        cx: &mut std::task::Context<'_>,
8599    ) -> std::task::Poll<Option<Self::Item>> {
8600        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8601            &mut self.event_receiver,
8602            cx
8603        )?) {
8604            Some(buf) => std::task::Poll::Ready(Some(StallResourceEvent::decode(buf))),
8605            None => std::task::Poll::Ready(None),
8606        }
8607    }
8608}
8609
8610#[derive(Debug)]
8611pub enum StallResourceEvent {}
8612
8613impl StallResourceEvent {
8614    /// Decodes a message buffer as a [`StallResourceEvent`].
8615    fn decode(
8616        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8617    ) -> Result<StallResourceEvent, fidl::Error> {
8618        let (bytes, _handles) = buf.split_mut();
8619        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8620        debug_assert_eq!(tx_header.tx_id, 0);
8621        match tx_header.ordinal {
8622            _ => Err(fidl::Error::UnknownOrdinal {
8623                ordinal: tx_header.ordinal,
8624                protocol_name: <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8625            }),
8626        }
8627    }
8628}
8629
8630/// A Stream of incoming requests for fuchsia.kernel/StallResource.
8631pub struct StallResourceRequestStream {
8632    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8633    is_terminated: bool,
8634}
8635
8636impl std::marker::Unpin for StallResourceRequestStream {}
8637
8638impl futures::stream::FusedStream for StallResourceRequestStream {
8639    fn is_terminated(&self) -> bool {
8640        self.is_terminated
8641    }
8642}
8643
8644impl fidl::endpoints::RequestStream for StallResourceRequestStream {
8645    type Protocol = StallResourceMarker;
8646    type ControlHandle = StallResourceControlHandle;
8647
8648    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8649        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8650    }
8651
8652    fn control_handle(&self) -> Self::ControlHandle {
8653        StallResourceControlHandle { inner: self.inner.clone() }
8654    }
8655
8656    fn into_inner(
8657        self,
8658    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8659    {
8660        (self.inner, self.is_terminated)
8661    }
8662
8663    fn from_inner(
8664        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8665        is_terminated: bool,
8666    ) -> Self {
8667        Self { inner, is_terminated }
8668    }
8669}
8670
8671impl futures::Stream for StallResourceRequestStream {
8672    type Item = Result<StallResourceRequest, fidl::Error>;
8673
8674    fn poll_next(
8675        mut self: std::pin::Pin<&mut Self>,
8676        cx: &mut std::task::Context<'_>,
8677    ) -> std::task::Poll<Option<Self::Item>> {
8678        let this = &mut *self;
8679        if this.inner.check_shutdown(cx) {
8680            this.is_terminated = true;
8681            return std::task::Poll::Ready(None);
8682        }
8683        if this.is_terminated {
8684            panic!("polled StallResourceRequestStream after completion");
8685        }
8686        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8687            |bytes, handles| {
8688                match this.inner.channel().read_etc(cx, bytes, handles) {
8689                    std::task::Poll::Ready(Ok(())) => {}
8690                    std::task::Poll::Pending => return std::task::Poll::Pending,
8691                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8692                        this.is_terminated = true;
8693                        return std::task::Poll::Ready(None);
8694                    }
8695                    std::task::Poll::Ready(Err(e)) => {
8696                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8697                            e.into(),
8698                        ))))
8699                    }
8700                }
8701
8702                // A message has been received from the channel
8703                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8704
8705                std::task::Poll::Ready(Some(match header.ordinal {
8706                    0x5edf4c8629a9781a => {
8707                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8708                        let mut req = fidl::new_empty!(
8709                            fidl::encoding::EmptyPayload,
8710                            fidl::encoding::DefaultFuchsiaResourceDialect
8711                        );
8712                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8713                        let control_handle =
8714                            StallResourceControlHandle { inner: this.inner.clone() };
8715                        Ok(StallResourceRequest::Get {
8716                            responder: StallResourceGetResponder {
8717                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8718                                tx_id: header.tx_id,
8719                            },
8720                        })
8721                    }
8722                    _ => Err(fidl::Error::UnknownOrdinal {
8723                        ordinal: header.ordinal,
8724                        protocol_name:
8725                            <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8726                    }),
8727                }))
8728            },
8729        )
8730    }
8731}
8732
8733/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
8734/// `ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
8735/// be notified of stalls.
8736#[derive(Debug)]
8737pub enum StallResourceRequest {
8738    /// Get a stall resource handle.
8739    Get { responder: StallResourceGetResponder },
8740}
8741
8742impl StallResourceRequest {
8743    #[allow(irrefutable_let_patterns)]
8744    pub fn into_get(self) -> Option<(StallResourceGetResponder)> {
8745        if let StallResourceRequest::Get { responder } = self {
8746            Some((responder))
8747        } else {
8748            None
8749        }
8750    }
8751
8752    /// Name of the method defined in FIDL
8753    pub fn method_name(&self) -> &'static str {
8754        match *self {
8755            StallResourceRequest::Get { .. } => "get",
8756        }
8757    }
8758}
8759
8760#[derive(Debug, Clone)]
8761pub struct StallResourceControlHandle {
8762    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8763}
8764
8765impl fidl::endpoints::ControlHandle for StallResourceControlHandle {
8766    fn shutdown(&self) {
8767        self.inner.shutdown()
8768    }
8769    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8770        self.inner.shutdown_with_epitaph(status)
8771    }
8772
8773    fn is_closed(&self) -> bool {
8774        self.inner.channel().is_closed()
8775    }
8776    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8777        self.inner.channel().on_closed()
8778    }
8779
8780    #[cfg(target_os = "fuchsia")]
8781    fn signal_peer(
8782        &self,
8783        clear_mask: zx::Signals,
8784        set_mask: zx::Signals,
8785    ) -> Result<(), zx_status::Status> {
8786        use fidl::Peered;
8787        self.inner.channel().signal_peer(clear_mask, set_mask)
8788    }
8789}
8790
8791impl StallResourceControlHandle {}
8792
8793#[must_use = "FIDL methods require a response to be sent"]
8794#[derive(Debug)]
8795pub struct StallResourceGetResponder {
8796    control_handle: std::mem::ManuallyDrop<StallResourceControlHandle>,
8797    tx_id: u32,
8798}
8799
8800/// Set the the channel to be shutdown (see [`StallResourceControlHandle::shutdown`])
8801/// if the responder is dropped without sending a response, so that the client
8802/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8803impl std::ops::Drop for StallResourceGetResponder {
8804    fn drop(&mut self) {
8805        self.control_handle.shutdown();
8806        // Safety: drops once, never accessed again
8807        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8808    }
8809}
8810
8811impl fidl::endpoints::Responder for StallResourceGetResponder {
8812    type ControlHandle = StallResourceControlHandle;
8813
8814    fn control_handle(&self) -> &StallResourceControlHandle {
8815        &self.control_handle
8816    }
8817
8818    fn drop_without_shutdown(mut self) {
8819        // Safety: drops once, never accessed again due to mem::forget
8820        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8821        // Prevent Drop from running (which would shut down the channel)
8822        std::mem::forget(self);
8823    }
8824}
8825
8826impl StallResourceGetResponder {
8827    /// Sends a response to the FIDL transaction.
8828    ///
8829    /// Sets the channel to shutdown if an error occurs.
8830    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8831        let _result = self.send_raw(resource);
8832        if _result.is_err() {
8833            self.control_handle.shutdown();
8834        }
8835        self.drop_without_shutdown();
8836        _result
8837    }
8838
8839    /// Similar to "send" but does not shutdown the channel if an error occurs.
8840    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8841        let _result = self.send_raw(resource);
8842        self.drop_without_shutdown();
8843        _result
8844    }
8845
8846    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8847        self.control_handle.inner.send::<StallResourceGetResponse>(
8848            (resource,),
8849            self.tx_id,
8850            0x5edf4c8629a9781a,
8851            fidl::encoding::DynamicFlags::empty(),
8852        )
8853    }
8854}
8855
8856#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8857pub struct StatsMarker;
8858
8859impl fidl::endpoints::ProtocolMarker for StatsMarker {
8860    type Proxy = StatsProxy;
8861    type RequestStream = StatsRequestStream;
8862    #[cfg(target_os = "fuchsia")]
8863    type SynchronousProxy = StatsSynchronousProxy;
8864
8865    const DEBUG_NAME: &'static str = "fuchsia.kernel.Stats";
8866}
8867impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
8868
8869pub trait StatsProxyInterface: Send + Sync {
8870    type GetMemoryStatsResponseFut: std::future::Future<Output = Result<MemoryStats, fidl::Error>>
8871        + Send;
8872    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut;
8873    type GetMemoryStatsExtendedResponseFut: std::future::Future<Output = Result<MemoryStatsExtended, fidl::Error>>
8874        + Send;
8875    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut;
8876    type GetMemoryStatsCompressionResponseFut: std::future::Future<Output = Result<MemoryStatsCompression, fidl::Error>>
8877        + Send;
8878    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut;
8879    type GetCpuStatsResponseFut: std::future::Future<Output = Result<CpuStats, fidl::Error>> + Send;
8880    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut;
8881    type GetCpuLoadResponseFut: std::future::Future<Output = Result<Vec<f32>, fidl::Error>> + Send;
8882    fn r#get_cpu_load(&self, duration: i64) -> Self::GetCpuLoadResponseFut;
8883}
8884#[derive(Debug)]
8885#[cfg(target_os = "fuchsia")]
8886pub struct StatsSynchronousProxy {
8887    client: fidl::client::sync::Client,
8888}
8889
8890#[cfg(target_os = "fuchsia")]
8891impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
8892    type Proxy = StatsProxy;
8893    type Protocol = StatsMarker;
8894
8895    fn from_channel(inner: fidl::Channel) -> Self {
8896        Self::new(inner)
8897    }
8898
8899    fn into_channel(self) -> fidl::Channel {
8900        self.client.into_channel()
8901    }
8902
8903    fn as_channel(&self) -> &fidl::Channel {
8904        self.client.as_channel()
8905    }
8906}
8907
8908#[cfg(target_os = "fuchsia")]
8909impl StatsSynchronousProxy {
8910    pub fn new(channel: fidl::Channel) -> Self {
8911        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8912        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8913    }
8914
8915    pub fn into_channel(self) -> fidl::Channel {
8916        self.client.into_channel()
8917    }
8918
8919    /// Waits until an event arrives and returns it. It is safe for other
8920    /// threads to make concurrent requests while waiting for an event.
8921    pub fn wait_for_event(
8922        &self,
8923        deadline: zx::MonotonicInstant,
8924    ) -> Result<StatsEvent, fidl::Error> {
8925        StatsEvent::decode(self.client.wait_for_event(deadline)?)
8926    }
8927
8928    pub fn r#get_memory_stats(
8929        &self,
8930        ___deadline: zx::MonotonicInstant,
8931    ) -> Result<MemoryStats, fidl::Error> {
8932        let _response =
8933            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsResponse>(
8934                (),
8935                0x686677932ae41074,
8936                fidl::encoding::DynamicFlags::empty(),
8937                ___deadline,
8938            )?;
8939        Ok(_response.stats)
8940    }
8941
8942    pub fn r#get_memory_stats_extended(
8943        &self,
8944        ___deadline: zx::MonotonicInstant,
8945    ) -> Result<MemoryStatsExtended, fidl::Error> {
8946        let _response = self
8947            .client
8948            .send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsExtendedResponse>(
8949                (),
8950                0x60faa0f8aa38c29f,
8951                fidl::encoding::DynamicFlags::empty(),
8952                ___deadline,
8953            )?;
8954        Ok(_response.stats)
8955    }
8956
8957    pub fn r#get_memory_stats_compression(
8958        &self,
8959        ___deadline: zx::MonotonicInstant,
8960    ) -> Result<MemoryStatsCompression, fidl::Error> {
8961        let _response =
8962            self.client.send_query::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
8963                (),
8964                0x544a09995befb531,
8965                fidl::encoding::DynamicFlags::empty(),
8966                ___deadline,
8967            )?;
8968        Ok(_response)
8969    }
8970
8971    pub fn r#get_cpu_stats(
8972        &self,
8973        ___deadline: zx::MonotonicInstant,
8974    ) -> Result<CpuStats, fidl::Error> {
8975        let _response =
8976            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetCpuStatsResponse>(
8977                (),
8978                0x470e2684ca1ca19e,
8979                fidl::encoding::DynamicFlags::empty(),
8980                ___deadline,
8981            )?;
8982        Ok(_response.stats)
8983    }
8984
8985    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
8986    /// duration.
8987    ///
8988    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
8989    /// PerCpuStats) over a time duration.
8990    pub fn r#get_cpu_load(
8991        &self,
8992        mut duration: i64,
8993        ___deadline: zx::MonotonicInstant,
8994    ) -> Result<Vec<f32>, fidl::Error> {
8995        let _response = self.client.send_query::<StatsGetCpuLoadRequest, StatsGetCpuLoadResponse>(
8996            (duration,),
8997            0x4c8f0f05e7034666,
8998            fidl::encoding::DynamicFlags::empty(),
8999            ___deadline,
9000        )?;
9001        Ok(_response.per_cpu_load)
9002    }
9003}
9004
9005#[derive(Debug, Clone)]
9006pub struct StatsProxy {
9007    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9008}
9009
9010impl fidl::endpoints::Proxy for StatsProxy {
9011    type Protocol = StatsMarker;
9012
9013    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9014        Self::new(inner)
9015    }
9016
9017    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9018        self.client.into_channel().map_err(|client| Self { client })
9019    }
9020
9021    fn as_channel(&self) -> &::fidl::AsyncChannel {
9022        self.client.as_channel()
9023    }
9024}
9025
9026impl StatsProxy {
9027    /// Create a new Proxy for fuchsia.kernel/Stats.
9028    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9029        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9030        Self { client: fidl::client::Client::new(channel, protocol_name) }
9031    }
9032
9033    /// Get a Stream of events from the remote end of the protocol.
9034    ///
9035    /// # Panics
9036    ///
9037    /// Panics if the event stream was already taken.
9038    pub fn take_event_stream(&self) -> StatsEventStream {
9039        StatsEventStream { event_receiver: self.client.take_event_receiver() }
9040    }
9041
9042    pub fn r#get_memory_stats(
9043        &self,
9044    ) -> fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9045    {
9046        StatsProxyInterface::r#get_memory_stats(self)
9047    }
9048
9049    pub fn r#get_memory_stats_extended(
9050        &self,
9051    ) -> fidl::client::QueryResponseFut<
9052        MemoryStatsExtended,
9053        fidl::encoding::DefaultFuchsiaResourceDialect,
9054    > {
9055        StatsProxyInterface::r#get_memory_stats_extended(self)
9056    }
9057
9058    pub fn r#get_memory_stats_compression(
9059        &self,
9060    ) -> fidl::client::QueryResponseFut<
9061        MemoryStatsCompression,
9062        fidl::encoding::DefaultFuchsiaResourceDialect,
9063    > {
9064        StatsProxyInterface::r#get_memory_stats_compression(self)
9065    }
9066
9067    pub fn r#get_cpu_stats(
9068        &self,
9069    ) -> fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9070    {
9071        StatsProxyInterface::r#get_cpu_stats(self)
9072    }
9073
9074    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9075    /// duration.
9076    ///
9077    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9078    /// PerCpuStats) over a time duration.
9079    pub fn r#get_cpu_load(
9080        &self,
9081        mut duration: i64,
9082    ) -> fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>
9083    {
9084        StatsProxyInterface::r#get_cpu_load(self, duration)
9085    }
9086}
9087
9088impl StatsProxyInterface for StatsProxy {
9089    type GetMemoryStatsResponseFut =
9090        fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9091    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut {
9092        fn _decode(
9093            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9094        ) -> Result<MemoryStats, fidl::Error> {
9095            let _response = fidl::client::decode_transaction_body::<
9096                StatsGetMemoryStatsResponse,
9097                fidl::encoding::DefaultFuchsiaResourceDialect,
9098                0x686677932ae41074,
9099            >(_buf?)?;
9100            Ok(_response.stats)
9101        }
9102        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStats>(
9103            (),
9104            0x686677932ae41074,
9105            fidl::encoding::DynamicFlags::empty(),
9106            _decode,
9107        )
9108    }
9109
9110    type GetMemoryStatsExtendedResponseFut = fidl::client::QueryResponseFut<
9111        MemoryStatsExtended,
9112        fidl::encoding::DefaultFuchsiaResourceDialect,
9113    >;
9114    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut {
9115        fn _decode(
9116            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9117        ) -> Result<MemoryStatsExtended, fidl::Error> {
9118            let _response = fidl::client::decode_transaction_body::<
9119                StatsGetMemoryStatsExtendedResponse,
9120                fidl::encoding::DefaultFuchsiaResourceDialect,
9121                0x60faa0f8aa38c29f,
9122            >(_buf?)?;
9123            Ok(_response.stats)
9124        }
9125        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsExtended>(
9126            (),
9127            0x60faa0f8aa38c29f,
9128            fidl::encoding::DynamicFlags::empty(),
9129            _decode,
9130        )
9131    }
9132
9133    type GetMemoryStatsCompressionResponseFut = fidl::client::QueryResponseFut<
9134        MemoryStatsCompression,
9135        fidl::encoding::DefaultFuchsiaResourceDialect,
9136    >;
9137    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut {
9138        fn _decode(
9139            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9140        ) -> Result<MemoryStatsCompression, fidl::Error> {
9141            let _response = fidl::client::decode_transaction_body::<
9142                MemoryStatsCompression,
9143                fidl::encoding::DefaultFuchsiaResourceDialect,
9144                0x544a09995befb531,
9145            >(_buf?)?;
9146            Ok(_response)
9147        }
9148        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
9149            (),
9150            0x544a09995befb531,
9151            fidl::encoding::DynamicFlags::empty(),
9152            _decode,
9153        )
9154    }
9155
9156    type GetCpuStatsResponseFut =
9157        fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9158    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut {
9159        fn _decode(
9160            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9161        ) -> Result<CpuStats, fidl::Error> {
9162            let _response = fidl::client::decode_transaction_body::<
9163                StatsGetCpuStatsResponse,
9164                fidl::encoding::DefaultFuchsiaResourceDialect,
9165                0x470e2684ca1ca19e,
9166            >(_buf?)?;
9167            Ok(_response.stats)
9168        }
9169        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CpuStats>(
9170            (),
9171            0x470e2684ca1ca19e,
9172            fidl::encoding::DynamicFlags::empty(),
9173            _decode,
9174        )
9175    }
9176
9177    type GetCpuLoadResponseFut =
9178        fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>;
9179    fn r#get_cpu_load(&self, mut duration: i64) -> Self::GetCpuLoadResponseFut {
9180        fn _decode(
9181            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9182        ) -> Result<Vec<f32>, fidl::Error> {
9183            let _response = fidl::client::decode_transaction_body::<
9184                StatsGetCpuLoadResponse,
9185                fidl::encoding::DefaultFuchsiaResourceDialect,
9186                0x4c8f0f05e7034666,
9187            >(_buf?)?;
9188            Ok(_response.per_cpu_load)
9189        }
9190        self.client.send_query_and_decode::<StatsGetCpuLoadRequest, Vec<f32>>(
9191            (duration,),
9192            0x4c8f0f05e7034666,
9193            fidl::encoding::DynamicFlags::empty(),
9194            _decode,
9195        )
9196    }
9197}
9198
9199pub struct StatsEventStream {
9200    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9201}
9202
9203impl std::marker::Unpin for StatsEventStream {}
9204
9205impl futures::stream::FusedStream for StatsEventStream {
9206    fn is_terminated(&self) -> bool {
9207        self.event_receiver.is_terminated()
9208    }
9209}
9210
9211impl futures::Stream for StatsEventStream {
9212    type Item = Result<StatsEvent, fidl::Error>;
9213
9214    fn poll_next(
9215        mut self: std::pin::Pin<&mut Self>,
9216        cx: &mut std::task::Context<'_>,
9217    ) -> std::task::Poll<Option<Self::Item>> {
9218        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9219            &mut self.event_receiver,
9220            cx
9221        )?) {
9222            Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
9223            None => std::task::Poll::Ready(None),
9224        }
9225    }
9226}
9227
9228#[derive(Debug)]
9229pub enum StatsEvent {}
9230
9231impl StatsEvent {
9232    /// Decodes a message buffer as a [`StatsEvent`].
9233    fn decode(
9234        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9235    ) -> Result<StatsEvent, fidl::Error> {
9236        let (bytes, _handles) = buf.split_mut();
9237        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9238        debug_assert_eq!(tx_header.tx_id, 0);
9239        match tx_header.ordinal {
9240            _ => Err(fidl::Error::UnknownOrdinal {
9241                ordinal: tx_header.ordinal,
9242                protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9243            }),
9244        }
9245    }
9246}
9247
9248/// A Stream of incoming requests for fuchsia.kernel/Stats.
9249pub struct StatsRequestStream {
9250    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9251    is_terminated: bool,
9252}
9253
9254impl std::marker::Unpin for StatsRequestStream {}
9255
9256impl futures::stream::FusedStream for StatsRequestStream {
9257    fn is_terminated(&self) -> bool {
9258        self.is_terminated
9259    }
9260}
9261
9262impl fidl::endpoints::RequestStream for StatsRequestStream {
9263    type Protocol = StatsMarker;
9264    type ControlHandle = StatsControlHandle;
9265
9266    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9267        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9268    }
9269
9270    fn control_handle(&self) -> Self::ControlHandle {
9271        StatsControlHandle { inner: self.inner.clone() }
9272    }
9273
9274    fn into_inner(
9275        self,
9276    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9277    {
9278        (self.inner, self.is_terminated)
9279    }
9280
9281    fn from_inner(
9282        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9283        is_terminated: bool,
9284    ) -> Self {
9285        Self { inner, is_terminated }
9286    }
9287}
9288
9289impl futures::Stream for StatsRequestStream {
9290    type Item = Result<StatsRequest, fidl::Error>;
9291
9292    fn poll_next(
9293        mut self: std::pin::Pin<&mut Self>,
9294        cx: &mut std::task::Context<'_>,
9295    ) -> std::task::Poll<Option<Self::Item>> {
9296        let this = &mut *self;
9297        if this.inner.check_shutdown(cx) {
9298            this.is_terminated = true;
9299            return std::task::Poll::Ready(None);
9300        }
9301        if this.is_terminated {
9302            panic!("polled StatsRequestStream after completion");
9303        }
9304        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9305            |bytes, handles| {
9306                match this.inner.channel().read_etc(cx, bytes, handles) {
9307                    std::task::Poll::Ready(Ok(())) => {}
9308                    std::task::Poll::Pending => return std::task::Poll::Pending,
9309                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9310                        this.is_terminated = true;
9311                        return std::task::Poll::Ready(None);
9312                    }
9313                    std::task::Poll::Ready(Err(e)) => {
9314                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9315                            e.into(),
9316                        ))))
9317                    }
9318                }
9319
9320                // A message has been received from the channel
9321                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9322
9323                std::task::Poll::Ready(Some(match header.ordinal {
9324                    0x686677932ae41074 => {
9325                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9326                        let mut req = fidl::new_empty!(
9327                            fidl::encoding::EmptyPayload,
9328                            fidl::encoding::DefaultFuchsiaResourceDialect
9329                        );
9330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9331                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9332                        Ok(StatsRequest::GetMemoryStats {
9333                            responder: StatsGetMemoryStatsResponder {
9334                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9335                                tx_id: header.tx_id,
9336                            },
9337                        })
9338                    }
9339                    0x60faa0f8aa38c29f => {
9340                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9341                        let mut req = fidl::new_empty!(
9342                            fidl::encoding::EmptyPayload,
9343                            fidl::encoding::DefaultFuchsiaResourceDialect
9344                        );
9345                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9346                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9347                        Ok(StatsRequest::GetMemoryStatsExtended {
9348                            responder: StatsGetMemoryStatsExtendedResponder {
9349                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9350                                tx_id: header.tx_id,
9351                            },
9352                        })
9353                    }
9354                    0x544a09995befb531 => {
9355                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9356                        let mut req = fidl::new_empty!(
9357                            fidl::encoding::EmptyPayload,
9358                            fidl::encoding::DefaultFuchsiaResourceDialect
9359                        );
9360                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9361                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9362                        Ok(StatsRequest::GetMemoryStatsCompression {
9363                            responder: StatsGetMemoryStatsCompressionResponder {
9364                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9365                                tx_id: header.tx_id,
9366                            },
9367                        })
9368                    }
9369                    0x470e2684ca1ca19e => {
9370                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9371                        let mut req = fidl::new_empty!(
9372                            fidl::encoding::EmptyPayload,
9373                            fidl::encoding::DefaultFuchsiaResourceDialect
9374                        );
9375                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9376                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9377                        Ok(StatsRequest::GetCpuStats {
9378                            responder: StatsGetCpuStatsResponder {
9379                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9380                                tx_id: header.tx_id,
9381                            },
9382                        })
9383                    }
9384                    0x4c8f0f05e7034666 => {
9385                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9386                        let mut req = fidl::new_empty!(
9387                            StatsGetCpuLoadRequest,
9388                            fidl::encoding::DefaultFuchsiaResourceDialect
9389                        );
9390                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatsGetCpuLoadRequest>(&header, _body_bytes, handles, &mut req)?;
9391                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9392                        Ok(StatsRequest::GetCpuLoad {
9393                            duration: req.duration,
9394
9395                            responder: StatsGetCpuLoadResponder {
9396                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9397                                tx_id: header.tx_id,
9398                            },
9399                        })
9400                    }
9401                    _ => Err(fidl::Error::UnknownOrdinal {
9402                        ordinal: header.ordinal,
9403                        protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9404                    }),
9405                }))
9406            },
9407        )
9408    }
9409}
9410
9411/// Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
9412/// the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
9413/// 'Root Resource' capability to obtain. Instead of vending out that capability, programs that
9414/// just want stats should use this service instead. If for some reason the protocol fails to
9415/// retrieve stats, which will be an un-recoverable error, it will close the channel.
9416#[derive(Debug)]
9417pub enum StatsRequest {
9418    GetMemoryStats {
9419        responder: StatsGetMemoryStatsResponder,
9420    },
9421    GetMemoryStatsExtended {
9422        responder: StatsGetMemoryStatsExtendedResponder,
9423    },
9424    GetMemoryStatsCompression {
9425        responder: StatsGetMemoryStatsCompressionResponder,
9426    },
9427    GetCpuStats {
9428        responder: StatsGetCpuStatsResponder,
9429    },
9430    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9431    /// duration.
9432    ///
9433    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9434    /// PerCpuStats) over a time duration.
9435    GetCpuLoad {
9436        duration: i64,
9437        responder: StatsGetCpuLoadResponder,
9438    },
9439}
9440
9441impl StatsRequest {
9442    #[allow(irrefutable_let_patterns)]
9443    pub fn into_get_memory_stats(self) -> Option<(StatsGetMemoryStatsResponder)> {
9444        if let StatsRequest::GetMemoryStats { responder } = self {
9445            Some((responder))
9446        } else {
9447            None
9448        }
9449    }
9450
9451    #[allow(irrefutable_let_patterns)]
9452    pub fn into_get_memory_stats_extended(self) -> Option<(StatsGetMemoryStatsExtendedResponder)> {
9453        if let StatsRequest::GetMemoryStatsExtended { responder } = self {
9454            Some((responder))
9455        } else {
9456            None
9457        }
9458    }
9459
9460    #[allow(irrefutable_let_patterns)]
9461    pub fn into_get_memory_stats_compression(
9462        self,
9463    ) -> Option<(StatsGetMemoryStatsCompressionResponder)> {
9464        if let StatsRequest::GetMemoryStatsCompression { responder } = self {
9465            Some((responder))
9466        } else {
9467            None
9468        }
9469    }
9470
9471    #[allow(irrefutable_let_patterns)]
9472    pub fn into_get_cpu_stats(self) -> Option<(StatsGetCpuStatsResponder)> {
9473        if let StatsRequest::GetCpuStats { responder } = self {
9474            Some((responder))
9475        } else {
9476            None
9477        }
9478    }
9479
9480    #[allow(irrefutable_let_patterns)]
9481    pub fn into_get_cpu_load(self) -> Option<(i64, StatsGetCpuLoadResponder)> {
9482        if let StatsRequest::GetCpuLoad { duration, responder } = self {
9483            Some((duration, responder))
9484        } else {
9485            None
9486        }
9487    }
9488
9489    /// Name of the method defined in FIDL
9490    pub fn method_name(&self) -> &'static str {
9491        match *self {
9492            StatsRequest::GetMemoryStats { .. } => "get_memory_stats",
9493            StatsRequest::GetMemoryStatsExtended { .. } => "get_memory_stats_extended",
9494            StatsRequest::GetMemoryStatsCompression { .. } => "get_memory_stats_compression",
9495            StatsRequest::GetCpuStats { .. } => "get_cpu_stats",
9496            StatsRequest::GetCpuLoad { .. } => "get_cpu_load",
9497        }
9498    }
9499}
9500
9501#[derive(Debug, Clone)]
9502pub struct StatsControlHandle {
9503    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9504}
9505
9506impl fidl::endpoints::ControlHandle for StatsControlHandle {
9507    fn shutdown(&self) {
9508        self.inner.shutdown()
9509    }
9510    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9511        self.inner.shutdown_with_epitaph(status)
9512    }
9513
9514    fn is_closed(&self) -> bool {
9515        self.inner.channel().is_closed()
9516    }
9517    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9518        self.inner.channel().on_closed()
9519    }
9520
9521    #[cfg(target_os = "fuchsia")]
9522    fn signal_peer(
9523        &self,
9524        clear_mask: zx::Signals,
9525        set_mask: zx::Signals,
9526    ) -> Result<(), zx_status::Status> {
9527        use fidl::Peered;
9528        self.inner.channel().signal_peer(clear_mask, set_mask)
9529    }
9530}
9531
9532impl StatsControlHandle {}
9533
9534#[must_use = "FIDL methods require a response to be sent"]
9535#[derive(Debug)]
9536pub struct StatsGetMemoryStatsResponder {
9537    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
9538    tx_id: u32,
9539}
9540
9541/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
9542/// if the responder is dropped without sending a response, so that the client
9543/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9544impl std::ops::Drop for StatsGetMemoryStatsResponder {
9545    fn drop(&mut self) {
9546        self.control_handle.shutdown();
9547        // Safety: drops once, never accessed again
9548        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9549    }
9550}
9551
9552impl fidl::endpoints::Responder for StatsGetMemoryStatsResponder {
9553    type ControlHandle = StatsControlHandle;
9554
9555    fn control_handle(&self) -> &StatsControlHandle {
9556        &self.control_handle
9557    }
9558
9559    fn drop_without_shutdown(mut self) {
9560        // Safety: drops once, never accessed again due to mem::forget
9561        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9562        // Prevent Drop from running (which would shut down the channel)
9563        std::mem::forget(self);
9564    }
9565}
9566
9567impl StatsGetMemoryStatsResponder {
9568    /// Sends a response to the FIDL transaction.
9569    ///
9570    /// Sets the channel to shutdown if an error occurs.
9571    pub fn send(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
9572        let _result = self.send_raw(stats);
9573        if _result.is_err() {
9574            self.control_handle.shutdown();
9575        }
9576        self.drop_without_shutdown();
9577        _result
9578    }
9579
9580    /// Similar to "send" but does not shutdown the channel if an error occurs.
9581    pub fn send_no_shutdown_on_err(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
9582        let _result = self.send_raw(stats);
9583        self.drop_without_shutdown();
9584        _result
9585    }
9586
9587    fn send_raw(&self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
9588        self.control_handle.inner.send::<StatsGetMemoryStatsResponse>(
9589            (stats,),
9590            self.tx_id,
9591            0x686677932ae41074,
9592            fidl::encoding::DynamicFlags::empty(),
9593        )
9594    }
9595}
9596
9597#[must_use = "FIDL methods require a response to be sent"]
9598#[derive(Debug)]
9599pub struct StatsGetMemoryStatsExtendedResponder {
9600    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
9601    tx_id: u32,
9602}
9603
9604/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
9605/// if the responder is dropped without sending a response, so that the client
9606/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9607impl std::ops::Drop for StatsGetMemoryStatsExtendedResponder {
9608    fn drop(&mut self) {
9609        self.control_handle.shutdown();
9610        // Safety: drops once, never accessed again
9611        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9612    }
9613}
9614
9615impl fidl::endpoints::Responder for StatsGetMemoryStatsExtendedResponder {
9616    type ControlHandle = StatsControlHandle;
9617
9618    fn control_handle(&self) -> &StatsControlHandle {
9619        &self.control_handle
9620    }
9621
9622    fn drop_without_shutdown(mut self) {
9623        // Safety: drops once, never accessed again due to mem::forget
9624        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9625        // Prevent Drop from running (which would shut down the channel)
9626        std::mem::forget(self);
9627    }
9628}
9629
9630impl StatsGetMemoryStatsExtendedResponder {
9631    /// Sends a response to the FIDL transaction.
9632    ///
9633    /// Sets the channel to shutdown if an error occurs.
9634    pub fn send(self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
9635        let _result = self.send_raw(stats);
9636        if _result.is_err() {
9637            self.control_handle.shutdown();
9638        }
9639        self.drop_without_shutdown();
9640        _result
9641    }
9642
9643    /// Similar to "send" but does not shutdown the channel if an error occurs.
9644    pub fn send_no_shutdown_on_err(
9645        self,
9646        mut stats: &MemoryStatsExtended,
9647    ) -> Result<(), fidl::Error> {
9648        let _result = self.send_raw(stats);
9649        self.drop_without_shutdown();
9650        _result
9651    }
9652
9653    fn send_raw(&self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
9654        self.control_handle.inner.send::<StatsGetMemoryStatsExtendedResponse>(
9655            (stats,),
9656            self.tx_id,
9657            0x60faa0f8aa38c29f,
9658            fidl::encoding::DynamicFlags::empty(),
9659        )
9660    }
9661}
9662
9663#[must_use = "FIDL methods require a response to be sent"]
9664#[derive(Debug)]
9665pub struct StatsGetMemoryStatsCompressionResponder {
9666    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
9667    tx_id: u32,
9668}
9669
9670/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
9671/// if the responder is dropped without sending a response, so that the client
9672/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9673impl std::ops::Drop for StatsGetMemoryStatsCompressionResponder {
9674    fn drop(&mut self) {
9675        self.control_handle.shutdown();
9676        // Safety: drops once, never accessed again
9677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9678    }
9679}
9680
9681impl fidl::endpoints::Responder for StatsGetMemoryStatsCompressionResponder {
9682    type ControlHandle = StatsControlHandle;
9683
9684    fn control_handle(&self) -> &StatsControlHandle {
9685        &self.control_handle
9686    }
9687
9688    fn drop_without_shutdown(mut self) {
9689        // Safety: drops once, never accessed again due to mem::forget
9690        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9691        // Prevent Drop from running (which would shut down the channel)
9692        std::mem::forget(self);
9693    }
9694}
9695
9696impl StatsGetMemoryStatsCompressionResponder {
9697    /// Sends a response to the FIDL transaction.
9698    ///
9699    /// Sets the channel to shutdown if an error occurs.
9700    pub fn send(self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
9701        let _result = self.send_raw(payload);
9702        if _result.is_err() {
9703            self.control_handle.shutdown();
9704        }
9705        self.drop_without_shutdown();
9706        _result
9707    }
9708
9709    /// Similar to "send" but does not shutdown the channel if an error occurs.
9710    pub fn send_no_shutdown_on_err(
9711        self,
9712        mut payload: &MemoryStatsCompression,
9713    ) -> Result<(), fidl::Error> {
9714        let _result = self.send_raw(payload);
9715        self.drop_without_shutdown();
9716        _result
9717    }
9718
9719    fn send_raw(&self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
9720        self.control_handle.inner.send::<MemoryStatsCompression>(
9721            payload,
9722            self.tx_id,
9723            0x544a09995befb531,
9724            fidl::encoding::DynamicFlags::empty(),
9725        )
9726    }
9727}
9728
9729#[must_use = "FIDL methods require a response to be sent"]
9730#[derive(Debug)]
9731pub struct StatsGetCpuStatsResponder {
9732    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
9733    tx_id: u32,
9734}
9735
9736/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
9737/// if the responder is dropped without sending a response, so that the client
9738/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9739impl std::ops::Drop for StatsGetCpuStatsResponder {
9740    fn drop(&mut self) {
9741        self.control_handle.shutdown();
9742        // Safety: drops once, never accessed again
9743        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9744    }
9745}
9746
9747impl fidl::endpoints::Responder for StatsGetCpuStatsResponder {
9748    type ControlHandle = StatsControlHandle;
9749
9750    fn control_handle(&self) -> &StatsControlHandle {
9751        &self.control_handle
9752    }
9753
9754    fn drop_without_shutdown(mut self) {
9755        // Safety: drops once, never accessed again due to mem::forget
9756        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9757        // Prevent Drop from running (which would shut down the channel)
9758        std::mem::forget(self);
9759    }
9760}
9761
9762impl StatsGetCpuStatsResponder {
9763    /// Sends a response to the FIDL transaction.
9764    ///
9765    /// Sets the channel to shutdown if an error occurs.
9766    pub fn send(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
9767        let _result = self.send_raw(stats);
9768        if _result.is_err() {
9769            self.control_handle.shutdown();
9770        }
9771        self.drop_without_shutdown();
9772        _result
9773    }
9774
9775    /// Similar to "send" but does not shutdown the channel if an error occurs.
9776    pub fn send_no_shutdown_on_err(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
9777        let _result = self.send_raw(stats);
9778        self.drop_without_shutdown();
9779        _result
9780    }
9781
9782    fn send_raw(&self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
9783        self.control_handle.inner.send::<StatsGetCpuStatsResponse>(
9784            (stats,),
9785            self.tx_id,
9786            0x470e2684ca1ca19e,
9787            fidl::encoding::DynamicFlags::empty(),
9788        )
9789    }
9790}
9791
9792#[must_use = "FIDL methods require a response to be sent"]
9793#[derive(Debug)]
9794pub struct StatsGetCpuLoadResponder {
9795    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
9796    tx_id: u32,
9797}
9798
9799/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
9800/// if the responder is dropped without sending a response, so that the client
9801/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9802impl std::ops::Drop for StatsGetCpuLoadResponder {
9803    fn drop(&mut self) {
9804        self.control_handle.shutdown();
9805        // Safety: drops once, never accessed again
9806        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9807    }
9808}
9809
9810impl fidl::endpoints::Responder for StatsGetCpuLoadResponder {
9811    type ControlHandle = StatsControlHandle;
9812
9813    fn control_handle(&self) -> &StatsControlHandle {
9814        &self.control_handle
9815    }
9816
9817    fn drop_without_shutdown(mut self) {
9818        // Safety: drops once, never accessed again due to mem::forget
9819        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9820        // Prevent Drop from running (which would shut down the channel)
9821        std::mem::forget(self);
9822    }
9823}
9824
9825impl StatsGetCpuLoadResponder {
9826    /// Sends a response to the FIDL transaction.
9827    ///
9828    /// Sets the channel to shutdown if an error occurs.
9829    pub fn send(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
9830        let _result = self.send_raw(per_cpu_load);
9831        if _result.is_err() {
9832            self.control_handle.shutdown();
9833        }
9834        self.drop_without_shutdown();
9835        _result
9836    }
9837
9838    /// Similar to "send" but does not shutdown the channel if an error occurs.
9839    pub fn send_no_shutdown_on_err(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
9840        let _result = self.send_raw(per_cpu_load);
9841        self.drop_without_shutdown();
9842        _result
9843    }
9844
9845    fn send_raw(&self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
9846        self.control_handle.inner.send::<StatsGetCpuLoadResponse>(
9847            (per_cpu_load,),
9848            self.tx_id,
9849            0x4c8f0f05e7034666,
9850            fidl::encoding::DynamicFlags::empty(),
9851        )
9852    }
9853}
9854
9855#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9856pub struct TracingResourceMarker;
9857
9858impl fidl::endpoints::ProtocolMarker for TracingResourceMarker {
9859    type Proxy = TracingResourceProxy;
9860    type RequestStream = TracingResourceRequestStream;
9861    #[cfg(target_os = "fuchsia")]
9862    type SynchronousProxy = TracingResourceSynchronousProxy;
9863
9864    const DEBUG_NAME: &'static str = "fuchsia.kernel.TracingResource";
9865}
9866impl fidl::endpoints::DiscoverableProtocolMarker for TracingResourceMarker {}
9867
9868pub trait TracingResourceProxyInterface: Send + Sync {
9869    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
9870    fn r#get(&self) -> Self::GetResponseFut;
9871}
9872#[derive(Debug)]
9873#[cfg(target_os = "fuchsia")]
9874pub struct TracingResourceSynchronousProxy {
9875    client: fidl::client::sync::Client,
9876}
9877
9878#[cfg(target_os = "fuchsia")]
9879impl fidl::endpoints::SynchronousProxy for TracingResourceSynchronousProxy {
9880    type Proxy = TracingResourceProxy;
9881    type Protocol = TracingResourceMarker;
9882
9883    fn from_channel(inner: fidl::Channel) -> Self {
9884        Self::new(inner)
9885    }
9886
9887    fn into_channel(self) -> fidl::Channel {
9888        self.client.into_channel()
9889    }
9890
9891    fn as_channel(&self) -> &fidl::Channel {
9892        self.client.as_channel()
9893    }
9894}
9895
9896#[cfg(target_os = "fuchsia")]
9897impl TracingResourceSynchronousProxy {
9898    pub fn new(channel: fidl::Channel) -> Self {
9899        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9900        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9901    }
9902
9903    pub fn into_channel(self) -> fidl::Channel {
9904        self.client.into_channel()
9905    }
9906
9907    /// Waits until an event arrives and returns it. It is safe for other
9908    /// threads to make concurrent requests while waiting for an event.
9909    pub fn wait_for_event(
9910        &self,
9911        deadline: zx::MonotonicInstant,
9912    ) -> Result<TracingResourceEvent, fidl::Error> {
9913        TracingResourceEvent::decode(self.client.wait_for_event(deadline)?)
9914    }
9915
9916    /// Get a tracing resource handle.
9917    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
9918        let _response =
9919            self.client.send_query::<fidl::encoding::EmptyPayload, TracingResourceGetResponse>(
9920                (),
9921                0x299bc179aa54c6aa,
9922                fidl::encoding::DynamicFlags::empty(),
9923                ___deadline,
9924            )?;
9925        Ok(_response.resource)
9926    }
9927}
9928
9929#[derive(Debug, Clone)]
9930pub struct TracingResourceProxy {
9931    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9932}
9933
9934impl fidl::endpoints::Proxy for TracingResourceProxy {
9935    type Protocol = TracingResourceMarker;
9936
9937    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9938        Self::new(inner)
9939    }
9940
9941    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9942        self.client.into_channel().map_err(|client| Self { client })
9943    }
9944
9945    fn as_channel(&self) -> &::fidl::AsyncChannel {
9946        self.client.as_channel()
9947    }
9948}
9949
9950impl TracingResourceProxy {
9951    /// Create a new Proxy for fuchsia.kernel/TracingResource.
9952    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9953        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9954        Self { client: fidl::client::Client::new(channel, protocol_name) }
9955    }
9956
9957    /// Get a Stream of events from the remote end of the protocol.
9958    ///
9959    /// # Panics
9960    ///
9961    /// Panics if the event stream was already taken.
9962    pub fn take_event_stream(&self) -> TracingResourceEventStream {
9963        TracingResourceEventStream { event_receiver: self.client.take_event_receiver() }
9964    }
9965
9966    /// Get a tracing resource handle.
9967    pub fn r#get(
9968        &self,
9969    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9970    {
9971        TracingResourceProxyInterface::r#get(self)
9972    }
9973}
9974
9975impl TracingResourceProxyInterface for TracingResourceProxy {
9976    type GetResponseFut = fidl::client::QueryResponseFut<
9977        fidl::Resource,
9978        fidl::encoding::DefaultFuchsiaResourceDialect,
9979    >;
9980    fn r#get(&self) -> Self::GetResponseFut {
9981        fn _decode(
9982            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9983        ) -> Result<fidl::Resource, fidl::Error> {
9984            let _response = fidl::client::decode_transaction_body::<
9985                TracingResourceGetResponse,
9986                fidl::encoding::DefaultFuchsiaResourceDialect,
9987                0x299bc179aa54c6aa,
9988            >(_buf?)?;
9989            Ok(_response.resource)
9990        }
9991        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9992            (),
9993            0x299bc179aa54c6aa,
9994            fidl::encoding::DynamicFlags::empty(),
9995            _decode,
9996        )
9997    }
9998}
9999
10000pub struct TracingResourceEventStream {
10001    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10002}
10003
10004impl std::marker::Unpin for TracingResourceEventStream {}
10005
10006impl futures::stream::FusedStream for TracingResourceEventStream {
10007    fn is_terminated(&self) -> bool {
10008        self.event_receiver.is_terminated()
10009    }
10010}
10011
10012impl futures::Stream for TracingResourceEventStream {
10013    type Item = Result<TracingResourceEvent, fidl::Error>;
10014
10015    fn poll_next(
10016        mut self: std::pin::Pin<&mut Self>,
10017        cx: &mut std::task::Context<'_>,
10018    ) -> std::task::Poll<Option<Self::Item>> {
10019        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10020            &mut self.event_receiver,
10021            cx
10022        )?) {
10023            Some(buf) => std::task::Poll::Ready(Some(TracingResourceEvent::decode(buf))),
10024            None => std::task::Poll::Ready(None),
10025        }
10026    }
10027}
10028
10029#[derive(Debug)]
10030pub enum TracingResourceEvent {}
10031
10032impl TracingResourceEvent {
10033    /// Decodes a message buffer as a [`TracingResourceEvent`].
10034    fn decode(
10035        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10036    ) -> Result<TracingResourceEvent, fidl::Error> {
10037        let (bytes, _handles) = buf.split_mut();
10038        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10039        debug_assert_eq!(tx_header.tx_id, 0);
10040        match tx_header.ordinal {
10041            _ => Err(fidl::Error::UnknownOrdinal {
10042                ordinal: tx_header.ordinal,
10043                protocol_name:
10044                    <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10045            }),
10046        }
10047    }
10048}
10049
10050/// A Stream of incoming requests for fuchsia.kernel/TracingResource.
10051pub struct TracingResourceRequestStream {
10052    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10053    is_terminated: bool,
10054}
10055
10056impl std::marker::Unpin for TracingResourceRequestStream {}
10057
10058impl futures::stream::FusedStream for TracingResourceRequestStream {
10059    fn is_terminated(&self) -> bool {
10060        self.is_terminated
10061    }
10062}
10063
10064impl fidl::endpoints::RequestStream for TracingResourceRequestStream {
10065    type Protocol = TracingResourceMarker;
10066    type ControlHandle = TracingResourceControlHandle;
10067
10068    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10069        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10070    }
10071
10072    fn control_handle(&self) -> Self::ControlHandle {
10073        TracingResourceControlHandle { inner: self.inner.clone() }
10074    }
10075
10076    fn into_inner(
10077        self,
10078    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10079    {
10080        (self.inner, self.is_terminated)
10081    }
10082
10083    fn from_inner(
10084        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10085        is_terminated: bool,
10086    ) -> Self {
10087        Self { inner, is_terminated }
10088    }
10089}
10090
10091impl futures::Stream for TracingResourceRequestStream {
10092    type Item = Result<TracingResourceRequest, fidl::Error>;
10093
10094    fn poll_next(
10095        mut self: std::pin::Pin<&mut Self>,
10096        cx: &mut std::task::Context<'_>,
10097    ) -> std::task::Poll<Option<Self::Item>> {
10098        let this = &mut *self;
10099        if this.inner.check_shutdown(cx) {
10100            this.is_terminated = true;
10101            return std::task::Poll::Ready(None);
10102        }
10103        if this.is_terminated {
10104            panic!("polled TracingResourceRequestStream after completion");
10105        }
10106        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10107            |bytes, handles| {
10108                match this.inner.channel().read_etc(cx, bytes, handles) {
10109                    std::task::Poll::Ready(Ok(())) => {}
10110                    std::task::Poll::Pending => return std::task::Poll::Pending,
10111                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10112                        this.is_terminated = true;
10113                        return std::task::Poll::Ready(None);
10114                    }
10115                    std::task::Poll::Ready(Err(e)) => {
10116                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10117                            e.into(),
10118                        ))))
10119                    }
10120                }
10121
10122                // A message has been received from the channel
10123                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10124
10125                std::task::Poll::Ready(Some(match header.ordinal {
10126                    0x299bc179aa54c6aa => {
10127                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10128                        let mut req = fidl::new_empty!(
10129                            fidl::encoding::EmptyPayload,
10130                            fidl::encoding::DefaultFuchsiaResourceDialect
10131                        );
10132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10133                        let control_handle =
10134                            TracingResourceControlHandle { inner: this.inner.clone() };
10135                        Ok(TracingResourceRequest::Get {
10136                            responder: TracingResourceGetResponder {
10137                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10138                                tx_id: header.tx_id,
10139                            },
10140                        })
10141                    }
10142                    _ => Err(fidl::Error::UnknownOrdinal {
10143                        ordinal: header.ordinal,
10144                        protocol_name:
10145                            <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10146                    }),
10147                }))
10148            },
10149        )
10150    }
10151}
10152
10153/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
10154/// `ZX_RSRC_SYSTEM_TRACING_BASE`.
10155#[derive(Debug)]
10156pub enum TracingResourceRequest {
10157    /// Get a tracing resource handle.
10158    Get { responder: TracingResourceGetResponder },
10159}
10160
10161impl TracingResourceRequest {
10162    #[allow(irrefutable_let_patterns)]
10163    pub fn into_get(self) -> Option<(TracingResourceGetResponder)> {
10164        if let TracingResourceRequest::Get { responder } = self {
10165            Some((responder))
10166        } else {
10167            None
10168        }
10169    }
10170
10171    /// Name of the method defined in FIDL
10172    pub fn method_name(&self) -> &'static str {
10173        match *self {
10174            TracingResourceRequest::Get { .. } => "get",
10175        }
10176    }
10177}
10178
10179#[derive(Debug, Clone)]
10180pub struct TracingResourceControlHandle {
10181    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10182}
10183
10184impl fidl::endpoints::ControlHandle for TracingResourceControlHandle {
10185    fn shutdown(&self) {
10186        self.inner.shutdown()
10187    }
10188    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10189        self.inner.shutdown_with_epitaph(status)
10190    }
10191
10192    fn is_closed(&self) -> bool {
10193        self.inner.channel().is_closed()
10194    }
10195    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10196        self.inner.channel().on_closed()
10197    }
10198
10199    #[cfg(target_os = "fuchsia")]
10200    fn signal_peer(
10201        &self,
10202        clear_mask: zx::Signals,
10203        set_mask: zx::Signals,
10204    ) -> Result<(), zx_status::Status> {
10205        use fidl::Peered;
10206        self.inner.channel().signal_peer(clear_mask, set_mask)
10207    }
10208}
10209
10210impl TracingResourceControlHandle {}
10211
10212#[must_use = "FIDL methods require a response to be sent"]
10213#[derive(Debug)]
10214pub struct TracingResourceGetResponder {
10215    control_handle: std::mem::ManuallyDrop<TracingResourceControlHandle>,
10216    tx_id: u32,
10217}
10218
10219/// Set the the channel to be shutdown (see [`TracingResourceControlHandle::shutdown`])
10220/// if the responder is dropped without sending a response, so that the client
10221/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10222impl std::ops::Drop for TracingResourceGetResponder {
10223    fn drop(&mut self) {
10224        self.control_handle.shutdown();
10225        // Safety: drops once, never accessed again
10226        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10227    }
10228}
10229
10230impl fidl::endpoints::Responder for TracingResourceGetResponder {
10231    type ControlHandle = TracingResourceControlHandle;
10232
10233    fn control_handle(&self) -> &TracingResourceControlHandle {
10234        &self.control_handle
10235    }
10236
10237    fn drop_without_shutdown(mut self) {
10238        // Safety: drops once, never accessed again due to mem::forget
10239        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10240        // Prevent Drop from running (which would shut down the channel)
10241        std::mem::forget(self);
10242    }
10243}
10244
10245impl TracingResourceGetResponder {
10246    /// Sends a response to the FIDL transaction.
10247    ///
10248    /// Sets the channel to shutdown if an error occurs.
10249    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10250        let _result = self.send_raw(resource);
10251        if _result.is_err() {
10252            self.control_handle.shutdown();
10253        }
10254        self.drop_without_shutdown();
10255        _result
10256    }
10257
10258    /// Similar to "send" but does not shutdown the channel if an error occurs.
10259    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10260        let _result = self.send_raw(resource);
10261        self.drop_without_shutdown();
10262        _result
10263    }
10264
10265    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10266        self.control_handle.inner.send::<TracingResourceGetResponse>(
10267            (resource,),
10268            self.tx_id,
10269            0x299bc179aa54c6aa,
10270            fidl::encoding::DynamicFlags::empty(),
10271        )
10272    }
10273}
10274
10275#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10276pub struct VmexResourceMarker;
10277
10278impl fidl::endpoints::ProtocolMarker for VmexResourceMarker {
10279    type Proxy = VmexResourceProxy;
10280    type RequestStream = VmexResourceRequestStream;
10281    #[cfg(target_os = "fuchsia")]
10282    type SynchronousProxy = VmexResourceSynchronousProxy;
10283
10284    const DEBUG_NAME: &'static str = "fuchsia.kernel.VmexResource";
10285}
10286impl fidl::endpoints::DiscoverableProtocolMarker for VmexResourceMarker {}
10287
10288pub trait VmexResourceProxyInterface: Send + Sync {
10289    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10290    fn r#get(&self) -> Self::GetResponseFut;
10291}
10292#[derive(Debug)]
10293#[cfg(target_os = "fuchsia")]
10294pub struct VmexResourceSynchronousProxy {
10295    client: fidl::client::sync::Client,
10296}
10297
10298#[cfg(target_os = "fuchsia")]
10299impl fidl::endpoints::SynchronousProxy for VmexResourceSynchronousProxy {
10300    type Proxy = VmexResourceProxy;
10301    type Protocol = VmexResourceMarker;
10302
10303    fn from_channel(inner: fidl::Channel) -> Self {
10304        Self::new(inner)
10305    }
10306
10307    fn into_channel(self) -> fidl::Channel {
10308        self.client.into_channel()
10309    }
10310
10311    fn as_channel(&self) -> &fidl::Channel {
10312        self.client.as_channel()
10313    }
10314}
10315
10316#[cfg(target_os = "fuchsia")]
10317impl VmexResourceSynchronousProxy {
10318    pub fn new(channel: fidl::Channel) -> Self {
10319        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10320        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10321    }
10322
10323    pub fn into_channel(self) -> fidl::Channel {
10324        self.client.into_channel()
10325    }
10326
10327    /// Waits until an event arrives and returns it. It is safe for other
10328    /// threads to make concurrent requests while waiting for an event.
10329    pub fn wait_for_event(
10330        &self,
10331        deadline: zx::MonotonicInstant,
10332    ) -> Result<VmexResourceEvent, fidl::Error> {
10333        VmexResourceEvent::decode(self.client.wait_for_event(deadline)?)
10334    }
10335
10336    /// Get a VMEX resource handle.
10337    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10338        let _response =
10339            self.client.send_query::<fidl::encoding::EmptyPayload, VmexResourceGetResponse>(
10340                (),
10341                0x33db32deed650699,
10342                fidl::encoding::DynamicFlags::empty(),
10343                ___deadline,
10344            )?;
10345        Ok(_response.resource)
10346    }
10347}
10348
10349#[derive(Debug, Clone)]
10350pub struct VmexResourceProxy {
10351    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10352}
10353
10354impl fidl::endpoints::Proxy for VmexResourceProxy {
10355    type Protocol = VmexResourceMarker;
10356
10357    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10358        Self::new(inner)
10359    }
10360
10361    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10362        self.client.into_channel().map_err(|client| Self { client })
10363    }
10364
10365    fn as_channel(&self) -> &::fidl::AsyncChannel {
10366        self.client.as_channel()
10367    }
10368}
10369
10370impl VmexResourceProxy {
10371    /// Create a new Proxy for fuchsia.kernel/VmexResource.
10372    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10373        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10374        Self { client: fidl::client::Client::new(channel, protocol_name) }
10375    }
10376
10377    /// Get a Stream of events from the remote end of the protocol.
10378    ///
10379    /// # Panics
10380    ///
10381    /// Panics if the event stream was already taken.
10382    pub fn take_event_stream(&self) -> VmexResourceEventStream {
10383        VmexResourceEventStream { event_receiver: self.client.take_event_receiver() }
10384    }
10385
10386    /// Get a VMEX resource handle.
10387    pub fn r#get(
10388        &self,
10389    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10390    {
10391        VmexResourceProxyInterface::r#get(self)
10392    }
10393}
10394
10395impl VmexResourceProxyInterface for VmexResourceProxy {
10396    type GetResponseFut = fidl::client::QueryResponseFut<
10397        fidl::Resource,
10398        fidl::encoding::DefaultFuchsiaResourceDialect,
10399    >;
10400    fn r#get(&self) -> Self::GetResponseFut {
10401        fn _decode(
10402            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10403        ) -> Result<fidl::Resource, fidl::Error> {
10404            let _response = fidl::client::decode_transaction_body::<
10405                VmexResourceGetResponse,
10406                fidl::encoding::DefaultFuchsiaResourceDialect,
10407                0x33db32deed650699,
10408            >(_buf?)?;
10409            Ok(_response.resource)
10410        }
10411        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10412            (),
10413            0x33db32deed650699,
10414            fidl::encoding::DynamicFlags::empty(),
10415            _decode,
10416        )
10417    }
10418}
10419
10420pub struct VmexResourceEventStream {
10421    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10422}
10423
10424impl std::marker::Unpin for VmexResourceEventStream {}
10425
10426impl futures::stream::FusedStream for VmexResourceEventStream {
10427    fn is_terminated(&self) -> bool {
10428        self.event_receiver.is_terminated()
10429    }
10430}
10431
10432impl futures::Stream for VmexResourceEventStream {
10433    type Item = Result<VmexResourceEvent, fidl::Error>;
10434
10435    fn poll_next(
10436        mut self: std::pin::Pin<&mut Self>,
10437        cx: &mut std::task::Context<'_>,
10438    ) -> std::task::Poll<Option<Self::Item>> {
10439        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10440            &mut self.event_receiver,
10441            cx
10442        )?) {
10443            Some(buf) => std::task::Poll::Ready(Some(VmexResourceEvent::decode(buf))),
10444            None => std::task::Poll::Ready(None),
10445        }
10446    }
10447}
10448
10449#[derive(Debug)]
10450pub enum VmexResourceEvent {}
10451
10452impl VmexResourceEvent {
10453    /// Decodes a message buffer as a [`VmexResourceEvent`].
10454    fn decode(
10455        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10456    ) -> Result<VmexResourceEvent, fidl::Error> {
10457        let (bytes, _handles) = buf.split_mut();
10458        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10459        debug_assert_eq!(tx_header.tx_id, 0);
10460        match tx_header.ordinal {
10461            _ => Err(fidl::Error::UnknownOrdinal {
10462                ordinal: tx_header.ordinal,
10463                protocol_name: <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10464            }),
10465        }
10466    }
10467}
10468
10469/// A Stream of incoming requests for fuchsia.kernel/VmexResource.
10470pub struct VmexResourceRequestStream {
10471    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10472    is_terminated: bool,
10473}
10474
10475impl std::marker::Unpin for VmexResourceRequestStream {}
10476
10477impl futures::stream::FusedStream for VmexResourceRequestStream {
10478    fn is_terminated(&self) -> bool {
10479        self.is_terminated
10480    }
10481}
10482
10483impl fidl::endpoints::RequestStream for VmexResourceRequestStream {
10484    type Protocol = VmexResourceMarker;
10485    type ControlHandle = VmexResourceControlHandle;
10486
10487    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10488        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10489    }
10490
10491    fn control_handle(&self) -> Self::ControlHandle {
10492        VmexResourceControlHandle { inner: self.inner.clone() }
10493    }
10494
10495    fn into_inner(
10496        self,
10497    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10498    {
10499        (self.inner, self.is_terminated)
10500    }
10501
10502    fn from_inner(
10503        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10504        is_terminated: bool,
10505    ) -> Self {
10506        Self { inner, is_terminated }
10507    }
10508}
10509
10510impl futures::Stream for VmexResourceRequestStream {
10511    type Item = Result<VmexResourceRequest, fidl::Error>;
10512
10513    fn poll_next(
10514        mut self: std::pin::Pin<&mut Self>,
10515        cx: &mut std::task::Context<'_>,
10516    ) -> std::task::Poll<Option<Self::Item>> {
10517        let this = &mut *self;
10518        if this.inner.check_shutdown(cx) {
10519            this.is_terminated = true;
10520            return std::task::Poll::Ready(None);
10521        }
10522        if this.is_terminated {
10523            panic!("polled VmexResourceRequestStream after completion");
10524        }
10525        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10526            |bytes, handles| {
10527                match this.inner.channel().read_etc(cx, bytes, handles) {
10528                    std::task::Poll::Ready(Ok(())) => {}
10529                    std::task::Poll::Pending => return std::task::Poll::Pending,
10530                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10531                        this.is_terminated = true;
10532                        return std::task::Poll::Ready(None);
10533                    }
10534                    std::task::Poll::Ready(Err(e)) => {
10535                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10536                            e.into(),
10537                        ))))
10538                    }
10539                }
10540
10541                // A message has been received from the channel
10542                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10543
10544                std::task::Poll::Ready(Some(match header.ordinal {
10545                    0x33db32deed650699 => {
10546                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10547                        let mut req = fidl::new_empty!(
10548                            fidl::encoding::EmptyPayload,
10549                            fidl::encoding::DefaultFuchsiaResourceDialect
10550                        );
10551                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10552                        let control_handle =
10553                            VmexResourceControlHandle { inner: this.inner.clone() };
10554                        Ok(VmexResourceRequest::Get {
10555                            responder: VmexResourceGetResponder {
10556                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10557                                tx_id: header.tx_id,
10558                            },
10559                        })
10560                    }
10561                    _ => Err(fidl::Error::UnknownOrdinal {
10562                        ordinal: header.ordinal,
10563                        protocol_name:
10564                            <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10565                    }),
10566                }))
10567            },
10568        )
10569    }
10570}
10571
10572/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
10573/// `ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
10574/// executable.
10575#[derive(Debug)]
10576pub enum VmexResourceRequest {
10577    /// Get a VMEX resource handle.
10578    Get { responder: VmexResourceGetResponder },
10579}
10580
10581impl VmexResourceRequest {
10582    #[allow(irrefutable_let_patterns)]
10583    pub fn into_get(self) -> Option<(VmexResourceGetResponder)> {
10584        if let VmexResourceRequest::Get { responder } = self {
10585            Some((responder))
10586        } else {
10587            None
10588        }
10589    }
10590
10591    /// Name of the method defined in FIDL
10592    pub fn method_name(&self) -> &'static str {
10593        match *self {
10594            VmexResourceRequest::Get { .. } => "get",
10595        }
10596    }
10597}
10598
10599#[derive(Debug, Clone)]
10600pub struct VmexResourceControlHandle {
10601    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10602}
10603
10604impl fidl::endpoints::ControlHandle for VmexResourceControlHandle {
10605    fn shutdown(&self) {
10606        self.inner.shutdown()
10607    }
10608    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10609        self.inner.shutdown_with_epitaph(status)
10610    }
10611
10612    fn is_closed(&self) -> bool {
10613        self.inner.channel().is_closed()
10614    }
10615    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10616        self.inner.channel().on_closed()
10617    }
10618
10619    #[cfg(target_os = "fuchsia")]
10620    fn signal_peer(
10621        &self,
10622        clear_mask: zx::Signals,
10623        set_mask: zx::Signals,
10624    ) -> Result<(), zx_status::Status> {
10625        use fidl::Peered;
10626        self.inner.channel().signal_peer(clear_mask, set_mask)
10627    }
10628}
10629
10630impl VmexResourceControlHandle {}
10631
10632#[must_use = "FIDL methods require a response to be sent"]
10633#[derive(Debug)]
10634pub struct VmexResourceGetResponder {
10635    control_handle: std::mem::ManuallyDrop<VmexResourceControlHandle>,
10636    tx_id: u32,
10637}
10638
10639/// Set the the channel to be shutdown (see [`VmexResourceControlHandle::shutdown`])
10640/// if the responder is dropped without sending a response, so that the client
10641/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10642impl std::ops::Drop for VmexResourceGetResponder {
10643    fn drop(&mut self) {
10644        self.control_handle.shutdown();
10645        // Safety: drops once, never accessed again
10646        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10647    }
10648}
10649
10650impl fidl::endpoints::Responder for VmexResourceGetResponder {
10651    type ControlHandle = VmexResourceControlHandle;
10652
10653    fn control_handle(&self) -> &VmexResourceControlHandle {
10654        &self.control_handle
10655    }
10656
10657    fn drop_without_shutdown(mut self) {
10658        // Safety: drops once, never accessed again due to mem::forget
10659        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10660        // Prevent Drop from running (which would shut down the channel)
10661        std::mem::forget(self);
10662    }
10663}
10664
10665impl VmexResourceGetResponder {
10666    /// Sends a response to the FIDL transaction.
10667    ///
10668    /// Sets the channel to shutdown if an error occurs.
10669    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10670        let _result = self.send_raw(resource);
10671        if _result.is_err() {
10672            self.control_handle.shutdown();
10673        }
10674        self.drop_without_shutdown();
10675        _result
10676    }
10677
10678    /// Similar to "send" but does not shutdown the channel if an error occurs.
10679    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10680        let _result = self.send_raw(resource);
10681        self.drop_without_shutdown();
10682        _result
10683    }
10684
10685    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10686        self.control_handle.inner.send::<VmexResourceGetResponse>(
10687            (resource,),
10688            self.tx_id,
10689            0x33db32deed650699,
10690            fidl::encoding::DynamicFlags::empty(),
10691        )
10692    }
10693}
10694
10695mod internal {
10696    use super::*;
10697
10698    impl fidl::encoding::ResourceTypeMarker for CounterGetInspectVmoResponse {
10699        type Borrowed<'a> = &'a mut Self;
10700        fn take_or_borrow<'a>(
10701            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10702        ) -> Self::Borrowed<'a> {
10703            value
10704        }
10705    }
10706
10707    unsafe impl fidl::encoding::TypeMarker for CounterGetInspectVmoResponse {
10708        type Owned = Self;
10709
10710        #[inline(always)]
10711        fn inline_align(_context: fidl::encoding::Context) -> usize {
10712            8
10713        }
10714
10715        #[inline(always)]
10716        fn inline_size(_context: fidl::encoding::Context) -> usize {
10717            24
10718        }
10719    }
10720
10721    unsafe impl
10722        fidl::encoding::Encode<
10723            CounterGetInspectVmoResponse,
10724            fidl::encoding::DefaultFuchsiaResourceDialect,
10725        > for &mut CounterGetInspectVmoResponse
10726    {
10727        #[inline]
10728        unsafe fn encode(
10729            self,
10730            encoder: &mut fidl::encoding::Encoder<
10731                '_,
10732                fidl::encoding::DefaultFuchsiaResourceDialect,
10733            >,
10734            offset: usize,
10735            _depth: fidl::encoding::Depth,
10736        ) -> fidl::Result<()> {
10737            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
10738            // Delegate to tuple encoding.
10739            fidl::encoding::Encode::<CounterGetInspectVmoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10740                (
10741                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
10742                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
10743                ),
10744                encoder, offset, _depth
10745            )
10746        }
10747    }
10748    unsafe impl<
10749            T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
10750            T1: fidl::encoding::Encode<
10751                fidl_fuchsia_mem::Buffer,
10752                fidl::encoding::DefaultFuchsiaResourceDialect,
10753            >,
10754        >
10755        fidl::encoding::Encode<
10756            CounterGetInspectVmoResponse,
10757            fidl::encoding::DefaultFuchsiaResourceDialect,
10758        > for (T0, T1)
10759    {
10760        #[inline]
10761        unsafe fn encode(
10762            self,
10763            encoder: &mut fidl::encoding::Encoder<
10764                '_,
10765                fidl::encoding::DefaultFuchsiaResourceDialect,
10766            >,
10767            offset: usize,
10768            depth: fidl::encoding::Depth,
10769        ) -> fidl::Result<()> {
10770            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
10771            // Zero out padding regions. There's no need to apply masks
10772            // because the unmasked parts will be overwritten by fields.
10773            unsafe {
10774                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10775                (ptr as *mut u64).write_unaligned(0);
10776            }
10777            // Write the fields.
10778            self.0.encode(encoder, offset + 0, depth)?;
10779            self.1.encode(encoder, offset + 8, depth)?;
10780            Ok(())
10781        }
10782    }
10783
10784    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10785        for CounterGetInspectVmoResponse
10786    {
10787        #[inline(always)]
10788        fn new_empty() -> Self {
10789            Self {
10790                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
10791                buffer: fidl::new_empty!(
10792                    fidl_fuchsia_mem::Buffer,
10793                    fidl::encoding::DefaultFuchsiaResourceDialect
10794                ),
10795            }
10796        }
10797
10798        #[inline]
10799        unsafe fn decode(
10800            &mut self,
10801            decoder: &mut fidl::encoding::Decoder<
10802                '_,
10803                fidl::encoding::DefaultFuchsiaResourceDialect,
10804            >,
10805            offset: usize,
10806            _depth: fidl::encoding::Depth,
10807        ) -> fidl::Result<()> {
10808            decoder.debug_check_bounds::<Self>(offset);
10809            // Verify that padding bytes are zero.
10810            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10811            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10812            let mask = 0xffffffff00000000u64;
10813            let maskedval = padval & mask;
10814            if maskedval != 0 {
10815                return Err(fidl::Error::NonZeroPadding {
10816                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10817                });
10818            }
10819            fidl::decode!(
10820                i32,
10821                fidl::encoding::DefaultFuchsiaResourceDialect,
10822                &mut self.status,
10823                decoder,
10824                offset + 0,
10825                _depth
10826            )?;
10827            fidl::decode!(
10828                fidl_fuchsia_mem::Buffer,
10829                fidl::encoding::DefaultFuchsiaResourceDialect,
10830                &mut self.buffer,
10831                decoder,
10832                offset + 8,
10833                _depth
10834            )?;
10835            Ok(())
10836        }
10837    }
10838
10839    impl fidl::encoding::ResourceTypeMarker for CpuResourceGetResponse {
10840        type Borrowed<'a> = &'a mut Self;
10841        fn take_or_borrow<'a>(
10842            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10843        ) -> Self::Borrowed<'a> {
10844            value
10845        }
10846    }
10847
10848    unsafe impl fidl::encoding::TypeMarker for CpuResourceGetResponse {
10849        type Owned = Self;
10850
10851        #[inline(always)]
10852        fn inline_align(_context: fidl::encoding::Context) -> usize {
10853            4
10854        }
10855
10856        #[inline(always)]
10857        fn inline_size(_context: fidl::encoding::Context) -> usize {
10858            4
10859        }
10860    }
10861
10862    unsafe impl
10863        fidl::encoding::Encode<
10864            CpuResourceGetResponse,
10865            fidl::encoding::DefaultFuchsiaResourceDialect,
10866        > for &mut CpuResourceGetResponse
10867    {
10868        #[inline]
10869        unsafe fn encode(
10870            self,
10871            encoder: &mut fidl::encoding::Encoder<
10872                '_,
10873                fidl::encoding::DefaultFuchsiaResourceDialect,
10874            >,
10875            offset: usize,
10876            _depth: fidl::encoding::Depth,
10877        ) -> fidl::Result<()> {
10878            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
10879            // Delegate to tuple encoding.
10880            fidl::encoding::Encode::<
10881                CpuResourceGetResponse,
10882                fidl::encoding::DefaultFuchsiaResourceDialect,
10883            >::encode(
10884                (<fidl::encoding::HandleType<
10885                    fidl::Resource,
10886                    { fidl::ObjectType::RESOURCE.into_raw() },
10887                    2147483648,
10888                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10889                    &mut self.resource
10890                ),),
10891                encoder,
10892                offset,
10893                _depth,
10894            )
10895        }
10896    }
10897    unsafe impl<
10898            T0: fidl::encoding::Encode<
10899                fidl::encoding::HandleType<
10900                    fidl::Resource,
10901                    { fidl::ObjectType::RESOURCE.into_raw() },
10902                    2147483648,
10903                >,
10904                fidl::encoding::DefaultFuchsiaResourceDialect,
10905            >,
10906        >
10907        fidl::encoding::Encode<
10908            CpuResourceGetResponse,
10909            fidl::encoding::DefaultFuchsiaResourceDialect,
10910        > for (T0,)
10911    {
10912        #[inline]
10913        unsafe fn encode(
10914            self,
10915            encoder: &mut fidl::encoding::Encoder<
10916                '_,
10917                fidl::encoding::DefaultFuchsiaResourceDialect,
10918            >,
10919            offset: usize,
10920            depth: fidl::encoding::Depth,
10921        ) -> fidl::Result<()> {
10922            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
10923            // Zero out padding regions. There's no need to apply masks
10924            // because the unmasked parts will be overwritten by fields.
10925            // Write the fields.
10926            self.0.encode(encoder, offset + 0, depth)?;
10927            Ok(())
10928        }
10929    }
10930
10931    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10932        for CpuResourceGetResponse
10933    {
10934        #[inline(always)]
10935        fn new_empty() -> Self {
10936            Self {
10937                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10938            }
10939        }
10940
10941        #[inline]
10942        unsafe fn decode(
10943            &mut self,
10944            decoder: &mut fidl::encoding::Decoder<
10945                '_,
10946                fidl::encoding::DefaultFuchsiaResourceDialect,
10947            >,
10948            offset: usize,
10949            _depth: fidl::encoding::Depth,
10950        ) -> fidl::Result<()> {
10951            decoder.debug_check_bounds::<Self>(offset);
10952            // Verify that padding bytes are zero.
10953            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
10954            Ok(())
10955        }
10956    }
10957
10958    impl fidl::encoding::ResourceTypeMarker for DebugResourceGetResponse {
10959        type Borrowed<'a> = &'a mut Self;
10960        fn take_or_borrow<'a>(
10961            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10962        ) -> Self::Borrowed<'a> {
10963            value
10964        }
10965    }
10966
10967    unsafe impl fidl::encoding::TypeMarker for DebugResourceGetResponse {
10968        type Owned = Self;
10969
10970        #[inline(always)]
10971        fn inline_align(_context: fidl::encoding::Context) -> usize {
10972            4
10973        }
10974
10975        #[inline(always)]
10976        fn inline_size(_context: fidl::encoding::Context) -> usize {
10977            4
10978        }
10979    }
10980
10981    unsafe impl
10982        fidl::encoding::Encode<
10983            DebugResourceGetResponse,
10984            fidl::encoding::DefaultFuchsiaResourceDialect,
10985        > for &mut DebugResourceGetResponse
10986    {
10987        #[inline]
10988        unsafe fn encode(
10989            self,
10990            encoder: &mut fidl::encoding::Encoder<
10991                '_,
10992                fidl::encoding::DefaultFuchsiaResourceDialect,
10993            >,
10994            offset: usize,
10995            _depth: fidl::encoding::Depth,
10996        ) -> fidl::Result<()> {
10997            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
10998            // Delegate to tuple encoding.
10999            fidl::encoding::Encode::<
11000                DebugResourceGetResponse,
11001                fidl::encoding::DefaultFuchsiaResourceDialect,
11002            >::encode(
11003                (<fidl::encoding::HandleType<
11004                    fidl::Resource,
11005                    { fidl::ObjectType::RESOURCE.into_raw() },
11006                    2147483648,
11007                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11008                    &mut self.resource
11009                ),),
11010                encoder,
11011                offset,
11012                _depth,
11013            )
11014        }
11015    }
11016    unsafe impl<
11017            T0: fidl::encoding::Encode<
11018                fidl::encoding::HandleType<
11019                    fidl::Resource,
11020                    { fidl::ObjectType::RESOURCE.into_raw() },
11021                    2147483648,
11022                >,
11023                fidl::encoding::DefaultFuchsiaResourceDialect,
11024            >,
11025        >
11026        fidl::encoding::Encode<
11027            DebugResourceGetResponse,
11028            fidl::encoding::DefaultFuchsiaResourceDialect,
11029        > for (T0,)
11030    {
11031        #[inline]
11032        unsafe fn encode(
11033            self,
11034            encoder: &mut fidl::encoding::Encoder<
11035                '_,
11036                fidl::encoding::DefaultFuchsiaResourceDialect,
11037            >,
11038            offset: usize,
11039            depth: fidl::encoding::Depth,
11040        ) -> fidl::Result<()> {
11041            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11042            // Zero out padding regions. There's no need to apply masks
11043            // because the unmasked parts will be overwritten by fields.
11044            // Write the fields.
11045            self.0.encode(encoder, offset + 0, depth)?;
11046            Ok(())
11047        }
11048    }
11049
11050    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11051        for DebugResourceGetResponse
11052    {
11053        #[inline(always)]
11054        fn new_empty() -> Self {
11055            Self {
11056                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11057            }
11058        }
11059
11060        #[inline]
11061        unsafe fn decode(
11062            &mut self,
11063            decoder: &mut fidl::encoding::Decoder<
11064                '_,
11065                fidl::encoding::DefaultFuchsiaResourceDialect,
11066            >,
11067            offset: usize,
11068            _depth: fidl::encoding::Depth,
11069        ) -> fidl::Result<()> {
11070            decoder.debug_check_bounds::<Self>(offset);
11071            // Verify that padding bytes are zero.
11072            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11073            Ok(())
11074        }
11075    }
11076
11077    impl fidl::encoding::ResourceTypeMarker for DebuglogResourceGetResponse {
11078        type Borrowed<'a> = &'a mut Self;
11079        fn take_or_borrow<'a>(
11080            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11081        ) -> Self::Borrowed<'a> {
11082            value
11083        }
11084    }
11085
11086    unsafe impl fidl::encoding::TypeMarker for DebuglogResourceGetResponse {
11087        type Owned = Self;
11088
11089        #[inline(always)]
11090        fn inline_align(_context: fidl::encoding::Context) -> usize {
11091            4
11092        }
11093
11094        #[inline(always)]
11095        fn inline_size(_context: fidl::encoding::Context) -> usize {
11096            4
11097        }
11098    }
11099
11100    unsafe impl
11101        fidl::encoding::Encode<
11102            DebuglogResourceGetResponse,
11103            fidl::encoding::DefaultFuchsiaResourceDialect,
11104        > for &mut DebuglogResourceGetResponse
11105    {
11106        #[inline]
11107        unsafe fn encode(
11108            self,
11109            encoder: &mut fidl::encoding::Encoder<
11110                '_,
11111                fidl::encoding::DefaultFuchsiaResourceDialect,
11112            >,
11113            offset: usize,
11114            _depth: fidl::encoding::Depth,
11115        ) -> fidl::Result<()> {
11116            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
11117            // Delegate to tuple encoding.
11118            fidl::encoding::Encode::<
11119                DebuglogResourceGetResponse,
11120                fidl::encoding::DefaultFuchsiaResourceDialect,
11121            >::encode(
11122                (<fidl::encoding::HandleType<
11123                    fidl::Resource,
11124                    { fidl::ObjectType::RESOURCE.into_raw() },
11125                    2147483648,
11126                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11127                    &mut self.resource
11128                ),),
11129                encoder,
11130                offset,
11131                _depth,
11132            )
11133        }
11134    }
11135    unsafe impl<
11136            T0: fidl::encoding::Encode<
11137                fidl::encoding::HandleType<
11138                    fidl::Resource,
11139                    { fidl::ObjectType::RESOURCE.into_raw() },
11140                    2147483648,
11141                >,
11142                fidl::encoding::DefaultFuchsiaResourceDialect,
11143            >,
11144        >
11145        fidl::encoding::Encode<
11146            DebuglogResourceGetResponse,
11147            fidl::encoding::DefaultFuchsiaResourceDialect,
11148        > for (T0,)
11149    {
11150        #[inline]
11151        unsafe fn encode(
11152            self,
11153            encoder: &mut fidl::encoding::Encoder<
11154                '_,
11155                fidl::encoding::DefaultFuchsiaResourceDialect,
11156            >,
11157            offset: usize,
11158            depth: fidl::encoding::Depth,
11159        ) -> fidl::Result<()> {
11160            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
11161            // Zero out padding regions. There's no need to apply masks
11162            // because the unmasked parts will be overwritten by fields.
11163            // Write the fields.
11164            self.0.encode(encoder, offset + 0, depth)?;
11165            Ok(())
11166        }
11167    }
11168
11169    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11170        for DebuglogResourceGetResponse
11171    {
11172        #[inline(always)]
11173        fn new_empty() -> Self {
11174            Self {
11175                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11176            }
11177        }
11178
11179        #[inline]
11180        unsafe fn decode(
11181            &mut self,
11182            decoder: &mut fidl::encoding::Decoder<
11183                '_,
11184                fidl::encoding::DefaultFuchsiaResourceDialect,
11185            >,
11186            offset: usize,
11187            _depth: fidl::encoding::Depth,
11188        ) -> fidl::Result<()> {
11189            decoder.debug_check_bounds::<Self>(offset);
11190            // Verify that padding bytes are zero.
11191            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11192            Ok(())
11193        }
11194    }
11195
11196    impl fidl::encoding::ResourceTypeMarker for EnergyInfoResourceGetResponse {
11197        type Borrowed<'a> = &'a mut Self;
11198        fn take_or_borrow<'a>(
11199            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11200        ) -> Self::Borrowed<'a> {
11201            value
11202        }
11203    }
11204
11205    unsafe impl fidl::encoding::TypeMarker for EnergyInfoResourceGetResponse {
11206        type Owned = Self;
11207
11208        #[inline(always)]
11209        fn inline_align(_context: fidl::encoding::Context) -> usize {
11210            4
11211        }
11212
11213        #[inline(always)]
11214        fn inline_size(_context: fidl::encoding::Context) -> usize {
11215            4
11216        }
11217    }
11218
11219    unsafe impl
11220        fidl::encoding::Encode<
11221            EnergyInfoResourceGetResponse,
11222            fidl::encoding::DefaultFuchsiaResourceDialect,
11223        > for &mut EnergyInfoResourceGetResponse
11224    {
11225        #[inline]
11226        unsafe fn encode(
11227            self,
11228            encoder: &mut fidl::encoding::Encoder<
11229                '_,
11230                fidl::encoding::DefaultFuchsiaResourceDialect,
11231            >,
11232            offset: usize,
11233            _depth: fidl::encoding::Depth,
11234        ) -> fidl::Result<()> {
11235            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
11236            // Delegate to tuple encoding.
11237            fidl::encoding::Encode::<
11238                EnergyInfoResourceGetResponse,
11239                fidl::encoding::DefaultFuchsiaResourceDialect,
11240            >::encode(
11241                (<fidl::encoding::HandleType<
11242                    fidl::Resource,
11243                    { fidl::ObjectType::RESOURCE.into_raw() },
11244                    2147483648,
11245                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11246                    &mut self.resource
11247                ),),
11248                encoder,
11249                offset,
11250                _depth,
11251            )
11252        }
11253    }
11254    unsafe impl<
11255            T0: fidl::encoding::Encode<
11256                fidl::encoding::HandleType<
11257                    fidl::Resource,
11258                    { fidl::ObjectType::RESOURCE.into_raw() },
11259                    2147483648,
11260                >,
11261                fidl::encoding::DefaultFuchsiaResourceDialect,
11262            >,
11263        >
11264        fidl::encoding::Encode<
11265            EnergyInfoResourceGetResponse,
11266            fidl::encoding::DefaultFuchsiaResourceDialect,
11267        > for (T0,)
11268    {
11269        #[inline]
11270        unsafe fn encode(
11271            self,
11272            encoder: &mut fidl::encoding::Encoder<
11273                '_,
11274                fidl::encoding::DefaultFuchsiaResourceDialect,
11275            >,
11276            offset: usize,
11277            depth: fidl::encoding::Depth,
11278        ) -> fidl::Result<()> {
11279            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
11280            // Zero out padding regions. There's no need to apply masks
11281            // because the unmasked parts will be overwritten by fields.
11282            // Write the fields.
11283            self.0.encode(encoder, offset + 0, depth)?;
11284            Ok(())
11285        }
11286    }
11287
11288    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11289        for EnergyInfoResourceGetResponse
11290    {
11291        #[inline(always)]
11292        fn new_empty() -> Self {
11293            Self {
11294                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11295            }
11296        }
11297
11298        #[inline]
11299        unsafe fn decode(
11300            &mut self,
11301            decoder: &mut fidl::encoding::Decoder<
11302                '_,
11303                fidl::encoding::DefaultFuchsiaResourceDialect,
11304            >,
11305            offset: usize,
11306            _depth: fidl::encoding::Depth,
11307        ) -> fidl::Result<()> {
11308            decoder.debug_check_bounds::<Self>(offset);
11309            // Verify that padding bytes are zero.
11310            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11311            Ok(())
11312        }
11313    }
11314
11315    impl fidl::encoding::ResourceTypeMarker for HypervisorResourceGetResponse {
11316        type Borrowed<'a> = &'a mut Self;
11317        fn take_or_borrow<'a>(
11318            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11319        ) -> Self::Borrowed<'a> {
11320            value
11321        }
11322    }
11323
11324    unsafe impl fidl::encoding::TypeMarker for HypervisorResourceGetResponse {
11325        type Owned = Self;
11326
11327        #[inline(always)]
11328        fn inline_align(_context: fidl::encoding::Context) -> usize {
11329            4
11330        }
11331
11332        #[inline(always)]
11333        fn inline_size(_context: fidl::encoding::Context) -> usize {
11334            4
11335        }
11336    }
11337
11338    unsafe impl
11339        fidl::encoding::Encode<
11340            HypervisorResourceGetResponse,
11341            fidl::encoding::DefaultFuchsiaResourceDialect,
11342        > for &mut HypervisorResourceGetResponse
11343    {
11344        #[inline]
11345        unsafe fn encode(
11346            self,
11347            encoder: &mut fidl::encoding::Encoder<
11348                '_,
11349                fidl::encoding::DefaultFuchsiaResourceDialect,
11350            >,
11351            offset: usize,
11352            _depth: fidl::encoding::Depth,
11353        ) -> fidl::Result<()> {
11354            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
11355            // Delegate to tuple encoding.
11356            fidl::encoding::Encode::<
11357                HypervisorResourceGetResponse,
11358                fidl::encoding::DefaultFuchsiaResourceDialect,
11359            >::encode(
11360                (<fidl::encoding::HandleType<
11361                    fidl::Resource,
11362                    { fidl::ObjectType::RESOURCE.into_raw() },
11363                    2147483648,
11364                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11365                    &mut self.resource
11366                ),),
11367                encoder,
11368                offset,
11369                _depth,
11370            )
11371        }
11372    }
11373    unsafe impl<
11374            T0: fidl::encoding::Encode<
11375                fidl::encoding::HandleType<
11376                    fidl::Resource,
11377                    { fidl::ObjectType::RESOURCE.into_raw() },
11378                    2147483648,
11379                >,
11380                fidl::encoding::DefaultFuchsiaResourceDialect,
11381            >,
11382        >
11383        fidl::encoding::Encode<
11384            HypervisorResourceGetResponse,
11385            fidl::encoding::DefaultFuchsiaResourceDialect,
11386        > for (T0,)
11387    {
11388        #[inline]
11389        unsafe fn encode(
11390            self,
11391            encoder: &mut fidl::encoding::Encoder<
11392                '_,
11393                fidl::encoding::DefaultFuchsiaResourceDialect,
11394            >,
11395            offset: usize,
11396            depth: fidl::encoding::Depth,
11397        ) -> fidl::Result<()> {
11398            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
11399            // Zero out padding regions. There's no need to apply masks
11400            // because the unmasked parts will be overwritten by fields.
11401            // Write the fields.
11402            self.0.encode(encoder, offset + 0, depth)?;
11403            Ok(())
11404        }
11405    }
11406
11407    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11408        for HypervisorResourceGetResponse
11409    {
11410        #[inline(always)]
11411        fn new_empty() -> Self {
11412            Self {
11413                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11414            }
11415        }
11416
11417        #[inline]
11418        unsafe fn decode(
11419            &mut self,
11420            decoder: &mut fidl::encoding::Decoder<
11421                '_,
11422                fidl::encoding::DefaultFuchsiaResourceDialect,
11423            >,
11424            offset: usize,
11425            _depth: fidl::encoding::Depth,
11426        ) -> fidl::Result<()> {
11427            decoder.debug_check_bounds::<Self>(offset);
11428            // Verify that padding bytes are zero.
11429            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11430            Ok(())
11431        }
11432    }
11433
11434    impl fidl::encoding::ResourceTypeMarker for InfoResourceGetResponse {
11435        type Borrowed<'a> = &'a mut Self;
11436        fn take_or_borrow<'a>(
11437            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11438        ) -> Self::Borrowed<'a> {
11439            value
11440        }
11441    }
11442
11443    unsafe impl fidl::encoding::TypeMarker for InfoResourceGetResponse {
11444        type Owned = Self;
11445
11446        #[inline(always)]
11447        fn inline_align(_context: fidl::encoding::Context) -> usize {
11448            4
11449        }
11450
11451        #[inline(always)]
11452        fn inline_size(_context: fidl::encoding::Context) -> usize {
11453            4
11454        }
11455    }
11456
11457    unsafe impl
11458        fidl::encoding::Encode<
11459            InfoResourceGetResponse,
11460            fidl::encoding::DefaultFuchsiaResourceDialect,
11461        > for &mut InfoResourceGetResponse
11462    {
11463        #[inline]
11464        unsafe fn encode(
11465            self,
11466            encoder: &mut fidl::encoding::Encoder<
11467                '_,
11468                fidl::encoding::DefaultFuchsiaResourceDialect,
11469            >,
11470            offset: usize,
11471            _depth: fidl::encoding::Depth,
11472        ) -> fidl::Result<()> {
11473            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
11474            // Delegate to tuple encoding.
11475            fidl::encoding::Encode::<
11476                InfoResourceGetResponse,
11477                fidl::encoding::DefaultFuchsiaResourceDialect,
11478            >::encode(
11479                (<fidl::encoding::HandleType<
11480                    fidl::Resource,
11481                    { fidl::ObjectType::RESOURCE.into_raw() },
11482                    2147483648,
11483                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11484                    &mut self.resource
11485                ),),
11486                encoder,
11487                offset,
11488                _depth,
11489            )
11490        }
11491    }
11492    unsafe impl<
11493            T0: fidl::encoding::Encode<
11494                fidl::encoding::HandleType<
11495                    fidl::Resource,
11496                    { fidl::ObjectType::RESOURCE.into_raw() },
11497                    2147483648,
11498                >,
11499                fidl::encoding::DefaultFuchsiaResourceDialect,
11500            >,
11501        >
11502        fidl::encoding::Encode<
11503            InfoResourceGetResponse,
11504            fidl::encoding::DefaultFuchsiaResourceDialect,
11505        > for (T0,)
11506    {
11507        #[inline]
11508        unsafe fn encode(
11509            self,
11510            encoder: &mut fidl::encoding::Encoder<
11511                '_,
11512                fidl::encoding::DefaultFuchsiaResourceDialect,
11513            >,
11514            offset: usize,
11515            depth: fidl::encoding::Depth,
11516        ) -> fidl::Result<()> {
11517            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
11518            // Zero out padding regions. There's no need to apply masks
11519            // because the unmasked parts will be overwritten by fields.
11520            // Write the fields.
11521            self.0.encode(encoder, offset + 0, depth)?;
11522            Ok(())
11523        }
11524    }
11525
11526    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11527        for InfoResourceGetResponse
11528    {
11529        #[inline(always)]
11530        fn new_empty() -> Self {
11531            Self {
11532                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11533            }
11534        }
11535
11536        #[inline]
11537        unsafe fn decode(
11538            &mut self,
11539            decoder: &mut fidl::encoding::Decoder<
11540                '_,
11541                fidl::encoding::DefaultFuchsiaResourceDialect,
11542            >,
11543            offset: usize,
11544            _depth: fidl::encoding::Depth,
11545        ) -> fidl::Result<()> {
11546            decoder.debug_check_bounds::<Self>(offset);
11547            // Verify that padding bytes are zero.
11548            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11549            Ok(())
11550        }
11551    }
11552
11553    impl fidl::encoding::ResourceTypeMarker for IommuResourceGetResponse {
11554        type Borrowed<'a> = &'a mut Self;
11555        fn take_or_borrow<'a>(
11556            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11557        ) -> Self::Borrowed<'a> {
11558            value
11559        }
11560    }
11561
11562    unsafe impl fidl::encoding::TypeMarker for IommuResourceGetResponse {
11563        type Owned = Self;
11564
11565        #[inline(always)]
11566        fn inline_align(_context: fidl::encoding::Context) -> usize {
11567            4
11568        }
11569
11570        #[inline(always)]
11571        fn inline_size(_context: fidl::encoding::Context) -> usize {
11572            4
11573        }
11574    }
11575
11576    unsafe impl
11577        fidl::encoding::Encode<
11578            IommuResourceGetResponse,
11579            fidl::encoding::DefaultFuchsiaResourceDialect,
11580        > for &mut IommuResourceGetResponse
11581    {
11582        #[inline]
11583        unsafe fn encode(
11584            self,
11585            encoder: &mut fidl::encoding::Encoder<
11586                '_,
11587                fidl::encoding::DefaultFuchsiaResourceDialect,
11588            >,
11589            offset: usize,
11590            _depth: fidl::encoding::Depth,
11591        ) -> fidl::Result<()> {
11592            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
11593            // Delegate to tuple encoding.
11594            fidl::encoding::Encode::<
11595                IommuResourceGetResponse,
11596                fidl::encoding::DefaultFuchsiaResourceDialect,
11597            >::encode(
11598                (<fidl::encoding::HandleType<
11599                    fidl::Resource,
11600                    { fidl::ObjectType::RESOURCE.into_raw() },
11601                    2147483648,
11602                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11603                    &mut self.resource
11604                ),),
11605                encoder,
11606                offset,
11607                _depth,
11608            )
11609        }
11610    }
11611    unsafe impl<
11612            T0: fidl::encoding::Encode<
11613                fidl::encoding::HandleType<
11614                    fidl::Resource,
11615                    { fidl::ObjectType::RESOURCE.into_raw() },
11616                    2147483648,
11617                >,
11618                fidl::encoding::DefaultFuchsiaResourceDialect,
11619            >,
11620        >
11621        fidl::encoding::Encode<
11622            IommuResourceGetResponse,
11623            fidl::encoding::DefaultFuchsiaResourceDialect,
11624        > for (T0,)
11625    {
11626        #[inline]
11627        unsafe fn encode(
11628            self,
11629            encoder: &mut fidl::encoding::Encoder<
11630                '_,
11631                fidl::encoding::DefaultFuchsiaResourceDialect,
11632            >,
11633            offset: usize,
11634            depth: fidl::encoding::Depth,
11635        ) -> fidl::Result<()> {
11636            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
11637            // Zero out padding regions. There's no need to apply masks
11638            // because the unmasked parts will be overwritten by fields.
11639            // Write the fields.
11640            self.0.encode(encoder, offset + 0, depth)?;
11641            Ok(())
11642        }
11643    }
11644
11645    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11646        for IommuResourceGetResponse
11647    {
11648        #[inline(always)]
11649        fn new_empty() -> Self {
11650            Self {
11651                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11652            }
11653        }
11654
11655        #[inline]
11656        unsafe fn decode(
11657            &mut self,
11658            decoder: &mut fidl::encoding::Decoder<
11659                '_,
11660                fidl::encoding::DefaultFuchsiaResourceDialect,
11661            >,
11662            offset: usize,
11663            _depth: fidl::encoding::Depth,
11664        ) -> fidl::Result<()> {
11665            decoder.debug_check_bounds::<Self>(offset);
11666            // Verify that padding bytes are zero.
11667            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11668            Ok(())
11669        }
11670    }
11671
11672    impl fidl::encoding::ResourceTypeMarker for IoportResourceGetResponse {
11673        type Borrowed<'a> = &'a mut Self;
11674        fn take_or_borrow<'a>(
11675            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11676        ) -> Self::Borrowed<'a> {
11677            value
11678        }
11679    }
11680
11681    unsafe impl fidl::encoding::TypeMarker for IoportResourceGetResponse {
11682        type Owned = Self;
11683
11684        #[inline(always)]
11685        fn inline_align(_context: fidl::encoding::Context) -> usize {
11686            4
11687        }
11688
11689        #[inline(always)]
11690        fn inline_size(_context: fidl::encoding::Context) -> usize {
11691            4
11692        }
11693    }
11694
11695    unsafe impl
11696        fidl::encoding::Encode<
11697            IoportResourceGetResponse,
11698            fidl::encoding::DefaultFuchsiaResourceDialect,
11699        > for &mut IoportResourceGetResponse
11700    {
11701        #[inline]
11702        unsafe fn encode(
11703            self,
11704            encoder: &mut fidl::encoding::Encoder<
11705                '_,
11706                fidl::encoding::DefaultFuchsiaResourceDialect,
11707            >,
11708            offset: usize,
11709            _depth: fidl::encoding::Depth,
11710        ) -> fidl::Result<()> {
11711            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
11712            // Delegate to tuple encoding.
11713            fidl::encoding::Encode::<
11714                IoportResourceGetResponse,
11715                fidl::encoding::DefaultFuchsiaResourceDialect,
11716            >::encode(
11717                (<fidl::encoding::HandleType<
11718                    fidl::Resource,
11719                    { fidl::ObjectType::RESOURCE.into_raw() },
11720                    2147483648,
11721                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11722                    &mut self.resource
11723                ),),
11724                encoder,
11725                offset,
11726                _depth,
11727            )
11728        }
11729    }
11730    unsafe impl<
11731            T0: fidl::encoding::Encode<
11732                fidl::encoding::HandleType<
11733                    fidl::Resource,
11734                    { fidl::ObjectType::RESOURCE.into_raw() },
11735                    2147483648,
11736                >,
11737                fidl::encoding::DefaultFuchsiaResourceDialect,
11738            >,
11739        >
11740        fidl::encoding::Encode<
11741            IoportResourceGetResponse,
11742            fidl::encoding::DefaultFuchsiaResourceDialect,
11743        > for (T0,)
11744    {
11745        #[inline]
11746        unsafe fn encode(
11747            self,
11748            encoder: &mut fidl::encoding::Encoder<
11749                '_,
11750                fidl::encoding::DefaultFuchsiaResourceDialect,
11751            >,
11752            offset: usize,
11753            depth: fidl::encoding::Depth,
11754        ) -> fidl::Result<()> {
11755            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
11756            // Zero out padding regions. There's no need to apply masks
11757            // because the unmasked parts will be overwritten by fields.
11758            // Write the fields.
11759            self.0.encode(encoder, offset + 0, depth)?;
11760            Ok(())
11761        }
11762    }
11763
11764    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11765        for IoportResourceGetResponse
11766    {
11767        #[inline(always)]
11768        fn new_empty() -> Self {
11769            Self {
11770                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11771            }
11772        }
11773
11774        #[inline]
11775        unsafe fn decode(
11776            &mut self,
11777            decoder: &mut fidl::encoding::Decoder<
11778                '_,
11779                fidl::encoding::DefaultFuchsiaResourceDialect,
11780            >,
11781            offset: usize,
11782            _depth: fidl::encoding::Depth,
11783        ) -> fidl::Result<()> {
11784            decoder.debug_check_bounds::<Self>(offset);
11785            // Verify that padding bytes are zero.
11786            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11787            Ok(())
11788        }
11789    }
11790
11791    impl fidl::encoding::ResourceTypeMarker for IrqResourceGetResponse {
11792        type Borrowed<'a> = &'a mut Self;
11793        fn take_or_borrow<'a>(
11794            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11795        ) -> Self::Borrowed<'a> {
11796            value
11797        }
11798    }
11799
11800    unsafe impl fidl::encoding::TypeMarker for IrqResourceGetResponse {
11801        type Owned = Self;
11802
11803        #[inline(always)]
11804        fn inline_align(_context: fidl::encoding::Context) -> usize {
11805            4
11806        }
11807
11808        #[inline(always)]
11809        fn inline_size(_context: fidl::encoding::Context) -> usize {
11810            4
11811        }
11812    }
11813
11814    unsafe impl
11815        fidl::encoding::Encode<
11816            IrqResourceGetResponse,
11817            fidl::encoding::DefaultFuchsiaResourceDialect,
11818        > for &mut IrqResourceGetResponse
11819    {
11820        #[inline]
11821        unsafe fn encode(
11822            self,
11823            encoder: &mut fidl::encoding::Encoder<
11824                '_,
11825                fidl::encoding::DefaultFuchsiaResourceDialect,
11826            >,
11827            offset: usize,
11828            _depth: fidl::encoding::Depth,
11829        ) -> fidl::Result<()> {
11830            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
11831            // Delegate to tuple encoding.
11832            fidl::encoding::Encode::<
11833                IrqResourceGetResponse,
11834                fidl::encoding::DefaultFuchsiaResourceDialect,
11835            >::encode(
11836                (<fidl::encoding::HandleType<
11837                    fidl::Resource,
11838                    { fidl::ObjectType::RESOURCE.into_raw() },
11839                    2147483648,
11840                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11841                    &mut self.resource
11842                ),),
11843                encoder,
11844                offset,
11845                _depth,
11846            )
11847        }
11848    }
11849    unsafe impl<
11850            T0: fidl::encoding::Encode<
11851                fidl::encoding::HandleType<
11852                    fidl::Resource,
11853                    { fidl::ObjectType::RESOURCE.into_raw() },
11854                    2147483648,
11855                >,
11856                fidl::encoding::DefaultFuchsiaResourceDialect,
11857            >,
11858        >
11859        fidl::encoding::Encode<
11860            IrqResourceGetResponse,
11861            fidl::encoding::DefaultFuchsiaResourceDialect,
11862        > for (T0,)
11863    {
11864        #[inline]
11865        unsafe fn encode(
11866            self,
11867            encoder: &mut fidl::encoding::Encoder<
11868                '_,
11869                fidl::encoding::DefaultFuchsiaResourceDialect,
11870            >,
11871            offset: usize,
11872            depth: fidl::encoding::Depth,
11873        ) -> fidl::Result<()> {
11874            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
11875            // Zero out padding regions. There's no need to apply masks
11876            // because the unmasked parts will be overwritten by fields.
11877            // Write the fields.
11878            self.0.encode(encoder, offset + 0, depth)?;
11879            Ok(())
11880        }
11881    }
11882
11883    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11884        for IrqResourceGetResponse
11885    {
11886        #[inline(always)]
11887        fn new_empty() -> Self {
11888            Self {
11889                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11890            }
11891        }
11892
11893        #[inline]
11894        unsafe fn decode(
11895            &mut self,
11896            decoder: &mut fidl::encoding::Decoder<
11897                '_,
11898                fidl::encoding::DefaultFuchsiaResourceDialect,
11899            >,
11900            offset: usize,
11901            _depth: fidl::encoding::Depth,
11902        ) -> fidl::Result<()> {
11903            decoder.debug_check_bounds::<Self>(offset);
11904            // Verify that padding bytes are zero.
11905            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11906            Ok(())
11907        }
11908    }
11909
11910    impl fidl::encoding::ResourceTypeMarker for MexecResourceGetResponse {
11911        type Borrowed<'a> = &'a mut Self;
11912        fn take_or_borrow<'a>(
11913            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11914        ) -> Self::Borrowed<'a> {
11915            value
11916        }
11917    }
11918
11919    unsafe impl fidl::encoding::TypeMarker for MexecResourceGetResponse {
11920        type Owned = Self;
11921
11922        #[inline(always)]
11923        fn inline_align(_context: fidl::encoding::Context) -> usize {
11924            4
11925        }
11926
11927        #[inline(always)]
11928        fn inline_size(_context: fidl::encoding::Context) -> usize {
11929            4
11930        }
11931    }
11932
11933    unsafe impl
11934        fidl::encoding::Encode<
11935            MexecResourceGetResponse,
11936            fidl::encoding::DefaultFuchsiaResourceDialect,
11937        > for &mut MexecResourceGetResponse
11938    {
11939        #[inline]
11940        unsafe fn encode(
11941            self,
11942            encoder: &mut fidl::encoding::Encoder<
11943                '_,
11944                fidl::encoding::DefaultFuchsiaResourceDialect,
11945            >,
11946            offset: usize,
11947            _depth: fidl::encoding::Depth,
11948        ) -> fidl::Result<()> {
11949            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
11950            // Delegate to tuple encoding.
11951            fidl::encoding::Encode::<
11952                MexecResourceGetResponse,
11953                fidl::encoding::DefaultFuchsiaResourceDialect,
11954            >::encode(
11955                (<fidl::encoding::HandleType<
11956                    fidl::Resource,
11957                    { fidl::ObjectType::RESOURCE.into_raw() },
11958                    2147483648,
11959                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11960                    &mut self.resource
11961                ),),
11962                encoder,
11963                offset,
11964                _depth,
11965            )
11966        }
11967    }
11968    unsafe impl<
11969            T0: fidl::encoding::Encode<
11970                fidl::encoding::HandleType<
11971                    fidl::Resource,
11972                    { fidl::ObjectType::RESOURCE.into_raw() },
11973                    2147483648,
11974                >,
11975                fidl::encoding::DefaultFuchsiaResourceDialect,
11976            >,
11977        >
11978        fidl::encoding::Encode<
11979            MexecResourceGetResponse,
11980            fidl::encoding::DefaultFuchsiaResourceDialect,
11981        > for (T0,)
11982    {
11983        #[inline]
11984        unsafe fn encode(
11985            self,
11986            encoder: &mut fidl::encoding::Encoder<
11987                '_,
11988                fidl::encoding::DefaultFuchsiaResourceDialect,
11989            >,
11990            offset: usize,
11991            depth: fidl::encoding::Depth,
11992        ) -> fidl::Result<()> {
11993            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
11994            // Zero out padding regions. There's no need to apply masks
11995            // because the unmasked parts will be overwritten by fields.
11996            // Write the fields.
11997            self.0.encode(encoder, offset + 0, depth)?;
11998            Ok(())
11999        }
12000    }
12001
12002    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12003        for MexecResourceGetResponse
12004    {
12005        #[inline(always)]
12006        fn new_empty() -> Self {
12007            Self {
12008                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12009            }
12010        }
12011
12012        #[inline]
12013        unsafe fn decode(
12014            &mut self,
12015            decoder: &mut fidl::encoding::Decoder<
12016                '_,
12017                fidl::encoding::DefaultFuchsiaResourceDialect,
12018            >,
12019            offset: usize,
12020            _depth: fidl::encoding::Depth,
12021        ) -> fidl::Result<()> {
12022            decoder.debug_check_bounds::<Self>(offset);
12023            // Verify that padding bytes are zero.
12024            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12025            Ok(())
12026        }
12027    }
12028
12029    impl fidl::encoding::ResourceTypeMarker for MmioResourceGetResponse {
12030        type Borrowed<'a> = &'a mut Self;
12031        fn take_or_borrow<'a>(
12032            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12033        ) -> Self::Borrowed<'a> {
12034            value
12035        }
12036    }
12037
12038    unsafe impl fidl::encoding::TypeMarker for MmioResourceGetResponse {
12039        type Owned = Self;
12040
12041        #[inline(always)]
12042        fn inline_align(_context: fidl::encoding::Context) -> usize {
12043            4
12044        }
12045
12046        #[inline(always)]
12047        fn inline_size(_context: fidl::encoding::Context) -> usize {
12048            4
12049        }
12050    }
12051
12052    unsafe impl
12053        fidl::encoding::Encode<
12054            MmioResourceGetResponse,
12055            fidl::encoding::DefaultFuchsiaResourceDialect,
12056        > for &mut MmioResourceGetResponse
12057    {
12058        #[inline]
12059        unsafe fn encode(
12060            self,
12061            encoder: &mut fidl::encoding::Encoder<
12062                '_,
12063                fidl::encoding::DefaultFuchsiaResourceDialect,
12064            >,
12065            offset: usize,
12066            _depth: fidl::encoding::Depth,
12067        ) -> fidl::Result<()> {
12068            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12069            // Delegate to tuple encoding.
12070            fidl::encoding::Encode::<
12071                MmioResourceGetResponse,
12072                fidl::encoding::DefaultFuchsiaResourceDialect,
12073            >::encode(
12074                (<fidl::encoding::HandleType<
12075                    fidl::Resource,
12076                    { fidl::ObjectType::RESOURCE.into_raw() },
12077                    2147483648,
12078                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12079                    &mut self.resource
12080                ),),
12081                encoder,
12082                offset,
12083                _depth,
12084            )
12085        }
12086    }
12087    unsafe impl<
12088            T0: fidl::encoding::Encode<
12089                fidl::encoding::HandleType<
12090                    fidl::Resource,
12091                    { fidl::ObjectType::RESOURCE.into_raw() },
12092                    2147483648,
12093                >,
12094                fidl::encoding::DefaultFuchsiaResourceDialect,
12095            >,
12096        >
12097        fidl::encoding::Encode<
12098            MmioResourceGetResponse,
12099            fidl::encoding::DefaultFuchsiaResourceDialect,
12100        > for (T0,)
12101    {
12102        #[inline]
12103        unsafe fn encode(
12104            self,
12105            encoder: &mut fidl::encoding::Encoder<
12106                '_,
12107                fidl::encoding::DefaultFuchsiaResourceDialect,
12108            >,
12109            offset: usize,
12110            depth: fidl::encoding::Depth,
12111        ) -> fidl::Result<()> {
12112            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12113            // Zero out padding regions. There's no need to apply masks
12114            // because the unmasked parts will be overwritten by fields.
12115            // Write the fields.
12116            self.0.encode(encoder, offset + 0, depth)?;
12117            Ok(())
12118        }
12119    }
12120
12121    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12122        for MmioResourceGetResponse
12123    {
12124        #[inline(always)]
12125        fn new_empty() -> Self {
12126            Self {
12127                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12128            }
12129        }
12130
12131        #[inline]
12132        unsafe fn decode(
12133            &mut self,
12134            decoder: &mut fidl::encoding::Decoder<
12135                '_,
12136                fidl::encoding::DefaultFuchsiaResourceDialect,
12137            >,
12138            offset: usize,
12139            _depth: fidl::encoding::Depth,
12140        ) -> fidl::Result<()> {
12141            decoder.debug_check_bounds::<Self>(offset);
12142            // Verify that padding bytes are zero.
12143            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12144            Ok(())
12145        }
12146    }
12147
12148    impl fidl::encoding::ResourceTypeMarker for MsiResourceGetResponse {
12149        type Borrowed<'a> = &'a mut Self;
12150        fn take_or_borrow<'a>(
12151            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12152        ) -> Self::Borrowed<'a> {
12153            value
12154        }
12155    }
12156
12157    unsafe impl fidl::encoding::TypeMarker for MsiResourceGetResponse {
12158        type Owned = Self;
12159
12160        #[inline(always)]
12161        fn inline_align(_context: fidl::encoding::Context) -> usize {
12162            4
12163        }
12164
12165        #[inline(always)]
12166        fn inline_size(_context: fidl::encoding::Context) -> usize {
12167            4
12168        }
12169    }
12170
12171    unsafe impl
12172        fidl::encoding::Encode<
12173            MsiResourceGetResponse,
12174            fidl::encoding::DefaultFuchsiaResourceDialect,
12175        > for &mut MsiResourceGetResponse
12176    {
12177        #[inline]
12178        unsafe fn encode(
12179            self,
12180            encoder: &mut fidl::encoding::Encoder<
12181                '_,
12182                fidl::encoding::DefaultFuchsiaResourceDialect,
12183            >,
12184            offset: usize,
12185            _depth: fidl::encoding::Depth,
12186        ) -> fidl::Result<()> {
12187            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
12188            // Delegate to tuple encoding.
12189            fidl::encoding::Encode::<
12190                MsiResourceGetResponse,
12191                fidl::encoding::DefaultFuchsiaResourceDialect,
12192            >::encode(
12193                (<fidl::encoding::HandleType<
12194                    fidl::Resource,
12195                    { fidl::ObjectType::RESOURCE.into_raw() },
12196                    2147483648,
12197                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12198                    &mut self.resource
12199                ),),
12200                encoder,
12201                offset,
12202                _depth,
12203            )
12204        }
12205    }
12206    unsafe impl<
12207            T0: fidl::encoding::Encode<
12208                fidl::encoding::HandleType<
12209                    fidl::Resource,
12210                    { fidl::ObjectType::RESOURCE.into_raw() },
12211                    2147483648,
12212                >,
12213                fidl::encoding::DefaultFuchsiaResourceDialect,
12214            >,
12215        >
12216        fidl::encoding::Encode<
12217            MsiResourceGetResponse,
12218            fidl::encoding::DefaultFuchsiaResourceDialect,
12219        > for (T0,)
12220    {
12221        #[inline]
12222        unsafe fn encode(
12223            self,
12224            encoder: &mut fidl::encoding::Encoder<
12225                '_,
12226                fidl::encoding::DefaultFuchsiaResourceDialect,
12227            >,
12228            offset: usize,
12229            depth: fidl::encoding::Depth,
12230        ) -> fidl::Result<()> {
12231            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
12232            // Zero out padding regions. There's no need to apply masks
12233            // because the unmasked parts will be overwritten by fields.
12234            // Write the fields.
12235            self.0.encode(encoder, offset + 0, depth)?;
12236            Ok(())
12237        }
12238    }
12239
12240    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12241        for MsiResourceGetResponse
12242    {
12243        #[inline(always)]
12244        fn new_empty() -> Self {
12245            Self {
12246                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12247            }
12248        }
12249
12250        #[inline]
12251        unsafe fn decode(
12252            &mut self,
12253            decoder: &mut fidl::encoding::Decoder<
12254                '_,
12255                fidl::encoding::DefaultFuchsiaResourceDialect,
12256            >,
12257            offset: usize,
12258            _depth: fidl::encoding::Depth,
12259        ) -> fidl::Result<()> {
12260            decoder.debug_check_bounds::<Self>(offset);
12261            // Verify that padding bytes are zero.
12262            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12263            Ok(())
12264        }
12265    }
12266
12267    impl fidl::encoding::ResourceTypeMarker for PowerResourceGetResponse {
12268        type Borrowed<'a> = &'a mut Self;
12269        fn take_or_borrow<'a>(
12270            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12271        ) -> Self::Borrowed<'a> {
12272            value
12273        }
12274    }
12275
12276    unsafe impl fidl::encoding::TypeMarker for PowerResourceGetResponse {
12277        type Owned = Self;
12278
12279        #[inline(always)]
12280        fn inline_align(_context: fidl::encoding::Context) -> usize {
12281            4
12282        }
12283
12284        #[inline(always)]
12285        fn inline_size(_context: fidl::encoding::Context) -> usize {
12286            4
12287        }
12288    }
12289
12290    unsafe impl
12291        fidl::encoding::Encode<
12292            PowerResourceGetResponse,
12293            fidl::encoding::DefaultFuchsiaResourceDialect,
12294        > for &mut PowerResourceGetResponse
12295    {
12296        #[inline]
12297        unsafe fn encode(
12298            self,
12299            encoder: &mut fidl::encoding::Encoder<
12300                '_,
12301                fidl::encoding::DefaultFuchsiaResourceDialect,
12302            >,
12303            offset: usize,
12304            _depth: fidl::encoding::Depth,
12305        ) -> fidl::Result<()> {
12306            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
12307            // Delegate to tuple encoding.
12308            fidl::encoding::Encode::<
12309                PowerResourceGetResponse,
12310                fidl::encoding::DefaultFuchsiaResourceDialect,
12311            >::encode(
12312                (<fidl::encoding::HandleType<
12313                    fidl::Resource,
12314                    { fidl::ObjectType::RESOURCE.into_raw() },
12315                    2147483648,
12316                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12317                    &mut self.resource
12318                ),),
12319                encoder,
12320                offset,
12321                _depth,
12322            )
12323        }
12324    }
12325    unsafe impl<
12326            T0: fidl::encoding::Encode<
12327                fidl::encoding::HandleType<
12328                    fidl::Resource,
12329                    { fidl::ObjectType::RESOURCE.into_raw() },
12330                    2147483648,
12331                >,
12332                fidl::encoding::DefaultFuchsiaResourceDialect,
12333            >,
12334        >
12335        fidl::encoding::Encode<
12336            PowerResourceGetResponse,
12337            fidl::encoding::DefaultFuchsiaResourceDialect,
12338        > for (T0,)
12339    {
12340        #[inline]
12341        unsafe fn encode(
12342            self,
12343            encoder: &mut fidl::encoding::Encoder<
12344                '_,
12345                fidl::encoding::DefaultFuchsiaResourceDialect,
12346            >,
12347            offset: usize,
12348            depth: fidl::encoding::Depth,
12349        ) -> fidl::Result<()> {
12350            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
12351            // Zero out padding regions. There's no need to apply masks
12352            // because the unmasked parts will be overwritten by fields.
12353            // Write the fields.
12354            self.0.encode(encoder, offset + 0, depth)?;
12355            Ok(())
12356        }
12357    }
12358
12359    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12360        for PowerResourceGetResponse
12361    {
12362        #[inline(always)]
12363        fn new_empty() -> Self {
12364            Self {
12365                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12366            }
12367        }
12368
12369        #[inline]
12370        unsafe fn decode(
12371            &mut self,
12372            decoder: &mut fidl::encoding::Decoder<
12373                '_,
12374                fidl::encoding::DefaultFuchsiaResourceDialect,
12375            >,
12376            offset: usize,
12377            _depth: fidl::encoding::Depth,
12378        ) -> fidl::Result<()> {
12379            decoder.debug_check_bounds::<Self>(offset);
12380            // Verify that padding bytes are zero.
12381            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12382            Ok(())
12383        }
12384    }
12385
12386    impl fidl::encoding::ResourceTypeMarker for ProfileResourceGetResponse {
12387        type Borrowed<'a> = &'a mut Self;
12388        fn take_or_borrow<'a>(
12389            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12390        ) -> Self::Borrowed<'a> {
12391            value
12392        }
12393    }
12394
12395    unsafe impl fidl::encoding::TypeMarker for ProfileResourceGetResponse {
12396        type Owned = Self;
12397
12398        #[inline(always)]
12399        fn inline_align(_context: fidl::encoding::Context) -> usize {
12400            4
12401        }
12402
12403        #[inline(always)]
12404        fn inline_size(_context: fidl::encoding::Context) -> usize {
12405            4
12406        }
12407    }
12408
12409    unsafe impl
12410        fidl::encoding::Encode<
12411            ProfileResourceGetResponse,
12412            fidl::encoding::DefaultFuchsiaResourceDialect,
12413        > for &mut ProfileResourceGetResponse
12414    {
12415        #[inline]
12416        unsafe fn encode(
12417            self,
12418            encoder: &mut fidl::encoding::Encoder<
12419                '_,
12420                fidl::encoding::DefaultFuchsiaResourceDialect,
12421            >,
12422            offset: usize,
12423            _depth: fidl::encoding::Depth,
12424        ) -> fidl::Result<()> {
12425            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
12426            // Delegate to tuple encoding.
12427            fidl::encoding::Encode::<
12428                ProfileResourceGetResponse,
12429                fidl::encoding::DefaultFuchsiaResourceDialect,
12430            >::encode(
12431                (<fidl::encoding::HandleType<
12432                    fidl::Resource,
12433                    { fidl::ObjectType::RESOURCE.into_raw() },
12434                    2147483648,
12435                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12436                    &mut self.resource
12437                ),),
12438                encoder,
12439                offset,
12440                _depth,
12441            )
12442        }
12443    }
12444    unsafe impl<
12445            T0: fidl::encoding::Encode<
12446                fidl::encoding::HandleType<
12447                    fidl::Resource,
12448                    { fidl::ObjectType::RESOURCE.into_raw() },
12449                    2147483648,
12450                >,
12451                fidl::encoding::DefaultFuchsiaResourceDialect,
12452            >,
12453        >
12454        fidl::encoding::Encode<
12455            ProfileResourceGetResponse,
12456            fidl::encoding::DefaultFuchsiaResourceDialect,
12457        > for (T0,)
12458    {
12459        #[inline]
12460        unsafe fn encode(
12461            self,
12462            encoder: &mut fidl::encoding::Encoder<
12463                '_,
12464                fidl::encoding::DefaultFuchsiaResourceDialect,
12465            >,
12466            offset: usize,
12467            depth: fidl::encoding::Depth,
12468        ) -> fidl::Result<()> {
12469            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
12470            // Zero out padding regions. There's no need to apply masks
12471            // because the unmasked parts will be overwritten by fields.
12472            // Write the fields.
12473            self.0.encode(encoder, offset + 0, depth)?;
12474            Ok(())
12475        }
12476    }
12477
12478    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12479        for ProfileResourceGetResponse
12480    {
12481        #[inline(always)]
12482        fn new_empty() -> Self {
12483            Self {
12484                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12485            }
12486        }
12487
12488        #[inline]
12489        unsafe fn decode(
12490            &mut self,
12491            decoder: &mut fidl::encoding::Decoder<
12492                '_,
12493                fidl::encoding::DefaultFuchsiaResourceDialect,
12494            >,
12495            offset: usize,
12496            _depth: fidl::encoding::Depth,
12497        ) -> fidl::Result<()> {
12498            decoder.debug_check_bounds::<Self>(offset);
12499            // Verify that padding bytes are zero.
12500            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12501            Ok(())
12502        }
12503    }
12504
12505    impl fidl::encoding::ResourceTypeMarker for RootJobGetResponse {
12506        type Borrowed<'a> = &'a mut Self;
12507        fn take_or_borrow<'a>(
12508            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12509        ) -> Self::Borrowed<'a> {
12510            value
12511        }
12512    }
12513
12514    unsafe impl fidl::encoding::TypeMarker for RootJobGetResponse {
12515        type Owned = Self;
12516
12517        #[inline(always)]
12518        fn inline_align(_context: fidl::encoding::Context) -> usize {
12519            4
12520        }
12521
12522        #[inline(always)]
12523        fn inline_size(_context: fidl::encoding::Context) -> usize {
12524            4
12525        }
12526    }
12527
12528    unsafe impl
12529        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
12530        for &mut RootJobGetResponse
12531    {
12532        #[inline]
12533        unsafe fn encode(
12534            self,
12535            encoder: &mut fidl::encoding::Encoder<
12536                '_,
12537                fidl::encoding::DefaultFuchsiaResourceDialect,
12538            >,
12539            offset: usize,
12540            _depth: fidl::encoding::Depth,
12541        ) -> fidl::Result<()> {
12542            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
12543            // Delegate to tuple encoding.
12544            fidl::encoding::Encode::<
12545                RootJobGetResponse,
12546                fidl::encoding::DefaultFuchsiaResourceDialect,
12547            >::encode(
12548                (<fidl::encoding::HandleType<
12549                    fidl::Job,
12550                    { fidl::ObjectType::JOB.into_raw() },
12551                    2147483648,
12552                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12553                    &mut self.job
12554                ),),
12555                encoder,
12556                offset,
12557                _depth,
12558            )
12559        }
12560    }
12561    unsafe impl<
12562            T0: fidl::encoding::Encode<
12563                fidl::encoding::HandleType<
12564                    fidl::Job,
12565                    { fidl::ObjectType::JOB.into_raw() },
12566                    2147483648,
12567                >,
12568                fidl::encoding::DefaultFuchsiaResourceDialect,
12569            >,
12570        >
12571        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
12572        for (T0,)
12573    {
12574        #[inline]
12575        unsafe fn encode(
12576            self,
12577            encoder: &mut fidl::encoding::Encoder<
12578                '_,
12579                fidl::encoding::DefaultFuchsiaResourceDialect,
12580            >,
12581            offset: usize,
12582            depth: fidl::encoding::Depth,
12583        ) -> fidl::Result<()> {
12584            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
12585            // Zero out padding regions. There's no need to apply masks
12586            // because the unmasked parts will be overwritten by fields.
12587            // Write the fields.
12588            self.0.encode(encoder, offset + 0, depth)?;
12589            Ok(())
12590        }
12591    }
12592
12593    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12594        for RootJobGetResponse
12595    {
12596        #[inline(always)]
12597        fn new_empty() -> Self {
12598            Self {
12599                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12600            }
12601        }
12602
12603        #[inline]
12604        unsafe fn decode(
12605            &mut self,
12606            decoder: &mut fidl::encoding::Decoder<
12607                '_,
12608                fidl::encoding::DefaultFuchsiaResourceDialect,
12609            >,
12610            offset: usize,
12611            _depth: fidl::encoding::Depth,
12612        ) -> fidl::Result<()> {
12613            decoder.debug_check_bounds::<Self>(offset);
12614            // Verify that padding bytes are zero.
12615            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
12616            Ok(())
12617        }
12618    }
12619
12620    impl fidl::encoding::ResourceTypeMarker for SmcResourceGetResponse {
12621        type Borrowed<'a> = &'a mut Self;
12622        fn take_or_borrow<'a>(
12623            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12624        ) -> Self::Borrowed<'a> {
12625            value
12626        }
12627    }
12628
12629    unsafe impl fidl::encoding::TypeMarker for SmcResourceGetResponse {
12630        type Owned = Self;
12631
12632        #[inline(always)]
12633        fn inline_align(_context: fidl::encoding::Context) -> usize {
12634            4
12635        }
12636
12637        #[inline(always)]
12638        fn inline_size(_context: fidl::encoding::Context) -> usize {
12639            4
12640        }
12641    }
12642
12643    unsafe impl
12644        fidl::encoding::Encode<
12645            SmcResourceGetResponse,
12646            fidl::encoding::DefaultFuchsiaResourceDialect,
12647        > for &mut SmcResourceGetResponse
12648    {
12649        #[inline]
12650        unsafe fn encode(
12651            self,
12652            encoder: &mut fidl::encoding::Encoder<
12653                '_,
12654                fidl::encoding::DefaultFuchsiaResourceDialect,
12655            >,
12656            offset: usize,
12657            _depth: fidl::encoding::Depth,
12658        ) -> fidl::Result<()> {
12659            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
12660            // Delegate to tuple encoding.
12661            fidl::encoding::Encode::<
12662                SmcResourceGetResponse,
12663                fidl::encoding::DefaultFuchsiaResourceDialect,
12664            >::encode(
12665                (<fidl::encoding::HandleType<
12666                    fidl::Resource,
12667                    { fidl::ObjectType::RESOURCE.into_raw() },
12668                    2147483648,
12669                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12670                    &mut self.resource
12671                ),),
12672                encoder,
12673                offset,
12674                _depth,
12675            )
12676        }
12677    }
12678    unsafe impl<
12679            T0: fidl::encoding::Encode<
12680                fidl::encoding::HandleType<
12681                    fidl::Resource,
12682                    { fidl::ObjectType::RESOURCE.into_raw() },
12683                    2147483648,
12684                >,
12685                fidl::encoding::DefaultFuchsiaResourceDialect,
12686            >,
12687        >
12688        fidl::encoding::Encode<
12689            SmcResourceGetResponse,
12690            fidl::encoding::DefaultFuchsiaResourceDialect,
12691        > for (T0,)
12692    {
12693        #[inline]
12694        unsafe fn encode(
12695            self,
12696            encoder: &mut fidl::encoding::Encoder<
12697                '_,
12698                fidl::encoding::DefaultFuchsiaResourceDialect,
12699            >,
12700            offset: usize,
12701            depth: fidl::encoding::Depth,
12702        ) -> fidl::Result<()> {
12703            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
12704            // Zero out padding regions. There's no need to apply masks
12705            // because the unmasked parts will be overwritten by fields.
12706            // Write the fields.
12707            self.0.encode(encoder, offset + 0, depth)?;
12708            Ok(())
12709        }
12710    }
12711
12712    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12713        for SmcResourceGetResponse
12714    {
12715        #[inline(always)]
12716        fn new_empty() -> Self {
12717            Self {
12718                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12719            }
12720        }
12721
12722        #[inline]
12723        unsafe fn decode(
12724            &mut self,
12725            decoder: &mut fidl::encoding::Decoder<
12726                '_,
12727                fidl::encoding::DefaultFuchsiaResourceDialect,
12728            >,
12729            offset: usize,
12730            _depth: fidl::encoding::Depth,
12731        ) -> fidl::Result<()> {
12732            decoder.debug_check_bounds::<Self>(offset);
12733            // Verify that padding bytes are zero.
12734            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12735            Ok(())
12736        }
12737    }
12738
12739    impl fidl::encoding::ResourceTypeMarker for StallResourceGetResponse {
12740        type Borrowed<'a> = &'a mut Self;
12741        fn take_or_borrow<'a>(
12742            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12743        ) -> Self::Borrowed<'a> {
12744            value
12745        }
12746    }
12747
12748    unsafe impl fidl::encoding::TypeMarker for StallResourceGetResponse {
12749        type Owned = Self;
12750
12751        #[inline(always)]
12752        fn inline_align(_context: fidl::encoding::Context) -> usize {
12753            4
12754        }
12755
12756        #[inline(always)]
12757        fn inline_size(_context: fidl::encoding::Context) -> usize {
12758            4
12759        }
12760    }
12761
12762    unsafe impl
12763        fidl::encoding::Encode<
12764            StallResourceGetResponse,
12765            fidl::encoding::DefaultFuchsiaResourceDialect,
12766        > for &mut StallResourceGetResponse
12767    {
12768        #[inline]
12769        unsafe fn encode(
12770            self,
12771            encoder: &mut fidl::encoding::Encoder<
12772                '_,
12773                fidl::encoding::DefaultFuchsiaResourceDialect,
12774            >,
12775            offset: usize,
12776            _depth: fidl::encoding::Depth,
12777        ) -> fidl::Result<()> {
12778            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
12779            // Delegate to tuple encoding.
12780            fidl::encoding::Encode::<
12781                StallResourceGetResponse,
12782                fidl::encoding::DefaultFuchsiaResourceDialect,
12783            >::encode(
12784                (<fidl::encoding::HandleType<
12785                    fidl::Resource,
12786                    { fidl::ObjectType::RESOURCE.into_raw() },
12787                    2147483648,
12788                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12789                    &mut self.resource
12790                ),),
12791                encoder,
12792                offset,
12793                _depth,
12794            )
12795        }
12796    }
12797    unsafe impl<
12798            T0: fidl::encoding::Encode<
12799                fidl::encoding::HandleType<
12800                    fidl::Resource,
12801                    { fidl::ObjectType::RESOURCE.into_raw() },
12802                    2147483648,
12803                >,
12804                fidl::encoding::DefaultFuchsiaResourceDialect,
12805            >,
12806        >
12807        fidl::encoding::Encode<
12808            StallResourceGetResponse,
12809            fidl::encoding::DefaultFuchsiaResourceDialect,
12810        > for (T0,)
12811    {
12812        #[inline]
12813        unsafe fn encode(
12814            self,
12815            encoder: &mut fidl::encoding::Encoder<
12816                '_,
12817                fidl::encoding::DefaultFuchsiaResourceDialect,
12818            >,
12819            offset: usize,
12820            depth: fidl::encoding::Depth,
12821        ) -> fidl::Result<()> {
12822            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
12823            // Zero out padding regions. There's no need to apply masks
12824            // because the unmasked parts will be overwritten by fields.
12825            // Write the fields.
12826            self.0.encode(encoder, offset + 0, depth)?;
12827            Ok(())
12828        }
12829    }
12830
12831    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12832        for StallResourceGetResponse
12833    {
12834        #[inline(always)]
12835        fn new_empty() -> Self {
12836            Self {
12837                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12838            }
12839        }
12840
12841        #[inline]
12842        unsafe fn decode(
12843            &mut self,
12844            decoder: &mut fidl::encoding::Decoder<
12845                '_,
12846                fidl::encoding::DefaultFuchsiaResourceDialect,
12847            >,
12848            offset: usize,
12849            _depth: fidl::encoding::Depth,
12850        ) -> fidl::Result<()> {
12851            decoder.debug_check_bounds::<Self>(offset);
12852            // Verify that padding bytes are zero.
12853            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12854            Ok(())
12855        }
12856    }
12857
12858    impl fidl::encoding::ResourceTypeMarker for TracingResourceGetResponse {
12859        type Borrowed<'a> = &'a mut Self;
12860        fn take_or_borrow<'a>(
12861            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12862        ) -> Self::Borrowed<'a> {
12863            value
12864        }
12865    }
12866
12867    unsafe impl fidl::encoding::TypeMarker for TracingResourceGetResponse {
12868        type Owned = Self;
12869
12870        #[inline(always)]
12871        fn inline_align(_context: fidl::encoding::Context) -> usize {
12872            4
12873        }
12874
12875        #[inline(always)]
12876        fn inline_size(_context: fidl::encoding::Context) -> usize {
12877            4
12878        }
12879    }
12880
12881    unsafe impl
12882        fidl::encoding::Encode<
12883            TracingResourceGetResponse,
12884            fidl::encoding::DefaultFuchsiaResourceDialect,
12885        > for &mut TracingResourceGetResponse
12886    {
12887        #[inline]
12888        unsafe fn encode(
12889            self,
12890            encoder: &mut fidl::encoding::Encoder<
12891                '_,
12892                fidl::encoding::DefaultFuchsiaResourceDialect,
12893            >,
12894            offset: usize,
12895            _depth: fidl::encoding::Depth,
12896        ) -> fidl::Result<()> {
12897            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
12898            // Delegate to tuple encoding.
12899            fidl::encoding::Encode::<
12900                TracingResourceGetResponse,
12901                fidl::encoding::DefaultFuchsiaResourceDialect,
12902            >::encode(
12903                (<fidl::encoding::HandleType<
12904                    fidl::Resource,
12905                    { fidl::ObjectType::RESOURCE.into_raw() },
12906                    2147483648,
12907                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12908                    &mut self.resource
12909                ),),
12910                encoder,
12911                offset,
12912                _depth,
12913            )
12914        }
12915    }
12916    unsafe impl<
12917            T0: fidl::encoding::Encode<
12918                fidl::encoding::HandleType<
12919                    fidl::Resource,
12920                    { fidl::ObjectType::RESOURCE.into_raw() },
12921                    2147483648,
12922                >,
12923                fidl::encoding::DefaultFuchsiaResourceDialect,
12924            >,
12925        >
12926        fidl::encoding::Encode<
12927            TracingResourceGetResponse,
12928            fidl::encoding::DefaultFuchsiaResourceDialect,
12929        > for (T0,)
12930    {
12931        #[inline]
12932        unsafe fn encode(
12933            self,
12934            encoder: &mut fidl::encoding::Encoder<
12935                '_,
12936                fidl::encoding::DefaultFuchsiaResourceDialect,
12937            >,
12938            offset: usize,
12939            depth: fidl::encoding::Depth,
12940        ) -> fidl::Result<()> {
12941            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
12942            // Zero out padding regions. There's no need to apply masks
12943            // because the unmasked parts will be overwritten by fields.
12944            // Write the fields.
12945            self.0.encode(encoder, offset + 0, depth)?;
12946            Ok(())
12947        }
12948    }
12949
12950    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12951        for TracingResourceGetResponse
12952    {
12953        #[inline(always)]
12954        fn new_empty() -> Self {
12955            Self {
12956                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12957            }
12958        }
12959
12960        #[inline]
12961        unsafe fn decode(
12962            &mut self,
12963            decoder: &mut fidl::encoding::Decoder<
12964                '_,
12965                fidl::encoding::DefaultFuchsiaResourceDialect,
12966            >,
12967            offset: usize,
12968            _depth: fidl::encoding::Depth,
12969        ) -> fidl::Result<()> {
12970            decoder.debug_check_bounds::<Self>(offset);
12971            // Verify that padding bytes are zero.
12972            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12973            Ok(())
12974        }
12975    }
12976
12977    impl fidl::encoding::ResourceTypeMarker for VmexResourceGetResponse {
12978        type Borrowed<'a> = &'a mut Self;
12979        fn take_or_borrow<'a>(
12980            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12981        ) -> Self::Borrowed<'a> {
12982            value
12983        }
12984    }
12985
12986    unsafe impl fidl::encoding::TypeMarker for VmexResourceGetResponse {
12987        type Owned = Self;
12988
12989        #[inline(always)]
12990        fn inline_align(_context: fidl::encoding::Context) -> usize {
12991            4
12992        }
12993
12994        #[inline(always)]
12995        fn inline_size(_context: fidl::encoding::Context) -> usize {
12996            4
12997        }
12998    }
12999
13000    unsafe impl
13001        fidl::encoding::Encode<
13002            VmexResourceGetResponse,
13003            fidl::encoding::DefaultFuchsiaResourceDialect,
13004        > for &mut VmexResourceGetResponse
13005    {
13006        #[inline]
13007        unsafe fn encode(
13008            self,
13009            encoder: &mut fidl::encoding::Encoder<
13010                '_,
13011                fidl::encoding::DefaultFuchsiaResourceDialect,
13012            >,
13013            offset: usize,
13014            _depth: fidl::encoding::Depth,
13015        ) -> fidl::Result<()> {
13016            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
13017            // Delegate to tuple encoding.
13018            fidl::encoding::Encode::<
13019                VmexResourceGetResponse,
13020                fidl::encoding::DefaultFuchsiaResourceDialect,
13021            >::encode(
13022                (<fidl::encoding::HandleType<
13023                    fidl::Resource,
13024                    { fidl::ObjectType::RESOURCE.into_raw() },
13025                    2147483648,
13026                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13027                    &mut self.resource
13028                ),),
13029                encoder,
13030                offset,
13031                _depth,
13032            )
13033        }
13034    }
13035    unsafe impl<
13036            T0: fidl::encoding::Encode<
13037                fidl::encoding::HandleType<
13038                    fidl::Resource,
13039                    { fidl::ObjectType::RESOURCE.into_raw() },
13040                    2147483648,
13041                >,
13042                fidl::encoding::DefaultFuchsiaResourceDialect,
13043            >,
13044        >
13045        fidl::encoding::Encode<
13046            VmexResourceGetResponse,
13047            fidl::encoding::DefaultFuchsiaResourceDialect,
13048        > for (T0,)
13049    {
13050        #[inline]
13051        unsafe fn encode(
13052            self,
13053            encoder: &mut fidl::encoding::Encoder<
13054                '_,
13055                fidl::encoding::DefaultFuchsiaResourceDialect,
13056            >,
13057            offset: usize,
13058            depth: fidl::encoding::Depth,
13059        ) -> fidl::Result<()> {
13060            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
13061            // Zero out padding regions. There's no need to apply masks
13062            // because the unmasked parts will be overwritten by fields.
13063            // Write the fields.
13064            self.0.encode(encoder, offset + 0, depth)?;
13065            Ok(())
13066        }
13067    }
13068
13069    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13070        for VmexResourceGetResponse
13071    {
13072        #[inline(always)]
13073        fn new_empty() -> Self {
13074            Self {
13075                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13076            }
13077        }
13078
13079        #[inline]
13080        unsafe fn decode(
13081            &mut self,
13082            decoder: &mut fidl::encoding::Decoder<
13083                '_,
13084                fidl::encoding::DefaultFuchsiaResourceDialect,
13085            >,
13086            offset: usize,
13087            _depth: fidl::encoding::Depth,
13088        ) -> fidl::Result<()> {
13089            decoder.debug_check_bounds::<Self>(offset);
13090            // Verify that padding bytes are zero.
13091            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13092            Ok(())
13093        }
13094    }
13095}