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#[cfg(target_os = "fuchsia")]
273impl From<CounterSynchronousProxy> for zx::Handle {
274    fn from(value: CounterSynchronousProxy) -> Self {
275        value.into_channel().into()
276    }
277}
278
279#[cfg(target_os = "fuchsia")]
280impl From<fidl::Channel> for CounterSynchronousProxy {
281    fn from(value: fidl::Channel) -> Self {
282        Self::new(value)
283    }
284}
285
286#[cfg(target_os = "fuchsia")]
287impl fidl::endpoints::FromClient for CounterSynchronousProxy {
288    type Protocol = CounterMarker;
289
290    fn from_client(value: fidl::endpoints::ClientEnd<CounterMarker>) -> Self {
291        Self::new(value.into_channel())
292    }
293}
294
295#[derive(Debug, Clone)]
296pub struct CounterProxy {
297    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
298}
299
300impl fidl::endpoints::Proxy for CounterProxy {
301    type Protocol = CounterMarker;
302
303    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
304        Self::new(inner)
305    }
306
307    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
308        self.client.into_channel().map_err(|client| Self { client })
309    }
310
311    fn as_channel(&self) -> &::fidl::AsyncChannel {
312        self.client.as_channel()
313    }
314}
315
316impl CounterProxy {
317    /// Create a new Proxy for fuchsia.kernel/Counter.
318    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
319        let protocol_name = <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
320        Self { client: fidl::client::Client::new(channel, protocol_name) }
321    }
322
323    /// Get a Stream of events from the remote end of the protocol.
324    ///
325    /// # Panics
326    ///
327    /// Panics if the event stream was already taken.
328    pub fn take_event_stream(&self) -> CounterEventStream {
329        CounterEventStream { event_receiver: self.client.take_event_receiver() }
330    }
331
332    /// Retrives a VMO containining summarized kcounter data. The vmo returned
333    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
334    pub fn r#get_inspect_vmo(
335        &self,
336    ) -> fidl::client::QueryResponseFut<
337        (i32, fidl_fuchsia_mem::Buffer),
338        fidl::encoding::DefaultFuchsiaResourceDialect,
339    > {
340        CounterProxyInterface::r#get_inspect_vmo(self)
341    }
342
343    /// Request that the previously-returned VMO buffer's data be updated. The
344    /// data may not be updated if it was already recently updated (updates are
345    /// limited to an unspecified rate, but approximately every few seconds).
346    pub fn r#update_inspect_vmo(
347        &self,
348    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
349        CounterProxyInterface::r#update_inspect_vmo(self)
350    }
351}
352
353impl CounterProxyInterface for CounterProxy {
354    type GetInspectVmoResponseFut = fidl::client::QueryResponseFut<
355        (i32, fidl_fuchsia_mem::Buffer),
356        fidl::encoding::DefaultFuchsiaResourceDialect,
357    >;
358    fn r#get_inspect_vmo(&self) -> Self::GetInspectVmoResponseFut {
359        fn _decode(
360            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
361        ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
362            let _response = fidl::client::decode_transaction_body::<
363                CounterGetInspectVmoResponse,
364                fidl::encoding::DefaultFuchsiaResourceDialect,
365                0x6ea9b2e6b2791b81,
366            >(_buf?)?;
367            Ok((_response.status, _response.buffer))
368        }
369        self.client
370            .send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, fidl_fuchsia_mem::Buffer)>(
371                (),
372                0x6ea9b2e6b2791b81,
373                fidl::encoding::DynamicFlags::empty(),
374                _decode,
375            )
376    }
377
378    type UpdateInspectVmoResponseFut =
379        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
380    fn r#update_inspect_vmo(&self) -> Self::UpdateInspectVmoResponseFut {
381        fn _decode(
382            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
383        ) -> Result<i32, fidl::Error> {
384            let _response = fidl::client::decode_transaction_body::<
385                CounterUpdateInspectVmoResponse,
386                fidl::encoding::DefaultFuchsiaResourceDialect,
387                0x1d25eb7995a0539f,
388            >(_buf?)?;
389            Ok(_response.status)
390        }
391        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
392            (),
393            0x1d25eb7995a0539f,
394            fidl::encoding::DynamicFlags::empty(),
395            _decode,
396        )
397    }
398}
399
400pub struct CounterEventStream {
401    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
402}
403
404impl std::marker::Unpin for CounterEventStream {}
405
406impl futures::stream::FusedStream for CounterEventStream {
407    fn is_terminated(&self) -> bool {
408        self.event_receiver.is_terminated()
409    }
410}
411
412impl futures::Stream for CounterEventStream {
413    type Item = Result<CounterEvent, fidl::Error>;
414
415    fn poll_next(
416        mut self: std::pin::Pin<&mut Self>,
417        cx: &mut std::task::Context<'_>,
418    ) -> std::task::Poll<Option<Self::Item>> {
419        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
420            &mut self.event_receiver,
421            cx
422        )?) {
423            Some(buf) => std::task::Poll::Ready(Some(CounterEvent::decode(buf))),
424            None => std::task::Poll::Ready(None),
425        }
426    }
427}
428
429#[derive(Debug)]
430pub enum CounterEvent {}
431
432impl CounterEvent {
433    /// Decodes a message buffer as a [`CounterEvent`].
434    fn decode(
435        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
436    ) -> Result<CounterEvent, fidl::Error> {
437        let (bytes, _handles) = buf.split_mut();
438        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
439        debug_assert_eq!(tx_header.tx_id, 0);
440        match tx_header.ordinal {
441            _ => Err(fidl::Error::UnknownOrdinal {
442                ordinal: tx_header.ordinal,
443                protocol_name: <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
444            }),
445        }
446    }
447}
448
449/// A Stream of incoming requests for fuchsia.kernel/Counter.
450pub struct CounterRequestStream {
451    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
452    is_terminated: bool,
453}
454
455impl std::marker::Unpin for CounterRequestStream {}
456
457impl futures::stream::FusedStream for CounterRequestStream {
458    fn is_terminated(&self) -> bool {
459        self.is_terminated
460    }
461}
462
463impl fidl::endpoints::RequestStream for CounterRequestStream {
464    type Protocol = CounterMarker;
465    type ControlHandle = CounterControlHandle;
466
467    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
468        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
469    }
470
471    fn control_handle(&self) -> Self::ControlHandle {
472        CounterControlHandle { inner: self.inner.clone() }
473    }
474
475    fn into_inner(
476        self,
477    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
478    {
479        (self.inner, self.is_terminated)
480    }
481
482    fn from_inner(
483        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
484        is_terminated: bool,
485    ) -> Self {
486        Self { inner, is_terminated }
487    }
488}
489
490impl futures::Stream for CounterRequestStream {
491    type Item = Result<CounterRequest, fidl::Error>;
492
493    fn poll_next(
494        mut self: std::pin::Pin<&mut Self>,
495        cx: &mut std::task::Context<'_>,
496    ) -> std::task::Poll<Option<Self::Item>> {
497        let this = &mut *self;
498        if this.inner.check_shutdown(cx) {
499            this.is_terminated = true;
500            return std::task::Poll::Ready(None);
501        }
502        if this.is_terminated {
503            panic!("polled CounterRequestStream after completion");
504        }
505        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
506            |bytes, handles| {
507                match this.inner.channel().read_etc(cx, bytes, handles) {
508                    std::task::Poll::Ready(Ok(())) => {}
509                    std::task::Poll::Pending => return std::task::Poll::Pending,
510                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
511                        this.is_terminated = true;
512                        return std::task::Poll::Ready(None);
513                    }
514                    std::task::Poll::Ready(Err(e)) => {
515                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
516                            e.into(),
517                        ))));
518                    }
519                }
520
521                // A message has been received from the channel
522                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
523
524                std::task::Poll::Ready(Some(match header.ordinal {
525                    0x6ea9b2e6b2791b81 => {
526                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
527                        let mut req = fidl::new_empty!(
528                            fidl::encoding::EmptyPayload,
529                            fidl::encoding::DefaultFuchsiaResourceDialect
530                        );
531                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
532                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
533                        Ok(CounterRequest::GetInspectVmo {
534                            responder: CounterGetInspectVmoResponder {
535                                control_handle: std::mem::ManuallyDrop::new(control_handle),
536                                tx_id: header.tx_id,
537                            },
538                        })
539                    }
540                    0x1d25eb7995a0539f => {
541                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
542                        let mut req = fidl::new_empty!(
543                            fidl::encoding::EmptyPayload,
544                            fidl::encoding::DefaultFuchsiaResourceDialect
545                        );
546                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
547                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
548                        Ok(CounterRequest::UpdateInspectVmo {
549                            responder: CounterUpdateInspectVmoResponder {
550                                control_handle: std::mem::ManuallyDrop::new(control_handle),
551                                tx_id: header.tx_id,
552                            },
553                        })
554                    }
555                    _ => Err(fidl::Error::UnknownOrdinal {
556                        ordinal: header.ordinal,
557                        protocol_name:
558                            <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
559                    }),
560                }))
561            },
562        )
563    }
564}
565
566/// Protocol for retrieving kcounter information.
567#[derive(Debug)]
568pub enum CounterRequest {
569    /// Retrives a VMO containining summarized kcounter data. The vmo returned
570    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
571    GetInspectVmo { responder: CounterGetInspectVmoResponder },
572    /// Request that the previously-returned VMO buffer's data be updated. The
573    /// data may not be updated if it was already recently updated (updates are
574    /// limited to an unspecified rate, but approximately every few seconds).
575    UpdateInspectVmo { responder: CounterUpdateInspectVmoResponder },
576}
577
578impl CounterRequest {
579    #[allow(irrefutable_let_patterns)]
580    pub fn into_get_inspect_vmo(self) -> Option<(CounterGetInspectVmoResponder)> {
581        if let CounterRequest::GetInspectVmo { responder } = self {
582            Some((responder))
583        } else {
584            None
585        }
586    }
587
588    #[allow(irrefutable_let_patterns)]
589    pub fn into_update_inspect_vmo(self) -> Option<(CounterUpdateInspectVmoResponder)> {
590        if let CounterRequest::UpdateInspectVmo { responder } = self {
591            Some((responder))
592        } else {
593            None
594        }
595    }
596
597    /// Name of the method defined in FIDL
598    pub fn method_name(&self) -> &'static str {
599        match *self {
600            CounterRequest::GetInspectVmo { .. } => "get_inspect_vmo",
601            CounterRequest::UpdateInspectVmo { .. } => "update_inspect_vmo",
602        }
603    }
604}
605
606#[derive(Debug, Clone)]
607pub struct CounterControlHandle {
608    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
609}
610
611impl fidl::endpoints::ControlHandle for CounterControlHandle {
612    fn shutdown(&self) {
613        self.inner.shutdown()
614    }
615    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
616        self.inner.shutdown_with_epitaph(status)
617    }
618
619    fn is_closed(&self) -> bool {
620        self.inner.channel().is_closed()
621    }
622    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
623        self.inner.channel().on_closed()
624    }
625
626    #[cfg(target_os = "fuchsia")]
627    fn signal_peer(
628        &self,
629        clear_mask: zx::Signals,
630        set_mask: zx::Signals,
631    ) -> Result<(), zx_status::Status> {
632        use fidl::Peered;
633        self.inner.channel().signal_peer(clear_mask, set_mask)
634    }
635}
636
637impl CounterControlHandle {}
638
639#[must_use = "FIDL methods require a response to be sent"]
640#[derive(Debug)]
641pub struct CounterGetInspectVmoResponder {
642    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
643    tx_id: u32,
644}
645
646/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
647/// if the responder is dropped without sending a response, so that the client
648/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
649impl std::ops::Drop for CounterGetInspectVmoResponder {
650    fn drop(&mut self) {
651        self.control_handle.shutdown();
652        // Safety: drops once, never accessed again
653        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
654    }
655}
656
657impl fidl::endpoints::Responder for CounterGetInspectVmoResponder {
658    type ControlHandle = CounterControlHandle;
659
660    fn control_handle(&self) -> &CounterControlHandle {
661        &self.control_handle
662    }
663
664    fn drop_without_shutdown(mut self) {
665        // Safety: drops once, never accessed again due to mem::forget
666        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
667        // Prevent Drop from running (which would shut down the channel)
668        std::mem::forget(self);
669    }
670}
671
672impl CounterGetInspectVmoResponder {
673    /// Sends a response to the FIDL transaction.
674    ///
675    /// Sets the channel to shutdown if an error occurs.
676    pub fn send(
677        self,
678        mut status: i32,
679        mut buffer: fidl_fuchsia_mem::Buffer,
680    ) -> Result<(), fidl::Error> {
681        let _result = self.send_raw(status, buffer);
682        if _result.is_err() {
683            self.control_handle.shutdown();
684        }
685        self.drop_without_shutdown();
686        _result
687    }
688
689    /// Similar to "send" but does not shutdown the channel if an error occurs.
690    pub fn send_no_shutdown_on_err(
691        self,
692        mut status: i32,
693        mut buffer: fidl_fuchsia_mem::Buffer,
694    ) -> Result<(), fidl::Error> {
695        let _result = self.send_raw(status, buffer);
696        self.drop_without_shutdown();
697        _result
698    }
699
700    fn send_raw(
701        &self,
702        mut status: i32,
703        mut buffer: fidl_fuchsia_mem::Buffer,
704    ) -> Result<(), fidl::Error> {
705        self.control_handle.inner.send::<CounterGetInspectVmoResponse>(
706            (status, &mut buffer),
707            self.tx_id,
708            0x6ea9b2e6b2791b81,
709            fidl::encoding::DynamicFlags::empty(),
710        )
711    }
712}
713
714#[must_use = "FIDL methods require a response to be sent"]
715#[derive(Debug)]
716pub struct CounterUpdateInspectVmoResponder {
717    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
718    tx_id: u32,
719}
720
721/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
722/// if the responder is dropped without sending a response, so that the client
723/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
724impl std::ops::Drop for CounterUpdateInspectVmoResponder {
725    fn drop(&mut self) {
726        self.control_handle.shutdown();
727        // Safety: drops once, never accessed again
728        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
729    }
730}
731
732impl fidl::endpoints::Responder for CounterUpdateInspectVmoResponder {
733    type ControlHandle = CounterControlHandle;
734
735    fn control_handle(&self) -> &CounterControlHandle {
736        &self.control_handle
737    }
738
739    fn drop_without_shutdown(mut self) {
740        // Safety: drops once, never accessed again due to mem::forget
741        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
742        // Prevent Drop from running (which would shut down the channel)
743        std::mem::forget(self);
744    }
745}
746
747impl CounterUpdateInspectVmoResponder {
748    /// Sends a response to the FIDL transaction.
749    ///
750    /// Sets the channel to shutdown if an error occurs.
751    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
752        let _result = self.send_raw(status);
753        if _result.is_err() {
754            self.control_handle.shutdown();
755        }
756        self.drop_without_shutdown();
757        _result
758    }
759
760    /// Similar to "send" but does not shutdown the channel if an error occurs.
761    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
762        let _result = self.send_raw(status);
763        self.drop_without_shutdown();
764        _result
765    }
766
767    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
768        self.control_handle.inner.send::<CounterUpdateInspectVmoResponse>(
769            (status,),
770            self.tx_id,
771            0x1d25eb7995a0539f,
772            fidl::encoding::DynamicFlags::empty(),
773        )
774    }
775}
776
777#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
778pub struct CpuResourceMarker;
779
780impl fidl::endpoints::ProtocolMarker for CpuResourceMarker {
781    type Proxy = CpuResourceProxy;
782    type RequestStream = CpuResourceRequestStream;
783    #[cfg(target_os = "fuchsia")]
784    type SynchronousProxy = CpuResourceSynchronousProxy;
785
786    const DEBUG_NAME: &'static str = "fuchsia.kernel.CpuResource";
787}
788impl fidl::endpoints::DiscoverableProtocolMarker for CpuResourceMarker {}
789
790pub trait CpuResourceProxyInterface: Send + Sync {
791    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
792    fn r#get(&self) -> Self::GetResponseFut;
793}
794#[derive(Debug)]
795#[cfg(target_os = "fuchsia")]
796pub struct CpuResourceSynchronousProxy {
797    client: fidl::client::sync::Client,
798}
799
800#[cfg(target_os = "fuchsia")]
801impl fidl::endpoints::SynchronousProxy for CpuResourceSynchronousProxy {
802    type Proxy = CpuResourceProxy;
803    type Protocol = CpuResourceMarker;
804
805    fn from_channel(inner: fidl::Channel) -> Self {
806        Self::new(inner)
807    }
808
809    fn into_channel(self) -> fidl::Channel {
810        self.client.into_channel()
811    }
812
813    fn as_channel(&self) -> &fidl::Channel {
814        self.client.as_channel()
815    }
816}
817
818#[cfg(target_os = "fuchsia")]
819impl CpuResourceSynchronousProxy {
820    pub fn new(channel: fidl::Channel) -> Self {
821        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
822        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
823    }
824
825    pub fn into_channel(self) -> fidl::Channel {
826        self.client.into_channel()
827    }
828
829    /// Waits until an event arrives and returns it. It is safe for other
830    /// threads to make concurrent requests while waiting for an event.
831    pub fn wait_for_event(
832        &self,
833        deadline: zx::MonotonicInstant,
834    ) -> Result<CpuResourceEvent, fidl::Error> {
835        CpuResourceEvent::decode(self.client.wait_for_event(deadline)?)
836    }
837
838    /// Get a CPU resource handle.
839    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
840        let _response =
841            self.client.send_query::<fidl::encoding::EmptyPayload, CpuResourceGetResponse>(
842                (),
843                0x41e1103acf4215e4,
844                fidl::encoding::DynamicFlags::empty(),
845                ___deadline,
846            )?;
847        Ok(_response.resource)
848    }
849}
850
851#[cfg(target_os = "fuchsia")]
852impl From<CpuResourceSynchronousProxy> for zx::Handle {
853    fn from(value: CpuResourceSynchronousProxy) -> Self {
854        value.into_channel().into()
855    }
856}
857
858#[cfg(target_os = "fuchsia")]
859impl From<fidl::Channel> for CpuResourceSynchronousProxy {
860    fn from(value: fidl::Channel) -> Self {
861        Self::new(value)
862    }
863}
864
865#[cfg(target_os = "fuchsia")]
866impl fidl::endpoints::FromClient for CpuResourceSynchronousProxy {
867    type Protocol = CpuResourceMarker;
868
869    fn from_client(value: fidl::endpoints::ClientEnd<CpuResourceMarker>) -> Self {
870        Self::new(value.into_channel())
871    }
872}
873
874#[derive(Debug, Clone)]
875pub struct CpuResourceProxy {
876    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
877}
878
879impl fidl::endpoints::Proxy for CpuResourceProxy {
880    type Protocol = CpuResourceMarker;
881
882    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
883        Self::new(inner)
884    }
885
886    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
887        self.client.into_channel().map_err(|client| Self { client })
888    }
889
890    fn as_channel(&self) -> &::fidl::AsyncChannel {
891        self.client.as_channel()
892    }
893}
894
895impl CpuResourceProxy {
896    /// Create a new Proxy for fuchsia.kernel/CpuResource.
897    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
898        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
899        Self { client: fidl::client::Client::new(channel, protocol_name) }
900    }
901
902    /// Get a Stream of events from the remote end of the protocol.
903    ///
904    /// # Panics
905    ///
906    /// Panics if the event stream was already taken.
907    pub fn take_event_stream(&self) -> CpuResourceEventStream {
908        CpuResourceEventStream { event_receiver: self.client.take_event_receiver() }
909    }
910
911    /// Get a CPU resource handle.
912    pub fn r#get(
913        &self,
914    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
915    {
916        CpuResourceProxyInterface::r#get(self)
917    }
918}
919
920impl CpuResourceProxyInterface for CpuResourceProxy {
921    type GetResponseFut = fidl::client::QueryResponseFut<
922        fidl::Resource,
923        fidl::encoding::DefaultFuchsiaResourceDialect,
924    >;
925    fn r#get(&self) -> Self::GetResponseFut {
926        fn _decode(
927            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
928        ) -> Result<fidl::Resource, fidl::Error> {
929            let _response = fidl::client::decode_transaction_body::<
930                CpuResourceGetResponse,
931                fidl::encoding::DefaultFuchsiaResourceDialect,
932                0x41e1103acf4215e4,
933            >(_buf?)?;
934            Ok(_response.resource)
935        }
936        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
937            (),
938            0x41e1103acf4215e4,
939            fidl::encoding::DynamicFlags::empty(),
940            _decode,
941        )
942    }
943}
944
945pub struct CpuResourceEventStream {
946    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
947}
948
949impl std::marker::Unpin for CpuResourceEventStream {}
950
951impl futures::stream::FusedStream for CpuResourceEventStream {
952    fn is_terminated(&self) -> bool {
953        self.event_receiver.is_terminated()
954    }
955}
956
957impl futures::Stream for CpuResourceEventStream {
958    type Item = Result<CpuResourceEvent, fidl::Error>;
959
960    fn poll_next(
961        mut self: std::pin::Pin<&mut Self>,
962        cx: &mut std::task::Context<'_>,
963    ) -> std::task::Poll<Option<Self::Item>> {
964        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
965            &mut self.event_receiver,
966            cx
967        )?) {
968            Some(buf) => std::task::Poll::Ready(Some(CpuResourceEvent::decode(buf))),
969            None => std::task::Poll::Ready(None),
970        }
971    }
972}
973
974#[derive(Debug)]
975pub enum CpuResourceEvent {}
976
977impl CpuResourceEvent {
978    /// Decodes a message buffer as a [`CpuResourceEvent`].
979    fn decode(
980        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
981    ) -> Result<CpuResourceEvent, fidl::Error> {
982        let (bytes, _handles) = buf.split_mut();
983        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
984        debug_assert_eq!(tx_header.tx_id, 0);
985        match tx_header.ordinal {
986            _ => Err(fidl::Error::UnknownOrdinal {
987                ordinal: tx_header.ordinal,
988                protocol_name: <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
989            }),
990        }
991    }
992}
993
994/// A Stream of incoming requests for fuchsia.kernel/CpuResource.
995pub struct CpuResourceRequestStream {
996    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
997    is_terminated: bool,
998}
999
1000impl std::marker::Unpin for CpuResourceRequestStream {}
1001
1002impl futures::stream::FusedStream for CpuResourceRequestStream {
1003    fn is_terminated(&self) -> bool {
1004        self.is_terminated
1005    }
1006}
1007
1008impl fidl::endpoints::RequestStream for CpuResourceRequestStream {
1009    type Protocol = CpuResourceMarker;
1010    type ControlHandle = CpuResourceControlHandle;
1011
1012    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1013        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1014    }
1015
1016    fn control_handle(&self) -> Self::ControlHandle {
1017        CpuResourceControlHandle { inner: self.inner.clone() }
1018    }
1019
1020    fn into_inner(
1021        self,
1022    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1023    {
1024        (self.inner, self.is_terminated)
1025    }
1026
1027    fn from_inner(
1028        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1029        is_terminated: bool,
1030    ) -> Self {
1031        Self { inner, is_terminated }
1032    }
1033}
1034
1035impl futures::Stream for CpuResourceRequestStream {
1036    type Item = Result<CpuResourceRequest, fidl::Error>;
1037
1038    fn poll_next(
1039        mut self: std::pin::Pin<&mut Self>,
1040        cx: &mut std::task::Context<'_>,
1041    ) -> std::task::Poll<Option<Self::Item>> {
1042        let this = &mut *self;
1043        if this.inner.check_shutdown(cx) {
1044            this.is_terminated = true;
1045            return std::task::Poll::Ready(None);
1046        }
1047        if this.is_terminated {
1048            panic!("polled CpuResourceRequestStream after completion");
1049        }
1050        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1051            |bytes, handles| {
1052                match this.inner.channel().read_etc(cx, bytes, handles) {
1053                    std::task::Poll::Ready(Ok(())) => {}
1054                    std::task::Poll::Pending => return std::task::Poll::Pending,
1055                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1056                        this.is_terminated = true;
1057                        return std::task::Poll::Ready(None);
1058                    }
1059                    std::task::Poll::Ready(Err(e)) => {
1060                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1061                            e.into(),
1062                        ))));
1063                    }
1064                }
1065
1066                // A message has been received from the channel
1067                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1068
1069                std::task::Poll::Ready(Some(match header.ordinal {
1070                    0x41e1103acf4215e4 => {
1071                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1072                        let mut req = fidl::new_empty!(
1073                            fidl::encoding::EmptyPayload,
1074                            fidl::encoding::DefaultFuchsiaResourceDialect
1075                        );
1076                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1077                        let control_handle = CpuResourceControlHandle { inner: this.inner.clone() };
1078                        Ok(CpuResourceRequest::Get {
1079                            responder: CpuResourceGetResponder {
1080                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1081                                tx_id: header.tx_id,
1082                            },
1083                        })
1084                    }
1085                    _ => Err(fidl::Error::UnknownOrdinal {
1086                        ordinal: header.ordinal,
1087                        protocol_name:
1088                            <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1089                    }),
1090                }))
1091            },
1092        )
1093    }
1094}
1095
1096/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
1097/// `ZX_RSRC_SYSTEM_CPU_BASE`.
1098#[derive(Debug)]
1099pub enum CpuResourceRequest {
1100    /// Get a CPU resource handle.
1101    Get { responder: CpuResourceGetResponder },
1102}
1103
1104impl CpuResourceRequest {
1105    #[allow(irrefutable_let_patterns)]
1106    pub fn into_get(self) -> Option<(CpuResourceGetResponder)> {
1107        if let CpuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
1108    }
1109
1110    /// Name of the method defined in FIDL
1111    pub fn method_name(&self) -> &'static str {
1112        match *self {
1113            CpuResourceRequest::Get { .. } => "get",
1114        }
1115    }
1116}
1117
1118#[derive(Debug, Clone)]
1119pub struct CpuResourceControlHandle {
1120    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1121}
1122
1123impl fidl::endpoints::ControlHandle for CpuResourceControlHandle {
1124    fn shutdown(&self) {
1125        self.inner.shutdown()
1126    }
1127    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1128        self.inner.shutdown_with_epitaph(status)
1129    }
1130
1131    fn is_closed(&self) -> bool {
1132        self.inner.channel().is_closed()
1133    }
1134    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1135        self.inner.channel().on_closed()
1136    }
1137
1138    #[cfg(target_os = "fuchsia")]
1139    fn signal_peer(
1140        &self,
1141        clear_mask: zx::Signals,
1142        set_mask: zx::Signals,
1143    ) -> Result<(), zx_status::Status> {
1144        use fidl::Peered;
1145        self.inner.channel().signal_peer(clear_mask, set_mask)
1146    }
1147}
1148
1149impl CpuResourceControlHandle {}
1150
1151#[must_use = "FIDL methods require a response to be sent"]
1152#[derive(Debug)]
1153pub struct CpuResourceGetResponder {
1154    control_handle: std::mem::ManuallyDrop<CpuResourceControlHandle>,
1155    tx_id: u32,
1156}
1157
1158/// Set the the channel to be shutdown (see [`CpuResourceControlHandle::shutdown`])
1159/// if the responder is dropped without sending a response, so that the client
1160/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1161impl std::ops::Drop for CpuResourceGetResponder {
1162    fn drop(&mut self) {
1163        self.control_handle.shutdown();
1164        // Safety: drops once, never accessed again
1165        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1166    }
1167}
1168
1169impl fidl::endpoints::Responder for CpuResourceGetResponder {
1170    type ControlHandle = CpuResourceControlHandle;
1171
1172    fn control_handle(&self) -> &CpuResourceControlHandle {
1173        &self.control_handle
1174    }
1175
1176    fn drop_without_shutdown(mut self) {
1177        // Safety: drops once, never accessed again due to mem::forget
1178        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1179        // Prevent Drop from running (which would shut down the channel)
1180        std::mem::forget(self);
1181    }
1182}
1183
1184impl CpuResourceGetResponder {
1185    /// Sends a response to the FIDL transaction.
1186    ///
1187    /// Sets the channel to shutdown if an error occurs.
1188    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1189        let _result = self.send_raw(resource);
1190        if _result.is_err() {
1191            self.control_handle.shutdown();
1192        }
1193        self.drop_without_shutdown();
1194        _result
1195    }
1196
1197    /// Similar to "send" but does not shutdown the channel if an error occurs.
1198    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1199        let _result = self.send_raw(resource);
1200        self.drop_without_shutdown();
1201        _result
1202    }
1203
1204    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1205        self.control_handle.inner.send::<CpuResourceGetResponse>(
1206            (resource,),
1207            self.tx_id,
1208            0x41e1103acf4215e4,
1209            fidl::encoding::DynamicFlags::empty(),
1210        )
1211    }
1212}
1213
1214#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1215pub struct DebugBrokerMarker;
1216
1217impl fidl::endpoints::ProtocolMarker for DebugBrokerMarker {
1218    type Proxy = DebugBrokerProxy;
1219    type RequestStream = DebugBrokerRequestStream;
1220    #[cfg(target_os = "fuchsia")]
1221    type SynchronousProxy = DebugBrokerSynchronousProxy;
1222
1223    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugBroker";
1224}
1225impl fidl::endpoints::DiscoverableProtocolMarker for DebugBrokerMarker {}
1226
1227pub trait DebugBrokerProxyInterface: Send + Sync {
1228    type SendDebugCommandResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1229    fn r#send_debug_command(&self, command: &str) -> Self::SendDebugCommandResponseFut;
1230    type SetTracingEnabledResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1231    fn r#set_tracing_enabled(&self, enabled: bool) -> Self::SetTracingEnabledResponseFut;
1232}
1233#[derive(Debug)]
1234#[cfg(target_os = "fuchsia")]
1235pub struct DebugBrokerSynchronousProxy {
1236    client: fidl::client::sync::Client,
1237}
1238
1239#[cfg(target_os = "fuchsia")]
1240impl fidl::endpoints::SynchronousProxy for DebugBrokerSynchronousProxy {
1241    type Proxy = DebugBrokerProxy;
1242    type Protocol = DebugBrokerMarker;
1243
1244    fn from_channel(inner: fidl::Channel) -> Self {
1245        Self::new(inner)
1246    }
1247
1248    fn into_channel(self) -> fidl::Channel {
1249        self.client.into_channel()
1250    }
1251
1252    fn as_channel(&self) -> &fidl::Channel {
1253        self.client.as_channel()
1254    }
1255}
1256
1257#[cfg(target_os = "fuchsia")]
1258impl DebugBrokerSynchronousProxy {
1259    pub fn new(channel: fidl::Channel) -> Self {
1260        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1261        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1262    }
1263
1264    pub fn into_channel(self) -> fidl::Channel {
1265        self.client.into_channel()
1266    }
1267
1268    /// Waits until an event arrives and returns it. It is safe for other
1269    /// threads to make concurrent requests while waiting for an event.
1270    pub fn wait_for_event(
1271        &self,
1272        deadline: zx::MonotonicInstant,
1273    ) -> Result<DebugBrokerEvent, fidl::Error> {
1274        DebugBrokerEvent::decode(self.client.wait_for_event(deadline)?)
1275    }
1276
1277    /// Pass debug command through to the kernel shell.
1278    /// Look at zx_debug_send_command syscall handling to find valid values.
1279    pub fn r#send_debug_command(
1280        &self,
1281        mut command: &str,
1282        ___deadline: zx::MonotonicInstant,
1283    ) -> Result<i32, fidl::Error> {
1284        let _response = self
1285            .client
1286            .send_query::<DebugBrokerSendDebugCommandRequest, DebugBrokerSendDebugCommandResponse>(
1287                (command,),
1288                0x1ee270f83b5d6ff6,
1289                fidl::encoding::DynamicFlags::empty(),
1290                ___deadline,
1291            )?;
1292        Ok(_response.status)
1293    }
1294
1295    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1296    pub fn r#set_tracing_enabled(
1297        &self,
1298        mut enabled: bool,
1299        ___deadline: zx::MonotonicInstant,
1300    ) -> Result<i32, fidl::Error> {
1301        let _response = self.client.send_query::<
1302            DebugBrokerSetTracingEnabledRequest,
1303            DebugBrokerSetTracingEnabledResponse,
1304        >(
1305            (enabled,),
1306            0x12e368d05329b30e,
1307            fidl::encoding::DynamicFlags::empty(),
1308            ___deadline,
1309        )?;
1310        Ok(_response.status)
1311    }
1312}
1313
1314#[cfg(target_os = "fuchsia")]
1315impl From<DebugBrokerSynchronousProxy> for zx::Handle {
1316    fn from(value: DebugBrokerSynchronousProxy) -> Self {
1317        value.into_channel().into()
1318    }
1319}
1320
1321#[cfg(target_os = "fuchsia")]
1322impl From<fidl::Channel> for DebugBrokerSynchronousProxy {
1323    fn from(value: fidl::Channel) -> Self {
1324        Self::new(value)
1325    }
1326}
1327
1328#[cfg(target_os = "fuchsia")]
1329impl fidl::endpoints::FromClient for DebugBrokerSynchronousProxy {
1330    type Protocol = DebugBrokerMarker;
1331
1332    fn from_client(value: fidl::endpoints::ClientEnd<DebugBrokerMarker>) -> Self {
1333        Self::new(value.into_channel())
1334    }
1335}
1336
1337#[derive(Debug, Clone)]
1338pub struct DebugBrokerProxy {
1339    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1340}
1341
1342impl fidl::endpoints::Proxy for DebugBrokerProxy {
1343    type Protocol = DebugBrokerMarker;
1344
1345    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1346        Self::new(inner)
1347    }
1348
1349    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1350        self.client.into_channel().map_err(|client| Self { client })
1351    }
1352
1353    fn as_channel(&self) -> &::fidl::AsyncChannel {
1354        self.client.as_channel()
1355    }
1356}
1357
1358impl DebugBrokerProxy {
1359    /// Create a new Proxy for fuchsia.kernel/DebugBroker.
1360    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1361        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1362        Self { client: fidl::client::Client::new(channel, protocol_name) }
1363    }
1364
1365    /// Get a Stream of events from the remote end of the protocol.
1366    ///
1367    /// # Panics
1368    ///
1369    /// Panics if the event stream was already taken.
1370    pub fn take_event_stream(&self) -> DebugBrokerEventStream {
1371        DebugBrokerEventStream { event_receiver: self.client.take_event_receiver() }
1372    }
1373
1374    /// Pass debug command through to the kernel shell.
1375    /// Look at zx_debug_send_command syscall handling to find valid values.
1376    pub fn r#send_debug_command(
1377        &self,
1378        mut command: &str,
1379    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1380        DebugBrokerProxyInterface::r#send_debug_command(self, command)
1381    }
1382
1383    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1384    pub fn r#set_tracing_enabled(
1385        &self,
1386        mut enabled: bool,
1387    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1388        DebugBrokerProxyInterface::r#set_tracing_enabled(self, enabled)
1389    }
1390}
1391
1392impl DebugBrokerProxyInterface for DebugBrokerProxy {
1393    type SendDebugCommandResponseFut =
1394        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1395    fn r#send_debug_command(&self, mut command: &str) -> Self::SendDebugCommandResponseFut {
1396        fn _decode(
1397            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1398        ) -> Result<i32, fidl::Error> {
1399            let _response = fidl::client::decode_transaction_body::<
1400                DebugBrokerSendDebugCommandResponse,
1401                fidl::encoding::DefaultFuchsiaResourceDialect,
1402                0x1ee270f83b5d6ff6,
1403            >(_buf?)?;
1404            Ok(_response.status)
1405        }
1406        self.client.send_query_and_decode::<DebugBrokerSendDebugCommandRequest, i32>(
1407            (command,),
1408            0x1ee270f83b5d6ff6,
1409            fidl::encoding::DynamicFlags::empty(),
1410            _decode,
1411        )
1412    }
1413
1414    type SetTracingEnabledResponseFut =
1415        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1416    fn r#set_tracing_enabled(&self, mut enabled: bool) -> Self::SetTracingEnabledResponseFut {
1417        fn _decode(
1418            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1419        ) -> Result<i32, fidl::Error> {
1420            let _response = fidl::client::decode_transaction_body::<
1421                DebugBrokerSetTracingEnabledResponse,
1422                fidl::encoding::DefaultFuchsiaResourceDialect,
1423                0x12e368d05329b30e,
1424            >(_buf?)?;
1425            Ok(_response.status)
1426        }
1427        self.client.send_query_and_decode::<DebugBrokerSetTracingEnabledRequest, i32>(
1428            (enabled,),
1429            0x12e368d05329b30e,
1430            fidl::encoding::DynamicFlags::empty(),
1431            _decode,
1432        )
1433    }
1434}
1435
1436pub struct DebugBrokerEventStream {
1437    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1438}
1439
1440impl std::marker::Unpin for DebugBrokerEventStream {}
1441
1442impl futures::stream::FusedStream for DebugBrokerEventStream {
1443    fn is_terminated(&self) -> bool {
1444        self.event_receiver.is_terminated()
1445    }
1446}
1447
1448impl futures::Stream for DebugBrokerEventStream {
1449    type Item = Result<DebugBrokerEvent, fidl::Error>;
1450
1451    fn poll_next(
1452        mut self: std::pin::Pin<&mut Self>,
1453        cx: &mut std::task::Context<'_>,
1454    ) -> std::task::Poll<Option<Self::Item>> {
1455        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1456            &mut self.event_receiver,
1457            cx
1458        )?) {
1459            Some(buf) => std::task::Poll::Ready(Some(DebugBrokerEvent::decode(buf))),
1460            None => std::task::Poll::Ready(None),
1461        }
1462    }
1463}
1464
1465#[derive(Debug)]
1466pub enum DebugBrokerEvent {}
1467
1468impl DebugBrokerEvent {
1469    /// Decodes a message buffer as a [`DebugBrokerEvent`].
1470    fn decode(
1471        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1472    ) -> Result<DebugBrokerEvent, fidl::Error> {
1473        let (bytes, _handles) = buf.split_mut();
1474        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1475        debug_assert_eq!(tx_header.tx_id, 0);
1476        match tx_header.ordinal {
1477            _ => Err(fidl::Error::UnknownOrdinal {
1478                ordinal: tx_header.ordinal,
1479                protocol_name: <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1480            }),
1481        }
1482    }
1483}
1484
1485/// A Stream of incoming requests for fuchsia.kernel/DebugBroker.
1486pub struct DebugBrokerRequestStream {
1487    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1488    is_terminated: bool,
1489}
1490
1491impl std::marker::Unpin for DebugBrokerRequestStream {}
1492
1493impl futures::stream::FusedStream for DebugBrokerRequestStream {
1494    fn is_terminated(&self) -> bool {
1495        self.is_terminated
1496    }
1497}
1498
1499impl fidl::endpoints::RequestStream for DebugBrokerRequestStream {
1500    type Protocol = DebugBrokerMarker;
1501    type ControlHandle = DebugBrokerControlHandle;
1502
1503    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1504        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1505    }
1506
1507    fn control_handle(&self) -> Self::ControlHandle {
1508        DebugBrokerControlHandle { inner: self.inner.clone() }
1509    }
1510
1511    fn into_inner(
1512        self,
1513    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1514    {
1515        (self.inner, self.is_terminated)
1516    }
1517
1518    fn from_inner(
1519        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1520        is_terminated: bool,
1521    ) -> Self {
1522        Self { inner, is_terminated }
1523    }
1524}
1525
1526impl futures::Stream for DebugBrokerRequestStream {
1527    type Item = Result<DebugBrokerRequest, fidl::Error>;
1528
1529    fn poll_next(
1530        mut self: std::pin::Pin<&mut Self>,
1531        cx: &mut std::task::Context<'_>,
1532    ) -> std::task::Poll<Option<Self::Item>> {
1533        let this = &mut *self;
1534        if this.inner.check_shutdown(cx) {
1535            this.is_terminated = true;
1536            return std::task::Poll::Ready(None);
1537        }
1538        if this.is_terminated {
1539            panic!("polled DebugBrokerRequestStream after completion");
1540        }
1541        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1542            |bytes, handles| {
1543                match this.inner.channel().read_etc(cx, bytes, handles) {
1544                    std::task::Poll::Ready(Ok(())) => {}
1545                    std::task::Poll::Pending => return std::task::Poll::Pending,
1546                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1547                        this.is_terminated = true;
1548                        return std::task::Poll::Ready(None);
1549                    }
1550                    std::task::Poll::Ready(Err(e)) => {
1551                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1552                            e.into(),
1553                        ))));
1554                    }
1555                }
1556
1557                // A message has been received from the channel
1558                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1559
1560                std::task::Poll::Ready(Some(match header.ordinal {
1561                    0x1ee270f83b5d6ff6 => {
1562                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1563                        let mut req = fidl::new_empty!(
1564                            DebugBrokerSendDebugCommandRequest,
1565                            fidl::encoding::DefaultFuchsiaResourceDialect
1566                        );
1567                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSendDebugCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1568                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1569                        Ok(DebugBrokerRequest::SendDebugCommand {
1570                            command: req.command,
1571
1572                            responder: DebugBrokerSendDebugCommandResponder {
1573                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1574                                tx_id: header.tx_id,
1575                            },
1576                        })
1577                    }
1578                    0x12e368d05329b30e => {
1579                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1580                        let mut req = fidl::new_empty!(
1581                            DebugBrokerSetTracingEnabledRequest,
1582                            fidl::encoding::DefaultFuchsiaResourceDialect
1583                        );
1584                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSetTracingEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1585                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1586                        Ok(DebugBrokerRequest::SetTracingEnabled {
1587                            enabled: req.enabled,
1588
1589                            responder: DebugBrokerSetTracingEnabledResponder {
1590                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1591                                tx_id: header.tx_id,
1592                            },
1593                        })
1594                    }
1595                    _ => Err(fidl::Error::UnknownOrdinal {
1596                        ordinal: header.ordinal,
1597                        protocol_name:
1598                            <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1599                    }),
1600                }))
1601            },
1602        )
1603    }
1604}
1605
1606/// Acts on behalf of the caller to interact with privileged debug system calls.
1607#[derive(Debug)]
1608pub enum DebugBrokerRequest {
1609    /// Pass debug command through to the kernel shell.
1610    /// Look at zx_debug_send_command syscall handling to find valid values.
1611    SendDebugCommand { command: String, responder: DebugBrokerSendDebugCommandResponder },
1612    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1613    SetTracingEnabled { enabled: bool, responder: DebugBrokerSetTracingEnabledResponder },
1614}
1615
1616impl DebugBrokerRequest {
1617    #[allow(irrefutable_let_patterns)]
1618    pub fn into_send_debug_command(self) -> Option<(String, DebugBrokerSendDebugCommandResponder)> {
1619        if let DebugBrokerRequest::SendDebugCommand { command, responder } = self {
1620            Some((command, responder))
1621        } else {
1622            None
1623        }
1624    }
1625
1626    #[allow(irrefutable_let_patterns)]
1627    pub fn into_set_tracing_enabled(self) -> Option<(bool, DebugBrokerSetTracingEnabledResponder)> {
1628        if let DebugBrokerRequest::SetTracingEnabled { enabled, responder } = self {
1629            Some((enabled, responder))
1630        } else {
1631            None
1632        }
1633    }
1634
1635    /// Name of the method defined in FIDL
1636    pub fn method_name(&self) -> &'static str {
1637        match *self {
1638            DebugBrokerRequest::SendDebugCommand { .. } => "send_debug_command",
1639            DebugBrokerRequest::SetTracingEnabled { .. } => "set_tracing_enabled",
1640        }
1641    }
1642}
1643
1644#[derive(Debug, Clone)]
1645pub struct DebugBrokerControlHandle {
1646    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1647}
1648
1649impl fidl::endpoints::ControlHandle for DebugBrokerControlHandle {
1650    fn shutdown(&self) {
1651        self.inner.shutdown()
1652    }
1653    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1654        self.inner.shutdown_with_epitaph(status)
1655    }
1656
1657    fn is_closed(&self) -> bool {
1658        self.inner.channel().is_closed()
1659    }
1660    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1661        self.inner.channel().on_closed()
1662    }
1663
1664    #[cfg(target_os = "fuchsia")]
1665    fn signal_peer(
1666        &self,
1667        clear_mask: zx::Signals,
1668        set_mask: zx::Signals,
1669    ) -> Result<(), zx_status::Status> {
1670        use fidl::Peered;
1671        self.inner.channel().signal_peer(clear_mask, set_mask)
1672    }
1673}
1674
1675impl DebugBrokerControlHandle {}
1676
1677#[must_use = "FIDL methods require a response to be sent"]
1678#[derive(Debug)]
1679pub struct DebugBrokerSendDebugCommandResponder {
1680    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1681    tx_id: u32,
1682}
1683
1684/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1685/// if the responder is dropped without sending a response, so that the client
1686/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1687impl std::ops::Drop for DebugBrokerSendDebugCommandResponder {
1688    fn drop(&mut self) {
1689        self.control_handle.shutdown();
1690        // Safety: drops once, never accessed again
1691        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1692    }
1693}
1694
1695impl fidl::endpoints::Responder for DebugBrokerSendDebugCommandResponder {
1696    type ControlHandle = DebugBrokerControlHandle;
1697
1698    fn control_handle(&self) -> &DebugBrokerControlHandle {
1699        &self.control_handle
1700    }
1701
1702    fn drop_without_shutdown(mut self) {
1703        // Safety: drops once, never accessed again due to mem::forget
1704        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1705        // Prevent Drop from running (which would shut down the channel)
1706        std::mem::forget(self);
1707    }
1708}
1709
1710impl DebugBrokerSendDebugCommandResponder {
1711    /// Sends a response to the FIDL transaction.
1712    ///
1713    /// Sets the channel to shutdown if an error occurs.
1714    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1715        let _result = self.send_raw(status);
1716        if _result.is_err() {
1717            self.control_handle.shutdown();
1718        }
1719        self.drop_without_shutdown();
1720        _result
1721    }
1722
1723    /// Similar to "send" but does not shutdown the channel if an error occurs.
1724    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1725        let _result = self.send_raw(status);
1726        self.drop_without_shutdown();
1727        _result
1728    }
1729
1730    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1731        self.control_handle.inner.send::<DebugBrokerSendDebugCommandResponse>(
1732            (status,),
1733            self.tx_id,
1734            0x1ee270f83b5d6ff6,
1735            fidl::encoding::DynamicFlags::empty(),
1736        )
1737    }
1738}
1739
1740#[must_use = "FIDL methods require a response to be sent"]
1741#[derive(Debug)]
1742pub struct DebugBrokerSetTracingEnabledResponder {
1743    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1744    tx_id: u32,
1745}
1746
1747/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1748/// if the responder is dropped without sending a response, so that the client
1749/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1750impl std::ops::Drop for DebugBrokerSetTracingEnabledResponder {
1751    fn drop(&mut self) {
1752        self.control_handle.shutdown();
1753        // Safety: drops once, never accessed again
1754        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1755    }
1756}
1757
1758impl fidl::endpoints::Responder for DebugBrokerSetTracingEnabledResponder {
1759    type ControlHandle = DebugBrokerControlHandle;
1760
1761    fn control_handle(&self) -> &DebugBrokerControlHandle {
1762        &self.control_handle
1763    }
1764
1765    fn drop_without_shutdown(mut self) {
1766        // Safety: drops once, never accessed again due to mem::forget
1767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1768        // Prevent Drop from running (which would shut down the channel)
1769        std::mem::forget(self);
1770    }
1771}
1772
1773impl DebugBrokerSetTracingEnabledResponder {
1774    /// Sends a response to the FIDL transaction.
1775    ///
1776    /// Sets the channel to shutdown if an error occurs.
1777    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1778        let _result = self.send_raw(status);
1779        if _result.is_err() {
1780            self.control_handle.shutdown();
1781        }
1782        self.drop_without_shutdown();
1783        _result
1784    }
1785
1786    /// Similar to "send" but does not shutdown the channel if an error occurs.
1787    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1788        let _result = self.send_raw(status);
1789        self.drop_without_shutdown();
1790        _result
1791    }
1792
1793    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1794        self.control_handle.inner.send::<DebugBrokerSetTracingEnabledResponse>(
1795            (status,),
1796            self.tx_id,
1797            0x12e368d05329b30e,
1798            fidl::encoding::DynamicFlags::empty(),
1799        )
1800    }
1801}
1802
1803#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1804pub struct DebugResourceMarker;
1805
1806impl fidl::endpoints::ProtocolMarker for DebugResourceMarker {
1807    type Proxy = DebugResourceProxy;
1808    type RequestStream = DebugResourceRequestStream;
1809    #[cfg(target_os = "fuchsia")]
1810    type SynchronousProxy = DebugResourceSynchronousProxy;
1811
1812    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugResource";
1813}
1814impl fidl::endpoints::DiscoverableProtocolMarker for DebugResourceMarker {}
1815
1816pub trait DebugResourceProxyInterface: Send + Sync {
1817    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
1818    fn r#get(&self) -> Self::GetResponseFut;
1819}
1820#[derive(Debug)]
1821#[cfg(target_os = "fuchsia")]
1822pub struct DebugResourceSynchronousProxy {
1823    client: fidl::client::sync::Client,
1824}
1825
1826#[cfg(target_os = "fuchsia")]
1827impl fidl::endpoints::SynchronousProxy for DebugResourceSynchronousProxy {
1828    type Proxy = DebugResourceProxy;
1829    type Protocol = DebugResourceMarker;
1830
1831    fn from_channel(inner: fidl::Channel) -> Self {
1832        Self::new(inner)
1833    }
1834
1835    fn into_channel(self) -> fidl::Channel {
1836        self.client.into_channel()
1837    }
1838
1839    fn as_channel(&self) -> &fidl::Channel {
1840        self.client.as_channel()
1841    }
1842}
1843
1844#[cfg(target_os = "fuchsia")]
1845impl DebugResourceSynchronousProxy {
1846    pub fn new(channel: fidl::Channel) -> Self {
1847        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1848        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1849    }
1850
1851    pub fn into_channel(self) -> fidl::Channel {
1852        self.client.into_channel()
1853    }
1854
1855    /// Waits until an event arrives and returns it. It is safe for other
1856    /// threads to make concurrent requests while waiting for an event.
1857    pub fn wait_for_event(
1858        &self,
1859        deadline: zx::MonotonicInstant,
1860    ) -> Result<DebugResourceEvent, fidl::Error> {
1861        DebugResourceEvent::decode(self.client.wait_for_event(deadline)?)
1862    }
1863
1864    /// Get a debug resource handle.
1865    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
1866        let _response =
1867            self.client.send_query::<fidl::encoding::EmptyPayload, DebugResourceGetResponse>(
1868                (),
1869                0x1d79d77ea12a6474,
1870                fidl::encoding::DynamicFlags::empty(),
1871                ___deadline,
1872            )?;
1873        Ok(_response.resource)
1874    }
1875}
1876
1877#[cfg(target_os = "fuchsia")]
1878impl From<DebugResourceSynchronousProxy> for zx::Handle {
1879    fn from(value: DebugResourceSynchronousProxy) -> Self {
1880        value.into_channel().into()
1881    }
1882}
1883
1884#[cfg(target_os = "fuchsia")]
1885impl From<fidl::Channel> for DebugResourceSynchronousProxy {
1886    fn from(value: fidl::Channel) -> Self {
1887        Self::new(value)
1888    }
1889}
1890
1891#[cfg(target_os = "fuchsia")]
1892impl fidl::endpoints::FromClient for DebugResourceSynchronousProxy {
1893    type Protocol = DebugResourceMarker;
1894
1895    fn from_client(value: fidl::endpoints::ClientEnd<DebugResourceMarker>) -> Self {
1896        Self::new(value.into_channel())
1897    }
1898}
1899
1900#[derive(Debug, Clone)]
1901pub struct DebugResourceProxy {
1902    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1903}
1904
1905impl fidl::endpoints::Proxy for DebugResourceProxy {
1906    type Protocol = DebugResourceMarker;
1907
1908    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1909        Self::new(inner)
1910    }
1911
1912    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1913        self.client.into_channel().map_err(|client| Self { client })
1914    }
1915
1916    fn as_channel(&self) -> &::fidl::AsyncChannel {
1917        self.client.as_channel()
1918    }
1919}
1920
1921impl DebugResourceProxy {
1922    /// Create a new Proxy for fuchsia.kernel/DebugResource.
1923    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1924        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1925        Self { client: fidl::client::Client::new(channel, protocol_name) }
1926    }
1927
1928    /// Get a Stream of events from the remote end of the protocol.
1929    ///
1930    /// # Panics
1931    ///
1932    /// Panics if the event stream was already taken.
1933    pub fn take_event_stream(&self) -> DebugResourceEventStream {
1934        DebugResourceEventStream { event_receiver: self.client.take_event_receiver() }
1935    }
1936
1937    /// Get a debug resource handle.
1938    pub fn r#get(
1939        &self,
1940    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
1941    {
1942        DebugResourceProxyInterface::r#get(self)
1943    }
1944}
1945
1946impl DebugResourceProxyInterface for DebugResourceProxy {
1947    type GetResponseFut = fidl::client::QueryResponseFut<
1948        fidl::Resource,
1949        fidl::encoding::DefaultFuchsiaResourceDialect,
1950    >;
1951    fn r#get(&self) -> Self::GetResponseFut {
1952        fn _decode(
1953            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1954        ) -> Result<fidl::Resource, fidl::Error> {
1955            let _response = fidl::client::decode_transaction_body::<
1956                DebugResourceGetResponse,
1957                fidl::encoding::DefaultFuchsiaResourceDialect,
1958                0x1d79d77ea12a6474,
1959            >(_buf?)?;
1960            Ok(_response.resource)
1961        }
1962        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
1963            (),
1964            0x1d79d77ea12a6474,
1965            fidl::encoding::DynamicFlags::empty(),
1966            _decode,
1967        )
1968    }
1969}
1970
1971pub struct DebugResourceEventStream {
1972    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1973}
1974
1975impl std::marker::Unpin for DebugResourceEventStream {}
1976
1977impl futures::stream::FusedStream for DebugResourceEventStream {
1978    fn is_terminated(&self) -> bool {
1979        self.event_receiver.is_terminated()
1980    }
1981}
1982
1983impl futures::Stream for DebugResourceEventStream {
1984    type Item = Result<DebugResourceEvent, fidl::Error>;
1985
1986    fn poll_next(
1987        mut self: std::pin::Pin<&mut Self>,
1988        cx: &mut std::task::Context<'_>,
1989    ) -> std::task::Poll<Option<Self::Item>> {
1990        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1991            &mut self.event_receiver,
1992            cx
1993        )?) {
1994            Some(buf) => std::task::Poll::Ready(Some(DebugResourceEvent::decode(buf))),
1995            None => std::task::Poll::Ready(None),
1996        }
1997    }
1998}
1999
2000#[derive(Debug)]
2001pub enum DebugResourceEvent {}
2002
2003impl DebugResourceEvent {
2004    /// Decodes a message buffer as a [`DebugResourceEvent`].
2005    fn decode(
2006        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2007    ) -> Result<DebugResourceEvent, fidl::Error> {
2008        let (bytes, _handles) = buf.split_mut();
2009        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2010        debug_assert_eq!(tx_header.tx_id, 0);
2011        match tx_header.ordinal {
2012            _ => Err(fidl::Error::UnknownOrdinal {
2013                ordinal: tx_header.ordinal,
2014                protocol_name: <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2015            }),
2016        }
2017    }
2018}
2019
2020/// A Stream of incoming requests for fuchsia.kernel/DebugResource.
2021pub struct DebugResourceRequestStream {
2022    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2023    is_terminated: bool,
2024}
2025
2026impl std::marker::Unpin for DebugResourceRequestStream {}
2027
2028impl futures::stream::FusedStream for DebugResourceRequestStream {
2029    fn is_terminated(&self) -> bool {
2030        self.is_terminated
2031    }
2032}
2033
2034impl fidl::endpoints::RequestStream for DebugResourceRequestStream {
2035    type Protocol = DebugResourceMarker;
2036    type ControlHandle = DebugResourceControlHandle;
2037
2038    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2039        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2040    }
2041
2042    fn control_handle(&self) -> Self::ControlHandle {
2043        DebugResourceControlHandle { inner: self.inner.clone() }
2044    }
2045
2046    fn into_inner(
2047        self,
2048    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2049    {
2050        (self.inner, self.is_terminated)
2051    }
2052
2053    fn from_inner(
2054        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2055        is_terminated: bool,
2056    ) -> Self {
2057        Self { inner, is_terminated }
2058    }
2059}
2060
2061impl futures::Stream for DebugResourceRequestStream {
2062    type Item = Result<DebugResourceRequest, fidl::Error>;
2063
2064    fn poll_next(
2065        mut self: std::pin::Pin<&mut Self>,
2066        cx: &mut std::task::Context<'_>,
2067    ) -> std::task::Poll<Option<Self::Item>> {
2068        let this = &mut *self;
2069        if this.inner.check_shutdown(cx) {
2070            this.is_terminated = true;
2071            return std::task::Poll::Ready(None);
2072        }
2073        if this.is_terminated {
2074            panic!("polled DebugResourceRequestStream after completion");
2075        }
2076        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2077            |bytes, handles| {
2078                match this.inner.channel().read_etc(cx, bytes, handles) {
2079                    std::task::Poll::Ready(Ok(())) => {}
2080                    std::task::Poll::Pending => return std::task::Poll::Pending,
2081                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2082                        this.is_terminated = true;
2083                        return std::task::Poll::Ready(None);
2084                    }
2085                    std::task::Poll::Ready(Err(e)) => {
2086                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2087                            e.into(),
2088                        ))));
2089                    }
2090                }
2091
2092                // A message has been received from the channel
2093                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2094
2095                std::task::Poll::Ready(Some(match header.ordinal {
2096                    0x1d79d77ea12a6474 => {
2097                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2098                        let mut req = fidl::new_empty!(
2099                            fidl::encoding::EmptyPayload,
2100                            fidl::encoding::DefaultFuchsiaResourceDialect
2101                        );
2102                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2103                        let control_handle =
2104                            DebugResourceControlHandle { inner: this.inner.clone() };
2105                        Ok(DebugResourceRequest::Get {
2106                            responder: DebugResourceGetResponder {
2107                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2108                                tx_id: header.tx_id,
2109                            },
2110                        })
2111                    }
2112                    _ => Err(fidl::Error::UnknownOrdinal {
2113                        ordinal: header.ordinal,
2114                        protocol_name:
2115                            <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2116                    }),
2117                }))
2118            },
2119        )
2120    }
2121}
2122
2123/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2124/// `ZX_RSRC_SYSTEM_DEBUG_BASE`.
2125#[derive(Debug)]
2126pub enum DebugResourceRequest {
2127    /// Get a debug resource handle.
2128    Get { responder: DebugResourceGetResponder },
2129}
2130
2131impl DebugResourceRequest {
2132    #[allow(irrefutable_let_patterns)]
2133    pub fn into_get(self) -> Option<(DebugResourceGetResponder)> {
2134        if let DebugResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2135    }
2136
2137    /// Name of the method defined in FIDL
2138    pub fn method_name(&self) -> &'static str {
2139        match *self {
2140            DebugResourceRequest::Get { .. } => "get",
2141        }
2142    }
2143}
2144
2145#[derive(Debug, Clone)]
2146pub struct DebugResourceControlHandle {
2147    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2148}
2149
2150impl fidl::endpoints::ControlHandle for DebugResourceControlHandle {
2151    fn shutdown(&self) {
2152        self.inner.shutdown()
2153    }
2154    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2155        self.inner.shutdown_with_epitaph(status)
2156    }
2157
2158    fn is_closed(&self) -> bool {
2159        self.inner.channel().is_closed()
2160    }
2161    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2162        self.inner.channel().on_closed()
2163    }
2164
2165    #[cfg(target_os = "fuchsia")]
2166    fn signal_peer(
2167        &self,
2168        clear_mask: zx::Signals,
2169        set_mask: zx::Signals,
2170    ) -> Result<(), zx_status::Status> {
2171        use fidl::Peered;
2172        self.inner.channel().signal_peer(clear_mask, set_mask)
2173    }
2174}
2175
2176impl DebugResourceControlHandle {}
2177
2178#[must_use = "FIDL methods require a response to be sent"]
2179#[derive(Debug)]
2180pub struct DebugResourceGetResponder {
2181    control_handle: std::mem::ManuallyDrop<DebugResourceControlHandle>,
2182    tx_id: u32,
2183}
2184
2185/// Set the the channel to be shutdown (see [`DebugResourceControlHandle::shutdown`])
2186/// if the responder is dropped without sending a response, so that the client
2187/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2188impl std::ops::Drop for DebugResourceGetResponder {
2189    fn drop(&mut self) {
2190        self.control_handle.shutdown();
2191        // Safety: drops once, never accessed again
2192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2193    }
2194}
2195
2196impl fidl::endpoints::Responder for DebugResourceGetResponder {
2197    type ControlHandle = DebugResourceControlHandle;
2198
2199    fn control_handle(&self) -> &DebugResourceControlHandle {
2200        &self.control_handle
2201    }
2202
2203    fn drop_without_shutdown(mut self) {
2204        // Safety: drops once, never accessed again due to mem::forget
2205        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2206        // Prevent Drop from running (which would shut down the channel)
2207        std::mem::forget(self);
2208    }
2209}
2210
2211impl DebugResourceGetResponder {
2212    /// Sends a response to the FIDL transaction.
2213    ///
2214    /// Sets the channel to shutdown if an error occurs.
2215    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2216        let _result = self.send_raw(resource);
2217        if _result.is_err() {
2218            self.control_handle.shutdown();
2219        }
2220        self.drop_without_shutdown();
2221        _result
2222    }
2223
2224    /// Similar to "send" but does not shutdown the channel if an error occurs.
2225    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2226        let _result = self.send_raw(resource);
2227        self.drop_without_shutdown();
2228        _result
2229    }
2230
2231    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2232        self.control_handle.inner.send::<DebugResourceGetResponse>(
2233            (resource,),
2234            self.tx_id,
2235            0x1d79d77ea12a6474,
2236            fidl::encoding::DynamicFlags::empty(),
2237        )
2238    }
2239}
2240
2241#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2242pub struct DebuglogResourceMarker;
2243
2244impl fidl::endpoints::ProtocolMarker for DebuglogResourceMarker {
2245    type Proxy = DebuglogResourceProxy;
2246    type RequestStream = DebuglogResourceRequestStream;
2247    #[cfg(target_os = "fuchsia")]
2248    type SynchronousProxy = DebuglogResourceSynchronousProxy;
2249
2250    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebuglogResource";
2251}
2252impl fidl::endpoints::DiscoverableProtocolMarker for DebuglogResourceMarker {}
2253
2254pub trait DebuglogResourceProxyInterface: Send + Sync {
2255    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2256    fn r#get(&self) -> Self::GetResponseFut;
2257}
2258#[derive(Debug)]
2259#[cfg(target_os = "fuchsia")]
2260pub struct DebuglogResourceSynchronousProxy {
2261    client: fidl::client::sync::Client,
2262}
2263
2264#[cfg(target_os = "fuchsia")]
2265impl fidl::endpoints::SynchronousProxy for DebuglogResourceSynchronousProxy {
2266    type Proxy = DebuglogResourceProxy;
2267    type Protocol = DebuglogResourceMarker;
2268
2269    fn from_channel(inner: fidl::Channel) -> Self {
2270        Self::new(inner)
2271    }
2272
2273    fn into_channel(self) -> fidl::Channel {
2274        self.client.into_channel()
2275    }
2276
2277    fn as_channel(&self) -> &fidl::Channel {
2278        self.client.as_channel()
2279    }
2280}
2281
2282#[cfg(target_os = "fuchsia")]
2283impl DebuglogResourceSynchronousProxy {
2284    pub fn new(channel: fidl::Channel) -> Self {
2285        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2286        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2287    }
2288
2289    pub fn into_channel(self) -> fidl::Channel {
2290        self.client.into_channel()
2291    }
2292
2293    /// Waits until an event arrives and returns it. It is safe for other
2294    /// threads to make concurrent requests while waiting for an event.
2295    pub fn wait_for_event(
2296        &self,
2297        deadline: zx::MonotonicInstant,
2298    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2299        DebuglogResourceEvent::decode(self.client.wait_for_event(deadline)?)
2300    }
2301
2302    /// Get a debuglog resource handle.
2303    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2304        let _response =
2305            self.client.send_query::<fidl::encoding::EmptyPayload, DebuglogResourceGetResponse>(
2306                (),
2307                0x6e78c1ff74765225,
2308                fidl::encoding::DynamicFlags::empty(),
2309                ___deadline,
2310            )?;
2311        Ok(_response.resource)
2312    }
2313}
2314
2315#[cfg(target_os = "fuchsia")]
2316impl From<DebuglogResourceSynchronousProxy> for zx::Handle {
2317    fn from(value: DebuglogResourceSynchronousProxy) -> Self {
2318        value.into_channel().into()
2319    }
2320}
2321
2322#[cfg(target_os = "fuchsia")]
2323impl From<fidl::Channel> for DebuglogResourceSynchronousProxy {
2324    fn from(value: fidl::Channel) -> Self {
2325        Self::new(value)
2326    }
2327}
2328
2329#[cfg(target_os = "fuchsia")]
2330impl fidl::endpoints::FromClient for DebuglogResourceSynchronousProxy {
2331    type Protocol = DebuglogResourceMarker;
2332
2333    fn from_client(value: fidl::endpoints::ClientEnd<DebuglogResourceMarker>) -> Self {
2334        Self::new(value.into_channel())
2335    }
2336}
2337
2338#[derive(Debug, Clone)]
2339pub struct DebuglogResourceProxy {
2340    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2341}
2342
2343impl fidl::endpoints::Proxy for DebuglogResourceProxy {
2344    type Protocol = DebuglogResourceMarker;
2345
2346    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2347        Self::new(inner)
2348    }
2349
2350    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2351        self.client.into_channel().map_err(|client| Self { client })
2352    }
2353
2354    fn as_channel(&self) -> &::fidl::AsyncChannel {
2355        self.client.as_channel()
2356    }
2357}
2358
2359impl DebuglogResourceProxy {
2360    /// Create a new Proxy for fuchsia.kernel/DebuglogResource.
2361    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2362        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2363        Self { client: fidl::client::Client::new(channel, protocol_name) }
2364    }
2365
2366    /// Get a Stream of events from the remote end of the protocol.
2367    ///
2368    /// # Panics
2369    ///
2370    /// Panics if the event stream was already taken.
2371    pub fn take_event_stream(&self) -> DebuglogResourceEventStream {
2372        DebuglogResourceEventStream { event_receiver: self.client.take_event_receiver() }
2373    }
2374
2375    /// Get a debuglog resource handle.
2376    pub fn r#get(
2377        &self,
2378    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2379    {
2380        DebuglogResourceProxyInterface::r#get(self)
2381    }
2382}
2383
2384impl DebuglogResourceProxyInterface for DebuglogResourceProxy {
2385    type GetResponseFut = fidl::client::QueryResponseFut<
2386        fidl::Resource,
2387        fidl::encoding::DefaultFuchsiaResourceDialect,
2388    >;
2389    fn r#get(&self) -> Self::GetResponseFut {
2390        fn _decode(
2391            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2392        ) -> Result<fidl::Resource, fidl::Error> {
2393            let _response = fidl::client::decode_transaction_body::<
2394                DebuglogResourceGetResponse,
2395                fidl::encoding::DefaultFuchsiaResourceDialect,
2396                0x6e78c1ff74765225,
2397            >(_buf?)?;
2398            Ok(_response.resource)
2399        }
2400        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2401            (),
2402            0x6e78c1ff74765225,
2403            fidl::encoding::DynamicFlags::empty(),
2404            _decode,
2405        )
2406    }
2407}
2408
2409pub struct DebuglogResourceEventStream {
2410    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2411}
2412
2413impl std::marker::Unpin for DebuglogResourceEventStream {}
2414
2415impl futures::stream::FusedStream for DebuglogResourceEventStream {
2416    fn is_terminated(&self) -> bool {
2417        self.event_receiver.is_terminated()
2418    }
2419}
2420
2421impl futures::Stream for DebuglogResourceEventStream {
2422    type Item = Result<DebuglogResourceEvent, fidl::Error>;
2423
2424    fn poll_next(
2425        mut self: std::pin::Pin<&mut Self>,
2426        cx: &mut std::task::Context<'_>,
2427    ) -> std::task::Poll<Option<Self::Item>> {
2428        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2429            &mut self.event_receiver,
2430            cx
2431        )?) {
2432            Some(buf) => std::task::Poll::Ready(Some(DebuglogResourceEvent::decode(buf))),
2433            None => std::task::Poll::Ready(None),
2434        }
2435    }
2436}
2437
2438#[derive(Debug)]
2439pub enum DebuglogResourceEvent {}
2440
2441impl DebuglogResourceEvent {
2442    /// Decodes a message buffer as a [`DebuglogResourceEvent`].
2443    fn decode(
2444        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2445    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2446        let (bytes, _handles) = buf.split_mut();
2447        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2448        debug_assert_eq!(tx_header.tx_id, 0);
2449        match tx_header.ordinal {
2450            _ => Err(fidl::Error::UnknownOrdinal {
2451                ordinal: tx_header.ordinal,
2452                protocol_name:
2453                    <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2454            }),
2455        }
2456    }
2457}
2458
2459/// A Stream of incoming requests for fuchsia.kernel/DebuglogResource.
2460pub struct DebuglogResourceRequestStream {
2461    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2462    is_terminated: bool,
2463}
2464
2465impl std::marker::Unpin for DebuglogResourceRequestStream {}
2466
2467impl futures::stream::FusedStream for DebuglogResourceRequestStream {
2468    fn is_terminated(&self) -> bool {
2469        self.is_terminated
2470    }
2471}
2472
2473impl fidl::endpoints::RequestStream for DebuglogResourceRequestStream {
2474    type Protocol = DebuglogResourceMarker;
2475    type ControlHandle = DebuglogResourceControlHandle;
2476
2477    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2478        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2479    }
2480
2481    fn control_handle(&self) -> Self::ControlHandle {
2482        DebuglogResourceControlHandle { inner: self.inner.clone() }
2483    }
2484
2485    fn into_inner(
2486        self,
2487    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2488    {
2489        (self.inner, self.is_terminated)
2490    }
2491
2492    fn from_inner(
2493        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2494        is_terminated: bool,
2495    ) -> Self {
2496        Self { inner, is_terminated }
2497    }
2498}
2499
2500impl futures::Stream for DebuglogResourceRequestStream {
2501    type Item = Result<DebuglogResourceRequest, fidl::Error>;
2502
2503    fn poll_next(
2504        mut self: std::pin::Pin<&mut Self>,
2505        cx: &mut std::task::Context<'_>,
2506    ) -> std::task::Poll<Option<Self::Item>> {
2507        let this = &mut *self;
2508        if this.inner.check_shutdown(cx) {
2509            this.is_terminated = true;
2510            return std::task::Poll::Ready(None);
2511        }
2512        if this.is_terminated {
2513            panic!("polled DebuglogResourceRequestStream after completion");
2514        }
2515        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2516            |bytes, handles| {
2517                match this.inner.channel().read_etc(cx, bytes, handles) {
2518                    std::task::Poll::Ready(Ok(())) => {}
2519                    std::task::Poll::Pending => return std::task::Poll::Pending,
2520                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2521                        this.is_terminated = true;
2522                        return std::task::Poll::Ready(None);
2523                    }
2524                    std::task::Poll::Ready(Err(e)) => {
2525                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2526                            e.into(),
2527                        ))));
2528                    }
2529                }
2530
2531                // A message has been received from the channel
2532                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2533
2534                std::task::Poll::Ready(Some(match header.ordinal {
2535                    0x6e78c1ff74765225 => {
2536                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2537                        let mut req = fidl::new_empty!(
2538                            fidl::encoding::EmptyPayload,
2539                            fidl::encoding::DefaultFuchsiaResourceDialect
2540                        );
2541                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2542                        let control_handle =
2543                            DebuglogResourceControlHandle { inner: this.inner.clone() };
2544                        Ok(DebuglogResourceRequest::Get {
2545                            responder: DebuglogResourceGetResponder {
2546                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2547                                tx_id: header.tx_id,
2548                            },
2549                        })
2550                    }
2551                    _ => Err(fidl::Error::UnknownOrdinal {
2552                        ordinal: header.ordinal,
2553                        protocol_name:
2554                            <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2555                    }),
2556                }))
2557            },
2558        )
2559    }
2560}
2561
2562/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2563/// `ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
2564#[derive(Debug)]
2565pub enum DebuglogResourceRequest {
2566    /// Get a debuglog resource handle.
2567    Get { responder: DebuglogResourceGetResponder },
2568}
2569
2570impl DebuglogResourceRequest {
2571    #[allow(irrefutable_let_patterns)]
2572    pub fn into_get(self) -> Option<(DebuglogResourceGetResponder)> {
2573        if let DebuglogResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2574    }
2575
2576    /// Name of the method defined in FIDL
2577    pub fn method_name(&self) -> &'static str {
2578        match *self {
2579            DebuglogResourceRequest::Get { .. } => "get",
2580        }
2581    }
2582}
2583
2584#[derive(Debug, Clone)]
2585pub struct DebuglogResourceControlHandle {
2586    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2587}
2588
2589impl fidl::endpoints::ControlHandle for DebuglogResourceControlHandle {
2590    fn shutdown(&self) {
2591        self.inner.shutdown()
2592    }
2593    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2594        self.inner.shutdown_with_epitaph(status)
2595    }
2596
2597    fn is_closed(&self) -> bool {
2598        self.inner.channel().is_closed()
2599    }
2600    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2601        self.inner.channel().on_closed()
2602    }
2603
2604    #[cfg(target_os = "fuchsia")]
2605    fn signal_peer(
2606        &self,
2607        clear_mask: zx::Signals,
2608        set_mask: zx::Signals,
2609    ) -> Result<(), zx_status::Status> {
2610        use fidl::Peered;
2611        self.inner.channel().signal_peer(clear_mask, set_mask)
2612    }
2613}
2614
2615impl DebuglogResourceControlHandle {}
2616
2617#[must_use = "FIDL methods require a response to be sent"]
2618#[derive(Debug)]
2619pub struct DebuglogResourceGetResponder {
2620    control_handle: std::mem::ManuallyDrop<DebuglogResourceControlHandle>,
2621    tx_id: u32,
2622}
2623
2624/// Set the the channel to be shutdown (see [`DebuglogResourceControlHandle::shutdown`])
2625/// if the responder is dropped without sending a response, so that the client
2626/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2627impl std::ops::Drop for DebuglogResourceGetResponder {
2628    fn drop(&mut self) {
2629        self.control_handle.shutdown();
2630        // Safety: drops once, never accessed again
2631        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2632    }
2633}
2634
2635impl fidl::endpoints::Responder for DebuglogResourceGetResponder {
2636    type ControlHandle = DebuglogResourceControlHandle;
2637
2638    fn control_handle(&self) -> &DebuglogResourceControlHandle {
2639        &self.control_handle
2640    }
2641
2642    fn drop_without_shutdown(mut self) {
2643        // Safety: drops once, never accessed again due to mem::forget
2644        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2645        // Prevent Drop from running (which would shut down the channel)
2646        std::mem::forget(self);
2647    }
2648}
2649
2650impl DebuglogResourceGetResponder {
2651    /// Sends a response to the FIDL transaction.
2652    ///
2653    /// Sets the channel to shutdown if an error occurs.
2654    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2655        let _result = self.send_raw(resource);
2656        if _result.is_err() {
2657            self.control_handle.shutdown();
2658        }
2659        self.drop_without_shutdown();
2660        _result
2661    }
2662
2663    /// Similar to "send" but does not shutdown the channel if an error occurs.
2664    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2665        let _result = self.send_raw(resource);
2666        self.drop_without_shutdown();
2667        _result
2668    }
2669
2670    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2671        self.control_handle.inner.send::<DebuglogResourceGetResponse>(
2672            (resource,),
2673            self.tx_id,
2674            0x6e78c1ff74765225,
2675            fidl::encoding::DynamicFlags::empty(),
2676        )
2677    }
2678}
2679
2680#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2681pub struct EnergyInfoResourceMarker;
2682
2683impl fidl::endpoints::ProtocolMarker for EnergyInfoResourceMarker {
2684    type Proxy = EnergyInfoResourceProxy;
2685    type RequestStream = EnergyInfoResourceRequestStream;
2686    #[cfg(target_os = "fuchsia")]
2687    type SynchronousProxy = EnergyInfoResourceSynchronousProxy;
2688
2689    const DEBUG_NAME: &'static str = "fuchsia.kernel.EnergyInfoResource";
2690}
2691impl fidl::endpoints::DiscoverableProtocolMarker for EnergyInfoResourceMarker {}
2692
2693pub trait EnergyInfoResourceProxyInterface: Send + Sync {
2694    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2695    fn r#get(&self) -> Self::GetResponseFut;
2696}
2697#[derive(Debug)]
2698#[cfg(target_os = "fuchsia")]
2699pub struct EnergyInfoResourceSynchronousProxy {
2700    client: fidl::client::sync::Client,
2701}
2702
2703#[cfg(target_os = "fuchsia")]
2704impl fidl::endpoints::SynchronousProxy for EnergyInfoResourceSynchronousProxy {
2705    type Proxy = EnergyInfoResourceProxy;
2706    type Protocol = EnergyInfoResourceMarker;
2707
2708    fn from_channel(inner: fidl::Channel) -> Self {
2709        Self::new(inner)
2710    }
2711
2712    fn into_channel(self) -> fidl::Channel {
2713        self.client.into_channel()
2714    }
2715
2716    fn as_channel(&self) -> &fidl::Channel {
2717        self.client.as_channel()
2718    }
2719}
2720
2721#[cfg(target_os = "fuchsia")]
2722impl EnergyInfoResourceSynchronousProxy {
2723    pub fn new(channel: fidl::Channel) -> Self {
2724        let protocol_name =
2725            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2726        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2727    }
2728
2729    pub fn into_channel(self) -> fidl::Channel {
2730        self.client.into_channel()
2731    }
2732
2733    /// Waits until an event arrives and returns it. It is safe for other
2734    /// threads to make concurrent requests while waiting for an event.
2735    pub fn wait_for_event(
2736        &self,
2737        deadline: zx::MonotonicInstant,
2738    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2739        EnergyInfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
2740    }
2741
2742    /// Get an EnergyInfo resource handle.
2743    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2744        let _response =
2745            self.client.send_query::<fidl::encoding::EmptyPayload, EnergyInfoResourceGetResponse>(
2746                (),
2747                0x5f5cc9f0745f61d0,
2748                fidl::encoding::DynamicFlags::empty(),
2749                ___deadline,
2750            )?;
2751        Ok(_response.resource)
2752    }
2753}
2754
2755#[cfg(target_os = "fuchsia")]
2756impl From<EnergyInfoResourceSynchronousProxy> for zx::Handle {
2757    fn from(value: EnergyInfoResourceSynchronousProxy) -> Self {
2758        value.into_channel().into()
2759    }
2760}
2761
2762#[cfg(target_os = "fuchsia")]
2763impl From<fidl::Channel> for EnergyInfoResourceSynchronousProxy {
2764    fn from(value: fidl::Channel) -> Self {
2765        Self::new(value)
2766    }
2767}
2768
2769#[cfg(target_os = "fuchsia")]
2770impl fidl::endpoints::FromClient for EnergyInfoResourceSynchronousProxy {
2771    type Protocol = EnergyInfoResourceMarker;
2772
2773    fn from_client(value: fidl::endpoints::ClientEnd<EnergyInfoResourceMarker>) -> Self {
2774        Self::new(value.into_channel())
2775    }
2776}
2777
2778#[derive(Debug, Clone)]
2779pub struct EnergyInfoResourceProxy {
2780    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2781}
2782
2783impl fidl::endpoints::Proxy for EnergyInfoResourceProxy {
2784    type Protocol = EnergyInfoResourceMarker;
2785
2786    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2787        Self::new(inner)
2788    }
2789
2790    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2791        self.client.into_channel().map_err(|client| Self { client })
2792    }
2793
2794    fn as_channel(&self) -> &::fidl::AsyncChannel {
2795        self.client.as_channel()
2796    }
2797}
2798
2799impl EnergyInfoResourceProxy {
2800    /// Create a new Proxy for fuchsia.kernel/EnergyInfoResource.
2801    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2802        let protocol_name =
2803            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2804        Self { client: fidl::client::Client::new(channel, protocol_name) }
2805    }
2806
2807    /// Get a Stream of events from the remote end of the protocol.
2808    ///
2809    /// # Panics
2810    ///
2811    /// Panics if the event stream was already taken.
2812    pub fn take_event_stream(&self) -> EnergyInfoResourceEventStream {
2813        EnergyInfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
2814    }
2815
2816    /// Get an EnergyInfo resource handle.
2817    pub fn r#get(
2818        &self,
2819    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2820    {
2821        EnergyInfoResourceProxyInterface::r#get(self)
2822    }
2823}
2824
2825impl EnergyInfoResourceProxyInterface for EnergyInfoResourceProxy {
2826    type GetResponseFut = fidl::client::QueryResponseFut<
2827        fidl::Resource,
2828        fidl::encoding::DefaultFuchsiaResourceDialect,
2829    >;
2830    fn r#get(&self) -> Self::GetResponseFut {
2831        fn _decode(
2832            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2833        ) -> Result<fidl::Resource, fidl::Error> {
2834            let _response = fidl::client::decode_transaction_body::<
2835                EnergyInfoResourceGetResponse,
2836                fidl::encoding::DefaultFuchsiaResourceDialect,
2837                0x5f5cc9f0745f61d0,
2838            >(_buf?)?;
2839            Ok(_response.resource)
2840        }
2841        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2842            (),
2843            0x5f5cc9f0745f61d0,
2844            fidl::encoding::DynamicFlags::empty(),
2845            _decode,
2846        )
2847    }
2848}
2849
2850pub struct EnergyInfoResourceEventStream {
2851    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2852}
2853
2854impl std::marker::Unpin for EnergyInfoResourceEventStream {}
2855
2856impl futures::stream::FusedStream for EnergyInfoResourceEventStream {
2857    fn is_terminated(&self) -> bool {
2858        self.event_receiver.is_terminated()
2859    }
2860}
2861
2862impl futures::Stream for EnergyInfoResourceEventStream {
2863    type Item = Result<EnergyInfoResourceEvent, fidl::Error>;
2864
2865    fn poll_next(
2866        mut self: std::pin::Pin<&mut Self>,
2867        cx: &mut std::task::Context<'_>,
2868    ) -> std::task::Poll<Option<Self::Item>> {
2869        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2870            &mut self.event_receiver,
2871            cx
2872        )?) {
2873            Some(buf) => std::task::Poll::Ready(Some(EnergyInfoResourceEvent::decode(buf))),
2874            None => std::task::Poll::Ready(None),
2875        }
2876    }
2877}
2878
2879#[derive(Debug)]
2880pub enum EnergyInfoResourceEvent {}
2881
2882impl EnergyInfoResourceEvent {
2883    /// Decodes a message buffer as a [`EnergyInfoResourceEvent`].
2884    fn decode(
2885        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2886    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2887        let (bytes, _handles) = buf.split_mut();
2888        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2889        debug_assert_eq!(tx_header.tx_id, 0);
2890        match tx_header.ordinal {
2891            _ => Err(fidl::Error::UnknownOrdinal {
2892                ordinal: tx_header.ordinal,
2893                protocol_name:
2894                    <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2895            }),
2896        }
2897    }
2898}
2899
2900/// A Stream of incoming requests for fuchsia.kernel/EnergyInfoResource.
2901pub struct EnergyInfoResourceRequestStream {
2902    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2903    is_terminated: bool,
2904}
2905
2906impl std::marker::Unpin for EnergyInfoResourceRequestStream {}
2907
2908impl futures::stream::FusedStream for EnergyInfoResourceRequestStream {
2909    fn is_terminated(&self) -> bool {
2910        self.is_terminated
2911    }
2912}
2913
2914impl fidl::endpoints::RequestStream for EnergyInfoResourceRequestStream {
2915    type Protocol = EnergyInfoResourceMarker;
2916    type ControlHandle = EnergyInfoResourceControlHandle;
2917
2918    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2919        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2920    }
2921
2922    fn control_handle(&self) -> Self::ControlHandle {
2923        EnergyInfoResourceControlHandle { inner: self.inner.clone() }
2924    }
2925
2926    fn into_inner(
2927        self,
2928    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2929    {
2930        (self.inner, self.is_terminated)
2931    }
2932
2933    fn from_inner(
2934        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2935        is_terminated: bool,
2936    ) -> Self {
2937        Self { inner, is_terminated }
2938    }
2939}
2940
2941impl futures::Stream for EnergyInfoResourceRequestStream {
2942    type Item = Result<EnergyInfoResourceRequest, fidl::Error>;
2943
2944    fn poll_next(
2945        mut self: std::pin::Pin<&mut Self>,
2946        cx: &mut std::task::Context<'_>,
2947    ) -> std::task::Poll<Option<Self::Item>> {
2948        let this = &mut *self;
2949        if this.inner.check_shutdown(cx) {
2950            this.is_terminated = true;
2951            return std::task::Poll::Ready(None);
2952        }
2953        if this.is_terminated {
2954            panic!("polled EnergyInfoResourceRequestStream after completion");
2955        }
2956        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2957            |bytes, handles| {
2958                match this.inner.channel().read_etc(cx, bytes, handles) {
2959                    std::task::Poll::Ready(Ok(())) => {}
2960                    std::task::Poll::Pending => return std::task::Poll::Pending,
2961                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2962                        this.is_terminated = true;
2963                        return std::task::Poll::Ready(None);
2964                    }
2965                    std::task::Poll::Ready(Err(e)) => {
2966                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2967                            e.into(),
2968                        ))));
2969                    }
2970                }
2971
2972                // A message has been received from the channel
2973                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2974
2975                std::task::Poll::Ready(Some(match header.ordinal {
2976                0x5f5cc9f0745f61d0 => {
2977                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2978                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2979                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2980                    let control_handle = EnergyInfoResourceControlHandle {
2981                        inner: this.inner.clone(),
2982                    };
2983                    Ok(EnergyInfoResourceRequest::Get {
2984                        responder: EnergyInfoResourceGetResponder {
2985                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2986                            tx_id: header.tx_id,
2987                        },
2988                    })
2989                }
2990                _ => Err(fidl::Error::UnknownOrdinal {
2991                    ordinal: header.ordinal,
2992                    protocol_name: <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2993                }),
2994            }))
2995            },
2996        )
2997    }
2998}
2999
3000/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3001/// `ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
3002#[derive(Debug)]
3003pub enum EnergyInfoResourceRequest {
3004    /// Get an EnergyInfo resource handle.
3005    Get { responder: EnergyInfoResourceGetResponder },
3006}
3007
3008impl EnergyInfoResourceRequest {
3009    #[allow(irrefutable_let_patterns)]
3010    pub fn into_get(self) -> Option<(EnergyInfoResourceGetResponder)> {
3011        if let EnergyInfoResourceRequest::Get { responder } = self {
3012            Some((responder))
3013        } else {
3014            None
3015        }
3016    }
3017
3018    /// Name of the method defined in FIDL
3019    pub fn method_name(&self) -> &'static str {
3020        match *self {
3021            EnergyInfoResourceRequest::Get { .. } => "get",
3022        }
3023    }
3024}
3025
3026#[derive(Debug, Clone)]
3027pub struct EnergyInfoResourceControlHandle {
3028    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3029}
3030
3031impl fidl::endpoints::ControlHandle for EnergyInfoResourceControlHandle {
3032    fn shutdown(&self) {
3033        self.inner.shutdown()
3034    }
3035    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3036        self.inner.shutdown_with_epitaph(status)
3037    }
3038
3039    fn is_closed(&self) -> bool {
3040        self.inner.channel().is_closed()
3041    }
3042    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3043        self.inner.channel().on_closed()
3044    }
3045
3046    #[cfg(target_os = "fuchsia")]
3047    fn signal_peer(
3048        &self,
3049        clear_mask: zx::Signals,
3050        set_mask: zx::Signals,
3051    ) -> Result<(), zx_status::Status> {
3052        use fidl::Peered;
3053        self.inner.channel().signal_peer(clear_mask, set_mask)
3054    }
3055}
3056
3057impl EnergyInfoResourceControlHandle {}
3058
3059#[must_use = "FIDL methods require a response to be sent"]
3060#[derive(Debug)]
3061pub struct EnergyInfoResourceGetResponder {
3062    control_handle: std::mem::ManuallyDrop<EnergyInfoResourceControlHandle>,
3063    tx_id: u32,
3064}
3065
3066/// Set the the channel to be shutdown (see [`EnergyInfoResourceControlHandle::shutdown`])
3067/// if the responder is dropped without sending a response, so that the client
3068/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3069impl std::ops::Drop for EnergyInfoResourceGetResponder {
3070    fn drop(&mut self) {
3071        self.control_handle.shutdown();
3072        // Safety: drops once, never accessed again
3073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3074    }
3075}
3076
3077impl fidl::endpoints::Responder for EnergyInfoResourceGetResponder {
3078    type ControlHandle = EnergyInfoResourceControlHandle;
3079
3080    fn control_handle(&self) -> &EnergyInfoResourceControlHandle {
3081        &self.control_handle
3082    }
3083
3084    fn drop_without_shutdown(mut self) {
3085        // Safety: drops once, never accessed again due to mem::forget
3086        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3087        // Prevent Drop from running (which would shut down the channel)
3088        std::mem::forget(self);
3089    }
3090}
3091
3092impl EnergyInfoResourceGetResponder {
3093    /// Sends a response to the FIDL transaction.
3094    ///
3095    /// Sets the channel to shutdown if an error occurs.
3096    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3097        let _result = self.send_raw(resource);
3098        if _result.is_err() {
3099            self.control_handle.shutdown();
3100        }
3101        self.drop_without_shutdown();
3102        _result
3103    }
3104
3105    /// Similar to "send" but does not shutdown the channel if an error occurs.
3106    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3107        let _result = self.send_raw(resource);
3108        self.drop_without_shutdown();
3109        _result
3110    }
3111
3112    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3113        self.control_handle.inner.send::<EnergyInfoResourceGetResponse>(
3114            (resource,),
3115            self.tx_id,
3116            0x5f5cc9f0745f61d0,
3117            fidl::encoding::DynamicFlags::empty(),
3118        )
3119    }
3120}
3121
3122#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3123pub struct HypervisorResourceMarker;
3124
3125impl fidl::endpoints::ProtocolMarker for HypervisorResourceMarker {
3126    type Proxy = HypervisorResourceProxy;
3127    type RequestStream = HypervisorResourceRequestStream;
3128    #[cfg(target_os = "fuchsia")]
3129    type SynchronousProxy = HypervisorResourceSynchronousProxy;
3130
3131    const DEBUG_NAME: &'static str = "fuchsia.kernel.HypervisorResource";
3132}
3133impl fidl::endpoints::DiscoverableProtocolMarker for HypervisorResourceMarker {}
3134
3135pub trait HypervisorResourceProxyInterface: Send + Sync {
3136    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3137    fn r#get(&self) -> Self::GetResponseFut;
3138}
3139#[derive(Debug)]
3140#[cfg(target_os = "fuchsia")]
3141pub struct HypervisorResourceSynchronousProxy {
3142    client: fidl::client::sync::Client,
3143}
3144
3145#[cfg(target_os = "fuchsia")]
3146impl fidl::endpoints::SynchronousProxy for HypervisorResourceSynchronousProxy {
3147    type Proxy = HypervisorResourceProxy;
3148    type Protocol = HypervisorResourceMarker;
3149
3150    fn from_channel(inner: fidl::Channel) -> Self {
3151        Self::new(inner)
3152    }
3153
3154    fn into_channel(self) -> fidl::Channel {
3155        self.client.into_channel()
3156    }
3157
3158    fn as_channel(&self) -> &fidl::Channel {
3159        self.client.as_channel()
3160    }
3161}
3162
3163#[cfg(target_os = "fuchsia")]
3164impl HypervisorResourceSynchronousProxy {
3165    pub fn new(channel: fidl::Channel) -> Self {
3166        let protocol_name =
3167            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3168        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3169    }
3170
3171    pub fn into_channel(self) -> fidl::Channel {
3172        self.client.into_channel()
3173    }
3174
3175    /// Waits until an event arrives and returns it. It is safe for other
3176    /// threads to make concurrent requests while waiting for an event.
3177    pub fn wait_for_event(
3178        &self,
3179        deadline: zx::MonotonicInstant,
3180    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3181        HypervisorResourceEvent::decode(self.client.wait_for_event(deadline)?)
3182    }
3183
3184    /// Get a hypervisor resource handle.
3185    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3186        let _response =
3187            self.client.send_query::<fidl::encoding::EmptyPayload, HypervisorResourceGetResponse>(
3188                (),
3189                0x1c312131d3b824a2,
3190                fidl::encoding::DynamicFlags::empty(),
3191                ___deadline,
3192            )?;
3193        Ok(_response.resource)
3194    }
3195}
3196
3197#[cfg(target_os = "fuchsia")]
3198impl From<HypervisorResourceSynchronousProxy> for zx::Handle {
3199    fn from(value: HypervisorResourceSynchronousProxy) -> Self {
3200        value.into_channel().into()
3201    }
3202}
3203
3204#[cfg(target_os = "fuchsia")]
3205impl From<fidl::Channel> for HypervisorResourceSynchronousProxy {
3206    fn from(value: fidl::Channel) -> Self {
3207        Self::new(value)
3208    }
3209}
3210
3211#[cfg(target_os = "fuchsia")]
3212impl fidl::endpoints::FromClient for HypervisorResourceSynchronousProxy {
3213    type Protocol = HypervisorResourceMarker;
3214
3215    fn from_client(value: fidl::endpoints::ClientEnd<HypervisorResourceMarker>) -> Self {
3216        Self::new(value.into_channel())
3217    }
3218}
3219
3220#[derive(Debug, Clone)]
3221pub struct HypervisorResourceProxy {
3222    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3223}
3224
3225impl fidl::endpoints::Proxy for HypervisorResourceProxy {
3226    type Protocol = HypervisorResourceMarker;
3227
3228    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3229        Self::new(inner)
3230    }
3231
3232    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3233        self.client.into_channel().map_err(|client| Self { client })
3234    }
3235
3236    fn as_channel(&self) -> &::fidl::AsyncChannel {
3237        self.client.as_channel()
3238    }
3239}
3240
3241impl HypervisorResourceProxy {
3242    /// Create a new Proxy for fuchsia.kernel/HypervisorResource.
3243    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3244        let protocol_name =
3245            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3246        Self { client: fidl::client::Client::new(channel, protocol_name) }
3247    }
3248
3249    /// Get a Stream of events from the remote end of the protocol.
3250    ///
3251    /// # Panics
3252    ///
3253    /// Panics if the event stream was already taken.
3254    pub fn take_event_stream(&self) -> HypervisorResourceEventStream {
3255        HypervisorResourceEventStream { event_receiver: self.client.take_event_receiver() }
3256    }
3257
3258    /// Get a hypervisor resource handle.
3259    pub fn r#get(
3260        &self,
3261    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3262    {
3263        HypervisorResourceProxyInterface::r#get(self)
3264    }
3265}
3266
3267impl HypervisorResourceProxyInterface for HypervisorResourceProxy {
3268    type GetResponseFut = fidl::client::QueryResponseFut<
3269        fidl::Resource,
3270        fidl::encoding::DefaultFuchsiaResourceDialect,
3271    >;
3272    fn r#get(&self) -> Self::GetResponseFut {
3273        fn _decode(
3274            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3275        ) -> Result<fidl::Resource, fidl::Error> {
3276            let _response = fidl::client::decode_transaction_body::<
3277                HypervisorResourceGetResponse,
3278                fidl::encoding::DefaultFuchsiaResourceDialect,
3279                0x1c312131d3b824a2,
3280            >(_buf?)?;
3281            Ok(_response.resource)
3282        }
3283        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3284            (),
3285            0x1c312131d3b824a2,
3286            fidl::encoding::DynamicFlags::empty(),
3287            _decode,
3288        )
3289    }
3290}
3291
3292pub struct HypervisorResourceEventStream {
3293    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3294}
3295
3296impl std::marker::Unpin for HypervisorResourceEventStream {}
3297
3298impl futures::stream::FusedStream for HypervisorResourceEventStream {
3299    fn is_terminated(&self) -> bool {
3300        self.event_receiver.is_terminated()
3301    }
3302}
3303
3304impl futures::Stream for HypervisorResourceEventStream {
3305    type Item = Result<HypervisorResourceEvent, fidl::Error>;
3306
3307    fn poll_next(
3308        mut self: std::pin::Pin<&mut Self>,
3309        cx: &mut std::task::Context<'_>,
3310    ) -> std::task::Poll<Option<Self::Item>> {
3311        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3312            &mut self.event_receiver,
3313            cx
3314        )?) {
3315            Some(buf) => std::task::Poll::Ready(Some(HypervisorResourceEvent::decode(buf))),
3316            None => std::task::Poll::Ready(None),
3317        }
3318    }
3319}
3320
3321#[derive(Debug)]
3322pub enum HypervisorResourceEvent {}
3323
3324impl HypervisorResourceEvent {
3325    /// Decodes a message buffer as a [`HypervisorResourceEvent`].
3326    fn decode(
3327        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3328    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3329        let (bytes, _handles) = buf.split_mut();
3330        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3331        debug_assert_eq!(tx_header.tx_id, 0);
3332        match tx_header.ordinal {
3333            _ => Err(fidl::Error::UnknownOrdinal {
3334                ordinal: tx_header.ordinal,
3335                protocol_name:
3336                    <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3337            }),
3338        }
3339    }
3340}
3341
3342/// A Stream of incoming requests for fuchsia.kernel/HypervisorResource.
3343pub struct HypervisorResourceRequestStream {
3344    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3345    is_terminated: bool,
3346}
3347
3348impl std::marker::Unpin for HypervisorResourceRequestStream {}
3349
3350impl futures::stream::FusedStream for HypervisorResourceRequestStream {
3351    fn is_terminated(&self) -> bool {
3352        self.is_terminated
3353    }
3354}
3355
3356impl fidl::endpoints::RequestStream for HypervisorResourceRequestStream {
3357    type Protocol = HypervisorResourceMarker;
3358    type ControlHandle = HypervisorResourceControlHandle;
3359
3360    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3361        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3362    }
3363
3364    fn control_handle(&self) -> Self::ControlHandle {
3365        HypervisorResourceControlHandle { inner: self.inner.clone() }
3366    }
3367
3368    fn into_inner(
3369        self,
3370    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3371    {
3372        (self.inner, self.is_terminated)
3373    }
3374
3375    fn from_inner(
3376        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3377        is_terminated: bool,
3378    ) -> Self {
3379        Self { inner, is_terminated }
3380    }
3381}
3382
3383impl futures::Stream for HypervisorResourceRequestStream {
3384    type Item = Result<HypervisorResourceRequest, fidl::Error>;
3385
3386    fn poll_next(
3387        mut self: std::pin::Pin<&mut Self>,
3388        cx: &mut std::task::Context<'_>,
3389    ) -> std::task::Poll<Option<Self::Item>> {
3390        let this = &mut *self;
3391        if this.inner.check_shutdown(cx) {
3392            this.is_terminated = true;
3393            return std::task::Poll::Ready(None);
3394        }
3395        if this.is_terminated {
3396            panic!("polled HypervisorResourceRequestStream after completion");
3397        }
3398        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3399            |bytes, handles| {
3400                match this.inner.channel().read_etc(cx, bytes, handles) {
3401                    std::task::Poll::Ready(Ok(())) => {}
3402                    std::task::Poll::Pending => return std::task::Poll::Pending,
3403                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3404                        this.is_terminated = true;
3405                        return std::task::Poll::Ready(None);
3406                    }
3407                    std::task::Poll::Ready(Err(e)) => {
3408                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3409                            e.into(),
3410                        ))));
3411                    }
3412                }
3413
3414                // A message has been received from the channel
3415                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3416
3417                std::task::Poll::Ready(Some(match header.ordinal {
3418                0x1c312131d3b824a2 => {
3419                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3420                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3421                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3422                    let control_handle = HypervisorResourceControlHandle {
3423                        inner: this.inner.clone(),
3424                    };
3425                    Ok(HypervisorResourceRequest::Get {
3426                        responder: HypervisorResourceGetResponder {
3427                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3428                            tx_id: header.tx_id,
3429                        },
3430                    })
3431                }
3432                _ => Err(fidl::Error::UnknownOrdinal {
3433                    ordinal: header.ordinal,
3434                    protocol_name: <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3435                }),
3436            }))
3437            },
3438        )
3439    }
3440}
3441
3442/// Protocol for providing the hypervisor resource.
3443#[derive(Debug)]
3444pub enum HypervisorResourceRequest {
3445    /// Get a hypervisor resource handle.
3446    Get { responder: HypervisorResourceGetResponder },
3447}
3448
3449impl HypervisorResourceRequest {
3450    #[allow(irrefutable_let_patterns)]
3451    pub fn into_get(self) -> Option<(HypervisorResourceGetResponder)> {
3452        if let HypervisorResourceRequest::Get { responder } = self {
3453            Some((responder))
3454        } else {
3455            None
3456        }
3457    }
3458
3459    /// Name of the method defined in FIDL
3460    pub fn method_name(&self) -> &'static str {
3461        match *self {
3462            HypervisorResourceRequest::Get { .. } => "get",
3463        }
3464    }
3465}
3466
3467#[derive(Debug, Clone)]
3468pub struct HypervisorResourceControlHandle {
3469    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3470}
3471
3472impl fidl::endpoints::ControlHandle for HypervisorResourceControlHandle {
3473    fn shutdown(&self) {
3474        self.inner.shutdown()
3475    }
3476    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3477        self.inner.shutdown_with_epitaph(status)
3478    }
3479
3480    fn is_closed(&self) -> bool {
3481        self.inner.channel().is_closed()
3482    }
3483    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3484        self.inner.channel().on_closed()
3485    }
3486
3487    #[cfg(target_os = "fuchsia")]
3488    fn signal_peer(
3489        &self,
3490        clear_mask: zx::Signals,
3491        set_mask: zx::Signals,
3492    ) -> Result<(), zx_status::Status> {
3493        use fidl::Peered;
3494        self.inner.channel().signal_peer(clear_mask, set_mask)
3495    }
3496}
3497
3498impl HypervisorResourceControlHandle {}
3499
3500#[must_use = "FIDL methods require a response to be sent"]
3501#[derive(Debug)]
3502pub struct HypervisorResourceGetResponder {
3503    control_handle: std::mem::ManuallyDrop<HypervisorResourceControlHandle>,
3504    tx_id: u32,
3505}
3506
3507/// Set the the channel to be shutdown (see [`HypervisorResourceControlHandle::shutdown`])
3508/// if the responder is dropped without sending a response, so that the client
3509/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3510impl std::ops::Drop for HypervisorResourceGetResponder {
3511    fn drop(&mut self) {
3512        self.control_handle.shutdown();
3513        // Safety: drops once, never accessed again
3514        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3515    }
3516}
3517
3518impl fidl::endpoints::Responder for HypervisorResourceGetResponder {
3519    type ControlHandle = HypervisorResourceControlHandle;
3520
3521    fn control_handle(&self) -> &HypervisorResourceControlHandle {
3522        &self.control_handle
3523    }
3524
3525    fn drop_without_shutdown(mut self) {
3526        // Safety: drops once, never accessed again due to mem::forget
3527        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3528        // Prevent Drop from running (which would shut down the channel)
3529        std::mem::forget(self);
3530    }
3531}
3532
3533impl HypervisorResourceGetResponder {
3534    /// Sends a response to the FIDL transaction.
3535    ///
3536    /// Sets the channel to shutdown if an error occurs.
3537    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3538        let _result = self.send_raw(resource);
3539        if _result.is_err() {
3540            self.control_handle.shutdown();
3541        }
3542        self.drop_without_shutdown();
3543        _result
3544    }
3545
3546    /// Similar to "send" but does not shutdown the channel if an error occurs.
3547    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3548        let _result = self.send_raw(resource);
3549        self.drop_without_shutdown();
3550        _result
3551    }
3552
3553    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3554        self.control_handle.inner.send::<HypervisorResourceGetResponse>(
3555            (resource,),
3556            self.tx_id,
3557            0x1c312131d3b824a2,
3558            fidl::encoding::DynamicFlags::empty(),
3559        )
3560    }
3561}
3562
3563#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3564pub struct InfoResourceMarker;
3565
3566impl fidl::endpoints::ProtocolMarker for InfoResourceMarker {
3567    type Proxy = InfoResourceProxy;
3568    type RequestStream = InfoResourceRequestStream;
3569    #[cfg(target_os = "fuchsia")]
3570    type SynchronousProxy = InfoResourceSynchronousProxy;
3571
3572    const DEBUG_NAME: &'static str = "fuchsia.kernel.InfoResource";
3573}
3574impl fidl::endpoints::DiscoverableProtocolMarker for InfoResourceMarker {}
3575
3576pub trait InfoResourceProxyInterface: Send + Sync {
3577    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3578    fn r#get(&self) -> Self::GetResponseFut;
3579}
3580#[derive(Debug)]
3581#[cfg(target_os = "fuchsia")]
3582pub struct InfoResourceSynchronousProxy {
3583    client: fidl::client::sync::Client,
3584}
3585
3586#[cfg(target_os = "fuchsia")]
3587impl fidl::endpoints::SynchronousProxy for InfoResourceSynchronousProxy {
3588    type Proxy = InfoResourceProxy;
3589    type Protocol = InfoResourceMarker;
3590
3591    fn from_channel(inner: fidl::Channel) -> Self {
3592        Self::new(inner)
3593    }
3594
3595    fn into_channel(self) -> fidl::Channel {
3596        self.client.into_channel()
3597    }
3598
3599    fn as_channel(&self) -> &fidl::Channel {
3600        self.client.as_channel()
3601    }
3602}
3603
3604#[cfg(target_os = "fuchsia")]
3605impl InfoResourceSynchronousProxy {
3606    pub fn new(channel: fidl::Channel) -> Self {
3607        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3608        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3609    }
3610
3611    pub fn into_channel(self) -> fidl::Channel {
3612        self.client.into_channel()
3613    }
3614
3615    /// Waits until an event arrives and returns it. It is safe for other
3616    /// threads to make concurrent requests while waiting for an event.
3617    pub fn wait_for_event(
3618        &self,
3619        deadline: zx::MonotonicInstant,
3620    ) -> Result<InfoResourceEvent, fidl::Error> {
3621        InfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
3622    }
3623
3624    /// Get an info resource handle.
3625    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3626        let _response =
3627            self.client.send_query::<fidl::encoding::EmptyPayload, InfoResourceGetResponse>(
3628                (),
3629                0x1de8edcb4abc2067,
3630                fidl::encoding::DynamicFlags::empty(),
3631                ___deadline,
3632            )?;
3633        Ok(_response.resource)
3634    }
3635}
3636
3637#[cfg(target_os = "fuchsia")]
3638impl From<InfoResourceSynchronousProxy> for zx::Handle {
3639    fn from(value: InfoResourceSynchronousProxy) -> Self {
3640        value.into_channel().into()
3641    }
3642}
3643
3644#[cfg(target_os = "fuchsia")]
3645impl From<fidl::Channel> for InfoResourceSynchronousProxy {
3646    fn from(value: fidl::Channel) -> Self {
3647        Self::new(value)
3648    }
3649}
3650
3651#[cfg(target_os = "fuchsia")]
3652impl fidl::endpoints::FromClient for InfoResourceSynchronousProxy {
3653    type Protocol = InfoResourceMarker;
3654
3655    fn from_client(value: fidl::endpoints::ClientEnd<InfoResourceMarker>) -> Self {
3656        Self::new(value.into_channel())
3657    }
3658}
3659
3660#[derive(Debug, Clone)]
3661pub struct InfoResourceProxy {
3662    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3663}
3664
3665impl fidl::endpoints::Proxy for InfoResourceProxy {
3666    type Protocol = InfoResourceMarker;
3667
3668    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3669        Self::new(inner)
3670    }
3671
3672    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3673        self.client.into_channel().map_err(|client| Self { client })
3674    }
3675
3676    fn as_channel(&self) -> &::fidl::AsyncChannel {
3677        self.client.as_channel()
3678    }
3679}
3680
3681impl InfoResourceProxy {
3682    /// Create a new Proxy for fuchsia.kernel/InfoResource.
3683    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3684        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3685        Self { client: fidl::client::Client::new(channel, protocol_name) }
3686    }
3687
3688    /// Get a Stream of events from the remote end of the protocol.
3689    ///
3690    /// # Panics
3691    ///
3692    /// Panics if the event stream was already taken.
3693    pub fn take_event_stream(&self) -> InfoResourceEventStream {
3694        InfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
3695    }
3696
3697    /// Get an info resource handle.
3698    pub fn r#get(
3699        &self,
3700    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3701    {
3702        InfoResourceProxyInterface::r#get(self)
3703    }
3704}
3705
3706impl InfoResourceProxyInterface for InfoResourceProxy {
3707    type GetResponseFut = fidl::client::QueryResponseFut<
3708        fidl::Resource,
3709        fidl::encoding::DefaultFuchsiaResourceDialect,
3710    >;
3711    fn r#get(&self) -> Self::GetResponseFut {
3712        fn _decode(
3713            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3714        ) -> Result<fidl::Resource, fidl::Error> {
3715            let _response = fidl::client::decode_transaction_body::<
3716                InfoResourceGetResponse,
3717                fidl::encoding::DefaultFuchsiaResourceDialect,
3718                0x1de8edcb4abc2067,
3719            >(_buf?)?;
3720            Ok(_response.resource)
3721        }
3722        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3723            (),
3724            0x1de8edcb4abc2067,
3725            fidl::encoding::DynamicFlags::empty(),
3726            _decode,
3727        )
3728    }
3729}
3730
3731pub struct InfoResourceEventStream {
3732    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3733}
3734
3735impl std::marker::Unpin for InfoResourceEventStream {}
3736
3737impl futures::stream::FusedStream for InfoResourceEventStream {
3738    fn is_terminated(&self) -> bool {
3739        self.event_receiver.is_terminated()
3740    }
3741}
3742
3743impl futures::Stream for InfoResourceEventStream {
3744    type Item = Result<InfoResourceEvent, fidl::Error>;
3745
3746    fn poll_next(
3747        mut self: std::pin::Pin<&mut Self>,
3748        cx: &mut std::task::Context<'_>,
3749    ) -> std::task::Poll<Option<Self::Item>> {
3750        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3751            &mut self.event_receiver,
3752            cx
3753        )?) {
3754            Some(buf) => std::task::Poll::Ready(Some(InfoResourceEvent::decode(buf))),
3755            None => std::task::Poll::Ready(None),
3756        }
3757    }
3758}
3759
3760#[derive(Debug)]
3761pub enum InfoResourceEvent {}
3762
3763impl InfoResourceEvent {
3764    /// Decodes a message buffer as a [`InfoResourceEvent`].
3765    fn decode(
3766        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3767    ) -> Result<InfoResourceEvent, fidl::Error> {
3768        let (bytes, _handles) = buf.split_mut();
3769        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3770        debug_assert_eq!(tx_header.tx_id, 0);
3771        match tx_header.ordinal {
3772            _ => Err(fidl::Error::UnknownOrdinal {
3773                ordinal: tx_header.ordinal,
3774                protocol_name: <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3775            }),
3776        }
3777    }
3778}
3779
3780/// A Stream of incoming requests for fuchsia.kernel/InfoResource.
3781pub struct InfoResourceRequestStream {
3782    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3783    is_terminated: bool,
3784}
3785
3786impl std::marker::Unpin for InfoResourceRequestStream {}
3787
3788impl futures::stream::FusedStream for InfoResourceRequestStream {
3789    fn is_terminated(&self) -> bool {
3790        self.is_terminated
3791    }
3792}
3793
3794impl fidl::endpoints::RequestStream for InfoResourceRequestStream {
3795    type Protocol = InfoResourceMarker;
3796    type ControlHandle = InfoResourceControlHandle;
3797
3798    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3799        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3800    }
3801
3802    fn control_handle(&self) -> Self::ControlHandle {
3803        InfoResourceControlHandle { inner: self.inner.clone() }
3804    }
3805
3806    fn into_inner(
3807        self,
3808    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3809    {
3810        (self.inner, self.is_terminated)
3811    }
3812
3813    fn from_inner(
3814        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3815        is_terminated: bool,
3816    ) -> Self {
3817        Self { inner, is_terminated }
3818    }
3819}
3820
3821impl futures::Stream for InfoResourceRequestStream {
3822    type Item = Result<InfoResourceRequest, fidl::Error>;
3823
3824    fn poll_next(
3825        mut self: std::pin::Pin<&mut Self>,
3826        cx: &mut std::task::Context<'_>,
3827    ) -> std::task::Poll<Option<Self::Item>> {
3828        let this = &mut *self;
3829        if this.inner.check_shutdown(cx) {
3830            this.is_terminated = true;
3831            return std::task::Poll::Ready(None);
3832        }
3833        if this.is_terminated {
3834            panic!("polled InfoResourceRequestStream after completion");
3835        }
3836        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3837            |bytes, handles| {
3838                match this.inner.channel().read_etc(cx, bytes, handles) {
3839                    std::task::Poll::Ready(Ok(())) => {}
3840                    std::task::Poll::Pending => return std::task::Poll::Pending,
3841                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3842                        this.is_terminated = true;
3843                        return std::task::Poll::Ready(None);
3844                    }
3845                    std::task::Poll::Ready(Err(e)) => {
3846                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3847                            e.into(),
3848                        ))));
3849                    }
3850                }
3851
3852                // A message has been received from the channel
3853                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3854
3855                std::task::Poll::Ready(Some(match header.ordinal {
3856                    0x1de8edcb4abc2067 => {
3857                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3858                        let mut req = fidl::new_empty!(
3859                            fidl::encoding::EmptyPayload,
3860                            fidl::encoding::DefaultFuchsiaResourceDialect
3861                        );
3862                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3863                        let control_handle =
3864                            InfoResourceControlHandle { inner: this.inner.clone() };
3865                        Ok(InfoResourceRequest::Get {
3866                            responder: InfoResourceGetResponder {
3867                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3868                                tx_id: header.tx_id,
3869                            },
3870                        })
3871                    }
3872                    _ => Err(fidl::Error::UnknownOrdinal {
3873                        ordinal: header.ordinal,
3874                        protocol_name:
3875                            <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3876                    }),
3877                }))
3878            },
3879        )
3880    }
3881}
3882
3883/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3884/// `ZX_RSRC_SYSTEM_INFO_BASE`.
3885#[derive(Debug)]
3886pub enum InfoResourceRequest {
3887    /// Get an info resource handle.
3888    Get { responder: InfoResourceGetResponder },
3889}
3890
3891impl InfoResourceRequest {
3892    #[allow(irrefutable_let_patterns)]
3893    pub fn into_get(self) -> Option<(InfoResourceGetResponder)> {
3894        if let InfoResourceRequest::Get { responder } = self { Some((responder)) } else { None }
3895    }
3896
3897    /// Name of the method defined in FIDL
3898    pub fn method_name(&self) -> &'static str {
3899        match *self {
3900            InfoResourceRequest::Get { .. } => "get",
3901        }
3902    }
3903}
3904
3905#[derive(Debug, Clone)]
3906pub struct InfoResourceControlHandle {
3907    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3908}
3909
3910impl fidl::endpoints::ControlHandle for InfoResourceControlHandle {
3911    fn shutdown(&self) {
3912        self.inner.shutdown()
3913    }
3914    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3915        self.inner.shutdown_with_epitaph(status)
3916    }
3917
3918    fn is_closed(&self) -> bool {
3919        self.inner.channel().is_closed()
3920    }
3921    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3922        self.inner.channel().on_closed()
3923    }
3924
3925    #[cfg(target_os = "fuchsia")]
3926    fn signal_peer(
3927        &self,
3928        clear_mask: zx::Signals,
3929        set_mask: zx::Signals,
3930    ) -> Result<(), zx_status::Status> {
3931        use fidl::Peered;
3932        self.inner.channel().signal_peer(clear_mask, set_mask)
3933    }
3934}
3935
3936impl InfoResourceControlHandle {}
3937
3938#[must_use = "FIDL methods require a response to be sent"]
3939#[derive(Debug)]
3940pub struct InfoResourceGetResponder {
3941    control_handle: std::mem::ManuallyDrop<InfoResourceControlHandle>,
3942    tx_id: u32,
3943}
3944
3945/// Set the the channel to be shutdown (see [`InfoResourceControlHandle::shutdown`])
3946/// if the responder is dropped without sending a response, so that the client
3947/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3948impl std::ops::Drop for InfoResourceGetResponder {
3949    fn drop(&mut self) {
3950        self.control_handle.shutdown();
3951        // Safety: drops once, never accessed again
3952        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3953    }
3954}
3955
3956impl fidl::endpoints::Responder for InfoResourceGetResponder {
3957    type ControlHandle = InfoResourceControlHandle;
3958
3959    fn control_handle(&self) -> &InfoResourceControlHandle {
3960        &self.control_handle
3961    }
3962
3963    fn drop_without_shutdown(mut self) {
3964        // Safety: drops once, never accessed again due to mem::forget
3965        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3966        // Prevent Drop from running (which would shut down the channel)
3967        std::mem::forget(self);
3968    }
3969}
3970
3971impl InfoResourceGetResponder {
3972    /// Sends a response to the FIDL transaction.
3973    ///
3974    /// Sets the channel to shutdown if an error occurs.
3975    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3976        let _result = self.send_raw(resource);
3977        if _result.is_err() {
3978            self.control_handle.shutdown();
3979        }
3980        self.drop_without_shutdown();
3981        _result
3982    }
3983
3984    /// Similar to "send" but does not shutdown the channel if an error occurs.
3985    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3986        let _result = self.send_raw(resource);
3987        self.drop_without_shutdown();
3988        _result
3989    }
3990
3991    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3992        self.control_handle.inner.send::<InfoResourceGetResponse>(
3993            (resource,),
3994            self.tx_id,
3995            0x1de8edcb4abc2067,
3996            fidl::encoding::DynamicFlags::empty(),
3997        )
3998    }
3999}
4000
4001#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4002pub struct IommuResourceMarker;
4003
4004impl fidl::endpoints::ProtocolMarker for IommuResourceMarker {
4005    type Proxy = IommuResourceProxy;
4006    type RequestStream = IommuResourceRequestStream;
4007    #[cfg(target_os = "fuchsia")]
4008    type SynchronousProxy = IommuResourceSynchronousProxy;
4009
4010    const DEBUG_NAME: &'static str = "fuchsia.kernel.IommuResource";
4011}
4012impl fidl::endpoints::DiscoverableProtocolMarker for IommuResourceMarker {}
4013
4014pub trait IommuResourceProxyInterface: Send + Sync {
4015    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4016    fn r#get(&self) -> Self::GetResponseFut;
4017}
4018#[derive(Debug)]
4019#[cfg(target_os = "fuchsia")]
4020pub struct IommuResourceSynchronousProxy {
4021    client: fidl::client::sync::Client,
4022}
4023
4024#[cfg(target_os = "fuchsia")]
4025impl fidl::endpoints::SynchronousProxy for IommuResourceSynchronousProxy {
4026    type Proxy = IommuResourceProxy;
4027    type Protocol = IommuResourceMarker;
4028
4029    fn from_channel(inner: fidl::Channel) -> Self {
4030        Self::new(inner)
4031    }
4032
4033    fn into_channel(self) -> fidl::Channel {
4034        self.client.into_channel()
4035    }
4036
4037    fn as_channel(&self) -> &fidl::Channel {
4038        self.client.as_channel()
4039    }
4040}
4041
4042#[cfg(target_os = "fuchsia")]
4043impl IommuResourceSynchronousProxy {
4044    pub fn new(channel: fidl::Channel) -> Self {
4045        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4046        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4047    }
4048
4049    pub fn into_channel(self) -> fidl::Channel {
4050        self.client.into_channel()
4051    }
4052
4053    /// Waits until an event arrives and returns it. It is safe for other
4054    /// threads to make concurrent requests while waiting for an event.
4055    pub fn wait_for_event(
4056        &self,
4057        deadline: zx::MonotonicInstant,
4058    ) -> Result<IommuResourceEvent, fidl::Error> {
4059        IommuResourceEvent::decode(self.client.wait_for_event(deadline)?)
4060    }
4061
4062    /// Get an iommu resource handle.
4063    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4064        let _response =
4065            self.client.send_query::<fidl::encoding::EmptyPayload, IommuResourceGetResponse>(
4066                (),
4067                0x5af309b619aa7c5b,
4068                fidl::encoding::DynamicFlags::empty(),
4069                ___deadline,
4070            )?;
4071        Ok(_response.resource)
4072    }
4073}
4074
4075#[cfg(target_os = "fuchsia")]
4076impl From<IommuResourceSynchronousProxy> for zx::Handle {
4077    fn from(value: IommuResourceSynchronousProxy) -> Self {
4078        value.into_channel().into()
4079    }
4080}
4081
4082#[cfg(target_os = "fuchsia")]
4083impl From<fidl::Channel> for IommuResourceSynchronousProxy {
4084    fn from(value: fidl::Channel) -> Self {
4085        Self::new(value)
4086    }
4087}
4088
4089#[cfg(target_os = "fuchsia")]
4090impl fidl::endpoints::FromClient for IommuResourceSynchronousProxy {
4091    type Protocol = IommuResourceMarker;
4092
4093    fn from_client(value: fidl::endpoints::ClientEnd<IommuResourceMarker>) -> Self {
4094        Self::new(value.into_channel())
4095    }
4096}
4097
4098#[derive(Debug, Clone)]
4099pub struct IommuResourceProxy {
4100    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4101}
4102
4103impl fidl::endpoints::Proxy for IommuResourceProxy {
4104    type Protocol = IommuResourceMarker;
4105
4106    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4107        Self::new(inner)
4108    }
4109
4110    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4111        self.client.into_channel().map_err(|client| Self { client })
4112    }
4113
4114    fn as_channel(&self) -> &::fidl::AsyncChannel {
4115        self.client.as_channel()
4116    }
4117}
4118
4119impl IommuResourceProxy {
4120    /// Create a new Proxy for fuchsia.kernel/IommuResource.
4121    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4122        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4123        Self { client: fidl::client::Client::new(channel, protocol_name) }
4124    }
4125
4126    /// Get a Stream of events from the remote end of the protocol.
4127    ///
4128    /// # Panics
4129    ///
4130    /// Panics if the event stream was already taken.
4131    pub fn take_event_stream(&self) -> IommuResourceEventStream {
4132        IommuResourceEventStream { event_receiver: self.client.take_event_receiver() }
4133    }
4134
4135    /// Get an iommu resource handle.
4136    pub fn r#get(
4137        &self,
4138    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4139    {
4140        IommuResourceProxyInterface::r#get(self)
4141    }
4142}
4143
4144impl IommuResourceProxyInterface for IommuResourceProxy {
4145    type GetResponseFut = fidl::client::QueryResponseFut<
4146        fidl::Resource,
4147        fidl::encoding::DefaultFuchsiaResourceDialect,
4148    >;
4149    fn r#get(&self) -> Self::GetResponseFut {
4150        fn _decode(
4151            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4152        ) -> Result<fidl::Resource, fidl::Error> {
4153            let _response = fidl::client::decode_transaction_body::<
4154                IommuResourceGetResponse,
4155                fidl::encoding::DefaultFuchsiaResourceDialect,
4156                0x5af309b619aa7c5b,
4157            >(_buf?)?;
4158            Ok(_response.resource)
4159        }
4160        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4161            (),
4162            0x5af309b619aa7c5b,
4163            fidl::encoding::DynamicFlags::empty(),
4164            _decode,
4165        )
4166    }
4167}
4168
4169pub struct IommuResourceEventStream {
4170    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4171}
4172
4173impl std::marker::Unpin for IommuResourceEventStream {}
4174
4175impl futures::stream::FusedStream for IommuResourceEventStream {
4176    fn is_terminated(&self) -> bool {
4177        self.event_receiver.is_terminated()
4178    }
4179}
4180
4181impl futures::Stream for IommuResourceEventStream {
4182    type Item = Result<IommuResourceEvent, fidl::Error>;
4183
4184    fn poll_next(
4185        mut self: std::pin::Pin<&mut Self>,
4186        cx: &mut std::task::Context<'_>,
4187    ) -> std::task::Poll<Option<Self::Item>> {
4188        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4189            &mut self.event_receiver,
4190            cx
4191        )?) {
4192            Some(buf) => std::task::Poll::Ready(Some(IommuResourceEvent::decode(buf))),
4193            None => std::task::Poll::Ready(None),
4194        }
4195    }
4196}
4197
4198#[derive(Debug)]
4199pub enum IommuResourceEvent {}
4200
4201impl IommuResourceEvent {
4202    /// Decodes a message buffer as a [`IommuResourceEvent`].
4203    fn decode(
4204        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4205    ) -> Result<IommuResourceEvent, fidl::Error> {
4206        let (bytes, _handles) = buf.split_mut();
4207        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4208        debug_assert_eq!(tx_header.tx_id, 0);
4209        match tx_header.ordinal {
4210            _ => Err(fidl::Error::UnknownOrdinal {
4211                ordinal: tx_header.ordinal,
4212                protocol_name: <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4213            }),
4214        }
4215    }
4216}
4217
4218/// A Stream of incoming requests for fuchsia.kernel/IommuResource.
4219pub struct IommuResourceRequestStream {
4220    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4221    is_terminated: bool,
4222}
4223
4224impl std::marker::Unpin for IommuResourceRequestStream {}
4225
4226impl futures::stream::FusedStream for IommuResourceRequestStream {
4227    fn is_terminated(&self) -> bool {
4228        self.is_terminated
4229    }
4230}
4231
4232impl fidl::endpoints::RequestStream for IommuResourceRequestStream {
4233    type Protocol = IommuResourceMarker;
4234    type ControlHandle = IommuResourceControlHandle;
4235
4236    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4237        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4238    }
4239
4240    fn control_handle(&self) -> Self::ControlHandle {
4241        IommuResourceControlHandle { inner: self.inner.clone() }
4242    }
4243
4244    fn into_inner(
4245        self,
4246    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4247    {
4248        (self.inner, self.is_terminated)
4249    }
4250
4251    fn from_inner(
4252        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4253        is_terminated: bool,
4254    ) -> Self {
4255        Self { inner, is_terminated }
4256    }
4257}
4258
4259impl futures::Stream for IommuResourceRequestStream {
4260    type Item = Result<IommuResourceRequest, fidl::Error>;
4261
4262    fn poll_next(
4263        mut self: std::pin::Pin<&mut Self>,
4264        cx: &mut std::task::Context<'_>,
4265    ) -> std::task::Poll<Option<Self::Item>> {
4266        let this = &mut *self;
4267        if this.inner.check_shutdown(cx) {
4268            this.is_terminated = true;
4269            return std::task::Poll::Ready(None);
4270        }
4271        if this.is_terminated {
4272            panic!("polled IommuResourceRequestStream after completion");
4273        }
4274        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4275            |bytes, handles| {
4276                match this.inner.channel().read_etc(cx, bytes, handles) {
4277                    std::task::Poll::Ready(Ok(())) => {}
4278                    std::task::Poll::Pending => return std::task::Poll::Pending,
4279                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4280                        this.is_terminated = true;
4281                        return std::task::Poll::Ready(None);
4282                    }
4283                    std::task::Poll::Ready(Err(e)) => {
4284                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4285                            e.into(),
4286                        ))));
4287                    }
4288                }
4289
4290                // A message has been received from the channel
4291                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4292
4293                std::task::Poll::Ready(Some(match header.ordinal {
4294                    0x5af309b619aa7c5b => {
4295                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4296                        let mut req = fidl::new_empty!(
4297                            fidl::encoding::EmptyPayload,
4298                            fidl::encoding::DefaultFuchsiaResourceDialect
4299                        );
4300                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4301                        let control_handle =
4302                            IommuResourceControlHandle { inner: this.inner.clone() };
4303                        Ok(IommuResourceRequest::Get {
4304                            responder: IommuResourceGetResponder {
4305                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4306                                tx_id: header.tx_id,
4307                            },
4308                        })
4309                    }
4310                    _ => Err(fidl::Error::UnknownOrdinal {
4311                        ordinal: header.ordinal,
4312                        protocol_name:
4313                            <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4314                    }),
4315                }))
4316            },
4317        )
4318    }
4319}
4320
4321/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
4322/// `ZX_RSRC_SYSTEM_IOMMU_BASE`.
4323#[derive(Debug)]
4324pub enum IommuResourceRequest {
4325    /// Get an iommu resource handle.
4326    Get { responder: IommuResourceGetResponder },
4327}
4328
4329impl IommuResourceRequest {
4330    #[allow(irrefutable_let_patterns)]
4331    pub fn into_get(self) -> Option<(IommuResourceGetResponder)> {
4332        if let IommuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4333    }
4334
4335    /// Name of the method defined in FIDL
4336    pub fn method_name(&self) -> &'static str {
4337        match *self {
4338            IommuResourceRequest::Get { .. } => "get",
4339        }
4340    }
4341}
4342
4343#[derive(Debug, Clone)]
4344pub struct IommuResourceControlHandle {
4345    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4346}
4347
4348impl fidl::endpoints::ControlHandle for IommuResourceControlHandle {
4349    fn shutdown(&self) {
4350        self.inner.shutdown()
4351    }
4352    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4353        self.inner.shutdown_with_epitaph(status)
4354    }
4355
4356    fn is_closed(&self) -> bool {
4357        self.inner.channel().is_closed()
4358    }
4359    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4360        self.inner.channel().on_closed()
4361    }
4362
4363    #[cfg(target_os = "fuchsia")]
4364    fn signal_peer(
4365        &self,
4366        clear_mask: zx::Signals,
4367        set_mask: zx::Signals,
4368    ) -> Result<(), zx_status::Status> {
4369        use fidl::Peered;
4370        self.inner.channel().signal_peer(clear_mask, set_mask)
4371    }
4372}
4373
4374impl IommuResourceControlHandle {}
4375
4376#[must_use = "FIDL methods require a response to be sent"]
4377#[derive(Debug)]
4378pub struct IommuResourceGetResponder {
4379    control_handle: std::mem::ManuallyDrop<IommuResourceControlHandle>,
4380    tx_id: u32,
4381}
4382
4383/// Set the the channel to be shutdown (see [`IommuResourceControlHandle::shutdown`])
4384/// if the responder is dropped without sending a response, so that the client
4385/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4386impl std::ops::Drop for IommuResourceGetResponder {
4387    fn drop(&mut self) {
4388        self.control_handle.shutdown();
4389        // Safety: drops once, never accessed again
4390        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4391    }
4392}
4393
4394impl fidl::endpoints::Responder for IommuResourceGetResponder {
4395    type ControlHandle = IommuResourceControlHandle;
4396
4397    fn control_handle(&self) -> &IommuResourceControlHandle {
4398        &self.control_handle
4399    }
4400
4401    fn drop_without_shutdown(mut self) {
4402        // Safety: drops once, never accessed again due to mem::forget
4403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4404        // Prevent Drop from running (which would shut down the channel)
4405        std::mem::forget(self);
4406    }
4407}
4408
4409impl IommuResourceGetResponder {
4410    /// Sends a response to the FIDL transaction.
4411    ///
4412    /// Sets the channel to shutdown if an error occurs.
4413    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4414        let _result = self.send_raw(resource);
4415        if _result.is_err() {
4416            self.control_handle.shutdown();
4417        }
4418        self.drop_without_shutdown();
4419        _result
4420    }
4421
4422    /// Similar to "send" but does not shutdown the channel if an error occurs.
4423    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4424        let _result = self.send_raw(resource);
4425        self.drop_without_shutdown();
4426        _result
4427    }
4428
4429    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4430        self.control_handle.inner.send::<IommuResourceGetResponse>(
4431            (resource,),
4432            self.tx_id,
4433            0x5af309b619aa7c5b,
4434            fidl::encoding::DynamicFlags::empty(),
4435        )
4436    }
4437}
4438
4439#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4440pub struct IoportResourceMarker;
4441
4442impl fidl::endpoints::ProtocolMarker for IoportResourceMarker {
4443    type Proxy = IoportResourceProxy;
4444    type RequestStream = IoportResourceRequestStream;
4445    #[cfg(target_os = "fuchsia")]
4446    type SynchronousProxy = IoportResourceSynchronousProxy;
4447
4448    const DEBUG_NAME: &'static str = "fuchsia.kernel.IoportResource";
4449}
4450impl fidl::endpoints::DiscoverableProtocolMarker for IoportResourceMarker {}
4451
4452pub trait IoportResourceProxyInterface: Send + Sync {
4453    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4454    fn r#get(&self) -> Self::GetResponseFut;
4455}
4456#[derive(Debug)]
4457#[cfg(target_os = "fuchsia")]
4458pub struct IoportResourceSynchronousProxy {
4459    client: fidl::client::sync::Client,
4460}
4461
4462#[cfg(target_os = "fuchsia")]
4463impl fidl::endpoints::SynchronousProxy for IoportResourceSynchronousProxy {
4464    type Proxy = IoportResourceProxy;
4465    type Protocol = IoportResourceMarker;
4466
4467    fn from_channel(inner: fidl::Channel) -> Self {
4468        Self::new(inner)
4469    }
4470
4471    fn into_channel(self) -> fidl::Channel {
4472        self.client.into_channel()
4473    }
4474
4475    fn as_channel(&self) -> &fidl::Channel {
4476        self.client.as_channel()
4477    }
4478}
4479
4480#[cfg(target_os = "fuchsia")]
4481impl IoportResourceSynchronousProxy {
4482    pub fn new(channel: fidl::Channel) -> Self {
4483        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4484        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4485    }
4486
4487    pub fn into_channel(self) -> fidl::Channel {
4488        self.client.into_channel()
4489    }
4490
4491    /// Waits until an event arrives and returns it. It is safe for other
4492    /// threads to make concurrent requests while waiting for an event.
4493    pub fn wait_for_event(
4494        &self,
4495        deadline: zx::MonotonicInstant,
4496    ) -> Result<IoportResourceEvent, fidl::Error> {
4497        IoportResourceEvent::decode(self.client.wait_for_event(deadline)?)
4498    }
4499
4500    /// Get an IO Port resource handle.
4501    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4502        let _response =
4503            self.client.send_query::<fidl::encoding::EmptyPayload, IoportResourceGetResponse>(
4504                (),
4505                0x4db20876b537c52b,
4506                fidl::encoding::DynamicFlags::empty(),
4507                ___deadline,
4508            )?;
4509        Ok(_response.resource)
4510    }
4511}
4512
4513#[cfg(target_os = "fuchsia")]
4514impl From<IoportResourceSynchronousProxy> for zx::Handle {
4515    fn from(value: IoportResourceSynchronousProxy) -> Self {
4516        value.into_channel().into()
4517    }
4518}
4519
4520#[cfg(target_os = "fuchsia")]
4521impl From<fidl::Channel> for IoportResourceSynchronousProxy {
4522    fn from(value: fidl::Channel) -> Self {
4523        Self::new(value)
4524    }
4525}
4526
4527#[cfg(target_os = "fuchsia")]
4528impl fidl::endpoints::FromClient for IoportResourceSynchronousProxy {
4529    type Protocol = IoportResourceMarker;
4530
4531    fn from_client(value: fidl::endpoints::ClientEnd<IoportResourceMarker>) -> Self {
4532        Self::new(value.into_channel())
4533    }
4534}
4535
4536#[derive(Debug, Clone)]
4537pub struct IoportResourceProxy {
4538    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4539}
4540
4541impl fidl::endpoints::Proxy for IoportResourceProxy {
4542    type Protocol = IoportResourceMarker;
4543
4544    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4545        Self::new(inner)
4546    }
4547
4548    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4549        self.client.into_channel().map_err(|client| Self { client })
4550    }
4551
4552    fn as_channel(&self) -> &::fidl::AsyncChannel {
4553        self.client.as_channel()
4554    }
4555}
4556
4557impl IoportResourceProxy {
4558    /// Create a new Proxy for fuchsia.kernel/IoportResource.
4559    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4560        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4561        Self { client: fidl::client::Client::new(channel, protocol_name) }
4562    }
4563
4564    /// Get a Stream of events from the remote end of the protocol.
4565    ///
4566    /// # Panics
4567    ///
4568    /// Panics if the event stream was already taken.
4569    pub fn take_event_stream(&self) -> IoportResourceEventStream {
4570        IoportResourceEventStream { event_receiver: self.client.take_event_receiver() }
4571    }
4572
4573    /// Get an IO Port resource handle.
4574    pub fn r#get(
4575        &self,
4576    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4577    {
4578        IoportResourceProxyInterface::r#get(self)
4579    }
4580}
4581
4582impl IoportResourceProxyInterface for IoportResourceProxy {
4583    type GetResponseFut = fidl::client::QueryResponseFut<
4584        fidl::Resource,
4585        fidl::encoding::DefaultFuchsiaResourceDialect,
4586    >;
4587    fn r#get(&self) -> Self::GetResponseFut {
4588        fn _decode(
4589            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4590        ) -> Result<fidl::Resource, fidl::Error> {
4591            let _response = fidl::client::decode_transaction_body::<
4592                IoportResourceGetResponse,
4593                fidl::encoding::DefaultFuchsiaResourceDialect,
4594                0x4db20876b537c52b,
4595            >(_buf?)?;
4596            Ok(_response.resource)
4597        }
4598        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4599            (),
4600            0x4db20876b537c52b,
4601            fidl::encoding::DynamicFlags::empty(),
4602            _decode,
4603        )
4604    }
4605}
4606
4607pub struct IoportResourceEventStream {
4608    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4609}
4610
4611impl std::marker::Unpin for IoportResourceEventStream {}
4612
4613impl futures::stream::FusedStream for IoportResourceEventStream {
4614    fn is_terminated(&self) -> bool {
4615        self.event_receiver.is_terminated()
4616    }
4617}
4618
4619impl futures::Stream for IoportResourceEventStream {
4620    type Item = Result<IoportResourceEvent, fidl::Error>;
4621
4622    fn poll_next(
4623        mut self: std::pin::Pin<&mut Self>,
4624        cx: &mut std::task::Context<'_>,
4625    ) -> std::task::Poll<Option<Self::Item>> {
4626        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4627            &mut self.event_receiver,
4628            cx
4629        )?) {
4630            Some(buf) => std::task::Poll::Ready(Some(IoportResourceEvent::decode(buf))),
4631            None => std::task::Poll::Ready(None),
4632        }
4633    }
4634}
4635
4636#[derive(Debug)]
4637pub enum IoportResourceEvent {}
4638
4639impl IoportResourceEvent {
4640    /// Decodes a message buffer as a [`IoportResourceEvent`].
4641    fn decode(
4642        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4643    ) -> Result<IoportResourceEvent, fidl::Error> {
4644        let (bytes, _handles) = buf.split_mut();
4645        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4646        debug_assert_eq!(tx_header.tx_id, 0);
4647        match tx_header.ordinal {
4648            _ => Err(fidl::Error::UnknownOrdinal {
4649                ordinal: tx_header.ordinal,
4650                protocol_name:
4651                    <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4652            }),
4653        }
4654    }
4655}
4656
4657/// A Stream of incoming requests for fuchsia.kernel/IoportResource.
4658pub struct IoportResourceRequestStream {
4659    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4660    is_terminated: bool,
4661}
4662
4663impl std::marker::Unpin for IoportResourceRequestStream {}
4664
4665impl futures::stream::FusedStream for IoportResourceRequestStream {
4666    fn is_terminated(&self) -> bool {
4667        self.is_terminated
4668    }
4669}
4670
4671impl fidl::endpoints::RequestStream for IoportResourceRequestStream {
4672    type Protocol = IoportResourceMarker;
4673    type ControlHandle = IoportResourceControlHandle;
4674
4675    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4676        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4677    }
4678
4679    fn control_handle(&self) -> Self::ControlHandle {
4680        IoportResourceControlHandle { inner: self.inner.clone() }
4681    }
4682
4683    fn into_inner(
4684        self,
4685    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4686    {
4687        (self.inner, self.is_terminated)
4688    }
4689
4690    fn from_inner(
4691        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4692        is_terminated: bool,
4693    ) -> Self {
4694        Self { inner, is_terminated }
4695    }
4696}
4697
4698impl futures::Stream for IoportResourceRequestStream {
4699    type Item = Result<IoportResourceRequest, fidl::Error>;
4700
4701    fn poll_next(
4702        mut self: std::pin::Pin<&mut Self>,
4703        cx: &mut std::task::Context<'_>,
4704    ) -> std::task::Poll<Option<Self::Item>> {
4705        let this = &mut *self;
4706        if this.inner.check_shutdown(cx) {
4707            this.is_terminated = true;
4708            return std::task::Poll::Ready(None);
4709        }
4710        if this.is_terminated {
4711            panic!("polled IoportResourceRequestStream after completion");
4712        }
4713        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4714            |bytes, handles| {
4715                match this.inner.channel().read_etc(cx, bytes, handles) {
4716                    std::task::Poll::Ready(Ok(())) => {}
4717                    std::task::Poll::Pending => return std::task::Poll::Pending,
4718                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4719                        this.is_terminated = true;
4720                        return std::task::Poll::Ready(None);
4721                    }
4722                    std::task::Poll::Ready(Err(e)) => {
4723                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4724                            e.into(),
4725                        ))));
4726                    }
4727                }
4728
4729                // A message has been received from the channel
4730                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4731
4732                std::task::Poll::Ready(Some(match header.ordinal {
4733                    0x4db20876b537c52b => {
4734                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4735                        let mut req = fidl::new_empty!(
4736                            fidl::encoding::EmptyPayload,
4737                            fidl::encoding::DefaultFuchsiaResourceDialect
4738                        );
4739                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4740                        let control_handle =
4741                            IoportResourceControlHandle { inner: this.inner.clone() };
4742                        Ok(IoportResourceRequest::Get {
4743                            responder: IoportResourceGetResponder {
4744                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4745                                tx_id: header.tx_id,
4746                            },
4747                        })
4748                    }
4749                    _ => Err(fidl::Error::UnknownOrdinal {
4750                        ordinal: header.ordinal,
4751                        protocol_name:
4752                            <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4753                    }),
4754                }))
4755            },
4756        )
4757    }
4758}
4759
4760/// Protocol for providing an IO Port resource with access to all valid ranges.
4761#[derive(Debug)]
4762pub enum IoportResourceRequest {
4763    /// Get an IO Port resource handle.
4764    Get { responder: IoportResourceGetResponder },
4765}
4766
4767impl IoportResourceRequest {
4768    #[allow(irrefutable_let_patterns)]
4769    pub fn into_get(self) -> Option<(IoportResourceGetResponder)> {
4770        if let IoportResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4771    }
4772
4773    /// Name of the method defined in FIDL
4774    pub fn method_name(&self) -> &'static str {
4775        match *self {
4776            IoportResourceRequest::Get { .. } => "get",
4777        }
4778    }
4779}
4780
4781#[derive(Debug, Clone)]
4782pub struct IoportResourceControlHandle {
4783    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4784}
4785
4786impl fidl::endpoints::ControlHandle for IoportResourceControlHandle {
4787    fn shutdown(&self) {
4788        self.inner.shutdown()
4789    }
4790    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4791        self.inner.shutdown_with_epitaph(status)
4792    }
4793
4794    fn is_closed(&self) -> bool {
4795        self.inner.channel().is_closed()
4796    }
4797    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4798        self.inner.channel().on_closed()
4799    }
4800
4801    #[cfg(target_os = "fuchsia")]
4802    fn signal_peer(
4803        &self,
4804        clear_mask: zx::Signals,
4805        set_mask: zx::Signals,
4806    ) -> Result<(), zx_status::Status> {
4807        use fidl::Peered;
4808        self.inner.channel().signal_peer(clear_mask, set_mask)
4809    }
4810}
4811
4812impl IoportResourceControlHandle {}
4813
4814#[must_use = "FIDL methods require a response to be sent"]
4815#[derive(Debug)]
4816pub struct IoportResourceGetResponder {
4817    control_handle: std::mem::ManuallyDrop<IoportResourceControlHandle>,
4818    tx_id: u32,
4819}
4820
4821/// Set the the channel to be shutdown (see [`IoportResourceControlHandle::shutdown`])
4822/// if the responder is dropped without sending a response, so that the client
4823/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4824impl std::ops::Drop for IoportResourceGetResponder {
4825    fn drop(&mut self) {
4826        self.control_handle.shutdown();
4827        // Safety: drops once, never accessed again
4828        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4829    }
4830}
4831
4832impl fidl::endpoints::Responder for IoportResourceGetResponder {
4833    type ControlHandle = IoportResourceControlHandle;
4834
4835    fn control_handle(&self) -> &IoportResourceControlHandle {
4836        &self.control_handle
4837    }
4838
4839    fn drop_without_shutdown(mut self) {
4840        // Safety: drops once, never accessed again due to mem::forget
4841        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4842        // Prevent Drop from running (which would shut down the channel)
4843        std::mem::forget(self);
4844    }
4845}
4846
4847impl IoportResourceGetResponder {
4848    /// Sends a response to the FIDL transaction.
4849    ///
4850    /// Sets the channel to shutdown if an error occurs.
4851    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4852        let _result = self.send_raw(resource);
4853        if _result.is_err() {
4854            self.control_handle.shutdown();
4855        }
4856        self.drop_without_shutdown();
4857        _result
4858    }
4859
4860    /// Similar to "send" but does not shutdown the channel if an error occurs.
4861    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4862        let _result = self.send_raw(resource);
4863        self.drop_without_shutdown();
4864        _result
4865    }
4866
4867    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4868        self.control_handle.inner.send::<IoportResourceGetResponse>(
4869            (resource,),
4870            self.tx_id,
4871            0x4db20876b537c52b,
4872            fidl::encoding::DynamicFlags::empty(),
4873        )
4874    }
4875}
4876
4877#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4878pub struct IrqResourceMarker;
4879
4880impl fidl::endpoints::ProtocolMarker for IrqResourceMarker {
4881    type Proxy = IrqResourceProxy;
4882    type RequestStream = IrqResourceRequestStream;
4883    #[cfg(target_os = "fuchsia")]
4884    type SynchronousProxy = IrqResourceSynchronousProxy;
4885
4886    const DEBUG_NAME: &'static str = "fuchsia.kernel.IrqResource";
4887}
4888impl fidl::endpoints::DiscoverableProtocolMarker for IrqResourceMarker {}
4889
4890pub trait IrqResourceProxyInterface: Send + Sync {
4891    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4892    fn r#get(&self) -> Self::GetResponseFut;
4893}
4894#[derive(Debug)]
4895#[cfg(target_os = "fuchsia")]
4896pub struct IrqResourceSynchronousProxy {
4897    client: fidl::client::sync::Client,
4898}
4899
4900#[cfg(target_os = "fuchsia")]
4901impl fidl::endpoints::SynchronousProxy for IrqResourceSynchronousProxy {
4902    type Proxy = IrqResourceProxy;
4903    type Protocol = IrqResourceMarker;
4904
4905    fn from_channel(inner: fidl::Channel) -> Self {
4906        Self::new(inner)
4907    }
4908
4909    fn into_channel(self) -> fidl::Channel {
4910        self.client.into_channel()
4911    }
4912
4913    fn as_channel(&self) -> &fidl::Channel {
4914        self.client.as_channel()
4915    }
4916}
4917
4918#[cfg(target_os = "fuchsia")]
4919impl IrqResourceSynchronousProxy {
4920    pub fn new(channel: fidl::Channel) -> Self {
4921        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4922        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4923    }
4924
4925    pub fn into_channel(self) -> fidl::Channel {
4926        self.client.into_channel()
4927    }
4928
4929    /// Waits until an event arrives and returns it. It is safe for other
4930    /// threads to make concurrent requests while waiting for an event.
4931    pub fn wait_for_event(
4932        &self,
4933        deadline: zx::MonotonicInstant,
4934    ) -> Result<IrqResourceEvent, fidl::Error> {
4935        IrqResourceEvent::decode(self.client.wait_for_event(deadline)?)
4936    }
4937
4938    /// Get an IRQ resource handle.
4939    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4940        let _response =
4941            self.client.send_query::<fidl::encoding::EmptyPayload, IrqResourceGetResponse>(
4942                (),
4943                0x491be54504b041e9,
4944                fidl::encoding::DynamicFlags::empty(),
4945                ___deadline,
4946            )?;
4947        Ok(_response.resource)
4948    }
4949}
4950
4951#[cfg(target_os = "fuchsia")]
4952impl From<IrqResourceSynchronousProxy> for zx::Handle {
4953    fn from(value: IrqResourceSynchronousProxy) -> Self {
4954        value.into_channel().into()
4955    }
4956}
4957
4958#[cfg(target_os = "fuchsia")]
4959impl From<fidl::Channel> for IrqResourceSynchronousProxy {
4960    fn from(value: fidl::Channel) -> Self {
4961        Self::new(value)
4962    }
4963}
4964
4965#[cfg(target_os = "fuchsia")]
4966impl fidl::endpoints::FromClient for IrqResourceSynchronousProxy {
4967    type Protocol = IrqResourceMarker;
4968
4969    fn from_client(value: fidl::endpoints::ClientEnd<IrqResourceMarker>) -> Self {
4970        Self::new(value.into_channel())
4971    }
4972}
4973
4974#[derive(Debug, Clone)]
4975pub struct IrqResourceProxy {
4976    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4977}
4978
4979impl fidl::endpoints::Proxy for IrqResourceProxy {
4980    type Protocol = IrqResourceMarker;
4981
4982    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4983        Self::new(inner)
4984    }
4985
4986    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4987        self.client.into_channel().map_err(|client| Self { client })
4988    }
4989
4990    fn as_channel(&self) -> &::fidl::AsyncChannel {
4991        self.client.as_channel()
4992    }
4993}
4994
4995impl IrqResourceProxy {
4996    /// Create a new Proxy for fuchsia.kernel/IrqResource.
4997    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4998        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4999        Self { client: fidl::client::Client::new(channel, protocol_name) }
5000    }
5001
5002    /// Get a Stream of events from the remote end of the protocol.
5003    ///
5004    /// # Panics
5005    ///
5006    /// Panics if the event stream was already taken.
5007    pub fn take_event_stream(&self) -> IrqResourceEventStream {
5008        IrqResourceEventStream { event_receiver: self.client.take_event_receiver() }
5009    }
5010
5011    /// Get an IRQ resource handle.
5012    pub fn r#get(
5013        &self,
5014    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5015    {
5016        IrqResourceProxyInterface::r#get(self)
5017    }
5018}
5019
5020impl IrqResourceProxyInterface for IrqResourceProxy {
5021    type GetResponseFut = fidl::client::QueryResponseFut<
5022        fidl::Resource,
5023        fidl::encoding::DefaultFuchsiaResourceDialect,
5024    >;
5025    fn r#get(&self) -> Self::GetResponseFut {
5026        fn _decode(
5027            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5028        ) -> Result<fidl::Resource, fidl::Error> {
5029            let _response = fidl::client::decode_transaction_body::<
5030                IrqResourceGetResponse,
5031                fidl::encoding::DefaultFuchsiaResourceDialect,
5032                0x491be54504b041e9,
5033            >(_buf?)?;
5034            Ok(_response.resource)
5035        }
5036        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5037            (),
5038            0x491be54504b041e9,
5039            fidl::encoding::DynamicFlags::empty(),
5040            _decode,
5041        )
5042    }
5043}
5044
5045pub struct IrqResourceEventStream {
5046    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5047}
5048
5049impl std::marker::Unpin for IrqResourceEventStream {}
5050
5051impl futures::stream::FusedStream for IrqResourceEventStream {
5052    fn is_terminated(&self) -> bool {
5053        self.event_receiver.is_terminated()
5054    }
5055}
5056
5057impl futures::Stream for IrqResourceEventStream {
5058    type Item = Result<IrqResourceEvent, fidl::Error>;
5059
5060    fn poll_next(
5061        mut self: std::pin::Pin<&mut Self>,
5062        cx: &mut std::task::Context<'_>,
5063    ) -> std::task::Poll<Option<Self::Item>> {
5064        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5065            &mut self.event_receiver,
5066            cx
5067        )?) {
5068            Some(buf) => std::task::Poll::Ready(Some(IrqResourceEvent::decode(buf))),
5069            None => std::task::Poll::Ready(None),
5070        }
5071    }
5072}
5073
5074#[derive(Debug)]
5075pub enum IrqResourceEvent {}
5076
5077impl IrqResourceEvent {
5078    /// Decodes a message buffer as a [`IrqResourceEvent`].
5079    fn decode(
5080        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5081    ) -> Result<IrqResourceEvent, fidl::Error> {
5082        let (bytes, _handles) = buf.split_mut();
5083        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5084        debug_assert_eq!(tx_header.tx_id, 0);
5085        match tx_header.ordinal {
5086            _ => Err(fidl::Error::UnknownOrdinal {
5087                ordinal: tx_header.ordinal,
5088                protocol_name: <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5089            }),
5090        }
5091    }
5092}
5093
5094/// A Stream of incoming requests for fuchsia.kernel/IrqResource.
5095pub struct IrqResourceRequestStream {
5096    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5097    is_terminated: bool,
5098}
5099
5100impl std::marker::Unpin for IrqResourceRequestStream {}
5101
5102impl futures::stream::FusedStream for IrqResourceRequestStream {
5103    fn is_terminated(&self) -> bool {
5104        self.is_terminated
5105    }
5106}
5107
5108impl fidl::endpoints::RequestStream for IrqResourceRequestStream {
5109    type Protocol = IrqResourceMarker;
5110    type ControlHandle = IrqResourceControlHandle;
5111
5112    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5113        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5114    }
5115
5116    fn control_handle(&self) -> Self::ControlHandle {
5117        IrqResourceControlHandle { inner: self.inner.clone() }
5118    }
5119
5120    fn into_inner(
5121        self,
5122    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5123    {
5124        (self.inner, self.is_terminated)
5125    }
5126
5127    fn from_inner(
5128        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5129        is_terminated: bool,
5130    ) -> Self {
5131        Self { inner, is_terminated }
5132    }
5133}
5134
5135impl futures::Stream for IrqResourceRequestStream {
5136    type Item = Result<IrqResourceRequest, fidl::Error>;
5137
5138    fn poll_next(
5139        mut self: std::pin::Pin<&mut Self>,
5140        cx: &mut std::task::Context<'_>,
5141    ) -> std::task::Poll<Option<Self::Item>> {
5142        let this = &mut *self;
5143        if this.inner.check_shutdown(cx) {
5144            this.is_terminated = true;
5145            return std::task::Poll::Ready(None);
5146        }
5147        if this.is_terminated {
5148            panic!("polled IrqResourceRequestStream after completion");
5149        }
5150        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5151            |bytes, handles| {
5152                match this.inner.channel().read_etc(cx, bytes, handles) {
5153                    std::task::Poll::Ready(Ok(())) => {}
5154                    std::task::Poll::Pending => return std::task::Poll::Pending,
5155                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5156                        this.is_terminated = true;
5157                        return std::task::Poll::Ready(None);
5158                    }
5159                    std::task::Poll::Ready(Err(e)) => {
5160                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5161                            e.into(),
5162                        ))));
5163                    }
5164                }
5165
5166                // A message has been received from the channel
5167                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5168
5169                std::task::Poll::Ready(Some(match header.ordinal {
5170                    0x491be54504b041e9 => {
5171                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5172                        let mut req = fidl::new_empty!(
5173                            fidl::encoding::EmptyPayload,
5174                            fidl::encoding::DefaultFuchsiaResourceDialect
5175                        );
5176                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5177                        let control_handle = IrqResourceControlHandle { inner: this.inner.clone() };
5178                        Ok(IrqResourceRequest::Get {
5179                            responder: IrqResourceGetResponder {
5180                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5181                                tx_id: header.tx_id,
5182                            },
5183                        })
5184                    }
5185                    _ => Err(fidl::Error::UnknownOrdinal {
5186                        ordinal: header.ordinal,
5187                        protocol_name:
5188                            <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5189                    }),
5190                }))
5191            },
5192        )
5193    }
5194}
5195
5196/// Protocol for providing an IRQ resource with access to all valid ranges.
5197#[derive(Debug)]
5198pub enum IrqResourceRequest {
5199    /// Get an IRQ resource handle.
5200    Get { responder: IrqResourceGetResponder },
5201}
5202
5203impl IrqResourceRequest {
5204    #[allow(irrefutable_let_patterns)]
5205    pub fn into_get(self) -> Option<(IrqResourceGetResponder)> {
5206        if let IrqResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5207    }
5208
5209    /// Name of the method defined in FIDL
5210    pub fn method_name(&self) -> &'static str {
5211        match *self {
5212            IrqResourceRequest::Get { .. } => "get",
5213        }
5214    }
5215}
5216
5217#[derive(Debug, Clone)]
5218pub struct IrqResourceControlHandle {
5219    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5220}
5221
5222impl fidl::endpoints::ControlHandle for IrqResourceControlHandle {
5223    fn shutdown(&self) {
5224        self.inner.shutdown()
5225    }
5226    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5227        self.inner.shutdown_with_epitaph(status)
5228    }
5229
5230    fn is_closed(&self) -> bool {
5231        self.inner.channel().is_closed()
5232    }
5233    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5234        self.inner.channel().on_closed()
5235    }
5236
5237    #[cfg(target_os = "fuchsia")]
5238    fn signal_peer(
5239        &self,
5240        clear_mask: zx::Signals,
5241        set_mask: zx::Signals,
5242    ) -> Result<(), zx_status::Status> {
5243        use fidl::Peered;
5244        self.inner.channel().signal_peer(clear_mask, set_mask)
5245    }
5246}
5247
5248impl IrqResourceControlHandle {}
5249
5250#[must_use = "FIDL methods require a response to be sent"]
5251#[derive(Debug)]
5252pub struct IrqResourceGetResponder {
5253    control_handle: std::mem::ManuallyDrop<IrqResourceControlHandle>,
5254    tx_id: u32,
5255}
5256
5257/// Set the the channel to be shutdown (see [`IrqResourceControlHandle::shutdown`])
5258/// if the responder is dropped without sending a response, so that the client
5259/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5260impl std::ops::Drop for IrqResourceGetResponder {
5261    fn drop(&mut self) {
5262        self.control_handle.shutdown();
5263        // Safety: drops once, never accessed again
5264        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5265    }
5266}
5267
5268impl fidl::endpoints::Responder for IrqResourceGetResponder {
5269    type ControlHandle = IrqResourceControlHandle;
5270
5271    fn control_handle(&self) -> &IrqResourceControlHandle {
5272        &self.control_handle
5273    }
5274
5275    fn drop_without_shutdown(mut self) {
5276        // Safety: drops once, never accessed again due to mem::forget
5277        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5278        // Prevent Drop from running (which would shut down the channel)
5279        std::mem::forget(self);
5280    }
5281}
5282
5283impl IrqResourceGetResponder {
5284    /// Sends a response to the FIDL transaction.
5285    ///
5286    /// Sets the channel to shutdown if an error occurs.
5287    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5288        let _result = self.send_raw(resource);
5289        if _result.is_err() {
5290            self.control_handle.shutdown();
5291        }
5292        self.drop_without_shutdown();
5293        _result
5294    }
5295
5296    /// Similar to "send" but does not shutdown the channel if an error occurs.
5297    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5298        let _result = self.send_raw(resource);
5299        self.drop_without_shutdown();
5300        _result
5301    }
5302
5303    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5304        self.control_handle.inner.send::<IrqResourceGetResponse>(
5305            (resource,),
5306            self.tx_id,
5307            0x491be54504b041e9,
5308            fidl::encoding::DynamicFlags::empty(),
5309        )
5310    }
5311}
5312
5313#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5314pub struct MexecResourceMarker;
5315
5316impl fidl::endpoints::ProtocolMarker for MexecResourceMarker {
5317    type Proxy = MexecResourceProxy;
5318    type RequestStream = MexecResourceRequestStream;
5319    #[cfg(target_os = "fuchsia")]
5320    type SynchronousProxy = MexecResourceSynchronousProxy;
5321
5322    const DEBUG_NAME: &'static str = "fuchsia.kernel.MexecResource";
5323}
5324impl fidl::endpoints::DiscoverableProtocolMarker for MexecResourceMarker {}
5325
5326pub trait MexecResourceProxyInterface: Send + Sync {
5327    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5328    fn r#get(&self) -> Self::GetResponseFut;
5329}
5330#[derive(Debug)]
5331#[cfg(target_os = "fuchsia")]
5332pub struct MexecResourceSynchronousProxy {
5333    client: fidl::client::sync::Client,
5334}
5335
5336#[cfg(target_os = "fuchsia")]
5337impl fidl::endpoints::SynchronousProxy for MexecResourceSynchronousProxy {
5338    type Proxy = MexecResourceProxy;
5339    type Protocol = MexecResourceMarker;
5340
5341    fn from_channel(inner: fidl::Channel) -> Self {
5342        Self::new(inner)
5343    }
5344
5345    fn into_channel(self) -> fidl::Channel {
5346        self.client.into_channel()
5347    }
5348
5349    fn as_channel(&self) -> &fidl::Channel {
5350        self.client.as_channel()
5351    }
5352}
5353
5354#[cfg(target_os = "fuchsia")]
5355impl MexecResourceSynchronousProxy {
5356    pub fn new(channel: fidl::Channel) -> Self {
5357        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5358        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5359    }
5360
5361    pub fn into_channel(self) -> fidl::Channel {
5362        self.client.into_channel()
5363    }
5364
5365    /// Waits until an event arrives and returns it. It is safe for other
5366    /// threads to make concurrent requests while waiting for an event.
5367    pub fn wait_for_event(
5368        &self,
5369        deadline: zx::MonotonicInstant,
5370    ) -> Result<MexecResourceEvent, fidl::Error> {
5371        MexecResourceEvent::decode(self.client.wait_for_event(deadline)?)
5372    }
5373
5374    /// Get an MEXEC resource handle as `resource`.
5375    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5376        let _response =
5377            self.client.send_query::<fidl::encoding::EmptyPayload, MexecResourceGetResponse>(
5378                (),
5379                0xff93e6722900f54,
5380                fidl::encoding::DynamicFlags::empty(),
5381                ___deadline,
5382            )?;
5383        Ok(_response.resource)
5384    }
5385}
5386
5387#[cfg(target_os = "fuchsia")]
5388impl From<MexecResourceSynchronousProxy> for zx::Handle {
5389    fn from(value: MexecResourceSynchronousProxy) -> Self {
5390        value.into_channel().into()
5391    }
5392}
5393
5394#[cfg(target_os = "fuchsia")]
5395impl From<fidl::Channel> for MexecResourceSynchronousProxy {
5396    fn from(value: fidl::Channel) -> Self {
5397        Self::new(value)
5398    }
5399}
5400
5401#[cfg(target_os = "fuchsia")]
5402impl fidl::endpoints::FromClient for MexecResourceSynchronousProxy {
5403    type Protocol = MexecResourceMarker;
5404
5405    fn from_client(value: fidl::endpoints::ClientEnd<MexecResourceMarker>) -> Self {
5406        Self::new(value.into_channel())
5407    }
5408}
5409
5410#[derive(Debug, Clone)]
5411pub struct MexecResourceProxy {
5412    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5413}
5414
5415impl fidl::endpoints::Proxy for MexecResourceProxy {
5416    type Protocol = MexecResourceMarker;
5417
5418    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5419        Self::new(inner)
5420    }
5421
5422    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5423        self.client.into_channel().map_err(|client| Self { client })
5424    }
5425
5426    fn as_channel(&self) -> &::fidl::AsyncChannel {
5427        self.client.as_channel()
5428    }
5429}
5430
5431impl MexecResourceProxy {
5432    /// Create a new Proxy for fuchsia.kernel/MexecResource.
5433    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5434        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5435        Self { client: fidl::client::Client::new(channel, protocol_name) }
5436    }
5437
5438    /// Get a Stream of events from the remote end of the protocol.
5439    ///
5440    /// # Panics
5441    ///
5442    /// Panics if the event stream was already taken.
5443    pub fn take_event_stream(&self) -> MexecResourceEventStream {
5444        MexecResourceEventStream { event_receiver: self.client.take_event_receiver() }
5445    }
5446
5447    /// Get an MEXEC resource handle as `resource`.
5448    pub fn r#get(
5449        &self,
5450    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5451    {
5452        MexecResourceProxyInterface::r#get(self)
5453    }
5454}
5455
5456impl MexecResourceProxyInterface for MexecResourceProxy {
5457    type GetResponseFut = fidl::client::QueryResponseFut<
5458        fidl::Resource,
5459        fidl::encoding::DefaultFuchsiaResourceDialect,
5460    >;
5461    fn r#get(&self) -> Self::GetResponseFut {
5462        fn _decode(
5463            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5464        ) -> Result<fidl::Resource, fidl::Error> {
5465            let _response = fidl::client::decode_transaction_body::<
5466                MexecResourceGetResponse,
5467                fidl::encoding::DefaultFuchsiaResourceDialect,
5468                0xff93e6722900f54,
5469            >(_buf?)?;
5470            Ok(_response.resource)
5471        }
5472        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5473            (),
5474            0xff93e6722900f54,
5475            fidl::encoding::DynamicFlags::empty(),
5476            _decode,
5477        )
5478    }
5479}
5480
5481pub struct MexecResourceEventStream {
5482    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5483}
5484
5485impl std::marker::Unpin for MexecResourceEventStream {}
5486
5487impl futures::stream::FusedStream for MexecResourceEventStream {
5488    fn is_terminated(&self) -> bool {
5489        self.event_receiver.is_terminated()
5490    }
5491}
5492
5493impl futures::Stream for MexecResourceEventStream {
5494    type Item = Result<MexecResourceEvent, fidl::Error>;
5495
5496    fn poll_next(
5497        mut self: std::pin::Pin<&mut Self>,
5498        cx: &mut std::task::Context<'_>,
5499    ) -> std::task::Poll<Option<Self::Item>> {
5500        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5501            &mut self.event_receiver,
5502            cx
5503        )?) {
5504            Some(buf) => std::task::Poll::Ready(Some(MexecResourceEvent::decode(buf))),
5505            None => std::task::Poll::Ready(None),
5506        }
5507    }
5508}
5509
5510#[derive(Debug)]
5511pub enum MexecResourceEvent {}
5512
5513impl MexecResourceEvent {
5514    /// Decodes a message buffer as a [`MexecResourceEvent`].
5515    fn decode(
5516        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5517    ) -> Result<MexecResourceEvent, fidl::Error> {
5518        let (bytes, _handles) = buf.split_mut();
5519        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5520        debug_assert_eq!(tx_header.tx_id, 0);
5521        match tx_header.ordinal {
5522            _ => Err(fidl::Error::UnknownOrdinal {
5523                ordinal: tx_header.ordinal,
5524                protocol_name: <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5525            }),
5526        }
5527    }
5528}
5529
5530/// A Stream of incoming requests for fuchsia.kernel/MexecResource.
5531pub struct MexecResourceRequestStream {
5532    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5533    is_terminated: bool,
5534}
5535
5536impl std::marker::Unpin for MexecResourceRequestStream {}
5537
5538impl futures::stream::FusedStream for MexecResourceRequestStream {
5539    fn is_terminated(&self) -> bool {
5540        self.is_terminated
5541    }
5542}
5543
5544impl fidl::endpoints::RequestStream for MexecResourceRequestStream {
5545    type Protocol = MexecResourceMarker;
5546    type ControlHandle = MexecResourceControlHandle;
5547
5548    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5549        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5550    }
5551
5552    fn control_handle(&self) -> Self::ControlHandle {
5553        MexecResourceControlHandle { inner: self.inner.clone() }
5554    }
5555
5556    fn into_inner(
5557        self,
5558    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5559    {
5560        (self.inner, self.is_terminated)
5561    }
5562
5563    fn from_inner(
5564        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5565        is_terminated: bool,
5566    ) -> Self {
5567        Self { inner, is_terminated }
5568    }
5569}
5570
5571impl futures::Stream for MexecResourceRequestStream {
5572    type Item = Result<MexecResourceRequest, fidl::Error>;
5573
5574    fn poll_next(
5575        mut self: std::pin::Pin<&mut Self>,
5576        cx: &mut std::task::Context<'_>,
5577    ) -> std::task::Poll<Option<Self::Item>> {
5578        let this = &mut *self;
5579        if this.inner.check_shutdown(cx) {
5580            this.is_terminated = true;
5581            return std::task::Poll::Ready(None);
5582        }
5583        if this.is_terminated {
5584            panic!("polled MexecResourceRequestStream after completion");
5585        }
5586        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5587            |bytes, handles| {
5588                match this.inner.channel().read_etc(cx, bytes, handles) {
5589                    std::task::Poll::Ready(Ok(())) => {}
5590                    std::task::Poll::Pending => return std::task::Poll::Pending,
5591                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5592                        this.is_terminated = true;
5593                        return std::task::Poll::Ready(None);
5594                    }
5595                    std::task::Poll::Ready(Err(e)) => {
5596                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5597                            e.into(),
5598                        ))));
5599                    }
5600                }
5601
5602                // A message has been received from the channel
5603                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5604
5605                std::task::Poll::Ready(Some(match header.ordinal {
5606                    0xff93e6722900f54 => {
5607                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5608                        let mut req = fidl::new_empty!(
5609                            fidl::encoding::EmptyPayload,
5610                            fidl::encoding::DefaultFuchsiaResourceDialect
5611                        );
5612                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5613                        let control_handle =
5614                            MexecResourceControlHandle { inner: this.inner.clone() };
5615                        Ok(MexecResourceRequest::Get {
5616                            responder: MexecResourceGetResponder {
5617                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5618                                tx_id: header.tx_id,
5619                            },
5620                        })
5621                    }
5622                    _ => Err(fidl::Error::UnknownOrdinal {
5623                        ordinal: header.ordinal,
5624                        protocol_name:
5625                            <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5626                    }),
5627                }))
5628            },
5629        )
5630    }
5631}
5632
5633/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
5634/// `ZX_RSRC_SYSTEM_MEXEC_BASE`.
5635#[derive(Debug)]
5636pub enum MexecResourceRequest {
5637    /// Get an MEXEC resource handle as `resource`.
5638    Get { responder: MexecResourceGetResponder },
5639}
5640
5641impl MexecResourceRequest {
5642    #[allow(irrefutable_let_patterns)]
5643    pub fn into_get(self) -> Option<(MexecResourceGetResponder)> {
5644        if let MexecResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5645    }
5646
5647    /// Name of the method defined in FIDL
5648    pub fn method_name(&self) -> &'static str {
5649        match *self {
5650            MexecResourceRequest::Get { .. } => "get",
5651        }
5652    }
5653}
5654
5655#[derive(Debug, Clone)]
5656pub struct MexecResourceControlHandle {
5657    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5658}
5659
5660impl fidl::endpoints::ControlHandle for MexecResourceControlHandle {
5661    fn shutdown(&self) {
5662        self.inner.shutdown()
5663    }
5664    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5665        self.inner.shutdown_with_epitaph(status)
5666    }
5667
5668    fn is_closed(&self) -> bool {
5669        self.inner.channel().is_closed()
5670    }
5671    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5672        self.inner.channel().on_closed()
5673    }
5674
5675    #[cfg(target_os = "fuchsia")]
5676    fn signal_peer(
5677        &self,
5678        clear_mask: zx::Signals,
5679        set_mask: zx::Signals,
5680    ) -> Result<(), zx_status::Status> {
5681        use fidl::Peered;
5682        self.inner.channel().signal_peer(clear_mask, set_mask)
5683    }
5684}
5685
5686impl MexecResourceControlHandle {}
5687
5688#[must_use = "FIDL methods require a response to be sent"]
5689#[derive(Debug)]
5690pub struct MexecResourceGetResponder {
5691    control_handle: std::mem::ManuallyDrop<MexecResourceControlHandle>,
5692    tx_id: u32,
5693}
5694
5695/// Set the the channel to be shutdown (see [`MexecResourceControlHandle::shutdown`])
5696/// if the responder is dropped without sending a response, so that the client
5697/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5698impl std::ops::Drop for MexecResourceGetResponder {
5699    fn drop(&mut self) {
5700        self.control_handle.shutdown();
5701        // Safety: drops once, never accessed again
5702        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5703    }
5704}
5705
5706impl fidl::endpoints::Responder for MexecResourceGetResponder {
5707    type ControlHandle = MexecResourceControlHandle;
5708
5709    fn control_handle(&self) -> &MexecResourceControlHandle {
5710        &self.control_handle
5711    }
5712
5713    fn drop_without_shutdown(mut self) {
5714        // Safety: drops once, never accessed again due to mem::forget
5715        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5716        // Prevent Drop from running (which would shut down the channel)
5717        std::mem::forget(self);
5718    }
5719}
5720
5721impl MexecResourceGetResponder {
5722    /// Sends a response to the FIDL transaction.
5723    ///
5724    /// Sets the channel to shutdown if an error occurs.
5725    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5726        let _result = self.send_raw(resource);
5727        if _result.is_err() {
5728            self.control_handle.shutdown();
5729        }
5730        self.drop_without_shutdown();
5731        _result
5732    }
5733
5734    /// Similar to "send" but does not shutdown the channel if an error occurs.
5735    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5736        let _result = self.send_raw(resource);
5737        self.drop_without_shutdown();
5738        _result
5739    }
5740
5741    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5742        self.control_handle.inner.send::<MexecResourceGetResponse>(
5743            (resource,),
5744            self.tx_id,
5745            0xff93e6722900f54,
5746            fidl::encoding::DynamicFlags::empty(),
5747        )
5748    }
5749}
5750
5751#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5752pub struct MmioResourceMarker;
5753
5754impl fidl::endpoints::ProtocolMarker for MmioResourceMarker {
5755    type Proxy = MmioResourceProxy;
5756    type RequestStream = MmioResourceRequestStream;
5757    #[cfg(target_os = "fuchsia")]
5758    type SynchronousProxy = MmioResourceSynchronousProxy;
5759
5760    const DEBUG_NAME: &'static str = "fuchsia.kernel.MmioResource";
5761}
5762impl fidl::endpoints::DiscoverableProtocolMarker for MmioResourceMarker {}
5763
5764pub trait MmioResourceProxyInterface: Send + Sync {
5765    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5766    fn r#get(&self) -> Self::GetResponseFut;
5767}
5768#[derive(Debug)]
5769#[cfg(target_os = "fuchsia")]
5770pub struct MmioResourceSynchronousProxy {
5771    client: fidl::client::sync::Client,
5772}
5773
5774#[cfg(target_os = "fuchsia")]
5775impl fidl::endpoints::SynchronousProxy for MmioResourceSynchronousProxy {
5776    type Proxy = MmioResourceProxy;
5777    type Protocol = MmioResourceMarker;
5778
5779    fn from_channel(inner: fidl::Channel) -> Self {
5780        Self::new(inner)
5781    }
5782
5783    fn into_channel(self) -> fidl::Channel {
5784        self.client.into_channel()
5785    }
5786
5787    fn as_channel(&self) -> &fidl::Channel {
5788        self.client.as_channel()
5789    }
5790}
5791
5792#[cfg(target_os = "fuchsia")]
5793impl MmioResourceSynchronousProxy {
5794    pub fn new(channel: fidl::Channel) -> Self {
5795        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5796        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5797    }
5798
5799    pub fn into_channel(self) -> fidl::Channel {
5800        self.client.into_channel()
5801    }
5802
5803    /// Waits until an event arrives and returns it. It is safe for other
5804    /// threads to make concurrent requests while waiting for an event.
5805    pub fn wait_for_event(
5806        &self,
5807        deadline: zx::MonotonicInstant,
5808    ) -> Result<MmioResourceEvent, fidl::Error> {
5809        MmioResourceEvent::decode(self.client.wait_for_event(deadline)?)
5810    }
5811
5812    /// Get an MMIO resource handle.
5813    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5814        let _response =
5815            self.client.send_query::<fidl::encoding::EmptyPayload, MmioResourceGetResponse>(
5816                (),
5817                0x66747b9c5a6dfe7b,
5818                fidl::encoding::DynamicFlags::empty(),
5819                ___deadline,
5820            )?;
5821        Ok(_response.resource)
5822    }
5823}
5824
5825#[cfg(target_os = "fuchsia")]
5826impl From<MmioResourceSynchronousProxy> for zx::Handle {
5827    fn from(value: MmioResourceSynchronousProxy) -> Self {
5828        value.into_channel().into()
5829    }
5830}
5831
5832#[cfg(target_os = "fuchsia")]
5833impl From<fidl::Channel> for MmioResourceSynchronousProxy {
5834    fn from(value: fidl::Channel) -> Self {
5835        Self::new(value)
5836    }
5837}
5838
5839#[cfg(target_os = "fuchsia")]
5840impl fidl::endpoints::FromClient for MmioResourceSynchronousProxy {
5841    type Protocol = MmioResourceMarker;
5842
5843    fn from_client(value: fidl::endpoints::ClientEnd<MmioResourceMarker>) -> Self {
5844        Self::new(value.into_channel())
5845    }
5846}
5847
5848#[derive(Debug, Clone)]
5849pub struct MmioResourceProxy {
5850    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5851}
5852
5853impl fidl::endpoints::Proxy for MmioResourceProxy {
5854    type Protocol = MmioResourceMarker;
5855
5856    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5857        Self::new(inner)
5858    }
5859
5860    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5861        self.client.into_channel().map_err(|client| Self { client })
5862    }
5863
5864    fn as_channel(&self) -> &::fidl::AsyncChannel {
5865        self.client.as_channel()
5866    }
5867}
5868
5869impl MmioResourceProxy {
5870    /// Create a new Proxy for fuchsia.kernel/MmioResource.
5871    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5872        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5873        Self { client: fidl::client::Client::new(channel, protocol_name) }
5874    }
5875
5876    /// Get a Stream of events from the remote end of the protocol.
5877    ///
5878    /// # Panics
5879    ///
5880    /// Panics if the event stream was already taken.
5881    pub fn take_event_stream(&self) -> MmioResourceEventStream {
5882        MmioResourceEventStream { event_receiver: self.client.take_event_receiver() }
5883    }
5884
5885    /// Get an MMIO resource handle.
5886    pub fn r#get(
5887        &self,
5888    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5889    {
5890        MmioResourceProxyInterface::r#get(self)
5891    }
5892}
5893
5894impl MmioResourceProxyInterface for MmioResourceProxy {
5895    type GetResponseFut = fidl::client::QueryResponseFut<
5896        fidl::Resource,
5897        fidl::encoding::DefaultFuchsiaResourceDialect,
5898    >;
5899    fn r#get(&self) -> Self::GetResponseFut {
5900        fn _decode(
5901            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5902        ) -> Result<fidl::Resource, fidl::Error> {
5903            let _response = fidl::client::decode_transaction_body::<
5904                MmioResourceGetResponse,
5905                fidl::encoding::DefaultFuchsiaResourceDialect,
5906                0x66747b9c5a6dfe7b,
5907            >(_buf?)?;
5908            Ok(_response.resource)
5909        }
5910        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5911            (),
5912            0x66747b9c5a6dfe7b,
5913            fidl::encoding::DynamicFlags::empty(),
5914            _decode,
5915        )
5916    }
5917}
5918
5919pub struct MmioResourceEventStream {
5920    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5921}
5922
5923impl std::marker::Unpin for MmioResourceEventStream {}
5924
5925impl futures::stream::FusedStream for MmioResourceEventStream {
5926    fn is_terminated(&self) -> bool {
5927        self.event_receiver.is_terminated()
5928    }
5929}
5930
5931impl futures::Stream for MmioResourceEventStream {
5932    type Item = Result<MmioResourceEvent, fidl::Error>;
5933
5934    fn poll_next(
5935        mut self: std::pin::Pin<&mut Self>,
5936        cx: &mut std::task::Context<'_>,
5937    ) -> std::task::Poll<Option<Self::Item>> {
5938        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5939            &mut self.event_receiver,
5940            cx
5941        )?) {
5942            Some(buf) => std::task::Poll::Ready(Some(MmioResourceEvent::decode(buf))),
5943            None => std::task::Poll::Ready(None),
5944        }
5945    }
5946}
5947
5948#[derive(Debug)]
5949pub enum MmioResourceEvent {}
5950
5951impl MmioResourceEvent {
5952    /// Decodes a message buffer as a [`MmioResourceEvent`].
5953    fn decode(
5954        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5955    ) -> Result<MmioResourceEvent, fidl::Error> {
5956        let (bytes, _handles) = buf.split_mut();
5957        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5958        debug_assert_eq!(tx_header.tx_id, 0);
5959        match tx_header.ordinal {
5960            _ => Err(fidl::Error::UnknownOrdinal {
5961                ordinal: tx_header.ordinal,
5962                protocol_name: <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5963            }),
5964        }
5965    }
5966}
5967
5968/// A Stream of incoming requests for fuchsia.kernel/MmioResource.
5969pub struct MmioResourceRequestStream {
5970    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5971    is_terminated: bool,
5972}
5973
5974impl std::marker::Unpin for MmioResourceRequestStream {}
5975
5976impl futures::stream::FusedStream for MmioResourceRequestStream {
5977    fn is_terminated(&self) -> bool {
5978        self.is_terminated
5979    }
5980}
5981
5982impl fidl::endpoints::RequestStream for MmioResourceRequestStream {
5983    type Protocol = MmioResourceMarker;
5984    type ControlHandle = MmioResourceControlHandle;
5985
5986    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5987        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5988    }
5989
5990    fn control_handle(&self) -> Self::ControlHandle {
5991        MmioResourceControlHandle { inner: self.inner.clone() }
5992    }
5993
5994    fn into_inner(
5995        self,
5996    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5997    {
5998        (self.inner, self.is_terminated)
5999    }
6000
6001    fn from_inner(
6002        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6003        is_terminated: bool,
6004    ) -> Self {
6005        Self { inner, is_terminated }
6006    }
6007}
6008
6009impl futures::Stream for MmioResourceRequestStream {
6010    type Item = Result<MmioResourceRequest, fidl::Error>;
6011
6012    fn poll_next(
6013        mut self: std::pin::Pin<&mut Self>,
6014        cx: &mut std::task::Context<'_>,
6015    ) -> std::task::Poll<Option<Self::Item>> {
6016        let this = &mut *self;
6017        if this.inner.check_shutdown(cx) {
6018            this.is_terminated = true;
6019            return std::task::Poll::Ready(None);
6020        }
6021        if this.is_terminated {
6022            panic!("polled MmioResourceRequestStream after completion");
6023        }
6024        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6025            |bytes, handles| {
6026                match this.inner.channel().read_etc(cx, bytes, handles) {
6027                    std::task::Poll::Ready(Ok(())) => {}
6028                    std::task::Poll::Pending => return std::task::Poll::Pending,
6029                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6030                        this.is_terminated = true;
6031                        return std::task::Poll::Ready(None);
6032                    }
6033                    std::task::Poll::Ready(Err(e)) => {
6034                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6035                            e.into(),
6036                        ))));
6037                    }
6038                }
6039
6040                // A message has been received from the channel
6041                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6042
6043                std::task::Poll::Ready(Some(match header.ordinal {
6044                    0x66747b9c5a6dfe7b => {
6045                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6046                        let mut req = fidl::new_empty!(
6047                            fidl::encoding::EmptyPayload,
6048                            fidl::encoding::DefaultFuchsiaResourceDialect
6049                        );
6050                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6051                        let control_handle =
6052                            MmioResourceControlHandle { inner: this.inner.clone() };
6053                        Ok(MmioResourceRequest::Get {
6054                            responder: MmioResourceGetResponder {
6055                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6056                                tx_id: header.tx_id,
6057                            },
6058                        })
6059                    }
6060                    _ => Err(fidl::Error::UnknownOrdinal {
6061                        ordinal: header.ordinal,
6062                        protocol_name:
6063                            <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6064                    }),
6065                }))
6066            },
6067        )
6068    }
6069}
6070
6071/// Protocol for providing an MMIO resource with access to all valid ranges.
6072#[derive(Debug)]
6073pub enum MmioResourceRequest {
6074    /// Get an MMIO resource handle.
6075    Get { responder: MmioResourceGetResponder },
6076}
6077
6078impl MmioResourceRequest {
6079    #[allow(irrefutable_let_patterns)]
6080    pub fn into_get(self) -> Option<(MmioResourceGetResponder)> {
6081        if let MmioResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6082    }
6083
6084    /// Name of the method defined in FIDL
6085    pub fn method_name(&self) -> &'static str {
6086        match *self {
6087            MmioResourceRequest::Get { .. } => "get",
6088        }
6089    }
6090}
6091
6092#[derive(Debug, Clone)]
6093pub struct MmioResourceControlHandle {
6094    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6095}
6096
6097impl fidl::endpoints::ControlHandle for MmioResourceControlHandle {
6098    fn shutdown(&self) {
6099        self.inner.shutdown()
6100    }
6101    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6102        self.inner.shutdown_with_epitaph(status)
6103    }
6104
6105    fn is_closed(&self) -> bool {
6106        self.inner.channel().is_closed()
6107    }
6108    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6109        self.inner.channel().on_closed()
6110    }
6111
6112    #[cfg(target_os = "fuchsia")]
6113    fn signal_peer(
6114        &self,
6115        clear_mask: zx::Signals,
6116        set_mask: zx::Signals,
6117    ) -> Result<(), zx_status::Status> {
6118        use fidl::Peered;
6119        self.inner.channel().signal_peer(clear_mask, set_mask)
6120    }
6121}
6122
6123impl MmioResourceControlHandle {}
6124
6125#[must_use = "FIDL methods require a response to be sent"]
6126#[derive(Debug)]
6127pub struct MmioResourceGetResponder {
6128    control_handle: std::mem::ManuallyDrop<MmioResourceControlHandle>,
6129    tx_id: u32,
6130}
6131
6132/// Set the the channel to be shutdown (see [`MmioResourceControlHandle::shutdown`])
6133/// if the responder is dropped without sending a response, so that the client
6134/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6135impl std::ops::Drop for MmioResourceGetResponder {
6136    fn drop(&mut self) {
6137        self.control_handle.shutdown();
6138        // Safety: drops once, never accessed again
6139        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6140    }
6141}
6142
6143impl fidl::endpoints::Responder for MmioResourceGetResponder {
6144    type ControlHandle = MmioResourceControlHandle;
6145
6146    fn control_handle(&self) -> &MmioResourceControlHandle {
6147        &self.control_handle
6148    }
6149
6150    fn drop_without_shutdown(mut self) {
6151        // Safety: drops once, never accessed again due to mem::forget
6152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6153        // Prevent Drop from running (which would shut down the channel)
6154        std::mem::forget(self);
6155    }
6156}
6157
6158impl MmioResourceGetResponder {
6159    /// Sends a response to the FIDL transaction.
6160    ///
6161    /// Sets the channel to shutdown if an error occurs.
6162    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6163        let _result = self.send_raw(resource);
6164        if _result.is_err() {
6165            self.control_handle.shutdown();
6166        }
6167        self.drop_without_shutdown();
6168        _result
6169    }
6170
6171    /// Similar to "send" but does not shutdown the channel if an error occurs.
6172    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6173        let _result = self.send_raw(resource);
6174        self.drop_without_shutdown();
6175        _result
6176    }
6177
6178    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6179        self.control_handle.inner.send::<MmioResourceGetResponse>(
6180            (resource,),
6181            self.tx_id,
6182            0x66747b9c5a6dfe7b,
6183            fidl::encoding::DynamicFlags::empty(),
6184        )
6185    }
6186}
6187
6188#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6189pub struct MsiResourceMarker;
6190
6191impl fidl::endpoints::ProtocolMarker for MsiResourceMarker {
6192    type Proxy = MsiResourceProxy;
6193    type RequestStream = MsiResourceRequestStream;
6194    #[cfg(target_os = "fuchsia")]
6195    type SynchronousProxy = MsiResourceSynchronousProxy;
6196
6197    const DEBUG_NAME: &'static str = "fuchsia.kernel.MsiResource";
6198}
6199impl fidl::endpoints::DiscoverableProtocolMarker for MsiResourceMarker {}
6200
6201pub trait MsiResourceProxyInterface: Send + Sync {
6202    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6203    fn r#get(&self) -> Self::GetResponseFut;
6204}
6205#[derive(Debug)]
6206#[cfg(target_os = "fuchsia")]
6207pub struct MsiResourceSynchronousProxy {
6208    client: fidl::client::sync::Client,
6209}
6210
6211#[cfg(target_os = "fuchsia")]
6212impl fidl::endpoints::SynchronousProxy for MsiResourceSynchronousProxy {
6213    type Proxy = MsiResourceProxy;
6214    type Protocol = MsiResourceMarker;
6215
6216    fn from_channel(inner: fidl::Channel) -> Self {
6217        Self::new(inner)
6218    }
6219
6220    fn into_channel(self) -> fidl::Channel {
6221        self.client.into_channel()
6222    }
6223
6224    fn as_channel(&self) -> &fidl::Channel {
6225        self.client.as_channel()
6226    }
6227}
6228
6229#[cfg(target_os = "fuchsia")]
6230impl MsiResourceSynchronousProxy {
6231    pub fn new(channel: fidl::Channel) -> Self {
6232        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6233        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6234    }
6235
6236    pub fn into_channel(self) -> fidl::Channel {
6237        self.client.into_channel()
6238    }
6239
6240    /// Waits until an event arrives and returns it. It is safe for other
6241    /// threads to make concurrent requests while waiting for an event.
6242    pub fn wait_for_event(
6243        &self,
6244        deadline: zx::MonotonicInstant,
6245    ) -> Result<MsiResourceEvent, fidl::Error> {
6246        MsiResourceEvent::decode(self.client.wait_for_event(deadline)?)
6247    }
6248
6249    /// Get an msi resource handle.
6250    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6251        let _response =
6252            self.client.send_query::<fidl::encoding::EmptyPayload, MsiResourceGetResponse>(
6253                (),
6254                0x360a97e47e8c4f1f,
6255                fidl::encoding::DynamicFlags::empty(),
6256                ___deadline,
6257            )?;
6258        Ok(_response.resource)
6259    }
6260}
6261
6262#[cfg(target_os = "fuchsia")]
6263impl From<MsiResourceSynchronousProxy> for zx::Handle {
6264    fn from(value: MsiResourceSynchronousProxy) -> Self {
6265        value.into_channel().into()
6266    }
6267}
6268
6269#[cfg(target_os = "fuchsia")]
6270impl From<fidl::Channel> for MsiResourceSynchronousProxy {
6271    fn from(value: fidl::Channel) -> Self {
6272        Self::new(value)
6273    }
6274}
6275
6276#[cfg(target_os = "fuchsia")]
6277impl fidl::endpoints::FromClient for MsiResourceSynchronousProxy {
6278    type Protocol = MsiResourceMarker;
6279
6280    fn from_client(value: fidl::endpoints::ClientEnd<MsiResourceMarker>) -> Self {
6281        Self::new(value.into_channel())
6282    }
6283}
6284
6285#[derive(Debug, Clone)]
6286pub struct MsiResourceProxy {
6287    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6288}
6289
6290impl fidl::endpoints::Proxy for MsiResourceProxy {
6291    type Protocol = MsiResourceMarker;
6292
6293    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6294        Self::new(inner)
6295    }
6296
6297    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6298        self.client.into_channel().map_err(|client| Self { client })
6299    }
6300
6301    fn as_channel(&self) -> &::fidl::AsyncChannel {
6302        self.client.as_channel()
6303    }
6304}
6305
6306impl MsiResourceProxy {
6307    /// Create a new Proxy for fuchsia.kernel/MsiResource.
6308    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6309        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6310        Self { client: fidl::client::Client::new(channel, protocol_name) }
6311    }
6312
6313    /// Get a Stream of events from the remote end of the protocol.
6314    ///
6315    /// # Panics
6316    ///
6317    /// Panics if the event stream was already taken.
6318    pub fn take_event_stream(&self) -> MsiResourceEventStream {
6319        MsiResourceEventStream { event_receiver: self.client.take_event_receiver() }
6320    }
6321
6322    /// Get an msi resource handle.
6323    pub fn r#get(
6324        &self,
6325    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6326    {
6327        MsiResourceProxyInterface::r#get(self)
6328    }
6329}
6330
6331impl MsiResourceProxyInterface for MsiResourceProxy {
6332    type GetResponseFut = fidl::client::QueryResponseFut<
6333        fidl::Resource,
6334        fidl::encoding::DefaultFuchsiaResourceDialect,
6335    >;
6336    fn r#get(&self) -> Self::GetResponseFut {
6337        fn _decode(
6338            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6339        ) -> Result<fidl::Resource, fidl::Error> {
6340            let _response = fidl::client::decode_transaction_body::<
6341                MsiResourceGetResponse,
6342                fidl::encoding::DefaultFuchsiaResourceDialect,
6343                0x360a97e47e8c4f1f,
6344            >(_buf?)?;
6345            Ok(_response.resource)
6346        }
6347        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6348            (),
6349            0x360a97e47e8c4f1f,
6350            fidl::encoding::DynamicFlags::empty(),
6351            _decode,
6352        )
6353    }
6354}
6355
6356pub struct MsiResourceEventStream {
6357    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6358}
6359
6360impl std::marker::Unpin for MsiResourceEventStream {}
6361
6362impl futures::stream::FusedStream for MsiResourceEventStream {
6363    fn is_terminated(&self) -> bool {
6364        self.event_receiver.is_terminated()
6365    }
6366}
6367
6368impl futures::Stream for MsiResourceEventStream {
6369    type Item = Result<MsiResourceEvent, fidl::Error>;
6370
6371    fn poll_next(
6372        mut self: std::pin::Pin<&mut Self>,
6373        cx: &mut std::task::Context<'_>,
6374    ) -> std::task::Poll<Option<Self::Item>> {
6375        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6376            &mut self.event_receiver,
6377            cx
6378        )?) {
6379            Some(buf) => std::task::Poll::Ready(Some(MsiResourceEvent::decode(buf))),
6380            None => std::task::Poll::Ready(None),
6381        }
6382    }
6383}
6384
6385#[derive(Debug)]
6386pub enum MsiResourceEvent {}
6387
6388impl MsiResourceEvent {
6389    /// Decodes a message buffer as a [`MsiResourceEvent`].
6390    fn decode(
6391        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6392    ) -> Result<MsiResourceEvent, fidl::Error> {
6393        let (bytes, _handles) = buf.split_mut();
6394        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6395        debug_assert_eq!(tx_header.tx_id, 0);
6396        match tx_header.ordinal {
6397            _ => Err(fidl::Error::UnknownOrdinal {
6398                ordinal: tx_header.ordinal,
6399                protocol_name: <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6400            }),
6401        }
6402    }
6403}
6404
6405/// A Stream of incoming requests for fuchsia.kernel/MsiResource.
6406pub struct MsiResourceRequestStream {
6407    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6408    is_terminated: bool,
6409}
6410
6411impl std::marker::Unpin for MsiResourceRequestStream {}
6412
6413impl futures::stream::FusedStream for MsiResourceRequestStream {
6414    fn is_terminated(&self) -> bool {
6415        self.is_terminated
6416    }
6417}
6418
6419impl fidl::endpoints::RequestStream for MsiResourceRequestStream {
6420    type Protocol = MsiResourceMarker;
6421    type ControlHandle = MsiResourceControlHandle;
6422
6423    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6424        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6425    }
6426
6427    fn control_handle(&self) -> Self::ControlHandle {
6428        MsiResourceControlHandle { inner: self.inner.clone() }
6429    }
6430
6431    fn into_inner(
6432        self,
6433    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6434    {
6435        (self.inner, self.is_terminated)
6436    }
6437
6438    fn from_inner(
6439        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6440        is_terminated: bool,
6441    ) -> Self {
6442        Self { inner, is_terminated }
6443    }
6444}
6445
6446impl futures::Stream for MsiResourceRequestStream {
6447    type Item = Result<MsiResourceRequest, fidl::Error>;
6448
6449    fn poll_next(
6450        mut self: std::pin::Pin<&mut Self>,
6451        cx: &mut std::task::Context<'_>,
6452    ) -> std::task::Poll<Option<Self::Item>> {
6453        let this = &mut *self;
6454        if this.inner.check_shutdown(cx) {
6455            this.is_terminated = true;
6456            return std::task::Poll::Ready(None);
6457        }
6458        if this.is_terminated {
6459            panic!("polled MsiResourceRequestStream after completion");
6460        }
6461        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6462            |bytes, handles| {
6463                match this.inner.channel().read_etc(cx, bytes, handles) {
6464                    std::task::Poll::Ready(Ok(())) => {}
6465                    std::task::Poll::Pending => return std::task::Poll::Pending,
6466                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6467                        this.is_terminated = true;
6468                        return std::task::Poll::Ready(None);
6469                    }
6470                    std::task::Poll::Ready(Err(e)) => {
6471                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6472                            e.into(),
6473                        ))));
6474                    }
6475                }
6476
6477                // A message has been received from the channel
6478                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6479
6480                std::task::Poll::Ready(Some(match header.ordinal {
6481                    0x360a97e47e8c4f1f => {
6482                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6483                        let mut req = fidl::new_empty!(
6484                            fidl::encoding::EmptyPayload,
6485                            fidl::encoding::DefaultFuchsiaResourceDialect
6486                        );
6487                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6488                        let control_handle = MsiResourceControlHandle { inner: this.inner.clone() };
6489                        Ok(MsiResourceRequest::Get {
6490                            responder: MsiResourceGetResponder {
6491                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6492                                tx_id: header.tx_id,
6493                            },
6494                        })
6495                    }
6496                    _ => Err(fidl::Error::UnknownOrdinal {
6497                        ordinal: header.ordinal,
6498                        protocol_name:
6499                            <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6500                    }),
6501                }))
6502            },
6503        )
6504    }
6505}
6506
6507/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6508/// `ZX_RSRC_SYSTEM_MSI_BASE`.
6509#[derive(Debug)]
6510pub enum MsiResourceRequest {
6511    /// Get an msi resource handle.
6512    Get { responder: MsiResourceGetResponder },
6513}
6514
6515impl MsiResourceRequest {
6516    #[allow(irrefutable_let_patterns)]
6517    pub fn into_get(self) -> Option<(MsiResourceGetResponder)> {
6518        if let MsiResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6519    }
6520
6521    /// Name of the method defined in FIDL
6522    pub fn method_name(&self) -> &'static str {
6523        match *self {
6524            MsiResourceRequest::Get { .. } => "get",
6525        }
6526    }
6527}
6528
6529#[derive(Debug, Clone)]
6530pub struct MsiResourceControlHandle {
6531    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6532}
6533
6534impl fidl::endpoints::ControlHandle for MsiResourceControlHandle {
6535    fn shutdown(&self) {
6536        self.inner.shutdown()
6537    }
6538    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6539        self.inner.shutdown_with_epitaph(status)
6540    }
6541
6542    fn is_closed(&self) -> bool {
6543        self.inner.channel().is_closed()
6544    }
6545    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6546        self.inner.channel().on_closed()
6547    }
6548
6549    #[cfg(target_os = "fuchsia")]
6550    fn signal_peer(
6551        &self,
6552        clear_mask: zx::Signals,
6553        set_mask: zx::Signals,
6554    ) -> Result<(), zx_status::Status> {
6555        use fidl::Peered;
6556        self.inner.channel().signal_peer(clear_mask, set_mask)
6557    }
6558}
6559
6560impl MsiResourceControlHandle {}
6561
6562#[must_use = "FIDL methods require a response to be sent"]
6563#[derive(Debug)]
6564pub struct MsiResourceGetResponder {
6565    control_handle: std::mem::ManuallyDrop<MsiResourceControlHandle>,
6566    tx_id: u32,
6567}
6568
6569/// Set the the channel to be shutdown (see [`MsiResourceControlHandle::shutdown`])
6570/// if the responder is dropped without sending a response, so that the client
6571/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6572impl std::ops::Drop for MsiResourceGetResponder {
6573    fn drop(&mut self) {
6574        self.control_handle.shutdown();
6575        // Safety: drops once, never accessed again
6576        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6577    }
6578}
6579
6580impl fidl::endpoints::Responder for MsiResourceGetResponder {
6581    type ControlHandle = MsiResourceControlHandle;
6582
6583    fn control_handle(&self) -> &MsiResourceControlHandle {
6584        &self.control_handle
6585    }
6586
6587    fn drop_without_shutdown(mut self) {
6588        // Safety: drops once, never accessed again due to mem::forget
6589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6590        // Prevent Drop from running (which would shut down the channel)
6591        std::mem::forget(self);
6592    }
6593}
6594
6595impl MsiResourceGetResponder {
6596    /// Sends a response to the FIDL transaction.
6597    ///
6598    /// Sets the channel to shutdown if an error occurs.
6599    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6600        let _result = self.send_raw(resource);
6601        if _result.is_err() {
6602            self.control_handle.shutdown();
6603        }
6604        self.drop_without_shutdown();
6605        _result
6606    }
6607
6608    /// Similar to "send" but does not shutdown the channel if an error occurs.
6609    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6610        let _result = self.send_raw(resource);
6611        self.drop_without_shutdown();
6612        _result
6613    }
6614
6615    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6616        self.control_handle.inner.send::<MsiResourceGetResponse>(
6617            (resource,),
6618            self.tx_id,
6619            0x360a97e47e8c4f1f,
6620            fidl::encoding::DynamicFlags::empty(),
6621        )
6622    }
6623}
6624
6625#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6626pub struct PowerResourceMarker;
6627
6628impl fidl::endpoints::ProtocolMarker for PowerResourceMarker {
6629    type Proxy = PowerResourceProxy;
6630    type RequestStream = PowerResourceRequestStream;
6631    #[cfg(target_os = "fuchsia")]
6632    type SynchronousProxy = PowerResourceSynchronousProxy;
6633
6634    const DEBUG_NAME: &'static str = "fuchsia.kernel.PowerResource";
6635}
6636impl fidl::endpoints::DiscoverableProtocolMarker for PowerResourceMarker {}
6637
6638pub trait PowerResourceProxyInterface: Send + Sync {
6639    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6640    fn r#get(&self) -> Self::GetResponseFut;
6641}
6642#[derive(Debug)]
6643#[cfg(target_os = "fuchsia")]
6644pub struct PowerResourceSynchronousProxy {
6645    client: fidl::client::sync::Client,
6646}
6647
6648#[cfg(target_os = "fuchsia")]
6649impl fidl::endpoints::SynchronousProxy for PowerResourceSynchronousProxy {
6650    type Proxy = PowerResourceProxy;
6651    type Protocol = PowerResourceMarker;
6652
6653    fn from_channel(inner: fidl::Channel) -> Self {
6654        Self::new(inner)
6655    }
6656
6657    fn into_channel(self) -> fidl::Channel {
6658        self.client.into_channel()
6659    }
6660
6661    fn as_channel(&self) -> &fidl::Channel {
6662        self.client.as_channel()
6663    }
6664}
6665
6666#[cfg(target_os = "fuchsia")]
6667impl PowerResourceSynchronousProxy {
6668    pub fn new(channel: fidl::Channel) -> Self {
6669        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6670        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6671    }
6672
6673    pub fn into_channel(self) -> fidl::Channel {
6674        self.client.into_channel()
6675    }
6676
6677    /// Waits until an event arrives and returns it. It is safe for other
6678    /// threads to make concurrent requests while waiting for an event.
6679    pub fn wait_for_event(
6680        &self,
6681        deadline: zx::MonotonicInstant,
6682    ) -> Result<PowerResourceEvent, fidl::Error> {
6683        PowerResourceEvent::decode(self.client.wait_for_event(deadline)?)
6684    }
6685
6686    /// Get a power resource handle.
6687    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6688        let _response =
6689            self.client.send_query::<fidl::encoding::EmptyPayload, PowerResourceGetResponse>(
6690                (),
6691                0x2b8df8ca24d1e866,
6692                fidl::encoding::DynamicFlags::empty(),
6693                ___deadline,
6694            )?;
6695        Ok(_response.resource)
6696    }
6697}
6698
6699#[cfg(target_os = "fuchsia")]
6700impl From<PowerResourceSynchronousProxy> for zx::Handle {
6701    fn from(value: PowerResourceSynchronousProxy) -> Self {
6702        value.into_channel().into()
6703    }
6704}
6705
6706#[cfg(target_os = "fuchsia")]
6707impl From<fidl::Channel> for PowerResourceSynchronousProxy {
6708    fn from(value: fidl::Channel) -> Self {
6709        Self::new(value)
6710    }
6711}
6712
6713#[cfg(target_os = "fuchsia")]
6714impl fidl::endpoints::FromClient for PowerResourceSynchronousProxy {
6715    type Protocol = PowerResourceMarker;
6716
6717    fn from_client(value: fidl::endpoints::ClientEnd<PowerResourceMarker>) -> Self {
6718        Self::new(value.into_channel())
6719    }
6720}
6721
6722#[derive(Debug, Clone)]
6723pub struct PowerResourceProxy {
6724    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6725}
6726
6727impl fidl::endpoints::Proxy for PowerResourceProxy {
6728    type Protocol = PowerResourceMarker;
6729
6730    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6731        Self::new(inner)
6732    }
6733
6734    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6735        self.client.into_channel().map_err(|client| Self { client })
6736    }
6737
6738    fn as_channel(&self) -> &::fidl::AsyncChannel {
6739        self.client.as_channel()
6740    }
6741}
6742
6743impl PowerResourceProxy {
6744    /// Create a new Proxy for fuchsia.kernel/PowerResource.
6745    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6746        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6747        Self { client: fidl::client::Client::new(channel, protocol_name) }
6748    }
6749
6750    /// Get a Stream of events from the remote end of the protocol.
6751    ///
6752    /// # Panics
6753    ///
6754    /// Panics if the event stream was already taken.
6755    pub fn take_event_stream(&self) -> PowerResourceEventStream {
6756        PowerResourceEventStream { event_receiver: self.client.take_event_receiver() }
6757    }
6758
6759    /// Get a power resource handle.
6760    pub fn r#get(
6761        &self,
6762    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6763    {
6764        PowerResourceProxyInterface::r#get(self)
6765    }
6766}
6767
6768impl PowerResourceProxyInterface for PowerResourceProxy {
6769    type GetResponseFut = fidl::client::QueryResponseFut<
6770        fidl::Resource,
6771        fidl::encoding::DefaultFuchsiaResourceDialect,
6772    >;
6773    fn r#get(&self) -> Self::GetResponseFut {
6774        fn _decode(
6775            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6776        ) -> Result<fidl::Resource, fidl::Error> {
6777            let _response = fidl::client::decode_transaction_body::<
6778                PowerResourceGetResponse,
6779                fidl::encoding::DefaultFuchsiaResourceDialect,
6780                0x2b8df8ca24d1e866,
6781            >(_buf?)?;
6782            Ok(_response.resource)
6783        }
6784        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6785            (),
6786            0x2b8df8ca24d1e866,
6787            fidl::encoding::DynamicFlags::empty(),
6788            _decode,
6789        )
6790    }
6791}
6792
6793pub struct PowerResourceEventStream {
6794    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6795}
6796
6797impl std::marker::Unpin for PowerResourceEventStream {}
6798
6799impl futures::stream::FusedStream for PowerResourceEventStream {
6800    fn is_terminated(&self) -> bool {
6801        self.event_receiver.is_terminated()
6802    }
6803}
6804
6805impl futures::Stream for PowerResourceEventStream {
6806    type Item = Result<PowerResourceEvent, fidl::Error>;
6807
6808    fn poll_next(
6809        mut self: std::pin::Pin<&mut Self>,
6810        cx: &mut std::task::Context<'_>,
6811    ) -> std::task::Poll<Option<Self::Item>> {
6812        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6813            &mut self.event_receiver,
6814            cx
6815        )?) {
6816            Some(buf) => std::task::Poll::Ready(Some(PowerResourceEvent::decode(buf))),
6817            None => std::task::Poll::Ready(None),
6818        }
6819    }
6820}
6821
6822#[derive(Debug)]
6823pub enum PowerResourceEvent {}
6824
6825impl PowerResourceEvent {
6826    /// Decodes a message buffer as a [`PowerResourceEvent`].
6827    fn decode(
6828        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6829    ) -> Result<PowerResourceEvent, fidl::Error> {
6830        let (bytes, _handles) = buf.split_mut();
6831        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6832        debug_assert_eq!(tx_header.tx_id, 0);
6833        match tx_header.ordinal {
6834            _ => Err(fidl::Error::UnknownOrdinal {
6835                ordinal: tx_header.ordinal,
6836                protocol_name: <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6837            }),
6838        }
6839    }
6840}
6841
6842/// A Stream of incoming requests for fuchsia.kernel/PowerResource.
6843pub struct PowerResourceRequestStream {
6844    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6845    is_terminated: bool,
6846}
6847
6848impl std::marker::Unpin for PowerResourceRequestStream {}
6849
6850impl futures::stream::FusedStream for PowerResourceRequestStream {
6851    fn is_terminated(&self) -> bool {
6852        self.is_terminated
6853    }
6854}
6855
6856impl fidl::endpoints::RequestStream for PowerResourceRequestStream {
6857    type Protocol = PowerResourceMarker;
6858    type ControlHandle = PowerResourceControlHandle;
6859
6860    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6861        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6862    }
6863
6864    fn control_handle(&self) -> Self::ControlHandle {
6865        PowerResourceControlHandle { inner: self.inner.clone() }
6866    }
6867
6868    fn into_inner(
6869        self,
6870    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6871    {
6872        (self.inner, self.is_terminated)
6873    }
6874
6875    fn from_inner(
6876        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6877        is_terminated: bool,
6878    ) -> Self {
6879        Self { inner, is_terminated }
6880    }
6881}
6882
6883impl futures::Stream for PowerResourceRequestStream {
6884    type Item = Result<PowerResourceRequest, fidl::Error>;
6885
6886    fn poll_next(
6887        mut self: std::pin::Pin<&mut Self>,
6888        cx: &mut std::task::Context<'_>,
6889    ) -> std::task::Poll<Option<Self::Item>> {
6890        let this = &mut *self;
6891        if this.inner.check_shutdown(cx) {
6892            this.is_terminated = true;
6893            return std::task::Poll::Ready(None);
6894        }
6895        if this.is_terminated {
6896            panic!("polled PowerResourceRequestStream after completion");
6897        }
6898        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6899            |bytes, handles| {
6900                match this.inner.channel().read_etc(cx, bytes, handles) {
6901                    std::task::Poll::Ready(Ok(())) => {}
6902                    std::task::Poll::Pending => return std::task::Poll::Pending,
6903                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6904                        this.is_terminated = true;
6905                        return std::task::Poll::Ready(None);
6906                    }
6907                    std::task::Poll::Ready(Err(e)) => {
6908                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6909                            e.into(),
6910                        ))));
6911                    }
6912                }
6913
6914                // A message has been received from the channel
6915                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6916
6917                std::task::Poll::Ready(Some(match header.ordinal {
6918                    0x2b8df8ca24d1e866 => {
6919                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6920                        let mut req = fidl::new_empty!(
6921                            fidl::encoding::EmptyPayload,
6922                            fidl::encoding::DefaultFuchsiaResourceDialect
6923                        );
6924                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6925                        let control_handle =
6926                            PowerResourceControlHandle { inner: this.inner.clone() };
6927                        Ok(PowerResourceRequest::Get {
6928                            responder: PowerResourceGetResponder {
6929                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6930                                tx_id: header.tx_id,
6931                            },
6932                        })
6933                    }
6934                    _ => Err(fidl::Error::UnknownOrdinal {
6935                        ordinal: header.ordinal,
6936                        protocol_name:
6937                            <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6938                    }),
6939                }))
6940            },
6941        )
6942    }
6943}
6944
6945/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6946/// `ZX_RSRC_SYSTEM_POWER_BASE`.
6947#[derive(Debug)]
6948pub enum PowerResourceRequest {
6949    /// Get a power resource handle.
6950    Get { responder: PowerResourceGetResponder },
6951}
6952
6953impl PowerResourceRequest {
6954    #[allow(irrefutable_let_patterns)]
6955    pub fn into_get(self) -> Option<(PowerResourceGetResponder)> {
6956        if let PowerResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6957    }
6958
6959    /// Name of the method defined in FIDL
6960    pub fn method_name(&self) -> &'static str {
6961        match *self {
6962            PowerResourceRequest::Get { .. } => "get",
6963        }
6964    }
6965}
6966
6967#[derive(Debug, Clone)]
6968pub struct PowerResourceControlHandle {
6969    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6970}
6971
6972impl fidl::endpoints::ControlHandle for PowerResourceControlHandle {
6973    fn shutdown(&self) {
6974        self.inner.shutdown()
6975    }
6976    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6977        self.inner.shutdown_with_epitaph(status)
6978    }
6979
6980    fn is_closed(&self) -> bool {
6981        self.inner.channel().is_closed()
6982    }
6983    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6984        self.inner.channel().on_closed()
6985    }
6986
6987    #[cfg(target_os = "fuchsia")]
6988    fn signal_peer(
6989        &self,
6990        clear_mask: zx::Signals,
6991        set_mask: zx::Signals,
6992    ) -> Result<(), zx_status::Status> {
6993        use fidl::Peered;
6994        self.inner.channel().signal_peer(clear_mask, set_mask)
6995    }
6996}
6997
6998impl PowerResourceControlHandle {}
6999
7000#[must_use = "FIDL methods require a response to be sent"]
7001#[derive(Debug)]
7002pub struct PowerResourceGetResponder {
7003    control_handle: std::mem::ManuallyDrop<PowerResourceControlHandle>,
7004    tx_id: u32,
7005}
7006
7007/// Set the the channel to be shutdown (see [`PowerResourceControlHandle::shutdown`])
7008/// if the responder is dropped without sending a response, so that the client
7009/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7010impl std::ops::Drop for PowerResourceGetResponder {
7011    fn drop(&mut self) {
7012        self.control_handle.shutdown();
7013        // Safety: drops once, never accessed again
7014        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7015    }
7016}
7017
7018impl fidl::endpoints::Responder for PowerResourceGetResponder {
7019    type ControlHandle = PowerResourceControlHandle;
7020
7021    fn control_handle(&self) -> &PowerResourceControlHandle {
7022        &self.control_handle
7023    }
7024
7025    fn drop_without_shutdown(mut self) {
7026        // Safety: drops once, never accessed again due to mem::forget
7027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7028        // Prevent Drop from running (which would shut down the channel)
7029        std::mem::forget(self);
7030    }
7031}
7032
7033impl PowerResourceGetResponder {
7034    /// Sends a response to the FIDL transaction.
7035    ///
7036    /// Sets the channel to shutdown if an error occurs.
7037    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7038        let _result = self.send_raw(resource);
7039        if _result.is_err() {
7040            self.control_handle.shutdown();
7041        }
7042        self.drop_without_shutdown();
7043        _result
7044    }
7045
7046    /// Similar to "send" but does not shutdown the channel if an error occurs.
7047    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7048        let _result = self.send_raw(resource);
7049        self.drop_without_shutdown();
7050        _result
7051    }
7052
7053    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7054        self.control_handle.inner.send::<PowerResourceGetResponse>(
7055            (resource,),
7056            self.tx_id,
7057            0x2b8df8ca24d1e866,
7058            fidl::encoding::DynamicFlags::empty(),
7059        )
7060    }
7061}
7062
7063#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7064pub struct ProfileResourceMarker;
7065
7066impl fidl::endpoints::ProtocolMarker for ProfileResourceMarker {
7067    type Proxy = ProfileResourceProxy;
7068    type RequestStream = ProfileResourceRequestStream;
7069    #[cfg(target_os = "fuchsia")]
7070    type SynchronousProxy = ProfileResourceSynchronousProxy;
7071
7072    const DEBUG_NAME: &'static str = "fuchsia.kernel.ProfileResource";
7073}
7074impl fidl::endpoints::DiscoverableProtocolMarker for ProfileResourceMarker {}
7075
7076pub trait ProfileResourceProxyInterface: Send + Sync {
7077    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
7078    fn r#get(&self) -> Self::GetResponseFut;
7079}
7080#[derive(Debug)]
7081#[cfg(target_os = "fuchsia")]
7082pub struct ProfileResourceSynchronousProxy {
7083    client: fidl::client::sync::Client,
7084}
7085
7086#[cfg(target_os = "fuchsia")]
7087impl fidl::endpoints::SynchronousProxy for ProfileResourceSynchronousProxy {
7088    type Proxy = ProfileResourceProxy;
7089    type Protocol = ProfileResourceMarker;
7090
7091    fn from_channel(inner: fidl::Channel) -> Self {
7092        Self::new(inner)
7093    }
7094
7095    fn into_channel(self) -> fidl::Channel {
7096        self.client.into_channel()
7097    }
7098
7099    fn as_channel(&self) -> &fidl::Channel {
7100        self.client.as_channel()
7101    }
7102}
7103
7104#[cfg(target_os = "fuchsia")]
7105impl ProfileResourceSynchronousProxy {
7106    pub fn new(channel: fidl::Channel) -> Self {
7107        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7108        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7109    }
7110
7111    pub fn into_channel(self) -> fidl::Channel {
7112        self.client.into_channel()
7113    }
7114
7115    /// Waits until an event arrives and returns it. It is safe for other
7116    /// threads to make concurrent requests while waiting for an event.
7117    pub fn wait_for_event(
7118        &self,
7119        deadline: zx::MonotonicInstant,
7120    ) -> Result<ProfileResourceEvent, fidl::Error> {
7121        ProfileResourceEvent::decode(self.client.wait_for_event(deadline)?)
7122    }
7123
7124    /// Get a profile resource handle.
7125    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
7126        let _response =
7127            self.client.send_query::<fidl::encoding::EmptyPayload, ProfileResourceGetResponse>(
7128                (),
7129                0x3003a0c14de1fa86,
7130                fidl::encoding::DynamicFlags::empty(),
7131                ___deadline,
7132            )?;
7133        Ok(_response.resource)
7134    }
7135}
7136
7137#[cfg(target_os = "fuchsia")]
7138impl From<ProfileResourceSynchronousProxy> for zx::Handle {
7139    fn from(value: ProfileResourceSynchronousProxy) -> Self {
7140        value.into_channel().into()
7141    }
7142}
7143
7144#[cfg(target_os = "fuchsia")]
7145impl From<fidl::Channel> for ProfileResourceSynchronousProxy {
7146    fn from(value: fidl::Channel) -> Self {
7147        Self::new(value)
7148    }
7149}
7150
7151#[cfg(target_os = "fuchsia")]
7152impl fidl::endpoints::FromClient for ProfileResourceSynchronousProxy {
7153    type Protocol = ProfileResourceMarker;
7154
7155    fn from_client(value: fidl::endpoints::ClientEnd<ProfileResourceMarker>) -> Self {
7156        Self::new(value.into_channel())
7157    }
7158}
7159
7160#[derive(Debug, Clone)]
7161pub struct ProfileResourceProxy {
7162    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7163}
7164
7165impl fidl::endpoints::Proxy for ProfileResourceProxy {
7166    type Protocol = ProfileResourceMarker;
7167
7168    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7169        Self::new(inner)
7170    }
7171
7172    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7173        self.client.into_channel().map_err(|client| Self { client })
7174    }
7175
7176    fn as_channel(&self) -> &::fidl::AsyncChannel {
7177        self.client.as_channel()
7178    }
7179}
7180
7181impl ProfileResourceProxy {
7182    /// Create a new Proxy for fuchsia.kernel/ProfileResource.
7183    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7184        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7185        Self { client: fidl::client::Client::new(channel, protocol_name) }
7186    }
7187
7188    /// Get a Stream of events from the remote end of the protocol.
7189    ///
7190    /// # Panics
7191    ///
7192    /// Panics if the event stream was already taken.
7193    pub fn take_event_stream(&self) -> ProfileResourceEventStream {
7194        ProfileResourceEventStream { event_receiver: self.client.take_event_receiver() }
7195    }
7196
7197    /// Get a profile resource handle.
7198    pub fn r#get(
7199        &self,
7200    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
7201    {
7202        ProfileResourceProxyInterface::r#get(self)
7203    }
7204}
7205
7206impl ProfileResourceProxyInterface for ProfileResourceProxy {
7207    type GetResponseFut = fidl::client::QueryResponseFut<
7208        fidl::Resource,
7209        fidl::encoding::DefaultFuchsiaResourceDialect,
7210    >;
7211    fn r#get(&self) -> Self::GetResponseFut {
7212        fn _decode(
7213            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7214        ) -> Result<fidl::Resource, fidl::Error> {
7215            let _response = fidl::client::decode_transaction_body::<
7216                ProfileResourceGetResponse,
7217                fidl::encoding::DefaultFuchsiaResourceDialect,
7218                0x3003a0c14de1fa86,
7219            >(_buf?)?;
7220            Ok(_response.resource)
7221        }
7222        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
7223            (),
7224            0x3003a0c14de1fa86,
7225            fidl::encoding::DynamicFlags::empty(),
7226            _decode,
7227        )
7228    }
7229}
7230
7231pub struct ProfileResourceEventStream {
7232    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7233}
7234
7235impl std::marker::Unpin for ProfileResourceEventStream {}
7236
7237impl futures::stream::FusedStream for ProfileResourceEventStream {
7238    fn is_terminated(&self) -> bool {
7239        self.event_receiver.is_terminated()
7240    }
7241}
7242
7243impl futures::Stream for ProfileResourceEventStream {
7244    type Item = Result<ProfileResourceEvent, fidl::Error>;
7245
7246    fn poll_next(
7247        mut self: std::pin::Pin<&mut Self>,
7248        cx: &mut std::task::Context<'_>,
7249    ) -> std::task::Poll<Option<Self::Item>> {
7250        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7251            &mut self.event_receiver,
7252            cx
7253        )?) {
7254            Some(buf) => std::task::Poll::Ready(Some(ProfileResourceEvent::decode(buf))),
7255            None => std::task::Poll::Ready(None),
7256        }
7257    }
7258}
7259
7260#[derive(Debug)]
7261pub enum ProfileResourceEvent {}
7262
7263impl ProfileResourceEvent {
7264    /// Decodes a message buffer as a [`ProfileResourceEvent`].
7265    fn decode(
7266        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7267    ) -> Result<ProfileResourceEvent, fidl::Error> {
7268        let (bytes, _handles) = buf.split_mut();
7269        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7270        debug_assert_eq!(tx_header.tx_id, 0);
7271        match tx_header.ordinal {
7272            _ => Err(fidl::Error::UnknownOrdinal {
7273                ordinal: tx_header.ordinal,
7274                protocol_name:
7275                    <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7276            }),
7277        }
7278    }
7279}
7280
7281/// A Stream of incoming requests for fuchsia.kernel/ProfileResource.
7282pub struct ProfileResourceRequestStream {
7283    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7284    is_terminated: bool,
7285}
7286
7287impl std::marker::Unpin for ProfileResourceRequestStream {}
7288
7289impl futures::stream::FusedStream for ProfileResourceRequestStream {
7290    fn is_terminated(&self) -> bool {
7291        self.is_terminated
7292    }
7293}
7294
7295impl fidl::endpoints::RequestStream for ProfileResourceRequestStream {
7296    type Protocol = ProfileResourceMarker;
7297    type ControlHandle = ProfileResourceControlHandle;
7298
7299    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7300        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7301    }
7302
7303    fn control_handle(&self) -> Self::ControlHandle {
7304        ProfileResourceControlHandle { inner: self.inner.clone() }
7305    }
7306
7307    fn into_inner(
7308        self,
7309    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7310    {
7311        (self.inner, self.is_terminated)
7312    }
7313
7314    fn from_inner(
7315        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7316        is_terminated: bool,
7317    ) -> Self {
7318        Self { inner, is_terminated }
7319    }
7320}
7321
7322impl futures::Stream for ProfileResourceRequestStream {
7323    type Item = Result<ProfileResourceRequest, fidl::Error>;
7324
7325    fn poll_next(
7326        mut self: std::pin::Pin<&mut Self>,
7327        cx: &mut std::task::Context<'_>,
7328    ) -> std::task::Poll<Option<Self::Item>> {
7329        let this = &mut *self;
7330        if this.inner.check_shutdown(cx) {
7331            this.is_terminated = true;
7332            return std::task::Poll::Ready(None);
7333        }
7334        if this.is_terminated {
7335            panic!("polled ProfileResourceRequestStream after completion");
7336        }
7337        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7338            |bytes, handles| {
7339                match this.inner.channel().read_etc(cx, bytes, handles) {
7340                    std::task::Poll::Ready(Ok(())) => {}
7341                    std::task::Poll::Pending => return std::task::Poll::Pending,
7342                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7343                        this.is_terminated = true;
7344                        return std::task::Poll::Ready(None);
7345                    }
7346                    std::task::Poll::Ready(Err(e)) => {
7347                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7348                            e.into(),
7349                        ))));
7350                    }
7351                }
7352
7353                // A message has been received from the channel
7354                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7355
7356                std::task::Poll::Ready(Some(match header.ordinal {
7357                    0x3003a0c14de1fa86 => {
7358                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7359                        let mut req = fidl::new_empty!(
7360                            fidl::encoding::EmptyPayload,
7361                            fidl::encoding::DefaultFuchsiaResourceDialect
7362                        );
7363                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7364                        let control_handle =
7365                            ProfileResourceControlHandle { inner: this.inner.clone() };
7366                        Ok(ProfileResourceRequest::Get {
7367                            responder: ProfileResourceGetResponder {
7368                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7369                                tx_id: header.tx_id,
7370                            },
7371                        })
7372                    }
7373                    _ => Err(fidl::Error::UnknownOrdinal {
7374                        ordinal: header.ordinal,
7375                        protocol_name:
7376                            <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7377                    }),
7378                }))
7379            },
7380        )
7381    }
7382}
7383
7384/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7385/// `ZX_RSRC_SYSTEM_PROFILE_BASE`.
7386#[derive(Debug)]
7387pub enum ProfileResourceRequest {
7388    /// Get a profile resource handle.
7389    Get { responder: ProfileResourceGetResponder },
7390}
7391
7392impl ProfileResourceRequest {
7393    #[allow(irrefutable_let_patterns)]
7394    pub fn into_get(self) -> Option<(ProfileResourceGetResponder)> {
7395        if let ProfileResourceRequest::Get { responder } = self { Some((responder)) } else { None }
7396    }
7397
7398    /// Name of the method defined in FIDL
7399    pub fn method_name(&self) -> &'static str {
7400        match *self {
7401            ProfileResourceRequest::Get { .. } => "get",
7402        }
7403    }
7404}
7405
7406#[derive(Debug, Clone)]
7407pub struct ProfileResourceControlHandle {
7408    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7409}
7410
7411impl fidl::endpoints::ControlHandle for ProfileResourceControlHandle {
7412    fn shutdown(&self) {
7413        self.inner.shutdown()
7414    }
7415    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7416        self.inner.shutdown_with_epitaph(status)
7417    }
7418
7419    fn is_closed(&self) -> bool {
7420        self.inner.channel().is_closed()
7421    }
7422    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7423        self.inner.channel().on_closed()
7424    }
7425
7426    #[cfg(target_os = "fuchsia")]
7427    fn signal_peer(
7428        &self,
7429        clear_mask: zx::Signals,
7430        set_mask: zx::Signals,
7431    ) -> Result<(), zx_status::Status> {
7432        use fidl::Peered;
7433        self.inner.channel().signal_peer(clear_mask, set_mask)
7434    }
7435}
7436
7437impl ProfileResourceControlHandle {}
7438
7439#[must_use = "FIDL methods require a response to be sent"]
7440#[derive(Debug)]
7441pub struct ProfileResourceGetResponder {
7442    control_handle: std::mem::ManuallyDrop<ProfileResourceControlHandle>,
7443    tx_id: u32,
7444}
7445
7446/// Set the the channel to be shutdown (see [`ProfileResourceControlHandle::shutdown`])
7447/// if the responder is dropped without sending a response, so that the client
7448/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7449impl std::ops::Drop for ProfileResourceGetResponder {
7450    fn drop(&mut self) {
7451        self.control_handle.shutdown();
7452        // Safety: drops once, never accessed again
7453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7454    }
7455}
7456
7457impl fidl::endpoints::Responder for ProfileResourceGetResponder {
7458    type ControlHandle = ProfileResourceControlHandle;
7459
7460    fn control_handle(&self) -> &ProfileResourceControlHandle {
7461        &self.control_handle
7462    }
7463
7464    fn drop_without_shutdown(mut self) {
7465        // Safety: drops once, never accessed again due to mem::forget
7466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7467        // Prevent Drop from running (which would shut down the channel)
7468        std::mem::forget(self);
7469    }
7470}
7471
7472impl ProfileResourceGetResponder {
7473    /// Sends a response to the FIDL transaction.
7474    ///
7475    /// Sets the channel to shutdown if an error occurs.
7476    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7477        let _result = self.send_raw(resource);
7478        if _result.is_err() {
7479            self.control_handle.shutdown();
7480        }
7481        self.drop_without_shutdown();
7482        _result
7483    }
7484
7485    /// Similar to "send" but does not shutdown the channel if an error occurs.
7486    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7487        let _result = self.send_raw(resource);
7488        self.drop_without_shutdown();
7489        _result
7490    }
7491
7492    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7493        self.control_handle.inner.send::<ProfileResourceGetResponse>(
7494            (resource,),
7495            self.tx_id,
7496            0x3003a0c14de1fa86,
7497            fidl::encoding::DynamicFlags::empty(),
7498        )
7499    }
7500}
7501
7502#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7503pub struct RootJobMarker;
7504
7505impl fidl::endpoints::ProtocolMarker for RootJobMarker {
7506    type Proxy = RootJobProxy;
7507    type RequestStream = RootJobRequestStream;
7508    #[cfg(target_os = "fuchsia")]
7509    type SynchronousProxy = RootJobSynchronousProxy;
7510
7511    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJob";
7512}
7513impl fidl::endpoints::DiscoverableProtocolMarker for RootJobMarker {}
7514
7515pub trait RootJobProxyInterface: Send + Sync {
7516    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7517    fn r#get(&self) -> Self::GetResponseFut;
7518}
7519#[derive(Debug)]
7520#[cfg(target_os = "fuchsia")]
7521pub struct RootJobSynchronousProxy {
7522    client: fidl::client::sync::Client,
7523}
7524
7525#[cfg(target_os = "fuchsia")]
7526impl fidl::endpoints::SynchronousProxy for RootJobSynchronousProxy {
7527    type Proxy = RootJobProxy;
7528    type Protocol = RootJobMarker;
7529
7530    fn from_channel(inner: fidl::Channel) -> Self {
7531        Self::new(inner)
7532    }
7533
7534    fn into_channel(self) -> fidl::Channel {
7535        self.client.into_channel()
7536    }
7537
7538    fn as_channel(&self) -> &fidl::Channel {
7539        self.client.as_channel()
7540    }
7541}
7542
7543#[cfg(target_os = "fuchsia")]
7544impl RootJobSynchronousProxy {
7545    pub fn new(channel: fidl::Channel) -> Self {
7546        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7547        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7548    }
7549
7550    pub fn into_channel(self) -> fidl::Channel {
7551        self.client.into_channel()
7552    }
7553
7554    /// Waits until an event arrives and returns it. It is safe for other
7555    /// threads to make concurrent requests while waiting for an event.
7556    pub fn wait_for_event(
7557        &self,
7558        deadline: zx::MonotonicInstant,
7559    ) -> Result<RootJobEvent, fidl::Error> {
7560        RootJobEvent::decode(self.client.wait_for_event(deadline)?)
7561    }
7562
7563    /// Get the root `job`.
7564    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7565        let _response =
7566            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
7567                (),
7568                0x73acb63f93d53eac,
7569                fidl::encoding::DynamicFlags::empty(),
7570                ___deadline,
7571            )?;
7572        Ok(_response.job)
7573    }
7574}
7575
7576#[cfg(target_os = "fuchsia")]
7577impl From<RootJobSynchronousProxy> for zx::Handle {
7578    fn from(value: RootJobSynchronousProxy) -> Self {
7579        value.into_channel().into()
7580    }
7581}
7582
7583#[cfg(target_os = "fuchsia")]
7584impl From<fidl::Channel> for RootJobSynchronousProxy {
7585    fn from(value: fidl::Channel) -> Self {
7586        Self::new(value)
7587    }
7588}
7589
7590#[cfg(target_os = "fuchsia")]
7591impl fidl::endpoints::FromClient for RootJobSynchronousProxy {
7592    type Protocol = RootJobMarker;
7593
7594    fn from_client(value: fidl::endpoints::ClientEnd<RootJobMarker>) -> Self {
7595        Self::new(value.into_channel())
7596    }
7597}
7598
7599#[derive(Debug, Clone)]
7600pub struct RootJobProxy {
7601    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7602}
7603
7604impl fidl::endpoints::Proxy for RootJobProxy {
7605    type Protocol = RootJobMarker;
7606
7607    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7608        Self::new(inner)
7609    }
7610
7611    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7612        self.client.into_channel().map_err(|client| Self { client })
7613    }
7614
7615    fn as_channel(&self) -> &::fidl::AsyncChannel {
7616        self.client.as_channel()
7617    }
7618}
7619
7620impl RootJobProxy {
7621    /// Create a new Proxy for fuchsia.kernel/RootJob.
7622    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7623        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7624        Self { client: fidl::client::Client::new(channel, protocol_name) }
7625    }
7626
7627    /// Get a Stream of events from the remote end of the protocol.
7628    ///
7629    /// # Panics
7630    ///
7631    /// Panics if the event stream was already taken.
7632    pub fn take_event_stream(&self) -> RootJobEventStream {
7633        RootJobEventStream { event_receiver: self.client.take_event_receiver() }
7634    }
7635
7636    /// Get the root `job`.
7637    pub fn r#get(
7638        &self,
7639    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7640    {
7641        RootJobProxyInterface::r#get(self)
7642    }
7643}
7644
7645impl RootJobProxyInterface for RootJobProxy {
7646    type GetResponseFut =
7647        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7648    fn r#get(&self) -> Self::GetResponseFut {
7649        fn _decode(
7650            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7651        ) -> Result<fidl::Job, fidl::Error> {
7652            let _response = fidl::client::decode_transaction_body::<
7653                RootJobGetResponse,
7654                fidl::encoding::DefaultFuchsiaResourceDialect,
7655                0x73acb63f93d53eac,
7656            >(_buf?)?;
7657            Ok(_response.job)
7658        }
7659        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7660            (),
7661            0x73acb63f93d53eac,
7662            fidl::encoding::DynamicFlags::empty(),
7663            _decode,
7664        )
7665    }
7666}
7667
7668pub struct RootJobEventStream {
7669    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7670}
7671
7672impl std::marker::Unpin for RootJobEventStream {}
7673
7674impl futures::stream::FusedStream for RootJobEventStream {
7675    fn is_terminated(&self) -> bool {
7676        self.event_receiver.is_terminated()
7677    }
7678}
7679
7680impl futures::Stream for RootJobEventStream {
7681    type Item = Result<RootJobEvent, fidl::Error>;
7682
7683    fn poll_next(
7684        mut self: std::pin::Pin<&mut Self>,
7685        cx: &mut std::task::Context<'_>,
7686    ) -> std::task::Poll<Option<Self::Item>> {
7687        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7688            &mut self.event_receiver,
7689            cx
7690        )?) {
7691            Some(buf) => std::task::Poll::Ready(Some(RootJobEvent::decode(buf))),
7692            None => std::task::Poll::Ready(None),
7693        }
7694    }
7695}
7696
7697#[derive(Debug)]
7698pub enum RootJobEvent {}
7699
7700impl RootJobEvent {
7701    /// Decodes a message buffer as a [`RootJobEvent`].
7702    fn decode(
7703        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7704    ) -> Result<RootJobEvent, fidl::Error> {
7705        let (bytes, _handles) = buf.split_mut();
7706        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7707        debug_assert_eq!(tx_header.tx_id, 0);
7708        match tx_header.ordinal {
7709            _ => Err(fidl::Error::UnknownOrdinal {
7710                ordinal: tx_header.ordinal,
7711                protocol_name: <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7712            }),
7713        }
7714    }
7715}
7716
7717/// A Stream of incoming requests for fuchsia.kernel/RootJob.
7718pub struct RootJobRequestStream {
7719    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7720    is_terminated: bool,
7721}
7722
7723impl std::marker::Unpin for RootJobRequestStream {}
7724
7725impl futures::stream::FusedStream for RootJobRequestStream {
7726    fn is_terminated(&self) -> bool {
7727        self.is_terminated
7728    }
7729}
7730
7731impl fidl::endpoints::RequestStream for RootJobRequestStream {
7732    type Protocol = RootJobMarker;
7733    type ControlHandle = RootJobControlHandle;
7734
7735    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7736        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7737    }
7738
7739    fn control_handle(&self) -> Self::ControlHandle {
7740        RootJobControlHandle { inner: self.inner.clone() }
7741    }
7742
7743    fn into_inner(
7744        self,
7745    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7746    {
7747        (self.inner, self.is_terminated)
7748    }
7749
7750    fn from_inner(
7751        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7752        is_terminated: bool,
7753    ) -> Self {
7754        Self { inner, is_terminated }
7755    }
7756}
7757
7758impl futures::Stream for RootJobRequestStream {
7759    type Item = Result<RootJobRequest, fidl::Error>;
7760
7761    fn poll_next(
7762        mut self: std::pin::Pin<&mut Self>,
7763        cx: &mut std::task::Context<'_>,
7764    ) -> std::task::Poll<Option<Self::Item>> {
7765        let this = &mut *self;
7766        if this.inner.check_shutdown(cx) {
7767            this.is_terminated = true;
7768            return std::task::Poll::Ready(None);
7769        }
7770        if this.is_terminated {
7771            panic!("polled RootJobRequestStream after completion");
7772        }
7773        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7774            |bytes, handles| {
7775                match this.inner.channel().read_etc(cx, bytes, handles) {
7776                    std::task::Poll::Ready(Ok(())) => {}
7777                    std::task::Poll::Pending => return std::task::Poll::Pending,
7778                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7779                        this.is_terminated = true;
7780                        return std::task::Poll::Ready(None);
7781                    }
7782                    std::task::Poll::Ready(Err(e)) => {
7783                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7784                            e.into(),
7785                        ))));
7786                    }
7787                }
7788
7789                // A message has been received from the channel
7790                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7791
7792                std::task::Poll::Ready(Some(match header.ordinal {
7793                    0x73acb63f93d53eac => {
7794                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7795                        let mut req = fidl::new_empty!(
7796                            fidl::encoding::EmptyPayload,
7797                            fidl::encoding::DefaultFuchsiaResourceDialect
7798                        );
7799                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7800                        let control_handle = RootJobControlHandle { inner: this.inner.clone() };
7801                        Ok(RootJobRequest::Get {
7802                            responder: RootJobGetResponder {
7803                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7804                                tx_id: header.tx_id,
7805                            },
7806                        })
7807                    }
7808                    _ => Err(fidl::Error::UnknownOrdinal {
7809                        ordinal: header.ordinal,
7810                        protocol_name:
7811                            <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7812                    }),
7813                }))
7814            },
7815        )
7816    }
7817}
7818
7819/// Protocol for providing the root job.
7820///
7821/// TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.
7822#[derive(Debug)]
7823pub enum RootJobRequest {
7824    /// Get the root `job`.
7825    Get { responder: RootJobGetResponder },
7826}
7827
7828impl RootJobRequest {
7829    #[allow(irrefutable_let_patterns)]
7830    pub fn into_get(self) -> Option<(RootJobGetResponder)> {
7831        if let RootJobRequest::Get { responder } = self { Some((responder)) } else { None }
7832    }
7833
7834    /// Name of the method defined in FIDL
7835    pub fn method_name(&self) -> &'static str {
7836        match *self {
7837            RootJobRequest::Get { .. } => "get",
7838        }
7839    }
7840}
7841
7842#[derive(Debug, Clone)]
7843pub struct RootJobControlHandle {
7844    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7845}
7846
7847impl fidl::endpoints::ControlHandle for RootJobControlHandle {
7848    fn shutdown(&self) {
7849        self.inner.shutdown()
7850    }
7851    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7852        self.inner.shutdown_with_epitaph(status)
7853    }
7854
7855    fn is_closed(&self) -> bool {
7856        self.inner.channel().is_closed()
7857    }
7858    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7859        self.inner.channel().on_closed()
7860    }
7861
7862    #[cfg(target_os = "fuchsia")]
7863    fn signal_peer(
7864        &self,
7865        clear_mask: zx::Signals,
7866        set_mask: zx::Signals,
7867    ) -> Result<(), zx_status::Status> {
7868        use fidl::Peered;
7869        self.inner.channel().signal_peer(clear_mask, set_mask)
7870    }
7871}
7872
7873impl RootJobControlHandle {}
7874
7875#[must_use = "FIDL methods require a response to be sent"]
7876#[derive(Debug)]
7877pub struct RootJobGetResponder {
7878    control_handle: std::mem::ManuallyDrop<RootJobControlHandle>,
7879    tx_id: u32,
7880}
7881
7882/// Set the the channel to be shutdown (see [`RootJobControlHandle::shutdown`])
7883/// if the responder is dropped without sending a response, so that the client
7884/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7885impl std::ops::Drop for RootJobGetResponder {
7886    fn drop(&mut self) {
7887        self.control_handle.shutdown();
7888        // Safety: drops once, never accessed again
7889        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7890    }
7891}
7892
7893impl fidl::endpoints::Responder for RootJobGetResponder {
7894    type ControlHandle = RootJobControlHandle;
7895
7896    fn control_handle(&self) -> &RootJobControlHandle {
7897        &self.control_handle
7898    }
7899
7900    fn drop_without_shutdown(mut self) {
7901        // Safety: drops once, never accessed again due to mem::forget
7902        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7903        // Prevent Drop from running (which would shut down the channel)
7904        std::mem::forget(self);
7905    }
7906}
7907
7908impl RootJobGetResponder {
7909    /// Sends a response to the FIDL transaction.
7910    ///
7911    /// Sets the channel to shutdown if an error occurs.
7912    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7913        let _result = self.send_raw(job);
7914        if _result.is_err() {
7915            self.control_handle.shutdown();
7916        }
7917        self.drop_without_shutdown();
7918        _result
7919    }
7920
7921    /// Similar to "send" but does not shutdown the channel if an error occurs.
7922    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7923        let _result = self.send_raw(job);
7924        self.drop_without_shutdown();
7925        _result
7926    }
7927
7928    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7929        self.control_handle.inner.send::<RootJobGetResponse>(
7930            (job,),
7931            self.tx_id,
7932            0x73acb63f93d53eac,
7933            fidl::encoding::DynamicFlags::empty(),
7934        )
7935    }
7936}
7937
7938#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7939pub struct RootJobForInspectMarker;
7940
7941impl fidl::endpoints::ProtocolMarker for RootJobForInspectMarker {
7942    type Proxy = RootJobForInspectProxy;
7943    type RequestStream = RootJobForInspectRequestStream;
7944    #[cfg(target_os = "fuchsia")]
7945    type SynchronousProxy = RootJobForInspectSynchronousProxy;
7946
7947    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJobForInspect";
7948}
7949impl fidl::endpoints::DiscoverableProtocolMarker for RootJobForInspectMarker {}
7950
7951pub trait RootJobForInspectProxyInterface: Send + Sync {
7952    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7953    fn r#get(&self) -> Self::GetResponseFut;
7954}
7955#[derive(Debug)]
7956#[cfg(target_os = "fuchsia")]
7957pub struct RootJobForInspectSynchronousProxy {
7958    client: fidl::client::sync::Client,
7959}
7960
7961#[cfg(target_os = "fuchsia")]
7962impl fidl::endpoints::SynchronousProxy for RootJobForInspectSynchronousProxy {
7963    type Proxy = RootJobForInspectProxy;
7964    type Protocol = RootJobForInspectMarker;
7965
7966    fn from_channel(inner: fidl::Channel) -> Self {
7967        Self::new(inner)
7968    }
7969
7970    fn into_channel(self) -> fidl::Channel {
7971        self.client.into_channel()
7972    }
7973
7974    fn as_channel(&self) -> &fidl::Channel {
7975        self.client.as_channel()
7976    }
7977}
7978
7979#[cfg(target_os = "fuchsia")]
7980impl RootJobForInspectSynchronousProxy {
7981    pub fn new(channel: fidl::Channel) -> Self {
7982        let protocol_name =
7983            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7984        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7985    }
7986
7987    pub fn into_channel(self) -> fidl::Channel {
7988        self.client.into_channel()
7989    }
7990
7991    /// Waits until an event arrives and returns it. It is safe for other
7992    /// threads to make concurrent requests while waiting for an event.
7993    pub fn wait_for_event(
7994        &self,
7995        deadline: zx::MonotonicInstant,
7996    ) -> Result<RootJobForInspectEvent, fidl::Error> {
7997        RootJobForInspectEvent::decode(self.client.wait_for_event(deadline)?)
7998    }
7999
8000    /// Get the root `job`.
8001    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
8002        let _response =
8003            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
8004                (),
8005                0x73acb63f93d53eac,
8006                fidl::encoding::DynamicFlags::empty(),
8007                ___deadline,
8008            )?;
8009        Ok(_response.job)
8010    }
8011}
8012
8013#[cfg(target_os = "fuchsia")]
8014impl From<RootJobForInspectSynchronousProxy> for zx::Handle {
8015    fn from(value: RootJobForInspectSynchronousProxy) -> Self {
8016        value.into_channel().into()
8017    }
8018}
8019
8020#[cfg(target_os = "fuchsia")]
8021impl From<fidl::Channel> for RootJobForInspectSynchronousProxy {
8022    fn from(value: fidl::Channel) -> Self {
8023        Self::new(value)
8024    }
8025}
8026
8027#[cfg(target_os = "fuchsia")]
8028impl fidl::endpoints::FromClient for RootJobForInspectSynchronousProxy {
8029    type Protocol = RootJobForInspectMarker;
8030
8031    fn from_client(value: fidl::endpoints::ClientEnd<RootJobForInspectMarker>) -> Self {
8032        Self::new(value.into_channel())
8033    }
8034}
8035
8036#[derive(Debug, Clone)]
8037pub struct RootJobForInspectProxy {
8038    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8039}
8040
8041impl fidl::endpoints::Proxy for RootJobForInspectProxy {
8042    type Protocol = RootJobForInspectMarker;
8043
8044    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8045        Self::new(inner)
8046    }
8047
8048    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8049        self.client.into_channel().map_err(|client| Self { client })
8050    }
8051
8052    fn as_channel(&self) -> &::fidl::AsyncChannel {
8053        self.client.as_channel()
8054    }
8055}
8056
8057impl RootJobForInspectProxy {
8058    /// Create a new Proxy for fuchsia.kernel/RootJobForInspect.
8059    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8060        let protocol_name =
8061            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8062        Self { client: fidl::client::Client::new(channel, protocol_name) }
8063    }
8064
8065    /// Get a Stream of events from the remote end of the protocol.
8066    ///
8067    /// # Panics
8068    ///
8069    /// Panics if the event stream was already taken.
8070    pub fn take_event_stream(&self) -> RootJobForInspectEventStream {
8071        RootJobForInspectEventStream { event_receiver: self.client.take_event_receiver() }
8072    }
8073
8074    /// Get the root `job`.
8075    pub fn r#get(
8076        &self,
8077    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
8078    {
8079        RootJobForInspectProxyInterface::r#get(self)
8080    }
8081}
8082
8083impl RootJobForInspectProxyInterface for RootJobForInspectProxy {
8084    type GetResponseFut =
8085        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
8086    fn r#get(&self) -> Self::GetResponseFut {
8087        fn _decode(
8088            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8089        ) -> Result<fidl::Job, fidl::Error> {
8090            let _response = fidl::client::decode_transaction_body::<
8091                RootJobGetResponse,
8092                fidl::encoding::DefaultFuchsiaResourceDialect,
8093                0x73acb63f93d53eac,
8094            >(_buf?)?;
8095            Ok(_response.job)
8096        }
8097        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
8098            (),
8099            0x73acb63f93d53eac,
8100            fidl::encoding::DynamicFlags::empty(),
8101            _decode,
8102        )
8103    }
8104}
8105
8106pub struct RootJobForInspectEventStream {
8107    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8108}
8109
8110impl std::marker::Unpin for RootJobForInspectEventStream {}
8111
8112impl futures::stream::FusedStream for RootJobForInspectEventStream {
8113    fn is_terminated(&self) -> bool {
8114        self.event_receiver.is_terminated()
8115    }
8116}
8117
8118impl futures::Stream for RootJobForInspectEventStream {
8119    type Item = Result<RootJobForInspectEvent, fidl::Error>;
8120
8121    fn poll_next(
8122        mut self: std::pin::Pin<&mut Self>,
8123        cx: &mut std::task::Context<'_>,
8124    ) -> std::task::Poll<Option<Self::Item>> {
8125        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8126            &mut self.event_receiver,
8127            cx
8128        )?) {
8129            Some(buf) => std::task::Poll::Ready(Some(RootJobForInspectEvent::decode(buf))),
8130            None => std::task::Poll::Ready(None),
8131        }
8132    }
8133}
8134
8135#[derive(Debug)]
8136pub enum RootJobForInspectEvent {}
8137
8138impl RootJobForInspectEvent {
8139    /// Decodes a message buffer as a [`RootJobForInspectEvent`].
8140    fn decode(
8141        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8142    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8143        let (bytes, _handles) = buf.split_mut();
8144        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8145        debug_assert_eq!(tx_header.tx_id, 0);
8146        match tx_header.ordinal {
8147            _ => Err(fidl::Error::UnknownOrdinal {
8148                ordinal: tx_header.ordinal,
8149                protocol_name:
8150                    <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8151            }),
8152        }
8153    }
8154}
8155
8156/// A Stream of incoming requests for fuchsia.kernel/RootJobForInspect.
8157pub struct RootJobForInspectRequestStream {
8158    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8159    is_terminated: bool,
8160}
8161
8162impl std::marker::Unpin for RootJobForInspectRequestStream {}
8163
8164impl futures::stream::FusedStream for RootJobForInspectRequestStream {
8165    fn is_terminated(&self) -> bool {
8166        self.is_terminated
8167    }
8168}
8169
8170impl fidl::endpoints::RequestStream for RootJobForInspectRequestStream {
8171    type Protocol = RootJobForInspectMarker;
8172    type ControlHandle = RootJobForInspectControlHandle;
8173
8174    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8175        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8176    }
8177
8178    fn control_handle(&self) -> Self::ControlHandle {
8179        RootJobForInspectControlHandle { inner: self.inner.clone() }
8180    }
8181
8182    fn into_inner(
8183        self,
8184    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8185    {
8186        (self.inner, self.is_terminated)
8187    }
8188
8189    fn from_inner(
8190        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8191        is_terminated: bool,
8192    ) -> Self {
8193        Self { inner, is_terminated }
8194    }
8195}
8196
8197impl futures::Stream for RootJobForInspectRequestStream {
8198    type Item = Result<RootJobForInspectRequest, fidl::Error>;
8199
8200    fn poll_next(
8201        mut self: std::pin::Pin<&mut Self>,
8202        cx: &mut std::task::Context<'_>,
8203    ) -> std::task::Poll<Option<Self::Item>> {
8204        let this = &mut *self;
8205        if this.inner.check_shutdown(cx) {
8206            this.is_terminated = true;
8207            return std::task::Poll::Ready(None);
8208        }
8209        if this.is_terminated {
8210            panic!("polled RootJobForInspectRequestStream after completion");
8211        }
8212        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8213            |bytes, handles| {
8214                match this.inner.channel().read_etc(cx, bytes, handles) {
8215                    std::task::Poll::Ready(Ok(())) => {}
8216                    std::task::Poll::Pending => return std::task::Poll::Pending,
8217                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8218                        this.is_terminated = true;
8219                        return std::task::Poll::Ready(None);
8220                    }
8221                    std::task::Poll::Ready(Err(e)) => {
8222                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8223                            e.into(),
8224                        ))));
8225                    }
8226                }
8227
8228                // A message has been received from the channel
8229                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8230
8231                std::task::Poll::Ready(Some(match header.ordinal {
8232                    0x73acb63f93d53eac => {
8233                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8234                        let mut req = fidl::new_empty!(
8235                            fidl::encoding::EmptyPayload,
8236                            fidl::encoding::DefaultFuchsiaResourceDialect
8237                        );
8238                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8239                        let control_handle =
8240                            RootJobForInspectControlHandle { inner: this.inner.clone() };
8241                        Ok(RootJobForInspectRequest::Get {
8242                            responder: RootJobForInspectGetResponder {
8243                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8244                                tx_id: header.tx_id,
8245                            },
8246                        })
8247                    }
8248                    _ => Err(fidl::Error::UnknownOrdinal {
8249                        ordinal: header.ordinal,
8250                        protocol_name:
8251                            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8252                    }),
8253                }))
8254            },
8255        )
8256    }
8257}
8258
8259/// Protocol for providing the root job with restricted rights, specifically:
8260/// INSPECT | ENUMERATE | DUPLICATE | TRANSFER
8261#[derive(Debug)]
8262pub enum RootJobForInspectRequest {
8263    /// Get the root `job`.
8264    Get { responder: RootJobForInspectGetResponder },
8265}
8266
8267impl RootJobForInspectRequest {
8268    #[allow(irrefutable_let_patterns)]
8269    pub fn into_get(self) -> Option<(RootJobForInspectGetResponder)> {
8270        if let RootJobForInspectRequest::Get { responder } = self {
8271            Some((responder))
8272        } else {
8273            None
8274        }
8275    }
8276
8277    /// Name of the method defined in FIDL
8278    pub fn method_name(&self) -> &'static str {
8279        match *self {
8280            RootJobForInspectRequest::Get { .. } => "get",
8281        }
8282    }
8283}
8284
8285#[derive(Debug, Clone)]
8286pub struct RootJobForInspectControlHandle {
8287    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8288}
8289
8290impl fidl::endpoints::ControlHandle for RootJobForInspectControlHandle {
8291    fn shutdown(&self) {
8292        self.inner.shutdown()
8293    }
8294    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8295        self.inner.shutdown_with_epitaph(status)
8296    }
8297
8298    fn is_closed(&self) -> bool {
8299        self.inner.channel().is_closed()
8300    }
8301    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8302        self.inner.channel().on_closed()
8303    }
8304
8305    #[cfg(target_os = "fuchsia")]
8306    fn signal_peer(
8307        &self,
8308        clear_mask: zx::Signals,
8309        set_mask: zx::Signals,
8310    ) -> Result<(), zx_status::Status> {
8311        use fidl::Peered;
8312        self.inner.channel().signal_peer(clear_mask, set_mask)
8313    }
8314}
8315
8316impl RootJobForInspectControlHandle {}
8317
8318#[must_use = "FIDL methods require a response to be sent"]
8319#[derive(Debug)]
8320pub struct RootJobForInspectGetResponder {
8321    control_handle: std::mem::ManuallyDrop<RootJobForInspectControlHandle>,
8322    tx_id: u32,
8323}
8324
8325/// Set the the channel to be shutdown (see [`RootJobForInspectControlHandle::shutdown`])
8326/// if the responder is dropped without sending a response, so that the client
8327/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8328impl std::ops::Drop for RootJobForInspectGetResponder {
8329    fn drop(&mut self) {
8330        self.control_handle.shutdown();
8331        // Safety: drops once, never accessed again
8332        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8333    }
8334}
8335
8336impl fidl::endpoints::Responder for RootJobForInspectGetResponder {
8337    type ControlHandle = RootJobForInspectControlHandle;
8338
8339    fn control_handle(&self) -> &RootJobForInspectControlHandle {
8340        &self.control_handle
8341    }
8342
8343    fn drop_without_shutdown(mut self) {
8344        // Safety: drops once, never accessed again due to mem::forget
8345        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8346        // Prevent Drop from running (which would shut down the channel)
8347        std::mem::forget(self);
8348    }
8349}
8350
8351impl RootJobForInspectGetResponder {
8352    /// Sends a response to the FIDL transaction.
8353    ///
8354    /// Sets the channel to shutdown if an error occurs.
8355    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8356        let _result = self.send_raw(job);
8357        if _result.is_err() {
8358            self.control_handle.shutdown();
8359        }
8360        self.drop_without_shutdown();
8361        _result
8362    }
8363
8364    /// Similar to "send" but does not shutdown the channel if an error occurs.
8365    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8366        let _result = self.send_raw(job);
8367        self.drop_without_shutdown();
8368        _result
8369    }
8370
8371    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8372        self.control_handle.inner.send::<RootJobGetResponse>(
8373            (job,),
8374            self.tx_id,
8375            0x73acb63f93d53eac,
8376            fidl::encoding::DynamicFlags::empty(),
8377        )
8378    }
8379}
8380
8381#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8382pub struct SmcResourceMarker;
8383
8384impl fidl::endpoints::ProtocolMarker for SmcResourceMarker {
8385    type Proxy = SmcResourceProxy;
8386    type RequestStream = SmcResourceRequestStream;
8387    #[cfg(target_os = "fuchsia")]
8388    type SynchronousProxy = SmcResourceSynchronousProxy;
8389
8390    const DEBUG_NAME: &'static str = "fuchsia.kernel.SmcResource";
8391}
8392impl fidl::endpoints::DiscoverableProtocolMarker for SmcResourceMarker {}
8393
8394pub trait SmcResourceProxyInterface: Send + Sync {
8395    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8396    fn r#get(&self) -> Self::GetResponseFut;
8397}
8398#[derive(Debug)]
8399#[cfg(target_os = "fuchsia")]
8400pub struct SmcResourceSynchronousProxy {
8401    client: fidl::client::sync::Client,
8402}
8403
8404#[cfg(target_os = "fuchsia")]
8405impl fidl::endpoints::SynchronousProxy for SmcResourceSynchronousProxy {
8406    type Proxy = SmcResourceProxy;
8407    type Protocol = SmcResourceMarker;
8408
8409    fn from_channel(inner: fidl::Channel) -> Self {
8410        Self::new(inner)
8411    }
8412
8413    fn into_channel(self) -> fidl::Channel {
8414        self.client.into_channel()
8415    }
8416
8417    fn as_channel(&self) -> &fidl::Channel {
8418        self.client.as_channel()
8419    }
8420}
8421
8422#[cfg(target_os = "fuchsia")]
8423impl SmcResourceSynchronousProxy {
8424    pub fn new(channel: fidl::Channel) -> Self {
8425        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8426        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8427    }
8428
8429    pub fn into_channel(self) -> fidl::Channel {
8430        self.client.into_channel()
8431    }
8432
8433    /// Waits until an event arrives and returns it. It is safe for other
8434    /// threads to make concurrent requests while waiting for an event.
8435    pub fn wait_for_event(
8436        &self,
8437        deadline: zx::MonotonicInstant,
8438    ) -> Result<SmcResourceEvent, fidl::Error> {
8439        SmcResourceEvent::decode(self.client.wait_for_event(deadline)?)
8440    }
8441
8442    /// Get an SMC resource handle.
8443    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8444        let _response =
8445            self.client.send_query::<fidl::encoding::EmptyPayload, SmcResourceGetResponse>(
8446                (),
8447                0x392cbd495b84ede7,
8448                fidl::encoding::DynamicFlags::empty(),
8449                ___deadline,
8450            )?;
8451        Ok(_response.resource)
8452    }
8453}
8454
8455#[cfg(target_os = "fuchsia")]
8456impl From<SmcResourceSynchronousProxy> for zx::Handle {
8457    fn from(value: SmcResourceSynchronousProxy) -> Self {
8458        value.into_channel().into()
8459    }
8460}
8461
8462#[cfg(target_os = "fuchsia")]
8463impl From<fidl::Channel> for SmcResourceSynchronousProxy {
8464    fn from(value: fidl::Channel) -> Self {
8465        Self::new(value)
8466    }
8467}
8468
8469#[cfg(target_os = "fuchsia")]
8470impl fidl::endpoints::FromClient for SmcResourceSynchronousProxy {
8471    type Protocol = SmcResourceMarker;
8472
8473    fn from_client(value: fidl::endpoints::ClientEnd<SmcResourceMarker>) -> Self {
8474        Self::new(value.into_channel())
8475    }
8476}
8477
8478#[derive(Debug, Clone)]
8479pub struct SmcResourceProxy {
8480    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8481}
8482
8483impl fidl::endpoints::Proxy for SmcResourceProxy {
8484    type Protocol = SmcResourceMarker;
8485
8486    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8487        Self::new(inner)
8488    }
8489
8490    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8491        self.client.into_channel().map_err(|client| Self { client })
8492    }
8493
8494    fn as_channel(&self) -> &::fidl::AsyncChannel {
8495        self.client.as_channel()
8496    }
8497}
8498
8499impl SmcResourceProxy {
8500    /// Create a new Proxy for fuchsia.kernel/SmcResource.
8501    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8502        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8503        Self { client: fidl::client::Client::new(channel, protocol_name) }
8504    }
8505
8506    /// Get a Stream of events from the remote end of the protocol.
8507    ///
8508    /// # Panics
8509    ///
8510    /// Panics if the event stream was already taken.
8511    pub fn take_event_stream(&self) -> SmcResourceEventStream {
8512        SmcResourceEventStream { event_receiver: self.client.take_event_receiver() }
8513    }
8514
8515    /// Get an SMC resource handle.
8516    pub fn r#get(
8517        &self,
8518    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8519    {
8520        SmcResourceProxyInterface::r#get(self)
8521    }
8522}
8523
8524impl SmcResourceProxyInterface for SmcResourceProxy {
8525    type GetResponseFut = fidl::client::QueryResponseFut<
8526        fidl::Resource,
8527        fidl::encoding::DefaultFuchsiaResourceDialect,
8528    >;
8529    fn r#get(&self) -> Self::GetResponseFut {
8530        fn _decode(
8531            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8532        ) -> Result<fidl::Resource, fidl::Error> {
8533            let _response = fidl::client::decode_transaction_body::<
8534                SmcResourceGetResponse,
8535                fidl::encoding::DefaultFuchsiaResourceDialect,
8536                0x392cbd495b84ede7,
8537            >(_buf?)?;
8538            Ok(_response.resource)
8539        }
8540        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8541            (),
8542            0x392cbd495b84ede7,
8543            fidl::encoding::DynamicFlags::empty(),
8544            _decode,
8545        )
8546    }
8547}
8548
8549pub struct SmcResourceEventStream {
8550    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8551}
8552
8553impl std::marker::Unpin for SmcResourceEventStream {}
8554
8555impl futures::stream::FusedStream for SmcResourceEventStream {
8556    fn is_terminated(&self) -> bool {
8557        self.event_receiver.is_terminated()
8558    }
8559}
8560
8561impl futures::Stream for SmcResourceEventStream {
8562    type Item = Result<SmcResourceEvent, fidl::Error>;
8563
8564    fn poll_next(
8565        mut self: std::pin::Pin<&mut Self>,
8566        cx: &mut std::task::Context<'_>,
8567    ) -> std::task::Poll<Option<Self::Item>> {
8568        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8569            &mut self.event_receiver,
8570            cx
8571        )?) {
8572            Some(buf) => std::task::Poll::Ready(Some(SmcResourceEvent::decode(buf))),
8573            None => std::task::Poll::Ready(None),
8574        }
8575    }
8576}
8577
8578#[derive(Debug)]
8579pub enum SmcResourceEvent {}
8580
8581impl SmcResourceEvent {
8582    /// Decodes a message buffer as a [`SmcResourceEvent`].
8583    fn decode(
8584        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8585    ) -> Result<SmcResourceEvent, fidl::Error> {
8586        let (bytes, _handles) = buf.split_mut();
8587        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8588        debug_assert_eq!(tx_header.tx_id, 0);
8589        match tx_header.ordinal {
8590            _ => Err(fidl::Error::UnknownOrdinal {
8591                ordinal: tx_header.ordinal,
8592                protocol_name: <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8593            }),
8594        }
8595    }
8596}
8597
8598/// A Stream of incoming requests for fuchsia.kernel/SmcResource.
8599pub struct SmcResourceRequestStream {
8600    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8601    is_terminated: bool,
8602}
8603
8604impl std::marker::Unpin for SmcResourceRequestStream {}
8605
8606impl futures::stream::FusedStream for SmcResourceRequestStream {
8607    fn is_terminated(&self) -> bool {
8608        self.is_terminated
8609    }
8610}
8611
8612impl fidl::endpoints::RequestStream for SmcResourceRequestStream {
8613    type Protocol = SmcResourceMarker;
8614    type ControlHandle = SmcResourceControlHandle;
8615
8616    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8617        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8618    }
8619
8620    fn control_handle(&self) -> Self::ControlHandle {
8621        SmcResourceControlHandle { inner: self.inner.clone() }
8622    }
8623
8624    fn into_inner(
8625        self,
8626    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8627    {
8628        (self.inner, self.is_terminated)
8629    }
8630
8631    fn from_inner(
8632        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8633        is_terminated: bool,
8634    ) -> Self {
8635        Self { inner, is_terminated }
8636    }
8637}
8638
8639impl futures::Stream for SmcResourceRequestStream {
8640    type Item = Result<SmcResourceRequest, fidl::Error>;
8641
8642    fn poll_next(
8643        mut self: std::pin::Pin<&mut Self>,
8644        cx: &mut std::task::Context<'_>,
8645    ) -> std::task::Poll<Option<Self::Item>> {
8646        let this = &mut *self;
8647        if this.inner.check_shutdown(cx) {
8648            this.is_terminated = true;
8649            return std::task::Poll::Ready(None);
8650        }
8651        if this.is_terminated {
8652            panic!("polled SmcResourceRequestStream after completion");
8653        }
8654        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8655            |bytes, handles| {
8656                match this.inner.channel().read_etc(cx, bytes, handles) {
8657                    std::task::Poll::Ready(Ok(())) => {}
8658                    std::task::Poll::Pending => return std::task::Poll::Pending,
8659                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8660                        this.is_terminated = true;
8661                        return std::task::Poll::Ready(None);
8662                    }
8663                    std::task::Poll::Ready(Err(e)) => {
8664                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8665                            e.into(),
8666                        ))));
8667                    }
8668                }
8669
8670                // A message has been received from the channel
8671                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8672
8673                std::task::Poll::Ready(Some(match header.ordinal {
8674                    0x392cbd495b84ede7 => {
8675                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8676                        let mut req = fidl::new_empty!(
8677                            fidl::encoding::EmptyPayload,
8678                            fidl::encoding::DefaultFuchsiaResourceDialect
8679                        );
8680                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8681                        let control_handle = SmcResourceControlHandle { inner: this.inner.clone() };
8682                        Ok(SmcResourceRequest::Get {
8683                            responder: SmcResourceGetResponder {
8684                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8685                                tx_id: header.tx_id,
8686                            },
8687                        })
8688                    }
8689                    _ => Err(fidl::Error::UnknownOrdinal {
8690                        ordinal: header.ordinal,
8691                        protocol_name:
8692                            <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8693                    }),
8694                }))
8695            },
8696        )
8697    }
8698}
8699
8700/// Protocol for providing an SMC resource with access to all valid ranges.
8701#[derive(Debug)]
8702pub enum SmcResourceRequest {
8703    /// Get an SMC resource handle.
8704    Get { responder: SmcResourceGetResponder },
8705}
8706
8707impl SmcResourceRequest {
8708    #[allow(irrefutable_let_patterns)]
8709    pub fn into_get(self) -> Option<(SmcResourceGetResponder)> {
8710        if let SmcResourceRequest::Get { responder } = self { Some((responder)) } else { None }
8711    }
8712
8713    /// Name of the method defined in FIDL
8714    pub fn method_name(&self) -> &'static str {
8715        match *self {
8716            SmcResourceRequest::Get { .. } => "get",
8717        }
8718    }
8719}
8720
8721#[derive(Debug, Clone)]
8722pub struct SmcResourceControlHandle {
8723    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8724}
8725
8726impl fidl::endpoints::ControlHandle for SmcResourceControlHandle {
8727    fn shutdown(&self) {
8728        self.inner.shutdown()
8729    }
8730    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8731        self.inner.shutdown_with_epitaph(status)
8732    }
8733
8734    fn is_closed(&self) -> bool {
8735        self.inner.channel().is_closed()
8736    }
8737    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8738        self.inner.channel().on_closed()
8739    }
8740
8741    #[cfg(target_os = "fuchsia")]
8742    fn signal_peer(
8743        &self,
8744        clear_mask: zx::Signals,
8745        set_mask: zx::Signals,
8746    ) -> Result<(), zx_status::Status> {
8747        use fidl::Peered;
8748        self.inner.channel().signal_peer(clear_mask, set_mask)
8749    }
8750}
8751
8752impl SmcResourceControlHandle {}
8753
8754#[must_use = "FIDL methods require a response to be sent"]
8755#[derive(Debug)]
8756pub struct SmcResourceGetResponder {
8757    control_handle: std::mem::ManuallyDrop<SmcResourceControlHandle>,
8758    tx_id: u32,
8759}
8760
8761/// Set the the channel to be shutdown (see [`SmcResourceControlHandle::shutdown`])
8762/// if the responder is dropped without sending a response, so that the client
8763/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8764impl std::ops::Drop for SmcResourceGetResponder {
8765    fn drop(&mut self) {
8766        self.control_handle.shutdown();
8767        // Safety: drops once, never accessed again
8768        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8769    }
8770}
8771
8772impl fidl::endpoints::Responder for SmcResourceGetResponder {
8773    type ControlHandle = SmcResourceControlHandle;
8774
8775    fn control_handle(&self) -> &SmcResourceControlHandle {
8776        &self.control_handle
8777    }
8778
8779    fn drop_without_shutdown(mut self) {
8780        // Safety: drops once, never accessed again due to mem::forget
8781        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8782        // Prevent Drop from running (which would shut down the channel)
8783        std::mem::forget(self);
8784    }
8785}
8786
8787impl SmcResourceGetResponder {
8788    /// Sends a response to the FIDL transaction.
8789    ///
8790    /// Sets the channel to shutdown if an error occurs.
8791    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8792        let _result = self.send_raw(resource);
8793        if _result.is_err() {
8794            self.control_handle.shutdown();
8795        }
8796        self.drop_without_shutdown();
8797        _result
8798    }
8799
8800    /// Similar to "send" but does not shutdown the channel if an error occurs.
8801    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8802        let _result = self.send_raw(resource);
8803        self.drop_without_shutdown();
8804        _result
8805    }
8806
8807    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8808        self.control_handle.inner.send::<SmcResourceGetResponse>(
8809            (resource,),
8810            self.tx_id,
8811            0x392cbd495b84ede7,
8812            fidl::encoding::DynamicFlags::empty(),
8813        )
8814    }
8815}
8816
8817#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8818pub struct StallResourceMarker;
8819
8820impl fidl::endpoints::ProtocolMarker for StallResourceMarker {
8821    type Proxy = StallResourceProxy;
8822    type RequestStream = StallResourceRequestStream;
8823    #[cfg(target_os = "fuchsia")]
8824    type SynchronousProxy = StallResourceSynchronousProxy;
8825
8826    const DEBUG_NAME: &'static str = "fuchsia.kernel.StallResource";
8827}
8828impl fidl::endpoints::DiscoverableProtocolMarker for StallResourceMarker {}
8829
8830pub trait StallResourceProxyInterface: Send + Sync {
8831    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8832    fn r#get(&self) -> Self::GetResponseFut;
8833}
8834#[derive(Debug)]
8835#[cfg(target_os = "fuchsia")]
8836pub struct StallResourceSynchronousProxy {
8837    client: fidl::client::sync::Client,
8838}
8839
8840#[cfg(target_os = "fuchsia")]
8841impl fidl::endpoints::SynchronousProxy for StallResourceSynchronousProxy {
8842    type Proxy = StallResourceProxy;
8843    type Protocol = StallResourceMarker;
8844
8845    fn from_channel(inner: fidl::Channel) -> Self {
8846        Self::new(inner)
8847    }
8848
8849    fn into_channel(self) -> fidl::Channel {
8850        self.client.into_channel()
8851    }
8852
8853    fn as_channel(&self) -> &fidl::Channel {
8854        self.client.as_channel()
8855    }
8856}
8857
8858#[cfg(target_os = "fuchsia")]
8859impl StallResourceSynchronousProxy {
8860    pub fn new(channel: fidl::Channel) -> Self {
8861        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8862        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8863    }
8864
8865    pub fn into_channel(self) -> fidl::Channel {
8866        self.client.into_channel()
8867    }
8868
8869    /// Waits until an event arrives and returns it. It is safe for other
8870    /// threads to make concurrent requests while waiting for an event.
8871    pub fn wait_for_event(
8872        &self,
8873        deadline: zx::MonotonicInstant,
8874    ) -> Result<StallResourceEvent, fidl::Error> {
8875        StallResourceEvent::decode(self.client.wait_for_event(deadline)?)
8876    }
8877
8878    /// Get a stall resource handle.
8879    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8880        let _response =
8881            self.client.send_query::<fidl::encoding::EmptyPayload, StallResourceGetResponse>(
8882                (),
8883                0x5edf4c8629a9781a,
8884                fidl::encoding::DynamicFlags::empty(),
8885                ___deadline,
8886            )?;
8887        Ok(_response.resource)
8888    }
8889}
8890
8891#[cfg(target_os = "fuchsia")]
8892impl From<StallResourceSynchronousProxy> for zx::Handle {
8893    fn from(value: StallResourceSynchronousProxy) -> Self {
8894        value.into_channel().into()
8895    }
8896}
8897
8898#[cfg(target_os = "fuchsia")]
8899impl From<fidl::Channel> for StallResourceSynchronousProxy {
8900    fn from(value: fidl::Channel) -> Self {
8901        Self::new(value)
8902    }
8903}
8904
8905#[cfg(target_os = "fuchsia")]
8906impl fidl::endpoints::FromClient for StallResourceSynchronousProxy {
8907    type Protocol = StallResourceMarker;
8908
8909    fn from_client(value: fidl::endpoints::ClientEnd<StallResourceMarker>) -> Self {
8910        Self::new(value.into_channel())
8911    }
8912}
8913
8914#[derive(Debug, Clone)]
8915pub struct StallResourceProxy {
8916    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8917}
8918
8919impl fidl::endpoints::Proxy for StallResourceProxy {
8920    type Protocol = StallResourceMarker;
8921
8922    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8923        Self::new(inner)
8924    }
8925
8926    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8927        self.client.into_channel().map_err(|client| Self { client })
8928    }
8929
8930    fn as_channel(&self) -> &::fidl::AsyncChannel {
8931        self.client.as_channel()
8932    }
8933}
8934
8935impl StallResourceProxy {
8936    /// Create a new Proxy for fuchsia.kernel/StallResource.
8937    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8938        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8939        Self { client: fidl::client::Client::new(channel, protocol_name) }
8940    }
8941
8942    /// Get a Stream of events from the remote end of the protocol.
8943    ///
8944    /// # Panics
8945    ///
8946    /// Panics if the event stream was already taken.
8947    pub fn take_event_stream(&self) -> StallResourceEventStream {
8948        StallResourceEventStream { event_receiver: self.client.take_event_receiver() }
8949    }
8950
8951    /// Get a stall resource handle.
8952    pub fn r#get(
8953        &self,
8954    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8955    {
8956        StallResourceProxyInterface::r#get(self)
8957    }
8958}
8959
8960impl StallResourceProxyInterface for StallResourceProxy {
8961    type GetResponseFut = fidl::client::QueryResponseFut<
8962        fidl::Resource,
8963        fidl::encoding::DefaultFuchsiaResourceDialect,
8964    >;
8965    fn r#get(&self) -> Self::GetResponseFut {
8966        fn _decode(
8967            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8968        ) -> Result<fidl::Resource, fidl::Error> {
8969            let _response = fidl::client::decode_transaction_body::<
8970                StallResourceGetResponse,
8971                fidl::encoding::DefaultFuchsiaResourceDialect,
8972                0x5edf4c8629a9781a,
8973            >(_buf?)?;
8974            Ok(_response.resource)
8975        }
8976        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8977            (),
8978            0x5edf4c8629a9781a,
8979            fidl::encoding::DynamicFlags::empty(),
8980            _decode,
8981        )
8982    }
8983}
8984
8985pub struct StallResourceEventStream {
8986    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8987}
8988
8989impl std::marker::Unpin for StallResourceEventStream {}
8990
8991impl futures::stream::FusedStream for StallResourceEventStream {
8992    fn is_terminated(&self) -> bool {
8993        self.event_receiver.is_terminated()
8994    }
8995}
8996
8997impl futures::Stream for StallResourceEventStream {
8998    type Item = Result<StallResourceEvent, fidl::Error>;
8999
9000    fn poll_next(
9001        mut self: std::pin::Pin<&mut Self>,
9002        cx: &mut std::task::Context<'_>,
9003    ) -> std::task::Poll<Option<Self::Item>> {
9004        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9005            &mut self.event_receiver,
9006            cx
9007        )?) {
9008            Some(buf) => std::task::Poll::Ready(Some(StallResourceEvent::decode(buf))),
9009            None => std::task::Poll::Ready(None),
9010        }
9011    }
9012}
9013
9014#[derive(Debug)]
9015pub enum StallResourceEvent {}
9016
9017impl StallResourceEvent {
9018    /// Decodes a message buffer as a [`StallResourceEvent`].
9019    fn decode(
9020        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9021    ) -> Result<StallResourceEvent, fidl::Error> {
9022        let (bytes, _handles) = buf.split_mut();
9023        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9024        debug_assert_eq!(tx_header.tx_id, 0);
9025        match tx_header.ordinal {
9026            _ => Err(fidl::Error::UnknownOrdinal {
9027                ordinal: tx_header.ordinal,
9028                protocol_name: <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9029            }),
9030        }
9031    }
9032}
9033
9034/// A Stream of incoming requests for fuchsia.kernel/StallResource.
9035pub struct StallResourceRequestStream {
9036    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9037    is_terminated: bool,
9038}
9039
9040impl std::marker::Unpin for StallResourceRequestStream {}
9041
9042impl futures::stream::FusedStream for StallResourceRequestStream {
9043    fn is_terminated(&self) -> bool {
9044        self.is_terminated
9045    }
9046}
9047
9048impl fidl::endpoints::RequestStream for StallResourceRequestStream {
9049    type Protocol = StallResourceMarker;
9050    type ControlHandle = StallResourceControlHandle;
9051
9052    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9053        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9054    }
9055
9056    fn control_handle(&self) -> Self::ControlHandle {
9057        StallResourceControlHandle { inner: self.inner.clone() }
9058    }
9059
9060    fn into_inner(
9061        self,
9062    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9063    {
9064        (self.inner, self.is_terminated)
9065    }
9066
9067    fn from_inner(
9068        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9069        is_terminated: bool,
9070    ) -> Self {
9071        Self { inner, is_terminated }
9072    }
9073}
9074
9075impl futures::Stream for StallResourceRequestStream {
9076    type Item = Result<StallResourceRequest, fidl::Error>;
9077
9078    fn poll_next(
9079        mut self: std::pin::Pin<&mut Self>,
9080        cx: &mut std::task::Context<'_>,
9081    ) -> std::task::Poll<Option<Self::Item>> {
9082        let this = &mut *self;
9083        if this.inner.check_shutdown(cx) {
9084            this.is_terminated = true;
9085            return std::task::Poll::Ready(None);
9086        }
9087        if this.is_terminated {
9088            panic!("polled StallResourceRequestStream after completion");
9089        }
9090        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9091            |bytes, handles| {
9092                match this.inner.channel().read_etc(cx, bytes, handles) {
9093                    std::task::Poll::Ready(Ok(())) => {}
9094                    std::task::Poll::Pending => return std::task::Poll::Pending,
9095                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9096                        this.is_terminated = true;
9097                        return std::task::Poll::Ready(None);
9098                    }
9099                    std::task::Poll::Ready(Err(e)) => {
9100                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9101                            e.into(),
9102                        ))));
9103                    }
9104                }
9105
9106                // A message has been received from the channel
9107                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9108
9109                std::task::Poll::Ready(Some(match header.ordinal {
9110                    0x5edf4c8629a9781a => {
9111                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9112                        let mut req = fidl::new_empty!(
9113                            fidl::encoding::EmptyPayload,
9114                            fidl::encoding::DefaultFuchsiaResourceDialect
9115                        );
9116                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9117                        let control_handle =
9118                            StallResourceControlHandle { inner: this.inner.clone() };
9119                        Ok(StallResourceRequest::Get {
9120                            responder: StallResourceGetResponder {
9121                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9122                                tx_id: header.tx_id,
9123                            },
9124                        })
9125                    }
9126                    _ => Err(fidl::Error::UnknownOrdinal {
9127                        ordinal: header.ordinal,
9128                        protocol_name:
9129                            <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9130                    }),
9131                }))
9132            },
9133        )
9134    }
9135}
9136
9137/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
9138/// `ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
9139/// be notified of stalls.
9140#[derive(Debug)]
9141pub enum StallResourceRequest {
9142    /// Get a stall resource handle.
9143    Get { responder: StallResourceGetResponder },
9144}
9145
9146impl StallResourceRequest {
9147    #[allow(irrefutable_let_patterns)]
9148    pub fn into_get(self) -> Option<(StallResourceGetResponder)> {
9149        if let StallResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9150    }
9151
9152    /// Name of the method defined in FIDL
9153    pub fn method_name(&self) -> &'static str {
9154        match *self {
9155            StallResourceRequest::Get { .. } => "get",
9156        }
9157    }
9158}
9159
9160#[derive(Debug, Clone)]
9161pub struct StallResourceControlHandle {
9162    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9163}
9164
9165impl fidl::endpoints::ControlHandle for StallResourceControlHandle {
9166    fn shutdown(&self) {
9167        self.inner.shutdown()
9168    }
9169    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9170        self.inner.shutdown_with_epitaph(status)
9171    }
9172
9173    fn is_closed(&self) -> bool {
9174        self.inner.channel().is_closed()
9175    }
9176    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9177        self.inner.channel().on_closed()
9178    }
9179
9180    #[cfg(target_os = "fuchsia")]
9181    fn signal_peer(
9182        &self,
9183        clear_mask: zx::Signals,
9184        set_mask: zx::Signals,
9185    ) -> Result<(), zx_status::Status> {
9186        use fidl::Peered;
9187        self.inner.channel().signal_peer(clear_mask, set_mask)
9188    }
9189}
9190
9191impl StallResourceControlHandle {}
9192
9193#[must_use = "FIDL methods require a response to be sent"]
9194#[derive(Debug)]
9195pub struct StallResourceGetResponder {
9196    control_handle: std::mem::ManuallyDrop<StallResourceControlHandle>,
9197    tx_id: u32,
9198}
9199
9200/// Set the the channel to be shutdown (see [`StallResourceControlHandle::shutdown`])
9201/// if the responder is dropped without sending a response, so that the client
9202/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9203impl std::ops::Drop for StallResourceGetResponder {
9204    fn drop(&mut self) {
9205        self.control_handle.shutdown();
9206        // Safety: drops once, never accessed again
9207        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9208    }
9209}
9210
9211impl fidl::endpoints::Responder for StallResourceGetResponder {
9212    type ControlHandle = StallResourceControlHandle;
9213
9214    fn control_handle(&self) -> &StallResourceControlHandle {
9215        &self.control_handle
9216    }
9217
9218    fn drop_without_shutdown(mut self) {
9219        // Safety: drops once, never accessed again due to mem::forget
9220        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9221        // Prevent Drop from running (which would shut down the channel)
9222        std::mem::forget(self);
9223    }
9224}
9225
9226impl StallResourceGetResponder {
9227    /// Sends a response to the FIDL transaction.
9228    ///
9229    /// Sets the channel to shutdown if an error occurs.
9230    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9231        let _result = self.send_raw(resource);
9232        if _result.is_err() {
9233            self.control_handle.shutdown();
9234        }
9235        self.drop_without_shutdown();
9236        _result
9237    }
9238
9239    /// Similar to "send" but does not shutdown the channel if an error occurs.
9240    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9241        let _result = self.send_raw(resource);
9242        self.drop_without_shutdown();
9243        _result
9244    }
9245
9246    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9247        self.control_handle.inner.send::<StallResourceGetResponse>(
9248            (resource,),
9249            self.tx_id,
9250            0x5edf4c8629a9781a,
9251            fidl::encoding::DynamicFlags::empty(),
9252        )
9253    }
9254}
9255
9256#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9257pub struct StatsMarker;
9258
9259impl fidl::endpoints::ProtocolMarker for StatsMarker {
9260    type Proxy = StatsProxy;
9261    type RequestStream = StatsRequestStream;
9262    #[cfg(target_os = "fuchsia")]
9263    type SynchronousProxy = StatsSynchronousProxy;
9264
9265    const DEBUG_NAME: &'static str = "fuchsia.kernel.Stats";
9266}
9267impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
9268
9269pub trait StatsProxyInterface: Send + Sync {
9270    type GetMemoryStatsResponseFut: std::future::Future<Output = Result<MemoryStats, fidl::Error>>
9271        + Send;
9272    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut;
9273    type GetMemoryStatsExtendedResponseFut: std::future::Future<Output = Result<MemoryStatsExtended, fidl::Error>>
9274        + Send;
9275    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut;
9276    type GetMemoryStatsCompressionResponseFut: std::future::Future<Output = Result<MemoryStatsCompression, fidl::Error>>
9277        + Send;
9278    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut;
9279    type GetCpuStatsResponseFut: std::future::Future<Output = Result<CpuStats, fidl::Error>> + Send;
9280    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut;
9281    type GetCpuLoadResponseFut: std::future::Future<Output = Result<Vec<f32>, fidl::Error>> + Send;
9282    fn r#get_cpu_load(&self, duration: i64) -> Self::GetCpuLoadResponseFut;
9283}
9284#[derive(Debug)]
9285#[cfg(target_os = "fuchsia")]
9286pub struct StatsSynchronousProxy {
9287    client: fidl::client::sync::Client,
9288}
9289
9290#[cfg(target_os = "fuchsia")]
9291impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
9292    type Proxy = StatsProxy;
9293    type Protocol = StatsMarker;
9294
9295    fn from_channel(inner: fidl::Channel) -> Self {
9296        Self::new(inner)
9297    }
9298
9299    fn into_channel(self) -> fidl::Channel {
9300        self.client.into_channel()
9301    }
9302
9303    fn as_channel(&self) -> &fidl::Channel {
9304        self.client.as_channel()
9305    }
9306}
9307
9308#[cfg(target_os = "fuchsia")]
9309impl StatsSynchronousProxy {
9310    pub fn new(channel: fidl::Channel) -> Self {
9311        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9312        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9313    }
9314
9315    pub fn into_channel(self) -> fidl::Channel {
9316        self.client.into_channel()
9317    }
9318
9319    /// Waits until an event arrives and returns it. It is safe for other
9320    /// threads to make concurrent requests while waiting for an event.
9321    pub fn wait_for_event(
9322        &self,
9323        deadline: zx::MonotonicInstant,
9324    ) -> Result<StatsEvent, fidl::Error> {
9325        StatsEvent::decode(self.client.wait_for_event(deadline)?)
9326    }
9327
9328    pub fn r#get_memory_stats(
9329        &self,
9330        ___deadline: zx::MonotonicInstant,
9331    ) -> Result<MemoryStats, fidl::Error> {
9332        let _response =
9333            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsResponse>(
9334                (),
9335                0x686677932ae41074,
9336                fidl::encoding::DynamicFlags::empty(),
9337                ___deadline,
9338            )?;
9339        Ok(_response.stats)
9340    }
9341
9342    pub fn r#get_memory_stats_extended(
9343        &self,
9344        ___deadline: zx::MonotonicInstant,
9345    ) -> Result<MemoryStatsExtended, fidl::Error> {
9346        let _response = self
9347            .client
9348            .send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsExtendedResponse>(
9349                (),
9350                0x60faa0f8aa38c29f,
9351                fidl::encoding::DynamicFlags::empty(),
9352                ___deadline,
9353            )?;
9354        Ok(_response.stats)
9355    }
9356
9357    pub fn r#get_memory_stats_compression(
9358        &self,
9359        ___deadline: zx::MonotonicInstant,
9360    ) -> Result<MemoryStatsCompression, fidl::Error> {
9361        let _response =
9362            self.client.send_query::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
9363                (),
9364                0x544a09995befb531,
9365                fidl::encoding::DynamicFlags::empty(),
9366                ___deadline,
9367            )?;
9368        Ok(_response)
9369    }
9370
9371    pub fn r#get_cpu_stats(
9372        &self,
9373        ___deadline: zx::MonotonicInstant,
9374    ) -> Result<CpuStats, fidl::Error> {
9375        let _response =
9376            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetCpuStatsResponse>(
9377                (),
9378                0x470e2684ca1ca19e,
9379                fidl::encoding::DynamicFlags::empty(),
9380                ___deadline,
9381            )?;
9382        Ok(_response.stats)
9383    }
9384
9385    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9386    /// duration.
9387    ///
9388    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9389    /// PerCpuStats) over a time duration.
9390    pub fn r#get_cpu_load(
9391        &self,
9392        mut duration: i64,
9393        ___deadline: zx::MonotonicInstant,
9394    ) -> Result<Vec<f32>, fidl::Error> {
9395        let _response = self.client.send_query::<StatsGetCpuLoadRequest, StatsGetCpuLoadResponse>(
9396            (duration,),
9397            0x4c8f0f05e7034666,
9398            fidl::encoding::DynamicFlags::empty(),
9399            ___deadline,
9400        )?;
9401        Ok(_response.per_cpu_load)
9402    }
9403}
9404
9405#[cfg(target_os = "fuchsia")]
9406impl From<StatsSynchronousProxy> for zx::Handle {
9407    fn from(value: StatsSynchronousProxy) -> Self {
9408        value.into_channel().into()
9409    }
9410}
9411
9412#[cfg(target_os = "fuchsia")]
9413impl From<fidl::Channel> for StatsSynchronousProxy {
9414    fn from(value: fidl::Channel) -> Self {
9415        Self::new(value)
9416    }
9417}
9418
9419#[cfg(target_os = "fuchsia")]
9420impl fidl::endpoints::FromClient for StatsSynchronousProxy {
9421    type Protocol = StatsMarker;
9422
9423    fn from_client(value: fidl::endpoints::ClientEnd<StatsMarker>) -> Self {
9424        Self::new(value.into_channel())
9425    }
9426}
9427
9428#[derive(Debug, Clone)]
9429pub struct StatsProxy {
9430    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9431}
9432
9433impl fidl::endpoints::Proxy for StatsProxy {
9434    type Protocol = StatsMarker;
9435
9436    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9437        Self::new(inner)
9438    }
9439
9440    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9441        self.client.into_channel().map_err(|client| Self { client })
9442    }
9443
9444    fn as_channel(&self) -> &::fidl::AsyncChannel {
9445        self.client.as_channel()
9446    }
9447}
9448
9449impl StatsProxy {
9450    /// Create a new Proxy for fuchsia.kernel/Stats.
9451    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9452        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9453        Self { client: fidl::client::Client::new(channel, protocol_name) }
9454    }
9455
9456    /// Get a Stream of events from the remote end of the protocol.
9457    ///
9458    /// # Panics
9459    ///
9460    /// Panics if the event stream was already taken.
9461    pub fn take_event_stream(&self) -> StatsEventStream {
9462        StatsEventStream { event_receiver: self.client.take_event_receiver() }
9463    }
9464
9465    pub fn r#get_memory_stats(
9466        &self,
9467    ) -> fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9468    {
9469        StatsProxyInterface::r#get_memory_stats(self)
9470    }
9471
9472    pub fn r#get_memory_stats_extended(
9473        &self,
9474    ) -> fidl::client::QueryResponseFut<
9475        MemoryStatsExtended,
9476        fidl::encoding::DefaultFuchsiaResourceDialect,
9477    > {
9478        StatsProxyInterface::r#get_memory_stats_extended(self)
9479    }
9480
9481    pub fn r#get_memory_stats_compression(
9482        &self,
9483    ) -> fidl::client::QueryResponseFut<
9484        MemoryStatsCompression,
9485        fidl::encoding::DefaultFuchsiaResourceDialect,
9486    > {
9487        StatsProxyInterface::r#get_memory_stats_compression(self)
9488    }
9489
9490    pub fn r#get_cpu_stats(
9491        &self,
9492    ) -> fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9493    {
9494        StatsProxyInterface::r#get_cpu_stats(self)
9495    }
9496
9497    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9498    /// duration.
9499    ///
9500    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9501    /// PerCpuStats) over a time duration.
9502    pub fn r#get_cpu_load(
9503        &self,
9504        mut duration: i64,
9505    ) -> fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>
9506    {
9507        StatsProxyInterface::r#get_cpu_load(self, duration)
9508    }
9509}
9510
9511impl StatsProxyInterface for StatsProxy {
9512    type GetMemoryStatsResponseFut =
9513        fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9514    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut {
9515        fn _decode(
9516            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9517        ) -> Result<MemoryStats, fidl::Error> {
9518            let _response = fidl::client::decode_transaction_body::<
9519                StatsGetMemoryStatsResponse,
9520                fidl::encoding::DefaultFuchsiaResourceDialect,
9521                0x686677932ae41074,
9522            >(_buf?)?;
9523            Ok(_response.stats)
9524        }
9525        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStats>(
9526            (),
9527            0x686677932ae41074,
9528            fidl::encoding::DynamicFlags::empty(),
9529            _decode,
9530        )
9531    }
9532
9533    type GetMemoryStatsExtendedResponseFut = fidl::client::QueryResponseFut<
9534        MemoryStatsExtended,
9535        fidl::encoding::DefaultFuchsiaResourceDialect,
9536    >;
9537    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut {
9538        fn _decode(
9539            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9540        ) -> Result<MemoryStatsExtended, fidl::Error> {
9541            let _response = fidl::client::decode_transaction_body::<
9542                StatsGetMemoryStatsExtendedResponse,
9543                fidl::encoding::DefaultFuchsiaResourceDialect,
9544                0x60faa0f8aa38c29f,
9545            >(_buf?)?;
9546            Ok(_response.stats)
9547        }
9548        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsExtended>(
9549            (),
9550            0x60faa0f8aa38c29f,
9551            fidl::encoding::DynamicFlags::empty(),
9552            _decode,
9553        )
9554    }
9555
9556    type GetMemoryStatsCompressionResponseFut = fidl::client::QueryResponseFut<
9557        MemoryStatsCompression,
9558        fidl::encoding::DefaultFuchsiaResourceDialect,
9559    >;
9560    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut {
9561        fn _decode(
9562            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9563        ) -> Result<MemoryStatsCompression, fidl::Error> {
9564            let _response = fidl::client::decode_transaction_body::<
9565                MemoryStatsCompression,
9566                fidl::encoding::DefaultFuchsiaResourceDialect,
9567                0x544a09995befb531,
9568            >(_buf?)?;
9569            Ok(_response)
9570        }
9571        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
9572            (),
9573            0x544a09995befb531,
9574            fidl::encoding::DynamicFlags::empty(),
9575            _decode,
9576        )
9577    }
9578
9579    type GetCpuStatsResponseFut =
9580        fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9581    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut {
9582        fn _decode(
9583            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9584        ) -> Result<CpuStats, fidl::Error> {
9585            let _response = fidl::client::decode_transaction_body::<
9586                StatsGetCpuStatsResponse,
9587                fidl::encoding::DefaultFuchsiaResourceDialect,
9588                0x470e2684ca1ca19e,
9589            >(_buf?)?;
9590            Ok(_response.stats)
9591        }
9592        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CpuStats>(
9593            (),
9594            0x470e2684ca1ca19e,
9595            fidl::encoding::DynamicFlags::empty(),
9596            _decode,
9597        )
9598    }
9599
9600    type GetCpuLoadResponseFut =
9601        fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>;
9602    fn r#get_cpu_load(&self, mut duration: i64) -> Self::GetCpuLoadResponseFut {
9603        fn _decode(
9604            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9605        ) -> Result<Vec<f32>, fidl::Error> {
9606            let _response = fidl::client::decode_transaction_body::<
9607                StatsGetCpuLoadResponse,
9608                fidl::encoding::DefaultFuchsiaResourceDialect,
9609                0x4c8f0f05e7034666,
9610            >(_buf?)?;
9611            Ok(_response.per_cpu_load)
9612        }
9613        self.client.send_query_and_decode::<StatsGetCpuLoadRequest, Vec<f32>>(
9614            (duration,),
9615            0x4c8f0f05e7034666,
9616            fidl::encoding::DynamicFlags::empty(),
9617            _decode,
9618        )
9619    }
9620}
9621
9622pub struct StatsEventStream {
9623    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9624}
9625
9626impl std::marker::Unpin for StatsEventStream {}
9627
9628impl futures::stream::FusedStream for StatsEventStream {
9629    fn is_terminated(&self) -> bool {
9630        self.event_receiver.is_terminated()
9631    }
9632}
9633
9634impl futures::Stream for StatsEventStream {
9635    type Item = Result<StatsEvent, fidl::Error>;
9636
9637    fn poll_next(
9638        mut self: std::pin::Pin<&mut Self>,
9639        cx: &mut std::task::Context<'_>,
9640    ) -> std::task::Poll<Option<Self::Item>> {
9641        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9642            &mut self.event_receiver,
9643            cx
9644        )?) {
9645            Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
9646            None => std::task::Poll::Ready(None),
9647        }
9648    }
9649}
9650
9651#[derive(Debug)]
9652pub enum StatsEvent {}
9653
9654impl StatsEvent {
9655    /// Decodes a message buffer as a [`StatsEvent`].
9656    fn decode(
9657        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9658    ) -> Result<StatsEvent, fidl::Error> {
9659        let (bytes, _handles) = buf.split_mut();
9660        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9661        debug_assert_eq!(tx_header.tx_id, 0);
9662        match tx_header.ordinal {
9663            _ => Err(fidl::Error::UnknownOrdinal {
9664                ordinal: tx_header.ordinal,
9665                protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9666            }),
9667        }
9668    }
9669}
9670
9671/// A Stream of incoming requests for fuchsia.kernel/Stats.
9672pub struct StatsRequestStream {
9673    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9674    is_terminated: bool,
9675}
9676
9677impl std::marker::Unpin for StatsRequestStream {}
9678
9679impl futures::stream::FusedStream for StatsRequestStream {
9680    fn is_terminated(&self) -> bool {
9681        self.is_terminated
9682    }
9683}
9684
9685impl fidl::endpoints::RequestStream for StatsRequestStream {
9686    type Protocol = StatsMarker;
9687    type ControlHandle = StatsControlHandle;
9688
9689    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9690        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9691    }
9692
9693    fn control_handle(&self) -> Self::ControlHandle {
9694        StatsControlHandle { inner: self.inner.clone() }
9695    }
9696
9697    fn into_inner(
9698        self,
9699    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9700    {
9701        (self.inner, self.is_terminated)
9702    }
9703
9704    fn from_inner(
9705        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9706        is_terminated: bool,
9707    ) -> Self {
9708        Self { inner, is_terminated }
9709    }
9710}
9711
9712impl futures::Stream for StatsRequestStream {
9713    type Item = Result<StatsRequest, fidl::Error>;
9714
9715    fn poll_next(
9716        mut self: std::pin::Pin<&mut Self>,
9717        cx: &mut std::task::Context<'_>,
9718    ) -> std::task::Poll<Option<Self::Item>> {
9719        let this = &mut *self;
9720        if this.inner.check_shutdown(cx) {
9721            this.is_terminated = true;
9722            return std::task::Poll::Ready(None);
9723        }
9724        if this.is_terminated {
9725            panic!("polled StatsRequestStream after completion");
9726        }
9727        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9728            |bytes, handles| {
9729                match this.inner.channel().read_etc(cx, bytes, handles) {
9730                    std::task::Poll::Ready(Ok(())) => {}
9731                    std::task::Poll::Pending => return std::task::Poll::Pending,
9732                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9733                        this.is_terminated = true;
9734                        return std::task::Poll::Ready(None);
9735                    }
9736                    std::task::Poll::Ready(Err(e)) => {
9737                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9738                            e.into(),
9739                        ))));
9740                    }
9741                }
9742
9743                // A message has been received from the channel
9744                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9745
9746                std::task::Poll::Ready(Some(match header.ordinal {
9747                    0x686677932ae41074 => {
9748                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9749                        let mut req = fidl::new_empty!(
9750                            fidl::encoding::EmptyPayload,
9751                            fidl::encoding::DefaultFuchsiaResourceDialect
9752                        );
9753                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9754                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9755                        Ok(StatsRequest::GetMemoryStats {
9756                            responder: StatsGetMemoryStatsResponder {
9757                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9758                                tx_id: header.tx_id,
9759                            },
9760                        })
9761                    }
9762                    0x60faa0f8aa38c29f => {
9763                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9764                        let mut req = fidl::new_empty!(
9765                            fidl::encoding::EmptyPayload,
9766                            fidl::encoding::DefaultFuchsiaResourceDialect
9767                        );
9768                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9769                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9770                        Ok(StatsRequest::GetMemoryStatsExtended {
9771                            responder: StatsGetMemoryStatsExtendedResponder {
9772                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9773                                tx_id: header.tx_id,
9774                            },
9775                        })
9776                    }
9777                    0x544a09995befb531 => {
9778                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9779                        let mut req = fidl::new_empty!(
9780                            fidl::encoding::EmptyPayload,
9781                            fidl::encoding::DefaultFuchsiaResourceDialect
9782                        );
9783                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9784                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9785                        Ok(StatsRequest::GetMemoryStatsCompression {
9786                            responder: StatsGetMemoryStatsCompressionResponder {
9787                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9788                                tx_id: header.tx_id,
9789                            },
9790                        })
9791                    }
9792                    0x470e2684ca1ca19e => {
9793                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9794                        let mut req = fidl::new_empty!(
9795                            fidl::encoding::EmptyPayload,
9796                            fidl::encoding::DefaultFuchsiaResourceDialect
9797                        );
9798                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9799                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9800                        Ok(StatsRequest::GetCpuStats {
9801                            responder: StatsGetCpuStatsResponder {
9802                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9803                                tx_id: header.tx_id,
9804                            },
9805                        })
9806                    }
9807                    0x4c8f0f05e7034666 => {
9808                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9809                        let mut req = fidl::new_empty!(
9810                            StatsGetCpuLoadRequest,
9811                            fidl::encoding::DefaultFuchsiaResourceDialect
9812                        );
9813                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatsGetCpuLoadRequest>(&header, _body_bytes, handles, &mut req)?;
9814                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9815                        Ok(StatsRequest::GetCpuLoad {
9816                            duration: req.duration,
9817
9818                            responder: StatsGetCpuLoadResponder {
9819                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9820                                tx_id: header.tx_id,
9821                            },
9822                        })
9823                    }
9824                    _ => Err(fidl::Error::UnknownOrdinal {
9825                        ordinal: header.ordinal,
9826                        protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9827                    }),
9828                }))
9829            },
9830        )
9831    }
9832}
9833
9834/// Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
9835/// the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
9836/// 'Root Resource' capability to obtain. Instead of vending out that capability, programs that
9837/// just want stats should use this service instead. If for some reason the protocol fails to
9838/// retrieve stats, which will be an un-recoverable error, it will close the channel.
9839#[derive(Debug)]
9840pub enum StatsRequest {
9841    GetMemoryStats {
9842        responder: StatsGetMemoryStatsResponder,
9843    },
9844    GetMemoryStatsExtended {
9845        responder: StatsGetMemoryStatsExtendedResponder,
9846    },
9847    GetMemoryStatsCompression {
9848        responder: StatsGetMemoryStatsCompressionResponder,
9849    },
9850    GetCpuStats {
9851        responder: StatsGetCpuStatsResponder,
9852    },
9853    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9854    /// duration.
9855    ///
9856    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9857    /// PerCpuStats) over a time duration.
9858    GetCpuLoad {
9859        duration: i64,
9860        responder: StatsGetCpuLoadResponder,
9861    },
9862}
9863
9864impl StatsRequest {
9865    #[allow(irrefutable_let_patterns)]
9866    pub fn into_get_memory_stats(self) -> Option<(StatsGetMemoryStatsResponder)> {
9867        if let StatsRequest::GetMemoryStats { responder } = self { Some((responder)) } else { None }
9868    }
9869
9870    #[allow(irrefutable_let_patterns)]
9871    pub fn into_get_memory_stats_extended(self) -> Option<(StatsGetMemoryStatsExtendedResponder)> {
9872        if let StatsRequest::GetMemoryStatsExtended { responder } = self {
9873            Some((responder))
9874        } else {
9875            None
9876        }
9877    }
9878
9879    #[allow(irrefutable_let_patterns)]
9880    pub fn into_get_memory_stats_compression(
9881        self,
9882    ) -> Option<(StatsGetMemoryStatsCompressionResponder)> {
9883        if let StatsRequest::GetMemoryStatsCompression { responder } = self {
9884            Some((responder))
9885        } else {
9886            None
9887        }
9888    }
9889
9890    #[allow(irrefutable_let_patterns)]
9891    pub fn into_get_cpu_stats(self) -> Option<(StatsGetCpuStatsResponder)> {
9892        if let StatsRequest::GetCpuStats { responder } = self { Some((responder)) } else { None }
9893    }
9894
9895    #[allow(irrefutable_let_patterns)]
9896    pub fn into_get_cpu_load(self) -> Option<(i64, StatsGetCpuLoadResponder)> {
9897        if let StatsRequest::GetCpuLoad { duration, responder } = self {
9898            Some((duration, responder))
9899        } else {
9900            None
9901        }
9902    }
9903
9904    /// Name of the method defined in FIDL
9905    pub fn method_name(&self) -> &'static str {
9906        match *self {
9907            StatsRequest::GetMemoryStats { .. } => "get_memory_stats",
9908            StatsRequest::GetMemoryStatsExtended { .. } => "get_memory_stats_extended",
9909            StatsRequest::GetMemoryStatsCompression { .. } => "get_memory_stats_compression",
9910            StatsRequest::GetCpuStats { .. } => "get_cpu_stats",
9911            StatsRequest::GetCpuLoad { .. } => "get_cpu_load",
9912        }
9913    }
9914}
9915
9916#[derive(Debug, Clone)]
9917pub struct StatsControlHandle {
9918    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9919}
9920
9921impl fidl::endpoints::ControlHandle for StatsControlHandle {
9922    fn shutdown(&self) {
9923        self.inner.shutdown()
9924    }
9925    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9926        self.inner.shutdown_with_epitaph(status)
9927    }
9928
9929    fn is_closed(&self) -> bool {
9930        self.inner.channel().is_closed()
9931    }
9932    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9933        self.inner.channel().on_closed()
9934    }
9935
9936    #[cfg(target_os = "fuchsia")]
9937    fn signal_peer(
9938        &self,
9939        clear_mask: zx::Signals,
9940        set_mask: zx::Signals,
9941    ) -> Result<(), zx_status::Status> {
9942        use fidl::Peered;
9943        self.inner.channel().signal_peer(clear_mask, set_mask)
9944    }
9945}
9946
9947impl StatsControlHandle {}
9948
9949#[must_use = "FIDL methods require a response to be sent"]
9950#[derive(Debug)]
9951pub struct StatsGetMemoryStatsResponder {
9952    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
9953    tx_id: u32,
9954}
9955
9956/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
9957/// if the responder is dropped without sending a response, so that the client
9958/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9959impl std::ops::Drop for StatsGetMemoryStatsResponder {
9960    fn drop(&mut self) {
9961        self.control_handle.shutdown();
9962        // Safety: drops once, never accessed again
9963        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9964    }
9965}
9966
9967impl fidl::endpoints::Responder for StatsGetMemoryStatsResponder {
9968    type ControlHandle = StatsControlHandle;
9969
9970    fn control_handle(&self) -> &StatsControlHandle {
9971        &self.control_handle
9972    }
9973
9974    fn drop_without_shutdown(mut self) {
9975        // Safety: drops once, never accessed again due to mem::forget
9976        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9977        // Prevent Drop from running (which would shut down the channel)
9978        std::mem::forget(self);
9979    }
9980}
9981
9982impl StatsGetMemoryStatsResponder {
9983    /// Sends a response to the FIDL transaction.
9984    ///
9985    /// Sets the channel to shutdown if an error occurs.
9986    pub fn send(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
9987        let _result = self.send_raw(stats);
9988        if _result.is_err() {
9989            self.control_handle.shutdown();
9990        }
9991        self.drop_without_shutdown();
9992        _result
9993    }
9994
9995    /// Similar to "send" but does not shutdown the channel if an error occurs.
9996    pub fn send_no_shutdown_on_err(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
9997        let _result = self.send_raw(stats);
9998        self.drop_without_shutdown();
9999        _result
10000    }
10001
10002    fn send_raw(&self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10003        self.control_handle.inner.send::<StatsGetMemoryStatsResponse>(
10004            (stats,),
10005            self.tx_id,
10006            0x686677932ae41074,
10007            fidl::encoding::DynamicFlags::empty(),
10008        )
10009    }
10010}
10011
10012#[must_use = "FIDL methods require a response to be sent"]
10013#[derive(Debug)]
10014pub struct StatsGetMemoryStatsExtendedResponder {
10015    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10016    tx_id: u32,
10017}
10018
10019/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10020/// if the responder is dropped without sending a response, so that the client
10021/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10022impl std::ops::Drop for StatsGetMemoryStatsExtendedResponder {
10023    fn drop(&mut self) {
10024        self.control_handle.shutdown();
10025        // Safety: drops once, never accessed again
10026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10027    }
10028}
10029
10030impl fidl::endpoints::Responder for StatsGetMemoryStatsExtendedResponder {
10031    type ControlHandle = StatsControlHandle;
10032
10033    fn control_handle(&self) -> &StatsControlHandle {
10034        &self.control_handle
10035    }
10036
10037    fn drop_without_shutdown(mut self) {
10038        // Safety: drops once, never accessed again due to mem::forget
10039        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10040        // Prevent Drop from running (which would shut down the channel)
10041        std::mem::forget(self);
10042    }
10043}
10044
10045impl StatsGetMemoryStatsExtendedResponder {
10046    /// Sends a response to the FIDL transaction.
10047    ///
10048    /// Sets the channel to shutdown if an error occurs.
10049    pub fn send(self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10050        let _result = self.send_raw(stats);
10051        if _result.is_err() {
10052            self.control_handle.shutdown();
10053        }
10054        self.drop_without_shutdown();
10055        _result
10056    }
10057
10058    /// Similar to "send" but does not shutdown the channel if an error occurs.
10059    pub fn send_no_shutdown_on_err(
10060        self,
10061        mut stats: &MemoryStatsExtended,
10062    ) -> Result<(), fidl::Error> {
10063        let _result = self.send_raw(stats);
10064        self.drop_without_shutdown();
10065        _result
10066    }
10067
10068    fn send_raw(&self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10069        self.control_handle.inner.send::<StatsGetMemoryStatsExtendedResponse>(
10070            (stats,),
10071            self.tx_id,
10072            0x60faa0f8aa38c29f,
10073            fidl::encoding::DynamicFlags::empty(),
10074        )
10075    }
10076}
10077
10078#[must_use = "FIDL methods require a response to be sent"]
10079#[derive(Debug)]
10080pub struct StatsGetMemoryStatsCompressionResponder {
10081    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10082    tx_id: u32,
10083}
10084
10085/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10086/// if the responder is dropped without sending a response, so that the client
10087/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10088impl std::ops::Drop for StatsGetMemoryStatsCompressionResponder {
10089    fn drop(&mut self) {
10090        self.control_handle.shutdown();
10091        // Safety: drops once, never accessed again
10092        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10093    }
10094}
10095
10096impl fidl::endpoints::Responder for StatsGetMemoryStatsCompressionResponder {
10097    type ControlHandle = StatsControlHandle;
10098
10099    fn control_handle(&self) -> &StatsControlHandle {
10100        &self.control_handle
10101    }
10102
10103    fn drop_without_shutdown(mut self) {
10104        // Safety: drops once, never accessed again due to mem::forget
10105        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10106        // Prevent Drop from running (which would shut down the channel)
10107        std::mem::forget(self);
10108    }
10109}
10110
10111impl StatsGetMemoryStatsCompressionResponder {
10112    /// Sends a response to the FIDL transaction.
10113    ///
10114    /// Sets the channel to shutdown if an error occurs.
10115    pub fn send(self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10116        let _result = self.send_raw(payload);
10117        if _result.is_err() {
10118            self.control_handle.shutdown();
10119        }
10120        self.drop_without_shutdown();
10121        _result
10122    }
10123
10124    /// Similar to "send" but does not shutdown the channel if an error occurs.
10125    pub fn send_no_shutdown_on_err(
10126        self,
10127        mut payload: &MemoryStatsCompression,
10128    ) -> Result<(), fidl::Error> {
10129        let _result = self.send_raw(payload);
10130        self.drop_without_shutdown();
10131        _result
10132    }
10133
10134    fn send_raw(&self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10135        self.control_handle.inner.send::<MemoryStatsCompression>(
10136            payload,
10137            self.tx_id,
10138            0x544a09995befb531,
10139            fidl::encoding::DynamicFlags::empty(),
10140        )
10141    }
10142}
10143
10144#[must_use = "FIDL methods require a response to be sent"]
10145#[derive(Debug)]
10146pub struct StatsGetCpuStatsResponder {
10147    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10148    tx_id: u32,
10149}
10150
10151/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10152/// if the responder is dropped without sending a response, so that the client
10153/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10154impl std::ops::Drop for StatsGetCpuStatsResponder {
10155    fn drop(&mut self) {
10156        self.control_handle.shutdown();
10157        // Safety: drops once, never accessed again
10158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10159    }
10160}
10161
10162impl fidl::endpoints::Responder for StatsGetCpuStatsResponder {
10163    type ControlHandle = StatsControlHandle;
10164
10165    fn control_handle(&self) -> &StatsControlHandle {
10166        &self.control_handle
10167    }
10168
10169    fn drop_without_shutdown(mut self) {
10170        // Safety: drops once, never accessed again due to mem::forget
10171        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10172        // Prevent Drop from running (which would shut down the channel)
10173        std::mem::forget(self);
10174    }
10175}
10176
10177impl StatsGetCpuStatsResponder {
10178    /// Sends a response to the FIDL transaction.
10179    ///
10180    /// Sets the channel to shutdown if an error occurs.
10181    pub fn send(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10182        let _result = self.send_raw(stats);
10183        if _result.is_err() {
10184            self.control_handle.shutdown();
10185        }
10186        self.drop_without_shutdown();
10187        _result
10188    }
10189
10190    /// Similar to "send" but does not shutdown the channel if an error occurs.
10191    pub fn send_no_shutdown_on_err(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10192        let _result = self.send_raw(stats);
10193        self.drop_without_shutdown();
10194        _result
10195    }
10196
10197    fn send_raw(&self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10198        self.control_handle.inner.send::<StatsGetCpuStatsResponse>(
10199            (stats,),
10200            self.tx_id,
10201            0x470e2684ca1ca19e,
10202            fidl::encoding::DynamicFlags::empty(),
10203        )
10204    }
10205}
10206
10207#[must_use = "FIDL methods require a response to be sent"]
10208#[derive(Debug)]
10209pub struct StatsGetCpuLoadResponder {
10210    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10211    tx_id: u32,
10212}
10213
10214/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10215/// if the responder is dropped without sending a response, so that the client
10216/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10217impl std::ops::Drop for StatsGetCpuLoadResponder {
10218    fn drop(&mut self) {
10219        self.control_handle.shutdown();
10220        // Safety: drops once, never accessed again
10221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10222    }
10223}
10224
10225impl fidl::endpoints::Responder for StatsGetCpuLoadResponder {
10226    type ControlHandle = StatsControlHandle;
10227
10228    fn control_handle(&self) -> &StatsControlHandle {
10229        &self.control_handle
10230    }
10231
10232    fn drop_without_shutdown(mut self) {
10233        // Safety: drops once, never accessed again due to mem::forget
10234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10235        // Prevent Drop from running (which would shut down the channel)
10236        std::mem::forget(self);
10237    }
10238}
10239
10240impl StatsGetCpuLoadResponder {
10241    /// Sends a response to the FIDL transaction.
10242    ///
10243    /// Sets the channel to shutdown if an error occurs.
10244    pub fn send(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10245        let _result = self.send_raw(per_cpu_load);
10246        if _result.is_err() {
10247            self.control_handle.shutdown();
10248        }
10249        self.drop_without_shutdown();
10250        _result
10251    }
10252
10253    /// Similar to "send" but does not shutdown the channel if an error occurs.
10254    pub fn send_no_shutdown_on_err(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10255        let _result = self.send_raw(per_cpu_load);
10256        self.drop_without_shutdown();
10257        _result
10258    }
10259
10260    fn send_raw(&self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10261        self.control_handle.inner.send::<StatsGetCpuLoadResponse>(
10262            (per_cpu_load,),
10263            self.tx_id,
10264            0x4c8f0f05e7034666,
10265            fidl::encoding::DynamicFlags::empty(),
10266        )
10267    }
10268}
10269
10270#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10271pub struct TracingResourceMarker;
10272
10273impl fidl::endpoints::ProtocolMarker for TracingResourceMarker {
10274    type Proxy = TracingResourceProxy;
10275    type RequestStream = TracingResourceRequestStream;
10276    #[cfg(target_os = "fuchsia")]
10277    type SynchronousProxy = TracingResourceSynchronousProxy;
10278
10279    const DEBUG_NAME: &'static str = "fuchsia.kernel.TracingResource";
10280}
10281impl fidl::endpoints::DiscoverableProtocolMarker for TracingResourceMarker {}
10282
10283pub trait TracingResourceProxyInterface: Send + Sync {
10284    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10285    fn r#get(&self) -> Self::GetResponseFut;
10286}
10287#[derive(Debug)]
10288#[cfg(target_os = "fuchsia")]
10289pub struct TracingResourceSynchronousProxy {
10290    client: fidl::client::sync::Client,
10291}
10292
10293#[cfg(target_os = "fuchsia")]
10294impl fidl::endpoints::SynchronousProxy for TracingResourceSynchronousProxy {
10295    type Proxy = TracingResourceProxy;
10296    type Protocol = TracingResourceMarker;
10297
10298    fn from_channel(inner: fidl::Channel) -> Self {
10299        Self::new(inner)
10300    }
10301
10302    fn into_channel(self) -> fidl::Channel {
10303        self.client.into_channel()
10304    }
10305
10306    fn as_channel(&self) -> &fidl::Channel {
10307        self.client.as_channel()
10308    }
10309}
10310
10311#[cfg(target_os = "fuchsia")]
10312impl TracingResourceSynchronousProxy {
10313    pub fn new(channel: fidl::Channel) -> Self {
10314        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10315        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10316    }
10317
10318    pub fn into_channel(self) -> fidl::Channel {
10319        self.client.into_channel()
10320    }
10321
10322    /// Waits until an event arrives and returns it. It is safe for other
10323    /// threads to make concurrent requests while waiting for an event.
10324    pub fn wait_for_event(
10325        &self,
10326        deadline: zx::MonotonicInstant,
10327    ) -> Result<TracingResourceEvent, fidl::Error> {
10328        TracingResourceEvent::decode(self.client.wait_for_event(deadline)?)
10329    }
10330
10331    /// Get a tracing resource handle.
10332    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10333        let _response =
10334            self.client.send_query::<fidl::encoding::EmptyPayload, TracingResourceGetResponse>(
10335                (),
10336                0x299bc179aa54c6aa,
10337                fidl::encoding::DynamicFlags::empty(),
10338                ___deadline,
10339            )?;
10340        Ok(_response.resource)
10341    }
10342}
10343
10344#[cfg(target_os = "fuchsia")]
10345impl From<TracingResourceSynchronousProxy> for zx::Handle {
10346    fn from(value: TracingResourceSynchronousProxy) -> Self {
10347        value.into_channel().into()
10348    }
10349}
10350
10351#[cfg(target_os = "fuchsia")]
10352impl From<fidl::Channel> for TracingResourceSynchronousProxy {
10353    fn from(value: fidl::Channel) -> Self {
10354        Self::new(value)
10355    }
10356}
10357
10358#[cfg(target_os = "fuchsia")]
10359impl fidl::endpoints::FromClient for TracingResourceSynchronousProxy {
10360    type Protocol = TracingResourceMarker;
10361
10362    fn from_client(value: fidl::endpoints::ClientEnd<TracingResourceMarker>) -> Self {
10363        Self::new(value.into_channel())
10364    }
10365}
10366
10367#[derive(Debug, Clone)]
10368pub struct TracingResourceProxy {
10369    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10370}
10371
10372impl fidl::endpoints::Proxy for TracingResourceProxy {
10373    type Protocol = TracingResourceMarker;
10374
10375    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10376        Self::new(inner)
10377    }
10378
10379    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10380        self.client.into_channel().map_err(|client| Self { client })
10381    }
10382
10383    fn as_channel(&self) -> &::fidl::AsyncChannel {
10384        self.client.as_channel()
10385    }
10386}
10387
10388impl TracingResourceProxy {
10389    /// Create a new Proxy for fuchsia.kernel/TracingResource.
10390    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10391        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10392        Self { client: fidl::client::Client::new(channel, protocol_name) }
10393    }
10394
10395    /// Get a Stream of events from the remote end of the protocol.
10396    ///
10397    /// # Panics
10398    ///
10399    /// Panics if the event stream was already taken.
10400    pub fn take_event_stream(&self) -> TracingResourceEventStream {
10401        TracingResourceEventStream { event_receiver: self.client.take_event_receiver() }
10402    }
10403
10404    /// Get a tracing resource handle.
10405    pub fn r#get(
10406        &self,
10407    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10408    {
10409        TracingResourceProxyInterface::r#get(self)
10410    }
10411}
10412
10413impl TracingResourceProxyInterface for TracingResourceProxy {
10414    type GetResponseFut = fidl::client::QueryResponseFut<
10415        fidl::Resource,
10416        fidl::encoding::DefaultFuchsiaResourceDialect,
10417    >;
10418    fn r#get(&self) -> Self::GetResponseFut {
10419        fn _decode(
10420            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10421        ) -> Result<fidl::Resource, fidl::Error> {
10422            let _response = fidl::client::decode_transaction_body::<
10423                TracingResourceGetResponse,
10424                fidl::encoding::DefaultFuchsiaResourceDialect,
10425                0x299bc179aa54c6aa,
10426            >(_buf?)?;
10427            Ok(_response.resource)
10428        }
10429        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10430            (),
10431            0x299bc179aa54c6aa,
10432            fidl::encoding::DynamicFlags::empty(),
10433            _decode,
10434        )
10435    }
10436}
10437
10438pub struct TracingResourceEventStream {
10439    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10440}
10441
10442impl std::marker::Unpin for TracingResourceEventStream {}
10443
10444impl futures::stream::FusedStream for TracingResourceEventStream {
10445    fn is_terminated(&self) -> bool {
10446        self.event_receiver.is_terminated()
10447    }
10448}
10449
10450impl futures::Stream for TracingResourceEventStream {
10451    type Item = Result<TracingResourceEvent, fidl::Error>;
10452
10453    fn poll_next(
10454        mut self: std::pin::Pin<&mut Self>,
10455        cx: &mut std::task::Context<'_>,
10456    ) -> std::task::Poll<Option<Self::Item>> {
10457        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10458            &mut self.event_receiver,
10459            cx
10460        )?) {
10461            Some(buf) => std::task::Poll::Ready(Some(TracingResourceEvent::decode(buf))),
10462            None => std::task::Poll::Ready(None),
10463        }
10464    }
10465}
10466
10467#[derive(Debug)]
10468pub enum TracingResourceEvent {}
10469
10470impl TracingResourceEvent {
10471    /// Decodes a message buffer as a [`TracingResourceEvent`].
10472    fn decode(
10473        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10474    ) -> Result<TracingResourceEvent, fidl::Error> {
10475        let (bytes, _handles) = buf.split_mut();
10476        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10477        debug_assert_eq!(tx_header.tx_id, 0);
10478        match tx_header.ordinal {
10479            _ => Err(fidl::Error::UnknownOrdinal {
10480                ordinal: tx_header.ordinal,
10481                protocol_name:
10482                    <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10483            }),
10484        }
10485    }
10486}
10487
10488/// A Stream of incoming requests for fuchsia.kernel/TracingResource.
10489pub struct TracingResourceRequestStream {
10490    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10491    is_terminated: bool,
10492}
10493
10494impl std::marker::Unpin for TracingResourceRequestStream {}
10495
10496impl futures::stream::FusedStream for TracingResourceRequestStream {
10497    fn is_terminated(&self) -> bool {
10498        self.is_terminated
10499    }
10500}
10501
10502impl fidl::endpoints::RequestStream for TracingResourceRequestStream {
10503    type Protocol = TracingResourceMarker;
10504    type ControlHandle = TracingResourceControlHandle;
10505
10506    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10507        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10508    }
10509
10510    fn control_handle(&self) -> Self::ControlHandle {
10511        TracingResourceControlHandle { inner: self.inner.clone() }
10512    }
10513
10514    fn into_inner(
10515        self,
10516    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10517    {
10518        (self.inner, self.is_terminated)
10519    }
10520
10521    fn from_inner(
10522        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10523        is_terminated: bool,
10524    ) -> Self {
10525        Self { inner, is_terminated }
10526    }
10527}
10528
10529impl futures::Stream for TracingResourceRequestStream {
10530    type Item = Result<TracingResourceRequest, fidl::Error>;
10531
10532    fn poll_next(
10533        mut self: std::pin::Pin<&mut Self>,
10534        cx: &mut std::task::Context<'_>,
10535    ) -> std::task::Poll<Option<Self::Item>> {
10536        let this = &mut *self;
10537        if this.inner.check_shutdown(cx) {
10538            this.is_terminated = true;
10539            return std::task::Poll::Ready(None);
10540        }
10541        if this.is_terminated {
10542            panic!("polled TracingResourceRequestStream after completion");
10543        }
10544        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10545            |bytes, handles| {
10546                match this.inner.channel().read_etc(cx, bytes, handles) {
10547                    std::task::Poll::Ready(Ok(())) => {}
10548                    std::task::Poll::Pending => return std::task::Poll::Pending,
10549                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10550                        this.is_terminated = true;
10551                        return std::task::Poll::Ready(None);
10552                    }
10553                    std::task::Poll::Ready(Err(e)) => {
10554                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10555                            e.into(),
10556                        ))));
10557                    }
10558                }
10559
10560                // A message has been received from the channel
10561                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10562
10563                std::task::Poll::Ready(Some(match header.ordinal {
10564                    0x299bc179aa54c6aa => {
10565                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10566                        let mut req = fidl::new_empty!(
10567                            fidl::encoding::EmptyPayload,
10568                            fidl::encoding::DefaultFuchsiaResourceDialect
10569                        );
10570                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10571                        let control_handle =
10572                            TracingResourceControlHandle { inner: this.inner.clone() };
10573                        Ok(TracingResourceRequest::Get {
10574                            responder: TracingResourceGetResponder {
10575                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10576                                tx_id: header.tx_id,
10577                            },
10578                        })
10579                    }
10580                    _ => Err(fidl::Error::UnknownOrdinal {
10581                        ordinal: header.ordinal,
10582                        protocol_name:
10583                            <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10584                    }),
10585                }))
10586            },
10587        )
10588    }
10589}
10590
10591/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
10592/// `ZX_RSRC_SYSTEM_TRACING_BASE`.
10593#[derive(Debug)]
10594pub enum TracingResourceRequest {
10595    /// Get a tracing resource handle.
10596    Get { responder: TracingResourceGetResponder },
10597}
10598
10599impl TracingResourceRequest {
10600    #[allow(irrefutable_let_patterns)]
10601    pub fn into_get(self) -> Option<(TracingResourceGetResponder)> {
10602        if let TracingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
10603    }
10604
10605    /// Name of the method defined in FIDL
10606    pub fn method_name(&self) -> &'static str {
10607        match *self {
10608            TracingResourceRequest::Get { .. } => "get",
10609        }
10610    }
10611}
10612
10613#[derive(Debug, Clone)]
10614pub struct TracingResourceControlHandle {
10615    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10616}
10617
10618impl fidl::endpoints::ControlHandle for TracingResourceControlHandle {
10619    fn shutdown(&self) {
10620        self.inner.shutdown()
10621    }
10622    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10623        self.inner.shutdown_with_epitaph(status)
10624    }
10625
10626    fn is_closed(&self) -> bool {
10627        self.inner.channel().is_closed()
10628    }
10629    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10630        self.inner.channel().on_closed()
10631    }
10632
10633    #[cfg(target_os = "fuchsia")]
10634    fn signal_peer(
10635        &self,
10636        clear_mask: zx::Signals,
10637        set_mask: zx::Signals,
10638    ) -> Result<(), zx_status::Status> {
10639        use fidl::Peered;
10640        self.inner.channel().signal_peer(clear_mask, set_mask)
10641    }
10642}
10643
10644impl TracingResourceControlHandle {}
10645
10646#[must_use = "FIDL methods require a response to be sent"]
10647#[derive(Debug)]
10648pub struct TracingResourceGetResponder {
10649    control_handle: std::mem::ManuallyDrop<TracingResourceControlHandle>,
10650    tx_id: u32,
10651}
10652
10653/// Set the the channel to be shutdown (see [`TracingResourceControlHandle::shutdown`])
10654/// if the responder is dropped without sending a response, so that the client
10655/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10656impl std::ops::Drop for TracingResourceGetResponder {
10657    fn drop(&mut self) {
10658        self.control_handle.shutdown();
10659        // Safety: drops once, never accessed again
10660        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10661    }
10662}
10663
10664impl fidl::endpoints::Responder for TracingResourceGetResponder {
10665    type ControlHandle = TracingResourceControlHandle;
10666
10667    fn control_handle(&self) -> &TracingResourceControlHandle {
10668        &self.control_handle
10669    }
10670
10671    fn drop_without_shutdown(mut self) {
10672        // Safety: drops once, never accessed again due to mem::forget
10673        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10674        // Prevent Drop from running (which would shut down the channel)
10675        std::mem::forget(self);
10676    }
10677}
10678
10679impl TracingResourceGetResponder {
10680    /// Sends a response to the FIDL transaction.
10681    ///
10682    /// Sets the channel to shutdown if an error occurs.
10683    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10684        let _result = self.send_raw(resource);
10685        if _result.is_err() {
10686            self.control_handle.shutdown();
10687        }
10688        self.drop_without_shutdown();
10689        _result
10690    }
10691
10692    /// Similar to "send" but does not shutdown the channel if an error occurs.
10693    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10694        let _result = self.send_raw(resource);
10695        self.drop_without_shutdown();
10696        _result
10697    }
10698
10699    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10700        self.control_handle.inner.send::<TracingResourceGetResponse>(
10701            (resource,),
10702            self.tx_id,
10703            0x299bc179aa54c6aa,
10704            fidl::encoding::DynamicFlags::empty(),
10705        )
10706    }
10707}
10708
10709#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10710pub struct VmexResourceMarker;
10711
10712impl fidl::endpoints::ProtocolMarker for VmexResourceMarker {
10713    type Proxy = VmexResourceProxy;
10714    type RequestStream = VmexResourceRequestStream;
10715    #[cfg(target_os = "fuchsia")]
10716    type SynchronousProxy = VmexResourceSynchronousProxy;
10717
10718    const DEBUG_NAME: &'static str = "fuchsia.kernel.VmexResource";
10719}
10720impl fidl::endpoints::DiscoverableProtocolMarker for VmexResourceMarker {}
10721
10722pub trait VmexResourceProxyInterface: Send + Sync {
10723    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10724    fn r#get(&self) -> Self::GetResponseFut;
10725}
10726#[derive(Debug)]
10727#[cfg(target_os = "fuchsia")]
10728pub struct VmexResourceSynchronousProxy {
10729    client: fidl::client::sync::Client,
10730}
10731
10732#[cfg(target_os = "fuchsia")]
10733impl fidl::endpoints::SynchronousProxy for VmexResourceSynchronousProxy {
10734    type Proxy = VmexResourceProxy;
10735    type Protocol = VmexResourceMarker;
10736
10737    fn from_channel(inner: fidl::Channel) -> Self {
10738        Self::new(inner)
10739    }
10740
10741    fn into_channel(self) -> fidl::Channel {
10742        self.client.into_channel()
10743    }
10744
10745    fn as_channel(&self) -> &fidl::Channel {
10746        self.client.as_channel()
10747    }
10748}
10749
10750#[cfg(target_os = "fuchsia")]
10751impl VmexResourceSynchronousProxy {
10752    pub fn new(channel: fidl::Channel) -> Self {
10753        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10754        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10755    }
10756
10757    pub fn into_channel(self) -> fidl::Channel {
10758        self.client.into_channel()
10759    }
10760
10761    /// Waits until an event arrives and returns it. It is safe for other
10762    /// threads to make concurrent requests while waiting for an event.
10763    pub fn wait_for_event(
10764        &self,
10765        deadline: zx::MonotonicInstant,
10766    ) -> Result<VmexResourceEvent, fidl::Error> {
10767        VmexResourceEvent::decode(self.client.wait_for_event(deadline)?)
10768    }
10769
10770    /// Get a VMEX resource handle.
10771    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10772        let _response =
10773            self.client.send_query::<fidl::encoding::EmptyPayload, VmexResourceGetResponse>(
10774                (),
10775                0x33db32deed650699,
10776                fidl::encoding::DynamicFlags::empty(),
10777                ___deadline,
10778            )?;
10779        Ok(_response.resource)
10780    }
10781}
10782
10783#[cfg(target_os = "fuchsia")]
10784impl From<VmexResourceSynchronousProxy> for zx::Handle {
10785    fn from(value: VmexResourceSynchronousProxy) -> Self {
10786        value.into_channel().into()
10787    }
10788}
10789
10790#[cfg(target_os = "fuchsia")]
10791impl From<fidl::Channel> for VmexResourceSynchronousProxy {
10792    fn from(value: fidl::Channel) -> Self {
10793        Self::new(value)
10794    }
10795}
10796
10797#[cfg(target_os = "fuchsia")]
10798impl fidl::endpoints::FromClient for VmexResourceSynchronousProxy {
10799    type Protocol = VmexResourceMarker;
10800
10801    fn from_client(value: fidl::endpoints::ClientEnd<VmexResourceMarker>) -> Self {
10802        Self::new(value.into_channel())
10803    }
10804}
10805
10806#[derive(Debug, Clone)]
10807pub struct VmexResourceProxy {
10808    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10809}
10810
10811impl fidl::endpoints::Proxy for VmexResourceProxy {
10812    type Protocol = VmexResourceMarker;
10813
10814    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10815        Self::new(inner)
10816    }
10817
10818    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10819        self.client.into_channel().map_err(|client| Self { client })
10820    }
10821
10822    fn as_channel(&self) -> &::fidl::AsyncChannel {
10823        self.client.as_channel()
10824    }
10825}
10826
10827impl VmexResourceProxy {
10828    /// Create a new Proxy for fuchsia.kernel/VmexResource.
10829    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10830        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10831        Self { client: fidl::client::Client::new(channel, protocol_name) }
10832    }
10833
10834    /// Get a Stream of events from the remote end of the protocol.
10835    ///
10836    /// # Panics
10837    ///
10838    /// Panics if the event stream was already taken.
10839    pub fn take_event_stream(&self) -> VmexResourceEventStream {
10840        VmexResourceEventStream { event_receiver: self.client.take_event_receiver() }
10841    }
10842
10843    /// Get a VMEX resource handle.
10844    pub fn r#get(
10845        &self,
10846    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10847    {
10848        VmexResourceProxyInterface::r#get(self)
10849    }
10850}
10851
10852impl VmexResourceProxyInterface for VmexResourceProxy {
10853    type GetResponseFut = fidl::client::QueryResponseFut<
10854        fidl::Resource,
10855        fidl::encoding::DefaultFuchsiaResourceDialect,
10856    >;
10857    fn r#get(&self) -> Self::GetResponseFut {
10858        fn _decode(
10859            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10860        ) -> Result<fidl::Resource, fidl::Error> {
10861            let _response = fidl::client::decode_transaction_body::<
10862                VmexResourceGetResponse,
10863                fidl::encoding::DefaultFuchsiaResourceDialect,
10864                0x33db32deed650699,
10865            >(_buf?)?;
10866            Ok(_response.resource)
10867        }
10868        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10869            (),
10870            0x33db32deed650699,
10871            fidl::encoding::DynamicFlags::empty(),
10872            _decode,
10873        )
10874    }
10875}
10876
10877pub struct VmexResourceEventStream {
10878    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10879}
10880
10881impl std::marker::Unpin for VmexResourceEventStream {}
10882
10883impl futures::stream::FusedStream for VmexResourceEventStream {
10884    fn is_terminated(&self) -> bool {
10885        self.event_receiver.is_terminated()
10886    }
10887}
10888
10889impl futures::Stream for VmexResourceEventStream {
10890    type Item = Result<VmexResourceEvent, fidl::Error>;
10891
10892    fn poll_next(
10893        mut self: std::pin::Pin<&mut Self>,
10894        cx: &mut std::task::Context<'_>,
10895    ) -> std::task::Poll<Option<Self::Item>> {
10896        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10897            &mut self.event_receiver,
10898            cx
10899        )?) {
10900            Some(buf) => std::task::Poll::Ready(Some(VmexResourceEvent::decode(buf))),
10901            None => std::task::Poll::Ready(None),
10902        }
10903    }
10904}
10905
10906#[derive(Debug)]
10907pub enum VmexResourceEvent {}
10908
10909impl VmexResourceEvent {
10910    /// Decodes a message buffer as a [`VmexResourceEvent`].
10911    fn decode(
10912        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10913    ) -> Result<VmexResourceEvent, fidl::Error> {
10914        let (bytes, _handles) = buf.split_mut();
10915        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10916        debug_assert_eq!(tx_header.tx_id, 0);
10917        match tx_header.ordinal {
10918            _ => Err(fidl::Error::UnknownOrdinal {
10919                ordinal: tx_header.ordinal,
10920                protocol_name: <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10921            }),
10922        }
10923    }
10924}
10925
10926/// A Stream of incoming requests for fuchsia.kernel/VmexResource.
10927pub struct VmexResourceRequestStream {
10928    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10929    is_terminated: bool,
10930}
10931
10932impl std::marker::Unpin for VmexResourceRequestStream {}
10933
10934impl futures::stream::FusedStream for VmexResourceRequestStream {
10935    fn is_terminated(&self) -> bool {
10936        self.is_terminated
10937    }
10938}
10939
10940impl fidl::endpoints::RequestStream for VmexResourceRequestStream {
10941    type Protocol = VmexResourceMarker;
10942    type ControlHandle = VmexResourceControlHandle;
10943
10944    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10945        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10946    }
10947
10948    fn control_handle(&self) -> Self::ControlHandle {
10949        VmexResourceControlHandle { inner: self.inner.clone() }
10950    }
10951
10952    fn into_inner(
10953        self,
10954    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10955    {
10956        (self.inner, self.is_terminated)
10957    }
10958
10959    fn from_inner(
10960        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10961        is_terminated: bool,
10962    ) -> Self {
10963        Self { inner, is_terminated }
10964    }
10965}
10966
10967impl futures::Stream for VmexResourceRequestStream {
10968    type Item = Result<VmexResourceRequest, fidl::Error>;
10969
10970    fn poll_next(
10971        mut self: std::pin::Pin<&mut Self>,
10972        cx: &mut std::task::Context<'_>,
10973    ) -> std::task::Poll<Option<Self::Item>> {
10974        let this = &mut *self;
10975        if this.inner.check_shutdown(cx) {
10976            this.is_terminated = true;
10977            return std::task::Poll::Ready(None);
10978        }
10979        if this.is_terminated {
10980            panic!("polled VmexResourceRequestStream after completion");
10981        }
10982        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10983            |bytes, handles| {
10984                match this.inner.channel().read_etc(cx, bytes, handles) {
10985                    std::task::Poll::Ready(Ok(())) => {}
10986                    std::task::Poll::Pending => return std::task::Poll::Pending,
10987                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10988                        this.is_terminated = true;
10989                        return std::task::Poll::Ready(None);
10990                    }
10991                    std::task::Poll::Ready(Err(e)) => {
10992                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10993                            e.into(),
10994                        ))));
10995                    }
10996                }
10997
10998                // A message has been received from the channel
10999                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11000
11001                std::task::Poll::Ready(Some(match header.ordinal {
11002                    0x33db32deed650699 => {
11003                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11004                        let mut req = fidl::new_empty!(
11005                            fidl::encoding::EmptyPayload,
11006                            fidl::encoding::DefaultFuchsiaResourceDialect
11007                        );
11008                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11009                        let control_handle =
11010                            VmexResourceControlHandle { inner: this.inner.clone() };
11011                        Ok(VmexResourceRequest::Get {
11012                            responder: VmexResourceGetResponder {
11013                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11014                                tx_id: header.tx_id,
11015                            },
11016                        })
11017                    }
11018                    _ => Err(fidl::Error::UnknownOrdinal {
11019                        ordinal: header.ordinal,
11020                        protocol_name:
11021                            <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11022                    }),
11023                }))
11024            },
11025        )
11026    }
11027}
11028
11029/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11030/// `ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
11031/// executable.
11032#[derive(Debug)]
11033pub enum VmexResourceRequest {
11034    /// Get a VMEX resource handle.
11035    Get { responder: VmexResourceGetResponder },
11036}
11037
11038impl VmexResourceRequest {
11039    #[allow(irrefutable_let_patterns)]
11040    pub fn into_get(self) -> Option<(VmexResourceGetResponder)> {
11041        if let VmexResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11042    }
11043
11044    /// Name of the method defined in FIDL
11045    pub fn method_name(&self) -> &'static str {
11046        match *self {
11047            VmexResourceRequest::Get { .. } => "get",
11048        }
11049    }
11050}
11051
11052#[derive(Debug, Clone)]
11053pub struct VmexResourceControlHandle {
11054    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11055}
11056
11057impl fidl::endpoints::ControlHandle for VmexResourceControlHandle {
11058    fn shutdown(&self) {
11059        self.inner.shutdown()
11060    }
11061    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11062        self.inner.shutdown_with_epitaph(status)
11063    }
11064
11065    fn is_closed(&self) -> bool {
11066        self.inner.channel().is_closed()
11067    }
11068    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11069        self.inner.channel().on_closed()
11070    }
11071
11072    #[cfg(target_os = "fuchsia")]
11073    fn signal_peer(
11074        &self,
11075        clear_mask: zx::Signals,
11076        set_mask: zx::Signals,
11077    ) -> Result<(), zx_status::Status> {
11078        use fidl::Peered;
11079        self.inner.channel().signal_peer(clear_mask, set_mask)
11080    }
11081}
11082
11083impl VmexResourceControlHandle {}
11084
11085#[must_use = "FIDL methods require a response to be sent"]
11086#[derive(Debug)]
11087pub struct VmexResourceGetResponder {
11088    control_handle: std::mem::ManuallyDrop<VmexResourceControlHandle>,
11089    tx_id: u32,
11090}
11091
11092/// Set the the channel to be shutdown (see [`VmexResourceControlHandle::shutdown`])
11093/// if the responder is dropped without sending a response, so that the client
11094/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11095impl std::ops::Drop for VmexResourceGetResponder {
11096    fn drop(&mut self) {
11097        self.control_handle.shutdown();
11098        // Safety: drops once, never accessed again
11099        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11100    }
11101}
11102
11103impl fidl::endpoints::Responder for VmexResourceGetResponder {
11104    type ControlHandle = VmexResourceControlHandle;
11105
11106    fn control_handle(&self) -> &VmexResourceControlHandle {
11107        &self.control_handle
11108    }
11109
11110    fn drop_without_shutdown(mut self) {
11111        // Safety: drops once, never accessed again due to mem::forget
11112        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11113        // Prevent Drop from running (which would shut down the channel)
11114        std::mem::forget(self);
11115    }
11116}
11117
11118impl VmexResourceGetResponder {
11119    /// Sends a response to the FIDL transaction.
11120    ///
11121    /// Sets the channel to shutdown if an error occurs.
11122    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11123        let _result = self.send_raw(resource);
11124        if _result.is_err() {
11125            self.control_handle.shutdown();
11126        }
11127        self.drop_without_shutdown();
11128        _result
11129    }
11130
11131    /// Similar to "send" but does not shutdown the channel if an error occurs.
11132    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11133        let _result = self.send_raw(resource);
11134        self.drop_without_shutdown();
11135        _result
11136    }
11137
11138    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11139        self.control_handle.inner.send::<VmexResourceGetResponse>(
11140            (resource,),
11141            self.tx_id,
11142            0x33db32deed650699,
11143            fidl::encoding::DynamicFlags::empty(),
11144        )
11145    }
11146}
11147
11148mod internal {
11149    use super::*;
11150
11151    impl fidl::encoding::ResourceTypeMarker for CounterGetInspectVmoResponse {
11152        type Borrowed<'a> = &'a mut Self;
11153        fn take_or_borrow<'a>(
11154            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11155        ) -> Self::Borrowed<'a> {
11156            value
11157        }
11158    }
11159
11160    unsafe impl fidl::encoding::TypeMarker for CounterGetInspectVmoResponse {
11161        type Owned = Self;
11162
11163        #[inline(always)]
11164        fn inline_align(_context: fidl::encoding::Context) -> usize {
11165            8
11166        }
11167
11168        #[inline(always)]
11169        fn inline_size(_context: fidl::encoding::Context) -> usize {
11170            24
11171        }
11172    }
11173
11174    unsafe impl
11175        fidl::encoding::Encode<
11176            CounterGetInspectVmoResponse,
11177            fidl::encoding::DefaultFuchsiaResourceDialect,
11178        > for &mut CounterGetInspectVmoResponse
11179    {
11180        #[inline]
11181        unsafe fn encode(
11182            self,
11183            encoder: &mut fidl::encoding::Encoder<
11184                '_,
11185                fidl::encoding::DefaultFuchsiaResourceDialect,
11186            >,
11187            offset: usize,
11188            _depth: fidl::encoding::Depth,
11189        ) -> fidl::Result<()> {
11190            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11191            // Delegate to tuple encoding.
11192            fidl::encoding::Encode::<CounterGetInspectVmoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11193                (
11194                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
11195                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
11196                ),
11197                encoder, offset, _depth
11198            )
11199        }
11200    }
11201    unsafe impl<
11202        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11203        T1: fidl::encoding::Encode<
11204                fidl_fuchsia_mem::Buffer,
11205                fidl::encoding::DefaultFuchsiaResourceDialect,
11206            >,
11207    >
11208        fidl::encoding::Encode<
11209            CounterGetInspectVmoResponse,
11210            fidl::encoding::DefaultFuchsiaResourceDialect,
11211        > for (T0, T1)
11212    {
11213        #[inline]
11214        unsafe fn encode(
11215            self,
11216            encoder: &mut fidl::encoding::Encoder<
11217                '_,
11218                fidl::encoding::DefaultFuchsiaResourceDialect,
11219            >,
11220            offset: usize,
11221            depth: fidl::encoding::Depth,
11222        ) -> fidl::Result<()> {
11223            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11224            // Zero out padding regions. There's no need to apply masks
11225            // because the unmasked parts will be overwritten by fields.
11226            unsafe {
11227                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11228                (ptr as *mut u64).write_unaligned(0);
11229            }
11230            // Write the fields.
11231            self.0.encode(encoder, offset + 0, depth)?;
11232            self.1.encode(encoder, offset + 8, depth)?;
11233            Ok(())
11234        }
11235    }
11236
11237    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11238        for CounterGetInspectVmoResponse
11239    {
11240        #[inline(always)]
11241        fn new_empty() -> Self {
11242            Self {
11243                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
11244                buffer: fidl::new_empty!(
11245                    fidl_fuchsia_mem::Buffer,
11246                    fidl::encoding::DefaultFuchsiaResourceDialect
11247                ),
11248            }
11249        }
11250
11251        #[inline]
11252        unsafe fn decode(
11253            &mut self,
11254            decoder: &mut fidl::encoding::Decoder<
11255                '_,
11256                fidl::encoding::DefaultFuchsiaResourceDialect,
11257            >,
11258            offset: usize,
11259            _depth: fidl::encoding::Depth,
11260        ) -> fidl::Result<()> {
11261            decoder.debug_check_bounds::<Self>(offset);
11262            // Verify that padding bytes are zero.
11263            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11264            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11265            let mask = 0xffffffff00000000u64;
11266            let maskedval = padval & mask;
11267            if maskedval != 0 {
11268                return Err(fidl::Error::NonZeroPadding {
11269                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11270                });
11271            }
11272            fidl::decode!(
11273                i32,
11274                fidl::encoding::DefaultFuchsiaResourceDialect,
11275                &mut self.status,
11276                decoder,
11277                offset + 0,
11278                _depth
11279            )?;
11280            fidl::decode!(
11281                fidl_fuchsia_mem::Buffer,
11282                fidl::encoding::DefaultFuchsiaResourceDialect,
11283                &mut self.buffer,
11284                decoder,
11285                offset + 8,
11286                _depth
11287            )?;
11288            Ok(())
11289        }
11290    }
11291
11292    impl fidl::encoding::ResourceTypeMarker for CpuResourceGetResponse {
11293        type Borrowed<'a> = &'a mut Self;
11294        fn take_or_borrow<'a>(
11295            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11296        ) -> Self::Borrowed<'a> {
11297            value
11298        }
11299    }
11300
11301    unsafe impl fidl::encoding::TypeMarker for CpuResourceGetResponse {
11302        type Owned = Self;
11303
11304        #[inline(always)]
11305        fn inline_align(_context: fidl::encoding::Context) -> usize {
11306            4
11307        }
11308
11309        #[inline(always)]
11310        fn inline_size(_context: fidl::encoding::Context) -> usize {
11311            4
11312        }
11313    }
11314
11315    unsafe impl
11316        fidl::encoding::Encode<
11317            CpuResourceGetResponse,
11318            fidl::encoding::DefaultFuchsiaResourceDialect,
11319        > for &mut CpuResourceGetResponse
11320    {
11321        #[inline]
11322        unsafe fn encode(
11323            self,
11324            encoder: &mut fidl::encoding::Encoder<
11325                '_,
11326                fidl::encoding::DefaultFuchsiaResourceDialect,
11327            >,
11328            offset: usize,
11329            _depth: fidl::encoding::Depth,
11330        ) -> fidl::Result<()> {
11331            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11332            // Delegate to tuple encoding.
11333            fidl::encoding::Encode::<
11334                CpuResourceGetResponse,
11335                fidl::encoding::DefaultFuchsiaResourceDialect,
11336            >::encode(
11337                (<fidl::encoding::HandleType<
11338                    fidl::Resource,
11339                    { fidl::ObjectType::RESOURCE.into_raw() },
11340                    2147483648,
11341                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11342                    &mut self.resource
11343                ),),
11344                encoder,
11345                offset,
11346                _depth,
11347            )
11348        }
11349    }
11350    unsafe impl<
11351        T0: fidl::encoding::Encode<
11352                fidl::encoding::HandleType<
11353                    fidl::Resource,
11354                    { fidl::ObjectType::RESOURCE.into_raw() },
11355                    2147483648,
11356                >,
11357                fidl::encoding::DefaultFuchsiaResourceDialect,
11358            >,
11359    >
11360        fidl::encoding::Encode<
11361            CpuResourceGetResponse,
11362            fidl::encoding::DefaultFuchsiaResourceDialect,
11363        > for (T0,)
11364    {
11365        #[inline]
11366        unsafe fn encode(
11367            self,
11368            encoder: &mut fidl::encoding::Encoder<
11369                '_,
11370                fidl::encoding::DefaultFuchsiaResourceDialect,
11371            >,
11372            offset: usize,
11373            depth: fidl::encoding::Depth,
11374        ) -> fidl::Result<()> {
11375            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11376            // Zero out padding regions. There's no need to apply masks
11377            // because the unmasked parts will be overwritten by fields.
11378            // Write the fields.
11379            self.0.encode(encoder, offset + 0, depth)?;
11380            Ok(())
11381        }
11382    }
11383
11384    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11385        for CpuResourceGetResponse
11386    {
11387        #[inline(always)]
11388        fn new_empty() -> Self {
11389            Self {
11390                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11391            }
11392        }
11393
11394        #[inline]
11395        unsafe fn decode(
11396            &mut self,
11397            decoder: &mut fidl::encoding::Decoder<
11398                '_,
11399                fidl::encoding::DefaultFuchsiaResourceDialect,
11400            >,
11401            offset: usize,
11402            _depth: fidl::encoding::Depth,
11403        ) -> fidl::Result<()> {
11404            decoder.debug_check_bounds::<Self>(offset);
11405            // Verify that padding bytes are zero.
11406            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11407            Ok(())
11408        }
11409    }
11410
11411    impl fidl::encoding::ResourceTypeMarker for DebugResourceGetResponse {
11412        type Borrowed<'a> = &'a mut Self;
11413        fn take_or_borrow<'a>(
11414            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11415        ) -> Self::Borrowed<'a> {
11416            value
11417        }
11418    }
11419
11420    unsafe impl fidl::encoding::TypeMarker for DebugResourceGetResponse {
11421        type Owned = Self;
11422
11423        #[inline(always)]
11424        fn inline_align(_context: fidl::encoding::Context) -> usize {
11425            4
11426        }
11427
11428        #[inline(always)]
11429        fn inline_size(_context: fidl::encoding::Context) -> usize {
11430            4
11431        }
11432    }
11433
11434    unsafe impl
11435        fidl::encoding::Encode<
11436            DebugResourceGetResponse,
11437            fidl::encoding::DefaultFuchsiaResourceDialect,
11438        > for &mut DebugResourceGetResponse
11439    {
11440        #[inline]
11441        unsafe fn encode(
11442            self,
11443            encoder: &mut fidl::encoding::Encoder<
11444                '_,
11445                fidl::encoding::DefaultFuchsiaResourceDialect,
11446            >,
11447            offset: usize,
11448            _depth: fidl::encoding::Depth,
11449        ) -> fidl::Result<()> {
11450            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11451            // Delegate to tuple encoding.
11452            fidl::encoding::Encode::<
11453                DebugResourceGetResponse,
11454                fidl::encoding::DefaultFuchsiaResourceDialect,
11455            >::encode(
11456                (<fidl::encoding::HandleType<
11457                    fidl::Resource,
11458                    { fidl::ObjectType::RESOURCE.into_raw() },
11459                    2147483648,
11460                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11461                    &mut self.resource
11462                ),),
11463                encoder,
11464                offset,
11465                _depth,
11466            )
11467        }
11468    }
11469    unsafe impl<
11470        T0: fidl::encoding::Encode<
11471                fidl::encoding::HandleType<
11472                    fidl::Resource,
11473                    { fidl::ObjectType::RESOURCE.into_raw() },
11474                    2147483648,
11475                >,
11476                fidl::encoding::DefaultFuchsiaResourceDialect,
11477            >,
11478    >
11479        fidl::encoding::Encode<
11480            DebugResourceGetResponse,
11481            fidl::encoding::DefaultFuchsiaResourceDialect,
11482        > for (T0,)
11483    {
11484        #[inline]
11485        unsafe fn encode(
11486            self,
11487            encoder: &mut fidl::encoding::Encoder<
11488                '_,
11489                fidl::encoding::DefaultFuchsiaResourceDialect,
11490            >,
11491            offset: usize,
11492            depth: fidl::encoding::Depth,
11493        ) -> fidl::Result<()> {
11494            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11495            // Zero out padding regions. There's no need to apply masks
11496            // because the unmasked parts will be overwritten by fields.
11497            // Write the fields.
11498            self.0.encode(encoder, offset + 0, depth)?;
11499            Ok(())
11500        }
11501    }
11502
11503    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11504        for DebugResourceGetResponse
11505    {
11506        #[inline(always)]
11507        fn new_empty() -> Self {
11508            Self {
11509                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11510            }
11511        }
11512
11513        #[inline]
11514        unsafe fn decode(
11515            &mut self,
11516            decoder: &mut fidl::encoding::Decoder<
11517                '_,
11518                fidl::encoding::DefaultFuchsiaResourceDialect,
11519            >,
11520            offset: usize,
11521            _depth: fidl::encoding::Depth,
11522        ) -> fidl::Result<()> {
11523            decoder.debug_check_bounds::<Self>(offset);
11524            // Verify that padding bytes are zero.
11525            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11526            Ok(())
11527        }
11528    }
11529
11530    impl fidl::encoding::ResourceTypeMarker for DebuglogResourceGetResponse {
11531        type Borrowed<'a> = &'a mut Self;
11532        fn take_or_borrow<'a>(
11533            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11534        ) -> Self::Borrowed<'a> {
11535            value
11536        }
11537    }
11538
11539    unsafe impl fidl::encoding::TypeMarker for DebuglogResourceGetResponse {
11540        type Owned = Self;
11541
11542        #[inline(always)]
11543        fn inline_align(_context: fidl::encoding::Context) -> usize {
11544            4
11545        }
11546
11547        #[inline(always)]
11548        fn inline_size(_context: fidl::encoding::Context) -> usize {
11549            4
11550        }
11551    }
11552
11553    unsafe impl
11554        fidl::encoding::Encode<
11555            DebuglogResourceGetResponse,
11556            fidl::encoding::DefaultFuchsiaResourceDialect,
11557        > for &mut DebuglogResourceGetResponse
11558    {
11559        #[inline]
11560        unsafe fn encode(
11561            self,
11562            encoder: &mut fidl::encoding::Encoder<
11563                '_,
11564                fidl::encoding::DefaultFuchsiaResourceDialect,
11565            >,
11566            offset: usize,
11567            _depth: fidl::encoding::Depth,
11568        ) -> fidl::Result<()> {
11569            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
11570            // Delegate to tuple encoding.
11571            fidl::encoding::Encode::<
11572                DebuglogResourceGetResponse,
11573                fidl::encoding::DefaultFuchsiaResourceDialect,
11574            >::encode(
11575                (<fidl::encoding::HandleType<
11576                    fidl::Resource,
11577                    { fidl::ObjectType::RESOURCE.into_raw() },
11578                    2147483648,
11579                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11580                    &mut self.resource
11581                ),),
11582                encoder,
11583                offset,
11584                _depth,
11585            )
11586        }
11587    }
11588    unsafe impl<
11589        T0: fidl::encoding::Encode<
11590                fidl::encoding::HandleType<
11591                    fidl::Resource,
11592                    { fidl::ObjectType::RESOURCE.into_raw() },
11593                    2147483648,
11594                >,
11595                fidl::encoding::DefaultFuchsiaResourceDialect,
11596            >,
11597    >
11598        fidl::encoding::Encode<
11599            DebuglogResourceGetResponse,
11600            fidl::encoding::DefaultFuchsiaResourceDialect,
11601        > for (T0,)
11602    {
11603        #[inline]
11604        unsafe fn encode(
11605            self,
11606            encoder: &mut fidl::encoding::Encoder<
11607                '_,
11608                fidl::encoding::DefaultFuchsiaResourceDialect,
11609            >,
11610            offset: usize,
11611            depth: fidl::encoding::Depth,
11612        ) -> fidl::Result<()> {
11613            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
11614            // Zero out padding regions. There's no need to apply masks
11615            // because the unmasked parts will be overwritten by fields.
11616            // Write the fields.
11617            self.0.encode(encoder, offset + 0, depth)?;
11618            Ok(())
11619        }
11620    }
11621
11622    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11623        for DebuglogResourceGetResponse
11624    {
11625        #[inline(always)]
11626        fn new_empty() -> Self {
11627            Self {
11628                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11629            }
11630        }
11631
11632        #[inline]
11633        unsafe fn decode(
11634            &mut self,
11635            decoder: &mut fidl::encoding::Decoder<
11636                '_,
11637                fidl::encoding::DefaultFuchsiaResourceDialect,
11638            >,
11639            offset: usize,
11640            _depth: fidl::encoding::Depth,
11641        ) -> fidl::Result<()> {
11642            decoder.debug_check_bounds::<Self>(offset);
11643            // Verify that padding bytes are zero.
11644            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11645            Ok(())
11646        }
11647    }
11648
11649    impl fidl::encoding::ResourceTypeMarker for EnergyInfoResourceGetResponse {
11650        type Borrowed<'a> = &'a mut Self;
11651        fn take_or_borrow<'a>(
11652            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11653        ) -> Self::Borrowed<'a> {
11654            value
11655        }
11656    }
11657
11658    unsafe impl fidl::encoding::TypeMarker for EnergyInfoResourceGetResponse {
11659        type Owned = Self;
11660
11661        #[inline(always)]
11662        fn inline_align(_context: fidl::encoding::Context) -> usize {
11663            4
11664        }
11665
11666        #[inline(always)]
11667        fn inline_size(_context: fidl::encoding::Context) -> usize {
11668            4
11669        }
11670    }
11671
11672    unsafe impl
11673        fidl::encoding::Encode<
11674            EnergyInfoResourceGetResponse,
11675            fidl::encoding::DefaultFuchsiaResourceDialect,
11676        > for &mut EnergyInfoResourceGetResponse
11677    {
11678        #[inline]
11679        unsafe fn encode(
11680            self,
11681            encoder: &mut fidl::encoding::Encoder<
11682                '_,
11683                fidl::encoding::DefaultFuchsiaResourceDialect,
11684            >,
11685            offset: usize,
11686            _depth: fidl::encoding::Depth,
11687        ) -> fidl::Result<()> {
11688            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
11689            // Delegate to tuple encoding.
11690            fidl::encoding::Encode::<
11691                EnergyInfoResourceGetResponse,
11692                fidl::encoding::DefaultFuchsiaResourceDialect,
11693            >::encode(
11694                (<fidl::encoding::HandleType<
11695                    fidl::Resource,
11696                    { fidl::ObjectType::RESOURCE.into_raw() },
11697                    2147483648,
11698                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11699                    &mut self.resource
11700                ),),
11701                encoder,
11702                offset,
11703                _depth,
11704            )
11705        }
11706    }
11707    unsafe impl<
11708        T0: fidl::encoding::Encode<
11709                fidl::encoding::HandleType<
11710                    fidl::Resource,
11711                    { fidl::ObjectType::RESOURCE.into_raw() },
11712                    2147483648,
11713                >,
11714                fidl::encoding::DefaultFuchsiaResourceDialect,
11715            >,
11716    >
11717        fidl::encoding::Encode<
11718            EnergyInfoResourceGetResponse,
11719            fidl::encoding::DefaultFuchsiaResourceDialect,
11720        > for (T0,)
11721    {
11722        #[inline]
11723        unsafe fn encode(
11724            self,
11725            encoder: &mut fidl::encoding::Encoder<
11726                '_,
11727                fidl::encoding::DefaultFuchsiaResourceDialect,
11728            >,
11729            offset: usize,
11730            depth: fidl::encoding::Depth,
11731        ) -> fidl::Result<()> {
11732            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
11733            // Zero out padding regions. There's no need to apply masks
11734            // because the unmasked parts will be overwritten by fields.
11735            // Write the fields.
11736            self.0.encode(encoder, offset + 0, depth)?;
11737            Ok(())
11738        }
11739    }
11740
11741    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11742        for EnergyInfoResourceGetResponse
11743    {
11744        #[inline(always)]
11745        fn new_empty() -> Self {
11746            Self {
11747                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11748            }
11749        }
11750
11751        #[inline]
11752        unsafe fn decode(
11753            &mut self,
11754            decoder: &mut fidl::encoding::Decoder<
11755                '_,
11756                fidl::encoding::DefaultFuchsiaResourceDialect,
11757            >,
11758            offset: usize,
11759            _depth: fidl::encoding::Depth,
11760        ) -> fidl::Result<()> {
11761            decoder.debug_check_bounds::<Self>(offset);
11762            // Verify that padding bytes are zero.
11763            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11764            Ok(())
11765        }
11766    }
11767
11768    impl fidl::encoding::ResourceTypeMarker for HypervisorResourceGetResponse {
11769        type Borrowed<'a> = &'a mut Self;
11770        fn take_or_borrow<'a>(
11771            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11772        ) -> Self::Borrowed<'a> {
11773            value
11774        }
11775    }
11776
11777    unsafe impl fidl::encoding::TypeMarker for HypervisorResourceGetResponse {
11778        type Owned = Self;
11779
11780        #[inline(always)]
11781        fn inline_align(_context: fidl::encoding::Context) -> usize {
11782            4
11783        }
11784
11785        #[inline(always)]
11786        fn inline_size(_context: fidl::encoding::Context) -> usize {
11787            4
11788        }
11789    }
11790
11791    unsafe impl
11792        fidl::encoding::Encode<
11793            HypervisorResourceGetResponse,
11794            fidl::encoding::DefaultFuchsiaResourceDialect,
11795        > for &mut HypervisorResourceGetResponse
11796    {
11797        #[inline]
11798        unsafe fn encode(
11799            self,
11800            encoder: &mut fidl::encoding::Encoder<
11801                '_,
11802                fidl::encoding::DefaultFuchsiaResourceDialect,
11803            >,
11804            offset: usize,
11805            _depth: fidl::encoding::Depth,
11806        ) -> fidl::Result<()> {
11807            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
11808            // Delegate to tuple encoding.
11809            fidl::encoding::Encode::<
11810                HypervisorResourceGetResponse,
11811                fidl::encoding::DefaultFuchsiaResourceDialect,
11812            >::encode(
11813                (<fidl::encoding::HandleType<
11814                    fidl::Resource,
11815                    { fidl::ObjectType::RESOURCE.into_raw() },
11816                    2147483648,
11817                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11818                    &mut self.resource
11819                ),),
11820                encoder,
11821                offset,
11822                _depth,
11823            )
11824        }
11825    }
11826    unsafe impl<
11827        T0: fidl::encoding::Encode<
11828                fidl::encoding::HandleType<
11829                    fidl::Resource,
11830                    { fidl::ObjectType::RESOURCE.into_raw() },
11831                    2147483648,
11832                >,
11833                fidl::encoding::DefaultFuchsiaResourceDialect,
11834            >,
11835    >
11836        fidl::encoding::Encode<
11837            HypervisorResourceGetResponse,
11838            fidl::encoding::DefaultFuchsiaResourceDialect,
11839        > for (T0,)
11840    {
11841        #[inline]
11842        unsafe fn encode(
11843            self,
11844            encoder: &mut fidl::encoding::Encoder<
11845                '_,
11846                fidl::encoding::DefaultFuchsiaResourceDialect,
11847            >,
11848            offset: usize,
11849            depth: fidl::encoding::Depth,
11850        ) -> fidl::Result<()> {
11851            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
11852            // Zero out padding regions. There's no need to apply masks
11853            // because the unmasked parts will be overwritten by fields.
11854            // Write the fields.
11855            self.0.encode(encoder, offset + 0, depth)?;
11856            Ok(())
11857        }
11858    }
11859
11860    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11861        for HypervisorResourceGetResponse
11862    {
11863        #[inline(always)]
11864        fn new_empty() -> Self {
11865            Self {
11866                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11867            }
11868        }
11869
11870        #[inline]
11871        unsafe fn decode(
11872            &mut self,
11873            decoder: &mut fidl::encoding::Decoder<
11874                '_,
11875                fidl::encoding::DefaultFuchsiaResourceDialect,
11876            >,
11877            offset: usize,
11878            _depth: fidl::encoding::Depth,
11879        ) -> fidl::Result<()> {
11880            decoder.debug_check_bounds::<Self>(offset);
11881            // Verify that padding bytes are zero.
11882            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11883            Ok(())
11884        }
11885    }
11886
11887    impl fidl::encoding::ResourceTypeMarker for InfoResourceGetResponse {
11888        type Borrowed<'a> = &'a mut Self;
11889        fn take_or_borrow<'a>(
11890            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11891        ) -> Self::Borrowed<'a> {
11892            value
11893        }
11894    }
11895
11896    unsafe impl fidl::encoding::TypeMarker for InfoResourceGetResponse {
11897        type Owned = Self;
11898
11899        #[inline(always)]
11900        fn inline_align(_context: fidl::encoding::Context) -> usize {
11901            4
11902        }
11903
11904        #[inline(always)]
11905        fn inline_size(_context: fidl::encoding::Context) -> usize {
11906            4
11907        }
11908    }
11909
11910    unsafe impl
11911        fidl::encoding::Encode<
11912            InfoResourceGetResponse,
11913            fidl::encoding::DefaultFuchsiaResourceDialect,
11914        > for &mut InfoResourceGetResponse
11915    {
11916        #[inline]
11917        unsafe fn encode(
11918            self,
11919            encoder: &mut fidl::encoding::Encoder<
11920                '_,
11921                fidl::encoding::DefaultFuchsiaResourceDialect,
11922            >,
11923            offset: usize,
11924            _depth: fidl::encoding::Depth,
11925        ) -> fidl::Result<()> {
11926            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
11927            // Delegate to tuple encoding.
11928            fidl::encoding::Encode::<
11929                InfoResourceGetResponse,
11930                fidl::encoding::DefaultFuchsiaResourceDialect,
11931            >::encode(
11932                (<fidl::encoding::HandleType<
11933                    fidl::Resource,
11934                    { fidl::ObjectType::RESOURCE.into_raw() },
11935                    2147483648,
11936                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11937                    &mut self.resource
11938                ),),
11939                encoder,
11940                offset,
11941                _depth,
11942            )
11943        }
11944    }
11945    unsafe impl<
11946        T0: fidl::encoding::Encode<
11947                fidl::encoding::HandleType<
11948                    fidl::Resource,
11949                    { fidl::ObjectType::RESOURCE.into_raw() },
11950                    2147483648,
11951                >,
11952                fidl::encoding::DefaultFuchsiaResourceDialect,
11953            >,
11954    >
11955        fidl::encoding::Encode<
11956            InfoResourceGetResponse,
11957            fidl::encoding::DefaultFuchsiaResourceDialect,
11958        > for (T0,)
11959    {
11960        #[inline]
11961        unsafe fn encode(
11962            self,
11963            encoder: &mut fidl::encoding::Encoder<
11964                '_,
11965                fidl::encoding::DefaultFuchsiaResourceDialect,
11966            >,
11967            offset: usize,
11968            depth: fidl::encoding::Depth,
11969        ) -> fidl::Result<()> {
11970            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
11971            // Zero out padding regions. There's no need to apply masks
11972            // because the unmasked parts will be overwritten by fields.
11973            // Write the fields.
11974            self.0.encode(encoder, offset + 0, depth)?;
11975            Ok(())
11976        }
11977    }
11978
11979    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11980        for InfoResourceGetResponse
11981    {
11982        #[inline(always)]
11983        fn new_empty() -> Self {
11984            Self {
11985                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11986            }
11987        }
11988
11989        #[inline]
11990        unsafe fn decode(
11991            &mut self,
11992            decoder: &mut fidl::encoding::Decoder<
11993                '_,
11994                fidl::encoding::DefaultFuchsiaResourceDialect,
11995            >,
11996            offset: usize,
11997            _depth: fidl::encoding::Depth,
11998        ) -> fidl::Result<()> {
11999            decoder.debug_check_bounds::<Self>(offset);
12000            // Verify that padding bytes are zero.
12001            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12002            Ok(())
12003        }
12004    }
12005
12006    impl fidl::encoding::ResourceTypeMarker for IommuResourceGetResponse {
12007        type Borrowed<'a> = &'a mut Self;
12008        fn take_or_borrow<'a>(
12009            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12010        ) -> Self::Borrowed<'a> {
12011            value
12012        }
12013    }
12014
12015    unsafe impl fidl::encoding::TypeMarker for IommuResourceGetResponse {
12016        type Owned = Self;
12017
12018        #[inline(always)]
12019        fn inline_align(_context: fidl::encoding::Context) -> usize {
12020            4
12021        }
12022
12023        #[inline(always)]
12024        fn inline_size(_context: fidl::encoding::Context) -> usize {
12025            4
12026        }
12027    }
12028
12029    unsafe impl
12030        fidl::encoding::Encode<
12031            IommuResourceGetResponse,
12032            fidl::encoding::DefaultFuchsiaResourceDialect,
12033        > for &mut IommuResourceGetResponse
12034    {
12035        #[inline]
12036        unsafe fn encode(
12037            self,
12038            encoder: &mut fidl::encoding::Encoder<
12039                '_,
12040                fidl::encoding::DefaultFuchsiaResourceDialect,
12041            >,
12042            offset: usize,
12043            _depth: fidl::encoding::Depth,
12044        ) -> fidl::Result<()> {
12045            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12046            // Delegate to tuple encoding.
12047            fidl::encoding::Encode::<
12048                IommuResourceGetResponse,
12049                fidl::encoding::DefaultFuchsiaResourceDialect,
12050            >::encode(
12051                (<fidl::encoding::HandleType<
12052                    fidl::Resource,
12053                    { fidl::ObjectType::RESOURCE.into_raw() },
12054                    2147483648,
12055                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12056                    &mut self.resource
12057                ),),
12058                encoder,
12059                offset,
12060                _depth,
12061            )
12062        }
12063    }
12064    unsafe impl<
12065        T0: fidl::encoding::Encode<
12066                fidl::encoding::HandleType<
12067                    fidl::Resource,
12068                    { fidl::ObjectType::RESOURCE.into_raw() },
12069                    2147483648,
12070                >,
12071                fidl::encoding::DefaultFuchsiaResourceDialect,
12072            >,
12073    >
12074        fidl::encoding::Encode<
12075            IommuResourceGetResponse,
12076            fidl::encoding::DefaultFuchsiaResourceDialect,
12077        > for (T0,)
12078    {
12079        #[inline]
12080        unsafe fn encode(
12081            self,
12082            encoder: &mut fidl::encoding::Encoder<
12083                '_,
12084                fidl::encoding::DefaultFuchsiaResourceDialect,
12085            >,
12086            offset: usize,
12087            depth: fidl::encoding::Depth,
12088        ) -> fidl::Result<()> {
12089            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12090            // Zero out padding regions. There's no need to apply masks
12091            // because the unmasked parts will be overwritten by fields.
12092            // Write the fields.
12093            self.0.encode(encoder, offset + 0, depth)?;
12094            Ok(())
12095        }
12096    }
12097
12098    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12099        for IommuResourceGetResponse
12100    {
12101        #[inline(always)]
12102        fn new_empty() -> Self {
12103            Self {
12104                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12105            }
12106        }
12107
12108        #[inline]
12109        unsafe fn decode(
12110            &mut self,
12111            decoder: &mut fidl::encoding::Decoder<
12112                '_,
12113                fidl::encoding::DefaultFuchsiaResourceDialect,
12114            >,
12115            offset: usize,
12116            _depth: fidl::encoding::Depth,
12117        ) -> fidl::Result<()> {
12118            decoder.debug_check_bounds::<Self>(offset);
12119            // Verify that padding bytes are zero.
12120            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12121            Ok(())
12122        }
12123    }
12124
12125    impl fidl::encoding::ResourceTypeMarker for IoportResourceGetResponse {
12126        type Borrowed<'a> = &'a mut Self;
12127        fn take_or_borrow<'a>(
12128            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12129        ) -> Self::Borrowed<'a> {
12130            value
12131        }
12132    }
12133
12134    unsafe impl fidl::encoding::TypeMarker for IoportResourceGetResponse {
12135        type Owned = Self;
12136
12137        #[inline(always)]
12138        fn inline_align(_context: fidl::encoding::Context) -> usize {
12139            4
12140        }
12141
12142        #[inline(always)]
12143        fn inline_size(_context: fidl::encoding::Context) -> usize {
12144            4
12145        }
12146    }
12147
12148    unsafe impl
12149        fidl::encoding::Encode<
12150            IoportResourceGetResponse,
12151            fidl::encoding::DefaultFuchsiaResourceDialect,
12152        > for &mut IoportResourceGetResponse
12153    {
12154        #[inline]
12155        unsafe fn encode(
12156            self,
12157            encoder: &mut fidl::encoding::Encoder<
12158                '_,
12159                fidl::encoding::DefaultFuchsiaResourceDialect,
12160            >,
12161            offset: usize,
12162            _depth: fidl::encoding::Depth,
12163        ) -> fidl::Result<()> {
12164            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12165            // Delegate to tuple encoding.
12166            fidl::encoding::Encode::<
12167                IoportResourceGetResponse,
12168                fidl::encoding::DefaultFuchsiaResourceDialect,
12169            >::encode(
12170                (<fidl::encoding::HandleType<
12171                    fidl::Resource,
12172                    { fidl::ObjectType::RESOURCE.into_raw() },
12173                    2147483648,
12174                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12175                    &mut self.resource
12176                ),),
12177                encoder,
12178                offset,
12179                _depth,
12180            )
12181        }
12182    }
12183    unsafe impl<
12184        T0: fidl::encoding::Encode<
12185                fidl::encoding::HandleType<
12186                    fidl::Resource,
12187                    { fidl::ObjectType::RESOURCE.into_raw() },
12188                    2147483648,
12189                >,
12190                fidl::encoding::DefaultFuchsiaResourceDialect,
12191            >,
12192    >
12193        fidl::encoding::Encode<
12194            IoportResourceGetResponse,
12195            fidl::encoding::DefaultFuchsiaResourceDialect,
12196        > for (T0,)
12197    {
12198        #[inline]
12199        unsafe fn encode(
12200            self,
12201            encoder: &mut fidl::encoding::Encoder<
12202                '_,
12203                fidl::encoding::DefaultFuchsiaResourceDialect,
12204            >,
12205            offset: usize,
12206            depth: fidl::encoding::Depth,
12207        ) -> fidl::Result<()> {
12208            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12209            // Zero out padding regions. There's no need to apply masks
12210            // because the unmasked parts will be overwritten by fields.
12211            // Write the fields.
12212            self.0.encode(encoder, offset + 0, depth)?;
12213            Ok(())
12214        }
12215    }
12216
12217    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12218        for IoportResourceGetResponse
12219    {
12220        #[inline(always)]
12221        fn new_empty() -> Self {
12222            Self {
12223                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12224            }
12225        }
12226
12227        #[inline]
12228        unsafe fn decode(
12229            &mut self,
12230            decoder: &mut fidl::encoding::Decoder<
12231                '_,
12232                fidl::encoding::DefaultFuchsiaResourceDialect,
12233            >,
12234            offset: usize,
12235            _depth: fidl::encoding::Depth,
12236        ) -> fidl::Result<()> {
12237            decoder.debug_check_bounds::<Self>(offset);
12238            // Verify that padding bytes are zero.
12239            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12240            Ok(())
12241        }
12242    }
12243
12244    impl fidl::encoding::ResourceTypeMarker for IrqResourceGetResponse {
12245        type Borrowed<'a> = &'a mut Self;
12246        fn take_or_borrow<'a>(
12247            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12248        ) -> Self::Borrowed<'a> {
12249            value
12250        }
12251    }
12252
12253    unsafe impl fidl::encoding::TypeMarker for IrqResourceGetResponse {
12254        type Owned = Self;
12255
12256        #[inline(always)]
12257        fn inline_align(_context: fidl::encoding::Context) -> usize {
12258            4
12259        }
12260
12261        #[inline(always)]
12262        fn inline_size(_context: fidl::encoding::Context) -> usize {
12263            4
12264        }
12265    }
12266
12267    unsafe impl
12268        fidl::encoding::Encode<
12269            IrqResourceGetResponse,
12270            fidl::encoding::DefaultFuchsiaResourceDialect,
12271        > for &mut IrqResourceGetResponse
12272    {
12273        #[inline]
12274        unsafe fn encode(
12275            self,
12276            encoder: &mut fidl::encoding::Encoder<
12277                '_,
12278                fidl::encoding::DefaultFuchsiaResourceDialect,
12279            >,
12280            offset: usize,
12281            _depth: fidl::encoding::Depth,
12282        ) -> fidl::Result<()> {
12283            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12284            // Delegate to tuple encoding.
12285            fidl::encoding::Encode::<
12286                IrqResourceGetResponse,
12287                fidl::encoding::DefaultFuchsiaResourceDialect,
12288            >::encode(
12289                (<fidl::encoding::HandleType<
12290                    fidl::Resource,
12291                    { fidl::ObjectType::RESOURCE.into_raw() },
12292                    2147483648,
12293                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12294                    &mut self.resource
12295                ),),
12296                encoder,
12297                offset,
12298                _depth,
12299            )
12300        }
12301    }
12302    unsafe impl<
12303        T0: fidl::encoding::Encode<
12304                fidl::encoding::HandleType<
12305                    fidl::Resource,
12306                    { fidl::ObjectType::RESOURCE.into_raw() },
12307                    2147483648,
12308                >,
12309                fidl::encoding::DefaultFuchsiaResourceDialect,
12310            >,
12311    >
12312        fidl::encoding::Encode<
12313            IrqResourceGetResponse,
12314            fidl::encoding::DefaultFuchsiaResourceDialect,
12315        > for (T0,)
12316    {
12317        #[inline]
12318        unsafe fn encode(
12319            self,
12320            encoder: &mut fidl::encoding::Encoder<
12321                '_,
12322                fidl::encoding::DefaultFuchsiaResourceDialect,
12323            >,
12324            offset: usize,
12325            depth: fidl::encoding::Depth,
12326        ) -> fidl::Result<()> {
12327            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12328            // Zero out padding regions. There's no need to apply masks
12329            // because the unmasked parts will be overwritten by fields.
12330            // Write the fields.
12331            self.0.encode(encoder, offset + 0, depth)?;
12332            Ok(())
12333        }
12334    }
12335
12336    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12337        for IrqResourceGetResponse
12338    {
12339        #[inline(always)]
12340        fn new_empty() -> Self {
12341            Self {
12342                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12343            }
12344        }
12345
12346        #[inline]
12347        unsafe fn decode(
12348            &mut self,
12349            decoder: &mut fidl::encoding::Decoder<
12350                '_,
12351                fidl::encoding::DefaultFuchsiaResourceDialect,
12352            >,
12353            offset: usize,
12354            _depth: fidl::encoding::Depth,
12355        ) -> fidl::Result<()> {
12356            decoder.debug_check_bounds::<Self>(offset);
12357            // Verify that padding bytes are zero.
12358            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12359            Ok(())
12360        }
12361    }
12362
12363    impl fidl::encoding::ResourceTypeMarker for MexecResourceGetResponse {
12364        type Borrowed<'a> = &'a mut Self;
12365        fn take_or_borrow<'a>(
12366            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12367        ) -> Self::Borrowed<'a> {
12368            value
12369        }
12370    }
12371
12372    unsafe impl fidl::encoding::TypeMarker for MexecResourceGetResponse {
12373        type Owned = Self;
12374
12375        #[inline(always)]
12376        fn inline_align(_context: fidl::encoding::Context) -> usize {
12377            4
12378        }
12379
12380        #[inline(always)]
12381        fn inline_size(_context: fidl::encoding::Context) -> usize {
12382            4
12383        }
12384    }
12385
12386    unsafe impl
12387        fidl::encoding::Encode<
12388            MexecResourceGetResponse,
12389            fidl::encoding::DefaultFuchsiaResourceDialect,
12390        > for &mut MexecResourceGetResponse
12391    {
12392        #[inline]
12393        unsafe fn encode(
12394            self,
12395            encoder: &mut fidl::encoding::Encoder<
12396                '_,
12397                fidl::encoding::DefaultFuchsiaResourceDialect,
12398            >,
12399            offset: usize,
12400            _depth: fidl::encoding::Depth,
12401        ) -> fidl::Result<()> {
12402            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12403            // Delegate to tuple encoding.
12404            fidl::encoding::Encode::<
12405                MexecResourceGetResponse,
12406                fidl::encoding::DefaultFuchsiaResourceDialect,
12407            >::encode(
12408                (<fidl::encoding::HandleType<
12409                    fidl::Resource,
12410                    { fidl::ObjectType::RESOURCE.into_raw() },
12411                    2147483648,
12412                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12413                    &mut self.resource
12414                ),),
12415                encoder,
12416                offset,
12417                _depth,
12418            )
12419        }
12420    }
12421    unsafe impl<
12422        T0: fidl::encoding::Encode<
12423                fidl::encoding::HandleType<
12424                    fidl::Resource,
12425                    { fidl::ObjectType::RESOURCE.into_raw() },
12426                    2147483648,
12427                >,
12428                fidl::encoding::DefaultFuchsiaResourceDialect,
12429            >,
12430    >
12431        fidl::encoding::Encode<
12432            MexecResourceGetResponse,
12433            fidl::encoding::DefaultFuchsiaResourceDialect,
12434        > for (T0,)
12435    {
12436        #[inline]
12437        unsafe fn encode(
12438            self,
12439            encoder: &mut fidl::encoding::Encoder<
12440                '_,
12441                fidl::encoding::DefaultFuchsiaResourceDialect,
12442            >,
12443            offset: usize,
12444            depth: fidl::encoding::Depth,
12445        ) -> fidl::Result<()> {
12446            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12447            // Zero out padding regions. There's no need to apply masks
12448            // because the unmasked parts will be overwritten by fields.
12449            // Write the fields.
12450            self.0.encode(encoder, offset + 0, depth)?;
12451            Ok(())
12452        }
12453    }
12454
12455    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12456        for MexecResourceGetResponse
12457    {
12458        #[inline(always)]
12459        fn new_empty() -> Self {
12460            Self {
12461                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12462            }
12463        }
12464
12465        #[inline]
12466        unsafe fn decode(
12467            &mut self,
12468            decoder: &mut fidl::encoding::Decoder<
12469                '_,
12470                fidl::encoding::DefaultFuchsiaResourceDialect,
12471            >,
12472            offset: usize,
12473            _depth: fidl::encoding::Depth,
12474        ) -> fidl::Result<()> {
12475            decoder.debug_check_bounds::<Self>(offset);
12476            // Verify that padding bytes are zero.
12477            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12478            Ok(())
12479        }
12480    }
12481
12482    impl fidl::encoding::ResourceTypeMarker for MmioResourceGetResponse {
12483        type Borrowed<'a> = &'a mut Self;
12484        fn take_or_borrow<'a>(
12485            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12486        ) -> Self::Borrowed<'a> {
12487            value
12488        }
12489    }
12490
12491    unsafe impl fidl::encoding::TypeMarker for MmioResourceGetResponse {
12492        type Owned = Self;
12493
12494        #[inline(always)]
12495        fn inline_align(_context: fidl::encoding::Context) -> usize {
12496            4
12497        }
12498
12499        #[inline(always)]
12500        fn inline_size(_context: fidl::encoding::Context) -> usize {
12501            4
12502        }
12503    }
12504
12505    unsafe impl
12506        fidl::encoding::Encode<
12507            MmioResourceGetResponse,
12508            fidl::encoding::DefaultFuchsiaResourceDialect,
12509        > for &mut MmioResourceGetResponse
12510    {
12511        #[inline]
12512        unsafe fn encode(
12513            self,
12514            encoder: &mut fidl::encoding::Encoder<
12515                '_,
12516                fidl::encoding::DefaultFuchsiaResourceDialect,
12517            >,
12518            offset: usize,
12519            _depth: fidl::encoding::Depth,
12520        ) -> fidl::Result<()> {
12521            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12522            // Delegate to tuple encoding.
12523            fidl::encoding::Encode::<
12524                MmioResourceGetResponse,
12525                fidl::encoding::DefaultFuchsiaResourceDialect,
12526            >::encode(
12527                (<fidl::encoding::HandleType<
12528                    fidl::Resource,
12529                    { fidl::ObjectType::RESOURCE.into_raw() },
12530                    2147483648,
12531                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12532                    &mut self.resource
12533                ),),
12534                encoder,
12535                offset,
12536                _depth,
12537            )
12538        }
12539    }
12540    unsafe impl<
12541        T0: fidl::encoding::Encode<
12542                fidl::encoding::HandleType<
12543                    fidl::Resource,
12544                    { fidl::ObjectType::RESOURCE.into_raw() },
12545                    2147483648,
12546                >,
12547                fidl::encoding::DefaultFuchsiaResourceDialect,
12548            >,
12549    >
12550        fidl::encoding::Encode<
12551            MmioResourceGetResponse,
12552            fidl::encoding::DefaultFuchsiaResourceDialect,
12553        > for (T0,)
12554    {
12555        #[inline]
12556        unsafe fn encode(
12557            self,
12558            encoder: &mut fidl::encoding::Encoder<
12559                '_,
12560                fidl::encoding::DefaultFuchsiaResourceDialect,
12561            >,
12562            offset: usize,
12563            depth: fidl::encoding::Depth,
12564        ) -> fidl::Result<()> {
12565            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12566            // Zero out padding regions. There's no need to apply masks
12567            // because the unmasked parts will be overwritten by fields.
12568            // Write the fields.
12569            self.0.encode(encoder, offset + 0, depth)?;
12570            Ok(())
12571        }
12572    }
12573
12574    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12575        for MmioResourceGetResponse
12576    {
12577        #[inline(always)]
12578        fn new_empty() -> Self {
12579            Self {
12580                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12581            }
12582        }
12583
12584        #[inline]
12585        unsafe fn decode(
12586            &mut self,
12587            decoder: &mut fidl::encoding::Decoder<
12588                '_,
12589                fidl::encoding::DefaultFuchsiaResourceDialect,
12590            >,
12591            offset: usize,
12592            _depth: fidl::encoding::Depth,
12593        ) -> fidl::Result<()> {
12594            decoder.debug_check_bounds::<Self>(offset);
12595            // Verify that padding bytes are zero.
12596            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12597            Ok(())
12598        }
12599    }
12600
12601    impl fidl::encoding::ResourceTypeMarker for MsiResourceGetResponse {
12602        type Borrowed<'a> = &'a mut Self;
12603        fn take_or_borrow<'a>(
12604            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12605        ) -> Self::Borrowed<'a> {
12606            value
12607        }
12608    }
12609
12610    unsafe impl fidl::encoding::TypeMarker for MsiResourceGetResponse {
12611        type Owned = Self;
12612
12613        #[inline(always)]
12614        fn inline_align(_context: fidl::encoding::Context) -> usize {
12615            4
12616        }
12617
12618        #[inline(always)]
12619        fn inline_size(_context: fidl::encoding::Context) -> usize {
12620            4
12621        }
12622    }
12623
12624    unsafe impl
12625        fidl::encoding::Encode<
12626            MsiResourceGetResponse,
12627            fidl::encoding::DefaultFuchsiaResourceDialect,
12628        > for &mut MsiResourceGetResponse
12629    {
12630        #[inline]
12631        unsafe fn encode(
12632            self,
12633            encoder: &mut fidl::encoding::Encoder<
12634                '_,
12635                fidl::encoding::DefaultFuchsiaResourceDialect,
12636            >,
12637            offset: usize,
12638            _depth: fidl::encoding::Depth,
12639        ) -> fidl::Result<()> {
12640            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
12641            // Delegate to tuple encoding.
12642            fidl::encoding::Encode::<
12643                MsiResourceGetResponse,
12644                fidl::encoding::DefaultFuchsiaResourceDialect,
12645            >::encode(
12646                (<fidl::encoding::HandleType<
12647                    fidl::Resource,
12648                    { fidl::ObjectType::RESOURCE.into_raw() },
12649                    2147483648,
12650                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12651                    &mut self.resource
12652                ),),
12653                encoder,
12654                offset,
12655                _depth,
12656            )
12657        }
12658    }
12659    unsafe impl<
12660        T0: fidl::encoding::Encode<
12661                fidl::encoding::HandleType<
12662                    fidl::Resource,
12663                    { fidl::ObjectType::RESOURCE.into_raw() },
12664                    2147483648,
12665                >,
12666                fidl::encoding::DefaultFuchsiaResourceDialect,
12667            >,
12668    >
12669        fidl::encoding::Encode<
12670            MsiResourceGetResponse,
12671            fidl::encoding::DefaultFuchsiaResourceDialect,
12672        > for (T0,)
12673    {
12674        #[inline]
12675        unsafe fn encode(
12676            self,
12677            encoder: &mut fidl::encoding::Encoder<
12678                '_,
12679                fidl::encoding::DefaultFuchsiaResourceDialect,
12680            >,
12681            offset: usize,
12682            depth: fidl::encoding::Depth,
12683        ) -> fidl::Result<()> {
12684            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
12685            // Zero out padding regions. There's no need to apply masks
12686            // because the unmasked parts will be overwritten by fields.
12687            // Write the fields.
12688            self.0.encode(encoder, offset + 0, depth)?;
12689            Ok(())
12690        }
12691    }
12692
12693    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12694        for MsiResourceGetResponse
12695    {
12696        #[inline(always)]
12697        fn new_empty() -> Self {
12698            Self {
12699                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12700            }
12701        }
12702
12703        #[inline]
12704        unsafe fn decode(
12705            &mut self,
12706            decoder: &mut fidl::encoding::Decoder<
12707                '_,
12708                fidl::encoding::DefaultFuchsiaResourceDialect,
12709            >,
12710            offset: usize,
12711            _depth: fidl::encoding::Depth,
12712        ) -> fidl::Result<()> {
12713            decoder.debug_check_bounds::<Self>(offset);
12714            // Verify that padding bytes are zero.
12715            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12716            Ok(())
12717        }
12718    }
12719
12720    impl fidl::encoding::ResourceTypeMarker for PowerResourceGetResponse {
12721        type Borrowed<'a> = &'a mut Self;
12722        fn take_or_borrow<'a>(
12723            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12724        ) -> Self::Borrowed<'a> {
12725            value
12726        }
12727    }
12728
12729    unsafe impl fidl::encoding::TypeMarker for PowerResourceGetResponse {
12730        type Owned = Self;
12731
12732        #[inline(always)]
12733        fn inline_align(_context: fidl::encoding::Context) -> usize {
12734            4
12735        }
12736
12737        #[inline(always)]
12738        fn inline_size(_context: fidl::encoding::Context) -> usize {
12739            4
12740        }
12741    }
12742
12743    unsafe impl
12744        fidl::encoding::Encode<
12745            PowerResourceGetResponse,
12746            fidl::encoding::DefaultFuchsiaResourceDialect,
12747        > for &mut PowerResourceGetResponse
12748    {
12749        #[inline]
12750        unsafe fn encode(
12751            self,
12752            encoder: &mut fidl::encoding::Encoder<
12753                '_,
12754                fidl::encoding::DefaultFuchsiaResourceDialect,
12755            >,
12756            offset: usize,
12757            _depth: fidl::encoding::Depth,
12758        ) -> fidl::Result<()> {
12759            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
12760            // Delegate to tuple encoding.
12761            fidl::encoding::Encode::<
12762                PowerResourceGetResponse,
12763                fidl::encoding::DefaultFuchsiaResourceDialect,
12764            >::encode(
12765                (<fidl::encoding::HandleType<
12766                    fidl::Resource,
12767                    { fidl::ObjectType::RESOURCE.into_raw() },
12768                    2147483648,
12769                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12770                    &mut self.resource
12771                ),),
12772                encoder,
12773                offset,
12774                _depth,
12775            )
12776        }
12777    }
12778    unsafe impl<
12779        T0: fidl::encoding::Encode<
12780                fidl::encoding::HandleType<
12781                    fidl::Resource,
12782                    { fidl::ObjectType::RESOURCE.into_raw() },
12783                    2147483648,
12784                >,
12785                fidl::encoding::DefaultFuchsiaResourceDialect,
12786            >,
12787    >
12788        fidl::encoding::Encode<
12789            PowerResourceGetResponse,
12790            fidl::encoding::DefaultFuchsiaResourceDialect,
12791        > for (T0,)
12792    {
12793        #[inline]
12794        unsafe fn encode(
12795            self,
12796            encoder: &mut fidl::encoding::Encoder<
12797                '_,
12798                fidl::encoding::DefaultFuchsiaResourceDialect,
12799            >,
12800            offset: usize,
12801            depth: fidl::encoding::Depth,
12802        ) -> fidl::Result<()> {
12803            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
12804            // Zero out padding regions. There's no need to apply masks
12805            // because the unmasked parts will be overwritten by fields.
12806            // Write the fields.
12807            self.0.encode(encoder, offset + 0, depth)?;
12808            Ok(())
12809        }
12810    }
12811
12812    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12813        for PowerResourceGetResponse
12814    {
12815        #[inline(always)]
12816        fn new_empty() -> Self {
12817            Self {
12818                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12819            }
12820        }
12821
12822        #[inline]
12823        unsafe fn decode(
12824            &mut self,
12825            decoder: &mut fidl::encoding::Decoder<
12826                '_,
12827                fidl::encoding::DefaultFuchsiaResourceDialect,
12828            >,
12829            offset: usize,
12830            _depth: fidl::encoding::Depth,
12831        ) -> fidl::Result<()> {
12832            decoder.debug_check_bounds::<Self>(offset);
12833            // Verify that padding bytes are zero.
12834            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12835            Ok(())
12836        }
12837    }
12838
12839    impl fidl::encoding::ResourceTypeMarker for ProfileResourceGetResponse {
12840        type Borrowed<'a> = &'a mut Self;
12841        fn take_or_borrow<'a>(
12842            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12843        ) -> Self::Borrowed<'a> {
12844            value
12845        }
12846    }
12847
12848    unsafe impl fidl::encoding::TypeMarker for ProfileResourceGetResponse {
12849        type Owned = Self;
12850
12851        #[inline(always)]
12852        fn inline_align(_context: fidl::encoding::Context) -> usize {
12853            4
12854        }
12855
12856        #[inline(always)]
12857        fn inline_size(_context: fidl::encoding::Context) -> usize {
12858            4
12859        }
12860    }
12861
12862    unsafe impl
12863        fidl::encoding::Encode<
12864            ProfileResourceGetResponse,
12865            fidl::encoding::DefaultFuchsiaResourceDialect,
12866        > for &mut ProfileResourceGetResponse
12867    {
12868        #[inline]
12869        unsafe fn encode(
12870            self,
12871            encoder: &mut fidl::encoding::Encoder<
12872                '_,
12873                fidl::encoding::DefaultFuchsiaResourceDialect,
12874            >,
12875            offset: usize,
12876            _depth: fidl::encoding::Depth,
12877        ) -> fidl::Result<()> {
12878            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
12879            // Delegate to tuple encoding.
12880            fidl::encoding::Encode::<
12881                ProfileResourceGetResponse,
12882                fidl::encoding::DefaultFuchsiaResourceDialect,
12883            >::encode(
12884                (<fidl::encoding::HandleType<
12885                    fidl::Resource,
12886                    { fidl::ObjectType::RESOURCE.into_raw() },
12887                    2147483648,
12888                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12889                    &mut self.resource
12890                ),),
12891                encoder,
12892                offset,
12893                _depth,
12894            )
12895        }
12896    }
12897    unsafe impl<
12898        T0: fidl::encoding::Encode<
12899                fidl::encoding::HandleType<
12900                    fidl::Resource,
12901                    { fidl::ObjectType::RESOURCE.into_raw() },
12902                    2147483648,
12903                >,
12904                fidl::encoding::DefaultFuchsiaResourceDialect,
12905            >,
12906    >
12907        fidl::encoding::Encode<
12908            ProfileResourceGetResponse,
12909            fidl::encoding::DefaultFuchsiaResourceDialect,
12910        > for (T0,)
12911    {
12912        #[inline]
12913        unsafe fn encode(
12914            self,
12915            encoder: &mut fidl::encoding::Encoder<
12916                '_,
12917                fidl::encoding::DefaultFuchsiaResourceDialect,
12918            >,
12919            offset: usize,
12920            depth: fidl::encoding::Depth,
12921        ) -> fidl::Result<()> {
12922            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
12923            // Zero out padding regions. There's no need to apply masks
12924            // because the unmasked parts will be overwritten by fields.
12925            // Write the fields.
12926            self.0.encode(encoder, offset + 0, depth)?;
12927            Ok(())
12928        }
12929    }
12930
12931    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12932        for ProfileResourceGetResponse
12933    {
12934        #[inline(always)]
12935        fn new_empty() -> Self {
12936            Self {
12937                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12938            }
12939        }
12940
12941        #[inline]
12942        unsafe fn decode(
12943            &mut self,
12944            decoder: &mut fidl::encoding::Decoder<
12945                '_,
12946                fidl::encoding::DefaultFuchsiaResourceDialect,
12947            >,
12948            offset: usize,
12949            _depth: fidl::encoding::Depth,
12950        ) -> fidl::Result<()> {
12951            decoder.debug_check_bounds::<Self>(offset);
12952            // Verify that padding bytes are zero.
12953            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12954            Ok(())
12955        }
12956    }
12957
12958    impl fidl::encoding::ResourceTypeMarker for RootJobGetResponse {
12959        type Borrowed<'a> = &'a mut Self;
12960        fn take_or_borrow<'a>(
12961            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12962        ) -> Self::Borrowed<'a> {
12963            value
12964        }
12965    }
12966
12967    unsafe impl fidl::encoding::TypeMarker for RootJobGetResponse {
12968        type Owned = Self;
12969
12970        #[inline(always)]
12971        fn inline_align(_context: fidl::encoding::Context) -> usize {
12972            4
12973        }
12974
12975        #[inline(always)]
12976        fn inline_size(_context: fidl::encoding::Context) -> usize {
12977            4
12978        }
12979    }
12980
12981    unsafe impl
12982        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
12983        for &mut RootJobGetResponse
12984    {
12985        #[inline]
12986        unsafe fn encode(
12987            self,
12988            encoder: &mut fidl::encoding::Encoder<
12989                '_,
12990                fidl::encoding::DefaultFuchsiaResourceDialect,
12991            >,
12992            offset: usize,
12993            _depth: fidl::encoding::Depth,
12994        ) -> fidl::Result<()> {
12995            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
12996            // Delegate to tuple encoding.
12997            fidl::encoding::Encode::<
12998                RootJobGetResponse,
12999                fidl::encoding::DefaultFuchsiaResourceDialect,
13000            >::encode(
13001                (<fidl::encoding::HandleType<
13002                    fidl::Job,
13003                    { fidl::ObjectType::JOB.into_raw() },
13004                    2147483648,
13005                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13006                    &mut self.job
13007                ),),
13008                encoder,
13009                offset,
13010                _depth,
13011            )
13012        }
13013    }
13014    unsafe impl<
13015        T0: fidl::encoding::Encode<
13016                fidl::encoding::HandleType<
13017                    fidl::Job,
13018                    { fidl::ObjectType::JOB.into_raw() },
13019                    2147483648,
13020                >,
13021                fidl::encoding::DefaultFuchsiaResourceDialect,
13022            >,
13023    > fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13024        for (T0,)
13025    {
13026        #[inline]
13027        unsafe fn encode(
13028            self,
13029            encoder: &mut fidl::encoding::Encoder<
13030                '_,
13031                fidl::encoding::DefaultFuchsiaResourceDialect,
13032            >,
13033            offset: usize,
13034            depth: fidl::encoding::Depth,
13035        ) -> fidl::Result<()> {
13036            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13037            // Zero out padding regions. There's no need to apply masks
13038            // because the unmasked parts will be overwritten by fields.
13039            // Write the fields.
13040            self.0.encode(encoder, offset + 0, depth)?;
13041            Ok(())
13042        }
13043    }
13044
13045    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13046        for RootJobGetResponse
13047    {
13048        #[inline(always)]
13049        fn new_empty() -> Self {
13050            Self {
13051                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13052            }
13053        }
13054
13055        #[inline]
13056        unsafe fn decode(
13057            &mut self,
13058            decoder: &mut fidl::encoding::Decoder<
13059                '_,
13060                fidl::encoding::DefaultFuchsiaResourceDialect,
13061            >,
13062            offset: usize,
13063            _depth: fidl::encoding::Depth,
13064        ) -> fidl::Result<()> {
13065            decoder.debug_check_bounds::<Self>(offset);
13066            // Verify that padding bytes are zero.
13067            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
13068            Ok(())
13069        }
13070    }
13071
13072    impl fidl::encoding::ResourceTypeMarker for SmcResourceGetResponse {
13073        type Borrowed<'a> = &'a mut Self;
13074        fn take_or_borrow<'a>(
13075            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13076        ) -> Self::Borrowed<'a> {
13077            value
13078        }
13079    }
13080
13081    unsafe impl fidl::encoding::TypeMarker for SmcResourceGetResponse {
13082        type Owned = Self;
13083
13084        #[inline(always)]
13085        fn inline_align(_context: fidl::encoding::Context) -> usize {
13086            4
13087        }
13088
13089        #[inline(always)]
13090        fn inline_size(_context: fidl::encoding::Context) -> usize {
13091            4
13092        }
13093    }
13094
13095    unsafe impl
13096        fidl::encoding::Encode<
13097            SmcResourceGetResponse,
13098            fidl::encoding::DefaultFuchsiaResourceDialect,
13099        > for &mut SmcResourceGetResponse
13100    {
13101        #[inline]
13102        unsafe fn encode(
13103            self,
13104            encoder: &mut fidl::encoding::Encoder<
13105                '_,
13106                fidl::encoding::DefaultFuchsiaResourceDialect,
13107            >,
13108            offset: usize,
13109            _depth: fidl::encoding::Depth,
13110        ) -> fidl::Result<()> {
13111            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13112            // Delegate to tuple encoding.
13113            fidl::encoding::Encode::<
13114                SmcResourceGetResponse,
13115                fidl::encoding::DefaultFuchsiaResourceDialect,
13116            >::encode(
13117                (<fidl::encoding::HandleType<
13118                    fidl::Resource,
13119                    { fidl::ObjectType::RESOURCE.into_raw() },
13120                    2147483648,
13121                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13122                    &mut self.resource
13123                ),),
13124                encoder,
13125                offset,
13126                _depth,
13127            )
13128        }
13129    }
13130    unsafe impl<
13131        T0: fidl::encoding::Encode<
13132                fidl::encoding::HandleType<
13133                    fidl::Resource,
13134                    { fidl::ObjectType::RESOURCE.into_raw() },
13135                    2147483648,
13136                >,
13137                fidl::encoding::DefaultFuchsiaResourceDialect,
13138            >,
13139    >
13140        fidl::encoding::Encode<
13141            SmcResourceGetResponse,
13142            fidl::encoding::DefaultFuchsiaResourceDialect,
13143        > for (T0,)
13144    {
13145        #[inline]
13146        unsafe fn encode(
13147            self,
13148            encoder: &mut fidl::encoding::Encoder<
13149                '_,
13150                fidl::encoding::DefaultFuchsiaResourceDialect,
13151            >,
13152            offset: usize,
13153            depth: fidl::encoding::Depth,
13154        ) -> fidl::Result<()> {
13155            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13156            // Zero out padding regions. There's no need to apply masks
13157            // because the unmasked parts will be overwritten by fields.
13158            // Write the fields.
13159            self.0.encode(encoder, offset + 0, depth)?;
13160            Ok(())
13161        }
13162    }
13163
13164    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13165        for SmcResourceGetResponse
13166    {
13167        #[inline(always)]
13168        fn new_empty() -> Self {
13169            Self {
13170                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13171            }
13172        }
13173
13174        #[inline]
13175        unsafe fn decode(
13176            &mut self,
13177            decoder: &mut fidl::encoding::Decoder<
13178                '_,
13179                fidl::encoding::DefaultFuchsiaResourceDialect,
13180            >,
13181            offset: usize,
13182            _depth: fidl::encoding::Depth,
13183        ) -> fidl::Result<()> {
13184            decoder.debug_check_bounds::<Self>(offset);
13185            // Verify that padding bytes are zero.
13186            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13187            Ok(())
13188        }
13189    }
13190
13191    impl fidl::encoding::ResourceTypeMarker for StallResourceGetResponse {
13192        type Borrowed<'a> = &'a mut Self;
13193        fn take_or_borrow<'a>(
13194            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13195        ) -> Self::Borrowed<'a> {
13196            value
13197        }
13198    }
13199
13200    unsafe impl fidl::encoding::TypeMarker for StallResourceGetResponse {
13201        type Owned = Self;
13202
13203        #[inline(always)]
13204        fn inline_align(_context: fidl::encoding::Context) -> usize {
13205            4
13206        }
13207
13208        #[inline(always)]
13209        fn inline_size(_context: fidl::encoding::Context) -> usize {
13210            4
13211        }
13212    }
13213
13214    unsafe impl
13215        fidl::encoding::Encode<
13216            StallResourceGetResponse,
13217            fidl::encoding::DefaultFuchsiaResourceDialect,
13218        > for &mut StallResourceGetResponse
13219    {
13220        #[inline]
13221        unsafe fn encode(
13222            self,
13223            encoder: &mut fidl::encoding::Encoder<
13224                '_,
13225                fidl::encoding::DefaultFuchsiaResourceDialect,
13226            >,
13227            offset: usize,
13228            _depth: fidl::encoding::Depth,
13229        ) -> fidl::Result<()> {
13230            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13231            // Delegate to tuple encoding.
13232            fidl::encoding::Encode::<
13233                StallResourceGetResponse,
13234                fidl::encoding::DefaultFuchsiaResourceDialect,
13235            >::encode(
13236                (<fidl::encoding::HandleType<
13237                    fidl::Resource,
13238                    { fidl::ObjectType::RESOURCE.into_raw() },
13239                    2147483648,
13240                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13241                    &mut self.resource
13242                ),),
13243                encoder,
13244                offset,
13245                _depth,
13246            )
13247        }
13248    }
13249    unsafe impl<
13250        T0: fidl::encoding::Encode<
13251                fidl::encoding::HandleType<
13252                    fidl::Resource,
13253                    { fidl::ObjectType::RESOURCE.into_raw() },
13254                    2147483648,
13255                >,
13256                fidl::encoding::DefaultFuchsiaResourceDialect,
13257            >,
13258    >
13259        fidl::encoding::Encode<
13260            StallResourceGetResponse,
13261            fidl::encoding::DefaultFuchsiaResourceDialect,
13262        > for (T0,)
13263    {
13264        #[inline]
13265        unsafe fn encode(
13266            self,
13267            encoder: &mut fidl::encoding::Encoder<
13268                '_,
13269                fidl::encoding::DefaultFuchsiaResourceDialect,
13270            >,
13271            offset: usize,
13272            depth: fidl::encoding::Depth,
13273        ) -> fidl::Result<()> {
13274            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13275            // Zero out padding regions. There's no need to apply masks
13276            // because the unmasked parts will be overwritten by fields.
13277            // Write the fields.
13278            self.0.encode(encoder, offset + 0, depth)?;
13279            Ok(())
13280        }
13281    }
13282
13283    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13284        for StallResourceGetResponse
13285    {
13286        #[inline(always)]
13287        fn new_empty() -> Self {
13288            Self {
13289                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13290            }
13291        }
13292
13293        #[inline]
13294        unsafe fn decode(
13295            &mut self,
13296            decoder: &mut fidl::encoding::Decoder<
13297                '_,
13298                fidl::encoding::DefaultFuchsiaResourceDialect,
13299            >,
13300            offset: usize,
13301            _depth: fidl::encoding::Depth,
13302        ) -> fidl::Result<()> {
13303            decoder.debug_check_bounds::<Self>(offset);
13304            // Verify that padding bytes are zero.
13305            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13306            Ok(())
13307        }
13308    }
13309
13310    impl fidl::encoding::ResourceTypeMarker for TracingResourceGetResponse {
13311        type Borrowed<'a> = &'a mut Self;
13312        fn take_or_borrow<'a>(
13313            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13314        ) -> Self::Borrowed<'a> {
13315            value
13316        }
13317    }
13318
13319    unsafe impl fidl::encoding::TypeMarker for TracingResourceGetResponse {
13320        type Owned = Self;
13321
13322        #[inline(always)]
13323        fn inline_align(_context: fidl::encoding::Context) -> usize {
13324            4
13325        }
13326
13327        #[inline(always)]
13328        fn inline_size(_context: fidl::encoding::Context) -> usize {
13329            4
13330        }
13331    }
13332
13333    unsafe impl
13334        fidl::encoding::Encode<
13335            TracingResourceGetResponse,
13336            fidl::encoding::DefaultFuchsiaResourceDialect,
13337        > for &mut TracingResourceGetResponse
13338    {
13339        #[inline]
13340        unsafe fn encode(
13341            self,
13342            encoder: &mut fidl::encoding::Encoder<
13343                '_,
13344                fidl::encoding::DefaultFuchsiaResourceDialect,
13345            >,
13346            offset: usize,
13347            _depth: fidl::encoding::Depth,
13348        ) -> fidl::Result<()> {
13349            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13350            // Delegate to tuple encoding.
13351            fidl::encoding::Encode::<
13352                TracingResourceGetResponse,
13353                fidl::encoding::DefaultFuchsiaResourceDialect,
13354            >::encode(
13355                (<fidl::encoding::HandleType<
13356                    fidl::Resource,
13357                    { fidl::ObjectType::RESOURCE.into_raw() },
13358                    2147483648,
13359                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13360                    &mut self.resource
13361                ),),
13362                encoder,
13363                offset,
13364                _depth,
13365            )
13366        }
13367    }
13368    unsafe impl<
13369        T0: fidl::encoding::Encode<
13370                fidl::encoding::HandleType<
13371                    fidl::Resource,
13372                    { fidl::ObjectType::RESOURCE.into_raw() },
13373                    2147483648,
13374                >,
13375                fidl::encoding::DefaultFuchsiaResourceDialect,
13376            >,
13377    >
13378        fidl::encoding::Encode<
13379            TracingResourceGetResponse,
13380            fidl::encoding::DefaultFuchsiaResourceDialect,
13381        > for (T0,)
13382    {
13383        #[inline]
13384        unsafe fn encode(
13385            self,
13386            encoder: &mut fidl::encoding::Encoder<
13387                '_,
13388                fidl::encoding::DefaultFuchsiaResourceDialect,
13389            >,
13390            offset: usize,
13391            depth: fidl::encoding::Depth,
13392        ) -> fidl::Result<()> {
13393            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13394            // Zero out padding regions. There's no need to apply masks
13395            // because the unmasked parts will be overwritten by fields.
13396            // Write the fields.
13397            self.0.encode(encoder, offset + 0, depth)?;
13398            Ok(())
13399        }
13400    }
13401
13402    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13403        for TracingResourceGetResponse
13404    {
13405        #[inline(always)]
13406        fn new_empty() -> Self {
13407            Self {
13408                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13409            }
13410        }
13411
13412        #[inline]
13413        unsafe fn decode(
13414            &mut self,
13415            decoder: &mut fidl::encoding::Decoder<
13416                '_,
13417                fidl::encoding::DefaultFuchsiaResourceDialect,
13418            >,
13419            offset: usize,
13420            _depth: fidl::encoding::Depth,
13421        ) -> fidl::Result<()> {
13422            decoder.debug_check_bounds::<Self>(offset);
13423            // Verify that padding bytes are zero.
13424            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13425            Ok(())
13426        }
13427    }
13428
13429    impl fidl::encoding::ResourceTypeMarker for VmexResourceGetResponse {
13430        type Borrowed<'a> = &'a mut Self;
13431        fn take_or_borrow<'a>(
13432            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13433        ) -> Self::Borrowed<'a> {
13434            value
13435        }
13436    }
13437
13438    unsafe impl fidl::encoding::TypeMarker for VmexResourceGetResponse {
13439        type Owned = Self;
13440
13441        #[inline(always)]
13442        fn inline_align(_context: fidl::encoding::Context) -> usize {
13443            4
13444        }
13445
13446        #[inline(always)]
13447        fn inline_size(_context: fidl::encoding::Context) -> usize {
13448            4
13449        }
13450    }
13451
13452    unsafe impl
13453        fidl::encoding::Encode<
13454            VmexResourceGetResponse,
13455            fidl::encoding::DefaultFuchsiaResourceDialect,
13456        > for &mut VmexResourceGetResponse
13457    {
13458        #[inline]
13459        unsafe fn encode(
13460            self,
13461            encoder: &mut fidl::encoding::Encoder<
13462                '_,
13463                fidl::encoding::DefaultFuchsiaResourceDialect,
13464            >,
13465            offset: usize,
13466            _depth: fidl::encoding::Depth,
13467        ) -> fidl::Result<()> {
13468            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
13469            // Delegate to tuple encoding.
13470            fidl::encoding::Encode::<
13471                VmexResourceGetResponse,
13472                fidl::encoding::DefaultFuchsiaResourceDialect,
13473            >::encode(
13474                (<fidl::encoding::HandleType<
13475                    fidl::Resource,
13476                    { fidl::ObjectType::RESOURCE.into_raw() },
13477                    2147483648,
13478                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13479                    &mut self.resource
13480                ),),
13481                encoder,
13482                offset,
13483                _depth,
13484            )
13485        }
13486    }
13487    unsafe impl<
13488        T0: fidl::encoding::Encode<
13489                fidl::encoding::HandleType<
13490                    fidl::Resource,
13491                    { fidl::ObjectType::RESOURCE.into_raw() },
13492                    2147483648,
13493                >,
13494                fidl::encoding::DefaultFuchsiaResourceDialect,
13495            >,
13496    >
13497        fidl::encoding::Encode<
13498            VmexResourceGetResponse,
13499            fidl::encoding::DefaultFuchsiaResourceDialect,
13500        > for (T0,)
13501    {
13502        #[inline]
13503        unsafe fn encode(
13504            self,
13505            encoder: &mut fidl::encoding::Encoder<
13506                '_,
13507                fidl::encoding::DefaultFuchsiaResourceDialect,
13508            >,
13509            offset: usize,
13510            depth: fidl::encoding::Depth,
13511        ) -> fidl::Result<()> {
13512            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
13513            // Zero out padding regions. There's no need to apply masks
13514            // because the unmasked parts will be overwritten by fields.
13515            // Write the fields.
13516            self.0.encode(encoder, offset + 0, depth)?;
13517            Ok(())
13518        }
13519    }
13520
13521    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13522        for VmexResourceGetResponse
13523    {
13524        #[inline(always)]
13525        fn new_empty() -> Self {
13526            Self {
13527                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13528            }
13529        }
13530
13531        #[inline]
13532        unsafe fn decode(
13533            &mut self,
13534            decoder: &mut fidl::encoding::Decoder<
13535                '_,
13536                fidl::encoding::DefaultFuchsiaResourceDialect,
13537            >,
13538            offset: usize,
13539            _depth: fidl::encoding::Depth,
13540        ) -> fidl::Result<()> {
13541            decoder.debug_check_bounds::<Self>(offset);
13542            // Verify that padding bytes are zero.
13543            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13544            Ok(())
13545        }
13546    }
13547}