Skip to main content

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 SamplingResourceGetResponse {
144    pub resource: fidl::Resource,
145}
146
147impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
148    for SamplingResourceGetResponse
149{
150}
151
152#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
153pub struct SmcResourceGetResponse {
154    pub resource: fidl::Resource,
155}
156
157impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SmcResourceGetResponse {}
158
159#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
160pub struct StallResourceGetResponse {
161    pub resource: fidl::Resource,
162}
163
164impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StallResourceGetResponse {}
165
166#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
167pub struct TracingResourceGetResponse {
168    pub resource: fidl::Resource,
169}
170
171impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
172    for TracingResourceGetResponse
173{
174}
175
176#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
177pub struct VmexResourceGetResponse {
178    pub resource: fidl::Resource,
179}
180
181impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VmexResourceGetResponse {}
182
183#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
184pub struct CounterMarker;
185
186impl fidl::endpoints::ProtocolMarker for CounterMarker {
187    type Proxy = CounterProxy;
188    type RequestStream = CounterRequestStream;
189    #[cfg(target_os = "fuchsia")]
190    type SynchronousProxy = CounterSynchronousProxy;
191
192    const DEBUG_NAME: &'static str = "fuchsia.kernel.Counter";
193}
194impl fidl::endpoints::DiscoverableProtocolMarker for CounterMarker {}
195
196pub trait CounterProxyInterface: Send + Sync {
197    type GetInspectVmoResponseFut: std::future::Future<Output = Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error>>
198        + Send;
199    fn r#get_inspect_vmo(&self) -> Self::GetInspectVmoResponseFut;
200    type UpdateInspectVmoResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
201    fn r#update_inspect_vmo(&self) -> Self::UpdateInspectVmoResponseFut;
202}
203#[derive(Debug)]
204#[cfg(target_os = "fuchsia")]
205pub struct CounterSynchronousProxy {
206    client: fidl::client::sync::Client,
207}
208
209#[cfg(target_os = "fuchsia")]
210impl fidl::endpoints::SynchronousProxy for CounterSynchronousProxy {
211    type Proxy = CounterProxy;
212    type Protocol = CounterMarker;
213
214    fn from_channel(inner: fidl::Channel) -> Self {
215        Self::new(inner)
216    }
217
218    fn into_channel(self) -> fidl::Channel {
219        self.client.into_channel()
220    }
221
222    fn as_channel(&self) -> &fidl::Channel {
223        self.client.as_channel()
224    }
225}
226
227#[cfg(target_os = "fuchsia")]
228impl CounterSynchronousProxy {
229    pub fn new(channel: fidl::Channel) -> Self {
230        Self { client: fidl::client::sync::Client::new(channel) }
231    }
232
233    pub fn into_channel(self) -> fidl::Channel {
234        self.client.into_channel()
235    }
236
237    /// Waits until an event arrives and returns it. It is safe for other
238    /// threads to make concurrent requests while waiting for an event.
239    pub fn wait_for_event(
240        &self,
241        deadline: zx::MonotonicInstant,
242    ) -> Result<CounterEvent, fidl::Error> {
243        CounterEvent::decode(self.client.wait_for_event::<CounterMarker>(deadline)?)
244    }
245
246    /// Retrives a VMO containining summarized kcounter data. The vmo returned
247    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
248    pub fn r#get_inspect_vmo(
249        &self,
250        ___deadline: zx::MonotonicInstant,
251    ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
252        let _response = self.client.send_query::<
253            fidl::encoding::EmptyPayload,
254            CounterGetInspectVmoResponse,
255            CounterMarker,
256        >(
257            (),
258            0x6ea9b2e6b2791b81,
259            fidl::encoding::DynamicFlags::empty(),
260            ___deadline,
261        )?;
262        Ok((_response.status, _response.buffer))
263    }
264
265    /// Request that the previously-returned VMO buffer's data be updated. The
266    /// data may not be updated if it was already recently updated (updates are
267    /// limited to an unspecified rate, but approximately every few seconds).
268    pub fn r#update_inspect_vmo(
269        &self,
270        ___deadline: zx::MonotonicInstant,
271    ) -> Result<i32, fidl::Error> {
272        let _response = self.client.send_query::<
273            fidl::encoding::EmptyPayload,
274            CounterUpdateInspectVmoResponse,
275            CounterMarker,
276        >(
277            (),
278            0x1d25eb7995a0539f,
279            fidl::encoding::DynamicFlags::empty(),
280            ___deadline,
281        )?;
282        Ok(_response.status)
283    }
284}
285
286#[cfg(target_os = "fuchsia")]
287impl From<CounterSynchronousProxy> for zx::NullableHandle {
288    fn from(value: CounterSynchronousProxy) -> Self {
289        value.into_channel().into()
290    }
291}
292
293#[cfg(target_os = "fuchsia")]
294impl From<fidl::Channel> for CounterSynchronousProxy {
295    fn from(value: fidl::Channel) -> Self {
296        Self::new(value)
297    }
298}
299
300#[cfg(target_os = "fuchsia")]
301impl fidl::endpoints::FromClient for CounterSynchronousProxy {
302    type Protocol = CounterMarker;
303
304    fn from_client(value: fidl::endpoints::ClientEnd<CounterMarker>) -> Self {
305        Self::new(value.into_channel())
306    }
307}
308
309#[derive(Debug, Clone)]
310pub struct CounterProxy {
311    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
312}
313
314impl fidl::endpoints::Proxy for CounterProxy {
315    type Protocol = CounterMarker;
316
317    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
318        Self::new(inner)
319    }
320
321    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
322        self.client.into_channel().map_err(|client| Self { client })
323    }
324
325    fn as_channel(&self) -> &::fidl::AsyncChannel {
326        self.client.as_channel()
327    }
328}
329
330impl CounterProxy {
331    /// Create a new Proxy for fuchsia.kernel/Counter.
332    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
333        let protocol_name = <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
334        Self { client: fidl::client::Client::new(channel, protocol_name) }
335    }
336
337    /// Get a Stream of events from the remote end of the protocol.
338    ///
339    /// # Panics
340    ///
341    /// Panics if the event stream was already taken.
342    pub fn take_event_stream(&self) -> CounterEventStream {
343        CounterEventStream { event_receiver: self.client.take_event_receiver() }
344    }
345
346    /// Retrives a VMO containining summarized kcounter data. The vmo returned
347    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
348    pub fn r#get_inspect_vmo(
349        &self,
350    ) -> fidl::client::QueryResponseFut<
351        (i32, fidl_fuchsia_mem::Buffer),
352        fidl::encoding::DefaultFuchsiaResourceDialect,
353    > {
354        CounterProxyInterface::r#get_inspect_vmo(self)
355    }
356
357    /// Request that the previously-returned VMO buffer's data be updated. The
358    /// data may not be updated if it was already recently updated (updates are
359    /// limited to an unspecified rate, but approximately every few seconds).
360    pub fn r#update_inspect_vmo(
361        &self,
362    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
363        CounterProxyInterface::r#update_inspect_vmo(self)
364    }
365}
366
367impl CounterProxyInterface for CounterProxy {
368    type GetInspectVmoResponseFut = fidl::client::QueryResponseFut<
369        (i32, fidl_fuchsia_mem::Buffer),
370        fidl::encoding::DefaultFuchsiaResourceDialect,
371    >;
372    fn r#get_inspect_vmo(&self) -> Self::GetInspectVmoResponseFut {
373        fn _decode(
374            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
375        ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
376            let _response = fidl::client::decode_transaction_body::<
377                CounterGetInspectVmoResponse,
378                fidl::encoding::DefaultFuchsiaResourceDialect,
379                0x6ea9b2e6b2791b81,
380            >(_buf?)?;
381            Ok((_response.status, _response.buffer))
382        }
383        self.client
384            .send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, fidl_fuchsia_mem::Buffer)>(
385                (),
386                0x6ea9b2e6b2791b81,
387                fidl::encoding::DynamicFlags::empty(),
388                _decode,
389            )
390    }
391
392    type UpdateInspectVmoResponseFut =
393        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
394    fn r#update_inspect_vmo(&self) -> Self::UpdateInspectVmoResponseFut {
395        fn _decode(
396            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
397        ) -> Result<i32, fidl::Error> {
398            let _response = fidl::client::decode_transaction_body::<
399                CounterUpdateInspectVmoResponse,
400                fidl::encoding::DefaultFuchsiaResourceDialect,
401                0x1d25eb7995a0539f,
402            >(_buf?)?;
403            Ok(_response.status)
404        }
405        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
406            (),
407            0x1d25eb7995a0539f,
408            fidl::encoding::DynamicFlags::empty(),
409            _decode,
410        )
411    }
412}
413
414pub struct CounterEventStream {
415    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
416}
417
418impl std::marker::Unpin for CounterEventStream {}
419
420impl futures::stream::FusedStream for CounterEventStream {
421    fn is_terminated(&self) -> bool {
422        self.event_receiver.is_terminated()
423    }
424}
425
426impl futures::Stream for CounterEventStream {
427    type Item = Result<CounterEvent, fidl::Error>;
428
429    fn poll_next(
430        mut self: std::pin::Pin<&mut Self>,
431        cx: &mut std::task::Context<'_>,
432    ) -> std::task::Poll<Option<Self::Item>> {
433        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
434            &mut self.event_receiver,
435            cx
436        )?) {
437            Some(buf) => std::task::Poll::Ready(Some(CounterEvent::decode(buf))),
438            None => std::task::Poll::Ready(None),
439        }
440    }
441}
442
443#[derive(Debug)]
444pub enum CounterEvent {}
445
446impl CounterEvent {
447    /// Decodes a message buffer as a [`CounterEvent`].
448    fn decode(
449        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
450    ) -> Result<CounterEvent, fidl::Error> {
451        let (bytes, _handles) = buf.split_mut();
452        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
453        debug_assert_eq!(tx_header.tx_id, 0);
454        match tx_header.ordinal {
455            _ => Err(fidl::Error::UnknownOrdinal {
456                ordinal: tx_header.ordinal,
457                protocol_name: <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
458            }),
459        }
460    }
461}
462
463/// A Stream of incoming requests for fuchsia.kernel/Counter.
464pub struct CounterRequestStream {
465    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
466    is_terminated: bool,
467}
468
469impl std::marker::Unpin for CounterRequestStream {}
470
471impl futures::stream::FusedStream for CounterRequestStream {
472    fn is_terminated(&self) -> bool {
473        self.is_terminated
474    }
475}
476
477impl fidl::endpoints::RequestStream for CounterRequestStream {
478    type Protocol = CounterMarker;
479    type ControlHandle = CounterControlHandle;
480
481    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
482        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
483    }
484
485    fn control_handle(&self) -> Self::ControlHandle {
486        CounterControlHandle { inner: self.inner.clone() }
487    }
488
489    fn into_inner(
490        self,
491    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
492    {
493        (self.inner, self.is_terminated)
494    }
495
496    fn from_inner(
497        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
498        is_terminated: bool,
499    ) -> Self {
500        Self { inner, is_terminated }
501    }
502}
503
504impl futures::Stream for CounterRequestStream {
505    type Item = Result<CounterRequest, fidl::Error>;
506
507    fn poll_next(
508        mut self: std::pin::Pin<&mut Self>,
509        cx: &mut std::task::Context<'_>,
510    ) -> std::task::Poll<Option<Self::Item>> {
511        let this = &mut *self;
512        if this.inner.check_shutdown(cx) {
513            this.is_terminated = true;
514            return std::task::Poll::Ready(None);
515        }
516        if this.is_terminated {
517            panic!("polled CounterRequestStream after completion");
518        }
519        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
520            |bytes, handles| {
521                match this.inner.channel().read_etc(cx, bytes, handles) {
522                    std::task::Poll::Ready(Ok(())) => {}
523                    std::task::Poll::Pending => return std::task::Poll::Pending,
524                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
525                        this.is_terminated = true;
526                        return std::task::Poll::Ready(None);
527                    }
528                    std::task::Poll::Ready(Err(e)) => {
529                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
530                            e.into(),
531                        ))));
532                    }
533                }
534
535                // A message has been received from the channel
536                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
537
538                std::task::Poll::Ready(Some(match header.ordinal {
539                    0x6ea9b2e6b2791b81 => {
540                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
541                        let mut req = fidl::new_empty!(
542                            fidl::encoding::EmptyPayload,
543                            fidl::encoding::DefaultFuchsiaResourceDialect
544                        );
545                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
546                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
547                        Ok(CounterRequest::GetInspectVmo {
548                            responder: CounterGetInspectVmoResponder {
549                                control_handle: std::mem::ManuallyDrop::new(control_handle),
550                                tx_id: header.tx_id,
551                            },
552                        })
553                    }
554                    0x1d25eb7995a0539f => {
555                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
556                        let mut req = fidl::new_empty!(
557                            fidl::encoding::EmptyPayload,
558                            fidl::encoding::DefaultFuchsiaResourceDialect
559                        );
560                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
561                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
562                        Ok(CounterRequest::UpdateInspectVmo {
563                            responder: CounterUpdateInspectVmoResponder {
564                                control_handle: std::mem::ManuallyDrop::new(control_handle),
565                                tx_id: header.tx_id,
566                            },
567                        })
568                    }
569                    _ => Err(fidl::Error::UnknownOrdinal {
570                        ordinal: header.ordinal,
571                        protocol_name:
572                            <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
573                    }),
574                }))
575            },
576        )
577    }
578}
579
580/// Protocol for retrieving kcounter information.
581#[derive(Debug)]
582pub enum CounterRequest {
583    /// Retrives a VMO containining summarized kcounter data. The vmo returned
584    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
585    GetInspectVmo { responder: CounterGetInspectVmoResponder },
586    /// Request that the previously-returned VMO buffer's data be updated. The
587    /// data may not be updated if it was already recently updated (updates are
588    /// limited to an unspecified rate, but approximately every few seconds).
589    UpdateInspectVmo { responder: CounterUpdateInspectVmoResponder },
590}
591
592impl CounterRequest {
593    #[allow(irrefutable_let_patterns)]
594    pub fn into_get_inspect_vmo(self) -> Option<(CounterGetInspectVmoResponder)> {
595        if let CounterRequest::GetInspectVmo { responder } = self {
596            Some((responder))
597        } else {
598            None
599        }
600    }
601
602    #[allow(irrefutable_let_patterns)]
603    pub fn into_update_inspect_vmo(self) -> Option<(CounterUpdateInspectVmoResponder)> {
604        if let CounterRequest::UpdateInspectVmo { responder } = self {
605            Some((responder))
606        } else {
607            None
608        }
609    }
610
611    /// Name of the method defined in FIDL
612    pub fn method_name(&self) -> &'static str {
613        match *self {
614            CounterRequest::GetInspectVmo { .. } => "get_inspect_vmo",
615            CounterRequest::UpdateInspectVmo { .. } => "update_inspect_vmo",
616        }
617    }
618}
619
620#[derive(Debug, Clone)]
621pub struct CounterControlHandle {
622    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
623}
624
625impl CounterControlHandle {
626    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
627        self.inner.shutdown_with_epitaph(status.into())
628    }
629}
630
631impl fidl::endpoints::ControlHandle for CounterControlHandle {
632    fn shutdown(&self) {
633        self.inner.shutdown()
634    }
635
636    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
637        self.inner.shutdown_with_epitaph(status)
638    }
639
640    fn is_closed(&self) -> bool {
641        self.inner.channel().is_closed()
642    }
643    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
644        self.inner.channel().on_closed()
645    }
646
647    #[cfg(target_os = "fuchsia")]
648    fn signal_peer(
649        &self,
650        clear_mask: zx::Signals,
651        set_mask: zx::Signals,
652    ) -> Result<(), zx_status::Status> {
653        use fidl::Peered;
654        self.inner.channel().signal_peer(clear_mask, set_mask)
655    }
656}
657
658impl CounterControlHandle {}
659
660#[must_use = "FIDL methods require a response to be sent"]
661#[derive(Debug)]
662pub struct CounterGetInspectVmoResponder {
663    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
664    tx_id: u32,
665}
666
667/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
668/// if the responder is dropped without sending a response, so that the client
669/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
670impl std::ops::Drop for CounterGetInspectVmoResponder {
671    fn drop(&mut self) {
672        self.control_handle.shutdown();
673        // Safety: drops once, never accessed again
674        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
675    }
676}
677
678impl fidl::endpoints::Responder for CounterGetInspectVmoResponder {
679    type ControlHandle = CounterControlHandle;
680
681    fn control_handle(&self) -> &CounterControlHandle {
682        &self.control_handle
683    }
684
685    fn drop_without_shutdown(mut self) {
686        // Safety: drops once, never accessed again due to mem::forget
687        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
688        // Prevent Drop from running (which would shut down the channel)
689        std::mem::forget(self);
690    }
691}
692
693impl CounterGetInspectVmoResponder {
694    /// Sends a response to the FIDL transaction.
695    ///
696    /// Sets the channel to shutdown if an error occurs.
697    pub fn send(
698        self,
699        mut status: i32,
700        mut buffer: fidl_fuchsia_mem::Buffer,
701    ) -> Result<(), fidl::Error> {
702        let _result = self.send_raw(status, buffer);
703        if _result.is_err() {
704            self.control_handle.shutdown();
705        }
706        self.drop_without_shutdown();
707        _result
708    }
709
710    /// Similar to "send" but does not shutdown the channel if an error occurs.
711    pub fn send_no_shutdown_on_err(
712        self,
713        mut status: i32,
714        mut buffer: fidl_fuchsia_mem::Buffer,
715    ) -> Result<(), fidl::Error> {
716        let _result = self.send_raw(status, buffer);
717        self.drop_without_shutdown();
718        _result
719    }
720
721    fn send_raw(
722        &self,
723        mut status: i32,
724        mut buffer: fidl_fuchsia_mem::Buffer,
725    ) -> Result<(), fidl::Error> {
726        self.control_handle.inner.send::<CounterGetInspectVmoResponse>(
727            (status, &mut buffer),
728            self.tx_id,
729            0x6ea9b2e6b2791b81,
730            fidl::encoding::DynamicFlags::empty(),
731        )
732    }
733}
734
735#[must_use = "FIDL methods require a response to be sent"]
736#[derive(Debug)]
737pub struct CounterUpdateInspectVmoResponder {
738    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
739    tx_id: u32,
740}
741
742/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
743/// if the responder is dropped without sending a response, so that the client
744/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
745impl std::ops::Drop for CounterUpdateInspectVmoResponder {
746    fn drop(&mut self) {
747        self.control_handle.shutdown();
748        // Safety: drops once, never accessed again
749        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
750    }
751}
752
753impl fidl::endpoints::Responder for CounterUpdateInspectVmoResponder {
754    type ControlHandle = CounterControlHandle;
755
756    fn control_handle(&self) -> &CounterControlHandle {
757        &self.control_handle
758    }
759
760    fn drop_without_shutdown(mut self) {
761        // Safety: drops once, never accessed again due to mem::forget
762        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
763        // Prevent Drop from running (which would shut down the channel)
764        std::mem::forget(self);
765    }
766}
767
768impl CounterUpdateInspectVmoResponder {
769    /// Sends a response to the FIDL transaction.
770    ///
771    /// Sets the channel to shutdown if an error occurs.
772    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
773        let _result = self.send_raw(status);
774        if _result.is_err() {
775            self.control_handle.shutdown();
776        }
777        self.drop_without_shutdown();
778        _result
779    }
780
781    /// Similar to "send" but does not shutdown the channel if an error occurs.
782    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
783        let _result = self.send_raw(status);
784        self.drop_without_shutdown();
785        _result
786    }
787
788    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
789        self.control_handle.inner.send::<CounterUpdateInspectVmoResponse>(
790            (status,),
791            self.tx_id,
792            0x1d25eb7995a0539f,
793            fidl::encoding::DynamicFlags::empty(),
794        )
795    }
796}
797
798#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
799pub struct CpuResourceMarker;
800
801impl fidl::endpoints::ProtocolMarker for CpuResourceMarker {
802    type Proxy = CpuResourceProxy;
803    type RequestStream = CpuResourceRequestStream;
804    #[cfg(target_os = "fuchsia")]
805    type SynchronousProxy = CpuResourceSynchronousProxy;
806
807    const DEBUG_NAME: &'static str = "fuchsia.kernel.CpuResource";
808}
809impl fidl::endpoints::DiscoverableProtocolMarker for CpuResourceMarker {}
810
811pub trait CpuResourceProxyInterface: Send + Sync {
812    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
813    fn r#get(&self) -> Self::GetResponseFut;
814}
815#[derive(Debug)]
816#[cfg(target_os = "fuchsia")]
817pub struct CpuResourceSynchronousProxy {
818    client: fidl::client::sync::Client,
819}
820
821#[cfg(target_os = "fuchsia")]
822impl fidl::endpoints::SynchronousProxy for CpuResourceSynchronousProxy {
823    type Proxy = CpuResourceProxy;
824    type Protocol = CpuResourceMarker;
825
826    fn from_channel(inner: fidl::Channel) -> Self {
827        Self::new(inner)
828    }
829
830    fn into_channel(self) -> fidl::Channel {
831        self.client.into_channel()
832    }
833
834    fn as_channel(&self) -> &fidl::Channel {
835        self.client.as_channel()
836    }
837}
838
839#[cfg(target_os = "fuchsia")]
840impl CpuResourceSynchronousProxy {
841    pub fn new(channel: fidl::Channel) -> Self {
842        Self { client: fidl::client::sync::Client::new(channel) }
843    }
844
845    pub fn into_channel(self) -> fidl::Channel {
846        self.client.into_channel()
847    }
848
849    /// Waits until an event arrives and returns it. It is safe for other
850    /// threads to make concurrent requests while waiting for an event.
851    pub fn wait_for_event(
852        &self,
853        deadline: zx::MonotonicInstant,
854    ) -> Result<CpuResourceEvent, fidl::Error> {
855        CpuResourceEvent::decode(self.client.wait_for_event::<CpuResourceMarker>(deadline)?)
856    }
857
858    /// Get a CPU resource handle.
859    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
860        let _response = self
861            .client
862            .send_query::<fidl::encoding::EmptyPayload, CpuResourceGetResponse, CpuResourceMarker>(
863                (),
864                0x41e1103acf4215e4,
865                fidl::encoding::DynamicFlags::empty(),
866                ___deadline,
867            )?;
868        Ok(_response.resource)
869    }
870}
871
872#[cfg(target_os = "fuchsia")]
873impl From<CpuResourceSynchronousProxy> for zx::NullableHandle {
874    fn from(value: CpuResourceSynchronousProxy) -> Self {
875        value.into_channel().into()
876    }
877}
878
879#[cfg(target_os = "fuchsia")]
880impl From<fidl::Channel> for CpuResourceSynchronousProxy {
881    fn from(value: fidl::Channel) -> Self {
882        Self::new(value)
883    }
884}
885
886#[cfg(target_os = "fuchsia")]
887impl fidl::endpoints::FromClient for CpuResourceSynchronousProxy {
888    type Protocol = CpuResourceMarker;
889
890    fn from_client(value: fidl::endpoints::ClientEnd<CpuResourceMarker>) -> Self {
891        Self::new(value.into_channel())
892    }
893}
894
895#[derive(Debug, Clone)]
896pub struct CpuResourceProxy {
897    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
898}
899
900impl fidl::endpoints::Proxy for CpuResourceProxy {
901    type Protocol = CpuResourceMarker;
902
903    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
904        Self::new(inner)
905    }
906
907    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
908        self.client.into_channel().map_err(|client| Self { client })
909    }
910
911    fn as_channel(&self) -> &::fidl::AsyncChannel {
912        self.client.as_channel()
913    }
914}
915
916impl CpuResourceProxy {
917    /// Create a new Proxy for fuchsia.kernel/CpuResource.
918    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
919        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
920        Self { client: fidl::client::Client::new(channel, protocol_name) }
921    }
922
923    /// Get a Stream of events from the remote end of the protocol.
924    ///
925    /// # Panics
926    ///
927    /// Panics if the event stream was already taken.
928    pub fn take_event_stream(&self) -> CpuResourceEventStream {
929        CpuResourceEventStream { event_receiver: self.client.take_event_receiver() }
930    }
931
932    /// Get a CPU resource handle.
933    pub fn r#get(
934        &self,
935    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
936    {
937        CpuResourceProxyInterface::r#get(self)
938    }
939}
940
941impl CpuResourceProxyInterface for CpuResourceProxy {
942    type GetResponseFut = fidl::client::QueryResponseFut<
943        fidl::Resource,
944        fidl::encoding::DefaultFuchsiaResourceDialect,
945    >;
946    fn r#get(&self) -> Self::GetResponseFut {
947        fn _decode(
948            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
949        ) -> Result<fidl::Resource, fidl::Error> {
950            let _response = fidl::client::decode_transaction_body::<
951                CpuResourceGetResponse,
952                fidl::encoding::DefaultFuchsiaResourceDialect,
953                0x41e1103acf4215e4,
954            >(_buf?)?;
955            Ok(_response.resource)
956        }
957        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
958            (),
959            0x41e1103acf4215e4,
960            fidl::encoding::DynamicFlags::empty(),
961            _decode,
962        )
963    }
964}
965
966pub struct CpuResourceEventStream {
967    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
968}
969
970impl std::marker::Unpin for CpuResourceEventStream {}
971
972impl futures::stream::FusedStream for CpuResourceEventStream {
973    fn is_terminated(&self) -> bool {
974        self.event_receiver.is_terminated()
975    }
976}
977
978impl futures::Stream for CpuResourceEventStream {
979    type Item = Result<CpuResourceEvent, fidl::Error>;
980
981    fn poll_next(
982        mut self: std::pin::Pin<&mut Self>,
983        cx: &mut std::task::Context<'_>,
984    ) -> std::task::Poll<Option<Self::Item>> {
985        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
986            &mut self.event_receiver,
987            cx
988        )?) {
989            Some(buf) => std::task::Poll::Ready(Some(CpuResourceEvent::decode(buf))),
990            None => std::task::Poll::Ready(None),
991        }
992    }
993}
994
995#[derive(Debug)]
996pub enum CpuResourceEvent {}
997
998impl CpuResourceEvent {
999    /// Decodes a message buffer as a [`CpuResourceEvent`].
1000    fn decode(
1001        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1002    ) -> Result<CpuResourceEvent, fidl::Error> {
1003        let (bytes, _handles) = buf.split_mut();
1004        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1005        debug_assert_eq!(tx_header.tx_id, 0);
1006        match tx_header.ordinal {
1007            _ => Err(fidl::Error::UnknownOrdinal {
1008                ordinal: tx_header.ordinal,
1009                protocol_name: <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1010            }),
1011        }
1012    }
1013}
1014
1015/// A Stream of incoming requests for fuchsia.kernel/CpuResource.
1016pub struct CpuResourceRequestStream {
1017    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1018    is_terminated: bool,
1019}
1020
1021impl std::marker::Unpin for CpuResourceRequestStream {}
1022
1023impl futures::stream::FusedStream for CpuResourceRequestStream {
1024    fn is_terminated(&self) -> bool {
1025        self.is_terminated
1026    }
1027}
1028
1029impl fidl::endpoints::RequestStream for CpuResourceRequestStream {
1030    type Protocol = CpuResourceMarker;
1031    type ControlHandle = CpuResourceControlHandle;
1032
1033    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1034        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1035    }
1036
1037    fn control_handle(&self) -> Self::ControlHandle {
1038        CpuResourceControlHandle { inner: self.inner.clone() }
1039    }
1040
1041    fn into_inner(
1042        self,
1043    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1044    {
1045        (self.inner, self.is_terminated)
1046    }
1047
1048    fn from_inner(
1049        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1050        is_terminated: bool,
1051    ) -> Self {
1052        Self { inner, is_terminated }
1053    }
1054}
1055
1056impl futures::Stream for CpuResourceRequestStream {
1057    type Item = Result<CpuResourceRequest, fidl::Error>;
1058
1059    fn poll_next(
1060        mut self: std::pin::Pin<&mut Self>,
1061        cx: &mut std::task::Context<'_>,
1062    ) -> std::task::Poll<Option<Self::Item>> {
1063        let this = &mut *self;
1064        if this.inner.check_shutdown(cx) {
1065            this.is_terminated = true;
1066            return std::task::Poll::Ready(None);
1067        }
1068        if this.is_terminated {
1069            panic!("polled CpuResourceRequestStream after completion");
1070        }
1071        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1072            |bytes, handles| {
1073                match this.inner.channel().read_etc(cx, bytes, handles) {
1074                    std::task::Poll::Ready(Ok(())) => {}
1075                    std::task::Poll::Pending => return std::task::Poll::Pending,
1076                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1077                        this.is_terminated = true;
1078                        return std::task::Poll::Ready(None);
1079                    }
1080                    std::task::Poll::Ready(Err(e)) => {
1081                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1082                            e.into(),
1083                        ))));
1084                    }
1085                }
1086
1087                // A message has been received from the channel
1088                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1089
1090                std::task::Poll::Ready(Some(match header.ordinal {
1091                    0x41e1103acf4215e4 => {
1092                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1093                        let mut req = fidl::new_empty!(
1094                            fidl::encoding::EmptyPayload,
1095                            fidl::encoding::DefaultFuchsiaResourceDialect
1096                        );
1097                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1098                        let control_handle = CpuResourceControlHandle { inner: this.inner.clone() };
1099                        Ok(CpuResourceRequest::Get {
1100                            responder: CpuResourceGetResponder {
1101                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1102                                tx_id: header.tx_id,
1103                            },
1104                        })
1105                    }
1106                    _ => Err(fidl::Error::UnknownOrdinal {
1107                        ordinal: header.ordinal,
1108                        protocol_name:
1109                            <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1110                    }),
1111                }))
1112            },
1113        )
1114    }
1115}
1116
1117/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
1118/// `ZX_RSRC_SYSTEM_CPU_BASE`.
1119#[derive(Debug)]
1120pub enum CpuResourceRequest {
1121    /// Get a CPU resource handle.
1122    Get { responder: CpuResourceGetResponder },
1123}
1124
1125impl CpuResourceRequest {
1126    #[allow(irrefutable_let_patterns)]
1127    pub fn into_get(self) -> Option<(CpuResourceGetResponder)> {
1128        if let CpuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
1129    }
1130
1131    /// Name of the method defined in FIDL
1132    pub fn method_name(&self) -> &'static str {
1133        match *self {
1134            CpuResourceRequest::Get { .. } => "get",
1135        }
1136    }
1137}
1138
1139#[derive(Debug, Clone)]
1140pub struct CpuResourceControlHandle {
1141    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1142}
1143
1144impl CpuResourceControlHandle {
1145    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1146        self.inner.shutdown_with_epitaph(status.into())
1147    }
1148}
1149
1150impl fidl::endpoints::ControlHandle for CpuResourceControlHandle {
1151    fn shutdown(&self) {
1152        self.inner.shutdown()
1153    }
1154
1155    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1156        self.inner.shutdown_with_epitaph(status)
1157    }
1158
1159    fn is_closed(&self) -> bool {
1160        self.inner.channel().is_closed()
1161    }
1162    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1163        self.inner.channel().on_closed()
1164    }
1165
1166    #[cfg(target_os = "fuchsia")]
1167    fn signal_peer(
1168        &self,
1169        clear_mask: zx::Signals,
1170        set_mask: zx::Signals,
1171    ) -> Result<(), zx_status::Status> {
1172        use fidl::Peered;
1173        self.inner.channel().signal_peer(clear_mask, set_mask)
1174    }
1175}
1176
1177impl CpuResourceControlHandle {}
1178
1179#[must_use = "FIDL methods require a response to be sent"]
1180#[derive(Debug)]
1181pub struct CpuResourceGetResponder {
1182    control_handle: std::mem::ManuallyDrop<CpuResourceControlHandle>,
1183    tx_id: u32,
1184}
1185
1186/// Set the the channel to be shutdown (see [`CpuResourceControlHandle::shutdown`])
1187/// if the responder is dropped without sending a response, so that the client
1188/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1189impl std::ops::Drop for CpuResourceGetResponder {
1190    fn drop(&mut self) {
1191        self.control_handle.shutdown();
1192        // Safety: drops once, never accessed again
1193        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1194    }
1195}
1196
1197impl fidl::endpoints::Responder for CpuResourceGetResponder {
1198    type ControlHandle = CpuResourceControlHandle;
1199
1200    fn control_handle(&self) -> &CpuResourceControlHandle {
1201        &self.control_handle
1202    }
1203
1204    fn drop_without_shutdown(mut self) {
1205        // Safety: drops once, never accessed again due to mem::forget
1206        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1207        // Prevent Drop from running (which would shut down the channel)
1208        std::mem::forget(self);
1209    }
1210}
1211
1212impl CpuResourceGetResponder {
1213    /// Sends a response to the FIDL transaction.
1214    ///
1215    /// Sets the channel to shutdown if an error occurs.
1216    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1217        let _result = self.send_raw(resource);
1218        if _result.is_err() {
1219            self.control_handle.shutdown();
1220        }
1221        self.drop_without_shutdown();
1222        _result
1223    }
1224
1225    /// Similar to "send" but does not shutdown the channel if an error occurs.
1226    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1227        let _result = self.send_raw(resource);
1228        self.drop_without_shutdown();
1229        _result
1230    }
1231
1232    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1233        self.control_handle.inner.send::<CpuResourceGetResponse>(
1234            (resource,),
1235            self.tx_id,
1236            0x41e1103acf4215e4,
1237            fidl::encoding::DynamicFlags::empty(),
1238        )
1239    }
1240}
1241
1242#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1243pub struct DebugBrokerMarker;
1244
1245impl fidl::endpoints::ProtocolMarker for DebugBrokerMarker {
1246    type Proxy = DebugBrokerProxy;
1247    type RequestStream = DebugBrokerRequestStream;
1248    #[cfg(target_os = "fuchsia")]
1249    type SynchronousProxy = DebugBrokerSynchronousProxy;
1250
1251    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugBroker";
1252}
1253impl fidl::endpoints::DiscoverableProtocolMarker for DebugBrokerMarker {}
1254
1255pub trait DebugBrokerProxyInterface: Send + Sync {
1256    type SendDebugCommandResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1257    fn r#send_debug_command(&self, command: &str) -> Self::SendDebugCommandResponseFut;
1258    type SetTracingEnabledResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1259    fn r#set_tracing_enabled(&self, enabled: bool) -> Self::SetTracingEnabledResponseFut;
1260}
1261#[derive(Debug)]
1262#[cfg(target_os = "fuchsia")]
1263pub struct DebugBrokerSynchronousProxy {
1264    client: fidl::client::sync::Client,
1265}
1266
1267#[cfg(target_os = "fuchsia")]
1268impl fidl::endpoints::SynchronousProxy for DebugBrokerSynchronousProxy {
1269    type Proxy = DebugBrokerProxy;
1270    type Protocol = DebugBrokerMarker;
1271
1272    fn from_channel(inner: fidl::Channel) -> Self {
1273        Self::new(inner)
1274    }
1275
1276    fn into_channel(self) -> fidl::Channel {
1277        self.client.into_channel()
1278    }
1279
1280    fn as_channel(&self) -> &fidl::Channel {
1281        self.client.as_channel()
1282    }
1283}
1284
1285#[cfg(target_os = "fuchsia")]
1286impl DebugBrokerSynchronousProxy {
1287    pub fn new(channel: fidl::Channel) -> Self {
1288        Self { client: fidl::client::sync::Client::new(channel) }
1289    }
1290
1291    pub fn into_channel(self) -> fidl::Channel {
1292        self.client.into_channel()
1293    }
1294
1295    /// Waits until an event arrives and returns it. It is safe for other
1296    /// threads to make concurrent requests while waiting for an event.
1297    pub fn wait_for_event(
1298        &self,
1299        deadline: zx::MonotonicInstant,
1300    ) -> Result<DebugBrokerEvent, fidl::Error> {
1301        DebugBrokerEvent::decode(self.client.wait_for_event::<DebugBrokerMarker>(deadline)?)
1302    }
1303
1304    /// Pass debug command through to the kernel shell.
1305    /// Look at zx_debug_send_command syscall handling to find valid values.
1306    pub fn r#send_debug_command(
1307        &self,
1308        mut command: &str,
1309        ___deadline: zx::MonotonicInstant,
1310    ) -> Result<i32, fidl::Error> {
1311        let _response = self.client.send_query::<
1312            DebugBrokerSendDebugCommandRequest,
1313            DebugBrokerSendDebugCommandResponse,
1314            DebugBrokerMarker,
1315        >(
1316            (command,),
1317            0x1ee270f83b5d6ff6,
1318            fidl::encoding::DynamicFlags::empty(),
1319            ___deadline,
1320        )?;
1321        Ok(_response.status)
1322    }
1323
1324    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1325    pub fn r#set_tracing_enabled(
1326        &self,
1327        mut enabled: bool,
1328        ___deadline: zx::MonotonicInstant,
1329    ) -> Result<i32, fidl::Error> {
1330        let _response = self.client.send_query::<
1331            DebugBrokerSetTracingEnabledRequest,
1332            DebugBrokerSetTracingEnabledResponse,
1333            DebugBrokerMarker,
1334        >(
1335            (enabled,),
1336            0x12e368d05329b30e,
1337            fidl::encoding::DynamicFlags::empty(),
1338            ___deadline,
1339        )?;
1340        Ok(_response.status)
1341    }
1342}
1343
1344#[cfg(target_os = "fuchsia")]
1345impl From<DebugBrokerSynchronousProxy> for zx::NullableHandle {
1346    fn from(value: DebugBrokerSynchronousProxy) -> Self {
1347        value.into_channel().into()
1348    }
1349}
1350
1351#[cfg(target_os = "fuchsia")]
1352impl From<fidl::Channel> for DebugBrokerSynchronousProxy {
1353    fn from(value: fidl::Channel) -> Self {
1354        Self::new(value)
1355    }
1356}
1357
1358#[cfg(target_os = "fuchsia")]
1359impl fidl::endpoints::FromClient for DebugBrokerSynchronousProxy {
1360    type Protocol = DebugBrokerMarker;
1361
1362    fn from_client(value: fidl::endpoints::ClientEnd<DebugBrokerMarker>) -> Self {
1363        Self::new(value.into_channel())
1364    }
1365}
1366
1367#[derive(Debug, Clone)]
1368pub struct DebugBrokerProxy {
1369    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1370}
1371
1372impl fidl::endpoints::Proxy for DebugBrokerProxy {
1373    type Protocol = DebugBrokerMarker;
1374
1375    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1376        Self::new(inner)
1377    }
1378
1379    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1380        self.client.into_channel().map_err(|client| Self { client })
1381    }
1382
1383    fn as_channel(&self) -> &::fidl::AsyncChannel {
1384        self.client.as_channel()
1385    }
1386}
1387
1388impl DebugBrokerProxy {
1389    /// Create a new Proxy for fuchsia.kernel/DebugBroker.
1390    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1391        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1392        Self { client: fidl::client::Client::new(channel, protocol_name) }
1393    }
1394
1395    /// Get a Stream of events from the remote end of the protocol.
1396    ///
1397    /// # Panics
1398    ///
1399    /// Panics if the event stream was already taken.
1400    pub fn take_event_stream(&self) -> DebugBrokerEventStream {
1401        DebugBrokerEventStream { event_receiver: self.client.take_event_receiver() }
1402    }
1403
1404    /// Pass debug command through to the kernel shell.
1405    /// Look at zx_debug_send_command syscall handling to find valid values.
1406    pub fn r#send_debug_command(
1407        &self,
1408        mut command: &str,
1409    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1410        DebugBrokerProxyInterface::r#send_debug_command(self, command)
1411    }
1412
1413    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1414    pub fn r#set_tracing_enabled(
1415        &self,
1416        mut enabled: bool,
1417    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1418        DebugBrokerProxyInterface::r#set_tracing_enabled(self, enabled)
1419    }
1420}
1421
1422impl DebugBrokerProxyInterface for DebugBrokerProxy {
1423    type SendDebugCommandResponseFut =
1424        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1425    fn r#send_debug_command(&self, mut command: &str) -> Self::SendDebugCommandResponseFut {
1426        fn _decode(
1427            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1428        ) -> Result<i32, fidl::Error> {
1429            let _response = fidl::client::decode_transaction_body::<
1430                DebugBrokerSendDebugCommandResponse,
1431                fidl::encoding::DefaultFuchsiaResourceDialect,
1432                0x1ee270f83b5d6ff6,
1433            >(_buf?)?;
1434            Ok(_response.status)
1435        }
1436        self.client.send_query_and_decode::<DebugBrokerSendDebugCommandRequest, i32>(
1437            (command,),
1438            0x1ee270f83b5d6ff6,
1439            fidl::encoding::DynamicFlags::empty(),
1440            _decode,
1441        )
1442    }
1443
1444    type SetTracingEnabledResponseFut =
1445        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1446    fn r#set_tracing_enabled(&self, mut enabled: bool) -> Self::SetTracingEnabledResponseFut {
1447        fn _decode(
1448            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1449        ) -> Result<i32, fidl::Error> {
1450            let _response = fidl::client::decode_transaction_body::<
1451                DebugBrokerSetTracingEnabledResponse,
1452                fidl::encoding::DefaultFuchsiaResourceDialect,
1453                0x12e368d05329b30e,
1454            >(_buf?)?;
1455            Ok(_response.status)
1456        }
1457        self.client.send_query_and_decode::<DebugBrokerSetTracingEnabledRequest, i32>(
1458            (enabled,),
1459            0x12e368d05329b30e,
1460            fidl::encoding::DynamicFlags::empty(),
1461            _decode,
1462        )
1463    }
1464}
1465
1466pub struct DebugBrokerEventStream {
1467    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1468}
1469
1470impl std::marker::Unpin for DebugBrokerEventStream {}
1471
1472impl futures::stream::FusedStream for DebugBrokerEventStream {
1473    fn is_terminated(&self) -> bool {
1474        self.event_receiver.is_terminated()
1475    }
1476}
1477
1478impl futures::Stream for DebugBrokerEventStream {
1479    type Item = Result<DebugBrokerEvent, fidl::Error>;
1480
1481    fn poll_next(
1482        mut self: std::pin::Pin<&mut Self>,
1483        cx: &mut std::task::Context<'_>,
1484    ) -> std::task::Poll<Option<Self::Item>> {
1485        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1486            &mut self.event_receiver,
1487            cx
1488        )?) {
1489            Some(buf) => std::task::Poll::Ready(Some(DebugBrokerEvent::decode(buf))),
1490            None => std::task::Poll::Ready(None),
1491        }
1492    }
1493}
1494
1495#[derive(Debug)]
1496pub enum DebugBrokerEvent {}
1497
1498impl DebugBrokerEvent {
1499    /// Decodes a message buffer as a [`DebugBrokerEvent`].
1500    fn decode(
1501        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1502    ) -> Result<DebugBrokerEvent, fidl::Error> {
1503        let (bytes, _handles) = buf.split_mut();
1504        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1505        debug_assert_eq!(tx_header.tx_id, 0);
1506        match tx_header.ordinal {
1507            _ => Err(fidl::Error::UnknownOrdinal {
1508                ordinal: tx_header.ordinal,
1509                protocol_name: <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1510            }),
1511        }
1512    }
1513}
1514
1515/// A Stream of incoming requests for fuchsia.kernel/DebugBroker.
1516pub struct DebugBrokerRequestStream {
1517    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1518    is_terminated: bool,
1519}
1520
1521impl std::marker::Unpin for DebugBrokerRequestStream {}
1522
1523impl futures::stream::FusedStream for DebugBrokerRequestStream {
1524    fn is_terminated(&self) -> bool {
1525        self.is_terminated
1526    }
1527}
1528
1529impl fidl::endpoints::RequestStream for DebugBrokerRequestStream {
1530    type Protocol = DebugBrokerMarker;
1531    type ControlHandle = DebugBrokerControlHandle;
1532
1533    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1534        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1535    }
1536
1537    fn control_handle(&self) -> Self::ControlHandle {
1538        DebugBrokerControlHandle { inner: self.inner.clone() }
1539    }
1540
1541    fn into_inner(
1542        self,
1543    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1544    {
1545        (self.inner, self.is_terminated)
1546    }
1547
1548    fn from_inner(
1549        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1550        is_terminated: bool,
1551    ) -> Self {
1552        Self { inner, is_terminated }
1553    }
1554}
1555
1556impl futures::Stream for DebugBrokerRequestStream {
1557    type Item = Result<DebugBrokerRequest, fidl::Error>;
1558
1559    fn poll_next(
1560        mut self: std::pin::Pin<&mut Self>,
1561        cx: &mut std::task::Context<'_>,
1562    ) -> std::task::Poll<Option<Self::Item>> {
1563        let this = &mut *self;
1564        if this.inner.check_shutdown(cx) {
1565            this.is_terminated = true;
1566            return std::task::Poll::Ready(None);
1567        }
1568        if this.is_terminated {
1569            panic!("polled DebugBrokerRequestStream after completion");
1570        }
1571        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1572            |bytes, handles| {
1573                match this.inner.channel().read_etc(cx, bytes, handles) {
1574                    std::task::Poll::Ready(Ok(())) => {}
1575                    std::task::Poll::Pending => return std::task::Poll::Pending,
1576                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1577                        this.is_terminated = true;
1578                        return std::task::Poll::Ready(None);
1579                    }
1580                    std::task::Poll::Ready(Err(e)) => {
1581                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1582                            e.into(),
1583                        ))));
1584                    }
1585                }
1586
1587                // A message has been received from the channel
1588                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1589
1590                std::task::Poll::Ready(Some(match header.ordinal {
1591                    0x1ee270f83b5d6ff6 => {
1592                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1593                        let mut req = fidl::new_empty!(
1594                            DebugBrokerSendDebugCommandRequest,
1595                            fidl::encoding::DefaultFuchsiaResourceDialect
1596                        );
1597                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSendDebugCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1598                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1599                        Ok(DebugBrokerRequest::SendDebugCommand {
1600                            command: req.command,
1601
1602                            responder: DebugBrokerSendDebugCommandResponder {
1603                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1604                                tx_id: header.tx_id,
1605                            },
1606                        })
1607                    }
1608                    0x12e368d05329b30e => {
1609                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1610                        let mut req = fidl::new_empty!(
1611                            DebugBrokerSetTracingEnabledRequest,
1612                            fidl::encoding::DefaultFuchsiaResourceDialect
1613                        );
1614                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSetTracingEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1615                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1616                        Ok(DebugBrokerRequest::SetTracingEnabled {
1617                            enabled: req.enabled,
1618
1619                            responder: DebugBrokerSetTracingEnabledResponder {
1620                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1621                                tx_id: header.tx_id,
1622                            },
1623                        })
1624                    }
1625                    _ => Err(fidl::Error::UnknownOrdinal {
1626                        ordinal: header.ordinal,
1627                        protocol_name:
1628                            <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1629                    }),
1630                }))
1631            },
1632        )
1633    }
1634}
1635
1636/// Acts on behalf of the caller to interact with privileged debug system calls.
1637#[derive(Debug)]
1638pub enum DebugBrokerRequest {
1639    /// Pass debug command through to the kernel shell.
1640    /// Look at zx_debug_send_command syscall handling to find valid values.
1641    SendDebugCommand { command: String, responder: DebugBrokerSendDebugCommandResponder },
1642    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1643    SetTracingEnabled { enabled: bool, responder: DebugBrokerSetTracingEnabledResponder },
1644}
1645
1646impl DebugBrokerRequest {
1647    #[allow(irrefutable_let_patterns)]
1648    pub fn into_send_debug_command(self) -> Option<(String, DebugBrokerSendDebugCommandResponder)> {
1649        if let DebugBrokerRequest::SendDebugCommand { command, responder } = self {
1650            Some((command, responder))
1651        } else {
1652            None
1653        }
1654    }
1655
1656    #[allow(irrefutable_let_patterns)]
1657    pub fn into_set_tracing_enabled(self) -> Option<(bool, DebugBrokerSetTracingEnabledResponder)> {
1658        if let DebugBrokerRequest::SetTracingEnabled { enabled, responder } = self {
1659            Some((enabled, responder))
1660        } else {
1661            None
1662        }
1663    }
1664
1665    /// Name of the method defined in FIDL
1666    pub fn method_name(&self) -> &'static str {
1667        match *self {
1668            DebugBrokerRequest::SendDebugCommand { .. } => "send_debug_command",
1669            DebugBrokerRequest::SetTracingEnabled { .. } => "set_tracing_enabled",
1670        }
1671    }
1672}
1673
1674#[derive(Debug, Clone)]
1675pub struct DebugBrokerControlHandle {
1676    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1677}
1678
1679impl DebugBrokerControlHandle {
1680    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1681        self.inner.shutdown_with_epitaph(status.into())
1682    }
1683}
1684
1685impl fidl::endpoints::ControlHandle for DebugBrokerControlHandle {
1686    fn shutdown(&self) {
1687        self.inner.shutdown()
1688    }
1689
1690    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1691        self.inner.shutdown_with_epitaph(status)
1692    }
1693
1694    fn is_closed(&self) -> bool {
1695        self.inner.channel().is_closed()
1696    }
1697    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1698        self.inner.channel().on_closed()
1699    }
1700
1701    #[cfg(target_os = "fuchsia")]
1702    fn signal_peer(
1703        &self,
1704        clear_mask: zx::Signals,
1705        set_mask: zx::Signals,
1706    ) -> Result<(), zx_status::Status> {
1707        use fidl::Peered;
1708        self.inner.channel().signal_peer(clear_mask, set_mask)
1709    }
1710}
1711
1712impl DebugBrokerControlHandle {}
1713
1714#[must_use = "FIDL methods require a response to be sent"]
1715#[derive(Debug)]
1716pub struct DebugBrokerSendDebugCommandResponder {
1717    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1718    tx_id: u32,
1719}
1720
1721/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1722/// if the responder is dropped without sending a response, so that the client
1723/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1724impl std::ops::Drop for DebugBrokerSendDebugCommandResponder {
1725    fn drop(&mut self) {
1726        self.control_handle.shutdown();
1727        // Safety: drops once, never accessed again
1728        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1729    }
1730}
1731
1732impl fidl::endpoints::Responder for DebugBrokerSendDebugCommandResponder {
1733    type ControlHandle = DebugBrokerControlHandle;
1734
1735    fn control_handle(&self) -> &DebugBrokerControlHandle {
1736        &self.control_handle
1737    }
1738
1739    fn drop_without_shutdown(mut self) {
1740        // Safety: drops once, never accessed again due to mem::forget
1741        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1742        // Prevent Drop from running (which would shut down the channel)
1743        std::mem::forget(self);
1744    }
1745}
1746
1747impl DebugBrokerSendDebugCommandResponder {
1748    /// Sends a response to the FIDL transaction.
1749    ///
1750    /// Sets the channel to shutdown if an error occurs.
1751    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1752        let _result = self.send_raw(status);
1753        if _result.is_err() {
1754            self.control_handle.shutdown();
1755        }
1756        self.drop_without_shutdown();
1757        _result
1758    }
1759
1760    /// Similar to "send" but does not shutdown the channel if an error occurs.
1761    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1762        let _result = self.send_raw(status);
1763        self.drop_without_shutdown();
1764        _result
1765    }
1766
1767    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1768        self.control_handle.inner.send::<DebugBrokerSendDebugCommandResponse>(
1769            (status,),
1770            self.tx_id,
1771            0x1ee270f83b5d6ff6,
1772            fidl::encoding::DynamicFlags::empty(),
1773        )
1774    }
1775}
1776
1777#[must_use = "FIDL methods require a response to be sent"]
1778#[derive(Debug)]
1779pub struct DebugBrokerSetTracingEnabledResponder {
1780    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1781    tx_id: u32,
1782}
1783
1784/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1785/// if the responder is dropped without sending a response, so that the client
1786/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1787impl std::ops::Drop for DebugBrokerSetTracingEnabledResponder {
1788    fn drop(&mut self) {
1789        self.control_handle.shutdown();
1790        // Safety: drops once, never accessed again
1791        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1792    }
1793}
1794
1795impl fidl::endpoints::Responder for DebugBrokerSetTracingEnabledResponder {
1796    type ControlHandle = DebugBrokerControlHandle;
1797
1798    fn control_handle(&self) -> &DebugBrokerControlHandle {
1799        &self.control_handle
1800    }
1801
1802    fn drop_without_shutdown(mut self) {
1803        // Safety: drops once, never accessed again due to mem::forget
1804        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1805        // Prevent Drop from running (which would shut down the channel)
1806        std::mem::forget(self);
1807    }
1808}
1809
1810impl DebugBrokerSetTracingEnabledResponder {
1811    /// Sends a response to the FIDL transaction.
1812    ///
1813    /// Sets the channel to shutdown if an error occurs.
1814    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1815        let _result = self.send_raw(status);
1816        if _result.is_err() {
1817            self.control_handle.shutdown();
1818        }
1819        self.drop_without_shutdown();
1820        _result
1821    }
1822
1823    /// Similar to "send" but does not shutdown the channel if an error occurs.
1824    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1825        let _result = self.send_raw(status);
1826        self.drop_without_shutdown();
1827        _result
1828    }
1829
1830    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1831        self.control_handle.inner.send::<DebugBrokerSetTracingEnabledResponse>(
1832            (status,),
1833            self.tx_id,
1834            0x12e368d05329b30e,
1835            fidl::encoding::DynamicFlags::empty(),
1836        )
1837    }
1838}
1839
1840#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1841pub struct DebugResourceMarker;
1842
1843impl fidl::endpoints::ProtocolMarker for DebugResourceMarker {
1844    type Proxy = DebugResourceProxy;
1845    type RequestStream = DebugResourceRequestStream;
1846    #[cfg(target_os = "fuchsia")]
1847    type SynchronousProxy = DebugResourceSynchronousProxy;
1848
1849    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugResource";
1850}
1851impl fidl::endpoints::DiscoverableProtocolMarker for DebugResourceMarker {}
1852
1853pub trait DebugResourceProxyInterface: Send + Sync {
1854    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
1855    fn r#get(&self) -> Self::GetResponseFut;
1856}
1857#[derive(Debug)]
1858#[cfg(target_os = "fuchsia")]
1859pub struct DebugResourceSynchronousProxy {
1860    client: fidl::client::sync::Client,
1861}
1862
1863#[cfg(target_os = "fuchsia")]
1864impl fidl::endpoints::SynchronousProxy for DebugResourceSynchronousProxy {
1865    type Proxy = DebugResourceProxy;
1866    type Protocol = DebugResourceMarker;
1867
1868    fn from_channel(inner: fidl::Channel) -> Self {
1869        Self::new(inner)
1870    }
1871
1872    fn into_channel(self) -> fidl::Channel {
1873        self.client.into_channel()
1874    }
1875
1876    fn as_channel(&self) -> &fidl::Channel {
1877        self.client.as_channel()
1878    }
1879}
1880
1881#[cfg(target_os = "fuchsia")]
1882impl DebugResourceSynchronousProxy {
1883    pub fn new(channel: fidl::Channel) -> Self {
1884        Self { client: fidl::client::sync::Client::new(channel) }
1885    }
1886
1887    pub fn into_channel(self) -> fidl::Channel {
1888        self.client.into_channel()
1889    }
1890
1891    /// Waits until an event arrives and returns it. It is safe for other
1892    /// threads to make concurrent requests while waiting for an event.
1893    pub fn wait_for_event(
1894        &self,
1895        deadline: zx::MonotonicInstant,
1896    ) -> Result<DebugResourceEvent, fidl::Error> {
1897        DebugResourceEvent::decode(self.client.wait_for_event::<DebugResourceMarker>(deadline)?)
1898    }
1899
1900    /// Get a debug resource handle.
1901    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
1902        let _response = self.client.send_query::<
1903            fidl::encoding::EmptyPayload,
1904            DebugResourceGetResponse,
1905            DebugResourceMarker,
1906        >(
1907            (),
1908            0x1d79d77ea12a6474,
1909            fidl::encoding::DynamicFlags::empty(),
1910            ___deadline,
1911        )?;
1912        Ok(_response.resource)
1913    }
1914}
1915
1916#[cfg(target_os = "fuchsia")]
1917impl From<DebugResourceSynchronousProxy> for zx::NullableHandle {
1918    fn from(value: DebugResourceSynchronousProxy) -> Self {
1919        value.into_channel().into()
1920    }
1921}
1922
1923#[cfg(target_os = "fuchsia")]
1924impl From<fidl::Channel> for DebugResourceSynchronousProxy {
1925    fn from(value: fidl::Channel) -> Self {
1926        Self::new(value)
1927    }
1928}
1929
1930#[cfg(target_os = "fuchsia")]
1931impl fidl::endpoints::FromClient for DebugResourceSynchronousProxy {
1932    type Protocol = DebugResourceMarker;
1933
1934    fn from_client(value: fidl::endpoints::ClientEnd<DebugResourceMarker>) -> Self {
1935        Self::new(value.into_channel())
1936    }
1937}
1938
1939#[derive(Debug, Clone)]
1940pub struct DebugResourceProxy {
1941    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1942}
1943
1944impl fidl::endpoints::Proxy for DebugResourceProxy {
1945    type Protocol = DebugResourceMarker;
1946
1947    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1948        Self::new(inner)
1949    }
1950
1951    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1952        self.client.into_channel().map_err(|client| Self { client })
1953    }
1954
1955    fn as_channel(&self) -> &::fidl::AsyncChannel {
1956        self.client.as_channel()
1957    }
1958}
1959
1960impl DebugResourceProxy {
1961    /// Create a new Proxy for fuchsia.kernel/DebugResource.
1962    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1963        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1964        Self { client: fidl::client::Client::new(channel, protocol_name) }
1965    }
1966
1967    /// Get a Stream of events from the remote end of the protocol.
1968    ///
1969    /// # Panics
1970    ///
1971    /// Panics if the event stream was already taken.
1972    pub fn take_event_stream(&self) -> DebugResourceEventStream {
1973        DebugResourceEventStream { event_receiver: self.client.take_event_receiver() }
1974    }
1975
1976    /// Get a debug resource handle.
1977    pub fn r#get(
1978        &self,
1979    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
1980    {
1981        DebugResourceProxyInterface::r#get(self)
1982    }
1983}
1984
1985impl DebugResourceProxyInterface for DebugResourceProxy {
1986    type GetResponseFut = fidl::client::QueryResponseFut<
1987        fidl::Resource,
1988        fidl::encoding::DefaultFuchsiaResourceDialect,
1989    >;
1990    fn r#get(&self) -> Self::GetResponseFut {
1991        fn _decode(
1992            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1993        ) -> Result<fidl::Resource, fidl::Error> {
1994            let _response = fidl::client::decode_transaction_body::<
1995                DebugResourceGetResponse,
1996                fidl::encoding::DefaultFuchsiaResourceDialect,
1997                0x1d79d77ea12a6474,
1998            >(_buf?)?;
1999            Ok(_response.resource)
2000        }
2001        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2002            (),
2003            0x1d79d77ea12a6474,
2004            fidl::encoding::DynamicFlags::empty(),
2005            _decode,
2006        )
2007    }
2008}
2009
2010pub struct DebugResourceEventStream {
2011    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2012}
2013
2014impl std::marker::Unpin for DebugResourceEventStream {}
2015
2016impl futures::stream::FusedStream for DebugResourceEventStream {
2017    fn is_terminated(&self) -> bool {
2018        self.event_receiver.is_terminated()
2019    }
2020}
2021
2022impl futures::Stream for DebugResourceEventStream {
2023    type Item = Result<DebugResourceEvent, fidl::Error>;
2024
2025    fn poll_next(
2026        mut self: std::pin::Pin<&mut Self>,
2027        cx: &mut std::task::Context<'_>,
2028    ) -> std::task::Poll<Option<Self::Item>> {
2029        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2030            &mut self.event_receiver,
2031            cx
2032        )?) {
2033            Some(buf) => std::task::Poll::Ready(Some(DebugResourceEvent::decode(buf))),
2034            None => std::task::Poll::Ready(None),
2035        }
2036    }
2037}
2038
2039#[derive(Debug)]
2040pub enum DebugResourceEvent {}
2041
2042impl DebugResourceEvent {
2043    /// Decodes a message buffer as a [`DebugResourceEvent`].
2044    fn decode(
2045        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2046    ) -> Result<DebugResourceEvent, fidl::Error> {
2047        let (bytes, _handles) = buf.split_mut();
2048        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2049        debug_assert_eq!(tx_header.tx_id, 0);
2050        match tx_header.ordinal {
2051            _ => Err(fidl::Error::UnknownOrdinal {
2052                ordinal: tx_header.ordinal,
2053                protocol_name: <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2054            }),
2055        }
2056    }
2057}
2058
2059/// A Stream of incoming requests for fuchsia.kernel/DebugResource.
2060pub struct DebugResourceRequestStream {
2061    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2062    is_terminated: bool,
2063}
2064
2065impl std::marker::Unpin for DebugResourceRequestStream {}
2066
2067impl futures::stream::FusedStream for DebugResourceRequestStream {
2068    fn is_terminated(&self) -> bool {
2069        self.is_terminated
2070    }
2071}
2072
2073impl fidl::endpoints::RequestStream for DebugResourceRequestStream {
2074    type Protocol = DebugResourceMarker;
2075    type ControlHandle = DebugResourceControlHandle;
2076
2077    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2078        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2079    }
2080
2081    fn control_handle(&self) -> Self::ControlHandle {
2082        DebugResourceControlHandle { inner: self.inner.clone() }
2083    }
2084
2085    fn into_inner(
2086        self,
2087    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2088    {
2089        (self.inner, self.is_terminated)
2090    }
2091
2092    fn from_inner(
2093        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2094        is_terminated: bool,
2095    ) -> Self {
2096        Self { inner, is_terminated }
2097    }
2098}
2099
2100impl futures::Stream for DebugResourceRequestStream {
2101    type Item = Result<DebugResourceRequest, fidl::Error>;
2102
2103    fn poll_next(
2104        mut self: std::pin::Pin<&mut Self>,
2105        cx: &mut std::task::Context<'_>,
2106    ) -> std::task::Poll<Option<Self::Item>> {
2107        let this = &mut *self;
2108        if this.inner.check_shutdown(cx) {
2109            this.is_terminated = true;
2110            return std::task::Poll::Ready(None);
2111        }
2112        if this.is_terminated {
2113            panic!("polled DebugResourceRequestStream after completion");
2114        }
2115        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2116            |bytes, handles| {
2117                match this.inner.channel().read_etc(cx, bytes, handles) {
2118                    std::task::Poll::Ready(Ok(())) => {}
2119                    std::task::Poll::Pending => return std::task::Poll::Pending,
2120                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2121                        this.is_terminated = true;
2122                        return std::task::Poll::Ready(None);
2123                    }
2124                    std::task::Poll::Ready(Err(e)) => {
2125                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2126                            e.into(),
2127                        ))));
2128                    }
2129                }
2130
2131                // A message has been received from the channel
2132                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2133
2134                std::task::Poll::Ready(Some(match header.ordinal {
2135                    0x1d79d77ea12a6474 => {
2136                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2137                        let mut req = fidl::new_empty!(
2138                            fidl::encoding::EmptyPayload,
2139                            fidl::encoding::DefaultFuchsiaResourceDialect
2140                        );
2141                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2142                        let control_handle =
2143                            DebugResourceControlHandle { inner: this.inner.clone() };
2144                        Ok(DebugResourceRequest::Get {
2145                            responder: DebugResourceGetResponder {
2146                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2147                                tx_id: header.tx_id,
2148                            },
2149                        })
2150                    }
2151                    _ => Err(fidl::Error::UnknownOrdinal {
2152                        ordinal: header.ordinal,
2153                        protocol_name:
2154                            <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2155                    }),
2156                }))
2157            },
2158        )
2159    }
2160}
2161
2162/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2163/// `ZX_RSRC_SYSTEM_DEBUG_BASE`.
2164#[derive(Debug)]
2165pub enum DebugResourceRequest {
2166    /// Get a debug resource handle.
2167    Get { responder: DebugResourceGetResponder },
2168}
2169
2170impl DebugResourceRequest {
2171    #[allow(irrefutable_let_patterns)]
2172    pub fn into_get(self) -> Option<(DebugResourceGetResponder)> {
2173        if let DebugResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2174    }
2175
2176    /// Name of the method defined in FIDL
2177    pub fn method_name(&self) -> &'static str {
2178        match *self {
2179            DebugResourceRequest::Get { .. } => "get",
2180        }
2181    }
2182}
2183
2184#[derive(Debug, Clone)]
2185pub struct DebugResourceControlHandle {
2186    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2187}
2188
2189impl DebugResourceControlHandle {
2190    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2191        self.inner.shutdown_with_epitaph(status.into())
2192    }
2193}
2194
2195impl fidl::endpoints::ControlHandle for DebugResourceControlHandle {
2196    fn shutdown(&self) {
2197        self.inner.shutdown()
2198    }
2199
2200    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2201        self.inner.shutdown_with_epitaph(status)
2202    }
2203
2204    fn is_closed(&self) -> bool {
2205        self.inner.channel().is_closed()
2206    }
2207    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2208        self.inner.channel().on_closed()
2209    }
2210
2211    #[cfg(target_os = "fuchsia")]
2212    fn signal_peer(
2213        &self,
2214        clear_mask: zx::Signals,
2215        set_mask: zx::Signals,
2216    ) -> Result<(), zx_status::Status> {
2217        use fidl::Peered;
2218        self.inner.channel().signal_peer(clear_mask, set_mask)
2219    }
2220}
2221
2222impl DebugResourceControlHandle {}
2223
2224#[must_use = "FIDL methods require a response to be sent"]
2225#[derive(Debug)]
2226pub struct DebugResourceGetResponder {
2227    control_handle: std::mem::ManuallyDrop<DebugResourceControlHandle>,
2228    tx_id: u32,
2229}
2230
2231/// Set the the channel to be shutdown (see [`DebugResourceControlHandle::shutdown`])
2232/// if the responder is dropped without sending a response, so that the client
2233/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2234impl std::ops::Drop for DebugResourceGetResponder {
2235    fn drop(&mut self) {
2236        self.control_handle.shutdown();
2237        // Safety: drops once, never accessed again
2238        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2239    }
2240}
2241
2242impl fidl::endpoints::Responder for DebugResourceGetResponder {
2243    type ControlHandle = DebugResourceControlHandle;
2244
2245    fn control_handle(&self) -> &DebugResourceControlHandle {
2246        &self.control_handle
2247    }
2248
2249    fn drop_without_shutdown(mut self) {
2250        // Safety: drops once, never accessed again due to mem::forget
2251        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2252        // Prevent Drop from running (which would shut down the channel)
2253        std::mem::forget(self);
2254    }
2255}
2256
2257impl DebugResourceGetResponder {
2258    /// Sends a response to the FIDL transaction.
2259    ///
2260    /// Sets the channel to shutdown if an error occurs.
2261    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2262        let _result = self.send_raw(resource);
2263        if _result.is_err() {
2264            self.control_handle.shutdown();
2265        }
2266        self.drop_without_shutdown();
2267        _result
2268    }
2269
2270    /// Similar to "send" but does not shutdown the channel if an error occurs.
2271    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2272        let _result = self.send_raw(resource);
2273        self.drop_without_shutdown();
2274        _result
2275    }
2276
2277    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2278        self.control_handle.inner.send::<DebugResourceGetResponse>(
2279            (resource,),
2280            self.tx_id,
2281            0x1d79d77ea12a6474,
2282            fidl::encoding::DynamicFlags::empty(),
2283        )
2284    }
2285}
2286
2287#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2288pub struct DebuglogResourceMarker;
2289
2290impl fidl::endpoints::ProtocolMarker for DebuglogResourceMarker {
2291    type Proxy = DebuglogResourceProxy;
2292    type RequestStream = DebuglogResourceRequestStream;
2293    #[cfg(target_os = "fuchsia")]
2294    type SynchronousProxy = DebuglogResourceSynchronousProxy;
2295
2296    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebuglogResource";
2297}
2298impl fidl::endpoints::DiscoverableProtocolMarker for DebuglogResourceMarker {}
2299
2300pub trait DebuglogResourceProxyInterface: Send + Sync {
2301    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2302    fn r#get(&self) -> Self::GetResponseFut;
2303}
2304#[derive(Debug)]
2305#[cfg(target_os = "fuchsia")]
2306pub struct DebuglogResourceSynchronousProxy {
2307    client: fidl::client::sync::Client,
2308}
2309
2310#[cfg(target_os = "fuchsia")]
2311impl fidl::endpoints::SynchronousProxy for DebuglogResourceSynchronousProxy {
2312    type Proxy = DebuglogResourceProxy;
2313    type Protocol = DebuglogResourceMarker;
2314
2315    fn from_channel(inner: fidl::Channel) -> Self {
2316        Self::new(inner)
2317    }
2318
2319    fn into_channel(self) -> fidl::Channel {
2320        self.client.into_channel()
2321    }
2322
2323    fn as_channel(&self) -> &fidl::Channel {
2324        self.client.as_channel()
2325    }
2326}
2327
2328#[cfg(target_os = "fuchsia")]
2329impl DebuglogResourceSynchronousProxy {
2330    pub fn new(channel: fidl::Channel) -> Self {
2331        Self { client: fidl::client::sync::Client::new(channel) }
2332    }
2333
2334    pub fn into_channel(self) -> fidl::Channel {
2335        self.client.into_channel()
2336    }
2337
2338    /// Waits until an event arrives and returns it. It is safe for other
2339    /// threads to make concurrent requests while waiting for an event.
2340    pub fn wait_for_event(
2341        &self,
2342        deadline: zx::MonotonicInstant,
2343    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2344        DebuglogResourceEvent::decode(
2345            self.client.wait_for_event::<DebuglogResourceMarker>(deadline)?,
2346        )
2347    }
2348
2349    /// Get a debuglog resource handle.
2350    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2351        let _response = self.client.send_query::<
2352            fidl::encoding::EmptyPayload,
2353            DebuglogResourceGetResponse,
2354            DebuglogResourceMarker,
2355        >(
2356            (),
2357            0x6e78c1ff74765225,
2358            fidl::encoding::DynamicFlags::empty(),
2359            ___deadline,
2360        )?;
2361        Ok(_response.resource)
2362    }
2363}
2364
2365#[cfg(target_os = "fuchsia")]
2366impl From<DebuglogResourceSynchronousProxy> for zx::NullableHandle {
2367    fn from(value: DebuglogResourceSynchronousProxy) -> Self {
2368        value.into_channel().into()
2369    }
2370}
2371
2372#[cfg(target_os = "fuchsia")]
2373impl From<fidl::Channel> for DebuglogResourceSynchronousProxy {
2374    fn from(value: fidl::Channel) -> Self {
2375        Self::new(value)
2376    }
2377}
2378
2379#[cfg(target_os = "fuchsia")]
2380impl fidl::endpoints::FromClient for DebuglogResourceSynchronousProxy {
2381    type Protocol = DebuglogResourceMarker;
2382
2383    fn from_client(value: fidl::endpoints::ClientEnd<DebuglogResourceMarker>) -> Self {
2384        Self::new(value.into_channel())
2385    }
2386}
2387
2388#[derive(Debug, Clone)]
2389pub struct DebuglogResourceProxy {
2390    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2391}
2392
2393impl fidl::endpoints::Proxy for DebuglogResourceProxy {
2394    type Protocol = DebuglogResourceMarker;
2395
2396    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2397        Self::new(inner)
2398    }
2399
2400    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2401        self.client.into_channel().map_err(|client| Self { client })
2402    }
2403
2404    fn as_channel(&self) -> &::fidl::AsyncChannel {
2405        self.client.as_channel()
2406    }
2407}
2408
2409impl DebuglogResourceProxy {
2410    /// Create a new Proxy for fuchsia.kernel/DebuglogResource.
2411    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2412        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2413        Self { client: fidl::client::Client::new(channel, protocol_name) }
2414    }
2415
2416    /// Get a Stream of events from the remote end of the protocol.
2417    ///
2418    /// # Panics
2419    ///
2420    /// Panics if the event stream was already taken.
2421    pub fn take_event_stream(&self) -> DebuglogResourceEventStream {
2422        DebuglogResourceEventStream { event_receiver: self.client.take_event_receiver() }
2423    }
2424
2425    /// Get a debuglog resource handle.
2426    pub fn r#get(
2427        &self,
2428    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2429    {
2430        DebuglogResourceProxyInterface::r#get(self)
2431    }
2432}
2433
2434impl DebuglogResourceProxyInterface for DebuglogResourceProxy {
2435    type GetResponseFut = fidl::client::QueryResponseFut<
2436        fidl::Resource,
2437        fidl::encoding::DefaultFuchsiaResourceDialect,
2438    >;
2439    fn r#get(&self) -> Self::GetResponseFut {
2440        fn _decode(
2441            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2442        ) -> Result<fidl::Resource, fidl::Error> {
2443            let _response = fidl::client::decode_transaction_body::<
2444                DebuglogResourceGetResponse,
2445                fidl::encoding::DefaultFuchsiaResourceDialect,
2446                0x6e78c1ff74765225,
2447            >(_buf?)?;
2448            Ok(_response.resource)
2449        }
2450        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2451            (),
2452            0x6e78c1ff74765225,
2453            fidl::encoding::DynamicFlags::empty(),
2454            _decode,
2455        )
2456    }
2457}
2458
2459pub struct DebuglogResourceEventStream {
2460    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2461}
2462
2463impl std::marker::Unpin for DebuglogResourceEventStream {}
2464
2465impl futures::stream::FusedStream for DebuglogResourceEventStream {
2466    fn is_terminated(&self) -> bool {
2467        self.event_receiver.is_terminated()
2468    }
2469}
2470
2471impl futures::Stream for DebuglogResourceEventStream {
2472    type Item = Result<DebuglogResourceEvent, fidl::Error>;
2473
2474    fn poll_next(
2475        mut self: std::pin::Pin<&mut Self>,
2476        cx: &mut std::task::Context<'_>,
2477    ) -> std::task::Poll<Option<Self::Item>> {
2478        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2479            &mut self.event_receiver,
2480            cx
2481        )?) {
2482            Some(buf) => std::task::Poll::Ready(Some(DebuglogResourceEvent::decode(buf))),
2483            None => std::task::Poll::Ready(None),
2484        }
2485    }
2486}
2487
2488#[derive(Debug)]
2489pub enum DebuglogResourceEvent {}
2490
2491impl DebuglogResourceEvent {
2492    /// Decodes a message buffer as a [`DebuglogResourceEvent`].
2493    fn decode(
2494        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2495    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2496        let (bytes, _handles) = buf.split_mut();
2497        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2498        debug_assert_eq!(tx_header.tx_id, 0);
2499        match tx_header.ordinal {
2500            _ => Err(fidl::Error::UnknownOrdinal {
2501                ordinal: tx_header.ordinal,
2502                protocol_name:
2503                    <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2504            }),
2505        }
2506    }
2507}
2508
2509/// A Stream of incoming requests for fuchsia.kernel/DebuglogResource.
2510pub struct DebuglogResourceRequestStream {
2511    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2512    is_terminated: bool,
2513}
2514
2515impl std::marker::Unpin for DebuglogResourceRequestStream {}
2516
2517impl futures::stream::FusedStream for DebuglogResourceRequestStream {
2518    fn is_terminated(&self) -> bool {
2519        self.is_terminated
2520    }
2521}
2522
2523impl fidl::endpoints::RequestStream for DebuglogResourceRequestStream {
2524    type Protocol = DebuglogResourceMarker;
2525    type ControlHandle = DebuglogResourceControlHandle;
2526
2527    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2528        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2529    }
2530
2531    fn control_handle(&self) -> Self::ControlHandle {
2532        DebuglogResourceControlHandle { inner: self.inner.clone() }
2533    }
2534
2535    fn into_inner(
2536        self,
2537    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2538    {
2539        (self.inner, self.is_terminated)
2540    }
2541
2542    fn from_inner(
2543        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2544        is_terminated: bool,
2545    ) -> Self {
2546        Self { inner, is_terminated }
2547    }
2548}
2549
2550impl futures::Stream for DebuglogResourceRequestStream {
2551    type Item = Result<DebuglogResourceRequest, fidl::Error>;
2552
2553    fn poll_next(
2554        mut self: std::pin::Pin<&mut Self>,
2555        cx: &mut std::task::Context<'_>,
2556    ) -> std::task::Poll<Option<Self::Item>> {
2557        let this = &mut *self;
2558        if this.inner.check_shutdown(cx) {
2559            this.is_terminated = true;
2560            return std::task::Poll::Ready(None);
2561        }
2562        if this.is_terminated {
2563            panic!("polled DebuglogResourceRequestStream after completion");
2564        }
2565        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2566            |bytes, handles| {
2567                match this.inner.channel().read_etc(cx, bytes, handles) {
2568                    std::task::Poll::Ready(Ok(())) => {}
2569                    std::task::Poll::Pending => return std::task::Poll::Pending,
2570                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2571                        this.is_terminated = true;
2572                        return std::task::Poll::Ready(None);
2573                    }
2574                    std::task::Poll::Ready(Err(e)) => {
2575                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2576                            e.into(),
2577                        ))));
2578                    }
2579                }
2580
2581                // A message has been received from the channel
2582                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2583
2584                std::task::Poll::Ready(Some(match header.ordinal {
2585                    0x6e78c1ff74765225 => {
2586                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2587                        let mut req = fidl::new_empty!(
2588                            fidl::encoding::EmptyPayload,
2589                            fidl::encoding::DefaultFuchsiaResourceDialect
2590                        );
2591                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2592                        let control_handle =
2593                            DebuglogResourceControlHandle { inner: this.inner.clone() };
2594                        Ok(DebuglogResourceRequest::Get {
2595                            responder: DebuglogResourceGetResponder {
2596                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2597                                tx_id: header.tx_id,
2598                            },
2599                        })
2600                    }
2601                    _ => Err(fidl::Error::UnknownOrdinal {
2602                        ordinal: header.ordinal,
2603                        protocol_name:
2604                            <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2605                    }),
2606                }))
2607            },
2608        )
2609    }
2610}
2611
2612/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2613/// `ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
2614#[derive(Debug)]
2615pub enum DebuglogResourceRequest {
2616    /// Get a debuglog resource handle.
2617    Get { responder: DebuglogResourceGetResponder },
2618}
2619
2620impl DebuglogResourceRequest {
2621    #[allow(irrefutable_let_patterns)]
2622    pub fn into_get(self) -> Option<(DebuglogResourceGetResponder)> {
2623        if let DebuglogResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2624    }
2625
2626    /// Name of the method defined in FIDL
2627    pub fn method_name(&self) -> &'static str {
2628        match *self {
2629            DebuglogResourceRequest::Get { .. } => "get",
2630        }
2631    }
2632}
2633
2634#[derive(Debug, Clone)]
2635pub struct DebuglogResourceControlHandle {
2636    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2637}
2638
2639impl DebuglogResourceControlHandle {
2640    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2641        self.inner.shutdown_with_epitaph(status.into())
2642    }
2643}
2644
2645impl fidl::endpoints::ControlHandle for DebuglogResourceControlHandle {
2646    fn shutdown(&self) {
2647        self.inner.shutdown()
2648    }
2649
2650    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2651        self.inner.shutdown_with_epitaph(status)
2652    }
2653
2654    fn is_closed(&self) -> bool {
2655        self.inner.channel().is_closed()
2656    }
2657    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2658        self.inner.channel().on_closed()
2659    }
2660
2661    #[cfg(target_os = "fuchsia")]
2662    fn signal_peer(
2663        &self,
2664        clear_mask: zx::Signals,
2665        set_mask: zx::Signals,
2666    ) -> Result<(), zx_status::Status> {
2667        use fidl::Peered;
2668        self.inner.channel().signal_peer(clear_mask, set_mask)
2669    }
2670}
2671
2672impl DebuglogResourceControlHandle {}
2673
2674#[must_use = "FIDL methods require a response to be sent"]
2675#[derive(Debug)]
2676pub struct DebuglogResourceGetResponder {
2677    control_handle: std::mem::ManuallyDrop<DebuglogResourceControlHandle>,
2678    tx_id: u32,
2679}
2680
2681/// Set the the channel to be shutdown (see [`DebuglogResourceControlHandle::shutdown`])
2682/// if the responder is dropped without sending a response, so that the client
2683/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2684impl std::ops::Drop for DebuglogResourceGetResponder {
2685    fn drop(&mut self) {
2686        self.control_handle.shutdown();
2687        // Safety: drops once, never accessed again
2688        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2689    }
2690}
2691
2692impl fidl::endpoints::Responder for DebuglogResourceGetResponder {
2693    type ControlHandle = DebuglogResourceControlHandle;
2694
2695    fn control_handle(&self) -> &DebuglogResourceControlHandle {
2696        &self.control_handle
2697    }
2698
2699    fn drop_without_shutdown(mut self) {
2700        // Safety: drops once, never accessed again due to mem::forget
2701        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2702        // Prevent Drop from running (which would shut down the channel)
2703        std::mem::forget(self);
2704    }
2705}
2706
2707impl DebuglogResourceGetResponder {
2708    /// Sends a response to the FIDL transaction.
2709    ///
2710    /// Sets the channel to shutdown if an error occurs.
2711    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2712        let _result = self.send_raw(resource);
2713        if _result.is_err() {
2714            self.control_handle.shutdown();
2715        }
2716        self.drop_without_shutdown();
2717        _result
2718    }
2719
2720    /// Similar to "send" but does not shutdown the channel if an error occurs.
2721    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2722        let _result = self.send_raw(resource);
2723        self.drop_without_shutdown();
2724        _result
2725    }
2726
2727    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2728        self.control_handle.inner.send::<DebuglogResourceGetResponse>(
2729            (resource,),
2730            self.tx_id,
2731            0x6e78c1ff74765225,
2732            fidl::encoding::DynamicFlags::empty(),
2733        )
2734    }
2735}
2736
2737#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2738pub struct EnergyInfoResourceMarker;
2739
2740impl fidl::endpoints::ProtocolMarker for EnergyInfoResourceMarker {
2741    type Proxy = EnergyInfoResourceProxy;
2742    type RequestStream = EnergyInfoResourceRequestStream;
2743    #[cfg(target_os = "fuchsia")]
2744    type SynchronousProxy = EnergyInfoResourceSynchronousProxy;
2745
2746    const DEBUG_NAME: &'static str = "fuchsia.kernel.EnergyInfoResource";
2747}
2748impl fidl::endpoints::DiscoverableProtocolMarker for EnergyInfoResourceMarker {}
2749
2750pub trait EnergyInfoResourceProxyInterface: Send + Sync {
2751    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2752    fn r#get(&self) -> Self::GetResponseFut;
2753}
2754#[derive(Debug)]
2755#[cfg(target_os = "fuchsia")]
2756pub struct EnergyInfoResourceSynchronousProxy {
2757    client: fidl::client::sync::Client,
2758}
2759
2760#[cfg(target_os = "fuchsia")]
2761impl fidl::endpoints::SynchronousProxy for EnergyInfoResourceSynchronousProxy {
2762    type Proxy = EnergyInfoResourceProxy;
2763    type Protocol = EnergyInfoResourceMarker;
2764
2765    fn from_channel(inner: fidl::Channel) -> Self {
2766        Self::new(inner)
2767    }
2768
2769    fn into_channel(self) -> fidl::Channel {
2770        self.client.into_channel()
2771    }
2772
2773    fn as_channel(&self) -> &fidl::Channel {
2774        self.client.as_channel()
2775    }
2776}
2777
2778#[cfg(target_os = "fuchsia")]
2779impl EnergyInfoResourceSynchronousProxy {
2780    pub fn new(channel: fidl::Channel) -> Self {
2781        Self { client: fidl::client::sync::Client::new(channel) }
2782    }
2783
2784    pub fn into_channel(self) -> fidl::Channel {
2785        self.client.into_channel()
2786    }
2787
2788    /// Waits until an event arrives and returns it. It is safe for other
2789    /// threads to make concurrent requests while waiting for an event.
2790    pub fn wait_for_event(
2791        &self,
2792        deadline: zx::MonotonicInstant,
2793    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2794        EnergyInfoResourceEvent::decode(
2795            self.client.wait_for_event::<EnergyInfoResourceMarker>(deadline)?,
2796        )
2797    }
2798
2799    /// Get an EnergyInfo resource handle.
2800    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2801        let _response = self.client.send_query::<
2802            fidl::encoding::EmptyPayload,
2803            EnergyInfoResourceGetResponse,
2804            EnergyInfoResourceMarker,
2805        >(
2806            (),
2807            0x5f5cc9f0745f61d0,
2808            fidl::encoding::DynamicFlags::empty(),
2809            ___deadline,
2810        )?;
2811        Ok(_response.resource)
2812    }
2813}
2814
2815#[cfg(target_os = "fuchsia")]
2816impl From<EnergyInfoResourceSynchronousProxy> for zx::NullableHandle {
2817    fn from(value: EnergyInfoResourceSynchronousProxy) -> Self {
2818        value.into_channel().into()
2819    }
2820}
2821
2822#[cfg(target_os = "fuchsia")]
2823impl From<fidl::Channel> for EnergyInfoResourceSynchronousProxy {
2824    fn from(value: fidl::Channel) -> Self {
2825        Self::new(value)
2826    }
2827}
2828
2829#[cfg(target_os = "fuchsia")]
2830impl fidl::endpoints::FromClient for EnergyInfoResourceSynchronousProxy {
2831    type Protocol = EnergyInfoResourceMarker;
2832
2833    fn from_client(value: fidl::endpoints::ClientEnd<EnergyInfoResourceMarker>) -> Self {
2834        Self::new(value.into_channel())
2835    }
2836}
2837
2838#[derive(Debug, Clone)]
2839pub struct EnergyInfoResourceProxy {
2840    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2841}
2842
2843impl fidl::endpoints::Proxy for EnergyInfoResourceProxy {
2844    type Protocol = EnergyInfoResourceMarker;
2845
2846    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2847        Self::new(inner)
2848    }
2849
2850    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2851        self.client.into_channel().map_err(|client| Self { client })
2852    }
2853
2854    fn as_channel(&self) -> &::fidl::AsyncChannel {
2855        self.client.as_channel()
2856    }
2857}
2858
2859impl EnergyInfoResourceProxy {
2860    /// Create a new Proxy for fuchsia.kernel/EnergyInfoResource.
2861    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2862        let protocol_name =
2863            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2864        Self { client: fidl::client::Client::new(channel, protocol_name) }
2865    }
2866
2867    /// Get a Stream of events from the remote end of the protocol.
2868    ///
2869    /// # Panics
2870    ///
2871    /// Panics if the event stream was already taken.
2872    pub fn take_event_stream(&self) -> EnergyInfoResourceEventStream {
2873        EnergyInfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
2874    }
2875
2876    /// Get an EnergyInfo resource handle.
2877    pub fn r#get(
2878        &self,
2879    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2880    {
2881        EnergyInfoResourceProxyInterface::r#get(self)
2882    }
2883}
2884
2885impl EnergyInfoResourceProxyInterface for EnergyInfoResourceProxy {
2886    type GetResponseFut = fidl::client::QueryResponseFut<
2887        fidl::Resource,
2888        fidl::encoding::DefaultFuchsiaResourceDialect,
2889    >;
2890    fn r#get(&self) -> Self::GetResponseFut {
2891        fn _decode(
2892            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2893        ) -> Result<fidl::Resource, fidl::Error> {
2894            let _response = fidl::client::decode_transaction_body::<
2895                EnergyInfoResourceGetResponse,
2896                fidl::encoding::DefaultFuchsiaResourceDialect,
2897                0x5f5cc9f0745f61d0,
2898            >(_buf?)?;
2899            Ok(_response.resource)
2900        }
2901        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2902            (),
2903            0x5f5cc9f0745f61d0,
2904            fidl::encoding::DynamicFlags::empty(),
2905            _decode,
2906        )
2907    }
2908}
2909
2910pub struct EnergyInfoResourceEventStream {
2911    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2912}
2913
2914impl std::marker::Unpin for EnergyInfoResourceEventStream {}
2915
2916impl futures::stream::FusedStream for EnergyInfoResourceEventStream {
2917    fn is_terminated(&self) -> bool {
2918        self.event_receiver.is_terminated()
2919    }
2920}
2921
2922impl futures::Stream for EnergyInfoResourceEventStream {
2923    type Item = Result<EnergyInfoResourceEvent, fidl::Error>;
2924
2925    fn poll_next(
2926        mut self: std::pin::Pin<&mut Self>,
2927        cx: &mut std::task::Context<'_>,
2928    ) -> std::task::Poll<Option<Self::Item>> {
2929        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2930            &mut self.event_receiver,
2931            cx
2932        )?) {
2933            Some(buf) => std::task::Poll::Ready(Some(EnergyInfoResourceEvent::decode(buf))),
2934            None => std::task::Poll::Ready(None),
2935        }
2936    }
2937}
2938
2939#[derive(Debug)]
2940pub enum EnergyInfoResourceEvent {}
2941
2942impl EnergyInfoResourceEvent {
2943    /// Decodes a message buffer as a [`EnergyInfoResourceEvent`].
2944    fn decode(
2945        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2946    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2947        let (bytes, _handles) = buf.split_mut();
2948        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2949        debug_assert_eq!(tx_header.tx_id, 0);
2950        match tx_header.ordinal {
2951            _ => Err(fidl::Error::UnknownOrdinal {
2952                ordinal: tx_header.ordinal,
2953                protocol_name:
2954                    <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2955            }),
2956        }
2957    }
2958}
2959
2960/// A Stream of incoming requests for fuchsia.kernel/EnergyInfoResource.
2961pub struct EnergyInfoResourceRequestStream {
2962    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2963    is_terminated: bool,
2964}
2965
2966impl std::marker::Unpin for EnergyInfoResourceRequestStream {}
2967
2968impl futures::stream::FusedStream for EnergyInfoResourceRequestStream {
2969    fn is_terminated(&self) -> bool {
2970        self.is_terminated
2971    }
2972}
2973
2974impl fidl::endpoints::RequestStream for EnergyInfoResourceRequestStream {
2975    type Protocol = EnergyInfoResourceMarker;
2976    type ControlHandle = EnergyInfoResourceControlHandle;
2977
2978    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2979        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2980    }
2981
2982    fn control_handle(&self) -> Self::ControlHandle {
2983        EnergyInfoResourceControlHandle { inner: self.inner.clone() }
2984    }
2985
2986    fn into_inner(
2987        self,
2988    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2989    {
2990        (self.inner, self.is_terminated)
2991    }
2992
2993    fn from_inner(
2994        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2995        is_terminated: bool,
2996    ) -> Self {
2997        Self { inner, is_terminated }
2998    }
2999}
3000
3001impl futures::Stream for EnergyInfoResourceRequestStream {
3002    type Item = Result<EnergyInfoResourceRequest, fidl::Error>;
3003
3004    fn poll_next(
3005        mut self: std::pin::Pin<&mut Self>,
3006        cx: &mut std::task::Context<'_>,
3007    ) -> std::task::Poll<Option<Self::Item>> {
3008        let this = &mut *self;
3009        if this.inner.check_shutdown(cx) {
3010            this.is_terminated = true;
3011            return std::task::Poll::Ready(None);
3012        }
3013        if this.is_terminated {
3014            panic!("polled EnergyInfoResourceRequestStream after completion");
3015        }
3016        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3017            |bytes, handles| {
3018                match this.inner.channel().read_etc(cx, bytes, handles) {
3019                    std::task::Poll::Ready(Ok(())) => {}
3020                    std::task::Poll::Pending => return std::task::Poll::Pending,
3021                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3022                        this.is_terminated = true;
3023                        return std::task::Poll::Ready(None);
3024                    }
3025                    std::task::Poll::Ready(Err(e)) => {
3026                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3027                            e.into(),
3028                        ))));
3029                    }
3030                }
3031
3032                // A message has been received from the channel
3033                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3034
3035                std::task::Poll::Ready(Some(match header.ordinal {
3036                0x5f5cc9f0745f61d0 => {
3037                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3038                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3039                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3040                    let control_handle = EnergyInfoResourceControlHandle {
3041                        inner: this.inner.clone(),
3042                    };
3043                    Ok(EnergyInfoResourceRequest::Get {
3044                        responder: EnergyInfoResourceGetResponder {
3045                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3046                            tx_id: header.tx_id,
3047                        },
3048                    })
3049                }
3050                _ => Err(fidl::Error::UnknownOrdinal {
3051                    ordinal: header.ordinal,
3052                    protocol_name: <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3053                }),
3054            }))
3055            },
3056        )
3057    }
3058}
3059
3060/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3061/// `ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
3062#[derive(Debug)]
3063pub enum EnergyInfoResourceRequest {
3064    /// Get an EnergyInfo resource handle.
3065    Get { responder: EnergyInfoResourceGetResponder },
3066}
3067
3068impl EnergyInfoResourceRequest {
3069    #[allow(irrefutable_let_patterns)]
3070    pub fn into_get(self) -> Option<(EnergyInfoResourceGetResponder)> {
3071        if let EnergyInfoResourceRequest::Get { responder } = self {
3072            Some((responder))
3073        } else {
3074            None
3075        }
3076    }
3077
3078    /// Name of the method defined in FIDL
3079    pub fn method_name(&self) -> &'static str {
3080        match *self {
3081            EnergyInfoResourceRequest::Get { .. } => "get",
3082        }
3083    }
3084}
3085
3086#[derive(Debug, Clone)]
3087pub struct EnergyInfoResourceControlHandle {
3088    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3089}
3090
3091impl EnergyInfoResourceControlHandle {
3092    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3093        self.inner.shutdown_with_epitaph(status.into())
3094    }
3095}
3096
3097impl fidl::endpoints::ControlHandle for EnergyInfoResourceControlHandle {
3098    fn shutdown(&self) {
3099        self.inner.shutdown()
3100    }
3101
3102    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3103        self.inner.shutdown_with_epitaph(status)
3104    }
3105
3106    fn is_closed(&self) -> bool {
3107        self.inner.channel().is_closed()
3108    }
3109    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3110        self.inner.channel().on_closed()
3111    }
3112
3113    #[cfg(target_os = "fuchsia")]
3114    fn signal_peer(
3115        &self,
3116        clear_mask: zx::Signals,
3117        set_mask: zx::Signals,
3118    ) -> Result<(), zx_status::Status> {
3119        use fidl::Peered;
3120        self.inner.channel().signal_peer(clear_mask, set_mask)
3121    }
3122}
3123
3124impl EnergyInfoResourceControlHandle {}
3125
3126#[must_use = "FIDL methods require a response to be sent"]
3127#[derive(Debug)]
3128pub struct EnergyInfoResourceGetResponder {
3129    control_handle: std::mem::ManuallyDrop<EnergyInfoResourceControlHandle>,
3130    tx_id: u32,
3131}
3132
3133/// Set the the channel to be shutdown (see [`EnergyInfoResourceControlHandle::shutdown`])
3134/// if the responder is dropped without sending a response, so that the client
3135/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3136impl std::ops::Drop for EnergyInfoResourceGetResponder {
3137    fn drop(&mut self) {
3138        self.control_handle.shutdown();
3139        // Safety: drops once, never accessed again
3140        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3141    }
3142}
3143
3144impl fidl::endpoints::Responder for EnergyInfoResourceGetResponder {
3145    type ControlHandle = EnergyInfoResourceControlHandle;
3146
3147    fn control_handle(&self) -> &EnergyInfoResourceControlHandle {
3148        &self.control_handle
3149    }
3150
3151    fn drop_without_shutdown(mut self) {
3152        // Safety: drops once, never accessed again due to mem::forget
3153        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3154        // Prevent Drop from running (which would shut down the channel)
3155        std::mem::forget(self);
3156    }
3157}
3158
3159impl EnergyInfoResourceGetResponder {
3160    /// Sends a response to the FIDL transaction.
3161    ///
3162    /// Sets the channel to shutdown if an error occurs.
3163    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3164        let _result = self.send_raw(resource);
3165        if _result.is_err() {
3166            self.control_handle.shutdown();
3167        }
3168        self.drop_without_shutdown();
3169        _result
3170    }
3171
3172    /// Similar to "send" but does not shutdown the channel if an error occurs.
3173    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3174        let _result = self.send_raw(resource);
3175        self.drop_without_shutdown();
3176        _result
3177    }
3178
3179    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3180        self.control_handle.inner.send::<EnergyInfoResourceGetResponse>(
3181            (resource,),
3182            self.tx_id,
3183            0x5f5cc9f0745f61d0,
3184            fidl::encoding::DynamicFlags::empty(),
3185        )
3186    }
3187}
3188
3189#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3190pub struct HypervisorResourceMarker;
3191
3192impl fidl::endpoints::ProtocolMarker for HypervisorResourceMarker {
3193    type Proxy = HypervisorResourceProxy;
3194    type RequestStream = HypervisorResourceRequestStream;
3195    #[cfg(target_os = "fuchsia")]
3196    type SynchronousProxy = HypervisorResourceSynchronousProxy;
3197
3198    const DEBUG_NAME: &'static str = "fuchsia.kernel.HypervisorResource";
3199}
3200impl fidl::endpoints::DiscoverableProtocolMarker for HypervisorResourceMarker {}
3201
3202pub trait HypervisorResourceProxyInterface: Send + Sync {
3203    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3204    fn r#get(&self) -> Self::GetResponseFut;
3205}
3206#[derive(Debug)]
3207#[cfg(target_os = "fuchsia")]
3208pub struct HypervisorResourceSynchronousProxy {
3209    client: fidl::client::sync::Client,
3210}
3211
3212#[cfg(target_os = "fuchsia")]
3213impl fidl::endpoints::SynchronousProxy for HypervisorResourceSynchronousProxy {
3214    type Proxy = HypervisorResourceProxy;
3215    type Protocol = HypervisorResourceMarker;
3216
3217    fn from_channel(inner: fidl::Channel) -> Self {
3218        Self::new(inner)
3219    }
3220
3221    fn into_channel(self) -> fidl::Channel {
3222        self.client.into_channel()
3223    }
3224
3225    fn as_channel(&self) -> &fidl::Channel {
3226        self.client.as_channel()
3227    }
3228}
3229
3230#[cfg(target_os = "fuchsia")]
3231impl HypervisorResourceSynchronousProxy {
3232    pub fn new(channel: fidl::Channel) -> Self {
3233        Self { client: fidl::client::sync::Client::new(channel) }
3234    }
3235
3236    pub fn into_channel(self) -> fidl::Channel {
3237        self.client.into_channel()
3238    }
3239
3240    /// Waits until an event arrives and returns it. It is safe for other
3241    /// threads to make concurrent requests while waiting for an event.
3242    pub fn wait_for_event(
3243        &self,
3244        deadline: zx::MonotonicInstant,
3245    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3246        HypervisorResourceEvent::decode(
3247            self.client.wait_for_event::<HypervisorResourceMarker>(deadline)?,
3248        )
3249    }
3250
3251    /// Get a hypervisor resource handle.
3252    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3253        let _response = self.client.send_query::<
3254            fidl::encoding::EmptyPayload,
3255            HypervisorResourceGetResponse,
3256            HypervisorResourceMarker,
3257        >(
3258            (),
3259            0x1c312131d3b824a2,
3260            fidl::encoding::DynamicFlags::empty(),
3261            ___deadline,
3262        )?;
3263        Ok(_response.resource)
3264    }
3265}
3266
3267#[cfg(target_os = "fuchsia")]
3268impl From<HypervisorResourceSynchronousProxy> for zx::NullableHandle {
3269    fn from(value: HypervisorResourceSynchronousProxy) -> Self {
3270        value.into_channel().into()
3271    }
3272}
3273
3274#[cfg(target_os = "fuchsia")]
3275impl From<fidl::Channel> for HypervisorResourceSynchronousProxy {
3276    fn from(value: fidl::Channel) -> Self {
3277        Self::new(value)
3278    }
3279}
3280
3281#[cfg(target_os = "fuchsia")]
3282impl fidl::endpoints::FromClient for HypervisorResourceSynchronousProxy {
3283    type Protocol = HypervisorResourceMarker;
3284
3285    fn from_client(value: fidl::endpoints::ClientEnd<HypervisorResourceMarker>) -> Self {
3286        Self::new(value.into_channel())
3287    }
3288}
3289
3290#[derive(Debug, Clone)]
3291pub struct HypervisorResourceProxy {
3292    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3293}
3294
3295impl fidl::endpoints::Proxy for HypervisorResourceProxy {
3296    type Protocol = HypervisorResourceMarker;
3297
3298    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3299        Self::new(inner)
3300    }
3301
3302    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3303        self.client.into_channel().map_err(|client| Self { client })
3304    }
3305
3306    fn as_channel(&self) -> &::fidl::AsyncChannel {
3307        self.client.as_channel()
3308    }
3309}
3310
3311impl HypervisorResourceProxy {
3312    /// Create a new Proxy for fuchsia.kernel/HypervisorResource.
3313    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3314        let protocol_name =
3315            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3316        Self { client: fidl::client::Client::new(channel, protocol_name) }
3317    }
3318
3319    /// Get a Stream of events from the remote end of the protocol.
3320    ///
3321    /// # Panics
3322    ///
3323    /// Panics if the event stream was already taken.
3324    pub fn take_event_stream(&self) -> HypervisorResourceEventStream {
3325        HypervisorResourceEventStream { event_receiver: self.client.take_event_receiver() }
3326    }
3327
3328    /// Get a hypervisor resource handle.
3329    pub fn r#get(
3330        &self,
3331    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3332    {
3333        HypervisorResourceProxyInterface::r#get(self)
3334    }
3335}
3336
3337impl HypervisorResourceProxyInterface for HypervisorResourceProxy {
3338    type GetResponseFut = fidl::client::QueryResponseFut<
3339        fidl::Resource,
3340        fidl::encoding::DefaultFuchsiaResourceDialect,
3341    >;
3342    fn r#get(&self) -> Self::GetResponseFut {
3343        fn _decode(
3344            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3345        ) -> Result<fidl::Resource, fidl::Error> {
3346            let _response = fidl::client::decode_transaction_body::<
3347                HypervisorResourceGetResponse,
3348                fidl::encoding::DefaultFuchsiaResourceDialect,
3349                0x1c312131d3b824a2,
3350            >(_buf?)?;
3351            Ok(_response.resource)
3352        }
3353        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3354            (),
3355            0x1c312131d3b824a2,
3356            fidl::encoding::DynamicFlags::empty(),
3357            _decode,
3358        )
3359    }
3360}
3361
3362pub struct HypervisorResourceEventStream {
3363    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3364}
3365
3366impl std::marker::Unpin for HypervisorResourceEventStream {}
3367
3368impl futures::stream::FusedStream for HypervisorResourceEventStream {
3369    fn is_terminated(&self) -> bool {
3370        self.event_receiver.is_terminated()
3371    }
3372}
3373
3374impl futures::Stream for HypervisorResourceEventStream {
3375    type Item = Result<HypervisorResourceEvent, fidl::Error>;
3376
3377    fn poll_next(
3378        mut self: std::pin::Pin<&mut Self>,
3379        cx: &mut std::task::Context<'_>,
3380    ) -> std::task::Poll<Option<Self::Item>> {
3381        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3382            &mut self.event_receiver,
3383            cx
3384        )?) {
3385            Some(buf) => std::task::Poll::Ready(Some(HypervisorResourceEvent::decode(buf))),
3386            None => std::task::Poll::Ready(None),
3387        }
3388    }
3389}
3390
3391#[derive(Debug)]
3392pub enum HypervisorResourceEvent {}
3393
3394impl HypervisorResourceEvent {
3395    /// Decodes a message buffer as a [`HypervisorResourceEvent`].
3396    fn decode(
3397        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3398    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3399        let (bytes, _handles) = buf.split_mut();
3400        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3401        debug_assert_eq!(tx_header.tx_id, 0);
3402        match tx_header.ordinal {
3403            _ => Err(fidl::Error::UnknownOrdinal {
3404                ordinal: tx_header.ordinal,
3405                protocol_name:
3406                    <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3407            }),
3408        }
3409    }
3410}
3411
3412/// A Stream of incoming requests for fuchsia.kernel/HypervisorResource.
3413pub struct HypervisorResourceRequestStream {
3414    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3415    is_terminated: bool,
3416}
3417
3418impl std::marker::Unpin for HypervisorResourceRequestStream {}
3419
3420impl futures::stream::FusedStream for HypervisorResourceRequestStream {
3421    fn is_terminated(&self) -> bool {
3422        self.is_terminated
3423    }
3424}
3425
3426impl fidl::endpoints::RequestStream for HypervisorResourceRequestStream {
3427    type Protocol = HypervisorResourceMarker;
3428    type ControlHandle = HypervisorResourceControlHandle;
3429
3430    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3431        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3432    }
3433
3434    fn control_handle(&self) -> Self::ControlHandle {
3435        HypervisorResourceControlHandle { inner: self.inner.clone() }
3436    }
3437
3438    fn into_inner(
3439        self,
3440    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3441    {
3442        (self.inner, self.is_terminated)
3443    }
3444
3445    fn from_inner(
3446        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3447        is_terminated: bool,
3448    ) -> Self {
3449        Self { inner, is_terminated }
3450    }
3451}
3452
3453impl futures::Stream for HypervisorResourceRequestStream {
3454    type Item = Result<HypervisorResourceRequest, fidl::Error>;
3455
3456    fn poll_next(
3457        mut self: std::pin::Pin<&mut Self>,
3458        cx: &mut std::task::Context<'_>,
3459    ) -> std::task::Poll<Option<Self::Item>> {
3460        let this = &mut *self;
3461        if this.inner.check_shutdown(cx) {
3462            this.is_terminated = true;
3463            return std::task::Poll::Ready(None);
3464        }
3465        if this.is_terminated {
3466            panic!("polled HypervisorResourceRequestStream after completion");
3467        }
3468        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3469            |bytes, handles| {
3470                match this.inner.channel().read_etc(cx, bytes, handles) {
3471                    std::task::Poll::Ready(Ok(())) => {}
3472                    std::task::Poll::Pending => return std::task::Poll::Pending,
3473                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3474                        this.is_terminated = true;
3475                        return std::task::Poll::Ready(None);
3476                    }
3477                    std::task::Poll::Ready(Err(e)) => {
3478                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3479                            e.into(),
3480                        ))));
3481                    }
3482                }
3483
3484                // A message has been received from the channel
3485                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3486
3487                std::task::Poll::Ready(Some(match header.ordinal {
3488                0x1c312131d3b824a2 => {
3489                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3490                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3491                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3492                    let control_handle = HypervisorResourceControlHandle {
3493                        inner: this.inner.clone(),
3494                    };
3495                    Ok(HypervisorResourceRequest::Get {
3496                        responder: HypervisorResourceGetResponder {
3497                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3498                            tx_id: header.tx_id,
3499                        },
3500                    })
3501                }
3502                _ => Err(fidl::Error::UnknownOrdinal {
3503                    ordinal: header.ordinal,
3504                    protocol_name: <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3505                }),
3506            }))
3507            },
3508        )
3509    }
3510}
3511
3512/// Protocol for providing the hypervisor resource.
3513#[derive(Debug)]
3514pub enum HypervisorResourceRequest {
3515    /// Get a hypervisor resource handle.
3516    Get { responder: HypervisorResourceGetResponder },
3517}
3518
3519impl HypervisorResourceRequest {
3520    #[allow(irrefutable_let_patterns)]
3521    pub fn into_get(self) -> Option<(HypervisorResourceGetResponder)> {
3522        if let HypervisorResourceRequest::Get { responder } = self {
3523            Some((responder))
3524        } else {
3525            None
3526        }
3527    }
3528
3529    /// Name of the method defined in FIDL
3530    pub fn method_name(&self) -> &'static str {
3531        match *self {
3532            HypervisorResourceRequest::Get { .. } => "get",
3533        }
3534    }
3535}
3536
3537#[derive(Debug, Clone)]
3538pub struct HypervisorResourceControlHandle {
3539    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3540}
3541
3542impl HypervisorResourceControlHandle {
3543    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3544        self.inner.shutdown_with_epitaph(status.into())
3545    }
3546}
3547
3548impl fidl::endpoints::ControlHandle for HypervisorResourceControlHandle {
3549    fn shutdown(&self) {
3550        self.inner.shutdown()
3551    }
3552
3553    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3554        self.inner.shutdown_with_epitaph(status)
3555    }
3556
3557    fn is_closed(&self) -> bool {
3558        self.inner.channel().is_closed()
3559    }
3560    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3561        self.inner.channel().on_closed()
3562    }
3563
3564    #[cfg(target_os = "fuchsia")]
3565    fn signal_peer(
3566        &self,
3567        clear_mask: zx::Signals,
3568        set_mask: zx::Signals,
3569    ) -> Result<(), zx_status::Status> {
3570        use fidl::Peered;
3571        self.inner.channel().signal_peer(clear_mask, set_mask)
3572    }
3573}
3574
3575impl HypervisorResourceControlHandle {}
3576
3577#[must_use = "FIDL methods require a response to be sent"]
3578#[derive(Debug)]
3579pub struct HypervisorResourceGetResponder {
3580    control_handle: std::mem::ManuallyDrop<HypervisorResourceControlHandle>,
3581    tx_id: u32,
3582}
3583
3584/// Set the the channel to be shutdown (see [`HypervisorResourceControlHandle::shutdown`])
3585/// if the responder is dropped without sending a response, so that the client
3586/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3587impl std::ops::Drop for HypervisorResourceGetResponder {
3588    fn drop(&mut self) {
3589        self.control_handle.shutdown();
3590        // Safety: drops once, never accessed again
3591        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3592    }
3593}
3594
3595impl fidl::endpoints::Responder for HypervisorResourceGetResponder {
3596    type ControlHandle = HypervisorResourceControlHandle;
3597
3598    fn control_handle(&self) -> &HypervisorResourceControlHandle {
3599        &self.control_handle
3600    }
3601
3602    fn drop_without_shutdown(mut self) {
3603        // Safety: drops once, never accessed again due to mem::forget
3604        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3605        // Prevent Drop from running (which would shut down the channel)
3606        std::mem::forget(self);
3607    }
3608}
3609
3610impl HypervisorResourceGetResponder {
3611    /// Sends a response to the FIDL transaction.
3612    ///
3613    /// Sets the channel to shutdown if an error occurs.
3614    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3615        let _result = self.send_raw(resource);
3616        if _result.is_err() {
3617            self.control_handle.shutdown();
3618        }
3619        self.drop_without_shutdown();
3620        _result
3621    }
3622
3623    /// Similar to "send" but does not shutdown the channel if an error occurs.
3624    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3625        let _result = self.send_raw(resource);
3626        self.drop_without_shutdown();
3627        _result
3628    }
3629
3630    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3631        self.control_handle.inner.send::<HypervisorResourceGetResponse>(
3632            (resource,),
3633            self.tx_id,
3634            0x1c312131d3b824a2,
3635            fidl::encoding::DynamicFlags::empty(),
3636        )
3637    }
3638}
3639
3640#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3641pub struct InfoResourceMarker;
3642
3643impl fidl::endpoints::ProtocolMarker for InfoResourceMarker {
3644    type Proxy = InfoResourceProxy;
3645    type RequestStream = InfoResourceRequestStream;
3646    #[cfg(target_os = "fuchsia")]
3647    type SynchronousProxy = InfoResourceSynchronousProxy;
3648
3649    const DEBUG_NAME: &'static str = "fuchsia.kernel.InfoResource";
3650}
3651impl fidl::endpoints::DiscoverableProtocolMarker for InfoResourceMarker {}
3652
3653pub trait InfoResourceProxyInterface: Send + Sync {
3654    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3655    fn r#get(&self) -> Self::GetResponseFut;
3656}
3657#[derive(Debug)]
3658#[cfg(target_os = "fuchsia")]
3659pub struct InfoResourceSynchronousProxy {
3660    client: fidl::client::sync::Client,
3661}
3662
3663#[cfg(target_os = "fuchsia")]
3664impl fidl::endpoints::SynchronousProxy for InfoResourceSynchronousProxy {
3665    type Proxy = InfoResourceProxy;
3666    type Protocol = InfoResourceMarker;
3667
3668    fn from_channel(inner: fidl::Channel) -> Self {
3669        Self::new(inner)
3670    }
3671
3672    fn into_channel(self) -> fidl::Channel {
3673        self.client.into_channel()
3674    }
3675
3676    fn as_channel(&self) -> &fidl::Channel {
3677        self.client.as_channel()
3678    }
3679}
3680
3681#[cfg(target_os = "fuchsia")]
3682impl InfoResourceSynchronousProxy {
3683    pub fn new(channel: fidl::Channel) -> Self {
3684        Self { client: fidl::client::sync::Client::new(channel) }
3685    }
3686
3687    pub fn into_channel(self) -> fidl::Channel {
3688        self.client.into_channel()
3689    }
3690
3691    /// Waits until an event arrives and returns it. It is safe for other
3692    /// threads to make concurrent requests while waiting for an event.
3693    pub fn wait_for_event(
3694        &self,
3695        deadline: zx::MonotonicInstant,
3696    ) -> Result<InfoResourceEvent, fidl::Error> {
3697        InfoResourceEvent::decode(self.client.wait_for_event::<InfoResourceMarker>(deadline)?)
3698    }
3699
3700    /// Get an info resource handle.
3701    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3702        let _response = self.client.send_query::<
3703            fidl::encoding::EmptyPayload,
3704            InfoResourceGetResponse,
3705            InfoResourceMarker,
3706        >(
3707            (),
3708            0x1de8edcb4abc2067,
3709            fidl::encoding::DynamicFlags::empty(),
3710            ___deadline,
3711        )?;
3712        Ok(_response.resource)
3713    }
3714}
3715
3716#[cfg(target_os = "fuchsia")]
3717impl From<InfoResourceSynchronousProxy> for zx::NullableHandle {
3718    fn from(value: InfoResourceSynchronousProxy) -> Self {
3719        value.into_channel().into()
3720    }
3721}
3722
3723#[cfg(target_os = "fuchsia")]
3724impl From<fidl::Channel> for InfoResourceSynchronousProxy {
3725    fn from(value: fidl::Channel) -> Self {
3726        Self::new(value)
3727    }
3728}
3729
3730#[cfg(target_os = "fuchsia")]
3731impl fidl::endpoints::FromClient for InfoResourceSynchronousProxy {
3732    type Protocol = InfoResourceMarker;
3733
3734    fn from_client(value: fidl::endpoints::ClientEnd<InfoResourceMarker>) -> Self {
3735        Self::new(value.into_channel())
3736    }
3737}
3738
3739#[derive(Debug, Clone)]
3740pub struct InfoResourceProxy {
3741    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3742}
3743
3744impl fidl::endpoints::Proxy for InfoResourceProxy {
3745    type Protocol = InfoResourceMarker;
3746
3747    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3748        Self::new(inner)
3749    }
3750
3751    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3752        self.client.into_channel().map_err(|client| Self { client })
3753    }
3754
3755    fn as_channel(&self) -> &::fidl::AsyncChannel {
3756        self.client.as_channel()
3757    }
3758}
3759
3760impl InfoResourceProxy {
3761    /// Create a new Proxy for fuchsia.kernel/InfoResource.
3762    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3763        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3764        Self { client: fidl::client::Client::new(channel, protocol_name) }
3765    }
3766
3767    /// Get a Stream of events from the remote end of the protocol.
3768    ///
3769    /// # Panics
3770    ///
3771    /// Panics if the event stream was already taken.
3772    pub fn take_event_stream(&self) -> InfoResourceEventStream {
3773        InfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
3774    }
3775
3776    /// Get an info resource handle.
3777    pub fn r#get(
3778        &self,
3779    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3780    {
3781        InfoResourceProxyInterface::r#get(self)
3782    }
3783}
3784
3785impl InfoResourceProxyInterface for InfoResourceProxy {
3786    type GetResponseFut = fidl::client::QueryResponseFut<
3787        fidl::Resource,
3788        fidl::encoding::DefaultFuchsiaResourceDialect,
3789    >;
3790    fn r#get(&self) -> Self::GetResponseFut {
3791        fn _decode(
3792            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3793        ) -> Result<fidl::Resource, fidl::Error> {
3794            let _response = fidl::client::decode_transaction_body::<
3795                InfoResourceGetResponse,
3796                fidl::encoding::DefaultFuchsiaResourceDialect,
3797                0x1de8edcb4abc2067,
3798            >(_buf?)?;
3799            Ok(_response.resource)
3800        }
3801        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3802            (),
3803            0x1de8edcb4abc2067,
3804            fidl::encoding::DynamicFlags::empty(),
3805            _decode,
3806        )
3807    }
3808}
3809
3810pub struct InfoResourceEventStream {
3811    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3812}
3813
3814impl std::marker::Unpin for InfoResourceEventStream {}
3815
3816impl futures::stream::FusedStream for InfoResourceEventStream {
3817    fn is_terminated(&self) -> bool {
3818        self.event_receiver.is_terminated()
3819    }
3820}
3821
3822impl futures::Stream for InfoResourceEventStream {
3823    type Item = Result<InfoResourceEvent, fidl::Error>;
3824
3825    fn poll_next(
3826        mut self: std::pin::Pin<&mut Self>,
3827        cx: &mut std::task::Context<'_>,
3828    ) -> std::task::Poll<Option<Self::Item>> {
3829        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3830            &mut self.event_receiver,
3831            cx
3832        )?) {
3833            Some(buf) => std::task::Poll::Ready(Some(InfoResourceEvent::decode(buf))),
3834            None => std::task::Poll::Ready(None),
3835        }
3836    }
3837}
3838
3839#[derive(Debug)]
3840pub enum InfoResourceEvent {}
3841
3842impl InfoResourceEvent {
3843    /// Decodes a message buffer as a [`InfoResourceEvent`].
3844    fn decode(
3845        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3846    ) -> Result<InfoResourceEvent, fidl::Error> {
3847        let (bytes, _handles) = buf.split_mut();
3848        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3849        debug_assert_eq!(tx_header.tx_id, 0);
3850        match tx_header.ordinal {
3851            _ => Err(fidl::Error::UnknownOrdinal {
3852                ordinal: tx_header.ordinal,
3853                protocol_name: <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3854            }),
3855        }
3856    }
3857}
3858
3859/// A Stream of incoming requests for fuchsia.kernel/InfoResource.
3860pub struct InfoResourceRequestStream {
3861    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3862    is_terminated: bool,
3863}
3864
3865impl std::marker::Unpin for InfoResourceRequestStream {}
3866
3867impl futures::stream::FusedStream for InfoResourceRequestStream {
3868    fn is_terminated(&self) -> bool {
3869        self.is_terminated
3870    }
3871}
3872
3873impl fidl::endpoints::RequestStream for InfoResourceRequestStream {
3874    type Protocol = InfoResourceMarker;
3875    type ControlHandle = InfoResourceControlHandle;
3876
3877    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3878        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3879    }
3880
3881    fn control_handle(&self) -> Self::ControlHandle {
3882        InfoResourceControlHandle { inner: self.inner.clone() }
3883    }
3884
3885    fn into_inner(
3886        self,
3887    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3888    {
3889        (self.inner, self.is_terminated)
3890    }
3891
3892    fn from_inner(
3893        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3894        is_terminated: bool,
3895    ) -> Self {
3896        Self { inner, is_terminated }
3897    }
3898}
3899
3900impl futures::Stream for InfoResourceRequestStream {
3901    type Item = Result<InfoResourceRequest, fidl::Error>;
3902
3903    fn poll_next(
3904        mut self: std::pin::Pin<&mut Self>,
3905        cx: &mut std::task::Context<'_>,
3906    ) -> std::task::Poll<Option<Self::Item>> {
3907        let this = &mut *self;
3908        if this.inner.check_shutdown(cx) {
3909            this.is_terminated = true;
3910            return std::task::Poll::Ready(None);
3911        }
3912        if this.is_terminated {
3913            panic!("polled InfoResourceRequestStream after completion");
3914        }
3915        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3916            |bytes, handles| {
3917                match this.inner.channel().read_etc(cx, bytes, handles) {
3918                    std::task::Poll::Ready(Ok(())) => {}
3919                    std::task::Poll::Pending => return std::task::Poll::Pending,
3920                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3921                        this.is_terminated = true;
3922                        return std::task::Poll::Ready(None);
3923                    }
3924                    std::task::Poll::Ready(Err(e)) => {
3925                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3926                            e.into(),
3927                        ))));
3928                    }
3929                }
3930
3931                // A message has been received from the channel
3932                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3933
3934                std::task::Poll::Ready(Some(match header.ordinal {
3935                    0x1de8edcb4abc2067 => {
3936                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3937                        let mut req = fidl::new_empty!(
3938                            fidl::encoding::EmptyPayload,
3939                            fidl::encoding::DefaultFuchsiaResourceDialect
3940                        );
3941                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3942                        let control_handle =
3943                            InfoResourceControlHandle { inner: this.inner.clone() };
3944                        Ok(InfoResourceRequest::Get {
3945                            responder: InfoResourceGetResponder {
3946                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3947                                tx_id: header.tx_id,
3948                            },
3949                        })
3950                    }
3951                    _ => Err(fidl::Error::UnknownOrdinal {
3952                        ordinal: header.ordinal,
3953                        protocol_name:
3954                            <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3955                    }),
3956                }))
3957            },
3958        )
3959    }
3960}
3961
3962/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3963/// `ZX_RSRC_SYSTEM_INFO_BASE`.
3964#[derive(Debug)]
3965pub enum InfoResourceRequest {
3966    /// Get an info resource handle.
3967    Get { responder: InfoResourceGetResponder },
3968}
3969
3970impl InfoResourceRequest {
3971    #[allow(irrefutable_let_patterns)]
3972    pub fn into_get(self) -> Option<(InfoResourceGetResponder)> {
3973        if let InfoResourceRequest::Get { responder } = self { Some((responder)) } else { None }
3974    }
3975
3976    /// Name of the method defined in FIDL
3977    pub fn method_name(&self) -> &'static str {
3978        match *self {
3979            InfoResourceRequest::Get { .. } => "get",
3980        }
3981    }
3982}
3983
3984#[derive(Debug, Clone)]
3985pub struct InfoResourceControlHandle {
3986    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3987}
3988
3989impl InfoResourceControlHandle {
3990    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3991        self.inner.shutdown_with_epitaph(status.into())
3992    }
3993}
3994
3995impl fidl::endpoints::ControlHandle for InfoResourceControlHandle {
3996    fn shutdown(&self) {
3997        self.inner.shutdown()
3998    }
3999
4000    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4001        self.inner.shutdown_with_epitaph(status)
4002    }
4003
4004    fn is_closed(&self) -> bool {
4005        self.inner.channel().is_closed()
4006    }
4007    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4008        self.inner.channel().on_closed()
4009    }
4010
4011    #[cfg(target_os = "fuchsia")]
4012    fn signal_peer(
4013        &self,
4014        clear_mask: zx::Signals,
4015        set_mask: zx::Signals,
4016    ) -> Result<(), zx_status::Status> {
4017        use fidl::Peered;
4018        self.inner.channel().signal_peer(clear_mask, set_mask)
4019    }
4020}
4021
4022impl InfoResourceControlHandle {}
4023
4024#[must_use = "FIDL methods require a response to be sent"]
4025#[derive(Debug)]
4026pub struct InfoResourceGetResponder {
4027    control_handle: std::mem::ManuallyDrop<InfoResourceControlHandle>,
4028    tx_id: u32,
4029}
4030
4031/// Set the the channel to be shutdown (see [`InfoResourceControlHandle::shutdown`])
4032/// if the responder is dropped without sending a response, so that the client
4033/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4034impl std::ops::Drop for InfoResourceGetResponder {
4035    fn drop(&mut self) {
4036        self.control_handle.shutdown();
4037        // Safety: drops once, never accessed again
4038        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4039    }
4040}
4041
4042impl fidl::endpoints::Responder for InfoResourceGetResponder {
4043    type ControlHandle = InfoResourceControlHandle;
4044
4045    fn control_handle(&self) -> &InfoResourceControlHandle {
4046        &self.control_handle
4047    }
4048
4049    fn drop_without_shutdown(mut self) {
4050        // Safety: drops once, never accessed again due to mem::forget
4051        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4052        // Prevent Drop from running (which would shut down the channel)
4053        std::mem::forget(self);
4054    }
4055}
4056
4057impl InfoResourceGetResponder {
4058    /// Sends a response to the FIDL transaction.
4059    ///
4060    /// Sets the channel to shutdown if an error occurs.
4061    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4062        let _result = self.send_raw(resource);
4063        if _result.is_err() {
4064            self.control_handle.shutdown();
4065        }
4066        self.drop_without_shutdown();
4067        _result
4068    }
4069
4070    /// Similar to "send" but does not shutdown the channel if an error occurs.
4071    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4072        let _result = self.send_raw(resource);
4073        self.drop_without_shutdown();
4074        _result
4075    }
4076
4077    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4078        self.control_handle.inner.send::<InfoResourceGetResponse>(
4079            (resource,),
4080            self.tx_id,
4081            0x1de8edcb4abc2067,
4082            fidl::encoding::DynamicFlags::empty(),
4083        )
4084    }
4085}
4086
4087#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4088pub struct IommuResourceMarker;
4089
4090impl fidl::endpoints::ProtocolMarker for IommuResourceMarker {
4091    type Proxy = IommuResourceProxy;
4092    type RequestStream = IommuResourceRequestStream;
4093    #[cfg(target_os = "fuchsia")]
4094    type SynchronousProxy = IommuResourceSynchronousProxy;
4095
4096    const DEBUG_NAME: &'static str = "fuchsia.kernel.IommuResource";
4097}
4098impl fidl::endpoints::DiscoverableProtocolMarker for IommuResourceMarker {}
4099
4100pub trait IommuResourceProxyInterface: Send + Sync {
4101    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4102    fn r#get(&self) -> Self::GetResponseFut;
4103}
4104#[derive(Debug)]
4105#[cfg(target_os = "fuchsia")]
4106pub struct IommuResourceSynchronousProxy {
4107    client: fidl::client::sync::Client,
4108}
4109
4110#[cfg(target_os = "fuchsia")]
4111impl fidl::endpoints::SynchronousProxy for IommuResourceSynchronousProxy {
4112    type Proxy = IommuResourceProxy;
4113    type Protocol = IommuResourceMarker;
4114
4115    fn from_channel(inner: fidl::Channel) -> Self {
4116        Self::new(inner)
4117    }
4118
4119    fn into_channel(self) -> fidl::Channel {
4120        self.client.into_channel()
4121    }
4122
4123    fn as_channel(&self) -> &fidl::Channel {
4124        self.client.as_channel()
4125    }
4126}
4127
4128#[cfg(target_os = "fuchsia")]
4129impl IommuResourceSynchronousProxy {
4130    pub fn new(channel: fidl::Channel) -> Self {
4131        Self { client: fidl::client::sync::Client::new(channel) }
4132    }
4133
4134    pub fn into_channel(self) -> fidl::Channel {
4135        self.client.into_channel()
4136    }
4137
4138    /// Waits until an event arrives and returns it. It is safe for other
4139    /// threads to make concurrent requests while waiting for an event.
4140    pub fn wait_for_event(
4141        &self,
4142        deadline: zx::MonotonicInstant,
4143    ) -> Result<IommuResourceEvent, fidl::Error> {
4144        IommuResourceEvent::decode(self.client.wait_for_event::<IommuResourceMarker>(deadline)?)
4145    }
4146
4147    /// Get an iommu resource handle.
4148    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4149        let _response = self.client.send_query::<
4150            fidl::encoding::EmptyPayload,
4151            IommuResourceGetResponse,
4152            IommuResourceMarker,
4153        >(
4154            (),
4155            0x5af309b619aa7c5b,
4156            fidl::encoding::DynamicFlags::empty(),
4157            ___deadline,
4158        )?;
4159        Ok(_response.resource)
4160    }
4161}
4162
4163#[cfg(target_os = "fuchsia")]
4164impl From<IommuResourceSynchronousProxy> for zx::NullableHandle {
4165    fn from(value: IommuResourceSynchronousProxy) -> Self {
4166        value.into_channel().into()
4167    }
4168}
4169
4170#[cfg(target_os = "fuchsia")]
4171impl From<fidl::Channel> for IommuResourceSynchronousProxy {
4172    fn from(value: fidl::Channel) -> Self {
4173        Self::new(value)
4174    }
4175}
4176
4177#[cfg(target_os = "fuchsia")]
4178impl fidl::endpoints::FromClient for IommuResourceSynchronousProxy {
4179    type Protocol = IommuResourceMarker;
4180
4181    fn from_client(value: fidl::endpoints::ClientEnd<IommuResourceMarker>) -> Self {
4182        Self::new(value.into_channel())
4183    }
4184}
4185
4186#[derive(Debug, Clone)]
4187pub struct IommuResourceProxy {
4188    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4189}
4190
4191impl fidl::endpoints::Proxy for IommuResourceProxy {
4192    type Protocol = IommuResourceMarker;
4193
4194    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4195        Self::new(inner)
4196    }
4197
4198    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4199        self.client.into_channel().map_err(|client| Self { client })
4200    }
4201
4202    fn as_channel(&self) -> &::fidl::AsyncChannel {
4203        self.client.as_channel()
4204    }
4205}
4206
4207impl IommuResourceProxy {
4208    /// Create a new Proxy for fuchsia.kernel/IommuResource.
4209    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4210        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4211        Self { client: fidl::client::Client::new(channel, protocol_name) }
4212    }
4213
4214    /// Get a Stream of events from the remote end of the protocol.
4215    ///
4216    /// # Panics
4217    ///
4218    /// Panics if the event stream was already taken.
4219    pub fn take_event_stream(&self) -> IommuResourceEventStream {
4220        IommuResourceEventStream { event_receiver: self.client.take_event_receiver() }
4221    }
4222
4223    /// Get an iommu resource handle.
4224    pub fn r#get(
4225        &self,
4226    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4227    {
4228        IommuResourceProxyInterface::r#get(self)
4229    }
4230}
4231
4232impl IommuResourceProxyInterface for IommuResourceProxy {
4233    type GetResponseFut = fidl::client::QueryResponseFut<
4234        fidl::Resource,
4235        fidl::encoding::DefaultFuchsiaResourceDialect,
4236    >;
4237    fn r#get(&self) -> Self::GetResponseFut {
4238        fn _decode(
4239            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4240        ) -> Result<fidl::Resource, fidl::Error> {
4241            let _response = fidl::client::decode_transaction_body::<
4242                IommuResourceGetResponse,
4243                fidl::encoding::DefaultFuchsiaResourceDialect,
4244                0x5af309b619aa7c5b,
4245            >(_buf?)?;
4246            Ok(_response.resource)
4247        }
4248        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4249            (),
4250            0x5af309b619aa7c5b,
4251            fidl::encoding::DynamicFlags::empty(),
4252            _decode,
4253        )
4254    }
4255}
4256
4257pub struct IommuResourceEventStream {
4258    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4259}
4260
4261impl std::marker::Unpin for IommuResourceEventStream {}
4262
4263impl futures::stream::FusedStream for IommuResourceEventStream {
4264    fn is_terminated(&self) -> bool {
4265        self.event_receiver.is_terminated()
4266    }
4267}
4268
4269impl futures::Stream for IommuResourceEventStream {
4270    type Item = Result<IommuResourceEvent, fidl::Error>;
4271
4272    fn poll_next(
4273        mut self: std::pin::Pin<&mut Self>,
4274        cx: &mut std::task::Context<'_>,
4275    ) -> std::task::Poll<Option<Self::Item>> {
4276        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4277            &mut self.event_receiver,
4278            cx
4279        )?) {
4280            Some(buf) => std::task::Poll::Ready(Some(IommuResourceEvent::decode(buf))),
4281            None => std::task::Poll::Ready(None),
4282        }
4283    }
4284}
4285
4286#[derive(Debug)]
4287pub enum IommuResourceEvent {}
4288
4289impl IommuResourceEvent {
4290    /// Decodes a message buffer as a [`IommuResourceEvent`].
4291    fn decode(
4292        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4293    ) -> Result<IommuResourceEvent, fidl::Error> {
4294        let (bytes, _handles) = buf.split_mut();
4295        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4296        debug_assert_eq!(tx_header.tx_id, 0);
4297        match tx_header.ordinal {
4298            _ => Err(fidl::Error::UnknownOrdinal {
4299                ordinal: tx_header.ordinal,
4300                protocol_name: <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4301            }),
4302        }
4303    }
4304}
4305
4306/// A Stream of incoming requests for fuchsia.kernel/IommuResource.
4307pub struct IommuResourceRequestStream {
4308    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4309    is_terminated: bool,
4310}
4311
4312impl std::marker::Unpin for IommuResourceRequestStream {}
4313
4314impl futures::stream::FusedStream for IommuResourceRequestStream {
4315    fn is_terminated(&self) -> bool {
4316        self.is_terminated
4317    }
4318}
4319
4320impl fidl::endpoints::RequestStream for IommuResourceRequestStream {
4321    type Protocol = IommuResourceMarker;
4322    type ControlHandle = IommuResourceControlHandle;
4323
4324    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4325        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4326    }
4327
4328    fn control_handle(&self) -> Self::ControlHandle {
4329        IommuResourceControlHandle { inner: self.inner.clone() }
4330    }
4331
4332    fn into_inner(
4333        self,
4334    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4335    {
4336        (self.inner, self.is_terminated)
4337    }
4338
4339    fn from_inner(
4340        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4341        is_terminated: bool,
4342    ) -> Self {
4343        Self { inner, is_terminated }
4344    }
4345}
4346
4347impl futures::Stream for IommuResourceRequestStream {
4348    type Item = Result<IommuResourceRequest, fidl::Error>;
4349
4350    fn poll_next(
4351        mut self: std::pin::Pin<&mut Self>,
4352        cx: &mut std::task::Context<'_>,
4353    ) -> std::task::Poll<Option<Self::Item>> {
4354        let this = &mut *self;
4355        if this.inner.check_shutdown(cx) {
4356            this.is_terminated = true;
4357            return std::task::Poll::Ready(None);
4358        }
4359        if this.is_terminated {
4360            panic!("polled IommuResourceRequestStream after completion");
4361        }
4362        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4363            |bytes, handles| {
4364                match this.inner.channel().read_etc(cx, bytes, handles) {
4365                    std::task::Poll::Ready(Ok(())) => {}
4366                    std::task::Poll::Pending => return std::task::Poll::Pending,
4367                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4368                        this.is_terminated = true;
4369                        return std::task::Poll::Ready(None);
4370                    }
4371                    std::task::Poll::Ready(Err(e)) => {
4372                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4373                            e.into(),
4374                        ))));
4375                    }
4376                }
4377
4378                // A message has been received from the channel
4379                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4380
4381                std::task::Poll::Ready(Some(match header.ordinal {
4382                    0x5af309b619aa7c5b => {
4383                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4384                        let mut req = fidl::new_empty!(
4385                            fidl::encoding::EmptyPayload,
4386                            fidl::encoding::DefaultFuchsiaResourceDialect
4387                        );
4388                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4389                        let control_handle =
4390                            IommuResourceControlHandle { inner: this.inner.clone() };
4391                        Ok(IommuResourceRequest::Get {
4392                            responder: IommuResourceGetResponder {
4393                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4394                                tx_id: header.tx_id,
4395                            },
4396                        })
4397                    }
4398                    _ => Err(fidl::Error::UnknownOrdinal {
4399                        ordinal: header.ordinal,
4400                        protocol_name:
4401                            <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4402                    }),
4403                }))
4404            },
4405        )
4406    }
4407}
4408
4409/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
4410/// `ZX_RSRC_SYSTEM_IOMMU_BASE`.
4411#[derive(Debug)]
4412pub enum IommuResourceRequest {
4413    /// Get an iommu resource handle.
4414    Get { responder: IommuResourceGetResponder },
4415}
4416
4417impl IommuResourceRequest {
4418    #[allow(irrefutable_let_patterns)]
4419    pub fn into_get(self) -> Option<(IommuResourceGetResponder)> {
4420        if let IommuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4421    }
4422
4423    /// Name of the method defined in FIDL
4424    pub fn method_name(&self) -> &'static str {
4425        match *self {
4426            IommuResourceRequest::Get { .. } => "get",
4427        }
4428    }
4429}
4430
4431#[derive(Debug, Clone)]
4432pub struct IommuResourceControlHandle {
4433    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4434}
4435
4436impl IommuResourceControlHandle {
4437    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4438        self.inner.shutdown_with_epitaph(status.into())
4439    }
4440}
4441
4442impl fidl::endpoints::ControlHandle for IommuResourceControlHandle {
4443    fn shutdown(&self) {
4444        self.inner.shutdown()
4445    }
4446
4447    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4448        self.inner.shutdown_with_epitaph(status)
4449    }
4450
4451    fn is_closed(&self) -> bool {
4452        self.inner.channel().is_closed()
4453    }
4454    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4455        self.inner.channel().on_closed()
4456    }
4457
4458    #[cfg(target_os = "fuchsia")]
4459    fn signal_peer(
4460        &self,
4461        clear_mask: zx::Signals,
4462        set_mask: zx::Signals,
4463    ) -> Result<(), zx_status::Status> {
4464        use fidl::Peered;
4465        self.inner.channel().signal_peer(clear_mask, set_mask)
4466    }
4467}
4468
4469impl IommuResourceControlHandle {}
4470
4471#[must_use = "FIDL methods require a response to be sent"]
4472#[derive(Debug)]
4473pub struct IommuResourceGetResponder {
4474    control_handle: std::mem::ManuallyDrop<IommuResourceControlHandle>,
4475    tx_id: u32,
4476}
4477
4478/// Set the the channel to be shutdown (see [`IommuResourceControlHandle::shutdown`])
4479/// if the responder is dropped without sending a response, so that the client
4480/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4481impl std::ops::Drop for IommuResourceGetResponder {
4482    fn drop(&mut self) {
4483        self.control_handle.shutdown();
4484        // Safety: drops once, never accessed again
4485        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4486    }
4487}
4488
4489impl fidl::endpoints::Responder for IommuResourceGetResponder {
4490    type ControlHandle = IommuResourceControlHandle;
4491
4492    fn control_handle(&self) -> &IommuResourceControlHandle {
4493        &self.control_handle
4494    }
4495
4496    fn drop_without_shutdown(mut self) {
4497        // Safety: drops once, never accessed again due to mem::forget
4498        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4499        // Prevent Drop from running (which would shut down the channel)
4500        std::mem::forget(self);
4501    }
4502}
4503
4504impl IommuResourceGetResponder {
4505    /// Sends a response to the FIDL transaction.
4506    ///
4507    /// Sets the channel to shutdown if an error occurs.
4508    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4509        let _result = self.send_raw(resource);
4510        if _result.is_err() {
4511            self.control_handle.shutdown();
4512        }
4513        self.drop_without_shutdown();
4514        _result
4515    }
4516
4517    /// Similar to "send" but does not shutdown the channel if an error occurs.
4518    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4519        let _result = self.send_raw(resource);
4520        self.drop_without_shutdown();
4521        _result
4522    }
4523
4524    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4525        self.control_handle.inner.send::<IommuResourceGetResponse>(
4526            (resource,),
4527            self.tx_id,
4528            0x5af309b619aa7c5b,
4529            fidl::encoding::DynamicFlags::empty(),
4530        )
4531    }
4532}
4533
4534#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4535pub struct IoportResourceMarker;
4536
4537impl fidl::endpoints::ProtocolMarker for IoportResourceMarker {
4538    type Proxy = IoportResourceProxy;
4539    type RequestStream = IoportResourceRequestStream;
4540    #[cfg(target_os = "fuchsia")]
4541    type SynchronousProxy = IoportResourceSynchronousProxy;
4542
4543    const DEBUG_NAME: &'static str = "fuchsia.kernel.IoportResource";
4544}
4545impl fidl::endpoints::DiscoverableProtocolMarker for IoportResourceMarker {}
4546
4547pub trait IoportResourceProxyInterface: Send + Sync {
4548    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4549    fn r#get(&self) -> Self::GetResponseFut;
4550}
4551#[derive(Debug)]
4552#[cfg(target_os = "fuchsia")]
4553pub struct IoportResourceSynchronousProxy {
4554    client: fidl::client::sync::Client,
4555}
4556
4557#[cfg(target_os = "fuchsia")]
4558impl fidl::endpoints::SynchronousProxy for IoportResourceSynchronousProxy {
4559    type Proxy = IoportResourceProxy;
4560    type Protocol = IoportResourceMarker;
4561
4562    fn from_channel(inner: fidl::Channel) -> Self {
4563        Self::new(inner)
4564    }
4565
4566    fn into_channel(self) -> fidl::Channel {
4567        self.client.into_channel()
4568    }
4569
4570    fn as_channel(&self) -> &fidl::Channel {
4571        self.client.as_channel()
4572    }
4573}
4574
4575#[cfg(target_os = "fuchsia")]
4576impl IoportResourceSynchronousProxy {
4577    pub fn new(channel: fidl::Channel) -> Self {
4578        Self { client: fidl::client::sync::Client::new(channel) }
4579    }
4580
4581    pub fn into_channel(self) -> fidl::Channel {
4582        self.client.into_channel()
4583    }
4584
4585    /// Waits until an event arrives and returns it. It is safe for other
4586    /// threads to make concurrent requests while waiting for an event.
4587    pub fn wait_for_event(
4588        &self,
4589        deadline: zx::MonotonicInstant,
4590    ) -> Result<IoportResourceEvent, fidl::Error> {
4591        IoportResourceEvent::decode(self.client.wait_for_event::<IoportResourceMarker>(deadline)?)
4592    }
4593
4594    /// Get an IO Port resource handle.
4595    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4596        let _response = self.client.send_query::<
4597            fidl::encoding::EmptyPayload,
4598            IoportResourceGetResponse,
4599            IoportResourceMarker,
4600        >(
4601            (),
4602            0x4db20876b537c52b,
4603            fidl::encoding::DynamicFlags::empty(),
4604            ___deadline,
4605        )?;
4606        Ok(_response.resource)
4607    }
4608}
4609
4610#[cfg(target_os = "fuchsia")]
4611impl From<IoportResourceSynchronousProxy> for zx::NullableHandle {
4612    fn from(value: IoportResourceSynchronousProxy) -> Self {
4613        value.into_channel().into()
4614    }
4615}
4616
4617#[cfg(target_os = "fuchsia")]
4618impl From<fidl::Channel> for IoportResourceSynchronousProxy {
4619    fn from(value: fidl::Channel) -> Self {
4620        Self::new(value)
4621    }
4622}
4623
4624#[cfg(target_os = "fuchsia")]
4625impl fidl::endpoints::FromClient for IoportResourceSynchronousProxy {
4626    type Protocol = IoportResourceMarker;
4627
4628    fn from_client(value: fidl::endpoints::ClientEnd<IoportResourceMarker>) -> Self {
4629        Self::new(value.into_channel())
4630    }
4631}
4632
4633#[derive(Debug, Clone)]
4634pub struct IoportResourceProxy {
4635    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4636}
4637
4638impl fidl::endpoints::Proxy for IoportResourceProxy {
4639    type Protocol = IoportResourceMarker;
4640
4641    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4642        Self::new(inner)
4643    }
4644
4645    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4646        self.client.into_channel().map_err(|client| Self { client })
4647    }
4648
4649    fn as_channel(&self) -> &::fidl::AsyncChannel {
4650        self.client.as_channel()
4651    }
4652}
4653
4654impl IoportResourceProxy {
4655    /// Create a new Proxy for fuchsia.kernel/IoportResource.
4656    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4657        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4658        Self { client: fidl::client::Client::new(channel, protocol_name) }
4659    }
4660
4661    /// Get a Stream of events from the remote end of the protocol.
4662    ///
4663    /// # Panics
4664    ///
4665    /// Panics if the event stream was already taken.
4666    pub fn take_event_stream(&self) -> IoportResourceEventStream {
4667        IoportResourceEventStream { event_receiver: self.client.take_event_receiver() }
4668    }
4669
4670    /// Get an IO Port resource handle.
4671    pub fn r#get(
4672        &self,
4673    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4674    {
4675        IoportResourceProxyInterface::r#get(self)
4676    }
4677}
4678
4679impl IoportResourceProxyInterface for IoportResourceProxy {
4680    type GetResponseFut = fidl::client::QueryResponseFut<
4681        fidl::Resource,
4682        fidl::encoding::DefaultFuchsiaResourceDialect,
4683    >;
4684    fn r#get(&self) -> Self::GetResponseFut {
4685        fn _decode(
4686            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4687        ) -> Result<fidl::Resource, fidl::Error> {
4688            let _response = fidl::client::decode_transaction_body::<
4689                IoportResourceGetResponse,
4690                fidl::encoding::DefaultFuchsiaResourceDialect,
4691                0x4db20876b537c52b,
4692            >(_buf?)?;
4693            Ok(_response.resource)
4694        }
4695        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4696            (),
4697            0x4db20876b537c52b,
4698            fidl::encoding::DynamicFlags::empty(),
4699            _decode,
4700        )
4701    }
4702}
4703
4704pub struct IoportResourceEventStream {
4705    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4706}
4707
4708impl std::marker::Unpin for IoportResourceEventStream {}
4709
4710impl futures::stream::FusedStream for IoportResourceEventStream {
4711    fn is_terminated(&self) -> bool {
4712        self.event_receiver.is_terminated()
4713    }
4714}
4715
4716impl futures::Stream for IoportResourceEventStream {
4717    type Item = Result<IoportResourceEvent, fidl::Error>;
4718
4719    fn poll_next(
4720        mut self: std::pin::Pin<&mut Self>,
4721        cx: &mut std::task::Context<'_>,
4722    ) -> std::task::Poll<Option<Self::Item>> {
4723        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4724            &mut self.event_receiver,
4725            cx
4726        )?) {
4727            Some(buf) => std::task::Poll::Ready(Some(IoportResourceEvent::decode(buf))),
4728            None => std::task::Poll::Ready(None),
4729        }
4730    }
4731}
4732
4733#[derive(Debug)]
4734pub enum IoportResourceEvent {}
4735
4736impl IoportResourceEvent {
4737    /// Decodes a message buffer as a [`IoportResourceEvent`].
4738    fn decode(
4739        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4740    ) -> Result<IoportResourceEvent, fidl::Error> {
4741        let (bytes, _handles) = buf.split_mut();
4742        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4743        debug_assert_eq!(tx_header.tx_id, 0);
4744        match tx_header.ordinal {
4745            _ => Err(fidl::Error::UnknownOrdinal {
4746                ordinal: tx_header.ordinal,
4747                protocol_name:
4748                    <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4749            }),
4750        }
4751    }
4752}
4753
4754/// A Stream of incoming requests for fuchsia.kernel/IoportResource.
4755pub struct IoportResourceRequestStream {
4756    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4757    is_terminated: bool,
4758}
4759
4760impl std::marker::Unpin for IoportResourceRequestStream {}
4761
4762impl futures::stream::FusedStream for IoportResourceRequestStream {
4763    fn is_terminated(&self) -> bool {
4764        self.is_terminated
4765    }
4766}
4767
4768impl fidl::endpoints::RequestStream for IoportResourceRequestStream {
4769    type Protocol = IoportResourceMarker;
4770    type ControlHandle = IoportResourceControlHandle;
4771
4772    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4773        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4774    }
4775
4776    fn control_handle(&self) -> Self::ControlHandle {
4777        IoportResourceControlHandle { inner: self.inner.clone() }
4778    }
4779
4780    fn into_inner(
4781        self,
4782    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4783    {
4784        (self.inner, self.is_terminated)
4785    }
4786
4787    fn from_inner(
4788        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4789        is_terminated: bool,
4790    ) -> Self {
4791        Self { inner, is_terminated }
4792    }
4793}
4794
4795impl futures::Stream for IoportResourceRequestStream {
4796    type Item = Result<IoportResourceRequest, fidl::Error>;
4797
4798    fn poll_next(
4799        mut self: std::pin::Pin<&mut Self>,
4800        cx: &mut std::task::Context<'_>,
4801    ) -> std::task::Poll<Option<Self::Item>> {
4802        let this = &mut *self;
4803        if this.inner.check_shutdown(cx) {
4804            this.is_terminated = true;
4805            return std::task::Poll::Ready(None);
4806        }
4807        if this.is_terminated {
4808            panic!("polled IoportResourceRequestStream after completion");
4809        }
4810        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4811            |bytes, handles| {
4812                match this.inner.channel().read_etc(cx, bytes, handles) {
4813                    std::task::Poll::Ready(Ok(())) => {}
4814                    std::task::Poll::Pending => return std::task::Poll::Pending,
4815                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4816                        this.is_terminated = true;
4817                        return std::task::Poll::Ready(None);
4818                    }
4819                    std::task::Poll::Ready(Err(e)) => {
4820                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4821                            e.into(),
4822                        ))));
4823                    }
4824                }
4825
4826                // A message has been received from the channel
4827                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4828
4829                std::task::Poll::Ready(Some(match header.ordinal {
4830                    0x4db20876b537c52b => {
4831                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4832                        let mut req = fidl::new_empty!(
4833                            fidl::encoding::EmptyPayload,
4834                            fidl::encoding::DefaultFuchsiaResourceDialect
4835                        );
4836                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4837                        let control_handle =
4838                            IoportResourceControlHandle { inner: this.inner.clone() };
4839                        Ok(IoportResourceRequest::Get {
4840                            responder: IoportResourceGetResponder {
4841                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4842                                tx_id: header.tx_id,
4843                            },
4844                        })
4845                    }
4846                    _ => Err(fidl::Error::UnknownOrdinal {
4847                        ordinal: header.ordinal,
4848                        protocol_name:
4849                            <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4850                    }),
4851                }))
4852            },
4853        )
4854    }
4855}
4856
4857/// Protocol for providing an IO Port resource with access to all valid ranges.
4858#[derive(Debug)]
4859pub enum IoportResourceRequest {
4860    /// Get an IO Port resource handle.
4861    Get { responder: IoportResourceGetResponder },
4862}
4863
4864impl IoportResourceRequest {
4865    #[allow(irrefutable_let_patterns)]
4866    pub fn into_get(self) -> Option<(IoportResourceGetResponder)> {
4867        if let IoportResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4868    }
4869
4870    /// Name of the method defined in FIDL
4871    pub fn method_name(&self) -> &'static str {
4872        match *self {
4873            IoportResourceRequest::Get { .. } => "get",
4874        }
4875    }
4876}
4877
4878#[derive(Debug, Clone)]
4879pub struct IoportResourceControlHandle {
4880    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4881}
4882
4883impl IoportResourceControlHandle {
4884    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4885        self.inner.shutdown_with_epitaph(status.into())
4886    }
4887}
4888
4889impl fidl::endpoints::ControlHandle for IoportResourceControlHandle {
4890    fn shutdown(&self) {
4891        self.inner.shutdown()
4892    }
4893
4894    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4895        self.inner.shutdown_with_epitaph(status)
4896    }
4897
4898    fn is_closed(&self) -> bool {
4899        self.inner.channel().is_closed()
4900    }
4901    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4902        self.inner.channel().on_closed()
4903    }
4904
4905    #[cfg(target_os = "fuchsia")]
4906    fn signal_peer(
4907        &self,
4908        clear_mask: zx::Signals,
4909        set_mask: zx::Signals,
4910    ) -> Result<(), zx_status::Status> {
4911        use fidl::Peered;
4912        self.inner.channel().signal_peer(clear_mask, set_mask)
4913    }
4914}
4915
4916impl IoportResourceControlHandle {}
4917
4918#[must_use = "FIDL methods require a response to be sent"]
4919#[derive(Debug)]
4920pub struct IoportResourceGetResponder {
4921    control_handle: std::mem::ManuallyDrop<IoportResourceControlHandle>,
4922    tx_id: u32,
4923}
4924
4925/// Set the the channel to be shutdown (see [`IoportResourceControlHandle::shutdown`])
4926/// if the responder is dropped without sending a response, so that the client
4927/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4928impl std::ops::Drop for IoportResourceGetResponder {
4929    fn drop(&mut self) {
4930        self.control_handle.shutdown();
4931        // Safety: drops once, never accessed again
4932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4933    }
4934}
4935
4936impl fidl::endpoints::Responder for IoportResourceGetResponder {
4937    type ControlHandle = IoportResourceControlHandle;
4938
4939    fn control_handle(&self) -> &IoportResourceControlHandle {
4940        &self.control_handle
4941    }
4942
4943    fn drop_without_shutdown(mut self) {
4944        // Safety: drops once, never accessed again due to mem::forget
4945        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4946        // Prevent Drop from running (which would shut down the channel)
4947        std::mem::forget(self);
4948    }
4949}
4950
4951impl IoportResourceGetResponder {
4952    /// Sends a response to the FIDL transaction.
4953    ///
4954    /// Sets the channel to shutdown if an error occurs.
4955    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4956        let _result = self.send_raw(resource);
4957        if _result.is_err() {
4958            self.control_handle.shutdown();
4959        }
4960        self.drop_without_shutdown();
4961        _result
4962    }
4963
4964    /// Similar to "send" but does not shutdown the channel if an error occurs.
4965    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4966        let _result = self.send_raw(resource);
4967        self.drop_without_shutdown();
4968        _result
4969    }
4970
4971    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4972        self.control_handle.inner.send::<IoportResourceGetResponse>(
4973            (resource,),
4974            self.tx_id,
4975            0x4db20876b537c52b,
4976            fidl::encoding::DynamicFlags::empty(),
4977        )
4978    }
4979}
4980
4981#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4982pub struct IrqResourceMarker;
4983
4984impl fidl::endpoints::ProtocolMarker for IrqResourceMarker {
4985    type Proxy = IrqResourceProxy;
4986    type RequestStream = IrqResourceRequestStream;
4987    #[cfg(target_os = "fuchsia")]
4988    type SynchronousProxy = IrqResourceSynchronousProxy;
4989
4990    const DEBUG_NAME: &'static str = "fuchsia.kernel.IrqResource";
4991}
4992impl fidl::endpoints::DiscoverableProtocolMarker for IrqResourceMarker {}
4993
4994pub trait IrqResourceProxyInterface: Send + Sync {
4995    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4996    fn r#get(&self) -> Self::GetResponseFut;
4997}
4998#[derive(Debug)]
4999#[cfg(target_os = "fuchsia")]
5000pub struct IrqResourceSynchronousProxy {
5001    client: fidl::client::sync::Client,
5002}
5003
5004#[cfg(target_os = "fuchsia")]
5005impl fidl::endpoints::SynchronousProxy for IrqResourceSynchronousProxy {
5006    type Proxy = IrqResourceProxy;
5007    type Protocol = IrqResourceMarker;
5008
5009    fn from_channel(inner: fidl::Channel) -> Self {
5010        Self::new(inner)
5011    }
5012
5013    fn into_channel(self) -> fidl::Channel {
5014        self.client.into_channel()
5015    }
5016
5017    fn as_channel(&self) -> &fidl::Channel {
5018        self.client.as_channel()
5019    }
5020}
5021
5022#[cfg(target_os = "fuchsia")]
5023impl IrqResourceSynchronousProxy {
5024    pub fn new(channel: fidl::Channel) -> Self {
5025        Self { client: fidl::client::sync::Client::new(channel) }
5026    }
5027
5028    pub fn into_channel(self) -> fidl::Channel {
5029        self.client.into_channel()
5030    }
5031
5032    /// Waits until an event arrives and returns it. It is safe for other
5033    /// threads to make concurrent requests while waiting for an event.
5034    pub fn wait_for_event(
5035        &self,
5036        deadline: zx::MonotonicInstant,
5037    ) -> Result<IrqResourceEvent, fidl::Error> {
5038        IrqResourceEvent::decode(self.client.wait_for_event::<IrqResourceMarker>(deadline)?)
5039    }
5040
5041    /// Get an IRQ resource handle.
5042    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5043        let _response = self
5044            .client
5045            .send_query::<fidl::encoding::EmptyPayload, IrqResourceGetResponse, IrqResourceMarker>(
5046                (),
5047                0x491be54504b041e9,
5048                fidl::encoding::DynamicFlags::empty(),
5049                ___deadline,
5050            )?;
5051        Ok(_response.resource)
5052    }
5053}
5054
5055#[cfg(target_os = "fuchsia")]
5056impl From<IrqResourceSynchronousProxy> for zx::NullableHandle {
5057    fn from(value: IrqResourceSynchronousProxy) -> Self {
5058        value.into_channel().into()
5059    }
5060}
5061
5062#[cfg(target_os = "fuchsia")]
5063impl From<fidl::Channel> for IrqResourceSynchronousProxy {
5064    fn from(value: fidl::Channel) -> Self {
5065        Self::new(value)
5066    }
5067}
5068
5069#[cfg(target_os = "fuchsia")]
5070impl fidl::endpoints::FromClient for IrqResourceSynchronousProxy {
5071    type Protocol = IrqResourceMarker;
5072
5073    fn from_client(value: fidl::endpoints::ClientEnd<IrqResourceMarker>) -> Self {
5074        Self::new(value.into_channel())
5075    }
5076}
5077
5078#[derive(Debug, Clone)]
5079pub struct IrqResourceProxy {
5080    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5081}
5082
5083impl fidl::endpoints::Proxy for IrqResourceProxy {
5084    type Protocol = IrqResourceMarker;
5085
5086    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5087        Self::new(inner)
5088    }
5089
5090    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5091        self.client.into_channel().map_err(|client| Self { client })
5092    }
5093
5094    fn as_channel(&self) -> &::fidl::AsyncChannel {
5095        self.client.as_channel()
5096    }
5097}
5098
5099impl IrqResourceProxy {
5100    /// Create a new Proxy for fuchsia.kernel/IrqResource.
5101    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5102        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5103        Self { client: fidl::client::Client::new(channel, protocol_name) }
5104    }
5105
5106    /// Get a Stream of events from the remote end of the protocol.
5107    ///
5108    /// # Panics
5109    ///
5110    /// Panics if the event stream was already taken.
5111    pub fn take_event_stream(&self) -> IrqResourceEventStream {
5112        IrqResourceEventStream { event_receiver: self.client.take_event_receiver() }
5113    }
5114
5115    /// Get an IRQ resource handle.
5116    pub fn r#get(
5117        &self,
5118    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5119    {
5120        IrqResourceProxyInterface::r#get(self)
5121    }
5122}
5123
5124impl IrqResourceProxyInterface for IrqResourceProxy {
5125    type GetResponseFut = fidl::client::QueryResponseFut<
5126        fidl::Resource,
5127        fidl::encoding::DefaultFuchsiaResourceDialect,
5128    >;
5129    fn r#get(&self) -> Self::GetResponseFut {
5130        fn _decode(
5131            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5132        ) -> Result<fidl::Resource, fidl::Error> {
5133            let _response = fidl::client::decode_transaction_body::<
5134                IrqResourceGetResponse,
5135                fidl::encoding::DefaultFuchsiaResourceDialect,
5136                0x491be54504b041e9,
5137            >(_buf?)?;
5138            Ok(_response.resource)
5139        }
5140        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5141            (),
5142            0x491be54504b041e9,
5143            fidl::encoding::DynamicFlags::empty(),
5144            _decode,
5145        )
5146    }
5147}
5148
5149pub struct IrqResourceEventStream {
5150    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5151}
5152
5153impl std::marker::Unpin for IrqResourceEventStream {}
5154
5155impl futures::stream::FusedStream for IrqResourceEventStream {
5156    fn is_terminated(&self) -> bool {
5157        self.event_receiver.is_terminated()
5158    }
5159}
5160
5161impl futures::Stream for IrqResourceEventStream {
5162    type Item = Result<IrqResourceEvent, fidl::Error>;
5163
5164    fn poll_next(
5165        mut self: std::pin::Pin<&mut Self>,
5166        cx: &mut std::task::Context<'_>,
5167    ) -> std::task::Poll<Option<Self::Item>> {
5168        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5169            &mut self.event_receiver,
5170            cx
5171        )?) {
5172            Some(buf) => std::task::Poll::Ready(Some(IrqResourceEvent::decode(buf))),
5173            None => std::task::Poll::Ready(None),
5174        }
5175    }
5176}
5177
5178#[derive(Debug)]
5179pub enum IrqResourceEvent {}
5180
5181impl IrqResourceEvent {
5182    /// Decodes a message buffer as a [`IrqResourceEvent`].
5183    fn decode(
5184        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5185    ) -> Result<IrqResourceEvent, fidl::Error> {
5186        let (bytes, _handles) = buf.split_mut();
5187        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5188        debug_assert_eq!(tx_header.tx_id, 0);
5189        match tx_header.ordinal {
5190            _ => Err(fidl::Error::UnknownOrdinal {
5191                ordinal: tx_header.ordinal,
5192                protocol_name: <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5193            }),
5194        }
5195    }
5196}
5197
5198/// A Stream of incoming requests for fuchsia.kernel/IrqResource.
5199pub struct IrqResourceRequestStream {
5200    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5201    is_terminated: bool,
5202}
5203
5204impl std::marker::Unpin for IrqResourceRequestStream {}
5205
5206impl futures::stream::FusedStream for IrqResourceRequestStream {
5207    fn is_terminated(&self) -> bool {
5208        self.is_terminated
5209    }
5210}
5211
5212impl fidl::endpoints::RequestStream for IrqResourceRequestStream {
5213    type Protocol = IrqResourceMarker;
5214    type ControlHandle = IrqResourceControlHandle;
5215
5216    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5217        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5218    }
5219
5220    fn control_handle(&self) -> Self::ControlHandle {
5221        IrqResourceControlHandle { inner: self.inner.clone() }
5222    }
5223
5224    fn into_inner(
5225        self,
5226    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5227    {
5228        (self.inner, self.is_terminated)
5229    }
5230
5231    fn from_inner(
5232        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5233        is_terminated: bool,
5234    ) -> Self {
5235        Self { inner, is_terminated }
5236    }
5237}
5238
5239impl futures::Stream for IrqResourceRequestStream {
5240    type Item = Result<IrqResourceRequest, fidl::Error>;
5241
5242    fn poll_next(
5243        mut self: std::pin::Pin<&mut Self>,
5244        cx: &mut std::task::Context<'_>,
5245    ) -> std::task::Poll<Option<Self::Item>> {
5246        let this = &mut *self;
5247        if this.inner.check_shutdown(cx) {
5248            this.is_terminated = true;
5249            return std::task::Poll::Ready(None);
5250        }
5251        if this.is_terminated {
5252            panic!("polled IrqResourceRequestStream after completion");
5253        }
5254        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5255            |bytes, handles| {
5256                match this.inner.channel().read_etc(cx, bytes, handles) {
5257                    std::task::Poll::Ready(Ok(())) => {}
5258                    std::task::Poll::Pending => return std::task::Poll::Pending,
5259                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5260                        this.is_terminated = true;
5261                        return std::task::Poll::Ready(None);
5262                    }
5263                    std::task::Poll::Ready(Err(e)) => {
5264                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5265                            e.into(),
5266                        ))));
5267                    }
5268                }
5269
5270                // A message has been received from the channel
5271                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5272
5273                std::task::Poll::Ready(Some(match header.ordinal {
5274                    0x491be54504b041e9 => {
5275                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5276                        let mut req = fidl::new_empty!(
5277                            fidl::encoding::EmptyPayload,
5278                            fidl::encoding::DefaultFuchsiaResourceDialect
5279                        );
5280                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5281                        let control_handle = IrqResourceControlHandle { inner: this.inner.clone() };
5282                        Ok(IrqResourceRequest::Get {
5283                            responder: IrqResourceGetResponder {
5284                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5285                                tx_id: header.tx_id,
5286                            },
5287                        })
5288                    }
5289                    _ => Err(fidl::Error::UnknownOrdinal {
5290                        ordinal: header.ordinal,
5291                        protocol_name:
5292                            <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5293                    }),
5294                }))
5295            },
5296        )
5297    }
5298}
5299
5300/// Protocol for providing an IRQ resource with access to all valid ranges.
5301#[derive(Debug)]
5302pub enum IrqResourceRequest {
5303    /// Get an IRQ resource handle.
5304    Get { responder: IrqResourceGetResponder },
5305}
5306
5307impl IrqResourceRequest {
5308    #[allow(irrefutable_let_patterns)]
5309    pub fn into_get(self) -> Option<(IrqResourceGetResponder)> {
5310        if let IrqResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5311    }
5312
5313    /// Name of the method defined in FIDL
5314    pub fn method_name(&self) -> &'static str {
5315        match *self {
5316            IrqResourceRequest::Get { .. } => "get",
5317        }
5318    }
5319}
5320
5321#[derive(Debug, Clone)]
5322pub struct IrqResourceControlHandle {
5323    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5324}
5325
5326impl IrqResourceControlHandle {
5327    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5328        self.inner.shutdown_with_epitaph(status.into())
5329    }
5330}
5331
5332impl fidl::endpoints::ControlHandle for IrqResourceControlHandle {
5333    fn shutdown(&self) {
5334        self.inner.shutdown()
5335    }
5336
5337    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5338        self.inner.shutdown_with_epitaph(status)
5339    }
5340
5341    fn is_closed(&self) -> bool {
5342        self.inner.channel().is_closed()
5343    }
5344    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5345        self.inner.channel().on_closed()
5346    }
5347
5348    #[cfg(target_os = "fuchsia")]
5349    fn signal_peer(
5350        &self,
5351        clear_mask: zx::Signals,
5352        set_mask: zx::Signals,
5353    ) -> Result<(), zx_status::Status> {
5354        use fidl::Peered;
5355        self.inner.channel().signal_peer(clear_mask, set_mask)
5356    }
5357}
5358
5359impl IrqResourceControlHandle {}
5360
5361#[must_use = "FIDL methods require a response to be sent"]
5362#[derive(Debug)]
5363pub struct IrqResourceGetResponder {
5364    control_handle: std::mem::ManuallyDrop<IrqResourceControlHandle>,
5365    tx_id: u32,
5366}
5367
5368/// Set the the channel to be shutdown (see [`IrqResourceControlHandle::shutdown`])
5369/// if the responder is dropped without sending a response, so that the client
5370/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5371impl std::ops::Drop for IrqResourceGetResponder {
5372    fn drop(&mut self) {
5373        self.control_handle.shutdown();
5374        // Safety: drops once, never accessed again
5375        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5376    }
5377}
5378
5379impl fidl::endpoints::Responder for IrqResourceGetResponder {
5380    type ControlHandle = IrqResourceControlHandle;
5381
5382    fn control_handle(&self) -> &IrqResourceControlHandle {
5383        &self.control_handle
5384    }
5385
5386    fn drop_without_shutdown(mut self) {
5387        // Safety: drops once, never accessed again due to mem::forget
5388        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5389        // Prevent Drop from running (which would shut down the channel)
5390        std::mem::forget(self);
5391    }
5392}
5393
5394impl IrqResourceGetResponder {
5395    /// Sends a response to the FIDL transaction.
5396    ///
5397    /// Sets the channel to shutdown if an error occurs.
5398    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5399        let _result = self.send_raw(resource);
5400        if _result.is_err() {
5401            self.control_handle.shutdown();
5402        }
5403        self.drop_without_shutdown();
5404        _result
5405    }
5406
5407    /// Similar to "send" but does not shutdown the channel if an error occurs.
5408    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5409        let _result = self.send_raw(resource);
5410        self.drop_without_shutdown();
5411        _result
5412    }
5413
5414    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5415        self.control_handle.inner.send::<IrqResourceGetResponse>(
5416            (resource,),
5417            self.tx_id,
5418            0x491be54504b041e9,
5419            fidl::encoding::DynamicFlags::empty(),
5420        )
5421    }
5422}
5423
5424#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5425pub struct MexecResourceMarker;
5426
5427impl fidl::endpoints::ProtocolMarker for MexecResourceMarker {
5428    type Proxy = MexecResourceProxy;
5429    type RequestStream = MexecResourceRequestStream;
5430    #[cfg(target_os = "fuchsia")]
5431    type SynchronousProxy = MexecResourceSynchronousProxy;
5432
5433    const DEBUG_NAME: &'static str = "fuchsia.kernel.MexecResource";
5434}
5435impl fidl::endpoints::DiscoverableProtocolMarker for MexecResourceMarker {}
5436
5437pub trait MexecResourceProxyInterface: Send + Sync {
5438    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5439    fn r#get(&self) -> Self::GetResponseFut;
5440}
5441#[derive(Debug)]
5442#[cfg(target_os = "fuchsia")]
5443pub struct MexecResourceSynchronousProxy {
5444    client: fidl::client::sync::Client,
5445}
5446
5447#[cfg(target_os = "fuchsia")]
5448impl fidl::endpoints::SynchronousProxy for MexecResourceSynchronousProxy {
5449    type Proxy = MexecResourceProxy;
5450    type Protocol = MexecResourceMarker;
5451
5452    fn from_channel(inner: fidl::Channel) -> Self {
5453        Self::new(inner)
5454    }
5455
5456    fn into_channel(self) -> fidl::Channel {
5457        self.client.into_channel()
5458    }
5459
5460    fn as_channel(&self) -> &fidl::Channel {
5461        self.client.as_channel()
5462    }
5463}
5464
5465#[cfg(target_os = "fuchsia")]
5466impl MexecResourceSynchronousProxy {
5467    pub fn new(channel: fidl::Channel) -> Self {
5468        Self { client: fidl::client::sync::Client::new(channel) }
5469    }
5470
5471    pub fn into_channel(self) -> fidl::Channel {
5472        self.client.into_channel()
5473    }
5474
5475    /// Waits until an event arrives and returns it. It is safe for other
5476    /// threads to make concurrent requests while waiting for an event.
5477    pub fn wait_for_event(
5478        &self,
5479        deadline: zx::MonotonicInstant,
5480    ) -> Result<MexecResourceEvent, fidl::Error> {
5481        MexecResourceEvent::decode(self.client.wait_for_event::<MexecResourceMarker>(deadline)?)
5482    }
5483
5484    /// Get an MEXEC resource handle as `resource`.
5485    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5486        let _response = self.client.send_query::<
5487            fidl::encoding::EmptyPayload,
5488            MexecResourceGetResponse,
5489            MexecResourceMarker,
5490        >(
5491            (),
5492            0xff93e6722900f54,
5493            fidl::encoding::DynamicFlags::empty(),
5494            ___deadline,
5495        )?;
5496        Ok(_response.resource)
5497    }
5498}
5499
5500#[cfg(target_os = "fuchsia")]
5501impl From<MexecResourceSynchronousProxy> for zx::NullableHandle {
5502    fn from(value: MexecResourceSynchronousProxy) -> Self {
5503        value.into_channel().into()
5504    }
5505}
5506
5507#[cfg(target_os = "fuchsia")]
5508impl From<fidl::Channel> for MexecResourceSynchronousProxy {
5509    fn from(value: fidl::Channel) -> Self {
5510        Self::new(value)
5511    }
5512}
5513
5514#[cfg(target_os = "fuchsia")]
5515impl fidl::endpoints::FromClient for MexecResourceSynchronousProxy {
5516    type Protocol = MexecResourceMarker;
5517
5518    fn from_client(value: fidl::endpoints::ClientEnd<MexecResourceMarker>) -> Self {
5519        Self::new(value.into_channel())
5520    }
5521}
5522
5523#[derive(Debug, Clone)]
5524pub struct MexecResourceProxy {
5525    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5526}
5527
5528impl fidl::endpoints::Proxy for MexecResourceProxy {
5529    type Protocol = MexecResourceMarker;
5530
5531    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5532        Self::new(inner)
5533    }
5534
5535    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5536        self.client.into_channel().map_err(|client| Self { client })
5537    }
5538
5539    fn as_channel(&self) -> &::fidl::AsyncChannel {
5540        self.client.as_channel()
5541    }
5542}
5543
5544impl MexecResourceProxy {
5545    /// Create a new Proxy for fuchsia.kernel/MexecResource.
5546    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5547        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5548        Self { client: fidl::client::Client::new(channel, protocol_name) }
5549    }
5550
5551    /// Get a Stream of events from the remote end of the protocol.
5552    ///
5553    /// # Panics
5554    ///
5555    /// Panics if the event stream was already taken.
5556    pub fn take_event_stream(&self) -> MexecResourceEventStream {
5557        MexecResourceEventStream { event_receiver: self.client.take_event_receiver() }
5558    }
5559
5560    /// Get an MEXEC resource handle as `resource`.
5561    pub fn r#get(
5562        &self,
5563    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5564    {
5565        MexecResourceProxyInterface::r#get(self)
5566    }
5567}
5568
5569impl MexecResourceProxyInterface for MexecResourceProxy {
5570    type GetResponseFut = fidl::client::QueryResponseFut<
5571        fidl::Resource,
5572        fidl::encoding::DefaultFuchsiaResourceDialect,
5573    >;
5574    fn r#get(&self) -> Self::GetResponseFut {
5575        fn _decode(
5576            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5577        ) -> Result<fidl::Resource, fidl::Error> {
5578            let _response = fidl::client::decode_transaction_body::<
5579                MexecResourceGetResponse,
5580                fidl::encoding::DefaultFuchsiaResourceDialect,
5581                0xff93e6722900f54,
5582            >(_buf?)?;
5583            Ok(_response.resource)
5584        }
5585        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5586            (),
5587            0xff93e6722900f54,
5588            fidl::encoding::DynamicFlags::empty(),
5589            _decode,
5590        )
5591    }
5592}
5593
5594pub struct MexecResourceEventStream {
5595    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5596}
5597
5598impl std::marker::Unpin for MexecResourceEventStream {}
5599
5600impl futures::stream::FusedStream for MexecResourceEventStream {
5601    fn is_terminated(&self) -> bool {
5602        self.event_receiver.is_terminated()
5603    }
5604}
5605
5606impl futures::Stream for MexecResourceEventStream {
5607    type Item = Result<MexecResourceEvent, fidl::Error>;
5608
5609    fn poll_next(
5610        mut self: std::pin::Pin<&mut Self>,
5611        cx: &mut std::task::Context<'_>,
5612    ) -> std::task::Poll<Option<Self::Item>> {
5613        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5614            &mut self.event_receiver,
5615            cx
5616        )?) {
5617            Some(buf) => std::task::Poll::Ready(Some(MexecResourceEvent::decode(buf))),
5618            None => std::task::Poll::Ready(None),
5619        }
5620    }
5621}
5622
5623#[derive(Debug)]
5624pub enum MexecResourceEvent {}
5625
5626impl MexecResourceEvent {
5627    /// Decodes a message buffer as a [`MexecResourceEvent`].
5628    fn decode(
5629        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5630    ) -> Result<MexecResourceEvent, fidl::Error> {
5631        let (bytes, _handles) = buf.split_mut();
5632        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5633        debug_assert_eq!(tx_header.tx_id, 0);
5634        match tx_header.ordinal {
5635            _ => Err(fidl::Error::UnknownOrdinal {
5636                ordinal: tx_header.ordinal,
5637                protocol_name: <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5638            }),
5639        }
5640    }
5641}
5642
5643/// A Stream of incoming requests for fuchsia.kernel/MexecResource.
5644pub struct MexecResourceRequestStream {
5645    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5646    is_terminated: bool,
5647}
5648
5649impl std::marker::Unpin for MexecResourceRequestStream {}
5650
5651impl futures::stream::FusedStream for MexecResourceRequestStream {
5652    fn is_terminated(&self) -> bool {
5653        self.is_terminated
5654    }
5655}
5656
5657impl fidl::endpoints::RequestStream for MexecResourceRequestStream {
5658    type Protocol = MexecResourceMarker;
5659    type ControlHandle = MexecResourceControlHandle;
5660
5661    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5662        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5663    }
5664
5665    fn control_handle(&self) -> Self::ControlHandle {
5666        MexecResourceControlHandle { inner: self.inner.clone() }
5667    }
5668
5669    fn into_inner(
5670        self,
5671    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5672    {
5673        (self.inner, self.is_terminated)
5674    }
5675
5676    fn from_inner(
5677        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5678        is_terminated: bool,
5679    ) -> Self {
5680        Self { inner, is_terminated }
5681    }
5682}
5683
5684impl futures::Stream for MexecResourceRequestStream {
5685    type Item = Result<MexecResourceRequest, fidl::Error>;
5686
5687    fn poll_next(
5688        mut self: std::pin::Pin<&mut Self>,
5689        cx: &mut std::task::Context<'_>,
5690    ) -> std::task::Poll<Option<Self::Item>> {
5691        let this = &mut *self;
5692        if this.inner.check_shutdown(cx) {
5693            this.is_terminated = true;
5694            return std::task::Poll::Ready(None);
5695        }
5696        if this.is_terminated {
5697            panic!("polled MexecResourceRequestStream after completion");
5698        }
5699        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5700            |bytes, handles| {
5701                match this.inner.channel().read_etc(cx, bytes, handles) {
5702                    std::task::Poll::Ready(Ok(())) => {}
5703                    std::task::Poll::Pending => return std::task::Poll::Pending,
5704                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5705                        this.is_terminated = true;
5706                        return std::task::Poll::Ready(None);
5707                    }
5708                    std::task::Poll::Ready(Err(e)) => {
5709                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5710                            e.into(),
5711                        ))));
5712                    }
5713                }
5714
5715                // A message has been received from the channel
5716                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5717
5718                std::task::Poll::Ready(Some(match header.ordinal {
5719                    0xff93e6722900f54 => {
5720                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5721                        let mut req = fidl::new_empty!(
5722                            fidl::encoding::EmptyPayload,
5723                            fidl::encoding::DefaultFuchsiaResourceDialect
5724                        );
5725                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5726                        let control_handle =
5727                            MexecResourceControlHandle { inner: this.inner.clone() };
5728                        Ok(MexecResourceRequest::Get {
5729                            responder: MexecResourceGetResponder {
5730                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5731                                tx_id: header.tx_id,
5732                            },
5733                        })
5734                    }
5735                    _ => Err(fidl::Error::UnknownOrdinal {
5736                        ordinal: header.ordinal,
5737                        protocol_name:
5738                            <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5739                    }),
5740                }))
5741            },
5742        )
5743    }
5744}
5745
5746/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
5747/// `ZX_RSRC_SYSTEM_MEXEC_BASE`.
5748#[derive(Debug)]
5749pub enum MexecResourceRequest {
5750    /// Get an MEXEC resource handle as `resource`.
5751    Get { responder: MexecResourceGetResponder },
5752}
5753
5754impl MexecResourceRequest {
5755    #[allow(irrefutable_let_patterns)]
5756    pub fn into_get(self) -> Option<(MexecResourceGetResponder)> {
5757        if let MexecResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5758    }
5759
5760    /// Name of the method defined in FIDL
5761    pub fn method_name(&self) -> &'static str {
5762        match *self {
5763            MexecResourceRequest::Get { .. } => "get",
5764        }
5765    }
5766}
5767
5768#[derive(Debug, Clone)]
5769pub struct MexecResourceControlHandle {
5770    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5771}
5772
5773impl MexecResourceControlHandle {
5774    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5775        self.inner.shutdown_with_epitaph(status.into())
5776    }
5777}
5778
5779impl fidl::endpoints::ControlHandle for MexecResourceControlHandle {
5780    fn shutdown(&self) {
5781        self.inner.shutdown()
5782    }
5783
5784    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5785        self.inner.shutdown_with_epitaph(status)
5786    }
5787
5788    fn is_closed(&self) -> bool {
5789        self.inner.channel().is_closed()
5790    }
5791    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5792        self.inner.channel().on_closed()
5793    }
5794
5795    #[cfg(target_os = "fuchsia")]
5796    fn signal_peer(
5797        &self,
5798        clear_mask: zx::Signals,
5799        set_mask: zx::Signals,
5800    ) -> Result<(), zx_status::Status> {
5801        use fidl::Peered;
5802        self.inner.channel().signal_peer(clear_mask, set_mask)
5803    }
5804}
5805
5806impl MexecResourceControlHandle {}
5807
5808#[must_use = "FIDL methods require a response to be sent"]
5809#[derive(Debug)]
5810pub struct MexecResourceGetResponder {
5811    control_handle: std::mem::ManuallyDrop<MexecResourceControlHandle>,
5812    tx_id: u32,
5813}
5814
5815/// Set the the channel to be shutdown (see [`MexecResourceControlHandle::shutdown`])
5816/// if the responder is dropped without sending a response, so that the client
5817/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5818impl std::ops::Drop for MexecResourceGetResponder {
5819    fn drop(&mut self) {
5820        self.control_handle.shutdown();
5821        // Safety: drops once, never accessed again
5822        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5823    }
5824}
5825
5826impl fidl::endpoints::Responder for MexecResourceGetResponder {
5827    type ControlHandle = MexecResourceControlHandle;
5828
5829    fn control_handle(&self) -> &MexecResourceControlHandle {
5830        &self.control_handle
5831    }
5832
5833    fn drop_without_shutdown(mut self) {
5834        // Safety: drops once, never accessed again due to mem::forget
5835        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5836        // Prevent Drop from running (which would shut down the channel)
5837        std::mem::forget(self);
5838    }
5839}
5840
5841impl MexecResourceGetResponder {
5842    /// Sends a response to the FIDL transaction.
5843    ///
5844    /// Sets the channel to shutdown if an error occurs.
5845    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5846        let _result = self.send_raw(resource);
5847        if _result.is_err() {
5848            self.control_handle.shutdown();
5849        }
5850        self.drop_without_shutdown();
5851        _result
5852    }
5853
5854    /// Similar to "send" but does not shutdown the channel if an error occurs.
5855    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5856        let _result = self.send_raw(resource);
5857        self.drop_without_shutdown();
5858        _result
5859    }
5860
5861    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5862        self.control_handle.inner.send::<MexecResourceGetResponse>(
5863            (resource,),
5864            self.tx_id,
5865            0xff93e6722900f54,
5866            fidl::encoding::DynamicFlags::empty(),
5867        )
5868    }
5869}
5870
5871#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5872pub struct MmioResourceMarker;
5873
5874impl fidl::endpoints::ProtocolMarker for MmioResourceMarker {
5875    type Proxy = MmioResourceProxy;
5876    type RequestStream = MmioResourceRequestStream;
5877    #[cfg(target_os = "fuchsia")]
5878    type SynchronousProxy = MmioResourceSynchronousProxy;
5879
5880    const DEBUG_NAME: &'static str = "fuchsia.kernel.MmioResource";
5881}
5882impl fidl::endpoints::DiscoverableProtocolMarker for MmioResourceMarker {}
5883
5884pub trait MmioResourceProxyInterface: Send + Sync {
5885    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5886    fn r#get(&self) -> Self::GetResponseFut;
5887}
5888#[derive(Debug)]
5889#[cfg(target_os = "fuchsia")]
5890pub struct MmioResourceSynchronousProxy {
5891    client: fidl::client::sync::Client,
5892}
5893
5894#[cfg(target_os = "fuchsia")]
5895impl fidl::endpoints::SynchronousProxy for MmioResourceSynchronousProxy {
5896    type Proxy = MmioResourceProxy;
5897    type Protocol = MmioResourceMarker;
5898
5899    fn from_channel(inner: fidl::Channel) -> Self {
5900        Self::new(inner)
5901    }
5902
5903    fn into_channel(self) -> fidl::Channel {
5904        self.client.into_channel()
5905    }
5906
5907    fn as_channel(&self) -> &fidl::Channel {
5908        self.client.as_channel()
5909    }
5910}
5911
5912#[cfg(target_os = "fuchsia")]
5913impl MmioResourceSynchronousProxy {
5914    pub fn new(channel: fidl::Channel) -> Self {
5915        Self { client: fidl::client::sync::Client::new(channel) }
5916    }
5917
5918    pub fn into_channel(self) -> fidl::Channel {
5919        self.client.into_channel()
5920    }
5921
5922    /// Waits until an event arrives and returns it. It is safe for other
5923    /// threads to make concurrent requests while waiting for an event.
5924    pub fn wait_for_event(
5925        &self,
5926        deadline: zx::MonotonicInstant,
5927    ) -> Result<MmioResourceEvent, fidl::Error> {
5928        MmioResourceEvent::decode(self.client.wait_for_event::<MmioResourceMarker>(deadline)?)
5929    }
5930
5931    /// Get an MMIO resource handle.
5932    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5933        let _response = self.client.send_query::<
5934            fidl::encoding::EmptyPayload,
5935            MmioResourceGetResponse,
5936            MmioResourceMarker,
5937        >(
5938            (),
5939            0x66747b9c5a6dfe7b,
5940            fidl::encoding::DynamicFlags::empty(),
5941            ___deadline,
5942        )?;
5943        Ok(_response.resource)
5944    }
5945}
5946
5947#[cfg(target_os = "fuchsia")]
5948impl From<MmioResourceSynchronousProxy> for zx::NullableHandle {
5949    fn from(value: MmioResourceSynchronousProxy) -> Self {
5950        value.into_channel().into()
5951    }
5952}
5953
5954#[cfg(target_os = "fuchsia")]
5955impl From<fidl::Channel> for MmioResourceSynchronousProxy {
5956    fn from(value: fidl::Channel) -> Self {
5957        Self::new(value)
5958    }
5959}
5960
5961#[cfg(target_os = "fuchsia")]
5962impl fidl::endpoints::FromClient for MmioResourceSynchronousProxy {
5963    type Protocol = MmioResourceMarker;
5964
5965    fn from_client(value: fidl::endpoints::ClientEnd<MmioResourceMarker>) -> Self {
5966        Self::new(value.into_channel())
5967    }
5968}
5969
5970#[derive(Debug, Clone)]
5971pub struct MmioResourceProxy {
5972    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5973}
5974
5975impl fidl::endpoints::Proxy for MmioResourceProxy {
5976    type Protocol = MmioResourceMarker;
5977
5978    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5979        Self::new(inner)
5980    }
5981
5982    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5983        self.client.into_channel().map_err(|client| Self { client })
5984    }
5985
5986    fn as_channel(&self) -> &::fidl::AsyncChannel {
5987        self.client.as_channel()
5988    }
5989}
5990
5991impl MmioResourceProxy {
5992    /// Create a new Proxy for fuchsia.kernel/MmioResource.
5993    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5994        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5995        Self { client: fidl::client::Client::new(channel, protocol_name) }
5996    }
5997
5998    /// Get a Stream of events from the remote end of the protocol.
5999    ///
6000    /// # Panics
6001    ///
6002    /// Panics if the event stream was already taken.
6003    pub fn take_event_stream(&self) -> MmioResourceEventStream {
6004        MmioResourceEventStream { event_receiver: self.client.take_event_receiver() }
6005    }
6006
6007    /// Get an MMIO resource handle.
6008    pub fn r#get(
6009        &self,
6010    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6011    {
6012        MmioResourceProxyInterface::r#get(self)
6013    }
6014}
6015
6016impl MmioResourceProxyInterface for MmioResourceProxy {
6017    type GetResponseFut = fidl::client::QueryResponseFut<
6018        fidl::Resource,
6019        fidl::encoding::DefaultFuchsiaResourceDialect,
6020    >;
6021    fn r#get(&self) -> Self::GetResponseFut {
6022        fn _decode(
6023            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6024        ) -> Result<fidl::Resource, fidl::Error> {
6025            let _response = fidl::client::decode_transaction_body::<
6026                MmioResourceGetResponse,
6027                fidl::encoding::DefaultFuchsiaResourceDialect,
6028                0x66747b9c5a6dfe7b,
6029            >(_buf?)?;
6030            Ok(_response.resource)
6031        }
6032        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6033            (),
6034            0x66747b9c5a6dfe7b,
6035            fidl::encoding::DynamicFlags::empty(),
6036            _decode,
6037        )
6038    }
6039}
6040
6041pub struct MmioResourceEventStream {
6042    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6043}
6044
6045impl std::marker::Unpin for MmioResourceEventStream {}
6046
6047impl futures::stream::FusedStream for MmioResourceEventStream {
6048    fn is_terminated(&self) -> bool {
6049        self.event_receiver.is_terminated()
6050    }
6051}
6052
6053impl futures::Stream for MmioResourceEventStream {
6054    type Item = Result<MmioResourceEvent, fidl::Error>;
6055
6056    fn poll_next(
6057        mut self: std::pin::Pin<&mut Self>,
6058        cx: &mut std::task::Context<'_>,
6059    ) -> std::task::Poll<Option<Self::Item>> {
6060        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6061            &mut self.event_receiver,
6062            cx
6063        )?) {
6064            Some(buf) => std::task::Poll::Ready(Some(MmioResourceEvent::decode(buf))),
6065            None => std::task::Poll::Ready(None),
6066        }
6067    }
6068}
6069
6070#[derive(Debug)]
6071pub enum MmioResourceEvent {}
6072
6073impl MmioResourceEvent {
6074    /// Decodes a message buffer as a [`MmioResourceEvent`].
6075    fn decode(
6076        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6077    ) -> Result<MmioResourceEvent, fidl::Error> {
6078        let (bytes, _handles) = buf.split_mut();
6079        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6080        debug_assert_eq!(tx_header.tx_id, 0);
6081        match tx_header.ordinal {
6082            _ => Err(fidl::Error::UnknownOrdinal {
6083                ordinal: tx_header.ordinal,
6084                protocol_name: <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6085            }),
6086        }
6087    }
6088}
6089
6090/// A Stream of incoming requests for fuchsia.kernel/MmioResource.
6091pub struct MmioResourceRequestStream {
6092    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6093    is_terminated: bool,
6094}
6095
6096impl std::marker::Unpin for MmioResourceRequestStream {}
6097
6098impl futures::stream::FusedStream for MmioResourceRequestStream {
6099    fn is_terminated(&self) -> bool {
6100        self.is_terminated
6101    }
6102}
6103
6104impl fidl::endpoints::RequestStream for MmioResourceRequestStream {
6105    type Protocol = MmioResourceMarker;
6106    type ControlHandle = MmioResourceControlHandle;
6107
6108    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6109        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6110    }
6111
6112    fn control_handle(&self) -> Self::ControlHandle {
6113        MmioResourceControlHandle { inner: self.inner.clone() }
6114    }
6115
6116    fn into_inner(
6117        self,
6118    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6119    {
6120        (self.inner, self.is_terminated)
6121    }
6122
6123    fn from_inner(
6124        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6125        is_terminated: bool,
6126    ) -> Self {
6127        Self { inner, is_terminated }
6128    }
6129}
6130
6131impl futures::Stream for MmioResourceRequestStream {
6132    type Item = Result<MmioResourceRequest, fidl::Error>;
6133
6134    fn poll_next(
6135        mut self: std::pin::Pin<&mut Self>,
6136        cx: &mut std::task::Context<'_>,
6137    ) -> std::task::Poll<Option<Self::Item>> {
6138        let this = &mut *self;
6139        if this.inner.check_shutdown(cx) {
6140            this.is_terminated = true;
6141            return std::task::Poll::Ready(None);
6142        }
6143        if this.is_terminated {
6144            panic!("polled MmioResourceRequestStream after completion");
6145        }
6146        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6147            |bytes, handles| {
6148                match this.inner.channel().read_etc(cx, bytes, handles) {
6149                    std::task::Poll::Ready(Ok(())) => {}
6150                    std::task::Poll::Pending => return std::task::Poll::Pending,
6151                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6152                        this.is_terminated = true;
6153                        return std::task::Poll::Ready(None);
6154                    }
6155                    std::task::Poll::Ready(Err(e)) => {
6156                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6157                            e.into(),
6158                        ))));
6159                    }
6160                }
6161
6162                // A message has been received from the channel
6163                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6164
6165                std::task::Poll::Ready(Some(match header.ordinal {
6166                    0x66747b9c5a6dfe7b => {
6167                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6168                        let mut req = fidl::new_empty!(
6169                            fidl::encoding::EmptyPayload,
6170                            fidl::encoding::DefaultFuchsiaResourceDialect
6171                        );
6172                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6173                        let control_handle =
6174                            MmioResourceControlHandle { inner: this.inner.clone() };
6175                        Ok(MmioResourceRequest::Get {
6176                            responder: MmioResourceGetResponder {
6177                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6178                                tx_id: header.tx_id,
6179                            },
6180                        })
6181                    }
6182                    _ => Err(fidl::Error::UnknownOrdinal {
6183                        ordinal: header.ordinal,
6184                        protocol_name:
6185                            <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6186                    }),
6187                }))
6188            },
6189        )
6190    }
6191}
6192
6193/// Protocol for providing an MMIO resource with access to all valid ranges.
6194#[derive(Debug)]
6195pub enum MmioResourceRequest {
6196    /// Get an MMIO resource handle.
6197    Get { responder: MmioResourceGetResponder },
6198}
6199
6200impl MmioResourceRequest {
6201    #[allow(irrefutable_let_patterns)]
6202    pub fn into_get(self) -> Option<(MmioResourceGetResponder)> {
6203        if let MmioResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6204    }
6205
6206    /// Name of the method defined in FIDL
6207    pub fn method_name(&self) -> &'static str {
6208        match *self {
6209            MmioResourceRequest::Get { .. } => "get",
6210        }
6211    }
6212}
6213
6214#[derive(Debug, Clone)]
6215pub struct MmioResourceControlHandle {
6216    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6217}
6218
6219impl MmioResourceControlHandle {
6220    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6221        self.inner.shutdown_with_epitaph(status.into())
6222    }
6223}
6224
6225impl fidl::endpoints::ControlHandle for MmioResourceControlHandle {
6226    fn shutdown(&self) {
6227        self.inner.shutdown()
6228    }
6229
6230    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6231        self.inner.shutdown_with_epitaph(status)
6232    }
6233
6234    fn is_closed(&self) -> bool {
6235        self.inner.channel().is_closed()
6236    }
6237    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6238        self.inner.channel().on_closed()
6239    }
6240
6241    #[cfg(target_os = "fuchsia")]
6242    fn signal_peer(
6243        &self,
6244        clear_mask: zx::Signals,
6245        set_mask: zx::Signals,
6246    ) -> Result<(), zx_status::Status> {
6247        use fidl::Peered;
6248        self.inner.channel().signal_peer(clear_mask, set_mask)
6249    }
6250}
6251
6252impl MmioResourceControlHandle {}
6253
6254#[must_use = "FIDL methods require a response to be sent"]
6255#[derive(Debug)]
6256pub struct MmioResourceGetResponder {
6257    control_handle: std::mem::ManuallyDrop<MmioResourceControlHandle>,
6258    tx_id: u32,
6259}
6260
6261/// Set the the channel to be shutdown (see [`MmioResourceControlHandle::shutdown`])
6262/// if the responder is dropped without sending a response, so that the client
6263/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6264impl std::ops::Drop for MmioResourceGetResponder {
6265    fn drop(&mut self) {
6266        self.control_handle.shutdown();
6267        // Safety: drops once, never accessed again
6268        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6269    }
6270}
6271
6272impl fidl::endpoints::Responder for MmioResourceGetResponder {
6273    type ControlHandle = MmioResourceControlHandle;
6274
6275    fn control_handle(&self) -> &MmioResourceControlHandle {
6276        &self.control_handle
6277    }
6278
6279    fn drop_without_shutdown(mut self) {
6280        // Safety: drops once, never accessed again due to mem::forget
6281        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6282        // Prevent Drop from running (which would shut down the channel)
6283        std::mem::forget(self);
6284    }
6285}
6286
6287impl MmioResourceGetResponder {
6288    /// Sends a response to the FIDL transaction.
6289    ///
6290    /// Sets the channel to shutdown if an error occurs.
6291    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6292        let _result = self.send_raw(resource);
6293        if _result.is_err() {
6294            self.control_handle.shutdown();
6295        }
6296        self.drop_without_shutdown();
6297        _result
6298    }
6299
6300    /// Similar to "send" but does not shutdown the channel if an error occurs.
6301    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6302        let _result = self.send_raw(resource);
6303        self.drop_without_shutdown();
6304        _result
6305    }
6306
6307    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6308        self.control_handle.inner.send::<MmioResourceGetResponse>(
6309            (resource,),
6310            self.tx_id,
6311            0x66747b9c5a6dfe7b,
6312            fidl::encoding::DynamicFlags::empty(),
6313        )
6314    }
6315}
6316
6317#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6318pub struct MsiResourceMarker;
6319
6320impl fidl::endpoints::ProtocolMarker for MsiResourceMarker {
6321    type Proxy = MsiResourceProxy;
6322    type RequestStream = MsiResourceRequestStream;
6323    #[cfg(target_os = "fuchsia")]
6324    type SynchronousProxy = MsiResourceSynchronousProxy;
6325
6326    const DEBUG_NAME: &'static str = "fuchsia.kernel.MsiResource";
6327}
6328impl fidl::endpoints::DiscoverableProtocolMarker for MsiResourceMarker {}
6329
6330pub trait MsiResourceProxyInterface: Send + Sync {
6331    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6332    fn r#get(&self) -> Self::GetResponseFut;
6333}
6334#[derive(Debug)]
6335#[cfg(target_os = "fuchsia")]
6336pub struct MsiResourceSynchronousProxy {
6337    client: fidl::client::sync::Client,
6338}
6339
6340#[cfg(target_os = "fuchsia")]
6341impl fidl::endpoints::SynchronousProxy for MsiResourceSynchronousProxy {
6342    type Proxy = MsiResourceProxy;
6343    type Protocol = MsiResourceMarker;
6344
6345    fn from_channel(inner: fidl::Channel) -> Self {
6346        Self::new(inner)
6347    }
6348
6349    fn into_channel(self) -> fidl::Channel {
6350        self.client.into_channel()
6351    }
6352
6353    fn as_channel(&self) -> &fidl::Channel {
6354        self.client.as_channel()
6355    }
6356}
6357
6358#[cfg(target_os = "fuchsia")]
6359impl MsiResourceSynchronousProxy {
6360    pub fn new(channel: fidl::Channel) -> Self {
6361        Self { client: fidl::client::sync::Client::new(channel) }
6362    }
6363
6364    pub fn into_channel(self) -> fidl::Channel {
6365        self.client.into_channel()
6366    }
6367
6368    /// Waits until an event arrives and returns it. It is safe for other
6369    /// threads to make concurrent requests while waiting for an event.
6370    pub fn wait_for_event(
6371        &self,
6372        deadline: zx::MonotonicInstant,
6373    ) -> Result<MsiResourceEvent, fidl::Error> {
6374        MsiResourceEvent::decode(self.client.wait_for_event::<MsiResourceMarker>(deadline)?)
6375    }
6376
6377    /// Get an msi resource handle.
6378    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6379        let _response = self
6380            .client
6381            .send_query::<fidl::encoding::EmptyPayload, MsiResourceGetResponse, MsiResourceMarker>(
6382                (),
6383                0x360a97e47e8c4f1f,
6384                fidl::encoding::DynamicFlags::empty(),
6385                ___deadline,
6386            )?;
6387        Ok(_response.resource)
6388    }
6389}
6390
6391#[cfg(target_os = "fuchsia")]
6392impl From<MsiResourceSynchronousProxy> for zx::NullableHandle {
6393    fn from(value: MsiResourceSynchronousProxy) -> Self {
6394        value.into_channel().into()
6395    }
6396}
6397
6398#[cfg(target_os = "fuchsia")]
6399impl From<fidl::Channel> for MsiResourceSynchronousProxy {
6400    fn from(value: fidl::Channel) -> Self {
6401        Self::new(value)
6402    }
6403}
6404
6405#[cfg(target_os = "fuchsia")]
6406impl fidl::endpoints::FromClient for MsiResourceSynchronousProxy {
6407    type Protocol = MsiResourceMarker;
6408
6409    fn from_client(value: fidl::endpoints::ClientEnd<MsiResourceMarker>) -> Self {
6410        Self::new(value.into_channel())
6411    }
6412}
6413
6414#[derive(Debug, Clone)]
6415pub struct MsiResourceProxy {
6416    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6417}
6418
6419impl fidl::endpoints::Proxy for MsiResourceProxy {
6420    type Protocol = MsiResourceMarker;
6421
6422    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6423        Self::new(inner)
6424    }
6425
6426    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6427        self.client.into_channel().map_err(|client| Self { client })
6428    }
6429
6430    fn as_channel(&self) -> &::fidl::AsyncChannel {
6431        self.client.as_channel()
6432    }
6433}
6434
6435impl MsiResourceProxy {
6436    /// Create a new Proxy for fuchsia.kernel/MsiResource.
6437    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6438        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6439        Self { client: fidl::client::Client::new(channel, protocol_name) }
6440    }
6441
6442    /// Get a Stream of events from the remote end of the protocol.
6443    ///
6444    /// # Panics
6445    ///
6446    /// Panics if the event stream was already taken.
6447    pub fn take_event_stream(&self) -> MsiResourceEventStream {
6448        MsiResourceEventStream { event_receiver: self.client.take_event_receiver() }
6449    }
6450
6451    /// Get an msi resource handle.
6452    pub fn r#get(
6453        &self,
6454    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6455    {
6456        MsiResourceProxyInterface::r#get(self)
6457    }
6458}
6459
6460impl MsiResourceProxyInterface for MsiResourceProxy {
6461    type GetResponseFut = fidl::client::QueryResponseFut<
6462        fidl::Resource,
6463        fidl::encoding::DefaultFuchsiaResourceDialect,
6464    >;
6465    fn r#get(&self) -> Self::GetResponseFut {
6466        fn _decode(
6467            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6468        ) -> Result<fidl::Resource, fidl::Error> {
6469            let _response = fidl::client::decode_transaction_body::<
6470                MsiResourceGetResponse,
6471                fidl::encoding::DefaultFuchsiaResourceDialect,
6472                0x360a97e47e8c4f1f,
6473            >(_buf?)?;
6474            Ok(_response.resource)
6475        }
6476        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6477            (),
6478            0x360a97e47e8c4f1f,
6479            fidl::encoding::DynamicFlags::empty(),
6480            _decode,
6481        )
6482    }
6483}
6484
6485pub struct MsiResourceEventStream {
6486    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6487}
6488
6489impl std::marker::Unpin for MsiResourceEventStream {}
6490
6491impl futures::stream::FusedStream for MsiResourceEventStream {
6492    fn is_terminated(&self) -> bool {
6493        self.event_receiver.is_terminated()
6494    }
6495}
6496
6497impl futures::Stream for MsiResourceEventStream {
6498    type Item = Result<MsiResourceEvent, fidl::Error>;
6499
6500    fn poll_next(
6501        mut self: std::pin::Pin<&mut Self>,
6502        cx: &mut std::task::Context<'_>,
6503    ) -> std::task::Poll<Option<Self::Item>> {
6504        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6505            &mut self.event_receiver,
6506            cx
6507        )?) {
6508            Some(buf) => std::task::Poll::Ready(Some(MsiResourceEvent::decode(buf))),
6509            None => std::task::Poll::Ready(None),
6510        }
6511    }
6512}
6513
6514#[derive(Debug)]
6515pub enum MsiResourceEvent {}
6516
6517impl MsiResourceEvent {
6518    /// Decodes a message buffer as a [`MsiResourceEvent`].
6519    fn decode(
6520        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6521    ) -> Result<MsiResourceEvent, fidl::Error> {
6522        let (bytes, _handles) = buf.split_mut();
6523        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6524        debug_assert_eq!(tx_header.tx_id, 0);
6525        match tx_header.ordinal {
6526            _ => Err(fidl::Error::UnknownOrdinal {
6527                ordinal: tx_header.ordinal,
6528                protocol_name: <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6529            }),
6530        }
6531    }
6532}
6533
6534/// A Stream of incoming requests for fuchsia.kernel/MsiResource.
6535pub struct MsiResourceRequestStream {
6536    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6537    is_terminated: bool,
6538}
6539
6540impl std::marker::Unpin for MsiResourceRequestStream {}
6541
6542impl futures::stream::FusedStream for MsiResourceRequestStream {
6543    fn is_terminated(&self) -> bool {
6544        self.is_terminated
6545    }
6546}
6547
6548impl fidl::endpoints::RequestStream for MsiResourceRequestStream {
6549    type Protocol = MsiResourceMarker;
6550    type ControlHandle = MsiResourceControlHandle;
6551
6552    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6553        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6554    }
6555
6556    fn control_handle(&self) -> Self::ControlHandle {
6557        MsiResourceControlHandle { inner: self.inner.clone() }
6558    }
6559
6560    fn into_inner(
6561        self,
6562    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6563    {
6564        (self.inner, self.is_terminated)
6565    }
6566
6567    fn from_inner(
6568        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6569        is_terminated: bool,
6570    ) -> Self {
6571        Self { inner, is_terminated }
6572    }
6573}
6574
6575impl futures::Stream for MsiResourceRequestStream {
6576    type Item = Result<MsiResourceRequest, fidl::Error>;
6577
6578    fn poll_next(
6579        mut self: std::pin::Pin<&mut Self>,
6580        cx: &mut std::task::Context<'_>,
6581    ) -> std::task::Poll<Option<Self::Item>> {
6582        let this = &mut *self;
6583        if this.inner.check_shutdown(cx) {
6584            this.is_terminated = true;
6585            return std::task::Poll::Ready(None);
6586        }
6587        if this.is_terminated {
6588            panic!("polled MsiResourceRequestStream after completion");
6589        }
6590        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6591            |bytes, handles| {
6592                match this.inner.channel().read_etc(cx, bytes, handles) {
6593                    std::task::Poll::Ready(Ok(())) => {}
6594                    std::task::Poll::Pending => return std::task::Poll::Pending,
6595                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6596                        this.is_terminated = true;
6597                        return std::task::Poll::Ready(None);
6598                    }
6599                    std::task::Poll::Ready(Err(e)) => {
6600                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6601                            e.into(),
6602                        ))));
6603                    }
6604                }
6605
6606                // A message has been received from the channel
6607                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6608
6609                std::task::Poll::Ready(Some(match header.ordinal {
6610                    0x360a97e47e8c4f1f => {
6611                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6612                        let mut req = fidl::new_empty!(
6613                            fidl::encoding::EmptyPayload,
6614                            fidl::encoding::DefaultFuchsiaResourceDialect
6615                        );
6616                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6617                        let control_handle = MsiResourceControlHandle { inner: this.inner.clone() };
6618                        Ok(MsiResourceRequest::Get {
6619                            responder: MsiResourceGetResponder {
6620                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6621                                tx_id: header.tx_id,
6622                            },
6623                        })
6624                    }
6625                    _ => Err(fidl::Error::UnknownOrdinal {
6626                        ordinal: header.ordinal,
6627                        protocol_name:
6628                            <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6629                    }),
6630                }))
6631            },
6632        )
6633    }
6634}
6635
6636/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6637/// `ZX_RSRC_SYSTEM_MSI_BASE`.
6638#[derive(Debug)]
6639pub enum MsiResourceRequest {
6640    /// Get an msi resource handle.
6641    Get { responder: MsiResourceGetResponder },
6642}
6643
6644impl MsiResourceRequest {
6645    #[allow(irrefutable_let_patterns)]
6646    pub fn into_get(self) -> Option<(MsiResourceGetResponder)> {
6647        if let MsiResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6648    }
6649
6650    /// Name of the method defined in FIDL
6651    pub fn method_name(&self) -> &'static str {
6652        match *self {
6653            MsiResourceRequest::Get { .. } => "get",
6654        }
6655    }
6656}
6657
6658#[derive(Debug, Clone)]
6659pub struct MsiResourceControlHandle {
6660    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6661}
6662
6663impl MsiResourceControlHandle {
6664    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6665        self.inner.shutdown_with_epitaph(status.into())
6666    }
6667}
6668
6669impl fidl::endpoints::ControlHandle for MsiResourceControlHandle {
6670    fn shutdown(&self) {
6671        self.inner.shutdown()
6672    }
6673
6674    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6675        self.inner.shutdown_with_epitaph(status)
6676    }
6677
6678    fn is_closed(&self) -> bool {
6679        self.inner.channel().is_closed()
6680    }
6681    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6682        self.inner.channel().on_closed()
6683    }
6684
6685    #[cfg(target_os = "fuchsia")]
6686    fn signal_peer(
6687        &self,
6688        clear_mask: zx::Signals,
6689        set_mask: zx::Signals,
6690    ) -> Result<(), zx_status::Status> {
6691        use fidl::Peered;
6692        self.inner.channel().signal_peer(clear_mask, set_mask)
6693    }
6694}
6695
6696impl MsiResourceControlHandle {}
6697
6698#[must_use = "FIDL methods require a response to be sent"]
6699#[derive(Debug)]
6700pub struct MsiResourceGetResponder {
6701    control_handle: std::mem::ManuallyDrop<MsiResourceControlHandle>,
6702    tx_id: u32,
6703}
6704
6705/// Set the the channel to be shutdown (see [`MsiResourceControlHandle::shutdown`])
6706/// if the responder is dropped without sending a response, so that the client
6707/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6708impl std::ops::Drop for MsiResourceGetResponder {
6709    fn drop(&mut self) {
6710        self.control_handle.shutdown();
6711        // Safety: drops once, never accessed again
6712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6713    }
6714}
6715
6716impl fidl::endpoints::Responder for MsiResourceGetResponder {
6717    type ControlHandle = MsiResourceControlHandle;
6718
6719    fn control_handle(&self) -> &MsiResourceControlHandle {
6720        &self.control_handle
6721    }
6722
6723    fn drop_without_shutdown(mut self) {
6724        // Safety: drops once, never accessed again due to mem::forget
6725        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6726        // Prevent Drop from running (which would shut down the channel)
6727        std::mem::forget(self);
6728    }
6729}
6730
6731impl MsiResourceGetResponder {
6732    /// Sends a response to the FIDL transaction.
6733    ///
6734    /// Sets the channel to shutdown if an error occurs.
6735    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6736        let _result = self.send_raw(resource);
6737        if _result.is_err() {
6738            self.control_handle.shutdown();
6739        }
6740        self.drop_without_shutdown();
6741        _result
6742    }
6743
6744    /// Similar to "send" but does not shutdown the channel if an error occurs.
6745    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6746        let _result = self.send_raw(resource);
6747        self.drop_without_shutdown();
6748        _result
6749    }
6750
6751    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6752        self.control_handle.inner.send::<MsiResourceGetResponse>(
6753            (resource,),
6754            self.tx_id,
6755            0x360a97e47e8c4f1f,
6756            fidl::encoding::DynamicFlags::empty(),
6757        )
6758    }
6759}
6760
6761#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6762pub struct PowerResourceMarker;
6763
6764impl fidl::endpoints::ProtocolMarker for PowerResourceMarker {
6765    type Proxy = PowerResourceProxy;
6766    type RequestStream = PowerResourceRequestStream;
6767    #[cfg(target_os = "fuchsia")]
6768    type SynchronousProxy = PowerResourceSynchronousProxy;
6769
6770    const DEBUG_NAME: &'static str = "fuchsia.kernel.PowerResource";
6771}
6772impl fidl::endpoints::DiscoverableProtocolMarker for PowerResourceMarker {}
6773
6774pub trait PowerResourceProxyInterface: Send + Sync {
6775    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6776    fn r#get(&self) -> Self::GetResponseFut;
6777}
6778#[derive(Debug)]
6779#[cfg(target_os = "fuchsia")]
6780pub struct PowerResourceSynchronousProxy {
6781    client: fidl::client::sync::Client,
6782}
6783
6784#[cfg(target_os = "fuchsia")]
6785impl fidl::endpoints::SynchronousProxy for PowerResourceSynchronousProxy {
6786    type Proxy = PowerResourceProxy;
6787    type Protocol = PowerResourceMarker;
6788
6789    fn from_channel(inner: fidl::Channel) -> Self {
6790        Self::new(inner)
6791    }
6792
6793    fn into_channel(self) -> fidl::Channel {
6794        self.client.into_channel()
6795    }
6796
6797    fn as_channel(&self) -> &fidl::Channel {
6798        self.client.as_channel()
6799    }
6800}
6801
6802#[cfg(target_os = "fuchsia")]
6803impl PowerResourceSynchronousProxy {
6804    pub fn new(channel: fidl::Channel) -> Self {
6805        Self { client: fidl::client::sync::Client::new(channel) }
6806    }
6807
6808    pub fn into_channel(self) -> fidl::Channel {
6809        self.client.into_channel()
6810    }
6811
6812    /// Waits until an event arrives and returns it. It is safe for other
6813    /// threads to make concurrent requests while waiting for an event.
6814    pub fn wait_for_event(
6815        &self,
6816        deadline: zx::MonotonicInstant,
6817    ) -> Result<PowerResourceEvent, fidl::Error> {
6818        PowerResourceEvent::decode(self.client.wait_for_event::<PowerResourceMarker>(deadline)?)
6819    }
6820
6821    /// Get a power resource handle.
6822    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6823        let _response = self.client.send_query::<
6824            fidl::encoding::EmptyPayload,
6825            PowerResourceGetResponse,
6826            PowerResourceMarker,
6827        >(
6828            (),
6829            0x2b8df8ca24d1e866,
6830            fidl::encoding::DynamicFlags::empty(),
6831            ___deadline,
6832        )?;
6833        Ok(_response.resource)
6834    }
6835}
6836
6837#[cfg(target_os = "fuchsia")]
6838impl From<PowerResourceSynchronousProxy> for zx::NullableHandle {
6839    fn from(value: PowerResourceSynchronousProxy) -> Self {
6840        value.into_channel().into()
6841    }
6842}
6843
6844#[cfg(target_os = "fuchsia")]
6845impl From<fidl::Channel> for PowerResourceSynchronousProxy {
6846    fn from(value: fidl::Channel) -> Self {
6847        Self::new(value)
6848    }
6849}
6850
6851#[cfg(target_os = "fuchsia")]
6852impl fidl::endpoints::FromClient for PowerResourceSynchronousProxy {
6853    type Protocol = PowerResourceMarker;
6854
6855    fn from_client(value: fidl::endpoints::ClientEnd<PowerResourceMarker>) -> Self {
6856        Self::new(value.into_channel())
6857    }
6858}
6859
6860#[derive(Debug, Clone)]
6861pub struct PowerResourceProxy {
6862    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6863}
6864
6865impl fidl::endpoints::Proxy for PowerResourceProxy {
6866    type Protocol = PowerResourceMarker;
6867
6868    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6869        Self::new(inner)
6870    }
6871
6872    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6873        self.client.into_channel().map_err(|client| Self { client })
6874    }
6875
6876    fn as_channel(&self) -> &::fidl::AsyncChannel {
6877        self.client.as_channel()
6878    }
6879}
6880
6881impl PowerResourceProxy {
6882    /// Create a new Proxy for fuchsia.kernel/PowerResource.
6883    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6884        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6885        Self { client: fidl::client::Client::new(channel, protocol_name) }
6886    }
6887
6888    /// Get a Stream of events from the remote end of the protocol.
6889    ///
6890    /// # Panics
6891    ///
6892    /// Panics if the event stream was already taken.
6893    pub fn take_event_stream(&self) -> PowerResourceEventStream {
6894        PowerResourceEventStream { event_receiver: self.client.take_event_receiver() }
6895    }
6896
6897    /// Get a power resource handle.
6898    pub fn r#get(
6899        &self,
6900    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6901    {
6902        PowerResourceProxyInterface::r#get(self)
6903    }
6904}
6905
6906impl PowerResourceProxyInterface for PowerResourceProxy {
6907    type GetResponseFut = fidl::client::QueryResponseFut<
6908        fidl::Resource,
6909        fidl::encoding::DefaultFuchsiaResourceDialect,
6910    >;
6911    fn r#get(&self) -> Self::GetResponseFut {
6912        fn _decode(
6913            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6914        ) -> Result<fidl::Resource, fidl::Error> {
6915            let _response = fidl::client::decode_transaction_body::<
6916                PowerResourceGetResponse,
6917                fidl::encoding::DefaultFuchsiaResourceDialect,
6918                0x2b8df8ca24d1e866,
6919            >(_buf?)?;
6920            Ok(_response.resource)
6921        }
6922        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6923            (),
6924            0x2b8df8ca24d1e866,
6925            fidl::encoding::DynamicFlags::empty(),
6926            _decode,
6927        )
6928    }
6929}
6930
6931pub struct PowerResourceEventStream {
6932    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6933}
6934
6935impl std::marker::Unpin for PowerResourceEventStream {}
6936
6937impl futures::stream::FusedStream for PowerResourceEventStream {
6938    fn is_terminated(&self) -> bool {
6939        self.event_receiver.is_terminated()
6940    }
6941}
6942
6943impl futures::Stream for PowerResourceEventStream {
6944    type Item = Result<PowerResourceEvent, fidl::Error>;
6945
6946    fn poll_next(
6947        mut self: std::pin::Pin<&mut Self>,
6948        cx: &mut std::task::Context<'_>,
6949    ) -> std::task::Poll<Option<Self::Item>> {
6950        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6951            &mut self.event_receiver,
6952            cx
6953        )?) {
6954            Some(buf) => std::task::Poll::Ready(Some(PowerResourceEvent::decode(buf))),
6955            None => std::task::Poll::Ready(None),
6956        }
6957    }
6958}
6959
6960#[derive(Debug)]
6961pub enum PowerResourceEvent {}
6962
6963impl PowerResourceEvent {
6964    /// Decodes a message buffer as a [`PowerResourceEvent`].
6965    fn decode(
6966        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6967    ) -> Result<PowerResourceEvent, fidl::Error> {
6968        let (bytes, _handles) = buf.split_mut();
6969        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6970        debug_assert_eq!(tx_header.tx_id, 0);
6971        match tx_header.ordinal {
6972            _ => Err(fidl::Error::UnknownOrdinal {
6973                ordinal: tx_header.ordinal,
6974                protocol_name: <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6975            }),
6976        }
6977    }
6978}
6979
6980/// A Stream of incoming requests for fuchsia.kernel/PowerResource.
6981pub struct PowerResourceRequestStream {
6982    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6983    is_terminated: bool,
6984}
6985
6986impl std::marker::Unpin for PowerResourceRequestStream {}
6987
6988impl futures::stream::FusedStream for PowerResourceRequestStream {
6989    fn is_terminated(&self) -> bool {
6990        self.is_terminated
6991    }
6992}
6993
6994impl fidl::endpoints::RequestStream for PowerResourceRequestStream {
6995    type Protocol = PowerResourceMarker;
6996    type ControlHandle = PowerResourceControlHandle;
6997
6998    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6999        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7000    }
7001
7002    fn control_handle(&self) -> Self::ControlHandle {
7003        PowerResourceControlHandle { inner: self.inner.clone() }
7004    }
7005
7006    fn into_inner(
7007        self,
7008    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7009    {
7010        (self.inner, self.is_terminated)
7011    }
7012
7013    fn from_inner(
7014        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7015        is_terminated: bool,
7016    ) -> Self {
7017        Self { inner, is_terminated }
7018    }
7019}
7020
7021impl futures::Stream for PowerResourceRequestStream {
7022    type Item = Result<PowerResourceRequest, fidl::Error>;
7023
7024    fn poll_next(
7025        mut self: std::pin::Pin<&mut Self>,
7026        cx: &mut std::task::Context<'_>,
7027    ) -> std::task::Poll<Option<Self::Item>> {
7028        let this = &mut *self;
7029        if this.inner.check_shutdown(cx) {
7030            this.is_terminated = true;
7031            return std::task::Poll::Ready(None);
7032        }
7033        if this.is_terminated {
7034            panic!("polled PowerResourceRequestStream after completion");
7035        }
7036        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7037            |bytes, handles| {
7038                match this.inner.channel().read_etc(cx, bytes, handles) {
7039                    std::task::Poll::Ready(Ok(())) => {}
7040                    std::task::Poll::Pending => return std::task::Poll::Pending,
7041                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7042                        this.is_terminated = true;
7043                        return std::task::Poll::Ready(None);
7044                    }
7045                    std::task::Poll::Ready(Err(e)) => {
7046                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7047                            e.into(),
7048                        ))));
7049                    }
7050                }
7051
7052                // A message has been received from the channel
7053                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7054
7055                std::task::Poll::Ready(Some(match header.ordinal {
7056                    0x2b8df8ca24d1e866 => {
7057                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7058                        let mut req = fidl::new_empty!(
7059                            fidl::encoding::EmptyPayload,
7060                            fidl::encoding::DefaultFuchsiaResourceDialect
7061                        );
7062                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7063                        let control_handle =
7064                            PowerResourceControlHandle { inner: this.inner.clone() };
7065                        Ok(PowerResourceRequest::Get {
7066                            responder: PowerResourceGetResponder {
7067                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7068                                tx_id: header.tx_id,
7069                            },
7070                        })
7071                    }
7072                    _ => Err(fidl::Error::UnknownOrdinal {
7073                        ordinal: header.ordinal,
7074                        protocol_name:
7075                            <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7076                    }),
7077                }))
7078            },
7079        )
7080    }
7081}
7082
7083/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7084/// `ZX_RSRC_SYSTEM_POWER_BASE`.
7085#[derive(Debug)]
7086pub enum PowerResourceRequest {
7087    /// Get a power resource handle.
7088    Get { responder: PowerResourceGetResponder },
7089}
7090
7091impl PowerResourceRequest {
7092    #[allow(irrefutable_let_patterns)]
7093    pub fn into_get(self) -> Option<(PowerResourceGetResponder)> {
7094        if let PowerResourceRequest::Get { responder } = self { Some((responder)) } else { None }
7095    }
7096
7097    /// Name of the method defined in FIDL
7098    pub fn method_name(&self) -> &'static str {
7099        match *self {
7100            PowerResourceRequest::Get { .. } => "get",
7101        }
7102    }
7103}
7104
7105#[derive(Debug, Clone)]
7106pub struct PowerResourceControlHandle {
7107    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7108}
7109
7110impl PowerResourceControlHandle {
7111    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7112        self.inner.shutdown_with_epitaph(status.into())
7113    }
7114}
7115
7116impl fidl::endpoints::ControlHandle for PowerResourceControlHandle {
7117    fn shutdown(&self) {
7118        self.inner.shutdown()
7119    }
7120
7121    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7122        self.inner.shutdown_with_epitaph(status)
7123    }
7124
7125    fn is_closed(&self) -> bool {
7126        self.inner.channel().is_closed()
7127    }
7128    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7129        self.inner.channel().on_closed()
7130    }
7131
7132    #[cfg(target_os = "fuchsia")]
7133    fn signal_peer(
7134        &self,
7135        clear_mask: zx::Signals,
7136        set_mask: zx::Signals,
7137    ) -> Result<(), zx_status::Status> {
7138        use fidl::Peered;
7139        self.inner.channel().signal_peer(clear_mask, set_mask)
7140    }
7141}
7142
7143impl PowerResourceControlHandle {}
7144
7145#[must_use = "FIDL methods require a response to be sent"]
7146#[derive(Debug)]
7147pub struct PowerResourceGetResponder {
7148    control_handle: std::mem::ManuallyDrop<PowerResourceControlHandle>,
7149    tx_id: u32,
7150}
7151
7152/// Set the the channel to be shutdown (see [`PowerResourceControlHandle::shutdown`])
7153/// if the responder is dropped without sending a response, so that the client
7154/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7155impl std::ops::Drop for PowerResourceGetResponder {
7156    fn drop(&mut self) {
7157        self.control_handle.shutdown();
7158        // Safety: drops once, never accessed again
7159        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7160    }
7161}
7162
7163impl fidl::endpoints::Responder for PowerResourceGetResponder {
7164    type ControlHandle = PowerResourceControlHandle;
7165
7166    fn control_handle(&self) -> &PowerResourceControlHandle {
7167        &self.control_handle
7168    }
7169
7170    fn drop_without_shutdown(mut self) {
7171        // Safety: drops once, never accessed again due to mem::forget
7172        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7173        // Prevent Drop from running (which would shut down the channel)
7174        std::mem::forget(self);
7175    }
7176}
7177
7178impl PowerResourceGetResponder {
7179    /// Sends a response to the FIDL transaction.
7180    ///
7181    /// Sets the channel to shutdown if an error occurs.
7182    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7183        let _result = self.send_raw(resource);
7184        if _result.is_err() {
7185            self.control_handle.shutdown();
7186        }
7187        self.drop_without_shutdown();
7188        _result
7189    }
7190
7191    /// Similar to "send" but does not shutdown the channel if an error occurs.
7192    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7193        let _result = self.send_raw(resource);
7194        self.drop_without_shutdown();
7195        _result
7196    }
7197
7198    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7199        self.control_handle.inner.send::<PowerResourceGetResponse>(
7200            (resource,),
7201            self.tx_id,
7202            0x2b8df8ca24d1e866,
7203            fidl::encoding::DynamicFlags::empty(),
7204        )
7205    }
7206}
7207
7208#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7209pub struct ProfileResourceMarker;
7210
7211impl fidl::endpoints::ProtocolMarker for ProfileResourceMarker {
7212    type Proxy = ProfileResourceProxy;
7213    type RequestStream = ProfileResourceRequestStream;
7214    #[cfg(target_os = "fuchsia")]
7215    type SynchronousProxy = ProfileResourceSynchronousProxy;
7216
7217    const DEBUG_NAME: &'static str = "fuchsia.kernel.ProfileResource";
7218}
7219impl fidl::endpoints::DiscoverableProtocolMarker for ProfileResourceMarker {}
7220
7221pub trait ProfileResourceProxyInterface: Send + Sync {
7222    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
7223    fn r#get(&self) -> Self::GetResponseFut;
7224}
7225#[derive(Debug)]
7226#[cfg(target_os = "fuchsia")]
7227pub struct ProfileResourceSynchronousProxy {
7228    client: fidl::client::sync::Client,
7229}
7230
7231#[cfg(target_os = "fuchsia")]
7232impl fidl::endpoints::SynchronousProxy for ProfileResourceSynchronousProxy {
7233    type Proxy = ProfileResourceProxy;
7234    type Protocol = ProfileResourceMarker;
7235
7236    fn from_channel(inner: fidl::Channel) -> Self {
7237        Self::new(inner)
7238    }
7239
7240    fn into_channel(self) -> fidl::Channel {
7241        self.client.into_channel()
7242    }
7243
7244    fn as_channel(&self) -> &fidl::Channel {
7245        self.client.as_channel()
7246    }
7247}
7248
7249#[cfg(target_os = "fuchsia")]
7250impl ProfileResourceSynchronousProxy {
7251    pub fn new(channel: fidl::Channel) -> Self {
7252        Self { client: fidl::client::sync::Client::new(channel) }
7253    }
7254
7255    pub fn into_channel(self) -> fidl::Channel {
7256        self.client.into_channel()
7257    }
7258
7259    /// Waits until an event arrives and returns it. It is safe for other
7260    /// threads to make concurrent requests while waiting for an event.
7261    pub fn wait_for_event(
7262        &self,
7263        deadline: zx::MonotonicInstant,
7264    ) -> Result<ProfileResourceEvent, fidl::Error> {
7265        ProfileResourceEvent::decode(self.client.wait_for_event::<ProfileResourceMarker>(deadline)?)
7266    }
7267
7268    /// Get a profile resource handle.
7269    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
7270        let _response = self.client.send_query::<
7271            fidl::encoding::EmptyPayload,
7272            ProfileResourceGetResponse,
7273            ProfileResourceMarker,
7274        >(
7275            (),
7276            0x3003a0c14de1fa86,
7277            fidl::encoding::DynamicFlags::empty(),
7278            ___deadline,
7279        )?;
7280        Ok(_response.resource)
7281    }
7282}
7283
7284#[cfg(target_os = "fuchsia")]
7285impl From<ProfileResourceSynchronousProxy> for zx::NullableHandle {
7286    fn from(value: ProfileResourceSynchronousProxy) -> Self {
7287        value.into_channel().into()
7288    }
7289}
7290
7291#[cfg(target_os = "fuchsia")]
7292impl From<fidl::Channel> for ProfileResourceSynchronousProxy {
7293    fn from(value: fidl::Channel) -> Self {
7294        Self::new(value)
7295    }
7296}
7297
7298#[cfg(target_os = "fuchsia")]
7299impl fidl::endpoints::FromClient for ProfileResourceSynchronousProxy {
7300    type Protocol = ProfileResourceMarker;
7301
7302    fn from_client(value: fidl::endpoints::ClientEnd<ProfileResourceMarker>) -> Self {
7303        Self::new(value.into_channel())
7304    }
7305}
7306
7307#[derive(Debug, Clone)]
7308pub struct ProfileResourceProxy {
7309    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7310}
7311
7312impl fidl::endpoints::Proxy for ProfileResourceProxy {
7313    type Protocol = ProfileResourceMarker;
7314
7315    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7316        Self::new(inner)
7317    }
7318
7319    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7320        self.client.into_channel().map_err(|client| Self { client })
7321    }
7322
7323    fn as_channel(&self) -> &::fidl::AsyncChannel {
7324        self.client.as_channel()
7325    }
7326}
7327
7328impl ProfileResourceProxy {
7329    /// Create a new Proxy for fuchsia.kernel/ProfileResource.
7330    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7331        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7332        Self { client: fidl::client::Client::new(channel, protocol_name) }
7333    }
7334
7335    /// Get a Stream of events from the remote end of the protocol.
7336    ///
7337    /// # Panics
7338    ///
7339    /// Panics if the event stream was already taken.
7340    pub fn take_event_stream(&self) -> ProfileResourceEventStream {
7341        ProfileResourceEventStream { event_receiver: self.client.take_event_receiver() }
7342    }
7343
7344    /// Get a profile resource handle.
7345    pub fn r#get(
7346        &self,
7347    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
7348    {
7349        ProfileResourceProxyInterface::r#get(self)
7350    }
7351}
7352
7353impl ProfileResourceProxyInterface for ProfileResourceProxy {
7354    type GetResponseFut = fidl::client::QueryResponseFut<
7355        fidl::Resource,
7356        fidl::encoding::DefaultFuchsiaResourceDialect,
7357    >;
7358    fn r#get(&self) -> Self::GetResponseFut {
7359        fn _decode(
7360            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7361        ) -> Result<fidl::Resource, fidl::Error> {
7362            let _response = fidl::client::decode_transaction_body::<
7363                ProfileResourceGetResponse,
7364                fidl::encoding::DefaultFuchsiaResourceDialect,
7365                0x3003a0c14de1fa86,
7366            >(_buf?)?;
7367            Ok(_response.resource)
7368        }
7369        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
7370            (),
7371            0x3003a0c14de1fa86,
7372            fidl::encoding::DynamicFlags::empty(),
7373            _decode,
7374        )
7375    }
7376}
7377
7378pub struct ProfileResourceEventStream {
7379    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7380}
7381
7382impl std::marker::Unpin for ProfileResourceEventStream {}
7383
7384impl futures::stream::FusedStream for ProfileResourceEventStream {
7385    fn is_terminated(&self) -> bool {
7386        self.event_receiver.is_terminated()
7387    }
7388}
7389
7390impl futures::Stream for ProfileResourceEventStream {
7391    type Item = Result<ProfileResourceEvent, fidl::Error>;
7392
7393    fn poll_next(
7394        mut self: std::pin::Pin<&mut Self>,
7395        cx: &mut std::task::Context<'_>,
7396    ) -> std::task::Poll<Option<Self::Item>> {
7397        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7398            &mut self.event_receiver,
7399            cx
7400        )?) {
7401            Some(buf) => std::task::Poll::Ready(Some(ProfileResourceEvent::decode(buf))),
7402            None => std::task::Poll::Ready(None),
7403        }
7404    }
7405}
7406
7407#[derive(Debug)]
7408pub enum ProfileResourceEvent {}
7409
7410impl ProfileResourceEvent {
7411    /// Decodes a message buffer as a [`ProfileResourceEvent`].
7412    fn decode(
7413        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7414    ) -> Result<ProfileResourceEvent, fidl::Error> {
7415        let (bytes, _handles) = buf.split_mut();
7416        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7417        debug_assert_eq!(tx_header.tx_id, 0);
7418        match tx_header.ordinal {
7419            _ => Err(fidl::Error::UnknownOrdinal {
7420                ordinal: tx_header.ordinal,
7421                protocol_name:
7422                    <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7423            }),
7424        }
7425    }
7426}
7427
7428/// A Stream of incoming requests for fuchsia.kernel/ProfileResource.
7429pub struct ProfileResourceRequestStream {
7430    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7431    is_terminated: bool,
7432}
7433
7434impl std::marker::Unpin for ProfileResourceRequestStream {}
7435
7436impl futures::stream::FusedStream for ProfileResourceRequestStream {
7437    fn is_terminated(&self) -> bool {
7438        self.is_terminated
7439    }
7440}
7441
7442impl fidl::endpoints::RequestStream for ProfileResourceRequestStream {
7443    type Protocol = ProfileResourceMarker;
7444    type ControlHandle = ProfileResourceControlHandle;
7445
7446    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7447        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7448    }
7449
7450    fn control_handle(&self) -> Self::ControlHandle {
7451        ProfileResourceControlHandle { inner: self.inner.clone() }
7452    }
7453
7454    fn into_inner(
7455        self,
7456    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7457    {
7458        (self.inner, self.is_terminated)
7459    }
7460
7461    fn from_inner(
7462        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7463        is_terminated: bool,
7464    ) -> Self {
7465        Self { inner, is_terminated }
7466    }
7467}
7468
7469impl futures::Stream for ProfileResourceRequestStream {
7470    type Item = Result<ProfileResourceRequest, fidl::Error>;
7471
7472    fn poll_next(
7473        mut self: std::pin::Pin<&mut Self>,
7474        cx: &mut std::task::Context<'_>,
7475    ) -> std::task::Poll<Option<Self::Item>> {
7476        let this = &mut *self;
7477        if this.inner.check_shutdown(cx) {
7478            this.is_terminated = true;
7479            return std::task::Poll::Ready(None);
7480        }
7481        if this.is_terminated {
7482            panic!("polled ProfileResourceRequestStream after completion");
7483        }
7484        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7485            |bytes, handles| {
7486                match this.inner.channel().read_etc(cx, bytes, handles) {
7487                    std::task::Poll::Ready(Ok(())) => {}
7488                    std::task::Poll::Pending => return std::task::Poll::Pending,
7489                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7490                        this.is_terminated = true;
7491                        return std::task::Poll::Ready(None);
7492                    }
7493                    std::task::Poll::Ready(Err(e)) => {
7494                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7495                            e.into(),
7496                        ))));
7497                    }
7498                }
7499
7500                // A message has been received from the channel
7501                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7502
7503                std::task::Poll::Ready(Some(match header.ordinal {
7504                    0x3003a0c14de1fa86 => {
7505                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7506                        let mut req = fidl::new_empty!(
7507                            fidl::encoding::EmptyPayload,
7508                            fidl::encoding::DefaultFuchsiaResourceDialect
7509                        );
7510                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7511                        let control_handle =
7512                            ProfileResourceControlHandle { inner: this.inner.clone() };
7513                        Ok(ProfileResourceRequest::Get {
7514                            responder: ProfileResourceGetResponder {
7515                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7516                                tx_id: header.tx_id,
7517                            },
7518                        })
7519                    }
7520                    _ => Err(fidl::Error::UnknownOrdinal {
7521                        ordinal: header.ordinal,
7522                        protocol_name:
7523                            <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7524                    }),
7525                }))
7526            },
7527        )
7528    }
7529}
7530
7531/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7532/// `ZX_RSRC_SYSTEM_PROFILE_BASE`.
7533#[derive(Debug)]
7534pub enum ProfileResourceRequest {
7535    /// Get a profile resource handle.
7536    Get { responder: ProfileResourceGetResponder },
7537}
7538
7539impl ProfileResourceRequest {
7540    #[allow(irrefutable_let_patterns)]
7541    pub fn into_get(self) -> Option<(ProfileResourceGetResponder)> {
7542        if let ProfileResourceRequest::Get { responder } = self { Some((responder)) } else { None }
7543    }
7544
7545    /// Name of the method defined in FIDL
7546    pub fn method_name(&self) -> &'static str {
7547        match *self {
7548            ProfileResourceRequest::Get { .. } => "get",
7549        }
7550    }
7551}
7552
7553#[derive(Debug, Clone)]
7554pub struct ProfileResourceControlHandle {
7555    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7556}
7557
7558impl ProfileResourceControlHandle {
7559    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7560        self.inner.shutdown_with_epitaph(status.into())
7561    }
7562}
7563
7564impl fidl::endpoints::ControlHandle for ProfileResourceControlHandle {
7565    fn shutdown(&self) {
7566        self.inner.shutdown()
7567    }
7568
7569    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7570        self.inner.shutdown_with_epitaph(status)
7571    }
7572
7573    fn is_closed(&self) -> bool {
7574        self.inner.channel().is_closed()
7575    }
7576    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7577        self.inner.channel().on_closed()
7578    }
7579
7580    #[cfg(target_os = "fuchsia")]
7581    fn signal_peer(
7582        &self,
7583        clear_mask: zx::Signals,
7584        set_mask: zx::Signals,
7585    ) -> Result<(), zx_status::Status> {
7586        use fidl::Peered;
7587        self.inner.channel().signal_peer(clear_mask, set_mask)
7588    }
7589}
7590
7591impl ProfileResourceControlHandle {}
7592
7593#[must_use = "FIDL methods require a response to be sent"]
7594#[derive(Debug)]
7595pub struct ProfileResourceGetResponder {
7596    control_handle: std::mem::ManuallyDrop<ProfileResourceControlHandle>,
7597    tx_id: u32,
7598}
7599
7600/// Set the the channel to be shutdown (see [`ProfileResourceControlHandle::shutdown`])
7601/// if the responder is dropped without sending a response, so that the client
7602/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7603impl std::ops::Drop for ProfileResourceGetResponder {
7604    fn drop(&mut self) {
7605        self.control_handle.shutdown();
7606        // Safety: drops once, never accessed again
7607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7608    }
7609}
7610
7611impl fidl::endpoints::Responder for ProfileResourceGetResponder {
7612    type ControlHandle = ProfileResourceControlHandle;
7613
7614    fn control_handle(&self) -> &ProfileResourceControlHandle {
7615        &self.control_handle
7616    }
7617
7618    fn drop_without_shutdown(mut self) {
7619        // Safety: drops once, never accessed again due to mem::forget
7620        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7621        // Prevent Drop from running (which would shut down the channel)
7622        std::mem::forget(self);
7623    }
7624}
7625
7626impl ProfileResourceGetResponder {
7627    /// Sends a response to the FIDL transaction.
7628    ///
7629    /// Sets the channel to shutdown if an error occurs.
7630    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7631        let _result = self.send_raw(resource);
7632        if _result.is_err() {
7633            self.control_handle.shutdown();
7634        }
7635        self.drop_without_shutdown();
7636        _result
7637    }
7638
7639    /// Similar to "send" but does not shutdown the channel if an error occurs.
7640    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7641        let _result = self.send_raw(resource);
7642        self.drop_without_shutdown();
7643        _result
7644    }
7645
7646    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7647        self.control_handle.inner.send::<ProfileResourceGetResponse>(
7648            (resource,),
7649            self.tx_id,
7650            0x3003a0c14de1fa86,
7651            fidl::encoding::DynamicFlags::empty(),
7652        )
7653    }
7654}
7655
7656#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7657pub struct RootJobMarker;
7658
7659impl fidl::endpoints::ProtocolMarker for RootJobMarker {
7660    type Proxy = RootJobProxy;
7661    type RequestStream = RootJobRequestStream;
7662    #[cfg(target_os = "fuchsia")]
7663    type SynchronousProxy = RootJobSynchronousProxy;
7664
7665    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJob";
7666}
7667impl fidl::endpoints::DiscoverableProtocolMarker for RootJobMarker {}
7668
7669pub trait RootJobProxyInterface: Send + Sync {
7670    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7671    fn r#get(&self) -> Self::GetResponseFut;
7672}
7673#[derive(Debug)]
7674#[cfg(target_os = "fuchsia")]
7675pub struct RootJobSynchronousProxy {
7676    client: fidl::client::sync::Client,
7677}
7678
7679#[cfg(target_os = "fuchsia")]
7680impl fidl::endpoints::SynchronousProxy for RootJobSynchronousProxy {
7681    type Proxy = RootJobProxy;
7682    type Protocol = RootJobMarker;
7683
7684    fn from_channel(inner: fidl::Channel) -> Self {
7685        Self::new(inner)
7686    }
7687
7688    fn into_channel(self) -> fidl::Channel {
7689        self.client.into_channel()
7690    }
7691
7692    fn as_channel(&self) -> &fidl::Channel {
7693        self.client.as_channel()
7694    }
7695}
7696
7697#[cfg(target_os = "fuchsia")]
7698impl RootJobSynchronousProxy {
7699    pub fn new(channel: fidl::Channel) -> Self {
7700        Self { client: fidl::client::sync::Client::new(channel) }
7701    }
7702
7703    pub fn into_channel(self) -> fidl::Channel {
7704        self.client.into_channel()
7705    }
7706
7707    /// Waits until an event arrives and returns it. It is safe for other
7708    /// threads to make concurrent requests while waiting for an event.
7709    pub fn wait_for_event(
7710        &self,
7711        deadline: zx::MonotonicInstant,
7712    ) -> Result<RootJobEvent, fidl::Error> {
7713        RootJobEvent::decode(self.client.wait_for_event::<RootJobMarker>(deadline)?)
7714    }
7715
7716    /// Get the root `job`.
7717    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7718        let _response = self
7719            .client
7720            .send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse, RootJobMarker>(
7721                (),
7722                0x73acb63f93d53eac,
7723                fidl::encoding::DynamicFlags::empty(),
7724                ___deadline,
7725            )?;
7726        Ok(_response.job)
7727    }
7728}
7729
7730#[cfg(target_os = "fuchsia")]
7731impl From<RootJobSynchronousProxy> for zx::NullableHandle {
7732    fn from(value: RootJobSynchronousProxy) -> Self {
7733        value.into_channel().into()
7734    }
7735}
7736
7737#[cfg(target_os = "fuchsia")]
7738impl From<fidl::Channel> for RootJobSynchronousProxy {
7739    fn from(value: fidl::Channel) -> Self {
7740        Self::new(value)
7741    }
7742}
7743
7744#[cfg(target_os = "fuchsia")]
7745impl fidl::endpoints::FromClient for RootJobSynchronousProxy {
7746    type Protocol = RootJobMarker;
7747
7748    fn from_client(value: fidl::endpoints::ClientEnd<RootJobMarker>) -> Self {
7749        Self::new(value.into_channel())
7750    }
7751}
7752
7753#[derive(Debug, Clone)]
7754pub struct RootJobProxy {
7755    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7756}
7757
7758impl fidl::endpoints::Proxy for RootJobProxy {
7759    type Protocol = RootJobMarker;
7760
7761    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7762        Self::new(inner)
7763    }
7764
7765    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7766        self.client.into_channel().map_err(|client| Self { client })
7767    }
7768
7769    fn as_channel(&self) -> &::fidl::AsyncChannel {
7770        self.client.as_channel()
7771    }
7772}
7773
7774impl RootJobProxy {
7775    /// Create a new Proxy for fuchsia.kernel/RootJob.
7776    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7777        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7778        Self { client: fidl::client::Client::new(channel, protocol_name) }
7779    }
7780
7781    /// Get a Stream of events from the remote end of the protocol.
7782    ///
7783    /// # Panics
7784    ///
7785    /// Panics if the event stream was already taken.
7786    pub fn take_event_stream(&self) -> RootJobEventStream {
7787        RootJobEventStream { event_receiver: self.client.take_event_receiver() }
7788    }
7789
7790    /// Get the root `job`.
7791    pub fn r#get(
7792        &self,
7793    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7794    {
7795        RootJobProxyInterface::r#get(self)
7796    }
7797}
7798
7799impl RootJobProxyInterface for RootJobProxy {
7800    type GetResponseFut =
7801        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7802    fn r#get(&self) -> Self::GetResponseFut {
7803        fn _decode(
7804            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7805        ) -> Result<fidl::Job, fidl::Error> {
7806            let _response = fidl::client::decode_transaction_body::<
7807                RootJobGetResponse,
7808                fidl::encoding::DefaultFuchsiaResourceDialect,
7809                0x73acb63f93d53eac,
7810            >(_buf?)?;
7811            Ok(_response.job)
7812        }
7813        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7814            (),
7815            0x73acb63f93d53eac,
7816            fidl::encoding::DynamicFlags::empty(),
7817            _decode,
7818        )
7819    }
7820}
7821
7822pub struct RootJobEventStream {
7823    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7824}
7825
7826impl std::marker::Unpin for RootJobEventStream {}
7827
7828impl futures::stream::FusedStream for RootJobEventStream {
7829    fn is_terminated(&self) -> bool {
7830        self.event_receiver.is_terminated()
7831    }
7832}
7833
7834impl futures::Stream for RootJobEventStream {
7835    type Item = Result<RootJobEvent, fidl::Error>;
7836
7837    fn poll_next(
7838        mut self: std::pin::Pin<&mut Self>,
7839        cx: &mut std::task::Context<'_>,
7840    ) -> std::task::Poll<Option<Self::Item>> {
7841        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7842            &mut self.event_receiver,
7843            cx
7844        )?) {
7845            Some(buf) => std::task::Poll::Ready(Some(RootJobEvent::decode(buf))),
7846            None => std::task::Poll::Ready(None),
7847        }
7848    }
7849}
7850
7851#[derive(Debug)]
7852pub enum RootJobEvent {}
7853
7854impl RootJobEvent {
7855    /// Decodes a message buffer as a [`RootJobEvent`].
7856    fn decode(
7857        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7858    ) -> Result<RootJobEvent, fidl::Error> {
7859        let (bytes, _handles) = buf.split_mut();
7860        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7861        debug_assert_eq!(tx_header.tx_id, 0);
7862        match tx_header.ordinal {
7863            _ => Err(fidl::Error::UnknownOrdinal {
7864                ordinal: tx_header.ordinal,
7865                protocol_name: <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7866            }),
7867        }
7868    }
7869}
7870
7871/// A Stream of incoming requests for fuchsia.kernel/RootJob.
7872pub struct RootJobRequestStream {
7873    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7874    is_terminated: bool,
7875}
7876
7877impl std::marker::Unpin for RootJobRequestStream {}
7878
7879impl futures::stream::FusedStream for RootJobRequestStream {
7880    fn is_terminated(&self) -> bool {
7881        self.is_terminated
7882    }
7883}
7884
7885impl fidl::endpoints::RequestStream for RootJobRequestStream {
7886    type Protocol = RootJobMarker;
7887    type ControlHandle = RootJobControlHandle;
7888
7889    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7890        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7891    }
7892
7893    fn control_handle(&self) -> Self::ControlHandle {
7894        RootJobControlHandle { inner: self.inner.clone() }
7895    }
7896
7897    fn into_inner(
7898        self,
7899    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7900    {
7901        (self.inner, self.is_terminated)
7902    }
7903
7904    fn from_inner(
7905        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7906        is_terminated: bool,
7907    ) -> Self {
7908        Self { inner, is_terminated }
7909    }
7910}
7911
7912impl futures::Stream for RootJobRequestStream {
7913    type Item = Result<RootJobRequest, fidl::Error>;
7914
7915    fn poll_next(
7916        mut self: std::pin::Pin<&mut Self>,
7917        cx: &mut std::task::Context<'_>,
7918    ) -> std::task::Poll<Option<Self::Item>> {
7919        let this = &mut *self;
7920        if this.inner.check_shutdown(cx) {
7921            this.is_terminated = true;
7922            return std::task::Poll::Ready(None);
7923        }
7924        if this.is_terminated {
7925            panic!("polled RootJobRequestStream after completion");
7926        }
7927        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7928            |bytes, handles| {
7929                match this.inner.channel().read_etc(cx, bytes, handles) {
7930                    std::task::Poll::Ready(Ok(())) => {}
7931                    std::task::Poll::Pending => return std::task::Poll::Pending,
7932                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7933                        this.is_terminated = true;
7934                        return std::task::Poll::Ready(None);
7935                    }
7936                    std::task::Poll::Ready(Err(e)) => {
7937                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7938                            e.into(),
7939                        ))));
7940                    }
7941                }
7942
7943                // A message has been received from the channel
7944                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7945
7946                std::task::Poll::Ready(Some(match header.ordinal {
7947                    0x73acb63f93d53eac => {
7948                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7949                        let mut req = fidl::new_empty!(
7950                            fidl::encoding::EmptyPayload,
7951                            fidl::encoding::DefaultFuchsiaResourceDialect
7952                        );
7953                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7954                        let control_handle = RootJobControlHandle { inner: this.inner.clone() };
7955                        Ok(RootJobRequest::Get {
7956                            responder: RootJobGetResponder {
7957                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7958                                tx_id: header.tx_id,
7959                            },
7960                        })
7961                    }
7962                    _ => Err(fidl::Error::UnknownOrdinal {
7963                        ordinal: header.ordinal,
7964                        protocol_name:
7965                            <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7966                    }),
7967                }))
7968            },
7969        )
7970    }
7971}
7972
7973/// Protocol for providing the root job.
7974///
7975/// TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.
7976#[derive(Debug)]
7977pub enum RootJobRequest {
7978    /// Get the root `job`.
7979    Get { responder: RootJobGetResponder },
7980}
7981
7982impl RootJobRequest {
7983    #[allow(irrefutable_let_patterns)]
7984    pub fn into_get(self) -> Option<(RootJobGetResponder)> {
7985        if let RootJobRequest::Get { responder } = self { Some((responder)) } else { None }
7986    }
7987
7988    /// Name of the method defined in FIDL
7989    pub fn method_name(&self) -> &'static str {
7990        match *self {
7991            RootJobRequest::Get { .. } => "get",
7992        }
7993    }
7994}
7995
7996#[derive(Debug, Clone)]
7997pub struct RootJobControlHandle {
7998    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7999}
8000
8001impl RootJobControlHandle {
8002    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8003        self.inner.shutdown_with_epitaph(status.into())
8004    }
8005}
8006
8007impl fidl::endpoints::ControlHandle for RootJobControlHandle {
8008    fn shutdown(&self) {
8009        self.inner.shutdown()
8010    }
8011
8012    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8013        self.inner.shutdown_with_epitaph(status)
8014    }
8015
8016    fn is_closed(&self) -> bool {
8017        self.inner.channel().is_closed()
8018    }
8019    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8020        self.inner.channel().on_closed()
8021    }
8022
8023    #[cfg(target_os = "fuchsia")]
8024    fn signal_peer(
8025        &self,
8026        clear_mask: zx::Signals,
8027        set_mask: zx::Signals,
8028    ) -> Result<(), zx_status::Status> {
8029        use fidl::Peered;
8030        self.inner.channel().signal_peer(clear_mask, set_mask)
8031    }
8032}
8033
8034impl RootJobControlHandle {}
8035
8036#[must_use = "FIDL methods require a response to be sent"]
8037#[derive(Debug)]
8038pub struct RootJobGetResponder {
8039    control_handle: std::mem::ManuallyDrop<RootJobControlHandle>,
8040    tx_id: u32,
8041}
8042
8043/// Set the the channel to be shutdown (see [`RootJobControlHandle::shutdown`])
8044/// if the responder is dropped without sending a response, so that the client
8045/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8046impl std::ops::Drop for RootJobGetResponder {
8047    fn drop(&mut self) {
8048        self.control_handle.shutdown();
8049        // Safety: drops once, never accessed again
8050        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8051    }
8052}
8053
8054impl fidl::endpoints::Responder for RootJobGetResponder {
8055    type ControlHandle = RootJobControlHandle;
8056
8057    fn control_handle(&self) -> &RootJobControlHandle {
8058        &self.control_handle
8059    }
8060
8061    fn drop_without_shutdown(mut self) {
8062        // Safety: drops once, never accessed again due to mem::forget
8063        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8064        // Prevent Drop from running (which would shut down the channel)
8065        std::mem::forget(self);
8066    }
8067}
8068
8069impl RootJobGetResponder {
8070    /// Sends a response to the FIDL transaction.
8071    ///
8072    /// Sets the channel to shutdown if an error occurs.
8073    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8074        let _result = self.send_raw(job);
8075        if _result.is_err() {
8076            self.control_handle.shutdown();
8077        }
8078        self.drop_without_shutdown();
8079        _result
8080    }
8081
8082    /// Similar to "send" but does not shutdown the channel if an error occurs.
8083    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8084        let _result = self.send_raw(job);
8085        self.drop_without_shutdown();
8086        _result
8087    }
8088
8089    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8090        self.control_handle.inner.send::<RootJobGetResponse>(
8091            (job,),
8092            self.tx_id,
8093            0x73acb63f93d53eac,
8094            fidl::encoding::DynamicFlags::empty(),
8095        )
8096    }
8097}
8098
8099#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8100pub struct RootJobForInspectMarker;
8101
8102impl fidl::endpoints::ProtocolMarker for RootJobForInspectMarker {
8103    type Proxy = RootJobForInspectProxy;
8104    type RequestStream = RootJobForInspectRequestStream;
8105    #[cfg(target_os = "fuchsia")]
8106    type SynchronousProxy = RootJobForInspectSynchronousProxy;
8107
8108    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJobForInspect";
8109}
8110impl fidl::endpoints::DiscoverableProtocolMarker for RootJobForInspectMarker {}
8111
8112pub trait RootJobForInspectProxyInterface: Send + Sync {
8113    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
8114    fn r#get(&self) -> Self::GetResponseFut;
8115}
8116#[derive(Debug)]
8117#[cfg(target_os = "fuchsia")]
8118pub struct RootJobForInspectSynchronousProxy {
8119    client: fidl::client::sync::Client,
8120}
8121
8122#[cfg(target_os = "fuchsia")]
8123impl fidl::endpoints::SynchronousProxy for RootJobForInspectSynchronousProxy {
8124    type Proxy = RootJobForInspectProxy;
8125    type Protocol = RootJobForInspectMarker;
8126
8127    fn from_channel(inner: fidl::Channel) -> Self {
8128        Self::new(inner)
8129    }
8130
8131    fn into_channel(self) -> fidl::Channel {
8132        self.client.into_channel()
8133    }
8134
8135    fn as_channel(&self) -> &fidl::Channel {
8136        self.client.as_channel()
8137    }
8138}
8139
8140#[cfg(target_os = "fuchsia")]
8141impl RootJobForInspectSynchronousProxy {
8142    pub fn new(channel: fidl::Channel) -> Self {
8143        Self { client: fidl::client::sync::Client::new(channel) }
8144    }
8145
8146    pub fn into_channel(self) -> fidl::Channel {
8147        self.client.into_channel()
8148    }
8149
8150    /// Waits until an event arrives and returns it. It is safe for other
8151    /// threads to make concurrent requests while waiting for an event.
8152    pub fn wait_for_event(
8153        &self,
8154        deadline: zx::MonotonicInstant,
8155    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8156        RootJobForInspectEvent::decode(
8157            self.client.wait_for_event::<RootJobForInspectMarker>(deadline)?,
8158        )
8159    }
8160
8161    /// Get the root `job`.
8162    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
8163        let _response = self.client.send_query::<
8164            fidl::encoding::EmptyPayload,
8165            RootJobGetResponse,
8166            RootJobForInspectMarker,
8167        >(
8168            (),
8169            0x73acb63f93d53eac,
8170            fidl::encoding::DynamicFlags::empty(),
8171            ___deadline,
8172        )?;
8173        Ok(_response.job)
8174    }
8175}
8176
8177#[cfg(target_os = "fuchsia")]
8178impl From<RootJobForInspectSynchronousProxy> for zx::NullableHandle {
8179    fn from(value: RootJobForInspectSynchronousProxy) -> Self {
8180        value.into_channel().into()
8181    }
8182}
8183
8184#[cfg(target_os = "fuchsia")]
8185impl From<fidl::Channel> for RootJobForInspectSynchronousProxy {
8186    fn from(value: fidl::Channel) -> Self {
8187        Self::new(value)
8188    }
8189}
8190
8191#[cfg(target_os = "fuchsia")]
8192impl fidl::endpoints::FromClient for RootJobForInspectSynchronousProxy {
8193    type Protocol = RootJobForInspectMarker;
8194
8195    fn from_client(value: fidl::endpoints::ClientEnd<RootJobForInspectMarker>) -> Self {
8196        Self::new(value.into_channel())
8197    }
8198}
8199
8200#[derive(Debug, Clone)]
8201pub struct RootJobForInspectProxy {
8202    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8203}
8204
8205impl fidl::endpoints::Proxy for RootJobForInspectProxy {
8206    type Protocol = RootJobForInspectMarker;
8207
8208    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8209        Self::new(inner)
8210    }
8211
8212    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8213        self.client.into_channel().map_err(|client| Self { client })
8214    }
8215
8216    fn as_channel(&self) -> &::fidl::AsyncChannel {
8217        self.client.as_channel()
8218    }
8219}
8220
8221impl RootJobForInspectProxy {
8222    /// Create a new Proxy for fuchsia.kernel/RootJobForInspect.
8223    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8224        let protocol_name =
8225            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8226        Self { client: fidl::client::Client::new(channel, protocol_name) }
8227    }
8228
8229    /// Get a Stream of events from the remote end of the protocol.
8230    ///
8231    /// # Panics
8232    ///
8233    /// Panics if the event stream was already taken.
8234    pub fn take_event_stream(&self) -> RootJobForInspectEventStream {
8235        RootJobForInspectEventStream { event_receiver: self.client.take_event_receiver() }
8236    }
8237
8238    /// Get the root `job`.
8239    pub fn r#get(
8240        &self,
8241    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
8242    {
8243        RootJobForInspectProxyInterface::r#get(self)
8244    }
8245}
8246
8247impl RootJobForInspectProxyInterface for RootJobForInspectProxy {
8248    type GetResponseFut =
8249        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
8250    fn r#get(&self) -> Self::GetResponseFut {
8251        fn _decode(
8252            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8253        ) -> Result<fidl::Job, fidl::Error> {
8254            let _response = fidl::client::decode_transaction_body::<
8255                RootJobGetResponse,
8256                fidl::encoding::DefaultFuchsiaResourceDialect,
8257                0x73acb63f93d53eac,
8258            >(_buf?)?;
8259            Ok(_response.job)
8260        }
8261        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
8262            (),
8263            0x73acb63f93d53eac,
8264            fidl::encoding::DynamicFlags::empty(),
8265            _decode,
8266        )
8267    }
8268}
8269
8270pub struct RootJobForInspectEventStream {
8271    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8272}
8273
8274impl std::marker::Unpin for RootJobForInspectEventStream {}
8275
8276impl futures::stream::FusedStream for RootJobForInspectEventStream {
8277    fn is_terminated(&self) -> bool {
8278        self.event_receiver.is_terminated()
8279    }
8280}
8281
8282impl futures::Stream for RootJobForInspectEventStream {
8283    type Item = Result<RootJobForInspectEvent, fidl::Error>;
8284
8285    fn poll_next(
8286        mut self: std::pin::Pin<&mut Self>,
8287        cx: &mut std::task::Context<'_>,
8288    ) -> std::task::Poll<Option<Self::Item>> {
8289        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8290            &mut self.event_receiver,
8291            cx
8292        )?) {
8293            Some(buf) => std::task::Poll::Ready(Some(RootJobForInspectEvent::decode(buf))),
8294            None => std::task::Poll::Ready(None),
8295        }
8296    }
8297}
8298
8299#[derive(Debug)]
8300pub enum RootJobForInspectEvent {}
8301
8302impl RootJobForInspectEvent {
8303    /// Decodes a message buffer as a [`RootJobForInspectEvent`].
8304    fn decode(
8305        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8306    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8307        let (bytes, _handles) = buf.split_mut();
8308        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8309        debug_assert_eq!(tx_header.tx_id, 0);
8310        match tx_header.ordinal {
8311            _ => Err(fidl::Error::UnknownOrdinal {
8312                ordinal: tx_header.ordinal,
8313                protocol_name:
8314                    <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8315            }),
8316        }
8317    }
8318}
8319
8320/// A Stream of incoming requests for fuchsia.kernel/RootJobForInspect.
8321pub struct RootJobForInspectRequestStream {
8322    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8323    is_terminated: bool,
8324}
8325
8326impl std::marker::Unpin for RootJobForInspectRequestStream {}
8327
8328impl futures::stream::FusedStream for RootJobForInspectRequestStream {
8329    fn is_terminated(&self) -> bool {
8330        self.is_terminated
8331    }
8332}
8333
8334impl fidl::endpoints::RequestStream for RootJobForInspectRequestStream {
8335    type Protocol = RootJobForInspectMarker;
8336    type ControlHandle = RootJobForInspectControlHandle;
8337
8338    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8339        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8340    }
8341
8342    fn control_handle(&self) -> Self::ControlHandle {
8343        RootJobForInspectControlHandle { inner: self.inner.clone() }
8344    }
8345
8346    fn into_inner(
8347        self,
8348    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8349    {
8350        (self.inner, self.is_terminated)
8351    }
8352
8353    fn from_inner(
8354        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8355        is_terminated: bool,
8356    ) -> Self {
8357        Self { inner, is_terminated }
8358    }
8359}
8360
8361impl futures::Stream for RootJobForInspectRequestStream {
8362    type Item = Result<RootJobForInspectRequest, fidl::Error>;
8363
8364    fn poll_next(
8365        mut self: std::pin::Pin<&mut Self>,
8366        cx: &mut std::task::Context<'_>,
8367    ) -> std::task::Poll<Option<Self::Item>> {
8368        let this = &mut *self;
8369        if this.inner.check_shutdown(cx) {
8370            this.is_terminated = true;
8371            return std::task::Poll::Ready(None);
8372        }
8373        if this.is_terminated {
8374            panic!("polled RootJobForInspectRequestStream after completion");
8375        }
8376        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8377            |bytes, handles| {
8378                match this.inner.channel().read_etc(cx, bytes, handles) {
8379                    std::task::Poll::Ready(Ok(())) => {}
8380                    std::task::Poll::Pending => return std::task::Poll::Pending,
8381                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8382                        this.is_terminated = true;
8383                        return std::task::Poll::Ready(None);
8384                    }
8385                    std::task::Poll::Ready(Err(e)) => {
8386                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8387                            e.into(),
8388                        ))));
8389                    }
8390                }
8391
8392                // A message has been received from the channel
8393                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8394
8395                std::task::Poll::Ready(Some(match header.ordinal {
8396                    0x73acb63f93d53eac => {
8397                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8398                        let mut req = fidl::new_empty!(
8399                            fidl::encoding::EmptyPayload,
8400                            fidl::encoding::DefaultFuchsiaResourceDialect
8401                        );
8402                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8403                        let control_handle =
8404                            RootJobForInspectControlHandle { inner: this.inner.clone() };
8405                        Ok(RootJobForInspectRequest::Get {
8406                            responder: RootJobForInspectGetResponder {
8407                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8408                                tx_id: header.tx_id,
8409                            },
8410                        })
8411                    }
8412                    _ => Err(fidl::Error::UnknownOrdinal {
8413                        ordinal: header.ordinal,
8414                        protocol_name:
8415                            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8416                    }),
8417                }))
8418            },
8419        )
8420    }
8421}
8422
8423/// Protocol for providing the root job with restricted rights, specifically:
8424/// INSPECT | ENUMERATE | DUPLICATE | TRANSFER
8425#[derive(Debug)]
8426pub enum RootJobForInspectRequest {
8427    /// Get the root `job`.
8428    Get { responder: RootJobForInspectGetResponder },
8429}
8430
8431impl RootJobForInspectRequest {
8432    #[allow(irrefutable_let_patterns)]
8433    pub fn into_get(self) -> Option<(RootJobForInspectGetResponder)> {
8434        if let RootJobForInspectRequest::Get { responder } = self {
8435            Some((responder))
8436        } else {
8437            None
8438        }
8439    }
8440
8441    /// Name of the method defined in FIDL
8442    pub fn method_name(&self) -> &'static str {
8443        match *self {
8444            RootJobForInspectRequest::Get { .. } => "get",
8445        }
8446    }
8447}
8448
8449#[derive(Debug, Clone)]
8450pub struct RootJobForInspectControlHandle {
8451    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8452}
8453
8454impl RootJobForInspectControlHandle {
8455    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8456        self.inner.shutdown_with_epitaph(status.into())
8457    }
8458}
8459
8460impl fidl::endpoints::ControlHandle for RootJobForInspectControlHandle {
8461    fn shutdown(&self) {
8462        self.inner.shutdown()
8463    }
8464
8465    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8466        self.inner.shutdown_with_epitaph(status)
8467    }
8468
8469    fn is_closed(&self) -> bool {
8470        self.inner.channel().is_closed()
8471    }
8472    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8473        self.inner.channel().on_closed()
8474    }
8475
8476    #[cfg(target_os = "fuchsia")]
8477    fn signal_peer(
8478        &self,
8479        clear_mask: zx::Signals,
8480        set_mask: zx::Signals,
8481    ) -> Result<(), zx_status::Status> {
8482        use fidl::Peered;
8483        self.inner.channel().signal_peer(clear_mask, set_mask)
8484    }
8485}
8486
8487impl RootJobForInspectControlHandle {}
8488
8489#[must_use = "FIDL methods require a response to be sent"]
8490#[derive(Debug)]
8491pub struct RootJobForInspectGetResponder {
8492    control_handle: std::mem::ManuallyDrop<RootJobForInspectControlHandle>,
8493    tx_id: u32,
8494}
8495
8496/// Set the the channel to be shutdown (see [`RootJobForInspectControlHandle::shutdown`])
8497/// if the responder is dropped without sending a response, so that the client
8498/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8499impl std::ops::Drop for RootJobForInspectGetResponder {
8500    fn drop(&mut self) {
8501        self.control_handle.shutdown();
8502        // Safety: drops once, never accessed again
8503        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8504    }
8505}
8506
8507impl fidl::endpoints::Responder for RootJobForInspectGetResponder {
8508    type ControlHandle = RootJobForInspectControlHandle;
8509
8510    fn control_handle(&self) -> &RootJobForInspectControlHandle {
8511        &self.control_handle
8512    }
8513
8514    fn drop_without_shutdown(mut self) {
8515        // Safety: drops once, never accessed again due to mem::forget
8516        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8517        // Prevent Drop from running (which would shut down the channel)
8518        std::mem::forget(self);
8519    }
8520}
8521
8522impl RootJobForInspectGetResponder {
8523    /// Sends a response to the FIDL transaction.
8524    ///
8525    /// Sets the channel to shutdown if an error occurs.
8526    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8527        let _result = self.send_raw(job);
8528        if _result.is_err() {
8529            self.control_handle.shutdown();
8530        }
8531        self.drop_without_shutdown();
8532        _result
8533    }
8534
8535    /// Similar to "send" but does not shutdown the channel if an error occurs.
8536    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8537        let _result = self.send_raw(job);
8538        self.drop_without_shutdown();
8539        _result
8540    }
8541
8542    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8543        self.control_handle.inner.send::<RootJobGetResponse>(
8544            (job,),
8545            self.tx_id,
8546            0x73acb63f93d53eac,
8547            fidl::encoding::DynamicFlags::empty(),
8548        )
8549    }
8550}
8551
8552#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8553pub struct SamplingResourceMarker;
8554
8555impl fidl::endpoints::ProtocolMarker for SamplingResourceMarker {
8556    type Proxy = SamplingResourceProxy;
8557    type RequestStream = SamplingResourceRequestStream;
8558    #[cfg(target_os = "fuchsia")]
8559    type SynchronousProxy = SamplingResourceSynchronousProxy;
8560
8561    const DEBUG_NAME: &'static str = "fuchsia.kernel.SamplingResource";
8562}
8563impl fidl::endpoints::DiscoverableProtocolMarker for SamplingResourceMarker {}
8564
8565pub trait SamplingResourceProxyInterface: Send + Sync {
8566    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8567    fn r#get(&self) -> Self::GetResponseFut;
8568}
8569#[derive(Debug)]
8570#[cfg(target_os = "fuchsia")]
8571pub struct SamplingResourceSynchronousProxy {
8572    client: fidl::client::sync::Client,
8573}
8574
8575#[cfg(target_os = "fuchsia")]
8576impl fidl::endpoints::SynchronousProxy for SamplingResourceSynchronousProxy {
8577    type Proxy = SamplingResourceProxy;
8578    type Protocol = SamplingResourceMarker;
8579
8580    fn from_channel(inner: fidl::Channel) -> Self {
8581        Self::new(inner)
8582    }
8583
8584    fn into_channel(self) -> fidl::Channel {
8585        self.client.into_channel()
8586    }
8587
8588    fn as_channel(&self) -> &fidl::Channel {
8589        self.client.as_channel()
8590    }
8591}
8592
8593#[cfg(target_os = "fuchsia")]
8594impl SamplingResourceSynchronousProxy {
8595    pub fn new(channel: fidl::Channel) -> Self {
8596        Self { client: fidl::client::sync::Client::new(channel) }
8597    }
8598
8599    pub fn into_channel(self) -> fidl::Channel {
8600        self.client.into_channel()
8601    }
8602
8603    /// Waits until an event arrives and returns it. It is safe for other
8604    /// threads to make concurrent requests while waiting for an event.
8605    pub fn wait_for_event(
8606        &self,
8607        deadline: zx::MonotonicInstant,
8608    ) -> Result<SamplingResourceEvent, fidl::Error> {
8609        SamplingResourceEvent::decode(
8610            self.client.wait_for_event::<SamplingResourceMarker>(deadline)?,
8611        )
8612    }
8613
8614    /// Get a sampling resource handle.
8615    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8616        let _response = self.client.send_query::<
8617            fidl::encoding::EmptyPayload,
8618            SamplingResourceGetResponse,
8619            SamplingResourceMarker,
8620        >(
8621            (),
8622            0x51c41ab037e99824,
8623            fidl::encoding::DynamicFlags::empty(),
8624            ___deadline,
8625        )?;
8626        Ok(_response.resource)
8627    }
8628}
8629
8630#[cfg(target_os = "fuchsia")]
8631impl From<SamplingResourceSynchronousProxy> for zx::NullableHandle {
8632    fn from(value: SamplingResourceSynchronousProxy) -> Self {
8633        value.into_channel().into()
8634    }
8635}
8636
8637#[cfg(target_os = "fuchsia")]
8638impl From<fidl::Channel> for SamplingResourceSynchronousProxy {
8639    fn from(value: fidl::Channel) -> Self {
8640        Self::new(value)
8641    }
8642}
8643
8644#[cfg(target_os = "fuchsia")]
8645impl fidl::endpoints::FromClient for SamplingResourceSynchronousProxy {
8646    type Protocol = SamplingResourceMarker;
8647
8648    fn from_client(value: fidl::endpoints::ClientEnd<SamplingResourceMarker>) -> Self {
8649        Self::new(value.into_channel())
8650    }
8651}
8652
8653#[derive(Debug, Clone)]
8654pub struct SamplingResourceProxy {
8655    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8656}
8657
8658impl fidl::endpoints::Proxy for SamplingResourceProxy {
8659    type Protocol = SamplingResourceMarker;
8660
8661    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8662        Self::new(inner)
8663    }
8664
8665    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8666        self.client.into_channel().map_err(|client| Self { client })
8667    }
8668
8669    fn as_channel(&self) -> &::fidl::AsyncChannel {
8670        self.client.as_channel()
8671    }
8672}
8673
8674impl SamplingResourceProxy {
8675    /// Create a new Proxy for fuchsia.kernel/SamplingResource.
8676    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8677        let protocol_name = <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8678        Self { client: fidl::client::Client::new(channel, protocol_name) }
8679    }
8680
8681    /// Get a Stream of events from the remote end of the protocol.
8682    ///
8683    /// # Panics
8684    ///
8685    /// Panics if the event stream was already taken.
8686    pub fn take_event_stream(&self) -> SamplingResourceEventStream {
8687        SamplingResourceEventStream { event_receiver: self.client.take_event_receiver() }
8688    }
8689
8690    /// Get a sampling resource handle.
8691    pub fn r#get(
8692        &self,
8693    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8694    {
8695        SamplingResourceProxyInterface::r#get(self)
8696    }
8697}
8698
8699impl SamplingResourceProxyInterface for SamplingResourceProxy {
8700    type GetResponseFut = fidl::client::QueryResponseFut<
8701        fidl::Resource,
8702        fidl::encoding::DefaultFuchsiaResourceDialect,
8703    >;
8704    fn r#get(&self) -> Self::GetResponseFut {
8705        fn _decode(
8706            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8707        ) -> Result<fidl::Resource, fidl::Error> {
8708            let _response = fidl::client::decode_transaction_body::<
8709                SamplingResourceGetResponse,
8710                fidl::encoding::DefaultFuchsiaResourceDialect,
8711                0x51c41ab037e99824,
8712            >(_buf?)?;
8713            Ok(_response.resource)
8714        }
8715        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8716            (),
8717            0x51c41ab037e99824,
8718            fidl::encoding::DynamicFlags::empty(),
8719            _decode,
8720        )
8721    }
8722}
8723
8724pub struct SamplingResourceEventStream {
8725    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8726}
8727
8728impl std::marker::Unpin for SamplingResourceEventStream {}
8729
8730impl futures::stream::FusedStream for SamplingResourceEventStream {
8731    fn is_terminated(&self) -> bool {
8732        self.event_receiver.is_terminated()
8733    }
8734}
8735
8736impl futures::Stream for SamplingResourceEventStream {
8737    type Item = Result<SamplingResourceEvent, fidl::Error>;
8738
8739    fn poll_next(
8740        mut self: std::pin::Pin<&mut Self>,
8741        cx: &mut std::task::Context<'_>,
8742    ) -> std::task::Poll<Option<Self::Item>> {
8743        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8744            &mut self.event_receiver,
8745            cx
8746        )?) {
8747            Some(buf) => std::task::Poll::Ready(Some(SamplingResourceEvent::decode(buf))),
8748            None => std::task::Poll::Ready(None),
8749        }
8750    }
8751}
8752
8753#[derive(Debug)]
8754pub enum SamplingResourceEvent {}
8755
8756impl SamplingResourceEvent {
8757    /// Decodes a message buffer as a [`SamplingResourceEvent`].
8758    fn decode(
8759        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8760    ) -> Result<SamplingResourceEvent, fidl::Error> {
8761        let (bytes, _handles) = buf.split_mut();
8762        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8763        debug_assert_eq!(tx_header.tx_id, 0);
8764        match tx_header.ordinal {
8765            _ => Err(fidl::Error::UnknownOrdinal {
8766                ordinal: tx_header.ordinal,
8767                protocol_name:
8768                    <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8769            }),
8770        }
8771    }
8772}
8773
8774/// A Stream of incoming requests for fuchsia.kernel/SamplingResource.
8775pub struct SamplingResourceRequestStream {
8776    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8777    is_terminated: bool,
8778}
8779
8780impl std::marker::Unpin for SamplingResourceRequestStream {}
8781
8782impl futures::stream::FusedStream for SamplingResourceRequestStream {
8783    fn is_terminated(&self) -> bool {
8784        self.is_terminated
8785    }
8786}
8787
8788impl fidl::endpoints::RequestStream for SamplingResourceRequestStream {
8789    type Protocol = SamplingResourceMarker;
8790    type ControlHandle = SamplingResourceControlHandle;
8791
8792    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8793        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8794    }
8795
8796    fn control_handle(&self) -> Self::ControlHandle {
8797        SamplingResourceControlHandle { inner: self.inner.clone() }
8798    }
8799
8800    fn into_inner(
8801        self,
8802    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8803    {
8804        (self.inner, self.is_terminated)
8805    }
8806
8807    fn from_inner(
8808        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8809        is_terminated: bool,
8810    ) -> Self {
8811        Self { inner, is_terminated }
8812    }
8813}
8814
8815impl futures::Stream for SamplingResourceRequestStream {
8816    type Item = Result<SamplingResourceRequest, fidl::Error>;
8817
8818    fn poll_next(
8819        mut self: std::pin::Pin<&mut Self>,
8820        cx: &mut std::task::Context<'_>,
8821    ) -> std::task::Poll<Option<Self::Item>> {
8822        let this = &mut *self;
8823        if this.inner.check_shutdown(cx) {
8824            this.is_terminated = true;
8825            return std::task::Poll::Ready(None);
8826        }
8827        if this.is_terminated {
8828            panic!("polled SamplingResourceRequestStream after completion");
8829        }
8830        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8831            |bytes, handles| {
8832                match this.inner.channel().read_etc(cx, bytes, handles) {
8833                    std::task::Poll::Ready(Ok(())) => {}
8834                    std::task::Poll::Pending => return std::task::Poll::Pending,
8835                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8836                        this.is_terminated = true;
8837                        return std::task::Poll::Ready(None);
8838                    }
8839                    std::task::Poll::Ready(Err(e)) => {
8840                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8841                            e.into(),
8842                        ))));
8843                    }
8844                }
8845
8846                // A message has been received from the channel
8847                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8848
8849                std::task::Poll::Ready(Some(match header.ordinal {
8850                    0x51c41ab037e99824 => {
8851                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8852                        let mut req = fidl::new_empty!(
8853                            fidl::encoding::EmptyPayload,
8854                            fidl::encoding::DefaultFuchsiaResourceDialect
8855                        );
8856                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8857                        let control_handle =
8858                            SamplingResourceControlHandle { inner: this.inner.clone() };
8859                        Ok(SamplingResourceRequest::Get {
8860                            responder: SamplingResourceGetResponder {
8861                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8862                                tx_id: header.tx_id,
8863                            },
8864                        })
8865                    }
8866                    _ => Err(fidl::Error::UnknownOrdinal {
8867                        ordinal: header.ordinal,
8868                        protocol_name:
8869                            <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8870                    }),
8871                }))
8872            },
8873        )
8874    }
8875}
8876
8877/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
8878/// `ZX_RSRC_SYSTEM_SAMPLING_BASE`.
8879#[derive(Debug)]
8880pub enum SamplingResourceRequest {
8881    /// Get a sampling resource handle.
8882    Get { responder: SamplingResourceGetResponder },
8883}
8884
8885impl SamplingResourceRequest {
8886    #[allow(irrefutable_let_patterns)]
8887    pub fn into_get(self) -> Option<(SamplingResourceGetResponder)> {
8888        if let SamplingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
8889    }
8890
8891    /// Name of the method defined in FIDL
8892    pub fn method_name(&self) -> &'static str {
8893        match *self {
8894            SamplingResourceRequest::Get { .. } => "get",
8895        }
8896    }
8897}
8898
8899#[derive(Debug, Clone)]
8900pub struct SamplingResourceControlHandle {
8901    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8902}
8903
8904impl SamplingResourceControlHandle {
8905    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8906        self.inner.shutdown_with_epitaph(status.into())
8907    }
8908}
8909
8910impl fidl::endpoints::ControlHandle for SamplingResourceControlHandle {
8911    fn shutdown(&self) {
8912        self.inner.shutdown()
8913    }
8914
8915    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8916        self.inner.shutdown_with_epitaph(status)
8917    }
8918
8919    fn is_closed(&self) -> bool {
8920        self.inner.channel().is_closed()
8921    }
8922    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8923        self.inner.channel().on_closed()
8924    }
8925
8926    #[cfg(target_os = "fuchsia")]
8927    fn signal_peer(
8928        &self,
8929        clear_mask: zx::Signals,
8930        set_mask: zx::Signals,
8931    ) -> Result<(), zx_status::Status> {
8932        use fidl::Peered;
8933        self.inner.channel().signal_peer(clear_mask, set_mask)
8934    }
8935}
8936
8937impl SamplingResourceControlHandle {}
8938
8939#[must_use = "FIDL methods require a response to be sent"]
8940#[derive(Debug)]
8941pub struct SamplingResourceGetResponder {
8942    control_handle: std::mem::ManuallyDrop<SamplingResourceControlHandle>,
8943    tx_id: u32,
8944}
8945
8946/// Set the the channel to be shutdown (see [`SamplingResourceControlHandle::shutdown`])
8947/// if the responder is dropped without sending a response, so that the client
8948/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8949impl std::ops::Drop for SamplingResourceGetResponder {
8950    fn drop(&mut self) {
8951        self.control_handle.shutdown();
8952        // Safety: drops once, never accessed again
8953        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8954    }
8955}
8956
8957impl fidl::endpoints::Responder for SamplingResourceGetResponder {
8958    type ControlHandle = SamplingResourceControlHandle;
8959
8960    fn control_handle(&self) -> &SamplingResourceControlHandle {
8961        &self.control_handle
8962    }
8963
8964    fn drop_without_shutdown(mut self) {
8965        // Safety: drops once, never accessed again due to mem::forget
8966        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8967        // Prevent Drop from running (which would shut down the channel)
8968        std::mem::forget(self);
8969    }
8970}
8971
8972impl SamplingResourceGetResponder {
8973    /// Sends a response to the FIDL transaction.
8974    ///
8975    /// Sets the channel to shutdown if an error occurs.
8976    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8977        let _result = self.send_raw(resource);
8978        if _result.is_err() {
8979            self.control_handle.shutdown();
8980        }
8981        self.drop_without_shutdown();
8982        _result
8983    }
8984
8985    /// Similar to "send" but does not shutdown the channel if an error occurs.
8986    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8987        let _result = self.send_raw(resource);
8988        self.drop_without_shutdown();
8989        _result
8990    }
8991
8992    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8993        self.control_handle.inner.send::<SamplingResourceGetResponse>(
8994            (resource,),
8995            self.tx_id,
8996            0x51c41ab037e99824,
8997            fidl::encoding::DynamicFlags::empty(),
8998        )
8999    }
9000}
9001
9002#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9003pub struct SmcResourceMarker;
9004
9005impl fidl::endpoints::ProtocolMarker for SmcResourceMarker {
9006    type Proxy = SmcResourceProxy;
9007    type RequestStream = SmcResourceRequestStream;
9008    #[cfg(target_os = "fuchsia")]
9009    type SynchronousProxy = SmcResourceSynchronousProxy;
9010
9011    const DEBUG_NAME: &'static str = "fuchsia.kernel.SmcResource";
9012}
9013impl fidl::endpoints::DiscoverableProtocolMarker for SmcResourceMarker {}
9014
9015pub trait SmcResourceProxyInterface: Send + Sync {
9016    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
9017    fn r#get(&self) -> Self::GetResponseFut;
9018}
9019#[derive(Debug)]
9020#[cfg(target_os = "fuchsia")]
9021pub struct SmcResourceSynchronousProxy {
9022    client: fidl::client::sync::Client,
9023}
9024
9025#[cfg(target_os = "fuchsia")]
9026impl fidl::endpoints::SynchronousProxy for SmcResourceSynchronousProxy {
9027    type Proxy = SmcResourceProxy;
9028    type Protocol = SmcResourceMarker;
9029
9030    fn from_channel(inner: fidl::Channel) -> Self {
9031        Self::new(inner)
9032    }
9033
9034    fn into_channel(self) -> fidl::Channel {
9035        self.client.into_channel()
9036    }
9037
9038    fn as_channel(&self) -> &fidl::Channel {
9039        self.client.as_channel()
9040    }
9041}
9042
9043#[cfg(target_os = "fuchsia")]
9044impl SmcResourceSynchronousProxy {
9045    pub fn new(channel: fidl::Channel) -> Self {
9046        Self { client: fidl::client::sync::Client::new(channel) }
9047    }
9048
9049    pub fn into_channel(self) -> fidl::Channel {
9050        self.client.into_channel()
9051    }
9052
9053    /// Waits until an event arrives and returns it. It is safe for other
9054    /// threads to make concurrent requests while waiting for an event.
9055    pub fn wait_for_event(
9056        &self,
9057        deadline: zx::MonotonicInstant,
9058    ) -> Result<SmcResourceEvent, fidl::Error> {
9059        SmcResourceEvent::decode(self.client.wait_for_event::<SmcResourceMarker>(deadline)?)
9060    }
9061
9062    /// Get an SMC resource handle.
9063    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
9064        let _response = self
9065            .client
9066            .send_query::<fidl::encoding::EmptyPayload, SmcResourceGetResponse, SmcResourceMarker>(
9067                (),
9068                0x392cbd495b84ede7,
9069                fidl::encoding::DynamicFlags::empty(),
9070                ___deadline,
9071            )?;
9072        Ok(_response.resource)
9073    }
9074}
9075
9076#[cfg(target_os = "fuchsia")]
9077impl From<SmcResourceSynchronousProxy> for zx::NullableHandle {
9078    fn from(value: SmcResourceSynchronousProxy) -> Self {
9079        value.into_channel().into()
9080    }
9081}
9082
9083#[cfg(target_os = "fuchsia")]
9084impl From<fidl::Channel> for SmcResourceSynchronousProxy {
9085    fn from(value: fidl::Channel) -> Self {
9086        Self::new(value)
9087    }
9088}
9089
9090#[cfg(target_os = "fuchsia")]
9091impl fidl::endpoints::FromClient for SmcResourceSynchronousProxy {
9092    type Protocol = SmcResourceMarker;
9093
9094    fn from_client(value: fidl::endpoints::ClientEnd<SmcResourceMarker>) -> Self {
9095        Self::new(value.into_channel())
9096    }
9097}
9098
9099#[derive(Debug, Clone)]
9100pub struct SmcResourceProxy {
9101    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9102}
9103
9104impl fidl::endpoints::Proxy for SmcResourceProxy {
9105    type Protocol = SmcResourceMarker;
9106
9107    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9108        Self::new(inner)
9109    }
9110
9111    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9112        self.client.into_channel().map_err(|client| Self { client })
9113    }
9114
9115    fn as_channel(&self) -> &::fidl::AsyncChannel {
9116        self.client.as_channel()
9117    }
9118}
9119
9120impl SmcResourceProxy {
9121    /// Create a new Proxy for fuchsia.kernel/SmcResource.
9122    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9123        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9124        Self { client: fidl::client::Client::new(channel, protocol_name) }
9125    }
9126
9127    /// Get a Stream of events from the remote end of the protocol.
9128    ///
9129    /// # Panics
9130    ///
9131    /// Panics if the event stream was already taken.
9132    pub fn take_event_stream(&self) -> SmcResourceEventStream {
9133        SmcResourceEventStream { event_receiver: self.client.take_event_receiver() }
9134    }
9135
9136    /// Get an SMC resource handle.
9137    pub fn r#get(
9138        &self,
9139    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9140    {
9141        SmcResourceProxyInterface::r#get(self)
9142    }
9143}
9144
9145impl SmcResourceProxyInterface for SmcResourceProxy {
9146    type GetResponseFut = fidl::client::QueryResponseFut<
9147        fidl::Resource,
9148        fidl::encoding::DefaultFuchsiaResourceDialect,
9149    >;
9150    fn r#get(&self) -> Self::GetResponseFut {
9151        fn _decode(
9152            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9153        ) -> Result<fidl::Resource, fidl::Error> {
9154            let _response = fidl::client::decode_transaction_body::<
9155                SmcResourceGetResponse,
9156                fidl::encoding::DefaultFuchsiaResourceDialect,
9157                0x392cbd495b84ede7,
9158            >(_buf?)?;
9159            Ok(_response.resource)
9160        }
9161        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9162            (),
9163            0x392cbd495b84ede7,
9164            fidl::encoding::DynamicFlags::empty(),
9165            _decode,
9166        )
9167    }
9168}
9169
9170pub struct SmcResourceEventStream {
9171    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9172}
9173
9174impl std::marker::Unpin for SmcResourceEventStream {}
9175
9176impl futures::stream::FusedStream for SmcResourceEventStream {
9177    fn is_terminated(&self) -> bool {
9178        self.event_receiver.is_terminated()
9179    }
9180}
9181
9182impl futures::Stream for SmcResourceEventStream {
9183    type Item = Result<SmcResourceEvent, fidl::Error>;
9184
9185    fn poll_next(
9186        mut self: std::pin::Pin<&mut Self>,
9187        cx: &mut std::task::Context<'_>,
9188    ) -> std::task::Poll<Option<Self::Item>> {
9189        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9190            &mut self.event_receiver,
9191            cx
9192        )?) {
9193            Some(buf) => std::task::Poll::Ready(Some(SmcResourceEvent::decode(buf))),
9194            None => std::task::Poll::Ready(None),
9195        }
9196    }
9197}
9198
9199#[derive(Debug)]
9200pub enum SmcResourceEvent {}
9201
9202impl SmcResourceEvent {
9203    /// Decodes a message buffer as a [`SmcResourceEvent`].
9204    fn decode(
9205        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9206    ) -> Result<SmcResourceEvent, fidl::Error> {
9207        let (bytes, _handles) = buf.split_mut();
9208        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9209        debug_assert_eq!(tx_header.tx_id, 0);
9210        match tx_header.ordinal {
9211            _ => Err(fidl::Error::UnknownOrdinal {
9212                ordinal: tx_header.ordinal,
9213                protocol_name: <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9214            }),
9215        }
9216    }
9217}
9218
9219/// A Stream of incoming requests for fuchsia.kernel/SmcResource.
9220pub struct SmcResourceRequestStream {
9221    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9222    is_terminated: bool,
9223}
9224
9225impl std::marker::Unpin for SmcResourceRequestStream {}
9226
9227impl futures::stream::FusedStream for SmcResourceRequestStream {
9228    fn is_terminated(&self) -> bool {
9229        self.is_terminated
9230    }
9231}
9232
9233impl fidl::endpoints::RequestStream for SmcResourceRequestStream {
9234    type Protocol = SmcResourceMarker;
9235    type ControlHandle = SmcResourceControlHandle;
9236
9237    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9238        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9239    }
9240
9241    fn control_handle(&self) -> Self::ControlHandle {
9242        SmcResourceControlHandle { inner: self.inner.clone() }
9243    }
9244
9245    fn into_inner(
9246        self,
9247    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9248    {
9249        (self.inner, self.is_terminated)
9250    }
9251
9252    fn from_inner(
9253        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9254        is_terminated: bool,
9255    ) -> Self {
9256        Self { inner, is_terminated }
9257    }
9258}
9259
9260impl futures::Stream for SmcResourceRequestStream {
9261    type Item = Result<SmcResourceRequest, fidl::Error>;
9262
9263    fn poll_next(
9264        mut self: std::pin::Pin<&mut Self>,
9265        cx: &mut std::task::Context<'_>,
9266    ) -> std::task::Poll<Option<Self::Item>> {
9267        let this = &mut *self;
9268        if this.inner.check_shutdown(cx) {
9269            this.is_terminated = true;
9270            return std::task::Poll::Ready(None);
9271        }
9272        if this.is_terminated {
9273            panic!("polled SmcResourceRequestStream after completion");
9274        }
9275        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9276            |bytes, handles| {
9277                match this.inner.channel().read_etc(cx, bytes, handles) {
9278                    std::task::Poll::Ready(Ok(())) => {}
9279                    std::task::Poll::Pending => return std::task::Poll::Pending,
9280                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9281                        this.is_terminated = true;
9282                        return std::task::Poll::Ready(None);
9283                    }
9284                    std::task::Poll::Ready(Err(e)) => {
9285                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9286                            e.into(),
9287                        ))));
9288                    }
9289                }
9290
9291                // A message has been received from the channel
9292                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9293
9294                std::task::Poll::Ready(Some(match header.ordinal {
9295                    0x392cbd495b84ede7 => {
9296                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9297                        let mut req = fidl::new_empty!(
9298                            fidl::encoding::EmptyPayload,
9299                            fidl::encoding::DefaultFuchsiaResourceDialect
9300                        );
9301                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9302                        let control_handle = SmcResourceControlHandle { inner: this.inner.clone() };
9303                        Ok(SmcResourceRequest::Get {
9304                            responder: SmcResourceGetResponder {
9305                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9306                                tx_id: header.tx_id,
9307                            },
9308                        })
9309                    }
9310                    _ => Err(fidl::Error::UnknownOrdinal {
9311                        ordinal: header.ordinal,
9312                        protocol_name:
9313                            <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9314                    }),
9315                }))
9316            },
9317        )
9318    }
9319}
9320
9321/// Protocol for providing an SMC resource with access to all valid ranges.
9322#[derive(Debug)]
9323pub enum SmcResourceRequest {
9324    /// Get an SMC resource handle.
9325    Get { responder: SmcResourceGetResponder },
9326}
9327
9328impl SmcResourceRequest {
9329    #[allow(irrefutable_let_patterns)]
9330    pub fn into_get(self) -> Option<(SmcResourceGetResponder)> {
9331        if let SmcResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9332    }
9333
9334    /// Name of the method defined in FIDL
9335    pub fn method_name(&self) -> &'static str {
9336        match *self {
9337            SmcResourceRequest::Get { .. } => "get",
9338        }
9339    }
9340}
9341
9342#[derive(Debug, Clone)]
9343pub struct SmcResourceControlHandle {
9344    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9345}
9346
9347impl SmcResourceControlHandle {
9348    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9349        self.inner.shutdown_with_epitaph(status.into())
9350    }
9351}
9352
9353impl fidl::endpoints::ControlHandle for SmcResourceControlHandle {
9354    fn shutdown(&self) {
9355        self.inner.shutdown()
9356    }
9357
9358    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9359        self.inner.shutdown_with_epitaph(status)
9360    }
9361
9362    fn is_closed(&self) -> bool {
9363        self.inner.channel().is_closed()
9364    }
9365    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9366        self.inner.channel().on_closed()
9367    }
9368
9369    #[cfg(target_os = "fuchsia")]
9370    fn signal_peer(
9371        &self,
9372        clear_mask: zx::Signals,
9373        set_mask: zx::Signals,
9374    ) -> Result<(), zx_status::Status> {
9375        use fidl::Peered;
9376        self.inner.channel().signal_peer(clear_mask, set_mask)
9377    }
9378}
9379
9380impl SmcResourceControlHandle {}
9381
9382#[must_use = "FIDL methods require a response to be sent"]
9383#[derive(Debug)]
9384pub struct SmcResourceGetResponder {
9385    control_handle: std::mem::ManuallyDrop<SmcResourceControlHandle>,
9386    tx_id: u32,
9387}
9388
9389/// Set the the channel to be shutdown (see [`SmcResourceControlHandle::shutdown`])
9390/// if the responder is dropped without sending a response, so that the client
9391/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9392impl std::ops::Drop for SmcResourceGetResponder {
9393    fn drop(&mut self) {
9394        self.control_handle.shutdown();
9395        // Safety: drops once, never accessed again
9396        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9397    }
9398}
9399
9400impl fidl::endpoints::Responder for SmcResourceGetResponder {
9401    type ControlHandle = SmcResourceControlHandle;
9402
9403    fn control_handle(&self) -> &SmcResourceControlHandle {
9404        &self.control_handle
9405    }
9406
9407    fn drop_without_shutdown(mut self) {
9408        // Safety: drops once, never accessed again due to mem::forget
9409        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9410        // Prevent Drop from running (which would shut down the channel)
9411        std::mem::forget(self);
9412    }
9413}
9414
9415impl SmcResourceGetResponder {
9416    /// Sends a response to the FIDL transaction.
9417    ///
9418    /// Sets the channel to shutdown if an error occurs.
9419    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9420        let _result = self.send_raw(resource);
9421        if _result.is_err() {
9422            self.control_handle.shutdown();
9423        }
9424        self.drop_without_shutdown();
9425        _result
9426    }
9427
9428    /// Similar to "send" but does not shutdown the channel if an error occurs.
9429    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9430        let _result = self.send_raw(resource);
9431        self.drop_without_shutdown();
9432        _result
9433    }
9434
9435    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9436        self.control_handle.inner.send::<SmcResourceGetResponse>(
9437            (resource,),
9438            self.tx_id,
9439            0x392cbd495b84ede7,
9440            fidl::encoding::DynamicFlags::empty(),
9441        )
9442    }
9443}
9444
9445#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9446pub struct StallResourceMarker;
9447
9448impl fidl::endpoints::ProtocolMarker for StallResourceMarker {
9449    type Proxy = StallResourceProxy;
9450    type RequestStream = StallResourceRequestStream;
9451    #[cfg(target_os = "fuchsia")]
9452    type SynchronousProxy = StallResourceSynchronousProxy;
9453
9454    const DEBUG_NAME: &'static str = "fuchsia.kernel.StallResource";
9455}
9456impl fidl::endpoints::DiscoverableProtocolMarker for StallResourceMarker {}
9457
9458pub trait StallResourceProxyInterface: Send + Sync {
9459    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
9460    fn r#get(&self) -> Self::GetResponseFut;
9461}
9462#[derive(Debug)]
9463#[cfg(target_os = "fuchsia")]
9464pub struct StallResourceSynchronousProxy {
9465    client: fidl::client::sync::Client,
9466}
9467
9468#[cfg(target_os = "fuchsia")]
9469impl fidl::endpoints::SynchronousProxy for StallResourceSynchronousProxy {
9470    type Proxy = StallResourceProxy;
9471    type Protocol = StallResourceMarker;
9472
9473    fn from_channel(inner: fidl::Channel) -> Self {
9474        Self::new(inner)
9475    }
9476
9477    fn into_channel(self) -> fidl::Channel {
9478        self.client.into_channel()
9479    }
9480
9481    fn as_channel(&self) -> &fidl::Channel {
9482        self.client.as_channel()
9483    }
9484}
9485
9486#[cfg(target_os = "fuchsia")]
9487impl StallResourceSynchronousProxy {
9488    pub fn new(channel: fidl::Channel) -> Self {
9489        Self { client: fidl::client::sync::Client::new(channel) }
9490    }
9491
9492    pub fn into_channel(self) -> fidl::Channel {
9493        self.client.into_channel()
9494    }
9495
9496    /// Waits until an event arrives and returns it. It is safe for other
9497    /// threads to make concurrent requests while waiting for an event.
9498    pub fn wait_for_event(
9499        &self,
9500        deadline: zx::MonotonicInstant,
9501    ) -> Result<StallResourceEvent, fidl::Error> {
9502        StallResourceEvent::decode(self.client.wait_for_event::<StallResourceMarker>(deadline)?)
9503    }
9504
9505    /// Get a stall resource handle.
9506    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
9507        let _response = self.client.send_query::<
9508            fidl::encoding::EmptyPayload,
9509            StallResourceGetResponse,
9510            StallResourceMarker,
9511        >(
9512            (),
9513            0x5edf4c8629a9781a,
9514            fidl::encoding::DynamicFlags::empty(),
9515            ___deadline,
9516        )?;
9517        Ok(_response.resource)
9518    }
9519}
9520
9521#[cfg(target_os = "fuchsia")]
9522impl From<StallResourceSynchronousProxy> for zx::NullableHandle {
9523    fn from(value: StallResourceSynchronousProxy) -> Self {
9524        value.into_channel().into()
9525    }
9526}
9527
9528#[cfg(target_os = "fuchsia")]
9529impl From<fidl::Channel> for StallResourceSynchronousProxy {
9530    fn from(value: fidl::Channel) -> Self {
9531        Self::new(value)
9532    }
9533}
9534
9535#[cfg(target_os = "fuchsia")]
9536impl fidl::endpoints::FromClient for StallResourceSynchronousProxy {
9537    type Protocol = StallResourceMarker;
9538
9539    fn from_client(value: fidl::endpoints::ClientEnd<StallResourceMarker>) -> Self {
9540        Self::new(value.into_channel())
9541    }
9542}
9543
9544#[derive(Debug, Clone)]
9545pub struct StallResourceProxy {
9546    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9547}
9548
9549impl fidl::endpoints::Proxy for StallResourceProxy {
9550    type Protocol = StallResourceMarker;
9551
9552    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9553        Self::new(inner)
9554    }
9555
9556    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9557        self.client.into_channel().map_err(|client| Self { client })
9558    }
9559
9560    fn as_channel(&self) -> &::fidl::AsyncChannel {
9561        self.client.as_channel()
9562    }
9563}
9564
9565impl StallResourceProxy {
9566    /// Create a new Proxy for fuchsia.kernel/StallResource.
9567    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9568        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9569        Self { client: fidl::client::Client::new(channel, protocol_name) }
9570    }
9571
9572    /// Get a Stream of events from the remote end of the protocol.
9573    ///
9574    /// # Panics
9575    ///
9576    /// Panics if the event stream was already taken.
9577    pub fn take_event_stream(&self) -> StallResourceEventStream {
9578        StallResourceEventStream { event_receiver: self.client.take_event_receiver() }
9579    }
9580
9581    /// Get a stall resource handle.
9582    pub fn r#get(
9583        &self,
9584    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9585    {
9586        StallResourceProxyInterface::r#get(self)
9587    }
9588}
9589
9590impl StallResourceProxyInterface for StallResourceProxy {
9591    type GetResponseFut = fidl::client::QueryResponseFut<
9592        fidl::Resource,
9593        fidl::encoding::DefaultFuchsiaResourceDialect,
9594    >;
9595    fn r#get(&self) -> Self::GetResponseFut {
9596        fn _decode(
9597            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9598        ) -> Result<fidl::Resource, fidl::Error> {
9599            let _response = fidl::client::decode_transaction_body::<
9600                StallResourceGetResponse,
9601                fidl::encoding::DefaultFuchsiaResourceDialect,
9602                0x5edf4c8629a9781a,
9603            >(_buf?)?;
9604            Ok(_response.resource)
9605        }
9606        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9607            (),
9608            0x5edf4c8629a9781a,
9609            fidl::encoding::DynamicFlags::empty(),
9610            _decode,
9611        )
9612    }
9613}
9614
9615pub struct StallResourceEventStream {
9616    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9617}
9618
9619impl std::marker::Unpin for StallResourceEventStream {}
9620
9621impl futures::stream::FusedStream for StallResourceEventStream {
9622    fn is_terminated(&self) -> bool {
9623        self.event_receiver.is_terminated()
9624    }
9625}
9626
9627impl futures::Stream for StallResourceEventStream {
9628    type Item = Result<StallResourceEvent, fidl::Error>;
9629
9630    fn poll_next(
9631        mut self: std::pin::Pin<&mut Self>,
9632        cx: &mut std::task::Context<'_>,
9633    ) -> std::task::Poll<Option<Self::Item>> {
9634        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9635            &mut self.event_receiver,
9636            cx
9637        )?) {
9638            Some(buf) => std::task::Poll::Ready(Some(StallResourceEvent::decode(buf))),
9639            None => std::task::Poll::Ready(None),
9640        }
9641    }
9642}
9643
9644#[derive(Debug)]
9645pub enum StallResourceEvent {}
9646
9647impl StallResourceEvent {
9648    /// Decodes a message buffer as a [`StallResourceEvent`].
9649    fn decode(
9650        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9651    ) -> Result<StallResourceEvent, fidl::Error> {
9652        let (bytes, _handles) = buf.split_mut();
9653        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9654        debug_assert_eq!(tx_header.tx_id, 0);
9655        match tx_header.ordinal {
9656            _ => Err(fidl::Error::UnknownOrdinal {
9657                ordinal: tx_header.ordinal,
9658                protocol_name: <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9659            }),
9660        }
9661    }
9662}
9663
9664/// A Stream of incoming requests for fuchsia.kernel/StallResource.
9665pub struct StallResourceRequestStream {
9666    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9667    is_terminated: bool,
9668}
9669
9670impl std::marker::Unpin for StallResourceRequestStream {}
9671
9672impl futures::stream::FusedStream for StallResourceRequestStream {
9673    fn is_terminated(&self) -> bool {
9674        self.is_terminated
9675    }
9676}
9677
9678impl fidl::endpoints::RequestStream for StallResourceRequestStream {
9679    type Protocol = StallResourceMarker;
9680    type ControlHandle = StallResourceControlHandle;
9681
9682    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9683        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9684    }
9685
9686    fn control_handle(&self) -> Self::ControlHandle {
9687        StallResourceControlHandle { inner: self.inner.clone() }
9688    }
9689
9690    fn into_inner(
9691        self,
9692    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9693    {
9694        (self.inner, self.is_terminated)
9695    }
9696
9697    fn from_inner(
9698        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9699        is_terminated: bool,
9700    ) -> Self {
9701        Self { inner, is_terminated }
9702    }
9703}
9704
9705impl futures::Stream for StallResourceRequestStream {
9706    type Item = Result<StallResourceRequest, fidl::Error>;
9707
9708    fn poll_next(
9709        mut self: std::pin::Pin<&mut Self>,
9710        cx: &mut std::task::Context<'_>,
9711    ) -> std::task::Poll<Option<Self::Item>> {
9712        let this = &mut *self;
9713        if this.inner.check_shutdown(cx) {
9714            this.is_terminated = true;
9715            return std::task::Poll::Ready(None);
9716        }
9717        if this.is_terminated {
9718            panic!("polled StallResourceRequestStream after completion");
9719        }
9720        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9721            |bytes, handles| {
9722                match this.inner.channel().read_etc(cx, bytes, handles) {
9723                    std::task::Poll::Ready(Ok(())) => {}
9724                    std::task::Poll::Pending => return std::task::Poll::Pending,
9725                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9726                        this.is_terminated = true;
9727                        return std::task::Poll::Ready(None);
9728                    }
9729                    std::task::Poll::Ready(Err(e)) => {
9730                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9731                            e.into(),
9732                        ))));
9733                    }
9734                }
9735
9736                // A message has been received from the channel
9737                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9738
9739                std::task::Poll::Ready(Some(match header.ordinal {
9740                    0x5edf4c8629a9781a => {
9741                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9742                        let mut req = fidl::new_empty!(
9743                            fidl::encoding::EmptyPayload,
9744                            fidl::encoding::DefaultFuchsiaResourceDialect
9745                        );
9746                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9747                        let control_handle =
9748                            StallResourceControlHandle { inner: this.inner.clone() };
9749                        Ok(StallResourceRequest::Get {
9750                            responder: StallResourceGetResponder {
9751                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9752                                tx_id: header.tx_id,
9753                            },
9754                        })
9755                    }
9756                    _ => Err(fidl::Error::UnknownOrdinal {
9757                        ordinal: header.ordinal,
9758                        protocol_name:
9759                            <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9760                    }),
9761                }))
9762            },
9763        )
9764    }
9765}
9766
9767/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
9768/// `ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
9769/// be notified of stalls.
9770#[derive(Debug)]
9771pub enum StallResourceRequest {
9772    /// Get a stall resource handle.
9773    Get { responder: StallResourceGetResponder },
9774}
9775
9776impl StallResourceRequest {
9777    #[allow(irrefutable_let_patterns)]
9778    pub fn into_get(self) -> Option<(StallResourceGetResponder)> {
9779        if let StallResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9780    }
9781
9782    /// Name of the method defined in FIDL
9783    pub fn method_name(&self) -> &'static str {
9784        match *self {
9785            StallResourceRequest::Get { .. } => "get",
9786        }
9787    }
9788}
9789
9790#[derive(Debug, Clone)]
9791pub struct StallResourceControlHandle {
9792    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9793}
9794
9795impl StallResourceControlHandle {
9796    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9797        self.inner.shutdown_with_epitaph(status.into())
9798    }
9799}
9800
9801impl fidl::endpoints::ControlHandle for StallResourceControlHandle {
9802    fn shutdown(&self) {
9803        self.inner.shutdown()
9804    }
9805
9806    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9807        self.inner.shutdown_with_epitaph(status)
9808    }
9809
9810    fn is_closed(&self) -> bool {
9811        self.inner.channel().is_closed()
9812    }
9813    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9814        self.inner.channel().on_closed()
9815    }
9816
9817    #[cfg(target_os = "fuchsia")]
9818    fn signal_peer(
9819        &self,
9820        clear_mask: zx::Signals,
9821        set_mask: zx::Signals,
9822    ) -> Result<(), zx_status::Status> {
9823        use fidl::Peered;
9824        self.inner.channel().signal_peer(clear_mask, set_mask)
9825    }
9826}
9827
9828impl StallResourceControlHandle {}
9829
9830#[must_use = "FIDL methods require a response to be sent"]
9831#[derive(Debug)]
9832pub struct StallResourceGetResponder {
9833    control_handle: std::mem::ManuallyDrop<StallResourceControlHandle>,
9834    tx_id: u32,
9835}
9836
9837/// Set the the channel to be shutdown (see [`StallResourceControlHandle::shutdown`])
9838/// if the responder is dropped without sending a response, so that the client
9839/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9840impl std::ops::Drop for StallResourceGetResponder {
9841    fn drop(&mut self) {
9842        self.control_handle.shutdown();
9843        // Safety: drops once, never accessed again
9844        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9845    }
9846}
9847
9848impl fidl::endpoints::Responder for StallResourceGetResponder {
9849    type ControlHandle = StallResourceControlHandle;
9850
9851    fn control_handle(&self) -> &StallResourceControlHandle {
9852        &self.control_handle
9853    }
9854
9855    fn drop_without_shutdown(mut self) {
9856        // Safety: drops once, never accessed again due to mem::forget
9857        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9858        // Prevent Drop from running (which would shut down the channel)
9859        std::mem::forget(self);
9860    }
9861}
9862
9863impl StallResourceGetResponder {
9864    /// Sends a response to the FIDL transaction.
9865    ///
9866    /// Sets the channel to shutdown if an error occurs.
9867    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9868        let _result = self.send_raw(resource);
9869        if _result.is_err() {
9870            self.control_handle.shutdown();
9871        }
9872        self.drop_without_shutdown();
9873        _result
9874    }
9875
9876    /// Similar to "send" but does not shutdown the channel if an error occurs.
9877    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9878        let _result = self.send_raw(resource);
9879        self.drop_without_shutdown();
9880        _result
9881    }
9882
9883    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9884        self.control_handle.inner.send::<StallResourceGetResponse>(
9885            (resource,),
9886            self.tx_id,
9887            0x5edf4c8629a9781a,
9888            fidl::encoding::DynamicFlags::empty(),
9889        )
9890    }
9891}
9892
9893#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9894pub struct StatsMarker;
9895
9896impl fidl::endpoints::ProtocolMarker for StatsMarker {
9897    type Proxy = StatsProxy;
9898    type RequestStream = StatsRequestStream;
9899    #[cfg(target_os = "fuchsia")]
9900    type SynchronousProxy = StatsSynchronousProxy;
9901
9902    const DEBUG_NAME: &'static str = "fuchsia.kernel.Stats";
9903}
9904impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
9905
9906pub trait StatsProxyInterface: Send + Sync {
9907    type GetMemoryStatsResponseFut: std::future::Future<Output = Result<MemoryStats, fidl::Error>>
9908        + Send;
9909    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut;
9910    type GetMemoryStatsExtendedResponseFut: std::future::Future<Output = Result<MemoryStatsExtended, fidl::Error>>
9911        + Send;
9912    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut;
9913    type GetMemoryStatsCompressionResponseFut: std::future::Future<Output = Result<MemoryStatsCompression, fidl::Error>>
9914        + Send;
9915    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut;
9916    type GetCpuStatsResponseFut: std::future::Future<Output = Result<CpuStats, fidl::Error>> + Send;
9917    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut;
9918    type GetCpuLoadResponseFut: std::future::Future<Output = Result<Vec<f32>, fidl::Error>> + Send;
9919    fn r#get_cpu_load(&self, duration: i64) -> Self::GetCpuLoadResponseFut;
9920}
9921#[derive(Debug)]
9922#[cfg(target_os = "fuchsia")]
9923pub struct StatsSynchronousProxy {
9924    client: fidl::client::sync::Client,
9925}
9926
9927#[cfg(target_os = "fuchsia")]
9928impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
9929    type Proxy = StatsProxy;
9930    type Protocol = StatsMarker;
9931
9932    fn from_channel(inner: fidl::Channel) -> Self {
9933        Self::new(inner)
9934    }
9935
9936    fn into_channel(self) -> fidl::Channel {
9937        self.client.into_channel()
9938    }
9939
9940    fn as_channel(&self) -> &fidl::Channel {
9941        self.client.as_channel()
9942    }
9943}
9944
9945#[cfg(target_os = "fuchsia")]
9946impl StatsSynchronousProxy {
9947    pub fn new(channel: fidl::Channel) -> Self {
9948        Self { client: fidl::client::sync::Client::new(channel) }
9949    }
9950
9951    pub fn into_channel(self) -> fidl::Channel {
9952        self.client.into_channel()
9953    }
9954
9955    /// Waits until an event arrives and returns it. It is safe for other
9956    /// threads to make concurrent requests while waiting for an event.
9957    pub fn wait_for_event(
9958        &self,
9959        deadline: zx::MonotonicInstant,
9960    ) -> Result<StatsEvent, fidl::Error> {
9961        StatsEvent::decode(self.client.wait_for_event::<StatsMarker>(deadline)?)
9962    }
9963
9964    pub fn r#get_memory_stats(
9965        &self,
9966        ___deadline: zx::MonotonicInstant,
9967    ) -> Result<MemoryStats, fidl::Error> {
9968        let _response = self
9969            .client
9970            .send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsResponse, StatsMarker>(
9971                (),
9972                0x686677932ae41074,
9973                fidl::encoding::DynamicFlags::empty(),
9974                ___deadline,
9975            )?;
9976        Ok(_response.stats)
9977    }
9978
9979    pub fn r#get_memory_stats_extended(
9980        &self,
9981        ___deadline: zx::MonotonicInstant,
9982    ) -> Result<MemoryStatsExtended, fidl::Error> {
9983        let _response = self.client.send_query::<
9984            fidl::encoding::EmptyPayload,
9985            StatsGetMemoryStatsExtendedResponse,
9986            StatsMarker,
9987        >(
9988            (),
9989            0x60faa0f8aa38c29f,
9990            fidl::encoding::DynamicFlags::empty(),
9991            ___deadline,
9992        )?;
9993        Ok(_response.stats)
9994    }
9995
9996    pub fn r#get_memory_stats_compression(
9997        &self,
9998        ___deadline: zx::MonotonicInstant,
9999    ) -> Result<MemoryStatsCompression, fidl::Error> {
10000        let _response = self
10001            .client
10002            .send_query::<fidl::encoding::EmptyPayload, MemoryStatsCompression, StatsMarker>(
10003                (),
10004                0x544a09995befb531,
10005                fidl::encoding::DynamicFlags::empty(),
10006                ___deadline,
10007            )?;
10008        Ok(_response)
10009    }
10010
10011    pub fn r#get_cpu_stats(
10012        &self,
10013        ___deadline: zx::MonotonicInstant,
10014    ) -> Result<CpuStats, fidl::Error> {
10015        let _response = self
10016            .client
10017            .send_query::<fidl::encoding::EmptyPayload, StatsGetCpuStatsResponse, StatsMarker>(
10018                (),
10019                0x470e2684ca1ca19e,
10020                fidl::encoding::DynamicFlags::empty(),
10021                ___deadline,
10022            )?;
10023        Ok(_response.stats)
10024    }
10025
10026    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
10027    /// duration.
10028    ///
10029    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
10030    /// PerCpuStats) over a time duration.
10031    pub fn r#get_cpu_load(
10032        &self,
10033        mut duration: i64,
10034        ___deadline: zx::MonotonicInstant,
10035    ) -> Result<Vec<f32>, fidl::Error> {
10036        let _response = self
10037            .client
10038            .send_query::<StatsGetCpuLoadRequest, StatsGetCpuLoadResponse, StatsMarker>(
10039                (duration,),
10040                0x4c8f0f05e7034666,
10041                fidl::encoding::DynamicFlags::empty(),
10042                ___deadline,
10043            )?;
10044        Ok(_response.per_cpu_load)
10045    }
10046}
10047
10048#[cfg(target_os = "fuchsia")]
10049impl From<StatsSynchronousProxy> for zx::NullableHandle {
10050    fn from(value: StatsSynchronousProxy) -> Self {
10051        value.into_channel().into()
10052    }
10053}
10054
10055#[cfg(target_os = "fuchsia")]
10056impl From<fidl::Channel> for StatsSynchronousProxy {
10057    fn from(value: fidl::Channel) -> Self {
10058        Self::new(value)
10059    }
10060}
10061
10062#[cfg(target_os = "fuchsia")]
10063impl fidl::endpoints::FromClient for StatsSynchronousProxy {
10064    type Protocol = StatsMarker;
10065
10066    fn from_client(value: fidl::endpoints::ClientEnd<StatsMarker>) -> Self {
10067        Self::new(value.into_channel())
10068    }
10069}
10070
10071#[derive(Debug, Clone)]
10072pub struct StatsProxy {
10073    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10074}
10075
10076impl fidl::endpoints::Proxy for StatsProxy {
10077    type Protocol = StatsMarker;
10078
10079    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10080        Self::new(inner)
10081    }
10082
10083    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10084        self.client.into_channel().map_err(|client| Self { client })
10085    }
10086
10087    fn as_channel(&self) -> &::fidl::AsyncChannel {
10088        self.client.as_channel()
10089    }
10090}
10091
10092impl StatsProxy {
10093    /// Create a new Proxy for fuchsia.kernel/Stats.
10094    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10095        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10096        Self { client: fidl::client::Client::new(channel, protocol_name) }
10097    }
10098
10099    /// Get a Stream of events from the remote end of the protocol.
10100    ///
10101    /// # Panics
10102    ///
10103    /// Panics if the event stream was already taken.
10104    pub fn take_event_stream(&self) -> StatsEventStream {
10105        StatsEventStream { event_receiver: self.client.take_event_receiver() }
10106    }
10107
10108    pub fn r#get_memory_stats(
10109        &self,
10110    ) -> fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>
10111    {
10112        StatsProxyInterface::r#get_memory_stats(self)
10113    }
10114
10115    pub fn r#get_memory_stats_extended(
10116        &self,
10117    ) -> fidl::client::QueryResponseFut<
10118        MemoryStatsExtended,
10119        fidl::encoding::DefaultFuchsiaResourceDialect,
10120    > {
10121        StatsProxyInterface::r#get_memory_stats_extended(self)
10122    }
10123
10124    pub fn r#get_memory_stats_compression(
10125        &self,
10126    ) -> fidl::client::QueryResponseFut<
10127        MemoryStatsCompression,
10128        fidl::encoding::DefaultFuchsiaResourceDialect,
10129    > {
10130        StatsProxyInterface::r#get_memory_stats_compression(self)
10131    }
10132
10133    pub fn r#get_cpu_stats(
10134        &self,
10135    ) -> fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>
10136    {
10137        StatsProxyInterface::r#get_cpu_stats(self)
10138    }
10139
10140    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
10141    /// duration.
10142    ///
10143    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
10144    /// PerCpuStats) over a time duration.
10145    pub fn r#get_cpu_load(
10146        &self,
10147        mut duration: i64,
10148    ) -> fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>
10149    {
10150        StatsProxyInterface::r#get_cpu_load(self, duration)
10151    }
10152}
10153
10154impl StatsProxyInterface for StatsProxy {
10155    type GetMemoryStatsResponseFut =
10156        fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
10157    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut {
10158        fn _decode(
10159            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10160        ) -> Result<MemoryStats, fidl::Error> {
10161            let _response = fidl::client::decode_transaction_body::<
10162                StatsGetMemoryStatsResponse,
10163                fidl::encoding::DefaultFuchsiaResourceDialect,
10164                0x686677932ae41074,
10165            >(_buf?)?;
10166            Ok(_response.stats)
10167        }
10168        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStats>(
10169            (),
10170            0x686677932ae41074,
10171            fidl::encoding::DynamicFlags::empty(),
10172            _decode,
10173        )
10174    }
10175
10176    type GetMemoryStatsExtendedResponseFut = fidl::client::QueryResponseFut<
10177        MemoryStatsExtended,
10178        fidl::encoding::DefaultFuchsiaResourceDialect,
10179    >;
10180    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut {
10181        fn _decode(
10182            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10183        ) -> Result<MemoryStatsExtended, fidl::Error> {
10184            let _response = fidl::client::decode_transaction_body::<
10185                StatsGetMemoryStatsExtendedResponse,
10186                fidl::encoding::DefaultFuchsiaResourceDialect,
10187                0x60faa0f8aa38c29f,
10188            >(_buf?)?;
10189            Ok(_response.stats)
10190        }
10191        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsExtended>(
10192            (),
10193            0x60faa0f8aa38c29f,
10194            fidl::encoding::DynamicFlags::empty(),
10195            _decode,
10196        )
10197    }
10198
10199    type GetMemoryStatsCompressionResponseFut = fidl::client::QueryResponseFut<
10200        MemoryStatsCompression,
10201        fidl::encoding::DefaultFuchsiaResourceDialect,
10202    >;
10203    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut {
10204        fn _decode(
10205            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10206        ) -> Result<MemoryStatsCompression, fidl::Error> {
10207            let _response = fidl::client::decode_transaction_body::<
10208                MemoryStatsCompression,
10209                fidl::encoding::DefaultFuchsiaResourceDialect,
10210                0x544a09995befb531,
10211            >(_buf?)?;
10212            Ok(_response)
10213        }
10214        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
10215            (),
10216            0x544a09995befb531,
10217            fidl::encoding::DynamicFlags::empty(),
10218            _decode,
10219        )
10220    }
10221
10222    type GetCpuStatsResponseFut =
10223        fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
10224    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut {
10225        fn _decode(
10226            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10227        ) -> Result<CpuStats, fidl::Error> {
10228            let _response = fidl::client::decode_transaction_body::<
10229                StatsGetCpuStatsResponse,
10230                fidl::encoding::DefaultFuchsiaResourceDialect,
10231                0x470e2684ca1ca19e,
10232            >(_buf?)?;
10233            Ok(_response.stats)
10234        }
10235        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CpuStats>(
10236            (),
10237            0x470e2684ca1ca19e,
10238            fidl::encoding::DynamicFlags::empty(),
10239            _decode,
10240        )
10241    }
10242
10243    type GetCpuLoadResponseFut =
10244        fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>;
10245    fn r#get_cpu_load(&self, mut duration: i64) -> Self::GetCpuLoadResponseFut {
10246        fn _decode(
10247            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10248        ) -> Result<Vec<f32>, fidl::Error> {
10249            let _response = fidl::client::decode_transaction_body::<
10250                StatsGetCpuLoadResponse,
10251                fidl::encoding::DefaultFuchsiaResourceDialect,
10252                0x4c8f0f05e7034666,
10253            >(_buf?)?;
10254            Ok(_response.per_cpu_load)
10255        }
10256        self.client.send_query_and_decode::<StatsGetCpuLoadRequest, Vec<f32>>(
10257            (duration,),
10258            0x4c8f0f05e7034666,
10259            fidl::encoding::DynamicFlags::empty(),
10260            _decode,
10261        )
10262    }
10263}
10264
10265pub struct StatsEventStream {
10266    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10267}
10268
10269impl std::marker::Unpin for StatsEventStream {}
10270
10271impl futures::stream::FusedStream for StatsEventStream {
10272    fn is_terminated(&self) -> bool {
10273        self.event_receiver.is_terminated()
10274    }
10275}
10276
10277impl futures::Stream for StatsEventStream {
10278    type Item = Result<StatsEvent, fidl::Error>;
10279
10280    fn poll_next(
10281        mut self: std::pin::Pin<&mut Self>,
10282        cx: &mut std::task::Context<'_>,
10283    ) -> std::task::Poll<Option<Self::Item>> {
10284        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10285            &mut self.event_receiver,
10286            cx
10287        )?) {
10288            Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
10289            None => std::task::Poll::Ready(None),
10290        }
10291    }
10292}
10293
10294#[derive(Debug)]
10295pub enum StatsEvent {}
10296
10297impl StatsEvent {
10298    /// Decodes a message buffer as a [`StatsEvent`].
10299    fn decode(
10300        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10301    ) -> Result<StatsEvent, fidl::Error> {
10302        let (bytes, _handles) = buf.split_mut();
10303        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10304        debug_assert_eq!(tx_header.tx_id, 0);
10305        match tx_header.ordinal {
10306            _ => Err(fidl::Error::UnknownOrdinal {
10307                ordinal: tx_header.ordinal,
10308                protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10309            }),
10310        }
10311    }
10312}
10313
10314/// A Stream of incoming requests for fuchsia.kernel/Stats.
10315pub struct StatsRequestStream {
10316    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10317    is_terminated: bool,
10318}
10319
10320impl std::marker::Unpin for StatsRequestStream {}
10321
10322impl futures::stream::FusedStream for StatsRequestStream {
10323    fn is_terminated(&self) -> bool {
10324        self.is_terminated
10325    }
10326}
10327
10328impl fidl::endpoints::RequestStream for StatsRequestStream {
10329    type Protocol = StatsMarker;
10330    type ControlHandle = StatsControlHandle;
10331
10332    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10333        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10334    }
10335
10336    fn control_handle(&self) -> Self::ControlHandle {
10337        StatsControlHandle { inner: self.inner.clone() }
10338    }
10339
10340    fn into_inner(
10341        self,
10342    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10343    {
10344        (self.inner, self.is_terminated)
10345    }
10346
10347    fn from_inner(
10348        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10349        is_terminated: bool,
10350    ) -> Self {
10351        Self { inner, is_terminated }
10352    }
10353}
10354
10355impl futures::Stream for StatsRequestStream {
10356    type Item = Result<StatsRequest, fidl::Error>;
10357
10358    fn poll_next(
10359        mut self: std::pin::Pin<&mut Self>,
10360        cx: &mut std::task::Context<'_>,
10361    ) -> std::task::Poll<Option<Self::Item>> {
10362        let this = &mut *self;
10363        if this.inner.check_shutdown(cx) {
10364            this.is_terminated = true;
10365            return std::task::Poll::Ready(None);
10366        }
10367        if this.is_terminated {
10368            panic!("polled StatsRequestStream after completion");
10369        }
10370        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10371            |bytes, handles| {
10372                match this.inner.channel().read_etc(cx, bytes, handles) {
10373                    std::task::Poll::Ready(Ok(())) => {}
10374                    std::task::Poll::Pending => return std::task::Poll::Pending,
10375                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10376                        this.is_terminated = true;
10377                        return std::task::Poll::Ready(None);
10378                    }
10379                    std::task::Poll::Ready(Err(e)) => {
10380                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10381                            e.into(),
10382                        ))));
10383                    }
10384                }
10385
10386                // A message has been received from the channel
10387                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10388
10389                std::task::Poll::Ready(Some(match header.ordinal {
10390                    0x686677932ae41074 => {
10391                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10392                        let mut req = fidl::new_empty!(
10393                            fidl::encoding::EmptyPayload,
10394                            fidl::encoding::DefaultFuchsiaResourceDialect
10395                        );
10396                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10397                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10398                        Ok(StatsRequest::GetMemoryStats {
10399                            responder: StatsGetMemoryStatsResponder {
10400                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10401                                tx_id: header.tx_id,
10402                            },
10403                        })
10404                    }
10405                    0x60faa0f8aa38c29f => {
10406                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10407                        let mut req = fidl::new_empty!(
10408                            fidl::encoding::EmptyPayload,
10409                            fidl::encoding::DefaultFuchsiaResourceDialect
10410                        );
10411                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10412                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10413                        Ok(StatsRequest::GetMemoryStatsExtended {
10414                            responder: StatsGetMemoryStatsExtendedResponder {
10415                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10416                                tx_id: header.tx_id,
10417                            },
10418                        })
10419                    }
10420                    0x544a09995befb531 => {
10421                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10422                        let mut req = fidl::new_empty!(
10423                            fidl::encoding::EmptyPayload,
10424                            fidl::encoding::DefaultFuchsiaResourceDialect
10425                        );
10426                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10427                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10428                        Ok(StatsRequest::GetMemoryStatsCompression {
10429                            responder: StatsGetMemoryStatsCompressionResponder {
10430                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10431                                tx_id: header.tx_id,
10432                            },
10433                        })
10434                    }
10435                    0x470e2684ca1ca19e => {
10436                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10437                        let mut req = fidl::new_empty!(
10438                            fidl::encoding::EmptyPayload,
10439                            fidl::encoding::DefaultFuchsiaResourceDialect
10440                        );
10441                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10442                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10443                        Ok(StatsRequest::GetCpuStats {
10444                            responder: StatsGetCpuStatsResponder {
10445                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10446                                tx_id: header.tx_id,
10447                            },
10448                        })
10449                    }
10450                    0x4c8f0f05e7034666 => {
10451                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10452                        let mut req = fidl::new_empty!(
10453                            StatsGetCpuLoadRequest,
10454                            fidl::encoding::DefaultFuchsiaResourceDialect
10455                        );
10456                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatsGetCpuLoadRequest>(&header, _body_bytes, handles, &mut req)?;
10457                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10458                        Ok(StatsRequest::GetCpuLoad {
10459                            duration: req.duration,
10460
10461                            responder: StatsGetCpuLoadResponder {
10462                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10463                                tx_id: header.tx_id,
10464                            },
10465                        })
10466                    }
10467                    _ => Err(fidl::Error::UnknownOrdinal {
10468                        ordinal: header.ordinal,
10469                        protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10470                    }),
10471                }))
10472            },
10473        )
10474    }
10475}
10476
10477/// Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
10478/// the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
10479/// 'Root Resource' capability to obtain. Instead of vending out that capability, programs that
10480/// just want stats should use this service instead. If for some reason the protocol fails to
10481/// retrieve stats, which will be an un-recoverable error, it will close the channel.
10482#[derive(Debug)]
10483pub enum StatsRequest {
10484    GetMemoryStats {
10485        responder: StatsGetMemoryStatsResponder,
10486    },
10487    GetMemoryStatsExtended {
10488        responder: StatsGetMemoryStatsExtendedResponder,
10489    },
10490    GetMemoryStatsCompression {
10491        responder: StatsGetMemoryStatsCompressionResponder,
10492    },
10493    GetCpuStats {
10494        responder: StatsGetCpuStatsResponder,
10495    },
10496    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
10497    /// duration.
10498    ///
10499    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
10500    /// PerCpuStats) over a time duration.
10501    GetCpuLoad {
10502        duration: i64,
10503        responder: StatsGetCpuLoadResponder,
10504    },
10505}
10506
10507impl StatsRequest {
10508    #[allow(irrefutable_let_patterns)]
10509    pub fn into_get_memory_stats(self) -> Option<(StatsGetMemoryStatsResponder)> {
10510        if let StatsRequest::GetMemoryStats { responder } = self { Some((responder)) } else { None }
10511    }
10512
10513    #[allow(irrefutable_let_patterns)]
10514    pub fn into_get_memory_stats_extended(self) -> Option<(StatsGetMemoryStatsExtendedResponder)> {
10515        if let StatsRequest::GetMemoryStatsExtended { responder } = self {
10516            Some((responder))
10517        } else {
10518            None
10519        }
10520    }
10521
10522    #[allow(irrefutable_let_patterns)]
10523    pub fn into_get_memory_stats_compression(
10524        self,
10525    ) -> Option<(StatsGetMemoryStatsCompressionResponder)> {
10526        if let StatsRequest::GetMemoryStatsCompression { responder } = self {
10527            Some((responder))
10528        } else {
10529            None
10530        }
10531    }
10532
10533    #[allow(irrefutable_let_patterns)]
10534    pub fn into_get_cpu_stats(self) -> Option<(StatsGetCpuStatsResponder)> {
10535        if let StatsRequest::GetCpuStats { responder } = self { Some((responder)) } else { None }
10536    }
10537
10538    #[allow(irrefutable_let_patterns)]
10539    pub fn into_get_cpu_load(self) -> Option<(i64, StatsGetCpuLoadResponder)> {
10540        if let StatsRequest::GetCpuLoad { duration, responder } = self {
10541            Some((duration, responder))
10542        } else {
10543            None
10544        }
10545    }
10546
10547    /// Name of the method defined in FIDL
10548    pub fn method_name(&self) -> &'static str {
10549        match *self {
10550            StatsRequest::GetMemoryStats { .. } => "get_memory_stats",
10551            StatsRequest::GetMemoryStatsExtended { .. } => "get_memory_stats_extended",
10552            StatsRequest::GetMemoryStatsCompression { .. } => "get_memory_stats_compression",
10553            StatsRequest::GetCpuStats { .. } => "get_cpu_stats",
10554            StatsRequest::GetCpuLoad { .. } => "get_cpu_load",
10555        }
10556    }
10557}
10558
10559#[derive(Debug, Clone)]
10560pub struct StatsControlHandle {
10561    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10562}
10563
10564impl StatsControlHandle {
10565    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10566        self.inner.shutdown_with_epitaph(status.into())
10567    }
10568}
10569
10570impl fidl::endpoints::ControlHandle for StatsControlHandle {
10571    fn shutdown(&self) {
10572        self.inner.shutdown()
10573    }
10574
10575    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10576        self.inner.shutdown_with_epitaph(status)
10577    }
10578
10579    fn is_closed(&self) -> bool {
10580        self.inner.channel().is_closed()
10581    }
10582    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10583        self.inner.channel().on_closed()
10584    }
10585
10586    #[cfg(target_os = "fuchsia")]
10587    fn signal_peer(
10588        &self,
10589        clear_mask: zx::Signals,
10590        set_mask: zx::Signals,
10591    ) -> Result<(), zx_status::Status> {
10592        use fidl::Peered;
10593        self.inner.channel().signal_peer(clear_mask, set_mask)
10594    }
10595}
10596
10597impl StatsControlHandle {}
10598
10599#[must_use = "FIDL methods require a response to be sent"]
10600#[derive(Debug)]
10601pub struct StatsGetMemoryStatsResponder {
10602    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10603    tx_id: u32,
10604}
10605
10606/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10607/// if the responder is dropped without sending a response, so that the client
10608/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10609impl std::ops::Drop for StatsGetMemoryStatsResponder {
10610    fn drop(&mut self) {
10611        self.control_handle.shutdown();
10612        // Safety: drops once, never accessed again
10613        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10614    }
10615}
10616
10617impl fidl::endpoints::Responder for StatsGetMemoryStatsResponder {
10618    type ControlHandle = StatsControlHandle;
10619
10620    fn control_handle(&self) -> &StatsControlHandle {
10621        &self.control_handle
10622    }
10623
10624    fn drop_without_shutdown(mut self) {
10625        // Safety: drops once, never accessed again due to mem::forget
10626        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10627        // Prevent Drop from running (which would shut down the channel)
10628        std::mem::forget(self);
10629    }
10630}
10631
10632impl StatsGetMemoryStatsResponder {
10633    /// Sends a response to the FIDL transaction.
10634    ///
10635    /// Sets the channel to shutdown if an error occurs.
10636    pub fn send(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10637        let _result = self.send_raw(stats);
10638        if _result.is_err() {
10639            self.control_handle.shutdown();
10640        }
10641        self.drop_without_shutdown();
10642        _result
10643    }
10644
10645    /// Similar to "send" but does not shutdown the channel if an error occurs.
10646    pub fn send_no_shutdown_on_err(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10647        let _result = self.send_raw(stats);
10648        self.drop_without_shutdown();
10649        _result
10650    }
10651
10652    fn send_raw(&self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10653        self.control_handle.inner.send::<StatsGetMemoryStatsResponse>(
10654            (stats,),
10655            self.tx_id,
10656            0x686677932ae41074,
10657            fidl::encoding::DynamicFlags::empty(),
10658        )
10659    }
10660}
10661
10662#[must_use = "FIDL methods require a response to be sent"]
10663#[derive(Debug)]
10664pub struct StatsGetMemoryStatsExtendedResponder {
10665    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10666    tx_id: u32,
10667}
10668
10669/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10670/// if the responder is dropped without sending a response, so that the client
10671/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10672impl std::ops::Drop for StatsGetMemoryStatsExtendedResponder {
10673    fn drop(&mut self) {
10674        self.control_handle.shutdown();
10675        // Safety: drops once, never accessed again
10676        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10677    }
10678}
10679
10680impl fidl::endpoints::Responder for StatsGetMemoryStatsExtendedResponder {
10681    type ControlHandle = StatsControlHandle;
10682
10683    fn control_handle(&self) -> &StatsControlHandle {
10684        &self.control_handle
10685    }
10686
10687    fn drop_without_shutdown(mut self) {
10688        // Safety: drops once, never accessed again due to mem::forget
10689        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10690        // Prevent Drop from running (which would shut down the channel)
10691        std::mem::forget(self);
10692    }
10693}
10694
10695impl StatsGetMemoryStatsExtendedResponder {
10696    /// Sends a response to the FIDL transaction.
10697    ///
10698    /// Sets the channel to shutdown if an error occurs.
10699    pub fn send(self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10700        let _result = self.send_raw(stats);
10701        if _result.is_err() {
10702            self.control_handle.shutdown();
10703        }
10704        self.drop_without_shutdown();
10705        _result
10706    }
10707
10708    /// Similar to "send" but does not shutdown the channel if an error occurs.
10709    pub fn send_no_shutdown_on_err(
10710        self,
10711        mut stats: &MemoryStatsExtended,
10712    ) -> Result<(), fidl::Error> {
10713        let _result = self.send_raw(stats);
10714        self.drop_without_shutdown();
10715        _result
10716    }
10717
10718    fn send_raw(&self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10719        self.control_handle.inner.send::<StatsGetMemoryStatsExtendedResponse>(
10720            (stats,),
10721            self.tx_id,
10722            0x60faa0f8aa38c29f,
10723            fidl::encoding::DynamicFlags::empty(),
10724        )
10725    }
10726}
10727
10728#[must_use = "FIDL methods require a response to be sent"]
10729#[derive(Debug)]
10730pub struct StatsGetMemoryStatsCompressionResponder {
10731    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10732    tx_id: u32,
10733}
10734
10735/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10736/// if the responder is dropped without sending a response, so that the client
10737/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10738impl std::ops::Drop for StatsGetMemoryStatsCompressionResponder {
10739    fn drop(&mut self) {
10740        self.control_handle.shutdown();
10741        // Safety: drops once, never accessed again
10742        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10743    }
10744}
10745
10746impl fidl::endpoints::Responder for StatsGetMemoryStatsCompressionResponder {
10747    type ControlHandle = StatsControlHandle;
10748
10749    fn control_handle(&self) -> &StatsControlHandle {
10750        &self.control_handle
10751    }
10752
10753    fn drop_without_shutdown(mut self) {
10754        // Safety: drops once, never accessed again due to mem::forget
10755        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10756        // Prevent Drop from running (which would shut down the channel)
10757        std::mem::forget(self);
10758    }
10759}
10760
10761impl StatsGetMemoryStatsCompressionResponder {
10762    /// Sends a response to the FIDL transaction.
10763    ///
10764    /// Sets the channel to shutdown if an error occurs.
10765    pub fn send(self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10766        let _result = self.send_raw(payload);
10767        if _result.is_err() {
10768            self.control_handle.shutdown();
10769        }
10770        self.drop_without_shutdown();
10771        _result
10772    }
10773
10774    /// Similar to "send" but does not shutdown the channel if an error occurs.
10775    pub fn send_no_shutdown_on_err(
10776        self,
10777        mut payload: &MemoryStatsCompression,
10778    ) -> Result<(), fidl::Error> {
10779        let _result = self.send_raw(payload);
10780        self.drop_without_shutdown();
10781        _result
10782    }
10783
10784    fn send_raw(&self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10785        self.control_handle.inner.send::<MemoryStatsCompression>(
10786            payload,
10787            self.tx_id,
10788            0x544a09995befb531,
10789            fidl::encoding::DynamicFlags::empty(),
10790        )
10791    }
10792}
10793
10794#[must_use = "FIDL methods require a response to be sent"]
10795#[derive(Debug)]
10796pub struct StatsGetCpuStatsResponder {
10797    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10798    tx_id: u32,
10799}
10800
10801/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10802/// if the responder is dropped without sending a response, so that the client
10803/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10804impl std::ops::Drop for StatsGetCpuStatsResponder {
10805    fn drop(&mut self) {
10806        self.control_handle.shutdown();
10807        // Safety: drops once, never accessed again
10808        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10809    }
10810}
10811
10812impl fidl::endpoints::Responder for StatsGetCpuStatsResponder {
10813    type ControlHandle = StatsControlHandle;
10814
10815    fn control_handle(&self) -> &StatsControlHandle {
10816        &self.control_handle
10817    }
10818
10819    fn drop_without_shutdown(mut self) {
10820        // Safety: drops once, never accessed again due to mem::forget
10821        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10822        // Prevent Drop from running (which would shut down the channel)
10823        std::mem::forget(self);
10824    }
10825}
10826
10827impl StatsGetCpuStatsResponder {
10828    /// Sends a response to the FIDL transaction.
10829    ///
10830    /// Sets the channel to shutdown if an error occurs.
10831    pub fn send(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10832        let _result = self.send_raw(stats);
10833        if _result.is_err() {
10834            self.control_handle.shutdown();
10835        }
10836        self.drop_without_shutdown();
10837        _result
10838    }
10839
10840    /// Similar to "send" but does not shutdown the channel if an error occurs.
10841    pub fn send_no_shutdown_on_err(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10842        let _result = self.send_raw(stats);
10843        self.drop_without_shutdown();
10844        _result
10845    }
10846
10847    fn send_raw(&self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10848        self.control_handle.inner.send::<StatsGetCpuStatsResponse>(
10849            (stats,),
10850            self.tx_id,
10851            0x470e2684ca1ca19e,
10852            fidl::encoding::DynamicFlags::empty(),
10853        )
10854    }
10855}
10856
10857#[must_use = "FIDL methods require a response to be sent"]
10858#[derive(Debug)]
10859pub struct StatsGetCpuLoadResponder {
10860    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10861    tx_id: u32,
10862}
10863
10864/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10865/// if the responder is dropped without sending a response, so that the client
10866/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10867impl std::ops::Drop for StatsGetCpuLoadResponder {
10868    fn drop(&mut self) {
10869        self.control_handle.shutdown();
10870        // Safety: drops once, never accessed again
10871        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10872    }
10873}
10874
10875impl fidl::endpoints::Responder for StatsGetCpuLoadResponder {
10876    type ControlHandle = StatsControlHandle;
10877
10878    fn control_handle(&self) -> &StatsControlHandle {
10879        &self.control_handle
10880    }
10881
10882    fn drop_without_shutdown(mut self) {
10883        // Safety: drops once, never accessed again due to mem::forget
10884        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10885        // Prevent Drop from running (which would shut down the channel)
10886        std::mem::forget(self);
10887    }
10888}
10889
10890impl StatsGetCpuLoadResponder {
10891    /// Sends a response to the FIDL transaction.
10892    ///
10893    /// Sets the channel to shutdown if an error occurs.
10894    pub fn send(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10895        let _result = self.send_raw(per_cpu_load);
10896        if _result.is_err() {
10897            self.control_handle.shutdown();
10898        }
10899        self.drop_without_shutdown();
10900        _result
10901    }
10902
10903    /// Similar to "send" but does not shutdown the channel if an error occurs.
10904    pub fn send_no_shutdown_on_err(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10905        let _result = self.send_raw(per_cpu_load);
10906        self.drop_without_shutdown();
10907        _result
10908    }
10909
10910    fn send_raw(&self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10911        self.control_handle.inner.send::<StatsGetCpuLoadResponse>(
10912            (per_cpu_load,),
10913            self.tx_id,
10914            0x4c8f0f05e7034666,
10915            fidl::encoding::DynamicFlags::empty(),
10916        )
10917    }
10918}
10919
10920#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10921pub struct TracingResourceMarker;
10922
10923impl fidl::endpoints::ProtocolMarker for TracingResourceMarker {
10924    type Proxy = TracingResourceProxy;
10925    type RequestStream = TracingResourceRequestStream;
10926    #[cfg(target_os = "fuchsia")]
10927    type SynchronousProxy = TracingResourceSynchronousProxy;
10928
10929    const DEBUG_NAME: &'static str = "fuchsia.kernel.TracingResource";
10930}
10931impl fidl::endpoints::DiscoverableProtocolMarker for TracingResourceMarker {}
10932
10933pub trait TracingResourceProxyInterface: Send + Sync {
10934    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10935    fn r#get(&self) -> Self::GetResponseFut;
10936}
10937#[derive(Debug)]
10938#[cfg(target_os = "fuchsia")]
10939pub struct TracingResourceSynchronousProxy {
10940    client: fidl::client::sync::Client,
10941}
10942
10943#[cfg(target_os = "fuchsia")]
10944impl fidl::endpoints::SynchronousProxy for TracingResourceSynchronousProxy {
10945    type Proxy = TracingResourceProxy;
10946    type Protocol = TracingResourceMarker;
10947
10948    fn from_channel(inner: fidl::Channel) -> Self {
10949        Self::new(inner)
10950    }
10951
10952    fn into_channel(self) -> fidl::Channel {
10953        self.client.into_channel()
10954    }
10955
10956    fn as_channel(&self) -> &fidl::Channel {
10957        self.client.as_channel()
10958    }
10959}
10960
10961#[cfg(target_os = "fuchsia")]
10962impl TracingResourceSynchronousProxy {
10963    pub fn new(channel: fidl::Channel) -> Self {
10964        Self { client: fidl::client::sync::Client::new(channel) }
10965    }
10966
10967    pub fn into_channel(self) -> fidl::Channel {
10968        self.client.into_channel()
10969    }
10970
10971    /// Waits until an event arrives and returns it. It is safe for other
10972    /// threads to make concurrent requests while waiting for an event.
10973    pub fn wait_for_event(
10974        &self,
10975        deadline: zx::MonotonicInstant,
10976    ) -> Result<TracingResourceEvent, fidl::Error> {
10977        TracingResourceEvent::decode(self.client.wait_for_event::<TracingResourceMarker>(deadline)?)
10978    }
10979
10980    /// Get a tracing resource handle.
10981    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10982        let _response = self.client.send_query::<
10983            fidl::encoding::EmptyPayload,
10984            TracingResourceGetResponse,
10985            TracingResourceMarker,
10986        >(
10987            (),
10988            0x299bc179aa54c6aa,
10989            fidl::encoding::DynamicFlags::empty(),
10990            ___deadline,
10991        )?;
10992        Ok(_response.resource)
10993    }
10994}
10995
10996#[cfg(target_os = "fuchsia")]
10997impl From<TracingResourceSynchronousProxy> for zx::NullableHandle {
10998    fn from(value: TracingResourceSynchronousProxy) -> Self {
10999        value.into_channel().into()
11000    }
11001}
11002
11003#[cfg(target_os = "fuchsia")]
11004impl From<fidl::Channel> for TracingResourceSynchronousProxy {
11005    fn from(value: fidl::Channel) -> Self {
11006        Self::new(value)
11007    }
11008}
11009
11010#[cfg(target_os = "fuchsia")]
11011impl fidl::endpoints::FromClient for TracingResourceSynchronousProxy {
11012    type Protocol = TracingResourceMarker;
11013
11014    fn from_client(value: fidl::endpoints::ClientEnd<TracingResourceMarker>) -> Self {
11015        Self::new(value.into_channel())
11016    }
11017}
11018
11019#[derive(Debug, Clone)]
11020pub struct TracingResourceProxy {
11021    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11022}
11023
11024impl fidl::endpoints::Proxy for TracingResourceProxy {
11025    type Protocol = TracingResourceMarker;
11026
11027    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11028        Self::new(inner)
11029    }
11030
11031    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11032        self.client.into_channel().map_err(|client| Self { client })
11033    }
11034
11035    fn as_channel(&self) -> &::fidl::AsyncChannel {
11036        self.client.as_channel()
11037    }
11038}
11039
11040impl TracingResourceProxy {
11041    /// Create a new Proxy for fuchsia.kernel/TracingResource.
11042    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11043        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11044        Self { client: fidl::client::Client::new(channel, protocol_name) }
11045    }
11046
11047    /// Get a Stream of events from the remote end of the protocol.
11048    ///
11049    /// # Panics
11050    ///
11051    /// Panics if the event stream was already taken.
11052    pub fn take_event_stream(&self) -> TracingResourceEventStream {
11053        TracingResourceEventStream { event_receiver: self.client.take_event_receiver() }
11054    }
11055
11056    /// Get a tracing resource handle.
11057    pub fn r#get(
11058        &self,
11059    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
11060    {
11061        TracingResourceProxyInterface::r#get(self)
11062    }
11063}
11064
11065impl TracingResourceProxyInterface for TracingResourceProxy {
11066    type GetResponseFut = fidl::client::QueryResponseFut<
11067        fidl::Resource,
11068        fidl::encoding::DefaultFuchsiaResourceDialect,
11069    >;
11070    fn r#get(&self) -> Self::GetResponseFut {
11071        fn _decode(
11072            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11073        ) -> Result<fidl::Resource, fidl::Error> {
11074            let _response = fidl::client::decode_transaction_body::<
11075                TracingResourceGetResponse,
11076                fidl::encoding::DefaultFuchsiaResourceDialect,
11077                0x299bc179aa54c6aa,
11078            >(_buf?)?;
11079            Ok(_response.resource)
11080        }
11081        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
11082            (),
11083            0x299bc179aa54c6aa,
11084            fidl::encoding::DynamicFlags::empty(),
11085            _decode,
11086        )
11087    }
11088}
11089
11090pub struct TracingResourceEventStream {
11091    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11092}
11093
11094impl std::marker::Unpin for TracingResourceEventStream {}
11095
11096impl futures::stream::FusedStream for TracingResourceEventStream {
11097    fn is_terminated(&self) -> bool {
11098        self.event_receiver.is_terminated()
11099    }
11100}
11101
11102impl futures::Stream for TracingResourceEventStream {
11103    type Item = Result<TracingResourceEvent, fidl::Error>;
11104
11105    fn poll_next(
11106        mut self: std::pin::Pin<&mut Self>,
11107        cx: &mut std::task::Context<'_>,
11108    ) -> std::task::Poll<Option<Self::Item>> {
11109        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11110            &mut self.event_receiver,
11111            cx
11112        )?) {
11113            Some(buf) => std::task::Poll::Ready(Some(TracingResourceEvent::decode(buf))),
11114            None => std::task::Poll::Ready(None),
11115        }
11116    }
11117}
11118
11119#[derive(Debug)]
11120pub enum TracingResourceEvent {}
11121
11122impl TracingResourceEvent {
11123    /// Decodes a message buffer as a [`TracingResourceEvent`].
11124    fn decode(
11125        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11126    ) -> Result<TracingResourceEvent, fidl::Error> {
11127        let (bytes, _handles) = buf.split_mut();
11128        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11129        debug_assert_eq!(tx_header.tx_id, 0);
11130        match tx_header.ordinal {
11131            _ => Err(fidl::Error::UnknownOrdinal {
11132                ordinal: tx_header.ordinal,
11133                protocol_name:
11134                    <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11135            }),
11136        }
11137    }
11138}
11139
11140/// A Stream of incoming requests for fuchsia.kernel/TracingResource.
11141pub struct TracingResourceRequestStream {
11142    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11143    is_terminated: bool,
11144}
11145
11146impl std::marker::Unpin for TracingResourceRequestStream {}
11147
11148impl futures::stream::FusedStream for TracingResourceRequestStream {
11149    fn is_terminated(&self) -> bool {
11150        self.is_terminated
11151    }
11152}
11153
11154impl fidl::endpoints::RequestStream for TracingResourceRequestStream {
11155    type Protocol = TracingResourceMarker;
11156    type ControlHandle = TracingResourceControlHandle;
11157
11158    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11159        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11160    }
11161
11162    fn control_handle(&self) -> Self::ControlHandle {
11163        TracingResourceControlHandle { inner: self.inner.clone() }
11164    }
11165
11166    fn into_inner(
11167        self,
11168    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11169    {
11170        (self.inner, self.is_terminated)
11171    }
11172
11173    fn from_inner(
11174        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11175        is_terminated: bool,
11176    ) -> Self {
11177        Self { inner, is_terminated }
11178    }
11179}
11180
11181impl futures::Stream for TracingResourceRequestStream {
11182    type Item = Result<TracingResourceRequest, fidl::Error>;
11183
11184    fn poll_next(
11185        mut self: std::pin::Pin<&mut Self>,
11186        cx: &mut std::task::Context<'_>,
11187    ) -> std::task::Poll<Option<Self::Item>> {
11188        let this = &mut *self;
11189        if this.inner.check_shutdown(cx) {
11190            this.is_terminated = true;
11191            return std::task::Poll::Ready(None);
11192        }
11193        if this.is_terminated {
11194            panic!("polled TracingResourceRequestStream after completion");
11195        }
11196        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11197            |bytes, handles| {
11198                match this.inner.channel().read_etc(cx, bytes, handles) {
11199                    std::task::Poll::Ready(Ok(())) => {}
11200                    std::task::Poll::Pending => return std::task::Poll::Pending,
11201                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11202                        this.is_terminated = true;
11203                        return std::task::Poll::Ready(None);
11204                    }
11205                    std::task::Poll::Ready(Err(e)) => {
11206                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11207                            e.into(),
11208                        ))));
11209                    }
11210                }
11211
11212                // A message has been received from the channel
11213                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11214
11215                std::task::Poll::Ready(Some(match header.ordinal {
11216                    0x299bc179aa54c6aa => {
11217                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11218                        let mut req = fidl::new_empty!(
11219                            fidl::encoding::EmptyPayload,
11220                            fidl::encoding::DefaultFuchsiaResourceDialect
11221                        );
11222                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11223                        let control_handle =
11224                            TracingResourceControlHandle { inner: this.inner.clone() };
11225                        Ok(TracingResourceRequest::Get {
11226                            responder: TracingResourceGetResponder {
11227                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11228                                tx_id: header.tx_id,
11229                            },
11230                        })
11231                    }
11232                    _ => Err(fidl::Error::UnknownOrdinal {
11233                        ordinal: header.ordinal,
11234                        protocol_name:
11235                            <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11236                    }),
11237                }))
11238            },
11239        )
11240    }
11241}
11242
11243/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11244/// `ZX_RSRC_SYSTEM_TRACING_BASE`.
11245#[derive(Debug)]
11246pub enum TracingResourceRequest {
11247    /// Get a tracing resource handle.
11248    Get { responder: TracingResourceGetResponder },
11249}
11250
11251impl TracingResourceRequest {
11252    #[allow(irrefutable_let_patterns)]
11253    pub fn into_get(self) -> Option<(TracingResourceGetResponder)> {
11254        if let TracingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11255    }
11256
11257    /// Name of the method defined in FIDL
11258    pub fn method_name(&self) -> &'static str {
11259        match *self {
11260            TracingResourceRequest::Get { .. } => "get",
11261        }
11262    }
11263}
11264
11265#[derive(Debug, Clone)]
11266pub struct TracingResourceControlHandle {
11267    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11268}
11269
11270impl TracingResourceControlHandle {
11271    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
11272        self.inner.shutdown_with_epitaph(status.into())
11273    }
11274}
11275
11276impl fidl::endpoints::ControlHandle for TracingResourceControlHandle {
11277    fn shutdown(&self) {
11278        self.inner.shutdown()
11279    }
11280
11281    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11282        self.inner.shutdown_with_epitaph(status)
11283    }
11284
11285    fn is_closed(&self) -> bool {
11286        self.inner.channel().is_closed()
11287    }
11288    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11289        self.inner.channel().on_closed()
11290    }
11291
11292    #[cfg(target_os = "fuchsia")]
11293    fn signal_peer(
11294        &self,
11295        clear_mask: zx::Signals,
11296        set_mask: zx::Signals,
11297    ) -> Result<(), zx_status::Status> {
11298        use fidl::Peered;
11299        self.inner.channel().signal_peer(clear_mask, set_mask)
11300    }
11301}
11302
11303impl TracingResourceControlHandle {}
11304
11305#[must_use = "FIDL methods require a response to be sent"]
11306#[derive(Debug)]
11307pub struct TracingResourceGetResponder {
11308    control_handle: std::mem::ManuallyDrop<TracingResourceControlHandle>,
11309    tx_id: u32,
11310}
11311
11312/// Set the the channel to be shutdown (see [`TracingResourceControlHandle::shutdown`])
11313/// if the responder is dropped without sending a response, so that the client
11314/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11315impl std::ops::Drop for TracingResourceGetResponder {
11316    fn drop(&mut self) {
11317        self.control_handle.shutdown();
11318        // Safety: drops once, never accessed again
11319        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11320    }
11321}
11322
11323impl fidl::endpoints::Responder for TracingResourceGetResponder {
11324    type ControlHandle = TracingResourceControlHandle;
11325
11326    fn control_handle(&self) -> &TracingResourceControlHandle {
11327        &self.control_handle
11328    }
11329
11330    fn drop_without_shutdown(mut self) {
11331        // Safety: drops once, never accessed again due to mem::forget
11332        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11333        // Prevent Drop from running (which would shut down the channel)
11334        std::mem::forget(self);
11335    }
11336}
11337
11338impl TracingResourceGetResponder {
11339    /// Sends a response to the FIDL transaction.
11340    ///
11341    /// Sets the channel to shutdown if an error occurs.
11342    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11343        let _result = self.send_raw(resource);
11344        if _result.is_err() {
11345            self.control_handle.shutdown();
11346        }
11347        self.drop_without_shutdown();
11348        _result
11349    }
11350
11351    /// Similar to "send" but does not shutdown the channel if an error occurs.
11352    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11353        let _result = self.send_raw(resource);
11354        self.drop_without_shutdown();
11355        _result
11356    }
11357
11358    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11359        self.control_handle.inner.send::<TracingResourceGetResponse>(
11360            (resource,),
11361            self.tx_id,
11362            0x299bc179aa54c6aa,
11363            fidl::encoding::DynamicFlags::empty(),
11364        )
11365    }
11366}
11367
11368#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11369pub struct VmexResourceMarker;
11370
11371impl fidl::endpoints::ProtocolMarker for VmexResourceMarker {
11372    type Proxy = VmexResourceProxy;
11373    type RequestStream = VmexResourceRequestStream;
11374    #[cfg(target_os = "fuchsia")]
11375    type SynchronousProxy = VmexResourceSynchronousProxy;
11376
11377    const DEBUG_NAME: &'static str = "fuchsia.kernel.VmexResource";
11378}
11379impl fidl::endpoints::DiscoverableProtocolMarker for VmexResourceMarker {}
11380
11381pub trait VmexResourceProxyInterface: Send + Sync {
11382    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
11383    fn r#get(&self) -> Self::GetResponseFut;
11384}
11385#[derive(Debug)]
11386#[cfg(target_os = "fuchsia")]
11387pub struct VmexResourceSynchronousProxy {
11388    client: fidl::client::sync::Client,
11389}
11390
11391#[cfg(target_os = "fuchsia")]
11392impl fidl::endpoints::SynchronousProxy for VmexResourceSynchronousProxy {
11393    type Proxy = VmexResourceProxy;
11394    type Protocol = VmexResourceMarker;
11395
11396    fn from_channel(inner: fidl::Channel) -> Self {
11397        Self::new(inner)
11398    }
11399
11400    fn into_channel(self) -> fidl::Channel {
11401        self.client.into_channel()
11402    }
11403
11404    fn as_channel(&self) -> &fidl::Channel {
11405        self.client.as_channel()
11406    }
11407}
11408
11409#[cfg(target_os = "fuchsia")]
11410impl VmexResourceSynchronousProxy {
11411    pub fn new(channel: fidl::Channel) -> Self {
11412        Self { client: fidl::client::sync::Client::new(channel) }
11413    }
11414
11415    pub fn into_channel(self) -> fidl::Channel {
11416        self.client.into_channel()
11417    }
11418
11419    /// Waits until an event arrives and returns it. It is safe for other
11420    /// threads to make concurrent requests while waiting for an event.
11421    pub fn wait_for_event(
11422        &self,
11423        deadline: zx::MonotonicInstant,
11424    ) -> Result<VmexResourceEvent, fidl::Error> {
11425        VmexResourceEvent::decode(self.client.wait_for_event::<VmexResourceMarker>(deadline)?)
11426    }
11427
11428    /// Get a VMEX resource handle.
11429    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
11430        let _response = self.client.send_query::<
11431            fidl::encoding::EmptyPayload,
11432            VmexResourceGetResponse,
11433            VmexResourceMarker,
11434        >(
11435            (),
11436            0x33db32deed650699,
11437            fidl::encoding::DynamicFlags::empty(),
11438            ___deadline,
11439        )?;
11440        Ok(_response.resource)
11441    }
11442}
11443
11444#[cfg(target_os = "fuchsia")]
11445impl From<VmexResourceSynchronousProxy> for zx::NullableHandle {
11446    fn from(value: VmexResourceSynchronousProxy) -> Self {
11447        value.into_channel().into()
11448    }
11449}
11450
11451#[cfg(target_os = "fuchsia")]
11452impl From<fidl::Channel> for VmexResourceSynchronousProxy {
11453    fn from(value: fidl::Channel) -> Self {
11454        Self::new(value)
11455    }
11456}
11457
11458#[cfg(target_os = "fuchsia")]
11459impl fidl::endpoints::FromClient for VmexResourceSynchronousProxy {
11460    type Protocol = VmexResourceMarker;
11461
11462    fn from_client(value: fidl::endpoints::ClientEnd<VmexResourceMarker>) -> Self {
11463        Self::new(value.into_channel())
11464    }
11465}
11466
11467#[derive(Debug, Clone)]
11468pub struct VmexResourceProxy {
11469    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11470}
11471
11472impl fidl::endpoints::Proxy for VmexResourceProxy {
11473    type Protocol = VmexResourceMarker;
11474
11475    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11476        Self::new(inner)
11477    }
11478
11479    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11480        self.client.into_channel().map_err(|client| Self { client })
11481    }
11482
11483    fn as_channel(&self) -> &::fidl::AsyncChannel {
11484        self.client.as_channel()
11485    }
11486}
11487
11488impl VmexResourceProxy {
11489    /// Create a new Proxy for fuchsia.kernel/VmexResource.
11490    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11491        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11492        Self { client: fidl::client::Client::new(channel, protocol_name) }
11493    }
11494
11495    /// Get a Stream of events from the remote end of the protocol.
11496    ///
11497    /// # Panics
11498    ///
11499    /// Panics if the event stream was already taken.
11500    pub fn take_event_stream(&self) -> VmexResourceEventStream {
11501        VmexResourceEventStream { event_receiver: self.client.take_event_receiver() }
11502    }
11503
11504    /// Get a VMEX resource handle.
11505    pub fn r#get(
11506        &self,
11507    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
11508    {
11509        VmexResourceProxyInterface::r#get(self)
11510    }
11511}
11512
11513impl VmexResourceProxyInterface for VmexResourceProxy {
11514    type GetResponseFut = fidl::client::QueryResponseFut<
11515        fidl::Resource,
11516        fidl::encoding::DefaultFuchsiaResourceDialect,
11517    >;
11518    fn r#get(&self) -> Self::GetResponseFut {
11519        fn _decode(
11520            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11521        ) -> Result<fidl::Resource, fidl::Error> {
11522            let _response = fidl::client::decode_transaction_body::<
11523                VmexResourceGetResponse,
11524                fidl::encoding::DefaultFuchsiaResourceDialect,
11525                0x33db32deed650699,
11526            >(_buf?)?;
11527            Ok(_response.resource)
11528        }
11529        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
11530            (),
11531            0x33db32deed650699,
11532            fidl::encoding::DynamicFlags::empty(),
11533            _decode,
11534        )
11535    }
11536}
11537
11538pub struct VmexResourceEventStream {
11539    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11540}
11541
11542impl std::marker::Unpin for VmexResourceEventStream {}
11543
11544impl futures::stream::FusedStream for VmexResourceEventStream {
11545    fn is_terminated(&self) -> bool {
11546        self.event_receiver.is_terminated()
11547    }
11548}
11549
11550impl futures::Stream for VmexResourceEventStream {
11551    type Item = Result<VmexResourceEvent, fidl::Error>;
11552
11553    fn poll_next(
11554        mut self: std::pin::Pin<&mut Self>,
11555        cx: &mut std::task::Context<'_>,
11556    ) -> std::task::Poll<Option<Self::Item>> {
11557        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11558            &mut self.event_receiver,
11559            cx
11560        )?) {
11561            Some(buf) => std::task::Poll::Ready(Some(VmexResourceEvent::decode(buf))),
11562            None => std::task::Poll::Ready(None),
11563        }
11564    }
11565}
11566
11567#[derive(Debug)]
11568pub enum VmexResourceEvent {}
11569
11570impl VmexResourceEvent {
11571    /// Decodes a message buffer as a [`VmexResourceEvent`].
11572    fn decode(
11573        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11574    ) -> Result<VmexResourceEvent, fidl::Error> {
11575        let (bytes, _handles) = buf.split_mut();
11576        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11577        debug_assert_eq!(tx_header.tx_id, 0);
11578        match tx_header.ordinal {
11579            _ => Err(fidl::Error::UnknownOrdinal {
11580                ordinal: tx_header.ordinal,
11581                protocol_name: <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11582            }),
11583        }
11584    }
11585}
11586
11587/// A Stream of incoming requests for fuchsia.kernel/VmexResource.
11588pub struct VmexResourceRequestStream {
11589    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11590    is_terminated: bool,
11591}
11592
11593impl std::marker::Unpin for VmexResourceRequestStream {}
11594
11595impl futures::stream::FusedStream for VmexResourceRequestStream {
11596    fn is_terminated(&self) -> bool {
11597        self.is_terminated
11598    }
11599}
11600
11601impl fidl::endpoints::RequestStream for VmexResourceRequestStream {
11602    type Protocol = VmexResourceMarker;
11603    type ControlHandle = VmexResourceControlHandle;
11604
11605    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11606        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11607    }
11608
11609    fn control_handle(&self) -> Self::ControlHandle {
11610        VmexResourceControlHandle { inner: self.inner.clone() }
11611    }
11612
11613    fn into_inner(
11614        self,
11615    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11616    {
11617        (self.inner, self.is_terminated)
11618    }
11619
11620    fn from_inner(
11621        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11622        is_terminated: bool,
11623    ) -> Self {
11624        Self { inner, is_terminated }
11625    }
11626}
11627
11628impl futures::Stream for VmexResourceRequestStream {
11629    type Item = Result<VmexResourceRequest, fidl::Error>;
11630
11631    fn poll_next(
11632        mut self: std::pin::Pin<&mut Self>,
11633        cx: &mut std::task::Context<'_>,
11634    ) -> std::task::Poll<Option<Self::Item>> {
11635        let this = &mut *self;
11636        if this.inner.check_shutdown(cx) {
11637            this.is_terminated = true;
11638            return std::task::Poll::Ready(None);
11639        }
11640        if this.is_terminated {
11641            panic!("polled VmexResourceRequestStream after completion");
11642        }
11643        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11644            |bytes, handles| {
11645                match this.inner.channel().read_etc(cx, bytes, handles) {
11646                    std::task::Poll::Ready(Ok(())) => {}
11647                    std::task::Poll::Pending => return std::task::Poll::Pending,
11648                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11649                        this.is_terminated = true;
11650                        return std::task::Poll::Ready(None);
11651                    }
11652                    std::task::Poll::Ready(Err(e)) => {
11653                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11654                            e.into(),
11655                        ))));
11656                    }
11657                }
11658
11659                // A message has been received from the channel
11660                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11661
11662                std::task::Poll::Ready(Some(match header.ordinal {
11663                    0x33db32deed650699 => {
11664                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11665                        let mut req = fidl::new_empty!(
11666                            fidl::encoding::EmptyPayload,
11667                            fidl::encoding::DefaultFuchsiaResourceDialect
11668                        );
11669                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11670                        let control_handle =
11671                            VmexResourceControlHandle { inner: this.inner.clone() };
11672                        Ok(VmexResourceRequest::Get {
11673                            responder: VmexResourceGetResponder {
11674                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11675                                tx_id: header.tx_id,
11676                            },
11677                        })
11678                    }
11679                    _ => Err(fidl::Error::UnknownOrdinal {
11680                        ordinal: header.ordinal,
11681                        protocol_name:
11682                            <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11683                    }),
11684                }))
11685            },
11686        )
11687    }
11688}
11689
11690/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11691/// `ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
11692/// executable.
11693#[derive(Debug)]
11694pub enum VmexResourceRequest {
11695    /// Get a VMEX resource handle.
11696    Get { responder: VmexResourceGetResponder },
11697}
11698
11699impl VmexResourceRequest {
11700    #[allow(irrefutable_let_patterns)]
11701    pub fn into_get(self) -> Option<(VmexResourceGetResponder)> {
11702        if let VmexResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11703    }
11704
11705    /// Name of the method defined in FIDL
11706    pub fn method_name(&self) -> &'static str {
11707        match *self {
11708            VmexResourceRequest::Get { .. } => "get",
11709        }
11710    }
11711}
11712
11713#[derive(Debug, Clone)]
11714pub struct VmexResourceControlHandle {
11715    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11716}
11717
11718impl VmexResourceControlHandle {
11719    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
11720        self.inner.shutdown_with_epitaph(status.into())
11721    }
11722}
11723
11724impl fidl::endpoints::ControlHandle for VmexResourceControlHandle {
11725    fn shutdown(&self) {
11726        self.inner.shutdown()
11727    }
11728
11729    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11730        self.inner.shutdown_with_epitaph(status)
11731    }
11732
11733    fn is_closed(&self) -> bool {
11734        self.inner.channel().is_closed()
11735    }
11736    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11737        self.inner.channel().on_closed()
11738    }
11739
11740    #[cfg(target_os = "fuchsia")]
11741    fn signal_peer(
11742        &self,
11743        clear_mask: zx::Signals,
11744        set_mask: zx::Signals,
11745    ) -> Result<(), zx_status::Status> {
11746        use fidl::Peered;
11747        self.inner.channel().signal_peer(clear_mask, set_mask)
11748    }
11749}
11750
11751impl VmexResourceControlHandle {}
11752
11753#[must_use = "FIDL methods require a response to be sent"]
11754#[derive(Debug)]
11755pub struct VmexResourceGetResponder {
11756    control_handle: std::mem::ManuallyDrop<VmexResourceControlHandle>,
11757    tx_id: u32,
11758}
11759
11760/// Set the the channel to be shutdown (see [`VmexResourceControlHandle::shutdown`])
11761/// if the responder is dropped without sending a response, so that the client
11762/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11763impl std::ops::Drop for VmexResourceGetResponder {
11764    fn drop(&mut self) {
11765        self.control_handle.shutdown();
11766        // Safety: drops once, never accessed again
11767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11768    }
11769}
11770
11771impl fidl::endpoints::Responder for VmexResourceGetResponder {
11772    type ControlHandle = VmexResourceControlHandle;
11773
11774    fn control_handle(&self) -> &VmexResourceControlHandle {
11775        &self.control_handle
11776    }
11777
11778    fn drop_without_shutdown(mut self) {
11779        // Safety: drops once, never accessed again due to mem::forget
11780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11781        // Prevent Drop from running (which would shut down the channel)
11782        std::mem::forget(self);
11783    }
11784}
11785
11786impl VmexResourceGetResponder {
11787    /// Sends a response to the FIDL transaction.
11788    ///
11789    /// Sets the channel to shutdown if an error occurs.
11790    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11791        let _result = self.send_raw(resource);
11792        if _result.is_err() {
11793            self.control_handle.shutdown();
11794        }
11795        self.drop_without_shutdown();
11796        _result
11797    }
11798
11799    /// Similar to "send" but does not shutdown the channel if an error occurs.
11800    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11801        let _result = self.send_raw(resource);
11802        self.drop_without_shutdown();
11803        _result
11804    }
11805
11806    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11807        self.control_handle.inner.send::<VmexResourceGetResponse>(
11808            (resource,),
11809            self.tx_id,
11810            0x33db32deed650699,
11811            fidl::encoding::DynamicFlags::empty(),
11812        )
11813    }
11814}
11815
11816mod internal {
11817    use super::*;
11818
11819    impl fidl::encoding::ResourceTypeMarker for CounterGetInspectVmoResponse {
11820        type Borrowed<'a> = &'a mut Self;
11821        fn take_or_borrow<'a>(
11822            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11823        ) -> Self::Borrowed<'a> {
11824            value
11825        }
11826    }
11827
11828    unsafe impl fidl::encoding::TypeMarker for CounterGetInspectVmoResponse {
11829        type Owned = Self;
11830
11831        #[inline(always)]
11832        fn inline_align(_context: fidl::encoding::Context) -> usize {
11833            8
11834        }
11835
11836        #[inline(always)]
11837        fn inline_size(_context: fidl::encoding::Context) -> usize {
11838            24
11839        }
11840    }
11841
11842    unsafe impl
11843        fidl::encoding::Encode<
11844            CounterGetInspectVmoResponse,
11845            fidl::encoding::DefaultFuchsiaResourceDialect,
11846        > for &mut CounterGetInspectVmoResponse
11847    {
11848        #[inline]
11849        unsafe fn encode(
11850            self,
11851            encoder: &mut fidl::encoding::Encoder<
11852                '_,
11853                fidl::encoding::DefaultFuchsiaResourceDialect,
11854            >,
11855            offset: usize,
11856            _depth: fidl::encoding::Depth,
11857        ) -> fidl::Result<()> {
11858            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11859            // Delegate to tuple encoding.
11860            fidl::encoding::Encode::<CounterGetInspectVmoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11861                (
11862                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
11863                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
11864                ),
11865                encoder, offset, _depth
11866            )
11867        }
11868    }
11869    unsafe impl<
11870        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11871        T1: fidl::encoding::Encode<
11872                fidl_fuchsia_mem::Buffer,
11873                fidl::encoding::DefaultFuchsiaResourceDialect,
11874            >,
11875    >
11876        fidl::encoding::Encode<
11877            CounterGetInspectVmoResponse,
11878            fidl::encoding::DefaultFuchsiaResourceDialect,
11879        > for (T0, T1)
11880    {
11881        #[inline]
11882        unsafe fn encode(
11883            self,
11884            encoder: &mut fidl::encoding::Encoder<
11885                '_,
11886                fidl::encoding::DefaultFuchsiaResourceDialect,
11887            >,
11888            offset: usize,
11889            depth: fidl::encoding::Depth,
11890        ) -> fidl::Result<()> {
11891            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11892            // Zero out padding regions. There's no need to apply masks
11893            // because the unmasked parts will be overwritten by fields.
11894            unsafe {
11895                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11896                (ptr as *mut u64).write_unaligned(0);
11897            }
11898            // Write the fields.
11899            self.0.encode(encoder, offset + 0, depth)?;
11900            self.1.encode(encoder, offset + 8, depth)?;
11901            Ok(())
11902        }
11903    }
11904
11905    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11906        for CounterGetInspectVmoResponse
11907    {
11908        #[inline(always)]
11909        fn new_empty() -> Self {
11910            Self {
11911                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
11912                buffer: fidl::new_empty!(
11913                    fidl_fuchsia_mem::Buffer,
11914                    fidl::encoding::DefaultFuchsiaResourceDialect
11915                ),
11916            }
11917        }
11918
11919        #[inline]
11920        unsafe fn decode(
11921            &mut self,
11922            decoder: &mut fidl::encoding::Decoder<
11923                '_,
11924                fidl::encoding::DefaultFuchsiaResourceDialect,
11925            >,
11926            offset: usize,
11927            _depth: fidl::encoding::Depth,
11928        ) -> fidl::Result<()> {
11929            decoder.debug_check_bounds::<Self>(offset);
11930            // Verify that padding bytes are zero.
11931            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11932            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11933            let mask = 0xffffffff00000000u64;
11934            let maskedval = padval & mask;
11935            if maskedval != 0 {
11936                return Err(fidl::Error::NonZeroPadding {
11937                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11938                });
11939            }
11940            fidl::decode!(
11941                i32,
11942                fidl::encoding::DefaultFuchsiaResourceDialect,
11943                &mut self.status,
11944                decoder,
11945                offset + 0,
11946                _depth
11947            )?;
11948            fidl::decode!(
11949                fidl_fuchsia_mem::Buffer,
11950                fidl::encoding::DefaultFuchsiaResourceDialect,
11951                &mut self.buffer,
11952                decoder,
11953                offset + 8,
11954                _depth
11955            )?;
11956            Ok(())
11957        }
11958    }
11959
11960    impl fidl::encoding::ResourceTypeMarker for CpuResourceGetResponse {
11961        type Borrowed<'a> = &'a mut Self;
11962        fn take_or_borrow<'a>(
11963            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11964        ) -> Self::Borrowed<'a> {
11965            value
11966        }
11967    }
11968
11969    unsafe impl fidl::encoding::TypeMarker for CpuResourceGetResponse {
11970        type Owned = Self;
11971
11972        #[inline(always)]
11973        fn inline_align(_context: fidl::encoding::Context) -> usize {
11974            4
11975        }
11976
11977        #[inline(always)]
11978        fn inline_size(_context: fidl::encoding::Context) -> usize {
11979            4
11980        }
11981    }
11982
11983    unsafe impl
11984        fidl::encoding::Encode<
11985            CpuResourceGetResponse,
11986            fidl::encoding::DefaultFuchsiaResourceDialect,
11987        > for &mut CpuResourceGetResponse
11988    {
11989        #[inline]
11990        unsafe fn encode(
11991            self,
11992            encoder: &mut fidl::encoding::Encoder<
11993                '_,
11994                fidl::encoding::DefaultFuchsiaResourceDialect,
11995            >,
11996            offset: usize,
11997            _depth: fidl::encoding::Depth,
11998        ) -> fidl::Result<()> {
11999            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
12000            // Delegate to tuple encoding.
12001            fidl::encoding::Encode::<
12002                CpuResourceGetResponse,
12003                fidl::encoding::DefaultFuchsiaResourceDialect,
12004            >::encode(
12005                (<fidl::encoding::HandleType<
12006                    fidl::Resource,
12007                    { fidl::ObjectType::RESOURCE.into_raw() },
12008                    2147483648,
12009                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12010                    &mut self.resource
12011                ),),
12012                encoder,
12013                offset,
12014                _depth,
12015            )
12016        }
12017    }
12018    unsafe impl<
12019        T0: fidl::encoding::Encode<
12020                fidl::encoding::HandleType<
12021                    fidl::Resource,
12022                    { fidl::ObjectType::RESOURCE.into_raw() },
12023                    2147483648,
12024                >,
12025                fidl::encoding::DefaultFuchsiaResourceDialect,
12026            >,
12027    >
12028        fidl::encoding::Encode<
12029            CpuResourceGetResponse,
12030            fidl::encoding::DefaultFuchsiaResourceDialect,
12031        > for (T0,)
12032    {
12033        #[inline]
12034        unsafe fn encode(
12035            self,
12036            encoder: &mut fidl::encoding::Encoder<
12037                '_,
12038                fidl::encoding::DefaultFuchsiaResourceDialect,
12039            >,
12040            offset: usize,
12041            depth: fidl::encoding::Depth,
12042        ) -> fidl::Result<()> {
12043            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
12044            // Zero out padding regions. There's no need to apply masks
12045            // because the unmasked parts will be overwritten by fields.
12046            // Write the fields.
12047            self.0.encode(encoder, offset + 0, depth)?;
12048            Ok(())
12049        }
12050    }
12051
12052    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12053        for CpuResourceGetResponse
12054    {
12055        #[inline(always)]
12056        fn new_empty() -> Self {
12057            Self {
12058                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12059            }
12060        }
12061
12062        #[inline]
12063        unsafe fn decode(
12064            &mut self,
12065            decoder: &mut fidl::encoding::Decoder<
12066                '_,
12067                fidl::encoding::DefaultFuchsiaResourceDialect,
12068            >,
12069            offset: usize,
12070            _depth: fidl::encoding::Depth,
12071        ) -> fidl::Result<()> {
12072            decoder.debug_check_bounds::<Self>(offset);
12073            // Verify that padding bytes are zero.
12074            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12075            Ok(())
12076        }
12077    }
12078
12079    impl fidl::encoding::ResourceTypeMarker for DebugResourceGetResponse {
12080        type Borrowed<'a> = &'a mut Self;
12081        fn take_or_borrow<'a>(
12082            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12083        ) -> Self::Borrowed<'a> {
12084            value
12085        }
12086    }
12087
12088    unsafe impl fidl::encoding::TypeMarker for DebugResourceGetResponse {
12089        type Owned = Self;
12090
12091        #[inline(always)]
12092        fn inline_align(_context: fidl::encoding::Context) -> usize {
12093            4
12094        }
12095
12096        #[inline(always)]
12097        fn inline_size(_context: fidl::encoding::Context) -> usize {
12098            4
12099        }
12100    }
12101
12102    unsafe impl
12103        fidl::encoding::Encode<
12104            DebugResourceGetResponse,
12105            fidl::encoding::DefaultFuchsiaResourceDialect,
12106        > for &mut DebugResourceGetResponse
12107    {
12108        #[inline]
12109        unsafe fn encode(
12110            self,
12111            encoder: &mut fidl::encoding::Encoder<
12112                '_,
12113                fidl::encoding::DefaultFuchsiaResourceDialect,
12114            >,
12115            offset: usize,
12116            _depth: fidl::encoding::Depth,
12117        ) -> fidl::Result<()> {
12118            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
12119            // Delegate to tuple encoding.
12120            fidl::encoding::Encode::<
12121                DebugResourceGetResponse,
12122                fidl::encoding::DefaultFuchsiaResourceDialect,
12123            >::encode(
12124                (<fidl::encoding::HandleType<
12125                    fidl::Resource,
12126                    { fidl::ObjectType::RESOURCE.into_raw() },
12127                    2147483648,
12128                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12129                    &mut self.resource
12130                ),),
12131                encoder,
12132                offset,
12133                _depth,
12134            )
12135        }
12136    }
12137    unsafe impl<
12138        T0: fidl::encoding::Encode<
12139                fidl::encoding::HandleType<
12140                    fidl::Resource,
12141                    { fidl::ObjectType::RESOURCE.into_raw() },
12142                    2147483648,
12143                >,
12144                fidl::encoding::DefaultFuchsiaResourceDialect,
12145            >,
12146    >
12147        fidl::encoding::Encode<
12148            DebugResourceGetResponse,
12149            fidl::encoding::DefaultFuchsiaResourceDialect,
12150        > for (T0,)
12151    {
12152        #[inline]
12153        unsafe fn encode(
12154            self,
12155            encoder: &mut fidl::encoding::Encoder<
12156                '_,
12157                fidl::encoding::DefaultFuchsiaResourceDialect,
12158            >,
12159            offset: usize,
12160            depth: fidl::encoding::Depth,
12161        ) -> fidl::Result<()> {
12162            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
12163            // Zero out padding regions. There's no need to apply masks
12164            // because the unmasked parts will be overwritten by fields.
12165            // Write the fields.
12166            self.0.encode(encoder, offset + 0, depth)?;
12167            Ok(())
12168        }
12169    }
12170
12171    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12172        for DebugResourceGetResponse
12173    {
12174        #[inline(always)]
12175        fn new_empty() -> Self {
12176            Self {
12177                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12178            }
12179        }
12180
12181        #[inline]
12182        unsafe fn decode(
12183            &mut self,
12184            decoder: &mut fidl::encoding::Decoder<
12185                '_,
12186                fidl::encoding::DefaultFuchsiaResourceDialect,
12187            >,
12188            offset: usize,
12189            _depth: fidl::encoding::Depth,
12190        ) -> fidl::Result<()> {
12191            decoder.debug_check_bounds::<Self>(offset);
12192            // Verify that padding bytes are zero.
12193            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12194            Ok(())
12195        }
12196    }
12197
12198    impl fidl::encoding::ResourceTypeMarker for DebuglogResourceGetResponse {
12199        type Borrowed<'a> = &'a mut Self;
12200        fn take_or_borrow<'a>(
12201            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12202        ) -> Self::Borrowed<'a> {
12203            value
12204        }
12205    }
12206
12207    unsafe impl fidl::encoding::TypeMarker for DebuglogResourceGetResponse {
12208        type Owned = Self;
12209
12210        #[inline(always)]
12211        fn inline_align(_context: fidl::encoding::Context) -> usize {
12212            4
12213        }
12214
12215        #[inline(always)]
12216        fn inline_size(_context: fidl::encoding::Context) -> usize {
12217            4
12218        }
12219    }
12220
12221    unsafe impl
12222        fidl::encoding::Encode<
12223            DebuglogResourceGetResponse,
12224            fidl::encoding::DefaultFuchsiaResourceDialect,
12225        > for &mut DebuglogResourceGetResponse
12226    {
12227        #[inline]
12228        unsafe fn encode(
12229            self,
12230            encoder: &mut fidl::encoding::Encoder<
12231                '_,
12232                fidl::encoding::DefaultFuchsiaResourceDialect,
12233            >,
12234            offset: usize,
12235            _depth: fidl::encoding::Depth,
12236        ) -> fidl::Result<()> {
12237            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
12238            // Delegate to tuple encoding.
12239            fidl::encoding::Encode::<
12240                DebuglogResourceGetResponse,
12241                fidl::encoding::DefaultFuchsiaResourceDialect,
12242            >::encode(
12243                (<fidl::encoding::HandleType<
12244                    fidl::Resource,
12245                    { fidl::ObjectType::RESOURCE.into_raw() },
12246                    2147483648,
12247                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12248                    &mut self.resource
12249                ),),
12250                encoder,
12251                offset,
12252                _depth,
12253            )
12254        }
12255    }
12256    unsafe impl<
12257        T0: fidl::encoding::Encode<
12258                fidl::encoding::HandleType<
12259                    fidl::Resource,
12260                    { fidl::ObjectType::RESOURCE.into_raw() },
12261                    2147483648,
12262                >,
12263                fidl::encoding::DefaultFuchsiaResourceDialect,
12264            >,
12265    >
12266        fidl::encoding::Encode<
12267            DebuglogResourceGetResponse,
12268            fidl::encoding::DefaultFuchsiaResourceDialect,
12269        > for (T0,)
12270    {
12271        #[inline]
12272        unsafe fn encode(
12273            self,
12274            encoder: &mut fidl::encoding::Encoder<
12275                '_,
12276                fidl::encoding::DefaultFuchsiaResourceDialect,
12277            >,
12278            offset: usize,
12279            depth: fidl::encoding::Depth,
12280        ) -> fidl::Result<()> {
12281            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
12282            // Zero out padding regions. There's no need to apply masks
12283            // because the unmasked parts will be overwritten by fields.
12284            // Write the fields.
12285            self.0.encode(encoder, offset + 0, depth)?;
12286            Ok(())
12287        }
12288    }
12289
12290    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12291        for DebuglogResourceGetResponse
12292    {
12293        #[inline(always)]
12294        fn new_empty() -> Self {
12295            Self {
12296                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12297            }
12298        }
12299
12300        #[inline]
12301        unsafe fn decode(
12302            &mut self,
12303            decoder: &mut fidl::encoding::Decoder<
12304                '_,
12305                fidl::encoding::DefaultFuchsiaResourceDialect,
12306            >,
12307            offset: usize,
12308            _depth: fidl::encoding::Depth,
12309        ) -> fidl::Result<()> {
12310            decoder.debug_check_bounds::<Self>(offset);
12311            // Verify that padding bytes are zero.
12312            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12313            Ok(())
12314        }
12315    }
12316
12317    impl fidl::encoding::ResourceTypeMarker for EnergyInfoResourceGetResponse {
12318        type Borrowed<'a> = &'a mut Self;
12319        fn take_or_borrow<'a>(
12320            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12321        ) -> Self::Borrowed<'a> {
12322            value
12323        }
12324    }
12325
12326    unsafe impl fidl::encoding::TypeMarker for EnergyInfoResourceGetResponse {
12327        type Owned = Self;
12328
12329        #[inline(always)]
12330        fn inline_align(_context: fidl::encoding::Context) -> usize {
12331            4
12332        }
12333
12334        #[inline(always)]
12335        fn inline_size(_context: fidl::encoding::Context) -> usize {
12336            4
12337        }
12338    }
12339
12340    unsafe impl
12341        fidl::encoding::Encode<
12342            EnergyInfoResourceGetResponse,
12343            fidl::encoding::DefaultFuchsiaResourceDialect,
12344        > for &mut EnergyInfoResourceGetResponse
12345    {
12346        #[inline]
12347        unsafe fn encode(
12348            self,
12349            encoder: &mut fidl::encoding::Encoder<
12350                '_,
12351                fidl::encoding::DefaultFuchsiaResourceDialect,
12352            >,
12353            offset: usize,
12354            _depth: fidl::encoding::Depth,
12355        ) -> fidl::Result<()> {
12356            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
12357            // Delegate to tuple encoding.
12358            fidl::encoding::Encode::<
12359                EnergyInfoResourceGetResponse,
12360                fidl::encoding::DefaultFuchsiaResourceDialect,
12361            >::encode(
12362                (<fidl::encoding::HandleType<
12363                    fidl::Resource,
12364                    { fidl::ObjectType::RESOURCE.into_raw() },
12365                    2147483648,
12366                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12367                    &mut self.resource
12368                ),),
12369                encoder,
12370                offset,
12371                _depth,
12372            )
12373        }
12374    }
12375    unsafe impl<
12376        T0: fidl::encoding::Encode<
12377                fidl::encoding::HandleType<
12378                    fidl::Resource,
12379                    { fidl::ObjectType::RESOURCE.into_raw() },
12380                    2147483648,
12381                >,
12382                fidl::encoding::DefaultFuchsiaResourceDialect,
12383            >,
12384    >
12385        fidl::encoding::Encode<
12386            EnergyInfoResourceGetResponse,
12387            fidl::encoding::DefaultFuchsiaResourceDialect,
12388        > for (T0,)
12389    {
12390        #[inline]
12391        unsafe fn encode(
12392            self,
12393            encoder: &mut fidl::encoding::Encoder<
12394                '_,
12395                fidl::encoding::DefaultFuchsiaResourceDialect,
12396            >,
12397            offset: usize,
12398            depth: fidl::encoding::Depth,
12399        ) -> fidl::Result<()> {
12400            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
12401            // Zero out padding regions. There's no need to apply masks
12402            // because the unmasked parts will be overwritten by fields.
12403            // Write the fields.
12404            self.0.encode(encoder, offset + 0, depth)?;
12405            Ok(())
12406        }
12407    }
12408
12409    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12410        for EnergyInfoResourceGetResponse
12411    {
12412        #[inline(always)]
12413        fn new_empty() -> Self {
12414            Self {
12415                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12416            }
12417        }
12418
12419        #[inline]
12420        unsafe fn decode(
12421            &mut self,
12422            decoder: &mut fidl::encoding::Decoder<
12423                '_,
12424                fidl::encoding::DefaultFuchsiaResourceDialect,
12425            >,
12426            offset: usize,
12427            _depth: fidl::encoding::Depth,
12428        ) -> fidl::Result<()> {
12429            decoder.debug_check_bounds::<Self>(offset);
12430            // Verify that padding bytes are zero.
12431            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12432            Ok(())
12433        }
12434    }
12435
12436    impl fidl::encoding::ResourceTypeMarker for HypervisorResourceGetResponse {
12437        type Borrowed<'a> = &'a mut Self;
12438        fn take_or_borrow<'a>(
12439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12440        ) -> Self::Borrowed<'a> {
12441            value
12442        }
12443    }
12444
12445    unsafe impl fidl::encoding::TypeMarker for HypervisorResourceGetResponse {
12446        type Owned = Self;
12447
12448        #[inline(always)]
12449        fn inline_align(_context: fidl::encoding::Context) -> usize {
12450            4
12451        }
12452
12453        #[inline(always)]
12454        fn inline_size(_context: fidl::encoding::Context) -> usize {
12455            4
12456        }
12457    }
12458
12459    unsafe impl
12460        fidl::encoding::Encode<
12461            HypervisorResourceGetResponse,
12462            fidl::encoding::DefaultFuchsiaResourceDialect,
12463        > for &mut HypervisorResourceGetResponse
12464    {
12465        #[inline]
12466        unsafe fn encode(
12467            self,
12468            encoder: &mut fidl::encoding::Encoder<
12469                '_,
12470                fidl::encoding::DefaultFuchsiaResourceDialect,
12471            >,
12472            offset: usize,
12473            _depth: fidl::encoding::Depth,
12474        ) -> fidl::Result<()> {
12475            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12476            // Delegate to tuple encoding.
12477            fidl::encoding::Encode::<
12478                HypervisorResourceGetResponse,
12479                fidl::encoding::DefaultFuchsiaResourceDialect,
12480            >::encode(
12481                (<fidl::encoding::HandleType<
12482                    fidl::Resource,
12483                    { fidl::ObjectType::RESOURCE.into_raw() },
12484                    2147483648,
12485                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12486                    &mut self.resource
12487                ),),
12488                encoder,
12489                offset,
12490                _depth,
12491            )
12492        }
12493    }
12494    unsafe impl<
12495        T0: fidl::encoding::Encode<
12496                fidl::encoding::HandleType<
12497                    fidl::Resource,
12498                    { fidl::ObjectType::RESOURCE.into_raw() },
12499                    2147483648,
12500                >,
12501                fidl::encoding::DefaultFuchsiaResourceDialect,
12502            >,
12503    >
12504        fidl::encoding::Encode<
12505            HypervisorResourceGetResponse,
12506            fidl::encoding::DefaultFuchsiaResourceDialect,
12507        > for (T0,)
12508    {
12509        #[inline]
12510        unsafe fn encode(
12511            self,
12512            encoder: &mut fidl::encoding::Encoder<
12513                '_,
12514                fidl::encoding::DefaultFuchsiaResourceDialect,
12515            >,
12516            offset: usize,
12517            depth: fidl::encoding::Depth,
12518        ) -> fidl::Result<()> {
12519            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12520            // Zero out padding regions. There's no need to apply masks
12521            // because the unmasked parts will be overwritten by fields.
12522            // Write the fields.
12523            self.0.encode(encoder, offset + 0, depth)?;
12524            Ok(())
12525        }
12526    }
12527
12528    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12529        for HypervisorResourceGetResponse
12530    {
12531        #[inline(always)]
12532        fn new_empty() -> Self {
12533            Self {
12534                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12535            }
12536        }
12537
12538        #[inline]
12539        unsafe fn decode(
12540            &mut self,
12541            decoder: &mut fidl::encoding::Decoder<
12542                '_,
12543                fidl::encoding::DefaultFuchsiaResourceDialect,
12544            >,
12545            offset: usize,
12546            _depth: fidl::encoding::Depth,
12547        ) -> fidl::Result<()> {
12548            decoder.debug_check_bounds::<Self>(offset);
12549            // Verify that padding bytes are zero.
12550            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12551            Ok(())
12552        }
12553    }
12554
12555    impl fidl::encoding::ResourceTypeMarker for InfoResourceGetResponse {
12556        type Borrowed<'a> = &'a mut Self;
12557        fn take_or_borrow<'a>(
12558            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12559        ) -> Self::Borrowed<'a> {
12560            value
12561        }
12562    }
12563
12564    unsafe impl fidl::encoding::TypeMarker for InfoResourceGetResponse {
12565        type Owned = Self;
12566
12567        #[inline(always)]
12568        fn inline_align(_context: fidl::encoding::Context) -> usize {
12569            4
12570        }
12571
12572        #[inline(always)]
12573        fn inline_size(_context: fidl::encoding::Context) -> usize {
12574            4
12575        }
12576    }
12577
12578    unsafe impl
12579        fidl::encoding::Encode<
12580            InfoResourceGetResponse,
12581            fidl::encoding::DefaultFuchsiaResourceDialect,
12582        > for &mut InfoResourceGetResponse
12583    {
12584        #[inline]
12585        unsafe fn encode(
12586            self,
12587            encoder: &mut fidl::encoding::Encoder<
12588                '_,
12589                fidl::encoding::DefaultFuchsiaResourceDialect,
12590            >,
12591            offset: usize,
12592            _depth: fidl::encoding::Depth,
12593        ) -> fidl::Result<()> {
12594            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12595            // Delegate to tuple encoding.
12596            fidl::encoding::Encode::<
12597                InfoResourceGetResponse,
12598                fidl::encoding::DefaultFuchsiaResourceDialect,
12599            >::encode(
12600                (<fidl::encoding::HandleType<
12601                    fidl::Resource,
12602                    { fidl::ObjectType::RESOURCE.into_raw() },
12603                    2147483648,
12604                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12605                    &mut self.resource
12606                ),),
12607                encoder,
12608                offset,
12609                _depth,
12610            )
12611        }
12612    }
12613    unsafe impl<
12614        T0: fidl::encoding::Encode<
12615                fidl::encoding::HandleType<
12616                    fidl::Resource,
12617                    { fidl::ObjectType::RESOURCE.into_raw() },
12618                    2147483648,
12619                >,
12620                fidl::encoding::DefaultFuchsiaResourceDialect,
12621            >,
12622    >
12623        fidl::encoding::Encode<
12624            InfoResourceGetResponse,
12625            fidl::encoding::DefaultFuchsiaResourceDialect,
12626        > for (T0,)
12627    {
12628        #[inline]
12629        unsafe fn encode(
12630            self,
12631            encoder: &mut fidl::encoding::Encoder<
12632                '_,
12633                fidl::encoding::DefaultFuchsiaResourceDialect,
12634            >,
12635            offset: usize,
12636            depth: fidl::encoding::Depth,
12637        ) -> fidl::Result<()> {
12638            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12639            // Zero out padding regions. There's no need to apply masks
12640            // because the unmasked parts will be overwritten by fields.
12641            // Write the fields.
12642            self.0.encode(encoder, offset + 0, depth)?;
12643            Ok(())
12644        }
12645    }
12646
12647    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12648        for InfoResourceGetResponse
12649    {
12650        #[inline(always)]
12651        fn new_empty() -> Self {
12652            Self {
12653                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12654            }
12655        }
12656
12657        #[inline]
12658        unsafe fn decode(
12659            &mut self,
12660            decoder: &mut fidl::encoding::Decoder<
12661                '_,
12662                fidl::encoding::DefaultFuchsiaResourceDialect,
12663            >,
12664            offset: usize,
12665            _depth: fidl::encoding::Depth,
12666        ) -> fidl::Result<()> {
12667            decoder.debug_check_bounds::<Self>(offset);
12668            // Verify that padding bytes are zero.
12669            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12670            Ok(())
12671        }
12672    }
12673
12674    impl fidl::encoding::ResourceTypeMarker for IommuResourceGetResponse {
12675        type Borrowed<'a> = &'a mut Self;
12676        fn take_or_borrow<'a>(
12677            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12678        ) -> Self::Borrowed<'a> {
12679            value
12680        }
12681    }
12682
12683    unsafe impl fidl::encoding::TypeMarker for IommuResourceGetResponse {
12684        type Owned = Self;
12685
12686        #[inline(always)]
12687        fn inline_align(_context: fidl::encoding::Context) -> usize {
12688            4
12689        }
12690
12691        #[inline(always)]
12692        fn inline_size(_context: fidl::encoding::Context) -> usize {
12693            4
12694        }
12695    }
12696
12697    unsafe impl
12698        fidl::encoding::Encode<
12699            IommuResourceGetResponse,
12700            fidl::encoding::DefaultFuchsiaResourceDialect,
12701        > for &mut IommuResourceGetResponse
12702    {
12703        #[inline]
12704        unsafe fn encode(
12705            self,
12706            encoder: &mut fidl::encoding::Encoder<
12707                '_,
12708                fidl::encoding::DefaultFuchsiaResourceDialect,
12709            >,
12710            offset: usize,
12711            _depth: fidl::encoding::Depth,
12712        ) -> fidl::Result<()> {
12713            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12714            // Delegate to tuple encoding.
12715            fidl::encoding::Encode::<
12716                IommuResourceGetResponse,
12717                fidl::encoding::DefaultFuchsiaResourceDialect,
12718            >::encode(
12719                (<fidl::encoding::HandleType<
12720                    fidl::Resource,
12721                    { fidl::ObjectType::RESOURCE.into_raw() },
12722                    2147483648,
12723                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12724                    &mut self.resource
12725                ),),
12726                encoder,
12727                offset,
12728                _depth,
12729            )
12730        }
12731    }
12732    unsafe impl<
12733        T0: fidl::encoding::Encode<
12734                fidl::encoding::HandleType<
12735                    fidl::Resource,
12736                    { fidl::ObjectType::RESOURCE.into_raw() },
12737                    2147483648,
12738                >,
12739                fidl::encoding::DefaultFuchsiaResourceDialect,
12740            >,
12741    >
12742        fidl::encoding::Encode<
12743            IommuResourceGetResponse,
12744            fidl::encoding::DefaultFuchsiaResourceDialect,
12745        > for (T0,)
12746    {
12747        #[inline]
12748        unsafe fn encode(
12749            self,
12750            encoder: &mut fidl::encoding::Encoder<
12751                '_,
12752                fidl::encoding::DefaultFuchsiaResourceDialect,
12753            >,
12754            offset: usize,
12755            depth: fidl::encoding::Depth,
12756        ) -> fidl::Result<()> {
12757            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12758            // Zero out padding regions. There's no need to apply masks
12759            // because the unmasked parts will be overwritten by fields.
12760            // Write the fields.
12761            self.0.encode(encoder, offset + 0, depth)?;
12762            Ok(())
12763        }
12764    }
12765
12766    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12767        for IommuResourceGetResponse
12768    {
12769        #[inline(always)]
12770        fn new_empty() -> Self {
12771            Self {
12772                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12773            }
12774        }
12775
12776        #[inline]
12777        unsafe fn decode(
12778            &mut self,
12779            decoder: &mut fidl::encoding::Decoder<
12780                '_,
12781                fidl::encoding::DefaultFuchsiaResourceDialect,
12782            >,
12783            offset: usize,
12784            _depth: fidl::encoding::Depth,
12785        ) -> fidl::Result<()> {
12786            decoder.debug_check_bounds::<Self>(offset);
12787            // Verify that padding bytes are zero.
12788            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12789            Ok(())
12790        }
12791    }
12792
12793    impl fidl::encoding::ResourceTypeMarker for IoportResourceGetResponse {
12794        type Borrowed<'a> = &'a mut Self;
12795        fn take_or_borrow<'a>(
12796            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12797        ) -> Self::Borrowed<'a> {
12798            value
12799        }
12800    }
12801
12802    unsafe impl fidl::encoding::TypeMarker for IoportResourceGetResponse {
12803        type Owned = Self;
12804
12805        #[inline(always)]
12806        fn inline_align(_context: fidl::encoding::Context) -> usize {
12807            4
12808        }
12809
12810        #[inline(always)]
12811        fn inline_size(_context: fidl::encoding::Context) -> usize {
12812            4
12813        }
12814    }
12815
12816    unsafe impl
12817        fidl::encoding::Encode<
12818            IoportResourceGetResponse,
12819            fidl::encoding::DefaultFuchsiaResourceDialect,
12820        > for &mut IoportResourceGetResponse
12821    {
12822        #[inline]
12823        unsafe fn encode(
12824            self,
12825            encoder: &mut fidl::encoding::Encoder<
12826                '_,
12827                fidl::encoding::DefaultFuchsiaResourceDialect,
12828            >,
12829            offset: usize,
12830            _depth: fidl::encoding::Depth,
12831        ) -> fidl::Result<()> {
12832            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12833            // Delegate to tuple encoding.
12834            fidl::encoding::Encode::<
12835                IoportResourceGetResponse,
12836                fidl::encoding::DefaultFuchsiaResourceDialect,
12837            >::encode(
12838                (<fidl::encoding::HandleType<
12839                    fidl::Resource,
12840                    { fidl::ObjectType::RESOURCE.into_raw() },
12841                    2147483648,
12842                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12843                    &mut self.resource
12844                ),),
12845                encoder,
12846                offset,
12847                _depth,
12848            )
12849        }
12850    }
12851    unsafe impl<
12852        T0: fidl::encoding::Encode<
12853                fidl::encoding::HandleType<
12854                    fidl::Resource,
12855                    { fidl::ObjectType::RESOURCE.into_raw() },
12856                    2147483648,
12857                >,
12858                fidl::encoding::DefaultFuchsiaResourceDialect,
12859            >,
12860    >
12861        fidl::encoding::Encode<
12862            IoportResourceGetResponse,
12863            fidl::encoding::DefaultFuchsiaResourceDialect,
12864        > for (T0,)
12865    {
12866        #[inline]
12867        unsafe fn encode(
12868            self,
12869            encoder: &mut fidl::encoding::Encoder<
12870                '_,
12871                fidl::encoding::DefaultFuchsiaResourceDialect,
12872            >,
12873            offset: usize,
12874            depth: fidl::encoding::Depth,
12875        ) -> fidl::Result<()> {
12876            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12877            // Zero out padding regions. There's no need to apply masks
12878            // because the unmasked parts will be overwritten by fields.
12879            // Write the fields.
12880            self.0.encode(encoder, offset + 0, depth)?;
12881            Ok(())
12882        }
12883    }
12884
12885    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12886        for IoportResourceGetResponse
12887    {
12888        #[inline(always)]
12889        fn new_empty() -> Self {
12890            Self {
12891                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12892            }
12893        }
12894
12895        #[inline]
12896        unsafe fn decode(
12897            &mut self,
12898            decoder: &mut fidl::encoding::Decoder<
12899                '_,
12900                fidl::encoding::DefaultFuchsiaResourceDialect,
12901            >,
12902            offset: usize,
12903            _depth: fidl::encoding::Depth,
12904        ) -> fidl::Result<()> {
12905            decoder.debug_check_bounds::<Self>(offset);
12906            // Verify that padding bytes are zero.
12907            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12908            Ok(())
12909        }
12910    }
12911
12912    impl fidl::encoding::ResourceTypeMarker for IrqResourceGetResponse {
12913        type Borrowed<'a> = &'a mut Self;
12914        fn take_or_borrow<'a>(
12915            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12916        ) -> Self::Borrowed<'a> {
12917            value
12918        }
12919    }
12920
12921    unsafe impl fidl::encoding::TypeMarker for IrqResourceGetResponse {
12922        type Owned = Self;
12923
12924        #[inline(always)]
12925        fn inline_align(_context: fidl::encoding::Context) -> usize {
12926            4
12927        }
12928
12929        #[inline(always)]
12930        fn inline_size(_context: fidl::encoding::Context) -> usize {
12931            4
12932        }
12933    }
12934
12935    unsafe impl
12936        fidl::encoding::Encode<
12937            IrqResourceGetResponse,
12938            fidl::encoding::DefaultFuchsiaResourceDialect,
12939        > for &mut IrqResourceGetResponse
12940    {
12941        #[inline]
12942        unsafe fn encode(
12943            self,
12944            encoder: &mut fidl::encoding::Encoder<
12945                '_,
12946                fidl::encoding::DefaultFuchsiaResourceDialect,
12947            >,
12948            offset: usize,
12949            _depth: fidl::encoding::Depth,
12950        ) -> fidl::Result<()> {
12951            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12952            // Delegate to tuple encoding.
12953            fidl::encoding::Encode::<
12954                IrqResourceGetResponse,
12955                fidl::encoding::DefaultFuchsiaResourceDialect,
12956            >::encode(
12957                (<fidl::encoding::HandleType<
12958                    fidl::Resource,
12959                    { fidl::ObjectType::RESOURCE.into_raw() },
12960                    2147483648,
12961                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12962                    &mut self.resource
12963                ),),
12964                encoder,
12965                offset,
12966                _depth,
12967            )
12968        }
12969    }
12970    unsafe impl<
12971        T0: fidl::encoding::Encode<
12972                fidl::encoding::HandleType<
12973                    fidl::Resource,
12974                    { fidl::ObjectType::RESOURCE.into_raw() },
12975                    2147483648,
12976                >,
12977                fidl::encoding::DefaultFuchsiaResourceDialect,
12978            >,
12979    >
12980        fidl::encoding::Encode<
12981            IrqResourceGetResponse,
12982            fidl::encoding::DefaultFuchsiaResourceDialect,
12983        > for (T0,)
12984    {
12985        #[inline]
12986        unsafe fn encode(
12987            self,
12988            encoder: &mut fidl::encoding::Encoder<
12989                '_,
12990                fidl::encoding::DefaultFuchsiaResourceDialect,
12991            >,
12992            offset: usize,
12993            depth: fidl::encoding::Depth,
12994        ) -> fidl::Result<()> {
12995            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12996            // Zero out padding regions. There's no need to apply masks
12997            // because the unmasked parts will be overwritten by fields.
12998            // Write the fields.
12999            self.0.encode(encoder, offset + 0, depth)?;
13000            Ok(())
13001        }
13002    }
13003
13004    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13005        for IrqResourceGetResponse
13006    {
13007        #[inline(always)]
13008        fn new_empty() -> Self {
13009            Self {
13010                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13011            }
13012        }
13013
13014        #[inline]
13015        unsafe fn decode(
13016            &mut self,
13017            decoder: &mut fidl::encoding::Decoder<
13018                '_,
13019                fidl::encoding::DefaultFuchsiaResourceDialect,
13020            >,
13021            offset: usize,
13022            _depth: fidl::encoding::Depth,
13023        ) -> fidl::Result<()> {
13024            decoder.debug_check_bounds::<Self>(offset);
13025            // Verify that padding bytes are zero.
13026            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13027            Ok(())
13028        }
13029    }
13030
13031    impl fidl::encoding::ResourceTypeMarker for MexecResourceGetResponse {
13032        type Borrowed<'a> = &'a mut Self;
13033        fn take_or_borrow<'a>(
13034            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13035        ) -> Self::Borrowed<'a> {
13036            value
13037        }
13038    }
13039
13040    unsafe impl fidl::encoding::TypeMarker for MexecResourceGetResponse {
13041        type Owned = Self;
13042
13043        #[inline(always)]
13044        fn inline_align(_context: fidl::encoding::Context) -> usize {
13045            4
13046        }
13047
13048        #[inline(always)]
13049        fn inline_size(_context: fidl::encoding::Context) -> usize {
13050            4
13051        }
13052    }
13053
13054    unsafe impl
13055        fidl::encoding::Encode<
13056            MexecResourceGetResponse,
13057            fidl::encoding::DefaultFuchsiaResourceDialect,
13058        > for &mut MexecResourceGetResponse
13059    {
13060        #[inline]
13061        unsafe fn encode(
13062            self,
13063            encoder: &mut fidl::encoding::Encoder<
13064                '_,
13065                fidl::encoding::DefaultFuchsiaResourceDialect,
13066            >,
13067            offset: usize,
13068            _depth: fidl::encoding::Depth,
13069        ) -> fidl::Result<()> {
13070            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
13071            // Delegate to tuple encoding.
13072            fidl::encoding::Encode::<
13073                MexecResourceGetResponse,
13074                fidl::encoding::DefaultFuchsiaResourceDialect,
13075            >::encode(
13076                (<fidl::encoding::HandleType<
13077                    fidl::Resource,
13078                    { fidl::ObjectType::RESOURCE.into_raw() },
13079                    2147483648,
13080                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13081                    &mut self.resource
13082                ),),
13083                encoder,
13084                offset,
13085                _depth,
13086            )
13087        }
13088    }
13089    unsafe impl<
13090        T0: fidl::encoding::Encode<
13091                fidl::encoding::HandleType<
13092                    fidl::Resource,
13093                    { fidl::ObjectType::RESOURCE.into_raw() },
13094                    2147483648,
13095                >,
13096                fidl::encoding::DefaultFuchsiaResourceDialect,
13097            >,
13098    >
13099        fidl::encoding::Encode<
13100            MexecResourceGetResponse,
13101            fidl::encoding::DefaultFuchsiaResourceDialect,
13102        > for (T0,)
13103    {
13104        #[inline]
13105        unsafe fn encode(
13106            self,
13107            encoder: &mut fidl::encoding::Encoder<
13108                '_,
13109                fidl::encoding::DefaultFuchsiaResourceDialect,
13110            >,
13111            offset: usize,
13112            depth: fidl::encoding::Depth,
13113        ) -> fidl::Result<()> {
13114            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
13115            // Zero out padding regions. There's no need to apply masks
13116            // because the unmasked parts will be overwritten by fields.
13117            // Write the fields.
13118            self.0.encode(encoder, offset + 0, depth)?;
13119            Ok(())
13120        }
13121    }
13122
13123    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13124        for MexecResourceGetResponse
13125    {
13126        #[inline(always)]
13127        fn new_empty() -> Self {
13128            Self {
13129                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13130            }
13131        }
13132
13133        #[inline]
13134        unsafe fn decode(
13135            &mut self,
13136            decoder: &mut fidl::encoding::Decoder<
13137                '_,
13138                fidl::encoding::DefaultFuchsiaResourceDialect,
13139            >,
13140            offset: usize,
13141            _depth: fidl::encoding::Depth,
13142        ) -> fidl::Result<()> {
13143            decoder.debug_check_bounds::<Self>(offset);
13144            // Verify that padding bytes are zero.
13145            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13146            Ok(())
13147        }
13148    }
13149
13150    impl fidl::encoding::ResourceTypeMarker for MmioResourceGetResponse {
13151        type Borrowed<'a> = &'a mut Self;
13152        fn take_or_borrow<'a>(
13153            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13154        ) -> Self::Borrowed<'a> {
13155            value
13156        }
13157    }
13158
13159    unsafe impl fidl::encoding::TypeMarker for MmioResourceGetResponse {
13160        type Owned = Self;
13161
13162        #[inline(always)]
13163        fn inline_align(_context: fidl::encoding::Context) -> usize {
13164            4
13165        }
13166
13167        #[inline(always)]
13168        fn inline_size(_context: fidl::encoding::Context) -> usize {
13169            4
13170        }
13171    }
13172
13173    unsafe impl
13174        fidl::encoding::Encode<
13175            MmioResourceGetResponse,
13176            fidl::encoding::DefaultFuchsiaResourceDialect,
13177        > for &mut MmioResourceGetResponse
13178    {
13179        #[inline]
13180        unsafe fn encode(
13181            self,
13182            encoder: &mut fidl::encoding::Encoder<
13183                '_,
13184                fidl::encoding::DefaultFuchsiaResourceDialect,
13185            >,
13186            offset: usize,
13187            _depth: fidl::encoding::Depth,
13188        ) -> fidl::Result<()> {
13189            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
13190            // Delegate to tuple encoding.
13191            fidl::encoding::Encode::<
13192                MmioResourceGetResponse,
13193                fidl::encoding::DefaultFuchsiaResourceDialect,
13194            >::encode(
13195                (<fidl::encoding::HandleType<
13196                    fidl::Resource,
13197                    { fidl::ObjectType::RESOURCE.into_raw() },
13198                    2147483648,
13199                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13200                    &mut self.resource
13201                ),),
13202                encoder,
13203                offset,
13204                _depth,
13205            )
13206        }
13207    }
13208    unsafe impl<
13209        T0: fidl::encoding::Encode<
13210                fidl::encoding::HandleType<
13211                    fidl::Resource,
13212                    { fidl::ObjectType::RESOURCE.into_raw() },
13213                    2147483648,
13214                >,
13215                fidl::encoding::DefaultFuchsiaResourceDialect,
13216            >,
13217    >
13218        fidl::encoding::Encode<
13219            MmioResourceGetResponse,
13220            fidl::encoding::DefaultFuchsiaResourceDialect,
13221        > for (T0,)
13222    {
13223        #[inline]
13224        unsafe fn encode(
13225            self,
13226            encoder: &mut fidl::encoding::Encoder<
13227                '_,
13228                fidl::encoding::DefaultFuchsiaResourceDialect,
13229            >,
13230            offset: usize,
13231            depth: fidl::encoding::Depth,
13232        ) -> fidl::Result<()> {
13233            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
13234            // Zero out padding regions. There's no need to apply masks
13235            // because the unmasked parts will be overwritten by fields.
13236            // Write the fields.
13237            self.0.encode(encoder, offset + 0, depth)?;
13238            Ok(())
13239        }
13240    }
13241
13242    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13243        for MmioResourceGetResponse
13244    {
13245        #[inline(always)]
13246        fn new_empty() -> Self {
13247            Self {
13248                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13249            }
13250        }
13251
13252        #[inline]
13253        unsafe fn decode(
13254            &mut self,
13255            decoder: &mut fidl::encoding::Decoder<
13256                '_,
13257                fidl::encoding::DefaultFuchsiaResourceDialect,
13258            >,
13259            offset: usize,
13260            _depth: fidl::encoding::Depth,
13261        ) -> fidl::Result<()> {
13262            decoder.debug_check_bounds::<Self>(offset);
13263            // Verify that padding bytes are zero.
13264            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13265            Ok(())
13266        }
13267    }
13268
13269    impl fidl::encoding::ResourceTypeMarker for MsiResourceGetResponse {
13270        type Borrowed<'a> = &'a mut Self;
13271        fn take_or_borrow<'a>(
13272            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13273        ) -> Self::Borrowed<'a> {
13274            value
13275        }
13276    }
13277
13278    unsafe impl fidl::encoding::TypeMarker for MsiResourceGetResponse {
13279        type Owned = Self;
13280
13281        #[inline(always)]
13282        fn inline_align(_context: fidl::encoding::Context) -> usize {
13283            4
13284        }
13285
13286        #[inline(always)]
13287        fn inline_size(_context: fidl::encoding::Context) -> usize {
13288            4
13289        }
13290    }
13291
13292    unsafe impl
13293        fidl::encoding::Encode<
13294            MsiResourceGetResponse,
13295            fidl::encoding::DefaultFuchsiaResourceDialect,
13296        > for &mut MsiResourceGetResponse
13297    {
13298        #[inline]
13299        unsafe fn encode(
13300            self,
13301            encoder: &mut fidl::encoding::Encoder<
13302                '_,
13303                fidl::encoding::DefaultFuchsiaResourceDialect,
13304            >,
13305            offset: usize,
13306            _depth: fidl::encoding::Depth,
13307        ) -> fidl::Result<()> {
13308            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
13309            // Delegate to tuple encoding.
13310            fidl::encoding::Encode::<
13311                MsiResourceGetResponse,
13312                fidl::encoding::DefaultFuchsiaResourceDialect,
13313            >::encode(
13314                (<fidl::encoding::HandleType<
13315                    fidl::Resource,
13316                    { fidl::ObjectType::RESOURCE.into_raw() },
13317                    2147483648,
13318                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13319                    &mut self.resource
13320                ),),
13321                encoder,
13322                offset,
13323                _depth,
13324            )
13325        }
13326    }
13327    unsafe impl<
13328        T0: fidl::encoding::Encode<
13329                fidl::encoding::HandleType<
13330                    fidl::Resource,
13331                    { fidl::ObjectType::RESOURCE.into_raw() },
13332                    2147483648,
13333                >,
13334                fidl::encoding::DefaultFuchsiaResourceDialect,
13335            >,
13336    >
13337        fidl::encoding::Encode<
13338            MsiResourceGetResponse,
13339            fidl::encoding::DefaultFuchsiaResourceDialect,
13340        > for (T0,)
13341    {
13342        #[inline]
13343        unsafe fn encode(
13344            self,
13345            encoder: &mut fidl::encoding::Encoder<
13346                '_,
13347                fidl::encoding::DefaultFuchsiaResourceDialect,
13348            >,
13349            offset: usize,
13350            depth: fidl::encoding::Depth,
13351        ) -> fidl::Result<()> {
13352            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
13353            // Zero out padding regions. There's no need to apply masks
13354            // because the unmasked parts will be overwritten by fields.
13355            // Write the fields.
13356            self.0.encode(encoder, offset + 0, depth)?;
13357            Ok(())
13358        }
13359    }
13360
13361    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13362        for MsiResourceGetResponse
13363    {
13364        #[inline(always)]
13365        fn new_empty() -> Self {
13366            Self {
13367                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13368            }
13369        }
13370
13371        #[inline]
13372        unsafe fn decode(
13373            &mut self,
13374            decoder: &mut fidl::encoding::Decoder<
13375                '_,
13376                fidl::encoding::DefaultFuchsiaResourceDialect,
13377            >,
13378            offset: usize,
13379            _depth: fidl::encoding::Depth,
13380        ) -> fidl::Result<()> {
13381            decoder.debug_check_bounds::<Self>(offset);
13382            // Verify that padding bytes are zero.
13383            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13384            Ok(())
13385        }
13386    }
13387
13388    impl fidl::encoding::ResourceTypeMarker for PowerResourceGetResponse {
13389        type Borrowed<'a> = &'a mut Self;
13390        fn take_or_borrow<'a>(
13391            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13392        ) -> Self::Borrowed<'a> {
13393            value
13394        }
13395    }
13396
13397    unsafe impl fidl::encoding::TypeMarker for PowerResourceGetResponse {
13398        type Owned = Self;
13399
13400        #[inline(always)]
13401        fn inline_align(_context: fidl::encoding::Context) -> usize {
13402            4
13403        }
13404
13405        #[inline(always)]
13406        fn inline_size(_context: fidl::encoding::Context) -> usize {
13407            4
13408        }
13409    }
13410
13411    unsafe impl
13412        fidl::encoding::Encode<
13413            PowerResourceGetResponse,
13414            fidl::encoding::DefaultFuchsiaResourceDialect,
13415        > for &mut PowerResourceGetResponse
13416    {
13417        #[inline]
13418        unsafe fn encode(
13419            self,
13420            encoder: &mut fidl::encoding::Encoder<
13421                '_,
13422                fidl::encoding::DefaultFuchsiaResourceDialect,
13423            >,
13424            offset: usize,
13425            _depth: fidl::encoding::Depth,
13426        ) -> fidl::Result<()> {
13427            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
13428            // Delegate to tuple encoding.
13429            fidl::encoding::Encode::<
13430                PowerResourceGetResponse,
13431                fidl::encoding::DefaultFuchsiaResourceDialect,
13432            >::encode(
13433                (<fidl::encoding::HandleType<
13434                    fidl::Resource,
13435                    { fidl::ObjectType::RESOURCE.into_raw() },
13436                    2147483648,
13437                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13438                    &mut self.resource
13439                ),),
13440                encoder,
13441                offset,
13442                _depth,
13443            )
13444        }
13445    }
13446    unsafe impl<
13447        T0: fidl::encoding::Encode<
13448                fidl::encoding::HandleType<
13449                    fidl::Resource,
13450                    { fidl::ObjectType::RESOURCE.into_raw() },
13451                    2147483648,
13452                >,
13453                fidl::encoding::DefaultFuchsiaResourceDialect,
13454            >,
13455    >
13456        fidl::encoding::Encode<
13457            PowerResourceGetResponse,
13458            fidl::encoding::DefaultFuchsiaResourceDialect,
13459        > for (T0,)
13460    {
13461        #[inline]
13462        unsafe fn encode(
13463            self,
13464            encoder: &mut fidl::encoding::Encoder<
13465                '_,
13466                fidl::encoding::DefaultFuchsiaResourceDialect,
13467            >,
13468            offset: usize,
13469            depth: fidl::encoding::Depth,
13470        ) -> fidl::Result<()> {
13471            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
13472            // Zero out padding regions. There's no need to apply masks
13473            // because the unmasked parts will be overwritten by fields.
13474            // Write the fields.
13475            self.0.encode(encoder, offset + 0, depth)?;
13476            Ok(())
13477        }
13478    }
13479
13480    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13481        for PowerResourceGetResponse
13482    {
13483        #[inline(always)]
13484        fn new_empty() -> Self {
13485            Self {
13486                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13487            }
13488        }
13489
13490        #[inline]
13491        unsafe fn decode(
13492            &mut self,
13493            decoder: &mut fidl::encoding::Decoder<
13494                '_,
13495                fidl::encoding::DefaultFuchsiaResourceDialect,
13496            >,
13497            offset: usize,
13498            _depth: fidl::encoding::Depth,
13499        ) -> fidl::Result<()> {
13500            decoder.debug_check_bounds::<Self>(offset);
13501            // Verify that padding bytes are zero.
13502            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13503            Ok(())
13504        }
13505    }
13506
13507    impl fidl::encoding::ResourceTypeMarker for ProfileResourceGetResponse {
13508        type Borrowed<'a> = &'a mut Self;
13509        fn take_or_borrow<'a>(
13510            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13511        ) -> Self::Borrowed<'a> {
13512            value
13513        }
13514    }
13515
13516    unsafe impl fidl::encoding::TypeMarker for ProfileResourceGetResponse {
13517        type Owned = Self;
13518
13519        #[inline(always)]
13520        fn inline_align(_context: fidl::encoding::Context) -> usize {
13521            4
13522        }
13523
13524        #[inline(always)]
13525        fn inline_size(_context: fidl::encoding::Context) -> usize {
13526            4
13527        }
13528    }
13529
13530    unsafe impl
13531        fidl::encoding::Encode<
13532            ProfileResourceGetResponse,
13533            fidl::encoding::DefaultFuchsiaResourceDialect,
13534        > for &mut ProfileResourceGetResponse
13535    {
13536        #[inline]
13537        unsafe fn encode(
13538            self,
13539            encoder: &mut fidl::encoding::Encoder<
13540                '_,
13541                fidl::encoding::DefaultFuchsiaResourceDialect,
13542            >,
13543            offset: usize,
13544            _depth: fidl::encoding::Depth,
13545        ) -> fidl::Result<()> {
13546            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
13547            // Delegate to tuple encoding.
13548            fidl::encoding::Encode::<
13549                ProfileResourceGetResponse,
13550                fidl::encoding::DefaultFuchsiaResourceDialect,
13551            >::encode(
13552                (<fidl::encoding::HandleType<
13553                    fidl::Resource,
13554                    { fidl::ObjectType::RESOURCE.into_raw() },
13555                    2147483648,
13556                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13557                    &mut self.resource
13558                ),),
13559                encoder,
13560                offset,
13561                _depth,
13562            )
13563        }
13564    }
13565    unsafe impl<
13566        T0: fidl::encoding::Encode<
13567                fidl::encoding::HandleType<
13568                    fidl::Resource,
13569                    { fidl::ObjectType::RESOURCE.into_raw() },
13570                    2147483648,
13571                >,
13572                fidl::encoding::DefaultFuchsiaResourceDialect,
13573            >,
13574    >
13575        fidl::encoding::Encode<
13576            ProfileResourceGetResponse,
13577            fidl::encoding::DefaultFuchsiaResourceDialect,
13578        > for (T0,)
13579    {
13580        #[inline]
13581        unsafe fn encode(
13582            self,
13583            encoder: &mut fidl::encoding::Encoder<
13584                '_,
13585                fidl::encoding::DefaultFuchsiaResourceDialect,
13586            >,
13587            offset: usize,
13588            depth: fidl::encoding::Depth,
13589        ) -> fidl::Result<()> {
13590            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
13591            // Zero out padding regions. There's no need to apply masks
13592            // because the unmasked parts will be overwritten by fields.
13593            // Write the fields.
13594            self.0.encode(encoder, offset + 0, depth)?;
13595            Ok(())
13596        }
13597    }
13598
13599    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13600        for ProfileResourceGetResponse
13601    {
13602        #[inline(always)]
13603        fn new_empty() -> Self {
13604            Self {
13605                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13606            }
13607        }
13608
13609        #[inline]
13610        unsafe fn decode(
13611            &mut self,
13612            decoder: &mut fidl::encoding::Decoder<
13613                '_,
13614                fidl::encoding::DefaultFuchsiaResourceDialect,
13615            >,
13616            offset: usize,
13617            _depth: fidl::encoding::Depth,
13618        ) -> fidl::Result<()> {
13619            decoder.debug_check_bounds::<Self>(offset);
13620            // Verify that padding bytes are zero.
13621            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13622            Ok(())
13623        }
13624    }
13625
13626    impl fidl::encoding::ResourceTypeMarker for RootJobGetResponse {
13627        type Borrowed<'a> = &'a mut Self;
13628        fn take_or_borrow<'a>(
13629            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13630        ) -> Self::Borrowed<'a> {
13631            value
13632        }
13633    }
13634
13635    unsafe impl fidl::encoding::TypeMarker for RootJobGetResponse {
13636        type Owned = Self;
13637
13638        #[inline(always)]
13639        fn inline_align(_context: fidl::encoding::Context) -> usize {
13640            4
13641        }
13642
13643        #[inline(always)]
13644        fn inline_size(_context: fidl::encoding::Context) -> usize {
13645            4
13646        }
13647    }
13648
13649    unsafe impl
13650        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13651        for &mut RootJobGetResponse
13652    {
13653        #[inline]
13654        unsafe fn encode(
13655            self,
13656            encoder: &mut fidl::encoding::Encoder<
13657                '_,
13658                fidl::encoding::DefaultFuchsiaResourceDialect,
13659            >,
13660            offset: usize,
13661            _depth: fidl::encoding::Depth,
13662        ) -> fidl::Result<()> {
13663            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13664            // Delegate to tuple encoding.
13665            fidl::encoding::Encode::<
13666                RootJobGetResponse,
13667                fidl::encoding::DefaultFuchsiaResourceDialect,
13668            >::encode(
13669                (<fidl::encoding::HandleType<
13670                    fidl::Job,
13671                    { fidl::ObjectType::JOB.into_raw() },
13672                    2147483648,
13673                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13674                    &mut self.job
13675                ),),
13676                encoder,
13677                offset,
13678                _depth,
13679            )
13680        }
13681    }
13682    unsafe impl<
13683        T0: fidl::encoding::Encode<
13684                fidl::encoding::HandleType<
13685                    fidl::Job,
13686                    { fidl::ObjectType::JOB.into_raw() },
13687                    2147483648,
13688                >,
13689                fidl::encoding::DefaultFuchsiaResourceDialect,
13690            >,
13691    > fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13692        for (T0,)
13693    {
13694        #[inline]
13695        unsafe fn encode(
13696            self,
13697            encoder: &mut fidl::encoding::Encoder<
13698                '_,
13699                fidl::encoding::DefaultFuchsiaResourceDialect,
13700            >,
13701            offset: usize,
13702            depth: fidl::encoding::Depth,
13703        ) -> fidl::Result<()> {
13704            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13705            // Zero out padding regions. There's no need to apply masks
13706            // because the unmasked parts will be overwritten by fields.
13707            // Write the fields.
13708            self.0.encode(encoder, offset + 0, depth)?;
13709            Ok(())
13710        }
13711    }
13712
13713    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13714        for RootJobGetResponse
13715    {
13716        #[inline(always)]
13717        fn new_empty() -> Self {
13718            Self {
13719                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13720            }
13721        }
13722
13723        #[inline]
13724        unsafe fn decode(
13725            &mut self,
13726            decoder: &mut fidl::encoding::Decoder<
13727                '_,
13728                fidl::encoding::DefaultFuchsiaResourceDialect,
13729            >,
13730            offset: usize,
13731            _depth: fidl::encoding::Depth,
13732        ) -> fidl::Result<()> {
13733            decoder.debug_check_bounds::<Self>(offset);
13734            // Verify that padding bytes are zero.
13735            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
13736            Ok(())
13737        }
13738    }
13739
13740    impl fidl::encoding::ResourceTypeMarker for SamplingResourceGetResponse {
13741        type Borrowed<'a> = &'a mut Self;
13742        fn take_or_borrow<'a>(
13743            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13744        ) -> Self::Borrowed<'a> {
13745            value
13746        }
13747    }
13748
13749    unsafe impl fidl::encoding::TypeMarker for SamplingResourceGetResponse {
13750        type Owned = Self;
13751
13752        #[inline(always)]
13753        fn inline_align(_context: fidl::encoding::Context) -> usize {
13754            4
13755        }
13756
13757        #[inline(always)]
13758        fn inline_size(_context: fidl::encoding::Context) -> usize {
13759            4
13760        }
13761    }
13762
13763    unsafe impl
13764        fidl::encoding::Encode<
13765            SamplingResourceGetResponse,
13766            fidl::encoding::DefaultFuchsiaResourceDialect,
13767        > for &mut SamplingResourceGetResponse
13768    {
13769        #[inline]
13770        unsafe fn encode(
13771            self,
13772            encoder: &mut fidl::encoding::Encoder<
13773                '_,
13774                fidl::encoding::DefaultFuchsiaResourceDialect,
13775            >,
13776            offset: usize,
13777            _depth: fidl::encoding::Depth,
13778        ) -> fidl::Result<()> {
13779            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13780            // Delegate to tuple encoding.
13781            fidl::encoding::Encode::<
13782                SamplingResourceGetResponse,
13783                fidl::encoding::DefaultFuchsiaResourceDialect,
13784            >::encode(
13785                (<fidl::encoding::HandleType<
13786                    fidl::Resource,
13787                    { fidl::ObjectType::RESOURCE.into_raw() },
13788                    2147483648,
13789                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13790                    &mut self.resource
13791                ),),
13792                encoder,
13793                offset,
13794                _depth,
13795            )
13796        }
13797    }
13798    unsafe impl<
13799        T0: fidl::encoding::Encode<
13800                fidl::encoding::HandleType<
13801                    fidl::Resource,
13802                    { fidl::ObjectType::RESOURCE.into_raw() },
13803                    2147483648,
13804                >,
13805                fidl::encoding::DefaultFuchsiaResourceDialect,
13806            >,
13807    >
13808        fidl::encoding::Encode<
13809            SamplingResourceGetResponse,
13810            fidl::encoding::DefaultFuchsiaResourceDialect,
13811        > for (T0,)
13812    {
13813        #[inline]
13814        unsafe fn encode(
13815            self,
13816            encoder: &mut fidl::encoding::Encoder<
13817                '_,
13818                fidl::encoding::DefaultFuchsiaResourceDialect,
13819            >,
13820            offset: usize,
13821            depth: fidl::encoding::Depth,
13822        ) -> fidl::Result<()> {
13823            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13824            // Zero out padding regions. There's no need to apply masks
13825            // because the unmasked parts will be overwritten by fields.
13826            // Write the fields.
13827            self.0.encode(encoder, offset + 0, depth)?;
13828            Ok(())
13829        }
13830    }
13831
13832    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13833        for SamplingResourceGetResponse
13834    {
13835        #[inline(always)]
13836        fn new_empty() -> Self {
13837            Self {
13838                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13839            }
13840        }
13841
13842        #[inline]
13843        unsafe fn decode(
13844            &mut self,
13845            decoder: &mut fidl::encoding::Decoder<
13846                '_,
13847                fidl::encoding::DefaultFuchsiaResourceDialect,
13848            >,
13849            offset: usize,
13850            _depth: fidl::encoding::Depth,
13851        ) -> fidl::Result<()> {
13852            decoder.debug_check_bounds::<Self>(offset);
13853            // Verify that padding bytes are zero.
13854            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13855            Ok(())
13856        }
13857    }
13858
13859    impl fidl::encoding::ResourceTypeMarker for SmcResourceGetResponse {
13860        type Borrowed<'a> = &'a mut Self;
13861        fn take_or_borrow<'a>(
13862            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13863        ) -> Self::Borrowed<'a> {
13864            value
13865        }
13866    }
13867
13868    unsafe impl fidl::encoding::TypeMarker for SmcResourceGetResponse {
13869        type Owned = Self;
13870
13871        #[inline(always)]
13872        fn inline_align(_context: fidl::encoding::Context) -> usize {
13873            4
13874        }
13875
13876        #[inline(always)]
13877        fn inline_size(_context: fidl::encoding::Context) -> usize {
13878            4
13879        }
13880    }
13881
13882    unsafe impl
13883        fidl::encoding::Encode<
13884            SmcResourceGetResponse,
13885            fidl::encoding::DefaultFuchsiaResourceDialect,
13886        > for &mut SmcResourceGetResponse
13887    {
13888        #[inline]
13889        unsafe fn encode(
13890            self,
13891            encoder: &mut fidl::encoding::Encoder<
13892                '_,
13893                fidl::encoding::DefaultFuchsiaResourceDialect,
13894            >,
13895            offset: usize,
13896            _depth: fidl::encoding::Depth,
13897        ) -> fidl::Result<()> {
13898            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13899            // Delegate to tuple encoding.
13900            fidl::encoding::Encode::<
13901                SmcResourceGetResponse,
13902                fidl::encoding::DefaultFuchsiaResourceDialect,
13903            >::encode(
13904                (<fidl::encoding::HandleType<
13905                    fidl::Resource,
13906                    { fidl::ObjectType::RESOURCE.into_raw() },
13907                    2147483648,
13908                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13909                    &mut self.resource
13910                ),),
13911                encoder,
13912                offset,
13913                _depth,
13914            )
13915        }
13916    }
13917    unsafe impl<
13918        T0: fidl::encoding::Encode<
13919                fidl::encoding::HandleType<
13920                    fidl::Resource,
13921                    { fidl::ObjectType::RESOURCE.into_raw() },
13922                    2147483648,
13923                >,
13924                fidl::encoding::DefaultFuchsiaResourceDialect,
13925            >,
13926    >
13927        fidl::encoding::Encode<
13928            SmcResourceGetResponse,
13929            fidl::encoding::DefaultFuchsiaResourceDialect,
13930        > for (T0,)
13931    {
13932        #[inline]
13933        unsafe fn encode(
13934            self,
13935            encoder: &mut fidl::encoding::Encoder<
13936                '_,
13937                fidl::encoding::DefaultFuchsiaResourceDialect,
13938            >,
13939            offset: usize,
13940            depth: fidl::encoding::Depth,
13941        ) -> fidl::Result<()> {
13942            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13943            // Zero out padding regions. There's no need to apply masks
13944            // because the unmasked parts will be overwritten by fields.
13945            // Write the fields.
13946            self.0.encode(encoder, offset + 0, depth)?;
13947            Ok(())
13948        }
13949    }
13950
13951    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13952        for SmcResourceGetResponse
13953    {
13954        #[inline(always)]
13955        fn new_empty() -> Self {
13956            Self {
13957                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13958            }
13959        }
13960
13961        #[inline]
13962        unsafe fn decode(
13963            &mut self,
13964            decoder: &mut fidl::encoding::Decoder<
13965                '_,
13966                fidl::encoding::DefaultFuchsiaResourceDialect,
13967            >,
13968            offset: usize,
13969            _depth: fidl::encoding::Depth,
13970        ) -> fidl::Result<()> {
13971            decoder.debug_check_bounds::<Self>(offset);
13972            // Verify that padding bytes are zero.
13973            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13974            Ok(())
13975        }
13976    }
13977
13978    impl fidl::encoding::ResourceTypeMarker for StallResourceGetResponse {
13979        type Borrowed<'a> = &'a mut Self;
13980        fn take_or_borrow<'a>(
13981            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13982        ) -> Self::Borrowed<'a> {
13983            value
13984        }
13985    }
13986
13987    unsafe impl fidl::encoding::TypeMarker for StallResourceGetResponse {
13988        type Owned = Self;
13989
13990        #[inline(always)]
13991        fn inline_align(_context: fidl::encoding::Context) -> usize {
13992            4
13993        }
13994
13995        #[inline(always)]
13996        fn inline_size(_context: fidl::encoding::Context) -> usize {
13997            4
13998        }
13999    }
14000
14001    unsafe impl
14002        fidl::encoding::Encode<
14003            StallResourceGetResponse,
14004            fidl::encoding::DefaultFuchsiaResourceDialect,
14005        > for &mut StallResourceGetResponse
14006    {
14007        #[inline]
14008        unsafe fn encode(
14009            self,
14010            encoder: &mut fidl::encoding::Encoder<
14011                '_,
14012                fidl::encoding::DefaultFuchsiaResourceDialect,
14013            >,
14014            offset: usize,
14015            _depth: fidl::encoding::Depth,
14016        ) -> fidl::Result<()> {
14017            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
14018            // Delegate to tuple encoding.
14019            fidl::encoding::Encode::<
14020                StallResourceGetResponse,
14021                fidl::encoding::DefaultFuchsiaResourceDialect,
14022            >::encode(
14023                (<fidl::encoding::HandleType<
14024                    fidl::Resource,
14025                    { fidl::ObjectType::RESOURCE.into_raw() },
14026                    2147483648,
14027                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14028                    &mut self.resource
14029                ),),
14030                encoder,
14031                offset,
14032                _depth,
14033            )
14034        }
14035    }
14036    unsafe impl<
14037        T0: fidl::encoding::Encode<
14038                fidl::encoding::HandleType<
14039                    fidl::Resource,
14040                    { fidl::ObjectType::RESOURCE.into_raw() },
14041                    2147483648,
14042                >,
14043                fidl::encoding::DefaultFuchsiaResourceDialect,
14044            >,
14045    >
14046        fidl::encoding::Encode<
14047            StallResourceGetResponse,
14048            fidl::encoding::DefaultFuchsiaResourceDialect,
14049        > for (T0,)
14050    {
14051        #[inline]
14052        unsafe fn encode(
14053            self,
14054            encoder: &mut fidl::encoding::Encoder<
14055                '_,
14056                fidl::encoding::DefaultFuchsiaResourceDialect,
14057            >,
14058            offset: usize,
14059            depth: fidl::encoding::Depth,
14060        ) -> fidl::Result<()> {
14061            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
14062            // Zero out padding regions. There's no need to apply masks
14063            // because the unmasked parts will be overwritten by fields.
14064            // Write the fields.
14065            self.0.encode(encoder, offset + 0, depth)?;
14066            Ok(())
14067        }
14068    }
14069
14070    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14071        for StallResourceGetResponse
14072    {
14073        #[inline(always)]
14074        fn new_empty() -> Self {
14075            Self {
14076                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14077            }
14078        }
14079
14080        #[inline]
14081        unsafe fn decode(
14082            &mut self,
14083            decoder: &mut fidl::encoding::Decoder<
14084                '_,
14085                fidl::encoding::DefaultFuchsiaResourceDialect,
14086            >,
14087            offset: usize,
14088            _depth: fidl::encoding::Depth,
14089        ) -> fidl::Result<()> {
14090            decoder.debug_check_bounds::<Self>(offset);
14091            // Verify that padding bytes are zero.
14092            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
14093            Ok(())
14094        }
14095    }
14096
14097    impl fidl::encoding::ResourceTypeMarker for TracingResourceGetResponse {
14098        type Borrowed<'a> = &'a mut Self;
14099        fn take_or_borrow<'a>(
14100            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14101        ) -> Self::Borrowed<'a> {
14102            value
14103        }
14104    }
14105
14106    unsafe impl fidl::encoding::TypeMarker for TracingResourceGetResponse {
14107        type Owned = Self;
14108
14109        #[inline(always)]
14110        fn inline_align(_context: fidl::encoding::Context) -> usize {
14111            4
14112        }
14113
14114        #[inline(always)]
14115        fn inline_size(_context: fidl::encoding::Context) -> usize {
14116            4
14117        }
14118    }
14119
14120    unsafe impl
14121        fidl::encoding::Encode<
14122            TracingResourceGetResponse,
14123            fidl::encoding::DefaultFuchsiaResourceDialect,
14124        > for &mut TracingResourceGetResponse
14125    {
14126        #[inline]
14127        unsafe fn encode(
14128            self,
14129            encoder: &mut fidl::encoding::Encoder<
14130                '_,
14131                fidl::encoding::DefaultFuchsiaResourceDialect,
14132            >,
14133            offset: usize,
14134            _depth: fidl::encoding::Depth,
14135        ) -> fidl::Result<()> {
14136            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
14137            // Delegate to tuple encoding.
14138            fidl::encoding::Encode::<
14139                TracingResourceGetResponse,
14140                fidl::encoding::DefaultFuchsiaResourceDialect,
14141            >::encode(
14142                (<fidl::encoding::HandleType<
14143                    fidl::Resource,
14144                    { fidl::ObjectType::RESOURCE.into_raw() },
14145                    2147483648,
14146                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14147                    &mut self.resource
14148                ),),
14149                encoder,
14150                offset,
14151                _depth,
14152            )
14153        }
14154    }
14155    unsafe impl<
14156        T0: fidl::encoding::Encode<
14157                fidl::encoding::HandleType<
14158                    fidl::Resource,
14159                    { fidl::ObjectType::RESOURCE.into_raw() },
14160                    2147483648,
14161                >,
14162                fidl::encoding::DefaultFuchsiaResourceDialect,
14163            >,
14164    >
14165        fidl::encoding::Encode<
14166            TracingResourceGetResponse,
14167            fidl::encoding::DefaultFuchsiaResourceDialect,
14168        > for (T0,)
14169    {
14170        #[inline]
14171        unsafe fn encode(
14172            self,
14173            encoder: &mut fidl::encoding::Encoder<
14174                '_,
14175                fidl::encoding::DefaultFuchsiaResourceDialect,
14176            >,
14177            offset: usize,
14178            depth: fidl::encoding::Depth,
14179        ) -> fidl::Result<()> {
14180            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
14181            // Zero out padding regions. There's no need to apply masks
14182            // because the unmasked parts will be overwritten by fields.
14183            // Write the fields.
14184            self.0.encode(encoder, offset + 0, depth)?;
14185            Ok(())
14186        }
14187    }
14188
14189    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14190        for TracingResourceGetResponse
14191    {
14192        #[inline(always)]
14193        fn new_empty() -> Self {
14194            Self {
14195                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14196            }
14197        }
14198
14199        #[inline]
14200        unsafe fn decode(
14201            &mut self,
14202            decoder: &mut fidl::encoding::Decoder<
14203                '_,
14204                fidl::encoding::DefaultFuchsiaResourceDialect,
14205            >,
14206            offset: usize,
14207            _depth: fidl::encoding::Depth,
14208        ) -> fidl::Result<()> {
14209            decoder.debug_check_bounds::<Self>(offset);
14210            // Verify that padding bytes are zero.
14211            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
14212            Ok(())
14213        }
14214    }
14215
14216    impl fidl::encoding::ResourceTypeMarker for VmexResourceGetResponse {
14217        type Borrowed<'a> = &'a mut Self;
14218        fn take_or_borrow<'a>(
14219            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14220        ) -> Self::Borrowed<'a> {
14221            value
14222        }
14223    }
14224
14225    unsafe impl fidl::encoding::TypeMarker for VmexResourceGetResponse {
14226        type Owned = Self;
14227
14228        #[inline(always)]
14229        fn inline_align(_context: fidl::encoding::Context) -> usize {
14230            4
14231        }
14232
14233        #[inline(always)]
14234        fn inline_size(_context: fidl::encoding::Context) -> usize {
14235            4
14236        }
14237    }
14238
14239    unsafe impl
14240        fidl::encoding::Encode<
14241            VmexResourceGetResponse,
14242            fidl::encoding::DefaultFuchsiaResourceDialect,
14243        > for &mut VmexResourceGetResponse
14244    {
14245        #[inline]
14246        unsafe fn encode(
14247            self,
14248            encoder: &mut fidl::encoding::Encoder<
14249                '_,
14250                fidl::encoding::DefaultFuchsiaResourceDialect,
14251            >,
14252            offset: usize,
14253            _depth: fidl::encoding::Depth,
14254        ) -> fidl::Result<()> {
14255            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
14256            // Delegate to tuple encoding.
14257            fidl::encoding::Encode::<
14258                VmexResourceGetResponse,
14259                fidl::encoding::DefaultFuchsiaResourceDialect,
14260            >::encode(
14261                (<fidl::encoding::HandleType<
14262                    fidl::Resource,
14263                    { fidl::ObjectType::RESOURCE.into_raw() },
14264                    2147483648,
14265                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14266                    &mut self.resource
14267                ),),
14268                encoder,
14269                offset,
14270                _depth,
14271            )
14272        }
14273    }
14274    unsafe impl<
14275        T0: fidl::encoding::Encode<
14276                fidl::encoding::HandleType<
14277                    fidl::Resource,
14278                    { fidl::ObjectType::RESOURCE.into_raw() },
14279                    2147483648,
14280                >,
14281                fidl::encoding::DefaultFuchsiaResourceDialect,
14282            >,
14283    >
14284        fidl::encoding::Encode<
14285            VmexResourceGetResponse,
14286            fidl::encoding::DefaultFuchsiaResourceDialect,
14287        > for (T0,)
14288    {
14289        #[inline]
14290        unsafe fn encode(
14291            self,
14292            encoder: &mut fidl::encoding::Encoder<
14293                '_,
14294                fidl::encoding::DefaultFuchsiaResourceDialect,
14295            >,
14296            offset: usize,
14297            depth: fidl::encoding::Depth,
14298        ) -> fidl::Result<()> {
14299            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
14300            // Zero out padding regions. There's no need to apply masks
14301            // because the unmasked parts will be overwritten by fields.
14302            // Write the fields.
14303            self.0.encode(encoder, offset + 0, depth)?;
14304            Ok(())
14305        }
14306    }
14307
14308    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14309        for VmexResourceGetResponse
14310    {
14311        #[inline(always)]
14312        fn new_empty() -> Self {
14313            Self {
14314                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14315            }
14316        }
14317
14318        #[inline]
14319        unsafe fn decode(
14320            &mut self,
14321            decoder: &mut fidl::encoding::Decoder<
14322                '_,
14323                fidl::encoding::DefaultFuchsiaResourceDialect,
14324            >,
14325            offset: usize,
14326            _depth: fidl::encoding::Depth,
14327        ) -> fidl::Result<()> {
14328            decoder.debug_check_bounds::<Self>(offset);
14329            // Verify that padding bytes are zero.
14330            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
14331            Ok(())
14332        }
14333    }
14334}