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 {
1108            Some((responder))
1109        } else {
1110            None
1111        }
1112    }
1113
1114    /// Name of the method defined in FIDL
1115    pub fn method_name(&self) -> &'static str {
1116        match *self {
1117            CpuResourceRequest::Get { .. } => "get",
1118        }
1119    }
1120}
1121
1122#[derive(Debug, Clone)]
1123pub struct CpuResourceControlHandle {
1124    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1125}
1126
1127impl fidl::endpoints::ControlHandle for CpuResourceControlHandle {
1128    fn shutdown(&self) {
1129        self.inner.shutdown()
1130    }
1131    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1132        self.inner.shutdown_with_epitaph(status)
1133    }
1134
1135    fn is_closed(&self) -> bool {
1136        self.inner.channel().is_closed()
1137    }
1138    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1139        self.inner.channel().on_closed()
1140    }
1141
1142    #[cfg(target_os = "fuchsia")]
1143    fn signal_peer(
1144        &self,
1145        clear_mask: zx::Signals,
1146        set_mask: zx::Signals,
1147    ) -> Result<(), zx_status::Status> {
1148        use fidl::Peered;
1149        self.inner.channel().signal_peer(clear_mask, set_mask)
1150    }
1151}
1152
1153impl CpuResourceControlHandle {}
1154
1155#[must_use = "FIDL methods require a response to be sent"]
1156#[derive(Debug)]
1157pub struct CpuResourceGetResponder {
1158    control_handle: std::mem::ManuallyDrop<CpuResourceControlHandle>,
1159    tx_id: u32,
1160}
1161
1162/// Set the the channel to be shutdown (see [`CpuResourceControlHandle::shutdown`])
1163/// if the responder is dropped without sending a response, so that the client
1164/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1165impl std::ops::Drop for CpuResourceGetResponder {
1166    fn drop(&mut self) {
1167        self.control_handle.shutdown();
1168        // Safety: drops once, never accessed again
1169        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1170    }
1171}
1172
1173impl fidl::endpoints::Responder for CpuResourceGetResponder {
1174    type ControlHandle = CpuResourceControlHandle;
1175
1176    fn control_handle(&self) -> &CpuResourceControlHandle {
1177        &self.control_handle
1178    }
1179
1180    fn drop_without_shutdown(mut self) {
1181        // Safety: drops once, never accessed again due to mem::forget
1182        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1183        // Prevent Drop from running (which would shut down the channel)
1184        std::mem::forget(self);
1185    }
1186}
1187
1188impl CpuResourceGetResponder {
1189    /// Sends a response to the FIDL transaction.
1190    ///
1191    /// Sets the channel to shutdown if an error occurs.
1192    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1193        let _result = self.send_raw(resource);
1194        if _result.is_err() {
1195            self.control_handle.shutdown();
1196        }
1197        self.drop_without_shutdown();
1198        _result
1199    }
1200
1201    /// Similar to "send" but does not shutdown the channel if an error occurs.
1202    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1203        let _result = self.send_raw(resource);
1204        self.drop_without_shutdown();
1205        _result
1206    }
1207
1208    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1209        self.control_handle.inner.send::<CpuResourceGetResponse>(
1210            (resource,),
1211            self.tx_id,
1212            0x41e1103acf4215e4,
1213            fidl::encoding::DynamicFlags::empty(),
1214        )
1215    }
1216}
1217
1218#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1219pub struct DebugBrokerMarker;
1220
1221impl fidl::endpoints::ProtocolMarker for DebugBrokerMarker {
1222    type Proxy = DebugBrokerProxy;
1223    type RequestStream = DebugBrokerRequestStream;
1224    #[cfg(target_os = "fuchsia")]
1225    type SynchronousProxy = DebugBrokerSynchronousProxy;
1226
1227    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugBroker";
1228}
1229impl fidl::endpoints::DiscoverableProtocolMarker for DebugBrokerMarker {}
1230
1231pub trait DebugBrokerProxyInterface: Send + Sync {
1232    type SendDebugCommandResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1233    fn r#send_debug_command(&self, command: &str) -> Self::SendDebugCommandResponseFut;
1234    type SetTracingEnabledResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1235    fn r#set_tracing_enabled(&self, enabled: bool) -> Self::SetTracingEnabledResponseFut;
1236}
1237#[derive(Debug)]
1238#[cfg(target_os = "fuchsia")]
1239pub struct DebugBrokerSynchronousProxy {
1240    client: fidl::client::sync::Client,
1241}
1242
1243#[cfg(target_os = "fuchsia")]
1244impl fidl::endpoints::SynchronousProxy for DebugBrokerSynchronousProxy {
1245    type Proxy = DebugBrokerProxy;
1246    type Protocol = DebugBrokerMarker;
1247
1248    fn from_channel(inner: fidl::Channel) -> Self {
1249        Self::new(inner)
1250    }
1251
1252    fn into_channel(self) -> fidl::Channel {
1253        self.client.into_channel()
1254    }
1255
1256    fn as_channel(&self) -> &fidl::Channel {
1257        self.client.as_channel()
1258    }
1259}
1260
1261#[cfg(target_os = "fuchsia")]
1262impl DebugBrokerSynchronousProxy {
1263    pub fn new(channel: fidl::Channel) -> Self {
1264        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1265        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1266    }
1267
1268    pub fn into_channel(self) -> fidl::Channel {
1269        self.client.into_channel()
1270    }
1271
1272    /// Waits until an event arrives and returns it. It is safe for other
1273    /// threads to make concurrent requests while waiting for an event.
1274    pub fn wait_for_event(
1275        &self,
1276        deadline: zx::MonotonicInstant,
1277    ) -> Result<DebugBrokerEvent, fidl::Error> {
1278        DebugBrokerEvent::decode(self.client.wait_for_event(deadline)?)
1279    }
1280
1281    /// Pass debug command through to the kernel shell.
1282    /// Look at zx_debug_send_command syscall handling to find valid values.
1283    pub fn r#send_debug_command(
1284        &self,
1285        mut command: &str,
1286        ___deadline: zx::MonotonicInstant,
1287    ) -> Result<i32, fidl::Error> {
1288        let _response = self
1289            .client
1290            .send_query::<DebugBrokerSendDebugCommandRequest, DebugBrokerSendDebugCommandResponse>(
1291                (command,),
1292                0x1ee270f83b5d6ff6,
1293                fidl::encoding::DynamicFlags::empty(),
1294                ___deadline,
1295            )?;
1296        Ok(_response.status)
1297    }
1298
1299    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1300    pub fn r#set_tracing_enabled(
1301        &self,
1302        mut enabled: bool,
1303        ___deadline: zx::MonotonicInstant,
1304    ) -> Result<i32, fidl::Error> {
1305        let _response = self.client.send_query::<
1306            DebugBrokerSetTracingEnabledRequest,
1307            DebugBrokerSetTracingEnabledResponse,
1308        >(
1309            (enabled,),
1310            0x12e368d05329b30e,
1311            fidl::encoding::DynamicFlags::empty(),
1312            ___deadline,
1313        )?;
1314        Ok(_response.status)
1315    }
1316}
1317
1318#[cfg(target_os = "fuchsia")]
1319impl From<DebugBrokerSynchronousProxy> for zx::Handle {
1320    fn from(value: DebugBrokerSynchronousProxy) -> Self {
1321        value.into_channel().into()
1322    }
1323}
1324
1325#[cfg(target_os = "fuchsia")]
1326impl From<fidl::Channel> for DebugBrokerSynchronousProxy {
1327    fn from(value: fidl::Channel) -> Self {
1328        Self::new(value)
1329    }
1330}
1331
1332#[cfg(target_os = "fuchsia")]
1333impl fidl::endpoints::FromClient for DebugBrokerSynchronousProxy {
1334    type Protocol = DebugBrokerMarker;
1335
1336    fn from_client(value: fidl::endpoints::ClientEnd<DebugBrokerMarker>) -> Self {
1337        Self::new(value.into_channel())
1338    }
1339}
1340
1341#[derive(Debug, Clone)]
1342pub struct DebugBrokerProxy {
1343    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1344}
1345
1346impl fidl::endpoints::Proxy for DebugBrokerProxy {
1347    type Protocol = DebugBrokerMarker;
1348
1349    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1350        Self::new(inner)
1351    }
1352
1353    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1354        self.client.into_channel().map_err(|client| Self { client })
1355    }
1356
1357    fn as_channel(&self) -> &::fidl::AsyncChannel {
1358        self.client.as_channel()
1359    }
1360}
1361
1362impl DebugBrokerProxy {
1363    /// Create a new Proxy for fuchsia.kernel/DebugBroker.
1364    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1365        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1366        Self { client: fidl::client::Client::new(channel, protocol_name) }
1367    }
1368
1369    /// Get a Stream of events from the remote end of the protocol.
1370    ///
1371    /// # Panics
1372    ///
1373    /// Panics if the event stream was already taken.
1374    pub fn take_event_stream(&self) -> DebugBrokerEventStream {
1375        DebugBrokerEventStream { event_receiver: self.client.take_event_receiver() }
1376    }
1377
1378    /// Pass debug command through to the kernel shell.
1379    /// Look at zx_debug_send_command syscall handling to find valid values.
1380    pub fn r#send_debug_command(
1381        &self,
1382        mut command: &str,
1383    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1384        DebugBrokerProxyInterface::r#send_debug_command(self, command)
1385    }
1386
1387    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1388    pub fn r#set_tracing_enabled(
1389        &self,
1390        mut enabled: bool,
1391    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1392        DebugBrokerProxyInterface::r#set_tracing_enabled(self, enabled)
1393    }
1394}
1395
1396impl DebugBrokerProxyInterface for DebugBrokerProxy {
1397    type SendDebugCommandResponseFut =
1398        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1399    fn r#send_debug_command(&self, mut command: &str) -> Self::SendDebugCommandResponseFut {
1400        fn _decode(
1401            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1402        ) -> Result<i32, fidl::Error> {
1403            let _response = fidl::client::decode_transaction_body::<
1404                DebugBrokerSendDebugCommandResponse,
1405                fidl::encoding::DefaultFuchsiaResourceDialect,
1406                0x1ee270f83b5d6ff6,
1407            >(_buf?)?;
1408            Ok(_response.status)
1409        }
1410        self.client.send_query_and_decode::<DebugBrokerSendDebugCommandRequest, i32>(
1411            (command,),
1412            0x1ee270f83b5d6ff6,
1413            fidl::encoding::DynamicFlags::empty(),
1414            _decode,
1415        )
1416    }
1417
1418    type SetTracingEnabledResponseFut =
1419        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1420    fn r#set_tracing_enabled(&self, mut enabled: bool) -> Self::SetTracingEnabledResponseFut {
1421        fn _decode(
1422            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1423        ) -> Result<i32, fidl::Error> {
1424            let _response = fidl::client::decode_transaction_body::<
1425                DebugBrokerSetTracingEnabledResponse,
1426                fidl::encoding::DefaultFuchsiaResourceDialect,
1427                0x12e368d05329b30e,
1428            >(_buf?)?;
1429            Ok(_response.status)
1430        }
1431        self.client.send_query_and_decode::<DebugBrokerSetTracingEnabledRequest, i32>(
1432            (enabled,),
1433            0x12e368d05329b30e,
1434            fidl::encoding::DynamicFlags::empty(),
1435            _decode,
1436        )
1437    }
1438}
1439
1440pub struct DebugBrokerEventStream {
1441    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1442}
1443
1444impl std::marker::Unpin for DebugBrokerEventStream {}
1445
1446impl futures::stream::FusedStream for DebugBrokerEventStream {
1447    fn is_terminated(&self) -> bool {
1448        self.event_receiver.is_terminated()
1449    }
1450}
1451
1452impl futures::Stream for DebugBrokerEventStream {
1453    type Item = Result<DebugBrokerEvent, fidl::Error>;
1454
1455    fn poll_next(
1456        mut self: std::pin::Pin<&mut Self>,
1457        cx: &mut std::task::Context<'_>,
1458    ) -> std::task::Poll<Option<Self::Item>> {
1459        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1460            &mut self.event_receiver,
1461            cx
1462        )?) {
1463            Some(buf) => std::task::Poll::Ready(Some(DebugBrokerEvent::decode(buf))),
1464            None => std::task::Poll::Ready(None),
1465        }
1466    }
1467}
1468
1469#[derive(Debug)]
1470pub enum DebugBrokerEvent {}
1471
1472impl DebugBrokerEvent {
1473    /// Decodes a message buffer as a [`DebugBrokerEvent`].
1474    fn decode(
1475        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1476    ) -> Result<DebugBrokerEvent, fidl::Error> {
1477        let (bytes, _handles) = buf.split_mut();
1478        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1479        debug_assert_eq!(tx_header.tx_id, 0);
1480        match tx_header.ordinal {
1481            _ => Err(fidl::Error::UnknownOrdinal {
1482                ordinal: tx_header.ordinal,
1483                protocol_name: <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1484            }),
1485        }
1486    }
1487}
1488
1489/// A Stream of incoming requests for fuchsia.kernel/DebugBroker.
1490pub struct DebugBrokerRequestStream {
1491    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1492    is_terminated: bool,
1493}
1494
1495impl std::marker::Unpin for DebugBrokerRequestStream {}
1496
1497impl futures::stream::FusedStream for DebugBrokerRequestStream {
1498    fn is_terminated(&self) -> bool {
1499        self.is_terminated
1500    }
1501}
1502
1503impl fidl::endpoints::RequestStream for DebugBrokerRequestStream {
1504    type Protocol = DebugBrokerMarker;
1505    type ControlHandle = DebugBrokerControlHandle;
1506
1507    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1508        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1509    }
1510
1511    fn control_handle(&self) -> Self::ControlHandle {
1512        DebugBrokerControlHandle { inner: self.inner.clone() }
1513    }
1514
1515    fn into_inner(
1516        self,
1517    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1518    {
1519        (self.inner, self.is_terminated)
1520    }
1521
1522    fn from_inner(
1523        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1524        is_terminated: bool,
1525    ) -> Self {
1526        Self { inner, is_terminated }
1527    }
1528}
1529
1530impl futures::Stream for DebugBrokerRequestStream {
1531    type Item = Result<DebugBrokerRequest, fidl::Error>;
1532
1533    fn poll_next(
1534        mut self: std::pin::Pin<&mut Self>,
1535        cx: &mut std::task::Context<'_>,
1536    ) -> std::task::Poll<Option<Self::Item>> {
1537        let this = &mut *self;
1538        if this.inner.check_shutdown(cx) {
1539            this.is_terminated = true;
1540            return std::task::Poll::Ready(None);
1541        }
1542        if this.is_terminated {
1543            panic!("polled DebugBrokerRequestStream after completion");
1544        }
1545        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1546            |bytes, handles| {
1547                match this.inner.channel().read_etc(cx, bytes, handles) {
1548                    std::task::Poll::Ready(Ok(())) => {}
1549                    std::task::Poll::Pending => return std::task::Poll::Pending,
1550                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1551                        this.is_terminated = true;
1552                        return std::task::Poll::Ready(None);
1553                    }
1554                    std::task::Poll::Ready(Err(e)) => {
1555                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1556                            e.into(),
1557                        ))))
1558                    }
1559                }
1560
1561                // A message has been received from the channel
1562                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1563
1564                std::task::Poll::Ready(Some(match header.ordinal {
1565                    0x1ee270f83b5d6ff6 => {
1566                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1567                        let mut req = fidl::new_empty!(
1568                            DebugBrokerSendDebugCommandRequest,
1569                            fidl::encoding::DefaultFuchsiaResourceDialect
1570                        );
1571                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSendDebugCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1572                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1573                        Ok(DebugBrokerRequest::SendDebugCommand {
1574                            command: req.command,
1575
1576                            responder: DebugBrokerSendDebugCommandResponder {
1577                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1578                                tx_id: header.tx_id,
1579                            },
1580                        })
1581                    }
1582                    0x12e368d05329b30e => {
1583                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1584                        let mut req = fidl::new_empty!(
1585                            DebugBrokerSetTracingEnabledRequest,
1586                            fidl::encoding::DefaultFuchsiaResourceDialect
1587                        );
1588                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSetTracingEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1589                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1590                        Ok(DebugBrokerRequest::SetTracingEnabled {
1591                            enabled: req.enabled,
1592
1593                            responder: DebugBrokerSetTracingEnabledResponder {
1594                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1595                                tx_id: header.tx_id,
1596                            },
1597                        })
1598                    }
1599                    _ => Err(fidl::Error::UnknownOrdinal {
1600                        ordinal: header.ordinal,
1601                        protocol_name:
1602                            <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1603                    }),
1604                }))
1605            },
1606        )
1607    }
1608}
1609
1610/// Acts on behalf of the caller to interact with privileged debug system calls.
1611#[derive(Debug)]
1612pub enum DebugBrokerRequest {
1613    /// Pass debug command through to the kernel shell.
1614    /// Look at zx_debug_send_command syscall handling to find valid values.
1615    SendDebugCommand { command: String, responder: DebugBrokerSendDebugCommandResponder },
1616    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1617    SetTracingEnabled { enabled: bool, responder: DebugBrokerSetTracingEnabledResponder },
1618}
1619
1620impl DebugBrokerRequest {
1621    #[allow(irrefutable_let_patterns)]
1622    pub fn into_send_debug_command(self) -> Option<(String, DebugBrokerSendDebugCommandResponder)> {
1623        if let DebugBrokerRequest::SendDebugCommand { command, responder } = self {
1624            Some((command, responder))
1625        } else {
1626            None
1627        }
1628    }
1629
1630    #[allow(irrefutable_let_patterns)]
1631    pub fn into_set_tracing_enabled(self) -> Option<(bool, DebugBrokerSetTracingEnabledResponder)> {
1632        if let DebugBrokerRequest::SetTracingEnabled { enabled, responder } = self {
1633            Some((enabled, responder))
1634        } else {
1635            None
1636        }
1637    }
1638
1639    /// Name of the method defined in FIDL
1640    pub fn method_name(&self) -> &'static str {
1641        match *self {
1642            DebugBrokerRequest::SendDebugCommand { .. } => "send_debug_command",
1643            DebugBrokerRequest::SetTracingEnabled { .. } => "set_tracing_enabled",
1644        }
1645    }
1646}
1647
1648#[derive(Debug, Clone)]
1649pub struct DebugBrokerControlHandle {
1650    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1651}
1652
1653impl fidl::endpoints::ControlHandle for DebugBrokerControlHandle {
1654    fn shutdown(&self) {
1655        self.inner.shutdown()
1656    }
1657    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1658        self.inner.shutdown_with_epitaph(status)
1659    }
1660
1661    fn is_closed(&self) -> bool {
1662        self.inner.channel().is_closed()
1663    }
1664    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1665        self.inner.channel().on_closed()
1666    }
1667
1668    #[cfg(target_os = "fuchsia")]
1669    fn signal_peer(
1670        &self,
1671        clear_mask: zx::Signals,
1672        set_mask: zx::Signals,
1673    ) -> Result<(), zx_status::Status> {
1674        use fidl::Peered;
1675        self.inner.channel().signal_peer(clear_mask, set_mask)
1676    }
1677}
1678
1679impl DebugBrokerControlHandle {}
1680
1681#[must_use = "FIDL methods require a response to be sent"]
1682#[derive(Debug)]
1683pub struct DebugBrokerSendDebugCommandResponder {
1684    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1685    tx_id: u32,
1686}
1687
1688/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1689/// if the responder is dropped without sending a response, so that the client
1690/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1691impl std::ops::Drop for DebugBrokerSendDebugCommandResponder {
1692    fn drop(&mut self) {
1693        self.control_handle.shutdown();
1694        // Safety: drops once, never accessed again
1695        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1696    }
1697}
1698
1699impl fidl::endpoints::Responder for DebugBrokerSendDebugCommandResponder {
1700    type ControlHandle = DebugBrokerControlHandle;
1701
1702    fn control_handle(&self) -> &DebugBrokerControlHandle {
1703        &self.control_handle
1704    }
1705
1706    fn drop_without_shutdown(mut self) {
1707        // Safety: drops once, never accessed again due to mem::forget
1708        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1709        // Prevent Drop from running (which would shut down the channel)
1710        std::mem::forget(self);
1711    }
1712}
1713
1714impl DebugBrokerSendDebugCommandResponder {
1715    /// Sends a response to the FIDL transaction.
1716    ///
1717    /// Sets the channel to shutdown if an error occurs.
1718    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1719        let _result = self.send_raw(status);
1720        if _result.is_err() {
1721            self.control_handle.shutdown();
1722        }
1723        self.drop_without_shutdown();
1724        _result
1725    }
1726
1727    /// Similar to "send" but does not shutdown the channel if an error occurs.
1728    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1729        let _result = self.send_raw(status);
1730        self.drop_without_shutdown();
1731        _result
1732    }
1733
1734    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1735        self.control_handle.inner.send::<DebugBrokerSendDebugCommandResponse>(
1736            (status,),
1737            self.tx_id,
1738            0x1ee270f83b5d6ff6,
1739            fidl::encoding::DynamicFlags::empty(),
1740        )
1741    }
1742}
1743
1744#[must_use = "FIDL methods require a response to be sent"]
1745#[derive(Debug)]
1746pub struct DebugBrokerSetTracingEnabledResponder {
1747    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1748    tx_id: u32,
1749}
1750
1751/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1752/// if the responder is dropped without sending a response, so that the client
1753/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1754impl std::ops::Drop for DebugBrokerSetTracingEnabledResponder {
1755    fn drop(&mut self) {
1756        self.control_handle.shutdown();
1757        // Safety: drops once, never accessed again
1758        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1759    }
1760}
1761
1762impl fidl::endpoints::Responder for DebugBrokerSetTracingEnabledResponder {
1763    type ControlHandle = DebugBrokerControlHandle;
1764
1765    fn control_handle(&self) -> &DebugBrokerControlHandle {
1766        &self.control_handle
1767    }
1768
1769    fn drop_without_shutdown(mut self) {
1770        // Safety: drops once, never accessed again due to mem::forget
1771        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1772        // Prevent Drop from running (which would shut down the channel)
1773        std::mem::forget(self);
1774    }
1775}
1776
1777impl DebugBrokerSetTracingEnabledResponder {
1778    /// Sends a response to the FIDL transaction.
1779    ///
1780    /// Sets the channel to shutdown if an error occurs.
1781    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1782        let _result = self.send_raw(status);
1783        if _result.is_err() {
1784            self.control_handle.shutdown();
1785        }
1786        self.drop_without_shutdown();
1787        _result
1788    }
1789
1790    /// Similar to "send" but does not shutdown the channel if an error occurs.
1791    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1792        let _result = self.send_raw(status);
1793        self.drop_without_shutdown();
1794        _result
1795    }
1796
1797    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1798        self.control_handle.inner.send::<DebugBrokerSetTracingEnabledResponse>(
1799            (status,),
1800            self.tx_id,
1801            0x12e368d05329b30e,
1802            fidl::encoding::DynamicFlags::empty(),
1803        )
1804    }
1805}
1806
1807#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1808pub struct DebugResourceMarker;
1809
1810impl fidl::endpoints::ProtocolMarker for DebugResourceMarker {
1811    type Proxy = DebugResourceProxy;
1812    type RequestStream = DebugResourceRequestStream;
1813    #[cfg(target_os = "fuchsia")]
1814    type SynchronousProxy = DebugResourceSynchronousProxy;
1815
1816    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugResource";
1817}
1818impl fidl::endpoints::DiscoverableProtocolMarker for DebugResourceMarker {}
1819
1820pub trait DebugResourceProxyInterface: Send + Sync {
1821    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
1822    fn r#get(&self) -> Self::GetResponseFut;
1823}
1824#[derive(Debug)]
1825#[cfg(target_os = "fuchsia")]
1826pub struct DebugResourceSynchronousProxy {
1827    client: fidl::client::sync::Client,
1828}
1829
1830#[cfg(target_os = "fuchsia")]
1831impl fidl::endpoints::SynchronousProxy for DebugResourceSynchronousProxy {
1832    type Proxy = DebugResourceProxy;
1833    type Protocol = DebugResourceMarker;
1834
1835    fn from_channel(inner: fidl::Channel) -> Self {
1836        Self::new(inner)
1837    }
1838
1839    fn into_channel(self) -> fidl::Channel {
1840        self.client.into_channel()
1841    }
1842
1843    fn as_channel(&self) -> &fidl::Channel {
1844        self.client.as_channel()
1845    }
1846}
1847
1848#[cfg(target_os = "fuchsia")]
1849impl DebugResourceSynchronousProxy {
1850    pub fn new(channel: fidl::Channel) -> Self {
1851        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1852        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1853    }
1854
1855    pub fn into_channel(self) -> fidl::Channel {
1856        self.client.into_channel()
1857    }
1858
1859    /// Waits until an event arrives and returns it. It is safe for other
1860    /// threads to make concurrent requests while waiting for an event.
1861    pub fn wait_for_event(
1862        &self,
1863        deadline: zx::MonotonicInstant,
1864    ) -> Result<DebugResourceEvent, fidl::Error> {
1865        DebugResourceEvent::decode(self.client.wait_for_event(deadline)?)
1866    }
1867
1868    /// Get a debug resource handle.
1869    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
1870        let _response =
1871            self.client.send_query::<fidl::encoding::EmptyPayload, DebugResourceGetResponse>(
1872                (),
1873                0x1d79d77ea12a6474,
1874                fidl::encoding::DynamicFlags::empty(),
1875                ___deadline,
1876            )?;
1877        Ok(_response.resource)
1878    }
1879}
1880
1881#[cfg(target_os = "fuchsia")]
1882impl From<DebugResourceSynchronousProxy> for zx::Handle {
1883    fn from(value: DebugResourceSynchronousProxy) -> Self {
1884        value.into_channel().into()
1885    }
1886}
1887
1888#[cfg(target_os = "fuchsia")]
1889impl From<fidl::Channel> for DebugResourceSynchronousProxy {
1890    fn from(value: fidl::Channel) -> Self {
1891        Self::new(value)
1892    }
1893}
1894
1895#[cfg(target_os = "fuchsia")]
1896impl fidl::endpoints::FromClient for DebugResourceSynchronousProxy {
1897    type Protocol = DebugResourceMarker;
1898
1899    fn from_client(value: fidl::endpoints::ClientEnd<DebugResourceMarker>) -> Self {
1900        Self::new(value.into_channel())
1901    }
1902}
1903
1904#[derive(Debug, Clone)]
1905pub struct DebugResourceProxy {
1906    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1907}
1908
1909impl fidl::endpoints::Proxy for DebugResourceProxy {
1910    type Protocol = DebugResourceMarker;
1911
1912    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1913        Self::new(inner)
1914    }
1915
1916    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1917        self.client.into_channel().map_err(|client| Self { client })
1918    }
1919
1920    fn as_channel(&self) -> &::fidl::AsyncChannel {
1921        self.client.as_channel()
1922    }
1923}
1924
1925impl DebugResourceProxy {
1926    /// Create a new Proxy for fuchsia.kernel/DebugResource.
1927    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1928        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1929        Self { client: fidl::client::Client::new(channel, protocol_name) }
1930    }
1931
1932    /// Get a Stream of events from the remote end of the protocol.
1933    ///
1934    /// # Panics
1935    ///
1936    /// Panics if the event stream was already taken.
1937    pub fn take_event_stream(&self) -> DebugResourceEventStream {
1938        DebugResourceEventStream { event_receiver: self.client.take_event_receiver() }
1939    }
1940
1941    /// Get a debug resource handle.
1942    pub fn r#get(
1943        &self,
1944    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
1945    {
1946        DebugResourceProxyInterface::r#get(self)
1947    }
1948}
1949
1950impl DebugResourceProxyInterface for DebugResourceProxy {
1951    type GetResponseFut = fidl::client::QueryResponseFut<
1952        fidl::Resource,
1953        fidl::encoding::DefaultFuchsiaResourceDialect,
1954    >;
1955    fn r#get(&self) -> Self::GetResponseFut {
1956        fn _decode(
1957            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1958        ) -> Result<fidl::Resource, fidl::Error> {
1959            let _response = fidl::client::decode_transaction_body::<
1960                DebugResourceGetResponse,
1961                fidl::encoding::DefaultFuchsiaResourceDialect,
1962                0x1d79d77ea12a6474,
1963            >(_buf?)?;
1964            Ok(_response.resource)
1965        }
1966        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
1967            (),
1968            0x1d79d77ea12a6474,
1969            fidl::encoding::DynamicFlags::empty(),
1970            _decode,
1971        )
1972    }
1973}
1974
1975pub struct DebugResourceEventStream {
1976    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1977}
1978
1979impl std::marker::Unpin for DebugResourceEventStream {}
1980
1981impl futures::stream::FusedStream for DebugResourceEventStream {
1982    fn is_terminated(&self) -> bool {
1983        self.event_receiver.is_terminated()
1984    }
1985}
1986
1987impl futures::Stream for DebugResourceEventStream {
1988    type Item = Result<DebugResourceEvent, fidl::Error>;
1989
1990    fn poll_next(
1991        mut self: std::pin::Pin<&mut Self>,
1992        cx: &mut std::task::Context<'_>,
1993    ) -> std::task::Poll<Option<Self::Item>> {
1994        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1995            &mut self.event_receiver,
1996            cx
1997        )?) {
1998            Some(buf) => std::task::Poll::Ready(Some(DebugResourceEvent::decode(buf))),
1999            None => std::task::Poll::Ready(None),
2000        }
2001    }
2002}
2003
2004#[derive(Debug)]
2005pub enum DebugResourceEvent {}
2006
2007impl DebugResourceEvent {
2008    /// Decodes a message buffer as a [`DebugResourceEvent`].
2009    fn decode(
2010        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2011    ) -> Result<DebugResourceEvent, fidl::Error> {
2012        let (bytes, _handles) = buf.split_mut();
2013        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2014        debug_assert_eq!(tx_header.tx_id, 0);
2015        match tx_header.ordinal {
2016            _ => Err(fidl::Error::UnknownOrdinal {
2017                ordinal: tx_header.ordinal,
2018                protocol_name: <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2019            }),
2020        }
2021    }
2022}
2023
2024/// A Stream of incoming requests for fuchsia.kernel/DebugResource.
2025pub struct DebugResourceRequestStream {
2026    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2027    is_terminated: bool,
2028}
2029
2030impl std::marker::Unpin for DebugResourceRequestStream {}
2031
2032impl futures::stream::FusedStream for DebugResourceRequestStream {
2033    fn is_terminated(&self) -> bool {
2034        self.is_terminated
2035    }
2036}
2037
2038impl fidl::endpoints::RequestStream for DebugResourceRequestStream {
2039    type Protocol = DebugResourceMarker;
2040    type ControlHandle = DebugResourceControlHandle;
2041
2042    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2043        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2044    }
2045
2046    fn control_handle(&self) -> Self::ControlHandle {
2047        DebugResourceControlHandle { inner: self.inner.clone() }
2048    }
2049
2050    fn into_inner(
2051        self,
2052    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2053    {
2054        (self.inner, self.is_terminated)
2055    }
2056
2057    fn from_inner(
2058        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2059        is_terminated: bool,
2060    ) -> Self {
2061        Self { inner, is_terminated }
2062    }
2063}
2064
2065impl futures::Stream for DebugResourceRequestStream {
2066    type Item = Result<DebugResourceRequest, fidl::Error>;
2067
2068    fn poll_next(
2069        mut self: std::pin::Pin<&mut Self>,
2070        cx: &mut std::task::Context<'_>,
2071    ) -> std::task::Poll<Option<Self::Item>> {
2072        let this = &mut *self;
2073        if this.inner.check_shutdown(cx) {
2074            this.is_terminated = true;
2075            return std::task::Poll::Ready(None);
2076        }
2077        if this.is_terminated {
2078            panic!("polled DebugResourceRequestStream after completion");
2079        }
2080        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2081            |bytes, handles| {
2082                match this.inner.channel().read_etc(cx, bytes, handles) {
2083                    std::task::Poll::Ready(Ok(())) => {}
2084                    std::task::Poll::Pending => return std::task::Poll::Pending,
2085                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2086                        this.is_terminated = true;
2087                        return std::task::Poll::Ready(None);
2088                    }
2089                    std::task::Poll::Ready(Err(e)) => {
2090                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2091                            e.into(),
2092                        ))))
2093                    }
2094                }
2095
2096                // A message has been received from the channel
2097                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2098
2099                std::task::Poll::Ready(Some(match header.ordinal {
2100                    0x1d79d77ea12a6474 => {
2101                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2102                        let mut req = fidl::new_empty!(
2103                            fidl::encoding::EmptyPayload,
2104                            fidl::encoding::DefaultFuchsiaResourceDialect
2105                        );
2106                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2107                        let control_handle =
2108                            DebugResourceControlHandle { inner: this.inner.clone() };
2109                        Ok(DebugResourceRequest::Get {
2110                            responder: DebugResourceGetResponder {
2111                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2112                                tx_id: header.tx_id,
2113                            },
2114                        })
2115                    }
2116                    _ => Err(fidl::Error::UnknownOrdinal {
2117                        ordinal: header.ordinal,
2118                        protocol_name:
2119                            <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2120                    }),
2121                }))
2122            },
2123        )
2124    }
2125}
2126
2127/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2128/// `ZX_RSRC_SYSTEM_DEBUG_BASE`.
2129#[derive(Debug)]
2130pub enum DebugResourceRequest {
2131    /// Get a debug resource handle.
2132    Get { responder: DebugResourceGetResponder },
2133}
2134
2135impl DebugResourceRequest {
2136    #[allow(irrefutable_let_patterns)]
2137    pub fn into_get(self) -> Option<(DebugResourceGetResponder)> {
2138        if let DebugResourceRequest::Get { responder } = self {
2139            Some((responder))
2140        } else {
2141            None
2142        }
2143    }
2144
2145    /// Name of the method defined in FIDL
2146    pub fn method_name(&self) -> &'static str {
2147        match *self {
2148            DebugResourceRequest::Get { .. } => "get",
2149        }
2150    }
2151}
2152
2153#[derive(Debug, Clone)]
2154pub struct DebugResourceControlHandle {
2155    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2156}
2157
2158impl fidl::endpoints::ControlHandle for DebugResourceControlHandle {
2159    fn shutdown(&self) {
2160        self.inner.shutdown()
2161    }
2162    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2163        self.inner.shutdown_with_epitaph(status)
2164    }
2165
2166    fn is_closed(&self) -> bool {
2167        self.inner.channel().is_closed()
2168    }
2169    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2170        self.inner.channel().on_closed()
2171    }
2172
2173    #[cfg(target_os = "fuchsia")]
2174    fn signal_peer(
2175        &self,
2176        clear_mask: zx::Signals,
2177        set_mask: zx::Signals,
2178    ) -> Result<(), zx_status::Status> {
2179        use fidl::Peered;
2180        self.inner.channel().signal_peer(clear_mask, set_mask)
2181    }
2182}
2183
2184impl DebugResourceControlHandle {}
2185
2186#[must_use = "FIDL methods require a response to be sent"]
2187#[derive(Debug)]
2188pub struct DebugResourceGetResponder {
2189    control_handle: std::mem::ManuallyDrop<DebugResourceControlHandle>,
2190    tx_id: u32,
2191}
2192
2193/// Set the the channel to be shutdown (see [`DebugResourceControlHandle::shutdown`])
2194/// if the responder is dropped without sending a response, so that the client
2195/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2196impl std::ops::Drop for DebugResourceGetResponder {
2197    fn drop(&mut self) {
2198        self.control_handle.shutdown();
2199        // Safety: drops once, never accessed again
2200        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2201    }
2202}
2203
2204impl fidl::endpoints::Responder for DebugResourceGetResponder {
2205    type ControlHandle = DebugResourceControlHandle;
2206
2207    fn control_handle(&self) -> &DebugResourceControlHandle {
2208        &self.control_handle
2209    }
2210
2211    fn drop_without_shutdown(mut self) {
2212        // Safety: drops once, never accessed again due to mem::forget
2213        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2214        // Prevent Drop from running (which would shut down the channel)
2215        std::mem::forget(self);
2216    }
2217}
2218
2219impl DebugResourceGetResponder {
2220    /// Sends a response to the FIDL transaction.
2221    ///
2222    /// Sets the channel to shutdown if an error occurs.
2223    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2224        let _result = self.send_raw(resource);
2225        if _result.is_err() {
2226            self.control_handle.shutdown();
2227        }
2228        self.drop_without_shutdown();
2229        _result
2230    }
2231
2232    /// Similar to "send" but does not shutdown the channel if an error occurs.
2233    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2234        let _result = self.send_raw(resource);
2235        self.drop_without_shutdown();
2236        _result
2237    }
2238
2239    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2240        self.control_handle.inner.send::<DebugResourceGetResponse>(
2241            (resource,),
2242            self.tx_id,
2243            0x1d79d77ea12a6474,
2244            fidl::encoding::DynamicFlags::empty(),
2245        )
2246    }
2247}
2248
2249#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2250pub struct DebuglogResourceMarker;
2251
2252impl fidl::endpoints::ProtocolMarker for DebuglogResourceMarker {
2253    type Proxy = DebuglogResourceProxy;
2254    type RequestStream = DebuglogResourceRequestStream;
2255    #[cfg(target_os = "fuchsia")]
2256    type SynchronousProxy = DebuglogResourceSynchronousProxy;
2257
2258    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebuglogResource";
2259}
2260impl fidl::endpoints::DiscoverableProtocolMarker for DebuglogResourceMarker {}
2261
2262pub trait DebuglogResourceProxyInterface: Send + Sync {
2263    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2264    fn r#get(&self) -> Self::GetResponseFut;
2265}
2266#[derive(Debug)]
2267#[cfg(target_os = "fuchsia")]
2268pub struct DebuglogResourceSynchronousProxy {
2269    client: fidl::client::sync::Client,
2270}
2271
2272#[cfg(target_os = "fuchsia")]
2273impl fidl::endpoints::SynchronousProxy for DebuglogResourceSynchronousProxy {
2274    type Proxy = DebuglogResourceProxy;
2275    type Protocol = DebuglogResourceMarker;
2276
2277    fn from_channel(inner: fidl::Channel) -> Self {
2278        Self::new(inner)
2279    }
2280
2281    fn into_channel(self) -> fidl::Channel {
2282        self.client.into_channel()
2283    }
2284
2285    fn as_channel(&self) -> &fidl::Channel {
2286        self.client.as_channel()
2287    }
2288}
2289
2290#[cfg(target_os = "fuchsia")]
2291impl DebuglogResourceSynchronousProxy {
2292    pub fn new(channel: fidl::Channel) -> Self {
2293        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2294        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2295    }
2296
2297    pub fn into_channel(self) -> fidl::Channel {
2298        self.client.into_channel()
2299    }
2300
2301    /// Waits until an event arrives and returns it. It is safe for other
2302    /// threads to make concurrent requests while waiting for an event.
2303    pub fn wait_for_event(
2304        &self,
2305        deadline: zx::MonotonicInstant,
2306    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2307        DebuglogResourceEvent::decode(self.client.wait_for_event(deadline)?)
2308    }
2309
2310    /// Get a debuglog resource handle.
2311    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2312        let _response =
2313            self.client.send_query::<fidl::encoding::EmptyPayload, DebuglogResourceGetResponse>(
2314                (),
2315                0x6e78c1ff74765225,
2316                fidl::encoding::DynamicFlags::empty(),
2317                ___deadline,
2318            )?;
2319        Ok(_response.resource)
2320    }
2321}
2322
2323#[cfg(target_os = "fuchsia")]
2324impl From<DebuglogResourceSynchronousProxy> for zx::Handle {
2325    fn from(value: DebuglogResourceSynchronousProxy) -> Self {
2326        value.into_channel().into()
2327    }
2328}
2329
2330#[cfg(target_os = "fuchsia")]
2331impl From<fidl::Channel> for DebuglogResourceSynchronousProxy {
2332    fn from(value: fidl::Channel) -> Self {
2333        Self::new(value)
2334    }
2335}
2336
2337#[cfg(target_os = "fuchsia")]
2338impl fidl::endpoints::FromClient for DebuglogResourceSynchronousProxy {
2339    type Protocol = DebuglogResourceMarker;
2340
2341    fn from_client(value: fidl::endpoints::ClientEnd<DebuglogResourceMarker>) -> Self {
2342        Self::new(value.into_channel())
2343    }
2344}
2345
2346#[derive(Debug, Clone)]
2347pub struct DebuglogResourceProxy {
2348    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2349}
2350
2351impl fidl::endpoints::Proxy for DebuglogResourceProxy {
2352    type Protocol = DebuglogResourceMarker;
2353
2354    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2355        Self::new(inner)
2356    }
2357
2358    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2359        self.client.into_channel().map_err(|client| Self { client })
2360    }
2361
2362    fn as_channel(&self) -> &::fidl::AsyncChannel {
2363        self.client.as_channel()
2364    }
2365}
2366
2367impl DebuglogResourceProxy {
2368    /// Create a new Proxy for fuchsia.kernel/DebuglogResource.
2369    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2370        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2371        Self { client: fidl::client::Client::new(channel, protocol_name) }
2372    }
2373
2374    /// Get a Stream of events from the remote end of the protocol.
2375    ///
2376    /// # Panics
2377    ///
2378    /// Panics if the event stream was already taken.
2379    pub fn take_event_stream(&self) -> DebuglogResourceEventStream {
2380        DebuglogResourceEventStream { event_receiver: self.client.take_event_receiver() }
2381    }
2382
2383    /// Get a debuglog resource handle.
2384    pub fn r#get(
2385        &self,
2386    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2387    {
2388        DebuglogResourceProxyInterface::r#get(self)
2389    }
2390}
2391
2392impl DebuglogResourceProxyInterface for DebuglogResourceProxy {
2393    type GetResponseFut = fidl::client::QueryResponseFut<
2394        fidl::Resource,
2395        fidl::encoding::DefaultFuchsiaResourceDialect,
2396    >;
2397    fn r#get(&self) -> Self::GetResponseFut {
2398        fn _decode(
2399            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2400        ) -> Result<fidl::Resource, fidl::Error> {
2401            let _response = fidl::client::decode_transaction_body::<
2402                DebuglogResourceGetResponse,
2403                fidl::encoding::DefaultFuchsiaResourceDialect,
2404                0x6e78c1ff74765225,
2405            >(_buf?)?;
2406            Ok(_response.resource)
2407        }
2408        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2409            (),
2410            0x6e78c1ff74765225,
2411            fidl::encoding::DynamicFlags::empty(),
2412            _decode,
2413        )
2414    }
2415}
2416
2417pub struct DebuglogResourceEventStream {
2418    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2419}
2420
2421impl std::marker::Unpin for DebuglogResourceEventStream {}
2422
2423impl futures::stream::FusedStream for DebuglogResourceEventStream {
2424    fn is_terminated(&self) -> bool {
2425        self.event_receiver.is_terminated()
2426    }
2427}
2428
2429impl futures::Stream for DebuglogResourceEventStream {
2430    type Item = Result<DebuglogResourceEvent, fidl::Error>;
2431
2432    fn poll_next(
2433        mut self: std::pin::Pin<&mut Self>,
2434        cx: &mut std::task::Context<'_>,
2435    ) -> std::task::Poll<Option<Self::Item>> {
2436        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2437            &mut self.event_receiver,
2438            cx
2439        )?) {
2440            Some(buf) => std::task::Poll::Ready(Some(DebuglogResourceEvent::decode(buf))),
2441            None => std::task::Poll::Ready(None),
2442        }
2443    }
2444}
2445
2446#[derive(Debug)]
2447pub enum DebuglogResourceEvent {}
2448
2449impl DebuglogResourceEvent {
2450    /// Decodes a message buffer as a [`DebuglogResourceEvent`].
2451    fn decode(
2452        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2453    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2454        let (bytes, _handles) = buf.split_mut();
2455        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2456        debug_assert_eq!(tx_header.tx_id, 0);
2457        match tx_header.ordinal {
2458            _ => Err(fidl::Error::UnknownOrdinal {
2459                ordinal: tx_header.ordinal,
2460                protocol_name:
2461                    <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2462            }),
2463        }
2464    }
2465}
2466
2467/// A Stream of incoming requests for fuchsia.kernel/DebuglogResource.
2468pub struct DebuglogResourceRequestStream {
2469    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2470    is_terminated: bool,
2471}
2472
2473impl std::marker::Unpin for DebuglogResourceRequestStream {}
2474
2475impl futures::stream::FusedStream for DebuglogResourceRequestStream {
2476    fn is_terminated(&self) -> bool {
2477        self.is_terminated
2478    }
2479}
2480
2481impl fidl::endpoints::RequestStream for DebuglogResourceRequestStream {
2482    type Protocol = DebuglogResourceMarker;
2483    type ControlHandle = DebuglogResourceControlHandle;
2484
2485    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2486        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2487    }
2488
2489    fn control_handle(&self) -> Self::ControlHandle {
2490        DebuglogResourceControlHandle { inner: self.inner.clone() }
2491    }
2492
2493    fn into_inner(
2494        self,
2495    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2496    {
2497        (self.inner, self.is_terminated)
2498    }
2499
2500    fn from_inner(
2501        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2502        is_terminated: bool,
2503    ) -> Self {
2504        Self { inner, is_terminated }
2505    }
2506}
2507
2508impl futures::Stream for DebuglogResourceRequestStream {
2509    type Item = Result<DebuglogResourceRequest, fidl::Error>;
2510
2511    fn poll_next(
2512        mut self: std::pin::Pin<&mut Self>,
2513        cx: &mut std::task::Context<'_>,
2514    ) -> std::task::Poll<Option<Self::Item>> {
2515        let this = &mut *self;
2516        if this.inner.check_shutdown(cx) {
2517            this.is_terminated = true;
2518            return std::task::Poll::Ready(None);
2519        }
2520        if this.is_terminated {
2521            panic!("polled DebuglogResourceRequestStream after completion");
2522        }
2523        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2524            |bytes, handles| {
2525                match this.inner.channel().read_etc(cx, bytes, handles) {
2526                    std::task::Poll::Ready(Ok(())) => {}
2527                    std::task::Poll::Pending => return std::task::Poll::Pending,
2528                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2529                        this.is_terminated = true;
2530                        return std::task::Poll::Ready(None);
2531                    }
2532                    std::task::Poll::Ready(Err(e)) => {
2533                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2534                            e.into(),
2535                        ))))
2536                    }
2537                }
2538
2539                // A message has been received from the channel
2540                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2541
2542                std::task::Poll::Ready(Some(match header.ordinal {
2543                    0x6e78c1ff74765225 => {
2544                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2545                        let mut req = fidl::new_empty!(
2546                            fidl::encoding::EmptyPayload,
2547                            fidl::encoding::DefaultFuchsiaResourceDialect
2548                        );
2549                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2550                        let control_handle =
2551                            DebuglogResourceControlHandle { inner: this.inner.clone() };
2552                        Ok(DebuglogResourceRequest::Get {
2553                            responder: DebuglogResourceGetResponder {
2554                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2555                                tx_id: header.tx_id,
2556                            },
2557                        })
2558                    }
2559                    _ => Err(fidl::Error::UnknownOrdinal {
2560                        ordinal: header.ordinal,
2561                        protocol_name:
2562                            <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2563                    }),
2564                }))
2565            },
2566        )
2567    }
2568}
2569
2570/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2571/// `ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
2572#[derive(Debug)]
2573pub enum DebuglogResourceRequest {
2574    /// Get a debuglog resource handle.
2575    Get { responder: DebuglogResourceGetResponder },
2576}
2577
2578impl DebuglogResourceRequest {
2579    #[allow(irrefutable_let_patterns)]
2580    pub fn into_get(self) -> Option<(DebuglogResourceGetResponder)> {
2581        if let DebuglogResourceRequest::Get { responder } = self {
2582            Some((responder))
2583        } else {
2584            None
2585        }
2586    }
2587
2588    /// Name of the method defined in FIDL
2589    pub fn method_name(&self) -> &'static str {
2590        match *self {
2591            DebuglogResourceRequest::Get { .. } => "get",
2592        }
2593    }
2594}
2595
2596#[derive(Debug, Clone)]
2597pub struct DebuglogResourceControlHandle {
2598    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2599}
2600
2601impl fidl::endpoints::ControlHandle for DebuglogResourceControlHandle {
2602    fn shutdown(&self) {
2603        self.inner.shutdown()
2604    }
2605    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2606        self.inner.shutdown_with_epitaph(status)
2607    }
2608
2609    fn is_closed(&self) -> bool {
2610        self.inner.channel().is_closed()
2611    }
2612    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2613        self.inner.channel().on_closed()
2614    }
2615
2616    #[cfg(target_os = "fuchsia")]
2617    fn signal_peer(
2618        &self,
2619        clear_mask: zx::Signals,
2620        set_mask: zx::Signals,
2621    ) -> Result<(), zx_status::Status> {
2622        use fidl::Peered;
2623        self.inner.channel().signal_peer(clear_mask, set_mask)
2624    }
2625}
2626
2627impl DebuglogResourceControlHandle {}
2628
2629#[must_use = "FIDL methods require a response to be sent"]
2630#[derive(Debug)]
2631pub struct DebuglogResourceGetResponder {
2632    control_handle: std::mem::ManuallyDrop<DebuglogResourceControlHandle>,
2633    tx_id: u32,
2634}
2635
2636/// Set the the channel to be shutdown (see [`DebuglogResourceControlHandle::shutdown`])
2637/// if the responder is dropped without sending a response, so that the client
2638/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2639impl std::ops::Drop for DebuglogResourceGetResponder {
2640    fn drop(&mut self) {
2641        self.control_handle.shutdown();
2642        // Safety: drops once, never accessed again
2643        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2644    }
2645}
2646
2647impl fidl::endpoints::Responder for DebuglogResourceGetResponder {
2648    type ControlHandle = DebuglogResourceControlHandle;
2649
2650    fn control_handle(&self) -> &DebuglogResourceControlHandle {
2651        &self.control_handle
2652    }
2653
2654    fn drop_without_shutdown(mut self) {
2655        // Safety: drops once, never accessed again due to mem::forget
2656        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2657        // Prevent Drop from running (which would shut down the channel)
2658        std::mem::forget(self);
2659    }
2660}
2661
2662impl DebuglogResourceGetResponder {
2663    /// Sends a response to the FIDL transaction.
2664    ///
2665    /// Sets the channel to shutdown if an error occurs.
2666    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2667        let _result = self.send_raw(resource);
2668        if _result.is_err() {
2669            self.control_handle.shutdown();
2670        }
2671        self.drop_without_shutdown();
2672        _result
2673    }
2674
2675    /// Similar to "send" but does not shutdown the channel if an error occurs.
2676    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2677        let _result = self.send_raw(resource);
2678        self.drop_without_shutdown();
2679        _result
2680    }
2681
2682    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2683        self.control_handle.inner.send::<DebuglogResourceGetResponse>(
2684            (resource,),
2685            self.tx_id,
2686            0x6e78c1ff74765225,
2687            fidl::encoding::DynamicFlags::empty(),
2688        )
2689    }
2690}
2691
2692#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2693pub struct EnergyInfoResourceMarker;
2694
2695impl fidl::endpoints::ProtocolMarker for EnergyInfoResourceMarker {
2696    type Proxy = EnergyInfoResourceProxy;
2697    type RequestStream = EnergyInfoResourceRequestStream;
2698    #[cfg(target_os = "fuchsia")]
2699    type SynchronousProxy = EnergyInfoResourceSynchronousProxy;
2700
2701    const DEBUG_NAME: &'static str = "fuchsia.kernel.EnergyInfoResource";
2702}
2703impl fidl::endpoints::DiscoverableProtocolMarker for EnergyInfoResourceMarker {}
2704
2705pub trait EnergyInfoResourceProxyInterface: Send + Sync {
2706    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2707    fn r#get(&self) -> Self::GetResponseFut;
2708}
2709#[derive(Debug)]
2710#[cfg(target_os = "fuchsia")]
2711pub struct EnergyInfoResourceSynchronousProxy {
2712    client: fidl::client::sync::Client,
2713}
2714
2715#[cfg(target_os = "fuchsia")]
2716impl fidl::endpoints::SynchronousProxy for EnergyInfoResourceSynchronousProxy {
2717    type Proxy = EnergyInfoResourceProxy;
2718    type Protocol = EnergyInfoResourceMarker;
2719
2720    fn from_channel(inner: fidl::Channel) -> Self {
2721        Self::new(inner)
2722    }
2723
2724    fn into_channel(self) -> fidl::Channel {
2725        self.client.into_channel()
2726    }
2727
2728    fn as_channel(&self) -> &fidl::Channel {
2729        self.client.as_channel()
2730    }
2731}
2732
2733#[cfg(target_os = "fuchsia")]
2734impl EnergyInfoResourceSynchronousProxy {
2735    pub fn new(channel: fidl::Channel) -> Self {
2736        let protocol_name =
2737            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2738        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2739    }
2740
2741    pub fn into_channel(self) -> fidl::Channel {
2742        self.client.into_channel()
2743    }
2744
2745    /// Waits until an event arrives and returns it. It is safe for other
2746    /// threads to make concurrent requests while waiting for an event.
2747    pub fn wait_for_event(
2748        &self,
2749        deadline: zx::MonotonicInstant,
2750    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2751        EnergyInfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
2752    }
2753
2754    /// Get an EnergyInfo resource handle.
2755    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2756        let _response =
2757            self.client.send_query::<fidl::encoding::EmptyPayload, EnergyInfoResourceGetResponse>(
2758                (),
2759                0x5f5cc9f0745f61d0,
2760                fidl::encoding::DynamicFlags::empty(),
2761                ___deadline,
2762            )?;
2763        Ok(_response.resource)
2764    }
2765}
2766
2767#[cfg(target_os = "fuchsia")]
2768impl From<EnergyInfoResourceSynchronousProxy> for zx::Handle {
2769    fn from(value: EnergyInfoResourceSynchronousProxy) -> Self {
2770        value.into_channel().into()
2771    }
2772}
2773
2774#[cfg(target_os = "fuchsia")]
2775impl From<fidl::Channel> for EnergyInfoResourceSynchronousProxy {
2776    fn from(value: fidl::Channel) -> Self {
2777        Self::new(value)
2778    }
2779}
2780
2781#[cfg(target_os = "fuchsia")]
2782impl fidl::endpoints::FromClient for EnergyInfoResourceSynchronousProxy {
2783    type Protocol = EnergyInfoResourceMarker;
2784
2785    fn from_client(value: fidl::endpoints::ClientEnd<EnergyInfoResourceMarker>) -> Self {
2786        Self::new(value.into_channel())
2787    }
2788}
2789
2790#[derive(Debug, Clone)]
2791pub struct EnergyInfoResourceProxy {
2792    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2793}
2794
2795impl fidl::endpoints::Proxy for EnergyInfoResourceProxy {
2796    type Protocol = EnergyInfoResourceMarker;
2797
2798    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2799        Self::new(inner)
2800    }
2801
2802    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2803        self.client.into_channel().map_err(|client| Self { client })
2804    }
2805
2806    fn as_channel(&self) -> &::fidl::AsyncChannel {
2807        self.client.as_channel()
2808    }
2809}
2810
2811impl EnergyInfoResourceProxy {
2812    /// Create a new Proxy for fuchsia.kernel/EnergyInfoResource.
2813    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2814        let protocol_name =
2815            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2816        Self { client: fidl::client::Client::new(channel, protocol_name) }
2817    }
2818
2819    /// Get a Stream of events from the remote end of the protocol.
2820    ///
2821    /// # Panics
2822    ///
2823    /// Panics if the event stream was already taken.
2824    pub fn take_event_stream(&self) -> EnergyInfoResourceEventStream {
2825        EnergyInfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
2826    }
2827
2828    /// Get an EnergyInfo resource handle.
2829    pub fn r#get(
2830        &self,
2831    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2832    {
2833        EnergyInfoResourceProxyInterface::r#get(self)
2834    }
2835}
2836
2837impl EnergyInfoResourceProxyInterface for EnergyInfoResourceProxy {
2838    type GetResponseFut = fidl::client::QueryResponseFut<
2839        fidl::Resource,
2840        fidl::encoding::DefaultFuchsiaResourceDialect,
2841    >;
2842    fn r#get(&self) -> Self::GetResponseFut {
2843        fn _decode(
2844            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2845        ) -> Result<fidl::Resource, fidl::Error> {
2846            let _response = fidl::client::decode_transaction_body::<
2847                EnergyInfoResourceGetResponse,
2848                fidl::encoding::DefaultFuchsiaResourceDialect,
2849                0x5f5cc9f0745f61d0,
2850            >(_buf?)?;
2851            Ok(_response.resource)
2852        }
2853        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2854            (),
2855            0x5f5cc9f0745f61d0,
2856            fidl::encoding::DynamicFlags::empty(),
2857            _decode,
2858        )
2859    }
2860}
2861
2862pub struct EnergyInfoResourceEventStream {
2863    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2864}
2865
2866impl std::marker::Unpin for EnergyInfoResourceEventStream {}
2867
2868impl futures::stream::FusedStream for EnergyInfoResourceEventStream {
2869    fn is_terminated(&self) -> bool {
2870        self.event_receiver.is_terminated()
2871    }
2872}
2873
2874impl futures::Stream for EnergyInfoResourceEventStream {
2875    type Item = Result<EnergyInfoResourceEvent, fidl::Error>;
2876
2877    fn poll_next(
2878        mut self: std::pin::Pin<&mut Self>,
2879        cx: &mut std::task::Context<'_>,
2880    ) -> std::task::Poll<Option<Self::Item>> {
2881        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2882            &mut self.event_receiver,
2883            cx
2884        )?) {
2885            Some(buf) => std::task::Poll::Ready(Some(EnergyInfoResourceEvent::decode(buf))),
2886            None => std::task::Poll::Ready(None),
2887        }
2888    }
2889}
2890
2891#[derive(Debug)]
2892pub enum EnergyInfoResourceEvent {}
2893
2894impl EnergyInfoResourceEvent {
2895    /// Decodes a message buffer as a [`EnergyInfoResourceEvent`].
2896    fn decode(
2897        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2898    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2899        let (bytes, _handles) = buf.split_mut();
2900        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2901        debug_assert_eq!(tx_header.tx_id, 0);
2902        match tx_header.ordinal {
2903            _ => Err(fidl::Error::UnknownOrdinal {
2904                ordinal: tx_header.ordinal,
2905                protocol_name:
2906                    <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2907            }),
2908        }
2909    }
2910}
2911
2912/// A Stream of incoming requests for fuchsia.kernel/EnergyInfoResource.
2913pub struct EnergyInfoResourceRequestStream {
2914    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2915    is_terminated: bool,
2916}
2917
2918impl std::marker::Unpin for EnergyInfoResourceRequestStream {}
2919
2920impl futures::stream::FusedStream for EnergyInfoResourceRequestStream {
2921    fn is_terminated(&self) -> bool {
2922        self.is_terminated
2923    }
2924}
2925
2926impl fidl::endpoints::RequestStream for EnergyInfoResourceRequestStream {
2927    type Protocol = EnergyInfoResourceMarker;
2928    type ControlHandle = EnergyInfoResourceControlHandle;
2929
2930    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2931        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2932    }
2933
2934    fn control_handle(&self) -> Self::ControlHandle {
2935        EnergyInfoResourceControlHandle { inner: self.inner.clone() }
2936    }
2937
2938    fn into_inner(
2939        self,
2940    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2941    {
2942        (self.inner, self.is_terminated)
2943    }
2944
2945    fn from_inner(
2946        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2947        is_terminated: bool,
2948    ) -> Self {
2949        Self { inner, is_terminated }
2950    }
2951}
2952
2953impl futures::Stream for EnergyInfoResourceRequestStream {
2954    type Item = Result<EnergyInfoResourceRequest, fidl::Error>;
2955
2956    fn poll_next(
2957        mut self: std::pin::Pin<&mut Self>,
2958        cx: &mut std::task::Context<'_>,
2959    ) -> std::task::Poll<Option<Self::Item>> {
2960        let this = &mut *self;
2961        if this.inner.check_shutdown(cx) {
2962            this.is_terminated = true;
2963            return std::task::Poll::Ready(None);
2964        }
2965        if this.is_terminated {
2966            panic!("polled EnergyInfoResourceRequestStream after completion");
2967        }
2968        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2969            |bytes, handles| {
2970                match this.inner.channel().read_etc(cx, bytes, handles) {
2971                    std::task::Poll::Ready(Ok(())) => {}
2972                    std::task::Poll::Pending => return std::task::Poll::Pending,
2973                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2974                        this.is_terminated = true;
2975                        return std::task::Poll::Ready(None);
2976                    }
2977                    std::task::Poll::Ready(Err(e)) => {
2978                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2979                            e.into(),
2980                        ))))
2981                    }
2982                }
2983
2984                // A message has been received from the channel
2985                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2986
2987                std::task::Poll::Ready(Some(match header.ordinal {
2988                0x5f5cc9f0745f61d0 => {
2989                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2990                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2991                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2992                    let control_handle = EnergyInfoResourceControlHandle {
2993                        inner: this.inner.clone(),
2994                    };
2995                    Ok(EnergyInfoResourceRequest::Get {
2996                        responder: EnergyInfoResourceGetResponder {
2997                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2998                            tx_id: header.tx_id,
2999                        },
3000                    })
3001                }
3002                _ => Err(fidl::Error::UnknownOrdinal {
3003                    ordinal: header.ordinal,
3004                    protocol_name: <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3005                }),
3006            }))
3007            },
3008        )
3009    }
3010}
3011
3012/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3013/// `ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
3014#[derive(Debug)]
3015pub enum EnergyInfoResourceRequest {
3016    /// Get an EnergyInfo resource handle.
3017    Get { responder: EnergyInfoResourceGetResponder },
3018}
3019
3020impl EnergyInfoResourceRequest {
3021    #[allow(irrefutable_let_patterns)]
3022    pub fn into_get(self) -> Option<(EnergyInfoResourceGetResponder)> {
3023        if let EnergyInfoResourceRequest::Get { responder } = self {
3024            Some((responder))
3025        } else {
3026            None
3027        }
3028    }
3029
3030    /// Name of the method defined in FIDL
3031    pub fn method_name(&self) -> &'static str {
3032        match *self {
3033            EnergyInfoResourceRequest::Get { .. } => "get",
3034        }
3035    }
3036}
3037
3038#[derive(Debug, Clone)]
3039pub struct EnergyInfoResourceControlHandle {
3040    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3041}
3042
3043impl fidl::endpoints::ControlHandle for EnergyInfoResourceControlHandle {
3044    fn shutdown(&self) {
3045        self.inner.shutdown()
3046    }
3047    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3048        self.inner.shutdown_with_epitaph(status)
3049    }
3050
3051    fn is_closed(&self) -> bool {
3052        self.inner.channel().is_closed()
3053    }
3054    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3055        self.inner.channel().on_closed()
3056    }
3057
3058    #[cfg(target_os = "fuchsia")]
3059    fn signal_peer(
3060        &self,
3061        clear_mask: zx::Signals,
3062        set_mask: zx::Signals,
3063    ) -> Result<(), zx_status::Status> {
3064        use fidl::Peered;
3065        self.inner.channel().signal_peer(clear_mask, set_mask)
3066    }
3067}
3068
3069impl EnergyInfoResourceControlHandle {}
3070
3071#[must_use = "FIDL methods require a response to be sent"]
3072#[derive(Debug)]
3073pub struct EnergyInfoResourceGetResponder {
3074    control_handle: std::mem::ManuallyDrop<EnergyInfoResourceControlHandle>,
3075    tx_id: u32,
3076}
3077
3078/// Set the the channel to be shutdown (see [`EnergyInfoResourceControlHandle::shutdown`])
3079/// if the responder is dropped without sending a response, so that the client
3080/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3081impl std::ops::Drop for EnergyInfoResourceGetResponder {
3082    fn drop(&mut self) {
3083        self.control_handle.shutdown();
3084        // Safety: drops once, never accessed again
3085        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3086    }
3087}
3088
3089impl fidl::endpoints::Responder for EnergyInfoResourceGetResponder {
3090    type ControlHandle = EnergyInfoResourceControlHandle;
3091
3092    fn control_handle(&self) -> &EnergyInfoResourceControlHandle {
3093        &self.control_handle
3094    }
3095
3096    fn drop_without_shutdown(mut self) {
3097        // Safety: drops once, never accessed again due to mem::forget
3098        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3099        // Prevent Drop from running (which would shut down the channel)
3100        std::mem::forget(self);
3101    }
3102}
3103
3104impl EnergyInfoResourceGetResponder {
3105    /// Sends a response to the FIDL transaction.
3106    ///
3107    /// Sets the channel to shutdown if an error occurs.
3108    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3109        let _result = self.send_raw(resource);
3110        if _result.is_err() {
3111            self.control_handle.shutdown();
3112        }
3113        self.drop_without_shutdown();
3114        _result
3115    }
3116
3117    /// Similar to "send" but does not shutdown the channel if an error occurs.
3118    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3119        let _result = self.send_raw(resource);
3120        self.drop_without_shutdown();
3121        _result
3122    }
3123
3124    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3125        self.control_handle.inner.send::<EnergyInfoResourceGetResponse>(
3126            (resource,),
3127            self.tx_id,
3128            0x5f5cc9f0745f61d0,
3129            fidl::encoding::DynamicFlags::empty(),
3130        )
3131    }
3132}
3133
3134#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3135pub struct HypervisorResourceMarker;
3136
3137impl fidl::endpoints::ProtocolMarker for HypervisorResourceMarker {
3138    type Proxy = HypervisorResourceProxy;
3139    type RequestStream = HypervisorResourceRequestStream;
3140    #[cfg(target_os = "fuchsia")]
3141    type SynchronousProxy = HypervisorResourceSynchronousProxy;
3142
3143    const DEBUG_NAME: &'static str = "fuchsia.kernel.HypervisorResource";
3144}
3145impl fidl::endpoints::DiscoverableProtocolMarker for HypervisorResourceMarker {}
3146
3147pub trait HypervisorResourceProxyInterface: Send + Sync {
3148    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3149    fn r#get(&self) -> Self::GetResponseFut;
3150}
3151#[derive(Debug)]
3152#[cfg(target_os = "fuchsia")]
3153pub struct HypervisorResourceSynchronousProxy {
3154    client: fidl::client::sync::Client,
3155}
3156
3157#[cfg(target_os = "fuchsia")]
3158impl fidl::endpoints::SynchronousProxy for HypervisorResourceSynchronousProxy {
3159    type Proxy = HypervisorResourceProxy;
3160    type Protocol = HypervisorResourceMarker;
3161
3162    fn from_channel(inner: fidl::Channel) -> Self {
3163        Self::new(inner)
3164    }
3165
3166    fn into_channel(self) -> fidl::Channel {
3167        self.client.into_channel()
3168    }
3169
3170    fn as_channel(&self) -> &fidl::Channel {
3171        self.client.as_channel()
3172    }
3173}
3174
3175#[cfg(target_os = "fuchsia")]
3176impl HypervisorResourceSynchronousProxy {
3177    pub fn new(channel: fidl::Channel) -> Self {
3178        let protocol_name =
3179            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3180        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3181    }
3182
3183    pub fn into_channel(self) -> fidl::Channel {
3184        self.client.into_channel()
3185    }
3186
3187    /// Waits until an event arrives and returns it. It is safe for other
3188    /// threads to make concurrent requests while waiting for an event.
3189    pub fn wait_for_event(
3190        &self,
3191        deadline: zx::MonotonicInstant,
3192    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3193        HypervisorResourceEvent::decode(self.client.wait_for_event(deadline)?)
3194    }
3195
3196    /// Get a hypervisor resource handle.
3197    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3198        let _response =
3199            self.client.send_query::<fidl::encoding::EmptyPayload, HypervisorResourceGetResponse>(
3200                (),
3201                0x1c312131d3b824a2,
3202                fidl::encoding::DynamicFlags::empty(),
3203                ___deadline,
3204            )?;
3205        Ok(_response.resource)
3206    }
3207}
3208
3209#[cfg(target_os = "fuchsia")]
3210impl From<HypervisorResourceSynchronousProxy> for zx::Handle {
3211    fn from(value: HypervisorResourceSynchronousProxy) -> Self {
3212        value.into_channel().into()
3213    }
3214}
3215
3216#[cfg(target_os = "fuchsia")]
3217impl From<fidl::Channel> for HypervisorResourceSynchronousProxy {
3218    fn from(value: fidl::Channel) -> Self {
3219        Self::new(value)
3220    }
3221}
3222
3223#[cfg(target_os = "fuchsia")]
3224impl fidl::endpoints::FromClient for HypervisorResourceSynchronousProxy {
3225    type Protocol = HypervisorResourceMarker;
3226
3227    fn from_client(value: fidl::endpoints::ClientEnd<HypervisorResourceMarker>) -> Self {
3228        Self::new(value.into_channel())
3229    }
3230}
3231
3232#[derive(Debug, Clone)]
3233pub struct HypervisorResourceProxy {
3234    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3235}
3236
3237impl fidl::endpoints::Proxy for HypervisorResourceProxy {
3238    type Protocol = HypervisorResourceMarker;
3239
3240    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3241        Self::new(inner)
3242    }
3243
3244    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3245        self.client.into_channel().map_err(|client| Self { client })
3246    }
3247
3248    fn as_channel(&self) -> &::fidl::AsyncChannel {
3249        self.client.as_channel()
3250    }
3251}
3252
3253impl HypervisorResourceProxy {
3254    /// Create a new Proxy for fuchsia.kernel/HypervisorResource.
3255    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3256        let protocol_name =
3257            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3258        Self { client: fidl::client::Client::new(channel, protocol_name) }
3259    }
3260
3261    /// Get a Stream of events from the remote end of the protocol.
3262    ///
3263    /// # Panics
3264    ///
3265    /// Panics if the event stream was already taken.
3266    pub fn take_event_stream(&self) -> HypervisorResourceEventStream {
3267        HypervisorResourceEventStream { event_receiver: self.client.take_event_receiver() }
3268    }
3269
3270    /// Get a hypervisor resource handle.
3271    pub fn r#get(
3272        &self,
3273    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3274    {
3275        HypervisorResourceProxyInterface::r#get(self)
3276    }
3277}
3278
3279impl HypervisorResourceProxyInterface for HypervisorResourceProxy {
3280    type GetResponseFut = fidl::client::QueryResponseFut<
3281        fidl::Resource,
3282        fidl::encoding::DefaultFuchsiaResourceDialect,
3283    >;
3284    fn r#get(&self) -> Self::GetResponseFut {
3285        fn _decode(
3286            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3287        ) -> Result<fidl::Resource, fidl::Error> {
3288            let _response = fidl::client::decode_transaction_body::<
3289                HypervisorResourceGetResponse,
3290                fidl::encoding::DefaultFuchsiaResourceDialect,
3291                0x1c312131d3b824a2,
3292            >(_buf?)?;
3293            Ok(_response.resource)
3294        }
3295        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3296            (),
3297            0x1c312131d3b824a2,
3298            fidl::encoding::DynamicFlags::empty(),
3299            _decode,
3300        )
3301    }
3302}
3303
3304pub struct HypervisorResourceEventStream {
3305    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3306}
3307
3308impl std::marker::Unpin for HypervisorResourceEventStream {}
3309
3310impl futures::stream::FusedStream for HypervisorResourceEventStream {
3311    fn is_terminated(&self) -> bool {
3312        self.event_receiver.is_terminated()
3313    }
3314}
3315
3316impl futures::Stream for HypervisorResourceEventStream {
3317    type Item = Result<HypervisorResourceEvent, fidl::Error>;
3318
3319    fn poll_next(
3320        mut self: std::pin::Pin<&mut Self>,
3321        cx: &mut std::task::Context<'_>,
3322    ) -> std::task::Poll<Option<Self::Item>> {
3323        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3324            &mut self.event_receiver,
3325            cx
3326        )?) {
3327            Some(buf) => std::task::Poll::Ready(Some(HypervisorResourceEvent::decode(buf))),
3328            None => std::task::Poll::Ready(None),
3329        }
3330    }
3331}
3332
3333#[derive(Debug)]
3334pub enum HypervisorResourceEvent {}
3335
3336impl HypervisorResourceEvent {
3337    /// Decodes a message buffer as a [`HypervisorResourceEvent`].
3338    fn decode(
3339        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3340    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3341        let (bytes, _handles) = buf.split_mut();
3342        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3343        debug_assert_eq!(tx_header.tx_id, 0);
3344        match tx_header.ordinal {
3345            _ => Err(fidl::Error::UnknownOrdinal {
3346                ordinal: tx_header.ordinal,
3347                protocol_name:
3348                    <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3349            }),
3350        }
3351    }
3352}
3353
3354/// A Stream of incoming requests for fuchsia.kernel/HypervisorResource.
3355pub struct HypervisorResourceRequestStream {
3356    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3357    is_terminated: bool,
3358}
3359
3360impl std::marker::Unpin for HypervisorResourceRequestStream {}
3361
3362impl futures::stream::FusedStream for HypervisorResourceRequestStream {
3363    fn is_terminated(&self) -> bool {
3364        self.is_terminated
3365    }
3366}
3367
3368impl fidl::endpoints::RequestStream for HypervisorResourceRequestStream {
3369    type Protocol = HypervisorResourceMarker;
3370    type ControlHandle = HypervisorResourceControlHandle;
3371
3372    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3373        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3374    }
3375
3376    fn control_handle(&self) -> Self::ControlHandle {
3377        HypervisorResourceControlHandle { inner: self.inner.clone() }
3378    }
3379
3380    fn into_inner(
3381        self,
3382    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3383    {
3384        (self.inner, self.is_terminated)
3385    }
3386
3387    fn from_inner(
3388        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3389        is_terminated: bool,
3390    ) -> Self {
3391        Self { inner, is_terminated }
3392    }
3393}
3394
3395impl futures::Stream for HypervisorResourceRequestStream {
3396    type Item = Result<HypervisorResourceRequest, fidl::Error>;
3397
3398    fn poll_next(
3399        mut self: std::pin::Pin<&mut Self>,
3400        cx: &mut std::task::Context<'_>,
3401    ) -> std::task::Poll<Option<Self::Item>> {
3402        let this = &mut *self;
3403        if this.inner.check_shutdown(cx) {
3404            this.is_terminated = true;
3405            return std::task::Poll::Ready(None);
3406        }
3407        if this.is_terminated {
3408            panic!("polled HypervisorResourceRequestStream after completion");
3409        }
3410        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3411            |bytes, handles| {
3412                match this.inner.channel().read_etc(cx, bytes, handles) {
3413                    std::task::Poll::Ready(Ok(())) => {}
3414                    std::task::Poll::Pending => return std::task::Poll::Pending,
3415                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3416                        this.is_terminated = true;
3417                        return std::task::Poll::Ready(None);
3418                    }
3419                    std::task::Poll::Ready(Err(e)) => {
3420                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3421                            e.into(),
3422                        ))))
3423                    }
3424                }
3425
3426                // A message has been received from the channel
3427                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3428
3429                std::task::Poll::Ready(Some(match header.ordinal {
3430                0x1c312131d3b824a2 => {
3431                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3432                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3433                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3434                    let control_handle = HypervisorResourceControlHandle {
3435                        inner: this.inner.clone(),
3436                    };
3437                    Ok(HypervisorResourceRequest::Get {
3438                        responder: HypervisorResourceGetResponder {
3439                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3440                            tx_id: header.tx_id,
3441                        },
3442                    })
3443                }
3444                _ => Err(fidl::Error::UnknownOrdinal {
3445                    ordinal: header.ordinal,
3446                    protocol_name: <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3447                }),
3448            }))
3449            },
3450        )
3451    }
3452}
3453
3454/// Protocol for providing the hypervisor resource.
3455#[derive(Debug)]
3456pub enum HypervisorResourceRequest {
3457    /// Get a hypervisor resource handle.
3458    Get { responder: HypervisorResourceGetResponder },
3459}
3460
3461impl HypervisorResourceRequest {
3462    #[allow(irrefutable_let_patterns)]
3463    pub fn into_get(self) -> Option<(HypervisorResourceGetResponder)> {
3464        if let HypervisorResourceRequest::Get { responder } = self {
3465            Some((responder))
3466        } else {
3467            None
3468        }
3469    }
3470
3471    /// Name of the method defined in FIDL
3472    pub fn method_name(&self) -> &'static str {
3473        match *self {
3474            HypervisorResourceRequest::Get { .. } => "get",
3475        }
3476    }
3477}
3478
3479#[derive(Debug, Clone)]
3480pub struct HypervisorResourceControlHandle {
3481    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3482}
3483
3484impl fidl::endpoints::ControlHandle for HypervisorResourceControlHandle {
3485    fn shutdown(&self) {
3486        self.inner.shutdown()
3487    }
3488    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3489        self.inner.shutdown_with_epitaph(status)
3490    }
3491
3492    fn is_closed(&self) -> bool {
3493        self.inner.channel().is_closed()
3494    }
3495    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3496        self.inner.channel().on_closed()
3497    }
3498
3499    #[cfg(target_os = "fuchsia")]
3500    fn signal_peer(
3501        &self,
3502        clear_mask: zx::Signals,
3503        set_mask: zx::Signals,
3504    ) -> Result<(), zx_status::Status> {
3505        use fidl::Peered;
3506        self.inner.channel().signal_peer(clear_mask, set_mask)
3507    }
3508}
3509
3510impl HypervisorResourceControlHandle {}
3511
3512#[must_use = "FIDL methods require a response to be sent"]
3513#[derive(Debug)]
3514pub struct HypervisorResourceGetResponder {
3515    control_handle: std::mem::ManuallyDrop<HypervisorResourceControlHandle>,
3516    tx_id: u32,
3517}
3518
3519/// Set the the channel to be shutdown (see [`HypervisorResourceControlHandle::shutdown`])
3520/// if the responder is dropped without sending a response, so that the client
3521/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3522impl std::ops::Drop for HypervisorResourceGetResponder {
3523    fn drop(&mut self) {
3524        self.control_handle.shutdown();
3525        // Safety: drops once, never accessed again
3526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3527    }
3528}
3529
3530impl fidl::endpoints::Responder for HypervisorResourceGetResponder {
3531    type ControlHandle = HypervisorResourceControlHandle;
3532
3533    fn control_handle(&self) -> &HypervisorResourceControlHandle {
3534        &self.control_handle
3535    }
3536
3537    fn drop_without_shutdown(mut self) {
3538        // Safety: drops once, never accessed again due to mem::forget
3539        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3540        // Prevent Drop from running (which would shut down the channel)
3541        std::mem::forget(self);
3542    }
3543}
3544
3545impl HypervisorResourceGetResponder {
3546    /// Sends a response to the FIDL transaction.
3547    ///
3548    /// Sets the channel to shutdown if an error occurs.
3549    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3550        let _result = self.send_raw(resource);
3551        if _result.is_err() {
3552            self.control_handle.shutdown();
3553        }
3554        self.drop_without_shutdown();
3555        _result
3556    }
3557
3558    /// Similar to "send" but does not shutdown the channel if an error occurs.
3559    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3560        let _result = self.send_raw(resource);
3561        self.drop_without_shutdown();
3562        _result
3563    }
3564
3565    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3566        self.control_handle.inner.send::<HypervisorResourceGetResponse>(
3567            (resource,),
3568            self.tx_id,
3569            0x1c312131d3b824a2,
3570            fidl::encoding::DynamicFlags::empty(),
3571        )
3572    }
3573}
3574
3575#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3576pub struct InfoResourceMarker;
3577
3578impl fidl::endpoints::ProtocolMarker for InfoResourceMarker {
3579    type Proxy = InfoResourceProxy;
3580    type RequestStream = InfoResourceRequestStream;
3581    #[cfg(target_os = "fuchsia")]
3582    type SynchronousProxy = InfoResourceSynchronousProxy;
3583
3584    const DEBUG_NAME: &'static str = "fuchsia.kernel.InfoResource";
3585}
3586impl fidl::endpoints::DiscoverableProtocolMarker for InfoResourceMarker {}
3587
3588pub trait InfoResourceProxyInterface: Send + Sync {
3589    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3590    fn r#get(&self) -> Self::GetResponseFut;
3591}
3592#[derive(Debug)]
3593#[cfg(target_os = "fuchsia")]
3594pub struct InfoResourceSynchronousProxy {
3595    client: fidl::client::sync::Client,
3596}
3597
3598#[cfg(target_os = "fuchsia")]
3599impl fidl::endpoints::SynchronousProxy for InfoResourceSynchronousProxy {
3600    type Proxy = InfoResourceProxy;
3601    type Protocol = InfoResourceMarker;
3602
3603    fn from_channel(inner: fidl::Channel) -> Self {
3604        Self::new(inner)
3605    }
3606
3607    fn into_channel(self) -> fidl::Channel {
3608        self.client.into_channel()
3609    }
3610
3611    fn as_channel(&self) -> &fidl::Channel {
3612        self.client.as_channel()
3613    }
3614}
3615
3616#[cfg(target_os = "fuchsia")]
3617impl InfoResourceSynchronousProxy {
3618    pub fn new(channel: fidl::Channel) -> Self {
3619        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3620        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3621    }
3622
3623    pub fn into_channel(self) -> fidl::Channel {
3624        self.client.into_channel()
3625    }
3626
3627    /// Waits until an event arrives and returns it. It is safe for other
3628    /// threads to make concurrent requests while waiting for an event.
3629    pub fn wait_for_event(
3630        &self,
3631        deadline: zx::MonotonicInstant,
3632    ) -> Result<InfoResourceEvent, fidl::Error> {
3633        InfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
3634    }
3635
3636    /// Get an info resource handle.
3637    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3638        let _response =
3639            self.client.send_query::<fidl::encoding::EmptyPayload, InfoResourceGetResponse>(
3640                (),
3641                0x1de8edcb4abc2067,
3642                fidl::encoding::DynamicFlags::empty(),
3643                ___deadline,
3644            )?;
3645        Ok(_response.resource)
3646    }
3647}
3648
3649#[cfg(target_os = "fuchsia")]
3650impl From<InfoResourceSynchronousProxy> for zx::Handle {
3651    fn from(value: InfoResourceSynchronousProxy) -> Self {
3652        value.into_channel().into()
3653    }
3654}
3655
3656#[cfg(target_os = "fuchsia")]
3657impl From<fidl::Channel> for InfoResourceSynchronousProxy {
3658    fn from(value: fidl::Channel) -> Self {
3659        Self::new(value)
3660    }
3661}
3662
3663#[cfg(target_os = "fuchsia")]
3664impl fidl::endpoints::FromClient for InfoResourceSynchronousProxy {
3665    type Protocol = InfoResourceMarker;
3666
3667    fn from_client(value: fidl::endpoints::ClientEnd<InfoResourceMarker>) -> Self {
3668        Self::new(value.into_channel())
3669    }
3670}
3671
3672#[derive(Debug, Clone)]
3673pub struct InfoResourceProxy {
3674    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3675}
3676
3677impl fidl::endpoints::Proxy for InfoResourceProxy {
3678    type Protocol = InfoResourceMarker;
3679
3680    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3681        Self::new(inner)
3682    }
3683
3684    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3685        self.client.into_channel().map_err(|client| Self { client })
3686    }
3687
3688    fn as_channel(&self) -> &::fidl::AsyncChannel {
3689        self.client.as_channel()
3690    }
3691}
3692
3693impl InfoResourceProxy {
3694    /// Create a new Proxy for fuchsia.kernel/InfoResource.
3695    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3696        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3697        Self { client: fidl::client::Client::new(channel, protocol_name) }
3698    }
3699
3700    /// Get a Stream of events from the remote end of the protocol.
3701    ///
3702    /// # Panics
3703    ///
3704    /// Panics if the event stream was already taken.
3705    pub fn take_event_stream(&self) -> InfoResourceEventStream {
3706        InfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
3707    }
3708
3709    /// Get an info resource handle.
3710    pub fn r#get(
3711        &self,
3712    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3713    {
3714        InfoResourceProxyInterface::r#get(self)
3715    }
3716}
3717
3718impl InfoResourceProxyInterface for InfoResourceProxy {
3719    type GetResponseFut = fidl::client::QueryResponseFut<
3720        fidl::Resource,
3721        fidl::encoding::DefaultFuchsiaResourceDialect,
3722    >;
3723    fn r#get(&self) -> Self::GetResponseFut {
3724        fn _decode(
3725            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3726        ) -> Result<fidl::Resource, fidl::Error> {
3727            let _response = fidl::client::decode_transaction_body::<
3728                InfoResourceGetResponse,
3729                fidl::encoding::DefaultFuchsiaResourceDialect,
3730                0x1de8edcb4abc2067,
3731            >(_buf?)?;
3732            Ok(_response.resource)
3733        }
3734        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3735            (),
3736            0x1de8edcb4abc2067,
3737            fidl::encoding::DynamicFlags::empty(),
3738            _decode,
3739        )
3740    }
3741}
3742
3743pub struct InfoResourceEventStream {
3744    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3745}
3746
3747impl std::marker::Unpin for InfoResourceEventStream {}
3748
3749impl futures::stream::FusedStream for InfoResourceEventStream {
3750    fn is_terminated(&self) -> bool {
3751        self.event_receiver.is_terminated()
3752    }
3753}
3754
3755impl futures::Stream for InfoResourceEventStream {
3756    type Item = Result<InfoResourceEvent, fidl::Error>;
3757
3758    fn poll_next(
3759        mut self: std::pin::Pin<&mut Self>,
3760        cx: &mut std::task::Context<'_>,
3761    ) -> std::task::Poll<Option<Self::Item>> {
3762        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3763            &mut self.event_receiver,
3764            cx
3765        )?) {
3766            Some(buf) => std::task::Poll::Ready(Some(InfoResourceEvent::decode(buf))),
3767            None => std::task::Poll::Ready(None),
3768        }
3769    }
3770}
3771
3772#[derive(Debug)]
3773pub enum InfoResourceEvent {}
3774
3775impl InfoResourceEvent {
3776    /// Decodes a message buffer as a [`InfoResourceEvent`].
3777    fn decode(
3778        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3779    ) -> Result<InfoResourceEvent, fidl::Error> {
3780        let (bytes, _handles) = buf.split_mut();
3781        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3782        debug_assert_eq!(tx_header.tx_id, 0);
3783        match tx_header.ordinal {
3784            _ => Err(fidl::Error::UnknownOrdinal {
3785                ordinal: tx_header.ordinal,
3786                protocol_name: <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3787            }),
3788        }
3789    }
3790}
3791
3792/// A Stream of incoming requests for fuchsia.kernel/InfoResource.
3793pub struct InfoResourceRequestStream {
3794    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3795    is_terminated: bool,
3796}
3797
3798impl std::marker::Unpin for InfoResourceRequestStream {}
3799
3800impl futures::stream::FusedStream for InfoResourceRequestStream {
3801    fn is_terminated(&self) -> bool {
3802        self.is_terminated
3803    }
3804}
3805
3806impl fidl::endpoints::RequestStream for InfoResourceRequestStream {
3807    type Protocol = InfoResourceMarker;
3808    type ControlHandle = InfoResourceControlHandle;
3809
3810    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3811        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3812    }
3813
3814    fn control_handle(&self) -> Self::ControlHandle {
3815        InfoResourceControlHandle { inner: self.inner.clone() }
3816    }
3817
3818    fn into_inner(
3819        self,
3820    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3821    {
3822        (self.inner, self.is_terminated)
3823    }
3824
3825    fn from_inner(
3826        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3827        is_terminated: bool,
3828    ) -> Self {
3829        Self { inner, is_terminated }
3830    }
3831}
3832
3833impl futures::Stream for InfoResourceRequestStream {
3834    type Item = Result<InfoResourceRequest, fidl::Error>;
3835
3836    fn poll_next(
3837        mut self: std::pin::Pin<&mut Self>,
3838        cx: &mut std::task::Context<'_>,
3839    ) -> std::task::Poll<Option<Self::Item>> {
3840        let this = &mut *self;
3841        if this.inner.check_shutdown(cx) {
3842            this.is_terminated = true;
3843            return std::task::Poll::Ready(None);
3844        }
3845        if this.is_terminated {
3846            panic!("polled InfoResourceRequestStream after completion");
3847        }
3848        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3849            |bytes, handles| {
3850                match this.inner.channel().read_etc(cx, bytes, handles) {
3851                    std::task::Poll::Ready(Ok(())) => {}
3852                    std::task::Poll::Pending => return std::task::Poll::Pending,
3853                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3854                        this.is_terminated = true;
3855                        return std::task::Poll::Ready(None);
3856                    }
3857                    std::task::Poll::Ready(Err(e)) => {
3858                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3859                            e.into(),
3860                        ))))
3861                    }
3862                }
3863
3864                // A message has been received from the channel
3865                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3866
3867                std::task::Poll::Ready(Some(match header.ordinal {
3868                    0x1de8edcb4abc2067 => {
3869                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3870                        let mut req = fidl::new_empty!(
3871                            fidl::encoding::EmptyPayload,
3872                            fidl::encoding::DefaultFuchsiaResourceDialect
3873                        );
3874                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3875                        let control_handle =
3876                            InfoResourceControlHandle { inner: this.inner.clone() };
3877                        Ok(InfoResourceRequest::Get {
3878                            responder: InfoResourceGetResponder {
3879                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3880                                tx_id: header.tx_id,
3881                            },
3882                        })
3883                    }
3884                    _ => Err(fidl::Error::UnknownOrdinal {
3885                        ordinal: header.ordinal,
3886                        protocol_name:
3887                            <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3888                    }),
3889                }))
3890            },
3891        )
3892    }
3893}
3894
3895/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3896/// `ZX_RSRC_SYSTEM_INFO_BASE`.
3897#[derive(Debug)]
3898pub enum InfoResourceRequest {
3899    /// Get an info resource handle.
3900    Get { responder: InfoResourceGetResponder },
3901}
3902
3903impl InfoResourceRequest {
3904    #[allow(irrefutable_let_patterns)]
3905    pub fn into_get(self) -> Option<(InfoResourceGetResponder)> {
3906        if let InfoResourceRequest::Get { responder } = self {
3907            Some((responder))
3908        } else {
3909            None
3910        }
3911    }
3912
3913    /// Name of the method defined in FIDL
3914    pub fn method_name(&self) -> &'static str {
3915        match *self {
3916            InfoResourceRequest::Get { .. } => "get",
3917        }
3918    }
3919}
3920
3921#[derive(Debug, Clone)]
3922pub struct InfoResourceControlHandle {
3923    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3924}
3925
3926impl fidl::endpoints::ControlHandle for InfoResourceControlHandle {
3927    fn shutdown(&self) {
3928        self.inner.shutdown()
3929    }
3930    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3931        self.inner.shutdown_with_epitaph(status)
3932    }
3933
3934    fn is_closed(&self) -> bool {
3935        self.inner.channel().is_closed()
3936    }
3937    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3938        self.inner.channel().on_closed()
3939    }
3940
3941    #[cfg(target_os = "fuchsia")]
3942    fn signal_peer(
3943        &self,
3944        clear_mask: zx::Signals,
3945        set_mask: zx::Signals,
3946    ) -> Result<(), zx_status::Status> {
3947        use fidl::Peered;
3948        self.inner.channel().signal_peer(clear_mask, set_mask)
3949    }
3950}
3951
3952impl InfoResourceControlHandle {}
3953
3954#[must_use = "FIDL methods require a response to be sent"]
3955#[derive(Debug)]
3956pub struct InfoResourceGetResponder {
3957    control_handle: std::mem::ManuallyDrop<InfoResourceControlHandle>,
3958    tx_id: u32,
3959}
3960
3961/// Set the the channel to be shutdown (see [`InfoResourceControlHandle::shutdown`])
3962/// if the responder is dropped without sending a response, so that the client
3963/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3964impl std::ops::Drop for InfoResourceGetResponder {
3965    fn drop(&mut self) {
3966        self.control_handle.shutdown();
3967        // Safety: drops once, never accessed again
3968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3969    }
3970}
3971
3972impl fidl::endpoints::Responder for InfoResourceGetResponder {
3973    type ControlHandle = InfoResourceControlHandle;
3974
3975    fn control_handle(&self) -> &InfoResourceControlHandle {
3976        &self.control_handle
3977    }
3978
3979    fn drop_without_shutdown(mut self) {
3980        // Safety: drops once, never accessed again due to mem::forget
3981        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3982        // Prevent Drop from running (which would shut down the channel)
3983        std::mem::forget(self);
3984    }
3985}
3986
3987impl InfoResourceGetResponder {
3988    /// Sends a response to the FIDL transaction.
3989    ///
3990    /// Sets the channel to shutdown if an error occurs.
3991    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3992        let _result = self.send_raw(resource);
3993        if _result.is_err() {
3994            self.control_handle.shutdown();
3995        }
3996        self.drop_without_shutdown();
3997        _result
3998    }
3999
4000    /// Similar to "send" but does not shutdown the channel if an error occurs.
4001    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4002        let _result = self.send_raw(resource);
4003        self.drop_without_shutdown();
4004        _result
4005    }
4006
4007    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4008        self.control_handle.inner.send::<InfoResourceGetResponse>(
4009            (resource,),
4010            self.tx_id,
4011            0x1de8edcb4abc2067,
4012            fidl::encoding::DynamicFlags::empty(),
4013        )
4014    }
4015}
4016
4017#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4018pub struct IommuResourceMarker;
4019
4020impl fidl::endpoints::ProtocolMarker for IommuResourceMarker {
4021    type Proxy = IommuResourceProxy;
4022    type RequestStream = IommuResourceRequestStream;
4023    #[cfg(target_os = "fuchsia")]
4024    type SynchronousProxy = IommuResourceSynchronousProxy;
4025
4026    const DEBUG_NAME: &'static str = "fuchsia.kernel.IommuResource";
4027}
4028impl fidl::endpoints::DiscoverableProtocolMarker for IommuResourceMarker {}
4029
4030pub trait IommuResourceProxyInterface: Send + Sync {
4031    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4032    fn r#get(&self) -> Self::GetResponseFut;
4033}
4034#[derive(Debug)]
4035#[cfg(target_os = "fuchsia")]
4036pub struct IommuResourceSynchronousProxy {
4037    client: fidl::client::sync::Client,
4038}
4039
4040#[cfg(target_os = "fuchsia")]
4041impl fidl::endpoints::SynchronousProxy for IommuResourceSynchronousProxy {
4042    type Proxy = IommuResourceProxy;
4043    type Protocol = IommuResourceMarker;
4044
4045    fn from_channel(inner: fidl::Channel) -> Self {
4046        Self::new(inner)
4047    }
4048
4049    fn into_channel(self) -> fidl::Channel {
4050        self.client.into_channel()
4051    }
4052
4053    fn as_channel(&self) -> &fidl::Channel {
4054        self.client.as_channel()
4055    }
4056}
4057
4058#[cfg(target_os = "fuchsia")]
4059impl IommuResourceSynchronousProxy {
4060    pub fn new(channel: fidl::Channel) -> Self {
4061        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4062        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4063    }
4064
4065    pub fn into_channel(self) -> fidl::Channel {
4066        self.client.into_channel()
4067    }
4068
4069    /// Waits until an event arrives and returns it. It is safe for other
4070    /// threads to make concurrent requests while waiting for an event.
4071    pub fn wait_for_event(
4072        &self,
4073        deadline: zx::MonotonicInstant,
4074    ) -> Result<IommuResourceEvent, fidl::Error> {
4075        IommuResourceEvent::decode(self.client.wait_for_event(deadline)?)
4076    }
4077
4078    /// Get an iommu resource handle.
4079    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4080        let _response =
4081            self.client.send_query::<fidl::encoding::EmptyPayload, IommuResourceGetResponse>(
4082                (),
4083                0x5af309b619aa7c5b,
4084                fidl::encoding::DynamicFlags::empty(),
4085                ___deadline,
4086            )?;
4087        Ok(_response.resource)
4088    }
4089}
4090
4091#[cfg(target_os = "fuchsia")]
4092impl From<IommuResourceSynchronousProxy> for zx::Handle {
4093    fn from(value: IommuResourceSynchronousProxy) -> Self {
4094        value.into_channel().into()
4095    }
4096}
4097
4098#[cfg(target_os = "fuchsia")]
4099impl From<fidl::Channel> for IommuResourceSynchronousProxy {
4100    fn from(value: fidl::Channel) -> Self {
4101        Self::new(value)
4102    }
4103}
4104
4105#[cfg(target_os = "fuchsia")]
4106impl fidl::endpoints::FromClient for IommuResourceSynchronousProxy {
4107    type Protocol = IommuResourceMarker;
4108
4109    fn from_client(value: fidl::endpoints::ClientEnd<IommuResourceMarker>) -> Self {
4110        Self::new(value.into_channel())
4111    }
4112}
4113
4114#[derive(Debug, Clone)]
4115pub struct IommuResourceProxy {
4116    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4117}
4118
4119impl fidl::endpoints::Proxy for IommuResourceProxy {
4120    type Protocol = IommuResourceMarker;
4121
4122    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4123        Self::new(inner)
4124    }
4125
4126    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4127        self.client.into_channel().map_err(|client| Self { client })
4128    }
4129
4130    fn as_channel(&self) -> &::fidl::AsyncChannel {
4131        self.client.as_channel()
4132    }
4133}
4134
4135impl IommuResourceProxy {
4136    /// Create a new Proxy for fuchsia.kernel/IommuResource.
4137    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4138        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4139        Self { client: fidl::client::Client::new(channel, protocol_name) }
4140    }
4141
4142    /// Get a Stream of events from the remote end of the protocol.
4143    ///
4144    /// # Panics
4145    ///
4146    /// Panics if the event stream was already taken.
4147    pub fn take_event_stream(&self) -> IommuResourceEventStream {
4148        IommuResourceEventStream { event_receiver: self.client.take_event_receiver() }
4149    }
4150
4151    /// Get an iommu resource handle.
4152    pub fn r#get(
4153        &self,
4154    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4155    {
4156        IommuResourceProxyInterface::r#get(self)
4157    }
4158}
4159
4160impl IommuResourceProxyInterface for IommuResourceProxy {
4161    type GetResponseFut = fidl::client::QueryResponseFut<
4162        fidl::Resource,
4163        fidl::encoding::DefaultFuchsiaResourceDialect,
4164    >;
4165    fn r#get(&self) -> Self::GetResponseFut {
4166        fn _decode(
4167            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4168        ) -> Result<fidl::Resource, fidl::Error> {
4169            let _response = fidl::client::decode_transaction_body::<
4170                IommuResourceGetResponse,
4171                fidl::encoding::DefaultFuchsiaResourceDialect,
4172                0x5af309b619aa7c5b,
4173            >(_buf?)?;
4174            Ok(_response.resource)
4175        }
4176        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4177            (),
4178            0x5af309b619aa7c5b,
4179            fidl::encoding::DynamicFlags::empty(),
4180            _decode,
4181        )
4182    }
4183}
4184
4185pub struct IommuResourceEventStream {
4186    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4187}
4188
4189impl std::marker::Unpin for IommuResourceEventStream {}
4190
4191impl futures::stream::FusedStream for IommuResourceEventStream {
4192    fn is_terminated(&self) -> bool {
4193        self.event_receiver.is_terminated()
4194    }
4195}
4196
4197impl futures::Stream for IommuResourceEventStream {
4198    type Item = Result<IommuResourceEvent, fidl::Error>;
4199
4200    fn poll_next(
4201        mut self: std::pin::Pin<&mut Self>,
4202        cx: &mut std::task::Context<'_>,
4203    ) -> std::task::Poll<Option<Self::Item>> {
4204        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4205            &mut self.event_receiver,
4206            cx
4207        )?) {
4208            Some(buf) => std::task::Poll::Ready(Some(IommuResourceEvent::decode(buf))),
4209            None => std::task::Poll::Ready(None),
4210        }
4211    }
4212}
4213
4214#[derive(Debug)]
4215pub enum IommuResourceEvent {}
4216
4217impl IommuResourceEvent {
4218    /// Decodes a message buffer as a [`IommuResourceEvent`].
4219    fn decode(
4220        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4221    ) -> Result<IommuResourceEvent, fidl::Error> {
4222        let (bytes, _handles) = buf.split_mut();
4223        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4224        debug_assert_eq!(tx_header.tx_id, 0);
4225        match tx_header.ordinal {
4226            _ => Err(fidl::Error::UnknownOrdinal {
4227                ordinal: tx_header.ordinal,
4228                protocol_name: <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4229            }),
4230        }
4231    }
4232}
4233
4234/// A Stream of incoming requests for fuchsia.kernel/IommuResource.
4235pub struct IommuResourceRequestStream {
4236    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4237    is_terminated: bool,
4238}
4239
4240impl std::marker::Unpin for IommuResourceRequestStream {}
4241
4242impl futures::stream::FusedStream for IommuResourceRequestStream {
4243    fn is_terminated(&self) -> bool {
4244        self.is_terminated
4245    }
4246}
4247
4248impl fidl::endpoints::RequestStream for IommuResourceRequestStream {
4249    type Protocol = IommuResourceMarker;
4250    type ControlHandle = IommuResourceControlHandle;
4251
4252    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4253        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4254    }
4255
4256    fn control_handle(&self) -> Self::ControlHandle {
4257        IommuResourceControlHandle { inner: self.inner.clone() }
4258    }
4259
4260    fn into_inner(
4261        self,
4262    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4263    {
4264        (self.inner, self.is_terminated)
4265    }
4266
4267    fn from_inner(
4268        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4269        is_terminated: bool,
4270    ) -> Self {
4271        Self { inner, is_terminated }
4272    }
4273}
4274
4275impl futures::Stream for IommuResourceRequestStream {
4276    type Item = Result<IommuResourceRequest, fidl::Error>;
4277
4278    fn poll_next(
4279        mut self: std::pin::Pin<&mut Self>,
4280        cx: &mut std::task::Context<'_>,
4281    ) -> std::task::Poll<Option<Self::Item>> {
4282        let this = &mut *self;
4283        if this.inner.check_shutdown(cx) {
4284            this.is_terminated = true;
4285            return std::task::Poll::Ready(None);
4286        }
4287        if this.is_terminated {
4288            panic!("polled IommuResourceRequestStream after completion");
4289        }
4290        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4291            |bytes, handles| {
4292                match this.inner.channel().read_etc(cx, bytes, handles) {
4293                    std::task::Poll::Ready(Ok(())) => {}
4294                    std::task::Poll::Pending => return std::task::Poll::Pending,
4295                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4296                        this.is_terminated = true;
4297                        return std::task::Poll::Ready(None);
4298                    }
4299                    std::task::Poll::Ready(Err(e)) => {
4300                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4301                            e.into(),
4302                        ))))
4303                    }
4304                }
4305
4306                // A message has been received from the channel
4307                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4308
4309                std::task::Poll::Ready(Some(match header.ordinal {
4310                    0x5af309b619aa7c5b => {
4311                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4312                        let mut req = fidl::new_empty!(
4313                            fidl::encoding::EmptyPayload,
4314                            fidl::encoding::DefaultFuchsiaResourceDialect
4315                        );
4316                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4317                        let control_handle =
4318                            IommuResourceControlHandle { inner: this.inner.clone() };
4319                        Ok(IommuResourceRequest::Get {
4320                            responder: IommuResourceGetResponder {
4321                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4322                                tx_id: header.tx_id,
4323                            },
4324                        })
4325                    }
4326                    _ => Err(fidl::Error::UnknownOrdinal {
4327                        ordinal: header.ordinal,
4328                        protocol_name:
4329                            <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4330                    }),
4331                }))
4332            },
4333        )
4334    }
4335}
4336
4337/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
4338/// `ZX_RSRC_SYSTEM_IOMMU_BASE`.
4339#[derive(Debug)]
4340pub enum IommuResourceRequest {
4341    /// Get an iommu resource handle.
4342    Get { responder: IommuResourceGetResponder },
4343}
4344
4345impl IommuResourceRequest {
4346    #[allow(irrefutable_let_patterns)]
4347    pub fn into_get(self) -> Option<(IommuResourceGetResponder)> {
4348        if let IommuResourceRequest::Get { responder } = self {
4349            Some((responder))
4350        } else {
4351            None
4352        }
4353    }
4354
4355    /// Name of the method defined in FIDL
4356    pub fn method_name(&self) -> &'static str {
4357        match *self {
4358            IommuResourceRequest::Get { .. } => "get",
4359        }
4360    }
4361}
4362
4363#[derive(Debug, Clone)]
4364pub struct IommuResourceControlHandle {
4365    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4366}
4367
4368impl fidl::endpoints::ControlHandle for IommuResourceControlHandle {
4369    fn shutdown(&self) {
4370        self.inner.shutdown()
4371    }
4372    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4373        self.inner.shutdown_with_epitaph(status)
4374    }
4375
4376    fn is_closed(&self) -> bool {
4377        self.inner.channel().is_closed()
4378    }
4379    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4380        self.inner.channel().on_closed()
4381    }
4382
4383    #[cfg(target_os = "fuchsia")]
4384    fn signal_peer(
4385        &self,
4386        clear_mask: zx::Signals,
4387        set_mask: zx::Signals,
4388    ) -> Result<(), zx_status::Status> {
4389        use fidl::Peered;
4390        self.inner.channel().signal_peer(clear_mask, set_mask)
4391    }
4392}
4393
4394impl IommuResourceControlHandle {}
4395
4396#[must_use = "FIDL methods require a response to be sent"]
4397#[derive(Debug)]
4398pub struct IommuResourceGetResponder {
4399    control_handle: std::mem::ManuallyDrop<IommuResourceControlHandle>,
4400    tx_id: u32,
4401}
4402
4403/// Set the the channel to be shutdown (see [`IommuResourceControlHandle::shutdown`])
4404/// if the responder is dropped without sending a response, so that the client
4405/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4406impl std::ops::Drop for IommuResourceGetResponder {
4407    fn drop(&mut self) {
4408        self.control_handle.shutdown();
4409        // Safety: drops once, never accessed again
4410        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4411    }
4412}
4413
4414impl fidl::endpoints::Responder for IommuResourceGetResponder {
4415    type ControlHandle = IommuResourceControlHandle;
4416
4417    fn control_handle(&self) -> &IommuResourceControlHandle {
4418        &self.control_handle
4419    }
4420
4421    fn drop_without_shutdown(mut self) {
4422        // Safety: drops once, never accessed again due to mem::forget
4423        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4424        // Prevent Drop from running (which would shut down the channel)
4425        std::mem::forget(self);
4426    }
4427}
4428
4429impl IommuResourceGetResponder {
4430    /// Sends a response to the FIDL transaction.
4431    ///
4432    /// Sets the channel to shutdown if an error occurs.
4433    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4434        let _result = self.send_raw(resource);
4435        if _result.is_err() {
4436            self.control_handle.shutdown();
4437        }
4438        self.drop_without_shutdown();
4439        _result
4440    }
4441
4442    /// Similar to "send" but does not shutdown the channel if an error occurs.
4443    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4444        let _result = self.send_raw(resource);
4445        self.drop_without_shutdown();
4446        _result
4447    }
4448
4449    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4450        self.control_handle.inner.send::<IommuResourceGetResponse>(
4451            (resource,),
4452            self.tx_id,
4453            0x5af309b619aa7c5b,
4454            fidl::encoding::DynamicFlags::empty(),
4455        )
4456    }
4457}
4458
4459#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4460pub struct IoportResourceMarker;
4461
4462impl fidl::endpoints::ProtocolMarker for IoportResourceMarker {
4463    type Proxy = IoportResourceProxy;
4464    type RequestStream = IoportResourceRequestStream;
4465    #[cfg(target_os = "fuchsia")]
4466    type SynchronousProxy = IoportResourceSynchronousProxy;
4467
4468    const DEBUG_NAME: &'static str = "fuchsia.kernel.IoportResource";
4469}
4470impl fidl::endpoints::DiscoverableProtocolMarker for IoportResourceMarker {}
4471
4472pub trait IoportResourceProxyInterface: Send + Sync {
4473    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4474    fn r#get(&self) -> Self::GetResponseFut;
4475}
4476#[derive(Debug)]
4477#[cfg(target_os = "fuchsia")]
4478pub struct IoportResourceSynchronousProxy {
4479    client: fidl::client::sync::Client,
4480}
4481
4482#[cfg(target_os = "fuchsia")]
4483impl fidl::endpoints::SynchronousProxy for IoportResourceSynchronousProxy {
4484    type Proxy = IoportResourceProxy;
4485    type Protocol = IoportResourceMarker;
4486
4487    fn from_channel(inner: fidl::Channel) -> Self {
4488        Self::new(inner)
4489    }
4490
4491    fn into_channel(self) -> fidl::Channel {
4492        self.client.into_channel()
4493    }
4494
4495    fn as_channel(&self) -> &fidl::Channel {
4496        self.client.as_channel()
4497    }
4498}
4499
4500#[cfg(target_os = "fuchsia")]
4501impl IoportResourceSynchronousProxy {
4502    pub fn new(channel: fidl::Channel) -> Self {
4503        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4504        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4505    }
4506
4507    pub fn into_channel(self) -> fidl::Channel {
4508        self.client.into_channel()
4509    }
4510
4511    /// Waits until an event arrives and returns it. It is safe for other
4512    /// threads to make concurrent requests while waiting for an event.
4513    pub fn wait_for_event(
4514        &self,
4515        deadline: zx::MonotonicInstant,
4516    ) -> Result<IoportResourceEvent, fidl::Error> {
4517        IoportResourceEvent::decode(self.client.wait_for_event(deadline)?)
4518    }
4519
4520    /// Get an IO Port resource handle.
4521    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4522        let _response =
4523            self.client.send_query::<fidl::encoding::EmptyPayload, IoportResourceGetResponse>(
4524                (),
4525                0x4db20876b537c52b,
4526                fidl::encoding::DynamicFlags::empty(),
4527                ___deadline,
4528            )?;
4529        Ok(_response.resource)
4530    }
4531}
4532
4533#[cfg(target_os = "fuchsia")]
4534impl From<IoportResourceSynchronousProxy> for zx::Handle {
4535    fn from(value: IoportResourceSynchronousProxy) -> Self {
4536        value.into_channel().into()
4537    }
4538}
4539
4540#[cfg(target_os = "fuchsia")]
4541impl From<fidl::Channel> for IoportResourceSynchronousProxy {
4542    fn from(value: fidl::Channel) -> Self {
4543        Self::new(value)
4544    }
4545}
4546
4547#[cfg(target_os = "fuchsia")]
4548impl fidl::endpoints::FromClient for IoportResourceSynchronousProxy {
4549    type Protocol = IoportResourceMarker;
4550
4551    fn from_client(value: fidl::endpoints::ClientEnd<IoportResourceMarker>) -> Self {
4552        Self::new(value.into_channel())
4553    }
4554}
4555
4556#[derive(Debug, Clone)]
4557pub struct IoportResourceProxy {
4558    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4559}
4560
4561impl fidl::endpoints::Proxy for IoportResourceProxy {
4562    type Protocol = IoportResourceMarker;
4563
4564    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4565        Self::new(inner)
4566    }
4567
4568    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4569        self.client.into_channel().map_err(|client| Self { client })
4570    }
4571
4572    fn as_channel(&self) -> &::fidl::AsyncChannel {
4573        self.client.as_channel()
4574    }
4575}
4576
4577impl IoportResourceProxy {
4578    /// Create a new Proxy for fuchsia.kernel/IoportResource.
4579    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4580        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4581        Self { client: fidl::client::Client::new(channel, protocol_name) }
4582    }
4583
4584    /// Get a Stream of events from the remote end of the protocol.
4585    ///
4586    /// # Panics
4587    ///
4588    /// Panics if the event stream was already taken.
4589    pub fn take_event_stream(&self) -> IoportResourceEventStream {
4590        IoportResourceEventStream { event_receiver: self.client.take_event_receiver() }
4591    }
4592
4593    /// Get an IO Port resource handle.
4594    pub fn r#get(
4595        &self,
4596    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4597    {
4598        IoportResourceProxyInterface::r#get(self)
4599    }
4600}
4601
4602impl IoportResourceProxyInterface for IoportResourceProxy {
4603    type GetResponseFut = fidl::client::QueryResponseFut<
4604        fidl::Resource,
4605        fidl::encoding::DefaultFuchsiaResourceDialect,
4606    >;
4607    fn r#get(&self) -> Self::GetResponseFut {
4608        fn _decode(
4609            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4610        ) -> Result<fidl::Resource, fidl::Error> {
4611            let _response = fidl::client::decode_transaction_body::<
4612                IoportResourceGetResponse,
4613                fidl::encoding::DefaultFuchsiaResourceDialect,
4614                0x4db20876b537c52b,
4615            >(_buf?)?;
4616            Ok(_response.resource)
4617        }
4618        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4619            (),
4620            0x4db20876b537c52b,
4621            fidl::encoding::DynamicFlags::empty(),
4622            _decode,
4623        )
4624    }
4625}
4626
4627pub struct IoportResourceEventStream {
4628    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4629}
4630
4631impl std::marker::Unpin for IoportResourceEventStream {}
4632
4633impl futures::stream::FusedStream for IoportResourceEventStream {
4634    fn is_terminated(&self) -> bool {
4635        self.event_receiver.is_terminated()
4636    }
4637}
4638
4639impl futures::Stream for IoportResourceEventStream {
4640    type Item = Result<IoportResourceEvent, fidl::Error>;
4641
4642    fn poll_next(
4643        mut self: std::pin::Pin<&mut Self>,
4644        cx: &mut std::task::Context<'_>,
4645    ) -> std::task::Poll<Option<Self::Item>> {
4646        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4647            &mut self.event_receiver,
4648            cx
4649        )?) {
4650            Some(buf) => std::task::Poll::Ready(Some(IoportResourceEvent::decode(buf))),
4651            None => std::task::Poll::Ready(None),
4652        }
4653    }
4654}
4655
4656#[derive(Debug)]
4657pub enum IoportResourceEvent {}
4658
4659impl IoportResourceEvent {
4660    /// Decodes a message buffer as a [`IoportResourceEvent`].
4661    fn decode(
4662        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4663    ) -> Result<IoportResourceEvent, fidl::Error> {
4664        let (bytes, _handles) = buf.split_mut();
4665        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4666        debug_assert_eq!(tx_header.tx_id, 0);
4667        match tx_header.ordinal {
4668            _ => Err(fidl::Error::UnknownOrdinal {
4669                ordinal: tx_header.ordinal,
4670                protocol_name:
4671                    <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4672            }),
4673        }
4674    }
4675}
4676
4677/// A Stream of incoming requests for fuchsia.kernel/IoportResource.
4678pub struct IoportResourceRequestStream {
4679    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4680    is_terminated: bool,
4681}
4682
4683impl std::marker::Unpin for IoportResourceRequestStream {}
4684
4685impl futures::stream::FusedStream for IoportResourceRequestStream {
4686    fn is_terminated(&self) -> bool {
4687        self.is_terminated
4688    }
4689}
4690
4691impl fidl::endpoints::RequestStream for IoportResourceRequestStream {
4692    type Protocol = IoportResourceMarker;
4693    type ControlHandle = IoportResourceControlHandle;
4694
4695    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4696        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4697    }
4698
4699    fn control_handle(&self) -> Self::ControlHandle {
4700        IoportResourceControlHandle { inner: self.inner.clone() }
4701    }
4702
4703    fn into_inner(
4704        self,
4705    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4706    {
4707        (self.inner, self.is_terminated)
4708    }
4709
4710    fn from_inner(
4711        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4712        is_terminated: bool,
4713    ) -> Self {
4714        Self { inner, is_terminated }
4715    }
4716}
4717
4718impl futures::Stream for IoportResourceRequestStream {
4719    type Item = Result<IoportResourceRequest, fidl::Error>;
4720
4721    fn poll_next(
4722        mut self: std::pin::Pin<&mut Self>,
4723        cx: &mut std::task::Context<'_>,
4724    ) -> std::task::Poll<Option<Self::Item>> {
4725        let this = &mut *self;
4726        if this.inner.check_shutdown(cx) {
4727            this.is_terminated = true;
4728            return std::task::Poll::Ready(None);
4729        }
4730        if this.is_terminated {
4731            panic!("polled IoportResourceRequestStream after completion");
4732        }
4733        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4734            |bytes, handles| {
4735                match this.inner.channel().read_etc(cx, bytes, handles) {
4736                    std::task::Poll::Ready(Ok(())) => {}
4737                    std::task::Poll::Pending => return std::task::Poll::Pending,
4738                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4739                        this.is_terminated = true;
4740                        return std::task::Poll::Ready(None);
4741                    }
4742                    std::task::Poll::Ready(Err(e)) => {
4743                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4744                            e.into(),
4745                        ))))
4746                    }
4747                }
4748
4749                // A message has been received from the channel
4750                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4751
4752                std::task::Poll::Ready(Some(match header.ordinal {
4753                    0x4db20876b537c52b => {
4754                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4755                        let mut req = fidl::new_empty!(
4756                            fidl::encoding::EmptyPayload,
4757                            fidl::encoding::DefaultFuchsiaResourceDialect
4758                        );
4759                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4760                        let control_handle =
4761                            IoportResourceControlHandle { inner: this.inner.clone() };
4762                        Ok(IoportResourceRequest::Get {
4763                            responder: IoportResourceGetResponder {
4764                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4765                                tx_id: header.tx_id,
4766                            },
4767                        })
4768                    }
4769                    _ => Err(fidl::Error::UnknownOrdinal {
4770                        ordinal: header.ordinal,
4771                        protocol_name:
4772                            <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4773                    }),
4774                }))
4775            },
4776        )
4777    }
4778}
4779
4780/// Protocol for providing an IO Port resource with access to all valid ranges.
4781#[derive(Debug)]
4782pub enum IoportResourceRequest {
4783    /// Get an IO Port resource handle.
4784    Get { responder: IoportResourceGetResponder },
4785}
4786
4787impl IoportResourceRequest {
4788    #[allow(irrefutable_let_patterns)]
4789    pub fn into_get(self) -> Option<(IoportResourceGetResponder)> {
4790        if let IoportResourceRequest::Get { responder } = self {
4791            Some((responder))
4792        } else {
4793            None
4794        }
4795    }
4796
4797    /// Name of the method defined in FIDL
4798    pub fn method_name(&self) -> &'static str {
4799        match *self {
4800            IoportResourceRequest::Get { .. } => "get",
4801        }
4802    }
4803}
4804
4805#[derive(Debug, Clone)]
4806pub struct IoportResourceControlHandle {
4807    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4808}
4809
4810impl fidl::endpoints::ControlHandle for IoportResourceControlHandle {
4811    fn shutdown(&self) {
4812        self.inner.shutdown()
4813    }
4814    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4815        self.inner.shutdown_with_epitaph(status)
4816    }
4817
4818    fn is_closed(&self) -> bool {
4819        self.inner.channel().is_closed()
4820    }
4821    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4822        self.inner.channel().on_closed()
4823    }
4824
4825    #[cfg(target_os = "fuchsia")]
4826    fn signal_peer(
4827        &self,
4828        clear_mask: zx::Signals,
4829        set_mask: zx::Signals,
4830    ) -> Result<(), zx_status::Status> {
4831        use fidl::Peered;
4832        self.inner.channel().signal_peer(clear_mask, set_mask)
4833    }
4834}
4835
4836impl IoportResourceControlHandle {}
4837
4838#[must_use = "FIDL methods require a response to be sent"]
4839#[derive(Debug)]
4840pub struct IoportResourceGetResponder {
4841    control_handle: std::mem::ManuallyDrop<IoportResourceControlHandle>,
4842    tx_id: u32,
4843}
4844
4845/// Set the the channel to be shutdown (see [`IoportResourceControlHandle::shutdown`])
4846/// if the responder is dropped without sending a response, so that the client
4847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4848impl std::ops::Drop for IoportResourceGetResponder {
4849    fn drop(&mut self) {
4850        self.control_handle.shutdown();
4851        // Safety: drops once, never accessed again
4852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4853    }
4854}
4855
4856impl fidl::endpoints::Responder for IoportResourceGetResponder {
4857    type ControlHandle = IoportResourceControlHandle;
4858
4859    fn control_handle(&self) -> &IoportResourceControlHandle {
4860        &self.control_handle
4861    }
4862
4863    fn drop_without_shutdown(mut self) {
4864        // Safety: drops once, never accessed again due to mem::forget
4865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4866        // Prevent Drop from running (which would shut down the channel)
4867        std::mem::forget(self);
4868    }
4869}
4870
4871impl IoportResourceGetResponder {
4872    /// Sends a response to the FIDL transaction.
4873    ///
4874    /// Sets the channel to shutdown if an error occurs.
4875    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4876        let _result = self.send_raw(resource);
4877        if _result.is_err() {
4878            self.control_handle.shutdown();
4879        }
4880        self.drop_without_shutdown();
4881        _result
4882    }
4883
4884    /// Similar to "send" but does not shutdown the channel if an error occurs.
4885    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4886        let _result = self.send_raw(resource);
4887        self.drop_without_shutdown();
4888        _result
4889    }
4890
4891    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4892        self.control_handle.inner.send::<IoportResourceGetResponse>(
4893            (resource,),
4894            self.tx_id,
4895            0x4db20876b537c52b,
4896            fidl::encoding::DynamicFlags::empty(),
4897        )
4898    }
4899}
4900
4901#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4902pub struct IrqResourceMarker;
4903
4904impl fidl::endpoints::ProtocolMarker for IrqResourceMarker {
4905    type Proxy = IrqResourceProxy;
4906    type RequestStream = IrqResourceRequestStream;
4907    #[cfg(target_os = "fuchsia")]
4908    type SynchronousProxy = IrqResourceSynchronousProxy;
4909
4910    const DEBUG_NAME: &'static str = "fuchsia.kernel.IrqResource";
4911}
4912impl fidl::endpoints::DiscoverableProtocolMarker for IrqResourceMarker {}
4913
4914pub trait IrqResourceProxyInterface: Send + Sync {
4915    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4916    fn r#get(&self) -> Self::GetResponseFut;
4917}
4918#[derive(Debug)]
4919#[cfg(target_os = "fuchsia")]
4920pub struct IrqResourceSynchronousProxy {
4921    client: fidl::client::sync::Client,
4922}
4923
4924#[cfg(target_os = "fuchsia")]
4925impl fidl::endpoints::SynchronousProxy for IrqResourceSynchronousProxy {
4926    type Proxy = IrqResourceProxy;
4927    type Protocol = IrqResourceMarker;
4928
4929    fn from_channel(inner: fidl::Channel) -> Self {
4930        Self::new(inner)
4931    }
4932
4933    fn into_channel(self) -> fidl::Channel {
4934        self.client.into_channel()
4935    }
4936
4937    fn as_channel(&self) -> &fidl::Channel {
4938        self.client.as_channel()
4939    }
4940}
4941
4942#[cfg(target_os = "fuchsia")]
4943impl IrqResourceSynchronousProxy {
4944    pub fn new(channel: fidl::Channel) -> Self {
4945        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4946        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4947    }
4948
4949    pub fn into_channel(self) -> fidl::Channel {
4950        self.client.into_channel()
4951    }
4952
4953    /// Waits until an event arrives and returns it. It is safe for other
4954    /// threads to make concurrent requests while waiting for an event.
4955    pub fn wait_for_event(
4956        &self,
4957        deadline: zx::MonotonicInstant,
4958    ) -> Result<IrqResourceEvent, fidl::Error> {
4959        IrqResourceEvent::decode(self.client.wait_for_event(deadline)?)
4960    }
4961
4962    /// Get an IRQ resource handle.
4963    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4964        let _response =
4965            self.client.send_query::<fidl::encoding::EmptyPayload, IrqResourceGetResponse>(
4966                (),
4967                0x491be54504b041e9,
4968                fidl::encoding::DynamicFlags::empty(),
4969                ___deadline,
4970            )?;
4971        Ok(_response.resource)
4972    }
4973}
4974
4975#[cfg(target_os = "fuchsia")]
4976impl From<IrqResourceSynchronousProxy> for zx::Handle {
4977    fn from(value: IrqResourceSynchronousProxy) -> Self {
4978        value.into_channel().into()
4979    }
4980}
4981
4982#[cfg(target_os = "fuchsia")]
4983impl From<fidl::Channel> for IrqResourceSynchronousProxy {
4984    fn from(value: fidl::Channel) -> Self {
4985        Self::new(value)
4986    }
4987}
4988
4989#[cfg(target_os = "fuchsia")]
4990impl fidl::endpoints::FromClient for IrqResourceSynchronousProxy {
4991    type Protocol = IrqResourceMarker;
4992
4993    fn from_client(value: fidl::endpoints::ClientEnd<IrqResourceMarker>) -> Self {
4994        Self::new(value.into_channel())
4995    }
4996}
4997
4998#[derive(Debug, Clone)]
4999pub struct IrqResourceProxy {
5000    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5001}
5002
5003impl fidl::endpoints::Proxy for IrqResourceProxy {
5004    type Protocol = IrqResourceMarker;
5005
5006    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5007        Self::new(inner)
5008    }
5009
5010    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5011        self.client.into_channel().map_err(|client| Self { client })
5012    }
5013
5014    fn as_channel(&self) -> &::fidl::AsyncChannel {
5015        self.client.as_channel()
5016    }
5017}
5018
5019impl IrqResourceProxy {
5020    /// Create a new Proxy for fuchsia.kernel/IrqResource.
5021    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5022        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5023        Self { client: fidl::client::Client::new(channel, protocol_name) }
5024    }
5025
5026    /// Get a Stream of events from the remote end of the protocol.
5027    ///
5028    /// # Panics
5029    ///
5030    /// Panics if the event stream was already taken.
5031    pub fn take_event_stream(&self) -> IrqResourceEventStream {
5032        IrqResourceEventStream { event_receiver: self.client.take_event_receiver() }
5033    }
5034
5035    /// Get an IRQ resource handle.
5036    pub fn r#get(
5037        &self,
5038    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5039    {
5040        IrqResourceProxyInterface::r#get(self)
5041    }
5042}
5043
5044impl IrqResourceProxyInterface for IrqResourceProxy {
5045    type GetResponseFut = fidl::client::QueryResponseFut<
5046        fidl::Resource,
5047        fidl::encoding::DefaultFuchsiaResourceDialect,
5048    >;
5049    fn r#get(&self) -> Self::GetResponseFut {
5050        fn _decode(
5051            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5052        ) -> Result<fidl::Resource, fidl::Error> {
5053            let _response = fidl::client::decode_transaction_body::<
5054                IrqResourceGetResponse,
5055                fidl::encoding::DefaultFuchsiaResourceDialect,
5056                0x491be54504b041e9,
5057            >(_buf?)?;
5058            Ok(_response.resource)
5059        }
5060        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5061            (),
5062            0x491be54504b041e9,
5063            fidl::encoding::DynamicFlags::empty(),
5064            _decode,
5065        )
5066    }
5067}
5068
5069pub struct IrqResourceEventStream {
5070    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5071}
5072
5073impl std::marker::Unpin for IrqResourceEventStream {}
5074
5075impl futures::stream::FusedStream for IrqResourceEventStream {
5076    fn is_terminated(&self) -> bool {
5077        self.event_receiver.is_terminated()
5078    }
5079}
5080
5081impl futures::Stream for IrqResourceEventStream {
5082    type Item = Result<IrqResourceEvent, fidl::Error>;
5083
5084    fn poll_next(
5085        mut self: std::pin::Pin<&mut Self>,
5086        cx: &mut std::task::Context<'_>,
5087    ) -> std::task::Poll<Option<Self::Item>> {
5088        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5089            &mut self.event_receiver,
5090            cx
5091        )?) {
5092            Some(buf) => std::task::Poll::Ready(Some(IrqResourceEvent::decode(buf))),
5093            None => std::task::Poll::Ready(None),
5094        }
5095    }
5096}
5097
5098#[derive(Debug)]
5099pub enum IrqResourceEvent {}
5100
5101impl IrqResourceEvent {
5102    /// Decodes a message buffer as a [`IrqResourceEvent`].
5103    fn decode(
5104        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5105    ) -> Result<IrqResourceEvent, fidl::Error> {
5106        let (bytes, _handles) = buf.split_mut();
5107        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5108        debug_assert_eq!(tx_header.tx_id, 0);
5109        match tx_header.ordinal {
5110            _ => Err(fidl::Error::UnknownOrdinal {
5111                ordinal: tx_header.ordinal,
5112                protocol_name: <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5113            }),
5114        }
5115    }
5116}
5117
5118/// A Stream of incoming requests for fuchsia.kernel/IrqResource.
5119pub struct IrqResourceRequestStream {
5120    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5121    is_terminated: bool,
5122}
5123
5124impl std::marker::Unpin for IrqResourceRequestStream {}
5125
5126impl futures::stream::FusedStream for IrqResourceRequestStream {
5127    fn is_terminated(&self) -> bool {
5128        self.is_terminated
5129    }
5130}
5131
5132impl fidl::endpoints::RequestStream for IrqResourceRequestStream {
5133    type Protocol = IrqResourceMarker;
5134    type ControlHandle = IrqResourceControlHandle;
5135
5136    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5137        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5138    }
5139
5140    fn control_handle(&self) -> Self::ControlHandle {
5141        IrqResourceControlHandle { inner: self.inner.clone() }
5142    }
5143
5144    fn into_inner(
5145        self,
5146    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5147    {
5148        (self.inner, self.is_terminated)
5149    }
5150
5151    fn from_inner(
5152        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5153        is_terminated: bool,
5154    ) -> Self {
5155        Self { inner, is_terminated }
5156    }
5157}
5158
5159impl futures::Stream for IrqResourceRequestStream {
5160    type Item = Result<IrqResourceRequest, fidl::Error>;
5161
5162    fn poll_next(
5163        mut self: std::pin::Pin<&mut Self>,
5164        cx: &mut std::task::Context<'_>,
5165    ) -> std::task::Poll<Option<Self::Item>> {
5166        let this = &mut *self;
5167        if this.inner.check_shutdown(cx) {
5168            this.is_terminated = true;
5169            return std::task::Poll::Ready(None);
5170        }
5171        if this.is_terminated {
5172            panic!("polled IrqResourceRequestStream after completion");
5173        }
5174        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5175            |bytes, handles| {
5176                match this.inner.channel().read_etc(cx, bytes, handles) {
5177                    std::task::Poll::Ready(Ok(())) => {}
5178                    std::task::Poll::Pending => return std::task::Poll::Pending,
5179                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5180                        this.is_terminated = true;
5181                        return std::task::Poll::Ready(None);
5182                    }
5183                    std::task::Poll::Ready(Err(e)) => {
5184                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5185                            e.into(),
5186                        ))))
5187                    }
5188                }
5189
5190                // A message has been received from the channel
5191                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5192
5193                std::task::Poll::Ready(Some(match header.ordinal {
5194                    0x491be54504b041e9 => {
5195                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5196                        let mut req = fidl::new_empty!(
5197                            fidl::encoding::EmptyPayload,
5198                            fidl::encoding::DefaultFuchsiaResourceDialect
5199                        );
5200                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5201                        let control_handle = IrqResourceControlHandle { inner: this.inner.clone() };
5202                        Ok(IrqResourceRequest::Get {
5203                            responder: IrqResourceGetResponder {
5204                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5205                                tx_id: header.tx_id,
5206                            },
5207                        })
5208                    }
5209                    _ => Err(fidl::Error::UnknownOrdinal {
5210                        ordinal: header.ordinal,
5211                        protocol_name:
5212                            <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5213                    }),
5214                }))
5215            },
5216        )
5217    }
5218}
5219
5220/// Protocol for providing an IRQ resource with access to all valid ranges.
5221#[derive(Debug)]
5222pub enum IrqResourceRequest {
5223    /// Get an IRQ resource handle.
5224    Get { responder: IrqResourceGetResponder },
5225}
5226
5227impl IrqResourceRequest {
5228    #[allow(irrefutable_let_patterns)]
5229    pub fn into_get(self) -> Option<(IrqResourceGetResponder)> {
5230        if let IrqResourceRequest::Get { responder } = self {
5231            Some((responder))
5232        } else {
5233            None
5234        }
5235    }
5236
5237    /// Name of the method defined in FIDL
5238    pub fn method_name(&self) -> &'static str {
5239        match *self {
5240            IrqResourceRequest::Get { .. } => "get",
5241        }
5242    }
5243}
5244
5245#[derive(Debug, Clone)]
5246pub struct IrqResourceControlHandle {
5247    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5248}
5249
5250impl fidl::endpoints::ControlHandle for IrqResourceControlHandle {
5251    fn shutdown(&self) {
5252        self.inner.shutdown()
5253    }
5254    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5255        self.inner.shutdown_with_epitaph(status)
5256    }
5257
5258    fn is_closed(&self) -> bool {
5259        self.inner.channel().is_closed()
5260    }
5261    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5262        self.inner.channel().on_closed()
5263    }
5264
5265    #[cfg(target_os = "fuchsia")]
5266    fn signal_peer(
5267        &self,
5268        clear_mask: zx::Signals,
5269        set_mask: zx::Signals,
5270    ) -> Result<(), zx_status::Status> {
5271        use fidl::Peered;
5272        self.inner.channel().signal_peer(clear_mask, set_mask)
5273    }
5274}
5275
5276impl IrqResourceControlHandle {}
5277
5278#[must_use = "FIDL methods require a response to be sent"]
5279#[derive(Debug)]
5280pub struct IrqResourceGetResponder {
5281    control_handle: std::mem::ManuallyDrop<IrqResourceControlHandle>,
5282    tx_id: u32,
5283}
5284
5285/// Set the the channel to be shutdown (see [`IrqResourceControlHandle::shutdown`])
5286/// if the responder is dropped without sending a response, so that the client
5287/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5288impl std::ops::Drop for IrqResourceGetResponder {
5289    fn drop(&mut self) {
5290        self.control_handle.shutdown();
5291        // Safety: drops once, never accessed again
5292        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5293    }
5294}
5295
5296impl fidl::endpoints::Responder for IrqResourceGetResponder {
5297    type ControlHandle = IrqResourceControlHandle;
5298
5299    fn control_handle(&self) -> &IrqResourceControlHandle {
5300        &self.control_handle
5301    }
5302
5303    fn drop_without_shutdown(mut self) {
5304        // Safety: drops once, never accessed again due to mem::forget
5305        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5306        // Prevent Drop from running (which would shut down the channel)
5307        std::mem::forget(self);
5308    }
5309}
5310
5311impl IrqResourceGetResponder {
5312    /// Sends a response to the FIDL transaction.
5313    ///
5314    /// Sets the channel to shutdown if an error occurs.
5315    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5316        let _result = self.send_raw(resource);
5317        if _result.is_err() {
5318            self.control_handle.shutdown();
5319        }
5320        self.drop_without_shutdown();
5321        _result
5322    }
5323
5324    /// Similar to "send" but does not shutdown the channel if an error occurs.
5325    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5326        let _result = self.send_raw(resource);
5327        self.drop_without_shutdown();
5328        _result
5329    }
5330
5331    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5332        self.control_handle.inner.send::<IrqResourceGetResponse>(
5333            (resource,),
5334            self.tx_id,
5335            0x491be54504b041e9,
5336            fidl::encoding::DynamicFlags::empty(),
5337        )
5338    }
5339}
5340
5341#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5342pub struct MexecResourceMarker;
5343
5344impl fidl::endpoints::ProtocolMarker for MexecResourceMarker {
5345    type Proxy = MexecResourceProxy;
5346    type RequestStream = MexecResourceRequestStream;
5347    #[cfg(target_os = "fuchsia")]
5348    type SynchronousProxy = MexecResourceSynchronousProxy;
5349
5350    const DEBUG_NAME: &'static str = "fuchsia.kernel.MexecResource";
5351}
5352impl fidl::endpoints::DiscoverableProtocolMarker for MexecResourceMarker {}
5353
5354pub trait MexecResourceProxyInterface: Send + Sync {
5355    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5356    fn r#get(&self) -> Self::GetResponseFut;
5357}
5358#[derive(Debug)]
5359#[cfg(target_os = "fuchsia")]
5360pub struct MexecResourceSynchronousProxy {
5361    client: fidl::client::sync::Client,
5362}
5363
5364#[cfg(target_os = "fuchsia")]
5365impl fidl::endpoints::SynchronousProxy for MexecResourceSynchronousProxy {
5366    type Proxy = MexecResourceProxy;
5367    type Protocol = MexecResourceMarker;
5368
5369    fn from_channel(inner: fidl::Channel) -> Self {
5370        Self::new(inner)
5371    }
5372
5373    fn into_channel(self) -> fidl::Channel {
5374        self.client.into_channel()
5375    }
5376
5377    fn as_channel(&self) -> &fidl::Channel {
5378        self.client.as_channel()
5379    }
5380}
5381
5382#[cfg(target_os = "fuchsia")]
5383impl MexecResourceSynchronousProxy {
5384    pub fn new(channel: fidl::Channel) -> Self {
5385        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5386        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5387    }
5388
5389    pub fn into_channel(self) -> fidl::Channel {
5390        self.client.into_channel()
5391    }
5392
5393    /// Waits until an event arrives and returns it. It is safe for other
5394    /// threads to make concurrent requests while waiting for an event.
5395    pub fn wait_for_event(
5396        &self,
5397        deadline: zx::MonotonicInstant,
5398    ) -> Result<MexecResourceEvent, fidl::Error> {
5399        MexecResourceEvent::decode(self.client.wait_for_event(deadline)?)
5400    }
5401
5402    /// Get an MEXEC resource handle as `resource`.
5403    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5404        let _response =
5405            self.client.send_query::<fidl::encoding::EmptyPayload, MexecResourceGetResponse>(
5406                (),
5407                0xff93e6722900f54,
5408                fidl::encoding::DynamicFlags::empty(),
5409                ___deadline,
5410            )?;
5411        Ok(_response.resource)
5412    }
5413}
5414
5415#[cfg(target_os = "fuchsia")]
5416impl From<MexecResourceSynchronousProxy> for zx::Handle {
5417    fn from(value: MexecResourceSynchronousProxy) -> Self {
5418        value.into_channel().into()
5419    }
5420}
5421
5422#[cfg(target_os = "fuchsia")]
5423impl From<fidl::Channel> for MexecResourceSynchronousProxy {
5424    fn from(value: fidl::Channel) -> Self {
5425        Self::new(value)
5426    }
5427}
5428
5429#[cfg(target_os = "fuchsia")]
5430impl fidl::endpoints::FromClient for MexecResourceSynchronousProxy {
5431    type Protocol = MexecResourceMarker;
5432
5433    fn from_client(value: fidl::endpoints::ClientEnd<MexecResourceMarker>) -> Self {
5434        Self::new(value.into_channel())
5435    }
5436}
5437
5438#[derive(Debug, Clone)]
5439pub struct MexecResourceProxy {
5440    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5441}
5442
5443impl fidl::endpoints::Proxy for MexecResourceProxy {
5444    type Protocol = MexecResourceMarker;
5445
5446    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5447        Self::new(inner)
5448    }
5449
5450    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5451        self.client.into_channel().map_err(|client| Self { client })
5452    }
5453
5454    fn as_channel(&self) -> &::fidl::AsyncChannel {
5455        self.client.as_channel()
5456    }
5457}
5458
5459impl MexecResourceProxy {
5460    /// Create a new Proxy for fuchsia.kernel/MexecResource.
5461    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5462        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5463        Self { client: fidl::client::Client::new(channel, protocol_name) }
5464    }
5465
5466    /// Get a Stream of events from the remote end of the protocol.
5467    ///
5468    /// # Panics
5469    ///
5470    /// Panics if the event stream was already taken.
5471    pub fn take_event_stream(&self) -> MexecResourceEventStream {
5472        MexecResourceEventStream { event_receiver: self.client.take_event_receiver() }
5473    }
5474
5475    /// Get an MEXEC resource handle as `resource`.
5476    pub fn r#get(
5477        &self,
5478    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5479    {
5480        MexecResourceProxyInterface::r#get(self)
5481    }
5482}
5483
5484impl MexecResourceProxyInterface for MexecResourceProxy {
5485    type GetResponseFut = fidl::client::QueryResponseFut<
5486        fidl::Resource,
5487        fidl::encoding::DefaultFuchsiaResourceDialect,
5488    >;
5489    fn r#get(&self) -> Self::GetResponseFut {
5490        fn _decode(
5491            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5492        ) -> Result<fidl::Resource, fidl::Error> {
5493            let _response = fidl::client::decode_transaction_body::<
5494                MexecResourceGetResponse,
5495                fidl::encoding::DefaultFuchsiaResourceDialect,
5496                0xff93e6722900f54,
5497            >(_buf?)?;
5498            Ok(_response.resource)
5499        }
5500        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5501            (),
5502            0xff93e6722900f54,
5503            fidl::encoding::DynamicFlags::empty(),
5504            _decode,
5505        )
5506    }
5507}
5508
5509pub struct MexecResourceEventStream {
5510    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5511}
5512
5513impl std::marker::Unpin for MexecResourceEventStream {}
5514
5515impl futures::stream::FusedStream for MexecResourceEventStream {
5516    fn is_terminated(&self) -> bool {
5517        self.event_receiver.is_terminated()
5518    }
5519}
5520
5521impl futures::Stream for MexecResourceEventStream {
5522    type Item = Result<MexecResourceEvent, fidl::Error>;
5523
5524    fn poll_next(
5525        mut self: std::pin::Pin<&mut Self>,
5526        cx: &mut std::task::Context<'_>,
5527    ) -> std::task::Poll<Option<Self::Item>> {
5528        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5529            &mut self.event_receiver,
5530            cx
5531        )?) {
5532            Some(buf) => std::task::Poll::Ready(Some(MexecResourceEvent::decode(buf))),
5533            None => std::task::Poll::Ready(None),
5534        }
5535    }
5536}
5537
5538#[derive(Debug)]
5539pub enum MexecResourceEvent {}
5540
5541impl MexecResourceEvent {
5542    /// Decodes a message buffer as a [`MexecResourceEvent`].
5543    fn decode(
5544        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5545    ) -> Result<MexecResourceEvent, fidl::Error> {
5546        let (bytes, _handles) = buf.split_mut();
5547        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5548        debug_assert_eq!(tx_header.tx_id, 0);
5549        match tx_header.ordinal {
5550            _ => Err(fidl::Error::UnknownOrdinal {
5551                ordinal: tx_header.ordinal,
5552                protocol_name: <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5553            }),
5554        }
5555    }
5556}
5557
5558/// A Stream of incoming requests for fuchsia.kernel/MexecResource.
5559pub struct MexecResourceRequestStream {
5560    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5561    is_terminated: bool,
5562}
5563
5564impl std::marker::Unpin for MexecResourceRequestStream {}
5565
5566impl futures::stream::FusedStream for MexecResourceRequestStream {
5567    fn is_terminated(&self) -> bool {
5568        self.is_terminated
5569    }
5570}
5571
5572impl fidl::endpoints::RequestStream for MexecResourceRequestStream {
5573    type Protocol = MexecResourceMarker;
5574    type ControlHandle = MexecResourceControlHandle;
5575
5576    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5577        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5578    }
5579
5580    fn control_handle(&self) -> Self::ControlHandle {
5581        MexecResourceControlHandle { inner: self.inner.clone() }
5582    }
5583
5584    fn into_inner(
5585        self,
5586    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5587    {
5588        (self.inner, self.is_terminated)
5589    }
5590
5591    fn from_inner(
5592        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5593        is_terminated: bool,
5594    ) -> Self {
5595        Self { inner, is_terminated }
5596    }
5597}
5598
5599impl futures::Stream for MexecResourceRequestStream {
5600    type Item = Result<MexecResourceRequest, fidl::Error>;
5601
5602    fn poll_next(
5603        mut self: std::pin::Pin<&mut Self>,
5604        cx: &mut std::task::Context<'_>,
5605    ) -> std::task::Poll<Option<Self::Item>> {
5606        let this = &mut *self;
5607        if this.inner.check_shutdown(cx) {
5608            this.is_terminated = true;
5609            return std::task::Poll::Ready(None);
5610        }
5611        if this.is_terminated {
5612            panic!("polled MexecResourceRequestStream after completion");
5613        }
5614        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5615            |bytes, handles| {
5616                match this.inner.channel().read_etc(cx, bytes, handles) {
5617                    std::task::Poll::Ready(Ok(())) => {}
5618                    std::task::Poll::Pending => return std::task::Poll::Pending,
5619                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5620                        this.is_terminated = true;
5621                        return std::task::Poll::Ready(None);
5622                    }
5623                    std::task::Poll::Ready(Err(e)) => {
5624                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5625                            e.into(),
5626                        ))))
5627                    }
5628                }
5629
5630                // A message has been received from the channel
5631                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5632
5633                std::task::Poll::Ready(Some(match header.ordinal {
5634                    0xff93e6722900f54 => {
5635                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5636                        let mut req = fidl::new_empty!(
5637                            fidl::encoding::EmptyPayload,
5638                            fidl::encoding::DefaultFuchsiaResourceDialect
5639                        );
5640                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5641                        let control_handle =
5642                            MexecResourceControlHandle { inner: this.inner.clone() };
5643                        Ok(MexecResourceRequest::Get {
5644                            responder: MexecResourceGetResponder {
5645                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5646                                tx_id: header.tx_id,
5647                            },
5648                        })
5649                    }
5650                    _ => Err(fidl::Error::UnknownOrdinal {
5651                        ordinal: header.ordinal,
5652                        protocol_name:
5653                            <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5654                    }),
5655                }))
5656            },
5657        )
5658    }
5659}
5660
5661/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
5662/// `ZX_RSRC_SYSTEM_MEXEC_BASE`.
5663#[derive(Debug)]
5664pub enum MexecResourceRequest {
5665    /// Get an MEXEC resource handle as `resource`.
5666    Get { responder: MexecResourceGetResponder },
5667}
5668
5669impl MexecResourceRequest {
5670    #[allow(irrefutable_let_patterns)]
5671    pub fn into_get(self) -> Option<(MexecResourceGetResponder)> {
5672        if let MexecResourceRequest::Get { responder } = self {
5673            Some((responder))
5674        } else {
5675            None
5676        }
5677    }
5678
5679    /// Name of the method defined in FIDL
5680    pub fn method_name(&self) -> &'static str {
5681        match *self {
5682            MexecResourceRequest::Get { .. } => "get",
5683        }
5684    }
5685}
5686
5687#[derive(Debug, Clone)]
5688pub struct MexecResourceControlHandle {
5689    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5690}
5691
5692impl fidl::endpoints::ControlHandle for MexecResourceControlHandle {
5693    fn shutdown(&self) {
5694        self.inner.shutdown()
5695    }
5696    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5697        self.inner.shutdown_with_epitaph(status)
5698    }
5699
5700    fn is_closed(&self) -> bool {
5701        self.inner.channel().is_closed()
5702    }
5703    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5704        self.inner.channel().on_closed()
5705    }
5706
5707    #[cfg(target_os = "fuchsia")]
5708    fn signal_peer(
5709        &self,
5710        clear_mask: zx::Signals,
5711        set_mask: zx::Signals,
5712    ) -> Result<(), zx_status::Status> {
5713        use fidl::Peered;
5714        self.inner.channel().signal_peer(clear_mask, set_mask)
5715    }
5716}
5717
5718impl MexecResourceControlHandle {}
5719
5720#[must_use = "FIDL methods require a response to be sent"]
5721#[derive(Debug)]
5722pub struct MexecResourceGetResponder {
5723    control_handle: std::mem::ManuallyDrop<MexecResourceControlHandle>,
5724    tx_id: u32,
5725}
5726
5727/// Set the the channel to be shutdown (see [`MexecResourceControlHandle::shutdown`])
5728/// if the responder is dropped without sending a response, so that the client
5729/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5730impl std::ops::Drop for MexecResourceGetResponder {
5731    fn drop(&mut self) {
5732        self.control_handle.shutdown();
5733        // Safety: drops once, never accessed again
5734        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5735    }
5736}
5737
5738impl fidl::endpoints::Responder for MexecResourceGetResponder {
5739    type ControlHandle = MexecResourceControlHandle;
5740
5741    fn control_handle(&self) -> &MexecResourceControlHandle {
5742        &self.control_handle
5743    }
5744
5745    fn drop_without_shutdown(mut self) {
5746        // Safety: drops once, never accessed again due to mem::forget
5747        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5748        // Prevent Drop from running (which would shut down the channel)
5749        std::mem::forget(self);
5750    }
5751}
5752
5753impl MexecResourceGetResponder {
5754    /// Sends a response to the FIDL transaction.
5755    ///
5756    /// Sets the channel to shutdown if an error occurs.
5757    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5758        let _result = self.send_raw(resource);
5759        if _result.is_err() {
5760            self.control_handle.shutdown();
5761        }
5762        self.drop_without_shutdown();
5763        _result
5764    }
5765
5766    /// Similar to "send" but does not shutdown the channel if an error occurs.
5767    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5768        let _result = self.send_raw(resource);
5769        self.drop_without_shutdown();
5770        _result
5771    }
5772
5773    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5774        self.control_handle.inner.send::<MexecResourceGetResponse>(
5775            (resource,),
5776            self.tx_id,
5777            0xff93e6722900f54,
5778            fidl::encoding::DynamicFlags::empty(),
5779        )
5780    }
5781}
5782
5783#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5784pub struct MmioResourceMarker;
5785
5786impl fidl::endpoints::ProtocolMarker for MmioResourceMarker {
5787    type Proxy = MmioResourceProxy;
5788    type RequestStream = MmioResourceRequestStream;
5789    #[cfg(target_os = "fuchsia")]
5790    type SynchronousProxy = MmioResourceSynchronousProxy;
5791
5792    const DEBUG_NAME: &'static str = "fuchsia.kernel.MmioResource";
5793}
5794impl fidl::endpoints::DiscoverableProtocolMarker for MmioResourceMarker {}
5795
5796pub trait MmioResourceProxyInterface: Send + Sync {
5797    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5798    fn r#get(&self) -> Self::GetResponseFut;
5799}
5800#[derive(Debug)]
5801#[cfg(target_os = "fuchsia")]
5802pub struct MmioResourceSynchronousProxy {
5803    client: fidl::client::sync::Client,
5804}
5805
5806#[cfg(target_os = "fuchsia")]
5807impl fidl::endpoints::SynchronousProxy for MmioResourceSynchronousProxy {
5808    type Proxy = MmioResourceProxy;
5809    type Protocol = MmioResourceMarker;
5810
5811    fn from_channel(inner: fidl::Channel) -> Self {
5812        Self::new(inner)
5813    }
5814
5815    fn into_channel(self) -> fidl::Channel {
5816        self.client.into_channel()
5817    }
5818
5819    fn as_channel(&self) -> &fidl::Channel {
5820        self.client.as_channel()
5821    }
5822}
5823
5824#[cfg(target_os = "fuchsia")]
5825impl MmioResourceSynchronousProxy {
5826    pub fn new(channel: fidl::Channel) -> Self {
5827        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5828        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5829    }
5830
5831    pub fn into_channel(self) -> fidl::Channel {
5832        self.client.into_channel()
5833    }
5834
5835    /// Waits until an event arrives and returns it. It is safe for other
5836    /// threads to make concurrent requests while waiting for an event.
5837    pub fn wait_for_event(
5838        &self,
5839        deadline: zx::MonotonicInstant,
5840    ) -> Result<MmioResourceEvent, fidl::Error> {
5841        MmioResourceEvent::decode(self.client.wait_for_event(deadline)?)
5842    }
5843
5844    /// Get an MMIO resource handle.
5845    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5846        let _response =
5847            self.client.send_query::<fidl::encoding::EmptyPayload, MmioResourceGetResponse>(
5848                (),
5849                0x66747b9c5a6dfe7b,
5850                fidl::encoding::DynamicFlags::empty(),
5851                ___deadline,
5852            )?;
5853        Ok(_response.resource)
5854    }
5855}
5856
5857#[cfg(target_os = "fuchsia")]
5858impl From<MmioResourceSynchronousProxy> for zx::Handle {
5859    fn from(value: MmioResourceSynchronousProxy) -> Self {
5860        value.into_channel().into()
5861    }
5862}
5863
5864#[cfg(target_os = "fuchsia")]
5865impl From<fidl::Channel> for MmioResourceSynchronousProxy {
5866    fn from(value: fidl::Channel) -> Self {
5867        Self::new(value)
5868    }
5869}
5870
5871#[cfg(target_os = "fuchsia")]
5872impl fidl::endpoints::FromClient for MmioResourceSynchronousProxy {
5873    type Protocol = MmioResourceMarker;
5874
5875    fn from_client(value: fidl::endpoints::ClientEnd<MmioResourceMarker>) -> Self {
5876        Self::new(value.into_channel())
5877    }
5878}
5879
5880#[derive(Debug, Clone)]
5881pub struct MmioResourceProxy {
5882    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5883}
5884
5885impl fidl::endpoints::Proxy for MmioResourceProxy {
5886    type Protocol = MmioResourceMarker;
5887
5888    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5889        Self::new(inner)
5890    }
5891
5892    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5893        self.client.into_channel().map_err(|client| Self { client })
5894    }
5895
5896    fn as_channel(&self) -> &::fidl::AsyncChannel {
5897        self.client.as_channel()
5898    }
5899}
5900
5901impl MmioResourceProxy {
5902    /// Create a new Proxy for fuchsia.kernel/MmioResource.
5903    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5904        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5905        Self { client: fidl::client::Client::new(channel, protocol_name) }
5906    }
5907
5908    /// Get a Stream of events from the remote end of the protocol.
5909    ///
5910    /// # Panics
5911    ///
5912    /// Panics if the event stream was already taken.
5913    pub fn take_event_stream(&self) -> MmioResourceEventStream {
5914        MmioResourceEventStream { event_receiver: self.client.take_event_receiver() }
5915    }
5916
5917    /// Get an MMIO resource handle.
5918    pub fn r#get(
5919        &self,
5920    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5921    {
5922        MmioResourceProxyInterface::r#get(self)
5923    }
5924}
5925
5926impl MmioResourceProxyInterface for MmioResourceProxy {
5927    type GetResponseFut = fidl::client::QueryResponseFut<
5928        fidl::Resource,
5929        fidl::encoding::DefaultFuchsiaResourceDialect,
5930    >;
5931    fn r#get(&self) -> Self::GetResponseFut {
5932        fn _decode(
5933            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5934        ) -> Result<fidl::Resource, fidl::Error> {
5935            let _response = fidl::client::decode_transaction_body::<
5936                MmioResourceGetResponse,
5937                fidl::encoding::DefaultFuchsiaResourceDialect,
5938                0x66747b9c5a6dfe7b,
5939            >(_buf?)?;
5940            Ok(_response.resource)
5941        }
5942        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5943            (),
5944            0x66747b9c5a6dfe7b,
5945            fidl::encoding::DynamicFlags::empty(),
5946            _decode,
5947        )
5948    }
5949}
5950
5951pub struct MmioResourceEventStream {
5952    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5953}
5954
5955impl std::marker::Unpin for MmioResourceEventStream {}
5956
5957impl futures::stream::FusedStream for MmioResourceEventStream {
5958    fn is_terminated(&self) -> bool {
5959        self.event_receiver.is_terminated()
5960    }
5961}
5962
5963impl futures::Stream for MmioResourceEventStream {
5964    type Item = Result<MmioResourceEvent, fidl::Error>;
5965
5966    fn poll_next(
5967        mut self: std::pin::Pin<&mut Self>,
5968        cx: &mut std::task::Context<'_>,
5969    ) -> std::task::Poll<Option<Self::Item>> {
5970        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5971            &mut self.event_receiver,
5972            cx
5973        )?) {
5974            Some(buf) => std::task::Poll::Ready(Some(MmioResourceEvent::decode(buf))),
5975            None => std::task::Poll::Ready(None),
5976        }
5977    }
5978}
5979
5980#[derive(Debug)]
5981pub enum MmioResourceEvent {}
5982
5983impl MmioResourceEvent {
5984    /// Decodes a message buffer as a [`MmioResourceEvent`].
5985    fn decode(
5986        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5987    ) -> Result<MmioResourceEvent, fidl::Error> {
5988        let (bytes, _handles) = buf.split_mut();
5989        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5990        debug_assert_eq!(tx_header.tx_id, 0);
5991        match tx_header.ordinal {
5992            _ => Err(fidl::Error::UnknownOrdinal {
5993                ordinal: tx_header.ordinal,
5994                protocol_name: <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5995            }),
5996        }
5997    }
5998}
5999
6000/// A Stream of incoming requests for fuchsia.kernel/MmioResource.
6001pub struct MmioResourceRequestStream {
6002    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6003    is_terminated: bool,
6004}
6005
6006impl std::marker::Unpin for MmioResourceRequestStream {}
6007
6008impl futures::stream::FusedStream for MmioResourceRequestStream {
6009    fn is_terminated(&self) -> bool {
6010        self.is_terminated
6011    }
6012}
6013
6014impl fidl::endpoints::RequestStream for MmioResourceRequestStream {
6015    type Protocol = MmioResourceMarker;
6016    type ControlHandle = MmioResourceControlHandle;
6017
6018    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6019        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6020    }
6021
6022    fn control_handle(&self) -> Self::ControlHandle {
6023        MmioResourceControlHandle { inner: self.inner.clone() }
6024    }
6025
6026    fn into_inner(
6027        self,
6028    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6029    {
6030        (self.inner, self.is_terminated)
6031    }
6032
6033    fn from_inner(
6034        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6035        is_terminated: bool,
6036    ) -> Self {
6037        Self { inner, is_terminated }
6038    }
6039}
6040
6041impl futures::Stream for MmioResourceRequestStream {
6042    type Item = Result<MmioResourceRequest, fidl::Error>;
6043
6044    fn poll_next(
6045        mut self: std::pin::Pin<&mut Self>,
6046        cx: &mut std::task::Context<'_>,
6047    ) -> std::task::Poll<Option<Self::Item>> {
6048        let this = &mut *self;
6049        if this.inner.check_shutdown(cx) {
6050            this.is_terminated = true;
6051            return std::task::Poll::Ready(None);
6052        }
6053        if this.is_terminated {
6054            panic!("polled MmioResourceRequestStream after completion");
6055        }
6056        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6057            |bytes, handles| {
6058                match this.inner.channel().read_etc(cx, bytes, handles) {
6059                    std::task::Poll::Ready(Ok(())) => {}
6060                    std::task::Poll::Pending => return std::task::Poll::Pending,
6061                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6062                        this.is_terminated = true;
6063                        return std::task::Poll::Ready(None);
6064                    }
6065                    std::task::Poll::Ready(Err(e)) => {
6066                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6067                            e.into(),
6068                        ))))
6069                    }
6070                }
6071
6072                // A message has been received from the channel
6073                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6074
6075                std::task::Poll::Ready(Some(match header.ordinal {
6076                    0x66747b9c5a6dfe7b => {
6077                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6078                        let mut req = fidl::new_empty!(
6079                            fidl::encoding::EmptyPayload,
6080                            fidl::encoding::DefaultFuchsiaResourceDialect
6081                        );
6082                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6083                        let control_handle =
6084                            MmioResourceControlHandle { inner: this.inner.clone() };
6085                        Ok(MmioResourceRequest::Get {
6086                            responder: MmioResourceGetResponder {
6087                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6088                                tx_id: header.tx_id,
6089                            },
6090                        })
6091                    }
6092                    _ => Err(fidl::Error::UnknownOrdinal {
6093                        ordinal: header.ordinal,
6094                        protocol_name:
6095                            <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6096                    }),
6097                }))
6098            },
6099        )
6100    }
6101}
6102
6103/// Protocol for providing an MMIO resource with access to all valid ranges.
6104#[derive(Debug)]
6105pub enum MmioResourceRequest {
6106    /// Get an MMIO resource handle.
6107    Get { responder: MmioResourceGetResponder },
6108}
6109
6110impl MmioResourceRequest {
6111    #[allow(irrefutable_let_patterns)]
6112    pub fn into_get(self) -> Option<(MmioResourceGetResponder)> {
6113        if let MmioResourceRequest::Get { responder } = self {
6114            Some((responder))
6115        } else {
6116            None
6117        }
6118    }
6119
6120    /// Name of the method defined in FIDL
6121    pub fn method_name(&self) -> &'static str {
6122        match *self {
6123            MmioResourceRequest::Get { .. } => "get",
6124        }
6125    }
6126}
6127
6128#[derive(Debug, Clone)]
6129pub struct MmioResourceControlHandle {
6130    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6131}
6132
6133impl fidl::endpoints::ControlHandle for MmioResourceControlHandle {
6134    fn shutdown(&self) {
6135        self.inner.shutdown()
6136    }
6137    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6138        self.inner.shutdown_with_epitaph(status)
6139    }
6140
6141    fn is_closed(&self) -> bool {
6142        self.inner.channel().is_closed()
6143    }
6144    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6145        self.inner.channel().on_closed()
6146    }
6147
6148    #[cfg(target_os = "fuchsia")]
6149    fn signal_peer(
6150        &self,
6151        clear_mask: zx::Signals,
6152        set_mask: zx::Signals,
6153    ) -> Result<(), zx_status::Status> {
6154        use fidl::Peered;
6155        self.inner.channel().signal_peer(clear_mask, set_mask)
6156    }
6157}
6158
6159impl MmioResourceControlHandle {}
6160
6161#[must_use = "FIDL methods require a response to be sent"]
6162#[derive(Debug)]
6163pub struct MmioResourceGetResponder {
6164    control_handle: std::mem::ManuallyDrop<MmioResourceControlHandle>,
6165    tx_id: u32,
6166}
6167
6168/// Set the the channel to be shutdown (see [`MmioResourceControlHandle::shutdown`])
6169/// if the responder is dropped without sending a response, so that the client
6170/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6171impl std::ops::Drop for MmioResourceGetResponder {
6172    fn drop(&mut self) {
6173        self.control_handle.shutdown();
6174        // Safety: drops once, never accessed again
6175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6176    }
6177}
6178
6179impl fidl::endpoints::Responder for MmioResourceGetResponder {
6180    type ControlHandle = MmioResourceControlHandle;
6181
6182    fn control_handle(&self) -> &MmioResourceControlHandle {
6183        &self.control_handle
6184    }
6185
6186    fn drop_without_shutdown(mut self) {
6187        // Safety: drops once, never accessed again due to mem::forget
6188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6189        // Prevent Drop from running (which would shut down the channel)
6190        std::mem::forget(self);
6191    }
6192}
6193
6194impl MmioResourceGetResponder {
6195    /// Sends a response to the FIDL transaction.
6196    ///
6197    /// Sets the channel to shutdown if an error occurs.
6198    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6199        let _result = self.send_raw(resource);
6200        if _result.is_err() {
6201            self.control_handle.shutdown();
6202        }
6203        self.drop_without_shutdown();
6204        _result
6205    }
6206
6207    /// Similar to "send" but does not shutdown the channel if an error occurs.
6208    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6209        let _result = self.send_raw(resource);
6210        self.drop_without_shutdown();
6211        _result
6212    }
6213
6214    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6215        self.control_handle.inner.send::<MmioResourceGetResponse>(
6216            (resource,),
6217            self.tx_id,
6218            0x66747b9c5a6dfe7b,
6219            fidl::encoding::DynamicFlags::empty(),
6220        )
6221    }
6222}
6223
6224#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6225pub struct MsiResourceMarker;
6226
6227impl fidl::endpoints::ProtocolMarker for MsiResourceMarker {
6228    type Proxy = MsiResourceProxy;
6229    type RequestStream = MsiResourceRequestStream;
6230    #[cfg(target_os = "fuchsia")]
6231    type SynchronousProxy = MsiResourceSynchronousProxy;
6232
6233    const DEBUG_NAME: &'static str = "fuchsia.kernel.MsiResource";
6234}
6235impl fidl::endpoints::DiscoverableProtocolMarker for MsiResourceMarker {}
6236
6237pub trait MsiResourceProxyInterface: Send + Sync {
6238    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6239    fn r#get(&self) -> Self::GetResponseFut;
6240}
6241#[derive(Debug)]
6242#[cfg(target_os = "fuchsia")]
6243pub struct MsiResourceSynchronousProxy {
6244    client: fidl::client::sync::Client,
6245}
6246
6247#[cfg(target_os = "fuchsia")]
6248impl fidl::endpoints::SynchronousProxy for MsiResourceSynchronousProxy {
6249    type Proxy = MsiResourceProxy;
6250    type Protocol = MsiResourceMarker;
6251
6252    fn from_channel(inner: fidl::Channel) -> Self {
6253        Self::new(inner)
6254    }
6255
6256    fn into_channel(self) -> fidl::Channel {
6257        self.client.into_channel()
6258    }
6259
6260    fn as_channel(&self) -> &fidl::Channel {
6261        self.client.as_channel()
6262    }
6263}
6264
6265#[cfg(target_os = "fuchsia")]
6266impl MsiResourceSynchronousProxy {
6267    pub fn new(channel: fidl::Channel) -> Self {
6268        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6269        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6270    }
6271
6272    pub fn into_channel(self) -> fidl::Channel {
6273        self.client.into_channel()
6274    }
6275
6276    /// Waits until an event arrives and returns it. It is safe for other
6277    /// threads to make concurrent requests while waiting for an event.
6278    pub fn wait_for_event(
6279        &self,
6280        deadline: zx::MonotonicInstant,
6281    ) -> Result<MsiResourceEvent, fidl::Error> {
6282        MsiResourceEvent::decode(self.client.wait_for_event(deadline)?)
6283    }
6284
6285    /// Get an msi resource handle.
6286    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6287        let _response =
6288            self.client.send_query::<fidl::encoding::EmptyPayload, MsiResourceGetResponse>(
6289                (),
6290                0x360a97e47e8c4f1f,
6291                fidl::encoding::DynamicFlags::empty(),
6292                ___deadline,
6293            )?;
6294        Ok(_response.resource)
6295    }
6296}
6297
6298#[cfg(target_os = "fuchsia")]
6299impl From<MsiResourceSynchronousProxy> for zx::Handle {
6300    fn from(value: MsiResourceSynchronousProxy) -> Self {
6301        value.into_channel().into()
6302    }
6303}
6304
6305#[cfg(target_os = "fuchsia")]
6306impl From<fidl::Channel> for MsiResourceSynchronousProxy {
6307    fn from(value: fidl::Channel) -> Self {
6308        Self::new(value)
6309    }
6310}
6311
6312#[cfg(target_os = "fuchsia")]
6313impl fidl::endpoints::FromClient for MsiResourceSynchronousProxy {
6314    type Protocol = MsiResourceMarker;
6315
6316    fn from_client(value: fidl::endpoints::ClientEnd<MsiResourceMarker>) -> Self {
6317        Self::new(value.into_channel())
6318    }
6319}
6320
6321#[derive(Debug, Clone)]
6322pub struct MsiResourceProxy {
6323    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6324}
6325
6326impl fidl::endpoints::Proxy for MsiResourceProxy {
6327    type Protocol = MsiResourceMarker;
6328
6329    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6330        Self::new(inner)
6331    }
6332
6333    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6334        self.client.into_channel().map_err(|client| Self { client })
6335    }
6336
6337    fn as_channel(&self) -> &::fidl::AsyncChannel {
6338        self.client.as_channel()
6339    }
6340}
6341
6342impl MsiResourceProxy {
6343    /// Create a new Proxy for fuchsia.kernel/MsiResource.
6344    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6345        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6346        Self { client: fidl::client::Client::new(channel, protocol_name) }
6347    }
6348
6349    /// Get a Stream of events from the remote end of the protocol.
6350    ///
6351    /// # Panics
6352    ///
6353    /// Panics if the event stream was already taken.
6354    pub fn take_event_stream(&self) -> MsiResourceEventStream {
6355        MsiResourceEventStream { event_receiver: self.client.take_event_receiver() }
6356    }
6357
6358    /// Get an msi resource handle.
6359    pub fn r#get(
6360        &self,
6361    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6362    {
6363        MsiResourceProxyInterface::r#get(self)
6364    }
6365}
6366
6367impl MsiResourceProxyInterface for MsiResourceProxy {
6368    type GetResponseFut = fidl::client::QueryResponseFut<
6369        fidl::Resource,
6370        fidl::encoding::DefaultFuchsiaResourceDialect,
6371    >;
6372    fn r#get(&self) -> Self::GetResponseFut {
6373        fn _decode(
6374            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6375        ) -> Result<fidl::Resource, fidl::Error> {
6376            let _response = fidl::client::decode_transaction_body::<
6377                MsiResourceGetResponse,
6378                fidl::encoding::DefaultFuchsiaResourceDialect,
6379                0x360a97e47e8c4f1f,
6380            >(_buf?)?;
6381            Ok(_response.resource)
6382        }
6383        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6384            (),
6385            0x360a97e47e8c4f1f,
6386            fidl::encoding::DynamicFlags::empty(),
6387            _decode,
6388        )
6389    }
6390}
6391
6392pub struct MsiResourceEventStream {
6393    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6394}
6395
6396impl std::marker::Unpin for MsiResourceEventStream {}
6397
6398impl futures::stream::FusedStream for MsiResourceEventStream {
6399    fn is_terminated(&self) -> bool {
6400        self.event_receiver.is_terminated()
6401    }
6402}
6403
6404impl futures::Stream for MsiResourceEventStream {
6405    type Item = Result<MsiResourceEvent, fidl::Error>;
6406
6407    fn poll_next(
6408        mut self: std::pin::Pin<&mut Self>,
6409        cx: &mut std::task::Context<'_>,
6410    ) -> std::task::Poll<Option<Self::Item>> {
6411        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6412            &mut self.event_receiver,
6413            cx
6414        )?) {
6415            Some(buf) => std::task::Poll::Ready(Some(MsiResourceEvent::decode(buf))),
6416            None => std::task::Poll::Ready(None),
6417        }
6418    }
6419}
6420
6421#[derive(Debug)]
6422pub enum MsiResourceEvent {}
6423
6424impl MsiResourceEvent {
6425    /// Decodes a message buffer as a [`MsiResourceEvent`].
6426    fn decode(
6427        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6428    ) -> Result<MsiResourceEvent, fidl::Error> {
6429        let (bytes, _handles) = buf.split_mut();
6430        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6431        debug_assert_eq!(tx_header.tx_id, 0);
6432        match tx_header.ordinal {
6433            _ => Err(fidl::Error::UnknownOrdinal {
6434                ordinal: tx_header.ordinal,
6435                protocol_name: <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6436            }),
6437        }
6438    }
6439}
6440
6441/// A Stream of incoming requests for fuchsia.kernel/MsiResource.
6442pub struct MsiResourceRequestStream {
6443    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6444    is_terminated: bool,
6445}
6446
6447impl std::marker::Unpin for MsiResourceRequestStream {}
6448
6449impl futures::stream::FusedStream for MsiResourceRequestStream {
6450    fn is_terminated(&self) -> bool {
6451        self.is_terminated
6452    }
6453}
6454
6455impl fidl::endpoints::RequestStream for MsiResourceRequestStream {
6456    type Protocol = MsiResourceMarker;
6457    type ControlHandle = MsiResourceControlHandle;
6458
6459    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6460        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6461    }
6462
6463    fn control_handle(&self) -> Self::ControlHandle {
6464        MsiResourceControlHandle { inner: self.inner.clone() }
6465    }
6466
6467    fn into_inner(
6468        self,
6469    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6470    {
6471        (self.inner, self.is_terminated)
6472    }
6473
6474    fn from_inner(
6475        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6476        is_terminated: bool,
6477    ) -> Self {
6478        Self { inner, is_terminated }
6479    }
6480}
6481
6482impl futures::Stream for MsiResourceRequestStream {
6483    type Item = Result<MsiResourceRequest, fidl::Error>;
6484
6485    fn poll_next(
6486        mut self: std::pin::Pin<&mut Self>,
6487        cx: &mut std::task::Context<'_>,
6488    ) -> std::task::Poll<Option<Self::Item>> {
6489        let this = &mut *self;
6490        if this.inner.check_shutdown(cx) {
6491            this.is_terminated = true;
6492            return std::task::Poll::Ready(None);
6493        }
6494        if this.is_terminated {
6495            panic!("polled MsiResourceRequestStream after completion");
6496        }
6497        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6498            |bytes, handles| {
6499                match this.inner.channel().read_etc(cx, bytes, handles) {
6500                    std::task::Poll::Ready(Ok(())) => {}
6501                    std::task::Poll::Pending => return std::task::Poll::Pending,
6502                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6503                        this.is_terminated = true;
6504                        return std::task::Poll::Ready(None);
6505                    }
6506                    std::task::Poll::Ready(Err(e)) => {
6507                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6508                            e.into(),
6509                        ))))
6510                    }
6511                }
6512
6513                // A message has been received from the channel
6514                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6515
6516                std::task::Poll::Ready(Some(match header.ordinal {
6517                    0x360a97e47e8c4f1f => {
6518                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6519                        let mut req = fidl::new_empty!(
6520                            fidl::encoding::EmptyPayload,
6521                            fidl::encoding::DefaultFuchsiaResourceDialect
6522                        );
6523                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6524                        let control_handle = MsiResourceControlHandle { inner: this.inner.clone() };
6525                        Ok(MsiResourceRequest::Get {
6526                            responder: MsiResourceGetResponder {
6527                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6528                                tx_id: header.tx_id,
6529                            },
6530                        })
6531                    }
6532                    _ => Err(fidl::Error::UnknownOrdinal {
6533                        ordinal: header.ordinal,
6534                        protocol_name:
6535                            <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6536                    }),
6537                }))
6538            },
6539        )
6540    }
6541}
6542
6543/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6544/// `ZX_RSRC_SYSTEM_MSI_BASE`.
6545#[derive(Debug)]
6546pub enum MsiResourceRequest {
6547    /// Get an msi resource handle.
6548    Get { responder: MsiResourceGetResponder },
6549}
6550
6551impl MsiResourceRequest {
6552    #[allow(irrefutable_let_patterns)]
6553    pub fn into_get(self) -> Option<(MsiResourceGetResponder)> {
6554        if let MsiResourceRequest::Get { responder } = self {
6555            Some((responder))
6556        } else {
6557            None
6558        }
6559    }
6560
6561    /// Name of the method defined in FIDL
6562    pub fn method_name(&self) -> &'static str {
6563        match *self {
6564            MsiResourceRequest::Get { .. } => "get",
6565        }
6566    }
6567}
6568
6569#[derive(Debug, Clone)]
6570pub struct MsiResourceControlHandle {
6571    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6572}
6573
6574impl fidl::endpoints::ControlHandle for MsiResourceControlHandle {
6575    fn shutdown(&self) {
6576        self.inner.shutdown()
6577    }
6578    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6579        self.inner.shutdown_with_epitaph(status)
6580    }
6581
6582    fn is_closed(&self) -> bool {
6583        self.inner.channel().is_closed()
6584    }
6585    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6586        self.inner.channel().on_closed()
6587    }
6588
6589    #[cfg(target_os = "fuchsia")]
6590    fn signal_peer(
6591        &self,
6592        clear_mask: zx::Signals,
6593        set_mask: zx::Signals,
6594    ) -> Result<(), zx_status::Status> {
6595        use fidl::Peered;
6596        self.inner.channel().signal_peer(clear_mask, set_mask)
6597    }
6598}
6599
6600impl MsiResourceControlHandle {}
6601
6602#[must_use = "FIDL methods require a response to be sent"]
6603#[derive(Debug)]
6604pub struct MsiResourceGetResponder {
6605    control_handle: std::mem::ManuallyDrop<MsiResourceControlHandle>,
6606    tx_id: u32,
6607}
6608
6609/// Set the the channel to be shutdown (see [`MsiResourceControlHandle::shutdown`])
6610/// if the responder is dropped without sending a response, so that the client
6611/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6612impl std::ops::Drop for MsiResourceGetResponder {
6613    fn drop(&mut self) {
6614        self.control_handle.shutdown();
6615        // Safety: drops once, never accessed again
6616        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6617    }
6618}
6619
6620impl fidl::endpoints::Responder for MsiResourceGetResponder {
6621    type ControlHandle = MsiResourceControlHandle;
6622
6623    fn control_handle(&self) -> &MsiResourceControlHandle {
6624        &self.control_handle
6625    }
6626
6627    fn drop_without_shutdown(mut self) {
6628        // Safety: drops once, never accessed again due to mem::forget
6629        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6630        // Prevent Drop from running (which would shut down the channel)
6631        std::mem::forget(self);
6632    }
6633}
6634
6635impl MsiResourceGetResponder {
6636    /// Sends a response to the FIDL transaction.
6637    ///
6638    /// Sets the channel to shutdown if an error occurs.
6639    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6640        let _result = self.send_raw(resource);
6641        if _result.is_err() {
6642            self.control_handle.shutdown();
6643        }
6644        self.drop_without_shutdown();
6645        _result
6646    }
6647
6648    /// Similar to "send" but does not shutdown the channel if an error occurs.
6649    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6650        let _result = self.send_raw(resource);
6651        self.drop_without_shutdown();
6652        _result
6653    }
6654
6655    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6656        self.control_handle.inner.send::<MsiResourceGetResponse>(
6657            (resource,),
6658            self.tx_id,
6659            0x360a97e47e8c4f1f,
6660            fidl::encoding::DynamicFlags::empty(),
6661        )
6662    }
6663}
6664
6665#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6666pub struct PowerResourceMarker;
6667
6668impl fidl::endpoints::ProtocolMarker for PowerResourceMarker {
6669    type Proxy = PowerResourceProxy;
6670    type RequestStream = PowerResourceRequestStream;
6671    #[cfg(target_os = "fuchsia")]
6672    type SynchronousProxy = PowerResourceSynchronousProxy;
6673
6674    const DEBUG_NAME: &'static str = "fuchsia.kernel.PowerResource";
6675}
6676impl fidl::endpoints::DiscoverableProtocolMarker for PowerResourceMarker {}
6677
6678pub trait PowerResourceProxyInterface: Send + Sync {
6679    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6680    fn r#get(&self) -> Self::GetResponseFut;
6681}
6682#[derive(Debug)]
6683#[cfg(target_os = "fuchsia")]
6684pub struct PowerResourceSynchronousProxy {
6685    client: fidl::client::sync::Client,
6686}
6687
6688#[cfg(target_os = "fuchsia")]
6689impl fidl::endpoints::SynchronousProxy for PowerResourceSynchronousProxy {
6690    type Proxy = PowerResourceProxy;
6691    type Protocol = PowerResourceMarker;
6692
6693    fn from_channel(inner: fidl::Channel) -> Self {
6694        Self::new(inner)
6695    }
6696
6697    fn into_channel(self) -> fidl::Channel {
6698        self.client.into_channel()
6699    }
6700
6701    fn as_channel(&self) -> &fidl::Channel {
6702        self.client.as_channel()
6703    }
6704}
6705
6706#[cfg(target_os = "fuchsia")]
6707impl PowerResourceSynchronousProxy {
6708    pub fn new(channel: fidl::Channel) -> Self {
6709        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6710        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6711    }
6712
6713    pub fn into_channel(self) -> fidl::Channel {
6714        self.client.into_channel()
6715    }
6716
6717    /// Waits until an event arrives and returns it. It is safe for other
6718    /// threads to make concurrent requests while waiting for an event.
6719    pub fn wait_for_event(
6720        &self,
6721        deadline: zx::MonotonicInstant,
6722    ) -> Result<PowerResourceEvent, fidl::Error> {
6723        PowerResourceEvent::decode(self.client.wait_for_event(deadline)?)
6724    }
6725
6726    /// Get a power resource handle.
6727    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6728        let _response =
6729            self.client.send_query::<fidl::encoding::EmptyPayload, PowerResourceGetResponse>(
6730                (),
6731                0x2b8df8ca24d1e866,
6732                fidl::encoding::DynamicFlags::empty(),
6733                ___deadline,
6734            )?;
6735        Ok(_response.resource)
6736    }
6737}
6738
6739#[cfg(target_os = "fuchsia")]
6740impl From<PowerResourceSynchronousProxy> for zx::Handle {
6741    fn from(value: PowerResourceSynchronousProxy) -> Self {
6742        value.into_channel().into()
6743    }
6744}
6745
6746#[cfg(target_os = "fuchsia")]
6747impl From<fidl::Channel> for PowerResourceSynchronousProxy {
6748    fn from(value: fidl::Channel) -> Self {
6749        Self::new(value)
6750    }
6751}
6752
6753#[cfg(target_os = "fuchsia")]
6754impl fidl::endpoints::FromClient for PowerResourceSynchronousProxy {
6755    type Protocol = PowerResourceMarker;
6756
6757    fn from_client(value: fidl::endpoints::ClientEnd<PowerResourceMarker>) -> Self {
6758        Self::new(value.into_channel())
6759    }
6760}
6761
6762#[derive(Debug, Clone)]
6763pub struct PowerResourceProxy {
6764    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6765}
6766
6767impl fidl::endpoints::Proxy for PowerResourceProxy {
6768    type Protocol = PowerResourceMarker;
6769
6770    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6771        Self::new(inner)
6772    }
6773
6774    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6775        self.client.into_channel().map_err(|client| Self { client })
6776    }
6777
6778    fn as_channel(&self) -> &::fidl::AsyncChannel {
6779        self.client.as_channel()
6780    }
6781}
6782
6783impl PowerResourceProxy {
6784    /// Create a new Proxy for fuchsia.kernel/PowerResource.
6785    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6786        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6787        Self { client: fidl::client::Client::new(channel, protocol_name) }
6788    }
6789
6790    /// Get a Stream of events from the remote end of the protocol.
6791    ///
6792    /// # Panics
6793    ///
6794    /// Panics if the event stream was already taken.
6795    pub fn take_event_stream(&self) -> PowerResourceEventStream {
6796        PowerResourceEventStream { event_receiver: self.client.take_event_receiver() }
6797    }
6798
6799    /// Get a power resource handle.
6800    pub fn r#get(
6801        &self,
6802    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6803    {
6804        PowerResourceProxyInterface::r#get(self)
6805    }
6806}
6807
6808impl PowerResourceProxyInterface for PowerResourceProxy {
6809    type GetResponseFut = fidl::client::QueryResponseFut<
6810        fidl::Resource,
6811        fidl::encoding::DefaultFuchsiaResourceDialect,
6812    >;
6813    fn r#get(&self) -> Self::GetResponseFut {
6814        fn _decode(
6815            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6816        ) -> Result<fidl::Resource, fidl::Error> {
6817            let _response = fidl::client::decode_transaction_body::<
6818                PowerResourceGetResponse,
6819                fidl::encoding::DefaultFuchsiaResourceDialect,
6820                0x2b8df8ca24d1e866,
6821            >(_buf?)?;
6822            Ok(_response.resource)
6823        }
6824        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6825            (),
6826            0x2b8df8ca24d1e866,
6827            fidl::encoding::DynamicFlags::empty(),
6828            _decode,
6829        )
6830    }
6831}
6832
6833pub struct PowerResourceEventStream {
6834    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6835}
6836
6837impl std::marker::Unpin for PowerResourceEventStream {}
6838
6839impl futures::stream::FusedStream for PowerResourceEventStream {
6840    fn is_terminated(&self) -> bool {
6841        self.event_receiver.is_terminated()
6842    }
6843}
6844
6845impl futures::Stream for PowerResourceEventStream {
6846    type Item = Result<PowerResourceEvent, fidl::Error>;
6847
6848    fn poll_next(
6849        mut self: std::pin::Pin<&mut Self>,
6850        cx: &mut std::task::Context<'_>,
6851    ) -> std::task::Poll<Option<Self::Item>> {
6852        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6853            &mut self.event_receiver,
6854            cx
6855        )?) {
6856            Some(buf) => std::task::Poll::Ready(Some(PowerResourceEvent::decode(buf))),
6857            None => std::task::Poll::Ready(None),
6858        }
6859    }
6860}
6861
6862#[derive(Debug)]
6863pub enum PowerResourceEvent {}
6864
6865impl PowerResourceEvent {
6866    /// Decodes a message buffer as a [`PowerResourceEvent`].
6867    fn decode(
6868        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6869    ) -> Result<PowerResourceEvent, fidl::Error> {
6870        let (bytes, _handles) = buf.split_mut();
6871        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6872        debug_assert_eq!(tx_header.tx_id, 0);
6873        match tx_header.ordinal {
6874            _ => Err(fidl::Error::UnknownOrdinal {
6875                ordinal: tx_header.ordinal,
6876                protocol_name: <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6877            }),
6878        }
6879    }
6880}
6881
6882/// A Stream of incoming requests for fuchsia.kernel/PowerResource.
6883pub struct PowerResourceRequestStream {
6884    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6885    is_terminated: bool,
6886}
6887
6888impl std::marker::Unpin for PowerResourceRequestStream {}
6889
6890impl futures::stream::FusedStream for PowerResourceRequestStream {
6891    fn is_terminated(&self) -> bool {
6892        self.is_terminated
6893    }
6894}
6895
6896impl fidl::endpoints::RequestStream for PowerResourceRequestStream {
6897    type Protocol = PowerResourceMarker;
6898    type ControlHandle = PowerResourceControlHandle;
6899
6900    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6901        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6902    }
6903
6904    fn control_handle(&self) -> Self::ControlHandle {
6905        PowerResourceControlHandle { inner: self.inner.clone() }
6906    }
6907
6908    fn into_inner(
6909        self,
6910    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6911    {
6912        (self.inner, self.is_terminated)
6913    }
6914
6915    fn from_inner(
6916        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6917        is_terminated: bool,
6918    ) -> Self {
6919        Self { inner, is_terminated }
6920    }
6921}
6922
6923impl futures::Stream for PowerResourceRequestStream {
6924    type Item = Result<PowerResourceRequest, fidl::Error>;
6925
6926    fn poll_next(
6927        mut self: std::pin::Pin<&mut Self>,
6928        cx: &mut std::task::Context<'_>,
6929    ) -> std::task::Poll<Option<Self::Item>> {
6930        let this = &mut *self;
6931        if this.inner.check_shutdown(cx) {
6932            this.is_terminated = true;
6933            return std::task::Poll::Ready(None);
6934        }
6935        if this.is_terminated {
6936            panic!("polled PowerResourceRequestStream after completion");
6937        }
6938        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6939            |bytes, handles| {
6940                match this.inner.channel().read_etc(cx, bytes, handles) {
6941                    std::task::Poll::Ready(Ok(())) => {}
6942                    std::task::Poll::Pending => return std::task::Poll::Pending,
6943                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6944                        this.is_terminated = true;
6945                        return std::task::Poll::Ready(None);
6946                    }
6947                    std::task::Poll::Ready(Err(e)) => {
6948                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6949                            e.into(),
6950                        ))))
6951                    }
6952                }
6953
6954                // A message has been received from the channel
6955                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6956
6957                std::task::Poll::Ready(Some(match header.ordinal {
6958                    0x2b8df8ca24d1e866 => {
6959                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6960                        let mut req = fidl::new_empty!(
6961                            fidl::encoding::EmptyPayload,
6962                            fidl::encoding::DefaultFuchsiaResourceDialect
6963                        );
6964                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6965                        let control_handle =
6966                            PowerResourceControlHandle { inner: this.inner.clone() };
6967                        Ok(PowerResourceRequest::Get {
6968                            responder: PowerResourceGetResponder {
6969                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6970                                tx_id: header.tx_id,
6971                            },
6972                        })
6973                    }
6974                    _ => Err(fidl::Error::UnknownOrdinal {
6975                        ordinal: header.ordinal,
6976                        protocol_name:
6977                            <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6978                    }),
6979                }))
6980            },
6981        )
6982    }
6983}
6984
6985/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6986/// `ZX_RSRC_SYSTEM_POWER_BASE`.
6987#[derive(Debug)]
6988pub enum PowerResourceRequest {
6989    /// Get a power resource handle.
6990    Get { responder: PowerResourceGetResponder },
6991}
6992
6993impl PowerResourceRequest {
6994    #[allow(irrefutable_let_patterns)]
6995    pub fn into_get(self) -> Option<(PowerResourceGetResponder)> {
6996        if let PowerResourceRequest::Get { responder } = self {
6997            Some((responder))
6998        } else {
6999            None
7000        }
7001    }
7002
7003    /// Name of the method defined in FIDL
7004    pub fn method_name(&self) -> &'static str {
7005        match *self {
7006            PowerResourceRequest::Get { .. } => "get",
7007        }
7008    }
7009}
7010
7011#[derive(Debug, Clone)]
7012pub struct PowerResourceControlHandle {
7013    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7014}
7015
7016impl fidl::endpoints::ControlHandle for PowerResourceControlHandle {
7017    fn shutdown(&self) {
7018        self.inner.shutdown()
7019    }
7020    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7021        self.inner.shutdown_with_epitaph(status)
7022    }
7023
7024    fn is_closed(&self) -> bool {
7025        self.inner.channel().is_closed()
7026    }
7027    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7028        self.inner.channel().on_closed()
7029    }
7030
7031    #[cfg(target_os = "fuchsia")]
7032    fn signal_peer(
7033        &self,
7034        clear_mask: zx::Signals,
7035        set_mask: zx::Signals,
7036    ) -> Result<(), zx_status::Status> {
7037        use fidl::Peered;
7038        self.inner.channel().signal_peer(clear_mask, set_mask)
7039    }
7040}
7041
7042impl PowerResourceControlHandle {}
7043
7044#[must_use = "FIDL methods require a response to be sent"]
7045#[derive(Debug)]
7046pub struct PowerResourceGetResponder {
7047    control_handle: std::mem::ManuallyDrop<PowerResourceControlHandle>,
7048    tx_id: u32,
7049}
7050
7051/// Set the the channel to be shutdown (see [`PowerResourceControlHandle::shutdown`])
7052/// if the responder is dropped without sending a response, so that the client
7053/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7054impl std::ops::Drop for PowerResourceGetResponder {
7055    fn drop(&mut self) {
7056        self.control_handle.shutdown();
7057        // Safety: drops once, never accessed again
7058        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7059    }
7060}
7061
7062impl fidl::endpoints::Responder for PowerResourceGetResponder {
7063    type ControlHandle = PowerResourceControlHandle;
7064
7065    fn control_handle(&self) -> &PowerResourceControlHandle {
7066        &self.control_handle
7067    }
7068
7069    fn drop_without_shutdown(mut self) {
7070        // Safety: drops once, never accessed again due to mem::forget
7071        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7072        // Prevent Drop from running (which would shut down the channel)
7073        std::mem::forget(self);
7074    }
7075}
7076
7077impl PowerResourceGetResponder {
7078    /// Sends a response to the FIDL transaction.
7079    ///
7080    /// Sets the channel to shutdown if an error occurs.
7081    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7082        let _result = self.send_raw(resource);
7083        if _result.is_err() {
7084            self.control_handle.shutdown();
7085        }
7086        self.drop_without_shutdown();
7087        _result
7088    }
7089
7090    /// Similar to "send" but does not shutdown the channel if an error occurs.
7091    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7092        let _result = self.send_raw(resource);
7093        self.drop_without_shutdown();
7094        _result
7095    }
7096
7097    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7098        self.control_handle.inner.send::<PowerResourceGetResponse>(
7099            (resource,),
7100            self.tx_id,
7101            0x2b8df8ca24d1e866,
7102            fidl::encoding::DynamicFlags::empty(),
7103        )
7104    }
7105}
7106
7107#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7108pub struct ProfileResourceMarker;
7109
7110impl fidl::endpoints::ProtocolMarker for ProfileResourceMarker {
7111    type Proxy = ProfileResourceProxy;
7112    type RequestStream = ProfileResourceRequestStream;
7113    #[cfg(target_os = "fuchsia")]
7114    type SynchronousProxy = ProfileResourceSynchronousProxy;
7115
7116    const DEBUG_NAME: &'static str = "fuchsia.kernel.ProfileResource";
7117}
7118impl fidl::endpoints::DiscoverableProtocolMarker for ProfileResourceMarker {}
7119
7120pub trait ProfileResourceProxyInterface: Send + Sync {
7121    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
7122    fn r#get(&self) -> Self::GetResponseFut;
7123}
7124#[derive(Debug)]
7125#[cfg(target_os = "fuchsia")]
7126pub struct ProfileResourceSynchronousProxy {
7127    client: fidl::client::sync::Client,
7128}
7129
7130#[cfg(target_os = "fuchsia")]
7131impl fidl::endpoints::SynchronousProxy for ProfileResourceSynchronousProxy {
7132    type Proxy = ProfileResourceProxy;
7133    type Protocol = ProfileResourceMarker;
7134
7135    fn from_channel(inner: fidl::Channel) -> Self {
7136        Self::new(inner)
7137    }
7138
7139    fn into_channel(self) -> fidl::Channel {
7140        self.client.into_channel()
7141    }
7142
7143    fn as_channel(&self) -> &fidl::Channel {
7144        self.client.as_channel()
7145    }
7146}
7147
7148#[cfg(target_os = "fuchsia")]
7149impl ProfileResourceSynchronousProxy {
7150    pub fn new(channel: fidl::Channel) -> Self {
7151        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7152        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7153    }
7154
7155    pub fn into_channel(self) -> fidl::Channel {
7156        self.client.into_channel()
7157    }
7158
7159    /// Waits until an event arrives and returns it. It is safe for other
7160    /// threads to make concurrent requests while waiting for an event.
7161    pub fn wait_for_event(
7162        &self,
7163        deadline: zx::MonotonicInstant,
7164    ) -> Result<ProfileResourceEvent, fidl::Error> {
7165        ProfileResourceEvent::decode(self.client.wait_for_event(deadline)?)
7166    }
7167
7168    /// Get a profile resource handle.
7169    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
7170        let _response =
7171            self.client.send_query::<fidl::encoding::EmptyPayload, ProfileResourceGetResponse>(
7172                (),
7173                0x3003a0c14de1fa86,
7174                fidl::encoding::DynamicFlags::empty(),
7175                ___deadline,
7176            )?;
7177        Ok(_response.resource)
7178    }
7179}
7180
7181#[cfg(target_os = "fuchsia")]
7182impl From<ProfileResourceSynchronousProxy> for zx::Handle {
7183    fn from(value: ProfileResourceSynchronousProxy) -> Self {
7184        value.into_channel().into()
7185    }
7186}
7187
7188#[cfg(target_os = "fuchsia")]
7189impl From<fidl::Channel> for ProfileResourceSynchronousProxy {
7190    fn from(value: fidl::Channel) -> Self {
7191        Self::new(value)
7192    }
7193}
7194
7195#[cfg(target_os = "fuchsia")]
7196impl fidl::endpoints::FromClient for ProfileResourceSynchronousProxy {
7197    type Protocol = ProfileResourceMarker;
7198
7199    fn from_client(value: fidl::endpoints::ClientEnd<ProfileResourceMarker>) -> Self {
7200        Self::new(value.into_channel())
7201    }
7202}
7203
7204#[derive(Debug, Clone)]
7205pub struct ProfileResourceProxy {
7206    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7207}
7208
7209impl fidl::endpoints::Proxy for ProfileResourceProxy {
7210    type Protocol = ProfileResourceMarker;
7211
7212    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7213        Self::new(inner)
7214    }
7215
7216    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7217        self.client.into_channel().map_err(|client| Self { client })
7218    }
7219
7220    fn as_channel(&self) -> &::fidl::AsyncChannel {
7221        self.client.as_channel()
7222    }
7223}
7224
7225impl ProfileResourceProxy {
7226    /// Create a new Proxy for fuchsia.kernel/ProfileResource.
7227    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7228        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7229        Self { client: fidl::client::Client::new(channel, protocol_name) }
7230    }
7231
7232    /// Get a Stream of events from the remote end of the protocol.
7233    ///
7234    /// # Panics
7235    ///
7236    /// Panics if the event stream was already taken.
7237    pub fn take_event_stream(&self) -> ProfileResourceEventStream {
7238        ProfileResourceEventStream { event_receiver: self.client.take_event_receiver() }
7239    }
7240
7241    /// Get a profile resource handle.
7242    pub fn r#get(
7243        &self,
7244    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
7245    {
7246        ProfileResourceProxyInterface::r#get(self)
7247    }
7248}
7249
7250impl ProfileResourceProxyInterface for ProfileResourceProxy {
7251    type GetResponseFut = fidl::client::QueryResponseFut<
7252        fidl::Resource,
7253        fidl::encoding::DefaultFuchsiaResourceDialect,
7254    >;
7255    fn r#get(&self) -> Self::GetResponseFut {
7256        fn _decode(
7257            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7258        ) -> Result<fidl::Resource, fidl::Error> {
7259            let _response = fidl::client::decode_transaction_body::<
7260                ProfileResourceGetResponse,
7261                fidl::encoding::DefaultFuchsiaResourceDialect,
7262                0x3003a0c14de1fa86,
7263            >(_buf?)?;
7264            Ok(_response.resource)
7265        }
7266        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
7267            (),
7268            0x3003a0c14de1fa86,
7269            fidl::encoding::DynamicFlags::empty(),
7270            _decode,
7271        )
7272    }
7273}
7274
7275pub struct ProfileResourceEventStream {
7276    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7277}
7278
7279impl std::marker::Unpin for ProfileResourceEventStream {}
7280
7281impl futures::stream::FusedStream for ProfileResourceEventStream {
7282    fn is_terminated(&self) -> bool {
7283        self.event_receiver.is_terminated()
7284    }
7285}
7286
7287impl futures::Stream for ProfileResourceEventStream {
7288    type Item = Result<ProfileResourceEvent, fidl::Error>;
7289
7290    fn poll_next(
7291        mut self: std::pin::Pin<&mut Self>,
7292        cx: &mut std::task::Context<'_>,
7293    ) -> std::task::Poll<Option<Self::Item>> {
7294        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7295            &mut self.event_receiver,
7296            cx
7297        )?) {
7298            Some(buf) => std::task::Poll::Ready(Some(ProfileResourceEvent::decode(buf))),
7299            None => std::task::Poll::Ready(None),
7300        }
7301    }
7302}
7303
7304#[derive(Debug)]
7305pub enum ProfileResourceEvent {}
7306
7307impl ProfileResourceEvent {
7308    /// Decodes a message buffer as a [`ProfileResourceEvent`].
7309    fn decode(
7310        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7311    ) -> Result<ProfileResourceEvent, fidl::Error> {
7312        let (bytes, _handles) = buf.split_mut();
7313        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7314        debug_assert_eq!(tx_header.tx_id, 0);
7315        match tx_header.ordinal {
7316            _ => Err(fidl::Error::UnknownOrdinal {
7317                ordinal: tx_header.ordinal,
7318                protocol_name:
7319                    <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7320            }),
7321        }
7322    }
7323}
7324
7325/// A Stream of incoming requests for fuchsia.kernel/ProfileResource.
7326pub struct ProfileResourceRequestStream {
7327    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7328    is_terminated: bool,
7329}
7330
7331impl std::marker::Unpin for ProfileResourceRequestStream {}
7332
7333impl futures::stream::FusedStream for ProfileResourceRequestStream {
7334    fn is_terminated(&self) -> bool {
7335        self.is_terminated
7336    }
7337}
7338
7339impl fidl::endpoints::RequestStream for ProfileResourceRequestStream {
7340    type Protocol = ProfileResourceMarker;
7341    type ControlHandle = ProfileResourceControlHandle;
7342
7343    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7344        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7345    }
7346
7347    fn control_handle(&self) -> Self::ControlHandle {
7348        ProfileResourceControlHandle { inner: self.inner.clone() }
7349    }
7350
7351    fn into_inner(
7352        self,
7353    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7354    {
7355        (self.inner, self.is_terminated)
7356    }
7357
7358    fn from_inner(
7359        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7360        is_terminated: bool,
7361    ) -> Self {
7362        Self { inner, is_terminated }
7363    }
7364}
7365
7366impl futures::Stream for ProfileResourceRequestStream {
7367    type Item = Result<ProfileResourceRequest, fidl::Error>;
7368
7369    fn poll_next(
7370        mut self: std::pin::Pin<&mut Self>,
7371        cx: &mut std::task::Context<'_>,
7372    ) -> std::task::Poll<Option<Self::Item>> {
7373        let this = &mut *self;
7374        if this.inner.check_shutdown(cx) {
7375            this.is_terminated = true;
7376            return std::task::Poll::Ready(None);
7377        }
7378        if this.is_terminated {
7379            panic!("polled ProfileResourceRequestStream after completion");
7380        }
7381        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7382            |bytes, handles| {
7383                match this.inner.channel().read_etc(cx, bytes, handles) {
7384                    std::task::Poll::Ready(Ok(())) => {}
7385                    std::task::Poll::Pending => return std::task::Poll::Pending,
7386                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7387                        this.is_terminated = true;
7388                        return std::task::Poll::Ready(None);
7389                    }
7390                    std::task::Poll::Ready(Err(e)) => {
7391                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7392                            e.into(),
7393                        ))))
7394                    }
7395                }
7396
7397                // A message has been received from the channel
7398                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7399
7400                std::task::Poll::Ready(Some(match header.ordinal {
7401                    0x3003a0c14de1fa86 => {
7402                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7403                        let mut req = fidl::new_empty!(
7404                            fidl::encoding::EmptyPayload,
7405                            fidl::encoding::DefaultFuchsiaResourceDialect
7406                        );
7407                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7408                        let control_handle =
7409                            ProfileResourceControlHandle { inner: this.inner.clone() };
7410                        Ok(ProfileResourceRequest::Get {
7411                            responder: ProfileResourceGetResponder {
7412                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7413                                tx_id: header.tx_id,
7414                            },
7415                        })
7416                    }
7417                    _ => Err(fidl::Error::UnknownOrdinal {
7418                        ordinal: header.ordinal,
7419                        protocol_name:
7420                            <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7421                    }),
7422                }))
7423            },
7424        )
7425    }
7426}
7427
7428/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7429/// `ZX_RSRC_SYSTEM_PROFILE_BASE`.
7430#[derive(Debug)]
7431pub enum ProfileResourceRequest {
7432    /// Get a profile resource handle.
7433    Get { responder: ProfileResourceGetResponder },
7434}
7435
7436impl ProfileResourceRequest {
7437    #[allow(irrefutable_let_patterns)]
7438    pub fn into_get(self) -> Option<(ProfileResourceGetResponder)> {
7439        if let ProfileResourceRequest::Get { responder } = self {
7440            Some((responder))
7441        } else {
7442            None
7443        }
7444    }
7445
7446    /// Name of the method defined in FIDL
7447    pub fn method_name(&self) -> &'static str {
7448        match *self {
7449            ProfileResourceRequest::Get { .. } => "get",
7450        }
7451    }
7452}
7453
7454#[derive(Debug, Clone)]
7455pub struct ProfileResourceControlHandle {
7456    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7457}
7458
7459impl fidl::endpoints::ControlHandle for ProfileResourceControlHandle {
7460    fn shutdown(&self) {
7461        self.inner.shutdown()
7462    }
7463    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7464        self.inner.shutdown_with_epitaph(status)
7465    }
7466
7467    fn is_closed(&self) -> bool {
7468        self.inner.channel().is_closed()
7469    }
7470    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7471        self.inner.channel().on_closed()
7472    }
7473
7474    #[cfg(target_os = "fuchsia")]
7475    fn signal_peer(
7476        &self,
7477        clear_mask: zx::Signals,
7478        set_mask: zx::Signals,
7479    ) -> Result<(), zx_status::Status> {
7480        use fidl::Peered;
7481        self.inner.channel().signal_peer(clear_mask, set_mask)
7482    }
7483}
7484
7485impl ProfileResourceControlHandle {}
7486
7487#[must_use = "FIDL methods require a response to be sent"]
7488#[derive(Debug)]
7489pub struct ProfileResourceGetResponder {
7490    control_handle: std::mem::ManuallyDrop<ProfileResourceControlHandle>,
7491    tx_id: u32,
7492}
7493
7494/// Set the the channel to be shutdown (see [`ProfileResourceControlHandle::shutdown`])
7495/// if the responder is dropped without sending a response, so that the client
7496/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7497impl std::ops::Drop for ProfileResourceGetResponder {
7498    fn drop(&mut self) {
7499        self.control_handle.shutdown();
7500        // Safety: drops once, never accessed again
7501        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7502    }
7503}
7504
7505impl fidl::endpoints::Responder for ProfileResourceGetResponder {
7506    type ControlHandle = ProfileResourceControlHandle;
7507
7508    fn control_handle(&self) -> &ProfileResourceControlHandle {
7509        &self.control_handle
7510    }
7511
7512    fn drop_without_shutdown(mut self) {
7513        // Safety: drops once, never accessed again due to mem::forget
7514        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7515        // Prevent Drop from running (which would shut down the channel)
7516        std::mem::forget(self);
7517    }
7518}
7519
7520impl ProfileResourceGetResponder {
7521    /// Sends a response to the FIDL transaction.
7522    ///
7523    /// Sets the channel to shutdown if an error occurs.
7524    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7525        let _result = self.send_raw(resource);
7526        if _result.is_err() {
7527            self.control_handle.shutdown();
7528        }
7529        self.drop_without_shutdown();
7530        _result
7531    }
7532
7533    /// Similar to "send" but does not shutdown the channel if an error occurs.
7534    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7535        let _result = self.send_raw(resource);
7536        self.drop_without_shutdown();
7537        _result
7538    }
7539
7540    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7541        self.control_handle.inner.send::<ProfileResourceGetResponse>(
7542            (resource,),
7543            self.tx_id,
7544            0x3003a0c14de1fa86,
7545            fidl::encoding::DynamicFlags::empty(),
7546        )
7547    }
7548}
7549
7550#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7551pub struct RootJobMarker;
7552
7553impl fidl::endpoints::ProtocolMarker for RootJobMarker {
7554    type Proxy = RootJobProxy;
7555    type RequestStream = RootJobRequestStream;
7556    #[cfg(target_os = "fuchsia")]
7557    type SynchronousProxy = RootJobSynchronousProxy;
7558
7559    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJob";
7560}
7561impl fidl::endpoints::DiscoverableProtocolMarker for RootJobMarker {}
7562
7563pub trait RootJobProxyInterface: Send + Sync {
7564    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7565    fn r#get(&self) -> Self::GetResponseFut;
7566}
7567#[derive(Debug)]
7568#[cfg(target_os = "fuchsia")]
7569pub struct RootJobSynchronousProxy {
7570    client: fidl::client::sync::Client,
7571}
7572
7573#[cfg(target_os = "fuchsia")]
7574impl fidl::endpoints::SynchronousProxy for RootJobSynchronousProxy {
7575    type Proxy = RootJobProxy;
7576    type Protocol = RootJobMarker;
7577
7578    fn from_channel(inner: fidl::Channel) -> Self {
7579        Self::new(inner)
7580    }
7581
7582    fn into_channel(self) -> fidl::Channel {
7583        self.client.into_channel()
7584    }
7585
7586    fn as_channel(&self) -> &fidl::Channel {
7587        self.client.as_channel()
7588    }
7589}
7590
7591#[cfg(target_os = "fuchsia")]
7592impl RootJobSynchronousProxy {
7593    pub fn new(channel: fidl::Channel) -> Self {
7594        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7595        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7596    }
7597
7598    pub fn into_channel(self) -> fidl::Channel {
7599        self.client.into_channel()
7600    }
7601
7602    /// Waits until an event arrives and returns it. It is safe for other
7603    /// threads to make concurrent requests while waiting for an event.
7604    pub fn wait_for_event(
7605        &self,
7606        deadline: zx::MonotonicInstant,
7607    ) -> Result<RootJobEvent, fidl::Error> {
7608        RootJobEvent::decode(self.client.wait_for_event(deadline)?)
7609    }
7610
7611    /// Get the root `job`.
7612    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7613        let _response =
7614            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
7615                (),
7616                0x73acb63f93d53eac,
7617                fidl::encoding::DynamicFlags::empty(),
7618                ___deadline,
7619            )?;
7620        Ok(_response.job)
7621    }
7622}
7623
7624#[cfg(target_os = "fuchsia")]
7625impl From<RootJobSynchronousProxy> for zx::Handle {
7626    fn from(value: RootJobSynchronousProxy) -> Self {
7627        value.into_channel().into()
7628    }
7629}
7630
7631#[cfg(target_os = "fuchsia")]
7632impl From<fidl::Channel> for RootJobSynchronousProxy {
7633    fn from(value: fidl::Channel) -> Self {
7634        Self::new(value)
7635    }
7636}
7637
7638#[cfg(target_os = "fuchsia")]
7639impl fidl::endpoints::FromClient for RootJobSynchronousProxy {
7640    type Protocol = RootJobMarker;
7641
7642    fn from_client(value: fidl::endpoints::ClientEnd<RootJobMarker>) -> Self {
7643        Self::new(value.into_channel())
7644    }
7645}
7646
7647#[derive(Debug, Clone)]
7648pub struct RootJobProxy {
7649    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7650}
7651
7652impl fidl::endpoints::Proxy for RootJobProxy {
7653    type Protocol = RootJobMarker;
7654
7655    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7656        Self::new(inner)
7657    }
7658
7659    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7660        self.client.into_channel().map_err(|client| Self { client })
7661    }
7662
7663    fn as_channel(&self) -> &::fidl::AsyncChannel {
7664        self.client.as_channel()
7665    }
7666}
7667
7668impl RootJobProxy {
7669    /// Create a new Proxy for fuchsia.kernel/RootJob.
7670    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7671        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7672        Self { client: fidl::client::Client::new(channel, protocol_name) }
7673    }
7674
7675    /// Get a Stream of events from the remote end of the protocol.
7676    ///
7677    /// # Panics
7678    ///
7679    /// Panics if the event stream was already taken.
7680    pub fn take_event_stream(&self) -> RootJobEventStream {
7681        RootJobEventStream { event_receiver: self.client.take_event_receiver() }
7682    }
7683
7684    /// Get the root `job`.
7685    pub fn r#get(
7686        &self,
7687    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7688    {
7689        RootJobProxyInterface::r#get(self)
7690    }
7691}
7692
7693impl RootJobProxyInterface for RootJobProxy {
7694    type GetResponseFut =
7695        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7696    fn r#get(&self) -> Self::GetResponseFut {
7697        fn _decode(
7698            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7699        ) -> Result<fidl::Job, fidl::Error> {
7700            let _response = fidl::client::decode_transaction_body::<
7701                RootJobGetResponse,
7702                fidl::encoding::DefaultFuchsiaResourceDialect,
7703                0x73acb63f93d53eac,
7704            >(_buf?)?;
7705            Ok(_response.job)
7706        }
7707        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7708            (),
7709            0x73acb63f93d53eac,
7710            fidl::encoding::DynamicFlags::empty(),
7711            _decode,
7712        )
7713    }
7714}
7715
7716pub struct RootJobEventStream {
7717    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7718}
7719
7720impl std::marker::Unpin for RootJobEventStream {}
7721
7722impl futures::stream::FusedStream for RootJobEventStream {
7723    fn is_terminated(&self) -> bool {
7724        self.event_receiver.is_terminated()
7725    }
7726}
7727
7728impl futures::Stream for RootJobEventStream {
7729    type Item = Result<RootJobEvent, fidl::Error>;
7730
7731    fn poll_next(
7732        mut self: std::pin::Pin<&mut Self>,
7733        cx: &mut std::task::Context<'_>,
7734    ) -> std::task::Poll<Option<Self::Item>> {
7735        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7736            &mut self.event_receiver,
7737            cx
7738        )?) {
7739            Some(buf) => std::task::Poll::Ready(Some(RootJobEvent::decode(buf))),
7740            None => std::task::Poll::Ready(None),
7741        }
7742    }
7743}
7744
7745#[derive(Debug)]
7746pub enum RootJobEvent {}
7747
7748impl RootJobEvent {
7749    /// Decodes a message buffer as a [`RootJobEvent`].
7750    fn decode(
7751        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7752    ) -> Result<RootJobEvent, fidl::Error> {
7753        let (bytes, _handles) = buf.split_mut();
7754        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7755        debug_assert_eq!(tx_header.tx_id, 0);
7756        match tx_header.ordinal {
7757            _ => Err(fidl::Error::UnknownOrdinal {
7758                ordinal: tx_header.ordinal,
7759                protocol_name: <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7760            }),
7761        }
7762    }
7763}
7764
7765/// A Stream of incoming requests for fuchsia.kernel/RootJob.
7766pub struct RootJobRequestStream {
7767    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7768    is_terminated: bool,
7769}
7770
7771impl std::marker::Unpin for RootJobRequestStream {}
7772
7773impl futures::stream::FusedStream for RootJobRequestStream {
7774    fn is_terminated(&self) -> bool {
7775        self.is_terminated
7776    }
7777}
7778
7779impl fidl::endpoints::RequestStream for RootJobRequestStream {
7780    type Protocol = RootJobMarker;
7781    type ControlHandle = RootJobControlHandle;
7782
7783    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7784        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7785    }
7786
7787    fn control_handle(&self) -> Self::ControlHandle {
7788        RootJobControlHandle { inner: self.inner.clone() }
7789    }
7790
7791    fn into_inner(
7792        self,
7793    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7794    {
7795        (self.inner, self.is_terminated)
7796    }
7797
7798    fn from_inner(
7799        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7800        is_terminated: bool,
7801    ) -> Self {
7802        Self { inner, is_terminated }
7803    }
7804}
7805
7806impl futures::Stream for RootJobRequestStream {
7807    type Item = Result<RootJobRequest, fidl::Error>;
7808
7809    fn poll_next(
7810        mut self: std::pin::Pin<&mut Self>,
7811        cx: &mut std::task::Context<'_>,
7812    ) -> std::task::Poll<Option<Self::Item>> {
7813        let this = &mut *self;
7814        if this.inner.check_shutdown(cx) {
7815            this.is_terminated = true;
7816            return std::task::Poll::Ready(None);
7817        }
7818        if this.is_terminated {
7819            panic!("polled RootJobRequestStream after completion");
7820        }
7821        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7822            |bytes, handles| {
7823                match this.inner.channel().read_etc(cx, bytes, handles) {
7824                    std::task::Poll::Ready(Ok(())) => {}
7825                    std::task::Poll::Pending => return std::task::Poll::Pending,
7826                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7827                        this.is_terminated = true;
7828                        return std::task::Poll::Ready(None);
7829                    }
7830                    std::task::Poll::Ready(Err(e)) => {
7831                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7832                            e.into(),
7833                        ))))
7834                    }
7835                }
7836
7837                // A message has been received from the channel
7838                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7839
7840                std::task::Poll::Ready(Some(match header.ordinal {
7841                    0x73acb63f93d53eac => {
7842                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7843                        let mut req = fidl::new_empty!(
7844                            fidl::encoding::EmptyPayload,
7845                            fidl::encoding::DefaultFuchsiaResourceDialect
7846                        );
7847                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7848                        let control_handle = RootJobControlHandle { inner: this.inner.clone() };
7849                        Ok(RootJobRequest::Get {
7850                            responder: RootJobGetResponder {
7851                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7852                                tx_id: header.tx_id,
7853                            },
7854                        })
7855                    }
7856                    _ => Err(fidl::Error::UnknownOrdinal {
7857                        ordinal: header.ordinal,
7858                        protocol_name:
7859                            <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7860                    }),
7861                }))
7862            },
7863        )
7864    }
7865}
7866
7867/// Protocol for providing the root job.
7868///
7869/// TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.
7870#[derive(Debug)]
7871pub enum RootJobRequest {
7872    /// Get the root `job`.
7873    Get { responder: RootJobGetResponder },
7874}
7875
7876impl RootJobRequest {
7877    #[allow(irrefutable_let_patterns)]
7878    pub fn into_get(self) -> Option<(RootJobGetResponder)> {
7879        if let RootJobRequest::Get { responder } = self {
7880            Some((responder))
7881        } else {
7882            None
7883        }
7884    }
7885
7886    /// Name of the method defined in FIDL
7887    pub fn method_name(&self) -> &'static str {
7888        match *self {
7889            RootJobRequest::Get { .. } => "get",
7890        }
7891    }
7892}
7893
7894#[derive(Debug, Clone)]
7895pub struct RootJobControlHandle {
7896    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7897}
7898
7899impl fidl::endpoints::ControlHandle for RootJobControlHandle {
7900    fn shutdown(&self) {
7901        self.inner.shutdown()
7902    }
7903    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7904        self.inner.shutdown_with_epitaph(status)
7905    }
7906
7907    fn is_closed(&self) -> bool {
7908        self.inner.channel().is_closed()
7909    }
7910    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7911        self.inner.channel().on_closed()
7912    }
7913
7914    #[cfg(target_os = "fuchsia")]
7915    fn signal_peer(
7916        &self,
7917        clear_mask: zx::Signals,
7918        set_mask: zx::Signals,
7919    ) -> Result<(), zx_status::Status> {
7920        use fidl::Peered;
7921        self.inner.channel().signal_peer(clear_mask, set_mask)
7922    }
7923}
7924
7925impl RootJobControlHandle {}
7926
7927#[must_use = "FIDL methods require a response to be sent"]
7928#[derive(Debug)]
7929pub struct RootJobGetResponder {
7930    control_handle: std::mem::ManuallyDrop<RootJobControlHandle>,
7931    tx_id: u32,
7932}
7933
7934/// Set the the channel to be shutdown (see [`RootJobControlHandle::shutdown`])
7935/// if the responder is dropped without sending a response, so that the client
7936/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7937impl std::ops::Drop for RootJobGetResponder {
7938    fn drop(&mut self) {
7939        self.control_handle.shutdown();
7940        // Safety: drops once, never accessed again
7941        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7942    }
7943}
7944
7945impl fidl::endpoints::Responder for RootJobGetResponder {
7946    type ControlHandle = RootJobControlHandle;
7947
7948    fn control_handle(&self) -> &RootJobControlHandle {
7949        &self.control_handle
7950    }
7951
7952    fn drop_without_shutdown(mut self) {
7953        // Safety: drops once, never accessed again due to mem::forget
7954        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7955        // Prevent Drop from running (which would shut down the channel)
7956        std::mem::forget(self);
7957    }
7958}
7959
7960impl RootJobGetResponder {
7961    /// Sends a response to the FIDL transaction.
7962    ///
7963    /// Sets the channel to shutdown if an error occurs.
7964    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7965        let _result = self.send_raw(job);
7966        if _result.is_err() {
7967            self.control_handle.shutdown();
7968        }
7969        self.drop_without_shutdown();
7970        _result
7971    }
7972
7973    /// Similar to "send" but does not shutdown the channel if an error occurs.
7974    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7975        let _result = self.send_raw(job);
7976        self.drop_without_shutdown();
7977        _result
7978    }
7979
7980    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7981        self.control_handle.inner.send::<RootJobGetResponse>(
7982            (job,),
7983            self.tx_id,
7984            0x73acb63f93d53eac,
7985            fidl::encoding::DynamicFlags::empty(),
7986        )
7987    }
7988}
7989
7990#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7991pub struct RootJobForInspectMarker;
7992
7993impl fidl::endpoints::ProtocolMarker for RootJobForInspectMarker {
7994    type Proxy = RootJobForInspectProxy;
7995    type RequestStream = RootJobForInspectRequestStream;
7996    #[cfg(target_os = "fuchsia")]
7997    type SynchronousProxy = RootJobForInspectSynchronousProxy;
7998
7999    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJobForInspect";
8000}
8001impl fidl::endpoints::DiscoverableProtocolMarker for RootJobForInspectMarker {}
8002
8003pub trait RootJobForInspectProxyInterface: Send + Sync {
8004    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
8005    fn r#get(&self) -> Self::GetResponseFut;
8006}
8007#[derive(Debug)]
8008#[cfg(target_os = "fuchsia")]
8009pub struct RootJobForInspectSynchronousProxy {
8010    client: fidl::client::sync::Client,
8011}
8012
8013#[cfg(target_os = "fuchsia")]
8014impl fidl::endpoints::SynchronousProxy for RootJobForInspectSynchronousProxy {
8015    type Proxy = RootJobForInspectProxy;
8016    type Protocol = RootJobForInspectMarker;
8017
8018    fn from_channel(inner: fidl::Channel) -> Self {
8019        Self::new(inner)
8020    }
8021
8022    fn into_channel(self) -> fidl::Channel {
8023        self.client.into_channel()
8024    }
8025
8026    fn as_channel(&self) -> &fidl::Channel {
8027        self.client.as_channel()
8028    }
8029}
8030
8031#[cfg(target_os = "fuchsia")]
8032impl RootJobForInspectSynchronousProxy {
8033    pub fn new(channel: fidl::Channel) -> Self {
8034        let protocol_name =
8035            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8036        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8037    }
8038
8039    pub fn into_channel(self) -> fidl::Channel {
8040        self.client.into_channel()
8041    }
8042
8043    /// Waits until an event arrives and returns it. It is safe for other
8044    /// threads to make concurrent requests while waiting for an event.
8045    pub fn wait_for_event(
8046        &self,
8047        deadline: zx::MonotonicInstant,
8048    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8049        RootJobForInspectEvent::decode(self.client.wait_for_event(deadline)?)
8050    }
8051
8052    /// Get the root `job`.
8053    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
8054        let _response =
8055            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
8056                (),
8057                0x73acb63f93d53eac,
8058                fidl::encoding::DynamicFlags::empty(),
8059                ___deadline,
8060            )?;
8061        Ok(_response.job)
8062    }
8063}
8064
8065#[cfg(target_os = "fuchsia")]
8066impl From<RootJobForInspectSynchronousProxy> for zx::Handle {
8067    fn from(value: RootJobForInspectSynchronousProxy) -> Self {
8068        value.into_channel().into()
8069    }
8070}
8071
8072#[cfg(target_os = "fuchsia")]
8073impl From<fidl::Channel> for RootJobForInspectSynchronousProxy {
8074    fn from(value: fidl::Channel) -> Self {
8075        Self::new(value)
8076    }
8077}
8078
8079#[cfg(target_os = "fuchsia")]
8080impl fidl::endpoints::FromClient for RootJobForInspectSynchronousProxy {
8081    type Protocol = RootJobForInspectMarker;
8082
8083    fn from_client(value: fidl::endpoints::ClientEnd<RootJobForInspectMarker>) -> Self {
8084        Self::new(value.into_channel())
8085    }
8086}
8087
8088#[derive(Debug, Clone)]
8089pub struct RootJobForInspectProxy {
8090    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8091}
8092
8093impl fidl::endpoints::Proxy for RootJobForInspectProxy {
8094    type Protocol = RootJobForInspectMarker;
8095
8096    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8097        Self::new(inner)
8098    }
8099
8100    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8101        self.client.into_channel().map_err(|client| Self { client })
8102    }
8103
8104    fn as_channel(&self) -> &::fidl::AsyncChannel {
8105        self.client.as_channel()
8106    }
8107}
8108
8109impl RootJobForInspectProxy {
8110    /// Create a new Proxy for fuchsia.kernel/RootJobForInspect.
8111    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8112        let protocol_name =
8113            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8114        Self { client: fidl::client::Client::new(channel, protocol_name) }
8115    }
8116
8117    /// Get a Stream of events from the remote end of the protocol.
8118    ///
8119    /// # Panics
8120    ///
8121    /// Panics if the event stream was already taken.
8122    pub fn take_event_stream(&self) -> RootJobForInspectEventStream {
8123        RootJobForInspectEventStream { event_receiver: self.client.take_event_receiver() }
8124    }
8125
8126    /// Get the root `job`.
8127    pub fn r#get(
8128        &self,
8129    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
8130    {
8131        RootJobForInspectProxyInterface::r#get(self)
8132    }
8133}
8134
8135impl RootJobForInspectProxyInterface for RootJobForInspectProxy {
8136    type GetResponseFut =
8137        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
8138    fn r#get(&self) -> Self::GetResponseFut {
8139        fn _decode(
8140            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8141        ) -> Result<fidl::Job, fidl::Error> {
8142            let _response = fidl::client::decode_transaction_body::<
8143                RootJobGetResponse,
8144                fidl::encoding::DefaultFuchsiaResourceDialect,
8145                0x73acb63f93d53eac,
8146            >(_buf?)?;
8147            Ok(_response.job)
8148        }
8149        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
8150            (),
8151            0x73acb63f93d53eac,
8152            fidl::encoding::DynamicFlags::empty(),
8153            _decode,
8154        )
8155    }
8156}
8157
8158pub struct RootJobForInspectEventStream {
8159    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8160}
8161
8162impl std::marker::Unpin for RootJobForInspectEventStream {}
8163
8164impl futures::stream::FusedStream for RootJobForInspectEventStream {
8165    fn is_terminated(&self) -> bool {
8166        self.event_receiver.is_terminated()
8167    }
8168}
8169
8170impl futures::Stream for RootJobForInspectEventStream {
8171    type Item = Result<RootJobForInspectEvent, fidl::Error>;
8172
8173    fn poll_next(
8174        mut self: std::pin::Pin<&mut Self>,
8175        cx: &mut std::task::Context<'_>,
8176    ) -> std::task::Poll<Option<Self::Item>> {
8177        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8178            &mut self.event_receiver,
8179            cx
8180        )?) {
8181            Some(buf) => std::task::Poll::Ready(Some(RootJobForInspectEvent::decode(buf))),
8182            None => std::task::Poll::Ready(None),
8183        }
8184    }
8185}
8186
8187#[derive(Debug)]
8188pub enum RootJobForInspectEvent {}
8189
8190impl RootJobForInspectEvent {
8191    /// Decodes a message buffer as a [`RootJobForInspectEvent`].
8192    fn decode(
8193        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8194    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8195        let (bytes, _handles) = buf.split_mut();
8196        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8197        debug_assert_eq!(tx_header.tx_id, 0);
8198        match tx_header.ordinal {
8199            _ => Err(fidl::Error::UnknownOrdinal {
8200                ordinal: tx_header.ordinal,
8201                protocol_name:
8202                    <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8203            }),
8204        }
8205    }
8206}
8207
8208/// A Stream of incoming requests for fuchsia.kernel/RootJobForInspect.
8209pub struct RootJobForInspectRequestStream {
8210    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8211    is_terminated: bool,
8212}
8213
8214impl std::marker::Unpin for RootJobForInspectRequestStream {}
8215
8216impl futures::stream::FusedStream for RootJobForInspectRequestStream {
8217    fn is_terminated(&self) -> bool {
8218        self.is_terminated
8219    }
8220}
8221
8222impl fidl::endpoints::RequestStream for RootJobForInspectRequestStream {
8223    type Protocol = RootJobForInspectMarker;
8224    type ControlHandle = RootJobForInspectControlHandle;
8225
8226    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8227        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8228    }
8229
8230    fn control_handle(&self) -> Self::ControlHandle {
8231        RootJobForInspectControlHandle { inner: self.inner.clone() }
8232    }
8233
8234    fn into_inner(
8235        self,
8236    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8237    {
8238        (self.inner, self.is_terminated)
8239    }
8240
8241    fn from_inner(
8242        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8243        is_terminated: bool,
8244    ) -> Self {
8245        Self { inner, is_terminated }
8246    }
8247}
8248
8249impl futures::Stream for RootJobForInspectRequestStream {
8250    type Item = Result<RootJobForInspectRequest, fidl::Error>;
8251
8252    fn poll_next(
8253        mut self: std::pin::Pin<&mut Self>,
8254        cx: &mut std::task::Context<'_>,
8255    ) -> std::task::Poll<Option<Self::Item>> {
8256        let this = &mut *self;
8257        if this.inner.check_shutdown(cx) {
8258            this.is_terminated = true;
8259            return std::task::Poll::Ready(None);
8260        }
8261        if this.is_terminated {
8262            panic!("polled RootJobForInspectRequestStream after completion");
8263        }
8264        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8265            |bytes, handles| {
8266                match this.inner.channel().read_etc(cx, bytes, handles) {
8267                    std::task::Poll::Ready(Ok(())) => {}
8268                    std::task::Poll::Pending => return std::task::Poll::Pending,
8269                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8270                        this.is_terminated = true;
8271                        return std::task::Poll::Ready(None);
8272                    }
8273                    std::task::Poll::Ready(Err(e)) => {
8274                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8275                            e.into(),
8276                        ))))
8277                    }
8278                }
8279
8280                // A message has been received from the channel
8281                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8282
8283                std::task::Poll::Ready(Some(match header.ordinal {
8284                    0x73acb63f93d53eac => {
8285                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8286                        let mut req = fidl::new_empty!(
8287                            fidl::encoding::EmptyPayload,
8288                            fidl::encoding::DefaultFuchsiaResourceDialect
8289                        );
8290                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8291                        let control_handle =
8292                            RootJobForInspectControlHandle { inner: this.inner.clone() };
8293                        Ok(RootJobForInspectRequest::Get {
8294                            responder: RootJobForInspectGetResponder {
8295                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8296                                tx_id: header.tx_id,
8297                            },
8298                        })
8299                    }
8300                    _ => Err(fidl::Error::UnknownOrdinal {
8301                        ordinal: header.ordinal,
8302                        protocol_name:
8303                            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8304                    }),
8305                }))
8306            },
8307        )
8308    }
8309}
8310
8311/// Protocol for providing the root job with restricted rights, specifically:
8312/// INSPECT | ENUMERATE | DUPLICATE | TRANSFER
8313#[derive(Debug)]
8314pub enum RootJobForInspectRequest {
8315    /// Get the root `job`.
8316    Get { responder: RootJobForInspectGetResponder },
8317}
8318
8319impl RootJobForInspectRequest {
8320    #[allow(irrefutable_let_patterns)]
8321    pub fn into_get(self) -> Option<(RootJobForInspectGetResponder)> {
8322        if let RootJobForInspectRequest::Get { responder } = self {
8323            Some((responder))
8324        } else {
8325            None
8326        }
8327    }
8328
8329    /// Name of the method defined in FIDL
8330    pub fn method_name(&self) -> &'static str {
8331        match *self {
8332            RootJobForInspectRequest::Get { .. } => "get",
8333        }
8334    }
8335}
8336
8337#[derive(Debug, Clone)]
8338pub struct RootJobForInspectControlHandle {
8339    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8340}
8341
8342impl fidl::endpoints::ControlHandle for RootJobForInspectControlHandle {
8343    fn shutdown(&self) {
8344        self.inner.shutdown()
8345    }
8346    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8347        self.inner.shutdown_with_epitaph(status)
8348    }
8349
8350    fn is_closed(&self) -> bool {
8351        self.inner.channel().is_closed()
8352    }
8353    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8354        self.inner.channel().on_closed()
8355    }
8356
8357    #[cfg(target_os = "fuchsia")]
8358    fn signal_peer(
8359        &self,
8360        clear_mask: zx::Signals,
8361        set_mask: zx::Signals,
8362    ) -> Result<(), zx_status::Status> {
8363        use fidl::Peered;
8364        self.inner.channel().signal_peer(clear_mask, set_mask)
8365    }
8366}
8367
8368impl RootJobForInspectControlHandle {}
8369
8370#[must_use = "FIDL methods require a response to be sent"]
8371#[derive(Debug)]
8372pub struct RootJobForInspectGetResponder {
8373    control_handle: std::mem::ManuallyDrop<RootJobForInspectControlHandle>,
8374    tx_id: u32,
8375}
8376
8377/// Set the the channel to be shutdown (see [`RootJobForInspectControlHandle::shutdown`])
8378/// if the responder is dropped without sending a response, so that the client
8379/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8380impl std::ops::Drop for RootJobForInspectGetResponder {
8381    fn drop(&mut self) {
8382        self.control_handle.shutdown();
8383        // Safety: drops once, never accessed again
8384        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8385    }
8386}
8387
8388impl fidl::endpoints::Responder for RootJobForInspectGetResponder {
8389    type ControlHandle = RootJobForInspectControlHandle;
8390
8391    fn control_handle(&self) -> &RootJobForInspectControlHandle {
8392        &self.control_handle
8393    }
8394
8395    fn drop_without_shutdown(mut self) {
8396        // Safety: drops once, never accessed again due to mem::forget
8397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8398        // Prevent Drop from running (which would shut down the channel)
8399        std::mem::forget(self);
8400    }
8401}
8402
8403impl RootJobForInspectGetResponder {
8404    /// Sends a response to the FIDL transaction.
8405    ///
8406    /// Sets the channel to shutdown if an error occurs.
8407    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8408        let _result = self.send_raw(job);
8409        if _result.is_err() {
8410            self.control_handle.shutdown();
8411        }
8412        self.drop_without_shutdown();
8413        _result
8414    }
8415
8416    /// Similar to "send" but does not shutdown the channel if an error occurs.
8417    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8418        let _result = self.send_raw(job);
8419        self.drop_without_shutdown();
8420        _result
8421    }
8422
8423    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8424        self.control_handle.inner.send::<RootJobGetResponse>(
8425            (job,),
8426            self.tx_id,
8427            0x73acb63f93d53eac,
8428            fidl::encoding::DynamicFlags::empty(),
8429        )
8430    }
8431}
8432
8433#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8434pub struct SmcResourceMarker;
8435
8436impl fidl::endpoints::ProtocolMarker for SmcResourceMarker {
8437    type Proxy = SmcResourceProxy;
8438    type RequestStream = SmcResourceRequestStream;
8439    #[cfg(target_os = "fuchsia")]
8440    type SynchronousProxy = SmcResourceSynchronousProxy;
8441
8442    const DEBUG_NAME: &'static str = "fuchsia.kernel.SmcResource";
8443}
8444impl fidl::endpoints::DiscoverableProtocolMarker for SmcResourceMarker {}
8445
8446pub trait SmcResourceProxyInterface: Send + Sync {
8447    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8448    fn r#get(&self) -> Self::GetResponseFut;
8449}
8450#[derive(Debug)]
8451#[cfg(target_os = "fuchsia")]
8452pub struct SmcResourceSynchronousProxy {
8453    client: fidl::client::sync::Client,
8454}
8455
8456#[cfg(target_os = "fuchsia")]
8457impl fidl::endpoints::SynchronousProxy for SmcResourceSynchronousProxy {
8458    type Proxy = SmcResourceProxy;
8459    type Protocol = SmcResourceMarker;
8460
8461    fn from_channel(inner: fidl::Channel) -> Self {
8462        Self::new(inner)
8463    }
8464
8465    fn into_channel(self) -> fidl::Channel {
8466        self.client.into_channel()
8467    }
8468
8469    fn as_channel(&self) -> &fidl::Channel {
8470        self.client.as_channel()
8471    }
8472}
8473
8474#[cfg(target_os = "fuchsia")]
8475impl SmcResourceSynchronousProxy {
8476    pub fn new(channel: fidl::Channel) -> Self {
8477        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8478        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8479    }
8480
8481    pub fn into_channel(self) -> fidl::Channel {
8482        self.client.into_channel()
8483    }
8484
8485    /// Waits until an event arrives and returns it. It is safe for other
8486    /// threads to make concurrent requests while waiting for an event.
8487    pub fn wait_for_event(
8488        &self,
8489        deadline: zx::MonotonicInstant,
8490    ) -> Result<SmcResourceEvent, fidl::Error> {
8491        SmcResourceEvent::decode(self.client.wait_for_event(deadline)?)
8492    }
8493
8494    /// Get an SMC resource handle.
8495    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8496        let _response =
8497            self.client.send_query::<fidl::encoding::EmptyPayload, SmcResourceGetResponse>(
8498                (),
8499                0x392cbd495b84ede7,
8500                fidl::encoding::DynamicFlags::empty(),
8501                ___deadline,
8502            )?;
8503        Ok(_response.resource)
8504    }
8505}
8506
8507#[cfg(target_os = "fuchsia")]
8508impl From<SmcResourceSynchronousProxy> for zx::Handle {
8509    fn from(value: SmcResourceSynchronousProxy) -> Self {
8510        value.into_channel().into()
8511    }
8512}
8513
8514#[cfg(target_os = "fuchsia")]
8515impl From<fidl::Channel> for SmcResourceSynchronousProxy {
8516    fn from(value: fidl::Channel) -> Self {
8517        Self::new(value)
8518    }
8519}
8520
8521#[cfg(target_os = "fuchsia")]
8522impl fidl::endpoints::FromClient for SmcResourceSynchronousProxy {
8523    type Protocol = SmcResourceMarker;
8524
8525    fn from_client(value: fidl::endpoints::ClientEnd<SmcResourceMarker>) -> Self {
8526        Self::new(value.into_channel())
8527    }
8528}
8529
8530#[derive(Debug, Clone)]
8531pub struct SmcResourceProxy {
8532    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8533}
8534
8535impl fidl::endpoints::Proxy for SmcResourceProxy {
8536    type Protocol = SmcResourceMarker;
8537
8538    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8539        Self::new(inner)
8540    }
8541
8542    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8543        self.client.into_channel().map_err(|client| Self { client })
8544    }
8545
8546    fn as_channel(&self) -> &::fidl::AsyncChannel {
8547        self.client.as_channel()
8548    }
8549}
8550
8551impl SmcResourceProxy {
8552    /// Create a new Proxy for fuchsia.kernel/SmcResource.
8553    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8554        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8555        Self { client: fidl::client::Client::new(channel, protocol_name) }
8556    }
8557
8558    /// Get a Stream of events from the remote end of the protocol.
8559    ///
8560    /// # Panics
8561    ///
8562    /// Panics if the event stream was already taken.
8563    pub fn take_event_stream(&self) -> SmcResourceEventStream {
8564        SmcResourceEventStream { event_receiver: self.client.take_event_receiver() }
8565    }
8566
8567    /// Get an SMC resource handle.
8568    pub fn r#get(
8569        &self,
8570    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8571    {
8572        SmcResourceProxyInterface::r#get(self)
8573    }
8574}
8575
8576impl SmcResourceProxyInterface for SmcResourceProxy {
8577    type GetResponseFut = fidl::client::QueryResponseFut<
8578        fidl::Resource,
8579        fidl::encoding::DefaultFuchsiaResourceDialect,
8580    >;
8581    fn r#get(&self) -> Self::GetResponseFut {
8582        fn _decode(
8583            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8584        ) -> Result<fidl::Resource, fidl::Error> {
8585            let _response = fidl::client::decode_transaction_body::<
8586                SmcResourceGetResponse,
8587                fidl::encoding::DefaultFuchsiaResourceDialect,
8588                0x392cbd495b84ede7,
8589            >(_buf?)?;
8590            Ok(_response.resource)
8591        }
8592        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8593            (),
8594            0x392cbd495b84ede7,
8595            fidl::encoding::DynamicFlags::empty(),
8596            _decode,
8597        )
8598    }
8599}
8600
8601pub struct SmcResourceEventStream {
8602    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8603}
8604
8605impl std::marker::Unpin for SmcResourceEventStream {}
8606
8607impl futures::stream::FusedStream for SmcResourceEventStream {
8608    fn is_terminated(&self) -> bool {
8609        self.event_receiver.is_terminated()
8610    }
8611}
8612
8613impl futures::Stream for SmcResourceEventStream {
8614    type Item = Result<SmcResourceEvent, fidl::Error>;
8615
8616    fn poll_next(
8617        mut self: std::pin::Pin<&mut Self>,
8618        cx: &mut std::task::Context<'_>,
8619    ) -> std::task::Poll<Option<Self::Item>> {
8620        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8621            &mut self.event_receiver,
8622            cx
8623        )?) {
8624            Some(buf) => std::task::Poll::Ready(Some(SmcResourceEvent::decode(buf))),
8625            None => std::task::Poll::Ready(None),
8626        }
8627    }
8628}
8629
8630#[derive(Debug)]
8631pub enum SmcResourceEvent {}
8632
8633impl SmcResourceEvent {
8634    /// Decodes a message buffer as a [`SmcResourceEvent`].
8635    fn decode(
8636        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8637    ) -> Result<SmcResourceEvent, fidl::Error> {
8638        let (bytes, _handles) = buf.split_mut();
8639        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8640        debug_assert_eq!(tx_header.tx_id, 0);
8641        match tx_header.ordinal {
8642            _ => Err(fidl::Error::UnknownOrdinal {
8643                ordinal: tx_header.ordinal,
8644                protocol_name: <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8645            }),
8646        }
8647    }
8648}
8649
8650/// A Stream of incoming requests for fuchsia.kernel/SmcResource.
8651pub struct SmcResourceRequestStream {
8652    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8653    is_terminated: bool,
8654}
8655
8656impl std::marker::Unpin for SmcResourceRequestStream {}
8657
8658impl futures::stream::FusedStream for SmcResourceRequestStream {
8659    fn is_terminated(&self) -> bool {
8660        self.is_terminated
8661    }
8662}
8663
8664impl fidl::endpoints::RequestStream for SmcResourceRequestStream {
8665    type Protocol = SmcResourceMarker;
8666    type ControlHandle = SmcResourceControlHandle;
8667
8668    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8669        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8670    }
8671
8672    fn control_handle(&self) -> Self::ControlHandle {
8673        SmcResourceControlHandle { inner: self.inner.clone() }
8674    }
8675
8676    fn into_inner(
8677        self,
8678    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8679    {
8680        (self.inner, self.is_terminated)
8681    }
8682
8683    fn from_inner(
8684        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8685        is_terminated: bool,
8686    ) -> Self {
8687        Self { inner, is_terminated }
8688    }
8689}
8690
8691impl futures::Stream for SmcResourceRequestStream {
8692    type Item = Result<SmcResourceRequest, fidl::Error>;
8693
8694    fn poll_next(
8695        mut self: std::pin::Pin<&mut Self>,
8696        cx: &mut std::task::Context<'_>,
8697    ) -> std::task::Poll<Option<Self::Item>> {
8698        let this = &mut *self;
8699        if this.inner.check_shutdown(cx) {
8700            this.is_terminated = true;
8701            return std::task::Poll::Ready(None);
8702        }
8703        if this.is_terminated {
8704            panic!("polled SmcResourceRequestStream after completion");
8705        }
8706        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8707            |bytes, handles| {
8708                match this.inner.channel().read_etc(cx, bytes, handles) {
8709                    std::task::Poll::Ready(Ok(())) => {}
8710                    std::task::Poll::Pending => return std::task::Poll::Pending,
8711                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8712                        this.is_terminated = true;
8713                        return std::task::Poll::Ready(None);
8714                    }
8715                    std::task::Poll::Ready(Err(e)) => {
8716                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8717                            e.into(),
8718                        ))))
8719                    }
8720                }
8721
8722                // A message has been received from the channel
8723                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8724
8725                std::task::Poll::Ready(Some(match header.ordinal {
8726                    0x392cbd495b84ede7 => {
8727                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8728                        let mut req = fidl::new_empty!(
8729                            fidl::encoding::EmptyPayload,
8730                            fidl::encoding::DefaultFuchsiaResourceDialect
8731                        );
8732                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8733                        let control_handle = SmcResourceControlHandle { inner: this.inner.clone() };
8734                        Ok(SmcResourceRequest::Get {
8735                            responder: SmcResourceGetResponder {
8736                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8737                                tx_id: header.tx_id,
8738                            },
8739                        })
8740                    }
8741                    _ => Err(fidl::Error::UnknownOrdinal {
8742                        ordinal: header.ordinal,
8743                        protocol_name:
8744                            <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8745                    }),
8746                }))
8747            },
8748        )
8749    }
8750}
8751
8752/// Protocol for providing an SMC resource with access to all valid ranges.
8753#[derive(Debug)]
8754pub enum SmcResourceRequest {
8755    /// Get an SMC resource handle.
8756    Get { responder: SmcResourceGetResponder },
8757}
8758
8759impl SmcResourceRequest {
8760    #[allow(irrefutable_let_patterns)]
8761    pub fn into_get(self) -> Option<(SmcResourceGetResponder)> {
8762        if let SmcResourceRequest::Get { responder } = self {
8763            Some((responder))
8764        } else {
8765            None
8766        }
8767    }
8768
8769    /// Name of the method defined in FIDL
8770    pub fn method_name(&self) -> &'static str {
8771        match *self {
8772            SmcResourceRequest::Get { .. } => "get",
8773        }
8774    }
8775}
8776
8777#[derive(Debug, Clone)]
8778pub struct SmcResourceControlHandle {
8779    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8780}
8781
8782impl fidl::endpoints::ControlHandle for SmcResourceControlHandle {
8783    fn shutdown(&self) {
8784        self.inner.shutdown()
8785    }
8786    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8787        self.inner.shutdown_with_epitaph(status)
8788    }
8789
8790    fn is_closed(&self) -> bool {
8791        self.inner.channel().is_closed()
8792    }
8793    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8794        self.inner.channel().on_closed()
8795    }
8796
8797    #[cfg(target_os = "fuchsia")]
8798    fn signal_peer(
8799        &self,
8800        clear_mask: zx::Signals,
8801        set_mask: zx::Signals,
8802    ) -> Result<(), zx_status::Status> {
8803        use fidl::Peered;
8804        self.inner.channel().signal_peer(clear_mask, set_mask)
8805    }
8806}
8807
8808impl SmcResourceControlHandle {}
8809
8810#[must_use = "FIDL methods require a response to be sent"]
8811#[derive(Debug)]
8812pub struct SmcResourceGetResponder {
8813    control_handle: std::mem::ManuallyDrop<SmcResourceControlHandle>,
8814    tx_id: u32,
8815}
8816
8817/// Set the the channel to be shutdown (see [`SmcResourceControlHandle::shutdown`])
8818/// if the responder is dropped without sending a response, so that the client
8819/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8820impl std::ops::Drop for SmcResourceGetResponder {
8821    fn drop(&mut self) {
8822        self.control_handle.shutdown();
8823        // Safety: drops once, never accessed again
8824        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8825    }
8826}
8827
8828impl fidl::endpoints::Responder for SmcResourceGetResponder {
8829    type ControlHandle = SmcResourceControlHandle;
8830
8831    fn control_handle(&self) -> &SmcResourceControlHandle {
8832        &self.control_handle
8833    }
8834
8835    fn drop_without_shutdown(mut self) {
8836        // Safety: drops once, never accessed again due to mem::forget
8837        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8838        // Prevent Drop from running (which would shut down the channel)
8839        std::mem::forget(self);
8840    }
8841}
8842
8843impl SmcResourceGetResponder {
8844    /// Sends a response to the FIDL transaction.
8845    ///
8846    /// Sets the channel to shutdown if an error occurs.
8847    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8848        let _result = self.send_raw(resource);
8849        if _result.is_err() {
8850            self.control_handle.shutdown();
8851        }
8852        self.drop_without_shutdown();
8853        _result
8854    }
8855
8856    /// Similar to "send" but does not shutdown the channel if an error occurs.
8857    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8858        let _result = self.send_raw(resource);
8859        self.drop_without_shutdown();
8860        _result
8861    }
8862
8863    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8864        self.control_handle.inner.send::<SmcResourceGetResponse>(
8865            (resource,),
8866            self.tx_id,
8867            0x392cbd495b84ede7,
8868            fidl::encoding::DynamicFlags::empty(),
8869        )
8870    }
8871}
8872
8873#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8874pub struct StallResourceMarker;
8875
8876impl fidl::endpoints::ProtocolMarker for StallResourceMarker {
8877    type Proxy = StallResourceProxy;
8878    type RequestStream = StallResourceRequestStream;
8879    #[cfg(target_os = "fuchsia")]
8880    type SynchronousProxy = StallResourceSynchronousProxy;
8881
8882    const DEBUG_NAME: &'static str = "fuchsia.kernel.StallResource";
8883}
8884impl fidl::endpoints::DiscoverableProtocolMarker for StallResourceMarker {}
8885
8886pub trait StallResourceProxyInterface: Send + Sync {
8887    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8888    fn r#get(&self) -> Self::GetResponseFut;
8889}
8890#[derive(Debug)]
8891#[cfg(target_os = "fuchsia")]
8892pub struct StallResourceSynchronousProxy {
8893    client: fidl::client::sync::Client,
8894}
8895
8896#[cfg(target_os = "fuchsia")]
8897impl fidl::endpoints::SynchronousProxy for StallResourceSynchronousProxy {
8898    type Proxy = StallResourceProxy;
8899    type Protocol = StallResourceMarker;
8900
8901    fn from_channel(inner: fidl::Channel) -> Self {
8902        Self::new(inner)
8903    }
8904
8905    fn into_channel(self) -> fidl::Channel {
8906        self.client.into_channel()
8907    }
8908
8909    fn as_channel(&self) -> &fidl::Channel {
8910        self.client.as_channel()
8911    }
8912}
8913
8914#[cfg(target_os = "fuchsia")]
8915impl StallResourceSynchronousProxy {
8916    pub fn new(channel: fidl::Channel) -> Self {
8917        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8918        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8919    }
8920
8921    pub fn into_channel(self) -> fidl::Channel {
8922        self.client.into_channel()
8923    }
8924
8925    /// Waits until an event arrives and returns it. It is safe for other
8926    /// threads to make concurrent requests while waiting for an event.
8927    pub fn wait_for_event(
8928        &self,
8929        deadline: zx::MonotonicInstant,
8930    ) -> Result<StallResourceEvent, fidl::Error> {
8931        StallResourceEvent::decode(self.client.wait_for_event(deadline)?)
8932    }
8933
8934    /// Get a stall resource handle.
8935    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8936        let _response =
8937            self.client.send_query::<fidl::encoding::EmptyPayload, StallResourceGetResponse>(
8938                (),
8939                0x5edf4c8629a9781a,
8940                fidl::encoding::DynamicFlags::empty(),
8941                ___deadline,
8942            )?;
8943        Ok(_response.resource)
8944    }
8945}
8946
8947#[cfg(target_os = "fuchsia")]
8948impl From<StallResourceSynchronousProxy> for zx::Handle {
8949    fn from(value: StallResourceSynchronousProxy) -> Self {
8950        value.into_channel().into()
8951    }
8952}
8953
8954#[cfg(target_os = "fuchsia")]
8955impl From<fidl::Channel> for StallResourceSynchronousProxy {
8956    fn from(value: fidl::Channel) -> Self {
8957        Self::new(value)
8958    }
8959}
8960
8961#[cfg(target_os = "fuchsia")]
8962impl fidl::endpoints::FromClient for StallResourceSynchronousProxy {
8963    type Protocol = StallResourceMarker;
8964
8965    fn from_client(value: fidl::endpoints::ClientEnd<StallResourceMarker>) -> Self {
8966        Self::new(value.into_channel())
8967    }
8968}
8969
8970#[derive(Debug, Clone)]
8971pub struct StallResourceProxy {
8972    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8973}
8974
8975impl fidl::endpoints::Proxy for StallResourceProxy {
8976    type Protocol = StallResourceMarker;
8977
8978    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8979        Self::new(inner)
8980    }
8981
8982    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8983        self.client.into_channel().map_err(|client| Self { client })
8984    }
8985
8986    fn as_channel(&self) -> &::fidl::AsyncChannel {
8987        self.client.as_channel()
8988    }
8989}
8990
8991impl StallResourceProxy {
8992    /// Create a new Proxy for fuchsia.kernel/StallResource.
8993    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8994        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8995        Self { client: fidl::client::Client::new(channel, protocol_name) }
8996    }
8997
8998    /// Get a Stream of events from the remote end of the protocol.
8999    ///
9000    /// # Panics
9001    ///
9002    /// Panics if the event stream was already taken.
9003    pub fn take_event_stream(&self) -> StallResourceEventStream {
9004        StallResourceEventStream { event_receiver: self.client.take_event_receiver() }
9005    }
9006
9007    /// Get a stall resource handle.
9008    pub fn r#get(
9009        &self,
9010    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9011    {
9012        StallResourceProxyInterface::r#get(self)
9013    }
9014}
9015
9016impl StallResourceProxyInterface for StallResourceProxy {
9017    type GetResponseFut = fidl::client::QueryResponseFut<
9018        fidl::Resource,
9019        fidl::encoding::DefaultFuchsiaResourceDialect,
9020    >;
9021    fn r#get(&self) -> Self::GetResponseFut {
9022        fn _decode(
9023            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9024        ) -> Result<fidl::Resource, fidl::Error> {
9025            let _response = fidl::client::decode_transaction_body::<
9026                StallResourceGetResponse,
9027                fidl::encoding::DefaultFuchsiaResourceDialect,
9028                0x5edf4c8629a9781a,
9029            >(_buf?)?;
9030            Ok(_response.resource)
9031        }
9032        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9033            (),
9034            0x5edf4c8629a9781a,
9035            fidl::encoding::DynamicFlags::empty(),
9036            _decode,
9037        )
9038    }
9039}
9040
9041pub struct StallResourceEventStream {
9042    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9043}
9044
9045impl std::marker::Unpin for StallResourceEventStream {}
9046
9047impl futures::stream::FusedStream for StallResourceEventStream {
9048    fn is_terminated(&self) -> bool {
9049        self.event_receiver.is_terminated()
9050    }
9051}
9052
9053impl futures::Stream for StallResourceEventStream {
9054    type Item = Result<StallResourceEvent, fidl::Error>;
9055
9056    fn poll_next(
9057        mut self: std::pin::Pin<&mut Self>,
9058        cx: &mut std::task::Context<'_>,
9059    ) -> std::task::Poll<Option<Self::Item>> {
9060        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9061            &mut self.event_receiver,
9062            cx
9063        )?) {
9064            Some(buf) => std::task::Poll::Ready(Some(StallResourceEvent::decode(buf))),
9065            None => std::task::Poll::Ready(None),
9066        }
9067    }
9068}
9069
9070#[derive(Debug)]
9071pub enum StallResourceEvent {}
9072
9073impl StallResourceEvent {
9074    /// Decodes a message buffer as a [`StallResourceEvent`].
9075    fn decode(
9076        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9077    ) -> Result<StallResourceEvent, fidl::Error> {
9078        let (bytes, _handles) = buf.split_mut();
9079        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9080        debug_assert_eq!(tx_header.tx_id, 0);
9081        match tx_header.ordinal {
9082            _ => Err(fidl::Error::UnknownOrdinal {
9083                ordinal: tx_header.ordinal,
9084                protocol_name: <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9085            }),
9086        }
9087    }
9088}
9089
9090/// A Stream of incoming requests for fuchsia.kernel/StallResource.
9091pub struct StallResourceRequestStream {
9092    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9093    is_terminated: bool,
9094}
9095
9096impl std::marker::Unpin for StallResourceRequestStream {}
9097
9098impl futures::stream::FusedStream for StallResourceRequestStream {
9099    fn is_terminated(&self) -> bool {
9100        self.is_terminated
9101    }
9102}
9103
9104impl fidl::endpoints::RequestStream for StallResourceRequestStream {
9105    type Protocol = StallResourceMarker;
9106    type ControlHandle = StallResourceControlHandle;
9107
9108    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9109        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9110    }
9111
9112    fn control_handle(&self) -> Self::ControlHandle {
9113        StallResourceControlHandle { inner: self.inner.clone() }
9114    }
9115
9116    fn into_inner(
9117        self,
9118    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9119    {
9120        (self.inner, self.is_terminated)
9121    }
9122
9123    fn from_inner(
9124        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9125        is_terminated: bool,
9126    ) -> Self {
9127        Self { inner, is_terminated }
9128    }
9129}
9130
9131impl futures::Stream for StallResourceRequestStream {
9132    type Item = Result<StallResourceRequest, fidl::Error>;
9133
9134    fn poll_next(
9135        mut self: std::pin::Pin<&mut Self>,
9136        cx: &mut std::task::Context<'_>,
9137    ) -> std::task::Poll<Option<Self::Item>> {
9138        let this = &mut *self;
9139        if this.inner.check_shutdown(cx) {
9140            this.is_terminated = true;
9141            return std::task::Poll::Ready(None);
9142        }
9143        if this.is_terminated {
9144            panic!("polled StallResourceRequestStream after completion");
9145        }
9146        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9147            |bytes, handles| {
9148                match this.inner.channel().read_etc(cx, bytes, handles) {
9149                    std::task::Poll::Ready(Ok(())) => {}
9150                    std::task::Poll::Pending => return std::task::Poll::Pending,
9151                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9152                        this.is_terminated = true;
9153                        return std::task::Poll::Ready(None);
9154                    }
9155                    std::task::Poll::Ready(Err(e)) => {
9156                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9157                            e.into(),
9158                        ))))
9159                    }
9160                }
9161
9162                // A message has been received from the channel
9163                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9164
9165                std::task::Poll::Ready(Some(match header.ordinal {
9166                    0x5edf4c8629a9781a => {
9167                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9168                        let mut req = fidl::new_empty!(
9169                            fidl::encoding::EmptyPayload,
9170                            fidl::encoding::DefaultFuchsiaResourceDialect
9171                        );
9172                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9173                        let control_handle =
9174                            StallResourceControlHandle { inner: this.inner.clone() };
9175                        Ok(StallResourceRequest::Get {
9176                            responder: StallResourceGetResponder {
9177                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9178                                tx_id: header.tx_id,
9179                            },
9180                        })
9181                    }
9182                    _ => Err(fidl::Error::UnknownOrdinal {
9183                        ordinal: header.ordinal,
9184                        protocol_name:
9185                            <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9186                    }),
9187                }))
9188            },
9189        )
9190    }
9191}
9192
9193/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
9194/// `ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
9195/// be notified of stalls.
9196#[derive(Debug)]
9197pub enum StallResourceRequest {
9198    /// Get a stall resource handle.
9199    Get { responder: StallResourceGetResponder },
9200}
9201
9202impl StallResourceRequest {
9203    #[allow(irrefutable_let_patterns)]
9204    pub fn into_get(self) -> Option<(StallResourceGetResponder)> {
9205        if let StallResourceRequest::Get { responder } = self {
9206            Some((responder))
9207        } else {
9208            None
9209        }
9210    }
9211
9212    /// Name of the method defined in FIDL
9213    pub fn method_name(&self) -> &'static str {
9214        match *self {
9215            StallResourceRequest::Get { .. } => "get",
9216        }
9217    }
9218}
9219
9220#[derive(Debug, Clone)]
9221pub struct StallResourceControlHandle {
9222    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9223}
9224
9225impl fidl::endpoints::ControlHandle for StallResourceControlHandle {
9226    fn shutdown(&self) {
9227        self.inner.shutdown()
9228    }
9229    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9230        self.inner.shutdown_with_epitaph(status)
9231    }
9232
9233    fn is_closed(&self) -> bool {
9234        self.inner.channel().is_closed()
9235    }
9236    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9237        self.inner.channel().on_closed()
9238    }
9239
9240    #[cfg(target_os = "fuchsia")]
9241    fn signal_peer(
9242        &self,
9243        clear_mask: zx::Signals,
9244        set_mask: zx::Signals,
9245    ) -> Result<(), zx_status::Status> {
9246        use fidl::Peered;
9247        self.inner.channel().signal_peer(clear_mask, set_mask)
9248    }
9249}
9250
9251impl StallResourceControlHandle {}
9252
9253#[must_use = "FIDL methods require a response to be sent"]
9254#[derive(Debug)]
9255pub struct StallResourceGetResponder {
9256    control_handle: std::mem::ManuallyDrop<StallResourceControlHandle>,
9257    tx_id: u32,
9258}
9259
9260/// Set the the channel to be shutdown (see [`StallResourceControlHandle::shutdown`])
9261/// if the responder is dropped without sending a response, so that the client
9262/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9263impl std::ops::Drop for StallResourceGetResponder {
9264    fn drop(&mut self) {
9265        self.control_handle.shutdown();
9266        // Safety: drops once, never accessed again
9267        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9268    }
9269}
9270
9271impl fidl::endpoints::Responder for StallResourceGetResponder {
9272    type ControlHandle = StallResourceControlHandle;
9273
9274    fn control_handle(&self) -> &StallResourceControlHandle {
9275        &self.control_handle
9276    }
9277
9278    fn drop_without_shutdown(mut self) {
9279        // Safety: drops once, never accessed again due to mem::forget
9280        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9281        // Prevent Drop from running (which would shut down the channel)
9282        std::mem::forget(self);
9283    }
9284}
9285
9286impl StallResourceGetResponder {
9287    /// Sends a response to the FIDL transaction.
9288    ///
9289    /// Sets the channel to shutdown if an error occurs.
9290    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9291        let _result = self.send_raw(resource);
9292        if _result.is_err() {
9293            self.control_handle.shutdown();
9294        }
9295        self.drop_without_shutdown();
9296        _result
9297    }
9298
9299    /// Similar to "send" but does not shutdown the channel if an error occurs.
9300    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9301        let _result = self.send_raw(resource);
9302        self.drop_without_shutdown();
9303        _result
9304    }
9305
9306    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9307        self.control_handle.inner.send::<StallResourceGetResponse>(
9308            (resource,),
9309            self.tx_id,
9310            0x5edf4c8629a9781a,
9311            fidl::encoding::DynamicFlags::empty(),
9312        )
9313    }
9314}
9315
9316#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9317pub struct StatsMarker;
9318
9319impl fidl::endpoints::ProtocolMarker for StatsMarker {
9320    type Proxy = StatsProxy;
9321    type RequestStream = StatsRequestStream;
9322    #[cfg(target_os = "fuchsia")]
9323    type SynchronousProxy = StatsSynchronousProxy;
9324
9325    const DEBUG_NAME: &'static str = "fuchsia.kernel.Stats";
9326}
9327impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
9328
9329pub trait StatsProxyInterface: Send + Sync {
9330    type GetMemoryStatsResponseFut: std::future::Future<Output = Result<MemoryStats, fidl::Error>>
9331        + Send;
9332    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut;
9333    type GetMemoryStatsExtendedResponseFut: std::future::Future<Output = Result<MemoryStatsExtended, fidl::Error>>
9334        + Send;
9335    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut;
9336    type GetMemoryStatsCompressionResponseFut: std::future::Future<Output = Result<MemoryStatsCompression, fidl::Error>>
9337        + Send;
9338    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut;
9339    type GetCpuStatsResponseFut: std::future::Future<Output = Result<CpuStats, fidl::Error>> + Send;
9340    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut;
9341    type GetCpuLoadResponseFut: std::future::Future<Output = Result<Vec<f32>, fidl::Error>> + Send;
9342    fn r#get_cpu_load(&self, duration: i64) -> Self::GetCpuLoadResponseFut;
9343}
9344#[derive(Debug)]
9345#[cfg(target_os = "fuchsia")]
9346pub struct StatsSynchronousProxy {
9347    client: fidl::client::sync::Client,
9348}
9349
9350#[cfg(target_os = "fuchsia")]
9351impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
9352    type Proxy = StatsProxy;
9353    type Protocol = StatsMarker;
9354
9355    fn from_channel(inner: fidl::Channel) -> Self {
9356        Self::new(inner)
9357    }
9358
9359    fn into_channel(self) -> fidl::Channel {
9360        self.client.into_channel()
9361    }
9362
9363    fn as_channel(&self) -> &fidl::Channel {
9364        self.client.as_channel()
9365    }
9366}
9367
9368#[cfg(target_os = "fuchsia")]
9369impl StatsSynchronousProxy {
9370    pub fn new(channel: fidl::Channel) -> Self {
9371        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9372        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9373    }
9374
9375    pub fn into_channel(self) -> fidl::Channel {
9376        self.client.into_channel()
9377    }
9378
9379    /// Waits until an event arrives and returns it. It is safe for other
9380    /// threads to make concurrent requests while waiting for an event.
9381    pub fn wait_for_event(
9382        &self,
9383        deadline: zx::MonotonicInstant,
9384    ) -> Result<StatsEvent, fidl::Error> {
9385        StatsEvent::decode(self.client.wait_for_event(deadline)?)
9386    }
9387
9388    pub fn r#get_memory_stats(
9389        &self,
9390        ___deadline: zx::MonotonicInstant,
9391    ) -> Result<MemoryStats, fidl::Error> {
9392        let _response =
9393            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsResponse>(
9394                (),
9395                0x686677932ae41074,
9396                fidl::encoding::DynamicFlags::empty(),
9397                ___deadline,
9398            )?;
9399        Ok(_response.stats)
9400    }
9401
9402    pub fn r#get_memory_stats_extended(
9403        &self,
9404        ___deadline: zx::MonotonicInstant,
9405    ) -> Result<MemoryStatsExtended, fidl::Error> {
9406        let _response = self
9407            .client
9408            .send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsExtendedResponse>(
9409                (),
9410                0x60faa0f8aa38c29f,
9411                fidl::encoding::DynamicFlags::empty(),
9412                ___deadline,
9413            )?;
9414        Ok(_response.stats)
9415    }
9416
9417    pub fn r#get_memory_stats_compression(
9418        &self,
9419        ___deadline: zx::MonotonicInstant,
9420    ) -> Result<MemoryStatsCompression, fidl::Error> {
9421        let _response =
9422            self.client.send_query::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
9423                (),
9424                0x544a09995befb531,
9425                fidl::encoding::DynamicFlags::empty(),
9426                ___deadline,
9427            )?;
9428        Ok(_response)
9429    }
9430
9431    pub fn r#get_cpu_stats(
9432        &self,
9433        ___deadline: zx::MonotonicInstant,
9434    ) -> Result<CpuStats, fidl::Error> {
9435        let _response =
9436            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetCpuStatsResponse>(
9437                (),
9438                0x470e2684ca1ca19e,
9439                fidl::encoding::DynamicFlags::empty(),
9440                ___deadline,
9441            )?;
9442        Ok(_response.stats)
9443    }
9444
9445    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9446    /// duration.
9447    ///
9448    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9449    /// PerCpuStats) over a time duration.
9450    pub fn r#get_cpu_load(
9451        &self,
9452        mut duration: i64,
9453        ___deadline: zx::MonotonicInstant,
9454    ) -> Result<Vec<f32>, fidl::Error> {
9455        let _response = self.client.send_query::<StatsGetCpuLoadRequest, StatsGetCpuLoadResponse>(
9456            (duration,),
9457            0x4c8f0f05e7034666,
9458            fidl::encoding::DynamicFlags::empty(),
9459            ___deadline,
9460        )?;
9461        Ok(_response.per_cpu_load)
9462    }
9463}
9464
9465#[cfg(target_os = "fuchsia")]
9466impl From<StatsSynchronousProxy> for zx::Handle {
9467    fn from(value: StatsSynchronousProxy) -> Self {
9468        value.into_channel().into()
9469    }
9470}
9471
9472#[cfg(target_os = "fuchsia")]
9473impl From<fidl::Channel> for StatsSynchronousProxy {
9474    fn from(value: fidl::Channel) -> Self {
9475        Self::new(value)
9476    }
9477}
9478
9479#[cfg(target_os = "fuchsia")]
9480impl fidl::endpoints::FromClient for StatsSynchronousProxy {
9481    type Protocol = StatsMarker;
9482
9483    fn from_client(value: fidl::endpoints::ClientEnd<StatsMarker>) -> Self {
9484        Self::new(value.into_channel())
9485    }
9486}
9487
9488#[derive(Debug, Clone)]
9489pub struct StatsProxy {
9490    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9491}
9492
9493impl fidl::endpoints::Proxy for StatsProxy {
9494    type Protocol = StatsMarker;
9495
9496    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9497        Self::new(inner)
9498    }
9499
9500    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9501        self.client.into_channel().map_err(|client| Self { client })
9502    }
9503
9504    fn as_channel(&self) -> &::fidl::AsyncChannel {
9505        self.client.as_channel()
9506    }
9507}
9508
9509impl StatsProxy {
9510    /// Create a new Proxy for fuchsia.kernel/Stats.
9511    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9512        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9513        Self { client: fidl::client::Client::new(channel, protocol_name) }
9514    }
9515
9516    /// Get a Stream of events from the remote end of the protocol.
9517    ///
9518    /// # Panics
9519    ///
9520    /// Panics if the event stream was already taken.
9521    pub fn take_event_stream(&self) -> StatsEventStream {
9522        StatsEventStream { event_receiver: self.client.take_event_receiver() }
9523    }
9524
9525    pub fn r#get_memory_stats(
9526        &self,
9527    ) -> fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9528    {
9529        StatsProxyInterface::r#get_memory_stats(self)
9530    }
9531
9532    pub fn r#get_memory_stats_extended(
9533        &self,
9534    ) -> fidl::client::QueryResponseFut<
9535        MemoryStatsExtended,
9536        fidl::encoding::DefaultFuchsiaResourceDialect,
9537    > {
9538        StatsProxyInterface::r#get_memory_stats_extended(self)
9539    }
9540
9541    pub fn r#get_memory_stats_compression(
9542        &self,
9543    ) -> fidl::client::QueryResponseFut<
9544        MemoryStatsCompression,
9545        fidl::encoding::DefaultFuchsiaResourceDialect,
9546    > {
9547        StatsProxyInterface::r#get_memory_stats_compression(self)
9548    }
9549
9550    pub fn r#get_cpu_stats(
9551        &self,
9552    ) -> fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9553    {
9554        StatsProxyInterface::r#get_cpu_stats(self)
9555    }
9556
9557    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9558    /// duration.
9559    ///
9560    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9561    /// PerCpuStats) over a time duration.
9562    pub fn r#get_cpu_load(
9563        &self,
9564        mut duration: i64,
9565    ) -> fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>
9566    {
9567        StatsProxyInterface::r#get_cpu_load(self, duration)
9568    }
9569}
9570
9571impl StatsProxyInterface for StatsProxy {
9572    type GetMemoryStatsResponseFut =
9573        fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9574    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut {
9575        fn _decode(
9576            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9577        ) -> Result<MemoryStats, fidl::Error> {
9578            let _response = fidl::client::decode_transaction_body::<
9579                StatsGetMemoryStatsResponse,
9580                fidl::encoding::DefaultFuchsiaResourceDialect,
9581                0x686677932ae41074,
9582            >(_buf?)?;
9583            Ok(_response.stats)
9584        }
9585        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStats>(
9586            (),
9587            0x686677932ae41074,
9588            fidl::encoding::DynamicFlags::empty(),
9589            _decode,
9590        )
9591    }
9592
9593    type GetMemoryStatsExtendedResponseFut = fidl::client::QueryResponseFut<
9594        MemoryStatsExtended,
9595        fidl::encoding::DefaultFuchsiaResourceDialect,
9596    >;
9597    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut {
9598        fn _decode(
9599            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9600        ) -> Result<MemoryStatsExtended, fidl::Error> {
9601            let _response = fidl::client::decode_transaction_body::<
9602                StatsGetMemoryStatsExtendedResponse,
9603                fidl::encoding::DefaultFuchsiaResourceDialect,
9604                0x60faa0f8aa38c29f,
9605            >(_buf?)?;
9606            Ok(_response.stats)
9607        }
9608        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsExtended>(
9609            (),
9610            0x60faa0f8aa38c29f,
9611            fidl::encoding::DynamicFlags::empty(),
9612            _decode,
9613        )
9614    }
9615
9616    type GetMemoryStatsCompressionResponseFut = fidl::client::QueryResponseFut<
9617        MemoryStatsCompression,
9618        fidl::encoding::DefaultFuchsiaResourceDialect,
9619    >;
9620    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut {
9621        fn _decode(
9622            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9623        ) -> Result<MemoryStatsCompression, fidl::Error> {
9624            let _response = fidl::client::decode_transaction_body::<
9625                MemoryStatsCompression,
9626                fidl::encoding::DefaultFuchsiaResourceDialect,
9627                0x544a09995befb531,
9628            >(_buf?)?;
9629            Ok(_response)
9630        }
9631        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
9632            (),
9633            0x544a09995befb531,
9634            fidl::encoding::DynamicFlags::empty(),
9635            _decode,
9636        )
9637    }
9638
9639    type GetCpuStatsResponseFut =
9640        fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9641    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut {
9642        fn _decode(
9643            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9644        ) -> Result<CpuStats, fidl::Error> {
9645            let _response = fidl::client::decode_transaction_body::<
9646                StatsGetCpuStatsResponse,
9647                fidl::encoding::DefaultFuchsiaResourceDialect,
9648                0x470e2684ca1ca19e,
9649            >(_buf?)?;
9650            Ok(_response.stats)
9651        }
9652        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CpuStats>(
9653            (),
9654            0x470e2684ca1ca19e,
9655            fidl::encoding::DynamicFlags::empty(),
9656            _decode,
9657        )
9658    }
9659
9660    type GetCpuLoadResponseFut =
9661        fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>;
9662    fn r#get_cpu_load(&self, mut duration: i64) -> Self::GetCpuLoadResponseFut {
9663        fn _decode(
9664            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9665        ) -> Result<Vec<f32>, fidl::Error> {
9666            let _response = fidl::client::decode_transaction_body::<
9667                StatsGetCpuLoadResponse,
9668                fidl::encoding::DefaultFuchsiaResourceDialect,
9669                0x4c8f0f05e7034666,
9670            >(_buf?)?;
9671            Ok(_response.per_cpu_load)
9672        }
9673        self.client.send_query_and_decode::<StatsGetCpuLoadRequest, Vec<f32>>(
9674            (duration,),
9675            0x4c8f0f05e7034666,
9676            fidl::encoding::DynamicFlags::empty(),
9677            _decode,
9678        )
9679    }
9680}
9681
9682pub struct StatsEventStream {
9683    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9684}
9685
9686impl std::marker::Unpin for StatsEventStream {}
9687
9688impl futures::stream::FusedStream for StatsEventStream {
9689    fn is_terminated(&self) -> bool {
9690        self.event_receiver.is_terminated()
9691    }
9692}
9693
9694impl futures::Stream for StatsEventStream {
9695    type Item = Result<StatsEvent, fidl::Error>;
9696
9697    fn poll_next(
9698        mut self: std::pin::Pin<&mut Self>,
9699        cx: &mut std::task::Context<'_>,
9700    ) -> std::task::Poll<Option<Self::Item>> {
9701        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9702            &mut self.event_receiver,
9703            cx
9704        )?) {
9705            Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
9706            None => std::task::Poll::Ready(None),
9707        }
9708    }
9709}
9710
9711#[derive(Debug)]
9712pub enum StatsEvent {}
9713
9714impl StatsEvent {
9715    /// Decodes a message buffer as a [`StatsEvent`].
9716    fn decode(
9717        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9718    ) -> Result<StatsEvent, fidl::Error> {
9719        let (bytes, _handles) = buf.split_mut();
9720        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9721        debug_assert_eq!(tx_header.tx_id, 0);
9722        match tx_header.ordinal {
9723            _ => Err(fidl::Error::UnknownOrdinal {
9724                ordinal: tx_header.ordinal,
9725                protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9726            }),
9727        }
9728    }
9729}
9730
9731/// A Stream of incoming requests for fuchsia.kernel/Stats.
9732pub struct StatsRequestStream {
9733    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9734    is_terminated: bool,
9735}
9736
9737impl std::marker::Unpin for StatsRequestStream {}
9738
9739impl futures::stream::FusedStream for StatsRequestStream {
9740    fn is_terminated(&self) -> bool {
9741        self.is_terminated
9742    }
9743}
9744
9745impl fidl::endpoints::RequestStream for StatsRequestStream {
9746    type Protocol = StatsMarker;
9747    type ControlHandle = StatsControlHandle;
9748
9749    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9750        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9751    }
9752
9753    fn control_handle(&self) -> Self::ControlHandle {
9754        StatsControlHandle { inner: self.inner.clone() }
9755    }
9756
9757    fn into_inner(
9758        self,
9759    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9760    {
9761        (self.inner, self.is_terminated)
9762    }
9763
9764    fn from_inner(
9765        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9766        is_terminated: bool,
9767    ) -> Self {
9768        Self { inner, is_terminated }
9769    }
9770}
9771
9772impl futures::Stream for StatsRequestStream {
9773    type Item = Result<StatsRequest, fidl::Error>;
9774
9775    fn poll_next(
9776        mut self: std::pin::Pin<&mut Self>,
9777        cx: &mut std::task::Context<'_>,
9778    ) -> std::task::Poll<Option<Self::Item>> {
9779        let this = &mut *self;
9780        if this.inner.check_shutdown(cx) {
9781            this.is_terminated = true;
9782            return std::task::Poll::Ready(None);
9783        }
9784        if this.is_terminated {
9785            panic!("polled StatsRequestStream after completion");
9786        }
9787        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9788            |bytes, handles| {
9789                match this.inner.channel().read_etc(cx, bytes, handles) {
9790                    std::task::Poll::Ready(Ok(())) => {}
9791                    std::task::Poll::Pending => return std::task::Poll::Pending,
9792                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9793                        this.is_terminated = true;
9794                        return std::task::Poll::Ready(None);
9795                    }
9796                    std::task::Poll::Ready(Err(e)) => {
9797                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9798                            e.into(),
9799                        ))))
9800                    }
9801                }
9802
9803                // A message has been received from the channel
9804                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9805
9806                std::task::Poll::Ready(Some(match header.ordinal {
9807                    0x686677932ae41074 => {
9808                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9809                        let mut req = fidl::new_empty!(
9810                            fidl::encoding::EmptyPayload,
9811                            fidl::encoding::DefaultFuchsiaResourceDialect
9812                        );
9813                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9814                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9815                        Ok(StatsRequest::GetMemoryStats {
9816                            responder: StatsGetMemoryStatsResponder {
9817                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9818                                tx_id: header.tx_id,
9819                            },
9820                        })
9821                    }
9822                    0x60faa0f8aa38c29f => {
9823                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9824                        let mut req = fidl::new_empty!(
9825                            fidl::encoding::EmptyPayload,
9826                            fidl::encoding::DefaultFuchsiaResourceDialect
9827                        );
9828                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9829                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9830                        Ok(StatsRequest::GetMemoryStatsExtended {
9831                            responder: StatsGetMemoryStatsExtendedResponder {
9832                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9833                                tx_id: header.tx_id,
9834                            },
9835                        })
9836                    }
9837                    0x544a09995befb531 => {
9838                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9839                        let mut req = fidl::new_empty!(
9840                            fidl::encoding::EmptyPayload,
9841                            fidl::encoding::DefaultFuchsiaResourceDialect
9842                        );
9843                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9844                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9845                        Ok(StatsRequest::GetMemoryStatsCompression {
9846                            responder: StatsGetMemoryStatsCompressionResponder {
9847                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9848                                tx_id: header.tx_id,
9849                            },
9850                        })
9851                    }
9852                    0x470e2684ca1ca19e => {
9853                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9854                        let mut req = fidl::new_empty!(
9855                            fidl::encoding::EmptyPayload,
9856                            fidl::encoding::DefaultFuchsiaResourceDialect
9857                        );
9858                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9859                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9860                        Ok(StatsRequest::GetCpuStats {
9861                            responder: StatsGetCpuStatsResponder {
9862                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9863                                tx_id: header.tx_id,
9864                            },
9865                        })
9866                    }
9867                    0x4c8f0f05e7034666 => {
9868                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9869                        let mut req = fidl::new_empty!(
9870                            StatsGetCpuLoadRequest,
9871                            fidl::encoding::DefaultFuchsiaResourceDialect
9872                        );
9873                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatsGetCpuLoadRequest>(&header, _body_bytes, handles, &mut req)?;
9874                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9875                        Ok(StatsRequest::GetCpuLoad {
9876                            duration: req.duration,
9877
9878                            responder: StatsGetCpuLoadResponder {
9879                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9880                                tx_id: header.tx_id,
9881                            },
9882                        })
9883                    }
9884                    _ => Err(fidl::Error::UnknownOrdinal {
9885                        ordinal: header.ordinal,
9886                        protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9887                    }),
9888                }))
9889            },
9890        )
9891    }
9892}
9893
9894/// Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
9895/// the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
9896/// 'Root Resource' capability to obtain. Instead of vending out that capability, programs that
9897/// just want stats should use this service instead. If for some reason the protocol fails to
9898/// retrieve stats, which will be an un-recoverable error, it will close the channel.
9899#[derive(Debug)]
9900pub enum StatsRequest {
9901    GetMemoryStats {
9902        responder: StatsGetMemoryStatsResponder,
9903    },
9904    GetMemoryStatsExtended {
9905        responder: StatsGetMemoryStatsExtendedResponder,
9906    },
9907    GetMemoryStatsCompression {
9908        responder: StatsGetMemoryStatsCompressionResponder,
9909    },
9910    GetCpuStats {
9911        responder: StatsGetCpuStatsResponder,
9912    },
9913    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9914    /// duration.
9915    ///
9916    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9917    /// PerCpuStats) over a time duration.
9918    GetCpuLoad {
9919        duration: i64,
9920        responder: StatsGetCpuLoadResponder,
9921    },
9922}
9923
9924impl StatsRequest {
9925    #[allow(irrefutable_let_patterns)]
9926    pub fn into_get_memory_stats(self) -> Option<(StatsGetMemoryStatsResponder)> {
9927        if let StatsRequest::GetMemoryStats { responder } = self {
9928            Some((responder))
9929        } else {
9930            None
9931        }
9932    }
9933
9934    #[allow(irrefutable_let_patterns)]
9935    pub fn into_get_memory_stats_extended(self) -> Option<(StatsGetMemoryStatsExtendedResponder)> {
9936        if let StatsRequest::GetMemoryStatsExtended { responder } = self {
9937            Some((responder))
9938        } else {
9939            None
9940        }
9941    }
9942
9943    #[allow(irrefutable_let_patterns)]
9944    pub fn into_get_memory_stats_compression(
9945        self,
9946    ) -> Option<(StatsGetMemoryStatsCompressionResponder)> {
9947        if let StatsRequest::GetMemoryStatsCompression { responder } = self {
9948            Some((responder))
9949        } else {
9950            None
9951        }
9952    }
9953
9954    #[allow(irrefutable_let_patterns)]
9955    pub fn into_get_cpu_stats(self) -> Option<(StatsGetCpuStatsResponder)> {
9956        if let StatsRequest::GetCpuStats { responder } = self {
9957            Some((responder))
9958        } else {
9959            None
9960        }
9961    }
9962
9963    #[allow(irrefutable_let_patterns)]
9964    pub fn into_get_cpu_load(self) -> Option<(i64, StatsGetCpuLoadResponder)> {
9965        if let StatsRequest::GetCpuLoad { duration, responder } = self {
9966            Some((duration, responder))
9967        } else {
9968            None
9969        }
9970    }
9971
9972    /// Name of the method defined in FIDL
9973    pub fn method_name(&self) -> &'static str {
9974        match *self {
9975            StatsRequest::GetMemoryStats { .. } => "get_memory_stats",
9976            StatsRequest::GetMemoryStatsExtended { .. } => "get_memory_stats_extended",
9977            StatsRequest::GetMemoryStatsCompression { .. } => "get_memory_stats_compression",
9978            StatsRequest::GetCpuStats { .. } => "get_cpu_stats",
9979            StatsRequest::GetCpuLoad { .. } => "get_cpu_load",
9980        }
9981    }
9982}
9983
9984#[derive(Debug, Clone)]
9985pub struct StatsControlHandle {
9986    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9987}
9988
9989impl fidl::endpoints::ControlHandle for StatsControlHandle {
9990    fn shutdown(&self) {
9991        self.inner.shutdown()
9992    }
9993    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9994        self.inner.shutdown_with_epitaph(status)
9995    }
9996
9997    fn is_closed(&self) -> bool {
9998        self.inner.channel().is_closed()
9999    }
10000    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10001        self.inner.channel().on_closed()
10002    }
10003
10004    #[cfg(target_os = "fuchsia")]
10005    fn signal_peer(
10006        &self,
10007        clear_mask: zx::Signals,
10008        set_mask: zx::Signals,
10009    ) -> Result<(), zx_status::Status> {
10010        use fidl::Peered;
10011        self.inner.channel().signal_peer(clear_mask, set_mask)
10012    }
10013}
10014
10015impl StatsControlHandle {}
10016
10017#[must_use = "FIDL methods require a response to be sent"]
10018#[derive(Debug)]
10019pub struct StatsGetMemoryStatsResponder {
10020    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10021    tx_id: u32,
10022}
10023
10024/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10025/// if the responder is dropped without sending a response, so that the client
10026/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10027impl std::ops::Drop for StatsGetMemoryStatsResponder {
10028    fn drop(&mut self) {
10029        self.control_handle.shutdown();
10030        // Safety: drops once, never accessed again
10031        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10032    }
10033}
10034
10035impl fidl::endpoints::Responder for StatsGetMemoryStatsResponder {
10036    type ControlHandle = StatsControlHandle;
10037
10038    fn control_handle(&self) -> &StatsControlHandle {
10039        &self.control_handle
10040    }
10041
10042    fn drop_without_shutdown(mut self) {
10043        // Safety: drops once, never accessed again due to mem::forget
10044        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10045        // Prevent Drop from running (which would shut down the channel)
10046        std::mem::forget(self);
10047    }
10048}
10049
10050impl StatsGetMemoryStatsResponder {
10051    /// Sends a response to the FIDL transaction.
10052    ///
10053    /// Sets the channel to shutdown if an error occurs.
10054    pub fn send(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10055        let _result = self.send_raw(stats);
10056        if _result.is_err() {
10057            self.control_handle.shutdown();
10058        }
10059        self.drop_without_shutdown();
10060        _result
10061    }
10062
10063    /// Similar to "send" but does not shutdown the channel if an error occurs.
10064    pub fn send_no_shutdown_on_err(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10065        let _result = self.send_raw(stats);
10066        self.drop_without_shutdown();
10067        _result
10068    }
10069
10070    fn send_raw(&self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10071        self.control_handle.inner.send::<StatsGetMemoryStatsResponse>(
10072            (stats,),
10073            self.tx_id,
10074            0x686677932ae41074,
10075            fidl::encoding::DynamicFlags::empty(),
10076        )
10077    }
10078}
10079
10080#[must_use = "FIDL methods require a response to be sent"]
10081#[derive(Debug)]
10082pub struct StatsGetMemoryStatsExtendedResponder {
10083    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10084    tx_id: u32,
10085}
10086
10087/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10088/// if the responder is dropped without sending a response, so that the client
10089/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10090impl std::ops::Drop for StatsGetMemoryStatsExtendedResponder {
10091    fn drop(&mut self) {
10092        self.control_handle.shutdown();
10093        // Safety: drops once, never accessed again
10094        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10095    }
10096}
10097
10098impl fidl::endpoints::Responder for StatsGetMemoryStatsExtendedResponder {
10099    type ControlHandle = StatsControlHandle;
10100
10101    fn control_handle(&self) -> &StatsControlHandle {
10102        &self.control_handle
10103    }
10104
10105    fn drop_without_shutdown(mut self) {
10106        // Safety: drops once, never accessed again due to mem::forget
10107        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10108        // Prevent Drop from running (which would shut down the channel)
10109        std::mem::forget(self);
10110    }
10111}
10112
10113impl StatsGetMemoryStatsExtendedResponder {
10114    /// Sends a response to the FIDL transaction.
10115    ///
10116    /// Sets the channel to shutdown if an error occurs.
10117    pub fn send(self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10118        let _result = self.send_raw(stats);
10119        if _result.is_err() {
10120            self.control_handle.shutdown();
10121        }
10122        self.drop_without_shutdown();
10123        _result
10124    }
10125
10126    /// Similar to "send" but does not shutdown the channel if an error occurs.
10127    pub fn send_no_shutdown_on_err(
10128        self,
10129        mut stats: &MemoryStatsExtended,
10130    ) -> Result<(), fidl::Error> {
10131        let _result = self.send_raw(stats);
10132        self.drop_without_shutdown();
10133        _result
10134    }
10135
10136    fn send_raw(&self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10137        self.control_handle.inner.send::<StatsGetMemoryStatsExtendedResponse>(
10138            (stats,),
10139            self.tx_id,
10140            0x60faa0f8aa38c29f,
10141            fidl::encoding::DynamicFlags::empty(),
10142        )
10143    }
10144}
10145
10146#[must_use = "FIDL methods require a response to be sent"]
10147#[derive(Debug)]
10148pub struct StatsGetMemoryStatsCompressionResponder {
10149    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10150    tx_id: u32,
10151}
10152
10153/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10154/// if the responder is dropped without sending a response, so that the client
10155/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10156impl std::ops::Drop for StatsGetMemoryStatsCompressionResponder {
10157    fn drop(&mut self) {
10158        self.control_handle.shutdown();
10159        // Safety: drops once, never accessed again
10160        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10161    }
10162}
10163
10164impl fidl::endpoints::Responder for StatsGetMemoryStatsCompressionResponder {
10165    type ControlHandle = StatsControlHandle;
10166
10167    fn control_handle(&self) -> &StatsControlHandle {
10168        &self.control_handle
10169    }
10170
10171    fn drop_without_shutdown(mut self) {
10172        // Safety: drops once, never accessed again due to mem::forget
10173        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10174        // Prevent Drop from running (which would shut down the channel)
10175        std::mem::forget(self);
10176    }
10177}
10178
10179impl StatsGetMemoryStatsCompressionResponder {
10180    /// Sends a response to the FIDL transaction.
10181    ///
10182    /// Sets the channel to shutdown if an error occurs.
10183    pub fn send(self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10184        let _result = self.send_raw(payload);
10185        if _result.is_err() {
10186            self.control_handle.shutdown();
10187        }
10188        self.drop_without_shutdown();
10189        _result
10190    }
10191
10192    /// Similar to "send" but does not shutdown the channel if an error occurs.
10193    pub fn send_no_shutdown_on_err(
10194        self,
10195        mut payload: &MemoryStatsCompression,
10196    ) -> Result<(), fidl::Error> {
10197        let _result = self.send_raw(payload);
10198        self.drop_without_shutdown();
10199        _result
10200    }
10201
10202    fn send_raw(&self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10203        self.control_handle.inner.send::<MemoryStatsCompression>(
10204            payload,
10205            self.tx_id,
10206            0x544a09995befb531,
10207            fidl::encoding::DynamicFlags::empty(),
10208        )
10209    }
10210}
10211
10212#[must_use = "FIDL methods require a response to be sent"]
10213#[derive(Debug)]
10214pub struct StatsGetCpuStatsResponder {
10215    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10216    tx_id: u32,
10217}
10218
10219/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10220/// if the responder is dropped without sending a response, so that the client
10221/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10222impl std::ops::Drop for StatsGetCpuStatsResponder {
10223    fn drop(&mut self) {
10224        self.control_handle.shutdown();
10225        // Safety: drops once, never accessed again
10226        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10227    }
10228}
10229
10230impl fidl::endpoints::Responder for StatsGetCpuStatsResponder {
10231    type ControlHandle = StatsControlHandle;
10232
10233    fn control_handle(&self) -> &StatsControlHandle {
10234        &self.control_handle
10235    }
10236
10237    fn drop_without_shutdown(mut self) {
10238        // Safety: drops once, never accessed again due to mem::forget
10239        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10240        // Prevent Drop from running (which would shut down the channel)
10241        std::mem::forget(self);
10242    }
10243}
10244
10245impl StatsGetCpuStatsResponder {
10246    /// Sends a response to the FIDL transaction.
10247    ///
10248    /// Sets the channel to shutdown if an error occurs.
10249    pub fn send(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10250        let _result = self.send_raw(stats);
10251        if _result.is_err() {
10252            self.control_handle.shutdown();
10253        }
10254        self.drop_without_shutdown();
10255        _result
10256    }
10257
10258    /// Similar to "send" but does not shutdown the channel if an error occurs.
10259    pub fn send_no_shutdown_on_err(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10260        let _result = self.send_raw(stats);
10261        self.drop_without_shutdown();
10262        _result
10263    }
10264
10265    fn send_raw(&self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10266        self.control_handle.inner.send::<StatsGetCpuStatsResponse>(
10267            (stats,),
10268            self.tx_id,
10269            0x470e2684ca1ca19e,
10270            fidl::encoding::DynamicFlags::empty(),
10271        )
10272    }
10273}
10274
10275#[must_use = "FIDL methods require a response to be sent"]
10276#[derive(Debug)]
10277pub struct StatsGetCpuLoadResponder {
10278    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10279    tx_id: u32,
10280}
10281
10282/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10283/// if the responder is dropped without sending a response, so that the client
10284/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10285impl std::ops::Drop for StatsGetCpuLoadResponder {
10286    fn drop(&mut self) {
10287        self.control_handle.shutdown();
10288        // Safety: drops once, never accessed again
10289        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10290    }
10291}
10292
10293impl fidl::endpoints::Responder for StatsGetCpuLoadResponder {
10294    type ControlHandle = StatsControlHandle;
10295
10296    fn control_handle(&self) -> &StatsControlHandle {
10297        &self.control_handle
10298    }
10299
10300    fn drop_without_shutdown(mut self) {
10301        // Safety: drops once, never accessed again due to mem::forget
10302        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10303        // Prevent Drop from running (which would shut down the channel)
10304        std::mem::forget(self);
10305    }
10306}
10307
10308impl StatsGetCpuLoadResponder {
10309    /// Sends a response to the FIDL transaction.
10310    ///
10311    /// Sets the channel to shutdown if an error occurs.
10312    pub fn send(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10313        let _result = self.send_raw(per_cpu_load);
10314        if _result.is_err() {
10315            self.control_handle.shutdown();
10316        }
10317        self.drop_without_shutdown();
10318        _result
10319    }
10320
10321    /// Similar to "send" but does not shutdown the channel if an error occurs.
10322    pub fn send_no_shutdown_on_err(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10323        let _result = self.send_raw(per_cpu_load);
10324        self.drop_without_shutdown();
10325        _result
10326    }
10327
10328    fn send_raw(&self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10329        self.control_handle.inner.send::<StatsGetCpuLoadResponse>(
10330            (per_cpu_load,),
10331            self.tx_id,
10332            0x4c8f0f05e7034666,
10333            fidl::encoding::DynamicFlags::empty(),
10334        )
10335    }
10336}
10337
10338#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10339pub struct TracingResourceMarker;
10340
10341impl fidl::endpoints::ProtocolMarker for TracingResourceMarker {
10342    type Proxy = TracingResourceProxy;
10343    type RequestStream = TracingResourceRequestStream;
10344    #[cfg(target_os = "fuchsia")]
10345    type SynchronousProxy = TracingResourceSynchronousProxy;
10346
10347    const DEBUG_NAME: &'static str = "fuchsia.kernel.TracingResource";
10348}
10349impl fidl::endpoints::DiscoverableProtocolMarker for TracingResourceMarker {}
10350
10351pub trait TracingResourceProxyInterface: Send + Sync {
10352    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10353    fn r#get(&self) -> Self::GetResponseFut;
10354}
10355#[derive(Debug)]
10356#[cfg(target_os = "fuchsia")]
10357pub struct TracingResourceSynchronousProxy {
10358    client: fidl::client::sync::Client,
10359}
10360
10361#[cfg(target_os = "fuchsia")]
10362impl fidl::endpoints::SynchronousProxy for TracingResourceSynchronousProxy {
10363    type Proxy = TracingResourceProxy;
10364    type Protocol = TracingResourceMarker;
10365
10366    fn from_channel(inner: fidl::Channel) -> Self {
10367        Self::new(inner)
10368    }
10369
10370    fn into_channel(self) -> fidl::Channel {
10371        self.client.into_channel()
10372    }
10373
10374    fn as_channel(&self) -> &fidl::Channel {
10375        self.client.as_channel()
10376    }
10377}
10378
10379#[cfg(target_os = "fuchsia")]
10380impl TracingResourceSynchronousProxy {
10381    pub fn new(channel: fidl::Channel) -> Self {
10382        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10383        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10384    }
10385
10386    pub fn into_channel(self) -> fidl::Channel {
10387        self.client.into_channel()
10388    }
10389
10390    /// Waits until an event arrives and returns it. It is safe for other
10391    /// threads to make concurrent requests while waiting for an event.
10392    pub fn wait_for_event(
10393        &self,
10394        deadline: zx::MonotonicInstant,
10395    ) -> Result<TracingResourceEvent, fidl::Error> {
10396        TracingResourceEvent::decode(self.client.wait_for_event(deadline)?)
10397    }
10398
10399    /// Get a tracing resource handle.
10400    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10401        let _response =
10402            self.client.send_query::<fidl::encoding::EmptyPayload, TracingResourceGetResponse>(
10403                (),
10404                0x299bc179aa54c6aa,
10405                fidl::encoding::DynamicFlags::empty(),
10406                ___deadline,
10407            )?;
10408        Ok(_response.resource)
10409    }
10410}
10411
10412#[cfg(target_os = "fuchsia")]
10413impl From<TracingResourceSynchronousProxy> for zx::Handle {
10414    fn from(value: TracingResourceSynchronousProxy) -> Self {
10415        value.into_channel().into()
10416    }
10417}
10418
10419#[cfg(target_os = "fuchsia")]
10420impl From<fidl::Channel> for TracingResourceSynchronousProxy {
10421    fn from(value: fidl::Channel) -> Self {
10422        Self::new(value)
10423    }
10424}
10425
10426#[cfg(target_os = "fuchsia")]
10427impl fidl::endpoints::FromClient for TracingResourceSynchronousProxy {
10428    type Protocol = TracingResourceMarker;
10429
10430    fn from_client(value: fidl::endpoints::ClientEnd<TracingResourceMarker>) -> Self {
10431        Self::new(value.into_channel())
10432    }
10433}
10434
10435#[derive(Debug, Clone)]
10436pub struct TracingResourceProxy {
10437    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10438}
10439
10440impl fidl::endpoints::Proxy for TracingResourceProxy {
10441    type Protocol = TracingResourceMarker;
10442
10443    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10444        Self::new(inner)
10445    }
10446
10447    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10448        self.client.into_channel().map_err(|client| Self { client })
10449    }
10450
10451    fn as_channel(&self) -> &::fidl::AsyncChannel {
10452        self.client.as_channel()
10453    }
10454}
10455
10456impl TracingResourceProxy {
10457    /// Create a new Proxy for fuchsia.kernel/TracingResource.
10458    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10459        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10460        Self { client: fidl::client::Client::new(channel, protocol_name) }
10461    }
10462
10463    /// Get a Stream of events from the remote end of the protocol.
10464    ///
10465    /// # Panics
10466    ///
10467    /// Panics if the event stream was already taken.
10468    pub fn take_event_stream(&self) -> TracingResourceEventStream {
10469        TracingResourceEventStream { event_receiver: self.client.take_event_receiver() }
10470    }
10471
10472    /// Get a tracing resource handle.
10473    pub fn r#get(
10474        &self,
10475    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10476    {
10477        TracingResourceProxyInterface::r#get(self)
10478    }
10479}
10480
10481impl TracingResourceProxyInterface for TracingResourceProxy {
10482    type GetResponseFut = fidl::client::QueryResponseFut<
10483        fidl::Resource,
10484        fidl::encoding::DefaultFuchsiaResourceDialect,
10485    >;
10486    fn r#get(&self) -> Self::GetResponseFut {
10487        fn _decode(
10488            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10489        ) -> Result<fidl::Resource, fidl::Error> {
10490            let _response = fidl::client::decode_transaction_body::<
10491                TracingResourceGetResponse,
10492                fidl::encoding::DefaultFuchsiaResourceDialect,
10493                0x299bc179aa54c6aa,
10494            >(_buf?)?;
10495            Ok(_response.resource)
10496        }
10497        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10498            (),
10499            0x299bc179aa54c6aa,
10500            fidl::encoding::DynamicFlags::empty(),
10501            _decode,
10502        )
10503    }
10504}
10505
10506pub struct TracingResourceEventStream {
10507    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10508}
10509
10510impl std::marker::Unpin for TracingResourceEventStream {}
10511
10512impl futures::stream::FusedStream for TracingResourceEventStream {
10513    fn is_terminated(&self) -> bool {
10514        self.event_receiver.is_terminated()
10515    }
10516}
10517
10518impl futures::Stream for TracingResourceEventStream {
10519    type Item = Result<TracingResourceEvent, fidl::Error>;
10520
10521    fn poll_next(
10522        mut self: std::pin::Pin<&mut Self>,
10523        cx: &mut std::task::Context<'_>,
10524    ) -> std::task::Poll<Option<Self::Item>> {
10525        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10526            &mut self.event_receiver,
10527            cx
10528        )?) {
10529            Some(buf) => std::task::Poll::Ready(Some(TracingResourceEvent::decode(buf))),
10530            None => std::task::Poll::Ready(None),
10531        }
10532    }
10533}
10534
10535#[derive(Debug)]
10536pub enum TracingResourceEvent {}
10537
10538impl TracingResourceEvent {
10539    /// Decodes a message buffer as a [`TracingResourceEvent`].
10540    fn decode(
10541        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10542    ) -> Result<TracingResourceEvent, fidl::Error> {
10543        let (bytes, _handles) = buf.split_mut();
10544        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10545        debug_assert_eq!(tx_header.tx_id, 0);
10546        match tx_header.ordinal {
10547            _ => Err(fidl::Error::UnknownOrdinal {
10548                ordinal: tx_header.ordinal,
10549                protocol_name:
10550                    <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10551            }),
10552        }
10553    }
10554}
10555
10556/// A Stream of incoming requests for fuchsia.kernel/TracingResource.
10557pub struct TracingResourceRequestStream {
10558    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10559    is_terminated: bool,
10560}
10561
10562impl std::marker::Unpin for TracingResourceRequestStream {}
10563
10564impl futures::stream::FusedStream for TracingResourceRequestStream {
10565    fn is_terminated(&self) -> bool {
10566        self.is_terminated
10567    }
10568}
10569
10570impl fidl::endpoints::RequestStream for TracingResourceRequestStream {
10571    type Protocol = TracingResourceMarker;
10572    type ControlHandle = TracingResourceControlHandle;
10573
10574    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10575        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10576    }
10577
10578    fn control_handle(&self) -> Self::ControlHandle {
10579        TracingResourceControlHandle { inner: self.inner.clone() }
10580    }
10581
10582    fn into_inner(
10583        self,
10584    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10585    {
10586        (self.inner, self.is_terminated)
10587    }
10588
10589    fn from_inner(
10590        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10591        is_terminated: bool,
10592    ) -> Self {
10593        Self { inner, is_terminated }
10594    }
10595}
10596
10597impl futures::Stream for TracingResourceRequestStream {
10598    type Item = Result<TracingResourceRequest, fidl::Error>;
10599
10600    fn poll_next(
10601        mut self: std::pin::Pin<&mut Self>,
10602        cx: &mut std::task::Context<'_>,
10603    ) -> std::task::Poll<Option<Self::Item>> {
10604        let this = &mut *self;
10605        if this.inner.check_shutdown(cx) {
10606            this.is_terminated = true;
10607            return std::task::Poll::Ready(None);
10608        }
10609        if this.is_terminated {
10610            panic!("polled TracingResourceRequestStream after completion");
10611        }
10612        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10613            |bytes, handles| {
10614                match this.inner.channel().read_etc(cx, bytes, handles) {
10615                    std::task::Poll::Ready(Ok(())) => {}
10616                    std::task::Poll::Pending => return std::task::Poll::Pending,
10617                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10618                        this.is_terminated = true;
10619                        return std::task::Poll::Ready(None);
10620                    }
10621                    std::task::Poll::Ready(Err(e)) => {
10622                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10623                            e.into(),
10624                        ))))
10625                    }
10626                }
10627
10628                // A message has been received from the channel
10629                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10630
10631                std::task::Poll::Ready(Some(match header.ordinal {
10632                    0x299bc179aa54c6aa => {
10633                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10634                        let mut req = fidl::new_empty!(
10635                            fidl::encoding::EmptyPayload,
10636                            fidl::encoding::DefaultFuchsiaResourceDialect
10637                        );
10638                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10639                        let control_handle =
10640                            TracingResourceControlHandle { inner: this.inner.clone() };
10641                        Ok(TracingResourceRequest::Get {
10642                            responder: TracingResourceGetResponder {
10643                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10644                                tx_id: header.tx_id,
10645                            },
10646                        })
10647                    }
10648                    _ => Err(fidl::Error::UnknownOrdinal {
10649                        ordinal: header.ordinal,
10650                        protocol_name:
10651                            <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10652                    }),
10653                }))
10654            },
10655        )
10656    }
10657}
10658
10659/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
10660/// `ZX_RSRC_SYSTEM_TRACING_BASE`.
10661#[derive(Debug)]
10662pub enum TracingResourceRequest {
10663    /// Get a tracing resource handle.
10664    Get { responder: TracingResourceGetResponder },
10665}
10666
10667impl TracingResourceRequest {
10668    #[allow(irrefutable_let_patterns)]
10669    pub fn into_get(self) -> Option<(TracingResourceGetResponder)> {
10670        if let TracingResourceRequest::Get { responder } = self {
10671            Some((responder))
10672        } else {
10673            None
10674        }
10675    }
10676
10677    /// Name of the method defined in FIDL
10678    pub fn method_name(&self) -> &'static str {
10679        match *self {
10680            TracingResourceRequest::Get { .. } => "get",
10681        }
10682    }
10683}
10684
10685#[derive(Debug, Clone)]
10686pub struct TracingResourceControlHandle {
10687    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10688}
10689
10690impl fidl::endpoints::ControlHandle for TracingResourceControlHandle {
10691    fn shutdown(&self) {
10692        self.inner.shutdown()
10693    }
10694    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10695        self.inner.shutdown_with_epitaph(status)
10696    }
10697
10698    fn is_closed(&self) -> bool {
10699        self.inner.channel().is_closed()
10700    }
10701    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10702        self.inner.channel().on_closed()
10703    }
10704
10705    #[cfg(target_os = "fuchsia")]
10706    fn signal_peer(
10707        &self,
10708        clear_mask: zx::Signals,
10709        set_mask: zx::Signals,
10710    ) -> Result<(), zx_status::Status> {
10711        use fidl::Peered;
10712        self.inner.channel().signal_peer(clear_mask, set_mask)
10713    }
10714}
10715
10716impl TracingResourceControlHandle {}
10717
10718#[must_use = "FIDL methods require a response to be sent"]
10719#[derive(Debug)]
10720pub struct TracingResourceGetResponder {
10721    control_handle: std::mem::ManuallyDrop<TracingResourceControlHandle>,
10722    tx_id: u32,
10723}
10724
10725/// Set the the channel to be shutdown (see [`TracingResourceControlHandle::shutdown`])
10726/// if the responder is dropped without sending a response, so that the client
10727/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10728impl std::ops::Drop for TracingResourceGetResponder {
10729    fn drop(&mut self) {
10730        self.control_handle.shutdown();
10731        // Safety: drops once, never accessed again
10732        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10733    }
10734}
10735
10736impl fidl::endpoints::Responder for TracingResourceGetResponder {
10737    type ControlHandle = TracingResourceControlHandle;
10738
10739    fn control_handle(&self) -> &TracingResourceControlHandle {
10740        &self.control_handle
10741    }
10742
10743    fn drop_without_shutdown(mut self) {
10744        // Safety: drops once, never accessed again due to mem::forget
10745        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10746        // Prevent Drop from running (which would shut down the channel)
10747        std::mem::forget(self);
10748    }
10749}
10750
10751impl TracingResourceGetResponder {
10752    /// Sends a response to the FIDL transaction.
10753    ///
10754    /// Sets the channel to shutdown if an error occurs.
10755    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10756        let _result = self.send_raw(resource);
10757        if _result.is_err() {
10758            self.control_handle.shutdown();
10759        }
10760        self.drop_without_shutdown();
10761        _result
10762    }
10763
10764    /// Similar to "send" but does not shutdown the channel if an error occurs.
10765    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10766        let _result = self.send_raw(resource);
10767        self.drop_without_shutdown();
10768        _result
10769    }
10770
10771    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10772        self.control_handle.inner.send::<TracingResourceGetResponse>(
10773            (resource,),
10774            self.tx_id,
10775            0x299bc179aa54c6aa,
10776            fidl::encoding::DynamicFlags::empty(),
10777        )
10778    }
10779}
10780
10781#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10782pub struct VmexResourceMarker;
10783
10784impl fidl::endpoints::ProtocolMarker for VmexResourceMarker {
10785    type Proxy = VmexResourceProxy;
10786    type RequestStream = VmexResourceRequestStream;
10787    #[cfg(target_os = "fuchsia")]
10788    type SynchronousProxy = VmexResourceSynchronousProxy;
10789
10790    const DEBUG_NAME: &'static str = "fuchsia.kernel.VmexResource";
10791}
10792impl fidl::endpoints::DiscoverableProtocolMarker for VmexResourceMarker {}
10793
10794pub trait VmexResourceProxyInterface: Send + Sync {
10795    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10796    fn r#get(&self) -> Self::GetResponseFut;
10797}
10798#[derive(Debug)]
10799#[cfg(target_os = "fuchsia")]
10800pub struct VmexResourceSynchronousProxy {
10801    client: fidl::client::sync::Client,
10802}
10803
10804#[cfg(target_os = "fuchsia")]
10805impl fidl::endpoints::SynchronousProxy for VmexResourceSynchronousProxy {
10806    type Proxy = VmexResourceProxy;
10807    type Protocol = VmexResourceMarker;
10808
10809    fn from_channel(inner: fidl::Channel) -> Self {
10810        Self::new(inner)
10811    }
10812
10813    fn into_channel(self) -> fidl::Channel {
10814        self.client.into_channel()
10815    }
10816
10817    fn as_channel(&self) -> &fidl::Channel {
10818        self.client.as_channel()
10819    }
10820}
10821
10822#[cfg(target_os = "fuchsia")]
10823impl VmexResourceSynchronousProxy {
10824    pub fn new(channel: fidl::Channel) -> Self {
10825        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10826        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10827    }
10828
10829    pub fn into_channel(self) -> fidl::Channel {
10830        self.client.into_channel()
10831    }
10832
10833    /// Waits until an event arrives and returns it. It is safe for other
10834    /// threads to make concurrent requests while waiting for an event.
10835    pub fn wait_for_event(
10836        &self,
10837        deadline: zx::MonotonicInstant,
10838    ) -> Result<VmexResourceEvent, fidl::Error> {
10839        VmexResourceEvent::decode(self.client.wait_for_event(deadline)?)
10840    }
10841
10842    /// Get a VMEX resource handle.
10843    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10844        let _response =
10845            self.client.send_query::<fidl::encoding::EmptyPayload, VmexResourceGetResponse>(
10846                (),
10847                0x33db32deed650699,
10848                fidl::encoding::DynamicFlags::empty(),
10849                ___deadline,
10850            )?;
10851        Ok(_response.resource)
10852    }
10853}
10854
10855#[cfg(target_os = "fuchsia")]
10856impl From<VmexResourceSynchronousProxy> for zx::Handle {
10857    fn from(value: VmexResourceSynchronousProxy) -> Self {
10858        value.into_channel().into()
10859    }
10860}
10861
10862#[cfg(target_os = "fuchsia")]
10863impl From<fidl::Channel> for VmexResourceSynchronousProxy {
10864    fn from(value: fidl::Channel) -> Self {
10865        Self::new(value)
10866    }
10867}
10868
10869#[cfg(target_os = "fuchsia")]
10870impl fidl::endpoints::FromClient for VmexResourceSynchronousProxy {
10871    type Protocol = VmexResourceMarker;
10872
10873    fn from_client(value: fidl::endpoints::ClientEnd<VmexResourceMarker>) -> Self {
10874        Self::new(value.into_channel())
10875    }
10876}
10877
10878#[derive(Debug, Clone)]
10879pub struct VmexResourceProxy {
10880    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10881}
10882
10883impl fidl::endpoints::Proxy for VmexResourceProxy {
10884    type Protocol = VmexResourceMarker;
10885
10886    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10887        Self::new(inner)
10888    }
10889
10890    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10891        self.client.into_channel().map_err(|client| Self { client })
10892    }
10893
10894    fn as_channel(&self) -> &::fidl::AsyncChannel {
10895        self.client.as_channel()
10896    }
10897}
10898
10899impl VmexResourceProxy {
10900    /// Create a new Proxy for fuchsia.kernel/VmexResource.
10901    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10902        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10903        Self { client: fidl::client::Client::new(channel, protocol_name) }
10904    }
10905
10906    /// Get a Stream of events from the remote end of the protocol.
10907    ///
10908    /// # Panics
10909    ///
10910    /// Panics if the event stream was already taken.
10911    pub fn take_event_stream(&self) -> VmexResourceEventStream {
10912        VmexResourceEventStream { event_receiver: self.client.take_event_receiver() }
10913    }
10914
10915    /// Get a VMEX resource handle.
10916    pub fn r#get(
10917        &self,
10918    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10919    {
10920        VmexResourceProxyInterface::r#get(self)
10921    }
10922}
10923
10924impl VmexResourceProxyInterface for VmexResourceProxy {
10925    type GetResponseFut = fidl::client::QueryResponseFut<
10926        fidl::Resource,
10927        fidl::encoding::DefaultFuchsiaResourceDialect,
10928    >;
10929    fn r#get(&self) -> Self::GetResponseFut {
10930        fn _decode(
10931            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10932        ) -> Result<fidl::Resource, fidl::Error> {
10933            let _response = fidl::client::decode_transaction_body::<
10934                VmexResourceGetResponse,
10935                fidl::encoding::DefaultFuchsiaResourceDialect,
10936                0x33db32deed650699,
10937            >(_buf?)?;
10938            Ok(_response.resource)
10939        }
10940        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10941            (),
10942            0x33db32deed650699,
10943            fidl::encoding::DynamicFlags::empty(),
10944            _decode,
10945        )
10946    }
10947}
10948
10949pub struct VmexResourceEventStream {
10950    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10951}
10952
10953impl std::marker::Unpin for VmexResourceEventStream {}
10954
10955impl futures::stream::FusedStream for VmexResourceEventStream {
10956    fn is_terminated(&self) -> bool {
10957        self.event_receiver.is_terminated()
10958    }
10959}
10960
10961impl futures::Stream for VmexResourceEventStream {
10962    type Item = Result<VmexResourceEvent, fidl::Error>;
10963
10964    fn poll_next(
10965        mut self: std::pin::Pin<&mut Self>,
10966        cx: &mut std::task::Context<'_>,
10967    ) -> std::task::Poll<Option<Self::Item>> {
10968        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10969            &mut self.event_receiver,
10970            cx
10971        )?) {
10972            Some(buf) => std::task::Poll::Ready(Some(VmexResourceEvent::decode(buf))),
10973            None => std::task::Poll::Ready(None),
10974        }
10975    }
10976}
10977
10978#[derive(Debug)]
10979pub enum VmexResourceEvent {}
10980
10981impl VmexResourceEvent {
10982    /// Decodes a message buffer as a [`VmexResourceEvent`].
10983    fn decode(
10984        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10985    ) -> Result<VmexResourceEvent, fidl::Error> {
10986        let (bytes, _handles) = buf.split_mut();
10987        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10988        debug_assert_eq!(tx_header.tx_id, 0);
10989        match tx_header.ordinal {
10990            _ => Err(fidl::Error::UnknownOrdinal {
10991                ordinal: tx_header.ordinal,
10992                protocol_name: <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10993            }),
10994        }
10995    }
10996}
10997
10998/// A Stream of incoming requests for fuchsia.kernel/VmexResource.
10999pub struct VmexResourceRequestStream {
11000    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11001    is_terminated: bool,
11002}
11003
11004impl std::marker::Unpin for VmexResourceRequestStream {}
11005
11006impl futures::stream::FusedStream for VmexResourceRequestStream {
11007    fn is_terminated(&self) -> bool {
11008        self.is_terminated
11009    }
11010}
11011
11012impl fidl::endpoints::RequestStream for VmexResourceRequestStream {
11013    type Protocol = VmexResourceMarker;
11014    type ControlHandle = VmexResourceControlHandle;
11015
11016    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11017        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11018    }
11019
11020    fn control_handle(&self) -> Self::ControlHandle {
11021        VmexResourceControlHandle { inner: self.inner.clone() }
11022    }
11023
11024    fn into_inner(
11025        self,
11026    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11027    {
11028        (self.inner, self.is_terminated)
11029    }
11030
11031    fn from_inner(
11032        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11033        is_terminated: bool,
11034    ) -> Self {
11035        Self { inner, is_terminated }
11036    }
11037}
11038
11039impl futures::Stream for VmexResourceRequestStream {
11040    type Item = Result<VmexResourceRequest, fidl::Error>;
11041
11042    fn poll_next(
11043        mut self: std::pin::Pin<&mut Self>,
11044        cx: &mut std::task::Context<'_>,
11045    ) -> std::task::Poll<Option<Self::Item>> {
11046        let this = &mut *self;
11047        if this.inner.check_shutdown(cx) {
11048            this.is_terminated = true;
11049            return std::task::Poll::Ready(None);
11050        }
11051        if this.is_terminated {
11052            panic!("polled VmexResourceRequestStream after completion");
11053        }
11054        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11055            |bytes, handles| {
11056                match this.inner.channel().read_etc(cx, bytes, handles) {
11057                    std::task::Poll::Ready(Ok(())) => {}
11058                    std::task::Poll::Pending => return std::task::Poll::Pending,
11059                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11060                        this.is_terminated = true;
11061                        return std::task::Poll::Ready(None);
11062                    }
11063                    std::task::Poll::Ready(Err(e)) => {
11064                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11065                            e.into(),
11066                        ))))
11067                    }
11068                }
11069
11070                // A message has been received from the channel
11071                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11072
11073                std::task::Poll::Ready(Some(match header.ordinal {
11074                    0x33db32deed650699 => {
11075                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11076                        let mut req = fidl::new_empty!(
11077                            fidl::encoding::EmptyPayload,
11078                            fidl::encoding::DefaultFuchsiaResourceDialect
11079                        );
11080                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11081                        let control_handle =
11082                            VmexResourceControlHandle { inner: this.inner.clone() };
11083                        Ok(VmexResourceRequest::Get {
11084                            responder: VmexResourceGetResponder {
11085                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11086                                tx_id: header.tx_id,
11087                            },
11088                        })
11089                    }
11090                    _ => Err(fidl::Error::UnknownOrdinal {
11091                        ordinal: header.ordinal,
11092                        protocol_name:
11093                            <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11094                    }),
11095                }))
11096            },
11097        )
11098    }
11099}
11100
11101/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11102/// `ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
11103/// executable.
11104#[derive(Debug)]
11105pub enum VmexResourceRequest {
11106    /// Get a VMEX resource handle.
11107    Get { responder: VmexResourceGetResponder },
11108}
11109
11110impl VmexResourceRequest {
11111    #[allow(irrefutable_let_patterns)]
11112    pub fn into_get(self) -> Option<(VmexResourceGetResponder)> {
11113        if let VmexResourceRequest::Get { responder } = self {
11114            Some((responder))
11115        } else {
11116            None
11117        }
11118    }
11119
11120    /// Name of the method defined in FIDL
11121    pub fn method_name(&self) -> &'static str {
11122        match *self {
11123            VmexResourceRequest::Get { .. } => "get",
11124        }
11125    }
11126}
11127
11128#[derive(Debug, Clone)]
11129pub struct VmexResourceControlHandle {
11130    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11131}
11132
11133impl fidl::endpoints::ControlHandle for VmexResourceControlHandle {
11134    fn shutdown(&self) {
11135        self.inner.shutdown()
11136    }
11137    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11138        self.inner.shutdown_with_epitaph(status)
11139    }
11140
11141    fn is_closed(&self) -> bool {
11142        self.inner.channel().is_closed()
11143    }
11144    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11145        self.inner.channel().on_closed()
11146    }
11147
11148    #[cfg(target_os = "fuchsia")]
11149    fn signal_peer(
11150        &self,
11151        clear_mask: zx::Signals,
11152        set_mask: zx::Signals,
11153    ) -> Result<(), zx_status::Status> {
11154        use fidl::Peered;
11155        self.inner.channel().signal_peer(clear_mask, set_mask)
11156    }
11157}
11158
11159impl VmexResourceControlHandle {}
11160
11161#[must_use = "FIDL methods require a response to be sent"]
11162#[derive(Debug)]
11163pub struct VmexResourceGetResponder {
11164    control_handle: std::mem::ManuallyDrop<VmexResourceControlHandle>,
11165    tx_id: u32,
11166}
11167
11168/// Set the the channel to be shutdown (see [`VmexResourceControlHandle::shutdown`])
11169/// if the responder is dropped without sending a response, so that the client
11170/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11171impl std::ops::Drop for VmexResourceGetResponder {
11172    fn drop(&mut self) {
11173        self.control_handle.shutdown();
11174        // Safety: drops once, never accessed again
11175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11176    }
11177}
11178
11179impl fidl::endpoints::Responder for VmexResourceGetResponder {
11180    type ControlHandle = VmexResourceControlHandle;
11181
11182    fn control_handle(&self) -> &VmexResourceControlHandle {
11183        &self.control_handle
11184    }
11185
11186    fn drop_without_shutdown(mut self) {
11187        // Safety: drops once, never accessed again due to mem::forget
11188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11189        // Prevent Drop from running (which would shut down the channel)
11190        std::mem::forget(self);
11191    }
11192}
11193
11194impl VmexResourceGetResponder {
11195    /// Sends a response to the FIDL transaction.
11196    ///
11197    /// Sets the channel to shutdown if an error occurs.
11198    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11199        let _result = self.send_raw(resource);
11200        if _result.is_err() {
11201            self.control_handle.shutdown();
11202        }
11203        self.drop_without_shutdown();
11204        _result
11205    }
11206
11207    /// Similar to "send" but does not shutdown the channel if an error occurs.
11208    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11209        let _result = self.send_raw(resource);
11210        self.drop_without_shutdown();
11211        _result
11212    }
11213
11214    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11215        self.control_handle.inner.send::<VmexResourceGetResponse>(
11216            (resource,),
11217            self.tx_id,
11218            0x33db32deed650699,
11219            fidl::encoding::DynamicFlags::empty(),
11220        )
11221    }
11222}
11223
11224mod internal {
11225    use super::*;
11226
11227    impl fidl::encoding::ResourceTypeMarker for CounterGetInspectVmoResponse {
11228        type Borrowed<'a> = &'a mut Self;
11229        fn take_or_borrow<'a>(
11230            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11231        ) -> Self::Borrowed<'a> {
11232            value
11233        }
11234    }
11235
11236    unsafe impl fidl::encoding::TypeMarker for CounterGetInspectVmoResponse {
11237        type Owned = Self;
11238
11239        #[inline(always)]
11240        fn inline_align(_context: fidl::encoding::Context) -> usize {
11241            8
11242        }
11243
11244        #[inline(always)]
11245        fn inline_size(_context: fidl::encoding::Context) -> usize {
11246            24
11247        }
11248    }
11249
11250    unsafe impl
11251        fidl::encoding::Encode<
11252            CounterGetInspectVmoResponse,
11253            fidl::encoding::DefaultFuchsiaResourceDialect,
11254        > for &mut CounterGetInspectVmoResponse
11255    {
11256        #[inline]
11257        unsafe fn encode(
11258            self,
11259            encoder: &mut fidl::encoding::Encoder<
11260                '_,
11261                fidl::encoding::DefaultFuchsiaResourceDialect,
11262            >,
11263            offset: usize,
11264            _depth: fidl::encoding::Depth,
11265        ) -> fidl::Result<()> {
11266            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11267            // Delegate to tuple encoding.
11268            fidl::encoding::Encode::<CounterGetInspectVmoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11269                (
11270                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
11271                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
11272                ),
11273                encoder, offset, _depth
11274            )
11275        }
11276    }
11277    unsafe impl<
11278            T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11279            T1: fidl::encoding::Encode<
11280                fidl_fuchsia_mem::Buffer,
11281                fidl::encoding::DefaultFuchsiaResourceDialect,
11282            >,
11283        >
11284        fidl::encoding::Encode<
11285            CounterGetInspectVmoResponse,
11286            fidl::encoding::DefaultFuchsiaResourceDialect,
11287        > for (T0, T1)
11288    {
11289        #[inline]
11290        unsafe fn encode(
11291            self,
11292            encoder: &mut fidl::encoding::Encoder<
11293                '_,
11294                fidl::encoding::DefaultFuchsiaResourceDialect,
11295            >,
11296            offset: usize,
11297            depth: fidl::encoding::Depth,
11298        ) -> fidl::Result<()> {
11299            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11300            // Zero out padding regions. There's no need to apply masks
11301            // because the unmasked parts will be overwritten by fields.
11302            unsafe {
11303                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11304                (ptr as *mut u64).write_unaligned(0);
11305            }
11306            // Write the fields.
11307            self.0.encode(encoder, offset + 0, depth)?;
11308            self.1.encode(encoder, offset + 8, depth)?;
11309            Ok(())
11310        }
11311    }
11312
11313    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11314        for CounterGetInspectVmoResponse
11315    {
11316        #[inline(always)]
11317        fn new_empty() -> Self {
11318            Self {
11319                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
11320                buffer: fidl::new_empty!(
11321                    fidl_fuchsia_mem::Buffer,
11322                    fidl::encoding::DefaultFuchsiaResourceDialect
11323                ),
11324            }
11325        }
11326
11327        #[inline]
11328        unsafe fn decode(
11329            &mut self,
11330            decoder: &mut fidl::encoding::Decoder<
11331                '_,
11332                fidl::encoding::DefaultFuchsiaResourceDialect,
11333            >,
11334            offset: usize,
11335            _depth: fidl::encoding::Depth,
11336        ) -> fidl::Result<()> {
11337            decoder.debug_check_bounds::<Self>(offset);
11338            // Verify that padding bytes are zero.
11339            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11340            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11341            let mask = 0xffffffff00000000u64;
11342            let maskedval = padval & mask;
11343            if maskedval != 0 {
11344                return Err(fidl::Error::NonZeroPadding {
11345                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11346                });
11347            }
11348            fidl::decode!(
11349                i32,
11350                fidl::encoding::DefaultFuchsiaResourceDialect,
11351                &mut self.status,
11352                decoder,
11353                offset + 0,
11354                _depth
11355            )?;
11356            fidl::decode!(
11357                fidl_fuchsia_mem::Buffer,
11358                fidl::encoding::DefaultFuchsiaResourceDialect,
11359                &mut self.buffer,
11360                decoder,
11361                offset + 8,
11362                _depth
11363            )?;
11364            Ok(())
11365        }
11366    }
11367
11368    impl fidl::encoding::ResourceTypeMarker for CpuResourceGetResponse {
11369        type Borrowed<'a> = &'a mut Self;
11370        fn take_or_borrow<'a>(
11371            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11372        ) -> Self::Borrowed<'a> {
11373            value
11374        }
11375    }
11376
11377    unsafe impl fidl::encoding::TypeMarker for CpuResourceGetResponse {
11378        type Owned = Self;
11379
11380        #[inline(always)]
11381        fn inline_align(_context: fidl::encoding::Context) -> usize {
11382            4
11383        }
11384
11385        #[inline(always)]
11386        fn inline_size(_context: fidl::encoding::Context) -> usize {
11387            4
11388        }
11389    }
11390
11391    unsafe impl
11392        fidl::encoding::Encode<
11393            CpuResourceGetResponse,
11394            fidl::encoding::DefaultFuchsiaResourceDialect,
11395        > for &mut CpuResourceGetResponse
11396    {
11397        #[inline]
11398        unsafe fn encode(
11399            self,
11400            encoder: &mut fidl::encoding::Encoder<
11401                '_,
11402                fidl::encoding::DefaultFuchsiaResourceDialect,
11403            >,
11404            offset: usize,
11405            _depth: fidl::encoding::Depth,
11406        ) -> fidl::Result<()> {
11407            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11408            // Delegate to tuple encoding.
11409            fidl::encoding::Encode::<
11410                CpuResourceGetResponse,
11411                fidl::encoding::DefaultFuchsiaResourceDialect,
11412            >::encode(
11413                (<fidl::encoding::HandleType<
11414                    fidl::Resource,
11415                    { fidl::ObjectType::RESOURCE.into_raw() },
11416                    2147483648,
11417                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11418                    &mut self.resource
11419                ),),
11420                encoder,
11421                offset,
11422                _depth,
11423            )
11424        }
11425    }
11426    unsafe impl<
11427            T0: fidl::encoding::Encode<
11428                fidl::encoding::HandleType<
11429                    fidl::Resource,
11430                    { fidl::ObjectType::RESOURCE.into_raw() },
11431                    2147483648,
11432                >,
11433                fidl::encoding::DefaultFuchsiaResourceDialect,
11434            >,
11435        >
11436        fidl::encoding::Encode<
11437            CpuResourceGetResponse,
11438            fidl::encoding::DefaultFuchsiaResourceDialect,
11439        > for (T0,)
11440    {
11441        #[inline]
11442        unsafe fn encode(
11443            self,
11444            encoder: &mut fidl::encoding::Encoder<
11445                '_,
11446                fidl::encoding::DefaultFuchsiaResourceDialect,
11447            >,
11448            offset: usize,
11449            depth: fidl::encoding::Depth,
11450        ) -> fidl::Result<()> {
11451            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11452            // Zero out padding regions. There's no need to apply masks
11453            // because the unmasked parts will be overwritten by fields.
11454            // Write the fields.
11455            self.0.encode(encoder, offset + 0, depth)?;
11456            Ok(())
11457        }
11458    }
11459
11460    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11461        for CpuResourceGetResponse
11462    {
11463        #[inline(always)]
11464        fn new_empty() -> Self {
11465            Self {
11466                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11467            }
11468        }
11469
11470        #[inline]
11471        unsafe fn decode(
11472            &mut self,
11473            decoder: &mut fidl::encoding::Decoder<
11474                '_,
11475                fidl::encoding::DefaultFuchsiaResourceDialect,
11476            >,
11477            offset: usize,
11478            _depth: fidl::encoding::Depth,
11479        ) -> fidl::Result<()> {
11480            decoder.debug_check_bounds::<Self>(offset);
11481            // Verify that padding bytes are zero.
11482            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11483            Ok(())
11484        }
11485    }
11486
11487    impl fidl::encoding::ResourceTypeMarker for DebugResourceGetResponse {
11488        type Borrowed<'a> = &'a mut Self;
11489        fn take_or_borrow<'a>(
11490            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11491        ) -> Self::Borrowed<'a> {
11492            value
11493        }
11494    }
11495
11496    unsafe impl fidl::encoding::TypeMarker for DebugResourceGetResponse {
11497        type Owned = Self;
11498
11499        #[inline(always)]
11500        fn inline_align(_context: fidl::encoding::Context) -> usize {
11501            4
11502        }
11503
11504        #[inline(always)]
11505        fn inline_size(_context: fidl::encoding::Context) -> usize {
11506            4
11507        }
11508    }
11509
11510    unsafe impl
11511        fidl::encoding::Encode<
11512            DebugResourceGetResponse,
11513            fidl::encoding::DefaultFuchsiaResourceDialect,
11514        > for &mut DebugResourceGetResponse
11515    {
11516        #[inline]
11517        unsafe fn encode(
11518            self,
11519            encoder: &mut fidl::encoding::Encoder<
11520                '_,
11521                fidl::encoding::DefaultFuchsiaResourceDialect,
11522            >,
11523            offset: usize,
11524            _depth: fidl::encoding::Depth,
11525        ) -> fidl::Result<()> {
11526            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11527            // Delegate to tuple encoding.
11528            fidl::encoding::Encode::<
11529                DebugResourceGetResponse,
11530                fidl::encoding::DefaultFuchsiaResourceDialect,
11531            >::encode(
11532                (<fidl::encoding::HandleType<
11533                    fidl::Resource,
11534                    { fidl::ObjectType::RESOURCE.into_raw() },
11535                    2147483648,
11536                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11537                    &mut self.resource
11538                ),),
11539                encoder,
11540                offset,
11541                _depth,
11542            )
11543        }
11544    }
11545    unsafe impl<
11546            T0: fidl::encoding::Encode<
11547                fidl::encoding::HandleType<
11548                    fidl::Resource,
11549                    { fidl::ObjectType::RESOURCE.into_raw() },
11550                    2147483648,
11551                >,
11552                fidl::encoding::DefaultFuchsiaResourceDialect,
11553            >,
11554        >
11555        fidl::encoding::Encode<
11556            DebugResourceGetResponse,
11557            fidl::encoding::DefaultFuchsiaResourceDialect,
11558        > for (T0,)
11559    {
11560        #[inline]
11561        unsafe fn encode(
11562            self,
11563            encoder: &mut fidl::encoding::Encoder<
11564                '_,
11565                fidl::encoding::DefaultFuchsiaResourceDialect,
11566            >,
11567            offset: usize,
11568            depth: fidl::encoding::Depth,
11569        ) -> fidl::Result<()> {
11570            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11571            // Zero out padding regions. There's no need to apply masks
11572            // because the unmasked parts will be overwritten by fields.
11573            // Write the fields.
11574            self.0.encode(encoder, offset + 0, depth)?;
11575            Ok(())
11576        }
11577    }
11578
11579    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11580        for DebugResourceGetResponse
11581    {
11582        #[inline(always)]
11583        fn new_empty() -> Self {
11584            Self {
11585                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11586            }
11587        }
11588
11589        #[inline]
11590        unsafe fn decode(
11591            &mut self,
11592            decoder: &mut fidl::encoding::Decoder<
11593                '_,
11594                fidl::encoding::DefaultFuchsiaResourceDialect,
11595            >,
11596            offset: usize,
11597            _depth: fidl::encoding::Depth,
11598        ) -> fidl::Result<()> {
11599            decoder.debug_check_bounds::<Self>(offset);
11600            // Verify that padding bytes are zero.
11601            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11602            Ok(())
11603        }
11604    }
11605
11606    impl fidl::encoding::ResourceTypeMarker for DebuglogResourceGetResponse {
11607        type Borrowed<'a> = &'a mut Self;
11608        fn take_or_borrow<'a>(
11609            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11610        ) -> Self::Borrowed<'a> {
11611            value
11612        }
11613    }
11614
11615    unsafe impl fidl::encoding::TypeMarker for DebuglogResourceGetResponse {
11616        type Owned = Self;
11617
11618        #[inline(always)]
11619        fn inline_align(_context: fidl::encoding::Context) -> usize {
11620            4
11621        }
11622
11623        #[inline(always)]
11624        fn inline_size(_context: fidl::encoding::Context) -> usize {
11625            4
11626        }
11627    }
11628
11629    unsafe impl
11630        fidl::encoding::Encode<
11631            DebuglogResourceGetResponse,
11632            fidl::encoding::DefaultFuchsiaResourceDialect,
11633        > for &mut DebuglogResourceGetResponse
11634    {
11635        #[inline]
11636        unsafe fn encode(
11637            self,
11638            encoder: &mut fidl::encoding::Encoder<
11639                '_,
11640                fidl::encoding::DefaultFuchsiaResourceDialect,
11641            >,
11642            offset: usize,
11643            _depth: fidl::encoding::Depth,
11644        ) -> fidl::Result<()> {
11645            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
11646            // Delegate to tuple encoding.
11647            fidl::encoding::Encode::<
11648                DebuglogResourceGetResponse,
11649                fidl::encoding::DefaultFuchsiaResourceDialect,
11650            >::encode(
11651                (<fidl::encoding::HandleType<
11652                    fidl::Resource,
11653                    { fidl::ObjectType::RESOURCE.into_raw() },
11654                    2147483648,
11655                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11656                    &mut self.resource
11657                ),),
11658                encoder,
11659                offset,
11660                _depth,
11661            )
11662        }
11663    }
11664    unsafe impl<
11665            T0: fidl::encoding::Encode<
11666                fidl::encoding::HandleType<
11667                    fidl::Resource,
11668                    { fidl::ObjectType::RESOURCE.into_raw() },
11669                    2147483648,
11670                >,
11671                fidl::encoding::DefaultFuchsiaResourceDialect,
11672            >,
11673        >
11674        fidl::encoding::Encode<
11675            DebuglogResourceGetResponse,
11676            fidl::encoding::DefaultFuchsiaResourceDialect,
11677        > for (T0,)
11678    {
11679        #[inline]
11680        unsafe fn encode(
11681            self,
11682            encoder: &mut fidl::encoding::Encoder<
11683                '_,
11684                fidl::encoding::DefaultFuchsiaResourceDialect,
11685            >,
11686            offset: usize,
11687            depth: fidl::encoding::Depth,
11688        ) -> fidl::Result<()> {
11689            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
11690            // Zero out padding regions. There's no need to apply masks
11691            // because the unmasked parts will be overwritten by fields.
11692            // Write the fields.
11693            self.0.encode(encoder, offset + 0, depth)?;
11694            Ok(())
11695        }
11696    }
11697
11698    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11699        for DebuglogResourceGetResponse
11700    {
11701        #[inline(always)]
11702        fn new_empty() -> Self {
11703            Self {
11704                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11705            }
11706        }
11707
11708        #[inline]
11709        unsafe fn decode(
11710            &mut self,
11711            decoder: &mut fidl::encoding::Decoder<
11712                '_,
11713                fidl::encoding::DefaultFuchsiaResourceDialect,
11714            >,
11715            offset: usize,
11716            _depth: fidl::encoding::Depth,
11717        ) -> fidl::Result<()> {
11718            decoder.debug_check_bounds::<Self>(offset);
11719            // Verify that padding bytes are zero.
11720            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11721            Ok(())
11722        }
11723    }
11724
11725    impl fidl::encoding::ResourceTypeMarker for EnergyInfoResourceGetResponse {
11726        type Borrowed<'a> = &'a mut Self;
11727        fn take_or_borrow<'a>(
11728            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11729        ) -> Self::Borrowed<'a> {
11730            value
11731        }
11732    }
11733
11734    unsafe impl fidl::encoding::TypeMarker for EnergyInfoResourceGetResponse {
11735        type Owned = Self;
11736
11737        #[inline(always)]
11738        fn inline_align(_context: fidl::encoding::Context) -> usize {
11739            4
11740        }
11741
11742        #[inline(always)]
11743        fn inline_size(_context: fidl::encoding::Context) -> usize {
11744            4
11745        }
11746    }
11747
11748    unsafe impl
11749        fidl::encoding::Encode<
11750            EnergyInfoResourceGetResponse,
11751            fidl::encoding::DefaultFuchsiaResourceDialect,
11752        > for &mut EnergyInfoResourceGetResponse
11753    {
11754        #[inline]
11755        unsafe fn encode(
11756            self,
11757            encoder: &mut fidl::encoding::Encoder<
11758                '_,
11759                fidl::encoding::DefaultFuchsiaResourceDialect,
11760            >,
11761            offset: usize,
11762            _depth: fidl::encoding::Depth,
11763        ) -> fidl::Result<()> {
11764            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
11765            // Delegate to tuple encoding.
11766            fidl::encoding::Encode::<
11767                EnergyInfoResourceGetResponse,
11768                fidl::encoding::DefaultFuchsiaResourceDialect,
11769            >::encode(
11770                (<fidl::encoding::HandleType<
11771                    fidl::Resource,
11772                    { fidl::ObjectType::RESOURCE.into_raw() },
11773                    2147483648,
11774                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11775                    &mut self.resource
11776                ),),
11777                encoder,
11778                offset,
11779                _depth,
11780            )
11781        }
11782    }
11783    unsafe impl<
11784            T0: fidl::encoding::Encode<
11785                fidl::encoding::HandleType<
11786                    fidl::Resource,
11787                    { fidl::ObjectType::RESOURCE.into_raw() },
11788                    2147483648,
11789                >,
11790                fidl::encoding::DefaultFuchsiaResourceDialect,
11791            >,
11792        >
11793        fidl::encoding::Encode<
11794            EnergyInfoResourceGetResponse,
11795            fidl::encoding::DefaultFuchsiaResourceDialect,
11796        > for (T0,)
11797    {
11798        #[inline]
11799        unsafe fn encode(
11800            self,
11801            encoder: &mut fidl::encoding::Encoder<
11802                '_,
11803                fidl::encoding::DefaultFuchsiaResourceDialect,
11804            >,
11805            offset: usize,
11806            depth: fidl::encoding::Depth,
11807        ) -> fidl::Result<()> {
11808            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
11809            // Zero out padding regions. There's no need to apply masks
11810            // because the unmasked parts will be overwritten by fields.
11811            // Write the fields.
11812            self.0.encode(encoder, offset + 0, depth)?;
11813            Ok(())
11814        }
11815    }
11816
11817    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11818        for EnergyInfoResourceGetResponse
11819    {
11820        #[inline(always)]
11821        fn new_empty() -> Self {
11822            Self {
11823                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11824            }
11825        }
11826
11827        #[inline]
11828        unsafe fn decode(
11829            &mut self,
11830            decoder: &mut fidl::encoding::Decoder<
11831                '_,
11832                fidl::encoding::DefaultFuchsiaResourceDialect,
11833            >,
11834            offset: usize,
11835            _depth: fidl::encoding::Depth,
11836        ) -> fidl::Result<()> {
11837            decoder.debug_check_bounds::<Self>(offset);
11838            // Verify that padding bytes are zero.
11839            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11840            Ok(())
11841        }
11842    }
11843
11844    impl fidl::encoding::ResourceTypeMarker for HypervisorResourceGetResponse {
11845        type Borrowed<'a> = &'a mut Self;
11846        fn take_or_borrow<'a>(
11847            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11848        ) -> Self::Borrowed<'a> {
11849            value
11850        }
11851    }
11852
11853    unsafe impl fidl::encoding::TypeMarker for HypervisorResourceGetResponse {
11854        type Owned = Self;
11855
11856        #[inline(always)]
11857        fn inline_align(_context: fidl::encoding::Context) -> usize {
11858            4
11859        }
11860
11861        #[inline(always)]
11862        fn inline_size(_context: fidl::encoding::Context) -> usize {
11863            4
11864        }
11865    }
11866
11867    unsafe impl
11868        fidl::encoding::Encode<
11869            HypervisorResourceGetResponse,
11870            fidl::encoding::DefaultFuchsiaResourceDialect,
11871        > for &mut HypervisorResourceGetResponse
11872    {
11873        #[inline]
11874        unsafe fn encode(
11875            self,
11876            encoder: &mut fidl::encoding::Encoder<
11877                '_,
11878                fidl::encoding::DefaultFuchsiaResourceDialect,
11879            >,
11880            offset: usize,
11881            _depth: fidl::encoding::Depth,
11882        ) -> fidl::Result<()> {
11883            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
11884            // Delegate to tuple encoding.
11885            fidl::encoding::Encode::<
11886                HypervisorResourceGetResponse,
11887                fidl::encoding::DefaultFuchsiaResourceDialect,
11888            >::encode(
11889                (<fidl::encoding::HandleType<
11890                    fidl::Resource,
11891                    { fidl::ObjectType::RESOURCE.into_raw() },
11892                    2147483648,
11893                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11894                    &mut self.resource
11895                ),),
11896                encoder,
11897                offset,
11898                _depth,
11899            )
11900        }
11901    }
11902    unsafe impl<
11903            T0: fidl::encoding::Encode<
11904                fidl::encoding::HandleType<
11905                    fidl::Resource,
11906                    { fidl::ObjectType::RESOURCE.into_raw() },
11907                    2147483648,
11908                >,
11909                fidl::encoding::DefaultFuchsiaResourceDialect,
11910            >,
11911        >
11912        fidl::encoding::Encode<
11913            HypervisorResourceGetResponse,
11914            fidl::encoding::DefaultFuchsiaResourceDialect,
11915        > for (T0,)
11916    {
11917        #[inline]
11918        unsafe fn encode(
11919            self,
11920            encoder: &mut fidl::encoding::Encoder<
11921                '_,
11922                fidl::encoding::DefaultFuchsiaResourceDialect,
11923            >,
11924            offset: usize,
11925            depth: fidl::encoding::Depth,
11926        ) -> fidl::Result<()> {
11927            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
11928            // Zero out padding regions. There's no need to apply masks
11929            // because the unmasked parts will be overwritten by fields.
11930            // Write the fields.
11931            self.0.encode(encoder, offset + 0, depth)?;
11932            Ok(())
11933        }
11934    }
11935
11936    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11937        for HypervisorResourceGetResponse
11938    {
11939        #[inline(always)]
11940        fn new_empty() -> Self {
11941            Self {
11942                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11943            }
11944        }
11945
11946        #[inline]
11947        unsafe fn decode(
11948            &mut self,
11949            decoder: &mut fidl::encoding::Decoder<
11950                '_,
11951                fidl::encoding::DefaultFuchsiaResourceDialect,
11952            >,
11953            offset: usize,
11954            _depth: fidl::encoding::Depth,
11955        ) -> fidl::Result<()> {
11956            decoder.debug_check_bounds::<Self>(offset);
11957            // Verify that padding bytes are zero.
11958            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11959            Ok(())
11960        }
11961    }
11962
11963    impl fidl::encoding::ResourceTypeMarker for InfoResourceGetResponse {
11964        type Borrowed<'a> = &'a mut Self;
11965        fn take_or_borrow<'a>(
11966            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11967        ) -> Self::Borrowed<'a> {
11968            value
11969        }
11970    }
11971
11972    unsafe impl fidl::encoding::TypeMarker for InfoResourceGetResponse {
11973        type Owned = Self;
11974
11975        #[inline(always)]
11976        fn inline_align(_context: fidl::encoding::Context) -> usize {
11977            4
11978        }
11979
11980        #[inline(always)]
11981        fn inline_size(_context: fidl::encoding::Context) -> usize {
11982            4
11983        }
11984    }
11985
11986    unsafe impl
11987        fidl::encoding::Encode<
11988            InfoResourceGetResponse,
11989            fidl::encoding::DefaultFuchsiaResourceDialect,
11990        > for &mut InfoResourceGetResponse
11991    {
11992        #[inline]
11993        unsafe fn encode(
11994            self,
11995            encoder: &mut fidl::encoding::Encoder<
11996                '_,
11997                fidl::encoding::DefaultFuchsiaResourceDialect,
11998            >,
11999            offset: usize,
12000            _depth: fidl::encoding::Depth,
12001        ) -> fidl::Result<()> {
12002            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12003            // Delegate to tuple encoding.
12004            fidl::encoding::Encode::<
12005                InfoResourceGetResponse,
12006                fidl::encoding::DefaultFuchsiaResourceDialect,
12007            >::encode(
12008                (<fidl::encoding::HandleType<
12009                    fidl::Resource,
12010                    { fidl::ObjectType::RESOURCE.into_raw() },
12011                    2147483648,
12012                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12013                    &mut self.resource
12014                ),),
12015                encoder,
12016                offset,
12017                _depth,
12018            )
12019        }
12020    }
12021    unsafe impl<
12022            T0: fidl::encoding::Encode<
12023                fidl::encoding::HandleType<
12024                    fidl::Resource,
12025                    { fidl::ObjectType::RESOURCE.into_raw() },
12026                    2147483648,
12027                >,
12028                fidl::encoding::DefaultFuchsiaResourceDialect,
12029            >,
12030        >
12031        fidl::encoding::Encode<
12032            InfoResourceGetResponse,
12033            fidl::encoding::DefaultFuchsiaResourceDialect,
12034        > for (T0,)
12035    {
12036        #[inline]
12037        unsafe fn encode(
12038            self,
12039            encoder: &mut fidl::encoding::Encoder<
12040                '_,
12041                fidl::encoding::DefaultFuchsiaResourceDialect,
12042            >,
12043            offset: usize,
12044            depth: fidl::encoding::Depth,
12045        ) -> fidl::Result<()> {
12046            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12047            // Zero out padding regions. There's no need to apply masks
12048            // because the unmasked parts will be overwritten by fields.
12049            // Write the fields.
12050            self.0.encode(encoder, offset + 0, depth)?;
12051            Ok(())
12052        }
12053    }
12054
12055    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12056        for InfoResourceGetResponse
12057    {
12058        #[inline(always)]
12059        fn new_empty() -> Self {
12060            Self {
12061                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12062            }
12063        }
12064
12065        #[inline]
12066        unsafe fn decode(
12067            &mut self,
12068            decoder: &mut fidl::encoding::Decoder<
12069                '_,
12070                fidl::encoding::DefaultFuchsiaResourceDialect,
12071            >,
12072            offset: usize,
12073            _depth: fidl::encoding::Depth,
12074        ) -> fidl::Result<()> {
12075            decoder.debug_check_bounds::<Self>(offset);
12076            // Verify that padding bytes are zero.
12077            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12078            Ok(())
12079        }
12080    }
12081
12082    impl fidl::encoding::ResourceTypeMarker for IommuResourceGetResponse {
12083        type Borrowed<'a> = &'a mut Self;
12084        fn take_or_borrow<'a>(
12085            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12086        ) -> Self::Borrowed<'a> {
12087            value
12088        }
12089    }
12090
12091    unsafe impl fidl::encoding::TypeMarker for IommuResourceGetResponse {
12092        type Owned = Self;
12093
12094        #[inline(always)]
12095        fn inline_align(_context: fidl::encoding::Context) -> usize {
12096            4
12097        }
12098
12099        #[inline(always)]
12100        fn inline_size(_context: fidl::encoding::Context) -> usize {
12101            4
12102        }
12103    }
12104
12105    unsafe impl
12106        fidl::encoding::Encode<
12107            IommuResourceGetResponse,
12108            fidl::encoding::DefaultFuchsiaResourceDialect,
12109        > for &mut IommuResourceGetResponse
12110    {
12111        #[inline]
12112        unsafe fn encode(
12113            self,
12114            encoder: &mut fidl::encoding::Encoder<
12115                '_,
12116                fidl::encoding::DefaultFuchsiaResourceDialect,
12117            >,
12118            offset: usize,
12119            _depth: fidl::encoding::Depth,
12120        ) -> fidl::Result<()> {
12121            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12122            // Delegate to tuple encoding.
12123            fidl::encoding::Encode::<
12124                IommuResourceGetResponse,
12125                fidl::encoding::DefaultFuchsiaResourceDialect,
12126            >::encode(
12127                (<fidl::encoding::HandleType<
12128                    fidl::Resource,
12129                    { fidl::ObjectType::RESOURCE.into_raw() },
12130                    2147483648,
12131                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12132                    &mut self.resource
12133                ),),
12134                encoder,
12135                offset,
12136                _depth,
12137            )
12138        }
12139    }
12140    unsafe impl<
12141            T0: fidl::encoding::Encode<
12142                fidl::encoding::HandleType<
12143                    fidl::Resource,
12144                    { fidl::ObjectType::RESOURCE.into_raw() },
12145                    2147483648,
12146                >,
12147                fidl::encoding::DefaultFuchsiaResourceDialect,
12148            >,
12149        >
12150        fidl::encoding::Encode<
12151            IommuResourceGetResponse,
12152            fidl::encoding::DefaultFuchsiaResourceDialect,
12153        > for (T0,)
12154    {
12155        #[inline]
12156        unsafe fn encode(
12157            self,
12158            encoder: &mut fidl::encoding::Encoder<
12159                '_,
12160                fidl::encoding::DefaultFuchsiaResourceDialect,
12161            >,
12162            offset: usize,
12163            depth: fidl::encoding::Depth,
12164        ) -> fidl::Result<()> {
12165            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12166            // Zero out padding regions. There's no need to apply masks
12167            // because the unmasked parts will be overwritten by fields.
12168            // Write the fields.
12169            self.0.encode(encoder, offset + 0, depth)?;
12170            Ok(())
12171        }
12172    }
12173
12174    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12175        for IommuResourceGetResponse
12176    {
12177        #[inline(always)]
12178        fn new_empty() -> Self {
12179            Self {
12180                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12181            }
12182        }
12183
12184        #[inline]
12185        unsafe fn decode(
12186            &mut self,
12187            decoder: &mut fidl::encoding::Decoder<
12188                '_,
12189                fidl::encoding::DefaultFuchsiaResourceDialect,
12190            >,
12191            offset: usize,
12192            _depth: fidl::encoding::Depth,
12193        ) -> fidl::Result<()> {
12194            decoder.debug_check_bounds::<Self>(offset);
12195            // Verify that padding bytes are zero.
12196            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12197            Ok(())
12198        }
12199    }
12200
12201    impl fidl::encoding::ResourceTypeMarker for IoportResourceGetResponse {
12202        type Borrowed<'a> = &'a mut Self;
12203        fn take_or_borrow<'a>(
12204            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12205        ) -> Self::Borrowed<'a> {
12206            value
12207        }
12208    }
12209
12210    unsafe impl fidl::encoding::TypeMarker for IoportResourceGetResponse {
12211        type Owned = Self;
12212
12213        #[inline(always)]
12214        fn inline_align(_context: fidl::encoding::Context) -> usize {
12215            4
12216        }
12217
12218        #[inline(always)]
12219        fn inline_size(_context: fidl::encoding::Context) -> usize {
12220            4
12221        }
12222    }
12223
12224    unsafe impl
12225        fidl::encoding::Encode<
12226            IoportResourceGetResponse,
12227            fidl::encoding::DefaultFuchsiaResourceDialect,
12228        > for &mut IoportResourceGetResponse
12229    {
12230        #[inline]
12231        unsafe fn encode(
12232            self,
12233            encoder: &mut fidl::encoding::Encoder<
12234                '_,
12235                fidl::encoding::DefaultFuchsiaResourceDialect,
12236            >,
12237            offset: usize,
12238            _depth: fidl::encoding::Depth,
12239        ) -> fidl::Result<()> {
12240            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12241            // Delegate to tuple encoding.
12242            fidl::encoding::Encode::<
12243                IoportResourceGetResponse,
12244                fidl::encoding::DefaultFuchsiaResourceDialect,
12245            >::encode(
12246                (<fidl::encoding::HandleType<
12247                    fidl::Resource,
12248                    { fidl::ObjectType::RESOURCE.into_raw() },
12249                    2147483648,
12250                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12251                    &mut self.resource
12252                ),),
12253                encoder,
12254                offset,
12255                _depth,
12256            )
12257        }
12258    }
12259    unsafe impl<
12260            T0: fidl::encoding::Encode<
12261                fidl::encoding::HandleType<
12262                    fidl::Resource,
12263                    { fidl::ObjectType::RESOURCE.into_raw() },
12264                    2147483648,
12265                >,
12266                fidl::encoding::DefaultFuchsiaResourceDialect,
12267            >,
12268        >
12269        fidl::encoding::Encode<
12270            IoportResourceGetResponse,
12271            fidl::encoding::DefaultFuchsiaResourceDialect,
12272        > for (T0,)
12273    {
12274        #[inline]
12275        unsafe fn encode(
12276            self,
12277            encoder: &mut fidl::encoding::Encoder<
12278                '_,
12279                fidl::encoding::DefaultFuchsiaResourceDialect,
12280            >,
12281            offset: usize,
12282            depth: fidl::encoding::Depth,
12283        ) -> fidl::Result<()> {
12284            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12285            // Zero out padding regions. There's no need to apply masks
12286            // because the unmasked parts will be overwritten by fields.
12287            // Write the fields.
12288            self.0.encode(encoder, offset + 0, depth)?;
12289            Ok(())
12290        }
12291    }
12292
12293    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12294        for IoportResourceGetResponse
12295    {
12296        #[inline(always)]
12297        fn new_empty() -> Self {
12298            Self {
12299                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12300            }
12301        }
12302
12303        #[inline]
12304        unsafe fn decode(
12305            &mut self,
12306            decoder: &mut fidl::encoding::Decoder<
12307                '_,
12308                fidl::encoding::DefaultFuchsiaResourceDialect,
12309            >,
12310            offset: usize,
12311            _depth: fidl::encoding::Depth,
12312        ) -> fidl::Result<()> {
12313            decoder.debug_check_bounds::<Self>(offset);
12314            // Verify that padding bytes are zero.
12315            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12316            Ok(())
12317        }
12318    }
12319
12320    impl fidl::encoding::ResourceTypeMarker for IrqResourceGetResponse {
12321        type Borrowed<'a> = &'a mut Self;
12322        fn take_or_borrow<'a>(
12323            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12324        ) -> Self::Borrowed<'a> {
12325            value
12326        }
12327    }
12328
12329    unsafe impl fidl::encoding::TypeMarker for IrqResourceGetResponse {
12330        type Owned = Self;
12331
12332        #[inline(always)]
12333        fn inline_align(_context: fidl::encoding::Context) -> usize {
12334            4
12335        }
12336
12337        #[inline(always)]
12338        fn inline_size(_context: fidl::encoding::Context) -> usize {
12339            4
12340        }
12341    }
12342
12343    unsafe impl
12344        fidl::encoding::Encode<
12345            IrqResourceGetResponse,
12346            fidl::encoding::DefaultFuchsiaResourceDialect,
12347        > for &mut IrqResourceGetResponse
12348    {
12349        #[inline]
12350        unsafe fn encode(
12351            self,
12352            encoder: &mut fidl::encoding::Encoder<
12353                '_,
12354                fidl::encoding::DefaultFuchsiaResourceDialect,
12355            >,
12356            offset: usize,
12357            _depth: fidl::encoding::Depth,
12358        ) -> fidl::Result<()> {
12359            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12360            // Delegate to tuple encoding.
12361            fidl::encoding::Encode::<
12362                IrqResourceGetResponse,
12363                fidl::encoding::DefaultFuchsiaResourceDialect,
12364            >::encode(
12365                (<fidl::encoding::HandleType<
12366                    fidl::Resource,
12367                    { fidl::ObjectType::RESOURCE.into_raw() },
12368                    2147483648,
12369                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12370                    &mut self.resource
12371                ),),
12372                encoder,
12373                offset,
12374                _depth,
12375            )
12376        }
12377    }
12378    unsafe impl<
12379            T0: fidl::encoding::Encode<
12380                fidl::encoding::HandleType<
12381                    fidl::Resource,
12382                    { fidl::ObjectType::RESOURCE.into_raw() },
12383                    2147483648,
12384                >,
12385                fidl::encoding::DefaultFuchsiaResourceDialect,
12386            >,
12387        >
12388        fidl::encoding::Encode<
12389            IrqResourceGetResponse,
12390            fidl::encoding::DefaultFuchsiaResourceDialect,
12391        > for (T0,)
12392    {
12393        #[inline]
12394        unsafe fn encode(
12395            self,
12396            encoder: &mut fidl::encoding::Encoder<
12397                '_,
12398                fidl::encoding::DefaultFuchsiaResourceDialect,
12399            >,
12400            offset: usize,
12401            depth: fidl::encoding::Depth,
12402        ) -> fidl::Result<()> {
12403            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12404            // Zero out padding regions. There's no need to apply masks
12405            // because the unmasked parts will be overwritten by fields.
12406            // Write the fields.
12407            self.0.encode(encoder, offset + 0, depth)?;
12408            Ok(())
12409        }
12410    }
12411
12412    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12413        for IrqResourceGetResponse
12414    {
12415        #[inline(always)]
12416        fn new_empty() -> Self {
12417            Self {
12418                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12419            }
12420        }
12421
12422        #[inline]
12423        unsafe fn decode(
12424            &mut self,
12425            decoder: &mut fidl::encoding::Decoder<
12426                '_,
12427                fidl::encoding::DefaultFuchsiaResourceDialect,
12428            >,
12429            offset: usize,
12430            _depth: fidl::encoding::Depth,
12431        ) -> fidl::Result<()> {
12432            decoder.debug_check_bounds::<Self>(offset);
12433            // Verify that padding bytes are zero.
12434            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12435            Ok(())
12436        }
12437    }
12438
12439    impl fidl::encoding::ResourceTypeMarker for MexecResourceGetResponse {
12440        type Borrowed<'a> = &'a mut Self;
12441        fn take_or_borrow<'a>(
12442            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12443        ) -> Self::Borrowed<'a> {
12444            value
12445        }
12446    }
12447
12448    unsafe impl fidl::encoding::TypeMarker for MexecResourceGetResponse {
12449        type Owned = Self;
12450
12451        #[inline(always)]
12452        fn inline_align(_context: fidl::encoding::Context) -> usize {
12453            4
12454        }
12455
12456        #[inline(always)]
12457        fn inline_size(_context: fidl::encoding::Context) -> usize {
12458            4
12459        }
12460    }
12461
12462    unsafe impl
12463        fidl::encoding::Encode<
12464            MexecResourceGetResponse,
12465            fidl::encoding::DefaultFuchsiaResourceDialect,
12466        > for &mut MexecResourceGetResponse
12467    {
12468        #[inline]
12469        unsafe fn encode(
12470            self,
12471            encoder: &mut fidl::encoding::Encoder<
12472                '_,
12473                fidl::encoding::DefaultFuchsiaResourceDialect,
12474            >,
12475            offset: usize,
12476            _depth: fidl::encoding::Depth,
12477        ) -> fidl::Result<()> {
12478            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12479            // Delegate to tuple encoding.
12480            fidl::encoding::Encode::<
12481                MexecResourceGetResponse,
12482                fidl::encoding::DefaultFuchsiaResourceDialect,
12483            >::encode(
12484                (<fidl::encoding::HandleType<
12485                    fidl::Resource,
12486                    { fidl::ObjectType::RESOURCE.into_raw() },
12487                    2147483648,
12488                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12489                    &mut self.resource
12490                ),),
12491                encoder,
12492                offset,
12493                _depth,
12494            )
12495        }
12496    }
12497    unsafe impl<
12498            T0: fidl::encoding::Encode<
12499                fidl::encoding::HandleType<
12500                    fidl::Resource,
12501                    { fidl::ObjectType::RESOURCE.into_raw() },
12502                    2147483648,
12503                >,
12504                fidl::encoding::DefaultFuchsiaResourceDialect,
12505            >,
12506        >
12507        fidl::encoding::Encode<
12508            MexecResourceGetResponse,
12509            fidl::encoding::DefaultFuchsiaResourceDialect,
12510        > for (T0,)
12511    {
12512        #[inline]
12513        unsafe fn encode(
12514            self,
12515            encoder: &mut fidl::encoding::Encoder<
12516                '_,
12517                fidl::encoding::DefaultFuchsiaResourceDialect,
12518            >,
12519            offset: usize,
12520            depth: fidl::encoding::Depth,
12521        ) -> fidl::Result<()> {
12522            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12523            // Zero out padding regions. There's no need to apply masks
12524            // because the unmasked parts will be overwritten by fields.
12525            // Write the fields.
12526            self.0.encode(encoder, offset + 0, depth)?;
12527            Ok(())
12528        }
12529    }
12530
12531    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12532        for MexecResourceGetResponse
12533    {
12534        #[inline(always)]
12535        fn new_empty() -> Self {
12536            Self {
12537                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12538            }
12539        }
12540
12541        #[inline]
12542        unsafe fn decode(
12543            &mut self,
12544            decoder: &mut fidl::encoding::Decoder<
12545                '_,
12546                fidl::encoding::DefaultFuchsiaResourceDialect,
12547            >,
12548            offset: usize,
12549            _depth: fidl::encoding::Depth,
12550        ) -> fidl::Result<()> {
12551            decoder.debug_check_bounds::<Self>(offset);
12552            // Verify that padding bytes are zero.
12553            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12554            Ok(())
12555        }
12556    }
12557
12558    impl fidl::encoding::ResourceTypeMarker for MmioResourceGetResponse {
12559        type Borrowed<'a> = &'a mut Self;
12560        fn take_or_borrow<'a>(
12561            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12562        ) -> Self::Borrowed<'a> {
12563            value
12564        }
12565    }
12566
12567    unsafe impl fidl::encoding::TypeMarker for MmioResourceGetResponse {
12568        type Owned = Self;
12569
12570        #[inline(always)]
12571        fn inline_align(_context: fidl::encoding::Context) -> usize {
12572            4
12573        }
12574
12575        #[inline(always)]
12576        fn inline_size(_context: fidl::encoding::Context) -> usize {
12577            4
12578        }
12579    }
12580
12581    unsafe impl
12582        fidl::encoding::Encode<
12583            MmioResourceGetResponse,
12584            fidl::encoding::DefaultFuchsiaResourceDialect,
12585        > for &mut MmioResourceGetResponse
12586    {
12587        #[inline]
12588        unsafe fn encode(
12589            self,
12590            encoder: &mut fidl::encoding::Encoder<
12591                '_,
12592                fidl::encoding::DefaultFuchsiaResourceDialect,
12593            >,
12594            offset: usize,
12595            _depth: fidl::encoding::Depth,
12596        ) -> fidl::Result<()> {
12597            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12598            // Delegate to tuple encoding.
12599            fidl::encoding::Encode::<
12600                MmioResourceGetResponse,
12601                fidl::encoding::DefaultFuchsiaResourceDialect,
12602            >::encode(
12603                (<fidl::encoding::HandleType<
12604                    fidl::Resource,
12605                    { fidl::ObjectType::RESOURCE.into_raw() },
12606                    2147483648,
12607                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12608                    &mut self.resource
12609                ),),
12610                encoder,
12611                offset,
12612                _depth,
12613            )
12614        }
12615    }
12616    unsafe impl<
12617            T0: fidl::encoding::Encode<
12618                fidl::encoding::HandleType<
12619                    fidl::Resource,
12620                    { fidl::ObjectType::RESOURCE.into_raw() },
12621                    2147483648,
12622                >,
12623                fidl::encoding::DefaultFuchsiaResourceDialect,
12624            >,
12625        >
12626        fidl::encoding::Encode<
12627            MmioResourceGetResponse,
12628            fidl::encoding::DefaultFuchsiaResourceDialect,
12629        > for (T0,)
12630    {
12631        #[inline]
12632        unsafe fn encode(
12633            self,
12634            encoder: &mut fidl::encoding::Encoder<
12635                '_,
12636                fidl::encoding::DefaultFuchsiaResourceDialect,
12637            >,
12638            offset: usize,
12639            depth: fidl::encoding::Depth,
12640        ) -> fidl::Result<()> {
12641            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12642            // Zero out padding regions. There's no need to apply masks
12643            // because the unmasked parts will be overwritten by fields.
12644            // Write the fields.
12645            self.0.encode(encoder, offset + 0, depth)?;
12646            Ok(())
12647        }
12648    }
12649
12650    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12651        for MmioResourceGetResponse
12652    {
12653        #[inline(always)]
12654        fn new_empty() -> Self {
12655            Self {
12656                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12657            }
12658        }
12659
12660        #[inline]
12661        unsafe fn decode(
12662            &mut self,
12663            decoder: &mut fidl::encoding::Decoder<
12664                '_,
12665                fidl::encoding::DefaultFuchsiaResourceDialect,
12666            >,
12667            offset: usize,
12668            _depth: fidl::encoding::Depth,
12669        ) -> fidl::Result<()> {
12670            decoder.debug_check_bounds::<Self>(offset);
12671            // Verify that padding bytes are zero.
12672            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12673            Ok(())
12674        }
12675    }
12676
12677    impl fidl::encoding::ResourceTypeMarker for MsiResourceGetResponse {
12678        type Borrowed<'a> = &'a mut Self;
12679        fn take_or_borrow<'a>(
12680            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12681        ) -> Self::Borrowed<'a> {
12682            value
12683        }
12684    }
12685
12686    unsafe impl fidl::encoding::TypeMarker for MsiResourceGetResponse {
12687        type Owned = Self;
12688
12689        #[inline(always)]
12690        fn inline_align(_context: fidl::encoding::Context) -> usize {
12691            4
12692        }
12693
12694        #[inline(always)]
12695        fn inline_size(_context: fidl::encoding::Context) -> usize {
12696            4
12697        }
12698    }
12699
12700    unsafe impl
12701        fidl::encoding::Encode<
12702            MsiResourceGetResponse,
12703            fidl::encoding::DefaultFuchsiaResourceDialect,
12704        > for &mut MsiResourceGetResponse
12705    {
12706        #[inline]
12707        unsafe fn encode(
12708            self,
12709            encoder: &mut fidl::encoding::Encoder<
12710                '_,
12711                fidl::encoding::DefaultFuchsiaResourceDialect,
12712            >,
12713            offset: usize,
12714            _depth: fidl::encoding::Depth,
12715        ) -> fidl::Result<()> {
12716            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
12717            // Delegate to tuple encoding.
12718            fidl::encoding::Encode::<
12719                MsiResourceGetResponse,
12720                fidl::encoding::DefaultFuchsiaResourceDialect,
12721            >::encode(
12722                (<fidl::encoding::HandleType<
12723                    fidl::Resource,
12724                    { fidl::ObjectType::RESOURCE.into_raw() },
12725                    2147483648,
12726                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12727                    &mut self.resource
12728                ),),
12729                encoder,
12730                offset,
12731                _depth,
12732            )
12733        }
12734    }
12735    unsafe impl<
12736            T0: fidl::encoding::Encode<
12737                fidl::encoding::HandleType<
12738                    fidl::Resource,
12739                    { fidl::ObjectType::RESOURCE.into_raw() },
12740                    2147483648,
12741                >,
12742                fidl::encoding::DefaultFuchsiaResourceDialect,
12743            >,
12744        >
12745        fidl::encoding::Encode<
12746            MsiResourceGetResponse,
12747            fidl::encoding::DefaultFuchsiaResourceDialect,
12748        > for (T0,)
12749    {
12750        #[inline]
12751        unsafe fn encode(
12752            self,
12753            encoder: &mut fidl::encoding::Encoder<
12754                '_,
12755                fidl::encoding::DefaultFuchsiaResourceDialect,
12756            >,
12757            offset: usize,
12758            depth: fidl::encoding::Depth,
12759        ) -> fidl::Result<()> {
12760            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
12761            // Zero out padding regions. There's no need to apply masks
12762            // because the unmasked parts will be overwritten by fields.
12763            // Write the fields.
12764            self.0.encode(encoder, offset + 0, depth)?;
12765            Ok(())
12766        }
12767    }
12768
12769    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12770        for MsiResourceGetResponse
12771    {
12772        #[inline(always)]
12773        fn new_empty() -> Self {
12774            Self {
12775                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12776            }
12777        }
12778
12779        #[inline]
12780        unsafe fn decode(
12781            &mut self,
12782            decoder: &mut fidl::encoding::Decoder<
12783                '_,
12784                fidl::encoding::DefaultFuchsiaResourceDialect,
12785            >,
12786            offset: usize,
12787            _depth: fidl::encoding::Depth,
12788        ) -> fidl::Result<()> {
12789            decoder.debug_check_bounds::<Self>(offset);
12790            // Verify that padding bytes are zero.
12791            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12792            Ok(())
12793        }
12794    }
12795
12796    impl fidl::encoding::ResourceTypeMarker for PowerResourceGetResponse {
12797        type Borrowed<'a> = &'a mut Self;
12798        fn take_or_borrow<'a>(
12799            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12800        ) -> Self::Borrowed<'a> {
12801            value
12802        }
12803    }
12804
12805    unsafe impl fidl::encoding::TypeMarker for PowerResourceGetResponse {
12806        type Owned = Self;
12807
12808        #[inline(always)]
12809        fn inline_align(_context: fidl::encoding::Context) -> usize {
12810            4
12811        }
12812
12813        #[inline(always)]
12814        fn inline_size(_context: fidl::encoding::Context) -> usize {
12815            4
12816        }
12817    }
12818
12819    unsafe impl
12820        fidl::encoding::Encode<
12821            PowerResourceGetResponse,
12822            fidl::encoding::DefaultFuchsiaResourceDialect,
12823        > for &mut PowerResourceGetResponse
12824    {
12825        #[inline]
12826        unsafe fn encode(
12827            self,
12828            encoder: &mut fidl::encoding::Encoder<
12829                '_,
12830                fidl::encoding::DefaultFuchsiaResourceDialect,
12831            >,
12832            offset: usize,
12833            _depth: fidl::encoding::Depth,
12834        ) -> fidl::Result<()> {
12835            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
12836            // Delegate to tuple encoding.
12837            fidl::encoding::Encode::<
12838                PowerResourceGetResponse,
12839                fidl::encoding::DefaultFuchsiaResourceDialect,
12840            >::encode(
12841                (<fidl::encoding::HandleType<
12842                    fidl::Resource,
12843                    { fidl::ObjectType::RESOURCE.into_raw() },
12844                    2147483648,
12845                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12846                    &mut self.resource
12847                ),),
12848                encoder,
12849                offset,
12850                _depth,
12851            )
12852        }
12853    }
12854    unsafe impl<
12855            T0: fidl::encoding::Encode<
12856                fidl::encoding::HandleType<
12857                    fidl::Resource,
12858                    { fidl::ObjectType::RESOURCE.into_raw() },
12859                    2147483648,
12860                >,
12861                fidl::encoding::DefaultFuchsiaResourceDialect,
12862            >,
12863        >
12864        fidl::encoding::Encode<
12865            PowerResourceGetResponse,
12866            fidl::encoding::DefaultFuchsiaResourceDialect,
12867        > for (T0,)
12868    {
12869        #[inline]
12870        unsafe fn encode(
12871            self,
12872            encoder: &mut fidl::encoding::Encoder<
12873                '_,
12874                fidl::encoding::DefaultFuchsiaResourceDialect,
12875            >,
12876            offset: usize,
12877            depth: fidl::encoding::Depth,
12878        ) -> fidl::Result<()> {
12879            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
12880            // Zero out padding regions. There's no need to apply masks
12881            // because the unmasked parts will be overwritten by fields.
12882            // Write the fields.
12883            self.0.encode(encoder, offset + 0, depth)?;
12884            Ok(())
12885        }
12886    }
12887
12888    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12889        for PowerResourceGetResponse
12890    {
12891        #[inline(always)]
12892        fn new_empty() -> Self {
12893            Self {
12894                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12895            }
12896        }
12897
12898        #[inline]
12899        unsafe fn decode(
12900            &mut self,
12901            decoder: &mut fidl::encoding::Decoder<
12902                '_,
12903                fidl::encoding::DefaultFuchsiaResourceDialect,
12904            >,
12905            offset: usize,
12906            _depth: fidl::encoding::Depth,
12907        ) -> fidl::Result<()> {
12908            decoder.debug_check_bounds::<Self>(offset);
12909            // Verify that padding bytes are zero.
12910            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12911            Ok(())
12912        }
12913    }
12914
12915    impl fidl::encoding::ResourceTypeMarker for ProfileResourceGetResponse {
12916        type Borrowed<'a> = &'a mut Self;
12917        fn take_or_borrow<'a>(
12918            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12919        ) -> Self::Borrowed<'a> {
12920            value
12921        }
12922    }
12923
12924    unsafe impl fidl::encoding::TypeMarker for ProfileResourceGetResponse {
12925        type Owned = Self;
12926
12927        #[inline(always)]
12928        fn inline_align(_context: fidl::encoding::Context) -> usize {
12929            4
12930        }
12931
12932        #[inline(always)]
12933        fn inline_size(_context: fidl::encoding::Context) -> usize {
12934            4
12935        }
12936    }
12937
12938    unsafe impl
12939        fidl::encoding::Encode<
12940            ProfileResourceGetResponse,
12941            fidl::encoding::DefaultFuchsiaResourceDialect,
12942        > for &mut ProfileResourceGetResponse
12943    {
12944        #[inline]
12945        unsafe fn encode(
12946            self,
12947            encoder: &mut fidl::encoding::Encoder<
12948                '_,
12949                fidl::encoding::DefaultFuchsiaResourceDialect,
12950            >,
12951            offset: usize,
12952            _depth: fidl::encoding::Depth,
12953        ) -> fidl::Result<()> {
12954            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
12955            // Delegate to tuple encoding.
12956            fidl::encoding::Encode::<
12957                ProfileResourceGetResponse,
12958                fidl::encoding::DefaultFuchsiaResourceDialect,
12959            >::encode(
12960                (<fidl::encoding::HandleType<
12961                    fidl::Resource,
12962                    { fidl::ObjectType::RESOURCE.into_raw() },
12963                    2147483648,
12964                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12965                    &mut self.resource
12966                ),),
12967                encoder,
12968                offset,
12969                _depth,
12970            )
12971        }
12972    }
12973    unsafe impl<
12974            T0: fidl::encoding::Encode<
12975                fidl::encoding::HandleType<
12976                    fidl::Resource,
12977                    { fidl::ObjectType::RESOURCE.into_raw() },
12978                    2147483648,
12979                >,
12980                fidl::encoding::DefaultFuchsiaResourceDialect,
12981            >,
12982        >
12983        fidl::encoding::Encode<
12984            ProfileResourceGetResponse,
12985            fidl::encoding::DefaultFuchsiaResourceDialect,
12986        > for (T0,)
12987    {
12988        #[inline]
12989        unsafe fn encode(
12990            self,
12991            encoder: &mut fidl::encoding::Encoder<
12992                '_,
12993                fidl::encoding::DefaultFuchsiaResourceDialect,
12994            >,
12995            offset: usize,
12996            depth: fidl::encoding::Depth,
12997        ) -> fidl::Result<()> {
12998            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
12999            // Zero out padding regions. There's no need to apply masks
13000            // because the unmasked parts will be overwritten by fields.
13001            // Write the fields.
13002            self.0.encode(encoder, offset + 0, depth)?;
13003            Ok(())
13004        }
13005    }
13006
13007    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13008        for ProfileResourceGetResponse
13009    {
13010        #[inline(always)]
13011        fn new_empty() -> Self {
13012            Self {
13013                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13014            }
13015        }
13016
13017        #[inline]
13018        unsafe fn decode(
13019            &mut self,
13020            decoder: &mut fidl::encoding::Decoder<
13021                '_,
13022                fidl::encoding::DefaultFuchsiaResourceDialect,
13023            >,
13024            offset: usize,
13025            _depth: fidl::encoding::Depth,
13026        ) -> fidl::Result<()> {
13027            decoder.debug_check_bounds::<Self>(offset);
13028            // Verify that padding bytes are zero.
13029            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13030            Ok(())
13031        }
13032    }
13033
13034    impl fidl::encoding::ResourceTypeMarker for RootJobGetResponse {
13035        type Borrowed<'a> = &'a mut Self;
13036        fn take_or_borrow<'a>(
13037            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13038        ) -> Self::Borrowed<'a> {
13039            value
13040        }
13041    }
13042
13043    unsafe impl fidl::encoding::TypeMarker for RootJobGetResponse {
13044        type Owned = Self;
13045
13046        #[inline(always)]
13047        fn inline_align(_context: fidl::encoding::Context) -> usize {
13048            4
13049        }
13050
13051        #[inline(always)]
13052        fn inline_size(_context: fidl::encoding::Context) -> usize {
13053            4
13054        }
13055    }
13056
13057    unsafe impl
13058        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13059        for &mut RootJobGetResponse
13060    {
13061        #[inline]
13062        unsafe fn encode(
13063            self,
13064            encoder: &mut fidl::encoding::Encoder<
13065                '_,
13066                fidl::encoding::DefaultFuchsiaResourceDialect,
13067            >,
13068            offset: usize,
13069            _depth: fidl::encoding::Depth,
13070        ) -> fidl::Result<()> {
13071            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13072            // Delegate to tuple encoding.
13073            fidl::encoding::Encode::<
13074                RootJobGetResponse,
13075                fidl::encoding::DefaultFuchsiaResourceDialect,
13076            >::encode(
13077                (<fidl::encoding::HandleType<
13078                    fidl::Job,
13079                    { fidl::ObjectType::JOB.into_raw() },
13080                    2147483648,
13081                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13082                    &mut self.job
13083                ),),
13084                encoder,
13085                offset,
13086                _depth,
13087            )
13088        }
13089    }
13090    unsafe impl<
13091            T0: fidl::encoding::Encode<
13092                fidl::encoding::HandleType<
13093                    fidl::Job,
13094                    { fidl::ObjectType::JOB.into_raw() },
13095                    2147483648,
13096                >,
13097                fidl::encoding::DefaultFuchsiaResourceDialect,
13098            >,
13099        >
13100        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13101        for (T0,)
13102    {
13103        #[inline]
13104        unsafe fn encode(
13105            self,
13106            encoder: &mut fidl::encoding::Encoder<
13107                '_,
13108                fidl::encoding::DefaultFuchsiaResourceDialect,
13109            >,
13110            offset: usize,
13111            depth: fidl::encoding::Depth,
13112        ) -> fidl::Result<()> {
13113            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13114            // Zero out padding regions. There's no need to apply masks
13115            // because the unmasked parts will be overwritten by fields.
13116            // Write the fields.
13117            self.0.encode(encoder, offset + 0, depth)?;
13118            Ok(())
13119        }
13120    }
13121
13122    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13123        for RootJobGetResponse
13124    {
13125        #[inline(always)]
13126        fn new_empty() -> Self {
13127            Self {
13128                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13129            }
13130        }
13131
13132        #[inline]
13133        unsafe fn decode(
13134            &mut self,
13135            decoder: &mut fidl::encoding::Decoder<
13136                '_,
13137                fidl::encoding::DefaultFuchsiaResourceDialect,
13138            >,
13139            offset: usize,
13140            _depth: fidl::encoding::Depth,
13141        ) -> fidl::Result<()> {
13142            decoder.debug_check_bounds::<Self>(offset);
13143            // Verify that padding bytes are zero.
13144            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
13145            Ok(())
13146        }
13147    }
13148
13149    impl fidl::encoding::ResourceTypeMarker for SmcResourceGetResponse {
13150        type Borrowed<'a> = &'a mut Self;
13151        fn take_or_borrow<'a>(
13152            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13153        ) -> Self::Borrowed<'a> {
13154            value
13155        }
13156    }
13157
13158    unsafe impl fidl::encoding::TypeMarker for SmcResourceGetResponse {
13159        type Owned = Self;
13160
13161        #[inline(always)]
13162        fn inline_align(_context: fidl::encoding::Context) -> usize {
13163            4
13164        }
13165
13166        #[inline(always)]
13167        fn inline_size(_context: fidl::encoding::Context) -> usize {
13168            4
13169        }
13170    }
13171
13172    unsafe impl
13173        fidl::encoding::Encode<
13174            SmcResourceGetResponse,
13175            fidl::encoding::DefaultFuchsiaResourceDialect,
13176        > for &mut SmcResourceGetResponse
13177    {
13178        #[inline]
13179        unsafe fn encode(
13180            self,
13181            encoder: &mut fidl::encoding::Encoder<
13182                '_,
13183                fidl::encoding::DefaultFuchsiaResourceDialect,
13184            >,
13185            offset: usize,
13186            _depth: fidl::encoding::Depth,
13187        ) -> fidl::Result<()> {
13188            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13189            // Delegate to tuple encoding.
13190            fidl::encoding::Encode::<
13191                SmcResourceGetResponse,
13192                fidl::encoding::DefaultFuchsiaResourceDialect,
13193            >::encode(
13194                (<fidl::encoding::HandleType<
13195                    fidl::Resource,
13196                    { fidl::ObjectType::RESOURCE.into_raw() },
13197                    2147483648,
13198                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13199                    &mut self.resource
13200                ),),
13201                encoder,
13202                offset,
13203                _depth,
13204            )
13205        }
13206    }
13207    unsafe impl<
13208            T0: fidl::encoding::Encode<
13209                fidl::encoding::HandleType<
13210                    fidl::Resource,
13211                    { fidl::ObjectType::RESOURCE.into_raw() },
13212                    2147483648,
13213                >,
13214                fidl::encoding::DefaultFuchsiaResourceDialect,
13215            >,
13216        >
13217        fidl::encoding::Encode<
13218            SmcResourceGetResponse,
13219            fidl::encoding::DefaultFuchsiaResourceDialect,
13220        > for (T0,)
13221    {
13222        #[inline]
13223        unsafe fn encode(
13224            self,
13225            encoder: &mut fidl::encoding::Encoder<
13226                '_,
13227                fidl::encoding::DefaultFuchsiaResourceDialect,
13228            >,
13229            offset: usize,
13230            depth: fidl::encoding::Depth,
13231        ) -> fidl::Result<()> {
13232            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13233            // Zero out padding regions. There's no need to apply masks
13234            // because the unmasked parts will be overwritten by fields.
13235            // Write the fields.
13236            self.0.encode(encoder, offset + 0, depth)?;
13237            Ok(())
13238        }
13239    }
13240
13241    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13242        for SmcResourceGetResponse
13243    {
13244        #[inline(always)]
13245        fn new_empty() -> Self {
13246            Self {
13247                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13248            }
13249        }
13250
13251        #[inline]
13252        unsafe fn decode(
13253            &mut self,
13254            decoder: &mut fidl::encoding::Decoder<
13255                '_,
13256                fidl::encoding::DefaultFuchsiaResourceDialect,
13257            >,
13258            offset: usize,
13259            _depth: fidl::encoding::Depth,
13260        ) -> fidl::Result<()> {
13261            decoder.debug_check_bounds::<Self>(offset);
13262            // Verify that padding bytes are zero.
13263            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13264            Ok(())
13265        }
13266    }
13267
13268    impl fidl::encoding::ResourceTypeMarker for StallResourceGetResponse {
13269        type Borrowed<'a> = &'a mut Self;
13270        fn take_or_borrow<'a>(
13271            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13272        ) -> Self::Borrowed<'a> {
13273            value
13274        }
13275    }
13276
13277    unsafe impl fidl::encoding::TypeMarker for StallResourceGetResponse {
13278        type Owned = Self;
13279
13280        #[inline(always)]
13281        fn inline_align(_context: fidl::encoding::Context) -> usize {
13282            4
13283        }
13284
13285        #[inline(always)]
13286        fn inline_size(_context: fidl::encoding::Context) -> usize {
13287            4
13288        }
13289    }
13290
13291    unsafe impl
13292        fidl::encoding::Encode<
13293            StallResourceGetResponse,
13294            fidl::encoding::DefaultFuchsiaResourceDialect,
13295        > for &mut StallResourceGetResponse
13296    {
13297        #[inline]
13298        unsafe fn encode(
13299            self,
13300            encoder: &mut fidl::encoding::Encoder<
13301                '_,
13302                fidl::encoding::DefaultFuchsiaResourceDialect,
13303            >,
13304            offset: usize,
13305            _depth: fidl::encoding::Depth,
13306        ) -> fidl::Result<()> {
13307            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13308            // Delegate to tuple encoding.
13309            fidl::encoding::Encode::<
13310                StallResourceGetResponse,
13311                fidl::encoding::DefaultFuchsiaResourceDialect,
13312            >::encode(
13313                (<fidl::encoding::HandleType<
13314                    fidl::Resource,
13315                    { fidl::ObjectType::RESOURCE.into_raw() },
13316                    2147483648,
13317                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13318                    &mut self.resource
13319                ),),
13320                encoder,
13321                offset,
13322                _depth,
13323            )
13324        }
13325    }
13326    unsafe impl<
13327            T0: fidl::encoding::Encode<
13328                fidl::encoding::HandleType<
13329                    fidl::Resource,
13330                    { fidl::ObjectType::RESOURCE.into_raw() },
13331                    2147483648,
13332                >,
13333                fidl::encoding::DefaultFuchsiaResourceDialect,
13334            >,
13335        >
13336        fidl::encoding::Encode<
13337            StallResourceGetResponse,
13338            fidl::encoding::DefaultFuchsiaResourceDialect,
13339        > for (T0,)
13340    {
13341        #[inline]
13342        unsafe fn encode(
13343            self,
13344            encoder: &mut fidl::encoding::Encoder<
13345                '_,
13346                fidl::encoding::DefaultFuchsiaResourceDialect,
13347            >,
13348            offset: usize,
13349            depth: fidl::encoding::Depth,
13350        ) -> fidl::Result<()> {
13351            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13352            // Zero out padding regions. There's no need to apply masks
13353            // because the unmasked parts will be overwritten by fields.
13354            // Write the fields.
13355            self.0.encode(encoder, offset + 0, depth)?;
13356            Ok(())
13357        }
13358    }
13359
13360    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13361        for StallResourceGetResponse
13362    {
13363        #[inline(always)]
13364        fn new_empty() -> Self {
13365            Self {
13366                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13367            }
13368        }
13369
13370        #[inline]
13371        unsafe fn decode(
13372            &mut self,
13373            decoder: &mut fidl::encoding::Decoder<
13374                '_,
13375                fidl::encoding::DefaultFuchsiaResourceDialect,
13376            >,
13377            offset: usize,
13378            _depth: fidl::encoding::Depth,
13379        ) -> fidl::Result<()> {
13380            decoder.debug_check_bounds::<Self>(offset);
13381            // Verify that padding bytes are zero.
13382            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13383            Ok(())
13384        }
13385    }
13386
13387    impl fidl::encoding::ResourceTypeMarker for TracingResourceGetResponse {
13388        type Borrowed<'a> = &'a mut Self;
13389        fn take_or_borrow<'a>(
13390            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13391        ) -> Self::Borrowed<'a> {
13392            value
13393        }
13394    }
13395
13396    unsafe impl fidl::encoding::TypeMarker for TracingResourceGetResponse {
13397        type Owned = Self;
13398
13399        #[inline(always)]
13400        fn inline_align(_context: fidl::encoding::Context) -> usize {
13401            4
13402        }
13403
13404        #[inline(always)]
13405        fn inline_size(_context: fidl::encoding::Context) -> usize {
13406            4
13407        }
13408    }
13409
13410    unsafe impl
13411        fidl::encoding::Encode<
13412            TracingResourceGetResponse,
13413            fidl::encoding::DefaultFuchsiaResourceDialect,
13414        > for &mut TracingResourceGetResponse
13415    {
13416        #[inline]
13417        unsafe fn encode(
13418            self,
13419            encoder: &mut fidl::encoding::Encoder<
13420                '_,
13421                fidl::encoding::DefaultFuchsiaResourceDialect,
13422            >,
13423            offset: usize,
13424            _depth: fidl::encoding::Depth,
13425        ) -> fidl::Result<()> {
13426            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13427            // Delegate to tuple encoding.
13428            fidl::encoding::Encode::<
13429                TracingResourceGetResponse,
13430                fidl::encoding::DefaultFuchsiaResourceDialect,
13431            >::encode(
13432                (<fidl::encoding::HandleType<
13433                    fidl::Resource,
13434                    { fidl::ObjectType::RESOURCE.into_raw() },
13435                    2147483648,
13436                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13437                    &mut self.resource
13438                ),),
13439                encoder,
13440                offset,
13441                _depth,
13442            )
13443        }
13444    }
13445    unsafe impl<
13446            T0: fidl::encoding::Encode<
13447                fidl::encoding::HandleType<
13448                    fidl::Resource,
13449                    { fidl::ObjectType::RESOURCE.into_raw() },
13450                    2147483648,
13451                >,
13452                fidl::encoding::DefaultFuchsiaResourceDialect,
13453            >,
13454        >
13455        fidl::encoding::Encode<
13456            TracingResourceGetResponse,
13457            fidl::encoding::DefaultFuchsiaResourceDialect,
13458        > for (T0,)
13459    {
13460        #[inline]
13461        unsafe fn encode(
13462            self,
13463            encoder: &mut fidl::encoding::Encoder<
13464                '_,
13465                fidl::encoding::DefaultFuchsiaResourceDialect,
13466            >,
13467            offset: usize,
13468            depth: fidl::encoding::Depth,
13469        ) -> fidl::Result<()> {
13470            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13471            // Zero out padding regions. There's no need to apply masks
13472            // because the unmasked parts will be overwritten by fields.
13473            // Write the fields.
13474            self.0.encode(encoder, offset + 0, depth)?;
13475            Ok(())
13476        }
13477    }
13478
13479    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13480        for TracingResourceGetResponse
13481    {
13482        #[inline(always)]
13483        fn new_empty() -> Self {
13484            Self {
13485                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13486            }
13487        }
13488
13489        #[inline]
13490        unsafe fn decode(
13491            &mut self,
13492            decoder: &mut fidl::encoding::Decoder<
13493                '_,
13494                fidl::encoding::DefaultFuchsiaResourceDialect,
13495            >,
13496            offset: usize,
13497            _depth: fidl::encoding::Depth,
13498        ) -> fidl::Result<()> {
13499            decoder.debug_check_bounds::<Self>(offset);
13500            // Verify that padding bytes are zero.
13501            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13502            Ok(())
13503        }
13504    }
13505
13506    impl fidl::encoding::ResourceTypeMarker for VmexResourceGetResponse {
13507        type Borrowed<'a> = &'a mut Self;
13508        fn take_or_borrow<'a>(
13509            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13510        ) -> Self::Borrowed<'a> {
13511            value
13512        }
13513    }
13514
13515    unsafe impl fidl::encoding::TypeMarker for VmexResourceGetResponse {
13516        type Owned = Self;
13517
13518        #[inline(always)]
13519        fn inline_align(_context: fidl::encoding::Context) -> usize {
13520            4
13521        }
13522
13523        #[inline(always)]
13524        fn inline_size(_context: fidl::encoding::Context) -> usize {
13525            4
13526        }
13527    }
13528
13529    unsafe impl
13530        fidl::encoding::Encode<
13531            VmexResourceGetResponse,
13532            fidl::encoding::DefaultFuchsiaResourceDialect,
13533        > for &mut VmexResourceGetResponse
13534    {
13535        #[inline]
13536        unsafe fn encode(
13537            self,
13538            encoder: &mut fidl::encoding::Encoder<
13539                '_,
13540                fidl::encoding::DefaultFuchsiaResourceDialect,
13541            >,
13542            offset: usize,
13543            _depth: fidl::encoding::Depth,
13544        ) -> fidl::Result<()> {
13545            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
13546            // Delegate to tuple encoding.
13547            fidl::encoding::Encode::<
13548                VmexResourceGetResponse,
13549                fidl::encoding::DefaultFuchsiaResourceDialect,
13550            >::encode(
13551                (<fidl::encoding::HandleType<
13552                    fidl::Resource,
13553                    { fidl::ObjectType::RESOURCE.into_raw() },
13554                    2147483648,
13555                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13556                    &mut self.resource
13557                ),),
13558                encoder,
13559                offset,
13560                _depth,
13561            )
13562        }
13563    }
13564    unsafe impl<
13565            T0: fidl::encoding::Encode<
13566                fidl::encoding::HandleType<
13567                    fidl::Resource,
13568                    { fidl::ObjectType::RESOURCE.into_raw() },
13569                    2147483648,
13570                >,
13571                fidl::encoding::DefaultFuchsiaResourceDialect,
13572            >,
13573        >
13574        fidl::encoding::Encode<
13575            VmexResourceGetResponse,
13576            fidl::encoding::DefaultFuchsiaResourceDialect,
13577        > for (T0,)
13578    {
13579        #[inline]
13580        unsafe fn encode(
13581            self,
13582            encoder: &mut fidl::encoding::Encoder<
13583                '_,
13584                fidl::encoding::DefaultFuchsiaResourceDialect,
13585            >,
13586            offset: usize,
13587            depth: fidl::encoding::Depth,
13588        ) -> fidl::Result<()> {
13589            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
13590            // Zero out padding regions. There's no need to apply masks
13591            // because the unmasked parts will be overwritten by fields.
13592            // Write the fields.
13593            self.0.encode(encoder, offset + 0, depth)?;
13594            Ok(())
13595        }
13596    }
13597
13598    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13599        for VmexResourceGetResponse
13600    {
13601        #[inline(always)]
13602        fn new_empty() -> Self {
13603            Self {
13604                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13605            }
13606        }
13607
13608        #[inline]
13609        unsafe fn decode(
13610            &mut self,
13611            decoder: &mut fidl::encoding::Decoder<
13612                '_,
13613                fidl::encoding::DefaultFuchsiaResourceDialect,
13614            >,
13615            offset: usize,
13616            _depth: fidl::encoding::Depth,
13617        ) -> fidl::Result<()> {
13618            decoder.debug_check_bounds::<Self>(offset);
13619            // Verify that padding bytes are zero.
13620            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13621            Ok(())
13622        }
13623    }
13624}